1 # Copyright (C) 2018 Verizon. All Rights Reserved.
\r
3 # Licensed under the Apache License, Version 2.0 (the "License");
\r
4 # you may not use this file except in compliance with the License.
\r
5 # You may obtain a copy of the License at
\r
7 # http://www.apache.org/licenses/LICENSE-2.0
\r
9 # Unless required by applicable law or agreed to in writing, software
\r
10 # distributed under the License is distributed on an "AS IS" BASIS,
\r
11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
\r
12 # See the License for the specific language governing permissions and
\r
13 # limitations under the License.
\r
17 from drf_yasg.utils import swagger_auto_schema
\r
18 from rest_framework import status
\r
19 from rest_framework.views import APIView
\r
21 from lcm.nf.biz.heal_vnf import HealVnf
\r
22 from lcm.nf.serializers.heal_vnf_req import HealVnfRequestSerializer
\r
23 from lcm.nf.serializers.response import ProblemDetailsSerializer
\r
24 from lcm.nf.const import VNF_STATUS
\r
25 from lcm.nf.const import OPERATION_TYPE
\r
26 from .common import view_safe_call_with_log
\r
27 from .common import deal_vnf_action
\r
29 logger = logging.getLogger(__name__)
\r
32 class HealVnfView(APIView):
\r
33 @swagger_auto_schema(
\r
34 request_body=HealVnfRequestSerializer(),
\r
36 status.HTTP_202_ACCEPTED: "Success",
\r
37 status.HTTP_404_NOT_FOUND: ProblemDetailsSerializer(),
\r
38 status.HTTP_409_CONFLICT: ProblemDetailsSerializer(),
\r
39 status.HTTP_500_INTERNAL_SERVER_ERROR: "Internal error"
\r
42 @view_safe_call_with_log(logger=logger)
\r
43 def post(self, request, instanceid):
\r
44 return deal_vnf_action(
\r
46 opt_type=OPERATION_TYPE.HEAL,
\r
47 opt_status=VNF_STATUS.HEALING,
\r
50 req_serializer=HealVnfRequestSerializer,
\r