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=dec_ttl(32768,12345,90,765,1024)
117 ffff 0020 00002320 0015 000500000000 80003039005A02fd 0400000000000000
119 # actions=sample(probability=12345,collector_set_id=23456,obs_domain_id=34567,obs_point_id=45678)
120 ffff 0018 00002320 001d 3039 00005BA0 00008707 0000B26E
122 # bad OpenFlow10 actions: OFPBAC_BAD_LEN
123 & ofp_actions|WARN|OpenFlow action OFPAT_OUTPUT length 240 exceeds action buffer length 8
124 & ofp_actions|WARN|bad action at offset 0 (OFPBAC_BAD_LEN):
125 & 00000000 00 00 00 f0 00 00 00 00-
126 00 00 00 f0 00 00 00 00
128 # bad OpenFlow10 actions: OFPBAC_BAD_LEN
129 & ofp_actions|WARN|OpenFlow action OFPAT_OUTPUT length 16 not in valid range [[8,8]]
130 & ofp_actions|WARN|bad action at offset 0 (OFPBAC_BAD_LEN):
131 & 00000000 00 00 00 10 ff fe ff ff-00 00 00 00 00 00 00 00
132 00 00 00 10 ff fe ff ff 00 00 00 00 00 00 00 00
134 # bad OpenFlow10 actions: OFPBAC_BAD_LEN
135 & ofp_actions|WARN|OpenFlow action NXAST_DEC_TTL_CNT_IDS length 17 is not a multiple of 8
136 ffff 0011 00002320 0015 0001 00000000 0000000000000000
138 # bad OpenFlow10 actions: OFPBAC_BAD_OUT_PORT
142 ffff 0018 00002320 0023 0000 00000000 0000 FF 000000 0000
145 ffff 0018 00002320 0023 0001 00000000 0000 FF 000000 0000
147 # actions=ct(table=10)
148 ffff 0018 00002320 0023 0000 00000000 0000 0A 000000 0000
150 # actions=ct(zone=10)
151 ffff 0018 00002320 0023 0000 00000000 000A FF 000000 0000
153 # actions=ct(zone=NXM_NX_REG0[0..15])
154 ffff 0018 00002320 0023 0000 00010004 000F FF 000000 0000
156 dnl Can't read 8 bits from register into 16-bit zone.
157 # bad OpenFlow10 actions: OFPBAC_BAD_SET_LEN
158 ffff 0018 00002320 0023 0000 00010004 0007 FF 000000 0000
160 dnl Can't read 32 bits from register into 16-bit zone.
161 # bad OpenFlow10 actions: OFPBAC_BAD_SET_LEN
162 ffff 0018 00002320 0023 0000 00010004 001F FF 000000 0000
164 # actions=ct(commit,exec(load:0xf009->NXM_NX_CT_MARK[]))
165 ffff 0030 00002320 0023 0001 00000000 0000 FF 000000 0000 dnl
166 ffff 0018 00002320 0007 001f 0001d604 000000000000f009
168 # bad OpenFlow10 actions: OFPBAC_BAD_SET_ARGUMENT
169 & ofp_actions|WARN|cannot set CT fields outside of ct action
170 ffff 0018 00002320 0007 001f 0001d604 000000000000f009
172 # bad OpenFlow10 actions: OFPBAC_BAD_SET_ARGUMENT
173 & meta_flow|WARN|destination field ct_zone is not writable
174 ffff 0030 00002320 0023 0001 00000000 0000 FF 000000 0000 dnl
175 ffff 0018 00002320 0007 000f 0001d504 000000000000f009
177 # bad OpenFlow10 actions: OFPBAC_BAD_ARGUMENT
178 & ofp_actions|WARN|ct action doesn't support nested action ct
179 ffff 0030 00002320 0023 0001 00000000 0000 FF 000000 0000 dnl
180 ffff 0018 00002320 0023 0000 00000000 0000 FF 000000 0000
182 # bad OpenFlow10 actions: OFPBAC_BAD_ARGUMENT
183 & ofp_actions|WARN|ct action doesn't support nested modification of reg0
184 ffff 0030 00002320 0023 0001 00000000 0000 FF 000000 0000 dnl
185 ffff 0018 00002320 0007 001f 00010004 000000000000f009
187 # actions=ct(alg=ftp)
188 ffff 0018 00002320 0023 0000 00000000 0000 FF 000000 0015
190 # actions=ct(commit,nat(src))
191 ffff 0028 00002320 0023 0001 00000000 0000 FF 000000 0000 dnl
192 ffff 0010 00002320 0024 00 00 0001 0000
194 # actions=ct(commit,nat(dst))
195 ffff 0028 00002320 0023 0001 00000000 0000 FF 000000 0000 dnl
196 ffff 0010 00002320 0024 00 00 0002 0000
199 ffff 0028 00002320 0023 0000 00000000 0000 FF 000000 0000 dnl
200 ffff 0010 00002320 0024 00 00 0000 0000
202 # actions=ct(commit,nat(src=10.0.0.240,random))
203 ffff 0030 00002320 0023 0001 00000000 0000 FF 000000 0000 dnl
204 ffff 0018 00002320 0024 00 00 0011 0001 0a0000f0 00000000
206 # actions=ct(commit,nat(src=10.0.0.240:32768-65535,random))
207 ffff 0030 00002320 0023 0001 00000000 0000 FF 000000 0000 dnl
208 ffff 0018 00002320 0024 00 00 0011 0031 0a0000f0 8000ffff
210 # actions=ct(commit,nat(dst=10.0.0.128-10.0.0.254,hash))
211 ffff 0030 00002320 0023 0001 00000000 0000 FF 000000 0000 dnl
212 ffff 0018 00002320 0024 00 00 000a 0003 0a000080 0a0000fe
214 # actions=ct(commit,nat(src=10.0.0.240-10.0.0.254:32768-65535,persistent))
215 ffff 0038 00002320 0023 0001 00000000 0000 FF 000000 0000 dnl
216 ffff 0020 00002320 0024 00 00 0005 0033 0a0000f0 0a0000fe 8000ffff 00000000
218 # actions=ct(commit,nat(src=fe80::20c:29ff:fe88:a18b,random))
219 ffff 0038 00002320 0023 0001 00000000 0000 FF 000000 0000 dnl
220 ffff 0020 00002320 0024 00 00 0011 0004 fe800000 00000000 020c 29ff fe88 a18b
222 # actions=ct(commit,nat(src=fe80::20c:29ff:fe88:1-fe80::20c:29ff:fe88:a18b,random))
223 ffff 0048 00002320 0023 0001 00000000 0000 FF 000000 0000 dnl
224 ffff 0030 00002320 0024 00 00 0011 000c fe800000 00000000 020c 29ff fe88 0001 fe800000 00000000 020c 29ff fe88 a18b
226 # actions=ct(commit,nat(src=[fe80::20c:29ff:fe88:1]-[fe80::20c:29ff:fe88:a18b]:255-4096,random))
227 ffff 0050 00002320 0023 0001 00000000 0000 FF 000000 0000 dnl
228 ffff 0038 00002320 0024 00 00 0011 003c dnl
229 fe800000 00000000 020c 29ff fe88 0001 dnl
230 fe800000 00000000 020c 29ff fe88 a18b dnl
233 # bad OpenFlow10 actions: OFPBAC_BAD_ARGUMENT
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 a18b fe800000 00000000 020c 29ff fe88 0001
238 sed '/^[[#&]]/d' < test-data > input.txt
239 sed -n 's/^# //p; /^$/p' < test-data > expout
240 sed -n 's/^& //p' < test-data > experr
241 AT_CAPTURE_FILE([input.txt])
242 AT_CAPTURE_FILE([expout])
243 AT_CAPTURE_FILE([experr])
245 [ovs-ofctl '-vPATTERN:console:%c|%p|%m' parse-actions OpenFlow10 < input.txt],
246 [0], [expout], [experr])
249 AT_SETUP([OpenFlow 1.0 "instruction" translations])
250 AT_KEYWORDS([ofp-actions OF1.0 instruction])
251 AT_DATA([test-data], [dnl
252 dnl Try a couple of ordinary actions to make sure they're accepted,
253 dnl but there's no point in retrying all the actions from the previous test.
257 # actions=mod_dl_src:00:11:22:33:44:55
258 0004 0010 001122334455 000000000000
260 dnl Now check that write_metadata is accepted.
261 # actions=write_metadata:0xfedcba9876543210
262 ffff 0020 00002320 0016 000000000000 fedcba9876543210 ffffffffffffffff
264 # actions=write_metadata:0xfedcba9876543210/0xffff0000ffff0000
265 ffff 0020 00002320 0016 000000000000 fedcba9876543210 ffff0000ffff0000
268 sed '/^[[#&]]/d' < test-data > input.txt
269 sed -n 's/^# //p; /^$/p' < test-data > expout
270 sed -n 's/^& //p' < test-data > experr
271 AT_CAPTURE_FILE([input.txt])
272 AT_CAPTURE_FILE([expout])
273 AT_CAPTURE_FILE([experr])
275 [ovs-ofctl '-vPATTERN:console:%c|%p|%m' parse-instructions OpenFlow10 < input.txt],
276 [0], [expout], [experr])
279 AT_SETUP([OpenFlow 1.1 action translation])
280 AT_KEYWORDS([ofp-actions OF1.1])
281 AT_DATA([test-data], [dnl
283 0000 0010 fffffffe 04d2 000000000000
285 # actions=CONTROLLER:1234
286 0000 0010 fffffffd 04d2 000000000000
288 # actions=set_vlan_vid:9
291 # actions=set_vlan_pcp:6
294 # actions=mod_dl_src:00:11:22:33:44:55
295 0003 0010 001122334455 000000000000
297 # actions=mod_dl_dst:10:20:30:40:50:60
298 0004 0010 102030405060 000000000000
300 # actions=mod_nw_src:1.2.3.4
303 # actions=mod_nw_dst:192.168.0.1
306 # actions=mod_nw_tos:48
309 # actions=mod_tp_src:80
312 # actions=mod_tp_dst:443
318 # actions=set_queue:2309737729
321 dnl 802.1ad isn't supported at the moment
322 dnl # actions=push_vlan:0x88a8
323 dnl 0011 0008 88a8 0000
324 # actions=push_vlan:0x8100
328 ffff 0010 00002320 0001 0005 00000000
330 # actions=set_tunnel:0x12345678
331 ffff 0010 00002320 0002 0000 12345678
334 ffff 0010 00002320 0005 000000000000
336 # actions=move:NXM_OF_IN_PORT[]->NXM_OF_VLAN_TCI[]
337 ffff 0018 00002320 0006 0010 0000 0000 00000002 00000802
339 # actions=load:0xf009->NXM_OF_VLAN_TCI[]
340 ffff 0018 00002320 0007 000f 00000802 000000000000f009
342 # actions=note:11.e9.9a.ad.67.f3
343 ffff 0010 00002320 0008 11e99aad67f3
345 # actions=set_tunnel64:0xc426384d49c53d60
346 ffff 0018 00002320 0009 000000000000 c426384d49c53d60
348 # actions=set_tunnel64:0x885f3298
349 ffff 0018 00002320 0009 000000000000 00000000885f3298
351 dnl Write-Metadata is only allowed in contexts that allow instructions.
352 & ofp_actions|WARN|write_metadata instruction not allowed here
353 # bad OpenFlow11 actions: OFPBIC_UNSUP_INST
354 ffff 0020 00002320 0016 000000000000 fedcba9876543210 ffffffffffffffff
356 # actions=multipath(eth_src,50,modulo_n,1,0,NXM_NX_REG0[])
357 ffff 0020 00002320 000a 0000 0032 0000 0000 0000 0000 0000 0000 001f 00010004
359 # actions=bundle(eth_src,0,hrw,ofport,slaves:4,8)
360 ffff 0028 00002320 000c 0001 0000 0000 00000002 0002 0000 00000000 00000000 dnl
363 # actions=bundle_load(eth_src,0,hrw,ofport,NXM_NX_REG0[],slaves:4,8)
364 ffff 0028 00002320 000d 0001 0000 0000 00000002 0002 001f 00010004 00000000 dnl
367 # actions=resubmit(10,5)
368 ffff 0010 00002320 000e 000a 05 000000
370 # actions=output:NXM_NX_REG1[5..10]
371 ffff 0018 00002320 000f 0145 00010204 ffff 000000000000
373 # 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[])
374 ffff 0048 00002320 0010 000a 0014 0050 123456789abcdef0 0000 02 00 0002 0004 dnl
375 000c 00000802 0000 00000802 0000 dnl
376 0030 00000406 0000 00000206 0000 dnl
377 1010 00000002 0000 dnl
381 ffff 0010 00002320 0011 000000000000
383 dnl OpenFlow 1.1 OFPAT_DEC_TTL
387 # actions=fin_timeout(idle_timeout=10,hard_timeout=20)
388 ffff 0010 00002320 0013 000a 0014 0000
390 # actions=controller(reason=invalid_ttl,max_len=1234,id=5678)
391 ffff 0010 00002320 0014 04d2 162e 02 00
393 # actions=dec_ttl(32768,12345,90,765,1024)
394 ffff 0020 00002320 0015 000500000000 80003039005A02fd 0400000000000000
396 # actions=sample(probability=12345,collector_set_id=23456,obs_domain_id=34567,obs_point_id=45678)
397 ffff 0018 00002320 001d 3039 00005BA0 00008707 0000B26E
399 # bad OpenFlow11 actions: OFPBAC_BAD_OUT_PORT
400 & ofp_actions|WARN|bad action at offset 0 (OFPBAC_BAD_OUT_PORT):
401 & 00000000 00 00 00 10 ff ff ff ff-00 00 00 00 00 00 00 00
402 0000 0010 ffffffff 0000 000000000000
405 sed '/^[[#&]]/d' < test-data > input.txt
406 sed -n 's/^# //p; /^$/p' < test-data > expout
407 sed -n 's/^& //p' < test-data > experr
408 AT_CAPTURE_FILE([input.txt])
409 AT_CAPTURE_FILE([expout])
410 AT_CAPTURE_FILE([experr])
412 [ovs-ofctl '-vPATTERN:console:%c|%p|%m' parse-actions OpenFlow11 < input.txt],
413 [0], [expout], [experr])
416 AT_SETUP([OpenFlow 1.1 instruction translation])
417 AT_KEYWORDS([OF1.1 instruction ofp-actions])
418 AT_DATA([test-data], [dnl
420 0004 0018 00000000 dnl
421 0000 0010 fffffffe 04d2 000000000000
423 dnl Apply-Actions non-zero padding
435 dnl Check that an empty Apply-Actions instruction gets dropped.
447 dnl Duplicate instruction type:
448 # bad OpenFlow11 instructions: OFPBIC_DUP_INST
449 0004 0008 00000000 0004 0008 00000000
451 dnl Instructions not multiple of 8 in length.
452 & ofp_actions|WARN|OpenFlow message instructions length 9 is not a multiple of 8
453 # bad OpenFlow11 instructions: OFPBIC_BAD_LEN
454 0004 0009 01 00000000
456 dnl Goto-Table instruction too long.
457 # bad OpenFlow11 instructions: OFPBIC_BAD_LEN
458 0001 0010 01 000000 0000000000000000
460 dnl Goto-Table 1 instruction non-zero padding
461 # actions=goto_table:1
465 dnl Goto-Table 1 instruction go back to the previous table.
466 # bad OpenFlow11 instructions: OFPBIC_BAD_TABLE_ID
467 2,0001 0008 01 000000
470 # actions=goto_table:1
474 # actions=write_metadata:0xfedcba9876543210
475 0002 0018 00000000 fedcba9876543210 ffffffffffffffff
477 dnl Write-Metadata as Nicira extension action is transformed into instruction.
478 # actions=write_metadata:0xfedcba9876543210
513 0004 0028 00000000 ffff 0020 00002320 0016 000000000000 fedcba9876543210 ffffffffffffffff
515 dnl Write-Metadata with mask.
516 # actions=write_metadata:0xfedcba9876543210/0xff00ff00ff00ff00
517 0002 0018 00000000 fedcba9876543210 ff00ff00ff00ff00
519 dnl Write-Metadata too short.
520 # bad OpenFlow11 instructions: OFPBIC_BAD_LEN
521 0002 0010 00000000 fedcba9876543210
523 dnl Write-Metadata too long.
524 # bad OpenFlow11 instructions: OFPBIC_BAD_LEN
525 0002 0020 00000000 fedcba9876543210 ffffffffffffffff 0000000000000000
527 dnl Write-Metadata duplicated.
528 # bad OpenFlow11 instructions: OFPBIC_DUP_INST
529 0002 0018 00000000 fedcba9876543210 ff00ff00ff00ff00 0002 0018 00000000 fedcba9876543210 ff00ff00ff00ff00
531 dnl Write-Metadata in wrong position (OpenFlow 1.1+ disregards the order
532 dnl and OVS reorders it to the canonical order)
533 # actions=write_metadata:0xfedcba9876543210,goto_table:1
561 0001 0008 01 000000 0002 0018 00000000 fedcba9876543210 ffffffffffffffff
563 dnl empty Write-Actions non-zero padding
564 # actions=write_actions(drop)
575 dnl Check that an empty Write-Actions instruction gets dropped.
576 # actions=write_actions(drop)
587 dnl Clear-Actions too-long
588 # bad OpenFlow11 instructions: OFPBIC_BAD_LEN
589 0005 0010 00000000 0000000000000000
591 dnl Clear-Actions non-zero padding
592 # actions=clear_actions
596 dnl Clear-Actions non-zero padding
597 # actions=clear_actions
602 # actions=clear_actions
605 dnl Experimenter actions not supported yet.
606 # bad OpenFlow11 instructions: OFPBIC_BAD_EXPERIMENTER
609 dnl Bad instruction number (0 not assigned).
610 # bad OpenFlow11 instructions: OFPBIC_UNKNOWN_INST
614 sed '/^[[#&]]/d' < test-data > input.txt
615 sed -n 's/^# //p; /^$/p' < test-data > expout
616 sed -n 's/^& //p' < test-data > experr
617 AT_CAPTURE_FILE([input.txt])
618 AT_CAPTURE_FILE([expout])
619 AT_CAPTURE_FILE([experr])
621 [ovs-ofctl '-vPATTERN:console:%c|%p|%m' parse-instructions OpenFlow11 < input.txt],
622 [0], [expout], [experr])
625 dnl Our primary goal here is to verify OpenFlow 1.2-specific changes,
626 dnl so the list of tests is short.
627 AT_SETUP([OpenFlow 1.2 action translation])
628 AT_KEYWORDS([ofp-actions OF1.2])
629 AT_DATA([test-data], [dnl
631 0000 0010 fffffffe 04d2 000000000000
633 # bad OpenFlow12 actions: OFPBAC_BAD_SET_MASK
634 & ofp_actions|WARN|bad action at offset 0 (OFPBAC_BAD_SET_MASK):
635 & 00000000 00 19 00 18 80 00 09 0c-00 00 00 00 12 34 00 00
636 & 00000010 00 00 ff ff 00 00 00 00-
637 0019 0018 8000090c 000000001234 00000000ffff 00000000
640 sed '/^[[#&]]/d' < test-data > input.txt
641 sed -n 's/^# //p; /^$/p' < test-data > expout
642 sed -n 's/^& //p' < test-data > experr
643 AT_CAPTURE_FILE([input.txt])
644 AT_CAPTURE_FILE([expout])
645 AT_CAPTURE_FILE([experr])
647 [ovs-ofctl '-vPATTERN:console:%c|%p|%m' parse-actions OpenFlow12 < input.txt],
648 [0], [expout], [experr])
651 dnl Our primary goal here is to verify OpenFlow 1.3-specific changes,
652 dnl so the list of tests is short.
653 AT_SETUP([OpenFlow 1.3 action translation])
654 AT_KEYWORDS([ofp-actions OF1.3])
655 AT_DATA([test-data], [dnl
657 0000 0010 fffffffe 04d2 000000000000
659 dnl Check the Nicira extension form of "move".
660 # actions=move:NXM_OF_IN_PORT[]->NXM_OF_VLAN_TCI[]
661 ffff 0018 00002320 0006 0010 0000 0000 00000002 00000802
663 dnl Check the ONF extension form of "copy_field".
664 # actions=move:NXM_OF_IN_PORT[]->NXM_OF_VLAN_TCI[]
665 ffff 0020 4f4e4600 0c80 0000 0010 0000 0000 0000 00000002 00000802 00000000
668 sed '/^[[#&]]/d' < test-data > input.txt
669 sed -n 's/^# //p; /^$/p' < test-data > expout
670 sed -n 's/^& //p' < test-data > experr
671 AT_CAPTURE_FILE([input.txt])
672 AT_CAPTURE_FILE([expout])
673 AT_CAPTURE_FILE([experr])
675 [ovs-ofctl '-vPATTERN:console:%c|%p|%m' parse-actions OpenFlow13 < input.txt],
676 [0], [expout], [experr])
679 dnl Our primary goal here is to verify that OpenFlow 1.5-specific changes,
680 dnl so the list of tests is short.
681 AT_SETUP([OpenFlow 1.5 action translation])
682 AT_KEYWORDS([ofp-actions OF1.5])
683 AT_DATA([test-data], [dnl
685 0000 0010 fffffffe 04d2 000000000000
687 # actions=move:NXM_OF_IN_PORT[]->NXM_OF_VLAN_TCI[]
688 001c 0018 0010 0000 0000 0000 00000002 00000802 00000000
690 # actions=set_field:00:00:00:00:12:34/00:00:00:00:ff:ff->eth_src
691 0019 0018 8000090c 000000001234 00000000ffff 00000000
694 sed '/^[[#&]]/d' < test-data > input.txt
695 sed -n 's/^# //p; /^$/p' < test-data > expout
696 sed -n 's/^& //p' < test-data > experr
697 AT_CAPTURE_FILE([input.txt])
698 AT_CAPTURE_FILE([expout])
699 AT_CAPTURE_FILE([experr])
701 [ovs-ofctl '-vPATTERN:console:%c|%p|%m' parse-actions OpenFlow15 < input.txt],
702 [0], [expout], [experr])
705 AT_SETUP([ofp-actions - inconsistent MPLS actions])
707 dnl OK: Use fin_timeout action on TCP flow
708 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn add-flow br0 'tcp actions=fin_timeout(idle_timeout=1)'])
709 dnl Bad: Use fin_timeout action on TCP flow that has been converted to MPLS
710 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn add-flow br0 'tcp actions=push_mpls:0x8847,fin_timeout(idle_timeout=1)'],
712 ovs-ofctl: none of the usable flow formats (OpenFlow10,NXM) is among the allowed flow formats (OpenFlow11)
717 AT_SETUP([reg_load <-> set_field translation corner case])
718 AT_KEYWORDS([ofp-actions])
720 dnl In OpenFlow 1.3, set_field always sets all the bits in the field,
721 dnl but when we translate to NXAST_LOAD we need to only set the bits that
722 dnl actually exist (e.g. mpls_label only has 20 bits) otherwise OVS rejects
723 dnl the "load" action as invalid. Check that we do this correctly.
724 AT_CHECK([ovs-ofctl -O OpenFlow13 add-flow br0 mpls,actions=set_field:10-\>mpls_label])
725 AT_CHECK([ovs-ofctl -O OpenFlow10 dump-flows br0 | ofctl_strip], [0], [dnl
727 mpls actions=load:0xa->OXM_OF_MPLS_LABEL[[]]