X-Git-Url: https://osm.etsi.org/gitweb/?a=blobdiff_plain;f=osm_lcm%2Fns.py;h=8742488ba52bc3b0811ff9064695db81eaa699c9;hb=e64f7fb3e0efd6fcc78ea322c90106c7403a8a62;hp=3972c59acb623293c830cf1f20b606161146a75c;hpb=77677d90626755970d87895be5054f4d8c1af8a3;p=osm%2FLCM.git diff --git a/osm_lcm/ns.py b/osm_lcm/ns.py index 3972c59..8742488 100644 --- a/osm_lcm/ns.py +++ b/osm_lcm/ns.py @@ -304,36 +304,39 @@ class NsLcm(LcmBase): "wim_account": wim_account_2_RO(ns_params.get("wimAccountId")), # "scenario": ns_params["nsdId"], } - if n2vc_key_list: - for vnfd_ref, vnfd in vnfd_dict.items(): - vdu_needed_access = [] - mgmt_cp = None - if vnfd.get("vnf-configuration"): - if vnfd.get("mgmt-interface"): - if vnfd["mgmt-interface"].get("vdu-id"): - vdu_needed_access.append(vnfd["mgmt-interface"]["vdu-id"]) - elif vnfd["mgmt-interface"].get("cp"): - mgmt_cp = vnfd["mgmt-interface"]["cp"] - - for vdu in vnfd.get("vdu", ()): - if vdu.get("vdu-configuration"): + n2vc_key_list = n2vc_key_list or [] + for vnfd_ref, vnfd in vnfd_dict.items(): + vdu_needed_access = [] + mgmt_cp = None + if vnfd.get("vnf-configuration"): + ssh_required = vnfd["vnf-configuration"].get("config-access", {}).get("ssh-access").get("required") + if ssh_required and vnfd.get("mgmt-interface"): + if vnfd["mgmt-interface"].get("vdu-id"): + vdu_needed_access.append(vnfd["mgmt-interface"]["vdu-id"]) + elif vnfd["mgmt-interface"].get("cp"): + mgmt_cp = vnfd["mgmt-interface"]["cp"] + + for vdu in vnfd.get("vdu", ()): + if vdu.get("vdu-configuration"): + ssh_required = vdu["vdu-configuration"].get("config-access", {}).get("ssh-access").get("required") + if ssh_required: vdu_needed_access.append(vdu["id"]) - elif mgmt_cp: - for vdu_interface in vdu.get("interface"): - if vdu_interface.get("external-connection-point-ref") and \ - vdu_interface["external-connection-point-ref"] == mgmt_cp: - vdu_needed_access.append(vdu["id"]) - mgmt_cp = None - break + elif mgmt_cp: + for vdu_interface in vdu.get("interface"): + if vdu_interface.get("external-connection-point-ref") and \ + vdu_interface["external-connection-point-ref"] == mgmt_cp: + vdu_needed_access.append(vdu["id"]) + mgmt_cp = None + break - if vdu_needed_access: - for vnf_member in nsd.get("constituent-vnfd"): - if vnf_member["vnfd-id-ref"] != vnfd_ref: - continue - for vdu in vdu_needed_access: - populate_dict(RO_ns_params, - ("vnfs", vnf_member["member-vnf-index"], "vdus", vdu, "mgmt_keys"), - n2vc_key_list) + if vdu_needed_access: + for vnf_member in nsd.get("constituent-vnfd"): + if vnf_member["vnfd-id-ref"] != vnfd_ref: + continue + for vdu in vdu_needed_access: + populate_dict(RO_ns_params, + ("vnfs", vnf_member["member-vnf-index"], "vdus", vdu, "mgmt_keys"), + n2vc_key_list) if ns_params.get("vduImage"): RO_ns_params["vduImage"] = ns_params["vduImage"] @@ -601,12 +604,13 @@ class NsLcm(LcmBase): break else: raise LcmException("ns_update_vnfr: Not found member_vnf_index={} vdur={} interface={} " - "at RO info".format(vnf_index, vdur["vdu-id-ref"], ifacer["name"])) + "from VIM info".format(vnf_index, vdur["vdu-id-ref"], + ifacer["name"])) vnfr_update["vdur.{}".format(vdu_index)] = vdur break else: - raise LcmException("ns_update_vnfr: Not found member_vnf_index={} vdur={} count_index={} at " - "RO info".format(vnf_index, vdur["vdu-id-ref"], vdur["count-index"])) + raise LcmException("ns_update_vnfr: Not found member_vnf_index={} vdur={} count_index={} from " + "VIM info".format(vnf_index, vdur["vdu-id-ref"], vdur["count-index"])) for vld_index, vld in enumerate(get_iterable(db_vnfr, "vld")): for net_RO in get_iterable(nsr_desc_RO, "nets"): @@ -619,14 +623,14 @@ class NsLcm(LcmBase): vnfr_update["vld.{}".format(vld_index)] = vld break else: - raise LcmException("ns_update_vnfr: Not found member_vnf_index={} vld={} at RO info".format( + raise LcmException("ns_update_vnfr: Not found member_vnf_index={} vld={} from VIM info".format( vnf_index, vld["id"])) self.update_db_2("vnfrs", db_vnfr["_id"], vnfr_update) break else: - raise LcmException("ns_update_vnfr: Not found member_vnf_index={} at RO info".format(vnf_index)) + raise LcmException("ns_update_vnfr: Not found member_vnf_index={} from VIM info".format(vnf_index)) async def instantiate(self, nsr_id, nslcmop_id): @@ -1151,7 +1155,7 @@ class NsLcm(LcmBase): n2vc_key_list.append(n2vc_key) RO_ns_params = self.ns_params_2_RO(ns_params, nsd, db_vnfds_ref, n2vc_key_list) - step = db_nsr_update["detailed-status"] = "Creating ns at RO" + step = db_nsr_update["detailed-status"] = "Deploying ns at VIM" desc = await self.RO.create("ns", descriptor=RO_ns_params, name=db_nsr["name"], scenario=RO_nsd_uuid) @@ -1162,7 +1166,7 @@ class NsLcm(LcmBase): self.update_db_2("nsrs", nsr_id, db_nsr_update) # wait until NS is ready - step = ns_status_detailed = detailed_status = "Waiting ns ready at RO. RO_id={}".format(RO_nsr_id) + step = ns_status_detailed = detailed_status = "Waiting VIM to deploy ns. RO_id={}".format(RO_nsr_id) detailed_status_old = None self.logger.debug(logging_text + step) @@ -1783,7 +1787,8 @@ class NsLcm(LcmBase): RO_delete_action = nsr_deployed["RO"].get("nsr_delete_action_id") try: if RO_nsr_id: - step = db_nsr_update["detailed-status"] = db_nslcmop_update["detailed-status"] = "Deleting ns at RO" + step = db_nsr_update["detailed-status"] = db_nslcmop_update["detailed-status"] = \ + "Deleting ns from VIM" self.update_db_2("nslcmops", nslcmop_id, db_nslcmop_update) self.update_db_2("nsrs", nsr_id, db_nsr_update) self.logger.debug(logging_text + step) @@ -1844,7 +1849,7 @@ class NsLcm(LcmBase): RO_nsd_id = nsr_deployed["RO"]["nsd_id"] try: step = db_nsr_update["detailed-status"] = db_nslcmop_update["detailed-status"] =\ - "Deleting nsd at RO" + "Deleting nsd from RO" await self.RO.delete("nsd", RO_nsd_id) self.logger.debug(logging_text + "RO_nsd_id={} deleted".format(RO_nsd_id)) db_nsr_update["_admin.deployed.RO.nsd_id"] = None @@ -2254,7 +2259,7 @@ class NsLcm(LcmBase): # break # TODO check if ns is in a proper status - step = "Sending scale order to RO" + step = "Sending scale order to VIM" nb_scale_op = 0 if not db_nsr["_admin"].get("scaling-group"): self.update_db_2("nsrs", nsr_id, {"_admin.scaling-group": [{"name": scaling_group, "nb-scale-op": 0}]}) @@ -2384,7 +2389,7 @@ class NsLcm(LcmBase): detailed_status = step + "; {}".format(ns_status_info) elif ns_status == "ACTIVE": RO_task_done = True - step = detailed_status = "Waiting ns ready at RO. RO_id={}".format(RO_nsr_id) + step = detailed_status = "Waiting VIM to deploy ns. RO_id={}".format(RO_nsr_id) self.logger.debug(logging_text + step) else: assert False, "ROclient.check_action_status returns unknown {}".format(ns_status)