Update operationHistory and response for create operation 10/14710/3
authoryshah <shahithya.y@tataelxsi.co.in>
Thu, 7 Nov 2024 09:32:22 +0000 (09:32 +0000)
committergarciadeblas <gerardo.garciadeblas@telefonica.com>
Mon, 11 Nov 2024 09:49:53 +0000 (10:49 +0100)
Change-Id: I89aec4ce42e8f4ccc5471aa63acb202435a2acc8
Signed-off-by: yshah <shahithya.y@tataelxsi.co.in>
osm_nbi/base_topic.py
osm_nbi/k8s_topics.py
osm_nbi/nbi.py

index a327260..dc656d5 100644 (file)
@@ -432,7 +432,8 @@ class BaseTopic:
         if launch_workflow:
             operation["workflowState"] = "PROCESSING"
             operation["resourceState"] = "NOT_READY"
-            operation["git_operation_info"] = None
+            operation["operationState"] = "IN_PROGRESS"
+            operation["gitOperationInfo"] = None
             operation["operationParams"] = operation_params
 
         content["operationHistory"].append(operation)
index 22eceba..f353724 100644 (file)
@@ -527,7 +527,10 @@ class K8sTopic(BaseTopic):
             filter_db = self._get_project_filter(session)
         # To allow project&user addressing by name AS WELL AS _id
         filter_db[BaseTopic.id_field(self.topic, _id)] = _id
+        op_id = str(uuid4())
+        operation_params = {}
         data = self.db.get_one(self.topic, filter_db)
+        data["current_operation"] = op_id
         data["operatingState"] = "PROCESSING"
         data["resourceState"] = "IN_PROGRESS"
         operation_params = indata
@@ -537,7 +540,6 @@ class K8sTopic(BaseTopic):
             operation_params,
         )
         self.db.set_one(self.topic, {"_id": _id}, data)
-        op_id = data["current_operation"]
         data = {"cluster_id": _id, "operation_id": op_id}
         self._send_msg(item, data)
         return op_id
index e11f4ba..368074a 100644 (file)
@@ -1872,7 +1872,7 @@ class Server(object):
                         self._set_location_header(main_topic, version, topic, _id)
                     else:
                         cherrypy.response.headers["Transaction-Id"] = _id
-                    outdata = {"_id": _id}
+                    outdata = {"_id": _id, "id": _id}
                 elif topic == "ns_instances_content":
                     # creates NSR
                     _id, _ = self.engine.new_item(
@@ -1994,7 +1994,7 @@ class Server(object):
                         rollback, engine_session, engine_topic, indata, kwargs
                     )
                     self._set_location_header(main_topic, version, topic, _id)
-                    outdata = {"id": _id}
+                    outdata = {"_id": _id, "id": _id}
                 elif (
                     topic
                     in (
@@ -2011,7 +2011,7 @@ class Server(object):
                         rollback, engine_session, engine_topic, indata, kwargs
                     )
                     self._set_location_header(main_topic, version, topic, _id)
-                    outdata = {"_id": _id}
+                    outdata = {"_id": _id, "id": _id}
                 elif topic == "ksus" and item:
                     if item == "clone":
                         _id = self.engine.clone(
@@ -2024,7 +2024,7 @@ class Server(object):
                             cherrypy.request.headers,
                         )
                         self._set_location_header(main_topic, version, topic, _id)
-                        outdata = {"id": _id}
+                        outdata = {"_id": _id, "id": _id}
                     if item == "move":
                         op_id = self.engine.move_ksu(
                             engine_session, engine_topic, _id, indata, kwargs
@@ -2055,7 +2055,7 @@ class Server(object):
                         cherrypy.request.headers,
                     )
                     self._set_location_header(main_topic, version, topic, _id)
-                    outdata = {"id": _id}
+                    outdata = {"_id": _id, "id": _id}
                     if op_id:
                         outdata["op_id"] = op_id
                         cherrypy.response.status = HTTPStatus.ACCEPTED.value