[ovs-dev] [PATCH ovn 1/3] CoPP: add self-test for icmp{4, 6}_error controller action

Lorenzo Bianconi lorenzo.bianconi at redhat.com
Thu Oct 21 11:45:52 UTC 2021


> On 13/10/2021 17:46, Lorenzo Bianconi wrote:
> > Introduce CoPP selftest for icmp{4,6}_error controller action
> > 
> > Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi at redhat.com>
> > ---
> >  tests/ovn-northd.at | 23 +++++++++++++++++++++++
> >  tests/system-ovn.at | 21 +++++++++++++++++++++
> >  2 files changed, 44 insertions(+)
> > 
> > diff --git a/tests/ovn-northd.at b/tests/ovn-northd.at
> > index 8b9049899..3bcbdf4a9 100644
> > --- a/tests/ovn-northd.at
> > +++ b/tests/ovn-northd.at
> > @@ -3249,6 +3249,29 @@ AT_CHECK([ovn-nbctl lr-copp-list r0], [0], [dnl
> >  
> >  AT_CHECK([ovn-sbctl list logical_flow | grep arp -A 2 | grep -q meter1],[1])
> >  
> > +check ovn-nbctl --wait=hv meter-add meter2 drop 400 pktps 10
> > +check ovn-nbctl --wait=hv lr-copp-add r0 icmp4-error meter2
> > +AT_CHECK([ovn-nbctl lr-copp-list r0], [0], [dnl
> > +icmp4-error: meter2
> > +])
> > +
> > +AT_CHECK([ovn-sbctl list logical_flow | grep icmp4 -A 2 | grep -q meter2])
> > +
> > +check ovn-nbctl --wait=hv lr-copp-del r0 icmp4-error
> > +AT_CHECK([ovn-nbctl lr-copp-list r0], [0], [dnl
> > +])
> > +
> > +check ovn-nbctl --wait=hv lr-copp-add r0 icmp6-error meter2
> > +AT_CHECK([ovn-nbctl lr-copp-list r0], [0], [dnl
> > +icmp6-error: meter2
> > +])
> > +
> > +AT_CHECK([ovn-sbctl list logical_flow | grep icmp6 -A 2 | grep -q meter2])
> > +
> > +check ovn-nbctl --wait=hv lr-copp-del r0 icmp6-error
> > +AT_CHECK([ovn-nbctl lr-copp-list r0], [0], [dnl
> > +])
> > +
> >  check ovn-nbctl --wait=hv ls-copp-del sw1 event-elb
> >  AT_CHECK([ovn-nbctl ls-copp-list sw1], [0], [dnl
> >  ])
> > diff --git a/tests/system-ovn.at b/tests/system-ovn.at
> > index 345384223..bd425f54b 100644
> > --- a/tests/system-ovn.at
> > +++ b/tests/system-ovn.at
> > @@ -6730,6 +6730,27 @@ OVS_WAIT_UNTIL([
> >      test "${n_arp}" = "2"
> >  ])
> >  
> > +check ovn-nbctl meter-add icmp-meter drop 1 pktps 0
> > +check ovn-nbctl --wait=hv lr-copp-add R1 icmp4-error icmp-meter
> > +AT_CHECK([ovn-nbctl lr-copp-list R1 |grep icmp4-error], [0], [dnl
> > +icmp4-error: icmp-meter
> > +])
> > +
> > +NS_EXEC([sw01], [tcpdump -n -i sw01 icmp > icmp.pcap &])
> > +ip netns exec sw01 scapy -H <<-EOF
> > +p = IP(src="192.168.1.2", dst="172.16.1.100", ttl=1)/ TCP(dport = 8080, flags="S") / Raw(b"X"*64)
> 
> small nit: can you make the whitespace between '/'s consistent across
> this statement. Only update this if you need to repost.

ack, I will fix it

> 
> > +send (p, iface='sw01', loop = 0, verbose = 0, count = 100)
> > +EOF
> > +
> > +sleep 2
> > +kill $(pidof tcpdump)
> > +
> I feel like a sleep could inadvertently introduce a race condition on
> some systems. Not sure how to avoid it though. Maybe rather than
> sleeping, you could wait until "n_icmp" == 2, and then check how much
> time has passed but I don't know if that would improve things

ack, I will use -l option in tcpdump instead

> 
> > +# 1pps + 1 burst size
> > +OVS_WAIT_UNTIL([
> > +    n_icmp=$(grep ICMP icmp.pcap | wc -l)
> > +    test "${n_icmp}" = "2"
> > +])
> > +
> >  kill $(pidof ovn-controller)
> >  
> >  as ovn-sb
> > 
> 
> You didn't add an ICMP6 test. Maybe its not necessary?
> 

I will add it.

Regards,
Lorenzo


More information about the dev mailing list