]> git.proxmox.com Git - mirror_ovs.git/blame - tests/ofp-actions.at
checkpatch: Check FOR_EACH loops with numbers.
[mirror_ovs.git] / tests / ofp-actions.at
CommitLineData
f25d0cf3
BP
1AT_BANNER([OpenFlow actions])
2
3AT_SETUP([OpenFlow 1.0 action translation])
4cceacb9 4AT_KEYWORDS([ofp-actions OF1.0])
f25d0cf3
BP
5AT_DATA([test-data], [dnl
6# actions=LOCAL
70000 0008 fffe 04d2
8
9# actions=CONTROLLER:1234
100000 0008 fffd 04d2
11
12# actions=mod_vlan_vid:9
130001 0008 0009 0000
14
15# actions=mod_vlan_pcp:6
160002 0008 06 000000
17
18# actions=strip_vlan
190003 0008 00000000
20
21# actions=mod_dl_src:00:11:22:33:44:55
220004 0010 001122334455 000000000000
23
24# actions=mod_dl_dst:10:20:30:40:50:60
250005 0010 102030405060 000000000000
26
27# actions=mod_nw_src:1.2.3.4
280006 0008 01020304
29
30# actions=mod_nw_dst:192.168.0.1
310007 0008 c0a80001
32
33# actions=mod_nw_tos:48
340008 0008 30 000000
35
36# actions=mod_tp_src:80
370009 0008 0050 0000
38
39# actions=mod_tp_dst:443
40000a 0008 01bb 0000
41
b55f2f79 42# actions=enqueue:10:55
f25d0cf3
BP
43000b 0010 000a 000000000000 00000037
44
45# actions=resubmit:5
46ffff 0010 00002320 0001 0005 00000000
47
48# actions=set_tunnel:0x12345678
49ffff 0010 00002320 0002 0000 12345678
50
51# actions=set_queue:2309737729
52ffff 0010 00002320 0004 0000 89abcd01
53
54# actions=pop_queue
55ffff 0010 00002320 0005 000000000000
56
57# actions=move:NXM_OF_IN_PORT[]->NXM_OF_VLAN_TCI[]
58ffff 0018 00002320 0006 0010 0000 0000 00000002 00000802
59
60# actions=load:0xf009->NXM_OF_VLAN_TCI[]
61ffff 0018 00002320 0007 000f 00000802 000000000000f009
62
63# actions=note:11.e9.9a.ad.67.f3
64ffff 0010 00002320 0008 11e99aad67f3
65
66# actions=set_tunnel64:0xc426384d49c53d60
67ffff 0018 00002320 0009 000000000000 c426384d49c53d60
68
69# actions=set_tunnel64:0x885f3298
70ffff 0018 00002320 0009 000000000000 00000000885f3298
71
65a8a59e 72# bad OpenFlow10 actions: OFPBIC_UNSUP_INST
8f2cded4 73& ofp_actions|WARN|write_metadata instruction not allowed here
4cceacb9
JS
74ffff 0020 00002320 0016 000000000000 fedcba9876543210 ffffffffffffffff
75
65a8a59e 76# bad OpenFlow10 actions: OFPBIC_UNSUP_INST
8f2cded4 77& ofp_actions|WARN|write_metadata instruction not allowed here
4cceacb9
JS
78ffff 0020 00002320 0016 000000000000 fedcba9876543210 ffff0000ffff0000
79
f25d0cf3
BP
80# actions=multipath(eth_src,50,modulo_n,1,0,NXM_NX_REG0[])
81ffff 0020 00002320 000a 0000 0032 0000 0000 0000 0000 0000 0000 001f 00010004
82
f25d0cf3
BP
83# actions=bundle(eth_src,0,hrw,ofport,slaves:4,8)
84ffff 0028 00002320 000c 0001 0000 0000 00000002 0002 0000 00000000 00000000 dnl
850004 0008 00000000
86
87# actions=bundle_load(eth_src,0,hrw,ofport,NXM_NX_REG0[],slaves:4,8)
88ffff 0028 00002320 000d 0001 0000 0000 00000002 0002 001f 00010004 00000000 dnl
890004 0008 00000000
90
91# actions=resubmit(10,5)
92ffff 0010 00002320 000e 000a 05 000000
93
2cd20955
JR
94# actions=resubmit(10,5,ct)
95ffff 0010 00002320 002c 000a 05 000000
96
f25d0cf3
BP
97# actions=output:NXM_NX_REG1[5..10]
98ffff 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[])
101ffff 0048 00002320 0010 000a 0014 0050 123456789abcdef0 0000 02 00 0002 0004 dnl
102000c 00000802 0000 00000802 0000 dnl
1030030 00000406 0000 00000206 0000 dnl
1041010 00000002 0000 dnl
10500000000
106
107# actions=exit
108ffff 0010 00002320 0011 000000000000
109
110# actions=dec_ttl
111ffff 0010 00002320 0012 000000000000
112
113# actions=fin_timeout(idle_timeout=10,hard_timeout=20)
114ffff 0010 00002320 0013 000a 0014 0000
115
116# actions=controller(reason=invalid_ttl,max_len=1234,id=5678)
117ffff 0010 00002320 0014 04d2 162e 02 00
118
77ab5fd2
BP
119# actions=controller(reason=invalid_ttl,max_len=1234,id=5678,userdata=01.02.03.04.05,pause)
120ffff 0040 00002320 0025 000000000000 dnl
bdcad671
BP
1210000 0008 04d2 0000 dnl
1220001 0008 162e 0000 dnl
1230002 0005 02 000000 dnl
77ab5fd2
BP
1240003 0009 0102030405 00000000000000 dnl
1250004 0004 00000000
bdcad671 126
c2d967a5
MM
127# actions=dec_ttl(32768,12345,90,765,1024)
128ffff 0020 00002320 0015 000500000000 80003039005A02fd 0400000000000000
129
29089a54
RL
130# actions=sample(probability=12345,collector_set_id=23456,obs_domain_id=34567,obs_point_id=45678)
131ffff 0018 00002320 001d 3039 00005BA0 00008707 0000B26E
132
f69f713b
BY
133# actions=sample(probability=12345,collector_set_id=23456,obs_domain_id=34567,obs_point_id=45678,sampling_port=56789)
134ffff 0020 00002320 0026 3039 00005BA0 00008707 0000B26E DDD50000 00000000
135
4930ea56
BP
136# actions=sample(probability=12345,collector_set_id=23456,obs_domain_id=34567,obs_point_id=45678,sampling_port=56789,egress)
137ffff 0020 00002320 0029 3039 00005BA0 00008707 0000B26E DDD50200 00000000
138
b153b990
BP
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-
14300 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
14900 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
153ffff 0011 00002320 0015 0001 00000000 0000000000000000
154
13d2c689
BP
155# bad OpenFlow10 actions: OFPBAC_BAD_OUT_PORT
1560000 0008 ffff 0000
157
07659514
JS
158# actions=ct()
159ffff 0018 00002320 0023 0000 00000000 0000 FF 000000 0000
160
161# actions=ct(commit)
162ffff 0018 00002320 0023 0001 00000000 0000 FF 000000 0000
163
a76a37ef
JR
164# actions=ct(commit,force)
165ffff 0018 00002320 0023 0003 00000000 0000 FF 000000 0000
166
167# bad OpenFlow10 actions: OFPBAC_BAD_ARGUMENT
168ffff 0018 00002320 0023 0002 00000000 0000 FF 000000 0000
169
07659514
JS
170# actions=ct(table=10)
171ffff 0018 00002320 0023 0000 00000000 0000 0A 000000 0000
172
173# actions=ct(zone=10)
174ffff 0018 00002320 0023 0000 00000000 000A FF 000000 0000
175
176# actions=ct(zone=NXM_NX_REG0[0..15])
177ffff 0018 00002320 0023 0000 00010004 000F FF 000000 0000
178
179dnl Can't read 8 bits from register into 16-bit zone.
180# bad OpenFlow10 actions: OFPBAC_BAD_SET_LEN
181ffff 0018 00002320 0023 0000 00010004 0007 FF 000000 0000
182
183dnl Can't read 32 bits from register into 16-bit zone.
184# bad OpenFlow10 actions: OFPBAC_BAD_SET_LEN
185ffff 0018 00002320 0023 0000 00010004 001F FF 000000 0000
186
8e53fe8c
JS
187# actions=ct(commit,exec(load:0xf009->NXM_NX_CT_MARK[]))
188ffff 0030 00002320 0023 0001 00000000 0000 FF 000000 0000 dnl
189ffff 0018 00002320 0007 001f 0001d604 000000000000f009
190
a76a37ef
JR
191# actions=ct(commit,force,exec(load:0xf009->NXM_NX_CT_MARK[]))
192ffff 0030 00002320 0023 0003 00000000 0000 FF 000000 0000 dnl
193ffff 0018 00002320 0007 001f 0001d604 000000000000f009
194
6bee8689
JR
195# actions=ct(commit,exec(load:0->NXM_NX_CT_LABEL[64..127],load:0x1d->NXM_NX_CT_LABEL[0..63]))
196ffff 0048 00002320 0023 0001 00000000 0000 FF 000000 0000 dnl
197ffff 0018 00002320 0007 103f 0001d810 0000 0000 0000 0000 dnl
198ffff 0018 00002320 0007 003f 0001d810 0000 0000 0000 001d
199
8e53fe8c
JS
200# bad OpenFlow10 actions: OFPBAC_BAD_SET_ARGUMENT
201& ofp_actions|WARN|cannot set CT fields outside of ct action
202ffff 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
206ffff 0030 00002320 0023 0001 00000000 0000 FF 000000 0000 dnl
207ffff 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
211ffff 0030 00002320 0023 0001 00000000 0000 FF 000000 0000 dnl
212ffff 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
216ffff 0030 00002320 0023 0001 00000000 0000 FF 000000 0000 dnl
217ffff 0018 00002320 0007 001f 00010004 000000000000f009
218
d787ad39
JS
219# actions=ct(alg=ftp)
220ffff 0018 00002320 0023 0000 00000000 0000 FF 000000 0015
221
40c7b2fc
JS
222# actions=ct(alg=tftp)
223ffff 0018 00002320 0023 0000 00000000 0000 FF 000000 0045
224
9ac0aada
JR
225# actions=ct(commit,nat(src))
226ffff 0028 00002320 0023 0001 00000000 0000 FF 000000 0000 dnl
227ffff 0010 00002320 0024 00 00 0001 0000
228
229# actions=ct(commit,nat(dst))
230ffff 0028 00002320 0023 0001 00000000 0000 FF 000000 0000 dnl
231ffff 0010 00002320 0024 00 00 0002 0000
232
233# actions=ct(nat)
234ffff 0028 00002320 0023 0000 00000000 0000 FF 000000 0000 dnl
235ffff 0010 00002320 0024 00 00 0000 0000
236
237# actions=ct(commit,nat(src=10.0.0.240,random))
238ffff 0030 00002320 0023 0001 00000000 0000 FF 000000 0000 dnl
239ffff 0018 00002320 0024 00 00 0011 0001 0a0000f0 00000000
240
241# actions=ct(commit,nat(src=10.0.0.240:32768-65535,random))
242ffff 0030 00002320 0023 0001 00000000 0000 FF 000000 0000 dnl
243ffff 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))
246ffff 0030 00002320 0023 0001 00000000 0000 FF 000000 0000 dnl
247ffff 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))
250ffff 0038 00002320 0023 0001 00000000 0000 FF 000000 0000 dnl
251ffff 0020 00002320 0024 00 00 0005 0033 0a0000f0 0a0000fe 8000ffff 00000000
252
253# actions=ct(commit,nat(src=fe80::20c:29ff:fe88:a18b,random))
254ffff 0038 00002320 0023 0001 00000000 0000 FF 000000 0000 dnl
255ffff 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))
258ffff 0048 00002320 0023 0001 00000000 0000 FF 000000 0000 dnl
259ffff 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))
262ffff 0050 00002320 0023 0001 00000000 0000 FF 000000 0000 dnl
263ffff 0038 00002320 0024 00 00 0011 003c dnl
264fe800000 00000000 020c 29ff fe88 0001 dnl
265fe800000 00000000 020c 29ff fe88 a18b dnl
26600ff1000 00000000
267
72fe7578
BP
268# actions=ct_clear
269ffff 0010 00002320 002b 000000000000
270
aaca4fe0
WT
271# actions=output(port=1,max_len=100)
272ffff 0010 00002320 0027 0001 00000064
273
7ae62a67
WT
274# actions=clone(mod_vlan_vid:5,output:10)
275ffff 0020 00002320 002a 000000000000 dnl
2760001 0008 0005 0000 dnl
2770000 0008 000a 0000
278
a9fedc78
JS
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[])
280ffff 0050 00002320 002d 0000 0000 0000 0000000000000000 0000 02 00 0000 0000 00000000 0000 0000 dnl
281000c 00000802 0000 00000802 0000 dnl
2820030 00000406 0000 00000206 0000 dnl
2831010 00000002 0000 dnl
28400000000
285
4c71600d
DDP
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[])
287ffff 0050 00002320 002d 000a 0014 0050 123456789abcdef0 0000 02 00 0002 0004 00000001 0000 0000 dnl
288000c 00000802 0000 00000802 0000 dnl
2890030 00000406 0000 00000206 0000 dnl
2901010 00000002 0000 dnl
29100000000
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[])
294ffff 0050 00002320 002d 000a 0014 0050 123456789abcdef0 0004 02 00 0002 0004 00000001 0008 0000 dnl
29500010004 dnl
296000c 00000802 0000 00000802 0000 dnl
2970030 00000406 0000 00000206 0000 dnl
2981010 00000002 0000
299
88c8ca26
BP
300# actions=group:5
301ffff 0010 00002320 0028 0000 00000005
302
77ab5fd2
BP
303# bad OpenFlow10 actions: NXBRC_MUST_BE_ZERO
304ffff 0018 00002320 0025 0000 0005 0000 1122334455 000005
305
306# bad OpenFlow10 actions: NXBRC_MUST_BE_ZERO
307ffff 0018 00002320 0025 0000 0005 5000 1122334455 000000
308
9ac0aada
JR
309# bad OpenFlow10 actions: OFPBAC_BAD_ARGUMENT
310ffff 0048 00002320 0023 0001 00000000 0000 FF 000000 0000 dnl
311ffff 0030 00002320 0024 00 00 0011 000c fe800000 00000000 020c 29ff fe88 a18b fe800000 00000000 020c 29ff fe88 0001
312
5b34f8fc
NS
313# actions=check_pkt_larger(1500)->NXM_NX_REG0[0]
314ffff 0018 00002320 0031 05dc 000000010004000000000000
315
316# actions=check_pkt_larger(1000)->NXM_NX_XXREG1[4]
317ffff 0018 00002320 0031 03e8 00040001e010000000000000
318
f25d0cf3
BP
319])
320sed '/^[[#&]]/d' < test-data > input.txt
321sed -n 's/^# //p; /^$/p' < test-data > expout
322sed -n 's/^& //p' < test-data > experr
323AT_CAPTURE_FILE([input.txt])
324AT_CAPTURE_FILE([expout])
325AT_CAPTURE_FILE([experr])
326AT_CHECK(
65a8a59e 327 [ovs-ofctl '-vPATTERN:console:%c|%p|%m' parse-actions OpenFlow10 < input.txt],
f25d0cf3
BP
328 [0], [expout], [experr])
329AT_CLEANUP
d01c980f 330
8f2cded4
BP
331AT_SETUP([OpenFlow 1.0 "instruction" translations])
332AT_KEYWORDS([ofp-actions OF1.0 instruction])
333AT_DATA([test-data], [dnl
334dnl Try a couple of ordinary actions to make sure they're accepted,
335dnl but there's no point in retrying all the actions from the previous test.
336# actions=LOCAL
3370000 0008 fffe 04d2
338
339# actions=mod_dl_src:00:11:22:33:44:55
3400004 0010 001122334455 000000000000
341
342dnl Now check that write_metadata is accepted.
343# actions=write_metadata:0xfedcba9876543210
344ffff 0020 00002320 0016 000000000000 fedcba9876543210 ffffffffffffffff
345
346# actions=write_metadata:0xfedcba9876543210/0xffff0000ffff0000
347ffff 0020 00002320 0016 000000000000 fedcba9876543210 ffff0000ffff0000
348
349])
350sed '/^[[#&]]/d' < test-data > input.txt
351sed -n 's/^# //p; /^$/p' < test-data > expout
352sed -n 's/^& //p' < test-data > experr
353AT_CAPTURE_FILE([input.txt])
354AT_CAPTURE_FILE([expout])
355AT_CAPTURE_FILE([experr])
356AT_CHECK(
65a8a59e 357 [ovs-ofctl '-vPATTERN:console:%c|%p|%m' parse-instructions OpenFlow10 < input.txt],
8f2cded4
BP
358 [0], [expout], [experr])
359AT_CLEANUP
360
d01c980f 361AT_SETUP([OpenFlow 1.1 action translation])
4cceacb9 362AT_KEYWORDS([ofp-actions OF1.1])
d01c980f
BP
363AT_DATA([test-data], [dnl
364# actions=LOCAL
3650000 0010 fffffffe 04d2 000000000000
366
367# actions=CONTROLLER:1234
3680000 0010 fffffffd 04d2 000000000000
369
ca287d20 370# actions=set_vlan_vid:9
d01c980f
BP
3710001 0008 0009 0000
372
ca287d20 373# actions=set_vlan_pcp:6
d01c980f
BP
3740002 0008 06 000000
375
376# actions=mod_dl_src:00:11:22:33:44:55
3770003 0010 001122334455 000000000000
378
379# actions=mod_dl_dst:10:20:30:40:50:60
3800004 0010 102030405060 000000000000
381
382# actions=mod_nw_src:1.2.3.4
3830005 0008 01020304
384
385# actions=mod_nw_dst:192.168.0.1
3860006 0008 c0a80001
387
388# actions=mod_nw_tos:48
3890007 0008 30 000000
390
4b684612
BP
391# actions=mod_nw_ecn:2
3920008 0008 02 000000
393
d01c980f
BP
394# actions=mod_tp_src:80
3950009 0008 0050 0000
396
397# actions=mod_tp_dst:443
398000a 0008 01bb 0000
399
64fcc073 400# actions=pop_vlan
8e61c110
IY
4010012 0008 00000000
402
276c4e7a
SH
403# actions=set_queue:2309737729
4040015 0008 89abcd01
405
3e34fbdd
IY
406dnl 802.1ad isn't supported at the moment
407dnl # actions=push_vlan:0x88a8
408dnl 0011 0008 88a8 0000
409# actions=push_vlan:0x8100
4100011 0008 8100 0000
411
d01c980f
BP
412# actions=resubmit:5
413ffff 0010 00002320 0001 0005 00000000
414
415# actions=set_tunnel:0x12345678
416ffff 0010 00002320 0002 0000 12345678
417
d01c980f
BP
418# actions=pop_queue
419ffff 0010 00002320 0005 000000000000
420
421# actions=move:NXM_OF_IN_PORT[]->NXM_OF_VLAN_TCI[]
422ffff 0018 00002320 0006 0010 0000 0000 00000002 00000802
423
424# actions=load:0xf009->NXM_OF_VLAN_TCI[]
425ffff 0018 00002320 0007 000f 00000802 000000000000f009
426
427# actions=note:11.e9.9a.ad.67.f3
428ffff 0010 00002320 0008 11e99aad67f3
429
430# actions=set_tunnel64:0xc426384d49c53d60
431ffff 0018 00002320 0009 000000000000 c426384d49c53d60
432
433# actions=set_tunnel64:0x885f3298
434ffff 0018 00002320 0009 000000000000 00000000885f3298
435
8f2cded4
BP
436dnl Write-Metadata is only allowed in contexts that allow instructions.
437& ofp_actions|WARN|write_metadata instruction not allowed here
65a8a59e 438# bad OpenFlow11 actions: OFPBIC_UNSUP_INST
4cceacb9
JS
439ffff 0020 00002320 0016 000000000000 fedcba9876543210 ffffffffffffffff
440
d01c980f
BP
441# actions=multipath(eth_src,50,modulo_n,1,0,NXM_NX_REG0[])
442ffff 0020 00002320 000a 0000 0032 0000 0000 0000 0000 0000 0000 001f 00010004
443
d01c980f
BP
444# actions=bundle(eth_src,0,hrw,ofport,slaves:4,8)
445ffff 0028 00002320 000c 0001 0000 0000 00000002 0002 0000 00000000 00000000 dnl
4460004 0008 00000000
447
448# actions=bundle_load(eth_src,0,hrw,ofport,NXM_NX_REG0[],slaves:4,8)
449ffff 0028 00002320 000d 0001 0000 0000 00000002 0002 001f 00010004 00000000 dnl
4500004 0008 00000000
451
452# actions=resubmit(10,5)
453ffff 0010 00002320 000e 000a 05 000000
454
2cd20955
JR
455# actions=resubmit(10,5,ct)
456ffff 0010 00002320 002c 000a 05 000000
457
d01c980f
BP
458# actions=output:NXM_NX_REG1[5..10]
459ffff 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[])
462ffff 0048 00002320 0010 000a 0014 0050 123456789abcdef0 0000 02 00 0002 0004 dnl
463000c 00000802 0000 00000802 0000 dnl
4640030 00000406 0000 00000206 0000 dnl
4651010 00000002 0000 dnl
46600000000
467
468# actions=exit
469ffff 0010 00002320 0011 000000000000
470
7bcb1506
IY
471dnl OpenFlow 1.1 OFPAT_DEC_TTL
472# actions=dec_ttl
4730018 0008 00000000
474
d01c980f
BP
475# actions=fin_timeout(idle_timeout=10,hard_timeout=20)
476ffff 0010 00002320 0013 000a 0014 0000
477
478# actions=controller(reason=invalid_ttl,max_len=1234,id=5678)
479ffff 0010 00002320 0014 04d2 162e 02 00
480
c2d967a5
MM
481# actions=dec_ttl(32768,12345,90,765,1024)
482ffff 0020 00002320 0015 000500000000 80003039005A02fd 0400000000000000
483
29089a54
RL
484# actions=sample(probability=12345,collector_set_id=23456,obs_domain_id=34567,obs_point_id=45678)
485ffff 0018 00002320 001d 3039 00005BA0 00008707 0000B26E
486
13d2c689
BP
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
4900000 0010 ffffffff 0000 000000000000
491
d01c980f
BP
492])
493sed '/^[[#&]]/d' < test-data > input.txt
494sed -n 's/^# //p; /^$/p' < test-data > expout
495sed -n 's/^& //p' < test-data > experr
496AT_CAPTURE_FILE([input.txt])
497AT_CAPTURE_FILE([expout])
498AT_CAPTURE_FILE([experr])
499AT_CHECK(
65a8a59e 500 [ovs-ofctl '-vPATTERN:console:%c|%p|%m' parse-actions OpenFlow11 < input.txt],
d01c980f
BP
501 [0], [expout], [experr])
502AT_CLEANUP
503
504AT_SETUP([OpenFlow 1.1 instruction translation])
4cceacb9 505AT_KEYWORDS([OF1.1 instruction ofp-actions])
d01c980f
BP
506AT_DATA([test-data], [dnl
507# actions=LOCAL
5080004 0018 00000000 dnl
5090000 0010 fffffffe 04d2 000000000000
510
8dd54666
IY
511dnl 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)
5210004 0008 00000001
522
d01c980f
BP
523dnl 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)
5330004 0008 00000000
534
e38c9de5 535dnl Duplicate instruction type:
65a8a59e 536# bad OpenFlow11 instructions: OFPBIC_DUP_INST
d01c980f
BP
5370004 0008 00000000 0004 0008 00000000
538
539dnl Instructions not multiple of 8 in length.
540& ofp_actions|WARN|OpenFlow message instructions length 9 is not a multiple of 8
65a8a59e 541# bad OpenFlow11 instructions: OFPBIC_BAD_LEN
d01c980f
BP
5420004 0009 01 00000000
543
544dnl Goto-Table instruction too long.
65a8a59e 545# bad OpenFlow11 instructions: OFPBIC_BAD_LEN
d01c980f
BP
5460001 0010 01 000000 0000000000000000
547
8dd54666
IY
548dnl Goto-Table 1 instruction non-zero padding
549# actions=goto_table:1
550# 7: 01 -> 00
5510001 0008 01 000001
552
bff7eeb6 553dnl Goto-Table 1 instruction go back to the previous table.
8c87971e 554# bad OpenFlow11 instructions: OFPBIC_BAD_TABLE_ID
bff7eeb6
JA
5552,0001 0008 01 000000
556
8dd54666
IY
557dnl Goto-Table 1
558# actions=goto_table:1
d01c980f
BP
5590001 0008 01 000000
560
4cceacb9
JS
561dnl Write-Metadata.
562# actions=write_metadata:0xfedcba9876543210
d01c980f
BP
5630002 0018 00000000 fedcba9876543210 ffffffffffffffff
564
8f2cded4
BP
565dnl 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)
6010004 0028 00000000 ffff 0020 00002320 0016 000000000000 fedcba9876543210 ffffffffffffffff
602
4cceacb9
JS
603dnl Write-Metadata with mask.
604# actions=write_metadata:0xfedcba9876543210/0xff00ff00ff00ff00
6050002 0018 00000000 fedcba9876543210 ff00ff00ff00ff00
606
d01c980f 607dnl Write-Metadata too short.
65a8a59e 608# bad OpenFlow11 instructions: OFPBIC_BAD_LEN
d01c980f
BP
6090002 0010 00000000 fedcba9876543210
610
611dnl Write-Metadata too long.
65a8a59e 612# bad OpenFlow11 instructions: OFPBIC_BAD_LEN
d01c980f
BP
6130002 0020 00000000 fedcba9876543210 ffffffffffffffff 0000000000000000
614
4cceacb9 615dnl Write-Metadata duplicated.
65a8a59e 616# bad OpenFlow11 instructions: OFPBIC_DUP_INST
4cceacb9
JS
6170002 0018 00000000 fedcba9876543210 ff00ff00ff00ff00 0002 0018 00000000 fedcba9876543210 ff00ff00ff00ff00
618
6813ee7c
BP
619dnl Write-Metadata in wrong position (OpenFlow 1.1+ disregards the order
620dnl 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
4cceacb9
JS
6490001 0008 01 000000 0002 0018 00000000 fedcba9876543210 ffffffffffffffff
650
7fdb60a7
SH
651dnl 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)
6610003 0008 00000001
662
663dnl 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)
6730003 0008 00000000
d01c980f 674
b19e8793 675dnl Clear-Actions too-long
65a8a59e 676# bad OpenFlow11 instructions: OFPBIC_BAD_LEN
b19e8793
IY
6770005 0010 00000000 0000000000000000
678
679dnl Clear-Actions non-zero padding
680# actions=clear_actions
681# 7: 01 -> 00
6820005 0008 00000001
683
684dnl Clear-Actions non-zero padding
685# actions=clear_actions
686# 4: 01 -> 00
d01c980f
BP
6870005 0008 01 000000
688
b19e8793
IY
689dnl Clear-Actions
690# actions=clear_actions
6910005 0008 00000000
692
d01c980f 693dnl Experimenter actions not supported yet.
65a8a59e 694# bad OpenFlow11 instructions: OFPBIC_BAD_EXPERIMENTER
d01c980f
BP
695ffff 0008 01 000000
696
697dnl Bad instruction number (0 not assigned).
65a8a59e 698# bad OpenFlow11 instructions: OFPBIC_UNKNOWN_INST
d01c980f
BP
6990000 0008 01 000000
700
701])
702sed '/^[[#&]]/d' < test-data > input.txt
703sed -n 's/^# //p; /^$/p' < test-data > expout
704sed -n 's/^& //p' < test-data > experr
705AT_CAPTURE_FILE([input.txt])
706AT_CAPTURE_FILE([expout])
707AT_CAPTURE_FILE([experr])
708AT_CHECK(
65a8a59e 709 [ovs-ofctl '-vPATTERN:console:%c|%p|%m' parse-instructions OpenFlow11 < input.txt],
d01c980f
BP
710 [0], [expout], [experr])
711AT_CLEANUP
94baabf7 712
178742f9
BP
713dnl Our primary goal here is to verify OpenFlow 1.2-specific changes,
714dnl so the list of tests is short.
715AT_SETUP([OpenFlow 1.2 action translation])
716AT_KEYWORDS([ofp-actions OF1.2])
717AT_DATA([test-data], [dnl
718# actions=LOCAL
7190000 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-
7250019 0018 8000090c 000000001234 00000000ffff 00000000
726
727])
728sed '/^[[#&]]/d' < test-data > input.txt
729sed -n 's/^# //p; /^$/p' < test-data > expout
730sed -n 's/^& //p' < test-data > experr
731AT_CAPTURE_FILE([input.txt])
732AT_CAPTURE_FILE([expout])
733AT_CAPTURE_FILE([experr])
734AT_CHECK(
735 [ovs-ofctl '-vPATTERN:console:%c|%p|%m' parse-actions OpenFlow12 < input.txt],
736 [0], [expout], [experr])
737AT_CLEANUP
738
914624f8
BP
739dnl Our primary goal here is to verify OpenFlow 1.3-specific changes,
740dnl so the list of tests is short.
741AT_SETUP([OpenFlow 1.3 action translation])
742AT_KEYWORDS([ofp-actions OF1.3])
743AT_DATA([test-data], [dnl
744# actions=LOCAL
7450000 0010 fffffffe 04d2 000000000000
746
747dnl Check the Nicira extension form of "move".
748# actions=move:NXM_OF_IN_PORT[]->NXM_OF_VLAN_TCI[]
749ffff 0018 00002320 0006 0010 0000 0000 00000002 00000802
750
751dnl Check the ONF extension form of "copy_field".
752# actions=move:NXM_OF_IN_PORT[]->NXM_OF_VLAN_TCI[]
753ffff 0020 4f4e4600 0c80 0000 0010 0000 0000 0000 00000002 00000802 00000000
754
731dbbbe 755dnl 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-
7600019 0008 8000fe00 000000100000 000100000000 00000000
761
762dnl 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-
7670019 0010 80000807 000102030405 000000000010 00000001
768
914624f8
BP
769])
770sed '/^[[#&]]/d' < test-data > input.txt
771sed -n 's/^# //p; /^$/p' < test-data > expout
772sed -n 's/^& //p' < test-data > experr
773AT_CAPTURE_FILE([input.txt])
774AT_CAPTURE_FILE([expout])
775AT_CAPTURE_FILE([experr])
776AT_CHECK(
777 [ovs-ofctl '-vPATTERN:console:%c|%p|%m' parse-actions OpenFlow13 < input.txt],
778 [0], [expout], [experr])
779AT_CLEANUP
780
da4425c7
BP
781dnl Our primary goal here is to verify that OpenFlow 1.5-specific changes,
782dnl so the list of tests is short.
73178f20
BP
783AT_SETUP([OpenFlow 1.5 action translation])
784AT_KEYWORDS([ofp-actions OF1.5])
785AT_DATA([test-data], [dnl
786# actions=LOCAL
7870000 0010 fffffffe 04d2 000000000000
788
789# actions=move:NXM_OF_IN_PORT[]->NXM_OF_VLAN_TCI[]
650763d8 790001c 0018 0010 0000 0000 0000 00000002 00000802 00000000
73178f20 791
7eb4b1f1 792# actions=set_field:00:00:00:00:12:34/00:00:00:00:ff:ff->eth_src
178742f9 7930019 0018 8000090c 000000001234 00000000ffff 00000000
da4425c7 794
4332b671
BP
795# actions=meter:5
796001d 0008 00000005
797
73178f20
BP
798])
799sed '/^[[#&]]/d' < test-data > input.txt
800sed -n 's/^# //p; /^$/p' < test-data > expout
801sed -n 's/^& //p' < test-data > experr
802AT_CAPTURE_FILE([input.txt])
803AT_CAPTURE_FILE([expout])
804AT_CAPTURE_FILE([experr])
805AT_CHECK(
806 [ovs-ofctl '-vPATTERN:console:%c|%p|%m' parse-actions OpenFlow15 < input.txt],
807 [0], [expout], [experr])
808AT_CLEANUP
809
94baabf7
SH
810AT_SETUP([ofp-actions - inconsistent MPLS actions])
811OVS_VSWITCHD_START
812dnl OK: Use fin_timeout action on TCP flow
813AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn add-flow br0 'tcp actions=fin_timeout(idle_timeout=1)'])
814dnl Bad: Use fin_timeout action on TCP flow that has been converted to MPLS
815AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn add-flow br0 'tcp actions=push_mpls:0x8847,fin_timeout(idle_timeout=1)'],
816 [1], [], [dnl
ba2fe8e9 817ovs-ofctl: none of the usable flow formats (OpenFlow10,NXM) is among the allowed flow formats (OpenFlow11)
94baabf7
SH
818])
819OVS_VSWITCHD_STOP
820AT_CLEANUP
fa078489
BP
821
822AT_SETUP([reg_load <-> set_field translation corner case])
823AT_KEYWORDS([ofp-actions])
824OVS_VSWITCHD_START
825dnl In OpenFlow 1.3, set_field always sets all the bits in the field,
826dnl but when we translate to NXAST_LOAD we need to only set the bits that
827dnl actually exist (e.g. mpls_label only has 20 bits) otherwise OVS rejects
828dnl the "load" action as invalid. Check that we do this correctly.
829AT_CHECK([ovs-ofctl -O OpenFlow13 add-flow br0 mpls,actions=set_field:10-\>mpls_label])
830AT_CHECK([ovs-ofctl -O OpenFlow10 dump-flows br0 | ofctl_strip], [0], [dnl
831NXST_FLOW reply:
832 mpls actions=load:0xa->OXM_OF_MPLS_LABEL[[]]
833])
834OVS_VSWITCHD_STOP
835AT_CLEANUP
0f2aaee9
BP
836
837AT_SETUP([enqueue action for OF1.1+])
838AT_KEYWORDS([ofp-actions])
839OVS_VSWITCHD_START
840dnl OpenFlow 1.0 has an "enqueue" action. For OpenFlow 1.1+, we translate
841dnl it to a series of actions that accomplish the same thing.
842AT_CHECK([ovs-ofctl -O OpenFlow10 add-flow br0 'actions=enqueue(123,456)'])
843AT_CHECK([ovs-ofctl -O OpenFlow10 dump-flows br0 | ofctl_strip], [0], [dnl
844NXST_FLOW reply:
845 actions=enqueue:123:456
846])
847AT_CHECK([ovs-ofctl -O OpenFlow13 dump-flows br0 | ofctl_strip], [0], [dnl
848OFPST_FLOW reply (OF1.3):
849 reset_counts actions=set_queue:456,output:123,pop_queue
850])
851OVS_VSWITCHD_STOP
852AT_CLEANUP
4b684612 853
56a91749
BP
854AT_SETUP([mod_nw_ttl action for OF1.0])
855AT_KEYWORDS([ofp-actions])
856OVS_VSWITCHD_START
857dnl OpenFlow 1.1+ have a mod_nw_ttl action. For OpenFlow 1.0, we translate
858dnl it to an Open vSwitch extension.
859AT_CHECK([ovs-ofctl -O OpenFlow11 add-flow br0 'ip,actions=mod_nw_ttl:123'])
860AT_CHECK([ovs-ofctl -O OpenFlow10 dump-flows br0 | ofctl_strip], [0], [dnl
861NXST_FLOW reply:
862 ip actions=load:0x7b->NXM_NX_IP_TTL[[]]
863])
864AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip], [0], [dnl
865OFPST_FLOW reply (OF1.1):
866 ip actions=mod_nw_ttl:123
867])
868OVS_VSWITCHD_STOP
869AT_CLEANUP
870
4b684612
BP
871AT_SETUP([mod_nw_ecn action translation])
872AT_KEYWORDS([ofp-actions])
873OVS_VSWITCHD_START
874
875dnl OpenFlow 1.1, but no other version, has a "mod_nw_ecn" action.
876dnl Check that we translate it properly for OF1.0 and OF1.2.
877dnl (OF1.3+ should be the same as OF1.2.)
878AT_CHECK([ovs-ofctl -O OpenFlow11 add-flow br0 'ip,actions=mod_nw_ecn:2'])
879AT_CHECK([ovs-ofctl -O OpenFlow10 dump-flows br0 | ofctl_strip], [0], [dnl
880NXST_FLOW reply:
881 ip actions=load:0x2->NXM_NX_IP_ECN[[]]
882])
883AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip], [0], [dnl
884OFPST_FLOW reply (OF1.1):
885 ip actions=mod_nw_ecn:2
886])
887AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip], [0], [dnl
888OFPST_FLOW reply (OF1.2):
889 ip actions=set_field:2->nw_ecn
890])
891
892dnl Check that OF1.2+ set_field to set ECN is translated into the OF1.1
893dnl mod_nw_ecn action.
894dnl
895dnl We don't do anything equivalent for OF1.0 reg_load because we prefer
896dnl that anything that comes in as reg_load gets translated back to reg_load
897dnl on output. Perhaps this is somewhat inconsistent but it's what OVS
898dnl has done for multiple versions.
899AT_CHECK([ovs-ofctl del-flows br0])
900AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 'ip,actions=set_field:2->ip_ecn'])
901AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip], [0], [dnl
902OFPST_FLOW reply (OF1.1):
903 ip actions=mod_nw_ecn:2
904])
1a1e1a49
EG
905
906dnl Check that OF1.2+ set_field to set ECN is translated for earlier OF
907dnl versions.
908AT_CHECK([ovs-ofctl del-flows br0])
909AT_CHECK([ovs-ofctl -O OpenFlow10 add-flow br0 'ip,actions=set_field:2->ip_ecn'])
910AT_CHECK([ovs-ofctl del-flows br0])
911AT_CHECK([ovs-ofctl -O OpenFlow11 add-flow br0 'ip,actions=set_field:2->ip_ecn'])
912
4b684612
BP
913OVS_VSWITCHD_STOP
914AT_CLEANUP
56a91749 915
70ed59cb
BP
916AT_SETUP([action parsing errors])
917bad_action () {
918 AT_CHECK_UNQUOTED([ovs-ofctl parse-flow "actions=$1"], [1], [],
919 [ovs-ofctl: $2
920])
921}
922
923# output
924bad_action 'output(port=xyzzy,max_len=5)' \
925 "output to unknown truncate port: xyzzy"
926bad_action 'output(port=all,max_len=64)' \
927 "output to unsupported truncate port: all"
928bad_action 'output(port=local,max_len=64,foo=bar)' \
929 "invalid key 'foo' in output_trunc argument"
930bad_action 'output(port=local,max_len=5)' \
931 "max_len 5 is less than the minimum value 14"
932
933# controller
934bad_action 'controller(reason=asdf)' 'unknown reason "asdf"'
935bad_action 'controller(foo=bar)' 'unknown key "foo" parsing controller action'
936bad_action 'controller(userdata=123x456)' \
937 'bad hex digit in `controller'\'' action `userdata'\'
938
939# enqueue
940bad_action 'enqueue:123' \
941 '"enqueue" syntax is "enqueue:PORT:QUEUE" or "enqueue(PORT,QUEUE)"'
942bad_action 'enqueue:asdf:123' 'asdf: enqueue to unknown port'
943
944# bundle
945bad_action 'bundle:123' '123: not enough arguments to bundle action'
946bad_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'"
948bad_action 'bundle(symmetric_l4,60,hrw,ofport,slaves:xyzzy,2,3,4,5)' \
949 'xyzzy: bad port number'
950bad_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'"
952bad_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'"
954bad_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'"
956bad_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
960bad_action 'mod_vlan_vid:6000' '6000: not a valid VLAN VID'
961
962# mod_vlan_pcp
963bad_action 'mod_vlan_pcp:8' '8: not a valid VLAN PCP'
964
965# push_vlan
966bad_action 'push_vlan(0x1234)' '0x1234: not a valid VLAN ethertype'
967
968# mod_nw_tos
969bad_action 'mod_nw_tos(1)' '1: not a valid TOS'
970
971# mod_nw_ecn
972bad_action 'mod_nw_ecn(5)' '5: not a valid ECN'
973
974# set_field
975bad_action 'set_field:1' "1: missing \`->'"
976bad_action 'set_field:1->' "1->: missing field name following \`->'"
977bad_action 'set_field:1->x' 'x is not a valid OXM field name'
978bad_action 'set_field:1->eth_type' 'eth_type is read-only'
979bad_action 'set_field:1->eth_src' '1: invalid Ethernet address'
980bad_action 'set_field:0xffff->ip_dscp' '0xffff: value too large for 1-byte field ip_dscp'
981bad_action 'set_field:0xff->ip_dscp' '0xff is not a valid value for field ip_dscp'
982
983# reg_load
984bad_action 'load:xyzzy->eth_src' 'xyzzy->eth_src: cannot parse integer value'
985bad_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
988bad_action 'push(eth_dst[[]]x)' 'x: trailing garbage following push or pop'
989
990# dec_ttl
991bad_action 'dec_ttl(,)' 'dec_ttl_cnt_ids: expected at least one controller id.'
992
993# set_mpls_label
994bad_action 'set_mpls_label' 'set_mpls_label: expected label.'
995
996# set_mpls_tc
997bad_action 'set_mpls_tc' 'set_mpls_tc: expected tc.'
998
999# set_mpls_ttl
1000bad_action 'set_mpls_ttl' 'set_mpls_ttl: expected ttl.'
1001
1002# fin_timeout
1003bad_action 'fin_timeout(foo=bar)' "invalid key 'foo' in 'fin_timeout' argument"
1004
1005# encap
1006bad_action 'encap(,)' 'Missing encap hdr: ,'
1007bad_action 'encap(x(y))' 'Encap hdr not supported: y'
1008bad_action 'encap(nsh(type=1))' 'Invalid property: type'
1009bad_action 'encap(nsh(md_type))' 'Value missing for encap property'
1010bad_action 'encap(nsh(md_type=3))' 'invalid md_type'
1011bad_action 'encap(nsh(tlv(,,)))' 'Invalid NSH TLV header: ,,'
1012
1013# decap
1014bad_action 'decap(packet_type(x))' 'Missing packet_type attribute ns'
1015bad_action 'decap(packet_type(ns=99))' 'Unsupported ns value: 99'
1016bad_action 'decap(packet_type(ns=0))' 'Missing packet_type attribute type'
1017bad_action 'decap(foo=bar)' 'Invalid decap argument: foo'
1018
1019# resubmit
1020bad_action 'resubmit(asdf)' 'asdf: resubmit to unknown port'
1021bad_action 'resubmit(,asdf)' 'asdf: resubmit to unknown table'
1022bad_action 'resubmit(1,2,xyzzy)' 'xyzzy: unknown parameter'
1023bad_action 'resubmit(in_port,255)' 'at least one "in_port" or "table" must be specified on resubmit'
1024
1025# learn
1026bad_action 'learn(load:123->actset_output)' \
1027 "123->actset_output: experimenter OXM field 'actset_output' not supported"
1028bad_action 'learn(load:1234->eth_dst[[0..5]])' \
1029 '1234->eth_dst[[0..5]]: value does not fit into 6 bits'
1030bad_action 'learn(actset_output=0x1000)' \
1031 "actset_output=0x1000: experimenter OXM field 'actset_output' not supported"
1032bad_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)"
1034bad_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'
1036bad_action 'learn(load:->)' "load: missing source before \`->' in \`->'"
1037bad_action 'learn(load:x)' "load: missing \`->' in \`x'"
1038bad_action 'learn(load:1x->foo)' "load: garbage before \`->' in \`1x->foo'"
1039bad_action 'learn(foo)' 'foo: unknown keyword foo'
1040bad_action 'learn(table=foo)' 'unknown table "foo"'
1041bad_action 'learn(table=255)' "table=255: table id 255 not valid for \`learn' action"
1042bad_action 'learn(result_dst=tcp_flags)' 'tcp_flags is read-only'
1043bad_action 'learn(result_dst=eth_dst)' "result_dst in 'learn' action must be a single bit"
1044
1045# conjunction
1046bad_action 'conjunction(1, 1/1)' 'conjunction must have at least 2 clauses'
1047bad_action 'conjunction(1, 1/65)' 'conjunction must have at most 64 clauses'
1048bad_action 'conjunction(1, 0/2)' 'clause index must be positive'
1049bad_action 'conjunction(1, 3/2)' \
1050 'clause index must be less than or equal to number of clauses'
1051
1052# multipath
1053bad_action 'multipath(1,2,3,4)' \
1054 '1,2,3,4: not enough arguments to multipath action'
1055bad_action 'multipath(xyzzy,50,modulo_n,1,0,NXM_NX_REG0[[]])' \
1056 "xyzzy,50,modulo_n,1,0,NXM_NX_REG0[[]]: unknown fields \`xyzzy'"
1057bad_action 'multipath(eth_src,50,fubar,1,0,NXM_NX_REG0[[]])' \
1058 "eth_src,50,fubar,1,0,NXM_NX_REG0[[]]: unknown algorithm \`fubar'"
1059bad_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"
1061bad_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"
1063bad_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
1067bad_action 'note:x' "bad hex digit in \`note' argument"
1068
1069# unroll_xlate
1070bad_action 'unroll_xlate' "UNROLL is an internal action that shouldn't be used via OpenFlow"
1071
1072# sample
1073bad_action 'sample(probability=0)' 'invalid probability value "0"'
1074bad_action 'sample(sampling_port=asdf)' 'asdf: unknown port'
1075bad_action 'sample(foo=bar)' 'invalid key "foo" in "sample" argument'
1076bad_action 'sample' 'non-zero "probability" must be specified on sample'
1077
1078# ct
1079bad_action 'ct(table=asdf)' 'unknown table asdf'
1080bad_action 'ct(table=255)' 'invalid table 0xff'
1081bad_action 'ct(foo=bar)' 'invalid argument to "ct" action: `foo'\'
1082bad_action 'ct(force)' '"force" flag requires "commit" flag.'
1083
1084# nat
1085bad_action 'nat(src=1.2.3.4x)' 'garbage (x) after nat range "1.2.3.4x" (pos: 7)'
1086bad_action 'nat(src=1.2.3.4-0.1.2.3)' 'invalid nat range "1.2.3.4-0.1.2.3"'
1087bad_action 'nat(foo=bar)' 'invalid key "foo" in "nat" argument'
1088bad_action 'nat(src=1.2.3.4,dst=2.3.4.5)' 'May only specify one of "src" or "dst".'
1089bad_action 'nat(persistent)' 'Flags allowed only with "src" or "dst".'
1090bad_action 'nat(src=1.2.3.4,hash,random)' 'Both "hash" and "random" are not allowed.'
1091
1092# check_pkt_larger
1093bad_action 'check_pkt_larger(1500)->reg0' \
1094 'Only 1-bit destination field is allowed'
1095
1096# goto_table
1097bad_action 'goto_table:asdf' 'unknown table "asdf"'
1098
1099# nested actions
1100bad_action 'set_field:1234->ct_mark' \
1101 "cannot set CT fields outside of ct action"
1102bad_action 'nat' 'Cannot have NAT action outside of "ct" action'
1103bad_action 'ct(commit,exec(push_vlan(0x8100)))' \
1104 "ct action doesn't support nested action push_vlan"
1105bad_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"
1107bad_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
1111bad_action 'goto_table:5,goto_table:5' \
1112 'duplicate goto_table instruction not allowed, for OpenFlow 1.1+ compatibility'
1113bad_action 'goto_table:5,clone()' \
1114 'invalid instruction ordering: apply_actions must appear before goto_table, for OpenFlow 1.1+ compatibility'
1115AT_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__()
1120bad_action 'apply_actions' 'apply_actions is the default instruction'
1121bad_action 'xyzzy' 'unknown action xyzzy'
1122bad_action 'drop,3' '"drop" must not be accompanied by any other action or instruction'
1123
1124AT_CLEANUP