Add nemo template and constraint model. 29/30529/1
authorZhigang Ji <jizhigang@huawei.com>
Thu, 3 Dec 2015 08:32:32 +0000 (16:32 +0800)
committerZhigang Ji <jizhigang@huawei.com>
Thu, 3 Dec 2015 08:34:35 +0000 (16:34 +0800)
Change-Id: I93a58a968efefe52a81662c8844249e6a106e5e9
Signed-off-by: Zhigang Ji <jizhigang@huawei.com>
nemo-api/src/main/yang/nemo-common.yang
nemo-api/src/main/yang/nemo-intent.yang
nemo-api/src/main/yang/nemo-operation.yang
nemo-api/src/main/yang/nemo-template.yang [new file with mode: 0644]

index 072745f2c9dc1905b18acf5c43140c011fae7c56..22430ef7dad05f0240a5413b7ac712060562d290 100644 (file)
@@ -115,12 +115,24 @@ module nemo-common {
         type unique-id;\r
     }\r
 \r
+    typedef constraint-segment-id {\r
+        description\r
+            "A unique ID for a segment of the constraint in an operation.";\r
+        type unique-id;\r
+    }\r
+\r
     typedef query-condition-id {\r
         description\r
             "A unique ID for a condition of the advanced query.";\r
         type unique-id;\r
     }\r
 \r
+    typedef template-instance-id {\r
+        description\r
+            "A unique ID for a template instance.";\r
+        type unique-id;\r
+    }\r
+\r
     // *********************\r
     // * Names\r
     // *********************\r
@@ -178,6 +190,12 @@ module nemo-common {
         type name;\r
     }\r
 \r
