NFVBENCH-123 EXT chain does not work with VXLAN 40/67140/1 3.0.6
authorahothan <ahothan@cisco.com>
Thu, 28 Feb 2019 01:31:31 +0000 (17:31 -0800)
committerahothan <ahothan@cisco.com>
Thu, 28 Feb 2019 01:31:31 +0000 (17:31 -0800)
Pick up the dest mac from config in case of EXT VxLAN

Change-Id: Ib1a625ab62fa9c7675456340d5eb73e4d04ccff0
Signed-off-by: ahothan <ahothan@cisco.com>
README.rst
nfvbench/chain_runner.py
nfvbench/chaining.py

index a3f67cf..9779392 100644 (file)
@@ -22,8 +22,7 @@ Online Documentation
 --------------------
 The latest version of the NFVbench documentation is available online at:
 
-http://docs.opnfv.org/en/latest/submodules/nfvbench/docs/testing/user/userguide/index.html
-
+https://opnfv-nfvbench.readthedocs.io/en/latest/testing/user/userguide/index.html
 
 Contact Information
 -------------------
index a4e461d..627e9ea 100644 (file)
@@ -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))
 
index 22f000b..a02bc1e 100644 (file)
@@ -883,8 +883,8 @@ class ChainManager(object):
                 for chain_id in range(self.chain_count):
                     self.chains.append(Chain(chain_id, self))
                 if config.service_chain == ChainType.EXT:
-                    # if EXT and no ARP we need to read dest MACs from config
-                    if config.no_arp:
+                    # if EXT and no ARP or VxLAN we need to read dest MACs from config
+                    if config.no_arp or config.vxlan:
                         self._get_dest_macs_from_config()
                 else:
                     # Make sure all instances are active before proceeding
@@ -1111,11 +1111,11 @@ class ChainManager(object):
         """
         return self.get_existing_ports().get(chain_network.get_uuid(), None)
 
-    def get_host_ip_from_mac(self, mac):
-        """Get the host IP address matching a MAC.
+    def get_hypervisor_from_mac(self, mac):
+        """Get the hypervisor that hosts a VM MAC.
 
         mac: MAC address to look for
-        return: the IP address of the host where the matching port runs or None if not found
+        return: the hypervisor where the matching port runs or None if not found
         """
         # _existing_ports is a dict of list of ports indexed by network id
         for port_list in self.get_existing_ports().values():
@@ -1123,11 +1123,22 @@ class ChainManager(object):
                 try:
                     if port['mac_address'] == mac:
                         host_id = port['binding:host_id']
-                        return self.comp.get_hypervisor(host_id).host_ip
+                        return self.comp.get_hypervisor(host_id)
                 except KeyError:
                     pass
         return None
 
+    def get_host_ip_from_mac(self, mac):
+        """Get the host IP address matching a MAC.
+
+        mac: MAC address to look for
+        return: the IP address of the host where the matching port runs or None if not found
+        """
+        hypervisor = self.get_hypervisor_from_mac(mac)
+        if hypervisor:
+            return hypervisor.host_ip
+        return None
+
     def get_chain_vlans(self, port_index):
         """Get the list of per chain VLAN id on a given port.
 
@@ -1146,11 +1157,11 @@ class ChainManager(object):
         port_index: left port is 0, right port is 1
         return: a VNIs ID list indexed by the chain index or None if no vlan tagging
         """
-        if self.chains:
+        if self.chains and self.is_admin:
             return [self.chains[chain_index].get_vxlan(port_index)
                     for chain_index in range(self.chain_count)]
         # no openstack
-        raise ChainException('VxLAN is only supported with OpenStack')
+        raise ChainException('VxLAN is only supported with OpenStack and with admin user')
 
     def get_dest_macs(self, port_index):
         """Get the list of per chain dest MACs on a given port.
@@ -1198,7 +1209,18 @@ class ChainManager(object):
         if self.chains:
             # in the case of EXT, the compute node must be retrieved from the port
             # associated to any of the dest MACs
-            return self.chains[0].get_compute_nodes()
+            if self.config.service_chain != ChainType.EXT:
+                return self.chains[0].get_compute_nodes()
+            # in the case of EXT, the compute node must be retrieved from the port
+            # associated to any of the dest MACs
+            dst_macs = self.generator_config.get_dest_macs()
+            # dest MAC on port 0, chain 0
+            dst_mac = dst_macs[0][0]
+            hypervisor = self.get_hypervisor_from_mac(dst_mac)
+            if hypervisor:
+                LOG.info('Found hypervisor for EXT chain: %s', hypervisor.hypervisor_hostname)
+                return[':' + hypervisor.hypervisor_hostname]
+
         # no openstack = no chains
         return []