From: aticig Date: Tue, 14 Jun 2022 00:01:36 +0000 (+0300) Subject: Fix Bug 2028 Multi-site VNF creation fails X-Git-Tag: v11.0.4^0 X-Git-Url: https://osm.etsi.org/gitweb/?a=commitdiff_plain;h=refs%2Fchanges%2F29%2F12329%2F7;p=osm%2FLCM.git Fix Bug 2028 Multi-site VNF creation fails This fix will provide to use the vim_network_name from instantiation parameters if it exists, if not, network which is given in NSD will be used for the NS which is instantiated on multi-site VIMs. Change-Id: Ie39e3444428474c8db01d59ef1a1995644ea6a81 Signed-off-by: aticig --- diff --git a/osm_lcm/ns.py b/osm_lcm/ns.py index 5ce18c87..19be2083 100644 --- a/osm_lcm/ns.py +++ b/osm_lcm/ns.py @@ -872,18 +872,55 @@ class NsLcm(LcmBase): get_iterable(vdur, "interfaces"), lambda iface: iface.get("ns-vld-id") == a_vld["name"], ) + + vld_params = find_in_list( + get_iterable(ns_params, "vld"), + lambda v_vld: v_vld["name"] in (a_vld["name"], a_vld["id"]), + ) if target_vld: + if vnf_params.get("vimAccountId") not in a_vld.get( "vim_info", {} ): + target_vim_network_list = [ + v for _, v in a_vld.get("vim_info").items() + ] + target_vim_network_name = next( + ( + item.get("vim_network_name", "") + for item in target_vim_network_list + ), + "", + ) + target["ns"]["vld"][a_index].get("vim_info").update( { "vim:{}".format(vnf_params["vimAccountId"]): { - "vim_network_name": "" + "vim_network_name": target_vim_network_name, } } ) + if vld_params: + for param in ("vim-network-name", "vim-network-id"): + if vld_params.get(param) and isinstance( + vld_params[param], dict + ): + for vim, vim_net in vld_params[ + param + ].items(): + other_target_vim = "vim:" + vim + populate_dict( + target["ns"]["vld"][a_index].get( + "vim_info" + ), + ( + other_target_vim, + param.replace("-", "_"), + ), + vim_net, + ) + nslcmop_id = db_nslcmop["_id"] target = { "name": db_nsr["name"],