From: lloretgalleg Date: Tue, 15 Dec 2020 10:54:02 +0000 (+0000) Subject: Changes for IM change 10095: remove kdu-model X-Git-Tag: v9.0.0rc1 X-Git-Url: https://osm.etsi.org/gitweb/?a=commitdiff_plain;h=2211d39b4fc65a8eff2fda5e10ee28ed2ada0787;p=osm%2FLCM.git Changes for IM change 10095: remove kdu-model Change-Id: I14dff0d94e8deb389d915f43e2a8aa41c618ca76 Signed-off-by: lloretgalleg --- diff --git a/osm_lcm/data_utils/vnfd.py b/osm_lcm/data_utils/vnfd.py index b12f7d03..f312e577 100644 --- a/osm_lcm/data_utils/vnfd.py +++ b/osm_lcm/data_utils/vnfd.py @@ -23,6 +23,7 @@ ## from osm_lcm.data_utils import list_utils +from osm_lcm.lcm_utils import get_iterable def get_lcm_operations_configuration(vnfd): @@ -88,12 +89,6 @@ def get_vdu_profile(vnfd, vdu_profile_id): lambda vdu_profile: vdu_profile["id"] == vdu_profile_id) -def get_kdu_profile(vnfd, kdu_profile_id): - return list_utils.find_in_list( - vnfd.get("df", ())[0]["kdu-profile"], - lambda kdu_profile: kdu_profile["name"] == kdu_profile_id) - - def get_vnf_configuration(vnfd): if "vnf-configuration-id" not in vnfd.get("df")[0]: return None @@ -110,11 +105,10 @@ def get_vdu_configuration(vnfd, vdu_id): lambda vdu_configuration: vdu_configuration["id"] == vdu_profile["vdu-configuration-id"]) -def get_kdu_configuration(vnfd, kdu_id): - kdu_profile = get_kdu_profile(vnfd, kdu_id) - return list_utils.find_in_list( - vnfd.get("kdu-configuration", ()), - lambda kdu_configuration: kdu_configuration["id"] == kdu_profile["kdu-configuration-id"]) +def get_kdu_configuration(vnfd, kdu_name): + for kdu in get_iterable(vnfd, "kdu"): + if kdu_name == kdu["name"]: + return kdu.get("kdu-configuration") def get_virtual_link_profiles(vnfd): diff --git a/osm_lcm/ns.py b/osm_lcm/ns.py index 29721b39..8e0beb65 100644 --- a/osm_lcm/ns.py +++ b/osm_lcm/ns.py @@ -1844,7 +1844,7 @@ class NsLcm(LcmBase): ) for kdud in get_kdu_list(vnfd): kdu_name = kdud["name"] - descriptor_config = get_kdu_configuration(vnfd, kdu_name) + descriptor_config = kdud.get('kdu-configuration') if descriptor_config: vdu_id = None vdu_index = 0 @@ -2313,14 +2313,14 @@ class NsLcm(LcmBase): kdud = next(kdud for kdud in vnfd_with_id["kdu"] if kdud["name"] == kdur["kdu-name"]) namespace = kdur.get("k8s-namespace") if kdur.get("helm-chart"): - kdumodel = kdur["helm-chart"]["kdu-model-locator"] + kdumodel = kdur["helm-chart"] # Default version: helm3, if helm-version is v2 assign v2 k8sclustertype = "helm-chart-v3" self.logger.debug("kdur: {}".format(kdur)) if kdur.get("helm-version") and kdur.get("helm-version") == "v2": k8sclustertype = "helm-chart" elif kdur.get("juju-bundle"): - kdumodel = kdur["juju-bundle"]["kdu-model-locator"] + kdumodel = kdur["juju-bundle"] k8sclustertype = "juju-bundle" else: raise LcmException("kdu type for kdu='{}.{}' is neither helm-chart nor " diff --git a/osm_lcm/tests/test_db_descriptors.py b/osm_lcm/tests/test_db_descriptors.py index 2a346b0a..080d88d0 100644 --- a/osm_lcm/tests/test_db_descriptors.py +++ b/osm_lcm/tests/test_db_descriptors.py @@ -1254,16 +1254,12 @@ db_vnfrs_text = """ k8s-cluster: id: e7169dab-f71a-4f1f-b82b-432605e8c4b3 kdu-name: ldap - helm-chart: - kdu-model-locator: - stable/openldap:1.2.1 + helm-chart: stable/openldap:1.2.1 - ip-address: null k8s-cluster: id: e7169dab-f71a-4f1f-b82b-432605e8c4b3 kdu-name: mongo - helm-chart: - kdu-model-locator: - stable/mongodb + helm-chart: stable/mongodb member-vnf-index-ref: multikdu nsr-id-ref: 0bcb701c-ee4d-41ab-8ee6-f4156f7f114d vdur: []