Search in sources :

Example 1 with OpenflowBasicClass

use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.OpenflowBasicClass in project openflowplugin by opendaylight.

the class MatchEntriesInitializer method registerMatchEntrySerializers.

/**
 * Registers match entry serializers into provided registry.
 * @param serializerRegistry registry to be initialized with match entry serializers
 */
public static void registerMatchEntrySerializers(SerializerRegistry serializerRegistry) {
    // register OF v1.3 OpenflowBasicClass match entry serializers
    Class<OpenflowBasicClass> oxmClass = OpenflowBasicClass.class;
    MatchEntrySerializerRegistryHelper<OpenflowBasicClass> helper = new MatchEntrySerializerRegistryHelper<>(EncodeConstants.OF13_VERSION_ID, oxmClass, serializerRegistry);
    helper.registerSerializer(InPort.class, new OxmInPortSerializer());
    helper.registerSerializer(InPhyPort.class, new OxmInPhyPortSerializer());
    helper.registerSerializer(Metadata.class, new OxmMetadataSerializer());
    helper.registerSerializer(EthDst.class, new OxmEthDstSerializer());
    helper.registerSerializer(EthSrc.class, new OxmEthSrcSerializer());
    helper.registerSerializer(EthType.class, new OxmEthTypeSerializer());
    helper.registerSerializer(VlanVid.class, new OxmVlanVidSerializer());
    helper.registerSerializer(VlanPcp.class, new OxmVlanPcpSerializer());
    helper.registerSerializer(IpDscp.class, new OxmIpDscpSerializer());
    helper.registerSerializer(IpEcn.class, new OxmIpEcnSerializer());
    helper.registerSerializer(IpProto.class, new OxmIpProtoSerializer());
    helper.registerSerializer(Ipv4Src.class, new OxmIpv4SrcSerializer());
    helper.registerSerializer(Ipv4Dst.class, new OxmIpv4DstSerializer());
    helper.registerSerializer(TcpSrc.class, new OxmTcpSrcSerializer());
    helper.registerSerializer(TcpDst.class, new OxmTcpDstSerializer());
    helper.registerSerializer(UdpSrc.class, new OxmUdpSrcSerializer());
    helper.registerSerializer(UdpDst.class, new OxmUdpDstSerializer());
    helper.registerSerializer(SctpSrc.class, new OxmSctpSrcSerializer());
    helper.registerSerializer(SctpDst.class, new OxmSctpDstSerializer());
    helper.registerSerializer(Icmpv4Type.class, new OxmIcmpv4TypeSerializer());
    helper.registerSerializer(Icmpv4Code.class, new OxmIcmpv4CodeSerializer());
    helper.registerSerializer(ArpOp.class, new OxmArpOpSerializer());
    helper.registerSerializer(ArpSpa.class, new OxmArpSpaSerializer());
    helper.registerSerializer(ArpTpa.class, new OxmArpTpaSerializer());
    helper.registerSerializer(ArpSha.class, new OxmArpShaSerializer());
    helper.registerSerializer(ArpTha.class, new OxmArpThaSerializer());
    helper.registerSerializer(Ipv6Src.class, new OxmIpv6SrcSerializer());
    helper.registerSerializer(Ipv6Dst.class, new OxmIpv6DstSerializer());
    helper.registerSerializer(Ipv6Flabel.class, new OxmIpv6FlabelSerializer());
    helper.registerSerializer(Icmpv6Type.class, new OxmIcmpv6TypeSerializer());
    helper.registerSerializer(Icmpv6Code.class, new OxmIcmpv6CodeSerializer());
    helper.registerSerializer(Ipv6NdTarget.class, new OxmIpv6NdTargetSerializer());
    helper.registerSerializer(Ipv6NdSll.class, new OxmIpv6NdSllSerializer());
    helper.registerSerializer(Ipv6NdTll.class, new OxmIpv6NdTllSerializer());
    helper.registerSerializer(MplsLabel.class, new OxmMplsLabelSerializer());
    helper.registerSerializer(MplsTc.class, new OxmMplsTcSerializer());
    helper.registerSerializer(MplsBos.class, new OxmMplsBosSerializer());
    helper.registerSerializer(PbbIsid.class, new OxmPbbIsidSerializer());
    helper.registerSerializer(TunnelId.class, new OxmTunnelIdSerializer());
    helper.registerSerializer(Ipv6Exthdr.class, new OxmIpv6ExtHdrSerializer());
    // Register approved openflow match entry serializers
    helper.registerExperimenterSerializer(TcpFlags.class, EncodeConstants.ONF_EXPERIMENTER_ID, new OnfOxmTcpFlagsSerializer());
}
Also used : OxmArpTpaSerializer(org.opendaylight.openflowjava.protocol.impl.serialization.match.OxmArpTpaSerializer) OxmIpv6NdTargetSerializer(org.opendaylight.openflowjava.protocol.impl.serialization.match.OxmIpv6NdTargetSerializer) OxmArpSpaSerializer(org.opendaylight.openflowjava.protocol.impl.serialization.match.OxmArpSpaSerializer) OxmIcmpv6TypeSerializer(org.opendaylight.openflowjava.protocol.impl.serialization.match.OxmIcmpv6TypeSerializer) OxmEthTypeSerializer(org.opendaylight.openflowjava.protocol.impl.serialization.match.OxmEthTypeSerializer) OxmUdpDstSerializer(org.opendaylight.openflowjava.protocol.impl.serialization.match.OxmUdpDstSerializer) OxmIpv6SrcSerializer(org.opendaylight.openflowjava.protocol.impl.serialization.match.OxmIpv6SrcSerializer) OpenflowBasicClass(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.OpenflowBasicClass) OxmTcpDstSerializer(org.opendaylight.openflowjava.protocol.impl.serialization.match.OxmTcpDstSerializer) OxmEthDstSerializer(org.opendaylight.openflowjava.protocol.impl.serialization.match.OxmEthDstSerializer) OxmIpDscpSerializer(org.opendaylight.openflowjava.protocol.impl.serialization.match.OxmIpDscpSerializer) OxmMplsLabelSerializer(org.opendaylight.openflowjava.protocol.impl.serialization.match.OxmMplsLabelSerializer) OxmUdpSrcSerializer(org.opendaylight.openflowjava.protocol.impl.serialization.match.OxmUdpSrcSerializer) OxmIcmpv4CodeSerializer(org.opendaylight.openflowjava.protocol.impl.serialization.match.OxmIcmpv4CodeSerializer) OxmIcmpv4TypeSerializer(org.opendaylight.openflowjava.protocol.impl.serialization.match.OxmIcmpv4TypeSerializer) OxmSctpSrcSerializer(org.opendaylight.openflowjava.protocol.impl.serialization.match.OxmSctpSrcSerializer) OxmMetadataSerializer(org.opendaylight.openflowjava.protocol.impl.serialization.match.OxmMetadataSerializer) OxmVlanPcpSerializer(org.opendaylight.openflowjava.protocol.impl.serialization.match.OxmVlanPcpSerializer) OxmIpv4SrcSerializer(org.opendaylight.openflowjava.protocol.impl.serialization.match.OxmIpv4SrcSerializer) OxmSctpDstSerializer(org.opendaylight.openflowjava.protocol.impl.serialization.match.OxmSctpDstSerializer) OxmIcmpv6CodeSerializer(org.opendaylight.openflowjava.protocol.impl.serialization.match.OxmIcmpv6CodeSerializer) OxmTcpSrcSerializer(org.opendaylight.openflowjava.protocol.impl.serialization.match.OxmTcpSrcSerializer) OxmVlanVidSerializer(org.opendaylight.openflowjava.protocol.impl.serialization.match.OxmVlanVidSerializer) OxmIpProtoSerializer(org.opendaylight.openflowjava.protocol.impl.serialization.match.OxmIpProtoSerializer) OxmIpv4DstSerializer(org.opendaylight.openflowjava.protocol.impl.serialization.match.OxmIpv4DstSerializer) OxmArpShaSerializer(org.opendaylight.openflowjava.protocol.impl.serialization.match.OxmArpShaSerializer) OxmIpv6NdSllSerializer(org.opendaylight.openflowjava.protocol.impl.serialization.match.OxmIpv6NdSllSerializer) OxmArpThaSerializer(org.opendaylight.openflowjava.protocol.impl.serialization.match.OxmArpThaSerializer) OxmIpv6NdTllSerializer(org.opendaylight.openflowjava.protocol.impl.serialization.match.OxmIpv6NdTllSerializer) OxmIpv6FlabelSerializer(org.opendaylight.openflowjava.protocol.impl.serialization.match.OxmIpv6FlabelSerializer) OxmInPortSerializer(org.opendaylight.openflowjava.protocol.impl.serialization.match.OxmInPortSerializer) OxmIpv6DstSerializer(org.opendaylight.openflowjava.protocol.impl.serialization.match.OxmIpv6DstSerializer) MatchEntrySerializerRegistryHelper(org.opendaylight.openflowjava.protocol.impl.util.MatchEntrySerializerRegistryHelper) OxmInPhyPortSerializer(org.opendaylight.openflowjava.protocol.impl.serialization.match.OxmInPhyPortSerializer) OxmMplsTcSerializer(org.opendaylight.openflowjava.protocol.impl.serialization.match.OxmMplsTcSerializer) OxmPbbIsidSerializer(org.opendaylight.openflowjava.protocol.impl.serialization.match.OxmPbbIsidSerializer) OxmEthSrcSerializer(org.opendaylight.openflowjava.protocol.impl.serialization.match.OxmEthSrcSerializer) OxmArpOpSerializer(org.opendaylight.openflowjava.protocol.impl.serialization.match.OxmArpOpSerializer) OxmMplsBosSerializer(org.opendaylight.openflowjava.protocol.impl.serialization.match.OxmMplsBosSerializer) OxmIpEcnSerializer(org.opendaylight.openflowjava.protocol.impl.serialization.match.OxmIpEcnSerializer) OxmTunnelIdSerializer(org.opendaylight.openflowjava.protocol.impl.serialization.match.OxmTunnelIdSerializer) OxmIpv6ExtHdrSerializer(org.opendaylight.openflowjava.protocol.impl.serialization.match.OxmIpv6ExtHdrSerializer) OnfOxmTcpFlagsSerializer(org.opendaylight.openflowjava.protocol.impl.serialization.match.ext.OnfOxmTcpFlagsSerializer)