+    typedef constraint-parameter-name {\r
+        description\r
+            "A name for a parameter of constraint.";\r
+        type name;\r
+    }\r
+\r
     typedef user-name {\r
         description\r
             "A name for a user.";\r
@@ -214,6 +232,18 @@ module nemo-common {
         type string;\r
     }\r
 \r
+    typedef template-name {\r
+        description\r
+            "A unique name for a template";\r
+        type name;\r
+    }\r
+\r
+    typedef template-instance-name {\r
+        description\r
+            "A unique name for a template instance.";\r
+        type name;\r
+    }\r
+\r
     // *********************\r
     // * Types\r
     // *********************\r
index 91876aa6bd793b9ebb298adaed33e5ac5712c669..8c2d605fc048adb6485a60cfa5a5569c131fbde9 100644 (file)
@@ -15,6 +15,7 @@ module nemo-intent {
     import nemo-common {prefix nemo-common;}\r
     import nemo-object {prefix nemo-object;}\r
     import nemo-operation {prefix nemo-operation;}\r
+    import nemo-template {prefix nemo-template;}\r
     import nemo-user {prefix nemo-user;}\r
 \r
     revision "2015-10-10" {\r
@@ -64,6 +65,14 @@ module nemo-intent {
         container results {\r
             // TBD\r
         }\r
+\r
+        container template-definitions {\r
+            uses nemo-template:template-definition;\r
+        }\r
+\r
+        container template-instances {\r
+            uses nemo-template:template-instance;\r
+        }\r
     }\r
 \r
     container users {\r
index 8b4083a6701db580592661c1cb34b9b461d78cb1..0da9cef4e6e847332111b5fae14193f42396fcfd 100644 (file)
@@ -71,6 +71,58 @@ module nemo-operation {
         }\r
     }\r
 \r
+    container constraint-parameter-definitions {\r
+        list constraint-parameter-definition {\r
+            description\r
+                "Defines the constraint parameter with its metadata.";\r
+\r
+            key "parameter-name";\r
+            leaf parameter-name {\r
+                description\r
+                    "A name for the constraint parameter.";\r
+                type nemo-common:parameter-name;\r
+                mandatory true;\r
+            }\r
+\r
+            leaf parameter-value-type {\r
+                description\r
+                    "A type of value for the constraint parameter.";\r
+                type enumeration {\r
+                    enum string {\r
+                        description\r
+                            "A string-valued parameter.";\r
+                    }\r
+                    enum int {\r
+                        description\r
+                            "An integer-valued parameter.";\r
+                    }\r
+                    enum range {\r
+                        description\r
+                            "An integer-range parameter.";\r
+                    }\r
+                }\r
+            }\r
+\r
+            container parameter-match-patterns {\r
+                description\r
+                    "Defines the match patterns of the constraint parameter.";\r
+\r
+                leaf-list parameter-match-pattern {\r
+                    type enumeration {\r
+                        enum less-than;\r
+                        enum not-less-than;\r
+                        enum equal;\r
+                        enum not-equal;\r
+                        enum greater-than;\r
+                        enum not-greater-than;\r
+                        enum between;\r
+                        enum periodical;\r
+                    }\r
+                }\r
+            }\r
+        }\r
+    }\r
+\r
     container action-definitions {\r
         list action-definition {\r
             description\r
@@ -188,6 +240,89 @@ module nemo-operation {
         }\r
     }\r
 \r
+    grouping constraint-instance {\r
+        description\r
+            "Specific a instance of constraint whose metadata has been filled in.";\r
+\r
+        list constraint-segment {\r
+            description\r
+                "The segment entities will be composed into a whole constraint entity.\r
+                 Each segment will be a sub expression of the constraint.";\r
+\r
+            key "constraint-segment-id";\r
+            leaf constraint-segment-id {\r
+                description\r
+                    "A unique ID for a constraint segment.";\r
+                type nemo-common:constraint-segment-id;\r
+                mandatory true;\r
+            }\r
+\r
+            leaf constraint-parameter-name {\r
+                description\r
+                    "A name for a constraint parameter.";\r
+                type nemo-common:constraint-parameter-name;\r
+            }\r
+\r
+            leaf constraint-parameter-match-pattern {\r
+                description\r
+                    "The operator for the constraint parameter and it's target value.";\r
+                type enumeration {\r
+                    enum less-than;\r
+                    enum not-less-than;\r
+                    enum equal;\r
+                    enum not-equal;\r
+                    enum greater-than;\r
+                    enum not-greater-than;\r
+                    enum between;\r
+                    enum periodical;\r
+                }\r
+            }\r
+\r
+            container constraint-parameter-target-value {\r
+                description\r
+                    "The target value of constraint parameter.";\r
+\r
+                leaf string-value {\r
+                    type string;\r
+                }\r
+\r
+                leaf int-value {\r
+                    type int64;\r
+                }\r
+\r
+                container range-value {\r
+                    leaf min {\r
+                        type int64;\r
+                        mandatory true;\r
+                    }\r
+\r
+                    leaf max {\r
+                        type int64;\r
+                        mandatory true;\r
+                    }\r
+\r
+                }\r
+            }\r
+\r
+            leaf precursor-relation-operator {\r
+                description\r
+                    "The logical operator between current segment and the next segment.";\r
+                type enumeration {\r
+                    enum none;\r
+                    enum and;\r
+                    enum or;\r
+                    enum not;\r
+                }\r
+            }\r
+\r
+            leaf order {\r
+                description\r
+                    "The order of the segment in the whole constraint entity.";\r
+                type uint32;\r
+            }\r
+        }\r
+    }\r
+\r
     grouping action-instance {\r
         description\r
             "Specific a action instance whose metadata has been filled in.";\r
@@ -274,6 +409,7 @@ module nemo-operation {
         }\r
 \r
         uses condition-instance;\r
+        uses constraint-instance;\r
 \r
         list action {\r
             description\r
diff --git a/nemo-api/src/main/yang/nemo-template.yang b/nemo-api/src/main/yang/nemo-template.yang
new file mode 100644 (file)
index 0000000..2b72fa4
--- /dev/null
@@ -0,0 +1,193 @@
+/*\r
+ * Copyright (c) 2015 Huawei, Inc. and others. All rights reserved.\r
+ *\r
+ * This program and the accompanying materials are made available under the\r
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
+ * and is available at http://www.eclipse.org/legal/epl-v10.html\r
+ */\r
+\r
+module nemo-template {\r
+    yang-version 1;\r
+\r
+    namespace "urn:opendaylight:params:xml:ns:yang:nemo:template";\r
+    prefix "nemo-template";\r
+\r
+    import nemo-common {prefix nemo-common;}\r
+    import nemo-object {prefix nemo-object;}\r
+    import nemo-operation {prefix nemo-operation;}\r
+\r
+    revision "2015-12-01" {\r
+        description\r
+            "Initial revision.";\r
+    }\r
+\r
+    grouping template-definition {\r
+        description\r
+            "It represents the node model instance and its metadata.\r
+             A node model defines a reusable function or template\r
+             which could be used many times.";\r
+\r
+        leaf template-name {\r
+            description\r
+                "A unique name for a template.";\r
+            type nemo-common:template-name;\r
+            mandatory true;\r
+        }\r
+\r
+        container abstract-intents {\r
+            description\r
+                "All abstract intents included in this template.";\r
+\r
+            container abstract-objects {\r
+                description\r
+                    "The element could be operated and managed by users.\r
+                     It includes resources to construct users' virtual networks,\r
+                     and the services in this network. In NEMO project, it is\r
+                     abstracted into node, connection and flow.";\r
+\r
+                list abstract-node {\r
+                    key "node-id";\r
+                    uses nemo-object:node-instance;\r
+                }\r
+\r
+                list abstract-connection {\r
+                    key "connection-id";\r
+                    uses nemo-object:connection-instance;\r
+                }\r
+\r
+                list abstract-flow {\r
+                    key "flow-id";\r
+                    uses nemo-object:flow-instance;\r
+                }\r
+            }\r
+\r
+            container abstract-operations {\r
+                description\r
+                    "The operation is to dynamically adjust the behavior of network,\r
+                     and it is applied on objects, that is, node, connection and flow.";\r
+\r
+                list abstract-operation {\r
+                    key "operation-id";\r
+                    uses nemo-operation:operation-instance;\r
+                }\r
+            }\r
+\r
+            container abstract-results {\r
+                // TBD\r
+            }\r
+        }\r
+\r
+        list template-parameter {\r
+            description\r
+                "List all the parameters included in the template. That is,\r
+                 other instance could have different values when instancing the\r
+                 template.";\r
+\r
+            key "parameter-name";\r
+            leaf parameter-name {\r
+                description\r
+                    "The name of the parameter.";\r
+                type nemo-common:parameter-name;\r
+                mandatory true;\r
+            }\r
+\r
+            leaf parameter-value-type {\r
+                description\r
+                    "List all value types could exist in the parameters.";\r
+                default string;\r
+                type enumeration {\r
+                    enum string {\r
+                        description\r
+                            "An string-valued property.";\r
+                    }\r
+                    enum int {\r
+                        description\r
+                            "An integer-valued property.";\r
+                    }\r
+                    enum range {\r
+                        description\r
+                            "An integer-range property.";\r
+                    }\r
+                }\r
+            }\r
+        }\r
+    }\r
+\r
+    grouping template-instance {\r
+        description\r
+            "A template instance which put specific values in the parameter list.";\r
+\r
+        leaf template-instance-id {\r
+            description\r
+                "A unique identifier for the template instance.";\r
+            type nemo-common:template-instance-id;\r
+            mandatory true;\r
+        }\r
+\r
+        leaf template-instance-name {\r
+            description\r
+                "A unique name for the template instance.";\r
+            type nemo-common:template-instance-name;\r
+            mandatory true;\r
+        }\r
+\r
+        leaf template-name {\r
+            description\r
+                "The template name instanced by this template instance.";\r
+            type nemo-common:template-name;\r
+            mandatory true;\r
+        }\r
+\r
+        list template-parameter {\r
+            description\r
+                "All specific parameters putted by this instance.";\r
+\r
+            key "parameter-name";\r
+            leaf parameter-name {\r
+                description\r
+                    "The name of the parameter.";\r
+                type nemo-common:parameter-name;\r
+                mandatory true;\r
+            }\r
+\r
+            container parameter-values {\r
+                description\r
+                    "The values for the parameter.";\r
+\r
+                list string-value {\r
+                    key "value order";\r
+                    leaf value {\r
+                        type string;\r
+                    }\r
+\r
+                    leaf order {\r
+                        type uint32;\r
+                    }\r
+                }\r
+\r
+                list int-value {\r
+                    key "value order";\r
+                    leaf value {\r
+                        type int64;\r
+                    }\r
+\r
+                    leaf order {\r
+                        type uint32;\r
+                    }\r
+                }\r
+\r
+                container range-value {\r
+                    leaf min {\r
+                        type int64;\r
+                        mandatory true;\r
+                    }\r
+\r
+                    leaf max {\r
+                        type int64;\r
+                        mandatory true;\r
+                    }\r
+                }\r
+            }\r
+        }\r
+    }\r
+}\r