From a7945e3d6abceb629814bd6e8fda56bfac9c1893 Mon Sep 17 00:00:00 2001 From: laili Date: Mon, 13 Aug 2018 08:59:05 +0800 Subject: Modify vnf instantiation related stuffs. Add test_instantiate_vnf_when_already_instantiated method. Change-Id: I8c2a33e0a3fab2756174a82df9a6b25eed8325e2 Issue-ID: VFC-1017 Signed-off-by: laili --- lcm/lcm/nf/tests/test_instantiate_vnf.py | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'lcm') diff --git a/lcm/lcm/nf/tests/test_instantiate_vnf.py b/lcm/lcm/nf/tests/test_instantiate_vnf.py index e7604990..7ec2240e 100644 --- a/lcm/lcm/nf/tests/test_instantiate_vnf.py +++ b/lcm/lcm/nf/tests/test_instantiate_vnf.py @@ -67,6 +67,29 @@ class TestNFInstantiate(TestCase): InstantiateVnf(data, nf_inst_id=self.nf_inst_id, job_id=self.job_id).run() self.assert_job_result(self.job_id, 255, "VNF nf_inst_id is not exist.") + def test_instantiate_vnf_when_already_instantiated(self): + NfInstModel.objects.create(nfinstid='1111', + nf_name='vFW_01', + package_id='222', + version='', + vendor='', + netype='', + vnfd_model='', + status='INSTANTIATED', + nf_desc='vFW in Nanjing TIC Edge', + vnfdid='111', + create_time=now_time()) + self.nf_inst_id = '1111' + self.job_id = JobUtil.create_job('NF', 'CREATE', self.nf_inst_id) + JobUtil.add_job_status(self.job_id, 0, "INST_VNF_READY") + jobs = JobStatusModel.objects.filter(jobid=self.job_id, + progress=0, + descp="INST_VNF_READY") + self.assertEqual(1, len(jobs)) + data = inst_req_data + InstantiateVnf(data, nf_inst_id=self.nf_inst_id, job_id=self.job_id).run() + self.assert_job_result(self.job_id, 255, "VNF instantiationState is not NOT_INSTANTIATED.") + @mock.patch.object(restcall, 'call_req') def test_instantiate_vnf_when_get_packageinfo_by_csarid_failed(self, mock_call_req): NfInstModel.objects.create(nfinstid='1111', -- cgit 1.2.3-korg