From: garciadeblas Date: Mon, 9 Dec 2024 12:31:06 +0000 (+0100) Subject: Manage OKA profile_type in OKA operations and KSUs based on OKA X-Git-Tag: v17.0.0~18 X-Git-Url: https://osm.etsi.org/gitweb/?a=commitdiff_plain;h=a897d12327dca341e3a3d816b9d3ee98d6e828b8;p=osm%2FLCM.git Manage OKA profile_type in OKA operations and KSUs based on OKA Change-Id: I9cc7eae62cdd40e1bf9d532b2a2915b98e5ba425 Signed-off-by: garciadeblas --- diff --git a/osm_lcm/odu_libs/ksu.py b/osm_lcm/odu_libs/ksu.py index 7f4d6991..767e30b2 100644 --- a/osm_lcm/odu_libs/ksu.py +++ b/osm_lcm/odu_libs/ksu.py @@ -21,7 +21,7 @@ import yaml MAP_PROFILE = { "infra_controller_profiles": "infra-controllers", - "infra_config_profiles": "infra-controllers", + "infra_config_profiles": "infra-configs", "resource_profiles": "managed_resources", "app_profiles": "apps", } @@ -45,7 +45,9 @@ async def create_ksus(self, op_id, op_params_list, content_list): if "sw_catalog_path" in oka_item: oka_path = oka_item["sw_catalog_path"] else: - oka_type = "infra-controllers" + oka_type = MAP_PROFILE[ + oka_item.get("profile_type", "infra_controller_profiles") + ] oka_name = oka_item["git_name"] oka_path = f"{oka_type}/{oka_name}/templates" @@ -184,7 +186,9 @@ async def update_ksus(self, op_id, op_params_list, content_list): if "sw_catalog_path" in oka_item: oka_path = oka_item["sw_catalog_path"] else: - oka_type = "infra-controllers" + oka_type = MAP_PROFILE[ + oka_item.get("profile_type", "infra_controller_profiles") + ] oka_name = oka_item["git_name"] oka_path = f"{oka_type}/{oka_name}/templates" diff --git a/osm_lcm/odu_libs/oka.py b/osm_lcm/odu_libs/oka.py index 62207a30..ce07e963 100644 --- a/osm_lcm/odu_libs/oka.py +++ b/osm_lcm/odu_libs/oka.py @@ -19,6 +19,14 @@ import yaml +MAP_PROFILE = { + "infra_controller_profiles": "infra-controllers", + "infra_config_profiles": "infra-configs", + "resource_profiles": "managed_resources", + "app_profiles": "apps", +} + + async def create_oka(self, op_id, op_params, content): self.logger.info(f"create_oka Enter. Operation {op_id}. Params: {op_params}") # self.logger.debug(f"Content: {content}") @@ -28,7 +36,7 @@ async def create_oka(self, op_id, op_params, content): # Additional params for the workflow oka_name = content["git_name"].lower() - oka_type = "infra-controllers" + oka_type = MAP_PROFILE[content.get("profile_type", "infra_controller_profiles")] osm_project_name = "osm_admin" # TODO: get project name from content # Get the OKA package @@ -87,7 +95,7 @@ async def update_oka(self, op_id, op_params, content): # Additional params for the workflow oka_name = content["git_name"].lower() - oka_type = "infra-controllers" + oka_type = MAP_PROFILE[content.get("profile_type", "infra_controller_profiles")] osm_project_name = "osm_admin" # TODO: get project name from content # Get the OKA package @@ -143,7 +151,8 @@ async def delete_oka(self, op_id, op_params, content): # Additional params for the workflow oka_name = content["git_name"].lower() - oka_type = "infra-controllers" + oka_type = MAP_PROFILE[content.get("profile_type", "infra_controller_profiles")] + osm_project_name = "osm_admin" # TODO: get project name from content # Render workflow