+ sce_net_uuid = sce_net.get('uuid', sce_net["name"])
+ # get involved datacenters where this network need to be created
+ involved_datacenters = []
+ for sce_vnf in scenarioDict.get("vnfs", ()):
+ vnf_datacenter = sce_vnf.get("datacenter", default_datacenter_id)
+ if vnf_datacenter in involved_datacenters:
+ continue
+ if sce_vnf.get("interfaces"):
+ for sce_vnf_ifaces in sce_vnf["interfaces"]:
+ if sce_vnf_ifaces.get("sce_net_id") == sce_net["uuid"]:
+ involved_datacenters.append(vnf_datacenter)
+ break
+ if not involved_datacenters:
+ involved_datacenters.append(default_datacenter_id)
+ target_wim_account = sce_net.get("wim_account", default_wim_account)
+
+ # --> WIM
+ # TODO: use this information during network creation
+ wim_account_id = wim_account_name = None
+ if len(involved_datacenters) > 1 and 'uuid' in sce_net:
+ if target_wim_account is None or target_wim_account is True: # automatic selection of WIM
+ # OBS: sce_net without uuid are used internally to VNFs
+ # and the assumption is that VNFs will not be split among
+ # different datacenters
+ wim_account = wim_engine.find_suitable_wim_account(
+ involved_datacenters, tenant_id)
+ wim_account_id = wim_account['uuid']
+ wim_account_name = wim_account['name']
+ wim_usage[sce_net['uuid']] = wim_account_id
+ elif isinstance(target_wim_account, str): # manual selection of WIM
+ wim_account.persist.get_wim_account_by(target_wim_account, tenant_id)
+ wim_account_id = wim_account['uuid']
+ wim_account_name = wim_account['name']
+ wim_usage[sce_net['uuid']] = wim_account_id
+ else: # not WIM usage
+ wim_usage[sce_net['uuid']] = False
+ # <-- WIM
+
+ descriptor_net = {}
+ if instance_dict.get("networks"):
+ if sce_net.get("uuid") in instance_dict["networks"]:
+ descriptor_net = instance_dict["networks"][sce_net["uuid"]]
+ descriptor_net_name = sce_net["uuid"]
+ elif sce_net.get("osm_id") in instance_dict["networks"]:
+ descriptor_net = instance_dict["networks"][sce_net["osm_id"]]
+ descriptor_net_name = sce_net["osm_id"]
+ elif sce_net["name"] in instance_dict["networks"]:
+ descriptor_net = instance_dict["networks"][sce_net["name"]]
+ descriptor_net_name = sce_net["name"]