From 699e14141627d8f8fd30abc07c87c1e081215762 Mon Sep 17 00:00:00 2001 From: balakrishn Date: Mon, 19 Sep 2016 06:41:01 -0400 Subject: [PATCH] Bug 43 - Use vnf-id instead of name in Openmano generated NSD descriptors Signed-off-by: balakrishn --- models/openmano/python/rift/openmano/rift2openmano.py | 11 +++++++++-- .../rwnsm/rift/tasklets/rwnsmtasklet/openmano_nsm.py | 7 +++++-- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/models/openmano/python/rift/openmano/rift2openmano.py b/models/openmano/python/rift/openmano/rift2openmano.py index 275d41d2..6cc13a7e 100755 --- a/models/openmano/python/rift/openmano/rift2openmano.py +++ b/models/openmano/python/rift/openmano/rift2openmano.py @@ -235,7 +235,7 @@ def convert_vnfd_name(vnfd_name, member_idx): return vnfd_name + "__" + str(member_idx) -def rift2openmano_nsd(rift_nsd, rift_vnfds): +def rift2openmano_nsd(rift_nsd, rift_vnfds,openmano_vnfd_ids): for vnfd_id in rift_nsd.vnfd_ids: if vnfd_id not in rift_vnfds: raise VNFNotFoundError("VNF id %s not provided" % vnfd_id) @@ -251,7 +251,14 @@ def rift2openmano_nsd(rift_nsd, rift_vnfds): vnfd_id = vnfd.vnfd_id_ref rift_vnfd = rift_vnfds[vnfd_id] member_idx = vnfd.member_vnf_index - topology["nodes"][rift_vnfd.name + "__" + str(member_idx)] = { + openmano_vnfd_id = openmano_vnfd_ids.get(vnfd_id,None) + if openmano_vnfd_id: + topology["nodes"][rift_vnfd.name + "__" + str(member_idx)] = { + "type": "VNF", + "vnf_id": openmano_vnfd_id + } + else: + topology["nodes"][rift_vnfd.name + "__" + str(member_idx)] = { "type": "VNF", "VNF model": rift_vnfd.name } diff --git a/rwlaunchpad/plugins/rwnsm/rift/tasklets/rwnsmtasklet/openmano_nsm.py b/rwlaunchpad/plugins/rwnsm/rift/tasklets/rwnsmtasklet/openmano_nsm.py index c3b16033..17a13a39 100644 --- a/rwlaunchpad/plugins/rwnsm/rift/tasklets/rwnsmtasklet/openmano_nsm.py +++ b/rwlaunchpad/plugins/rwnsm/rift/tasklets/rwnsmtasklet/openmano_nsm.py @@ -102,7 +102,6 @@ class VnfrConsoleOperdataDtsHandler(object): if action == rwdts.QueryAction.READ: schema = RwVnfrYang.YangData_RwVnfr_VnfrConsole_Vnfr_Vdur.schema() path_entry = schema.keyspec_to_entry(ks_path) - self._log.debug("VDU Opdata path is {}".format(path_entry)) try: console_url = yield from self._loop.run_in_executor( @@ -274,6 +273,10 @@ class OpenmanoNsr(object): def vnfds(self): return {v.rift_vnfd_id: v.vnfd for v in self._vnfrs} + @property + def vnfr_ids(self): + return {v.rift_vnfd_id: v.openmano_vnfd_id for v in self._vnfrs} + @property def vnfrs(self): return self._vnfrs @@ -281,7 +284,7 @@ class OpenmanoNsr(object): @property def openmano_nsd_yaml(self): self._log.debug("Converting nsd %s from rift to openmano", self.nsd.id) - openmano_nsd = rift2openmano.rift2openmano_nsd(self.nsd, self.vnfds) + openmano_nsd = rift2openmano.rift2openmano_nsd(self.nsd, self.vnfds,self.vnfr_ids) return yaml.safe_dump(openmano_nsd, default_flow_style=False) -- 2.25.1