Example 2 with OpenflowBasicClass

use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.OpenflowBasicClass in project openflowplugin by opendaylight.

the class SwitchConnectionProviderImpl02Test method testUnregisterExistingKeys.

/**
 * Test register and unregister method.
 */
@Test
public void testUnregisterExistingKeys() throws UnknownHostException {
    startUp(TransportProtocol.TCP);
    // -- registerActionSerializer
    final ExperimenterActionSerializerKey key1 = new ExperimenterActionSerializerKey(EncodeConstants.OF10_VERSION_ID, 42L, TestSubType.class);
    provider.registerActionSerializer(key1, serializer);
    Assert.assertTrue("Wrong -- unregister ActionSerializer", provider.unregisterSerializer(key1));
    Assert.assertFalse("Wrong -- unregister ActionSerializer by not existing key", provider.unregisterSerializer(key1));
    // -- registerActionDeserializer
    final ExperimenterActionDeserializerKey key2 = new ExperimenterActionDeserializerKey(EncodeConstants.OF10_VERSION_ID, 42L);
    provider.registerActionDeserializer(key2, deserializer);
    Assert.assertTrue("Wrong -- unregister ActionDeserializer", provider.unregisterDeserializer(key2));
    Assert.assertFalse("Wrong -- unregister ActionDeserializer by not existing key", provider.unregisterDeserializer(key2));
    // -- registerInstructionSerializer
    final ExperimenterInstructionSerializerKey key3 = new ExperimenterInstructionSerializerKey(EncodeConstants.OF10_VERSION_ID, 42L);
    provider.registerInstructionSerializer(key3, serializer);
    Assert.assertTrue("Wrong -- unregister InstructionSerializer", provider.unregisterSerializer(key3));
    Assert.assertFalse("Wrong -- unregister InstructionSerializer by not existing key", provider.unregisterSerializer(key3));
    // -- registerInstructionDeserializer
    final ExperimenterInstructionDeserializerKey key4 = new ExperimenterInstructionDeserializerKey(EncodeConstants.OF10_VERSION_ID, 42L);
    provider.registerInstructionDeserializer(key4, deserializer);
    Assert.assertTrue("Wrong -- unregister InstructionDeserializer", provider.unregisterDeserializer(key4));
    Assert.assertFalse("Wrong -- unregister InstructionDeserializer by not existing key", provider.unregisterDeserializer(key4));
    // -- registerMatchEntryDeserializer
    final MatchEntryDeserializerKey key5 = new MatchEntryDeserializerKey(EncodeConstants.OF10_VERSION_ID, 0x8000, 42);
    provider.registerMatchEntryDeserializer(key5, deserializer);
    Assert.assertTrue("Wrong -- unregister MatchEntryDeserializer", provider.unregisterDeserializer(key5));
    Assert.assertFalse("Wrong -- unregister MatchEntryDeserializer by not existing key", provider.unregisterDeserializer(key5));
    // -- registerErrorDeserializer
    final ExperimenterIdDeserializerKey key6 = new ExperimenterIdDeserializerKey(EncodeConstants.OF10_VERSION_ID, 42L, ErrorMessage.class);
    provider.registerErrorDeserializer(key6, deserializerError);
    Assert.assertTrue("Wrong -- unregister ErrorDeserializer", provider.unregisterDeserializer(key6));
    Assert.assertFalse("Wrong -- unregister ErrorDeserializer by not existing key", provider.unregisterDeserializer(key6));
    // -- registerExperimenterMessageDeserializer
    final ExperimenterIdDeserializerKey key7 = new ExperimenterIdDeserializerKey(EncodeConstants.OF10_VERSION_ID, 42L, ExperimenterMessage.class);
    provider.registerExperimenterMessageDeserializer(key7, deserializerExpMsg);
    Assert.assertTrue("Wrong -- unregister ExperimenterMessageDeserializer", provider.unregisterDeserializer(key7));
    Assert.assertFalse("Wrong -- unregister ExperimenterMessageDeserializer by not existing key", provider.unregisterDeserializer(key7));
    // -- registerMultipartReplyMessageDeserializer
    final ExperimenterIdDeserializerKey key8 = new ExperimenterIdDeserializerKey(EncodeConstants.OF10_VERSION_ID, 42L, MultipartReplyMessage.class);
    provider.registerMultipartReplyMessageDeserializer(key8, deserializerMultipartRplMsg);
    Assert.assertTrue("Wrong -- unregister MultipartReplyMessageDeserializer", provider.unregisterDeserializer(key8));
    Assert.assertFalse("Wrong -- unregister MultipartReplyMessageDeserializer by not existing key", provider.unregisterDeserializer(key8));
    // -- registerMultipartReplyTFDeserializer
    final ExperimenterIdDeserializerKey key9 = new ExperimenterIdDeserializerKey(EncodeConstants.OF10_VERSION_ID, 42L, MultipartReplyMessage.class);
    provider.registerMultipartReplyTFDeserializer(key9, deserializer);
    Assert.assertTrue("Wrong -- unregister MultipartReplyTFDeserializer", provider.unregisterDeserializer(key9));
    Assert.assertFalse("Wrong -- unregister MultipartReplyTFDeserializer by non existing key", provider.unregisterDeserializer(key9));
    // -- registerQueuePropertyDeserializer
    final ExperimenterIdDeserializerKey key10 = new ExperimenterIdDeserializerKey(EncodeConstants.OF10_VERSION_ID, 42L, QueueProperty.class);
    provider.registerQueuePropertyDeserializer(key10, deserializerQueueProperty);
    Assert.assertTrue("Wrong -- unregister QueuePropertyDeserializer", provider.unregisterDeserializer(key10));
    Assert.assertFalse("Wrong -- unregister QueuePropertyDeserializer by not existing key", provider.unregisterDeserializer(key10));
    // -- registerMeterBandDeserializer
    final ExperimenterIdDeserializerKey key11 = new ExperimenterIdDeserializerKey(EncodeConstants.OF10_VERSION_ID, 42L, MeterBandExperimenterCase.class);
    provider.registerMeterBandDeserializer(key11, deserializerMeterBandExpCase);
    Assert.assertTrue("Wrong -- unregister MeterBandDeserializer", provider.unregisterDeserializer(key11));
    Assert.assertFalse("Wrong -- unregister MeterBandDeserializer by not existing key", provider.unregisterDeserializer(key11));
    // -- registerExperimenterMessageSerializer
    ExperimenterIdSerializerKey<ExperimenterDataOfChoice> key12 = new ExperimenterIdSerializerKey<>(EncodeConstants.OF10_VERSION_ID, 42L, ExperimenterDataOfChoice.class);
    provider.registerExperimenterMessageSerializer(key12, serializerExperimenterInput);
    Assert.assertTrue("Wrong -- unregister ExperimenterMessageSerializer", provider.unregisterSerializer(key12));
    Assert.assertFalse("Wrong -- unregister ExperimenterMessageSerializer by not existing key", provider.unregisterSerializer(key12));
    // registerMultipartRequestSerializer
    ExperimenterIdSerializerKey<ExperimenterDataOfChoice> key13 = new ExperimenterIdSerializerKey<>(EncodeConstants.OF10_VERSION_ID, 42L, ExperimenterDataOfChoice.class);
    provider.registerMultipartRequestSerializer(key13, serializerMultipartRequestExpCase);
    Assert.assertTrue("Wrong -- unregister MultipartRequestSerializer", provider.unregisterSerializer(key13));
    Assert.assertFalse("Wrong -- unregister MultipartRequestSerializer by not existing key", provider.unregisterSerializer(key13));
    // -- registerMultipartRequestTFSerializer
    final ExperimenterIdSerializerKey<TableFeatureProperties> key14 = new ExperimenterIdSerializerKey<>(EncodeConstants.OF10_VERSION_ID, 42L, TableFeatureProperties.class);
    provider.registerMultipartRequestTFSerializer(key14, serializer);
    Assert.assertTrue("Wrong -- unregister MultipartRequestTFSerializer", provider.unregisterSerializer(key14));
    Assert.assertFalse("Wrong -- unregister MultipartRequestTFSerializer by not existing key", provider.unregisterSerializer(key14));
    // -- registerMeterBandSerializer
    final ExperimenterIdMeterSubTypeSerializerKey<MeterBandExperimenterCase> key15 = new ExperimenterIdMeterSubTypeSerializerKey<>(EncodeConstants.OF10_VERSION_ID, 42L, MeterBandExperimenterCase.class, null);
    provider.registerMeterBandSerializer(key15, serializerMeterBandExpCase);
    Assert.assertTrue("Wrong -- unregister MeterBandSerializer", provider.unregisterSerializer(key15));
    Assert.assertFalse("Wrong -- unregister MeterBandSerializer by not existing key", provider.unregisterSerializer(key15));
    // -- registerMatchEntrySerializer
    final MatchEntrySerializerKey<OpenflowBasicClass, InPort> key16 = new MatchEntrySerializerKey<>(EncodeConstants.OF13_VERSION_ID, OpenflowBasicClass.class, InPort.class);
    provider.registerMatchEntrySerializer(key16, serializer);
    Assert.assertTrue("Wrong -- unregister MatchEntrySerializer", provider.unregisterSerializer(key16));
    Assert.assertFalse("Wrong -- unregister MatchEntrySerializer by not existing key", provider.unregisterSerializer(key15));
    // -- registerSerializer
    final MessageTypeKey key17 = new MessageTypeKey<>(EncodeConstants.OF13_VERSION_ID, TestSubType.class);
    provider.registerSerializer(key17, serializer);
    // -- registerDeserializer
    final MessageCodeKey key18 = new MessageCodeKey(EncodeConstants.OF13_VERSION_ID, 42, TestSubType.class);
    provider.registerDeserializer(key18, deserializer);
}
Also used : ExperimenterActionDeserializerKey(org.opendaylight.openflowjava.protocol.api.keys.ExperimenterActionDeserializerKey) InPort(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.InPort) MatchEntryDeserializerKey(org.opendaylight.openflowjava.protocol.api.keys.MatchEntryDeserializerKey) TableFeatureProperties(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.table.features.properties.grouping.TableFeatureProperties) OpenflowBasicClass(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.OpenflowBasicClass) ExperimenterIdMeterSubTypeSerializerKey(org.opendaylight.openflowjava.protocol.api.keys.ExperimenterIdMeterSubTypeSerializerKey) ExperimenterInstructionDeserializerKey(org.opendaylight.openflowjava.protocol.api.keys.ExperimenterInstructionDeserializerKey) ExperimenterIdDeserializerKey(org.opendaylight.openflowjava.protocol.api.keys.ExperimenterIdDeserializerKey) MeterBandExperimenterCase(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.meter.band.header.meter.band.MeterBandExperimenterCase) ExperimenterInstructionSerializerKey(org.opendaylight.openflowjava.protocol.api.keys.ExperimenterInstructionSerializerKey) MessageCodeKey(org.opendaylight.openflowjava.protocol.api.keys.MessageCodeKey) ExperimenterActionSerializerKey(org.opendaylight.openflowjava.protocol.api.keys.ExperimenterActionSerializerKey) ExperimenterDataOfChoice(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.experimenter.core.ExperimenterDataOfChoice) MatchEntrySerializerKey(org.opendaylight.openflowjava.protocol.api.keys.MatchEntrySerializerKey) MessageTypeKey(org.opendaylight.openflowjava.protocol.api.keys.MessageTypeKey) ExperimenterIdSerializerKey(org.opendaylight.openflowjava.protocol.api.keys.ExperimenterIdSerializerKey) Test(org.junit.Test)

