]>
Commit | Line | Data |
---|---|---|
f25d0cf3 BP |
1 | AT_BANNER([OpenFlow actions]) |
2 | ||
3 | AT_SETUP([OpenFlow 1.0 action translation]) | |
4cceacb9 | 4 | AT_KEYWORDS([ofp-actions OF1.0]) |
f25d0cf3 BP |
5 | AT_DATA([test-data], [dnl |
6 | # actions=LOCAL | |
7 | 0000 0008 fffe 04d2 | |
8 | ||
9 | # actions=CONTROLLER:1234 | |
10 | 0000 0008 fffd 04d2 | |
11 | ||
12 | # actions=mod_vlan_vid:9 | |
13 | 0001 0008 0009 0000 | |
14 | ||
15 | # actions=mod_vlan_pcp:6 | |
16 | 0002 0008 06 000000 | |
17 | ||
18 | # actions=strip_vlan | |
19 | 0003 0008 00000000 | |
20 | ||
21 | # actions=mod_dl_src:00:11:22:33:44:55 | |
22 | 0004 0010 001122334455 000000000000 | |
23 | ||
24 | # actions=mod_dl_dst:10:20:30:40:50:60 | |
25 | 0005 0010 102030405060 000000000000 | |
26 | ||
27 | # actions=mod_nw_src:1.2.3.4 | |
28 | 0006 0008 01020304 | |
29 | ||
30 | # actions=mod_nw_dst:192.168.0.1 | |
31 | 0007 0008 c0a80001 | |
32 | ||
33 | # actions=mod_nw_tos:48 | |
34 | 0008 0008 30 000000 | |
35 | ||
36 | # actions=mod_tp_src:80 | |
37 | 0009 0008 0050 0000 | |
38 | ||
39 | # actions=mod_tp_dst:443 | |
40 | 000a 0008 01bb 0000 | |
41 | ||
b55f2f79 | 42 | # actions=enqueue:10:55 |
f25d0cf3 BP |
43 | 000b 0010 000a 000000000000 00000037 |
44 | ||
45 | # actions=resubmit:5 | |
46 | ffff 0010 00002320 0001 0005 00000000 | |
47 | ||
48 | # actions=set_tunnel:0x12345678 | |
49 | ffff 0010 00002320 0002 0000 12345678 | |
50 | ||
51 | # actions=set_queue:2309737729 | |
52 | ffff 0010 00002320 0004 0000 89abcd01 | |
53 | ||
54 | # actions=pop_queue | |
55 | ffff 0010 00002320 0005 000000000000 | |
56 | ||
57 | # actions=move:NXM_OF_IN_PORT[]->NXM_OF_VLAN_TCI[] | |
58 | ffff 0018 00002320 0006 0010 0000 0000 00000002 00000802 | |
59 | ||
60 | # actions=load:0xf009->NXM_OF_VLAN_TCI[] | |
61 | ffff 0018 00002320 0007 000f 00000802 000000000000f009 | |
62 | ||
63 | # actions=note:11.e9.9a.ad.67.f3 | |
64 | ffff 0010 00002320 0008 11e99aad67f3 | |
65 | ||
66 | # actions=set_tunnel64:0xc426384d49c53d60 | |
67 | ffff 0018 00002320 0009 000000000000 c426384d49c53d60 | |
68 | ||
69 | # actions=set_tunnel64:0x885f3298 | |
70 | ffff 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 |
74 | ffff 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 |
78 | ffff 0020 00002320 0016 000000000000 fedcba9876543210 ffff0000ffff0000 |
79 | ||
f25d0cf3 BP |
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 | |
82 | ||
f25d0cf3 BP |
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 | |
85 | 0004 0008 00000000 | |
86 | ||
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 | |
89 | 0004 0008 00000000 | |
90 | ||
91 | # actions=resubmit(10,5) | |
92 | ffff 0010 00002320 000e 000a 05 000000 | |
93 | ||
94 | # actions=output:NXM_NX_REG1[5..10] | |
95 | ffff 0018 00002320 000f 0145 00010204 ffff 000000000000 | |
96 | ||
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 | |
102 | 00000000 | |
103 | ||
104 | # actions=exit | |
105 | ffff 0010 00002320 0011 000000000000 | |
106 | ||
107 | # actions=dec_ttl | |
108 | ffff 0010 00002320 0012 000000000000 | |
109 | ||
110 | # actions=fin_timeout(idle_timeout=10,hard_timeout=20) | |
111 | ffff 0010 00002320 0013 000a 0014 0000 | |
112 | ||
113 | # actions=controller(reason=invalid_ttl,max_len=1234,id=5678) | |
114 | ffff 0010 00002320 0014 04d2 162e 02 00 | |
115 | ||
c2d967a5 MM |
116 | # actions=dec_ttl(32768,12345,90,765,1024) |
117 | ffff 0020 00002320 0015 000500000000 80003039005A02fd 0400000000000000 | |
118 | ||
29089a54 RL |
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 | |
121 | ||
b153b990 BP |
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 | |
127 | ||
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 | |
133 | ||
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 | |
137 | ||
13d2c689 BP |
138 | # bad OpenFlow10 actions: OFPBAC_BAD_OUT_PORT |
139 | 0000 0008 ffff 0000 | |
140 | ||
07659514 JS |
141 | # actions=ct() |
142 | ffff 0018 00002320 0023 0000 00000000 0000 FF 000000 0000 | |
143 | ||
144 | # actions=ct(commit) | |
145 | ffff 0018 00002320 0023 0001 00000000 0000 FF 000000 0000 | |
146 | ||
147 | # actions=ct(table=10) | |
148 | ffff 0018 00002320 0023 0000 00000000 0000 0A 000000 0000 | |
149 | ||
150 | # actions=ct(zone=10) | |
151 | ffff 0018 00002320 0023 0000 00000000 000A FF 000000 0000 | |
152 | ||
153 | # actions=ct(zone=NXM_NX_REG0[0..15]) | |
154 | ffff 0018 00002320 0023 0000 00010004 000F FF 000000 0000 | |
155 | ||
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 | |
159 | ||
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 | |
163 | ||
8e53fe8c JS |
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 | |
167 | ||
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 | |
171 | ||
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 | |
176 | ||
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 | |
181 | ||
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 | |
186 | ||
d787ad39 JS |
187 | # actions=ct(alg=ftp) |
188 | ffff 0018 00002320 0023 0000 00000000 0000 FF 000000 0015 | |
189 | ||
9ac0aada JR |
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 | |
193 | ||
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 | |
197 | ||
198 | # actions=ct(nat) | |
199 | ffff 0028 00002320 0023 0000 00000000 0000 FF 000000 0000 dnl | |
200 | ffff 0010 00002320 0024 00 00 0000 0000 | |
201 | ||
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 | |
205 | ||
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 | |
209 | ||
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 | |
213 | ||
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 | |
217 | ||
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 | |
221 | ||
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 | |
225 | ||
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 | |
231 | 00ff1000 00000000 | |
232 | ||
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 | |
236 | ||
f25d0cf3 BP |
237 | ]) |
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]) | |
244 | AT_CHECK( | |
65a8a59e | 245 | [ovs-ofctl '-vPATTERN:console:%c|%p|%m' parse-actions OpenFlow10 < input.txt], |
f25d0cf3 BP |
246 | [0], [expout], [experr]) |
247 | AT_CLEANUP | |
d01c980f | 248 | |
8f2cded4 BP |
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. | |
254 | # actions=LOCAL | |
255 | 0000 0008 fffe 04d2 | |
256 | ||
257 | # actions=mod_dl_src:00:11:22:33:44:55 | |
258 | 0004 0010 001122334455 000000000000 | |
259 | ||
260 | dnl Now check that write_metadata is accepted. | |
261 | # actions=write_metadata:0xfedcba9876543210 | |
262 | ffff 0020 00002320 0016 000000000000 fedcba9876543210 ffffffffffffffff | |
263 | ||
264 | # actions=write_metadata:0xfedcba9876543210/0xffff0000ffff0000 | |
265 | ffff 0020 00002320 0016 000000000000 fedcba9876543210 ffff0000ffff0000 | |
266 | ||
267 | ]) | |
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]) | |
274 | AT_CHECK( | |
65a8a59e | 275 | [ovs-ofctl '-vPATTERN:console:%c|%p|%m' parse-instructions OpenFlow10 < input.txt], |
8f2cded4 BP |
276 | [0], [expout], [experr]) |
277 | AT_CLEANUP | |
278 | ||
d01c980f | 279 | AT_SETUP([OpenFlow 1.1 action translation]) |
4cceacb9 | 280 | AT_KEYWORDS([ofp-actions OF1.1]) |
d01c980f BP |
281 | AT_DATA([test-data], [dnl |
282 | # actions=LOCAL | |
283 | 0000 0010 fffffffe 04d2 000000000000 | |
284 | ||
285 | # actions=CONTROLLER:1234 | |
286 | 0000 0010 fffffffd 04d2 000000000000 | |
287 | ||
ca287d20 | 288 | # actions=set_vlan_vid:9 |
d01c980f BP |
289 | 0001 0008 0009 0000 |
290 | ||
ca287d20 | 291 | # actions=set_vlan_pcp:6 |
d01c980f BP |
292 | 0002 0008 06 000000 |
293 | ||
294 | # actions=mod_dl_src:00:11:22:33:44:55 | |
295 | 0003 0010 001122334455 000000000000 | |
296 | ||
297 | # actions=mod_dl_dst:10:20:30:40:50:60 | |
298 | 0004 0010 102030405060 000000000000 | |
299 | ||
300 | # actions=mod_nw_src:1.2.3.4 | |
301 | 0005 0008 01020304 | |
302 | ||
303 | # actions=mod_nw_dst:192.168.0.1 | |
304 | 0006 0008 c0a80001 | |
305 | ||
306 | # actions=mod_nw_tos:48 | |
307 | 0007 0008 30 000000 | |
308 | ||
309 | # actions=mod_tp_src:80 | |
310 | 0009 0008 0050 0000 | |
311 | ||
312 | # actions=mod_tp_dst:443 | |
313 | 000a 0008 01bb 0000 | |
314 | ||
64fcc073 | 315 | # actions=pop_vlan |
8e61c110 IY |
316 | 0012 0008 00000000 |
317 | ||
276c4e7a SH |
318 | # actions=set_queue:2309737729 |
319 | 0015 0008 89abcd01 | |
320 | ||
3e34fbdd IY |
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 | |
325 | 0011 0008 8100 0000 | |
326 | ||
d01c980f BP |
327 | # actions=resubmit:5 |
328 | ffff 0010 00002320 0001 0005 00000000 | |
329 | ||
330 | # actions=set_tunnel:0x12345678 | |
331 | ffff 0010 00002320 0002 0000 12345678 | |
332 | ||
d01c980f BP |
333 | # actions=pop_queue |
334 | ffff 0010 00002320 0005 000000000000 | |
335 | ||
336 | # actions=move:NXM_OF_IN_PORT[]->NXM_OF_VLAN_TCI[] | |
337 | ffff 0018 00002320 0006 0010 0000 0000 00000002 00000802 | |
338 | ||
339 | # actions=load:0xf009->NXM_OF_VLAN_TCI[] | |
340 | ffff 0018 00002320 0007 000f 00000802 000000000000f009 | |
341 | ||
342 | # actions=note:11.e9.9a.ad.67.f3 | |
343 | ffff 0010 00002320 0008 11e99aad67f3 | |
344 | ||
345 | # actions=set_tunnel64:0xc426384d49c53d60 | |
346 | ffff 0018 00002320 0009 000000000000 c426384d49c53d60 | |
347 | ||
348 | # actions=set_tunnel64:0x885f3298 | |
349 | ffff 0018 00002320 0009 000000000000 00000000885f3298 | |
350 | ||
8f2cded4 BP |
351 | dnl Write-Metadata is only allowed in contexts that allow instructions. |
352 | & ofp_actions|WARN|write_metadata instruction not allowed here | |
65a8a59e | 353 | # bad OpenFlow11 actions: OFPBIC_UNSUP_INST |
4cceacb9 JS |
354 | ffff 0020 00002320 0016 000000000000 fedcba9876543210 ffffffffffffffff |
355 | ||
d01c980f BP |
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 | |
358 | ||
d01c980f BP |
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 | |
361 | 0004 0008 00000000 | |
362 | ||
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 | |
365 | 0004 0008 00000000 | |
366 | ||
367 | # actions=resubmit(10,5) | |
368 | ffff 0010 00002320 000e 000a 05 000000 | |
369 | ||
370 | # actions=output:NXM_NX_REG1[5..10] | |
371 | ffff 0018 00002320 000f 0145 00010204 ffff 000000000000 | |
372 | ||
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 | |
378 | 00000000 | |
379 | ||
380 | # actions=exit | |
381 | ffff 0010 00002320 0011 000000000000 | |
382 | ||
7bcb1506 IY |
383 | dnl OpenFlow 1.1 OFPAT_DEC_TTL |
384 | # actions=dec_ttl | |
385 | 0018 0008 00000000 | |
386 | ||
d01c980f BP |
387 | # actions=fin_timeout(idle_timeout=10,hard_timeout=20) |
388 | ffff 0010 00002320 0013 000a 0014 0000 | |
389 | ||
390 | # actions=controller(reason=invalid_ttl,max_len=1234,id=5678) | |
391 | ffff 0010 00002320 0014 04d2 162e 02 00 | |
392 | ||
c2d967a5 MM |
393 | # actions=dec_ttl(32768,12345,90,765,1024) |
394 | ffff 0020 00002320 0015 000500000000 80003039005A02fd 0400000000000000 | |
395 | ||
29089a54 RL |
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 | |
398 | ||
13d2c689 BP |
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 | |
403 | ||
d01c980f BP |
404 | ]) |
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]) | |
411 | AT_CHECK( | |
65a8a59e | 412 | [ovs-ofctl '-vPATTERN:console:%c|%p|%m' parse-actions OpenFlow11 < input.txt], |
d01c980f BP |
413 | [0], [expout], [experr]) |
414 | AT_CLEANUP | |
415 | ||
416 | AT_SETUP([OpenFlow 1.1 instruction translation]) | |
4cceacb9 | 417 | AT_KEYWORDS([OF1.1 instruction ofp-actions]) |
d01c980f BP |
418 | AT_DATA([test-data], [dnl |
419 | # actions=LOCAL | |
420 | 0004 0018 00000000 dnl | |
421 | 0000 0010 fffffffe 04d2 000000000000 | |
422 | ||
8dd54666 IY |
423 | dnl Apply-Actions non-zero padding |
424 | # actions=drop | |
425 | # 0: 00 -> (none) | |
426 | # 1: 04 -> (none) | |
427 | # 2: 00 -> (none) | |
428 | # 3: 08 -> (none) | |
429 | # 4: 00 -> (none) | |
430 | # 5: 00 -> (none) | |
431 | # 6: 00 -> (none) | |
432 | # 7: 01 -> (none) | |
433 | 0004 0008 00000001 | |
434 | ||
d01c980f BP |
435 | dnl Check that an empty Apply-Actions instruction gets dropped. |
436 | # actions=drop | |
437 | # 0: 00 -> (none) | |
438 | # 1: 04 -> (none) | |
439 | # 2: 00 -> (none) | |
440 | # 3: 08 -> (none) | |
441 | # 4: 00 -> (none) | |
442 | # 5: 00 -> (none) | |
443 | # 6: 00 -> (none) | |
444 | # 7: 00 -> (none) | |
445 | 0004 0008 00000000 | |
446 | ||
e38c9de5 | 447 | dnl Duplicate instruction type: |
65a8a59e | 448 | # bad OpenFlow11 instructions: OFPBIC_DUP_INST |
d01c980f BP |
449 | 0004 0008 00000000 0004 0008 00000000 |
450 | ||
451 | dnl Instructions not multiple of 8 in length. | |
452 | & ofp_actions|WARN|OpenFlow message instructions length 9 is not a multiple of 8 | |
65a8a59e | 453 | # bad OpenFlow11 instructions: OFPBIC_BAD_LEN |
d01c980f BP |
454 | 0004 0009 01 00000000 |
455 | ||
456 | dnl Goto-Table instruction too long. | |
65a8a59e | 457 | # bad OpenFlow11 instructions: OFPBIC_BAD_LEN |
d01c980f BP |
458 | 0001 0010 01 000000 0000000000000000 |
459 | ||
8dd54666 IY |
460 | dnl Goto-Table 1 instruction non-zero padding |
461 | # actions=goto_table:1 | |
462 | # 7: 01 -> 00 | |
463 | 0001 0008 01 000001 | |
464 | ||
bff7eeb6 | 465 | dnl Goto-Table 1 instruction go back to the previous table. |
8c87971e | 466 | # bad OpenFlow11 instructions: OFPBIC_BAD_TABLE_ID |
bff7eeb6 JA |
467 | 2,0001 0008 01 000000 |
468 | ||
8dd54666 IY |
469 | dnl Goto-Table 1 |
470 | # actions=goto_table:1 | |
d01c980f BP |
471 | 0001 0008 01 000000 |
472 | ||
4cceacb9 JS |
473 | dnl Write-Metadata. |
474 | # actions=write_metadata:0xfedcba9876543210 | |
d01c980f BP |
475 | 0002 0018 00000000 fedcba9876543210 ffffffffffffffff |
476 | ||
8f2cded4 BP |
477 | dnl Write-Metadata as Nicira extension action is transformed into instruction. |
478 | # actions=write_metadata:0xfedcba9876543210 | |
479 | # 1: 04 -> 02 | |
480 | # 3: 28 -> 18 | |
481 | # 8: ff -> fe | |
482 | # 9: ff -> dc | |
483 | # 10: 00 -> ba | |
484 | # 11: 20 -> 98 | |
485 | # 12: 00 -> 76 | |
486 | # 13: 00 -> 54 | |
487 | # 14: 23 -> 32 | |
488 | # 15: 20 -> 10 | |
489 | # 16: 00 -> ff | |
490 | # 17: 16 -> ff | |
491 | # 18: 00 -> ff | |
492 | # 19: 00 -> ff | |
493 | # 20: 00 -> ff | |
494 | # 21: 00 -> ff | |
495 | # 22: 00 -> ff | |
496 | # 23: 00 -> ff | |
497 | # 24: fe -> (none) | |
498 | # 25: dc -> (none) | |
499 | # 26: ba -> (none) | |
500 | # 27: 98 -> (none) | |
501 | # 28: 76 -> (none) | |
502 | # 29: 54 -> (none) | |
503 | # 30: 32 -> (none) | |
504 | # 31: 10 -> (none) | |
505 | # 32: ff -> (none) | |
506 | # 33: ff -> (none) | |
507 | # 34: ff -> (none) | |
508 | # 35: ff -> (none) | |
509 | # 36: ff -> (none) | |
510 | # 37: ff -> (none) | |
511 | # 38: ff -> (none) | |
512 | # 39: ff -> (none) | |
513 | 0004 0028 00000000 ffff 0020 00002320 0016 000000000000 fedcba9876543210 ffffffffffffffff | |
514 | ||
4cceacb9 JS |
515 | dnl Write-Metadata with mask. |
516 | # actions=write_metadata:0xfedcba9876543210/0xff00ff00ff00ff00 | |
517 | 0002 0018 00000000 fedcba9876543210 ff00ff00ff00ff00 | |
518 | ||
d01c980f | 519 | dnl Write-Metadata too short. |
65a8a59e | 520 | # bad OpenFlow11 instructions: OFPBIC_BAD_LEN |
d01c980f BP |
521 | 0002 0010 00000000 fedcba9876543210 |
522 | ||
523 | dnl Write-Metadata too long. | |
65a8a59e | 524 | # bad OpenFlow11 instructions: OFPBIC_BAD_LEN |
d01c980f BP |
525 | 0002 0020 00000000 fedcba9876543210 ffffffffffffffff 0000000000000000 |
526 | ||
4cceacb9 | 527 | dnl Write-Metadata duplicated. |
65a8a59e | 528 | # bad OpenFlow11 instructions: OFPBIC_DUP_INST |
4cceacb9 JS |
529 | 0002 0018 00000000 fedcba9876543210 ff00ff00ff00ff00 0002 0018 00000000 fedcba9876543210 ff00ff00ff00ff00 |
530 | ||
6813ee7c BP |
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 | |
534 | # 1: 01 -> 02 | |
535 | # 3: 08 -> 18 | |
536 | # 4: 01 -> 00 | |
537 | # 8: 00 -> fe | |
538 | # 9: 02 -> dc | |
539 | # 10: 00 -> ba | |
540 | # 11: 18 -> 98 | |
541 | # 12: 00 -> 76 | |
542 | # 13: 00 -> 54 | |
543 | # 14: 00 -> 32 | |
544 | # 15: 00 -> 10 | |
545 | # 16: fe -> ff | |
546 | # 17: dc -> ff | |
547 | # 18: ba -> ff | |
548 | # 19: 98 -> ff | |
549 | # 20: 76 -> ff | |
550 | # 21: 54 -> ff | |
551 | # 22: 32 -> ff | |
552 | # 23: 10 -> ff | |
553 | # 24: ff -> 00 | |
554 | # 25: ff -> 01 | |
555 | # 26: ff -> 00 | |
556 | # 27: ff -> 08 | |
557 | # 28: ff -> 01 | |
558 | # 29: ff -> 00 | |
559 | # 30: ff -> 00 | |
560 | # 31: ff -> 00 | |
4cceacb9 JS |
561 | 0001 0008 01 000000 0002 0018 00000000 fedcba9876543210 ffffffffffffffff |
562 | ||
7fdb60a7 SH |
563 | dnl empty Write-Actions non-zero padding |
564 | # actions=write_actions(drop) | |
565 | # 0: 00 -> (none) | |
566 | # 1: 03 -> (none) | |
567 | # 2: 00 -> (none) | |
568 | # 3: 08 -> (none) | |
569 | # 4: 00 -> (none) | |
570 | # 5: 00 -> (none) | |
571 | # 6: 00 -> (none) | |
572 | # 7: 01 -> (none) | |
573 | 0003 0008 00000001 | |
574 | ||
575 | dnl Check that an empty Write-Actions instruction gets dropped. | |
576 | # actions=write_actions(drop) | |
577 | # 0: 00 -> (none) | |
578 | # 1: 03 -> (none) | |
579 | # 2: 00 -> (none) | |
580 | # 3: 08 -> (none) | |
581 | # 4: 00 -> (none) | |
582 | # 5: 00 -> (none) | |
583 | # 6: 00 -> (none) | |
584 | # 7: 00 -> (none) | |
585 | 0003 0008 00000000 | |
d01c980f | 586 | |
b19e8793 | 587 | dnl Clear-Actions too-long |
65a8a59e | 588 | # bad OpenFlow11 instructions: OFPBIC_BAD_LEN |
b19e8793 IY |
589 | 0005 0010 00000000 0000000000000000 |
590 | ||
591 | dnl Clear-Actions non-zero padding | |
592 | # actions=clear_actions | |
593 | # 7: 01 -> 00 | |
594 | 0005 0008 00000001 | |
595 | ||
596 | dnl Clear-Actions non-zero padding | |
597 | # actions=clear_actions | |
598 | # 4: 01 -> 00 | |
d01c980f BP |
599 | 0005 0008 01 000000 |
600 | ||
b19e8793 IY |
601 | dnl Clear-Actions |
602 | # actions=clear_actions | |
603 | 0005 0008 00000000 | |
604 | ||
d01c980f | 605 | dnl Experimenter actions not supported yet. |
65a8a59e | 606 | # bad OpenFlow11 instructions: OFPBIC_BAD_EXPERIMENTER |
d01c980f BP |
607 | ffff 0008 01 000000 |
608 | ||
609 | dnl Bad instruction number (0 not assigned). | |
65a8a59e | 610 | # bad OpenFlow11 instructions: OFPBIC_UNKNOWN_INST |
d01c980f BP |
611 | 0000 0008 01 000000 |
612 | ||
613 | ]) | |
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]) | |
620 | AT_CHECK( | |
65a8a59e | 621 | [ovs-ofctl '-vPATTERN:console:%c|%p|%m' parse-instructions OpenFlow11 < input.txt], |
d01c980f BP |
622 | [0], [expout], [experr]) |
623 | AT_CLEANUP | |
94baabf7 | 624 | |
178742f9 BP |
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 | |
630 | # actions=LOCAL | |
631 | 0000 0010 fffffffe 04d2 000000000000 | |
632 | ||
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 | |
638 | ||
639 | ]) | |
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]) | |
646 | AT_CHECK( | |
647 | [ovs-ofctl '-vPATTERN:console:%c|%p|%m' parse-actions OpenFlow12 < input.txt], | |
648 | [0], [expout], [experr]) | |
649 | AT_CLEANUP | |
650 | ||
914624f8 BP |
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 | |
656 | # actions=LOCAL | |
657 | 0000 0010 fffffffe 04d2 000000000000 | |
658 | ||
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 | |
662 | ||
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 | |
666 | ||
667 | ]) | |
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]) | |
674 | AT_CHECK( | |
675 | [ovs-ofctl '-vPATTERN:console:%c|%p|%m' parse-actions OpenFlow13 < input.txt], | |
676 | [0], [expout], [experr]) | |
677 | AT_CLEANUP | |
678 | ||
da4425c7 BP |
679 | dnl Our primary goal here is to verify that OpenFlow 1.5-specific changes, |
680 | dnl so the list of tests is short. | |
73178f20 BP |
681 | AT_SETUP([OpenFlow 1.5 action translation]) |
682 | AT_KEYWORDS([ofp-actions OF1.5]) | |
683 | AT_DATA([test-data], [dnl | |
684 | # actions=LOCAL | |
685 | 0000 0010 fffffffe 04d2 000000000000 | |
686 | ||
687 | # actions=move:NXM_OF_IN_PORT[]->NXM_OF_VLAN_TCI[] | |
650763d8 | 688 | 001c 0018 0010 0000 0000 0000 00000002 00000802 00000000 |
73178f20 | 689 | |
7eb4b1f1 | 690 | # actions=set_field:00:00:00:00:12:34/00:00:00:00:ff:ff->eth_src |
178742f9 | 691 | 0019 0018 8000090c 000000001234 00000000ffff 00000000 |
da4425c7 | 692 | |
73178f20 BP |
693 | ]) |
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]) | |
700 | AT_CHECK( | |
701 | [ovs-ofctl '-vPATTERN:console:%c|%p|%m' parse-actions OpenFlow15 < input.txt], | |
702 | [0], [expout], [experr]) | |
703 | AT_CLEANUP | |
704 | ||
94baabf7 SH |
705 | AT_SETUP([ofp-actions - inconsistent MPLS actions]) |
706 | OVS_VSWITCHD_START | |
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)'], | |
711 | [1], [], [dnl | |
ba2fe8e9 | 712 | ovs-ofctl: none of the usable flow formats (OpenFlow10,NXM) is among the allowed flow formats (OpenFlow11) |
94baabf7 SH |
713 | ]) |
714 | OVS_VSWITCHD_STOP | |
715 | AT_CLEANUP | |
fa078489 BP |
716 | |
717 | AT_SETUP([reg_load <-> set_field translation corner case]) | |
718 | AT_KEYWORDS([ofp-actions]) | |
719 | OVS_VSWITCHD_START | |
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 | |
726 | NXST_FLOW reply: | |
727 | mpls actions=load:0xa->OXM_OF_MPLS_LABEL[[]] | |
728 | ]) | |
729 | OVS_VSWITCHD_STOP | |
730 | AT_CLEANUP |