Search in sources :

Example 1 with GroupCase

use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.GroupCase in project openflowplugin by opendaylight.

the class OfToSalGroupCase method process.

@Override
public Optional<Action> process(@Nonnull final GroupCase source, final ActionResponseConvertorData data, ConvertorExecutor convertorExecutor) {
    GroupAction groupActionFromOF = source.getGroupAction();
    GroupActionBuilder groupAction = new GroupActionBuilder();
    groupAction.setGroupId(groupActionFromOF.getGroupId());
    return Optional.of(new GroupActionCaseBuilder().setGroupAction(groupAction.build()).build());
}
Also used : GroupAction(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.group._case.GroupAction) GroupActionCaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.GroupActionCaseBuilder) GroupActionBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.group.action._case.GroupActionBuilder)

Example 2 with GroupCase

use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.GroupCase in project openflowplugin by opendaylight.

the class MultipartReplyMessageFactoryTest method testGroupSerialize.

@Test
public void testGroupSerialize() throws Exception {
    MultipartReplyMessageBuilder builder = new MultipartReplyMessageBuilder();
    BufferHelper.setupHeader(builder, EncodeConstants.OF13_VERSION_ID);
    builder.setFlags(new MultipartRequestFlags(true));
    builder.setType(MultipartType.forValue(6));
    MultipartReplyGroupCaseBuilder groupCase = new MultipartReplyGroupCaseBuilder();
    MultipartReplyGroupBuilder group = new MultipartReplyGroupBuilder();
    group.setGroupStats(createGroupStats());
    groupCase.setMultipartReplyGroup(group.build());
    builder.setMultipartReplyBody(groupCase.build());
    MultipartReplyMessage message = builder.build();
    ByteBuf serializedBuffer = UnpooledByteBufAllocator.DEFAULT.buffer();
    factory.serialize(message, serializedBuffer);
    BufferHelper.checkHeaderV13(serializedBuffer, MESSAGE_TYPE, 72);
    Assert.assertEquals("Wrong type", MultipartType.OFPMPGROUP.getIntValue(), serializedBuffer.readShort());
    Assert.assertEquals("Wrong flags", message.getFlags(), createMultipartRequestFlags(serializedBuffer.readShort()));
    serializedBuffer.skipBytes(PADDING);
    MultipartReplyGroupCase body = (MultipartReplyGroupCase) message.getMultipartReplyBody();
    MultipartReplyGroup messageOutput = body.getMultipartReplyGroup();
    GroupStats groupStats = messageOutput.getGroupStats().get(0);
    Assert.assertEquals("Wrong length", 56, serializedBuffer.readShort());
    serializedBuffer.skipBytes(2);
    Assert.assertEquals("Wrong group id", groupStats.getGroupId().getValue().intValue(), serializedBuffer.readInt());
    Assert.assertEquals("Wrong ref count", groupStats.getRefCount().intValue(), serializedBuffer.readInt());
    serializedBuffer.skipBytes(4);
    Assert.assertEquals("Wrong Packet count", groupStats.getPacketCount().longValue(), serializedBuffer.readLong());
    Assert.assertEquals("Wrong Byte count", groupStats.getByteCount().longValue(), serializedBuffer.readLong());
    Assert.assertEquals("Wrong duration sec", groupStats.getDurationSec().intValue(), serializedBuffer.readInt());
    Assert.assertEquals("Wrong duration nsec", groupStats.getDurationNsec().intValue(), serializedBuffer.readInt());
    BucketStats bucketStats = groupStats.getBucketStats().get(0);
    Assert.assertEquals("Wrong Packet count", bucketStats.getPacketCount().longValue(), serializedBuffer.readLong());
    Assert.assertEquals("Wrong Byte count", bucketStats.getByteCount().longValue(), serializedBuffer.readLong());
}
Also used : MultipartReplyMessage(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartReplyMessage) MultipartReplyGroupCase(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.MultipartReplyGroupCase) MultipartReplyGroupCaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.MultipartReplyGroupCaseBuilder) MultipartReplyMessageBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartReplyMessageBuilder) MultipartReplyGroupBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.group._case.MultipartReplyGroupBuilder) MultipartReplyGroup(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.group._case.MultipartReplyGroup) MultipartRequestFlags(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.MultipartRequestFlags) GroupStats(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.group._case.multipart.reply.group.GroupStats) ByteBuf(io.netty.buffer.ByteBuf) BucketStats(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.group._case.multipart.reply.group.group.stats.BucketStats) Test(org.junit.Test)