Example 3 with OpenflowBasicClass

use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.OpenflowBasicClass 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 OpenflowBasicClass

use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.OpenflowBasicClass in project openflowplugin by opendaylight.

the class TableFeaturesResponseConvertor method setSetFieldTableFeatureProperty.

private static List<SetFieldMatch> setSetFieldTableFeatureProperty(final TableFeatureProperties properties, final boolean setHasMask) {
    List<SetFieldMatch> setFieldMatchList = new ArrayList<>();
    SetFieldMatchBuilder setFieldMatchBuilder = new SetFieldMatchBuilder();
    // This handles only OpenflowBasicClass oxm class.
    for (MatchEntry currMatch : properties.getAugmentation(OxmRelatedTableFeatureProperty.class).getMatchEntry()) {
        Class<? extends MatchField> ofMatchField = currMatch.getOxmMatchField();
        if (setHasMask) {
            setFieldMatchBuilder.setHasMask(currMatch.isHasMask());
        }
        setFieldMatchBuilder.setMatchType(OF_TO_SAL_TABLE_FEATURE_PROPERTIES.get(ofMatchField));
        setFieldMatchList.add(setFieldMatchBuilder.build());
    }
    return setFieldMatchList;
}
Also used : SetFieldMatchBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.set.field.match.SetFieldMatchBuilder) MatchEntry(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entries.grouping.MatchEntry) OxmRelatedTableFeatureProperty(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev150225.OxmRelatedTableFeatureProperty) ArrayList(java.util.ArrayList) SetFieldMatch(org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.set.field.match.SetFieldMatch)

