diff options
author | Fu Jinhua <fu.jinhua@zte.com.cn> | 2018-08-10 02:00:16 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2018-08-10 02:00:16 +0000 |
commit | 433be1ff21f0a914cde6a45bb7ae431a1670e85f (patch) | |
tree | d742534e097c0ef231cee52f1be4168029a47fbe | |
parent | a489d17eed5ffb2d8c2f60d959f868934b377977 (diff) | |
parent | 6dba09acb334b868eec0ccf84bd2267bec191532 (diff) |
Merge "Modify job serializer"
-rw-r--r-- | lcm/lcm/nf/serializers/job_identifier.py | 23 | ||||
-rw-r--r-- | lcm/lcm/nf/views/terminate_vnf_view.py | 7 |
2 files changed, 27 insertions, 3 deletions
diff --git a/lcm/lcm/nf/serializers/job_identifier.py b/lcm/lcm/nf/serializers/job_identifier.py new file mode 100644 index 00000000..cfd06a63 --- /dev/null +++ b/lcm/lcm/nf/serializers/job_identifier.py @@ -0,0 +1,23 @@ +# 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) diff --git a/lcm/lcm/nf/views/terminate_vnf_view.py b/lcm/lcm/nf/views/terminate_vnf_view.py index 8cd26467..c1903b76 100644 --- a/lcm/lcm/nf/views/terminate_vnf_view.py +++ b/lcm/lcm/nf/views/terminate_vnf_view.py @@ -21,7 +21,8 @@ from rest_framework.response import Response from rest_framework.views import APIView
from lcm.nf.biz.terminate_vnf import TerminateVnf
-from lcm.nf.serializers.serializers import InstOrTeriVnfResponseSerializer, TerminateVnfRequestSerializer
+from lcm.nf.serializers.terminate_vnf_req import TerminateVnfRequestSerializer
+from lcm.nf.serializers.job_identifier import JobIdentifierSerializer
from lcm.pub.exceptions import NFLCMException
from lcm.pub.utils.jobutil import JobUtil
@@ -33,7 +34,7 @@ class TerminateVnfView(APIView): @swagger_auto_schema(
request_body=TerminateVnfRequestSerializer(),
responses={
- status.HTTP_202_ACCEPTED: InstOrTeriVnfResponseSerializer(),
+ status.HTTP_202_ACCEPTED: JobIdentifierSerializer(),
status.HTTP_500_INTERNAL_SERVER_ERROR: "Internal error"
}
)
@@ -48,7 +49,7 @@ class TerminateVnfView(APIView): JobUtil.add_job_status(job_id, 0, "TERM_VNF_READY")
TerminateVnf(terminate_vnf_request_serializer.data, instanceid, job_id).start()
- terminate_vnf_response_serializer = InstOrTeriVnfResponseSerializer(data={"jobId": job_id})
+ terminate_vnf_response_serializer = JobIdentifierSerializer(data={"jobId": job_id})
if not terminate_vnf_response_serializer.is_valid():
raise NFLCMException(terminate_vnf_response_serializer.errors)
|