Add Nicira vendor extension action NXAST_DEC_TTL_CNT_IDS.
[sliver-openvswitch.git] / tests / ofp-actions.at
1 AT_BANNER([OpenFlow actions])
2
3 AT_SETUP([OpenFlow 1.0 action translation])
4 AT_KEYWORDS([OF1.0])
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
42 # actions=enqueue:10q55
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
72 # actions=multipath(eth_src,50,modulo_n,1,0,NXM_NX_REG0[])
73 ffff 0020 00002320 000a 0000 0032 0000 0000 0000 0000 0000 0000 001f 00010004
74
75 # actions=autopath(2,NXM_NX_REG0[2..30])
76 ffff 0018 00002320 000b 009c 00010004 00000002 00000000
77
78 # actions=bundle(eth_src,0,hrw,ofport,slaves:4,8)
79 ffff 0028 00002320 000c 0001 0000 0000 00000002 0002 0000 00000000 00000000 dnl
80 0004 0008 00000000
81
82 # actions=bundle_load(eth_src,0,hrw,ofport,NXM_NX_REG0[],slaves:4,8)
83 ffff 0028 00002320 000d 0001 0000 0000 00000002 0002 001f 00010004 00000000 dnl
84 0004 0008 00000000
85
86 # actions=resubmit(10,5)
87 ffff 0010 00002320 000e 000a 05 000000
88
89 # actions=output:NXM_NX_REG1[5..10]
90 ffff 0018 00002320 000f 0145 00010204 ffff 000000000000
91
92 # actions=learn(table=2,idle_timeout=10,hard_timeout=20,fin_idle_timeout=2,fin_hard_timeout=4,priority=80,cookie=0x123456789abcdef0,NXM_OF_VLAN_TCI[0..11],NXM_OF_ETH_DST[]=NXM_OF_ETH_SRC[],output:NXM_OF_IN_PORT[])
93 ffff 0048 00002320 0010 000a 0014 0050 123456789abcdef0 0000 02 00 0002 0004 dnl
94 000c 00000802 0000 00000802 0000 dnl
95 0030 00000406 0000 00000206 0000 dnl
96 1010 00000002 0000 dnl
97 00000000
98
99 # actions=exit
100 ffff 0010 00002320 0011 000000000000
101
102 # actions=dec_ttl
103 ffff 0010 00002320 0012 000000000000
104
105 # actions=fin_timeout(idle_timeout=10,hard_timeout=20)
106 ffff 0010 00002320 0013 000a 0014 0000
107
108 # actions=controller(reason=invalid_ttl,max_len=1234,id=5678)
109 ffff 0010 00002320 0014 04d2 162e 02 00
110
111 # actions=dec_ttl(32768,12345,90,765,1024)
112 ffff 0020 00002320 0015 000500000000 80003039005A02fd 0400000000000000
113
114 ])
115 sed '/^[[#&]]/d' < test-data > input.txt
116 sed -n 's/^# //p; /^$/p' < test-data > expout
117 sed -n 's/^& //p' < test-data > experr
118 AT_CAPTURE_FILE([input.txt])
119 AT_CAPTURE_FILE([expout])
120 AT_CAPTURE_FILE([experr])
121 AT_CHECK(
122   [ovs-ofctl '-vPATTERN:console:%c|%p|%m' parse-ofp10-actions < input.txt],
123   [0], [expout], [experr])
124 AT_CLEANUP
125
126 AT_SETUP([OpenFlow 1.1 action translation])
127 AT_KEYWORDS([OF1.1])
128 AT_DATA([test-data], [dnl
129 # actions=LOCAL
130 0000 0010 fffffffe 04d2 000000000000
131
132 # actions=CONTROLLER:1234
133 0000 0010 fffffffd 04d2 000000000000
134
135 # actions=mod_vlan_vid:9
136 0001 0008 0009 0000
137
138 # actions=mod_vlan_pcp:6
139 0002 0008 06 000000
140
141 # actions=mod_dl_src:00:11:22:33:44:55
142 0003 0010 001122334455 000000000000
143
144 # actions=mod_dl_dst:10:20:30:40:50:60
145 0004 0010 102030405060 000000000000
146
147 # actions=mod_nw_src:1.2.3.4
148 0005 0008 01020304
149
150 # actions=mod_nw_dst:192.168.0.1
151 0006 0008 c0a80001
152
153 # actions=mod_nw_tos:48
154 0007 0008 30 000000
155
156 # actions=mod_tp_src:80
157 0009 0008 0050 0000
158
159 # actions=mod_tp_dst:443
160 000a 0008 01bb 0000
161
162 # actions=resubmit:5
163 ffff 0010 00002320 0001 0005 00000000
164
165 # actions=set_tunnel:0x12345678
166 ffff 0010 00002320 0002 0000 12345678
167
168 # actions=set_queue:2309737729
169 ffff 0010 00002320 0004 0000 89abcd01
170
171 # actions=pop_queue
172 ffff 0010 00002320 0005 000000000000
173
174 # actions=move:NXM_OF_IN_PORT[]->NXM_OF_VLAN_TCI[]
175 ffff 0018 00002320 0006 0010 0000 0000 00000002 00000802
176
177 # actions=load:0xf009->NXM_OF_VLAN_TCI[]
178 ffff 0018 00002320 0007 000f 00000802 000000000000f009
179
180 # actions=note:11.e9.9a.ad.67.f3
181 ffff 0010 00002320 0008 11e99aad67f3
182
183 # actions=set_tunnel64:0xc426384d49c53d60
184 ffff 0018 00002320 0009 000000000000 c426384d49c53d60
185
186 # actions=set_tunnel64:0x885f3298
187 ffff 0018 00002320 0009 000000000000 00000000885f3298
188
189 # actions=multipath(eth_src,50,modulo_n,1,0,NXM_NX_REG0[])
190 ffff 0020 00002320 000a 0000 0032 0000 0000 0000 0000 0000 0000 001f 00010004
191
192 # actions=autopath(2,NXM_NX_REG0[2..30])
193 ffff 0018 00002320 000b 009c 00010004 00000002 00000000
194
195 # actions=bundle(eth_src,0,hrw,ofport,slaves:4,8)
196 ffff 0028 00002320 000c 0001 0000 0000 00000002 0002 0000 00000000 00000000 dnl
197 0004 0008 00000000
198
199 # actions=bundle_load(eth_src,0,hrw,ofport,NXM_NX_REG0[],slaves:4,8)
200 ffff 0028 00002320 000d 0001 0000 0000 00000002 0002 001f 00010004 00000000 dnl
201 0004 0008 00000000
202
203 # actions=resubmit(10,5)
204 ffff 0010 00002320 000e 000a 05 000000
205
206 # actions=output:NXM_NX_REG1[5..10]
207 ffff 0018 00002320 000f 0145 00010204 ffff 000000000000
208
209 # 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[])
210 ffff 0048 00002320 0010 000a 0014 0050 123456789abcdef0 0000 02 00 0002 0004 dnl
211 000c 00000802 0000 00000802 0000 dnl
212 0030 00000406 0000 00000206 0000 dnl
213 1010 00000002 0000 dnl
214 00000000
215
216 # actions=exit
217 ffff 0010 00002320 0011 000000000000
218
219 # actions=dec_ttl
220 ffff 0010 00002320 0012 000000000000
221
222 # actions=fin_timeout(idle_timeout=10,hard_timeout=20)
223 ffff 0010 00002320 0013 000a 0014 0000
224
225 # actions=controller(reason=invalid_ttl,max_len=1234,id=5678)
226 ffff 0010 00002320 0014 04d2 162e 02 00
227
228 # actions=dec_ttl(32768,12345,90,765,1024)
229 ffff 0020 00002320 0015 000500000000 80003039005A02fd 0400000000000000
230
231 ])
232 sed '/^[[#&]]/d' < test-data > input.txt
233 sed -n 's/^# //p; /^$/p' < test-data > expout
234 sed -n 's/^& //p' < test-data > experr
235 AT_CAPTURE_FILE([input.txt])
236 AT_CAPTURE_FILE([expout])
237 AT_CAPTURE_FILE([experr])
238 AT_CHECK(
239   [ovs-ofctl '-vPATTERN:console:%c|%p|%m' parse-ofp11-actions < input.txt],
240   [0], [expout], [experr])
241 AT_CLEANUP
242
243 AT_SETUP([OpenFlow 1.1 instruction translation])
244 AT_KEYWORDS([OF1.1])
245 AT_DATA([test-data], [dnl
246 # actions=LOCAL
247 0004 0018 00000000 dnl
248 0000 0010 fffffffe 04d2 000000000000
249
250 dnl Check that an empty Apply-Actions instruction gets dropped.
251 # actions=drop
252 #  0: 00 -> (none)
253 #  1: 04 -> (none)
254 #  2: 00 -> (none)
255 #  3: 08 -> (none)
256 #  4: 00 -> (none)
257 #  5: 00 -> (none)
258 #  6: 00 -> (none)
259 #  7: 00 -> (none)
260 0004 0008 00000000
261
262 # bad OF1.1 instructions: NXBIC_DUP_TYPE
263 0004 0008 00000000 0004 0008 00000000
264
265 dnl Instructions not multiple of 8 in length.
266 & ofp_actions|WARN|OpenFlow message instructions length 9 is not a multiple of 8
267 # bad OF1.1 instructions: OFPBIC_BAD_LEN
268 0004 0009 01 00000000
269
270 dnl Goto-Table instruction too long.
271 # bad OF1.1 instructions: OFPBIC_BAD_LEN
272 0001 0010 01 000000 0000000000000000
273
274 dnl Goto-Table not supported yet.
275 # bad OF1.1 instructions: OFPBIC_UNSUP_INST
276 0001 0008 01 000000
277
278 dnl Write-Metadata not supported yet.
279 # bad OF1.1 instructions: OFPBIC_UNSUP_INST
280 0002 0018 00000000 fedcba9876543210 ffffffffffffffff
281
282 dnl Write-Metadata too short.
283 # bad OF1.1 instructions: OFPBIC_BAD_LEN
284 0002 0010 00000000 fedcba9876543210
285
286 dnl Write-Metadata too long.
287 # bad OF1.1 instructions: OFPBIC_BAD_LEN
288 0002 0020 00000000 fedcba9876543210 ffffffffffffffff 0000000000000000
289
290 dnl Write-Actions not supported yet.
291 # bad OF1.1 instructions: OFPBIC_UNSUP_INST
292 0003 0008 01 000000
293
294 dnl Clear-Actions not supported yet.
295 # bad OF1.1 instructions: OFPBIC_UNSUP_INST
296 0005 0008 01 000000
297
298 dnl Experimenter actions not supported yet.
299 # bad OF1.1 instructions: OFPBIC_BAD_EXPERIMENTER
300 ffff 0008 01 000000
301
302 dnl Bad instruction number (0 not assigned).
303 # bad OF1.1 instructions: OFPBIC_UNKNOWN_INST
304 0000 0008 01 000000
305
306 ])
307 sed '/^[[#&]]/d' < test-data > input.txt
308 sed -n 's/^# //p; /^$/p' < test-data > expout
309 sed -n 's/^& //p' < test-data > experr
310 AT_CAPTURE_FILE([input.txt])
311 AT_CAPTURE_FILE([expout])
312 AT_CAPTURE_FILE([experr])
313 AT_CHECK(
314   [ovs-ofctl '-vPATTERN:console:%c|%p|%m' parse-ofp11-instructions < input.txt],
315   [0], [expout], [experr])
316 AT_CLEANUP