Aggregations

Test (org.junit.Test)2 OpenflowBasicClass (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.OpenflowBasicClass)2 MatchEntry (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entries.grouping.MatchEntry)2 ByteBuf (io.netty.buffer.ByteBuf)1 ArrayList (java.util.ArrayList)1 ExperimenterActionDeserializerKey (org.opendaylight.openflowjava.protocol.api.keys.ExperimenterActionDeserializerKey)1 ExperimenterActionSerializerKey (org.opendaylight.openflowjava.protocol.api.keys.ExperimenterActionSerializerKey)1 ExperimenterIdDeserializerKey (org.opendaylight.openflowjava.protocol.api.keys.ExperimenterIdDeserializerKey)1 ExperimenterIdMeterSubTypeSerializerKey (org.opendaylight.openflowjava.protocol.api.keys.ExperimenterIdMeterSubTypeSerializerKey)1 ExperimenterIdSerializerKey (org.opendaylight.openflowjava.protocol.api.keys.ExperimenterIdSerializerKey)1 ExperimenterInstructionDeserializerKey (org.opendaylight.openflowjava.protocol.api.keys.ExperimenterInstructionDeserializerKey)1 ExperimenterInstructionSerializerKey (org.opendaylight.openflowjava.protocol.api.keys.ExperimenterInstructionSerializerKey)1 MatchEntryDeserializerKey (org.opendaylight.openflowjava.protocol.api.keys.MatchEntryDeserializerKey)1 MatchEntrySerializerKey (org.opendaylight.openflowjava.protocol.api.keys.MatchEntrySerializerKey)1 MessageCodeKey (org.opendaylight.openflowjava.protocol.api.keys.MessageCodeKey)1 MessageTypeKey (org.opendaylight.openflowjava.protocol.api.keys.MessageTypeKey)1 OxmArpOpSerializer (org.opendaylight.openflowjava.protocol.impl.serialization.match.OxmArpOpSerializer)1 OxmArpShaSerializer (org.opendaylight.openflowjava.protocol.impl.serialization.match.OxmArpShaSerializer)1 OxmArpSpaSerializer (org.opendaylight.openflowjava.protocol.impl.serialization.match.OxmArpSpaSerializer)1 OxmArpThaSerializer (org.opendaylight.openflowjava.protocol.impl.serialization.match.OxmArpThaSerializer)1