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 ffff 0018 00002320 000b 009c 00010004 00000002 00000000
78 # actions=bundle(eth_src,0,hrw,ofport,slaves:4,8)
79 ffff 0028 00002320 000c 0001 0000 0000 00000002 0002 0000 00000000 00000000 dnl
82 # actions=bundle_load(eth_src,0,hrw,ofport,NXM_NX_REG0[],slaves:4,8)
83 ffff 0028 00002320 000d 0001 0000 0000 00000002 0002 001f 00010004 00000000 dnl
86 # actions=resubmit(10,5)
87 ffff 0010 00002320 000e 000a 05 000000
89 # actions=output:NXM_NX_REG1[5..10]
90 ffff 0018 00002320 000f 0145 00010204 ffff 000000000000
92 # 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[])
93 ffff 0048 00002320 0010 000a 0014 0050 123456789abcdef0 0000 02 00 0002 0004 dnl
94 000c 00000802 0000 00000802 0000 dnl
95 0030 00000406 0000 00000206 0000 dnl
96 1010 00000002 0000 dnl
100 ffff 0010 00002320 0011 000000000000
103 ffff 0010 00002320 0012 000000000000
105 # actions=fin_timeout(idle_timeout=10,hard_timeout=20)
106 ffff 0010 00002320 0013 000a 0014 0000
108 # actions=controller(reason=invalid_ttl,max_len=1234,id=5678)
109 ffff 0010 00002320 0014 04d2 162e 02 00
112 sed '/^[[#&]]/d' < test-data > input.txt
113 sed -n 's/^# //p; /^$/p' < test-data > expout
114 sed -n 's/^& //p' < test-data > experr
115 AT_CAPTURE_FILE([input.txt])
116 AT_CAPTURE_FILE([expout])
117 AT_CAPTURE_FILE([experr])
119 [ovs-ofctl '-vPATTERN:console:%c|%p|%m' parse-ofp10-actions < input.txt],
120 [0], [expout], [experr])
123 AT_SETUP([OpenFlow 1.1 action translation])
125 AT_DATA([test-data], [dnl
127 0000 0010 fffffffe 04d2 000000000000
129 # actions=CONTROLLER:1234
130 0000 0010 fffffffd 04d2 000000000000
132 # actions=mod_vlan_vid:9
135 # actions=mod_vlan_pcp:6
138 # actions=mod_dl_src:00:11:22:33:44:55
139 0003 0010 001122334455 000000000000
141 # actions=mod_dl_dst:10:20:30:40:50:60
142 0004 0010 102030405060 000000000000
144 # actions=mod_nw_src:1.2.3.4
147 # actions=mod_nw_dst:192.168.0.1
150 # actions=mod_nw_tos:48
153 # actions=mod_tp_src:80
156 # actions=mod_tp_dst:443
160 ffff 0010 00002320 0001 0005 00000000
162 # actions=set_tunnel:0x12345678
163 ffff 0010 00002320 0002 0000 12345678
165 # actions=set_queue:2309737729
166 ffff 0010 00002320 0004 0000 89abcd01
169 ffff 0010 00002320 0005 000000000000
171 # actions=move:NXM_OF_IN_PORT[]->NXM_OF_VLAN_TCI[]
172 ffff 0018 00002320 0006 0010 0000 0000 00000002 00000802
174 # actions=load:0xf009->NXM_OF_VLAN_TCI[]
175 ffff 0018 00002320 0007 000f 00000802 000000000000f009
177 # actions=note:11.e9.9a.ad.67.f3
178 ffff 0010 00002320 0008 11e99aad67f3
180 # actions=set_tunnel64:0xc426384d49c53d60
181 ffff 0018 00002320 0009 000000000000 c426384d49c53d60
183 # actions=set_tunnel64:0x885f3298
184 ffff 0018 00002320 0009 000000000000 00000000885f3298
186 # actions=multipath(eth_src,50,modulo_n,1,0,NXM_NX_REG0[])
187 ffff 0020 00002320 000a 0000 0032 0000 0000 0000 0000 0000 0000 001f 00010004
189 # actions=autopath(2,NXM_NX_REG0[2..30])
190 ffff 0018 00002320 000b 009c 00010004 00000002 00000000
192 # actions=bundle(eth_src,0,hrw,ofport,slaves:4,8)
193 ffff 0028 00002320 000c 0001 0000 0000 00000002 0002 0000 00000000 00000000 dnl
196 # actions=bundle_load(eth_src,0,hrw,ofport,NXM_NX_REG0[],slaves:4,8)
197 ffff 0028 00002320 000d 0001 0000 0000 00000002 0002 001f 00010004 00000000 dnl
200 # actions=resubmit(10,5)
201 ffff 0010 00002320 000e 000a 05 000000
203 # actions=output:NXM_NX_REG1[5..10]
204 ffff 0018 00002320 000f 0145 00010204 ffff 000000000000
206 # 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[])
207 ffff 0048 00002320 0010 000a 0014 0050 123456789abcdef0 0000 02 00 0002 0004 dnl
208 000c 00000802 0000 00000802 0000 dnl
209 0030 00000406 0000 00000206 0000 dnl
210 1010 00000002 0000 dnl
214 ffff 0010 00002320 0011 000000000000
217 ffff 0010 00002320 0012 000000000000
219 # actions=fin_timeout(idle_timeout=10,hard_timeout=20)
220 ffff 0010 00002320 0013 000a 0014 0000
222 # actions=controller(reason=invalid_ttl,max_len=1234,id=5678)
223 ffff 0010 00002320 0014 04d2 162e 02 00
226 sed '/^[[#&]]/d' < test-data > input.txt
227 sed -n 's/^# //p; /^$/p' < test-data > expout
228 sed -n 's/^& //p' < test-data > experr
229 AT_CAPTURE_FILE([input.txt])
230 AT_CAPTURE_FILE([expout])
231 AT_CAPTURE_FILE([experr])
233 [ovs-ofctl '-vPATTERN:console:%c|%p|%m' parse-ofp11-actions < input.txt],
234 [0], [expout], [experr])
237 AT_SETUP([OpenFlow 1.1 instruction translation])
239 AT_DATA([test-data], [dnl
241 0004 0018 00000000 dnl
242 0000 0010 fffffffe 04d2 000000000000
244 dnl Check that an empty Apply-Actions instruction gets dropped.
256 # bad OF1.1 instructions: NXBIC_DUP_TYPE
257 0004 0008 00000000 0004 0008 00000000
259 dnl Instructions not multiple of 8 in length.
260 & ofp_actions|WARN|OpenFlow message instructions length 9 is not a multiple of 8
261 # bad OF1.1 instructions: OFPBIC_BAD_LEN
262 0004 0009 01 00000000
264 dnl Goto-Table instruction too long.
265 # bad OF1.1 instructions: OFPBIC_BAD_LEN
266 0001 0010 01 000000 0000000000000000
268 dnl Goto-Table not supported yet.
269 # bad OF1.1 instructions: OFPBIC_UNSUP_INST
272 dnl Write-Metadata not supported yet.
273 # bad OF1.1 instructions: OFPBIC_UNSUP_INST
274 0002 0018 00000000 fedcba9876543210 ffffffffffffffff
276 dnl Write-Metadata too short.
277 # bad OF1.1 instructions: OFPBIC_BAD_LEN
278 0002 0010 00000000 fedcba9876543210
280 dnl Write-Metadata too long.
281 # bad OF1.1 instructions: OFPBIC_BAD_LEN
282 0002 0020 00000000 fedcba9876543210 ffffffffffffffff 0000000000000000
284 dnl Write-Actions not supported yet.
285 # bad OF1.1 instructions: OFPBIC_UNSUP_INST
288 dnl Clear-Actions not supported yet.
289 # bad OF1.1 instructions: OFPBIC_UNSUP_INST
292 dnl Experimenter actions not supported yet.
293 # bad OF1.1 instructions: OFPBIC_BAD_EXPERIMENTER
296 dnl Bad instruction number (0 not assigned).
297 # bad OF1.1 instructions: OFPBIC_UNKNOWN_INST
301 sed '/^[[#&]]/d' < test-data > input.txt
302 sed -n 's/^# //p; /^$/p' < test-data > expout
303 sed -n 's/^& //p' < test-data > experr
304 AT_CAPTURE_FILE([input.txt])
305 AT_CAPTURE_FILE([expout])
306 AT_CAPTURE_FILE([experr])
308 [ovs-ofctl '-vPATTERN:console:%c|%p|%m' parse-ofp11-instructions < input.txt],
309 [0], [expout], [experr])