3 AT_SETUP([ofproto - echo request])
5 AT_CHECK([ovs-ofctl -vwarn probe br0])
9 AT_SETUP([ofproto - handling messages with bad version])
12 # Start a monitor running OpenFlow 1.0, then send the switch an OF1.1 features
14 AT_CHECK([ovs-ofctl -P openflow10 monitor br0 --detach --no-chdir --pidfile])
15 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
16 AT_CAPTURE_FILE([monitor.log])
17 ovs-appctl -t ovs-ofctl ofctl/send 0205000801234567
18 ovs-appctl -t ovs-ofctl ofctl/barrier
19 ovs-appctl -t ovs-ofctl exit
21 AT_CHECK([sed 's/ (xid=0x[[0-9a-fA-F]]*)//
22 /ECHO/d' monitor.log], [0], [dnl
23 send: OFPT_FEATURES_REQUEST (OF1.1):
24 OFPT_ERROR (OF1.1): OFPBRC_BAD_VERSION
25 OFPT_FEATURES_REQUEST (OF1.1):
29 OVS_VSWITCHD_STOP(["/received OpenFlow version 0x02 != expected 01/d"])
32 AT_SETUP([ofproto - feature request, config request])
34 AT_CHECK([ovs-ofctl -vwarn show br0], [0], [stdout])
35 AT_CHECK([STRIP_XIDS stdout], [0], [dnl
36 OFPT_FEATURES_REPLY: dpid:fedcba9876543210
37 n_tables:254, n_buffers:256
38 capabilities: FLOW_STATS TABLE_STATS PORT_STATS QUEUE_STATS ARP_MATCH_IP
39 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
40 LOCAL(br0): addr:aa:55:aa:55:00:00
43 speed: 0 Mbps now, 0 Mbps max
44 OFPT_GET_CONFIG_REPLY: frags=normal miss_send_len=0
49 AT_SETUP([ofproto - set OpenFlow port number])
51 [add-port br0 p1 -- set Interface p1 type=dummy --\
52 add-port br0 p2 -- set Interface p2 type=dummy ofport_request=99])
53 AT_CHECK([ovs-ofctl -vwarn show br0], [0], [stdout])
55 s/ (xid=0x[0-9a-fA-F]*)//
56 s/00:0.$/00:0x/' < stdout]],
58 OFPT_FEATURES_REPLY: dpid:fedcba9876543210
59 n_tables:254, n_buffers:256
60 capabilities: FLOW_STATS TABLE_STATS PORT_STATS QUEUE_STATS ARP_MATCH_IP
61 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
62 1(p1): addr:aa:55:aa:55:00:0x
65 speed: 0 Mbps now, 0 Mbps max
66 99(p2): addr:aa:55:aa:55:00:0x
69 speed: 0 Mbps now, 0 Mbps max
70 LOCAL(br0): addr:aa:55:aa:55:00:0x
73 speed: 0 Mbps now, 0 Mbps max
74 OFPT_GET_CONFIG_REPLY: frags=normal miss_send_len=0
80 dnl This is really bare-bones.
81 dnl It at least checks request and reply serialization and deserialization.
82 AT_SETUP([ofproto - port stats - (OpenFlow 1.0)])
84 AT_CHECK([ovs-ofctl -vwarn dump-ports br0], [0], [stdout])
85 AT_CHECK([STRIP_XIDS stdout], [0], [dnl
86 OFPST_PORT reply: 1 ports
87 port LOCAL: rx pkts=0, bytes=0, drop=0, errs=0, frame=0, over=0, crc=0
88 tx pkts=0, bytes=0, drop=0, errs=0, coll=0
93 AT_SETUP([ofproto - port stats - (OpenFlow 1.2)])
95 AT_CHECK([ovs-ofctl -O OpenFlow12 -vwarn dump-ports br0], [0], [stdout])
96 AT_CHECK([STRIP_XIDS stdout], [0], [dnl
97 OFPST_PORT reply (OF1.2): 1 ports
98 port LOCAL: rx pkts=0, bytes=0, drop=0, errs=0, frame=0, over=0, crc=0
99 tx pkts=0, bytes=0, drop=0, errs=0, coll=0
104 AT_SETUP([ofproto - port stats - (OpenFlow 1.4)])
106 AT_CHECK([ovs-ofctl -O OpenFlow14 -vwarn dump-ports br0], [0], [stdout])
107 AT_CHECK([STRIP_XIDS stdout | sed 's/duration=[[0-9.]]*s/duration=?s/'],
109 OFPST_PORT reply (OF1.4): 1 ports
110 port LOCAL: rx pkts=0, bytes=0, drop=0, errs=0, frame=0, over=0, crc=0
111 tx pkts=0, bytes=0, drop=0, errs=0, coll=0
117 dnl This is really bare-bones.
118 dnl It at least checks request and reply serialization and deserialization.
119 AT_SETUP([ofproto - port-desc stats (OpenFlow 1.0)])
121 AT_CHECK([ovs-ofctl -vwarn dump-ports-desc br0], [0], [stdout])
122 AT_CHECK([STRIP_XIDS stdout], [0], [dnl
123 OFPST_PORT_DESC reply:
124 LOCAL(br0): addr:aa:55:aa:55:00:00
127 speed: 0 Mbps now, 0 Mbps max
132 dnl This is really bare-bones.
133 dnl It at least checks request and reply serialization and deserialization.
134 AT_SETUP([ofproto - port-desc stats (OpenFlow 1.2)])
136 AT_CHECK([ovs-ofctl -O OpenFlow12 -vwarn dump-ports-desc br0], [0], [stdout])
137 AT_CHECK([STRIP_XIDS stdout], [0], [dnl
138 OFPST_PORT_DESC reply (OF1.2):
139 LOCAL(br0): addr:aa:55:aa:55:00:00
142 speed: 0 Mbps now, 0 Mbps max
147 AT_SETUP([ofproto - port-desc stats (OpenFlow 1.5)])
149 ADD_OF_PORTS([br0], 1, 2, 3)
150 AT_CHECK([ovs-ofctl -F OXM-OpenFlow15 -O OpenFlow15 -vwarn dump-ports-desc br0], [0], [stdout])
151 AT_CHECK([STRIP_XIDS stdout | sed 's/00:0./00:0x/'], [0], [dnl
152 OFPST_PORT_DESC reply (OF1.5):
153 1(p1): addr:aa:55:aa:55:00:0x
156 speed: 0 Mbps now, 0 Mbps max
157 2(p2): addr:aa:55:aa:55:00:0x
160 speed: 0 Mbps now, 0 Mbps max
161 3(p3): addr:aa:55:aa:55:00:0x
164 speed: 0 Mbps now, 0 Mbps max
165 LOCAL(br0): addr:aa:55:aa:55:00:0x
168 speed: 0 Mbps now, 0 Mbps max
170 AT_CHECK([ovs-ofctl -F OXM-OpenFlow15 -O OpenFlow15 -vwarn dump-ports-desc br0 2], [0], [stdout])
171 AT_CHECK([STRIP_XIDS stdout | sed 's/00:0./00:0x/'], [0], [dnl
172 OFPST_PORT_DESC reply (OF1.5):
173 2(p2): addr:aa:55:aa:55:00:0x
176 speed: 0 Mbps now, 0 Mbps max
181 dnl This is really bare-bones.
182 dnl It at least checks request and reply serialization and deserialization.
183 AT_SETUP([ofproto - queue stats - (OpenFlow 1.0)])
185 AT_CHECK([ovs-ofctl -vwarn queue-stats br0], [0], [stdout])
186 AT_CHECK([STRIP_XIDS stdout], [0], [dnl
187 OFPST_QUEUE reply: 0 queues
189 AT_CHECK([ovs-ofctl -vwarn queue-stats br0 ANY 5], [0],
190 [OFPT_ERROR (xid=0x2): OFPQOFC_BAD_QUEUE
191 OFPST_QUEUE request (xid=0x2):port=ANY queue=5
193 AT_CHECK([ovs-ofctl -vwarn queue-stats br0 10], [0],
194 [OFPT_ERROR (xid=0x2): OFPQOFC_BAD_PORT
195 OFPST_QUEUE request (xid=0x2):port=10 queue=ALL
200 AT_SETUP([ofproto - queue stats - (OpenFlow 1.2)])
202 AT_CHECK([ovs-ofctl -O OpenFlow12 -vwarn queue-stats br0], [0], [stdout])
203 AT_CHECK([STRIP_XIDS stdout], [0], [dnl
204 OFPST_QUEUE reply (OF1.2): 0 queues
206 AT_CHECK([ovs-ofctl -O OpenFlow12 -vwarn queue-stats br0 ALL 5], [0],
207 [OFPT_ERROR (OF1.2) (xid=0x2): OFPQOFC_BAD_QUEUE
208 OFPST_QUEUE request (OF1.2) (xid=0x2):port=ANY queue=5
210 AT_CHECK([ovs-ofctl -O OpenFlow12 -vwarn queue-stats br0 10], [0],
211 [OFPT_ERROR (OF1.2) (xid=0x2): OFPQOFC_BAD_PORT
212 OFPST_QUEUE request (OF1.2) (xid=0x2):port=10 queue=ALL
217 AT_SETUP([ofproto - queue stats - (OpenFlow 1.4)])
219 AT_CHECK([ovs-ofctl -O OpenFlow14 -vwarn queue-stats br0], [0], [stdout])
220 AT_CHECK([STRIP_XIDS stdout], [0], [dnl
221 OFPST_QUEUE reply (OF1.4): 0 queues
223 AT_CHECK([ovs-ofctl -O OpenFlow14 -vwarn queue-stats br0 ALL 5], [0],
224 [OFPT_ERROR (OF1.4) (xid=0x2): OFPQOFC_BAD_QUEUE
225 OFPST_QUEUE request (OF1.4) (xid=0x2):port=ANY queue=5
227 AT_CHECK([ovs-ofctl -O OpenFlow14 -vwarn queue-stats br0 10], [0],
228 [OFPT_ERROR (OF1.4) (xid=0x2): OFPQOFC_BAD_PORT
229 OFPST_QUEUE request (OF1.4) (xid=0x2):port=10 queue=ALL
234 dnl This is really bare-bones.
235 dnl It at least checks request and reply serialization and deserialization.
236 AT_SETUP([ofproto - queue configuration - (OpenFlow 1.0)])
238 ADD_OF_PORTS([br0], [1], [2])
239 AT_CHECK([ovs-ofctl queue-get-config br0 1], [0], [stdout])
240 AT_CHECK([STRIP_XIDS stdout], [0], [dnl
241 OFPT_QUEUE_GET_CONFIG_REPLY: port=1
243 AT_CHECK([ovs-ofctl queue-get-config br0 10], [0],
244 [OFPT_ERROR (xid=0x2): OFPQOFC_BAD_PORT
245 OFPT_QUEUE_GET_CONFIG_REQUEST (xid=0x2): port=10
250 AT_SETUP([ofproto - queue configuration - (OpenFlow 1.2)])
252 ADD_OF_PORTS([br0], [1], [2])
253 AT_CHECK([ovs-ofctl -O OpenFlow12 queue-get-config br0 1], [0], [stdout])
254 AT_CHECK([STRIP_XIDS stdout], [0], [dnl
255 OFPT_QUEUE_GET_CONFIG_REPLY (OF1.2): port=1
257 AT_CHECK([ovs-ofctl -O OpenFlow12 queue-get-config br0 10], [0],
258 [OFPT_ERROR (OF1.2) (xid=0x2): OFPQOFC_BAD_PORT
259 OFPT_QUEUE_GET_CONFIG_REQUEST (OF1.2) (xid=0x2): port=10
264 dnl This is really bare-bones.
265 dnl It at least checks request and reply serialization and deserialization.
266 dnl Actions definition listed in both supported formats (w/ actions=)
267 AT_SETUP([ofproto - no group support (OpenFlow 1.0)])
269 AT_DATA([groups.txt], [dnl
270 group_id=1234,type=all,bucket=output:10
271 group_id=1235,type=all,bucket=actions=output:10
273 AT_DATA([stderr], [dnl
274 ovs-ofctl: none of the usable flow formats (OXM,OpenFlow11) is among the allowed flow formats (OpenFlow10,NXM)
276 AT_CHECK([ovs-ofctl -O OpenFlow10 -vwarn add-groups br0 groups.txt], [1], ,[stderr])
277 AT_CHECK([ovs-ofctl -O OpenFlow10 -vwarn mod-group br0 'group_id=1234,type=all,bucket=output:10'], [1], ,[stderr])
278 AT_CHECK([ovs-ofctl -O OpenFlow10 -vwarn del-groups br0], [1], ,[stderr])
279 AT_CHECK([ovs-ofctl -O OpenFlow10 -vwarn dump-groups br0 ], [1], ,[stderr])
283 dnl This is really bare-bones.
284 dnl It at least checks request and reply serialization and deserialization.
285 dnl Actions definition listed in both supported formats (w/ actions=)
286 AT_SETUP([ofproto - del group (OpenFlow 1.1)])
288 AT_DATA([groups.txt], [dnl
289 group_id=1234,type=all,bucket=output:10
290 group_id=1235,type=all,bucket=actions=output:10
292 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn add-groups br0 groups.txt])
293 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn dump-groups br0 ], [0], [stdout])
294 AT_CHECK([STRIP_XIDS stdout], [0], [dnl
295 OFPST_GROUP_DESC reply (OF1.1):
296 group_id=1234,type=all,bucket=actions=output:10
297 group_id=1235,type=all,bucket=actions=output:10
299 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn del-groups br0 group_id=1234])
300 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn dump-groups br0], [0], [stdout])
301 AT_CHECK([STRIP_XIDS stdout], [0], [dnl
302 OFPST_GROUP_DESC reply (OF1.1):
303 group_id=1235,type=all,bucket=actions=output:10
305 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn del-groups br0 group_id=1234])
306 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn dump-groups br0], [0], [stdout])
307 AT_CHECK([STRIP_XIDS stdout], [0], [dnl
308 OFPST_GROUP_DESC reply (OF1.1):
309 group_id=1235,type=all,bucket=actions=output:10
311 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn del-groups br0], [0])
312 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn dump-groups br0], [0], [stdout])
313 AT_CHECK([STRIP_XIDS stdout], [0], [dnl
314 OFPST_GROUP_DESC reply (OF1.1):
318 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn del-groups br0 group_id=0xfffffff0],
319 [1], [], [ovs-ofctl: invalid group id 4294967280
324 dnl This is really bare-bones.
325 dnl It at least checks request and reply serialization and deserialization.
326 dnl Actions definition listed in both supported formats (w/ actions=)
327 AT_SETUP([ofproto - add indirect group])
329 dnl indirect group must have exactly one bucket
330 AT_DATA([stderr], [dnl
331 OFPT_ERROR (OF1.1) (xid=0x2): OFPGMFC_INVALID_GROUP
332 OFPT_GROUP_MOD (OF1.1) (xid=0x2): ***decode error: OFPGMFC_INVALID_GROUP***
334 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn add-group br0 'group_id=1234,type=indirect'], [1], , [stderr])
335 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn add-group br0 'group_id=1235,type=indirect,bucket=output:10'])
336 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn add-group br0 'group_id=1236,type=indirect,bucket=output:10,bucket=output:11'], [1], , [stderr])
340 dnl This is really bare-bones.
341 dnl It at least checks request and reply serialization and deserialization.
342 dnl Actions definition listed in both supported formats (w/ actions=)
343 AT_SETUP([ofproto - del group (OpenFlow 1.5)])
345 AT_DATA([groups.txt], [dnl
346 group_id=1233,type=select,selection_method=hash,bucket=output:10,bucket=output:11
347 group_id=1234,type=select,selection_method=hash,fields(eth_dst,ip_dst,tcp_dst),bucket=output:10,bucket=output:11
348 group_id=1235,type=all,bucket=actions=output:12,bucket=bucket_id:0,actions=output:10,bucket=bucket_id:1,actions=output:11
350 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn add-groups br0 groups.txt])
351 AT_CHECK([ovs-ofctl -F OXM-OpenFlow15 -O OpenFlow15 -vwarn dump-groups br0 1234], [0], [stdout])
352 AT_CHECK([STRIP_XIDS stdout], [0], [dnl
353 OFPST_GROUP_DESC reply (OF1.5):
354 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
356 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn del-groups br0 group_id=1234])
357 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn dump-groups br0], [0], [stdout])
358 AT_CHECK([STRIP_XIDS stdout], [0], [dnl
359 OFPST_GROUP_DESC reply (OF1.5):
360 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
361 group_id=1233,type=select,selection_method=hash,bucket=bucket_id:0,actions=output:10,bucket=bucket_id:1,actions=output:11
363 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn del-groups br0 group_id=1234])
364 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn dump-groups br0], [0], [stdout])
365 AT_CHECK([STRIP_XIDS stdout], [0], [dnl
366 OFPST_GROUP_DESC reply (OF1.5):
367 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
368 group_id=1233,type=select,selection_method=hash,bucket=bucket_id:0,actions=output:10,bucket=bucket_id:1,actions=output:11
370 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn del-groups br0], [0])
371 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn dump-groups br0], [0], [stdout])
372 AT_CHECK([STRIP_XIDS stdout], [0], [dnl
373 OFPST_GROUP_DESC reply (OF1.5):
378 dnl This is really bare-bones.
379 dnl It at least checks request and reply serialization and deserialization.
380 AT_SETUP([ofproto - del group deletes flows])
382 AT_DATA([groups.txt], [dnl
383 group_id=1234,type=all,bucket=output:10
384 group_id=1235,type=all,bucket=output:10
386 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn add-groups br0 groups.txt])
387 AT_DATA([flows.txt], [dnl
388 tcp actions=group:1234
389 udp actions=group:1235
391 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn add-flows br0 flows.txt])
392 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn dump-flows br0 | ofctl_strip | sort],
394 tcp actions=group:1234
395 udp actions=group:1235
396 OFPST_FLOW reply (OF1.1):
398 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn del-groups br0 group_id=1234])
399 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn dump-flows br0 | ofctl_strip | sort],
401 udp actions=group:1235
402 OFPST_FLOW reply (OF1.1):
404 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn del-groups br0 group_id=1234])
405 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn dump-flows br0 | ofctl_strip | sort],
407 udp actions=group:1235
408 OFPST_FLOW reply (OF1.1):
410 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn del-groups br0])
411 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn dump-flows br0 | ofctl_strip | sort],
413 OFPST_FLOW reply (OF1.1):
418 dnl This is really bare-bones.
419 dnl It at least checks request and reply serialization and deserialization.
420 dnl Actions definition listed in both supported formats (w/ actions=)
421 AT_SETUP([ofproto - insert buckets])
423 # Add group with no buckets.
424 AT_DATA([groups.txt], [dnl
425 group_id=1234,type=all
427 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn add-groups br0 groups.txt])
428 AT_CHECK([ovs-ofctl -F OXM-OpenFlow15 -O OpenFlow15 -vwarn dump-groups br0 1234], [0], [stdout])
429 AT_CHECK([STRIP_XIDS stdout], [0], [dnl
430 OFPST_GROUP_DESC reply (OF1.5):
431 group_id=1234,type=all
434 # Add two buckets, using "last".
435 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])
436 AT_CHECK([ovs-ofctl -F OXM-OpenFlow15 -O OpenFlow15 -vwarn dump-groups br0 1234], [0], [stdout])
437 AT_CHECK([STRIP_XIDS stdout], [0], [dnl
438 OFPST_GROUP_DESC reply (OF1.5):
439 group_id=1234,type=all,bucket=bucket_id:10,actions=output:10,bucket=bucket_id:11,actions=output:11
442 # Start over again, then add two buckets using "first".
443 AT_CHECK([ovs-ofctl -O OpenFlow15 --strict del-groups br0 group_id=1234])
444 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn add-group br0 group_id=1234,type=all])
445 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])
446 AT_CHECK([ovs-ofctl -F OXM-OpenFlow15 -O OpenFlow15 -vwarn dump-groups br0 1234], [0], [stdout])
447 AT_CHECK([STRIP_XIDS stdout], [0], [dnl
448 OFPST_GROUP_DESC reply (OF1.5):
449 group_id=1234,type=all,bucket=bucket_id:10,actions=output:10,bucket=bucket_id:11,actions=output:11
452 # Add two more buckets before the existing ones.
453 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])
454 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn dump-groups br0], [0], [stdout])
455 AT_CHECK([STRIP_XIDS stdout], [0], [dnl
456 OFPST_GROUP_DESC reply (OF1.5):
457 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
460 # Add another bucket at the end.
461 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])
462 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn dump-groups br0], [0], [stdout])
463 AT_CHECK([STRIP_XIDS stdout], [0], [dnl
464 OFPST_GROUP_DESC reply (OF1.5):
465 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
468 # Verify that duplicate bucket IDs are rejected.
469 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])
470 AT_CHECK([STRIP_XIDS stderr | sed '/truncated/,$d'], [0], [dnl
471 OFPT_ERROR (OF1.5): OFPGMFC_BUCKET_EXISTS
472 OFPT_GROUP_MOD (OF1.5):
476 # Add another bucket just before bucket 15.
477 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn insert-buckets br0 group_id=1234,command_bucket_id=15])
478 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn dump-groups br0], [0], [stdout])
479 AT_CHECK([STRIP_XIDS stdout], [0], [dnl
480 OFPST_GROUP_DESC reply (OF1.5):
481 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
484 # Add two more buckets just before bucket 11,
485 # getting the command from a file.
486 AT_DATA([buckets.txt], [dnl
487 group_id=1234,command_bucket_id=11,bucket=bucket_id:12,actions=output:12,bucket=bucket_id:13,actions=output:13
489 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn insert-buckets br0 - < buckets.txt])
490 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn dump-groups br0], [0], [stdout])
491 AT_CHECK([STRIP_XIDS stdout], [0], [dnl
492 OFPST_GROUP_DESC reply (OF1.5):
493 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
496 # Add yet two more buckets.
497 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])
498 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn dump-groups br0], [0], [stdout])
499 AT_CHECK([STRIP_XIDS stdout], [0], [dnl
500 OFPST_GROUP_DESC reply (OF1.5):
501 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
505 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], [],
506 [ovs-ofctl: invalid command bucket id 4294967041
508 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], [],
509 [ovs-ofctl: insert-bucket needs OpenFlow 1.5 or later ('-O OpenFlow15')
514 dnl This is really bare-bones.
515 dnl It at least checks request and reply serialization and deserialization.
516 dnl Actions definition listed in both supported formats (w/ actions=)
517 AT_SETUP([ofproto - remove buckets])
519 AT_DATA([groups.txt], [dnl
520 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
522 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn add-groups br0 groups.txt])
523 AT_CHECK([ovs-ofctl -F OXM-OpenFlow15 -O OpenFlow15 -vwarn dump-groups br0 1234], [0], [stdout])
524 AT_CHECK([STRIP_XIDS stdout], [0], [dnl
525 OFPST_GROUP_DESC reply (OF1.5):
526 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
528 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn remove-buckets br0 group_id=1234,command_bucket_id=first])
529 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn dump-groups br0], [0], [stdout])
530 AT_CHECK([STRIP_XIDS stdout], [0], [dnl
531 OFPST_GROUP_DESC reply (OF1.5):
532 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
534 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn remove-buckets br0 group_id=1234,command_bucket_id=last])
535 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn dump-groups br0], [0], [stdout])
536 AT_CHECK([STRIP_XIDS stdout], [0], [dnl
537 OFPST_GROUP_DESC reply (OF1.5):
538 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
540 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn remove-buckets br0 group_id=1234,command_bucket_id=13])
541 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn dump-groups br0], [0], [stdout])
542 AT_CHECK([STRIP_XIDS stdout], [0], [dnl
543 OFPST_GROUP_DESC reply (OF1.5):
544 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
546 AT_DATA([buckets.txt], [dnl
549 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn remove-buckets br0 - < buckets.txt])
550 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn dump-groups br0], [0], [stdout])
551 AT_CHECK([STRIP_XIDS stdout], [0], [dnl
552 OFPST_GROUP_DESC reply (OF1.5):
553 group_id=1234,type=all
555 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn remove-buckets br0 group_id=1234,command_bucket_id=first])
556 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn remove-buckets br0 group_id=1234,command_bucket_id=last])
557 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn remove-buckets br0 group_id=1234,command_bucket_id=all])
558 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn remove-buckets br0 group_id=1234,command_bucket_id=1], [1], [], [stderr])
559 AT_CHECK([cat stderr | ofctl_strip], [0], [dnl
560 OFPT_ERROR (OF1.5): OFPGMFC_UNKNOWN_BUCKET
561 OFPT_GROUP_MOD (OF1.5):
562 REMOVE_BUCKET command_bucket_id:1,group_id=1234
565 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn remove-buckets br0 group_id=1234,command_bucket_id=last], [1], [],
566 [ovs-ofctl: remove-bucket needs OpenFlow 1.5 or later ('-O OpenFlow15')
571 dnl This is really bare-bones.
572 dnl It at least checks request and reply serialization and deserialization.
573 AT_SETUP([ofproto - flow mod checks group availability])
575 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn add-group br0 group_id=1234,type=all,bucket=output:10])
576 AT_DATA([flows.txt], [dnl
577 tcp actions=group:1234
578 udp actions=group:1235
580 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn add-flow br0 'tcp actions=group:1234'])
581 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn add-flow br0 'tcp actions=group:1235'], [1], [], [stderr])
583 # The output should look like this:
585 # 00000000 02 0e 00 98 00 00 00 02-00 00 00 00 00 00 00 00 |................|
586 # 00000010 00 00 00 00 00 00 00 00-ff 00 00 00 00 00 80 00 |................|
587 # 00000020 ff ff ff ff ff ff ff ff-ff ff ff ff 00 00 00 00 |................|
588 # 00000030 00 00 00 58 00 00 00 00-00 00 03 d7 00 00 00 00 |...X............|
590 # This 'sed' command captures the error message but drops details.
591 AT_CHECK([sed '/truncated/d
592 /^000000.0/d' stderr | STRIP_XIDS], [0],
593 [OFPT_ERROR (OF1.1): OFPBAC_BAD_OUT_GROUP
594 OFPT_FLOW_MOD (OF1.1):
599 dnl This is really bare-bones.
600 dnl It at least checks request and reply serialization and deserialization.
601 AT_SETUP([ofproto - group description])
603 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn add-group br0 group_id=1234,type=all,bucket=output:10], [0], [stdout])
604 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn dump-groups br0], [0], [stdout])
605 AT_CHECK([STRIP_XIDS stdout], [0], [dnl
606 OFPST_GROUP_DESC reply (OF1.1):
607 group_id=1234,type=all,bucket=actions=output:10
612 dnl This is really bare-bones.
613 dnl It at least checks request and reply serialization and deserialization.
614 AT_SETUP([ofproto - group description])
616 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn add-group br0 group_id=1234,type=all,bucket=output:10])
617 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn dump-groups br0], [0], [stdout])
618 AT_CHECK([STRIP_XIDS stdout], [0], [dnl
619 OFPST_GROUP_DESC reply (OF1.1):
620 group_id=1234,type=all,bucket=actions=output:10
625 dnl This is really bare-bones.
626 dnl It at least checks request and reply serialization and deserialization.
627 AT_SETUP([ofproto - group features])
629 AT_CHECK([ovs-ofctl -O OpenFlow12 -vwarn dump-group-features br0], [0], [stdout])
630 AT_CHECK([STRIP_XIDS stdout], [0], [dnl
631 OFPST_GROUP_FEATURES reply (OF1.2):
636 max_groups=0xffffff00
637 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
639 max_groups=0xffffff00
640 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
642 max_groups=0xffffff00
643 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
645 max_groups=0xffffff00
646 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
651 dnl This is really bare-bones.
652 dnl It at least checks request and reply serialization and deserialization.
653 AT_SETUP([ofproto - group stats (OpenFlow 1.1)])
655 AT_DATA([groups.txt], [dnl
656 group_id=1234,type=all,bucket=output:10
657 group_id=1235,type=all,bucket=output:10
659 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn add-groups br0 groups.txt])
660 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn add-flow br0 'tcp actions=group:1234'])
661 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn dump-group-stats br0 group_id=1234], [0], [stdout])
662 AT_CHECK([STRIP_XIDS stdout | sort], [0], [dnl
663 group_id=1234,ref_count=1,packet_count=0,byte_count=0,bucket0:packet_count=0,byte_count=0
664 OFPST_GROUP reply (OF1.1):
666 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn dump-group-stats br0], [0], [stdout])
667 AT_CHECK([STRIP_XIDS stdout | sort], [0], [dnl
668 group_id=1234,ref_count=1,packet_count=0,byte_count=0,bucket0:packet_count=0,byte_count=0
669 group_id=1235,ref_count=0,packet_count=0,byte_count=0,bucket0:packet_count=0,byte_count=0
670 OFPST_GROUP reply (OF1.1):
675 dnl This is really bare-bones.
676 dnl It at least checks request and reply serialization and deserialization.
677 AT_SETUP([ofproto - group stats (OpenFlow 1.3)])
679 AT_DATA([groups.txt], [dnl
680 group_id=1234,type=all,bucket=output:10
681 group_id=1235,type=all,bucket=output:10
683 AT_CHECK([ovs-ofctl -O OpenFlow13 -vwarn add-groups br0 groups.txt])
684 AT_CHECK([ovs-ofctl -O OpenFlow13 -vwarn add-flow br0 'tcp actions=group:1234'])
685 AT_CHECK([ovs-ofctl -O OpenFlow13 -vwarn dump-group-stats br0 group_id=1234], [0], [stdout])
686 AT_CHECK([STRIP_XIDS stdout | sed 's/duration=[[0-9.]]*s/duration=?s/' | sort], [0], [dnl
687 group_id=1234,duration=?s,ref_count=1,packet_count=0,byte_count=0,bucket0:packet_count=0,byte_count=0
688 OFPST_GROUP reply (OF1.3):
690 AT_CHECK([ovs-ofctl -O OpenFlow13 -vwarn dump-group-stats br0], [0], [stdout])
691 AT_CHECK([STRIP_XIDS stdout | sed 's/duration=[[0-9.]]*s/duration=?s/' | sort], [0], [dnl
692 group_id=1234,duration=?s,ref_count=1,packet_count=0,byte_count=0,bucket0:packet_count=0,byte_count=0
693 group_id=1235,duration=?s,ref_count=0,packet_count=0,byte_count=0,bucket0:packet_count=0,byte_count=0
694 OFPST_GROUP reply (OF1.3):
699 dnl This is really bare-bones.
700 dnl It at least checks request and reply serialization and deserialization.
701 AT_SETUP([ofproto - group stats (OpenFlow 1.5)])
703 AT_DATA([groups.txt], [dnl
704 group_id=1234,type=all,bucket=output:10
705 group_id=1235,type=all,bucket=output:10
707 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn add-groups br0 groups.txt])
708 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn add-flow br0 'tcp actions=group:1234'])
709 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn dump-group-stats br0 group_id=1234], [0], [stdout])
710 AT_CHECK([STRIP_XIDS stdout | sed 's/duration=[[0-9.]]*s/duration=?s/' | sort], [0], [dnl
711 group_id=1234,duration=?s,ref_count=1,packet_count=0,byte_count=0,bucket0:packet_count=0,byte_count=0
712 OFPST_GROUP reply (OF1.5):
714 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn dump-group-stats br0], [0], [stdout])
715 AT_CHECK([STRIP_XIDS stdout | sed 's/duration=[[0-9.]]*s/duration=?s/' | sort], [0], [dnl
716 group_id=1234,duration=?s,ref_count=1,packet_count=0,byte_count=0,bucket0:packet_count=0,byte_count=0
717 group_id=1235,duration=?s,ref_count=0,packet_count=0,byte_count=0,bucket0:packet_count=0,byte_count=0
718 OFPST_GROUP reply (OF1.5):
723 dnl This found a use-after-free error in bridge destruction in the
724 dnl presence of groups.
725 AT_SETUP([ofproto - group add then bridge delete (OpenFlow 1.3)])
727 AT_DATA([groups.txt], [dnl
728 group_id=1234,type=all,bucket=output:10
729 group_id=1235,type=all,bucket=output:10
731 AT_CHECK([ovs-ofctl -O OpenFlow13 -vwarn add-groups br0 groups.txt])
732 AT_CHECK([ovs-vsctl del-br br0])
736 AT_SETUP([ofproto - mod-port (OpenFlow 1.0)])
738 for command_config_state in \
740 'noflood NO_FLOOD 0' \
741 'down PORT_DOWN,NO_FLOOD LINK_DOWN' \
742 'flood PORT_DOWN LINK_DOWN' \
743 'no-receive PORT_DOWN,NO_RECV LINK_DOWN' \
744 'no-forward PORT_DOWN,NO_RECV,NO_FWD LINK_DOWN' \
745 'no-packet-in PORT_DOWN,NO_RECV,NO_FWD,NO_PACKET_IN LINK_DOWN' \
746 'forward PORT_DOWN,NO_RECV,NO_PACKET_IN LINK_DOWN' \
747 'packet-in PORT_DOWN,NO_RECV LINK_DOWN' \
751 set $command_config_state
752 command=$[1] config=`echo $[2] | sed 's/,/ /g'` state=$[3]
753 AT_CHECK([ovs-ofctl -vwarn mod-port br0 br0 $command])
754 AT_CHECK([ovs-ofctl -vwarn show br0], [0], [stdout])
755 AT_CHECK_UNQUOTED([STRIP_XIDS stdout], [0], [dnl
756 OFPT_FEATURES_REPLY: dpid:fedcba9876543210
757 n_tables:254, n_buffers:256
758 capabilities: FLOW_STATS TABLE_STATS PORT_STATS QUEUE_STATS ARP_MATCH_IP
759 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
760 LOCAL(br0): addr:aa:55:aa:55:00:00
763 speed: 0 Mbps now, 0 Mbps max
764 OFPT_GET_CONFIG_REPLY: frags=normal miss_send_len=0
770 AT_SETUP([ofproto - mod-port (OpenFlow 1.2)])
772 for command_config_state in \
774 'down PORT_DOWN LINK_DOWN' \
775 'no-receive PORT_DOWN,NO_RECV LINK_DOWN' \
776 'no-forward PORT_DOWN,NO_RECV,NO_FWD LINK_DOWN' \
777 'no-packet-in PORT_DOWN,NO_RECV,NO_FWD,NO_PACKET_IN LINK_DOWN' \
778 'forward PORT_DOWN,NO_RECV,NO_PACKET_IN LINK_DOWN' \
779 'packet-in PORT_DOWN,NO_RECV LINK_DOWN' \
783 set $command_config_state
784 command=$[1] config=`echo $[2] | sed 's/,/ /g'` state=$[3]
785 AT_CHECK([ovs-ofctl -O OpenFlow12 -vwarn mod-port br0 br0 $command])
786 AT_CHECK([ovs-ofctl -O OpenFlow12 -vwarn show br0], [0], [stdout])
787 AT_CHECK_UNQUOTED([STRIP_XIDS stdout], [0], [dnl
788 OFPT_FEATURES_REPLY (OF1.2): dpid:fedcba9876543210
789 n_tables:254, n_buffers:256
790 capabilities: FLOW_STATS TABLE_STATS PORT_STATS GROUP_STATS QUEUE_STATS
791 LOCAL(br0): addr:aa:55:aa:55:00:00
794 speed: 0 Mbps now, 0 Mbps max
795 OFPT_GET_CONFIG_REPLY (OF1.2): frags=normal miss_send_len=0
801 AT_SETUP([ofproto - mod-port (OpenFlow 1.4)])
803 for command_config_state in \
805 'down PORT_DOWN LINK_DOWN' \
806 'no-receive PORT_DOWN,NO_RECV LINK_DOWN' \
807 'no-forward PORT_DOWN,NO_RECV,NO_FWD LINK_DOWN' \
808 'no-packet-in PORT_DOWN,NO_RECV,NO_FWD,NO_PACKET_IN LINK_DOWN' \
809 'forward PORT_DOWN,NO_RECV,NO_PACKET_IN LINK_DOWN' \
810 'packet-in PORT_DOWN,NO_RECV LINK_DOWN' \
814 set $command_config_state
815 command=$[1] config=`echo $[2] | sed 's/,/ /g'` state=$[3]
816 AT_CHECK([ovs-ofctl -O OpenFlow14 -vwarn mod-port br0 br0 $command])
817 AT_CHECK([ovs-ofctl -O OpenFlow14 -vwarn show br0], [0], [stdout])
818 AT_CHECK_UNQUOTED([STRIP_XIDS stdout], [0], [dnl
819 OFPT_FEATURES_REPLY (OF1.4): dpid:fedcba9876543210
820 n_tables:254, n_buffers:256
821 capabilities: FLOW_STATS TABLE_STATS PORT_STATS GROUP_STATS QUEUE_STATS
822 OFPST_PORT_DESC reply (OF1.4):
823 LOCAL(br0): addr:aa:55:aa:55:00:00
826 speed: 0 Mbps now, 0 Mbps max
827 OFPT_GET_CONFIG_REPLY (OF1.4): frags=normal miss_send_len=0
833 AT_SETUP([ofproto - basic flow_mod commands (NXM)])
835 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip], [0], [NXST_FLOW reply:
837 AT_CHECK([echo 'in_port=2,actions=1' | ovs-ofctl add-flows br0 -])
838 AT_CHECK([ovs-ofctl add-flow br0 in_port=1,actions=2])
839 AT_CHECK([ovs-ofctl -F nxm add-flow br0 table=1,in_port=4,actions=3])
840 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
841 in_port=1 actions=output:2
842 in_port=2 actions=output:1
843 table=1, in_port=4 actions=output:3
846 AT_CHECK([ovs-ofctl dump-aggregate br0 table=0 | STRIP_XIDS], [0], [dnl
847 NXST_AGGREGATE reply: packet_count=0 byte_count=0 flow_count=2
849 AT_CHECK([ovs-ofctl del-flows br0])
850 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip], [0], [NXST_FLOW reply:
855 AT_SETUP([ofproto - basic flow_mod commands (OpenFlow 1.0)])
857 AT_CHECK([ovs-ofctl -F openflow10 dump-flows br0 | ofctl_strip], [0], [OFPST_FLOW reply:
859 AT_CHECK([echo 'in_port=2,actions=1' | ovs-ofctl -F openflow10 add-flows br0 -])
860 AT_CHECK([ovs-ofctl -F openflow10 add-flow br0 in_port=1,actions=2])
861 AT_CHECK([ovs-ofctl -F openflow10 add-flow br0 table=1,in_port=4,actions=3])
862 AT_CHECK([ovs-ofctl -F openflow10 dump-flows br0 | ofctl_strip | sort], [0], [dnl
863 in_port=1 actions=output:2
864 in_port=2 actions=output:1
865 table=1, in_port=4 actions=output:3
868 AT_CHECK([ovs-ofctl -F openflow10 dump-aggregate br0 table=0 | STRIP_XIDS], [0], [dnl
869 OFPST_AGGREGATE reply: packet_count=0 byte_count=0 flow_count=2
871 AT_CHECK([ovs-ofctl -F openflow10 del-flows br0])
872 AT_CHECK([ovs-ofctl -F openflow10 dump-flows br0 | ofctl_strip], [0], [OFPST_FLOW reply:
877 # It's really dumb that check_overlap and reset_counts are considered
878 # part of flow state, but OpenFlow implies that it is, and OFTest and
879 # some users insist on it.
880 AT_SETUP([ofproto - add-flow and flags])
882 AT_CHECK([ovs-ofctl -F openflow10 add-flow br0 check_overlap,in_port=1,actions=drop])
883 # Prior to OF1.3, flow dumps didn't include a "flags" field.
884 AT_CHECK([ovs-ofctl -F openflow10 dump-flows br0 | ofctl_strip], [0], [dnl
886 in_port=1 actions=drop
888 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip], [0], [dnl
889 OFPST_FLOW reply (OF1.1):
890 in_port=1 actions=drop
892 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip], [0], [dnl
893 OFPST_FLOW reply (OF1.2):
894 in_port=1 actions=drop
896 # OF1.3 makes the flags visible.
897 AT_CHECK([ovs-ofctl -O OpenFlow13 dump-flows br0 | ofctl_strip], [0], [dnl
898 OFPST_FLOW reply (OF1.3):
899 check_overlap reset_counts in_port=1 actions=drop
901 AT_CHECK([ovs-ofctl -O OpenFlow14 dump-flows br0 | ofctl_strip], [0], [dnl
902 OFPST_FLOW reply (OF1.4):
903 check_overlap reset_counts in_port=1 actions=drop
905 AT_CHECK([ovs-ofctl -O OpenFlow15 dump-flows br0 | ofctl_strip], [0], [dnl
906 OFPST_FLOW reply (OF1.5):
907 check_overlap reset_counts in_port=1 actions=drop
912 AT_SETUP([ofproto - basic flow_mod commands (OpenFlow 1.1)])
914 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip], [0], [OFPST_FLOW reply (OF1.1):
916 AT_CHECK([echo 'in_port=2,actions=1' | ovs-ofctl -O OpenFlow11 add-flows br0 -])
917 AT_CHECK([ovs-ofctl -O OpenFlow11 add-flow br0 in_port=1,actions=2])
918 AT_CHECK([ovs-ofctl -O OpenFlow11 add-flow br0 table=1,in_port=4,actions=3])
919 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0], [dnl
920 in_port=1 actions=output:2
921 in_port=2 actions=output:1
922 table=1, in_port=4 actions=output:3
923 OFPST_FLOW reply (OF1.1):
925 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-aggregate br0 table=0 | STRIP_XIDS], [0], [dnl
926 OFPST_AGGREGATE reply (OF1.1): packet_count=0 byte_count=0 flow_count=2
928 AT_CHECK([ovs-ofctl -O OpenFlow11 del-flows br0])
929 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip], [0], [OFPST_FLOW reply (OF1.1):
930 table=1, in_port=4 actions=output:3
935 AT_SETUP([ofproto - flow_mod negative test (OpenFlow 1.1)])
937 [set bridge br0 protocols=OpenFlow10,OpenFlow11,OpenFlow12,OpenFlow13])
938 AT_CHECK([ovs-ofctl add-flow -O OpenFlow11 br0 table=1,action=goto_table:2])
940 # The error message here actually comes from ovs-ofctl, not from ovs-vswitchd,
941 # but at least it's the same code in ofpacts_check() that issues the error.
942 AT_CHECK([ovs-ofctl add-flow -O OpenFlow11 br0 table=1,action=goto_table:1],
944 [ovs-ofctl: actions are invalid with specified match (OFPBIC_BAD_TABLE_ID)
949 AT_SETUP([ofproto - set-field flow_mod commands (NXM)])
951 AT_CHECK([ovs-ofctl add-flow br0 ipv6,table=1,in_port=3,actions=drop])
952 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])
953 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])
954 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
955 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[[]]
956 table=1, ipv6,in_port=3 actions=load:0xa6badbfffefe59fa->NXM_NX_IPV6_SRC[[0..63]],load:0xfe8001234567890a->NXM_NX_IPV6_SRC[[64..127]]
962 AT_SETUP([ofproto - basic flow_mod commands (OpenFlow 1.2)])
964 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip], [0], [OFPST_FLOW reply (OF1.2):
966 AT_CHECK([echo 'in_port=2,actions=1' | ovs-ofctl -O OpenFlow12 add-flows br0 -])
967 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 in_port=1,actions=2])
968 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 table=1,in_port=4,actions=3])
969 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
970 in_port=1 actions=output:2
971 in_port=2 actions=output:1
972 table=1, in_port=4 actions=output:3
973 OFPST_FLOW reply (OF1.2):
975 AT_CHECK([ovs-ofctl -O OpenFlow12 del-flows br0])
976 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip], [0], [OFPST_FLOW reply (OF1.2):
981 AT_SETUP([ofproto - set-field flow_mod commands (OF1.2)])
983 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 ipv6,table=1,in_port=3,actions=drop])
984 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])
985 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])
986 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
987 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
988 table=1, ipv6,in_port=3 actions=set_field:fe80:123:4567:890a:a6ba:dbff:fefe:59fa->ipv6_src
989 OFPST_FLOW reply (OF1.2):
994 AT_SETUP([ofproto - dump flows with cookie])
996 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x1,in_port=1,actions=1])
997 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x2,in_port=2,actions=1])
998 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x3,in_port=3,actions=1])
999 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1000 cookie=0x1, in_port=1 actions=output:1
1001 cookie=0x2, in_port=2 actions=output:1
1002 cookie=0x3, in_port=3 actions=output:1
1005 AT_CHECK([ovs-ofctl dump-aggregate br0 table=0 | STRIP_XIDS], [0], [dnl
1006 NXST_AGGREGATE reply: packet_count=0 byte_count=0 flow_count=3
1008 AT_CHECK([ovs-ofctl dump-flows br0 cookie=0x3/-1 | ofctl_strip | sort], [0], [dnl
1009 cookie=0x3, in_port=3 actions=output:1
1012 AT_CHECK([ovs-ofctl dump-aggregate br0 cookie=0x3/-1 | STRIP_XIDS], [0], [dnl
1013 NXST_AGGREGATE reply: packet_count=0 byte_count=0 flow_count=1
1018 AT_SETUP([ofproto - mod flow with cookie change (OpenFlow 1.0)])
1020 AT_CHECK([ovs-ofctl -F openflow10 add-flow br0 cookie=0x1,in_port=1,actions=1])
1021 AT_CHECK([ovs-ofctl -F openflow10 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1022 cookie=0x1, in_port=1 actions=output:1
1026 AT_CHECK([ovs-ofctl -F openflow10 mod-flows br0 cookie=0x2,in_port=1,actions=1])
1027 AT_CHECK([ovs-ofctl -F openflow10 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1028 cookie=0x2, in_port=1 actions=output:1
1034 AT_SETUP([ofproto - mod flow with cookie change (NXM)])
1036 AT_CHECK([ovs-ofctl -F nxm add-flow br0 cookie=0x1,in_port=1,actions=1])
1037 AT_CHECK([ovs-ofctl -F nxm dump-flows br0 | ofctl_strip | sort], [0], [dnl
1038 cookie=0x1, in_port=1 actions=output:1
1042 AT_CHECK([ovs-ofctl -F nxm mod-flows br0 cookie=0x2,in_port=1,actions=1])
1043 AT_CHECK([ovs-ofctl -F nxm dump-flows br0 | ofctl_strip | sort], [0], [dnl
1044 cookie=0x2, in_port=1 actions=output:1
1050 AT_SETUP([ofproto - no mod flow with cookie change (OpenFlow 1.1)])
1052 AT_CHECK([ovs-ofctl -O OpenFlow11 add-flow br0 cookie=0x1,in_port=1,actions=1])
1053 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1054 cookie=0x1, in_port=1 actions=output:1
1055 OFPST_FLOW reply (OF1.1):
1057 AT_CHECK([ovs-ofctl -O OpenFlow11 mod-flows br0 cookie=0x2,in_port=1,actions=1])
1058 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1059 cookie=0x1, in_port=1 actions=output:1
1060 OFPST_FLOW reply (OF1.1):
1065 dnl The OpenFlow 1.2 spec states that the cookie may not be modified
1066 AT_SETUP([ofproto - no mod flow with cookie change (OpenFlow 1.2)])
1068 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 cookie=0x1,in_port=1,actions=1])
1069 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1070 cookie=0x1, in_port=1 actions=output:1
1071 OFPST_FLOW reply (OF1.2):
1074 AT_CHECK([ovs-ofctl -O OpenFlow12 mod-flows br0 cookie=0x2,in_port=1,actions=1])
1075 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1076 cookie=0x1, in_port=1 actions=output:1
1077 OFPST_FLOW reply (OF1.2):
1082 AT_SETUP([ofproto - mod flows based on cookie mask (OpenFlow 1.0)])
1084 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x1,in_port=1,actions=1])
1085 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x1,in_port=2,actions=1])
1086 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x2,in_port=3,actions=1])
1087 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1088 cookie=0x1, in_port=1 actions=output:1
1089 cookie=0x1, in_port=2 actions=output:1
1090 cookie=0x2, in_port=3 actions=output:1
1094 AT_CHECK([ovs-ofctl -F nxm mod-flows br0 cookie=0x1/0xff,actions=4])
1095 AT_CHECK([ovs-ofctl -F nxm dump-flows br0 | ofctl_strip | sort], [0], [dnl
1096 cookie=0x1, in_port=1 actions=output:4
1097 cookie=0x1, in_port=2 actions=output:4
1098 cookie=0x2, in_port=3 actions=output:1
1104 AT_SETUP([ofproto - mod flows based on cookie mask (OpenFlow 1.1)])
1106 AT_CHECK([ovs-ofctl -O OpenFlow11 add-flow br0 cookie=0x1,in_port=1,actions=1])
1107 AT_CHECK([ovs-ofctl -O OpenFlow11 add-flow br0 cookie=0x1,in_port=2,actions=1])
1108 AT_CHECK([ovs-ofctl -O OpenFlow11 add-flow br0 cookie=0x2,in_port=3,actions=1])
1109 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1110 cookie=0x1, in_port=1 actions=output:1
1111 cookie=0x1, in_port=2 actions=output:1
1112 cookie=0x2, in_port=3 actions=output:1
1113 OFPST_FLOW reply (OF1.1):
1116 AT_CHECK([ovs-ofctl -O OpenFlow11 mod-flows br0 cookie=0x1/0xff,actions=4])
1117 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1118 cookie=0x1, in_port=1 actions=output:4
1119 cookie=0x1, in_port=2 actions=output:4
1120 cookie=0x2, in_port=3 actions=output:1
1121 OFPST_FLOW reply (OF1.1):
1126 AT_SETUP([ofproto - mod flows based on cookie mask (OpenFlow 1.2)])
1128 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 cookie=0x1,in_port=1,actions=1])
1129 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 cookie=0x1,in_port=2,actions=1])
1130 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 cookie=0x2,in_port=3,actions=1])
1131 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1132 cookie=0x1, in_port=1 actions=output:1
1133 cookie=0x1, in_port=2 actions=output:1
1134 cookie=0x2, in_port=3 actions=output:1
1135 OFPST_FLOW reply (OF1.2):
1138 AT_CHECK([ovs-ofctl -O OpenFlow12 mod-flows br0 cookie=0x1/0xff,actions=4])
1139 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1140 cookie=0x1, in_port=1 actions=output:4
1141 cookie=0x1, in_port=2 actions=output:4
1142 cookie=0x2, in_port=3 actions=output:1
1143 OFPST_FLOW reply (OF1.2):
1148 dnl The OpenFlow 1.2 spec states that the cookie may not be modified
1149 AT_SETUP([ofproto - mod flows based on cookie mask with cookie change])
1151 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x1,in_port=1,actions=1])
1152 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x1,in_port=2,actions=1])
1153 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x2,in_port=3,actions=1])
1154 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1155 cookie=0x1, in_port=1 actions=output:1
1156 cookie=0x1, in_port=2 actions=output:1
1157 cookie=0x2, in_port=3 actions=output:1
1161 AT_CHECK([ovs-ofctl -F nxm mod-flows br0 cookie=1/-1,cookie=4,actions=4])
1162 AT_CHECK([ovs-ofctl -F nxm dump-flows br0 | ofctl_strip | sort], [0], [dnl
1163 cookie=0x2, in_port=3 actions=output:1
1164 cookie=0x4, in_port=1 actions=output:4
1165 cookie=0x4, in_port=2 actions=output:4
1171 AT_SETUP([ofproto - mod flow with cookie miss (mask==0) - NXM])
1173 AT_CHECK([ovs-ofctl -F nxm mod-flows br0 in_port=1,actions=1])
1174 AT_CHECK([ovs-ofctl -F nxm dump-flows br0 | ofctl_strip | sort], [0], [dnl
1175 in_port=1 actions=output:1
1181 AT_SETUP([ofproto - mod flow with cookie miss (mask==0) - OF1.1])
1183 AT_CHECK([ovs-ofctl -O openflow11 mod-flows br0 in_port=1,actions=1])
1184 AT_CHECK([ovs-ofctl -O openflow11 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1185 in_port=1 actions=output:1
1186 OFPST_FLOW reply (OF1.1):
1191 AT_SETUP([ofproto - mod flow with cookie miss (mask==0) - OF1.2])
1193 AT_CHECK([ovs-ofctl -O openflow12 mod-flows br0 in_port=1,actions=1])
1194 AT_CHECK([ovs-ofctl -O openflow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1195 OFPST_FLOW reply (OF1.2):
1200 AT_SETUP([ofproto - mod flow with cookie miss (mask!=0) - NXM])
1202 AT_CHECK([ovs-ofctl -F nxm mod-flows br0 cookie=1/1,in_port=1,actions=1])
1203 AT_CHECK([ovs-ofctl -F nxm dump-flows br0 | ofctl_strip | sort], [0], [dnl
1209 AT_SETUP([ofproto - mod flow with cookie miss (mask!=0) - OF1.1])
1211 AT_CHECK([ovs-ofctl -O openflow11 mod-flows br0 cookie=1/1,in_port=1,actions=1])
1212 AT_CHECK([ovs-ofctl -O openflow11 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1213 OFPST_FLOW reply (OF1.1):
1218 AT_SETUP([ofproto - mod flow with cookie miss (mask!=0) - OF1.2])
1220 AT_CHECK([ovs-ofctl -O openflow12 mod-flows br0 cookie=1/1,in_port=1,actions=1])
1221 AT_CHECK([ovs-ofctl -O openflow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1222 OFPST_FLOW reply (OF1.2):
1227 AT_SETUP([ofproto - del flows with cookies])
1229 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x1,in_port=1,actions=1])
1230 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x2,in_port=2,actions=1])
1231 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x3,in_port=3,actions=1])
1232 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1233 cookie=0x1, in_port=1 actions=output:1
1234 cookie=0x2, in_port=2 actions=output:1
1235 cookie=0x3, in_port=3 actions=output:1
1239 AT_CHECK([ovs-ofctl del-flows br0])
1240 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1246 AT_SETUP([ofproto - del flows based on cookie])
1248 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x1,in_port=1,actions=1])
1249 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x2,in_port=2,actions=1])
1250 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x3,in_port=3,actions=1])
1251 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1252 cookie=0x1, in_port=1 actions=output:1
1253 cookie=0x2, in_port=2 actions=output:1
1254 cookie=0x3, in_port=3 actions=output:1
1258 AT_CHECK([ovs-ofctl del-flows br0 cookie=0x3/-1])
1259 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1260 cookie=0x1, in_port=1 actions=output:1
1261 cookie=0x2, in_port=2 actions=output:1
1267 AT_SETUP([ofproto - del flows based on cookie mask])
1269 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x1,in_port=1,actions=1])
1270 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x2,in_port=2,actions=1])
1271 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x3,in_port=3,actions=1])
1272 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1273 cookie=0x1, in_port=1 actions=output:1
1274 cookie=0x2, in_port=2 actions=output:1
1275 cookie=0x3, in_port=3 actions=output:1
1278 AT_CHECK([ovs-ofctl del-flows br0 cookie=0x3/0x1])
1279 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1280 cookie=0x2, in_port=2 actions=output:1
1286 AT_SETUP([ofproto - del flows based on table id (NXM)])
1288 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x1,in_port=1,actions=1])
1289 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x2,in_port=2,table=1,actions=1])
1290 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1291 cookie=0x1, in_port=1 actions=output:1
1292 cookie=0x2, table=1, in_port=2 actions=output:1
1295 AT_CHECK([ovs-ofctl del-flows br0 table=0])
1296 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1297 cookie=0x2, table=1, in_port=2 actions=output:1
1300 AT_CHECK([ovs-ofctl del-flows br0 table=1])
1301 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1304 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x1,in_port=1,actions=1])
1305 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x2,in_port=2,table=1,actions=1])
1306 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1307 cookie=0x1, in_port=1 actions=output:1
1308 cookie=0x2, table=1, in_port=2 actions=output:1
1311 AT_CHECK([ovs-ofctl del-flows br0])
1312 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1318 AT_SETUP([ofproto - del flows based on table id (OpenFlow 1.1)])
1320 AT_CHECK([ovs-ofctl -O OpenFlow11 add-flow br0 cookie=0x1,in_port=1,actions=1])
1321 AT_CHECK([ovs-ofctl -O OpenFlow11 add-flow br0 cookie=0x2,in_port=2,table=1,actions=1])
1322 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1323 cookie=0x1, in_port=1 actions=output:1
1324 cookie=0x2, table=1, in_port=2 actions=output:1
1325 OFPST_FLOW reply (OF1.1):
1327 AT_CHECK([ovs-ofctl -O OpenFlow11 del-flows br0 table=0])
1328 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1329 cookie=0x2, table=1, in_port=2 actions=output:1
1330 OFPST_FLOW reply (OF1.1):
1332 AT_CHECK([ovs-ofctl -O OpenFlow11 del-flows br0 table=1])
1333 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1334 OFPST_FLOW reply (OF1.1):
1336 AT_CHECK([ovs-ofctl -O OpenFlow11 add-flow br0 cookie=0x1,in_port=1,actions=1])
1337 AT_CHECK([ovs-ofctl -O OpenFlow11 add-flow br0 cookie=0x2,in_port=2,table=1,actions=1])
1338 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1339 cookie=0x1, in_port=1 actions=output:1
1340 cookie=0x2, table=1, in_port=2 actions=output:1
1341 OFPST_FLOW reply (OF1.1):
1343 AT_CHECK([ovs-ofctl -O OpenFlow11 del-flows br0])
1344 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip], [0], [dnl
1345 OFPST_FLOW reply (OF1.1):
1346 cookie=0x2, table=1, in_port=2 actions=output:1
1351 AT_SETUP([ofproto - del flows based on table id (OpenFlow 1.2)])
1353 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 cookie=0x1,in_port=1,actions=1])
1354 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 cookie=0x2,in_port=2,table=1,actions=1])
1355 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1356 cookie=0x1, in_port=1 actions=output:1
1357 cookie=0x2, table=1, in_port=2 actions=output:1
1358 OFPST_FLOW reply (OF1.2):
1360 AT_CHECK([ovs-ofctl -O OpenFlow12 del-flows br0 table=0])
1361 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1362 cookie=0x2, table=1, in_port=2 actions=output:1
1363 OFPST_FLOW reply (OF1.2):
1365 AT_CHECK([ovs-ofctl -O OpenFlow12 del-flows br0 table=1])
1366 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1367 OFPST_FLOW reply (OF1.2):
1369 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 cookie=0x1,in_port=1,actions=1])
1370 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 cookie=0x2,in_port=2,table=1,actions=1])
1371 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1372 cookie=0x1, in_port=1 actions=output:1
1373 cookie=0x2, table=1, in_port=2 actions=output:1
1374 OFPST_FLOW reply (OF1.2):
1376 AT_CHECK([ovs-ofctl -O OpenFlow12 del-flows br0])
1377 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1378 OFPST_FLOW reply (OF1.2):
1383 AT_SETUP([ofproto - flow_mod with out_port matching (OpenFlow 1.0)])
1385 AT_DATA([flows.txt], [dnl
1386 in_port=1 actions=output:2
1387 in_port=2 actions=output:1,output:2,output:3
1388 in_port=3 actions=output:3,output:1,output:2
1389 in_port=4 actions=drop
1390 in_port=5 actions=output:3
1391 in_port=6 actions=output:1
1393 AT_CHECK([ovs-ofctl -F openflow10 add-flows br0 flows.txt])
1394 (cat flows.txt; echo 'OFPST_FLOW reply:') > expout
1395 AT_CHECK([ovs-ofctl -F openflow10 dump-flows br0 | ofctl_strip | sort], [0],
1398 (grep 'output:2' flows.txt; echo 'OFPST_FLOW reply:') > expout
1399 AT_CHECK([ovs-ofctl -F openflow10 dump-flows br0 out_port=2 | ofctl_strip | sort], [0], [expout])
1401 AT_CHECK([ovs-ofctl -F openflow10 del-flows br0 out_port=2])
1402 (grep -v 'output:2' flows.txt; echo 'OFPST_FLOW reply:') > expout
1403 AT_CHECK([ovs-ofctl -F openflow10 dump-flows br0 | ofctl_strip | sort], [0],
1406 AT_CHECK([ovs-ofctl -F openflow10 del-flows br0 out_port=3])
1407 (grep -v 'output:[[23]]' flows.txt; echo 'OFPST_FLOW reply:') > expout
1408 AT_CHECK([ovs-ofctl -F openflow10 dump-flows br0 | ofctl_strip | sort], [0],
1411 AT_CHECK([ovs-ofctl -F openflow10 del-flows br0 out_port=1])
1412 (grep -v 'output:[[123]]' flows.txt; echo 'OFPST_FLOW reply:') > expout
1413 AT_CHECK([ovs-ofctl -F openflow10 dump-flows br0 | ofctl_strip | sort], [0],
1419 AT_SETUP([ofproto - flow_mod with out_port matching (OpenFlow 1.1)])
1421 AT_DATA([flows.txt], [dnl
1422 in_port=1 actions=output:2
1423 in_port=2 actions=output:1,write_actions(output:2,output:3)
1424 in_port=3 actions=output:3,output:1,write_actions(output:2)
1425 in_port=4 actions=drop
1426 in_port=5 actions=write_actions(output:3)
1427 in_port=6 actions=output:1
1429 AT_CHECK([ovs-ofctl -O OpenFlow11 add-flows br0 flows.txt])
1430 (cat flows.txt; echo 'OFPST_FLOW reply (OF1.1):') > expout
1431 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0],
1434 (grep 'output:2' flows.txt; echo 'OFPST_FLOW reply (OF1.1):') > expout
1435 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 out_port=2 | ofctl_strip | sort], [0], [expout])
1437 AT_CHECK([ovs-ofctl -O OpenFlow11 del-flows br0 out_port=2])
1438 (grep -v 'output:2' flows.txt; echo 'OFPST_FLOW reply (OF1.1):') > expout
1439 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0],
1442 AT_CHECK([ovs-ofctl -O OpenFlow11 del-flows br0 out_port=3])
1443 (grep -v 'output:[[23]]' flows.txt; echo 'OFPST_FLOW reply (OF1.1):') > expout
1444 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0],
1447 AT_CHECK([ovs-ofctl -O OpenFlow11 del-flows br0 out_port=1])
1448 (grep -v 'output:[[123]]' flows.txt; echo 'OFPST_FLOW reply (OF1.1):') > expout
1449 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0],
1455 AT_SETUP([ofproto - flow_mod with out_group matching (OpenFlow 1.1)])
1457 AT_DATA([groups.txt], [dnl
1458 group_id=1,type=all,bucket=output:10
1459 group_id=2,type=all,bucket=output:10
1460 group_id=3,type=all,bucket=output:10
1462 AT_CHECK([ovs-ofctl -O OpenFlow11 add-groups br0 groups.txt])
1463 AT_DATA([flows.txt], [dnl
1464 in_port=1 actions=group:2,output:5
1465 in_port=2 actions=group:1,write_actions(group:2,group:3,output:6)
1466 in_port=3 actions=group:3,group:1,write_actions(group:2,output:3)
1467 in_port=4 actions=output:4
1468 in_port=5 actions=write_actions(output:4,group:3)
1469 in_port=6 actions=group:1
1471 AT_CHECK([ovs-ofctl -O OpenFlow11 add-flows br0 flows.txt])
1472 (cat flows.txt; echo 'OFPST_FLOW reply (OF1.1):') > expout
1473 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0],
1476 (grep 'output:3' flows.txt | grep 'group:2'; echo 'OFPST_FLOW reply (OF1.1):') > expout
1477 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 out_port=3,out_group=2 | ofctl_strip | sort], [0], [expout])
1479 AT_CHECK([ovs-ofctl -O OpenFlow11 del-flows br0 out_group=2])
1480 (grep -v 'group:2' flows.txt; echo 'OFPST_FLOW reply (OF1.1):') > expout
1481 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0],
1484 AT_CHECK([ovs-ofctl -O OpenFlow11 del-flows br0 out_group=3])
1485 (grep -v 'group:[[23]]' flows.txt; echo 'OFPST_FLOW reply (OF1.1):') > expout
1486 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0],
1489 AT_CHECK([ovs-ofctl -O OpenFlow11 del-flows br0 out_group=1])
1490 (grep -v 'group:[[123]]' flows.txt; echo 'OFPST_FLOW reply (OF1.1):') > expout
1491 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0],
1497 AT_SETUP([ofproto - flow table configuration (OpenFlow 1.0)])
1499 # Check the default configuration.
1501 printf 'OFPST_TABLE reply (xid=0x2):
1503 active=0, lookup=0, matched=0
1506 in_port: exact match or wildcard
1507 eth_src: exact match or wildcard
1508 eth_dst: exact match or wildcard
1509 eth_type: exact match or wildcard
1510 vlan_vid: exact match or wildcard
1511 vlan_pcp: exact match or wildcard
1512 ip_src: exact match or wildcard
1513 ip_dst: exact match or wildcard
1514 nw_proto: exact match or wildcard
1515 nw_tos: exact match or wildcard
1516 tcp_src: exact match or wildcard
1517 tcp_dst: exact match or wildcard
1522 for i in `seq $1 $2`; do
1523 printf ' table %d ("table%d"): ditto\n' $i $i
1526 (head_table classifier; ditto 1 253) > expout
1527 AT_CHECK([ovs-ofctl dump-tables br0], [0], [expout])
1528 # Change the configuration.
1531 -- --id=@t0 create Flow_Table name=main \
1532 -- --id=@t1 create Flow_Table flow-limit=1024 \
1533 -- set bridge br0 'flow_tables={1=@t1,0=@t0}' \
1534 | ${PERL} $srcdir/uuidfilt.pl],
1538 # Check that the configuration was updated.
1539 (head_table main; echo ' table 1 ("table1"):
1540 active=0, lookup=0, matched=0
1545 active=0, lookup=0, matched=0
1548 '; ditto 3 253) > expout
1549 AT_CHECK([ovs-ofctl dump-tables br0], [0], [expout])
1553 dnl In-band and fail-open add "hidden rules" to table 0. These rules shouldn't
1554 dnl be visible to OpenFlow. This test checks that "dump-flows" and
1555 dnl "dump-tables" don't make them visible.
1556 AT_SETUP([ofproto - hidden rules not in table stats])
1557 # Use an IP address for a controller that won't actually exist: we
1558 # want to create in-band rules but we do not want to actually connect
1559 # to a controller (because that could mess about with our test). The
1560 # Class E range 240.0.0.0 - 255.255.255.255 seems like a good choice.
1561 OVS_VSWITCHD_START([set-controller br0 tcp:240.0.0.1:6653])
1562 for i in 1 2 3 4 5; do ovs-appctl time/warp 1000; done
1564 # Check that no hidden flows are visible in OpenFlow.
1565 AT_CHECK([ovs-ofctl dump-flows br0], [0], [NXST_FLOW reply (xid=0x4):
1568 # Check that some hidden flows related to 240.0.0.1 are actually in table 0.
1570 # We discard flows that mention table_id because we only want table 0 flows,
1571 # which in OVS is implied by the absence of a table_id.
1572 AT_CHECK([ovs-appctl bridge/dump-flows br0], [0], [stdout])
1573 AT_CHECK([test `grep '240\.0\.0\.1' stdout | grep -v table_id= | wc -l` -gt 0])
1575 # Check that dump-tables doesn't count the hidden flows.
1577 printf 'OFPST_TABLE reply (xid=0x2):
1579 active=0, lookup=0, matched=0
1582 in_port: exact match or wildcard
1583 eth_src: exact match or wildcard
1584 eth_dst: exact match or wildcard
1585 eth_type: exact match or wildcard
1586 vlan_vid: exact match or wildcard
1587 vlan_pcp: exact match or wildcard
1588 ip_src: exact match or wildcard
1589 ip_dst: exact match or wildcard
1590 nw_proto: exact match or wildcard
1591 nw_tos: exact match or wildcard
1592 tcp_src: exact match or wildcard
1593 tcp_dst: exact match or wildcard
1598 for i in `seq $1 $2`; do
1599 printf ' table %d ("table%d"): ditto\n' $i $i
1602 (head_table classifier; ditto 1 253) > expout
1603 AT_CHECK([ovs-ofctl dump-tables br0], [0], [expout])
1604 OVS_VSWITCHD_STOP(["/240\.0\.0\.1/d"])
1607 AT_SETUP([ofproto - flow table configuration (OpenFlow 1.2)])
1609 # Check the default configuration.
1611 printf 'OFPST_TABLE reply (OF1.2) (xid=0x2):
1613 active=0, lookup=0, matched=0
1614 metadata: match=0xffffffffffffffff write=0xffffffffffffffff
1617 instructions (table miss and others):
1618 instructions: apply_actions,clear_actions,write_actions,write_metadata,goto_table
1619 Write-Actions and Apply-Actions features:
1620 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
1621 supported on Set-Field: metadata in_port_oxm eth_src eth_dst vlan_vid vlan_pcp mpls_label mpls_tc ip_src ip_dst ipv6_src ipv6_dst ipv6_label ip_dscp nw_ecn arp_op arp_spa arp_tpa arp_sha arp_tha tcp_src tcp_dst udp_src udp_dst sctp_src sctp_dst icmp_type icmp_code icmpv6_type icmpv6_code nd_target nd_sll nd_tll
1623 metadata: exact match or wildcard
1624 in_port_oxm: exact match or wildcard
1625 eth_src: exact match or wildcard
1626 eth_dst: exact match or wildcard
1627 eth_type: exact match or wildcard
1628 vlan_vid: exact match or wildcard
1629 vlan_pcp: exact match or wildcard
1630 mpls_label: exact match or wildcard
1631 mpls_tc: exact match or wildcard
1632 ip_src: exact match or wildcard
1633 ip_dst: exact match or wildcard
1634 ipv6_src: exact match or wildcard
1635 ipv6_dst: exact match or wildcard
1636 ipv6_label: exact match or wildcard
1637 nw_proto: exact match or wildcard
1638 ip_dscp: exact match or wildcard
1639 nw_ecn: exact match or wildcard
1640 arp_op: exact match or wildcard
1641 arp_spa: exact match or wildcard
1642 arp_tpa: exact match or wildcard
1643 arp_sha: exact match or wildcard
1644 arp_tha: exact match or wildcard
1645 tcp_src: exact match or wildcard
1646 tcp_dst: exact match or wildcard
1647 udp_src: exact match or wildcard
1648 udp_dst: exact match or wildcard
1649 sctp_src: exact match or wildcard
1650 sctp_dst: exact match or wildcard
1651 icmp_type: exact match or wildcard
1652 icmp_code: exact match or wildcard
1653 icmpv6_type: exact match or wildcard
1654 icmpv6_code: exact match or wildcard
1655 nd_target: exact match or wildcard
1656 nd_sll: exact match or wildcard
1657 nd_tll: exact match or wildcard
1662 for i in `seq $1 $2`; do
1663 printf ' table %d ("table%d"): ditto\n' $i $i
1667 printf ' table 253 ("table253"):
1668 active=0, lookup=0, matched=0
1669 metadata: match=0xffffffffffffffff write=0xffffffffffffffff
1672 instructions (table miss and others):
1673 instructions: apply_actions,clear_actions,write_actions,write_metadata
1678 (head_table classifier; ditto 1 252; tail_table) > expout
1679 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-tables br0], [0], [expout])
1680 # Change the configuration.
1683 -- --id=@t0 create Flow_Table name=main \
1684 -- --id=@t1 create Flow_Table flow-limit=1024 \
1685 -- set bridge br0 'flow_tables={1=@t1,0=@t0}' \
1686 | ${PERL} $srcdir/uuidfilt.pl],
1690 # Check that the configuration was updated.
1691 (head_table main; echo ' table 1 ("table1"):
1692 active=0, lookup=0, matched=0
1693 metadata: match=0xffffffffffffffff write=0xffffffffffffffff
1700 active=0, lookup=0, matched=0
1701 metadata: match=0xffffffffffffffff write=0xffffffffffffffff
1706 '; ditto 3 252; tail_table) > expout
1707 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-tables br0], [0], [expout])
1711 AT_SETUP([ofproto - table features (OpenFlow 1.3)])
1714 printf ' table 0 ("%s"):
1715 metadata: match=0xffffffffffffffff write=0xffffffffffffffff
1717 instructions (table miss and others):
1719 instructions: meter,apply_actions,clear_actions,write_actions,write_metadata,goto_table
1720 Write-Actions and Apply-Actions features:
1721 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
1722 supported on Set-Field: tun_id tun_src tun_dst tun_flags tun_gbp_id tun_gbp_flags tun_metadata0 dnl
1723 tun_metadata1 tun_metadata2 tun_metadata3 tun_metadata4 tun_metadata5 tun_metadata6 tun_metadata7 tun_metadata8 tun_metadata9 tun_metadata10 tun_metadata11 tun_metadata12 tun_metadata13 tun_metadata14 tun_metadata15 tun_metadata16 tun_metadata17 tun_metadata18 tun_metadata19 tun_metadata20 tun_metadata21 tun_metadata22 tun_metadata23 tun_metadata24 tun_metadata25 tun_metadata26 tun_metadata27 tun_metadata28 tun_metadata29 tun_metadata30 tun_metadata31 tun_metadata32 tun_metadata33 tun_metadata34 tun_metadata35 tun_metadata36 tun_metadata37 tun_metadata38 tun_metadata39 tun_metadata40 tun_metadata41 tun_metadata42 tun_metadata43 tun_metadata44 tun_metadata45 tun_metadata46 tun_metadata47 tun_metadata48 tun_metadata49 tun_metadata50 tun_metadata51 tun_metadata52 tun_metadata53 tun_metadata54 tun_metadata55 tun_metadata56 tun_metadata57 tun_metadata58 tun_metadata59 tun_metadata60 tun_metadata61 tun_metadata62 tun_metadata63 dnl
1724 metadata in_port in_port_oxm pkt_mark ct_mark ct_label reg0 reg1 reg2 reg3 reg4 reg5 reg6 reg7 xreg0 xreg1 xreg2 xreg3 eth_src eth_dst vlan_tci vlan_vid vlan_pcp mpls_label mpls_tc ip_src ip_dst ipv6_src ipv6_dst ipv6_label nw_tos ip_dscp nw_ecn nw_ttl arp_op arp_spa arp_tpa arp_sha arp_tha tcp_src tcp_dst udp_src udp_dst sctp_src sctp_dst icmp_type icmp_code icmpv6_type icmpv6_code nd_target nd_sll nd_tll
1726 dp_hash: arbitrary mask
1727 recirc_id: exact match or wildcard
1728 conj_id: exact match or wildcard
1729 tun_id: arbitrary mask
1730 tun_src: arbitrary mask
1731 tun_dst: arbitrary mask
1732 tun_flags: arbitrary mask
1733 tun_gbp_id: arbitrary mask
1734 tun_gbp_flags: arbitrary mask
1735 tun_metadata0: arbitrary mask
1736 tun_metadata1: arbitrary mask
1737 tun_metadata2: arbitrary mask
1738 tun_metadata3: arbitrary mask
1739 tun_metadata4: arbitrary mask
1740 tun_metadata5: arbitrary mask
1741 tun_metadata6: arbitrary mask
1742 tun_metadata7: arbitrary mask
1743 tun_metadata8: arbitrary mask
1744 tun_metadata9: arbitrary mask
1745 tun_metadata10: arbitrary mask
1746 tun_metadata11: arbitrary mask
1747 tun_metadata12: arbitrary mask
1748 tun_metadata13: arbitrary mask
1749 tun_metadata14: arbitrary mask
1750 tun_metadata15: arbitrary mask
1751 tun_metadata16: arbitrary mask
1752 tun_metadata17: arbitrary mask
1753 tun_metadata18: arbitrary mask
1754 tun_metadata19: arbitrary mask
1755 tun_metadata20: arbitrary mask
1756 tun_metadata21: arbitrary mask
1757 tun_metadata22: arbitrary mask
1758 tun_metadata23: arbitrary mask
1759 tun_metadata24: arbitrary mask
1760 tun_metadata25: arbitrary mask
1761 tun_metadata26: arbitrary mask
1762 tun_metadata27: arbitrary mask
1763 tun_metadata28: arbitrary mask
1764 tun_metadata29: arbitrary mask
1765 tun_metadata30: arbitrary mask
1766 tun_metadata31: arbitrary mask
1767 tun_metadata32: arbitrary mask
1768 tun_metadata33: arbitrary mask
1769 tun_metadata34: arbitrary mask
1770 tun_metadata35: arbitrary mask
1771 tun_metadata36: arbitrary mask
1772 tun_metadata37: arbitrary mask
1773 tun_metadata38: arbitrary mask
1774 tun_metadata39: arbitrary mask
1775 tun_metadata40: arbitrary mask
1776 tun_metadata41: arbitrary mask
1777 tun_metadata42: arbitrary mask
1778 tun_metadata43: arbitrary mask
1779 tun_metadata44: arbitrary mask
1780 tun_metadata45: arbitrary mask
1781 tun_metadata46: arbitrary mask
1782 tun_metadata47: arbitrary mask
1783 tun_metadata48: arbitrary mask
1784 tun_metadata49: arbitrary mask
1785 tun_metadata50: arbitrary mask
1786 tun_metadata51: arbitrary mask
1787 tun_metadata52: arbitrary mask
1788 tun_metadata53: arbitrary mask
1789 tun_metadata54: arbitrary mask
1790 tun_metadata55: arbitrary mask
1791 tun_metadata56: arbitrary mask
1792 tun_metadata57: arbitrary mask
1793 tun_metadata58: arbitrary mask
1794 tun_metadata59: arbitrary mask
1795 tun_metadata60: arbitrary mask
1796 tun_metadata61: arbitrary mask
1797 tun_metadata62: arbitrary mask
1798 tun_metadata63: arbitrary mask
1799 metadata: arbitrary mask
1800 in_port: exact match or wildcard
1801 in_port_oxm: exact match or wildcard
1802 actset_output: exact match or wildcard
1803 pkt_mark: arbitrary mask
1804 ct_state: arbitrary mask
1805 ct_zone: exact match or wildcard
1806 ct_mark: arbitrary mask
1807 ct_label: arbitrary mask
1808 reg0: arbitrary mask
1809 reg1: arbitrary mask
1810 reg2: arbitrary mask
1811 reg3: arbitrary mask
1812 reg4: arbitrary mask
1813 reg5: arbitrary mask
1814 reg6: arbitrary mask
1815 reg7: arbitrary mask
1816 xreg0: arbitrary mask
1817 xreg1: arbitrary mask
1818 xreg2: arbitrary mask
1819 xreg3: arbitrary mask
1820 eth_src: arbitrary mask
1821 eth_dst: arbitrary mask
1822 eth_type: exact match or wildcard
1823 vlan_tci: arbitrary mask
1824 vlan_vid: arbitrary mask
1825 vlan_pcp: exact match or wildcard
1826 mpls_label: exact match or wildcard
1827 mpls_tc: exact match or wildcard
1828 mpls_bos: exact match or wildcard
1829 ip_src: arbitrary mask
1830 ip_dst: arbitrary mask
1831 ipv6_src: arbitrary mask
1832 ipv6_dst: arbitrary mask
1833 ipv6_label: arbitrary mask
1834 nw_proto: exact match or wildcard
1835 nw_tos: exact match or wildcard
1836 ip_dscp: exact match or wildcard
1837 nw_ecn: exact match or wildcard
1838 nw_ttl: exact match or wildcard
1839 ip_frag: arbitrary mask
1840 arp_op: exact match or wildcard
1841 arp_spa: arbitrary mask
1842 arp_tpa: arbitrary mask
1843 arp_sha: arbitrary mask
1844 arp_tha: arbitrary mask
1845 tcp_src: arbitrary mask
1846 tcp_dst: arbitrary mask
1847 tcp_flags: arbitrary mask
1848 udp_src: arbitrary mask
1849 udp_dst: arbitrary mask
1850 sctp_src: arbitrary mask
1851 sctp_dst: arbitrary mask
1852 icmp_type: exact match or wildcard
1853 icmp_code: exact match or wildcard
1854 icmpv6_type: exact match or wildcard
1855 icmpv6_code: exact match or wildcard
1856 nd_target: arbitrary mask
1857 nd_sll: arbitrary mask
1858 nd_tll: arbitrary mask
1863 printf ' table %d ("%s"):
1864 metadata: match=0xffffffffffffffff write=0xffffffffffffffff
1866 instructions (table miss and others):
1872 ' $1 $2 $3 `expr $1 + 1`
1875 echo ' table 252 ("table252"):
1876 metadata: match=0xffffffffffffffff write=0xffffffffffffffff
1878 instructions (table miss and others):
1884 table 253 ("table253"):
1885 metadata: match=0xffffffffffffffff write=0xffffffffffffffff
1887 instructions (table miss and others):
1888 instructions: meter,apply_actions,clear_actions,write_actions,write_metadata
1893 (head_table classifier
1894 for i in `seq 1 251`; do
1895 ditto $i table$i 1000000
1897 tail_tables) > expout
1898 AT_CHECK([ovs-ofctl -O OpenFlow13 dump-table-features br0], [0], [expout])
1899 # Change the configuration.
1902 -- --id=@t0 create Flow_Table name=main \
1903 -- --id=@t1 create Flow_Table flow-limit=1024 \
1904 -- set bridge br0 'flow_tables={1=@t1,0=@t0}' \
1905 | ${PERL} $srcdir/uuidfilt.pl],
1909 # Check that the configuration was updated.
1912 for i in `seq 2 251`; do
1913 ditto $i table$i 1000000
1915 tail_tables) > expout
1916 AT_CHECK([ovs-ofctl -O OpenFlow13 dump-table-features br0], [0], [expout])
1920 AT_SETUP([ofproto - table description (OpenFlow 1.4)])
1923 while test $x -lt 254; do
1926 eviction=off eviction_flags=OTHER|IMPORTANCE|LIFETIME
1930 AT_CHECK([ovs-ofctl -O OpenFlow14 dump-table-desc br0 | sed '/^$/d
1931 /^OFPST_TABLE_DESC/d'], [0], [expout])
1933 # Change the configuration.
1934 AT_CHECK([ovs-ofctl -O Openflow14 mod-table br0 0 evict])
1935 # Check that the configuration was updated.
1936 mv expout orig-expout
1937 sed -e '2s/eviction=off/eviction=on/' <orig-expout > expout
1938 AT_CHECK([ovs-ofctl -O OpenFlow14 dump-table-desc br0 | sed '/^$/d
1939 /^OFPST_TABLE_DESC/d'], [0], [expout])
1941 AT_CHECK([ovs-ofctl -O Openflow14 mod-table br0 0 vacancy:20,80])
1942 # Check that the configuration was updated.
1943 mv expout orig-expout
1944 sed -e '3s/vacancy=off/vacancy=on vacancy_down=20% vacancy_up=80% vacancy=0%/' <orig-expout > expout
1945 AT_CHECK([ovs-ofctl -O OpenFlow14 dump-table-desc br0 | sed '/^$/d
1946 /^OFPST_TABLE_DESC/d'], [0], [expout])
1950 AT_SETUP([ofproto - hard limits on flow table size (OpenFlow 1.0)])
1952 # Configure a maximum of 4 flows.
1955 -- --id=@t0 create Flow_Table flow-limit=4 \
1956 -- set bridge br0 flow_tables:0=@t0 \
1957 | ${PERL} $srcdir/uuidfilt.pl],
1961 for in_port in 1 2 3 4; do
1962 ovs-ofctl add-flow br0 in_port=$in_port,actions=drop
1964 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1965 in_port=1 actions=drop
1966 in_port=2 actions=drop
1967 in_port=3 actions=drop
1968 in_port=4 actions=drop
1971 # Adding another flow will be refused.
1972 AT_CHECK([ovs-ofctl add-flow br0 in_port=5,actions=drop], [1], [], [stderr])
1973 AT_CHECK([head -n 1 stderr | ofctl_strip], [0],
1974 [OFPT_ERROR: OFPFMFC_TABLE_FULL
1976 # Also a mod-flow that would add a flow will be refused.
1977 AT_CHECK([ovs-ofctl mod-flows br0 in_port=5,actions=drop], [1], [], [stderr])
1978 AT_CHECK([head -n 1 stderr | ofctl_strip], [0],
1979 [OFPT_ERROR: OFPFMFC_TABLE_FULL
1981 # Replacing or modifying an existing flow is allowed.
1982 AT_CHECK([ovs-ofctl add-flow br0 in_port=4,actions=normal])
1983 AT_CHECK([ovs-ofctl mod-flows br0 in_port=3,actions=output:1])
1984 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1985 in_port=1 actions=drop
1986 in_port=2 actions=drop
1987 in_port=3 actions=output:1
1988 in_port=4 actions=NORMAL
1994 AT_SETUP([ofproto - hard limits on flow table size (OpenFlow 1.2)])
1996 # Configure a maximum of 4 flows.
1999 -- --id=@t0 create Flow_Table flow-limit=4 \
2000 -- set bridge br0 flow_tables:0=@t0 \
2001 | ${PERL} $srcdir/uuidfilt.pl],
2005 for in_port in 1 2 3 4; do
2006 ovs-ofctl -O OpenFlow12 add-flow br0 in_port=$in_port,actions=drop
2008 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
2009 in_port=1 actions=drop
2010 in_port=2 actions=drop
2011 in_port=3 actions=drop
2012 in_port=4 actions=drop
2013 OFPST_FLOW reply (OF1.2):
2015 # Adding another flow will be refused.
2016 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 in_port=5,actions=drop], [1], [], [stderr])
2017 AT_CHECK([head -n 1 stderr | ofctl_strip], [0],
2018 [OFPT_ERROR (OF1.2): OFPFMFC_TABLE_FULL
2020 # Replacing or modifying an existing flow is allowed.
2021 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 in_port=4,actions=normal])
2022 AT_CHECK([ovs-ofctl -O OpenFlow12 mod-flows br0 in_port=3,actions=output:1])
2023 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
2024 in_port=1 actions=drop
2025 in_port=2 actions=drop
2026 in_port=3 actions=output:1
2027 in_port=4 actions=NORMAL
2028 OFPST_FLOW reply (OF1.2):
2033 AT_SETUP([ofproto - eviction upon table overflow (OpenFlow 1.0)])
2035 # Configure a maximum of 4 flows.
2038 -- --id=@t0 create Flow_Table flow-limit=4 overflow-policy=evict \
2039 -- set bridge br0 flow_tables:0=@t0 \
2040 | ${PERL} $srcdir/uuidfilt.pl],
2044 for in_port in 4 3 2 1; do
2045 ovs-ofctl add-flow br0 idle_timeout=${in_port}0,in_port=$in_port,actions=drop
2047 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
2048 idle_timeout=10, in_port=1 actions=drop
2049 idle_timeout=20, in_port=2 actions=drop
2050 idle_timeout=30, in_port=3 actions=drop
2051 idle_timeout=40, in_port=4 actions=drop
2054 # Adding another flow will cause the one that expires soonest to be evicted.
2055 AT_CHECK([ovs-ofctl add-flow br0 in_port=5,actions=drop])
2056 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
2057 idle_timeout=20, in_port=2 actions=drop
2058 idle_timeout=30, in_port=3 actions=drop
2059 idle_timeout=40, in_port=4 actions=drop
2060 in_port=5 actions=drop
2063 # A mod-flow that adds a flow also causes eviction, but replacing or
2064 # modifying an existing flow doesn't.
2065 AT_CHECK([ovs-ofctl mod-flows br0 in_port=6,actions=drop])
2066 AT_CHECK([ovs-ofctl add-flow br0 in_port=4,actions=normal])
2067 AT_CHECK([ovs-ofctl mod-flows br0 in_port=3,actions=output:1])
2068 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
2069 idle_timeout=30, in_port=3 actions=output:1
2070 in_port=4 actions=NORMAL
2071 in_port=5 actions=drop
2072 in_port=6 actions=drop
2075 # Flows with no timeouts at all cannot be evicted.
2076 AT_CHECK([ovs-ofctl add-flow br0 in_port=7,actions=normal])
2077 AT_CHECK([ovs-ofctl add-flow br0 in_port=8,actions=drop], [1], [], [stderr])
2078 AT_CHECK([head -n 1 stderr | ofctl_strip], [0],
2079 [OFPT_ERROR: OFPFMFC_TABLE_FULL
2081 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
2082 in_port=4 actions=NORMAL
2083 in_port=5 actions=drop
2084 in_port=6 actions=drop
2085 in_port=7 actions=NORMAL
2091 AT_SETUP([ofproto - eviction upon table overflow (OpenFlow 1.2)])
2093 # Configure a maximum of 4 flows.
2096 -- --id=@t0 create Flow_Table flow-limit=4 overflow-policy=evict \
2097 -- set bridge br0 flow_tables:0=@t0 \
2098 | ${PERL} $srcdir/uuidfilt.pl],
2102 for in_port in 4 3 2 1; do
2103 ovs-ofctl -O OpenFlow12 add-flow br0 idle_timeout=${in_port}0,in_port=$in_port,actions=drop
2105 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
2106 idle_timeout=10, in_port=1 actions=drop
2107 idle_timeout=20, in_port=2 actions=drop
2108 idle_timeout=30, in_port=3 actions=drop
2109 idle_timeout=40, in_port=4 actions=drop
2110 OFPST_FLOW reply (OF1.2):
2112 # Adding another flow will cause the one that expires soonest to be evicted.
2113 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 in_port=5,actions=drop])
2114 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
2115 idle_timeout=20, in_port=2 actions=drop
2116 idle_timeout=30, in_port=3 actions=drop
2117 idle_timeout=40, in_port=4 actions=drop
2118 in_port=5 actions=drop
2119 OFPST_FLOW reply (OF1.2):
2121 # In OpenFlow 1.2 a mod-flow does not ever add a flow and thus
2122 # has no effect on eviction
2123 AT_CHECK([ovs-ofctl -O OpenFlow12 mod-flows br0 in_port=6,actions=drop])
2124 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 in_port=4,actions=normal])
2125 AT_CHECK([ovs-ofctl -O OpenFlow12 mod-flows br0 in_port=3,actions=output:1])
2126 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
2127 idle_timeout=20, in_port=2 actions=drop
2128 idle_timeout=30, in_port=3 actions=output:1
2129 in_port=4 actions=NORMAL
2130 in_port=5 actions=drop
2131 OFPST_FLOW reply (OF1.2):
2133 # Flows with no timeouts at all cannot be evicted.
2134 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 in_port=6,actions=drop])
2135 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 in_port=7,actions=normal])
2136 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 in_port=8,actions=drop], [1], [], [stderr])
2137 AT_CHECK([head -n 1 stderr | ofctl_strip], [0],
2138 [OFPT_ERROR (OF1.2): OFPFMFC_TABLE_FULL
2140 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
2141 in_port=4 actions=NORMAL
2142 in_port=5 actions=drop
2143 in_port=6 actions=drop
2144 in_port=7 actions=NORMAL
2145 OFPST_FLOW reply (OF1.2):
2150 AT_SETUP([ofproto - eviction using importance upon table overflow (OpenFlow 1.4)])
2152 # Configure a maximum of 4 flows.
2155 -- --id=@t0 create Flow_Table name=evict flow-limit=4 \
2156 -- set bridge br0 flow_tables:0=@t0 \
2157 | ${PERL} $srcdir/uuidfilt.pl],
2160 # Use mod-table to turn on eviction just to demonstrate that it works.
2161 AT_CHECK([ovs-ofctl -O OpenFlow14 mod-table br0 0 evict])
2163 for in_port in 4 3 2 1; do
2164 ovs-ofctl -O Openflow14 add-flow br0 importance=$((in_port + 30)),priority=$((in_port + 5)),hard_timeout=$((in_port + 500)),actions=drop
2166 AT_CHECK([ovs-ofctl -O Openflow14 dump-flows br0 | ofctl_strip | sort], [0], [dnl
2167 hard_timeout=501, importance=31, priority=6 actions=drop
2168 hard_timeout=502, importance=32, priority=7 actions=drop
2169 hard_timeout=503, importance=33, priority=8 actions=drop
2170 hard_timeout=504, importance=34, priority=9 actions=drop
2171 OFPST_FLOW reply (OF1.4):
2173 # Adding another flow will cause the one with lowest importance to be evicted.
2174 AT_CHECK([ovs-ofctl -O Openflow14 add-flow br0 hard_timeout=505,importance=35,priority=10,in_port=2,actions=drop])
2175 AT_CHECK([ovs-ofctl -O Openflow14 dump-flows br0 | ofctl_strip | sort], [0], [dnl
2176 hard_timeout=502, importance=32, priority=7 actions=drop
2177 hard_timeout=503, importance=33, priority=8 actions=drop
2178 hard_timeout=504, importance=34, priority=9 actions=drop
2179 hard_timeout=505, importance=35, priority=10,in_port=2 actions=drop
2180 OFPST_FLOW reply (OF1.4):
2182 # Disable the Eviction configuration.
2183 AT_CHECK([ovs-ofctl -O OpenFlow14 mod-table br0 0 noevict])
2184 # Adding another flow will cause the system to give error for FULL TABLE.
2185 AT_CHECK([ovs-ofctl -O Openflow14 add-flow br0 hard_timeout=506,importance=36,priority=11,actions=drop],[1], [], [stderr])
2186 AT_CHECK([head -n 1 stderr | ofctl_strip], [0],
2187 [OFPT_ERROR (OF1.4): OFPFMFC_TABLE_FULL
2189 #Dump flows. It should show only the old values
2190 AT_CHECK([ovs-ofctl -O Openflow14 dump-flows br0 | ofctl_strip | sort], [0], [dnl
2191 hard_timeout=502, importance=32, priority=7 actions=drop
2192 hard_timeout=503, importance=33, priority=8 actions=drop
2193 hard_timeout=504, importance=34, priority=9 actions=drop
2194 hard_timeout=505, importance=35, priority=10,in_port=2 actions=drop
2195 OFPST_FLOW reply (OF1.4):
2197 # mod-flow that would modify a flow will be done successfully.
2198 AT_CHECK([ovs-ofctl -O Openflow14 mod-flows br0 in_port=2,actions=NORMAL])
2199 AT_CHECK([ovs-ofctl -O Openflow14 dump-flows br0 | ofctl_strip | sort], [0], [dnl
2200 hard_timeout=502, importance=32, priority=7 actions=drop
2201 hard_timeout=503, importance=33, priority=8 actions=drop
2202 hard_timeout=504, importance=34, priority=9 actions=drop
2203 hard_timeout=505, importance=35, priority=10,in_port=2 actions=NORMAL
2204 OFPST_FLOW reply (OF1.4):
2206 # Also a mod-flow that would add a flow will be refused.
2207 AT_CHECK([ovs-ofctl mod-flows br0 in_port=5,actions=drop], [1], [], [stderr])
2208 AT_CHECK([head -n 1 stderr | ofctl_strip], [0],
2209 [OFPT_ERROR: OFPFMFC_TABLE_FULL
2214 AT_SETUP([ofproto - eviction upon table overflow, with fairness (OpenFlow 1.0)])
2216 # Configure a maximum of 4 flows.
2219 -- --id=@t0 create Flow_Table name=evict flow-limit=4 \
2220 overflow-policy=evict \
2221 groups='"NXM_OF_IN_PORT[[]]"' \
2222 -- set bridge br0 flow_tables:0=@t0 \
2223 | ${PERL} $srcdir/uuidfilt.pl],
2227 ovs-ofctl add-flows br0 - <<EOF
2228 idle_timeout=10 in_port=2 dl_src=00:44:55:66:77:88 actions=drop
2229 idle_timeout=20 in_port=1 dl_src=00:11:22:33:44:55 actions=drop
2230 idle_timeout=30 in_port=1 dl_src=00:22:33:44:55:66 actions=drop
2231 idle_timeout=40 in_port=1 dl_src=00:33:44:55:66:77 actions=drop
2233 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
2234 idle_timeout=10, in_port=2,dl_src=00:44:55:66:77:88 actions=drop
2235 idle_timeout=20, in_port=1,dl_src=00:11:22:33:44:55 actions=drop
2236 idle_timeout=30, in_port=1,dl_src=00:22:33:44:55:66 actions=drop
2237 idle_timeout=40, in_port=1,dl_src=00:33:44:55:66:77 actions=drop
2240 # Adding another flow will cause the one that expires soonest within
2241 # the largest group (those with in_port=1) to be evicted. In this
2242 # case this is not the same as the one that expires soonest overall
2243 # (which is what makes the test interesting):
2244 AT_CHECK([ovs-ofctl add-flow br0 in_port=2,dl_src=00:55:66:77:88:99,actions=drop])
2245 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
2246 idle_timeout=10, in_port=2,dl_src=00:44:55:66:77:88 actions=drop
2247 idle_timeout=30, in_port=1,dl_src=00:22:33:44:55:66 actions=drop
2248 idle_timeout=40, in_port=1,dl_src=00:33:44:55:66:77 actions=drop
2249 in_port=2,dl_src=00:55:66:77:88:99 actions=drop
2252 # Enlarge the flow limit, change the eviction policy back to strictly
2253 # based on expiration, and and add some flows.
2254 AT_CHECK([ovs-vsctl set Flow_Table evict groups='[[]]' flow-limit=7])
2255 ovs-ofctl add-flows br0 - <<EOF
2256 idle_timeout=50 in_port=2 dl_src=00:66:77:88:99:aa actions=drop
2257 idle_timeout=60 in_port=2 dl_src=00:77:88:99:aa:bb actions=drop
2258 idle_timeout=70 in_port=2 dl_src=00:88:99:aa:bb:cc actions=drop
2260 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
2261 idle_timeout=10, in_port=2,dl_src=00:44:55:66:77:88 actions=drop
2262 idle_timeout=30, in_port=1,dl_src=00:22:33:44:55:66 actions=drop
2263 idle_timeout=40, in_port=1,dl_src=00:33:44:55:66:77 actions=drop
2264 idle_timeout=50, in_port=2,dl_src=00:66:77:88:99:aa actions=drop
2265 idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=drop
2266 idle_timeout=70, in_port=2,dl_src=00:88:99:aa:bb:cc actions=drop
2267 in_port=2,dl_src=00:55:66:77:88:99 actions=drop
2270 # Adding another flow will cause the one that expires soonest overall
2272 AT_CHECK([ovs-ofctl add-flow br0 'idle_timeout=80 in_port=2 dl_src=00:99:aa:bb:cc:dd actions=drop'])
2273 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
2274 idle_timeout=30, in_port=1,dl_src=00:22:33:44:55:66 actions=drop
2275 idle_timeout=40, in_port=1,dl_src=00:33:44:55:66:77 actions=drop
2276 idle_timeout=50, in_port=2,dl_src=00:66:77:88:99:aa actions=drop
2277 idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=drop
2278 idle_timeout=70, in_port=2,dl_src=00:88:99:aa:bb:cc actions=drop
2279 idle_timeout=80, in_port=2,dl_src=00:99:aa:bb:cc:dd actions=drop
2280 in_port=2,dl_src=00:55:66:77:88:99 actions=drop
2283 # Reducing the flow limit also causes the flows that expire soonest
2284 # overall to be evicted.
2285 AT_CHECK([ovs-vsctl set Flow_Table evict flow-limit=4])
2286 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
2287 idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=drop
2288 idle_timeout=70, in_port=2,dl_src=00:88:99:aa:bb:cc actions=drop
2289 idle_timeout=80, in_port=2,dl_src=00:99:aa:bb:cc:dd actions=drop
2290 in_port=2,dl_src=00:55:66:77:88:99 actions=drop
2296 AT_SETUP([ofproto - eviction upon table overflow, with fairness (OpenFlow 1.2)])
2298 # Configure a maximum of 4 flows.
2301 -- --id=@t0 create Flow_Table name=evict flow-limit=4 \
2302 overflow-policy=evict \
2303 groups='"NXM_OF_IN_PORT[[]]"' \
2304 -- set bridge br0 flow_tables:0=@t0 \
2305 | ${PERL} $srcdir/uuidfilt.pl],
2309 ovs-ofctl -O OpenFlow12 add-flows br0 - <<EOF
2310 idle_timeout=10 in_port=2 dl_src=00:44:55:66:77:88 actions=drop
2311 idle_timeout=20 in_port=1 dl_src=00:11:22:33:44:55 actions=drop
2312 idle_timeout=30 in_port=1 dl_src=00:22:33:44:55:66 actions=drop
2313 idle_timeout=40 in_port=1 dl_src=00:33:44:55:66:77 actions=drop
2315 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
2316 idle_timeout=10, in_port=2,dl_src=00:44:55:66:77:88 actions=drop
2317 idle_timeout=20, in_port=1,dl_src=00:11:22:33:44:55 actions=drop
2318 idle_timeout=30, in_port=1,dl_src=00:22:33:44:55:66 actions=drop
2319 idle_timeout=40, in_port=1,dl_src=00:33:44:55:66:77 actions=drop
2320 OFPST_FLOW reply (OF1.2):
2322 # Adding another flow will cause the one that expires soonest within
2323 # the largest group (those with in_port=1) to be evicted. In this
2324 # case this is not the same as the one that expires soonest overall
2325 # (which is what makes the test interesting):
2326 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 in_port=2,dl_src=00:55:66:77:88:99,actions=drop])
2327 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
2328 idle_timeout=10, in_port=2,dl_src=00:44:55:66:77:88 actions=drop
2329 idle_timeout=30, in_port=1,dl_src=00:22:33:44:55:66 actions=drop
2330 idle_timeout=40, in_port=1,dl_src=00:33:44:55:66:77 actions=drop
2331 in_port=2,dl_src=00:55:66:77:88:99 actions=drop
2332 OFPST_FLOW reply (OF1.2):
2334 # Enlarge the flow limit, change the eviction policy back to strictly
2335 # based on expiration, and and add some flows.
2336 AT_CHECK([ovs-vsctl set Flow_Table evict groups='[[]]' flow-limit=7])
2337 ovs-ofctl -O OpenFlow12 add-flows br0 - <<EOF
2338 idle_timeout=50 in_port=2 dl_src=00:66:77:88:99:aa actions=drop
2339 idle_timeout=60 in_port=2 dl_src=00:77:88:99:aa:bb actions=drop
2340 idle_timeout=70 in_port=2 dl_src=00:88:99:aa:bb:cc actions=drop
2342 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
2343 idle_timeout=10, in_port=2,dl_src=00:44:55:66:77:88 actions=drop
2344 idle_timeout=30, in_port=1,dl_src=00:22:33:44:55:66 actions=drop
2345 idle_timeout=40, in_port=1,dl_src=00:33:44:55:66:77 actions=drop
2346 idle_timeout=50, in_port=2,dl_src=00:66:77:88:99:aa actions=drop
2347 idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=drop
2348 idle_timeout=70, in_port=2,dl_src=00:88:99:aa:bb:cc actions=drop
2349 in_port=2,dl_src=00:55:66:77:88:99 actions=drop
2350 OFPST_FLOW reply (OF1.2):
2352 # Adding another flow will cause the one that expires soonest overall
2354 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'])
2355 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
2356 idle_timeout=30, in_port=1,dl_src=00:22:33:44:55:66 actions=drop
2357 idle_timeout=40, in_port=1,dl_src=00:33:44:55:66:77 actions=drop
2358 idle_timeout=50, in_port=2,dl_src=00:66:77:88:99:aa actions=drop
2359 idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=drop
2360 idle_timeout=70, in_port=2,dl_src=00:88:99:aa:bb:cc actions=drop
2361 idle_timeout=80, in_port=2,dl_src=00:99:aa:bb:cc:dd actions=drop
2362 in_port=2,dl_src=00:55:66:77:88:99 actions=drop
2363 OFPST_FLOW reply (OF1.2):
2365 # Reducing the flow limit also causes the flows that expire soonest
2366 # overall to be evicted.
2367 AT_CHECK([ovs-vsctl set Flow_Table evict flow-limit=4])
2368 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
2369 idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=drop
2370 idle_timeout=70, in_port=2,dl_src=00:88:99:aa:bb:cc actions=drop
2371 idle_timeout=80, in_port=2,dl_src=00:99:aa:bb:cc:dd actions=drop
2372 in_port=2,dl_src=00:55:66:77:88:99 actions=drop
2373 OFPST_FLOW reply (OF1.2):
2378 AT_SETUP([ofproto - eviction upon table overflow, with modified hard timeout])
2380 # Configure a maximum of 4 flows.
2383 -- --id=@t0 create Flow_Table flow-limit=4 overflow-policy=evict \
2384 -- set bridge br0 flow_tables:0=@t0 \
2385 | ${PERL} $srcdir/uuidfilt.pl],
2388 ovs-appctl time/stop
2390 for in_port in 4 3 2 1; do
2391 ovs-ofctl add-flow br0 hard_timeout=$((10 + in_port * 3)),in_port=$in_port,actions=drop
2393 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
2394 hard_timeout=13, in_port=1 actions=drop
2395 hard_timeout=16, in_port=2 actions=drop
2396 hard_timeout=19, in_port=3 actions=drop
2397 hard_timeout=22, in_port=4 actions=drop
2400 # Sleep and modify the one that expires soonest
2401 ovs-appctl time/warp 5000
2402 AT_CHECK([ovs-ofctl mod-flows br0 in_port=1,actions=drop])
2403 # At this point the table would looks like:
2404 # in_port seconds to expire
2409 ovs-appctl time/warp 2000
2410 # Adding another flow will cause the one that expires soonest to be evicted.
2411 AT_CHECK([ovs-ofctl add-flow br0 in_port=5,actions=drop])
2412 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
2413 hard_timeout=13, in_port=1 actions=drop
2414 hard_timeout=19, in_port=3 actions=drop
2415 hard_timeout=22, in_port=4 actions=drop
2416 in_port=5 actions=drop
2422 AT_SETUP([ofproto - eviction upon table overflow, with modified idle timeout])
2423 OVS_VSWITCHD_START([add-port br0 p1 -- set interface p1 type=dummy ofport_request=1])
2424 # Configure a maximum of 4 flows.
2427 -- --id=@t0 create Flow_Table flow-limit=4 overflow-policy=evict \
2428 -- set bridge br0 flow_tables:0=@t0 \
2429 | ${PERL} $srcdir/uuidfilt.pl],
2433 for in_port in 4 3 2 1; do
2434 ovs-ofctl add-flow br0 idle_timeout=$((10 + in_port * 3)),in_port=$in_port,actions=drop
2436 ovs-appctl time/stop
2437 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
2438 idle_timeout=13, in_port=1 actions=drop
2439 idle_timeout=16, in_port=2 actions=drop
2440 idle_timeout=19, in_port=3 actions=drop
2441 idle_timeout=22, in_port=4 actions=drop
2444 # Sleep and receive on the flow that expires soonest
2445 ovs-appctl time/warp 5000
2446 AT_CHECK([ovs-appctl netdev-dummy/receive p1 'in_port(1)'])
2447 # At this point the table would looks like:
2448 # in_port seconds to expire
2453 ovs-appctl time/warp 2000
2454 # Adding another flow will cause the one that expires soonest to be evicted.
2455 AT_CHECK([ovs-ofctl add-flow br0 in_port=5,actions=drop])
2456 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
2457 idle_timeout=19, in_port=3 actions=drop
2458 idle_timeout=22, in_port=4 actions=drop
2459 in_port=5 actions=drop
2460 n_packets=1, n_bytes=60, idle_timeout=13, in_port=1 actions=drop
2466 AT_SETUP([ofproto - asynchronous message control (OpenFlow 1.0)])
2468 AT_CHECK([ovs-ofctl -P openflow10 monitor br0 --detach --no-chdir --pidfile])
2470 printf '\n\n--- check_async %d ---\n\n\n' $1
2473 ovs-appctl -t ovs-ofctl ofctl/barrier
2474 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
2477 # OFPT_PACKET_IN, OFPR_ACTION (controller_id=0)
2478 ovs-ofctl -v packet-out br0 controller controller '0001020304050010203040501234'
2479 if test X"$1" = X"OFPR_ACTION"; then shift;
2480 echo >>expout "OFPT_PACKET_IN: total_len=14 in_port=CONTROLLER (via action) data_len=14 (unbuffered)
2481 vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1234"
2484 # OFPT_PACKET_IN, OFPR_NO_MATCH (controller_id=123)
2485 ovs-ofctl -v packet-out br0 controller 'controller(reason=no_match,id=123)' '0001020304050010203040501234'
2486 if test X"$1" = X"OFPR_NO_MATCH"; then shift;
2487 echo >>expout "OFPT_PACKET_IN: total_len=14 in_port=CONTROLLER (via no_match) data_len=14 (unbuffered)
2488 vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1234"
2491 # OFPT_PACKET_IN, OFPR_INVALID_TTL (controller_id=0)
2492 ovs-ofctl packet-out br0 controller dec_ttl '002583dfb4000026b98cb0f908004500003eb7e200000011339bac11370dac100002d7730035002b8f6d86fb0100000100000000000006626c702d7873066e696369726103636f6d00000f00'
2493 if test X"$1" = X"OFPR_INVALID_TTL"; then shift;
2494 echo >>expout "OFPT_PACKET_IN: total_len=76 in_port=CONTROLLER (via invalid_ttl) data_len=76 (unbuffered)
2495 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"
2498 # OFPT_PORT_STATUS, OFPPR_ADD
2499 ovs-vsctl add-port br0 test -- set Interface test type=dummy ofport_request=1
2500 if test X"$1" = X"OFPPR_ADD"; then shift;
2501 echo >>expout "OFPT_PORT_STATUS: ADD: 1(test): addr:aa:55:aa:55:00:0x
2504 speed: 0 Mbps now, 0 Mbps max"
2507 # OFPT_PORT_STATUS, OFPPR_DELETE
2508 ovs-vsctl del-port br0 test
2509 if test X"$1" = X"OFPPR_DELETE"; then shift;
2510 echo >>expout "OFPT_PORT_STATUS: DEL: 1(test): addr:aa:55:aa:55:00:0x
2513 speed: 0 Mbps now, 0 Mbps max"
2516 # OFPT_FLOW_REMOVED, OFPRR_DELETE
2517 ovs-ofctl add-flow br0 send_flow_rem,actions=drop
2518 ovs-ofctl --strict del-flows br0 ''
2519 if test X"$1" = X"OFPRR_DELETE"; then shift;
2520 echo >>expout "OFPT_FLOW_REMOVED: reason=delete"
2522 AT_FAIL_IF([test X"$1" != X])
2524 ovs-appctl -t ovs-ofctl ofctl/barrier
2525 echo >>expout "OFPT_BARRIER_REPLY:"
2529 s/ (xid=0x[0-9a-fA-F]*)//
2531 s/00:0.$/00:0x/' < monitor.log]],
2535 # It's a service connection so initially there should be no async messages.
2538 # Set miss_send_len to 128, turning on packet-ins for our service connection.
2539 ovs-appctl -t ovs-ofctl ofctl/send 0109000c0123456700000080
2540 check_async 2 OFPR_ACTION OFPPR_ADD OFPPR_DELETE OFPRR_DELETE
2542 # Set miss_send_len to 128 and enable invalid_ttl.
2543 ovs-appctl -t ovs-ofctl ofctl/send 0109000c0123456700040080
2544 check_async 3 OFPR_ACTION OFPR_INVALID_TTL OFPPR_ADD OFPPR_DELETE OFPRR_DELETE
2546 # Become slave, which should disable everything except port status.
2547 ovs-appctl -t ovs-ofctl ofctl/send 0104001400000002000023200000000a00000002
2548 check_async 4 OFPPR_ADD OFPPR_DELETE
2550 # Use NXT_SET_ASYNC_CONFIG to enable a patchwork of asynchronous messages.
2551 ovs-appctl -t ovs-ofctl ofctl/send 01040028000000020000232000000013000000020000000500000005000000020000000200000005
2552 check_async 5 OFPR_INVALID_TTL OFPPR_DELETE OFPRR_DELETE
2554 # Set controller ID 123.
2555 ovs-appctl -t ovs-ofctl ofctl/send 01040018000000030000232000000014000000000000007b
2556 check_async 6 OFPR_NO_MATCH OFPPR_DELETE OFPRR_DELETE
2558 # Restore controller ID 0.
2559 ovs-appctl -t ovs-ofctl ofctl/send 010400180000000300002320000000140000000000000000
2562 ovs-appctl -t ovs-ofctl ofctl/send 0104001400000002000023200000000a00000001
2563 check_async 7 OFPR_ACTION OFPPR_ADD
2565 ovs-appctl -t ovs-ofctl exit
2569 AT_SETUP([ofproto - asynchronous message control (OpenFlow 1.2)])
2571 AT_CHECK([ovs-ofctl -O OpenFlow12 monitor br0 --detach --no-chdir --pidfile])
2573 printf '\n\n--- check_async %d ---\n\n\n' $1
2577 ovs-appctl -t ovs-ofctl ofctl/barrier
2578 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
2581 # OFPT_PACKET_IN, OFPR_ACTION (controller_id=0)
2582 ovs-ofctl -O OpenFlow12 -v packet-out br0 none controller '0001020304050010203040501234'
2583 if test X"$1" = X"OFPR_ACTION"; then shift;
2584 echo >>expout "OFPT_PACKET_IN (OF1.2): total_len=14 in_port=ANY (via action) data_len=14 (unbuffered)
2585 vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1234"
2588 # OFPT_PACKET_IN, OFPR_NO_MATCH (controller_id=123)
2589 ovs-ofctl -O OpenFlow12 -v packet-out br0 none 'controller(reason=no_match,id=123)' '0001020304050010203040501234'
2590 if test X"$1" = X"OFPR_NO_MATCH"; then shift;
2591 echo >>expout "OFPT_PACKET_IN (OF1.2): total_len=14 in_port=ANY (via no_match) data_len=14 (unbuffered)
2592 vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1234"
2595 # OFPT_PACKET_IN, OFPR_INVALID_TTL (controller_id=0)
2596 ovs-ofctl -O OpenFlow12 packet-out br0 none dec_ttl '002583dfb4000026b98cb0f908004500003eb7e200000011339bac11370dac100002d7730035002b8f6d86fb0100000100000000000006626c702d7873066e696369726103636f6d00000f00'
2597 if test X"$1" = X"OFPR_INVALID_TTL"; then shift;
2598 echo >>expout "OFPT_PACKET_IN (OF1.2): total_len=76 in_port=ANY (via invalid_ttl) data_len=76 (unbuffered)
2599 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"
2602 # OFPT_PORT_STATUS, OFPPR_ADD
2603 ovs-vsctl add-port br0 test -- set Interface test type=dummy
2604 if test X"$1" = X"OFPPR_ADD"; then shift;
2605 echo >>expout "OFPT_PORT_STATUS (OF1.2): ADD: ${INDEX}(test): addr:aa:55:aa:55:00:0x
2608 speed: 0 Mbps now, 0 Mbps max"
2611 # OFPT_PORT_STATUS, OFPPR_DELETE
2612 ovs-vsctl del-port br0 test
2613 if test X"$1" = X"OFPPR_DELETE"; then shift;
2614 echo >>expout "OFPT_PORT_STATUS (OF1.2): DEL: ${INDEX}(test): addr:aa:55:aa:55:00:0x
2617 speed: 0 Mbps now, 0 Mbps max"
2620 # OFPT_FLOW_REMOVED, OFPRR_DELETE
2621 ovs-ofctl -O OpenFlow12 add-flow br0 send_flow_rem,actions=drop
2622 ovs-ofctl -O OpenFlow12 --strict del-flows br0 ''
2623 if test X"$1" = X"OFPRR_DELETE"; then shift;
2624 echo >>expout "OFPT_FLOW_REMOVED (OF1.2): reason=delete table_id=0"
2626 AT_FAIL_IF([test X"$1" != X])
2632 s/ (xid=0x[0-9a-fA-F]*)//
2634 s/00:0.$/00:0x/' < monitor.log]],
2638 # It's a service connection so initially there should be no async messages.
2641 # Set miss_send_len to 128, turning on packet-ins for our service connection.
2642 ovs-appctl -t ovs-ofctl ofctl/send 0309000c0123456700000080
2643 check_async 2 OFPR_ACTION OFPPR_ADD OFPPR_DELETE OFPRR_DELETE
2645 # Set miss_send_len to 128 and enable invalid_ttl.
2646 ovs-appctl -t ovs-ofctl ofctl/send 0309000c0123456700040080
2647 check_async 3 OFPR_ACTION OFPR_INVALID_TTL OFPPR_ADD OFPPR_DELETE OFPRR_DELETE
2649 # Become slave (OF 1.2), which should disable everything except port status.
2650 ovs-appctl -t ovs-ofctl ofctl/send 031800180000000200000003000000000000000000000001
2651 check_async 4 OFPPR_ADD OFPPR_DELETE
2653 # Use NXT_SET_ASYNC_CONFIG to enable a patchwork of asynchronous messages.
2654 ovs-appctl -t ovs-ofctl ofctl/send 03040028000000020000232000000013000000020000000500000005000000020000000200000005
2655 check_async 5 OFPR_INVALID_TTL OFPPR_DELETE OFPRR_DELETE
2657 # Set controller ID 123.
2658 ovs-appctl -t ovs-ofctl ofctl/send 03040018000000030000232000000014000000000000007b
2659 check_async 6 OFPR_NO_MATCH OFPPR_DELETE OFPRR_DELETE
2661 # Restore controller ID 0.
2662 ovs-appctl -t ovs-ofctl ofctl/send 030400180000000300002320000000140000000000000000
2664 # Become master (OF 1.2).
2665 ovs-appctl -t ovs-ofctl ofctl/send 031800180000000400000002000000000000000000000002
2666 check_async 7 OFPR_ACTION OFPPR_ADD
2668 ovs-appctl -t ovs-ofctl exit
2672 AT_SETUP([ofproto - asynchronous message control (OpenFlow 1.3)])
2674 AT_CHECK([ovs-ofctl -O OpenFlow13 monitor br0 --detach --no-chdir --pidfile])
2676 printf '\n\n--- check_async %d ---\n\n\n' $1
2680 ovs-appctl -t ovs-ofctl ofctl/barrier
2681 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
2684 # OFPT_PACKET_IN, OFPR_ACTION (controller_id=0)
2685 ovs-ofctl -O OpenFlow13 -v packet-out br0 none controller '0001020304050010203040501234'
2686 if test X"$1" = X"OFPR_ACTION"; then shift;
2687 echo >>expout "OFPT_PACKET_IN (OF1.3): total_len=14 in_port=ANY (via action) data_len=14 (unbuffered)
2688 vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1234"
2691 # OFPT_PACKET_IN, OFPR_NO_MATCH (controller_id=123)
2692 ovs-ofctl -O OpenFlow13 -v packet-out br0 none 'controller(reason=no_match,id=123)' '0001020304050010203040501234'
2693 if test X"$1" = X"OFPR_NO_MATCH"; then shift;
2694 echo >>expout "OFPT_PACKET_IN (OF1.3): total_len=14 in_port=ANY (via no_match) data_len=14 (unbuffered)
2695 vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1234"
2698 # OFPT_PACKET_IN, OFPR_INVALID_TTL (controller_id=0)
2699 ovs-ofctl -O OpenFlow13 packet-out br0 none dec_ttl '002583dfb4000026b98cb0f908004500003eb7e200000011339bac11370dac100002d7730035002b8f6d86fb0100000100000000000006626c702d7873066e696369726103636f6d00000f00'
2700 if test X"$1" = X"OFPR_INVALID_TTL"; then shift;
2701 echo >>expout "OFPT_PACKET_IN (OF1.3): total_len=76 in_port=ANY (via invalid_ttl) data_len=76 (unbuffered)
2702 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"
2705 # OFPT_PORT_STATUS, OFPPR_ADD
2706 ovs-vsctl add-port br0 test -- set Interface test type=dummy
2707 if test X"$1" = X"OFPPR_ADD"; then shift;
2708 echo >>expout "OFPT_PORT_STATUS (OF1.3): ADD: ${INDEX}(test): addr:aa:55:aa:55:00:0x
2711 speed: 0 Mbps now, 0 Mbps max"
2714 # OFPT_PORT_STATUS, OFPPR_DELETE
2715 ovs-vsctl del-port br0 test
2716 if test X"$1" = X"OFPPR_DELETE"; then shift;
2717 echo >>expout "OFPT_PORT_STATUS (OF1.3): DEL: ${INDEX}(test): addr:aa:55:aa:55:00:0x
2720 speed: 0 Mbps now, 0 Mbps max"
2723 # OFPT_FLOW_REMOVED, OFPRR_DELETE
2724 ovs-ofctl -O OpenFlow13 add-flow br0 send_flow_rem,actions=drop
2725 ovs-ofctl -O OpenFlow13 --strict del-flows br0 ''
2726 if test X"$1" = X"OFPRR_DELETE"; then shift;
2727 echo >>expout "OFPT_FLOW_REMOVED (OF1.3): reason=delete table_id=0"
2730 # OFPT_FLOW_REMOVED, OFPRR_GROUP_DELETE
2731 ovs-ofctl -O OpenFlow13 add-group br0 group_id=1234,type=all,bucket=output:10
2732 ovs-ofctl -O OpenFlow13 add-flow br0 send_flow_rem,actions=group:1234
2733 ovs-ofctl -O OpenFlow13 --strict del-groups br0 group_id=1234
2734 if test X"$1" = X"OFPRR_DELETE"; then shift;
2735 echo >>expout "OFPT_FLOW_REMOVED (OF1.3): reason=gropu_delete table_id=0"
2738 AT_FAIL_IF([test X"$1" != X])
2740 ovs-appctl -t ovs-ofctl ofctl/barrier
2741 echo >>expout "OFPT_BARRIER_REPLY (OF1.3):"
2745 s/ (xid=0x[0-9a-fA-F]*)//
2747 s/00:0.$/00:0x/' < monitor.log]],
2751 # It's a service connection so initially there should be no async messages.
2754 # Set miss_send_len to 128, turning on packet-ins for our service connection.
2755 ovs-appctl -t ovs-ofctl ofctl/send 0409000c0123456700000080
2756 check_async 2 OFPR_ACTION OFPPR_ADD OFPPR_DELETE OFPRR_DELETE
2758 # Become slave (OF 1.3), which should disable everything except port status.
2759 ovs-appctl -t ovs-ofctl ofctl/send 041800180000000200000003000000000000000000000001
2760 check_async 3 OFPPR_ADD OFPPR_DELETE
2762 # Use OF 1.3 OFPT_SET_ASYNC to enable a patchwork of asynchronous messages.
2763 ovs-appctl -t ovs-ofctl ofctl/send 041c002000000002000000020000000500000005000000020000000200000005
2764 check_async 4 OFPR_INVALID_TTL OFPPR_DELETE OFPRR_DELETE
2766 # Set controller ID 123.
2767 ovs-appctl -t ovs-ofctl ofctl/send 04040018000000030000232000000014000000000000007b
2768 check_async 5 OFPR_NO_MATCH OFPPR_DELETE OFPRR_DELETE
2770 # Restore controller ID 0.
2771 ovs-appctl -t ovs-ofctl ofctl/send 040400180000000300002320000000140000000000000000
2773 # Become master (OF 1.3).
2774 ovs-appctl -t ovs-ofctl ofctl/send 041800180000000400000002000000000000000000000002
2775 check_async 6 OFPR_ACTION OFPPR_ADD
2777 ovs-appctl -t ovs-ofctl exit
2781 AT_SETUP([ofproto - asynchronous message control (OpenFlow 1.4)])
2783 AT_CHECK([ovs-ofctl -O OpenFlow14 monitor br0 --detach --no-chdir --pidfile])
2785 printf '\n\n--- check_async %d ---\n\n\n' $1
2789 ovs-appctl -t ovs-ofctl ofctl/barrier
2790 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
2793 # OFPT_PACKET_IN, OFPR_ACTION (controller_id=0)
2794 ovs-ofctl -O OpenFlow14 -v packet-out br0 none controller '0001020304050010203040501234'
2795 if test X"$1" = X"OFPR_ACTION"; then shift;
2796 echo >>expout "OFPT_PACKET_IN (OF1.4): total_len=14 in_port=ANY (via action) data_len=14 (unbuffered)
2797 vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1234"
2800 # OFPT_PACKET_IN, OFPR_NO_MATCH (controller_id=123)
2801 ovs-ofctl -O OpenFlow14 -v packet-out br0 none 'controller(reason=no_match,id=123)' '0001020304050010203040501234'
2802 if test X"$1" = X"OFPR_NO_MATCH"; then shift;
2803 echo >>expout "OFPT_PACKET_IN (OF1.4): total_len=14 in_port=ANY (via no_match) data_len=14 (unbuffered)
2804 vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1234"
2807 # OFPT_PACKET_IN, OFPR_INVALID_TTL (controller_id=0)
2808 ovs-ofctl -O OpenFlow14 packet-out br0 none dec_ttl '002583dfb4000026b98cb0f908004500003eb7e200000011339bac11370dac100002d7730035002b8f6d86fb0100000100000000000006626c702d7873066e696369726103636f6d00000f00'
2809 if test X"$1" = X"OFPR_INVALID_TTL"; then shift;
2810 echo >>expout "OFPT_PACKET_IN (OF1.4): total_len=76 in_port=ANY (via invalid_ttl) data_len=76 (unbuffered)
2811 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"
2814 # OFPT_PORT_STATUS, OFPPR_ADD
2815 ovs-vsctl add-port br0 test -- set Interface test type=dummy
2816 if test X"$1" = X"OFPPR_ADD"; then shift;
2817 echo >>expout "OFPT_PORT_STATUS (OF1.4): ADD: ${INDEX}(test): addr:aa:55:aa:55:00:0x
2820 speed: 0 Mbps now, 0 Mbps max"
2823 # OFPT_PORT_STATUS, OFPPR_MODIFY
2824 ovs-ofctl -O OpenFlow14 -vwarn mod-port br0 test up
2825 if test X"$1" = X"OFPPR_MODIFY"; then shift;
2826 echo >>expout "OFPT_PORT_STATUS (OF1.4): MOD: ${INDEX}(test): addr:aa:55:aa:55:00:0x
2829 speed: 0 Mbps now, 0 Mbps max
2830 OFPT_PORT_STATUS (OF1.4): MOD: ${INDEX}(test): addr:aa:55:aa:55:00:0x
2833 speed: 0 Mbps now, 0 Mbps max"
2836 # OFPT_PORT_STATUS, OFPPR_DELETE
2837 ovs-vsctl del-port br0 test
2838 if test X"$1" = X"OFPPR_DELETE"; then shift;
2839 echo >>expout "OFPT_PORT_STATUS (OF1.4): DEL: ${INDEX}(test): addr:aa:55:aa:55:00:0x
2842 speed: 0 Mbps now, 0 Mbps max"
2845 # OFPT_FLOW_REMOVED, OFPRR_DELETE
2846 ovs-ofctl -O OpenFlow14 add-flow br0 send_flow_rem,actions=drop
2847 ovs-ofctl -O OpenFlow14 --strict del-flows br0 ''
2848 if test X"$1" = X"OFPRR_DELETE"; then shift;
2849 echo >>expout "OFPT_FLOW_REMOVED (OF1.4): reason=delete table_id=0"
2852 # OFPT_FLOW_REMOVED, OFPRR_GROUP_DELETE
2853 ovs-ofctl -O OpenFlow14 add-group br0 group_id=1234,type=all,bucket=output:10
2854 ovs-ofctl -O OpenFlow14 add-flow br0 send_flow_rem,actions=group:1234
2855 ovs-ofctl -O OpenFlow14 --strict del-groups br0 group_id=1234
2856 if test X"$1" = X"OFPRR_GROUP_DELETE"; then shift;
2857 echo >>expout "OFPT_FLOW_REMOVED (OF1.4): reason=group_delete table_id=0"
2860 AT_FAIL_IF([test X"$1" != X])
2862 ovs-appctl -t ovs-ofctl ofctl/barrier
2863 echo >>expout "OFPT_BARRIER_REPLY (OF1.4):"
2867 s/ (xid=0x[0-9a-fA-F]*)//
2869 s/00:0.$/00:0x/' < monitor.log]],
2873 # It's a service connection so initially there should be no async messages.
2876 # Set miss_send_len to 128, turning on packet-ins for our service connection.
2877 ovs-appctl -t ovs-ofctl ofctl/send 0509000c0123456700000080
2878 check_async 2 OFPR_ACTION OFPPR_ADD OFPPR_MODIFY OFPPR_DELETE OFPRR_DELETE OFPRR_GROUP_DELETE
2880 # Become slave (OF 1.4), which should disable everything except port status.
2881 ovs-appctl -t ovs-ofctl ofctl/send 051800180000000200000003000000000000000000000001
2882 check_async 3 OFPPR_ADD OFPPR_MODIFY OFPPR_DELETE
2884 # Use OF 1.4 OFPT_SET_ASYNC to enable a patchwork of asynchronous messages.
2885 ovs-appctl -t ovs-ofctl ofctl/send 051c0038000000020000000800000005000100080000000200020008000000020003000800000005000400080000001c0005000800000005
2886 check_async 4 OFPR_INVALID_TTL OFPPR_DELETE OFPRR_DELETE OFPRR_GROUP_DELETE
2888 # Set controller ID 123.
2889 ovs-appctl -t ovs-ofctl ofctl/send 05040018000000030000232000000014000000000000007b
2890 check_async 5 OFPR_NO_MATCH OFPPR_DELETE OFPRR_DELETE OFPRR_GROUP_DELETE
2892 # Restore controller ID 0.
2893 ovs-appctl -t ovs-ofctl ofctl/send 050400180000000300002320000000140000000000000000
2895 # Become master (OF 1.4).
2896 ovs-appctl -t ovs-ofctl ofctl/send 051800180000000400000002000000000000000000000002
2897 check_async 6 OFPR_ACTION OFPPR_ADD OFPPR_MODIFY OFPRR_DELETE
2899 ovs-appctl -t ovs-ofctl exit
2903 AT_SETUP([ofproto - asynchronous message control (OpenFlow 1.5)])
2905 AT_CHECK([ovs-ofctl -O OpenFlow15 monitor br0 --detach --no-chdir --pidfile])
2907 printf '\n\n--- check_async %d ---\n\n\n' $1
2911 ovs-appctl -t ovs-ofctl ofctl/barrier
2912 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
2915 # Other tests are not working with OF 1.5, and message
2916 # format may change, so leave them out.
2918 # OFPT_PORT_STATUS, OFPPR_ADD
2919 ovs-vsctl add-port br0 test -- set Interface test type=dummy
2920 if test X"$1" = X"OFPPR_ADD"; then shift;
2921 echo >>expout "OFPT_PORT_STATUS (OF1.5): ADD: ${INDEX}(test): addr:aa:55:aa:55:00:0x
2924 speed: 0 Mbps now, 0 Mbps max"
2927 # OFPT_PORT_STATUS, OFPPR_MODIFY
2928 ovs-ofctl -O OpenFlow15 -vwarn mod-port br0 test up
2929 if test X"$1" = X"OFPPR_MODIFY"; then shift;
2930 echo >>expout "OFPT_PORT_STATUS (OF1.5): MOD: ${INDEX}(test): addr:aa:55:aa:55:00:0x
2933 speed: 0 Mbps now, 0 Mbps max
2934 OFPT_PORT_STATUS (OF1.5): MOD: 2(test): addr:aa:55:aa:55:00:0x
2937 speed: 0 Mbps now, 0 Mbps max"
2940 # OFPT_PORT_STATUS, OFPPR_DELETE
2941 ovs-vsctl del-port br0 test
2942 if test X"$1" = X"OFPPR_DELETE"; then shift;
2943 echo >>expout "OFPT_PORT_STATUS (OF1.5): DEL: ${INDEX}(test): addr:aa:55:aa:55:00:0x
2946 speed: 0 Mbps now, 0 Mbps max"
2949 AT_FAIL_IF([test X"$1" != X])
2951 ovs-appctl -t ovs-ofctl ofctl/barrier
2952 echo >>expout "OFPT_BARRIER_REPLY (OF1.5):"
2956 s/ (xid=0x[0-9a-fA-F]*)//
2958 s/00:0.$/00:0x/' < monitor.log]],
2962 # It's a service connection so initially there should be no async messages.
2965 # If we don't set this, async messages are not received.
2966 # Set miss_send_len to 128, turning on packet-ins for our service connection.
2967 ovs-appctl -t ovs-ofctl ofctl/send 0609000c0123456700000080
2968 check_async 2 OFPPR_ADD OFPPR_MODIFY OFPPR_DELETE
2970 # Set-async has changed in OF 1.4 and is not yet implemented.
2972 ovs-appctl -t ovs-ofctl exit
2976 dnl This test checks that the role request/response messaging works
2977 dnl and that generation_id is handled properly.
2978 AT_SETUP([ofproto - controller role (OpenFlow 1.2)])
2980 on_exit 'kill `cat c1.pid c2.pid`'
2982 # Start two ovs-ofctl controller processes.
2983 AT_CAPTURE_FILE([monitor1.log])
2984 AT_CAPTURE_FILE([expout1])
2985 AT_CAPTURE_FILE([experr1])
2986 AT_CAPTURE_FILE([monitor2.log])
2987 AT_CAPTURE_FILE([expout2])
2988 AT_CAPTURE_FILE([experr2])
2990 AT_CHECK([ovs-ofctl -O OpenFlow12 monitor br0 --detach --no-chdir --pidfile=`pwd`/c$i.pid --unixctl=`pwd`/c$i])
2991 ovs-appctl -t `pwd`/c$i ofctl/barrier
2992 ovs-appctl -t `pwd`/c$i ofctl/set-output-file monitor$i.log
2996 # find out current role
2997 ovs-appctl -t `pwd`/c$i ofctl/send 031800180000000200000000000000000000000000000000
2998 echo >>experr$i "send: OFPT_ROLE_REQUEST (OF1.2): role=nochange"
2999 echo >>expout$i "OFPT_ROLE_REPLY (OF1.2): role=equal"
3002 # controller 1: Become slave (generation_id is initially undefined, so
3003 # 2^63+2 should not be stale)
3004 ovs-appctl -t `pwd`/c1 ofctl/send 031800180000000300000003000000008000000000000002
3005 echo >>experr1 "send: OFPT_ROLE_REQUEST (OF1.2): role=slave generation_id=9223372036854775810"
3006 echo >>expout1 "OFPT_ROLE_REPLY (OF1.2): role=slave generation_id=9223372036854775810"
3008 # controller 2: Become master.
3009 ovs-appctl -t `pwd`/c2 ofctl/send 031800180000000300000002000000008000000000000003
3010 echo >>experr2 "send: OFPT_ROLE_REQUEST (OF1.2): role=master generation_id=9223372036854775811"
3011 echo >>expout2 "OFPT_ROLE_REPLY (OF1.2): role=master generation_id=9223372036854775811"
3013 # controller 1: Try to become the master using a stale generation ID
3014 ovs-appctl -t `pwd`/c1 ofctl/send 031800180000000400000002000000000000000000000003
3015 echo >>experr1 "send: OFPT_ROLE_REQUEST (OF1.2): role=master generation_id=3"
3016 echo >>expout1 "OFPT_ERROR (OF1.2): OFPRRFC_STALE"
3017 echo >>expout1 "OFPT_ROLE_REQUEST (OF1.2): role=master generation_id=3"
3019 # controller 1: Become master using a valid generation ID
3020 ovs-appctl -t `pwd`/c1 ofctl/send 031800180000000500000002000000000000000000000001
3021 echo >>experr1 "send: OFPT_ROLE_REQUEST (OF1.2): role=master generation_id=1"
3022 echo >>expout1 "OFPT_ROLE_REPLY (OF1.2): role=master generation_id=1"
3025 ovs-appctl -t `pwd`/c$i ofctl/barrier
3026 echo >>expout$i "OFPT_BARRIER_REPLY (OF1.2):"
3032 AT_CHECK([grep -v '^send:' monitor$i.log | STRIP_XIDS], [0], [expout])
3034 AT_CHECK([grep '^send:' monitor$i.log | STRIP_XIDS], [0], [expout])
3039 dnl This test checks that the role request/response messaging works,
3040 dnl that generation_id is handled properly, and that role status update
3041 dnl messages are sent when a controller's role gets changed from master
3043 AT_SETUP([ofproto - controller role (OpenFlow 1.4)])
3045 on_exit 'kill `cat c1.pid c2.pid`'
3047 # Start two ovs-ofctl controller processes.
3048 AT_CAPTURE_FILE([monitor1.log])
3049 AT_CAPTURE_FILE([expout1])
3050 AT_CAPTURE_FILE([experr1])
3051 AT_CAPTURE_FILE([monitor2.log])
3052 AT_CAPTURE_FILE([expout2])
3053 AT_CAPTURE_FILE([experr2])
3055 AT_CHECK([ovs-ofctl -O OpenFlow14 monitor br0 --detach --no-chdir --pidfile=`pwd`/c$i.pid --unixctl=`pwd`/c$i])
3056 ovs-appctl -t `pwd`/c$i ofctl/barrier
3057 ovs-appctl -t `pwd`/c$i ofctl/set-output-file monitor$i.log
3061 # find out current role
3062 ovs-appctl -t `pwd`/c$i ofctl/send 051800180000000200000000000000000000000000000000
3063 echo >>experr$i "send: OFPT_ROLE_REQUEST (OF1.4): role=nochange"
3064 echo >>expout$i "OFPT_ROLE_REPLY (OF1.4): role=equal"
3067 # controller 1: Become slave (generation_id is initially undefined, so
3068 # 2^63+2 should not be stale)
3069 ovs-appctl -t `pwd`/c1 ofctl/send 051800180000000300000003000000008000000000000002
3070 echo >>experr1 "send: OFPT_ROLE_REQUEST (OF1.4): role=slave generation_id=9223372036854775810"
3071 echo >>expout1 "OFPT_ROLE_REPLY (OF1.4): role=slave generation_id=9223372036854775810"
3073 # controller 2: Become master.
3074 ovs-appctl -t `pwd`/c2 ofctl/send 051800180000000300000002000000008000000000000003
3075 echo >>experr2 "send: OFPT_ROLE_REQUEST (OF1.4): role=master generation_id=9223372036854775811"
3076 echo >>expout2 "OFPT_ROLE_REPLY (OF1.4): role=master generation_id=9223372036854775811"
3078 # controller 1: Try to become the master using a stale generation ID
3079 ovs-appctl -t `pwd`/c1 ofctl/send 051800180000000400000002000000000000000000000003
3080 echo >>experr1 "send: OFPT_ROLE_REQUEST (OF1.4): role=master generation_id=3"
3081 echo >>expout1 "OFPT_ERROR (OF1.4): OFPRRFC_STALE"
3082 echo >>expout1 "OFPT_ROLE_REQUEST (OF1.4): role=master generation_id=3"
3084 # controller 1: Become master using a valid generation ID
3085 ovs-appctl -t `pwd`/c1 ofctl/send 051800180000000500000002000000000000000000000001
3086 echo >>experr1 "send: OFPT_ROLE_REQUEST (OF1.4): role=master generation_id=1"
3087 echo >>expout1 "OFPT_ROLE_REPLY (OF1.4): role=master generation_id=1"
3088 echo >>expout2 "OFPT_ROLE_STATUS (OF1.4): role=slave generation_id=1 reason=master_request"
3091 ovs-appctl -t `pwd`/c$i ofctl/barrier
3092 echo >>expout$i "OFPT_BARRIER_REPLY (OF1.4):"
3098 AT_CHECK([grep -v '^send:' monitor$i.log | STRIP_XIDS], [0], [expout])
3100 AT_CHECK([grep '^send:' monitor$i.log | STRIP_XIDS], [0], [expout])
3105 dnl This test checks the Group and meter notifications when a group mod
3106 dnl command is sent from one controller and the reply is received by
3107 dnl other controllers.
3108 AT_SETUP([ofproto - requestforward (OpenFlow 1.4)])
3110 on_exit 'kill `cat c1.pid c2.pid c3.pid`'
3112 # Start two ovs-ofctl controller processes.
3113 AT_CAPTURE_FILE([monitor1.log])
3114 AT_CAPTURE_FILE([expout1])
3115 AT_CAPTURE_FILE([monitor2.log])
3116 AT_CAPTURE_FILE([expout2])
3117 AT_CAPTURE_FILE([monitor3.log])
3118 AT_CAPTURE_FILE([expout3])
3120 ovs-ofctl -O OpenFlow15 monitor br0 --detach --no-chdir --pidfile=`pwd`/c1.pid --unixctl=`pwd`/c1
3121 ovs-ofctl -O OpenFlow14 monitor br0 --detach --no-chdir --pidfile=`pwd`/c2.pid --unixctl=`pwd`/c2
3122 ovs-ofctl -O OpenFlow14 monitor br0 --detach --no-chdir --pidfile=`pwd`/c3.pid --unixctl=`pwd`/c3
3126 ovs-appctl -t `pwd`/c$i ofctl/barrier
3127 ovs-appctl -t `pwd`/c$i ofctl/set-output-file monitor$i.log
3131 printf '\n\n--- check_async %d ---\n\n\n' $1
3136 ovs-appctl -t `pwd`/c2 ofctl/send 050f0010000000020000000000000001
3137 if test X"$1" = X"OFPGC_ADD"; then shift;
3138 echo >>expout2 "send: OFPT_GROUP_MOD (OF1.4):
3139 ADD group_id=1,type=all"
3140 echo >>expout1 "OFPT_REQUESTFORWARD (OF1.5): reason=group_mod
3141 ADD group_id=1,type=all"
3142 echo >>expout3 "OFPT_REQUESTFORWARD (OF1.4): reason=group_mod
3143 ADD group_id=1,type=all"
3147 ovs-appctl -t `pwd`/c2 ofctl/send 050f0010000000020001010000000001
3148 if test X"$1" = X"OFPGC_MODIFY"; then shift;
3149 echo >>expout2 "send: OFPT_GROUP_MOD (OF1.4):
3150 MOD group_id=1,type=select"
3151 echo >>expout1 "OFPT_REQUESTFORWARD (OF1.5): reason=group_mod
3152 MOD group_id=1,type=select"
3153 echo >>expout3 "OFPT_REQUESTFORWARD (OF1.4): reason=group_mod
3154 MOD group_id=1,type=select"
3157 ovs-appctl -t `pwd`/c1 ofctl/barrier
3158 echo >>expout1 "OFPT_BARRIER_REPLY (OF1.5):"
3159 ovs-appctl -t `pwd`/c2 ofctl/barrier
3160 echo >>expout2 "OFPT_BARRIER_REPLY (OF1.4):"
3161 ovs-appctl -t `pwd`/c3 ofctl/barrier
3162 echo >>expout3 "OFPT_BARRIER_REPLY (OF1.4):"
3169 s/ (xid=0x[0-9a-fA-F]*)//'< monitor$i.log]],
3174 # controller 1: Become slave
3175 ovs-appctl -t `pwd`/c1 ofctl/send 061800180000000300000003000000008000000000000002
3177 # controller 2: Become master
3178 ovs-appctl -t `pwd`/c2 ofctl/send 051800180000000300000002000000008000000000000003
3180 # controller 1: Become slave
3181 ovs-appctl -t `pwd`/c3 ofctl/send 051800180000000300000003000000008000000000000004
3183 # controller 1: Enabled requestforward using set Asynchronous message
3184 ovs-appctl -t `pwd`/c1 ofctl/send 061c00280000000200000008000000050002000800000002000400080000001a000a000800000003
3186 # controller 2: Enabled requestforward using set Asynchronous message
3187 ovs-appctl -t `pwd`/c2 ofctl/send 051c002800000002000100080000000200030008000000050005000800000005000b000800000003
3189 # controller 1: Enabled requestforward using set Asynchronous message
3190 ovs-appctl -t `pwd`/c3 ofctl/send 051c00280000000200000008000000050002000800000002000400080000001a000a000800000003
3191 check_async 1 OFPGC_ADD OFPGC_MODIFY
3196 dnl This test checks that OFPT_PACKET_OUT accepts both OFPP_NONE (as
3197 dnl specified by OpenFlow 1.0) and OFPP_CONTROLLER (used by some
3198 dnl controllers despite the spec) as meaning a packet that was generated
3199 dnl by the controller.
3200 AT_SETUP([ofproto - packet-out from controller (OpenFlow 1.0)])
3202 ADD_OF_PORTS([br0], [1])
3204 # Start a monitor listening for packet-ins.
3205 AT_CHECK([ovs-ofctl -P openflow10 monitor br0 --detach --no-chdir --pidfile])
3206 ovs-appctl -t ovs-ofctl ofctl/send 0109000c0123456700000080
3207 ovs-appctl -t ovs-ofctl ofctl/barrier
3208 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
3209 AT_CAPTURE_FILE([monitor.log])
3211 # Send some packet-outs with OFPP_NONE and OFPP_CONTROLLER (65533) as in_port.
3212 AT_CHECK([ovs-ofctl packet-out br0 none controller,1 '0001020304050010203040501234'])
3213 AT_CHECK([ovs-ofctl packet-out br0 controller controller,1 '0001020304050010203040505678'])
3215 # Stop the monitor and check its output.
3216 ovs-appctl -t ovs-ofctl ofctl/barrier
3217 ovs-appctl -t ovs-ofctl exit
3219 ovs-ofctl dump-ports br0
3221 AT_CHECK([sed 's/ (xid=0x[[0-9a-fA-F]]*)//' monitor.log], [0], [dnl
3222 OFPT_PACKET_IN: total_len=14 in_port=ANY (via action) data_len=14 (unbuffered)
3223 vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1234
3224 OFPT_PACKET_IN: total_len=14 in_port=CONTROLLER (via action) data_len=14 (unbuffered)
3225 vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x5678
3232 dnl This test checks that OFPT_PACKET_OUT accepts both OFPP_NONE (as
3233 dnl specified by OpenFlow 1.2) and OFPP_CONTROLLER (used by some
3234 dnl controllers despite the spec) as meaning a packet that was generated
3235 dnl by the controller.
3236 AT_SETUP([ofproto - packet-out from controller (OpenFlow 1.2)])
3239 # Start a monitor listening for packet-ins.
3240 AT_CHECK([ovs-ofctl -O OpenFlow12 monitor br0 --detach --no-chdir --pidfile])
3241 ovs-appctl -t ovs-ofctl ofctl/send 0309000c0123456700000080
3242 ovs-appctl -t ovs-ofctl ofctl/barrier
3243 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
3244 AT_CAPTURE_FILE([monitor.log])
3246 # Send some packet-outs with OFPP_NONE and OFPP_CONTROLLER (65533) as in_port.
3247 AT_CHECK([ovs-ofctl -O OpenFlow12 packet-out br0 none controller '0001020304050010203040501234'])
3248 AT_CHECK([ovs-ofctl -O OpenFlow12 packet-out br0 4294967293 controller '0001020304050010203040505678'])
3250 # Stop the monitor and check its output.
3251 ovs-appctl -t ovs-ofctl ofctl/barrier
3252 ovs-appctl -t ovs-ofctl exit
3254 AT_CHECK([sed 's/ (xid=0x[[0-9a-fA-F]]*)//' monitor.log], [0], [dnl
3255 OFPT_PACKET_IN (OF1.2): total_len=14 in_port=ANY (via action) data_len=14 (unbuffered)
3256 vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1234
3257 OFPT_PACKET_IN (OF1.2): total_len=14 in_port=CONTROLLER (via action) data_len=14 (unbuffered)
3258 vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x5678
3259 OFPT_BARRIER_REPLY (OF1.2):
3265 dnl This test checks that OFPT_PACKET_OUT accepts both OFPP_NONE (as
3266 dnl specified by OpenFlow 1.1) and OFPP_CONTROLLER (used by some
3267 dnl controllers despite the spec) as meaning a packet that was generated
3268 dnl by the controller.
3269 AT_SETUP([ofproto - packet-out from controller (OpenFlow 1.1)])
3272 # Start a monitor listening for packet-ins.
3273 AT_CHECK([ovs-ofctl -O OpenFlow11 monitor br0 --detach --no-chdir --pidfile])
3274 ovs-appctl -t ovs-ofctl ofctl/send 0209000c0123456700000080
3275 ovs-appctl -t ovs-ofctl ofctl/barrier
3276 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
3277 AT_CAPTURE_FILE([monitor.log])
3279 # Send some packet-outs with OFPP_NONE and OFPP_CONTROLLER (65533) as in_port.
3280 AT_CHECK([ovs-ofctl -O OpenFlow11 packet-out br0 none controller '0001020304050010203040501234'])
3281 AT_CHECK([ovs-ofctl -O OpenFlow11 packet-out br0 4294967293 controller '0001020304050010203040505678'])
3283 # Stop the monitor and check its output.
3284 ovs-appctl -t ovs-ofctl ofctl/barrier
3285 ovs-appctl -t ovs-ofctl exit
3287 AT_CHECK([sed 's/ (xid=0x[[0-9a-fA-F]]*)//' monitor.log], [0], [dnl
3288 OFPT_PACKET_IN (OF1.1): total_len=14 in_port=ANY (via action) data_len=14 (unbuffered)
3289 vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1234
3290 OFPT_PACKET_IN (OF1.1): total_len=14 in_port=CONTROLLER (via action) data_len=14 (unbuffered)
3291 vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x5678
3292 OFPT_BARRIER_REPLY (OF1.1):
3298 dnl This test checks that metadata is encoded in packet_in structures,
3299 dnl supported by NXAST.
3300 AT_SETUP([ofproto - packet-out with metadata (NXM)])
3303 # Start a monitor listening for packet-ins.
3304 AT_CHECK([ovs-ofctl -P nxm monitor br0 --detach --no-chdir --pidfile])
3305 ovs-appctl -t ovs-ofctl ofctl/send 0109000c0123456700000080
3306 ovs-appctl -t ovs-ofctl ofctl/barrier
3307 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
3308 AT_CAPTURE_FILE([monitor.log])
3310 # Send a packet-out with a load action to set some metadata, and forward to controller
3311 AT_CHECK([ovs-ofctl packet-out br0 controller 'load(0xfafafafa5a5a5a5a->OXM_OF_METADATA[[0..63]]), load(0xaa->NXM_NX_PKT_MARK[[]]), controller' '0001020304050010203040501234'])
3313 # Stop the monitor and check its output.
3314 ovs-appctl -t ovs-ofctl ofctl/barrier
3315 ovs-appctl -t ovs-ofctl exit
3317 AT_CHECK([sed 's/ (xid=0x[[0-9a-fA-F]]*)//' monitor.log], [0], [dnl
3318 NXT_PACKET_IN: total_len=14 pkt_mark=0xaa,metadata=0xfafafafa5a5a5a5a,in_port=CONTROLLER (via action) data_len=14 (unbuffered)
3319 vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1234
3326 dnl This test checks that metadata is encoded in packet_in structures,
3327 dnl supported by NXAST.
3328 AT_SETUP([ofproto - packet-out with metadata (OpenFlow 1.2)])
3331 # Start a monitor listening for packet-ins.
3332 AT_CHECK([ovs-ofctl -O OpenFlow12 monitor br0 --detach --no-chdir --pidfile])
3333 ovs-appctl -t ovs-ofctl ofctl/send 0309000c0123456700000080
3334 ovs-appctl -t ovs-ofctl ofctl/barrier
3335 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
3336 AT_CAPTURE_FILE([monitor.log])
3338 # Send a packet-out with a set-field action to set some metadata, and forward to controller
3339 AT_CHECK([ovs-ofctl -O OpenFlow12 packet-out br0 none 'set_field:0xfafafafa5a5a5a5a->metadata, controller' '0001020304050010203040501234'])
3341 # Stop the monitor and check its output.
3342 ovs-appctl -t ovs-ofctl ofctl/barrier
3343 ovs-appctl -t ovs-ofctl exit
3345 AT_CHECK([sed 's/ (xid=0x[[0-9a-fA-F]]*)//' monitor.log], [0], [dnl
3346 OFPT_PACKET_IN (OF1.2): total_len=14 metadata=0xfafafafa5a5a5a5a,in_port=ANY (via action) data_len=14 (unbuffered)
3347 vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1234
3348 OFPT_BARRIER_REPLY (OF1.2):
3354 dnl This test checks that metadata is encoded in packet_in structures,
3355 dnl supported by NXAST.
3356 AT_SETUP([ofproto - packet-out with metadata and dual set_field (OpenFlow 1.3)])
3359 # Start a monitor listening for packet-ins.
3360 AT_CHECK([ovs-ofctl -O OpenFlow13 monitor br0 --detach --no-chdir --pidfile])
3361 ovs-appctl -t ovs-ofctl ofctl/send 0409000c0123456700000080
3362 ovs-appctl -t ovs-ofctl ofctl/barrier
3363 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
3364 AT_CAPTURE_FILE([monitor.log])
3366 # Send a packet-out with a couple of set-field action to set some metadata, and forward to controller
3367 AT_CHECK([ovs-ofctl -O OpenFlow13 packet-out br0 none 'set_field:0xfafafafa5a5a5a5a->metadata, set_field:0x6b->metadata, controller' '0001020304050010203040501234'])
3369 # Stop the monitor and check its output.
3370 ovs-appctl -t ovs-ofctl ofctl/barrier
3371 ovs-appctl -t ovs-ofctl exit
3373 AT_CHECK([sed 's/ (xid=0x[[0-9a-fA-F]]*)//' monitor.log], [0], [dnl
3374 OFPT_PACKET_IN (OF1.3): total_len=14 metadata=0x6b,in_port=ANY (via action) data_len=14 (unbuffered)
3375 vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1234
3376 OFPT_BARRIER_REPLY (OF1.3):
3382 dnl This test checks that tunnel metadata is encoded in packet_in structures.
3383 AT_SETUP([ofproto - packet-out with tunnel metadata (OpenFlow 1.2)])
3386 # Start a monitor listening for packet-ins.
3387 AT_CHECK([ovs-ofctl -O OpenFlow12 monitor br0 --detach --no-chdir --pidfile])
3388 ovs-appctl -t ovs-ofctl ofctl/send 0309000c0123456700000080
3389 ovs-appctl -t ovs-ofctl ofctl/barrier
3390 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
3391 AT_CAPTURE_FILE([monitor.log])
3393 # Send a packet-out with set field actions to set some tunnel metadata, and forward to controller
3394 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'])
3396 # Stop the monitor and check its output.
3397 ovs-appctl -t ovs-ofctl ofctl/barrier
3398 ovs-appctl -t ovs-ofctl exit
3400 AT_CHECK([sed 's/ (xid=0x[[0-9a-fA-F]]*)//' monitor.log], [0], [dnl
3401 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)
3402 vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1234
3403 OFPT_BARRIER_REPLY (OF1.2):
3409 m4_divert_push([PREPARE_TESTS])
3410 # Sorts groups of lines that start with a space, without moving them
3411 # past the nearest line that does not start with a space.
3421 print $_ foreach sort(@buffer);
3426 print $_ foreach sort(@buffer);
3429 m4_divert_pop([PREPARE_TESTS])
3431 AT_SETUP([ofproto - flow monitoring])
3432 AT_KEYWORDS([monitor])
3435 ovs-ofctl add-flow br0 in_port=0,dl_vlan=123,actions=output:1
3437 # Start a monitor watching the flow table and check the initial reply.
3438 ovs-ofctl monitor br0 watch: --detach --no-chdir --pidfile >monitor.log 2>&1
3439 AT_CAPTURE_FILE([monitor.log])
3440 ovs-appctl -t ovs-ofctl ofctl/barrier
3441 AT_CHECK([sed 's/ (xid=0x[[1-9a-fA-F]][[0-9a-fA-F]]*)//' monitor.log], [0],
3442 [NXST_FLOW_MONITOR reply:
3443 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=123 actions=output:1
3447 # Add, delete, and modify some flows and check the updates.
3448 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
3449 ovs-ofctl add-flow br0 in_port=0,dl_vlan=124,actions=output:2
3450 ovs-ofctl add-flow br0 in_port=0,dl_vlan=123,actions=output:5
3451 ovs-ofctl add-flow br0 in_port=0,dl_vlan=123,dl_vlan_pcp=0,actions=output:6
3452 ovs-ofctl add-flow br0 in_port=0,dl_vlan=123,dl_vlan_pcp=1,actions=output:7
3453 ovs-ofctl add-flow br0 in_port=0,dl_vlan=123,actions=output:8
3454 ovs-ofctl add-flow br0 in_port=0,dl_vlan=65535,dl_vlan_pcp=0,actions=output:9
3455 ovs-ofctl add-flow br0 in_port=0,dl_vlan=65535,dl_vlan_pcp=1,actions=output:10
3456 ovs-ofctl add-flow br0 in_port=0,dl_vlan=65535,actions=output:11
3457 ovs-ofctl add-flow br0 in_port=0,dl_vlan=8191,dl_vlan_pcp=0,actions=output:12
3458 ovs-ofctl add-flow br0 in_port=0,dl_vlan=8191,dl_vlan_pcp=1,actions=output:13
3459 ovs-ofctl add-flow br0 in_port=0,dl_vlan=8191,actions=output:14
3460 ovs-ofctl add-flow br0 in_port=0,dl_vlan=0,dl_vlan_pcp=0,actions=output:15
3461 ovs-ofctl add-flow br0 in_port=0,dl_vlan=0,dl_vlan_pcp=1,actions=output:16
3462 ovs-ofctl add-flow br0 in_port=0,dl_vlan=0,actions=output:17
3463 ovs-ofctl add-flow br0 in_port=0,dl_vlan=0,dl_vlan_pcp=0,actions=output:18
3464 ovs-ofctl add-flow br0 in_port=0,dl_vlan=0,dl_vlan_pcp=1,actions=output:19
3465 ovs-ofctl add-flow br0 in_port=0,dl_vlan=0,actions=output:20
3466 ovs-ofctl add-flow br0 in_port=0,dl_vlan_pcp=0,actions=output:21
3467 ovs-ofctl add-flow br0 in_port=0,dl_vlan_pcp=1,actions=output:22
3468 ovs-ofctl add-flow br0 in_port=0,actions=output:23
3469 ovs-ofctl mod-flows br0 dl_vlan=123,actions=output:3
3470 ovs-ofctl mod-flows br0 cookie=5,dl_vlan=123,actions=output:3
3471 ovs-ofctl del-flows br0 dl_vlan=123
3472 ovs-ofctl del-flows br0
3473 ovs-appctl -t ovs-ofctl ofctl/barrier
3474 AT_CHECK([sed 's/ (xid=0x[[1-9a-fA-F]][[0-9a-fA-F]]*)//' monitor.log | multiline_sort], [0],
3475 [NXST_FLOW_MONITOR reply (xid=0x0):
3476 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=124 actions=output:2
3477 NXST_FLOW_MONITOR reply (xid=0x0):
3478 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=123 actions=output:5
3479 NXST_FLOW_MONITOR reply (xid=0x0):
3480 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=123,dl_vlan_pcp=0 actions=output:6
3481 NXST_FLOW_MONITOR reply (xid=0x0):
3482 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=123,dl_vlan_pcp=1 actions=output:7
3483 NXST_FLOW_MONITOR reply (xid=0x0):
3484 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=123 actions=output:8
3485 NXST_FLOW_MONITOR reply (xid=0x0):
3486 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=0,dl_vlan_pcp=0 actions=output:9
3487 NXST_FLOW_MONITOR reply (xid=0x0):
3488 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=0,dl_vlan_pcp=1 actions=output:10
3489 NXST_FLOW_MONITOR reply (xid=0x0):
3490 event=ADDED table=0 cookie=0 in_port=0,vlan_tci=0x0000 actions=output:11
3491 NXST_FLOW_MONITOR reply (xid=0x0):
3492 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=4095,dl_vlan_pcp=0 actions=output:12
3493 NXST_FLOW_MONITOR reply (xid=0x0):
3494 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=4095,dl_vlan_pcp=1 actions=output:13
3495 NXST_FLOW_MONITOR reply (xid=0x0):
3496 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=4095 actions=output:14
3497 NXST_FLOW_MONITOR reply (xid=0x0):
3498 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=0,dl_vlan_pcp=0 actions=output:15
3499 NXST_FLOW_MONITOR reply (xid=0x0):
3500 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=0,dl_vlan_pcp=1 actions=output:16
3501 NXST_FLOW_MONITOR reply (xid=0x0):
3502 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=0 actions=output:17
3503 NXST_FLOW_MONITOR reply (xid=0x0):
3504 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=0,dl_vlan_pcp=0 actions=output:18
3505 NXST_FLOW_MONITOR reply (xid=0x0):
3506 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=0,dl_vlan_pcp=1 actions=output:19
3507 NXST_FLOW_MONITOR reply (xid=0x0):
3508 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=0 actions=output:20
3509 NXST_FLOW_MONITOR reply (xid=0x0):
3510 event=ADDED table=0 cookie=0 in_port=0,dl_vlan_pcp=0 actions=output:21
3511 NXST_FLOW_MONITOR reply (xid=0x0):
3512 event=ADDED table=0 cookie=0 in_port=0,dl_vlan_pcp=1 actions=output:22
3513 NXST_FLOW_MONITOR reply (xid=0x0):
3514 event=ADDED table=0 cookie=0 in_port=0 actions=output:23
3515 NXST_FLOW_MONITOR reply (xid=0x0):
3516 event=MODIFIED table=0 cookie=0 in_port=0,dl_vlan=123 actions=output:3
3517 event=MODIFIED table=0 cookie=0 in_port=0,dl_vlan=123,dl_vlan_pcp=0 actions=output:3
3518 event=MODIFIED table=0 cookie=0 in_port=0,dl_vlan=123,dl_vlan_pcp=1 actions=output:3
3519 NXST_FLOW_MONITOR reply (xid=0x0):
3520 event=MODIFIED table=0 cookie=0x5 in_port=0,dl_vlan=123 actions=output:3
3521 event=MODIFIED table=0 cookie=0x5 in_port=0,dl_vlan=123,dl_vlan_pcp=0 actions=output:3
3522 event=MODIFIED table=0 cookie=0x5 in_port=0,dl_vlan=123,dl_vlan_pcp=1 actions=output:3
3523 NXST_FLOW_MONITOR reply (xid=0x0):
3524 event=DELETED reason=delete table=0 cookie=0x5 in_port=0,dl_vlan=123 actions=output:3
3525 event=DELETED reason=delete table=0 cookie=0x5 in_port=0,dl_vlan=123,dl_vlan_pcp=0 actions=output:3
3526 event=DELETED reason=delete table=0 cookie=0x5 in_port=0,dl_vlan=123,dl_vlan_pcp=1 actions=output:3
3527 NXST_FLOW_MONITOR reply (xid=0x0):
3528 event=DELETED reason=delete table=0 cookie=0 in_port=0 actions=output:23
3529 event=DELETED reason=delete table=0 cookie=0 in_port=0,dl_vlan=0 actions=output:20
3530 event=DELETED reason=delete table=0 cookie=0 in_port=0,dl_vlan=0,dl_vlan_pcp=0 actions=output:18
3531 event=DELETED reason=delete table=0 cookie=0 in_port=0,dl_vlan=0,dl_vlan_pcp=1 actions=output:19
3532 event=DELETED reason=delete table=0 cookie=0 in_port=0,dl_vlan=124 actions=output:2
3533 event=DELETED reason=delete table=0 cookie=0 in_port=0,dl_vlan=4095 actions=output:14
3534 event=DELETED reason=delete table=0 cookie=0 in_port=0,dl_vlan=4095,dl_vlan_pcp=0 actions=output:12
3535 event=DELETED reason=delete table=0 cookie=0 in_port=0,dl_vlan=4095,dl_vlan_pcp=1 actions=output:13
3536 event=DELETED reason=delete table=0 cookie=0 in_port=0,dl_vlan_pcp=0 actions=output:21
3537 event=DELETED reason=delete table=0 cookie=0 in_port=0,dl_vlan_pcp=1 actions=output:22
3538 event=DELETED reason=delete table=0 cookie=0 in_port=0,vlan_tci=0x0000 actions=output:11
3542 # Check that our own changes are reported as full updates.
3543 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
3544 ovs-ofctl add-flow br0 in_port=1,actions=output:2
3545 ovs-ofctl add-flow br0 in_port=2,actions=output:1
3546 ovs-appctl -t ovs-ofctl ofctl/barrier
3547 ovs-appctl -t ovs-ofctl ofctl/send 010e004812345678003fffff00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003000000000000ffffffffffff0000
3548 ovs-appctl -t ovs-ofctl ofctl/barrier
3549 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip], [0], [NXST_FLOW reply:
3551 AT_CHECK([sed 's/ (xid=0x[[1-9a-fA-F]][[0-9a-fA-F]]*)//' monitor.log | multiline_sort], [0],
3552 [NXST_FLOW_MONITOR reply (xid=0x0):
3553 event=ADDED table=0 cookie=0 in_port=1 actions=output:2
3554 NXST_FLOW_MONITOR reply (xid=0x0):
3555 event=ADDED table=0 cookie=0 in_port=2 actions=output:1
3557 send: OFPT_FLOW_MOD: DEL priority=0 actions=drop
3558 NXST_FLOW_MONITOR reply (xid=0x0):
3559 event=DELETED reason=delete table=0 cookie=0 in_port=1 actions=output:2
3560 event=DELETED reason=delete table=0 cookie=0 in_port=2 actions=output:1
3564 ovs-appctl -t ovs-ofctl exit
3568 AT_SETUP([ofproto - flow monitoring with !own])
3569 AT_KEYWORDS([monitor])
3572 ovs-ofctl add-flow br0 in_port=0,dl_vlan=123,actions=output:1
3574 # Start a monitor watching the flow table and check the initial reply.
3575 ovs-ofctl monitor br0 watch:\!own --detach --no-chdir --pidfile >monitor.log 2>&1
3576 AT_CAPTURE_FILE([monitor.log])
3577 ovs-appctl -t ovs-ofctl ofctl/barrier
3578 AT_CHECK([sed 's/ (xid=0x[[1-9a-fA-F]][[0-9a-fA-F]]*)//' monitor.log], [0],
3579 [NXST_FLOW_MONITOR reply:
3580 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=123 actions=output:1
3584 # Check that our own changes are reported as abbreviations.
3585 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
3586 ovs-ofctl add-flow br0 in_port=1,actions=output:2
3587 ovs-ofctl add-flow br0 in_port=2,actions=output:1
3588 ovs-appctl -t ovs-ofctl ofctl/barrier
3589 ovs-appctl -t ovs-ofctl ofctl/send 010e004812345678003fffff00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003000000000000ffffffffffff0000
3590 ovs-appctl -t ovs-ofctl ofctl/barrier
3591 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip], [0], [NXST_FLOW reply:
3593 AT_CHECK([sed 's/ (xid=0x[[1-9a-fA-F]][[0-9a-fA-F]]*)//' monitor.log], [0],
3594 [NXST_FLOW_MONITOR reply (xid=0x0):
3595 event=ADDED table=0 cookie=0 in_port=1 actions=output:2
3596 NXST_FLOW_MONITOR reply (xid=0x0):
3597 event=ADDED table=0 cookie=0 in_port=2 actions=output:1
3599 send: OFPT_FLOW_MOD: DEL priority=0 actions=drop
3600 NXST_FLOW_MONITOR reply (xid=0x0):
3601 event=ABBREV xid=0x12345678
3605 ovs-appctl -t ovs-ofctl exit
3609 AT_SETUP([ofproto - flow monitoring with out_port])
3610 AT_KEYWORDS([monitor])
3613 ovs-ofctl add-flow br0 in_port=0,dl_vlan=121,actions=output:1
3614 ovs-ofctl add-flow br0 in_port=0,dl_vlan=122,actions=output:1
3615 ovs-ofctl add-flow br0 in_port=0,dl_vlan=123,actions=output:2
3617 # Start a monitor watching the flow table and check the initial reply.
3618 ovs-ofctl monitor br0 watch:out_port=2 --detach --no-chdir --pidfile >monitor.log 2>&1
3619 AT_CAPTURE_FILE([monitor.log])
3620 ovs-appctl -t ovs-ofctl ofctl/barrier
3621 AT_CHECK([sed 's/ (xid=0x[[1-9a-fA-F]][[0-9a-fA-F]]*)//' monitor.log], [0],
3622 [NXST_FLOW_MONITOR reply:
3623 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=123 actions=output:2
3627 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
3629 # Add, modify flows and check the updates.
3630 ovs-ofctl mod-flows br0 dl_vlan=121,actions=drop
3631 ovs-ofctl mod-flows br0 dl_vlan=122,actions=output:1,output:2
3632 ovs-appctl -t ovs-ofctl ofctl/barrier
3634 ovs-ofctl mod-flows br0 dl_vlan=123,actions=output:1,output:2
3635 ovs-appctl -t ovs-ofctl ofctl/barrier
3637 ovs-ofctl mod-flows br0 dl_vlan=122,actions=output:1
3638 ovs-appctl -t ovs-ofctl ofctl/barrier
3639 ovs-ofctl mod-flows br0 dl_vlan=123,actions=output:2
3640 ovs-appctl -t ovs-ofctl ofctl/barrier
3642 AT_CHECK([sed 's/ (xid=0x[[1-9a-fA-F]][[0-9a-fA-F]]*)//' monitor.log], [0],
3643 [NXST_FLOW_MONITOR reply (xid=0x0):
3644 event=MODIFIED table=0 cookie=0 in_port=0,dl_vlan=122 actions=output:1,output:2
3646 NXST_FLOW_MONITOR reply (xid=0x0):
3647 event=MODIFIED table=0 cookie=0 in_port=0,dl_vlan=123 actions=output:1,output:2
3649 NXST_FLOW_MONITOR reply (xid=0x0):
3650 event=MODIFIED table=0 cookie=0 in_port=0,dl_vlan=122 actions=output:1
3652 NXST_FLOW_MONITOR reply (xid=0x0):
3653 event=MODIFIED table=0 cookie=0 in_port=0,dl_vlan=123 actions=output:2
3657 ovs-appctl -t ovs-ofctl exit
3661 AT_SETUP([ofproto - flow monitoring pause and resume])
3662 AT_KEYWORDS([monitor])
3664 # The maximum socket receive buffer size is important for this test, which
3665 # tests behavior when the receive buffer overflows.
3666 if test -e /proc/sys/net/core/rmem_max; then
3668 rmem_max=`cat /proc/sys/net/core/rmem_max`
3669 elif rmem_max=`sysctl -n net.inet.tcp.recvbuf_max 2>/dev/null`; then
3672 # Don't know how to get maximum socket receive buffer on this OS
3675 # Calculate the total amount of queuing: rmem_max in the kernel, 128 kB
3676 # in ofproto sending userspace (see ofmonitor_flush() in connmgr.c).
3677 queue_size=`expr $rmem_max + 128 \* 1024`
3678 echo rmem_max=$rmem_max queue_size=$queue_size
3680 # If there's too much queuing skip the test to avoid timing out.
3681 AT_SKIP_IF([test $rmem_max -gt 1048576])
3683 # Each flow update message takes up at least 48 bytes of space in queues
3684 # and in practice more than that.
3685 n_msgs=`expr $queue_size / 48`
3690 # Start a monitor watching the flow table, then make it block.
3691 on_exit 'kill `cat ovs-ofctl.pid`'
3692 ovs-ofctl monitor br0 watch: --detach --no-chdir --pidfile >monitor.log 2>&1
3693 AT_CAPTURE_FILE([monitor.log])
3694 ovs-appctl -t ovs-ofctl ofctl/block
3696 # Add $n_msgs flows.
3697 (echo "in_port=2,actions=output:2"
3699 for ($i = 0; $i < '$n_msgs'; $i++) {
3700 print "cookie=1,reg1=$i,actions=drop\n";
3703 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
3704 # Check that multipart flow dumps work properly:
3705 AT_CHECK([ovs-ofctl diff-flows br0 flows.txt])
3706 AT_CHECK([ovs-ofctl add-flow br0 in_port=1,cookie=3,actions=drop])
3707 AT_CHECK([ovs-ofctl mod-flows br0 in_port=2,cookie=2,actions=output:2])
3708 AT_CHECK([ovs-ofctl del-flows br0 cookie=1/-1])
3710 ovs-appctl -t ovs-ofctl ofctl/unblock
3712 # Wait for the connection resumed.
3713 # A barrier doesn't work for this purpose.
3714 # https://www.mail-archive.com/dev@openvswitch.org/msg27013.html
3715 # https://www.mail-archive.com/dev@openvswitch.org/msg27675.html
3716 OVS_WAIT_UNTIL([grep NXT_FLOW_MONITOR_RESUMED monitor.log])
3718 ovs-appctl -t ovs-ofctl exit
3720 # Check that the flow monitor reported the same number of flows
3721 # added and deleted, but fewer than we actually added and deleted.
3722 adds=`grep -c 'ADDED.*reg1=' monitor.log`
3723 deletes=`grep -c 'DELETED.*reg1=' monitor.log`
3724 echo adds=$adds deletes=$deletes
3725 AT_CHECK([test $adds -gt 100 && test $adds -lt $n_msgs])
3726 AT_CHECK([test $adds = $deletes])
3728 # Check that the flow monitor reported everything in the expected order:
3730 # event=ADDED table=0 cookie=0x1 reg1=0x22
3732 # NXT_FLOW_MONITOR_PAUSED:
3734 # event=DELETED reason=delete table=0 cookie=0x1 reg1=0x22
3736 # event=ADDED table=0 cookie=0x3 in_port=1
3737 # event=MODIFIED table=0 cookie=0x2 in_port=2 actions=output:2
3738 # NXT_FLOW_MONITOR_RESUMED:
3740 # except that, between the PAUSED and RESUMED, the order of the ADDED
3741 # and MODIFIED lines lines depends on hash order, that is, it varies
3742 # as we change the hash function or change architecture. Therefore,
3743 # we use a couple of tests below to accept both orders.
3744 AT_CHECK([ofctl_strip < monitor.log | sed -n -e '
3747 /NXT_FLOW_MONITOR_PAUSED:/p
3748 /NXT_FLOW_MONITOR_RESUMED:/p
3749 ' > monitor.log.subset])
3750 AT_CHECK([grep -v MODIFIED monitor.log.subset], [0], [dnl
3751 event=ADDED table=0 cookie=0x1 reg1=0x22
3752 NXT_FLOW_MONITOR_PAUSED:
3753 event=DELETED reason=delete table=0 cookie=0x1 reg1=0x22
3754 event=ADDED table=0 cookie=0x3 in_port=1
3755 NXT_FLOW_MONITOR_RESUMED:
3757 AT_CHECK([grep -v ADDED monitor.log.subset], [0], [dnl
3758 NXT_FLOW_MONITOR_PAUSED:
3759 event=DELETED reason=delete table=0 cookie=0x1 reg1=0x22
3760 event=MODIFIED table=0 cookie=0x2 in_port=2 actions=output:2
3761 NXT_FLOW_MONITOR_RESUMED:
3767 AT_SETUP([ofproto - event filtering (OpenFlow 1.3)])
3768 AT_KEYWORDS([monitor])
3771 # Start a monitor, use the required protocol version
3772 ovs-ofctl -O OpenFlow13 monitor br0 --detach --no-chdir --pidfile >monitor.log 2>&1
3773 AT_CAPTURE_FILE([monitor.log])
3775 # Send an OpenFlow13 message (04), OFPT_GET_ASYNC_REQUEST (1a), length (8), xid (0a)
3776 ovs-appctl -t ovs-ofctl ofctl/send 041a00080000000a
3777 ovs-appctl -t ovs-ofctl ofctl/barrier
3779 # Check default setting
3780 read -r -d '' expected <<'EOF'
3783 AT_CHECK([ofctl_strip < monitor.log], [], [dnl
3784 send: OFPT_GET_ASYNC_REQUEST (OF1.3):
3785 OFPT_GET_ASYNC_REPLY (OF1.3):
3787 PACKET_IN: no_match action
3788 PORT_STATUS: add delete modify
3789 FLOW_REMOVED: idle hard delete
3793 PORT_STATUS: add delete modify
3795 OFPT_BARRIER_REPLY (OF1.3):
3801 AT_SETUP([ofproto - ofport_request])
3803 ADD_OF_PORTS([br0], [1], [2], [3])
3805 set_and_check_specific_ofports () {
3806 ovs-vsctl set Interface p1 ofport_request="$1" -- \
3807 set Interface p2 ofport_request="$2" -- \
3808 set Interface p3 ofport_request="$3"
3809 ofports=`ovs-vsctl get Interface p1 ofport -- \
3810 get Interface p2 ofport -- \
3811 get Interface p3 ofport`
3812 AT_CHECK_UNQUOTED([echo $ofports], [0], [$1 $2 $3
3815 for pre in '1 2 3' '1 3 2' '2 1 3' '2 3 1' '3 1 2' '3 2 1'; do
3816 for post in '1 2 3' '1 3 2' '2 1 3' '2 3 1' '3 1 2' '3 2 1'; do
3817 echo -----------------------------------------------------------
3818 echo "Check changing port numbers from $pre to $post"
3819 set_and_check_specific_ofports $pre
3820 set_and_check_specific_ofports $post
3824 ovs-vsctl del-port p3
3826 set_and_check_poorly_specified_ofports () {
3827 ovs-vsctl set Interface p1 ofport_request="$1" -- \
3828 set Interface p2 ofport_request="$2"
3829 p1=`ovs-vsctl get Interface p1 ofport`
3830 p2=`ovs-vsctl get Interface p2 ofport`
3833 AT_CHECK([test "$p1" != "$p2"])
3834 if test "$1" = "$2" && test "$1" != '[[]]'; then
3835 # One port number must be the requested one.
3836 AT_CHECK([test "$p1" = "$1" || test "$p2" = "$1"])
3837 # The other port number must be different (already tested above).
3839 AT_CHECK([test "$1" = '[[]]' || test "$p1" = "$1"])
3840 AT_CHECK([test "$2" = '[[]]' || test "$p2" = "$2"])
3843 for pre in '1 2' '[[]] 2' '1 [[]]' '[[]] [[]]' '2 1' '[[]] 1' '2 [[]]' \
3845 for post in '1 2' '[[]] 2' '1 [[]]' '[[]] [[]]' '2 1' '[[]] 1' '2 [[]]' \
3847 echo -----------------------------------------------------------
3848 echo "Check changing port numbers from $pre to $post"
3849 set_and_check_poorly_specified_ofports $pre
3850 set_and_check_poorly_specified_ofports $post
3857 AT_SETUP([ofproto - bundles, open (OpenFlow 1.4)])
3858 AT_KEYWORDS([monitor])
3861 # Start a monitor, use the required protocol version
3862 ovs-ofctl -O OpenFlow14 monitor br0 --detach --no-chdir --pidfile >monitor.log 2>&1
3863 AT_CAPTURE_FILE([monitor.log])
3865 # Send an OpenFlow14 message (05), OFPT_BUNDLE_CONTROL (21), length (10), xid (0a)
3866 ovs-appctl -t ovs-ofctl ofctl/send "05 21 00 10 00 00 00 0a 00 00 00 01 00 00 00 02"
3867 ovs-appctl -t ovs-ofctl ofctl/barrier
3868 ovs-appctl -t ovs-ofctl exit
3870 AT_CHECK([ofctl_strip < monitor.log], [], [dnl
3871 send: OFPT_BUNDLE_CONTROL (OF1.4):
3872 bundle_id=0x1 type=OPEN_REQUEST flags=ordered
3873 OFPT_BUNDLE_CONTROL (OF1.4):
3874 bundle_id=0x1 type=OPEN_REPLY flags=0
3875 OFPT_BARRIER_REPLY (OF1.4):
3881 AT_SETUP([ofproto - bundles, double open (OpenFlow 1.4)])
3882 AT_KEYWORDS([monitor])
3885 # Start a monitor, use the required protocol version
3886 ovs-ofctl -O OpenFlow14 monitor br0 --detach --no-chdir --pidfile >monitor.log 2>&1
3887 AT_CAPTURE_FILE([monitor.log])
3889 # Send twice an OpenFlow14 message (05), OFPT_BUNDLE_CONTROL (21), length (10), xid (0a)
3890 ovs-appctl -t ovs-ofctl ofctl/send "05 21 00 10 00 00 00 0a 00 00 00 01 00 00 00 02"
3891 ovs-appctl -t ovs-ofctl ofctl/barrier
3892 ovs-appctl -t ovs-ofctl ofctl/send "05 21 00 10 00 00 00 0a 00 00 00 01 00 00 00 02"
3893 ovs-appctl -t ovs-ofctl ofctl/barrier
3894 ovs-appctl -t ovs-ofctl exit
3896 AT_CHECK([ofctl_strip < monitor.log], [0], [dnl
3897 send: OFPT_BUNDLE_CONTROL (OF1.4):
3898 bundle_id=0x1 type=OPEN_REQUEST flags=ordered
3899 OFPT_BUNDLE_CONTROL (OF1.4):
3900 bundle_id=0x1 type=OPEN_REPLY flags=0
3901 OFPT_BARRIER_REPLY (OF1.4):
3902 send: OFPT_BUNDLE_CONTROL (OF1.4):
3903 bundle_id=0x1 type=OPEN_REQUEST flags=ordered
3904 OFPT_ERROR (OF1.4): OFPBFC_BAD_ID
3905 OFPT_BUNDLE_CONTROL (OF1.4):
3906 bundle_id=0x1 type=OPEN_REQUEST flags=ordered
3907 OFPT_BARRIER_REPLY (OF1.4):
3913 AT_SETUP([ofproto - bundle close without open (OpenFlow 1.4)])
3914 AT_KEYWORDS([monitor])
3917 # Start a monitor, use the required protocol version
3918 ovs-ofctl -O OpenFlow14 monitor br0 --detach --no-chdir --pidfile >monitor.log 2>&1
3919 AT_CAPTURE_FILE([monitor.log])
3921 ovs-appctl -t ovs-ofctl ofctl/send "05 21 00 10 00 00 00 0a 00 00 00 01 00 02 00 02"
3922 ovs-appctl -t ovs-ofctl ofctl/barrier
3923 ovs-appctl -t ovs-ofctl exit
3925 AT_CHECK([ofctl_strip < monitor.log], [0], [dnl
3926 send: OFPT_BUNDLE_CONTROL (OF1.4):
3927 bundle_id=0x1 type=CLOSE_REQUEST flags=ordered
3928 OFPT_ERROR (OF1.4): OFPBFC_BAD_ID
3929 OFPT_BUNDLE_CONTROL (OF1.4):
3930 bundle_id=0x1 type=CLOSE_REQUEST flags=ordered
3931 OFPT_BARRIER_REPLY (OF1.4):
3937 AT_SETUP([ofproto - bundle double close (OpenFlow 1.4)])
3938 AT_KEYWORDS([monitor])
3941 # Start a monitor, use the required protocol version
3942 ovs-ofctl -O OpenFlow14 monitor br0 --detach --no-chdir --pidfile >monitor.log 2>&1
3943 AT_CAPTURE_FILE([monitor.log])
3945 # Open, Close, Close
3946 ovs-appctl -t ovs-ofctl ofctl/send "05 21 00 10 00 00 00 0a 00 00 00 01 00 00 00 02"
3947 ovs-appctl -t ovs-ofctl ofctl/barrier
3948 ovs-appctl -t ovs-ofctl ofctl/send "05 21 00 10 00 00 00 0a 00 00 00 01 00 02 00 02"
3949 ovs-appctl -t ovs-ofctl ofctl/barrier
3950 ovs-appctl -t ovs-ofctl ofctl/send "05 21 00 10 00 00 00 0a 00 00 00 01 00 02 00 02"
3951 ovs-appctl -t ovs-ofctl ofctl/barrier
3952 ovs-appctl -t ovs-ofctl exit
3954 AT_CHECK([ofctl_strip < monitor.log], [0], [dnl
3955 send: OFPT_BUNDLE_CONTROL (OF1.4):
3956 bundle_id=0x1 type=OPEN_REQUEST flags=ordered
3957 OFPT_BUNDLE_CONTROL (OF1.4):
3958 bundle_id=0x1 type=OPEN_REPLY flags=0
3959 OFPT_BARRIER_REPLY (OF1.4):
3960 send: OFPT_BUNDLE_CONTROL (OF1.4):
3961 bundle_id=0x1 type=CLOSE_REQUEST flags=ordered
3962 OFPT_BUNDLE_CONTROL (OF1.4):
3963 bundle_id=0x1 type=CLOSE_REPLY flags=0
3964 OFPT_BARRIER_REPLY (OF1.4):
3965 send: OFPT_BUNDLE_CONTROL (OF1.4):
3966 bundle_id=0x1 type=CLOSE_REQUEST flags=ordered
3967 OFPT_ERROR (OF1.4): OFPBFC_BUNDLE_CLOSED
3968 OFPT_BUNDLE_CONTROL (OF1.4):
3969 bundle_id=0x1 type=CLOSE_REQUEST flags=ordered
3970 OFPT_BARRIER_REPLY (OF1.4):
3976 AT_SETUP([ofproto - bundle close, different flags (OpenFlow 1.4)])
3977 AT_KEYWORDS([monitor])
3980 # Start a monitor, use the required protocol version
3981 ovs-ofctl -O OpenFlow14 monitor br0 --detach --no-chdir --pidfile >monitor.log 2>&1
3982 AT_CAPTURE_FILE([monitor.log])
3984 # Open, Close, Close
3985 ovs-appctl -t ovs-ofctl ofctl/send "05 21 00 10 00 00 00 0a 00 00 00 01 00 00 00 02"
3986 ovs-appctl -t ovs-ofctl ofctl/barrier
3987 ovs-appctl -t ovs-ofctl ofctl/send "05 21 00 10 00 00 00 0a 00 00 00 01 00 02 00 01"
3988 ovs-appctl -t ovs-ofctl ofctl/barrier
3989 ovs-appctl -t ovs-ofctl exit
3991 AT_CHECK([ofctl_strip < monitor.log], [0], [dnl
3992 send: OFPT_BUNDLE_CONTROL (OF1.4):
3993 bundle_id=0x1 type=OPEN_REQUEST flags=ordered
3994 OFPT_BUNDLE_CONTROL (OF1.4):
3995 bundle_id=0x1 type=OPEN_REPLY flags=0
3996 OFPT_BARRIER_REPLY (OF1.4):
3997 send: OFPT_BUNDLE_CONTROL (OF1.4):
3998 bundle_id=0x1 type=CLOSE_REQUEST flags=atomic
3999 OFPT_ERROR (OF1.4): OFPBFC_BAD_FLAGS
4000 OFPT_BUNDLE_CONTROL (OF1.4):
4001 bundle_id=0x1 type=CLOSE_REQUEST flags=atomic
4002 OFPT_BARRIER_REPLY (OF1.4):
4008 AT_SETUP([ofproto - bundle commit without open (OpenFlow 1.4)])
4009 AT_KEYWORDS([monitor])
4012 # Start a monitor, use the required protocol version
4013 ovs-ofctl -O OpenFlow14 monitor br0 --detach --no-chdir --pidfile >monitor.log 2>&1
4014 AT_CAPTURE_FILE([monitor.log])
4016 # Open, Close, Close
4017 ovs-appctl -t ovs-ofctl ofctl/send "05 21 00 10 00 00 00 0a 00 00 00 01 00 04 00 02"
4018 ovs-appctl -t ovs-ofctl ofctl/barrier
4019 ovs-appctl -t ovs-ofctl exit
4021 AT_CHECK([ofctl_strip < monitor.log], [0], [dnl
4022 send: OFPT_BUNDLE_CONTROL (OF1.4):
4023 bundle_id=0x1 type=COMMIT_REQUEST flags=ordered
4024 OFPT_ERROR (OF1.4): OFPBFC_BAD_ID
4025 OFPT_BUNDLE_CONTROL (OF1.4):
4026 bundle_id=0x1 type=COMMIT_REQUEST flags=ordered
4027 OFPT_BARRIER_REPLY (OF1.4):
4033 AT_SETUP([ofproto - bundle commit, different flags (OpenFlow 1.4)])
4034 AT_KEYWORDS([monitor])
4037 # Start a monitor, use the required protocol version
4038 ovs-ofctl -O OpenFlow14 monitor br0 --detach --no-chdir --pidfile >monitor.log 2>&1
4039 AT_CAPTURE_FILE([monitor.log])
4041 # Open, Close, Close
4042 ovs-appctl -t ovs-ofctl ofctl/send "05 21 00 10 00 00 00 0a 00 00 00 01 00 00 00 02"
4043 ovs-appctl -t ovs-ofctl ofctl/barrier
4044 ovs-appctl -t ovs-ofctl ofctl/send "05 21 00 10 00 00 00 0a 00 00 00 01 00 04 00 01"
4045 ovs-appctl -t ovs-ofctl ofctl/barrier
4046 ovs-appctl -t ovs-ofctl exit
4048 AT_CHECK([ofctl_strip < monitor.log], [0], [dnl
4049 send: OFPT_BUNDLE_CONTROL (OF1.4):
4050 bundle_id=0x1 type=OPEN_REQUEST flags=ordered
4051 OFPT_BUNDLE_CONTROL (OF1.4):
4052 bundle_id=0x1 type=OPEN_REPLY flags=0
4053 OFPT_BARRIER_REPLY (OF1.4):
4054 send: OFPT_BUNDLE_CONTROL (OF1.4):
4055 bundle_id=0x1 type=COMMIT_REQUEST flags=atomic
4056 OFPT_ERROR (OF1.4): OFPBFC_BAD_FLAGS
4057 OFPT_BUNDLE_CONTROL (OF1.4):
4058 bundle_id=0x1 type=COMMIT_REQUEST flags=atomic
4059 OFPT_BARRIER_REPLY (OF1.4):
4065 AT_SETUP([ofproto - bundle discard without open (OpenFlow 1.4)])
4066 AT_KEYWORDS([monitor])
4069 # Start a monitor, use the required protocol version
4070 ovs-ofctl -O OpenFlow14 monitor br0 --detach --no-chdir --pidfile >monitor.log 2>&1
4071 AT_CAPTURE_FILE([monitor.log])
4073 # Open, Close, Close
4074 ovs-appctl -t ovs-ofctl ofctl/send "05 21 00 10 00 00 00 0a 00 00 00 01 00 06 00 02"
4075 ovs-appctl -t ovs-ofctl ofctl/barrier
4076 ovs-appctl -t ovs-ofctl exit
4078 AT_CHECK([ofctl_strip < monitor.log], [0], [dnl
4079 send: OFPT_BUNDLE_CONTROL (OF1.4):
4080 bundle_id=0x1 type=DISCARD_REQUEST flags=ordered
4081 OFPT_ERROR (OF1.4): OFPBFC_BAD_ID
4082 OFPT_BUNDLE_CONTROL (OF1.4):
4083 bundle_id=0x1 type=DISCARD_REQUEST flags=ordered
4084 OFPT_BARRIER_REPLY (OF1.4):
4091 AT_SETUP([ofproto - bundle with multiple flow mods (OpenFlow 1.4)])
4092 AT_KEYWORDS([monitor])
4095 AT_CHECK([ovs-appctl vlog/set vconn:dbg])
4097 AT_CHECK([ovs-ofctl del-flows br0])
4099 AT_DATA([flows.txt], [dnl
4100 add idle_timeout=50 in_port=2 dl_src=00:66:77:88:99:aa actions=1
4101 add idle_timeout=60 in_port=2 dl_src=00:77:88:99:aa:bb actions=2
4102 add idle_timeout=70 in_port=2 dl_src=00:88:99:aa:bb:cc actions=3
4103 add idle_timeout=50 in_port=2 dl_src=00:66:77:88:99:aa actions=4
4105 add idle_timeout=50 in_port=2 dl_src=00:66:77:88:99:aa actions=5
4106 add idle_timeout=60 in_port=2 dl_src=00:77:88:99:aa:bb actions=6
4107 add idle_timeout=70 in_port=2 dl_src=00:88:99:aa:bb:cc actions=7
4108 delete in_port=2 dl_src=00:88:99:aa:bb:cc
4111 AT_CHECK([ovs-ofctl --bundle add-flows br0 flows.txt])
4113 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
4114 idle_timeout=50, in_port=2,dl_src=00:66:77:88:99:aa actions=output:5
4115 idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=output:6
4119 AT_DATA([flows.txt], [dnl
4121 modify_strict in_port=2 dl_src=00:77:88:99:aa:bb actions=7
4124 AT_CHECK([ovs-ofctl --bundle add-flows br0 flows.txt])
4126 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
4127 idle_timeout=50, in_port=2,dl_src=00:66:77:88:99:aa actions=drop
4128 idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=output:7
4132 # Adding an existing flow acts as a modify, and delete_strict also works.
4133 AT_DATA([flows.txt], [dnl
4134 add idle_timeout=60 in_port=2 dl_src=00:77:88:99:aa:bb actions=8
4135 delete_strict in_port=2 dl_src=00:66:77:88:99:aa
4136 add in_port=2 dl_src=00:66:77:88:99:aa actions=drop
4139 AT_CHECK([ovs-ofctl --bundle add-flows br0 flows.txt])
4141 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
4142 idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=output:8
4143 in_port=2,dl_src=00:66:77:88:99:aa actions=drop
4147 dnl Check logs for OpenFlow trace
4149 OVS_WAIT_UNTIL([cat ovs-vswitchd.log | vconn_sub | test `grep -- "|vconn|DBG|unix: sent (Success): NXST_FLOW reply" | wc -l` -ge 3])
4150 AT_CHECK([print_vconn_debug | vconn_sub | ofctl_strip], [0], [dnl
4151 vconn|DBG|unix: sent (Success): OFPT_HELLO (OF1.5):
4152 version bitmap: 0x01, 0x02, 0x03, 0x04, 0x05, 0x06
4153 vconn|DBG|unix: received: OFPT_HELLO:
4154 version bitmap: 0x01
4155 vconn|DBG|unix: negotiated OpenFlow version 0x01 (we support version 0x06 and earlier, peer supports version 0x01)
4156 vconn|DBG|unix: received: OFPT_FLOW_MOD: DEL actions=drop
4157 vconn|DBG|unix: received: OFPT_BARRIER_REQUEST:
4158 vconn|DBG|unix: sent (Success): OFPT_BARRIER_REPLY:
4159 vconn|DBG|unix: sent (Success): OFPT_HELLO (OF1.5):
4160 version bitmap: 0x01, 0x02, 0x03, 0x04, 0x05, 0x06
4161 vconn|DBG|unix: received: OFPT_HELLO (OF1.4):
4162 version bitmap: 0x05
4163 vconn|DBG|unix: negotiated OpenFlow version 0x05 (we support version 0x06 and earlier, peer supports version 0x05)
4164 vconn|DBG|unix: received: OFPT_BUNDLE_CONTROL (OF1.4):
4165 bundle_id=0 type=OPEN_REQUEST flags=atomic ordered
4166 vconn|DBG|unix: sent (Success): OFPT_BUNDLE_CONTROL (OF1.4):
4167 bundle_id=0 type=OPEN_REPLY flags=0
4168 vconn|DBG|unix: received: OFPT_BUNDLE_ADD_MESSAGE (OF1.4):
4169 bundle_id=0 flags=atomic ordered
4170 OFPT_FLOW_MOD (OF1.4): ADD in_port=2,dl_src=00:66:77:88:99:aa idle:50 actions=output:1
4171 vconn|DBG|unix: received: OFPT_BUNDLE_ADD_MESSAGE (OF1.4):
4172 bundle_id=0 flags=atomic ordered
4173 OFPT_FLOW_MOD (OF1.4): ADD in_port=2,dl_src=00:77:88:99:aa:bb idle:60 actions=output:2
4174 vconn|DBG|unix: received: OFPT_BUNDLE_ADD_MESSAGE (OF1.4):
4175 bundle_id=0 flags=atomic ordered
4176 OFPT_FLOW_MOD (OF1.4): ADD in_port=2,dl_src=00:88:99:aa:bb:cc idle:70 actions=output:3
4177 vconn|DBG|unix: received: OFPT_BUNDLE_ADD_MESSAGE (OF1.4):
4178 bundle_id=0 flags=atomic ordered
4179 OFPT_FLOW_MOD (OF1.4): ADD in_port=2,dl_src=00:66:77:88:99:aa idle:50 actions=output:4
4180 vconn|DBG|unix: received: OFPT_BUNDLE_ADD_MESSAGE (OF1.4):
4181 bundle_id=0 flags=atomic ordered
4182 OFPT_FLOW_MOD (OF1.4): DEL table:255 actions=drop
4183 vconn|DBG|unix: received: OFPT_BUNDLE_ADD_MESSAGE (OF1.4):
4184 bundle_id=0 flags=atomic ordered
4185 OFPT_FLOW_MOD (OF1.4): ADD in_port=2,dl_src=00:66:77:88:99:aa idle:50 actions=output:5
4186 vconn|DBG|unix: received: OFPT_BUNDLE_ADD_MESSAGE (OF1.4):
4187 bundle_id=0 flags=atomic ordered
4188 OFPT_FLOW_MOD (OF1.4): ADD in_port=2,dl_src=00:77:88:99:aa:bb idle:60 actions=output:6
4189 vconn|DBG|unix: received: OFPT_BUNDLE_ADD_MESSAGE (OF1.4):
4190 bundle_id=0 flags=atomic ordered
4191 OFPT_FLOW_MOD (OF1.4): ADD in_port=2,dl_src=00:88:99:aa:bb:cc idle:70 actions=output:7
4192 vconn|DBG|unix: received: OFPT_BUNDLE_ADD_MESSAGE (OF1.4):
4193 bundle_id=0 flags=atomic ordered
4194 OFPT_FLOW_MOD (OF1.4): DEL table:255 in_port=2,dl_src=00:88:99:aa:bb:cc actions=drop
4195 vconn|DBG|unix: received: OFPT_BUNDLE_CONTROL (OF1.4):
4196 bundle_id=0 type=COMMIT_REQUEST flags=atomic ordered
4197 vconn|DBG|unix: sent (Success): OFPT_BUNDLE_CONTROL (OF1.4):
4198 bundle_id=0 type=COMMIT_REPLY flags=0
4199 vconn|DBG|unix: sent (Success): OFPT_HELLO (OF1.5):
4200 version bitmap: 0x01, 0x02, 0x03, 0x04, 0x05, 0x06
4201 vconn|DBG|unix: received: OFPT_HELLO:
4202 version bitmap: 0x01
4203 vconn|DBG|unix: negotiated OpenFlow version 0x01 (we support version 0x06 and earlier, peer supports version 0x01)
4204 vconn|DBG|unix: received: NXT_SET_FLOW_FORMAT: format=nxm
4205 vconn|DBG|unix: received: OFPT_BARRIER_REQUEST:
4206 vconn|DBG|unix: sent (Success): OFPT_BARRIER_REPLY:
4207 vconn|DBG|unix: received: NXST_FLOW request:
4208 vconn|DBG|unix: sent (Success): NXST_FLOW reply:
4209 idle_timeout=50, in_port=2,dl_src=00:66:77:88:99:aa actions=output:5
4210 idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=output:6
4211 vconn|DBG|unix: sent (Success): OFPT_HELLO (OF1.5):
4212 version bitmap: 0x01, 0x02, 0x03, 0x04, 0x05, 0x06
4213 vconn|DBG|unix: received: OFPT_HELLO (OF1.4):
4214 version bitmap: 0x05
4215 vconn|DBG|unix: negotiated OpenFlow version 0x05 (we support version 0x06 and earlier, peer supports version 0x05)
4216 vconn|DBG|unix: received: OFPT_BUNDLE_CONTROL (OF1.4):
4217 bundle_id=0 type=OPEN_REQUEST flags=atomic ordered
4218 vconn|DBG|unix: sent (Success): OFPT_BUNDLE_CONTROL (OF1.4):
4219 bundle_id=0 type=OPEN_REPLY flags=0
4220 vconn|DBG|unix: received: OFPT_BUNDLE_ADD_MESSAGE (OF1.4):
4221 bundle_id=0 flags=atomic ordered
4222 OFPT_FLOW_MOD (OF1.4): MOD actions=drop
4223 vconn|DBG|unix: received: OFPT_BUNDLE_ADD_MESSAGE (OF1.4):
4224 bundle_id=0 flags=atomic ordered
4225 OFPT_FLOW_MOD (OF1.4): MOD_STRICT in_port=2,dl_src=00:77:88:99:aa:bb actions=output:7
4226 vconn|DBG|unix: received: OFPT_BUNDLE_CONTROL (OF1.4):
4227 bundle_id=0 type=COMMIT_REQUEST flags=atomic ordered
4228 vconn|DBG|unix: sent (Success): OFPT_BUNDLE_CONTROL (OF1.4):
4229 bundle_id=0 type=COMMIT_REPLY flags=0
4230 vconn|DBG|unix: sent (Success): OFPT_HELLO (OF1.5):
4231 version bitmap: 0x01, 0x02, 0x03, 0x04, 0x05, 0x06
4232 vconn|DBG|unix: received: OFPT_HELLO:
4233 version bitmap: 0x01
4234 vconn|DBG|unix: negotiated OpenFlow version 0x01 (we support version 0x06 and earlier, peer supports version 0x01)
4235 vconn|DBG|unix: received: NXT_SET_FLOW_FORMAT: format=nxm
4236 vconn|DBG|unix: received: OFPT_BARRIER_REQUEST:
4237 vconn|DBG|unix: sent (Success): OFPT_BARRIER_REPLY:
4238 vconn|DBG|unix: received: NXST_FLOW request:
4239 vconn|DBG|unix: sent (Success): NXST_FLOW reply:
4240 idle_timeout=50, in_port=2,dl_src=00:66:77:88:99:aa actions=drop
4241 idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=output:7
4242 vconn|DBG|unix: sent (Success): OFPT_HELLO (OF1.5):
4243 version bitmap: 0x01, 0x02, 0x03, 0x04, 0x05, 0x06
4244 vconn|DBG|unix: received: OFPT_HELLO (OF1.4):
4245 version bitmap: 0x05
4246 vconn|DBG|unix: negotiated OpenFlow version 0x05 (we support version 0x06 and earlier, peer supports version 0x05)
4247 vconn|DBG|unix: received: OFPT_BUNDLE_CONTROL (OF1.4):
4248 bundle_id=0 type=OPEN_REQUEST flags=atomic ordered
4249 vconn|DBG|unix: sent (Success): OFPT_BUNDLE_CONTROL (OF1.4):
4250 bundle_id=0 type=OPEN_REPLY flags=0
4251 vconn|DBG|unix: received: OFPT_BUNDLE_ADD_MESSAGE (OF1.4):
4252 bundle_id=0 flags=atomic ordered
4253 OFPT_FLOW_MOD (OF1.4): ADD in_port=2,dl_src=00:77:88:99:aa:bb idle:60 actions=output:8
4254 vconn|DBG|unix: received: OFPT_BUNDLE_ADD_MESSAGE (OF1.4):
4255 bundle_id=0 flags=atomic ordered
4256 OFPT_FLOW_MOD (OF1.4): DEL_STRICT table:255 in_port=2,dl_src=00:66:77:88:99:aa actions=drop
4257 vconn|DBG|unix: received: OFPT_BUNDLE_ADD_MESSAGE (OF1.4):
4258 bundle_id=0 flags=atomic ordered
4259 OFPT_FLOW_MOD (OF1.4): ADD in_port=2,dl_src=00:66:77:88:99:aa actions=drop
4260 vconn|DBG|unix: received: OFPT_BUNDLE_CONTROL (OF1.4):
4261 bundle_id=0 type=COMMIT_REQUEST flags=atomic ordered
4262 vconn|DBG|unix: sent (Success): OFPT_BUNDLE_CONTROL (OF1.4):
4263 bundle_id=0 type=COMMIT_REPLY flags=0
4264 vconn|DBG|unix: sent (Success): OFPT_HELLO (OF1.5):
4265 version bitmap: 0x01, 0x02, 0x03, 0x04, 0x05, 0x06
4266 vconn|DBG|unix: received: OFPT_HELLO:
4267 version bitmap: 0x01
4268 vconn|DBG|unix: negotiated OpenFlow version 0x01 (we support version 0x06 and earlier, peer supports version 0x01)
4269 vconn|DBG|unix: received: NXT_SET_FLOW_FORMAT: format=nxm
4270 vconn|DBG|unix: received: OFPT_BARRIER_REQUEST:
4271 vconn|DBG|unix: sent (Success): OFPT_BARRIER_REPLY:
4272 vconn|DBG|unix: received: NXST_FLOW request:
4273 vconn|DBG|unix: sent (Success): NXST_FLOW reply:
4274 idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=output:8
4275 in_port=2,dl_src=00:66:77:88:99:aa actions=drop
4282 AT_SETUP([ofproto - failing bundle commit (OpenFlow 1.4)])
4283 AT_KEYWORDS([monitor])
4286 AT_CHECK([ovs-ofctl del-flows br0])
4288 ovs-ofctl add-flows br0 - <<EOF
4289 idle_timeout=50 in_port=2 dl_src=00:66:77:88:99:aa actions=11
4290 idle_timeout=60 in_port=2 dl_src=00:77:88:99:aa:bb actions=22
4291 idle_timeout=70 in_port=2 dl_src=00:88:99:aa:bb:cc actions=33
4293 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
4294 idle_timeout=50, in_port=2,dl_src=00:66:77:88:99:aa actions=output:11
4295 idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=output:22
4296 idle_timeout=70, in_port=2,dl_src=00:88:99:aa:bb:cc actions=output:33
4300 # last line uses illegal table number (OVS internal table)
4301 AT_DATA([flows.txt], [dnl
4302 add idle_timeout=50 in_port=2 dl_src=00:66:77:88:99:aa actions=1
4303 add idle_timeout=60 in_port=2 dl_src=00:77:88:99:aa:bb actions=2
4304 add idle_timeout=70 in_port=2 dl_src=00:88:99:aa:bb:cc actions=3
4305 modify idle_timeout=50 in_port=2 dl_src=00:66:77:88:99:aa actions=4
4307 add idle_timeout=50 in_port=2 dl_src=00:66:77:88:99:aa actions=5
4308 add idle_timeout=60 in_port=2 dl_src=00:77:88:99:aa:bb actions=6
4309 add idle_timeout=70 in_port=2 dl_src=00:88:99:aa:bb:cc actions=7
4310 delete in_port=2 dl_src=00:88:99:aa:bb:cc
4311 add table=254 actions=drop
4314 AT_CHECK([ovs-ofctl --bundle add-flows br0 flows.txt 2>&1 | sed '/|WARN|/d
4315 s/unix:.*br0\.mgmt/unix:br0.mgmt/' | sed 's/(.* error)/(error)/'],
4317 OFPT_ERROR (OF1.4) (xid=0xb): OFPBRC_EPERM
4318 OFPT_FLOW_MOD (OF1.4) (xid=0xb): ADD table:254 actions=drop
4319 OFPT_ERROR (OF1.4) (xid=0xd): OFPBFC_MSG_FAILED
4320 OFPT_BUNDLE_CONTROL (OF1.4) (xid=0xd):
4321 bundle_id=0 type=COMMIT_REQUEST flags=atomic ordered
4322 ovs-ofctl: talking to unix:br0.mgmt (error)
4325 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
4326 idle_timeout=50, in_port=2,dl_src=00:66:77:88:99:aa actions=output:11
4327 idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=output:22
4328 idle_timeout=70, in_port=2,dl_src=00:88:99:aa:bb:cc actions=output:33