]>
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 | ||
77ab5fd2 BP |
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 | |
bdcad671 BP |
118 | 0000 0008 04d2 0000 dnl |
119 | 0001 0008 162e 0000 dnl | |
120 | 0002 0005 02 000000 dnl | |
77ab5fd2 BP |
121 | 0003 0009 0102030405 00000000000000 dnl |
122 | 0004 0004 00000000 | |
bdcad671 | 123 | |
c2d967a5 MM |
124 | # actions=dec_ttl(32768,12345,90,765,1024) |
125 | ffff 0020 00002320 0015 000500000000 80003039005A02fd 0400000000000000 | |
126 | ||
29089a54 RL |
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 | |
129 | ||
f69f713b BY |
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 | |
132 | ||
b153b990 BP |
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 | |
138 | ||
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 | |
144 | ||
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 | |
148 | ||
13d2c689 BP |
149 | # bad OpenFlow10 actions: OFPBAC_BAD_OUT_PORT |
150 | 0000 0008 ffff 0000 | |
151 | ||
07659514 JS |
152 | # actions=ct() |
153 | ffff 0018 00002320 0023 0000 00000000 0000 FF 000000 0000 | |
154 | ||
155 | # actions=ct(commit) | |
156 | ffff 0018 00002320 0023 0001 00000000 0000 FF 000000 0000 | |
157 | ||
158 | # actions=ct(table=10) | |
159 | ffff 0018 00002320 0023 0000 00000000 0000 0A 000000 0000 | |
160 | ||
161 | # actions=ct(zone=10) | |
162 | ffff 0018 00002320 0023 0000 00000000 000A FF 000000 0000 | |
163 | ||
164 | # actions=ct(zone=NXM_NX_REG0[0..15]) | |
165 | ffff 0018 00002320 0023 0000 00010004 000F FF 000000 0000 | |
166 | ||
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 | |
170 | ||
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 | |
174 | ||
8e53fe8c JS |
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 | |
178 | ||
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 | |
182 | ||
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 | |
187 | ||
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 | |
192 | ||
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 | |
197 | ||
d787ad39 JS |
198 | # actions=ct(alg=ftp) |
199 | ffff 0018 00002320 0023 0000 00000000 0000 FF 000000 0015 | |
200 | ||
9ac0aada JR |
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 | |
204 | ||
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 | |
208 | ||
209 | # actions=ct(nat) | |
210 | ffff 0028 00002320 0023 0000 00000000 0000 FF 000000 0000 dnl | |
211 | ffff 0010 00002320 0024 00 00 0000 0000 | |
212 | ||
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 | |
216 | ||
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 | |
220 | ||
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 | |
224 | ||
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 | |
228 | ||
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 | |
232 | ||
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 | |
236 | ||
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 | |
242 | 00ff1000 00000000 | |
243 | ||
77ab5fd2 BP |
244 | # bad OpenFlow10 actions: NXBRC_MUST_BE_ZERO |
245 | ffff 0018 00002320 0025 0000 0005 0000 1122334455 000005 | |
246 | ||
247 | # bad OpenFlow10 actions: NXBRC_MUST_BE_ZERO | |
248 | ffff 0018 00002320 0025 0000 0005 5000 1122334455 000000 | |
249 | ||
9ac0aada JR |
250 | # bad OpenFlow10 actions: OFPBAC_BAD_ARGUMENT |
251 | ffff 0048 00002320 0023 0001 00000000 0000 FF 000000 0000 dnl | |
252 | ffff 0030 00002320 0024 00 00 0011 000c fe800000 00000000 020c 29ff fe88 a18b fe800000 00000000 020c 29ff fe88 0001 | |
253 | ||
f25d0cf3 BP |
254 | ]) |
255 | sed '/^[[#&]]/d' < test-data > input.txt | |
256 | sed -n 's/^# //p; /^$/p' < test-data > expout | |
257 | sed -n 's/^& //p' < test-data > experr | |
258 | AT_CAPTURE_FILE([input.txt]) | |
259 | AT_CAPTURE_FILE([expout]) | |
260 | AT_CAPTURE_FILE([experr]) | |
261 | AT_CHECK( | |
65a8a59e | 262 | [ovs-ofctl '-vPATTERN:console:%c|%p|%m' parse-actions OpenFlow10 < input.txt], |
f25d0cf3 BP |
263 | [0], [expout], [experr]) |
264 | AT_CLEANUP | |
d01c980f | 265 | |
8f2cded4 BP |
266 | AT_SETUP([OpenFlow 1.0 "instruction" translations]) |
267 | AT_KEYWORDS([ofp-actions OF1.0 instruction]) | |
268 | AT_DATA([test-data], [dnl | |
269 | dnl Try a couple of ordinary actions to make sure they're accepted, | |
270 | dnl but there's no point in retrying all the actions from the previous test. | |
271 | # actions=LOCAL | |
272 | 0000 0008 fffe 04d2 | |
273 | ||
274 | # actions=mod_dl_src:00:11:22:33:44:55 | |
275 | 0004 0010 001122334455 000000000000 | |
276 | ||
277 | dnl Now check that write_metadata is accepted. | |
278 | # actions=write_metadata:0xfedcba9876543210 | |
279 | ffff 0020 00002320 0016 000000000000 fedcba9876543210 ffffffffffffffff | |
280 | ||
281 | # actions=write_metadata:0xfedcba9876543210/0xffff0000ffff0000 | |
282 | ffff 0020 00002320 0016 000000000000 fedcba9876543210 ffff0000ffff0000 | |
283 | ||
284 | ]) | |
285 | sed '/^[[#&]]/d' < test-data > input.txt | |
286 | sed -n 's/^# //p; /^$/p' < test-data > expout | |
287 | sed -n 's/^& //p' < test-data > experr | |
288 | AT_CAPTURE_FILE([input.txt]) | |
289 | AT_CAPTURE_FILE([expout]) | |
290 | AT_CAPTURE_FILE([experr]) | |
291 | AT_CHECK( | |
65a8a59e | 292 | [ovs-ofctl '-vPATTERN:console:%c|%p|%m' parse-instructions OpenFlow10 < input.txt], |
8f2cded4 BP |
293 | [0], [expout], [experr]) |
294 | AT_CLEANUP | |
295 | ||
d01c980f | 296 | AT_SETUP([OpenFlow 1.1 action translation]) |
4cceacb9 | 297 | AT_KEYWORDS([ofp-actions OF1.1]) |
d01c980f BP |
298 | AT_DATA([test-data], [dnl |
299 | # actions=LOCAL | |
300 | 0000 0010 fffffffe 04d2 000000000000 | |
301 | ||
302 | # actions=CONTROLLER:1234 | |
303 | 0000 0010 fffffffd 04d2 000000000000 | |
304 | ||
ca287d20 | 305 | # actions=set_vlan_vid:9 |
d01c980f BP |
306 | 0001 0008 0009 0000 |
307 | ||
ca287d20 | 308 | # actions=set_vlan_pcp:6 |
d01c980f BP |
309 | 0002 0008 06 000000 |
310 | ||
311 | # actions=mod_dl_src:00:11:22:33:44:55 | |
312 | 0003 0010 001122334455 000000000000 | |
313 | ||
314 | # actions=mod_dl_dst:10:20:30:40:50:60 | |
315 | 0004 0010 102030405060 000000000000 | |
316 | ||
317 | # actions=mod_nw_src:1.2.3.4 | |
318 | 0005 0008 01020304 | |
319 | ||
320 | # actions=mod_nw_dst:192.168.0.1 | |
321 | 0006 0008 c0a80001 | |
322 | ||
323 | # actions=mod_nw_tos:48 | |
324 | 0007 0008 30 000000 | |
325 | ||
326 | # actions=mod_tp_src:80 | |
327 | 0009 0008 0050 0000 | |
328 | ||
329 | # actions=mod_tp_dst:443 | |
330 | 000a 0008 01bb 0000 | |
331 | ||
64fcc073 | 332 | # actions=pop_vlan |
8e61c110 IY |
333 | 0012 0008 00000000 |
334 | ||
276c4e7a SH |
335 | # actions=set_queue:2309737729 |
336 | 0015 0008 89abcd01 | |
337 | ||
3e34fbdd IY |
338 | dnl 802.1ad isn't supported at the moment |
339 | dnl # actions=push_vlan:0x88a8 | |
340 | dnl 0011 0008 88a8 0000 | |
341 | # actions=push_vlan:0x8100 | |
342 | 0011 0008 8100 0000 | |
343 | ||
d01c980f BP |
344 | # actions=resubmit:5 |
345 | ffff 0010 00002320 0001 0005 00000000 | |
346 | ||
347 | # actions=set_tunnel:0x12345678 | |
348 | ffff 0010 00002320 0002 0000 12345678 | |
349 | ||
d01c980f BP |
350 | # actions=pop_queue |
351 | ffff 0010 00002320 0005 000000000000 | |
352 | ||
353 | # actions=move:NXM_OF_IN_PORT[]->NXM_OF_VLAN_TCI[] | |
354 | ffff 0018 00002320 0006 0010 0000 0000 00000002 00000802 | |
355 | ||
356 | # actions=load:0xf009->NXM_OF_VLAN_TCI[] | |
357 | ffff 0018 00002320 0007 000f 00000802 000000000000f009 | |
358 | ||
359 | # actions=note:11.e9.9a.ad.67.f3 | |
360 | ffff 0010 00002320 0008 11e99aad67f3 | |
361 | ||
362 | # actions=set_tunnel64:0xc426384d49c53d60 | |
363 | ffff 0018 00002320 0009 000000000000 c426384d49c53d60 | |
364 | ||
365 | # actions=set_tunnel64:0x885f3298 | |
366 | ffff 0018 00002320 0009 000000000000 00000000885f3298 | |
367 | ||
8f2cded4 BP |
368 | dnl Write-Metadata is only allowed in contexts that allow instructions. |
369 | & ofp_actions|WARN|write_metadata instruction not allowed here | |
65a8a59e | 370 | # bad OpenFlow11 actions: OFPBIC_UNSUP_INST |
4cceacb9 JS |
371 | ffff 0020 00002320 0016 000000000000 fedcba9876543210 ffffffffffffffff |
372 | ||
d01c980f BP |
373 | # actions=multipath(eth_src,50,modulo_n,1,0,NXM_NX_REG0[]) |
374 | ffff 0020 00002320 000a 0000 0032 0000 0000 0000 0000 0000 0000 001f 00010004 | |
375 | ||
d01c980f BP |
376 | # actions=bundle(eth_src,0,hrw,ofport,slaves:4,8) |
377 | ffff 0028 00002320 000c 0001 0000 0000 00000002 0002 0000 00000000 00000000 dnl | |
378 | 0004 0008 00000000 | |
379 | ||
380 | # actions=bundle_load(eth_src,0,hrw,ofport,NXM_NX_REG0[],slaves:4,8) | |
381 | ffff 0028 00002320 000d 0001 0000 0000 00000002 0002 001f 00010004 00000000 dnl | |
382 | 0004 0008 00000000 | |
383 | ||
384 | # actions=resubmit(10,5) | |
385 | ffff 0010 00002320 000e 000a 05 000000 | |
386 | ||
387 | # actions=output:NXM_NX_REG1[5..10] | |
388 | ffff 0018 00002320 000f 0145 00010204 ffff 000000000000 | |
389 | ||
390 | # 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[]) | |
391 | ffff 0048 00002320 0010 000a 0014 0050 123456789abcdef0 0000 02 00 0002 0004 dnl | |
392 | 000c 00000802 0000 00000802 0000 dnl | |
393 | 0030 00000406 0000 00000206 0000 dnl | |
394 | 1010 00000002 0000 dnl | |
395 | 00000000 | |
396 | ||
397 | # actions=exit | |
398 | ffff 0010 00002320 0011 000000000000 | |
399 | ||
7bcb1506 IY |
400 | dnl OpenFlow 1.1 OFPAT_DEC_TTL |
401 | # actions=dec_ttl | |
402 | 0018 0008 00000000 | |
403 | ||
d01c980f BP |
404 | # actions=fin_timeout(idle_timeout=10,hard_timeout=20) |
405 | ffff 0010 00002320 0013 000a 0014 0000 | |
406 | ||
407 | # actions=controller(reason=invalid_ttl,max_len=1234,id=5678) | |
408 | ffff 0010 00002320 0014 04d2 162e 02 00 | |
409 | ||
c2d967a5 MM |
410 | # actions=dec_ttl(32768,12345,90,765,1024) |
411 | ffff 0020 00002320 0015 000500000000 80003039005A02fd 0400000000000000 | |
412 | ||
29089a54 RL |
413 | # actions=sample(probability=12345,collector_set_id=23456,obs_domain_id=34567,obs_point_id=45678) |
414 | ffff 0018 00002320 001d 3039 00005BA0 00008707 0000B26E | |
415 | ||
13d2c689 BP |
416 | # bad OpenFlow11 actions: OFPBAC_BAD_OUT_PORT |
417 | & ofp_actions|WARN|bad action at offset 0 (OFPBAC_BAD_OUT_PORT): | |
418 | & 00000000 00 00 00 10 ff ff ff ff-00 00 00 00 00 00 00 00 | |
419 | 0000 0010 ffffffff 0000 000000000000 | |
420 | ||
d01c980f BP |
421 | ]) |
422 | sed '/^[[#&]]/d' < test-data > input.txt | |
423 | sed -n 's/^# //p; /^$/p' < test-data > expout | |
424 | sed -n 's/^& //p' < test-data > experr | |
425 | AT_CAPTURE_FILE([input.txt]) | |
426 | AT_CAPTURE_FILE([expout]) | |
427 | AT_CAPTURE_FILE([experr]) | |
428 | AT_CHECK( | |
65a8a59e | 429 | [ovs-ofctl '-vPATTERN:console:%c|%p|%m' parse-actions OpenFlow11 < input.txt], |
d01c980f BP |
430 | [0], [expout], [experr]) |
431 | AT_CLEANUP | |
432 | ||
433 | AT_SETUP([OpenFlow 1.1 instruction translation]) | |
4cceacb9 | 434 | AT_KEYWORDS([OF1.1 instruction ofp-actions]) |
d01c980f BP |
435 | AT_DATA([test-data], [dnl |
436 | # actions=LOCAL | |
437 | 0004 0018 00000000 dnl | |
438 | 0000 0010 fffffffe 04d2 000000000000 | |
439 | ||
8dd54666 IY |
440 | dnl Apply-Actions non-zero padding |
441 | # actions=drop | |
442 | # 0: 00 -> (none) | |
443 | # 1: 04 -> (none) | |
444 | # 2: 00 -> (none) | |
445 | # 3: 08 -> (none) | |
446 | # 4: 00 -> (none) | |
447 | # 5: 00 -> (none) | |
448 | # 6: 00 -> (none) | |
449 | # 7: 01 -> (none) | |
450 | 0004 0008 00000001 | |
451 | ||
d01c980f BP |
452 | dnl Check that an empty Apply-Actions instruction gets dropped. |
453 | # actions=drop | |
454 | # 0: 00 -> (none) | |
455 | # 1: 04 -> (none) | |
456 | # 2: 00 -> (none) | |
457 | # 3: 08 -> (none) | |
458 | # 4: 00 -> (none) | |
459 | # 5: 00 -> (none) | |
460 | # 6: 00 -> (none) | |
461 | # 7: 00 -> (none) | |
462 | 0004 0008 00000000 | |
463 | ||
e38c9de5 | 464 | dnl Duplicate instruction type: |
65a8a59e | 465 | # bad OpenFlow11 instructions: OFPBIC_DUP_INST |
d01c980f BP |
466 | 0004 0008 00000000 0004 0008 00000000 |
467 | ||
468 | dnl Instructions not multiple of 8 in length. | |
469 | & ofp_actions|WARN|OpenFlow message instructions length 9 is not a multiple of 8 | |
65a8a59e | 470 | # bad OpenFlow11 instructions: OFPBIC_BAD_LEN |
d01c980f BP |
471 | 0004 0009 01 00000000 |
472 | ||
473 | dnl Goto-Table instruction too long. | |
65a8a59e | 474 | # bad OpenFlow11 instructions: OFPBIC_BAD_LEN |
d01c980f BP |
475 | 0001 0010 01 000000 0000000000000000 |
476 | ||
8dd54666 IY |
477 | dnl Goto-Table 1 instruction non-zero padding |
478 | # actions=goto_table:1 | |
479 | # 7: 01 -> 00 | |
480 | 0001 0008 01 000001 | |
481 | ||
bff7eeb6 | 482 | dnl Goto-Table 1 instruction go back to the previous table. |
8c87971e | 483 | # bad OpenFlow11 instructions: OFPBIC_BAD_TABLE_ID |
bff7eeb6 JA |
484 | 2,0001 0008 01 000000 |
485 | ||
8dd54666 IY |
486 | dnl Goto-Table 1 |
487 | # actions=goto_table:1 | |
d01c980f BP |
488 | 0001 0008 01 000000 |
489 | ||
4cceacb9 JS |
490 | dnl Write-Metadata. |
491 | # actions=write_metadata:0xfedcba9876543210 | |
d01c980f BP |
492 | 0002 0018 00000000 fedcba9876543210 ffffffffffffffff |
493 | ||
8f2cded4 BP |
494 | dnl Write-Metadata as Nicira extension action is transformed into instruction. |
495 | # actions=write_metadata:0xfedcba9876543210 | |
496 | # 1: 04 -> 02 | |
497 | # 3: 28 -> 18 | |
498 | # 8: ff -> fe | |
499 | # 9: ff -> dc | |
500 | # 10: 00 -> ba | |
501 | # 11: 20 -> 98 | |
502 | # 12: 00 -> 76 | |
503 | # 13: 00 -> 54 | |
504 | # 14: 23 -> 32 | |
505 | # 15: 20 -> 10 | |
506 | # 16: 00 -> ff | |
507 | # 17: 16 -> ff | |
508 | # 18: 00 -> ff | |
509 | # 19: 00 -> ff | |
510 | # 20: 00 -> ff | |
511 | # 21: 00 -> ff | |
512 | # 22: 00 -> ff | |
513 | # 23: 00 -> ff | |
514 | # 24: fe -> (none) | |
515 | # 25: dc -> (none) | |
516 | # 26: ba -> (none) | |
517 | # 27: 98 -> (none) | |
518 | # 28: 76 -> (none) | |
519 | # 29: 54 -> (none) | |
520 | # 30: 32 -> (none) | |
521 | # 31: 10 -> (none) | |
522 | # 32: ff -> (none) | |
523 | # 33: ff -> (none) | |
524 | # 34: ff -> (none) | |
525 | # 35: ff -> (none) | |
526 | # 36: ff -> (none) | |
527 | # 37: ff -> (none) | |
528 | # 38: ff -> (none) | |
529 | # 39: ff -> (none) | |
530 | 0004 0028 00000000 ffff 0020 00002320 0016 000000000000 fedcba9876543210 ffffffffffffffff | |
531 | ||
4cceacb9 JS |
532 | dnl Write-Metadata with mask. |
533 | # actions=write_metadata:0xfedcba9876543210/0xff00ff00ff00ff00 | |
534 | 0002 0018 00000000 fedcba9876543210 ff00ff00ff00ff00 | |
535 | ||
d01c980f | 536 | dnl Write-Metadata too short. |
65a8a59e | 537 | # bad OpenFlow11 instructions: OFPBIC_BAD_LEN |
d01c980f BP |
538 | 0002 0010 00000000 fedcba9876543210 |
539 | ||
540 | dnl Write-Metadata too long. | |
65a8a59e | 541 | # bad OpenFlow11 instructions: OFPBIC_BAD_LEN |
d01c980f BP |
542 | 0002 0020 00000000 fedcba9876543210 ffffffffffffffff 0000000000000000 |
543 | ||
4cceacb9 | 544 | dnl Write-Metadata duplicated. |
65a8a59e | 545 | # bad OpenFlow11 instructions: OFPBIC_DUP_INST |
4cceacb9 JS |
546 | 0002 0018 00000000 fedcba9876543210 ff00ff00ff00ff00 0002 0018 00000000 fedcba9876543210 ff00ff00ff00ff00 |
547 | ||
6813ee7c BP |
548 | dnl Write-Metadata in wrong position (OpenFlow 1.1+ disregards the order |
549 | dnl and OVS reorders it to the canonical order) | |
550 | # actions=write_metadata:0xfedcba9876543210,goto_table:1 | |
551 | # 1: 01 -> 02 | |
552 | # 3: 08 -> 18 | |
553 | # 4: 01 -> 00 | |
554 | # 8: 00 -> fe | |
555 | # 9: 02 -> dc | |
556 | # 10: 00 -> ba | |
557 | # 11: 18 -> 98 | |
558 | # 12: 00 -> 76 | |
559 | # 13: 00 -> 54 | |
560 | # 14: 00 -> 32 | |
561 | # 15: 00 -> 10 | |
562 | # 16: fe -> ff | |
563 | # 17: dc -> ff | |
564 | # 18: ba -> ff | |
565 | # 19: 98 -> ff | |
566 | # 20: 76 -> ff | |
567 | # 21: 54 -> ff | |
568 | # 22: 32 -> ff | |
569 | # 23: 10 -> ff | |
570 | # 24: ff -> 00 | |
571 | # 25: ff -> 01 | |
572 | # 26: ff -> 00 | |
573 | # 27: ff -> 08 | |
574 | # 28: ff -> 01 | |
575 | # 29: ff -> 00 | |
576 | # 30: ff -> 00 | |
577 | # 31: ff -> 00 | |
4cceacb9 JS |
578 | 0001 0008 01 000000 0002 0018 00000000 fedcba9876543210 ffffffffffffffff |
579 | ||
7fdb60a7 SH |
580 | dnl empty Write-Actions non-zero padding |
581 | # actions=write_actions(drop) | |
582 | # 0: 00 -> (none) | |
583 | # 1: 03 -> (none) | |
584 | # 2: 00 -> (none) | |
585 | # 3: 08 -> (none) | |
586 | # 4: 00 -> (none) | |
587 | # 5: 00 -> (none) | |
588 | # 6: 00 -> (none) | |
589 | # 7: 01 -> (none) | |
590 | 0003 0008 00000001 | |
591 | ||
592 | dnl Check that an empty Write-Actions instruction gets dropped. | |
593 | # actions=write_actions(drop) | |
594 | # 0: 00 -> (none) | |
595 | # 1: 03 -> (none) | |
596 | # 2: 00 -> (none) | |
597 | # 3: 08 -> (none) | |
598 | # 4: 00 -> (none) | |
599 | # 5: 00 -> (none) | |
600 | # 6: 00 -> (none) | |
601 | # 7: 00 -> (none) | |
602 | 0003 0008 00000000 | |
d01c980f | 603 | |
b19e8793 | 604 | dnl Clear-Actions too-long |
65a8a59e | 605 | # bad OpenFlow11 instructions: OFPBIC_BAD_LEN |
b19e8793 IY |
606 | 0005 0010 00000000 0000000000000000 |
607 | ||
608 | dnl Clear-Actions non-zero padding | |
609 | # actions=clear_actions | |
610 | # 7: 01 -> 00 | |
611 | 0005 0008 00000001 | |
612 | ||
613 | dnl Clear-Actions non-zero padding | |
614 | # actions=clear_actions | |
615 | # 4: 01 -> 00 | |
d01c980f BP |
616 | 0005 0008 01 000000 |
617 | ||
b19e8793 IY |
618 | dnl Clear-Actions |
619 | # actions=clear_actions | |
620 | 0005 0008 00000000 | |
621 | ||
d01c980f | 622 | dnl Experimenter actions not supported yet. |
65a8a59e | 623 | # bad OpenFlow11 instructions: OFPBIC_BAD_EXPERIMENTER |
d01c980f BP |
624 | ffff 0008 01 000000 |
625 | ||
626 | dnl Bad instruction number (0 not assigned). | |
65a8a59e | 627 | # bad OpenFlow11 instructions: OFPBIC_UNKNOWN_INST |
d01c980f BP |
628 | 0000 0008 01 000000 |
629 | ||
630 | ]) | |
631 | sed '/^[[#&]]/d' < test-data > input.txt | |
632 | sed -n 's/^# //p; /^$/p' < test-data > expout | |
633 | sed -n 's/^& //p' < test-data > experr | |
634 | AT_CAPTURE_FILE([input.txt]) | |
635 | AT_CAPTURE_FILE([expout]) | |
636 | AT_CAPTURE_FILE([experr]) | |
637 | AT_CHECK( | |
65a8a59e | 638 | [ovs-ofctl '-vPATTERN:console:%c|%p|%m' parse-instructions OpenFlow11 < input.txt], |
d01c980f BP |
639 | [0], [expout], [experr]) |
640 | AT_CLEANUP | |
94baabf7 | 641 | |
178742f9 BP |
642 | dnl Our primary goal here is to verify OpenFlow 1.2-specific changes, |
643 | dnl so the list of tests is short. | |
644 | AT_SETUP([OpenFlow 1.2 action translation]) | |
645 | AT_KEYWORDS([ofp-actions OF1.2]) | |
646 | AT_DATA([test-data], [dnl | |
647 | # actions=LOCAL | |
648 | 0000 0010 fffffffe 04d2 000000000000 | |
649 | ||
650 | # bad OpenFlow12 actions: OFPBAC_BAD_SET_MASK | |
651 | & ofp_actions|WARN|bad action at offset 0 (OFPBAC_BAD_SET_MASK): | |
652 | & 00000000 00 19 00 18 80 00 09 0c-00 00 00 00 12 34 00 00 | |
653 | & 00000010 00 00 ff ff 00 00 00 00- | |
654 | 0019 0018 8000090c 000000001234 00000000ffff 00000000 | |
655 | ||
656 | ]) | |
657 | sed '/^[[#&]]/d' < test-data > input.txt | |
658 | sed -n 's/^# //p; /^$/p' < test-data > expout | |
659 | sed -n 's/^& //p' < test-data > experr | |
660 | AT_CAPTURE_FILE([input.txt]) | |
661 | AT_CAPTURE_FILE([expout]) | |
662 | AT_CAPTURE_FILE([experr]) | |
663 | AT_CHECK( | |
664 | [ovs-ofctl '-vPATTERN:console:%c|%p|%m' parse-actions OpenFlow12 < input.txt], | |
665 | [0], [expout], [experr]) | |
666 | AT_CLEANUP | |
667 | ||
914624f8 BP |
668 | dnl Our primary goal here is to verify OpenFlow 1.3-specific changes, |
669 | dnl so the list of tests is short. | |
670 | AT_SETUP([OpenFlow 1.3 action translation]) | |
671 | AT_KEYWORDS([ofp-actions OF1.3]) | |
672 | AT_DATA([test-data], [dnl | |
673 | # actions=LOCAL | |
674 | 0000 0010 fffffffe 04d2 000000000000 | |
675 | ||
676 | dnl Check the Nicira extension form of "move". | |
677 | # actions=move:NXM_OF_IN_PORT[]->NXM_OF_VLAN_TCI[] | |
678 | ffff 0018 00002320 0006 0010 0000 0000 00000002 00000802 | |
679 | ||
680 | dnl Check the ONF extension form of "copy_field". | |
681 | # actions=move:NXM_OF_IN_PORT[]->NXM_OF_VLAN_TCI[] | |
682 | ffff 0020 4f4e4600 0c80 0000 0010 0000 0000 0000 00000002 00000802 00000000 | |
683 | ||
684 | ]) | |
685 | sed '/^[[#&]]/d' < test-data > input.txt | |
686 | sed -n 's/^# //p; /^$/p' < test-data > expout | |
687 | sed -n 's/^& //p' < test-data > experr | |
688 | AT_CAPTURE_FILE([input.txt]) | |
689 | AT_CAPTURE_FILE([expout]) | |
690 | AT_CAPTURE_FILE([experr]) | |
691 | AT_CHECK( | |
692 | [ovs-ofctl '-vPATTERN:console:%c|%p|%m' parse-actions OpenFlow13 < input.txt], | |
693 | [0], [expout], [experr]) | |
694 | AT_CLEANUP | |
695 | ||
da4425c7 BP |
696 | dnl Our primary goal here is to verify that OpenFlow 1.5-specific changes, |
697 | dnl so the list of tests is short. | |
73178f20 BP |
698 | AT_SETUP([OpenFlow 1.5 action translation]) |
699 | AT_KEYWORDS([ofp-actions OF1.5]) | |
700 | AT_DATA([test-data], [dnl | |
701 | # actions=LOCAL | |
702 | 0000 0010 fffffffe 04d2 000000000000 | |
703 | ||
704 | # actions=move:NXM_OF_IN_PORT[]->NXM_OF_VLAN_TCI[] | |
650763d8 | 705 | 001c 0018 0010 0000 0000 0000 00000002 00000802 00000000 |
73178f20 | 706 | |
7eb4b1f1 | 707 | # actions=set_field:00:00:00:00:12:34/00:00:00:00:ff:ff->eth_src |
178742f9 | 708 | 0019 0018 8000090c 000000001234 00000000ffff 00000000 |
da4425c7 | 709 | |
73178f20 BP |
710 | ]) |
711 | sed '/^[[#&]]/d' < test-data > input.txt | |
712 | sed -n 's/^# //p; /^$/p' < test-data > expout | |
713 | sed -n 's/^& //p' < test-data > experr | |
714 | AT_CAPTURE_FILE([input.txt]) | |
715 | AT_CAPTURE_FILE([expout]) | |
716 | AT_CAPTURE_FILE([experr]) | |
717 | AT_CHECK( | |
718 | [ovs-ofctl '-vPATTERN:console:%c|%p|%m' parse-actions OpenFlow15 < input.txt], | |
719 | [0], [expout], [experr]) | |
720 | AT_CLEANUP | |
721 | ||
94baabf7 SH |
722 | AT_SETUP([ofp-actions - inconsistent MPLS actions]) |
723 | OVS_VSWITCHD_START | |
724 | dnl OK: Use fin_timeout action on TCP flow | |
725 | AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn add-flow br0 'tcp actions=fin_timeout(idle_timeout=1)']) | |
726 | dnl Bad: Use fin_timeout action on TCP flow that has been converted to MPLS | |
727 | AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn add-flow br0 'tcp actions=push_mpls:0x8847,fin_timeout(idle_timeout=1)'], | |
728 | [1], [], [dnl | |
ba2fe8e9 | 729 | ovs-ofctl: none of the usable flow formats (OpenFlow10,NXM) is among the allowed flow formats (OpenFlow11) |
94baabf7 SH |
730 | ]) |
731 | OVS_VSWITCHD_STOP | |
732 | AT_CLEANUP | |
fa078489 BP |
733 | |
734 | AT_SETUP([reg_load <-> set_field translation corner case]) | |
735 | AT_KEYWORDS([ofp-actions]) | |
736 | OVS_VSWITCHD_START | |
737 | dnl In OpenFlow 1.3, set_field always sets all the bits in the field, | |
738 | dnl but when we translate to NXAST_LOAD we need to only set the bits that | |
739 | dnl actually exist (e.g. mpls_label only has 20 bits) otherwise OVS rejects | |
740 | dnl the "load" action as invalid. Check that we do this correctly. | |
741 | AT_CHECK([ovs-ofctl -O OpenFlow13 add-flow br0 mpls,actions=set_field:10-\>mpls_label]) | |
742 | AT_CHECK([ovs-ofctl -O OpenFlow10 dump-flows br0 | ofctl_strip], [0], [dnl | |
743 | NXST_FLOW reply: | |
744 | mpls actions=load:0xa->OXM_OF_MPLS_LABEL[[]] | |
745 | ]) | |
746 | OVS_VSWITCHD_STOP | |
747 | AT_CLEANUP |