Merge from master 59/1459/1
authorPhilip Joseph <philip.joseph@riftio.com>
Fri, 31 Mar 2017 19:35:56 +0000 (01:05 +0530)
committerPhilip Joseph <philip.joseph@riftio.com>
Fri, 31 Mar 2017 19:35:56 +0000 (01:05 +0530)
Signed-off-by: Philip Joseph <philip.joseph@riftio.com>
27 files changed:
1  2 
BUILD.sh
common/python/CMakeLists.txt
common/python/rift/mano/config_agent/operdata.py
common/python/rift/mano/tosca_translator/rwmano/tosca/tosca_nfv_vnf.py
common/python/rift/mano/yang_translator/rwmano/yang/yang_nsd.py
models/openmano/python/rift/openmano/rift2openmano.py
models/plugins/yang/mano-types.yang
models/plugins/yang/nsd-base.yang
models/plugins/yang/nsd.yang
models/plugins/yang/nsr.yang
models/plugins/yang/project-nsd.yang
models/plugins/yang/vnfr.yang
rwcm/plugins/rwconman/rift/tasklets/rwconmantasklet/rwconman_config.py
rwlaunchpad/plugins/rwimagemgr/rift/tasklets/rwimagemgr/upload.py
rwlaunchpad/plugins/rwlaunchpadtasklet/rift/package/store.py
rwlaunchpad/plugins/rwlaunchpadtasklet/rift/tasklets/rwlaunchpad/export.py
rwlaunchpad/plugins/rwlaunchpadtasklet/rift/tasklets/rwlaunchpad/image.py
rwlaunchpad/plugins/rwlaunchpadtasklet/scripts/onboard_pkg
rwlaunchpad/plugins/rwnsm/rift/tasklets/rwnsmtasklet/rwnsmtasklet.py
rwlaunchpad/plugins/rwpkgmgr/rift/tasklets/rwpkgmgr/publisher/download_status.py
rwlaunchpad/plugins/rwpkgmgr/rift/tasklets/rwpkgmgr/rwpkgmgr.py
rwlaunchpad/plugins/rwpkgmgr/rift/tasklets/rwpkgmgr/subscriber/download_status.py
rwlaunchpad/plugins/rwresmgr/rift/tasklets/rwresmgrtasklet/rwresmgrtasklet.py
rwlaunchpad/plugins/rwvnfm/rift/tasklets/rwvnfmtasklet/rwvnfmtasklet.py
rwlaunchpad/plugins/rwvns/vala/CMakeLists.txt
rwlaunchpad/plugins/rwvns/yang/rwsdn.yang
rwlaunchpad/plugins/yang/rw-pkg-mgmt.yang

diff --cc BUILD.sh
Simple merge
@@@ -130,7 -133,7 +134,8 @@@ rift_python_install_tree
      rift/mano/utils/__init.py__
      rift/mano/utils/compare_desc.py
      rift/mano/utils/juju_api.py
 +    rift/mano/utils/project.py
+     rift/mano/utils/short_name.py
    COMPONENT ${PKG_LONG_NAME}
    PYTHON3_ONLY
    )
@@@ -186,45 -193,44 +193,44 @@@ class ToscaNfvVnf(ManoResource)
          self.log.debug(_("VDU {0} properties: {1}").
                         format(self.name, self.properties))
  
-     def handle_requirements(self, nodes):
+     def handle_requirements(self, nodes, policies, vnf_type_to_vdus_map):
          tosca_reqs = self.get_tosca_reqs()
-         self.log.debug("VNF {0} requirements: {1}".
-                        format(self.name, tosca_reqs))
-         try:
-             for req in tosca_reqs:
-                 if 'vdus' in req:
-                     target = req['vdus']['target']
-                     node = self.get_node_with_name(target, nodes)
-                     if node:
-                         self._vdus.append(node)
-                         node._vnf = self
-                         # Add the VDU id to mgmt-intf
-                         if 'mgmt-interface' in self.properties:
-                             self.properties['mgmt-interface']['vdu-id'] = \
-                                             node.id
-                             if 'vdu' in self.properties['mgmt-interface']:
-                                 # Older yang
-                                 self.properties['mgmt-interface'].pop('vdu')
-                     else:
-                         err_msg = _("VNF {0}, VDU {1} specified not found"). \
-                                   format(self.name, target)
-                         self.log.error(err_msg)
-                         raise ValidationError(message=err_msg)
-         except Exception as e:
-             err_msg = _("Exception getting VDUs for VNF {0}: {1}"). \
-                       format(self.name, e)
-             self.log.error(err_msg)
-             raise e
-         self.log.debug(_("VNF {0} properties: {1}").
-                        format(self.name, self.properties))
+         for req in tosca_reqs:
+             for key, value in req.items():
+                 if 'target' in value:
+                     self._reqs[key] = value['target']
+         for policy in policies:
+             if hasattr(policy, '_vnf_name') and policy._vnf_name == self.name:
+                 self._policies.append(policy)
+         if self.vnf_type in vnf_type_to_vdus_map:
+             for vdu_node_name in vnf_type_to_vdus_map[self.vnf_type]:
+                 node = self.get_node_with_name(vdu_node_name, nodes)
+                 if node:
+                     self._vdus.append(node)
+                     node._vnf = self
+                     # Add the VDU id to mgmt-intf
+                     if 'mgmt-interface' in self.properties:
+                         self.properties['mgmt-interface']['vdu-id'] = \
+                                         node.id
+                         if 'vdu' in self.properties['mgmt-interface']:
+                             # Older yang
+                             self.properties['mgmt-interface'].pop('vdu')
+                 else:
+                     err_msg = _("VNF {0}, VDU {1} specified not found"). \
+                               format(self.name, target)
+                     self.log.error(err_msg)
+                     raise ValidationError(message=err_msg)
  
      def generate_yang_model_gi(self, nsd, vnfds):
 -        vnfd_cat = RwVnfdYang.YangData_Vnfd_VnfdCatalog()
 +        vnfd_cat = RwVnfdYang.YangData_RwProject_Project_VnfdCatalog()
          vnfd = vnfd_cat.vnfd.add()
          props = convert_keys_to_python(self.properties)
