When ovn-fake-multinode is started with INLINE_BR_EX=yes, then eth1 is an internal interface attached to br-ex instead of being a physical interface. This results in all traffic (dataplane, management and geneve) going through eth2.
This patch ensures that, when a test restarts ovs, it is restarted with the same configuration. Signed-off-by: Xavier Simonart <[email protected]> --- tests/multinode-macros.at | 12 ++++++++++++ tests/multinode.at | 18 ++++++++++++++++-- 2 files changed, 28 insertions(+), 2 deletions(-) diff --git a/tests/multinode-macros.at b/tests/multinode-macros.at index 1c85f79f8..74f2d7894 100644 --- a/tests/multinode-macros.at +++ b/tests/multinode-macros.at @@ -305,6 +305,12 @@ multinode_setup_controller() { remote_ip=$4 encap_type=${5:-"geneve"} + # Get info from eth1 + local eth1_ip="" + if m_as $c ovs-vsctl list-ports br-ex | grep -qx eth1; then + eth1_ip=$(m_as $c ip -4 -o addr show eth1 | awk '{print $4}') + fi + # Cleanup existing one m_as $c /usr/share/openvswitch/scripts/ovs-ctl stop m_as $c /usr/share/ovn/scripts/ovn-ctl stop_controller @@ -324,6 +330,12 @@ multinode_setup_controller() { # Add back br-ex which was removed when removing ovs conf.db m_as $c ovs-vsctl --if-exists del-br br-ex m_as $c ovs-vsctl add-br br-ex + # Add eth1 back + if [[ -n "$eth1_ip" ]]; then + m_as $c ovs-vsctl add-port br-ex eth1 -- set interface eth1 type=internal + m_as $c ip addr add $eth1_ip dev eth1 + m_as $c ip link set eth1 up + fi m_as $c ip link set eth2 down m_as $c ovs-vsctl add-port br-ex eth2 m_as $c ip link set eth2 up diff --git a/tests/multinode.at b/tests/multinode.at index 4948c3c67..bb9e47749 100644 --- a/tests/multinode.at +++ b/tests/multinode.at @@ -2490,7 +2490,7 @@ cleanup_multinode_resources for i in 1 2; do chassis="ovn-chassis-$i" ip=$(m_as $chassis ip -4 addr show eth1 | grep inet | awk '{print $2}' | cut -d'/' -f1) - central_ip=$(m_central_as ip -4 addr show eth1 | grep inet | awk '{print $2}' | cut -d'/' -f1) + central_ip=$( (m_central_as ip -4 addr show eth1 2>/dev/null || m_central_as ip -4 addr show eth2) | grep inet | awk '{print $2}' | cut -d'/' -f1) multinode_setup_northd $chassis multinode_setup_controller $chassis $chassis $ip $ip @@ -3546,6 +3546,9 @@ add_port() { ln -sf /proc/$pid/ns/net /var/run/netns/$pid port=$(host_ovs_vsctl --data=bare --no-heading --columns=name find interface \ external_ids:container_id=ovn-gw-1 external_ids:container_iface="$interface") + if [[ -z "$port" ]]; then + return + fi port="${port:0:13}" ip link del "${port}_l" 2>/dev/null || true ip link del "${port}_c" 2>/dev/null || true @@ -3703,6 +3706,8 @@ check_migration_between_gw1_and_gw2_kill_gw2() { check_packets "true" "false" "false" "true" start_openvswitch ovn-gw-2 + m_as ovn-gw-2 ip addr add $gw2_ip_mask dev eth1 + m_as ovn-gw-2 ip link set eth1 up echo "$(date +%H:%M:%S.%03N) Restarting gw2 ovn-controller" m_as ovn-gw-2 /usr/share/ovn/scripts/ovn-ctl start_controller ${CONTROLLER_SSL_ARGS} @@ -3719,10 +3724,13 @@ check_migration_between_gw1_and_gw2_kill_gw1() { max_expected_loss2=$2 prepare + gw1_ip_mask=$(m_as ovn-gw-1 ip -4 -o addr show eth1 | awk '{print $4}') on_exit 'm_as ovn-gw-1 /usr/share/openvswitch/scripts/ovs-ctl status || m_as ovn-gw-1 /usr/share/openvswitch/scripts/ovs-ctl start --system-id=ovn-gw-1' on_exit 'm_as ovn-gw-1 /usr/share/ovn/scripts/ovn-ctl status_controller || m_as ovn-gw-1 /usr/share/ovn/scripts/ovn-ctl start_controller ${CONTROLLER_SSL_ARGS}' + on_exit 'm_as ovn-gw-1 ip addr add $gw1_ip_mask dev eth1' + on_exit 'm_as ovn-gw-1 ip link set eth1 up' m_as ovn-gw-1 kill -9 $(m_as ovn-gw-1 cat /run/ovn/ovn-controller.pid) m_as ovn-gw-1 kill -9 $(m_as ovn-gw-1 cat /run/openvswitch/ovs-vswitchd.pid) @@ -3736,6 +3744,8 @@ check_migration_between_gw1_and_gw2_kill_gw1() { check_garps "false" "true" "false" check_packets "false" "true" "false" "true" start_openvswitch ovn-gw-1 + m_as ovn-gw-1 ip addr add $gw1_ip_mask dev eth1 + m_as ovn-gw-1 ip link set eth1 up # Wait some long time before restarting ovn-controller sleep 10 @@ -3758,6 +3768,8 @@ check_migration_between_gw1_and_gw2_reboot_gw1() { max_expected_loss2=$2 prepare + gw1_ip_mask=$(m_as ovn-gw-1 ip -4 -o addr show eth1 | awk '{print $4}') + podman stop -t 0 ovn-gw-1 (exec 3>&- 4>&- 5>&- 6>&-; podman start ovn-gw-1) @@ -3773,6 +3785,8 @@ check_migration_between_gw1_and_gw2_reboot_gw1() { check_packets "false" "true" "false" "true" start_openvswitch ovn-gw-1 + m_as ovn-gw-1 ip addr add $gw1_ip_mask dev eth1 + m_as ovn-gw-1 ip link set eth1 up M_START_TCPDUMPS([ovn-gw-1], [-neei eth1], [gw1_eth1]) # Wait some long time before restarting ovn-controller @@ -3882,7 +3896,7 @@ echo "$(date +%H:%M:%S.%03N) Checking it went through gw1 and not gw2" AT_CHECK([cat gw2.tcpdump | grep "ICMP echo"], [1], [dnl ]) -AT_CHECK([cat gw1.tcpdump | grep "ICMP echo" | cut -d ' ' -f2-15], [0], [dnl +AT_CHECK([cat gw1.tcpdump | grep -v genev | grep "ICMP echo" | cut -d ' ' -f2-15], [0], [dnl f0:00:c0:a8:00:fe > 00:00:c0:a8:00:01, ethertype IPv4 (0x0800), length 98: 192.168.1.1 > 192.168.0.1: ICMP echo request, 00:00:c0:a8:00:01 > f0:00:c0:a8:00:fe, ethertype IPv4 (0x0800), length 98: 192.168.0.1 > 192.168.1.1: ICMP echo reply, f0:00:c0:a8:00:fe > 00:00:c0:a8:00:01, ethertype IPv4 (0x0800), length 98: 192.168.1.1 > 192.168.0.1: ICMP echo request, -- 2.47.1 _______________________________________________ dev mailing list [email protected] https://mail.openvswitch.org/mailman/listinfo/ovs-dev
