[ovs-dev] [PATCH ovn 2/3] CoPP: add self-test for bfd controller action

Mark Gray mark.d.gray at redhat.com
Fri Oct 15 15:42:48 UTC 2021


On 13/10/2021 17:46, Lorenzo Bianconi wrote:
> Introduce CoPP selftest for bfd controller action
> 
> Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi at redhat.com>
> ---
>  tests/system-ovn.at | 29 +++++++++++++++++++++++++++++
>  1 file changed, 29 insertions(+)
> 
> diff --git a/tests/system-ovn.at b/tests/system-ovn.at
> index bd425f54b..12f072b72 100644
> --- a/tests/system-ovn.at
> +++ b/tests/system-ovn.at
> @@ -6751,6 +6751,35 @@ OVS_WAIT_UNTIL([
>      test "${n_icmp}" = "2"
>  ])
>  
> +check ovn-nbctl meter-add bfd-meter drop 1 pktps 0
> +check ovn-nbctl --wait=hv lr-copp-add R1 bfd bfd-meter
> +AT_CHECK([ovn-nbctl lr-copp-list R1 |grep bfd], [0], [dnl
> +bfd: bfd-meter
> +])
> +
> +check ovn-nbctl --bfd lr-route-add R1 240.0.0.0/8 172.16.1.50 rp-public
> +disc=$(ovn-sbctl list bfd | awk '/disc/{print $3}')
> +printf "%08x" $disc > /tmp/disc

Could you just get the value directly from the database using:

`ovn-sbctl get BFD ...`?

> +NS_EXEC([server], [tcpdump -n -i s1 udp port 3784 -Q in > bfd.pcap &])
> +ip netns exec server scapy -H <<-EOF
> +import binascii
> +f = open("/tmp/disc", "r")
> +bfd = binascii.unhexlify("20600518a899e77b" + f.readline().strip() + "000f4240000f424000000000")

Please add some comments, its hard to follow what's going on.

> +p = IP(src="172.16.1.50", dst="172.16.1.1")/ UDP(dport = 3784, sport = 49152) / Raw(load = bfd)
> +send (p, iface='s1', loop = 0, verbose = 0, count = 100)
> +f.close()
> +EOF
> +rm /tmp/disc
> +
> +sleep 2
> +kill $(pidof tcpdump)
> +
> +# 1pps + 1 burst size
> +OVS_WAIT_UNTIL([
> +    n_tcp_rst=$(grep Final bfd.pcap | wc -l)
> +    test "${n_tcp_rst}" = "2"
> +])
> +
>  kill $(pidof ovn-controller)
>  
>  as ovn-sb
> 



More information about the dev mailing list