Return the uuid of the executed primitive 70/5970/1
authorAdam Israel <adam.israel@canonical.com>
Fri, 13 Apr 2018 14:41:43 +0000 (08:41 -0600)
committerAdam Israel <adam.israel@canonical.com>
Fri, 13 Apr 2018 14:41:43 +0000 (08:41 -0600)
Return the uuid of the queued primitive from ExecutePrimitive, the first
step in allowing the orchestrator check the status and output of the primitive.

Signed-off-by: Adam Israel <adam.israel@canonical.com>
n2vc/vnf.py

index 7244b22..899e407 100644 (file)
@@ -373,6 +373,12 @@ class N2VC:
                 raise
 
     async def ExecutePrimitive(self, model_name, application_name, primitive, callback, *callback_args, **params):
+        """
+        Queue the execution of a primitive
+
+        returns the UUID of the executed primitive
+        """
+        uuid = None
         try:
             if not self.authenticated:
                 await self.login()
@@ -392,11 +398,12 @@ class N2VC:
                     if unit:
                         self.log.debug("Executing primitive {}".format(primitive))
                         action = await unit.run_action(primitive, **params)
-                        # action = await action.wait()
+                        uuid = action.id
                 await model.disconnect()
         except Exception as e:
             self.log.debug("Caught exception while executing primitive: {}".format(e))
             raise e
+        return uuid
 
     async def RemoveCharms(self, model_name, application_name, callback=None, *callback_args):
         try: