update from RIFT as of 696b75d2fe9fb046261b08c616f1bcf6c0b54a9b second try
[osm/SO.git] / models / plugins / yang / nsd.yang
index 2e32c6c..4a88eac 100644 (file)
@@ -1,7 +1,7 @@
 
 /*
- * 
- *   Copyright 2016 RIFT.IO Inc
+ *
+ *   Copyright 2016-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.
@@ -23,30 +23,23 @@ module nsd
   namespace "urn:ietf:params:xml:ns:yang:nfvo:nsd";
   prefix "nsd";
 
-  import rw-pb-ext {
-    prefix "rwpb";
-  }
-
-  import vld {
-    prefix "vld";
-  }
-
   import vnfd {
     prefix "vnfd";
   }
 
-  import ietf-inet-types {
-    prefix "inet";
-  }
-
-  import ietf-yang-types {
-    prefix "yang";
+  import nsd-base {
+    prefix "nsd-base";
   }
 
   import mano-types {
     prefix "manotypes";
   }
 
+  revision 2017-02-28 {
+    description
+      "Update model to support projects.";
+  }
+
   revision 2014-10-27 {
     description
       "Initial revision. This YANG file defines
@@ -55,267 +48,7 @@ module nsd
       "Derived from earlier versions of base YANG files";
   }
 
-  typedef scaling-trigger {
-    type enumeration {
-      enum pre-scale-in {
-        value 1;
-      }
-      enum post-scale-in {
-        value 2;
-      }
-      enum pre-scale-out {
-        value 3;
-      }
-      enum post-scale-out {
-        value 4;
-      }
-    }
-  }
-
-  typedef scaling-policy-type {
-    type enumeration {
-      enum manual {
-        value 1;
-      }
-      enum automatic {
-        value 2;
-      }
-    }
-  }
-
-  typedef scaling-criteria-operation {
-    type enumeration {
-      enum AND {
-        value 1;
-      }
-      enum OR {
-        value 2;
-      }
-    }
-  }
-
-  grouping primitive-parameter {
-    leaf name {
-      description
-          "Name of the parameter.";
-      type string;
-    }
-
-    leaf data-type {
-      description
-          "Data type associated with the name.";
-      type manotypes:parameter-data-type;
-    }
-
-    leaf mandatory {
-      description "Is this field mandatory";
-      type boolean;
-      default false;
-    }
-
-    leaf default-value {
-      description "The default value for this field";
-      type string;
-    }
-
-    leaf parameter-pool {
-      description "NSD Parameter pool name to use for this paramter";
-      type string;
-    }
-  }
-
-  grouping nsd-descriptor {
-    leaf id {
-      description "Identifier for the NSD.";
-      type string;
-    }
-
-    leaf name {
-      description "NSD name.";
-      mandatory true;
-      type string;
-    }
-
-    leaf short-name {
-      description "NSD short name.";
-      type string;
-    }
-
-    leaf vendor {
-      description "Vendor of the NSD.";
-      type string;
-    }
-
-    leaf logo {
-      description
-        "File path for  the vendor specific logo. For example icons/mylogo.png.
-         The logo  should be part of the network service";
-      type string;
-    }
-
-    leaf description {
-      description "Description of the NSD.";
-      type string;
-    }
-
-    leaf version {
-      description "Version of the NSD";
-      type string;
-    }
-
-    list connection-point {
-      description
-          "List for external connection points.
-          Each NS has one or more external connection
-          points. As the name implies that external
-          connection points are used for connecting
-          the NS to other NS or to external networks.
-          Each NS exposes these connection points to
-          the orchestrator. The orchestrator can
-          construct network service chains by
-          connecting the connection points between
-          different NS.";
-
-      key "name";
-      leaf name {
-        description
-            "Name of the NS connection point.";
-        type string;
-      }
-
-      leaf type {
-        description
-            "Type of the connection point.";
-        type manotypes:connection-point-type;
-      }
-    }
-
-    /* Still having issues modelling this,
-       see the comments under vnfd-connection-point-ref
-     */
-    list vld {
-      description
-          "List of Virtual Link Descriptors.";
-
-      key "id";
-
-      leaf id {
-        description
-            "Identifier for the VLD.";
-        type string;
-      }
-
-      leaf name {
-        description
-            "Virtual Link Descriptor (VLD) name.";
-        type string;
-      }
-
-      leaf short-name {
-        description
-            "Short name for VLD for UI";
-        type string;
-      }
-
-      leaf vendor {
-        description "Provider of the VLD.";
-        type string;
-      }
-
-      leaf description {
-        description "Description of the VLD.";
-        type string;
-      }
-
-      leaf version {
-        description "Version of the VLD";
-        type string;
-      }
-
-      leaf type {
-        type manotypes:virtual-link-type;
-      }
-
-      leaf root-bandwidth {
-        description
-            "For ELAN this is the aggregate bandwidth.";
-        type uint64;
-      }
-
-      leaf leaf-bandwidth {
-        description
-            "For ELAN this is the bandwidth of branches.";
-        type uint64;
-      }
-
-      list vnfd-connection-point-ref {
-        description
-            "A list of references to connection points.";
-        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 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 resovled this will switched to use
-               leafref";
-          type string;
-        }
-
-        leaf vnfd-connection-point-ref {
-          description "A reference to a connection point name";
-          type leafref {
-            path "/vnfd:vnfd-catalog/vnfd:vnfd" +
-                 "[vnfd:id = current()/../vnfd-id-ref]/" +
-                 "vnfd:connection-point/vnfd:name";
-          }
-        }
-      }
-
-      // replicate for pnfd container here
-      uses manotypes:provider-network;
-
-      leaf mgmt-network {
-         description "Flag indicating whether this network is a VIM management network"; 
-         type boolean;
-         default false;
-      }
-
-      choice init-params {
-        description "Extra parameters for VLD instantiation";
-
-        case vim-network-ref {
-          leaf vim-network-name {
-            description
-                "Name of network in VIM account. This is used to indicate
-                   pre-provisioned network name in cloud account.";
-            type string;
-          }
-        }
-
-        case vim-network-profile {
-          leaf ip-profile-ref {
-            description "Named reference to IP-profile object";
-            type string;
-          } 
-        }
-
-      }
-    }
-
+  grouping nsd-constituent-vnfd {
     list constituent-vnfd {
       description
           "List of VNFDs that are part of this
@@ -346,199 +79,50 @@ module nsd
         default true;
       }
     }
