Add yang models for bundle messages 24/47724/5
authorAndrej Leitner <andrej.leitner@pantheon.tech>
Mon, 24 Oct 2016 06:45:01 +0000 (08:45 +0200)
committerAndrej Leitner <andrej.leitner@pantheon.tech>
Fri, 4 Nov 2016 07:52:02 +0000 (08:52 +0100)
 - augmented model of experimenter message for ONF_ET_BUNDLE_CONTROL
   and ONF_ET_BUNDLE_ADD_MESSAGE messages
 - added related defined types (error codes, flags, properties, ...)

Reference: ONF approved extension #230
Resolves: Bug 6806

Change-Id: I03761dc2630928623dbb55c55fd148c762b2489a
Signed-off-by: Andrej Leitner <andrej.leitner@pantheon.tech>
openflow-protocol-api/src/main/java/org/opendaylight/openflowjava/protocol/api/util/EncodeConstants.java
openflow-protocol-api/src/main/java/org/opendaylight/openflowjava/protocol/api/util/OxmMatchConstants.java
openflow-protocol-api/src/main/yang/openflow-approved-extensions.yang
openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/deserialization/MatchEntryDeserializerInitializer.java
openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/serialization/MatchEntriesInitializer.java
openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/serialization/match/ext/OnfOxmTcpFlagsSerializer.java

