diff mbox series

[ovs-dev,v3] test: add dedicated test for garp-max-timeout

Message ID e227c9d149c71f41dd007668e11932956c5f39b9.1704706590.git.lorenzo.bianconi@redhat.com
State Accepted
Delegated to: Dumitru Ceara
Headers show
Series [ovs-dev,v3] test: add dedicated test for garp-max-timeout | expand

Checks

Context Check Description
ovsrobot/apply-robot success apply and check: success
ovsrobot/github-robot-_Build_and_Test success github build: passed
ovsrobot/github-robot-_ovn-kubernetes success github build: passed

Commit Message

Lorenzo Bianconi Jan. 8, 2024, 9:37 a.m. UTC
Introduce a dedicated test for garp-max-timeout knob

Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
---
 tests/ovn.at | 65 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 65 insertions(+)

Comments

Dumitru Ceara Jan. 9, 2024, 9:18 p.m. UTC | #1
On 1/8/24 10:37, Lorenzo Bianconi wrote:
> Introduce a dedicated test for garp-max-timeout knob
> 
> Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
> ---
>  tests/ovn.at | 65 ++++++++++++++++++++++++++++++++++++++++++++++++++++
>  1 file changed, 65 insertions(+)
> 
> diff --git a/tests/ovn.at b/tests/ovn.at
> index 5615ba1a9..6093e0ed9 100644
> --- a/tests/ovn.at
> +++ b/tests/ovn.at
> @@ -37524,3 +37524,68 @@ wait_for_ports_up
>  OVN_CLEANUP([hv1])
>  AT_CLEANUP
>  ])
> +
> +OVN_FOR_EACH_NORTHD([
> +AT_SETUP([gratuitous arp max timeout])
> +AT_KEYWORDS([slowtest])
> +TAG_UNSTABLE
> +AT_SKIP_IF([test $HAVE_TCPDUMP = no])
> +AT_SKIP_IF([test $HAVE_SCAPY = no])
> +ovn_start
> +
> +check ovn-nbctl ls-add ls0
> +check ovn-nbctl lr-add lr0
> +check ovn-nbctl lrp-add lr0 lr0-ls0 f0:00:00:00:00:01 192.168.0.1/24
> +check ovn-nbctl lsp-add ls0 ls0-lr0 -- set Logical_Switch_Port ls0-lr0 \
> +    type=router options:router-port=lr0-ls0 addresses='"f0:00:00:00:00:01"'
> +
> +check ovn-nbctl lsp-add ls0 ln_port
> +check ovn-nbctl lsp-set-addresses ln_port unknown
> +check ovn-nbctl lsp-set-type ln_port localnet
> +check ovn-nbctl --wait=hv lsp-set-options ln_port network_name=physnet1
> +
> +net_add n1
> +sim_add hv1
> +as hv1
> +check ovs-vsctl \
> +    -- add-br br-phys \
> +    -- add-br br-eth0
> +
> +ovn_attach n1 br-phys 192.168.0.10
> +
> +AT_CHECK([ovs-vsctl set Open_vSwitch . external-ids:ovn-bridge-mappings=physnet1:br-eth0])
> +AT_CHECK([ovs-vsctl add-port br-eth0 snoopvif -- set Interface snoopvif options:tx_pcap=hv1/snoopvif-tx.pcap options:rxq_pcap=hv1/snoopvif-rx.pcap])
> +
> +# set garp max timeout to 2s
> +AT_CHECK([as hv1 ovs-vsctl set Open_vSwitch . external-ids:garp-max-timeout-sec=2])
> +
> +# Wait until the patch ports are created in hv1 to connect br-int to br-eth0
> +AT_CHECK([ovn-nbctl set logical_router lr0 options:chassis=hv1])
> +OVN_WAIT_PATCH_PORT_FLOWS(["ln_port"], ["hv1"])
> +
> +# sleep for 12s to get a garp every ~ 2s
> +sleep 12
> +
> +n_arp=$(tcpdump -ner hv1/snoopvif-tx.pcap arp | wc -l)
> +AT_CHECK([test $n_arp -ge 5 -a $n_arp -lt 10])
> +
> +# Temporarily remove lr0 chassis
> +# Wait for hv confirmation to make sure chassis is removed before we reset pcap
> +# Otherwise a garp might be sent after pcap have been reset but before chassis is removed
> +AT_CHECK([ovn-nbctl --wait=hv remove logical_router lr0 options chassis])
> +
> +as hv1 reset_pcap_file snoopvif hv1/snoopvif
> +# set garp max timeout to 1s
> +AT_CHECK([as hv1 ovs-vsctl set Open_vSwitch . external-ids:garp-max-timeout-sec=1])
> +AT_CHECK([ovn-nbctl set logical_router lr0 options:chassis=hv1])
> +
> +# sleep for 7s to get a garp every ~ 1s
> +sleep 7
> +
> +n_arp=$(tcpdump -ner hv1/snoopvif-tx.pcap arp | wc -l)
> +AT_CHECK([test $n_arp -ge 5 -a $n_arp -lt 10])
> +
> +OVN_CLEANUP([hv1])
> +
> +AT_CLEANUP
> +])

