Fix 1582 : deploy juju units = number-of-instances
[osm/LCM.git] / osm_lcm / ns.py
index 0d15378..6a4a8e6 100644 (file)
@@ -2390,9 +2390,7 @@ class NsLcm(LcmBase):
                     deploy_params_vdu["OSM"] = get_osm_params(
                         db_vnfr, vdu_id, vdu_count_index=0
                     )
-                    vdud_count = get_vdu_profile(vnfd, vdu_id).get(
-                        "max-number-of-instances", 1
-                    )
+                    vdud_count = get_number_of_instances(vnfd, vdu_id)
 
                     self.logger.debug("VDUD > {}".format(vdud))
                     self.logger.debug(
@@ -2848,13 +2846,16 @@ class NsLcm(LcmBase):
                 "path": nsr_db_path,
             }
 
-            kdu_instance = self.k8scluster_map[
-                k8sclustertype
-            ].generate_kdu_instance_name(
-                db_dict=db_dict_install,
-                kdu_model=k8s_instance_info["kdu-model"],
-                kdu_name=k8s_instance_info["kdu-name"],
-            )
+            if k8s_instance_info.get("kdu-deployment-name"):
+                kdu_instance = k8s_instance_info.get("kdu-deployment-name")
+            else:
+                kdu_instance = self.k8scluster_map[
+                    k8sclustertype
+                ].generate_kdu_instance_name(
+                    db_dict=db_dict_install,
+                    kdu_model=k8s_instance_info["kdu-model"],
+                    kdu_name=k8s_instance_info["kdu-name"],
+                )
             self.update_db_2(
                 "nsrs", nsr_id, {nsr_db_path + ".kdu-instance": kdu_instance}
             )
@@ -3093,6 +3094,7 @@ class NsLcm(LcmBase):
                         if kdud["name"] == kdur["kdu-name"]
                     )
                     namespace = kdur.get("k8s-namespace")
+                    kdu_deployment_name = kdur.get("kdu-deployment-name")
                     if kdur.get("helm-chart"):
                         kdumodel = kdur["helm-chart"]
                         # Default version: helm3, if helm-version is v2 assign v2
@@ -3205,6 +3207,7 @@ class NsLcm(LcmBase):
                         "kdu-name": kdur["kdu-name"],
                         "kdu-model": kdumodel,
                         "namespace": namespace,
+                        "kdu-deployment-name": kdu_deployment_name,
                     }
                     db_path = "_admin.deployed.K8s.{}".format(index)
                     db_nsr_update[db_path] = k8s_instance_info
@@ -5381,7 +5384,6 @@ class NsLcm(LcmBase):
                         # Pre-scale retry check: Check if this sub-operation has been executed before
                         op_index = self._check_or_add_scale_suboperation(
                             db_nslcmop,
-                            nslcmop_id,
                             vnf_index,
                             vnf_config_primitive,
                             primitive_params,
@@ -5790,7 +5792,6 @@ class NsLcm(LcmBase):
                         # Post-scale retry check: Check if this sub-operation has been executed before
                         op_index = self._check_or_add_scale_suboperation(
                             db_nslcmop,
-                            nslcmop_id,
                             vnf_index,
                             vnf_config_primitive,
                             primitive_params,