aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lcm/ns_vnfs/biz/place_vnfs.py17
-rw-r--r--lcm/ns_vnfs/tests/tests.py8
2 files changed, 16 insertions, 9 deletions
diff --git a/lcm/ns_vnfs/biz/place_vnfs.py b/lcm/ns_vnfs/biz/place_vnfs.py
index a63c04e3..e288f9dd 100644
--- a/lcm/ns_vnfs/biz/place_vnfs.py
+++ b/lcm/ns_vnfs/biz/place_vnfs.py
@@ -64,14 +64,14 @@ class PlaceVnfs(object):
if self.placements == [] or self.placements == [[]]:
logger.debug("No solution found for request %s " % self.request_id)
self.update_response_to_db(self.request_id, self.transaction_id,
- self.data.get("requestStatus"), "no-solution", "no-solution",
- "no-solution", "no-solution")
+ self.data.get("requestStatus"), "none", "none",
+ "none", "none")
return
for item in self.placements:
if not isinstance(item, list):
self.update_response_to_db(self.request_id, self.transaction_id,
- self.data.get("requestStatus"), "no-solution", "no-solution",
- "no-solution", "no-solution")
+ self.data.get("requestStatus"), "none", "none",
+ "none", "none")
continue
for placement in item:
assignmentInfo = placement.get("assignmentInfo")
@@ -106,8 +106,15 @@ class PlaceVnfs(object):
cloud_owner = placement.get("solution").get("cloudOwner") \
if placement.get("solution").get("cloudOwner") \
else vim_info.get("cloudOwner")
+ location_id = vim_info.get("locationId")
+ if not cloud_owner or not location_id:
+ self.update_response_to_db(self.request_id,
+ self.transaction_id,
+ self.data.get("requestStatus"), "none", "none",
+ "none", "none")
+ return
vim_id = vim_info['vimId'] if vim_info.get('vimId') \
- else cloud_owner + "_" + vim_info.get("locationId")
+ else cloud_owner + "_" + location_id
self.update_response_to_db(requestId=self.request_id,
transactionId=self.transaction_id,
requestStatus=self.data.get("requestStatus"),
diff --git a/lcm/ns_vnfs/tests/tests.py b/lcm/ns_vnfs/tests/tests.py
index db5931e9..b6c5a1be 100644
--- a/lcm/ns_vnfs/tests/tests.py
+++ b/lcm/ns_vnfs/tests/tests.py
@@ -930,10 +930,10 @@ class TestPlaceVnfViews(TestCase):
PlaceVnfs(resp).extract()
db_info = OOFDataModel.objects.filter(request_id=resp.get("requestId"), transaction_id=resp.get("transactionId"))
self.assertEqual(db_info[0].request_status, "completed")
- self.assertEqual(db_info[0].vim_id, "no-solution")
- self.assertEqual(db_info[0].cloud_owner, "no-solution")
- self.assertEqual(db_info[0].cloud_region_id, "no-solution")
- self.assertEqual(db_info[0].vdu_info, "no-solution")
+ self.assertEqual(db_info[0].vim_id, "none")
+ self.assertEqual(db_info[0].cloud_owner, "none")
+ self.assertEqual(db_info[0].cloud_region_id, "none")
+ self.assertEqual(db_info[0].vdu_info, "none")
vnfd_model_dict = {