Fix ns instant 71/91071/3
authorhewei-cmss <hewei@cmss.chinamobile.com>
Tue, 9 Jul 2019 09:05:03 +0000 (17:05 +0800)
committerhewei-cmss <hewei@cmss.chinamobile.com>
Tue, 9 Jul 2019 09:44:16 +0000 (17:44 +0800)
Issue-ID: VFC-1439

Signed-off-by: hewei-cmss <hewei@cmss.chinamobile.com>
Change-Id: Ieacdc33aaf86812cd1eb72e5eeab2bef20421209

lcm/ns/biz/ns_instant.py
lcm/ns/views/sol/instantiate_ns_views.py

index 39ddecf..ada85e8 100644 (file)
@@ -191,7 +191,7 @@ class InstantNSService(object):
         JobUtil.add_job_status(job_id, 10, 'NS inst(%s) wso2 workflow started: %s' % (
             self.ns_inst_id, ret.get('status')))
         if ret.get('status') == 1:
-            return dict(data={'jobId': job_id}, status=status.HTTP_200_OK)
+            return dict(data={'jobId': job_id}, status=status.HTTP_200_OK, occ_id=occ_id)
         return dict(data={'error': ret['message']}, status=status.HTTP_500_INTERNAL_SERVER_ERROR)
 
     def start_activiti_workflow(self, job_id, plan_input, occ_id):
index 615f43c..ae8c51d 100644 (file)
@@ -57,7 +57,9 @@ class InstantiateNsView(APIView):
                 InstantNsReq['locationConstraints'].append(vnf)
 
         ack = InstantNSService(ns_instance_id, request.data).do_biz()
-        nsLcmOpOccId = ack['occ_id']
+        nsLcmOpOccId = ack.get('occ_id')
+        if not nsLcmOpOccId:
+            return Response(data=ack['data'], status=ack['status'])
         response = Response(data={}, status=status.HTTP_202_ACCEPTED)
         logger.debug("Location: %s" % ack['occ_id'])
         response["Location"] = NS_OCC_BASE_URI % nsLcmOpOccId