index dad7b76f1b4c128443a99e6b9fcffc8922f6334a..8c6539b6e75135ec4d73ce3d203f57caf7900308 100644 (file)
@@ -62,8 +62,16 @@ public abstract class EncodeConstants {
 
     /** OF v1.0 maximal port name length */
     public static final byte MAX_PORT_NAME_LENGTH = 16;
-    /** OF v1.3 length of experimenter_ids - see Multipart TableFeatures (properties) message */
-    public static final byte EXPERIMENTER_IDS_LENGTH = 8;
+
+    /** ONF Approved Extensions Constants */
+    /** Experimenter ID of ONF approved extensions */
+    public static final long ONF_EXPERIMENTER_ID = 0x4F4E4600;
+    /** ONFOXM_ET_TCP_FLAGS value */
+    public static final int ONFOXM_ET_TCP_FLAGS = 42;
+    /** ONF_ET_BUNDLE_CONTROL message type */
+    public static final int ONF_ET_BUNDLE_CONTROL = 2300;
+    /** ONF_ET_BUNDLE_ADD_MESSAGE message type */
+    public static final int ONF_ET_BUNDLE_ADD_MESSAGE = 2301;
 
     private EncodeConstants() {
         //not called
index f4da03ce530aec8a47de46004d8797d1e0f256f5..e47b70d6630efeba3e424c513c5547b5620f4f4c 100644 (file)
@@ -8,9 +8,8 @@
 package org.opendaylight.openflowjava.protocol.api.util;
 
 /**
- * Stores oxm_match constants
+ * Stores oxm_match constants.
  * @author michal.polkorab
- *
  */
 public abstract class OxmMatchConstants {
 
@@ -115,15 +114,6 @@ public abstract class OxmMatchConstants {
     /** NXM TCP_Flag value */
     public static final int NXM_NX_TCP_FLAG = 34;
 
-    /**
-     * ONF Approved Extensions Constants
-     */
-
-    /** ONFOXM_ET_TCP_FLAGS value */
-    public static final int ONFOXM_ET_TCP_FLAGS = 42;
-    /** ONFOXM_ET_TCP_FLAGS Experimenter Id (0x4F4E4600) */
-    public static final long ONFOXM_ET_TCP_FLAGS_EXP_ID = 1330529792;
-
     private OxmMatchConstants() {
         //not called
     }
index d4afa880003d51ecc3b168ead51b3872833a6488..17c89408bd2f17da07a1d7531af9a87bf135475a 100644 (file)
@@ -19,6 +19,77 @@ module openflow-approved-extensions {
 
     //ONF Approved OpenFlow Extensions
 
+    // ONF experimenter error codes
+    typedef onf-experimenter-error-code {
+        description "Error codes for experimenter error type.";
+        type enumeration {
+            enum ONFERR_ET_UNKNOWN {
+                description "Unspecified error.";
+                value 2300;
+            }
+            enum ONFERR_ET_EPERM {
+                description "Permissions error.";
+                value 2301;
+            }
+            enum ONFERR_ET_BAD_ID {
+                description "Bundle ID doesn’t exist.";
+                value 2302;
+            }
+            enum ONFERR_ET_BUNDLE_EXIST {
+                description "Bundle ID already exist.";
+                value 2303;
+            }
+            enum ONFERR_ET_BUNDLE_CLOSED {
+                description "Bundle ID is closed.";
+                value 2304;
+            }
+            enum ONFERR_ET_OUT_OF_BUNDLES {
+                description "Too many bundles IDs.";
+                value 2305;
+            }
+            enum ONFERR_ET_BAD_TYPE {
+                description "Unsupported or unknown message control type.";
+                value 2306;
+            }
+            enum ONFERR_ET_BAD_FLAGS {
+                description "Unsupported, unknown, or inconsistent flags.";
+                value 2307;
+            }
+            enum ONFERR_ET_MSG_BAD_LEN {
+                description "Length problem in included message.";
+                value 2308;
+            }
+            enum ONFERR_ET_MSG_BAD_XID {
+                description "Inconsistent or duplicate XID.";
+                value 2309;
+            }
+            enum ONFERR_ET_MSG_UNSUP {
+                description "Unsupported message in this bundle.";
+                value 2310;
+            }
+            enum ONFERR_ET_MSG_CONFLICT {
+                description "Unsupported message combination in this bundle.";
+                value 2311;
+            }
+            enum ONFERR_ET_MSG_TOO_MANY {
+                description "Can not handle this many messages in bundle.";
+                value 2312;
+            }
+            enum ONFERR_ET_MSG_FAILED {
+                description "One message in bundle failed.";
+                value 2313;
+            }
+            enum ONFERR_ET_TIMEOUT {
+                description "Bundle is taking too long.";
+                value 2314;
+            }
+            enum ONFERR_ET_BUNDLE_IN_PROGRESS {
+                description "Bundle is locking the resource.";
+                value 2315;
+            }
+        }
+    }
+
     // Extension 109 - TCP FLAGS
     identity tcp_flags {
         base oxm:match-field;
@@ -37,4 +108,124 @@ module openflow-approved-extensions {
         }
     }
 
+    // Extension 230 - Bundle Extension (experimenterID 0x4F4E4600)
+    typedef bundle-id {
+        description "Identify the bundle.";
+        type uint32;
+    }
+
+    typedef bundle-control-type {
+        description "Bundle control message type.";
+        type enumeration {
+            enum ONF_BCT_OPEN_REQUEST {
+                value 0;
+            }
+            enum ONF_BCT_OPEN_REPLY {
+                value 1;
+            }
+            enum ONF_BCT_CLOSE_REQUEST {
+                value 2;
+            }
+            enum ONF_BCT_CLOSE_REPLY {
+                value 3;
+            }
+            enum ONF_BCT_COMMIT_REQUEST {
+                value 4;
+            }
+            enum ONF_BCT_COMMIT_REPLY {
+                value 5;
+            }
+            enum ONF_BCT_DISCARD_REQUEST {
+                value 6;
+            }
+            enum ONF_BCT_DISCARD_REPLY {
+                value 7;
+            }
+        }
+    }
+
+    typedef bundle-flags {
+        description "Bundle configuration flags.";
+        type bits {
+            bit atomic {
+                description "Execute atomically.";
+                position 0;
+            }
+            bit ordered {
+                description "Execute in specified order.";
+                position 1;
+            }
+        }
+    }
+
+    typedef bundle-property-type {
+        description "Bundle property types.";
+        type enumeration {
+            enum ONF_ET_BPT_EXPERIMENTER {
+                description "Experimenter property.";
+                value 65535; //0xFFFF
+            }
+        }
+    }
+
+    grouping bundle-properties {
+        list bundle-property {
+            description "Bundle properties list.";
+            leaf type {
+                type bundle-property-type;
+            }
+            choice bundle-property-entry {
+                case bundle-experimenter-property {
+                    leaf experimenter {
+                         type oft:experimenter-id;
+                    }
+                    leaf exp-type {
+                         type uint32;
+                    }
+                    choice bundle-experimenter-property-data {
+                        // to be augmented by vendors
+                    }
+                }
+            }
+        }
+    }
+
+    augment "/ofproto:experimenter/ofproto:input/ofproto:experimenter-data-of-choice" {
+        case bundle-control {
+            description "ONF_ET_BUNDLE_CONTROL message in OpenFlow Switch Extension 230.";
+            leaf bundle-id {
+                type bundle-id;
+            }
+            leaf type {
+                type bundle-control-type;
+            }
+            leaf flags {
+                type bundle-flags;
+            }
+            uses bundle-properties;
+        }
+        case bundle-add-message {
+            description "ONF_ET_BUNDLE_ADD_MESSAGE in OpenFlow Switch Extension 230.";
+            leaf bundle-id {
+                type bundle-id;
+            }
+            leaf flags {
+                type bundle-flags;
+            }
+            // Inner message
+            choice message {
+                description "Message added to the bundle.";
+                case flow-mod-case {
+                    uses ofproto:flow-mod;
+                }
+                case group-mod-case {
+                    uses ofproto:group-mod;
+                }
+                case port-mod-case {
+                    uses ofproto:port-mod;
+                }
+            }
+            uses bundle-properties;
+        }
+    }
 }
\ No newline at end of file
index dc1bae06345ef3bd8b4f5a4ee33f57565f8877cc..98d1b34e725f07ce2859459c9f229847cb0806fe 100644 (file)
@@ -8,6 +8,8 @@
 package org.opendaylight.openflowjava.protocol.impl.deserialization;
 
 import org.opendaylight.openflowjava.protocol.api.extensibility.DeserializerRegistry;
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
 import org.opendaylight.openflowjava.protocol.impl.deserialization.match.OxmArpOpDeserializer;
 import org.opendaylight.openflowjava.protocol.impl.deserialization.match.OxmArpShaDeserializer;
 import org.opendaylight.openflowjava.protocol.impl.deserialization.match.OxmArpSpaDeserializer;
@@ -48,14 +50,12 @@ import org.opendaylight.openflowjava.protocol.impl.deserialization.match.OxmUdpD
 import org.opendaylight.openflowjava.protocol.impl.deserialization.match.OxmUdpSrcDeserializer;
 import org.opendaylight.openflowjava.protocol.impl.deserialization.match.OxmVlanPcpDeserializer;
 import org.opendaylight.openflowjava.protocol.impl.deserialization.match.OxmVlanVidDeserializer;
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
 import org.opendaylight.openflowjava.protocol.impl.deserialization.match.ext.OnfOxmTcpFlagsDeserializer;
 import org.opendaylight.openflowjava.protocol.impl.util.MatchEntryDeserializerRegistryHelper;
-import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
 
 /**
+ * Util class for init registration of match entry deserializers.
  * @author michal.polkorab
- *
  */
 public final class MatchEntryDeserializerInitializer {
 
@@ -64,7 +64,7 @@ public final class MatchEntryDeserializerInitializer {
     }
 
     /**
-     * Registers match entry deserializers
+     * Registers match entry deserializers.
      * @param registry registry to be filled with deserializers
      */
     public static void registerMatchEntryDeserializers(DeserializerRegistry registry) {
@@ -114,7 +114,7 @@ public final class MatchEntryDeserializerInitializer {
         helper.register(OxmMatchConstants.IPV6_EXTHDR, new OxmIpv6ExtHdrDeserializer());
 
         // Register approved openflow match entry deserializers
-        helper.registerExperimenter(OxmMatchConstants.ONFOXM_ET_TCP_FLAGS, OxmMatchConstants.ONFOXM_ET_TCP_FLAGS_EXP_ID,
+        helper.registerExperimenter(EncodeConstants.ONFOXM_ET_TCP_FLAGS, EncodeConstants.ONF_EXPERIMENTER_ID,
                 new OnfOxmTcpFlagsDeserializer());
     }
 }
index 2ed24e59ffea817b1009c76b34aed163d70738bf..a78797883583297b6ddd216500364b1b8d37a057 100644 (file)
@@ -9,7 +9,6 @@ package org.opendaylight.openflowjava.protocol.impl.serialization;
 
 import org.opendaylight.openflowjava.protocol.api.extensibility.SerializerRegistry;
 import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
-import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
 import org.opendaylight.openflowjava.protocol.impl.serialization.match.OxmArpOpSerializer;
 import org.opendaylight.openflowjava.protocol.impl.serialization.match.OxmArpShaSerializer;
 import org.opendaylight.openflowjava.protocol.impl.serialization.match.OxmArpSpaSerializer;
@@ -96,7 +95,7 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.Vlan
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.VlanVid;
 
 /**
- * Initializes serializer registry with match entry serializers
+ * Initializes serializer registry with match entry serializers.
  * @author michal.polkorab
  */
 public final class MatchEntriesInitializer {
@@ -106,7 +105,7 @@ public final class MatchEntriesInitializer {
     }
 
     /**
-     * Registers match entry serializers into provided registry
+     * Registers match entry serializers into provided registry.
      * @param serializerRegistry registry to be initialized with match entry serializers
      */
     public static void registerMatchEntrySerializers(SerializerRegistry serializerRegistry) {
@@ -157,7 +156,7 @@ public final class MatchEntriesInitializer {
         helper.registerSerializer(Ipv6Exthdr.class, new OxmIpv6ExtHdrSerializer());
 
         // Register approved openflow match entry serializers
-        helper.registerExperimenterSerializer(TcpFlags.class, OxmMatchConstants.ONFOXM_ET_TCP_FLAGS_EXP_ID,
+        helper.registerExperimenterSerializer(TcpFlags.class, EncodeConstants.ONF_EXPERIMENTER_ID,
                 new OnfOxmTcpFlagsSerializer());
     }
 }
index 340dc7ae67f85d03dc784b47ebd288a96cf0273a..f244cc42ff756fbfd40566d7b0955cc25df40cfa 100644 (file)
@@ -36,7 +36,7 @@ public class OnfOxmTcpFlagsSerializer extends AbstractOxmExperimenterMatchEntryS
      */
     @Override
     protected long getExperimenterId() {
-        return OxmMatchConstants.ONFOXM_ET_TCP_FLAGS_EXP_ID;
+        return EncodeConstants.ONF_EXPERIMENTER_ID;
     }
 
     /**
@@ -44,7 +44,7 @@ public class OnfOxmTcpFlagsSerializer extends AbstractOxmExperimenterMatchEntryS
      */
     @Override
     protected int getOxmFieldCode() {
-        return OxmMatchConstants.ONFOXM_ET_TCP_FLAGS;
+        return EncodeConstants.ONFOXM_ET_TCP_FLAGS;
     }
 
     /**