+
+ if vdu_needed_access:
+ for vnf_member in nsd.get("constituent-vnfd"):
+ if vnf_member["vnfd-id-ref"] != vnfd_ref:
+ continue
+ for vdu in vdu_needed_access:
+ populate_dict(RO_ns_params,
+ ("vnfs", vnf_member["member-vnf-index"], "vdus", vdu, "mgmt_keys"),
+ n2vc_key_list)
+
+ if ns_params.get("vduImage"):
+ RO_ns_params["vduImage"] = ns_params["vduImage"]
+
+ if ns_params.get("ssh_keys"):
+ RO_ns_params["cloud-config"] = {"key-pairs": ns_params["ssh_keys"]}
+ for vnf_params in get_iterable(ns_params, "vnf"):
+ for constituent_vnfd in nsd["constituent-vnfd"]:
+ if constituent_vnfd["member-vnf-index"] == vnf_params["member-vnf-index"]:
+ vnf_descriptor = vnfd_dict[constituent_vnfd["vnfd-id-ref"]]
+ break
+ else:
+ raise LcmException("Invalid instantiate parameter vnf:member-vnf-index={} is not present at nsd:"
+ "constituent-vnfd".format(vnf_params["member-vnf-index"]))
+ if vnf_params.get("vimAccountId"):
+ populate_dict(RO_ns_params, ("vnfs", vnf_params["member-vnf-index"], "datacenter"),
+ vim_account_2_RO(vnf_params["vimAccountId"]))
+
+ for vdu_params in get_iterable(vnf_params, "vdu"):
+ # TODO feature 1417: check that this VDU exist and it is not a PDU
+ if vdu_params.get("volume"):
+ for volume_params in vdu_params["volume"]:
+ if volume_params.get("vim-volume-id"):
+ populate_dict(RO_ns_params, ("vnfs", vnf_params["member-vnf-index"], "vdus",
+ vdu_params["id"], "devices", volume_params["name"], "vim_id"),
+ volume_params["vim-volume-id"])
+ if vdu_params.get("interface"):
+ for interface_params in vdu_params["interface"]:
+ if interface_params.get("ip-address"):
+ populate_dict(RO_ns_params, ("vnfs", vnf_params["member-vnf-index"], "vdus",
+ vdu_params["id"], "interfaces", interface_params["name"],
+ "ip_address"),
+ interface_params["ip-address"])
+ if interface_params.get("mac-address"):
+ populate_dict(RO_ns_params, ("vnfs", vnf_params["member-vnf-index"], "vdus",
+ vdu_params["id"], "interfaces", interface_params["name"],
+ "mac_address"),
+ interface_params["mac-address"])
+ if interface_params.get("floating-ip-required"):
+ populate_dict(RO_ns_params, ("vnfs", vnf_params["member-vnf-index"], "vdus",
+ vdu_params["id"], "interfaces", interface_params["name"],
+ "floating-ip"),
+ interface_params["floating-ip-required"])
+
+ for internal_vld_params in get_iterable(vnf_params, "internal-vld"):
+ if internal_vld_params.get("vim-network-name"):
+ populate_dict(RO_ns_params, ("vnfs", vnf_params["member-vnf-index"], "networks",
+ internal_vld_params["name"], "vim-network-name"),
+ internal_vld_params["vim-network-name"])
+ if internal_vld_params.get("ip-profile"):
+ populate_dict(RO_ns_params, ("vnfs", vnf_params["member-vnf-index"], "networks",
+ internal_vld_params["name"], "ip-profile"),
+ ip_profile_2_RO(internal_vld_params["ip-profile"]))
+
+ for icp_params in get_iterable(internal_vld_params, "internal-connection-point"):
+ # look for interface
+ iface_found = False
+ for vdu_descriptor in vnf_descriptor["vdu"]:
+ for vdu_interface in vdu_descriptor["interface"]:
+ if vdu_interface.get("internal-connection-point-ref") == icp_params["id-ref"]:
+ if icp_params.get("ip-address"):
+ populate_dict(RO_ns_params, ("vnfs", vnf_params["member-vnf-index"], "vdus",
+ vdu_descriptor["id"], "interfaces",
+ vdu_interface["name"], "ip_address"),
+ icp_params["ip-address"])
+
+ if icp_params.get("mac-address"):
+ populate_dict(RO_ns_params, ("vnfs", vnf_params["member-vnf-index"], "vdus",
+ vdu_descriptor["id"], "interfaces",
+ vdu_interface["name"], "mac_address"),
+ icp_params["mac-address"])
+ iface_found = True