X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=openflow-protocol-impl%2Fsrc%2Ftest%2Fjava%2Forg%2Fopendaylight%2Fopenflowjava%2Fprotocol%2Fimpl%2Futil%2FActionsDeserializerTest.java;h=a63edea95735bf90c54ff2624fd5b25cf1e71df5;hb=6cd66ac6ecd35ddd17b9a489633a2443464e8581;hp=0b133f5cdbec4614f8b66d6fb45f35cfba0e3bd9;hpb=1e5d5241f8df52fa151496ed110b71b627f185ae;p=openflowjava.git diff --git a/openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/util/ActionsDeserializerTest.java b/openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/util/ActionsDeserializerTest.java index 0b133f5c..a63edea9 100644 --- a/openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/util/ActionsDeserializerTest.java +++ b/openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/util/ActionsDeserializerTest.java @@ -14,6 +14,7 @@ import java.util.List; import org.junit.Assert; import org.junit.Test; import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.EthertypeAction; +import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.ExperimenterAction; import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.GroupIdAction; import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MaxLengthAction; import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MplsTtlAction; @@ -22,8 +23,8 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.PortAction; import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.PortNumberMatchEntry; import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.QueueIdAction; -import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.ActionsList; -import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.MatchEntries; +import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.Action; +import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntries; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -55,58 +56,59 @@ public class ActionsDeserializerTest { + "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"); + + "00 1B 00 08 00 00 00 00 " + + "FF FF 00 10 00 00 00 08 00 01 02 03 04 05 06 07"); message.skipBytes(4); // skip XID LOGGER.info("bytes: " + message.readableBytes()); - List actions = ActionsDeserializer.createActionsList(message, message.readableBytes()); + List actions = ActionsDeserializer.createActions(message, message.readableBytes()); Assert.assertEquals("Wrong action type", "org.opendaylight.yang.gen.v1.urn.opendaylight." - + "openflow.common.action.rev130731.Output", actions.get(0).getAction().getType().getName()); + + "openflow.common.action.rev130731.Output", actions.get(0).getType().getName()); Assert.assertEquals("Wrong action port", 1, - actions.get(0).getAction().getAugmentation(PortAction.class).getPort().getValue().intValue()); + actions.get(0).getAugmentation(PortAction.class).getPort().getValue().intValue()); Assert.assertEquals("Wrong action max-length", 2, - actions.get(0).getAction().getAugmentation(MaxLengthAction.class).getMaxLength().intValue()); + actions.get(0).getAugmentation(MaxLengthAction.class).getMaxLength().intValue()); Assert.assertEquals("Wrong action type", "org.opendaylight.yang.gen.v1.urn.opendaylight." - + "openflow.common.action.rev130731.CopyTtlOut", actions.get(1).getAction().getType().getName()); + + "openflow.common.action.rev130731.CopyTtlOut", actions.get(1).getType().getName()); Assert.assertEquals("Wrong action type", "org.opendaylight.yang.gen.v1.urn.opendaylight." - + "openflow.common.action.rev130731.CopyTtlIn", actions.get(2).getAction().getType().getName()); + + "openflow.common.action.rev130731.CopyTtlIn", actions.get(2).getType().getName()); Assert.assertEquals("Wrong action type", "org.opendaylight.yang.gen.v1.urn.opendaylight." - + "openflow.common.action.rev130731.SetMplsTtl", actions.get(3).getAction().getType().getName()); + + "openflow.common.action.rev130731.SetMplsTtl", actions.get(3).getType().getName()); Assert.assertEquals("Wrong action value", 3, - actions.get(3).getAction().getAugmentation(MplsTtlAction.class).getMplsTtl().shortValue()); + actions.get(3).getAugmentation(MplsTtlAction.class).getMplsTtl().shortValue()); Assert.assertEquals("Wrong action type", "org.opendaylight.yang.gen.v1.urn.opendaylight." - + "openflow.common.action.rev130731.DecMplsTtl", actions.get(4).getAction().getType().getName()); + + "openflow.common.action.rev130731.DecMplsTtl", actions.get(4).getType().getName()); Assert.assertEquals("Wrong action type", "org.opendaylight.yang.gen.v1.urn.opendaylight." - + "openflow.common.action.rev130731.PushVlan", actions.get(5).getAction().getType().getName()); + + "openflow.common.action.rev130731.PushVlan", actions.get(5).getType().getName()); Assert.assertEquals("Wrong action value", 4, - actions.get(5).getAction().getAugmentation(EthertypeAction.class).getEthertype().getValue().intValue()); + actions.get(5).getAugmentation(EthertypeAction.class).getEthertype().getValue().intValue()); Assert.assertEquals("Wrong action type", "org.opendaylight.yang.gen.v1.urn.opendaylight." - + "openflow.common.action.rev130731.PopVlan", actions.get(6).getAction().getType().getName()); + + "openflow.common.action.rev130731.PopVlan", actions.get(6).getType().getName()); Assert.assertEquals("Wrong action type", "org.opendaylight.yang.gen.v1.urn.opendaylight." - + "openflow.common.action.rev130731.PushMpls", actions.get(7).getAction().getType().getName()); + + "openflow.common.action.rev130731.PushMpls", actions.get(7).getType().getName()); Assert.assertEquals("Wrong action value", 5, - actions.get(7).getAction().getAugmentation(EthertypeAction.class).getEthertype().getValue().intValue()); + actions.get(7).getAugmentation(EthertypeAction.class).getEthertype().getValue().intValue()); Assert.assertEquals("Wrong action type", "org.opendaylight.yang.gen.v1.urn.opendaylight." - + "openflow.common.action.rev130731.PopMpls", actions.get(8).getAction().getType().getName()); + + "openflow.common.action.rev130731.PopMpls", actions.get(8).getType().getName()); Assert.assertEquals("Wrong action value", 6, - actions.get(8).getAction().getAugmentation(EthertypeAction.class).getEthertype().getValue().intValue()); + actions.get(8).getAugmentation(EthertypeAction.class).getEthertype().getValue().intValue()); Assert.assertEquals("Wrong action type", "org.opendaylight.yang.gen.v1.urn.opendaylight." - + "openflow.common.action.rev130731.SetQueue", actions.get(9).getAction().getType().getName()); + + "openflow.common.action.rev130731.SetQueue", actions.get(9).getType().getName()); Assert.assertEquals("Wrong action value", 7, - actions.get(9).getAction().getAugmentation(QueueIdAction.class).getQueueId().intValue()); + actions.get(9).getAugmentation(QueueIdAction.class).getQueueId().intValue()); Assert.assertEquals("Wrong action type", "org.opendaylight.yang.gen.v1.urn.opendaylight." - + "openflow.common.action.rev130731.Group", actions.get(10).getAction().getType().getName()); + + "openflow.common.action.rev130731.Group", actions.get(10).getType().getName()); Assert.assertEquals("Wrong action value", 8, - actions.get(10).getAction().getAugmentation(GroupIdAction.class).getGroupId().intValue()); + actions.get(10).getAugmentation(GroupIdAction.class).getGroupId().intValue()); Assert.assertEquals("Wrong action type", "org.opendaylight.yang.gen.v1.urn.opendaylight." - + "openflow.common.action.rev130731.SetNwTtl", actions.get(11).getAction().getType().getName()); + + "openflow.common.action.rev130731.SetNwTtl", actions.get(11).getType().getName()); Assert.assertEquals("Wrong action value", 9, - actions.get(11).getAction().getAugmentation(NwTtlAction.class).getNwTtl().intValue()); + actions.get(11).getAugmentation(NwTtlAction.class).getNwTtl().intValue()); Assert.assertEquals("Wrong action type", "org.opendaylight.yang.gen.v1.urn.opendaylight." - + "openflow.common.action.rev130731.DecNwTtl", actions.get(12).getAction().getType().getName()); + + "openflow.common.action.rev130731.DecNwTtl", actions.get(12).getType().getName()); Assert.assertEquals("Wrong action type", "org.opendaylight.yang.gen.v1.urn.opendaylight." - + "openflow.common.action.rev130731.SetField", actions.get(13).getAction().getType().getName()); - List entries = actions.get(13).getAction().getAugmentation(OxmFieldsAction.class).getMatchEntries(); + + "openflow.common.action.rev130731.SetField", actions.get(13).getType().getName()); + List entries = actions.get(13).getAugmentation(OxmFieldsAction.class).getMatchEntries(); Assert.assertEquals("Wrong number of fields", 1, entries.size()); Assert.assertEquals("Wrong match entry class", "org.opendaylight.yang.gen.v1.urn.opendaylight.openflow." + "oxm.rev130731.OpenflowBasicClass", entries.get(0).getOxmClass().getName()); @@ -116,11 +118,17 @@ public class ActionsDeserializerTest { Assert.assertEquals("Wrong match entry value", 11, entries.get(0).getAugmentation(PortNumberMatchEntry.class).getPortNumber().getValue().intValue()); Assert.assertEquals("Wrong action type", "org.opendaylight.yang.gen.v1.urn.opendaylight." - + "openflow.common.action.rev130731.PushPbb", actions.get(14).getAction().getType().getName()); + + "openflow.common.action.rev130731.PushPbb", actions.get(14).getType().getName()); Assert.assertEquals("Wrong action value", 10, - actions.get(14).getAction().getAugmentation(EthertypeAction.class).getEthertype().getValue().intValue()); + actions.get(14).getAugmentation(EthertypeAction.class).getEthertype().getValue().intValue()); Assert.assertEquals("Wrong action type", "org.opendaylight.yang.gen.v1.urn.opendaylight." - + "openflow.common.action.rev130731.PopPbb", actions.get(15).getAction().getType().getName()); + + "openflow.common.action.rev130731.PopPbb", actions.get(15).getType().getName()); + Assert.assertEquals("Wrong action type", "org.opendaylight.yang.gen.v1.urn.opendaylight." + + "openflow.common.action.rev130731.Experimenter", actions.get(16).getType().getName()); + Assert.assertEquals("Wrong experimenter", 8, actions.get(16).getAugmentation(ExperimenterAction.class) + .getExperimenter().intValue()); + Assert.assertArrayEquals("Wrong data", new byte[]{0, 1, 2, 3, 4, 5, 6, 7}, actions.get(16) + .getAugmentation(ExperimenterAction.class).getData()); Assert.assertTrue("Unread data in message", message.readableBytes() == 0); }