From: tierno Date: Wed, 11 Apr 2018 21:21:55 +0000 (+0200) Subject: LCM Providing VDU IP address information X-Git-Tag: v4.0.0~20 X-Git-Url: https://osm.etsi.org/gitweb/?a=commitdiff_plain;h=0b68f8a2b982a9c1990d24acc07f8738f2bb24bb;p=osm%2FRO.git LCM Providing VDU IP address information Change-Id: Ica02b90e6dd01a7a3c9498afcd326c3f9f92a96a Signed-off-by: tierno --- diff --git a/lcm/osm_lcm/ROclient.py b/lcm/osm_lcm/ROclient.py index 040eb17e..8564bfd8 100644 --- a/lcm/osm_lcm/ROclient.py +++ b/lcm/osm_lcm/ROclient.py @@ -299,16 +299,17 @@ class ROClient: @staticmethod def get_ns_vnf_ip(ns_descriptor): """ - Get a dict with the IPs of every vnf. + Get a dict with the IPs of every vnf and vdu :param ns_descriptor: instance descriptor obtained with self.show("ns", ) - :return: dict iwth key member_vnf_index, value ip_address + :return: dict with {member_vnf_index: ip_address, ... member_vnf_index.vdu_id: ip_address ...} """ - ns_ip={} + ns_ip = {"vnf": {}, "vdu": {}} for vnf in ns_descriptor["vnfs"]: - ns_ip[str(vnf["member_vnf_index"])] = vnf["ip_address"] - #uuid sce_vnf_id - # vnf[mgmt_access]: '{interface_id: cf3cbf00-385c-49b4-9a3f-b400b7b15dc6, vm_id: d0dd22a9-91ef-46f1-8e8f-8cf4b2d5b2d7}' - # vnf[vms] + ns_ip["vnf"][str(vnf["member_vnf_index"])] = vnf["ip_address"] + ns_ip["vdu"][str(vnf["member_vnf_index"])] = {} + for vm in vnf["vms"]: + if vm.get("ip_address"): + ns_ip["vdu"][str(vnf["member_vnf_index"])][vm["vdu_osm_id"]] = vm["ip_address"] return ns_ip async def _get_item_uuid(self, session, item, item_id_name, all_tenants=False): diff --git a/lcm/osm_lcm/lcm.py b/lcm/osm_lcm/lcm.py index 2b62c1f4..aa90f3d8 100644 --- a/lcm/osm_lcm/lcm.py +++ b/lcm/osm_lcm/lcm.py @@ -1044,7 +1044,13 @@ class Lcm: self.logger.error("Task Kafka Exception {}".format(e)) await asyncio.sleep(1, loop=self.loop) self.logger.debug("Task Kafka terminating") + self.logger.debug("Task Kafka exit") + + def start(self): + self.loop = asyncio.get_event_loop() + self.loop.run_until_complete(self.read_kafka()) # TODO + # self.logger.debug("Terminating cancelling creation tasks") # self.cancel_tasks("ALL", "create") # timeout = 200 # while self.is_pending_tasks(): @@ -1053,11 +1059,6 @@ class Lcm: # timeout -= 2 # if not timeout: # self.cancel_tasks("ALL", "ALL") - self.logger.debug("Task Kafka exit") - - def start(self): - self.loop = asyncio.get_event_loop() - self.loop.run_until_complete(self.read_kafka()) self.loop.close() self.loop = None if self.db: