Fix Bug 1193: Day 1 actions for Juju KDUs 91/9691/1
authorDominik Fleischmann <dominik.fleischmann@canonical.com>
Wed, 19 Aug 2020 10:17:51 +0000 (12:17 +0200)
committergarciadeblas <gerardo.garciadeblas@telefonica.com>
Mon, 7 Sep 2020 07:34:27 +0000 (07:34 +0000)
This commit enables the functionality of
executing initial config primitives with kdus
deployed with juju-bundles.

It fixes the Bug 1193.

Change-Id: Ibbd256022c28522d180e19dba1fdf5ee21fac5f0
Signed-off-by: Dominik Fleischmann <dominik.fleischmann@canonical.com>
osm_lcm/ns.py

index fbefc4d..ab224cb 100644 (file)
@@ -2450,6 +2450,22 @@ class NsLcm(LcmBase):
 
                 self.update_db_2("vnfrs", vnfr_data.get("_id"), vnfr_update_dict)
 
+            kdu_config = kdud.get("kdu-configuration")
+            if kdu_config and kdu_config.get("initial-config-primitive") and kdu_config.get("juju") is None:
+                initial_config_primitive_list = kdu_config.get("initial-config-primitive")
+                initial_config_primitive_list.sort(key=lambda val: int(val["seq"]))
+
+                for initial_config_primitive in initial_config_primitive_list:
+                    primitive_params_ = self._map_primitive_params(initial_config_primitive, {}, {})
+
+                    await asyncio.wait_for(
+                        self.k8scluster_map[k8sclustertype].exec_primitive(
+                            cluster_uuid=k8s_instance_info["k8scluster-uuid"],
+                            kdu_instance=kdu_instance,
+                            primitive_name=initial_config_primitive["name"],
+                            params=primitive_params_, db_dict={}),
+                        timeout=timeout)
+
         except Exception as e:
             # Prepare update db with error and raise exception
             try: