use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.GroupId in project openflowplugin by opendaylight.
the class MultipartRequestInputMessageFactory method setGroup.
private MultipartRequestGroupCase setGroup(ByteBuf input) {
MultipartRequestGroupCaseBuilder caseBuilder = new MultipartRequestGroupCaseBuilder();
MultipartRequestGroupBuilder groupBuilder = new MultipartRequestGroupBuilder();
groupBuilder.setGroupId(new GroupId(input.readUnsignedInt()));
caseBuilder.setMultipartRequestGroup(groupBuilder.build());
return caseBuilder.build();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.GroupId in project openflowplugin by opendaylight.
the class GroupModInputMessageFactory method deserialize.
@Override
public GroupModInput deserialize(ByteBuf rawMessage) {
GroupModInputBuilder builder = new GroupModInputBuilder();
builder.setVersion((short) EncodeConstants.OF13_VERSION_ID);
builder.setXid(rawMessage.readUnsignedInt());
builder.setCommand(GroupModCommand.forValue(rawMessage.readUnsignedShort()));
builder.setType(GroupType.forValue(rawMessage.readUnsignedByte()));
rawMessage.skipBytes(PADDING);
builder.setGroupId(new GroupId(rawMessage.readUnsignedInt()));
List<BucketsList> bucketsList = new ArrayList<>();
while (rawMessage.readableBytes() > 0) {
BucketsListBuilder bucketsBuilder = new BucketsListBuilder();
final int bucketsLength = rawMessage.readUnsignedShort();
bucketsBuilder.setWeight(rawMessage.readUnsignedShort());
bucketsBuilder.setWatchPort(new PortNumber(rawMessage.readUnsignedInt()));
bucketsBuilder.setWatchGroup(rawMessage.readUnsignedInt());
rawMessage.skipBytes(PADDING_IN_BUCKETS_HEADER);
CodeKeyMaker keyMaker = CodeKeyMakerFactory.createActionsKeyMaker(EncodeConstants.OF13_VERSION_ID);
List<Action> actions = ListDeserializer.deserializeList(EncodeConstants.OF13_VERSION_ID, bucketsLength - BUCKETS_HEADER_LENGTH, rawMessage, keyMaker, registry);
bucketsBuilder.setAction(actions);
bucketsList.add(bucketsBuilder.build());
}
builder.setBucketsList(bucketsList);
return builder.build();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.GroupId in project openflowplugin by opendaylight.
the class MultipartReplyMessageFactoryTest method testMultipartReplyGroupDescBody04.
/**
* Testing {@link MultipartReplyMessageFactory} for correct translation into POJO.
* Test covers bodies of actions NW TTL, Experimenter.
*/
@Test
public void testMultipartReplyGroupDescBody04() {
ByteBuf bb = BufferHelper.buildBuffer("00 07 00 01 00 00 00 00 " + // len
"00 30 " + // type
"01 " + // pad
"00 " + // groupId
"00 00 00 08 " + // bucketLen
"00 28 " + // bucketWeight
"00 06 " + // bucketWatchPort
"00 00 00 05 " + // bucketWatchGroup
"00 00 00 04 " + // bucketPad
"00 00 00 00 " + // nwTTlType
"00 17 " + // nwTTlLen
"00 08 " + // nwTTlnwTTL
"0E " + // nwTTlPad
"00 00 00 " + // setFieldType
"00 19 " + // setFieldLen
"00 10 " + // setFieldOXMClass
"80 00 " + // setFieldOXMField
"00 " + // setFieldOXMLength
"04 " + // setFieldPort
"00 00 00 FF " + "00 00 00 00");
MultipartReplyMessage builtByFactory = BufferHelper.deserialize(multipartFactory, bb);
BufferHelper.checkHeaderV13(builtByFactory);
Assert.assertEquals("Wrong type", 7, builtByFactory.getType().getIntValue());
Assert.assertEquals("Wrong flag", true, builtByFactory.getFlags().isOFPMPFREQMORE());
MultipartReplyGroupDescCase messageCase = (MultipartReplyGroupDescCase) builtByFactory.getMultipartReplyBody();
MultipartReplyGroupDesc message = messageCase.getMultipartReplyGroupDesc();
Assert.assertEquals("Wrong type", 1, message.getGroupDesc().get(0).getType().getIntValue());
Assert.assertEquals("Wrong groupId", 8, message.getGroupDesc().get(0).getGroupId().getValue().intValue());
Assert.assertEquals("Wrong bucketWeight", 6, message.getGroupDesc().get(0).getBucketsList().get(0).getWeight().intValue());
Assert.assertEquals("Wrong bucketWatchPort", 5, message.getGroupDesc().get(0).getBucketsList().get(0).getWatchPort().getValue().intValue());
Assert.assertEquals("Wrong bucketWatchGroup", 4, message.getGroupDesc().get(0).getBucketsList().get(0).getWatchGroup().intValue());
Assert.assertTrue("Wrong nwTTlType", message.getGroupDesc().get(0).getBucketsList().get(0).getAction().get(0).getActionChoice() instanceof SetNwTtlCase);
Assert.assertEquals("Wrong nwTTlnwTTL", 14, ((SetNwTtlCase) message.getGroupDesc().get(0).getBucketsList().get(0).getAction().get(0).getActionChoice()).getSetNwTtlAction().getNwTtl().intValue());
Assert.assertTrue("Wrong setFieldType", message.getGroupDesc().get(0).getBucketsList().get(0).getAction().get(1).getActionChoice() instanceof SetFieldCase);
Assert.assertEquals("Wrong setFieldOXMClass", OpenflowBasicClass.class, ((SetFieldCase) message.getGroupDesc().get(0).getBucketsList().get(0).getAction().get(1).getActionChoice()).getSetFieldAction().getMatchEntry().get(0).getOxmClass());
Assert.assertEquals("Wrong setFieldOXMField", InPort.class, ((SetFieldCase) message.getGroupDesc().get(0).getBucketsList().get(0).getAction().get(1).getActionChoice()).getSetFieldAction().getMatchEntry().get(0).getOxmMatchField());
MatchEntry entry = ((SetFieldCase) message.getGroupDesc().get(0).getBucketsList().get(0).getAction().get(1).getActionChoice()).getSetFieldAction().getMatchEntry().get(0);
Assert.assertEquals("Wrong setFieldOXMValue", 255, ((InPortCase) entry.getMatchEntryValue()).getInPort().getPortNumber().getValue().intValue());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.GroupId in project openflowplugin by opendaylight.
the class MultipartReplyMessageFactoryTest method testMultipartReplyGroupDescBody03.
/**
* Testing {@link MultipartReplyMessageFactory} for correct translation into POJO.
* Test covers bodies of actions Pop VLAN, Pop PBB, Pop MPLS, Group, Dec NW TTL.
*/
@Test
public void testMultipartReplyGroupDescBody03() {
ByteBuf bb = BufferHelper.buildBuffer("00 07 00 01 00 00 00 00 " + // len
"00 48 " + // type
"01 " + // pad
"00 " + // groupId
"00 00 00 08 " + // bucketLen
"00 40 " + // bucketWeight
"00 06 " + // bucketWatchPort
"00 00 00 05 " + // bucketWatchGroup
"00 00 00 04 " + // bucketPad
"00 00 00 00 " + // popVlanType
"00 12 " + // popVlanLen
"00 08 " + // popVlanPad
"00 00 00 00 " + // popPbbType
"00 1B " + // popPbbLen
"00 08 " + // popPbbPad
"00 00 00 00 " + // popMplsType
"00 14 " + // popMplsLen
"00 08 " + // popMplsEthertype
"00 CF " + // popMplsPad
"00 00 " + // setQueueType
"00 15 " + // setQueueLen
"00 08 " + // setQueueQueueId
"00 CF 00 00 " + // groupType
"00 16 " + // groupLen
"00 08 " + // groupGroupId
"00 CF 00 00 " + // decNwTtlType
"00 18 " + // decNwTtlLen
"00 08 " + // decNwTtlPad
"00 00 00 00");
MultipartReplyMessage builtByFactory = BufferHelper.deserialize(multipartFactory, bb);
BufferHelper.checkHeaderV13(builtByFactory);
Assert.assertEquals("Wrong type", 7, builtByFactory.getType().getIntValue());
Assert.assertEquals("Wrong flag", true, builtByFactory.getFlags().isOFPMPFREQMORE());
MultipartReplyGroupDescCase messageCase = (MultipartReplyGroupDescCase) builtByFactory.getMultipartReplyBody();
MultipartReplyGroupDesc message = messageCase.getMultipartReplyGroupDesc();
Assert.assertEquals("Wrong type", 1, message.getGroupDesc().get(0).getType().getIntValue());
Assert.assertEquals("Wrong groupId", 8, message.getGroupDesc().get(0).getGroupId().getValue().intValue());
Assert.assertEquals("Wrong bucketWeight", 6, message.getGroupDesc().get(0).getBucketsList().get(0).getWeight().intValue());
Assert.assertEquals("Wrong bucketWatchPort", 5, message.getGroupDesc().get(0).getBucketsList().get(0).getWatchPort().getValue().intValue());
Assert.assertEquals("Wrong bucketWatchGroup", 4, message.getGroupDesc().get(0).getBucketsList().get(0).getWatchGroup().intValue());
Assert.assertTrue("Wrong popVlanType", message.getGroupDesc().get(0).getBucketsList().get(0).getAction().get(0).getActionChoice() instanceof PopVlanCase);
Assert.assertTrue("Wrong popPbbType", message.getGroupDesc().get(0).getBucketsList().get(0).getAction().get(1).getActionChoice() instanceof PopPbbCase);
Assert.assertTrue("Wrong popMplsType", message.getGroupDesc().get(0).getBucketsList().get(0).getAction().get(2).getActionChoice() instanceof PopMplsCase);
Assert.assertEquals("Wrong popMplsEthertype", 207, ((PopMplsCase) message.getGroupDesc().get(0).getBucketsList().get(0).getAction().get(2).getActionChoice()).getPopMplsAction().getEthertype().getValue().intValue());
Assert.assertTrue("Wrong setQueueType", message.getGroupDesc().get(0).getBucketsList().get(0).getAction().get(3).getActionChoice() instanceof SetQueueCase);
Assert.assertEquals("Wrong setQueueQueueId", 13565952, ((SetQueueCase) message.getGroupDesc().get(0).getBucketsList().get(0).getAction().get(3).getActionChoice()).getSetQueueAction().getQueueId().intValue());
Assert.assertTrue("Wrong groupType", message.getGroupDesc().get(0).getBucketsList().get(0).getAction().get(4).getActionChoice() instanceof GroupCase);
Assert.assertEquals("Wrong groupGroupId", 13565952, ((GroupCase) message.getGroupDesc().get(0).getBucketsList().get(0).getAction().get(4).getActionChoice()).getGroupAction().getGroupId().intValue());
Assert.assertTrue("Wrong decNwTtlType", message.getGroupDesc().get(0).getBucketsList().get(0).getAction().get(5).getActionChoice() instanceof DecNwTtlCase);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.GroupId in project openflowplugin by opendaylight.
the class MultipartReplyMessageFactoryTest method testMultipartReplyGroupDescBody02.
/**
* Testing {@link MultipartReplyMessageFactory} for correct translation into POJO.
* Test covers bodies of actions Set MPLS TTL , Dec MPLS TTL, Push VLAN. Push MPLS, Push PBB.
*/
@Test
public void testMultipartReplyGroupDescBody02() {
ByteBuf bb = BufferHelper.buildBuffer("00 07 00 01 00 00 00 00 " + // len
"00 40 " + // type
"01 " + // pad
"00 " + // groupId
"00 00 00 08 " + // bucketLen
"00 38 " + // bucketWeight
"00 06 " + // bucketWatchPort
"00 00 00 05 " + // bucketWatchGroup
"00 00 00 04 " + // bucketPad
"00 00 00 00 " + // setMplsTtlType
"00 0F " + // setMplsTtlLen
"00 08 " + // setMplsTtlMPLS_TTL
"09 " + // setMplsTtlPad
"00 00 00 " + // decMplsTtlType
"00 10 " + // decMplsTtlLen
"00 08 " + // decMplsTtlPad
"00 00 00 00 " + // pushVlanType
"00 11 " + // pushVlanLen
"00 08 " + // pushVlanEthertype
"00 20 " + // pushVlanPad
"00 00 " + // pushMplsType
"00 13 " + // pushMplsLen
"00 08 " + // pushMplsEthertype
"00 FF " + // pushMplsPad
"00 00 " + // pushPbbType
"00 1A " + // pushPbbLen
"00 08 " + // pushPbbEthertype
"0F FF " + // pushPbbPad
"00 00");
MultipartReplyMessage builtByFactory = BufferHelper.deserialize(multipartFactory, bb);
BufferHelper.checkHeaderV13(builtByFactory);
Assert.assertEquals("Wrong type", 7, builtByFactory.getType().getIntValue());
Assert.assertEquals("Wrong flag", true, builtByFactory.getFlags().isOFPMPFREQMORE());
MultipartReplyGroupDescCase messageCase = (MultipartReplyGroupDescCase) builtByFactory.getMultipartReplyBody();
MultipartReplyGroupDesc message = messageCase.getMultipartReplyGroupDesc();
Assert.assertEquals("Wrong type", 1, message.getGroupDesc().get(0).getType().getIntValue());
Assert.assertEquals("Wrong groupId", 8, message.getGroupDesc().get(0).getGroupId().getValue().intValue());
Assert.assertEquals("Wrong bucketWeight", 6, message.getGroupDesc().get(0).getBucketsList().get(0).getWeight().intValue());
Assert.assertEquals("Wrong bucketWatchPort", 5, message.getGroupDesc().get(0).getBucketsList().get(0).getWatchPort().getValue().intValue());
Assert.assertEquals("Wrong bucketWatchGroup", 4, message.getGroupDesc().get(0).getBucketsList().get(0).getWatchGroup().intValue());
Assert.assertTrue("Wrong setMplsTtlType", message.getGroupDesc().get(0).getBucketsList().get(0).getAction().get(0).getActionChoice() instanceof SetMplsTtlCase);
Assert.assertEquals("Wrong setMplsTtlMPLS_TTL", 9, ((SetMplsTtlCase) message.getGroupDesc().get(0).getBucketsList().get(0).getAction().get(0).getActionChoice()).getSetMplsTtlAction().getMplsTtl().intValue());
Assert.assertTrue("Wrong decMplsTtlType", message.getGroupDesc().get(0).getBucketsList().get(0).getAction().get(1).getActionChoice() instanceof DecMplsTtlCase);
Assert.assertTrue("Wrong pushVlanType", message.getGroupDesc().get(0).getBucketsList().get(0).getAction().get(2).getActionChoice() instanceof PushVlanCase);
Assert.assertEquals("Wrong pushVlanEthertype", 32, ((PushVlanCase) message.getGroupDesc().get(0).getBucketsList().get(0).getAction().get(2).getActionChoice()).getPushVlanAction().getEthertype().getValue().intValue());
Assert.assertTrue("Wrong pushMplsType", message.getGroupDesc().get(0).getBucketsList().get(0).getAction().get(3).getActionChoice() instanceof PushMplsCase);
Assert.assertEquals("Wrong pushMplsEthertype", 255, ((PushMplsCase) message.getGroupDesc().get(0).getBucketsList().get(0).getAction().get(3).getActionChoice()).getPushMplsAction().getEthertype().getValue().intValue());
Assert.assertTrue("Wrong pushPbbType", message.getGroupDesc().get(0).getBucketsList().get(0).getAction().get(4).getActionChoice() instanceof PushPbbCase);
Assert.assertEquals("Wrong pushPbbEthertype", 4095, ((PushPbbCase) message.getGroupDesc().get(0).getBucketsList().get(0).getAction().get(4).getActionChoice()).getPushPbbAction().getEthertype().getValue().intValue());
}
Aggregations