diff options
author | Ritu Sood <ritu.sood@intel.com> | 2018-05-21 19:44:48 -0700 |
---|---|---|
committer | Ritu Sood <ritu.sood@intel.com> | 2018-05-21 21:14:38 -0700 |
commit | 2302ee99d350173972cfc0249f225a13ed59d3cd (patch) | |
tree | ff81dad07ab68ceedad67683efda8ca7b9d507e1 | |
parent | e287acf0381633e726e850dd5439734760042a69 (diff) |
Using cloud-region in vGMuxInfra flow
If no pserver available for vserver use
cloud-region to get the complex information.
This patch also fixes a version issue.
Change-Id: I981941feef96e531b3ca427ec269cf810f652922
Issue-ID: OPTFRA-241
Signed-off-by: Ritu Sood <ritu.sood@intel.com>
-rw-r--r-- | conductor/conductor/controller/translator.py | 2 | ||||
-rw-r--r-- | conductor/conductor/data/plugins/inventory_provider/aai.py | 52 |
2 files changed, 37 insertions, 17 deletions
diff --git a/conductor/conductor/controller/translator.py b/conductor/conductor/controller/translator.py index 2913c69..7cd90f4 100644 --- a/conductor/conductor/controller/translator.py +++ b/conductor/conductor/controller/translator.py @@ -37,7 +37,7 @@ LOG = log.getLogger(__name__) CONF = cfg.CONF -VERSIONS = ["2016-11-01", "2017-10-10"] +VERSIONS = ["2016-11-01", "2017-10-10", "2018-02-01"] LOCATION_KEYS = ['latitude', 'longitude', 'host_name', 'clli_code'] INVENTORY_PROVIDERS = ['aai'] INVENTORY_TYPES = ['cloud', 'service', 'transport'] diff --git a/conductor/conductor/data/plugins/inventory_provider/aai.py b/conductor/conductor/data/plugins/inventory_provider/aai.py index 2e36bf5..b556ef7 100644 --- a/conductor/conductor/data/plugins/inventory_provider/aai.py +++ b/conductor/conductor/data/plugins/inventory_provider/aai.py @@ -1027,7 +1027,8 @@ class AAI(base.InventoryProviderBase): for i in range(0, len(rl_data_list)): vs_link_list.append(rl_data_list[i].get('link')) - candidate['cloud_owner'] = rl_data.get('d_value') + cloud_owner = rl_data.get('d_value') + candidate['cloud_owner'] = cloud_owner search_key = "cloud-region.cloud-region-id" @@ -1163,22 +1164,38 @@ class AAI(base.InventoryProviderBase): # Third level query to get cloud region from pserver if not ps_link: - LOG.error(_LE("{} pserver related link " - "not found in A&AI: {}"). + LOG.debug(_LE("{} pserver related link " + "not found in A&AI: {} using cloud-region "). format(name, rl_data)) - continue - ps_path = self._get_aai_path_from_link(ps_link) - if not ps_path: - LOG.error(_LE("{} pserver path information " - "not found in A&AI: {}"). - format(name, ps_link)) - continue # move ahead with the next vnf - path = self._aai_versioned_path(ps_path) - response = self._request( - path=path, context="PSERVER", value=ps_path) - if response is None or response.status_code != 200: - continue - body = response.json() + if not (cloud_owner and cloud_region_id): + LOG.error("{} cloud-owner or cloud-region not " + "available from A&AI". + format(name)) + continue # move ahead with the next vnf + cloud_region_uri = \ + '/cloud-infrastructure/cloud-regions/cloud-region' \ + '/?cloud-owner=' + cloud_owner\ + + '&cloud-region-id=' + cloud_region_id + path = self._aai_versioned_path(cloud_region_uri) + response = self._request('get', + path=path, + data=None) + if response is None or response.status_code != 200: + continue + body = response.json() + else: + ps_path = self._get_aai_path_from_link(ps_link) + if not ps_path: + LOG.error(_LE("{} pserver path information " + "not found in A&AI: {}"). + format(name, ps_link)) + continue # move ahead with the next vnf + path = self._aai_versioned_path(ps_path) + response = self._request( + path=path, context="PSERVER", value=ps_path) + if response is None or response.status_code != 200: + continue + body = response.json() related_to = "complex" search_key = "complex.physical-location-id" @@ -1202,6 +1219,9 @@ class AAI(base.InventoryProviderBase): "available from A&AI") continue + # In the scenario where no pserver information is available + # assumption here is that cloud-region does not span across + # multiple complexes if len(complex_list) > 1: if not self.match_vserver_attribute(complex_list): self._log_multiple_item_error( |