Example 3 with GroupCase

use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.GroupCase in project openflowplugin by opendaylight.

the class ActionsDeserializerTest method test.

/**
 * Testing actions deserialization.
 */
@Test
public void test() {
    ByteBuf message = BufferHelper.buildBuffer("00 00 00 10 00 00 00 01 00 02 00 00 00 00 00 00 " + "00 0B 00 08 00 00 00 00 " + "00 0C 00 08 00 00 00 00 " + "00 0F 00 08 03 00 00 00 " + "00 10 00 08 00 00 00 00 " + "00 11 00 08 00 04 00 00 " + "00 12 00 08 00 00 00 00 " + "00 13 00 08 00 05 00 00 " + "00 14 00 08 00 06 00 00 " + "00 15 00 08 00 00 00 07 " + "00 16 00 08 00 00 00 08 " + "00 17 00 08 09 00 00 00 " + "00 18 00 08 00 00 00 00 " + "00 19 00 10 80 00 02 04 00 00 00 0B 00 00 00 00 " + "00 1A 00 08 00 0A 00 00 " + "00 1B 00 08 00 00 00 00");
    // skip XID
    message.skipBytes(4);
    LOG.info("bytes: {}", message.readableBytes());
    CodeKeyMaker keyMaker = CodeKeyMakerFactory.createActionsKeyMaker(EncodeConstants.OF13_VERSION_ID);
    List<Action> actions = ListDeserializer.deserializeList(EncodeConstants.OF13_VERSION_ID, message.readableBytes(), message, keyMaker, registry);
    Assert.assertTrue("Wrong action type", actions.get(0).getActionChoice() instanceof OutputActionCase);
    Assert.assertEquals("Wrong action port", 1, ((OutputActionCase) actions.get(0).getActionChoice()).getOutputAction().getPort().getValue().intValue());
    Assert.assertEquals("Wrong action max-length", 2, ((OutputActionCase) actions.get(0).getActionChoice()).getOutputAction().getMaxLength().intValue());
    Assert.assertTrue("Wrong action type", actions.get(1).getActionChoice() instanceof CopyTtlOutCase);
    Assert.assertTrue("Wrong action type", actions.get(2).getActionChoice() instanceof CopyTtlInCase);
    Assert.assertTrue("Wrong action type", actions.get(3).getActionChoice() instanceof SetMplsTtlCase);
    Assert.assertEquals("Wrong action value", 3, ((SetMplsTtlCase) actions.get(3).getActionChoice()).getSetMplsTtlAction().getMplsTtl().shortValue());
    Assert.assertTrue("Wrong action type", actions.get(4).getActionChoice() instanceof DecMplsTtlCase);
    Assert.assertTrue("Wrong action type", actions.get(5).getActionChoice() instanceof PushVlanCase);
    Assert.assertEquals("Wrong action value", 4, ((PushVlanCase) actions.get(5).getActionChoice()).getPushVlanAction().getEthertype().getValue().intValue());
    Assert.assertTrue("Wrong action type", actions.get(6).getActionChoice() instanceof PopVlanCase);
    Assert.assertTrue("Wrong action type", actions.get(7).getActionChoice() instanceof PushMplsCase);
    Assert.assertEquals("Wrong action value", 5, ((PushMplsCase) actions.get(7).getActionChoice()).getPushMplsAction().getEthertype().getValue().intValue());
    Assert.assertTrue("Wrong action type", actions.get(8).getActionChoice() instanceof PopMplsCase);
    Assert.assertEquals("Wrong action value", 6, ((PopMplsCase) actions.get(8).getActionChoice()).getPopMplsAction().getEthertype().getValue().intValue());
    Assert.assertTrue("Wrong action type", actions.get(9).getActionChoice() instanceof SetQueueCase);
    Assert.assertEquals("Wrong action value", 7, ((SetQueueCase) actions.get(9).getActionChoice()).getSetQueueAction().getQueueId().intValue());
    Assert.assertTrue("Wrong action type", actions.get(10).getActionChoice() instanceof GroupCase);
    Assert.assertEquals("Wrong action value", 8, ((GroupCase) actions.get(10).getActionChoice()).getGroupAction().getGroupId().intValue());
    Assert.assertTrue("Wrong action type", actions.get(11).getActionChoice() instanceof SetNwTtlCase);
    Assert.assertEquals("Wrong action value", 9, ((SetNwTtlCase) actions.get(11).getActionChoice()).getSetNwTtlAction().getNwTtl().intValue());
    Assert.assertTrue("Wrong action type", actions.get(12).getActionChoice() instanceof DecNwTtlCase);
    Assert.assertTrue("Wrong action type", actions.get(13).getActionChoice() instanceof SetFieldCase);
    List<MatchEntry> entries = ((SetFieldCase) actions.get(13).getActionChoice()).getSetFieldAction().getMatchEntry();
    Assert.assertEquals("Wrong number of fields", 1, entries.size());
    Assert.assertEquals("Wrong match entry class", "org.opendaylight.yang.gen.v1.urn.opendaylight.openflow." + "oxm.rev150225.OpenflowBasicClass", entries.get(0).getOxmClass().getName());
    Assert.assertEquals("Wrong match entry field", "org.opendaylight.yang.gen.v1.urn.opendaylight.openflow." + "oxm.rev150225.InPhyPort", entries.get(0).getOxmMatchField().getName());
    Assert.assertEquals("Wrong match entry mask", false, entries.get(0).isHasMask());
    Assert.assertEquals("Wrong match entry value", 11, ((InPhyPortCase) entries.get(0).getMatchEntryValue()).getInPhyPort().getPortNumber().getValue().intValue());
    Assert.assertTrue("Wrong action type", actions.get(14).getActionChoice() instanceof PushPbbCase);
    Assert.assertEquals("Wrong action value", 10, ((PushPbbCase) actions.get(14).getActionChoice()).getPushPbbAction().getEthertype().getValue().intValue());
    Assert.assertTrue("Wrong action type", actions.get(15).getActionChoice() instanceof PopPbbCase);
    Assert.assertTrue("Unread data in message", message.readableBytes() == 0);
}
Also used : Action(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.actions.grouping.Action) PushVlanCase(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.PushVlanCase) MatchEntry(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entries.grouping.MatchEntry) SetFieldCase(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.SetFieldCase) SetMplsTtlCase(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.SetMplsTtlCase) SetQueueCase(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.SetQueueCase) GroupCase(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.GroupCase) ByteBuf(io.netty.buffer.ByteBuf) PushPbbCase(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.PushPbbCase) DecNwTtlCase(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.DecNwTtlCase) InPhyPortCase(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.InPhyPortCase) PopPbbCase(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.PopPbbCase) CopyTtlOutCase(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.CopyTtlOutCase) PushMplsCase(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.PushMplsCase) OutputActionCase(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.OutputActionCase) DecMplsTtlCase(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.DecMplsTtlCase) PopVlanCase(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.PopVlanCase) SetNwTtlCase(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.SetNwTtlCase) CopyTtlInCase(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.CopyTtlInCase) PopMplsCase(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.PopMplsCase) Test(org.junit.Test)

