X-Git-Url: https://gerrit.onap.org/r/gitweb?a=blobdiff_plain;f=lcm%2Flcm%2Fnf%2Fviews%2Fheal_vnf_view.py;h=24b33e34d3d1501b96de6d81651fd0d2c2f1a8d3;hb=refs%2Fchanges%2F13%2F85013%2F1;hp=4fe3f8477c013387b7614118f63685e3b7bf69a4;hpb=a759abc3e8fe796f2e2137862583fdd6aa0e3e8b;p=vfc%2Fgvnfm%2Fvnflcm.git diff --git a/lcm/lcm/nf/views/heal_vnf_view.py b/lcm/lcm/nf/views/heal_vnf_view.py index 4fe3f847..24b33e34 100644 --- a/lcm/lcm/nf/views/heal_vnf_view.py +++ b/lcm/lcm/nf/views/heal_vnf_view.py @@ -22,7 +22,9 @@ from rest_framework.views import APIView from lcm.nf.biz.heal_vnf import HealVnf from lcm.nf.serializers.heal_vnf_req import HealVnfRequestSerializer from lcm.nf.serializers.response import ProblemDetailsSerializer -from lcm.pub.exceptions import NFLCMException, NFLCMExceptionNotFound +from lcm.pub.exceptions import NFLCMException +from lcm.pub.exceptions import NFLCMExceptionNotFound +from lcm.pub.exceptions import NFLCMExceptionConflict from lcm.pub.utils.jobutil import JobUtil from lcm.pub.database.models import NfInstModel from lcm.nf.const import VNF_STATUS @@ -63,6 +65,9 @@ class HealVnfView(APIView): if not vnf_insts.exists(): raise NFLCMExceptionNotFound("VNF nf_inst_id does not exist.") + if vnf_insts[0].status != 'INSTANTIATED': + raise NFLCMExceptionConflict("VNF instantiationState is not INSTANTIATED.") + NfInstModel.objects.filter(nfinstid=nf_inst_id).update(status=VNF_STATUS.HEALING) JobUtil.add_job_status(job_id, 15, 'Nf healing pre-check finish') logger.info("Nf healing pre-check finish")