]> git.proxmox.com Git - ovs.git/blame - tests/ofp-actions.at
Fix ovs-dpctl-top by removing 3 wrong hunks in py3-compat.patch.
[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
91fc374a 83# actions=bundle(eth_src,0,hrw,ofport,members:4,8)
f25d0cf3
BP
84ffff 0028 00002320 000c 0001 0000 0000 00000002 0002 0000 00000000 00000000 dnl
850004 0008 00000000
86
91fc374a 87# actions=bundle_load(eth_src,0,hrw,ofport,NXM_NX_REG0[],members:4,8)
f25d0cf3
BP
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
81f71381
YHW
319# actions=delete_field:tun_metadata10
320ffff 0018 00002320 0032 00 01 64 7c 00 00 00 00 000000000000
321
f25d0cf3
BP
322])
323sed '/^[[#&]]/d' < test-data > input.txt
324sed -n 's/^# //p; /^$/p' < test-data > expout
325sed -n 's/^& //p' < test-data > experr
326AT_CAPTURE_FILE([input.txt])
327AT_CAPTURE_FILE([expout])
328AT_CAPTURE_FILE([experr])
329AT_CHECK(
65a8a59e 330 [ovs-ofctl '-vPATTERN:console:%c|%p|%m' parse-actions OpenFlow10 < input.txt],
f25d0cf3
BP
331 [0], [expout], [experr])
332AT_CLEANUP
d01c980f 333
8f2cded4
BP
334AT_SETUP([OpenFlow 1.0 "instruction" translations])
335AT_KEYWORDS([ofp-actions OF1.0 instruction])
336AT_DATA([test-data], [dnl
337dnl Try a couple of ordinary actions to make sure they're accepted,
338dnl but there's no point in retrying all the actions from the previous test.
339# actions=LOCAL
3400000 0008 fffe 04d2
341
342# actions=mod_dl_src:00:11:22:33:44:55
3430004 0010 001122334455 000000000000
344
345dnl Now check that write_metadata is accepted.
346# actions=write_metadata:0xfedcba9876543210
347ffff 0020 00002320 0016 000000000000 fedcba9876543210 ffffffffffffffff
348
349# actions=write_metadata:0xfedcba9876543210/0xffff0000ffff0000
350ffff 0020 00002320 0016 000000000000 fedcba9876543210 ffff0000ffff0000
351
352])
353sed '/^[[#&]]/d' < test-data > input.txt
354sed -n 's/^# //p; /^$/p' < test-data > expout
355sed -n 's/^& //p' < test-data > experr
356AT_CAPTURE_FILE([input.txt])
357AT_CAPTURE_FILE([expout])
358AT_CAPTURE_FILE([experr])
359AT_CHECK(
65a8a59e 360 [ovs-ofctl '-vPATTERN:console:%c|%p|%m' parse-instructions OpenFlow10 < input.txt],
8f2cded4
BP
361 [0], [expout], [experr])
362AT_CLEANUP
363
d01c980f 364AT_SETUP([OpenFlow 1.1 action translation])
4cceacb9 365AT_KEYWORDS([ofp-actions OF1.1])
d01c980f
BP
366AT_DATA([test-data], [dnl
367# actions=LOCAL
3680000 0010 fffffffe 04d2 000000000000
369
370# actions=CONTROLLER:1234
3710000 0010 fffffffd 04d2 000000000000
372
ca287d20 373# actions=set_vlan_vid:9
d01c980f
BP
3740001 0008 0009 0000
375
ca287d20 376# actions=set_vlan_pcp:6
d01c980f
BP
3770002 0008 06 000000
378
379# actions=mod_dl_src:00:11:22:33:44:55
3800003 0010 001122334455 000000000000
381
382# actions=mod_dl_dst:10:20:30:40:50:60
3830004 0010 102030405060 000000000000
384
385# actions=mod_nw_src:1.2.3.4
3860005 0008 01020304
387
388# actions=mod_nw_dst:192.168.0.1
3890006 0008 c0a80001
390
391# actions=mod_nw_tos:48
3920007 0008 30 000000
393
4b684612
BP
394# actions=mod_nw_ecn:2
3950008 0008 02 000000
396
d01c980f
BP
397# actions=mod_tp_src:80
3980009 0008 0050 0000
399
400# actions=mod_tp_dst:443
401000a 0008 01bb 0000
402
64fcc073 403# actions=pop_vlan
8e61c110
IY
4040012 0008 00000000
405
276c4e7a
SH
406# actions=set_queue:2309737729
4070015 0008 89abcd01
408
3e34fbdd
IY
409dnl 802.1ad isn't supported at the moment
410dnl # actions=push_vlan:0x88a8
411dnl 0011 0008 88a8 0000
412# actions=push_vlan:0x8100
4130011 0008 8100 0000
414
d01c980f
BP
415# actions=resubmit:5
416ffff 0010 00002320 0001 0005 00000000
417
418# actions=set_tunnel:0x12345678
419ffff 0010 00002320 0002 0000 12345678
420
d01c980f
BP
421# actions=pop_queue
422ffff 0010 00002320 0005 000000000000
423
424# actions=move:NXM_OF_IN_PORT[]->NXM_OF_VLAN_TCI[]
425ffff 0018 00002320 0006 0010 0000 0000 00000002 00000802
426
427# actions=load:0xf009->NXM_OF_VLAN_TCI[]
428ffff 0018 00002320 0007 000f 00000802 000000000000f009
429
430# actions=note:11.e9.9a.ad.67.f3
431ffff 0010 00002320 0008 11e99aad67f3
432
433# actions=set_tunnel64:0xc426384d49c53d60
434ffff 0018 00002320 0009 000000000000 c426384d49c53d60
435
436# actions=set_tunnel64:0x885f3298
437ffff 0018 00002320 0009 000000000000 00000000885f3298
438
8f2cded4
BP
439dnl Write-Metadata is only allowed in contexts that allow instructions.
440& ofp_actions|WARN|write_metadata instruction not allowed here
65a8a59e 441# bad OpenFlow11 actions: OFPBIC_UNSUP_INST
4cceacb9
JS
442ffff 0020 00002320 0016 000000000000 fedcba9876543210 ffffffffffffffff
443
d01c980f
BP
444# actions=multipath(eth_src,50,modulo_n,1,0,NXM_NX_REG0[])
445ffff 0020 00002320 000a 0000 0032 0000 0000 0000 0000 0000 0000 001f 00010004
446
91fc374a 447# actions=bundle(eth_src,0,hrw,ofport,members:4,8)
d01c980f
BP
448ffff 0028 00002320 000c 0001 0000 0000 00000002 0002 0000 00000000 00000000 dnl
4490004 0008 00000000
450
91fc374a 451# actions=bundle_load(eth_src,0,hrw,ofport,NXM_NX_REG0[],members:4,8)
d01c980f
BP
452ffff 0028 00002320 000d 0001 0000 0000 00000002 0002 001f 00010004 00000000 dnl
4530004 0008 00000000
454
455# actions=resubmit(10,5)
456ffff 0010 00002320 000e 000a 05 000000
457
2cd20955
JR
458# actions=resubmit(10,5,ct)
459ffff 0010 00002320 002c 000a 05 000000
460
d01c980f
BP
461# actions=output:NXM_NX_REG1[5..10]
462ffff 0018 00002320 000f 0145 00010204 ffff 000000000000
463
464# 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[])
465ffff 0048 00002320 0010 000a 0014 0050 123456789abcdef0 0000 02 00 0002 0004 dnl
466000c 00000802 0000 00000802 0000 dnl
4670030 00000406 0000 00000206 0000 dnl
4681010 00000002 0000 dnl
46900000000
470
471# actions=exit
472ffff 0010 00002320 0011 000000000000
473
7bcb1506
IY
474dnl OpenFlow 1.1 OFPAT_DEC_TTL
475# actions=dec_ttl
4760018 0008 00000000
477
d01c980f
BP
478# actions=fin_timeout(idle_timeout=10,hard_timeout=20)
479ffff 0010 00002320 0013 000a 0014 0000
480
481# actions=controller(reason=invalid_ttl,max_len=1234,id=5678)
482ffff 0010 00002320 0014 04d2 162e 02 00
483
c2d967a5
MM
484# actions=dec_ttl(32768,12345,90,765,1024)
485ffff 0020 00002320 0015 000500000000 80003039005A02fd 0400000000000000
486
29089a54
RL
487# actions=sample(probability=12345,collector_set_id=23456,obs_domain_id=34567,obs_point_id=45678)
488ffff 0018 00002320 001d 3039 00005BA0 00008707 0000B26E
489
13d2c689
BP
490# bad OpenFlow11 actions: OFPBAC_BAD_OUT_PORT
491& ofp_actions|WARN|bad action at offset 0 (OFPBAC_BAD_OUT_PORT):
492& 00000000 00 00 00 10 ff ff ff ff-00 00 00 00 00 00 00 00
4930000 0010 ffffffff 0000 000000000000
494
d01c980f
BP
495])
496sed '/^[[#&]]/d' < test-data > input.txt
497sed -n 's/^# //p; /^$/p' < test-data > expout
498sed -n 's/^& //p' < test-data > experr
499AT_CAPTURE_FILE([input.txt])
500AT_CAPTURE_FILE([expout])
501AT_CAPTURE_FILE([experr])
502AT_CHECK(
65a8a59e 503 [ovs-ofctl '-vPATTERN:console:%c|%p|%m' parse-actions OpenFlow11 < input.txt],
d01c980f
BP
504 [0], [expout], [experr])
505AT_CLEANUP
506
507AT_SETUP([OpenFlow 1.1 instruction translation])
4cceacb9 508AT_KEYWORDS([OF1.1 instruction ofp-actions])
d01c980f
BP
509AT_DATA([test-data], [dnl
510# actions=LOCAL
5110004 0018 00000000 dnl
5120000 0010 fffffffe 04d2 000000000000
513
8dd54666
IY
514dnl Apply-Actions non-zero padding
515# actions=drop
516# 0: 00 -> (none)
517# 1: 04 -> (none)
518# 2: 00 -> (none)
519# 3: 08 -> (none)
520# 4: 00 -> (none)
521# 5: 00 -> (none)
522# 6: 00 -> (none)
523# 7: 01 -> (none)
5240004 0008 00000001
525
d01c980f
BP
526dnl Check that an empty Apply-Actions instruction gets dropped.
527# actions=drop
528# 0: 00 -> (none)
529# 1: 04 -> (none)
530# 2: 00 -> (none)
531# 3: 08 -> (none)
532# 4: 00 -> (none)
533# 5: 00 -> (none)
534# 6: 00 -> (none)
535# 7: 00 -> (none)
5360004 0008 00000000
537
e38c9de5 538dnl Duplicate instruction type:
65a8a59e 539# bad OpenFlow11 instructions: OFPBIC_DUP_INST
d01c980f
BP
5400004 0008 00000000 0004 0008 00000000
541
542dnl Instructions not multiple of 8 in length.
543& ofp_actions|WARN|OpenFlow message instructions length 9 is not a multiple of 8
65a8a59e 544# bad OpenFlow11 instructions: OFPBIC_BAD_LEN
d01c980f
BP
5450004 0009 01 00000000
546
547dnl Goto-Table instruction too long.
65a8a59e 548# bad OpenFlow11 instructions: OFPBIC_BAD_LEN
d01c980f
BP
5490001 0010 01 000000 0000000000000000
550
8dd54666
IY
551dnl Goto-Table 1 instruction non-zero padding
552# actions=goto_table:1
553# 7: 01 -> 00
5540001 0008 01 000001
555
bff7eeb6 556dnl Goto-Table 1 instruction go back to the previous table.
8c87971e 557# bad OpenFlow11 instructions: OFPBIC_BAD_TABLE_ID
bff7eeb6
JA
5582,0001 0008 01 000000
559
8dd54666
IY
560dnl Goto-Table 1
561# actions=goto_table:1
d01c980f
BP
5620001 0008 01 000000
563
4cceacb9
JS
564dnl Write-Metadata.
565# actions=write_metadata:0xfedcba9876543210
d01c980f
BP
5660002 0018 00000000 fedcba9876543210 ffffffffffffffff
567
8f2cded4
BP
568dnl Write-Metadata as Nicira extension action is transformed into instruction.
569# actions=write_metadata:0xfedcba9876543210
570# 1: 04 -> 02
571# 3: 28 -> 18
572# 8: ff -> fe
573# 9: ff -> dc
574# 10: 00 -> ba
575# 11: 20 -> 98
576# 12: 00 -> 76
577# 13: 00 -> 54
578# 14: 23 -> 32
579# 15: 20 -> 10
580# 16: 00 -> ff
581# 17: 16 -> ff
582# 18: 00 -> ff
583# 19: 00 -> ff
584# 20: 00 -> ff
585# 21: 00 -> ff
586# 22: 00 -> ff
587# 23: 00 -> ff
588# 24: fe -> (none)
589# 25: dc -> (none)
590# 26: ba -> (none)
591# 27: 98 -> (none)
592# 28: 76 -> (none)
593# 29: 54 -> (none)
594# 30: 32 -> (none)
595# 31: 10 -> (none)
596# 32: ff -> (none)
597# 33: ff -> (none)
598# 34: ff -> (none)
599# 35: ff -> (none)
600# 36: ff -> (none)
601# 37: ff -> (none)
602# 38: ff -> (none)
603# 39: ff -> (none)
6040004 0028 00000000 ffff 0020 00002320 0016 000000000000 fedcba9876543210 ffffffffffffffff
605
4cceacb9
JS
606dnl Write-Metadata with mask.
607# actions=write_metadata:0xfedcba9876543210/0xff00ff00ff00ff00
6080002 0018 00000000 fedcba9876543210 ff00ff00ff00ff00
609
d01c980f 610dnl Write-Metadata too short.
65a8a59e 611# bad OpenFlow11 instructions: OFPBIC_BAD_LEN
d01c980f
BP
6120002 0010 00000000 fedcba9876543210
613
614dnl Write-Metadata too long.
65a8a59e 615# bad OpenFlow11 instructions: OFPBIC_BAD_LEN
d01c980f
BP
6160002 0020 00000000 fedcba9876543210 ffffffffffffffff 0000000000000000
617
4cceacb9 618dnl Write-Metadata duplicated.
65a8a59e 619# bad OpenFlow11 instructions: OFPBIC_DUP_INST
4cceacb9
JS
6200002 0018 00000000 fedcba9876543210 ff00ff00ff00ff00 0002 0018 00000000 fedcba9876543210 ff00ff00ff00ff00
621
6813ee7c
BP
622dnl Write-Metadata in wrong position (OpenFlow 1.1+ disregards the order
623dnl and OVS reorders it to the canonical order)
624# actions=write_metadata:0xfedcba9876543210,goto_table:1
625# 1: 01 -> 02
626# 3: 08 -> 18
627# 4: 01 -> 00
628# 8: 00 -> fe
629# 9: 02 -> dc
630# 10: 00 -> ba
631# 11: 18 -> 98
632# 12: 00 -> 76
633# 13: 00 -> 54
634# 14: 00 -> 32
635# 15: 00 -> 10
636# 16: fe -> ff
637# 17: dc -> ff
638# 18: ba -> ff
639# 19: 98 -> ff
640# 20: 76 -> ff
641# 21: 54 -> ff
642# 22: 32 -> ff
643# 23: 10 -> ff
644# 24: ff -> 00
645# 25: ff -> 01
646# 26: ff -> 00
647# 27: ff -> 08
648# 28: ff -> 01
649# 29: ff -> 00
650# 30: ff -> 00
651# 31: ff -> 00
4cceacb9
JS
6520001 0008 01 000000 0002 0018 00000000 fedcba9876543210 ffffffffffffffff
653
7fdb60a7
SH
654dnl empty Write-Actions non-zero padding
655# actions=write_actions(drop)
656# 0: 00 -> (none)
657# 1: 03 -> (none)
658# 2: 00 -> (none)
659# 3: 08 -> (none)
660# 4: 00 -> (none)
661# 5: 00 -> (none)
662# 6: 00 -> (none)
663# 7: 01 -> (none)
6640003 0008 00000001
665
666dnl Check that an empty Write-Actions instruction gets dropped.
667# actions=write_actions(drop)
668# 0: 00 -> (none)
669# 1: 03 -> (none)
670# 2: 00 -> (none)
671# 3: 08 -> (none)
672# 4: 00 -> (none)
673# 5: 00 -> (none)
674# 6: 00 -> (none)
675# 7: 00 -> (none)
6760003 0008 00000000
d01c980f 677
b19e8793 678dnl Clear-Actions too-long
65a8a59e 679# bad OpenFlow11 instructions: OFPBIC_BAD_LEN
b19e8793
IY
6800005 0010 00000000 0000000000000000
681
682dnl Clear-Actions non-zero padding
683# actions=clear_actions
684# 7: 01 -> 00
6850005 0008 00000001
686
687dnl Clear-Actions non-zero padding
688# actions=clear_actions
689# 4: 01 -> 00
d01c980f
BP
6900005 0008 01 000000
691
b19e8793
IY
692dnl Clear-Actions
693# actions=clear_actions
6940005 0008 00000000
695
d01c980f 696dnl Experimenter actions not supported yet.
65a8a59e 697# bad OpenFlow11 instructions: OFPBIC_BAD_EXPERIMENTER
d01c980f
BP
698ffff 0008 01 000000
699
700dnl Bad instruction number (0 not assigned).
65a8a59e 701# bad OpenFlow11 instructions: OFPBIC_UNKNOWN_INST
d01c980f
BP
7020000 0008 01 000000
703
704])
705sed '/^[[#&]]/d' < test-data > input.txt
706sed -n 's/^# //p; /^$/p' < test-data > expout
707sed -n 's/^& //p' < test-data > experr
708AT_CAPTURE_FILE([input.txt])
709AT_CAPTURE_FILE([expout])
710AT_CAPTURE_FILE([experr])
711AT_CHECK(
65a8a59e 712 [ovs-ofctl '-vPATTERN:console:%c|%p|%m' parse-instructions OpenFlow11 < input.txt],
d01c980f
BP
713 [0], [expout], [experr])
714AT_CLEANUP
94baabf7 715
178742f9
BP
716dnl Our primary goal here is to verify OpenFlow 1.2-specific changes,
717dnl so the list of tests is short.
718AT_SETUP([OpenFlow 1.2 action translation])
719AT_KEYWORDS([ofp-actions OF1.2])
720AT_DATA([test-data], [dnl
721# actions=LOCAL
7220000 0010 fffffffe 04d2 000000000000
723
724# bad OpenFlow12 actions: OFPBAC_BAD_SET_MASK
725& ofp_actions|WARN|bad action at offset 0 (OFPBAC_BAD_SET_MASK):
726& 00000000 00 19 00 18 80 00 09 0c-00 00 00 00 12 34 00 00
727& 00000010 00 00 ff ff 00 00 00 00-
7280019 0018 8000090c 000000001234 00000000ffff 00000000
729
730])
731sed '/^[[#&]]/d' < test-data > input.txt
732sed -n 's/^# //p; /^$/p' < test-data > expout
733sed -n 's/^& //p' < test-data > experr
734AT_CAPTURE_FILE([input.txt])
735AT_CAPTURE_FILE([expout])
736AT_CAPTURE_FILE([experr])
737AT_CHECK(
738 [ovs-ofctl '-vPATTERN:console:%c|%p|%m' parse-actions OpenFlow12 < input.txt],
739 [0], [expout], [experr])
740AT_CLEANUP
741
914624f8
BP
742dnl Our primary goal here is to verify OpenFlow 1.3-specific changes,
743dnl so the list of tests is short.
744AT_SETUP([OpenFlow 1.3 action translation])
745AT_KEYWORDS([ofp-actions OF1.3])
746AT_DATA([test-data], [dnl
747# actions=LOCAL
7480000 0010 fffffffe 04d2 000000000000
749
750dnl Check the Nicira extension form of "move".
751# actions=move:NXM_OF_IN_PORT[]->NXM_OF_VLAN_TCI[]
752ffff 0018 00002320 0006 0010 0000 0000 00000002 00000802
753
754dnl Check the ONF extension form of "copy_field".
755# actions=move:NXM_OF_IN_PORT[]->NXM_OF_VLAN_TCI[]
756ffff 0020 4f4e4600 0c80 0000 0010 0000 0000 0000 00000002 00000802 00000000
757
731dbbbe 758dnl Check OpenFlow v1.3.4 Conformance Test: 430.500.
759# bad OpenFlow13 actions: OFPBAC_BAD_SET_TYPE
760& ofp_actions|WARN|bad action at offset 0 (OFPBAC_BAD_SET_TYPE):
761& 00000000 00 19 00 08 80 00 fe 00-00 00 00 10 00 00 00 01
762& 00000010 00 00 00 00 00 00 00 00-
7630019 0008 8000fe00 000000100000 000100000000 00000000
764
765dnl Check OpenFlow v1.3.4 Conformance Test: 430.510.
766# bad OpenFlow13 actions: OFPBAC_BAD_SET_LEN
767& ofp_actions|WARN|bad action at offset 0 (OFPBAC_BAD_SET_LEN):
768& 00000000 00 19 00 10 80 00 08 07-00 01 02 03 04 05 00 00
769& 00000010 00 00 00 10 00 00 00 01-
7700019 0010 80000807 000102030405 000000000010 00000001
771
51dec40f
IM
772dnl Check NSH encap (experimenter extension).
773# actions=encap(nsh(md_type=1))
774ffff 0018 00002320 002e 0000 0001894f 0004 01 05 01 000000
775
776dnl NSH encap with non-zero padding.
777# actions=encap(nsh(md_type=1))
778# 21: 12 -> 00
779# 22: 34 -> 00
780# 23: 56 -> 00
781ffff 0018 00002320 002e 0000 0001894f 0004 01 05 01 123456
782
914624f8
BP
783])
784sed '/^[[#&]]/d' < test-data > input.txt
785sed -n 's/^# //p; /^$/p' < test-data > expout
786sed -n 's/^& //p' < test-data > experr
787AT_CAPTURE_FILE([input.txt])
788AT_CAPTURE_FILE([expout])
789AT_CAPTURE_FILE([experr])
790AT_CHECK(
791 [ovs-ofctl '-vPATTERN:console:%c|%p|%m' parse-actions OpenFlow13 < input.txt],
792 [0], [expout], [experr])
793AT_CLEANUP
794
da4425c7
BP
795dnl Our primary goal here is to verify that OpenFlow 1.5-specific changes,
796dnl so the list of tests is short.
73178f20
BP
797AT_SETUP([OpenFlow 1.5 action translation])
798AT_KEYWORDS([ofp-actions OF1.5])
799AT_DATA([test-data], [dnl
800# actions=LOCAL
8010000 0010 fffffffe 04d2 000000000000
802
803# actions=move:NXM_OF_IN_PORT[]->NXM_OF_VLAN_TCI[]
650763d8 804001c 0018 0010 0000 0000 0000 00000002 00000802 00000000
73178f20 805
7eb4b1f1 806# actions=set_field:00:00:00:00:12:34/00:00:00:00:ff:ff->eth_src
178742f9 8070019 0018 8000090c 000000001234 00000000ffff 00000000
da4425c7 808
4332b671
BP
809# actions=meter:5
810001d 0008 00000005
811
73178f20
BP
812])
813sed '/^[[#&]]/d' < test-data > input.txt
814sed -n 's/^# //p; /^$/p' < test-data > expout
815sed -n 's/^& //p' < test-data > experr
816AT_CAPTURE_FILE([input.txt])
817AT_CAPTURE_FILE([expout])
818AT_CAPTURE_FILE([experr])
819AT_CHECK(
820 [ovs-ofctl '-vPATTERN:console:%c|%p|%m' parse-actions OpenFlow15 < input.txt],
821 [0], [expout], [experr])
822AT_CLEANUP
823
94baabf7
SH
824AT_SETUP([ofp-actions - inconsistent MPLS actions])
825OVS_VSWITCHD_START
826dnl OK: Use fin_timeout action on TCP flow
827AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn add-flow br0 'tcp actions=fin_timeout(idle_timeout=1)'])
828dnl Bad: Use fin_timeout action on TCP flow that has been converted to MPLS
829AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn add-flow br0 'tcp actions=push_mpls:0x8847,fin_timeout(idle_timeout=1)'],
830 [1], [], [dnl
ba2fe8e9 831ovs-ofctl: none of the usable flow formats (OpenFlow10,NXM) is among the allowed flow formats (OpenFlow11)
94baabf7
SH
832])
833OVS_VSWITCHD_STOP
834AT_CLEANUP
fa078489
BP
835
836AT_SETUP([reg_load <-> set_field translation corner case])
837AT_KEYWORDS([ofp-actions])
838OVS_VSWITCHD_START
839dnl In OpenFlow 1.3, set_field always sets all the bits in the field,
840dnl but when we translate to NXAST_LOAD we need to only set the bits that
841dnl actually exist (e.g. mpls_label only has 20 bits) otherwise OVS rejects
842dnl the "load" action as invalid. Check that we do this correctly.
843AT_CHECK([ovs-ofctl -O OpenFlow13 add-flow br0 mpls,actions=set_field:10-\>mpls_label])
844AT_CHECK([ovs-ofctl -O OpenFlow10 dump-flows br0 | ofctl_strip], [0], [dnl
845NXST_FLOW reply:
846 mpls actions=load:0xa->OXM_OF_MPLS_LABEL[[]]
847])
848OVS_VSWITCHD_STOP
849AT_CLEANUP
0f2aaee9
BP
850
851AT_SETUP([enqueue action for OF1.1+])
852AT_KEYWORDS([ofp-actions])
853OVS_VSWITCHD_START
854dnl OpenFlow 1.0 has an "enqueue" action. For OpenFlow 1.1+, we translate
855dnl it to a series of actions that accomplish the same thing.
856AT_CHECK([ovs-ofctl -O OpenFlow10 add-flow br0 'actions=enqueue(123,456)'])
857AT_CHECK([ovs-ofctl -O OpenFlow10 dump-flows br0 | ofctl_strip], [0], [dnl
858NXST_FLOW reply:
859 actions=enqueue:123:456
860])
861AT_CHECK([ovs-ofctl -O OpenFlow13 dump-flows br0 | ofctl_strip], [0], [dnl
862OFPST_FLOW reply (OF1.3):
863 reset_counts actions=set_queue:456,output:123,pop_queue
864])
865OVS_VSWITCHD_STOP
866AT_CLEANUP
4b684612 867
56a91749
BP
868AT_SETUP([mod_nw_ttl action for OF1.0])
869AT_KEYWORDS([ofp-actions])
870OVS_VSWITCHD_START
871dnl OpenFlow 1.1+ have a mod_nw_ttl action. For OpenFlow 1.0, we translate
872dnl it to an Open vSwitch extension.
873AT_CHECK([ovs-ofctl -O OpenFlow11 add-flow br0 'ip,actions=mod_nw_ttl:123'])
874AT_CHECK([ovs-ofctl -O OpenFlow10 dump-flows br0 | ofctl_strip], [0], [dnl
875NXST_FLOW reply:
876 ip actions=load:0x7b->NXM_NX_IP_TTL[[]]
877])
878AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip], [0], [dnl
879OFPST_FLOW reply (OF1.1):
880 ip actions=mod_nw_ttl:123
881])
882OVS_VSWITCHD_STOP
883AT_CLEANUP
884
4b684612
BP
885AT_SETUP([mod_nw_ecn action translation])
886AT_KEYWORDS([ofp-actions])
887OVS_VSWITCHD_START
888
889dnl OpenFlow 1.1, but no other version, has a "mod_nw_ecn" action.
890dnl Check that we translate it properly for OF1.0 and OF1.2.
891dnl (OF1.3+ should be the same as OF1.2.)
892AT_CHECK([ovs-ofctl -O OpenFlow11 add-flow br0 'ip,actions=mod_nw_ecn:2'])
893AT_CHECK([ovs-ofctl -O OpenFlow10 dump-flows br0 | ofctl_strip], [0], [dnl
894NXST_FLOW reply:
895 ip actions=load:0x2->NXM_NX_IP_ECN[[]]
896])
897AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip], [0], [dnl
898OFPST_FLOW reply (OF1.1):
899 ip actions=mod_nw_ecn:2
900])
901AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip], [0], [dnl
902OFPST_FLOW reply (OF1.2):
903 ip actions=set_field:2->nw_ecn
904])
905
906dnl Check that OF1.2+ set_field to set ECN is translated into the OF1.1
907dnl mod_nw_ecn action.
908dnl
909dnl We don't do anything equivalent for OF1.0 reg_load because we prefer
910dnl that anything that comes in as reg_load gets translated back to reg_load
911dnl on output. Perhaps this is somewhat inconsistent but it's what OVS
912dnl has done for multiple versions.
913AT_CHECK([ovs-ofctl del-flows br0])
914AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 'ip,actions=set_field:2->ip_ecn'])
915AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip], [0], [dnl
916OFPST_FLOW reply (OF1.1):
917 ip actions=mod_nw_ecn:2
918])
1a1e1a49
EG
919
920dnl Check that OF1.2+ set_field to set ECN is translated for earlier OF
921dnl versions.
922AT_CHECK([ovs-ofctl del-flows br0])
923AT_CHECK([ovs-ofctl -O OpenFlow10 add-flow br0 'ip,actions=set_field:2->ip_ecn'])
924AT_CHECK([ovs-ofctl del-flows br0])
925AT_CHECK([ovs-ofctl -O OpenFlow11 add-flow br0 'ip,actions=set_field:2->ip_ecn'])
926
4b684612
BP
927OVS_VSWITCHD_STOP
928AT_CLEANUP
56a91749 929
70ed59cb
BP
930AT_SETUP([action parsing errors])
931bad_action () {
932 AT_CHECK_UNQUOTED([ovs-ofctl parse-flow "actions=$1"], [1], [],
933 [ovs-ofctl: $2
934])
935}
936
937# output
938bad_action 'output(port=xyzzy,max_len=5)' \
939 "output to unknown truncate port: xyzzy"
940bad_action 'output(port=all,max_len=64)' \
941 "output to unsupported truncate port: all"
942bad_action 'output(port=local,max_len=64,foo=bar)' \
943 "invalid key 'foo' in output_trunc argument"
944bad_action 'output(port=local,max_len=5)' \
945 "max_len 5 is less than the minimum value 14"
946
947# controller
948bad_action 'controller(reason=asdf)' 'unknown reason "asdf"'
949bad_action 'controller(foo=bar)' 'unknown key "foo" parsing controller action'
950bad_action 'controller(userdata=123x456)' \
951 'bad hex digit in `controller'\'' action `userdata'\'
952
953# enqueue
954bad_action 'enqueue:123' \
955 '"enqueue" syntax is "enqueue:PORT:QUEUE" or "enqueue(PORT,QUEUE)"'
956bad_action 'enqueue:asdf:123' 'asdf: enqueue to unknown port'
957
958# bundle
959bad_action 'bundle:123' '123: not enough arguments to bundle action'
960bad_action 'bundle(symmetric_l4,60,hrw,ofport,ports:1,2,3,4,5)' \
91fc374a
BP
961 "symmetric_l4,60,hrw,ofport,ports:1,2,3,4,5: missing member delimiter, expected \`members', got \`ports'"
962bad_action 'bundle(symmetric_l4,60,hrw,ofport,members:xyzzy,2,3,4,5)' \
70ed59cb 963 'xyzzy: bad port number'
91fc374a
BP
964bad_action 'bundle(asymmetric_l4,60,hrw,ofport,members:1,2,3,4,5)' \
965 "asymmetric_l4,60,hrw,ofport,members:1,2,3,4,5: unknown fields \`asymmetric_l4'"
966bad_action 'bundle(symmetric_l4,60,hrt,ofport,members:1,2,3,4,5)' \
967 "symmetric_l4,60,hrt,ofport,members:1,2,3,4,5: unknown algorithm \`hrt'"
968bad_action 'bundle(symmetric_l4,60,hrw,odpport,members:1,2,3,4,5)' \
969 "symmetric_l4,60,hrw,odpport,members:1,2,3,4,5: unknown member_type \`odpport'"
970bad_action 'bundle_load(symmetric_l4,60,hrw,ofport,actset_output,members:1,2,3,4,5)' \
971 "symmetric_l4,60,hrw,ofport,actset_output,members:1,2,3,4,5: experimenter OXM field 'actset_output' not supported"
70ed59cb
BP
972
973# mod_vlan_vid
974bad_action 'mod_vlan_vid:6000' '6000: not a valid VLAN VID'
975
976# mod_vlan_pcp
977bad_action 'mod_vlan_pcp:8' '8: not a valid VLAN PCP'
978
979# push_vlan
980bad_action 'push_vlan(0x1234)' '0x1234: not a valid VLAN ethertype'
981
982# mod_nw_tos
983bad_action 'mod_nw_tos(1)' '1: not a valid TOS'
984
985# mod_nw_ecn
986bad_action 'mod_nw_ecn(5)' '5: not a valid ECN'
987
988# set_field
989bad_action 'set_field:1' "1: missing \`->'"
990bad_action 'set_field:1->' "1->: missing field name following \`->'"
991bad_action 'set_field:1->x' 'x is not a valid OXM field name'
992bad_action 'set_field:1->eth_type' 'eth_type is read-only'
993bad_action 'set_field:1->eth_src' '1: invalid Ethernet address'
994bad_action 'set_field:0xffff->ip_dscp' '0xffff: value too large for 1-byte field ip_dscp'
995bad_action 'set_field:0xff->ip_dscp' '0xff is not a valid value for field ip_dscp'
996
997# reg_load
998bad_action 'load:xyzzy->eth_src' 'xyzzy->eth_src: cannot parse integer value'
999bad_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'
1000
1001# push/pop
1002bad_action 'push(eth_dst[[]]x)' 'x: trailing garbage following push or pop'
1003
1004# dec_ttl
1005bad_action 'dec_ttl(,)' 'dec_ttl_cnt_ids: expected at least one controller id.'
1006
1007# set_mpls_label
1008bad_action 'set_mpls_label' 'set_mpls_label: expected label.'
1009
1010# set_mpls_tc
1011bad_action 'set_mpls_tc' 'set_mpls_tc: expected tc.'
1012
1013# set_mpls_ttl
1014bad_action 'set_mpls_ttl' 'set_mpls_ttl: expected ttl.'
1015
1016# fin_timeout
1017bad_action 'fin_timeout(foo=bar)' "invalid key 'foo' in 'fin_timeout' argument"
1018
1019# encap
1020bad_action 'encap(,)' 'Missing encap hdr: ,'
1021bad_action 'encap(x(y))' 'Encap hdr not supported: y'
1022bad_action 'encap(nsh(type=1))' 'Invalid property: type'
1023bad_action 'encap(nsh(md_type))' 'Value missing for encap property'
1024bad_action 'encap(nsh(md_type=3))' 'invalid md_type'
1025bad_action 'encap(nsh(tlv(,,)))' 'Invalid NSH TLV header: ,,'
1026
1027# decap
1028bad_action 'decap(packet_type(x))' 'Missing packet_type attribute ns'
1029bad_action 'decap(packet_type(ns=99))' 'Unsupported ns value: 99'
1030bad_action 'decap(packet_type(ns=0))' 'Missing packet_type attribute type'
1031bad_action 'decap(foo=bar)' 'Invalid decap argument: foo'
1032
1033# resubmit
1034bad_action 'resubmit(asdf)' 'asdf: resubmit to unknown port'
1035bad_action 'resubmit(,asdf)' 'asdf: resubmit to unknown table'
1036bad_action 'resubmit(1,2,xyzzy)' 'xyzzy: unknown parameter'
1037bad_action 'resubmit(in_port,255)' 'at least one "in_port" or "table" must be specified on resubmit'
1038
1039# learn
1040bad_action 'learn(load:123->actset_output)' \
1041 "123->actset_output: experimenter OXM field 'actset_output' not supported"
1042bad_action 'learn(load:1234->eth_dst[[0..5]])' \
1043 '1234->eth_dst[[0..5]]: value does not fit into 6 bits'
1044bad_action 'learn(actset_output=0x1000)' \
1045 "actset_output=0x1000: experimenter OXM field 'actset_output' not supported"
1046bad_action 'learn(eth_type[[5]]=xyzzy)' \
1047 "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)"
1048bad_action 'learn(eth_type[[0]]=eth_type[[1..2]])' \
1049 'eth_type[[0]]=eth_type[[1..2]]: bit widths of eth_type[[0]] (2) and eth_type[[1..2]] (1) differ'
1050bad_action 'learn(load:->)' "load: missing source before \`->' in \`->'"
1051bad_action 'learn(load:x)' "load: missing \`->' in \`x'"
1052bad_action 'learn(load:1x->foo)' "load: garbage before \`->' in \`1x->foo'"
1053bad_action 'learn(foo)' 'foo: unknown keyword foo'
1054bad_action 'learn(table=foo)' 'unknown table "foo"'
1055bad_action 'learn(table=255)' "table=255: table id 255 not valid for \`learn' action"
1056bad_action 'learn(result_dst=tcp_flags)' 'tcp_flags is read-only'
1057bad_action 'learn(result_dst=eth_dst)' "result_dst in 'learn' action must be a single bit"
1058
1059# conjunction
1060bad_action 'conjunction(1, 1/1)' 'conjunction must have at least 2 clauses'
1061bad_action 'conjunction(1, 1/65)' 'conjunction must have at most 64 clauses'
1062bad_action 'conjunction(1, 0/2)' 'clause index must be positive'
1063bad_action 'conjunction(1, 3/2)' \
1064 'clause index must be less than or equal to number of clauses'
1065
1066# multipath
1067bad_action 'multipath(1,2,3,4)' \
1068 '1,2,3,4: not enough arguments to multipath action'
1069bad_action 'multipath(xyzzy,50,modulo_n,1,0,NXM_NX_REG0[[]])' \
1070 "xyzzy,50,modulo_n,1,0,NXM_NX_REG0[[]]: unknown fields \`xyzzy'"
1071bad_action 'multipath(eth_src,50,fubar,1,0,NXM_NX_REG0[[]])' \
1072 "eth_src,50,fubar,1,0,NXM_NX_REG0[[]]: unknown algorithm \`fubar'"
1073bad_action 'multipath(eth_src,50,modulo_n,0,0,NXM_NX_REG0[[]])' \
1074 "eth_src,50,modulo_n,0,0,NXM_NX_REG0[[]]: n_links 0 is not in valid range 1 to 65536"
1075bad_action 'multipath(eth_src,50,modulo_n,1024,0,actset_output)' \
1076 "eth_src,50,modulo_n,1024,0,actset_output: experimenter OXM field 'actset_output' not supported"
1077bad_action 'multipath(eth_src,50,modulo_n,1024,0,NXM_NX_REG0[[0..7]])' \
1078 "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"
1079
1080# note
1081bad_action 'note:x' "bad hex digit in \`note' argument"
1082
1083# unroll_xlate
1084bad_action 'unroll_xlate' "UNROLL is an internal action that shouldn't be used via OpenFlow"
1085
1086# sample
1087bad_action 'sample(probability=0)' 'invalid probability value "0"'
1088bad_action 'sample(sampling_port=asdf)' 'asdf: unknown port'
1089bad_action 'sample(foo=bar)' 'invalid key "foo" in "sample" argument'
1090bad_action 'sample' 'non-zero "probability" must be specified on sample'
1091
1092# ct
1093bad_action 'ct(table=asdf)' 'unknown table asdf'
1094bad_action 'ct(table=255)' 'invalid table 0xff'
1095bad_action 'ct(foo=bar)' 'invalid argument to "ct" action: `foo'\'
1096bad_action 'ct(force)' '"force" flag requires "commit" flag.'
1097
1098# nat
1099bad_action 'nat(src=1.2.3.4x)' 'garbage (x) after nat range "1.2.3.4x" (pos: 7)'
1100bad_action 'nat(src=1.2.3.4-0.1.2.3)' 'invalid nat range "1.2.3.4-0.1.2.3"'
1101bad_action 'nat(foo=bar)' 'invalid key "foo" in "nat" argument'
1102bad_action 'nat(src=1.2.3.4,dst=2.3.4.5)' 'May only specify one of "src" or "dst".'
1103bad_action 'nat(persistent)' 'Flags allowed only with "src" or "dst".'
1104bad_action 'nat(src=1.2.3.4,hash,random)' 'Both "hash" and "random" are not allowed.'
1105
1106# check_pkt_larger
1107bad_action 'check_pkt_larger(1500)->reg0' \
1108 'Only 1-bit destination field is allowed'
1109
1110# goto_table
1111bad_action 'goto_table:asdf' 'unknown table "asdf"'
1112
1113# nested actions
1114bad_action 'set_field:1234->ct_mark' \
1115 "cannot set CT fields outside of ct action"
1116bad_action 'nat' 'Cannot have NAT action outside of "ct" action'
1117bad_action 'ct(commit,exec(push_vlan(0x8100)))' \
1118 "ct action doesn't support nested action push_vlan"
1119bad_action 'ct(commit,exec(set_field:12:34:56:78:9a:bc->eth_dst))' \
1120 "ct action doesn't support nested modification of eth_dst"
1121bad_action 'conjunction(1, 2/3),ct_clear' \
1122 '"conjunction" actions may be used along with "note" but not any other kind of action (such as the "ct_clear" action used here)'
1123
1124# instructions
1125bad_action 'goto_table:5,goto_table:5' \
1126 'duplicate goto_table instruction not allowed, for OpenFlow 1.1+ compatibility'
1127bad_action 'goto_table:5,clone()' \
1128 'invalid instruction ordering: apply_actions must appear before goto_table, for OpenFlow 1.1+ compatibility'
1129AT_CHECK([ovs-ofctl parse-group 'group_id=1,type=select,bucket=actions=clear_actions'], [1], [],
1130 [ovs-ofctl: clear_actions instruction not allowed here
1131])
1132
1133# ofpacts_parse__()
1134bad_action 'apply_actions' 'apply_actions is the default instruction'
1135bad_action 'xyzzy' 'unknown action xyzzy'
1136bad_action 'drop,3' '"drop" must not be accompanied by any other action or instruction'
1137
1138AT_CLEANUP