1 AT_BANNER([OpenFlow actions])
3 AT_SETUP([OpenFlow 1.0 action translation])
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:10q55
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 # actions=multipath(eth_src,50,modulo_n,1,0,NXM_NX_REG0[])
73 ffff 0020 00002320 000a 0000 0032 0000 0000 0000 0000 0000 0000 001f 00010004
75 # actions=autopath(2,NXM_NX_REG0[2..30])
76 & autopath|WARN|The autopath action is deprecated and may be removed in February 2013. Please email dev@openvswitch.org with concerns.
77 ffff 0018 00002320 000b 009c 00010004 00000002 00000000
79 # actions=bundle(eth_src,0,hrw,ofport,slaves:4,8)
80 ffff 0028 00002320 000c 0001 0000 0000 00000002 0002 0000 00000000 00000000 dnl
83 # actions=bundle_load(eth_src,0,hrw,ofport,NXM_NX_REG0[],slaves:4,8)
84 ffff 0028 00002320 000d 0001 0000 0000 00000002 0002 001f 00010004 00000000 dnl
87 # actions=resubmit(10,5)
88 ffff 0010 00002320 000e 000a 05 000000
90 # actions=output:NXM_NX_REG1[5..10]
91 ffff 0018 00002320 000f 0145 00010204 ffff 000000000000
93 # 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[])
94 ffff 0048 00002320 0010 000a 0014 0050 123456789abcdef0 0000 02 00 0002 0004 dnl
95 000c 00000802 0000 00000802 0000 dnl
96 0030 00000406 0000 00000206 0000 dnl
97 1010 00000002 0000 dnl
101 ffff 0010 00002320 0011 000000000000
104 ffff 0010 00002320 0012 000000000000
106 # actions=fin_timeout(idle_timeout=10,hard_timeout=20)
107 ffff 0010 00002320 0013 000a 0014 0000
109 # actions=controller(reason=invalid_ttl,max_len=1234,id=5678)
110 ffff 0010 00002320 0014 04d2 162e 02 00
112 # actions=dec_ttl(32768,12345,90,765,1024)
113 ffff 0020 00002320 0015 000500000000 80003039005A02fd 0400000000000000
116 sed '/^[[#&]]/d' < test-data > input.txt
117 sed -n 's/^# //p; /^$/p' < test-data > expout
118 sed -n 's/^& //p' < test-data > experr
119 AT_CAPTURE_FILE([input.txt])
120 AT_CAPTURE_FILE([expout])
121 AT_CAPTURE_FILE([experr])
123 [ovs-ofctl '-vPATTERN:console:%c|%p|%m' parse-ofp10-actions < input.txt],
124 [0], [expout], [experr])
127 AT_SETUP([OpenFlow 1.1 action translation])
129 AT_DATA([test-data], [dnl
131 0000 0010 fffffffe 04d2 000000000000
133 # actions=CONTROLLER:1234
134 0000 0010 fffffffd 04d2 000000000000
136 # actions=mod_vlan_vid:9
139 # actions=mod_vlan_pcp:6
142 # actions=mod_dl_src:00:11:22:33:44:55
143 0003 0010 001122334455 000000000000
145 # actions=mod_dl_dst:10:20:30:40:50:60
146 0004 0010 102030405060 000000000000
148 # actions=mod_nw_src:1.2.3.4
151 # actions=mod_nw_dst:192.168.0.1
154 # actions=mod_nw_tos:48
157 # actions=mod_tp_src:80
160 # actions=mod_tp_dst:443
164 ffff 0010 00002320 0001 0005 00000000
166 # actions=set_tunnel:0x12345678
167 ffff 0010 00002320 0002 0000 12345678
169 # actions=set_queue:2309737729
170 ffff 0010 00002320 0004 0000 89abcd01
173 ffff 0010 00002320 0005 000000000000
175 # actions=move:NXM_OF_IN_PORT[]->NXM_OF_VLAN_TCI[]
176 ffff 0018 00002320 0006 0010 0000 0000 00000002 00000802
178 # actions=load:0xf009->NXM_OF_VLAN_TCI[]
179 ffff 0018 00002320 0007 000f 00000802 000000000000f009
181 # actions=note:11.e9.9a.ad.67.f3
182 ffff 0010 00002320 0008 11e99aad67f3
184 # actions=set_tunnel64:0xc426384d49c53d60
185 ffff 0018 00002320 0009 000000000000 c426384d49c53d60
187 # actions=set_tunnel64:0x885f3298
188 ffff 0018 00002320 0009 000000000000 00000000885f3298
190 # actions=multipath(eth_src,50,modulo_n,1,0,NXM_NX_REG0[])
191 ffff 0020 00002320 000a 0000 0032 0000 0000 0000 0000 0000 0000 001f 00010004
193 # actions=autopath(2,NXM_NX_REG0[2..30])
194 & autopath|WARN|The autopath action is deprecated and may be removed in February 2013. Please email dev@openvswitch.org with concerns.
195 ffff 0018 00002320 000b 009c 00010004 00000002 00000000
197 # actions=bundle(eth_src,0,hrw,ofport,slaves:4,8)
198 ffff 0028 00002320 000c 0001 0000 0000 00000002 0002 0000 00000000 00000000 dnl
201 # actions=bundle_load(eth_src,0,hrw,ofport,NXM_NX_REG0[],slaves:4,8)
202 ffff 0028 00002320 000d 0001 0000 0000 00000002 0002 001f 00010004 00000000 dnl
205 # actions=resubmit(10,5)
206 ffff 0010 00002320 000e 000a 05 000000
208 # actions=output:NXM_NX_REG1[5..10]
209 ffff 0018 00002320 000f 0145 00010204 ffff 000000000000
211 # 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[])
212 ffff 0048 00002320 0010 000a 0014 0050 123456789abcdef0 0000 02 00 0002 0004 dnl
213 000c 00000802 0000 00000802 0000 dnl
214 0030 00000406 0000 00000206 0000 dnl
215 1010 00000002 0000 dnl
219 ffff 0010 00002320 0011 000000000000
223 ffff 0010 00002320 0012 000000000000
225 dnl OpenFlow 1.1 OFPAT_DEC_TTL
229 # actions=fin_timeout(idle_timeout=10,hard_timeout=20)
230 ffff 0010 00002320 0013 000a 0014 0000
232 # actions=controller(reason=invalid_ttl,max_len=1234,id=5678)
233 ffff 0010 00002320 0014 04d2 162e 02 00
235 # actions=dec_ttl(32768,12345,90,765,1024)
236 ffff 0020 00002320 0015 000500000000 80003039005A02fd 0400000000000000
239 sed '/^[[#&]]/d' < test-data > input.txt
240 sed -n 's/^# //p; /^$/p' < test-data > expout
241 sed -n 's/^& //p' < test-data > experr
242 AT_CAPTURE_FILE([input.txt])
243 AT_CAPTURE_FILE([expout])
244 AT_CAPTURE_FILE([experr])
246 [ovs-ofctl '-vPATTERN:console:%c|%p|%m' parse-ofp11-actions < input.txt],
247 [0], [expout], [experr])
250 AT_SETUP([OpenFlow 1.1 instruction translation])
251 AT_KEYWORDS([OF1.1 instruction])
252 AT_DATA([test-data], [dnl
254 0004 0018 00000000 dnl
255 0000 0010 fffffffe 04d2 000000000000
257 dnl Apply-Actions non-zero padding
269 dnl Check that an empty Apply-Actions instruction gets dropped.
281 dnl Duplicate instruction type:
282 # bad OF1.1 instructions: OFPIT_BAD_INSTRUCTION
283 0004 0008 00000000 0004 0008 00000000
285 dnl Instructions not multiple of 8 in length.
286 & ofp_actions|WARN|OpenFlow message instructions length 9 is not a multiple of 8
287 # bad OF1.1 instructions: OFPBIC_BAD_LEN
288 0004 0009 01 00000000
290 dnl Goto-Table instruction too long.
291 # bad OF1.1 instructions: OFPBIC_BAD_LEN
292 0001 0010 01 000000 0000000000000000
294 dnl Goto-Table 1 instruction non-zero padding
295 # actions=goto_table:1
300 # actions=goto_table:1
303 dnl Write-Metadata not supported yet.
304 # bad OF1.1 instructions: OFPBIC_UNSUP_INST
305 0002 0018 00000000 fedcba9876543210 ffffffffffffffff
307 dnl Write-Metadata too short.
308 # bad OF1.1 instructions: OFPBIC_BAD_LEN
309 0002 0010 00000000 fedcba9876543210
311 dnl Write-Metadata too long.
312 # bad OF1.1 instructions: OFPBIC_BAD_LEN
313 0002 0020 00000000 fedcba9876543210 ffffffffffffffff 0000000000000000
315 dnl Write-Actions not supported yet.
316 # bad OF1.1 instructions: OFPBIC_UNSUP_INST
319 dnl Clear-Actions too-long
320 # bad OF1.1 instructions: OFPBIC_BAD_LEN
321 0005 0010 00000000 0000000000000000
323 dnl Clear-Actions non-zero padding
324 # actions=clear_actions
328 dnl Clear-Actions non-zero padding
329 # actions=clear_actions
334 # actions=clear_actions
337 dnl Experimenter actions not supported yet.
338 # bad OF1.1 instructions: OFPBIC_BAD_EXPERIMENTER
341 dnl Bad instruction number (0 not assigned).
342 # bad OF1.1 instructions: OFPBIC_UNKNOWN_INST
346 sed '/^[[#&]]/d' < test-data > input.txt
347 sed -n 's/^# //p; /^$/p' < test-data > expout
348 sed -n 's/^& //p' < test-data > experr
349 AT_CAPTURE_FILE([input.txt])
350 AT_CAPTURE_FILE([expout])
351 AT_CAPTURE_FILE([experr])
353 [ovs-ofctl '-vPATTERN:console:%c|%p|%m' parse-ofp11-instructions < input.txt],
354 [0], [expout], [experr])