diff mbox series

[ovs-dev,v4,4/4] Userspace: Add system test with UDP tunneling of UDP traffic.

Message ID 20240215225305.408579-4-mkp@redhat.com
State Accepted
Headers show
Series [ovs-dev,v4,1/4] netdev-linux: Favour inner packet for multi-encapsulated TSO. | expand

Checks

Context Check Description
ovsrobot/apply-robot success apply and check: success
ovsrobot/github-robot-_Build_and_Test success github build: passed
ovsrobot/intel-ovs-compilation success test: success

Commit Message

Mike Pattrick Feb. 15, 2024, 10:53 p.m. UTC
Previously a gap existed in the tunnel system tests where only ICMP and
TCP traffic was tested. However, the code paths using for UDP traffic is
different then either of those and should also be tested.

Some of the modified tests had previously checked for TCP with ncat but
didn't include an appropriate check for ncat support. That check was
added to these tests.

Signed-off-by: Mike Pattrick <mkp@redhat.com>
---
 tests/system-traffic.at | 118 +++++++++++++++++++++++++++++++++++++---
 1 file changed, 111 insertions(+), 7 deletions(-)

Comments

Ilya Maximets Feb. 16, 2024, 8:23 p.m. UTC | #1
On 2/15/24 23:53, Mike Pattrick wrote:
> Previously a gap existed in the tunnel system tests where only ICMP and
> TCP traffic was tested. However, the code paths using for UDP traffic is
> different then either of those and should also be tested.
> 
> Some of the modified tests had previously checked for TCP with ncat but
> didn't include an appropriate check for ncat support. That check was
> added to these tests.
> 
> Signed-off-by: Mike Pattrick <mkp@redhat.com>
> ---
>  tests/system-traffic.at | 118 +++++++++++++++++++++++++++++++++++++---
>  1 file changed, 111 insertions(+), 7 deletions(-)
> 

Hi, Mike.  Thanks for the fixes.  They look mostly fine to me and I
tested them also with David's triple-tunnel test and it seem to work.

The code becomes excessively hard to read though.  I think the dp-packet
API has to be re-done before userspace-tso can be declared not
experimental.  I don't have any good ideas on how to actually do that
though.
But this should not be addressed in this patch set.

See a few comments for the tests below.

> diff --git a/tests/system-traffic.at b/tests/system-traffic.at
> index e68fe7e18..ca54a0f73 100644
> --- a/tests/system-traffic.at
> +++ b/tests/system-traffic.at
> @@ -292,6 +292,7 @@ OVS_TRAFFIC_VSWITCHD_STOP
>  AT_CLEANUP
>  
>  AT_SETUP([datapath - ping over vxlan tunnel])
> +AT_SKIP_IF([test $HAVE_NC = no])
>  OVS_CHECK_VXLAN()
>  
>  OVS_TRAFFIC_VSWITCHD_START()
> @@ -318,6 +319,10 @@ NS_CHECK_EXEC([at_ns0], [ping -q -c 3 -i 0.3 -W 2 172.31.1.100 | FORMAT_PING], [
>  3 packets transmitted, 3 received, 0% packet loss, time 0ms
>  ])
>  
> +dnl Start ncat listeners.
> +OVS_DAEMONIZE([nc -l 10.1.1.100 1234 > tcp_data], [nc.pid])
> +NETNS_DAEMONIZE([at_ns0], [nc -l -u 10.1.1.1 4321 > udp_data], [nc2.pid])
> +

This should not be here.  We should start them below, close to their usage.

