Search in sources :

Example 6 with MultipartReplyGroupDesc

use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.group.desc._case.MultipartReplyGroupDesc 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());
}
Also used : MultipartReplyMessage(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartReplyMessage) MatchEntry(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entries.grouping.MatchEntry) InPortCase(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.InPortCase) MultipartReplyGroupDescCase(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.MultipartReplyGroupDescCase) SetFieldCase(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.SetFieldCase) MultipartReplyGroupDesc(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.group.desc._case.MultipartReplyGroupDesc) ByteBuf(io.netty.buffer.ByteBuf) SetNwTtlCase(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.SetNwTtlCase) Test(org.junit.Test)

Example 7 with MultipartReplyGroupDesc

use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.group.desc._case.MultipartReplyGroupDesc 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);
}
Also used : MultipartReplyMessage(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartReplyMessage) MultipartReplyGroupDescCase(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.MultipartReplyGroupDescCase) MultipartReplyGroupDesc(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.group.desc._case.MultipartReplyGroupDesc) DecNwTtlCase(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.DecNwTtlCase) SetQueueCase(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.SetQueueCase) PopPbbCase(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.PopPbbCase) GroupCase(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.GroupCase) MultipartReplyGroupCase(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.MultipartReplyGroupCase) ByteBuf(io.netty.buffer.ByteBuf) PopVlanCase(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.PopVlanCase) PopMplsCase(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.PopMplsCase) Test(org.junit.Test)

Example 8 with MultipartReplyGroupDesc

use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.group.desc._case.MultipartReplyGroupDesc 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());
}
Also used : MultipartReplyMessage(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartReplyMessage) PushVlanCase(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.PushVlanCase) MultipartReplyGroupDescCase(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.MultipartReplyGroupDescCase) PushPbbCase(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.PushPbbCase) MultipartReplyGroupDesc(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.group.desc._case.MultipartReplyGroupDesc) SetMplsTtlCase(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.SetMplsTtlCase) ByteBuf(io.netty.buffer.ByteBuf) PushMplsCase(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.PushMplsCase) DecMplsTtlCase(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.DecMplsTtlCase) Test(org.junit.Test)

Example 9 with MultipartReplyGroupDesc

use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.group.desc._case.MultipartReplyGroupDesc in project openflowplugin by opendaylight.

the class MultipartReplyGroupDescDeserializerTest method deserialize.

@Test
public void deserialize() throws Exception {
    ByteBuf buffer = UnpooledByteBufAllocator.DEFAULT.buffer();
    buffer.writeShort(ITEM_LENGTH);
    buffer.writeByte(GROUP_TYPE);
    buffer.writeZero(PADDING_IN_GROUP_DESC_HEADER);
    buffer.writeInt(GROUP_ID);
    buffer.writeShort(BUCKET_LENGTH);
    buffer.writeShort(WEIGHT);
    buffer.writeInt(WATCH_PORT);
    buffer.writeInt(WATCH_GROUP);
    buffer.writeZero(PADDING_IN_BUCKETS_HEADER);
    // POP PBB action
    buffer.writeShort(ActionConstants.POP_PBB_CODE);
    buffer.writeShort(ActionConstants.GENERAL_ACTION_LENGTH);
    buffer.writeZero(ActionConstants.PADDING_IN_ACTION_HEADER);
    final MultipartReplyGroupDesc reply = (MultipartReplyGroupDesc) deserializeMultipart(buffer);
    assertEquals(GROUP_ID, reply.getGroupDescStats().get(0).getGroupId().getValue().intValue());
    assertEquals(WEIGHT, reply.getGroupDescStats().get(0).getBuckets().getBucket().get(0).getWeight().intValue());
    assertEquals(WATCH_PORT, reply.getGroupDescStats().get(0).getBuckets().getBucket().get(0).getWatchPort().intValue());
    assertEquals(WATCH_GROUP, reply.getGroupDescStats().get(0).getBuckets().getBucket().get(0).getWatchGroup().intValue());
    assertEquals(GROUP_TYPE, reply.getGroupDescStats().get(0).getGroupType().getIntValue());
    assertEquals(0, buffer.readableBytes());
}
Also used : MultipartReplyGroupDesc(org.opendaylight.yang.gen.v1.urn.opendaylight.group.statistics.rev131111.multipart.reply.multipart.reply.body.MultipartReplyGroupDesc) ByteBuf(io.netty.buffer.ByteBuf) Test(org.junit.Test)

Aggregations

MultipartReplyGroupDescCase (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.MultipartReplyGroupDescCase)8 MultipartReplyGroupDesc (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.group.desc._case.MultipartReplyGroupDesc)8 ByteBuf (io.netty.buffer.ByteBuf)7 Test (org.junit.Test)6 MultipartReplyMessage (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartReplyMessage)5 ArrayList (java.util.ArrayList)2 List (java.util.List)2 BucketsList (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.buckets.grouping.BucketsList)2 GroupDesc (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.group.desc._case.multipart.reply.group.desc.GroupDesc)2 VersionConvertorData (org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.data.VersionConvertorData)1 FlowAndStatisticsMapList (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.flow.and.statistics.map.list.FlowAndStatisticsMapList)1 GroupDescStatsUpdatedBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.group.statistics.rev131111.GroupDescStatsUpdatedBuilder)1 MultipartReplyGroupDesc (org.opendaylight.yang.gen.v1.urn.opendaylight.group.statistics.rev131111.multipart.reply.multipart.reply.body.MultipartReplyGroupDesc)1 MultipartReplyGroupDescBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.group.statistics.rev131111.multipart.reply.multipart.reply.body.MultipartReplyGroupDescBuilder)1 CopyTtlInCase (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.CopyTtlInCase)1 CopyTtlOutCase (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.CopyTtlOutCase)1 DecMplsTtlCase (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.DecMplsTtlCase)1 DecNwTtlCase (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.DecNwTtlCase)1 GroupCase (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.GroupCase)1 OutputActionCase (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.OutputActionCase)1