New feature: Support rooted descriptors and descriptors under project 34/1234/2
authorPhilip Joseph <philip.joseph@riftio.com>
Tue, 7 Mar 2017 17:39:10 +0000 (23:09 +0530)
committerjosephp <philip.joseph@riftio.com>
Wed, 8 Mar 2017 14:18:53 +0000 (15:18 +0100)
Signed-off-by: Philip Joseph <philip.joseph@riftio.com>
76 files changed:
common/python/rift/mano/config_data/config.py
common/python/rift/mano/config_data/test/test_converter.py
common/python/rift/mano/dts/subscriber/ns_subscriber.py
common/python/rift/mano/dts/subscriber/test/utest_subscriber_dts.py
common/python/rift/mano/dts/subscriber/vnf_subscriber.py
common/python/rift/mano/tosca_translator/rwmano/syntax/mano_parameter.py
common/python/rift/mano/tosca_translator/rwmano/syntax/mano_template.py
common/python/rift/mano/tosca_translator/rwmano/tosca/tosca_nfv_vnf.py
common/python/rift/mano/utils/project.py
common/python/rift/mano/yang_translator/rwmano/yang/yang_nsd.py
common/python/test/utest_config_data.py
common/python/test/utest_project.py
common/rw_gen_package.py
examples/ping_pong_ns/config_desc.py
examples/ping_pong_ns/rift/mano/examples/ping_pong_nsd.py
models/openmano/python/rift/openmano/rift2openmano.py
models/openmano/src/openmano2rift.py
models/plugins/yang/CMakeLists.txt
models/plugins/yang/nsd-base.yang [new file with mode: 0644]
models/plugins/yang/nsd.yang
models/plugins/yang/nsr.yang
models/plugins/yang/project-nsd.yang [new file with mode: 0644]
models/plugins/yang/project-vnfd.yang [new file with mode: 0644]
models/plugins/yang/rw-nsd-base.yang [new file with mode: 0644]
models/plugins/yang/rw-nsd.yang
models/plugins/yang/rw-nsr.yang
models/plugins/yang/rw-project-nsd.yang [new file with mode: 0644]
models/plugins/yang/rw-project-vnfd.yang [new file with mode: 0644]
models/plugins/yang/rw-vnfd-base.yang [new file with mode: 0644]
models/plugins/yang/rw-vnfd.yang
models/plugins/yang/rw-vnfr.yang
models/plugins/yang/vld.yang
models/plugins/yang/vnfd-base.yang [new file with mode: 0644]
models/plugins/yang/vnfd.yang
models/plugins/yang/vnfr.yang
rwcm/plugins/rwconman/rift/tasklets/rwconmantasklet/rwconman_config.py
rwcm/plugins/yang/rw-conman.yang
rwlaunchpad/plugins/cli/cli_launchpad_schema_listing.txt
rwlaunchpad/plugins/rwautoscaler/test/utest_autoscaler_dts.py
rwlaunchpad/plugins/rwlaunchpadtasklet/rift/package/convert.py
rwlaunchpad/plugins/rwlaunchpadtasklet/rift/tasklets/rwlaunchpad/export.py
rwlaunchpad/plugins/rwlaunchpadtasklet/rift/tasklets/rwlaunchpad/onboard.py
rwlaunchpad/plugins/rwlaunchpadtasklet/rift/tasklets/rwlaunchpad/tasklet.py
rwlaunchpad/plugins/rwlaunchpadtasklet/rift/tasklets/rwlaunchpad/uploader.py
rwlaunchpad/plugins/rwlaunchpadtasklet/scripts/onboard_pkg
rwlaunchpad/plugins/rwlaunchpadtasklet/test/utest_export.py
rwlaunchpad/plugins/rwlaunchpadtasklet/test/utest_fileserver.py
rwlaunchpad/plugins/rwlaunchpadtasklet/test/utest_onboard.py
rwlaunchpad/plugins/rwlaunchpadtasklet/test/utest_package.py
rwlaunchpad/plugins/rwlaunchpadtasklet/test/utest_uploader_app_dts.py
rwlaunchpad/plugins/rwmonparam/test/utest_mon_params_dts.py
rwlaunchpad/plugins/rwnsm/rift/tasklets/rwnsmtasklet/publisher.py
rwlaunchpad/plugins/rwnsm/rift/tasklets/rwnsmtasklet/rwnsmtasklet.py
rwlaunchpad/plugins/rwnsm/rift/tasklets/rwnsmtasklet/scale_group.py
rwlaunchpad/plugins/rwvnfm/rift/tasklets/rwvnfmtasklet/rwvnfmtasklet.py
rwlaunchpad/plugins/yang/rw-launchpad.yang
rwlaunchpad/plugins/yang/rw-nsm.yang
rwlaunchpad/plugins/yang/rw-vnfm.yang
rwlaunchpad/ra/pytest/multivm_vnf/conftest.py
rwlaunchpad/ra/pytest/multivm_vnf/test_multi_vm_vnf_slb.py
rwlaunchpad/ra/pytest/multivm_vnf/test_multi_vm_vnf_trafgen.py
rwlaunchpad/ra/pytest/ns/haproxy/test_scaling.py
rwlaunchpad/ra/pytest/ns/pingpong/test_pingpong.py
rwlaunchpad/ra/pytest/ns/pingpong/test_records.py
rwlaunchpad/ra/pytest/ns/pingpong/test_scaling.py
rwlaunchpad/ra/pytest/ns/test_onboard.py
rwlaunchpad/ra/pytest/test_failover.py
rwlaunchpad/test/mano_ut.py
rwlaunchpad/test/pytest/lp_kt_utm_test.py
rwlaunchpad/test/pytest/lp_kt_utm_wims_test.py
rwlaunchpad/test/pytest/lp_test.py
rwlaunchpad/test/pytest/lp_tg_2vrouter_ts_epa_test.py
rwlaunchpad/test/pytest/lp_tg_2vrouter_ts_test.py
rwlaunchpad/test/pytest/lp_tg_vrouter_ts_epa_sriov_test.py
rwlaunchpad/test/utest_ro_account.py
rwlaunchpad/test/utest_rwnsm.py

index 63a2e48..e04475a 100644 (file)
@@ -20,8 +20,8 @@ import json
 import os
 import yaml
 
-from gi.repository import NsdYang
-from gi.repository import VnfdYang
+from gi.repository import ProjectNsdYang as NsdYang
+from gi.repository import ProjectVnfdYang as VnfdYang
 
 
 class InitialConfigReadError(Exception):
index 6169d73..0354c2b 100644 (file)
 
 import pytest
 import uuid
-from gi.repository import NsdYang, VnfdYang
+from gi.repository import (
+    ProjectNsdYang as NsdYang,
+    ProjectVnfdYang as VnfdYang,
+    )
 from ..config import ConfigPrimitiveConvertor
 import yaml
 
index a379b9a..4258afa 100644 (file)
@@ -49,7 +49,7 @@ class NsdCatalogSubscriber(core.AbstractConfigSubscriber):
         return "id"
 
     def get_xpath(self):
-        return self._project.add_project("C,/nsd:nsd-catalog/nsd:nsd")
+        return self._project.add_project("C,/project-nsd:nsd-catalog/project-nsd:nsd")
 
 
 class NsInstanceConfigSubscriber(core.AbstractConfigSubscriber):
index bf7ae68..9479b16 100644 (file)
@@ -30,10 +30,10 @@ gi.require_version('RwDtsYang', '1.0')
 from gi.repository import (
         RwLaunchpadYang as launchpadyang,
         RwDts as rwdts,
-        RwVnfdYang,
+        RwProjectVnfdYang as RwVnfdYang,
         RwVnfrYang,
         RwNsrYang,
-        RwNsdYang,
+        RwProjectNsdYang as RwNsdYang,
         VnfrYang
         )
 
@@ -110,8 +110,8 @@ class SubscriberStoreDtsTestCase(rift.test.dts.AbstractDTSTest):
         mock_vnfd = RwVnfdYang.YangData_RwProject_Project_VnfdCatalog_Vnfd()
         mock_vnfd.id = str(uuid.uuid1())
 
-        w_xpath = "C,/rw-project:project/vnfd:vnfd-catalog/vnfd:vnfd"
-        xpath = "{}[vnfd:id='{}']".format(w_xpath, mock_vnfd.id)
+        w_xpath = "C,/rw-project:project/project-vnfd:vnfd-catalog/project-vnfd:vnfd"
+        xpath = "{}[project-vnfd:id='{}']".format(w_xpath, mock_vnfd.id)
         yield from self.publisher.publish(w_xpath, xpath, mock_vnfd)
 
         yield from asyncio.sleep(5, loop=self.loop)
@@ -178,8 +178,8 @@ class SubscriberStoreDtsTestCase(rift.test.dts.AbstractDTSTest):
         mock_nsd = RwNsdYang.YangData_RwProject_Project_NsdCatalog_Nsd()
         mock_nsd.id = str(uuid.uuid1())
 
-        w_xpath = "C,/rw-project:project/nsd:nsd-catalog/nsd:nsd"
-        xpath = "{}[nsd:id='{}']".format(w_xpath, mock_nsd.id)
+        w_xpath = "C,/rw-project:project/project-nsd:nsd-catalog/project-nsd:nsd"
+        xpath = "{}[project-nsd:id='{}']".format(w_xpath, mock_nsd.id)
         yield from self.publisher.publish(w_xpath, xpath, mock_nsd)
 
         yield from asyncio.sleep(2, loop=self.loop)
@@ -238,4 +238,4 @@ def main(argv=sys.argv[1:]):
             )
 
 if __name__ == '__main__':
-    main()
\ No newline at end of file
+    main()
index 85ec589..524fb41 100644 (file)
@@ -48,4 +48,4 @@ class VnfdCatalogSubscriber(core.AbstractConfigSubscriber):
         return "id"
 
     def get_xpath(self):
-        return self.project.add_project("C,/vnfd:vnfd-catalog/vnfd:vnfd")
+        return self.project.add_project("C,/project-vnfd:vnfd-catalog/project-vnfd:vnfd")
index 7df584f..83e054f 100644 (file)
@@ -42,7 +42,7 @@ class ManoParameter(object):
 
     # TODO(Philip): Harcoding for now, need to make this generic
     def get_xpath(self):
-        xpath = '/rw-project:project/nsd:nsd-catalog/nsd:nsd/nsd:' + self.name
+        xpath = '/rw-project:project/project-nsd:nsd-catalog/project-nsd:nsd/nsd:' + self.name
         return xpath
 
     def get_dict_output(self):
index edcbef6..5300eba 100644 (file)
@@ -24,11 +24,11 @@ from rift.mano.tosca_translator.common.utils import dict_convert_values_to_str
 try:
     import gi
     gi.require_version('RwYang', '1.0')
-    gi.require_version('RwNsdYang', '1.0')
-    gi.require_version('NsdYang', '1.0')
+    gi.require_version('RwProjectNsdYang', '1.0')
+    gi.require_version('ProjectNsdYang', '1.0')
 
-    from gi.repository import NsdYang
-    from gi.repository import RwNsdYang
+    from gi.repository import ProjectNsdYang as NsdYang
+    from gi.repository import RwProjectNsdYang as RwNsdYang
     from gi.repository import RwYang
 except ImportError:
     pass
index 6356601..29beca1 100644 (file)
@@ -23,9 +23,9 @@ from toscaparser.common.exception import ValidationError
 
 try:
     import gi
-    gi.require_version('RwVnfdYang', '1.0')
+    gi.require_version('RwProjectVnfdYang', '1.0')
 
-    from gi.repository import RwVnfdYang
+    from gi.repository import RwProjectVnfdYang as RwVnfdYang
 except ImportError:
     pass
 except ValueError:
index 637c0ca..65d7654 100644 (file)
@@ -183,7 +183,7 @@ class ManoProject(object):
         if idx == 0:
             name = cls.from_xpath(xpath, log)
             if name == project:
-                log.warning("Project already in the XPATH: {}".format(xpath))
+                log.debug("Project already in the XPATH: {}".format(xpath))
                 return xpath
 
             else:
