Search in sources :

Example 6 with InPortCase

use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.InPortCase 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)

Aggregations

InPortCase (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.InPortCase)4 Test (org.junit.Test)3 MatchEntry (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entries.grouping.MatchEntry)3 ByteBuf (io.netty.buffer.ByteBuf)2 BigInteger (java.math.BigInteger)2 MacAddress (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress)2 MatchBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.MatchBuilder)2 SetFieldCase (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.SetFieldCase)2 SetNwTtlCase (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.SetNwTtlCase)2 List (java.util.List)1 OpenflowVersion (org.opendaylight.openflowplugin.api.openflow.md.util.OpenflowVersion)1 VersionConvertorData (org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.data.VersionConvertorData)1 Dscp (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Dscp)1 Ipv4Address (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Address)1 Ipv4Prefix (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Prefix)1 Ipv6Address (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv6Address)1 PortNumber (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.PortNumber)1 Match (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.Match)1 NodeConnectorId (org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeConnectorId)1 EtherType (org.opendaylight.yang.gen.v1.urn.opendaylight.l2.types.rev130827.EtherType)1