initial submission of RIFT model changes for multi-tenancy, RBAC and projects
[osm/IM.git] / models / yang / project-nsd.yang
diff --git a/models/yang/project-nsd.yang b/models/yang/project-nsd.yang
new file mode 100644 (file)
index 0000000..ae79d96
--- /dev/null
@@ -0,0 +1,600 @@
+
+/*
+ * 
+ *   Copyright 2017 RIFT.IO Inc
+ *
+ *   Licensed under the Apache License, Version 2.0 (the "License");
+ *   you may not use this file except in compliance with the License.
+ *   You may obtain a copy of the License at
+ *
+ *       http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *   Unless required by applicable law or agreed to in writing, software
+ *   distributed under the License is distributed on an "AS IS" BASIS,
+ *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *   See the License for the specific language governing permissions and
+ *   limitations under the License.
+ *
+ *
+ */
+
+module project-nsd
+{
+  namespace "http://riftio.com/ns/riftware-1.0/project-nsd";
+  prefix "project-nsd";
+
+  import mano-types {
+    prefix "manotypes";
+  }
+
+  import project-vnfd {
+    prefix "project-vnfd";
+  }
+
+  import nsd-base {
+    prefix "nsd-base";
+  }
+
+  import rw-project {
+    prefix "rw-project";
+  }
+
+
+  revision 2017-02-28 {
+    description
+      "Initial revision. This YANG file defines
+       the Network Service Descriptor (NSD)
+       under projects";
+    reference
+      "Derived from earlier versions of base YANG files";
+  }
+
+
+  grouping nsd-constituent-vnfd {
+    list constituent-vnfd {
+      description
+          "List of VNFDs that are part of this
+          network service.";
+
+      key "member-vnf-index";
+
+      leaf member-vnf-index {
+        description
+          "Identifier/index for the VNFD. This separate id
+           is required to ensure that multiple VNFs can be
+           part of single NS";
+        type uint64;
+      }
+
+      leaf vnfd-id-ref {
+        description
+          "Identifier for the VNFD.";
+        type leafref {
+          path "/rw-project:project[rw-project:name = current()/../../../../rw-project:name]" +
+            "/project-vnfd:vnfd-catalog/project-vnfd:vnfd/project-vnfd:id";
+        }
+      }
+
+      leaf start-by-default {
+        description
+          "VNFD is started as part of the NS instantiation";
+        type boolean;
+        default true;
+      }
+    }
+  }
+
+  grouping nsr-nsd-constituent-vnfd {
+    list constituent-vnfd {
+      description
+          "List of VNFDs that are part of this
+          network service.";
+
+      key "member-vnf-index";
+
+      leaf member-vnf-index {
+        description
+          "Identifier/index for the VNFD. This separate id
+           is required to ensure that multiple VNFs can be
+           part of single NS";
+        type uint64;
+      }
+
+      leaf vnfd-id-ref {
+        description
+          "Identifier for the VNFD.";
+        type leafref {
+          path "/rw-project:project[rw-project:name = current()/../../../../../rw-project:name]" +
+            "/project-vnfd:vnfd-catalog/project-vnfd:vnfd/project-vnfd:id";
+        }
+      }
+
+      leaf start-by-default {
+        description
+          "VNFD is started as part of the NS instantiation";
+        type boolean;
+        default true;
+      }
+    }
+  }
+
+  grouping nsd-vld {
+    list vld {
+
+      key "id";
+
+      uses nsd-base:nsd-vld-common;
+
+      list vnfd-connection-point-ref {
+        description
+            "A list of references to connection points.";
+        key "member-vnf-index-ref vnfd-connection-point-ref";
+
+        leaf member-vnf-index-ref {
+          description "Reference to member-vnf within constituent-vnfds";
+          type leafref {
+            path "../../../constituent-vnfd/member-vnf-index";
+          }
+        }
+
+        leaf vnfd-id-ref {
+          description
+              "A reference to a vnfd. This is a
+               leafref to path:
+                   ../../constituent-vnfd
+                   + [id = current()/../id-ref]
+                   + /vnfd-id-ref
+               NOTE: An issue with confd is preventing the
+               use of xpath. Seems to be an issue with leafref
+               to leafref, whose target is in a different module.
+               Once that is resolved this will switched to use
+               leafref";
+          //type string;
+          type leafref {
+            path "../../../constituent-vnfd[member-vnf-index = current()/../member-vnf-index-ref]/vnfd-id-ref";
+          }
+        }
+
+        leaf vnfd-connection-point-ref {
+          description "A reference to a connection point name";
+          type leafref {
+            path "../../../../../project-vnfd:vnfd-catalog/project-vnfd:vnfd" +
+                 "[project-vnfd:id = current()/../vnfd-id-ref]/" +
+                 "project-vnfd:connection-point/project-vnfd:name";
+          }
+        }
+      }
+    }
+  }
+
+  grouping nsr-nsd-vld {
+    list vld {
+
+      key "id";
+
+      uses nsd-base:nsd-vld-common;
+
+      list vnfd-connection-point-ref {
+        description
+            "A list of references to connection points.";
+        key "member-vnf-index-ref vnfd-connection-point-ref";
+
+        leaf member-vnf-index-ref {
+          description "Reference to member-vnf within constituent-vnfds";
+
+          type leafref {
+            path "../../../constituent-vnfd/member-vnf-index";
+          }
+        }
+
+        leaf vnfd-id-ref {
+          description
+              "A reference to a vnfd. This is a
+               leafref to path:
+                   ../../nsd:constituent-vnfd
+                   + [nsd:id = current()/../nsd:id-ref]
+                   + /nsd:vnfd-id-ref
+               NOTE: An issue with confd is preventing the
+               use of xpath. Seems to be an issue with leafref
+               to leafref, whose target is in a different module.
+               Once that is resolved this will switched to use
+               leafref";
+          type string;
+        }
+
+        leaf vnfd-connection-point-ref {
+          description "A reference to a connection point name";
+          type leafref {
+            path "../../../../../../project-vnfd:vnfd-catalog/project-vnfd:vnfd" +
+                 "[project-vnfd:id = current()/../vnfd-id-ref]/" +
+                 "project-vnfd:connection-point/project-vnfd:name";
+          }
+        }
+      }
+    }
+  }
+
+  grouping nsd-vnf-dependency {
+    list vnf-dependency {
+      description
+          "List of VNF dependencies.";
+      key vnf-source-ref;
+      leaf vnf-source-ref {
+        type leafref {
+          path "../../../../project-vnfd:vnfd-catalog/project-vnfd:vnfd/project-vnfd:id";
+        }
+      }
+      leaf vnf-depends-on-ref {
+        description
+            "Reference to VNF that sorce VNF depends.";
+        type leafref {
+          path "../../../../project-vnfd:vnfd-catalog/project-vnfd:vnfd/project-vnfd:id";
+        }
+      }
+    }
+  }
+
+  grouping nsr-nsd-vnf-dependency {
+    list vnf-dependency {
+      description
+          "List of VNF dependencies.";
+      key vnf-source-ref;
+      leaf vnf-source-ref {
+        type leafref {
+          path "../../../../../project-vnfd:vnfd-catalog/project-vnfd:vnfd/project-vnfd:id";
+        }
+      }
+      leaf vnf-depends-on-ref {
+        description
+            "Reference to VNF that sorce VNF depends.";
+        type leafref {
+          path "../../../../../project-vnfd:vnfd-catalog/project-vnfd:vnfd/project-vnfd:id";
+        }
+      }
+    }
+  }
+
+  grouping nsd-placement-groups {
+    list placement-groups {
+      description "List of placement groups at NS level";
+
+      key "name";
+      uses manotypes:placement-group-info;
+
+      list member-vnfd {
+        description
+            "List of VNFDs that are part of this placement group";
+
+        key "member-vnf-index-ref";
+
+        leaf member-vnf-index-ref {
+          description "member VNF index of this member VNF";
+          type leafref {
+            path "../../../constituent-vnfd/member-vnf-index";
+          }
+        }
+
+        leaf vnfd-id-ref {
+          description
+              "Identifier for the VNFD.";
+          type leafref {
+            path "../../../../../project-vnfd:vnfd-catalog/project-vnfd:vnfd/project-vnfd:id";
+          }
+        }
+      }
+    }
+  }
+
+  grouping nsr-nsd-placement-groups {
+    list placement-groups {
+      description "List of placement groups at NS level";
+
+      key "name";
+      uses manotypes:placement-group-info;
+
+      list member-vnfd {
+        description
+            "List of VNFDs that are part of this placement group";
+
+        key "member-vnf-index-ref";
+
+        leaf member-vnf-index-ref {
+          description "member VNF index of this member VNF";
+          type leafref {
+            path "../../../constituent-vnfd/member-vnf-index";
+          }
+        }
+
+        leaf vnfd-id-ref {
+          description
+              "Identifier for the VNFD.";
+          type leafref {
+            path "../../../../../../project-vnfd:vnfd-catalog/project-vnfd:vnfd/project-vnfd:id";
+          }
+        }
+      }
+    }
+  }
+
+  grouping nsd-monitoring-param {
+
+    list monitoring-param {
+      key "id";
+
+      uses nsd-base:monitoring-param-common;
+
+      list vnfd-monitoring-param {
+        description "A list of VNFD monitoring params";
+        key "member-vnf-index-ref vnfd-monitoring-param-ref";
+
+        leaf vnfd-id-ref {
+          description
+            "A reference to a vnfd. This is a
+              leafref to path:
+                  ../../../../nsd:constituent-vnfd
+                  + [nsd:id = current()/../nsd:id-ref]
+                  + /nsd:vnfd-id-ref
+              NOTE: An issue with confd is preventing the
+              use of xpath. Seems to be an issue with leafref
+              to leafref, whose target is in a different module.
+              Once that is resolved this will switched to use
+              leafref";
+
+          type leafref {
+            path "../../../constituent-vnfd" +
+              "[member-vnf-index = current()/../member-vnf-index-ref]" +
+              "/vnfd-id-ref";
+          }
+        }
+
+        leaf vnfd-monitoring-param-ref {
+          description "A reference to the VNFD monitoring param";
+          type leafref {
+            path "../../../../../project-vnfd:vnfd-catalog/project-vnfd:vnfd"
+              + "[project-vnfd:id = current()/../vnfd-id-ref]"
+              + "/project-vnfd:monitoring-param/project-vnfd:id";
+          }
+        }
+
+        leaf member-vnf-index-ref {
+          description
+            "Optional reference to member-vnf within constituent-vnfds";
+          type leafref {
+            path "../../../constituent-vnfd/member-vnf-index";
+          }
+        }
+      }
+    }
+  }
+
+  grouping nsr-nsd-monitoring-param {
+    list monitoring-param {
+      key "id";
+
+      uses nsd-base:monitoring-param-common;
+
+      list vnfd-monitoring-param {
+        description "A list of VNFD monitoring params";
+        key "member-vnf-index-ref vnfd-monitoring-param-ref";
+
+        leaf vnfd-id-ref {
+          description
+            "A reference to a vnfd. This is a
+              leafref to path:
+                  ../../../../nsd:constituent-vnfd
+                  + [nsd:id = current()/../nsd:id-ref]
+                  + /nsd:vnfd-id-ref
+              NOTE: An issue with confd is preventing the
+              use of xpath. Seems to be an issue with leafref
+              to leafref, whose target is in a different module.
+              Once that is resolved this will switched to use
+              leafref";
+
+          type string;
+        }
+
+        leaf vnfd-monitoring-param-ref {
+          description "A reference to the VNFD monitoring param";
+          type leafref {
+            path "../../../../../../project-vnfd:vnfd-catalog/project-vnfd:vnfd"
+              + "[project-vnfd:id = current()/../vnfd-id-ref]"
+              + "/project-vnfd:monitoring-param/project-vnfd:id";
+          }
+        }
+
+        leaf member-vnf-index-ref {
+          description
+            "Optional reference to member-vnf within constituent-vnfds";
+          type leafref {
+            path "../../../constituent-vnfd/member-vnf-index";
+          }
+        }
+      }
+    }
+  }
+
+  grouping nsd-service-primitive {
+   list service-primitive {
+      description
+          "Network service level service primitives.";
+
+      key "name";
+
+      leaf name {
+        description
+            "Name of the service primitive.";
+        type string;
+      }
+
+      list parameter {
+        description
+            "List of parameters for the service primitive.";
+
+        key "name";
+        uses manotypes:primitive-parameter;
+      }
+
+      uses manotypes:ui-primitive-group;
+
+      list vnf-primitive-group {
+        description
+            "List of service primitives grouped by VNF.";
+
+        key "member-vnf-index-ref";
+        leaf member-vnf-index-ref {
+          description
+              "Reference to member-vnf within constituent-vnfds";
+          type leafref {
+             path "../../../constituent-vnfd/member-vnf-index";
+          }
+        }
+
+        leaf vnfd-id-ref {
+          description
+              "A reference to a vnfd. This is a leafref";
+
+          type leafref {
+             path "../../../constituent-vnfd" +
+                "[member-vnf-index = current()/../member-vnf-index-ref]" + "/vnfd-id-ref";
+          }
+        }
+
+        leaf vnfd-name {
+          description
+              "Name of the VNFD";
+          type leafref {
+              path "../../../../../project-vnfd:vnfd-catalog/project-vnfd:vnfd"
+                    + "[project-vnfd:id = current()/../vnfd-id-ref]"
+                    + "/project-vnfd:name";
+          }
+        }
+
+        list primitive {
+          key "index";
+
+          leaf index {
+            description "Index of this primitive";
+            type uint32;
+          }
+
+          leaf name {
+            description "Name of the primitive in the VNF primitive ";
+            type string;
+          }
+        }
+      }
+
+      leaf user-defined-script {
+        description
+            "A user defined script.";
+        type string;
+      }
+    }
+  }
+
+  grouping nsr-nsd-service-primitive {
+   list service-primitive {
+      description
+          "Network service level service primitives.";
+
+      key "name";
+
+      leaf name {
+        description
+            "Name of the service primitive.";
+        type string;
+      }
+
+      list parameter {
+        description
+            "List of parameters for the service primitive.";
+
+        key "name";
+        uses manotypes:primitive-parameter;
+      }
+
+      uses manotypes:ui-primitive-group;
+
+      list vnf-primitive-group {
+        description
+            "List of service primitives grouped by VNF.";
+
+        key "member-vnf-index-ref";
+        leaf member-vnf-index-ref {
+          description
+              "Reference to member-vnf within constituent-vnfds";
+          type leafref {
+             path "../../../constituent-vnfd/member-vnf-index";
+          }
+        }
+
+        leaf vnfd-id-ref {
+          description
+              "A reference to a vnfd. This is a leafref";
+
+          type leafref {
+             path "../../../constituent-vnfd" +
+                "[member-vnf-index = current()/../member-vnf-index-ref]" + "/vnfd-id-ref";
+          }
+        }
+
+        leaf vnfd-name {
+          description
+              "Name of the VNFD";
+          type leafref {
+              path "../../../../../../project-vnfd:vnfd-catalog/project-vnfd:vnfd"
+                    + "[project-vnfd:id = current()/../vnfd-id-ref]"
+                    + "/project-vnfd:name";
+          }
+        }
+
+        list primitive {
+          key "index";
+
+          leaf index {
+            description "Index of this primitive";
+            type uint32;
+          }
+
+          leaf name {
+            description "Name of the primitive in the VNF primitive ";
+            type string;
+          }
+        }
+      }
+
+      leaf user-defined-script {
+        description
+            "A user defined script.";
+        type string;
+      }
+    }
+  }
+
+  grouping nsd-descriptor {
+     uses nsd-base:nsd-descriptor-common;
+
+     uses nsd-vld;
+
+     uses nsd-constituent-vnfd;
+
+     uses nsd-placement-groups;
+
+     uses nsd-vnf-dependency;
+
+     uses nsd-monitoring-param;
+
+     uses nsd-service-primitive;
+  }
+
+  augment "/rw-project:project" {
+    container nsd-catalog {
+
+      list nsd {
+        key id;
+
+        uses nsd-descriptor;
+      }
+    }
+  }
+}