Example 4 with GroupCase

use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.GroupCase in project openflowplugin by opendaylight.

the class ActionConvertorTest method outputActions.

// TODO - check if this method is needed (private and never used locally) - see line 94
private static void outputActions(final List<org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.actions.grouping.Action> ofActionsList) {
    for (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.actions.grouping.Action action : ofActionsList) {
        if (action.getActionChoice() instanceof OutputActionCase) {
            OutputActionCase outputActionCase = (OutputActionCase) action.getActionChoice();
            Assert.assertEquals((Integer) 10, outputActionCase.getOutputAction().getMaxLength());
            long port = 4294967293L;
            Assert.assertEquals(port, (long) outputActionCase.getOutputAction().getPort().getValue());
        }
        if (action.getActionChoice() instanceof CopyTtlInCase) {
            Assert.assertEquals(action.getActionChoice().getImplementedInterface().getName(), CopyTtlInCase.class.getName());
        }
        if (action.getActionChoice() instanceof CopyTtlOutCase) {
            Assert.assertEquals(action.getActionChoice().getImplementedInterface().getName(), CopyTtlOutCase.class.getName());
        }
        if (action.getActionChoice() instanceof SetMplsTtlCase) {
            Assert.assertEquals(action.getActionChoice().getImplementedInterface().getName(), SetMplsTtlCase.class.getName());
        }
        if (action.getActionChoice() instanceof DecMplsTtlCase) {
            Assert.assertEquals(action.getActionChoice().getImplementedInterface().getName(), DecMplsTtlCase.class.getName());
        }
        if (action.getActionChoice() instanceof PushMplsCase) {
            PushMplsCase pushMplsCase = (PushMplsCase) action.getActionChoice();
            EtherType etherType = pushMplsCase.getPushMplsAction().getEthertype();
            if (etherType != null) {
                Assert.assertEquals((Integer) 10, etherType.getValue());
            }
        }
        if (action.getActionChoice() instanceof PopMplsCase) {
            PopMplsCase popMplsCase = (PopMplsCase) action.getActionChoice();
            Assert.assertEquals((Integer) 10, popMplsCase.getPopMplsAction().getEthertype().getValue());
        }
        if (action.getActionChoice() instanceof SetQueueCase) {
            Assert.assertEquals(action.getActionChoice().getImplementedInterface().getName(), SetQueueCase.class.getName());
        }
        if (action.getActionChoice() instanceof GroupCase) {
            GroupCase groupCase = (GroupCase) action.getActionChoice();
            Assert.assertEquals(98, (long) groupCase.getGroupAction().getGroupId());
        }
        if (action.getActionChoice() instanceof PushVlanCase) {
            Assert.assertEquals(action.getActionChoice().getImplementedInterface().getName(), PushVlanCase.class.getName());
        }
        if (action.getActionChoice() instanceof PopVlanCase) {
            Assert.assertEquals(action.getActionChoice().getImplementedInterface().getName(), PopVlanCase.class.getName());
        }
        if (action.getActionChoice() instanceof SetNwTtlCase) {
            Assert.assertEquals(action.getActionChoice().getImplementedInterface().getName(), SetNwTtlCase.class.getName());
        }
        if (action.getActionChoice() instanceof DecNwTtlCase) {
            Assert.assertEquals(action.getActionChoice().getImplementedInterface().getName(), DecNwTtlCase.class.getName());
        }
        if (action.getActionChoice() instanceof PushPbbCase) {
            PushPbbCase pushPbbCase = (PushPbbCase) action.getActionChoice();
            if (pushPbbCase.getPushPbbAction().getEthertype() != null) {
                Assert.assertEquals((Integer) 10, pushPbbCase.getPushPbbAction().getEthertype().getValue());
            }
        }
        if (action.getActionChoice() instanceof PopMplsCase) {
            Assert.assertEquals(action.getActionChoice().getImplementedInterface().getName(), PopMplsCase.class.getName());
        }
        if (action.getActionChoice() instanceof SetFieldCase) {
            SetFieldCase setFieldCase = (SetFieldCase) action.getActionChoice();
            Assert.assertNotNull(setFieldCase.getSetFieldAction());
        /*
                Assert.assertEquals(OpenflowBasicClass.class, sf.getMatchEntry().get(0).getOxmClass());

                if (sf.getMatchEntry().get(0).getOxmMatchField().equals(InPort.class)) {
                    InPortCase inPortCase = ((InPortCase) sf.getMatchEntry().get(0).getMatchEntryValue());
                    Assert.assertEquals(2125, inPortCase.getInPort().getPortNumber().getValue().intValue());

                }
*/
        }
    }
}
Also used : PushVlanCase(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.PushVlanCase) SetFieldCase(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.SetFieldCase) SetMplsTtlCase(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.SetMplsTtlCase) EtherType(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.EtherType) PushPbbCase(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.PushPbbCase) DecNwTtlCase(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.DecNwTtlCase) PushMplsCase(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.PushMplsCase) OutputActionCase(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.OutputActionCase) CopyTtlInCase(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.CopyTtlInCase) SetQueueCase(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.SetQueueCase) GroupCase(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.GroupCase) CopyTtlOutCase(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.CopyTtlOutCase) DecMplsTtlCase(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.DecMplsTtlCase) PopVlanCase(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.PopVlanCase) SetNwTtlCase(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.SetNwTtlCase) PopMplsCase(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.PopMplsCase)

