From 19c8f17c4191e47cf15dce4d5ed48716a1c78c59 Mon Sep 17 00:00:00 2001 From: hongyuzhao Date: Tue, 24 Sep 2019 10:53:56 +0800 Subject: Code optimization Change-Id: I5f620e6b8573d487aa1d17f5e3eb30dc1bb21097 Issue-ID: VFC-1431 Signed-off-by: hongyuzhao --- lcm/lcm/nf/tests/test_create_vnf.py | 6 +++++- lcm/lcm/nf/views/curd_vnf_views.py | 7 ++++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/lcm/lcm/nf/tests/test_create_vnf.py b/lcm/lcm/nf/tests/test_create_vnf.py index 240ed17f..1272d381 100644 --- a/lcm/lcm/nf/tests/test_create_vnf.py +++ b/lcm/lcm/nf/tests/test_create_vnf.py @@ -106,9 +106,13 @@ class TestNFInstantiate(TestCase): expect_data = { "id": "1", "vnfProvider": "huawei", + 'vnfInstanceDescription': 'vFW in Nanjing TIC Edge', + 'vnfInstanceName': 'vFW_01', "vnfdVersion": "1.0", "vnfPkgId": "111", - "instantiationState": "NOT_INSTANTIATED" + "instantiationState": "NOT_INSTANTIATED", + 'vnfSoftwareVersion': '1.0', + 'vnfdId': '111' } self.assertEqual(status.HTTP_201_CREATED, response.status_code) 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 fa57f2ed..37e46ff3 100644 --- a/lcm/lcm/nf/views/curd_vnf_views.py +++ b/lcm/lcm/nf/views/curd_vnf_views.py @@ -74,10 +74,15 @@ class CreateVnfAndQueryVnfs(APIView): nf_inst = CreateVnf(request.data).do_biz() rsp_data = {"id": nf_inst.nfinstid, + "vnfInstanceName": nf_inst.nf_name, + "vnfdId": nf_inst.vnfdid, "vnfProvider": nf_inst.vendor, + "vnfSoftwareVersion": nf_inst.vnfSoftwareVersion, "vnfdVersion": nf_inst.version, "vnfPkgId": nf_inst.package_id, - "instantiationState": nf_inst.status} + "instantiationState": nf_inst.status, + "vnfInstanceDescription": nf_inst.nf_desc + } create_vnf_resp_serializer = VnfInstanceSerializer(data=rsp_data) if not create_vnf_resp_serializer.is_valid(): raise NFLCMException(create_vnf_resp_serializer.errors) -- cgit 1.2.3-korg