From 4f810f24007e506d87a0f17886ada38d0f82c554 Mon Sep 17 00:00:00 2001 From: Philip Joseph Date: Tue, 7 Mar 2017 23:09:10 +0530 Subject: [PATCH] New feature: Support rooted descriptors and descriptors under project Signed-off-by: Philip Joseph --- common/python/rift/mano/config_data/config.py | 4 +- .../mano/config_data/test/test_converter.py | 5 +- .../rift/mano/dts/subscriber/ns_subscriber.py | 2 +- .../subscriber/test/utest_subscriber_dts.py | 14 +- .../mano/dts/subscriber/vnf_subscriber.py | 2 +- .../rwmano/syntax/mano_parameter.py | 2 +- .../rwmano/syntax/mano_template.py | 8 +- .../rwmano/tosca/tosca_nfv_vnf.py | 4 +- common/python/rift/mano/utils/project.py | 2 +- .../yang_translator/rwmano/yang/yang_nsd.py | 2 +- common/python/test/utest_config_data.py | 4 +- common/python/test/utest_project.py | 2 +- common/rw_gen_package.py | 8 +- examples/ping_pong_ns/config_desc.py | 21 +- .../rift/mano/examples/ping_pong_nsd.py | 67 +- .../python/rift/openmano/rift2openmano.py | 8 +- models/openmano/src/openmano2rift.py | 13 +- models/plugins/yang/CMakeLists.txt | 4 + models/plugins/yang/nsd-base.yang | 791 ++++++++++++ models/plugins/yang/nsd.yang | 1076 ++--------------- models/plugins/yang/nsr.yang | 54 +- models/plugins/yang/project-nsd.yang | 437 +++++++ models/plugins/yang/project-vnfd.yang | 57 + models/plugins/yang/rw-nsd-base.yang | 49 + models/plugins/yang/rw-nsd.yang | 28 +- models/plugins/yang/rw-nsr.yang | 6 +- models/plugins/yang/rw-project-nsd.yang | 51 + models/plugins/yang/rw-project-vnfd.yang | 54 + models/plugins/yang/rw-vnfd-base.yang | 119 ++ models/plugins/yang/rw-vnfd.yang | 85 +- models/plugins/yang/rw-vnfr.yang | 12 +- models/plugins/yang/vld.yang | 14 +- models/plugins/yang/vnfd-base.yang | 532 ++++++++ models/plugins/yang/vnfd.yang | 516 +------- models/plugins/yang/vnfr.yang | 18 +- .../rwconmantasklet/rwconman_config.py | 10 +- rwcm/plugins/yang/rw-conman.yang | 8 + .../cli/cli_launchpad_schema_listing.txt | 12 +- .../rwautoscaler/test/utest_autoscaler_dts.py | 6 +- .../rift/package/convert.py | 112 +- .../rift/tasklets/rwlaunchpad/export.py | 8 +- .../rift/tasklets/rwlaunchpad/onboard.py | 10 +- .../rift/tasklets/rwlaunchpad/tasklet.py | 4 +- .../rift/tasklets/rwlaunchpad/uploader.py | 8 +- .../rwlaunchpadtasklet/scripts/onboard_pkg | 4 +- .../rwlaunchpadtasklet/test/utest_export.py | 7 +- .../test/utest_fileserver.py | 8 +- .../rwlaunchpadtasklet/test/utest_onboard.py | 8 +- .../rwlaunchpadtasklet/test/utest_package.py | 24 +- .../test/utest_uploader_app_dts.py | 7 +- .../rwmonparam/test/utest_mon_params_dts.py | 4 +- .../rift/tasklets/rwnsmtasklet/publisher.py | 4 +- .../tasklets/rwnsmtasklet/rwnsmtasklet.py | 25 +- .../rift/tasklets/rwnsmtasklet/scale_group.py | 9 +- .../tasklets/rwvnfmtasklet/rwvnfmtasklet.py | 4 +- rwlaunchpad/plugins/yang/rw-launchpad.yang | 8 +- rwlaunchpad/plugins/yang/rw-nsm.yang | 24 +- rwlaunchpad/plugins/yang/rw-vnfm.yang | 4 +- rwlaunchpad/ra/pytest/multivm_vnf/conftest.py | 4 +- .../multivm_vnf/test_multi_vm_vnf_slb.py | 6 +- .../multivm_vnf/test_multi_vm_vnf_trafgen.py | 6 +- .../ra/pytest/ns/haproxy/test_scaling.py | 8 +- .../ra/pytest/ns/pingpong/test_pingpong.py | 11 +- .../ra/pytest/ns/pingpong/test_records.py | 6 +- .../ra/pytest/ns/pingpong/test_scaling.py | 4 +- rwlaunchpad/ra/pytest/ns/test_onboard.py | 8 +- rwlaunchpad/ra/pytest/test_failover.py | 2 +- rwlaunchpad/test/mano_ut.py | 12 +- rwlaunchpad/test/pytest/lp_kt_utm_test.py | 6 +- .../test/pytest/lp_kt_utm_wims_test.py | 8 +- rwlaunchpad/test/pytest/lp_test.py | 10 +- .../test/pytest/lp_tg_2vrouter_ts_epa_test.py | 16 +- .../test/pytest/lp_tg_2vrouter_ts_test.py | 18 +- .../pytest/lp_tg_vrouter_ts_epa_sriov_test.py | 16 +- rwlaunchpad/test/utest_ro_account.py | 6 +- rwlaunchpad/test/utest_rwnsm.py | 34 +- 76 files changed, 2628 insertions(+), 1942 deletions(-) create mode 100644 models/plugins/yang/nsd-base.yang create mode 100644 models/plugins/yang/project-nsd.yang create mode 100644 models/plugins/yang/project-vnfd.yang create mode 100644 models/plugins/yang/rw-nsd-base.yang create mode 100644 models/plugins/yang/rw-project-nsd.yang create mode 100644 models/plugins/yang/rw-project-vnfd.yang create mode 100644 models/plugins/yang/rw-vnfd-base.yang create mode 100644 models/plugins/yang/vnfd-base.yang diff --git a/common/python/rift/mano/config_data/config.py b/common/python/rift/mano/config_data/config.py index 63a2e48d..e04475af 100644 --- a/common/python/rift/mano/config_data/config.py +++ b/common/python/rift/mano/config_data/config.py @@ -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): diff --git a/common/python/rift/mano/config_data/test/test_converter.py b/common/python/rift/mano/config_data/test/test_converter.py index 6169d739..0354c2be 100644 --- a/common/python/rift/mano/config_data/test/test_converter.py +++ b/common/python/rift/mano/config_data/test/test_converter.py @@ -17,7 +17,10 @@ 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 diff --git a/common/python/rift/mano/dts/subscriber/ns_subscriber.py b/common/python/rift/mano/dts/subscriber/ns_subscriber.py index a379b9a3..4258afa5 100644 --- a/common/python/rift/mano/dts/subscriber/ns_subscriber.py +++ b/common/python/rift/mano/dts/subscriber/ns_subscriber.py @@ -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): diff --git a/common/python/rift/mano/dts/subscriber/test/utest_subscriber_dts.py b/common/python/rift/mano/dts/subscriber/test/utest_subscriber_dts.py index bf7ae680..9479b163 100644 --- a/common/python/rift/mano/dts/subscriber/test/utest_subscriber_dts.py +++ b/common/python/rift/mano/dts/subscriber/test/utest_subscriber_dts.py @@ -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() diff --git a/common/python/rift/mano/dts/subscriber/vnf_subscriber.py b/common/python/rift/mano/dts/subscriber/vnf_subscriber.py index 85ec5894..524fb412 100644 --- a/common/python/rift/mano/dts/subscriber/vnf_subscriber.py +++ b/common/python/rift/mano/dts/subscriber/vnf_subscriber.py @@ -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") diff --git a/common/python/rift/mano/tosca_translator/rwmano/syntax/mano_parameter.py b/common/python/rift/mano/tosca_translator/rwmano/syntax/mano_parameter.py index 7df584f0..83e054fc 100644 --- a/common/python/rift/mano/tosca_translator/rwmano/syntax/mano_parameter.py +++ b/common/python/rift/mano/tosca_translator/rwmano/syntax/mano_parameter.py @@ -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): diff --git a/common/python/rift/mano/tosca_translator/rwmano/syntax/mano_template.py b/common/python/rift/mano/tosca_translator/rwmano/syntax/mano_template.py index edcbef6d..5300eba6 100644 --- a/common/python/rift/mano/tosca_translator/rwmano/syntax/mano_template.py +++ b/common/python/rift/mano/tosca_translator/rwmano/syntax/mano_template.py @@ -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 diff --git a/common/python/rift/mano/tosca_translator/rwmano/tosca/tosca_nfv_vnf.py b/common/python/rift/mano/tosca_translator/rwmano/tosca/tosca_nfv_vnf.py index 6356601c..29beca1b 100644 --- a/common/python/rift/mano/tosca_translator/rwmano/tosca/tosca_nfv_vnf.py +++ b/common/python/rift/mano/tosca_translator/rwmano/tosca/tosca_nfv_vnf.py @@ -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: diff --git a/common/python/rift/mano/utils/project.py b/common/python/rift/mano/utils/project.py index 637c0caf..65d76543 100644 --- a/common/python/rift/mano/utils/project.py +++ b/common/python/rift/mano/utils/project.py @@ -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: diff --git a/common/python/rift/mano/yang_translator/rwmano/yang/yang_nsd.py b/common/python/rift/mano/yang_translator/rwmano/yang/yang_nsd.py index 41845dca..8ed4daa5 100644 --- a/common/python/rift/mano/yang_translator/rwmano/yang/yang_nsd.py +++ b/common/python/rift/mano/yang_translator/rwmano/yang/yang_nsd.py @@ -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}"). diff --git a/common/python/test/utest_config_data.py b/common/python/test/utest_config_data.py index 8287c119..020a2b46 100644 --- a/common/python/test/utest_config_data.py +++ b/common/python/test/utest_config_data.py @@ -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, ) diff --git a/common/python/test/utest_project.py b/common/python/test/utest_project.py index 1bc531ec..01f627cb 100644 --- a/common/python/test/utest_project.py +++ b/common/python/test/utest_project.py @@ -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 diff --git a/common/rw_gen_package.py b/common/rw_gen_package.py index 7c052f0d..1feb5deb 100755 --- a/common/rw_gen_package.py +++ b/common/rw_gen_package.py @@ -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 ) diff --git a/examples/ping_pong_ns/config_desc.py b/examples/ping_pong_ns/config_desc.py index 50204f9b..dae1c3b4 100755 --- a/examples/ping_pong_ns/config_desc.py +++ b/examples/ping_pong_ns/config_desc.py @@ -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( diff --git a/examples/ping_pong_ns/rift/mano/examples/ping_pong_nsd.py b/examples/ping_pong_ns/rift/mano/examples/ping_pong_nsd.py index e852b21e..d254cff7 100755 --- a/examples/ping_pong_ns/rift/mano/examples/ping_pong_nsd.py +++ b/examples/ping_pong_ns/rift/mano/examples/ping_pong_nsd.py @@ -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) diff --git a/models/openmano/python/rift/openmano/rift2openmano.py b/models/openmano/python/rift/openmano/rift2openmano.py index 8a308e61..4325ea0a 100755 --- a/models/openmano/python/rift/openmano/rift2openmano.py +++ b/models/openmano/python/rift/openmano/rift2openmano.py @@ -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 diff --git a/models/openmano/src/openmano2rift.py b/models/openmano/src/openmano2rift.py index 88c549ba..750115cd 100755 --- a/models/openmano/src/openmano2rift.py +++ b/models/openmano/src/openmano2rift.py @@ -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, ) diff --git a/models/plugins/yang/CMakeLists.txt b/models/plugins/yang/CMakeLists.txt index 827ec2b9..580e5565 100644 --- a/models/plugins/yang/CMakeLists.txt +++ b/models/plugins/yang/CMakeLists.txt @@ -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 index 00000000..70cacda1 --- /dev/null +++ b/models/plugins/yang/nsd-base.yang @@ -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; + } +} diff --git a/models/plugins/yang/nsd.yang b/models/plugins/yang/nsd.yang index 2b48ee7d..1b628819 100644 --- a/models/plugins/yang/nsd.yang +++ b/models/plugins/yang/nsd.yang @@ -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; } } } diff --git a/models/plugins/yang/nsr.yang b/models/plugins/yang/nsr.yang index 0917928f..136b62b0 100644 --- a/models/plugins/yang/nsr.yang +++ b/models/plugins/yang/nsr.yang @@ -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 index 00000000..e2be49d3 --- /dev/null +++ b/models/plugins/yang/project-nsd.yang @@ -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 index 00000000..53424369 --- /dev/null +++ b/models/plugins/yang/project-vnfd.yang @@ -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 index 00000000..bed366d9 --- /dev/null +++ b/models/plugins/yang/rw-nsd-base.yang @@ -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 diff --git a/models/plugins/yang/rw-nsd.yang b/models/plugins/yang/rw-nsd.yang index 73aab73d..d59168d5 100644 --- a/models/plugins/yang/rw-nsd.yang +++ b/models/plugins/yang/rw-nsd.yang @@ -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; } } diff --git a/models/plugins/yang/rw-nsr.yang b/models/plugins/yang/rw-nsr.yang index b77af37c..16bd4111 100644 --- a/models/plugins/yang/rw-nsr.yang +++ b/models/plugins/yang/rw-nsr.yang @@ -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 index 00000000..2e033854 --- /dev/null +++ b/models/plugins/yang/rw-project-nsd.yang @@ -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 index 00000000..766f5255 --- /dev/null +++ b/models/plugins/yang/rw-project-vnfd.yang @@ -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 index 00000000..ec39ef1e --- /dev/null +++ b/models/plugins/yang/rw-vnfd-base.yang @@ -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 diff --git a/models/plugins/yang/rw-vnfd.yang b/models/plugins/yang/rw-vnfd.yang index 7e2e8e7f..e7fca3b7 100644 --- a/models/plugins/yang/rw-vnfd.yang +++ b/models/plugins/yang/rw-vnfd.yang @@ -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 diff --git a/models/plugins/yang/rw-vnfr.yang b/models/plugins/yang/rw-vnfr.yang index 6337cad9..6614f169 100644 --- a/models/plugins/yang/rw-vnfr.yang +++ b/models/plugins/yang/rw-vnfr.yang @@ -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 { diff --git a/models/plugins/yang/vld.yang b/models/plugins/yang/vld.yang index 9f26dba9..63556d76 100644 --- a/models/plugins/yang/vld.yang +++ b/models/plugins/yang/vld.yang @@ -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 index 00000000..27f064e5 --- /dev/null +++ b/models/plugins/yang/vnfd-base.yang @@ -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 diff --git a/models/plugins/yang/vnfd.yang b/models/plugins/yang/vnfd.yang index 0e5d5aed..42de19ce 100644 --- a/models/plugins/yang/vnfd.yang +++ b/models/plugins/yang/vnfd.yang @@ -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; } } } diff --git a/models/plugins/yang/vnfr.yang b/models/plugins/yang/vnfr.yang index 13d96006..5cae6b80 100644 --- a/models/plugins/yang/vnfr.yang +++ b/models/plugins/yang/vnfr.yang @@ -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 diff --git a/rwcm/plugins/rwconman/rift/tasklets/rwconmantasklet/rwconman_config.py b/rwcm/plugins/rwconman/rift/tasklets/rwconmantasklet/rwconman_config.py index 6f76cb4f..a5d64049 100644 --- a/rwcm/plugins/rwconman/rift/tasklets/rwconmantasklet/rwconman_config.py +++ b/rwcm/plugins/rwconman/rift/tasklets/rwconmantasklet/rwconman_config.py @@ -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): diff --git a/rwcm/plugins/yang/rw-conman.yang b/rwcm/plugins/yang/rw-conman.yang index 006f11b1..b6cf99c2 100644 --- a/rwcm/plugins/yang/rw-conman.yang +++ b/rwcm/plugins/yang/rw-conman.yang @@ -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"; } diff --git a/rwlaunchpad/plugins/cli/cli_launchpad_schema_listing.txt b/rwlaunchpad/plugins/cli/cli_launchpad_schema_listing.txt index 83431549..c06e6b80 100644 --- a/rwlaunchpad/plugins/cli/cli_launchpad_schema_listing.txt +++ b/rwlaunchpad/plugins/cli/cli_launchpad_schema_listing.txt @@ -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 diff --git a/rwlaunchpad/plugins/rwautoscaler/test/utest_autoscaler_dts.py b/rwlaunchpad/plugins/rwautoscaler/test/utest_autoscaler_dts.py index edc7a9e4..ec1016f7 100644 --- a/rwlaunchpad/plugins/rwautoscaler/test/utest_autoscaler_dts.py +++ b/rwlaunchpad/plugins/rwautoscaler/test/utest_autoscaler_dts.py @@ -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 ) diff --git a/rwlaunchpad/plugins/rwlaunchpadtasklet/rift/package/convert.py b/rwlaunchpad/plugins/rwlaunchpadtasklet/rift/package/convert.py index 2e8e3b23..525eff52 100644 --- a/rwlaunchpad/plugins/rwlaunchpadtasklet/rift/package/convert.py +++ b/rwlaunchpad/plugins/rwlaunchpadtasklet/rift/package/convert.py @@ -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. @@ -18,18 +18,22 @@ 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) diff --git a/rwlaunchpad/plugins/rwlaunchpadtasklet/rift/tasklets/rwlaunchpad/export.py b/rwlaunchpad/plugins/rwlaunchpadtasklet/rift/tasklets/rwlaunchpad/export.py index 1e017b20..cffd21c0 100644 --- a/rwlaunchpad/plugins/rwlaunchpadtasklet/rift/tasklets/rwlaunchpad/export.py +++ b/rwlaunchpad/plugins/rwlaunchpadtasklet/rift/tasklets/rwlaunchpad/export.py @@ -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 diff --git a/rwlaunchpad/plugins/rwlaunchpadtasklet/rift/tasklets/rwlaunchpad/onboard.py b/rwlaunchpad/plugins/rwlaunchpadtasklet/rift/tasklets/rwlaunchpad/onboard.py index db7737fa..d4125d4c 100644 --- a/rwlaunchpad/plugins/rwlaunchpadtasklet/rift/tasklets/rwlaunchpad/onboard.py +++ b/rwlaunchpad/plugins/rwlaunchpadtasklet/rift/tasklets/rwlaunchpad/onboard.py @@ -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( diff --git a/rwlaunchpad/plugins/rwlaunchpadtasklet/rift/tasklets/rwlaunchpad/tasklet.py b/rwlaunchpad/plugins/rwlaunchpadtasklet/rift/tasklets/rwlaunchpad/tasklet.py index 76dc781c..f38bbc62 100644 --- a/rwlaunchpad/plugins/rwlaunchpadtasklet/rift/tasklets/rwlaunchpad/tasklet.py +++ b/rwlaunchpad/plugins/rwlaunchpadtasklet/rift/tasklets/rwlaunchpad/tasklet.py @@ -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)) diff --git a/rwlaunchpad/plugins/rwlaunchpadtasklet/rift/tasklets/rwlaunchpad/uploader.py b/rwlaunchpad/plugins/rwlaunchpadtasklet/rift/tasklets/rwlaunchpad/uploader.py index 1406a890..1e45ea4b 100644 --- a/rwlaunchpad/plugins/rwlaunchpadtasklet/rift/tasklets/rwlaunchpad/uploader.py +++ b/rwlaunchpad/plugins/rwlaunchpadtasklet/rift/tasklets/rwlaunchpad/uploader.py @@ -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 diff --git a/rwlaunchpad/plugins/rwlaunchpadtasklet/scripts/onboard_pkg b/rwlaunchpad/plugins/rwlaunchpadtasklet/scripts/onboard_pkg index d5bb4e50..d07cfb75 100755 --- a/rwlaunchpad/plugins/rwlaunchpadtasklet/scripts/onboard_pkg +++ b/rwlaunchpad/plugins/rwlaunchpadtasklet/scripts/onboard_pkg @@ -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: diff --git a/rwlaunchpad/plugins/rwlaunchpadtasklet/test/utest_export.py b/rwlaunchpad/plugins/rwlaunchpadtasklet/test/utest_export.py index 522c1a80..434d036f 100755 --- a/rwlaunchpad/plugins/rwlaunchpadtasklet/test/utest_export.py +++ b/rwlaunchpad/plugins/rwlaunchpadtasklet/test/utest_export.py @@ -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 diff --git a/rwlaunchpad/plugins/rwlaunchpadtasklet/test/utest_fileserver.py b/rwlaunchpad/plugins/rwlaunchpadtasklet/test/utest_fileserver.py index e56ec043..812f3329 100755 --- a/rwlaunchpad/plugins/rwlaunchpadtasklet/test/utest_fileserver.py +++ b/rwlaunchpad/plugins/rwlaunchpadtasklet/test/utest_fileserver.py @@ -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, ) diff --git a/rwlaunchpad/plugins/rwlaunchpadtasklet/test/utest_onboard.py b/rwlaunchpad/plugins/rwlaunchpadtasklet/test/utest_onboard.py index b3a7458e..643b6fb8 100755 --- a/rwlaunchpad/plugins/rwlaunchpadtasklet/test/utest_onboard.py +++ b/rwlaunchpad/plugins/rwlaunchpadtasklet/test/utest_onboard.py @@ -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, ) diff --git a/rwlaunchpad/plugins/rwlaunchpadtasklet/test/utest_package.py b/rwlaunchpad/plugins/rwlaunchpadtasklet/test/utest_package.py index 1efd2df7..d57ac77a 100755 --- a/rwlaunchpad/plugins/rwlaunchpadtasklet/test/utest_package.py +++ b/rwlaunchpad/plugins/rwlaunchpadtasklet/test/utest_package.py @@ -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() diff --git a/rwlaunchpad/plugins/rwlaunchpadtasklet/test/utest_uploader_app_dts.py b/rwlaunchpad/plugins/rwlaunchpadtasklet/test/utest_uploader_app_dts.py index 18b53d5f..26d808ad 100755 --- a/rwlaunchpad/plugins/rwlaunchpadtasklet/test/utest_uploader_app_dts.py +++ b/rwlaunchpad/plugins/rwlaunchpadtasklet/test/utest_uploader_app_dts.py @@ -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 diff --git a/rwlaunchpad/plugins/rwmonparam/test/utest_mon_params_dts.py b/rwlaunchpad/plugins/rwmonparam/test/utest_mon_params_dts.py index 80d9387f..5dec3621 100644 --- a/rwlaunchpad/plugins/rwmonparam/test/utest_mon_params_dts.py +++ b/rwlaunchpad/plugins/rwmonparam/test/utest_mon_params_dts.py @@ -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 diff --git a/rwlaunchpad/plugins/rwnsm/rift/tasklets/rwnsmtasklet/publisher.py b/rwlaunchpad/plugins/rwnsm/rift/tasklets/rwnsmtasklet/publisher.py index e3ae5cf1..1b5c787a 100644 --- a/rwlaunchpad/plugins/rwnsm/rift/tasklets/rwnsmtasklet/publisher.py +++ b/rwlaunchpad/plugins/rwnsm/rift/tasklets/rwnsmtasklet/publisher.py @@ -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]) diff --git a/rwlaunchpad/plugins/rwnsm/rift/tasklets/rwnsmtasklet/rwnsmtasklet.py b/rwlaunchpad/plugins/rwnsm/rift/tasklets/rwnsmtasklet/rwnsmtasklet.py index 0797b558..139302bd 100755 --- a/rwlaunchpad/plugins/rwnsm/rift/tasklets/rwnsmtasklet/rwnsmtasklet.py +++ b/rwlaunchpad/plugins/rwnsm/rift/tasklets/rwnsmtasklet/rwnsmtasklet.py @@ -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 diff --git a/rwlaunchpad/plugins/rwnsm/rift/tasklets/rwnsmtasklet/scale_group.py b/rwlaunchpad/plugins/rwnsm/rift/tasklets/rwnsmtasklet/scale_group.py index e3b7f1f0..9112f480 100644 --- a/rwlaunchpad/plugins/rwnsm/rift/tasklets/rwnsmtasklet/scale_group.py +++ b/rwlaunchpad/plugins/rwnsm/rift/tasklets/rwnsmtasklet/scale_group.py @@ -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): diff --git a/rwlaunchpad/plugins/rwvnfm/rift/tasklets/rwvnfmtasklet/rwvnfmtasklet.py b/rwlaunchpad/plugins/rwvnfm/rift/tasklets/rwvnfmtasklet/rwvnfmtasklet.py index abf73aec..955f566d 100755 --- a/rwlaunchpad/plugins/rwvnfm/rift/tasklets/rwvnfmtasklet/rwvnfmtasklet.py +++ b/rwlaunchpad/plugins/rwvnfm/rift/tasklets/rwvnfmtasklet/rwvnfmtasklet.py @@ -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 diff --git a/rwlaunchpad/plugins/yang/rw-launchpad.yang b/rwlaunchpad/plugins/yang/rw-launchpad.yang index c12bf517..99328744 100644 --- a/rwlaunchpad/plugins/yang/rw-launchpad.yang +++ b/rwlaunchpad/plugins/yang/rw-launchpad.yang @@ -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 { diff --git a/rwlaunchpad/plugins/yang/rw-nsm.yang b/rwlaunchpad/plugins/yang/rw-nsm.yang index c07d2000..f182114d 100644 --- a/rwlaunchpad/plugins/yang/rw-nsm.yang +++ b/rwlaunchpad/plugins/yang/rw-nsm.yang @@ -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"; } diff --git a/rwlaunchpad/plugins/yang/rw-vnfm.yang b/rwlaunchpad/plugins/yang/rw-vnfm.yang index 25e1abba..225633b9 100644 --- a/rwlaunchpad/plugins/yang/rw-vnfm.yang +++ b/rwlaunchpad/plugins/yang/rw-vnfm.yang @@ -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 { diff --git a/rwlaunchpad/ra/pytest/multivm_vnf/conftest.py b/rwlaunchpad/ra/pytest/multivm_vnf/conftest.py index a3c565bb..8510fa61 100644 --- a/rwlaunchpad/ra/pytest/multivm_vnf/conftest.py +++ b/rwlaunchpad/ra/pytest/multivm_vnf/conftest.py @@ -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 ) diff --git a/rwlaunchpad/ra/pytest/multivm_vnf/test_multi_vm_vnf_slb.py b/rwlaunchpad/ra/pytest/multivm_vnf/test_multi_vm_vnf_slb.py index fb4bd613..bf46ac80 100755 --- a/rwlaunchpad/ra/pytest/multivm_vnf/test_multi_vm_vnf_slb.py +++ b/rwlaunchpad/ra/pytest/multivm_vnf/test_multi_vm_vnf_slb.py @@ -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()) diff --git a/rwlaunchpad/ra/pytest/multivm_vnf/test_multi_vm_vnf_trafgen.py b/rwlaunchpad/ra/pytest/multivm_vnf/test_multi_vm_vnf_trafgen.py index b05a23cb..ae9f4046 100755 --- a/rwlaunchpad/ra/pytest/multivm_vnf/test_multi_vm_vnf_trafgen.py +++ b/rwlaunchpad/ra/pytest/multivm_vnf/test_multi_vm_vnf_trafgen.py @@ -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()) diff --git a/rwlaunchpad/ra/pytest/ns/haproxy/test_scaling.py b/rwlaunchpad/ra/pytest/ns/haproxy/test_scaling.py index 3cf2c526..8e203d9c 100644 --- a/rwlaunchpad/ra/pytest/ns/haproxy/test_scaling.py +++ b/rwlaunchpad/ra/pytest/ns/haproxy/test_scaling.py @@ -17,7 +17,13 @@ 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') diff --git a/rwlaunchpad/ra/pytest/ns/pingpong/test_pingpong.py b/rwlaunchpad/ra/pytest/ns/pingpong/test_pingpong.py index ef4949cc..49cfcb55 100644 --- a/rwlaunchpad/ra/pytest/ns/pingpong/test_pingpong.py +++ b/rwlaunchpad/ra/pytest/ns/pingpong/test_pingpong.py @@ -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()) diff --git a/rwlaunchpad/ra/pytest/ns/pingpong/test_records.py b/rwlaunchpad/ra/pytest/ns/pingpong/test_records.py index 9f1cd0a2..81eeeb08 100644 --- a/rwlaunchpad/ra/pytest/ns/pingpong/test_records.py +++ b/rwlaunchpad/ra/pytest/ns/pingpong/test_records.py @@ -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, diff --git a/rwlaunchpad/ra/pytest/ns/pingpong/test_scaling.py b/rwlaunchpad/ra/pytest/ns/pingpong/test_scaling.py index 0878db74..d38509fe 100644 --- a/rwlaunchpad/ra/pytest/ns/pingpong/test_scaling.py +++ b/rwlaunchpad/ra/pytest/ns/pingpong/test_scaling.py @@ -35,10 +35,10 @@ import rift.auto.descriptor from gi.repository import ( NsrYang, - NsdYang, + ProjectNsdYang as NsdYang, VnfrYang, RwNsrYang, - RwNsdYang, + RwProjectNsdYang as RwNsdYang, RwVnfrYang, ) diff --git a/rwlaunchpad/ra/pytest/ns/test_onboard.py b/rwlaunchpad/ra/pytest/ns/test_onboard.py index ecec8340..07a31dd2 100644 --- a/rwlaunchpad/ra/pytest/ns/test_onboard.py +++ b/rwlaunchpad/ra/pytest/ns/test_onboard.py @@ -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()) diff --git a/rwlaunchpad/ra/pytest/test_failover.py b/rwlaunchpad/ra/pytest/test_failover.py index 60ba82a4..e952b698 100755 --- a/rwlaunchpad/ra/pytest/test_failover.py +++ b/rwlaunchpad/ra/pytest/test_failover.py @@ -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 diff --git a/rwlaunchpad/test/mano_ut.py b/rwlaunchpad/test/mano_ut.py index 3835ab50..d85088b5 100755 --- a/rwlaunchpad/test/mano_ut.py +++ b/rwlaunchpad/test/mano_ut.py @@ -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, ) diff --git a/rwlaunchpad/test/pytest/lp_kt_utm_test.py b/rwlaunchpad/test/pytest/lp_kt_utm_test.py index feb0b993..75e30d3d 100644 --- a/rwlaunchpad/test/pytest/lp_kt_utm_test.py +++ b/rwlaunchpad/test/pytest/lp_kt_utm_test.py @@ -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, ) diff --git a/rwlaunchpad/test/pytest/lp_kt_utm_wims_test.py b/rwlaunchpad/test/pytest/lp_kt_utm_wims_test.py index 4e73aac3..9b2fa8ed 100644 --- a/rwlaunchpad/test/pytest/lp_kt_utm_wims_test.py +++ b/rwlaunchpad/test/pytest/lp_kt_utm_wims_test.py @@ -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, ) diff --git a/rwlaunchpad/test/pytest/lp_test.py b/rwlaunchpad/test/pytest/lp_test.py index 8b41cb1f..8957dfe5 100644 --- a/rwlaunchpad/test/pytest/lp_test.py +++ b/rwlaunchpad/test/pytest/lp_test.py @@ -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) diff --git a/rwlaunchpad/test/pytest/lp_tg_2vrouter_ts_epa_test.py b/rwlaunchpad/test/pytest/lp_tg_2vrouter_ts_epa_test.py index 3470b750..bd51e1d2 100644 --- a/rwlaunchpad/test/pytest/lp_tg_2vrouter_ts_epa_test.py +++ b/rwlaunchpad/test/pytest/lp_tg_2vrouter_ts_epa_test.py @@ -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) diff --git a/rwlaunchpad/test/pytest/lp_tg_2vrouter_ts_test.py b/rwlaunchpad/test/pytest/lp_tg_2vrouter_ts_test.py index 578c0af0..059217d1 100644 --- a/rwlaunchpad/test/pytest/lp_tg_2vrouter_ts_test.py +++ b/rwlaunchpad/test/pytest/lp_tg_2vrouter_ts_test.py @@ -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) diff --git a/rwlaunchpad/test/pytest/lp_tg_vrouter_ts_epa_sriov_test.py b/rwlaunchpad/test/pytest/lp_tg_vrouter_ts_epa_sriov_test.py index 405bee67..db880158 100644 --- a/rwlaunchpad/test/pytest/lp_tg_vrouter_ts_epa_sriov_test.py +++ b/rwlaunchpad/test/pytest/lp_tg_vrouter_ts_epa_sriov_test.py @@ -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) diff --git a/rwlaunchpad/test/utest_ro_account.py b/rwlaunchpad/test/utest_ro_account.py index 9ed28fdc..deaca6b1 100755 --- a/rwlaunchpad/test/utest_ro_account.py +++ b/rwlaunchpad/test/utest_ro_account.py @@ -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() diff --git a/rwlaunchpad/test/utest_rwnsm.py b/rwlaunchpad/test/utest_rwnsm.py index fa997518..9f73d291 100755 --- a/rwlaunchpad/test/utest_rwnsm.py +++ b/rwlaunchpad/test/utest_rwnsm.py @@ -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", ), ]) -- 2.25.1