FIX: Use vhost macs when testpmd_mac forwarding used in VM 95/21795/1
authorJan Gelety <jgelety@cisco.com>
Mon, 2 Sep 2019 21:28:30 +0000 (23:28 +0200)
committerJan Gelety <jgelety@cisco.com>
Thu, 5 Sep 2019 06:15:47 +0000 (06:15 +0000)
Change-Id: I291c3dc852e7c1bde6fb6102a9168cfec9992682
Signed-off-by: Jan Gelety <jgelety@cisco.com>
(cherry picked from commit 474034ac24ce89cdaa94a09ae4d9ebbd3fb0f219)

resources/libraries/python/QemuManager.py
resources/libraries/robot/ip/ip4.robot
resources/libraries/robot/shared/interfaces.robot
tests/vpp/perf/vm_vhost/10ge2p1x710-ethip4-ip4base-eth-2vhostvr1024-1vm-ndrpdr.robot
tests/vpp/perf/vm_vhost/2n1l-10ge2p1x710-ethip4-ip4base-eth-2vhostvr1024-1vm-ndrpdr.robot

index c9b89f0..ad205c8 100644 (file)
@@ -18,7 +18,7 @@ from collections import OrderedDict
 from resources.libraries.python.Constants import Constants
 from resources.libraries.python.CpuUtils import CpuUtils
 from resources.libraries.python.QemuUtils import QemuUtils
-from resources.libraries.python.topology import NodeType
+from resources.libraries.python.topology import NodeType, Topology
 
 __all__ = ["QemuManager"]
 
@@ -62,10 +62,18 @@ class QemuManager(object):
                 name = '{node}_{qemu_id}'.format(node=node, qemu_id=qemu_id)
                 sock1 = '/var/run/vpp/sock-{qemu_id}-1'.format(qemu_id=qemu_id)
                 sock2 = '/var/run/vpp/sock-{qemu_id}-2'.format(qemu_id=qemu_id)
