+ @staticmethod
+ def _select_persistent_root_disk(vsd: dict, vdu: dict) -> dict:
+ """Selects the persistent root disk if exists.
+ Args:
+ vsd (dict): Virtual storage descriptors in VNFD
+ vdu (dict): VNF descriptor
+
+ Returns:
+ root_disk (dict): Selected persistent root disk
+ """
+ if vsd.get("id") == vdu.get("virtual-storage-desc", [[]])[0]:
+ root_disk = vsd
+ if root_disk.get(
+ "type-of-storage"
+ ) == "persistent-storage:persistent-storage" and root_disk.get(
+ "size-of-storage"
+ ):
+ return root_disk
+
+ @staticmethod
+ def _add_persistent_root_disk_to_disk_list(
+ vnfd: dict, target_vdu: dict, persistent_root_disk: dict, disk_list: list
+ ) -> None:
+ """Find the persistent root disk and add to disk list.
+
+ Args:
+ vnfd (dict): VNF descriptor
+ target_vdu (dict): Details of VDU to be created
+ persistent_root_disk (dict): Details of persistent root disk
+ disk_list (list): Disks of VDU
+
+ """
+ for vdu in vnfd.get("vdu", ()):
+ if vdu["name"] == target_vdu["vdu-name"]:
+ for vsd in vnfd.get("virtual-storage-desc", ()):
+ root_disk = Ns._select_persistent_root_disk(vsd, vdu)
+ if not root_disk:
+ continue
+
+ persistent_root_disk[vsd["id"]] = {
+ "image_id": vdu.get("sw-image-desc"),
+ "size": root_disk["size-of-storage"],
+ "keep": Ns.is_volume_keeping_required(root_disk),
+ }
+
+ disk_list.append(persistent_root_disk[vsd["id"]])
+ break
+
+ @staticmethod
+ def _add_persistent_ordinary_disks_to_disk_list(
+ target_vdu: dict,
+ persistent_root_disk: dict,
+ persistent_ordinary_disk: dict,
+ disk_list: list,
+ ) -> None:
+ """Fill the disk list by adding persistent ordinary disks.
+
+ Args:
+ target_vdu (dict): Details of VDU to be created
+ persistent_root_disk (dict): Details of persistent root disk
+ persistent_ordinary_disk (dict): Details of persistent ordinary disk
+ disk_list (list): Disks of VDU
+
+ """
+ if target_vdu.get("virtual-storages"):
+ for disk in target_vdu["virtual-storages"]:
+ if (
+ disk.get("type-of-storage")
+ == "persistent-storage:persistent-storage"
+ and disk["id"] not in persistent_root_disk.keys()
+ ):
+ persistent_ordinary_disk[disk["id"]] = {
+ "size": disk["size-of-storage"],
+ "keep": Ns.is_volume_keeping_required(disk),
+ }
+ disk_list.append(persistent_ordinary_disk[disk["id"]])
+
+ @staticmethod
+ def _prepare_vdu_affinity_group_list(
+ target_vdu: dict, extra_dict: dict, ns_preffix: str
+ ) -> List[Dict[str, any]]:
+ """Process affinity group details to prepare affinity group list.
+
+ Args:
+ target_vdu (dict): Details of VDU to be created
+ extra_dict (dict): Dictionary to be filled
+ ns_preffix (str): Prefix as string
+
+ Returns:
+
+ affinity_group_list (list): Affinity group details
+
+ """
+ affinity_group_list = []
+
+ if target_vdu.get("affinity-or-anti-affinity-group-id"):
+ for affinity_group_id in target_vdu["affinity-or-anti-affinity-group-id"]:
+ affinity_group = {}
+ affinity_group_text = (
+ ns_preffix + ":affinity-or-anti-affinity-group." + affinity_group_id
+ )
+
+ if not isinstance(extra_dict.get("depends_on"), list):
+ raise NsException("Invalid extra_dict format.")
+
+ extra_dict["depends_on"].append(affinity_group_text)
+ affinity_group["affinity_group_id"] = "TASK-" + affinity_group_text
+ affinity_group_list.append(affinity_group)
+
+ return affinity_group_list
+
+ @staticmethod
+ def _process_vdu_params(
+ target_vdu: Dict[str, Any],
+ indata: Dict[str, Any],
+ vim_info: Dict[str, Any],
+ target_record_id: str,
+ **kwargs: Dict[str, Any],
+ ) -> Dict[str, Any]:
+ """Function to process VDU parameters.
+
+ Args:
+ target_vdu (Dict[str, Any]): [description]
+ indata (Dict[str, Any]): [description]
+ vim_info (Dict[str, Any]): [description]
+ target_record_id (str): [description]
+
+ Returns:
+ Dict[str, Any]: [description]
+ """
+ vnfr_id = kwargs.get("vnfr_id")
+ nsr_id = kwargs.get("nsr_id")
+ vnfr = kwargs.get("vnfr")
+ vdu2cloud_init = kwargs.get("vdu2cloud_init")
+ tasks_by_target_record_id = kwargs.get("tasks_by_target_record_id")
+ logger = kwargs.get("logger")
+ db = kwargs.get("db")
+ fs = kwargs.get("fs")
+ ro_nsr_public_key = kwargs.get("ro_nsr_public_key")
+
+ vnf_preffix = "vnfrs:{}".format(vnfr_id)
+ ns_preffix = "nsrs:{}".format(nsr_id)
+ image_text = ns_preffix + ":image." + target_vdu["ns-image-id"]
+ flavor_text = ns_preffix + ":flavor." + target_vdu["ns-flavor-id"]
+ extra_dict = {"depends_on": [image_text, flavor_text]}
+ net_list = []
+