vdur_copy = deepcopy(vdur)
vdur_copy["status"] = "BUILD"
vdur_copy["status-detailed"] = None
- vdur_copy["ip-address"]: None
+ vdur_copy["ip-address"] = None
vdur_copy["_id"] = str(uuid4())
vdur_copy["count-index"] += count + 1
vdur_copy["id"] = "{}-{}".format(
# read from db: operation
stage[1] = "Getting nslcmop={} from db.".format(nslcmop_id)
db_nslcmop = self.db.get_one("nslcmops", {"_id": nslcmop_id})
+ if db_nslcmop["operationParams"].get("additionalParamsForVnf"):
+ db_nslcmop["operationParams"]["additionalParamsForVnf"] = json.loads(
+ db_nslcmop["operationParams"]["additionalParamsForVnf"]
+ )
ns_params = db_nslcmop.get("operationParams")
if ns_params and ns_params.get("timeout_ns_deploy"):
timeout_ns_deploy = ns_params["timeout_ns_deploy"]
# for each vnf in ns, read vnfd
for vnfr in db_vnfrs_list:
+ if vnfr.get("kdur"):
+ kdur_list = []
+ for kdur in vnfr["kdur"]:
+ if kdur.get("additionalParams"):
+ kdur["additionalParams"] = json.loads(kdur["additionalParams"])
+ kdur_list.append(kdur)
+ vnfr["kdur"] = kdur_list
+
db_vnfrs[vnfr["member-vnf-index-ref"]] = vnfr
vnfd_id = vnfr["vnfd-id"]
vnfd_ref = vnfr["vnfd-ref"]
step = "Getting information from database"
db_nslcmop = self.db.get_one("nslcmops", {"_id": nslcmop_id})
db_nsr = self.db.get_one("nsrs", {"_id": nsr_id})
+ if db_nslcmop["operationParams"].get("primitive_params"):
+ db_nslcmop["operationParams"]["primitive_params"] = json.loads(
+ db_nslcmop["operationParams"]["primitive_params"]
+ )
nsr_deployed = db_nsr["_admin"].get("deployed")
vnf_index = db_nslcmop["operationParams"].get("member_vnf_index")
for kdu_delta in delta.get("kdu-resource-delta", {}):
kdu_profile = get_kdu_resource_profile(db_vnfd, kdu_delta["id"])
kdu_name = kdu_profile["kdu-name"]
- resource_name = kdu_profile["resource-name"]
+ resource_name = kdu_profile.get("resource-name", "")
# Might have different kdus in the same delta
# Should have list for each kdu
and kdur.get("helm-version") == "v2"
):
k8s_cluster_type = "helm-chart"
- raise NotImplementedError
elif kdur.get("juju-bundle"):
k8s_cluster_type = "juju-bundle"
else:
kdu_instance = deployed_kdu.get("kdu-instance")
instance_num = await self.k8scluster_map[
k8s_cluster_type
- ].get_scale_count(resource_name, kdu_instance, vca_id=vca_id)
+ ].get_scale_count(
+ resource_name,
+ kdu_instance,
+ vca_id=vca_id,
+ cluster_uuid=deployed_kdu.get("k8scluster-uuid"),
+ kdu_model=deployed_kdu.get("kdu-model"),
+ )
kdu_replica_count = instance_num + kdu_delta.get(
"number-of-instances", 1
)
for kdu_delta in delta.get("kdu-resource-delta", {}):
kdu_profile = get_kdu_resource_profile(db_vnfd, kdu_delta["id"])
kdu_name = kdu_profile["kdu-name"]
- resource_name = kdu_profile["resource-name"]
+ resource_name = kdu_profile.get("resource-name", "")
if not scaling_info["kdu-delete"].get(kdu_name, None):
scaling_info["kdu-delete"][kdu_name] = []
and kdur.get("helm-version") == "v2"
):
k8s_cluster_type = "helm-chart"
- raise NotImplementedError
elif kdur.get("juju-bundle"):
k8s_cluster_type = "juju-bundle"
else:
kdu_instance = deployed_kdu.get("kdu-instance")
instance_num = await self.k8scluster_map[
k8s_cluster_type
- ].get_scale_count(resource_name, kdu_instance, vca_id=vca_id)
+ ].get_scale_count(
+ resource_name,
+ kdu_instance,
+ vca_id=vca_id,
+ cluster_uuid=deployed_kdu.get("k8scluster-uuid"),
+ kdu_model=deployed_kdu.get("kdu-model"),
+ )
kdu_replica_count = instance_num - kdu_delta.get(
"number-of-instances", 1
)
)
cluster_uuid = deployed_kdu["k8scluster-uuid"]
kdu_instance = deployed_kdu["kdu-instance"]
+ kdu_model = deployed_kdu.get("kdu-model")
scale = int(kdu_scaling_info["scale"])
k8s_cluster_type = kdu_scaling_info["k8s-cluster-type"]
scale,
kdu_scaling_info["resource-name"],
vca_id=vca_id,
+ cluster_uuid=cluster_uuid,
+ kdu_model=kdu_model,
+ atomic=True,
+ db_dict=db_dict,
),
timeout=self.timeout_vca_on_error,
)