diff mbox

[ovs-dev,v1,1/1] ovn: l3ha fix unexpected ARP requests on pcap during tests

Message ID 1500458848-22634-1-git-send-email-majopela@redhat.com
State Rejected
Headers show

Commit Message

Miguel Angel Ajo July 19, 2017, 10:07 a.m. UTC
For testing l3ha datapath we have an external port on a separate sim
instance (ext1), and we send an UDP packet that we expect to see
going through the specific MASTER gateway (gw1 or gw2) and reaching
the final ext1-vif port on ext1.

ovn_arp_populate macro din't know about the BRIDGE/IP/MAC of ext1-vif
port, and didn't populate the tables, so in some cases an ARP
request was sent from alice external distributed port to the external
network, which wasn't expected on the OVN_CHECK_PACKETS macro.

This patch adds a macro to let us register extra arp entries before
running the tests, also makes sure that ovn-controller has synchronized
and waits one more second to make sure that BFD sessions are fully
established between gateways.

Signed-off-by: Miguel Angel Ajo <majopela@redhat.com>
---
 tests/ofproto-macros.at | 11 ++++++++++-
 tests/ovn.at            | 17 ++++++++++++-----
 2 files changed, 22 insertions(+), 6 deletions(-)

Comments

Miguel Angel Ajo July 20, 2017, 6:02 a.m. UTC | #1
Please, ignore this patch, it doesn't help.

On Wed, Jul 19, 2017 at 12:07 PM, Miguel Angel Ajo <majopela@redhat.com>
wrote:

