From dd27fd26104887c177f26fecfae595ee1f3db463 Mon Sep 17 00:00:00 2001 From: Dominik Fleischmann Date: Wed, 19 Aug 2020 12:17:51 +0200 Subject: [PATCH] Fix Bug 1193: Day 1 actions for Juju KDUs 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 --- osm_lcm/ns.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/osm_lcm/ns.py b/osm_lcm/ns.py index fbefc4d..ab224cb 100644 --- a/osm_lcm/ns.py +++ b/osm_lcm/ns.py @@ -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: -- 2.25.1