index 41845dc..8ed4daa 100644 (file)
@@ -73,7 +73,7 @@ class YangNsd(ToscaResource):
                 self.inputs.append({
                     self.NAME:
                     self.map_yang_name_to_tosca(
-                        val.replace('/rw-project:project/nsd:nsd-catalog/nsd:nsd/nsd:', ''))})
+                        val.replace('/rw-project:project/project-nsd:nsd-catalog/project-nsd:nsd/nsd:', ''))})
             if len(param):
                 self.log.warn(_("{0}, Did not process the following for "
                                 "input param {1}: {2}").
index 8287c11..020a2b4 100644 (file)
@@ -31,11 +31,11 @@ import yaml
 from rift.mano.config_data import config
 
 import gi
-gi.require_version('VnfdYang', '1.0')
+gi.require_version('ProjectVnfdYang', '1.0')
 gi.require_version('RwYang', '1.0')
 
 from gi.repository import (
-        VnfdYang,
+        ProjectVnfdYang,
         RwYang,
         )
 
index 1bc531e..01f627c 100644 (file)
@@ -134,7 +134,7 @@ class TestCase(unittest.TestCase):
             1. Instance of project from xpath
             2. project name in instance is correct
         """
-        xpath = XPATH + '/rw:project/rw-project:project/rw-project:project/rw-project:project/rw-project:project/nsd:nsd-catalog/nsd:nsd[id=\'1232334\']'
+        xpath = XPATH + '/rw:project/rw-project:project/rw-project:project/rw-project:project/rw-project:project/project-nsd:nsd-catalog/project-nsd:nsd[id=\'1232334\']'
         proj = project.ManoProject.create_from_xpath(xpath, TestCase.log)
         assert proj
         assert NAME == proj.name
index 7c052f0..1feb5de 100755 (executable)
@@ -25,10 +25,10 @@ import xml.etree.ElementTree as etree
 
 from gi.repository import (
     RwYang,
-    NsdYang,
-    RwNsdYang,
-    VnfdYang,
-    RwVnfdYang,
+    ProjectNsdYang as NsdYang,
+    RwProjectNsdYang as RwNsdYang,
+    ProjectVnfdYang as VnfdYang,
+    RwProjectVnfdYang as RwVnfdYang,
     VldYang,
     RwVldYang
 )
index 50204f9..dae1c3b 100755 (executable)
@@ -1,7 +1,7 @@
 #!/usr/bin/env python3
 
-# 
-#   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.
@@ -25,7 +25,14 @@ import sys
 import gi
 gi.require_version('RwYang', '1.0')
 
-from gi.repository import NsdYang, VldYang, VnfdYang, RwYang
+# TODO (Philip): Relook at this code
+
+from gi.repository import (
+    NsdYang,
+    VldYang,
+    VnfdYang,
+    RwYang
+    )
 
 logging.basicConfig(level=logging.DEBUG)
 logger = logging.getLogger(__name__)
@@ -49,7 +56,7 @@ def configure_vld(proxy, vld_xml_hdl):
 def configure_vnfd(proxy, vnfd_xml_hdl):
     vnfd_xml = vnfd_xml_hdl.read()
     logger.debug("Attempting to deserialize XML into VNFD protobuf: %s", vnfd_xml)
-    vnfd = VnfdYang.YangData_RwProject_Project_VnfdCatalog_Vnfd()
+    vnfd = VnfdYang.YangData_VnfdCatalog_Vnfd()
     vnfd.from_xml_v2(model, vnfd_xml)
 
     logger.debug("Sending VNFD to netconf: %s", vnfd)
@@ -59,7 +66,7 @@ def configure_vnfd(proxy, vnfd_xml_hdl):
 def configure_nsd(proxy, nsd_xml_hdl):
     nsd_xml = nsd_xml_hdl.read()
     logger.debug("Attempting to deserialize XML into NSD protobuf: %s", nsd_xml)
-    nsd = NsdYang.YangData_RwProject_Project_NsdCatalog_Nsd()
+    nsd = NsdYang.YangData_NsdCatalog_Nsd()
     nsd.from_xml_v2(model, nsd_xml)
 
     logger.debug("Sending NSD to netconf: %s", nsd)
@@ -86,7 +93,9 @@ def parse_args(argv=sys.argv[1:]):
             action="append",
             default=[],
             type=argparse.FileType(),
-            help="VLD XML File Path",
+            #help="VLD XML File Path",
+            # We do not support uploading VLD separately
+            help=argparse.SUPRESS,
             )
 
     parser.add_argument(
index e852b21..d254cff 100755 (executable)
@@ -29,20 +29,17 @@ from xml.dom.minidom import parseString
 
 import gi
 gi.require_version('RwYang', '1.0')
-gi.require_version('RwProjectYang', '1.0')
 gi.require_version('RwVnfdYang', '1.0')
 gi.require_version('VnfdYang', '1.0')
+gi.require_version('RwVnfdYang', '1.0')
 gi.require_version('RwNsdYang', '1.0')
-gi.require_version('NsdYang', '1.0')
-
 
 from gi.repository import (
-    RwNsdYang,
-    NsdYang,
-    RwVnfdYang,
-    VnfdYang,
+    RwNsdYang as RwNsdYang,
+    NsdYang as NsdYang,
+    RwVnfdYang as RwVnfdYang,
+    VnfdYang as VnfdYang,
     RwYang,
-    RwProjectYang,
 )
 
 
@@ -101,31 +98,15 @@ class ManoDescriptor(object):
         for module in module_list:
             model.load_module(module)
 
-        # Need to extract the catalog part to dump as descriptor
-        if output_format in ['json', 'yaml']:
-            # Convert to yaml instead of directly using as_dict as
-            # this adds the namespaces correctly
-            ya = self.descriptor.to_yaml(model)
-            proj = yaml.load(ya)
-            desc = proj['rw-project:project'][0]
-
-            if output_format == 'json':
-                with open('%s/%s.json' % (outdir, self.name), "w") as fh:
-                    fh.write(simplejson.dumps(desc, indent=4))
-            elif output_format == 'yaml':
-                with open('%s/%s.yaml' % (outdir, self.name), "w") as fh:
-                    fh.write(yaml.dump(desc, default_flow_style=False))
-        elif output_format == 'xml':
-            # Converting from dict to xml does not provide the
-            # required output. So using the PBCM to_xml and then
-            # printing only from the catalog tag.
+        if output_format == 'json':
+            with open('%s/%s.json' % (outdir, self.name), "w") as fh:
+                fh.write(self.descriptor.to_json(model))
+        elif output_format.strip() == 'xml':
             with open('%s/%s.xml' % (outdir, self.name), "w") as fh:
-                proj = self.descriptor.to_xml_v2(model)
-                dom = parseString(proj)
-                desc = dom.getElementsByTagName("vnfd:vnfd-catalog")
-                if not desc:
-                    desc = dom.getElementsByTagName("nsd:nsd-catalog")
-                fh.write(desc[0].toprettyxml())
+                fh.write(self.descriptor.to_xml_v2(model))
+        elif output_format.strip() == 'yaml':
+            with open('%s/%s.yaml' % (outdir, self.name), "w") as fh:
+                fh.write(self.descriptor.to_yaml(model))
         else:
             raise Exception("Invalid output format for the descriptor")
 
@@ -151,7 +132,7 @@ class VirtualNetworkFunction(ManoDescriptor):
     def compose(self, image_name, cloud_init="", cloud_init_file="", endpoint=None, mon_params=[],
                 mon_port=8888, mgmt_port=8888, num_vlr_count=1, num_ivlr_count=1,
                 num_vms=1, image_md5sum=None, mano_ut=False):
-        self.descriptor = RwVnfdYang.YangData_RwProject_Project_VnfdCatalog()
+        self.descriptor = RwVnfdYang.YangData_Vnfd_VnfdCatalog()
         self.id = str(uuid.uuid1())
         vnfd = self.descriptor.vnfd.add()
         vnfd.id = self.id
@@ -181,14 +162,14 @@ class VirtualNetworkFunction(ManoDescriptor):
             cp.name = '%s/cp%d' % (self.name, i)
 
         if endpoint is not None:
-            endp = VnfdYang.YangData_RwProject_Project_VnfdCatalog_Vnfd_HttpEndpoint(
+            endp = VnfdYang.YangData_Vnfd_VnfdCatalog_Vnfd_HttpEndpoint(
                     path=endpoint, port=mon_port, polling_interval_secs=2
                     )
             vnfd.http_endpoint.append(endp)
 
         # Monitoring params
         for monp_dict in mon_params:
-            monp = VnfdYang.YangData_RwProject_Project_VnfdCatalog_Vnfd_MonitoringParam.from_dict(monp_dict)
+            monp = VnfdYang.YangData_Vnfd_VnfdCatalog_Vnfd_MonitoringParam.from_dict(monp_dict)
             monp.http_endpoint_ref = endpoint
             vnfd.monitoring_param.append(monp)
 
@@ -324,7 +305,7 @@ class VirtualNetworkFunction(ManoDescriptor):
         dirpath = "%s/%s" % (outdir, self.name)
         if not os.path.exists(dirpath):
             os.makedirs(dirpath)
-        super(VirtualNetworkFunction, self).write_to_file(['rw-project', 'vnfd', 'rw-vnfd'],
+        super(VirtualNetworkFunction, self).write_to_file(['vnfd', 'rw-vnfd'],
                                                           dirpath,
                                                           output_format)
         self.add_scripts(outdir)
@@ -655,7 +636,7 @@ exit 0
         self._placement_groups.append(placement_group)
 
     def create_mon_params(self, vnfds):
-        NsdMonParam = NsdYang.YangData_RwProject_Project_NsdCatalog_Nsd_MonitoringParam
+        NsdMonParam = NsdYang.YangData_Nsd_NsdCatalog_Nsd_MonitoringParam
         param_id = 1
         for vnfd_obj in vnfds:
             for mon_param in vnfd_obj.vnfd.monitoring_param:
@@ -684,7 +665,7 @@ exit 0
             use_ns_init_conf = False
             use_vnf_init_conf = False
 
-        self.descriptor = RwNsdYang.YangData_RwProject_Project_NsdCatalog()
+        self.descriptor = RwNsdYang.YangData_Nsd_NsdCatalog()
         self.id = str(uuid.uuid1())
         nsd = self.descriptor.nsd.add()
         self.nsd = nsd
@@ -696,8 +677,8 @@ exit 0
         nsd.description = 'Toy NS'
         nsd.version = '1.0'
         nsd.input_parameter_xpath.append(
-                NsdYang.YangData_RwProject_Project_NsdCatalog_Nsd_InputParameterXpath(
-                    xpath="/nsd:nsd-catalog/nsd:nsd/nsd:vendor",
+                NsdYang.YangData_Nsd_NsdCatalog_Nsd_InputParameterXpath(
+                    xpath="/nsd-catalog/nsd/vendor",
                     )
                 )
 
@@ -722,7 +703,7 @@ exit 0
             vld.ip_profile_ref = 'InterVNFLink'
             for cp in cpgroup:
                 cpref = vld.vnfd_connection_point_ref.add()
-                cpref.member_vnf_index_ref = str(cp[0])
+                cpref.member_vnf_index_ref = cp[0]
                 cpref.vnfd_id_ref = cp[1]
                 cpref.vnfd_connection_point_ref = cp[2]
 
@@ -778,7 +759,7 @@ exit 0
             for member_vnfd in placement_group.vnfd_list:
                 member = group.member_vnfd.add()
                 member.vnfd_id_ref = member_vnfd.descriptor.vnfd[0].id
-                member.member_vnf_index_ref = str(vnfd_index_map[member_vnfd])
+                member.member_vnf_index_ref = vnfd_index_map[member_vnfd]
 
         # self.create_mon_params(vnfd_list)
 
@@ -823,7 +804,7 @@ exit 0
         if not os.path.exists(dirpath):
             os.makedirs(dirpath)
 
-        super(NetworkService, self).write_to_file(["rw-project", "nsd", "rw-nsd"],
+        super(NetworkService, self).write_to_file(["nsd", "rw-nsd"],
                                                   dirpath,
                                                   output_format)
 
index 8a308e6..4325ea0 100755 (executable)
@@ -27,13 +27,13 @@ import yaml
 
 import gi
 gi.require_version('RwYang', '1.0')
-gi.require_version('RwVnfdYang', '1.0')
-gi.require_version('RwNsdYang', '1.0')
+gi.require_version('RwProjectVnfdYang', '1.0')
+gi.require_version('RwProjectNsdYang', '1.0')
 
 from gi.repository import (
     RwYang,
-    RwVnfdYang,
-    RwNsdYang,
+    RwProjectVnfdYang as RwVnfdYang,
+    RwProjectNsdYang as RwNsdYang,
     )
 
 import rift.package.store
index 88c549b..750115c 100755 (executable)
@@ -28,13 +28,13 @@ import yaml
 
 import gi
 gi.require_version('RwYang', '1.0')
-gi.require_version('RwVnfdYang', '1.0')
-gi.require_version('RwNsdYang', '1.0')
+gi.require_version('RwProjectVnfdYang', '1.0')
+gi.require_version('RwProjectNsdYang', '1.0')
 gi.require_version('RwProjectYang', '1.0')
 from gi.repository import (
     RwYang,
-    RwVnfdYang,
-    RwNsdYang,
+    RwProjectVnfdYang as RwVnfdYang,
+    RwProjectNsdYang as RwNsdYang,
     RwProjectYang,
     )
 
@@ -169,7 +169,7 @@ class RiftNS(RiftManoDescriptor):
                         if topo_node['type'] == 'VNF':
                             cpref = vld.vnfd_connection_point_ref.add()
                             cpref.from_dict(dict(
-                                member_vnf_index_ref=str(vnf_member_index_dict[node_key]),
+                                member_vnf_index_ref=vnf_member_index_dict[node_key],
                                 vnfd_id_ref=self.get_vnfd_id(vnf_list, topo_node['VNF model']),
                                 #vnfd_id_ref=topo_node['VNF model'],
                                 vnfd_connection_point_ref=node[node_key],
@@ -469,8 +469,9 @@ def main(argv=sys.argv[1:]):
     vnf_list = create_vnfs_from_yaml_files(args.yaml_file_hdls)
     ns_list = create_ns_from_yaml_files(args.yaml_file_hdls, vnf_list)
 
+    # TODO (Philip): Relook at the model generation
     writer = DescriptorFileWriter(
-        module_list=['rw-project', 'nsd', 'rw-nsd', 'vnfd', 'rw-vnfd'],
+        module_list=['rw-project', 'project-nsd', 'rw-project-nsd', 'project-vnfd', 'rw-project-vnfd'],
         output_dir=args.outdir,
         output_format=args.format,
         )
index 827ec2b..580e556 100644 (file)
@@ -22,13 +22,17 @@ set(source_yang_files
   ietf-l2-topology.yang
   ietf-network-topology.yang
   ietf-network.yang
+  nsd-base.yang rw-nsd-base.yang
   nsd.yang rw-nsd.yang
+  project-nsd.yang rw-project-nsd.yang
   nsr.yang rw-nsr.yang
   pnfd.yang
   rw-topology.yang
   vld.yang rw-vld.yang
   vlr.yang rw-vlr.yang
+  vnfd-base.yang rw-vnfd-base.yang
   vnfd.yang rw-vnfd.yang
+  project-vnfd.yang rw-project-vnfd.yang
   vnfr.yang rw-vnfr.yang
   vnffgd.yang
   )
diff --git a/models/plugins/yang/nsd-base.yang b/models/plugins/yang/nsd-base.yang
new file mode 100644 (file)
index 0000000..70cacda
--- /dev/null
@@ -0,0 +1,791 @@
+
+/*
+ * 
+ *   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;
+
+    uses manotypes:ns-service-primitive;
+
+    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;
+  }
+}
index 2b48ee7..1b62881 100644 (file)
@@ -23,763 +23,65 @@ 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 mano-types {
-    prefix "manotypes";
-  }
-
-  import rw-project {
-    prefix "rw-project";
-  }
-
-  revision 2017-02-08 {
-    description
-      "Update model to support projects.";
-  }
-
-  revision 2014-10-27 {
-    description
-      "Initial revision. This YANG file defines
-       the Network Service Descriptor (NSD)";
-    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;
-
-    uses manotypes:ns-service-primitive;
-
-    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;
-        }
-      }
-    }
+  import vnfd {
+    prefix "vnfd";
   }
 
-  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;
-    }
+  import nsd-base {
+    prefix "nsd-base";
+  }
 
-    leaf version {
-      description "Version of the VLD";
-      type string;
-    }
+  import mano-types {
+    prefix "manotypes";
+  }
 
-    leaf type {
-      type manotypes:virtual-link-type;
-    }
+  revision 2017-02-28 {
+    description
+      "Update model to support projects.";
+  }
 
-    leaf root-bandwidth {
-      description
-        "For ELAN this is the aggregate bandwidth.";
-      type uint64;
-    }
+  revision 2014-10-27 {
+    description
+      "Initial revision. This YANG file defines
+       the Network Service Descriptor (NSD)";
+    reference
+      "Derived from earlier versions of base YANG files";
+  }
 
-    leaf leaf-bandwidth {
+  grouping nsd-constituent-vnfd {
+    list constituent-vnfd {
       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;
-    }
+          "List of VNFDs that are part of this
+          network service.";
 
-    choice init-params {
-      description "Extra parameters for VLD instantiation";
+      key "member-vnf-index";
 
-      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;
-        }
+      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;
       }
 
-      case vim-network-profile {
-        leaf ip-profile-ref {
-          description "Named reference to IP-profile object";
-          type string;
+      leaf vnfd-id-ref {
+        description
+          "Identifier for the VNFD.";
+        type leafref {
+          path "/vnfd:vnfd-catalog/vnfd:vnfd/vnfd:id";
         }
       }
 
+      leaf start-by-default {
+        description
+          "VNFD is started as part of the NS instantiation";
+        type boolean;
+        default true;
+      }
     }
   }
 
@@ -788,7 +90,7 @@ module nsd
 
       key "id";
 
-      uses nsd-vld-common;
+      uses nsd-base:nsd-vld-common;
 
       list vnfd-connection-point-ref {
         description
@@ -806,9 +108,9 @@ module nsd
           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
+                   ../../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.
@@ -820,7 +122,7 @@ module nsd
         leaf vnfd-connection-point-ref {
           description "A reference to a connection point name";
           type leafref {
-            path "../../../../../vnfd:vnfd-catalog/vnfd:vnfd" +
+            path "/vnfd:vnfd-catalog/vnfd:vnfd" +
                  "[vnfd:id = current()/../vnfd-id-ref]/" +
                  "vnfd:connection-point/vnfd:name";
           }
@@ -829,120 +131,22 @@ module nsd
     }
   }
 
-  grouping nsr-nsd-vld {
-    list vld {
-
-      key "id";
-
-      uses 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): Fix this
-          // 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:
-                   ../../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";
-          // TODO (Philip): Fix this
-          // type leafref {
-          //   path "../../../../../../vnfd:vnfd-catalog/vnfd:vnfd" +
-          //        "[vnfd:id = current()/../vnfd-id-ref]/" +
-          //        "vnfd:connection-point/vnfd:name";
-          // }
-          type string;
-        }
-      }
-    }
-  }
-
-  grouping nsd-constituent-vnfd {
-    list constituent-vnfd {
+  grouping nsd-vnf-dependency {
+    list vnf-dependency {
       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.";
+          "List of VNF dependencies.";
+      key vnf-source-ref;
+      leaf vnf-source-ref {
         type leafref {
-          path "../../../../vnfd:vnfd-catalog/vnfd:vnfd/vnfd:id";
+          path "/vnfd:vnfd-catalog/vnfd:vnfd/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.";
-        // TODO (Philip): Fix this
-        // type leafref {
-        //   path "../../../../../vnfd:vnfd-catalog/vnfd:vnfd/vnfd:id";
-        // }
-        type string;
-      }
-
-      leaf start-by-default {
+      leaf vnf-depends-on-ref {
         description
-          "VNFD is started as part of the NS instantiation";
-        type boolean;
-        default true;
+            "Reference to VNF that sorce VNF depends.";
+        type leafref {
+          path "/vnfd:vnfd-catalog/vnfd:vnfd/vnfd:id";
+        }
       }
     }
   }
@@ -971,156 +175,19 @@ module nsd
           description
               "Identifier for the VNFD.";
           type leafref {
-            path "../../../../../vnfd:vnfd-catalog/vnfd:vnfd/vnfd:id";
+            path "/vnfd:vnfd-catalog/vnfd:vnfd/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): Fix this
-          // type leafref {
-          //   path "../../../constituent-vnfd/member-vnf-index";
-          // }
-          type uint64;
-        }
-
-        leaf vnfd-id-ref {
-          description
-              "Identifier for the VNFD.";
-          // TODO (Philip): Fix this
-          // type leafref {
-          //   path "../../../../../../vnfd:vnfd-catalog/vnfd:vnfd/vnfd:id";
-          // }
-          type string;
-        }
-      }
-    }
-  }
-
-  grouping nsd-vnf-dependency {
-    list vnf-dependency {
-      description
-          "List of VNF dependencies.";
-      key vnf-source-ref;
-      leaf vnf-source-ref {
-        type leafref {
-          path "../../../../vnfd:vnfd-catalog/vnfd:vnfd/vnfd:id";
-        }
-      }
-      leaf vnf-depends-on-ref {
-        description
-            "Reference to VNF that sorce VNF depends.";
-        type leafref {
-          path "../../../../vnfd:vnfd-catalog/vnfd:vnfd/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 "../../../../../vnfd:vnfd-catalog/vnfd:vnfd/vnfd:id";
-        }
-      }
-      leaf vnf-depends-on-ref {
-        description
-            "Reference to VNF that sorce VNF depends.";
-        type leafref {
-          path "../../../../../vnfd:vnfd-catalog/vnfd:vnfd/vnfd:id";
-        }
-      }
-    }
-  }
-
-  grouping monitoring-param-common {
-    // list monitoring-param {
-    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;
-  }
-
   grouping nsd-monitoring-param {
 
     list monitoring-param {
-      key "id";
-
-      uses 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 "../../../../../vnfd:vnfd-catalog/vnfd:vnfd"
-              + "[vnfd:id = current()/../vnfd-id-ref]"
-              + "/vnfd:monitoring-param/vnfd:id";
-          }
-        }
-
-        leaf-list member-vnf-index-ref {
-          description
-            "Optional reference to member-vnf within constituent-vnfds";
-          type uint64;
-        }
-      }
-    }
-  }
-
-  grouping nsr-nsd-monitoring-param {
-    list monitoring-param {
-      key "id";
+      key id;
 
-      uses monitoring-param-common;
+      uses nsd-base:monitoring-param-common;
 
       list vnfd-monitoring-param {
         description "A list of VNFD monitoring params";
@@ -1145,7 +212,7 @@ module nsd
         leaf vnfd-monitoring-param-ref {
           description "A reference to the VNFD monitoring param";
           type leafref {
-            path "../../../../../../vnfd:vnfd-catalog/vnfd:vnfd"
+            path "/vnfd:vnfd-catalog/vnfd:vnfd"
               + "[vnfd:id = current()/../vnfd-id-ref]"
               + "/vnfd:monitoring-param/vnfd:id";
           }
@@ -1160,25 +227,22 @@ module nsd
     }
   }
 
+  container nsd-catalog {
 
-  augment "/rw-project:project" {
-    container nsd-catalog {
+    list nsd {
+      key id;
 
-      list nsd {
-        key "id";
+      uses nsd-base:nsd-descriptor-common;
 
-        uses nsd-descriptor-common;
+      uses nsd-vld;
 
-        uses nsd-vld;
+      uses nsd-constituent-vnfd;
 
-        uses nsd-constituent-vnfd;
+      uses nsd-placement-groups;
 
-        uses nsd-placement-groups;
+      uses nsd-vnf-dependency;
 
-        uses nsd-vnf-dependency;
-
-        uses nsd-monitoring-param;
-      }
+      uses nsd-monitoring-param;
     }
   }
 }
index 0917928..136b62b 100644 (file)
@@ -35,12 +35,16 @@ module nsr
     prefix "vld";
   }
 
-  import nsd {
-    prefix "nsd";
+  import nsd-base {
+    prefix "nsd-base";
   }
 
-  import vnfd {
-    prefix "vnfd";
+  import project-nsd {
+    prefix "project-nsd";
+  }
+
+  import project-vnfd {
+    prefix "project-vnfd";
   }
 
   import vnfr {
@@ -154,17 +158,17 @@ module nsr
         container nsd {
           description "NS descriptor used to instantiate this NS";
 
-          uses nsd:nsd-descriptor-common;
+          uses nsd-base:nsd-descriptor-common;
 
-          uses nsd:nsr-nsd-vld;
+          uses project-nsd:nsr-nsd-vld;
 
-          uses nsd:nsr-nsd-constituent-vnfd;
+          uses project-nsd:nsr-nsd-constituent-vnfd;
 
-          uses nsd:nsr-nsd-placement-groups;
+          uses project-nsd:nsr-nsd-placement-groups;
 
-          uses nsd:nsr-nsd-vnf-dependency;
+          uses project-nsd:nsr-nsd-vnf-dependency;
 
-          uses nsd:nsr-nsd-monitoring-param;
+          uses project-nsd:nsr-nsd-monitoring-param;
         }
 
         uses ns-instance-config-params;
@@ -225,9 +229,9 @@ module nsr
         description
           "A reference to a vnfd. This is a
           leafref to path:
-          ../../../../nsd:constituent-vnfd
+          ../../../../project-nsd:constituent-vnfd
           + [id = current()/../id-ref]
-          + /nsd:vnfd-id-ref
+          + /project-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.
@@ -240,8 +244,8 @@ module nsr
         description
           "A reference to VNFD placement group";
         type leafref {
-          path "../../../../vnfd:vnfd-catalog/vnfd:vnfd[vnfd:id = " +
-            "current()/../vnfd-id-ref]/vnfd:placement-groups/vnfd:name";
+          path "../../../../project-vnfd:vnfd-catalog/project-vnfd:vnfd[project-vnfd:id = " +
+            "current()/../vnfd-id-ref]/project-vnfd:placement-groups/project-vnfd:name";
         }
       }
 
@@ -900,9 +904,9 @@ module nsr
                        that produced this result";
             // TODO: Fix leafref
             type leafref {
-              path "../../../../nsd:nsd-catalog/nsd:nsd" +
-                "[nsd:id = current()/../../nsd-ref]" +
-                "/nsd:monitoring-param/nsd:id";
+              path "../../../../project-nsd:nsd-catalog/project-nsd:nsd" +
+                "[project-nsd:id = current()/../../nsd-ref]" +
+                "/project-nsd:monitoring-param/project-nsd:id";
             }
           }
 
@@ -1120,9 +1124,9 @@ module nsr
           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
+                   ../../../../project-nsd:constituent-vnfd
+                   + [project-nsd:id = current()/../project-nsd:id-ref]
+                   + /project-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.
@@ -1414,9 +1418,9 @@ module nsr
           description
             "A reference to a vnfd. This is a
           leafref to path:
-          ../../../../nsd:constituent-vnfd
-          + [id = current()/../nsd:id-ref]
-          + /nsd:vnfd-id-ref
+          ../../../../project-nsd:constituent-vnfd
+          + [id = current()/../project-nsd:id-ref]
+          + /project-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.
@@ -1430,8 +1434,8 @@ module nsr
             "A reference to VNFD placement group";
           type leafref {
             path "/rw-project:project[rw-project:name=current()/" +
-              "../../project-name]/vnfd:vnfd-catalog/vnfd:vnfd[vnfd:id = " +
-              "current()/../vnfd-id-ref]/vnfd:placement-groups/vnfd:name";
+              "../../project-name]/project-vnfd:vnfd-catalog/project-vnfd:vnfd[project-vnfd:id = " +
+              "current()/../vnfd-id-ref]/project-vnfd:placement-groups/project-vnfd:name";
           }
         }
 
diff --git a/models/plugins/yang/project-nsd.yang b/models/plugins/yang/project-nsd.yang
new file mode 100644 (file)
index 0000000..e2be49d
--- /dev/null
@@ -0,0 +1,437 @@
+
+/*
+ * 
+ *   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-list member-vnf-index-ref {
+          description
+            "Optional reference to member-vnf within constituent-vnfds";
+          type uint64;
+        }
+      }
+    }
+  }
+
+  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-list member-vnf-index-ref {
+          description
+            "Optional reference to member-vnf within constituent-vnfds";
+          type uint64;
+        }
+      }
+    }
+  }
+
+  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;
+  }
+
+  augment "/rw-project:project" {
+    container nsd-catalog {
+
+      list nsd {
+        key id;
+
+        uses nsd-descriptor;
+      }
+    }
+  }
+}
diff --git a/models/plugins/yang/project-vnfd.yang b/models/plugins/yang/project-vnfd.yang
new file mode 100644 (file)
index 0000000..5342436
--- /dev/null
@@ -0,0 +1,57 @@
+
+/*
+ * 
+ *   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-vnfd
+{
+  namespace "http://riftio.com/ns/riftware-1.0/project-vnfd";
+  prefix "project-vnfd";
+
+  import rw-project {
+    prefix "rw-project";
+  }
+
+  import vnfd-base {
+    prefix "vnfd-base";
+  }
+
+  revision 2017-02-28 {
+    description
+      "Initial revision. This YANG file defines
+       the Virtual Network Function (VNF) descriptor
+       under a project";
+    reference
+      "Derived from earlier versions of base YANG files";
+  }
+
+  augment /rw-project:project {
+    container vnfd-catalog {
+      description
+        "Virtual Network Function Descriptor (VNFD).";
+
+      list vnfd {
+        key "id";
+
+        uses vnfd-base:vnfd-descriptor;
+      }
+    }
+  }
+}
+
+// vim: sw=2
diff --git a/models/plugins/yang/rw-nsd-base.yang b/models/plugins/yang/rw-nsd-base.yang
new file mode 100644 (file)
index 0000000..bed366d
--- /dev/null
@@ -0,0 +1,49 @@
+
+/*
+ * 
+ *   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.
+ *   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 rw-nsd-base
+{
+  namespace "http://riftio.com/ns/riftware-1.0/rw-nsd-base";
+  prefix "rw-nsd-base";
+
+  import mano-types {
+    prefix "manotypes";
+  }
+
+  revision 2017-02-28 {
+    description
+      "Initial revision. This YANG file defines
+       grouping to extend the base MANO NSD";
+    reference
+      "Derived from earlier versions of base YANG files";
+  }
+
+  grouping rw-nsd-ext {
+    uses manotypes:control-param;
+    uses manotypes:action-param;
+    leaf meta {
+      description
+        "Any meta-data needed by the UI";
+      type string;
+    }
+  }
+}
+
+// vim: sw=2
index 73aab73..d59168d 100644 (file)
@@ -23,23 +23,15 @@ module rw-nsd
   namespace "http://riftio.com/ns/riftware-1.0/rw-nsd";
   prefix "rw-nsd";
 
-  import nsd {
-    prefix "nsd";
-  }
-
-  import ietf-yang-types {
-    prefix "yang";
+  import rw-nsd-base {
+    prefix "rw-nsd-base";
   }
 
-  import mano-types {
-    prefix "manotypes";
-  }
-
-  import rw-project {
-    prefix "rw-project";
+  import nsd {
+    prefix "nsd";
   }
 
-  revision 2017-02-08 {
+  revision 2017-02-28 {
     description
       "Update model to support projects.";
   }
@@ -52,14 +44,8 @@ module rw-nsd
       "Derived from earlier versions of base YANG files";
   }
 
-  augment /rw-project:project/nsd:nsd-catalog/nsd:nsd {
-    uses manotypes:control-param;
-    uses manotypes:action-param;
-    leaf meta {
-      description
-        "Any meta-data needed by the UI";
-      type string;
-    }
+  augment /nsd:nsd-catalog/nsd:nsd {
+    uses rw-nsd-base:rw-nsd-ext;
   }
 }
 
index b77af37..16bd411 100644 (file)
@@ -31,8 +31,8 @@ module rw-nsr
     prefix "nsr";
   }
 
-  import nsd {
-    prefix "nsd";
+  import project-nsd {
+    prefix "project-nsd";
   }
 
   import rw-cloud {
@@ -112,7 +112,7 @@ module rw-nsr
       leaf nsd-id-ref {
         description "Reference to NSD";
         type leafref {
-          path "../../../nsd:nsd-catalog/nsd:nsd/nsd:id";
+          path "../../../project-nsd:nsd-catalog/project-nsd:nsd/project-nsd:id";
         }
       }
       leaf instance-ref-count {
diff --git a/models/plugins/yang/rw-project-nsd.yang b/models/plugins/yang/rw-project-nsd.yang
new file mode 100644 (file)
index 0000000..2e03385
--- /dev/null
@@ -0,0 +1,51 @@
+
+/*
+ * 
+ *   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 rw-project-nsd
+{
+  namespace "http://riftio.com/ns/riftware-1.0/rw-project-nsd";
+  prefix "rw-project-nsd";
+
+  import rw-nsd-base {
+    prefix "rw-nsd-base";
+  }
+
+  import project-nsd {
+    prefix "nsd";
+  }
+
+  import rw-project {
+    prefix "rw-project";
+  }
+
+  revision 2017-02-28 {
+    description
+      "Initial revision. This YANG file augments
+       the base MANO NSD";
+    reference
+      "Derived from earlier versions of base YANG files";
+  }
+
+  augment /rw-project:project/nsd:nsd-catalog/nsd:nsd {
+    uses rw-nsd-base:rw-nsd-ext;
+  }
+}
+
+// vim: sw=2
diff --git a/models/plugins/yang/rw-project-vnfd.yang b/models/plugins/yang/rw-project-vnfd.yang
new file mode 100644 (file)
index 0000000..766f525
--- /dev/null
@@ -0,0 +1,54 @@
+
+/*
+ * 
+ *   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.
+ *   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 rw-project-vnfd
+{
+  namespace "http://riftio.com/ns/riftware-1.0/rw-project-vnfd";
+  prefix "rw-project-vnfd";
+
+  import project-vnfd {
+    prefix "project-vnfd";
+  }
+
+  import rw-vnfd-base {
+    prefix "rw-vnfd-base";
+  }
+
+  import rw-project {
+    prefix "rw-project";
+  }
+
+  revision 2017-02-28 {
+    description
+      "Initial revision. This YANG file augments
+       the base MANO VNFD";
+    reference
+      "Derived from earlier versions of base YANG files";
+  }
+
+  augment /rw-project:project/project-vnfd:vnfd-catalog/project-vnfd:vnfd {
+    uses rw-vnfd-base:rw-vnfd-ext;
+  }
+
+  augment /rw-project:project/project-vnfd:vnfd-catalog/project-vnfd:vnfd/project-vnfd:vdu {
+    uses rw-vnfd-base:vcs-component-ref;
+  }
+}
+// vim: sw=2
diff --git a/models/plugins/yang/rw-vnfd-base.yang b/models/plugins/yang/rw-vnfd-base.yang
new file mode 100644 (file)
index 0000000..ec39ef1
--- /dev/null
@@ -0,0 +1,119 @@
+
+/*
+ * 
+ *   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.
+ *   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 rw-vnfd-base
+{
+  namespace "http://riftio.com/ns/riftware-1.0/rw-vnfd-base";
+  prefix "rw-vnfd-base";
+
+  import vnfd {
+    prefix "vnfd";
+  }
+
+  import rwvcs-types {
+    prefix "rwvcstypes";
+  }
+
+  import rw-pb-ext { prefix "rwpb"; }
+
+  import ietf-yang-types {
+    prefix "yang";
+  }
+
+  import mano-types {
+    prefix "manotypes";
+  }
+
+  revision 2017-02-28 {
+    description
+      "Initial revision. This YANG file defines
+       common structs for extending MANO VNFD";
+    reference
+      "Derived from earlier versions of base YANG files";
+  }
+
+  grouping rw-vnfd-ext {
+    uses manotypes:control-param;
+    uses manotypes:action-param;
+
+    leaf meta {
+      description
+        "Any meta-data needed by the UI";
+      type string;
+    }
+
+    list component {
+      description
+          "This section defines the RIFT.ware
+           virtual components";
+      key "component-name";
+      rwpb:msg-new VcsComponent;
+      rwpb:application-request-point;
+
+      leaf component-name {
+        description "";
+        type string;
+      }
+
+      leaf component-type {
+        description "";
+        type rwvcstypes:component_type;
+        mandatory true;
+      }
+
+      choice component {
+        case rwvcs-rwcollection {
+          uses rwvcstypes:rwvcs-rwcollection;
+        }
+        case rwvcs-rwvm {
+          uses rwvcstypes:rwvcs-rwvm;
+        }
+        case rwvcs-rwproc {
+          uses rwvcstypes:rwvcs-rwproc;
+        }
+        case native-proc {
+          uses rwvcstypes:native-proc;
+        }
+        case rwvcs-rwtasklet {
+          uses rwvcstypes:rwvcs-rwtasklet;
+        }
+      }
+    } // list component
+  }
+
+  grouping vcs-component-ref {
+    leaf vcs-component-ref {
+      description
+          "This defines the software components using the
+           RIFT.ware Virtual Component System (VCS). This
+           also allows specifying a state machine during
+           the VM startup.
+           NOTE: This is an significant addition to MANO,
+           since MANO doesn't clearly specify a method to
+           identify various software components in a VM.
+           Also using a state machine is not something that
+           is well described in MANO.";
+      type leafref {
+        path "../../component/component-name";
+      }
+    }
+  }
+}
+// vim: sw=2
index 7e2e8e7..e7fca3b 100644 (file)
@@ -27,25 +27,11 @@ module rw-vnfd
     prefix "vnfd";
   }
 
-  import rwvcs-types {
-    prefix "rwvcstypes";
+  import rw-vnfd-base {
+    prefix "rw-vnfd-base";
   }
 
-  import rw-pb-ext { prefix "rwpb"; }
-
-  import ietf-yang-types {
-    prefix "yang";
-  }
-
-  import mano-types {
-    prefix "manotypes";
-  }
-
-  import rw-project {
-    prefix "rw-project";
-  }
-
-  revision 2017-02-08 {
+  revision 2017-02-28 {
     description
       "Update model to support projects.";
   }
@@ -58,69 +44,12 @@ module rw-vnfd
       "Derived from earlier versions of base YANG files";
   }
 
-  augment /rw-project:project/vnfd:vnfd-catalog/vnfd:vnfd {
-    uses manotypes:control-param;
-    uses manotypes:action-param;
-    leaf meta {
-      description
-        "Any meta-data needed by the UI";
-      type string;
-    }
-    list component {
-      description
-          "This section defines the RIFT.ware
-           virtual components";
-      key "component-name";
-      rwpb:msg-new VcsComponent;
-      rwpb:application-request-point;
-
-      leaf component-name {
-        description "";
-        type string;
-      }
-
-      leaf component-type {
-        description "";
-        type rwvcstypes:component_type;
-        mandatory true;
-      }
-
-      choice component {
-        case rwvcs-rwcollection {
-          uses rwvcstypes:rwvcs-rwcollection;
-        }
-        case rwvcs-rwvm {
-          uses rwvcstypes:rwvcs-rwvm;
-        }
-        case rwvcs-rwproc {
-          uses rwvcstypes:rwvcs-rwproc;
-        }
-        case native-proc {
-          uses rwvcstypes:native-proc;
-        }
-        case rwvcs-rwtasklet {
-          uses rwvcstypes:rwvcs-rwtasklet;
-        }
-      }
-    } // list component
+  augment /vnfd:vnfd-catalog/vnfd:vnfd {
+    uses rw-vnfd-base:rw-vnfd-ext;
   }
 
-  augment /rw-project:project/vnfd:vnfd-catalog/vnfd:vnfd/vnfd:vdu {
-    leaf vcs-component-ref {
-      description
-          "This defines the software components using the
-           RIFT.ware Virtual Component System (VCS). This
-           also allows specifying a state machine during
-           the VM startup.
-           NOTE: This is an significant addition to MANO,
-           since MANO doesn't clearly specify a method to
-           identify various software components in a VM.
-           Also using a state machine is not something that
-           is well described in MANO.";
-      type leafref {
-        path "../../rw-vnfd:component/rw-vnfd:component-name";
-      }
-    }
+  augment /vnfd:vnfd-catalog/vnfd:vnfd/vnfd:vdu {
+    uses rw-vnfd-base:vcs-component-ref;
   }
 }
 // vim: sw=2
index 6337cad..6614f16 100644 (file)
@@ -27,14 +27,16 @@ module rw-vnfr
     prefix "manotypes";
   }
 
-  import rw-pb-ext { prefix "rwpb"; }
+  import rw-pb-ext {
+    prefix "rwpb";
+  }
 
   import vnfr {
     prefix "vnfr";
   }
 
-  import vnfd {
-    prefix "vnfd";
+  import project-vnfd {
+    prefix "project-vnfd";
   }
 
   import rw-cloud {
@@ -57,7 +59,7 @@ module rw-vnfr
     prefix "rw-project";
   }
 
-  revision 2017-02-08 {
+  revision 2017-02-28 {
     description
       "Update model to support projects.";
   }
@@ -288,7 +290,7 @@ module rw-vnfr
       leaf vnfd-id-ref {
         description "Reference to VNFD";
         type leafref {
-          path "../../../vnfd:vnfd-catalog/vnfd:vnfd/vnfd:id";
+          path "../../../project-vnfd:vnfd-catalog/project-vnfd:vnfd/project-vnfd:id";
         }
       }
       leaf instance-ref-count {
index 9f26dba..63556d7 100644 (file)
@@ -27,8 +27,8 @@ module vld
     prefix "rwpb";
   }
 
-  import vnfd {
-    prefix "vnfd";
+  import project-vnfd {
+    prefix "project-vnfd";
   }
 
   import ietf-inet-types {
@@ -120,7 +120,7 @@ module vld
           leaf vnfd-ref {
             description "A reference to a vnfd";
             type leafref {
-              path "../../../../vnfd:vnfd-catalog/vnfd:vnfd/vnfd:id";
+              path "../../../../project-vnfd:vnfd-catalog/project-vnfd:vnfd/project-vnfd:id";
             }
           }
 
@@ -128,7 +128,7 @@ module vld
             description
               "A reference to the consituent-vnfd id in nsd. 
               Should have been a leafref to:
-                '/nsd:nsd-catalog:/nsd:nsd/constituent-vnfd/member-vnf-index-ref'. 
+                '/rw-project:project/project-nsd:nsd-catalog:/nsd/constituent-vnfd/member-vnf-index-ref'.
               Instead using direct leaf to avoid circular reference.";
             type uint64;
           }
@@ -137,9 +137,9 @@ module vld
             description
               "A reference to a connection point name in a vnfd";
             type leafref {
-              path "../../../../vnfd:vnfd-catalog/vnfd:vnfd"
-                + "[vnfd:id = current()/../vld:vnfd-ref]"
-                + "/vnfd:connection-point/vnfd:name";
+              path "../../../../project-vnfd:vnfd-catalog/project-vnfd:vnfd"
+                + "[project-vnfd:id = current()/../vld:vnfd-ref]"
+                + "/project-vnfd:connection-point/project-vnfd:name";
             }
           }
         }
diff --git a/models/plugins/yang/vnfd-base.yang b/models/plugins/yang/vnfd-base.yang
new file mode 100644 (file)
index 0000000..27f064e
--- /dev/null
@@ -0,0 +1,532 @@
+
+/*
+ * 
+ *   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 vnfd-base
+{
+  namespace "http://riftio.com/ns/riftware-1.0/vnfd-base";
+  prefix "vnfd-base";
+
+  import mano-types {
+    prefix "manotypes";
+  }
+
+  import rw-pb-ext {
+    prefix "rwpb";
+  }
+
+  import ietf-yang-types {
+    prefix "yang";
+  }
+
+  import ietf-inet-types {
+    prefix "inet";
+  }
+
+  revision 2017-02-28 {
+    description
+      "Initial revision. This YANG file defines
+       the common types for Virtual Network Function
+       (VNF) descriptor";
+    reference
+      "Derived from earlier versions of base YANG files";
+  }
+
+  grouping common-connection-point {
+    leaf name {
+      description "Name of the connection point";
+      type string;
+    }
+
+    leaf id {
+      description "Identifier for the internal connection points";
+      type string;
+    }
+
+    leaf short-name {
+      description "Short name of the connection point";
+      type string;
+    }
+
+    leaf type {
+      description "Type of the connection point.";
+      type manotypes:connection-point-type;
+    }
+    leaf port-security-enabled {
+      description "Enables the port security for the port";
+      type boolean;
+    }
+  }
+
+  grouping virtual-interface {
+    container virtual-interface {
+      description
+          "Container for the virtual interface properties";
+
+      leaf type {
+        description
+            "Specifies the type of virtual interface
+             between VM and host.
+             VIRTIO          : Use the traditional VIRTIO interface.
+             PCI-PASSTHROUGH : Use PCI-PASSTHROUGH interface.
+             SR-IOV          : Use SR-IOV interface.
+             E1000           : Emulate E1000 interface.
+             RTL8139         : Emulate RTL8139 interface.
+             PCNET           : Emulate PCNET interface.
+             OM-MGMT         : Used to specify openmano mgmt external-connection type";
+
+        type enumeration {
+          enum OM-MGMT;
+          enum PCI-PASSTHROUGH;
+          enum SR-IOV;
+          enum VIRTIO;
+          enum E1000;
+          enum RTL8139;
+          enum PCNET;
+        }
+        default "VIRTIO";
+      }
+
+      leaf vpci {
+        description
+            "Specifies the virtual PCI address. Expressed in
+             the following format dddd:dd:dd.d. For example
+             0000:00:12.0. This information can be used to
+             pass as metadata during the VM creation.";
+        type string;
+      }
+
+      leaf bandwidth {
+        description
+            "Aggregate bandwidth of the NIC.";
+        type uint64;
+      }
+    }
+  }
+
+  grouping vnfd-descriptor {
+      leaf id {
+        description "Identifier for the VNFD.";
+        type string;
+      }
+
+      leaf name {
+        description "VNFD name.";
+        mandatory true;
+        type string;
+      }
+
+      leaf short-name {
+        description "VNFD short name.";
+        type string;
+      }
+
+      leaf vendor {
+        description "Vendor of the VNFD.";
+        type string;
+      }
+
+      leaf logo {
+        description
+            "Vendor logo for the Virtual Network Function";
+        type string;
+      }
+
+      leaf description {
+        description "Description of the VNFD.";
+        type string;
+      }
+
+      leaf version {
+        description "Version of the VNFD";
+        type string;
+      }
+
+      uses manotypes:vnf-configuration;
+
+      container mgmt-interface {
+        description
+            "Interface over which the VNF is managed.";
+
+        choice endpoint-type {
+          description
+              "Indicates the type of management endpoint.";
+
+          case ip {
+            description
+                "Specifies the static IP address for managing the VNF.";
+            leaf ip-address {
+              type inet:ip-address;
+            }
+          }
+
+          case vdu-id {
+            description
+                "Use the default management interface on this VDU.";
+            leaf vdu-id {
+              type leafref {
+                path "../../vdu/id";
+              }
+            }
+          }
+
+          case cp {
+            description
+                "Use the ip address associated with this connection point.";
+            leaf cp {
+              type leafref {
+                path "../../connection-point/name";
+              }
+            }
+          }
+        }
+
+        leaf port {
+          description
+              "Port for the management interface.";
+          type inet:port-number;
+        }
+
+        container dashboard-params {
+          description "Parameters for the VNF dashboard";
+
+          leaf path {
+            description "The HTTP path for the dashboard";
+            type string;
+          }
+
+          leaf https {
+            description "Pick HTTPS instead of HTTP , Default is false";
+            type boolean;
+          }
+
+          leaf port {
+            description "The HTTP port for the dashboard";
+            type inet:port-number;
+          }
+        }
+      }
+
+      list internal-vld {
+        key "id";
+        description
+            "List of Internal Virtual Link Descriptors (VLD).
+            The internal VLD describes the basic topology of
+            the connectivity (e.g. E-LAN, E-Line, E-Tree)
+            between internal VNF components of the system.";
+
+        leaf id {
+          description "Identifier for the VLD";
+          type string;
+        }
+
+        leaf name {
+          description "Name of the internal VLD";
+          type string;
+        }
+
+        leaf short-name {
+          description "Short name of the internal VLD";
+          type string;
+        }
+
+        leaf description {
+          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 internal-connection-point {
+          key "id-ref";
+          description "List of internal connection points in this VLD";
+          leaf id-ref {
+            description "reference to the internal connection point id";
+            type leafref {
+              path "../../../vdu/internal-connection-point/id";
+            }
+          }
+        }
+        uses manotypes:provider-network;
+        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;
+            }
+          }
+
+        }
+      }
+
+      uses manotypes:ip-profile-list;
+
+      list connection-point {
+        key "name";
+        description
+            "List for external connection points. Each VNF has one
+            or more external connection points. As the name
+            implies that external connection points are used for
+            connecting the VNF to other VNFs or to external networks.
+            Each VNF exposes these connection points to the
+            orchestrator. The orchestrator can construct network
+            services by connecting the connection points between
+            different VNFs. The NFVO will use VLDs and VNFFGs at
+            the network service level to construct network services.";
+
+        uses common-connection-point;
+      }
+
+      list vdu {
+        description "List of Virtual Deployment Units";
+        key "id";
+
+        leaf id {
+          description "Unique id for the VDU";
+          type string;
+        }
+
+        leaf name {
+          description "Unique name for the VDU";
+          type string;
+        }
+
+        leaf description {
+            description "Description of the VDU.";
+            type string;
+        }
+
+        leaf count {
+          description "Number of instances of VDU";
+          type uint64;
+        }
+
+        leaf mgmt-vpci {
+          description
+              "Specifies the virtual PCI address. Expressed in
+             the following format dddd:dd:dd.d. For example
+             0000:00:12.0. This information can be used to
+             pass as metadata during the VM creation.";
+          type string;
+        }
+
+        uses manotypes:vm-flavor;
+        uses manotypes:guest-epa;
+        uses manotypes:vswitch-epa;
+        uses manotypes:hypervisor-epa;
+        uses manotypes:host-epa;
+
+        list alarm {
+          key "alarm-id";
+
+          uses manotypes:alarm;
+        }
+
+        uses manotypes:image-properties;
+
+        choice cloud-init-input {
+          description
+            "Indicates how the contents of cloud-init script are provided.
+             There are 2 choices - inline or in a file";
+
+          case inline {
+            leaf cloud-init {
+              description
+                "Contents of cloud-init script, provided inline, in cloud-config format";
+              type string;
+            }
+          }
+
+          case filename {
+            leaf cloud-init-file {
+              description
+                "Name of file with contents of cloud-init script in cloud-config format";
+                type string;
+            }
+          }
+        }
+
+        uses manotypes:supplemental-boot-data;
+
+        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
+              the VNF components internal to the VNF. If a VNF
+              has only one VNFC, it may not have any internal
+              connection points.";
+
+          uses common-connection-point;
+
+          leaf internal-vld-ref {
+            type leafref {
+              path "../../../internal-vld/id";
+            }
+          }
+        }
+
+        list internal-interface {
+          description
+              "List of internal interfaces for the VNF";
+          key name;
+
+          leaf name {
+            description
+                "Name of internal interface. Note that this
+                name has only local significance to the VDU.";
+            type string;
+          }
+
+          leaf vdu-internal-connection-point-ref {
+            type leafref {
+              path "../../internal-connection-point/id";
+            }
+          }
+          uses virtual-interface;
+        }
+
+        list external-interface {
+          description
+              "List of external interfaces for the VNF.
+              The external interfaces enable sending
+              traffic to and from VNF.";
+          key name;
+
+          leaf name {
+            description
+                "Name of the external interface. Note that
+                this name has only local significance.";
+            type string;
+          }
+
+          leaf vnfd-connection-point-ref {
+            description
+              "Name of the external connection point.";
+            type leafref {
+              path "../../../connection-point/name";
+            }
+          }
+          uses virtual-interface;
+        }
+
+        list volumes {
+          key "name";
+
+          leaf name {
+            description "Name of the disk-volumes, e.g. vda, vdb etc";
+            type string;
+          }
+
+          uses manotypes:volume-info;
+        } 
+      }
+
+      list vdu-dependency {
+        description
+            "List of VDU dependencies.";
+
+        key vdu-source-ref;
+        leaf vdu-source-ref {
+          type leafref {
+            path "../../vdu/id";
+          }
+        }
+
+        leaf vdu-depends-on-ref {
+          description
+              "Reference to the VDU that
+              source VDU depends.";
+          type leafref {
+            path "../../vdu/id";
+          }
+        }
+      }
+
+      leaf service-function-chain {
+        description "Type of node in Service Function Chaining Architecture";
+
+        type enumeration {
+          enum UNAWARE;
+          enum CLASSIFIER;
+          enum SF;
+          enum SFF;
+        }
+        default "UNAWARE";
+      }
+
+      leaf service-function-type {
+        description
+            "Type of Service Function.
+             NOTE: This needs to map with Service Function Type in ODL to
+             support VNFFG. Service Function Type is manadatory param in ODL
+             SFC. This is temporarily set to string for ease of use";
+            type string;
+      }
+
+      uses manotypes:monitoring-param;
+
+      list placement-groups {
+        description "List of placement groups at VNF level";
+
+        key "name";
+        uses manotypes:placement-group-info;
+
+        list member-vdus {
+
+          description
+              "List of VDUs that are part of this placement group";
+          key "member-vdu-ref";
+
+          leaf member-vdu-ref {
+            type leafref {
+              path "../../../vdu/id";
+            }
+          }
+        }
+      }
+  }
+}
+
+// vim: sw=2
index 0e5d5ae..42de19c 100644 (file)
@@ -23,27 +23,11 @@ module vnfd
   namespace "urn:ietf:params:xml:ns:yang:nfvo:vnfd";
   prefix "vnfd";
 
-  import mano-types {
-    prefix "manotypes";
+  import vnfd-base {
+    prefix "vnfd-base";
   }
 
-  import rw-pb-ext {
-    prefix "rwpb";
-  }
-
-  import ietf-yang-types {
-    prefix "yang";
-  }
-
-  import ietf-inet-types {
-    prefix "inet";
-  }
-
-  import rw-project {
-    prefix "rw-project";
-  }
-
-  revision 2017-02-08 {
+  revision 2017-02-28 {
     description
       "Update model to support projects.";
   }
@@ -56,496 +40,14 @@ module vnfd
       "Derived from earlier versions of base YANG files";
   }
 
-  grouping common-connection-point {
-    leaf name {
-      description "Name of the connection point";
-      type string;
-    }
-
-    leaf id {
-      description "Identifier for the internal connection points";
-      type string;
-    }
-
-    leaf short-name {
-      description "Short name of the connection point";
-      type string;
-    }
-
-    leaf type {
-      description "Type of the connection point.";
-      type manotypes:connection-point-type;
-    }
-    leaf port-security-enabled {
-      description "Enables the port security for the port";
-      type boolean;
-    }
-  }
-
-  grouping virtual-interface {
-    container virtual-interface {
-      description
-          "Container for the virtual interface properties";
-
-      leaf type {
-        description
-            "Specifies the type of virtual interface
-             between VM and host.
-             VIRTIO          : Use the traditional VIRTIO interface.
-             PCI-PASSTHROUGH : Use PCI-PASSTHROUGH interface.
-             SR-IOV          : Use SR-IOV interface.
-             E1000           : Emulate E1000 interface.
-             RTL8139         : Emulate RTL8139 interface.
-             PCNET           : Emulate PCNET interface.
-             OM-MGMT         : Used to specify openmano mgmt external-connection type";
-
-        type enumeration {
-          enum OM-MGMT;
-          enum PCI-PASSTHROUGH;
-          enum SR-IOV;
-          enum VIRTIO;
-          enum E1000;
-          enum RTL8139;
-          enum PCNET;
-        }
-        default "VIRTIO";
-      }
-
-      leaf vpci {
-        description
-            "Specifies the virtual PCI address. Expressed in
-             the following format dddd:dd:dd.d. For example
-             0000:00:12.0. This information can be used to
-             pass as metadata during the VM creation.";
-        type string;
-      }
-
-      leaf bandwidth {
-        description
-            "Aggregate bandwidth of the NIC.";
-        type uint64;
-      }
-    }
-  }
-
-  grouping vnfd-descriptor {
-      leaf id {
-        description "Identifier for the VNFD.";
-        type string;
-      }
-
-      leaf name {
-        description "VNFD name.";
-        mandatory true;
-        type string;
-      }
-
-      leaf short-name {
-        description "VNFD short name.";
-        type string;
-      }
-
-      leaf vendor {
-        description "Vendor of the VNFD.";
-        type string;
-      }
-
-      leaf logo {
-        description
-            "Vendor logo for the Virtual Network Function";
-        type string;
-      }
-
-      leaf description {
-        description "Description of the VNFD.";
-        type string;
-      }
-
-      leaf version {
-        description "Version of the VNFD";
-        type string;
-      }
-
-      uses manotypes:vnf-configuration;
-
-      container mgmt-interface {
-        description
-            "Interface over which the VNF is managed.";
-
-        choice endpoint-type {
-          description
-              "Indicates the type of management endpoint.";
-
-          case ip {
-            description
-                "Specifies the static IP address for managing the VNF.";
-            leaf ip-address {
-              type inet:ip-address;
-            }
-          }
-
-          case vdu-id {
-            description
-                "Use the default management interface on this VDU.";
-            leaf vdu-id {
-              type leafref {
-                path "../../vdu/id";
-              }
-            }
-          }
-
-          case cp {
-            description
-                "Use the ip address associated with this connection point.";
-            leaf cp {
-              type leafref {
-                path "../../connection-point/name";
-              }
-            }
-          }
-        }
-
-        leaf port {
-          description
-              "Port for the management interface.";
-          type inet:port-number;
-        }
-
-        container dashboard-params {
-          description "Parameters for the VNF dashboard";
-
-          leaf path {
-            description "The HTTP path for the dashboard";
-            type string;
-          }
-
-          leaf https {
-            description "Pick HTTPS instead of HTTP , Default is false";
-            type boolean;
-          }
-
-          leaf port {
-            description "The HTTP port for the dashboard";
-            type inet:port-number;
-          }
-        }
-      }
-
-      list internal-vld {
-        key "id";
-        description
-            "List of Internal Virtual Link Descriptors (VLD).
-            The internal VLD describes the basic topology of
-            the connectivity (e.g. E-LAN, E-Line, E-Tree)
-            between internal VNF components of the system.";
-
-        leaf id {
-          description "Identifier for the VLD";
-          type string;
-        }
-
-        leaf name {
-          description "Name of the internal VLD";
-          type string;
-        }
-
-        leaf short-name {
-          description "Short name of the internal VLD";
-          type string;
-        }
-
-        leaf description {
-          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 internal-connection-point {
-          key "id-ref";
-          description "List of internal connection points in this VLD";
-          leaf id-ref {
-            description "reference to the internal connection point id";
-            type leafref {
-              path "../../../vdu/internal-connection-point/id";
-            }
-          }
-        }
-        uses manotypes:provider-network;
-        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;
-            }
-          }
-
-        }
-      }
-
-      uses manotypes:ip-profile-list;
-
-      list connection-point {
-        key "name";
-        description
-            "List for external connection points. Each VNF has one
-            or more external connection points. As the name
-            implies that external connection points are used for
-            connecting the VNF to other VNFs or to external networks.
-            Each VNF exposes these connection points to the
-            orchestrator. The orchestrator can construct network
-            services by connecting the connection points between
-            different VNFs. The NFVO will use VLDs and VNFFGs at
-            the network service level to construct network services.";
-
-        uses common-connection-point;
-      }
-
-      list vdu {
-        description "List of Virtual Deployment Units";
-        key "id";
-
-        leaf id {
-          description "Unique id for the VDU";
-          type string;
-        }
-
-        leaf name {
-          description "Unique name for the VDU";
-          type string;
-        }
-
-        leaf description {
-            description "Description of the VDU.";
-            type string;
-        }
-
-        leaf count {
-          description "Number of instances of VDU";
-          type uint64;
-        }
-
-        leaf mgmt-vpci {
-          description
-              "Specifies the virtual PCI address. Expressed in
-             the following format dddd:dd:dd.d. For example
-             0000:00:12.0. This information can be used to
-             pass as metadata during the VM creation.";
-          type string;
-        }
-
-        uses manotypes:vm-flavor;
-        uses manotypes:guest-epa;
-        uses manotypes:vswitch-epa;
-        uses manotypes:hypervisor-epa;
-        uses manotypes:host-epa;
-
-        list alarm {
-          key "alarm-id";
-
-          uses manotypes:alarm;
-        }
-
-        uses manotypes:image-properties;
-
-        choice cloud-init-input {
-          description
-            "Indicates how the contents of cloud-init script are provided.
-             There are 2 choices - inline or in a file";
-
-          case inline {
-            leaf cloud-init {
-              description
-                "Contents of cloud-init script, provided inline, in cloud-config format";
-              type string;
-            }
-          }
-
-          case filename {
-            leaf cloud-init-file {
-              description
-                "Name of file with contents of cloud-init script in cloud-config format";
-                type string;
-            }
-          }
-        }
-
-        uses manotypes:supplemental-boot-data;
-
-        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
-              the VNF components internal to the VNF. If a VNF
-              has only one VNFC, it may not have any internal
-              connection points.";
-
-          uses common-connection-point;
-
-          leaf internal-vld-ref {
-            type leafref {
-              path "../../../internal-vld/id";
-            }
-          }
-        }
-
-        list internal-interface {
-          description
-              "List of internal interfaces for the VNF";
-          key name;
-
-          leaf name {
-            description
-                "Name of internal interface. Note that this
-                name has only local significance to the VDU.";
-            type string;
-          }
-
-          leaf vdu-internal-connection-point-ref {
-            type leafref {
-              path "../../internal-connection-point/id";
-            }
-          }
-          uses virtual-interface;
-        }
-
-        list external-interface {
-          description
-              "List of external interfaces for the VNF.
-              The external interfaces enable sending
-              traffic to and from VNF.";
-          key name;
-
-          leaf name {
-            description
-                "Name of the external interface. Note that
-                this name has only local significance.";
-            type string;
-          }
-
-          leaf vnfd-connection-point-ref {
-            description
-              "Name of the external connection point.";
-            type leafref {
-              path "../../../connection-point/name";
-            }
-          }
-          uses virtual-interface;
-        }
-
-        list volumes {
-          key "name";
-
-          leaf name {
-            description "Name of the disk-volumes, e.g. vda, vdb etc";
-            type string;
-          }
-
-          uses manotypes:volume-info;
-        } 
-      }
-
-      list vdu-dependency {
-        description
-            "List of VDU dependencies.";
-
-        key vdu-source-ref;
-        leaf vdu-source-ref {
-          type leafref {
-            path "../../vdu/id";
-          }
-        }
-
-        leaf vdu-depends-on-ref {
-          description
-              "Reference to the VDU that
-              source VDU depends.";
-          type leafref {
-            path "../../vdu/id";
-          }
-        }
-      }
-
-      leaf service-function-chain {
-        description "Type of node in Service Function Chaining Architecture";
-
-        type enumeration {
-          enum UNAWARE;
-          enum CLASSIFIER;
-          enum SF;
-          enum SFF;
-        }
-        default "UNAWARE";
-      }
-
-      leaf service-function-type {
-        description
-            "Type of Service Function.
-             NOTE: This needs to map with Service Function Type in ODL to
-             support VNFFG. Service Function Type is manadatory param in ODL
-             SFC. This is temporarily set to string for ease of use";
-            type string;
-      }
-
-      uses manotypes:monitoring-param;
-
-      list placement-groups {
-        description "List of placement groups at VNF level";
-
-        key "name";
-        uses manotypes:placement-group-info;
-
-        list member-vdus {
-
-          description
-              "List of VDUs that are part of this placement group";
-          key "member-vdu-ref";
-
-          leaf member-vdu-ref {
-            type leafref {
-              path "../../../vdu/id";
-            }
-          }
-        }
-      }
-  }
-
-  augment "/rw-project:project" {
-    container vnfd-catalog {
-      description
-        "Virtual Network Function Descriptor (VNFD).";
+  container vnfd-catalog {
+    description
+      "Virtual Network Function Descriptor (VNFD).";
 
-      list vnfd {
-        key "id";
+    list vnfd {
+      key "id";
 
-        uses vnfd-descriptor;
-      }
+        uses vnfd-base:vnfd-descriptor;
     }
   }
 }
index 13d9600..5cae6b8 100644 (file)
@@ -31,12 +31,12 @@ module vnfr
     prefix "rwpb";
   }
 
-  import vnfd {
-    prefix "vnfd";
+  import vnfd-base {
+    prefix "vnfd-base";
   }
 
-  import nsd {
-    prefix "nsd";
+  import project-nsd {
+    prefix "project-nsd";
   }
 
   import vlr {
@@ -59,7 +59,7 @@ module vnfr
     prefix "rw-cloud";
   }
 
-  revision 2017-02-08 {
+  revision 2017-02-28 {
     description
       "Update model to support projects.";
   }
@@ -170,7 +170,7 @@ module vnfr
         leaf member-vnf-index-ref {
           description "Reference to member VNF index in Network service.";
           type leafref {
-            path "../../../nsd:nsd-catalog/nsd:nsd/nsd:constituent-vnfd/nsd:member-vnf-index";
+            path "../../../project-nsd:nsd-catalog/project-nsd:nsd/project-nsd:constituent-vnfd/project-nsd:member-vnf-index";
           }
         }
 
@@ -223,7 +223,7 @@ module vnfr
 
         container vnfd {
           description "VNF descriptor used to instantiate this VNF";
-          uses vnfd:vnfd-descriptor;
+          uses vnfd-base:vnfd-descriptor;
         }
 
         // Use parameters provided here to configure this VNF
@@ -269,7 +269,7 @@ module vnfr
              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
@@ -390,7 +390,7 @@ module vnfr
                has only one VNFC, it may not have any internal
                connection points.";
 
-            uses vnfd:common-connection-point;
+            uses vnfd-base:common-connection-point;
 
             leaf ip-address {
               description
index 6f76cb4..a5d6404 100644 (file)
@@ -502,7 +502,7 @@ class ConfigManagerConfig(object):
         if nsr_obj.cm_nsr['state'] != nsr_obj.state_to_string(conmanY.RecordState.INIT):
             self._log.debug("NSR(%s) is already processed, state=%s",
                             nsr_obj.nsr_name, nsr_obj.cm_nsr['state'])
-            yield from nsr_obj.publish_cm_state()
+            yield from nsr_obj.publish_cm_state()
             return True
 
         cmdts_obj = self.cmdts_obj
@@ -1361,8 +1361,8 @@ class XPaths(object):
 
     @staticmethod
     def nsd_msg(k=None):
-        return ("C,/nsd:nsd-catalog/nsd:nsd" +
-                "[nsd:id = '{}']".format(k) if k is not None else "")
+        return ("C,/project-nsd:nsd-catalog/project-nsd:nsd" +
+                "[project-nsd:id = '{}']".format(k) if k is not None else "")
 
     @staticmethod
     def vnfr_opdata(k=None):
@@ -1371,8 +1371,8 @@ class XPaths(object):
 
     @staticmethod
     def vnfd(k=None):
-        return ("C,/vnfd:vnfd-catalog/vnfd:vnfd" +
-                ("[vnfd:id='{}']".format(k) if k is not None else ""))
+        return ("C,/project-vnfd:vnfd-catalog/project-vnfd:vnfd" +
+                ("[project-vnfd:id='{}']".format(k) if k is not None else ""))
 
     @staticmethod
     def config_agent(k=None):
index 006f11b..b6cf99c 100644 (file)
@@ -39,6 +39,14 @@ module rw-conman
     prefix "rwcli";
   }
 
+  import rw-project-vnfd {
+    prefix "rw-project-vnfd";
+  }
+
+  import rw-project-nsd {
+    prefix "rw-project-nsd";
+  }
+
   import nsr {
     prefix "nsr";
   }
index 8343154..c06e6b8 100644 (file)
@@ -6,8 +6,10 @@ ietf-network-topology
 ietf-restconf-monitoring
 ietf-yang-types
 mano-types
-nsd
+nsd-base
 nsr
+project-nsd
+project-vnfd
 rw-base
 rwcal
 rw-cli-ext
@@ -32,11 +34,13 @@ rwmsg-data
 rw-netconf
 rw-restconf
 rw-notify-ext
-rw-nsd
+rw-nsd-base
 rw-nsm
 rw-nsr
 rw-pb-ext
 rw-project
+rw-project-nsd
+rw-project-vnfd
 rw-resource-mgr
 rw-restportforward
 rwsdn
@@ -48,11 +52,11 @@ rw-vcs
 rwvcs-types
 rw-vld
 rw-vlr
-rw-vnfd
+rw-vnfd-base
 rw-vnfr
 rw-yang-types
 vld
 vlr
-vnfd
+project-vnfd
 vnffgd
 vnfr
index edc7a9e..ec1016f 100644 (file)
@@ -33,11 +33,11 @@ gi.require_version('RwDtsYang', '1.0')
 from gi.repository import (
         RwNsrYang,
         NsrYang,
-        NsdYang,
+        ProjectNsdYang as NsdYang,
         RwLaunchpadYang as launchpadyang,
         RwVnfrYang,
-        RwVnfdYang,
-        RwNsdYang,
+        RwProjectVnfdYang as RwVnfdYang,
+        RwProjectNsdYang as RwNsdYang,
         VnfrYang
         )
 
index 2e8e3b2..525eff5 100644 (file)
@@ -1,6 +1,6 @@
 
-# 
-#   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.
 import json
 import logging
 import os
-import tempfile
-import yaml
 
 import gi
 gi.require_version('RwNsdYang', '1.0')
+gi.require_version('RwProjectNsdYang', '1.0')
 gi.require_version('RwVnfdYang', '1.0')
+gi.require_version('RwProjectVnfdYang', '1.0')
 gi.require_version('RwYang', '1.0')
 from gi.repository import (
         RwNsdYang,
         RwVnfdYang,
         NsdYang,
         VnfdYang,
+        RwProjectNsdYang,
+        RwProjectVnfdYang,
+        ProjectNsdYang,
+        ProjectVnfdYang,
         RwYang,
         )
 
@@ -55,10 +59,15 @@ class ProtoMessageSerializer(object):
     """(De)Serializer/deserializer fo a specific protobuf message into various formats"""
     libncx_model = None
 
-    def __init__(self, yang_ns, yang_pb_cls):
+    def __init__(self, yang_ns, yang_pb_cls,
+                 yang_ns_project, yang_pb_project_cls):
         """ Create a serializer for a specific protobuf message """
         self._yang_ns = yang_ns
         self._yang_pb_cls = yang_pb_cls
+        self._yang_ns_project = yang_ns_project
+        self._yang_pb_project_cls = yang_pb_project_cls
+
+        self._log = logging.getLogger('rw-maon-log')
 
     @classmethod
     def _deserialize_extension_method_map(cls):
@@ -101,9 +110,19 @@ class ProtoMessageSerializer(object):
 
     @property
     def yang_class(self):
-        """ The Protobuf's GI class (e.g. RwVnfdYang.YangData_RwProject_Project_VnfdCatalog_Vnfd) """
+        """ The Protobuf's GI class (e.g. RwVnfdYang.YangData_Vnfd_VnfdCatalog_Vnfd) """
         return self._yang_pb_cls
 
+    @property
+    def yang_ns_project(self):
+        """ The Protobuf's GI namespace class (e.g. RwProjectVnfdYang) """
+        return self._yang_ns_project
+
+    @property
+    def yang_class_project(self):
+        """ The Protobuf's GI class (e.g. RwProjectVnfdYang.YangData_RwProject_Project_VnfdCatalog_Vnfd) """
+        return self._yang_pb_project_cls
+
     @property
     def model(self):
         cls = self.__class__
@@ -112,6 +131,7 @@ class ProtoMessageSerializer(object):
         if cls.libncx_model is None:
             cls.libncx_model = RwYang.model_create_libncx()
             cls.libncx_model.load_schema_ypbc(self.yang_namespace.get_schema())
+            cls.libncx_model.load_schema_ypbc(self.yang_ns_project.get_schema())
 
         return cls.libncx_model
 
@@ -131,17 +151,45 @@ class ProtoMessageSerializer(object):
         # Need to prefix project on to the descriptor and then
         # convert to yang pb
         # TODO: See if there is a better way to do this
-        desc = {NS_PROJECT: []}
-        desc[NS_PROJECT].append(yaml.load(decode(yml)))
+        desc = {NS_PROJECT: []}
+        desc[NS_PROJECT].append(yaml.load(decode(yml)))
         # log = logging.getLogger('rw-mano-log')
         # log.error("Desc from yaml: {}".format(desc))
-        return self.yang_class.from_yaml(self.model, yaml.dump(desc), strict=False)
+        # return self.yang_class.from_yaml(self.model, yaml.dump(desc), strict=False)
+
+        try:
+            desc_msg = self.yang_class.from_yaml(self.model, decode(yml), strict=False)
+            return self.yang_class_project.from_dict(desc_msg.as_dict())
+        except Exception as e:
+            self._log.exception(e)
+            raise e
 
-    def to_json_string(self, pb_msg):
+    def to_desc_msg(self, pb_msg, project_rooted=True):
+        """Convert to and from project rooted pb msg  descriptor to catalog
+           rooted pb msg
+        """
+        if project_rooted:
+            if isinstance(pb_msg, self._yang_pb_project_cls):
+                return self._yang_pb_cls.from_dict(pb_msg.as_dict())
+            elif isinstance(pb_msg, self._yang_pb_cls):
+                return pb_msg
+
+        else:
+            if isinstance(pb_msg, self._yang_pb_cls):
+                return self._yang_pb_project_cls.from_dict(pb_msg.as_dict())
+            elif isinstance(pb_msg, self._yang_pb_project_cls):
+                return pb_msg
+
+        raise TypeError("Invalid protobuf message type provided: {}".format(type(pb_msg)))
+
+
+    def to_json_string(self, pb_msg, project_ns=False):
         """ Serialize a protobuf message into JSON
 
         Arguments:
             pb_msg - A GI-protobuf object of type provided into constructor
+            project_ns - Need the desc in project namespace, required for
+                         posting to Restconf as part of onboarding
 
         Returns:
             A JSON string representing the protobuf message
@@ -150,20 +198,20 @@ class ProtoMessageSerializer(object):
             SerializationError - Message could not be serialized
             TypeError - Incorrect protobuf type provided
         """
-        if not isinstance(pb_msg, self._yang_pb_cls):
-            raise TypeError("Invalid protobuf message type provided")
-
         try:
-            json_str = pb_msg.to_json(self.model)
+            # json_str = pb_msg.to_json(self.model)
+
+            desc_msg = self.to_desc_msg(pb_msg, not project_ns)
+            json_str = desc_msg.to_json(self.model)
+            if project_ns:
+                # Remove rw-project:project top level element
+                dic = json.loads(json_str)
+                jstr = json.dumps(dic[NS_PROJECT][0])
 
-            # Remove rw-project:project top level element
-            dic = json.loads(json_str)
-            jstr = json.dumps(dic[NS_PROJECT][0])
         except Exception as e:
             raise SerializationError(e)
 
-        log = logging.getLogger('rw-mano-log')
-        log.error("Desc to json: {}".format(jstr))
+        self._log.debug("Convert desc to json: {}".format(jstr))
         return jstr
 
     def to_yaml_string(self, pb_msg):
@@ -179,13 +227,12 @@ class ProtoMessageSerializer(object):
             SerializationError - Message could not be serialized
             TypeError - Incorrect protobuf type provided
         """
-        if not isinstance(pb_msg, self._yang_pb_cls):
-            raise TypeError("Invalid protobuf message type provided")
-
         try:
-            yaml_str = pb_msg.to_yaml(self.model)
+            desc_msg = self.to_desc_msg(pb_msg)
+            yaml_str = desc_msg.to_yaml(self.model)
 
         except Exception as e:
+            self._log.exception("Exception converting to yaml: {}".format(e))
             raise SerializationError(e)
 
         return yaml_str
@@ -203,13 +250,12 @@ class ProtoMessageSerializer(object):
             SerializationError - Message could not be serialized
             TypeError - Incorrect protobuf type provided
         """
-        if not isinstance(pb_msg, self._yang_pb_cls):
-            raise TypeError("Invalid protobuf message type provided")
-
         try:
-            xml_str = pb_msg.to_xml_v2(self.model)
+            desc_msg = self.to_desc_msg(pb_msg)
+            xml_str = desc_msg.to_xml_v2(self.model)
 
         except Exception as e:
+            self._log.exception("Exception converting to xml: {}".format(e))
             raise SerializationError(e)
 
         return xml_str
@@ -278,22 +324,26 @@ class ProtoMessageSerializer(object):
 class VnfdSerializer(ProtoMessageSerializer):
     """ Creates a serializer for the VNFD descriptor"""
     def __init__(self):
-        super().__init__(VnfdYang, VnfdYang.YangData_RwProject_Project_VnfdCatalog_Vnfd)
+        super().__init__(VnfdYang, VnfdYang.YangData_Vnfd_VnfdCatalog_Vnfd,
+                         ProjectVnfdYang, ProjectVnfdYang.YangData_RwProject_Project_VnfdCatalog_Vnfd)
 
 
 class NsdSerializer(ProtoMessageSerializer):
     """ Creates a serializer for the NSD descriptor"""
     def __init__(self):
-        super().__init__(NsdYang, NsdYang.YangData_RwProject_Project_NsdCatalog_Nsd)
+        super().__init__(NsdYang, NsdYang.YangData_Nsd_NsdCatalog_Nsd,
+                         ProjectNsdYang, ProjectNsdYang.YangData_RwProject_Project_NsdCatalog_Nsd)
 
 
 class RwVnfdSerializer(ProtoMessageSerializer):
     """ Creates a serializer for the VNFD descriptor"""
     def __init__(self):
-        super().__init__(RwVnfdYang, RwVnfdYang.YangData_RwProject_Project_VnfdCatalog_Vnfd)
+        super().__init__(RwVnfdYang, RwVnfdYang.YangData_Vnfd_VnfdCatalog_Vnfd,
+                         RwProjectVnfdYang, RwProjectVnfdYang.YangData_RwProject_Project_VnfdCatalog_Vnfd)
 
 
 class RwNsdSerializer(ProtoMessageSerializer):
     """ Creates a serializer for the NSD descriptor"""
     def __init__(self):
-        super().__init__(RwNsdYang, RwNsdYang.YangData_RwProject_Project_NsdCatalog_Nsd)
+        super().__init__(RwNsdYang, RwNsdYang.YangData_Nsd_NsdCatalog_Nsd,
+                         RwProjectNsdYang, RwProjectNsdYang.YangData_RwProject_Project_NsdCatalog_Nsd)
index 1e017b2..cffd21c 100644 (file)
@@ -1,6 +1,6 @@
 
-# 
-#   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.
@@ -35,13 +35,9 @@ from . import message
 from . import tosca
 
 import gi
-gi.require_version('NsdYang', '1.0')
-gi.require_version('VnfdYang', '1.0')
 gi.require_version('RwPkgMgmtYang', '1.0')
 
 from gi.repository import (
-        NsdYang,
-        VnfdYang,
         RwPkgMgmtYang)
 import rift.mano.dts as mano_dts
 
index db7737f..d4125d4 100644 (file)
@@ -20,10 +20,10 @@ import requests
 from rift.mano.utils.project import DEFAULT_PROJECT
 from rift.package import convert
 from gi.repository import (
-    NsdYang,
-    RwNsdYang,
-    VnfdYang,
-    RwVnfdYang,
+    ProjectNsdYang as NsdYang,
+    RwProjectNsdYang as RwNsdYang,
+    ProjectVnfdYang as VnfdYang,
+    RwProjectVnfdYang as RwVnfdYang,
 )
 
 
@@ -97,7 +97,7 @@ class DescriptorOnboarder(object):
             raise TypeError("Invalid descriptor message type")
 
         serializer = DescriptorOnboarder.DESC_SERIALIZER_MAP[type(descriptor_msg)]
-        json_data = serializer.to_json_string(descriptor_msg)
+        json_data = serializer.to_json_string(descriptor_msg, project_ns=True)
         url = self._get_url(descriptor_msg, project=project)
 
         request_args = dict(
index 76dc781..f38bbc6 100644 (file)
@@ -81,7 +81,7 @@ class CatalogDtsHandler(object):
 
 
 class NsdCatalogDtsHandler(CatalogDtsHandler):
-    XPATH = "C,/nsd:nsd-catalog/nsd:nsd"
+    XPATH = "C,/project-nsd:nsd-catalog/project-nsd:nsd"
 
     def add_nsd(self, nsd):
         self.log.debug('nsd-catalog-handler:add:{}'.format(nsd.id))
@@ -158,7 +158,7 @@ class NsdCatalogDtsHandler(CatalogDtsHandler):
 
 
 class VnfdCatalogDtsHandler(CatalogDtsHandler):
-    XPATH = "C,/vnfd:vnfd-catalog/vnfd:vnfd"
+    XPATH = "C,/project-vnfd:vnfd-catalog/project-vnfd:vnfd"
 
     def add_vnfd(self, vnfd):
         self.log.debug('vnfd-catalog-handler:add:{}'.format(vnfd.id))
index 1406a89..1e45ea4 100644 (file)
@@ -38,12 +38,12 @@ requests.packages.urllib3.disable_warnings(InsecureRequestWarning)
 
 import gi
 gi.require_version('RwLaunchpadYang', '1.0')
-gi.require_version('NsdYang', '1.0')
-gi.require_version('VnfdYang', '1.0')
+gi.require_version('ProjectNsdYang', '1.0')
+gi.require_version('ProjectVnfdYang', '1.0')
 
 from gi.repository import (
-        NsdYang,
-        VnfdYang,
+        ProjectNsdYang as NsdYang,
+        ProjectVnfdYang as VnfdYang,
         )
 import rift.mano.cloud
 
index d5bb4e5..d07cfb7 100755 (executable)
@@ -343,7 +343,7 @@ class OnboardPackage:
                                             js['error']))
 
         try:
