NFVBENCH-153 Add support for python3
[nfvbench.git] / nfvbench / chain_runner.py
index e38cfcd..418d667 100644 (file)
@@ -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):
@@ -74,8 +74,11 @@ class ChainRunner(object):
 
         # 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))
 
@@ -84,12 +87,8 @@ class ChainRunner(object):
             vtep_vlan = gen_config.gen_config.vtep_vlan
             src_vteps = gen_config.gen_config.src_vteps
             dst_vtep = gen_config.gen_config.dst_vtep
-            int_nets = self.config.internal_networks
-            network_type = set(
-                [int_nets[net].get('network_type') for net in int_nets])
-            if 'vxlan' in network_type:
-                gen_config.set_vxlans(0, self.chain_manager.get_chain_vxlans(0))
-                gen_config.set_vxlans(1, self.chain_manager.get_chain_vxlans(1))
+            gen_config.set_vxlans(0, self.chain_manager.get_chain_vxlans(0))
+            gen_config.set_vxlans(1, self.chain_manager.get_chain_vxlans(1))
             gen_config.set_vtep_vlan(0, vtep_vlan)
             gen_config.set_vtep_vlan(1, vtep_vlan)
             # Configuring source an remote VTEPs on TREx interfaces
@@ -105,8 +104,8 @@ class ChainRunner(object):
         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:
+            if (self.config.service_chain == ChainType.EXT or
+                    self.config.vxlan or self.config.l3_router) and not self.config.no_arp:
                 self.traffic_client.ensure_arp_successful()
             self.traffic_client.ensure_end_to_end()