+ # #######################################
+ # # Execute initial config primitive(s) #
+ # #######################################
+ primitives = {}
+
+ # Build a sequential list of the primitives to execute
+ for primitive in params['initial-config-primitive']:
+ try:
+ if primitive['name'] == 'config':
+ # This is applied when the Application is deployed
+ pass
+ else:
+ seq = primitive['seq']
+
+ params = {}
+ if 'parameter' in primitive:
+ params = primitive['parameter']
+
+ primitives[seq] = {
+ 'name': primitive['name'],
+ 'parameters': self._map_primitive_parameters(
+ params,
+ {'<rw_mgmt_ip>': rw_mgmt_ip}
+ ),
+ }
+
+ for primitive in sorted(primitives):
+ await self.ExecutePrimitive(
+ model_name,
+ application_name,
+ primitives[primitive]['name'],
+ callback,
+ callback_args,
+ **primitives[primitive]['parameters'],
+ )
+ except N2VCPrimitiveExecutionFailed as e:
+ self.log.debug(
+ "[N2VC] Exception executing primitive: {}".format(e)
+ )
+ raise
+
+ async def GetPrimitiveStatus(self, model_name, uuid):
+ results = None
+ try:
+ if not self.authenticated:
+ await self.login()
+
+ # FIXME: This is hard-coded until model-per-ns is added
+ model_name = 'default'
+
+ model = await self.controller.get_model(model_name)
+
+ results = await model.get_action_output(uuid)
+
+ await model.disconnect()
+ except Exception as e:
+ self.log.debug(
+ "Caught exception while getting primitive status: {}".format(e)
+ )
+ raise N2VCPrimitiveExecutionFailed(e)
+
+ return results
+
+