diff options
-rw-r--r-- | sfc/lib/topology_shuffler.py | 24 | ||||
-rw-r--r-- | sfc/lib/utils.py | 34 |
2 files changed, 34 insertions, 24 deletions
diff --git a/sfc/lib/topology_shuffler.py b/sfc/lib/topology_shuffler.py index 4524b879..79825fcf 100644 --- a/sfc/lib/topology_shuffler.py +++ b/sfc/lib/topology_shuffler.py @@ -9,6 +9,13 @@ logger = ft_logger.Logger(__name__).getLogger() # The possible topologies we are testing TOPOLOGIES = [ { + 'id': 'CLIENT_SERVER_VNF_SAME_HOST', + 'description': ''' + All endpoints and VNFs are on a single host. + This is the baseline test. + ''' + }, + { 'id': 'CLIENT_VNF_SAME_HOST', 'description': ''' Client instance and vnfs are are on the same @@ -26,7 +33,7 @@ TOPOLOGIES = [ 'id': 'SERVER_VNF_SAME_HOST', 'description': ''' Server instance and vnfs are are on the same - compute host. Server instance is on a different host + compute host. Client instance is on a different host ''' }, { @@ -110,7 +117,12 @@ def topology(vnf_names, av_zones=None, seed=None): 'id': topo['id'], 'description': topo['description'] } - if topo['id'] == 'CLIENT_VNF_SAME_HOST': + if topo['id'] == 'CLIENT_SERVER_VNF_SAME_HOST': + topology_assigment['client'] = av_zones[0] + topology_assigment['server'] = av_zones[0] + for vnf in vnf_names: + topology_assigment[vnf] = av_zones[0] + elif topo['id'] == 'CLIENT_VNF_SAME_HOST': topology_assigment['client'] = av_zones[0] topology_assigment['server'] = av_zones[1] for vnf in vnf_names: @@ -128,17 +140,13 @@ def topology(vnf_names, av_zones=None, seed=None): elif topo['id'] == 'CLIENT_SERVER_SAME_HOST_SPLIT_VNF': topology_assigment['client'] = av_zones[0] topology_assigment['server'] = av_zones[0] - idx = 0 - for vnf in vnf_names: + for idx, vnf in enumerate(vnf_names): topology_assigment[vnf] = av_zones[idx % 2] - idx += 1 elif topo['id'] == 'CLIENT_SERVER_DIFFERENT_HOST_SPLIT_VNF': topology_assigment['client'] = av_zones[0] topology_assigment['server'] = av_zones[1] - idx = 0 - for vnf in vnf_names: + for idx, vnf in enumerate(vnf_names): topology_assigment[vnf] = av_zones[idx % 2] - idx += 1 logger.info("Creating enpoint and VNF topology on the compute hosts") logger.info(topo['description']) return topology_assigment diff --git a/sfc/lib/utils.py b/sfc/lib/utils.py index d1ae0844..b4807cc2 100644 --- a/sfc/lib/utils.py +++ b/sfc/lib/utils.py @@ -399,22 +399,24 @@ def ofctl_time_counter(ovs_logger, ssh_conn, max_duration=None): @ft_utils.timethis def wait_for_classification_rules(ovs_logger, compute_clients, timeout=200): # 10 sec. is the threshold to consider a flow from an old deployment - max_duration = 10 - rsps = ofctl_time_counter(ovs_logger, compute_clients[0], max_duration) - # first_RSP saves a potential RSP from an old deployment. ODL may take - # quite some time to implement the new flow and an old flow may be there - first_RSP = rsps[0] if len(rsps) > 0 else '' - while not ((len(rsps) > 1) and - (first_RSP != rsps[0]) and - (rsps[0] == rsps[1])): - rsps = ofctl_time_counter(ovs_logger, compute_clients[0]) - timeout -= 1 - if timeout == 0: - logger.error( - "Timeout but classification rules are not updated") - return - time.sleep(1) - logger.info("classification rules updated") + for compute_client in compute_clients: + max_duration = 10 + rsps = ofctl_time_counter(ovs_logger, compute_client, max_duration) + # first_RSP saves a potential RSP from an old deployment. + # ODL may take quite some time to implement the new flow + # and an old flow may be there + first_RSP = rsps[0] if len(rsps) > 0 else '' + while not ((len(rsps) > 1) and + (first_RSP != rsps[0]) and + (rsps[0] == rsps[1])): + rsps = ofctl_time_counter(ovs_logger, compute_client) + timeout -= 1 + if timeout == 0: + logger.error( + "Timeout but classification rules are not updated") + return + time.sleep(1) + logger.info("classification rules updated") def setup_compute_node(cidr, compute_nodes): |