Changes for IM change 10095: remove kdu-model 12/10112/3 release-v9.0-start v9.0.0 v9.0.0rc1
authorlloretgalleg <illoret@indra.es>
Tue, 15 Dec 2020 10:54:02 +0000 (10:54 +0000)
committerlloretgalleg <illoret@indra.es>
Tue, 15 Dec 2020 13:44:58 +0000 (13:44 +0000)
Change-Id: I14dff0d94e8deb389d915f43e2a8aa41c618ca76
Signed-off-by: lloretgalleg <illoret@indra.es>
osm_lcm/data_utils/vnfd.py
osm_lcm/ns.py
osm_lcm/tests/test_db_descriptors.py

index b12f7d0..f312e57 100644 (file)
@@ -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):
index 29721b3..8e0beb6 100644 (file)
@@ -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 "
index 2a346b0..080d88d 100644 (file)
@@ -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: []