Thanks, Lorenzo and Mark!

I applied this to main with a small change:

diff --git a/tests/ovn.at b/tests/ovn.at
index 6093e0ed99..c3644ac78e 100644
--- a/tests/ovn.at
+++ b/tests/ovn.at
@@ -37530,7 +37530,6 @@ AT_SETUP([gratuitous arp max timeout])
 AT_KEYWORDS([slowtest])
 TAG_UNSTABLE
 AT_SKIP_IF([test $HAVE_TCPDUMP = no])
-AT_SKIP_IF([test $HAVE_SCAPY = no])
 ovn_start
 
 check ovn-nbctl ls-add ls0
@@ -37553,14 +37552,14 @@ check ovs-vsctl \
 
 ovn_attach n1 br-phys 192.168.0.10
 
-AT_CHECK([ovs-vsctl set Open_vSwitch . external-ids:ovn-bridge-mappings=physnet1:br-eth0])
-AT_CHECK([ovs-vsctl add-port br-eth0 snoopvif -- set Interface snoopvif options:tx_pcap=hv1/snoopvif-tx.pcap options:rxq_pcap=hv1/snoopvif-rx.pcap])
+check ovs-vsctl set Open_vSwitch . external-ids:ovn-bridge-mappings=physnet1:br-eth0
+check ovs-vsctl add-port br-eth0 snoopvif -- set Interface snoopvif options:tx_pcap=hv1/snoopvif-tx.pcap options:rxq_pcap=hv1/snoopvif-rx.pcap
 
 # set garp max timeout to 2s
-AT_CHECK([as hv1 ovs-vsctl set Open_vSwitch . external-ids:garp-max-timeout-sec=2])
+as hv1 check ovs-vsctl set Open_vSwitch . external-ids:garp-max-timeout-sec=2
 
 # Wait until the patch ports are created in hv1 to connect br-int to br-eth0
-AT_CHECK([ovn-nbctl set logical_router lr0 options:chassis=hv1])
+check ovn-nbctl set logical_router lr0 options:chassis=hv1
 OVN_WAIT_PATCH_PORT_FLOWS(["ln_port"], ["hv1"])
 
 # sleep for 12s to get a garp every ~ 2s
@@ -37572,12 +37571,12 @@ AT_CHECK([test $n_arp -ge 5 -a $n_arp -lt 10])
 # Temporarily remove lr0 chassis
 # Wait for hv confirmation to make sure chassis is removed before we reset pcap
 # Otherwise a garp might be sent after pcap have been reset but before chassis is removed
-AT_CHECK([ovn-nbctl --wait=hv remove logical_router lr0 options chassis])
+check ovn-nbctl --wait=hv remove logical_router lr0 options chassis
 
 as hv1 reset_pcap_file snoopvif hv1/snoopvif
 # set garp max timeout to 1s
