X-Git-Url: https://osm.etsi.org/gitweb/?a=blobdiff_plain;f=osm_lcm%2Fns.py;h=87eaecd578b9b6f2fdf50d2b1343eb7a8f8a38c4;hb=refs%2Fchanges%2F95%2F8395%2F2;hp=6ecb04d5d4410d9426b6aba3a7a4f205ccaa5297;hpb=5ee020569ae1cf9420fbe4032f6e6b71ff3926f4;p=osm%2FLCM.git diff --git a/osm_lcm/ns.py b/osm_lcm/ns.py index 6ecb04d..87eaecd 100644 --- a/osm_lcm/ns.py +++ b/osm_lcm/ns.py @@ -21,6 +21,7 @@ import yaml import logging import logging.handlers import traceback +import json from jinja2 import Environment, Template, meta, TemplateError, TemplateNotFound, TemplateSyntaxError from osm_lcm import ROclient @@ -1089,7 +1090,7 @@ class NsLcm(LcmBase): step = "Install configuration Software, getting public ssh key" pub_key = await self.n2vc.get_ee_ssh_public__key(ee_id=ee_id, db_dict=db_dict) - step = "Insert public key into VM" + step = "Insert public key into VM user={} ssh_key={}".format(user, pub_key) else: step = "Waiting to VM being up and getting IP address" self.logger.debug(logging_text + step) @@ -1125,7 +1126,7 @@ class NsLcm(LcmBase): for initial_config_primitive in initial_config_primitive_list: # adding information on the vca_deployed if it is a NS execution environment if not vca_deployed["member-vnf-index"]: - deploy_params["ns_config_info"] = self._get_ns_config_info(nsr_id) + deploy_params["ns_config_info"] = json.dumps(self._get_ns_config_info(nsr_id)) # TODO check if already done primitive_params_ = self._map_primitive_params(initial_config_primitive, {}, deploy_params) @@ -1672,9 +1673,11 @@ class NsLcm(LcmBase): params=desc_params, db_dict=db_dict, timeout=3600) ) else: - task = self.k8sclusterjuju.install(cluster_uuid=cluster_uuid, kdu_model=kdumodel, - atomic=True, params=desc_params, - db_dict=db_dict, timeout=600) + task = asyncio.ensure_future( + self.k8sclusterjuju.install(cluster_uuid=cluster_uuid, kdu_model=kdumodel, + atomic=True, params=desc_params, + db_dict=db_dict, timeout=600) + ) pending_tasks[task] = "_admin.deployed.K8s.{}.".format(index) index += 1 @@ -1975,6 +1978,13 @@ class NsLcm(LcmBase): # or op_index (operationState != 'COMPLETED') return self._reintent_or_skip_suboperation(db_nslcmop, op_index) + # Function to return execution_environment id + + def _get_ee_id(self, vnf_index, vdu_id, vca_deployed_list): + for vca in vca_deployed_list: + if vca["member-vnf-index"] == vnf_index and vca["vdu_id"] == vdu_id: + return vca["ee_id"] + # Helper methods for terminate() async def _terminate_action(self, db_nslcmop, nslcmop_id, nsr_id): @@ -1982,6 +1992,8 @@ class NsLcm(LcmBase): Called from terminate() before deleting instance Calls action() to execute the primitive """ logging_text = "Task ns={} _terminate_action={} ".format(nsr_id, nslcmop_id) + db_nsr = self.db.get_one("nsrs", {"_id": nsr_id}) + vca_deployed_list = db_nsr["_admin"]["deployed"]["VCA"] db_vnfrs_list = self.db.get_list("vnfrs", {"nsr-id-ref": nsr_id}) db_vnfds = {} # Loop over VNFRs @@ -2033,8 +2045,7 @@ class NsLcm(LcmBase): # " primitive={} fails with error {}".format( # vnf_index, seq.get("name"), result_detail)) - # TODO: find ee_id - ee_id = None + ee_id = self._get_ee_id(vnf_index, vdu_id, vca_deployed_list) try: await self.n2vc.exec_primitive( ee_id=ee_id,