Fix vnf heal logic
[vfc/gvnfm/vnflcm.git] / lcm / lcm / nf / views / heal_vnf_view.py
index 08daa98..4c2fad0 100644 (file)
@@ -52,8 +52,9 @@ class HealVnfView(APIView):
             JobUtil.add_job_status(job_id, 0, "HEAL_VNF_READY")\r
             self.heal_pre_check(instanceid, job_id)\r
             HealVnf(heal_vnf_request_serializer.data, instanceid, job_id).start()\r
-            response = Response(data=None, status=status.HTTP_202_ACCEPTED)\r
-            response["Location"] = "/vnf_lc_ops/%s" % job_id\r
+            response = Response(data={"jobId": job_id}, status=status.HTTP_202_ACCEPTED)\r
+            # todo, heal_vnf codes uses job as the status storage, not in VNFLcmOpOccModel.\r
+            # response["Location"] = "/api/vnflcm/v1/vnf_lc_ops/%s" % lcmopoccid\r
             return response\r
         except NFLCMExceptionNotFound as e:\r
             probDetail = ProblemDetailsSerializer(data={"status": status.HTTP_404_NOT_FOUND, "detail": "VNF Instance not found"})\r
@@ -80,9 +81,6 @@ class HealVnfView(APIView):
         if not vnf_insts.exists():\r
             raise NFLCMExceptionNotFound("VNF nf_inst_id does not exist.")\r
 \r
-        if vnf_insts[0].status != 'INSTANTIATED':\r
-            raise NFLCMExceptionConflict("VNF instantiationState is not INSTANTIATED.")\r
-\r
         NfInstModel.objects.filter(nfinstid=nf_inst_id).update(status=VNF_STATUS.HEALING)\r
         JobUtil.add_job_status(job_id, 15, 'Nf healing pre-check finish')\r
         logger.info("Nf healing pre-check finish")\r