summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lcm/lcm/nf/biz/instantiate_vnf.py2
-rw-r--r--lcm/lcm/nf/tests/test_instantiate_vnf.py19
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
)