1 AT_BANNER([OpenFlow actions])
3 AT_SETUP([OpenFlow 1.0 action translation])
4 AT_KEYWORDS([ofp-actions OF1.0])
5 AT_DATA([test-data], [dnl
9 # actions=CONTROLLER:1234
12 # actions=mod_vlan_vid:9
15 # actions=mod_vlan_pcp:6
21 # actions=mod_dl_src:00:11:22:33:44:55
22 0004 0010 001122334455 000000000000
24 # actions=mod_dl_dst:10:20:30:40:50:60
25 0005 0010 102030405060 000000000000
27 # actions=mod_nw_src:1.2.3.4
30 # actions=mod_nw_dst:192.168.0.1
33 # actions=mod_nw_tos:48
36 # actions=mod_tp_src:80
39 # actions=mod_tp_dst:443
42 # actions=enqueue:10:55
43 000b 0010 000a 000000000000 00000037
46 ffff 0010 00002320 0001 0005 00000000
48 # actions=set_tunnel:0x12345678
49 ffff 0010 00002320 0002 0000 12345678
51 # actions=set_queue:2309737729
52 ffff 0010 00002320 0004 0000 89abcd01
55 ffff 0010 00002320 0005 000000000000
57 # actions=move:NXM_OF_IN_PORT[]->NXM_OF_VLAN_TCI[]
58 ffff 0018 00002320 0006 0010 0000 0000 00000002 00000802
60 # actions=load:0xf009->NXM_OF_VLAN_TCI[]
61 ffff 0018 00002320 0007 000f 00000802 000000000000f009
63 # actions=note:11.e9.9a.ad.67.f3
64 ffff 0010 00002320 0008 11e99aad67f3
66 # actions=set_tunnel64:0xc426384d49c53d60
67 ffff 0018 00002320 0009 000000000000 c426384d49c53d60
69 # actions=set_tunnel64:0x885f3298
70 ffff 0018 00002320 0009 000000000000 00000000885f3298
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
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
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
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
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
91 # actions=resubmit(10,5)
92 ffff 0010 00002320 000e 000a 05 000000
94 # actions=output:NXM_NX_REG1[5..10]
95 ffff 0018 00002320 000f 0145 00010204 ffff 000000000000
97 # 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[])
98 ffff 0048 00002320 0010 000a 0014 0050 123456789abcdef0 0000 02 00 0002 0004 dnl
99 000c 00000802 0000 00000802 0000 dnl
100 0030 00000406 0000 00000206 0000 dnl
101 1010 00000002 0000 dnl
105 ffff 0010 00002320 0011 000000000000
108 ffff 0010 00002320 0012 000000000000
110 # actions=fin_timeout(idle_timeout=10,hard_timeout=20)
111 ffff 0010 00002320 0013 000a 0014 0000
113 # actions=controller(reason=invalid_ttl,max_len=1234,id=5678)
114 ffff 0010 00002320 0014 04d2 162e 02 00
116 # actions=controller(reason=invalid_ttl,max_len=1234,id=5678,userdata=01.02.03.04.05,pause)
117 ffff 0040 00002320 0025 000000000000 dnl
118 0000 0008 04d2 0000 dnl
119 0001 0008 162e 0000 dnl
120 0002 0005 02 000000 dnl
121 0003 0009 0102030405 00000000000000 dnl
124 # actions=dec_ttl(32768,12345,90,765,1024)
125 ffff 0020 00002320 0015 000500000000 80003039005A02fd 0400000000000000
127 # actions=sample(probability=12345,collector_set_id=23456,obs_domain_id=34567,obs_point_id=45678)
128 ffff 0018 00002320 001d 3039 00005BA0 00008707 0000B26E
130 # actions=sample(probability=12345,collector_set_id=23456,obs_domain_id=34567,obs_point_id=45678,sampling_port=56789)
131 ffff 0020 00002320 0026 3039 00005BA0 00008707 0000B26E DDD50000 00000000
133 # bad OpenFlow10 actions: OFPBAC_BAD_LEN
134 & ofp_actions|WARN|OpenFlow action OFPAT_OUTPUT length 240 exceeds action buffer length 8
135 & ofp_actions|WARN|bad action at offset 0 (OFPBAC_BAD_LEN):
136 & 00000000 00 00 00 f0 00 00 00 00-
137 00 00 00 f0 00 00 00 00
139 # bad OpenFlow10 actions: OFPBAC_BAD_LEN
140 & ofp_actions|WARN|OpenFlow action OFPAT_OUTPUT length 16 not in valid range [[8,8]]
141 & ofp_actions|WARN|bad action at offset 0 (OFPBAC_BAD_LEN):
142 & 00000000 00 00 00 10 ff fe ff ff-00 00 00 00 00 00 00 00
143 00 00 00 10 ff fe ff ff 00 00 00 00 00 00 00 00
145 # bad OpenFlow10 actions: OFPBAC_BAD_LEN
146 & ofp_actions|WARN|OpenFlow action NXAST_DEC_TTL_CNT_IDS length 17 is not a multiple of 8
147 ffff 0011 00002320 0015 0001 00000000 0000000000000000
149 # bad OpenFlow10 actions: OFPBAC_BAD_OUT_PORT
153 ffff 0018 00002320 0023 0000 00000000 0000 FF 000000 0000
156 ffff 0018 00002320 0023 0001 00000000 0000 FF 000000 0000
158 # actions=ct(table=10)
159 ffff 0018 00002320 0023 0000 00000000 0000 0A 000000 0000
161 # actions=ct(zone=10)
162 ffff 0018 00002320 0023 0000 00000000 000A FF 000000 0000
164 # actions=ct(zone=NXM_NX_REG0[0..15])
165 ffff 0018 00002320 0023 0000 00010004 000F FF 000000 0000
167 dnl Can't read 8 bits from register into 16-bit zone.
168 # bad OpenFlow10 actions: OFPBAC_BAD_SET_LEN
169 ffff 0018 00002320 0023 0000 00010004 0007 FF 000000 0000
171 dnl Can't read 32 bits from register into 16-bit zone.
172 # bad OpenFlow10 actions: OFPBAC_BAD_SET_LEN
173 ffff 0018 00002320 0023 0000 00010004 001F FF 000000 0000
175 # actions=ct(commit,exec(load:0xf009->NXM_NX_CT_MARK[]))
176 ffff 0030 00002320 0023 0001 00000000 0000 FF 000000 0000 dnl
177 ffff 0018 00002320 0007 001f 0001d604 000000000000f009
179 # bad OpenFlow10 actions: OFPBAC_BAD_SET_ARGUMENT
180 & ofp_actions|WARN|cannot set CT fields outside of ct action
181 ffff 0018 00002320 0007 001f 0001d604 000000000000f009
183 # bad OpenFlow10 actions: OFPBAC_BAD_SET_ARGUMENT
184 & meta_flow|WARN|destination field ct_zone is not writable
185 ffff 0030 00002320 0023 0001 00000000 0000 FF 000000 0000 dnl
186 ffff 0018 00002320 0007 000f 0001d504 000000000000f009
188 # bad OpenFlow10 actions: OFPBAC_BAD_ARGUMENT
189 & ofp_actions|WARN|ct action doesn't support nested action ct
190 ffff 0030 00002320 0023 0001 00000000 0000 FF 000000 0000 dnl
191 ffff 0018 00002320 0023 0000 00000000 0000 FF 000000 0000
193 # bad OpenFlow10 actions: OFPBAC_BAD_ARGUMENT
194 & ofp_actions|WARN|ct action doesn't support nested modification of reg0
195 ffff 0030 00002320 0023 0001 00000000 0000 FF 000000 0000 dnl
196 ffff 0018 00002320 0007 001f 00010004 000000000000f009
198 # actions=ct(alg=ftp)
199 ffff 0018 00002320 0023 0000 00000000 0000 FF 000000 0015
201 # actions=ct(commit,nat(src))
202 ffff 0028 00002320 0023 0001 00000000 0000 FF 000000 0000 dnl
203 ffff 0010 00002320 0024 00 00 0001 0000
205 # actions=ct(commit,nat(dst))
206 ffff 0028 00002320 0023 0001 00000000 0000 FF 000000 0000 dnl
207 ffff 0010 00002320 0024 00 00 0002 0000
210 ffff 0028 00002320 0023 0000 00000000 0000 FF 000000 0000 dnl
211 ffff 0010 00002320 0024 00 00 0000 0000
213 # actions=ct(commit,nat(src=10.0.0.240,random))
214 ffff 0030 00002320 0023 0001 00000000 0000 FF 000000 0000 dnl
215 ffff 0018 00002320 0024 00 00 0011 0001 0a0000f0 00000000
217 # actions=ct(commit,nat(src=10.0.0.240:32768-65535,random))
218 ffff 0030 00002320 0023 0001 00000000 0000 FF 000000 0000 dnl
219 ffff 0018 00002320 0024 00 00 0011 0031 0a0000f0 8000ffff
221 # actions=ct(commit,nat(dst=10.0.0.128-10.0.0.254,hash))
222 ffff 0030 00002320 0023 0001 00000000 0000 FF 000000 0000 dnl
223 ffff 0018 00002320 0024 00 00 000a 0003 0a000080 0a0000fe
225 # actions=ct(commit,nat(src=10.0.0.240-10.0.0.254:32768-65535,persistent))
226 ffff 0038 00002320 0023 0001 00000000 0000 FF 000000 0000 dnl
227 ffff 0020 00002320 0024 00 00 0005 0033 0a0000f0 0a0000fe 8000ffff 00000000
229 # actions=ct(commit,nat(src=fe80::20c:29ff:fe88:a18b,random))
230 ffff 0038 00002320 0023 0001 00000000 0000 FF 000000 0000 dnl
231 ffff 0020 00002320 0024 00 00 0011 0004 fe800000 00000000 020c 29ff fe88 a18b
233 # actions=ct(commit,nat(src=fe80::20c:29ff:fe88:1-fe80::20c:29ff:fe88:a18b,random))
234 ffff 0048 00002320 0023 0001 00000000 0000 FF 000000 0000 dnl
235 ffff 0030 00002320 0024 00 00 0011 000c fe800000 00000000 020c 29ff fe88 0001 fe800000 00000000 020c 29ff fe88 a18b
237 # actions=ct(commit,nat(src=[fe80::20c:29ff:fe88:1]-[fe80::20c:29ff:fe88:a18b]:255-4096,random))
238 ffff 0050 00002320 0023 0001 00000000 0000 FF 000000 0000 dnl
239 ffff 0038 00002320 0024 00 00 0011 003c dnl
240 fe800000 00000000 020c 29ff fe88 0001 dnl
241 fe800000 00000000 020c 29ff fe88 a18b dnl
244 # actions=output(port=1,max_len=100)
245 ffff 0010 00002320 0027 0001 00000064
248 ffff 0010 00002320 0028 0000 00000005
250 # bad OpenFlow10 actions: NXBRC_MUST_BE_ZERO
251 ffff 0018 00002320 0025 0000 0005 0000 1122334455 000005
253 # bad OpenFlow10 actions: NXBRC_MUST_BE_ZERO
254 ffff 0018 00002320 0025 0000 0005 5000 1122334455 000000
256 # bad OpenFlow10 actions: OFPBAC_BAD_ARGUMENT
257 ffff 0048 00002320 0023 0001 00000000 0000 FF 000000 0000 dnl
258 ffff 0030 00002320 0024 00 00 0011 000c fe800000 00000000 020c 29ff fe88 a18b fe800000 00000000 020c 29ff fe88 0001
261 sed '/^[[#&]]/d' < test-data > input.txt
262 sed -n 's/^# //p; /^$/p' < test-data > expout
263 sed -n 's/^& //p' < test-data > experr
264 AT_CAPTURE_FILE([input.txt])
265 AT_CAPTURE_FILE([expout])
266 AT_CAPTURE_FILE([experr])
268 [ovs-ofctl '-vPATTERN:console:%c|%p|%m' parse-actions OpenFlow10 < input.txt],
269 [0], [expout], [experr])
272 AT_SETUP([OpenFlow 1.0 "instruction" translations])
273 AT_KEYWORDS([ofp-actions OF1.0 instruction])
274 AT_DATA([test-data], [dnl
275 dnl Try a couple of ordinary actions to make sure they're accepted,
276 dnl but there's no point in retrying all the actions from the previous test.
280 # actions=mod_dl_src:00:11:22:33:44:55
281 0004 0010 001122334455 000000000000
283 dnl Now check that write_metadata is accepted.
284 # actions=write_metadata:0xfedcba9876543210
285 ffff 0020 00002320 0016 000000000000 fedcba9876543210 ffffffffffffffff
287 # actions=write_metadata:0xfedcba9876543210/0xffff0000ffff0000
288 ffff 0020 00002320 0016 000000000000 fedcba9876543210 ffff0000ffff0000
291 sed '/^[[#&]]/d' < test-data > input.txt
292 sed -n 's/^# //p; /^$/p' < test-data > expout
293 sed -n 's/^& //p' < test-data > experr
294 AT_CAPTURE_FILE([input.txt])
295 AT_CAPTURE_FILE([expout])
296 AT_CAPTURE_FILE([experr])
298 [ovs-ofctl '-vPATTERN:console:%c|%p|%m' parse-instructions OpenFlow10 < input.txt],
299 [0], [expout], [experr])
302 AT_SETUP([OpenFlow 1.1 action translation])
303 AT_KEYWORDS([ofp-actions OF1.1])
304 AT_DATA([test-data], [dnl
306 0000 0010 fffffffe 04d2 000000000000
308 # actions=CONTROLLER:1234
309 0000 0010 fffffffd 04d2 000000000000
311 # actions=set_vlan_vid:9
314 # actions=set_vlan_pcp:6
317 # actions=mod_dl_src:00:11:22:33:44:55
318 0003 0010 001122334455 000000000000
320 # actions=mod_dl_dst:10:20:30:40:50:60
321 0004 0010 102030405060 000000000000
323 # actions=mod_nw_src:1.2.3.4
326 # actions=mod_nw_dst:192.168.0.1
329 # actions=mod_nw_tos:48
332 # actions=mod_tp_src:80
335 # actions=mod_tp_dst:443
341 # actions=set_queue:2309737729
344 dnl 802.1ad isn't supported at the moment
345 dnl # actions=push_vlan:0x88a8
346 dnl 0011 0008 88a8 0000
347 # actions=push_vlan:0x8100
351 ffff 0010 00002320 0001 0005 00000000
353 # actions=set_tunnel:0x12345678
354 ffff 0010 00002320 0002 0000 12345678
357 ffff 0010 00002320 0005 000000000000
359 # actions=move:NXM_OF_IN_PORT[]->NXM_OF_VLAN_TCI[]
360 ffff 0018 00002320 0006 0010 0000 0000 00000002 00000802
362 # actions=load:0xf009->NXM_OF_VLAN_TCI[]
363 ffff 0018 00002320 0007 000f 00000802 000000000000f009
365 # actions=note:11.e9.9a.ad.67.f3
366 ffff 0010 00002320 0008 11e99aad67f3
368 # actions=set_tunnel64:0xc426384d49c53d60
369 ffff 0018 00002320 0009 000000000000 c426384d49c53d60
371 # actions=set_tunnel64:0x885f3298
372 ffff 0018 00002320 0009 000000000000 00000000885f3298
374 dnl Write-Metadata is only allowed in contexts that allow instructions.
375 & ofp_actions|WARN|write_metadata instruction not allowed here
376 # bad OpenFlow11 actions: OFPBIC_UNSUP_INST
377 ffff 0020 00002320 0016 000000000000 fedcba9876543210 ffffffffffffffff
379 # actions=multipath(eth_src,50,modulo_n,1,0,NXM_NX_REG0[])
380 ffff 0020 00002320 000a 0000 0032 0000 0000 0000 0000 0000 0000 001f 00010004
382 # actions=bundle(eth_src,0,hrw,ofport,slaves:4,8)
383 ffff 0028 00002320 000c 0001 0000 0000 00000002 0002 0000 00000000 00000000 dnl
386 # actions=bundle_load(eth_src,0,hrw,ofport,NXM_NX_REG0[],slaves:4,8)
387 ffff 0028 00002320 000d 0001 0000 0000 00000002 0002 001f 00010004 00000000 dnl
390 # actions=resubmit(10,5)
391 ffff 0010 00002320 000e 000a 05 000000
393 # actions=output:NXM_NX_REG1[5..10]
394 ffff 0018 00002320 000f 0145 00010204 ffff 000000000000
396 # 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[])
397 ffff 0048 00002320 0010 000a 0014 0050 123456789abcdef0 0000 02 00 0002 0004 dnl
398 000c 00000802 0000 00000802 0000 dnl
399 0030 00000406 0000 00000206 0000 dnl
400 1010 00000002 0000 dnl
404 ffff 0010 00002320 0011 000000000000
406 dnl OpenFlow 1.1 OFPAT_DEC_TTL
410 # actions=fin_timeout(idle_timeout=10,hard_timeout=20)
411 ffff 0010 00002320 0013 000a 0014 0000
413 # actions=controller(reason=invalid_ttl,max_len=1234,id=5678)
414 ffff 0010 00002320 0014 04d2 162e 02 00
416 # actions=dec_ttl(32768,12345,90,765,1024)
417 ffff 0020 00002320 0015 000500000000 80003039005A02fd 0400000000000000
419 # actions=sample(probability=12345,collector_set_id=23456,obs_domain_id=34567,obs_point_id=45678)
420 ffff 0018 00002320 001d 3039 00005BA0 00008707 0000B26E
422 # bad OpenFlow11 actions: OFPBAC_BAD_OUT_PORT
423 & ofp_actions|WARN|bad action at offset 0 (OFPBAC_BAD_OUT_PORT):
424 & 00000000 00 00 00 10 ff ff ff ff-00 00 00 00 00 00 00 00
425 0000 0010 ffffffff 0000 000000000000
428 sed '/^[[#&]]/d' < test-data > input.txt
429 sed -n 's/^# //p; /^$/p' < test-data > expout
430 sed -n 's/^& //p' < test-data > experr
431 AT_CAPTURE_FILE([input.txt])
432 AT_CAPTURE_FILE([expout])
433 AT_CAPTURE_FILE([experr])
435 [ovs-ofctl '-vPATTERN:console:%c|%p|%m' parse-actions OpenFlow11 < input.txt],
436 [0], [expout], [experr])
439 AT_SETUP([OpenFlow 1.1 instruction translation])
440 AT_KEYWORDS([OF1.1 instruction ofp-actions])
441 AT_DATA([test-data], [dnl
443 0004 0018 00000000 dnl
444 0000 0010 fffffffe 04d2 000000000000
446 dnl Apply-Actions non-zero padding
458 dnl Check that an empty Apply-Actions instruction gets dropped.
470 dnl Duplicate instruction type:
471 # bad OpenFlow11 instructions: OFPBIC_DUP_INST
472 0004 0008 00000000 0004 0008 00000000
474 dnl Instructions not multiple of 8 in length.
475 & ofp_actions|WARN|OpenFlow message instructions length 9 is not a multiple of 8
476 # bad OpenFlow11 instructions: OFPBIC_BAD_LEN
477 0004 0009 01 00000000
479 dnl Goto-Table instruction too long.
480 # bad OpenFlow11 instructions: OFPBIC_BAD_LEN
481 0001 0010 01 000000 0000000000000000
483 dnl Goto-Table 1 instruction non-zero padding
484 # actions=goto_table:1
488 dnl Goto-Table 1 instruction go back to the previous table.
489 # bad OpenFlow11 instructions: OFPBIC_BAD_TABLE_ID
490 2,0001 0008 01 000000
493 # actions=goto_table:1
497 # actions=write_metadata:0xfedcba9876543210
498 0002 0018 00000000 fedcba9876543210 ffffffffffffffff
500 dnl Write-Metadata as Nicira extension action is transformed into instruction.
501 # actions=write_metadata:0xfedcba9876543210
536 0004 0028 00000000 ffff 0020 00002320 0016 000000000000 fedcba9876543210 ffffffffffffffff
538 dnl Write-Metadata with mask.
539 # actions=write_metadata:0xfedcba9876543210/0xff00ff00ff00ff00
540 0002 0018 00000000 fedcba9876543210 ff00ff00ff00ff00
542 dnl Write-Metadata too short.
543 # bad OpenFlow11 instructions: OFPBIC_BAD_LEN
544 0002 0010 00000000 fedcba9876543210
546 dnl Write-Metadata too long.
547 # bad OpenFlow11 instructions: OFPBIC_BAD_LEN
548 0002 0020 00000000 fedcba9876543210 ffffffffffffffff 0000000000000000
550 dnl Write-Metadata duplicated.
551 # bad OpenFlow11 instructions: OFPBIC_DUP_INST
552 0002 0018 00000000 fedcba9876543210 ff00ff00ff00ff00 0002 0018 00000000 fedcba9876543210 ff00ff00ff00ff00
554 dnl Write-Metadata in wrong position (OpenFlow 1.1+ disregards the order
555 dnl and OVS reorders it to the canonical order)
556 # actions=write_metadata:0xfedcba9876543210,goto_table:1
584 0001 0008 01 000000 0002 0018 00000000 fedcba9876543210 ffffffffffffffff
586 dnl empty Write-Actions non-zero padding
587 # actions=write_actions(drop)
598 dnl Check that an empty Write-Actions instruction gets dropped.
599 # actions=write_actions(drop)
610 dnl Clear-Actions too-long
611 # bad OpenFlow11 instructions: OFPBIC_BAD_LEN
612 0005 0010 00000000 0000000000000000
614 dnl Clear-Actions non-zero padding
615 # actions=clear_actions
619 dnl Clear-Actions non-zero padding
620 # actions=clear_actions
625 # actions=clear_actions
628 dnl Experimenter actions not supported yet.
629 # bad OpenFlow11 instructions: OFPBIC_BAD_EXPERIMENTER
632 dnl Bad instruction number (0 not assigned).
633 # bad OpenFlow11 instructions: OFPBIC_UNKNOWN_INST
637 sed '/^[[#&]]/d' < test-data > input.txt
638 sed -n 's/^# //p; /^$/p' < test-data > expout
639 sed -n 's/^& //p' < test-data > experr
640 AT_CAPTURE_FILE([input.txt])
641 AT_CAPTURE_FILE([expout])
642 AT_CAPTURE_FILE([experr])
644 [ovs-ofctl '-vPATTERN:console:%c|%p|%m' parse-instructions OpenFlow11 < input.txt],
645 [0], [expout], [experr])
648 dnl Our primary goal here is to verify OpenFlow 1.2-specific changes,
649 dnl so the list of tests is short.
650 AT_SETUP([OpenFlow 1.2 action translation])
651 AT_KEYWORDS([ofp-actions OF1.2])
652 AT_DATA([test-data], [dnl
654 0000 0010 fffffffe 04d2 000000000000
656 # bad OpenFlow12 actions: OFPBAC_BAD_SET_MASK
657 & ofp_actions|WARN|bad action at offset 0 (OFPBAC_BAD_SET_MASK):
658 & 00000000 00 19 00 18 80 00 09 0c-00 00 00 00 12 34 00 00
659 & 00000010 00 00 ff ff 00 00 00 00-
660 0019 0018 8000090c 000000001234 00000000ffff 00000000
663 sed '/^[[#&]]/d' < test-data > input.txt
664 sed -n 's/^# //p; /^$/p' < test-data > expout
665 sed -n 's/^& //p' < test-data > experr
666 AT_CAPTURE_FILE([input.txt])
667 AT_CAPTURE_FILE([expout])
668 AT_CAPTURE_FILE([experr])
670 [ovs-ofctl '-vPATTERN:console:%c|%p|%m' parse-actions OpenFlow12 < input.txt],
671 [0], [expout], [experr])
674 dnl Our primary goal here is to verify OpenFlow 1.3-specific changes,
675 dnl so the list of tests is short.
676 AT_SETUP([OpenFlow 1.3 action translation])
677 AT_KEYWORDS([ofp-actions OF1.3])
678 AT_DATA([test-data], [dnl
680 0000 0010 fffffffe 04d2 000000000000
682 dnl Check the Nicira extension form of "move".
683 # actions=move:NXM_OF_IN_PORT[]->NXM_OF_VLAN_TCI[]
684 ffff 0018 00002320 0006 0010 0000 0000 00000002 00000802
686 dnl Check the ONF extension form of "copy_field".
687 # actions=move:NXM_OF_IN_PORT[]->NXM_OF_VLAN_TCI[]
688 ffff 0020 4f4e4600 0c80 0000 0010 0000 0000 0000 00000002 00000802 00000000
691 sed '/^[[#&]]/d' < test-data > input.txt
692 sed -n 's/^# //p; /^$/p' < test-data > expout
693 sed -n 's/^& //p' < test-data > experr
694 AT_CAPTURE_FILE([input.txt])
695 AT_CAPTURE_FILE([expout])
696 AT_CAPTURE_FILE([experr])
698 [ovs-ofctl '-vPATTERN:console:%c|%p|%m' parse-actions OpenFlow13 < input.txt],
699 [0], [expout], [experr])
702 dnl Our primary goal here is to verify that OpenFlow 1.5-specific changes,
703 dnl so the list of tests is short.
704 AT_SETUP([OpenFlow 1.5 action translation])
705 AT_KEYWORDS([ofp-actions OF1.5])
706 AT_DATA([test-data], [dnl
708 0000 0010 fffffffe 04d2 000000000000
710 # actions=move:NXM_OF_IN_PORT[]->NXM_OF_VLAN_TCI[]
711 001c 0018 0010 0000 0000 0000 00000002 00000802 00000000
713 # actions=set_field:00:00:00:00:12:34/00:00:00:00:ff:ff->eth_src
714 0019 0018 8000090c 000000001234 00000000ffff 00000000
717 sed '/^[[#&]]/d' < test-data > input.txt
718 sed -n 's/^# //p; /^$/p' < test-data > expout
719 sed -n 's/^& //p' < test-data > experr
720 AT_CAPTURE_FILE([input.txt])
721 AT_CAPTURE_FILE([expout])
722 AT_CAPTURE_FILE([experr])
724 [ovs-ofctl '-vPATTERN:console:%c|%p|%m' parse-actions OpenFlow15 < input.txt],
725 [0], [expout], [experr])
728 AT_SETUP([ofp-actions - inconsistent MPLS actions])
730 dnl OK: Use fin_timeout action on TCP flow
731 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn add-flow br0 'tcp actions=fin_timeout(idle_timeout=1)'])
732 dnl Bad: Use fin_timeout action on TCP flow that has been converted to MPLS
733 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn add-flow br0 'tcp actions=push_mpls:0x8847,fin_timeout(idle_timeout=1)'],
735 ovs-ofctl: none of the usable flow formats (OpenFlow10,NXM) is among the allowed flow formats (OpenFlow11)
740 AT_SETUP([reg_load <-> set_field translation corner case])
741 AT_KEYWORDS([ofp-actions])
743 dnl In OpenFlow 1.3, set_field always sets all the bits in the field,
744 dnl but when we translate to NXAST_LOAD we need to only set the bits that
745 dnl actually exist (e.g. mpls_label only has 20 bits) otherwise OVS rejects
746 dnl the "load" action as invalid. Check that we do this correctly.
747 AT_CHECK([ovs-ofctl -O OpenFlow13 add-flow br0 mpls,actions=set_field:10-\>mpls_label])
748 AT_CHECK([ovs-ofctl -O OpenFlow10 dump-flows br0 | ofctl_strip], [0], [dnl
750 mpls actions=load:0xa->OXM_OF_MPLS_LABEL[[]]
755 AT_SETUP([enqueue action for OF1.1+])
756 AT_KEYWORDS([ofp-actions])
758 dnl OpenFlow 1.0 has an "enqueue" action. For OpenFlow 1.1+, we translate
759 dnl it to a series of actions that accomplish the same thing.
760 AT_CHECK([ovs-ofctl -O OpenFlow10 add-flow br0 'actions=enqueue(123,456)'])
761 AT_CHECK([ovs-ofctl -O OpenFlow10 dump-flows br0 | ofctl_strip], [0], [dnl
763 actions=enqueue:123:456
765 AT_CHECK([ovs-ofctl -O OpenFlow13 dump-flows br0 | ofctl_strip], [0], [dnl
766 OFPST_FLOW reply (OF1.3):
767 reset_counts actions=set_queue:456,output:123,pop_queue