--- /dev/null
+# Copyright 2018 ZTE Corporation.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+from rest_framework import serializers
+
+
+class JobIdentifierSerializer(serializers.Serializer):
+ jobId = serializers.CharField(
+ help_text="jobId",
+ required=True,
+ max_length=255,
+ allow_null=True)
from rest_framework.views import APIView\r
\r
from lcm.nf.biz.terminate_vnf import TerminateVnf\r
-from lcm.nf.serializers.serializers import InstOrTeriVnfResponseSerializer, TerminateVnfRequestSerializer\r
+from lcm.nf.serializers.terminate_vnf_req import TerminateVnfRequestSerializer\r
+from lcm.nf.serializers.job_identifier import JobIdentifierSerializer\r
from lcm.pub.exceptions import NFLCMException\r
from lcm.pub.utils.jobutil import JobUtil\r
\r
@swagger_auto_schema(\r
request_body=TerminateVnfRequestSerializer(),\r
responses={\r
- status.HTTP_202_ACCEPTED: InstOrTeriVnfResponseSerializer(),\r
+ status.HTTP_202_ACCEPTED: JobIdentifierSerializer(),\r
status.HTTP_500_INTERNAL_SERVER_ERROR: "Internal error"\r
}\r
)\r
JobUtil.add_job_status(job_id, 0, "TERM_VNF_READY")\r
TerminateVnf(terminate_vnf_request_serializer.data, instanceid, job_id).start()\r
\r
- terminate_vnf_response_serializer = InstOrTeriVnfResponseSerializer(data={"jobId": job_id})\r
+ terminate_vnf_response_serializer = JobIdentifierSerializer(data={"jobId": job_id})\r
if not terminate_vnf_response_serializer.is_valid():\r
raise NFLCMException(terminate_vnf_response_serializer.errors)\r
\r