+  }
 
-    list scaling-group-descriptor {
-      description
-          "scaling group descriptor within this network service.
-           The scaling group defines a group of VNFs,
-           and the ratio of VNFs in the network service
-           that is used as target for scaling action";
-
-      key "name";
-
-      leaf name {
-        description "Name of this scaling group.";
-        type string;
-      }
-
-      list scaling-policy {
-
-        key "name";
-
-        leaf name {
-          description
-              "Name of the scaling policy";
-          type string;
-        }
-
-        leaf scaling-type {
-          description
-              "Type of scaling";
-          type scaling-policy-type;
-        }
-
-        leaf enabled {
-          description
-            "Specifies if the scaling policy can be applied";
-          type boolean;
-          default true;
-        }
-
-        leaf scale-in-operation-type {
-          description
-              "Operation to be applied to check between scaling criterias to 
-               check if the scale in threshold condition has been met.
-               Defaults to AND";
-          type scaling-criteria-operation;
-          default AND;
-        }
-
-        leaf scale-out-operation-type {
-          description
-              "Operation to be applied to check between scaling criterias to 
-               check if the scale out threshold condition has been met.
-               Defauls to OR";
-          type scaling-criteria-operation;
-          default OR;
-        }
-
-        leaf threshold-time {
-          description
-            "The duration for which the criteria must hold true";
-          type uint32;
-          mandatory true;
-        }
-
-        leaf cooldown-time {
-          description
-            "The duration after a scaling-in/scaling-out action has been
-            triggered, for which there will be no further optional";
-          type uint32;
-          mandatory true;
-        }
-
-        list scaling-criteria {
-          description
-              "list of conditions to be met for generating scaling
-                 requests";
-          key "name";
-
-          leaf name {
-            type string;
-          }
-
-          leaf scale-in-threshold {
-            description
-                "Value below which scale-in requests are generated";
-            type uint64;
-          }
+  grouping nsd-vld {
+    list vld {
 
-          leaf scale-out-threshold {
-            description
-                "Value above which scale-out requests are generated";
-            type uint64;
-          }
+      key "id";
 
-          leaf ns-monitoring-param-ref {
-            description 
-               "Reference to the NS level monitoring parameter
-                that is aggregated";
-            type leafref {
-              path "../../../../monitoring-param/id";
-            }
-          }
-        }
-      }
+      uses nsd-base:nsd-vld-common;
 
-      list vnfd-member {
-        description "List of VNFs in this scaling group";
-        key "member-vnf-index-ref";
+      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 "member VNF index of this member VNF";
+          description "Reference to member-vnf within constituent-vnfds";
           type leafref {
             path "../../../constituent-vnfd/member-vnf-index";
           }
         }
 
-        leaf count {
+        leaf vnfd-id-ref {
           description
-            "count of this member VNF  within this scaling group.
-             The count allows to define  the number of instances
-             when a scaling action targets this scaling group";
-          type uint32;
-          default 1;
-        }
-      }
-
-      leaf min-instance-count {
-        description
-          "Minimum instances of the scaling group which are allowed.
-          These instances are created by default when the network service
-          is instantiated.";
-        type uint32;
-        default 0;
-      }
-
-      leaf max-instance-count {
-        description
-          "Maximum instances of this scaling group that are allowed
-           in a single network service. The network service scaling
-           will fail, when the number of service group instances
-           exceed the max-instance-count specified.";
-        type uint32;
-        default 10;
-      }
-
-      list scaling-config-action {
-        description "List of scaling config actions";
-        key "trigger";
-
-        leaf trigger {
-          description "scaling trigger";
-          type scaling-trigger;
-        }
-
-        leaf ns-config-primitive-name-ref {
-          description "Reference to the NS config name primitive";
-          type leafref {
-            path "../../../service-primitive/name";
-          }
-        }
-      }
-    }
-
-    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";
+              "A reference to a VNFD";
           type leafref {
-            path "../../../constituent-vnfd/member-vnf-index";
+            path "../../../constituent-vnfd" +
+                 "[member-vnf-index = current()/../member-vnf-index-ref]" +
+                 "/vnfd-id-ref";
           }
         }
 
-        leaf vnfd-id-ref {
-          description
-              "Identifier for the VNFD.";
+        leaf vnfd-connection-point-ref {
+          description "A reference to a connection point name";
           type leafref {
-            path "/vnfd:vnfd-catalog/vnfd:vnfd/vnfd:id";
+            path "/vnfd:vnfd-catalog/vnfd:vnfd" +
+                 "[vnfd:id = current()/../vnfd-id-ref]/" +
+                 "vnfd:connection-point/vnfd:name";
           }
         }
       }
     }