-AT_CHECK([as hv1 ovs-vsctl set Open_vSwitch . external-ids:garp-max-timeout-sec=1])
-AT_CHECK([ovn-nbctl set logical_router lr0 options:chassis=hv1])
+as hv1 check ovs-vsctl set Open_vSwitch . external-ids:garp-max-timeout-sec=1
+check ovn-nbctl set logical_router lr0 options:chassis=hv1
 
 # sleep for 7s to get a garp every ~ 1s
 sleep 7
---

I also backported this all the way down to 21.12 (as requested).

Regards,
Dumitru
diff mbox series

Patch

diff --git a/tests/ovn.at b/tests/ovn.at
index 5615ba1a9..6093e0ed9 100644
--- a/tests/ovn.at
+++ b/tests/ovn.at
@@ -37524,3 +37524,68 @@  wait_for_ports_up
 OVN_CLEANUP([hv1])
 AT_CLEANUP
 ])
+
+OVN_FOR_EACH_NORTHD([
+AT_SETUP([gratuitous arp max timeout])
+AT_KEYWORDS([slowtest])
+TAG_UNSTABLE
+AT_SKIP_IF([test $HAVE_TCPDUMP = no])
+AT_SKIP_IF([test $HAVE_SCAPY = no])
+ovn_start
+
+check ovn-nbctl ls-add ls0
+check ovn-nbctl lr-add lr0
+check ovn-nbctl lrp-add lr0 lr0-ls0 f0:00:00:00:00:01 192.168.0.1/24
+check ovn-nbctl lsp-add ls0 ls0-lr0 -- set Logical_Switch_Port ls0-lr0 \
+    type=router options:router-port=lr0-ls0 addresses='"f0:00:00:00:00:01"'
+
+check ovn-nbctl lsp-add ls0 ln_port
+check ovn-nbctl lsp-set-addresses ln_port unknown
+check ovn-nbctl lsp-set-type ln_port localnet
+check ovn-nbctl --wait=hv lsp-set-options ln_port network_name=physnet1
+
+net_add n1
+sim_add hv1
+as hv1
+check ovs-vsctl \
+    -- add-br br-phys \
+    -- add-br br-eth0
+
+ovn_attach n1 br-phys 192.168.0.10
+
+AT_CHECK([ovs-vsctl set Open_vSwitch . external-ids:ovn-bridge-mappings=physnet1:br-eth0])
+AT_CHECK([ovs-vsctl add-port br-eth0 snoopvif -- set Interface snoopvif options:tx_pcap=hv1/snoopvif-tx.pcap options:rxq_pcap=hv1/snoopvif-rx.pcap])
+
+# set garp max timeout to 2s
+AT_CHECK([as hv1 ovs-vsctl set Open_vSwitch . external-ids:garp-max-timeout-sec=2])
+
+# Wait until the patch ports are created in hv1 to connect br-int to br-eth0
+AT_CHECK([ovn-nbctl set logical_router lr0 options:chassis=hv1])
+OVN_WAIT_PATCH_PORT_FLOWS(["ln_port"], ["hv1"])
+
+# sleep for 12s to get a garp every ~ 2s
+sleep 12
+
+n_arp=$(tcpdump -ner hv1/snoopvif-tx.pcap arp | wc -l)
+AT_CHECK([test $n_arp -ge 5 -a $n_arp -lt 10])
+
+# Temporarily remove lr0 chassis
+# Wait for hv confirmation to make sure chassis is removed before we reset pcap
+# Otherwise a garp might be sent after pcap have been reset but before chassis is removed
+AT_CHECK([ovn-nbctl --wait=hv remove logical_router lr0 options chassis])
+
+as hv1 reset_pcap_file snoopvif hv1/snoopvif
+# set garp max timeout to 1s
+AT_CHECK([as hv1 ovs-vsctl set Open_vSwitch . external-ids:garp-max-timeout-sec=1])
+AT_CHECK([ovn-nbctl set logical_router lr0 options:chassis=hv1])
+
+# sleep for 7s to get a garp every ~ 1s
+sleep 7
+
+n_arp=$(tcpdump -ner hv1/snoopvif-tx.pcap arp | wc -l)
+AT_CHECK([test $n_arp -ge 5 -a $n_arp -lt 10])
+
+OVN_CLEANUP([hv1])
+
+AT_CLEANUP
+])