All of the commands starting L7 servers duplicate detailed specifics
which inhibits readability, and makes it difficult to ensure that the
servers are ready before the test proceeds. Add a new macro that
provides simpler semantics from the test perspective and hide the
details in the macro. A followup patch will extend this macro to ensure
that servers are ready to serve requests before the test proceeds.

Signed-off-by: Joe Stringer <[email protected]>
---
 tests/system-common-macros.at |  11 ++++
 tests/system-ovn.at           |   6 +--
 tests/system-traffic.at       | 121 +++++++++++++++++++++++-------------------
 3 files changed, 79 insertions(+), 59 deletions(-)

diff --git a/tests/system-common-macros.at b/tests/system-common-macros.at
index d41de2366695..eb5478d38d1b 100644
--- a/tests/system-common-macros.at
+++ b/tests/system-common-macros.at
@@ -230,6 +230,17 @@ m4_define([NETNS_DAEMONIZE],
 m4_define([OVS_CHECK_FIREWALL],
     [AT_SKIP_IF([systemctl status firewalld 2>&1 | grep running > /dev/null])])
 
+# OVS_START_L7([namespace], [protocol])
+#
+# Start a server serving 'protocol' within 'namespace'. The server will exit
+# when the test finishes.
+#
+m4_define([OVS_START_L7],
+   [PIDFILE=$(mktemp $2XXX.log)
+    NETNS_DAEMONIZE([$1], [[$PYTHON $srcdir/test-l7.py $2]], [$PIDFILE])
+   ]
+)
+
 # OVS_CHECK_VXLAN()
 #
 # Do basic check for vxlan functionality, skip the test if it's not there.
diff --git a/tests/system-ovn.at b/tests/system-ovn.at
index 9e323424a2a1..7b35e84a43d2 100644
--- a/tests/system-ovn.at
+++ b/tests/system-ovn.at
@@ -581,9 +581,9 @@ ovn-nbctl set load_balancer $uuid 
vips:'"30.0.0.2:8000"'='"172.16.1.2:80,172.16.
 OVS_WAIT_UNTIL([ovs-ofctl -O OpenFlow13 dump-groups br-int | grep ct\(])
 
 # Start webservers in 'bar1', 'bar2' and 'bar3'.
-NETNS_DAEMONIZE([bar1], [[$PYTHON $srcdir/test-l7.py]], [http1.pid])
-NETNS_DAEMONIZE([bar2], [[$PYTHON $srcdir/test-l7.py]], [http2.pid])
-NETNS_DAEMONIZE([bar3], [[$PYTHON $srcdir/test-l7.py]], [http3.pid])
+OVS_START_L7([bar1], [http])
+OVS_START_L7([bar2], [http])
+OVS_START_L7([bar3], [http])
 
 dnl Should work with the virtual IP 30.0.0.1 address through NAT
 for i in `seq 1 20`; do
diff --git a/tests/system-traffic.at b/tests/system-traffic.at
index d70c5c3f0b87..67e06a11805b 100644
--- a/tests/system-traffic.at
+++ b/tests/system-traffic.at
@@ -37,7 +37,7 @@ NS_CHECK_EXEC([at_ns0], [ping -q -c 3 -i 0.3 -w 2 10.1.1.2 | 
FORMAT_PING], [0],
 3 packets transmitted, 3 received, 0% packet loss, time 0ms
 ])
 
-NETNS_DAEMONIZE([at_ns1], [[$PYTHON $srcdir/test-l7.py]], [http0.pid])
+OVS_START_L7([at_ns1], [http])
 NS_CHECK_EXEC([at_ns0], [wget 10.1.1.2 -t 3 -T 1 --retry-connrefused -v -o 
wget0.log])
 
 OVS_TRAFFIC_VSWITCHD_STOP
@@ -668,17 +668,17 @@ priority=100,in_port=2,ct_state=+trk+est,tcp,action=1
 
 AT_CHECK([ovs-ofctl --bundle add-flows br0 flows.txt])
 
+OVS_START_L7([at_ns0], [http])
+OVS_START_L7([at_ns1], [http])
+
 dnl HTTP requests from ns0->ns1 should work fine.
-NETNS_DAEMONIZE([at_ns1], [[$PYTHON $srcdir/test-l7.py]], [http0.pid])
 NS_CHECK_EXEC([at_ns0], [wget 10.1.1.2 -t 3 -T 1 --retry-connrefused -v -o 
wget0.log])
-
 AT_CHECK([ovs-appctl dpctl/dump-conntrack | FORMAT_CT(10.1.1.2)], [0], [dnl
 
tcp,orig=(src=10.1.1.1,dst=10.1.1.2,sport=<cleared>,dport=<cleared>),reply=(src=10.1.1.2,dst=10.1.1.1,sport=<cleared>,dport=<cleared>),protoinfo=(state=<cleared>)
 ])
 
 dnl HTTP requests from ns1->ns0 should fail due to network failure.
 dnl Try 3 times, in 1 second intervals.
-NETNS_DAEMONIZE([at_ns0], [[$PYTHON $srcdir/test-l7.py]], [http1.pid])
 NS_CHECK_EXEC([at_ns1], [wget 10.1.1.1 -t 3 -T 1 -v -o wget1.log], [4])
 
 OVS_TRAFFIC_VSWITCHD_STOP
@@ -709,18 +709,17 @@ dnl waiting, we get occasional failures due to the 
following error:
 dnl "connect: Cannot assign requested address"
 OVS_WAIT_UNTIL([ip netns exec at_ns0 ping6 -c 1 fc00::2])
 
-dnl HTTP requests from ns0->ns1 should work fine.
-NETNS_DAEMONIZE([at_ns1], [[$PYTHON $srcdir/test-l7.py http6]], [http0.pid])
+OVS_START_L7([at_ns0], [http6])
+OVS_START_L7([at_ns1], [http6])
 
+dnl HTTP requests from ns0->ns1 should work fine.
 NS_CHECK_EXEC([at_ns0], [wget http://[[fc00::2]] -t 3 -T 1 --retry-connrefused 
-v -o wget0.log])
-
 AT_CHECK([ovs-appctl dpctl/dump-conntrack | FORMAT_CT(fc00::2)], [0], [dnl
 
tcp,orig=(src=fc00::1,dst=fc00::2,sport=<cleared>,dport=<cleared>),reply=(src=fc00::2,dst=fc00::1,sport=<cleared>,dport=<cleared>),protoinfo=(state=<cleared>)
 ])
 
 dnl HTTP requests from ns1->ns0 should fail due to network failure.
 dnl Try 3 times, in 1 second intervals.
-NETNS_DAEMONIZE([at_ns0], [[$PYTHON $srcdir/test-l7.py http6]], [http1.pid])
 NS_CHECK_EXEC([at_ns1], [wget http://[[fc00::1]] -t 3 -T 1 -v -o wget1.log], 
[4])
 
 OVS_TRAFFIC_VSWITCHD_STOP
@@ -843,12 +842,13 @@ priority=100,in_port=4,tcp,ct_state=+trk,action=3
 
 AT_CHECK([ovs-ofctl --bundle add-flows br0 flows.txt])
 
+OVS_START_L7([at_ns1], [http])
+OVS_START_L7([at_ns3], [http])
+
 dnl HTTP requests from p0->p1 should work fine.
-NETNS_DAEMONIZE([at_ns1], [[$PYTHON $srcdir/test-l7.py]], [http0.pid])
 NS_CHECK_EXEC([at_ns0], [wget 10.1.1.2 -t 3 -T 1 --retry-connrefused -v -o 
wget0.log])
 
 dnl HTTP requests from p2->p3 should work fine.
-NETNS_DAEMONIZE([at_ns3], [[$PYTHON $srcdir/test-l7.py]], [http1.pid])
 NS_CHECK_EXEC([at_ns2], [wget 10.1.1.4 -t 3 -T 1 --retry-connrefused -v -o 
wget1.log])
 
 OVS_TRAFFIC_VSWITCHD_STOP
@@ -883,12 +883,13 @@ priority=100,in_port=4,tcp,ct_state=+trk,action=3
 
 AT_CHECK([ovs-ofctl --bundle add-flows br0 flows.txt])
 
+OVS_START_L7([at_ns1], [http])
+OVS_START_L7([at_ns3], [http])
+
 dnl HTTP requests from p0->p1 should work fine.
-NETNS_DAEMONIZE([at_ns1], [[$PYTHON $srcdir/test-l7.py]], [http0.pid])
 NS_CHECK_EXEC([at_ns0], [wget 10.1.1.2 -t 3 -T 1 --retry-connrefused -v -o 
wget0.log])
 
 dnl HTTP requests from p2->p3 should work fine.
-NETNS_DAEMONIZE([at_ns3], [[$PYTHON $srcdir/test-l7.py]], [http1.pid])
 NS_CHECK_EXEC([at_ns2], [wget 10.1.1.4 -t 3 -T 1 --retry-connrefused -v -o 
wget1.log])
 
 OVS_TRAFFIC_VSWITCHD_STOP
@@ -927,11 +928,11 @@ AT_CHECK([ovs-ofctl --bundle add-flows br0 flows.txt])
 dnl We set up our rules to allow the request without committing. The return
 dnl traffic can't be identified, because the initial request wasn't committed.
 dnl For the first pair of ports, this means that the connection fails.
-NETNS_DAEMONIZE([at_ns1], [[$PYTHON $srcdir/test-l7.py]], [http0.pid])
+OVS_START_L7([at_ns1], [http])
+OVS_START_L7([at_ns3], [http])
 NS_CHECK_EXEC([at_ns0], [wget 10.1.1.2 -t 3 -T 1 --retry-connrefused -v -o 
wget0.log], [4])
 
 dnl For the second pair, we allow packets from invalid connections, so it 
works.
-NETNS_DAEMONIZE([at_ns3], [[$PYTHON $srcdir/test-l7.py]], [http1.pid])
 NS_CHECK_EXEC([at_ns2], [wget 10.1.1.4 -t 3 -T 1 --retry-connrefused -v -o 
wget1.log])
 
 OVS_TRAFFIC_VSWITCHD_STOP
@@ -964,8 +965,10 @@ priority=100,in_port=4,ct_state=+trk,ct_zone=1,tcp,action=3
 
 AT_CHECK([ovs-ofctl --bundle add-flows br0 flows.txt])
 
+OVS_START_L7([at_ns1], [http])
+OVS_START_L7([at_ns3], [http])
+
 dnl HTTP requests from p0->p1 should work fine.
-NETNS_DAEMONIZE([at_ns1], [[$PYTHON $srcdir/test-l7.py]], [http0.pid])
 NS_CHECK_EXEC([at_ns0], [wget 10.1.1.2 -t 3 -T 1 --retry-connrefused -v -o 
wget0.log])
 
 AT_CHECK([ovs-appctl dpctl/dump-conntrack | FORMAT_CT(10.1.1.2)], [0], [dnl
@@ -974,7 +977,6 @@ 
tcp,orig=(src=10.1.1.1,dst=10.1.1.2,sport=<cleared>,dport=<cleared>),reply=(src=
 
 dnl HTTP requests from p2->p3 should fail due to network failure.
 dnl Try 3 times, in 1 second intervals.
-NETNS_DAEMONIZE([at_ns3], [[$PYTHON $srcdir/test-l7.py]], [http1.pid])
 NS_CHECK_EXEC([at_ns2], [wget 10.1.1.4 -t 3 -T 1 -v -o wget1.log], [4])
 
 AT_CHECK([ovs-appctl dpctl/dump-conntrack | FORMAT_CT(10.1.1.4)], [0], [dnl
@@ -1010,8 +1012,10 @@ 
priority=100,in_port=4,ct_state=+trk,ct_zone=0x1001,tcp,action=3
 
 AT_CHECK([ovs-ofctl --bundle add-flows br0 flows.txt])
 
+OVS_START_L7([at_ns1], [http])
+OVS_START_L7([at_ns3], [http])
+
 dnl HTTP requests from p0->p1 should work fine.
-NETNS_DAEMONIZE([at_ns1], [[$PYTHON $srcdir/test-l7.py]], [http0.pid])
 NS_CHECK_EXEC([at_ns0], [wget 10.1.1.2 -t 3 -T 1 --retry-connrefused -v -o 
wget0.log])
 
 AT_CHECK([ovs-appctl dpctl/dump-conntrack | FORMAT_CT(10.1.1.2)], [0], [dnl
@@ -1020,7 +1024,6 @@ 
tcp,orig=(src=10.1.1.1,dst=10.1.1.2,sport=<cleared>,dport=<cleared>),reply=(src=
 
 dnl HTTP requests from p2->p3 should fail due to network failure.
 dnl Try 3 times, in 1 second intervals.
-NETNS_DAEMONIZE([at_ns3], [[$PYTHON $srcdir/test-l7.py]], [http1.pid])
 NS_CHECK_EXEC([at_ns2], [wget 10.1.1.4 -t 3 -T 1 -v -o wget1.log], [4])
 
 AT_CHECK([ovs-appctl dpctl/dump-conntrack | FORMAT_CT(10.1.1.4)], [0], [dnl
@@ -1068,7 +1071,7 @@ AT_CHECK([ovs-ofctl --bundle add-flows br0 flows-br0.txt])
 AT_CHECK([ovs-ofctl --bundle add-flows br1 flows-br1.txt])
 
 dnl HTTP requests from p0->p1 should work fine.
-NETNS_DAEMONIZE([at_ns1], [[$PYTHON $srcdir/test-l7.py]], [http0.pid])
+OVS_START_L7([at_ns1], [http])
 NS_CHECK_EXEC([at_ns0], [wget 10.1.1.2 -t 3 -T 1 --retry-connrefused -v -o 
wget0.log])
 
 OVS_TRAFFIC_VSWITCHD_STOP
@@ -1095,8 +1098,9 @@ 
priority=100,in_port=2,ct_state=+trk,ct_zone=2,tcp,action=1
 
 AT_CHECK([ovs-ofctl --bundle add-flows br0 flows.txt])
 
+OVS_START_L7([at_ns1], [http])
+
 dnl HTTP requests from p0->p1 should work fine.
-NETNS_DAEMONIZE([at_ns1], [[$PYTHON $srcdir/test-l7.py]], [http0.pid])
 NS_CHECK_EXEC([at_ns0], [wget 10.1.1.2 -t 3 -T 1 --retry-connrefused -v -o 
wget0.log])
 
 dnl (again) HTTP requests from p0->p1 should work fine.
@@ -1141,8 +1145,9 @@ AT_CHECK([ping -q -c 3 -i 0.3 -w 2 10.1.1.2 | 
FORMAT_PING], [0], [dnl
 3 packets transmitted, 3 received, 0% packet loss, time 0ms
 ])
 
+OVS_START_L7([at_ns0], [http])
+
 dnl HTTP requests from root namespace to p0 should work fine.
-NETNS_DAEMONIZE([at_ns0], [[$PYTHON $srcdir/test-l7.py]], [http0.pid])
 AT_CHECK([wget 10.1.1.2 -t 3 -T 1 --retry-connrefused -v -o wget0.log])
 
 dnl (again) HTTP requests from root namespace to  p0 should work fine.
@@ -1183,8 +1188,9 @@ 
priority=100,in_port=2,ct_state=+trk,ct_zone=1,tcp,action=1
 
 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
 
+OVS_START_L7([at_ns1], [http])
+
 dnl HTTP requests from p0->p1 should work fine.
-NETNS_DAEMONIZE([at_ns1], [[$PYTHON $srcdir/test-l7.py]], [http0.pid])
 NS_CHECK_EXEC([at_ns0], [wget 10.1.1.2 -t 3 -T 1 --retry-connrefused -v -o 
wget0.log])
 
 dnl (again) HTTP requests from p0->p1 should work fine.
@@ -1252,8 +1258,9 @@ AT_CHECK([ping -q -c 3 -i 0.3 -w 2 10.1.1.2 | 
FORMAT_PING], [0], [dnl
 3 packets transmitted, 3 received, 0% packet loss, time 0ms
 ])
 
+OVS_START_L7([at_ns0], [http])
+
 dnl HTTP requests from root namespace to p0 should work fine.
-NETNS_DAEMONIZE([at_ns0], [[$PYTHON $srcdir/test-l7.py]], [http0.pid])
 AT_CHECK([wget 10.1.1.2 -t 3 -T 1 --retry-connrefused -v -o wget0.log])
 
 dnl (again) HTTP requests from root namespace to p0 should work fine.
@@ -1296,19 +1303,18 @@ 
priority=100,in_port=4,ct_state=+trk,ct_mark=1,tcp,action=3
 
 AT_CHECK([ovs-ofctl --bundle add-flows br0 flows.txt])
 
+OVS_START_L7([at_ns1], [http])
+OVS_START_L7([at_ns3], [http])
+
 dnl HTTP requests from p0->p1 should work fine.
-NETNS_DAEMONIZE([at_ns1], [[$PYTHON $srcdir/test-l7.py]], [http0.pid])
 NS_CHECK_EXEC([at_ns0], [wget 10.1.1.2 -t 3 -T 1 --retry-connrefused -v -o 
wget0.log])
-
 AT_CHECK([ovs-appctl dpctl/dump-conntrack | FORMAT_CT(10.1.1.2)], [0], [dnl
 
tcp,orig=(src=10.1.1.1,dst=10.1.1.2,sport=<cleared>,dport=<cleared>),reply=(src=10.1.1.2,dst=10.1.1.1,sport=<cleared>,dport=<cleared>),mark=1,protoinfo=(state=<cleared>)
 ])
 
 dnl HTTP requests from p2->p3 should fail due to network failure.
 dnl Try 3 times, in 1 second intervals.
-NETNS_DAEMONIZE([at_ns3], [[$PYTHON $srcdir/test-l7.py]], [http1.pid])
 NS_CHECK_EXEC([at_ns2], [wget 10.1.1.4 -t 3 -T 1 -v -o wget1.log], [4])
-
 AT_CHECK([ovs-appctl dpctl/dump-conntrack | FORMAT_CT(10.1.1.4)], [0], [dnl
 
tcp,orig=(src=10.1.1.3,dst=10.1.1.4,sport=<cleared>,dport=<cleared>),reply=(src=10.1.1.4,dst=10.1.1.3,sport=<cleared>,dport=<cleared>),mark=2,protoinfo=(state=<cleared>)
 ])
@@ -1340,8 +1346,9 @@ table=1,in_port=2,ct_state=+trk,ct_mark=3,tcp,action=1
 
 AT_CHECK([ovs-ofctl --bundle add-flows br0 flows.txt])
 
+OVS_START_L7([at_ns1], [http])
+
 dnl HTTP requests from p0->p1 should work fine.
-NETNS_DAEMONIZE([at_ns1], [[$PYTHON $srcdir/test-l7.py]], [http0.pid])
 NS_CHECK_EXEC([at_ns0], [wget 10.1.1.2 -t 3 -T 1 --retry-connrefused -v -o 
wget0.log])
 
 AT_CHECK([ovs-appctl dpctl/dump-conntrack | FORMAT_CT(10.1.1.2)], [0], [dnl
@@ -1377,19 +1384,18 @@ 
priority=100,in_port=4,ct_state=+trk,ct_mark=1,tcp,action=3
 
 AT_CHECK([ovs-ofctl --bundle add-flows br0 flows.txt])
 
+OVS_START_L7([at_ns1], [http])
+OVS_START_L7([at_ns3], [http])
+
 dnl HTTP requests from p0->p1 should work fine.
-NETNS_DAEMONIZE([at_ns1], [[$PYTHON $srcdir/test-l7.py]], [http0.pid])
 NS_CHECK_EXEC([at_ns0], [wget 10.1.1.2 -t 3 -T 1 --retry-connrefused -v -o 
wget0.log])
-
 AT_CHECK([ovs-appctl dpctl/dump-conntrack | FORMAT_CT(10.1.1.2)], [0], [dnl
 
tcp,orig=(src=10.1.1.1,dst=10.1.1.2,sport=<cleared>,dport=<cleared>),reply=(src=10.1.1.2,dst=10.1.1.1,sport=<cleared>,dport=<cleared>),mark=1,protoinfo=(state=<cleared>)
 ])
 
 dnl HTTP requests from p2->p3 should fail due to network failure.
 dnl Try 3 times, in 1 second intervals.
-NETNS_DAEMONIZE([at_ns3], [[$PYTHON $srcdir/test-l7.py]], [http1.pid])
 NS_CHECK_EXEC([at_ns2], [wget 10.1.1.4 -t 3 -T 1 -v -o wget1.log], [4])
-
 AT_CHECK([ovs-appctl dpctl/dump-conntrack | FORMAT_CT(10.1.1.4)], [0], [dnl
 
tcp,orig=(src=10.1.1.3,dst=10.1.1.4,sport=<cleared>,dport=<cleared>),reply=(src=10.1.1.4,dst=10.1.1.3,sport=<cleared>,dport=<cleared>),mark=2,protoinfo=(state=<cleared>)
 ])
@@ -1424,13 +1430,14 @@ 
priority=100,in_port=4,ct_state=+trk,ct_label=0x0a000d000005000001,tcp,action=3
 
 AT_CHECK([ovs-ofctl --bundle add-flows br0 flows.txt])
 
+OVS_START_L7([at_ns1], [http])
+OVS_START_L7([at_ns3], [http])
+
 dnl HTTP requests from p0->p1 should work fine.
-NETNS_DAEMONIZE([at_ns1], [[$PYTHON $srcdir/test-l7.py]], [http0.pid])
 NS_CHECK_EXEC([at_ns0], [wget 10.1.1.2 -t 3 -T 1 --retry-connrefused -v -o 
wget0.log])
 
 dnl HTTP requests from p2->p3 should fail due to network failure.
 dnl Try 3 times, in 1 second intervals.
-NETNS_DAEMONIZE([at_ns3], [[$PYTHON $srcdir/test-l7.py]], [http1.pid])
 NS_CHECK_EXEC([at_ns2], [wget 10.1.1.4 -t 3 -T 1 -v -o wget1.log], [4])
 
 OVS_TRAFFIC_VSWITCHD_STOP
@@ -1460,8 +1467,9 @@ 
table=1,in_port=2,ct_state=+trk,ct_label=0x200000001,tcp,action=1
 
 AT_CHECK([ovs-ofctl --bundle add-flows br0 flows.txt])
 
+OVS_START_L7([at_ns1], [http])
+
 dnl HTTP requests from p0->p1 should work fine.
-NETNS_DAEMONIZE([at_ns1], [[$PYTHON $srcdir/test-l7.py]], [http0.pid])
 NS_CHECK_EXEC([at_ns0], [wget 10.1.1.2 -t 3 -T 1 --retry-connrefused -v -o 
wget0.log])
 
 AT_CHECK([ovs-appctl dpctl/dump-conntrack | FORMAT_CT(10.1.1.2)], [0], [dnl
@@ -1497,8 +1505,9 @@ table=1,in_port=2,tcp,action=ct(zone=2),1
 
 AT_CHECK([ovs-ofctl --bundle add-flows br0 flows.txt])
 
+OVS_START_L7([at_ns1], [http])
+
 dnl HTTP requests from p0->p1 should work fine.
-NETNS_DAEMONIZE([at_ns1], [[$PYTHON $srcdir/test-l7.py]], [http0.pid])
 NS_CHECK_EXEC([at_ns0], [wget 10.1.1.2 -t 3 -T 1 --retry-connrefused -v -o 
wget0.log])
 
 AT_CHECK([ovs-appctl dpctl/dump-conntrack | FORMAT_CT(10.1.1.2)], [0], [dnl
@@ -1631,8 +1640,8 @@ table=1,in_port=2,tcp,ct_state=+trk-new+rel,action=1
 
 AT_CHECK([ovs-ofctl --bundle replace-flows br0 flows1.txt])
 
-NETNS_DAEMONIZE([at_ns0], [[$PYTHON $srcdir/test-l7.py ftp]], [ftp1.pid])
-NETNS_DAEMONIZE([at_ns1], [[$PYTHON $srcdir/test-l7.py ftp]], [ftp0.pid])
+OVS_START_L7([at_ns0], [ftp])
+OVS_START_L7([at_ns1], [ftp])
 OVS_WAIT_UNTIL([ip netns exec at_ns1 netstat -l | grep ftp])
 
 dnl FTP requests from p1->p0 should fail due to network failure.
@@ -1717,7 +1726,7 @@ dnl waiting, we get occasional failures due to the 
following error:
 dnl "connect: Cannot assign requested address"
 OVS_WAIT_UNTIL([ip netns exec at_ns0 ping6 -c 1 fc00::2 >/dev/null])
 
-NETNS_DAEMONIZE([at_ns1], [[$PYTHON $srcdir/test-l7.py ftp]], [ftp0.pid])
+OVS_START_L7([at_ns1], [ftp])
 OVS_WAIT_UNTIL([ip netns exec at_ns1 netstat -l | grep ftp])
 
 dnl FTP requests from p0->p1 should work fine.
@@ -1767,8 +1776,8 @@ table=2,in_port=2,tcp,ct_zone=1,ct_state=+trk+est,action=1
 
 AT_CHECK([ovs-ofctl --bundle add-flows br0 flows.txt])
 
-NETNS_DAEMONIZE([at_ns0], [[$PYTHON $srcdir/test-l7.py ftp]], [ftp1.pid])
-NETNS_DAEMONIZE([at_ns1], [[$PYTHON $srcdir/test-l7.py ftp]], [ftp0.pid])
+OVS_START_L7([at_ns0], [ftp])
+OVS_START_L7([at_ns1], [ftp])
 
 dnl FTP requests from p1->p0 should fail due to network failure.
 dnl Try 3 times, in 1 second intervals.
@@ -2212,7 +2221,7 @@ table=10 priority=0 action=drop
 AT_CHECK([ovs-ofctl --bundle add-flows br0 flows.txt])
 
 dnl HTTP requests from p0->p1 should work fine.
-NETNS_DAEMONIZE([at_ns1], [[$PYTHON $srcdir/test-l7.py]], [http0.pid])
+OVS_START_L7([at_ns1], [http])
 NS_CHECK_EXEC([at_ns0], [wget 10.1.1.2 -t 5 -T 1 --retry-connrefused -v -o 
wget0.log])
 
 AT_CHECK([ovs-appctl dpctl/dump-conntrack | FORMAT_CT(10.1.1.2) | sed -e 
's/dst=10.1.1.2[[45]][[0-9]]/dst=10.1.1.2XX/'], [0], [dnl
@@ -2260,7 +2269,7 @@ table=10 priority=0 action=drop
 AT_CHECK([ovs-ofctl --bundle add-flows br0 flows.txt])
 
 dnl HTTP requests from p0->p1 should work fine.
-NETNS_DAEMONIZE([at_ns1], [[$PYTHON $srcdir/test-l7.py]], [http0.pid])
+OVS_START_L7([at_ns1], [http])
 NS_CHECK_EXEC([at_ns0], [wget 10.1.1.2 -t 5 -T 1 --retry-connrefused -v -o 
wget0.log])
 
 AT_CHECK([ovs-appctl dpctl/dump-conntrack | FORMAT_CT(10.1.1.2) | sed -e 
's/dst=10.1.1.2[[45]][[0-9]]/dst=10.1.1.2XX/'], [0], [dnl
@@ -2313,7 +2322,7 @@ table=10 priority=0 action=drop
 AT_CHECK([ovs-ofctl --bundle add-flows br0 flows.txt])
 
 dnl HTTP requests from p0->p1 should work fine.
-NETNS_DAEMONIZE([at_ns1], [[$PYTHON $srcdir/test-l7.py]], [http0.pid])
+OVS_START_L7([at_ns1], [http])
 NS_CHECK_EXEC([at_ns0], [wget 10.1.1.2 -t 5 -T 1 --retry-connrefused -v -o 
wget0.log])
 
 AT_CHECK([ovs-appctl dpctl/dump-conntrack | FORMAT_CT(10.1.1.2) | sed -e 
's/dst=10.1.1.2[[45]][[0-9]]/dst=10.1.1.2XX/'], [0], [dnl
@@ -2361,7 +2370,7 @@ table=10 priority=0 action=drop
 AT_CHECK([ovs-ofctl --bundle add-flows br0 flows.txt])
 
 dnl Should work with the virtual IP address through NAT
-NETNS_DAEMONIZE([at_ns1], [[$PYTHON $srcdir/test-l7.py]], [http0.pid])
+OVS_START_L7([at_ns1], [http])
 NS_CHECK_EXEC([at_ns0], [wget 10.1.1.64 -t 5 -T 1 --retry-connrefused -v -o 
wget0.log])
 
 AT_CHECK([ovs-appctl dpctl/dump-conntrack | FORMAT_CT(10.1.1.64)], [0], [dnl
@@ -2422,7 +2431,7 @@ table=10 priority=0 action=drop
 AT_CHECK([ovs-ofctl --bundle add-flows br0 flows.txt])
 
 dnl Should work with the virtual IP address through NAT
-NETNS_DAEMONIZE([at_ns1], [[$PYTHON $srcdir/test-l7.py]], [http0.pid])
+OVS_START_L7([at_ns1], [http])
 NS_CHECK_EXEC([at_ns0], [wget 10.1.1.64 -t 5 -T 1 --retry-connrefused -v -o 
wget0.log])
 
 AT_CHECK([ovs-appctl dpctl/dump-conntrack | FORMAT_CT(10.1.1.64)], [0], [dnl
@@ -2524,7 +2533,7 @@ m4_define([CHECK_FTP_NAT],
 
     AT_CHECK([ovs-ofctl --bundle add-flows br0 flows.txt])
 
-    NETNS_DAEMONIZE([at_ns1], [[$PYTHON $srcdir/test-l7.py ftp]], [ftp0.pid])
+    OVS_START_L7([at_ns1], [ftp])
     OVS_WAIT_UNTIL([ip netns exec at_ns1 netstat -l | grep ftp])
 
     dnl FTP requests from p0->p1 should work fine.
@@ -2705,13 +2714,13 @@ dnl "connect: Cannot assign requested address"
 OVS_WAIT_UNTIL([ip netns exec at_ns0 ping6 -c 1 fc00::2])
 
 dnl HTTP requests from ns0->ns1 should work fine.
-NETNS_DAEMONIZE([at_ns1], [[$PYTHON $srcdir/test-l7.py http6]], [http0.pid])
+OVS_START_L7([at_ns1], [http6])
 
 NS_CHECK_EXEC([at_ns0], [wget http://[[fc00::2]] -t 3 -T 1 --retry-connrefused 
-v -o wget0.log])
 
 dnl HTTP requests from ns1->ns0 should fail due to network failure.
 dnl Try 3 times, in 1 second intervals.
-NETNS_DAEMONIZE([at_ns0], [[$PYTHON $srcdir/test-l7.py http6]], [http1.pid])
+OVS_START_L7([at_ns0], [http6])
 NS_CHECK_EXEC([at_ns1], [wget http://[[fc00::1]] -t 3 -T 1 -v -o wget1.log], 
[4])
 
 OVS_TRAFFIC_VSWITCHD_STOP
@@ -2762,7 +2771,7 @@ dnl waiting, we get occasional failures due to the 
following error:
 dnl "connect: Cannot assign requested address"
 OVS_WAIT_UNTIL([ip netns exec at_ns0 ping6 -c 1 fc00::2 >/dev/null])
 
-NETNS_DAEMONIZE([at_ns1], [[$PYTHON $srcdir/test-l7.py ftp]], [ftp0.pid])
+OVS_START_L7([at_ns1], [ftp])
 OVS_WAIT_UNTIL([ip netns exec at_ns1 netstat -l | grep ftp])
 
 dnl FTP requests from p0->p1 should work fine.
@@ -2834,9 +2843,9 @@ table=10 priority=0 action=controller
 AT_CHECK([ovs-ofctl --bundle add-flows br0 flows.txt])
 
 dnl Start web servers
-NETNS_DAEMONIZE([at_ns2], [[$PYTHON $srcdir/test-l7.py]], [http2.pid])
-NETNS_DAEMONIZE([at_ns3], [[$PYTHON $srcdir/test-l7.py]], [http3.pid])
-NETNS_DAEMONIZE([at_ns4], [[$PYTHON $srcdir/test-l7.py]], [http4.pid])
+OVS_START_L7([at_ns2], [http])
+OVS_START_L7([at_ns3], [http])
+OVS_START_L7([at_ns4], [http])
 
 on_exit 'ovs-ofctl -O OpenFlow15 dump-flows br0'
 on_exit 'ovs-appctl revalidator/purge'
@@ -2925,9 +2934,9 @@ table=10 priority=0 action=controller
 AT_CHECK([ovs-ofctl --bundle add-flows br0 flows.txt])
 
 dnl Start web servers
-NETNS_DAEMONIZE([at_ns2], [[$PYTHON $srcdir/test-l7.py]], [http2.pid])
-NETNS_DAEMONIZE([at_ns3], [[$PYTHON $srcdir/test-l7.py]], [http3.pid])
-NETNS_DAEMONIZE([at_ns4], [[$PYTHON $srcdir/test-l7.py]], [http4.pid])
+OVS_START_L7([at_ns2], [http])
+OVS_START_L7([at_ns3], [http])
+OVS_START_L7([at_ns4], [http])
 
 on_exit 'ovs-ofctl -O OpenFlow15 dump-flows br0'
 on_exit 'ovs-appctl revalidator/purge'
-- 
2.10.2

_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to