+         for key in ToscaNfvVnf.IGNORE_PROPS:
+             if key in props:
+                 props.pop(key)
          try:
              vnfd.from_dict(props)
          except Exception as e:
Simple merge
index 70cacda,0000000..b279398
mode 100644,000000..100644
--- /dev/null
@@@ -1,791 -1,0 +1,789 @@@
-     uses manotypes:ns-service-primitive;
 +
 +/*
 + * 
 + *   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 nsd-base
 +{
 +  namespace "http://riftio.com/ns/riftware-1.0/nsd-base";
 +  prefix "nsd-base";
 +
 +  import rw-pb-ext {
 +    prefix "rwpb";
 +  }
 +
 +  import vld {
 +    prefix "vld";
 +  }
 +
 +  import ietf-inet-types {
 +    prefix "inet";
 +  }
 +
 +  import ietf-yang-types {
 +    prefix "yang";
 +  }
 +
 +  import mano-types {
 +    prefix "manotypes";
 +  }
 +
 +  revision 2017-02-28 {
 +    description
 +      "Initial revision. This YANG file defines
 +       the Network Service Descriptor (NSD)
 +       common groupings";
 +    reference
 +      "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-common {
 +    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;
 +      }
 +    }
 +
 +    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;
 +          }
 +
 +          leaf scale-out-threshold {
 +            description
 +                "Value above which scale-out requests are generated";
 +            type uint64;
 +          }
 +
 +          leaf ns-monitoring-param-ref {
 +            description
 +               "Reference to the NS level monitoring parameter
 +                that is aggregated";
 +            type leafref {
 +              path "../../../../monitoring-param/id";
 +            }
 +          }
 +        }
 +      }
 +
 +      list vnfd-member {
 +        description "List of VNFs in this scaling 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 count {
 +          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 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";
 +          }
 +
 +          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 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
 +                  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";
 +            // TODO: Keeping as string as this needs to be
 +            // diffenent lvel based of if it is nsd-catalog or
 +            // in nsr.
 +            // type leafref {
 +            //   path "../../../../../../vnfd:vnfd-catalog/vnfd:vnfd" +
 +            //        "[vnfd:id = current()/../vnfd-id-ref]/" +
 +            //        "vnfd:connection-point/vnfd:name";
 +            // }
 +            type string;
 +          }
 +        }
 +      } //rsp
 +
 +      list classifier {
 +        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;
 +        }
 +
 +        leaf rsp-id-ref {
 +          description
 +              "A reference to the RSP.";
 +          type leafref {
 +            path "../../rsp/id";
 +          }
 +        }
 +
 +        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 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
 +                  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";
 +          // TODO: Keeping as string as this needs to be
 +          // diffenent lvel based of if it is nsd-catalog or
 +          // in nsr.
 +          // type leafref {
 +          //     path "../../../../../vnfd:vnfd-catalog/vnfd:vnfd" +
 +          //          "[vnfd:id = current()/../vnfd-id-ref]/" +
 +          //          "vnfd:connection-point/vnfd:name";
 +          // }
 +          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;
 +          }
 +
 +          leaf destination-port {
 +            description
 +                "Destination port number.";
 +            type inet:port-number;
 +          }
 +          //TODO: Add more match criteria
 +        } //match-attributes
 +      } // classifier
 +    } // vnffgd
 +
 +    uses manotypes:ip-profile-list;
 +
 +    list initial-config-primitive {
 +      rwpb:msg-new NsdInitialConfigPrimitive;
 +      description
 +        "Initial set of configuration primitives for NSD.";
 +      key "seq";
 +
 +      uses manotypes:initial-config;
 +    }
 +
 +    uses manotypes:input-parameter-xpath;
 +
 +    list parameter-pool {
 +      description
 +        "Pool of parameter values which must be
 +         pulled from during configuration";
 +      key "name";
 +
 +      leaf name {
 +        description
 +            "Name of the configuration value pool";
 +        type string;
 +      }
 +
 +      container range {
 +        description
 +            "Create a range of values to populate the pool with";
 +
 +        leaf start-value {
 +          description
 +              "Generated pool values start at this value";
 +          type uint32;
 +          mandatory true;
 +        }
 +
 +        leaf end-value {
 +          description
 +              "Generated pool values stop at this value";
 +          type uint32;
 +          mandatory true;
 +        }
 +      }
 +    }
 +
 +    list key-pair {
 +      key "name";
 +      description "Used to configure the list of public keys to be injected as part
 +          of ns instantiation";
 +
 +      leaf name {
 +        description "Name of this key pair";
 +        type string;
 +      }
 +
 +      leaf key {
 +        description "Key associated with this key pair";
 +        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;
 +      }
 +
 +      leaf user-info {
 +        description "The user name's real name";
 +        type string;
 +      }
 +
 +      list key-pair {
 +        key "name";
 +        description "Used to configure the list of public keys to be injected as part
 +            of ns instantiation";
 +
 +        leaf name {
 +          description "Name of this key pair";
 +          type string;
 +        }
 +
 +        leaf key {
 +          description "Key associated with this key pair";
 +          type string;
 +        }
 +      }
 +    }
 +  }
 +
 +  grouping nsd-vld-common {
 +    /* Still having issues modelling this,
 +       see the comments under vnfd-connection-point-ref
 +    */
 +    description
 +      "List of Virtual Link Descriptors.";
 +
 +    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;
 +    }
 +
 +    // 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 monitoring-param-common {
 +    description
 +      "List of monitoring parameters from VNF's that should be
 +        propogated up into NSR";
 +
 +    leaf id {
 +      type string;
 +    }
 +
 +    leaf name {
 +      type string;
 +    }
 +
 +    uses manotypes:monitoring-param-value;
 +    uses manotypes:monitoring-param-ui-data;
 +    uses manotypes:monitoring-param-aggregation;
 +  }
 +}