Example 5 with GroupCase

use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.GroupCase in project openflowplugin by opendaylight.

the class MultipartReplyMessageFactoryTest method testGroupDescSerialize.

@Test
public void testGroupDescSerialize() throws Exception {
    MultipartReplyMessageBuilder builder = new MultipartReplyMessageBuilder();
    BufferHelper.setupHeader(builder, EncodeConstants.OF13_VERSION_ID);
    builder.setFlags(new MultipartRequestFlags(true));
    builder.setType(MultipartType.forValue(7));
    MultipartReplyGroupDescCaseBuilder groupCase = new MultipartReplyGroupDescCaseBuilder();
    MultipartReplyGroupDescBuilder group = new MultipartReplyGroupDescBuilder();
    group.setGroupDesc(createGroupDesc());
    groupCase.setMultipartReplyGroupDesc(group.build());
    builder.setMultipartReplyBody(groupCase.build());
    MultipartReplyMessage message = builder.build();
    ByteBuf serializedBuffer = UnpooledByteBufAllocator.DEFAULT.buffer();
    factory.serialize(message, serializedBuffer);
    BufferHelper.checkHeaderV13(serializedBuffer, MESSAGE_TYPE, 64);
    Assert.assertEquals("Wrong type", MultipartType.OFPMPGROUPDESC.getIntValue(), serializedBuffer.readShort());
    Assert.assertEquals("Wrong flags", message.getFlags(), createMultipartRequestFlags(serializedBuffer.readShort()));
    serializedBuffer.skipBytes(PADDING);
    MultipartReplyGroupDescCase body = (MultipartReplyGroupDescCase) message.getMultipartReplyBody();
    MultipartReplyGroupDesc messageOutput = body.getMultipartReplyGroupDesc();
    GroupDesc groupDesc = messageOutput.getGroupDesc().get(0);
    Assert.assertEquals("Wrong length", 48, serializedBuffer.readShort());
    Assert.assertEquals("Wrong type", groupDesc.getType().getIntValue(), serializedBuffer.readUnsignedByte());
    serializedBuffer.skipBytes(1);
    Assert.assertEquals("Wrong group id", groupDesc.getGroupId().getValue().intValue(), serializedBuffer.readInt());
    BucketsList bucketList = groupDesc.getBucketsList().get(0);
    Assert.assertEquals("Wrong length", 40, serializedBuffer.readShort());
    Assert.assertEquals("Wrong weight", bucketList.getWeight().intValue(), serializedBuffer.readShort());
    Assert.assertEquals("Wrong watch port", bucketList.getWatchPort().getValue().intValue(), serializedBuffer.readInt());
    Assert.assertEquals("Wrong watch group", bucketList.getWatchGroup().intValue(), serializedBuffer.readInt());
    serializedBuffer.skipBytes(4);
    Assert.assertEquals("Wrong action type", 0, serializedBuffer.readUnsignedShort());
    Assert.assertEquals("Wrong action length", 16, serializedBuffer.readUnsignedShort());
    Assert.assertEquals("Wrong action type", 45, serializedBuffer.readUnsignedInt());
    Assert.assertEquals("Wrong action type", 55, serializedBuffer.readUnsignedShort());
    serializedBuffer.skipBytes(6);
    Assert.assertEquals("Wrong action type", 23, serializedBuffer.readUnsignedShort());
    Assert.assertEquals("Wrong action length", 8, serializedBuffer.readUnsignedShort());
    Assert.assertEquals("Wrong action type", 64, serializedBuffer.readUnsignedByte());
    serializedBuffer.skipBytes(3);
    Assert.assertTrue("Not all data were read", serializedBuffer.readableBytes() == 0);
}
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) MultipartReplyMessageBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartReplyMessageBuilder) 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) MultipartReplyGroupDesc(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.group.desc._case.MultipartReplyGroupDesc) MultipartReplyGroupDesc(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.group.desc._case.MultipartReplyGroupDesc) MultipartRequestFlags(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.MultipartRequestFlags) ByteBuf(io.netty.buffer.ByteBuf) BucketsList(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.buckets.grouping.BucketsList) MultipartReplyGroupDescCaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.MultipartReplyGroupDescCaseBuilder) MultipartReplyGroupDescBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.group.desc._case.MultipartReplyGroupDescBuilder) Test(org.junit.Test)

Aggregations

ByteBuf (io.netty.buffer.ByteBuf)6 Test (org.junit.Test)5 GroupCase (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.GroupCase)4 SetQueueCase (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.SetQueueCase)4 MultipartReplyGroupCase (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.MultipartReplyGroupCase)4 DecNwTtlCase (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.DecNwTtlCase)3 OutputActionCase (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.OutputActionCase)3 PopMplsCase (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.PopMplsCase)3 PopVlanCase (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.PopVlanCase)3 SetMplsTtlCase (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.SetMplsTtlCase)3 MultipartReplyMessage (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartReplyMessage)3 MultipartReplyGroup (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.group._case.MultipartReplyGroup)3 GroupStats (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.group._case.multipart.reply.group.GroupStats)3 CopyTtlInCase (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.CopyTtlInCase)2 CopyTtlOutCase (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.CopyTtlOutCase)2 DecMplsTtlCase (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.DecMplsTtlCase)2 PopPbbCase (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.PopPbbCase)2 PushMplsCase (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.PushMplsCase)2 PushPbbCase (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.PushPbbCase)2 PushVlanCase (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.PushVlanCase)2