+  }
 
-    uses manotypes:ip-profile-list;
-
+  grouping nsd-vnf-dependency {
     list vnf-dependency {
       description
           "List of VNF dependencies.";
@@ -556,142 +140,23 @@ module nsd
         }
       }
     }
+  }
 
-    list vnffgd {
-      description
-          "List of VNF Forwarding Graph Descriptors (VNFFGD).";
-
-      key "id";
-
-      leaf id {
-        description
-            "Identifier for the VNFFGD.";
-        type string;
-      }
-
-      leaf name {
-        description
-            "VNFFGD name.";
-        type string;
-      }
-
-      leaf short-name {
-        description
-            "Short name for VNFFGD for UI";
-        type string;
-      }
-
-      leaf vendor {
-        description "Provider of the VNFFGD.";
-        type string;
-      }
-
-      leaf description {
-        description "Description of the VNFFGD.";
-        type string;
-      }
-
-      leaf version {
-        description "Version of the VNFFGD";
-        type string;
-      }
-
-      list rsp {
-        description
-            "List of Rendered Service Paths (RSP).";
-
-        key "id";
-
-        leaf id {
-          description
-              "Identifier for the RSP.";
-          type string;
-        }
-
-        leaf name {
-          description
-              "RSP name.";
-          type string;
-        }
-
-        list vnfd-connection-point-ref {
-          description
-                "A list of references to connection points.";
-          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 order {
-            type uint8;
-            description
-                "A number that denotes the order of a VNF in a chain";
-          }
+  grouping nsd-placement-groups {
+    list placement-groups {
+      description "List of placement groups at NS level";
 
-           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 resovled this will switched to use
-                  leafref";
-             type string;
-           }
-
-           leaf vnfd-connection-point-ref {
-             description
-                 "A reference to a connection point name
-                  in a vnfd. This is a leafref to path:
-                      /vnfd:vnfd-catalog/vnfd:vnfd
-                      + [vnfd:id = current()/../nsd:vnfd-id-ref]
-                      + /vnfd:connection-point/vnfd:name
-                  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 resovled this will switched to use
-                  leafref";
-              type string;
-          }
-        }
-      } //rsp
+      key "name";
+      uses manotypes:placement-group-info;
 
-      list classifier {
+      list member-vnfd {
         description
-            "List of classifier rules.";
-
-        key "id";
-
-        leaf id {
-          description
-              "Identifier for the classifier rule.";
-          type string;
-        }
-
-        leaf name {
-          description
-              "Name of the classifier.";
-          type string;
-        }
+            "List of VNFDs that are part of this placement group";
 
-        leaf rsp-id-ref {
-          description
-              "A reference to the RSP.";
-          type leafref {
-            path "../../rsp/id";
-          }
-        }
+        key "member-vnf-index-ref";
 
         leaf member-vnf-index-ref {
-          description "Reference to member-vnf within constituent-vnfds";
+          description "Member VNF index of this member VNF";
           type leafref {
             path "../../../constituent-vnfd/member-vnf-index";
           }
@@ -699,116 +164,37 @@ module nsd
 
         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 resovled this will switched to use
-                  leafref";
-          type string;
-        }
-
-        leaf vnfd-connection-point-ref {
-          description
-              "A reference to a connection point name
-                  in a vnfd. This is a leafref to path:
-                      /vnfd:vnfd-catalog/vnfd:vnfd
-                      + [vnfd:id = current()/../nsd:vnfd-id-ref]
-                      + /vnfd:connection-point/vnfd:name
-                  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 resovled this will switched to use
-                  leafref";
-          type string;
-        }
-
-        list match-attributes {
-          description
-              "List of match attributes.";
-
-          key "id";
-
-          leaf id {
-            description
-                "Identifier for the classifier match attribute rule.";
-            type string;
-          }
-
-          leaf ip-proto {
-            description
-                "IP Protocol.";
-            type uint8;
-          }
-
-          leaf source-ip-address {
-            description
-                "Source IP address.";
-            type inet:ip-address;
-          }
-
-          leaf destination-ip-address {
-            description
-                "Destination IP address.";
-            type inet:ip-address;
-          }
-
-          leaf source-port {
-            description
-                "Source port number.";
-            type inet:port-number;
+              "Identifier for the VNFD.";
+          type leafref {
+            path "../../../constituent-vnfd" + 
+                 "[member-vnf-index = current()/../member-vnf-index-ref]" +
+                 "/vnfd-id-ref";
           }
+        }
+      }
+    }
+  }
 
-          leaf destination-port {
-            description
-                "Destination port number.";
-            type inet:port-number;
-          }
-          //TODO: Add more match criteria
-        } //match-attributes
-      } // classifier
-    } // vnffgd
+  grouping nsd-monitoring-param {
 
     list monitoring-param {
-      description
-        "List of monitoring parameters from VNF's that should be
-        propogated up into NSR";
-      key "id";
+      key id;
 
-      leaf id {
-        type string;
-      }
-
-      leaf name {
-        type string;
-      }
-
-      uses manotypes:monitoring-param-value;
-      uses manotypes:monitoring-param-ui-data;
-      uses manotypes:monitoring-param-aggregation;
+      uses nsd-base:monitoring-param-common;
 
       list vnfd-monitoring-param {
         description "A list of VNFD monitoring params";
-        key "vnfd-id-ref vnfd-monitoring-param-ref";
+        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 yang:uuid;
+             "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-monitoring-param-ref {
@@ -820,115 +206,114 @@ module nsd
           }
         }
 
-        leaf-list member-vnf-index-ref {
-         description
-            "Optional reference to member-vnf within constituent-vnfds";
-         type uint64;
+        leaf member-vnf-index-ref {
+          description
+            "Mandatory reference to member-vnf within constituent-vnfds";
+          type leafref {
+            path "../../../constituent-vnfd/member-vnf-index";
+          }
         }
       }
     }
