import org.opendaylight.openflowjava.nx.codec.match.UdpDstCodec;
import org.opendaylight.openflowjava.nx.codec.match.UdpSrcCodec;
import org.opendaylight.openflowjava.nx.codec.match.InPortCodec;
+import org.opendaylight.openflowjava.nx.codec.match.MplsLabelCodec;
import com.google.common.base.Preconditions;
registrator.registerMatchEntryDeserializer(ArpTpaCodec.DESERIALIZER_KEY, NiciraMatchCodecs.ARP_TPA_CODEC);
registrator.registerMatchEntrySerializer(InPortCodec.SERIALIZER_KEY, NiciraMatchCodecs.NXM_OF_IN_PORT_CODEC);
registrator.registerMatchEntryDeserializer(InPortCodec.DESERIALIZER_KEY, NiciraMatchCodecs.NXM_OF_IN_PORT_CODEC);
+ registrator.registerMatchEntrySerializer(MplsLabelCodec.SERIALIZER_KEY, NiciraMatchCodecs.OXM_OF_MPLS_LABEL);
+ registrator.registerMatchEntryDeserializer(MplsLabelCodec.DESERIALIZER_KEY, NiciraMatchCodecs.OXM_OF_MPLS_LABEL);
registrator.registerMatchEntrySerializer(EthDstCodec.SERIALIZER_KEY, NiciraMatchCodecs.ETH_DST_CODEC);
registrator.registerMatchEntryDeserializer(EthDstCodec.DESERIALIZER_KEY, NiciraMatchCodecs.ETH_DST_CODEC);
registrator.registerMatchEntrySerializer(EthSrcCodec.SERIALIZER_KEY, NiciraMatchCodecs.ETH_SRC_CODEC);
registrator.unregisterMatchEntryDeserializer(ArpTpaCodec.DESERIALIZER_KEY);
registrator.unregisterMatchEntrySerializer(InPortCodec.SERIALIZER_KEY);
registrator.unregisterMatchEntryDeserializer(InPortCodec.DESERIALIZER_KEY);
+ registrator.unregisterMatchEntrySerializer(MplsLabelCodec.SERIALIZER_KEY);
+ registrator.unregisterMatchEntryDeserializer(MplsLabelCodec.DESERIALIZER_KEY);
registrator.unregisterMatchEntrySerializer(EthDstCodec.SERIALIZER_KEY);
registrator.unregisterMatchEntryDeserializer(EthDstCodec.DESERIALIZER_KEY);
registrator.unregisterMatchEntrySerializer(EthSrcCodec.SERIALIZER_KEY);
import org.opendaylight.openflowjava.nx.codec.match.IpSrcCodec;
import org.opendaylight.openflowjava.nx.codec.match.IpDstCodec;
import org.opendaylight.openflowjava.nx.codec.match.InPortCodec;
+import org.opendaylight.openflowjava.nx.codec.match.MplsLabelCodec;
import org.opendaylight.openflowjava.nx.codec.match.Nshc1Codec;
import org.opendaylight.openflowjava.nx.codec.match.Nshc2Codec;
import org.opendaylight.openflowjava.nx.codec.match.Nshc3Codec;
public static final ArpThaCodec ARP_THA_CODEC = new ArpThaCodec();
public static final ArpTpaCodec ARP_TPA_CODEC = new ArpTpaCodec();
public static final InPortCodec NXM_OF_IN_PORT_CODEC = new InPortCodec();
+ public static final MplsLabelCodec OXM_OF_MPLS_LABEL = new MplsLabelCodec();
public static final EthDstCodec ETH_DST_CODEC = new EthDstCodec();
public static final EthSrcCodec ETH_SRC_CODEC = new EthSrcCodec();
public static final TunIpv4DstCodec TUN_IPV4_DST_CODEC = new TunIpv4DstCodec();
--- /dev/null
+/*
+ * Copyright (c) 2016 Ericsson, Inc. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.openflowjava.nx.codec.match;
+
+import org.opendaylight.openflowjava.protocol.api.keys.MatchEntryDeserializerKey;
+import org.opendaylight.openflowjava.protocol.api.keys.MatchEntrySerializerKey;
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.MatchField;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.Nxm0Class;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.OxmClassBase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entries.grouping.MatchEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entries.grouping.MatchEntryBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.NxmOfMplsLabel;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.ofj.oxm.of.mpls.label.grouping.MplsLabelValuesBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.oxm.container.match.entry.value.OfMplsLabelCaseValue;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.oxm.container.match.entry.value.OfMplsLabelCaseValueBuilder;
+
+import io.netty.buffer.ByteBuf;
+
+public class MplsLabelCodec extends AbstractMatchCodec {
+
+ private static final int VALUE_LENGTH = 4;
+ private static final int NXM_FIELD_CODE = 34;
+
+ public static final MatchEntrySerializerKey<Nxm0Class, NxmOfMplsLabel> SERIALIZER_KEY = new MatchEntrySerializerKey<>(
+ EncodeConstants.OF13_VERSION_ID, Nxm0Class.class,
+ NxmOfMplsLabel.class);
+
+ public static final MatchEntryDeserializerKey DESERIALIZER_KEY = new MatchEntryDeserializerKey(
+ EncodeConstants.OF13_VERSION_ID, OxmMatchConstants.NXM_0_CLASS,
+ NXM_FIELD_CODE);
+
+ @Override
+ public void serialize(MatchEntry input, ByteBuf outBuffer) {
+ serializeHeader(input, outBuffer);
+ OfMplsLabelCaseValue value = (OfMplsLabelCaseValue) input.getMatchEntryValue();
+ outBuffer.writeInt(value.getMplsLabelValues().getMplsLabel().intValue());
+ }
+
+ @Override
+ public MatchEntry deserialize(ByteBuf message) {
+ MatchEntryBuilder matchEntryBuilder = deserializeHeader(message);
+ OfMplsLabelCaseValueBuilder caseBuilder = new OfMplsLabelCaseValueBuilder();
+ MplsLabelValuesBuilder valuesBuilder = new MplsLabelValuesBuilder();
+ valuesBuilder.setMplsLabel(message.readLong()).build();
+ caseBuilder.setMplsLabelValues(valuesBuilder.build());
+ matchEntryBuilder.setMatchEntryValue(caseBuilder.build());
+ return matchEntryBuilder.build();
+ }
+
+ @Override
+ public int getNxmFieldCode() {
+ return NXM_FIELD_CODE;
+ }
+
+ @Override
+ public int getOxmClassCode() {
+ return OxmMatchConstants.NXM_0_CLASS;
+ }
+
+ @Override
+ public int getValueLength() {
+ return VALUE_LENGTH;
+ }
+
+ @Override
+ public Class<? extends MatchField> getNxmField() {
+ return NxmOfMplsLabel.class;
+ }
+
+ @Override
+ public Class<? extends OxmClassBase> getOxmClass() {
+ return Nxm0Class.class;
+ }
+}
identity nxm-nx-tun-gpe-np {
base ofoxm:match-field;
}
+ identity nxm-of-mpls-label {
+ base ofoxm:match-field;
+ }
grouping ofj-nxm-nx-match-reg-grouping {
}
}
}
+ grouping ofj-oxm-of-mpls-label-grouping {
+ container mpls-label-values {
+ leaf mpls-label {
+ type uint32;
+ }
+ }
+ }
+
grouping ofj-nxm-nx-match-tun-id-grouping {
container tun-id-values {
leaf value {
case eth-src-case-value {
uses ofj-nxm-of-match-eth-src-grouping;
}
+ case of-mpls-label-case-value {
+ uses ofj-oxm-of-mpls-label-grouping;
+ }
case eth-dst-case-value {
uses ofj-nxm-of-match-eth-dst-grouping;
}
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.dst.choice.grouping.dst.choice.DstOfIpDstCaseBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.dst.choice.grouping.dst.choice.DstOfIpSrcCase;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.dst.choice.grouping.dst.choice.DstOfIpSrcCaseBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.dst.choice.grouping.dst.choice.DstOfMplsLabelCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.dst.choice.grouping.dst.choice.DstOfMplsLabelCaseBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.flows.statistics.update.flow.and.statistics.map.list.instructions.instruction.instruction.apply.actions._case.apply.actions.action.action.NxActionRegMoveNotifFlowsStatisticsUpdateApplyActionsCaseBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.flows.statistics.update.flow.and.statistics.map.list.instructions.instruction.instruction.write.actions._case.write.actions.action.action.NxActionRegMoveNotifFlowsStatisticsUpdateWriteActionsCaseBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.group.desc.stats.updated.group.desc.stats.buckets.bucket.action.action.NxActionRegMoveNotifGroupDescStatsUpdatedCaseBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.src.choice.grouping.src.choice.SrcNxNshMdtypeCaseBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.src.choice.grouping.src.choice.SrcNxNshNpCase;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.src.choice.grouping.src.choice.SrcNxNshNpCaseBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.src.choice.grouping.src.choice.SrcNxOfMplsLabelCase;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.src.choice.grouping.src.choice.SrcNxTunGpeNpCase;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.src.choice.grouping.src.choice.SrcNxTunGpeNpCaseBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.src.choice.grouping.src.choice.SrcNxRegCase;
if (dstValue == NiciraMatchCodecs.NXM_OF_IN_PORT_CODEC.getHeaderWithoutHasMask().toLong()) {
return new DstNxOfInPortCaseBuilder().setOfInPort(true).build();
}
+ if (dstValue == NiciraMatchCodecs.OXM_OF_MPLS_LABEL.getHeaderWithoutHasMask().toLong()) {
+ return new DstOfMplsLabelCaseBuilder().setOfMplsLabel(true).build();
+ }
if (dstValue == NiciraMatchCodecs.ETH_DST_CODEC.getHeaderWithoutHasMask().toLong()) {
return new DstOfEthDstCaseBuilder().setOfEthDst(true).build();
}
if (dstChoice instanceof DstNxOfInPortCase) {
return NiciraMatchCodecs.NXM_OF_IN_PORT_CODEC.getHeaderWithoutHasMask().toLong();
}
+ if (dstChoice instanceof DstOfMplsLabelCase) {
+ return NiciraMatchCodecs.OXM_OF_MPLS_LABEL.getHeaderWithoutHasMask().toLong();
+ }
if (dstChoice instanceof DstNxTunIpv4DstCase) {
return NiciraMatchCodecs.TUN_IPV4_DST_CODEC.getHeaderWithoutHasMask().toLong();
}
if (srcChoice instanceof SrcNxOfInPortCase) {
return NiciraMatchCodecs.NXM_OF_IN_PORT_CODEC.getHeaderWithoutHasMask().toLong();
}
+ if (srcChoice instanceof SrcNxOfMplsLabelCase) {
+ return NiciraMatchCodecs.OXM_OF_MPLS_LABEL.getHeaderWithoutHasMask().toLong();
+ }
if (srcChoice instanceof SrcNxTunIpv4DstCase) {
return NiciraMatchCodecs.TUN_IPV4_DST_CODEC.getHeaderWithoutHasMask().toLong();
}
type empty;
}
}
+ grouping oxm-of-mpls-label-grouping {
+ leaf of-mpls-label {
+ type empty;
+ }
+ }
grouping nxm-of-arp-op-grouping {
leaf of-arp-op {
type empty;
case dst-nx-tun-id-case {
uses nxm-nx-tun-id-grouping;
}
+ case dst-of-mpls-label-case {
+ uses oxm-of-mpls-label-grouping;
+ }
case dst-nx-arp-sha-case {
uses nxm-nx-arp-sha-grouping;
}
case src-nx-tun-id-case {
uses nxm-nx-tun-id-grouping;
}
+ case src-nx-of-mpls-label-case {
+ uses oxm-of-mpls-label-grouping;
+ }
case src-nx-arp-sha-case {
uses nxm-nx-arp-sha-grouping;
}