-            nsd = js['nsd:nsd']
+            nsd = js['project-nsd:nsd']
         except KeyError as e:
             raise OnboardPkgNsdError("NSD ID {} provided is not valid".
                                      format(self._nsd_id))
@@ -415,7 +415,7 @@ class OnboardPackage:
 
                 self.log.debug("NSD list: {}".format(js))
                 print('List of NSDs on SO:\nName\tID')
-                for nsd in js['nsd:nsd']:
+                for nsd in js['project-nsd:nsd']:
                     print('{}\t{}'.format(nsd['name'], nsd['id']))
 
             except OnboardPkgCmdError as e:
index 522c1a8..434d036 100755 (executable)
@@ -42,10 +42,11 @@ import rift.package.store
 from rift.tasklets.rwlaunchpad import export
 
 import gi
-gi.require_version('RwVnfdYang', '1.0')
+gi.require_version('ProjectVnfdYang', '1.0')
+gi.require_version('RwProjectVnfdYang', '1.0')
 from gi.repository import (
-        RwVnfdYang,
-        VnfdYang,
+        RwProjectVnfdYang as RwVnfdYang,
+        ProjectVnfdYang as VnfdYang,
         )
 
 import utest_package
index e56ec04..812f332 100755 (executable)
@@ -33,12 +33,12 @@ import xmlrunner
 from rift.package.handler import FileRestApiHandler
 
 import gi
