Fix Bug 2303:NS instance name getting truncated in OpenStack
[osm/RO.git] / NG-RO / osm_ng_ro / ns.py
index 6cab53a..c71e113 100644 (file)
@@ -737,9 +737,11 @@ class Ns(object):
             # Pinning policy "ISOLATE" uses cores as host should not support SMT architecture
             # Pinning policy "PREFER" uses threads in case host supports SMT architecture
             numa[
-                "cores"
-                if guest_epa_quota.get("cpu-thread-pinning-policy") == "ISOLATE"
-                else "threads"
+                (
+                    "cores"
+                    if guest_epa_quota.get("cpu-thread-pinning-policy") == "ISOLATE"
+                    else "threads"
+                )
             ] = max(vcpu_count, 1)
             local_epa_vcpu_set = True
 
@@ -1835,9 +1837,9 @@ class Ns(object):
 
         extra_dict["params"] = {
             "name": "{}-{}-{}-{}".format(
-                indata["name"][:16],
-                vnfr["member-vnf-index-ref"][:16],
-                target_vdu["vdu-name"][:32],
+                indata["name"],
+                vnfr["member-vnf-index-ref"],
+                target_vdu["vdu-name"],
                 target_vdu.get("count-index") or 0,
             ),
             "description": target_vdu["vdu-name"],
@@ -1999,7 +2001,11 @@ class Ns(object):
                 net_item["model"] = interface.get("type")
 
             if interface.get("ip-address"):
-                net_item["ip_address"] = interface["ip-address"]
+                dual_ip = interface.get("ip-address").split(";")
+                if len(dual_ip) == 2:
+                    net_item["ip_address"] = dual_ip
+                else:
+                    net_item["ip_address"] = interface["ip-address"]
 
             if interface.get("mac-address"):
                 net_item["mac_address"] = interface["mac-address"]
@@ -2064,9 +2070,9 @@ class Ns(object):
 
         extra_dict["params"] = {
             "name": "{}-{}-{}-{}".format(
-                db_nsr["name"][:16],
-                vnfr["member-vnf-index-ref"][:16],
-                existing_vdu["vdu-name"][:32],
+                db_nsr["name"],
+                vnfr["member-vnf-index-ref"],
+                existing_vdu["vdu-name"],
                 existing_vdu.get("count-index") or 0,
             ),
             "description": existing_vdu["vdu-name"],
@@ -3393,9 +3399,9 @@ class Ns(object):
 
         return_data = {
             "status": global_status,
-            "details": ". ".join(details)
-            if details
-            else "progress {}/{}".format(done, total),
+            "details": (
+                ". ".join(details) if details else "progress {}/{}".format(done, total)
+            ),
             "nsr_id": nsr_id,
             "action_id": action_id,
             "tasks": task_list,