-                vif1_mac = kwargs['tg_if1_mac'] if nf_node == 1 \
-                        else '52:54:00:00:{id:02x}:02'.format(id=qemu_id - 1)
-                vif2_mac = kwargs['tg_if2_mac'] if nf_node == nf_nodes \
-                        else '52:54:00:00:{id:02x}:01'.format(id=qemu_id + 1)
+                vif1_mac = Topology.get_interface_mac(
+                    self.nodes[node], 'vhost{idx}'.format(
+                        idx=(nf_chain - 1) * nf_nodes * 2 + nf_node * 2 - 1)) \
+                    if kwargs['vnf'] == 'testpmd_mac' \
+                    else kwargs['tg_if1_mac'] if nf_node == 1 \
+                    else '52:54:00:00:{id:02x}:02'.format(id=qemu_id - 1)
+                vif2_mac = Topology.get_interface_mac(
+                    self.nodes[node], 'vhost{idx}'.format(
+                        idx=(nf_chain - 1) * nf_nodes * 2 + nf_node * 2)) \
+                    if kwargs['vnf'] == 'testpmd_mac' \
+                    else kwargs['tg_if2_mac'] if nf_node == nf_nodes \
+                    else '52:54:00:00:{id:02x}:01'.format(id=qemu_id + 1)
 
                 self.machines_affinity[name] = CpuUtils.get_affinity_nf(
                     nodes=self.nodes, node=node, nf_chains=nf_chains,
index 7209c6c..84f422e 100644 (file)
 | | ...
 | | ... | *Arguments:*
 | | ... | - nf_nodes - Number of guest VMs. Type: integer
+| | ... | - testpmd_mac - Switch for testpmd_mac test configuration.
+| | ... | Type: boolean
 | | ...
 | | ... | *Note:*
 | | ... | Socket paths for VM are defined in following format:
 | | ... | \| IPv4 forwarding with Vhost-User initialized in a 2-node circular\
 | | ... | topology \| 1 \|
 | | ...
-| | [Arguments] | ${nf_nodes}=${1}
+| | [Arguments] | ${nf_nodes}=${1} | ${testpmd_mac}=${FALSE}
 | | ...
 | | Set interfaces in path up
 | | ${fib_table_1}= | Set Variable | ${101}
 | | | ... | ${dut1} | ${dut1-vhost-${number}-if1} | 1.1.1.2 | 30
 | | | VPP Interface Set IP Address
 | | | ... | ${dut1} | ${dut1-vhost-${number}-if2} | 1.1.2.2 | 30
-| | | Vpp Route Add | ${dut1} | 20.0.0.0 | 8 | gateway=1.1.1.1
+| | | Run Keyword Unless | ${testpmd_mac}
+| | | ... | Vpp Route Add | ${dut1} | 20.0.0.0 | 8 | gateway=1.1.1.1
 | | | ... | interface=${dut1-vhost-${number}-if1} | vrf=${fib_table_1}
-| | | Vpp Route Add | ${dut1} | 10.0.0.0 | 8 | gateway=1.1.2.1
+| | | Run Keyword Unless | ${testpmd_mac}
+| | | ... | Vpp Route Add | ${dut1} | 10.0.0.0 | 8 | gateway=1.1.2.1
+| | | ... | interface=${dut1-vhost-${number}-if2} | vrf=${fib_table_2}
+| | | Run Keyword If | ${testpmd_mac}
+| | | ... | VPP Add IP Neighbor | ${dut1} | ${dut1-vhost-${number}-if1}
+| | | ... | 1.1.2.2 | ${dut1-vhost-${number}-if2_mac}
+| | | Run Keyword If | ${testpmd_mac}
+| | | ... | VPP Add IP Neighbor | ${dut1} | ${dut1-vhost-${number}-if2}
+| | | ... | 1.1.1.2 | ${dut1-vhost-${number}-if1_mac}
+| | | Run Keyword If | ${testpmd_mac}
+| | | ... | Vpp Route Add | ${dut1} | 20.0.0.0 | 8 | gateway=1.1.2.2
+| | | ... | interface=${dut1-vhost-${number}-if1} | vrf=${fib_table_1}
+| | | Run Keyword If | ${testpmd_mac}
+| | | ... | Vpp Route Add | ${dut1} | 10.0.0.0 | 8 | gateway=1.1.1.2
 | | | ... | interface=${dut1-vhost-${number}-if2} | vrf=${fib_table_2}
 
 | Initialize IPv4 forwarding with vhost in 3-node circular topology
 | | ... | \| IPv4 forwarding with Vhost-User initialized in a 3-node circular\
 | | ... | topology \| 1 \|
 | | ...
-| | [Arguments] | ${nf_nodes}=${1}
+| | [Arguments] | ${nf_nodes}=${1} | ${testpmd_mac}=${FALSE}
 | | ...
 | | Set interfaces in path up
 | | ${fib_table_1}= | Set Variable | ${101}
 | | | ... | ${dut2} | ${dut2-vhost-${number}-if1} | 1.1.1.2 | 30
 | | | VPP Interface Set IP Address
 | | | ... | ${dut2} | ${dut2-vhost-${number}-if2} | 1.1.2.2 | 30
-| | | Vpp Route Add | ${dut1} | 20.0.0.0 | 8 | gateway=1.1.1.1
+| | | Run Keyword Unless | ${testpmd_mac}
+| | | ... | Vpp Route Add | ${dut1} | 20.0.0.0 | 8 | gateway=1.1.1.1
+| | | ... | interface=${dut1-vhost-${number}-if1} | vrf=${fib_table_1}
+| | | Run Keyword Unless | ${testpmd_mac}
+| | | ... | Vpp Route Add | ${dut1} | 10.0.0.0 | 8 | gateway=1.1.2.1
+| | | ... | interface=${dut1-vhost-${number}-if2} | vrf=${fib_table_2}
+| | | Run Keyword Unless | ${testpmd_mac}
+| | | ... | Vpp Route Add | ${dut2} | 20.0.0.0 | 8 | gateway=1.1.1.1
+| | | ... | interface=${dut2-vhost-${number}-if1} | vrf=${fib_table_1}
+| | | Run Keyword Unless | ${testpmd_mac}
+| | | ... | Vpp Route Add | ${dut2} | 10.0.0.0 | 8 | gateway=1.1.2.1
+| | | ... | interface=${dut2-vhost-${number}-if2} | vrf=${fib_table_2}
+| | | Run Keyword If | ${testpmd_mac}
+| | | ... | VPP Add IP Neighbor | ${dut1} | ${dut1-vhost-${number}-if1}
+| | | ... | 1.1.2.2 | ${dut1-vhost-${number}-if2_mac}
+| | | Run Keyword If | ${testpmd_mac}
+| | | ... | VPP Add IP Neighbor | ${dut1} | ${dut1-vhost-${number}-if2}
+| | | ... | 1.1.1.2 | ${dut1-vhost-${number}-if1_mac}
+| | | Run Keyword If | ${testpmd_mac}
+| | | ... | VPP Add IP Neighbor | ${dut2} | ${dut2-vhost-${number}-if1}
+| | | ... | 1.1.2.2 | ${dut2-vhost-${number}-if2_mac}
+| | | Run Keyword If | ${testpmd_mac}
+| | | ... | VPP Add IP Neighbor | ${dut2} | ${dut2-vhost-${number}-if2}
+| | | ... | 1.1.1.2 | ${dut2-vhost-${number}-if1_mac}
+| | | Run Keyword If | ${testpmd_mac}
+| | | ... | Vpp Route Add | ${dut1} | 20.0.0.0 | 8 | gateway=1.1.2.2
 | | | ... | interface=${dut1-vhost-${number}-if1} | vrf=${fib_table_1}
-| | | Vpp Route Add | ${dut1} | 10.0.0.0 | 8 | gateway=1.1.2.1
+| | | Run Keyword If | ${testpmd_mac}
+| | | ... | Vpp Route Add | ${dut1} | 10.0.0.0 | 8 | gateway=1.1.1.2
 | | | ... | interface=${dut1-vhost-${number}-if2} | vrf=${fib_table_2}
-| | | Vpp Route Add | ${dut2} | 20.0.0.0 | 8 | gateway=1.1.1.1
+| | | Run Keyword If | ${testpmd_mac}
+| | | ... | Vpp Route Add | ${dut2} | 20.0.0.0 | 8 | gateway=1.1.2.2
 | | | ... | interface=${dut2-vhost-${number}-if1} | vrf=${fib_table_1}
-| | | Vpp Route Add | ${dut2} | 10.0.0.0 | 8 | gateway=1.1.2.1
+| | | Run Keyword If | ${testpmd_mac}
+| | | ... | Vpp Route Add | ${dut2} | 10.0.0.0 | 8 | gateway=1.1.1.2
 | | | ... | interface=${dut2-vhost-${number}-if2} | vrf=${fib_table_2}
 
 | Initialize IPv4 forwarding with VLAN dot1q sub-interfaces in circular topology
index f3fb3de..514ed91 100644 (file)
 | | ...
 | | ${vhost_1}= | Vpp Create Vhost User Interface | ${dut_node} | ${sock1}
 | | ${vhost_2}= | Vpp Create Vhost User Interface | ${dut_node} | ${sock2}
+| | ${vhost_1_key}= | Get Interface By SW Index | ${dut_node} | ${vhost_1}
+| | ${vhost_2_key}= | Get Interface By SW Index | ${dut_node} | ${vhost_2}
+| | ${vhost_1_mac}= | Get Interface MAC | ${dut_node} | ${vhost_1_key}
+| | ${vhost_2_mac}= | Get Interface MAC | ${dut_node} | ${vhost_2_key}
 | | Set Interface State | ${dut_node} | ${vhost_1} | up
 | | Set Interface State | ${dut_node} | ${vhost_2} | up
 | | Set Test Variable | ${${vhost_if1}} | ${vhost_1}
 | | Set Test Variable | ${${vhost_if2}} | ${vhost_2}
+| | Set Test Variable | ${${vhost_if1}_mac} | ${vhost_1_mac}
+| | Set Test Variable | ${${vhost_if2}_mac} | ${vhost_2_mac}
index 659e933..63ed079 100644 (file)
@@ -81,7 +81,7 @@
 | | And Set Max Rate And Jumbo And Handle Multi Seg
 | | And Apply startup configuration on all VPP DUTs
 | | When Initialize IPv4 forwarding with vhost in 3-node circular topology
-| | ... | nf_nodes=${nf_nodes}
+| | ... | nf_nodes=${nf_nodes} | testpmd_mac=${TRUE}
 | | And Configure chains of NFs connected via vhost-user
 | | ... | nf_chains=${nf_chains} | nf_nodes=${nf_nodes} | jumbo=${jumbo}
 | | ... | use_tuned_cfs=${False} | auto_scale=${True} | vnf=testpmd_mac
index 2f4782d..6f668e8 100644 (file)
@@ -81,7 +81,7 @@
 | | And Set Max Rate And Jumbo And Handle Multi Seg
 | | And Apply startup configuration on all VPP DUTs
 | | When Initialize IPv4 forwarding with vhost in 2-node circular topology
-| | ... | nf_nodes=${nf_nodes}
+| | ... | nf_nodes=${nf_nodes} | testpmd_mac=${TRUE}
 | | And Configure chains of NFs connected via vhost-user
 | | ... | nf_chains=${nf_chains} | nf_nodes=${nf_nodes} | jumbo=${jumbo}
 | | ... | use_tuned_cfs=${False} | auto_scale=${True} | vnf=testpmd_mac

©2016 FD.io a Linux Foundation Collaborative Project. All Rights Reserved.
Linux Foundation is a registered trademark of The Linux Foundation. Linux is a registered trademark of Linus Torvalds.
Please see our privacy policy and terms of use.