from osm_lcm.data_utils.database.database import Database
from osm_lcm.data_utils.filesystem.filesystem import Filesystem
-from osm_lcm.data_utils.wim import (
- get_sdn_ports,
- get_target_wim_attrs,
- select_feasible_wim_account,
-)
from n2vc.n2vc_juju_conn import N2VCJujuConnector
from n2vc.exceptions import N2VCException, N2VCNotFound, K8sException
target_vld["vim_info"][target_sdn]["sdn-ports"] = vld_params[
"provider-network"
]["sdn-ports"]
-
- # check if WIM is needed; if needed, choose a feasible WIM able to connect VIMs
- # if wim_account_id is specified in vld_params, validate if it is feasible.
- wim_account_id, db_wim = select_feasible_wim_account(
- db_nsr, db_vnfrs, target_vld, vld_params, self.logger
- )
-
- if wim_account_id:
- # WIM is needed and a feasible one was found, populate WIM target and SDN ports
- self.logger.info("WIM selected: {:s}".format(str(wim_account_id)))
- # update vld_params with correct WIM account Id
- vld_params["wimAccountId"] = wim_account_id
-
- target_wim = "wim:{}".format(wim_account_id)
- target_wim_attrs = get_target_wim_attrs(nsr_id, target_vld, vld_params)
- sdn_ports = get_sdn_ports(vld_params, db_wim)
- if len(sdn_ports) > 0:
- target_vld["vim_info"][target_wim] = target_wim_attrs
- target_vld["vim_info"][target_wim]["sdn-ports"] = sdn_ports
-
- self.logger.debug(
- "Target VLD with WIM data: {:s}".format(str(target_vld))
- )
-
+ if vld_params.get("wimAccountId"):
+ target_wim = "wim:{}".format(vld_params["wimAccountId"])
+ target_vld["vim_info"][target_wim] = {}
for param in ("vim-network-name", "vim-network-id"):
if vld_params.get(param):
if isinstance(vld_params[param], dict):