-gi.require_version('NsdYang', '1.0')
-gi.require_version('VnfdYang', '1.0')
+gi.require_version('ProjectNsdYang', '1.0')
+gi.require_version('ProjectVnfdYang', '1.0')
 
 from gi.repository import (
-        NsdYang,
-        VnfdYang,
+        ProjectNsdYang as NsdYang,
+        ProjectVnfdYang as VnfdYang,
         )
 
 
index b3a7458..643b6fb 100755 (executable)
@@ -36,12 +36,12 @@ from rift.tasklets.rwlaunchpad import onboard
 import rift.test.dts
 
 import gi
-gi.require_version('NsdYang', '1.0')
-gi.require_version('VnfdYang', '1.0')
+gi.require_version('ProjectNsdYang', '1.0')
+gi.require_version('ProjectVnfdYang', '1.0')
 
 from gi.repository import (
-        NsdYang,
-        VnfdYang,
+        ProjectNsdYang as NsdYang,
+        ProjectVnfdYang as VnfdYang,
         )
 
 
index 1efd2df..d57ac77 100755 (executable)
@@ -50,18 +50,18 @@ from gi.repository import (
         )
 
 
-nsd_yaml = b"""nsd:nsd-catalog:
-  nsd:nsd:
-  - nsd:id: gw_corpA
-    nsd:name: gw_corpA
-    nsd:description: Gateways to access as corpA to PE1 and PE2
+nsd_yaml = b"""project-nsd:nsd-catalog:
+  project-nsd:nsd:
+  - project-nsd:id: gw_corpA
+    project-nsd:name: gw_corpA
+    project-nsd:description: Gateways to access as corpA to PE1 and PE2
 """
 
-vnfd_yaml = b"""vnfd:vnfd-catalog:
-  vnfd:vnfd:
-  - vnfd:id: gw_corpA_vnfd
-    vnfd:name: gw_corpA_vnfd
-    vnfd:description: Gateways to access as corpA to PE1 and PE2
+vnfd_yaml = b"""project-vnfd:vnfd-catalog:
+  project-vnfd:vnfd:
+  - project-vnfd:id: gw_corpA_vnfd
+    project-vnfd:name: gw_corpA_vnfd
+    project-vnfd:description: Gateways to access as corpA to PE1 and PE2
 """
 
 nsd_filename = "gw_corpA__nsd.yaml"
