+ db_nsir_update_RO["vld_id"] = netslice_vld["name"]
+ if self.ro_config["ng"]:
+ db_nsir_update_RO["netslice_scenario_id"] = (
+ vld_shared.get("instance_scenario_id")
+ if vld_shared
+ else "nsir:{}:vld.{}".format(nsir_id, netslice_vld["name"])
+ )
+ else: # if not self.ro_config["ng"]:
+ if netslice_vld.get("mgmt-network"):
+ mgmt_network = True
+ RO_ns_params = {}
+ RO_ns_params["name"] = netslice_vld["name"]
+ RO_ns_params["datacenter"] = vim_account_2_RO(
+ db_nsir["instantiation_parameters"]["vimAccountId"]
+ )
+
+ # Creating scenario if vim-network-name / vim-network-id are present as instantiation parameter
+ # Use vim-network-id instantiation parameter
+ vim_network_option = None
+ if ip_vld:
+ if ip_vld.get("vim-network-id"):
+ vim_network_option = "vim-network-id"
+ elif ip_vld.get("vim-network-name"):
+ vim_network_option = "vim-network-name"
+ if ip_vld.get("ip-profile"):
+ populate_dict(
+ RO_ns_params,
+ ("networks", netslice_vld["name"], "ip-profile"),
+ ip_profile_2_RO(ip_vld["ip-profile"]),
+ )
+
+ if vim_network_option:
+ if ip_vld.get(vim_network_option):
+ if isinstance(ip_vld.get(vim_network_option), list):
+ for vim_net_id in ip_vld.get(vim_network_option):
+ for vim_account, vim_net in vim_net_id.items():
+ RO_vld_sites.append(
+ {
+ "netmap-use": vim_net,
+ "datacenter": vim_account_2_RO(
+ vim_account
+ ),
+ }
+ )
+ elif isinstance(ip_vld.get(vim_network_option), dict):
+ for vim_account, vim_net in ip_vld.get(
+ vim_network_option
+ ).items():
+ RO_vld_sites.append(
+ {
+ "netmap-use": vim_net,
+ "datacenter": vim_account_2_RO(vim_account),
+ }
+ )
+ else:
+ RO_vld_sites.append(
+ {
+ "netmap-use": ip_vld[vim_network_option],
+ "datacenter": vim_account_2_RO(
+ netslice_vld["vimAccountId"]
+ ),
+ }
+ )
+
+ # Use default netslice vim-network-name from template
+ else:
+ for nss_conn_point_ref in get_iterable(
+ netslice_vld, "nss-connection-point-ref"
+ ):
+ if nss_conn_point_ref.get("vimAccountId"):
+ if (
+ nss_conn_point_ref["vimAccountId"]
+ != netslice_vld["vimAccountId"]
+ ):
+ RO_vld_sites.append(
+ {
+ "netmap-create": None,
+ "datacenter": vim_account_2_RO(
+ nss_conn_point_ref["vimAccountId"]
+ ),
+ }
+ )
+
+ if vld_shared:
+ populate_dict(
+ RO_ns_params,
+ ("networks", netslice_vld["name"], "use-network"),
+ vld_shared,
+ )
+
+ if RO_vld_sites:
+ populate_dict(
+ RO_ns_params,
+ ("networks", netslice_vld["name"], "sites"),
+ RO_vld_sites,
+ )
+
+ RO_ns_params["scenario"] = {
+ "nets": [
+ {
+ "name": netslice_vld["name"],
+ "external": mgmt_network,
+ "type": "bridge",
+ }
+ ]
+ }
+
+ # self.logger.debug(logging_text + step)
+ desc = await RO.create("ns", descriptor=RO_ns_params)
+ db_nsir_update_RO["netslice_scenario_id"] = desc["uuid"]