3 AT_SETUP([ofproto - echo request])
5 AT_CHECK([ovs-ofctl -vwarn probe br0])
9 AT_SETUP([ofproto - feature request, config request])
11 AT_CHECK([ovs-ofctl -vwarn show br0], [0], [stdout])
12 AT_CHECK([STRIP_XIDS stdout], [0], [dnl
13 OFPT_FEATURES_REPLY: dpid:fedcba9876543210
14 n_tables:255, n_buffers:256
15 capabilities: FLOW_STATS TABLE_STATS PORT_STATS QUEUE_STATS ARP_MATCH_IP
16 actions: OUTPUT SET_VLAN_VID SET_VLAN_PCP STRIP_VLAN SET_DL_SRC SET_DL_DST SET_NW_SRC SET_NW_DST SET_NW_TOS SET_TP_SRC SET_TP_DST ENQUEUE
17 LOCAL(br0): addr:aa:55:aa:55:00:00
20 speed: 100 Mbps now, 100 Mbps max
21 OFPT_GET_CONFIG_REPLY: frags=normal miss_send_len=0
26 dnl This is really bare-bones.
27 dnl It at least checks request and reply serialization and deserialization.
28 AT_SETUP([ofproto - port stats])
30 AT_CHECK([ovs-ofctl -vwarn dump-ports br0], [0], [stdout])
31 AT_CHECK([STRIP_XIDS stdout], [0], [dnl
32 OFPST_PORT reply: 1 ports
33 port 65534: rx pkts=0, bytes=0, drop=0, errs=0, frame=0, over=0, crc=0
34 tx pkts=0, bytes=0, drop=0, errs=0, coll=0
39 dnl This is really bare-bones.
40 dnl It at least checks request and reply serialization and deserialization.
41 AT_SETUP([ofproto - port-desc stats])
43 AT_CHECK([ovs-ofctl -vwarn dump-ports-desc br0], [0], [stdout])
44 AT_CHECK([STRIP_XIDS stdout], [0], [dnl
45 OFPST_PORT_DESC reply:
46 LOCAL(br0): addr:aa:55:aa:55:00:00
49 speed: 100 Mbps now, 100 Mbps max
54 dnl This is really bare-bones.
55 dnl It at least checks request and reply serialization and deserialization.
56 AT_SETUP([ofproto - queue stats])
58 AT_CHECK([ovs-ofctl -vwarn queue-stats br0], [0], [stdout])
59 AT_CHECK([STRIP_XIDS stdout], [0], [dnl
60 OFPST_QUEUE reply: 0 queues
62 AT_CHECK([ovs-ofctl -vwarn queue-stats br0 ALL 5], [0],
63 [OFPT_ERROR (xid=0x2): OFPQOFC_BAD_QUEUE
64 OFPST_QUEUE request (xid=0x2):port=ALL queue=5
66 AT_CHECK([ovs-ofctl -vwarn queue-stats br0 10], [0],
67 [OFPT_ERROR (xid=0x2): OFPQOFC_BAD_PORT
68 OFPST_QUEUE request (xid=0x2):port=10 queue=ALL
73 AT_SETUP([ofproto - mod-port])
75 for command_config_state in \
77 'noflood NO_FLOOD 0' \
78 'down PORT_DOWN,NO_FLOOD LINK_DOWN' \
79 'flood PORT_DOWN LINK_DOWN' \
80 'no-receive PORT_DOWN,NO_RECV LINK_DOWN' \
81 'no-forward PORT_DOWN,NO_RECV,NO_FWD LINK_DOWN' \
82 'no-packet-in PORT_DOWN,NO_RECV,NO_FWD,NO_PACKET_IN LINK_DOWN' \
83 'forward PORT_DOWN,NO_RECV,NO_PACKET_IN LINK_DOWN' \
84 'packet-in PORT_DOWN,NO_RECV LINK_DOWN' \
88 set $command_config_state
89 command=$[1] config=`echo $[2] | sed 's/,/ /g'` state=$[3]
90 AT_CHECK([ovs-ofctl -vwarn mod-port br0 br0 $command])
91 AT_CHECK([ovs-ofctl -vwarn show br0], [0], [stdout])
92 AT_CHECK_UNQUOTED([STRIP_XIDS stdout], [0], [dnl
93 OFPT_FEATURES_REPLY: dpid:fedcba9876543210
94 n_tables:255, n_buffers:256
95 capabilities: FLOW_STATS TABLE_STATS PORT_STATS QUEUE_STATS ARP_MATCH_IP
96 actions: OUTPUT SET_VLAN_VID SET_VLAN_PCP STRIP_VLAN SET_DL_SRC SET_DL_DST SET_NW_SRC SET_NW_DST SET_NW_TOS SET_TP_SRC SET_TP_DST ENQUEUE
97 LOCAL(br0): addr:aa:55:aa:55:00:00
100 speed: 100 Mbps now, 100 Mbps max
101 OFPT_GET_CONFIG_REPLY: frags=normal miss_send_len=0
107 AT_SETUP([ofproto - basic flow_mod commands (NXM)])
109 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip], [0], [NXST_FLOW reply:
111 AT_CHECK([echo 'in_port=2,actions=1' | ovs-ofctl add-flows br0 -])
112 AT_CHECK([ovs-ofctl add-flow br0 in_port=1,actions=2])
113 AT_CHECK([ovs-ofctl -F nxm add-flow br0 table=1,in_port=4,actions=3])
114 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
115 in_port=1 actions=output:2
116 in_port=2 actions=output:1
117 table=1, in_port=4 actions=output:3
120 AT_CHECK([ovs-ofctl dump-aggregate br0 table=0 | STRIP_XIDS], [0], [dnl
121 NXST_AGGREGATE reply: packet_count=0 byte_count=0 flow_count=2
123 AT_CHECK([ovs-ofctl del-flows br0])
124 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip], [0], [NXST_FLOW reply:
129 AT_SETUP([ofproto - basic flow_mod commands (OpenFlow 1.0)])
131 AT_CHECK([ovs-ofctl -F openflow10 dump-flows br0 | ofctl_strip], [0], [OFPST_FLOW reply:
133 AT_CHECK([echo 'in_port=2,actions=1' | ovs-ofctl -F openflow10 add-flows br0 -])
134 AT_CHECK([ovs-ofctl -F openflow10 add-flow br0 in_port=1,actions=2])
135 AT_CHECK([ovs-ofctl -F openflow10 add-flow br0 table=1,in_port=4,actions=3])
136 AT_CHECK([ovs-ofctl -F openflow10 dump-flows br0 | ofctl_strip | sort], [0], [dnl
137 in_port=1 actions=output:2
138 in_port=2 actions=output:1
139 table=1, in_port=4 actions=output:3
142 AT_CHECK([ovs-ofctl -F openflow10 dump-aggregate br0 table=0 | STRIP_XIDS], [0], [dnl
143 OFPST_AGGREGATE reply: packet_count=0 byte_count=0 flow_count=2
145 AT_CHECK([ovs-ofctl -F openflow10 del-flows br0])
146 AT_CHECK([ovs-ofctl -F openflow10 dump-flows br0 | ofctl_strip], [0], [OFPST_FLOW reply:
151 AT_SETUP([ofproto - set-field flow_mod commands (NXM)])
153 AT_CHECK([ovs-ofctl add-flow br0 ipv6,table=1,in_port=3,actions=drop])
154 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])
155 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
156 table=1, ipv6,in_port=3 actions=load:0xa6badbfffefe59fa->NXM_NX_IPV6_SRC[[0..63]],load:0xfe8001234567890a->NXM_NX_IPV6_SRC[[64..127]]
162 AT_SETUP([ofproto - dump flows with cookie])
164 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x1,in_port=1,actions=1])
165 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x2,in_port=2,actions=1])
166 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x3,in_port=3,actions=1])
167 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
168 cookie=0x1, in_port=1 actions=output:1
169 cookie=0x2, in_port=2 actions=output:1
170 cookie=0x3, in_port=3 actions=output:1
173 AT_CHECK([ovs-ofctl dump-aggregate br0 table=0 | STRIP_XIDS], [0], [dnl
174 NXST_AGGREGATE reply: packet_count=0 byte_count=0 flow_count=3
176 AT_CHECK([ovs-ofctl dump-flows br0 cookie=0x3/-1 | ofctl_strip | sort], [0], [dnl
177 cookie=0x3, in_port=3 actions=output:1
180 AT_CHECK([ovs-ofctl dump-aggregate br0 cookie=0x3/-1 | STRIP_XIDS], [0], [dnl
181 NXST_AGGREGATE reply: packet_count=0 byte_count=0 flow_count=1
186 AT_SETUP([ofproto - dump flows with cookie mask])
188 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x1,in_port=1,actions=1])
189 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x2,in_port=2,actions=1])
190 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x3,in_port=3,actions=1])
191 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
192 cookie=0x1, in_port=1 actions=output:1
193 cookie=0x2, in_port=2 actions=output:1
194 cookie=0x3, in_port=3 actions=output:1
197 AT_CHECK([ovs-ofctl dump-aggregate br0 table=0 | STRIP_XIDS], [0], [dnl
198 NXST_AGGREGATE reply: packet_count=0 byte_count=0 flow_count=3
200 AT_CHECK([ovs-ofctl dump-flows br0 cookie=0x3/0x1 | ofctl_strip | sort], [0], [dnl
201 cookie=0x1, in_port=1 actions=output:1
202 cookie=0x3, in_port=3 actions=output:1
205 AT_CHECK([ovs-ofctl dump-aggregate br0 cookie=0x3/0x1 | STRIP_XIDS], [0], [dnl
206 NXST_AGGREGATE reply: packet_count=0 byte_count=0 flow_count=2
211 AT_SETUP([ofproto - mod flow with cookie change (OpenFlow 1.0)])
213 AT_CHECK([ovs-ofctl -F openflow10 add-flow br0 cookie=0x1,in_port=1,actions=1])
214 AT_CHECK([ovs-ofctl -F openflow10 dump-flows br0 | ofctl_strip | sort], [0], [dnl
215 cookie=0x1, in_port=1 actions=output:1
219 AT_CHECK([ovs-ofctl -F openflow10 mod-flows br0 cookie=0x2,in_port=1,actions=1])
220 AT_CHECK([ovs-ofctl -F openflow10 dump-flows br0 | ofctl_strip | sort], [0], [dnl
221 cookie=0x2, in_port=1 actions=output:1
227 AT_SETUP([ofproto - mod flow with cookie change (NXM)])
229 AT_CHECK([ovs-ofctl -F nxm add-flow br0 cookie=0x1,in_port=1,actions=1])
230 AT_CHECK([ovs-ofctl -F nxm dump-flows br0 | ofctl_strip | sort], [0], [dnl
231 cookie=0x1, in_port=1 actions=output:1
235 AT_CHECK([ovs-ofctl -F nxm mod-flows br0 cookie=0x2,in_port=1,actions=1])
236 AT_CHECK([ovs-ofctl -F nxm dump-flows br0 | ofctl_strip | sort], [0], [dnl
237 cookie=0x2, in_port=1 actions=output:1
243 AT_SETUP([ofproto - mod flows based on cookie mask])
245 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x1,in_port=1,actions=1])
246 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x1,in_port=2,actions=1])
247 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x2,in_port=3,actions=1])
248 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
249 cookie=0x1, in_port=1 actions=output:1
250 cookie=0x1, in_port=2 actions=output:1
251 cookie=0x2, in_port=3 actions=output:1
255 AT_CHECK([ovs-ofctl -F nxm mod-flows br0 cookie=0x1/0xff,actions=4])
256 AT_CHECK([ovs-ofctl -F nxm dump-flows br0 | ofctl_strip | sort], [0], [dnl
257 cookie=0x1, in_port=1 actions=output:4
258 cookie=0x1, in_port=2 actions=output:4
259 cookie=0x2, in_port=3 actions=output:1
265 AT_SETUP([ofproto - mod flows based on cookie mask with cookie change])
267 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x1,in_port=1,actions=1])
268 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x1,in_port=2,actions=1])
269 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x2,in_port=3,actions=1])
270 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
271 cookie=0x1, in_port=1 actions=output:1
272 cookie=0x1, in_port=2 actions=output:1
273 cookie=0x2, in_port=3 actions=output:1
277 AT_CHECK([ovs-ofctl -F nxm mod-flows br0 cookie=1/-1,cookie=4,actions=4])
278 AT_CHECK([ovs-ofctl -F nxm dump-flows br0 | ofctl_strip | sort], [0], [dnl
279 cookie=0x2, in_port=3 actions=output:1
280 cookie=0x4, in_port=1 actions=output:4
281 cookie=0x4, in_port=2 actions=output:4
287 AT_SETUP([ofproto - mod flow with cookie miss (mask==0)])
289 AT_CHECK([ovs-ofctl -F nxm mod-flows br0 in_port=1,actions=1])
290 AT_CHECK([ovs-ofctl -F nxm dump-flows br0 | ofctl_strip | sort], [0], [dnl
291 in_port=1 actions=output:1
297 AT_SETUP([ofproto - mod flow with cookie miss (mask!=0)])
299 AT_CHECK([ovs-ofctl -F nxm mod-flows br0 cookie=1/1,in_port=1,actions=1])
300 AT_CHECK([ovs-ofctl -F nxm dump-flows br0 | ofctl_strip | sort], [0], [dnl
306 AT_SETUP([ofproto - del flows with cookies])
308 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x1,in_port=1,actions=1])
309 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x2,in_port=2,actions=1])
310 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x3,in_port=3,actions=1])
311 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
312 cookie=0x1, in_port=1 actions=output:1
313 cookie=0x2, in_port=2 actions=output:1
314 cookie=0x3, in_port=3 actions=output:1
318 AT_CHECK([ovs-ofctl del-flows br0])
319 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
325 AT_SETUP([ofproto - del flows based on cookie])
327 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x1,in_port=1,actions=1])
328 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x2,in_port=2,actions=1])
329 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x3,in_port=3,actions=1])
330 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
331 cookie=0x1, in_port=1 actions=output:1
332 cookie=0x2, in_port=2 actions=output:1
333 cookie=0x3, in_port=3 actions=output:1
337 AT_CHECK([ovs-ofctl del-flows br0 cookie=0x3/-1])
338 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
339 cookie=0x1, in_port=1 actions=output:1
340 cookie=0x2, in_port=2 actions=output:1
346 AT_SETUP([ofproto - del flows based on cookie mask])
348 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x1,in_port=1,actions=1])
349 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x2,in_port=2,actions=1])
350 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x3,in_port=3,actions=1])
351 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
352 cookie=0x1, in_port=1 actions=output:1
353 cookie=0x2, in_port=2 actions=output:1
354 cookie=0x3, in_port=3 actions=output:1
357 AT_CHECK([ovs-ofctl del-flows br0 cookie=0x3/0x1])
358 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
359 cookie=0x2, in_port=2 actions=output:1
365 AT_SETUP([ofproto - flow table configuration])
367 # Check the default configuration.
368 (echo "OFPST_TABLE reply (xid=0x2): 255 tables
369 0: classifier: wild=0x3fffff, max=1000000, active=0
372 while test $x -lt 254; do
373 printf " %d: %-8s: wild=0x3fffff, max=1000000, active=0
378 echo " 254: table254: wild=0x3fffff, max=1000000, active=2
379 lookup=0, matched=0") > expout
380 AT_CHECK([ovs-ofctl dump-tables br0], [0], [expout])
381 # Change the configuration.
384 -- --id=@t0 create Flow_Table name=main \
385 -- --id=@t1 create Flow_Table flow-limit=1024 \
386 -- set bridge br0 'flow_tables={1=@t1,0=@t0}' \
387 | perl $srcdir/uuidfilt.pl],
391 # Check that the configuration was updated.
392 mv expout orig-expout
393 (echo "OFPST_TABLE reply (xid=0x2): 255 tables
394 0: main : wild=0x3fffff, max=1000000, active=0
396 1: table1 : wild=0x3fffff, max= 1024, active=0
398 tail -n +6 orig-expout) > expout
399 AT_CHECK([ovs-ofctl dump-tables br0], [0], [expout])
403 AT_SETUP([ofproto - hard limits on flow table size])
405 # Configure a maximum of 4 flows.
408 -- --id=@t0 create Flow_Table flow-limit=4 \
409 -- set bridge br0 flow_tables:0=@t0 \
410 | perl $srcdir/uuidfilt.pl],
414 for in_port in 1 2 3 4; do
415 ovs-ofctl add-flow br0 in_port=$in_port,actions=drop
417 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
418 in_port=1 actions=drop
419 in_port=2 actions=drop
420 in_port=3 actions=drop
421 in_port=4 actions=drop
424 # Adding another flow will be refused.
425 AT_CHECK([ovs-ofctl add-flow br0 in_port=5,actions=drop], [1], [], [stderr])
426 AT_CHECK([head -n 1 stderr | ofctl_strip], [0],
427 [OFPT_ERROR: OFPFMFC_ALL_TABLES_FULL
429 # Also a mod-flow that would add a flow will be refused.
430 AT_CHECK([ovs-ofctl mod-flows br0 in_port=5,actions=drop], [1], [], [stderr])
431 AT_CHECK([head -n 1 stderr | ofctl_strip], [0],
432 [OFPT_ERROR: OFPFMFC_ALL_TABLES_FULL
434 # Replacing or modifying an existing flow is allowed.
435 AT_CHECK([ovs-ofctl add-flow br0 in_port=4,actions=normal])
436 AT_CHECK([ovs-ofctl mod-flows br0 in_port=3,actions=output:1])
437 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
438 in_port=1 actions=drop
439 in_port=2 actions=drop
440 in_port=3 actions=output:1
441 in_port=4 actions=NORMAL
447 AT_SETUP([ofproto - eviction upon table overflow])
449 # Configure a maximum of 4 flows.
452 -- --id=@t0 create Flow_Table flow-limit=4 overflow-policy=evict \
453 -- set bridge br0 flow_tables:0=@t0 \
454 | perl $srcdir/uuidfilt.pl],
458 for in_port in 4 3 2 1; do
459 ovs-ofctl add-flow br0 idle_timeout=${in_port}0,in_port=$in_port,actions=drop
461 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
462 idle_timeout=10, in_port=1 actions=drop
463 idle_timeout=20, in_port=2 actions=drop
464 idle_timeout=30, in_port=3 actions=drop
465 idle_timeout=40, in_port=4 actions=drop
468 # Adding another flow will cause the one that expires soonest to be evicted.
469 AT_CHECK([ovs-ofctl add-flow br0 in_port=5,actions=drop])
470 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
471 idle_timeout=20, in_port=2 actions=drop
472 idle_timeout=30, in_port=3 actions=drop
473 idle_timeout=40, in_port=4 actions=drop
474 in_port=5 actions=drop
477 # A mod-flow that adds a flow also causes eviction, but replacing or
478 # modifying an existing flow doesn't.
479 AT_CHECK([ovs-ofctl mod-flows br0 in_port=6,actions=drop])
480 AT_CHECK([ovs-ofctl add-flow br0 in_port=4,actions=normal])
481 AT_CHECK([ovs-ofctl mod-flows br0 in_port=3,actions=output:1])
482 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
483 idle_timeout=30, in_port=3 actions=output:1
484 in_port=4 actions=NORMAL
485 in_port=5 actions=drop
486 in_port=6 actions=drop
489 # Flows with no timeouts at all cannot be evicted.
490 AT_CHECK([ovs-ofctl add-flow br0 in_port=7,actions=normal])
491 AT_CHECK([ovs-ofctl add-flow br0 in_port=8,actions=drop], [1], [], [stderr])
492 AT_CHECK([head -n 1 stderr | ofctl_strip], [0],
493 [OFPT_ERROR: OFPFMFC_ALL_TABLES_FULL
495 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
496 in_port=4 actions=NORMAL
497 in_port=5 actions=drop
498 in_port=6 actions=drop
499 in_port=7 actions=NORMAL
505 AT_SETUP([ofproto - eviction upon table overflow, with fairness])
507 # Configure a maximum of 4 flows.
510 -- --id=@t0 create Flow_Table name=evict flow-limit=4 \
511 overflow-policy=evict \
512 groups='"NXM_OF_IN_PORT[[]]"' \
513 -- set bridge br0 flow_tables:0=@t0 \
514 | perl $srcdir/uuidfilt.pl],
518 ovs-ofctl add-flows br0 - <<EOF
519 idle_timeout=10 in_port=2 dl_src=00:44:55:66:77:88 actions=drop
520 idle_timeout=20 in_port=1 dl_src=00:11:22:33:44:55 actions=drop
521 idle_timeout=30 in_port=1 dl_src=00:22:33:44:55:66 actions=drop
522 idle_timeout=40 in_port=1 dl_src=00:33:44:55:66:77 actions=drop
524 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
525 idle_timeout=10, in_port=2,dl_src=00:44:55:66:77:88 actions=drop
526 idle_timeout=20, in_port=1,dl_src=00:11:22:33:44:55 actions=drop
527 idle_timeout=30, in_port=1,dl_src=00:22:33:44:55:66 actions=drop
528 idle_timeout=40, in_port=1,dl_src=00:33:44:55:66:77 actions=drop
531 # Adding another flow will cause the one that expires soonest within
532 # the largest group (those with in_port=1) to be evicted. In this
533 # case this is not the same as the one that expires soonest overall
534 # (which is what makes the test interesting):
535 AT_CHECK([ovs-ofctl add-flow br0 in_port=2,dl_src=00:55:66:77:88:99,actions=drop])
536 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
537 idle_timeout=10, in_port=2,dl_src=00:44:55:66:77:88 actions=drop
538 idle_timeout=30, in_port=1,dl_src=00:22:33:44:55:66 actions=drop
539 idle_timeout=40, in_port=1,dl_src=00:33:44:55:66:77 actions=drop
540 in_port=2,dl_src=00:55:66:77:88:99 actions=drop
543 # Enlarge the flow limit, change the eviction policy back to strictly
544 # based on expiration, and and add some flows.
545 AT_CHECK([ovs-vsctl set Flow_Table evict groups='[[]]' flow-limit=7])
546 ovs-ofctl add-flows br0 - <<EOF
547 idle_timeout=50 in_port=2 dl_src=00:66:77:88:99:aa actions=drop
548 idle_timeout=60 in_port=2 dl_src=00:77:88:99:aa:bb actions=drop
549 idle_timeout=70 in_port=2 dl_src=00:88:99:aa:bb:cc actions=drop
551 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
552 idle_timeout=10, in_port=2,dl_src=00:44:55:66:77:88 actions=drop
553 idle_timeout=30, in_port=1,dl_src=00:22:33:44:55:66 actions=drop
554 idle_timeout=40, in_port=1,dl_src=00:33:44:55:66:77 actions=drop
555 idle_timeout=50, in_port=2,dl_src=00:66:77:88:99:aa actions=drop
556 idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=drop
557 idle_timeout=70, in_port=2,dl_src=00:88:99:aa:bb:cc actions=drop
558 in_port=2,dl_src=00:55:66:77:88:99 actions=drop
561 # Adding another flow will cause the one that expires soonest overall
563 AT_CHECK([ovs-ofctl add-flow br0 'idle_timeout=80 in_port=2 dl_src=00:99:aa:bb:cc:dd actions=drop'])
564 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
565 idle_timeout=30, in_port=1,dl_src=00:22:33:44:55:66 actions=drop
566 idle_timeout=40, in_port=1,dl_src=00:33:44:55:66:77 actions=drop
567 idle_timeout=50, in_port=2,dl_src=00:66:77:88:99:aa actions=drop
568 idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=drop
569 idle_timeout=70, in_port=2,dl_src=00:88:99:aa:bb:cc actions=drop
570 idle_timeout=80, in_port=2,dl_src=00:99:aa:bb:cc:dd actions=drop
571 in_port=2,dl_src=00:55:66:77:88:99 actions=drop
574 # Reducing the flow limit also causes the flows that expire soonest
575 # overall to be evicted.
576 AT_CHECK([ovs-vsctl set Flow_Table evict flow-limit=4])
577 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
578 idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=drop
579 idle_timeout=70, in_port=2,dl_src=00:88:99:aa:bb:cc actions=drop
580 idle_timeout=80, in_port=2,dl_src=00:99:aa:bb:cc:dd actions=drop
581 in_port=2,dl_src=00:55:66:77:88:99 actions=drop
587 AT_SETUP([ofproto - asynchronous message control])
589 AT_CHECK([ovs-ofctl -P openflow10 monitor br0 --detach --no-chdir --pidfile])
591 printf '\n\n--- check_async %d ---\n\n\n' $1
594 ovs-appctl -t ovs-ofctl ofctl/barrier
595 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
598 # OFPT_PACKET_IN, OFPR_ACTION (controller_id=0)
599 ovs-ofctl -v packet-out br0 none controller '0001020304050010203040501234'
600 if test X"$1" = X"OFPR_ACTION"; then shift;
601 echo >>expout "OFPT_PACKET_IN: total_len=14 in_port=NONE (via action) data_len=14 (unbuffered)
602 priority:0,tunnel:0,metadata:0,in_port:0000,tci(0) mac(00:10:20:30:40:50->00:01:02:03:04:05) type:1234"
605 # OFPT_PACKET_IN, OFPR_NO_MATCH (controller_id=123)
606 ovs-ofctl -v packet-out br0 none 'controller(reason=no_match,id=123)' '0001020304050010203040501234'
607 if test X"$1" = X"OFPR_NO_MATCH"; then shift;
608 echo >>expout "OFPT_PACKET_IN: total_len=14 in_port=NONE (via no_match) data_len=14 (unbuffered)
609 priority:0,tunnel:0,metadata:0,in_port:0000,tci(0) mac(00:10:20:30:40:50->00:01:02:03:04:05) type:1234"
612 # OFPT_PACKET_IN, OFPR_INVALID_TTL (controller_id=0)
613 ovs-ofctl packet-out br0 none dec_ttl '002583dfb4000026b98cb0f908004500003fb7e200000011339bac11370dac100002d7730035002b8f6d86fb0100000100000000000006626c702d7873066e696369726103636f6d00000f00'
614 if test X"$1" = X"OFPR_INVALID_TTL"; then shift;
615 echo >>expout "OFPT_PACKET_IN: total_len=76 in_port=NONE (via invalid_ttl) data_len=76 (unbuffered)
616 priority:0,tunnel:0,metadata:0,in_port:0000,tci(0) mac(00:26:b9:8c:b0:f9->00:25:83:df:b4:00) type:0800 proto:17 tos:0 ttl:0 ip(172.17.55.13->172.16.0.2) port(55155->53) udp_csum:8f6d"
619 # OFPT_PORT_STATUS, OFPPR_ADD
620 ovs-vsctl add-port br0 test -- set Interface test type=dummy
621 if test X"$1" = X"OFPPR_ADD"; then shift;
622 echo >>expout "OFPT_PORT_STATUS: ADD: 1(test): addr:aa:55:aa:55:00:0x
625 speed: 100 Mbps now, 100 Mbps max"
628 # OFPT_PORT_STATUS, OFPPR_DELETE
629 ovs-vsctl del-port br0 test
630 if test X"$1" = X"OFPPR_DELETE"; then shift;
631 echo >>expout "OFPT_PORT_STATUS: DEL: 1(test): addr:aa:55:aa:55:00:0x
634 speed: 100 Mbps now, 100 Mbps max"
637 # OFPT_FLOW_REMOVED, OFPRR_DELETE
638 ovs-ofctl add-flow br0 send_flow_rem,actions=drop
639 ovs-ofctl --strict del-flows br0 ''
640 if test X"$1" = X"OFPRR_DELETE"; then shift;
641 echo >>expout "OFPT_FLOW_REMOVED: reason=delete"
643 AT_FAIL_IF([test X"$1" != X])
645 ovs-appctl -t ovs-ofctl ofctl/barrier
646 echo >>expout "OFPT_BARRIER_REPLY:"
650 s/ (xid=0x[0-9a-fA-F]*)//
652 s/00:0.$/00:0x/' < monitor.log]],
656 # It's a service connection so initially there should be no async messages.
659 # Set miss_send_len to 128, turning on packet-ins for our service connection.
660 ovs-appctl -t ovs-ofctl ofctl/send 0109000c0123456700000080
661 check_async 2 OFPR_ACTION OFPPR_ADD OFPPR_DELETE OFPRR_DELETE
663 # Set miss_send_len to 128 and enable invalid_ttl.
664 ovs-appctl -t ovs-ofctl ofctl/send 0109000c0123456700040080
665 check_async 3 OFPR_ACTION OFPR_INVALID_TTL OFPPR_ADD OFPPR_DELETE OFPRR_DELETE
667 # Become slave, which should disable everything except port status.
668 ovs-appctl -t ovs-ofctl ofctl/send 0104001400000002000023200000000a00000002
669 check_async 4 OFPPR_ADD OFPPR_DELETE
671 # Use NXT_SET_ASYNC_CONFIG to enable a patchwork of asynchronous messages.
672 ovs-appctl -t ovs-ofctl ofctl/send 01040028000000020000232000000013000000020000000500000005000000020000000200000005
673 check_async 5 OFPR_INVALID_TTL OFPPR_DELETE OFPRR_DELETE
675 # Set controller ID 123.
676 ovs-appctl -t ovs-ofctl ofctl/send 01040018000000030000232000000014000000000000007b
677 check_async 6 OFPR_NO_MATCH OFPPR_DELETE OFPRR_DELETE
679 # Restore controller ID 0.
680 ovs-appctl -t ovs-ofctl ofctl/send 010400180000000300002320000000140000000000000000
683 ovs-appctl -t ovs-ofctl ofctl/send 0104001400000002000023200000000a00000001
684 check_async 7 OFPR_ACTION OFPPR_ADD
686 ovs-appctl -t ovs-ofctl exit
690 dnl This test checks that OFPT_PACKET_OUT accepts both OFPP_NONE (as
691 dnl specified by OpenFlow 1.0) and OFPP_CONTROLLER (used by some
692 dnl controllers despite the spec) as meaning a packet that was generated
693 dnl by the controller.
694 AT_SETUP([ofproto - packet-out from controller])
697 # Start a monitor listening for packet-ins.
698 AT_CHECK([ovs-ofctl -P openflow10 monitor br0 --detach --no-chdir --pidfile])
699 ovs-appctl -t ovs-ofctl ofctl/send 0109000c0123456700000080
700 ovs-appctl -t ovs-ofctl ofctl/barrier
701 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
702 AT_CAPTURE_FILE([monitor.log])
704 # Send some packet-outs with OFPP_NONE and OFPP_CONTROLLER (65533) as in_port.
705 AT_CHECK([ovs-ofctl packet-out br0 none controller '0001020304050010203040501234'])
706 AT_CHECK([ovs-ofctl packet-out br0 controller controller '0001020304050010203040505678'])
708 # Stop the monitor and check its output.
709 ovs-appctl -t ovs-ofctl ofctl/barrier
710 ovs-appctl -t ovs-ofctl exit
712 AT_CHECK([sed 's/ (xid=0x[[0-9a-fA-F]]*)//' monitor.log], [0], [dnl
713 OFPT_PACKET_IN: total_len=14 in_port=NONE (via action) data_len=14 (unbuffered)
714 priority:0,tunnel:0,metadata:0,in_port:0000,tci(0) mac(00:10:20:30:40:50->00:01:02:03:04:05) type:1234
715 OFPT_PACKET_IN: total_len=14 in_port=CONTROLLER (via action) data_len=14 (unbuffered)
716 priority:0,tunnel:0,metadata:0,in_port:0000,tci(0) mac(00:10:20:30:40:50->00:01:02:03:04:05) type:5678
723 dnl This test checks that metadata is encoded in packet_in structures,
724 dnl supported by NXAST.
725 AT_SETUP([ofproto - packet-out with metadata (NXM)])
728 # Start a monitor listening for packet-ins.
729 AT_CHECK([ovs-ofctl -P nxm monitor br0 --detach --no-chdir --pidfile])
730 ovs-appctl -t ovs-ofctl ofctl/send 0109000c0123456700000080
731 ovs-appctl -t ovs-ofctl ofctl/barrier
732 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
733 AT_CAPTURE_FILE([monitor.log])
735 # Send a packet-out with a load action to set some metadata, and forward to controller
736 AT_CHECK([ovs-ofctl packet-out br0 none 'load(0xfafafafa5a5a5a5a->OXM_OF_METADATA[[0..63]]), controller' '0001020304050010203040501234'])
738 # Stop the monitor and check its output.
739 ovs-appctl -t ovs-ofctl ofctl/barrier
740 ovs-appctl -t ovs-ofctl exit
742 AT_CHECK([sed 's/ (xid=0x[[0-9a-fA-F]]*)//' monitor.log], [0], [dnl
743 NXT_PACKET_IN: total_len=14 in_port=NONE metadata=0xfafafafa5a5a5a5a (via action) data_len=14 (unbuffered)
744 priority:0,tunnel:0,metadata:0,in_port:0000,tci(0) mac(00:10:20:30:40:50->00:01:02:03:04:05) type:1234
751 AT_SETUP([ofproto - flow monitoring])
752 AT_KEYWORDS([monitor])
755 ovs-ofctl add-flow br0 in_port=0,dl_vlan=123,actions=output:1
757 # Start a monitor watching the flow table and check the initial reply.
758 ovs-ofctl monitor br0 watch: --detach --no-chdir --pidfile >monitor.log 2>&1
759 AT_CAPTURE_FILE([monitor.log])
760 ovs-appctl -t ovs-ofctl ofctl/barrier
761 AT_CHECK([sed 's/ (xid=0x[[1-9a-fA-F]][[0-9a-fA-F]]*)//' monitor.log], [0],
762 [NXST_FLOW_MONITOR reply:
763 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=123 actions=output:1
767 # Add, delete, and modify some flows and check the updates.
768 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
769 ovs-ofctl add-flow br0 in_port=0,dl_vlan=124,actions=output:2
770 ovs-ofctl add-flow br0 in_port=0,dl_vlan=123,actions=output:5
771 ovs-ofctl add-flow br0 in_port=0,dl_vlan=123,dl_vlan_pcp=0,actions=output:6
772 ovs-ofctl add-flow br0 in_port=0,dl_vlan=123,dl_vlan_pcp=1,actions=output:7
773 ovs-ofctl add-flow br0 in_port=0,dl_vlan=123,actions=output:8
774 ovs-ofctl add-flow br0 in_port=0,dl_vlan=65535,dl_vlan_pcp=0,actions=output:9
775 ovs-ofctl add-flow br0 in_port=0,dl_vlan=65535,dl_vlan_pcp=1,actions=output:10
776 ovs-ofctl add-flow br0 in_port=0,dl_vlan=65535,actions=output:11
777 ovs-ofctl add-flow br0 in_port=0,dl_vlan=8191,dl_vlan_pcp=0,actions=output:12
778 ovs-ofctl add-flow br0 in_port=0,dl_vlan=8191,dl_vlan_pcp=1,actions=output:13
779 ovs-ofctl add-flow br0 in_port=0,dl_vlan=8191,actions=output:14
780 ovs-ofctl add-flow br0 in_port=0,dl_vlan=0,dl_vlan_pcp=0,actions=output:15
781 ovs-ofctl add-flow br0 in_port=0,dl_vlan=0,dl_vlan_pcp=1,actions=output:16
782 ovs-ofctl add-flow br0 in_port=0,dl_vlan=0,actions=output:17
783 ovs-ofctl add-flow br0 in_port=0,dl_vlan=0,dl_vlan_pcp=0,actions=output:18
784 ovs-ofctl add-flow br0 in_port=0,dl_vlan=0,dl_vlan_pcp=1,actions=output:19
785 ovs-ofctl add-flow br0 in_port=0,dl_vlan=0,actions=output:20
786 ovs-ofctl add-flow br0 in_port=0,dl_vlan_pcp=0,actions=output:21
787 ovs-ofctl add-flow br0 in_port=0,dl_vlan_pcp=1,actions=output:22
788 ovs-ofctl add-flow br0 in_port=0,actions=output:23
789 ovs-ofctl mod-flows br0 cookie=5,dl_vlan=123,actions=output:3
790 ovs-ofctl del-flows br0 dl_vlan=123
791 ovs-ofctl del-flows br0
792 ovs-appctl -t ovs-ofctl ofctl/barrier
794 # Sorts groups of lines that start with a space, without moving them
795 # past the nearest line that does not start with a space.
803 print $_ foreach sort(@buffer);
808 print $_ foreach sort(@buffer);
810 AT_CHECK([sed 's/ (xid=0x[[1-9a-fA-F]][[0-9a-fA-F]]*)//' monitor.log | perl -e "$sort"], [0],
811 [NXST_FLOW_MONITOR reply (xid=0x0):
812 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=124 actions=output:2
813 NXST_FLOW_MONITOR reply (xid=0x0):
814 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=123 actions=output:5
815 NXST_FLOW_MONITOR reply (xid=0x0):
816 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=123,dl_vlan_pcp=0 actions=output:6
817 NXST_FLOW_MONITOR reply (xid=0x0):
818 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=123,dl_vlan_pcp=1 actions=output:7
819 NXST_FLOW_MONITOR reply (xid=0x0):
820 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=123 actions=output:8
821 NXST_FLOW_MONITOR reply (xid=0x0):
822 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=0,dl_vlan_pcp=0 actions=output:9
823 NXST_FLOW_MONITOR reply (xid=0x0):
824 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=0,dl_vlan_pcp=1 actions=output:10
825 NXST_FLOW_MONITOR reply (xid=0x0):
826 event=ADDED table=0 cookie=0 in_port=0,vlan_tci=0x0000 actions=output:11
827 NXST_FLOW_MONITOR reply (xid=0x0):
828 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=4095,dl_vlan_pcp=0 actions=output:12
829 NXST_FLOW_MONITOR reply (xid=0x0):
830 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=4095,dl_vlan_pcp=1 actions=output:13
831 NXST_FLOW_MONITOR reply (xid=0x0):
832 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=4095 actions=output:14
833 NXST_FLOW_MONITOR reply (xid=0x0):
834 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=0,dl_vlan_pcp=0 actions=output:15
835 NXST_FLOW_MONITOR reply (xid=0x0):
836 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=0,dl_vlan_pcp=1 actions=output:16
837 NXST_FLOW_MONITOR reply (xid=0x0):
838 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=0 actions=output:17
839 NXST_FLOW_MONITOR reply (xid=0x0):
840 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=0,dl_vlan_pcp=0 actions=output:18
841 NXST_FLOW_MONITOR reply (xid=0x0):
842 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=0,dl_vlan_pcp=1 actions=output:19
843 NXST_FLOW_MONITOR reply (xid=0x0):
844 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=0 actions=output:20
845 NXST_FLOW_MONITOR reply (xid=0x0):
846 event=ADDED table=0 cookie=0 in_port=0,dl_vlan_pcp=0 actions=output:21
847 NXST_FLOW_MONITOR reply (xid=0x0):
848 event=ADDED table=0 cookie=0 in_port=0,dl_vlan_pcp=1 actions=output:22
849 NXST_FLOW_MONITOR reply (xid=0x0):
850 event=ADDED table=0 cookie=0 in_port=0 actions=output:23
851 NXST_FLOW_MONITOR reply (xid=0x0):
852 event=MODIFIED table=0 cookie=0x5 in_port=0,dl_vlan=123 actions=output:3
853 event=MODIFIED table=0 cookie=0x5 in_port=0,dl_vlan=123,dl_vlan_pcp=0 actions=output:3
854 event=MODIFIED table=0 cookie=0x5 in_port=0,dl_vlan=123,dl_vlan_pcp=1 actions=output:3
855 NXST_FLOW_MONITOR reply (xid=0x0):
856 event=DELETED reason=delete table=0 cookie=0x5 in_port=0,dl_vlan=123 actions=output:3
857 event=DELETED reason=delete table=0 cookie=0x5 in_port=0,dl_vlan=123,dl_vlan_pcp=0 actions=output:3
858 event=DELETED reason=delete table=0 cookie=0x5 in_port=0,dl_vlan=123,dl_vlan_pcp=1 actions=output:3
859 NXST_FLOW_MONITOR reply (xid=0x0):
860 event=DELETED reason=delete table=0 cookie=0 in_port=0 actions=output:23
861 event=DELETED reason=delete table=0 cookie=0 in_port=0,dl_vlan=0 actions=output:20
862 event=DELETED reason=delete table=0 cookie=0 in_port=0,dl_vlan=0,dl_vlan_pcp=0 actions=output:18
863 event=DELETED reason=delete table=0 cookie=0 in_port=0,dl_vlan=0,dl_vlan_pcp=1 actions=output:19
864 event=DELETED reason=delete table=0 cookie=0 in_port=0,dl_vlan=124 actions=output:2
865 event=DELETED reason=delete table=0 cookie=0 in_port=0,dl_vlan=4095 actions=output:14
866 event=DELETED reason=delete table=0 cookie=0 in_port=0,dl_vlan=4095,dl_vlan_pcp=0 actions=output:12
867 event=DELETED reason=delete table=0 cookie=0 in_port=0,dl_vlan=4095,dl_vlan_pcp=1 actions=output:13
868 event=DELETED reason=delete table=0 cookie=0 in_port=0,dl_vlan_pcp=0 actions=output:21
869 event=DELETED reason=delete table=0 cookie=0 in_port=0,dl_vlan_pcp=1 actions=output:22
870 event=DELETED reason=delete table=0 cookie=0 in_port=0,vlan_tci=0x0000 actions=output:11
874 # Check that our own changes are reported as abbreviations.
875 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
876 ovs-ofctl add-flow br0 in_port=1,actions=output:2
877 ovs-ofctl add-flow br0 in_port=2,actions=output:1
878 ovs-appctl -t ovs-ofctl ofctl/send 010e004812345678003fffff00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003000000000000ffffffffffff0000
879 ovs-appctl -t ovs-ofctl ofctl/barrier
880 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip], [0], [NXST_FLOW reply:
882 AT_CHECK([sed 's/ (xid=0x[[1-9a-fA-F]][[0-9a-fA-F]]*)//' monitor.log], [0],
883 [NXST_FLOW_MONITOR reply (xid=0x0):
884 event=ADDED table=0 cookie=0 in_port=1 actions=output:2
885 NXST_FLOW_MONITOR reply (xid=0x0):
886 event=ADDED table=0 cookie=0 in_port=2 actions=output:1
887 send: OFPT_FLOW_MOD: DEL priority=0 actions=drop
888 NXST_FLOW_MONITOR reply (xid=0x0):
889 event=ABBREV xid=0x12345678
893 ovs-appctl -t ovs-ofctl exit
897 AT_SETUP([ofproto - flow monitoring pause and resume])
898 AT_KEYWORDS([monitor])
900 # The maximum socket receive buffer size is important for this test, which
901 # tests behavior when the receive buffer overflows.
902 if test -e /proc/sys/net/core/rmem_max; then
904 rmem_max=`cat /proc/sys/net/core/rmem_max`
905 elif rmem_max=`sysctl -n net.inet.tcp.recvbuf_max 2>/dev/null`; then
908 # Don't know how to get maximum socket receive buffer on this OS
911 # Calculate the total amount of queuing: rmem_max in the kernel, 128 kB
912 # in ofproto sending userspace (see ofmonitor_flush() in connmgr.c).
913 queue_size=`expr $rmem_max + 128 \* 1024`
914 echo rmem_max=$rmem_max queue_size=$queue_size
916 # Each flow update message takes up at least 48 bytes of space in queues
917 # and in practice more than that.
918 n_msgs=`expr $queue_size / 48`
923 # Start a monitor watching the flow table, then make it block.
924 ON_EXIT([kill `cat ovs-ofctl.pid`])
925 ovs-ofctl monitor br0 watch: --detach --no-chdir --pidfile >monitor.log 2>&1
926 AT_CAPTURE_FILE([monitor.log])
927 ovs-appctl -t ovs-ofctl ofctl/block
930 (echo "in_port=2,actions=output:2"
932 for ($i = 0; $i < '$n_msgs'; $i++) {
933 print "cookie=1,reg1=$i,actions=drop\n";
936 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
937 # Check that multipart flow dumps work properly:
938 AT_CHECK([ovs-ofctl diff-flows br0 flows.txt])
939 AT_CHECK([ovs-ofctl add-flow br0 in_port=1,cookie=3,actions=drop])
940 AT_CHECK([ovs-ofctl mod-flows br0 in_port=2,cookie=2,actions=output:2])
941 AT_CHECK([ovs-ofctl del-flows br0 cookie=1/-1])
943 ovs-appctl -t ovs-ofctl ofctl/unblock
944 ovs-appctl -t ovs-ofctl ofctl/barrier
946 ovs-appctl -t ovs-ofctl exit
948 # Check that the flow monitor reported the same number of flows
949 # added and deleted, but fewer than we actually added and deleted.
950 adds=`grep -c 'ADDED.*reg1=' monitor.log`
951 deletes=`grep -c 'DELETED.*reg1=' monitor.log`
952 echo adds=$adds deletes=$deletes
953 AT_CHECK([test $adds -gt 100 && test $adds -lt $n_msgs])
954 AT_CHECK([test $adds = $deletes])
956 # Check that the flow monitor reported everything in the expected order:
958 # event=ADDED table=0 cookie=0x1 reg1=0x22
960 # NXT_FLOW_MONITOR_PAUSED:
962 # event=DELETED reason=delete table=0 cookie=0x1 reg1=0x22
964 # event=ADDED table=0 cookie=0x3 in_port=1
965 # event=MODIFIED table=0 cookie=0x2 in_port=2 actions=output:2
966 # NXT_FLOW_MONITOR_RESUMED:
968 # except that, between the PAUSED and RESUMED, the order of the ADDED
969 # and MODIFIED lines lines depends on hash order, that is, it varies
970 # as we change the hash function or change architecture. Therefore,
971 # we use a couple of tests below to accept both orders.
972 AT_CHECK([ofctl_strip < monitor.log | sed -n -e '
975 /NXT_FLOW_MONITOR_PAUSED:/p
976 /NXT_FLOW_MONITOR_RESUMED:/p
977 ' > monitor.log.subset])
978 AT_CHECK([grep -v MODIFIED monitor.log.subset], [0], [dnl
979 event=ADDED table=0 cookie=0x1 reg1=0x22
980 NXT_FLOW_MONITOR_PAUSED:
981 event=DELETED reason=delete table=0 cookie=0x1 reg1=0x22
982 event=ADDED table=0 cookie=0x3 in_port=1
983 NXT_FLOW_MONITOR_RESUMED:
985 AT_CHECK([grep -v ADDED monitor.log.subset], [0], [dnl
986 NXT_FLOW_MONITOR_PAUSED:
987 event=DELETED reason=delete table=0 cookie=0x1 reg1=0x22
988 event=MODIFIED table=0 cookie=0x2 in_port=2 actions=output:2
989 NXT_FLOW_MONITOR_RESUMED: