Add cluster, KSU, profile and OKA operation initialization logic previously under NBI

Change-Id: I8517463f9776bc483bec400a88408ebf193e935d
Signed-off-by: garciadeblas <gerardo.garciadeblas@telefonica.com>
diff --git a/osm_lcm/k8s.py b/osm_lcm/k8s.py
index 4840329..6c55a52 100644
--- a/osm_lcm/k8s.py
+++ b/osm_lcm/k8s.py
@@ -29,6 +29,8 @@
 
 
 class GitOpsLcm(LcmBase):
+    db_collection = "gitops"
+
     def __init__(self, msg, lcm_tasks, config):
         self.logger = logging.getLogger("lcm.gitops")
         self.lcm_tasks = lcm_tasks
@@ -42,6 +44,19 @@
         self.logger.info(f"Operation {op_id}. Params: {op_params}. Content: {content}")
         return True, "OK"
 
+    def initialize_operation(self, item_id, op_id):
+        db_item = self.db.get_one(self.db_collection, {"_id": item_id})
+        operation = next(
+            (op for op in db_item.get("operationHistory", []) if op["op_id"] == op_id),
+            None,
+        )
+        operation["workflowState"] = "PROCESSING"
+        operation["resourceState"] = "NOT_READY"
+        operation["operationState"] = "IN_PROGRESS"
+        operation["gitOperationInfo"] = None
+        db_item["current_operation"] = operation["op_id"]
+        self.db.set_one(self.db_collection, {"_id": item_id}, db_item)
+
     def update_operation_history(
         self, content, workflow_status=None, resource_status=None
     ):