From 148f5bd1f58b2b2f65d4e5783189b965b43925a2 Mon Sep 17 00:00:00 2001 From: biancunkang Date: Fri, 10 Aug 2018 16:46:46 +0800 Subject: Modify serializers and Create Add terms additionalparams in terminate_vnf_req.py and the instantiationState in VnfInstanceSerializer Change-Id: I44888b20698909f47410bb83e6ee24b463d3e136 Issue-ID: VFC-1015 Signed-off-by: biancunkang --- lcm/lcm/nf/serializers/terminate_vnf_req.py | 5 +++++ lcm/lcm/nf/tests/test_create_vnf.py | 3 ++- lcm/lcm/nf/views/curd_vnf_views.py | 3 ++- 3 files changed, 9 insertions(+), 2 deletions(-) (limited to 'lcm') diff --git a/lcm/lcm/nf/serializers/terminate_vnf_req.py b/lcm/lcm/nf/serializers/terminate_vnf_req.py index 805ef6b3..956fb350 100644 --- a/lcm/lcm/nf/serializers/terminate_vnf_req.py +++ b/lcm/lcm/nf/serializers/terminate_vnf_req.py @@ -25,3 +25,8 @@ class TerminateVnfRequestSerializer(serializers.Serializer): help_text="This attribute is only applicable in case of graceful termination", default=120, required=False) + additionalParams = serializers.DictField( + help_text="Additional parameters passed by the NFVO as input to the termination process", + child=serializers.CharField(help_text="KeyValue Pairs", allow_blank=True), + required=False, + allow_null=True) diff --git a/lcm/lcm/nf/tests/test_create_vnf.py b/lcm/lcm/nf/tests/test_create_vnf.py index afeedb31..a672827e 100644 --- a/lcm/lcm/nf/tests/test_create_vnf.py +++ b/lcm/lcm/nf/tests/test_create_vnf.py @@ -76,5 +76,6 @@ class TestNFInstantiate(TestCase): "vnfInstanceDescription": "vFW in Nanjing TIC Edge" } response = self.client.post("/api/vnflcm/v1/vnf_instances", data=data, format='json') - expect_data = {"id": "1", "vnfProvider": "huawei", "vnfdVersion": "1.0", "vnfPkgId": "111"} + expect_data = {"id": "1", "vnfProvider": "huawei", "vnfdVersion": "1.0", "vnfPkgId": "111", + "instantiationState": "NOT_INSTANTIATED"} self.assertEqual(expect_data, response.data) diff --git a/lcm/lcm/nf/views/curd_vnf_views.py b/lcm/lcm/nf/views/curd_vnf_views.py index 078053a8..efd85168 100644 --- a/lcm/lcm/nf/views/curd_vnf_views.py +++ b/lcm/lcm/nf/views/curd_vnf_views.py @@ -74,7 +74,8 @@ class CreateVnfAndQueryVnfs(APIView): create_vnf_resp_serializer = VnfInstanceSerializer(data={"id": nf_inst.nfinstid, "vnfProvider": nf_inst.vendor, "vnfdVersion": nf_inst.version, - "vnfPkgId": nf_inst.package_id}) + "vnfPkgId": nf_inst.package_id, + "instantiationState": nf_inst.status}) if not create_vnf_resp_serializer.is_valid(): raise NFLCMException(create_vnf_resp_serializer.errors) return Response(data=create_vnf_resp_serializer.data, status=status.HTTP_201_CREATED) -- cgit 1.2.3-korg