Add nemo template and constraint model.
[nemo.git] / nemo-api / src / main / yang / nemo-operation.yang
index 219b19203fccd9e0f37da21d115d338ac4128987..0da9cef4e6e847332111b5fae14193f42396fcfd 100644 (file)
@@ -1,5 +1,5 @@
 /*\r
- * Copyright (c) 2015  Huawei Technologies Co., Ltd. and others.  All rights reserved.\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
  */\r
 \r
 module nemo-operation {\r
+    yang-version 1;\r
 \r
-       yang-version 1; \r
-       namespace "urn:opendaylight:params:xml:ns:yang:nemo:operation"; \r
-       prefix "nemo-operation";\r
-       \r
-       import nemo-common {prefix nemo-common;}\r
-       \r
-       revision "2015-06-29" {\r
+    namespace "urn:opendaylight:params:xml:ns:yang:nemo:operation";\r
+    prefix "nemo-operation";\r
+\r
+    import nemo-common {prefix nemo-common;}\r
+\r
+    revision "2015-10-10" {\r
         description\r
             "Initial revision.";\r
     }\r
-       \r
-       grouping parameter-definition {\r
-               leaf name {\r
-                       description "A user-visible name for parameter";\r
-                       type nemo-common:parameter-name;\r
-                       mandatory true;\r
-               }       \r
-               leaf type {\r
-                       description "The type of the parameter";\r
-                       default string;\r
-                       type enumeration {\r
-                               enum string {\r
-                                       description "A string-valued parameter";\r
-                               }\r
-                               enum int {\r
-                                       description "An integer-valued parameter";\r
-                               }\r
-                               enum range {\r
-                                       description "An integer-range parameter";\r
-                               }\r
-                       }\r
-               }       \r
-               leaf is-required {\r
-                       description "Specify whether the parameter is required ";\r
-                       default optional;\r
-                       type enumeration {\r
-                               enum required {\r
-                                       description "The parameter is required";\r
-                               }\r
-                               enum optional {\r
-                                       description "The parameter is optional";\r
-                               }\r
-                       }\r
-               }       \r
-       }\r
-       \r
-       \r
-       container action-definitions {\r
-           list action-definition {            \r
-                       key "action-name";\r
-                       leaf action-name {\r
-                               description "A name for the action definition";\r
-                               type nemo-common:action-definition-name;\r
-                           mandatory true;                     \r
-                   }                   \r
-               list data {\r
-                               description\r
-                                       "data for the action that can be passed in.";\r
-                               key "name";                     \r
-                               uses parameter-definition;              \r
-                   }           \r
-           }\r
-       }       \r
-       grouping action-parameter-instance{\r
-               leaf data-name {\r
-                       type nemo-common:data-name;\r
-                       mandatory true;\r
-               }\r
-               leaf string-value {\r
-                       type string;\r
-               }\r
-               leaf int-value {\r
-                       type int64;\r
-               }\r
-               container range-value {\r
-                       leaf min {\r
-                               type int64;\r
-                               mandatory true;\r
-                       }\r
-                       leaf max {\r
-                               type int64;\r
-                               mandatory true;\r
-                       }\r
-               }       \r
-       }       \r
-       grouping action-instance{\r
-               description " ";\r
-               leaf action-name{\r
-                       type nemo-common:action-instance-name;\r
-                       mandatory true;\r
-               }\r
-               list data {\r
-                       key "data-name";\r
-                       uses action-parameter-instance;                 \r
-               }               \r
-       }\r
-               \r
-       container condition-definitions {\r
-               list condition-definition{\r
-                       key "condition-name";\r
-                       leaf condition-name{\r
-                               type nemo-common:condition-definition-name;\r
-                               mandatory true;         \r
-                       }\r
-                       list condition-parameter{\r
-                               key "name";\r
-                               uses parameter-definition;\r
-                               min-elements 1;\r
-                       }       \r
-               }\r
-       }\r
-       grouping conditon-parameter-instance{\r
-               leaf parameter-name {\r
-                   type nemo-common:condition-parameter-name;\r
-                       mandatory true;\r
-               }\r
-               leaf string-value {\r
-                       type string;\r
-               }\r
-               leaf int-value {\r
-                       type int64;\r
-               }\r
-               container range-value {\r
-                       leaf min {\r
-                               type int64;\r
-                               mandatory true;\r
-                       }\r
-                       leaf max {\r
-                               type int64;\r
-                               mandatory true;\r
-                       }\r
-               }       \r
-       }       \r
-       grouping condition-instance {\r
-               description " ";\r
-               leaf condition-name{\r
-                       type nemo-common:condition-instance-name;\r
-                       mandatory true;                         \r
-               }       \r
-               list condition-parameter{\r
-                       key "parameter-name";\r
-                       uses conditon-parameter-instance;\r
-                       min-elements 1;\r
-               }\r
-       }\r
-       \r
-       \r
-       container constraint-definitions {\r
-               list constraint-definition{\r
-                       key "constraint-name";\r
-                       leaf constraint-name{\r
-                               type nemo-common:constraint-definition-name;\r
-                               mandatory true;         \r
-                       }\r
-                       list constraint-parameter{\r
-                               key "name";\r
-                               uses parameter-definition;\r
-                               min-elements 1;\r
-                       }       \r
-               }\r
-       }\r
-       grouping constraint-parameter-instance{\r
-               leaf parameter-name {\r
-                       type nemo-common:constraint-parameter-name;\r
-                       mandatory true;\r
-               }\r
-               leaf string-value {\r
-                       type string;\r
-               }\r
-               leaf int-value {\r
-                       type int64;\r
-               }\r
-               container range-value {\r
-                       leaf min {\r
-                               type int64;\r
-                               mandatory true;\r
-                       }\r
-                       leaf max {\r
-                               type int64;\r
-                               mandatory true;\r
-                       }\r
-               }       \r
-       }       \r
-       grouping constraint-instance {\r
-               description " ";\r
-               leaf constraint-name{\r
-                       type nemo-common:constraint-instance-name;\r
-                       mandatory true;                         \r
-               }       \r
-               list constraint-parameter{\r
-                       key "parameter-name";\r
-                       uses constraint-parameter-instance;\r
-                       min-elements 1;\r
-               }\r
-       }\r
-       \r
-}
\ No newline at end of file
+\r
+    container condition-parameter-definitions {\r
+        list condition-parameter-definition {\r
+            description\r
+                "Defines the condition parameter with its metadata.";\r
+\r
+            key "parameter-name";\r
+            leaf parameter-name {\r
+                description\r
+                    "A name for the condition 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 condition 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 condition 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 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
+                "Defines the actions which will be supported by the NEMO project.";\r
+\r
+            key "action-name";\r
+            leaf action-name {\r
+                description\r
+                    "A name for the action definition.";\r
+                type nemo-common:action-name;\r
+                mandatory true;\r
+            }\r
+\r
+            leaf parameter-value-type {\r
+                description\r
+                    "The type of the action parameter.";\r
+                default string;\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
+    }\r
+\r
+    grouping condition-instance {\r
+        description\r
+            "Specific a instance of condition whose metadata has been filled in.";\r
+\r
+        list condition-segment {\r
+            description\r
+                "The segment entities will be composed into a whole condition entity.\r
+                 Each segment will be a sub expression of the condition.";\r
+\r
+            key "condition-segment-id";\r
+            leaf condition-segment-id {\r
+                description\r
+                    "A unique ID for a condition segment.";\r
+                type nemo-common:condition-segment-id;\r
+                mandatory true;\r
+            }\r
+\r
+            leaf condition-parameter-name {\r
+                description\r
+                    "A name for a conditon parameter.";\r
+                type nemo-common:condition-parameter-name;\r
+            }\r
+\r
+            leaf condition-parameter-match-pattern {\r
+                description\r
+                    "The operator for the condition 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 condition-parameter-target-value {\r
+                description\r
+                    "The target value of condition 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
+            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 condition entity.";\r
+                type uint32;\r
+            }\r
+        }\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
+\r
+        leaf action-name {\r
+            description\r
+                "A name for a action instance.";\r
+            type nemo-common:action-name;\r
+            mandatory true;\r
+        }\r
+\r
+        container parameter-values {\r
+            description\r
+                "The parameter value list of an action.";\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
+    grouping operation-instance {\r
+        description\r
+            "Specific an operation instance whose metadata has been filled in.\r
+             Operation is a type of intent which refers to taking for some specific\r
+             actions to realize the purpose.";\r
+\r
+        leaf operation-id {\r
+            description\r
+                "A unique ID for a operation instance.";\r
+            type nemo-common:operation-id;\r
+            mandatory true;\r
+        }\r
+\r
+        leaf operation-name {\r
+            description\r
+                "A user-visible and unique name for a operation instance.";\r
+            type nemo-common:operation-name;\r
+            mandatory true;\r
+        }\r
+\r
+        leaf priority {\r
+            description\r
+                "Defines the priority of a operation instance.";\r
+            type uint32;\r
+            default 0;\r
+        }\r
+\r
+        leaf target-object {\r
+            description\r
+                "The target object which the operation instance will apply to.";\r
+            type nemo-common:object-id;\r
+            mandatory true;\r
+        }\r
+\r
+        uses condition-instance;\r
+        uses constraint-instance;\r
+\r
+        list action {\r
+            description\r
+                "The action list for the operation instance.";\r
+\r
+            key "action-name";\r
+            uses action-instance;\r
+\r
+            leaf order {\r
+                description\r
+                    "The order of an action instance in execution sequence.";\r
+                type uint32;\r
+            }\r
+\r
+            min-elements 1;\r
+        }\r
+    }\r
+}\r