diff options
author | biancunkang <bian.cunkang@zte.com.cn> | 2018-08-10 16:46:46 +0800 |
---|---|---|
committer | biancunkang <bian.cunkang@zte.com.cn> | 2018-08-10 16:46:46 +0800 |
commit | 148f5bd1f58b2b2f65d4e5783189b965b43925a2 (patch) | |
tree | bf525e20965ee61b0ab3203794523520601cc3f2 /lcm | |
parent | 433be1ff21f0a914cde6a45bb7ae431a1670e85f (diff) |
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 <bian.cunkang@zte.com.cn>
Diffstat (limited to 'lcm')
-rw-r--r-- | lcm/lcm/nf/serializers/terminate_vnf_req.py | 5 | ||||
-rw-r--r-- | lcm/lcm/nf/tests/test_create_vnf.py | 3 | ||||
-rw-r--r-- | lcm/lcm/nf/views/curd_vnf_views.py | 3 |
3 files changed, 9 insertions, 2 deletions
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) |