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
65 AT_SETUP([ofproto - mod-port])
67 for command_config_state in \
69 'noflood NO_FLOOD 0' \
70 'down PORT_DOWN,NO_FLOOD LINK_DOWN' \
71 'flood PORT_DOWN LINK_DOWN' \
72 'no-receive PORT_DOWN,NO_RECV LINK_DOWN' \
73 'no-forward PORT_DOWN,NO_RECV,NO_FWD LINK_DOWN' \
74 'no-packet-in PORT_DOWN,NO_RECV,NO_FWD,NO_PACKET_IN LINK_DOWN' \
75 'forward PORT_DOWN,NO_RECV,NO_PACKET_IN LINK_DOWN' \
76 'packet-in PORT_DOWN,NO_RECV LINK_DOWN' \
80 set $command_config_state
81 command=$[1] config=`echo $[2] | sed 's/,/ /g'` state=$[3]
82 AT_CHECK([ovs-ofctl -vwarn mod-port br0 br0 $command])
83 AT_CHECK([ovs-ofctl -vwarn show br0], [0], [stdout])
84 AT_CHECK_UNQUOTED([STRIP_XIDS stdout], [0], [dnl
85 OFPT_FEATURES_REPLY: dpid:fedcba9876543210
86 n_tables:255, n_buffers:256
87 capabilities: FLOW_STATS TABLE_STATS PORT_STATS QUEUE_STATS ARP_MATCH_IP
88 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
89 LOCAL(br0): addr:aa:55:aa:55:00:00
92 speed: 100 Mbps now, 100 Mbps max
93 OFPT_GET_CONFIG_REPLY: frags=normal miss_send_len=0
99 AT_SETUP([ofproto - basic flow_mod commands (NXM)])
101 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip], [0], [NXST_FLOW reply:
103 AT_CHECK([echo 'in_port=1,actions=0' | ovs-ofctl add-flows br0 -])
104 AT_CHECK([ovs-ofctl add-flow br0 in_port=0,actions=1])
105 AT_CHECK([ovs-ofctl -F nxm add-flow br0 table=1,in_port=3,actions=2])
106 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
107 in_port=0 actions=output:1
108 in_port=1 actions=output:0
109 table=1, in_port=3 actions=output:2
112 AT_CHECK([ovs-ofctl dump-aggregate br0 table=0 | STRIP_XIDS], [0], [dnl
113 NXST_AGGREGATE reply: packet_count=0 byte_count=0 flow_count=2
115 AT_CHECK([ovs-ofctl del-flows br0])
116 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip], [0], [NXST_FLOW reply:
121 AT_SETUP([ofproto - basic flow_mod commands (OpenFlow 1.0)])
123 AT_CHECK([ovs-ofctl -F openflow10 dump-flows br0 | ofctl_strip], [0], [OFPST_FLOW reply:
125 AT_CHECK([echo 'in_port=1,actions=0' | ovs-ofctl -F openflow10 add-flows br0 -])
126 AT_CHECK([ovs-ofctl -F openflow10 add-flow br0 in_port=0,actions=1])
127 AT_CHECK([ovs-ofctl -F openflow10 add-flow br0 table=1,in_port=3,actions=2])
128 AT_CHECK([ovs-ofctl -F openflow10 dump-flows br0 | ofctl_strip | sort], [0], [dnl
129 in_port=0 actions=output:1
130 in_port=1 actions=output:0
131 table=1, in_port=3 actions=output:2
134 AT_CHECK([ovs-ofctl -F openflow10 dump-aggregate br0 table=0 | STRIP_XIDS], [0], [dnl
135 OFPST_AGGREGATE reply: packet_count=0 byte_count=0 flow_count=2
137 AT_CHECK([ovs-ofctl -F openflow10 del-flows br0])
138 AT_CHECK([ovs-ofctl -F openflow10 dump-flows br0 | ofctl_strip], [0], [OFPST_FLOW reply:
143 AT_SETUP([ofproto - dump flows with cookie])
145 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x1,in_port=1,actions=0])
146 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x2,in_port=2,actions=0])
147 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x3,in_port=3,actions=0])
148 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
149 cookie=0x1, in_port=1 actions=output:0
150 cookie=0x2, in_port=2 actions=output:0
151 cookie=0x3, in_port=3 actions=output:0
154 AT_CHECK([ovs-ofctl dump-aggregate br0 table=0 | STRIP_XIDS], [0], [dnl
155 NXST_AGGREGATE reply: packet_count=0 byte_count=0 flow_count=3
157 AT_CHECK([ovs-ofctl dump-flows br0 cookie=0x3/-1 | ofctl_strip | sort], [0], [dnl
158 cookie=0x3, in_port=3 actions=output:0
161 AT_CHECK([ovs-ofctl dump-aggregate br0 cookie=0x3/-1 | STRIP_XIDS], [0], [dnl
162 NXST_AGGREGATE reply: packet_count=0 byte_count=0 flow_count=1
167 AT_SETUP([ofproto - dump flows with cookie mask])
169 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x1,in_port=1,actions=0])
170 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x2,in_port=2,actions=0])
171 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x3,in_port=3,actions=0])
172 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
173 cookie=0x1, in_port=1 actions=output:0
174 cookie=0x2, in_port=2 actions=output:0
175 cookie=0x3, in_port=3 actions=output:0
178 AT_CHECK([ovs-ofctl dump-aggregate br0 table=0 | STRIP_XIDS], [0], [dnl
179 NXST_AGGREGATE reply: packet_count=0 byte_count=0 flow_count=3
181 AT_CHECK([ovs-ofctl dump-flows br0 cookie=0x3/0x1 | ofctl_strip | sort], [0], [dnl
182 cookie=0x1, in_port=1 actions=output:0
183 cookie=0x3, in_port=3 actions=output:0
186 AT_CHECK([ovs-ofctl dump-aggregate br0 cookie=0x3/0x1 | STRIP_XIDS], [0], [dnl
187 NXST_AGGREGATE reply: packet_count=0 byte_count=0 flow_count=2
192 AT_SETUP([ofproto - mod flow with cookie change (OpenFlow 1.0)])
194 AT_CHECK([ovs-ofctl -F openflow10 add-flow br0 cookie=0x1,in_port=1,actions=0])
195 AT_CHECK([ovs-ofctl -F openflow10 dump-flows br0 | ofctl_strip | sort], [0], [dnl
196 cookie=0x1, in_port=1 actions=output:0
200 AT_CHECK([ovs-ofctl -F openflow10 mod-flows br0 cookie=0x2,in_port=1,actions=0])
201 AT_CHECK([ovs-ofctl -F openflow10 dump-flows br0 | ofctl_strip | sort], [0], [dnl
202 cookie=0x2, in_port=1 actions=output:0
208 AT_SETUP([ofproto - mod flow with cookie change (NXM)])
210 AT_CHECK([ovs-ofctl -F nxm add-flow br0 cookie=0x1,in_port=1,actions=0])
211 AT_CHECK([ovs-ofctl -F nxm dump-flows br0 | ofctl_strip | sort], [0], [dnl
212 cookie=0x1, in_port=1 actions=output:0
216 AT_CHECK([ovs-ofctl -F nxm mod-flows br0 cookie=0x2,in_port=1,actions=0])
217 AT_CHECK([ovs-ofctl -F nxm dump-flows br0 | ofctl_strip | sort], [0], [dnl
218 cookie=0x2, in_port=1 actions=output:0
224 AT_SETUP([ofproto - mod flows based on cookie mask])
226 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x1,in_port=1,actions=0])
227 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x1,in_port=2,actions=0])
228 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x2,in_port=3,actions=0])
229 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
230 cookie=0x1, in_port=1 actions=output:0
231 cookie=0x1, in_port=2 actions=output:0
232 cookie=0x2, in_port=3 actions=output:0
236 AT_CHECK([ovs-ofctl -F nxm mod-flows br0 cookie=0x1/0xff,actions=4])
237 AT_CHECK([ovs-ofctl -F nxm dump-flows br0 | ofctl_strip | sort], [0], [dnl
238 cookie=0x1, in_port=1 actions=output:4
239 cookie=0x1, in_port=2 actions=output:4
240 cookie=0x2, in_port=3 actions=output:0
246 AT_SETUP([ofproto - mod flows based on cookie mask with cookie change])
248 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x1,in_port=1,actions=0])
249 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x1,in_port=2,actions=0])
250 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x2,in_port=3,actions=0])
251 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
252 cookie=0x1, in_port=1 actions=output:0
253 cookie=0x1, in_port=2 actions=output:0
254 cookie=0x2, in_port=3 actions=output:0
258 AT_CHECK([ovs-ofctl -F nxm mod-flows br0 cookie=1/-1,cookie=4,actions=4])
259 AT_CHECK([ovs-ofctl -F nxm dump-flows br0 | ofctl_strip | sort], [0], [dnl
260 cookie=0x2, in_port=3 actions=output:0
261 cookie=0x4, in_port=1 actions=output:4
262 cookie=0x4, in_port=2 actions=output:4
268 AT_SETUP([ofproto - mod flow with cookie miss (mask==0)])
270 AT_CHECK([ovs-ofctl -F nxm mod-flows br0 in_port=1,actions=0])
271 AT_CHECK([ovs-ofctl -F nxm dump-flows br0 | ofctl_strip | sort], [0], [dnl
272 in_port=1 actions=output:0
278 AT_SETUP([ofproto - mod flow with cookie miss (mask!=0)])
280 AT_CHECK([ovs-ofctl -F nxm mod-flows br0 cookie=1/1,in_port=1,actions=0])
281 AT_CHECK([ovs-ofctl -F nxm dump-flows br0 | ofctl_strip | sort], [0], [dnl
287 AT_SETUP([ofproto - del flows with cookies])
289 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x1,in_port=1,actions=0])
290 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x2,in_port=2,actions=0])
291 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x3,in_port=3,actions=0])
292 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
293 cookie=0x1, in_port=1 actions=output:0
294 cookie=0x2, in_port=2 actions=output:0
295 cookie=0x3, in_port=3 actions=output:0
299 AT_CHECK([ovs-ofctl del-flows br0])
300 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
306 AT_SETUP([ofproto - del flows based on cookie])
308 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x1,in_port=1,actions=0])
309 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x2,in_port=2,actions=0])
310 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x3,in_port=3,actions=0])
311 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
312 cookie=0x1, in_port=1 actions=output:0
313 cookie=0x2, in_port=2 actions=output:0
314 cookie=0x3, in_port=3 actions=output:0
318 AT_CHECK([ovs-ofctl del-flows br0 cookie=0x3/-1])
319 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
320 cookie=0x1, in_port=1 actions=output:0
321 cookie=0x2, in_port=2 actions=output:0
327 AT_SETUP([ofproto - del flows based on cookie mask])
329 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x1,in_port=1,actions=0])
330 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x2,in_port=2,actions=0])
331 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x3,in_port=3,actions=0])
332 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
333 cookie=0x1, in_port=1 actions=output:0
334 cookie=0x2, in_port=2 actions=output:0
335 cookie=0x3, in_port=3 actions=output:0
338 AT_CHECK([ovs-ofctl del-flows br0 cookie=0x3/0x1])
339 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
340 cookie=0x2, in_port=2 actions=output:0
346 AT_SETUP([ofproto - flow table configuration])
348 # Check the default configuration.
349 (echo "OFPST_TABLE reply (xid=0x1): 255 tables
350 0: classifier: wild=0x3fffff, max=1000000, active=0
353 while test $x -lt 254; do
354 printf " %d: %-8s: wild=0x3fffff, max=1000000, active=0
359 echo " 254: table254: wild=0x3fffff, max=1000000, active=2
360 lookup=0, matched=0") > expout
361 AT_CHECK([ovs-ofctl dump-tables br0], [0], [expout])
362 # Change the configuration.
365 -- --id=@t0 create Flow_Table name=main \
366 -- --id=@t1 create Flow_Table flow-limit=1024 \
367 -- set bridge br0 'flow_tables={1=@t1,0=@t0}' \
368 | perl $srcdir/uuidfilt.pl],
372 # Check that the configuration was updated.
373 mv expout orig-expout
374 (echo "OFPST_TABLE reply (xid=0x1): 255 tables
375 0: main : wild=0x3fffff, max=1000000, active=0
377 1: table1 : wild=0x3fffff, max= 1024, active=0
379 tail -n +6 orig-expout) > expout
380 AT_CHECK([ovs-ofctl dump-tables br0], [0], [expout])
384 AT_SETUP([ofproto - hard limits on flow table size])
386 # Configure a maximum of 4 flows.
389 -- --id=@t0 create Flow_Table flow-limit=4 \
390 -- set bridge br0 flow_tables:0=@t0 \
391 | perl $srcdir/uuidfilt.pl],
395 for in_port in 1 2 3 4; do
396 ovs-ofctl add-flow br0 in_port=$in_port,actions=drop
398 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
399 in_port=1 actions=drop
400 in_port=2 actions=drop
401 in_port=3 actions=drop
402 in_port=4 actions=drop
405 # Adding another flow will be refused.
406 AT_CHECK([ovs-ofctl add-flow br0 in_port=5,actions=drop], [1], [], [stderr])
407 AT_CHECK([head -n 1 stderr | ofctl_strip], [0],
408 [OFPT_ERROR: OFPFMFC_ALL_TABLES_FULL
410 # Also a mod-flow that would add a flow will be refused.
411 AT_CHECK([ovs-ofctl mod-flows br0 in_port=5,actions=drop], [1], [], [stderr])
412 AT_CHECK([head -n 1 stderr | ofctl_strip], [0],
413 [OFPT_ERROR: OFPFMFC_ALL_TABLES_FULL
415 # Replacing or modifying an existing flow is allowed.
416 AT_CHECK([ovs-ofctl add-flow br0 in_port=4,actions=normal])
417 AT_CHECK([ovs-ofctl mod-flows br0 in_port=3,actions=output:1])
418 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
419 in_port=1 actions=drop
420 in_port=2 actions=drop
421 in_port=3 actions=output:1
422 in_port=4 actions=NORMAL
428 AT_SETUP([ofproto - eviction upon table overflow])
430 # Configure a maximum of 4 flows.
433 -- --id=@t0 create Flow_Table flow-limit=4 overflow-policy=evict \
434 -- set bridge br0 flow_tables:0=@t0 \
435 | perl $srcdir/uuidfilt.pl],
439 for in_port in 4 3 2 1; do
440 ovs-ofctl add-flow br0 idle_timeout=${in_port}0,in_port=$in_port,actions=drop
442 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
443 idle_timeout=10, in_port=1 actions=drop
444 idle_timeout=20, in_port=2 actions=drop
445 idle_timeout=30, in_port=3 actions=drop
446 idle_timeout=40, in_port=4 actions=drop
449 # Adding another flow will cause the one that expires soonest to be evicted.
450 AT_CHECK([ovs-ofctl add-flow br0 in_port=5,actions=drop])
451 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
452 idle_timeout=20, in_port=2 actions=drop
453 idle_timeout=30, in_port=3 actions=drop
454 idle_timeout=40, in_port=4 actions=drop
455 in_port=5 actions=drop
458 # A mod-flow that adds a flow also causes eviction, but replacing or
459 # modifying an existing flow doesn't.
460 AT_CHECK([ovs-ofctl mod-flows br0 in_port=6,actions=drop])
461 AT_CHECK([ovs-ofctl add-flow br0 in_port=4,actions=normal])
462 AT_CHECK([ovs-ofctl mod-flows br0 in_port=3,actions=output:1])
463 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
464 idle_timeout=30, in_port=3 actions=output:1
465 in_port=4 actions=NORMAL
466 in_port=5 actions=drop
467 in_port=6 actions=drop
470 # Flows with no timeouts at all cannot be evicted.
471 AT_CHECK([ovs-ofctl add-flow br0 in_port=7,actions=normal])
472 AT_CHECK([ovs-ofctl add-flow br0 in_port=8,actions=drop], [1], [], [stderr])
473 AT_CHECK([head -n 1 stderr | ofctl_strip], [0],
474 [OFPT_ERROR: OFPFMFC_ALL_TABLES_FULL
476 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
477 in_port=4 actions=NORMAL
478 in_port=5 actions=drop
479 in_port=6 actions=drop
480 in_port=7 actions=NORMAL
486 AT_SETUP([ofproto - eviction upon table overflow, with fairness])
488 # Configure a maximum of 4 flows.
491 -- --id=@t0 create Flow_Table name=evict flow-limit=4 \
492 overflow-policy=evict \
493 groups='"NXM_OF_IN_PORT[[]]"' \
494 -- set bridge br0 flow_tables:0=@t0 \
495 | perl $srcdir/uuidfilt.pl],
499 ovs-ofctl add-flows br0 - <<EOF
500 idle_timeout=10 in_port=2 dl_src=00:44:55:66:77:88 actions=drop
501 idle_timeout=20 in_port=1 dl_src=00:11:22:33:44:55 actions=drop
502 idle_timeout=30 in_port=1 dl_src=00:22:33:44:55:66 actions=drop
503 idle_timeout=40 in_port=1 dl_src=00:33:44:55:66:77 actions=drop
505 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
506 idle_timeout=10, in_port=2,dl_src=00:44:55:66:77:88 actions=drop
507 idle_timeout=20, in_port=1,dl_src=00:11:22:33:44:55 actions=drop
508 idle_timeout=30, in_port=1,dl_src=00:22:33:44:55:66 actions=drop
509 idle_timeout=40, in_port=1,dl_src=00:33:44:55:66:77 actions=drop
512 # Adding another flow will cause the one that expires soonest within
513 # the largest group (those with in_port=1) to be evicted. In this
514 # case this is not the same as the one that expires soonest overall
515 # (which is what makes the test interesting):
516 AT_CHECK([ovs-ofctl add-flow br0 in_port=2,dl_src=00:55:66:77:88:99,actions=drop])
517 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
518 idle_timeout=10, in_port=2,dl_src=00:44:55:66:77:88 actions=drop
519 idle_timeout=30, in_port=1,dl_src=00:22:33:44:55:66 actions=drop
520 idle_timeout=40, in_port=1,dl_src=00:33:44:55:66:77 actions=drop
521 in_port=2,dl_src=00:55:66:77:88:99 actions=drop
524 # Enlarge the flow limit, change the eviction policy back to strictly
525 # based on expiration, and and add some flows.
526 AT_CHECK([ovs-vsctl set Flow_Table evict groups='[[]]' flow-limit=7])
527 ovs-ofctl add-flows br0 - <<EOF
528 idle_timeout=50 in_port=2 dl_src=00:66:77:88:99:aa actions=drop
529 idle_timeout=60 in_port=2 dl_src=00:77:88:99:aa:bb actions=drop
530 idle_timeout=70 in_port=2 dl_src=00:88:99:aa:bb:cc actions=drop
532 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
533 idle_timeout=10, in_port=2,dl_src=00:44:55:66:77:88 actions=drop
534 idle_timeout=30, in_port=1,dl_src=00:22:33:44:55:66 actions=drop
535 idle_timeout=40, in_port=1,dl_src=00:33:44:55:66:77 actions=drop
536 idle_timeout=50, in_port=2,dl_src=00:66:77:88:99:aa actions=drop
537 idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=drop
538 idle_timeout=70, in_port=2,dl_src=00:88:99:aa:bb:cc actions=drop
539 in_port=2,dl_src=00:55:66:77:88:99 actions=drop
542 # Adding another flow will cause the one that expires soonest overall
544 AT_CHECK([ovs-ofctl add-flow br0 'idle_timeout=80 in_port=2 dl_src=00:99:aa:bb:cc:dd actions=drop'])
545 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
546 idle_timeout=30, in_port=1,dl_src=00:22:33:44:55:66 actions=drop
547 idle_timeout=40, in_port=1,dl_src=00:33:44:55:66:77 actions=drop
548 idle_timeout=50, in_port=2,dl_src=00:66:77:88:99:aa actions=drop
549 idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=drop
550 idle_timeout=70, in_port=2,dl_src=00:88:99:aa:bb:cc actions=drop
551 idle_timeout=80, in_port=2,dl_src=00:99:aa:bb:cc:dd actions=drop
552 in_port=2,dl_src=00:55:66:77:88:99 actions=drop
555 # Reducing the flow limit also causes the flows that expire soonest
556 # overall to be evicted.
557 AT_CHECK([ovs-vsctl set Flow_Table evict flow-limit=4])
558 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
559 idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=drop
560 idle_timeout=70, in_port=2,dl_src=00:88:99:aa:bb:cc actions=drop
561 idle_timeout=80, in_port=2,dl_src=00:99:aa:bb:cc:dd actions=drop
562 in_port=2,dl_src=00:55:66:77:88:99 actions=drop
568 AT_SETUP([ofproto - asynchronous message control])
570 AT_CHECK([ovs-ofctl -P openflow10 monitor br0 --detach --no-chdir --pidfile])
572 printf '\n\n--- check_async %d ---\n\n\n' $1
575 ovs-appctl -t ovs-ofctl ofctl/barrier
576 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
579 # OFPT_PACKET_IN, OFPR_ACTION (controller_id=0)
580 ovs-ofctl -v packet-out br0 none controller '0001020304050010203040501234'
581 if test X"$1" = X"OFPR_ACTION"; then shift;
582 echo >>expout "OFPT_PACKET_IN: total_len=14 in_port=NONE (via action) data_len=14 (unbuffered)
583 priority:0,tunnel:0,in_port:0000,tci(0) mac(00:10:20:30:40:50->00:01:02:03:04:05) type:1234 proto:0 tos:0 ttl:0 ip(0.0.0.0->0.0.0.0)"
586 # OFPT_PACKET_IN, OFPR_NO_MATCH (controller_id=123)
587 ovs-ofctl -v packet-out br0 none 'controller(reason=no_match,id=123)' '0001020304050010203040501234'
588 if test X"$1" = X"OFPR_NO_MATCH"; then shift;
589 echo >>expout "OFPT_PACKET_IN: total_len=14 in_port=NONE (via no_match) data_len=14 (unbuffered)
590 priority:0,tunnel:0,in_port:0000,tci(0) mac(00:10:20:30:40:50->00:01:02:03:04:05) type:1234 proto:0 tos:0 ttl:0 ip(0.0.0.0->0.0.0.0)"
593 # OFPT_PACKET_IN, OFPR_INVALID_TTL (controller_id=0)
594 ovs-ofctl packet-out br0 none dec_ttl '002583dfb4000026b98cb0f908004500003fb7e200000011339bac11370dac100002d7730035002b8f6d86fb0100000100000000000006626c702d7873066e696369726103636f6d00000f00'
595 if test X"$1" = X"OFPR_INVALID_TTL"; then shift;
596 echo >>expout "OFPT_PACKET_IN: total_len=76 in_port=NONE (via invalid_ttl) data_len=76 (unbuffered)
597 priority:0,tunnel: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"
600 # OFPT_PORT_STATUS, OFPPR_ADD
601 ovs-vsctl add-port br0 test -- set Interface test type=dummy
602 if test X"$1" = X"OFPPR_ADD"; then shift;
603 echo >>expout "OFPT_PORT_STATUS: ADD: 1(test): addr:aa:55:aa:55:00:0x
606 speed: 100 Mbps now, 100 Mbps max"
609 # OFPT_PORT_STATUS, OFPPR_DELETE
610 ovs-vsctl del-port br0 test
611 if test X"$1" = X"OFPPR_DELETE"; then shift;
612 echo >>expout "OFPT_PORT_STATUS: DEL: 1(test): addr:aa:55:aa:55:00:0x
615 speed: 100 Mbps now, 100 Mbps max"
618 # OFPT_FLOW_REMOVED, OFPRR_DELETE
619 ovs-ofctl add-flow br0 send_flow_rem,actions=drop
620 ovs-ofctl --strict del-flows br0 ''
621 if test X"$1" = X"OFPRR_DELETE"; then shift;
622 echo >>expout "OFPT_FLOW_REMOVED: reason=delete"
624 AT_FAIL_IF([test X"$1" != X])
626 ovs-appctl -t ovs-ofctl ofctl/barrier
627 echo >>expout "OFPT_BARRIER_REPLY:"
631 s/ (xid=0x[0-9a-fA-F]*)//
633 s/00:0.$/00:0x/' < monitor.log]],
637 # It's a service connection so initially there should be no async messages.
640 # Set miss_send_len to 128, turning on packet-ins for our service connection.
641 ovs-appctl -t ovs-ofctl ofctl/send 0109000c0123456700000080
642 check_async 2 OFPR_ACTION OFPPR_ADD OFPPR_DELETE OFPRR_DELETE
644 # Set miss_send_len to 128 and enable invalid_ttl.
645 ovs-appctl -t ovs-ofctl ofctl/send 0109000c0123456700040080
646 check_async 3 OFPR_ACTION OFPR_INVALID_TTL OFPPR_ADD OFPPR_DELETE OFPRR_DELETE
648 # Become slave, which should disable everything except port status.
649 ovs-appctl -t ovs-ofctl ofctl/send 0104001400000002000023200000000a00000002
650 check_async 4 OFPPR_ADD OFPPR_DELETE
652 # Use NXT_SET_ASYNC_CONFIG to enable a patchwork of asynchronous messages.
653 ovs-appctl -t ovs-ofctl ofctl/send 01040028000000020000232000000013000000020000000500000005000000020000000200000005
654 check_async 5 OFPR_INVALID_TTL OFPPR_DELETE OFPRR_DELETE
656 # Set controller ID 123.
657 ovs-appctl -t ovs-ofctl ofctl/send 01040018000000030000232000000014000000000000007b
658 check_async 6 OFPR_NO_MATCH OFPPR_DELETE OFPRR_DELETE
660 # Restore controller ID 0.
661 ovs-appctl -t ovs-ofctl ofctl/send 010400180000000300002320000000140000000000000000
664 ovs-appctl -t ovs-ofctl ofctl/send 0104001400000002000023200000000a00000001
665 check_async 7 OFPR_ACTION OFPPR_ADD
667 ovs-appctl -t ovs-ofctl exit
671 dnl This test checks that OFPT_PACKET_OUT accepts both OFPP_NONE (as
672 dnl specified by OpenFlow 1.0) and OFPP_CONTROLLER (used by some
673 dnl controllers despite the spec) as meaning a packet that was generated
674 dnl by the controller.
675 AT_SETUP([ofproto - packet-out from controller])
678 # Start a monitor listening for packet-ins.
679 AT_CHECK([ovs-ofctl -P openflow10 monitor br0 --detach --no-chdir --pidfile])
680 ovs-appctl -t ovs-ofctl ofctl/send 0109000c0123456700000080
681 ovs-appctl -t ovs-ofctl ofctl/barrier
682 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
683 AT_CAPTURE_FILE([monitor.log])
685 # Send some packet-outs with OFPP_NONE and OFPP_CONTROLLER (65533) as in_port.
686 AT_CHECK([ovs-ofctl packet-out br0 none controller '0001020304050010203040501234'])
687 AT_CHECK([ovs-ofctl packet-out br0 65533 controller '0001020304050010203040505678'])
689 # Stop the monitor and check its output.
690 ovs-appctl -t ovs-ofctl ofctl/barrier
691 ovs-appctl -t ovs-ofctl exit
693 AT_CHECK([sed 's/ (xid=0x[[0-9a-fA-F]]*)//' monitor.log], [0], [dnl
694 OFPT_PACKET_IN: total_len=14 in_port=NONE (via action) data_len=14 (unbuffered)
695 priority:0,tunnel:0,in_port:0000,tci(0) mac(00:10:20:30:40:50->00:01:02:03:04:05) type:1234 proto:0 tos:0 ttl:0 ip(0.0.0.0->0.0.0.0)
696 OFPT_PACKET_IN: total_len=14 in_port=CONTROLLER (via action) data_len=14 (unbuffered)
697 priority:0,tunnel:0,in_port:0000,tci(0) mac(00:10:20:30:40:50->00:01:02:03:04:05) type:5678 proto:0 tos:0 ttl:0 ip(0.0.0.0->0.0.0.0)