From: Srini Seetharaman Date: Fri, 31 Oct 2014 17:01:23 +0000 (-0700) Subject: Adding Nicira actions and match for NSH Index and path fields. X-Git-Tag: release/lithium~711 X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=commitdiff_plain;h=7a7fecfe44709588424f64806f338bb90314553e;p=openflowplugin.git Adding Nicira actions and match for NSH Index and path fields. match.nsi, match.nsp, action.set_nsi and action.set_nsp. This is part of the consolidation of Nicira OF extensions from the OVSDB project. Signed-off-by: Srini Seetharaman --- diff --git a/extension/openflowjava-extension-nicira/src/main/java/org/opendaylight/openflowjava/nx/NiciraExtensionsRegistrator.java b/extension/openflowjava-extension-nicira/src/main/java/org/opendaylight/openflowjava/nx/NiciraExtensionsRegistrator.java index 6f64c76d9a..3feb068f8c 100644 --- a/extension/openflowjava-extension-nicira/src/main/java/org/opendaylight/openflowjava/nx/NiciraExtensionsRegistrator.java +++ b/extension/openflowjava-extension-nicira/src/main/java/org/opendaylight/openflowjava/nx/NiciraExtensionsRegistrator.java @@ -7,6 +7,8 @@ import org.opendaylight.openflowjava.nx.codec.action.RegLoadCodec; import org.opendaylight.openflowjava.nx.codec.action.RegMoveCodec; import org.opendaylight.openflowjava.nx.codec.action.ResubmitCodec; import org.opendaylight.openflowjava.nx.codec.action.MultipathCodec; +import org.opendaylight.openflowjava.nx.codec.action.SetNspCodec; +import org.opendaylight.openflowjava.nx.codec.action.SetNsiCodec; import org.opendaylight.openflowjava.nx.codec.match.ArpOpCodec; import org.opendaylight.openflowjava.nx.codec.match.ArpShaCodec; import org.opendaylight.openflowjava.nx.codec.match.ArpSpaCodec; @@ -26,6 +28,8 @@ import org.opendaylight.openflowjava.nx.codec.match.Reg7Codec; import org.opendaylight.openflowjava.nx.codec.match.TunIdCodec; import org.opendaylight.openflowjava.nx.codec.match.TunIpv4DstCodec; import org.opendaylight.openflowjava.nx.codec.match.TunIpv4SrcCodec; +import org.opendaylight.openflowjava.nx.codec.match.NspCodec; +import org.opendaylight.openflowjava.nx.codec.match.NsiCodec; import com.google.common.base.Preconditions; @@ -48,6 +52,16 @@ public class NiciraExtensionsRegistrator implements AutoCloseable { registrator.registerActionSerializer(RegMoveCodec.SERIALIZER_KEY, NiciraActionCodecs.REG_MOVE_CODEC); registrator.registerActionDeserializer(OutputRegCodec.DESERIALIZER_KEY, NiciraActionCodecs.OUTPUT_REG_CODEC); registrator.registerActionSerializer(OutputRegCodec.SERIALIZER_KEY, NiciraActionCodecs.OUTPUT_REG_CODEC); + registrator.registerActionSerializer(ResubmitCodec.SERIALIZER_KEY, NiciraActionCodecs.RESUBMIT_CODEC); + registrator.registerActionDeserializer(ResubmitCodec.DESERIALIZER_KEY, NiciraActionCodecs.RESUBMIT_CODEC); + registrator.registerActionDeserializer(ResubmitCodec.TABLE_DESERIALIZER_KEY, NiciraActionCodecs.RESUBMIT_CODEC); + registrator.registerActionSerializer(MultipathCodec.SERIALIZER_KEY, NiciraActionCodecs.MULTIPATH_CODEC); + registrator.registerActionDeserializer(MultipathCodec.DESERIALIZER_KEY, NiciraActionCodecs.MULTIPATH_CODEC); + registrator.registerActionDeserializer(SetNspCodec.DESERIALIZER_KEY, NiciraActionCodecs.SET_NSP_CODEC); + registrator.registerActionSerializer(SetNspCodec.SERIALIZER_KEY, NiciraActionCodecs.SET_NSP_CODEC); + registrator.registerActionDeserializer(SetNsiCodec.DESERIALIZER_KEY, NiciraActionCodecs.SET_NSI_CODEC); + registrator.registerActionSerializer(SetNsiCodec.SERIALIZER_KEY, NiciraActionCodecs.SET_NSI_CODEC); + registrator.registerMatchEntrySerializer(Reg0Codec.SERIALIZER_KEY, NiciraMatchCodecs.REG0_CODEC); registrator.registerMatchEntryDeserializer(Reg0Codec.DESERIALIZER_KEY, NiciraMatchCodecs.REG0_CODEC); registrator.registerMatchEntrySerializer(Reg1Codec.SERIALIZER_KEY, NiciraMatchCodecs.REG1_CODEC); @@ -86,11 +100,10 @@ public class NiciraExtensionsRegistrator implements AutoCloseable { registrator.registerMatchEntryDeserializer(TunIpv4SrcCodec.DESERIALIZER_KEY, NiciraMatchCodecs.TUN_IPV4_SRC_CODEC); registrator.registerMatchEntrySerializer(EthTypeCodec.SERIALIZER_KEY, NiciraMatchCodecs.ETH_TYPE_CODEC); registrator.registerMatchEntryDeserializer(EthTypeCodec.DESERIALIZER_KEY, NiciraMatchCodecs.ETH_TYPE_CODEC); - registrator.registerActionSerializer(ResubmitCodec.SERIALIZER_KEY, NiciraActionCodecs.RESUBMIT_CODEC); - registrator.registerActionDeserializer(ResubmitCodec.DESERIALIZER_KEY, NiciraActionCodecs.RESUBMIT_CODEC); - registrator.registerActionDeserializer(ResubmitCodec.TABLE_DESERIALIZER_KEY, NiciraActionCodecs.RESUBMIT_CODEC); - registrator.registerActionSerializer(MultipathCodec.SERIALIZER_KEY, NiciraActionCodecs.MULTIPATH_CODEC); - registrator.registerActionDeserializer(MultipathCodec.DESERIALIZER_KEY, NiciraActionCodecs.MULTIPATH_CODEC); + registrator.registerMatchEntrySerializer(NspCodec.SERIALIZER_KEY, NiciraMatchCodecs.NSP_CODEC); + registrator.registerMatchEntryDeserializer(NspCodec.DESERIALIZER_KEY, NiciraMatchCodecs.NSP_CODEC); + registrator.registerMatchEntrySerializer(NsiCodec.SERIALIZER_KEY, NiciraMatchCodecs.NSI_CODEC); + registrator.registerMatchEntryDeserializer(NsiCodec.DESERIALIZER_KEY, NiciraMatchCodecs.NSI_CODEC); } public void unregisterExtensions() { @@ -100,6 +113,16 @@ public class NiciraExtensionsRegistrator implements AutoCloseable { registrator.unregisterActionSerializer(RegMoveCodec.SERIALIZER_KEY); registrator.unregisterActionDeserializer(OutputRegCodec.DESERIALIZER_KEY); registrator.unregisterActionSerializer(OutputRegCodec.SERIALIZER_KEY); + registrator.unregisterActionSerializer(ResubmitCodec.SERIALIZER_KEY); + registrator.unregisterActionDeserializer(ResubmitCodec.TABLE_DESERIALIZER_KEY); + registrator.unregisterActionDeserializer(ResubmitCodec.DESERIALIZER_KEY); + registrator.unregisterActionSerializer(MultipathCodec.SERIALIZER_KEY); + registrator.unregisterActionDeserializer(MultipathCodec.DESERIALIZER_KEY); + registrator.unregisterActionDeserializer(SetNsiCodec.DESERIALIZER_KEY); + registrator.unregisterActionSerializer(SetNsiCodec.SERIALIZER_KEY); + registrator.unregisterActionDeserializer(SetNspCodec.DESERIALIZER_KEY); + registrator.unregisterActionSerializer(SetNspCodec.SERIALIZER_KEY); + registrator.unregisterMatchEntrySerializer(Reg0Codec.SERIALIZER_KEY); registrator.unregisterMatchEntryDeserializer(Reg0Codec.DESERIALIZER_KEY); registrator.unregisterMatchEntrySerializer(Reg1Codec.SERIALIZER_KEY); @@ -138,11 +161,10 @@ public class NiciraExtensionsRegistrator implements AutoCloseable { registrator.unregisterMatchEntryDeserializer(TunIpv4SrcCodec.DESERIALIZER_KEY); registrator.unregisterMatchEntrySerializer(EthTypeCodec.SERIALIZER_KEY); registrator.unregisterMatchEntryDeserializer(EthTypeCodec.DESERIALIZER_KEY); - registrator.unregisterActionSerializer(ResubmitCodec.SERIALIZER_KEY); - registrator.unregisterActionDeserializer(ResubmitCodec.TABLE_DESERIALIZER_KEY); - registrator.unregisterActionDeserializer(ResubmitCodec.DESERIALIZER_KEY); - registrator.unregisterActionSerializer(MultipathCodec.SERIALIZER_KEY); - registrator.unregisterActionDeserializer(MultipathCodec.DESERIALIZER_KEY); + registrator.unregisterMatchEntrySerializer(NspCodec.SERIALIZER_KEY); + registrator.unregisterMatchEntryDeserializer(NspCodec.DESERIALIZER_KEY); + registrator.unregisterMatchEntrySerializer(NsiCodec.SERIALIZER_KEY); + registrator.unregisterMatchEntryDeserializer(NsiCodec.DESERIALIZER_KEY); } @Override diff --git a/extension/openflowjava-extension-nicira/src/main/java/org/opendaylight/openflowjava/nx/NiciraMatchCodecs.java b/extension/openflowjava-extension-nicira/src/main/java/org/opendaylight/openflowjava/nx/NiciraMatchCodecs.java index b9422f5192..5e2f41305a 100644 --- a/extension/openflowjava-extension-nicira/src/main/java/org/opendaylight/openflowjava/nx/NiciraMatchCodecs.java +++ b/extension/openflowjava-extension-nicira/src/main/java/org/opendaylight/openflowjava/nx/NiciraMatchCodecs.java @@ -26,6 +26,8 @@ import org.opendaylight.openflowjava.nx.codec.match.Reg7Codec; import org.opendaylight.openflowjava.nx.codec.match.TunIdCodec; import org.opendaylight.openflowjava.nx.codec.match.TunIpv4DstCodec; import org.opendaylight.openflowjava.nx.codec.match.TunIpv4SrcCodec; +import org.opendaylight.openflowjava.nx.codec.match.NspCodec; +import org.opendaylight.openflowjava.nx.codec.match.NsiCodec; /** * @author msunal @@ -52,5 +54,6 @@ public class NiciraMatchCodecs { public static final TunIpv4DstCodec TUN_IPV4_DST_CODEC = new TunIpv4DstCodec(); public static final TunIpv4SrcCodec TUN_IPV4_SRC_CODEC = new TunIpv4SrcCodec(); public static final EthTypeCodec ETH_TYPE_CODEC = new EthTypeCodec(); - + public static final NspCodec NSP_CODEC = new NspCodec(); + public static final NsiCodec NSI_CODEC = new NsiCodec(); } diff --git a/extension/openflowjava-extension-nicira/src/main/java/org/opendaylight/openflowjava/nx/codec/action/NiciraActionCodecs.java b/extension/openflowjava-extension-nicira/src/main/java/org/opendaylight/openflowjava/nx/codec/action/NiciraActionCodecs.java index 77f09eb383..7e1f1ac70f 100644 --- a/extension/openflowjava-extension-nicira/src/main/java/org/opendaylight/openflowjava/nx/codec/action/NiciraActionCodecs.java +++ b/extension/openflowjava-extension-nicira/src/main/java/org/opendaylight/openflowjava/nx/codec/action/NiciraActionCodecs.java @@ -18,4 +18,6 @@ public class NiciraActionCodecs { public static final OutputRegCodec OUTPUT_REG_CODEC = new OutputRegCodec(); public static final ResubmitCodec RESUBMIT_CODEC = new ResubmitCodec(); public static final MultipathCodec MULTIPATH_CODEC = new MultipathCodec(); + public static final SetNspCodec SET_NSP_CODEC = new SetNspCodec(); + public static final SetNsiCodec SET_NSI_CODEC = new SetNsiCodec(); } diff --git a/extension/openflowjava-extension-nicira/src/main/java/org/opendaylight/openflowjava/nx/codec/action/SetNsiCodec.java b/extension/openflowjava-extension-nicira/src/main/java/org/opendaylight/openflowjava/nx/codec/action/SetNsiCodec.java new file mode 100644 index 0000000000..424113c509 --- /dev/null +++ b/extension/openflowjava-extension-nicira/src/main/java/org/opendaylight/openflowjava/nx/codec/action/SetNsiCodec.java @@ -0,0 +1,63 @@ +/* + * Copyright (C) 2014 Red Hat, Inc. + * + * 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 + * + * Authors : Madhu Venugopal + */ + +package org.opendaylight.openflowjava.nx.codec.action; + +import io.netty.buffer.ByteBuf; + +import org.opendaylight.openflowjava.nx.api.NiciraActionDeserializerKey; +import org.opendaylight.openflowjava.nx.api.NiciraActionSerializerKey; +import org.opendaylight.openflowjava.nx.codec.action.AbstractActionCodec; +import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants; +import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.ExperimenterIdAction; +import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.Action; +import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.ActionBuilder; +import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.NxmNxSetNsi; +import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.OfjAugNxAction; +import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.OfjAugNxActionBuilder; +import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.ofj.nx.action.set.nsi.grouping.ActionSetNsi; +import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.ofj.nx.action.set.nsi.grouping.ActionSetNsiBuilder; + +/** + * Codec for the NX_SetNsi and NX_SetNsi_TABLE + */ +public class SetNsiCodec extends AbstractActionCodec { + public static final int LENGTH = 16; + public static final byte NXAST_SET_NSI_SUBTYPE = 33; + public static final NiciraActionSerializerKey SERIALIZER_KEY = + new NiciraActionSerializerKey(EncodeConstants.OF13_VERSION_ID, NxmNxSetNsi.class); + public static final NiciraActionDeserializerKey DESERIALIZER_KEY = + new NiciraActionDeserializerKey(EncodeConstants.OF13_VERSION_ID, NXAST_SET_NSI_SUBTYPE); + private static final int padding = 5; // nx_action_SetNsi : uint8_t pad[3]; + + @Override + public void serialize(Action input, ByteBuf outBuffer) { + ActionSetNsi action = input.getAugmentation(OfjAugNxAction.class).getActionSetNsi(); + serializeHeader(LENGTH, NXAST_SET_NSI_SUBTYPE, outBuffer); + outBuffer.writeByte(action.getNsi().byteValue()); + outBuffer.writeZero(padding); + } + + @Override + public Action deserialize(ByteBuf message) { + ActionBuilder actionBuilder = deserializeHeader(message); + ActionSetNsiBuilder builder = new ActionSetNsiBuilder(); + builder.setNsi(message.readUnsignedByte()); + message.skipBytes(padding); + + OfjAugNxActionBuilder augNxActionBuilder = new OfjAugNxActionBuilder(); + augNxActionBuilder.setActionSetNsi(builder.build()); + actionBuilder.addAugmentation(ExperimenterIdAction.class, + createExperimenterIdAction(NxmNxSetNsi.class)); + actionBuilder.addAugmentation(OfjAugNxAction.class, augNxActionBuilder.build()); + return actionBuilder.build(); + } + +} diff --git a/extension/openflowjava-extension-nicira/src/main/java/org/opendaylight/openflowjava/nx/codec/action/SetNspCodec.java b/extension/openflowjava-extension-nicira/src/main/java/org/opendaylight/openflowjava/nx/codec/action/SetNspCodec.java new file mode 100644 index 0000000000..05b03b36a2 --- /dev/null +++ b/extension/openflowjava-extension-nicira/src/main/java/org/opendaylight/openflowjava/nx/codec/action/SetNspCodec.java @@ -0,0 +1,63 @@ +/* + * Copyright (C) 2014 Red Hat, Inc. + * + * 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 + * + * Authors : Madhu Venugopal + */ + +package org.opendaylight.openflowjava.nx.codec.action; + +import io.netty.buffer.ByteBuf; + +import org.opendaylight.openflowjava.nx.api.NiciraActionDeserializerKey; +import org.opendaylight.openflowjava.nx.api.NiciraActionSerializerKey; +import org.opendaylight.openflowjava.nx.codec.action.AbstractActionCodec; +import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants; +import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.ExperimenterIdAction; +import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.Action; +import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.ActionBuilder; +import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.NxmNxSetNsp; +import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.OfjAugNxAction; +import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.OfjAugNxActionBuilder; +import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.ofj.nx.action.set.nsp.grouping.ActionSetNsp; +import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.ofj.nx.action.set.nsp.grouping.ActionSetNspBuilder; + +/** + * Codec for the NX_SetNsp and NX_SetNsp_TABLE + */ +public class SetNspCodec extends AbstractActionCodec { + public static final int LENGTH = 16; + public static final byte NXAST_SET_NSP_SUBTYPE = 32; + public static final NiciraActionSerializerKey SERIALIZER_KEY = + new NiciraActionSerializerKey(EncodeConstants.OF13_VERSION_ID, NxmNxSetNsp.class); + public static final NiciraActionDeserializerKey DESERIALIZER_KEY = + new NiciraActionDeserializerKey(EncodeConstants.OF13_VERSION_ID, NXAST_SET_NSP_SUBTYPE); + private static final int padding = 2; // nx_action_SetNsp : uint8_t pad[3]; + + @Override + public void serialize(Action input, ByteBuf outBuffer) { + ActionSetNsp action = input.getAugmentation(OfjAugNxAction.class).getActionSetNsp(); + serializeHeader(LENGTH, NXAST_SET_NSP_SUBTYPE, outBuffer); + outBuffer.writeZero(padding); + outBuffer.writeInt(action.getNsp().intValue()); + } + + @Override + public Action deserialize(ByteBuf message) { + ActionBuilder actionBuilder = deserializeHeader(message); + ActionSetNspBuilder builder = new ActionSetNspBuilder(); + message.skipBytes(padding); + builder.setNsp(message.readUnsignedInt()); + + OfjAugNxActionBuilder augNxActionBuilder = new OfjAugNxActionBuilder(); + augNxActionBuilder.setActionSetNsp(builder.build()); + actionBuilder.addAugmentation(ExperimenterIdAction.class, + createExperimenterIdAction(NxmNxSetNsp.class)); + actionBuilder.addAugmentation(OfjAugNxAction.class, augNxActionBuilder.build()); + return actionBuilder.build(); + } + +} diff --git a/extension/openflowjava-extension-nicira/src/main/java/org/opendaylight/openflowjava/nx/codec/match/NsiCodec.java b/extension/openflowjava-extension-nicira/src/main/java/org/opendaylight/openflowjava/nx/codec/match/NsiCodec.java new file mode 100644 index 0000000000..10c5cd3904 --- /dev/null +++ b/extension/openflowjava-extension-nicira/src/main/java/org/opendaylight/openflowjava/nx/codec/match/NsiCodec.java @@ -0,0 +1,78 @@ +/* + * Copyright (C) 2014 Red Hat, Inc. + * + * 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 + * + * Authors : Madhu Venugopal + */ + +package org.opendaylight.openflowjava.nx.codec.match; +import io.netty.buffer.ByteBuf; + +import org.opendaylight.openflowjava.nx.codec.match.AbstractMatchCodec; +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.rev130731.MatchField; +import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Nxm1Class; +import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OxmClassBase; +import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntries; +import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntriesBuilder; +import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.NxmNxNsi; +import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.OfjAugNxMatch; +import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.OfjAugNxMatchBuilder; +import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.ofj.nxm.nx.match.nsi.grouping.NsiValuesBuilder; + +public class NsiCodec extends AbstractMatchCodec { + + private static final int VALUE_LENGTH = 1; + private static final int NXM_FIELD_CODE = 38; + public static final MatchEntrySerializerKey SERIALIZER_KEY = new MatchEntrySerializerKey<>( + EncodeConstants.OF13_VERSION_ID, Nxm1Class.class, NxmNxNsi.class); + public static final MatchEntryDeserializerKey DESERIALIZER_KEY = new MatchEntryDeserializerKey( + EncodeConstants.OF13_VERSION_ID, OxmMatchConstants.NXM_1_CLASS, NXM_FIELD_CODE); + + @Override + public void serialize(MatchEntries input, ByteBuf outBuffer) { + serializeHeader(input, outBuffer); + Short nsi = input.getAugmentation(OfjAugNxMatch.class).getNsiValues().getNsi(); + outBuffer.writeByte(nsi.byteValue()); + } + + @Override + public MatchEntries deserialize(ByteBuf message) { + MatchEntriesBuilder matchEntriesBuilder = deserializeHeader(message); + OfjAugNxMatchBuilder augNxMatchBuilder = new OfjAugNxMatchBuilder(); + augNxMatchBuilder.setNsiValues(new NsiValuesBuilder().setNsi(message.readUnsignedByte()).build()); + matchEntriesBuilder.addAugmentation(OfjAugNxMatch.class, augNxMatchBuilder.build()); + return matchEntriesBuilder.build(); + } + + @Override + public int getNxmFieldCode() { + return NXM_FIELD_CODE; + } + + @Override + public int getOxmClassCode() { + return OxmMatchConstants.NXM_1_CLASS; + } + + @Override + public int getValueLength() { + return VALUE_LENGTH; + } + + @Override + public Class getNxmField() { + return NxmNxNsi.class; + } + + @Override + public Class getOxmClass() { + return Nxm1Class.class; + } +} diff --git a/extension/openflowjava-extension-nicira/src/main/java/org/opendaylight/openflowjava/nx/codec/match/NspCodec.java b/extension/openflowjava-extension-nicira/src/main/java/org/opendaylight/openflowjava/nx/codec/match/NspCodec.java new file mode 100644 index 0000000000..be989f2854 --- /dev/null +++ b/extension/openflowjava-extension-nicira/src/main/java/org/opendaylight/openflowjava/nx/codec/match/NspCodec.java @@ -0,0 +1,78 @@ +/* + * Copyright (C) 2014 Red Hat, Inc. + * + * 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 + * + * Authors : Madhu Venugopal + */ + +package org.opendaylight.openflowjava.nx.codec.match; +import io.netty.buffer.ByteBuf; + +import org.opendaylight.openflowjava.nx.codec.match.AbstractMatchCodec; +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.rev130731.MatchField; +import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Nxm1Class; +import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OxmClassBase; +import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntries; +import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntriesBuilder; +import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.NxmNxNsp; +import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.OfjAugNxMatch; +import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.OfjAugNxMatchBuilder; +import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.ofj.nxm.nx.match.nsp.grouping.NspValuesBuilder; + +public class NspCodec extends AbstractMatchCodec { + + private static final int VALUE_LENGTH = 4; + private static final int NXM_FIELD_CODE = 37; + public static final MatchEntrySerializerKey SERIALIZER_KEY = new MatchEntrySerializerKey<>( + EncodeConstants.OF13_VERSION_ID, Nxm1Class.class, NxmNxNsp.class); + public static final MatchEntryDeserializerKey DESERIALIZER_KEY = new MatchEntryDeserializerKey( + EncodeConstants.OF13_VERSION_ID, OxmMatchConstants.NXM_1_CLASS, NXM_FIELD_CODE); + + @Override + public void serialize(MatchEntries input, ByteBuf outBuffer) { + serializeHeader(input, outBuffer); + Long nsp = input.getAugmentation(OfjAugNxMatch.class).getNspValues().getNsp(); + outBuffer.writeInt(nsp.intValue()); + } + + @Override + public MatchEntries deserialize(ByteBuf message) { + MatchEntriesBuilder matchEntriesBuilder = deserializeHeader(message); + OfjAugNxMatchBuilder augNxMatchBuilder = new OfjAugNxMatchBuilder(); + augNxMatchBuilder.setNspValues(new NspValuesBuilder().setNsp(message.readUnsignedInt()).build()); + matchEntriesBuilder.addAugmentation(OfjAugNxMatch.class, augNxMatchBuilder.build()); + return matchEntriesBuilder.build(); + } + + @Override + public int getNxmFieldCode() { + return NXM_FIELD_CODE; + } + + @Override + public int getOxmClassCode() { + return OxmMatchConstants.NXM_1_CLASS; + } + + @Override + public int getValueLength() { + return VALUE_LENGTH; + } + + @Override + public Class getNxmField() { + return NxmNxNsp.class; + } + + @Override + public Class getOxmClass() { + return Nxm1Class.class; + } +} diff --git a/extension/openflowjava-extension-nicira/src/main/yang/nicira-action.yang b/extension/openflowjava-extension-nicira/src/main/yang/nicira-action.yang index 7352c01ef5..c218ce9a44 100644 --- a/extension/openflowjava-extension-nicira/src/main/yang/nicira-action.yang +++ b/extension/openflowjava-extension-nicira/src/main/yang/nicira-action.yang @@ -30,6 +30,12 @@ module nicira-action { identity nxm-nx-multipath { base ofaction:experimenter-action-sub-type; } + identity nxm-nx-set-nsp { + base ofaction:experimenter-action-sub-type; + } + identity nxm-nx-set-nsi { + base ofaction:experimenter-action-sub-type; + } grouping ofj-nx-action-reg-load-grouping { container action-reg-load { @@ -149,6 +155,22 @@ module nicira-action { } } + grouping ofj-nx-action-set-nsp-grouping { + container action-set-nsp { + leaf nsp { + type uint32; + } + } + } + + grouping ofj-nx-action-set-nsi-grouping { + container action-set-nsi { + leaf nsi { + type uint8; + } + } + } + augment "/ofaction:actions-container/ofaction:action" { ext:augment-identifier "ofj-aug-nx-action"; uses ofj-nx-action-reg-load-grouping; @@ -156,5 +178,7 @@ module nicira-action { uses ofj-nx-action-output-reg-grouping; uses ofj-nx-action-resubmit-grouping; uses ofj-nx-action-multipath-grouping; + uses ofj-nx-action-set-nsp-grouping; + uses ofj-nx-action-set-nsi-grouping; } } diff --git a/extension/openflowjava-extension-nicira/src/main/yang/nicira-match.yang b/extension/openflowjava-extension-nicira/src/main/yang/nicira-match.yang index 05814d2cc0..d4233f8079 100644 --- a/extension/openflowjava-extension-nicira/src/main/yang/nicira-match.yang +++ b/extension/openflowjava-extension-nicira/src/main/yang/nicira-match.yang @@ -77,6 +77,12 @@ module nicira-match { identity nxm-of-eth-type { base ofoxm:match-field; } + identity nxm-nx-nsp { + base ofoxm:match-field; + } + identity nxm-nx-nsi { + base ofoxm:match-field; + } grouping ofj-nxm-nx-match-reg-grouping { container reg-values { @@ -163,6 +169,22 @@ module nicira-match { } } + grouping ofj-nxm-nx-match-nsp-grouping { + container nsp-values { + leaf nsp { + type uint32; + } + } + } + + grouping ofj-nxm-nx-match-nsi-grouping { + container nsi-values { + leaf nsi { + type uint8; + } + } + } + augment "/ofoxm:oxm-container/ofoxm:match-entries" { ext:augment-identifier "ofj-aug_nx_match"; uses ofj-nxm-nx-match-reg-grouping; @@ -177,6 +199,8 @@ module nicira-match { uses ofj-nxm-of-match-eth-src-grouping; uses ofj-nxm-of-match-eth-dst-grouping; uses ofj-nxm-of-match-eth-type-grouping; + uses ofj-nxm-nx-match-nsp-grouping; + uses ofj-nxm-nx-match-nsi-grouping; } -} \ No newline at end of file +} diff --git a/extension/openflowplugin-extension-nicira/src/main/java/org/opendaylight/openflowplugin/extension/vendor/nicira/NiciraExtensionProvider.java b/extension/openflowplugin-extension-nicira/src/main/java/org/opendaylight/openflowplugin/extension/vendor/nicira/NiciraExtensionProvider.java index 101ab1355a..3b7cf0a9ef 100644 --- a/extension/openflowplugin-extension-nicira/src/main/java/org/opendaylight/openflowplugin/extension/vendor/nicira/NiciraExtensionProvider.java +++ b/extension/openflowplugin-extension-nicira/src/main/java/org/opendaylight/openflowplugin/extension/vendor/nicira/NiciraExtensionProvider.java @@ -16,6 +16,8 @@ import org.opendaylight.openflowjava.nx.codec.action.RegLoadCodec; import org.opendaylight.openflowjava.nx.codec.action.RegMoveCodec; import org.opendaylight.openflowjava.nx.codec.action.ResubmitCodec; import org.opendaylight.openflowjava.nx.codec.action.MultipathCodec; +import org.opendaylight.openflowjava.nx.codec.action.SetNspCodec; +import org.opendaylight.openflowjava.nx.codec.action.SetNsiCodec; import org.opendaylight.openflowjava.nx.codec.match.ArpOpCodec; import org.opendaylight.openflowjava.nx.codec.match.ArpShaCodec; import org.opendaylight.openflowjava.nx.codec.match.ArpSpaCodec; @@ -35,6 +37,8 @@ import org.opendaylight.openflowjava.nx.codec.match.Reg7Codec; import org.opendaylight.openflowjava.nx.codec.match.TunIdCodec; import org.opendaylight.openflowjava.nx.codec.match.TunIpv4DstCodec; import org.opendaylight.openflowjava.nx.codec.match.TunIpv4SrcCodec; +import org.opendaylight.openflowjava.nx.codec.match.NspCodec; +import org.opendaylight.openflowjava.nx.codec.match.NsiCodec; import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants; import org.opendaylight.openflowplugin.extension.api.ConverterExtensionKey; import org.opendaylight.openflowplugin.extension.api.ConvertorActionToOFJava; @@ -45,6 +49,8 @@ import org.opendaylight.openflowplugin.extension.vendor.nicira.convertor.action. import org.opendaylight.openflowplugin.extension.vendor.nicira.convertor.action.RegMoveConvertor; import org.opendaylight.openflowplugin.extension.vendor.nicira.convertor.action.ResubmitConvertor; import org.opendaylight.openflowplugin.extension.vendor.nicira.convertor.action.MultipathConvertor; +import org.opendaylight.openflowplugin.extension.vendor.nicira.convertor.action.SetNspConvertor; +import org.opendaylight.openflowplugin.extension.vendor.nicira.convertor.action.SetNsiConvertor; import org.opendaylight.openflowplugin.extension.vendor.nicira.convertor.match.ArpOpConvertor; import org.opendaylight.openflowplugin.extension.vendor.nicira.convertor.match.ArpShaConvertor; import org.opendaylight.openflowplugin.extension.vendor.nicira.convertor.match.ArpSpaConvertor; @@ -57,53 +63,74 @@ import org.opendaylight.openflowplugin.extension.vendor.nicira.convertor.match.R import org.opendaylight.openflowplugin.extension.vendor.nicira.convertor.match.TunIdConvertor; import org.opendaylight.openflowplugin.extension.vendor.nicira.convertor.match.TunIpv4DstConvertor; import org.opendaylight.openflowplugin.extension.vendor.nicira.convertor.match.TunIpv4SrcConvertor; +import org.opendaylight.openflowplugin.extension.vendor.nicira.convertor.match.NsiConvertor; +import org.opendaylight.openflowplugin.extension.vendor.nicira.convertor.match.NspConvertor; import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action; + + import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.add.flow.input.instructions.instruction.instruction.apply.actions._case.apply.actions.action.action.NxActionOutputRegRpcAddFlowApplyActionsCase; import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.add.flow.input.instructions.instruction.instruction.apply.actions._case.apply.actions.action.action.NxActionRegLoadRpcAddFlowApplyActionsCase; import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.add.flow.input.instructions.instruction.instruction.apply.actions._case.apply.actions.action.action.NxActionRegMoveRpcAddFlowApplyActionsCase; import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.add.flow.input.instructions.instruction.instruction.apply.actions._case.apply.actions.action.action.NxActionResubmitRpcAddFlowApplyActionsCase; import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.add.flow.input.instructions.instruction.instruction.apply.actions._case.apply.actions.action.action.NxActionMultipathRpcAddFlowApplyActionsCase; +import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.add.flow.input.instructions.instruction.instruction.apply.actions._case.apply.actions.action.action.NxActionSetNspRpcAddFlowApplyActionsCase; +import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.add.flow.input.instructions.instruction.instruction.apply.actions._case.apply.actions.action.action.NxActionSetNsiRpcAddFlowApplyActionsCase; import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.add.flow.input.instructions.instruction.instruction.write.actions._case.write.actions.action.action.NxActionOutputRegRpcAddFlowWriteActionsCase; import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.add.flow.input.instructions.instruction.instruction.write.actions._case.write.actions.action.action.NxActionRegLoadRpcAddFlowWriteActionsCase; import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.add.flow.input.instructions.instruction.instruction.write.actions._case.write.actions.action.action.NxActionRegMoveRpcAddFlowWriteActionsCase; import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.add.flow.input.instructions.instruction.instruction.write.actions._case.write.actions.action.action.NxActionResubmitRpcAddFlowWriteActionsCase; import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.add.flow.input.instructions.instruction.instruction.write.actions._case.write.actions.action.action.NxActionMultipathRpcAddFlowWriteActionsCase; +import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.add.flow.input.instructions.instruction.instruction.write.actions._case.write.actions.action.action.NxActionSetNspRpcAddFlowWriteActionsCase; +import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.add.flow.input.instructions.instruction.instruction.write.actions._case.write.actions.action.action.NxActionSetNsiRpcAddFlowWriteActionsCase; import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.add.group.input.buckets.bucket.action.action.NxActionOutputRegRpcAddGroupCase; import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.add.group.input.buckets.bucket.action.action.NxActionRegLoadRpcAddGroupCase; import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.add.group.input.buckets.bucket.action.action.NxActionRegMoveRpcAddGroupCase; import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.add.group.input.buckets.bucket.action.action.NxActionResubmitRpcAddGroupCase; import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.add.group.input.buckets.bucket.action.action.NxActionMultipathRpcAddGroupCase; +import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.add.group.input.buckets.bucket.action.action.NxActionSetNspRpcAddGroupCase; +import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.add.group.input.buckets.bucket.action.action.NxActionSetNsiRpcAddGroupCase; import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.nodes.node.group.buckets.bucket.action.action.NxActionOutputRegNodesNodeGroupBucketsBucketActionsCase; import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.nodes.node.group.buckets.bucket.action.action.NxActionRegLoadNodesNodeGroupBucketsBucketActionsCase; import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.nodes.node.group.buckets.bucket.action.action.NxActionRegMoveNodesNodeGroupBucketsBucketActionsCase; import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.nodes.node.group.buckets.bucket.action.action.NxActionResubmitNodesNodeGroupBucketsBucketActionsCase; import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.nodes.node.group.buckets.bucket.action.action.NxActionMultipathNodesNodeGroupBucketsBucketActionsCase; +import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.nodes.node.group.buckets.bucket.action.action.NxActionSetNspNodesNodeGroupBucketsBucketActionsCase; +import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.nodes.node.group.buckets.bucket.action.action.NxActionSetNsiNodesNodeGroupBucketsBucketActionsCase; import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.nodes.node.table.flow.instructions.instruction.instruction.apply.actions._case.apply.actions.action.action.NxActionOutputRegNodesNodeTableFlowApplyActionsCase; import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.nodes.node.table.flow.instructions.instruction.instruction.apply.actions._case.apply.actions.action.action.NxActionRegLoadNodesNodeTableFlowApplyActionsCase; import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.nodes.node.table.flow.instructions.instruction.instruction.apply.actions._case.apply.actions.action.action.NxActionRegMoveNodesNodeTableFlowApplyActionsCase; import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.nodes.node.table.flow.instructions.instruction.instruction.apply.actions._case.apply.actions.action.action.NxActionResubmitNodesNodeTableFlowApplyActionsCase; import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.nodes.node.table.flow.instructions.instruction.instruction.apply.actions._case.apply.actions.action.action.NxActionMultipathNodesNodeTableFlowApplyActionsCase; +import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.nodes.node.table.flow.instructions.instruction.instruction.apply.actions._case.apply.actions.action.action.NxActionSetNspNodesNodeTableFlowApplyActionsCase; +import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.nodes.node.table.flow.instructions.instruction.instruction.apply.actions._case.apply.actions.action.action.NxActionSetNsiNodesNodeTableFlowApplyActionsCase; import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.nodes.node.table.flow.instructions.instruction.instruction.write.actions._case.write.actions.action.action.NxActionOutputRegNodesNodeTableFlowWriteActionsCase; import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.nodes.node.table.flow.instructions.instruction.instruction.write.actions._case.write.actions.action.action.NxActionRegLoadNodesNodeTableFlowWriteActionsCase; import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.nodes.node.table.flow.instructions.instruction.instruction.write.actions._case.write.actions.action.action.NxActionRegMoveNodesNodeTableFlowWriteActionsCase; import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.nodes.node.table.flow.instructions.instruction.instruction.write.actions._case.write.actions.action.action.NxActionResubmitNodesNodeTableFlowWriteActionsCase; import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.nodes.node.table.flow.instructions.instruction.instruction.write.actions._case.write.actions.action.action.NxActionMultipathNodesNodeTableFlowWriteActionsCase; +import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.nodes.node.table.flow.instructions.instruction.instruction.write.actions._case.write.actions.action.action.NxActionSetNspNodesNodeTableFlowWriteActionsCase; +import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.nodes.node.table.flow.instructions.instruction.instruction.write.actions._case.write.actions.action.action.NxActionSetNsiNodesNodeTableFlowWriteActionsCase; import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.remove.group.input.buckets.bucket.action.action.NxActionOutputRegRpcRemoveGroupCase; import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.remove.group.input.buckets.bucket.action.action.NxActionRegLoadRpcRemoveGroupCase; import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.remove.group.input.buckets.bucket.action.action.NxActionRegMoveRpcRemoveGroupCase; import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.remove.group.input.buckets.bucket.action.action.NxActionResubmitRpcRemoveGroupCase; import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.remove.group.input.buckets.bucket.action.action.NxActionMultipathRpcRemoveGroupCase; +import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.remove.group.input.buckets.bucket.action.action.NxActionSetNspRpcRemoveGroupCase; +import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.remove.group.input.buckets.bucket.action.action.NxActionSetNsiRpcRemoveGroupCase; import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.update.group.input.original.group.buckets.bucket.action.action.NxActionOutputRegRpcUpdateGroupOriginalCase; import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.update.group.input.original.group.buckets.bucket.action.action.NxActionRegLoadRpcUpdateGroupOriginalCase; import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.update.group.input.original.group.buckets.bucket.action.action.NxActionRegMoveRpcUpdateGroupOriginalCase; import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.update.group.input.original.group.buckets.bucket.action.action.NxActionResubmitRpcUpdateGroupOriginalCase; import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.update.group.input.original.group.buckets.bucket.action.action.NxActionMultipathRpcUpdateGroupOriginalCase; +import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.update.group.input.original.group.buckets.bucket.action.action.NxActionSetNspRpcUpdateGroupOriginalCase; +import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.update.group.input.original.group.buckets.bucket.action.action.NxActionSetNsiRpcUpdateGroupOriginalCase; import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.update.group.input.updated.group.buckets.bucket.action.action.NxActionOutputRegRpcUpdateGroupUpdatedCase; import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.update.group.input.updated.group.buckets.bucket.action.action.NxActionRegLoadRpcUpdateGroupUpdatedCase; import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.update.group.input.updated.group.buckets.bucket.action.action.NxActionRegMoveRpcUpdateGroupUpdatedCase; import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.update.group.input.updated.group.buckets.bucket.action.action.NxActionResubmitRpcUpdateGroupUpdatedCase; import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.update.group.input.updated.group.buckets.bucket.action.action.NxActionMultipathRpcUpdateGroupUpdatedCase; - +import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.update.group.input.updated.group.buckets.bucket.action.action.NxActionSetNspRpcUpdateGroupUpdatedCase; +import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.update.group.input.updated.group.buckets.bucket.action.action.NxActionSetNsiRpcUpdateGroupUpdatedCase; import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.match.rev140714.NxmNxArpShaKey; import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.match.rev140714.NxmNxArpThaKey; import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.match.rev140714.NxmNxReg0Key; @@ -123,6 +150,8 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.ni import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.match.rev140714.NxmOfEthDstKey; import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.match.rev140714.NxmOfEthSrcKey; import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.match.rev140714.NxmOfEthTypeKey; +import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.match.rev140714.NxmNxNspKey; +import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.match.rev140714.NxmNxNsiKey; import org.opendaylight.yangtools.concepts.ObjectRegistration; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -157,6 +186,10 @@ public class NiciraExtensionProvider implements AutoCloseable { private final static EthTypeConvertor ETH_TYPE_CONVERTOR = new EthTypeConvertor(); private final static ResubmitConvertor RESUBMIT_CONVERTOR = new ResubmitConvertor(); private final static MultipathConvertor MULTIPATH_CONVERTOR = new MultipathConvertor(); + private final static SetNspConvertor SET_NSP_CONVERTOR = new SetNspConvertor(); + private final static SetNsiConvertor SET_NSI_CONVERTOR = new SetNsiConvertor(); + private final static NspConvertor NSP_CONVERTOR = new NspConvertor(); + private final static NsiConvertor NSI_CONVERTOR = new NsiConvertor(); @Override public void close() { @@ -190,16 +223,24 @@ public class NiciraExtensionProvider implements AutoCloseable { registerAction13(NxActionOutputRegNodesNodeTableFlowApplyActionsCase.class, OUTPUT_REG_CONVERTOR); registerAction13(NxActionResubmitNodesNodeTableFlowApplyActionsCase.class, RESUBMIT_CONVERTOR); registerAction13(NxActionMultipathNodesNodeTableFlowApplyActionsCase.class, MULTIPATH_CONVERTOR); + registerAction13(NxActionSetNspNodesNodeTableFlowApplyActionsCase.class, SET_NSP_CONVERTOR); + registerAction13(NxActionSetNsiNodesNodeTableFlowApplyActionsCase.class, SET_NSI_CONVERTOR); + registerAction13(NxActionRegLoadNodesNodeTableFlowWriteActionsCase.class, REG_LOAD_CONVERTOR); registerAction13(NxActionRegMoveNodesNodeTableFlowWriteActionsCase.class, REG_MOVE_CONVERTOR); registerAction13(NxActionOutputRegNodesNodeTableFlowWriteActionsCase.class, OUTPUT_REG_CONVERTOR); registerAction13(NxActionResubmitNodesNodeTableFlowWriteActionsCase.class, RESUBMIT_CONVERTOR); registerAction13(NxActionMultipathNodesNodeTableFlowWriteActionsCase.class, MULTIPATH_CONVERTOR); + registerAction13(NxActionSetNspNodesNodeTableFlowWriteActionsCase.class, SET_NSP_CONVERTOR); + registerAction13(NxActionSetNsiNodesNodeTableFlowWriteActionsCase.class, SET_NSI_CONVERTOR); + registerAction13(NxActionRegLoadNodesNodeGroupBucketsBucketActionsCase.class, REG_LOAD_CONVERTOR); registerAction13(NxActionRegMoveNodesNodeGroupBucketsBucketActionsCase.class, REG_MOVE_CONVERTOR); registerAction13(NxActionOutputRegNodesNodeGroupBucketsBucketActionsCase.class, OUTPUT_REG_CONVERTOR); registerAction13(NxActionResubmitNodesNodeGroupBucketsBucketActionsCase.class, RESUBMIT_CONVERTOR); registerAction13(NxActionMultipathNodesNodeGroupBucketsBucketActionsCase.class, MULTIPATH_CONVERTOR); + registerAction13(NxActionSetNspNodesNodeGroupBucketsBucketActionsCase.class, SET_NSP_CONVERTOR); + registerAction13(NxActionSetNsiNodesNodeGroupBucketsBucketActionsCase.class, SET_NSI_CONVERTOR); // src=rpc-addFlow registerAction13(NxActionRegLoadRpcAddFlowApplyActionsCase.class, REG_LOAD_CONVERTOR); @@ -207,12 +248,16 @@ public class NiciraExtensionProvider implements AutoCloseable { registerAction13(NxActionOutputRegRpcAddFlowApplyActionsCase.class, OUTPUT_REG_CONVERTOR); registerAction13(NxActionResubmitRpcAddFlowApplyActionsCase.class, RESUBMIT_CONVERTOR); registerAction13(NxActionMultipathRpcAddFlowApplyActionsCase.class, MULTIPATH_CONVERTOR); + registerAction13(NxActionSetNspRpcAddFlowApplyActionsCase.class, SET_NSP_CONVERTOR); + registerAction13(NxActionSetNsiRpcAddFlowApplyActionsCase.class, SET_NSI_CONVERTOR); registerAction13(NxActionRegLoadRpcAddFlowWriteActionsCase.class, REG_LOAD_CONVERTOR); registerAction13(NxActionRegMoveRpcAddFlowWriteActionsCase.class, REG_MOVE_CONVERTOR); registerAction13(NxActionOutputRegRpcAddFlowWriteActionsCase.class, OUTPUT_REG_CONVERTOR); registerAction13(NxActionResubmitRpcAddFlowWriteActionsCase.class, RESUBMIT_CONVERTOR); registerAction13(NxActionMultipathRpcAddFlowWriteActionsCase.class, MULTIPATH_CONVERTOR); + registerAction13(NxActionSetNspRpcAddFlowWriteActionsCase.class, SET_NSP_CONVERTOR); + registerAction13(NxActionSetNsiRpcAddFlowWriteActionsCase.class, SET_NSI_CONVERTOR); registerAction13(NxActionRegLoadRpcAddGroupCase.class, REG_LOAD_CONVERTOR); registerAction13(NxActionRegLoadRpcRemoveGroupCase.class, REG_LOAD_CONVERTOR); @@ -234,12 +279,22 @@ public class NiciraExtensionProvider implements AutoCloseable { registerAction13(NxActionMultipathRpcRemoveGroupCase.class, MULTIPATH_CONVERTOR); registerAction13(NxActionMultipathRpcUpdateGroupOriginalCase.class, MULTIPATH_CONVERTOR); registerAction13(NxActionMultipathRpcUpdateGroupUpdatedCase.class, MULTIPATH_CONVERTOR); + registerAction13(NxActionSetNspRpcAddGroupCase.class, SET_NSP_CONVERTOR); + registerAction13(NxActionSetNspRpcRemoveGroupCase.class, SET_NSP_CONVERTOR); + registerAction13(NxActionSetNspRpcUpdateGroupOriginalCase.class, SET_NSP_CONVERTOR); + registerAction13(NxActionSetNspRpcUpdateGroupUpdatedCase.class, SET_NSP_CONVERTOR); + registerAction13(NxActionSetNsiRpcAddGroupCase.class, SET_NSI_CONVERTOR); + registerAction13(NxActionSetNsiRpcRemoveGroupCase.class, SET_NSI_CONVERTOR); + registerAction13(NxActionSetNsiRpcUpdateGroupOriginalCase.class, SET_NSI_CONVERTOR); + registerAction13(NxActionSetNsiRpcUpdateGroupUpdatedCase.class, SET_NSI_CONVERTOR); registrations.add(extensionConverterRegistrator.registerActionConvertor(NiciraUtil.createOfJavaKeyFrom(RegLoadCodec.SERIALIZER_KEY), REG_LOAD_CONVERTOR)); registrations.add(extensionConverterRegistrator.registerActionConvertor(NiciraUtil.createOfJavaKeyFrom(RegMoveCodec.SERIALIZER_KEY), REG_MOVE_CONVERTOR)); registrations.add(extensionConverterRegistrator.registerActionConvertor(NiciraUtil.createOfJavaKeyFrom(OutputRegCodec.SERIALIZER_KEY), OUTPUT_REG_CONVERTOR)); registrations.add(extensionConverterRegistrator.registerActionConvertor(NiciraUtil.createOfJavaKeyFrom(ResubmitCodec.SERIALIZER_KEY), RESUBMIT_CONVERTOR)); registrations.add(extensionConverterRegistrator.registerActionConvertor(NiciraUtil.createOfJavaKeyFrom(MultipathCodec.SERIALIZER_KEY), MULTIPATH_CONVERTOR)); + registrations.add(extensionConverterRegistrator.registerActionConvertor(NiciraUtil.createOfJavaKeyFrom(SetNspCodec.SERIALIZER_KEY), SET_NSP_CONVERTOR)); + registrations.add(extensionConverterRegistrator.registerActionConvertor(NiciraUtil.createOfJavaKeyFrom(SetNsiCodec.SERIALIZER_KEY), SET_NSI_CONVERTOR)); registrations.add(extensionConverterRegistrator.registerMatchConvertor(new ConverterExtensionKey<>(NxmNxReg0Key.class, EncodeConstants.OF13_VERSION_ID), REG_CONVERTOR)); registrations.add(extensionConverterRegistrator.registerMatchConvertor(new ConverterExtensionKey<>(NxmNxReg1Key.class, EncodeConstants.OF13_VERSION_ID), REG_CONVERTOR)); @@ -280,6 +335,10 @@ public class NiciraExtensionProvider implements AutoCloseable { registrations.add(extensionConverterRegistrator.registerMatchConvertor(EthDstCodec.SERIALIZER_KEY, ETH_DST_CONVERTOR)); registrations.add(extensionConverterRegistrator.registerMatchConvertor(new ConverterExtensionKey<>(NxmOfEthTypeKey.class, EncodeConstants.OF13_VERSION_ID), ETH_TYPE_CONVERTOR)); registrations.add(extensionConverterRegistrator.registerMatchConvertor(EthTypeCodec.SERIALIZER_KEY, ETH_TYPE_CONVERTOR)); + registrations.add(extensionConverterRegistrator.registerMatchConvertor(new ConverterExtensionKey<>(NxmNxNspKey.class, EncodeConstants.OF13_VERSION_ID), NSP_CONVERTOR)); + registrations.add(extensionConverterRegistrator.registerMatchConvertor(NspCodec.SERIALIZER_KEY, NSP_CONVERTOR)); + registrations.add(extensionConverterRegistrator.registerMatchConvertor(new ConverterExtensionKey<>(NxmNxNsiKey.class, EncodeConstants.OF13_VERSION_ID), NSI_CONVERTOR)); + registrations.add(extensionConverterRegistrator.registerMatchConvertor(NsiCodec.SERIALIZER_KEY, NSI_CONVERTOR)); } /** diff --git a/extension/openflowplugin-extension-nicira/src/main/java/org/opendaylight/openflowplugin/extension/vendor/nicira/convertor/action/SetNsiConvertor.java b/extension/openflowplugin-extension-nicira/src/main/java/org/opendaylight/openflowplugin/extension/vendor/nicira/convertor/action/SetNsiConvertor.java new file mode 100644 index 0000000000..12e5afa3c3 --- /dev/null +++ b/extension/openflowplugin-extension-nicira/src/main/java/org/opendaylight/openflowplugin/extension/vendor/nicira/convertor/action/SetNsiConvertor.java @@ -0,0 +1,70 @@ +/* + * Copyright (C) 2014 Red Hat, Inc. + * + * 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 + * + * Authors : Madhu Venugopal + */ +package org.opendaylight.openflowplugin.extension.vendor.nicira.convertor.action; + +import org.opendaylight.openflowplugin.extension.api.ConvertorActionFromOFJava; +import org.opendaylight.openflowplugin.extension.api.ConvertorActionToOFJava; +import org.opendaylight.openflowplugin.extension.api.path.ActionPath; +import org.opendaylight.openflowplugin.extension.vendor.nicira.convertor.CodecPreconditionException; +import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.Action; +import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.NxmNxSetNsi; +import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.OfjAugNxAction; +import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.OfjAugNxActionBuilder; +import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.ofj.nx.action.set.nsi.grouping.ActionSetNsi; +import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.ofj.nx.action.set.nsi.grouping.ActionSetNsiBuilder; +import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.NxActionSetNsiGrouping; +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.NxActionSetNsiNotifFlowsStatisticsUpdateApplyActionsCaseBuilder; +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.NxActionSetNsiNotifFlowsStatisticsUpdateWriteActionsCaseBuilder; +import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.group.desc.stats.updated.group.desc.stats.buckets.bucket.action.action.NxActionSetNsiNotifGroupDescStatsUpdatedCaseBuilder; +import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.nodes.node.table.flow.instructions.instruction.instruction.write.actions._case.write.actions.action.action.NxActionSetNsiNodesNodeTableFlowWriteActionsCaseBuilder; +import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.nx.action.set.nsi.grouping.NxSetNsi; +import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.nx.action.set.nsi.grouping.NxSetNsiBuilder; + +import com.google.common.base.Preconditions; + +public class SetNsiConvertor implements +ConvertorActionToOFJava, +ConvertorActionFromOFJava { + + @Override + public org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action convert(Action input, ActionPath path) { + ActionSetNsi action = input.getAugmentation(OfjAugNxAction.class).getActionSetNsi(); + NxSetNsiBuilder builder = new NxSetNsiBuilder(); + builder.setNsi(action.getNsi()); + return resolveAction(builder.build(), path); + } + + private static org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action resolveAction(NxSetNsi value, ActionPath path) { + switch (path) { + case NODES_NODE_TABLE_FLOW_INSTRUCTIONS_INSTRUCTION_WRITEACTIONSCASE_WRITEACTIONS_ACTION_ACTION_EXTENSIONLIST_EXTENSION: + return new NxActionSetNsiNodesNodeTableFlowWriteActionsCaseBuilder().setNxSetNsi(value).build(); + case FLOWSSTATISTICSUPDATE_FLOWANDSTATISTICSMAPLIST_INSTRUCTIONS_INSTRUCTION_INSTRUCTION_WRITEACTIONSCASE_WRITEACTIONS_ACTION_ACTION: + return new NxActionSetNsiNotifFlowsStatisticsUpdateWriteActionsCaseBuilder().setNxSetNsi(value).build(); + case FLOWSSTATISTICSUPDATE_FLOWANDSTATISTICSMAPLIST_INSTRUCTIONS_INSTRUCTION_INSTRUCTION_APPLYACTIONSCASE_APPLYACTIONS_ACTION_ACTION: + return new NxActionSetNsiNotifFlowsStatisticsUpdateApplyActionsCaseBuilder().setNxSetNsi(value).build(); + case GROUPDESCSTATSUPDATED_GROUPDESCSTATS_BUCKETS_BUCKET_ACTION: + return new NxActionSetNsiNotifGroupDescStatsUpdatedCaseBuilder().setNxSetNsi(value).build(); + default: + throw new CodecPreconditionException(path); + } + } + + @Override + public Action convert(org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action nxActionArg) { + Preconditions.checkArgument(nxActionArg instanceof NxActionSetNsiGrouping); + NxActionSetNsiGrouping nxAction = (NxActionSetNsiGrouping) nxActionArg; + ActionSetNsiBuilder builder = new ActionSetNsiBuilder(); + builder.setNsi(nxAction.getNxSetNsi().getNsi()); + OfjAugNxActionBuilder augNxActionBuilder = new OfjAugNxActionBuilder(); + augNxActionBuilder.setActionSetNsi(builder.build()); + return ActionUtil.createNiciraAction(augNxActionBuilder.build(), NxmNxSetNsi.class); + } + +} \ No newline at end of file diff --git a/extension/openflowplugin-extension-nicira/src/main/java/org/opendaylight/openflowplugin/extension/vendor/nicira/convertor/action/SetNspConvertor.java b/extension/openflowplugin-extension-nicira/src/main/java/org/opendaylight/openflowplugin/extension/vendor/nicira/convertor/action/SetNspConvertor.java new file mode 100644 index 0000000000..39f34aba7c --- /dev/null +++ b/extension/openflowplugin-extension-nicira/src/main/java/org/opendaylight/openflowplugin/extension/vendor/nicira/convertor/action/SetNspConvertor.java @@ -0,0 +1,70 @@ +/* + * Copyright (C) 2014 Red Hat, Inc. + * + * 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 + * + * Authors : Madhu Venugopal + */ +package org.opendaylight.openflowplugin.extension.vendor.nicira.convertor.action; + +import org.opendaylight.openflowplugin.extension.api.ConvertorActionFromOFJava; +import org.opendaylight.openflowplugin.extension.api.ConvertorActionToOFJava; +import org.opendaylight.openflowplugin.extension.api.path.ActionPath; +import org.opendaylight.openflowplugin.extension.vendor.nicira.convertor.CodecPreconditionException; +import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.Action; +import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.NxmNxSetNsp; +import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.OfjAugNxAction; +import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.OfjAugNxActionBuilder; +import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.ofj.nx.action.set.nsp.grouping.ActionSetNsp; +import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.ofj.nx.action.set.nsp.grouping.ActionSetNspBuilder; +import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.NxActionSetNspGrouping; +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.NxActionSetNspNotifFlowsStatisticsUpdateApplyActionsCaseBuilder; +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.NxActionSetNspNotifFlowsStatisticsUpdateWriteActionsCaseBuilder; +import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.group.desc.stats.updated.group.desc.stats.buckets.bucket.action.action.NxActionSetNspNotifGroupDescStatsUpdatedCaseBuilder; +import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.nodes.node.table.flow.instructions.instruction.instruction.write.actions._case.write.actions.action.action.NxActionSetNspNodesNodeTableFlowWriteActionsCaseBuilder; +import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.nx.action.set.nsp.grouping.NxSetNsp; +import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.nx.action.set.nsp.grouping.NxSetNspBuilder; + +import com.google.common.base.Preconditions; + +public class SetNspConvertor implements +ConvertorActionToOFJava, +ConvertorActionFromOFJava { + + @Override + public org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action convert(Action input, ActionPath path) { + ActionSetNsp action = input.getAugmentation(OfjAugNxAction.class).getActionSetNsp(); + NxSetNspBuilder builder = new NxSetNspBuilder(); + builder.setNsp(action.getNsp()); + return resolveAction(builder.build(), path); + } + + private static org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action resolveAction(NxSetNsp value, ActionPath path) { + switch (path) { + case NODES_NODE_TABLE_FLOW_INSTRUCTIONS_INSTRUCTION_WRITEACTIONSCASE_WRITEACTIONS_ACTION_ACTION_EXTENSIONLIST_EXTENSION: + return new NxActionSetNspNodesNodeTableFlowWriteActionsCaseBuilder().setNxSetNsp(value).build(); + case FLOWSSTATISTICSUPDATE_FLOWANDSTATISTICSMAPLIST_INSTRUCTIONS_INSTRUCTION_INSTRUCTION_WRITEACTIONSCASE_WRITEACTIONS_ACTION_ACTION: + return new NxActionSetNspNotifFlowsStatisticsUpdateWriteActionsCaseBuilder().setNxSetNsp(value).build(); + case FLOWSSTATISTICSUPDATE_FLOWANDSTATISTICSMAPLIST_INSTRUCTIONS_INSTRUCTION_INSTRUCTION_APPLYACTIONSCASE_APPLYACTIONS_ACTION_ACTION: + return new NxActionSetNspNotifFlowsStatisticsUpdateApplyActionsCaseBuilder().setNxSetNsp(value).build(); + case GROUPDESCSTATSUPDATED_GROUPDESCSTATS_BUCKETS_BUCKET_ACTION: + return new NxActionSetNspNotifGroupDescStatsUpdatedCaseBuilder().setNxSetNsp(value).build(); + default: + throw new CodecPreconditionException(path); + } + } + + @Override + public Action convert(org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action nxActionArg) { + Preconditions.checkArgument(nxActionArg instanceof NxActionSetNspGrouping); + NxActionSetNspGrouping nxAction = (NxActionSetNspGrouping) nxActionArg; + ActionSetNspBuilder builder = new ActionSetNspBuilder(); + builder.setNsp(nxAction.getNxSetNsp().getNsp()); + OfjAugNxActionBuilder augNxActionBuilder = new OfjAugNxActionBuilder(); + augNxActionBuilder.setActionSetNsp(builder.build()); + return ActionUtil.createNiciraAction(augNxActionBuilder.build(), NxmNxSetNsp.class); + } + +} \ No newline at end of file diff --git a/extension/openflowplugin-extension-nicira/src/main/java/org/opendaylight/openflowplugin/extension/vendor/nicira/convertor/match/MatchUtil.java b/extension/openflowplugin-extension-nicira/src/main/java/org/opendaylight/openflowplugin/extension/vendor/nicira/convertor/match/MatchUtil.java index 3ba9bbe95d..ac3449e4db 100644 --- a/extension/openflowplugin-extension-nicira/src/main/java/org/opendaylight/openflowplugin/extension/vendor/nicira/convertor/match/MatchUtil.java +++ b/extension/openflowplugin-extension-nicira/src/main/java/org/opendaylight/openflowplugin/extension/vendor/nicira/convertor/match/MatchUtil.java @@ -41,6 +41,8 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.ni import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.match.rev140714.NxmOfEthDstGrouping; import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.match.rev140714.NxmOfEthSrcGrouping; import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.match.rev140714.NxmOfEthTypeGrouping; +import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.match.rev140714.NxmNxNspGrouping; +import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.match.rev140714.NxmNxNsiGrouping; import org.opendaylight.yangtools.yang.binding.Augmentation; /** @@ -74,6 +76,10 @@ public class MatchUtil { NxmOfEthSrcGrouping.class); public final static GroupingResolver ethTypeResolver = new GroupingResolver<>( NxmOfEthTypeGrouping.class); + public final static GroupingResolver nsiResolver = new GroupingResolver<>( + NxmNxNsiGrouping.class); + public final static GroupingResolver nspResolver = new GroupingResolver<>( + NxmNxNspGrouping.class); public final static ExperimenterIdMatchEntry EXPERIMENTER_ID_MATCH_ENTRY; static { @@ -97,6 +103,8 @@ public class MatchUtil { ethDstResolver.setAugmentations(augmentationsOfExtension); ethSrcResolver.setAugmentations(augmentationsOfExtension); ethTypeResolver.setAugmentations(augmentationsOfExtension); + nspResolver.setAugmentations(augmentationsOfExtension); + nsiResolver.setAugmentations(augmentationsOfExtension); ExperimenterIdMatchEntryBuilder experimenterIdMatchEntryBuilder = new ExperimenterIdMatchEntryBuilder(); experimenterIdMatchEntryBuilder.setExperimenter(new ExperimenterId(NiciraConstants.NX_VENDOR_ID)); EXPERIMENTER_ID_MATCH_ENTRY = experimenterIdMatchEntryBuilder.build(); diff --git a/extension/openflowplugin-extension-nicira/src/main/java/org/opendaylight/openflowplugin/extension/vendor/nicira/convertor/match/NsiConvertor.java b/extension/openflowplugin-extension-nicira/src/main/java/org/opendaylight/openflowplugin/extension/vendor/nicira/convertor/match/NsiConvertor.java new file mode 100644 index 0000000000..8828b1797a --- /dev/null +++ b/extension/openflowplugin-extension-nicira/src/main/java/org/opendaylight/openflowplugin/extension/vendor/nicira/convertor/match/NsiConvertor.java @@ -0,0 +1,79 @@ +/* + * Copyright (C) 2014 Red Hat, Inc. + * + * 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 + * + * Authors : Madhu Venugopal + */ +package org.opendaylight.openflowplugin.extension.vendor.nicira.convertor.match; + +import org.opendaylight.openflowplugin.extension.api.ConvertorFromOFJava; +import org.opendaylight.openflowplugin.extension.api.ConvertorToOFJava; +import org.opendaylight.openflowplugin.extension.api.ExtensionAugment; +import org.opendaylight.openflowplugin.extension.api.path.MatchPath; +import org.opendaylight.openflowplugin.extension.vendor.nicira.convertor.CodecPreconditionException; +import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Nxm1Class; +import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntries; +import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.OfjAugNxMatch; +import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.OfjAugNxMatchBuilder; +import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.ofj.nxm.nx.match.nsi.grouping.NsiValues; +import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.ofj.nxm.nx.match.nsi.grouping.NsiValuesBuilder; +import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.general.rev140714.ExtensionKey; +import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.general.rev140714.general.extension.grouping.Extension; +import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.match.rev140714.NxAugMatchNotifPacketIn; +import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.match.rev140714.NxAugMatchNotifPacketInBuilder; +import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.match.rev140714.NxAugMatchNotifSwitchFlowRemoved; +import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.match.rev140714.NxAugMatchNotifSwitchFlowRemovedBuilder; +import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.match.rev140714.NxAugMatchNotifUpdateFlowStats; +import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.match.rev140714.NxAugMatchNotifUpdateFlowStatsBuilder; +import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.match.rev140714.NxmNxNsiGrouping; +import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.match.rev140714.NxmNxNsiKey; +import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.match.rev140714.nxm.nx.nsi.grouping.NxmNxNsi; +import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.match.rev140714.nxm.nx.nsi.grouping.NxmNxNsiBuilder; +import org.opendaylight.yangtools.yang.binding.Augmentation; + +import com.google.common.base.Optional; +public class NsiConvertor implements ConvertorToOFJava, ConvertorFromOFJava { + @Override + public ExtensionAugment> convert(MatchEntries input, MatchPath path) { + NsiValues values = input.getAugmentation(OfjAugNxMatch.class).getNsiValues(); + return resolveAugmentation(new NxmNxNsiBuilder().setNsi(values.getNsi()).build(), path, + NxmNxNsiKey.class); + } + + private static ExtensionAugment> resolveAugmentation(NxmNxNsi value, + MatchPath path, Class key) { + switch (path) { + case FLOWSSTATISTICSUPDATE_FLOWANDSTATISTICSMAPLIST_MATCH: + return new ExtensionAugment<>(NxAugMatchNotifUpdateFlowStats.class, + new NxAugMatchNotifUpdateFlowStatsBuilder().setNxmNxNsi(value).build(), key); + case PACKETRECEIVED_MATCH: + return new ExtensionAugment<>(NxAugMatchNotifPacketIn.class, new NxAugMatchNotifPacketInBuilder() + .setNxmNxNsi(value).build(), key); + case SWITCHFLOWREMOVED_MATCH: + return new ExtensionAugment<>(NxAugMatchNotifSwitchFlowRemoved.class, + new NxAugMatchNotifSwitchFlowRemovedBuilder().setNxmNxNsi(value).build(), key); + default: + throw new CodecPreconditionException(path); + } + } + + @Override + public MatchEntries convert(Extension extension) { + Optional matchGrouping = MatchUtil.nsiResolver.getExtension(extension); + if (!matchGrouping.isPresent()) { + throw new CodecPreconditionException(extension); + } + Short value = matchGrouping.get().getNxmNxNsi().getNsi(); + OfjAugNxMatchBuilder augNxMatchBuilder = new OfjAugNxMatchBuilder().setNsiValues(new NsiValuesBuilder() + .setNsi(value).build()); + return MatchUtil + .createNiciraMatchEntries( + Nxm1Class.class, + org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.NxmNxNsi.class, + false, augNxMatchBuilder.build()); + } + +} diff --git a/extension/openflowplugin-extension-nicira/src/main/java/org/opendaylight/openflowplugin/extension/vendor/nicira/convertor/match/NspConvertor.java b/extension/openflowplugin-extension-nicira/src/main/java/org/opendaylight/openflowplugin/extension/vendor/nicira/convertor/match/NspConvertor.java new file mode 100644 index 0000000000..91db426915 --- /dev/null +++ b/extension/openflowplugin-extension-nicira/src/main/java/org/opendaylight/openflowplugin/extension/vendor/nicira/convertor/match/NspConvertor.java @@ -0,0 +1,79 @@ +/* + * Copyright (C) 2014 Red Hat, Inc. + * + * 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 + * + * Authors : Madhu Venugopal + */ +package org.opendaylight.openflowplugin.extension.vendor.nicira.convertor.match; + +import org.opendaylight.openflowplugin.extension.api.ConvertorFromOFJava; +import org.opendaylight.openflowplugin.extension.api.ConvertorToOFJava; +import org.opendaylight.openflowplugin.extension.api.ExtensionAugment; +import org.opendaylight.openflowplugin.extension.api.path.MatchPath; +import org.opendaylight.openflowplugin.extension.vendor.nicira.convertor.CodecPreconditionException; +import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Nxm1Class; +import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntries; +import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.OfjAugNxMatch; +import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.OfjAugNxMatchBuilder; +import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.ofj.nxm.nx.match.nsp.grouping.NspValues; +import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.ofj.nxm.nx.match.nsp.grouping.NspValuesBuilder; +import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.general.rev140714.ExtensionKey; +import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.general.rev140714.general.extension.grouping.Extension; +import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.match.rev140714.NxAugMatchNotifPacketIn; +import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.match.rev140714.NxAugMatchNotifPacketInBuilder; +import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.match.rev140714.NxAugMatchNotifSwitchFlowRemoved; +import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.match.rev140714.NxAugMatchNotifSwitchFlowRemovedBuilder; +import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.match.rev140714.NxAugMatchNotifUpdateFlowStats; +import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.match.rev140714.NxAugMatchNotifUpdateFlowStatsBuilder; +import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.match.rev140714.NxmNxNspGrouping; +import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.match.rev140714.NxmNxNspKey; +import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.match.rev140714.nxm.nx.nsp.grouping.NxmNxNsp; +import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.match.rev140714.nxm.nx.nsp.grouping.NxmNxNspBuilder; +import org.opendaylight.yangtools.yang.binding.Augmentation; + +import com.google.common.base.Optional; +public class NspConvertor implements ConvertorToOFJava, ConvertorFromOFJava { + @Override + public ExtensionAugment> convert(MatchEntries input, MatchPath path) { + NspValues values = input.getAugmentation(OfjAugNxMatch.class).getNspValues(); + return resolveAugmentation(new NxmNxNspBuilder().setValue(values.getNsp()).build(), path, + NxmNxNspKey.class); + } + + private static ExtensionAugment> resolveAugmentation(NxmNxNsp value, + MatchPath path, Class key) { + switch (path) { + case FLOWSSTATISTICSUPDATE_FLOWANDSTATISTICSMAPLIST_MATCH: + return new ExtensionAugment<>(NxAugMatchNotifUpdateFlowStats.class, + new NxAugMatchNotifUpdateFlowStatsBuilder().setNxmNxNsp(value).build(), key); + case PACKETRECEIVED_MATCH: + return new ExtensionAugment<>(NxAugMatchNotifPacketIn.class, new NxAugMatchNotifPacketInBuilder() + .setNxmNxNsp(value).build(), key); + case SWITCHFLOWREMOVED_MATCH: + return new ExtensionAugment<>(NxAugMatchNotifSwitchFlowRemoved.class, + new NxAugMatchNotifSwitchFlowRemovedBuilder().setNxmNxNsp(value).build(), key); + default: + throw new CodecPreconditionException(path); + } + } + + @Override + public MatchEntries convert(Extension extension) { + Optional matchGrouping = MatchUtil.nspResolver.getExtension(extension); + if (!matchGrouping.isPresent()) { + throw new CodecPreconditionException(extension); + } + Long value = matchGrouping.get().getNxmNxNsp().getValue(); + OfjAugNxMatchBuilder augNxMatchBuilder = new OfjAugNxMatchBuilder().setNspValues(new NspValuesBuilder() + .setNsp(value).build()); + return MatchUtil + .createNiciraMatchEntries( + Nxm1Class.class, + org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.NxmNxNsp.class, + false, augNxMatchBuilder.build()); + } + +} diff --git a/extension/openflowplugin-extension-nicira/src/main/yang/openflowplugin-extension-nicira-action.yang b/extension/openflowplugin-extension-nicira/src/main/yang/openflowplugin-extension-nicira-action.yang index 6c06f8f6e2..41b86b27c1 100644 --- a/extension/openflowplugin-extension-nicira/src/main/yang/openflowplugin-extension-nicira-action.yang +++ b/extension/openflowplugin-extension-nicira/src/main/yang/openflowplugin-extension-nicira-action.yang @@ -271,6 +271,25 @@ bits specified from the register."; } } + grouping nx-action-set-nsp-grouping { + container nx-set-nsp { + description "Sets NSP header"; + description "Sets NSH Service Path ID (NSP) header"; + leaf nsp { + type uint32; + } + } + } + + grouping nx-action-set-nsi-grouping { + container nx-set-nsi { + description "Sets NSH Service Index (NSI) header"; + leaf nsi { + type uint8; + } + } + } + // ACTION augmentations // RPCS augment "/sal-flow:add-flow/sal-flow:input/sal-flow:instructions/sal-flow:instruction/sal-flow:instruction/sal-flow:write-actions-case/sal-flow:write-actions/sal-flow:action/sal-flow:action" { @@ -298,6 +317,17 @@ bits specified from the register."; uses nx-action-multipath-grouping; } } + augment "/sal-flow:add-flow/sal-flow:input/sal-flow:instructions/sal-flow:instruction/sal-flow:instruction/sal-flow:write-actions-case/sal-flow:write-actions/sal-flow:action/sal-flow:action" { + case nx-action-set-nsp-rpc-add-flow-write-actions-case { + uses nx-action-set-nsp-grouping; + } + } + augment "/sal-flow:add-flow/sal-flow:input/sal-flow:instructions/sal-flow:instruction/sal-flow:instruction/sal-flow:write-actions-case/sal-flow:write-actions/sal-flow:action/sal-flow:action" { + case nx-action-set-nsi-rpc-add-flow-write-actions-case { + uses nx-action-set-nsi-grouping; + } + } + augment "/sal-flow:add-flow/sal-flow:input/sal-flow:instructions/sal-flow:instruction/sal-flow:instruction/sal-flow:apply-actions-case/sal-flow:apply-actions/sal-flow:action/sal-flow:action" { case nx-action-reg-load-rpc-add-flow-apply-actions-case { uses nx-action-reg-load-grouping; @@ -323,6 +353,16 @@ bits specified from the register."; uses nx-action-multipath-grouping; } } + augment "/sal-flow:add-flow/sal-flow:input/sal-flow:instructions/sal-flow:instruction/sal-flow:instruction/sal-flow:apply-actions-case/sal-flow:apply-actions/sal-flow:action/sal-flow:action" { + case nx-action-set-nsp-rpc-add-flow-apply-actions-case { + uses nx-action-set-nsp-grouping; + } + } + augment "/sal-flow:add-flow/sal-flow:input/sal-flow:instructions/sal-flow:instruction/sal-flow:instruction/sal-flow:apply-actions-case/sal-flow:apply-actions/sal-flow:action/sal-flow:action" { + case nx-action-set-nsi-rpc-add-flow-apply-actions-case { + uses nx-action-set-nsi-grouping; + } + } augment "/sal-flow:remove-flow/sal-flow:input/sal-flow:instructions/sal-flow:instruction/sal-flow:instruction/sal-flow:write-actions-case/sal-flow:write-actions/sal-flow:action/sal-flow:action" { case "nx-action-reg-load-rpc-remove-flow-write-actions-case" { @@ -349,6 +389,17 @@ bits specified from the register."; uses nx-action-multipath-grouping; } } + augment "/sal-flow:remove-flow/sal-flow:input/sal-flow:instructions/sal-flow:instruction/sal-flow:instruction/sal-flow:write-actions-case/sal-flow:write-actions/sal-flow:action/sal-flow:action" { + case nx-action-set-nsp-rpc-remove-flow-write-actions-case { + uses nx-action-set-nsp-grouping; + } + } + augment "/sal-flow:remove-flow/sal-flow:input/sal-flow:instructions/sal-flow:instruction/sal-flow:instruction/sal-flow:write-actions-case/sal-flow:write-actions/sal-flow:action/sal-flow:action" { + case nx-action-set-nsi-rpc-remove-flow-write-actions-case { + uses nx-action-set-nsi-grouping; + } + } + augment "/sal-flow:remove-flow/sal-flow:input/sal-flow:instructions/sal-flow:instruction/sal-flow:instruction/sal-flow:apply-actions-case/sal-flow:apply-actions/sal-flow:action/sal-flow:action" { case "nx-action-reg-load-rpc-remove-flow-apply-actions-case" { uses nx-action-reg-load-grouping; @@ -374,6 +425,16 @@ bits specified from the register."; uses nx-action-multipath-grouping; } } + augment "/sal-flow:remove-flow/sal-flow:input/sal-flow:instructions/sal-flow:instruction/sal-flow:instruction/sal-flow:apply-actions-case/sal-flow:apply-actions/sal-flow:action/sal-flow:action" { + case nx-action-set-nsp-rpc-remove-flow-apply-actions-case { + uses nx-action-set-nsp-grouping; + } + } + augment "/sal-flow:remove-flow/sal-flow:input/sal-flow:instructions/sal-flow:instruction/sal-flow:instruction/sal-flow:apply-actions-case/sal-flow:apply-actions/sal-flow:action/sal-flow:action" { + case nx-action-set-nsi-rpc-remove-flow-apply-actions-case { + uses nx-action-set-nsi-grouping; + } + } augment "/sal-flow:update-flow/sal-flow:input/sal-flow:original-flow/sal-flow:instructions/sal-flow:instruction/sal-flow:instruction/sal-flow:write-actions-case/sal-flow:write-actions/sal-flow:action/sal-flow:action" { case "nx-action-reg-load-rpc-update-flow-original-write-actions-case" { @@ -400,6 +461,17 @@ bits specified from the register."; uses nx-action-multipath-grouping; } } + augment "/sal-flow:update-flow/sal-flow:input/sal-flow:original-flow/sal-flow:instructions/sal-flow:instruction/sal-flow:instruction/sal-flow:write-actions-case/sal-flow:write-actions/sal-flow:action/sal-flow:action" { + case "nx-action-set-nsp-rpc-update-flow-original-write-actions-case" { + uses nx-action-set-nsp-grouping; + } + } + augment "/sal-flow:update-flow/sal-flow:input/sal-flow:original-flow/sal-flow:instructions/sal-flow:instruction/sal-flow:instruction/sal-flow:write-actions-case/sal-flow:write-actions/sal-flow:action/sal-flow:action" { + case "nx-action-set-nsi-rpc-update-flow-original-write-actions-case" { + uses nx-action-set-nsi-grouping; + } + } + augment "/sal-flow:update-flow/sal-flow:input/sal-flow:original-flow/sal-flow:instructions/sal-flow:instruction/sal-flow:instruction/sal-flow:apply-actions-case/sal-flow:apply-actions/sal-flow:action/sal-flow:action" { case "nx-action-reg-load-rpc-update-flow-original-apply-actions-case" { uses nx-action-reg-load-grouping; @@ -425,6 +497,17 @@ bits specified from the register."; uses nx-action-multipath-grouping; } } + augment "/sal-flow:update-flow/sal-flow:input/sal-flow:original-flow/sal-flow:instructions/sal-flow:instruction/sal-flow:instruction/sal-flow:apply-actions-case/sal-flow:apply-actions/sal-flow:action/sal-flow:action" { + case "nx-action-set-nsp-rpc-update-flow-original-apply-actions-case" { + uses nx-action-set-nsp-grouping; + } + } + augment "/sal-flow:update-flow/sal-flow:input/sal-flow:original-flow/sal-flow:instructions/sal-flow:instruction/sal-flow:instruction/sal-flow:apply-actions-case/sal-flow:apply-actions/sal-flow:action/sal-flow:action" { + case "nx-action-set-nsi-rpc-update-flow-original-apply-actions-case" { + uses nx-action-set-nsi-grouping; + } + } + augment "/sal-flow:update-flow/sal-flow:input/sal-flow:updated-flow/sal-flow:instructions/sal-flow:instruction/sal-flow:instruction/sal-flow:write-actions-case/sal-flow:write-actions/sal-flow:action/sal-flow:action" { case "nx-action-reg-load-rpc-update-flow-updated-write-actions-case" { uses nx-action-reg-load-grouping; @@ -450,6 +533,17 @@ bits specified from the register."; uses nx-action-multipath-grouping; } } + augment "/sal-flow:update-flow/sal-flow:input/sal-flow:updated-flow/sal-flow:instructions/sal-flow:instruction/sal-flow:instruction/sal-flow:write-actions-case/sal-flow:write-actions/sal-flow:action/sal-flow:action" { + case "nx-action-set-nsp-rpc-update-flow-updated-write-actions-case" { + uses nx-action-set-nsp-grouping; + } + } + augment "/sal-flow:update-flow/sal-flow:input/sal-flow:updated-flow/sal-flow:instructions/sal-flow:instruction/sal-flow:instruction/sal-flow:write-actions-case/sal-flow:write-actions/sal-flow:action/sal-flow:action" { + case "nx-action-set-nsi-rpc-update-flow-updated-write-actions-case" { + uses nx-action-set-nsi-grouping; + } + } + augment "/sal-flow:update-flow/sal-flow:input/sal-flow:updated-flow/sal-flow:instructions/sal-flow:instruction/sal-flow:instruction/sal-flow:apply-actions-case/sal-flow:apply-actions/sal-flow:action/sal-flow:action" { case "nx-action-reg-load-rpc-update-flow-updated-apply-actions-case" { uses nx-action-reg-load-grouping; @@ -475,6 +569,16 @@ bits specified from the register."; uses nx-action-multipath-grouping; } } + augment "/sal-flow:update-flow/sal-flow:input/sal-flow:updated-flow/sal-flow:instructions/sal-flow:instruction/sal-flow:instruction/sal-flow:apply-actions-case/sal-flow:apply-actions/sal-flow:action/sal-flow:action" { + case "nx-action-set-nsp-rpc-update-flow-updated-apply-actions-case" { + uses nx-action-set-nsp-grouping; + } + } + augment "/sal-flow:update-flow/sal-flow:input/sal-flow:updated-flow/sal-flow:instructions/sal-flow:instruction/sal-flow:instruction/sal-flow:apply-actions-case/sal-flow:apply-actions/sal-flow:action/sal-flow:action" { + case "nx-action-set-nsi-rpc-update-flow-updated-apply-actions-case" { + uses nx-action-set-nsi-grouping; + } + } augment "/sal-group:add-group/sal-group:input/sal-group:buckets/sal-group:bucket/sal-group:action/sal-group:action" { case "nx-action-reg-load-rpc-add-group-case" { @@ -501,6 +605,16 @@ bits specified from the register."; uses nx-action-multipath-grouping; } } + augment "/sal-group:add-group/sal-group:input/sal-group:buckets/sal-group:bucket/sal-group:action/sal-group:action" { + case "nx-action-set-nsp-rpc-add-group-case" { + uses nx-action-set-nsp-grouping; + } + } + augment "/sal-group:add-group/sal-group:input/sal-group:buckets/sal-group:bucket/sal-group:action/sal-group:action" { + case "nx-action-set-nsi-rpc-add-group-case" { + uses nx-action-set-nsi-grouping; + } + } augment "/sal-group:remove-group/sal-group:input/sal-group:buckets/sal-group:bucket/sal-group:action/sal-group:action" { case "nx-action-reg-load-rpc-remove-group-case" { @@ -527,6 +641,16 @@ bits specified from the register."; uses nx-action-multipath-grouping; } } + augment "/sal-group:remove-group/sal-group:input/sal-group:buckets/sal-group:bucket/sal-group:action/sal-group:action" { + case "nx-action-set-nsp-rpc-remove-group-case" { + uses nx-action-set-nsp-grouping; + } + } + augment "/sal-group:remove-group/sal-group:input/sal-group:buckets/sal-group:bucket/sal-group:action/sal-group:action" { + case "nx-action-set-nsi-rpc-remove-group-case" { + uses nx-action-set-nsi-grouping; + } + } augment "/sal-group:update-group/sal-group:input/sal-group:original-group/sal-group:buckets/sal-group:bucket/sal-group:action/sal-group:action" { case "nx-action-reg-load-rpc-update-group-original-case" { @@ -553,6 +677,17 @@ bits specified from the register."; uses nx-action-multipath-grouping; } } + augment "/sal-group:update-group/sal-group:input/sal-group:original-group/sal-group:buckets/sal-group:bucket/sal-group:action/sal-group:action" { + case "nx-action-set-nsp-rpc-update-group-original-case" { + uses nx-action-set-nsp-grouping; + } + } + augment "/sal-group:update-group/sal-group:input/sal-group:original-group/sal-group:buckets/sal-group:bucket/sal-group:action/sal-group:action" { + case "nx-action-set-nsi-rpc-update-group-original-case" { + uses nx-action-set-nsi-grouping; + } + } + augment "/sal-group:update-group/sal-group:input/sal-group:updated-group/sal-group:buckets/sal-group:bucket/sal-group:action/sal-group:action" { case "nx-action-reg-load-rpc-update-group-updated-case" { uses nx-action-reg-load-grouping; @@ -578,6 +713,16 @@ bits specified from the register."; uses nx-action-multipath-grouping; } } + augment "/sal-group:update-group/sal-group:input/sal-group:updated-group/sal-group:buckets/sal-group:bucket/sal-group:action/sal-group:action" { + case "nx-action-set-nsp-rpc-update-group-updated-case" { + uses nx-action-set-nsp-grouping; + } + } + augment "/sal-group:update-group/sal-group:input/sal-group:updated-group/sal-group:buckets/sal-group:bucket/sal-group:action/sal-group:action" { + case "nx-action-set-nsi-rpc-update-group-updated-case" { + uses nx-action-set-nsi-grouping; + } + } augment "/sal-packet:transmit-packet/sal-packet:input/sal-packet:action/sal-packet:action" { case "nx-action-reg-load-rpc-transmit-packet-case" { @@ -604,6 +749,16 @@ bits specified from the register."; uses nx-action-multipath-grouping; } } + augment "/sal-packet:transmit-packet/sal-packet:input/sal-packet:action/sal-packet:action" { + case "nx-action-set-nsp-rpc-transmit-packet-case" { + uses nx-action-set-nsp-grouping; + } + } + augment "/sal-packet:transmit-packet/sal-packet:input/sal-packet:action/sal-packet:action" { + case "nx-action-set-nsi-rpc-transmit-packet-case" { + uses nx-action-set-nsi-grouping; + } + } // DATA augment "/inv:nodes/inv:node/fni:table/fni:flow/fni:instructions/fni:instruction/fni:instruction/fni:write-actions-case/fni:write-actions/fni:action/fni:action" { @@ -631,6 +786,17 @@ bits specified from the register."; uses nx-action-multipath-grouping; } } + augment "/inv:nodes/inv:node/fni:table/fni:flow/fni:instructions/fni:instruction/fni:instruction/fni:write-actions-case/fni:write-actions/fni:action/fni:action" { + case "nx-action-set-nsp-nodes-node-table-flow-write-actions-case" { + uses nx-action-set-nsp-grouping; + } + } + augment "/inv:nodes/inv:node/fni:table/fni:flow/fni:instructions/fni:instruction/fni:instruction/fni:write-actions-case/fni:write-actions/fni:action/fni:action" { + case "nx-action-set-nsi-nodes-node-table-flow-write-actions-case" { + uses nx-action-set-nsi-grouping; + } + } + augment "/inv:nodes/inv:node/fni:table/fni:flow/fni:instructions/fni:instruction/fni:instruction/fni:apply-actions-case/fni:apply-actions/fni:action/fni:action" { case "nx-action-reg-load-nodes-node-table-flow-apply-actions-case" { uses nx-action-reg-load-grouping; @@ -656,6 +822,16 @@ bits specified from the register."; uses nx-action-multipath-grouping; } } + augment "/inv:nodes/inv:node/fni:table/fni:flow/fni:instructions/fni:instruction/fni:instruction/fni:apply-actions-case/fni:apply-actions/fni:action/fni:action" { + case "nx-action-set-nsp-nodes-node-table-flow-apply-actions-case" { + uses nx-action-set-nsp-grouping; + } + } + augment "/inv:nodes/inv:node/fni:table/fni:flow/fni:instructions/fni:instruction/fni:instruction/fni:apply-actions-case/fni:apply-actions/fni:action/fni:action" { + case "nx-action-set-nsi-nodes-node-table-flow-apply-actions-case" { + uses nx-action-set-nsi-grouping; + } + } augment "/inv:nodes/inv:node/fni:group/fni:buckets/fni:bucket/fni:action/fni:action" { case "nx-action-reg-load-nodes-node-group-buckets-bucket-actions-case" { @@ -682,6 +858,16 @@ bits specified from the register."; uses nx-action-multipath-grouping; } } + augment "/inv:nodes/inv:node/fni:group/fni:buckets/fni:bucket/fni:action/fni:action" { + case "nx-action-set-nsp-nodes-node-group-buckets-bucket-actions-case" { + uses nx-action-set-nsp-grouping; + } + } + augment "/inv:nodes/inv:node/fni:group/fni:buckets/fni:bucket/fni:action/fni:action" { + case "nx-action-set-nsi-nodes-node-group-buckets-bucket-actions-case" { + uses nx-action-set-nsi-grouping; + } + } // NOTIFICATIONS augment "/odl-flow-stats:flows-statistics-update/odl-flow-stats:flow-and-statistics-map-list/odl-flow-stats:instructions/odl-flow-stats:instruction/odl-flow-stats:instruction/odl-flow-stats:write-actions-case/odl-flow-stats:write-actions/odl-flow-stats:action/odl-flow-stats:action" { @@ -709,6 +895,16 @@ bits specified from the register."; uses nx-action-multipath-grouping; } } + augment "/odl-flow-stats:flows-statistics-update/odl-flow-stats:flow-and-statistics-map-list/odl-flow-stats:instructions/odl-flow-stats:instruction/odl-flow-stats:instruction/odl-flow-stats:write-actions-case/odl-flow-stats:write-actions/odl-flow-stats:action/odl-flow-stats:action" { + case "nx-action-set-nsp-notif-flows-statistics-update-write-actions-case" { + uses nx-action-set-nsp-grouping; + } + } + augment "/odl-flow-stats:flows-statistics-update/odl-flow-stats:flow-and-statistics-map-list/odl-flow-stats:instructions/odl-flow-stats:instruction/odl-flow-stats:instruction/odl-flow-stats:write-actions-case/odl-flow-stats:write-actions/odl-flow-stats:action/odl-flow-stats:action" { + case "nx-action-set-nsi-notif-flows-statistics-update-write-actions-case" { + uses nx-action-set-nsi-grouping; + } + } augment "/odl-flow-stats:flows-statistics-update/odl-flow-stats:flow-and-statistics-map-list/odl-flow-stats:instructions/odl-flow-stats:instruction/odl-flow-stats:instruction/odl-flow-stats:apply-actions-case/odl-flow-stats:apply-actions/odl-flow-stats:action/odl-flow-stats:action" { case "nx-action-reg-load-notif-flows-statistics-update-apply-actions-case" { @@ -735,6 +931,16 @@ bits specified from the register."; uses nx-action-multipath-grouping; } } + augment "/odl-flow-stats:flows-statistics-update/odl-flow-stats:flow-and-statistics-map-list/odl-flow-stats:instructions/odl-flow-stats:instruction/odl-flow-stats:instruction/odl-flow-stats:apply-actions-case/odl-flow-stats:apply-actions/odl-flow-stats:action/odl-flow-stats:action" { + case "nx-action-set-nsp-notif-flows-statistics-update-apply-actions-case" { + uses nx-action-set-nsp-grouping; + } + } + augment "/odl-flow-stats:flows-statistics-update/odl-flow-stats:flow-and-statistics-map-list/odl-flow-stats:instructions/odl-flow-stats:instruction/odl-flow-stats:instruction/odl-flow-stats:apply-actions-case/odl-flow-stats:apply-actions/odl-flow-stats:action/odl-flow-stats:action" { + case "nx-action-set-nsi-notif-flows-statistics-update-apply-actions-case" { + uses nx-action-set-nsi-grouping; + } + } augment "/odl-group-stats:group-desc-stats-updated/odl-group-stats:group-desc-stats/odl-group-stats:buckets/odl-group-stats:bucket/odl-group-stats:action/odl-group-stats:action" { case "nx-action-reg-load-notif-group-desc-stats-updated-case" { @@ -761,4 +967,14 @@ bits specified from the register."; uses nx-action-multipath-grouping; } } + augment "/odl-group-stats:group-desc-stats-updated/odl-group-stats:group-desc-stats/odl-group-stats:buckets/odl-group-stats:bucket/odl-group-stats:action/odl-group-stats:action" { + case "nx-action-set-nsp-notif-group-desc-stats-updated-case" { + uses nx-action-set-nsp-grouping; + } + } + augment "/odl-group-stats:group-desc-stats-updated/odl-group-stats:group-desc-stats/odl-group-stats:buckets/odl-group-stats:bucket/odl-group-stats:action/odl-group-stats:action" { + case "nx-action-set-nsi-notif-group-desc-stats-updated-case" { + uses nx-action-set-nsi-grouping; + } + } } diff --git a/extension/openflowplugin-extension-nicira/src/main/yang/openflowplugin-extension-nicira-match.yang b/extension/openflowplugin-extension-nicira/src/main/yang/openflowplugin-extension-nicira-match.yang index af6797aeab..c3efdfb385 100644 --- a/extension/openflowplugin-extension-nicira/src/main/yang/openflowplugin-extension-nicira-match.yang +++ b/extension/openflowplugin-extension-nicira/src/main/yang/openflowplugin-extension-nicira-match.yang @@ -3,11 +3,11 @@ module openflowplugin-extension-nicira-match { namespace "urn:opendaylight:openflowplugin:extension:nicira:match"; prefix "openflowplugin-nicira-match"; - - import yang-ext {prefix ext; revision-date "2013-07-09";} - import flow-node-inventory {prefix fni; revision-date 2013-08-19; } - import opendaylight-inventory {prefix inv;revision-date "2013-08-19";} - import sal-flow {prefix sal-flow;revision-date "2013-08-19";} + + import yang-ext {prefix ext; revision-date "2013-07-09";} + import flow-node-inventory {prefix fni; revision-date 2013-08-19; } + import opendaylight-inventory {prefix inv;revision-date "2013-08-19";} + import sal-flow {prefix sal-flow;revision-date "2013-08-19";} import packet-processing {prefix sal-packet;revision-date "2013-07-09";} import openflowplugin-extension-general {prefix ext-gen;revision-date "2014-07-14";} import opendaylight-flow-statistics {prefix odl-flow-stats;revision-date "2013-08-19";} @@ -79,6 +79,12 @@ module openflowplugin-extension-nicira-match { identity nxm-of-eth-type-key { base ext-gen:extension-key; } + identity nxm-nx-nsp-key { + base ext-gen:extension-key; + } + identity nxm-nx-nsi-key { + base ext-gen:extension-key; + } grouping ipv4-address-grouping { leaf ipv4-address { @@ -91,18 +97,18 @@ module openflowplugin-extension-nicira-match { } } - grouping nxm-nx-reg-grouping { - container nxm-nx-reg { - leaf reg { + grouping nxm-nx-reg-grouping { + container nxm-nx-reg { + leaf reg { type identityref { base nicira-match:nxm-nx-reg; } } - leaf value { + leaf value { type uint32; } - } - } + } + } grouping nxm-nx-tun-id-grouping { container nxm-nx-tun-id { leaf value { @@ -167,6 +173,21 @@ module openflowplugin-extension-nicira-match { } } } + grouping nxm-nx-nsp-grouping { + container nxm-nx-nsp { + leaf value { + type uint32; + } + } + } + grouping nxm-nx-nsi-grouping { + container nxm-nx-nsi { + leaf nsi { + type uint8; + } + } + } + grouping all-matches-grouping { uses nxm-nx-reg-grouping; @@ -181,6 +202,8 @@ module openflowplugin-extension-nicira-match { uses nxm-of-eth-src-grouping; uses nxm-of-eth-dst-grouping; uses nxm-of-eth-type-grouping; + uses nxm-nx-nsp-grouping; + uses nxm-nx-nsi-grouping; } // MATCH augmentations @@ -222,4 +245,4 @@ module openflowplugin-extension-nicira-match { uses all-matches-grouping; } -} \ No newline at end of file +}