X-Git-Url: https://osm.etsi.org/gitweb/?a=blobdiff_plain;f=RO%2Fosm_ro%2Fnfvo.py;h=f06bce41f84cb30885abad33687acf1405185770;hb=f9ce4e432f498dd9e597638c2aef525db6cc3221;hp=25d8cc6cb597cba30f1fc2fcfe2d7bc008d651bf;hpb=79870eac1909757c72047fc0b7df1444ce566fc5;p=osm%2FRO.git diff --git a/RO/osm_ro/nfvo.py b/RO/osm_ro/nfvo.py index 25d8cc6c..f06bce41 100644 --- a/RO/osm_ro/nfvo.py +++ b/RO/osm_ro/nfvo.py @@ -3315,7 +3315,10 @@ def create_instance(mydb, tenant_id, instance_dict): # 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 + urls = [myvims[v].url for v in involved_datacenters] + if len(set(urls)) < 2: + wim_usage[sce_net['uuid']] = False + elif 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 @@ -4188,14 +4191,14 @@ def instantiate_vnf(mydb, sce_vnf, params, params_out, rollbackList): db_vm_iface_instance.update(db_vm_iface) if db_vm_iface_instance.get("ip_address"): # increment ip_address ip = db_vm_iface_instance.get("ip_address") - i = ip.rfind(".") - if i > 0: - try: + try: + i = ip.rfind(".") + if i > 0: i += 1 ip = ip[i:] + str(int(ip[:i]) + 1) db_vm_iface_instance["ip_address"] = ip - except: - db_vm_iface_instance["ip_address"] = None + except: + db_vm_iface_instance["ip_address"] = None db_instance_interfaces.append(db_vm_iface_instance) myVMDict['networks'][iface_index]["uuid"] = iface_uuid iface_index += 1 @@ -4908,16 +4911,16 @@ def instance_action(mydb,nfvo_tenant,instance_id, action_dict): for iface in task_params_copy[5]: iface["uuid"] = iface2iface[iface["uuid"]] # increment ip_address - if "ip_address" in iface: - ip = iface.get("ip_address") - i = ip.rfind(".") - if i > 0: - try: + if iface.get("ip_address"): + try: + ip = iface["ip_address"] + i = ip.rfind(".") + if i > 0: i += 1 ip = ip[i:] + str(int(ip[:i]) + 1) iface["ip_address"] = ip - except: - iface["ip_address"] = None + except: + iface["ip_address"] = None if vm_name: task_params_copy[0] = vm_name db_vim_action = { @@ -5325,7 +5328,7 @@ def edit_vim_account(mydb, nfvo_tenant, datacenter_tenant_id, datacenter_id=None if config: original_config_dict = yaml.load(original_config, Loader=yaml.Loader) original_config_dict.update(config) - update["config"] = yaml.safe_dump(original_config_dict, default_flow_style=True, width=256) + update_["config"] = yaml.safe_dump(original_config_dict, default_flow_style=True, width=256) if name: update_['name'] = name if vim_tenant: