]> git.proxmox.com Git - mirror_ovs.git/blob - tests/ofp-actions.at
ofproto-dpif: Expose datapath capability to ovsdb.
[mirror_ovs.git] / tests / ofp-actions.at
1 AT_BANNER([OpenFlow actions])
2
3 AT_SETUP([OpenFlow 1.0 action translation])
4 AT_KEYWORDS([ofp-actions OF1.0])
5 AT_DATA([test-data], [dnl
6 # actions=LOCAL
7 0000 0008 fffe 04d2
8
9 # actions=CONTROLLER:1234
10 0000 0008 fffd 04d2
11
12 # actions=mod_vlan_vid:9
13 0001 0008 0009 0000
14
15 # actions=mod_vlan_pcp:6
16 0002 0008 06 000000
17
18 # actions=strip_vlan
19 0003 0008 00000000
20
21 # actions=mod_dl_src:00:11:22:33:44:55
22 0004 0010 001122334455 000000000000
23
24 # actions=mod_dl_dst:10:20:30:40:50:60
25 0005 0010 102030405060 000000000000
26
27 # actions=mod_nw_src:1.2.3.4
28 0006 0008 01020304
29
30 # actions=mod_nw_dst:192.168.0.1
31 0007 0008 c0a80001
32
33 # actions=mod_nw_tos:48
34 0008 0008 30 000000
35
36 # actions=mod_tp_src:80
37 0009 0008 0050 0000
38
39 # actions=mod_tp_dst:443
40 000a 0008 01bb 0000
41
42 # actions=enqueue:10:55
43 000b 0010 000a 000000000000 00000037
44
45 # actions=resubmit:5
46 ffff 0010 00002320 0001 0005 00000000
47
48 # actions=set_tunnel:0x12345678
49 ffff 0010 00002320 0002 0000 12345678
50
51 # actions=set_queue:2309737729
52 ffff 0010 00002320 0004 0000 89abcd01
53
54 # actions=pop_queue
55 ffff 0010 00002320 0005 000000000000
56
57 # actions=move:NXM_OF_IN_PORT[]->NXM_OF_VLAN_TCI[]
58 ffff 0018 00002320 0006 0010 0000 0000 00000002 00000802
59
60 # actions=load:0xf009->NXM_OF_VLAN_TCI[]
61 ffff 0018 00002320 0007 000f 00000802 000000000000f009
62
63 # actions=note:11.e9.9a.ad.67.f3
64 ffff 0010 00002320 0008 11e99aad67f3
65
66 # actions=set_tunnel64:0xc426384d49c53d60
67 ffff 0018 00002320 0009 000000000000 c426384d49c53d60
68
69 # actions=set_tunnel64:0x885f3298
70 ffff 0018 00002320 0009 000000000000 00000000885f3298
71
72 # bad OpenFlow10 actions: OFPBIC_UNSUP_INST
73 & ofp_actions|WARN|write_metadata instruction not allowed here
74 ffff 0020 00002320 0016 000000000000 fedcba9876543210 ffffffffffffffff
75
76 # bad OpenFlow10 actions: OFPBIC_UNSUP_INST
77 & ofp_actions|WARN|write_metadata instruction not allowed here
78 ffff 0020 00002320 0016 000000000000 fedcba9876543210 ffff0000ffff0000
79
80 # actions=multipath(eth_src,50,modulo_n,1,0,NXM_NX_REG0[])
81 ffff 0020 00002320 000a 0000 0032 0000 0000 0000 0000 0000 0000 001f 00010004
82
83 # actions=bundle(eth_src,0,hrw,ofport,slaves:4,8)
84 ffff 0028 00002320 000c 0001 0000 0000 00000002 0002 0000 00000000 00000000 dnl
85 0004 0008 00000000
86
87 # actions=bundle_load(eth_src,0,hrw,ofport,NXM_NX_REG0[],slaves:4,8)
88 ffff 0028 00002320 000d 0001 0000 0000 00000002 0002 001f 00010004 00000000 dnl
89 0004 0008 00000000
90
91 # actions=resubmit(10,5)
92 ffff 0010 00002320 000e 000a 05 000000
93
94 # actions=resubmit(10,5,ct)
95 ffff 0010 00002320 002c 000a 05 000000
96
97 # actions=output:NXM_NX_REG1[5..10]
98 ffff 0018 00002320 000f 0145 00010204 ffff 000000000000
99
100 # actions=learn(table=2,idle_timeout=10,hard_timeout=20,fin_idle_timeout=2,fin_hard_timeout=4,priority=80,cookie=0x123456789abcdef0,NXM_OF_VLAN_TCI[0..11],NXM_OF_ETH_DST[]=NXM_OF_ETH_SRC[],output:NXM_OF_IN_PORT[])
101 ffff 0048 00002320 0010 000a 0014 0050 123456789abcdef0 0000 02 00 0002 0004 dnl
102 000c 00000802 0000 00000802 0000 dnl
103 0030 00000406 0000 00000206 0000 dnl
104 1010 00000002 0000 dnl
105 00000000
106
107 # actions=exit
108 ffff 0010 00002320 0011 000000000000
109
110 # actions=dec_ttl
111 ffff 0010 00002320 0012 000000000000
112
113 # actions=fin_timeout(idle_timeout=10,hard_timeout=20)
114 ffff 0010 00002320 0013 000a 0014 0000
115
116 # actions=controller(reason=invalid_ttl,max_len=1234,id=5678)
117 ffff 0010 00002320 0014 04d2 162e 02 00
118
119 # actions=controller(reason=invalid_ttl,max_len=1234,id=5678,userdata=01.02.03.04.05,pause)
120 ffff 0040 00002320 0025 000000000000 dnl
121 0000 0008 04d2 0000 dnl
122 0001 0008 162e 0000 dnl
123 0002 0005 02 000000 dnl
124 0003 0009 0102030405 00000000000000 dnl
125 0004 0004 00000000
126
127 # actions=dec_ttl(32768,12345,90,765,1024)
128 ffff 0020 00002320 0015 000500000000 80003039005A02fd 0400000000000000
129
130 # actions=sample(probability=12345,collector_set_id=23456,obs_domain_id=34567,obs_point_id=45678)
131 ffff 0018 00002320 001d 3039 00005BA0 00008707 0000B26E
132
133 # actions=sample(probability=12345,collector_set_id=23456,obs_domain_id=34567,obs_point_id=45678,sampling_port=56789)
134 ffff 0020 00002320 0026 3039 00005BA0 00008707 0000B26E DDD50000 00000000
135
136 # actions=sample(probability=12345,collector_set_id=23456,obs_domain_id=34567,obs_point_id=45678,sampling_port=56789,egress)
137 ffff 0020 00002320 0029 3039 00005BA0 00008707 0000B26E DDD50200 00000000
138
139 # bad OpenFlow10 actions: OFPBAC_BAD_LEN
140 & ofp_actions|WARN|OpenFlow action OFPAT_OUTPUT length 240 exceeds action buffer length 8
141 & ofp_actions|WARN|bad action at offset 0 (OFPBAC_BAD_LEN):
142 & 00000000 00 00 00 f0 00 00 00 00-
143 00 00 00 f0 00 00 00 00
144
145 # bad OpenFlow10 actions: OFPBAC_BAD_LEN
146 & ofp_actions|WARN|OpenFlow action OFPAT_OUTPUT length 16 not in valid range [[8,8]]
147 & ofp_actions|WARN|bad action at offset 0 (OFPBAC_BAD_LEN):
148 & 00000000 00 00 00 10 ff fe ff ff-00 00 00 00 00 00 00 00
149 00 00 00 10 ff fe ff ff 00 00 00 00 00 00 00 00
150
151 # bad OpenFlow10 actions: OFPBAC_BAD_LEN
152 & ofp_actions|WARN|OpenFlow action NXAST_DEC_TTL_CNT_IDS length 17 is not a multiple of 8
153 ffff 0011 00002320 0015 0001 00000000 0000000000000000
154
155 # bad OpenFlow10 actions: OFPBAC_BAD_OUT_PORT
156 0000 0008 ffff 0000
157
158 # actions=ct()
159 ffff 0018 00002320 0023 0000 00000000 0000 FF 000000 0000
160
161 # actions=ct(commit)
162 ffff 0018 00002320 0023 0001 00000000 0000 FF 000000 0000
163
164 # actions=ct(commit,force)
165 ffff 0018 00002320 0023 0003 00000000 0000 FF 000000 0000
166
167 # bad OpenFlow10 actions: OFPBAC_BAD_ARGUMENT
168 ffff 0018 00002320 0023 0002 00000000 0000 FF 000000 0000
169
170 # actions=ct(table=10)
171 ffff 0018 00002320 0023 0000 00000000 0000 0A 000000 0000
172
173 # actions=ct(zone=10)
174 ffff 0018 00002320 0023 0000 00000000 000A FF 000000 0000
175
176 # actions=ct(zone=NXM_NX_REG0[0..15])
177 ffff 0018 00002320 0023 0000 00010004 000F FF 000000 0000
178
179 dnl Can't read 8 bits from register into 16-bit zone.
180 # bad OpenFlow10 actions: OFPBAC_BAD_SET_LEN
181 ffff 0018 00002320 0023 0000 00010004 0007 FF 000000 0000
182
183 dnl Can't read 32 bits from register into 16-bit zone.
184 # bad OpenFlow10 actions: OFPBAC_BAD_SET_LEN
185 ffff 0018 00002320 0023 0000 00010004 001F FF 000000 0000
186
187 # actions=ct(commit,exec(load:0xf009->NXM_NX_CT_MARK[]))
188 ffff 0030 00002320 0023 0001 00000000 0000 FF 000000 0000 dnl
189 ffff 0018 00002320 0007 001f 0001d604 000000000000f009
190
191 # actions=ct(commit,force,exec(load:0xf009->NXM_NX_CT_MARK[]))
192 ffff 0030 00002320 0023 0003 00000000 0000 FF 000000 0000 dnl
193 ffff 0018 00002320 0007 001f 0001d604 000000000000f009
194
195 # actions=ct(commit,exec(load:0->NXM_NX_CT_LABEL[64..127],load:0x1d->NXM_NX_CT_LABEL[0..63]))
196 ffff 0048 00002320 0023 0001 00000000 0000 FF 000000 0000 dnl
197 ffff 0018 00002320 0007 103f 0001d810 0000 0000 0000 0000 dnl
198 ffff 0018 00002320 0007 003f 0001d810 0000 0000 0000 001d
199
200 # bad OpenFlow10 actions: OFPBAC_BAD_SET_ARGUMENT
201 & ofp_actions|WARN|cannot set CT fields outside of ct action
202 ffff 0018 00002320 0007 001f 0001d604 000000000000f009
203
204 # bad OpenFlow10 actions: OFPBAC_BAD_SET_ARGUMENT
205 & meta_flow|WARN|destination field ct_zone is not writable
206 ffff 0030 00002320 0023 0001 00000000 0000 FF 000000 0000 dnl
207 ffff 0018 00002320 0007 000f 0001d504 000000000000f009
208
209 # bad OpenFlow10 actions: OFPBAC_BAD_ARGUMENT
210 & ofp_actions|WARN|ct action doesn't support nested action ct
211 ffff 0030 00002320 0023 0001 00000000 0000 FF 000000 0000 dnl
212 ffff 0018 00002320 0023 0000 00000000 0000 FF 000000 0000
213
214 # bad OpenFlow10 actions: OFPBAC_BAD_ARGUMENT
215 & ofp_actions|WARN|ct action doesn't support nested modification of reg0
216 ffff 0030 00002320 0023 0001 00000000 0000 FF 000000 0000 dnl
217 ffff 0018 00002320 0007 001f 00010004 000000000000f009
218
219 # actions=ct(alg=ftp)
220 ffff 0018 00002320 0023 0000 00000000 0000 FF 000000 0015
221
222 # actions=ct(alg=tftp)
223 ffff 0018 00002320 0023 0000 00000000 0000 FF 000000 0045
224
225 # actions=ct(commit,nat(src))
226 ffff 0028 00002320 0023 0001 00000000 0000 FF 000000 0000 dnl
227 ffff 0010 00002320 0024 00 00 0001 0000
228
229 # actions=ct(commit,nat(dst))
230 ffff 0028 00002320 0023 0001 00000000 0000 FF 000000 0000 dnl
231 ffff 0010 00002320 0024 00 00 0002 0000
232
233 # actions=ct(nat)
234 ffff 0028 00002320 0023 0000 00000000 0000 FF 000000 0000 dnl
235 ffff 0010 00002320 0024 00 00 0000 0000
236
237 # actions=ct(commit,nat(src=10.0.0.240,random))
238 ffff 0030 00002320 0023 0001 00000000 0000 FF 000000 0000 dnl
239 ffff 0018 00002320 0024 00 00 0011 0001 0a0000f0 00000000
240
241 # actions=ct(commit,nat(src=10.0.0.240:32768-65535,random))
242 ffff 0030 00002320 0023 0001 00000000 0000 FF 000000 0000 dnl
243 ffff 0018 00002320 0024 00 00 0011 0031 0a0000f0 8000ffff
244
245 # actions=ct(commit,nat(dst=10.0.0.128-10.0.0.254,hash))
246 ffff 0030 00002320 0023 0001 00000000 0000 FF 000000 0000 dnl
247 ffff 0018 00002320 0024 00 00 000a 0003 0a000080 0a0000fe
248
249 # actions=ct(commit,nat(src=10.0.0.240-10.0.0.254:32768-65535,persistent))
250 ffff 0038 00002320 0023 0001 00000000 0000 FF 000000 0000 dnl
251 ffff 0020 00002320 0024 00 00 0005 0033 0a0000f0 0a0000fe 8000ffff 00000000
252
253 # actions=ct(commit,nat(src=fe80::20c:29ff:fe88:a18b,random))
254 ffff 0038 00002320 0023 0001 00000000 0000 FF 000000 0000 dnl
255 ffff 0020 00002320 0024 00 00 0011 0004 fe800000 00000000 020c 29ff fe88 a18b
256
257 # actions=ct(commit,nat(src=fe80::20c:29ff:fe88:1-fe80::20c:29ff:fe88:a18b,random))
258 ffff 0048 00002320 0023 0001 00000000 0000 FF 000000 0000 dnl
259 ffff 0030 00002320 0024 00 00 0011 000c fe800000 00000000 020c 29ff fe88 0001 fe800000 00000000 020c 29ff fe88 a18b
260
261 # actions=ct(commit,nat(src=[fe80::20c:29ff:fe88:1]-[fe80::20c:29ff:fe88:a18b]:255-4096,random))
262 ffff 0050 00002320 0023 0001 00000000 0000 FF 000000 0000 dnl
263 ffff 0038 00002320 0024 00 00 0011 003c dnl
264 fe800000 00000000 020c 29ff fe88 0001 dnl
265 fe800000 00000000 020c 29ff fe88 a18b dnl
266 00ff1000 00000000
267
268 # actions=ct_clear
269 ffff 0010 00002320 002b 000000000000
270
271 # actions=output(port=1,max_len=100)
272 ffff 0010 00002320 0027 0001 00000064
273
274 # actions=clone(mod_vlan_vid:5,output:10)
275 ffff 0020 00002320 002a 000000000000 dnl
276 0001 0008 0005 0000 dnl
277 0000 0008 000a 0000
278
279 # actions=learn(table=2,priority=0,NXM_OF_VLAN_TCI[0..11],NXM_OF_ETH_DST[]=NXM_OF_ETH_SRC[],output:NXM_OF_IN_PORT[])
280 ffff 0050 00002320 002d 0000 0000 0000 0000000000000000 0000 02 00 0000 0000 00000000 0000 0000 dnl
281 000c 00000802 0000 00000802 0000 dnl
282 0030 00000406 0000 00000206 0000 dnl
283 1010 00000002 0000 dnl
284 00000000
285
286 # actions=learn(table=2,idle_timeout=10,hard_timeout=20,fin_idle_timeout=2,fin_hard_timeout=4,priority=80,cookie=0x123456789abcdef0,limit=1,NXM_OF_VLAN_TCI[0..11],NXM_OF_ETH_DST[]=NXM_OF_ETH_SRC[],output:NXM_OF_IN_PORT[])
287 ffff 0050 00002320 002d 000a 0014 0050 123456789abcdef0 0000 02 00 0002 0004 00000001 0000 0000 dnl
288 000c 00000802 0000 00000802 0000 dnl
289 0030 00000406 0000 00000206 0000 dnl
290 1010 00000002 0000 dnl
291 00000000
292
293 # actions=learn(table=2,idle_timeout=10,hard_timeout=20,fin_idle_timeout=2,fin_hard_timeout=4,priority=80,cookie=0x123456789abcdef0,limit=1,result_dst=NXM_NX_REG0[8],NXM_OF_VLAN_TCI[0..11],NXM_OF_ETH_DST[]=NXM_OF_ETH_SRC[],output:NXM_OF_IN_PORT[])
294 ffff 0050 00002320 002d 000a 0014 0050 123456789abcdef0 0004 02 00 0002 0004 00000001 0008 0000 dnl
295 00010004 dnl
296 000c 00000802 0000 00000802 0000 dnl
297 0030 00000406 0000 00000206 0000 dnl
298 1010 00000002 0000
299
300 # actions=group:5
301 ffff 0010 00002320 0028 0000 00000005
302
303 # bad OpenFlow10 actions: NXBRC_MUST_BE_ZERO
304 ffff 0018 00002320 0025 0000 0005 0000 1122334455 000005
305
306 # bad OpenFlow10 actions: NXBRC_MUST_BE_ZERO
307 ffff 0018 00002320 0025 0000 0005 5000 1122334455 000000
308
309 # bad OpenFlow10 actions: OFPBAC_BAD_ARGUMENT
310 ffff 0048 00002320 0023 0001 00000000 0000 FF 000000 0000 dnl
311 ffff 0030 00002320 0024 00 00 0011 000c fe800000 00000000 020c 29ff fe88 a18b fe800000 00000000 020c 29ff fe88 0001
312
313 # actions=check_pkt_larger(1500)->NXM_NX_REG0[0]
314 ffff 0018 00002320 0031 05dc 000000010004000000000000
315
316 # actions=check_pkt_larger(1000)->NXM_NX_XXREG1[4]
317 ffff 0018 00002320 0031 03e8 00040001e010000000000000
318
319 ])
320 sed '/^[[#&]]/d' < test-data > input.txt
321 sed -n 's/^# //p; /^$/p' < test-data > expout
322 sed -n 's/^& //p' < test-data > experr
323 AT_CAPTURE_FILE([input.txt])
324 AT_CAPTURE_FILE([expout])
325 AT_CAPTURE_FILE([experr])
326 AT_CHECK(
327 [ovs-ofctl '-vPATTERN:console:%c|%p|%m' parse-actions OpenFlow10 < input.txt],
328 [0], [expout], [experr])
329 AT_CLEANUP
330
331 AT_SETUP([OpenFlow 1.0 "instruction" translations])
332 AT_KEYWORDS([ofp-actions OF1.0 instruction])
333 AT_DATA([test-data], [dnl
334 dnl Try a couple of ordinary actions to make sure they're accepted,
335 dnl but there's no point in retrying all the actions from the previous test.
336 # actions=LOCAL
337 0000 0008 fffe 04d2
338
339 # actions=mod_dl_src:00:11:22:33:44:55
340 0004 0010 001122334455 000000000000
341
342 dnl Now check that write_metadata is accepted.
343 # actions=write_metadata:0xfedcba9876543210
344 ffff 0020 00002320 0016 000000000000 fedcba9876543210 ffffffffffffffff
345
346 # actions=write_metadata:0xfedcba9876543210/0xffff0000ffff0000
347 ffff 0020 00002320 0016 000000000000 fedcba9876543210 ffff0000ffff0000
348
349 ])
350 sed '/^[[#&]]/d' < test-data > input.txt
351 sed -n 's/^# //p; /^$/p' < test-data > expout
352 sed -n 's/^& //p' < test-data > experr
353 AT_CAPTURE_FILE([input.txt])
354 AT_CAPTURE_FILE([expout])
355 AT_CAPTURE_FILE([experr])
356 AT_CHECK(
357 [ovs-ofctl '-vPATTERN:console:%c|%p|%m' parse-instructions OpenFlow10 < input.txt],
358 [0], [expout], [experr])
359 AT_CLEANUP
360
361 AT_SETUP([OpenFlow 1.1 action translation])
362 AT_KEYWORDS([ofp-actions OF1.1])
363 AT_DATA([test-data], [dnl
364 # actions=LOCAL
365 0000 0010 fffffffe 04d2 000000000000
366
367 # actions=CONTROLLER:1234
368 0000 0010 fffffffd 04d2 000000000000
369
370 # actions=set_vlan_vid:9
371 0001 0008 0009 0000
372
373 # actions=set_vlan_pcp:6
374 0002 0008 06 000000
375
376 # actions=mod_dl_src:00:11:22:33:44:55
377 0003 0010 001122334455 000000000000
378
379 # actions=mod_dl_dst:10:20:30:40:50:60
380 0004 0010 102030405060 000000000000
381
382 # actions=mod_nw_src:1.2.3.4
383 0005 0008 01020304
384
385 # actions=mod_nw_dst:192.168.0.1
386 0006 0008 c0a80001
387
388 # actions=mod_nw_tos:48
389 0007 0008 30 000000
390
391 # actions=mod_nw_ecn:2
392 0008 0008 02 000000
393
394 # actions=mod_tp_src:80
395 0009 0008 0050 0000
396
397 # actions=mod_tp_dst:443
398 000a 0008 01bb 0000
399
400 # actions=pop_vlan
401 0012 0008 00000000
402
403 # actions=set_queue:2309737729
404 0015 0008 89abcd01
405
406 dnl 802.1ad isn't supported at the moment
407 dnl # actions=push_vlan:0x88a8
408 dnl 0011 0008 88a8 0000
409 # actions=push_vlan:0x8100
410 0011 0008 8100 0000
411
412 # actions=resubmit:5
413 ffff 0010 00002320 0001 0005 00000000
414
415 # actions=set_tunnel:0x12345678
416 ffff 0010 00002320 0002 0000 12345678
417
418 # actions=pop_queue
419 ffff 0010 00002320 0005 000000000000
420
421 # actions=move:NXM_OF_IN_PORT[]->NXM_OF_VLAN_TCI[]
422 ffff 0018 00002320 0006 0010 0000 0000 00000002 00000802
423
424 # actions=load:0xf009->NXM_OF_VLAN_TCI[]
425 ffff 0018 00002320 0007 000f 00000802 000000000000f009
426
427 # actions=note:11.e9.9a.ad.67.f3
428 ffff 0010 00002320 0008 11e99aad67f3
429
430 # actions=set_tunnel64:0xc426384d49c53d60
431 ffff 0018 00002320 0009 000000000000 c426384d49c53d60
432
433 # actions=set_tunnel64:0x885f3298
434 ffff 0018 00002320 0009 000000000000 00000000885f3298
435
436 dnl Write-Metadata is only allowed in contexts that allow instructions.
437 & ofp_actions|WARN|write_metadata instruction not allowed here
438 # bad OpenFlow11 actions: OFPBIC_UNSUP_INST
439 ffff 0020 00002320 0016 000000000000 fedcba9876543210 ffffffffffffffff
440
441 # actions=multipath(eth_src,50,modulo_n,1,0,NXM_NX_REG0[])
442 ffff 0020 00002320 000a 0000 0032 0000 0000 0000 0000 0000 0000 001f 00010004
443
444 # actions=bundle(eth_src,0,hrw,ofport,slaves:4,8)
445 ffff 0028 00002320 000c 0001 0000 0000 00000002 0002 0000 00000000 00000000 dnl
446 0004 0008 00000000
447
448 # actions=bundle_load(eth_src,0,hrw,ofport,NXM_NX_REG0[],slaves:4,8)
449 ffff 0028 00002320 000d 0001 0000 0000 00000002 0002 001f 00010004 00000000 dnl
450 0004 0008 00000000
451
452 # actions=resubmit(10,5)
453 ffff 0010 00002320 000e 000a 05 000000
454
455 # actions=resubmit(10,5,ct)
456 ffff 0010 00002320 002c 000a 05 000000
457
458 # actions=output:NXM_NX_REG1[5..10]
459 ffff 0018 00002320 000f 0145 00010204 ffff 000000000000
460
461 # actions=learn(table=2,idle_timeout=10,hard_timeout=20,fin_idle_timeout=2,fin_hard_timeout=4,priority=80,cookie=0x123456789abcdef0,NXM_OF_VLAN_TCI[0..11],NXM_OF_ETH_DST[]=NXM_OF_ETH_SRC[],output:NXM_OF_IN_PORT[])
462 ffff 0048 00002320 0010 000a 0014 0050 123456789abcdef0 0000 02 00 0002 0004 dnl
463 000c 00000802 0000 00000802 0000 dnl
464 0030 00000406 0000 00000206 0000 dnl
465 1010 00000002 0000 dnl
466 00000000
467
468 # actions=exit
469 ffff 0010 00002320 0011 000000000000
470
471 dnl OpenFlow 1.1 OFPAT_DEC_TTL
472 # actions=dec_ttl
473 0018 0008 00000000
474
475 # actions=fin_timeout(idle_timeout=10,hard_timeout=20)
476 ffff 0010 00002320 0013 000a 0014 0000
477
478 # actions=controller(reason=invalid_ttl,max_len=1234,id=5678)
479 ffff 0010 00002320 0014 04d2 162e 02 00
480
481 # actions=dec_ttl(32768,12345,90,765,1024)
482 ffff 0020 00002320 0015 000500000000 80003039005A02fd 0400000000000000
483
484 # actions=sample(probability=12345,collector_set_id=23456,obs_domain_id=34567,obs_point_id=45678)
485 ffff 0018 00002320 001d 3039 00005BA0 00008707 0000B26E
486
487 # bad OpenFlow11 actions: OFPBAC_BAD_OUT_PORT
488 & ofp_actions|WARN|bad action at offset 0 (OFPBAC_BAD_OUT_PORT):
489 & 00000000 00 00 00 10 ff ff ff ff-00 00 00 00 00 00 00 00
490 0000 0010 ffffffff 0000 000000000000
491
492 ])
493 sed '/^[[#&]]/d' < test-data > input.txt
494 sed -n 's/^# //p; /^$/p' < test-data > expout
495 sed -n 's/^& //p' < test-data > experr
496 AT_CAPTURE_FILE([input.txt])
497 AT_CAPTURE_FILE([expout])
498 AT_CAPTURE_FILE([experr])
499 AT_CHECK(
500 [ovs-ofctl '-vPATTERN:console:%c|%p|%m' parse-actions OpenFlow11 < input.txt],
501 [0], [expout], [experr])
502 AT_CLEANUP
503
504 AT_SETUP([OpenFlow 1.1 instruction translation])
505 AT_KEYWORDS([OF1.1 instruction ofp-actions])
506 AT_DATA([test-data], [dnl
507 # actions=LOCAL
508 0004 0018 00000000 dnl
509 0000 0010 fffffffe 04d2 000000000000
510
511 dnl Apply-Actions non-zero padding
512 # actions=drop
513 # 0: 00 -> (none)
514 # 1: 04 -> (none)
515 # 2: 00 -> (none)
516 # 3: 08 -> (none)
517 # 4: 00 -> (none)
518 # 5: 00 -> (none)
519 # 6: 00 -> (none)
520 # 7: 01 -> (none)
521 0004 0008 00000001
522
523 dnl Check that an empty Apply-Actions instruction gets dropped.
524 # actions=drop
525 # 0: 00 -> (none)
526 # 1: 04 -> (none)
527 # 2: 00 -> (none)
528 # 3: 08 -> (none)
529 # 4: 00 -> (none)
530 # 5: 00 -> (none)
531 # 6: 00 -> (none)
532 # 7: 00 -> (none)
533 0004 0008 00000000
534
535 dnl Duplicate instruction type:
536 # bad OpenFlow11 instructions: OFPBIC_DUP_INST
537 0004 0008 00000000 0004 0008 00000000
538
539 dnl Instructions not multiple of 8 in length.
540 & ofp_actions|WARN|OpenFlow message instructions length 9 is not a multiple of 8
541 # bad OpenFlow11 instructions: OFPBIC_BAD_LEN
542 0004 0009 01 00000000
543
544 dnl Goto-Table instruction too long.
545 # bad OpenFlow11 instructions: OFPBIC_BAD_LEN
546 0001 0010 01 000000 0000000000000000
547
548 dnl Goto-Table 1 instruction non-zero padding
549 # actions=goto_table:1
550 # 7: 01 -> 00
551 0001 0008 01 000001
552
553 dnl Goto-Table 1 instruction go back to the previous table.
554 # bad OpenFlow11 instructions: OFPBIC_BAD_TABLE_ID
555 2,0001 0008 01 000000
556
557 dnl Goto-Table 1
558 # actions=goto_table:1
559 0001 0008 01 000000
560
561 dnl Write-Metadata.
562 # actions=write_metadata:0xfedcba9876543210
563 0002 0018 00000000 fedcba9876543210 ffffffffffffffff
564
565 dnl Write-Metadata as Nicira extension action is transformed into instruction.
566 # actions=write_metadata:0xfedcba9876543210
567 # 1: 04 -> 02
568 # 3: 28 -> 18
569 # 8: ff -> fe
570 # 9: ff -> dc
571 # 10: 00 -> ba
572 # 11: 20 -> 98
573 # 12: 00 -> 76
574 # 13: 00 -> 54
575 # 14: 23 -> 32
576 # 15: 20 -> 10
577 # 16: 00 -> ff
578 # 17: 16 -> ff
579 # 18: 00 -> ff
580 # 19: 00 -> ff
581 # 20: 00 -> ff
582 # 21: 00 -> ff
583 # 22: 00 -> ff
584 # 23: 00 -> ff
585 # 24: fe -> (none)
586 # 25: dc -> (none)
587 # 26: ba -> (none)
588 # 27: 98 -> (none)
589 # 28: 76 -> (none)
590 # 29: 54 -> (none)
591 # 30: 32 -> (none)
592 # 31: 10 -> (none)
593 # 32: ff -> (none)
594 # 33: ff -> (none)
595 # 34: ff -> (none)
596 # 35: ff -> (none)
597 # 36: ff -> (none)
598 # 37: ff -> (none)
599 # 38: ff -> (none)
600 # 39: ff -> (none)
601 0004 0028 00000000 ffff 0020 00002320 0016 000000000000 fedcba9876543210 ffffffffffffffff
602
603 dnl Write-Metadata with mask.
604 # actions=write_metadata:0xfedcba9876543210/0xff00ff00ff00ff00
605 0002 0018 00000000 fedcba9876543210 ff00ff00ff00ff00
606
607 dnl Write-Metadata too short.
608 # bad OpenFlow11 instructions: OFPBIC_BAD_LEN
609 0002 0010 00000000 fedcba9876543210
610
611 dnl Write-Metadata too long.
612 # bad OpenFlow11 instructions: OFPBIC_BAD_LEN
613 0002 0020 00000000 fedcba9876543210 ffffffffffffffff 0000000000000000
614
615 dnl Write-Metadata duplicated.
616 # bad OpenFlow11 instructions: OFPBIC_DUP_INST
617 0002 0018 00000000 fedcba9876543210 ff00ff00ff00ff00 0002 0018 00000000 fedcba9876543210 ff00ff00ff00ff00
618
619 dnl Write-Metadata in wrong position (OpenFlow 1.1+ disregards the order
620 dnl and OVS reorders it to the canonical order)
621 # actions=write_metadata:0xfedcba9876543210,goto_table:1
622 # 1: 01 -> 02
623 # 3: 08 -> 18
624 # 4: 01 -> 00
625 # 8: 00 -> fe
626 # 9: 02 -> dc
627 # 10: 00 -> ba
628 # 11: 18 -> 98
629 # 12: 00 -> 76
630 # 13: 00 -> 54
631 # 14: 00 -> 32
632 # 15: 00 -> 10
633 # 16: fe -> ff
634 # 17: dc -> ff
635 # 18: ba -> ff
636 # 19: 98 -> ff
637 # 20: 76 -> ff
638 # 21: 54 -> ff
639 # 22: 32 -> ff
640 # 23: 10 -> ff
641 # 24: ff -> 00
642 # 25: ff -> 01
643 # 26: ff -> 00
644 # 27: ff -> 08
645 # 28: ff -> 01
646 # 29: ff -> 00
647 # 30: ff -> 00
648 # 31: ff -> 00
649 0001 0008 01 000000 0002 0018 00000000 fedcba9876543210 ffffffffffffffff
650
651 dnl empty Write-Actions non-zero padding
652 # actions=write_actions(drop)
653 # 0: 00 -> (none)
654 # 1: 03 -> (none)
655 # 2: 00 -> (none)
656 # 3: 08 -> (none)
657 # 4: 00 -> (none)
658 # 5: 00 -> (none)
659 # 6: 00 -> (none)
660 # 7: 01 -> (none)
661 0003 0008 00000001
662
663 dnl Check that an empty Write-Actions instruction gets dropped.
664 # actions=write_actions(drop)
665 # 0: 00 -> (none)
666 # 1: 03 -> (none)
667 # 2: 00 -> (none)
668 # 3: 08 -> (none)
669 # 4: 00 -> (none)
670 # 5: 00 -> (none)
671 # 6: 00 -> (none)
672 # 7: 00 -> (none)
673 0003 0008 00000000
674
675 dnl Clear-Actions too-long
676 # bad OpenFlow11 instructions: OFPBIC_BAD_LEN
677 0005 0010 00000000 0000000000000000
678
679 dnl Clear-Actions non-zero padding
680 # actions=clear_actions
681 # 7: 01 -> 00
682 0005 0008 00000001
683
684 dnl Clear-Actions non-zero padding
685 # actions=clear_actions
686 # 4: 01 -> 00
687 0005 0008 01 000000
688
689 dnl Clear-Actions
690 # actions=clear_actions
691 0005 0008 00000000
692
693 dnl Experimenter actions not supported yet.
694 # bad OpenFlow11 instructions: OFPBIC_BAD_EXPERIMENTER
695 ffff 0008 01 000000
696
697 dnl Bad instruction number (0 not assigned).
698 # bad OpenFlow11 instructions: OFPBIC_UNKNOWN_INST
699 0000 0008 01 000000
700
701 ])
702 sed '/^[[#&]]/d' < test-data > input.txt
703 sed -n 's/^# //p; /^$/p' < test-data > expout
704 sed -n 's/^& //p' < test-data > experr
705 AT_CAPTURE_FILE([input.txt])
706 AT_CAPTURE_FILE([expout])
707 AT_CAPTURE_FILE([experr])
708 AT_CHECK(
709 [ovs-ofctl '-vPATTERN:console:%c|%p|%m' parse-instructions OpenFlow11 < input.txt],
710 [0], [expout], [experr])
711 AT_CLEANUP
712
713 dnl Our primary goal here is to verify OpenFlow 1.2-specific changes,
714 dnl so the list of tests is short.
715 AT_SETUP([OpenFlow 1.2 action translation])
716 AT_KEYWORDS([ofp-actions OF1.2])
717 AT_DATA([test-data], [dnl
718 # actions=LOCAL
719 0000 0010 fffffffe 04d2 000000000000
720
721 # bad OpenFlow12 actions: OFPBAC_BAD_SET_MASK
722 & ofp_actions|WARN|bad action at offset 0 (OFPBAC_BAD_SET_MASK):
723 & 00000000 00 19 00 18 80 00 09 0c-00 00 00 00 12 34 00 00
724 & 00000010 00 00 ff ff 00 00 00 00-
725 0019 0018 8000090c 000000001234 00000000ffff 00000000
726
727 ])
728 sed '/^[[#&]]/d' < test-data > input.txt
729 sed -n 's/^# //p; /^$/p' < test-data > expout
730 sed -n 's/^& //p' < test-data > experr
731 AT_CAPTURE_FILE([input.txt])
732 AT_CAPTURE_FILE([expout])
733 AT_CAPTURE_FILE([experr])
734 AT_CHECK(
735 [ovs-ofctl '-vPATTERN:console:%c|%p|%m' parse-actions OpenFlow12 < input.txt],
736 [0], [expout], [experr])
737 AT_CLEANUP
738
739 dnl Our primary goal here is to verify OpenFlow 1.3-specific changes,
740 dnl so the list of tests is short.
741 AT_SETUP([OpenFlow 1.3 action translation])
742 AT_KEYWORDS([ofp-actions OF1.3])
743 AT_DATA([test-data], [dnl
744 # actions=LOCAL
745 0000 0010 fffffffe 04d2 000000000000
746
747 dnl Check the Nicira extension form of "move".
748 # actions=move:NXM_OF_IN_PORT[]->NXM_OF_VLAN_TCI[]
749 ffff 0018 00002320 0006 0010 0000 0000 00000002 00000802
750
751 dnl Check the ONF extension form of "copy_field".
752 # actions=move:NXM_OF_IN_PORT[]->NXM_OF_VLAN_TCI[]
753 ffff 0020 4f4e4600 0c80 0000 0010 0000 0000 0000 00000002 00000802 00000000
754
755 dnl Check OpenFlow v1.3.4 Conformance Test: 430.500.
756 # bad OpenFlow13 actions: OFPBAC_BAD_SET_TYPE
757 & ofp_actions|WARN|bad action at offset 0 (OFPBAC_BAD_SET_TYPE):
758 & 00000000 00 19 00 08 80 00 fe 00-00 00 00 10 00 00 00 01
759 & 00000010 00 00 00 00 00 00 00 00-
760 0019 0008 8000fe00 000000100000 000100000000 00000000
761
762 dnl Check OpenFlow v1.3.4 Conformance Test: 430.510.
763 # bad OpenFlow13 actions: OFPBAC_BAD_SET_LEN
764 & ofp_actions|WARN|bad action at offset 0 (OFPBAC_BAD_SET_LEN):
765 & 00000000 00 19 00 10 80 00 08 07-00 01 02 03 04 05 00 00
766 & 00000010 00 00 00 10 00 00 00 01-
767 0019 0010 80000807 000102030405 000000000010 00000001
768
769 ])
770 sed '/^[[#&]]/d' < test-data > input.txt
771 sed -n 's/^# //p; /^$/p' < test-data > expout
772 sed -n 's/^& //p' < test-data > experr
773 AT_CAPTURE_FILE([input.txt])
774 AT_CAPTURE_FILE([expout])
775 AT_CAPTURE_FILE([experr])
776 AT_CHECK(
777 [ovs-ofctl '-vPATTERN:console:%c|%p|%m' parse-actions OpenFlow13 < input.txt],
778 [0], [expout], [experr])
779 AT_CLEANUP
780
781 dnl Our primary goal here is to verify that OpenFlow 1.5-specific changes,
782 dnl so the list of tests is short.
783 AT_SETUP([OpenFlow 1.5 action translation])
784 AT_KEYWORDS([ofp-actions OF1.5])
785 AT_DATA([test-data], [dnl
786 # actions=LOCAL
787 0000 0010 fffffffe 04d2 000000000000
788
789 # actions=move:NXM_OF_IN_PORT[]->NXM_OF_VLAN_TCI[]
790 001c 0018 0010 0000 0000 0000 00000002 00000802 00000000
791
792 # actions=set_field:00:00:00:00:12:34/00:00:00:00:ff:ff->eth_src
793 0019 0018 8000090c 000000001234 00000000ffff 00000000
794
795 # actions=meter:5
796 001d 0008 00000005
797
798 ])
799 sed '/^[[#&]]/d' < test-data > input.txt
800 sed -n 's/^# //p; /^$/p' < test-data > expout
801 sed -n 's/^& //p' < test-data > experr
802 AT_CAPTURE_FILE([input.txt])
803 AT_CAPTURE_FILE([expout])
804 AT_CAPTURE_FILE([experr])
805 AT_CHECK(
806 [ovs-ofctl '-vPATTERN:console:%c|%p|%m' parse-actions OpenFlow15 < input.txt],
807 [0], [expout], [experr])
808 AT_CLEANUP
809
810 AT_SETUP([ofp-actions - inconsistent MPLS actions])
811 OVS_VSWITCHD_START
812 dnl OK: Use fin_timeout action on TCP flow
813 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn add-flow br0 'tcp actions=fin_timeout(idle_timeout=1)'])
814 dnl Bad: Use fin_timeout action on TCP flow that has been converted to MPLS
815 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn add-flow br0 'tcp actions=push_mpls:0x8847,fin_timeout(idle_timeout=1)'],
816 [1], [], [dnl
817 ovs-ofctl: none of the usable flow formats (OpenFlow10,NXM) is among the allowed flow formats (OpenFlow11)
818 ])
819 OVS_VSWITCHD_STOP
820 AT_CLEANUP
821
822 AT_SETUP([reg_load <-> set_field translation corner case])
823 AT_KEYWORDS([ofp-actions])
824 OVS_VSWITCHD_START
825 dnl In OpenFlow 1.3, set_field always sets all the bits in the field,
826 dnl but when we translate to NXAST_LOAD we need to only set the bits that
827 dnl actually exist (e.g. mpls_label only has 20 bits) otherwise OVS rejects
828 dnl the "load" action as invalid. Check that we do this correctly.
829 AT_CHECK([ovs-ofctl -O OpenFlow13 add-flow br0 mpls,actions=set_field:10-\>mpls_label])
830 AT_CHECK([ovs-ofctl -O OpenFlow10 dump-flows br0 | ofctl_strip], [0], [dnl
831 NXST_FLOW reply:
832 mpls actions=load:0xa->OXM_OF_MPLS_LABEL[[]]
833 ])
834 OVS_VSWITCHD_STOP
835 AT_CLEANUP
836
837 AT_SETUP([enqueue action for OF1.1+])
838 AT_KEYWORDS([ofp-actions])
839 OVS_VSWITCHD_START
840 dnl OpenFlow 1.0 has an "enqueue" action. For OpenFlow 1.1+, we translate
841 dnl it to a series of actions that accomplish the same thing.
842 AT_CHECK([ovs-ofctl -O OpenFlow10 add-flow br0 'actions=enqueue(123,456)'])
843 AT_CHECK([ovs-ofctl -O OpenFlow10 dump-flows br0 | ofctl_strip], [0], [dnl
844 NXST_FLOW reply:
845 actions=enqueue:123:456
846 ])
847 AT_CHECK([ovs-ofctl -O OpenFlow13 dump-flows br0 | ofctl_strip], [0], [dnl
848 OFPST_FLOW reply (OF1.3):
849 reset_counts actions=set_queue:456,output:123,pop_queue
850 ])
851 OVS_VSWITCHD_STOP
852 AT_CLEANUP
853
854 AT_SETUP([mod_nw_ttl action for OF1.0])
855 AT_KEYWORDS([ofp-actions])
856 OVS_VSWITCHD_START
857 dnl OpenFlow 1.1+ have a mod_nw_ttl action. For OpenFlow 1.0, we translate
858 dnl it to an Open vSwitch extension.
859 AT_CHECK([ovs-ofctl -O OpenFlow11 add-flow br0 'ip,actions=mod_nw_ttl:123'])
860 AT_CHECK([ovs-ofctl -O OpenFlow10 dump-flows br0 | ofctl_strip], [0], [dnl
861 NXST_FLOW reply:
862 ip actions=load:0x7b->NXM_NX_IP_TTL[[]]
863 ])
864 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip], [0], [dnl
865 OFPST_FLOW reply (OF1.1):
866 ip actions=mod_nw_ttl:123
867 ])
868 OVS_VSWITCHD_STOP
869 AT_CLEANUP
870
871 AT_SETUP([mod_nw_ecn action translation])
872 AT_KEYWORDS([ofp-actions])
873 OVS_VSWITCHD_START
874
875 dnl OpenFlow 1.1, but no other version, has a "mod_nw_ecn" action.
876 dnl Check that we translate it properly for OF1.0 and OF1.2.
877 dnl (OF1.3+ should be the same as OF1.2.)
878 AT_CHECK([ovs-ofctl -O OpenFlow11 add-flow br0 'ip,actions=mod_nw_ecn:2'])
879 AT_CHECK([ovs-ofctl -O OpenFlow10 dump-flows br0 | ofctl_strip], [0], [dnl
880 NXST_FLOW reply:
881 ip actions=load:0x2->NXM_NX_IP_ECN[[]]
882 ])
883 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip], [0], [dnl
884 OFPST_FLOW reply (OF1.1):
885 ip actions=mod_nw_ecn:2
886 ])
887 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip], [0], [dnl
888 OFPST_FLOW reply (OF1.2):
889 ip actions=set_field:2->nw_ecn
890 ])
891
892 dnl Check that OF1.2+ set_field to set ECN is translated into the OF1.1
893 dnl mod_nw_ecn action.
894 dnl
895 dnl We don't do anything equivalent for OF1.0 reg_load because we prefer
896 dnl that anything that comes in as reg_load gets translated back to reg_load
897 dnl on output. Perhaps this is somewhat inconsistent but it's what OVS
898 dnl has done for multiple versions.
899 AT_CHECK([ovs-ofctl del-flows br0])
900 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 'ip,actions=set_field:2->ip_ecn'])
901 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip], [0], [dnl
902 OFPST_FLOW reply (OF1.1):
903 ip actions=mod_nw_ecn:2
904 ])
905
906 dnl Check that OF1.2+ set_field to set ECN is translated for earlier OF
907 dnl versions.
908 AT_CHECK([ovs-ofctl del-flows br0])
909 AT_CHECK([ovs-ofctl -O OpenFlow10 add-flow br0 'ip,actions=set_field:2->ip_ecn'])
910 AT_CHECK([ovs-ofctl del-flows br0])
911 AT_CHECK([ovs-ofctl -O OpenFlow11 add-flow br0 'ip,actions=set_field:2->ip_ecn'])
912
913 OVS_VSWITCHD_STOP
914 AT_CLEANUP
915
916 AT_SETUP([action parsing errors])
917 bad_action () {
918 AT_CHECK_UNQUOTED([ovs-ofctl parse-flow "actions=$1"], [1], [],
919 [ovs-ofctl: $2
920 ])
921 }
922
923 # output
924 bad_action 'output(port=xyzzy,max_len=5)' \
925 "output to unknown truncate port: xyzzy"
926 bad_action 'output(port=all,max_len=64)' \
927 "output to unsupported truncate port: all"
928 bad_action 'output(port=local,max_len=64,foo=bar)' \
929 "invalid key 'foo' in output_trunc argument"
930 bad_action 'output(port=local,max_len=5)' \
931 "max_len 5 is less than the minimum value 14"
932
933 # controller
934 bad_action 'controller(reason=asdf)' 'unknown reason "asdf"'
935 bad_action 'controller(foo=bar)' 'unknown key "foo" parsing controller action'
936 bad_action 'controller(userdata=123x456)' \
937 'bad hex digit in `controller'\'' action `userdata'\'
938
939 # enqueue
940 bad_action 'enqueue:123' \
941 '"enqueue" syntax is "enqueue:PORT:QUEUE" or "enqueue(PORT,QUEUE)"'
942 bad_action 'enqueue:asdf:123' 'asdf: enqueue to unknown port'
943
944 # bundle
945 bad_action 'bundle:123' '123: not enough arguments to bundle action'
946 bad_action 'bundle(symmetric_l4,60,hrw,ofport,ports:1,2,3,4,5)' \
947 "symmetric_l4,60,hrw,ofport,ports:1,2,3,4,5: missing slave delimiter, expected \`slaves' got \`ports'"
948 bad_action 'bundle(symmetric_l4,60,hrw,ofport,slaves:xyzzy,2,3,4,5)' \
949 'xyzzy: bad port number'
950 bad_action 'bundle(asymmetric_l4,60,hrw,ofport,slaves:1,2,3,4,5)' \
951 "asymmetric_l4,60,hrw,ofport,slaves:1,2,3,4,5: unknown fields \`asymmetric_l4'"
952 bad_action 'bundle(symmetric_l4,60,hrt,ofport,slaves:1,2,3,4,5)' \
953 "symmetric_l4,60,hrt,ofport,slaves:1,2,3,4,5: unknown algorithm \`hrt'"
954 bad_action 'bundle(symmetric_l4,60,hrw,odpport,slaves:1,2,3,4,5)' \
955 "symmetric_l4,60,hrw,odpport,slaves:1,2,3,4,5: unknown slave_type \`odpport'"
956 bad_action 'bundle_load(symmetric_l4,60,hrw,ofport,actset_output,slaves:1,2,3,4,5)' \
957 "symmetric_l4,60,hrw,ofport,actset_output,slaves:1,2,3,4,5: experimenter OXM field 'actset_output' not supported"
958
959 # mod_vlan_vid
960 bad_action 'mod_vlan_vid:6000' '6000: not a valid VLAN VID'
961
962 # mod_vlan_pcp
963 bad_action 'mod_vlan_pcp:8' '8: not a valid VLAN PCP'
964
965 # push_vlan
966 bad_action 'push_vlan(0x1234)' '0x1234: not a valid VLAN ethertype'
967
968 # mod_nw_tos
969 bad_action 'mod_nw_tos(1)' '1: not a valid TOS'
970
971 # mod_nw_ecn
972 bad_action 'mod_nw_ecn(5)' '5: not a valid ECN'
973
974 # set_field
975 bad_action 'set_field:1' "1: missing \`->'"
976 bad_action 'set_field:1->' "1->: missing field name following \`->'"
977 bad_action 'set_field:1->x' 'x is not a valid OXM field name'
978 bad_action 'set_field:1->eth_type' 'eth_type is read-only'
979 bad_action 'set_field:1->eth_src' '1: invalid Ethernet address'
980 bad_action 'set_field:0xffff->ip_dscp' '0xffff: value too large for 1-byte field ip_dscp'
981 bad_action 'set_field:0xff->ip_dscp' '0xff is not a valid value for field ip_dscp'
982
983 # reg_load
984 bad_action 'load:xyzzy->eth_src' 'xyzzy->eth_src: cannot parse integer value'
985 bad_action 'load:0xff->eth_src[[1..5]]' '0xff->eth_src[[1..5]]: value 00:00:00:00:00:ff does not fit into 5 bits'
986
987 # push/pop
988 bad_action 'push(eth_dst[[]]x)' 'x: trailing garbage following push or pop'
989
990 # dec_ttl
991 bad_action 'dec_ttl(,)' 'dec_ttl_cnt_ids: expected at least one controller id.'
992
993 # set_mpls_label
994 bad_action 'set_mpls_label' 'set_mpls_label: expected label.'
995
996 # set_mpls_tc
997 bad_action 'set_mpls_tc' 'set_mpls_tc: expected tc.'
998
999 # set_mpls_ttl
1000 bad_action 'set_mpls_ttl' 'set_mpls_ttl: expected ttl.'
1001
1002 # fin_timeout
1003 bad_action 'fin_timeout(foo=bar)' "invalid key 'foo' in 'fin_timeout' argument"
1004
1005 # encap
1006 bad_action 'encap(,)' 'Missing encap hdr: ,'
1007 bad_action 'encap(x(y))' 'Encap hdr not supported: y'
1008 bad_action 'encap(nsh(type=1))' 'Invalid property: type'
1009 bad_action 'encap(nsh(md_type))' 'Value missing for encap property'
1010 bad_action 'encap(nsh(md_type=3))' 'invalid md_type'
1011 bad_action 'encap(nsh(tlv(,,)))' 'Invalid NSH TLV header: ,,'
1012
1013 # decap
1014 bad_action 'decap(packet_type(x))' 'Missing packet_type attribute ns'
1015 bad_action 'decap(packet_type(ns=99))' 'Unsupported ns value: 99'
1016 bad_action 'decap(packet_type(ns=0))' 'Missing packet_type attribute type'
1017 bad_action 'decap(foo=bar)' 'Invalid decap argument: foo'
1018
1019 # resubmit
1020 bad_action 'resubmit(asdf)' 'asdf: resubmit to unknown port'
1021 bad_action 'resubmit(,asdf)' 'asdf: resubmit to unknown table'
1022 bad_action 'resubmit(1,2,xyzzy)' 'xyzzy: unknown parameter'
1023 bad_action 'resubmit(in_port,255)' 'at least one "in_port" or "table" must be specified on resubmit'
1024
1025 # learn
1026 bad_action 'learn(load:123->actset_output)' \
1027 "123->actset_output: experimenter OXM field 'actset_output' not supported"
1028 bad_action 'learn(load:1234->eth_dst[[0..5]])' \
1029 '1234->eth_dst[[0..5]]: value does not fit into 6 bits'
1030 bad_action 'learn(actset_output=0x1000)' \
1031 "actset_output=0x1000: experimenter OXM field 'actset_output' not supported"
1032 bad_action 'learn(eth_type[[5]]=xyzzy)' \
1033 "eth_type[[5]]=xyzzy: eth_type[[5]] value xyzzy cannot be parsed as a subfield (xyzzy: unknown field \`xyzzy') or an immediate value (eth_type[[5]]=xyzzy: cannot parse integer value)"
1034 bad_action 'learn(eth_type[[0]]=eth_type[[1..2]])' \
1035 'eth_type[[0]]=eth_type[[1..2]]: bit widths of eth_type[[0]] (2) and eth_type[[1..2]] (1) differ'
1036 bad_action 'learn(load:->)' "load: missing source before \`->' in \`->'"
1037 bad_action 'learn(load:x)' "load: missing \`->' in \`x'"
1038 bad_action 'learn(load:1x->foo)' "load: garbage before \`->' in \`1x->foo'"
1039 bad_action 'learn(foo)' 'foo: unknown keyword foo'
1040 bad_action 'learn(table=foo)' 'unknown table "foo"'
1041 bad_action 'learn(table=255)' "table=255: table id 255 not valid for \`learn' action"
1042 bad_action 'learn(result_dst=tcp_flags)' 'tcp_flags is read-only'
1043 bad_action 'learn(result_dst=eth_dst)' "result_dst in 'learn' action must be a single bit"
1044
1045 # conjunction
1046 bad_action 'conjunction(1, 1/1)' 'conjunction must have at least 2 clauses'
1047 bad_action 'conjunction(1, 1/65)' 'conjunction must have at most 64 clauses'
1048 bad_action 'conjunction(1, 0/2)' 'clause index must be positive'
1049 bad_action 'conjunction(1, 3/2)' \
1050 'clause index must be less than or equal to number of clauses'
1051
1052 # multipath
1053 bad_action 'multipath(1,2,3,4)' \
1054 '1,2,3,4: not enough arguments to multipath action'
1055 bad_action 'multipath(xyzzy,50,modulo_n,1,0,NXM_NX_REG0[[]])' \
1056 "xyzzy,50,modulo_n,1,0,NXM_NX_REG0[[]]: unknown fields \`xyzzy'"
1057 bad_action 'multipath(eth_src,50,fubar,1,0,NXM_NX_REG0[[]])' \
1058 "eth_src,50,fubar,1,0,NXM_NX_REG0[[]]: unknown algorithm \`fubar'"
1059 bad_action 'multipath(eth_src,50,modulo_n,0,0,NXM_NX_REG0[[]])' \
1060 "eth_src,50,modulo_n,0,0,NXM_NX_REG0[[]]: n_links 0 is not in valid range 1 to 65536"
1061 bad_action 'multipath(eth_src,50,modulo_n,1024,0,actset_output)' \
1062 "eth_src,50,modulo_n,1024,0,actset_output: experimenter OXM field 'actset_output' not supported"
1063 bad_action 'multipath(eth_src,50,modulo_n,1024,0,NXM_NX_REG0[[0..7]])' \
1064 "eth_src,50,modulo_n,1024,0,NXM_NX_REG0[[0..7]]: 8-bit destination field has 256 possible values, less than specified n_links 1024"
1065
1066 # note
1067 bad_action 'note:x' "bad hex digit in \`note' argument"
1068
1069 # unroll_xlate
1070 bad_action 'unroll_xlate' "UNROLL is an internal action that shouldn't be used via OpenFlow"
1071
1072 # sample
1073 bad_action 'sample(probability=0)' 'invalid probability value "0"'
1074 bad_action 'sample(sampling_port=asdf)' 'asdf: unknown port'
1075 bad_action 'sample(foo=bar)' 'invalid key "foo" in "sample" argument'
1076 bad_action 'sample' 'non-zero "probability" must be specified on sample'
1077
1078 # ct
1079 bad_action 'ct(table=asdf)' 'unknown table asdf'
1080 bad_action 'ct(table=255)' 'invalid table 0xff'
1081 bad_action 'ct(foo=bar)' 'invalid argument to "ct" action: `foo'\'
1082 bad_action 'ct(force)' '"force" flag requires "commit" flag.'
1083
1084 # nat
1085 bad_action 'nat(src=1.2.3.4x)' 'garbage (x) after nat range "1.2.3.4x" (pos: 7)'
1086 bad_action 'nat(src=1.2.3.4-0.1.2.3)' 'invalid nat range "1.2.3.4-0.1.2.3"'
1087 bad_action 'nat(foo=bar)' 'invalid key "foo" in "nat" argument'
1088 bad_action 'nat(src=1.2.3.4,dst=2.3.4.5)' 'May only specify one of "src" or "dst".'
1089 bad_action 'nat(persistent)' 'Flags allowed only with "src" or "dst".'
1090 bad_action 'nat(src=1.2.3.4,hash,random)' 'Both "hash" and "random" are not allowed.'
1091
1092 # check_pkt_larger
1093 bad_action 'check_pkt_larger(1500)->reg0' \
1094 'Only 1-bit destination field is allowed'
1095
1096 # goto_table
1097 bad_action 'goto_table:asdf' 'unknown table "asdf"'
1098
1099 # nested actions
1100 bad_action 'set_field:1234->ct_mark' \
1101 "cannot set CT fields outside of ct action"
1102 bad_action 'nat' 'Cannot have NAT action outside of "ct" action'
1103 bad_action 'ct(commit,exec(push_vlan(0x8100)))' \
1104 "ct action doesn't support nested action push_vlan"
1105 bad_action 'ct(commit,exec(set_field:12:34:56:78:9a:bc->eth_dst))' \
1106 "ct action doesn't support nested modification of eth_dst"
1107 bad_action 'conjunction(1, 2/3),ct_clear' \
1108 '"conjunction" actions may be used along with "note" but not any other kind of action (such as the "ct_clear" action used here)'
1109
1110 # instructions
1111 bad_action 'goto_table:5,goto_table:5' \
1112 'duplicate goto_table instruction not allowed, for OpenFlow 1.1+ compatibility'
1113 bad_action 'goto_table:5,clone()' \
1114 'invalid instruction ordering: apply_actions must appear before goto_table, for OpenFlow 1.1+ compatibility'
1115 AT_CHECK([ovs-ofctl parse-group 'group_id=1,type=select,bucket=actions=clear_actions'], [1], [],
1116 [ovs-ofctl: clear_actions instruction not allowed here
1117 ])
1118
1119 # ofpacts_parse__()
1120 bad_action 'apply_actions' 'apply_actions is the default instruction'
1121 bad_action 'xyzzy' 'unknown action xyzzy'
1122 bad_action 'drop,3' '"drop" must not be accompanied by any other action or instruction'
1123
1124 AT_CLEANUP