aboutsummaryrefslogtreecommitdiffstats
path: root/nfvbench/chain_runner.py
diff options
context:
space:
mode:
Diffstat (limited to 'nfvbench/chain_runner.py')
-rw-r--r--nfvbench/chain_runner.py60
1 files changed, 44 insertions, 16 deletions
diff --git a/nfvbench/chain_runner.py b/nfvbench/chain_runner.py
index a4e461d..f045528 100644
--- a/nfvbench/chain_runner.py
+++ b/nfvbench/chain_runner.py
@@ -23,11 +23,11 @@ The ChainRunner class is in charge of coordinating:
from collections import OrderedDict
-from chaining import ChainManager
-from log import LOG
-from specs import ChainType
-from stats_manager import StatsManager
-from traffic_client import TrafficClient
+from .chaining import ChainManager
+from .log import LOG
+from .specs import ChainType
+from .stats_manager import StatsManager
+from .traffic_client import TrafficClient
class ChainRunner(object):
@@ -71,11 +71,16 @@ class ChainRunner(object):
# VLAN is discovered from the networks
gen_config.set_vlans(0, self.chain_manager.get_chain_vlans(0))
gen_config.set_vlans(1, self.chain_manager.get_chain_vlans(1))
+ else:
+ LOG.info("Ports: untagged")
# the only case we do not need to set the dest MAC is in the case of
# l2-loopback (because the traffic gen will default to use the peer MAC)
- # or EXT+ARP (because dest MAC will be discovered by TRex ARP)
- if not config.l2_loopback and (config.service_chain != ChainType.EXT or config.no_arp):
+ # or EXT+ARP+VLAN (because dest MAC will be discovered by TRex ARP)
+ # Note that in the case of EXT+ARP+VxLAN, the dest MACs need to be loaded
+ # because ARP only operates on the dest VTEP IP not on the VM dest MAC
+ if not config.l2_loopback and \
+ (config.service_chain != ChainType.EXT or config.no_arp or config.vxlan):
gen_config.set_dest_macs(0, self.chain_manager.get_dest_macs(0))
gen_config.set_dest_macs(1, self.chain_manager.get_dest_macs(1))
@@ -93,16 +98,37 @@ class ChainRunner(object):
gen_config.set_vxlan_endpoints(1, src_vteps[1], dst_vtep)
self.config['vxlan_gen_config'] = gen_config
+ if config.mpls:
+ # MPLS VPN is discovered from the networks
+ src_vteps = gen_config.gen_config.src_vteps
+ vtep_gateway_ips = gen_config.gen_config.vtep_gateway_ips
+ gen_config.set_mpls_inner_labels(0, self.chain_manager.get_chain_mpls_inner_labels(0))
+ gen_config.set_mpls_inner_labels(1, self.chain_manager.get_chain_mpls_inner_labels(1))
+ outer_mpls_labels_left = self.config.internal_networks.left.mpls_transport_labels
+ outer_mpls_labels_right = self.config.internal_networks.right.mpls_transport_labels
+ if outer_mpls_labels_left or outer_mpls_labels_right:
+ gen_config.set_mpls_outer_labels(0, outer_mpls_labels_left)
+ gen_config.set_mpls_outer_labels(1, outer_mpls_labels_right)
+ # Configuring source an remote VTEPs on TREx interfaces
+ gen_config.set_mpls_peers(0, src_vteps[0], vtep_gateway_ips[0])
+ gen_config.set_mpls_peers(1, src_vteps[1], vtep_gateway_ips[1])
+ self.config['mpls_gen_config'] = gen_config
+
# get an instance of the stats manager
self.stats_manager = StatsManager(self)
LOG.info('ChainRunner initialized')
def __setup_traffic(self):
+ # possibly skip connectivity check
+ if self.config.no_e2e_check:
+ LOG.info('Skipping end to end connectivity check')
+ return
self.traffic_client.setup()
if not self.config.no_traffic:
- # ARP is needed for EXT chain or VxLAN overlay unless disabled explicitly
- if (self.config.service_chain == ChainType.EXT or self.config.vxlan) and \
- not self.config.no_arp:
+ # ARP is needed for EXT chain or VxLAN overlay or MPLS unless disabled explicitly
+ if (self.config.service_chain == ChainType.EXT or self.config.mpls or
+ self.config.vxlan or self.config.l3_router or self.config.loop_vm_arp)\
+ and not self.config.no_arp:
self.traffic_client.ensure_arp_successful()
self.traffic_client.ensure_end_to_end()
@@ -129,7 +155,10 @@ class ChainRunner(object):
if self.config.single_run:
result['run_config'] = self.traffic_client.get_run_config(result)
required = result['run_config']['direction-total']['orig']['rate_pps']
- actual = result['stats']['total_tx_rate']
+ if self.config.periodic_gratuitous_arp:
+ actual = result['stats']['total_tx_rate'] + self.config.gratuitous_arp_pps
+ else:
+ actual = result['stats']['total_tx_rate']
warning = self.traffic_client.compare_tx_rates(required, actual)
if warning is not None:
result['run_config']['warning'] = warning
@@ -163,10 +192,9 @@ class ChainRunner(object):
LOG.info('Starting %dx%s benchmark...', self.config.service_chain_count, self.chain_name)
self.stats_manager.create_worker()
- if self.config.vxlan:
- # Configure vxlan tunnels
+ if self.config.vxlan or self.config.mpls:
+ # Configure vxlan or mpls tunnels
self.stats_manager.worker.config_interfaces()
-
self.__setup_traffic()
results[self.chain_name] = {'result': self.__get_chain_result()}
@@ -185,8 +213,8 @@ class ChainRunner(object):
LOG.info('Clean up skipped.')
try:
self.traffic_client.close()
- except Exception:
- LOG.exception()
+ except Exception as exc:
+ LOG.exception(exc)
if self.stats_manager:
self.stats_manager.close()
except Exception: