Skip to content

Commit

Permalink
tests: Flunk OVN tests if populating ARP tables failed.
Browse files Browse the repository at this point in the history
If we cannot talk to ovs-vswitchd process for some reason, e.g. it has
terminated prematurely, we want to fail the test as soon as possible.

Otherwise the test will likely fail later on due to ARP tables not being
populated, which will make the troubleshooting the failure harder.

Signed-off-by: Jakub Sitnicki <[email protected]>
Signed-off-by: Ben Pfaff <[email protected]>
  • Loading branch information
Jakub Sitnicki authored and blp committed Jan 11, 2018
1 parent ce10a2d commit 74868f2
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 26 deletions.
7 changes: 4 additions & 3 deletions tests/ofproto-macros.at
Original file line number Diff line number Diff line change
Expand Up @@ -271,23 +271,24 @@ ovn_attach() {
start_daemon ovn-controller || return 1
}

# ovn_populate_arp
# OVN_POPULATE_ARP
#
# This pre-populates the ARP tables of all of the OVN instances that have been
# started with ovn_attach(). That means that packets sent from one hypervisor
# to another never get dropped or delayed by ARP resolution, which makes
# testing easier.
ovn_populate_arp() {
ovn_populate_arp__() {
for e1 in $arp_table; do
set `echo $e1 | sed 's/,/ /g'`; sb1=$1 br1=$2 ip=$3 mac=$4
for e2 in $arp_table; do
set `echo $e2 | sed 's/,/ /g'`; sb2=$1 br2=$2
if test $sb1,$br1 != $sb2,$br2; then
as $sb2 ovs-appctl tnl/neigh/set $br2 $ip $mac
as $sb2 ovs-appctl tnl/neigh/set $br2 $ip $mac || return 1
fi
done
done
}
m4_define([OVN_POPULATE_ARP], [AT_CHECK(ovn_populate_arp__, [0], [ignore])])

# Strips 'xid=0x1234' from ovs-ofctl output.
strip_xids () {
Expand Down
46 changes: 23 additions & 23 deletions tests/ovn.at
Original file line number Diff line number Diff line change
Expand Up @@ -1185,7 +1185,7 @@ ovn-nbctl acl-add lsw0 to-lport 1000 'eth.type == 0x1237 && eth.src == $set1 &&
# Pre-populate the hypervisors' ARP tables so that we don't lose any
# packets for ARP resolution (native tunneling doesn't queue packets
# for ARP resolution).
ovn_populate_arp
OVN_POPULATE_ARP

# Allow some time for ovn-northd and ovn-controller to catch up.
# XXX This should be more systematic.
Expand Down Expand Up @@ -1721,7 +1721,7 @@ done
ovn-nbctl --wait=sb sync
ovn-sbctl dump-flows

ovn_populate_arp
OVN_POPULATE_ARP

# XXX This is now the 3rd copy of these functions in this file ...

Expand Down Expand Up @@ -1924,7 +1924,7 @@ ovs-vsctl add-port br-phys vif3 -- set Interface vif3 options:tx_pcap=hv3/vif3-t
# Pre-populate the hypervisors' ARP tables so that we don't lose any
# packets for ARP resolution (native tunneling doesn't queue packets
# for ARP resolution).
ovn_populate_arp
OVN_POPULATE_ARP

# Allow some time for ovn-northd and ovn-controller to catch up.
# XXX This should be more systematic.
Expand Down Expand Up @@ -2094,7 +2094,7 @@ ovs-vsctl add-port br-phys vif3 -- set Interface vif3 options:tx_pcap=hv3/vif3-t
# Pre-populate the hypervisors' ARP tables so that we don't lose any
# packets for ARP resolution (native tunneling doesn't queue packets
# for ARP resolution).
ovn_populate_arp
OVN_POPULATE_ARP

# Allow some time for ovn-northd and ovn-controller to catch up.
# XXX This should be more systematic.
Expand Down Expand Up @@ -2291,7 +2291,7 @@ done
# Pre-populate the hypervisors' ARP tables so that we don't lose any
# packets for ARP resolution (native tunneling doesn't queue packets
# for ARP resolution).
ovn_populate_arp
OVN_POPULATE_ARP

# Allow some time for ovn-northd and ovn-controller to catch up.
# XXX This should be more systematic.
Expand Down Expand Up @@ -2638,7 +2638,7 @@ done
# Pre-populate the hypervisors' ARP tables so that we don't lose any
# packets for ARP resolution (native tunneling doesn't queue packets
# for ARP resolution).
ovn_populate_arp
OVN_POPULATE_ARP

# Allow some time for ovn-northd and ovn-controller to catch up.
# XXX This should be more systematic.
Expand Down Expand Up @@ -3054,7 +3054,7 @@ ovs-vsctl -- add-port br-int hv2-vif1 -- \
# Pre-populate the hypervisors' ARP tables so that we don't lose any
# packets for ARP resolution (native tunneling doesn't queue packets
# for ARP resolution).
ovn_populate_arp
OVN_POPULATE_ARP

# Allow some time for ovn-northd and ovn-controller to catch up.
# XXX This should be more systematic.
Expand Down Expand Up @@ -3454,7 +3454,7 @@ ovs-vsctl -- add-port br-int hv2-vif1 -- \
# Pre-populate the hypervisors' ARP tables so that we don't lose any
# packets for ARP resolution (native tunneling doesn't queue packets
# for ARP resolution).
ovn_populate_arp
OVN_POPULATE_ARP

# Allow some time for ovn-northd and ovn-controller to catch up.
# XXX This should be more systematic.
Expand Down Expand Up @@ -3666,7 +3666,7 @@ ovs-vsctl -- add-port br-int hv2-vif1 -- \
# Pre-populate the hypervisors' ARP tables so that we don't lose any
# packets for ARP resolution (native tunneling doesn't queue packets
# for ARP resolution).
ovn_populate_arp
OVN_POPULATE_ARP

# Allow some time for ovn-northd and ovn-controller to catch up.
# XXX This should be more systematic.
Expand Down Expand Up @@ -3806,7 +3806,7 @@ ovs-vsctl -- add-port br-int hv1-vif4 -- \
options:rxq_pcap=hv1/vif4-rx.pcap \
ofport-request=4

ovn_populate_arp
OVN_POPULATE_ARP

sleep 2

Expand Down Expand Up @@ -4152,7 +4152,7 @@ ovs-vsctl -- add-port br-int hv1-vif5 -- \
options:rxq_pcap=hv1/vif5-rx.pcap \
ofport-request=5

ovn_populate_arp
OVN_POPULATE_ARP

sleep 2

Expand Down Expand Up @@ -4379,7 +4379,7 @@ ovs-vsctl -- add-port br-int hv2-vif1 -- \
# Pre-populate the hypervisors' ARP tables so that we don't lose any
# packets for ARP resolution (native tunneling doesn't queue packets
# for ARP resolution).
ovn_populate_arp
OVN_POPULATE_ARP

ovn-nbctl create Logical_Router name=R1
ovn-nbctl create Logical_Router name=R2 options:chassis="hv2"
Expand Down Expand Up @@ -5288,7 +5288,7 @@ ovs-vsctl -- add-port br-int hv1-vif1 -- \
options:rxq_pcap=hv1/vif1-rx.pcap \
ofport-request=1

ovn_populate_arp
OVN_POPULATE_ARP
sleep 2

as hv1 ovs-vsctl show
Expand Down Expand Up @@ -6323,7 +6323,7 @@ ovs-vsctl -- add-port br-int vm2 -- \
# Pre-populate the hypervisors' ARP tables so that we don't lose any
# packets for ARP resolution (native tunneling doesn't queue packets
# for ARP resolution).
ovn_populate_arp
OVN_POPULATE_ARP

# Allow some time for ovn-northd and ovn-controller to catch up.
# XXX This should be more systematic.
Expand Down Expand Up @@ -6558,7 +6558,7 @@ ovn-nbctl lsp-add bob bob1 \
# Pre-populate the hypervisors' ARP tables so that we don't lose any
# packets for ARP resolution (native tunneling doesn't queue packets
# for ARP resolution).
ovn_populate_arp
OVN_POPULATE_ARP

# Allow some time for ovn-northd and ovn-controller to catch up.
# XXX This should be more systematic.
Expand Down Expand Up @@ -6690,7 +6690,7 @@ ovs-vsctl -- add-port br-int hv1-vif2 -- \
options:rxq_pcap=hv1/vif2-rx.pcap \
ofport-request=2

ovn_populate_arp
OVN_POPULATE_ARP
sleep 2
as hv1 ovs-vsctl show

Expand Down Expand Up @@ -7063,7 +7063,7 @@ ovs-vsctl -- add-port br-int ext1-vif1 -- \
# Pre-populate the hypervisors' ARP tables so that we don't lose any
# packets for ARP resolution (native tunneling doesn't queue packets
# for ARP resolution).
ovn_populate_arp
OVN_POPULATE_ARP

ovn-nbctl create Logical_Router name=R1

Expand Down Expand Up @@ -7246,7 +7246,7 @@ ovs-vsctl -- add-port br-int ext1-vif1 -- \
# Pre-populate the hypervisors' ARP tables so that we don't lose any
# packets for ARP resolution (native tunneling doesn't queue packets
# for ARP resolution).
ovn_populate_arp
OVN_POPULATE_ARP

ovn-nbctl create Logical_Router name=R0
ovn-nbctl create Logical_Router name=R1
Expand Down Expand Up @@ -7466,7 +7466,7 @@ ovs-vsctl -- add-port br-int hv3-vif1 -- \
# Pre-populate the hypervisors' ARP tables so that we don't lose any
# packets for ARP resolution (native tunneling doesn't queue packets
# for ARP resolution).
ovn_populate_arp
OVN_POPULATE_ARP

ovn-nbctl create Logical_Router name=R1

Expand Down Expand Up @@ -8195,7 +8195,7 @@ ovs-vsctl -- add-port br-int hv2-vif1 -- \
# Pre-populate the hypervisors' ARP tables so that we don't lose any
# packets for ARP resolution (native tunneling doesn't queue packets
# for ARP resolution).
ovn_populate_arp
OVN_POPULATE_ARP

# Allow some time for ovn-northd and ovn-controller to catch up.
# XXX This should be more systematic.
Expand Down Expand Up @@ -8273,7 +8273,7 @@ done
ovn-nbctl --wait=sb sync
ovn-sbctl dump-flows

ovn_populate_arp
OVN_POPULATE_ARP

# Given the name of a logical port, prints the name of the hypervisor
# on which it is located.
Expand Down Expand Up @@ -8392,7 +8392,7 @@ for i in 1 2; do

done

ovn_populate_arp
OVN_POPULATE_ARP

ovn-nbctl create Logical_Router name=R1

Expand Down Expand Up @@ -8811,7 +8811,7 @@ ovn-nbctl lsp-add inside inside1 \
-- lsp-set-addresses inside1 "f0:00:00:01:22:01 192.168.1.101"


ovn_populate_arp
OVN_POPULATE_ARP

ovn-nbctl create Logical_Router name=R1

Expand Down

0 comments on commit 74868f2

Please sign in to comment.