> For testing l3ha datapath we have an external port on a separate sim
> instance (ext1), and we send an UDP packet that we expect to see
> going through the specific MASTER gateway (gw1 or gw2) and reaching
> the final ext1-vif port on ext1.
>
> ovn_arp_populate macro din't know about the BRIDGE/IP/MAC of ext1-vif
> port, and didn't populate the tables, so in some cases an ARP
> request was sent from alice external distributed port to the external
> network, which wasn't expected on the OVN_CHECK_PACKETS macro.
>
> This patch adds a macro to let us register extra arp entries before
> running the tests, also makes sure that ovn-controller has synchronized
> and waits one more second to make sure that BFD sessions are fully
> established between gateways.
>
> Signed-off-by: Miguel Angel Ajo <majopela@redhat.com>
> ---
>  tests/ofproto-macros.at | 11 ++++++++++-
>  tests/ovn.at            | 17 ++++++++++++-----
>  2 files changed, 22 insertions(+), 6 deletions(-)
>
> diff --git a/tests/ofproto-macros.at b/tests/ofproto-macros.at
> index 23b0321..afba585 100644
> --- a/tests/ofproto-macros.at
> +++ b/tests/ofproto-macros.at
> @@ -235,6 +235,15 @@ net_attach () {
>          || return 1
>  }
>
> +# ovn_register_arp BRIDGE IP MAC
> +#
> +# Registers bridge/ip/mac triplet to the arp_table list which can be
> +# populated via the ovn_populate_arp function.
> +ovn_register_arp() {
> +    local sandbox=$1 bridge=$2 ip=$3 mac=$4
> +    arp_table="$arp_table $sandbox,$bridge,$ip,$mac"
> +}
> +
>  # ovn_attach NETWORK BRIDGE IP [MASKLEN]
>  #
>  # First, this command attaches BRIDGE to interconnection network NETWORK,
> just
> @@ -247,7 +256,7 @@ ovn_attach() {
>      net_attach $net $bridge || return 1
>
>      mac=`ovs-vsctl get Interface $bridge mac_in_use | sed s/\"//g`
> -    arp_table="$arp_table $sandbox,$bridge,$ip,$mac"
> +    ovn_register_arp $sandbox $bridge $ip $mac
>      ovs-appctl netdev-dummy/ip4addr $bridge $ip/$masklen >/dev/null ||
> return 1
>      ovs-appctl ovs/route/add $ip/$masklen $bridge >/dev/null || return 1
>      ovs-vsctl \
> diff --git a/tests/ovn.at b/tests/ovn.at
> index 248aea4..22d3ab1 100644
> --- a/tests/ovn.at
> +++ b/tests/ovn.at
> @@ -6851,7 +6851,6 @@ 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-nbctl create Logical_Router name=R1
>
> @@ -6907,11 +6906,19 @@ as gw1 ovs-vsctl set open .
> external-ids:ovn-bridge-mappings=phys:br-phys
>  as gw2 ovs-vsctl set open . external-ids:ovn-bridge-mappings=phys:br-phys
>  as ext1 ovs-vsctl set open . external-ids:ovn-bridge-
> mappings=phys:br-phys
>
> -AT_CHECK([ovn-nbctl --timeout=3 --wait=sb sync], [0], [ignore])
> +AT_CHECK([ovn-nbctl --timeout=3 --wait=hv sync], [0], [ignore])
>
> -# Allow some time for ovn-northd and ovn-controller to catch up.
> -# XXX This should be more systematic.
> -sleep 2
> +ovn_register_arp ext1 br-phys 172.16.1.3 f0:00:00:01:02:04
> +
> +ovn_populate_arp
> +
> +for x in hv1 gw1 gw2 ext1; do
> +   echo tnl/arp/show at ${x}:
> +   as $x ovs-appctl tnl/arp/show
> +done
> +
> +# allow BFD sessions to be established and up/steady
> +sleep 3
>
>  ip_to_hex() {
>      printf "%02x%02x%02x%02x" "$@"
> --
> 1.8.3.1
>
>
diff mbox

Patch

diff --git a/tests/ofproto-macros.at b/tests/ofproto-macros.at
index 23b0321..afba585 100644
--- a/tests/ofproto-macros.at
+++ b/tests/ofproto-macros.at
@@ -235,6 +235,15 @@  net_attach () {
         || return 1
 }
 
+# ovn_register_arp BRIDGE IP MAC
+#
+# Registers bridge/ip/mac triplet to the arp_table list which can be
+# populated via the ovn_populate_arp function.
+ovn_register_arp() {
+    local sandbox=$1 bridge=$2 ip=$3 mac=$4
+    arp_table="$arp_table $sandbox,$bridge,$ip,$mac"
+}	
+
 # ovn_attach NETWORK BRIDGE IP [MASKLEN]
 #
 # First, this command attaches BRIDGE to interconnection network NETWORK, just
@@ -247,7 +256,7 @@  ovn_attach() {
     net_attach $net $bridge || return 1
 
     mac=`ovs-vsctl get Interface $bridge mac_in_use | sed s/\"//g`
-    arp_table="$arp_table $sandbox,$bridge,$ip,$mac"
+    ovn_register_arp $sandbox $bridge $ip $mac
     ovs-appctl netdev-dummy/ip4addr $bridge $ip/$masklen >/dev/null || return 1
     ovs-appctl ovs/route/add $ip/$masklen $bridge >/dev/null || return 1
     ovs-vsctl \
diff --git a/tests/ovn.at b/tests/ovn.at
index 248aea4..22d3ab1 100644
--- a/tests/ovn.at
+++ b/tests/ovn.at
@@ -6851,7 +6851,6 @@  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-nbctl create Logical_Router name=R1
 
@@ -6907,11 +6906,19 @@  as gw1 ovs-vsctl set open . external-ids:ovn-bridge-mappings=phys:br-phys
 as gw2 ovs-vsctl set open . external-ids:ovn-bridge-mappings=phys:br-phys
 as ext1 ovs-vsctl set open . external-ids:ovn-bridge-mappings=phys:br-phys
 
-AT_CHECK([ovn-nbctl --timeout=3 --wait=sb sync], [0], [ignore])
+AT_CHECK([ovn-nbctl --timeout=3 --wait=hv sync], [0], [ignore])
 
-# Allow some time for ovn-northd and ovn-controller to catch up.
-# XXX This should be more systematic.
-sleep 2
+ovn_register_arp ext1 br-phys 172.16.1.3 f0:00:00:01:02:04
+
+ovn_populate_arp
+
+for x in hv1 gw1 gw2 ext1; do
+   echo tnl/arp/show at ${x}:
+   as $x ovs-appctl tnl/arp/show
+done
+
+# allow BFD sessions to be established and up/steady
+sleep 3
 
 ip_to_hex() {
     printf "%02x%02x%02x%02x" "$@"