>  dnl Okay, now check the overlay with different packet sizes
>  NS_CHECK_EXEC([at_ns0], [ping -q -c 3 -i 0.3 -W 2 10.1.1.100 | FORMAT_PING], [0], [dnl
>  3 packets transmitted, 3 received, 0% packet loss, time 0ms
> @@ -329,15 +334,29 @@ NS_CHECK_EXEC([at_ns0], [ping -s 3200 -q -c 3 -i 0.3 -W 2 10.1.1.100 | FORMAT_PI
>  3 packets transmitted, 3 received, 0% packet loss, time 0ms
>  ])
>  
> +dnl Verify that ncat is ready.
> +OVS_WAIT_UNTIL([netstat -ln | grep :1234])
> +OVS_WAIT_UNTIL([NS_EXEC([at_ns0], [netstat -ln | grep :4321])])
> +
>  dnl Check large bidirectional TCP.
>  AT_CHECK([dd if=/dev/urandom of=payload.bin bs=60000 count=1 2> /dev/null])
> -OVS_DAEMONIZE([nc -l 10.1.1.100 1234 > data], [nc.pid])
>  NS_CHECK_EXEC([at_ns0], [nc $NC_EOF_OPT 10.1.1.100 1234 < payload.bin])
>  
>  dnl Wait until transfer completes before checking.
>  OVS_WAIT_WHILE([kill -0 $(cat nc.pid)])
> -AT_CHECK([diff -q payload.bin data], [0])
> +AT_CHECK([diff -q payload.bin tcp_data], [0])
> +
> +dnl Check UDP

Period at the end.

> +AT_CHECK([dd if=/dev/urandom of=payload.bin bs=600 count=1 2> /dev/null])
> +AT_CHECK([nc $NC_EOF_OPT -u 10.1.1.1 4321 < payload.bin])
>  
> +dnl The UDP listener will just listen forever if not terminated.
> +OVS_WAIT_UNTIL([kill -0 $(cat nc2.pid)])
> +AT_CHECK([kill $(cat nc2.pid)])
> +
> +dnl Wait until transfer completes before checking.
> +OVS_WAIT_WHILE([kill -0 $(cat nc2.pid)])

I don't think 6 lines above do anything useful.
We check that the process is running, kill it, wait until it dies.
But if it didn't finish writing the data, we will kill it and end
up with incomplete data...

> +AT_CHECK([diff -q payload.bin udp_data], [0])

... so instead of all these manipulations we can just use
OVS_WAIT_UNTIL here and wait until the file is fully transferred.

The server will be stopped by the on_exit hook registered by the
NETNS_DAEMONIZE.

We can also apply the same strategy to the TCP check, we can just
wait on a content and not wait for the process to exit.

The same applies to all other tests here.

I already tried these changes here:
  https://github.com/igsilya/ovs/commit/f544d397250714b7ba8c1a3f81eada29ffd59142

I did several iterations of GHA runs with these changes and they
work fine in CI.

If you agree, I can fold those in while applying the set.

Please, let me know as soon as possible as we need to proceed with
the release.

Best regards, Ilya Maximets.
Mike Pattrick Feb. 16, 2024, 8:40 p.m. UTC | #2
On Fri, Feb 16, 2024 at 3:23 PM Ilya Maximets <i.maximets@ovn.org> wrote:
>
> On 2/15/24 23:53, Mike Pattrick wrote:
> > Previously a gap existed in the tunnel system tests where only ICMP and
> > TCP traffic was tested. However, the code paths using for UDP traffic is
> > different then either of those and should also be tested.
> >
> > Some of the modified tests had previously checked for TCP with ncat but
> > didn't include an appropriate check for ncat support. That check was
> > added to these tests.
> >
> > Signed-off-by: Mike Pattrick <mkp@redhat.com>
> > ---
> >  tests/system-traffic.at | 118 +++++++++++++++++++++++++++++++++++++---
> >  1 file changed, 111 insertions(+), 7 deletions(-)
> >
>
> Hi, Mike.  Thanks for the fixes.  They look mostly fine to me and I
> tested them also with David's triple-tunnel test and it seem to work.
>
> The code becomes excessively hard to read though.  I think the dp-packet
> API has to be re-done before userspace-tso can be declared not
> experimental.  I don't have any good ideas on how to actually do that
> though.

I strongly agree, I can send a proposal later.

> But this should not be addressed in this patch set.
>
> See a few comments for the tests below.
>
> > diff --git a/tests/system-traffic.at b/tests/system-traffic.at
> > index e68fe7e18..ca54a0f73 100644
> > --- a/tests/system-traffic.at
> > +++ b/tests/system-traffic.at
> > @@ -292,6 +292,7 @@ OVS_TRAFFIC_VSWITCHD_STOP
> >  AT_CLEANUP
> >
> >  AT_SETUP([datapath - ping over vxlan tunnel])
> > +AT_SKIP_IF([test $HAVE_NC = no])
> >  OVS_CHECK_VXLAN()
> >
> >  OVS_TRAFFIC_VSWITCHD_START()
> > @@ -318,6 +319,10 @@ NS_CHECK_EXEC([at_ns0], [ping -q -c 3 -i 0.3 -W 2 172.31.1.100 | FORMAT_PING], [
> >  3 packets transmitted, 3 received, 0% packet loss, time 0ms
> >  ])
> >
> > +dnl Start ncat listeners.
> > +OVS_DAEMONIZE([nc -l 10.1.1.100 1234 > tcp_data], [nc.pid])
> > +NETNS_DAEMONIZE([at_ns0], [nc -l -u 10.1.1.1 4321 > udp_data], [nc2.pid])
> > +
>
> This should not be here.  We should start them below, close to their usage.
>
> >  dnl Okay, now check the overlay with different packet sizes
> >  NS_CHECK_EXEC([at_ns0], [ping -q -c 3 -i 0.3 -W 2 10.1.1.100 | FORMAT_PING], [0], [dnl
> >  3 packets transmitted, 3 received, 0% packet loss, time 0ms
> > @@ -329,15 +334,29 @@ NS_CHECK_EXEC([at_ns0], [ping -s 3200 -q -c 3 -i 0.3 -W 2 10.1.1.100 | FORMAT_PI
> >  3 packets transmitted, 3 received, 0% packet loss, time 0ms
> >  ])
> >
> > +dnl Verify that ncat is ready.
> > +OVS_WAIT_UNTIL([netstat -ln | grep :1234])
> > +OVS_WAIT_UNTIL([NS_EXEC([at_ns0], [netstat -ln | grep :4321])])
> > +
> >  dnl Check large bidirectional TCP.
> >  AT_CHECK([dd if=/dev/urandom of=payload.bin bs=60000 count=1 2> /dev/null])
> > -OVS_DAEMONIZE([nc -l 10.1.1.100 1234 > data], [nc.pid])
> >  NS_CHECK_EXEC([at_ns0], [nc $NC_EOF_OPT 10.1.1.100 1234 < payload.bin])
> >
> >  dnl Wait until transfer completes before checking.
> >  OVS_WAIT_WHILE([kill -0 $(cat nc.pid)])
> > -AT_CHECK([diff -q payload.bin data], [0])
> > +AT_CHECK([diff -q payload.bin tcp_data], [0])
> > +
> > +dnl Check UDP
>
> Period at the end.
>
> > +AT_CHECK([dd if=/dev/urandom of=payload.bin bs=600 count=1 2> /dev/null])
> > +AT_CHECK([nc $NC_EOF_OPT -u 10.1.1.1 4321 < payload.bin])
> >
> > +dnl The UDP listener will just listen forever if not terminated.
> > +OVS_WAIT_UNTIL([kill -0 $(cat nc2.pid)])
> > +AT_CHECK([kill $(cat nc2.pid)])
> > +
> > +dnl Wait until transfer completes before checking.
> > +OVS_WAIT_WHILE([kill -0 $(cat nc2.pid)])
>
> I don't think 6 lines above do anything useful.
> We check that the process is running, kill it, wait until it dies.
> But if it didn't finish writing the data, we will kill it and end
> up with incomplete data...
>
> > +AT_CHECK([diff -q payload.bin udp_data], [0])
>
> ... so instead of all these manipulations we can just use
> OVS_WAIT_UNTIL here and wait until the file is fully transferred.
>
> The server will be stopped by the on_exit hook registered by the
> NETNS_DAEMONIZE.
>
> We can also apply the same strategy to the TCP check, we can just
> wait on a content and not wait for the process to exit.
>
> The same applies to all other tests here.
>
> I already tried these changes here:
>   https://github.com/igsilya/ovs/commit/f544d397250714b7ba8c1a3f81eada29ffd59142
>
> I did several iterations of GHA runs with these changes and they
> work fine in CI.
>
> If you agree, I can fold those in while applying the set.
>
> Please, let me know as soon as possible as we need to proceed with
> the release.

I agree with those changes.

-M

>
> Best regards, Ilya Maximets.
>
Ilya Maximets Feb. 16, 2024, 9:35 p.m. UTC | #3
On 2/16/24 21:40, Mike Pattrick wrote:
> On Fri, Feb 16, 2024 at 3:23 PM Ilya Maximets <i.maximets@ovn.org> wrote:
>>
>> On 2/15/24 23:53, Mike Pattrick wrote:
>>> Previously a gap existed in the tunnel system tests where only ICMP and
>>> TCP traffic was tested. However, the code paths using for UDP traffic is
>>> different then either of those and should also be tested.
>>>
>>> Some of the modified tests had previously checked for TCP with ncat but
>>> didn't include an appropriate check for ncat support. That check was
>>> added to these tests.
>>>
>>> Signed-off-by: Mike Pattrick <mkp@redhat.com>
>>> ---
>>>  tests/system-traffic.at | 118 +++++++++++++++++++++++++++++++++++++---
>>>  1 file changed, 111 insertions(+), 7 deletions(-)
>>>
>>
>> Hi, Mike.  Thanks for the fixes.  They look mostly fine to me and I
>> tested them also with David's triple-tunnel test and it seem to work.
>>
>> The code becomes excessively hard to read though.  I think the dp-packet
>> API has to be re-done before userspace-tso can be declared not
>> experimental.  I don't have any good ideas on how to actually do that
>> though.
> 
> I strongly agree, I can send a proposal later.

Thanks!

> 
>> But this should not be addressed in this patch set.
>>
>> See a few comments for the tests below.
>>
>>> diff --git a/tests/system-traffic.at b/tests/system-traffic.at
>>> index e68fe7e18..ca54a0f73 100644
>>> --- a/tests/system-traffic.at
>>> +++ b/tests/system-traffic.at
>>> @@ -292,6 +292,7 @@ OVS_TRAFFIC_VSWITCHD_STOP
>>>  AT_CLEANUP
>>>
>>>  AT_SETUP([datapath - ping over vxlan tunnel])
>>> +AT_SKIP_IF([test $HAVE_NC = no])
>>>  OVS_CHECK_VXLAN()
>>>
>>>  OVS_TRAFFIC_VSWITCHD_START()
>>> @@ -318,6 +319,10 @@ NS_CHECK_EXEC([at_ns0], [ping -q -c 3 -i 0.3 -W 2 172.31.1.100 | FORMAT_PING], [
>>>  3 packets transmitted, 3 received, 0% packet loss, time 0ms
>>>  ])
>>>
>>> +dnl Start ncat listeners.
>>> +OVS_DAEMONIZE([nc -l 10.1.1.100 1234 > tcp_data], [nc.pid])
>>> +NETNS_DAEMONIZE([at_ns0], [nc -l -u 10.1.1.1 4321 > udp_data], [nc2.pid])
>>> +
>>
>> This should not be here.  We should start them below, close to their usage.
>>
>>>  dnl Okay, now check the overlay with different packet sizes
>>>  NS_CHECK_EXEC([at_ns0], [ping -q -c 3 -i 0.3 -W 2 10.1.1.100 | FORMAT_PING], [0], [dnl
>>>  3 packets transmitted, 3 received, 0% packet loss, time 0ms
>>> @@ -329,15 +334,29 @@ NS_CHECK_EXEC([at_ns0], [ping -s 3200 -q -c 3 -i 0.3 -W 2 10.1.1.100 | FORMAT_PI
>>>  3 packets transmitted, 3 received, 0% packet loss, time 0ms
>>>  ])
>>>
>>> +dnl Verify that ncat is ready.
>>> +OVS_WAIT_UNTIL([netstat -ln | grep :1234])
>>> +OVS_WAIT_UNTIL([NS_EXEC([at_ns0], [netstat -ln | grep :4321])])
>>> +
>>>  dnl Check large bidirectional TCP.
>>>  AT_CHECK([dd if=/dev/urandom of=payload.bin bs=60000 count=1 2> /dev/null])
>>> -OVS_DAEMONIZE([nc -l 10.1.1.100 1234 > data], [nc.pid])
>>>  NS_CHECK_EXEC([at_ns0], [nc $NC_EOF_OPT 10.1.1.100 1234 < payload.bin])
>>>
>>>  dnl Wait until transfer completes before checking.
>>>  OVS_WAIT_WHILE([kill -0 $(cat nc.pid)])
>>> -AT_CHECK([diff -q payload.bin data], [0])
>>> +AT_CHECK([diff -q payload.bin tcp_data], [0])
>>> +
>>> +dnl Check UDP
>>
>> Period at the end.
>>
>>> +AT_CHECK([dd if=/dev/urandom of=payload.bin bs=600 count=1 2> /dev/null])
>>> +AT_CHECK([nc $NC_EOF_OPT -u 10.1.1.1 4321 < payload.bin])
>>>
>>> +dnl The UDP listener will just listen forever if not terminated.
>>> +OVS_WAIT_UNTIL([kill -0 $(cat nc2.pid)])
>>> +AT_CHECK([kill $(cat nc2.pid)])
>>> +
>>> +dnl Wait until transfer completes before checking.
>>> +OVS_WAIT_WHILE([kill -0 $(cat nc2.pid)])
>>
>> I don't think 6 lines above do anything useful.
>> We check that the process is running, kill it, wait until it dies.
>> But if it didn't finish writing the data, we will kill it and end
>> up with incomplete data...
>>
>>> +AT_CHECK([diff -q payload.bin udp_data], [0])
>>
>> ... so instead of all these manipulations we can just use
>> OVS_WAIT_UNTIL here and wait until the file is fully transferred.
>>
>> The server will be stopped by the on_exit hook registered by the
>> NETNS_DAEMONIZE.
>>
>> We can also apply the same strategy to the TCP check, we can just
>> wait on a content and not wait for the process to exit.
>>
>> The same applies to all other tests here.
>>
>> I already tried these changes here:
>>   https://github.com/igsilya/ovs/commit/f544d397250714b7ba8c1a3f81eada29ffd59142
>>
>> I did several iterations of GHA runs with these changes and they
>> work fine in CI.
>>
>> If you agree, I can fold those in while applying the set.
>>
>> Please, let me know as soon as possible as we need to proceed with
>> the release.
> 
> I agree with those changes.

Thanks!  I adjusted the subject of this patch a little, folded discussed
changes in and applied the set.  Also backported to 3.3.

Best regards, Ilya Maximets.
diff mbox series

Patch

diff --git a/tests/system-traffic.at b/tests/system-traffic.at
index e68fe7e18..ca54a0f73 100644
--- a/tests/system-traffic.at
+++ b/tests/system-traffic.at
@@ -292,6 +292,7 @@  OVS_TRAFFIC_VSWITCHD_STOP
 AT_CLEANUP
 
 AT_SETUP([datapath - ping over vxlan tunnel])
+AT_SKIP_IF([test $HAVE_NC = no])
 OVS_CHECK_VXLAN()
 
 OVS_TRAFFIC_VSWITCHD_START()
@@ -318,6 +319,10 @@  NS_CHECK_EXEC([at_ns0], [ping -q -c 3 -i 0.3 -W 2 172.31.1.100 | FORMAT_PING], [
 3 packets transmitted, 3 received, 0% packet loss, time 0ms
 ])
 
+dnl Start ncat listeners.
+OVS_DAEMONIZE([nc -l 10.1.1.100 1234 > tcp_data], [nc.pid])
+NETNS_DAEMONIZE([at_ns0], [nc -l -u 10.1.1.1 4321 > udp_data], [nc2.pid])
+
 dnl Okay, now check the overlay with different packet sizes
 NS_CHECK_EXEC([at_ns0], [ping -q -c 3 -i 0.3 -W 2 10.1.1.100 | FORMAT_PING], [0], [dnl
 3 packets transmitted, 3 received, 0% packet loss, time 0ms
@@ -329,15 +334,29 @@  NS_CHECK_EXEC([at_ns0], [ping -s 3200 -q -c 3 -i 0.3 -W 2 10.1.1.100 | FORMAT_PI
 3 packets transmitted, 3 received, 0% packet loss, time 0ms
 ])
 
+dnl Verify that ncat is ready.
+OVS_WAIT_UNTIL([netstat -ln | grep :1234])
+OVS_WAIT_UNTIL([NS_EXEC([at_ns0], [netstat -ln | grep :4321])])
+
 dnl Check large bidirectional TCP.
 AT_CHECK([dd if=/dev/urandom of=payload.bin bs=60000 count=1 2> /dev/null])
-OVS_DAEMONIZE([nc -l 10.1.1.100 1234 > data], [nc.pid])
 NS_CHECK_EXEC([at_ns0], [nc $NC_EOF_OPT 10.1.1.100 1234 < payload.bin])
 
 dnl Wait until transfer completes before checking.
 OVS_WAIT_WHILE([kill -0 $(cat nc.pid)])
-AT_CHECK([diff -q payload.bin data], [0])
+AT_CHECK([diff -q payload.bin tcp_data], [0])
+
+dnl Check UDP
+AT_CHECK([dd if=/dev/urandom of=payload.bin bs=600 count=1 2> /dev/null])
+AT_CHECK([nc $NC_EOF_OPT -u 10.1.1.1 4321 < payload.bin])
 
+dnl The UDP listener will just listen forever if not terminated.
+OVS_WAIT_UNTIL([kill -0 $(cat nc2.pid)])
+AT_CHECK([kill $(cat nc2.pid)])
+
+dnl Wait until transfer completes before checking.
+OVS_WAIT_WHILE([kill -0 $(cat nc2.pid)])
+AT_CHECK([diff -q payload.bin udp_data], [0])
 OVS_TRAFFIC_VSWITCHD_STOP
 AT_CLEANUP
 
@@ -389,6 +408,7 @@  OVS_TRAFFIC_VSWITCHD_STOP
 AT_CLEANUP
 
 AT_SETUP([datapath - ping over vxlan6 tunnel])
+AT_SKIP_IF([test $HAVE_NC = no])
 OVS_CHECK_VXLAN_UDP6ZEROCSUM()
 
 OVS_TRAFFIC_VSWITCHD_START()
@@ -412,6 +432,9 @@  ADD_NATIVE_TUNNEL6([vxlan], [at_vxlan1], [at_ns0], [fc00::100], [10.1.1.1/24],
 
 OVS_WAIT_UNTIL([ip netns exec at_ns0 ping6 -c 1 fc00::100])
 
+OVS_DAEMONIZE([nc -l 10.1.1.100 1234 > data], [nc.pid])
+NETNS_DAEMONIZE([at_ns0], [nc -l -u 10.1.1.1 4321 > udp_data], [nc2.pid])
+
 dnl First, check the underlay
 NS_CHECK_EXEC([at_ns0], [ping6 -q -c 3 -i 0.3 -W 2 fc00::100 | FORMAT_PING], [0], [dnl
 3 packets transmitted, 3 received, 0% packet loss, time 0ms
@@ -428,14 +451,29 @@  NS_CHECK_EXEC([at_ns0], [ping -s 3200 -q -c 3 -i 0.3 -W 2 10.1.1.100 | FORMAT_PI
 3 packets transmitted, 3 received, 0% packet loss, time 0ms
 ])
 
+dnl Verify that ncat is ready.
+OVS_WAIT_UNTIL([netstat -ln | grep :1234])
+OVS_WAIT_UNTIL([NS_EXEC([at_ns0], [netstat -ln | grep :4321])])
+
 dnl Check large bidirectional TCP.
 AT_CHECK([dd if=/dev/urandom of=payload.bin bs=60000 count=1 2> /dev/null])
-OVS_DAEMONIZE([nc -l 10.1.1.100 1234 > data], [nc.pid])
 NS_CHECK_EXEC([at_ns0], [nc $NC_EOF_OPT 10.1.1.100 1234 < payload.bin])
 
 dnl Wait until transfer completes before checking.
 OVS_WAIT_WHILE([kill -0 $(cat nc.pid)])
 AT_CHECK([diff -q payload.bin data], [0])
+
+dnl Check UDP
+AT_CHECK([dd if=/dev/urandom of=payload.bin bs=600 count=1 2> /dev/null])
+AT_CHECK([nc $NC_EOF_OPT -u 10.1.1.1 4321 < payload.bin])
+
+dnl The UDP listener will just listen forever if not terminated.
+OVS_WAIT_UNTIL([kill -0 $(cat nc2.pid)])
+AT_CHECK([kill $(cat nc2.pid)])
+
+dnl Wait until transfer completes before checking.
+OVS_WAIT_WHILE([kill -0 $(cat nc2.pid)])
+AT_CHECK([diff -q payload.bin udp_data], [0])
 OVS_TRAFFIC_VSWITCHD_STOP
 AT_CLEANUP
 
@@ -466,6 +504,10 @@  NS_CHECK_EXEC([at_ns0], [ping -q -c 3 -i 0.3 -W 2 172.31.1.100 | FORMAT_PING], [
 3 packets transmitted, 3 received, 0% packet loss, time 0ms
 ])
 
+dnl Start ncat listeners.
+OVS_DAEMONIZE([nc -l 10.1.1.100 1234 > tcp_data], [nc.pid])
+NETNS_DAEMONIZE([at_ns0], [nc -l -u 10.1.1.1 4321 > udp_data], [nc2.pid])
+
 dnl Okay, now check the overlay with different packet sizes
 NS_CHECK_EXEC([at_ns0], [ping -q -c 3 -i 0.3 -W 2 10.1.1.100 | FORMAT_PING], [0], [dnl
 3 packets transmitted, 3 received, 0% packet loss, time 0ms
@@ -477,6 +519,29 @@  NS_CHECK_EXEC([at_ns0], [ping -s 3200 -q -c 3 -i 0.3 -W 2 10.1.1.100 | FORMAT_PI
 3 packets transmitted, 3 received, 0% packet loss, time 0ms
 ])
 
+dnl Verify that ncat is ready.
+OVS_WAIT_UNTIL([netstat -ln | grep :1234])
+OVS_WAIT_UNTIL([NS_EXEC([at_ns0], [netstat -ln | grep :4321])])
+
+dnl Check large bidirectional TCP.
+AT_CHECK([dd if=/dev/urandom of=payload.bin bs=60000 count=1 2> /dev/null])
+NS_CHECK_EXEC([at_ns0], [nc $NC_EOF_OPT 10.1.1.100 1234 < payload.bin])
+
+dnl Wait until transfer completes before checking.
+OVS_WAIT_WHILE([kill -0 $(cat nc.pid)])
+AT_CHECK([diff -q payload.bin tcp_data], [0])
+
+dnl Check UDP
+AT_CHECK([dd if=/dev/urandom of=payload.bin bs=600 count=1 2> /dev/null])
+AT_CHECK([nc $NC_EOF_OPT -u 10.1.1.1 4321 < payload.bin])
+
+dnl The UDP listener will just listen forever if not terminated.
+OVS_WAIT_UNTIL([kill -0 $(cat nc2.pid)])
+AT_CHECK([kill $(cat nc2.pid)])
+
+dnl Wait until transfer completes before checking.
+OVS_WAIT_WHILE([kill -0 $(cat nc2.pid)])
+AT_CHECK([diff -q payload.bin udp_data], [0])
 OVS_TRAFFIC_VSWITCHD_STOP
 AT_CLEANUP
 
@@ -672,6 +737,7 @@  OVS_TRAFFIC_VSWITCHD_STOP
 AT_CLEANUP
 
 AT_SETUP([datapath - ping over geneve tunnel])
+AT_SKIP_IF([test $HAVE_NC = no])
 OVS_CHECK_GENEVE()
 
 OVS_TRAFFIC_VSWITCHD_START()
@@ -698,6 +764,10 @@  NS_CHECK_EXEC([at_ns0], [ping -q -c 3 -i 0.3 -W 2 172.31.1.100 | FORMAT_PING], [
 3 packets transmitted, 3 received, 0% packet loss, time 0ms
 ])
 
+dnl Start ncat listeners.
+OVS_DAEMONIZE([nc -l 10.1.1.100 1234 > tcp_data], [nc.pid])
+NETNS_DAEMONIZE([at_ns0], [nc -l -u 10.1.1.1 4321 > udp_data], [nc2.pid])
+
 dnl Okay, now check the overlay with different packet sizes
 NS_CHECK_EXEC([at_ns0], [ping -q -c 3 -i 0.3 -W 2 10.1.1.100 | FORMAT_PING], [0], [dnl
 3 packets transmitted, 3 received, 0% packet loss, time 0ms
@@ -709,15 +779,29 @@  NS_CHECK_EXEC([at_ns0], [ping -s 3200 -q -c 3 -i 0.3 -W 2 10.1.1.100 | FORMAT_PI
 3 packets transmitted, 3 received, 0% packet loss, time 0ms
 ])
 
+dnl Verify that ncat is ready.
+OVS_WAIT_UNTIL([netstat -ln | grep :1234])
+OVS_WAIT_UNTIL([NS_EXEC([at_ns0], [netstat -ln | grep :4321])])
+
 dnl Check large bidirectional TCP.
 AT_CHECK([dd if=/dev/urandom of=payload.bin bs=60000 count=1 2> /dev/null])
-OVS_DAEMONIZE([nc -l 10.1.1.100 1234 > data], [nc.pid])
 NS_CHECK_EXEC([at_ns0], [nc $NC_EOF_OPT 10.1.1.100 1234 < payload.bin])
 
 dnl Wait until transfer completes before checking.
 OVS_WAIT_WHILE([kill -0 $(cat nc.pid)])
-AT_CHECK([diff -q payload.bin data], [0])
+AT_CHECK([diff -q payload.bin tcp_data], [0])
+
+dnl Check UDP
+AT_CHECK([dd if=/dev/urandom of=payload.bin bs=600 count=1 2> /dev/null])
+AT_CHECK([nc $NC_EOF_OPT -u 10.1.1.1 4321 < payload.bin])
 
+dnl The UDP listener will just listen forever if not terminated.
+OVS_WAIT_UNTIL([kill -0 $(cat nc2.pid)])
+AT_CHECK([kill $(cat nc2.pid)])
+
+dnl Wait until transfer completes before checking.
+OVS_WAIT_WHILE([kill -0 $(cat nc2.pid)])
+AT_CHECK([diff -q payload.bin udp_data], [0])
 OVS_TRAFFIC_VSWITCHD_STOP
 AT_CLEANUP
 
@@ -827,6 +911,7 @@  OVS_TRAFFIC_VSWITCHD_STOP
 AT_CLEANUP
 
 AT_SETUP([datapath - ping over geneve6 tunnel])
+AT_SKIP_IF([test $HAVE_NC = no])
 OVS_CHECK_GENEVE_UDP6ZEROCSUM()
 
 OVS_TRAFFIC_VSWITCHD_START()
@@ -855,6 +940,10 @@  NS_CHECK_EXEC([at_ns0], [ping6 -q -c 3 -i 0.3 -W 2 fc00::100 | FORMAT_PING], [0]
 3 packets transmitted, 3 received, 0% packet loss, time 0ms
 ])
 
+dnl Start ncat listeners.
+OVS_DAEMONIZE([nc -l 10.1.1.100 1234 > tcp_data], [nc.pid])
+NETNS_DAEMONIZE([at_ns0], [nc -l -u 10.1.1.1 4321 > udp_data], [nc2.pid])
+
 dnl Okay, now check the overlay with different packet sizes
 NS_CHECK_EXEC([at_ns0], [ping -q -c 3 -i 0.3 -W 2 10.1.1.100 | FORMAT_PING], [0], [dnl
 3 packets transmitted, 3 received, 0% packet loss, time 0ms
@@ -866,14 +955,29 @@  NS_CHECK_EXEC([at_ns0], [ping -s 3200 -q -c 3 -i 0.3 -W 2 10.1.1.100 | FORMAT_PI
 3 packets transmitted, 3 received, 0% packet loss, time 0ms
 ])
 
+dnl Verify that ncat is ready.
+OVS_WAIT_UNTIL([netstat -ln | grep :1234])
+OVS_WAIT_UNTIL([NS_EXEC([at_ns0], [netstat -ln | grep :4321])])
+
 dnl Check large bidirectional TCP.
 AT_CHECK([dd if=/dev/urandom of=payload.bin bs=60000 count=1 2> /dev/null])
-OVS_DAEMONIZE([nc -l 10.1.1.100 1234 > data], [nc.pid])
 NS_CHECK_EXEC([at_ns0], [nc $NC_EOF_OPT 10.1.1.100 1234 < payload.bin])
 
 dnl Wait until transfer completes before checking.
 OVS_WAIT_WHILE([kill -0 $(cat nc.pid)])
-AT_CHECK([diff -q payload.bin data], [0])
+AT_CHECK([diff -q payload.bin tcp_data], [0])
+
+dnl Check UDP
+AT_CHECK([dd if=/dev/urandom of=payload.bin bs=600 count=1 2> /dev/null])
+AT_CHECK([nc $NC_EOF_OPT -u 10.1.1.1 4321 < payload.bin])
+
+dnl The UDP listener will just listen forever if not terminated.
+OVS_WAIT_UNTIL([kill -0 $(cat nc2.pid)])
+AT_CHECK([kill $(cat nc2.pid)])
+
+dnl Wait until transfer completes before checking.
+OVS_WAIT_WHILE([kill -0 $(cat nc2.pid)])
+AT_CHECK([diff -q payload.bin udp_data], [0])
 OVS_TRAFFIC_VSWITCHD_STOP
 AT_CLEANUP