aboutsummaryrefslogtreecommitdiffstats
path: root/sfc
diff options
context:
space:
mode:
authorGeorge Paraskevopoulos <geopar@intracom-telecom.com>2017-03-30 15:20:33 +0300
committerGeorge Paraskevopoulos <geopar@intracom-telecom.com>2017-03-31 11:24:31 +0300
commit4afb88fb03f4b9280470e53322d5a630d22548f5 (patch)
tree4cc217da615953b2093617590ff5b2e5ed882e85 /sfc
parent89b68dcce2e79251e38e6231a3556b1bdc5fea79 (diff)
Fix hardcoded domain in wait_for_clf_rules
In the CI the availability zones are using a different domain. For example instead of "node-1.domain.tld", we have "node-1.opnfvericsson.com" This patch takes the av zones dynamically from nova hypervisor-list. Change-Id: Ifa26dbbb6b8d415ee30bb1216fc1150f65096a16 Signed-off-by: George Paraskevopoulos <geopar@intracom-telecom.com>
Diffstat (limited to 'sfc')
-rw-r--r--sfc/lib/topology_shuffler.py14
-rw-r--r--sfc/lib/utils.py21
2 files changed, 21 insertions, 14 deletions
diff --git a/sfc/lib/topology_shuffler.py b/sfc/lib/topology_shuffler.py
index 4e027d9e..9104a5f6 100644
--- a/sfc/lib/topology_shuffler.py
+++ b/sfc/lib/topology_shuffler.py
@@ -1,8 +1,7 @@
import datetime
import random
-import functest.utils.openstack_utils as os_utils
import functest.utils.functest_logger as ft_logger
-
+import sfc.lib.utils as sfc_utils
logger = ft_logger.Logger(__name__).getLogger()
@@ -75,15 +74,6 @@ def get_seed():
return seed
-def _get_av_zones():
- '''
- Return the availability zone each host belongs to
- '''
- nova_client = os_utils.get_nova_client()
- hosts = os_utils.get_hypervisors(nova_client)
- return ['nova::{0}'.format(host) for host in hosts]
-
-
def topology(vnf_names, av_zones=None, seed=None):
'''
Get the topology for client, server and vnfs.
@@ -99,7 +89,7 @@ def topology(vnf_names, av_zones=None, seed=None):
'''
if av_zones is None:
- av_zones = _get_av_zones()
+ av_zones = sfc_utils.get_av_zones()
if len(av_zones) < 2 or seed is None:
# fall back to nova availability zone
diff --git a/sfc/lib/utils.py b/sfc/lib/utils.py
index fc5ed025..ba29a8a6 100644
--- a/sfc/lib/utils.py
+++ b/sfc/lib/utils.py
@@ -82,6 +82,15 @@ def download_image(url, image_path):
logger.info("Using old image")
+def get_av_zones():
+ '''
+ Return the availability zone each host belongs to
+ '''
+ nova_client = os_utils.get_nova_client()
+ hosts = os_utils.get_hypervisors(nova_client)
+ return ['nova::{0}'.format(host) for host in hosts]
+
+
def create_vnf_in_av_zone(
tacker_client, vnf_name, vnfd_name, default_param_file, av_zone=None):
param_file = default_param_file
@@ -480,9 +489,17 @@ def promised_rsps_in_computes(
def wait_for_classification_rules(ovs_logger, compute_nodes, odl_ip, odl_port,
topology, timeout=200):
try:
+ hypervisors = get_av_zones()
+ av_zone_regex = re.compile(r'nova::node-([0-9]+)\.(.+)')
+ # Example: String "nova::node-13.domain.tld" is matched
+ # It's deconstructed as:
+ # group(0) -> nova::node-13.domain.tld
+ # group(1) -> 13
+ # group(2) -> domain.tld
+ hypervisor_matches = [av_zone_regex.match(h) for h in hypervisors]
compute_av_zones = {
- node.id: 'nova::node-{0}.domain.tld'.format(node.id)
- for node in compute_nodes
+ hypervisor_match.group(1): hypervisor_match.group(0)
+ for hypervisor_match in hypervisor_matches
}
# keep only vnfs