summaryrefslogtreecommitdiffstats
path: root/conductor
diff options
context:
space:
mode:
authorShankaranarayanan Puzhavakath Narayanan <snarayanan@research.att.com>2018-03-22 20:27:10 +0000
committerGerrit Code Review <gerrit@onap.org>2018-03-22 20:27:10 +0000
commit5e2f356e8a51c08b442c05a954f1d8ada394932f (patch)
tree0b68c4edd94c92aa9f3b0bb6a6af85f12e3df5ce /conductor
parent9c7878cd58992d239bc1828d192cbaa8519b3452 (diff)
parent4b9fda38ad56178ac1813c57759f6afab8099d46 (diff)
Merge "Added vim-id attribute for Homing Candidates"
Diffstat (limited to 'conductor')
-rw-r--r--conductor/conductor/data/plugins/inventory_provider/aai.py15
-rw-r--r--conductor/conductor/solver/service.py1
-rw-r--r--conductor/conductor/tests/unit/data/plugins/inventory_provider/test_aai.py31
3 files changed, 39 insertions, 8 deletions
diff --git a/conductor/conductor/data/plugins/inventory_provider/aai.py b/conductor/conductor/data/plugins/inventory_provider/aai.py
index f35b495..f25557f 100644
--- a/conductor/conductor/data/plugins/inventory_provider/aai.py
+++ b/conductor/conductor/data/plugins/inventory_provider/aai.py
@@ -21,13 +21,11 @@ import re
import time
import uuid
-
-from oslo_config import cfg
-from oslo_log import log
-
from conductor.common import rest
from conductor.data.plugins.inventory_provider import base
from conductor.i18n import _LE, _LI
+from oslo_config import cfg
+from oslo_log import log
LOG = log.getLogger(__name__)
@@ -821,6 +819,11 @@ class AAI(base.InventoryProviderBase):
region['cloud_region_version'])
candidate['cloud_owner'] = \
region['cloud_owner']
+
+ # Added vim-id for short-term workaround
+ candidate['vim-id'] = \
+ region['cloud_owner'] + '_' + region_id
+
candidate['physical_location_id'] = \
region['complex']['complex_id']
candidate['complex_name'] = \
@@ -992,6 +995,10 @@ class AAI(base.InventoryProviderBase):
cloud_region_id = rl_data.get('d_value')
candidate['location_id'] = cloud_region_id
+ # Added vim-id for short-term workaround
+ candidate['vim-id'] = \
+ candidate['cloud_owner'] + '_' + cloud_region_id
+
# get AIC version for service candidate
if cloud_region_id:
cloud_region_uri = '/cloud-infrastructure/cloud-regions' \
diff --git a/conductor/conductor/solver/service.py b/conductor/conductor/solver/service.py
index c54c180..f0bdb81 100644
--- a/conductor/conductor/solver/service.py
+++ b/conductor/conductor/solver/service.py
@@ -335,6 +335,7 @@ class SolverService(cotyledon.Service):
"location_type": resource.get("location_type"),
"location_id": location_id,
"is_rehome": is_rehome,
+ "vim-id": resource.get("vim-id"),
},
"attributes": {
"physical-location-id":
diff --git a/conductor/conductor/tests/unit/data/plugins/inventory_provider/test_aai.py b/conductor/conductor/tests/unit/data/plugins/inventory_provider/test_aai.py
index 802168f..6b985a5 100644
--- a/conductor/conductor/tests/unit/data/plugins/inventory_provider/test_aai.py
+++ b/conductor/conductor/tests/unit/data/plugins/inventory_provider/test_aai.py
@@ -18,12 +18,13 @@
#
import json
import unittest
-import mock
+
import conductor.data.plugins.inventory_provider.aai as aai
+import mock
from conductor.data.plugins.inventory_provider.aai import AAI
-from conductor.common import rest
from oslo_config import cfg
+
class TestAAI(unittest.TestCase):
def setUp(self):
@@ -138,8 +139,30 @@ class TestAAI(unittest.TestCase):
self.mock_get_complex.start()
self.maxDiff = None
- self.assertEqual({u'demand_name': [{'candidate_id': u'service-instance-id','city': None,'cloud_owner': u'cloud-owner','cloud_region_version': '','complex_name': None,'cost': 1.0,'country': u'USA','existing_placement': 'false','host_id': u'vnf-name','inventory_provider': 'aai','inventory_type': 'service','latitude': u'28.543251','location_id': u'cloud-region-id','location_type': 'att_aic','longitude': u'-81.377112','physical_location_id': 'test-id','region': u'SE','service_resource_id': '','sriov_automation': 'false','state': None},{'candidate_id': u'region-name','city': u'Middletown','cloud_owner': u'cloud-owner','cloud_region_version': u'1.0','complex_name': u'complex-name','cost': 2.0,'country': u'USA','existing_placement': 'false','inventory_provider': 'aai','inventory_type': 'cloud','latitude': u'50.34','location_id': u'region-name','location_type': 'att_aic','longitude': u'30.12','physical_location_id': u'complex-id','region': u'USA','service_resource_id': u'service-resource-id-123','sriov_automation': 'false','state': u'NJ'}]} ,
- self.aai_ep.resolve_demands(demands_list))
+ self.assertEqual({u'demand_name': [
+ {'candidate_id': u'service-instance-id', 'city': None,
+ 'cloud_owner': u'cloud-owner',
+ 'vim-id': 'cloud-owner_cloud-region-id',
+ 'cloud_region_version': '', 'complex_name': None, 'cost': 1.0,
+ 'country': u'USA', 'existing_placement': 'false',
+ 'host_id': u'vnf-name', 'inventory_provider': 'aai',
+ 'inventory_type': 'service', 'latitude': u'28.543251',
+ 'location_id': u'cloud-region-id', 'location_type': 'att_aic',
+ 'longitude': u'-81.377112', 'physical_location_id': 'test-id',
+ 'region': u'SE', 'service_resource_id': '',
+ 'sriov_automation': 'false', 'state': None},
+ {'candidate_id': u'region-name', 'city': u'Middletown',
+ 'cloud_owner': u'cloud-owner',
+ 'vim-id': 'cloud-owner_region-name',
+ 'cloud_region_version': u'1.0', 'complex_name': u'complex-name',
+ 'cost': 2.0, 'country': u'USA', 'existing_placement': 'false',
+ 'inventory_provider': 'aai', 'inventory_type': 'cloud',
+ 'latitude': u'50.34', 'location_id': u'region-name',
+ 'location_type': 'att_aic', 'longitude': u'30.12',
+ 'physical_location_id': u'complex-id', 'region': u'USA',
+ 'service_resource_id': u'service-resource-id-123',
+ 'sriov_automation': 'false', 'state': u'NJ'}]},
+ self.aai_ep.resolve_demands(demands_list))
def test_get_complex(self):