diff options
author | hongyuzhao <zhao.hongyu@zte.com.cn> | 2019-07-10 17:35:31 +0800 |
---|---|---|
committer | hongyuzhao <zhao.hongyu@zte.com.cn> | 2019-07-10 17:36:53 +0800 |
commit | 0457e5473e7eb27a21e7ec811ea38b23f2fba690 (patch) | |
tree | c5d98f34a7c46cea0585b801da3c3a94a1c62d6e | |
parent | da7fa99b4472a891d9e0ab16e0224acdc4f63e8e (diff) |
rollback code in vnflcm\lcm\lcm\nf\biz\instantiate_vnf.py
Change-Id: Ib6f3ea19914726dd4ecc2d060b11c5dfdd04465a
Issue-ID: VFC-1429
Signed-off-by: hongyuzhao <zhao.hongyu@zte.com.cn>
-rw-r--r-- | lcm/lcm/nf/biz/instantiate_vnf.py | 2 | ||||
-rw-r--r-- | lcm/lcm/nf/tests/test_instantiate_vnf.py | 19 |
2 files changed, 10 insertions, 11 deletions
diff --git a/lcm/lcm/nf/biz/instantiate_vnf.py b/lcm/lcm/nf/biz/instantiate_vnf.py index 58ca591b..13b29ead 100644 --- a/lcm/lcm/nf/biz/instantiate_vnf.py +++ b/lcm/lcm/nf/biz/instantiate_vnf.py @@ -59,10 +59,10 @@ class InstantiateVnf(Thread): operation=OPERATION_TYPE.INSTANTIATE, task=OPERATION_TASK.INSTANTIATE ) + self.pre_deal() def run(self): try: - self.pre_deal() self.inst_pre() self.lcm_op_occ.notify_lcm(OPERATION_STATE_TYPE.STARTING) self.apply_grant() diff --git a/lcm/lcm/nf/tests/test_instantiate_vnf.py b/lcm/lcm/nf/tests/test_instantiate_vnf.py index c243c44b..f8dba91e 100644 --- a/lcm/lcm/nf/tests/test_instantiate_vnf.py +++ b/lcm/lcm/nf/tests/test_instantiate_vnf.py @@ -428,7 +428,7 @@ class TestNFInstantiate(TestCase): self.assertEqual(status.HTTP_400_BAD_REQUEST, response.status_code)
@mock.patch.object(restcall, 'call_req')
- def test_instantiate_operating_fail(self, mock_call_req):
+ def test_instantiate_operating_conflict(self, mock_call_req):
NfInstModel.objects.create(
nfinstid='1111',
nf_name='vFW_01',
@@ -457,13 +457,12 @@ class TestNFInstantiate(TestCase): id=self.job_id,
operation=const.OPERATION_TYPE.INSTANTIATE,
operation_state=const.OPERATION_STATE_TYPE.PROCESSING)
- InstantiateVnf(
- inst_req_data,
- nf_inst_id=self.nf_inst_id,
- job_id=self.job_id
- ).run()
- self.assert_job_result(
- self.job_id,
- 255,
- 'VNF(%s) %s in processing.' % (self.nf_inst_id, const.OPERATION_TYPE.INSTANTIATE)
+ response = self.client.post(
+ '/api/vnflcm/v1/vnf_instances/1111/instantiate',
+ data=inst_req_data,
+ format='json'
+ )
+ self.assertEqual(
+ status.HTTP_409_CONFLICT,
+ response.status_code
)
|