3 # Expands into the proper ovs-vsctl commands to create a bridge with the
4 # appropriate type and properties
5 m4_define([_ADD_BR], [[add-br $1 -- set Bridge $1 datapath_type="netdev" protocols=OpenFlow10,OpenFlow11,OpenFlow12,OpenFlow13,OpenFlow14,OpenFlow15 fail-mode=secure ]])
7 # OVS_TRAFFIC_VSWITCHD_START([vsctl-args], [vsctl-output], [=override])
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'
14 # specifies the expected output after filtering through uuidfilt.
15 m4_define([OVS_TRAFFIC_VSWITCHD_START],
17 OVS_WAIT_WHILE([ip link show ovs-netdev])
18 _OVS_VSWITCHD_START([--disable-system])
19 dnl Add bridges, ports, etc.
20 OVS_WAIT_WHILE([ip link show br0])
21 AT_CHECK([ovs-vsctl -- _ADD_BR([br0]) -- $1 m4_if([$2], [], [], [| uuidfilt])], [0], [$2])
24 # OVS_TRAFFIC_VSWITCHD_STOP([WHITELIST], [extra_cmds])
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
28 # is present. The optional WHITELIST may contain shell-quoted "sed"
29 # commands to delete any warnings that are actually expected, e.g.:
31 # OVS_TRAFFIC_VSWITCHD_STOP(["/expected error/d"])
33 # 'extra_cmds' are shell commands to be executed afte OVS_VSWITCHD_STOP() is
34 # invoked. They can be used to perform additional cleanups such as name space
36 m4_define([OVS_TRAFFIC_VSWITCHD_STOP],
37 [OVS_VSWITCHD_STOP([dnl
38 $1";/netdev_linux.*obtaining netdev stats via vport failed/d
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"])
45 # CONFIGURE_VETH_OFFLOADS([VETH])
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.
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.
57 # This is a workaround, and should be removed when offloads are properly
58 # supported in netdev-linux.
59 m4_define([CONFIGURE_VETH_OFFLOADS],
60 [AT_CHECK([ethtool -K $1 tx off], [0], [ignore], [ignore])]
65 # Perform requirements checks for running conntrack tests.
67 m4_define([CHECK_CONNTRACK],
68 [AT_SKIP_IF([test $HAVE_PYTHON2 = no])]
71 # CHECK_CONNTRACK_ALG()
73 # Perform requirements checks for running conntrack ALG tests. The userspace
74 # supports FTP and TFTP.
76 m4_define([CHECK_CONNTRACK_ALG])
78 # CHECK_CONNTRACK_LOCAL_STACK()
80 # Perform requirements checks for running conntrack tests with local stack.
81 # While the kernel connection tracker automatically passes all the connection
82 # tracking state from an internal port to the OpenvSwitch kernel module, there
83 # is simply no way of doing that with the userspace, so skip the tests.
84 m4_define([CHECK_CONNTRACK_LOCAL_STACK],
89 # CHECK_CONNTRACK_FRAG_OVERLAP()
91 # The userspace datapath supports fragment overlap check.
92 m4_define([CHECK_CONNTRACK_FRAG_OVERLAP])
94 # CHECK_CONNTRACK_NAT()
96 # Perform requirements checks for running conntrack NAT tests. The userspace
97 # datapath supports NAT.
99 m4_define([CHECK_CONNTRACK_NAT])
101 # CHECK_CT_DPIF_PER_ZONE_LIMIT()
103 # Perform requirements checks for running ovs-dpctl ct-[set|get|del]-limits per
104 # zone. The userspace datapath does not support this feature yet.
105 m4_define([CHECK_CT_DPIF_PER_ZONE_LIMIT],
110 # CHECK_CT_DPIF_SET_GET_MAXCONNS()
112 # Perform requirements checks for running ovs-dpctl ct-set-maxconns or
113 # ovs-dpctl ct-get-maxconns. The userspace datapath does support this feature.
114 m4_define([CHECK_CT_DPIF_SET_GET_MAXCONNS])
116 # CHECK_CT_DPIF_GET_NCONNS()
118 # Perform requirements checks for running ovs-dpctl ct-get-nconns. The
119 # userspace datapath does support this feature.
120 m4_define([CHECK_CT_DPIF_GET_NCONNS])
122 # DPCTL_SET_MIN_FRAG_SIZE()
124 # The userspace datapath supports this command.
125 m4_define([DPCTL_SET_MIN_FRAG_SIZE],
127 AT_CHECK([ovs-appctl dpctl/ipf-set-min-frag v4 400], [], [dnl
128 setting minimum fragment size successful
130 AT_CHECK([ovs-appctl dpctl/ipf-set-min-frag v6 400], [], [dnl
131 setting minimum fragment size successful
135 # DPCTL_MODIFY_FRAGMENTATION()
137 # The userspace datapath supports this command.
138 m4_define([DPCTL_MODIFY_FRAGMENTATION],
140 AT_CHECK([ovs-appctl dpctl/ipf-set-min-frag v4 1000], [], [dnl
141 setting minimum fragment size successful
143 AT_CHECK([ovs-appctl dpctl/ipf-set-max-nfrags 500], [], [dnl
144 setting maximum fragments successful
146 AT_CHECK([ovs-appctl dpctl/ipf-get-status], [], [dnl
147 Fragmentation Module Status
148 ---------------------------
151 max num frags (v4/v6): 500
153 min v4 frag size: 1000
155 v4 frags completed: 0
157 v4 frags too small: 0
158 v4 frags overlapped: 0
160 min v6 frag size: 1280
162 v6 frags completed: 0
164 v6 frags too small: 0
165 v6 frags overlapped: 0
170 # DPCTL_CHECK_FRAGMENTATION_PASS()
172 # Used to check fragmentation counters for some fragmentation tests using
173 # the userspace datapath.
174 m4_define([DPCTL_CHECK_FRAGMENTATION_PASS],
176 AT_CHECK([ovs-appctl dpctl/ipf-get-status --more], [], [dnl
177 Fragmentation Module Status
178 ---------------------------
181 max num frags (v4/v6): 500
183 min v4 frag size: 1000
184 v4 frags accepted: 30
185 v4 frags completed: 30
187 v4 frags too small: 0
188 v4 frags overlapped: 0
190 min v6 frag size: 1280
192 v6 frags completed: 0
194 v6 frags too small: 0
195 v6 frags overlapped: 0
203 # DPCTL_CHECK_V6_FRAGMENTATION_PASS()
205 # Used to check fragmentation counters for some fragmentation tests using
206 # the userspace datapath.
207 m4_define([DPCTL_CHECK_V6_FRAGMENTATION_PASS],
209 AT_CHECK([ovs-appctl dpctl/ipf-get-status --more], [], [dnl
210 Fragmentation Module Status
211 ---------------------------
214 max num frags (v4/v6): 1000
216 min v4 frag size: 1200
218 v4 frags completed: 0
220 v4 frags too small: 0
221 v4 frags overlapped: 0
223 min v6 frag size: 1280
224 v6 frags accepted: 30
225 v6 frags completed: 30
227 v6 frags too small: 0
228 v6 frags overlapped: 0
236 # FORMAT_FRAG_LIST([])
238 # Strip content from the piped input which can differ from test to test; recirc_id
239 # and ip_id fields in an ipf_list vary from test to test and hence are cleared.
240 m4_define([FORMAT_FRAG_LIST],
241 [[sed -e 's/ip_id=[0-9]*/ip_id=<cleared>/g' -e 's/recirc_id=[0-9]*/recirc_id=<cleared>/g']])
243 # DPCTL_CHECK_FRAGMENTATION_FAIL()
245 # Used to check fragmentation counters for some fragmentation tests using
246 # the userspace datapath, when failure to transmit fragments is expected.
247 m4_define([DPCTL_CHECK_FRAGMENTATION_FAIL],
249 AT_CHECK([ovs-appctl dpctl/ipf-get-status -m | FORMAT_FRAG_LIST()], [], [dnl
250 Fragmentation Module Status
251 ---------------------------
254 max num frags (v4/v6): 500
256 min v4 frag size: 1000
258 v4 frags completed: 0
260 v4 frags too small: 0
261 v4 frags overlapped: 0
263 min v6 frag size: 1280
265 v6 frags completed: 0
267 v6 frags too small: 0
268 v6 frags overlapped: 0
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 (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)
276 (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)
277 (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)
278 (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)
279 (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)
283 # OVS_CHECK_MIN_KERNEL([minversion], [maxversion])
285 # The userspace skips all tests that check kernel version.
286 m4_define([OVS_CHECK_MIN_KERNEL],
291 # OVS_CHECK_KERNEL_EXCL([minversion], [maxversion], [minsublevel], [maxsublevel])
293 # The userspace skips all tests that check kernel version.
294 m4_define([OVS_CHECK_KERNEL_EXCL],