+  }
 
-    uses manotypes:input-parameter-xpath;
-
-    list parameter-pool {
+  grouping nsd-service-primitive {
+   list service-primitive {
       description
-        "Pool of parameter values which must be
-         pulled from during configuration";
+          "Network service level service primitives.";
+
       key "name";
 
       leaf name {
         description
-            "Name of the configuration value pool";
+            "Name of the service primitive.";
         type string;
       }
 
-      container range {
+      list parameter {
         description
-            "Create a range of values to populate the pool with";
+            "List of parameters for the service primitive.";
+
+        key "name";
+        uses manotypes:primitive-parameter;
+      }
 
-        leaf start-value {
+      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
-              "Generated pool values start at this value";
-          type uint32;
-          mandatory true;
+              "Reference to member-vnf within constituent-vnfds";
+          type leafref {
+             path "../../../constituent-vnfd/member-vnf-index";
+          }
         }
 
-        leaf end-value {
+        leaf vnfd-id-ref {
           description
-              "Generated pool values stop at this value";
-          type uint32;
-          mandatory true;
-        }
-      }
-    }
+              "A reference to a VNFD. This is a leafref";
 
-    uses manotypes:ns-service-primitive;
+          type leafref {
+             path "../../../constituent-vnfd" +
+                "[member-vnf-index = current()/../member-vnf-index-ref]" + "/vnfd-id-ref";
+          }
+        }
 
-    list initial-config-primitive {
-      rwpb:msg-new NsdInitialConfigPrimitive;
-      description
-        "Initial set of configuration primitives for NSD.";
-      key "seq";
+        leaf vnfd-name {
+          description
+              "Name of the VNFD";
+          type leafref {
+              path "/vnfd:vnfd-catalog/vnfd:vnfd"
+                    + "[vnfd:id = current()/../vnfd-id-ref]"
+                    + "/vnfd:name";
+          }
+        }
 
-      uses manotypes:initial-config;
-    }
+        list primitive {
+          key "index";
 
-    list key-pair {
-      key "name";
-      description "Used to configure the list of public keys to be injected as part
-          of ns instantiation";
+          leaf index {
+            description "Index of this primitive";
+            type uint32;
+          }
 
-      leaf name {
-        description "Name of this key pair";
-        type string;
+          leaf name {
+            description "Name of the primitive in the VNF primitive ";
+            type string;
+          }
+        }
       }
 
-      leaf key {
-        description "Key associated with this key pair";
+      leaf user-defined-script {
+        description
+            "A user defined script.";
         type string;
       }
     }
+  }
 
-    list user {
-      key "name";
-      description "List of users to be added through cloud-config";
-
-      leaf name {
-        description "Name of the user ";
-        type string;
-      }
+  container nsd-catalog {
 
-      leaf user-info {
-        description "The user name's real name";
-        type string;
-      }
+    list nsd {
+      key id;
 
-      list key-pair {
-        key "name";
-        description "Used to configure the list of public keys to be injected as part
-            of ns instantiation";
+      uses nsd-base:nsd-descriptor-common;
 
-        leaf name {
-          description "Name of this key pair";
-          type string;
-        }
+      uses nsd-vld;
 
-        leaf key {
-          description "Key associated with this key pair";
-          type string;
-        }
-      }
-    }
-  }
+      uses nsd-constituent-vnfd;
 
+      uses nsd-placement-groups;
 
-  container nsd-catalog {
+      uses nsd-vnf-dependency;
 
-    list nsd {
-      key "id";
+      uses nsd-monitoring-param;
 
-      uses nsd-descriptor;
+      uses nsd-service-primitive;
     }
   }
-
 }