]>
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 | ||
91fc374a | 83 | # actions=bundle(eth_src,0,hrw,ofport,members:4,8) |
f25d0cf3 BP |
84 | ffff 0028 00002320 000c 0001 0000 0000 00000002 0002 0000 00000000 00000000 dnl |
85 | 0004 0008 00000000 | |
86 | ||
91fc374a | 87 | # actions=bundle_load(eth_src,0,hrw,ofport,NXM_NX_REG0[],members:4,8) |
f25d0cf3 BP |
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 | ||
2cd20955 JR |
94 | # actions=resubmit(10,5,ct) |
95 | ffff 0010 00002320 002c 000a 05 000000 | |
96 | ||
f25d0cf3 BP |
97 | # actions=output:NXM_NX_REG1[5..10] |
98 | ffff 0018 00002320 000f 0145 00010204 ffff 000000000000 | |
99 | ||
100 | # 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[]) | |
101 | ffff 0048 00002320 0010 000a 0014 0050 123456789abcdef0 0000 02 00 0002 0004 dnl | |
102 | 000c 00000802 0000 00000802 0000 dnl | |
103 | 0030 00000406 0000 00000206 0000 dnl | |
104 | 1010 00000002 0000 dnl | |
105 | 00000000 | |
106 | ||
107 | # actions=exit | |
108 | ffff 0010 00002320 0011 000000000000 | |
109 | ||
110 | # actions=dec_ttl | |
111 | ffff 0010 00002320 0012 000000000000 | |
112 | ||
113 | # actions=fin_timeout(idle_timeout=10,hard_timeout=20) | |
114 | ffff 0010 00002320 0013 000a 0014 0000 | |
115 | ||
116 | # actions=controller(reason=invalid_ttl,max_len=1234,id=5678) | |
117 | ffff 0010 00002320 0014 04d2 162e 02 00 | |
118 | ||
77ab5fd2 BP |
119 | # actions=controller(reason=invalid_ttl,max_len=1234,id=5678,userdata=01.02.03.04.05,pause) |
120 | ffff 0040 00002320 0025 000000000000 dnl | |
bdcad671 BP |
121 | 0000 0008 04d2 0000 dnl |
122 | 0001 0008 162e 0000 dnl | |
123 | 0002 0005 02 000000 dnl | |
77ab5fd2 BP |
124 | 0003 0009 0102030405 00000000000000 dnl |
125 | 0004 0004 00000000 | |
bdcad671 | 126 | |
c2d967a5 MM |
127 | # actions=dec_ttl(32768,12345,90,765,1024) |
128 | ffff 0020 00002320 0015 000500000000 80003039005A02fd 0400000000000000 | |
129 | ||
29089a54 RL |
130 | # actions=sample(probability=12345,collector_set_id=23456,obs_domain_id=34567,obs_point_id=45678) |
131 | ffff 0018 00002320 001d 3039 00005BA0 00008707 0000B26E | |
132 | ||
f69f713b BY |
133 | # actions=sample(probability=12345,collector_set_id=23456,obs_domain_id=34567,obs_point_id=45678,sampling_port=56789) |
134 | ffff 0020 00002320 0026 3039 00005BA0 00008707 0000B26E DDD50000 00000000 | |
135 | ||
4930ea56 BP |
136 | # actions=sample(probability=12345,collector_set_id=23456,obs_domain_id=34567,obs_point_id=45678,sampling_port=56789,egress) |
137 | ffff 0020 00002320 0029 3039 00005BA0 00008707 0000B26E DDD50200 00000000 | |
138 | ||
b153b990 BP |
139 | # bad OpenFlow10 actions: OFPBAC_BAD_LEN |
140 | & ofp_actions|WARN|OpenFlow action OFPAT_OUTPUT length 240 exceeds action buffer length 8 | |
141 | & ofp_actions|WARN|bad action at offset 0 (OFPBAC_BAD_LEN): | |
142 | & 00000000 00 00 00 f0 00 00 00 00- | |
143 | 00 00 00 f0 00 00 00 00 | |
144 | ||
145 | # bad OpenFlow10 actions: OFPBAC_BAD_LEN | |
146 | & ofp_actions|WARN|OpenFlow action OFPAT_OUTPUT length 16 not in valid range [[8,8]] | |
147 | & ofp_actions|WARN|bad action at offset 0 (OFPBAC_BAD_LEN): | |
148 | & 00000000 00 00 00 10 ff fe ff ff-00 00 00 00 00 00 00 00 | |
149 | 00 00 00 10 ff fe ff ff 00 00 00 00 00 00 00 00 | |
150 | ||
151 | # bad OpenFlow10 actions: OFPBAC_BAD_LEN | |
152 | & ofp_actions|WARN|OpenFlow action NXAST_DEC_TTL_CNT_IDS length 17 is not a multiple of 8 | |
153 | ffff 0011 00002320 0015 0001 00000000 0000000000000000 | |
154 | ||
13d2c689 BP |
155 | # bad OpenFlow10 actions: OFPBAC_BAD_OUT_PORT |
156 | 0000 0008 ffff 0000 | |
157 | ||
07659514 JS |
158 | # actions=ct() |
159 | ffff 0018 00002320 0023 0000 00000000 0000 FF 000000 0000 | |
160 | ||
161 | # actions=ct(commit) | |
162 | ffff 0018 00002320 0023 0001 00000000 0000 FF 000000 0000 | |
163 | ||
a76a37ef JR |
164 | # actions=ct(commit,force) |
165 | ffff 0018 00002320 0023 0003 00000000 0000 FF 000000 0000 | |
166 | ||
167 | # bad OpenFlow10 actions: OFPBAC_BAD_ARGUMENT | |
168 | ffff 0018 00002320 0023 0002 00000000 0000 FF 000000 0000 | |
169 | ||
07659514 JS |
170 | # actions=ct(table=10) |
171 | ffff 0018 00002320 0023 0000 00000000 0000 0A 000000 0000 | |
172 | ||
173 | # actions=ct(zone=10) | |
174 | ffff 0018 00002320 0023 0000 00000000 000A FF 000000 0000 | |
175 | ||
176 | # actions=ct(zone=NXM_NX_REG0[0..15]) | |
177 | ffff 0018 00002320 0023 0000 00010004 000F FF 000000 0000 | |
178 | ||
179 | dnl Can't read 8 bits from register into 16-bit zone. | |
180 | # bad OpenFlow10 actions: OFPBAC_BAD_SET_LEN | |
181 | ffff 0018 00002320 0023 0000 00010004 0007 FF 000000 0000 | |
182 | ||
183 | dnl Can't read 32 bits from register into 16-bit zone. | |
184 | # bad OpenFlow10 actions: OFPBAC_BAD_SET_LEN | |
185 | ffff 0018 00002320 0023 0000 00010004 001F FF 000000 0000 | |
186 | ||
8e53fe8c JS |
187 | # actions=ct(commit,exec(load:0xf009->NXM_NX_CT_MARK[])) |
188 | ffff 0030 00002320 0023 0001 00000000 0000 FF 000000 0000 dnl | |
189 | ffff 0018 00002320 0007 001f 0001d604 000000000000f009 | |
190 | ||
a76a37ef JR |
191 | # actions=ct(commit,force,exec(load:0xf009->NXM_NX_CT_MARK[])) |
192 | ffff 0030 00002320 0023 0003 00000000 0000 FF 000000 0000 dnl | |
193 | ffff 0018 00002320 0007 001f 0001d604 000000000000f009 | |
194 | ||
6bee8689 JR |
195 | # actions=ct(commit,exec(load:0->NXM_NX_CT_LABEL[64..127],load:0x1d->NXM_NX_CT_LABEL[0..63])) |
196 | ffff 0048 00002320 0023 0001 00000000 0000 FF 000000 0000 dnl | |
197 | ffff 0018 00002320 0007 103f 0001d810 0000 0000 0000 0000 dnl | |
198 | ffff 0018 00002320 0007 003f 0001d810 0000 0000 0000 001d | |
199 | ||
8e53fe8c JS |
200 | # bad OpenFlow10 actions: OFPBAC_BAD_SET_ARGUMENT |
201 | & ofp_actions|WARN|cannot set CT fields outside of ct action | |
202 | ffff 0018 00002320 0007 001f 0001d604 000000000000f009 | |
203 | ||
204 | # bad OpenFlow10 actions: OFPBAC_BAD_SET_ARGUMENT | |
205 | & meta_flow|WARN|destination field ct_zone is not writable | |
206 | ffff 0030 00002320 0023 0001 00000000 0000 FF 000000 0000 dnl | |
207 | ffff 0018 00002320 0007 000f 0001d504 000000000000f009 | |
208 | ||
209 | # bad OpenFlow10 actions: OFPBAC_BAD_ARGUMENT | |
210 | & ofp_actions|WARN|ct action doesn't support nested action ct | |
211 | ffff 0030 00002320 0023 0001 00000000 0000 FF 000000 0000 dnl | |
212 | ffff 0018 00002320 0023 0000 00000000 0000 FF 000000 0000 | |
213 | ||
214 | # bad OpenFlow10 actions: OFPBAC_BAD_ARGUMENT | |
215 | & ofp_actions|WARN|ct action doesn't support nested modification of reg0 | |
216 | ffff 0030 00002320 0023 0001 00000000 0000 FF 000000 0000 dnl | |
217 | ffff 0018 00002320 0007 001f 00010004 000000000000f009 | |
218 | ||
d787ad39 JS |
219 | # actions=ct(alg=ftp) |
220 | ffff 0018 00002320 0023 0000 00000000 0000 FF 000000 0015 | |
221 | ||
40c7b2fc JS |
222 | # actions=ct(alg=tftp) |
223 | ffff 0018 00002320 0023 0000 00000000 0000 FF 000000 0045 | |
224 | ||
9ac0aada JR |
225 | # actions=ct(commit,nat(src)) |
226 | ffff 0028 00002320 0023 0001 00000000 0000 FF 000000 0000 dnl | |
227 | ffff 0010 00002320 0024 00 00 0001 0000 | |
228 | ||
229 | # actions=ct(commit,nat(dst)) | |
230 | ffff 0028 00002320 0023 0001 00000000 0000 FF 000000 0000 dnl | |
231 | ffff 0010 00002320 0024 00 00 0002 0000 | |
232 | ||
233 | # actions=ct(nat) | |
234 | ffff 0028 00002320 0023 0000 00000000 0000 FF 000000 0000 dnl | |
235 | ffff 0010 00002320 0024 00 00 0000 0000 | |
236 | ||
237 | # actions=ct(commit,nat(src=10.0.0.240,random)) | |
238 | ffff 0030 00002320 0023 0001 00000000 0000 FF 000000 0000 dnl | |
239 | ffff 0018 00002320 0024 00 00 0011 0001 0a0000f0 00000000 | |
240 | ||
241 | # actions=ct(commit,nat(src=10.0.0.240:32768-65535,random)) | |
242 | ffff 0030 00002320 0023 0001 00000000 0000 FF 000000 0000 dnl | |
243 | ffff 0018 00002320 0024 00 00 0011 0031 0a0000f0 8000ffff | |
244 | ||
245 | # actions=ct(commit,nat(dst=10.0.0.128-10.0.0.254,hash)) | |
246 | ffff 0030 00002320 0023 0001 00000000 0000 FF 000000 0000 dnl | |
247 | ffff 0018 00002320 0024 00 00 000a 0003 0a000080 0a0000fe | |
248 | ||
249 | # actions=ct(commit,nat(src=10.0.0.240-10.0.0.254:32768-65535,persistent)) | |
250 | ffff 0038 00002320 0023 0001 00000000 0000 FF 000000 0000 dnl | |
251 | ffff 0020 00002320 0024 00 00 0005 0033 0a0000f0 0a0000fe 8000ffff 00000000 | |
252 | ||
253 | # actions=ct(commit,nat(src=fe80::20c:29ff:fe88:a18b,random)) | |
254 | ffff 0038 00002320 0023 0001 00000000 0000 FF 000000 0000 dnl | |
255 | ffff 0020 00002320 0024 00 00 0011 0004 fe800000 00000000 020c 29ff fe88 a18b | |
256 | ||
257 | # actions=ct(commit,nat(src=fe80::20c:29ff:fe88:1-fe80::20c:29ff:fe88:a18b,random)) | |
258 | ffff 0048 00002320 0023 0001 00000000 0000 FF 000000 0000 dnl | |
259 | ffff 0030 00002320 0024 00 00 0011 000c fe800000 00000000 020c 29ff fe88 0001 fe800000 00000000 020c 29ff fe88 a18b | |
260 | ||
261 | # actions=ct(commit,nat(src=[fe80::20c:29ff:fe88:1]-[fe80::20c:29ff:fe88:a18b]:255-4096,random)) | |
262 | ffff 0050 00002320 0023 0001 00000000 0000 FF 000000 0000 dnl | |
263 | ffff 0038 00002320 0024 00 00 0011 003c dnl | |
264 | fe800000 00000000 020c 29ff fe88 0001 dnl | |
265 | fe800000 00000000 020c 29ff fe88 a18b dnl | |
266 | 00ff1000 00000000 | |
267 | ||
72fe7578 BP |
268 | # actions=ct_clear |
269 | ffff 0010 00002320 002b 000000000000 | |
270 | ||
aaca4fe0 WT |
271 | # actions=output(port=1,max_len=100) |
272 | ffff 0010 00002320 0027 0001 00000064 | |
273 | ||
7ae62a67 WT |
274 | # actions=clone(mod_vlan_vid:5,output:10) |
275 | ffff 0020 00002320 002a 000000000000 dnl | |
276 | 0001 0008 0005 0000 dnl | |
277 | 0000 0008 000a 0000 | |
278 | ||
a9fedc78 JS |
279 | # actions=learn(table=2,priority=0,NXM_OF_VLAN_TCI[0..11],NXM_OF_ETH_DST[]=NXM_OF_ETH_SRC[],output:NXM_OF_IN_PORT[]) |
280 | ffff 0050 00002320 002d 0000 0000 0000 0000000000000000 0000 02 00 0000 0000 00000000 0000 0000 dnl | |
281 | 000c 00000802 0000 00000802 0000 dnl | |
282 | 0030 00000406 0000 00000206 0000 dnl | |
283 | 1010 00000002 0000 dnl | |
284 | 00000000 | |
285 | ||
4c71600d DDP |
286 | # actions=learn(table=2,idle_timeout=10,hard_timeout=20,fin_idle_timeout=2,fin_hard_timeout=4,priority=80,cookie=0x123456789abcdef0,limit=1,NXM_OF_VLAN_TCI[0..11],NXM_OF_ETH_DST[]=NXM_OF_ETH_SRC[],output:NXM_OF_IN_PORT[]) |
287 | ffff 0050 00002320 002d 000a 0014 0050 123456789abcdef0 0000 02 00 0002 0004 00000001 0000 0000 dnl | |
288 | 000c 00000802 0000 00000802 0000 dnl | |
289 | 0030 00000406 0000 00000206 0000 dnl | |
290 | 1010 00000002 0000 dnl | |
291 | 00000000 | |
292 | ||
293 | # actions=learn(table=2,idle_timeout=10,hard_timeout=20,fin_idle_timeout=2,fin_hard_timeout=4,priority=80,cookie=0x123456789abcdef0,limit=1,result_dst=NXM_NX_REG0[8],NXM_OF_VLAN_TCI[0..11],NXM_OF_ETH_DST[]=NXM_OF_ETH_SRC[],output:NXM_OF_IN_PORT[]) | |
294 | ffff 0050 00002320 002d 000a 0014 0050 123456789abcdef0 0004 02 00 0002 0004 00000001 0008 0000 dnl | |
295 | 00010004 dnl | |
296 | 000c 00000802 0000 00000802 0000 dnl | |
297 | 0030 00000406 0000 00000206 0000 dnl | |
298 | 1010 00000002 0000 | |
299 | ||
88c8ca26 BP |
300 | # actions=group:5 |
301 | ffff 0010 00002320 0028 0000 00000005 | |
302 | ||
77ab5fd2 BP |
303 | # bad OpenFlow10 actions: NXBRC_MUST_BE_ZERO |
304 | ffff 0018 00002320 0025 0000 0005 0000 1122334455 000005 | |
305 | ||
306 | # bad OpenFlow10 actions: NXBRC_MUST_BE_ZERO | |
307 | ffff 0018 00002320 0025 0000 0005 5000 1122334455 000000 | |
308 | ||
9ac0aada JR |
309 | # bad OpenFlow10 actions: OFPBAC_BAD_ARGUMENT |
310 | ffff 0048 00002320 0023 0001 00000000 0000 FF 000000 0000 dnl | |
311 | ffff 0030 00002320 0024 00 00 0011 000c fe800000 00000000 020c 29ff fe88 a18b fe800000 00000000 020c 29ff fe88 0001 | |
312 | ||
5b34f8fc NS |
313 | # actions=check_pkt_larger(1500)->NXM_NX_REG0[0] |
314 | ffff 0018 00002320 0031 05dc 000000010004000000000000 | |
315 | ||
316 | # actions=check_pkt_larger(1000)->NXM_NX_XXREG1[4] | |
317 | ffff 0018 00002320 0031 03e8 00040001e010000000000000 | |
318 | ||
81f71381 YHW |
319 | # actions=delete_field:tun_metadata10 |
320 | ffff 0018 00002320 0032 00 01 64 7c 00 00 00 00 000000000000 | |
321 | ||
f25d0cf3 BP |
322 | ]) |
323 | sed '/^[[#&]]/d' < test-data > input.txt | |
324 | sed -n 's/^# //p; /^$/p' < test-data > expout | |
325 | sed -n 's/^& //p' < test-data > experr | |
326 | AT_CAPTURE_FILE([input.txt]) | |
327 | AT_CAPTURE_FILE([expout]) | |
328 | AT_CAPTURE_FILE([experr]) | |
329 | AT_CHECK( | |
65a8a59e | 330 | [ovs-ofctl '-vPATTERN:console:%c|%p|%m' parse-actions OpenFlow10 < input.txt], |
f25d0cf3 BP |
331 | [0], [expout], [experr]) |
332 | AT_CLEANUP | |
d01c980f | 333 | |
8f2cded4 BP |
334 | AT_SETUP([OpenFlow 1.0 "instruction" translations]) |
335 | AT_KEYWORDS([ofp-actions OF1.0 instruction]) | |
336 | AT_DATA([test-data], [dnl | |
337 | dnl Try a couple of ordinary actions to make sure they're accepted, | |
338 | dnl but there's no point in retrying all the actions from the previous test. | |
339 | # actions=LOCAL | |
340 | 0000 0008 fffe 04d2 | |
341 | ||
342 | # actions=mod_dl_src:00:11:22:33:44:55 | |
343 | 0004 0010 001122334455 000000000000 | |
344 | ||
345 | dnl Now check that write_metadata is accepted. | |
346 | # actions=write_metadata:0xfedcba9876543210 | |
347 | ffff 0020 00002320 0016 000000000000 fedcba9876543210 ffffffffffffffff | |
348 | ||
349 | # actions=write_metadata:0xfedcba9876543210/0xffff0000ffff0000 | |
350 | ffff 0020 00002320 0016 000000000000 fedcba9876543210 ffff0000ffff0000 | |
351 | ||
352 | ]) | |
353 | sed '/^[[#&]]/d' < test-data > input.txt | |
354 | sed -n 's/^# //p; /^$/p' < test-data > expout | |
355 | sed -n 's/^& //p' < test-data > experr | |
356 | AT_CAPTURE_FILE([input.txt]) | |
357 | AT_CAPTURE_FILE([expout]) | |
358 | AT_CAPTURE_FILE([experr]) | |
359 | AT_CHECK( | |
65a8a59e | 360 | [ovs-ofctl '-vPATTERN:console:%c|%p|%m' parse-instructions OpenFlow10 < input.txt], |
8f2cded4 BP |
361 | [0], [expout], [experr]) |
362 | AT_CLEANUP | |
363 | ||
d01c980f | 364 | AT_SETUP([OpenFlow 1.1 action translation]) |
4cceacb9 | 365 | AT_KEYWORDS([ofp-actions OF1.1]) |
d01c980f BP |
366 | AT_DATA([test-data], [dnl |
367 | # actions=LOCAL | |
368 | 0000 0010 fffffffe 04d2 000000000000 | |
369 | ||
370 | # actions=CONTROLLER:1234 | |
371 | 0000 0010 fffffffd 04d2 000000000000 | |
372 | ||
ca287d20 | 373 | # actions=set_vlan_vid:9 |
d01c980f BP |
374 | 0001 0008 0009 0000 |
375 | ||
ca287d20 | 376 | # actions=set_vlan_pcp:6 |
d01c980f BP |
377 | 0002 0008 06 000000 |
378 | ||
379 | # actions=mod_dl_src:00:11:22:33:44:55 | |
380 | 0003 0010 001122334455 000000000000 | |
381 | ||
382 | # actions=mod_dl_dst:10:20:30:40:50:60 | |
383 | 0004 0010 102030405060 000000000000 | |
384 | ||
385 | # actions=mod_nw_src:1.2.3.4 | |
386 | 0005 0008 01020304 | |
387 | ||
388 | # actions=mod_nw_dst:192.168.0.1 | |
389 | 0006 0008 c0a80001 | |
390 | ||
391 | # actions=mod_nw_tos:48 | |
392 | 0007 0008 30 000000 | |
393 | ||
4b684612 BP |
394 | # actions=mod_nw_ecn:2 |
395 | 0008 0008 02 000000 | |
396 | ||
d01c980f BP |
397 | # actions=mod_tp_src:80 |
398 | 0009 0008 0050 0000 | |
399 | ||
400 | # actions=mod_tp_dst:443 | |
401 | 000a 0008 01bb 0000 | |
402 | ||
64fcc073 | 403 | # actions=pop_vlan |
8e61c110 IY |
404 | 0012 0008 00000000 |
405 | ||
276c4e7a SH |
406 | # actions=set_queue:2309737729 |
407 | 0015 0008 89abcd01 | |
408 | ||
3e34fbdd IY |
409 | dnl 802.1ad isn't supported at the moment |
410 | dnl # actions=push_vlan:0x88a8 | |
411 | dnl 0011 0008 88a8 0000 | |
412 | # actions=push_vlan:0x8100 | |
413 | 0011 0008 8100 0000 | |
414 | ||
d01c980f BP |
415 | # actions=resubmit:5 |
416 | ffff 0010 00002320 0001 0005 00000000 | |
417 | ||
418 | # actions=set_tunnel:0x12345678 | |
419 | ffff 0010 00002320 0002 0000 12345678 | |
420 | ||
d01c980f BP |
421 | # actions=pop_queue |
422 | ffff 0010 00002320 0005 000000000000 | |
423 | ||
424 | # actions=move:NXM_OF_IN_PORT[]->NXM_OF_VLAN_TCI[] | |
425 | ffff 0018 00002320 0006 0010 0000 0000 00000002 00000802 | |
426 | ||
427 | # actions=load:0xf009->NXM_OF_VLAN_TCI[] | |
428 | ffff 0018 00002320 0007 000f 00000802 000000000000f009 | |
429 | ||
430 | # actions=note:11.e9.9a.ad.67.f3 | |
431 | ffff 0010 00002320 0008 11e99aad67f3 | |
432 | ||
433 | # actions=set_tunnel64:0xc426384d49c53d60 | |
434 | ffff 0018 00002320 0009 000000000000 c426384d49c53d60 | |
435 | ||
436 | # actions=set_tunnel64:0x885f3298 | |
437 | ffff 0018 00002320 0009 000000000000 00000000885f3298 | |
438 | ||
8f2cded4 BP |
439 | dnl Write-Metadata is only allowed in contexts that allow instructions. |
440 | & ofp_actions|WARN|write_metadata instruction not allowed here | |
65a8a59e | 441 | # bad OpenFlow11 actions: OFPBIC_UNSUP_INST |
4cceacb9 JS |
442 | ffff 0020 00002320 0016 000000000000 fedcba9876543210 ffffffffffffffff |
443 | ||
d01c980f BP |
444 | # actions=multipath(eth_src,50,modulo_n,1,0,NXM_NX_REG0[]) |
445 | ffff 0020 00002320 000a 0000 0032 0000 0000 0000 0000 0000 0000 001f 00010004 | |
446 | ||
91fc374a | 447 | # actions=bundle(eth_src,0,hrw,ofport,members:4,8) |
d01c980f BP |
448 | ffff 0028 00002320 000c 0001 0000 0000 00000002 0002 0000 00000000 00000000 dnl |
449 | 0004 0008 00000000 | |
450 | ||
91fc374a | 451 | # actions=bundle_load(eth_src,0,hrw,ofport,NXM_NX_REG0[],members:4,8) |
d01c980f BP |
452 | ffff 0028 00002320 000d 0001 0000 0000 00000002 0002 001f 00010004 00000000 dnl |
453 | 0004 0008 00000000 | |
454 | ||
455 | # actions=resubmit(10,5) | |
456 | ffff 0010 00002320 000e 000a 05 000000 | |
457 | ||
2cd20955 JR |
458 | # actions=resubmit(10,5,ct) |
459 | ffff 0010 00002320 002c 000a 05 000000 | |
460 | ||
d01c980f BP |
461 | # actions=output:NXM_NX_REG1[5..10] |
462 | ffff 0018 00002320 000f 0145 00010204 ffff 000000000000 | |
463 | ||
464 | # 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[]) | |
465 | ffff 0048 00002320 0010 000a 0014 0050 123456789abcdef0 0000 02 00 0002 0004 dnl | |
466 | 000c 00000802 0000 00000802 0000 dnl | |
467 | 0030 00000406 0000 00000206 0000 dnl | |
468 | 1010 00000002 0000 dnl | |
469 | 00000000 | |
470 | ||
471 | # actions=exit | |
472 | ffff 0010 00002320 0011 000000000000 | |
473 | ||
7bcb1506 IY |
474 | dnl OpenFlow 1.1 OFPAT_DEC_TTL |
475 | # actions=dec_ttl | |
476 | 0018 0008 00000000 | |
477 | ||
d01c980f BP |
478 | # actions=fin_timeout(idle_timeout=10,hard_timeout=20) |
479 | ffff 0010 00002320 0013 000a 0014 0000 | |
480 | ||
481 | # actions=controller(reason=invalid_ttl,max_len=1234,id=5678) | |
482 | ffff 0010 00002320 0014 04d2 162e 02 00 | |
483 | ||
c2d967a5 MM |
484 | # actions=dec_ttl(32768,12345,90,765,1024) |
485 | ffff 0020 00002320 0015 000500000000 80003039005A02fd 0400000000000000 | |
486 | ||
29089a54 RL |
487 | # actions=sample(probability=12345,collector_set_id=23456,obs_domain_id=34567,obs_point_id=45678) |
488 | ffff 0018 00002320 001d 3039 00005BA0 00008707 0000B26E | |
489 | ||
13d2c689 BP |
490 | # bad OpenFlow11 actions: OFPBAC_BAD_OUT_PORT |
491 | & ofp_actions|WARN|bad action at offset 0 (OFPBAC_BAD_OUT_PORT): | |
492 | & 00000000 00 00 00 10 ff ff ff ff-00 00 00 00 00 00 00 00 | |
493 | 0000 0010 ffffffff 0000 000000000000 | |
494 | ||
d01c980f BP |
495 | ]) |
496 | sed '/^[[#&]]/d' < test-data > input.txt | |
497 | sed -n 's/^# //p; /^$/p' < test-data > expout | |
498 | sed -n 's/^& //p' < test-data > experr | |
499 | AT_CAPTURE_FILE([input.txt]) | |
500 | AT_CAPTURE_FILE([expout]) | |
501 | AT_CAPTURE_FILE([experr]) | |
502 | AT_CHECK( | |
65a8a59e | 503 | [ovs-ofctl '-vPATTERN:console:%c|%p|%m' parse-actions OpenFlow11 < input.txt], |
d01c980f BP |
504 | [0], [expout], [experr]) |
505 | AT_CLEANUP | |
506 | ||
507 | AT_SETUP([OpenFlow 1.1 instruction translation]) | |
4cceacb9 | 508 | AT_KEYWORDS([OF1.1 instruction ofp-actions]) |
d01c980f BP |
509 | AT_DATA([test-data], [dnl |
510 | # actions=LOCAL | |
511 | 0004 0018 00000000 dnl | |
512 | 0000 0010 fffffffe 04d2 000000000000 | |
513 | ||
8dd54666 IY |
514 | dnl Apply-Actions non-zero padding |
515 | # actions=drop | |
516 | # 0: 00 -> (none) | |
517 | # 1: 04 -> (none) | |
518 | # 2: 00 -> (none) | |
519 | # 3: 08 -> (none) | |
520 | # 4: 00 -> (none) | |
521 | # 5: 00 -> (none) | |
522 | # 6: 00 -> (none) | |
523 | # 7: 01 -> (none) | |
524 | 0004 0008 00000001 | |
525 | ||
d01c980f BP |
526 | dnl Check that an empty Apply-Actions instruction gets dropped. |
527 | # actions=drop | |
528 | # 0: 00 -> (none) | |
529 | # 1: 04 -> (none) | |
530 | # 2: 00 -> (none) | |
531 | # 3: 08 -> (none) | |
532 | # 4: 00 -> (none) | |
533 | # 5: 00 -> (none) | |
534 | # 6: 00 -> (none) | |
535 | # 7: 00 -> (none) | |
536 | 0004 0008 00000000 | |
537 | ||
e38c9de5 | 538 | dnl Duplicate instruction type: |
65a8a59e | 539 | # bad OpenFlow11 instructions: OFPBIC_DUP_INST |
d01c980f BP |
540 | 0004 0008 00000000 0004 0008 00000000 |
541 | ||
542 | dnl Instructions not multiple of 8 in length. | |
543 | & ofp_actions|WARN|OpenFlow message instructions length 9 is not a multiple of 8 | |
65a8a59e | 544 | # bad OpenFlow11 instructions: OFPBIC_BAD_LEN |
d01c980f BP |
545 | 0004 0009 01 00000000 |
546 | ||
547 | dnl Goto-Table instruction too long. | |
65a8a59e | 548 | # bad OpenFlow11 instructions: OFPBIC_BAD_LEN |
d01c980f BP |
549 | 0001 0010 01 000000 0000000000000000 |
550 | ||
8dd54666 IY |
551 | dnl Goto-Table 1 instruction non-zero padding |
552 | # actions=goto_table:1 | |
553 | # 7: 01 -> 00 | |
554 | 0001 0008 01 000001 | |
555 | ||
bff7eeb6 | 556 | dnl Goto-Table 1 instruction go back to the previous table. |
8c87971e | 557 | # bad OpenFlow11 instructions: OFPBIC_BAD_TABLE_ID |
bff7eeb6 JA |
558 | 2,0001 0008 01 000000 |
559 | ||
8dd54666 IY |
560 | dnl Goto-Table 1 |
561 | # actions=goto_table:1 | |
d01c980f BP |
562 | 0001 0008 01 000000 |
563 | ||
4cceacb9 JS |
564 | dnl Write-Metadata. |
565 | # actions=write_metadata:0xfedcba9876543210 | |
d01c980f BP |
566 | 0002 0018 00000000 fedcba9876543210 ffffffffffffffff |
567 | ||
8f2cded4 BP |
568 | dnl Write-Metadata as Nicira extension action is transformed into instruction. |
569 | # actions=write_metadata:0xfedcba9876543210 | |
570 | # 1: 04 -> 02 | |
571 | # 3: 28 -> 18 | |
572 | # 8: ff -> fe | |
573 | # 9: ff -> dc | |
574 | # 10: 00 -> ba | |
575 | # 11: 20 -> 98 | |
576 | # 12: 00 -> 76 | |
577 | # 13: 00 -> 54 | |
578 | # 14: 23 -> 32 | |
579 | # 15: 20 -> 10 | |
580 | # 16: 00 -> ff | |
581 | # 17: 16 -> ff | |
582 | # 18: 00 -> ff | |
583 | # 19: 00 -> ff | |
584 | # 20: 00 -> ff | |
585 | # 21: 00 -> ff | |
586 | # 22: 00 -> ff | |
587 | # 23: 00 -> ff | |
588 | # 24: fe -> (none) | |
589 | # 25: dc -> (none) | |
590 | # 26: ba -> (none) | |
591 | # 27: 98 -> (none) | |
592 | # 28: 76 -> (none) | |
593 | # 29: 54 -> (none) | |
594 | # 30: 32 -> (none) | |
595 | # 31: 10 -> (none) | |
596 | # 32: ff -> (none) | |
597 | # 33: ff -> (none) | |
598 | # 34: ff -> (none) | |
599 | # 35: ff -> (none) | |
600 | # 36: ff -> (none) | |
601 | # 37: ff -> (none) | |
602 | # 38: ff -> (none) | |
603 | # 39: ff -> (none) | |
604 | 0004 0028 00000000 ffff 0020 00002320 0016 000000000000 fedcba9876543210 ffffffffffffffff | |
605 | ||
4cceacb9 JS |
606 | dnl Write-Metadata with mask. |
607 | # actions=write_metadata:0xfedcba9876543210/0xff00ff00ff00ff00 | |
608 | 0002 0018 00000000 fedcba9876543210 ff00ff00ff00ff00 | |
609 | ||
d01c980f | 610 | dnl Write-Metadata too short. |
65a8a59e | 611 | # bad OpenFlow11 instructions: OFPBIC_BAD_LEN |
d01c980f BP |
612 | 0002 0010 00000000 fedcba9876543210 |
613 | ||
614 | dnl Write-Metadata too long. | |
65a8a59e | 615 | # bad OpenFlow11 instructions: OFPBIC_BAD_LEN |
d01c980f BP |
616 | 0002 0020 00000000 fedcba9876543210 ffffffffffffffff 0000000000000000 |
617 | ||
4cceacb9 | 618 | dnl Write-Metadata duplicated. |
65a8a59e | 619 | # bad OpenFlow11 instructions: OFPBIC_DUP_INST |
4cceacb9 JS |
620 | 0002 0018 00000000 fedcba9876543210 ff00ff00ff00ff00 0002 0018 00000000 fedcba9876543210 ff00ff00ff00ff00 |
621 | ||
6813ee7c BP |
622 | dnl Write-Metadata in wrong position (OpenFlow 1.1+ disregards the order |
623 | dnl and OVS reorders it to the canonical order) | |
624 | # actions=write_metadata:0xfedcba9876543210,goto_table:1 | |
625 | # 1: 01 -> 02 | |
626 | # 3: 08 -> 18 | |
627 | # 4: 01 -> 00 | |
628 | # 8: 00 -> fe | |
629 | # 9: 02 -> dc | |
630 | # 10: 00 -> ba | |
631 | # 11: 18 -> 98 | |
632 | # 12: 00 -> 76 | |
633 | # 13: 00 -> 54 | |
634 | # 14: 00 -> 32 | |
635 | # 15: 00 -> 10 | |
636 | # 16: fe -> ff | |
637 | # 17: dc -> ff | |
638 | # 18: ba -> ff | |
639 | # 19: 98 -> ff | |
640 | # 20: 76 -> ff | |
641 | # 21: 54 -> ff | |
642 | # 22: 32 -> ff | |
643 | # 23: 10 -> ff | |
644 | # 24: ff -> 00 | |
645 | # 25: ff -> 01 | |
646 | # 26: ff -> 00 | |
647 | # 27: ff -> 08 | |
648 | # 28: ff -> 01 | |
649 | # 29: ff -> 00 | |
650 | # 30: ff -> 00 | |
651 | # 31: ff -> 00 | |
4cceacb9 JS |
652 | 0001 0008 01 000000 0002 0018 00000000 fedcba9876543210 ffffffffffffffff |
653 | ||
7fdb60a7 SH |
654 | dnl empty Write-Actions non-zero padding |
655 | # actions=write_actions(drop) | |
656 | # 0: 00 -> (none) | |
657 | # 1: 03 -> (none) | |
658 | # 2: 00 -> (none) | |
659 | # 3: 08 -> (none) | |
660 | # 4: 00 -> (none) | |
661 | # 5: 00 -> (none) | |
662 | # 6: 00 -> (none) | |
663 | # 7: 01 -> (none) | |
664 | 0003 0008 00000001 | |
665 | ||
666 | dnl Check that an empty Write-Actions instruction gets dropped. | |
667 | # actions=write_actions(drop) | |
668 | # 0: 00 -> (none) | |
669 | # 1: 03 -> (none) | |
670 | # 2: 00 -> (none) | |
671 | # 3: 08 -> (none) | |
672 | # 4: 00 -> (none) | |
673 | # 5: 00 -> (none) | |
674 | # 6: 00 -> (none) | |
675 | # 7: 00 -> (none) | |
676 | 0003 0008 00000000 | |
d01c980f | 677 | |
b19e8793 | 678 | dnl Clear-Actions too-long |
65a8a59e | 679 | # bad OpenFlow11 instructions: OFPBIC_BAD_LEN |
b19e8793 IY |
680 | 0005 0010 00000000 0000000000000000 |
681 | ||
682 | dnl Clear-Actions non-zero padding | |
683 | # actions=clear_actions | |
684 | # 7: 01 -> 00 | |
685 | 0005 0008 00000001 | |
686 | ||
687 | dnl Clear-Actions non-zero padding | |
688 | # actions=clear_actions | |
689 | # 4: 01 -> 00 | |
d01c980f BP |
690 | 0005 0008 01 000000 |
691 | ||
b19e8793 IY |
692 | dnl Clear-Actions |
693 | # actions=clear_actions | |
694 | 0005 0008 00000000 | |
695 | ||
d01c980f | 696 | dnl Experimenter actions not supported yet. |
65a8a59e | 697 | # bad OpenFlow11 instructions: OFPBIC_BAD_EXPERIMENTER |
d01c980f BP |
698 | ffff 0008 01 000000 |
699 | ||
700 | dnl Bad instruction number (0 not assigned). | |
65a8a59e | 701 | # bad OpenFlow11 instructions: OFPBIC_UNKNOWN_INST |
d01c980f BP |
702 | 0000 0008 01 000000 |
703 | ||
704 | ]) | |
705 | sed '/^[[#&]]/d' < test-data > input.txt | |
706 | sed -n 's/^# //p; /^$/p' < test-data > expout | |
707 | sed -n 's/^& //p' < test-data > experr | |
708 | AT_CAPTURE_FILE([input.txt]) | |
709 | AT_CAPTURE_FILE([expout]) | |
710 | AT_CAPTURE_FILE([experr]) | |
711 | AT_CHECK( | |
65a8a59e | 712 | [ovs-ofctl '-vPATTERN:console:%c|%p|%m' parse-instructions OpenFlow11 < input.txt], |
d01c980f BP |
713 | [0], [expout], [experr]) |
714 | AT_CLEANUP | |
94baabf7 | 715 | |
178742f9 BP |
716 | dnl Our primary goal here is to verify OpenFlow 1.2-specific changes, |
717 | dnl so the list of tests is short. | |
718 | AT_SETUP([OpenFlow 1.2 action translation]) | |
719 | AT_KEYWORDS([ofp-actions OF1.2]) | |
720 | AT_DATA([test-data], [dnl | |
721 | # actions=LOCAL | |
722 | 0000 0010 fffffffe 04d2 000000000000 | |
723 | ||
724 | # bad OpenFlow12 actions: OFPBAC_BAD_SET_MASK | |
725 | & ofp_actions|WARN|bad action at offset 0 (OFPBAC_BAD_SET_MASK): | |
726 | & 00000000 00 19 00 18 80 00 09 0c-00 00 00 00 12 34 00 00 | |
727 | & 00000010 00 00 ff ff 00 00 00 00- | |
728 | 0019 0018 8000090c 000000001234 00000000ffff 00000000 | |
729 | ||
730 | ]) | |
731 | sed '/^[[#&]]/d' < test-data > input.txt | |
732 | sed -n 's/^# //p; /^$/p' < test-data > expout | |
733 | sed -n 's/^& //p' < test-data > experr | |
734 | AT_CAPTURE_FILE([input.txt]) | |
735 | AT_CAPTURE_FILE([expout]) | |
736 | AT_CAPTURE_FILE([experr]) | |
737 | AT_CHECK( | |
738 | [ovs-ofctl '-vPATTERN:console:%c|%p|%m' parse-actions OpenFlow12 < input.txt], | |
739 | [0], [expout], [experr]) | |
740 | AT_CLEANUP | |
741 | ||
914624f8 BP |
742 | dnl Our primary goal here is to verify OpenFlow 1.3-specific changes, |
743 | dnl so the list of tests is short. | |
744 | AT_SETUP([OpenFlow 1.3 action translation]) | |
745 | AT_KEYWORDS([ofp-actions OF1.3]) | |
746 | AT_DATA([test-data], [dnl | |
747 | # actions=LOCAL | |
748 | 0000 0010 fffffffe 04d2 000000000000 | |
749 | ||
750 | dnl Check the Nicira extension form of "move". | |
751 | # actions=move:NXM_OF_IN_PORT[]->NXM_OF_VLAN_TCI[] | |
752 | ffff 0018 00002320 0006 0010 0000 0000 00000002 00000802 | |
753 | ||
754 | dnl Check the ONF extension form of "copy_field". | |
755 | # actions=move:NXM_OF_IN_PORT[]->NXM_OF_VLAN_TCI[] | |
756 | ffff 0020 4f4e4600 0c80 0000 0010 0000 0000 0000 00000002 00000802 00000000 | |
757 | ||
731dbbbe | 758 | dnl Check OpenFlow v1.3.4 Conformance Test: 430.500. |
759 | # bad OpenFlow13 actions: OFPBAC_BAD_SET_TYPE | |
760 | & ofp_actions|WARN|bad action at offset 0 (OFPBAC_BAD_SET_TYPE): | |
761 | & 00000000 00 19 00 08 80 00 fe 00-00 00 00 10 00 00 00 01 | |
762 | & 00000010 00 00 00 00 00 00 00 00- | |
763 | 0019 0008 8000fe00 000000100000 000100000000 00000000 | |
764 | ||
765 | dnl Check OpenFlow v1.3.4 Conformance Test: 430.510. | |
766 | # bad OpenFlow13 actions: OFPBAC_BAD_SET_LEN | |
767 | & ofp_actions|WARN|bad action at offset 0 (OFPBAC_BAD_SET_LEN): | |
768 | & 00000000 00 19 00 10 80 00 08 07-00 01 02 03 04 05 00 00 | |
769 | & 00000010 00 00 00 10 00 00 00 01- | |
770 | 0019 0010 80000807 000102030405 000000000010 00000001 | |
771 | ||
51dec40f IM |
772 | dnl Check NSH encap (experimenter extension). |
773 | # actions=encap(nsh(md_type=1)) | |
774 | ffff 0018 00002320 002e 0000 0001894f 0004 01 05 01 000000 | |
775 | ||
776 | dnl NSH encap with non-zero padding. | |
777 | # actions=encap(nsh(md_type=1)) | |
778 | # 21: 12 -> 00 | |
779 | # 22: 34 -> 00 | |
780 | # 23: 56 -> 00 | |
781 | ffff 0018 00002320 002e 0000 0001894f 0004 01 05 01 123456 | |
782 | ||
914624f8 BP |
783 | ]) |
784 | sed '/^[[#&]]/d' < test-data > input.txt | |
785 | sed -n 's/^# //p; /^$/p' < test-data > expout | |
786 | sed -n 's/^& //p' < test-data > experr | |
787 | AT_CAPTURE_FILE([input.txt]) | |
788 | AT_CAPTURE_FILE([expout]) | |
789 | AT_CAPTURE_FILE([experr]) | |
790 | AT_CHECK( | |
791 | [ovs-ofctl '-vPATTERN:console:%c|%p|%m' parse-actions OpenFlow13 < input.txt], | |
792 | [0], [expout], [experr]) | |
793 | AT_CLEANUP | |
794 | ||
da4425c7 BP |
795 | dnl Our primary goal here is to verify that OpenFlow 1.5-specific changes, |
796 | dnl so the list of tests is short. | |
73178f20 BP |
797 | AT_SETUP([OpenFlow 1.5 action translation]) |
798 | AT_KEYWORDS([ofp-actions OF1.5]) | |
799 | AT_DATA([test-data], [dnl | |
800 | # actions=LOCAL | |
801 | 0000 0010 fffffffe 04d2 000000000000 | |
802 | ||
803 | # actions=move:NXM_OF_IN_PORT[]->NXM_OF_VLAN_TCI[] | |
650763d8 | 804 | 001c 0018 0010 0000 0000 0000 00000002 00000802 00000000 |
73178f20 | 805 | |
7eb4b1f1 | 806 | # actions=set_field:00:00:00:00:12:34/00:00:00:00:ff:ff->eth_src |
178742f9 | 807 | 0019 0018 8000090c 000000001234 00000000ffff 00000000 |
da4425c7 | 808 | |
4332b671 BP |
809 | # actions=meter:5 |
810 | 001d 0008 00000005 | |
811 | ||
73178f20 BP |
812 | ]) |
813 | sed '/^[[#&]]/d' < test-data > input.txt | |
814 | sed -n 's/^# //p; /^$/p' < test-data > expout | |
815 | sed -n 's/^& //p' < test-data > experr | |
816 | AT_CAPTURE_FILE([input.txt]) | |
817 | AT_CAPTURE_FILE([expout]) | |
818 | AT_CAPTURE_FILE([experr]) | |
819 | AT_CHECK( | |
820 | [ovs-ofctl '-vPATTERN:console:%c|%p|%m' parse-actions OpenFlow15 < input.txt], | |
821 | [0], [expout], [experr]) | |
822 | AT_CLEANUP | |
823 | ||
94baabf7 SH |
824 | AT_SETUP([ofp-actions - inconsistent MPLS actions]) |
825 | OVS_VSWITCHD_START | |
826 | dnl OK: Use fin_timeout action on TCP flow | |
827 | AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn add-flow br0 'tcp actions=fin_timeout(idle_timeout=1)']) | |
828 | dnl Bad: Use fin_timeout action on TCP flow that has been converted to MPLS | |
829 | AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn add-flow br0 'tcp actions=push_mpls:0x8847,fin_timeout(idle_timeout=1)'], | |
830 | [1], [], [dnl | |
ba2fe8e9 | 831 | ovs-ofctl: none of the usable flow formats (OpenFlow10,NXM) is among the allowed flow formats (OpenFlow11) |
94baabf7 SH |
832 | ]) |
833 | OVS_VSWITCHD_STOP | |
834 | AT_CLEANUP | |
fa078489 BP |
835 | |
836 | AT_SETUP([reg_load <-> set_field translation corner case]) | |
837 | AT_KEYWORDS([ofp-actions]) | |
838 | OVS_VSWITCHD_START | |
839 | dnl In OpenFlow 1.3, set_field always sets all the bits in the field, | |
840 | dnl but when we translate to NXAST_LOAD we need to only set the bits that | |
841 | dnl actually exist (e.g. mpls_label only has 20 bits) otherwise OVS rejects | |
842 | dnl the "load" action as invalid. Check that we do this correctly. | |
843 | AT_CHECK([ovs-ofctl -O OpenFlow13 add-flow br0 mpls,actions=set_field:10-\>mpls_label]) | |
844 | AT_CHECK([ovs-ofctl -O OpenFlow10 dump-flows br0 | ofctl_strip], [0], [dnl | |
845 | NXST_FLOW reply: | |
846 | mpls actions=load:0xa->OXM_OF_MPLS_LABEL[[]] | |
847 | ]) | |
848 | OVS_VSWITCHD_STOP | |
849 | AT_CLEANUP | |
0f2aaee9 BP |
850 | |
851 | AT_SETUP([enqueue action for OF1.1+]) | |
852 | AT_KEYWORDS([ofp-actions]) | |
853 | OVS_VSWITCHD_START | |
854 | dnl OpenFlow 1.0 has an "enqueue" action. For OpenFlow 1.1+, we translate | |
855 | dnl it to a series of actions that accomplish the same thing. | |
856 | AT_CHECK([ovs-ofctl -O OpenFlow10 add-flow br0 'actions=enqueue(123,456)']) | |
857 | AT_CHECK([ovs-ofctl -O OpenFlow10 dump-flows br0 | ofctl_strip], [0], [dnl | |
858 | NXST_FLOW reply: | |
859 | actions=enqueue:123:456 | |
860 | ]) | |
861 | AT_CHECK([ovs-ofctl -O OpenFlow13 dump-flows br0 | ofctl_strip], [0], [dnl | |
862 | OFPST_FLOW reply (OF1.3): | |
863 | reset_counts actions=set_queue:456,output:123,pop_queue | |
864 | ]) | |
865 | OVS_VSWITCHD_STOP | |
866 | AT_CLEANUP | |
4b684612 | 867 | |
56a91749 BP |
868 | AT_SETUP([mod_nw_ttl action for OF1.0]) |
869 | AT_KEYWORDS([ofp-actions]) | |
870 | OVS_VSWITCHD_START | |
871 | dnl OpenFlow 1.1+ have a mod_nw_ttl action. For OpenFlow 1.0, we translate | |
872 | dnl it to an Open vSwitch extension. | |
873 | AT_CHECK([ovs-ofctl -O OpenFlow11 add-flow br0 'ip,actions=mod_nw_ttl:123']) | |
874 | AT_CHECK([ovs-ofctl -O OpenFlow10 dump-flows br0 | ofctl_strip], [0], [dnl | |
875 | NXST_FLOW reply: | |
876 | ip actions=load:0x7b->NXM_NX_IP_TTL[[]] | |
877 | ]) | |
878 | AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip], [0], [dnl | |
879 | OFPST_FLOW reply (OF1.1): | |
880 | ip actions=mod_nw_ttl:123 | |
881 | ]) | |
882 | OVS_VSWITCHD_STOP | |
883 | AT_CLEANUP | |
884 | ||
4b684612 BP |
885 | AT_SETUP([mod_nw_ecn action translation]) |
886 | AT_KEYWORDS([ofp-actions]) | |
887 | OVS_VSWITCHD_START | |
888 | ||
889 | dnl OpenFlow 1.1, but no other version, has a "mod_nw_ecn" action. | |
890 | dnl Check that we translate it properly for OF1.0 and OF1.2. | |
891 | dnl (OF1.3+ should be the same as OF1.2.) | |
892 | AT_CHECK([ovs-ofctl -O OpenFlow11 add-flow br0 'ip,actions=mod_nw_ecn:2']) | |
893 | AT_CHECK([ovs-ofctl -O OpenFlow10 dump-flows br0 | ofctl_strip], [0], [dnl | |
894 | NXST_FLOW reply: | |
895 | ip actions=load:0x2->NXM_NX_IP_ECN[[]] | |
896 | ]) | |
897 | AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip], [0], [dnl | |
898 | OFPST_FLOW reply (OF1.1): | |
899 | ip actions=mod_nw_ecn:2 | |
900 | ]) | |
901 | AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip], [0], [dnl | |
902 | OFPST_FLOW reply (OF1.2): | |
903 | ip actions=set_field:2->nw_ecn | |
904 | ]) | |
905 | ||
906 | dnl Check that OF1.2+ set_field to set ECN is translated into the OF1.1 | |
907 | dnl mod_nw_ecn action. | |
908 | dnl | |
909 | dnl We don't do anything equivalent for OF1.0 reg_load because we prefer | |
910 | dnl that anything that comes in as reg_load gets translated back to reg_load | |
911 | dnl on output. Perhaps this is somewhat inconsistent but it's what OVS | |
912 | dnl has done for multiple versions. | |
913 | AT_CHECK([ovs-ofctl del-flows br0]) | |
914 | AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 'ip,actions=set_field:2->ip_ecn']) | |
915 | AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip], [0], [dnl | |
916 | OFPST_FLOW reply (OF1.1): | |
917 | ip actions=mod_nw_ecn:2 | |
918 | ]) | |
1a1e1a49 EG |
919 | |
920 | dnl Check that OF1.2+ set_field to set ECN is translated for earlier OF | |
921 | dnl versions. | |
922 | AT_CHECK([ovs-ofctl del-flows br0]) | |
923 | AT_CHECK([ovs-ofctl -O OpenFlow10 add-flow br0 'ip,actions=set_field:2->ip_ecn']) | |
924 | AT_CHECK([ovs-ofctl del-flows br0]) | |
925 | AT_CHECK([ovs-ofctl -O OpenFlow11 add-flow br0 'ip,actions=set_field:2->ip_ecn']) | |
926 | ||
4b684612 BP |
927 | OVS_VSWITCHD_STOP |
928 | AT_CLEANUP | |
56a91749 | 929 | |
70ed59cb BP |
930 | AT_SETUP([action parsing errors]) |
931 | bad_action () { | |
932 | AT_CHECK_UNQUOTED([ovs-ofctl parse-flow "actions=$1"], [1], [], | |
933 | [ovs-ofctl: $2 | |
934 | ]) | |
935 | } | |
936 | ||
937 | # output | |
938 | bad_action 'output(port=xyzzy,max_len=5)' \ | |
939 | "output to unknown truncate port: xyzzy" | |
940 | bad_action 'output(port=all,max_len=64)' \ | |
941 | "output to unsupported truncate port: all" | |
942 | bad_action 'output(port=local,max_len=64,foo=bar)' \ | |
943 | "invalid key 'foo' in output_trunc argument" | |
944 | bad_action 'output(port=local,max_len=5)' \ | |
945 | "max_len 5 is less than the minimum value 14" | |
946 | ||
947 | # controller | |
948 | bad_action 'controller(reason=asdf)' 'unknown reason "asdf"' | |
949 | bad_action 'controller(foo=bar)' 'unknown key "foo" parsing controller action' | |
950 | bad_action 'controller(userdata=123x456)' \ | |
951 | 'bad hex digit in `controller'\'' action `userdata'\' | |
952 | ||
953 | # enqueue | |
954 | bad_action 'enqueue:123' \ | |
955 | '"enqueue" syntax is "enqueue:PORT:QUEUE" or "enqueue(PORT,QUEUE)"' | |
956 | bad_action 'enqueue:asdf:123' 'asdf: enqueue to unknown port' | |
957 | ||
958 | # bundle | |
959 | bad_action 'bundle:123' '123: not enough arguments to bundle action' | |
960 | bad_action 'bundle(symmetric_l4,60,hrw,ofport,ports:1,2,3,4,5)' \ | |
91fc374a BP |
961 | "symmetric_l4,60,hrw,ofport,ports:1,2,3,4,5: missing member delimiter, expected \`members', got \`ports'" |
962 | bad_action 'bundle(symmetric_l4,60,hrw,ofport,members:xyzzy,2,3,4,5)' \ | |
70ed59cb | 963 | 'xyzzy: bad port number' |
91fc374a BP |
964 | bad_action 'bundle(asymmetric_l4,60,hrw,ofport,members:1,2,3,4,5)' \ |
965 | "asymmetric_l4,60,hrw,ofport,members:1,2,3,4,5: unknown fields \`asymmetric_l4'" | |
966 | bad_action 'bundle(symmetric_l4,60,hrt,ofport,members:1,2,3,4,5)' \ | |
967 | "symmetric_l4,60,hrt,ofport,members:1,2,3,4,5: unknown algorithm \`hrt'" | |
968 | bad_action 'bundle(symmetric_l4,60,hrw,odpport,members:1,2,3,4,5)' \ | |
969 | "symmetric_l4,60,hrw,odpport,members:1,2,3,4,5: unknown member_type \`odpport'" | |
970 | bad_action 'bundle_load(symmetric_l4,60,hrw,ofport,actset_output,members:1,2,3,4,5)' \ | |
971 | "symmetric_l4,60,hrw,ofport,actset_output,members:1,2,3,4,5: experimenter OXM field 'actset_output' not supported" | |
70ed59cb BP |
972 | |
973 | # mod_vlan_vid | |
974 | bad_action 'mod_vlan_vid:6000' '6000: not a valid VLAN VID' | |
975 | ||
976 | # mod_vlan_pcp | |
977 | bad_action 'mod_vlan_pcp:8' '8: not a valid VLAN PCP' | |
978 | ||
979 | # push_vlan | |
980 | bad_action 'push_vlan(0x1234)' '0x1234: not a valid VLAN ethertype' | |
981 | ||
982 | # mod_nw_tos | |
983 | bad_action 'mod_nw_tos(1)' '1: not a valid TOS' | |
984 | ||
985 | # mod_nw_ecn | |
986 | bad_action 'mod_nw_ecn(5)' '5: not a valid ECN' | |
987 | ||
988 | # set_field | |
989 | bad_action 'set_field:1' "1: missing \`->'" | |
990 | bad_action 'set_field:1->' "1->: missing field name following \`->'" | |
991 | bad_action 'set_field:1->x' 'x is not a valid OXM field name' | |
992 | bad_action 'set_field:1->eth_type' 'eth_type is read-only' | |
993 | bad_action 'set_field:1->eth_src' '1: invalid Ethernet address' | |
994 | bad_action 'set_field:0xffff->ip_dscp' '0xffff: value too large for 1-byte field ip_dscp' | |
995 | bad_action 'set_field:0xff->ip_dscp' '0xff is not a valid value for field ip_dscp' | |
996 | ||
997 | # reg_load | |
998 | bad_action 'load:xyzzy->eth_src' 'xyzzy->eth_src: cannot parse integer value' | |
999 | bad_action 'load:0xff->eth_src[[1..5]]' '0xff->eth_src[[1..5]]: value 00:00:00:00:00:ff does not fit into 5 bits' | |
1000 | ||
1001 | # push/pop | |
1002 | bad_action 'push(eth_dst[[]]x)' 'x: trailing garbage following push or pop' | |
1003 | ||
1004 | # dec_ttl | |
1005 | bad_action 'dec_ttl(,)' 'dec_ttl_cnt_ids: expected at least one controller id.' | |
1006 | ||
1007 | # set_mpls_label | |
1008 | bad_action 'set_mpls_label' 'set_mpls_label: expected label.' | |
1009 | ||
1010 | # set_mpls_tc | |
1011 | bad_action 'set_mpls_tc' 'set_mpls_tc: expected tc.' | |
1012 | ||
1013 | # set_mpls_ttl | |
1014 | bad_action 'set_mpls_ttl' 'set_mpls_ttl: expected ttl.' | |
1015 | ||
1016 | # fin_timeout | |
1017 | bad_action 'fin_timeout(foo=bar)' "invalid key 'foo' in 'fin_timeout' argument" | |
1018 | ||
1019 | # encap | |
1020 | bad_action 'encap(,)' 'Missing encap hdr: ,' | |
1021 | bad_action 'encap(x(y))' 'Encap hdr not supported: y' | |
1022 | bad_action 'encap(nsh(type=1))' 'Invalid property: type' | |
1023 | bad_action 'encap(nsh(md_type))' 'Value missing for encap property' | |
1024 | bad_action 'encap(nsh(md_type=3))' 'invalid md_type' | |
1025 | bad_action 'encap(nsh(tlv(,,)))' 'Invalid NSH TLV header: ,,' | |
1026 | ||
1027 | # decap | |
1028 | bad_action 'decap(packet_type(x))' 'Missing packet_type attribute ns' | |
1029 | bad_action 'decap(packet_type(ns=99))' 'Unsupported ns value: 99' | |
1030 | bad_action 'decap(packet_type(ns=0))' 'Missing packet_type attribute type' | |
1031 | bad_action 'decap(foo=bar)' 'Invalid decap argument: foo' | |
1032 | ||
1033 | # resubmit | |
1034 | bad_action 'resubmit(asdf)' 'asdf: resubmit to unknown port' | |
1035 | bad_action 'resubmit(,asdf)' 'asdf: resubmit to unknown table' | |
1036 | bad_action 'resubmit(1,2,xyzzy)' 'xyzzy: unknown parameter' | |
1037 | bad_action 'resubmit(in_port,255)' 'at least one "in_port" or "table" must be specified on resubmit' | |
1038 | ||
1039 | # learn | |
1040 | bad_action 'learn(load:123->actset_output)' \ | |
1041 | "123->actset_output: experimenter OXM field 'actset_output' not supported" | |
1042 | bad_action 'learn(load:1234->eth_dst[[0..5]])' \ | |
1043 | '1234->eth_dst[[0..5]]: value does not fit into 6 bits' | |
1044 | bad_action 'learn(actset_output=0x1000)' \ | |
1045 | "actset_output=0x1000: experimenter OXM field 'actset_output' not supported" | |
1046 | bad_action 'learn(eth_type[[5]]=xyzzy)' \ | |
1047 | "eth_type[[5]]=xyzzy: eth_type[[5]] value xyzzy cannot be parsed as a subfield (xyzzy: unknown field \`xyzzy') or an immediate value (eth_type[[5]]=xyzzy: cannot parse integer value)" | |
1048 | bad_action 'learn(eth_type[[0]]=eth_type[[1..2]])' \ | |
1049 | 'eth_type[[0]]=eth_type[[1..2]]: bit widths of eth_type[[0]] (2) and eth_type[[1..2]] (1) differ' | |
1050 | bad_action 'learn(load:->)' "load: missing source before \`->' in \`->'" | |
1051 | bad_action 'learn(load:x)' "load: missing \`->' in \`x'" | |
1052 | bad_action 'learn(load:1x->foo)' "load: garbage before \`->' in \`1x->foo'" | |
1053 | bad_action 'learn(foo)' 'foo: unknown keyword foo' | |
1054 | bad_action 'learn(table=foo)' 'unknown table "foo"' | |
1055 | bad_action 'learn(table=255)' "table=255: table id 255 not valid for \`learn' action" | |
1056 | bad_action 'learn(result_dst=tcp_flags)' 'tcp_flags is read-only' | |
1057 | bad_action 'learn(result_dst=eth_dst)' "result_dst in 'learn' action must be a single bit" | |
1058 | ||
1059 | # conjunction | |
1060 | bad_action 'conjunction(1, 1/1)' 'conjunction must have at least 2 clauses' | |
1061 | bad_action 'conjunction(1, 1/65)' 'conjunction must have at most 64 clauses' | |
1062 | bad_action 'conjunction(1, 0/2)' 'clause index must be positive' | |
1063 | bad_action 'conjunction(1, 3/2)' \ | |
1064 | 'clause index must be less than or equal to number of clauses' | |
1065 | ||
1066 | # multipath | |
1067 | bad_action 'multipath(1,2,3,4)' \ | |
1068 | '1,2,3,4: not enough arguments to multipath action' | |
1069 | bad_action 'multipath(xyzzy,50,modulo_n,1,0,NXM_NX_REG0[[]])' \ | |
1070 | "xyzzy,50,modulo_n,1,0,NXM_NX_REG0[[]]: unknown fields \`xyzzy'" | |
1071 | bad_action 'multipath(eth_src,50,fubar,1,0,NXM_NX_REG0[[]])' \ | |
1072 | "eth_src,50,fubar,1,0,NXM_NX_REG0[[]]: unknown algorithm \`fubar'" | |
1073 | bad_action 'multipath(eth_src,50,modulo_n,0,0,NXM_NX_REG0[[]])' \ | |
1074 | "eth_src,50,modulo_n,0,0,NXM_NX_REG0[[]]: n_links 0 is not in valid range 1 to 65536" | |
1075 | bad_action 'multipath(eth_src,50,modulo_n,1024,0,actset_output)' \ | |
1076 | "eth_src,50,modulo_n,1024,0,actset_output: experimenter OXM field 'actset_output' not supported" | |
1077 | bad_action 'multipath(eth_src,50,modulo_n,1024,0,NXM_NX_REG0[[0..7]])' \ | |
1078 | "eth_src,50,modulo_n,1024,0,NXM_NX_REG0[[0..7]]: 8-bit destination field has 256 possible values, less than specified n_links 1024" | |
1079 | ||
1080 | # note | |
1081 | bad_action 'note:x' "bad hex digit in \`note' argument" | |
1082 | ||
1083 | # unroll_xlate | |
1084 | bad_action 'unroll_xlate' "UNROLL is an internal action that shouldn't be used via OpenFlow" | |
1085 | ||
1086 | # sample | |
1087 | bad_action 'sample(probability=0)' 'invalid probability value "0"' | |
1088 | bad_action 'sample(sampling_port=asdf)' 'asdf: unknown port' | |
1089 | bad_action 'sample(foo=bar)' 'invalid key "foo" in "sample" argument' | |
1090 | bad_action 'sample' 'non-zero "probability" must be specified on sample' | |
1091 | ||
1092 | # ct | |
1093 | bad_action 'ct(table=asdf)' 'unknown table asdf' | |
1094 | bad_action 'ct(table=255)' 'invalid table 0xff' | |
1095 | bad_action 'ct(foo=bar)' 'invalid argument to "ct" action: `foo'\' | |
1096 | bad_action 'ct(force)' '"force" flag requires "commit" flag.' | |
1097 | ||
1098 | # nat | |
1099 | bad_action 'nat(src=1.2.3.4x)' 'garbage (x) after nat range "1.2.3.4x" (pos: 7)' | |
1100 | bad_action 'nat(src=1.2.3.4-0.1.2.3)' 'invalid nat range "1.2.3.4-0.1.2.3"' | |
1101 | bad_action 'nat(foo=bar)' 'invalid key "foo" in "nat" argument' | |
1102 | bad_action 'nat(src=1.2.3.4,dst=2.3.4.5)' 'May only specify one of "src" or "dst".' | |
1103 | bad_action 'nat(persistent)' 'Flags allowed only with "src" or "dst".' | |
1104 | bad_action 'nat(src=1.2.3.4,hash,random)' 'Both "hash" and "random" are not allowed.' | |
1105 | ||
1106 | # check_pkt_larger | |
1107 | bad_action 'check_pkt_larger(1500)->reg0' \ | |
1108 | 'Only 1-bit destination field is allowed' | |
1109 | ||
1110 | # goto_table | |
1111 | bad_action 'goto_table:asdf' 'unknown table "asdf"' | |
1112 | ||
1113 | # nested actions | |
1114 | bad_action 'set_field:1234->ct_mark' \ | |
1115 | "cannot set CT fields outside of ct action" | |
1116 | bad_action 'nat' 'Cannot have NAT action outside of "ct" action' | |
1117 | bad_action 'ct(commit,exec(push_vlan(0x8100)))' \ | |
1118 | "ct action doesn't support nested action push_vlan" | |
1119 | bad_action 'ct(commit,exec(set_field:12:34:56:78:9a:bc->eth_dst))' \ | |
1120 | "ct action doesn't support nested modification of eth_dst" | |
1121 | bad_action 'conjunction(1, 2/3),ct_clear' \ | |
1122 | '"conjunction" actions may be used along with "note" but not any other kind of action (such as the "ct_clear" action used here)' | |
1123 | ||
1124 | # instructions | |
1125 | bad_action 'goto_table:5,goto_table:5' \ | |
1126 | 'duplicate goto_table instruction not allowed, for OpenFlow 1.1+ compatibility' | |
1127 | bad_action 'goto_table:5,clone()' \ | |
1128 | 'invalid instruction ordering: apply_actions must appear before goto_table, for OpenFlow 1.1+ compatibility' | |
1129 | AT_CHECK([ovs-ofctl parse-group 'group_id=1,type=select,bucket=actions=clear_actions'], [1], [], | |
1130 | [ovs-ofctl: clear_actions instruction not allowed here | |
1131 | ]) | |
1132 | ||
1133 | # ofpacts_parse__() | |
1134 | bad_action 'apply_actions' 'apply_actions is the default instruction' | |
1135 | bad_action 'xyzzy' 'unknown action xyzzy' | |
1136 | bad_action 'drop,3' '"drop" must not be accompanied by any other action or instruction' | |
1137 | ||
1138 | AT_CLEANUP |