Merge remote-tracking branch 'origin/master' into ovn4
[cascardo/ovs.git] / tests / ovn.at
1 AT_BANNER([OVN])
2
3 AT_SETUP([ovn -- lexer])
4 dnl For lines without =>, input and expected output are identical.
5 dnl For lines with =>, input precedes => and expected output follows =>.
6 AT_DATA([test-cases.txt], [dnl
7 foo bar baz quuxquuxquux _abcd_ a.b.c.d a123_.456
8 "abc\u0020def" => "abc def"
9 " => error("Input ends inside quoted string.")dnl "
10
11 a/*b*/c => a c
12 a//b c => a
13 a/**/b => a b
14 a/*/b => a error("`/*' without matching `*/'.")
15 a/*/**/b => a b
16 a/b => a error("`/' is only valid as part of `//' or `/*'.") b
17
18 0 1 12345 18446744073709551615
19 18446744073709551616 => error("Decimal constants must be less than 2**64.")
20 9999999999999999999999 => error("Decimal constants must be less than 2**64.")
21 01 => error("Decimal constants must not have leading zeros.")
22
23 0/0
24 0/1
25 1/0 => error("Value contains unmasked 1-bits.")
26 1/1
27 128/384
28 1/3
29 1/ => error("Integer constant expected.")
30
31 1/0x123 => error("Value and mask have incompatible formats.")
32
33 0x1234
34 0x01234 => 0x1234
35 0x0 => 0
36 0x000 => 0
37 0xfedcba9876543210
38 0XFEDCBA9876543210 => 0xfedcba9876543210
39 0xfedcba9876543210fedcba9876543210
40 0xfedcba9876543210fedcba98765432100 => error("Hexadecimal constant requires more than 128 bits.")
41 0x0000fedcba9876543210fedcba9876543210 => 0xfedcba9876543210fedcba9876543210
42 0x => error("Hex digits expected following 0x.")
43 0X => error("Hex digits expected following 0X.")
44 0x0/0x0 => 0/0
45 0x0/0x1 => 0/0x1
46 0x1/0x0 => error("Value contains unmasked 1-bits.")
47 0xffff/0x1ffff
48 0x. => error("Invalid syntax in hexadecimal constant.")
49
50 192.168.128.1 1.2.3.4 255.255.255.255 0.0.0.0
51 256.1.2.3 => error("Invalid numeric constant.")
52 192.168.0.0/16
53 192.168.0.0/255.255.0.0 => 192.168.0.0/16
54 192.168.0.0/255.255.255.0 => 192.168.0.0/24
55 192.168.0.0/255.255.0.255
56 192.168.0.0/255.0.0.0 => error("Value contains unmasked 1-bits.")
57 192.168.0.0/32
58 192.168.0.0/255.255.255.255 => 192.168.0.0/32
59
60 ::
61 ::1
62 ff00::1234 => ff00::1234
63 2001:db8:85a3::8a2e:370:7334
64 2001:db8:85a3:0:0:8a2e:370:7334 => 2001:db8:85a3::8a2e:370:7334
65 2001:0db8:85a3:0000:0000:8a2e:0370:7334 => 2001:db8:85a3::8a2e:370:7334
66 ::ffff:192.0.2.128
67 ::ffff:c000:0280 => ::ffff:192.0.2.128
68 ::1/::1
69 ::1/ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff => ::1/128
70 ::1/128
71 ff00::/8
72 ff00::/ff00:: => ff00::/8
73
74 01:23:45:67:ab:cd
75 01:23:45:67:AB:CD => 01:23:45:67:ab:cd
76 fe:dc:ba:98:76:54
77 FE:DC:ba:98:76:54 => fe:dc:ba:98:76:54
78 01:00:00:00:00:00/01:00:00:00:00:00
79 ff:ff:ff:ff:ff:ff/ff:ff:ff:ff:ff:ff
80 fe:ff:ff:ff:ff:ff/ff:ff:ff:ff:ff:ff
81 ff:ff:ff:ff:ff:ff/fe:ff:ff:ff:ff:ff => error("Value contains unmasked 1-bits.")
82 fe:x => error("Invalid numeric constant.")
83 00:01:02:03:04:x => error("Invalid numeric constant.")
84
85 (){}[[]]==!=<<=>>=!&&||..,;= => ( ) { } [[ ]] == != < <= > >= ! && || .. , ; =
86 & => error("`&' is only valid as part of `&&'.")
87 | => error("`|' is only valid as part of `||'.")
88
89 ^ => error("Invalid character `^' in input.")
90 ])
91 AT_CAPTURE_FILE([input.txt])
92 sed 's/ =>.*//' test-cases.txt > input.txt
93 sed 's/.* => //' test-cases.txt > expout
94 AT_CHECK([ovstest test-ovn lex < input.txt], [0], [expout])
95 AT_CLEANUP
96
97 AT_SETUP([ovn -- expression parser])
98 dnl For lines without =>, input and expected output are identical.
99 dnl For lines with =>, input precedes => and expected output follows =>.
100 AT_DATA([test-cases.txt], [[
101 eth.type == 0x800
102 eth.type==0x800 => eth.type == 0x800
103 eth.type[0..15] == 0x800 => eth.type == 0x800
104
105 vlan.present
106 vlan.present == 1 => vlan.present
107 !(vlan.present == 0) => vlan.present
108 !(vlan.present != 1) => vlan.present
109 !vlan.present
110 vlan.present == 0 => !vlan.present
111 vlan.present != 1 => !vlan.present
112 !(vlan.present == 1) => !vlan.present
113 !(vlan.present != 0) => !vlan.present
114
115 eth.dst[0]
116 eth.dst[0] == 1 => eth.dst[0]
117 eth.dst[0] != 0 => eth.dst[0]
118 !(eth.dst[0] == 0) => eth.dst[0]
119 !(eth.dst[0] != 1) => eth.dst[0]
120
121 !eth.dst[0]
122 eth.dst[0] == 0 => !eth.dst[0]
123 eth.dst[0] != 1 => !eth.dst[0]
124 !(eth.dst[0] == 1) => !eth.dst[0]
125 !(eth.dst[0] != 0) => !eth.dst[0]
126
127 vlan.tci[12..15] == 0x3
128 vlan.tci == 0x3000/0xf000 => vlan.tci[12..15] == 0x3
129 vlan.tci[12..15] != 0x3
130 vlan.tci != 0x3000/0xf000 => vlan.tci[12..15] != 0x3
131
132 !vlan.pcp => vlan.pcp == 0
133 !(vlan.pcp) => vlan.pcp == 0
134 vlan.pcp == 0x4
135 vlan.pcp != 0x4
136 vlan.pcp > 0x4
137 vlan.pcp >= 0x4
138 vlan.pcp < 0x4
139 vlan.pcp <= 0x4
140 !(vlan.pcp != 0x4) => vlan.pcp == 0x4
141 !(vlan.pcp == 0x4) => vlan.pcp != 0x4
142 !(vlan.pcp <= 0x4) => vlan.pcp > 0x4
143 !(vlan.pcp < 0x4) => vlan.pcp >= 0x4
144 !(vlan.pcp >= 0x4) => vlan.pcp < 0x4
145 !(vlan.pcp > 0x4) => vlan.pcp <= 0x4
146 0x4 == vlan.pcp => vlan.pcp == 0x4
147 0x4 != vlan.pcp => vlan.pcp != 0x4
148 0x4 < vlan.pcp => vlan.pcp > 0x4
149 0x4 <= vlan.pcp => vlan.pcp >= 0x4
150 0x4 > vlan.pcp => vlan.pcp < 0x4
151 0x4 >= vlan.pcp => vlan.pcp <= 0x4
152 !(0x4 != vlan.pcp) => vlan.pcp == 0x4
153 !(0x4 == vlan.pcp) => vlan.pcp != 0x4
154 !(0x4 >= vlan.pcp) => vlan.pcp > 0x4
155 !(0x4 > vlan.pcp) => vlan.pcp >= 0x4
156 !(0x4 <= vlan.pcp) => vlan.pcp < 0x4
157 !(0x4 < vlan.pcp) => vlan.pcp <= 0x4
158
159 1 < vlan.pcp < 4 => vlan.pcp > 0x1 && vlan.pcp < 0x4
160 1 <= vlan.pcp <= 4 => vlan.pcp >= 0x1 && vlan.pcp <= 0x4
161 1 < vlan.pcp <= 4 => vlan.pcp > 0x1 && vlan.pcp <= 0x4
162 1 <= vlan.pcp < 4 => vlan.pcp >= 0x1 && vlan.pcp < 0x4
163 1 <= vlan.pcp <= 4 => vlan.pcp >= 0x1 && vlan.pcp <= 0x4
164 4 > vlan.pcp > 1 => vlan.pcp < 0x4 && vlan.pcp > 0x1
165 4 >= vlan.pcp > 1 => vlan.pcp <= 0x4 && vlan.pcp > 0x1
166 4 > vlan.pcp >= 1 => vlan.pcp < 0x4 && vlan.pcp >= 0x1
167 4 >= vlan.pcp >= 1 => vlan.pcp <= 0x4 && vlan.pcp >= 0x1
168 !(1 < vlan.pcp < 4) => vlan.pcp <= 0x1 || vlan.pcp >= 0x4
169 !(1 <= vlan.pcp <= 4) => vlan.pcp < 0x1 || vlan.pcp > 0x4
170 !(1 < vlan.pcp <= 4) => vlan.pcp <= 0x1 || vlan.pcp > 0x4
171 !(1 <= vlan.pcp < 4) => vlan.pcp < 0x1 || vlan.pcp >= 0x4
172 !(1 <= vlan.pcp <= 4) => vlan.pcp < 0x1 || vlan.pcp > 0x4
173 !(4 > vlan.pcp > 1) => vlan.pcp >= 0x4 || vlan.pcp <= 0x1
174 !(4 >= vlan.pcp > 1) => vlan.pcp > 0x4 || vlan.pcp <= 0x1
175 !(4 > vlan.pcp >= 1) => vlan.pcp >= 0x4 || vlan.pcp < 0x1
176 !(4 >= vlan.pcp >= 1) => vlan.pcp > 0x4 || vlan.pcp < 0x1
177
178 vlan.pcp == {1, 2, 3, 4} => vlan.pcp == 0x1 || vlan.pcp == 0x2 || vlan.pcp == 0x3 || vlan.pcp == 0x4
179 vlan.pcp == 1 || ((vlan.pcp == 2 || vlan.pcp == 3) || vlan.pcp == 4) => vlan.pcp == 0x1 || vlan.pcp == 0x2 || vlan.pcp == 0x3 || vlan.pcp == 0x4
180
181 vlan.pcp != {1, 2, 3, 4} => vlan.pcp != 0x1 && vlan.pcp != 0x2 && vlan.pcp != 0x3 && vlan.pcp != 0x4
182 vlan.pcp == 1 && ((vlan.pcp == 2 && vlan.pcp == 3) && vlan.pcp == 4) => vlan.pcp == 0x1 && vlan.pcp == 0x2 && vlan.pcp == 0x3 && vlan.pcp == 0x4
183
184 vlan.pcp == 1 && !((vlan.pcp == 2 && vlan.pcp == 3) && vlan.pcp == 4) => vlan.pcp == 0x1 && (vlan.pcp != 0x2 || vlan.pcp != 0x3 || vlan.pcp != 0x4)
185 vlan.pcp == 1 && (!(vlan.pcp == 2 && vlan.pcp == 3) && vlan.pcp == 4) => vlan.pcp == 0x1 && (vlan.pcp != 0x2 || vlan.pcp != 0x3) && vlan.pcp == 0x4
186 vlan.pcp == 1 && !(!(vlan.pcp == 2 && vlan.pcp == 3) && vlan.pcp == 4) => vlan.pcp == 0x1 && ((vlan.pcp == 0x2 && vlan.pcp == 0x3) || vlan.pcp != 0x4)
187
188 ip4.src == {10.0.0.0/8, 192.168.0.0/16, 172.16.20.0/24, 8.8.8.8} => ip4.src[24..31] == 0xa || ip4.src[16..31] == 0xc0a8 || ip4.src[8..31] == 0xac1014 || ip4.src == 0x8080808
189 ip6.src == ::1 => ip6.src == 0x1
190
191 ip4.src == 1.2.3.4 => ip4.src == 0x1020304
192 ip4.src == ::1.2.3.4/::ffff:ffff => ip4.src == 0x1020304
193 ip6.src == ::1 => ip6.src == 0x1
194
195 1
196 0
197 !1 => 0
198 !0 => 1
199
200 inport == "eth0"
201 !(inport != "eth0") => inport == "eth0"
202
203 ip4.src == "eth0" => Integer field ip4.src is not compatible with string constant.
204 inport == 1 => String field inport is not compatible with integer constant.
205
206 ip4.src > {1, 2, 3} => Only == and != operators may be used with value sets.
207 eth.type > 0x800 => Only == and != operators may be used with nominal field eth.type.
208 vlan.present > 0 => Only == and != operators may be used with Boolean field vlan.present.
209
210 inport != "eth0" => Nominal field inport may only be tested for equality (taking enclosing `!' operators into account).
211 !(inport == "eth0") => Nominal field inport may only be tested for equality (taking enclosing `!' operators into account).
212 eth.type != 0x800 => Nominal field eth.type may only be tested for equality (taking enclosing `!' operators into account).
213 !(eth.type == 0x800) => Nominal field eth.type may only be tested for equality (taking enclosing `!' operators into account).
214
215 123 == 123 => Syntax error at `123' expecting field name.
216
217 123 == xyzzy => Syntax error at `xyzzy' expecting field name.
218 xyzzy == 1 => Syntax error at `xyzzy' expecting field name.
219
220 inport[1] == 1 => Cannot select subfield of string field inport.
221
222 eth.type[] == 1 => Syntax error at `@:>@' expecting small integer.
223 eth.type[::1] == 1 => Syntax error at `::1' expecting small integer.
224 eth.type[18446744073709551615] == 1 => Syntax error at `18446744073709551615' expecting small integer.
225
226 eth.type[5!] => Syntax error at `!' expecting `@:>@'.
227
228 eth.type[5..1] => Invalid bit range 5 to 1.
229
230 eth.type[12..16] => Cannot select bits 12 to 16 of 16-bit field eth.type.
231
232 eth.type[10] == 1 => Cannot select subfield of nominal field eth.type.
233
234 eth.type => Explicit `!= 0' is required for inequality test of multibit field against 0.
235
236 !(!(vlan.pcp)) => Explicit `!= 0' is required for inequality test of multibit field against 0.
237
238 123 => Syntax error at end of input expecting relational operator.
239
240 123 x => Syntax error at `x' expecting relational operator.
241
242 {1, "eth0"} => Syntax error at `"eth0"' expecting integer.
243
244 eth.type == xyzzy => Syntax error at `xyzzy' expecting constant.
245
246 (1 x) => Syntax error at `x' expecting `)'.
247
248 !0x800 != eth.type => Missing parentheses around operand of !.
249
250 eth.type == 0x800 || eth.type == 0x86dd && ip.proto == 17 => && and || must be parenthesized when used together.
251
252 eth.dst == {} => Syntax error at `}' expecting constant.
253
254 eth.src > 00:00:00:00:11:11/00:00:00:00:ff:ff => Only == and != operators may be used with masked constants.  Consider using subfields instead (e.g. eth.src[0..15] > 0x1111 in place of eth.src > 00:00:00:00:11:11/00:00:00:00:ff:ff).
255
256 ip4.src == ::1 => 128-bit constant is not compatible with 32-bit field ip4.src.
257
258 1 == eth.type == 2 => Range expressions must have the form `x < field < y' or `x > field > y', with each `<' optionally replaced by `<=' or `>' by `>=').
259 ]])
260 sed 's/ =>.*//' test-cases.txt > input.txt
261 sed 's/.* => //' test-cases.txt > expout
262 AT_CHECK([ovstest test-ovn parse-expr < input.txt], [0], [expout])
263 AT_CLEANUP
264
265 AT_SETUP([ovn -- expression annotation])
266 dnl Input precedes =>, expected output follows =>.
267 AT_DATA([test-cases.txt], [[
268 ip4.src == 1.2.3.4 => ip4.src == 0x1020304 && eth.type == 0x800
269 ip4.src != 1.2.3.4 => ip4.src != 0x1020304 && eth.type == 0x800
270 ip.proto == 123 => ip.proto == 0x7b && (eth.type == 0x800 || eth.type == 0x86dd)
271 ip.proto == {123, 234} => (ip.proto == 0x7b && (eth.type == 0x800 || eth.type == 0x86dd)) || (ip.proto == 0xea && (eth.type == 0x800 || eth.type == 0x86dd))
272 ip4.src == 1.2.3.4 && ip4.dst == 5.6.7.8 => ip4.src == 0x1020304 && eth.type == 0x800 && ip4.dst == 0x5060708 && eth.type == 0x800
273
274 ip => eth.type == 0x800 || eth.type == 0x86dd
275 ip == 1 => eth.type == 0x800 || eth.type == 0x86dd
276 ip[0] == 1 => eth.type == 0x800 || eth.type == 0x86dd
277 ip > 0 => Only == and != operators may be used with nominal field ip.
278 !ip => Nominal predicate ip may only be tested positively, e.g. `ip' or `ip == 1' but not `!ip' or `ip == 0'.
279 ip == 0 => Nominal predicate ip may only be tested positively, e.g. `ip' or `ip == 1' but not `!ip' or `ip == 0'.
280
281 vlan.present => vlan.tci[12]
282 !vlan.present => !vlan.tci[12]
283
284 !vlan.pcp => vlan.tci[13..15] == 0 && vlan.tci[12]
285 vlan.pcp == 1 && vlan.vid == 2 => vlan.tci[13..15] == 0x1 && vlan.tci[12] && vlan.tci[0..11] == 0x2 && vlan.tci[12]
286 !reg0 && !reg1 && !reg2 && !reg3 => xreg0[32..63] == 0 && xreg0[0..31] == 0 && xreg1[32..63] == 0 && xreg1[0..31] == 0
287
288 ip.first_frag => ip.frag[0] && (eth.type == 0x800 || eth.type == 0x86dd) && (!ip.frag[1] || (eth.type != 0x800 && eth.type != 0x86dd))
289 !ip.first_frag => !ip.frag[0] || (eth.type != 0x800 && eth.type != 0x86dd) || (ip.frag[1] && (eth.type == 0x800 || eth.type == 0x86dd))
290 ip.later_frag => ip.frag[1] && (eth.type == 0x800 || eth.type == 0x86dd)
291
292 bad_prereq != 0 => Error parsing expression `xyzzy' encountered as prerequisite or predicate of initial expression: Syntax error at `xyzzy' expecting field name.
293 self_recurse != 0 => Error parsing expression `self_recurse != 0' encountered as prerequisite or predicate of initial expression: Recursive expansion of symbol `self_recurse'.
294 mutual_recurse_1 != 0 => Error parsing expression `mutual_recurse_2 != 0' encountered as prerequisite or predicate of initial expression: Error parsing expression `mutual_recurse_1 != 0' encountered as prerequisite or predicate of initial expression: Recursive expansion of symbol `mutual_recurse_1'.
295 mutual_recurse_2 != 0 => Error parsing expression `mutual_recurse_1 != 0' encountered as prerequisite or predicate of initial expression: Error parsing expression `mutual_recurse_2 != 0' encountered as prerequisite or predicate of initial expression: Recursive expansion of symbol `mutual_recurse_2'.
296 ]])
297 sed 's/ =>.*//' test-cases.txt > input.txt
298 sed 's/.* => //' test-cases.txt > expout
299 AT_CHECK([ovstest test-ovn annotate-expr < input.txt], [0], [expout])
300 AT_CLEANUP
301
302 AT_SETUP([ovn -- expression conversion (1)])
303 AT_CHECK([ovstest test-ovn exhaustive --operation=convert 1], [0],
304   [Tested converting all 1-terminal expressions with 2 vars each of 3 bits in terms of operators == != < <= > >=.
305 ])
306 AT_CLEANUP
307
308 AT_SETUP([ovn -- expression conversion (2)])
309 AT_CHECK([ovstest test-ovn exhaustive --operation=convert 2], [0],
310   [Tested converting 562 expressions of 2 terminals with 2 vars each of 3 bits in terms of operators == != < <= > >=.
311 ])
312 AT_CLEANUP
313
314 AT_SETUP([ovn -- expression conversion (3)])
315 AT_CHECK([ovstest test-ovn exhaustive --operation=convert --bits=2 3], [0],
316   [Tested converting 57618 expressions of 3 terminals with 2 vars each of 2 bits in terms of operators == != < <= > >=.
317 ])
318 AT_CLEANUP
319
320 AT_SETUP([ovn -- expression simplification])
321 AT_CHECK([ovstest test-ovn exhaustive --operation=simplify --vars=2 3], [0],
322   [Tested simplifying 477138 expressions of 3 terminals with 2 vars each of 3 bits in terms of operators == != < <= > >=.
323 ])
324 AT_CLEANUP
325
326 AT_SETUP([ovn -- expression normalization (1)])
327 AT_CHECK([ovstest test-ovn exhaustive --operation=normalize --vars=3 --bits=1 4], [0],
328   [Tested normalizing 1207162 expressions of 4 terminals with 3 vars each of 1 bits in terms of operators == != < <= > >=.
329 ])
330 AT_CLEANUP
331
332 AT_SETUP([ovn -- expression normalization (1)])
333 AT_CHECK([ovstest test-ovn exhaustive --operation=normalize --vars=3 --bits=1 --relops='==' 5], [0],
334   [Tested normalizing 368550 expressions of 5 terminals with 3 vars each of 1 bits in terms of operators ==.
335 ])
336 AT_CLEANUP
337
338 AT_SETUP([ovn -- converting expressions to flows (1)])
339 AT_CHECK([ovstest test-ovn exhaustive --operation=flow --vars=2 --bits=2 --relops='==' 4], [0],
340   [Tested converting to flows 128282 expressions of 4 terminals with 2 vars each of 2 bits in terms of operators ==.
341 ])
342 AT_CLEANUP
343
344 AT_SETUP([ovn -- converting expressions to flows (2)])
345 AT_CHECK([ovstest test-ovn exhaustive --operation=flow --vars=3 --bits=3 --relops='==' 3], [0],
346   [Tested converting to flows 38394 expressions of 3 terminals with 3 vars each of 3 bits in terms of operators ==.
347 ])
348 AT_CLEANUP
349
350 AT_SETUP([ovn -- converting expressions to flows -- string fields])
351 expr_to_flow () {
352     echo "$1" | ovstest test-ovn expr-to-flows | sort
353 }
354 AT_CHECK([expr_to_flow 'inport == "eth0"'], [0], [reg6=0x5
355 ])
356 AT_CHECK([expr_to_flow 'inport == "eth1"'], [0], [reg6=0x6
357 ])
358 AT_CHECK([expr_to_flow 'inport == "eth2"'], [0], [(no flows)
359 ])
360 AT_CHECK([expr_to_flow 'inport == "eth0" && ip'], [0], [dnl
361 ip,reg6=0x5
362 ipv6,reg6=0x5
363 ])
364 AT_CHECK([expr_to_flow 'inport == "eth1" && ip'], [0], [dnl
365 ip,reg6=0x6
366 ipv6,reg6=0x6
367 ])
368 AT_CHECK([expr_to_flow 'inport == "eth2" && ip'], [0], [(no flows)
369 ])
370 AT_CHECK([expr_to_flow 'inport == {"eth0", "eth1", "eth2", "LOCAL"}'], [0],
371 [reg6=0x5
372 reg6=0x6
373 reg6=0xfffe
374 ])
375 AT_CHECK([expr_to_flow 'inport == {"eth0", "eth1", "eth2"} && ip'], [0], [dnl
376 ip,reg6=0x5
377 ip,reg6=0x6
378 ipv6,reg6=0x5
379 ipv6,reg6=0x6
380 ])
381 AT_CLEANUP
382
383 AT_SETUP([ovn -- action parsing])
384 dnl Text before => is input, text after => is expected output.
385 AT_DATA([test-cases.txt], [[
386 # Positive tests.
387 drop; => actions=drop, prereqs=1
388 next; => actions=resubmit(,11), prereqs=1
389 output; => actions=resubmit(,64), prereqs=1
390 outport="eth0"; next; outport="LOCAL"; next; => actions=set_field:0x5->reg7,resubmit(,11),set_field:0xfffe->reg7,resubmit(,11), prereqs=1
391 tcp.dst=80; => actions=set_field:80->tcp_dst, prereqs=ip.proto == 0x6 && (eth.type == 0x800 || eth.type == 0x86dd)
392 eth.dst[40] = 1; => actions=set_field:01:00:00:00:00:00/01:00:00:00:00:00->eth_dst, prereqs=1
393 vlan.pcp = 2; => actions=set_field:0x4000/0xe000->vlan_tci, prereqs=vlan.tci[12]
394 vlan.tci[13..15] = 2; => actions=set_field:0x4000/0xe000->vlan_tci, prereqs=1
395
396 ## Negative tests.
397
398 ; => Syntax error at `;'.
399 xyzzy; => Syntax error at `xyzzy' expecting action.
400 next; 123; => Syntax error at `123'.
401 next; xyzzy; => Syntax error at `xyzzy' expecting action.
402
403 # "drop;" must be on its own:
404 drop; next; => Syntax error at `next' expecting end of input.
405 next; drop; => Syntax error at `drop' expecting action.
406
407 # Missing ";":
408 next => Syntax error at end of input expecting ';'.
409
410 inport[1] = 1; => Cannot select subfield of string field inport.
411 ip.proto[1] = 1; => Cannot select subfield of nominal field ip.proto.
412 eth.dst[40] == 1; => Syntax error at `==' expecting `='.
413 ip = 1; => Can't assign to predicate symbol ip.
414 ip.proto = 6; => Field ip.proto is not modifiable.
415 inport = {"a", "b"}; => Assignments require a single value.
416 inport = {}; => Syntax error at `}' expecting constant.
417 bad_prereq = 123; => Error parsing expression `xyzzy' encountered as prerequisite or predicate of initial expression: Syntax error at `xyzzy' expecting field name.
418 self_recurse = 123; => Error parsing expression `self_recurse != 0' encountered as prerequisite or predicate of initial expression: Error parsing expression `self_recurse != 0' encountered as prerequisite or predicate of initial expression: Recursive expansion of symbol `self_recurse'.
419 vlan.present = 0; => Can't assign to predicate symbol vlan.present.
420 ]])
421 sed 's/ =>.*//' test-cases.txt > input.txt
422 sed 's/.* => //' test-cases.txt > expout
423 AT_CHECK([ovstest test-ovn parse-actions < input.txt], [0], [expout])
424 AT_CLEANUP