]> git.proxmox.com Git - mirror_ovs.git/blame - tests/system-userspace-macros.at
Eliminate "whitelist" and "blacklist" terms.
[mirror_ovs.git] / tests / system-userspace-macros.at
CommitLineData
7ca476af 1# _ADD_BR([name])
d7c5426b
DDP
2#
3# Expands into the proper ovs-vsctl commands to create a bridge with the
cf7659b6
JR
4# appropriate type and properties
5m4_define([_ADD_BR], [[add-br $1 -- set Bridge $1 datapath_type="netdev" protocols=OpenFlow10,OpenFlow11,OpenFlow12,OpenFlow13,OpenFlow14,OpenFlow15 fail-mode=secure ]])
d7c5426b
DDP
6
7# OVS_TRAFFIC_VSWITCHD_START([vsctl-args], [vsctl-output], [=override])
8#
9# Creates a database and starts ovsdb-server, starts ovs-vswitchd
10# connected to that database, calls ovs-vsctl to create a bridge named
11# br0 with predictable settings, passing 'vsctl-args' as additional
12# commands to ovs-vsctl. If 'vsctl-args' causes ovs-vsctl to provide
13# output (e.g. because it includes "create" commands) then 'vsctl-output'
c724bd67 14# specifies the expected output after filtering through uuidfilt.
d7c5426b
DDP
15m4_define([OVS_TRAFFIC_VSWITCHD_START],
16 [
b9e04f84 17 OVS_WAIT_WHILE([ip link show ovs-netdev])
d7c5426b
DDP
18 _OVS_VSWITCHD_START([--disable-system])
19 dnl Add bridges, ports, etc.
b9e04f84 20 OVS_WAIT_WHILE([ip link show br0])
c724bd67 21 AT_CHECK([ovs-vsctl -- _ADD_BR([br0]) -- $1 m4_if([$2], [], [], [| uuidfilt])], [0], [$2])
d7c5426b
DDP
22])
23
8205fbc8 24# OVS_TRAFFIC_VSWITCHD_STOP([ALLOWLIST], [extra_cmds])
d7c5426b
DDP
25#
26# Gracefully stops ovs-vswitchd and ovsdb-server, checking their log files
27# for messages with severity WARN or higher and signaling an error if any
8205fbc8 28# is present. The optional ALLOWLIST may contain shell-quoted "sed"
d7c5426b
DDP
29# commands to delete any warnings that are actually expected, e.g.:
30#
31# OVS_TRAFFIC_VSWITCHD_STOP(["/expected error/d"])
32#
8205fbc8 33# 'extra_cmds' are shell commands to be executed after OVS_VSWITCHD_STOP() is
d7c5426b
DDP
34# invoked. They can be used to perform additional cleanups such as name space
35# removal.
36m4_define([OVS_TRAFFIC_VSWITCHD_STOP],
5390d185 37 [OVS_VSWITCHD_STOP([dnl
afa0dfc6 38$1";/netdev_linux.*obtaining netdev stats via vport failed/d
03ccfe48
WT
39/dpif_netlink.*Generic Netlink family 'ovs_datapath' does not exist. The Open vSwitch kernel module is probably not loaded./d
40/dpif_netdev(revalidator.*)|ERR|internal error parsing flow key.*proto=2.*/d
41/dpif(revalidator.*)|WARN|netdev@ovs-netdev: failed to.*proto=2.*/d"])
d7c5426b
DDP
42 AT_CHECK([:; $2])
43 ])
07659514 44
ddcf96d2
DDP
45# CONFIGURE_VETH_OFFLOADS([VETH])
46#
47# Disable TX offloads for veths. The userspace datapath uses the AF_PACKET
48# socket to receive packets for veths. Unfortunately, the AF_PACKET socket
49# doesn't play well with offloads:
50# 1. GSO packets are received without segmentation and therefore discarded.
51# 2. Packets with offloaded partial checksum are received with the wrong
52# checksum, therefore discarded by the receiver.
53#
54# By disabling tx offloads in the non-OVS side of the veth peer we make sure
55# that the AF_PACKET socket will not receive bad packets.
56#
57# This is a workaround, and should be removed when offloads are properly
58# supported in netdev-linux.
59m4_define([CONFIGURE_VETH_OFFLOADS],
941d80b4 60 [AT_CHECK([ethtool -K $1 tx off], [0], [ignore], [ignore])]
ddcf96d2
DDP
61)
62
07659514
JS
63# CHECK_CONNTRACK()
64#
4573c42e 65# Perform requirements checks for running conntrack tests.
07659514 66#
1ca0323e 67m4_define([CHECK_CONNTRACK], [])
4573c42e
DDP
68
69# CHECK_CONNTRACK_ALG()
70#
71# Perform requirements checks for running conntrack ALG tests. The userspace
a8031633 72# supports FTP and TFTP.
4573c42e 73#
a8031633 74m4_define([CHECK_CONNTRACK_ALG])
4573c42e 75
4573c42e
DDP
76# CHECK_CONNTRACK_LOCAL_STACK()
77#
78# Perform requirements checks for running conntrack tests with local stack.
79# While the kernel connection tracker automatically passes all the connection
80# tracking state from an internal port to the OpenvSwitch kernel module, there
81# is simply no way of doing that with the userspace, so skip the tests.
82m4_define([CHECK_CONNTRACK_LOCAL_STACK],
83[
84 AT_SKIP_IF([:])
85])
86
b21ac618
DB
87# CHECK_CONNTRACK_FRAG_OVERLAP()
88#
4ea96698
DB
89# The userspace datapath supports fragment overlap check.
90m4_define([CHECK_CONNTRACK_FRAG_OVERLAP])
b21ac618 91
4573c42e
DDP
92# CHECK_CONNTRACK_NAT()
93#
94# Perform requirements checks for running conntrack NAT tests. The userspace
ae49b064 95# datapath supports NAT.
4573c42e 96#
ae49b064 97m4_define([CHECK_CONNTRACK_NAT])
c43a1331 98
187bb41f
YHW
99# CHECK_CONNTRACK_TIMEOUT()
100#
101# Perform requirements checks for running conntrack customized timeout tests.
187bb41f 102#
2078901a 103m4_define([CHECK_CONNTRACK_TIMEOUT])
187bb41f 104
26509f88
DB
105# CHECK_CT_DPIF_SET_GET_MAXCONNS()
106#
107# Perform requirements checks for running ovs-dpctl ct-set-maxconns or
108# ovs-dpctl ct-get-maxconns. The userspace datapath does support this feature.
109m4_define([CHECK_CT_DPIF_SET_GET_MAXCONNS])
110
111# CHECK_CT_DPIF_GET_NCONNS()
112#
113# Perform requirements checks for running ovs-dpctl ct-get-nconns. The
114# userspace datapath does support this feature.
115m4_define([CHECK_CT_DPIF_GET_NCONNS])
d1224d28 116
4ea96698
DB
117# DPCTL_SET_MIN_FRAG_SIZE()
118#
119# The userspace datapath supports this command.
120m4_define([DPCTL_SET_MIN_FRAG_SIZE],
121[
122AT_CHECK([ovs-appctl dpctl/ipf-set-min-frag v4 400], [], [dnl
123setting minimum fragment size successful
124])
125AT_CHECK([ovs-appctl dpctl/ipf-set-min-frag v6 400], [], [dnl
126setting minimum fragment size successful
127])
128])
129
130# DPCTL_MODIFY_FRAGMENTATION()
131#
132# The userspace datapath supports this command.
133m4_define([DPCTL_MODIFY_FRAGMENTATION],
134[
135AT_CHECK([ovs-appctl dpctl/ipf-set-min-frag v4 1000], [], [dnl
136setting minimum fragment size successful
137])
138AT_CHECK([ovs-appctl dpctl/ipf-set-max-nfrags 500], [], [dnl
139setting maximum fragments successful
140])
141AT_CHECK([ovs-appctl dpctl/ipf-get-status], [], [dnl
142 Fragmentation Module Status
143 ---------------------------
144 v4 enabled: 1
145 v6 enabled: 1
146 max num frags (v4/v6): 500
147 num frag: 0
148 min v4 frag size: 1000
149 v4 frags accepted: 0
150 v4 frags completed: 0
151 v4 frags expired: 0
152 v4 frags too small: 0
153 v4 frags overlapped: 0
154 v4 frags purged: 0
155 min v6 frag size: 1280
156 v6 frags accepted: 0
157 v6 frags completed: 0
158 v6 frags expired: 0
159 v6 frags too small: 0
160 v6 frags overlapped: 0
161 v6 frags purged: 0
162])
163])
164
165# DPCTL_CHECK_FRAGMENTATION_PASS()
166#
167# Used to check fragmentation counters for some fragmentation tests using
168# the userspace datapath.
169m4_define([DPCTL_CHECK_FRAGMENTATION_PASS],
170[
171AT_CHECK([ovs-appctl dpctl/ipf-get-status --more], [], [dnl
172 Fragmentation Module Status
173 ---------------------------
174 v4 enabled: 1
175 v6 enabled: 1
176 max num frags (v4/v6): 500
177 num frag: 0
178 min v4 frag size: 1000
179 v4 frags accepted: 30
180 v4 frags completed: 30
181 v4 frags expired: 0
182 v4 frags too small: 0
183 v4 frags overlapped: 0
184 v4 frags purged: 0
185 min v6 frag size: 1280
186 v6 frags accepted: 0
187 v6 frags completed: 0
188 v6 frags expired: 0
189 v6 frags too small: 0
190 v6 frags overlapped: 0
191 v6 frags purged: 0
192
193 Fragment Lists:
194
195])
196])
197
198# DPCTL_CHECK_V6_FRAGMENTATION_PASS()
199#
200# Used to check fragmentation counters for some fragmentation tests using
201# the userspace datapath.
202m4_define([DPCTL_CHECK_V6_FRAGMENTATION_PASS],
203[
204AT_CHECK([ovs-appctl dpctl/ipf-get-status --more], [], [dnl
205 Fragmentation Module Status
206 ---------------------------
207 v4 enabled: 1
208 v6 enabled: 1
209 max num frags (v4/v6): 1000
210 num frag: 0
211 min v4 frag size: 1200
212 v4 frags accepted: 0
213 v4 frags completed: 0
214 v4 frags expired: 0
215 v4 frags too small: 0
216 v4 frags overlapped: 0
217 v4 frags purged: 0
218 min v6 frag size: 1280
219 v6 frags accepted: 30
220 v6 frags completed: 30
221 v6 frags expired: 0
222 v6 frags too small: 0
223 v6 frags overlapped: 0
224 v6 frags purged: 0
225
226 Fragment Lists:
227
228])
229])
230
231# FORMAT_FRAG_LIST([])
232#
233# Strip content from the piped input which can differ from test to test; recirc_id
234# and ip_id fields in an ipf_list vary from test to test and hence are cleared.
235m4_define([FORMAT_FRAG_LIST],
236 [[sed -e 's/ip_id=[0-9]*/ip_id=<cleared>/g' -e 's/recirc_id=[0-9]*/recirc_id=<cleared>/g']])
237
238# DPCTL_CHECK_FRAGMENTATION_FAIL()
239#
240# Used to check fragmentation counters for some fragmentation tests using
241# the userspace datapath, when failure to transmit fragments is expected.
242m4_define([DPCTL_CHECK_FRAGMENTATION_FAIL],
243[
244AT_CHECK([ovs-appctl dpctl/ipf-get-status -m | FORMAT_FRAG_LIST()], [], [dnl
245 Fragmentation Module Status
246 ---------------------------
247 v4 enabled: 1
248 v6 enabled: 1
249 max num frags (v4/v6): 500
250 num frag: 7
251 min v4 frag size: 1000
252 v4 frags accepted: 7
253 v4 frags completed: 0
254 v4 frags expired: 0
255 v4 frags too small: 0
256 v4 frags overlapped: 0
257 v4 frags purged: 0
258 min v6 frag size: 1280
259 v6 frags accepted: 0
260 v6 frags completed: 0
261 v6 frags expired: 0
262 v6 frags too small: 0
263 v6 frags overlapped: 0
264 v6 frags purged: 0
265
266 Fragment Lists:
267
268(src=10.1.1.1,dst=10.1.1.2,recirc_id=<cleared>,ip_id=<cleared>,dl_type=0x800,zone=9,nw_proto=1,num_fragments=1,state=first frag)
269(src=10.1.1.1,dst=10.1.1.2,recirc_id=<cleared>,ip_id=<cleared>,dl_type=0x800,zone=9,nw_proto=1,num_fragments=1,state=first frag)
270(src=10.1.1.1,dst=10.1.1.2,recirc_id=<cleared>,ip_id=<cleared>,dl_type=0x800,zone=9,nw_proto=1,num_fragments=1,state=first frag)
271(src=10.1.1.1,dst=10.1.1.2,recirc_id=<cleared>,ip_id=<cleared>,dl_type=0x800,zone=9,nw_proto=1,num_fragments=1,state=first frag)
272(src=10.1.1.1,dst=10.1.1.2,recirc_id=<cleared>,ip_id=<cleared>,dl_type=0x800,zone=9,nw_proto=1,num_fragments=1,state=first frag)
273(src=10.1.1.1,dst=10.1.1.2,recirc_id=<cleared>,ip_id=<cleared>,dl_type=0x800,zone=9,nw_proto=1,num_fragments=1,state=first frag)
274(src=10.1.1.1,dst=10.1.1.2,recirc_id=<cleared>,ip_id=<cleared>,dl_type=0x800,zone=9,nw_proto=1,num_fragments=1,state=first frag)
275])
276])
277
e06c44a8 278# OVS_CHECK_MIN_KERNEL([minversion], [maxversion])
d1224d28
YS
279#
280# The userspace skips all tests that check kernel version.
e06c44a8 281m4_define([OVS_CHECK_MIN_KERNEL],
d1224d28
YS
282[
283 AT_SKIP_IF([:])
284])
285
286# OVS_CHECK_KERNEL_EXCL([minversion], [maxversion], [minsublevel], [maxsublevel])
287#
288# The userspace skips all tests that check kernel version.
289m4_define([OVS_CHECK_KERNEL_EXCL],
290[
291 AT_SKIP_IF([:])
292])
187bb41f
YHW
293
294# VSCTL_ADD_DATAPATH_TABLE()
295#
296# Create datapath table "netdev" for userspace tests in ovsdb
297m4_define([VSCTL_ADD_DATAPATH_TABLE],
298[
299 AT_CHECK([ovs-vsctl -- --id=@m create Datapath datapath_version=0 -- set Open_vSwitch . datapaths:"netdev"=@m], [0], [stdout])
300 DP_TYPE=$(echo "netdev")
301])
ae05d681
GR
302
303
304# CHECK_L3L4_CONNTRACK_REASM()
305#
306# Only allow this test to run on the kernel datapath - it is not useful
307# or necessary for the userspace datapath as it is checking for a kernel
308# specific regression.
309m4_define([CHECK_L3L4_CONNTRACK_REASM],
310[
311 AT_SKIP_IF([:])
312])