diff options
author | fengyuanxing <feng.yuanxing@zte.com.cn> | 2018-03-13 11:17:43 +0800 |
---|---|---|
committer | fengyuanxing <feng.yuanxing@zte.com.cn> | 2018-03-13 11:17:43 +0800 |
commit | 8cea0c1d22597c85b989fb45dc7396b1ddb8c488 (patch) | |
tree | 037bc07e9982e933dc1e8a693da873a5d63467d7 | |
parent | f71ca1115be830e8ccb2e155942f9b1d37d01e70 (diff) |
Add a new case for scaling vnf
Change-Id: Ib2faf3254056aafc1f474ebe52c191b0827f4735
Issue-ID: VFC-784
Signed-off-by: fengyuanxing <feng.yuanxing@zte.com.cn>
-rw-r--r-- | lcm/ns/tests/vnfs/tests.py | 63 |
1 files changed, 63 insertions, 0 deletions
diff --git a/lcm/ns/tests/vnfs/tests.py b/lcm/ns/tests/vnfs/tests.py index b14dea12..1406fae2 100644 --- a/lcm/ns/tests/vnfs/tests.py +++ b/lcm/ns/tests/vnfs/tests.py @@ -362,6 +362,69 @@ class TestScaleVnfViews(TestCase): nsIns = NfInstModel.objects.filter(nfinstid=self.nf_inst_id) self.assertIsNotNone(nsIns) + @mock.patch.object(NFManualScaleService, "send_nf_scaling_request") + def test_scale_vnf_success(self, mock_send_nf_scaling_request): + vnfd_info = { + "vnf_flavours": [{ + "flavour_id": "flavour1", + "description": "", + "vdu_profiles": [ + { + "vdu_id": "vdu1Id", + "instances_minimum_number": 1, + "instances_maximum_number": 4, + "local_affinity_antiaffinity_rule": [ + { + "affinity_antiaffinity": "affinity", + "scope": "node", + } + ] + } + ], + "scaling_aspects": [ + { + "id": "demo_aspect", + "name": "demo_aspect", + "description": "demo_aspect", + "associated_group": "elementGroup1", + "max_scale_level": 5 + } + ] + }], + "element_groups": [{ + "group_id": "elementGroup1", + "description": "", + "properties": { + "name": "elementGroup1", + }, + "members": ["gsu_vm", "pfu_vm"] + }] + } + + req_data = { + "scaleVnfData": [ + { + "type": "SCALE_OUT", + "aspectId": "demo_aspect1", + "numberOfSteps": 1, + "additionalParam": vnfd_info + }, + { + "type": "SCALE_OUT", + "aspectId": "demo_aspect2", + "numberOfSteps": 1, + "additionalParam": vnfd_info + } + ] + } + scale_service = NFManualScaleService(self.nf_inst_id, req_data) + scale_service.run() + nsIns = NfInstModel.objects.filter(nfinstid=self.nf_inst_id) + self.assertIsNotNone(nsIns) + + jobs = JobModel.objects.filter(jobid=scale_service.job_id) + self.assertIsNotNone(100, jobs[0].progress) + class TestHealVnfViews(TestCase): def setUp(self): |