@@ -169,7 +169,7 @@ class TestPackage(PackageTestCase):
 
         json_str = package.json_descriptor
         desc_dict = json.loads(json_str)
-        self.assertIn("nsd:nsd-catalog", desc_dict)
+        self.assertIn("project-nsd:nsd-catalog", desc_dict)
 
     def test_create_vnfd_package_from_archive(self):
         package = self.create_vnfd_package()
@@ -177,7 +177,7 @@ class TestPackage(PackageTestCase):
 
         json_str = package.json_descriptor
         desc_dict = json.loads(json_str)
-        self.assertIn("vnfd:vnfd-catalog", desc_dict)
+        self.assertIn("project-vnfd:vnfd-catalog", desc_dict)
 
     def test_create_vnfd_archive_from_package(self):
         package = self.create_vnfd_package()
index 18b53d5..26d808a 100755 (executable)
@@ -33,19 +33,20 @@ import tornado.ioloop
 import tornado.web
 import tornado.httputil
 
-import gi
 import requests
 from tornado.platform.asyncio import AsyncIOMainLoop
 from tornado.ioloop import IOLoop
 from concurrent.futures.thread import ThreadPoolExecutor
 from concurrent.futures.process import ProcessPoolExecutor
+
+import gi
 gi.require_version('RwDts', '1.0')
 gi.require_version('RwPkgMgmtYang', '1.0')
+gi.require_version('RwProjectVnfdYang', '1.0')
 from gi.repository import (
         RwDts as rwdts,
         RwPkgMgmtYang,
-        RwVnfdYang
-
+        RwProjectVnfdYang as RwVnfdYang,
         )
 
 import rift.tasklets.rwlaunchpad.uploader as uploader
index 80d9387..5dec362 100644 (file)
@@ -40,8 +40,8 @@ from gi.repository import (
         RwLaunchpadYang as launchpadyang,
         RwDts as rwdts,
         RwVnfrYang,
-        RwVnfdYang,
-        RwNsdYang
+        RwProjectVnfdYang as RwVnfdYang,
+        RwProjectNsdYang as RwNsdYang,
         )
 
 import utest_mon_params
index e3ae5cf..1b5c787 100644 (file)
@@ -21,7 +21,7 @@ import json
 from gi.repository import (
     RwDts as rwdts,
     RwTypes,
-    RwVnfdYang,
+    RwProjectVnfdYang as RwVnfdYang,
     RwYang
     )
 import rift.tasklets
@@ -281,7 +281,7 @@ class VnfdPublisher(object):
 
             data = vnfd.to_json(model)
 
-            key = "vnfd:vnfd-catalog"
+            key = "project-vnfd:vnfd-catalog"
             newdict = json.loads(data)
             if key in newdict:
                 data = json.dumps(newdict[key])
index 0797b55..139302b 100755 (executable)
@@ -35,7 +35,7 @@ from enum import Enum
 
 import gi
 gi.require_version('RwYang', '1.0')
-gi.require_version('RwNsdYang', '1.0')
+gi.require_version('ProjectNsdYang', '1.0')
 gi.require_version('RwDts', '1.0')
 gi.require_version('RwNsmYang', '1.0')
 gi.require_version('RwNsrYang', '1.0')
