]> git.proxmox.com Git - mirror_ovs.git/blob - tests/ofproto.at
dpctl: Add the option 'pmd' for dump-flows.
[mirror_ovs.git] / tests / ofproto.at
1 AT_BANNER([ofproto])
2
3 AT_SETUP([ofproto - echo request])
4 OVS_VSWITCHD_START
5 AT_CHECK([ovs-ofctl -vwarn probe br0])
6 OVS_VSWITCHD_STOP
7 AT_CLEANUP
8
9 AT_SETUP([ofproto - handling messages with bad version])
10 AT_KEYWORDS([monitor])
11 OVS_VSWITCHD_START
12
13 # Start a monitor running OpenFlow 1.0, then send the switch an OF1.1 features
14 # request
15 AT_CHECK([ovs-ofctl -P standard monitor br0 --detach --no-chdir --pidfile])
16 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
17 AT_CAPTURE_FILE([monitor.log])
18 ovs-appctl -t ovs-ofctl ofctl/send 0205000801234567
19 ovs-appctl -t ovs-ofctl ofctl/barrier
20 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
21
22 AT_CHECK([sed 's/ (xid=0x[[0-9a-fA-F]]*)//
23 /ECHO/d' monitor.log], [0], [dnl
24 send: OFPT_FEATURES_REQUEST (OF1.1):
25 OFPT_ERROR (OF1.1): OFPBRC_BAD_VERSION
26 OFPT_FEATURES_REQUEST (OF1.1):
27 OFPT_BARRIER_REPLY:
28 ])
29
30 OVS_VSWITCHD_STOP(["/received OpenFlow version 0x02 != expected 01/d"])
31 AT_CLEANUP
32
33 AT_SETUP([ofproto - feature request, config request])
34 OVS_VSWITCHD_START
35 AT_CHECK([ovs-ofctl -vwarn show br0], [0], [stdout])
36 AT_CHECK([strip_xids < stdout], [0], [dnl
37 OFPT_FEATURES_REPLY: dpid:fedcba9876543210
38 n_tables:254, n_buffers:0
39 capabilities: FLOW_STATS TABLE_STATS PORT_STATS QUEUE_STATS ARP_MATCH_IP
40 actions: output enqueue set_vlan_vid set_vlan_pcp strip_vlan mod_dl_src mod_dl_dst mod_nw_src mod_nw_dst mod_nw_tos mod_tp_src mod_tp_dst
41 LOCAL(br0): addr:aa:55:aa:55:00:00
42 config: 0
43 state: 0
44 speed: 0 Mbps now, 0 Mbps max
45 OFPT_GET_CONFIG_REPLY: frags=normal miss_send_len=0
46 ])
47 OVS_VSWITCHD_STOP
48 AT_CLEANUP
49
50 AT_SETUP([ofproto - set OpenFlow port number])
51 OVS_VSWITCHD_START(
52 [add-port br0 p1 -- set Interface p1 type=dummy --\
53 add-port br0 p2 -- set Interface p2 type=dummy ofport_request=99])
54 AT_CHECK([ovs-ofctl -vwarn show br0], [0], [stdout])
55 AT_CHECK([[sed '
56 s/ (xid=0x[0-9a-fA-F]*)//
57 s/00:0.$/00:0x/' < stdout]],
58 [0], [dnl
59 OFPT_FEATURES_REPLY: dpid:fedcba9876543210
60 n_tables:254, n_buffers:0
61 capabilities: FLOW_STATS TABLE_STATS PORT_STATS QUEUE_STATS ARP_MATCH_IP
62 actions: output enqueue set_vlan_vid set_vlan_pcp strip_vlan mod_dl_src mod_dl_dst mod_nw_src mod_nw_dst mod_nw_tos mod_tp_src mod_tp_dst
63 1(p1): addr:aa:55:aa:55:00:0x
64 config: 0
65 state: 0
66 speed: 0 Mbps now, 0 Mbps max
67 99(p2): addr:aa:55:aa:55:00:0x
68 config: 0
69 state: 0
70 speed: 0 Mbps now, 0 Mbps max
71 LOCAL(br0): addr:aa:55:aa:55:00:0x
72 config: 0
73 state: 0
74 speed: 0 Mbps now, 0 Mbps max
75 OFPT_GET_CONFIG_REPLY: frags=normal miss_send_len=0
76 ])
77
78 OVS_VSWITCHD_STOP
79 AT_CLEANUP
80
81 dnl This is really bare-bones.
82 dnl It at least checks request and reply serialization and deserialization.
83 AT_SETUP([ofproto - port stats - (OpenFlow 1.0)])
84 OVS_VSWITCHD_START
85 AT_CHECK([ovs-ofctl -vwarn dump-ports br0], [0], [stdout])
86 AT_CHECK([strip_xids < stdout], [0], [dnl
87 OFPST_PORT reply: 1 ports
88 port LOCAL: rx pkts=0, bytes=0, drop=?, errs=?, frame=?, over=?, crc=?
89 tx pkts=0, bytes=0, drop=?, errs=?, coll=?
90 ])
91 OVS_VSWITCHD_STOP
92 AT_CLEANUP
93
94 AT_SETUP([ofproto - port stats - (OpenFlow 1.2)])
95 OVS_VSWITCHD_START
96 AT_CHECK([ovs-ofctl -O OpenFlow12 -vwarn dump-ports br0], [0], [stdout])
97 AT_CHECK([strip_xids < stdout], [0], [dnl
98 OFPST_PORT reply (OF1.2): 1 ports
99 port LOCAL: rx pkts=0, bytes=0, drop=?, errs=?, frame=?, over=?, crc=?
100 tx pkts=0, bytes=0, drop=?, errs=?, coll=?
101 ])
102 OVS_VSWITCHD_STOP
103 AT_CLEANUP
104
105 AT_SETUP([ofproto - port stats - (OpenFlow 1.4)])
106 OVS_VSWITCHD_START
107 AT_CHECK([ovs-ofctl -O OpenFlow14 -vwarn dump-ports br0], [0], [stdout])
108 AT_CHECK([strip_xids < stdout | sed 's/duration=[[0-9.]]*s/duration=?s/'],
109 [0], [dnl
110 OFPST_PORT reply (OF1.4): 1 ports
111 port LOCAL: rx pkts=0, bytes=0, drop=?, errs=?, frame=?, over=?, crc=?
112 tx pkts=0, bytes=0, drop=?, errs=?, coll=?
113 duration=?s
114 CUSTOM Statistics
115 rx_custom_packets_1=0, rx_custom_packets_2=0,
116 ])
117 OVS_VSWITCHD_STOP
118 AT_CLEANUP
119
120 dnl This is really bare-bones.
121 dnl It at least checks request and reply serialization and deserialization.
122 AT_SETUP([ofproto - port-desc stats (OpenFlow 1.0)])
123 OVS_VSWITCHD_START
124 AT_CHECK([ovs-ofctl -vwarn dump-ports-desc br0], [0], [stdout])
125 AT_CHECK([strip_xids < stdout], [0], [dnl
126 OFPST_PORT_DESC reply:
127 LOCAL(br0): addr:aa:55:aa:55:00:00
128 config: 0
129 state: 0
130 speed: 0 Mbps now, 0 Mbps max
131 ])
132 OVS_VSWITCHD_STOP
133 AT_CLEANUP
134
135 dnl This is really bare-bones.
136 dnl It at least checks request and reply serialization and deserialization.
137 AT_SETUP([ofproto - port-desc stats (OpenFlow 1.2)])
138 OVS_VSWITCHD_START
139 AT_CHECK([ovs-ofctl -O OpenFlow12 -vwarn dump-ports-desc br0], [0], [stdout])
140 AT_CHECK([strip_xids < stdout], [0], [dnl
141 OFPST_PORT_DESC reply (OF1.2):
142 LOCAL(br0): addr:aa:55:aa:55:00:00
143 config: 0
144 state: LIVE
145 speed: 0 Mbps now, 0 Mbps max
146 ])
147 OVS_VSWITCHD_STOP
148 AT_CLEANUP
149
150 AT_SETUP([ofproto - port-desc stats (OpenFlow 1.5)])
151 OVS_VSWITCHD_START
152 add_of_ports br0 1 2 3
153 AT_CHECK([ovs-ofctl -F OXM-OpenFlow15 -O OpenFlow15 -vwarn dump-ports-desc br0], [0], [stdout])
154 AT_CHECK([strip_xids < stdout | sed 's/00:0./00:0x/'], [0], [dnl
155 OFPST_PORT_DESC reply (OF1.5):
156 1(p1): addr:aa:55:aa:55:00:0x
157 config: 0
158 state: LIVE
159 speed: 0 Mbps now, 0 Mbps max
160 2(p2): addr:aa:55:aa:55:00:0x
161 config: 0
162 state: LIVE
163 speed: 0 Mbps now, 0 Mbps max
164 3(p3): addr:aa:55:aa:55:00:0x
165 config: 0
166 state: LIVE
167 speed: 0 Mbps now, 0 Mbps max
168 LOCAL(br0): addr:aa:55:aa:55:00:0x
169 config: 0
170 state: LIVE
171 speed: 0 Mbps now, 0 Mbps max
172 ])
173 AT_CHECK([ovs-ofctl -F OXM-OpenFlow15 -O OpenFlow15 -vwarn dump-ports-desc br0 2], [0], [stdout])
174 AT_CHECK([strip_xids < stdout | sed 's/00:0./00:0x/'], [0], [dnl
175 OFPST_PORT_DESC reply (OF1.5):
176 2(p2): addr:aa:55:aa:55:00:0x
177 config: 0
178 state: LIVE
179 speed: 0 Mbps now, 0 Mbps max
180 ])
181 OVS_VSWITCHD_STOP
182 AT_CLEANUP
183
184 dnl CHECK_QUEUE_STATS(label, option, format)
185 m4_define([CHECK_QUEUE_STATS], [
186 AT_SETUP([ofproto - queue stats - (OpenFlow $1)])
187 OVS_VSWITCHD_START
188
189 AT_CHECK([ovs-ofctl -O $2 queue-stats br0 | strip_xids], [0],
190 [OFPST_QUEUE reply$3: 1 queues
191 port LOCAL queue 0: bytes=?, pkts=?, errors=?, duration=?
192 ])
193
194 AT_CHECK([ovs-ofctl -O $2 queue-stats br0 LOCAL | strip_xids], [0],
195 [OFPST_QUEUE reply$3: 1 queues
196 port LOCAL queue 0: bytes=?, pkts=?, errors=?, duration=?
197 ])
198
199 AT_CHECK([ovs-ofctl -O $2 queue-stats br0 LOCAL 0 | strip_xids], [0],
200 [OFPST_QUEUE reply$3: 1 queues
201 port LOCAL queue 0: bytes=?, pkts=?, errors=?, duration=?
202 ])
203
204 AT_CHECK([ovs-ofctl -O $2 queue-stats br0 ANY 0 | strip_xids], [0],
205 [OFPST_QUEUE reply$3: 1 queues
206 port LOCAL queue 0: bytes=?, pkts=?, errors=?, duration=?
207 ])
208
209 AT_CHECK([ovs-ofctl -O $2 queue-stats br0 LOCAL 5 | strip_xids], [0],
210 [OFPT_ERROR$3: OFPQOFC_BAD_QUEUE
211 OFPST_QUEUE request$3: port=LOCAL queue=5
212 ])
213
214 AT_CHECK([ovs-ofctl -O $2 queue-stats br0 ANY 5 | strip_xids], [0],
215 [OFPT_ERROR$3: OFPQOFC_BAD_QUEUE
216 OFPST_QUEUE request$3: port=ANY queue=5
217 ])
218
219 AT_CHECK([ovs-ofctl -O $2 queue-stats br0 10 | strip_xids], [0],
220 [OFPT_ERROR$3: OFPQOFC_BAD_PORT
221 OFPST_QUEUE request$3: port=10 queue=ALL
222 ])
223 OVS_VSWITCHD_STOP
224 AT_CLEANUP
225 ])
226 CHECK_QUEUE_STATS([1.0], [OpenFlow10], [])
227 CHECK_QUEUE_STATS([1.1], [OpenFlow11], [ (OF1.1)])
228 CHECK_QUEUE_STATS([1.2], [OpenFlow12], [ (OF1.2)])
229 CHECK_QUEUE_STATS([1.3], [OpenFlow13], [ (OF1.3)])
230 CHECK_QUEUE_STATS([1.4], [OpenFlow14], [ (OF1.4)])
231
232 dnl This is really bare-bones.
233 dnl It at least checks request and reply serialization and deserialization.
234 AT_SETUP([ofproto - queue configuration - (OpenFlow 1.0)])
235 OVS_VSWITCHD_START
236 add_of_ports br0 1 2
237 AT_CHECK([ovs-ofctl queue-get-config br0 1], [0], [stdout])
238 AT_CHECK([strip_xids < stdout], [0], [dnl
239 OFPT_QUEUE_GET_CONFIG_REPLY: port=1
240 queue 0:
241 ])
242 AT_CHECK([ovs-ofctl queue-get-config br0], [0], [stdout])
243 AT_CHECK([strip_xids < stdout | sort], [0], [dnl
244 OFPT_QUEUE_GET_CONFIG_REPLY: port=1
245 OFPT_QUEUE_GET_CONFIG_REPLY: port=2
246 queue 0:
247 queue 0:
248 ])
249 AT_CHECK([ovs-ofctl queue-get-config br0 10], [0],
250 [OFPT_ERROR (xid=0x2): OFPQOFC_BAD_PORT
251 OFPT_QUEUE_GET_CONFIG_REQUEST (xid=0x2): port=10
252 ])
253 OVS_VSWITCHD_STOP
254 AT_CLEANUP
255
256 AT_SETUP([ofproto - queue configuration - (OpenFlow 1.1)])
257 OVS_VSWITCHD_START
258 add_of_ports br0 1 2
259 AT_CHECK([ovs-ofctl -O OpenFlow11 queue-get-config br0 1], [0], [stdout])
260 AT_CHECK([strip_xids < stdout], [0], [dnl
261 OFPT_QUEUE_GET_CONFIG_REPLY (OF1.1): port=1
262 queue 0:
263 ])
264 AT_CHECK([ovs-ofctl -O OpenFlow11 queue-get-config br0 10 | strip_xids], [0],
265 [OFPT_ERROR (OF1.1): OFPQOFC_BAD_PORT
266 OFPT_QUEUE_GET_CONFIG_REQUEST (OF1.1): port=10
267 ])
268 OVS_VSWITCHD_STOP
269 AT_CLEANUP
270
271 AT_SETUP([ofproto - queue configuration - (OpenFlow 1.2)])
272 OVS_VSWITCHD_START
273 add_of_ports br0 1 2
274 AT_CHECK([ovs-ofctl -O OpenFlow12 queue-get-config br0 1], [0], [stdout])
275 AT_CHECK([strip_xids < stdout], [0], [dnl
276 OFPT_QUEUE_GET_CONFIG_REPLY (OF1.2): port=1
277 queue 0:
278 ])
279 AT_CHECK([ovs-ofctl -O OpenFlow12 queue-get-config br0 ANY], [0], [stdout])
280 AT_CHECK([strip_xids < stdout], [0], [dnl
281 OFPT_QUEUE_GET_CONFIG_REPLY (OF1.2): port=ANY
282 queue 0:
283 queue 0:
284 queue 0:
285 ])
286 AT_CHECK([ovs-ofctl -O OpenFlow12 queue-get-config br0 10 | strip_xids], [0],
287 [OFPT_ERROR (OF1.2): OFPQOFC_BAD_PORT
288 OFPT_QUEUE_GET_CONFIG_REQUEST (OF1.2): port=10
289 ])
290 OVS_VSWITCHD_STOP
291 AT_CLEANUP
292
293 AT_SETUP([ofproto - queue configuration - (OpenFlow 1.4)])
294 OVS_VSWITCHD_START
295 add_of_ports br0 1 2
296
297 AT_CHECK([ovs-ofctl -O OpenFlow14 queue-get-config br0 any | strip_xids], [0],
298 [OFPST_QUEUE_DESC reply (OF1.4): port=1
299 queue 0:
300 port=2
301 queue 0:
302 port=LOCAL
303 queue 0:
304 ])
305
306 AT_CHECK([ovs-ofctl -O OpenFlow14 queue-get-config br0 1 | strip_xids], [0],
307 [OFPST_QUEUE_DESC reply (OF1.4): port=1
308 queue 0:
309 ])
310
311 AT_CHECK([ovs-ofctl -O OpenFlow14 queue-get-config br0 10 | strip_xids], [0],
312 [OFPT_ERROR (OF1.4): OFPQOFC_BAD_PORT
313 OFPST_QUEUE_DESC request (OF1.4): port=10
314 ])
315
316 AT_CHECK([ovs-ofctl -O OpenFlow14 queue-get-config br0 1 2 | strip_xids], [0],
317 [OFPT_ERROR (OF1.4): OFPQOFC_BAD_QUEUE
318 OFPST_QUEUE_DESC request (OF1.4): port=1 queue=2
319 ])
320 OVS_VSWITCHD_STOP
321 AT_CLEANUP
322
323 dnl This is really bare-bones.
324 dnl It at least checks request and reply serialization and deserialization.
325 dnl Actions definition listed in both supported formats (w/ actions=)
326 AT_SETUP([ofproto - del group (OpenFlow 1.0 extension)])
327 OVS_VSWITCHD_START
328 AT_DATA([groups.txt], [dnl
329 group_id=1233,type=select,selection_method=hash,bucket=output:10,bucket=output:11
330 group_id=1234,type=select,selection_method=hash,fields(eth_dst,ip_dst,tcp_dst),bucket=output:10,bucket=output:11
331 group_id=1235,type=all,bucket=actions=output:12,bucket=bucket_id:0,actions=output:10,bucket=bucket_id:1,actions=output:11
332 group_id=1236,type=select,selection_method=dp_hash,bucket=output:10,bucket=output:11
333 ])
334 AT_CHECK([ovs-ofctl -O OpenFlow10 -vwarn add-groups br0 groups.txt])
335 AT_CHECK([ovs-ofctl -O OpenFlow10 -vwarn dump-groups br0 1234], [0], [stdout])
336 AT_CHECK([strip_xids < stdout], [0], [dnl
337 NXST_GROUP_DESC reply:
338 group_id=1234,type=select,selection_method=hash,fields(eth_dst,ip_dst,tcp_dst),bucket=bucket_id:0,actions=output:10,bucket=bucket_id:1,actions=output:11
339 ])
340 AT_CHECK([ovs-ofctl -O OpenFlow10 -vwarn del-groups br0 group_id=1234])
341 AT_CHECK([ovs-ofctl -O OpenFlow10 -vwarn dump-groups br0], [0], [stdout])
342 AT_CHECK([strip_xids < stdout | sort], [0], [dnl
343 group_id=1233,type=select,selection_method=hash,bucket=bucket_id:0,actions=output:10,bucket=bucket_id:1,actions=output:11
344 group_id=1235,type=all,bucket=bucket_id:2,actions=output:12,bucket=bucket_id:0,actions=output:10,bucket=bucket_id:1,actions=output:11
345 group_id=1236,type=select,selection_method=dp_hash,bucket=bucket_id:0,actions=output:10,bucket=bucket_id:1,actions=output:11
346 NXST_GROUP_DESC reply:
347 ])
348 AT_CHECK([ovs-ofctl -O OpenFlow10 -vwarn del-groups br0 group_id=1234])
349 AT_CHECK([ovs-ofctl -O OpenFlow10 -vwarn dump-groups br0], [0], [stdout])
350 AT_CHECK([strip_xids < stdout | sort], [0], [dnl
351 group_id=1233,type=select,selection_method=hash,bucket=bucket_id:0,actions=output:10,bucket=bucket_id:1,actions=output:11
352 group_id=1235,type=all,bucket=bucket_id:2,actions=output:12,bucket=bucket_id:0,actions=output:10,bucket=bucket_id:1,actions=output:11
353 group_id=1236,type=select,selection_method=dp_hash,bucket=bucket_id:0,actions=output:10,bucket=bucket_id:1,actions=output:11
354 NXST_GROUP_DESC reply:
355 ])
356 AT_CHECK([ovs-ofctl -O OpenFlow10 -vwarn del-groups br0], [0])
357 AT_CHECK([ovs-ofctl -O OpenFlow10 -vwarn dump-groups br0], [0], [stdout])
358 AT_CHECK([strip_xids < stdout], [0], [dnl
359 NXST_GROUP_DESC reply:
360 ])
361 OVS_VSWITCHD_STOP
362 AT_CLEANUP
363
364 dnl This is really bare-bones.
365 dnl It at least checks request and reply serialization and deserialization.
366 dnl Actions definition listed in both supported formats (w/ actions=)
367 AT_SETUP([ofproto - del group (OpenFlow 1.1)])
368 OVS_VSWITCHD_START
369 AT_DATA([groups.txt], [dnl
370 group_id=1234,type=all,bucket=output:10
371 group_id=1235,type=all,bucket=actions=output:10
372 ])
373 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn add-groups br0 groups.txt])
374 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn dump-groups br0 ], [0], [stdout])
375 AT_CHECK([strip_xids < stdout | sort], [0], [dnl
376 group_id=1234,type=all,bucket=actions=output:10
377 group_id=1235,type=all,bucket=actions=output:10
378 OFPST_GROUP_DESC reply (OF1.1):
379 ])
380 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn del-groups br0 group_id=1234])
381 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn dump-groups br0], [0], [stdout])
382 AT_CHECK([strip_xids < stdout], [0], [dnl
383 OFPST_GROUP_DESC reply (OF1.1):
384 group_id=1235,type=all,bucket=actions=output:10
385 ])
386 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn del-groups br0 group_id=1234])
387 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn dump-groups br0], [0], [stdout])
388 AT_CHECK([strip_xids < stdout], [0], [dnl
389 OFPST_GROUP_DESC reply (OF1.1):
390 group_id=1235,type=all,bucket=actions=output:10
391 ])
392 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn del-groups br0], [0])
393 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn dump-groups br0], [0], [stdout])
394 AT_CHECK([strip_xids < stdout], [0], [dnl
395 OFPST_GROUP_DESC reply (OF1.1):
396 ])
397
398 # Negative test.
399 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn del-groups br0 group_id=0xfffffff0],
400 [1], [], [ovs-ofctl: invalid group id 4294967280
401 ])
402 OVS_VSWITCHD_STOP
403 AT_CLEANUP
404
405 dnl This is really bare-bones.
406 dnl It at least checks request and reply serialization and deserialization.
407 dnl Actions definition listed in both supported formats (w/ actions=)
408 AT_SETUP([ofproto - add indirect group])
409 OVS_VSWITCHD_START
410 dnl indirect group must have exactly one bucket
411 AT_DATA([stderr], [dnl
412 OFPT_ERROR (OF1.1) (xid=0x2): OFPGMFC_INVALID_GROUP
413 OFPT_GROUP_MOD (OF1.1) (xid=0x2): ***decode error: OFPGMFC_INVALID_GROUP***
414 ])
415 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn add-group br0 'group_id=1234,type=indirect'], [1], , [stderr])
416 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn add-group br0 'group_id=1235,type=indirect,bucket=output:10'])
417 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn add-group br0 'group_id=1236,type=indirect,bucket=output:10,bucket=output:11'], [1], , [stderr])
418 OVS_VSWITCHD_STOP
419 AT_CLEANUP
420
421 AT_SETUP([ofproto - group mod with mod and add_or_mod command])
422 OVS_VSWITCHD_START
423 dnl Check that mod-group for non-existing group fails without --may-create
424 AT_DATA([stderr], [dnl
425 OFPT_ERROR (OF1.3) (xid=0x2): OFPGMFC_UNKNOWN_GROUP
426 OFPT_GROUP_MOD (OF1.3) (xid=0x2):
427 MOD group_id=1234,type=indirect,bucket=actions=output:2
428 ])
429 AT_CHECK([ovs-ofctl -O OpenFlow13 -vwarn mod-group br0 'group_id=1234,type=indirect,bucket=actions=2'], [1], , [stderr])
430 dnl Check that mod-group for non-existing group succeeds with --may-create
431 AT_CHECK([ovs-ofctl -O OpenFlow13 -vwarn --may-create mod-group br0 'group_id=1234,type=indirect,bucket=actions=2'])
432 AT_CHECK([ovs-ofctl -O OpenFlow13 -vwarn dump-groups br0], [0], [stdout])
433 AT_CHECK([strip_xids < stdout], [0], [dnl
434 OFPST_GROUP_DESC reply (OF1.3):
435 group_id=1234,type=indirect,bucket=actions=output:2
436 ])
437 dnl Check that mod-group for existing group succeeds with --may-create
438 AT_CHECK([ovs-ofctl -O OpenFlow13 -vwarn --may-create mod-group br0 'group_id=1234,type=indirect,bucket=actions=3'])
439 AT_CHECK([ovs-ofctl -O OpenFlow13 -vwarn dump-groups br0], [0], [stdout])
440 AT_CHECK([strip_xids < stdout], [0], [dnl
441 OFPST_GROUP_DESC reply (OF1.3):
442 group_id=1234,type=indirect,bucket=actions=output:3
443 ])
444 OVS_VSWITCHD_STOP
445 AT_CLEANUP
446
447 dnl This is really bare-bones.
448 dnl It at least checks request and reply serialization and deserialization.
449 dnl Actions definition listed in both supported formats (w/ actions=)
450 AT_SETUP([ofproto - del group (OpenFlow 1.5)])
451 OVS_VSWITCHD_START
452 AT_DATA([groups.txt], [dnl
453 group_id=1233,type=select,selection_method=hash,bucket=output:10,bucket=output:11
454 group_id=1234,type=select,selection_method=hash,fields(eth_dst,ip_dst,tcp_dst),bucket=output:10,bucket=output:11
455 group_id=1235,type=all,bucket=actions=output:12,bucket=bucket_id:0,actions=output:10,bucket=bucket_id:1,actions=output:11
456 group_id=1236,type=select,selection_method=dp_hash,bucket=output:10,bucket=output:11
457 ])
458 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn add-groups br0 groups.txt])
459 AT_CHECK([ovs-ofctl -F OXM-OpenFlow15 -O OpenFlow15 -vwarn dump-groups br0 1234], [0], [stdout])
460 AT_CHECK([strip_xids < stdout], [0], [dnl
461 OFPST_GROUP_DESC reply (OF1.5):
462 group_id=1234,type=select,selection_method=hash,fields(eth_dst,ip_dst,tcp_dst),bucket=bucket_id:0,actions=output:10,bucket=bucket_id:1,actions=output:11
463 ])
464 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn del-groups br0 group_id=1234])
465 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn dump-groups br0], [0], [stdout])
466 AT_CHECK([strip_xids < stdout | sort], [0], [dnl
467 group_id=1233,type=select,selection_method=hash,bucket=bucket_id:0,actions=output:10,bucket=bucket_id:1,actions=output:11
468 group_id=1235,type=all,bucket=bucket_id:2,actions=output:12,bucket=bucket_id:0,actions=output:10,bucket=bucket_id:1,actions=output:11
469 group_id=1236,type=select,selection_method=dp_hash,bucket=bucket_id:0,actions=output:10,bucket=bucket_id:1,actions=output:11
470 OFPST_GROUP_DESC reply (OF1.5):
471 ])
472 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn del-groups br0 group_id=1234])
473 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn dump-groups br0], [0], [stdout])
474 AT_CHECK([strip_xids < stdout | sort], [0], [dnl
475 group_id=1233,type=select,selection_method=hash,bucket=bucket_id:0,actions=output:10,bucket=bucket_id:1,actions=output:11
476 group_id=1235,type=all,bucket=bucket_id:2,actions=output:12,bucket=bucket_id:0,actions=output:10,bucket=bucket_id:1,actions=output:11
477 group_id=1236,type=select,selection_method=dp_hash,bucket=bucket_id:0,actions=output:10,bucket=bucket_id:1,actions=output:11
478 OFPST_GROUP_DESC reply (OF1.5):
479 ])
480 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn del-groups br0], [0])
481 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn dump-groups br0], [0], [stdout])
482 AT_CHECK([strip_xids < stdout], [0], [dnl
483 OFPST_GROUP_DESC reply (OF1.5):
484 ])
485 OVS_VSWITCHD_STOP
486 AT_CLEANUP
487
488 dnl This is really bare-bones.
489 dnl It at least checks request and reply serialization and deserialization.
490 AT_SETUP([ofproto - del group deletes flows])
491 OVS_VSWITCHD_START
492 AT_DATA([groups.txt], [dnl
493 group_id=1234,type=all,bucket=output:10
494 group_id=1235,type=all,bucket=output:10
495 ])
496 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn add-groups br0 groups.txt])
497 AT_DATA([flows.txt], [dnl
498 tcp actions=group:1234
499 table=2 udp actions=group:1235
500 ])
501 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn add-flows br0 flows.txt])
502 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn dump-flows br0 | ofctl_strip | sort],
503 [0], [dnl
504 table=2, udp actions=group:1235
505 tcp actions=group:1234
506 OFPST_FLOW reply (OF1.1):
507 ])
508 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn del-groups br0 group_id=1234])
509 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn dump-flows br0 | ofctl_strip | sort],
510 [0], [dnl
511 table=2, udp actions=group:1235
512 OFPST_FLOW reply (OF1.1):
513 ])
514 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn del-groups br0 group_id=1234])
515 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn dump-flows br0 | ofctl_strip | sort],
516 [0], [dnl
517 table=2, udp actions=group:1235
518 OFPST_FLOW reply (OF1.1):
519 ])
520 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn del-groups br0])
521 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn dump-flows br0 | ofctl_strip | sort],
522 [0], [dnl
523 OFPST_FLOW reply (OF1.1):
524 ])
525 OVS_VSWITCHD_STOP
526 AT_CLEANUP
527
528 dnl This is really bare-bones.
529 dnl It at least checks request and reply serialization and deserialization.
530 dnl Actions definition listed in both supported formats (w/ actions=)
531 AT_SETUP([ofproto - insert group buckets])
532 OVS_VSWITCHD_START
533 # Add group with no buckets.
534 AT_DATA([groups.txt], [dnl
535 group_id=1234,type=all
536 ])
537 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn add-groups br0 groups.txt])
538 AT_CHECK([ovs-ofctl -F OXM-OpenFlow15 -O OpenFlow15 -vwarn dump-groups br0 1234], [0], [stdout])
539 AT_CHECK([strip_xids < stdout], [0], [dnl
540 OFPST_GROUP_DESC reply (OF1.5):
541 group_id=1234,type=all
542 ])
543
544 # Add two buckets, using "last".
545 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn insert-buckets br0 group_id=1234,command_bucket_id=last,bucket=bucket_id:10,actions=output:10,bucket=bucket_id:11,actions=output:11])
546 AT_CHECK([ovs-ofctl -F OXM-OpenFlow15 -O OpenFlow15 -vwarn dump-groups br0 1234], [0], [stdout])
547 AT_CHECK([strip_xids < stdout], [0], [dnl
548 OFPST_GROUP_DESC reply (OF1.5):
549 group_id=1234,type=all,bucket=bucket_id:10,actions=output:10,bucket=bucket_id:11,actions=output:11
550 ])
551
552 # Start over again, then add two buckets using "first".
553 AT_CHECK([ovs-ofctl -O OpenFlow15 --strict del-groups br0 group_id=1234])
554 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn add-group br0 group_id=1234,type=all])
555 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn insert-buckets br0 group_id=1234,command_bucket_id=first,bucket=bucket_id:10,actions=output:10,bucket=bucket_id:11,actions=output:11])
556 AT_CHECK([ovs-ofctl -F OXM-OpenFlow15 -O OpenFlow15 -vwarn dump-groups br0 1234], [0], [stdout])
557 AT_CHECK([strip_xids < stdout], [0], [dnl
558 OFPST_GROUP_DESC reply (OF1.5):
559 group_id=1234,type=all,bucket=bucket_id:10,actions=output:10,bucket=bucket_id:11,actions=output:11
560 ])
561
562 # Add two more buckets before the existing ones.
563 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn insert-buckets br0 group_id=1234,command_bucket_id=first,bucket=bucket_id:0,actions=output:0,bucket=bucket_id:1,actions=output:1])
564 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn dump-groups br0], [0], [stdout])
565 AT_CHECK([strip_xids < stdout], [0], [dnl
566 OFPST_GROUP_DESC reply (OF1.5):
567 group_id=1234,type=all,bucket=bucket_id:0,actions=output:0,bucket=bucket_id:1,actions=output:1,bucket=bucket_id:10,actions=output:10,bucket=bucket_id:11,actions=output:11
568 ])
569
570 # Add another bucket at the end.
571 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn insert-buckets br0 group_id=1234,command_bucket_id=last,bucket=bucket_id:14,actions=output:14,bucket=bucket_id:15,actions=output:15])
572 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn dump-groups br0], [0], [stdout])
573 AT_CHECK([strip_xids < stdout], [0], [dnl
574 OFPST_GROUP_DESC reply (OF1.5):
575 group_id=1234,type=all,bucket=bucket_id:0,actions=output:0,bucket=bucket_id:1,actions=output:1,bucket=bucket_id:10,actions=output:10,bucket=bucket_id:11,actions=output:11,bucket=bucket_id:14,actions=output:14,bucket=bucket_id:15,actions=output:15
576 ])
577
578 # Verify that duplicate bucket IDs are rejected.
579 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn insert-buckets br0 group_id=1234,command_bucket_id=last,bucket=bucket_id:14,actions=output:14,bucket=bucket_id:15,actions=output:15], [1], [], [stderr])
580 AT_CHECK([strip_xids < stderr | sed '/truncated/,$d'], [0], [dnl
581 OFPT_ERROR (OF1.5): OFPGMFC_BUCKET_EXISTS
582 OFPT_GROUP_MOD (OF1.5):
583 INSERT_BUCKET command_bucket_id:last,group_id=1234,bucket=bucket_id:14,actions=output:14,bucket=bucket_id:15,actions=output:15
584 ])
585
586
587 # Add another bucket just before bucket 15.
588 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn insert-buckets br0 group_id=1234,command_bucket_id=15])
589 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn dump-groups br0], [0], [stdout])
590 AT_CHECK([strip_xids < stdout], [0], [dnl
591 OFPST_GROUP_DESC reply (OF1.5):
592 group_id=1234,type=all,bucket=bucket_id:0,actions=output:0,bucket=bucket_id:1,actions=output:1,bucket=bucket_id:10,actions=output:10,bucket=bucket_id:11,actions=output:11,bucket=bucket_id:14,actions=output:14,bucket=bucket_id:15,actions=output:15
593 ])
594
595 # Add two more buckets just before bucket 11,
596 # getting the command from a file.
597 AT_DATA([buckets.txt], [dnl
598 group_id=1234,command_bucket_id=11,bucket=bucket_id:12,actions=output:12,bucket=bucket_id:13,actions=output:13
599 ])
600 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn insert-buckets br0 - < buckets.txt])
601 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn dump-groups br0], [0], [stdout])
602 AT_CHECK([strip_xids < stdout], [0], [dnl
603 OFPST_GROUP_DESC reply (OF1.5):
604 group_id=1234,type=all,bucket=bucket_id:0,actions=output:0,bucket=bucket_id:1,actions=output:1,bucket=bucket_id:10,actions=output:10,bucket=bucket_id:11,actions=output:11,bucket=bucket_id:12,actions=output:12,bucket=bucket_id:13,actions=output:13,bucket=bucket_id:14,actions=output:14,bucket=bucket_id:15,actions=output:15
605 ])
606
607 # Add yet two more buckets.
608 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn insert-buckets br0 group_id=1234,command_bucket_id=15,bucket=bucket_id:20,actions=output:20,bucket=bucket_id:21,actions=output:21])
609 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn dump-groups br0], [0], [stdout])
610 AT_CHECK([strip_xids < stdout], [0], [dnl
611 OFPST_GROUP_DESC reply (OF1.5):
612 group_id=1234,type=all,bucket=bucket_id:0,actions=output:0,bucket=bucket_id:1,actions=output:1,bucket=bucket_id:10,actions=output:10,bucket=bucket_id:11,actions=output:11,bucket=bucket_id:12,actions=output:12,bucket=bucket_id:13,actions=output:13,bucket=bucket_id:14,actions=output:14,bucket=bucket_id:15,actions=output:15,bucket=bucket_id:20,actions=output:20,bucket=bucket_id:21,actions=output:21
613 ])
614
615 # Delete groups.
616 AT_CHECK([ovs-ofctl -O OpenFlow15 del-groups br0])
617
618 # Add "fast_failover" group, then insert a bucket into it and make
619 # sure that the type of the group doesn't change. (There was a bug
620 # that caused this to happen.)
621 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn add-group br0 group_id=1234,type=ff])
622 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn dump-groups br0], [0], [stdout])
623 AT_CHECK([strip_xids < stdout], [0], [dnl
624 OFPST_GROUP_DESC reply (OF1.5):
625 group_id=1234,type=ff
626 ])
627 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn insert-buckets br0 group_id=1234,command_bucket_id=first,bucket=bucket_id:20,actions=output:20,bucket=bucket_id:21,actions=output:21])
628 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn dump-groups br0], [0], [stdout])
629 AT_CHECK([strip_xids < stdout], [0], [dnl
630 OFPST_GROUP_DESC reply (OF1.5):
631 group_id=1234,type=ff,bucket=bucket_id:20,actions=output:20,bucket=bucket_id:21,actions=output:21
632 ])
633
634 # Negative tests.
635 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn insert-buckets br0 group_id=1234,command_bucket_id=123,type=indirect,bucket=bucket_id:0,actions=output:0,bucket=bucket_id:1,actions=output:1], [1], [],
636 [ovs-ofctl: type is not needed
637 ])
638 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn insert-buckets br0 group_id=1234,command_bucket_id=123,selection_method=dp_hash,type=indirect,bucket=bucket_id:0,actions=output:0,bucket=bucket_id:1,actions=output:1], [1], [],
639 [ovs-ofctl: selection method is not needed
640 ])
641 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn insert-buckets br0 group_id=1234,command_bucket_id=0xffffff01,bucket=bucket_id:0,actions=output:0,bucket=bucket_id:1,actions=output:1], [1], [],
642 [ovs-ofctl: invalid command bucket id 4294967041
643 ])
644 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn insert-buckets br0 group_id=1234,command_bucket_id=first,bucket=bucket_id:0,actions=output:0,bucket=bucket_id:1,actions=output:1], [1], [],
645 [ovs-ofctl: insert-bucket needs OpenFlow 1.5 or later ('-O OpenFlow15')
646 ])
647
648 # Verify insert-buckets command to insert bucket with weight value for select group.
649 AT_CHECK([ovs-ofctl -O OpenFlow15 --strict del-groups br0 group_id=1234])
650 AT_DATA([groups.txt], [dnl
651 group_id=1234,type=select,selection_method=hash,bucket=bucket_id=1,weight:100,output:11
652 ])
653 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn add-groups br0 groups.txt])
654 AT_CHECK([ovs-ofctl -O OpenFlow15 insert-buckets br0 group_id=1234,command_bucket_id=last,bucket=bucket_id=2,weight=100,actions=output:11])
655 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn dump-groups br0], [0], [stdout])
656 AT_CHECK([strip_xids < stdout], [0], [dnl
657 OFPST_GROUP_DESC reply (OF1.5):
658 group_id=1234,type=select,selection_method=hash,bucket=bucket_id:1,weight:100,actions=output:11,bucket=bucket_id:2,weight:100,actions=output:11
659 ])
660
661 OVS_VSWITCHD_STOP
662 AT_CLEANUP
663
664 dnl This is really bare-bones.
665 dnl It at least checks request and reply serialization and deserialization.
666 dnl Actions definition listed in both supported formats (w/ actions=)
667 AT_SETUP([ofproto - remove group buckets])
668 OVS_VSWITCHD_START
669 AT_DATA([groups.txt], [dnl
670 group_id=1234,type=all,bucket=bucket_id:10,actions=output:10,bucket=bucket_id:11,actions=output:11,bucket=bucket_id:12,actions=output:12,bucket=bucket_id:13,actions=output:13,bucket=bucket_id:14,actions=output:14,bucket=bucket_id:15,actions=output:15,bucket=bucket_id:16,actions=output:16
671 ])
672 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn add-groups br0 groups.txt])
673 AT_CHECK([ovs-ofctl -F OXM-OpenFlow15 -O OpenFlow15 -vwarn dump-groups br0 1234], [0], [stdout])
674 AT_CHECK([strip_xids < stdout], [0], [dnl
675 OFPST_GROUP_DESC reply (OF1.5):
676 group_id=1234,type=all,bucket=bucket_id:10,actions=output:10,bucket=bucket_id:11,actions=output:11,bucket=bucket_id:12,actions=output:12,bucket=bucket_id:13,actions=output:13,bucket=bucket_id:14,actions=output:14,bucket=bucket_id:15,actions=output:15,bucket=bucket_id:16,actions=output:16
677 ])
678 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn remove-buckets br0 group_id=1234,command_bucket_id=first])
679 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn dump-groups br0], [0], [stdout])
680 AT_CHECK([strip_xids < stdout], [0], [dnl
681 OFPST_GROUP_DESC reply (OF1.5):
682 group_id=1234,type=all,bucket=bucket_id:11,actions=output:11,bucket=bucket_id:12,actions=output:12,bucket=bucket_id:13,actions=output:13,bucket=bucket_id:14,actions=output:14,bucket=bucket_id:15,actions=output:15,bucket=bucket_id:16,actions=output:16
683 ])
684 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn remove-buckets br0 group_id=1234,command_bucket_id=last])
685 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn dump-groups br0], [0], [stdout])
686 AT_CHECK([strip_xids < stdout], [0], [dnl
687 OFPST_GROUP_DESC reply (OF1.5):
688 group_id=1234,type=all,bucket=bucket_id:11,actions=output:11,bucket=bucket_id:12,actions=output:12,bucket=bucket_id:13,actions=output:13,bucket=bucket_id:14,actions=output:14,bucket=bucket_id:15,actions=output:15
689 ])
690 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn remove-buckets br0 group_id=1234,command_bucket_id=13])
691 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn dump-groups br0], [0], [stdout])
692 AT_CHECK([strip_xids < stdout], [0], [dnl
693 OFPST_GROUP_DESC reply (OF1.5):
694 group_id=1234,type=all,bucket=bucket_id:11,actions=output:11,bucket=bucket_id:12,actions=output:12,bucket=bucket_id:14,actions=output:14,bucket=bucket_id:15,actions=output:15
695 ])
696 AT_DATA([buckets.txt], [dnl
697 group_id=1234
698 ])
699 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn remove-buckets br0 - < buckets.txt])
700 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn dump-groups br0], [0], [stdout])
701 AT_CHECK([strip_xids < stdout], [0], [dnl
702 OFPST_GROUP_DESC reply (OF1.5):
703 group_id=1234,type=all
704 ])
705 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn remove-buckets br0 group_id=1234,command_bucket_id=first])
706 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn remove-buckets br0 group_id=1234,command_bucket_id=last])
707 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn remove-buckets br0 group_id=1234,command_bucket_id=all])
708 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn remove-buckets br0 group_id=1234,command_bucket_id=1], [1], [], [stderr])
709 AT_CHECK([ofctl_strip < stderr], [0], [dnl
710 OFPT_ERROR (OF1.5): OFPGMFC_UNKNOWN_BUCKET
711 OFPT_GROUP_MOD (OF1.5):
712 REMOVE_BUCKET command_bucket_id:1,group_id=1234
713 ])
714 # Negative test.
715 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn remove-buckets br0 group_id=1234,command_bucket_id=last], [1], [],
716 [ovs-ofctl: none of the usable flow formats (OpenFlow10,NXM,OXM-OpenFlow15) is among the allowed flow formats (OpenFlow11)
717 ])
718 OVS_VSWITCHD_STOP
719 AT_CLEANUP
720
721 AT_SETUP([ofproto - bundle del group (OpenFlow 1.3)])
722 OVS_VSWITCHD_START
723 AT_DATA([groups.txt], [dnl
724 group_id=1234,type=all,bucket=output:10
725 group_id=1235,type=all,bucket=actions=output:10
726 ])
727 AT_CHECK([ovs-ofctl --bundle -O OpenFlow13 -vwarn add-groups br0 groups.txt])
728 AT_CHECK([ovs-ofctl -O OpenFlow13 -vwarn dump-groups br0 ], [0], [stdout])
729 AT_CHECK([strip_xids < stdout | sort], [0], [dnl
730 group_id=1234,type=all,bucket=actions=output:10
731 group_id=1235,type=all,bucket=actions=output:10
732 OFPST_GROUP_DESC reply (OF1.3):
733 ])
734 AT_CHECK([ovs-ofctl --bundle -O OpenFlow13 -vwarn del-groups br0 group_id=1234])
735 AT_CHECK([ovs-ofctl -O OpenFlow13 -vwarn dump-groups br0], [0], [stdout])
736 AT_CHECK([strip_xids < stdout], [0], [dnl
737 OFPST_GROUP_DESC reply (OF1.3):
738 group_id=1235,type=all,bucket=actions=output:10
739 ])
740 AT_CHECK([ovs-ofctl --bundle -O OpenFlow13 -vwarn del-groups br0 group_id=1234])
741 AT_CHECK([ovs-ofctl -O OpenFlow13 -vwarn dump-groups br0], [0], [stdout])
742 AT_CHECK([strip_xids < stdout], [0], [dnl
743 OFPST_GROUP_DESC reply (OF1.3):
744 group_id=1235,type=all,bucket=actions=output:10
745 ])
746 AT_CHECK([ovs-ofctl --bundle -O OpenFlow13 -vwarn del-groups br0], [0])
747 AT_CHECK([ovs-ofctl -O OpenFlow13 -vwarn dump-groups br0], [0], [stdout])
748 AT_CHECK([strip_xids < stdout], [0], [dnl
749 OFPST_GROUP_DESC reply (OF1.3):
750 ])
751
752 # Negative test.
753 AT_CHECK([ovs-ofctl --bundle -O OpenFlow13 -vwarn del-groups br0 group_id=0xfffffff0],
754 [1], [], [ovs-ofctl: invalid group id 4294967280
755 ])
756 OVS_VSWITCHD_STOP
757 AT_CLEANUP
758
759 AT_SETUP([ofproto - bundle add indirect group])
760 OVS_VSWITCHD_START
761 dnl indirect group must have exactly one bucket
762 AT_DATA([stderr], [dnl
763 OFPT_ERROR (OF1.4) (xid=0x2): OFPGMFC_INVALID_GROUP
764 OFPT_BUNDLE_ADD_MESSAGE (OF1.4) (xid=0x2):
765 bundle_id=0 flags=atomic ordered
766 OFPT_GROUP_MOD (OF1.4) (xid=0x2): ***decode error: OFPGMFC_INVALID_GROUP***
767 ])
768 AT_CHECK([ovs-ofctl --bundle -vwarn add-group br0 'group_id=1234,type=indirect'], [1], , [stderr])
769 AT_CHECK([ovs-ofctl --bundle -vwarn add-group br0 'group_id=1235,type=indirect,bucket=output:10'])
770 AT_CHECK([ovs-ofctl --bundle -vwarn add-group br0 'group_id=1236,type=indirect,bucket=output:10,bucket=output:11'], [1], , [stderr])
771 OVS_VSWITCHD_STOP
772 AT_CLEANUP
773
774 AT_SETUP([ofproto - bundle group mod with mod and add_or_mod command])
775 OVS_VSWITCHD_START
776 dnl Check that mod-group for non-existing group fails without --may-create
777 AT_DATA([stderr], [dnl
778 OFPT_ERROR (OF1.4) (xid=0x2): OFPGMFC_UNKNOWN_GROUP
779 OFPT_GROUP_MOD (OF1.4) (xid=0x2):
780 MOD group_id=1234,type=indirect,bucket=actions=output:2
781 ])
782 AT_CHECK([ovs-ofctl --bundle -vwarn mod-group br0 'group_id=1234,type=indirect,bucket=actions=2'], [1], , [stderr])
783 dnl Check that mod-group for non-existing group succeeds with --may-create
784 AT_CHECK([ovs-ofctl --bundle -vwarn --may-create mod-group br0 'group_id=1234,type=indirect,bucket=actions=2'])
785 AT_CHECK([ovs-ofctl -O OpenFlow14 -vwarn dump-groups br0], [0], [stdout])
786 AT_CHECK([strip_xids < stdout], [0], [dnl
787 OFPST_GROUP_DESC reply (OF1.4):
788 group_id=1234,type=indirect,bucket=actions=output:2
789 ])
790 dnl Check that mod-group for existing group succeeds with --may-create
791 AT_CHECK([ovs-ofctl --bundle -vwarn --may-create mod-group br0 'group_id=1234,type=indirect,bucket=actions=3'])
792 AT_CHECK([ovs-ofctl -O OpenFlow14 -vwarn dump-groups br0], [0], [stdout])
793 AT_CHECK([strip_xids < stdout], [0], [dnl
794 OFPST_GROUP_DESC reply (OF1.4):
795 group_id=1234,type=indirect,bucket=actions=output:3
796 ])
797 OVS_VSWITCHD_STOP
798 AT_CLEANUP
799
800 AT_SETUP([ofproto - bundle del group (OpenFlow 1.5)])
801 OVS_VSWITCHD_START
802 AT_DATA([groups.txt], [dnl
803 group_id=1233,type=select,selection_method=hash,bucket=output:10,bucket=output:11
804 group_id=1234,type=select,selection_method=hash,fields(eth_dst,ip_dst,tcp_dst),bucket=output:10,bucket=output:11
805 group_id=1235,type=all,bucket=actions=output:12,bucket=bucket_id:0,actions=output:10,bucket=bucket_id:1,actions=output:11
806 ])
807 AT_CHECK([ovs-ofctl --bundle -O OpenFlow15 -vwarn add-groups br0 groups.txt])
808 AT_CHECK([ovs-ofctl -F OXM-OpenFlow15 -O OpenFlow15 -vwarn dump-groups br0 1234], [0], [stdout])
809 AT_CHECK([strip_xids < stdout], [0], [dnl
810 OFPST_GROUP_DESC reply (OF1.5):
811 group_id=1234,type=select,selection_method=hash,fields(eth_dst,ip_dst,tcp_dst),bucket=bucket_id:0,actions=output:10,bucket=bucket_id:1,actions=output:11
812 ])
813 AT_CHECK([ovs-ofctl --bundle -O OpenFlow15 -vwarn del-groups br0 group_id=1234])
814 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn dump-groups br0], [0], [stdout])
815 AT_CHECK([strip_xids < stdout | sort], [0], [dnl
816 group_id=1233,type=select,selection_method=hash,bucket=bucket_id:0,actions=output:10,bucket=bucket_id:1,actions=output:11
817 group_id=1235,type=all,bucket=bucket_id:2,actions=output:12,bucket=bucket_id:0,actions=output:10,bucket=bucket_id:1,actions=output:11
818 OFPST_GROUP_DESC reply (OF1.5):
819 ])
820 AT_CHECK([ovs-ofctl --bundle -O OpenFlow15 -vwarn del-groups br0 group_id=1234])
821 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn dump-groups br0], [0], [stdout])
822 AT_CHECK([strip_xids < stdout | sort], [0], [dnl
823 group_id=1233,type=select,selection_method=hash,bucket=bucket_id:0,actions=output:10,bucket=bucket_id:1,actions=output:11
824 group_id=1235,type=all,bucket=bucket_id:2,actions=output:12,bucket=bucket_id:0,actions=output:10,bucket=bucket_id:1,actions=output:11
825 OFPST_GROUP_DESC reply (OF1.5):
826 ])
827 AT_CHECK([ovs-ofctl --bundle -O OpenFlow15 -vwarn del-groups br0], [0])
828 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn dump-groups br0], [0], [stdout])
829 AT_CHECK([strip_xids < stdout], [0], [dnl
830 OFPST_GROUP_DESC reply (OF1.5):
831 ])
832 OVS_VSWITCHD_STOP
833 AT_CLEANUP
834
835 AT_SETUP([ofproto - bundle del group deletes flows])
836 OVS_VSWITCHD_START
837 AT_DATA([groups.txt], [dnl
838 group_id=1234,type=all,bucket=output:10
839 group_id=1235,type=all,bucket=output:10
840 ])
841 AT_CHECK([ovs-ofctl --bundle -vwarn add-groups br0 groups.txt])
842 AT_DATA([flows.txt], [dnl
843 tcp actions=group:1234
844 table=2 udp actions=group:1235
845 ])
846 AT_CHECK([ovs-ofctl --bundle -vwarn add-flows br0 flows.txt])
847 AT_CHECK([ovs-ofctl -O OpenFlow14 -vwarn dump-flows br0 | ofctl_strip | sort],
848 [0], [dnl
849 table=2, udp actions=group:1235
850 tcp actions=group:1234
851 OFPST_FLOW reply (OF1.4):
852 ])
853 AT_CHECK([ovs-ofctl --bundle -vwarn del-groups br0 group_id=1234])
854 AT_CHECK([ovs-ofctl -O OpenFlow14 -vwarn dump-flows br0 | ofctl_strip | sort],
855 [0], [dnl
856 table=2, udp actions=group:1235
857 OFPST_FLOW reply (OF1.4):
858 ])
859 AT_CHECK([ovs-ofctl --bundle -vwarn del-groups br0 group_id=1234])
860 AT_CHECK([ovs-ofctl -O OpenFlow14 -vwarn dump-flows br0 | ofctl_strip | sort],
861 [0], [dnl
862 table=2, udp actions=group:1235
863 OFPST_FLOW reply (OF1.4):
864 ])
865 AT_CHECK([ovs-ofctl --bundle -vwarn del-groups br0])
866 AT_CHECK([ovs-ofctl -O OpenFlow14 -vwarn dump-flows br0 | ofctl_strip | sort],
867 [0], [dnl
868 OFPST_FLOW reply (OF1.4):
869 ])
870 OVS_VSWITCHD_STOP
871 AT_CLEANUP
872
873 dnl This is really bare-bones.
874 dnl It at least checks request and reply serialization and deserialization.
875 dnl Actions definition listed in both supported formats (w/ actions=)
876 AT_SETUP([ofproto - bundle insert group buckets])
877 OVS_VSWITCHD_START
878 # Add group with no buckets.
879 AT_DATA([groups.txt], [dnl
880 group_id=1234,type=all
881 ])
882 AT_CHECK([ovs-ofctl --bundle -O OpenFlow15 -vwarn add-groups br0 groups.txt])
883 AT_CHECK([ovs-ofctl -F OXM-OpenFlow15 -O OpenFlow15 -vwarn dump-groups br0 1234], [0], [stdout])
884 AT_CHECK([strip_xids < stdout], [0], [dnl
885 OFPST_GROUP_DESC reply (OF1.5):
886 group_id=1234,type=all
887 ])
888
889 # Add two buckets, using "last".
890 AT_CHECK([ovs-ofctl --bundle -O OpenFlow15 -vwarn insert-buckets br0 group_id=1234,command_bucket_id=last,bucket=bucket_id:10,actions=output:10,bucket=bucket_id:11,actions=output:11])
891 AT_CHECK([ovs-ofctl -F OXM-OpenFlow15 -O OpenFlow15 -vwarn dump-groups br0 1234], [0], [stdout])
892 AT_CHECK([strip_xids < stdout], [0], [dnl
893 OFPST_GROUP_DESC reply (OF1.5):
894 group_id=1234,type=all,bucket=bucket_id:10,actions=output:10,bucket=bucket_id:11,actions=output:11
895 ])
896
897 # Start over again, then add two buckets using "first".
898 AT_DATA([groups.txt], [dnl
899 delete group_id=1234
900 add group_id=1234,type=all
901 insert_bucket group_id=1234,command_bucket_id=first,bucket=bucket_id:10,actions=output:10,bucket=bucket_id:11,actions=output:11
902 ])
903 AT_CHECK([ovs-ofctl --bundle -O OpenFlow15 -vwarn add-groups br0 groups.txt])
904 AT_CHECK([ovs-ofctl -F OXM-OpenFlow15 -O OpenFlow15 -vwarn dump-groups br0 1234], [0], [stdout])
905 AT_CHECK([strip_xids < stdout], [0], [dnl
906 OFPST_GROUP_DESC reply (OF1.5):
907 group_id=1234,type=all,bucket=bucket_id:10,actions=output:10,bucket=bucket_id:11,actions=output:11
908 ])
909
910 # Add two more buckets before the existing ones.
911 AT_CHECK([ovs-ofctl --bundle -O OpenFlow15 -vwarn insert-buckets br0 group_id=1234,command_bucket_id=first,bucket=bucket_id:0,actions=output:0,bucket=bucket_id:1,actions=output:1])
912 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn dump-groups br0], [0], [stdout])
913 AT_CHECK([strip_xids < stdout], [0], [dnl
914 OFPST_GROUP_DESC reply (OF1.5):
915 group_id=1234,type=all,bucket=bucket_id:0,actions=output:0,bucket=bucket_id:1,actions=output:1,bucket=bucket_id:10,actions=output:10,bucket=bucket_id:11,actions=output:11
916 ])
917
918 # Add another bucket at the end.
919 AT_CHECK([ovs-ofctl --bundle -O OpenFlow15 -vwarn insert-buckets br0 group_id=1234,command_bucket_id=last,bucket=bucket_id:14,actions=output:14,bucket=bucket_id:15,actions=output:15])
920 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn dump-groups br0], [0], [stdout])
921 AT_CHECK([strip_xids < stdout], [0], [dnl
922 OFPST_GROUP_DESC reply (OF1.5):
923 group_id=1234,type=all,bucket=bucket_id:0,actions=output:0,bucket=bucket_id:1,actions=output:1,bucket=bucket_id:10,actions=output:10,bucket=bucket_id:11,actions=output:11,bucket=bucket_id:14,actions=output:14,bucket=bucket_id:15,actions=output:15
924 ])
925
926 # Verify that duplicate bucket IDs are rejected.
927 AT_CHECK([ovs-ofctl --bundle -O OpenFlow15 -vwarn insert-buckets br0 group_id=1234,command_bucket_id=last,bucket=bucket_id:14,actions=output:14,bucket=bucket_id:15,actions=output:15], [1], [], [stderr])
928 AT_CHECK([strip_xids < stderr | sed '/talking to/,$d'], [0], [dnl
929 Error OFPGMFC_BUCKET_EXISTS for: OFPT_GROUP_MOD (OF1.5):
930 INSERT_BUCKET command_bucket_id:last,group_id=1234,bucket=bucket_id:14,actions=output:14,bucket=bucket_id:15,actions=output:15
931 Error OFPBFC_MSG_FAILED for: OFPT_BUNDLE_CONTROL (OF1.5):
932 bundle_id=0 type=COMMIT_REQUEST flags=atomic ordered
933 ])
934
935 # Add another bucket just before bucket 15.
936 AT_CHECK([ovs-ofctl --bundle -O OpenFlow15 -vwarn insert-buckets br0 group_id=1234,command_bucket_id=15])
937 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn dump-groups br0], [0], [stdout])
938 AT_CHECK([strip_xids < stdout], [0], [dnl
939 OFPST_GROUP_DESC reply (OF1.5):
940 group_id=1234,type=all,bucket=bucket_id:0,actions=output:0,bucket=bucket_id:1,actions=output:1,bucket=bucket_id:10,actions=output:10,bucket=bucket_id:11,actions=output:11,bucket=bucket_id:14,actions=output:14,bucket=bucket_id:15,actions=output:15
941 ])
942
943 # Add two more buckets just before bucket 11,
944 # getting the command from a file.
945 AT_DATA([buckets.txt], [dnl
946 group_id=1234,command_bucket_id=11,bucket=bucket_id:12,actions=output:12,bucket=bucket_id:13,actions=output:13
947 ])
948 AT_CHECK([ovs-ofctl --bundle -O OpenFlow15 -vwarn insert-buckets br0 - < buckets.txt])
949 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn dump-groups br0], [0], [stdout])
950 AT_CHECK([strip_xids < stdout], [0], [dnl
951 OFPST_GROUP_DESC reply (OF1.5):
952 group_id=1234,type=all,bucket=bucket_id:0,actions=output:0,bucket=bucket_id:1,actions=output:1,bucket=bucket_id:10,actions=output:10,bucket=bucket_id:11,actions=output:11,bucket=bucket_id:12,actions=output:12,bucket=bucket_id:13,actions=output:13,bucket=bucket_id:14,actions=output:14,bucket=bucket_id:15,actions=output:15
953 ])
954
955 # Add yet two more buckets.
956 AT_CHECK([ovs-ofctl --bundle -O OpenFlow15 -vwarn insert-buckets br0 group_id=1234,command_bucket_id=15,bucket=bucket_id:20,actions=output:20,bucket=bucket_id:21,actions=output:21])
957 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn dump-groups br0], [0], [stdout])
958 AT_CHECK([strip_xids < stdout], [0], [dnl
959 OFPST_GROUP_DESC reply (OF1.5):
960 group_id=1234,type=all,bucket=bucket_id:0,actions=output:0,bucket=bucket_id:1,actions=output:1,bucket=bucket_id:10,actions=output:10,bucket=bucket_id:11,actions=output:11,bucket=bucket_id:12,actions=output:12,bucket=bucket_id:13,actions=output:13,bucket=bucket_id:14,actions=output:14,bucket=bucket_id:15,actions=output:15,bucket=bucket_id:20,actions=output:20,bucket=bucket_id:21,actions=output:21
961 ])
962
963 # Negative tests.
964 AT_CHECK([ovs-ofctl --bundle -O OpenFlow15 -vwarn insert-buckets br0 group_id=1234,command_bucket_id=0xffffff01,bucket=bucket_id:0,actions=output:0,bucket=bucket_id:1,actions=output:1], [1], [],
965 [ovs-ofctl: invalid command bucket id 4294967041
966 ])
967 AT_CHECK([ovs-ofctl --bundle -vwarn insert-buckets br0 group_id=1234,command_bucket_id=first,bucket=bucket_id:0,actions=output:0,bucket=bucket_id:1,actions=output:1], [1], [],
968 [ovs-ofctl: insert-bucket needs OpenFlow 1.5 or later ('-O OpenFlow15')
969 ])
970 OVS_VSWITCHD_STOP
971 AT_CLEANUP
972
973 AT_SETUP([ofproto - bundle remove group buckets])
974 OVS_VSWITCHD_START
975 AT_DATA([groups.txt], [dnl
976 group_id=1234,type=all,bucket=bucket_id:10,actions=output:10,bucket=bucket_id:11,actions=output:11,bucket=bucket_id:12,actions=output:12,bucket=bucket_id:13,actions=output:13,bucket=bucket_id:14,actions=output:14,bucket=bucket_id:15,actions=output:15,bucket=bucket_id:16,actions=output:16
977 ])
978 AT_CHECK([ovs-ofctl --bundle -O OpenFlow15 -vwarn add-groups br0 groups.txt])
979 AT_CHECK([ovs-ofctl -F OXM-OpenFlow15 -O OpenFlow15 -vwarn dump-groups br0 1234], [0], [stdout])
980 AT_CHECK([strip_xids < stdout], [0], [dnl
981 OFPST_GROUP_DESC reply (OF1.5):
982 group_id=1234,type=all,bucket=bucket_id:10,actions=output:10,bucket=bucket_id:11,actions=output:11,bucket=bucket_id:12,actions=output:12,bucket=bucket_id:13,actions=output:13,bucket=bucket_id:14,actions=output:14,bucket=bucket_id:15,actions=output:15,bucket=bucket_id:16,actions=output:16
983 ])
984 AT_CHECK([ovs-ofctl --bundle -O OpenFlow15 -vwarn remove-buckets br0 group_id=1234,command_bucket_id=first])
985 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn dump-groups br0], [0], [stdout])
986 AT_CHECK([strip_xids < stdout], [0], [dnl
987 OFPST_GROUP_DESC reply (OF1.5):
988 group_id=1234,type=all,bucket=bucket_id:11,actions=output:11,bucket=bucket_id:12,actions=output:12,bucket=bucket_id:13,actions=output:13,bucket=bucket_id:14,actions=output:14,bucket=bucket_id:15,actions=output:15,bucket=bucket_id:16,actions=output:16
989 ])
990 AT_CHECK([ovs-ofctl --bundle -O OpenFlow15 -vwarn remove-buckets br0 group_id=1234,command_bucket_id=last])
991 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn dump-groups br0], [0], [stdout])
992 AT_CHECK([strip_xids < stdout], [0], [dnl
993 OFPST_GROUP_DESC reply (OF1.5):
994 group_id=1234,type=all,bucket=bucket_id:11,actions=output:11,bucket=bucket_id:12,actions=output:12,bucket=bucket_id:13,actions=output:13,bucket=bucket_id:14,actions=output:14,bucket=bucket_id:15,actions=output:15
995 ])
996 AT_CHECK([ovs-ofctl --bundle -O OpenFlow15 -vwarn remove-buckets br0 group_id=1234,command_bucket_id=13])
997 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn dump-groups br0], [0], [stdout])
998 AT_CHECK([strip_xids < stdout], [0], [dnl
999 OFPST_GROUP_DESC reply (OF1.5):
1000 group_id=1234,type=all,bucket=bucket_id:11,actions=output:11,bucket=bucket_id:12,actions=output:12,bucket=bucket_id:14,actions=output:14,bucket=bucket_id:15,actions=output:15
1001 ])
1002 AT_DATA([buckets.txt], [dnl
1003 group_id=1234
1004 ])
1005 AT_CHECK([ovs-ofctl --bundle -O OpenFlow15 -vwarn remove-buckets br0 - < buckets.txt])
1006 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn dump-groups br0], [0], [stdout])
1007 AT_CHECK([strip_xids < stdout], [0], [dnl
1008 OFPST_GROUP_DESC reply (OF1.5):
1009 group_id=1234,type=all
1010 ])
1011 AT_CHECK([ovs-ofctl --bundle -O OpenFlow15 -vwarn remove-buckets br0 group_id=1234,command_bucket_id=first])
1012 AT_CHECK([ovs-ofctl --bundle -O OpenFlow15 -vwarn remove-buckets br0 group_id=1234,command_bucket_id=last])
1013 AT_CHECK([ovs-ofctl --bundle -O OpenFlow15 -vwarn remove-buckets br0 group_id=1234,command_bucket_id=all])
1014 AT_CHECK([ovs-ofctl --bundle -O OpenFlow15 -vwarn remove-buckets br0 group_id=1234,command_bucket_id=1], [1], [], [stderr])
1015 AT_CHECK([ofctl_strip < stderr | sed '/talking to/,$d'], [0], [dnl
1016 Error OFPGMFC_UNKNOWN_BUCKET for: OFPT_GROUP_MOD (OF1.5):
1017 REMOVE_BUCKET command_bucket_id:1,group_id=1234
1018 Error OFPBFC_MSG_FAILED for: OFPT_BUNDLE_CONTROL (OF1.5):
1019 bundle_id=0 type=COMMIT_REQUEST flags=atomic ordered
1020 ])
1021 # Negative test.
1022 AT_CHECK([ovs-ofctl --bundle -O OpenFlow11 -vwarn remove-buckets br0 group_id=1234,command_bucket_id=last], [1], [],
1023 [ovs-ofctl: none of the usable flow formats (OXM-OpenFlow15) is among the allowed flow formats (OXM-OpenFlow14)
1024 ])
1025 OVS_VSWITCHD_STOP
1026 AT_CLEANUP
1027
1028 dnl This is really bare-bones.
1029 dnl It at least checks request and reply serialization and deserialization.
1030 AT_SETUP([ofproto - flow mod checks group availability])
1031 OVS_VSWITCHD_START
1032 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn add-group br0 group_id=1234,type=all,bucket=output:10])
1033 AT_DATA([flows.txt], [dnl
1034 tcp actions=group:1234
1035 udp actions=group:1235
1036 ])
1037 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn add-flow br0 'tcp actions=group:1234'])
1038 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn add-flow br0 'tcp actions=group:1235'], [1], [], [stderr])
1039
1040 AT_CHECK([strip_xids < stderr], [0],
1041 [OFPT_ERROR (OF1.1): OFPBAC_BAD_OUT_GROUP
1042 OFPT_FLOW_MOD (OF1.1): ADD tcp actions=group:1235
1043 ])
1044 OVS_VSWITCHD_STOP
1045 AT_CLEANUP
1046
1047 AT_SETUP([ofproto - bundle flow mod checks group availability])
1048 OVS_VSWITCHD_START
1049 AT_DATA([bundle.txt], [dnl
1050 group add group_id=1234,type=all,bucket=output:10
1051 flow add tcp actions=group:1234
1052 flow add udp actions=group:1235
1053 ])
1054 AT_CHECK([ovs-ofctl -vwarn bundle br0 bundle.txt], [1], [], [stderr])
1055
1056 AT_CHECK([ofctl_strip < stderr | sed '/talking to/,$d'], [0],
1057 [dnl
1058 Error OFPBAC_BAD_OUT_GROUP for: OFPT_FLOW_MOD (OF1.4): ADD udp actions=group:1235
1059 Error OFPBFC_MSG_FAILED for: OFPT_BUNDLE_CONTROL (OF1.4):
1060 bundle_id=0 type=COMMIT_REQUEST flags=atomic ordered
1061 ])
1062 OVS_VSWITCHD_STOP
1063 AT_CLEANUP
1064
1065 dnl This is really bare-bones.
1066 dnl It at least checks request and reply serialization and deserialization.
1067 AT_SETUP([ofproto - group description])
1068 OVS_VSWITCHD_START
1069 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn add-group br0 group_id=1234,type=all,bucket=output:10], [0], [stdout])
1070 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn dump-groups br0], [0], [stdout])
1071 AT_CHECK([strip_xids < stdout], [0], [dnl
1072 OFPST_GROUP_DESC reply (OF1.1):
1073 group_id=1234,type=all,bucket=actions=output:10
1074 ])
1075 OVS_VSWITCHD_STOP
1076 AT_CLEANUP
1077
1078 dnl This is really bare-bones.
1079 dnl It at least checks request and reply serialization and deserialization.
1080 AT_SETUP([ofproto - group features (OpenFlow 1.0 extension)])
1081 OVS_VSWITCHD_START
1082 AT_CHECK([ovs-ofctl -O OpenFlow10 -vwarn dump-group-features br0], [0], [stdout])
1083 AT_CHECK([strip_xids < stdout], [0], [dnl
1084 NXST_GROUP_FEATURES reply:
1085 Group table:
1086 Types: 0xf
1087 Capabilities: 0x7
1088 all group:
1089 max_groups=0xffffff00
1090 actions: output enqueue set_vlan_vid set_vlan_pcp strip_vlan mod_dl_src mod_dl_dst mod_nw_src mod_nw_dst mod_nw_tos mod_tp_src mod_tp_dst
1091 select group:
1092 max_groups=0xffffff00
1093 actions: output enqueue set_vlan_vid set_vlan_pcp strip_vlan mod_dl_src mod_dl_dst mod_nw_src mod_nw_dst mod_nw_tos mod_tp_src mod_tp_dst
1094 indirect group:
1095 max_groups=0xffffff00
1096 actions: output enqueue set_vlan_vid set_vlan_pcp strip_vlan mod_dl_src mod_dl_dst mod_nw_src mod_nw_dst mod_nw_tos mod_tp_src mod_tp_dst
1097 fast failover group:
1098 max_groups=0xffffff00
1099 actions: output enqueue set_vlan_vid set_vlan_pcp strip_vlan mod_dl_src mod_dl_dst mod_nw_src mod_nw_dst mod_nw_tos mod_tp_src mod_tp_dst
1100 ])
1101 OVS_VSWITCHD_STOP
1102 AT_CLEANUP
1103
1104 dnl This is really bare-bones.
1105 dnl It at least checks request and reply serialization and deserialization.
1106 AT_SETUP([ofproto - group features (OpenFlow 1.2)])
1107 OVS_VSWITCHD_START
1108 AT_CHECK([ovs-ofctl -O OpenFlow12 -vwarn dump-group-features br0], [0], [stdout])
1109 AT_CHECK([strip_xids < stdout], [0], [dnl
1110 OFPST_GROUP_FEATURES reply (OF1.2):
1111 Group table:
1112 Types: 0xf
1113 Capabilities: 0x7
1114 all group:
1115 max_groups=0xffffff00
1116 actions: output group set_field strip_vlan push_vlan mod_nw_ttl dec_ttl set_mpls_ttl dec_mpls_ttl push_mpls pop_mpls set_queue
1117 select group:
1118 max_groups=0xffffff00
1119 actions: output group set_field strip_vlan push_vlan mod_nw_ttl dec_ttl set_mpls_ttl dec_mpls_ttl push_mpls pop_mpls set_queue
1120 indirect group:
1121 max_groups=0xffffff00
1122 actions: output group set_field strip_vlan push_vlan mod_nw_ttl dec_ttl set_mpls_ttl dec_mpls_ttl push_mpls pop_mpls set_queue
1123 fast failover group:
1124 max_groups=0xffffff00
1125 actions: output group set_field strip_vlan push_vlan mod_nw_ttl dec_ttl set_mpls_ttl dec_mpls_ttl push_mpls pop_mpls set_queue
1126 ])
1127 OVS_VSWITCHD_STOP
1128 AT_CLEANUP
1129
1130 dnl This is really bare-bones.
1131 dnl It at least checks request and reply serialization and deserialization.
1132 AT_SETUP([ofproto - group stats (OpenFlow 1.0 extension)])
1133 OVS_VSWITCHD_START
1134 AT_DATA([groups.txt], [dnl
1135 group_id=1234,type=all,bucket=output:10
1136 group_id=1235,type=all,bucket=output:10
1137 ])
1138 AT_CHECK([ovs-ofctl -O OpenFlow10 -vwarn add-groups br0 groups.txt])
1139 AT_CHECK([ovs-ofctl -O OpenFlow10 -vwarn add-flow br0 'tcp actions=group:1234'])
1140 AT_CHECK([ovs-ofctl -O OpenFlow10 -vwarn dump-group-stats br0 group_id=1234], [0], [stdout])
1141 AT_CHECK([strip_xids < stdout | sed 's/duration=[[0-9.]]*s/duration=?s/' | sort], [0], [dnl
1142 group_id=1234,duration=?s,ref_count=1,packet_count=0,byte_count=0,bucket0:packet_count=0,byte_count=0
1143 NXST_GROUP reply:
1144 ])
1145 AT_CHECK([ovs-ofctl -O OpenFlow10 -vwarn dump-group-stats br0], [0], [stdout])
1146 AT_CHECK([strip_xids < stdout | sed 's/duration=[[0-9.]]*s/duration=?s/' | sort], [0], [dnl
1147 group_id=1234,duration=?s,ref_count=1,packet_count=0,byte_count=0,bucket0:packet_count=0,byte_count=0
1148 group_id=1235,duration=?s,ref_count=0,packet_count=0,byte_count=0,bucket0:packet_count=0,byte_count=0
1149 NXST_GROUP reply:
1150 ])
1151 OVS_VSWITCHD_STOP
1152 AT_CLEANUP
1153
1154 dnl This is really bare-bones.
1155 dnl It at least checks request and reply serialization and deserialization.
1156 AT_SETUP([ofproto - group stats (OpenFlow 1.1)])
1157 OVS_VSWITCHD_START
1158 AT_DATA([groups.txt], [dnl
1159 group_id=1234,type=all,bucket=output:10
1160 group_id=1235,type=all,bucket=output:10
1161 ])
1162 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn add-groups br0 groups.txt])
1163 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn add-flow br0 'tcp actions=group:1234'])
1164 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn dump-group-stats br0 group_id=1234], [0], [stdout])
1165 AT_CHECK([strip_xids < stdout | sort], [0], [dnl
1166 group_id=1234,ref_count=1,packet_count=0,byte_count=0,bucket0:packet_count=0,byte_count=0
1167 OFPST_GROUP reply (OF1.1):
1168 ])
1169 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn dump-group-stats br0], [0], [stdout])
1170 AT_CHECK([strip_xids < stdout | sort], [0], [dnl
1171 group_id=1234,ref_count=1,packet_count=0,byte_count=0,bucket0:packet_count=0,byte_count=0
1172 group_id=1235,ref_count=0,packet_count=0,byte_count=0,bucket0:packet_count=0,byte_count=0
1173 OFPST_GROUP reply (OF1.1):
1174 ])
1175 OVS_VSWITCHD_STOP
1176 AT_CLEANUP
1177
1178 dnl This is really bare-bones.
1179 dnl It at least checks request and reply serialization and deserialization.
1180 AT_SETUP([ofproto - group stats (OpenFlow 1.3)])
1181 OVS_VSWITCHD_START
1182 AT_DATA([groups.txt], [dnl
1183 group_id=1234,type=all,bucket=output:10
1184 group_id=1235,type=all,bucket=output:10
1185 ])
1186 AT_CHECK([ovs-ofctl -O OpenFlow13 -vwarn add-groups br0 groups.txt])
1187 AT_CHECK([ovs-ofctl -O OpenFlow13 -vwarn add-flow br0 'tcp actions=group:1234'])
1188 AT_CHECK([ovs-ofctl -O OpenFlow13 -vwarn dump-group-stats br0 group_id=1234], [0], [stdout])
1189 AT_CHECK([strip_xids < stdout | sed 's/duration=[[0-9.]]*s/duration=?s/' | sort], [0], [dnl
1190 group_id=1234,duration=?s,ref_count=1,packet_count=0,byte_count=0,bucket0:packet_count=0,byte_count=0
1191 OFPST_GROUP reply (OF1.3):
1192 ])
1193 AT_CHECK([ovs-ofctl -O OpenFlow13 -vwarn dump-group-stats br0], [0], [stdout])
1194 AT_CHECK([strip_xids < stdout | sed 's/duration=[[0-9.]]*s/duration=?s/' | sort], [0], [dnl
1195 group_id=1234,duration=?s,ref_count=1,packet_count=0,byte_count=0,bucket0:packet_count=0,byte_count=0
1196 group_id=1235,duration=?s,ref_count=0,packet_count=0,byte_count=0,bucket0:packet_count=0,byte_count=0
1197 OFPST_GROUP reply (OF1.3):
1198 ])
1199 OVS_VSWITCHD_STOP
1200 AT_CLEANUP
1201
1202 dnl This is really bare-bones.
1203 dnl It at least checks request and reply serialization and deserialization.
1204 AT_SETUP([ofproto - group stats (OpenFlow 1.5)])
1205 OVS_VSWITCHD_START
1206 AT_DATA([groups.txt], [dnl
1207 group_id=1234,type=all,bucket=output:10
1208 group_id=1235,type=all,bucket=output:10
1209 ])
1210 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn add-groups br0 groups.txt])
1211 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn add-flow br0 'tcp actions=group:1234'])
1212 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn dump-group-stats br0 group_id=1234], [0], [stdout])
1213 AT_CHECK([strip_xids < stdout | sed 's/duration=[[0-9.]]*s/duration=?s/' | sort], [0], [dnl
1214 group_id=1234,duration=?s,ref_count=1,packet_count=0,byte_count=0,bucket0:packet_count=0,byte_count=0
1215 OFPST_GROUP reply (OF1.5):
1216 ])
1217 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn dump-group-stats br0], [0], [stdout])
1218 AT_CHECK([strip_xids < stdout | sed 's/duration=[[0-9.]]*s/duration=?s/' | sort], [0], [dnl
1219 group_id=1234,duration=?s,ref_count=1,packet_count=0,byte_count=0,bucket0:packet_count=0,byte_count=0
1220 group_id=1235,duration=?s,ref_count=0,packet_count=0,byte_count=0,bucket0:packet_count=0,byte_count=0
1221 OFPST_GROUP reply (OF1.5):
1222 ])
1223 OVS_VSWITCHD_STOP
1224 AT_CLEANUP
1225
1226 dnl This is used to find that the bucket counter is not updated.
1227 AT_SETUP([ofproto - group stats after insert a new bucket (OpenFlow 1.5)])
1228 OVS_VSWITCHD_START
1229 AT_DATA([groups.txt], [dnl
1230 group_id=1234,type=select,selection_method=hash bucket=bucket_id=1,weight:100,actions=output:10
1231 ])
1232 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn add-groups br0 groups.txt])
1233 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn insert-buckets br0 'group_id=1234, command_bucket_id=last, bucket=bucket_id=2,weight:100,actions=output:10'])
1234 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn dump-group-stats br0 group_id=1234], [0], [stdout])
1235 AT_CHECK([strip_xids < stdout | sed 's/duration=[[0-9.]]*s/duration=?s/' | sort], [0], [dnl
1236 group_id=1234,duration=?s,ref_count=0,packet_count=0,byte_count=0,bucket0:packet_count=0,byte_count=0,bucket1:packet_count=0,byte_count=0
1237 OFPST_GROUP reply (OF1.5):
1238 ])
1239 OVS_VSWITCHD_STOP
1240 AT_CLEANUP
1241
1242 dnl This found a use-after-free error in bridge destruction in the
1243 dnl presence of groups.
1244 AT_SETUP([ofproto - group add then bridge delete (OpenFlow 1.3)])
1245 OVS_VSWITCHD_START
1246 AT_DATA([groups.txt], [dnl
1247 group_id=1234,type=all,bucket=output:10
1248 group_id=1235,type=all,bucket=output:10
1249
1250 dnl This checks for regression against a parser bug such that
1251 dnl "actions=resbmit(,1)" etc. was rejected as a syntax error.
1252 group_id=2345,type=select,bucket=weight:10,actions=resubmit(,1),bucket=weight:10,actions=resubmit(,2),bucket=weight:1,actions=resubmit(,3)
1253 ])
1254 AT_CHECK([ovs-ofctl -O OpenFlow13 -vwarn add-groups br0 groups.txt])
1255 AT_CHECK([ovs-vsctl del-br br0])
1256 OVS_VSWITCHD_STOP
1257 AT_CLEANUP
1258
1259 AT_SETUP([ofproto - mod-port (OpenFlow 1.0)])
1260 OVS_VSWITCHD_START
1261 for command_config_state in \
1262 'up 0 0' \
1263 'noflood NO_FLOOD 0' \
1264 'flood 0 0' \
1265 'no-receive NO_RECV 0' \
1266 'no-forward NO_RECV,NO_FWD 0' \
1267 'no-packet-in NO_RECV,NO_FWD,NO_PACKET_IN 0' \
1268 'forward NO_RECV,NO_PACKET_IN 0' \
1269 'packet-in NO_RECV 0' \
1270 'up NO_RECV 0' \
1271 'receive 0 0' \
1272 'down PORT_DOWN LINK_DOWN'
1273 do
1274 printf '\n--- %s --- \n\n' "$command_config_state"
1275 set $command_config_state
1276 command=$[1] config=`echo $[2] | sed 's/,/ /g'` state=$[3]
1277 AT_CHECK([ovs-ofctl -vwarn mod-port br0 br0 $command])
1278 AT_CHECK([ovs-ofctl -vwarn show br0], [0], [stdout])
1279 AT_CHECK_UNQUOTED([strip_xids < stdout], [0], [dnl
1280 OFPT_FEATURES_REPLY: dpid:fedcba9876543210
1281 n_tables:254, n_buffers:0
1282 capabilities: FLOW_STATS TABLE_STATS PORT_STATS QUEUE_STATS ARP_MATCH_IP
1283 actions: output enqueue set_vlan_vid set_vlan_pcp strip_vlan mod_dl_src mod_dl_dst mod_nw_src mod_nw_dst mod_nw_tos mod_tp_src mod_tp_dst
1284 LOCAL(br0): addr:aa:55:aa:55:00:00
1285 config: $config
1286 state: $state
1287 speed: 0 Mbps now, 0 Mbps max
1288 OFPT_GET_CONFIG_REPLY: frags=normal miss_send_len=0
1289 ])
1290 done
1291 OVS_VSWITCHD_STOP
1292 AT_CLEANUP
1293
1294 AT_SETUP([ofproto - mod-port (OpenFlow 1.2)])
1295 OVS_VSWITCHD_START
1296 for command_config_state in \
1297 'up 0 LIVE' \
1298 'no-receive NO_RECV LIVE' \
1299 'no-forward NO_RECV,NO_FWD LIVE' \
1300 'no-packet-in NO_RECV,NO_FWD,NO_PACKET_IN LIVE' \
1301 'forward NO_RECV,NO_PACKET_IN LIVE' \
1302 'packet-in NO_RECV LIVE' \
1303 'up NO_RECV LIVE' \
1304 'receive 0 LIVE' \
1305 'down PORT_DOWN LINK_DOWN'
1306 do
1307 printf '\n--- %s --- \n\n' "$command_config_state"
1308 set $command_config_state
1309 command=$[1] config=`echo $[2] | sed 's/,/ /g'` state=$[3]
1310 AT_CHECK([ovs-ofctl -O OpenFlow12 -vwarn mod-port br0 br0 $command])
1311 AT_CHECK([ovs-ofctl -O OpenFlow12 -vwarn show br0], [0], [stdout])
1312 AT_CHECK_UNQUOTED([strip_xids < stdout], [0], [dnl
1313 OFPT_FEATURES_REPLY (OF1.2): dpid:fedcba9876543210
1314 n_tables:254, n_buffers:0
1315 capabilities: FLOW_STATS TABLE_STATS PORT_STATS GROUP_STATS QUEUE_STATS
1316 LOCAL(br0): addr:aa:55:aa:55:00:00
1317 config: $config
1318 state: $state
1319 speed: 0 Mbps now, 0 Mbps max
1320 OFPT_GET_CONFIG_REPLY (OF1.2): frags=normal miss_send_len=0
1321 ])
1322 done
1323 OVS_VSWITCHD_STOP
1324 AT_CLEANUP
1325
1326 AT_SETUP([ofproto - mod-port (OpenFlow 1.4)])
1327 OVS_VSWITCHD_START
1328 for command_config_state in \
1329 'up 0 LIVE' \
1330 'no-receive NO_RECV LIVE' \
1331 'no-forward NO_RECV,NO_FWD LIVE' \
1332 'no-packet-in NO_RECV,NO_FWD,NO_PACKET_IN LIVE' \
1333 'forward NO_RECV,NO_PACKET_IN LIVE' \
1334 'packet-in NO_RECV LIVE' \
1335 'up NO_RECV LIVE' \
1336 'receive 0 LIVE' \
1337 'down PORT_DOWN LINK_DOWN'
1338 do
1339 printf '\n--- %s --- \n\n' "$command_config_state"
1340 set $command_config_state
1341 command=$[1] config=`echo $[2] | sed 's/,/ /g'` state=$[3]
1342 AT_CHECK([ovs-ofctl -O OpenFlow14 -vwarn mod-port br0 br0 $command])
1343 AT_CHECK([ovs-ofctl -O OpenFlow14 -vwarn show br0], [0], [stdout])
1344 AT_CHECK_UNQUOTED([strip_xids < stdout], [0], [dnl
1345 OFPT_FEATURES_REPLY (OF1.4): dpid:fedcba9876543210
1346 n_tables:254, n_buffers:0
1347 capabilities: FLOW_STATS TABLE_STATS PORT_STATS GROUP_STATS QUEUE_STATS BUNDLES
1348 OFPST_PORT_DESC reply (OF1.4):
1349 LOCAL(br0): addr:aa:55:aa:55:00:00
1350 config: $config
1351 state: $state
1352 speed: 0 Mbps now, 0 Mbps max
1353 OFPT_GET_CONFIG_REPLY (OF1.4): frags=normal miss_send_len=0
1354 ])
1355 done
1356 OVS_VSWITCHD_STOP
1357 AT_CLEANUP
1358
1359 AT_SETUP([ofproto - basic flow_mod commands (NXM)])
1360 OVS_VSWITCHD_START
1361 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip], [0], [NXST_FLOW reply:
1362 ])
1363 AT_CHECK([echo 'in_port=2,actions=1' | ovs-ofctl add-flows br0 -])
1364 AT_CHECK([ovs-ofctl add-flow br0 in_port=1,actions=2])
1365 AT_CHECK([ovs-ofctl -F nxm add-flow br0 table=1,in_port=4,actions=3])
1366 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1367 in_port=1 actions=output:2
1368 in_port=2 actions=output:1
1369 table=1, in_port=4 actions=output:3
1370 NXST_FLOW reply:
1371 ])
1372 AT_CHECK([ovs-ofctl dump-aggregate br0 table=0 | strip_xids], [0], [dnl
1373 NXST_AGGREGATE reply: packet_count=0 byte_count=0 flow_count=2
1374 ])
1375 AT_CHECK([ovs-ofctl del-flows br0])
1376 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip], [0], [NXST_FLOW reply:
1377 ])
1378 OVS_VSWITCHD_STOP
1379 AT_CLEANUP
1380
1381 AT_SETUP([ofproto - basic flow_mod commands (OpenFlow 1.0)])
1382 OVS_VSWITCHD_START
1383 AT_CHECK([ovs-ofctl -F openflow10 dump-flows br0 | ofctl_strip], [0], [OFPST_FLOW reply:
1384 ])
1385 AT_CHECK([echo 'in_port=2,actions=1' | ovs-ofctl -F openflow10 add-flows br0 -])
1386 AT_CHECK([ovs-ofctl -F openflow10 add-flow br0 in_port=1,actions=2])
1387 AT_CHECK([ovs-ofctl -F openflow10 add-flow br0 table=1,in_port=4,actions=3])
1388 AT_CHECK([ovs-ofctl -F openflow10 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1389 in_port=1 actions=output:2
1390 in_port=2 actions=output:1
1391 table=1, in_port=4 actions=output:3
1392 OFPST_FLOW reply:
1393 ])
1394 AT_CHECK([ovs-ofctl -F openflow10 dump-aggregate br0 table=0 | strip_xids], [0], [dnl
1395 OFPST_AGGREGATE reply: packet_count=0 byte_count=0 flow_count=2
1396 ])
1397 AT_CHECK([ovs-ofctl -F openflow10 del-flows br0])
1398 AT_CHECK([ovs-ofctl -F openflow10 dump-flows br0 | ofctl_strip], [0], [OFPST_FLOW reply:
1399 ])
1400 OVS_VSWITCHD_STOP
1401 AT_CLEANUP
1402
1403 # It's really dumb that check_overlap and reset_counts are considered
1404 # part of flow state, but OpenFlow implies that it is, and OFTest and
1405 # some users insist on it.
1406 AT_SETUP([ofproto - add-flow and flags])
1407 OVS_VSWITCHD_START
1408 AT_CHECK([ovs-ofctl -F openflow10 add-flow br0 check_overlap,in_port=1,actions=drop])
1409 # Prior to OF1.3, flow dumps didn't include a "flags" field.
1410 AT_CHECK([ovs-ofctl -F openflow10 dump-flows br0 | ofctl_strip], [0], [dnl
1411 OFPST_FLOW reply:
1412 in_port=1 actions=drop
1413 ])
1414 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip], [0], [dnl
1415 OFPST_FLOW reply (OF1.1):
1416 in_port=1 actions=drop
1417 ])
1418 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip], [0], [dnl
1419 OFPST_FLOW reply (OF1.2):
1420 in_port=1 actions=drop
1421 ])
1422 # OF1.3 makes the flags visible.
1423 AT_CHECK([ovs-ofctl -O OpenFlow13 dump-flows br0 | ofctl_strip], [0], [dnl
1424 OFPST_FLOW reply (OF1.3):
1425 check_overlap reset_counts in_port=1 actions=drop
1426 ])
1427 AT_CHECK([ovs-ofctl -O OpenFlow14 dump-flows br0 | ofctl_strip], [0], [dnl
1428 OFPST_FLOW reply (OF1.4):
1429 check_overlap reset_counts in_port=1 actions=drop
1430 ])
1431 # OF1.5 makes the flags invisible.
1432 AT_CHECK([ovs-ofctl -O OpenFlow15 dump-flows br0 | ofctl_strip], [0], [dnl
1433 OFPST_FLOW reply (OF1.5):
1434 check_overlap reset_counts in_port=1 actions=drop
1435 ])
1436 OVS_VSWITCHD_STOP
1437 AT_CLEANUP
1438
1439 AT_SETUP([ofproto - basic flow_mod commands (OpenFlow 1.1)])
1440 OVS_VSWITCHD_START
1441 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip], [0], [OFPST_FLOW reply (OF1.1):
1442 ])
1443 AT_CHECK([echo 'in_port=2,actions=1' | ovs-ofctl -O OpenFlow11 add-flows br0 -])
1444 AT_CHECK([ovs-ofctl -O OpenFlow11 add-flow br0 in_port=1,actions=2])
1445 AT_CHECK([ovs-ofctl -O OpenFlow11 add-flow br0 table=1,in_port=4,actions=3])
1446 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1447 in_port=1 actions=output:2
1448 in_port=2 actions=output:1
1449 table=1, in_port=4 actions=output:3
1450 OFPST_FLOW reply (OF1.1):
1451 ])
1452 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-aggregate br0 table=0 | strip_xids], [0], [dnl
1453 OFPST_AGGREGATE reply (OF1.1): packet_count=0 byte_count=0 flow_count=2
1454 ])
1455 AT_CHECK([ovs-ofctl -O OpenFlow11 del-flows br0])
1456 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip], [0], [OFPST_FLOW reply (OF1.1):
1457 table=1, in_port=4 actions=output:3
1458 ])
1459 OVS_VSWITCHD_STOP
1460 AT_CLEANUP
1461
1462 AT_SETUP([ofproto - flow_mod negative test (OpenFlow 1.1)])
1463 OVS_VSWITCHD_START(
1464 [set bridge br0 protocols=OpenFlow10,OpenFlow11,OpenFlow12,OpenFlow13])
1465 AT_CHECK([ovs-ofctl add-flow -O OpenFlow11 br0 table=1,action=goto_table:2])
1466
1467 # The error message here actually comes from ovs-ofctl, not from ovs-vswitchd,
1468 # but at least it's the same code in ofpacts_check() that issues the error.
1469 AT_CHECK([ovs-ofctl add-flow -O OpenFlow11 br0 table=1,action=goto_table:1],
1470 [1], [],
1471 [ovs-ofctl: actions are invalid with specified match (OFPBIC_BAD_TABLE_ID)
1472 ])
1473 OVS_VSWITCHD_STOP
1474 AT_CLEANUP
1475
1476 AT_SETUP([ofproto - set-field flow_mod commands (NXM)])
1477 OVS_VSWITCHD_START
1478 AT_CHECK([ovs-ofctl add-flow br0 ipv6,table=1,in_port=3,actions=drop])
1479 AT_CHECK([ovs-ofctl add-flow br0 ipv6,table=1,in_port=3,actions=set_field:fe80:0123:4567:890a:a6ba:dbff:fefe:59fa-\>ipv6_src])
1480 AT_CHECK([ovs-ofctl add-flow br0 icmp6,icmp_type=136,table=1,in_port=3,actions=set_field:fe80:8675:3097:890a:a6ba:dbff:f00d:59fa-\>nd_target,set_field:cc:dd:ee:ff:00:11-\>nd_tll])
1481 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1482 table=1, icmp6,in_port=3,icmp_type=136 actions=load:0xa6badbfff00d59fa->NXM_NX_ND_TARGET[[0..63]],load:0xfe8086753097890a->NXM_NX_ND_TARGET[[64..127]],load:0xccddeeff0011->NXM_NX_ND_TLL[[]]
1483 table=1, ipv6,in_port=3 actions=load:0xa6badbfffefe59fa->NXM_NX_IPV6_SRC[[0..63]],load:0xfe8001234567890a->NXM_NX_IPV6_SRC[[64..127]]
1484 NXST_FLOW reply:
1485 ])
1486 OVS_VSWITCHD_STOP
1487 AT_CLEANUP
1488
1489 AT_SETUP([ofproto - basic flow_mod commands (OpenFlow 1.2)])
1490 OVS_VSWITCHD_START
1491 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip], [0], [OFPST_FLOW reply (OF1.2):
1492 ])
1493 AT_CHECK([echo 'in_port=2,actions=1' | ovs-ofctl -O OpenFlow12 add-flows br0 -])
1494 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 in_port=1,actions=2])
1495 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 table=1,in_port=4,actions=3])
1496 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1497 in_port=1 actions=output:2
1498 in_port=2 actions=output:1
1499 table=1, in_port=4 actions=output:3
1500 OFPST_FLOW reply (OF1.2):
1501 ])
1502 AT_CHECK([ovs-ofctl -O OpenFlow12 del-flows br0])
1503 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip], [0], [OFPST_FLOW reply (OF1.2):
1504 ])
1505 OVS_VSWITCHD_STOP
1506 AT_CLEANUP
1507
1508 AT_SETUP([ofproto - set-field flow_mod commands (OF1.2)])
1509 OVS_VSWITCHD_START
1510 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 ipv6,table=1,in_port=3,actions=drop])
1511 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 ipv6,table=1,in_port=3,actions=set_field:fe80:0123:4567:890a:a6ba:dbff:fefe:59fa-\>ipv6_src])
1512 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 icmp6,icmp_type=136,table=1,in_port=3,actions=set_field:fe80:8675:3097:890a:a6ba:dbff:f00d:59fa-\>nd_target,set_field:cc:dd:ee:ff:00:11-\>nd_tll])
1513 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1514 table=1, icmp6,in_port=3,icmp_type=136 actions=set_field:fe80:8675:3097:890a:a6ba:dbff:f00d:59fa->nd_target,set_field:cc:dd:ee:ff:00:11->nd_tll
1515 table=1, ipv6,in_port=3 actions=set_field:fe80:123:4567:890a:a6ba:dbff:fefe:59fa->ipv6_src
1516 OFPST_FLOW reply (OF1.2):
1517 ])
1518 OVS_VSWITCHD_STOP
1519 AT_CLEANUP
1520
1521 AT_SETUP([ofproto - dump flows with cookie])
1522 OVS_VSWITCHD_START
1523 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x1,in_port=1,actions=1])
1524 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x2,in_port=2,actions=1])
1525 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x3,in_port=3,actions=1])
1526 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1527 cookie=0x1, in_port=1 actions=output:1
1528 cookie=0x2, in_port=2 actions=output:1
1529 cookie=0x3, in_port=3 actions=output:1
1530 NXST_FLOW reply:
1531 ])
1532 AT_CHECK([ovs-ofctl dump-aggregate br0 table=0 | strip_xids], [0], [dnl
1533 NXST_AGGREGATE reply: packet_count=0 byte_count=0 flow_count=3
1534 ])
1535 AT_CHECK([ovs-ofctl dump-flows br0 cookie=0x3/-1 | ofctl_strip | sort], [0], [dnl
1536 cookie=0x3, in_port=3 actions=output:1
1537 NXST_FLOW reply:
1538 ])
1539 AT_CHECK([ovs-ofctl dump-aggregate br0 cookie=0x3/-1 | strip_xids], [0], [dnl
1540 NXST_AGGREGATE reply: packet_count=0 byte_count=0 flow_count=1
1541 ])
1542 OVS_VSWITCHD_STOP
1543 AT_CLEANUP
1544
1545 AT_SETUP([ofproto - mod flow with cookie change (OpenFlow 1.0)])
1546 OVS_VSWITCHD_START
1547 AT_CHECK([ovs-ofctl -F openflow10 add-flow br0 cookie=0x1,in_port=1,actions=1])
1548 AT_CHECK([ovs-ofctl -F openflow10 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1549 cookie=0x1, in_port=1 actions=output:1
1550 OFPST_FLOW reply:
1551 ])
1552
1553 AT_CHECK([ovs-ofctl -F openflow10 mod-flows br0 cookie=0x2,in_port=1,actions=1])
1554 AT_CHECK([ovs-ofctl -F openflow10 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1555 cookie=0x2, in_port=1 actions=output:1
1556 OFPST_FLOW reply:
1557 ])
1558 OVS_VSWITCHD_STOP
1559 AT_CLEANUP
1560
1561 AT_SETUP([ofproto - mod flow with cookie change (NXM)])
1562 OVS_VSWITCHD_START
1563 AT_CHECK([ovs-ofctl -F nxm add-flow br0 cookie=0x1,in_port=1,actions=1])
1564 AT_CHECK([ovs-ofctl -F nxm dump-flows br0 | ofctl_strip | sort], [0], [dnl
1565 cookie=0x1, in_port=1 actions=output:1
1566 NXST_FLOW reply:
1567 ])
1568
1569 AT_CHECK([ovs-ofctl -F nxm mod-flows br0 cookie=0x2,in_port=1,actions=1])
1570 AT_CHECK([ovs-ofctl -F nxm dump-flows br0 | ofctl_strip | sort], [0], [dnl
1571 cookie=0x2, in_port=1 actions=output:1
1572 NXST_FLOW reply:
1573 ])
1574 OVS_VSWITCHD_STOP
1575 AT_CLEANUP
1576
1577 AT_SETUP([ofproto - no mod flow with cookie change (OpenFlow 1.1)])
1578 OVS_VSWITCHD_START
1579 AT_CHECK([ovs-ofctl -O OpenFlow11 add-flow br0 cookie=0x1,in_port=1,actions=1])
1580 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1581 cookie=0x1, in_port=1 actions=output:1
1582 OFPST_FLOW reply (OF1.1):
1583 ])
1584 AT_CHECK([ovs-ofctl -O OpenFlow11 mod-flows br0 cookie=0x2,in_port=1,actions=1])
1585 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1586 cookie=0x1, in_port=1 actions=output:1
1587 OFPST_FLOW reply (OF1.1):
1588 ])
1589 OVS_VSWITCHD_STOP
1590 AT_CLEANUP
1591
1592 dnl The OpenFlow 1.2 spec states that the cookie may not be modified
1593 AT_SETUP([ofproto - no mod flow with cookie change (OpenFlow 1.2)])
1594 OVS_VSWITCHD_START
1595 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 cookie=0x1,in_port=1,actions=1])
1596 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1597 cookie=0x1, in_port=1 actions=output:1
1598 OFPST_FLOW reply (OF1.2):
1599 ])
1600
1601 AT_CHECK([ovs-ofctl -O OpenFlow12 mod-flows br0 cookie=0x2,in_port=1,actions=1])
1602 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1603 cookie=0x1, in_port=1 actions=output:1
1604 OFPST_FLOW reply (OF1.2):
1605 ])
1606 OVS_VSWITCHD_STOP
1607 AT_CLEANUP
1608
1609 AT_SETUP([ofproto - mod flows based on cookie mask (OpenFlow 1.0)])
1610 OVS_VSWITCHD_START
1611 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x1,in_port=1,actions=1])
1612 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x1,in_port=2,actions=1])
1613 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x2,in_port=3,actions=1])
1614 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1615 cookie=0x1, in_port=1 actions=output:1
1616 cookie=0x1, in_port=2 actions=output:1
1617 cookie=0x2, in_port=3 actions=output:1
1618 NXST_FLOW reply:
1619 ])
1620
1621 AT_CHECK([ovs-ofctl -F nxm mod-flows br0 cookie=0x1/0xff,actions=4])
1622 AT_CHECK([ovs-ofctl -F nxm dump-flows br0 | ofctl_strip | sort], [0], [dnl
1623 cookie=0x1, in_port=1 actions=output:4
1624 cookie=0x1, in_port=2 actions=output:4
1625 cookie=0x2, in_port=3 actions=output:1
1626 NXST_FLOW reply:
1627 ])
1628 OVS_VSWITCHD_STOP
1629 AT_CLEANUP
1630
1631 AT_SETUP([ofproto - mod flows based on cookie mask (OpenFlow 1.1)])
1632 OVS_VSWITCHD_START
1633 AT_CHECK([ovs-ofctl -O OpenFlow11 add-flow br0 cookie=0x1,in_port=1,actions=1])
1634 AT_CHECK([ovs-ofctl -O OpenFlow11 add-flow br0 cookie=0x1,in_port=2,actions=1])
1635 AT_CHECK([ovs-ofctl -O OpenFlow11 add-flow br0 cookie=0x2,in_port=3,actions=1])
1636 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1637 cookie=0x1, in_port=1 actions=output:1
1638 cookie=0x1, in_port=2 actions=output:1
1639 cookie=0x2, in_port=3 actions=output:1
1640 OFPST_FLOW reply (OF1.1):
1641 ])
1642
1643 AT_CHECK([ovs-ofctl -O OpenFlow11 mod-flows br0 cookie=0x1/0xff,actions=4])
1644 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1645 cookie=0x1, in_port=1 actions=output:4
1646 cookie=0x1, in_port=2 actions=output:4
1647 cookie=0x2, in_port=3 actions=output:1
1648 OFPST_FLOW reply (OF1.1):
1649 ])
1650 OVS_VSWITCHD_STOP
1651 AT_CLEANUP
1652
1653 AT_SETUP([ofproto - mod flows based on cookie mask (OpenFlow 1.2)])
1654 OVS_VSWITCHD_START
1655 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 cookie=0x1,in_port=1,actions=1])
1656 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 cookie=0x1,in_port=2,actions=1])
1657 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 cookie=0x2,in_port=3,actions=1])
1658 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1659 cookie=0x1, in_port=1 actions=output:1
1660 cookie=0x1, in_port=2 actions=output:1
1661 cookie=0x2, in_port=3 actions=output:1
1662 OFPST_FLOW reply (OF1.2):
1663 ])
1664
1665 AT_CHECK([ovs-ofctl -O OpenFlow12 mod-flows br0 cookie=0x1/0xff,actions=4])
1666 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1667 cookie=0x1, in_port=1 actions=output:4
1668 cookie=0x1, in_port=2 actions=output:4
1669 cookie=0x2, in_port=3 actions=output:1
1670 OFPST_FLOW reply (OF1.2):
1671 ])
1672 OVS_VSWITCHD_STOP
1673 AT_CLEANUP
1674
1675 dnl The OpenFlow 1.2 spec states that the cookie may not be modified
1676 AT_SETUP([ofproto - mod flows based on cookie mask with cookie change])
1677 OVS_VSWITCHD_START
1678 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x1,in_port=1,actions=1])
1679 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x1,in_port=2,actions=1])
1680 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x2,in_port=3,actions=1])
1681 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1682 cookie=0x1, in_port=1 actions=output:1
1683 cookie=0x1, in_port=2 actions=output:1
1684 cookie=0x2, in_port=3 actions=output:1
1685 NXST_FLOW reply:
1686 ])
1687
1688 AT_CHECK([ovs-ofctl -F nxm mod-flows br0 cookie=1/-1,cookie=4,actions=4])
1689 AT_CHECK([ovs-ofctl -F nxm dump-flows br0 | ofctl_strip | sort], [0], [dnl
1690 cookie=0x2, in_port=3 actions=output:1
1691 cookie=0x4, in_port=1 actions=output:4
1692 cookie=0x4, in_port=2 actions=output:4
1693 NXST_FLOW reply:
1694 ])
1695 OVS_VSWITCHD_STOP
1696 AT_CLEANUP
1697
1698 AT_SETUP([ofproto - mod flow with cookie miss (mask==0) - NXM])
1699 OVS_VSWITCHD_START
1700 AT_CHECK([ovs-ofctl -F nxm mod-flows br0 in_port=1,actions=1])
1701 AT_CHECK([ovs-ofctl -F nxm dump-flows br0 | ofctl_strip | sort], [0], [dnl
1702 in_port=1 actions=output:1
1703 NXST_FLOW reply:
1704 ])
1705 OVS_VSWITCHD_STOP
1706 AT_CLEANUP
1707
1708 AT_SETUP([ofproto - mod flow with cookie miss (mask==0) - OF1.1])
1709 OVS_VSWITCHD_START
1710 AT_CHECK([ovs-ofctl -O openflow11 mod-flows br0 in_port=1,actions=1])
1711 AT_CHECK([ovs-ofctl -O openflow11 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1712 in_port=1 actions=output:1
1713 OFPST_FLOW reply (OF1.1):
1714 ])
1715 OVS_VSWITCHD_STOP
1716 AT_CLEANUP
1717
1718 AT_SETUP([ofproto - mod flow with cookie miss (mask==0) - OF1.2])
1719 OVS_VSWITCHD_START
1720 AT_CHECK([ovs-ofctl -O openflow12 mod-flows br0 in_port=1,actions=1])
1721 AT_CHECK([ovs-ofctl -O openflow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1722 OFPST_FLOW reply (OF1.2):
1723 ])
1724 OVS_VSWITCHD_STOP
1725 AT_CLEANUP
1726
1727 AT_SETUP([ofproto - mod flow with cookie miss (mask!=0) - NXM])
1728 OVS_VSWITCHD_START
1729 AT_CHECK([ovs-ofctl -F nxm mod-flows br0 cookie=1/1,in_port=1,actions=1])
1730 AT_CHECK([ovs-ofctl -F nxm dump-flows br0 | ofctl_strip | sort], [0], [dnl
1731 NXST_FLOW reply:
1732 ])
1733 OVS_VSWITCHD_STOP
1734 AT_CLEANUP
1735
1736 AT_SETUP([ofproto - mod flow with cookie miss (mask!=0) - OF1.1])
1737 OVS_VSWITCHD_START
1738 AT_CHECK([ovs-ofctl -O openflow11 mod-flows br0 cookie=1/1,in_port=1,actions=1])
1739 AT_CHECK([ovs-ofctl -O openflow11 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1740 OFPST_FLOW reply (OF1.1):
1741 ])
1742 OVS_VSWITCHD_STOP
1743 AT_CLEANUP
1744
1745 AT_SETUP([ofproto - mod flow with cookie miss (mask!=0) - OF1.2])
1746 OVS_VSWITCHD_START
1747 AT_CHECK([ovs-ofctl -O openflow12 mod-flows br0 cookie=1/1,in_port=1,actions=1])
1748 AT_CHECK([ovs-ofctl -O openflow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1749 OFPST_FLOW reply (OF1.2):
1750 ])
1751 OVS_VSWITCHD_STOP
1752 AT_CLEANUP
1753
1754 AT_SETUP([ofproto - del flows with cookies])
1755 OVS_VSWITCHD_START
1756 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x1,in_port=1,actions=1])
1757 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x2,in_port=2,actions=1])
1758 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x3,in_port=3,actions=1])
1759 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1760 cookie=0x1, in_port=1 actions=output:1
1761 cookie=0x2, in_port=2 actions=output:1
1762 cookie=0x3, in_port=3 actions=output:1
1763 NXST_FLOW reply:
1764 ])
1765
1766 AT_CHECK([ovs-ofctl del-flows br0])
1767 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1768 NXST_FLOW reply:
1769 ])
1770 OVS_VSWITCHD_STOP
1771 AT_CLEANUP
1772
1773 AT_SETUP([ofproto - del flows based on cookie])
1774 OVS_VSWITCHD_START
1775 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x1,in_port=1,actions=1])
1776 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x2,in_port=2,actions=1])
1777 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x3,in_port=3,actions=1])
1778 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1779 cookie=0x1, in_port=1 actions=output:1
1780 cookie=0x2, in_port=2 actions=output:1
1781 cookie=0x3, in_port=3 actions=output:1
1782 NXST_FLOW reply:
1783 ])
1784
1785 AT_CHECK([ovs-ofctl del-flows br0 cookie=0x3/-1])
1786 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1787 cookie=0x1, in_port=1 actions=output:1
1788 cookie=0x2, in_port=2 actions=output:1
1789 NXST_FLOW reply:
1790 ])
1791 OVS_VSWITCHD_STOP
1792 AT_CLEANUP
1793
1794 AT_SETUP([ofproto - del flows based on cookie mask])
1795 OVS_VSWITCHD_START
1796 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x1,in_port=1,actions=1])
1797 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x2,in_port=2,actions=1])
1798 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x3,in_port=3,actions=1])
1799 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1800 cookie=0x1, in_port=1 actions=output:1
1801 cookie=0x2, in_port=2 actions=output:1
1802 cookie=0x3, in_port=3 actions=output:1
1803 NXST_FLOW reply:
1804 ])
1805 AT_CHECK([ovs-ofctl del-flows br0 cookie=0x3/0x1])
1806 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1807 cookie=0x2, in_port=2 actions=output:1
1808 NXST_FLOW reply:
1809 ])
1810 OVS_VSWITCHD_STOP
1811 AT_CLEANUP
1812
1813 AT_SETUP([ofproto - del flows based on table id (NXM)])
1814 OVS_VSWITCHD_START
1815 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x1,in_port=1,actions=1])
1816 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x2,in_port=2,table=1,actions=1])
1817 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1818 cookie=0x1, in_port=1 actions=output:1
1819 cookie=0x2, table=1, in_port=2 actions=output:1
1820 NXST_FLOW reply:
1821 ])
1822 AT_CHECK([ovs-ofctl del-flows br0 table=0])
1823 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1824 cookie=0x2, table=1, in_port=2 actions=output:1
1825 NXST_FLOW reply:
1826 ])
1827 AT_CHECK([ovs-ofctl del-flows br0 table=1])
1828 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1829 NXST_FLOW reply:
1830 ])
1831 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x1,in_port=1,actions=1])
1832 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x2,in_port=2,table=1,actions=1])
1833 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1834 cookie=0x1, in_port=1 actions=output:1
1835 cookie=0x2, table=1, in_port=2 actions=output:1
1836 NXST_FLOW reply:
1837 ])
1838 AT_CHECK([ovs-ofctl del-flows br0])
1839 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1840 NXST_FLOW reply:
1841 ])
1842 OVS_VSWITCHD_STOP
1843 AT_CLEANUP
1844
1845 AT_SETUP([ofproto - del flows based on table id (OpenFlow 1.1)])
1846 OVS_VSWITCHD_START
1847 AT_CHECK([ovs-ofctl -O OpenFlow11 add-flow br0 cookie=0x1,in_port=1,actions=1])
1848 AT_CHECK([ovs-ofctl -O OpenFlow11 add-flow br0 cookie=0x2,in_port=2,table=1,actions=1])
1849 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1850 cookie=0x1, in_port=1 actions=output:1
1851 cookie=0x2, table=1, in_port=2 actions=output:1
1852 OFPST_FLOW reply (OF1.1):
1853 ])
1854 AT_CHECK([ovs-ofctl -O OpenFlow11 del-flows br0 table=0])
1855 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1856 cookie=0x2, table=1, in_port=2 actions=output:1
1857 OFPST_FLOW reply (OF1.1):
1858 ])
1859 AT_CHECK([ovs-ofctl -O OpenFlow11 del-flows br0 table=1])
1860 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1861 OFPST_FLOW reply (OF1.1):
1862 ])
1863 AT_CHECK([ovs-ofctl -O OpenFlow11 add-flow br0 cookie=0x1,in_port=1,actions=1])
1864 AT_CHECK([ovs-ofctl -O OpenFlow11 add-flow br0 cookie=0x2,in_port=2,table=1,actions=1])
1865 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1866 cookie=0x1, in_port=1 actions=output:1
1867 cookie=0x2, table=1, in_port=2 actions=output:1
1868 OFPST_FLOW reply (OF1.1):
1869 ])
1870 AT_CHECK([ovs-ofctl -O OpenFlow11 del-flows br0])
1871 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip], [0], [dnl
1872 OFPST_FLOW reply (OF1.1):
1873 cookie=0x2, table=1, in_port=2 actions=output:1
1874 ])
1875 OVS_VSWITCHD_STOP
1876 AT_CLEANUP
1877
1878 AT_SETUP([ofproto - del flows based on table id (OpenFlow 1.2)])
1879 OVS_VSWITCHD_START
1880 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 cookie=0x1,in_port=1,actions=1])
1881 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 cookie=0x2,in_port=2,table=1,actions=1])
1882 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1883 cookie=0x1, in_port=1 actions=output:1
1884 cookie=0x2, table=1, in_port=2 actions=output:1
1885 OFPST_FLOW reply (OF1.2):
1886 ])
1887 AT_CHECK([ovs-ofctl -O OpenFlow12 del-flows br0 table=0])
1888 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1889 cookie=0x2, table=1, in_port=2 actions=output:1
1890 OFPST_FLOW reply (OF1.2):
1891 ])
1892 AT_CHECK([ovs-ofctl -O OpenFlow12 del-flows br0 table=1])
1893 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1894 OFPST_FLOW reply (OF1.2):
1895 ])
1896 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 cookie=0x1,in_port=1,actions=1])
1897 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 cookie=0x2,in_port=2,table=1,actions=1])
1898 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1899 cookie=0x1, in_port=1 actions=output:1
1900 cookie=0x2, table=1, in_port=2 actions=output:1
1901 OFPST_FLOW reply (OF1.2):
1902 ])
1903 AT_CHECK([ovs-ofctl -O OpenFlow12 del-flows br0])
1904 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1905 OFPST_FLOW reply (OF1.2):
1906 ])
1907 OVS_VSWITCHD_STOP
1908 AT_CLEANUP
1909
1910 AT_SETUP([ofproto - flow_mod with out_port matching (OpenFlow 1.0)])
1911 OVS_VSWITCHD_START
1912 AT_DATA([flows.txt], [dnl
1913 in_port=1 actions=output:2
1914 in_port=2 actions=output:1,output:2,output:3
1915 in_port=3 actions=output:3,output:1,output:2
1916 in_port=4 actions=drop
1917 in_port=5 actions=output:3
1918 in_port=6 actions=output:1
1919 ])
1920 AT_CHECK([ovs-ofctl -F openflow10 add-flows br0 flows.txt])
1921 (cat flows.txt; echo 'OFPST_FLOW reply:') > expout
1922 AT_CHECK([ovs-ofctl -F openflow10 dump-flows br0 | ofctl_strip | sort], [0],
1923 [expout])
1924
1925 (grep 'output:2' flows.txt; echo 'OFPST_FLOW reply:') > expout
1926 AT_CHECK([ovs-ofctl -F openflow10 dump-flows br0 out_port=2 | ofctl_strip | sort], [0], [expout])
1927
1928 AT_CHECK([ovs-ofctl -F openflow10 del-flows br0 out_port=2])
1929 (grep -v 'output:2' flows.txt; echo 'OFPST_FLOW reply:') > expout
1930 AT_CHECK([ovs-ofctl -F openflow10 dump-flows br0 | ofctl_strip | sort], [0],
1931 [expout])
1932
1933 AT_CHECK([ovs-ofctl -F openflow10 del-flows br0 out_port=3])
1934 (grep -v 'output:[[23]]' flows.txt; echo 'OFPST_FLOW reply:') > expout
1935 AT_CHECK([ovs-ofctl -F openflow10 dump-flows br0 | ofctl_strip | sort], [0],
1936 [expout])
1937
1938 AT_CHECK([ovs-ofctl -F openflow10 del-flows br0 out_port=1])
1939 (grep -v 'output:[[123]]' flows.txt; echo 'OFPST_FLOW reply:') > expout
1940 AT_CHECK([ovs-ofctl -F openflow10 dump-flows br0 | ofctl_strip | sort], [0],
1941 [expout])
1942
1943 OVS_VSWITCHD_STOP
1944 AT_CLEANUP
1945
1946 AT_SETUP([ofproto - flow_mod with out_port matching (OpenFlow 1.1)])
1947 OVS_VSWITCHD_START
1948 AT_DATA([flows.txt], [dnl
1949 in_port=1 actions=output:2
1950 in_port=2 actions=output:1,write_actions(output:2,output:3)
1951 in_port=3 actions=output:3,output:1,write_actions(output:2)
1952 in_port=4 actions=drop
1953 in_port=5 actions=write_actions(output:3)
1954 in_port=6 actions=output:1
1955 ])
1956 AT_CHECK([ovs-ofctl -O OpenFlow11 add-flows br0 flows.txt])
1957 (cat flows.txt; echo 'OFPST_FLOW reply (OF1.1):') > expout
1958 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0],
1959 [expout])
1960
1961 (grep 'output:2' flows.txt; echo 'OFPST_FLOW reply (OF1.1):') > expout
1962 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 out_port=2 | ofctl_strip | sort], [0], [expout])
1963
1964 AT_CHECK([ovs-ofctl -O OpenFlow11 del-flows br0 out_port=2])
1965 (grep -v 'output:2' flows.txt; echo 'OFPST_FLOW reply (OF1.1):') > expout
1966 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0],
1967 [expout])
1968
1969 AT_CHECK([ovs-ofctl -O OpenFlow11 del-flows br0 out_port=3])
1970 (grep -v 'output:[[23]]' flows.txt; echo 'OFPST_FLOW reply (OF1.1):') > expout
1971 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0],
1972 [expout])
1973
1974 AT_CHECK([ovs-ofctl -O OpenFlow11 del-flows br0 out_port=1])
1975 (grep -v 'output:[[123]]' flows.txt; echo 'OFPST_FLOW reply (OF1.1):') > expout
1976 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0],
1977 [expout])
1978
1979 OVS_VSWITCHD_STOP
1980 AT_CLEANUP
1981
1982 AT_SETUP([ofproto - flow_mod with out_group matching (OpenFlow 1.1)])
1983 OVS_VSWITCHD_START
1984 AT_DATA([groups.txt], [dnl
1985 group_id=1,type=all,bucket=output:10
1986 group_id=2,type=all,bucket=output:10
1987 group_id=3,type=all,bucket=output:10
1988 ])
1989 AT_CHECK([ovs-ofctl -O OpenFlow11 add-groups br0 groups.txt])
1990 AT_DATA([flows.txt], [dnl
1991 in_port=1 actions=group:2,output:5
1992 in_port=2 actions=group:1,write_actions(group:2,group:3,output:6)
1993 in_port=3 actions=group:3,group:1,write_actions(group:2,output:3)
1994 in_port=4 actions=output:4
1995 in_port=5 actions=write_actions(output:4,group:3)
1996 in_port=6 actions=group:1
1997 ])
1998 AT_CHECK([ovs-ofctl -O OpenFlow11 add-flows br0 flows.txt])
1999 (cat flows.txt; echo 'OFPST_FLOW reply (OF1.1):') > expout
2000 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0],
2001 [expout])
2002
2003 (grep 'output:3' flows.txt | grep 'group:2'; echo 'OFPST_FLOW reply (OF1.1):') > expout
2004 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 out_port=3,out_group=2 | ofctl_strip | sort], [0], [expout])
2005
2006 AT_CHECK([ovs-ofctl -O OpenFlow11 del-flows br0 out_group=2])
2007 (grep -v 'group:2' flows.txt; echo 'OFPST_FLOW reply (OF1.1):') > expout
2008 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0],
2009 [expout])
2010
2011 AT_CHECK([ovs-ofctl -O OpenFlow11 del-flows br0 out_group=3])
2012 (grep -v 'group:[[23]]' flows.txt; echo 'OFPST_FLOW reply (OF1.1):') > expout
2013 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0],
2014 [expout])
2015
2016 AT_CHECK([ovs-ofctl -O OpenFlow11 del-flows br0 out_group=1])
2017 (grep -v 'group:[[123]]' flows.txt; echo 'OFPST_FLOW reply (OF1.1):') > expout
2018 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0],
2019 [expout])
2020
2021 OVS_VSWITCHD_STOP
2022 AT_CLEANUP
2023
2024 AT_SETUP([ofproto - bundle flow_mod with out group matching (OpenFlow 1.4)])
2025 OVS_VSWITCHD_START
2026 AT_DATA([bundle.txt], [dnl
2027 group group_id=1,type=all,bucket=output:10
2028 group group_id=2,type=all,bucket=output:10
2029 group group_id=3,type=all,bucket=output:10
2030 flow in_port=1 actions=group:2,output:5
2031 flow in_port=2 actions=group:1,write_actions(group:2,group:3,output:6)
2032 flow in_port=3 actions=group:3,group:1,write_actions(group:2,output:3)
2033 flow in_port=4 actions=output:4
2034 flow in_port=5 actions=write_actions(output:4,group:3)
2035 flow in_port=6 actions=group:1
2036 ])
2037 AT_CHECK([ovs-ofctl bundle br0 bundle.txt])
2038
2039 # for checking
2040 AT_DATA([flows.txt], [dnl
2041 in_port=1 actions=group:2,output:5
2042 in_port=2 actions=group:1,write_actions(group:2,group:3,output:6)
2043 in_port=3 actions=group:3,group:1,write_actions(group:2,output:3)
2044 in_port=4 actions=output:4
2045 in_port=5 actions=write_actions(output:4,group:3)
2046 in_port=6 actions=group:1
2047 ])
2048
2049 (cat flows.txt; echo 'OFPST_FLOW reply (OF1.4):') > expout
2050 AT_CHECK([ovs-ofctl -O OpenFlow14 dump-flows br0 | ofctl_strip | sort], [0],
2051 [expout])
2052
2053 (grep 'output:3' flows.txt | grep 'group:2'; echo 'OFPST_FLOW reply (OF1.4):') > expout
2054 AT_CHECK([ovs-ofctl -O OpenFlow14 dump-flows br0 out_port=3,out_group=2 | ofctl_strip | sort], [0], [expout])
2055
2056 AT_CHECK([ovs-ofctl -O OpenFlow14 del-flows br0 out_group=2])
2057 (grep -v 'group:2' flows.txt; echo 'OFPST_FLOW reply (OF1.4):') > expout
2058 AT_CHECK([ovs-ofctl -O OpenFlow14 dump-flows br0 | ofctl_strip | sort], [0],
2059 [expout])
2060
2061 AT_CHECK([ovs-ofctl -O OpenFlow14 del-flows br0 out_group=3])
2062 (grep -v 'group:[[23]]' flows.txt; echo 'OFPST_FLOW reply (OF1.4):') > expout
2063 AT_CHECK([ovs-ofctl -O OpenFlow14 dump-flows br0 | ofctl_strip | sort], [0],
2064 [expout])
2065
2066 AT_CHECK([ovs-ofctl -O OpenFlow14 del-flows br0 out_group=1])
2067 (grep -v 'group:[[123]]' flows.txt; echo 'OFPST_FLOW reply (OF1.4):') > expout
2068 AT_CHECK([ovs-ofctl -O OpenFlow14 dump-flows br0 | ofctl_strip | sort], [0],
2069 [expout])
2070
2071 OVS_VSWITCHD_STOP
2072 AT_CLEANUP
2073
2074 AT_SETUP([ofproto - bundle packet-out (OpenFlow 1.4)])
2075 OVS_VSWITCHD_START
2076
2077 ovs-ofctl del-flows br0
2078 ovs-ofctl add-flow br0 priority=0,actions=drop
2079
2080 # Start a monitor listening for packet-ins.
2081 AT_CHECK([ovs-ofctl -P standard monitor br0 --detach --no-chdir --pidfile])
2082 ovs-appctl -t ovs-ofctl ofctl/send 0109000c0123456700000080
2083 ovs-appctl -t ovs-ofctl ofctl/barrier
2084 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
2085 AT_CAPTURE_FILE([monitor.log])
2086
2087 # This bundle adds a group, a flow using that group and then a
2088 # packet-out that needs them both. Finally the bundle deletes all
2089 # groups, which also deletes the flow, leaving only the drop flow in
2090 # the table. If this works properly, the packet-out should get
2091 # translated and processed before the flow disappears. Also, if the
2092 # bundle were to fail, the packet-in should not get executed.
2093 AT_DATA([bundle.txt], [dnl
2094 group group_id=1,type=all,bucket=output:controller
2095 flow in_port=6 actions=group:1
2096 packet-out in_port=6, packet=0001020304050010203040501234 actions=table
2097 group delete
2098 ])
2099 AT_CHECK([ovs-ofctl bundle br0 bundle.txt])
2100
2101 # Verify that only the drop flow remains.
2102 AT_CHECK([ovs-ofctl -O OpenFlow14 dump-flows br0 | ofctl_strip | sort], [0],
2103 [ reset_counts priority=0 actions=drop
2104 OFPST_FLOW reply (OF1.4):
2105 ])
2106
2107 # Verify that the packet-in was received via controller action.
2108 AT_CHECK([sed 's/ (xid=0x[[1-9a-fA-F]][[0-9a-fA-F]]*)//' monitor.log], [0],
2109 [OFPT_PACKET_IN (xid=0x0): total_len=14 in_port=6 (via action) data_len=14 (unbuffered)
2110 vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1234
2111 ])
2112
2113 OVS_VSWITCHD_STOP
2114 AT_CLEANUP
2115
2116 AT_SETUP([ofproto - bundle packet-out, failing bundle commit (OpenFlow 1.4)])
2117 OVS_VSWITCHD_START
2118
2119 ovs-ofctl del-flows br0
2120 ovs-ofctl add-flow br0 priority=0,actions=drop
2121
2122 # Start a monitor listening for packet-ins.
2123 AT_CHECK([ovs-ofctl -P standard monitor br0 --detach --no-chdir --pidfile])
2124 ovs-appctl -t ovs-ofctl ofctl/send 0109000c0123456700000080
2125 ovs-appctl -t ovs-ofctl ofctl/barrier
2126 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
2127 AT_CAPTURE_FILE([monitor.log])
2128
2129 # This bundle adds a flow using that group and then a packet-out that
2130 # needs them both. Finally the bundle adds another flow that referes
2131 # to a non-existing group, causing the bundle to fail, and the
2132 # packet-in should not get executed.
2133 AT_DATA([bundle.txt], [dnl
2134 group group_id=1,type=all,bucket=output:controller
2135 flow in_port=6 actions=group:1
2136 packet-out in_port=6, packet=0001020304050010203040501234 actions=table
2137 flow in_port=7 actions=group:2
2138 ])
2139 AT_CHECK([ovs-ofctl bundle br0 bundle.txt 2>&1 | sed '/talking to/,$d' | strip_xids], [], [dnl
2140 Error OFPBAC_BAD_OUT_GROUP for: OFPT_FLOW_MOD (OF1.4): ADD in_port=7 actions=group:2
2141 Error OFPBFC_MSG_FAILED for: OFPT_BUNDLE_CONTROL (OF1.4):
2142 bundle_id=0 type=COMMIT_REQUEST flags=atomic ordered
2143 ])
2144
2145 # Verify that only the drop flow remains.
2146 AT_CHECK([ovs-ofctl -O OpenFlow14 dump-flows br0 | ofctl_strip | sort], [0],
2147 [ reset_counts priority=0 actions=drop
2148 OFPST_FLOW reply (OF1.4):
2149 ])
2150
2151 # Verify that the packet-in was NOT received via controller action.
2152 AT_CHECK([strip_xids < monitor.log], [0], [])
2153
2154 OVS_VSWITCHD_STOP
2155 AT_CLEANUP
2156
2157 AT_SETUP([ofproto - bundle packet-out makes bundle commit to fail(OpenFlow 1.4)])
2158 OVS_VSWITCHD_START
2159
2160 ovs-ofctl del-flows br0
2161 ovs-ofctl add-flow br0 priority=0,actions=drop
2162
2163 # Start a monitor listening for packet-ins.
2164 AT_CHECK([ovs-ofctl -P standard monitor br0 --detach --no-chdir --pidfile])
2165 ovs-appctl -t ovs-ofctl ofctl/send 0109000c0123456700000080
2166 ovs-appctl -t ovs-ofctl ofctl/barrier
2167 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
2168 AT_CAPTURE_FILE([monitor.log])
2169
2170 # This bundle adds a flow using that group and then a packet-out that
2171 # needs them both. Finally the bundle adds another flow that referes
2172 # to a non-existing group, causing the bundle to fail, and the
2173 # packet-in should not get executed.
2174 AT_DATA([bundle.txt], [dnl
2175 group group_id=1,type=all,bucket=output:controller
2176 flow in_port=6 actions=group:1
2177 packet-out in_port=6, packet=0001020304050010203040501234 actions=table
2178 packet-out in_port=6, packet=0001020304050010203040501234 actions=group:2
2179 ])
2180 AT_CHECK([ovs-ofctl bundle br0 bundle.txt 2>&1 | sed '/talking to/,$d' | strip_xids], [], [dnl
2181 Error OFPBAC_BAD_OUT_GROUP for: OFPT_PACKET_OUT (OF1.4): in_port=6 actions=group:2 data_len=14
2182 vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1234
2183 Error OFPBFC_MSG_FAILED for: OFPT_BUNDLE_CONTROL (OF1.4):
2184 bundle_id=0 type=COMMIT_REQUEST flags=atomic ordered
2185 ])
2186
2187 # Verify that only the drop flow remains.
2188 AT_CHECK([ovs-ofctl -O OpenFlow14 dump-flows br0 | ofctl_strip | sort], [0],
2189 [ reset_counts priority=0 actions=drop
2190 OFPST_FLOW reply (OF1.4):
2191 ])
2192
2193 # Verify that the packet-in was NOT received via controller action.
2194 AT_CHECK([strip_xids < monitor.log], [0], [])
2195
2196 OVS_VSWITCHD_STOP
2197 AT_CLEANUP
2198
2199 AT_SETUP([ofproto - flow table configuration (OpenFlow 1.0)])
2200 OVS_VSWITCHD_START
2201 # Check the default configuration.
2202 head_table() {
2203 printf 'OFPST_TABLE reply (xid=0x2):
2204 table 0%s:
2205 active=0, lookup=0, matched=0
2206 max_entries=1000000
2207 matching:
2208 exact match or wildcard: in_port eth_{src,dst,type} vlan_{vid,pcp} ip_{src,dst} nw_{proto,tos} tcp_{src,dst}
2209
2210 ' "$1"
2211 }
2212 (head_table; echo ' tables 1...253: ditto') > expout
2213 AT_CHECK([ovs-ofctl dump-tables br0], [0], [expout])
2214 # Change the configuration.
2215 AT_CHECK(
2216 [ovs-vsctl \
2217 -- --id=@t0 create Flow_Table name=main \
2218 -- --id=@t1 create Flow_Table flow-limit=1024 \
2219 -- set bridge br0 'flow_tables={1=@t1,0=@t0}' \
2220 | uuidfilt],
2221 [0], [<0>
2222 <1>
2223 ])
2224 # Check that the configuration was updated.
2225 (head_table ' ("main")'; echo ' table 1:
2226 active=0, lookup=0, matched=0
2227 max_entries=1024
2228 (same matching)
2229
2230 table 2:
2231 active=0, lookup=0, matched=0
2232 max_entries=1000000
2233 (same matching)
2234 '; echo ' tables 3...253: ditto') > expout
2235 AT_CHECK([ovs-ofctl dump-tables br0], [0], [expout])
2236 OVS_VSWITCHD_STOP
2237 AT_CLEANUP
2238
2239 dnl In-band and fail-open add "hidden rules" to table 0. These rules shouldn't
2240 dnl be visible to OpenFlow. This test checks that "dump-flows" and
2241 dnl "dump-tables" don't make them visible.
2242 AT_SETUP([ofproto - hidden rules not in table stats])
2243 # Use an IP address for a controller that won't actually exist: we
2244 # want to create in-band rules but we do not want to actually connect
2245 # to a controller (because that could mess about with our test). The
2246 # Class E range 240.0.0.0 - 255.255.255.255 seems like a good choice.
2247 OVS_VSWITCHD_START([set-controller br0 tcp:240.0.0.1:6653])
2248 for i in 1 2 3 4 5; do ovs-appctl time/warp 1000; done
2249
2250 # Check that no hidden flows are visible in OpenFlow.
2251 AT_CHECK([ovs-ofctl dump-flows br0 | strip_xids], [0], [NXST_FLOW reply:
2252 ])
2253
2254 # Check that some hidden flows related to 240.0.0.1 are actually in table 0.
2255 #
2256 # We discard flows that mention table_id because we only want table 0 flows,
2257 # which in OVS is implied by the absence of a table_id.
2258 AT_CHECK([ovs-appctl bridge/dump-flows br0], [0], [stdout])
2259 AT_CHECK([test `grep '240\.0\.0\.1' stdout | grep -v table_id= | wc -l` -gt 0])
2260
2261 # Check that dump-tables doesn't count the hidden flows.
2262 head_table() {
2263 printf 'OFPST_TABLE reply:
2264 table 0:
2265 active=0, lookup=0, matched=0
2266 max_entries=1000000
2267 matching:
2268 exact match or wildcard: in_port eth_{src,dst,type} vlan_{vid,pcp} ip_{src,dst} nw_{proto,tos} tcp_{src,dst}
2269
2270 '
2271 }
2272 (head_table; echo ' tables 1...253: ditto') > expout
2273 AT_CHECK([ovs-ofctl dump-tables br0 | strip_xids], [0], [expout])
2274 OVS_VSWITCHD_STOP(["/240\.0\.0\.1/d"])
2275 AT_CLEANUP
2276
2277 AT_SETUP([ofproto - flow table configuration (OpenFlow 1.2)])
2278 OVS_VSWITCHD_START
2279 # Check the default configuration.
2280 head_table() {
2281 printf 'OFPST_TABLE reply (OF1.2) (xid=0x2):
2282 table 0%s:
2283 active=0, lookup=0, matched=0
2284 metadata: match=0xffffffffffffffff write=0xffffffffffffffff
2285 config=controller
2286 max_entries=1000000
2287 instructions (table miss and others):
2288 instructions: apply_actions clear_actions write_actions write_metadata goto_table
2289 Write-Actions and Apply-Actions features:
2290 actions: output group set_field strip_vlan push_vlan mod_nw_ttl dec_ttl set_mpls_ttl dec_mpls_ttl push_mpls pop_mpls set_queue
2291 supported on Set-Field: metadata in_port_oxm eth_{src,dst} vlan_{vid,pcp} mpls_{label,tc} ip_{src,dst} ipv6_{src,dst,label} ip_dscp nw_ecn arp_{op,spa,tpa,sha,tha} tcp_{src,dst} udp_{src,dst} sctp_{src,dst} icmp_{type,code} icmpv6_{type,code} nd_{target,sll,tll}
2292 matching:
2293 exact match or wildcard: metadata in_port_oxm eth_{src,dst,type} vlan_{vid,pcp} mpls_{label,tc} ip_{src,dst} ipv6_{src,dst,label} nw_proto ip_dscp nw_ecn arp_{op,spa,tpa,sha,tha} tcp_{src,dst} udp_{src,dst} sctp_{src,dst} icmp_{type,code} icmpv6_{type,code} nd_{target,sll,tll}
2294
2295 ' "$1"
2296 }
2297 tail_table() {
2298 printf ' table 253:
2299 active=0, lookup=0, matched=0
2300 metadata: match=0xffffffffffffffff write=0xffffffffffffffff
2301 config=controller
2302 max_entries=1000000
2303 instructions (table miss and others):
2304 instructions: apply_actions clear_actions write_actions write_metadata
2305 (same actions)
2306 (same matching)
2307 '
2308 }
2309 (head_table; printf ' tables 1...252: ditto\n\n'; tail_table) > expout
2310 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-tables br0], [0], [expout])
2311 # Change the configuration.
2312 AT_CHECK(
2313 [ovs-vsctl \
2314 -- --id=@t0 create Flow_Table name=main \
2315 -- --id=@t1 create Flow_Table flow-limit=1024 \
2316 -- set bridge br0 'flow_tables={1=@t1,0=@t0}' \
2317 | uuidfilt],
2318 [0], [<0>
2319 <1>
2320 ])
2321 # Check that the configuration was updated.
2322 (head_table ' ("main")'; echo ' table 1:
2323 active=0, lookup=0, matched=0
2324 metadata: match=0xffffffffffffffff write=0xffffffffffffffff
2325 config=controller
2326 max_entries=1024
2327 (same instructions)
2328 (same matching)
2329
2330 table 2:
2331 active=0, lookup=0, matched=0
2332 metadata: match=0xffffffffffffffff write=0xffffffffffffffff
2333 config=controller
2334 max_entries=1000000
2335 (same instructions)
2336 (same matching)
2337 '; printf ' tables 3...252: ditto\n\n'; tail_table) > expout
2338 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-tables br0], [0], [expout])
2339 OVS_VSWITCHD_STOP
2340 AT_CLEANUP
2341
2342 AT_SETUP([ofproto - table features (OpenFlow 1.3)])
2343 OVS_VSWITCHD_START
2344 head_table () {
2345 printf ' table 0%s:
2346 metadata: match=0xffffffffffffffff write=0xffffffffffffffff
2347 max_entries=1000000
2348 instructions (table miss and others):
2349 next tables: 1-253
2350 instructions: meter apply_actions clear_actions write_actions write_metadata goto_table
2351 Write-Actions and Apply-Actions features:
2352 actions: output group set_field strip_vlan push_vlan mod_nw_ttl dec_ttl set_mpls_ttl dec_mpls_ttl push_mpls pop_mpls set_queue
2353 supported on Set-Field: tun_{id,src,dst,ipv6_{src,dst},flags,gbp_{id,flags},erspan_{idx,ver,dir,hwid},metadata0...metadata63} metadata in_{port,port_oxm} pkt_mark ct_{mark,label} reg0...reg15 xreg0...xreg7 xxreg0...xxreg3 eth_{src,dst} vlan_{tci,vid,pcp} mpls_{label,tc,ttl} ip_{src,dst} ipv6_{src,dst,label} nw_tos ip_dscp nw_{ecn,ttl} arp_{op,spa,tpa,sha,tha} tcp_{src,dst} udp_{src,dst} sctp_{src,dst} icmp_{type,code} icmpv6_{type,code} nd_{target,sll,tll,reserved,options_type} nsh_{flags,spi,si,c1...c4,ttl}
2354 matching:
2355 arbitrary mask: dp_hash tun_{id,src,dst,ipv6_{src,dst},flags,gbp_{id,flags},erspan_{idx,ver,dir,hwid},gtpu_{flags,msgtype},metadata0...metadata63} metadata pkt_mark ct_{state,mark,label,nw_{src,dst},ipv6_{src,dst},tp_{src,dst}} reg0...reg15 xreg0...xreg7 xxreg0...xxreg3 eth_{src,dst} vlan_{tci,vid} ip_{src,dst} ipv6_{src,dst,label} ip_frag arp_{spa,tpa,sha,tha} tcp_{src,dst,flags} udp_{src,dst} sctp_{src,dst} nd_{target,sll,tll} nsh_{flags,c1...c4}
2356 exact match or wildcard: recirc_id packet_type conj_id in_{port,port_oxm} actset_output ct_{zone,nw_proto} eth_type vlan_pcp mpls_{label,tc,bos,ttl} nw_{proto,tos} ip_dscp nw_{ecn,ttl} arp_op icmp_{type,code} icmpv6_{type,code} nd_{reserved,options_type} nsh_{mdtype,np,spi,si,ttl}
2357
2358 ' "$1"
2359 }
2360 tail_tables() {
2361 echo ' table 253:
2362 metadata: match=0xffffffffffffffff write=0xffffffffffffffff
2363 max_entries=1000000
2364 instructions (table miss and others):
2365 instructions: meter apply_actions clear_actions write_actions write_metadata
2366 (same actions)
2367 (same matching)
2368 '
2369 }
2370 (head_table
2371 printf ' tables 1...252: ditto\n\n'
2372 tail_tables) > expout
2373 AT_CHECK([ovs-ofctl -O OpenFlow13 dump-table-features br0], [0], [expout])
2374 # Change the configuration.
2375 AT_CHECK(
2376 [ovs-vsctl \
2377 -- --id=@t0 create Flow_Table name=main \
2378 -- --id=@t1 create Flow_Table flow-limit=1024 \
2379 -- set bridge br0 'flow_tables={1=@t1,0=@t0}' \
2380 | uuidfilt],
2381 [0], [<0>
2382 <1>
2383 ])
2384 # Check that the configuration was updated.
2385 (head_table ' ("main")'
2386 echo ' table 1:
2387 metadata: match=0xffffffffffffffff write=0xffffffffffffffff
2388 max_entries=1024
2389 (same instructions)
2390 (same matching)
2391
2392 table 2:
2393 metadata: match=0xffffffffffffffff write=0xffffffffffffffff
2394 max_entries=1000000
2395 (same instructions)
2396 (same matching)
2397
2398 tables 3...252: ditto
2399 '
2400 tail_tables) > expout
2401 AT_CHECK([ovs-ofctl -O OpenFlow13 dump-table-features br0], [0], [expout])
2402 OVS_VSWITCHD_STOP
2403 AT_CLEANUP
2404
2405 AT_SETUP([ofproto - flow table names])
2406 OVS_VSWITCHD_START
2407 add_of_ports br0 1 2
2408
2409 # Set a table name via OpenFlow 1.3 and one via OpenFlow 1.5.
2410 AT_CHECK([ovs-ofctl -O OpenFlow13 mod-table br0 0 name:xyzzy])
2411 AT_CHECK([ovs-ofctl -O OpenFlow15 mod-table br0 1 name:quux])
2412 AT_CHECK([ovs-ofctl -O OpenFlow15 dump-table-features br0 |grep '^ table'],
2413 [0], [dnl
2414 table 0 ("xyzzy"):
2415 table 1 ("quux"): ditto
2416 tables 2...252: ditto
2417 table 253:
2418 ])
2419
2420 # Set some table names via OVSDB.
2421 AT_CHECK(
2422 [ovs-vsctl \
2423 -- --id=@t0 create Flow_Table name=zero \
2424 -- --id=@t1 create Flow_Table name=one \
2425 -- --id=@t2 create Flow_Table name=two \
2426 -- set bridge br0 'flow_tables={0=@t0,1=@t1,2=@t2}' \
2427 | uuidfilt],
2428 [0], [<0>
2429 <1>
2430 <2>
2431 ])
2432 AT_CHECK([ovs-ofctl -O OpenFlow15 dump-table-features br0 |grep '^ table'],
2433 [0], [dnl
2434 table 0 ("zero"):
2435 table 1 ("one"): ditto
2436 table 2 ("two"): ditto
2437 tables 3...252: ditto
2438 table 253:
2439 ])
2440
2441 # Check that flow table parsing and dumping uses the names.
2442 AT_DATA([flows.txt], [dnl
2443 table=zero in_port=p2 actions=p1,resubmit(,one)
2444 table=one,in_port=p1,ip,actions=ct(table=two)
2445 table=one,in_port=p1,arp,actions=goto_table(two)
2446 ])
2447 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
2448 AT_CHECK([ovs-ofctl --names --no-stats dump-flows br0], [0], [dnl
2449 table=zero, in_port=p2 actions=output:p1,resubmit(,one)
2450 table=one, ip,in_port=p1 actions=ct(table=two)
2451 table=one, arp,in_port=p1 actions=resubmit(,two)
2452 ])
2453 AT_CHECK([ovs-ofctl --no-names --no-stats dump-flows br0], [0], [dnl
2454 in_port=2 actions=output:1,resubmit(,1)
2455 table=1, ip,in_port=1 actions=ct(table=2)
2456 table=1, arp,in_port=1 actions=resubmit(,2)
2457 ])
2458
2459 # Setting the same table names via OpenFlow 1.3 or OpenFlow 1.5 is a no-op.
2460 AT_CHECK([ovs-ofctl -O OpenFlow13 mod-table br0 0 name:zero])
2461 AT_CHECK([ovs-ofctl -O OpenFlow15 mod-table br0 1 name:one])
2462 AT_CHECK([ovs-ofctl -O OpenFlow15 dump-table-features br0 |grep '^ table'],
2463 [0], [dnl
2464 table 0 ("zero"):
2465 table 1 ("one"): ditto
2466 table 2 ("two"): ditto
2467 tables 3...252: ditto
2468 table 253:
2469 ])
2470
2471 # Setting different tables names via OpenFlow 1.3 or OpenFlow 1.5 yield errors.
2472 AT_CHECK([ovs-ofctl -O OpenFlow13 mod-table br0 0 name:xyzzy], 1, [], [stderr])
2473 AT_CHECK([head -1 stderr], [0], [OFPT_ERROR (OF1.3) (xid=0x5): OFPTFFC_EPERM
2474 ])
2475 AT_CHECK([ovs-ofctl -O OpenFlow15 mod-table br0 1 name:quux], 1, [], [stderr])
2476 AT_CHECK([head -1 stderr], [0], [OFPT_ERROR (OF1.5) (xid=0x5): OFPTFFC_EPERM
2477 ])
2478
2479 # But we can still set table names for those not set via OVSDB.
2480 AT_CHECK([ovs-ofctl -O OpenFlow13 mod-table br0 3 name:three])
2481 AT_CHECK([ovs-ofctl -O OpenFlow15 dump-table-features br0 |grep '^ table'],
2482 [0], [dnl
2483 table 0 ("zero"):
2484 table 1 ("one"): ditto
2485 table 2 ("two"): ditto
2486 table 3 ("three"): ditto
2487 tables 4...252: ditto
2488 table 253:
2489 ])
2490
2491 # Unsetting names via OVSDB then setting them via OpenFlow works too.
2492 AT_CHECK([ovs-vsctl remove bridge br0 Flow_Table 2])
2493 AT_CHECK([ovs-ofctl -O OpenFlow15 dump-table-features br0 |grep '^ table'],
2494 [0], [dnl
2495 table 0 ("zero"):
2496 table 1 ("one"): ditto
2497 table 2: ditto
2498 table 3 ("three"): ditto
2499 tables 4...252: ditto
2500 table 253:
2501 ])
2502 AT_CHECK([ovs-ofctl -O OpenFlow13 mod-table br0 2 name:foobar])
2503 AT_CHECK([ovs-ofctl -O OpenFlow15 dump-table-features br0 |grep '^ table'],
2504 [0], [dnl
2505 table 0 ("zero"):
2506 table 1 ("one"): ditto
2507 table 2 ("foobar"): ditto
2508 table 3 ("three"): ditto
2509 tables 4...252: ditto
2510 table 253:
2511 ])
2512
2513 # We can clear names via OpenFlow, at least if they were set that way.
2514 AT_CHECK([ovs-ofctl -O OpenFlow13 mod-table br0 2 name:])
2515 AT_CHECK([ovs-ofctl -O OpenFlow15 dump-table-features br0 |grep '^ table'],
2516 [0], [dnl
2517 table 0 ("zero"):
2518 table 1 ("one"): ditto
2519 table 2: ditto
2520 table 3 ("three"): ditto
2521 tables 4...252: ditto
2522 table 253:
2523 ])
2524
2525 OVS_VSWITCHD_STOP
2526 AT_CLEANUP
2527
2528 AT_SETUP([ofproto - table description (OpenFlow 1.4)])
2529 OVS_VSWITCHD_START
2530 (x=0
2531 while test $x -lt 254; do
2532 y=`expr $x + 1`
2533 echo " table $x:
2534 eviction=off eviction_flags=OTHER|IMPORTANCE|LIFETIME
2535 vacancy=off"
2536 x=$y
2537 done) > expout
2538 AT_CHECK([ovs-ofctl -O OpenFlow14 dump-table-desc br0 | sed '/^$/d
2539 /^OFPST_TABLE_DESC/d'], [0], [expout])
2540
2541 # Change the configuration.
2542 AT_CHECK([ovs-ofctl -O Openflow14 mod-table br0 0 evict])
2543 # Check that the configuration was updated.
2544 mv expout orig-expout
2545 sed -e '2s/eviction=off/eviction=on/' <orig-expout > expout
2546 AT_CHECK([ovs-ofctl -O OpenFlow14 dump-table-desc br0 | sed '/^$/d
2547 /^OFPST_TABLE_DESC/d'], [0], [expout])
2548
2549 AT_CHECK([ovs-ofctl -O Openflow14 mod-table br0 0 vacancy:20,80])
2550 # Check that the configuration was updated.
2551 mv expout orig-expout
2552 sed -e '3s/vacancy=off/vacancy=on vacancy_down=20% vacancy_up=80% vacancy=100%/' <orig-expout > expout
2553 AT_CHECK([ovs-ofctl -O OpenFlow14 dump-table-desc br0 | sed '/^$/d
2554 /^OFPST_TABLE_DESC/d'], [0], [expout])
2555 OVS_VSWITCHD_STOP
2556 AT_CLEANUP
2557
2558 AT_SETUP([ofproto - hard limits on flow table size (OpenFlow 1.0)])
2559 OVS_VSWITCHD_START
2560 # Configure a maximum of 4 flows.
2561 AT_CHECK(
2562 [ovs-vsctl \
2563 -- --id=@t0 create Flow_Table flow-limit=4 \
2564 -- set bridge br0 flow_tables:0=@t0 \
2565 | uuidfilt],
2566 [0], [<0>
2567 ])
2568 # Add 4 flows.
2569 for in_port in 1 2 3 4; do
2570 ovs-ofctl add-flow br0 in_port=$in_port,actions=drop
2571 done
2572 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
2573 in_port=1 actions=drop
2574 in_port=2 actions=drop
2575 in_port=3 actions=drop
2576 in_port=4 actions=drop
2577 NXST_FLOW reply:
2578 ])
2579 # Adding another flow will be refused.
2580 AT_CHECK([ovs-ofctl add-flow br0 in_port=5,actions=drop], [1], [], [stderr])
2581 AT_CHECK([ofctl_strip < stderr], [0],
2582 [OFPT_ERROR: OFPFMFC_TABLE_FULL
2583 OFPT_FLOW_MOD: ADD in_port=5 actions=drop
2584 ])
2585 # Also a mod-flow that would add a flow will be refused.
2586 AT_CHECK([ovs-ofctl mod-flows br0 in_port=5,actions=drop], [1], [], [stderr])
2587 AT_CHECK([ofctl_strip < stderr], [0],
2588 [OFPT_ERROR: OFPFMFC_TABLE_FULL
2589 OFPT_FLOW_MOD: MOD in_port=5 actions=drop
2590 ])
2591 # Replacing or modifying an existing flow is allowed.
2592 AT_CHECK([ovs-ofctl add-flow br0 in_port=4,actions=normal])
2593 AT_CHECK([ovs-ofctl mod-flows br0 in_port=3,actions=output:1])
2594 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
2595 in_port=1 actions=drop
2596 in_port=2 actions=drop
2597 in_port=3 actions=output:1
2598 in_port=4 actions=NORMAL
2599 NXST_FLOW reply:
2600 ])
2601 OVS_VSWITCHD_STOP
2602 AT_CLEANUP
2603
2604 AT_SETUP([ofproto - hard limits on flow table size (OpenFlow 1.2)])
2605 OVS_VSWITCHD_START
2606 # Configure a maximum of 4 flows.
2607 AT_CHECK(
2608 [ovs-vsctl \
2609 -- --id=@t0 create Flow_Table flow-limit=4 \
2610 -- set bridge br0 flow_tables:0=@t0 \
2611 | uuidfilt],
2612 [0], [<0>
2613 ])
2614 # Add 4 flows.
2615 for in_port in 1 2 3 4; do
2616 ovs-ofctl -O OpenFlow12 add-flow br0 in_port=$in_port,actions=drop
2617 done
2618 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
2619 in_port=1 actions=drop
2620 in_port=2 actions=drop
2621 in_port=3 actions=drop
2622 in_port=4 actions=drop
2623 OFPST_FLOW reply (OF1.2):
2624 ])
2625 # Adding another flow will be refused.
2626 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 in_port=5,actions=drop], [1], [], [stderr])
2627 AT_CHECK([ofctl_strip < stderr], [0],
2628 [OFPT_ERROR (OF1.2): OFPFMFC_TABLE_FULL
2629 OFPT_FLOW_MOD (OF1.2): ADD in_port=5 actions=drop
2630 ])
2631 # Replacing or modifying an existing flow is allowed.
2632 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 in_port=4,actions=normal])
2633 AT_CHECK([ovs-ofctl -O OpenFlow12 mod-flows br0 in_port=3,actions=output:1])
2634 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
2635 in_port=1 actions=drop
2636 in_port=2 actions=drop
2637 in_port=3 actions=output:1
2638 in_port=4 actions=NORMAL
2639 OFPST_FLOW reply (OF1.2):
2640 ])
2641 OVS_VSWITCHD_STOP
2642 AT_CLEANUP
2643
2644 AT_SETUP([ofproto - eviction upon table overflow (OpenFlow 1.0)])
2645 OVS_VSWITCHD_START
2646 # Configure a maximum of 4 flows.
2647 AT_CHECK(
2648 [ovs-vsctl \
2649 -- --id=@t0 create Flow_Table flow-limit=4 overflow-policy=evict \
2650 -- set bridge br0 flow_tables:0=@t0 \
2651 | uuidfilt],
2652 [0], [<0>
2653 ])
2654 # Add 4 flows.
2655 for in_port in 4 3 2 1; do
2656 ovs-ofctl add-flow br0 idle_timeout=${in_port}0,in_port=$in_port,actions=drop
2657 done
2658 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
2659 idle_timeout=10, in_port=1 actions=drop
2660 idle_timeout=20, in_port=2 actions=drop
2661 idle_timeout=30, in_port=3 actions=drop
2662 idle_timeout=40, in_port=4 actions=drop
2663 NXST_FLOW reply:
2664 ])
2665 # Adding another flow will cause the one that expires soonest to be evicted.
2666 AT_CHECK([ovs-ofctl add-flow br0 in_port=5,actions=drop])
2667 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
2668 idle_timeout=20, in_port=2 actions=drop
2669 idle_timeout=30, in_port=3 actions=drop
2670 idle_timeout=40, in_port=4 actions=drop
2671 in_port=5 actions=drop
2672 NXST_FLOW reply:
2673 ])
2674 # A mod-flow that adds a flow also causes eviction, but replacing or
2675 # modifying an existing flow doesn't.
2676 AT_CHECK([ovs-ofctl mod-flows br0 in_port=6,actions=drop])
2677 AT_CHECK([ovs-ofctl add-flow br0 in_port=4,actions=normal])
2678 AT_CHECK([ovs-ofctl mod-flows br0 in_port=3,actions=output:1])
2679 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
2680 idle_timeout=30, in_port=3 actions=output:1
2681 in_port=4 actions=NORMAL
2682 in_port=5 actions=drop
2683 in_port=6 actions=drop
2684 NXST_FLOW reply:
2685 ])
2686 # Flows with no timeouts at all cannot be evicted.
2687 AT_CHECK([ovs-ofctl add-flow br0 in_port=7,actions=normal])
2688 AT_CHECK([ovs-ofctl add-flow br0 in_port=8,actions=drop], [1], [], [stderr])
2689 AT_CHECK([ofctl_strip < stderr], [0],
2690 [OFPT_ERROR: OFPFMFC_TABLE_FULL
2691 OFPT_FLOW_MOD: ADD in_port=8 actions=drop
2692 ])
2693 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
2694 in_port=4 actions=NORMAL
2695 in_port=5 actions=drop
2696 in_port=6 actions=drop
2697 in_port=7 actions=NORMAL
2698 NXST_FLOW reply:
2699 ])
2700 OVS_VSWITCHD_STOP
2701 AT_CLEANUP
2702
2703 AT_SETUP([ofproto - eviction upon table overflow (OpenFlow 1.2)])
2704 OVS_VSWITCHD_START
2705 # Configure a maximum of 4 flows.
2706 AT_CHECK(
2707 [ovs-vsctl \
2708 -- --id=@t0 create Flow_Table flow-limit=4 overflow-policy=evict \
2709 -- set bridge br0 flow_tables:0=@t0 \
2710 | uuidfilt],
2711 [0], [<0>
2712 ])
2713 # Add 4 flows.
2714 for in_port in 4 3 2 1; do
2715 ovs-ofctl -O OpenFlow12 add-flow br0 idle_timeout=${in_port}0,in_port=$in_port,actions=drop
2716 done
2717 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
2718 idle_timeout=10, in_port=1 actions=drop
2719 idle_timeout=20, in_port=2 actions=drop
2720 idle_timeout=30, in_port=3 actions=drop
2721 idle_timeout=40, in_port=4 actions=drop
2722 OFPST_FLOW reply (OF1.2):
2723 ])
2724 # Adding another flow will cause the one that expires soonest to be evicted.
2725 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 in_port=5,actions=drop])
2726 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
2727 idle_timeout=20, in_port=2 actions=drop
2728 idle_timeout=30, in_port=3 actions=drop
2729 idle_timeout=40, in_port=4 actions=drop
2730 in_port=5 actions=drop
2731 OFPST_FLOW reply (OF1.2):
2732 ])
2733 # In OpenFlow 1.2 a mod-flow does not ever add a flow and thus
2734 # has no effect on eviction
2735 AT_CHECK([ovs-ofctl -O OpenFlow12 mod-flows br0 in_port=6,actions=drop])
2736 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 in_port=4,actions=normal])
2737 AT_CHECK([ovs-ofctl -O OpenFlow12 mod-flows br0 in_port=3,actions=output:1])
2738 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
2739 idle_timeout=20, in_port=2 actions=drop
2740 idle_timeout=30, in_port=3 actions=output:1
2741 in_port=4 actions=NORMAL
2742 in_port=5 actions=drop
2743 OFPST_FLOW reply (OF1.2):
2744 ])
2745 # Flows with no timeouts at all cannot be evicted.
2746 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 in_port=6,actions=drop])
2747 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 in_port=7,actions=normal])
2748 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 in_port=8,actions=drop], [1], [], [stderr])
2749 AT_CHECK([ofctl_strip < stderr], [0],
2750 [OFPT_ERROR (OF1.2): OFPFMFC_TABLE_FULL
2751 OFPT_FLOW_MOD (OF1.2): ADD in_port=8 actions=drop
2752 ])
2753 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
2754 in_port=4 actions=NORMAL
2755 in_port=5 actions=drop
2756 in_port=6 actions=drop
2757 in_port=7 actions=NORMAL
2758 OFPST_FLOW reply (OF1.2):
2759 ])
2760 OVS_VSWITCHD_STOP
2761 AT_CLEANUP
2762
2763 AT_SETUP([ofproto - eviction using importance upon table overflow (OpenFlow 1.4)])
2764 OVS_VSWITCHD_START
2765 # Configure a maximum of 4 flows.
2766 AT_CHECK(
2767 [ovs-vsctl \
2768 -- --id=@t0 create Flow_Table name=evict flow-limit=4 \
2769 -- set bridge br0 flow_tables:0=@t0 \
2770 | uuidfilt],
2771 [0], [<0>
2772 ])
2773 # Use mod-table to turn on eviction just to demonstrate that it works.
2774 AT_CHECK([ovs-ofctl -O OpenFlow14 mod-table br0 0 evict])
2775 # Add 4 flows.
2776 for in_port in 4 3 2 1; do
2777 ovs-ofctl -O Openflow14 add-flow br0 importance=$((in_port + 30)),priority=$((in_port + 5)),hard_timeout=$((in_port + 500)),actions=drop
2778 done
2779 AT_CHECK([ovs-ofctl -O Openflow14 dump-flows br0 | ofctl_strip | sort], [0], [dnl
2780 hard_timeout=501, importance=31, priority=6 actions=drop
2781 hard_timeout=502, importance=32, priority=7 actions=drop
2782 hard_timeout=503, importance=33, priority=8 actions=drop
2783 hard_timeout=504, importance=34, priority=9 actions=drop
2784 OFPST_FLOW reply (OF1.4):
2785 ])
2786 # Adding another flow will cause the one with lowest importance to be evicted.
2787 AT_CHECK([ovs-ofctl -O Openflow14 add-flow br0 hard_timeout=505,importance=35,priority=10,in_port=2,actions=drop])
2788 AT_CHECK([ovs-ofctl -O Openflow14 dump-flows br0 | ofctl_strip | sort], [0], [dnl
2789 hard_timeout=502, importance=32, priority=7 actions=drop
2790 hard_timeout=503, importance=33, priority=8 actions=drop
2791 hard_timeout=504, importance=34, priority=9 actions=drop
2792 hard_timeout=505, importance=35, priority=10,in_port=2 actions=drop
2793 OFPST_FLOW reply (OF1.4):
2794 ])
2795 # Disable the Eviction configuration.
2796 AT_CHECK([ovs-ofctl -O OpenFlow14 mod-table br0 0 noevict])
2797 # Adding another flow will cause the system to give error for FULL TABLE.
2798 AT_CHECK([ovs-ofctl -O Openflow14 add-flow br0 hard_timeout=506,importance=36,priority=11,actions=drop],[1], [], [stderr])
2799 AT_CHECK([ofctl_strip < stderr], [0],
2800 [OFPT_ERROR (OF1.4): OFPFMFC_TABLE_FULL
2801 OFPT_FLOW_MOD (OF1.4): ADD priority=11 hard:506 importance:36 actions=drop
2802 ])
2803 #Dump flows. It should show only the old values
2804 AT_CHECK([ovs-ofctl -O Openflow14 dump-flows br0 | ofctl_strip | sort], [0], [dnl
2805 hard_timeout=502, importance=32, priority=7 actions=drop
2806 hard_timeout=503, importance=33, priority=8 actions=drop
2807 hard_timeout=504, importance=34, priority=9 actions=drop
2808 hard_timeout=505, importance=35, priority=10,in_port=2 actions=drop
2809 OFPST_FLOW reply (OF1.4):
2810 ])
2811 # mod-flow that would modify a flow will be done successfully.
2812 AT_CHECK([ovs-ofctl -O Openflow14 mod-flows br0 in_port=2,actions=NORMAL])
2813 AT_CHECK([ovs-ofctl -O Openflow14 dump-flows br0 | ofctl_strip | sort], [0], [dnl
2814 hard_timeout=502, importance=32, priority=7 actions=drop
2815 hard_timeout=503, importance=33, priority=8 actions=drop
2816 hard_timeout=504, importance=34, priority=9 actions=drop
2817 hard_timeout=505, importance=35, priority=10,in_port=2 actions=NORMAL
2818 OFPST_FLOW reply (OF1.4):
2819 ])
2820 # Also a mod-flow that would add a flow will be refused.
2821 AT_CHECK([ovs-ofctl mod-flows br0 in_port=5,actions=drop], [1], [], [stderr])
2822 AT_CHECK([ofctl_strip < stderr], [0],
2823 [OFPT_ERROR: OFPFMFC_TABLE_FULL
2824 OFPT_FLOW_MOD: MOD in_port=5 actions=drop
2825 ])
2826 OVS_VSWITCHD_STOP
2827 AT_CLEANUP
2828
2829 AT_SETUP([ofproto - eviction upon table overflow, with fairness (OpenFlow 1.0)])
2830 OVS_VSWITCHD_START
2831 # Configure a maximum of 4 flows.
2832 AT_CHECK(
2833 [ovs-vsctl \
2834 -- --id=@t0 create Flow_Table name=evict flow-limit=4 \
2835 overflow-policy=evict \
2836 groups='"NXM_OF_IN_PORT[[]]"' \
2837 -- set bridge br0 flow_tables:0=@t0 \
2838 | uuidfilt],
2839 [0], [<0>
2840 ])
2841 # Add 4 flows.
2842 ovs-ofctl add-flows br0 - <<EOF
2843 idle_timeout=10 in_port=2 dl_src=00:44:55:66:77:88 actions=drop
2844 idle_timeout=20 in_port=1 dl_src=00:11:22:33:44:55 actions=drop
2845 idle_timeout=30 in_port=1 dl_src=00:22:33:44:55:66 actions=drop
2846 idle_timeout=40 in_port=1 dl_src=00:33:44:55:66:77 actions=drop
2847 EOF
2848 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
2849 idle_timeout=10, in_port=2,dl_src=00:44:55:66:77:88 actions=drop
2850 idle_timeout=20, in_port=1,dl_src=00:11:22:33:44:55 actions=drop
2851 idle_timeout=30, in_port=1,dl_src=00:22:33:44:55:66 actions=drop
2852 idle_timeout=40, in_port=1,dl_src=00:33:44:55:66:77 actions=drop
2853 NXST_FLOW reply:
2854 ])
2855 # Adding another flow will cause the one that expires soonest within
2856 # the largest group (those with in_port=1) to be evicted. In this
2857 # case this is not the same as the one that expires soonest overall
2858 # (which is what makes the test interesting):
2859 AT_CHECK([ovs-ofctl add-flow br0 in_port=2,dl_src=00:55:66:77:88:99,actions=drop])
2860 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
2861 idle_timeout=10, in_port=2,dl_src=00:44:55:66:77:88 actions=drop
2862 idle_timeout=30, in_port=1,dl_src=00:22:33:44:55:66 actions=drop
2863 idle_timeout=40, in_port=1,dl_src=00:33:44:55:66:77 actions=drop
2864 in_port=2,dl_src=00:55:66:77:88:99 actions=drop
2865 NXST_FLOW reply:
2866 ])
2867 # Enlarge the flow limit, change the eviction policy back to strictly
2868 # based on expiration, and and add some flows.
2869 AT_CHECK([ovs-vsctl set Flow_Table evict groups='[[]]' flow-limit=7])
2870 ovs-ofctl add-flows br0 - <<EOF
2871 idle_timeout=50 in_port=2 dl_src=00:66:77:88:99:aa actions=drop
2872 idle_timeout=60 in_port=2 dl_src=00:77:88:99:aa:bb actions=drop
2873 idle_timeout=70 in_port=2 dl_src=00:88:99:aa:bb:cc actions=drop
2874 EOF
2875 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
2876 idle_timeout=10, in_port=2,dl_src=00:44:55:66:77:88 actions=drop
2877 idle_timeout=30, in_port=1,dl_src=00:22:33:44:55:66 actions=drop
2878 idle_timeout=40, in_port=1,dl_src=00:33:44:55:66:77 actions=drop
2879 idle_timeout=50, in_port=2,dl_src=00:66:77:88:99:aa actions=drop
2880 idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=drop
2881 idle_timeout=70, in_port=2,dl_src=00:88:99:aa:bb:cc actions=drop
2882 in_port=2,dl_src=00:55:66:77:88:99 actions=drop
2883 NXST_FLOW reply:
2884 ])
2885 # Adding another flow will cause the one that expires soonest overall
2886 # to be evicted.
2887 AT_CHECK([ovs-ofctl add-flow br0 'idle_timeout=80 in_port=2 dl_src=00:99:aa:bb:cc:dd actions=drop'])
2888 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
2889 idle_timeout=30, in_port=1,dl_src=00:22:33:44:55:66 actions=drop
2890 idle_timeout=40, in_port=1,dl_src=00:33:44:55:66:77 actions=drop
2891 idle_timeout=50, in_port=2,dl_src=00:66:77:88:99:aa actions=drop
2892 idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=drop
2893 idle_timeout=70, in_port=2,dl_src=00:88:99:aa:bb:cc actions=drop
2894 idle_timeout=80, in_port=2,dl_src=00:99:aa:bb:cc:dd actions=drop
2895 in_port=2,dl_src=00:55:66:77:88:99 actions=drop
2896 NXST_FLOW reply:
2897 ])
2898 # Reducing the flow limit also causes the flows that expire soonest
2899 # overall to be evicted.
2900 AT_CHECK([ovs-vsctl set Flow_Table evict flow-limit=4])
2901 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
2902 idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=drop
2903 idle_timeout=70, in_port=2,dl_src=00:88:99:aa:bb:cc actions=drop
2904 idle_timeout=80, in_port=2,dl_src=00:99:aa:bb:cc:dd actions=drop
2905 in_port=2,dl_src=00:55:66:77:88:99 actions=drop
2906 NXST_FLOW reply:
2907 ])
2908 OVS_VSWITCHD_STOP
2909 AT_CLEANUP
2910
2911 AT_SETUP([ofproto - eviction upon table overflow, with fairness (OpenFlow 1.2)])
2912 OVS_VSWITCHD_START
2913 # Configure a maximum of 4 flows.
2914 AT_CHECK(
2915 [ovs-vsctl \
2916 -- --id=@t0 create Flow_Table name=evict flow-limit=4 \
2917 overflow-policy=evict \
2918 groups='"NXM_OF_IN_PORT[[]]"' \
2919 -- set bridge br0 flow_tables:0=@t0 \
2920 | uuidfilt],
2921 [0], [<0>
2922 ])
2923 # Add 4 flows.
2924 ovs-ofctl -O OpenFlow12 add-flows br0 - <<EOF
2925 idle_timeout=10 in_port=2 dl_src=00:44:55:66:77:88 actions=drop
2926 idle_timeout=20 in_port=1 dl_src=00:11:22:33:44:55 actions=drop
2927 idle_timeout=30 in_port=1 dl_src=00:22:33:44:55:66 actions=drop
2928 idle_timeout=40 in_port=1 dl_src=00:33:44:55:66:77 actions=drop
2929 EOF
2930 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
2931 idle_timeout=10, in_port=2,dl_src=00:44:55:66:77:88 actions=drop
2932 idle_timeout=20, in_port=1,dl_src=00:11:22:33:44:55 actions=drop
2933 idle_timeout=30, in_port=1,dl_src=00:22:33:44:55:66 actions=drop
2934 idle_timeout=40, in_port=1,dl_src=00:33:44:55:66:77 actions=drop
2935 OFPST_FLOW reply (OF1.2):
2936 ])
2937 # Adding another flow will cause the one that expires soonest within
2938 # the largest group (those with in_port=1) to be evicted. In this
2939 # case this is not the same as the one that expires soonest overall
2940 # (which is what makes the test interesting):
2941 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 in_port=2,dl_src=00:55:66:77:88:99,actions=drop])
2942 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
2943 idle_timeout=10, in_port=2,dl_src=00:44:55:66:77:88 actions=drop
2944 idle_timeout=30, in_port=1,dl_src=00:22:33:44:55:66 actions=drop
2945 idle_timeout=40, in_port=1,dl_src=00:33:44:55:66:77 actions=drop
2946 in_port=2,dl_src=00:55:66:77:88:99 actions=drop
2947 OFPST_FLOW reply (OF1.2):
2948 ])
2949 # Enlarge the flow limit, change the eviction policy back to strictly
2950 # based on expiration, and and add some flows.
2951 AT_CHECK([ovs-vsctl set Flow_Table evict groups='[[]]' flow-limit=7])
2952 ovs-ofctl -O OpenFlow12 add-flows br0 - <<EOF
2953 idle_timeout=50 in_port=2 dl_src=00:66:77:88:99:aa actions=drop
2954 idle_timeout=60 in_port=2 dl_src=00:77:88:99:aa:bb actions=drop
2955 idle_timeout=70 in_port=2 dl_src=00:88:99:aa:bb:cc actions=drop
2956 EOF
2957 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
2958 idle_timeout=10, in_port=2,dl_src=00:44:55:66:77:88 actions=drop
2959 idle_timeout=30, in_port=1,dl_src=00:22:33:44:55:66 actions=drop
2960 idle_timeout=40, in_port=1,dl_src=00:33:44:55:66:77 actions=drop
2961 idle_timeout=50, in_port=2,dl_src=00:66:77:88:99:aa actions=drop
2962 idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=drop
2963 idle_timeout=70, in_port=2,dl_src=00:88:99:aa:bb:cc actions=drop
2964 in_port=2,dl_src=00:55:66:77:88:99 actions=drop
2965 OFPST_FLOW reply (OF1.2):
2966 ])
2967 # Adding another flow will cause the one that expires soonest overall
2968 # to be evicted.
2969 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 'idle_timeout=80 in_port=2 dl_src=00:99:aa:bb:cc:dd actions=drop'])
2970 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
2971 idle_timeout=30, in_port=1,dl_src=00:22:33:44:55:66 actions=drop
2972 idle_timeout=40, in_port=1,dl_src=00:33:44:55:66:77 actions=drop
2973 idle_timeout=50, in_port=2,dl_src=00:66:77:88:99:aa actions=drop
2974 idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=drop
2975 idle_timeout=70, in_port=2,dl_src=00:88:99:aa:bb:cc actions=drop
2976 idle_timeout=80, in_port=2,dl_src=00:99:aa:bb:cc:dd actions=drop
2977 in_port=2,dl_src=00:55:66:77:88:99 actions=drop
2978 OFPST_FLOW reply (OF1.2):
2979 ])
2980 # Reducing the flow limit also causes the flows that expire soonest
2981 # overall to be evicted.
2982 AT_CHECK([ovs-vsctl set Flow_Table evict flow-limit=4])
2983 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
2984 idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=drop
2985 idle_timeout=70, in_port=2,dl_src=00:88:99:aa:bb:cc actions=drop
2986 idle_timeout=80, in_port=2,dl_src=00:99:aa:bb:cc:dd actions=drop
2987 in_port=2,dl_src=00:55:66:77:88:99 actions=drop
2988 OFPST_FLOW reply (OF1.2):
2989 ])
2990 OVS_VSWITCHD_STOP
2991 AT_CLEANUP
2992
2993 AT_SETUP([ofproto - eviction upon table overflow, with modified hard timeout])
2994 OVS_VSWITCHD_START
2995 # Configure a maximum of 4 flows.
2996 AT_CHECK(
2997 [ovs-vsctl \
2998 -- --id=@t0 create Flow_Table flow-limit=4 overflow-policy=evict \
2999 -- set bridge br0 flow_tables:0=@t0 \
3000 | uuidfilt],
3001 [0], [<0>
3002 ])
3003 ovs-appctl time/stop
3004 # Add 4 flows.
3005 for in_port in 4 3 2 1; do
3006 ovs-ofctl add-flow br0 hard_timeout=$((10 + in_port * 3)),in_port=$in_port,actions=drop
3007 done
3008 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
3009 hard_timeout=13, in_port=1 actions=drop
3010 hard_timeout=16, in_port=2 actions=drop
3011 hard_timeout=19, in_port=3 actions=drop
3012 hard_timeout=22, in_port=4 actions=drop
3013 NXST_FLOW reply:
3014 ])
3015 # Sleep and modify the one that expires soonest
3016 ovs-appctl time/warp 5000
3017 AT_CHECK([ovs-ofctl mod-flows br0 in_port=1,actions=drop])
3018 # At this point the table would looks like:
3019 # in_port seconds to expire
3020 # 1 13
3021 # 2 11
3022 # 3 14
3023 # 4 17
3024 ovs-appctl time/warp 2000
3025 # Adding another flow will cause the one that expires soonest to be evicted.
3026 AT_CHECK([ovs-ofctl add-flow br0 in_port=5,actions=drop])
3027 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
3028 hard_timeout=13, in_port=1 actions=drop
3029 hard_timeout=19, in_port=3 actions=drop
3030 hard_timeout=22, in_port=4 actions=drop
3031 in_port=5 actions=drop
3032 NXST_FLOW reply:
3033 ])
3034 OVS_VSWITCHD_STOP
3035 AT_CLEANUP
3036
3037 AT_SETUP([ofproto - eviction upon table overflow, with modified idle timeout])
3038 OVS_VSWITCHD_START([add-port br0 p1 -- set interface p1 type=dummy ofport_request=1])
3039 # Configure a maximum of 4 flows.
3040 AT_CHECK(
3041 [ovs-vsctl \
3042 -- --id=@t0 create Flow_Table flow-limit=4 overflow-policy=evict \
3043 -- set bridge br0 flow_tables:0=@t0 \
3044 | uuidfilt],
3045 [0], [<0>
3046 ])
3047 # Add 4 flows.
3048 for in_port in 4 3 2 1; do
3049 ovs-ofctl add-flow br0 idle_timeout=$((10 + in_port * 3)),in_port=$in_port,actions=drop
3050 done
3051 ovs-appctl time/stop
3052 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
3053 idle_timeout=13, in_port=1 actions=drop
3054 idle_timeout=16, in_port=2 actions=drop
3055 idle_timeout=19, in_port=3 actions=drop
3056 idle_timeout=22, in_port=4 actions=drop
3057 NXST_FLOW reply:
3058 ])
3059 # Sleep and receive on the flow that expires soonest
3060 ovs-appctl time/warp 5000
3061 AT_CHECK([ovs-appctl netdev-dummy/receive p1 'in_port(1)'])
3062 # At this point the table would looks like:
3063 # in_port seconds to expire
3064 # 1 13
3065 # 2 11
3066 # 3 14
3067 # 4 17
3068 ovs-appctl time/warp 2000
3069 # Adding another flow will cause the one that expires soonest to be evicted.
3070 AT_CHECK([ovs-ofctl add-flow br0 in_port=5,actions=drop])
3071 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
3072 idle_timeout=19, in_port=3 actions=drop
3073 idle_timeout=22, in_port=4 actions=drop
3074 in_port=5 actions=drop
3075 n_packets=1, n_bytes=14, idle_timeout=13, in_port=1 actions=drop
3076 NXST_FLOW reply:
3077 ])
3078 OVS_VSWITCHD_STOP
3079 AT_CLEANUP
3080
3081 AT_SETUP([ofproto - asynchronous message control (OpenFlow 1.0)])
3082 OVS_VSWITCHD_START([set bridge br0 other_config:hwaddr=00:01:02:03:04:05])
3083 AT_CHECK([ovs-ofctl -P standard monitor br0 --detach --no-chdir --pidfile])
3084 check_async () {
3085 printf '\n\n--- check_async %d ---\n\n\n' $1
3086 shift
3087
3088 ovs-appctl -t ovs-ofctl ofctl/barrier
3089 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
3090 : > expout
3091
3092 # OFPT_PACKET_IN, OFPR_ACTION (controller_id=0)
3093 ovs-ofctl -v packet-out br0 controller controller '0001020304050010203040501234'
3094 if test X"$1" = X"OFPR_ACTION"; then shift;
3095 echo >>expout "OFPT_PACKET_IN: total_len=14 in_port=CONTROLLER (via action) data_len=14 (unbuffered)
3096 vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1234"
3097 fi
3098
3099 # OFPT_PACKET_IN, OFPR_NO_MATCH (controller_id=123)
3100 ovs-ofctl -v packet-out br0 controller 'controller(reason=no_match,id=123)' '0001020304050010203040501234'
3101 if test X"$1" = X"OFPR_NO_MATCH"; then shift;
3102 echo >>expout "OFPT_PACKET_IN: total_len=14 in_port=CONTROLLER (via no_match) data_len=14 (unbuffered)
3103 vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1234"
3104 fi
3105
3106 # OFPT_PACKET_IN, OFPR_INVALID_TTL (controller_id=0)
3107 ovs-ofctl packet-out br0 "in_port=controller packet=002583dfb4000026b98cb0f908004500003eb7e200000011339bac11370dac100002d7730035002b8f6d86fb0100000100000000000006626c702d7873066e696369726103636f6d00000f00 actions=dec_ttl"
3108 if test X"$1" = X"OFPR_INVALID_TTL"; then shift;
3109 echo >>expout "OFPT_PACKET_IN: total_len=76 in_port=CONTROLLER (via invalid_ttl) data_len=76 (unbuffered)
3110 udp,vlan_tci=0x0000,dl_src=00:26:b9:8c:b0:f9,dl_dst=00:25:83:df:b4:00,nw_src=172.17.55.13,nw_dst=172.16.0.2,nw_tos=0,nw_ecn=0,nw_ttl=0,tp_src=55155,tp_dst=53 udp_csum:8f6d"
3111 fi
3112
3113 # OFPT_PORT_STATUS, OFPPR_ADD
3114 ovs-vsctl add-port br0 test -- set Interface test type=dummy ofport_request=1
3115 if test X"$1" = X"OFPPR_ADD"; then shift;
3116 echo >>expout "OFPT_PORT_STATUS: ADD: 1(test): addr:aa:55:aa:55:00:0x
3117 config: 0
3118 state: 0
3119 speed: 0 Mbps now, 0 Mbps max"
3120 fi
3121
3122 # OFPT_PORT_STATUS, OFPPR_DELETE
3123 ovs-vsctl del-port br0 test
3124 if test X"$1" = X"OFPPR_DELETE"; then shift;
3125 echo >>expout "OFPT_PORT_STATUS: DEL: 1(test): addr:aa:55:aa:55:00:0x
3126 config: 0
3127 state: 0
3128 speed: 0 Mbps now, 0 Mbps max"
3129 fi
3130
3131 # OFPT_FLOW_REMOVED, OFPRR_DELETE
3132 ovs-ofctl add-flow br0 send_flow_rem,actions=drop
3133 ovs-ofctl --strict del-flows br0 ''
3134 if test X"$1" = X"OFPRR_DELETE"; then shift;
3135 echo >>expout "OFPT_FLOW_REMOVED: reason=delete"
3136 fi
3137 AT_FAIL_IF([test X"$1" != X])
3138
3139 OVS_WAIT_UNTIL([test `wc -l < "monitor.log"` -ge `wc -l < "expout"`])
3140
3141 AT_CHECK(
3142 [[sed '
3143 s/ (xid=0x[0-9a-fA-F]*)//
3144 s/ *duration.*//
3145 s/00:0.$/00:0x/' < monitor.log]],
3146 [0], [expout])
3147 }
3148
3149 # It's a service connection so initially there should be no async messages.
3150 check_async 1
3151
3152 # Set miss_send_len to 128, turning on packet-ins for our service connection.
3153 ovs-appctl -t ovs-ofctl ofctl/send 0109000c0123456700000080
3154 check_async 2 OFPR_ACTION OFPPR_ADD OFPPR_DELETE OFPRR_DELETE
3155
3156 # Set miss_send_len to 128 and enable invalid_ttl.
3157 ovs-appctl -t ovs-ofctl ofctl/send 0109000c0123456700040080
3158 check_async 3 OFPR_ACTION OFPR_INVALID_TTL OFPPR_ADD OFPPR_DELETE OFPRR_DELETE
3159
3160 # Become secondary, which should disable everything except port status.
3161 ovs-appctl -t ovs-ofctl ofctl/send 0104001400000002000023200000000a00000002
3162 check_async 4 OFPPR_ADD OFPPR_DELETE
3163
3164 # Use NXT_SET_ASYNC_CONFIG to enable a patchwork of asynchronous messages.
3165 ovs-appctl -t ovs-ofctl ofctl/send 01040028000000020000232000000013000000020000000500000005000000020000000200000005
3166 check_async 5 OFPR_INVALID_TTL OFPPR_DELETE OFPRR_DELETE
3167
3168 # Set controller ID 123.
3169 ovs-appctl -t ovs-ofctl ofctl/send 01040018000000030000232000000014000000000000007b
3170 check_async 6 OFPR_NO_MATCH OFPPR_DELETE OFPRR_DELETE
3171
3172 # Restore controller ID 0.
3173 ovs-appctl -t ovs-ofctl ofctl/send 010400180000000300002320000000140000000000000000
3174
3175 # Become primary.
3176 ovs-appctl -t ovs-ofctl ofctl/send 0104001400000002000023200000000a00000001
3177 check_async 7 OFPR_ACTION OFPPR_ADD
3178
3179 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
3180 OVS_VSWITCHD_STOP
3181 AT_CLEANUP
3182
3183 AT_SETUP([ofproto - asynchronous message control (OpenFlow 1.2)])
3184 OVS_VSWITCHD_START
3185 AT_CHECK([ovs-ofctl -O OpenFlow12 -P standard monitor br0 --detach --no-chdir --pidfile])
3186 check_async () {
3187 printf '\n\n--- check_async %d ---\n\n\n' $1
3188 INDEX=$1
3189 shift
3190
3191 ovs-appctl -t ovs-ofctl ofctl/barrier
3192 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
3193 : > expout
3194
3195 # OFPT_PACKET_IN, OFPR_ACTION (controller_id=0)
3196 ovs-ofctl -O OpenFlow12 -v packet-out br0 none controller '0001020304050010203040501234'
3197 if test X"$1" = X"OFPR_ACTION"; then shift;
3198 echo >>expout "OFPT_PACKET_IN (OF1.2): total_len=14 in_port=ANY (via action) data_len=14 (unbuffered)
3199 vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1234"
3200 fi
3201
3202 # OFPT_PACKET_IN, OFPR_NO_MATCH (controller_id=123)
3203 ovs-ofctl -O OpenFlow12 -v packet-out br0 none 'controller(reason=no_match,id=123)' '0001020304050010203040501234'
3204 if test X"$1" = X"OFPR_NO_MATCH"; then shift;
3205 echo >>expout "OFPT_PACKET_IN (OF1.2): total_len=14 in_port=ANY (via no_match) data_len=14 (unbuffered)
3206 vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1234"
3207 fi
3208
3209 # OFPT_PACKET_IN, OFPR_INVALID_TTL (controller_id=0)
3210 ovs-ofctl -O OpenFlow12 packet-out br0 none dec_ttl '002583dfb4000026b98cb0f908004500003eb7e200000011339bac11370dac100002d7730035002b8f6d86fb0100000100000000000006626c702d7873066e696369726103636f6d00000f00'
3211 if test X"$1" = X"OFPR_INVALID_TTL"; then shift;
3212 echo >>expout "OFPT_PACKET_IN (OF1.2): total_len=76 in_port=ANY (via invalid_ttl) data_len=76 (unbuffered)
3213 udp,vlan_tci=0x0000,dl_src=00:26:b9:8c:b0:f9,dl_dst=00:25:83:df:b4:00,nw_src=172.17.55.13,nw_dst=172.16.0.2,nw_tos=0,nw_ecn=0,nw_ttl=0,tp_src=55155,tp_dst=53 udp_csum:8f6d"
3214 fi
3215
3216 # OFPT_PORT_STATUS, OFPPR_ADD
3217 ovs-vsctl add-port br0 test -- set Interface test type=dummy
3218 if test X"$1" = X"OFPPR_ADD"; then shift;
3219 echo >>expout "OFPT_PORT_STATUS (OF1.2): ADD: ${INDEX}(test): addr:aa:55:aa:55:00:0x
3220 config: 0
3221 state: 0
3222 speed: 0 Mbps now, 0 Mbps max
3223 OFPT_PORT_STATUS (OF1.2): MOD: ${INDEX}(test): addr:aa:55:aa:55:00:0x
3224 config: 0
3225 state: LIVE
3226 speed: 0 Mbps now, 0 Mbps max"
3227 fi
3228
3229 # OFPT_PORT_STATUS, OFPPR_DELETE
3230 ovs-vsctl del-port br0 test
3231 if test X"$1" = X"OFPPR_DELETE"; then shift;
3232 echo >>expout "OFPT_PORT_STATUS (OF1.2): DEL: ${INDEX}(test): addr:aa:55:aa:55:00:0x
3233 config: 0
3234 state: LIVE
3235 speed: 0 Mbps now, 0 Mbps max"
3236 fi
3237
3238 # OFPT_FLOW_REMOVED, OFPRR_DELETE
3239 ovs-ofctl -O OpenFlow12 add-flow br0 send_flow_rem,actions=drop
3240 ovs-ofctl -O OpenFlow12 --strict del-flows br0 ''
3241 if test X"$1" = X"OFPRR_DELETE"; then shift;
3242 echo >>expout "OFPT_FLOW_REMOVED (OF1.2): reason=delete table_id=0"
3243 fi
3244 AT_FAIL_IF([test X"$1" != X])
3245
3246 OVS_WAIT_UNTIL([test `wc -l < "monitor.log"` -ge `wc -l < "expout"`])
3247
3248 AT_CHECK(
3249 [[sed '
3250 s/ (xid=0x[0-9a-fA-F]*)//
3251 s/ *duration.*//
3252 s/00:0.$/00:0x/' < monitor.log]],
3253 [0], [expout])
3254 }
3255
3256 # It's a service connection so initially there should be no async messages.
3257 check_async 1
3258
3259 # Set miss_send_len to 128, turning on packet-ins for our service connection.
3260 ovs-appctl -t ovs-ofctl ofctl/send 0309000c0123456700000080
3261 check_async 2 OFPR_ACTION OFPPR_ADD OFPPR_DELETE OFPRR_DELETE
3262
3263 # Set miss_send_len to 128 and enable invalid_ttl.
3264 ovs-appctl -t ovs-ofctl ofctl/send 0309000c0123456700040080
3265 check_async 3 OFPR_ACTION OFPR_INVALID_TTL OFPPR_ADD OFPPR_DELETE OFPRR_DELETE
3266
3267 # Become secondary (OF 1.2), which should disable everything except port status.
3268 ovs-appctl -t ovs-ofctl ofctl/send 031800180000000200000003000000000000000000000001
3269 check_async 4 OFPPR_ADD OFPPR_DELETE
3270
3271 # Use NXT_SET_ASYNC_CONFIG to enable a patchwork of asynchronous messages.
3272 ovs-appctl -t ovs-ofctl ofctl/send 03040028000000020000232000000013000000020000000500000005000000020000000200000005
3273 check_async 5 OFPR_INVALID_TTL OFPPR_DELETE OFPRR_DELETE
3274
3275 # Set controller ID 123.
3276 ovs-appctl -t ovs-ofctl ofctl/send 03040018000000030000232000000014000000000000007b
3277 check_async 6 OFPR_NO_MATCH OFPPR_DELETE OFPRR_DELETE
3278
3279 # Restore controller ID 0.
3280 ovs-appctl -t ovs-ofctl ofctl/send 030400180000000300002320000000140000000000000000
3281
3282 # Become primary (OF 1.2).
3283 ovs-appctl -t ovs-ofctl ofctl/send 031800180000000400000002000000000000000000000002
3284 check_async 7 OFPR_ACTION OFPPR_ADD
3285
3286 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
3287 OVS_VSWITCHD_STOP
3288 AT_CLEANUP
3289
3290 AT_SETUP([ofproto - asynchronous message control (OpenFlow 1.3)])
3291 OVS_VSWITCHD_START([dnl
3292 add-port br0 p1 -- set Interface p1 type=dummy ofport_request=10
3293 ])
3294 AT_CHECK([ovs-ofctl -O OpenFlow13 -P standard monitor br0 --detach --no-chdir --pidfile])
3295 check_async () {
3296 printf '\n\n--- check_async %d ---\n\n\n' $1
3297 INDEX=$1
3298 shift
3299
3300 ovs-appctl -t ovs-ofctl ofctl/barrier
3301 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
3302 : > expout
3303
3304 # OFPT_PACKET_IN, OFPR_ACTION (controller_id=0)
3305 # OFPR_ACTION_SET is treated as OFPR_ACTION in OpenFlow 1.3
3306 ovs-ofctl -O OpenFlow13 -v packet-out br0 none controller '0001020304050010203040501234'
3307 ovs-ofctl -O OpenFlow13 add-flow br0 'in_port=10 actions=write_actions(output(CONTROLLER))'
3308 ovs-appctl netdev-dummy/receive p1 'in_port(10),eth(src=00:10:20:30:40:50,dst=00:01:02:03:04:05),eth_type(0x1234)'
3309 if test X"$1" = X"OFPR_ACTION"; then shift;
3310 echo >>expout "OFPT_PACKET_IN (OF1.3): total_len=14 in_port=ANY (via action) data_len=14 (unbuffered)
3311 vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1234"
3312 echo >>expout "OFPT_PACKET_IN (OF1.3): cookie=0x0 total_len=14 in_port=10 (via action) data_len=14 (unbuffered)
3313 vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1234"
3314 fi
3315
3316 # OFPT_PACKET_IN, OFPR_NO_MATCH (controller_id=123)
3317 ovs-ofctl -O OpenFlow13 -v packet-out br0 none 'controller(reason=no_match,id=123)' '0001020304050010203040501234'
3318 if test X"$1" = X"OFPR_NO_MATCH"; then shift;
3319 echo >>expout "OFPT_PACKET_IN (OF1.3): total_len=14 in_port=ANY (via no_match) data_len=14 (unbuffered)
3320 vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1234"
3321 fi
3322
3323 # OFPT_PACKET_IN, OFPR_INVALID_TTL (controller_id=0)
3324 ovs-ofctl -O OpenFlow13 packet-out br0 none dec_ttl '002583dfb4000026b98cb0f908004500003eb7e200000011339bac11370dac100002d7730035002b8f6d86fb0100000100000000000006626c702d7873066e696369726103636f6d00000f00'
3325 if test X"$1" = X"OFPR_INVALID_TTL"; then shift;
3326 echo >>expout "OFPT_PACKET_IN (OF1.3): total_len=76 in_port=ANY (via invalid_ttl) data_len=76 (unbuffered)
3327 udp,vlan_tci=0x0000,dl_src=00:26:b9:8c:b0:f9,dl_dst=00:25:83:df:b4:00,nw_src=172.17.55.13,nw_dst=172.16.0.2,nw_tos=0,nw_ecn=0,nw_ttl=0,tp_src=55155,tp_dst=53 udp_csum:8f6d"
3328 fi
3329
3330 # OFPT_PORT_STATUS, OFPPR_ADD
3331 ovs-vsctl add-port br0 test -- set Interface test type=dummy
3332 if test X"$1" = X"OFPPR_ADD"; then shift;
3333 echo >>expout "OFPT_PORT_STATUS (OF1.3): ADD: ${INDEX}(test): addr:aa:55:aa:55:00:0x
3334 config: 0
3335 state: 0
3336 speed: 0 Mbps now, 0 Mbps max
3337 OFPT_PORT_STATUS (OF1.3): MOD: ${INDEX}(test): addr:aa:55:aa:55:00:0x
3338 config: 0
3339 state: LIVE
3340 speed: 0 Mbps now, 0 Mbps max"
3341 fi
3342
3343 # OFPT_PORT_STATUS, OFPPR_DELETE
3344 ovs-vsctl del-port br0 test
3345 if test X"$1" = X"OFPPR_DELETE"; then shift;
3346 echo >>expout "OFPT_PORT_STATUS (OF1.3): DEL: ${INDEX}(test): addr:aa:55:aa:55:00:0x
3347 config: 0
3348 state: LIVE
3349 speed: 0 Mbps now, 0 Mbps max"
3350 fi
3351
3352 # OFPT_FLOW_REMOVED, OFPRR_DELETE
3353 ovs-ofctl -O OpenFlow13 add-flow br0 send_flow_rem,actions=drop
3354 ovs-ofctl -O OpenFlow13 --strict del-flows br0 ''
3355 if test X"$1" = X"OFPRR_DELETE"; then shift;
3356 echo >>expout "OFPT_FLOW_REMOVED (OF1.3): reason=delete table_id=0"
3357 fi
3358
3359 # OFPT_FLOW_REMOVED, OFPRR_GROUP_DELETE
3360 ovs-ofctl -O OpenFlow13 add-group br0 group_id=1234,type=all,bucket=output:10
3361 ovs-ofctl -O OpenFlow13 add-flow br0 send_flow_rem,actions=group:1234
3362 ovs-ofctl -O OpenFlow13 --strict del-groups br0 group_id=1234
3363 if test X"$1" = X"OFPRR_GROUP_DELETE"; then shift;
3364 echo >>expout "OFPT_FLOW_REMOVED (OF1.3): reason=group_delete table_id=0"
3365 fi
3366
3367 AT_FAIL_IF([test X"$1" != X])
3368
3369 OVS_WAIT_UNTIL([test `wc -l < "monitor.log"` -ge `wc -l < "expout"`])
3370
3371 AT_CHECK(
3372 [[sed '
3373 s/ (xid=0x[0-9a-fA-F]*)//
3374 s/ *duration.*//
3375 s/00:0.$/00:0x/' < monitor.log]],
3376 [0], [expout])
3377 }
3378
3379 # It's a service connection so initially there should be no async messages.
3380 check_async 1
3381
3382 # Set miss_send_len to 128, turning on packet-ins for our service connection.
3383 ovs-appctl -t ovs-ofctl ofctl/send 0409000c0123456700000080
3384 check_async 2 OFPR_ACTION OFPPR_ADD OFPPR_DELETE OFPRR_DELETE OFPRR_GROUP_DELETE
3385
3386 # Become secondary (OF 1.3), which should disable everything except port status.
3387 ovs-appctl -t ovs-ofctl ofctl/send 041800180000000200000003000000000000000000000001
3388 check_async 3 OFPPR_ADD OFPPR_DELETE
3389
3390 # Use OF 1.3 OFPT_SET_ASYNC to enable a patchwork of asynchronous messages.
3391 ovs-appctl -t ovs-ofctl ofctl/send 041c00200000000200000002000000050000000500000002000000020000000d
3392 check_async 4 OFPR_INVALID_TTL OFPPR_DELETE OFPRR_DELETE OFPRR_GROUP_DELETE
3393
3394 # Set controller ID 123.
3395 ovs-appctl -t ovs-ofctl ofctl/send 04040018000000030000232000000014000000000000007b
3396 check_async 5 OFPR_NO_MATCH OFPPR_DELETE OFPRR_DELETE OFPRR_GROUP_DELETE
3397
3398 # Restore controller ID 0.
3399 ovs-appctl -t ovs-ofctl ofctl/send 040400180000000300002320000000140000000000000000
3400
3401 # Become primary (OF 1.3).
3402 ovs-appctl -t ovs-ofctl ofctl/send 041800180000000400000002000000000000000000000002
3403 check_async 6 OFPR_ACTION OFPPR_ADD
3404
3405 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
3406 OVS_VSWITCHD_STOP
3407 AT_CLEANUP
3408
3409 AT_SETUP([ofproto - asynchronous message control (OpenFlow 1.4)])
3410 OVS_VSWITCHD_START([dnl
3411 add-port br0 p1 -- set Interface p1 type=dummy ofport_request=10
3412 ])
3413 AT_CHECK([ovs-ofctl -O OpenFlow14 -P standard monitor br0 --detach --no-chdir --pidfile])
3414 ovs_appctl () {
3415 echo ovs-appctl "$@"
3416 AT_CHECK([ovs-appctl "$@"], [0], [ignore], [ignore])
3417 }
3418 ovs_ofctl () {
3419 echo ovs-ofctl --no-names "$@"
3420 AT_CHECK([ovs-ofctl --no-names "$@"])
3421 }
3422 ovs_vsctl () {
3423 echo ovs-vsctl "$@"
3424 AT_CHECK([ovs-vsctl "$@"])
3425 }
3426 check_async () {
3427 printf '\n\n--- check_async %d ---\n\n\n' $1
3428 INDEX=$1
3429 shift
3430
3431 ovs_appctl -t ovs-ofctl ofctl/barrier
3432 ovs_appctl -t ovs-ofctl ofctl/set-output-file monitor.log
3433 : > expout
3434
3435 # OFPT_PACKET_IN, OFPR_PACKET_OUT (controller_id=0)
3436 ovs_ofctl -O OpenFlow14 packet-out br0 none controller '0001020304050010203040501234'
3437 if test X"$1" = X"OFPR_PACKET_OUT"; then shift;
3438 echo >>expout "OFPT_PACKET_IN (OF1.4): total_len=14 in_port=ANY (via packet_out) data_len=14 (unbuffered)
3439 vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1234"
3440 fi
3441
3442 # OFPT_PACKET_IN, OFPR_ACTION_SET (controller_id=0)
3443 ovs_ofctl -O OpenFlow14 add-flow br0 'in_port=10 actions=write_actions(output(CONTROLLER))'
3444 ovs_appctl netdev-dummy/receive p1 'in_port(10),eth(src=00:10:20:30:40:50,dst=00:01:02:03:04:05),eth_type(0x1234)'
3445 if test X"$1" = X"OFPR_ACTION_SET"; then shift;
3446 echo >>expout "OFPT_PACKET_IN (OF1.4): cookie=0x0 total_len=14 in_port=10 (via action_set) data_len=14 (unbuffered)
3447 vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1234"
3448 fi
3449
3450 # OFPT_PACKET_IN, OFPR_NO_MATCH (controller_id=123)
3451 ovs_ofctl -O OpenFlow14 packet-out br0 none 'controller(reason=no_match,id=123)' '0001020304050010203040501234'
3452 if test X"$1" = X"OFPR_NO_MATCH"; then shift;
3453 echo >>expout "OFPT_PACKET_IN (OF1.4): total_len=14 in_port=ANY (via no_match) data_len=14 (unbuffered)
3454 vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1234"
3455 fi
3456
3457 # OFPT_PACKET_IN, OFPR_INVALID_TTL (controller_id=0)
3458 ovs_ofctl -O OpenFlow14 packet-out br0 none dec_ttl '002583dfb4000026b98cb0f908004500003eb7e200000011339bac11370dac100002d7730035002b8f6d86fb0100000100000000000006626c702d7873066e696369726103636f6d00000f00'
3459 if test X"$1" = X"OFPR_INVALID_TTL"; then shift;
3460 echo >>expout "OFPT_PACKET_IN (OF1.4): total_len=76 in_port=ANY (via invalid_ttl) data_len=76 (unbuffered)
3461 udp,vlan_tci=0x0000,dl_src=00:26:b9:8c:b0:f9,dl_dst=00:25:83:df:b4:00,nw_src=172.17.55.13,nw_dst=172.16.0.2,nw_tos=0,nw_ecn=0,nw_ttl=0,tp_src=55155,tp_dst=53 udp_csum:8f6d"
3462 fi
3463
3464 # OFPT_PORT_STATUS, OFPPR_ADD
3465 ovs_vsctl add-port br0 test -- set Interface test type=dummy
3466 if test X"$1" = X"OFPPR_ADD"; then shift;
3467 echo >>expout "OFPT_PORT_STATUS (OF1.4): ADD: ${INDEX}(test): addr:aa:55:aa:55:00:0x
3468 config: 0
3469 state: 0
3470 speed: 0 Mbps now, 0 Mbps max
3471 OFPT_PORT_STATUS (OF1.4): MOD: ${INDEX}(test): addr:aa:55:aa:55:00:0x
3472 config: 0
3473 state: LIVE
3474 speed: 0 Mbps now, 0 Mbps max"
3475 fi
3476
3477 # OFPT_PORT_STATUS, OFPPR_MODIFY
3478 ovs_ofctl -O OpenFlow14 -vwarn mod-port br0 test down
3479 if test X"$1" = X"OFPPR_MODIFY"; then shift;
3480 echo >>expout "OFPT_PORT_STATUS (OF1.4): MOD: ${INDEX}(test): addr:aa:55:aa:55:00:0x
3481 config: PORT_DOWN
3482 state: 0
3483 speed: 0 Mbps now, 0 Mbps max
3484 OFPT_PORT_STATUS (OF1.4): MOD: ${INDEX}(test): addr:aa:55:aa:55:00:0x
3485 config: PORT_DOWN
3486 state: LINK_DOWN
3487 speed: 0 Mbps now, 0 Mbps max"
3488 fi
3489
3490 # OFPT_PORT_STATUS, OFPPR_DELETE
3491 ovs_vsctl del-port br0 test
3492 if test X"$1" = X"OFPPR_DELETE"; then shift;
3493 echo >>expout "OFPT_PORT_STATUS (OF1.4): DEL: ${INDEX}(test): addr:aa:55:aa:55:00:0x
3494 config: PORT_DOWN
3495 state: LINK_DOWN
3496 speed: 0 Mbps now, 0 Mbps max"
3497 fi
3498
3499 # OFPT_FLOW_REMOVED, OFPRR_DELETE
3500 ovs_ofctl -O OpenFlow14 add-flow br0 send_flow_rem,actions=drop
3501 ovs-ofctl -O OpenFlow14 dump-flows br0
3502 ovs_ofctl -O OpenFlow14 --strict del-flows br0 ''
3503 ovs-ofctl -O OpenFlow14 dump-flows br0
3504 if test X"$1" = X"OFPRR_DELETE"; then shift;
3505 echo >>expout "OFPT_FLOW_REMOVED (OF1.4): reason=delete table_id=0"
3506 fi
3507
3508 # OFPT_FLOW_REMOVED, OFPRR_GROUP_DELETE
3509 ovs_ofctl -O OpenFlow14 add-group br0 group_id=1234,type=all,bucket=output:10
3510 ovs_ofctl -O OpenFlow14 add-flow br0 send_flow_rem,actions=group:1234
3511 ovs_ofctl -O OpenFlow14 --strict del-groups br0 group_id=1234
3512 if test X"$1" = X"OFPRR_GROUP_DELETE"; then shift;
3513 echo >>expout "OFPT_FLOW_REMOVED (OF1.4): reason=group_delete table_id=0"
3514 fi
3515
3516 # OFPT_TABLE_STATUS, OFPTR_VACANCY_UP
3517 if test X"$1" = X"OFPTR_VACANCY_UP"; then shift;
3518 AT_CHECK([ovs-vsctl -- --id=@t1 create Flow_Table flow-limit=10 -- set bridge br0 flow_tables:1=@t1], [0], [ignore], [])
3519
3520 # Turn on vacancy events, then add flows until we're full.
3521 # With initial vacancy of 100% and vacancy_up of 80%, so that
3522 # vacancy >= vacancy_up, this enables VACANY_DOWN events, so
3523 # we get a single such message when vacancy dips below 20%.
3524 ovs_ofctl -O OpenFlow14 mod-table br0 1 vacancy:20,80
3525 ovs_ofctl -O OpenFlow14 add-flow br0 table=1,in_port=1,actions=2
3526 ovs_ofctl -O OpenFlow14 add-flow br0 table=1,in_port=2,actions=2
3527 ovs_ofctl -O OpenFlow14 add-flow br0 table=1,in_port=3,actions=2
3528 ovs_ofctl -O OpenFlow14 add-flow br0 table=1,in_port=4,actions=2
3529 ovs_ofctl -O OpenFlow14 add-flow br0 table=1,in_port=5,actions=2
3530 ovs_ofctl -O OpenFlow14 add-flow br0 table=1,in_port=6,actions=2
3531 ovs_ofctl -O OpenFlow14 add-flow br0 table=1,in_port=7,actions=2
3532 ovs_ofctl -O OpenFlow14 add-flow br0 table=1,in_port=8,actions=2
3533 ovs_ofctl -O OpenFlow14 add-flow br0 table=1,in_port=9,actions=2
3534 ovs_ofctl -O OpenFlow14 add-flow br0 table=1,in_port=10,actions=2
3535 echo >>expout "OFPT_TABLE_STATUS (OF1.4): reason=VACANCY_DOWN
3536 table_desc:-
3537 table 1:
3538 eviction=off eviction_flags=OTHER|IMPORTANCE|LIFETIME
3539 vacancy=on vacancy_down=20% vacancy_up=80% vacancy=10%"
3540 # Then delete flows until we're empty. Sending the
3541 # VACANCY_DOWN message enabled VACANCY_UP events, so we get a
3542 # single such message when vacancy rises above 80%.
3543 ovs_ofctl -O OpenFlow14 del-flows br0 table=1,in_port=1
3544 ovs_ofctl -O OpenFlow14 del-flows br0 table=1,in_port=2
3545 ovs_ofctl -O OpenFlow14 del-flows br0 table=1,in_port=3
3546 ovs_ofctl -O OpenFlow14 del-flows br0 table=1,in_port=4
3547 ovs_ofctl -O OpenFlow14 del-flows br0 table=1,in_port=5
3548 ovs_ofctl -O OpenFlow14 del-flows br0 table=1,in_port=6
3549 ovs_ofctl -O OpenFlow14 del-flows br0 table=1,in_port=7
3550 ovs_ofctl -O OpenFlow14 del-flows br0 table=1,in_port=8
3551 ovs_ofctl -O OpenFlow14 del-flows br0 table=1,in_port=9
3552 ovs_ofctl -O OpenFlow14 del-flows br0 table=1,in_port=10
3553 echo >>expout "OFPT_TABLE_STATUS (OF1.4): reason=VACANCY_UP
3554 table_desc:-
3555 table 1:
3556 eviction=off eviction_flags=OTHER|IMPORTANCE|LIFETIME
3557 vacancy=on vacancy_down=20% vacancy_up=80% vacancy=90%"
3558
3559 # Now approach vacancy from the other direction. First
3560 # disable vacancy events. With initial vacancy of 70%, so
3561 # that vacancy < vacancy_up, this enables VACANCY_UP events.
3562 # That means that filling up the table generates no message,
3563 # but deleting all the flows generates VACANCY_UP at the point
3564 # vacancy rises above 80%.
3565 ovs_ofctl -O OpenFlow14 mod-table br0 1 novacancy
3566 ovs_ofctl -O OpenFlow14 add-flow br0 table=1,in_port=1,actions=2
3567 ovs_ofctl -O OpenFlow14 add-flow br0 table=1,in_port=2,actions=2
3568 ovs_ofctl -O OpenFlow14 add-flow br0 table=1,in_port=3,actions=2
3569 ovs_ofctl -O OpenFlow14 mod-table br0 1 vacancy:20,80
3570 ovs_ofctl -O OpenFlow14 add-flow br0 table=1,in_port=4,actions=2
3571 ovs_ofctl -O OpenFlow14 add-flow br0 table=1,in_port=5,actions=2
3572 ovs_ofctl -O OpenFlow14 add-flow br0 table=1,in_port=6,actions=2
3573 ovs_ofctl -O OpenFlow14 add-flow br0 table=1,in_port=7,actions=2
3574 ovs_ofctl -O OpenFlow14 add-flow br0 table=1,in_port=8,actions=2
3575 ovs_ofctl -O OpenFlow14 add-flow br0 table=1,in_port=9,actions=2
3576 ovs_ofctl -O OpenFlow14 add-flow br0 table=1,in_port=10,actions=2
3577 ovs_ofctl -O OpenFlow14 del-flows br0 table=1,in_port=1
3578 ovs_ofctl -O OpenFlow14 del-flows br0 table=1,in_port=2
3579 ovs_ofctl -O OpenFlow14 del-flows br0 table=1,in_port=3
3580 ovs_ofctl -O OpenFlow14 del-flows br0 table=1,in_port=4
3581 ovs_ofctl -O OpenFlow14 del-flows br0 table=1,in_port=5
3582 ovs_ofctl -O OpenFlow14 del-flows br0 table=1,in_port=6
3583 ovs_ofctl -O OpenFlow14 del-flows br0 table=1,in_port=7
3584 ovs_ofctl -O OpenFlow14 del-flows br0 table=1,in_port=8
3585 ovs_ofctl -O OpenFlow14 del-flows br0 table=1,in_port=9
3586 ovs_ofctl -O OpenFlow14 del-flows br0 table=1,in_port=10
3587 echo >>expout "OFPT_TABLE_STATUS (OF1.4): reason=VACANCY_UP
3588 table_desc:-
3589 table 1:
3590 eviction=off eviction_flags=OTHER|IMPORTANCE|LIFETIME
3591 vacancy=on vacancy_down=20% vacancy_up=80% vacancy=90%"
3592 fi
3593
3594 AT_FAIL_IF([test X"$1" != X])
3595
3596 normalize_log () {
3597 sed '
3598 s/ (xid=0x[[0-9a-fA-F]]*)//
3599 s/ *duration.*//
3600 s/00:0.$/00:0x/' < monitor.log
3601 }
3602
3603 OVS_WAIT_UNTIL([test `wc -l < "monitor.log"` -ge `wc -l < "expout"`],
3604 [normalize_log | diff -u - expout])
3605
3606 AT_CHECK(
3607 [normalize_log],
3608 [0], [expout])
3609 }
3610
3611 # It's a service connection so initially there should be no async messages.
3612 check_async 1
3613
3614 # Set miss_send_len to 128, turning on packet-ins for our service connection.
3615 ovs_appctl -t ovs-ofctl ofctl/send 0509000c0123456700000080
3616 check_async 2 OFPR_PACKET_OUT OFPR_ACTION_SET OFPPR_ADD OFPPR_MODIFY OFPPR_DELETE OFPRR_DELETE OFPRR_GROUP_DELETE
3617
3618 # Become secondary (OF 1.4), which should disable everything except port status.
3619 ovs_appctl -t ovs-ofctl ofctl/send 051800180000000200000003000000000000000000000001
3620 check_async 3 OFPPR_ADD OFPPR_MODIFY OFPPR_DELETE
3621
3622 # Use OF 1.4 OFPT_SET_ASYNC to enable a patchwork of asynchronous messages.
3623 ovs_appctl -t ovs-ofctl ofctl/send 051c0040000000020000000800000005000100080000002000020008000000020003000800000005000400080000001c00050008000000050008000800000018
3624 check_async 4 OFPR_INVALID_TTL OFPPR_DELETE OFPRR_DELETE OFPRR_GROUP_DELETE OFPTR_VACANCY_UP
3625
3626 # Set controller ID 123.
3627 ovs_appctl -t ovs-ofctl ofctl/send 05040018000000030000232000000014000000000000007b
3628 check_async 5 OFPR_NO_MATCH OFPPR_DELETE OFPRR_DELETE OFPRR_GROUP_DELETE
3629
3630 # Restore controller ID 0.
3631 ovs_appctl -t ovs-ofctl ofctl/send 050400180000000300002320000000140000000000000000
3632
3633 # Become primary (OF 1.4).
3634 ovs_appctl -t ovs-ofctl ofctl/send 051800180000000400000002000000000000000000000002
3635 check_async 6 OFPR_PACKET_OUT OFPPR_ADD OFPPR_MODIFY OFPRR_DELETE
3636
3637 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
3638 OVS_VSWITCHD_STOP
3639 AT_CLEANUP
3640
3641 AT_SETUP([ofproto - asynchronous message control (OpenFlow 1.5)])
3642 OVS_VSWITCHD_START
3643 AT_CHECK([ovs-ofctl -O OpenFlow15 -P standard monitor br0 --detach --no-chdir --pidfile])
3644 check_async () {
3645 printf '\n\n--- check_async %d ---\n\n\n' $1
3646 INDEX=$1
3647 shift
3648
3649 ovs-appctl -t ovs-ofctl ofctl/barrier
3650 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
3651 : > expout
3652
3653 # Other tests are not working with OF 1.5, and message
3654 # format may change, so leave them out.
3655
3656 # OFPT_PORT_STATUS, OFPPR_ADD
3657 ovs-vsctl add-port br0 test -- set Interface test type=dummy
3658 if test X"$1" = X"OFPPR_ADD"; then shift;
3659 echo >>expout "OFPT_PORT_STATUS (OF1.5): ADD: ${INDEX}(test): addr:aa:55:aa:55:00:0x
3660 config: 0
3661 state: 0
3662 speed: 0 Mbps now, 0 Mbps max
3663 OFPT_PORT_STATUS (OF1.5): MOD: ${INDEX}(test): addr:aa:55:aa:55:00:0x
3664 config: 0
3665 state: LIVE
3666 speed: 0 Mbps now, 0 Mbps max"
3667 fi
3668
3669 # OFPT_PORT_STATUS, OFPPR_MODIFY
3670 ovs-ofctl -O OpenFlow15 -vwarn mod-port br0 test down
3671 if test X"$1" = X"OFPPR_MODIFY"; then shift;
3672 echo >>expout "OFPT_PORT_STATUS (OF1.5): MOD: ${INDEX}(test): addr:aa:55:aa:55:00:0x
3673 config: PORT_DOWN
3674 state: 0
3675 speed: 0 Mbps now, 0 Mbps max
3676 OFPT_PORT_STATUS (OF1.5): MOD: ${INDEX}(test): addr:aa:55:aa:55:00:0x
3677 config: PORT_DOWN
3678 state: LINK_DOWN
3679 speed: 0 Mbps now, 0 Mbps max"
3680 fi
3681
3682 # OFPT_PORT_STATUS, OFPPR_DELETE
3683 ovs-vsctl del-port br0 test
3684 if test X"$1" = X"OFPPR_DELETE"; then shift;
3685 echo >>expout "OFPT_PORT_STATUS (OF1.5): DEL: ${INDEX}(test): addr:aa:55:aa:55:00:0x
3686 config: PORT_DOWN
3687 state: LINK_DOWN
3688 speed: 0 Mbps now, 0 Mbps max"
3689 fi
3690
3691 AT_FAIL_IF([test X"$1" != X])
3692
3693 OVS_WAIT_UNTIL([test `wc -l < "monitor.log"` -ge `wc -l < "expout"`])
3694
3695 AT_CHECK(
3696 [[sed '
3697 s/ (xid=0x[0-9a-fA-F]*)//
3698 s/ *duration.*//
3699 s/00:0.$/00:0x/' < monitor.log]],
3700 [0], [expout])
3701 }
3702
3703 # It's a service connection so initially there should be no async messages.
3704 check_async 1
3705
3706 # If we don't set this, async messages are not received.
3707 # Set miss_send_len to 128, turning on packet-ins for our service connection.
3708 ovs-appctl -t ovs-ofctl ofctl/send 0609000c0123456700000080
3709 check_async 2 OFPPR_ADD OFPPR_MODIFY OFPPR_DELETE
3710
3711 # Set-async has changed in OF 1.4 and is not yet implemented.
3712
3713 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
3714 OVS_VSWITCHD_STOP
3715 AT_CLEANUP
3716
3717 dnl This test checks that the role request/response messaging works
3718 dnl and that generation_id is handled properly.
3719 AT_SETUP([ofproto - controller role (OpenFlow 1.2)])
3720 OVS_VSWITCHD_START
3721 on_exit 'kill `cat c1.pid c2.pid`'
3722
3723 # Start two ovs-ofctl controller processes.
3724 AT_CAPTURE_FILE([monitor1.log])
3725 AT_CAPTURE_FILE([expout1])
3726 AT_CAPTURE_FILE([experr1])
3727 AT_CAPTURE_FILE([monitor2.log])
3728 AT_CAPTURE_FILE([expout2])
3729 AT_CAPTURE_FILE([experr2])
3730 for i in 1 2; do
3731 AT_CHECK([ovs-ofctl -O OpenFlow12 monitor br0 --detach --no-chdir --pidfile=c$i.pid --unixctl=c$i])
3732 ovs-appctl -t `pwd`/c$i ofctl/barrier
3733 ovs-appctl -t `pwd`/c$i ofctl/set-output-file monitor$i.log
3734 : > expout$i
3735 : > experr$i
3736
3737 # find out current role
3738 ovs-appctl -t `pwd`/c$i ofctl/send 031800180000000200000000000000000000000000000000
3739 echo >>experr$i "send: OFPT_ROLE_REQUEST (OF1.2): role=nochange"
3740 echo >>expout$i "OFPT_ROLE_REPLY (OF1.2): role=equal"
3741 done
3742
3743 # controller 1: Become secondary (generation_id is initially undefined, so
3744 # 2^63+2 should not be stale)
3745 ovs-appctl -t `pwd`/c1 ofctl/send 031800180000000300000003000000008000000000000002
3746 echo >>experr1 "send: OFPT_ROLE_REQUEST (OF1.2): role=secondary generation_id=9223372036854775810"
3747 echo >>expout1 "OFPT_ROLE_REPLY (OF1.2): role=secondary generation_id=9223372036854775810"
3748
3749 # controller 2: Become primary.
3750 ovs-appctl -t `pwd`/c2 ofctl/send 031800180000000300000002000000008000000000000003
3751 echo >>experr2 "send: OFPT_ROLE_REQUEST (OF1.2): role=primary generation_id=9223372036854775811"
3752 echo >>expout2 "OFPT_ROLE_REPLY (OF1.2): role=primary generation_id=9223372036854775811"
3753
3754 # controller 1: Try to become the primary using a stale generation ID
3755 ovs-appctl -t `pwd`/c1 ofctl/send 031800180000000400000002000000000000000000000003
3756 echo >>experr1 "send: OFPT_ROLE_REQUEST (OF1.2): role=primary generation_id=3"
3757 echo >>expout1 "OFPT_ERROR (OF1.2): OFPRRFC_STALE"
3758 echo >>expout1 "OFPT_ROLE_REQUEST (OF1.2): role=primary generation_id=3"
3759
3760 # controller 1: Become primary using a valid generation ID
3761 ovs-appctl -t `pwd`/c1 ofctl/send 031800180000000500000002000000000000000000000001
3762 echo >>experr1 "send: OFPT_ROLE_REQUEST (OF1.2): role=primary generation_id=1"
3763 echo >>expout1 "OFPT_ROLE_REPLY (OF1.2): role=primary generation_id=1"
3764
3765 for i in 1 2; do
3766 ovs-appctl -t `pwd`/c$i ofctl/barrier
3767 echo >>expout$i "OFPT_BARRIER_REPLY (OF1.2):"
3768 done
3769
3770 # Check output.
3771 for i in 1 2; do
3772 cp expout$i expout
3773 AT_CHECK([grep -v '^send:' monitor$i.log | strip_xids], [0], [expout])
3774 cp experr$i expout
3775 AT_CHECK([grep '^send:' monitor$i.log | strip_xids], [0], [expout])
3776 done
3777 OVS_VSWITCHD_STOP
3778 AT_CLEANUP
3779
3780 dnl This test checks that the role request/response messaging works,
3781 dnl that generation_id is handled properly, and that role status update
3782 dnl messages are sent when a controller's role gets changed from primary
3783 dnl to secondary.
3784 AT_SETUP([ofproto - controller role (OpenFlow 1.4)])
3785 OVS_VSWITCHD_START
3786 on_exit 'kill `cat c1.pid c2.pid`'
3787
3788 # Start two ovs-ofctl controller processes.
3789 AT_CAPTURE_FILE([monitor1.log])
3790 AT_CAPTURE_FILE([expout1])
3791 AT_CAPTURE_FILE([experr1])
3792 AT_CAPTURE_FILE([monitor2.log])
3793 AT_CAPTURE_FILE([expout2])
3794 AT_CAPTURE_FILE([experr2])
3795 for i in 1 2; do
3796 AT_CHECK([ovs-ofctl -O OpenFlow14 monitor br0 --detach --no-chdir --pidfile=c$i.pid --unixctl=c$i])
3797 ovs-appctl -t `pwd`/c$i ofctl/barrier
3798 ovs-appctl -t `pwd`/c$i ofctl/set-output-file monitor$i.log
3799 : > expout$i
3800 : > experr$i
3801
3802 # find out current role
3803 ovs-appctl -t `pwd`/c$i ofctl/send 051800180000000200000000000000000000000000000000
3804 echo >>experr$i "send: OFPT_ROLE_REQUEST (OF1.4): role=nochange"
3805 echo >>expout$i "OFPT_ROLE_REPLY (OF1.4): role=equal"
3806 done
3807
3808 # controller 1: Become secondary (generation_id is initially undefined, so
3809 # 2^63+2 should not be stale)
3810 ovs-appctl -t `pwd`/c1 ofctl/send 051800180000000300000003000000008000000000000002
3811 echo >>experr1 "send: OFPT_ROLE_REQUEST (OF1.4): role=secondary generation_id=9223372036854775810"
3812 echo >>expout1 "OFPT_ROLE_REPLY (OF1.4): role=secondary generation_id=9223372036854775810"
3813
3814 # controller 2: Become primary.
3815 ovs-appctl -t `pwd`/c2 ofctl/send 051800180000000300000002000000008000000000000003
3816 echo >>experr2 "send: OFPT_ROLE_REQUEST (OF1.4): role=primary generation_id=9223372036854775811"
3817 echo >>expout2 "OFPT_ROLE_REPLY (OF1.4): role=primary generation_id=9223372036854775811"
3818
3819 # controller 1: Try to become the primary using a stale generation ID
3820 ovs-appctl -t `pwd`/c1 ofctl/send 051800180000000400000002000000000000000000000003
3821 echo >>experr1 "send: OFPT_ROLE_REQUEST (OF1.4): role=primary generation_id=3"
3822 echo >>expout1 "OFPT_ERROR (OF1.4): OFPRRFC_STALE"
3823 echo >>expout1 "OFPT_ROLE_REQUEST (OF1.4): role=primary generation_id=3"
3824
3825 # controller 1: Become primary using a valid generation ID
3826 ovs-appctl -t `pwd`/c1 ofctl/send 051800180000000500000002000000000000000000000001
3827 echo >>experr1 "send: OFPT_ROLE_REQUEST (OF1.4): role=primary generation_id=1"
3828 echo >>expout1 "OFPT_ROLE_REPLY (OF1.4): role=primary generation_id=1"
3829 echo >>expout2 "OFPT_ROLE_STATUS (OF1.4): role=secondary generation_id=1 reason=primary_request"
3830
3831 for i in 1 2; do
3832 ovs-appctl -t `pwd`/c$i ofctl/barrier
3833 echo >>expout$i "OFPT_BARRIER_REPLY (OF1.4):"
3834 done
3835
3836 # Check output.
3837 for i in 1 2; do
3838 cp expout$i expout
3839 AT_CHECK([grep -v '^send:' monitor$i.log | strip_xids], [0], [expout])
3840 cp experr$i expout
3841 AT_CHECK([grep '^send:' monitor$i.log | strip_xids], [0], [expout])
3842 done
3843 OVS_VSWITCHD_STOP
3844 AT_CLEANUP
3845
3846 dnl This test checks that the role request/response messaging works,
3847 dnl that generation_id is handled properly, and that role status update
3848 dnl messages are sent when a controller's role gets changed from primary
3849 dnl to secondary.
3850 AT_SETUP([ofproto - controller role (OpenFlow 1.3)])
3851 OVS_VSWITCHD_START
3852 on_exit 'kill `cat c1.pid c2.pid`'
3853
3854 # Start two ovs-ofctl controller processes.
3855 AT_CAPTURE_FILE([monitor1.log])
3856 AT_CAPTURE_FILE([expout1])
3857 AT_CAPTURE_FILE([experr1])
3858 AT_CAPTURE_FILE([monitor2.log])
3859 AT_CAPTURE_FILE([expout2])
3860 AT_CAPTURE_FILE([experr2])
3861 for i in 1 2; do
3862 AT_CHECK([ovs-ofctl -O OpenFlow13 monitor br0 --detach --no-chdir --pidfile=c$i.pid --unixctl=c$i])
3863 ovs-appctl -t `pwd`/c$i ofctl/barrier
3864 ovs-appctl -t `pwd`/c$i ofctl/set-output-file monitor$i.log
3865 : > expout$i
3866 : > experr$i
3867
3868 # find out current role
3869 ovs-appctl -t `pwd`/c$i ofctl/send 041800180000000200000000000000000000000000000000
3870 echo >>experr$i "send: OFPT_ROLE_REQUEST (OF1.3): role=nochange"
3871 echo >>expout$i "OFPT_ROLE_REPLY (OF1.3): role=equal"
3872 done
3873
3874 # controller 1: Become secondary (generation_id is initially undefined, so
3875 # 2^63+2 should not be stale)
3876 ovs-appctl -t `pwd`/c1 ofctl/send 041800180000000300000003000000008000000000000002
3877 echo >>experr1 "send: OFPT_ROLE_REQUEST (OF1.3): role=secondary generation_id=9223372036854775810"
3878 echo >>expout1 "OFPT_ROLE_REPLY (OF1.3): role=secondary generation_id=9223372036854775810"
3879
3880 # controller 2: Become primary.
3881 ovs-appctl -t `pwd`/c2 ofctl/send 041800180000000300000002000000008000000000000003
3882 echo >>experr2 "send: OFPT_ROLE_REQUEST (OF1.3): role=primary generation_id=9223372036854775811"
3883 echo >>expout2 "OFPT_ROLE_REPLY (OF1.3): role=primary generation_id=9223372036854775811"
3884
3885 # controller 1: Try to become the primary using a stale generation ID
3886 ovs-appctl -t `pwd`/c1 ofctl/send 041800180000000400000002000000000000000000000003
3887 echo >>experr1 "send: OFPT_ROLE_REQUEST (OF1.3): role=primary generation_id=3"
3888 echo >>expout1 "OFPT_ERROR (OF1.3): OFPRRFC_STALE"
3889 echo >>expout1 "OFPT_ROLE_REQUEST (OF1.3): role=primary generation_id=3"
3890
3891 # controller 1: Become primary using a valid generation ID
3892 ovs-appctl -t `pwd`/c1 ofctl/send 041800180000000500000002000000000000000000000001
3893 echo >>experr1 "send: OFPT_ROLE_REQUEST (OF1.3): role=primary generation_id=1"
3894 echo >>expout1 "OFPT_ROLE_REPLY (OF1.3): role=primary generation_id=1"
3895 echo >>expout2 "ONFT_ROLE_STATUS (OF1.3): role=secondary generation_id=1 reason=primary_request"
3896
3897 for i in 1 2; do
3898 ovs-appctl -t `pwd`/c$i ofctl/barrier
3899 echo >>expout$i "OFPT_BARRIER_REPLY (OF1.3):"
3900 done
3901
3902 # Check output.
3903 for i in 1 2; do
3904 cp expout$i expout
3905 AT_CHECK([grep -v '^send:' monitor$i.log | strip_xids], [0], [expout])
3906 cp experr$i expout
3907 AT_CHECK([grep '^send:' monitor$i.log | strip_xids], [0], [expout])
3908 done
3909 OVS_VSWITCHD_STOP
3910 AT_CLEANUP
3911
3912 dnl This test checks the Group and meter notifications when a group mod
3913 dnl command is sent from one controller and the reply is received by
3914 dnl other controllers.
3915 AT_SETUP([ofproto - requestforward (OpenFlow 1.4)])
3916 OVS_VSWITCHD_START
3917 on_exit 'kill `cat c1.pid c2.pid c3.pid`'
3918
3919 # Start two ovs-ofctl controller processes.
3920 AT_CAPTURE_FILE([monitor1.log])
3921 AT_CAPTURE_FILE([expout1])
3922 AT_CAPTURE_FILE([monitor2.log])
3923 AT_CAPTURE_FILE([expout2])
3924 AT_CAPTURE_FILE([monitor3.log])
3925 AT_CAPTURE_FILE([expout3])
3926
3927 ovs-ofctl -O OpenFlow15 monitor br0 --detach --no-chdir --pidfile=c1.pid --unixctl=c1
3928 ovs-ofctl -O OpenFlow14 monitor br0 --detach --no-chdir --pidfile=c2.pid --unixctl=c2
3929 ovs-ofctl -O OpenFlow14 monitor br0 --detach --no-chdir --pidfile=c3.pid --unixctl=c3
3930
3931 check_async () {
3932 for i in 1 3; do
3933 ovs-appctl -t `pwd`/c$i ofctl/barrier
3934 ovs-appctl -t `pwd`/c$i ofctl/set-output-file monitor$i.log
3935 : > expout$i
3936 done
3937
3938 printf '\n\n--- check_async %d ---\n\n\n' $1
3939 INDEX=$1
3940 shift
3941
3942 # OFPGC_ADD
3943 ovs-appctl -t `pwd`/c2 ofctl/send "050f0020000000020000000000000001 00100000 ffffffffffffffff 00000000"
3944 if test X"$1" = X"OFPGC_ADD"; then shift;
3945 echo >>expout2 "send: OFPT_GROUP_MOD (OF1.4):
3946 ADD group_id=1,type=all,bucket=actions=drop"
3947 echo >>expout1 "OFPT_REQUESTFORWARD (OF1.5): reason=group_mod
3948 ADD group_id=1,type=all,bucket=bucket_id:0,actions=drop"
3949 echo >>expout3 "OFPT_REQUESTFORWARD (OF1.4): reason=group_mod
3950 ADD group_id=1,type=all,bucket=actions=drop"
3951 fi
3952
3953 # OFPGC_MODIFY
3954 ovs-appctl -t `pwd`/c2 ofctl/send "050f0020000000020001010000000001 00100000 ffffffffffffffff 00000000"
3955 if test X"$1" = X"OFPGC_MODIFY"; then shift;
3956 echo >>expout2 "send: OFPT_GROUP_MOD (OF1.4):
3957 MOD group_id=1,type=select,bucket=weight:0,actions=drop"
3958 echo >>expout1 "OFPT_REQUESTFORWARD (OF1.5): reason=group_mod
3959 MOD group_id=1,type=select,bucket=bucket_id:0,weight:0,actions=drop"
3960 echo >>expout3 "OFPT_REQUESTFORWARD (OF1.4): reason=group_mod
3961 MOD group_id=1,type=select,bucket=weight:0,actions=drop"
3962 fi
3963
3964 ovs-appctl -t `pwd`/c1 ofctl/barrier
3965 echo >>expout1 "OFPT_BARRIER_REPLY (OF1.5):"
3966 ovs-appctl -t `pwd`/c2 ofctl/barrier
3967 echo >>expout2 "OFPT_BARRIER_REPLY (OF1.4):"
3968 ovs-appctl -t `pwd`/c3 ofctl/barrier
3969 echo >>expout3 "OFPT_BARRIER_REPLY (OF1.4):"
3970
3971 # Check output.
3972 for i in 1 3; do
3973 cp expout$i expout
3974 AT_CHECK(
3975 [[sed '
3976 s/ (xid=0x[0-9a-fA-F]*)//'< monitor$i.log]],
3977 [0], [expout])
3978 done
3979 }
3980
3981 # controller 1: Become secondary
3982 ovs-appctl -t `pwd`/c1 ofctl/send 061800180000000300000003000000008000000000000002
3983
3984 # controller 2: Become primary
3985 ovs-appctl -t `pwd`/c2 ofctl/send 051800180000000300000002000000008000000000000003
3986
3987 # controller 1: Become secondary
3988 ovs-appctl -t `pwd`/c3 ofctl/send 051800180000000300000003000000008000000000000004
3989
3990 # controller 1: Enabled requestforward using set Asynchronous message
3991 ovs-appctl -t `pwd`/c1 ofctl/send 061c00280000000200000008000000050002000800000002000400080000001a000a000800000003
3992
3993 # controller 2: Enabled requestforward using set Asynchronous message
3994 ovs-appctl -t `pwd`/c2 ofctl/send 051c002800000002000100080000000200030008000000050005000800000005000b000800000003
3995
3996 # controller 1: Enabled requestforward using set Asynchronous message
3997 ovs-appctl -t `pwd`/c3 ofctl/send 051c00280000000200000008000000050002000800000002000400080000001a000a000800000003
3998 check_async 1 OFPGC_ADD OFPGC_MODIFY
3999
4000 OVS_VSWITCHD_STOP
4001 AT_CLEANUP
4002
4003 dnl This test checks the backwards compatibility of the NXT_REQUESTFORWARD
4004 dnl message type to OpenFlow 1.0, also relying on the Nicira Extensions:
4005 dnl NXT_GROUP_MOD, NXT_ROLE_REQUEST, and OFPRAW_NXT_SET_ASYNC_CONFIG2,
4006 dnl while also testing the functionality of the previous test.
4007 AT_SETUP([ofproto - NXT requestforward (OpenFlow 1.0)])
4008 OVS_VSWITCHD_START
4009 on_exit 'kill `cat c1.pid c2.pid c3.pid`'
4010
4011 # Start two ovs-ofctl controller processes.
4012 AT_CAPTURE_FILE([monitor1.log])
4013 AT_CAPTURE_FILE([expout1])
4014 AT_CAPTURE_FILE([monitor2.log])
4015 AT_CAPTURE_FILE([expout2])
4016 AT_CAPTURE_FILE([monitor3.log])
4017 AT_CAPTURE_FILE([expout3])
4018
4019 ovs-ofctl -O OpenFlow10 monitor br0 --detach --no-chdir --pidfile=c1.pid --unixctl=c1
4020 ovs-ofctl -O OpenFlow10 monitor br0 --detach --no-chdir --pidfile=c2.pid --unixctl=c2
4021 ovs-ofctl -O OpenFlow10 monitor br0 --detach --no-chdir --pidfile=c3.pid --unixctl=c3
4022
4023 check_async () {
4024 for i in 1 3; do
4025 ovs-appctl -t `pwd`/c$i ofctl/barrier
4026 ovs-appctl -t `pwd`/c$i ofctl/set-output-file monitor$i.log
4027 : > expout$i
4028 done
4029
4030 printf '\n\n--- check_async %d ---\n\n\n' $1
4031 INDEX=$1
4032 shift
4033
4034 # OFPGC_ADD
4035 # NXT_GROUP_MOD (xid=0x2):
4036 # ADD group_id=2271560481,type=select,selection_method=hash,selection_method_param=7,bucket=bucket_id:0,weight:100,watch_port:1,actions=output:1,bucket=bucket_id:1,weight:200,watch_port:2,actions=output:2,bucket=bucket_id:2,weight:200,watch_port:3,actions=output:3
4037 ovs-appctl -t `pwd`/c2 ofctl/send "01 04 00 a8 00 00 00 02 00 00 23 20 00 00 00 1f 00 00 01 00 87 65 43 21 00 60 00 00 ff ff ff ff 00 20 00 08 00 00 00 00 00 00 00 08 00 01 00 00 00 00 00 08 00 64 00 00 00 01 00 08 00 00 00 01 00 20 00 08 00 00 00 01 00 00 00 08 00 02 00 00 00 00 00 08 00 c8 00 00 00 01 00 08 00 00 00 02 00 20 00 08 00 00 00 02 00 00 00 08 00 03 00 00 00 00 00 08 00 c8 00 00 00 01 00 08 00 00 00 03 ff ff 00 28 00 00 15 40 00 00 00 01 00 00 00 00 68 61 73 68 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 07"
4038 if test X"$1" = X"OFPGC_ADD"; then shift;
4039 echo >>expout2 "send: NXT_GROUP_MOD:
4040 ADD group_id=2271560481,type=select,selection_method=hash,selection_method_param=7,bucket=bucket_id:0,weight:100,watch_port:1,actions=output:1,bucket=bucket_id:1,weight:200,watch_port:2,actions=output:2,bucket=bucket_id:2,weight:200,watch_port:3,actions=output:3"
4041 echo >>expout1 "NXT_REQUESTFORWARD: reason=group_mod
4042 ADD group_id=2271560481,type=select,selection_method=hash,selection_method_param=7,bucket=bucket_id:0,weight:100,watch_port:1,actions=output:1,bucket=bucket_id:1,weight:200,watch_port:2,actions=output:2,bucket=bucket_id:2,weight:200,watch_port:3,actions=output:3"
4043 echo >>expout3 "NXT_REQUESTFORWARD: reason=group_mod
4044 ADD group_id=2271560481,type=select,selection_method=hash,selection_method_param=7,bucket=bucket_id:0,weight:100,watch_port:1,actions=output:1,bucket=bucket_id:1,weight:200,watch_port:2,actions=output:2,bucket=bucket_id:2,weight:200,watch_port:3,actions=output:3"
4045 fi
4046
4047 # OFPGC_MODIFY
4048 # NXT_GROUP_MOD (xid=0x2):
4049 # MOD group_id=2271560481,type=select,selection_method=hash,selection_method_param=7,bucket=bucket_id:0,weight:150,watch_port:1,actions=output:1,bucket=bucket_id:1,weight:150,watch_port:2,actions=output:2,bucket=bucket_id:2,weight:150,watch_port:3,actions=output:3
4050 ovs-appctl -t `pwd`/c2 ofctl/send "01 04 00 a8 00 00 00 02 00 00 23 20 00 00 00 1f 00 01 01 00 87 65 43 21 00 60 00 00 ff ff ff ff 00 20 00 08 00 00 00 00 00 00 00 08 00 01 00 00 00 00 00 08 00 96 00 00 00 01 00 08 00 00 00 01 00 20 00 08 00 00 00 01 00 00 00 08 00 02 00 00 00 00 00 08 00 96 00 00 00 01 00 08 00 00 00 02 00 20 00 08 00 00 00 02 00 00 00 08 00 03 00 00 00 00 00 08 00 96 00 00 00 01 00 08 00 00 00 03 ff ff 00 28 00 00 15 40 00 00 00 01 00 00 00 00 68 61 73 68 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 07"
4051 if test X"$1" = X"OFPGC_MODIFY"; then shift;
4052 echo >>expout2 "send: NXT_GROUP_MOD:
4053 MOD group_id=2271560481,type=select,selection_method=hash,selection_method_param=7,bucket=bucket_id:0,weight:150,watch_port:1,actions=output:1,bucket=bucket_id:1,weight:150,watch_port:2,actions=output:2,bucket=bucket_id:2,weight:150,watch_port:3,actions=output:3"
4054 echo >>expout1 "NXT_REQUESTFORWARD: reason=group_mod
4055 MOD group_id=2271560481,type=select,selection_method=hash,selection_method_param=7,bucket=bucket_id:0,weight:150,watch_port:1,actions=output:1,bucket=bucket_id:1,weight:150,watch_port:2,actions=output:2,bucket=bucket_id:2,weight:150,watch_port:3,actions=output:3"
4056 echo >>expout3 "NXT_REQUESTFORWARD: reason=group_mod
4057 MOD group_id=2271560481,type=select,selection_method=hash,selection_method_param=7,bucket=bucket_id:0,weight:150,watch_port:1,actions=output:1,bucket=bucket_id:1,weight:150,watch_port:2,actions=output:2,bucket=bucket_id:2,weight:150,watch_port:3,actions=output:3"
4058 fi
4059
4060 ovs-appctl -t `pwd`/c1 ofctl/barrier
4061 echo >>expout1 "OFPT_BARRIER_REPLY:"
4062 ovs-appctl -t `pwd`/c2 ofctl/barrier
4063 echo >>expout2 "OFPT_BARRIER_REPLY:"
4064 ovs-appctl -t `pwd`/c3 ofctl/barrier
4065 echo >>expout3 "OFPT_BARRIER_REPLY:"
4066
4067 # Check output.
4068 for i in 1 3; do
4069 cp expout$i expout
4070 AT_CHECK(
4071 [[sed '
4072 s/ (xid=0x[0-9a-fA-F]*)//'< monitor$i.log]],
4073 [0], [expout])
4074 done
4075 }
4076
4077 # controller 1: Become secondary
4078 # NXT_ROLE_REQUEST (xid=0x3): role=secondary
4079 ovs-appctl -t `pwd`/c1 ofctl/send 0104001400000003000023200000000a00000002
4080
4081 # controller 2: Become primary
4082 # NXT_ROLE_REQUEST (xid=0x3): role=primary
4083 ovs-appctl -t `pwd`/c2 ofctl/send 0104001400000003000023200000000a00000001
4084
4085 # controller 1: Become secondary
4086 # NXT_ROLE_REQUEST (xid=0x3): role=secondary
4087 ovs-appctl -t `pwd`/c3 ofctl/send 0104001400000003000023200000000a00000002
4088
4089 # controller 1: Enabled requestforward using OFPRAW_NXT_SET_ASYNC_CONFIG2
4090 ovs-appctl -t `pwd`/c1 ofctl/send 0104003000000002000023200000001b00000008000000050002000800000002000400080000001a000a000800000003
4091
4092 # controller 2: Enabled requestforward using OFPRAW_NXT_SET_ASYNC_CONFIG2
4093 ovs-appctl -t `pwd`/c2 ofctl/send 0104003000000002000023200000001b000100080000000200030008000000050005000800000005000b000800000003
4094
4095 # controller 1: Enabled requestforward using OFPRAW_NXT_SET_ASYNC_CONFIG2
4096 ovs-appctl -t `pwd`/c3 ofctl/send 0104003000000002000023200000001b00000008000000050002000800000002000400080000001a000a000800000003
4097 check_async 1 OFPGC_ADD OFPGC_MODIFY
4098
4099 OVS_VSWITCHD_STOP
4100 AT_CLEANUP
4101
4102 dnl This test checks the Group and meter notifications when a group mod
4103 dnl command is sent from one controller and the reply is received by
4104 dnl other controllers, using the ONF Extension for OF 1.3.
4105 AT_SETUP([ofproto - ONF requestforward (OpenFlow 1.3)])
4106 OVS_VSWITCHD_START
4107 on_exit 'kill `cat c1.pid c2.pid c3.pid`'
4108
4109 # Start two ovs-ofctl controller processes.
4110 AT_CAPTURE_FILE([monitor1.log])
4111 AT_CAPTURE_FILE([expout1])
4112 AT_CAPTURE_FILE([monitor2.log])
4113 AT_CAPTURE_FILE([expout2])
4114 AT_CAPTURE_FILE([monitor3.log])
4115 AT_CAPTURE_FILE([expout3])
4116
4117 ovs-ofctl -O OpenFlow13 monitor br0 --detach --no-chdir --pidfile=c1.pid --unixctl=c1
4118 ovs-ofctl -O OpenFlow13 monitor br0 --detach --no-chdir --pidfile=c2.pid --unixctl=c2
4119 ovs-ofctl -O OpenFlow13 monitor br0 --detach --no-chdir --pidfile=c3.pid --unixctl=c3
4120
4121 check_async () {
4122 for i in 1 3; do
4123 ovs-appctl -t `pwd`/c$i ofctl/barrier
4124 ovs-appctl -t `pwd`/c$i ofctl/set-output-file monitor$i.log
4125 : > expout$i
4126 done
4127
4128 printf '\n\n--- check_async %d ---\n\n\n' $1
4129 INDEX=$1
4130 shift
4131
4132 # OFPGC_ADD
4133 # OFPT_GROUP_MOD (OF1.3) (xid=0x2):
4134 # ADD group_id=1,type=all,bucket=actions=drop
4135 ovs-appctl -t `pwd`/c2 ofctl/send "040f0020000000020000000000000001 00100000 ffffffffffffffff 00000000"
4136 if test X"$1" = X"OFPGC_ADD"; then shift;
4137 echo >>expout2 "send: OFPT_GROUP_MOD (OF1.3):
4138 ADD group_id=1,type=all,bucket=actions=drop"
4139 echo >>expout1 "ONFT_REQUESTFORWARD (OF1.3): reason=group_mod
4140 ADD group_id=1,type=all,bucket=actions=drop"
4141 echo >>expout3 "ONFT_REQUESTFORWARD (OF1.3): reason=group_mod
4142 ADD group_id=1,type=all,bucket=actions=drop"
4143 fi
4144
4145 # OFPGC_MODIFY
4146 # OFPT_GROUP_MOD (OF1.3) (xid=0x2):
4147 # MOD group_id=1,type=select,bucket=weight:0,actions=drop
4148 ovs-appctl -t `pwd`/c2 ofctl/send "040f0020000000020001010000000001 00100000 ffffffffffffffff 00000000"
4149 if test X"$1" = X"OFPGC_MODIFY"; then shift;
4150 echo >>expout2 "send: OFPT_GROUP_MOD (OF1.3):
4151 MOD group_id=1,type=select,bucket=weight:0,actions=drop"
4152 echo >>expout1 "ONFT_REQUESTFORWARD (OF1.3): reason=group_mod
4153 MOD group_id=1,type=select,bucket=weight:0,actions=drop"
4154 echo >>expout3 "ONFT_REQUESTFORWARD (OF1.3): reason=group_mod
4155 MOD group_id=1,type=select,bucket=weight:0,actions=drop"
4156 fi
4157
4158 ovs-appctl -t `pwd`/c1 ofctl/barrier
4159 echo >>expout1 "OFPT_BARRIER_REPLY (OF1.3):"
4160 ovs-appctl -t `pwd`/c2 ofctl/barrier
4161 echo >>expout2 "OFPT_BARRIER_REPLY (OF1.3):"
4162 ovs-appctl -t `pwd`/c3 ofctl/barrier
4163 echo >>expout3 "OFPT_BARRIER_REPLY (OF1.3):"
4164
4165 # Check output.
4166 for i in 1 3; do
4167 cp expout$i expout
4168 AT_CHECK(
4169 [[sed '
4170 s/ (xid=0x[0-9a-fA-F]*)//'< monitor$i.log]],
4171 [0], [expout])
4172 done
4173 }
4174
4175 # controller 1: Become secondary
4176 # OFPT_ROLE_REQUEST (OF1.3) (xid=0x3): role=secondary
4177 ovs-appctl -t `pwd`/c1 ofctl/send 041800180000000300000003000000008000000000000002
4178
4179 # controller 2: Become primary
4180 # OFPT_ROLE_REQUEST (OF1.3) (xid=0x3): role=primary
4181 ovs-appctl -t `pwd`/c2 ofctl/send 041800180000000300000002000000008000000000000003
4182
4183 # controller 1: Become secondary
4184 # OFPT_ROLE_REQUEST (OF1.3) (xid=0x3): role=secondary
4185 ovs-appctl -t `pwd`/c3 ofctl/send 041800180000000300000003000000008000000000000004
4186
4187 # controller 1: Enabled requestforward using OFPRAW_NXT_SET_ASYNC_CONFIG2 (necessary for OF1.3)
4188 ovs-appctl -t `pwd`/c1 ofctl/send 0404003000000002000023200000001b00000008000000050002000800000002000400080000001a000a000800000003
4189
4190 # controller 2: Enabled requestforward using OFPRAW_NXT_SET_ASYNC_CONFIG2 (necessary for OF1.3)
4191 ovs-appctl -t `pwd`/c2 ofctl/send 0404003000000002000023200000001b000100080000000200030008000000050005000800000005000b000800000003
4192
4193 # controller 1: Enabled requestforward using OFPRAW_NXT_SET_ASYNC_CONFIG2 (necessary for OF1.3)
4194 ovs-appctl -t `pwd`/c3 ofctl/send 0404003000000002000023200000001b00000008000000050002000800000002000400080000001a000a000800000003
4195 check_async 1 OFPGC_ADD OFPGC_MODIFY
4196
4197 OVS_VSWITCHD_STOP
4198 AT_CLEANUP
4199
4200
4201
4202 dnl This test checks that OFPT_PACKET_OUT accepts both OFPP_NONE (as
4203 dnl specified by OpenFlow 1.0) and OFPP_CONTROLLER (used by some
4204 dnl controllers despite the spec) as meaning a packet that was generated
4205 dnl by the controller.
4206 AT_SETUP([ofproto - packet-out from controller (OpenFlow 1.0)])
4207 OVS_VSWITCHD_START
4208 add_of_ports br0 1
4209
4210 # Start a monitor listening for packet-ins.
4211 AT_CHECK([ovs-ofctl -P standard monitor br0 --detach --no-chdir --pidfile])
4212 ovs-appctl -t ovs-ofctl ofctl/send 0109000c0123456700000080
4213 ovs-appctl -t ovs-ofctl ofctl/barrier
4214 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
4215 AT_CAPTURE_FILE([monitor.log])
4216
4217 # Send some packet-outs with OFPP_NONE and OFPP_CONTROLLER (65533) as in_port.
4218 AT_CHECK([ovs-ofctl packet-out br0 "in_port=none packet=0001020304050010203040501234 actions=controller,1"])
4219 AT_CHECK([ovs-ofctl packet-out br0 "in_port=controller packet=0001020304050010203040505678 actions=controller,1"])
4220
4221 # Stop the monitor and check its output.
4222 ovs-appctl -t ovs-ofctl ofctl/barrier
4223 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
4224
4225 ovs-ofctl dump-ports br0
4226
4227 AT_CHECK([sed 's/ (xid=0x[[0-9a-fA-F]]*)//' monitor.log], [0], [dnl
4228 OFPT_PACKET_IN: total_len=14 in_port=ANY (via action) data_len=14 (unbuffered)
4229 vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1234
4230 OFPT_PACKET_IN: total_len=14 in_port=CONTROLLER (via action) data_len=14 (unbuffered)
4231 vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x5678
4232 OFPT_BARRIER_REPLY:
4233 ])
4234
4235 OVS_VSWITCHD_STOP
4236 AT_CLEANUP
4237
4238 dnl This test checks that OFPT_PACKET_OUT accepts both OFPP_NONE (as
4239 dnl specified by OpenFlow 1.2) and OFPP_CONTROLLER (used by some
4240 dnl controllers despite the spec) as meaning a packet that was generated
4241 dnl by the controller.
4242 AT_SETUP([ofproto - packet-out from controller (OpenFlow 1.2)])
4243 OVS_VSWITCHD_START
4244
4245 # Start a monitor listening for packet-ins.
4246 AT_CHECK([ovs-ofctl -O OpenFlow12 -P standard monitor br0 --detach --no-chdir --pidfile])
4247 ovs-appctl -t ovs-ofctl ofctl/send 0309000c0123456700000080
4248 ovs-appctl -t ovs-ofctl ofctl/barrier
4249 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
4250 AT_CAPTURE_FILE([monitor.log])
4251
4252 # Send some packet-outs with OFPP_NONE and OFPP_CONTROLLER (65533) as in_port.
4253 AT_CHECK([ovs-ofctl -O OpenFlow12 packet-out br0 none controller '0001020304050010203040501234'])
4254 AT_CHECK([ovs-ofctl -O OpenFlow12 packet-out br0 4294967293 controller '0001020304050010203040505678'])
4255
4256 # Stop the monitor and check its output.
4257 ovs-appctl -t ovs-ofctl ofctl/barrier
4258 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
4259
4260 AT_CHECK([sed 's/ (xid=0x[[0-9a-fA-F]]*)//' monitor.log], [0], [dnl
4261 OFPT_PACKET_IN (OF1.2): total_len=14 in_port=ANY (via action) data_len=14 (unbuffered)
4262 vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1234
4263 OFPT_PACKET_IN (OF1.2): total_len=14 in_port=CONTROLLER (via action) data_len=14 (unbuffered)
4264 vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x5678
4265 OFPT_BARRIER_REPLY (OF1.2):
4266 ])
4267
4268 OVS_VSWITCHD_STOP
4269 AT_CLEANUP
4270
4271 dnl This test checks that OFPT_PACKET_OUT accepts both OFPP_NONE (as
4272 dnl specified by OpenFlow 1.1) and OFPP_CONTROLLER (used by some
4273 dnl controllers despite the spec) as meaning a packet that was generated
4274 dnl by the controller.
4275 AT_SETUP([ofproto - packet-out from controller (OpenFlow 1.1)])
4276 OVS_VSWITCHD_START
4277
4278 # Start a monitor listening for packet-ins.
4279 AT_CHECK([ovs-ofctl -O OpenFlow11 -P standard monitor br0 --detach --no-chdir --pidfile])
4280 ovs-appctl -t ovs-ofctl ofctl/send 0209000c0123456700000080
4281 ovs-appctl -t ovs-ofctl ofctl/barrier
4282 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
4283 AT_CAPTURE_FILE([monitor.log])
4284
4285 # Send some packet-outs with OFPP_NONE and OFPP_CONTROLLER as in_port.
4286 AT_CHECK([ovs-appctl -t ovs-ofctl ofctl/packet-out "in_port=none, packet=0001020304050010203040501234 actions=controller"])
4287 AT_CHECK([ovs-appctl -t ovs-ofctl ofctl/packet-out "in_port=controller packet=0001020304050010203040505678 actions=controller"])
4288
4289 # Stop the monitor and check its output.
4290 ovs-appctl -t ovs-ofctl ofctl/barrier
4291 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
4292
4293 AT_CHECK([sed 's/ (xid=0x[[0-9a-fA-F]]*)//
4294 /PACKET_OUT/d' monitor.log], [0], [dnl
4295 OFPT_PACKET_IN (OF1.1): total_len=14 in_port=ANY (via action) data_len=14 (unbuffered)
4296 vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1234
4297 OFPT_PACKET_IN (OF1.1): total_len=14 in_port=CONTROLLER (via action) data_len=14 (unbuffered)
4298 vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x5678
4299 OFPT_BARRIER_REPLY (OF1.1):
4300 ])
4301
4302 OVS_VSWITCHD_STOP
4303 AT_CLEANUP
4304
4305 AT_SETUP([ofproto - packet-out from controller (OpenFlow 1.5)])
4306 OVS_VSWITCHD_START
4307
4308 # Start a monitor listening for packet-ins.
4309 AT_CHECK([ovs-ofctl -O OpenFlow15 -P standard monitor br0 --detach --no-chdir --pidfile])
4310 ovs-appctl -t ovs-ofctl ofctl/send 0609000c0123456700000080
4311 ovs-appctl -t ovs-ofctl ofctl/barrier
4312 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
4313 AT_CAPTURE_FILE([monitor.log])
4314
4315 # Send some packet-outs with OFPP_NONE and OFPP_CONTROLLER (65533) as in_port.
4316 AT_CHECK([ovs-ofctl -O OpenFlow15 packet-out br0 "in_port=none tun_id=0x11 metadata=0x22 packet=0001020304050010203040501234 actions=controller"])
4317 AT_CHECK([ovs-ofctl -O OpenFlow15 packet-out br0 "in_port=controller tun_id=0x11 metadata=0x33 packet=0001020304050010203040505678 actions=controller"])
4318
4319 # Stop the monitor and check its output.
4320 ovs-appctl -t ovs-ofctl ofctl/barrier
4321 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
4322
4323 AT_CHECK([sed 's/ (xid=0x[[0-9a-fA-F]]*)//' monitor.log], [0], [dnl
4324 OFPT_PACKET_IN (OF1.5): total_len=14 tun_id=0x11,metadata=0x22,in_port=ANY (via packet_out) data_len=14 (unbuffered)
4325 vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1234
4326 OFPT_PACKET_IN (OF1.5): total_len=14 tun_id=0x11,metadata=0x33,in_port=CONTROLLER (via packet_out) data_len=14 (unbuffered)
4327 vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x5678
4328 OFPT_BARRIER_REPLY (OF1.5):
4329 ])
4330
4331 OVS_VSWITCHD_STOP
4332 AT_CLEANUP
4333
4334 dnl This test checks that metadata and userdata are encoded in NXT_PACKET_IN2.
4335 AT_SETUP([ofproto - packet-out with metadata and userdata (NXT_PACKET_IN2)])
4336 OVS_VSWITCHD_START
4337
4338 # Start a monitor listening for packet-ins.
4339 AT_CHECK([ovs-ofctl -P nxt_packet_in2 monitor br0 --detach --no-chdir --pidfile])
4340 ovs-appctl -t ovs-ofctl ofctl/send 0109000c0123456700000080
4341 ovs-appctl -t ovs-ofctl ofctl/barrier
4342 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
4343 AT_CAPTURE_FILE([monitor.log])
4344
4345 # Send a packet-out with a load action to set some metadata, and forward to controller
4346 AT_CHECK([ovs-ofctl packet-out br0 "in_port=controller packet=0001020304050010203040501234 actions=load(0xfafafafa5a5a5a5a->OXM_OF_METADATA[[0..63]]),load(0xaa->NXM_NX_PKT_MARK[[]]),controller(userdata=01.02.03.04.05)"])
4347
4348 # Stop the monitor and check its output.
4349 ovs-appctl -t ovs-ofctl ofctl/barrier
4350 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
4351
4352 AT_CHECK([sed 's/ (xid=0x[[0-9a-fA-F]]*)//' monitor.log], [0], [dnl
4353 NXT_PACKET_IN2: total_len=14 pkt_mark=0xaa,metadata=0xfafafafa5a5a5a5a,in_port=CONTROLLER (via action) data_len=14 (unbuffered)
4354 userdata=01.02.03.04.05
4355 vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1234
4356 OFPT_BARRIER_REPLY:
4357 ])
4358
4359 OVS_VSWITCHD_STOP
4360 AT_CLEANUP
4361
4362 dnl This test checks that 1.5 packet_out is properly encoded/decoded.
4363 AT_SETUP([ofproto - packet-out with set_field metadata (OpenFlow 1.5)])
4364 OVS_VSWITCHD_START
4365
4366 # Start a monitor listening for packet-ins.
4367 AT_CHECK([ovs-ofctl -P standard -O OpenFlow13 monitor br0 --detach --no-chdir --pidfile])
4368 ovs-appctl -t ovs-ofctl ofctl/send 0409000c0123456700000080
4369 ovs-appctl -t ovs-ofctl ofctl/barrier
4370 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
4371 AT_CAPTURE_FILE([monitor.log])
4372
4373 # Send a packet-out with a couple of set-field action to set some metadata, and forward to controller
4374 AT_CHECK([ovs-ofctl -O OpenFlow15 packet-out br0 CONTROLLER 'set_field:0xfafafafa5a5a5a5a->metadata, controller' '0001020304050010203040501234'])
4375
4376 # Stop the monitor and check its output.
4377 ovs-appctl -t ovs-ofctl ofctl/barrier
4378 ovs-appctl -t ovs-ofctl exit
4379
4380 AT_CHECK([sed 's/ (xid=0x[[0-9a-fA-F]]*)//' monitor.log], [0], [dnl
4381 OFPT_PACKET_IN (OF1.3): total_len=14 metadata=0xfafafafa5a5a5a5a,in_port=CONTROLLER (via action) data_len=14 (unbuffered)
4382 vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1234
4383 OFPT_BARRIER_REPLY (OF1.3):
4384 ])
4385
4386 OVS_VSWITCHD_STOP
4387 AT_CLEANUP
4388
4389 dnl This test checks that packet_type PT_ETH is properly encoded/decoded in 1.5 packet_out.
4390 AT_SETUP([ofproto - packet-out with set_field metadata with packet_type PT_ETH (OpenFlow 1.5)])
4391 OVS_VSWITCHD_START
4392
4393 # Start a monitor listening for packet-ins.
4394 AT_CHECK([ovs-ofctl -P standard -O OpenFlow13 monitor br0 --detach --no-chdir --pidfile])
4395 ovs-appctl -t ovs-ofctl ofctl/send 0409000c0123456700000080
4396 ovs-appctl -t ovs-ofctl ofctl/barrier
4397 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
4398 AT_CAPTURE_FILE([monitor.log])
4399
4400 # Send a packet-out with a couple of set-field action to set some metadata, and forward to controller
4401 AT_CHECK([ovs-ofctl -O OpenFlow15 packet-out br0 "in_port=controller packet=0001020304050010203040501234 packet_type(0,0x0) actions=set_field:0xfafafafa5a5a5a5a->metadata,controller"])
4402
4403 # Stop the monitor and check its output.
4404 ovs-appctl -t ovs-ofctl ofctl/barrier
4405 ovs-appctl -t ovs-ofctl exit
4406
4407 AT_CHECK([sed 's/ (xid=0x[[0-9a-fA-F]]*)//' monitor.log], [0], [dnl
4408 OFPT_PACKET_IN (OF1.3): total_len=14 metadata=0xfafafafa5a5a5a5a,in_port=CONTROLLER (via action) data_len=14 (unbuffered)
4409 vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1234
4410 OFPT_BARRIER_REPLY (OF1.3):
4411 ])
4412
4413 OVS_VSWITCHD_STOP
4414 AT_CLEANUP
4415
4416 dnl This test checks that packet_type PT_IPV4 is properly encoded/decoded in 1.5 packet_out.
4417 AT_SETUP([ofproto - packet-out with set_field metadata with packet_type PT_IPV4 on PTAP bridge (OpenFlow 1.5)])
4418 OVS_VSWITCHD_START
4419
4420 # Start a monitor listening for packet-ins.
4421 AT_CHECK([ovs-ofctl -P standard -O OpenFlow13 monitor br0 --detach --no-chdir --pidfile])
4422 ovs-appctl -t ovs-ofctl ofctl/send 0409000c0123456700000080
4423 ovs-appctl -t ovs-ofctl ofctl/barrier
4424 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
4425 AT_CAPTURE_FILE([monitor.log])
4426
4427 # Send a packet-out with a couple of set-field action to set some metadata, and forward to controller
4428 AT_CHECK([ovs-ofctl -O OpenFlow15 packet-out br0 "in_port=controller packet=4500002012344000ff1155670a0000140a00001e006400c8000cea78ffffffff packet_type(1,0x800) actions=set_field:0xfafafafa5a5a5a5a->metadata,controller"])
4429
4430 # Stop the monitor and check its output.
4431 ovs-appctl -t ovs-ofctl ofctl/barrier
4432 ovs-appctl -t ovs-ofctl exit
4433
4434 AT_CHECK([sed 's/ (xid=0x[[0-9a-fA-F]]*)//' monitor.log], [0], [dnl
4435 OFPT_PACKET_IN (OF1.3): total_len=32 packet_type=(1,0x800),metadata=0xfafafafa5a5a5a5a,in_port=CONTROLLER (via action) data_len=32 (unbuffered)
4436 packet_type=(1,0x800),nw_src=10.0.0.20,nw_dst=10.0.0.30,nw_proto=17,nw_tos=0,nw_ecn=0,nw_ttl=255,tp_src=100,tp_dst=200 udp_csum:ea78
4437 OFPT_BARRIER_REPLY (OF1.3):
4438 ])
4439
4440 OVS_VSWITCHD_STOP
4441 AT_CLEANUP
4442
4443 dnl This test checks that metadata is encoded in packet_in structures,
4444 dnl supported by NXAST.
4445 AT_SETUP([ofproto - packet-out with metadata (NXM)])
4446 OVS_VSWITCHD_START
4447
4448 # Start a monitor listening for packet-ins.
4449 AT_CHECK([ovs-ofctl -P nxt_packet_in monitor br0 --detach --no-chdir --pidfile])
4450 ovs-appctl -t ovs-ofctl ofctl/send 0109000c0123456700000080
4451 ovs-appctl -t ovs-ofctl ofctl/barrier
4452 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
4453 AT_CAPTURE_FILE([monitor.log])
4454
4455 # Send a packet-out with a load action to set some metadata, and forward to controller
4456 AT_CHECK([ovs-ofctl packet-out br0 "in_port=controller packet=0001020304050010203040501234 actions=load(0xfafafafa5a5a5a5a->OXM_OF_METADATA[[0..63]]),load(0xaa->NXM_NX_PKT_MARK[[]]),controller"])
4457
4458 # Stop the monitor and check its output.
4459 ovs-appctl -t ovs-ofctl ofctl/barrier
4460 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
4461
4462 AT_CHECK([sed 's/ (xid=0x[[0-9a-fA-F]]*)//' monitor.log], [0], [dnl
4463 NXT_PACKET_IN: total_len=14 pkt_mark=0xaa,metadata=0xfafafafa5a5a5a5a,in_port=CONTROLLER (via action) data_len=14 (unbuffered)
4464 vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1234
4465 OFPT_BARRIER_REPLY:
4466 ])
4467
4468 OVS_VSWITCHD_STOP
4469 AT_CLEANUP
4470
4471 dnl This test checks that metadata is encoded in packet_in structures,
4472 dnl supported by NXAST.
4473 AT_SETUP([ofproto - packet-out with metadata (OpenFlow 1.2)])
4474 OVS_VSWITCHD_START
4475
4476 # Start a monitor listening for packet-ins.
4477 AT_CHECK([ovs-ofctl -O OpenFlow12 -P standard monitor br0 --detach --no-chdir --pidfile])
4478 ovs-appctl -t ovs-ofctl ofctl/send 0309000c0123456700000080
4479 ovs-appctl -t ovs-ofctl ofctl/barrier
4480 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
4481 AT_CAPTURE_FILE([monitor.log])
4482
4483 # Send a packet-out with a set-field action to set some metadata, and forward to controller
4484 AT_CHECK([ovs-ofctl -O OpenFlow12 packet-out br0 none 'set_field:0xfafafafa5a5a5a5a->metadata, controller' '0001020304050010203040501234'])
4485
4486 # Stop the monitor and check its output.
4487 ovs-appctl -t ovs-ofctl ofctl/barrier
4488 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
4489
4490 AT_CHECK([sed 's/ (xid=0x[[0-9a-fA-F]]*)//' monitor.log], [0], [dnl
4491 OFPT_PACKET_IN (OF1.2): total_len=14 metadata=0xfafafafa5a5a5a5a,in_port=ANY (via action) data_len=14 (unbuffered)
4492 vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1234
4493 OFPT_BARRIER_REPLY (OF1.2):
4494 ])
4495
4496 OVS_VSWITCHD_STOP
4497 AT_CLEANUP
4498
4499 dnl This test checks that metadata is encoded in packet_in structures,
4500 dnl supported by NXAST.
4501 AT_SETUP([ofproto - packet-out with metadata and dual set_field (OpenFlow 1.3)])
4502 OVS_VSWITCHD_START
4503
4504 # Start a monitor listening for packet-ins.
4505 AT_CHECK([ovs-ofctl -O OpenFlow13 -P standard monitor br0 --detach --no-chdir --pidfile])
4506 ovs-appctl -t ovs-ofctl ofctl/send 0409000c0123456700000080
4507 ovs-appctl -t ovs-ofctl ofctl/barrier
4508 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
4509 AT_CAPTURE_FILE([monitor.log])
4510
4511 # Send a packet-out with a couple of set-field action to set some metadata, and forward to controller
4512 AT_CHECK([ovs-ofctl -O OpenFlow13 packet-out br0 none 'set_field:0xfafafafa5a5a5a5a->metadata, set_field:0x6b->metadata, controller' '0001020304050010203040501234'])
4513
4514 # Stop the monitor and check its output.
4515 ovs-appctl -t ovs-ofctl ofctl/barrier
4516 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
4517
4518 AT_CHECK([sed 's/ (xid=0x[[0-9a-fA-F]]*)//' monitor.log], [0], [dnl
4519 OFPT_PACKET_IN (OF1.3): total_len=14 metadata=0x6b,in_port=ANY (via action) data_len=14 (unbuffered)
4520 vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1234
4521 OFPT_BARRIER_REPLY (OF1.3):
4522 ])
4523
4524 OVS_VSWITCHD_STOP
4525 AT_CLEANUP
4526
4527 dnl This test checks that tunnel metadata is encoded in packet_in structures.
4528 AT_SETUP([ofproto - packet-out with tunnel metadata (OpenFlow 1.2)])
4529 OVS_VSWITCHD_START
4530
4531 # Start a monitor listening for packet-ins.
4532 AT_CHECK([ovs-ofctl -O OpenFlow12 -P standard monitor br0 --detach --no-chdir --pidfile])
4533 ovs-appctl -t ovs-ofctl ofctl/send 0309000c0123456700000080
4534 ovs-appctl -t ovs-ofctl ofctl/barrier
4535 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
4536 AT_CAPTURE_FILE([monitor.log])
4537
4538 # Send a packet-out with set field actions to set some tunnel metadata, and forward to controller
4539 AT_CHECK([ovs-ofctl -O OpenFlow12 packet-out br0 none 'set_field:127.0.0.1->tun_src,set_field:0x01020304->tun_id,set_field:192.168.0.1->tun_dst, controller' '0001020304050010203040501234'])
4540
4541 # Stop the monitor and check its output.
4542 ovs-appctl -t ovs-ofctl ofctl/barrier
4543 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
4544
4545 AT_CHECK([sed 's/ (xid=0x[[0-9a-fA-F]]*)//' monitor.log], [0], [dnl
4546 OFPT_PACKET_IN (OF1.2): total_len=14 tun_id=0x1020304,tun_src=127.0.0.1,tun_dst=192.168.0.1,in_port=ANY (via action) data_len=14 (unbuffered)
4547 vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1234
4548 OFPT_BARRIER_REPLY (OF1.2):
4549 ])
4550
4551 OVS_VSWITCHD_STOP
4552 AT_CLEANUP
4553
4554 m4_divert_push([PREPARE_TESTS])
4555 # Sorts groups of lines that start with a space, without moving them
4556 # past the nearest line that does not start with a space.
4557 [
4558 multiline_sort () {
4559 $PYTHON3 -c '
4560 import sys
4561
4562 buffer = []
4563 while True:
4564 line = sys.stdin.readline()
4565 if not line:
4566 break
4567 if line.startswith(" "):
4568 buffer.append(line)
4569 else:
4570 sys.stdout.write("".join(sorted(buffer)))
4571 sys.stdout.write(line)
4572 buffer = []
4573 sys.stdout.write("".join(sorted(buffer)))
4574 '
4575 }
4576 ]
4577 m4_divert_pop([PREPARE_TESTS])
4578
4579 AT_SETUP([ofproto - flow monitoring])
4580 AT_KEYWORDS([monitor])
4581 OVS_VSWITCHD_START
4582
4583 ovs-ofctl add-flow br0 in_port=0,dl_vlan=123,actions=output:1
4584
4585 # Start a monitor watching the flow table and check the initial reply.
4586 ovs-ofctl monitor br0 watch: --detach --no-chdir --pidfile >monitor.log 2>&1
4587 AT_CAPTURE_FILE([monitor.log])
4588 ovs-appctl -t ovs-ofctl ofctl/barrier
4589 AT_CHECK([sed 's/ (xid=0x[[1-9a-fA-F]][[0-9a-fA-F]]*)//' monitor.log], [0],
4590 [NXST_FLOW_MONITOR reply:
4591 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=123 actions=output:1
4592 OFPT_BARRIER_REPLY:
4593 ])
4594
4595 # Add, delete, and modify some flows and check the updates.
4596 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
4597 ovs-ofctl add-flow br0 in_port=0,dl_vlan=124,actions=output:2
4598 ovs-ofctl add-flow br0 in_port=0,dl_vlan=123,actions=output:5
4599 ovs-ofctl add-flow br0 in_port=0,dl_vlan=123,dl_vlan_pcp=0,actions=output:6
4600 ovs-ofctl add-flow br0 in_port=0,dl_vlan=123,dl_vlan_pcp=1,actions=output:7
4601 ovs-ofctl add-flow br0 in_port=0,dl_vlan=123,actions=output:8
4602 ovs-ofctl add-flow br0 in_port=0,dl_vlan=65535,dl_vlan_pcp=0,actions=output:9
4603 ovs-ofctl add-flow br0 in_port=0,dl_vlan=65535,dl_vlan_pcp=1,actions=output:10
4604 ovs-ofctl add-flow br0 in_port=0,dl_vlan=65535,actions=output:11
4605 ovs-ofctl add-flow br0 in_port=0,dl_vlan=8191,dl_vlan_pcp=0,actions=output:12
4606 ovs-ofctl add-flow br0 in_port=0,dl_vlan=8191,dl_vlan_pcp=1,actions=output:13
4607 ovs-ofctl add-flow br0 in_port=0,dl_vlan=8191,actions=output:14
4608 ovs-ofctl add-flow br0 in_port=0,dl_vlan=0,dl_vlan_pcp=0,actions=output:15
4609 ovs-ofctl add-flow br0 in_port=0,dl_vlan=0,dl_vlan_pcp=1,actions=output:16
4610 ovs-ofctl add-flow br0 in_port=0,dl_vlan=0,actions=output:17
4611 ovs-ofctl add-flow br0 in_port=0,dl_vlan=0,dl_vlan_pcp=0,actions=output:18
4612 ovs-ofctl add-flow br0 in_port=0,dl_vlan=0,dl_vlan_pcp=1,actions=output:19
4613 ovs-ofctl add-flow br0 in_port=0,dl_vlan=0,actions=output:20
4614 ovs-ofctl add-flow br0 in_port=0,dl_vlan_pcp=0,actions=output:21
4615 ovs-ofctl add-flow br0 in_port=0,dl_vlan_pcp=1,actions=output:22
4616 ovs-ofctl add-flow br0 in_port=0,actions=output:23
4617 ovs-ofctl mod-flows br0 dl_vlan=123,actions=output:3
4618 ovs-ofctl mod-flows br0 cookie=5,dl_vlan=123,actions=output:3
4619 ovs-ofctl del-flows br0 dl_vlan=123
4620 ovs-ofctl del-flows br0
4621 ovs-appctl -t ovs-ofctl ofctl/barrier
4622 AT_CHECK([sed 's/ (xid=0x[[1-9a-fA-F]][[0-9a-fA-F]]*)//' monitor.log | multiline_sort], [0],
4623 [NXST_FLOW_MONITOR reply (xid=0x0):
4624 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=124 actions=output:2
4625 NXST_FLOW_MONITOR reply (xid=0x0):
4626 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=123 actions=output:5
4627 NXST_FLOW_MONITOR reply (xid=0x0):
4628 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=123,dl_vlan_pcp=0 actions=output:6
4629 NXST_FLOW_MONITOR reply (xid=0x0):
4630 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=123,dl_vlan_pcp=1 actions=output:7
4631 NXST_FLOW_MONITOR reply (xid=0x0):
4632 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=123 actions=output:8
4633 NXST_FLOW_MONITOR reply (xid=0x0):
4634 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=0,dl_vlan_pcp=0 actions=output:9
4635 NXST_FLOW_MONITOR reply (xid=0x0):
4636 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=0,dl_vlan_pcp=1 actions=output:10
4637 NXST_FLOW_MONITOR reply (xid=0x0):
4638 event=ADDED table=0 cookie=0 in_port=0,vlan_tci=0x0000 actions=output:11
4639 NXST_FLOW_MONITOR reply (xid=0x0):
4640 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=4095,dl_vlan_pcp=0 actions=output:12
4641 NXST_FLOW_MONITOR reply (xid=0x0):
4642 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=4095,dl_vlan_pcp=1 actions=output:13
4643 NXST_FLOW_MONITOR reply (xid=0x0):
4644 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=4095 actions=output:14
4645 NXST_FLOW_MONITOR reply (xid=0x0):
4646 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=0,dl_vlan_pcp=0 actions=output:15
4647 NXST_FLOW_MONITOR reply (xid=0x0):
4648 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=0,dl_vlan_pcp=1 actions=output:16
4649 NXST_FLOW_MONITOR reply (xid=0x0):
4650 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=0 actions=output:17
4651 NXST_FLOW_MONITOR reply (xid=0x0):
4652 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=0,dl_vlan_pcp=0 actions=output:18
4653 NXST_FLOW_MONITOR reply (xid=0x0):
4654 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=0,dl_vlan_pcp=1 actions=output:19
4655 NXST_FLOW_MONITOR reply (xid=0x0):
4656 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=0 actions=output:20
4657 NXST_FLOW_MONITOR reply (xid=0x0):
4658 event=ADDED table=0 cookie=0 in_port=0,dl_vlan_pcp=0 actions=output:21
4659 NXST_FLOW_MONITOR reply (xid=0x0):
4660 event=ADDED table=0 cookie=0 in_port=0,dl_vlan_pcp=1 actions=output:22
4661 NXST_FLOW_MONITOR reply (xid=0x0):
4662 event=ADDED table=0 cookie=0 in_port=0 actions=output:23
4663 NXST_FLOW_MONITOR reply (xid=0x0):
4664 event=MODIFIED table=0 cookie=0 in_port=0,dl_vlan=123 actions=output:3
4665 event=MODIFIED table=0 cookie=0 in_port=0,dl_vlan=123,dl_vlan_pcp=0 actions=output:3
4666 event=MODIFIED table=0 cookie=0 in_port=0,dl_vlan=123,dl_vlan_pcp=1 actions=output:3
4667 NXST_FLOW_MONITOR reply (xid=0x0):
4668 event=MODIFIED table=0 cookie=0x5 in_port=0,dl_vlan=123 actions=output:3
4669 event=MODIFIED table=0 cookie=0x5 in_port=0,dl_vlan=123,dl_vlan_pcp=0 actions=output:3
4670 event=MODIFIED table=0 cookie=0x5 in_port=0,dl_vlan=123,dl_vlan_pcp=1 actions=output:3
4671 NXST_FLOW_MONITOR reply (xid=0x0):
4672 event=DELETED reason=delete table=0 cookie=0x5 in_port=0,dl_vlan=123 actions=output:3
4673 event=DELETED reason=delete table=0 cookie=0x5 in_port=0,dl_vlan=123,dl_vlan_pcp=0 actions=output:3
4674 event=DELETED reason=delete table=0 cookie=0x5 in_port=0,dl_vlan=123,dl_vlan_pcp=1 actions=output:3
4675 NXST_FLOW_MONITOR reply (xid=0x0):
4676 event=DELETED reason=delete table=0 cookie=0 in_port=0 actions=output:23
4677 event=DELETED reason=delete table=0 cookie=0 in_port=0,dl_vlan=0 actions=output:20
4678 event=DELETED reason=delete table=0 cookie=0 in_port=0,dl_vlan=0,dl_vlan_pcp=0 actions=output:18
4679 event=DELETED reason=delete table=0 cookie=0 in_port=0,dl_vlan=0,dl_vlan_pcp=1 actions=output:19
4680 event=DELETED reason=delete table=0 cookie=0 in_port=0,dl_vlan=124 actions=output:2
4681 event=DELETED reason=delete table=0 cookie=0 in_port=0,dl_vlan=4095 actions=output:14
4682 event=DELETED reason=delete table=0 cookie=0 in_port=0,dl_vlan=4095,dl_vlan_pcp=0 actions=output:12
4683 event=DELETED reason=delete table=0 cookie=0 in_port=0,dl_vlan=4095,dl_vlan_pcp=1 actions=output:13
4684 event=DELETED reason=delete table=0 cookie=0 in_port=0,dl_vlan_pcp=0 actions=output:21
4685 event=DELETED reason=delete table=0 cookie=0 in_port=0,dl_vlan_pcp=1 actions=output:22
4686 event=DELETED reason=delete table=0 cookie=0 in_port=0,vlan_tci=0x0000 actions=output:11
4687 OFPT_BARRIER_REPLY:
4688 ])
4689
4690 # Check that our own changes are reported as full updates.
4691 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
4692 ovs-ofctl add-flow br0 in_port=1,actions=output:2
4693 ovs-ofctl add-flow br0 in_port=2,actions=output:1
4694 ovs-appctl -t ovs-ofctl ofctl/barrier
4695 ovs-appctl -t ovs-ofctl ofctl/send 010e004812345678003fffff00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003000000000000ffffffffffff0000
4696 ovs-appctl -t ovs-ofctl ofctl/barrier
4697 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip], [0], [NXST_FLOW reply:
4698 ])
4699 AT_CHECK([sed 's/ (xid=0x[[1-9a-fA-F]][[0-9a-fA-F]]*)//' monitor.log | multiline_sort], [0],
4700 [NXST_FLOW_MONITOR reply (xid=0x0):
4701 event=ADDED table=0 cookie=0 in_port=1 actions=output:2
4702 NXST_FLOW_MONITOR reply (xid=0x0):
4703 event=ADDED table=0 cookie=0 in_port=2 actions=output:1
4704 OFPT_BARRIER_REPLY:
4705 send: OFPT_FLOW_MOD: DEL priority=0 actions=drop
4706 NXST_FLOW_MONITOR reply (xid=0x0):
4707 event=DELETED reason=delete table=0 cookie=0 in_port=1 actions=output:2
4708 event=DELETED reason=delete table=0 cookie=0 in_port=2 actions=output:1
4709 OFPT_BARRIER_REPLY:
4710 ])
4711
4712 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
4713 OVS_VSWITCHD_STOP
4714 AT_CLEANUP
4715
4716 AT_SETUP([ofproto - flow monitoring with !own])
4717 AT_KEYWORDS([monitor])
4718 OVS_VSWITCHD_START
4719
4720 ovs-ofctl add-flow br0 in_port=0,dl_vlan=123,actions=output:1
4721
4722 # Start a monitor watching the flow table and check the initial reply.
4723 ovs-ofctl monitor br0 watch:\!own --detach --no-chdir --pidfile >monitor.log 2>&1
4724 AT_CAPTURE_FILE([monitor.log])
4725 ovs-appctl -t ovs-ofctl ofctl/barrier
4726 AT_CHECK([sed 's/ (xid=0x[[1-9a-fA-F]][[0-9a-fA-F]]*)//' monitor.log], [0],
4727 [NXST_FLOW_MONITOR reply:
4728 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=123 actions=output:1
4729 OFPT_BARRIER_REPLY:
4730 ])
4731
4732 # Check that our own changes are reported as abbreviations.
4733 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
4734 ovs-ofctl add-flow br0 in_port=1,actions=output:2
4735 ovs-ofctl add-flow br0 in_port=2,actions=output:1
4736 ovs-appctl -t ovs-ofctl ofctl/barrier
4737 ovs-appctl -t ovs-ofctl ofctl/send 010e004812345678003fffff00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003000000000000ffffffffffff0000
4738 ovs-appctl -t ovs-ofctl ofctl/barrier
4739 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip], [0], [NXST_FLOW reply:
4740 ])
4741 AT_CHECK([sed 's/ (xid=0x[[1-9a-fA-F]][[0-9a-fA-F]]*)//' monitor.log], [0],
4742 [NXST_FLOW_MONITOR reply (xid=0x0):
4743 event=ADDED table=0 cookie=0 in_port=1 actions=output:2
4744 NXST_FLOW_MONITOR reply (xid=0x0):
4745 event=ADDED table=0 cookie=0 in_port=2 actions=output:1
4746 OFPT_BARRIER_REPLY:
4747 send: OFPT_FLOW_MOD: DEL priority=0 actions=drop
4748 NXST_FLOW_MONITOR reply (xid=0x0):
4749 event=ABBREV xid=0x12345678
4750 OFPT_BARRIER_REPLY:
4751 ])
4752
4753 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
4754 OVS_VSWITCHD_STOP
4755 AT_CLEANUP
4756
4757 AT_SETUP([ofproto - flow monitoring with out_port])
4758 AT_KEYWORDS([monitor])
4759 OVS_VSWITCHD_START
4760
4761 ovs-ofctl add-flow br0 in_port=0,dl_vlan=121,actions=output:1
4762 ovs-ofctl add-flow br0 in_port=0,dl_vlan=122,actions=output:1
4763 ovs-ofctl add-flow br0 in_port=0,dl_vlan=123,actions=output:2
4764
4765 # Start a monitor watching the flow table and check the initial reply.
4766 ovs-ofctl monitor br0 watch:out_port=2 --detach --no-chdir --pidfile >monitor.log 2>&1
4767 AT_CAPTURE_FILE([monitor.log])
4768 ovs-appctl -t ovs-ofctl ofctl/barrier
4769 AT_CHECK([sed 's/ (xid=0x[[1-9a-fA-F]][[0-9a-fA-F]]*)//' monitor.log], [0],
4770 [NXST_FLOW_MONITOR reply:
4771 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=123 actions=output:2
4772 OFPT_BARRIER_REPLY:
4773 ])
4774
4775 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
4776
4777 # Add, modify flows and check the updates.
4778 ovs-ofctl mod-flows br0 dl_vlan=121,actions=drop
4779 ovs-ofctl mod-flows br0 dl_vlan=122,actions=output:1,output:2
4780 ovs-appctl -t ovs-ofctl ofctl/barrier
4781
4782 ovs-ofctl mod-flows br0 dl_vlan=123,actions=output:1,output:2
4783 ovs-appctl -t ovs-ofctl ofctl/barrier
4784
4785 ovs-ofctl mod-flows br0 dl_vlan=122,actions=output:1
4786 ovs-appctl -t ovs-ofctl ofctl/barrier
4787 ovs-ofctl mod-flows br0 dl_vlan=123,actions=output:2
4788 ovs-appctl -t ovs-ofctl ofctl/barrier
4789
4790 AT_CHECK([sed 's/ (xid=0x[[1-9a-fA-F]][[0-9a-fA-F]]*)//' monitor.log], [0],
4791 [NXST_FLOW_MONITOR reply (xid=0x0):
4792 event=MODIFIED table=0 cookie=0 in_port=0,dl_vlan=122 actions=output:1,output:2
4793 OFPT_BARRIER_REPLY:
4794 NXST_FLOW_MONITOR reply (xid=0x0):
4795 event=MODIFIED table=0 cookie=0 in_port=0,dl_vlan=123 actions=output:1,output:2
4796 OFPT_BARRIER_REPLY:
4797 NXST_FLOW_MONITOR reply (xid=0x0):
4798 event=MODIFIED table=0 cookie=0 in_port=0,dl_vlan=122 actions=output:1
4799 OFPT_BARRIER_REPLY:
4800 NXST_FLOW_MONITOR reply (xid=0x0):
4801 event=MODIFIED table=0 cookie=0 in_port=0,dl_vlan=123 actions=output:2
4802 OFPT_BARRIER_REPLY:
4803 ])
4804
4805 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
4806 OVS_VSWITCHD_STOP
4807 AT_CLEANUP
4808
4809 AT_SETUP([ofproto - flow monitoring pause and resume])
4810 AT_KEYWORDS([monitor])
4811
4812 # The maximum socket receive buffer size is important for this test, which
4813 # tests behavior when the receive buffer overflows.
4814 if test -e /proc/sys/net/core/rmem_max; then
4815 # Linux
4816 rmem_max=`cat /proc/sys/net/core/rmem_max`
4817 elif rmem_max=`sysctl -n net.inet.tcp.recvbuf_max 2>/dev/null`; then
4818 : # FreeBSD, NetBSD
4819 else
4820 # Don't know how to get maximum socket receive buffer on this OS
4821 AT_SKIP_IF([:])
4822 fi
4823 # Calculate the total amount of queuing: rmem_max in the kernel, 128 kB
4824 # in ofproto sending userspace (see ofmonitor_flush() in connmgr.c).
4825 queue_size=`expr $rmem_max + 128 \* 1024`
4826 echo rmem_max=$rmem_max queue_size=$queue_size
4827
4828 # If there's too much queuing skip the test to avoid timing out.
4829 AT_SKIP_IF([test $rmem_max -gt 1048576])
4830
4831 # Each flow update message takes up at least 48 bytes of space in queues
4832 # and in practice more than that.
4833 n_msgs=`expr $queue_size / 48`
4834 echo n_msgs=$n_msgs
4835
4836 OVS_VSWITCHD_START
4837
4838 # Start a monitor watching the flow table, then make it block.
4839 on_exit 'kill `cat ovs-ofctl.pid`'
4840 ovs-ofctl monitor br0 watch: --detach --no-chdir --pidfile >monitor.log 2>&1
4841 AT_CAPTURE_FILE([monitor.log])
4842 ovs-appctl -t ovs-ofctl ofctl/block
4843
4844 # Add $n_msgs flows.
4845 (echo "in_port=2,actions=output:2"
4846 $PYTHON3 -c '
4847 for i in range('$n_msgs'):
4848 print("cookie=1,reg1=%d,actions=drop" % i)
4849 ') > flows.txt
4850 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
4851 # Check that multipart flow dumps work properly:
4852 AT_CHECK([ovs-ofctl diff-flows br0 flows.txt])
4853 AT_CHECK([ovs-ofctl add-flow br0 in_port=1,cookie=3,actions=drop])
4854 AT_CHECK([ovs-ofctl mod-flows br0 in_port=2,cookie=2,actions=output:2])
4855 AT_CHECK([ovs-ofctl del-flows br0 cookie=1/-1])
4856
4857 ovs-appctl -t ovs-ofctl ofctl/unblock
4858
4859 # Wait for the connection resumed.
4860 # A barrier doesn't work for this purpose.
4861 # https://www.mail-archive.com/dev@openvswitch.org/msg27013.html
4862 # https://www.mail-archive.com/dev@openvswitch.org/msg27675.html
4863 OVS_WAIT_UNTIL([grep NXT_FLOW_MONITOR_RESUMED monitor.log])
4864
4865 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
4866
4867 # Check that the flow monitor reported the same number of flows
4868 # added and deleted, but fewer than we actually added and deleted.
4869 adds=`grep -c 'ADDED.*reg1=' monitor.log`
4870 deletes=`grep -c 'DELETED.*reg1=' monitor.log`
4871 echo adds=$adds deletes=$deletes
4872 AT_CHECK([test $adds -gt 100 && test $adds -lt $n_msgs])
4873 AT_CHECK([test $adds = $deletes])
4874
4875 # Check that the flow monitor reported everything in the expected order:
4876 #
4877 # event=ADDED table=0 cookie=0x1 reg1=0x22
4878 # ...
4879 # NXT_FLOW_MONITOR_PAUSED:
4880 # ...
4881 # event=DELETED reason=delete table=0 cookie=0x1 reg1=0x22
4882 # ...
4883 # event=ADDED table=0 cookie=0x3 in_port=1
4884 # event=MODIFIED table=0 cookie=0x2 in_port=2 actions=output:2
4885 # NXT_FLOW_MONITOR_RESUMED:
4886 #
4887 # except that, between the PAUSED and RESUMED, the order of the ADDED
4888 # and MODIFIED lines lines depends on hash order, that is, it varies
4889 # as we change the hash function or change architecture. Therefore,
4890 # we use a couple of tests below to accept both orders.
4891 AT_CHECK([ofctl_strip < monitor.log | sed -n -e '
4892 /reg1=0x22$/p
4893 /cookie=0x[[23]]/p
4894 /NXT_FLOW_MONITOR_PAUSED:/p
4895 /NXT_FLOW_MONITOR_RESUMED:/p
4896 ' > monitor.log.subset])
4897 AT_CHECK([grep -v MODIFIED monitor.log.subset], [0], [dnl
4898 event=ADDED table=0 cookie=0x1 reg1=0x22
4899 NXT_FLOW_MONITOR_PAUSED:
4900 event=DELETED reason=delete table=0 cookie=0x1 reg1=0x22
4901 event=ADDED table=0 cookie=0x3 in_port=1
4902 NXT_FLOW_MONITOR_RESUMED:
4903 ])
4904 AT_CHECK([grep -v ADDED monitor.log.subset], [0], [dnl
4905 NXT_FLOW_MONITOR_PAUSED:
4906 event=DELETED reason=delete table=0 cookie=0x1 reg1=0x22
4907 event=MODIFIED table=0 cookie=0x2 in_port=2 actions=output:2
4908 NXT_FLOW_MONITOR_RESUMED:
4909 ])
4910
4911 OVS_VSWITCHD_STOP
4912 AT_CLEANUP
4913
4914 AT_SETUP([ofproto - flow monitoring usable protocols])
4915 AT_KEYWORDS([monitor])
4916
4917 OVS_VSWITCHD_START
4918
4919 on_exit 'kill `cat ovs-ofctl.pid`'
4920 ovs-ofctl -OOpenFlow14 monitor br0 watch:udp,udp_dst=8 --detach --no-chdir --pidfile >monitor.log 2>&1
4921 AT_CAPTURE_FILE([monitor.log])
4922
4923 # ovs-ofctl should exit because monitor is not supported in OpenFlow 1.4
4924 OVS_WAIT_UNTIL([grep "ovs-ofctl: none of the usable flow formats (OpenFlow10,NXM) is among the allowed flow formats (OXM-OpenFlow14)" monitor.log])
4925
4926 # check that only NXM flag is returned as usable protocols for sctp_dst
4927 # and ovs-ofctl should exit since monitor is not supported in OpenFlow 1.4
4928 ovs-ofctl -OOpenFlow14 monitor br0 watch:sctp,sctp_dst=9 --detach --no-chdir --pidfile >monitor.log 2>&1
4929 OVS_WAIT_UNTIL([grep "ovs-ofctl: none of the usable flow formats (NXM) is among the allowed flow formats (OXM-OpenFlow14)" monitor.log])
4930
4931 OVS_VSWITCHD_STOP
4932 AT_CLEANUP
4933
4934
4935 AT_SETUP([ofproto - event filtering (OpenFlow 1.3)])
4936 AT_KEYWORDS([monitor])
4937 OVS_VSWITCHD_START
4938
4939 # Start a monitor, use the required protocol version
4940 ovs-ofctl -O OpenFlow13 monitor br0 --detach --no-chdir --pidfile >monitor.log 2>&1
4941 AT_CAPTURE_FILE([monitor.log])
4942
4943 # Send an OpenFlow13 message (04), OFPT_GET_ASYNC_REQUEST (1a), length (8), xid (0a)
4944 ovs-appctl -t ovs-ofctl ofctl/send 041a00080000000a
4945 ovs-appctl -t ovs-ofctl ofctl/barrier
4946
4947 # Check default setting
4948 read -r -d '' expected <<'EOF'
4949 EOF
4950
4951 AT_CHECK([ofctl_strip < monitor.log], [], [dnl
4952 send: OFPT_GET_ASYNC_REQUEST (OF1.3):
4953 OFPT_GET_ASYNC_REPLY (OF1.3):
4954 primary:
4955 PACKET_IN: no_match action
4956 PORT_STATUS: add delete modify
4957 FLOW_REMOVED: idle hard delete group_delete
4958 ROLE_STATUS: (off)
4959 TABLE_STATUS: (off)
4960 REQUESTFORWARD: (off)
4961
4962 secondary:
4963 PACKET_IN: (off)
4964 PORT_STATUS: add delete modify
4965 FLOW_REMOVED: (off)
4966 ROLE_STATUS: (off)
4967 TABLE_STATUS: (off)
4968 REQUESTFORWARD: (off)
4969 OFPT_BARRIER_REPLY (OF1.3):
4970 ])
4971
4972 OVS_VSWITCHD_STOP
4973 AT_CLEANUP
4974
4975 AT_SETUP([ofproto - ofport_request])
4976 OVS_VSWITCHD_START
4977 add_of_ports br0 1 2 3
4978
4979 set_and_check_specific_ofports () {
4980 ovs-vsctl set Interface p1 ofport_request="$1" -- \
4981 set Interface p2 ofport_request="$2" -- \
4982 set Interface p3 ofport_request="$3"
4983 ofports=`ovs-vsctl get Interface p1 ofport -- \
4984 get Interface p2 ofport -- \
4985 get Interface p3 ofport`
4986 AT_CHECK_UNQUOTED([echo $ofports], [0], [$1 $2 $3
4987 ])
4988 }
4989 for pre in '1 2 3' '1 3 2' '2 1 3' '2 3 1' '3 1 2' '3 2 1'; do
4990 for post in '1 2 3' '1 3 2' '2 1 3' '2 3 1' '3 1 2' '3 2 1'; do
4991 echo -----------------------------------------------------------
4992 echo "Check changing port numbers from $pre to $post"
4993 set_and_check_specific_ofports $pre
4994 set_and_check_specific_ofports $post
4995 done
4996 done
4997
4998 ovs-vsctl del-port p3
4999
5000 set_and_check_poorly_specified_ofports () {
5001 ovs-vsctl set Interface p1 ofport_request="$1" -- \
5002 set Interface p2 ofport_request="$2"
5003 p1=`ovs-vsctl get Interface p1 ofport`
5004 p2=`ovs-vsctl get Interface p2 ofport`
5005 echo $p1 $p2
5006
5007 AT_CHECK([test "$p1" != "$p2"])
5008 if test "$1" = "$2" && test "$1" != '[[]]'; then
5009 # One port number must be the requested one.
5010 AT_CHECK([test "$p1" = "$1" || test "$p2" = "$1"])
5011 # The other port number must be different (already tested above).
5012 else
5013 AT_CHECK([test "$1" = '[[]]' || test "$p1" = "$1"])
5014 AT_CHECK([test "$2" = '[[]]' || test "$p2" = "$2"])
5015 fi
5016 }
5017 for pre in '1 2' '[[]] 2' '1 [[]]' '[[]] [[]]' '2 1' '[[]] 1' '2 [[]]' \
5018 '1 1' '2 2'; do
5019 for post in '1 2' '[[]] 2' '1 [[]]' '[[]] [[]]' '2 1' '[[]] 1' '2 [[]]' \
5020 '1 1' '2 2'; do
5021 echo -----------------------------------------------------------
5022 echo "Check changing port numbers from $pre to $post"
5023 set_and_check_poorly_specified_ofports $pre
5024 set_and_check_poorly_specified_ofports $post
5025 done
5026 done
5027 OVS_VSWITCHD_STOP
5028 AT_CLEANUP
5029
5030
5031 AT_SETUP([ofproto - bundle open (OpenFlow 1.4)])
5032 AT_KEYWORDS([monitor])
5033 OVS_VSWITCHD_START
5034
5035 # Start a monitor, use the required protocol version
5036 ovs-ofctl -O OpenFlow14 monitor br0 --detach --no-chdir --pidfile >monitor.log 2>&1
5037 AT_CAPTURE_FILE([monitor.log])
5038
5039 # Send an OpenFlow14 message (05), OFPT_BUNDLE_CONTROL (21), length (10), xid (0a)
5040 ovs-appctl -t ovs-ofctl ofctl/send "05 21 00 10 00 00 00 0a 00 00 00 01 00 00 00 02"
5041 ovs-appctl -t ovs-ofctl ofctl/barrier
5042 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
5043
5044 AT_CHECK([ofctl_strip < monitor.log], [], [dnl
5045 send: OFPT_BUNDLE_CONTROL (OF1.4):
5046 bundle_id=0x1 type=OPEN_REQUEST flags=ordered
5047 OFPT_BUNDLE_CONTROL (OF1.4):
5048 bundle_id=0x1 type=OPEN_REPLY flags=0
5049 OFPT_BARRIER_REPLY (OF1.4):
5050 ])
5051
5052 OVS_VSWITCHD_STOP
5053 AT_CLEANUP
5054
5055 AT_SETUP([ofproto - bundle double open (OpenFlow 1.4)])
5056 AT_KEYWORDS([monitor])
5057 OVS_VSWITCHD_START
5058
5059 # Start a monitor, use the required protocol version
5060 ovs-ofctl -O OpenFlow14 monitor br0 --detach --no-chdir --pidfile >monitor.log 2>&1
5061 AT_CAPTURE_FILE([monitor.log])
5062
5063 # Send twice an OpenFlow14 message (05), OFPT_BUNDLE_CONTROL (21), length (10), xid (0a)
5064 ovs-appctl -t ovs-ofctl ofctl/send "05 21 00 10 00 00 00 0a 00 00 00 01 00 00 00 02"
5065 ovs-appctl -t ovs-ofctl ofctl/barrier
5066 ovs-appctl -t ovs-ofctl ofctl/send "05 21 00 10 00 00 00 0a 00 00 00 01 00 00 00 02"
5067 ovs-appctl -t ovs-ofctl ofctl/barrier
5068 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
5069
5070 AT_CHECK([ofctl_strip < monitor.log], [0], [dnl
5071 send: OFPT_BUNDLE_CONTROL (OF1.4):
5072 bundle_id=0x1 type=OPEN_REQUEST flags=ordered
5073 OFPT_BUNDLE_CONTROL (OF1.4):
5074 bundle_id=0x1 type=OPEN_REPLY flags=0
5075 OFPT_BARRIER_REPLY (OF1.4):
5076 send: OFPT_BUNDLE_CONTROL (OF1.4):
5077 bundle_id=0x1 type=OPEN_REQUEST flags=ordered
5078 OFPT_ERROR (OF1.4): OFPBFC_BAD_ID
5079 OFPT_BUNDLE_CONTROL (OF1.4):
5080 bundle_id=0x1 type=OPEN_REQUEST flags=ordered
5081 OFPT_BARRIER_REPLY (OF1.4):
5082 ])
5083
5084 OVS_VSWITCHD_STOP
5085 AT_CLEANUP
5086
5087 AT_SETUP([ofproto - bundle close without open (OpenFlow 1.4)])
5088 AT_KEYWORDS([monitor])
5089 OVS_VSWITCHD_START
5090
5091 # Start a monitor, use the required protocol version
5092 ovs-ofctl -O OpenFlow14 monitor br0 --detach --no-chdir --pidfile >monitor.log 2>&1
5093 AT_CAPTURE_FILE([monitor.log])
5094
5095 ovs-appctl -t ovs-ofctl ofctl/send "05 21 00 10 00 00 00 0a 00 00 00 01 00 02 00 02"
5096 ovs-appctl -t ovs-ofctl ofctl/barrier
5097 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
5098
5099 AT_CHECK([ofctl_strip < monitor.log], [0], [dnl
5100 send: OFPT_BUNDLE_CONTROL (OF1.4):
5101 bundle_id=0x1 type=CLOSE_REQUEST flags=ordered
5102 OFPT_ERROR (OF1.4): OFPBFC_BAD_ID
5103 OFPT_BUNDLE_CONTROL (OF1.4):
5104 bundle_id=0x1 type=CLOSE_REQUEST flags=ordered
5105 OFPT_BARRIER_REPLY (OF1.4):
5106 ])
5107
5108 OVS_VSWITCHD_STOP
5109 AT_CLEANUP
5110
5111 AT_SETUP([ofproto - bundle double close (OpenFlow 1.4)])
5112 AT_KEYWORDS([monitor])
5113 OVS_VSWITCHD_START
5114
5115 # Start a monitor, use the required protocol version
5116 ovs-ofctl -O OpenFlow14 monitor br0 --detach --no-chdir --pidfile >monitor.log 2>&1
5117 AT_CAPTURE_FILE([monitor.log])
5118
5119 # Open, Close, Close
5120 ovs-appctl -t ovs-ofctl ofctl/send "05 21 00 10 00 00 00 0a 00 00 00 01 00 00 00 02"
5121 ovs-appctl -t ovs-ofctl ofctl/barrier
5122 ovs-appctl -t ovs-ofctl ofctl/send "05 21 00 10 00 00 00 0a 00 00 00 01 00 02 00 02"
5123 ovs-appctl -t ovs-ofctl ofctl/barrier
5124 ovs-appctl -t ovs-ofctl ofctl/send "05 21 00 10 00 00 00 0a 00 00 00 01 00 02 00 02"
5125 ovs-appctl -t ovs-ofctl ofctl/barrier
5126 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
5127
5128 AT_CHECK([ofctl_strip < monitor.log], [0], [dnl
5129 send: OFPT_BUNDLE_CONTROL (OF1.4):
5130 bundle_id=0x1 type=OPEN_REQUEST flags=ordered
5131 OFPT_BUNDLE_CONTROL (OF1.4):
5132 bundle_id=0x1 type=OPEN_REPLY flags=0
5133 OFPT_BARRIER_REPLY (OF1.4):
5134 send: OFPT_BUNDLE_CONTROL (OF1.4):
5135 bundle_id=0x1 type=CLOSE_REQUEST flags=ordered
5136 OFPT_BUNDLE_CONTROL (OF1.4):
5137 bundle_id=0x1 type=CLOSE_REPLY flags=0
5138 OFPT_BARRIER_REPLY (OF1.4):
5139 send: OFPT_BUNDLE_CONTROL (OF1.4):
5140 bundle_id=0x1 type=CLOSE_REQUEST flags=ordered
5141 OFPT_ERROR (OF1.4): OFPBFC_BUNDLE_CLOSED
5142 OFPT_BUNDLE_CONTROL (OF1.4):
5143 bundle_id=0x1 type=CLOSE_REQUEST flags=ordered
5144 OFPT_BARRIER_REPLY (OF1.4):
5145 ])
5146
5147 OVS_VSWITCHD_STOP
5148 AT_CLEANUP
5149
5150 AT_SETUP([ofproto - bundle close, different flags (OpenFlow 1.4)])
5151 AT_KEYWORDS([monitor])
5152 OVS_VSWITCHD_START
5153
5154 # Start a monitor, use the required protocol version
5155 ovs-ofctl -O OpenFlow14 monitor br0 --detach --no-chdir --pidfile >monitor.log 2>&1
5156 AT_CAPTURE_FILE([monitor.log])
5157
5158 # Open, Close
5159 ovs-appctl -t ovs-ofctl ofctl/send "05 21 00 10 00 00 00 0a 00 00 00 01 00 00 00 02"
5160 ovs-appctl -t ovs-ofctl ofctl/barrier
5161 ovs-appctl -t ovs-ofctl ofctl/send "05 21 00 10 00 00 00 0a 00 00 00 01 00 02 00 01"
5162 ovs-appctl -t ovs-ofctl ofctl/barrier
5163 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
5164
5165 AT_CHECK([ofctl_strip < monitor.log], [0], [dnl
5166 send: OFPT_BUNDLE_CONTROL (OF1.4):
5167 bundle_id=0x1 type=OPEN_REQUEST flags=ordered
5168 OFPT_BUNDLE_CONTROL (OF1.4):
5169 bundle_id=0x1 type=OPEN_REPLY flags=0
5170 OFPT_BARRIER_REPLY (OF1.4):
5171 send: OFPT_BUNDLE_CONTROL (OF1.4):
5172 bundle_id=0x1 type=CLOSE_REQUEST flags=atomic
5173 OFPT_ERROR (OF1.4): OFPBFC_BAD_FLAGS
5174 OFPT_BUNDLE_CONTROL (OF1.4):
5175 bundle_id=0x1 type=CLOSE_REQUEST flags=atomic
5176 OFPT_BARRIER_REPLY (OF1.4):
5177 ])
5178
5179 OVS_VSWITCHD_STOP
5180 AT_CLEANUP
5181
5182 AT_SETUP([ofproto - bundle commit without open (OpenFlow 1.4)])
5183 AT_KEYWORDS([monitor])
5184 OVS_VSWITCHD_START
5185
5186 # Start a monitor, use the required protocol version
5187 ovs-ofctl -O OpenFlow14 monitor br0 --detach --no-chdir --pidfile >monitor.log 2>&1
5188 AT_CAPTURE_FILE([monitor.log])
5189
5190 # Commit
5191 ovs-appctl -t ovs-ofctl ofctl/send "05 21 00 10 00 00 00 0a 00 00 00 01 00 04 00 02"
5192 ovs-appctl -t ovs-ofctl ofctl/barrier
5193 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
5194
5195 AT_CHECK([ofctl_strip < monitor.log], [0], [dnl
5196 send: OFPT_BUNDLE_CONTROL (OF1.4):
5197 bundle_id=0x1 type=COMMIT_REQUEST flags=ordered
5198 OFPT_ERROR (OF1.4): OFPBFC_BAD_ID
5199 OFPT_BUNDLE_CONTROL (OF1.4):
5200 bundle_id=0x1 type=COMMIT_REQUEST flags=ordered
5201 OFPT_BARRIER_REPLY (OF1.4):
5202 ])
5203
5204 OVS_VSWITCHD_STOP
5205 AT_CLEANUP
5206
5207 AT_SETUP([ofproto - bundle commit, different flags (OpenFlow 1.4)])
5208 AT_KEYWORDS([monitor])
5209 OVS_VSWITCHD_START
5210
5211 # Start a monitor, use the required protocol version
5212 ovs-ofctl -O OpenFlow14 monitor br0 --detach --no-chdir --pidfile >monitor.log 2>&1
5213 AT_CAPTURE_FILE([monitor.log])
5214
5215 # Open, Commit
5216 ovs-appctl -t ovs-ofctl ofctl/send "05 21 00 10 00 00 00 0a 00 00 00 01 00 00 00 02"
5217 ovs-appctl -t ovs-ofctl ofctl/barrier
5218 ovs-appctl -t ovs-ofctl ofctl/send "05 21 00 10 00 00 00 0a 00 00 00 01 00 04 00 01"
5219 ovs-appctl -t ovs-ofctl ofctl/barrier
5220 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
5221
5222 AT_CHECK([ofctl_strip < monitor.log], [0], [dnl
5223 send: OFPT_BUNDLE_CONTROL (OF1.4):
5224 bundle_id=0x1 type=OPEN_REQUEST flags=ordered
5225 OFPT_BUNDLE_CONTROL (OF1.4):
5226 bundle_id=0x1 type=OPEN_REPLY flags=0
5227 OFPT_BARRIER_REPLY (OF1.4):
5228 send: OFPT_BUNDLE_CONTROL (OF1.4):
5229 bundle_id=0x1 type=COMMIT_REQUEST flags=atomic
5230 OFPT_ERROR (OF1.4): OFPBFC_BAD_FLAGS
5231 OFPT_BUNDLE_CONTROL (OF1.4):
5232 bundle_id=0x1 type=COMMIT_REQUEST flags=atomic
5233 OFPT_BARRIER_REPLY (OF1.4):
5234 ])
5235
5236 OVS_VSWITCHD_STOP
5237 AT_CLEANUP
5238
5239 AT_SETUP([ofproto - bundle discard without open (OpenFlow 1.4)])
5240 AT_KEYWORDS([monitor])
5241 OVS_VSWITCHD_START
5242
5243 # Start a monitor, use the required protocol version
5244 ovs-ofctl -O OpenFlow14 monitor br0 --detach --no-chdir --pidfile >monitor.log 2>&1
5245 AT_CAPTURE_FILE([monitor.log])
5246
5247 # Discard
5248 ovs-appctl -t ovs-ofctl ofctl/send "05 21 00 10 00 00 00 0a 00 00 00 01 00 06 00 02"
5249 ovs-appctl -t ovs-ofctl ofctl/barrier
5250 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
5251
5252 AT_CHECK([ofctl_strip < monitor.log], [0], [dnl
5253 send: OFPT_BUNDLE_CONTROL (OF1.4):
5254 bundle_id=0x1 type=DISCARD_REQUEST flags=ordered
5255 OFPT_ERROR (OF1.4): OFPBFC_BAD_ID
5256 OFPT_BUNDLE_CONTROL (OF1.4):
5257 bundle_id=0x1 type=DISCARD_REQUEST flags=ordered
5258 OFPT_BARRIER_REPLY (OF1.4):
5259 ])
5260
5261 OVS_VSWITCHD_STOP
5262 AT_CLEANUP
5263
5264
5265 AT_SETUP([ofproto - bundle with multiple flow mods (OpenFlow 1.4)])
5266 OVS_VSWITCHD_START
5267
5268 AT_CHECK([ovs-appctl vlog/set vconn:dbg])
5269
5270 AT_CHECK([ovs-ofctl --no-names del-flows br0])
5271
5272 AT_DATA([flows.txt], [dnl
5273 add idle_timeout=50 in_port=2 dl_src=00:66:77:88:99:aa actions=1
5274 add idle_timeout=60 in_port=2 dl_src=00:77:88:99:aa:bb actions=2
5275 add idle_timeout=70 in_port=2 dl_src=00:88:99:aa:bb:cc actions=3
5276 add idle_timeout=50 in_port=2 dl_src=00:66:77:88:99:aa actions=4
5277 delete
5278 add idle_timeout=50 in_port=2 dl_src=00:66:77:88:99:aa actions=5
5279 add idle_timeout=60 in_port=2 dl_src=00:77:88:99:aa:bb actions=6
5280 add idle_timeout=70 in_port=2 dl_src=00:88:99:aa:bb:cc actions=7
5281 delete in_port=2 dl_src=00:88:99:aa:bb:cc
5282 ])
5283
5284 AT_CHECK([ovs-ofctl --no-names --bundle add-flows br0 flows.txt])
5285
5286 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
5287 idle_timeout=50, in_port=2,dl_src=00:66:77:88:99:aa actions=output:5
5288 idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=output:6
5289 NXST_FLOW reply:
5290 ])
5291
5292 AT_DATA([flows.txt], [dnl
5293 modify actions=drop
5294 modify_strict in_port=2 dl_src=00:77:88:99:aa:bb actions=7
5295 ])
5296
5297 AT_CHECK([ovs-ofctl --no-names --bundle add-flows br0 flows.txt])
5298
5299 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
5300 idle_timeout=50, in_port=2,dl_src=00:66:77:88:99:aa actions=drop
5301 idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=output:7
5302 NXST_FLOW reply:
5303 ])
5304
5305 # Adding an existing flow acts as a modify, and delete_strict also works.
5306 AT_DATA([flows.txt], [dnl
5307 add idle_timeout=60 in_port=2 dl_src=00:77:88:99:aa:bb actions=8
5308 delete_strict in_port=2 dl_src=00:66:77:88:99:aa
5309 add in_port=2 dl_src=00:66:77:88:99:aa actions=drop
5310 ])
5311
5312 AT_CHECK([ovs-ofctl --no-names --bundle add-flows br0 flows.txt])
5313
5314 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
5315 idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=output:8
5316 in_port=2,dl_src=00:66:77:88:99:aa actions=drop
5317 NXST_FLOW reply:
5318 ])
5319
5320 dnl Check logs for OpenFlow trace
5321 # Prevent race.
5322 OVS_WAIT_UNTIL([vconn_sub < ovs-vswitchd.log | test `grep -- "|vconn|DBG|unix: sent (Success): NXST_FLOW reply" | wc -l` -ge 3])
5323 AT_CHECK([print_vconn_debug | vconn_sub | ofctl_strip], [0], [dnl
5324 vconn|DBG|unix: sent (Success): OFPT_HELLO (OF1.5):
5325 version bitmap: 0x01, 0x02, 0x03, 0x04, 0x05, 0x06
5326 vconn|DBG|unix: received: OFPT_HELLO:
5327 version bitmap: 0x01
5328 vconn|DBG|unix: negotiated OpenFlow version 0x01 (we support version 0x06 and earlier, peer supports version 0x01)
5329 vconn|DBG|unix: received: OFPT_FLOW_MOD: DEL actions=drop
5330 vconn|DBG|unix: received: OFPT_BARRIER_REQUEST:
5331 vconn|DBG|unix: sent (Success): OFPT_BARRIER_REPLY:
5332 vconn|DBG|unix: sent (Success): OFPT_HELLO (OF1.5):
5333 version bitmap: 0x01, 0x02, 0x03, 0x04, 0x05, 0x06
5334 vconn|DBG|unix: received: OFPT_HELLO (OF1.4):
5335 version bitmap: 0x05
5336 vconn|DBG|unix: negotiated OpenFlow version 0x05 (we support version 0x06 and earlier, peer supports version 0x05)
5337 vconn|DBG|unix: received: OFPT_BUNDLE_CONTROL (OF1.4):
5338 bundle_id=0 type=OPEN_REQUEST flags=atomic ordered
5339 vconn|DBG|unix: sent (Success): OFPT_BUNDLE_CONTROL (OF1.4):
5340 bundle_id=0 type=OPEN_REPLY flags=0
5341 vconn|DBG|unix: received: OFPT_BUNDLE_ADD_MESSAGE (OF1.4):
5342 bundle_id=0 flags=atomic ordered
5343 OFPT_FLOW_MOD (OF1.4): ADD in_port=2,dl_src=00:66:77:88:99:aa idle:50 actions=output:1
5344 vconn|DBG|unix: received: OFPT_BUNDLE_ADD_MESSAGE (OF1.4):
5345 bundle_id=0 flags=atomic ordered
5346 OFPT_FLOW_MOD (OF1.4): ADD in_port=2,dl_src=00:77:88:99:aa:bb idle:60 actions=output:2
5347 vconn|DBG|unix: received: OFPT_BUNDLE_ADD_MESSAGE (OF1.4):
5348 bundle_id=0 flags=atomic ordered
5349 OFPT_FLOW_MOD (OF1.4): ADD in_port=2,dl_src=00:88:99:aa:bb:cc idle:70 actions=output:3
5350 vconn|DBG|unix: received: OFPT_BUNDLE_ADD_MESSAGE (OF1.4):
5351 bundle_id=0 flags=atomic ordered
5352 OFPT_FLOW_MOD (OF1.4): ADD in_port=2,dl_src=00:66:77:88:99:aa idle:50 actions=output:4
5353 vconn|DBG|unix: received: OFPT_BUNDLE_ADD_MESSAGE (OF1.4):
5354 bundle_id=0 flags=atomic ordered
5355 OFPT_FLOW_MOD (OF1.4): DEL table:255 actions=drop
5356 vconn|DBG|unix: received: OFPT_BUNDLE_ADD_MESSAGE (OF1.4):
5357 bundle_id=0 flags=atomic ordered
5358 OFPT_FLOW_MOD (OF1.4): ADD in_port=2,dl_src=00:66:77:88:99:aa idle:50 actions=output:5
5359 vconn|DBG|unix: received: OFPT_BUNDLE_ADD_MESSAGE (OF1.4):
5360 bundle_id=0 flags=atomic ordered
5361 OFPT_FLOW_MOD (OF1.4): ADD in_port=2,dl_src=00:77:88:99:aa:bb idle:60 actions=output:6
5362 vconn|DBG|unix: received: OFPT_BUNDLE_ADD_MESSAGE (OF1.4):
5363 bundle_id=0 flags=atomic ordered
5364 OFPT_FLOW_MOD (OF1.4): ADD in_port=2,dl_src=00:88:99:aa:bb:cc idle:70 actions=output:7
5365 vconn|DBG|unix: received: OFPT_BUNDLE_ADD_MESSAGE (OF1.4):
5366 bundle_id=0 flags=atomic ordered
5367 OFPT_FLOW_MOD (OF1.4): DEL table:255 in_port=2,dl_src=00:88:99:aa:bb:cc actions=drop
5368 vconn|DBG|unix: received: OFPT_BARRIER_REQUEST (OF1.4):
5369 vconn|DBG|unix: sent (Success): OFPT_BARRIER_REPLY (OF1.4):
5370 vconn|DBG|unix: received: OFPT_BUNDLE_CONTROL (OF1.4):
5371 bundle_id=0 type=COMMIT_REQUEST flags=atomic ordered
5372 vconn|DBG|unix: sent (Success): OFPT_BUNDLE_CONTROL (OF1.4):
5373 bundle_id=0 type=COMMIT_REPLY flags=0
5374 vconn|DBG|unix: sent (Success): OFPT_HELLO (OF1.5):
5375 version bitmap: 0x01, 0x02, 0x03, 0x04, 0x05, 0x06
5376 vconn|DBG|unix: received: OFPT_HELLO:
5377 version bitmap: 0x01
5378 vconn|DBG|unix: negotiated OpenFlow version 0x01 (we support version 0x06 and earlier, peer supports version 0x01)
5379 vconn|DBG|unix: received: NXT_SET_FLOW_FORMAT: format=nxm
5380 vconn|DBG|unix: received: OFPT_BARRIER_REQUEST:
5381 vconn|DBG|unix: sent (Success): OFPT_BARRIER_REPLY:
5382 vconn|DBG|unix: received: NXST_FLOW request:
5383 vconn|DBG|unix: sent (Success): NXST_FLOW reply:
5384 idle_timeout=50, in_port=2,dl_src=00:66:77:88:99:aa actions=output:5
5385 idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=output:6
5386 vconn|DBG|unix: sent (Success): OFPT_HELLO (OF1.5):
5387 version bitmap: 0x01, 0x02, 0x03, 0x04, 0x05, 0x06
5388 vconn|DBG|unix: received: OFPT_HELLO (OF1.4):
5389 version bitmap: 0x05
5390 vconn|DBG|unix: negotiated OpenFlow version 0x05 (we support version 0x06 and earlier, peer supports version 0x05)
5391 vconn|DBG|unix: received: OFPT_BUNDLE_CONTROL (OF1.4):
5392 bundle_id=0 type=OPEN_REQUEST flags=atomic ordered
5393 vconn|DBG|unix: sent (Success): OFPT_BUNDLE_CONTROL (OF1.4):
5394 bundle_id=0 type=OPEN_REPLY flags=0
5395 vconn|DBG|unix: received: OFPT_BUNDLE_ADD_MESSAGE (OF1.4):
5396 bundle_id=0 flags=atomic ordered
5397 OFPT_FLOW_MOD (OF1.4): MOD actions=drop
5398 vconn|DBG|unix: received: OFPT_BUNDLE_ADD_MESSAGE (OF1.4):
5399 bundle_id=0 flags=atomic ordered
5400 OFPT_FLOW_MOD (OF1.4): MOD_STRICT in_port=2,dl_src=00:77:88:99:aa:bb actions=output:7
5401 vconn|DBG|unix: received: OFPT_BARRIER_REQUEST (OF1.4):
5402 vconn|DBG|unix: sent (Success): OFPT_BARRIER_REPLY (OF1.4):
5403 vconn|DBG|unix: received: OFPT_BUNDLE_CONTROL (OF1.4):
5404 bundle_id=0 type=COMMIT_REQUEST flags=atomic ordered
5405 vconn|DBG|unix: sent (Success): OFPT_BUNDLE_CONTROL (OF1.4):
5406 bundle_id=0 type=COMMIT_REPLY flags=0
5407 vconn|DBG|unix: sent (Success): OFPT_HELLO (OF1.5):
5408 version bitmap: 0x01, 0x02, 0x03, 0x04, 0x05, 0x06
5409 vconn|DBG|unix: received: OFPT_HELLO:
5410 version bitmap: 0x01
5411 vconn|DBG|unix: negotiated OpenFlow version 0x01 (we support version 0x06 and earlier, peer supports version 0x01)
5412 vconn|DBG|unix: received: NXT_SET_FLOW_FORMAT: format=nxm
5413 vconn|DBG|unix: received: OFPT_BARRIER_REQUEST:
5414 vconn|DBG|unix: sent (Success): OFPT_BARRIER_REPLY:
5415 vconn|DBG|unix: received: NXST_FLOW request:
5416 vconn|DBG|unix: sent (Success): NXST_FLOW reply:
5417 idle_timeout=50, in_port=2,dl_src=00:66:77:88:99:aa actions=drop
5418 idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=output:7
5419 vconn|DBG|unix: sent (Success): OFPT_HELLO (OF1.5):
5420 version bitmap: 0x01, 0x02, 0x03, 0x04, 0x05, 0x06
5421 vconn|DBG|unix: received: OFPT_HELLO (OF1.4):
5422 version bitmap: 0x05
5423 vconn|DBG|unix: negotiated OpenFlow version 0x05 (we support version 0x06 and earlier, peer supports version 0x05)
5424 vconn|DBG|unix: received: OFPT_BUNDLE_CONTROL (OF1.4):
5425 bundle_id=0 type=OPEN_REQUEST flags=atomic ordered
5426 vconn|DBG|unix: sent (Success): OFPT_BUNDLE_CONTROL (OF1.4):
5427 bundle_id=0 type=OPEN_REPLY flags=0
5428 vconn|DBG|unix: received: OFPT_BUNDLE_ADD_MESSAGE (OF1.4):
5429 bundle_id=0 flags=atomic ordered
5430 OFPT_FLOW_MOD (OF1.4): ADD in_port=2,dl_src=00:77:88:99:aa:bb idle:60 actions=output:8
5431 vconn|DBG|unix: received: OFPT_BUNDLE_ADD_MESSAGE (OF1.4):
5432 bundle_id=0 flags=atomic ordered
5433 OFPT_FLOW_MOD (OF1.4): DEL_STRICT table:255 in_port=2,dl_src=00:66:77:88:99:aa actions=drop
5434 vconn|DBG|unix: received: OFPT_BUNDLE_ADD_MESSAGE (OF1.4):
5435 bundle_id=0 flags=atomic ordered
5436 OFPT_FLOW_MOD (OF1.4): ADD in_port=2,dl_src=00:66:77:88:99:aa actions=drop
5437 vconn|DBG|unix: received: OFPT_BARRIER_REQUEST (OF1.4):
5438 vconn|DBG|unix: sent (Success): OFPT_BARRIER_REPLY (OF1.4):
5439 vconn|DBG|unix: received: OFPT_BUNDLE_CONTROL (OF1.4):
5440 bundle_id=0 type=COMMIT_REQUEST flags=atomic ordered
5441 vconn|DBG|unix: sent (Success): OFPT_BUNDLE_CONTROL (OF1.4):
5442 bundle_id=0 type=COMMIT_REPLY flags=0
5443 vconn|DBG|unix: sent (Success): OFPT_HELLO (OF1.5):
5444 version bitmap: 0x01, 0x02, 0x03, 0x04, 0x05, 0x06
5445 vconn|DBG|unix: received: OFPT_HELLO:
5446 version bitmap: 0x01
5447 vconn|DBG|unix: negotiated OpenFlow version 0x01 (we support version 0x06 and earlier, peer supports version 0x01)
5448 vconn|DBG|unix: received: NXT_SET_FLOW_FORMAT: format=nxm
5449 vconn|DBG|unix: received: OFPT_BARRIER_REQUEST:
5450 vconn|DBG|unix: sent (Success): OFPT_BARRIER_REPLY:
5451 vconn|DBG|unix: received: NXST_FLOW request:
5452 vconn|DBG|unix: sent (Success): NXST_FLOW reply:
5453 idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=output:8
5454 in_port=2,dl_src=00:66:77:88:99:aa actions=drop
5455 ])
5456
5457 AT_CHECK([grep " flow_mods in the last " ovs-vswitchd.log | sed -e 's/^.*connmgr|INFO|//' | vconn_sub], [0], [dnl
5458 br0<->unix: 1 flow_mods in the last 0 s (1 deletes)
5459 br0<->unix: 9 flow_mods in the last 0 s (7 adds, 2 deletes)
5460 br0<->unix: 2 flow_mods in the last 0 s (2 modifications)
5461 br0<->unix: 3 flow_mods in the last 0 s (2 adds, 1 deletes)
5462 ])
5463
5464 OVS_VSWITCHD_STOP
5465 AT_CLEANUP
5466
5467
5468 AT_SETUP([ofproto - failing bundle commit (OpenFlow 1.4)])
5469 OVS_VSWITCHD_START
5470
5471 AT_CHECK([ovs-ofctl del-flows br0])
5472
5473 ovs-ofctl add-flows br0 - <<EOF
5474 idle_timeout=50 in_port=2 dl_src=00:66:77:88:99:aa actions=11
5475 idle_timeout=60 in_port=2 dl_src=00:77:88:99:aa:bb actions=22
5476 idle_timeout=70 in_port=2 dl_src=00:88:99:aa:bb:cc actions=33
5477 EOF
5478 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
5479 idle_timeout=50, in_port=2,dl_src=00:66:77:88:99:aa actions=output:11
5480 idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=output:22
5481 idle_timeout=70, in_port=2,dl_src=00:88:99:aa:bb:cc actions=output:33
5482 NXST_FLOW reply:
5483 ])
5484
5485 # last line uses illegal table number (OVS internal table)
5486 AT_DATA([flows.txt], [dnl
5487 add idle_timeout=50 in_port=2 dl_src=00:66:77:88:99:aa actions=1
5488 add idle_timeout=60 in_port=2 dl_src=00:77:88:99:aa:bb actions=2
5489 add idle_timeout=70 in_port=2 dl_src=00:88:99:aa:bb:cc actions=3
5490 modify idle_timeout=50 in_port=2 dl_src=00:66:77:88:99:aa actions=4
5491 delete
5492 add idle_timeout=50 in_port=2 dl_src=00:66:77:88:99:aa actions=5
5493 add idle_timeout=60 in_port=2 dl_src=00:77:88:99:aa:bb actions=6
5494 add idle_timeout=70 in_port=2 dl_src=00:88:99:aa:bb:cc actions=7
5495 delete in_port=2 dl_src=00:88:99:aa:bb:cc
5496 add table=254 actions=drop
5497 ])
5498
5499 AT_CHECK([ovs-ofctl --bundle add-flows br0 flows.txt 2>&1 | sed '/talking to/,$d' | strip_xids],
5500 [0], [dnl
5501 Error OFPBRC_EPERM for: OFPT_FLOW_MOD (OF1.4): ADD table:254 actions=drop
5502 ])
5503
5504 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
5505 idle_timeout=50, in_port=2,dl_src=00:66:77:88:99:aa actions=output:11
5506 idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=output:22
5507 idle_timeout=70, in_port=2,dl_src=00:88:99:aa:bb:cc actions=output:33
5508 NXST_FLOW reply:
5509 ])
5510
5511 OVS_VSWITCHD_STOP
5512 AT_CLEANUP
5513
5514
5515 AT_SETUP([ofproto - bundle timeout (OpenFlow 1.4)])
5516 AT_KEYWORDS([monitor])
5517 OVS_VSWITCHD_START
5518
5519 # Start a monitor, use the required protocol version
5520 ovs-ofctl -O OpenFlow14 monitor br0 --detach --no-chdir --pidfile >monitor.log 2>&1
5521 AT_CAPTURE_FILE([monitor.log])
5522
5523 ovs-appctl time/stop
5524
5525 # Send an OpenFlow14 message (05), OFPT_BUNDLE_CONTROL (21), length (10), xid (01)
5526 ovs-appctl -t ovs-ofctl ofctl/send "05 21 00 10 00 00 00 01 00 00 00 01 00 00 00 03"
5527 ovs-appctl time/warp 8000
5528 # Send a bundle flow mod, it should keep the bundle alive.
5529 ovs-appctl -t ovs-ofctl ofctl/send "05 22 00 a0 00 00 00 02 00 00 00 01 00 00 00 03 \
5530 05 0e 00 90 00 00 00 02 00 00 00 00 00 00 00 00 \
5531 00 00 00 00 00 00 00 00 01 00 00 00 00 00 ff ff \
5532 ff ff ff ff ff ff ff ff ff ff ff ff 00 00 00 00 \
5533 00 01 00 42 80 00 00 04 00 00 00 01 80 00 08 06 \
5534 50 54 00 00 00 06 80 00 06 06 50 54 00 00 00 05 \
5535 80 00 0a 02 08 06 80 00 0c 02 00 00 80 00 2a 02 \
5536 00 02 80 00 2c 04 c0 a8 00 02 80 00 2e 04 c0 a8 \
5537 00 01 00 00 00 00 00 00 00 04 00 18 00 00 00 00 \
5538 00 00 00 10 00 00 00 03 00 00 00 00 00 00 00 00 \
5539 "
5540 ovs-appctl time/warp 8000
5541 # Send a bundle close, it should keep the bundle alive.
5542 ovs-appctl -t ovs-ofctl ofctl/send "05 21 00 10 00 00 00 03 00 00 00 01 00 02 00 03"
5543 ovs-appctl time/warp 11000
5544 # Make sure that timeouts are processed after the expiry
5545 ovs-appctl time/warp 1000
5546 # Send a Commit, but too late.
5547 ovs-appctl -t ovs-ofctl ofctl/send "05 21 00 10 00 00 00 04 00 00 00 01 00 04 00 03"
5548 ovs-appctl -t ovs-ofctl ofctl/barrier
5549 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
5550
5551 AT_CHECK([ofctl_strip < monitor.log], [], [dnl
5552 send: OFPT_BUNDLE_CONTROL (OF1.4):
5553 bundle_id=0x1 type=OPEN_REQUEST flags=atomic ordered
5554 OFPT_BUNDLE_CONTROL (OF1.4):
5555 bundle_id=0x1 type=OPEN_REPLY flags=0
5556 send: OFPT_BUNDLE_ADD_MESSAGE (OF1.4):
5557 bundle_id=0x1 flags=atomic ordered
5558 OFPT_FLOW_MOD (OF1.4): ADD table:1 priority=65535,arp,in_port=1,vlan_tci=0x0000/0x1fff,dl_src=50:54:00:00:00:06,dl_dst=50:54:00:00:00:05,arp_spa=192.168.0.2,arp_tpa=192.168.0.1,arp_op=2 actions=output:3
5559 send: OFPT_BUNDLE_CONTROL (OF1.4):
5560 bundle_id=0x1 type=CLOSE_REQUEST flags=atomic ordered
5561 OFPT_BUNDLE_CONTROL (OF1.4):
5562 bundle_id=0x1 type=CLOSE_REPLY flags=0
5563 OFPT_ERROR (OF1.4): OFPBFC_TIMEOUT
5564 OFPT_BUNDLE_CONTROL (OF1.4):
5565 bundle_id=0x1 type=OPEN_REQUEST flags=atomic ordered
5566 send: OFPT_BUNDLE_CONTROL (OF1.4):
5567 bundle_id=0x1 type=COMMIT_REQUEST flags=atomic ordered
5568 OFPT_ERROR (OF1.4): OFPBFC_BAD_ID
5569 OFPT_BUNDLE_CONTROL (OF1.4):
5570 bundle_id=0x1 type=COMMIT_REQUEST flags=atomic ordered
5571 OFPT_BARRIER_REPLY (OF1.4):
5572 ])
5573
5574 OVS_VSWITCHD_STOP
5575 AT_CLEANUP
5576
5577 AT_SETUP([ofproto - bundle custom timeout (OpenFlow 1.4)])
5578 AT_KEYWORDS([monitor])
5579 OVS_VSWITCHD_START
5580
5581 AT_CHECK([ovs-vsctl set Open_vSwitch . other_config:bundle-idle-timeout=4])
5582
5583 # Start a monitor, use the required protocol version
5584 ovs-ofctl -O OpenFlow14 monitor br0 --detach --no-chdir --pidfile >monitor.log 2>&1
5585 AT_CAPTURE_FILE([monitor.log])
5586
5587 ovs-appctl time/stop
5588
5589 # Send an OpenFlow14 message (05), OFPT_BUNDLE_CONTROL (21), length (10), xid (01)
5590 ovs-appctl -t ovs-ofctl ofctl/send "05 21 00 10 00 00 00 01 00 00 00 01 00 00 00 03"
5591 ovs-appctl time/warp 2000
5592 # Send a bundle flow mod, it should keep the bundle alive.
5593 ovs-appctl -t ovs-ofctl ofctl/send "05 22 00 a0 00 00 00 02 00 00 00 01 00 00 00 03 \
5594 05 0e 00 90 00 00 00 02 00 00 00 00 00 00 00 00 \
5595 00 00 00 00 00 00 00 00 01 00 00 00 00 00 ff ff \
5596 ff ff ff ff ff ff ff ff ff ff ff ff 00 00 00 00 \
5597 00 01 00 42 80 00 00 04 00 00 00 01 80 00 08 06 \
5598 50 54 00 00 00 06 80 00 06 06 50 54 00 00 00 05 \
5599 80 00 0a 02 08 06 80 00 0c 02 00 00 80 00 2a 02 \
5600 00 02 80 00 2c 04 c0 a8 00 02 80 00 2e 04 c0 a8 \
5601 00 01 00 00 00 00 00 00 00 04 00 18 00 00 00 00 \
5602 00 00 00 10 00 00 00 03 00 00 00 00 00 00 00 00 \
5603 "
5604 ovs-appctl time/warp 2000
5605 # Send a bundle close, it should keep the bundle alive.
5606 ovs-appctl -t ovs-ofctl ofctl/send "05 21 00 10 00 00 00 03 00 00 00 01 00 02 00 03"
5607 ovs-appctl time/warp 4000
5608 # Make sure that timeouts are processed after the expiry, but still before the
5609 # current timeout of 4s.
5610 ovs-appctl time/warp 1000
5611 # Send a Commit, but too late.
5612 ovs-appctl -t ovs-ofctl ofctl/send "05 21 00 10 00 00 00 04 00 00 00 01 00 04 00 03"
5613 ovs-appctl -t ovs-ofctl ofctl/barrier
5614 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
5615
5616 AT_CHECK([ofctl_strip < monitor.log], [], [dnl
5617 send: OFPT_BUNDLE_CONTROL (OF1.4):
5618 bundle_id=0x1 type=OPEN_REQUEST flags=atomic ordered
5619 OFPT_BUNDLE_CONTROL (OF1.4):
5620 bundle_id=0x1 type=OPEN_REPLY flags=0
5621 send: OFPT_BUNDLE_ADD_MESSAGE (OF1.4):
5622 bundle_id=0x1 flags=atomic ordered
5623 OFPT_FLOW_MOD (OF1.4): ADD table:1 priority=65535,arp,in_port=1,vlan_tci=0x0000/0x1fff,dl_src=50:54:00:00:00:06,dl_dst=50:54:00:00:00:05,arp_spa=192.168.0.2,arp_tpa=192.168.0.1,arp_op=2 actions=output:3
5624 send: OFPT_BUNDLE_CONTROL (OF1.4):
5625 bundle_id=0x1 type=CLOSE_REQUEST flags=atomic ordered
5626 OFPT_BUNDLE_CONTROL (OF1.4):
5627 bundle_id=0x1 type=CLOSE_REPLY flags=0
5628 OFPT_ERROR (OF1.4): OFPBFC_TIMEOUT
5629 OFPT_BUNDLE_CONTROL (OF1.4):
5630 bundle_id=0x1 type=OPEN_REQUEST flags=atomic ordered
5631 send: OFPT_BUNDLE_CONTROL (OF1.4):
5632 bundle_id=0x1 type=COMMIT_REQUEST flags=atomic ordered
5633 OFPT_ERROR (OF1.4): OFPBFC_BAD_ID
5634 OFPT_BUNDLE_CONTROL (OF1.4):
5635 bundle_id=0x1 type=COMMIT_REQUEST flags=atomic ordered
5636 OFPT_BARRIER_REPLY (OF1.4):
5637 ])
5638
5639 OVS_VSWITCHD_STOP
5640 AT_CLEANUP
5641
5642 AT_SETUP([ofproto - bundle reset timeout to default (OpenFlow 1.4)])
5643 AT_KEYWORDS([monitor])
5644 OVS_VSWITCHD_START
5645
5646 AT_CHECK([ovs-vsctl set Open_vSwitch . other_config:bundle-idle-timeout=15])
5647 AT_CHECK([ovs-vsctl remove Open_vSwitch . other_config bundle-idle-timeout])
5648
5649 # Start a monitor, use the required protocol version
5650 ovs-ofctl -O OpenFlow14 monitor br0 --detach --no-chdir --pidfile >monitor.log 2>&1
5651 AT_CAPTURE_FILE([monitor.log])
5652
5653 ovs-appctl time/stop
5654
5655 # Send an OpenFlow14 message (05), OFPT_BUNDLE_CONTROL (21), length (10), xid (01)
5656 ovs-appctl -t ovs-ofctl ofctl/send "05 21 00 10 00 00 00 01 00 00 00 01 00 00 00 03"
5657 ovs-appctl time/warp 8000
5658 # Send a bundle flow mod, it should keep the bundle alive.
5659 ovs-appctl -t ovs-ofctl ofctl/send "05 22 00 a0 00 00 00 02 00 00 00 01 00 00 00 03 \
5660 05 0e 00 90 00 00 00 02 00 00 00 00 00 00 00 00 \
5661 00 00 00 00 00 00 00 00 01 00 00 00 00 00 ff ff \
5662 ff ff ff ff ff ff ff ff ff ff ff ff 00 00 00 00 \
5663 00 01 00 42 80 00 00 04 00 00 00 01 80 00 08 06 \
5664 50 54 00 00 00 06 80 00 06 06 50 54 00 00 00 05 \
5665 80 00 0a 02 08 06 80 00 0c 02 00 00 80 00 2a 02 \
5666 00 02 80 00 2c 04 c0 a8 00 02 80 00 2e 04 c0 a8 \
5667 00 01 00 00 00 00 00 00 00 04 00 18 00 00 00 00 \
5668 00 00 00 10 00 00 00 03 00 00 00 00 00 00 00 00 \
5669 "
5670 ovs-appctl time/warp 8000
5671 # Send a bundle close, it should keep the bundle alive.
5672 ovs-appctl -t ovs-ofctl ofctl/send "05 21 00 10 00 00 00 03 00 00 00 01 00 02 00 03"
5673 ovs-appctl time/warp 11000
5674 # Make sure that timeouts are processed after the expiry
5675 ovs-appctl time/warp 1000
5676 # Send a Commit, but too late.
5677 ovs-appctl -t ovs-ofctl ofctl/send "05 21 00 10 00 00 00 04 00 00 00 01 00 04 00 03"
5678 ovs-appctl -t ovs-ofctl ofctl/barrier
5679 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
5680
5681 AT_CHECK([ofctl_strip < monitor.log], [], [dnl
5682 send: OFPT_BUNDLE_CONTROL (OF1.4):
5683 bundle_id=0x1 type=OPEN_REQUEST flags=atomic ordered
5684 OFPT_BUNDLE_CONTROL (OF1.4):
5685 bundle_id=0x1 type=OPEN_REPLY flags=0
5686 send: OFPT_BUNDLE_ADD_MESSAGE (OF1.4):
5687 bundle_id=0x1 flags=atomic ordered
5688 OFPT_FLOW_MOD (OF1.4): ADD table:1 priority=65535,arp,in_port=1,vlan_tci=0x0000/0x1fff,dl_src=50:54:00:00:00:06,dl_dst=50:54:00:00:00:05,arp_spa=192.168.0.2,arp_tpa=192.168.0.1,arp_op=2 actions=output:3
5689 send: OFPT_BUNDLE_CONTROL (OF1.4):
5690 bundle_id=0x1 type=CLOSE_REQUEST flags=atomic ordered
5691 OFPT_BUNDLE_CONTROL (OF1.4):
5692 bundle_id=0x1 type=CLOSE_REPLY flags=0
5693 OFPT_ERROR (OF1.4): OFPBFC_TIMEOUT
5694 OFPT_BUNDLE_CONTROL (OF1.4):
5695 bundle_id=0x1 type=OPEN_REQUEST flags=atomic ordered
5696 send: OFPT_BUNDLE_CONTROL (OF1.4):
5697 bundle_id=0x1 type=COMMIT_REQUEST flags=atomic ordered
5698 OFPT_ERROR (OF1.4): OFPBFC_BAD_ID
5699 OFPT_BUNDLE_CONTROL (OF1.4):
5700 bundle_id=0x1 type=COMMIT_REQUEST flags=atomic ordered
5701 OFPT_BARRIER_REPLY (OF1.4):
5702 ])
5703
5704 OVS_VSWITCHD_STOP
5705 AT_CLEANUP
5706
5707 AT_SETUP([ofproto - bundle open (OpenFlow 1.3)])
5708 AT_KEYWORDS([monitor])
5709 OVS_VSWITCHD_START
5710
5711 # Start a monitor, use the required protocol version
5712 ovs-ofctl -O OpenFlow13 monitor br0 --detach --no-chdir --pidfile >monitor.log 2>&1
5713 AT_CAPTURE_FILE([monitor.log])
5714
5715 # Send an OpenFlow13 message (04), OFPT_EXPERIMENTER (04), length (0018),
5716 # xid (0000000a), ONF_EXPERIMENTER_ID (4F4E4600),
5717 # ONFT_BUNDLE_CONTROL (2300 = 0x08FC), bundle id (00000001),
5718 # message type (0000), and flags (0002)
5719 ovs-appctl -t ovs-ofctl ofctl/send "04 04 00 18 00 00 00 0a 4F 4E 46 00 00 00 08 FC 00 00 00 01 00 00 00 02"
5720 ovs-appctl -t ovs-ofctl ofctl/barrier
5721 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
5722
5723 AT_CHECK([ofctl_strip < monitor.log], [], [dnl
5724 send: ONFT_BUNDLE_CONTROL (OF1.3):
5725 bundle_id=0x1 type=OPEN_REQUEST flags=ordered
5726 ONFT_BUNDLE_CONTROL (OF1.3):
5727 bundle_id=0x1 type=OPEN_REPLY flags=0
5728 OFPT_BARRIER_REPLY (OF1.3):
5729 ])
5730
5731 OVS_VSWITCHD_STOP
5732 AT_CLEANUP
5733
5734 AT_SETUP([ofproto - bundle double open (OpenFlow 1.3)])
5735 AT_KEYWORDS([monitor])
5736 OVS_VSWITCHD_START
5737
5738 # Start a monitor, use the required protocol version
5739 ovs-ofctl -O OpenFlow13 monitor br0 --detach --no-chdir --pidfile >monitor.log 2>&1
5740 AT_CAPTURE_FILE([monitor.log])
5741
5742 # Send twice an OpenFlow13 message (04), OFPT_EXPERIMENTER (04), length (0018),
5743 # xid (0000000a), ONF_EXPERIMENTER_ID (4F4E4600),
5744 # ONFT_BUNDLE_CONTROL (2300 = 0x08FC), bundle id (00000001),
5745 # message type (0000), and flags (0002)
5746 ovs-appctl -t ovs-ofctl ofctl/send "04 04 00 18 00 00 00 0a 4F 4E 46 00 00 00 08 FC 00 00 00 01 00 00 00 02"
5747 ovs-appctl -t ovs-ofctl ofctl/barrier
5748 ovs-appctl -t ovs-ofctl ofctl/send "04 04 00 18 00 00 00 0a 4F 4E 46 00 00 00 08 FC 00 00 00 01 00 00 00 02"
5749 ovs-appctl -t ovs-ofctl ofctl/barrier
5750 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
5751
5752 AT_CHECK([ofctl_strip < monitor.log], [0], [dnl
5753 send: ONFT_BUNDLE_CONTROL (OF1.3):
5754 bundle_id=0x1 type=OPEN_REQUEST flags=ordered
5755 ONFT_BUNDLE_CONTROL (OF1.3):
5756 bundle_id=0x1 type=OPEN_REPLY flags=0
5757 OFPT_BARRIER_REPLY (OF1.3):
5758 send: ONFT_BUNDLE_CONTROL (OF1.3):
5759 bundle_id=0x1 type=OPEN_REQUEST flags=ordered
5760 OFPT_ERROR (OF1.3): OFPBFC_BAD_ID
5761 ONFT_BUNDLE_CONTROL (OF1.3):
5762 bundle_id=0x1 type=OPEN_REQUEST flags=ordered
5763 OFPT_BARRIER_REPLY (OF1.3):
5764 ])
5765
5766 OVS_VSWITCHD_STOP
5767 AT_CLEANUP
5768
5769 AT_SETUP([ofproto - bundle close without open (OpenFlow 1.3)])
5770 AT_KEYWORDS([monitor])
5771 OVS_VSWITCHD_START
5772
5773 # Start a monitor, use the required protocol version
5774 ovs-ofctl -O OpenFlow13 monitor br0 --detach --no-chdir --pidfile >monitor.log 2>&1
5775 AT_CAPTURE_FILE([monitor.log])
5776
5777 ovs-appctl -t ovs-ofctl ofctl/send "04 04 00 18 00 00 00 0a 4F 4E 46 00 00 00 08 FC 00 00 00 01 00 02 00 02"
5778 ovs-appctl -t ovs-ofctl ofctl/barrier
5779 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
5780
5781 AT_CHECK([ofctl_strip < monitor.log], [0], [dnl
5782 send: ONFT_BUNDLE_CONTROL (OF1.3):
5783 bundle_id=0x1 type=CLOSE_REQUEST flags=ordered
5784 OFPT_ERROR (OF1.3): OFPBFC_BAD_ID
5785 ONFT_BUNDLE_CONTROL (OF1.3):
5786 bundle_id=0x1 type=CLOSE_REQUEST flags=ordered
5787 OFPT_BARRIER_REPLY (OF1.3):
5788 ])
5789
5790 OVS_VSWITCHD_STOP
5791 AT_CLEANUP
5792
5793 AT_SETUP([ofproto - bundle double close (OpenFlow 1.3)])
5794 AT_KEYWORDS([monitor])
5795 OVS_VSWITCHD_START
5796
5797 # Start a monitor, use the required protocol version
5798 ovs-ofctl -O OpenFlow13 monitor br0 --detach --no-chdir --pidfile >monitor.log 2>&1
5799 AT_CAPTURE_FILE([monitor.log])
5800
5801 # Open, Close, Close
5802 ovs-appctl -t ovs-ofctl ofctl/send "04 04 00 18 00 00 00 0a 4F 4E 46 00 00 00 08 FC 00 00 00 01 00 00 00 02"
5803 ovs-appctl -t ovs-ofctl ofctl/barrier
5804 ovs-appctl -t ovs-ofctl ofctl/send "04 04 00 18 00 00 00 0a 4F 4E 46 00 00 00 08 FC 00 00 00 01 00 02 00 02"
5805 ovs-appctl -t ovs-ofctl ofctl/barrier
5806 ovs-appctl -t ovs-ofctl ofctl/send "04 04 00 18 00 00 00 0a 4F 4E 46 00 00 00 08 FC 00 00 00 01 00 02 00 02"
5807 ovs-appctl -t ovs-ofctl ofctl/barrier
5808 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
5809
5810 AT_CHECK([ofctl_strip < monitor.log], [0], [dnl
5811 send: ONFT_BUNDLE_CONTROL (OF1.3):
5812 bundle_id=0x1 type=OPEN_REQUEST flags=ordered
5813 ONFT_BUNDLE_CONTROL (OF1.3):
5814 bundle_id=0x1 type=OPEN_REPLY flags=0
5815 OFPT_BARRIER_REPLY (OF1.3):
5816 send: ONFT_BUNDLE_CONTROL (OF1.3):
5817 bundle_id=0x1 type=CLOSE_REQUEST flags=ordered
5818 ONFT_BUNDLE_CONTROL (OF1.3):
5819 bundle_id=0x1 type=CLOSE_REPLY flags=0
5820 OFPT_BARRIER_REPLY (OF1.3):
5821 send: ONFT_BUNDLE_CONTROL (OF1.3):
5822 bundle_id=0x1 type=CLOSE_REQUEST flags=ordered
5823 OFPT_ERROR (OF1.3): OFPBFC_BUNDLE_CLOSED
5824 ONFT_BUNDLE_CONTROL (OF1.3):
5825 bundle_id=0x1 type=CLOSE_REQUEST flags=ordered
5826 OFPT_BARRIER_REPLY (OF1.3):
5827 ])
5828
5829 OVS_VSWITCHD_STOP
5830 AT_CLEANUP
5831
5832 AT_SETUP([ofproto - bundle close, different flags (OpenFlow 1.3)])
5833 AT_KEYWORDS([monitor])
5834 OVS_VSWITCHD_START
5835
5836 # Start a monitor, use the required protocol version
5837 ovs-ofctl -O OpenFlow13 monitor br0 --detach --no-chdir --pidfile >monitor.log 2>&1
5838 AT_CAPTURE_FILE([monitor.log])
5839
5840 # Open, Close
5841 ovs-appctl -t ovs-ofctl ofctl/send "04 04 00 18 00 00 00 0a 4F 4E 46 00 00 00 08 FC 00 00 00 01 00 00 00 02"
5842 ovs-appctl -t ovs-ofctl ofctl/barrier
5843 ovs-appctl -t ovs-ofctl ofctl/send "04 04 00 18 00 00 00 0a 4F 4E 46 00 00 00 08 FC 00 00 00 01 00 02 00 01"
5844 ovs-appctl -t ovs-ofctl ofctl/barrier
5845 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
5846
5847 AT_CHECK([ofctl_strip < monitor.log], [0], [dnl
5848 send: ONFT_BUNDLE_CONTROL (OF1.3):
5849 bundle_id=0x1 type=OPEN_REQUEST flags=ordered
5850 ONFT_BUNDLE_CONTROL (OF1.3):
5851 bundle_id=0x1 type=OPEN_REPLY flags=0
5852 OFPT_BARRIER_REPLY (OF1.3):
5853 send: ONFT_BUNDLE_CONTROL (OF1.3):
5854 bundle_id=0x1 type=CLOSE_REQUEST flags=atomic
5855 OFPT_ERROR (OF1.3): OFPBFC_BAD_FLAGS
5856 ONFT_BUNDLE_CONTROL (OF1.3):
5857 bundle_id=0x1 type=CLOSE_REQUEST flags=atomic
5858 OFPT_BARRIER_REPLY (OF1.3):
5859 ])
5860
5861 OVS_VSWITCHD_STOP
5862 AT_CLEANUP
5863
5864 AT_SETUP([ofproto - bundle commit without open (OpenFlow 1.3)])
5865 AT_KEYWORDS([monitor])
5866 OVS_VSWITCHD_START
5867
5868 # Start a monitor, use the required protocol version
5869 ovs-ofctl -O OpenFlow13 monitor br0 --detach --no-chdir --pidfile >monitor.log 2>&1
5870 AT_CAPTURE_FILE([monitor.log])
5871
5872 # Commit
5873 ovs-appctl -t ovs-ofctl ofctl/send "04 04 00 18 00 00 00 0a 4F 4E 46 00 00 00 08 FC 00 00 00 01 00 04 00 02"
5874 ovs-appctl -t ovs-ofctl ofctl/barrier
5875 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
5876
5877 AT_CHECK([ofctl_strip < monitor.log], [0], [dnl
5878 send: ONFT_BUNDLE_CONTROL (OF1.3):
5879 bundle_id=0x1 type=COMMIT_REQUEST flags=ordered
5880 OFPT_ERROR (OF1.3): OFPBFC_BAD_ID
5881 ONFT_BUNDLE_CONTROL (OF1.3):
5882 bundle_id=0x1 type=COMMIT_REQUEST flags=ordered
5883 OFPT_BARRIER_REPLY (OF1.3):
5884 ])
5885
5886 OVS_VSWITCHD_STOP
5887 AT_CLEANUP
5888
5889 AT_SETUP([ofproto - bundle commit, different flags (OpenFlow 1.3)])
5890 AT_KEYWORDS([monitor])
5891 OVS_VSWITCHD_START
5892
5893 # Start a monitor, use the required protocol version
5894 ovs-ofctl -O OpenFlow13 monitor br0 --detach --no-chdir --pidfile >monitor.log 2>&1
5895 AT_CAPTURE_FILE([monitor.log])
5896
5897 # Open, Commit
5898 ovs-appctl -t ovs-ofctl ofctl/send "04 04 00 18 00 00 00 0a 4F 4E 46 00 00 00 08 FC 00 00 00 01 00 00 00 02"
5899 ovs-appctl -t ovs-ofctl ofctl/barrier
5900 ovs-appctl -t ovs-ofctl ofctl/send "04 04 00 18 00 00 00 0a 4F 4E 46 00 00 00 08 FC 00 00 00 01 00 04 00 01"
5901 ovs-appctl -t ovs-ofctl ofctl/barrier
5902 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
5903
5904 AT_CHECK([ofctl_strip < monitor.log], [0], [dnl
5905 send: ONFT_BUNDLE_CONTROL (OF1.3):
5906 bundle_id=0x1 type=OPEN_REQUEST flags=ordered
5907 ONFT_BUNDLE_CONTROL (OF1.3):
5908 bundle_id=0x1 type=OPEN_REPLY flags=0
5909 OFPT_BARRIER_REPLY (OF1.3):
5910 send: ONFT_BUNDLE_CONTROL (OF1.3):
5911 bundle_id=0x1 type=COMMIT_REQUEST flags=atomic
5912 OFPT_ERROR (OF1.3): OFPBFC_BAD_FLAGS
5913 ONFT_BUNDLE_CONTROL (OF1.3):
5914 bundle_id=0x1 type=COMMIT_REQUEST flags=atomic
5915 OFPT_BARRIER_REPLY (OF1.3):
5916 ])
5917
5918 OVS_VSWITCHD_STOP
5919 AT_CLEANUP
5920
5921 AT_SETUP([ofproto - bundle discard without open (OpenFlow 1.3)])
5922 AT_KEYWORDS([monitor])
5923 OVS_VSWITCHD_START
5924
5925 # Start a monitor, use the required protocol version
5926 ovs-ofctl -O OpenFlow13 monitor br0 --detach --no-chdir --pidfile >monitor.log 2>&1
5927 AT_CAPTURE_FILE([monitor.log])
5928
5929 # Discard
5930 ovs-appctl -t ovs-ofctl ofctl/send "04 04 00 18 00 00 00 0a 4F 4E 46 00 00 00 08 FC 00 00 00 01 00 06 00 02"
5931 ovs-appctl -t ovs-ofctl ofctl/barrier
5932 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
5933
5934 AT_CHECK([ofctl_strip < monitor.log], [0], [dnl
5935 send: ONFT_BUNDLE_CONTROL (OF1.3):
5936 bundle_id=0x1 type=DISCARD_REQUEST flags=ordered
5937 OFPT_ERROR (OF1.3): OFPBFC_BAD_ID
5938 ONFT_BUNDLE_CONTROL (OF1.3):
5939 bundle_id=0x1 type=DISCARD_REQUEST flags=ordered
5940 OFPT_BARRIER_REPLY (OF1.3):
5941 ])
5942
5943 OVS_VSWITCHD_STOP
5944 AT_CLEANUP
5945
5946
5947 AT_SETUP([ofproto - bundle with multiple flow mods (OpenFlow 1.3)])
5948 OVS_VSWITCHD_START
5949
5950 AT_CHECK([ovs-appctl vlog/set vconn:dbg])
5951
5952 AT_CHECK([ovs-ofctl --no-names del-flows br0])
5953
5954 AT_DATA([flows.txt], [dnl
5955 add idle_timeout=50 in_port=2 dl_src=00:66:77:88:99:aa actions=1
5956 add idle_timeout=60 in_port=2 dl_src=00:77:88:99:aa:bb actions=2
5957 add idle_timeout=70 in_port=2 dl_src=00:88:99:aa:bb:cc actions=3
5958 add idle_timeout=50 in_port=2 dl_src=00:66:77:88:99:aa actions=4
5959 delete
5960 add idle_timeout=50 in_port=2 dl_src=00:66:77:88:99:aa actions=5
5961 add idle_timeout=60 in_port=2 dl_src=00:77:88:99:aa:bb actions=6
5962 add idle_timeout=70 in_port=2 dl_src=00:88:99:aa:bb:cc actions=7
5963 delete in_port=2 dl_src=00:88:99:aa:bb:cc
5964 ])
5965
5966 AT_CHECK([ovs-ofctl -O OpenFlow13 --no-names --bundle add-flows br0 flows.txt])
5967
5968 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
5969 idle_timeout=50, in_port=2,dl_src=00:66:77:88:99:aa actions=output:5
5970 idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=output:6
5971 NXST_FLOW reply:
5972 ])
5973
5974 AT_DATA([flows.txt], [dnl
5975 modify actions=drop
5976 modify_strict in_port=2 dl_src=00:77:88:99:aa:bb actions=7
5977 ])
5978
5979 AT_CHECK([ovs-ofctl -O OpenFlow13 --no-names --bundle add-flows br0 flows.txt])
5980
5981 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
5982 idle_timeout=50, in_port=2,dl_src=00:66:77:88:99:aa actions=drop
5983 idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=output:7
5984 NXST_FLOW reply:
5985 ])
5986
5987 # Adding an existing flow acts as a modify, and delete_strict also works.
5988 AT_DATA([flows.txt], [dnl
5989 add idle_timeout=60 in_port=2 dl_src=00:77:88:99:aa:bb actions=8
5990 delete_strict in_port=2 dl_src=00:66:77:88:99:aa
5991 add in_port=2 dl_src=00:66:77:88:99:aa actions=drop
5992 ])
5993
5994 AT_CHECK([ovs-ofctl -O OpenFlow13 --bundle --no-names add-flows br0 flows.txt])
5995
5996 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
5997 idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=output:8
5998 in_port=2,dl_src=00:66:77:88:99:aa actions=drop
5999 NXST_FLOW reply:
6000 ])
6001
6002 dnl Check logs for OpenFlow trace
6003 # Prevent race.
6004 OVS_WAIT_UNTIL([vconn_sub < ovs-vswitchd.log | test `grep -- "|vconn|DBG|unix: sent (Success): NXST_FLOW reply" | wc -l` -ge 3])
6005 AT_CHECK([print_vconn_debug | vconn_sub | ofctl_strip], [0], [dnl
6006 vconn|DBG|unix: sent (Success): OFPT_HELLO (OF1.5):
6007 version bitmap: 0x01, 0x02, 0x03, 0x04, 0x05, 0x06
6008 vconn|DBG|unix: received: OFPT_HELLO:
6009 version bitmap: 0x01
6010 vconn|DBG|unix: negotiated OpenFlow version 0x01 (we support version 0x06 and earlier, peer supports version 0x01)
6011 vconn|DBG|unix: received: OFPT_FLOW_MOD: DEL actions=drop
6012 vconn|DBG|unix: received: OFPT_BARRIER_REQUEST:
6013 vconn|DBG|unix: sent (Success): OFPT_BARRIER_REPLY:
6014 vconn|DBG|unix: sent (Success): OFPT_HELLO (OF1.5):
6015 version bitmap: 0x01, 0x02, 0x03, 0x04, 0x05, 0x06
6016 vconn|DBG|unix: received: OFPT_HELLO (OF1.3):
6017 version bitmap: 0x04
6018 vconn|DBG|unix: negotiated OpenFlow version 0x04 (we support version 0x06 and earlier, peer supports version 0x04)
6019 vconn|DBG|unix: received: ONFT_BUNDLE_CONTROL (OF1.3):
6020 bundle_id=0 type=OPEN_REQUEST flags=atomic ordered
6021 vconn|DBG|unix: sent (Success): ONFT_BUNDLE_CONTROL (OF1.3):
6022 bundle_id=0 type=OPEN_REPLY flags=0
6023 vconn|DBG|unix: received: ONFT_BUNDLE_ADD_MESSAGE (OF1.3):
6024 bundle_id=0 flags=atomic ordered
6025 OFPT_FLOW_MOD (OF1.3): ADD in_port=2,dl_src=00:66:77:88:99:aa idle:50 actions=output:1
6026 vconn|DBG|unix: received: ONFT_BUNDLE_ADD_MESSAGE (OF1.3):
6027 bundle_id=0 flags=atomic ordered
6028 OFPT_FLOW_MOD (OF1.3): ADD in_port=2,dl_src=00:77:88:99:aa:bb idle:60 actions=output:2
6029 vconn|DBG|unix: received: ONFT_BUNDLE_ADD_MESSAGE (OF1.3):
6030 bundle_id=0 flags=atomic ordered
6031 OFPT_FLOW_MOD (OF1.3): ADD in_port=2,dl_src=00:88:99:aa:bb:cc idle:70 actions=output:3
6032 vconn|DBG|unix: received: ONFT_BUNDLE_ADD_MESSAGE (OF1.3):
6033 bundle_id=0 flags=atomic ordered
6034 OFPT_FLOW_MOD (OF1.3): ADD in_port=2,dl_src=00:66:77:88:99:aa idle:50 actions=output:4
6035 vconn|DBG|unix: received: ONFT_BUNDLE_ADD_MESSAGE (OF1.3):
6036 bundle_id=0 flags=atomic ordered
6037 OFPT_FLOW_MOD (OF1.3): DEL table:255 actions=drop
6038 vconn|DBG|unix: received: ONFT_BUNDLE_ADD_MESSAGE (OF1.3):
6039 bundle_id=0 flags=atomic ordered
6040 OFPT_FLOW_MOD (OF1.3): ADD in_port=2,dl_src=00:66:77:88:99:aa idle:50 actions=output:5
6041 vconn|DBG|unix: received: ONFT_BUNDLE_ADD_MESSAGE (OF1.3):
6042 bundle_id=0 flags=atomic ordered
6043 OFPT_FLOW_MOD (OF1.3): ADD in_port=2,dl_src=00:77:88:99:aa:bb idle:60 actions=output:6
6044 vconn|DBG|unix: received: ONFT_BUNDLE_ADD_MESSAGE (OF1.3):
6045 bundle_id=0 flags=atomic ordered
6046 OFPT_FLOW_MOD (OF1.3): ADD in_port=2,dl_src=00:88:99:aa:bb:cc idle:70 actions=output:7
6047 vconn|DBG|unix: received: ONFT_BUNDLE_ADD_MESSAGE (OF1.3):
6048 bundle_id=0 flags=atomic ordered
6049 OFPT_FLOW_MOD (OF1.3): DEL table:255 in_port=2,dl_src=00:88:99:aa:bb:cc actions=drop
6050 vconn|DBG|unix: received: OFPT_BARRIER_REQUEST (OF1.3):
6051 vconn|DBG|unix: sent (Success): OFPT_BARRIER_REPLY (OF1.3):
6052 vconn|DBG|unix: received: ONFT_BUNDLE_CONTROL (OF1.3):
6053 bundle_id=0 type=COMMIT_REQUEST flags=atomic ordered
6054 vconn|DBG|unix: sent (Success): ONFT_BUNDLE_CONTROL (OF1.3):
6055 bundle_id=0 type=COMMIT_REPLY flags=0
6056 vconn|DBG|unix: sent (Success): OFPT_HELLO (OF1.5):
6057 version bitmap: 0x01, 0x02, 0x03, 0x04, 0x05, 0x06
6058 vconn|DBG|unix: received: OFPT_HELLO:
6059 version bitmap: 0x01
6060 vconn|DBG|unix: negotiated OpenFlow version 0x01 (we support version 0x06 and earlier, peer supports version 0x01)
6061 vconn|DBG|unix: received: NXT_SET_FLOW_FORMAT: format=nxm
6062 vconn|DBG|unix: received: OFPT_BARRIER_REQUEST:
6063 vconn|DBG|unix: sent (Success): OFPT_BARRIER_REPLY:
6064 vconn|DBG|unix: received: NXST_FLOW request:
6065 vconn|DBG|unix: sent (Success): NXST_FLOW reply:
6066 idle_timeout=50, in_port=2,dl_src=00:66:77:88:99:aa actions=output:5
6067 idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=output:6
6068 vconn|DBG|unix: sent (Success): OFPT_HELLO (OF1.5):
6069 version bitmap: 0x01, 0x02, 0x03, 0x04, 0x05, 0x06
6070 vconn|DBG|unix: received: OFPT_HELLO (OF1.3):
6071 version bitmap: 0x04
6072 vconn|DBG|unix: negotiated OpenFlow version 0x04 (we support version 0x06 and earlier, peer supports version 0x04)
6073 vconn|DBG|unix: received: ONFT_BUNDLE_CONTROL (OF1.3):
6074 bundle_id=0 type=OPEN_REQUEST flags=atomic ordered
6075 vconn|DBG|unix: sent (Success): ONFT_BUNDLE_CONTROL (OF1.3):
6076 bundle_id=0 type=OPEN_REPLY flags=0
6077 vconn|DBG|unix: received: ONFT_BUNDLE_ADD_MESSAGE (OF1.3):
6078 bundle_id=0 flags=atomic ordered
6079 OFPT_FLOW_MOD (OF1.3): MOD actions=drop
6080 vconn|DBG|unix: received: ONFT_BUNDLE_ADD_MESSAGE (OF1.3):
6081 bundle_id=0 flags=atomic ordered
6082 OFPT_FLOW_MOD (OF1.3): MOD_STRICT in_port=2,dl_src=00:77:88:99:aa:bb actions=output:7
6083 vconn|DBG|unix: received: OFPT_BARRIER_REQUEST (OF1.3):
6084 vconn|DBG|unix: sent (Success): OFPT_BARRIER_REPLY (OF1.3):
6085 vconn|DBG|unix: received: ONFT_BUNDLE_CONTROL (OF1.3):
6086 bundle_id=0 type=COMMIT_REQUEST flags=atomic ordered
6087 vconn|DBG|unix: sent (Success): ONFT_BUNDLE_CONTROL (OF1.3):
6088 bundle_id=0 type=COMMIT_REPLY flags=0
6089 vconn|DBG|unix: sent (Success): OFPT_HELLO (OF1.5):
6090 version bitmap: 0x01, 0x02, 0x03, 0x04, 0x05, 0x06
6091 vconn|DBG|unix: received: OFPT_HELLO:
6092 version bitmap: 0x01
6093 vconn|DBG|unix: negotiated OpenFlow version 0x01 (we support version 0x06 and earlier, peer supports version 0x01)
6094 vconn|DBG|unix: received: NXT_SET_FLOW_FORMAT: format=nxm
6095 vconn|DBG|unix: received: OFPT_BARRIER_REQUEST:
6096 vconn|DBG|unix: sent (Success): OFPT_BARRIER_REPLY:
6097 vconn|DBG|unix: received: NXST_FLOW request:
6098 vconn|DBG|unix: sent (Success): NXST_FLOW reply:
6099 idle_timeout=50, in_port=2,dl_src=00:66:77:88:99:aa actions=drop
6100 idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=output:7
6101 vconn|DBG|unix: sent (Success): OFPT_HELLO (OF1.5):
6102 version bitmap: 0x01, 0x02, 0x03, 0x04, 0x05, 0x06
6103 vconn|DBG|unix: received: OFPT_HELLO (OF1.3):
6104 version bitmap: 0x04
6105 vconn|DBG|unix: negotiated OpenFlow version 0x04 (we support version 0x06 and earlier, peer supports version 0x04)
6106 vconn|DBG|unix: received: ONFT_BUNDLE_CONTROL (OF1.3):
6107 bundle_id=0 type=OPEN_REQUEST flags=atomic ordered
6108 vconn|DBG|unix: sent (Success): ONFT_BUNDLE_CONTROL (OF1.3):
6109 bundle_id=0 type=OPEN_REPLY flags=0
6110 vconn|DBG|unix: received: ONFT_BUNDLE_ADD_MESSAGE (OF1.3):
6111 bundle_id=0 flags=atomic ordered
6112 OFPT_FLOW_MOD (OF1.3): ADD in_port=2,dl_src=00:77:88:99:aa:bb idle:60 actions=output:8
6113 vconn|DBG|unix: received: ONFT_BUNDLE_ADD_MESSAGE (OF1.3):
6114 bundle_id=0 flags=atomic ordered
6115 OFPT_FLOW_MOD (OF1.3): DEL_STRICT table:255 in_port=2,dl_src=00:66:77:88:99:aa actions=drop
6116 vconn|DBG|unix: received: ONFT_BUNDLE_ADD_MESSAGE (OF1.3):
6117 bundle_id=0 flags=atomic ordered
6118 OFPT_FLOW_MOD (OF1.3): ADD in_port=2,dl_src=00:66:77:88:99:aa actions=drop
6119 vconn|DBG|unix: received: OFPT_BARRIER_REQUEST (OF1.3):
6120 vconn|DBG|unix: sent (Success): OFPT_BARRIER_REPLY (OF1.3):
6121 vconn|DBG|unix: received: ONFT_BUNDLE_CONTROL (OF1.3):
6122 bundle_id=0 type=COMMIT_REQUEST flags=atomic ordered
6123 vconn|DBG|unix: sent (Success): ONFT_BUNDLE_CONTROL (OF1.3):
6124 bundle_id=0 type=COMMIT_REPLY flags=0
6125 vconn|DBG|unix: sent (Success): OFPT_HELLO (OF1.5):
6126 version bitmap: 0x01, 0x02, 0x03, 0x04, 0x05, 0x06
6127 vconn|DBG|unix: received: OFPT_HELLO:
6128 version bitmap: 0x01
6129 vconn|DBG|unix: negotiated OpenFlow version 0x01 (we support version 0x06 and earlier, peer supports version 0x01)
6130 vconn|DBG|unix: received: NXT_SET_FLOW_FORMAT: format=nxm
6131 vconn|DBG|unix: received: OFPT_BARRIER_REQUEST:
6132 vconn|DBG|unix: sent (Success): OFPT_BARRIER_REPLY:
6133 vconn|DBG|unix: received: NXST_FLOW request:
6134 vconn|DBG|unix: sent (Success): NXST_FLOW reply:
6135 idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=output:8
6136 in_port=2,dl_src=00:66:77:88:99:aa actions=drop
6137 ])
6138
6139 OVS_VSWITCHD_STOP
6140 AT_CLEANUP
6141
6142
6143 AT_SETUP([ofproto - failing bundle add message (OpenFlow 1.3)])
6144 OVS_VSWITCHD_START
6145
6146 AT_CHECK([ovs-ofctl del-flows br0])
6147
6148 ovs-ofctl add-flows br0 - <<EOF
6149 idle_timeout=50 in_port=2 dl_src=00:66:77:88:99:aa actions=11
6150 idle_timeout=60 in_port=2 dl_src=00:77:88:99:aa:bb actions=22
6151 idle_timeout=70 in_port=2 dl_src=00:88:99:aa:bb:cc actions=33
6152 EOF
6153 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
6154 idle_timeout=50, in_port=2,dl_src=00:66:77:88:99:aa actions=output:11
6155 idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=output:22
6156 idle_timeout=70, in_port=2,dl_src=00:88:99:aa:bb:cc actions=output:33
6157 NXST_FLOW reply:
6158 ])
6159
6160 # last line uses illegal table number (OVS internal table)
6161 AT_DATA([flows.txt], [dnl
6162 add idle_timeout=50 in_port=2 dl_src=00:66:77:88:99:aa actions=1
6163 add idle_timeout=60 in_port=2 dl_src=00:77:88:99:aa:bb actions=2
6164 add idle_timeout=70 in_port=2 dl_src=00:88:99:aa:bb:cc actions=3
6165 modify idle_timeout=50 in_port=2 dl_src=00:66:77:88:99:aa actions=4
6166 delete
6167 add idle_timeout=50 in_port=2 dl_src=00:66:77:88:99:aa actions=5
6168 add idle_timeout=60 in_port=2 dl_src=00:77:88:99:aa:bb actions=6
6169 add idle_timeout=70 in_port=2 dl_src=00:88:99:aa:bb:cc actions=7
6170 delete in_port=2 dl_src=00:88:99:aa:bb:cc
6171 add table=254 actions=drop
6172 ])
6173
6174 AT_CHECK([ovs-ofctl -O OpenFlow13 --bundle add-flows br0 flows.txt 2>&1 | sed '/talking to/,$d' | strip_xids],
6175 [0], [dnl
6176 Error OFPBRC_EPERM for: OFPT_FLOW_MOD (OF1.3): ADD table:254 actions=drop
6177 ])
6178
6179 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
6180 idle_timeout=50, in_port=2,dl_src=00:66:77:88:99:aa actions=output:11
6181 idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=output:22
6182 idle_timeout=70, in_port=2,dl_src=00:88:99:aa:bb:cc actions=output:33
6183 NXST_FLOW reply:
6184 ])
6185
6186 OVS_VSWITCHD_STOP
6187 AT_CLEANUP
6188
6189
6190 AT_SETUP([ofproto - failing bundle commit (OpenFlow 1.3)])
6191 OVS_VSWITCHD_START
6192
6193 AT_CHECK([ovs-ofctl del-flows br0])
6194
6195 # Invalid group numbers are detected at commit time
6196 AT_DATA([flows.txt], [dnl
6197 add idle_timeout=50 in_port=2 dl_src=00:66:77:88:99:aa actions=group:1
6198 add idle_timeout=60 in_port=2 dl_src=00:77:88:99:aa:bb actions=group:2
6199 add idle_timeout=70 in_port=2 dl_src=00:88:99:aa:bb:cc actions=group:3
6200 ])
6201
6202 AT_CHECK([ovs-ofctl -O OpenFlow13 --bundle add-flows br0 flows.txt 2>&1 | sed '/talking to/,$d' | strip_xids],
6203 [0], [dnl
6204 Error OFPBAC_BAD_OUT_GROUP for: OFPT_FLOW_MOD (OF1.3): ADD in_port=2,dl_src=00:66:77:88:99:aa idle:50 actions=group:1
6205 Error OFPBFC_MSG_FAILED for: ONFT_BUNDLE_CONTROL (OF1.3):
6206 bundle_id=0 type=COMMIT_REQUEST flags=atomic ordered
6207 ])
6208
6209 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
6210 NXST_FLOW reply:
6211 ])
6212
6213 OVS_VSWITCHD_STOP
6214 AT_CLEANUP
6215
6216 AT_SETUP([ofproto - monitor flows with tun_md])
6217 OVS_VSWITCHD_START
6218
6219 AT_CHECK([ovs-ofctl add-tlv-map br0 "{class=0xffff,type=0,len=4}->tun_metadata0"])
6220 AT_CHECK([ovs-ofctl add-flow br0 tun_metadata0=0x1,actions=drop])
6221
6222 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip], [0], [dnl
6223 NXST_FLOW reply:
6224 tun_metadata0=0x1 actions=drop
6225 ])
6226
6227 AT_CAPTURE_FILE([ofctl_monitor.log])
6228 dnl Usually ovs-ofctl monitor outputs on stderr, but the first message here
6229 dnl is put on stdout, because it is handled by ofctl in dump_transaction()
6230 dnl and not in monitor_vconn().
6231 AT_CHECK([ovs-ofctl monitor br0 65534 watch: --detach --no-chdir --pidfile >ofctl_monitor.log 2>&1])
6232
6233 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 2])
6234
6235 AT_CHECK([cat ofctl_monitor.log | ofctl_strip], [0], [dnl
6236 NXST_FLOW_MONITOR reply:
6237 event=ADDED table=0 cookie=0 tun_metadata0=0x1
6238 ])
6239
6240 AT_CHECK([ovs-ofctl del-flows br0])
6241
6242 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 4])
6243
6244 AT_CHECK([cat ofctl_monitor.log | ofctl_strip], [0], [dnl
6245 NXST_FLOW_MONITOR reply:
6246 event=ADDED table=0 cookie=0 tun_metadata0=0x1
6247 NXST_FLOW_MONITOR reply:
6248 event=DELETED reason=delete table=0 cookie=0 tun_metadata0=0x1
6249 ])
6250
6251 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
6252
6253 dnl Check that vswitchd hasn't crashed
6254 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip], [0], [dnl
6255 NXST_FLOW reply:
6256 ])
6257
6258 OVS_VSWITCHD_STOP
6259 AT_CLEANUP
6260
6261 AT_SETUP([ofproto - flow mod with tunnel metadata])
6262 AT_KEYWORDS([ofp-actions])
6263 OVS_VSWITCHD_START
6264
6265 AT_CHECK([ovs-ofctl add-tlv-map br0 "{class=0xffff,type=0,len=4}->tun_metadata0"])
6266 AT_CHECK([ovs-ofctl add-flow br0 "in_port=1 actions=move:tun_metadata0[[0..31]]->NXM_NX_REG0[[]]"])
6267
6268 dnl Check the length of tun_metadata0 in the replied OXM header.
6269 dnl Ignore the first 0x50 bytes of hex dump from the reply msg since the NXM
6270 dnl header that describes the tunnel metadata starts at offset 0x50.
6271 AT_CHECK([ovs-ofctl dump-flows br0 -mmmm], [0], [stdout])
6272 AT_CHECK([sed -e 's/duration=[[0-9.]]*s/duration=?s/' -e 's/idle_age=[[0-9]]*/idle_age=?/' -e '/^000000[[0-4]]0 / d' stdout | strip_xids], [0], [dnl
6273 NXST_FLOW reply:
6274 cookie=0x0, duration=?s, table=0, n_packets=0, n_bytes=0, idle_age=?, in_port=1 actions=move:NXM_NX_TUN_METADATA0[[0..31]]->NXM_NX_REG0[[]]
6275 00000050 ff ff 00 18 00 00 23 20-00 06 00 20 00 00 00 00 |......# ... ....|
6276 00000060 00 01 50 04 00 01 00 04- |..P..... |
6277 ])
6278
6279 dnl Check actions that may use tun_metadata
6280 AT_CHECK([ovs-ofctl add-flow br0 "in_port=2 actions=move:tun_metadata1[[0..31]]->NXM_NX_REG0[[]]"], [1], [], [stderr])
6281 AT_CHECK([strip_xids < stderr | sed '/FLOW_MOD/,$d'], [0], [dnl
6282 OFPT_ERROR: NXFMFC_INVALID_TLV_FIELD
6283 ])
6284
6285 AT_CHECK([ovs-ofctl add-flow br0 "in_port=2 actions=move:tun_metadata0[[32..63]]->NXM_NX_REG0[[]]"], [1], [], [stderr])
6286 AT_CHECK([strip_xids < stderr | sed '/FLOW_MOD/,$d'], [0], [dnl
6287 OFPT_ERROR: OFPBAC_BAD_SET_LEN
6288 ])
6289
6290 AT_CHECK([ovs-ofctl add-flow br0 "in_port=2 actions=push:tun_metadata1[[0..31]]"], [1], [], [stderr])
6291 AT_CHECK([strip_xids < stderr | sed '/FLOW_MOD/,$d'], [0], [dnl
6292 OFPT_ERROR: NXFMFC_INVALID_TLV_FIELD
6293 ])
6294
6295 AT_CHECK([ovs-ofctl add-flow br0 "in_port=2 actions=pop:tun_metadata0[[32..63]]"], [1], [], [stderr])
6296 AT_CHECK([strip_xids < stderr | sed '/FLOW_MOD/,$d'], [0], [dnl
6297 OFPT_ERROR: OFPBAC_BAD_SET_LEN
6298 ])
6299
6300 AT_CHECK([ovs-ofctl add-flow br0 "in_port=3, actions=load:0x11223344->tun_metadata1"], [1], [], [stderr])
6301 AT_CHECK([strip_xids < stderr | sed '/FLOW_MOD/,$d'], [0], [dnl
6302 OFPT_ERROR: NXFMFC_INVALID_TLV_FIELD
6303 ])
6304
6305 AT_CHECK([ovs-ofctl add-flow br0 "in_port=2 actions=output:tun_metadata1[[0..31]]"], [1], [], [stderr])
6306 AT_CHECK([strip_xids < stderr | sed '/FLOW_MOD/,$d'], [0], [dnl
6307 OFPT_ERROR: NXFMFC_INVALID_TLV_FIELD
6308 ])
6309
6310 AT_CHECK([ovs-ofctl add-flow br0 "in_port=2 actions=output:tun_metadata0[[32..63]]"], [1], [], [stderr])
6311 AT_CHECK([strip_xids < stderr | sed '/FLOW_MOD/,$d'], [0], [dnl
6312 OFPT_ERROR: OFPBAC_BAD_SET_LEN
6313 ])
6314
6315 AT_CHECK([ovs-ofctl add-flow br0 "in_port=2 actions=multipath(eth_src,50,modulo_n,1,0,tun_metadata1[[0..31]])"], [1], [], [stderr])
6316 AT_CHECK([strip_xids < stderr | sed '/FLOW_MOD/,$d'], [0], [dnl
6317 OFPT_ERROR: NXFMFC_INVALID_TLV_FIELD
6318 ])
6319
6320 AT_CHECK([ovs-ofctl add-flow br0 "in_port=2 actions=multipath(eth_src,50,modulo_n,1,0,tun_metadata0[[32..63]])"], [1], [], [stderr])
6321 AT_CHECK([strip_xids < stderr | sed '/FLOW_MOD/,$d'], [0], [dnl
6322 OFPT_ERROR: OFPBAC_BAD_SET_LEN
6323 ])
6324
6325 AT_CHECK([ovs-ofctl add-flow br0 "in_port=2 actions=bundle_load(eth_src,50,hrw,ofport,tun_metadata1[[0..31]], members:4,8)"], [1], [], [stderr])
6326 AT_CHECK([strip_xids < stderr | sed '/FLOW_MOD/,$d'], [0], [dnl
6327 OFPT_ERROR: NXFMFC_INVALID_TLV_FIELD
6328 ])
6329
6330 AT_CHECK([ovs-ofctl add-flow br0 "in_port=2 actions=bundle_load(eth_src,50,hrw,ofport,tun_metadata0[[32..63]], members:4,8)"], [1], [], [stderr])
6331 AT_CHECK([strip_xids < stderr | sed '/FLOW_MOD/,$d'], [0], [dnl
6332 OFPT_ERROR: OFPBAC_BAD_SET_LEN
6333 ])
6334
6335 AT_CHECK([ovs-ofctl add-flow br0 "in_port=2 actions=learn(tun_metadata1[[0..31]]=reg0[[0..31]])"], [1], [], [stderr])
6336 AT_CHECK([strip_xids < stderr | sed '/FLOW_MOD/,$d'], [0], [dnl
6337 OFPT_ERROR: NXFMFC_INVALID_TLV_FIELD
6338 ])
6339
6340 AT_CHECK([ovs-ofctl add-flow br0 "in_port=2 actions=learn(tun_metadata0[[32..63]]=reg0[[0..31]])"], [1], [], [stderr])
6341 AT_CHECK([strip_xids < stderr | sed '/FLOW_MOD/,$d'], [0], [dnl
6342 OFPT_ERROR: OFPBAC_BAD_SET_LEN
6343 ])
6344
6345 AT_CHECK([ovs-ofctl add-flow br0 "in_port=2 actions=clone(move:tun_metadata1[[0..31]]->reg0[[0..31]])"], [1], [], [stderr])
6346 AT_CHECK([strip_xids < stderr | sed '/FLOW_MOD/,$d'], [0], [dnl
6347 OFPT_ERROR: NXFMFC_INVALID_TLV_FIELD
6348 ])
6349
6350 AT_CHECK([ovs-ofctl add-flow br0 "in_port=2 actions=clone(move:tun_metadata0[[32..63]]->reg0[[0..31]])"], [1], [], [stderr])
6351 AT_CHECK([strip_xids < stderr | sed '/FLOW_MOD/,$d'], [0], [dnl
6352 OFPT_ERROR: OFPBAC_BAD_SET_LEN
6353 ])
6354
6355 AT_CHECK([ovs-ofctl add-flow br0 "ip actions=ct(commit,zone=tun_metadata1[[0..15]],exec(set_field:0x01->ct_mark))"], [1], [], [stderr])
6356 AT_CHECK([strip_xids < stderr | sed '/FLOW_MOD/,$d'], [0], [dnl
6357 OFPT_ERROR: NXFMFC_INVALID_TLV_FIELD
6358 ])
6359
6360 AT_CHECK([ovs-ofctl add-flow br0 "ip actions=ct(commit,zone=tun_metadata0[[32..47]],exec(set_field:0x01->ct_mark))"], [1], [], [stderr])
6361 AT_CHECK([strip_xids < stderr | sed '/FLOW_MOD/,$d'], [0], [dnl
6362 OFPT_ERROR: OFPBAC_BAD_SET_LEN
6363 ])
6364
6365 AT_CHECK([ovs-ofctl add-flow br0 "ip actions=ct(commit,zone=1,exec(move:tun_metadata1[[0..31]]->ct_mark))"], [1], [], [stderr])
6366 AT_CHECK([strip_xids < stderr | sed '/FLOW_MOD/,$d'], [0], [dnl
6367 OFPT_ERROR: NXFMFC_INVALID_TLV_FIELD
6368 ])
6369
6370 AT_CHECK([ovs-ofctl add-flow br0 "ip actions=ct(commit,zone=1,exec(move:tun_metadata0[[32..63]]->ct_mark))"], [1], [], [stderr])
6371 AT_CHECK([strip_xids < stderr | sed '/FLOW_MOD/,$d'], [0], [dnl
6372 OFPT_ERROR: OFPBAC_BAD_SET_LEN
6373 ])
6374
6375 dnl Check match field with tun_metadata
6376 AT_CHECK([ovs-ofctl add-flow br0 "tun_metadata0=0x11223344 actions=output:2"], [0], [], [stderr])
6377 AT_CHECK([ovs-ofctl add-flow br0 "tun_metadata1=0x11223344 actions=output:2"], [1], [], [stderr])
6378 AT_CHECK([strip_xids < stderr | sed '/FLOW_MOD/,$d'], [0], [dnl
6379 OFPT_ERROR: NXFMFC_INVALID_TLV_FIELD
6380 ])
6381
6382 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip], [0], [dnl)
6383 NXST_FLOW reply:
6384 in_port=1 actions=move:NXM_NX_TUN_METADATA0[[0..31]]->NXM_NX_REG0[[]]
6385 tun_metadata0=0x11223344 actions=output:2
6386 ])
6387
6388 OVS_VSWITCHD_STOP(["/NXFMFC_INVALID_TLV_FIELD/d
6389 /tun_metadata0/d
6390 /OFPBAC_BAD_SET_LEN/d"])
6391 AT_CLEANUP
6392
6393 AT_SETUP([ofproto - flush flows, groups, and meters for controller change])
6394 AT_KEYWORDS([flow flows group group meter])
6395 OVS_VSWITCHD_START
6396
6397 add_flow_group_and_meter () {
6398 AT_CHECK([ovs-ofctl add-flow br0 in_port=1,actions=2])
6399 AT_CHECK([ovs-ofctl -O OpenFlow11 add-group br0 group_id=1234,type=all,bucket=output:10
6400 AT_CHECK([ovs-ofctl -O OpenFlow13 add-meter br0 'meter=1 pktps burst stats bands=type=drop rate=1 burst_size=1'])
6401 ])
6402 }
6403
6404 verify_added () {
6405 AT_CHECK([ovs-ofctl --no-stats dump-flows br0], [0], [dnl
6406 in_port=1 actions=output:2
6407 ])
6408 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-groups br0], [0], [dnl
6409 OFPST_GROUP_DESC reply (OF1.1) (xid=0x2):
6410 group_id=1234,type=all,bucket=actions=output:10
6411 ])
6412 AT_CHECK([ovs-ofctl -O OpenFlow13 dump-meters br0], [0], [dnl
6413 OFPST_METER_CONFIG reply (OF1.3) (xid=0x2):
6414 meter=1 pktps burst stats bands=
6415 type=drop rate=1 burst_size=1
6416 ])
6417 }
6418
6419 verify_deleted () {
6420 AT_CHECK([ovs-ofctl --no-stats dump-flows br0])
6421 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-groups br0], [0], [dnl
6422 OFPST_GROUP_DESC reply (OF1.1) (xid=0x2):
6423 ])
6424 AT_CHECK([ovs-ofctl -O OpenFlow13 dump-meters br0], [0], [dnl
6425 OFPST_METER_CONFIG reply (OF1.3) (xid=0x2):
6426 ])
6427 }
6428
6429 # Add flow, group, meter and check that they're there, without a controller.
6430 add_flow_group_and_meter
6431 verify_added
6432
6433 # Set up a controller and verify that the flow and group were deleted,
6434 # then add them back.
6435 AT_CHECK([ovs-vsctl set-controller br0 'tcp:<invalid>:6653'])
6436 verify_deleted
6437 add_flow_group_and_meter
6438 verify_added
6439
6440 # Change the controller and verify that the flow and group are still there.
6441 AT_CHECK([ovs-vsctl set-controller br0 'tcp:<invalid2>:6653'])
6442 verify_added
6443
6444 # Clear the controller and verify that the flow and group were deleted.
6445 AT_CHECK([ovs-vsctl del-controller br0])
6446 verify_deleted
6447
6448 OVS_VSWITCHD_STOP(["/<invalid/d"])
6449 AT_CLEANUP