bugfix(ip/mac): increments only in extra VDU, not the first one. Bug 1578
[osm/NBI.git] / osm_nbi / instance_topics.py
index 1486133..d76b0b1 100644 (file)
@@ -710,9 +710,14 @@ class NsrTopic(BaseTopic):
             if kdu_params and kdu_params.get("k8s-namespace"):
                 kdu_k8s_namespace = kdu_params["k8s-namespace"]
 
+            kdu_deployment_name = ""
+            if kdu_params and kdu_params.get("kdu-deployment-name"):
+                kdu_deployment_name = kdu_params.get("kdu-deployment-name")
+
             kdur = {
                 "additionalParams": additional_params,
                 "k8s-namespace": kdu_k8s_namespace,
+                "kdu-deployment-name": kdu_deployment_name,
                 "kdu-name": kdu["name"],
                 # TODO      "name": ""     Name of the VDU in the VIM
                 "ip-address": None,  # mgmt-interface filled by LCM
@@ -933,9 +938,9 @@ class NsrTopic(BaseTopic):
             for index in range(0, count):
                 vdur = deepcopy(vdur)
                 for iface in vdur["interfaces"]:
-                    if iface.get("ip-address"):
+                    if iface.get("ip-address") and index != 0:
                         iface["ip-address"] = increment_ip_mac(iface["ip-address"])
-                    if iface.get("mac-address"):
+                    if iface.get("mac-address") and index != 0:
                         iface["mac-address"] = increment_ip_mac(iface["mac-address"])
 
                 vdur["_id"] = str(uuid4())