X-Git-Url: https://osm.etsi.org/gitweb/?a=blobdiff_plain;f=osm_nbi%2Finstance_topics.py;h=243a19955054124d757427b28071d14dc76902aa;hb=2c92b7de64b0834728c39e52437d50b40059cde1;hp=14861336b3c570817b9a0d5dbda92f7a64c07f99;hpb=5758955b7b394517ff5caf5506a4400cdc5aa372;p=osm%2FNBI.git diff --git a/osm_nbi/instance_topics.py b/osm_nbi/instance_topics.py index 1486133..243a199 100644 --- a/osm_nbi/instance_topics.py +++ b/osm_nbi/instance_topics.py @@ -334,7 +334,7 @@ class NsrTopic(BaseTopic): # Create VNFRs needed_vnfds = {} # TODO: Change for multiple df support - vnf_profiles = nsd.get("df", [[]])[0].get("vnf-profile", ()) + vnf_profiles = nsd.get("df", [{}])[0].get("vnf-profile", ()) for vnfp in vnf_profiles: vnfd_id = vnfp.get("vnfd-id") vnf_index = vnfp.get("id") @@ -478,7 +478,6 @@ class NsrTopic(BaseTopic): ns_request["nsr_id"] = nsr_id if ns_request and ns_request.get("config-units"): nsr_descriptor["config-units"] = ns_request["config-units"] - # Create vld if nsd.get("virtual-link-desc"): nsr_vld = deepcopy(nsd.get("virtual-link-desc", [])) @@ -710,9 +709,14 @@ class NsrTopic(BaseTopic): if kdu_params and kdu_params.get("k8s-namespace"): kdu_k8s_namespace = kdu_params["k8s-namespace"] + kdu_deployment_name = "" + if kdu_params and kdu_params.get("kdu-deployment-name"): + kdu_deployment_name = kdu_params.get("kdu-deployment-name") + kdur = { "additionalParams": additional_params, "k8s-namespace": kdu_k8s_namespace, + "kdu-deployment-name": kdu_deployment_name, "kdu-name": kdu["name"], # TODO "name": "" Name of the VDU in the VIM "ip-address": None, # mgmt-interface filled by LCM @@ -933,9 +937,9 @@ class NsrTopic(BaseTopic): for index in range(0, count): vdur = deepcopy(vdur) for iface in vdur["interfaces"]: - if iface.get("ip-address"): + if iface.get("ip-address") and index != 0: iface["ip-address"] = increment_ip_mac(iface["ip-address"]) - if iface.get("mac-address"): + if iface.get("mac-address") and index != 0: iface["mac-address"] = increment_ip_mac(iface["mac-address"]) vdur["_id"] = str(uuid4()) @@ -1321,6 +1325,18 @@ class NsLcmOpTopic(BaseTopic): ) vim_accounts.append(vim_account) + def _get_vim_account(self, vim_id: str, session): + try: + db_filter = self._get_project_filter(session) + db_filter["_id"] = vim_id + return self.db.get_one("vim_accounts", db_filter) + except Exception: + raise EngineException( + "Invalid vimAccountId='{}' not present for the project".format( + vim_id + ) + ) + def _check_valid_wim_account(self, wim_account, wim_accounts, session): if not isinstance(wim_account, str): return @@ -1595,15 +1611,14 @@ class NsLcmOpTopic(BaseTopic): # update vim-account-id vim_account = indata["vimAccountId"] - vca_id = indata.get("vcaId") + vca_id = self._get_vim_account(vim_account, session).get("vca") # check instantiate parameters for vnf_inst_params in get_iterable(indata.get("vnf")): if vnf_inst_params["member-vnf-index"] != member_vnf_index: continue if vnf_inst_params.get("vimAccountId"): vim_account = vnf_inst_params.get("vimAccountId") - if vnf_inst_params.get("vcaId"): - vca_id = vnf_inst_params.get("vcaId") + vca_id = self._get_vim_account(vim_account, session).get("vca") # get vnf.vdu.interface instantiation params to update vnfr.vdur.interfaces ip, mac for vdu_inst_param in get_iterable(vnf_inst_params.get("vdu")):