@@ -46,7 +46,7 @@ from gi.repository import (
     RwYang,
     RwNsrYang,
     NsrYang,
-    NsdYang,
+    ProjectNsdYang as NsdYang,
     RwVlrYang,
     VnfrYang,
     RwVnfrYang,
@@ -650,7 +650,7 @@ class VirtualLinkRecord(object):
         for conn in self.vld_msg.vnfd_connection_point_ref:
             for vnfr in vnfrs:
                 if (vnfr.vnfd.id == conn.vnfd_id_ref and
-                        vnfr.member_vnf_index == conn.member_vnf_index_ref and
+                        str(vnfr.member_vnf_index) == conn.member_vnf_index_ref and
                         self.cloud_account_name == vnfr.cloud_account_name and
                         self.om_datacenter_name == vnfr.om_datacenter_name):
                     cp_entry = nsr_vlr.vnfr_connection_point_ref.add()
@@ -1086,7 +1086,7 @@ class VirtualNetworkFunctionRecord(object):
                 for vnfd_cp in vlr.vld_msg.vnfd_connection_point_ref:
                     if (vnfd_cp.vnfd_id_ref == self._vnfd.id and
                             vnfd_cp.vnfd_connection_point_ref == conn.name and
-                            vnfd_cp.member_vnf_index_ref == self.member_vnf_index and
+                            vnfd_cp.member_vnf_index_ref == str(self.member_vnf_index) and
                              vlr.cloud_account_name == self.cloud_account_name):
                         self._log.debug("Found VLR for cp_name:%s and vnf-index:%d",
                                         conn.name, self.member_vnf_index)
@@ -1094,6 +1094,8 @@ class VirtualNetworkFunctionRecord(object):
             return None
 
         # For every connection point in the VNFD fill in the identifier
+        self._log.debug("Add connection point for VNF %s: %s",
+                        self.vnfr_msg.name, self._vnfd.connection_point)
         for conn_p in self._vnfd.connection_point:
             cpr = VnfrYang.YangData_RwProject_Project_VnfrCatalog_Vnfr_ConnectionPoint()
             cpr.name = conn_p.name
@@ -1125,9 +1127,6 @@ class VirtualNetworkFunctionRecord(object):
         self._log.info("Created VNF with xpath %s and vnfr %s",
                        self.xpath, self.vnfr_msg)
 
-        self._log.info("Instantiated VNFR with xpath %s and vnfd %s, vnfr %s",
-                       self.xpath, self._vnfd, self.vnfr_msg)
-
     @asyncio.coroutine
     def update_state(self, vnfr_msg):
         """ Update this VNFR"""
@@ -1444,7 +1443,7 @@ class NetworkServiceRecord(object):
         """  Fetch Cloud Account for the passed vnfd id """
         if self._nsr_cfg_msg.vnf_cloud_account_map:
            vim_accounts = [(vnf.cloud_account,vnf.om_datacenter)  for vnf in self._nsr_cfg_msg.vnf_cloud_account_map \
-                           if vnfd_member_index == vnf.member_vnf_index_ref]
+                           if str(vnfd_member_index) == vnf.member_vnf_index_ref]
            if vim_accounts and vim_accounts[0]:
                return vim_accounts[0]
         return (self.cloud_account_name,self.om_datacenter_name)
@@ -2039,7 +2038,7 @@ class NetworkServiceRecord(object):
         for group in self.nsd_msg.placement_groups:
             for member_vnfd in group.member_vnfd:
                 if (member_vnfd.vnfd_id_ref == vnfd_msg.id) and \
-                   (member_vnfd.member_vnf_index_ref == const_vnfd.member_vnf_index):
+                   (member_vnfd.member_vnf_index_ref == str(const_vnfd.member_vnf_index)):
                     group_info = self.resolve_placement_group_cloud_construct(group)
                     if group_info is None:
                         self._log.error("Could not resolve cloud-construct for placement group: %s", group.name)
@@ -2235,7 +2234,7 @@ class NetworkServiceRecord(object):
     def nsd_xpath(self):
         """ Return NSD config xpath."""
         return self._project.add_project((
-            "C,/nsd:nsd-catalog/nsd:nsd[nsd:id = '{}']"
+            "C,/project-nsd:nsd-catalog/project-nsd:nsd[project-nsd:id = '{}']"
         ).format(self.nsd_id))
 
     @asyncio.coroutine
@@ -2780,7 +2779,7 @@ class NetworkServiceDescriptor(object):
     def path_for_id(nsd_id):
         """ Return path for the passed nsd_id"""
         return self._nsm._project.add_project(
-            "C,/nsd:nsd-catalog/nsd:nsd[nsd:id = '{}'".
+            "C,/project-nsd:nsd-catalog/project-nsd:nsd[project-nsd:id = '{}'".
             format(nsd_id))
 
     def path(self):
@@ -2794,7 +2793,7 @@ class NetworkServiceDescriptor(object):
 
 class NsdDtsHandler(object):
     """ The network service descriptor DTS handler """
-    XPATH = "C,/nsd:nsd-catalog/nsd:nsd"
+    XPATH = "C,/project-nsd:nsd-catalog/project-nsd:nsd"
 
     def __init__(self, dts, log, loop, nsm):
         self._dts = dts
@@ -2900,7 +2899,7 @@ class NsdDtsHandler(object):
 
 class VnfdDtsHandler(object):
     """ DTS handler for VNFD config changes """
-    XPATH = "C,/vnfd:vnfd-catalog/vnfd:vnfd"
+    XPATH = "C,/project-vnfd:vnfd-catalog/project-vnfd:vnfd"
 
     def __init__(self, dts, log, loop, nsm):
         self._dts = dts
index e3b7f1f..9112f48 100644 (file)
@@ -1,6 +1,6 @@
 
-# 
-#   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.
@@ -19,7 +19,10 @@ import time
 
 from enum import Enum
 
-from gi.repository import NsdYang, NsrYang
+from gi.repository import (
+    ProjectNsdYang as NsdYang,
+    NsrYang
+    )
 
 
 class ScalingGroupIndexExists(Exception):
index abf73ae..955f566 100755 (executable)
@@ -1219,7 +1219,7 @@ class VirtualNetworkFunctionRecord(object):
     @staticmethod
     def vnfd_xpath(vnfd_id):
         """ VNFD xpath associated with this VNFR """
-        return ("C,/vnfd:vnfd-catalog/vnfd:vnfd[vnfd:id = '{}']".
+        return ("C,/project-vnfd:vnfd-catalog/project-vnfd:vnfd[project-vnfd:id = '{}']".
                 format(vnfd_id))
 
     @property
@@ -1989,7 +1989,7 @@ class VirtualNetworkFunctionRecord(object):
 
 class VnfdDtsHandler(object):
     """ DTS handler for VNFD config changes """
-    XPATH = "C,/vnfd:vnfd-catalog/vnfd:vnfd"
+    XPATH = "C,/project-vnfd:vnfd-catalog/project-vnfd:vnfd"
 
     def __init__(self, dts, log, loop, vnfm):
         self._dts = dts
index c12bf51..9932874 100644 (file)
@@ -57,16 +57,16 @@ module rw-launchpad
     prefix "rwcal";
   }
 
-  import rw-vnfd {
-    prefix "rw-vnfd";
+  import rw-project-vnfd {
+    prefix "rw-project-vnfd";
   }
 
   import vld {
     prefix "vld";
   }
 
-  import rw-nsd {
-    prefix "rw-nsd";
+  import rw-project-nsd {
+    prefix "rw-project-nsd";
   }
 
   import rw-cloud {
index c07d200..f182114 100644 (file)
@@ -43,30 +43,38 @@ module rw-nsm
     prefix "inet";
   }
 
-  import rw-nsd {
-    prefix "rw-nsd";
+  import rw-project-nsd {
+    prefix "rw-project-nsd";
   }
-  import nsd {
-    prefix "nsd";
+
+  import project-nsd {
+    prefix "project-nsd";
   }
+
   import rw-nsr {
     prefix "rw-nsr";
   }
+
   import vld {
     prefix "vld";
   }
+
   import rw-vlr {
     prefix "rw-vlr";
   }
+
   import rw-vns {
     prefix "rw-vns";
   }
-  import rw-vnfd {
-    prefix "rw-vnfd";
+
+  import rw-project-vnfd {
+    prefix "rw-project-vnfd";
   }
-  import vnfd {
-    prefix "vnfd";
+
+  import project-vnfd {
+    prefix "project-vnfd";
   }
+
   import rw-vnfr {
     prefix "rw-vnfr";
   }
index 25e1abb..225633b 100644 (file)
@@ -47,8 +47,8 @@ module rw-vnfm
     prefix "rw-vns";
   }
 
-  import rw-vnfd {
-    prefix "rw-vnfd";
+  import rw-project-vnfd {
+    prefix "rw-project-vnfd";
   }
 
   import rw-vnfr {
index a3c565b..8510fa6 100644 (file)
@@ -23,13 +23,13 @@ import subprocess
 import tempfile
 
 from gi.repository import (
-    NsdYang,
+    ProjectNsdYang as NsdYang,
     NsrYang,
     RwNsrYang,
     RwVnfrYang,
     VnfrYang,
     VldYang,
-    RwVnfdYang,
+    RwProjectVnfdYang as RwVnfdYang,
     RwLaunchpadYang,
     RwBaseYang
 )
index fb4bd61..bf46ac8 100755 (executable)
@@ -33,12 +33,12 @@ import time
 import uuid
 
 from gi.repository import (
-    NsdYang,
+    ProjectNsdYang as NsdYang,
     NsrYang,
     RwNsrYang,
     VnfrYang,
     VldYang,
-    RwVnfdYang,
+    RwProjectVnfdYang as RwVnfdYang,
     RwLaunchpadYang,
     RwBaseYang
 )
@@ -210,7 +210,7 @@ class TestMultiVmVnfSlb(object):
         nsd = catalog.nsd[0]
 
         input_parameters = []
-        descr_xpath = "/rw-project:project/nsd:nsd-catalog/nsd:nsd[nsd:id='%s']/nsd:description" % nsd.id
+        descr_xpath = "/rw-project:project/project-nsd:nsd-catalog/project-nsd:nsd[project-nsd:id='%s']/project-nsd:description" % nsd.id
         descr_value = "New NSD Description"
         in_param_id = str(uuid.uuid4())
 
index b05a23c..ae9f404 100755 (executable)
@@ -33,12 +33,12 @@ import time
 import uuid
 
 from gi.repository import (
-    NsdYang,
+    ProjectNsdYang as NsdYang,
     NsrYang,
     RwNsrYang,
     VnfrYang,
     VldYang,
-    RwVnfdYang,
+    RwProjectVnfdYang as RwVnfdYang,
     RwLaunchpadYang,
     RwBaseYang
 )
@@ -206,7 +206,7 @@ class TestMultiVmVnfTrafgenApp(object):
         nsd = catalog.nsd[0]
 
         input_parameters = []
-        descr_xpath = "/rw-project:project/nsd:nsd-catalog/nsd:nsd[nsd:id='%s']/nsd:description" % nsd.id
+        descr_xpath = "/rw-project:project/project-nsd:nsd-catalog/project-nsd:nsd[project-nsd:id='%s']/project-nsd:description" % nsd.id
         descr_value = "New NSD Description"
         in_param_id = str(uuid.uuid4())
 
index 3cf2c52..8e203d9 100644 (file)
 
 import pytest
 
-from gi.repository import NsrYang, RwNsrYang, RwVnfrYang, NsdYang, RwNsdYang
+from gi.repository import (
+    NsrYang,
+    RwNsrYang,
+    RwVnfrYang,
+    ProjectNsdYang as NsdYang,
+    RwProjectNsdYang as RwNsdYang
+    )
 import rift.auto.session
 
 @pytest.fixture(scope='module')
index ef4949c..49cfcb5 100644 (file)
@@ -41,18 +41,19 @@ import rift.mano.examples.ping_pong_nsd as ping_pong
 
 import gi
 gi.require_version('RwNsrYang', '1.0')
-gi.require_version('RwVnfdYang', '1.0')
+gi.require_version('ProjectNsdYang', '1.0')
+gi.require_version('RwProjectVnfdYang', '1.0')
 gi.require_version('RwLaunchpadYang', '1.0')
 gi.require_version('RwBaseYang', '1.0')
 
 from gi.repository import (
-    NsdYang,
+    ProjectNsdYang as NsdYang,
     RwNsrYang,
     RwVnfrYang,
     NsrYang,
     VnfrYang,
     VldYang,
-    RwVnfdYang,
+    RwProjectVnfdYang as RwVnfdYang,
     RwLaunchpadYang,
     RwBaseYang
 )
@@ -409,7 +410,7 @@ class TestPingPongStart(object):
         nsd = catalog.nsd[0]
 
         input_parameters = []
-        descr_xpath = "/rw-project:project/nsd:nsd-catalog/nsd:nsd[nsd:id='%s']/nsd:vendor" % nsd.id
+        descr_xpath = "/rw-project:project/project-nsd:nsd-catalog/project-nsd:nsd[project-nsd:id='%s']/project-nsd:vendor" % nsd.id
         descr_value = "automation"
         in_param_id = str(uuid.uuid4())
 
@@ -597,7 +598,7 @@ class TestUpdateNsr(object):
         nsd = catalog.nsd[0]
 
         input_parameters = []
-        descr_xpath = "/rw-project:project/nsd:nsd-catalog/nsd:nsd[nsd:id='%s']/nsd:vendor" % nsd.id
+        descr_xpath = "/rw-project:project/project-nsd:nsd-catalog/project-nsd:nsd[project-nsd:id='%s']/project-nsd:vendor" % nsd.id
         descr_value = "automation"
         in_param_id = str(uuid.uuid4())
 
index 9f1cd0a..81eeeb0 100644 (file)
@@ -26,14 +26,14 @@ import gi
 import re
 gi.require_version('RwNsrYang', '1.0')
 from gi.repository import (
-        NsdYang,
+        ProjectNsdYang as NsdYang,
         RwBaseYang,
         RwConmanYang,
         RwNsrYang,
-        RwNsdYang,
+        RwProjectNsdYang as RwNsdYang,
         RwVcsYang,
         RwVlrYang,
-        RwVnfdYang,
+        RwProjectVnfdYang as RwVnfdYang,
         RwVnfrYang,
         VlrYang,
         VnfrYang,
index 0878db7..d38509f 100644 (file)
@@ -35,10 +35,10 @@ import rift.auto.descriptor
 
 from gi.repository import (
     NsrYang,
-    NsdYang,
+    ProjectNsdYang as NsdYang,
     VnfrYang,
     RwNsrYang,
-    RwNsdYang,
+    RwProjectNsdYang as RwNsdYang,
     RwVnfrYang,
 )
 
index ecec834..07a31dd 100644 (file)
@@ -37,19 +37,19 @@ import rift.auto.session
 
 import gi
 gi.require_version('RwNsrYang', '1.0')
-gi.require_version('RwVnfdYang', '1.0')
+gi.require_version('RwProjectVnfdYang', '1.0')
 gi.require_version('RwLaunchpadYang', '1.0')
 gi.require_version('RwBaseYang', '1.0')
 
 from gi.repository import (
     RwcalYang,
-    NsdYang,
+    ProjectNsdYang as NsdYang,
     RwNsrYang,
     RwVnfrYang,
     NsrYang,
     VnfrYang,
     VldYang,
-    RwVnfdYang,
+    RwProjectVnfdYang as RwVnfdYang,
     RwLaunchpadYang,
     RwBaseYang
 )
@@ -333,7 +333,7 @@ class TestNsrStart(object):
         nsd = catalog.nsd[0]
 
         input_parameters = []
-        descr_xpath = "/rw-project:project/nsd:nsd-catalog/nsd:nsd[nsd:id='%s']/nsd:description" % nsd.id
+        descr_xpath = "/rw-project:project/project-nsd:nsd-catalog/project-nsd:nsd[project-nsd:id='%s']/project-nsd:description" % nsd.id
         descr_value = "New NSD Description"
         in_param_id = str(uuid.uuid4())
 
index 60ba82a..e952b69 100755 (executable)
@@ -27,7 +27,7 @@ import argparse
 import subprocess
 
 import gi
-from gi.repository import RwVnfdYang
+from gi.repository import RwProjectVnfdYang as RwVnfdYang
 from gi.repository import RwVnfrYang
 
 import rift.auto.proxy
index 3835ab5..d85088b 100755 (executable)
@@ -81,8 +81,8 @@ if sys.version_info < (3, 4, 4):
 class XPaths(object):
     @staticmethod
     def nsd(k=None):
-        return ("C,/nsd:nsd-catalog/nsd:nsd" +
-                ("[nsd:id='{}']".format(k) if k is not None else ""))
+        return ("C,/project-nsd:nsd-catalog/project-nsd:nsd" +
+                ("[project-nsd:id='{}']".format(k) if k is not None else ""))
 
     @staticmethod
     def vld(k=None):
@@ -91,8 +91,8 @@ class XPaths(object):
 
     @staticmethod
     def vnfd(k=None):
-        return ("C,/vnfd:vnfd-catalog/vnfd:vnfd" +
-                ("[vnfd:id='{}']".format(k) if k is not None else ""))
+        return ("C,/project-vnfd:vnfd-catalog/project-vnfd:vnfd" +
+                ("[project-vnfd:id='{}']".format(k) if k is not None else ""))
 
     @staticmethod
     def vnfr(k=None):
@@ -549,7 +549,7 @@ class PingPongNsrConfigPublisher(object):
 
         inputs = nsryang.YangData_RwProject_Project_NsInstanceConfig_Nsr_InputParameter()
         inputs.xpath = self.project.add_project(
-            "/nsd:nsd-catalog/nsd:nsd[nsd:id={}]/nsd:name".format(ping_pong.nsd_id))
+            "/project-nsd:nsd-catalog/project-nsd:nsd[project-nsd:id={}]/project-nsd:name".format(ping_pong.nsd_id))
         inputs.value = "inigo montoya"
 
         fast_cpu = {'metadata_key': 'FASTCPU', 'metadata_value': 'True'}
@@ -1057,7 +1057,7 @@ class ManoTestCase(rift.test.dts.AbstractDTSTest):
 
             nsr_config = nsr_configs[0]
             self.assertEqual(
-                    "/rw-project:project/nsd:nsd-catalog/nsd:nsd[nsd:id={}]/nsd:name".format(self.ping_pong.nsd_id),
+                    "/rw-project:project/project-nsd:nsd-catalog/project-nsd:nsd[project-nsd:id={}]/project-nsd:name".format(self.ping_pong.nsd_id),
                     nsr_config.input_parameter[0].xpath,
                     )
 
index feb0b99..75e30d3 100644 (file)
@@ -41,10 +41,10 @@ gi.require_version('RwIwpYang', '1.0')
 gi.require_version('RwNsrYang', '1.0')
 gi.require_version('RwResourceMgrYang', '1.0')
 gi.require_version('RwConmanYang', '1.0')
-gi.require_version('RwVnfdYang', '1.0')
+gi.require_version('RwProjectVnfdYang', '1.0')
 
 from gi.repository import (
-        NsdYang,
+        ProjectNsdYang as NsdYang,
         NsrYang,
         RwBaseYang,
         RwCloudYang,
@@ -54,7 +54,7 @@ from gi.repository import (
         RwNsrYang,
         RwResourceMgrYang,
         RwConmanYang,
-        RwVnfdYang,
+        RwProjectVnfdYang as RwVnfdYang,
         VldYang,
         )
 
index 4e73aac..9b2fa8e 100644 (file)
@@ -39,13 +39,13 @@ gi.require_version('RwCloudYang', '1.0')
 gi.require_version('RwIwpYang', '1.0')
 gi.require_version('RwNsmYang', '1.0')
 gi.require_version('RwNsrYang', '1.0')
-gi.require_version('RwNsrYang', '1.0')
+gi.require_version('ProjectNsdYang', '1.0')
 gi.require_version('RwResourceMgrYang', '1.0')
 gi.require_version('RwConmanYang', '1.0')
-gi.require_version('RwVnfdYang', '1.0')
+gi.require_version('RwProjectVnfdYang', '1.0')
 
 from gi.repository import (
-        NsdYang,
+        ProjectNsdYang as NsdYang,
         NsrYang,
         RwBaseYang,
         RwCloudYang,
@@ -55,7 +55,7 @@ from gi.repository import (
         RwNsrYang,
         RwResourceMgrYang,
         RwConmanYang,
-        RwVnfdYang,
+        RwProjectVnfdYang as RwVnfdYang,
         VldYang,
         )
 
index 8b41cb1..8957dfe 100644 (file)
@@ -39,13 +39,13 @@ gi.require_version('RwCloudYang', '1.0')
 gi.require_version('RwIwpYang', '1.0')
 gi.require_version('RwlogMgmtYang', '1.0')
 gi.require_version('RwNsmYang', '1.0')
-gi.require_version('RwNsmYang', '1.0')
+gi.require_version('ProjectNsdYang', '1.0')
 gi.require_version('RwResourceMgrYang', '1.0')
 gi.require_version('RwConmanYang', '1.0')
-gi.require_version('RwVnfdYang', '1.0')
+gi.require_version('RwProjectVnfdYang', '1.0')
 
 from gi.repository import (
-        NsdYang,
+        ProjectNsdYang as NsdYang,
         NsrYang,
         RwBaseYang,
         RwCloudYang,
@@ -55,7 +55,7 @@ from gi.repository import (
         RwNsrYang,
         RwResourceMgrYang,
         RwConmanYang,
-        RwVnfdYang,
+        RwProjectVnfdYang as RwVnfdYang,
         VldYang,
         )
 
@@ -182,7 +182,7 @@ def create_nsr_from_nsd_id(nsd_id):
     nsr.cloud_account = "openstack"
 
     param = NsrYang.YangData_RwProject_Project_NsInstanceConfig_Nsr_InputParameter()
-    param.xpath = '/rw-project:project/nsd:nsd-catalog/nsd:nsd/nsd:vendor'
+    param.xpath = '/rw-project:project/project-nsd:nsd-catalog/project-nsd:nsd/project-nsd:vendor'
     param.value = "rift-o-matic"
 
     nsr.input_parameter.append(param)
index 3470b75..bd51e1d 100644 (file)
@@ -35,7 +35,7 @@ import uuid
 import gi
 gi.require_version('RwIwpYang', '1.0')
 gi.require_version('RwNsrYang', '1.0')
-gi.require_version('RwVnfdYang', '1.0')
+gi.require_version('RwProjectVnfdYang', '1.0')
 gi.require_version('RwCloudYang', '1.0')
 gi.require_version('RwBaseYang', '1.0')
 gi.require_version('RwResourceMgrYang', '1.0')
@@ -44,7 +44,19 @@ gi.require_version('RwNsmYang', '1.0')
 
 
 
-from gi.repository import RwIwpYang, NsdYang, NsrYang, RwNsrYang, VldYang, RwVnfdYang, RwCloudYang, RwBaseYang, RwResourceMgrYang, RwConmanYang, RwNsmYang
+from gi.repository import (
+    RwIwpYang,
+    ProjectNsdYang as NsdYang,
+    NsrYang,
+    RwNsrYang,
+    VldYang,
+    RwProjectVnfdYang as RwVnfdYang,
+    RwCloudYang,
+    RwBaseYang,
+    RwResourceMgrYang,
+    RwConmanYang,
+    RwNsmYang
+)
 
 logging.basicConfig(level=logging.DEBUG)
 
index 578c0af..059217d 100644 (file)
@@ -35,16 +35,26 @@ import uuid
 import gi
 gi.require_version('RwIwpYang', '1.0')
 gi.require_version('RwNsrYang', '1.0')
-gi.require_version('RwVnfdYang', '1.0')
+gi.require_version('RwProjectVnfdYang', '1.0')
 gi.require_version('RwCloudYang', '1.0')
 gi.require_version('RwBaseYang', '1.0')
 gi.require_version('RwResourceMgrYang', '1.0')
 gi.require_version('RwConmanYang', '1.0')
 gi.require_version('RwNsmYang', '1.0')
 
-
-
-from gi.repository import RwIwpYang, NsdYang, NsrYang, RwNsrYang, VldYang, RwVnfdYang, RwCloudYang, RwBaseYang, RwResourceMgrYang, RwConmanYang, RwNsmYang
+from gi.repository import (
+    RwIwpYang,
+    ProjectNsdYang as NsdYang,
+    NsrYang,
+    RwNsrYang,
+    VldYang,
+    RwProjectVnfdYang as RwVnfdYang,
+    RwCloudYang,
+    RwBaseYang,
+    RwResourceMgrYang,
+    RwConmanYang,
+    RwNsmYang
+    )
 
 logging.basicConfig(level=logging.DEBUG)
 
index 405bee6..db88015 100644 (file)
@@ -35,7 +35,7 @@ import uuid
 import gi
 gi.require_version('RwIwpYang', '1.0')
 gi.require_version('RwNsrYang', '1.0')
-gi.require_version('RwVnfdYang', '1.0')
+gi.require_version('RwProjectVnfdYang', '1.0')
 gi.require_version('RwCloudYang', '1.0')
 gi.require_version('RwBaseYang', '1.0')
 gi.require_version('RwResourceMgrYang', '1.0')
@@ -43,7 +43,19 @@ gi.require_version('RwConmanYang', '1.0')
 gi.require_version('RwNsmYang', '1.0')
 
 
-from gi.repository import RwIwpYang, NsdYang, NsrYang, RwNsrYang, VldYang, RwVnfdYang, RwCloudYang, RwBaseYang, RwResourceMgrYang, RwConmanYang, RwNsmYang
+from gi.repository import (
+    RwIwpYang,
+    ProjectNsdYang,
+    NsrYang,
+    RwNsrYang,
+    VldYang,
+    RwProjectVnfdYang as RwVnfdYang,
+    RwCloudYang,
+    RwBaseYang,
+    RwResourceMgrYang,
+    RwConmanYang,
+    RwNsmYang
+    )
 
 logging.basicConfig(level=logging.DEBUG)
 
index 9ed28fd..deaca6b 100755 (executable)
@@ -31,10 +31,10 @@ gi.require_version('RwDtsYang', '1.0')
 from gi.repository import (
         RwLaunchpadYang as launchpadyang,
         RwDts as rwdts,
-        RwVnfdYang,
+        RwProjectVnfdYang as RwVnfdYang,
         RwVnfrYang,
         RwNsrYang,
-        RwNsdYang,
+        RwProjectNsdYang as RwNsdYang,
         VnfrYang
         )
 
@@ -170,4 +170,4 @@ def main(argv=sys.argv[1:]):
             )
 
 if __name__ == '__main__':
-    main()
\ No newline at end of file
+    main()
index fa99751..9f73d29 100755 (executable)
@@ -26,7 +26,7 @@ import uuid
 import xmlrunner
 
 from gi.repository import (
-        NsdYang,
+        ProjectNsdYang as NsdYang,
         NsrYang,
         )
 
@@ -57,15 +57,15 @@ class TestGiXpath(unittest.TestCase):
                 )
 
         # Retrieve the NSD using and xpath expression
-        xpath = '/rw-project:project/nsd:nsd-catalog/nsd:nsd[nsd:id={}]'.format(nsd_id)
+        xpath = '/rw-project:project/project-nsd:nsd-catalog/project-nsd:nsd[project-nsd:id={}]'.format(nsd_id)
         nsd = rwxpath.getxattr(nsd_catalog, xpath)
 
         self.assertEqual(nsd_id, nsd.id)
 
         # Modified the name of the NSD using an xpath expression
-        rwxpath.setxattr(nsd_catalog, xpath + "/nsd:name", "test-name")
+        rwxpath.setxattr(nsd_catalog, xpath + "/project-nsd:name", "test-name")
 
-        name = rwxpath.getxattr(nsd_catalog, xpath + "/nsd:name")
+        name = rwxpath.getxattr(nsd_catalog, xpath + "/project-nsd:name")
         self.assertEqual("test-name", name)
 
     def test_nsd_scalar_fields(self):
@@ -77,16 +77,16 @@ class TestGiXpath(unittest.TestCase):
         nsd = NsdYang.YangData_RwProject_Project_NsdCatalog_Nsd()
 
         # Check that the unset fields are in fact set to None
-        self.assertEqual(None, rwxpath.getxattr(nsd, "/rw-project:project/nsd:nsd-catalog/nsd:nsd/nsd:name"))
-        self.assertEqual(None, rwxpath.getxattr(nsd, "/rw-project:project/nsd:nsd-catalog/nsd:nsd/nsd:short-name"))
+        self.assertEqual(None, rwxpath.getxattr(nsd, "/rw-project:project/project-nsd:nsd-catalog/project-nsd:nsd/project-nsd:name"))
+        self.assertEqual(None, rwxpath.getxattr(nsd, "/rw-project:project/project-nsd:nsd-catalog/project-nsd:nsd/project-nsd:short-name"))
 
         # Set the values of the 'name' and 'short-name' fields
-        rwxpath.setxattr(nsd, "/rw-project:project/nsd:nsd-catalog/nsd:nsd/nsd:name", "test-name")
-        rwxpath.setxattr(nsd, "/rw-project:project/nsd:nsd-catalog/nsd:nsd/nsd:short-name", "test-short-name")
+        rwxpath.setxattr(nsd, "/rw-project:project/project-nsd:nsd-catalog/project-nsd:nsd/project-nsd:name", "test-name")
+        rwxpath.setxattr(nsd, "/rw-project:project/project-nsd:nsd-catalog/project-nsd:nsd/project-nsd:short-name", "test-short-name")
 
         # Check that the 'name' and 'short-name' fields are correctly set
-        self.assertEqual(nsd.name, rwxpath.getxattr(nsd, "/rw-project:project/nsd:nsd-catalog/nsd:nsd/nsd:name"))
-        self.assertEqual(nsd.short_name, rwxpath.getxattr(nsd, "/rw-project:project/nsd:nsd-catalog/nsd:nsd/nsd:short-name"))
+        self.assertEqual(nsd.name, rwxpath.getxattr(nsd, "/rw-project:project/project-nsd:nsd-catalog/project-nsd:nsd/project-nsd:name"))
+        self.assertEqual(nsd.short_name, rwxpath.getxattr(nsd, "/rw-project:project/project-nsd:nsd-catalog/project-nsd:nsd/project-nsd:short-name"))
 
 
 class TestInputParameterSubstitution(unittest.TestCase):
@@ -122,7 +122,7 @@ class TestInputParameterSubstitution(unittest.TestCase):
         # Define which parameters may be modified
         nsd.input_parameter_xpath.append(
                 NsdYang.YangData_RwProject_Project_NsdCatalog_Nsd_InputParameterXpath(
-                    xpath="/rw-project:project/nsd:nsd-catalog/nsd:nsd/nsd:name",
+                    xpath="/rw-project:project/project-nsd:nsd-catalog/project-nsd:nsd/project-nsd:name",
                     label="NSD Name",
                     )
                 )
@@ -131,11 +131,11 @@ class TestInputParameterSubstitution(unittest.TestCase):
         nsr_config = NsrYang.YangData_RwProject_Project_NsInstanceConfig_Nsr()
         nsr_config.input_parameter.extend([
             NsrYang.YangData_RwProject_Project_NsInstanceConfig_Nsr_InputParameter(
-                xpath="/rw-project:project/nsd:nsd-catalog/nsd:nsd/nsd:name",
+                xpath="/rw-project:project/project-nsd:nsd-catalog/project-nsd:nsd/project-nsd:name",
                 value="alice",
                 ),
             NsrYang.YangData_RwProject_Project_NsInstanceConfig_Nsr_InputParameter(
-                xpath="/rw-project:project/nsd:nsd-catalog/nsd:nsd/nsd:short-name",
+                xpath="/rw-project:project/project-nsd:nsd-catalog/project-nsd:nsd/project-nsd:short-name",
                 value="alice",
                 ),
             ])
@@ -160,11 +160,11 @@ class TestInputParameterSubstitution(unittest.TestCase):
         # Define which parameters may be modified
         nsd.input_parameter_xpath.extend([
                 NsdYang.YangData_RwProject_Project_NsdCatalog_Nsd_InputParameterXpath(
-                    xpath="/rw-project:project/nsd:nsd-catalog/nsd:nsd/nsd:name",
+                    xpath="/rw-project:project/project-nsd:nsd-catalog/project-nsd:nsd/project-nsd:name",
                     label="NSD Name",
                     ),
                 NsdYang.YangData_RwProject_Project_NsdCatalog_Nsd_InputParameterXpath(
-                    xpath="/rw-project:project/nsd:nsd-catalog/nsd:nsd/nsd:short-name",
+                    xpath="/rw-project:project/project-nsd:nsd-catalog/project-nsd:nsd/project-nsd:short-name",
                     label="NSD Short Name",
                     ),
                 ])
@@ -173,11 +173,11 @@ class TestInputParameterSubstitution(unittest.TestCase):
         nsr_config = NsrYang.YangData_RwProject_Project_NsInstanceConfig_Nsr()
         nsr_config.input_parameter.extend([
             NsrYang.YangData_RwProject_Project_NsInstanceConfig_Nsr_InputParameter(
-                xpath="/rw-project:project/nsd:nsd-catalog/nsd:nsd/nsd:name",
+                xpath="/rw-project:project/project-nsd:nsd-catalog/project-nsd:nsd/project-nsd:name",
                 value="robert",
                 ),
             NsrYang.YangData_RwProject_Project_NsInstanceConfig_Nsr_InputParameter(
-                xpath="/rw-project:project/nsd:nsd-catalog/nsd:nsd/nsd:short-name",
+                xpath="/rw-project:project/project-nsd:nsd-catalog/project-nsd:nsd/project-nsd:short-name",
                 value="bob",
                 ),
             ])