@@@ -227,24 -801,183 +217,105 @@@ module ns
          }
        }
      }
 +  }
  
 -    uses manotypes:input-parameter-xpath;
 -
 -    list parameter-pool {
 -      description
 -        "Pool of parameter values which must be
 -         pulled from during configuration";
 -      key "name";
 -
 -      leaf name {
 -        description
 -            "Name of the configuration value pool";
 -        type string;
 -      }
 -
 -      container range {
 -        description
 -            "Create a range of values to populate the pool with";
 -
 -        leaf start-value {
 -          description
 -              "Generated pool values start at this value";
 -          type uint32;
 -          mandatory true;
 -        }
 -
 -        leaf end-value {
 -          description
 -              "Generated pool values stop at this value";
 -          type uint32;
 -          mandatory true;
 -        }
 -      }
 -    }
 -
 -    list service-primitive {
++  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 "/vnfd:vnfd-catalog/vnfd:vnfd"
+                     + "[vnfd:id = current()/../vnfd-id-ref]"
+                     + "/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;
+       }
+     }
 - 
 -    list initial-config-primitive {
 -      rwpb:msg-new NsdInitialConfigPrimitive;
 -      description
 -        "Initial set of configuration primitives for NSD.";
 -      key "seq";
 -
 -      uses manotypes:initial-config;
 -    }
 -
 -    list key-pair {
 -      key "name";
 -      description "Used to configure the list of public keys to be injected as part
 -          of ns instantiation";
 -
 -      leaf name {
 -        description "Name of this key pair";
 -        type string;
 -      }
 -
 -      leaf key {
 -        description "Key associated with this key pair";
 -        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;
      }
    }
 -
  }
