Manage OKA profile_type in OKA operations and KSUs based on OKA 19/14819/3
authorgarciadeblas <gerardo.garciadeblas@telefonica.com>
Mon, 9 Dec 2024 12:31:06 +0000 (13:31 +0100)
committergarciadeblas <gerardo.garciadeblas@telefonica.com>
Thu, 12 Dec 2024 09:20:09 +0000 (10:20 +0100)
Change-Id: I9cc7eae62cdd40e1bf9d532b2a2915b98e5ba425
Signed-off-by: garciadeblas <gerardo.garciadeblas@telefonica.com>
osm_lcm/odu_libs/ksu.py
osm_lcm/odu_libs/oka.py

index 7f4d699..767e30b 100644 (file)
@@ -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"
 
index 62207a3..ce07e96 100644 (file)
 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