diff options
author | maopeng zhang <zhang.maopeng1@zte.com.cn> | 2019-07-22 10:42:04 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2019-07-22 10:42:04 +0000 |
commit | b6a08c041bbca7c97fb28fe73389000a28d58c0e (patch) | |
tree | 0ccd2ae05dafef085bed532dbf34ac240a3df7f3 /lcm | |
parent | 2a4aee5b35dfbb67e1144b8a6da459aafb9b44f0 (diff) | |
parent | 81b84ce1988d96da4e46d9d51e94ef936d67f19e (diff) |
Merge "improve code coverage rate (scale vnf to level) after vfclcm upgraded from python2 to python"
Diffstat (limited to 'lcm')
-rw-r--r-- | lcm/lcm/jobs/views.py | 2 | ||||
-rw-r--r-- | lcm/lcm/nf/tests/const.py | 33 | ||||
-rw-r--r-- | lcm/lcm/nf/tests/test_scale_vnf.py | 3 | ||||
-rw-r--r-- | lcm/lcm/nf/tests/test_scale_vnf_to_level.py | 1 | ||||
-rw-r--r-- | lcm/lcm/nf/views/subscriptions_view.py | 2 |
5 files changed, 31 insertions, 10 deletions
diff --git a/lcm/lcm/jobs/views.py b/lcm/lcm/jobs/views.py index 7221bf55..02b7687c 100644 --- a/lcm/lcm/jobs/views.py +++ b/lcm/lcm/jobs/views.py @@ -50,7 +50,7 @@ class JobView(APIView): resp_serializer = JobQueryRespSerializer(data=ret) if not resp_serializer.is_valid(): raise NFLCMException(resp_serializer.errors) - return Response(data=resp_serializer.data, status=status.HTTP_200_OK) + return Response(data=ret, status=status.HTTP_200_OK) except Exception as e: logger.error(traceback.format_exc()) return Response(data={'error': e.args[0]}, status=status.HTTP_500_INTERNAL_SERVER_ERROR) diff --git a/lcm/lcm/nf/tests/const.py b/lcm/lcm/nf/tests/const.py index c9509513..8a50fa1a 100644 --- a/lcm/lcm/nf/tests/const.py +++ b/lcm/lcm/nf/tests/const.py @@ -1166,7 +1166,22 @@ multiple_vnf_lcm_op = [{ # } # } vnfd_for_scale = { - "volume_storages": [], + "volume_storages": [ + { + "volume_storage_id": "test", + "properties": { + "location_info": { + "vimid": "vim_1", + "tenant": "chinamobile", + "availability_zone": "test", + }, + "volume_name": "test", + "custom_volume_type": "test", + "size_of_storage": "\"10 GB\"", + }, + "image_file": "test", + }, + ], "vnf": { "type": "tosca.nodes.nfv.VNF", "requirements": { @@ -1202,7 +1217,16 @@ vnfd_for_scale = { { "description": "", "virtual_storages": [ - + { + "virtual_storage_id": "test", + "type_of_storage": "ephemeral", + "size_of_storage": "10 GB", + } + ], + "volume_storages": [ + { + "volume_storage_id": "test", + } ], "vdu_id": "sunshine", "artifacts": [ @@ -1222,11 +1246,6 @@ vnfd_for_scale = { "virtual_memory": { "virtual_mem_size": "4096 MB" }, - "virtual_local_storage": [ - { - "size_of_storage": "40 GB" - } - ] }, "vls": [ diff --git a/lcm/lcm/nf/tests/test_scale_vnf.py b/lcm/lcm/nf/tests/test_scale_vnf.py index 43614034..c415bf0b 100644 --- a/lcm/lcm/nf/tests/test_scale_vnf.py +++ b/lcm/lcm/nf/tests/test_scale_vnf.py @@ -91,7 +91,7 @@ class TestNfScale(TestCase): def test_scale_out_vnf_success(self, mock_call, mock_call_req): self.nf_inst_id = '6789' res_cache = {"volume": {}, "flavor": {}, "port": {}} - # res_cache["volume"]["volume_storage1"] = "vol1" + res_cache["volume"]["test"] = "test" # res_cache["flavor"]["vdu1Id"] = "flavor1" res_cache["port"]["ext_cp"] = "port1" NfInstModel(nfinstid=self.nf_inst_id, @@ -193,6 +193,7 @@ class TestNfScale(TestCase): ).run() NfInstModel.objects.filter(nfinstid=self.nf_inst_id).delete() + # print([{job.progress: job.descp} for job in JobStatusModel.objects.filter( jobid=self.job_id)]) self.assert_job_result( self.job_id, 100, diff --git a/lcm/lcm/nf/tests/test_scale_vnf_to_level.py b/lcm/lcm/nf/tests/test_scale_vnf_to_level.py index 173f539d..23d812c6 100644 --- a/lcm/lcm/nf/tests/test_scale_vnf_to_level.py +++ b/lcm/lcm/nf/tests/test_scale_vnf_to_level.py @@ -91,6 +91,7 @@ class TestNfScaleToLevel(TestCase): def test_scale_out_vnf_success(self, mock_call, mock_call_req): self.nf_inst_id = '6789' res_cache = {"volume": {}, "flavor": {}, "port": {}} + res_cache["volume"]["test"] = "test" res_cache["port"]["ext_cp"] = "port1" NfInstModel(nfinstid=self.nf_inst_id, nf_name='VNF1', diff --git a/lcm/lcm/nf/views/subscriptions_view.py b/lcm/lcm/nf/views/subscriptions_view.py index 547e0124..4f6566bd 100644 --- a/lcm/lcm/nf/views/subscriptions_view.py +++ b/lcm/lcm/nf/views/subscriptions_view.py @@ -106,7 +106,7 @@ class SubscriptionsView(APIView): raise NFLCMException(subscriptions_serializer.errors)
logger.debug("SubscribeNotification--get::> Remove default fields")
- return Response(data=subscriptions_serializer.data, status=status.HTTP_200_OK)
+ return Response(data=resp_data, status=status.HTTP_200_OK)
class SubscriptionDetailView(APIView):
|