@@@ -118,61 -131,91 +118,63 @@@ module ns
      }
    }
  
 -  list key-pair {
 -    key "name";
 -    description "Used to configure the list of public keys to be injected as part
 -                 of ns instantiation";
 -    leaf name {
 -      description "Name of this key pair";
 -      type string;
 -    }
 +  augment "/rw-project:project" {
 +    container ns-instance-config {
  
 -    leaf key {
 -      description "Key associated with this key pair";
 -      type string;
 -    }
 -  }
 +      list nsr {
 +        key "id";
 +        unique "name";
  
 -  rpc start-network-service {
 -    description "Start the network service";
 -    input {
 -      leaf name {
 -        mandatory true;
 -        description "Name of the Network Service";
 -        type string;
 -      }
 -      leaf nsd-ref {
 -        description "Reference to NSR ID ref";
 -        mandatory true;
 -        type leafref {
 -          path "/nsd:nsd-catalog/nsd:nsd/nsd:id";
 +        leaf id {
 +          description "Identifier for the NSR.";
 +          type yang:uuid;
          }
 -      }
 -      uses ns-instance-config-params;
 -    }
  
 -    output {
 -      leaf nsr-id {
 -        description "Automatically generated parameter";
 -        type yang:uuid;
 -      }
 -    }
 -  }
 +        leaf name {
 +          description "NSR name.";
 +          type string;
 +        }
  
 +        leaf short-name {
 +          description "NSR short name.";
 +          type string;
 +        }
  
 +        leaf description {
 +          description "NSR description.";
 +          type string;
 +        }
  
 -  container ns-instance-config {
 +        leaf admin-status {
 +          description
 +            "This is the administrative status of the NS instance";
  
 -    list nsr {
 -      key "id";
 -      unique "name";
 +          type enumeration {
 +            enum ENABLED;
 +            enum DISABLED;
 +          }
 +        }
  
 -      leaf id {
 -        description "Identifier for the NSR.";
 -        type yang:uuid;
 -      }
 +        container nsd {
 +          description "NS descriptor used to instantiate this NS";
  
 -      leaf name {
 -        description "NSR name.";
 -        type string;
 -      }
 +          uses nsd-base:nsd-descriptor-common;
  
 -      leaf short-name {
 -        description "NSR short name.";
 -        type string;
 -      }
 +          uses project-nsd:nsr-nsd-vld;
  
 -      leaf description {
 -        description "NSR description.";
 -        type string;
 -      }
 +          uses project-nsd:nsr-nsd-constituent-vnfd;
  
 -      leaf admin-status {
 -        description
 -          "This is the administrative status of the NS instance";
 +          uses project-nsd:nsr-nsd-placement-groups;
  
 -        type enumeration {
 -          enum ENABLED;
 -          enum DISABLED;
 +          uses project-nsd:nsr-nsd-vnf-dependency;
 +
 +          uses project-nsd:nsr-nsd-monitoring-param;
++
++          uses project-nsd:nsr-nsd-service-primitive;
          }
 -      }
  
 -      container nsd {
 -        description "NS descriptor used to instantiate this NS";
 -        uses nsd:nsd-descriptor;
 +        uses ns-instance-config-params;
        }
 -
 -      uses ns-instance-config-params;
      }
    }
  
              configuring: At least one of the VNFs in this instance is in configuring state
              configured:  All the VNFs in this NS instance are configured or config-not-needed state
            ";
 -        type config-states;
 -      }
 +          type config-states;
 +        }
  
-         uses manotypes:ns-service-primitive;
 -      list service-primitive {
 -         description
 -              "Network service level service primitives.";
++        list service-primitive {
++           description
++                "Network service level service primitives.";
 -         key "name";
++           key "name";
 -         leaf name {
 -            description
 -                "Name of the service primitive.";
 -            type string;
 -         }
 -
 -         list parameter {
 -            description
 -                "List of parameters for the service primitive.";
++           leaf name {
++              description
++                  "Name of the service primitive.";
++              type string;
++           }
 -            key "name";
 -            uses manotypes:primitive-parameter;
 -         }
++           list parameter {
++              description
++                  "List of parameters for the service primitive.";
 -         uses manotypes:ui-primitive-group;
++              key "name";
++              uses manotypes:primitive-parameter;
++           }
 -         list vnf-primitive-group {
 -            description
 -                "List of service primitives grouped by VNF.";
++           uses manotypes:ui-primitive-group;
 -            key "member-vnf-index-ref";
 -            leaf member-vnf-index-ref {
++           list vnf-primitive-group {
+               description
 -                 "Reference to member-vnf within constituent-vnfds";
 -              type string;
 -            }
 -
 -            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;
 -            }
++                  "List of service primitives grouped by VNF.";
 -            leaf vnfd-name {
 -               description
 -                 "Name of the VNFD";
 -               type string;
 -            }
++              key "member-vnf-index-ref";
++              leaf member-vnf-index-ref {
++                description
++                   "Reference to member-vnf within constituent-vnfds";
++                type string;
++              }
 -            list primitive {
 -               key "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";
 -               leaf index {
 -                 description "Index of this primitive";
 -                 type uint32;
 -               }
++                 type string;
++              }
 -               leaf name {
 -                 description "Name of the primitive in the VNF primitive ";
++              leaf vnfd-name {
++                 description
++                   "Name of the VNFD";
+                  type string;
 -               }
 -            }
 -         }
++              }
 -         leaf user-defined-script {
 -           description
 -               "A user defined script.";
 -           type string;
 -         }
 -      }
++              list primitive {
++                 key "index";
 -      list initial-config-primitive {
 -        rwpb:msg-new NsrInitialConfigPrimitive;
 -        description
 -            "Initial set of configuration primitives for NSD.";
 -        key "seq";
 -        leaf seq {
 -          description
 -              "Sequence number for the configuration primitive.";
 -          type uint64;
 -        }
++                 leaf index {
++                   description "Index of this primitive";
++                   type uint32;
++                 }
 -        leaf name {
 -          description
 -              "Name of the configuration primitive.";
 -          type string;
 -          mandatory "true";
++                 leaf name {
++                   description "Name of the primitive in the VNF primitive ";
++                   type string;
++                 }
++              }
++           }
++
++           leaf user-defined-script {
++             description
++                 "A user defined script.";
++             type string;
++           }
+         }
  
 -        leaf user-defined-script {
 +        list initial-config-primitive {
 +          rwpb:msg-new NsrInitialConfigPrimitive;
            description
 -              "A user defined script.";
 -          type string;
 -        }
 +            "Initial set of configuration primitives for NSD.";
 +          key "seq";
 +          leaf seq {
 +            description
 +              "Sequence number for the configuration primitive.";
 +            type uint64;
 +          }
  
 -        list parameter {
 -          key "name";
            leaf name {
 +            description
 +              "Name of the configuration primitive.";
              type string;
 +            mandatory "true";
            }
  
 -          leaf value {
 +          leaf user-defined-script {
 +            description
 +              "A user defined script.";
              type string;
            }
 +
 +          list parameter {
 +            key "name";
 +            leaf name {
 +              type string;
 +            }
 +
 +            leaf value {
 +              type string;
 +            }
 +          }
          }
 -      }
  
  
 -      list monitoring-param {
 -        description
 -          "List of NS level params.";
 -        key "id";
 +        list monitoring-param {
 +          description
 +            "List of NS level params.";
 +          key "id";
  
 -        uses manotypes:monitoring-param-value;
 -        uses manotypes:monitoring-param-ui-data;
 -        uses manotypes:monitoring-param-aggregation;
 +          uses manotypes:monitoring-param-value;
 +          uses manotypes:monitoring-param-ui-data;
 +          uses manotypes:monitoring-param-aggregation;
  
 -        leaf id {
 -          type string;
 -        }
 +          leaf id {
 +            type string;
 +          }
  
 -        leaf name {
 -          type string;
 -        }
 +          leaf name {
 +            type string;
 +          }
  
 -        leaf nsd-mon-param-ref {
 -          description "Reference to the NSD monitoring param descriptor
 +          leaf nsd-mon-param-ref {
 +            description "Reference to the NSD monitoring param descriptor
                         that produced this result";
 -          type leafref {
 -            path "/nsd:nsd-catalog/nsd:nsd[nsd:id = current()/" +
 -                 "../../nsr:nsd-ref]/nsd:monitoring-param/nsd:id";
 +            // TODO: Fix leafref
 +            type leafref {
 +              path "../../../../project-nsd:nsd-catalog/project-nsd:nsd" +
 +                "[project-nsd:id = current()/../../nsd-ref]" +
 +                "/project-nsd:monitoring-param/project-nsd:id";
 +            }
            }
 -        }
  
 -        list vnfr-mon-param-ref {
 -          description "A list of VNFR monitoring params associated with this monp";
 -          key "vnfr-id-ref vnfr-mon-param-ref";
 +          list vnfr-mon-param-ref {
 +            description "A list of VNFR monitoring params associated with this monp";
 +            key "vnfr-id-ref vnfr-mon-param-ref";
  
 -          leaf vnfr-id-ref {
 -            description
 -               "A reference to a vnfr. This is a
 +            leaf vnfr-id-ref {
 +              description
 +                "A reference to a vnfr. This is a
                  leafref to path:
                      /vnfr:vnfr-catalog/vnfr:vnfr/vnfr:id";
  
index 1cf36af,0000000..9e20fd2
mode 100644,000000..100644
--- /dev/null
@@@ -1,441 -1,0 +1,601 @@@
 +
 +/*
 + * 
 + *   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 ietf-yang-types {
 +    prefix "yang";
 +  }
 +
 +  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 "../../../../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 "../../../../../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";
 +          // TODO (Philip): RIFT-15639
 +          // type leafref {
 +          //   path "../../../constituent-vnfd/member-vnf-index";
 +          // }
 +          type uint64;
 +        }
 +
 +        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 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 "../../../../../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 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 "../../../../../../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";
 +          // TODO (Philip): RIFT-15639
 +          // type leafref {
 +          //   path "../../../constituent-vnfd/member-vnf-index";
 +          // }
 +          type uint64;
 +        }
 +
 +        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";
 +          // TODO (Philip): RIFT-15639
 +          // type leafref {
 +          //   path "../../../constituent-vnfd/member-vnf-index";
 +          // }
 +          type uint64;
 +        }
 +
 +        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 "vnfd-id-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;
 +        }
 +
 +        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 "vnfd-id-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;
 +        }
 +
 +        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;
 +      }
 +    }
 +  }
 +}
@@@ -269,120 -255,129 +269,129 @@@ module vnf
               different VNFs. The NFVO will use VLDs and VNFFGs at
               the network service level to construct network services.";
  
 -        uses vnfd:common-connection-point;
 +          uses vnfd-base:common-connection-point;
  
 -        leaf vlr-ref {
 -          description
 +          leaf vlr-ref {
 +            description
                "Reference to the VLR associated with this connection point";
 -          type  leafref {
 -            path "/vlr:vlr-catalog/vlr:vlr/vlr:id";
 +            type  leafref {
 +              path "../../../../vlr:vlr-catalog/vlr:vlr/vlr:id";
 +            }
            }
 -        }
  
 -        leaf ip-address {
 -          description
 +          leaf ip-address {
 +            description
                "IP address assigned to the external connection point";
 -          type inet:ip-address;
 -        }
 -        leaf mac-address {
 -          description
 +            type inet:ip-address;
 +          }
 +          leaf mac-address {
 +            description
                "MAC address assigned to the external connection point";
 -          // type inet:mac-address;
 -          type string;
 -        }
 -        leaf connection-point-id {
 -          rwpb:field-inline "true";
 -          rwpb:field-string-max 64;
 -          type string;
 +            // type inet:mac-address;
 +            type string;
 +          }
 +          leaf connection-point-id {
 +            rwpb:field-inline "true";
 +            rwpb:field-string-max 64;
 +            type string;
 +          }
          }
 -      }
  
 -      list vdur {
 -        description "List of Virtual Deployment Units";
 -        key "id";
 -        unique "name";
 +        list vdur {
 +          description "List of Virtual Deployment Units";
 +          key "id";
 +          unique "name";
  
 -        leaf id {
 -          description "Unique id for the VDU";
 -          type yang:uuid;
 -        }
 +          leaf id {
 +            description "Unique id for the VDU";
 +            type yang:uuid;
 +          }
  
 -        leaf name {
 -          description "name of the instantiated VDUR";
 -          type string;
 -        }
 +          leaf name {
 +            description "name of the instantiated VDUR";
 +            type string;
 +          }
  
 -        leaf unique-short-name {
 -          description "Short Unique name of the VDU
 -                This will be of the format NSR name-ShortnedString-VDUname
 -                NSR name and VDU name shall be constrained to 10 characters";
 -          rwpb:field-inline "true";
 -          rwpb:field-string-max 64;
 -          type string;
 -        }
++          leaf unique-short-name {
++            description "Short Unique name of the VDU
++                  This will be of the format NSR name-ShortnedString-VDUname
++                  NSR name and VDU name shall be constrained to 10 characters";
++            rwpb:field-inline "true";
++            rwpb:field-string-max 64;
++            type string;
++          }
 -        leaf vdu-id-ref {
 -          type leafref {
 -            path "../../vnfd/vdu/id";
 +          leaf vdu-id-ref {
 +            type leafref {
 +              path "../../vnfd/vdu/id";
 +            }
            }
 -        }
  
 -        leaf vim-id {
 -          description "Allocated VM resource id";
 -          type string;
 -        }
 +          leaf vim-id {
 +            description "Allocated VM resource id";
 +            type string;
 +          }
  
 -        leaf flavor-id {
 -          description "VIM assigned flavor id";
 -          type string;
 -        }
 +          leaf flavor-id {
 +            description "VIM assigned flavor id";
 +            type string;
 +          }
  
 -        leaf image-id {
 -          description "VIM assigned image id";
 -          type string;
 -        }
 +          leaf image-id {
 +            description "VIM assigned image id";
 +            type string;
 +          }
  
 -        leaf management-ip {
 -          description "Management IP address";
 -          type inet:ip-address;
 -        }
 +          leaf management-ip {
 +            description "Management IP address";
 +            type inet:ip-address;
 +          }
  
 -        leaf vm-management-ip {
 -          description "VM Private Management IP address";
 -          type inet:ip-address;
 -        }
 +          leaf vm-management-ip {
 +            description "VM Private Management IP address";
 +            type inet:ip-address;
 +          }
  
 -        leaf console-url {
 -          description "Console URL for this VDU, if available";
 -          type inet:uri;
 -        }
 +          leaf console-url {
 +            description "Console URL for this VDU, if available";
 +            type inet:uri;
 +          }
  
 -        uses manotypes:vm-flavor;
 -        uses manotypes:guest-epa;
 -        uses manotypes:vswitch-epa;
 -        uses manotypes:hypervisor-epa;
 -        uses manotypes:host-epa;
 +          uses manotypes:vm-flavor;
 +          uses manotypes:guest-epa;
 +          uses manotypes:vswitch-epa;
 +          uses manotypes:hypervisor-epa;
 +          uses manotypes:host-epa;
  
 -        uses manotypes:supplemental-boot-data;
 +          uses manotypes:supplemental-boot-data;
  
 -        list volumes {
 -          key "name";
 +          list volumes {
 +            key "name";
  
 -          leaf name {
 -            description "Name of the disk-volumes, e.g. vda, vdb etc";
 -            type string;
 -          }
 +            leaf name {
 +              description "Name of the disk-volumes, e.g. vda, vdb etc";
 +              type string;
 +            }
  
 -          leaf volume-id {
 -            description "VIM assigned volume id";
 -            type string;
 -          }
 +            leaf volume-id {
 +              description "VIM assigned volume id";
 +              type string;
 +            }
  
 -          uses manotypes:volume-info;
 -        }
 +            uses manotypes:volume-info;
 +          }
  
 -        list alarms {
 -          description
 +          list alarms {
 +            description
                "A list of the alarms that have been created for this VDU";
  
 -          key "alarm-id";
 -          uses manotypes:alarm;
 -        }
 +            key "alarm-id";
 +            uses manotypes:alarm;
 +          }
  
 -        list internal-connection-point {
 -          key "id";
 -          description
 +          list internal-connection-point {
 +            key "id";
 +            description
                "List for internal connection points. Each VNFC
                 has zero or more internal connection points.
                 Internal connection points are used for connecting
@@@ -394,37 -381,18 +394,47 @@@ class OnboardPackage
          self.log.info("Successfully initiated instantiation of NS as {} ({})".
                        format(self._service_name, ns_id))
  
 +    def list_nsds(self):
 +        if self._args.list_nsds:
 +            self.log.debug("Check NSDS at {}:{}, with credentials {}:{}".
 +                           format(self._ip, self._rport, self._user, self._password))
 +
 +            rest_url = self._conf_url+"/nsd-catalog/nsd"
 +            try:
 +                output = self._exec_cmd(rest_url)
 +                self.log.debug("Output of NSD list: {}".
 +                               format(output))
 +                if output:
 +                    js = json.loads(output)
 +                    if "error" in js:
 +                        raise OnboardPkgRcConnError("SO Restconf connect error: {}".
 +                                                    format(js["error"]))
 +                else:
 +                    print("No NSDs found on SO")
 +                    return
 +
 +                self.log.debug("NSD list: {}".format(js))
 +                print('List of NSDs on SO:\nName\tID')
 +                for nsd in js['project-nsd:nsd']:
 +                    print('{}\t{}'.format(nsd['name'], nsd['id']))
 +
 +            except OnboardPkgCmdError as e:
 +                self.log.error("SO restconf connect failed: {}".format(e))
 +                raise OnboardPkgRcConnError("SO Restconf connect error: {}".
 +                                            format(e))
 +
      def process(self):
-         self.validate_args()
+         try:
+             self.validate_args()
+         except Exception as e:
+             if args.verbose:
+                 log.exception(e)
+             print("\nERROR:", e)
+             print("\n")
+             parser.print_help()
+             sys.exit(2)
          self.validate_connectivity()
          self.upload_packages()
          self.instantiate()
@@@ -28,28 -33,50 +33,58 @@@ if sys.version_info < (3, 4, 4)
  
  class DownloadStatusPublisher(mano_dts.DtsHandler, url_downloader.DownloaderProtocol):
  
 -    def __init__(self, log, dts, loop):
 -        super().__init__(log, dts, loop)
 +    def __init__(self, log, dts, loop, project):
 +        super().__init__(log, dts, loop, project)
          self.tasks = {}
  
      def xpath(self, download_id=None):
 -        return ("D,/rw-pkg-mgmt:download-jobs/rw-pkg-mgmt:job" +
 -            ("[download-id='{}']".format(download_id) if download_id else ""))
 +        return self._project.add_project("D,/rw-pkg-mgmt:download-jobs/rw-pkg-mgmt:job" +
 +                                         ("[download-id='{}']".
 +                                          format(download_id) if download_id else ""))
  
+     @asyncio.coroutine
+     def _dts_publisher(self, job):
+          # Publish the download state
+          self.reg.update_element(
+                         self.xpath(download_id=job.download_id), job)
      @asyncio.coroutine
      def register(self):
          self.reg = yield from self.dts.register(xpath=self.xpath(),
                    flags=rwdts.Flag.PUBLISHER|rwdts.Flag.CACHE|rwdts.Flag.NO_PREP_READ)
  
          assert self.reg is not None
 +
 +    def dergister(self):
 +        self._log.debug("De-registering download status for project {}".
 +                        format(self.project.name))
 +        if self.reg:
 +            self.reg.deregister()
 +            self.reg = None
+    
+     @staticmethod 
+     def _async_func(func, fut):
+         try:
+             ret = func()
+             fut.set_result(ret)
+         except Exception as e:
+             fut.set_exception(e)
+     def _schedule_dts_work(self, download_job_msg):
+         # Create a coroutine
+         cort = self._dts_publisher(download_job_msg)
+         # Use main asyncio loop (running in main thread)
+         newfunc = functools.partial(asyncio.ensure_future, cort, loop=self.loop)
+         fut = concurrent.futures.Future()
+         # Schedule future in main thread immediately
+         self.loop.call_soon_threadsafe(DownloadStatusPublisher._async_func, newfunc, fut)
+         res = fut.result()
+         exc = fut.exception()
+         if exc is not None:
+             self.log.error("Caught future exception during download: %s type %s", str(exc), type(exc))
+             raise exc
+         return res
  
      def on_download_progress(self, download_job_msg):
          """callback that triggers update.
@@@ -40,25 -37,8 +40,33 @@@ from rift.mano.utils.project import 
  from . import rpc
  from .proxy import filesystem
  from . import publisher as pkg_publisher
+ from . import subscriber 
  
-         self.job_handler = pkg_publisher.DownloadStatusPublisher(
-             self._log, self._dts, self._loop, self)
 +class PackageManagerProject(ManoProject):
 +
 +    def __init__(self, name, tasklet, **kw):
 +        super(PackageManagerProject, self).__init__(tasklet.log, name)
 +        self.update(tasklet)
 +
++        args = [self.log, self.dts, self.loop, self]
++        self.job_handler = pkg_publisher.DownloadStatusPublisher(*args)
++        # create catalog subscribers 
++        self.vnfd_catalog_sub = subscriber.VnfdStatusSubscriber(*args)
++        self.nsd_catalog_sub = subscriber.NsdStatusSubscriber(*args)
++
 +
 +    @asyncio.coroutine
 +    def register (self):
++        yield from self.vnfd_catalog_sub.register()
++        yield from self.nsd_catalog_sub.register()
 +        yield from self.job_handler.register()
 +
 +    def deregister (self):
 +        yield from self.job_handler.deregister()
++        yield from self.vnfd_catalog_sub.deregister()
++        yield from self.nsd_catalog_sub.deregister()
 +
 +
  class PackageManagerTasklet(rift.tasklets.Tasklet):
      def __init__(self, *args, **kwargs):
          try:
  # Creation Date: 09/25/2016
  # 
  
+ import os
+ import io
+ import shutil
  import rift.mano.dts as mano_dts
+ import rift.package.package as package 
+ import rift.package.store as store 
+ import rift.package.convert as convert
  
+ from gi.repository import (
+     RwYang,
+     NsdYang,
+     RwNsdYang,
+     VnfdYang,
+     RwVnfdYang,
+     RwDts
+ )
  
  class DownloadStatusSubscriber(mano_dts.AbstractOpdataSubscriber):
-     def __init__(self, log, dts, loop, project, callback=None):
++    def __init__(self, log, dts, loop, project, callback):
 +        super().__init__(log, dts, loop, project, callback)
 +
 +    def get_xpath(self):
 +        return self._project.add_project(
 +            "D,/rw-pkg-mgmt:download-jobs/rw-pkg-mgmt:job")
 -    def __init__(self, log, dts, loop, callback):
 -        super().__init__(log, dts, loop, callback)
 -    
 -    def get_xpath(self): 
 -        return ("D,/rw-pkg-mgmt:download-jobs/rw-pkg-mgmt:job")
+ class VnfdStatusSubscriber(DownloadStatusSubscriber): 
+     DOWNLOAD_DIR = store.VnfdPackageFilesystemStore.DEFAULT_ROOT_DIR
+     MODULE_DESC = 'vnfd rw-vnfd'.split()
+     DESC_TYPE = 'vnfd'
+     
 -    def __init__(self, log, dts, loop):
 -        super().__init__(log, dts, loop, self.on_change)
 -        self.subscriber = mano_dts.VnfdCatalogSubscriber(log, dts, loop)
++    def __init__(self, log, dts, loop, project):
++        super().__init__(log, dts, loop, project, self.on_change)
++        self.subscriber = mano_dts.VnfdCatalogSubscriber(log, dts, loop, project)
+     def on_change(self, msg, action): 
+         log_msg = "1. Vnfd called w/ msg attributes: {} id {} name {} action: {}".format(repr(msg), msg.id, msg.name, repr(action))
+         self.log.debug(log_msg)
+         if action == RwDts.QueryAction.UPDATE:
+             actionCreate(self, msg)
+         else:
+             self.log.debug("VnfdStatusSubscriber: No action for {}".format(repr(action)))
+             pass
+     def get_xpath(self): 
+         return self.subscriber.get_xpath() 
+ class NsdStatusSubscriber(DownloadStatusSubscriber): 
+     DOWNLOAD_DIR = store.NsdPackageFilesystemStore.DEFAULT_ROOT_DIR
+     MODULE_DESC = 'nsd rw-nsd'.split()
+     DESC_TYPE = 'nsd'
+     
 -    def __init__(self, log, dts, loop):
 -        super().__init__(log, dts, loop, self.on_change)
 -        self.subscriber = mano_dts.NsdCatalogSubscriber(log, dts, loop)
++    def __init__(self, log, dts, loop, project):
++        super().__init__(log, dts, loop, project, self.on_change)
++        self.subscriber = mano_dts.NsdCatalogSubscriber(log, dts, loop, project)
+     def on_change(self, msg, action): 
+         log_msg = "1. Nsd called w/ msg attributes: {} id {} name {} action: {}".format(repr(msg), msg.id, msg.name, repr(action))
+         self.log.debug(log_msg)
+         if action == RwDts.QueryAction.UPDATE:
+             actionCreate(self, msg)
+         else:
+             self.log.debug("NsdStatusSubscriber: No action for {}".format(repr(action)))
+             pass
+     def get_xpath(self): 
+         return self.subscriber.get_xpath() 
+ def actionCreate(descriptor, msg): 
+     ''' Create folder structure if it doesn't exist: id/vnf name OR id/nsd name  
+     Serialize the Vnfd/Nsd object to yaml and store yaml file in the created folder.
+     '''
+     desc_name = msg.name if msg.name else ""
+     download_dir = os.path.join(descriptor.DOWNLOAD_DIR, msg.id)
+     # If a download dir is present with contents, then we know it has been created in the 
+     # upload path. 
+     if os.path.exists(download_dir) and os.listdir(download_dir):
+         descriptor.log.debug("Skpping folder creation, {} already present".format(download_dir))
+         return
+     else: 
+         download_dir = os.path.join(download_dir, desc_name) 
+         if not os.path.exists(download_dir):
+             os.makedirs(download_dir)
+             descriptor.log.debug("Created directory {}".format(download_dir))
+             model = RwYang.Model.create_libncx()
+             for module in descriptor.MODULE_DESC: model.load_module(module)
+             yaml_path = "{base}/{name}_{type}.yaml".format(base=download_dir, name=msg.name, type=descriptor.DESC_TYPE) 
+             with open(yaml_path,"w") as fh:
+                 fh.write(msg.to_yaml(model))
@@@ -51,10 -51,7 +51,11 @@@ import rift.package.stor
  import rift.package.cloud_init
  import rift.package.script
  import rift.mano.dts as mano_dts
 +from rift.mano.utils.project import (
 +    ManoProject,
 +    ProjectHandler,
 +    )
+ import rift.mano.utils.short_name as mano_short_name
  
  
  class VMResourceError(Exception):
@@@ -274,9 -270,9 +275,10 @@@ class VirtualDeploymentUnitRecord(objec
                   dts,
                   log,
                   loop,
 +                 project,
                   vdud,
                   vnfr,
+                  nsr_config,
                   mgmt_intf,
                   mgmt_network,
                   cloud_account_name,
          self._dts = dts
          self._log = log
          self._loop = loop
 +        self._project = project
          self._vdud = vdud
          self._vnfr = vnfr
+         self._nsr_config = nsr_config
          self._mgmt_intf = mgmt_intf
          self._cloud_account_name = cloud_account_name
          self._vnfd_package_store = vnfd_package_store
@@@ -1598,9 -1614,9 +1633,10 @@@ class VirtualNetworkFunctionRecord(obje
                  dts=self._dts,
                  log=self._log,
                  loop=self._loop,
 +                project = self._project,
                  vdud=vdu,
                  vnfr=vnfr,
+                 nsr_config=nsr_config,
                  mgmt_intf=self.has_mgmt_interface(vdu),
                  mgmt_network=self._mgmt_network,
                  cloud_account_name=self.cloud_account_name,
@@@ -2153,9 -2136,9 +2189,9 @@@ class VnfrConsoleOperdataDtsHandler(obj
                  )
  
              if action == rwdts.QueryAction.READ:
 -                schema = RwVnfrYang.YangData_RwVnfr_VnfrConsole_Vnfr_Vdur.schema()
 +                schema = RwVnfrYang.YangData_RwProject_Project_VnfrConsole_Vnfr_Vdur.schema()
                  path_entry = schema.keyspec_to_entry(ks_path)
-                 self._log.debug("VDU Opdata path is {}".format(path_entry))
+                 self._log.debug("VDU Opdata path is {}".format(path_entry.key00.id))
                  try:
                      vnfr = self._vnfm.get_vnfr(self._vnfr_id)
                  except VnfRecordError as e:
@@@ -2619,11 -2582,6 +2659,11 @@@ class VnfManager(object)
          for hdl in self._dts_handlers:
              yield from hdl.register()
  
-         self.log.debug("De-register VNFM project {}".format(self.name))
 +    def deregister(self):
++        self._log.debug("De-register VNFM project {}".format(self._project.name))
 +        for hdl in self._dts_handlers:
 +            hdl.deregister()
 +
      @asyncio.coroutine
      def run(self):
          """ Run this VNFM instance """
@@@ -329,86 -372,88 +386,89 @@@ module rwsd
      }
    }
  
 +  augment "/rw-project:project" {
 +    container vnffg-classifiers {
 +      list vnffg-classifier {
 +        key "name";
 +        rwpb:msg-new VNFFGClassifier;
  
 -  container vnffg-classifiers {
 -    list vnffg-classifier {
 -      key "name";
 -      rwpb:msg-new VNFFGClassifier;
 -
 -      leaf name {
 -        type string;
 -      }
 -      leaf rsp-name {
 -        type string;
 -      }
 -      leaf rsp-id {
 -        type yang:uuid;
 -      }
 -      leaf port-id {
 -        rwpb:field-inline "true";
 -        rwpb:field-string-max 64;
 -        type string;
 -      }
 -      leaf vm-id {
 -        rwpb:field-inline "true";
 -        rwpb:field-string-max 64;
 -        type string;
 -      }
 -      leaf sff-name {
 -        type string;
 -      }
 -      container vnffg-metadata {
 -        leaf ctx1 {
 +        leaf name {
            type string;
          }
 -        leaf ctx2 {
 +        leaf rsp-name {
            type string;
          }
 -        leaf ctx3 {
++        leaf rsp-id {
++          type yang:uuid;
++        }
 +        leaf port-id {
 +          rwpb:field-inline "true";
 +          rwpb:field-string-max 64;
            type string;
          }
 -        leaf ctx4 {
 +        leaf vm-id {
 +          rwpb:field-inline "true";
 +          rwpb:field-string-max 64;
            type string;
          }
 -      }
 -      list match-attributes {
 -        description
 -            "List of match attributes.";
 -        key "name";
 -        leaf name {
 +        leaf sff-name {
 +          type string;
 +        }
 +        container vnffg-metadata {
 +          leaf ctx1 {
 +            type string;
 +          }
 +          leaf ctx2 {
 +            type string;
 +          }
 +          leaf ctx3 {
 +            type string;
 +          }
 +          leaf ctx4 {
 +            type string;
 +          }
 +        }
 +        list match-attributes {
            description
 +            "List of match attributes.";
 +          key "name";
 +          leaf name {
 +            description
                "Name for the Access list";
 -          type string;  
 -        }
 +            type string;
 +          }
  
 -        leaf ip-proto {
 -          description
 +          leaf ip-proto {
 +            description
                "IP Protocol.";
 -          type uint8;
 -        }
 +            type uint8;
 +          }
  
 -        leaf source-ip-address {
 -          description
 +          leaf source-ip-address {
 +            description
                "Source IP address.";
 -          type inet:ip-prefix;
 -        }
 +            type inet:ip-prefix;
 +          }
  
 -        leaf destination-ip-address {
 -          description
 +          leaf destination-ip-address {
 +            description
                "Destination IP address.";
 -          type inet:ip-prefix;
 -        }
 +            type inet:ip-prefix;
 +          }
  
 -        leaf source-port {
 -          description
 +          leaf source-port {
 +            description
                "Source port number.";
 -          type inet:port-number;
 -        }
 +            type inet:port-number;
 +          }
  
 -        leaf destination-port {
 -          description
 +          leaf destination-port {
 +            description
                "Destination port number.";
 -          type inet:port-number;
 -        }
 -      } //match-attributes
 +            type inet:port-number;
 +          }
 +        } //match-attributes
 +      }
      }
    }
  
@@@ -53,19 -53,13 +53,27 @@@ module rw-pkg-mgm
      prefix "manotypes";
    }
  
+   import rw-vnfd {
+     prefix "rwvnfd";
+   }
++
+   import rw-nsd {
+     prefix "rwnsd";
+   }
 +  import rw-project {
 +    prefix "rw-project";
 +  }
 +
 +  import rw-project-mano {
 +    prefix "rw-project-mano";
 +  }
 +
 +  revision 2017-02-08 {
 +    description
 +      "Update model to support projects.";
 +  }
 +
    revision 2016-06-01 {
      description
        "Initial revision.";