X-Git-Url: https://osm.etsi.org/gitweb/?a=blobdiff_plain;f=NG-RO%2Fosm_ng_ro%2Fns.py;h=ece7ee5bf2d55744d2dcf07a8058c859078ba693;hb=refs%2Fchanges%2F63%2F13163%2F4;hp=4e88cc4b976f60c1314ea269c93d78cf5f097ad2;hpb=21c55d66c67cce097adab2f237356388b1a16077;p=osm%2FRO.git diff --git a/NG-RO/osm_ng_ro/ns.py b/NG-RO/osm_ng_ro/ns.py index 4e88cc4b..ece7ee5b 100644 --- a/NG-RO/osm_ng_ro/ns.py +++ b/NG-RO/osm_ng_ro/ns.py @@ -862,44 +862,6 @@ class Ns(object): return extra_dict - @staticmethod - def _ip_profile_to_ro( - ip_profile: Dict[str, Any], - ) -> Dict[str, Any]: - """[summary] - - Args: - ip_profile (Dict[str, Any]): [description] - - Returns: - Dict[str, Any]: [description] - """ - if not ip_profile: - return None - - ro_ip_profile = { - "ip_version": "IPv4" - if "v4" in ip_profile.get("ip-version", "ipv4") - else "IPv6", - "subnet_address": ip_profile.get("subnet-address"), - "gateway_address": ip_profile.get("gateway-address"), - "dhcp_enabled": ip_profile.get("dhcp-params", {}).get("enabled", False), - "dhcp_start_address": ip_profile.get("dhcp-params", {}).get( - "start-address", None - ), - "dhcp_count": ip_profile.get("dhcp-params", {}).get("count", None), - } - - if ip_profile.get("dns-server"): - ro_ip_profile["dns_address"] = ";".join( - [v["address"] for v in ip_profile["dns-server"] if v.get("address")] - ) - - if ip_profile.get("security-group"): - ro_ip_profile["security_group"] = ip_profile["security-group"] - - return ro_ip_profile - @staticmethod def _process_net_params( target_vld: Dict[str, Any], @@ -963,7 +925,7 @@ class Ns(object): "net_name": ( f"{indata.get('name')[:16]}-{target_vld.get('name', target_vld.get('id'))[:16]}" ), - "ip_profile": Ns._ip_profile_to_ro(vim_info.get("ip_profile")), + "ip_profile": vim_info.get("ip_profile"), "provider_network_profile": vim_info.get("provider_network"), } @@ -1522,13 +1484,13 @@ class Ns(object): 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]} + extra_dict = {"depends_on": [image_text]} net_list = [] persistent_root_disk = {} persistent_ordinary_disk = {} vdu_instantiation_volumes_list = [] + vdu_instantiation_flavor_id = None disk_list = [] vnfd_id = vnfr["vnfd-id"] vnfd = db.get_one("vnfds", {"_id": vnfd_id}) @@ -1566,9 +1528,20 @@ class Ns(object): if target_vdu.get("additionalParams"): vdu_instantiation_volumes_list = ( - target_vdu.get("additionalParams").get("OSM").get("vdu_volumes") + target_vdu.get("additionalParams").get("OSM", {}).get("vdu_volumes") + ) + vdu_instantiation_flavor_id = ( + target_vdu.get("additionalParams").get("OSM", {}).get("vim_flavor_id") ) + # flavor id + if vdu_instantiation_flavor_id: + flavor_id = vdu_instantiation_flavor_id + else: + flavor_text = ns_preffix + ":flavor." + target_vdu["ns-flavor-id"] + flavor_id = "TASK-" + flavor_text + extra_dict["depends_on"].append(flavor_text) + if vdu_instantiation_volumes_list: # Find the root volumes and add to the disk_list persistent_root_disk = Ns.find_persistent_root_volumes( @@ -1609,7 +1582,7 @@ class Ns(object): "description": target_vdu["vdu-name"], "start": True, "image_id": "TASK-" + image_text, - "flavor_id": "TASK-" + flavor_text, + "flavor_id": flavor_id, "affinity_group_list": affinity_group_list, "net_list": net_list, "cloud_config": cloud_config or None,