X-Git-Url: https://osm.etsi.org/gitweb/?a=blobdiff_plain;f=osm_lcm%2Fns.py;h=d54187dce5d0e9319c84332d8bcac1cdf321f7ae;hb=refs%2Fchanges%2F56%2F6756%2F2;hp=4b4adbf1f931fad4713ed3153a9ecf306ff6a470;hpb=47e86b567ff08adb8c77ce35a8e4feb4c7d59a3d;p=osm%2FLCM.git diff --git a/osm_lcm/ns.py b/osm_lcm/ns.py index 4b4adbf..d54187d 100644 --- a/osm_lcm/ns.py +++ b/osm_lcm/ns.py @@ -216,6 +216,9 @@ class NsLcm(LcmBase): "vnfs": {}, "networks": {}, } + if ns_params.get("vduImage"): + RO_ns_params["vduImage"] = ns_params["vduImage"] + if ns_params.get("ssh-authorized-key"): RO_ns_params["cloud-config"] = {"key-pairs": ns_params["ssh-authorized-key"]} if ns_params.get("vnf"): @@ -394,50 +397,6 @@ class NsLcm(LcmBase): else: raise LcmException("ns_update_vnfr: Not found member_vnf_index={} at RO info".format(vnf_index)) - async def create_monitoring(self, nsr_id, vnf_member_index, vnfd_desc): - if not vnfd_desc.get("scaling-group-descriptor"): - return - for scaling_group in vnfd_desc["scaling-group-descriptor"]: - scaling_policy_desc = {} - scaling_desc = { - "ns_id": nsr_id, - "scaling_group_descriptor": { - "name": scaling_group["name"], - "scaling_policy": scaling_policy_desc - } - } - for scaling_policy in scaling_group.get("scaling-policy"): - scaling_policy_desc["scale_in_operation_type"] = scaling_policy_desc["scale_out_operation_type"] = \ - scaling_policy["scaling-type"] - scaling_policy_desc["threshold_time"] = scaling_policy["threshold-time"] - scaling_policy_desc["cooldown_time"] = scaling_policy["cooldown-time"] - scaling_policy_desc["scaling_criteria"] = [] - for scaling_criteria in scaling_policy.get("scaling-criteria"): - scaling_criteria_desc = {"scale_in_threshold": scaling_criteria.get("scale-in-threshold"), - "scale_out_threshold": scaling_criteria.get("scale-out-threshold"), - } - if not scaling_criteria.get("vnf-monitoring-param-ref"): - continue - for monitoring_param in vnfd_desc.get("monitoring-param", ()): - if monitoring_param["id"] == scaling_criteria["vnf-monitoring-param-ref"]: - scaling_criteria_desc["monitoring_param"] = { - "id": monitoring_param["id"], - "name": monitoring_param["name"], - "aggregation_type": monitoring_param.get("aggregation-type"), - "vdu_name": monitoring_param.get("vdu-ref"), - "vnf_member_index": vnf_member_index, - } - - scaling_policy_desc["scaling_criteria"].append(scaling_criteria_desc) - break - else: - self.logger.error( - "Task ns={} member_vnf_index={} Invalid vnfd vnf-monitoring-param-ref={} not in " - "monitoring-param list".format(nsr_id, vnf_member_index, - scaling_criteria["vnf-monitoring-param-ref"])) - - await self.msg.aiowrite("lcm_pm", "configure_scaling", scaling_desc, self.loop) - async def instantiate(self, nsr_id, nslcmop_id): logging_text = "Task ns={} instantiate={} ".format(nsr_id, nslcmop_id) self.logger.debug(logging_text + "Enter") @@ -588,6 +547,11 @@ class NsLcm(LcmBase): step = db_nsr_update["detailed-status"] = "Checking instantiation parameters" RO_ns_params = self.ns_params_2_RO(ns_params, nsd, needed_vnfd) + + n2vc_key = await self.n2vc.GetPublicKey() + RO_ns_params["mgmt_keys"] = [n2vc_key] + # TODO feature 1429. Add this option only to VMs with configuration and no password + step = db_nsr_update["detailed-status"] = "Creating ns at RO" desc = await RO.create("ns", descriptor=RO_ns_params, name=db_nsr["name"], @@ -846,9 +810,6 @@ class NsLcm(LcmBase): db_nsr_update["config-status"] = "configured" db_nsr_update["detailed-status"] = "done" - # step = "Sending monitoring parameters to PM" - # for c_vnf in nsd["constituent-vnfd"]: - # await self.create_monitoring(nsr_id, c_vnf["member-vnf-index"], needed_vnfd[c_vnf["vnfd-id-ref"]]) return except (ROclient.ROClientException, DbException, LcmException) as e: