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 - del group])
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_CHECK([ovs-ofctl -O OpenFlow11 -vwarn add-groups br0 groups.txt])
274 AT_CHECK([ovs-ofctl -F OXM-OpenFlow15 -O OpenFlow15 -vwarn dump-groups br0 1234], [0], [stdout])
275 AT_CHECK([STRIP_XIDS stdout], [0], [dnl
276 OFPST_GROUP_DESC reply (OF1.5):
277 group_id=1234,type=all,bucket=actions=output:10
279 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn del-groups br0 group_id=1234])
280 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn dump-groups br0], [0], [stdout])
281 AT_CHECK([STRIP_XIDS stdout], [0], [dnl
282 OFPST_GROUP_DESC reply (OF1.1):
283 group_id=1235,type=all,bucket=actions=output:10
285 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn del-groups br0 group_id=1234])
286 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn dump-groups br0], [0], [stdout])
287 AT_CHECK([STRIP_XIDS stdout], [0], [dnl
288 OFPST_GROUP_DESC reply (OF1.1):
289 group_id=1235,type=all,bucket=actions=output:10
291 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn del-groups br0], [0])
292 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn dump-groups br0], [0], [stdout])
293 AT_CHECK([STRIP_XIDS stdout], [0], [dnl
294 OFPST_GROUP_DESC reply (OF1.1):
299 dnl This is really bare-bones.
300 dnl It at least checks request and reply serialization and deserialization.
301 dnl Actions definition listed in both supported formats (w/ actions=)
302 AT_SETUP([ofproto - add indirect group])
304 dnl indirect group must have exactly one bucket
305 AT_DATA([stderr], [dnl
306 OFPT_ERROR (OF1.1) (xid=0x2): OFPGMFC_INVALID_GROUP
307 OFPT_GROUP_MOD (OF1.1) (xid=0x2): ***decode error: OFPGMFC_INVALID_GROUP***
309 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn add-group br0 'group_id=1234,type=indirect'], [1], , [stderr])
310 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn add-group br0 'group_id=1235,type=indirect,bucket=output:10'])
311 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn add-group br0 'group_id=1236,type=indirect,bucket=output:10,bucket=output:11'], [1], , [stderr])
315 dnl This is really bare-bones.
316 dnl It at least checks request and reply serialization and deserialization.
317 AT_SETUP([ofproto - del group deletes flows])
319 AT_DATA([groups.txt], [dnl
320 group_id=1234,type=all,bucket=output:10
321 group_id=1235,type=all,bucket=output:10
323 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn add-groups br0 groups.txt])
324 AT_DATA([flows.txt], [dnl
325 tcp actions=group:1234
326 udp actions=group:1235
328 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn add-flows br0 flows.txt])
329 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn dump-flows br0 | ofctl_strip | sort],
331 tcp actions=group:1234
332 udp actions=group:1235
333 OFPST_FLOW reply (OF1.1):
335 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn del-groups br0 group_id=1234])
336 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn dump-flows br0 | ofctl_strip | sort],
338 udp actions=group:1235
339 OFPST_FLOW reply (OF1.1):
341 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn del-groups br0 group_id=1234])
342 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn dump-flows br0 | ofctl_strip | sort],
344 udp actions=group:1235
345 OFPST_FLOW reply (OF1.1):
347 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn del-groups br0])
348 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn dump-flows br0 | ofctl_strip | sort],
350 OFPST_FLOW reply (OF1.1):
355 dnl This is really bare-bones.
356 dnl It at least checks request and reply serialization and deserialization.
357 AT_SETUP([ofproto - flow mod checks group availability])
359 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn add-group br0 group_id=1234,type=all,bucket=output:10])
360 AT_DATA([flows.txt], [dnl
361 tcp actions=group:1234
362 udp actions=group:1235
364 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn add-flow br0 'tcp actions=group:1234'])
365 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn add-flow br0 'tcp actions=group:1235'], [1], [], [stderr])
367 # The output should look like this:
369 # 00000000 02 0e 00 98 00 00 00 02-00 00 00 00 00 00 00 00 |................|
370 # 00000010 00 00 00 00 00 00 00 00-ff 00 00 00 00 00 80 00 |................|
371 # 00000020 ff ff ff ff ff ff ff ff-ff ff ff ff 00 00 00 00 |................|
372 # 00000030 00 00 00 58 00 00 00 00-00 00 03 d7 00 00 00 00 |...X............|
374 # This 'sed' command captures the error message but drops details.
375 AT_CHECK([sed '/truncated/d
376 /^000000.0/d' stderr | STRIP_XIDS], [0],
377 [OFPT_ERROR (OF1.1): OFPBAC_BAD_OUT_GROUP
378 OFPT_FLOW_MOD (OF1.1):
383 dnl This is really bare-bones.
384 dnl It at least checks request and reply serialization and deserialization.
385 AT_SETUP([ofproto - group description])
387 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn add-group br0 group_id=1234,type=all,bucket=output:10], [0], [stdout])
388 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn dump-groups br0], [0], [stdout])
389 AT_CHECK([STRIP_XIDS stdout], [0], [dnl
390 OFPST_GROUP_DESC reply (OF1.1):
391 group_id=1234,type=all,bucket=actions=output:10
396 dnl This is really bare-bones.
397 dnl It at least checks request and reply serialization and deserialization.
398 AT_SETUP([ofproto - group description])
400 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn add-group br0 group_id=1234,type=all,bucket=output:10])
401 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn dump-groups br0], [0], [stdout])
402 AT_CHECK([STRIP_XIDS stdout], [0], [dnl
403 OFPST_GROUP_DESC reply (OF1.1):
404 group_id=1234,type=all,bucket=actions=output:10
409 dnl This is really bare-bones.
410 dnl It at least checks request and reply serialization and deserialization.
411 AT_SETUP([ofproto - group features])
413 AT_CHECK([ovs-ofctl -O OpenFlow12 -vwarn dump-group-features br0], [0], [stdout])
414 AT_CHECK([STRIP_XIDS stdout], [0], [dnl
415 OFPST_GROUP_FEATURES reply (OF1.2):
423 dnl This is really bare-bones.
424 dnl It at least checks request and reply serialization and deserialization.
425 AT_SETUP([ofproto - group stats])
427 AT_DATA([groups.txt], [dnl
428 group_id=1234,type=all,bucket=output:10
429 group_id=1235,type=all,bucket=output:10
431 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn add-groups br0 groups.txt])
432 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn add-flow br0 'tcp actions=group:1234'])
433 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn dump-group-stats br0 group_id=1234], [0], [stdout])
434 AT_CHECK([STRIP_XIDS stdout | sort], [0], [dnl
435 group_id=1234,ref_count=1,packet_count=0,byte_count=0,bucket0:packet_count=0,byte_count=0
436 OFPST_GROUP reply (OF1.1):
438 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn dump-group-stats br0], [0], [stdout])
439 AT_CHECK([STRIP_XIDS stdout | sort], [0], [dnl
440 group_id=1234,ref_count=1,packet_count=0,byte_count=0,bucket0:packet_count=0,byte_count=0
441 group_id=1235,ref_count=0,packet_count=0,byte_count=0,bucket0:packet_count=0,byte_count=0
442 OFPST_GROUP reply (OF1.1):
447 AT_SETUP([ofproto - mod-port (OpenFlow 1.0)])
449 for command_config_state in \
451 'noflood NO_FLOOD 0' \
452 'down PORT_DOWN,NO_FLOOD LINK_DOWN' \
453 'flood PORT_DOWN LINK_DOWN' \
454 'no-receive PORT_DOWN,NO_RECV LINK_DOWN' \
455 'no-forward PORT_DOWN,NO_RECV,NO_FWD LINK_DOWN' \
456 'no-packet-in PORT_DOWN,NO_RECV,NO_FWD,NO_PACKET_IN LINK_DOWN' \
457 'forward PORT_DOWN,NO_RECV,NO_PACKET_IN LINK_DOWN' \
458 'packet-in PORT_DOWN,NO_RECV LINK_DOWN' \
462 set $command_config_state
463 command=$[1] config=`echo $[2] | sed 's/,/ /g'` state=$[3]
464 AT_CHECK([ovs-ofctl -vwarn mod-port br0 br0 $command])
465 AT_CHECK([ovs-ofctl -vwarn show br0], [0], [stdout])
466 AT_CHECK_UNQUOTED([STRIP_XIDS stdout], [0], [dnl
467 OFPT_FEATURES_REPLY: dpid:fedcba9876543210
468 n_tables:254, n_buffers:256
469 capabilities: FLOW_STATS TABLE_STATS PORT_STATS QUEUE_STATS ARP_MATCH_IP
470 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
471 LOCAL(br0): addr:aa:55:aa:55:00:00
474 speed: 0 Mbps now, 0 Mbps max
475 OFPT_GET_CONFIG_REPLY: frags=normal miss_send_len=0
481 AT_SETUP([ofproto - mod-port (OpenFlow 1.2)])
483 for command_config_state in \
485 'down PORT_DOWN LINK_DOWN' \
486 'no-receive PORT_DOWN,NO_RECV LINK_DOWN' \
487 'no-forward PORT_DOWN,NO_RECV,NO_FWD LINK_DOWN' \
488 'no-packet-in PORT_DOWN,NO_RECV,NO_FWD,NO_PACKET_IN LINK_DOWN' \
489 'forward PORT_DOWN,NO_RECV,NO_PACKET_IN LINK_DOWN' \
490 'packet-in PORT_DOWN,NO_RECV LINK_DOWN' \
494 set $command_config_state
495 command=$[1] config=`echo $[2] | sed 's/,/ /g'` state=$[3]
496 AT_CHECK([ovs-ofctl -O OpenFlow12 -vwarn mod-port br0 br0 $command])
497 AT_CHECK([ovs-ofctl -O OpenFlow12 -vwarn show br0], [0], [stdout])
498 AT_CHECK_UNQUOTED([STRIP_XIDS stdout], [0], [dnl
499 OFPT_FEATURES_REPLY (OF1.2): dpid:fedcba9876543210
500 n_tables:254, n_buffers:256
501 capabilities: FLOW_STATS TABLE_STATS PORT_STATS GROUP_STATS QUEUE_STATS
502 LOCAL(br0): addr:aa:55:aa:55:00:00
505 speed: 0 Mbps now, 0 Mbps max
506 OFPT_GET_CONFIG_REPLY (OF1.2): frags=normal miss_send_len=0
512 AT_SETUP([ofproto - mod-port (OpenFlow 1.4)])
514 for command_config_state in \
516 'down PORT_DOWN LINK_DOWN' \
517 'no-receive PORT_DOWN,NO_RECV LINK_DOWN' \
518 'no-forward PORT_DOWN,NO_RECV,NO_FWD LINK_DOWN' \
519 'no-packet-in PORT_DOWN,NO_RECV,NO_FWD,NO_PACKET_IN LINK_DOWN' \
520 'forward PORT_DOWN,NO_RECV,NO_PACKET_IN LINK_DOWN' \
521 'packet-in PORT_DOWN,NO_RECV LINK_DOWN' \
525 set $command_config_state
526 command=$[1] config=`echo $[2] | sed 's/,/ /g'` state=$[3]
527 AT_CHECK([ovs-ofctl -O OpenFlow14 -vwarn mod-port br0 br0 $command])
528 AT_CHECK([ovs-ofctl -O OpenFlow14 -vwarn show br0], [0], [stdout])
529 AT_CHECK_UNQUOTED([STRIP_XIDS stdout], [0], [dnl
530 OFPT_FEATURES_REPLY (OF1.4): dpid:fedcba9876543210
531 n_tables:254, n_buffers:256
532 capabilities: FLOW_STATS TABLE_STATS PORT_STATS GROUP_STATS QUEUE_STATS
533 OFPST_PORT_DESC reply (OF1.4):
534 LOCAL(br0): addr:aa:55:aa:55:00:00
537 speed: 0 Mbps now, 0 Mbps max
538 OFPT_GET_CONFIG_REPLY (OF1.4): frags=normal miss_send_len=0
544 AT_SETUP([ofproto - basic flow_mod commands (NXM)])
546 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip], [0], [NXST_FLOW reply:
548 AT_CHECK([echo 'in_port=2,actions=1' | ovs-ofctl add-flows br0 -])
549 AT_CHECK([ovs-ofctl add-flow br0 in_port=1,actions=2])
550 AT_CHECK([ovs-ofctl -F nxm add-flow br0 table=1,in_port=4,actions=3])
551 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
552 in_port=1 actions=output:2
553 in_port=2 actions=output:1
554 table=1, in_port=4 actions=output:3
557 AT_CHECK([ovs-ofctl dump-aggregate br0 table=0 | STRIP_XIDS], [0], [dnl
558 NXST_AGGREGATE reply: packet_count=0 byte_count=0 flow_count=2
560 AT_CHECK([ovs-ofctl del-flows br0])
561 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip], [0], [NXST_FLOW reply:
566 AT_SETUP([ofproto - basic flow_mod commands (OpenFlow 1.0)])
568 AT_CHECK([ovs-ofctl -F openflow10 dump-flows br0 | ofctl_strip], [0], [OFPST_FLOW reply:
570 AT_CHECK([echo 'in_port=2,actions=1' | ovs-ofctl -F openflow10 add-flows br0 -])
571 AT_CHECK([ovs-ofctl -F openflow10 add-flow br0 in_port=1,actions=2])
572 AT_CHECK([ovs-ofctl -F openflow10 add-flow br0 table=1,in_port=4,actions=3])
573 AT_CHECK([ovs-ofctl -F openflow10 dump-flows br0 | ofctl_strip | sort], [0], [dnl
574 in_port=1 actions=output:2
575 in_port=2 actions=output:1
576 table=1, in_port=4 actions=output:3
579 AT_CHECK([ovs-ofctl -F openflow10 dump-aggregate br0 table=0 | STRIP_XIDS], [0], [dnl
580 OFPST_AGGREGATE reply: packet_count=0 byte_count=0 flow_count=2
582 AT_CHECK([ovs-ofctl -F openflow10 del-flows br0])
583 AT_CHECK([ovs-ofctl -F openflow10 dump-flows br0 | ofctl_strip], [0], [OFPST_FLOW reply:
588 AT_SETUP([ofproto - basic flow_mod commands (OpenFlow 1.1)])
590 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip], [0], [OFPST_FLOW reply (OF1.1):
592 AT_CHECK([echo 'in_port=2,actions=1' | ovs-ofctl -O OpenFlow11 add-flows br0 -])
593 AT_CHECK([ovs-ofctl -O OpenFlow11 add-flow br0 in_port=1,actions=2])
594 AT_CHECK([ovs-ofctl -O OpenFlow11 add-flow br0 table=1,in_port=4,actions=3])
595 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0], [dnl
596 in_port=1 actions=output:2
597 in_port=2 actions=output:1
598 table=1, in_port=4 actions=output:3
599 OFPST_FLOW reply (OF1.1):
601 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-aggregate br0 table=0 | STRIP_XIDS], [0], [dnl
602 OFPST_AGGREGATE reply (OF1.1): packet_count=0 byte_count=0 flow_count=2
604 AT_CHECK([ovs-ofctl -O OpenFlow11 del-flows br0])
605 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip], [0], [OFPST_FLOW reply (OF1.1):
606 table=1, in_port=4 actions=output:3
611 AT_SETUP([ofproto - flow_mod negative test (OpenFlow 1.1)])
613 [set bridge br0 protocols=OpenFlow10,OpenFlow11,OpenFlow12,OpenFlow13])
614 AT_CHECK([ovs-ofctl add-flow -O OpenFlow11 br0 table=1,action=goto_table:2])
616 # The error message here actually comes from ovs-ofctl, not from ovs-vswitchd,
617 # but at least it's the same code in ofpacts_check() that issues the error.
618 AT_CHECK([ovs-ofctl add-flow -O OpenFlow11 br0 table=1,action=goto_table:1],
620 [ovs-ofctl: actions are invalid with specified match (OFPBIC_BAD_TABLE_ID)
625 AT_SETUP([ofproto - set-field flow_mod commands (NXM)])
627 AT_CHECK([ovs-ofctl add-flow br0 ipv6,table=1,in_port=3,actions=drop])
628 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])
629 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
630 table=1, ipv6,in_port=3 actions=load:0xa6badbfffefe59fa->NXM_NX_IPV6_SRC[[0..63]],load:0xfe8001234567890a->NXM_NX_IPV6_SRC[[64..127]]
636 AT_SETUP([ofproto - basic flow_mod commands (OpenFlow 1.2)])
638 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip], [0], [OFPST_FLOW reply (OF1.2):
640 AT_CHECK([echo 'in_port=2,actions=1' | ovs-ofctl -O OpenFlow12 add-flows br0 -])
641 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 in_port=1,actions=2])
642 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 table=1,in_port=4,actions=3])
643 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
644 in_port=1 actions=output:2
645 in_port=2 actions=output:1
646 table=1, in_port=4 actions=output:3
647 OFPST_FLOW reply (OF1.2):
649 AT_CHECK([ovs-ofctl -O OpenFlow12 del-flows br0])
650 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip], [0], [OFPST_FLOW reply (OF1.2):
655 AT_SETUP([ofproto - dump flows with cookie])
657 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x1,in_port=1,actions=1])
658 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x2,in_port=2,actions=1])
659 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x3,in_port=3,actions=1])
660 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
661 cookie=0x1, in_port=1 actions=output:1
662 cookie=0x2, in_port=2 actions=output:1
663 cookie=0x3, in_port=3 actions=output:1
666 AT_CHECK([ovs-ofctl dump-aggregate br0 table=0 | STRIP_XIDS], [0], [dnl
667 NXST_AGGREGATE reply: packet_count=0 byte_count=0 flow_count=3
669 AT_CHECK([ovs-ofctl dump-flows br0 cookie=0x3/-1 | ofctl_strip | sort], [0], [dnl
670 cookie=0x3, in_port=3 actions=output:1
673 AT_CHECK([ovs-ofctl dump-aggregate br0 cookie=0x3/-1 | STRIP_XIDS], [0], [dnl
674 NXST_AGGREGATE reply: packet_count=0 byte_count=0 flow_count=1
679 AT_SETUP([ofproto - mod flow with cookie change (OpenFlow 1.0)])
681 AT_CHECK([ovs-ofctl -F openflow10 add-flow br0 cookie=0x1,in_port=1,actions=1])
682 AT_CHECK([ovs-ofctl -F openflow10 dump-flows br0 | ofctl_strip | sort], [0], [dnl
683 cookie=0x1, in_port=1 actions=output:1
687 AT_CHECK([ovs-ofctl -F openflow10 mod-flows br0 cookie=0x2,in_port=1,actions=1])
688 AT_CHECK([ovs-ofctl -F openflow10 dump-flows br0 | ofctl_strip | sort], [0], [dnl
689 cookie=0x2, in_port=1 actions=output:1
695 AT_SETUP([ofproto - mod flow with cookie change (NXM)])
697 AT_CHECK([ovs-ofctl -F nxm add-flow br0 cookie=0x1,in_port=1,actions=1])
698 AT_CHECK([ovs-ofctl -F nxm dump-flows br0 | ofctl_strip | sort], [0], [dnl
699 cookie=0x1, in_port=1 actions=output:1
703 AT_CHECK([ovs-ofctl -F nxm mod-flows br0 cookie=0x2,in_port=1,actions=1])
704 AT_CHECK([ovs-ofctl -F nxm dump-flows br0 | ofctl_strip | sort], [0], [dnl
705 cookie=0x2, in_port=1 actions=output:1
711 AT_SETUP([ofproto - no mod flow with cookie change (OpenFlow 1.1)])
713 AT_CHECK([ovs-ofctl -O OpenFlow11 add-flow br0 cookie=0x1,in_port=1,actions=1])
714 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0], [dnl
715 cookie=0x1, in_port=1 actions=output:1
716 OFPST_FLOW reply (OF1.1):
718 AT_CHECK([ovs-ofctl -O OpenFlow11 mod-flows br0 cookie=0x2,in_port=1,actions=1])
719 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0], [dnl
720 cookie=0x1, in_port=1 actions=output:1
721 OFPST_FLOW reply (OF1.1):
726 dnl The OpenFlow 1.2 spec states that the cookie may not be modified
727 AT_SETUP([ofproto - no mod flow with cookie change (OpenFlow 1.2)])
729 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 cookie=0x1,in_port=1,actions=1])
730 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
731 cookie=0x1, in_port=1 actions=output:1
732 OFPST_FLOW reply (OF1.2):
735 AT_CHECK([ovs-ofctl -O OpenFlow12 mod-flows br0 cookie=0x2,in_port=1,actions=1])
736 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
737 cookie=0x1, in_port=1 actions=output:1
738 OFPST_FLOW reply (OF1.2):
743 AT_SETUP([ofproto - mod flows based on cookie mask (OpenFlow 1.0)])
745 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x1,in_port=1,actions=1])
746 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x1,in_port=2,actions=1])
747 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x2,in_port=3,actions=1])
748 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
749 cookie=0x1, in_port=1 actions=output:1
750 cookie=0x1, in_port=2 actions=output:1
751 cookie=0x2, in_port=3 actions=output:1
755 AT_CHECK([ovs-ofctl -F nxm mod-flows br0 cookie=0x1/0xff,actions=4])
756 AT_CHECK([ovs-ofctl -F nxm dump-flows br0 | ofctl_strip | sort], [0], [dnl
757 cookie=0x1, in_port=1 actions=output:4
758 cookie=0x1, in_port=2 actions=output:4
759 cookie=0x2, in_port=3 actions=output:1
765 AT_SETUP([ofproto - mod flows based on cookie mask (OpenFlow 1.1)])
767 AT_CHECK([ovs-ofctl -O OpenFlow11 add-flow br0 cookie=0x1,in_port=1,actions=1])
768 AT_CHECK([ovs-ofctl -O OpenFlow11 add-flow br0 cookie=0x1,in_port=2,actions=1])
769 AT_CHECK([ovs-ofctl -O OpenFlow11 add-flow br0 cookie=0x2,in_port=3,actions=1])
770 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0], [dnl
771 cookie=0x1, in_port=1 actions=output:1
772 cookie=0x1, in_port=2 actions=output:1
773 cookie=0x2, in_port=3 actions=output:1
774 OFPST_FLOW reply (OF1.1):
777 AT_CHECK([ovs-ofctl -O OpenFlow11 mod-flows br0 cookie=0x1/0xff,actions=4])
778 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0], [dnl
779 cookie=0x1, in_port=1 actions=output:4
780 cookie=0x1, in_port=2 actions=output:4
781 cookie=0x2, in_port=3 actions=output:1
782 OFPST_FLOW reply (OF1.1):
787 AT_SETUP([ofproto - mod flows based on cookie mask (OpenFlow 1.2)])
789 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 cookie=0x1,in_port=1,actions=1])
790 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 cookie=0x1,in_port=2,actions=1])
791 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 cookie=0x2,in_port=3,actions=1])
792 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
793 cookie=0x1, in_port=1 actions=output:1
794 cookie=0x1, in_port=2 actions=output:1
795 cookie=0x2, in_port=3 actions=output:1
796 OFPST_FLOW reply (OF1.2):
799 AT_CHECK([ovs-ofctl -O OpenFlow12 mod-flows br0 cookie=0x1/0xff,actions=4])
800 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
801 cookie=0x1, in_port=1 actions=output:4
802 cookie=0x1, in_port=2 actions=output:4
803 cookie=0x2, in_port=3 actions=output:1
804 OFPST_FLOW reply (OF1.2):
809 dnl The OpenFlow 1.2 spec states that the cookie may not be modified
810 AT_SETUP([ofproto - mod flows based on cookie mask with cookie change])
812 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x1,in_port=1,actions=1])
813 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x1,in_port=2,actions=1])
814 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x2,in_port=3,actions=1])
815 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
816 cookie=0x1, in_port=1 actions=output:1
817 cookie=0x1, in_port=2 actions=output:1
818 cookie=0x2, in_port=3 actions=output:1
822 AT_CHECK([ovs-ofctl -F nxm mod-flows br0 cookie=1/-1,cookie=4,actions=4])
823 AT_CHECK([ovs-ofctl -F nxm dump-flows br0 | ofctl_strip | sort], [0], [dnl
824 cookie=0x2, in_port=3 actions=output:1
825 cookie=0x4, in_port=1 actions=output:4
826 cookie=0x4, in_port=2 actions=output:4
832 AT_SETUP([ofproto - mod flow with cookie miss (mask==0) - NXM])
834 AT_CHECK([ovs-ofctl -F nxm mod-flows br0 in_port=1,actions=1])
835 AT_CHECK([ovs-ofctl -F nxm dump-flows br0 | ofctl_strip | sort], [0], [dnl
836 in_port=1 actions=output:1
842 AT_SETUP([ofproto - mod flow with cookie miss (mask==0) - OF1.1])
844 AT_CHECK([ovs-ofctl -O openflow11 mod-flows br0 in_port=1,actions=1])
845 AT_CHECK([ovs-ofctl -O openflow11 dump-flows br0 | ofctl_strip | sort], [0], [dnl
846 in_port=1 actions=output:1
847 OFPST_FLOW reply (OF1.1):
852 AT_SETUP([ofproto - mod flow with cookie miss (mask==0) - OF1.2])
854 AT_CHECK([ovs-ofctl -O openflow12 mod-flows br0 in_port=1,actions=1])
855 AT_CHECK([ovs-ofctl -O openflow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
856 OFPST_FLOW reply (OF1.2):
861 AT_SETUP([ofproto - mod flow with cookie miss (mask!=0) - NXM])
863 AT_CHECK([ovs-ofctl -F nxm mod-flows br0 cookie=1/1,in_port=1,actions=1])
864 AT_CHECK([ovs-ofctl -F nxm dump-flows br0 | ofctl_strip | sort], [0], [dnl
870 AT_SETUP([ofproto - mod flow with cookie miss (mask!=0) - OF1.1])
872 AT_CHECK([ovs-ofctl -O openflow11 mod-flows br0 cookie=1/1,in_port=1,actions=1])
873 AT_CHECK([ovs-ofctl -O openflow11 dump-flows br0 | ofctl_strip | sort], [0], [dnl
874 OFPST_FLOW reply (OF1.1):
879 AT_SETUP([ofproto - mod flow with cookie miss (mask!=0) - OF1.2])
881 AT_CHECK([ovs-ofctl -O openflow12 mod-flows br0 cookie=1/1,in_port=1,actions=1])
882 AT_CHECK([ovs-ofctl -O openflow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
883 OFPST_FLOW reply (OF1.2):
888 AT_SETUP([ofproto - del flows with cookies])
890 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x1,in_port=1,actions=1])
891 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x2,in_port=2,actions=1])
892 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x3,in_port=3,actions=1])
893 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
894 cookie=0x1, in_port=1 actions=output:1
895 cookie=0x2, in_port=2 actions=output:1
896 cookie=0x3, in_port=3 actions=output:1
900 AT_CHECK([ovs-ofctl del-flows br0])
901 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
907 AT_SETUP([ofproto - del flows based on cookie])
909 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x1,in_port=1,actions=1])
910 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x2,in_port=2,actions=1])
911 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x3,in_port=3,actions=1])
912 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
913 cookie=0x1, in_port=1 actions=output:1
914 cookie=0x2, in_port=2 actions=output:1
915 cookie=0x3, in_port=3 actions=output:1
919 AT_CHECK([ovs-ofctl del-flows br0 cookie=0x3/-1])
920 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
921 cookie=0x1, in_port=1 actions=output:1
922 cookie=0x2, in_port=2 actions=output:1
928 AT_SETUP([ofproto - del flows based on cookie mask])
930 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x1,in_port=1,actions=1])
931 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x2,in_port=2,actions=1])
932 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x3,in_port=3,actions=1])
933 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
934 cookie=0x1, in_port=1 actions=output:1
935 cookie=0x2, in_port=2 actions=output:1
936 cookie=0x3, in_port=3 actions=output:1
939 AT_CHECK([ovs-ofctl del-flows br0 cookie=0x3/0x1])
940 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
941 cookie=0x2, in_port=2 actions=output:1
947 AT_SETUP([ofproto - del flows based on table id (NXM)])
949 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x1,in_port=1,actions=1])
950 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x2,in_port=2,table=1,actions=1])
951 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
952 cookie=0x1, in_port=1 actions=output:1
953 cookie=0x2, table=1, in_port=2 actions=output:1
956 AT_CHECK([ovs-ofctl del-flows br0 table=0])
957 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
958 cookie=0x2, table=1, in_port=2 actions=output:1
961 AT_CHECK([ovs-ofctl del-flows br0 table=1])
962 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
965 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x1,in_port=1,actions=1])
966 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x2,in_port=2,table=1,actions=1])
967 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
968 cookie=0x1, in_port=1 actions=output:1
969 cookie=0x2, table=1, in_port=2 actions=output:1
972 AT_CHECK([ovs-ofctl del-flows br0])
973 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
979 AT_SETUP([ofproto - del flows based on table id (OpenFlow 1.1)])
981 AT_CHECK([ovs-ofctl -O OpenFlow11 add-flow br0 cookie=0x1,in_port=1,actions=1])
982 AT_CHECK([ovs-ofctl -O OpenFlow11 add-flow br0 cookie=0x2,in_port=2,table=1,actions=1])
983 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0], [dnl
984 cookie=0x1, in_port=1 actions=output:1
985 cookie=0x2, table=1, in_port=2 actions=output:1
986 OFPST_FLOW reply (OF1.1):
988 AT_CHECK([ovs-ofctl -O OpenFlow11 del-flows br0 table=0])
989 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0], [dnl
990 cookie=0x2, table=1, in_port=2 actions=output:1
991 OFPST_FLOW reply (OF1.1):
993 AT_CHECK([ovs-ofctl -O OpenFlow11 del-flows br0 table=1])
994 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0], [dnl
995 OFPST_FLOW reply (OF1.1):
997 AT_CHECK([ovs-ofctl -O OpenFlow11 add-flow br0 cookie=0x1,in_port=1,actions=1])
998 AT_CHECK([ovs-ofctl -O OpenFlow11 add-flow br0 cookie=0x2,in_port=2,table=1,actions=1])
999 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1000 cookie=0x1, in_port=1 actions=output:1
1001 cookie=0x2, table=1, in_port=2 actions=output:1
1002 OFPST_FLOW reply (OF1.1):
1004 AT_CHECK([ovs-ofctl -O OpenFlow11 del-flows br0])
1005 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip], [0], [dnl
1006 OFPST_FLOW reply (OF1.1):
1007 cookie=0x2, table=1, in_port=2 actions=output:1
1012 AT_SETUP([ofproto - del flows based on table id (OpenFlow 1.2)])
1014 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 cookie=0x1,in_port=1,actions=1])
1015 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 cookie=0x2,in_port=2,table=1,actions=1])
1016 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1017 cookie=0x1, in_port=1 actions=output:1
1018 cookie=0x2, table=1, in_port=2 actions=output:1
1019 OFPST_FLOW reply (OF1.2):
1021 AT_CHECK([ovs-ofctl -O OpenFlow12 del-flows br0 table=0])
1022 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1023 cookie=0x2, table=1, in_port=2 actions=output:1
1024 OFPST_FLOW reply (OF1.2):
1026 AT_CHECK([ovs-ofctl -O OpenFlow12 del-flows br0 table=1])
1027 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1028 OFPST_FLOW reply (OF1.2):
1030 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 cookie=0x1,in_port=1,actions=1])
1031 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 cookie=0x2,in_port=2,table=1,actions=1])
1032 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1033 cookie=0x1, in_port=1 actions=output:1
1034 cookie=0x2, table=1, in_port=2 actions=output:1
1035 OFPST_FLOW reply (OF1.2):
1037 AT_CHECK([ovs-ofctl -O OpenFlow12 del-flows br0])
1038 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1039 OFPST_FLOW reply (OF1.2):
1044 AT_SETUP([ofproto - flow table configuration (OpenFlow 1.0)])
1046 # Check the default configuration.
1047 (printf "OFPST_TABLE reply (xid=0x2):"
1050 while test $x -lt 254; do
1053 active=0, lookup=0, matched=0
1056 in_port: exact match or wildcard
1057 eth_src: exact match or wildcard
1058 eth_dst: exact match or wildcard
1059 eth_type: exact match or wildcard
1060 vlan_vid: exact match or wildcard
1061 vlan_pcp: exact match or wildcard
1062 ip_src: exact match or wildcard
1063 ip_dst: exact match or wildcard
1064 nw_proto: exact match or wildcard
1065 nw_tos: exact match or wildcard
1066 tcp_src: exact match or wildcard
1067 tcp_dst: exact match or wildcard
1072 AT_CHECK([ovs-ofctl dump-tables br0], [0], [expout])
1073 # Change the configuration.
1076 -- --id=@t0 create Flow_Table name=main \
1077 -- --id=@t1 create Flow_Table flow-limit=1024 \
1078 -- set bridge br0 'flow_tables={1=@t1,0=@t0}' \
1079 | ${PERL} $srcdir/uuidfilt.pl],
1083 # Check that the configuration was updated.
1084 mv expout orig-expout
1085 sed -e 's/classifier/main/
1086 21s/1000000/1024/' orig-expout > expout
1087 AT_CHECK([ovs-ofctl dump-tables br0], [0], [expout])
1091 AT_SETUP([ofproto - flow table configuration (OpenFlow 1.2)])
1093 # Check the default configuration.
1094 (printf "OFPST_TABLE reply (OF1.2) (xid=0x2):"
1097 while test $x -lt 254; do
1099 table $x (\"$name\"):
1100 active=0, lookup=0, matched=0
1101 metadata: match=0xffffffffffffffff write=0xffffffffffffffff
1104 instructions (table miss and others):
1105 instructions: apply_actions,clear_actions,write_actions,write_metadata,goto_table
1106 Write-Actions and Apply-Actions features:
1107 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
1108 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 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
1110 metadata: exact match or wildcard
1111 in_port_oxm: exact match or wildcard
1112 eth_src: exact match or wildcard
1113 eth_dst: exact match or wildcard
1114 eth_type: exact match or wildcard
1115 vlan_vid: exact match or wildcard
1116 vlan_pcp: exact match or wildcard
1117 mpls_label: exact match or wildcard
1118 mpls_tc: exact match or wildcard
1119 ip_src: exact match or wildcard
1120 ip_dst: exact match or wildcard
1121 ipv6_src: exact match or wildcard
1122 ipv6_dst: exact match or wildcard
1123 ipv6_label: exact match or wildcard
1124 nw_proto: exact match or wildcard
1125 ip_dscp: exact match or wildcard
1126 nw_ecn: exact match or wildcard
1127 arp_op: exact match or wildcard
1128 arp_spa: exact match or wildcard
1129 arp_tpa: exact match or wildcard
1130 arp_sha: exact match or wildcard
1131 arp_tha: exact match or wildcard
1132 tcp_src: exact match or wildcard
1133 tcp_dst: exact match or wildcard
1134 udp_src: exact match or wildcard
1135 udp_dst: exact match or wildcard
1136 sctp_src: exact match or wildcard
1137 sctp_dst: exact match or wildcard
1138 icmp_type: exact match or wildcard
1139 icmp_code: exact match or wildcard
1140 icmpv6_type: exact match or wildcard
1141 icmpv6_code: exact match or wildcard
1142 nd_target: exact match or wildcard
1143 nd_sll: exact match or wildcard
1144 nd_tll: exact match or wildcard"
1148 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-tables br0], [0], [expout])
1149 # Change the configuration.
1152 -- --id=@t0 create Flow_Table name=main \
1153 -- --id=@t1 create Flow_Table flow-limit=1024 \
1154 -- set bridge br0 'flow_tables={1=@t1,0=@t0}' \
1155 | ${PERL} $srcdir/uuidfilt.pl],
1159 # Check that the configuration was updated.
1160 mv expout orig-expout
1161 sed 's/classifier/main/
1162 53s/1000000/1024/' < orig-expout > expout
1163 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-tables br0], [0], [expout])
1167 AT_SETUP([ofproto - table features (OpenFlow 1.3)])
1171 while test $x -lt 254; do
1173 if test $x = 253; then
1178 echo " table $x (\"$name\"):
1179 metadata: match=0xffffffffffffffff write=0xffffffffffffffff
1181 instructions (table miss and others):
1183 instructions: meter,apply_actions,clear_actions,write_actions,write_metadata,goto_table
1184 Write-Actions and Apply-Actions features:
1185 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
1186 supported on Set-Field: tun_id tun_src tun_dst metadata in_port in_port_oxm pkt_mark 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 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
1188 dp_hash: arbitrary mask
1189 recirc_id: exact match or wildcard
1190 tun_id: arbitrary mask
1191 tun_src: arbitrary mask
1192 tun_dst: arbitrary mask
1193 metadata: arbitrary mask
1194 in_port: exact match or wildcard
1195 in_port_oxm: exact match or wildcard
1196 pkt_mark: arbitrary mask
1197 reg0: arbitrary mask
1198 reg1: arbitrary mask
1199 reg2: arbitrary mask
1200 reg3: arbitrary mask
1201 reg4: arbitrary mask
1202 reg5: arbitrary mask
1203 reg6: arbitrary mask
1204 reg7: arbitrary mask
1205 xreg0: arbitrary mask
1206 xreg1: arbitrary mask
1207 xreg2: arbitrary mask
1208 xreg3: arbitrary mask
1209 eth_src: arbitrary mask
1210 eth_dst: arbitrary mask
1211 eth_type: exact match or wildcard
1212 vlan_tci: arbitrary mask
1213 vlan_vid: arbitrary mask
1214 vlan_pcp: exact match or wildcard
1215 mpls_label: exact match or wildcard
1216 mpls_tc: exact match or wildcard
1217 mpls_bos: exact match or wildcard
1218 ip_src: arbitrary mask
1219 ip_dst: arbitrary mask
1220 ipv6_src: arbitrary mask
1221 ipv6_dst: arbitrary mask
1222 ipv6_label: arbitrary mask
1223 nw_proto: exact match or wildcard
1224 nw_tos: exact match or wildcard
1225 ip_dscp: exact match or wildcard
1226 nw_ecn: exact match or wildcard
1227 nw_ttl: exact match or wildcard
1228 ip_frag: arbitrary mask
1229 arp_op: exact match or wildcard
1230 arp_spa: arbitrary mask
1231 arp_tpa: arbitrary mask
1232 arp_sha: arbitrary mask
1233 arp_tha: arbitrary mask
1234 tcp_src: arbitrary mask
1235 tcp_dst: arbitrary mask
1236 tcp_flags: arbitrary mask
1237 udp_src: arbitrary mask
1238 udp_dst: arbitrary mask
1239 sctp_src: arbitrary mask
1240 sctp_dst: arbitrary mask
1241 icmp_type: exact match or wildcard
1242 icmp_code: exact match or wildcard
1243 icmpv6_type: exact match or wildcard
1244 icmpv6_code: exact match or wildcard
1245 nd_target: arbitrary mask
1246 nd_sll: arbitrary mask
1247 nd_tll: arbitrary mask"
1251 AT_CHECK([ovs-ofctl -O OpenFlow13 dump-table-features br0 | sed '/^$/d
1252 /^OFPST_TABLE_FEATURES/d'], [0], [expout])
1253 # Change the configuration.
1256 -- --id=@t0 create Flow_Table name=main \
1257 -- --id=@t1 create Flow_Table flow-limit=1024 \
1258 -- set bridge br0 'flow_tables={1=@t1,0=@t0}' \
1259 | ${PERL} $srcdir/uuidfilt.pl],
1263 # Check that the configuration was updated.
1264 mv expout orig-expout
1265 sed 's/classifier/main/
1266 73s/1000000/1024/' < orig-expout > expout
1267 AT_CHECK([ovs-ofctl -O OpenFlow13 dump-table-features br0 | sed '/^$/d
1268 /^OFPST_TABLE_FEATURES/d'], [0], [expout])
1272 AT_SETUP([ofproto - hard limits on flow table size (OpenFlow 1.0)])
1274 # Configure a maximum of 4 flows.
1277 -- --id=@t0 create Flow_Table flow-limit=4 \
1278 -- set bridge br0 flow_tables:0=@t0 \
1279 | ${PERL} $srcdir/uuidfilt.pl],
1283 for in_port in 1 2 3 4; do
1284 ovs-ofctl add-flow br0 in_port=$in_port,actions=drop
1286 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1287 in_port=1 actions=drop
1288 in_port=2 actions=drop
1289 in_port=3 actions=drop
1290 in_port=4 actions=drop
1293 # Adding another flow will be refused.
1294 AT_CHECK([ovs-ofctl add-flow br0 in_port=5,actions=drop], [1], [], [stderr])
1295 AT_CHECK([head -n 1 stderr | ofctl_strip], [0],
1296 [OFPT_ERROR: OFPFMFC_TABLE_FULL
1298 # Also a mod-flow that would add a flow will be refused.
1299 AT_CHECK([ovs-ofctl mod-flows br0 in_port=5,actions=drop], [1], [], [stderr])
1300 AT_CHECK([head -n 1 stderr | ofctl_strip], [0],
1301 [OFPT_ERROR: OFPFMFC_TABLE_FULL
1303 # Replacing or modifying an existing flow is allowed.
1304 AT_CHECK([ovs-ofctl add-flow br0 in_port=4,actions=normal])
1305 AT_CHECK([ovs-ofctl mod-flows br0 in_port=3,actions=output:1])
1306 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1307 in_port=1 actions=drop
1308 in_port=2 actions=drop
1309 in_port=3 actions=output:1
1310 in_port=4 actions=NORMAL
1316 AT_SETUP([ofproto - hard limits on flow table size (OpenFlow 1.2)])
1318 # Configure a maximum of 4 flows.
1321 -- --id=@t0 create Flow_Table flow-limit=4 \
1322 -- set bridge br0 flow_tables:0=@t0 \
1323 | ${PERL} $srcdir/uuidfilt.pl],
1327 for in_port in 1 2 3 4; do
1328 ovs-ofctl -O OpenFlow12 add-flow br0 in_port=$in_port,actions=drop
1330 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1331 in_port=1 actions=drop
1332 in_port=2 actions=drop
1333 in_port=3 actions=drop
1334 in_port=4 actions=drop
1335 OFPST_FLOW reply (OF1.2):
1337 # Adding another flow will be refused.
1338 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 in_port=5,actions=drop], [1], [], [stderr])
1339 AT_CHECK([head -n 1 stderr | ofctl_strip], [0],
1340 [OFPT_ERROR (OF1.2): OFPFMFC_TABLE_FULL
1342 # Replacing or modifying an existing flow is allowed.
1343 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 in_port=4,actions=normal])
1344 AT_CHECK([ovs-ofctl -O OpenFlow12 mod-flows br0 in_port=3,actions=output:1])
1345 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1346 in_port=1 actions=drop
1347 in_port=2 actions=drop
1348 in_port=3 actions=output:1
1349 in_port=4 actions=NORMAL
1350 OFPST_FLOW reply (OF1.2):
1355 AT_SETUP([ofproto - eviction upon table overflow (OpenFlow 1.0)])
1357 # Configure a maximum of 4 flows.
1360 -- --id=@t0 create Flow_Table flow-limit=4 overflow-policy=evict \
1361 -- set bridge br0 flow_tables:0=@t0 \
1362 | ${PERL} $srcdir/uuidfilt.pl],
1366 for in_port in 4 3 2 1; do
1367 ovs-ofctl add-flow br0 idle_timeout=${in_port}0,in_port=$in_port,actions=drop
1369 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1370 idle_timeout=10, in_port=1 actions=drop
1371 idle_timeout=20, in_port=2 actions=drop
1372 idle_timeout=30, in_port=3 actions=drop
1373 idle_timeout=40, in_port=4 actions=drop
1376 # Adding another flow will cause the one that expires soonest to be evicted.
1377 AT_CHECK([ovs-ofctl add-flow br0 in_port=5,actions=drop])
1378 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1379 idle_timeout=20, in_port=2 actions=drop
1380 idle_timeout=30, in_port=3 actions=drop
1381 idle_timeout=40, in_port=4 actions=drop
1382 in_port=5 actions=drop
1385 # A mod-flow that adds a flow also causes eviction, but replacing or
1386 # modifying an existing flow doesn't.
1387 AT_CHECK([ovs-ofctl mod-flows br0 in_port=6,actions=drop])
1388 AT_CHECK([ovs-ofctl add-flow br0 in_port=4,actions=normal])
1389 AT_CHECK([ovs-ofctl mod-flows br0 in_port=3,actions=output:1])
1390 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1391 idle_timeout=30, in_port=3 actions=output:1
1392 in_port=4 actions=NORMAL
1393 in_port=5 actions=drop
1394 in_port=6 actions=drop
1397 # Flows with no timeouts at all cannot be evicted.
1398 AT_CHECK([ovs-ofctl add-flow br0 in_port=7,actions=normal])
1399 AT_CHECK([ovs-ofctl add-flow br0 in_port=8,actions=drop], [1], [], [stderr])
1400 AT_CHECK([head -n 1 stderr | ofctl_strip], [0],
1401 [OFPT_ERROR: OFPFMFC_TABLE_FULL
1403 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1404 in_port=4 actions=NORMAL
1405 in_port=5 actions=drop
1406 in_port=6 actions=drop
1407 in_port=7 actions=NORMAL
1413 AT_SETUP([ofproto - eviction upon table overflow (OpenFlow 1.2)])
1415 # Configure a maximum of 4 flows.
1418 -- --id=@t0 create Flow_Table flow-limit=4 overflow-policy=evict \
1419 -- set bridge br0 flow_tables:0=@t0 \
1420 | ${PERL} $srcdir/uuidfilt.pl],
1424 for in_port in 4 3 2 1; do
1425 ovs-ofctl -O OpenFlow12 add-flow br0 idle_timeout=${in_port}0,in_port=$in_port,actions=drop
1427 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1428 idle_timeout=10, in_port=1 actions=drop
1429 idle_timeout=20, in_port=2 actions=drop
1430 idle_timeout=30, in_port=3 actions=drop
1431 idle_timeout=40, in_port=4 actions=drop
1432 OFPST_FLOW reply (OF1.2):
1434 # Adding another flow will cause the one that expires soonest to be evicted.
1435 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 in_port=5,actions=drop])
1436 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1437 idle_timeout=20, in_port=2 actions=drop
1438 idle_timeout=30, in_port=3 actions=drop
1439 idle_timeout=40, in_port=4 actions=drop
1440 in_port=5 actions=drop
1441 OFPST_FLOW reply (OF1.2):
1443 # In Open Flow 1.2 a mod-flow does not ever add a flow and thus
1444 # has no effect on eviction
1445 AT_CHECK([ovs-ofctl -O OpenFlow12 mod-flows br0 in_port=6,actions=drop])
1446 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 in_port=4,actions=normal])
1447 AT_CHECK([ovs-ofctl -O OpenFlow12 mod-flows br0 in_port=3,actions=output:1])
1448 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1449 idle_timeout=20, in_port=2 actions=drop
1450 idle_timeout=30, in_port=3 actions=output:1
1451 in_port=4 actions=NORMAL
1452 in_port=5 actions=drop
1453 OFPST_FLOW reply (OF1.2):
1455 # Flows with no timeouts at all cannot be evicted.
1456 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 in_port=6,actions=drop])
1457 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 in_port=7,actions=normal])
1458 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 in_port=8,actions=drop], [1], [], [stderr])
1459 AT_CHECK([head -n 1 stderr | ofctl_strip], [0],
1460 [OFPT_ERROR (OF1.2): OFPFMFC_TABLE_FULL
1462 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1463 in_port=4 actions=NORMAL
1464 in_port=5 actions=drop
1465 in_port=6 actions=drop
1466 in_port=7 actions=NORMAL
1467 OFPST_FLOW reply (OF1.2):
1472 AT_SETUP([ofproto - eviction upon table overflow, with fairness (OpenFlow 1.0)])
1474 # Configure a maximum of 4 flows.
1477 -- --id=@t0 create Flow_Table name=evict flow-limit=4 \
1478 overflow-policy=evict \
1479 groups='"NXM_OF_IN_PORT[[]]"' \
1480 -- set bridge br0 flow_tables:0=@t0 \
1481 | ${PERL} $srcdir/uuidfilt.pl],
1485 ovs-ofctl add-flows br0 - <<EOF
1486 idle_timeout=10 in_port=2 dl_src=00:44:55:66:77:88 actions=drop
1487 idle_timeout=20 in_port=1 dl_src=00:11:22:33:44:55 actions=drop
1488 idle_timeout=30 in_port=1 dl_src=00:22:33:44:55:66 actions=drop
1489 idle_timeout=40 in_port=1 dl_src=00:33:44:55:66:77 actions=drop
1491 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1492 idle_timeout=10, in_port=2,dl_src=00:44:55:66:77:88 actions=drop
1493 idle_timeout=20, in_port=1,dl_src=00:11:22:33:44:55 actions=drop
1494 idle_timeout=30, in_port=1,dl_src=00:22:33:44:55:66 actions=drop
1495 idle_timeout=40, in_port=1,dl_src=00:33:44:55:66:77 actions=drop
1498 # Adding another flow will cause the one that expires soonest within
1499 # the largest group (those with in_port=1) to be evicted. In this
1500 # case this is not the same as the one that expires soonest overall
1501 # (which is what makes the test interesting):
1502 AT_CHECK([ovs-ofctl add-flow br0 in_port=2,dl_src=00:55:66:77:88:99,actions=drop])
1503 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1504 idle_timeout=10, in_port=2,dl_src=00:44:55:66:77:88 actions=drop
1505 idle_timeout=30, in_port=1,dl_src=00:22:33:44:55:66 actions=drop
1506 idle_timeout=40, in_port=1,dl_src=00:33:44:55:66:77 actions=drop
1507 in_port=2,dl_src=00:55:66:77:88:99 actions=drop
1510 # Enlarge the flow limit, change the eviction policy back to strictly
1511 # based on expiration, and and add some flows.
1512 AT_CHECK([ovs-vsctl set Flow_Table evict groups='[[]]' flow-limit=7])
1513 ovs-ofctl add-flows br0 - <<EOF
1514 idle_timeout=50 in_port=2 dl_src=00:66:77:88:99:aa actions=drop
1515 idle_timeout=60 in_port=2 dl_src=00:77:88:99:aa:bb actions=drop
1516 idle_timeout=70 in_port=2 dl_src=00:88:99:aa:bb:cc actions=drop
1518 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1519 idle_timeout=10, in_port=2,dl_src=00:44:55:66:77:88 actions=drop
1520 idle_timeout=30, in_port=1,dl_src=00:22:33:44:55:66 actions=drop
1521 idle_timeout=40, in_port=1,dl_src=00:33:44:55:66:77 actions=drop
1522 idle_timeout=50, in_port=2,dl_src=00:66:77:88:99:aa actions=drop
1523 idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=drop
1524 idle_timeout=70, in_port=2,dl_src=00:88:99:aa:bb:cc actions=drop
1525 in_port=2,dl_src=00:55:66:77:88:99 actions=drop
1528 # Adding another flow will cause the one that expires soonest overall
1530 AT_CHECK([ovs-ofctl add-flow br0 'idle_timeout=80 in_port=2 dl_src=00:99:aa:bb:cc:dd actions=drop'])
1531 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1532 idle_timeout=30, in_port=1,dl_src=00:22:33:44:55:66 actions=drop
1533 idle_timeout=40, in_port=1,dl_src=00:33:44:55:66:77 actions=drop
1534 idle_timeout=50, in_port=2,dl_src=00:66:77:88:99:aa actions=drop
1535 idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=drop
1536 idle_timeout=70, in_port=2,dl_src=00:88:99:aa:bb:cc actions=drop
1537 idle_timeout=80, in_port=2,dl_src=00:99:aa:bb:cc:dd actions=drop
1538 in_port=2,dl_src=00:55:66:77:88:99 actions=drop
1541 # Reducing the flow limit also causes the flows that expire soonest
1542 # overall to be evicted.
1543 AT_CHECK([ovs-vsctl set Flow_Table evict flow-limit=4])
1544 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1545 idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=drop
1546 idle_timeout=70, in_port=2,dl_src=00:88:99:aa:bb:cc actions=drop
1547 idle_timeout=80, in_port=2,dl_src=00:99:aa:bb:cc:dd actions=drop
1548 in_port=2,dl_src=00:55:66:77:88:99 actions=drop
1554 AT_SETUP([ofproto - eviction upon table overflow, with fairness (OpenFlow 1.2)])
1556 # Configure a maximum of 4 flows.
1559 -- --id=@t0 create Flow_Table name=evict flow-limit=4 \
1560 overflow-policy=evict \
1561 groups='"NXM_OF_IN_PORT[[]]"' \
1562 -- set bridge br0 flow_tables:0=@t0 \
1563 | ${PERL} $srcdir/uuidfilt.pl],
1567 ovs-ofctl -O OpenFlow12 add-flows br0 - <<EOF
1568 idle_timeout=10 in_port=2 dl_src=00:44:55:66:77:88 actions=drop
1569 idle_timeout=20 in_port=1 dl_src=00:11:22:33:44:55 actions=drop
1570 idle_timeout=30 in_port=1 dl_src=00:22:33:44:55:66 actions=drop
1571 idle_timeout=40 in_port=1 dl_src=00:33:44:55:66:77 actions=drop
1573 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1574 idle_timeout=10, in_port=2,dl_src=00:44:55:66:77:88 actions=drop
1575 idle_timeout=20, in_port=1,dl_src=00:11:22:33:44:55 actions=drop
1576 idle_timeout=30, in_port=1,dl_src=00:22:33:44:55:66 actions=drop
1577 idle_timeout=40, in_port=1,dl_src=00:33:44:55:66:77 actions=drop
1578 OFPST_FLOW reply (OF1.2):
1580 # Adding another flow will cause the one that expires soonest within
1581 # the largest group (those with in_port=1) to be evicted. In this
1582 # case this is not the same as the one that expires soonest overall
1583 # (which is what makes the test interesting):
1584 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 in_port=2,dl_src=00:55:66:77:88:99,actions=drop])
1585 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1586 idle_timeout=10, in_port=2,dl_src=00:44:55:66:77:88 actions=drop
1587 idle_timeout=30, in_port=1,dl_src=00:22:33:44:55:66 actions=drop
1588 idle_timeout=40, in_port=1,dl_src=00:33:44:55:66:77 actions=drop
1589 in_port=2,dl_src=00:55:66:77:88:99 actions=drop
1590 OFPST_FLOW reply (OF1.2):
1592 # Enlarge the flow limit, change the eviction policy back to strictly
1593 # based on expiration, and and add some flows.
1594 AT_CHECK([ovs-vsctl set Flow_Table evict groups='[[]]' flow-limit=7])
1595 ovs-ofctl -O OpenFlow12 add-flows br0 - <<EOF
1596 idle_timeout=50 in_port=2 dl_src=00:66:77:88:99:aa actions=drop
1597 idle_timeout=60 in_port=2 dl_src=00:77:88:99:aa:bb actions=drop
1598 idle_timeout=70 in_port=2 dl_src=00:88:99:aa:bb:cc actions=drop
1600 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1601 idle_timeout=10, in_port=2,dl_src=00:44:55:66:77:88 actions=drop
1602 idle_timeout=30, in_port=1,dl_src=00:22:33:44:55:66 actions=drop
1603 idle_timeout=40, in_port=1,dl_src=00:33:44:55:66:77 actions=drop
1604 idle_timeout=50, in_port=2,dl_src=00:66:77:88:99:aa actions=drop
1605 idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=drop
1606 idle_timeout=70, in_port=2,dl_src=00:88:99:aa:bb:cc actions=drop
1607 in_port=2,dl_src=00:55:66:77:88:99 actions=drop
1608 OFPST_FLOW reply (OF1.2):
1610 # Adding another flow will cause the one that expires soonest overall
1612 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'])
1613 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1614 idle_timeout=30, in_port=1,dl_src=00:22:33:44:55:66 actions=drop
1615 idle_timeout=40, in_port=1,dl_src=00:33:44:55:66:77 actions=drop
1616 idle_timeout=50, in_port=2,dl_src=00:66:77:88:99:aa actions=drop
1617 idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=drop
1618 idle_timeout=70, in_port=2,dl_src=00:88:99:aa:bb:cc actions=drop
1619 idle_timeout=80, in_port=2,dl_src=00:99:aa:bb:cc:dd actions=drop
1620 in_port=2,dl_src=00:55:66:77:88:99 actions=drop
1621 OFPST_FLOW reply (OF1.2):
1623 # Reducing the flow limit also causes the flows that expire soonest
1624 # overall to be evicted.
1625 AT_CHECK([ovs-vsctl set Flow_Table evict flow-limit=4])
1626 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1627 idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=drop
1628 idle_timeout=70, in_port=2,dl_src=00:88:99:aa:bb:cc actions=drop
1629 idle_timeout=80, in_port=2,dl_src=00:99:aa:bb:cc:dd actions=drop
1630 in_port=2,dl_src=00:55:66:77:88:99 actions=drop
1631 OFPST_FLOW reply (OF1.2):
1636 AT_SETUP([ofproto - eviction upon table overflow, with modified hard timeout])
1638 # Configure a maximum of 4 flows.
1641 -- --id=@t0 create Flow_Table flow-limit=4 overflow-policy=evict \
1642 -- set bridge br0 flow_tables:0=@t0 \
1643 | ${PERL} $srcdir/uuidfilt.pl],
1646 ovs-appctl time/stop
1648 for in_port in 4 3 2 1; do
1649 ovs-ofctl add-flow br0 hard_timeout=$((10 + in_port * 3)),in_port=$in_port,actions=drop
1651 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1652 hard_timeout=13, in_port=1 actions=drop
1653 hard_timeout=16, in_port=2 actions=drop
1654 hard_timeout=19, in_port=3 actions=drop
1655 hard_timeout=22, in_port=4 actions=drop
1658 # Sleep and modify the one that expires soonest
1659 ovs-appctl time/warp 5000
1660 AT_CHECK([ovs-ofctl mod-flows br0 in_port=1,actions=drop])
1661 # At this point the table would looks like:
1662 # in_port seconds to expire
1667 ovs-appctl time/warp 2000
1668 # Adding another flow will cause the one that expires soonest to be evicted.
1669 AT_CHECK([ovs-ofctl add-flow br0 in_port=5,actions=drop])
1670 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1671 hard_timeout=13, in_port=1 actions=drop
1672 hard_timeout=19, in_port=3 actions=drop
1673 hard_timeout=22, in_port=4 actions=drop
1674 in_port=5 actions=drop
1680 AT_SETUP([ofproto - eviction upon table overflow, with modified idle timeout])
1681 OVS_VSWITCHD_START([add-port br0 p1 -- set interface p1 type=dummy ofport_request=1])
1682 # Configure a maximum of 4 flows.
1685 -- --id=@t0 create Flow_Table flow-limit=4 overflow-policy=evict \
1686 -- set bridge br0 flow_tables:0=@t0 \
1687 | ${PERL} $srcdir/uuidfilt.pl],
1691 for in_port in 4 3 2 1; do
1692 ovs-ofctl add-flow br0 idle_timeout=$((10 + in_port * 3)),in_port=$in_port,actions=drop
1694 ovs-appctl time/stop
1695 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1696 idle_timeout=13, in_port=1 actions=drop
1697 idle_timeout=16, in_port=2 actions=drop
1698 idle_timeout=19, in_port=3 actions=drop
1699 idle_timeout=22, in_port=4 actions=drop
1702 # Sleep and receive on the flow that expires soonest
1703 ovs-appctl time/warp 5000
1704 AT_CHECK([ovs-appctl netdev-dummy/receive p1 'in_port(1)'])
1705 # At this point the table would looks like:
1706 # in_port seconds to expire
1711 ovs-appctl time/warp 2000
1712 # Adding another flow will cause the one that expires soonest to be evicted.
1713 AT_CHECK([ovs-ofctl add-flow br0 in_port=5,actions=drop])
1714 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1715 idle_timeout=19, in_port=3 actions=drop
1716 idle_timeout=22, in_port=4 actions=drop
1717 in_port=5 actions=drop
1718 n_packets=1, n_bytes=60, idle_timeout=13, in_port=1 actions=drop
1724 AT_SETUP([ofproto - asynchronous message control (OpenFlow 1.0)])
1726 AT_CHECK([ovs-ofctl -P openflow10 monitor br0 --detach --no-chdir --pidfile])
1728 printf '\n\n--- check_async %d ---\n\n\n' $1
1731 ovs-appctl -t ovs-ofctl ofctl/barrier
1732 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
1735 # OFPT_PACKET_IN, OFPR_ACTION (controller_id=0)
1736 ovs-ofctl -v packet-out br0 controller controller '0001020304050010203040501234'
1737 if test X"$1" = X"OFPR_ACTION"; then shift;
1738 echo >>expout "OFPT_PACKET_IN: total_len=14 in_port=CONTROLLER (via action) data_len=14 (unbuffered)
1739 in_port=0,vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1234"
1742 # OFPT_PACKET_IN, OFPR_NO_MATCH (controller_id=123)
1743 ovs-ofctl -v packet-out br0 controller 'controller(reason=no_match,id=123)' '0001020304050010203040501234'
1744 if test X"$1" = X"OFPR_NO_MATCH"; then shift;
1745 echo >>expout "OFPT_PACKET_IN: total_len=14 in_port=CONTROLLER (via no_match) data_len=14 (unbuffered)
1746 in_port=0,vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1234"
1749 # OFPT_PACKET_IN, OFPR_INVALID_TTL (controller_id=0)
1750 ovs-ofctl packet-out br0 controller dec_ttl '002583dfb4000026b98cb0f908004500003fb7e200000011339bac11370dac100002d7730035002b8f6d86fb0100000100000000000006626c702d7873066e696369726103636f6d00000f00'
1751 if test X"$1" = X"OFPR_INVALID_TTL"; then shift;
1752 echo >>expout "OFPT_PACKET_IN: total_len=76 in_port=CONTROLLER (via invalid_ttl) data_len=76 (unbuffered)
1753 udp,in_port=0,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"
1756 # OFPT_PORT_STATUS, OFPPR_ADD
1757 ovs-vsctl add-port br0 test -- set Interface test type=dummy ofport_request=1
1758 if test X"$1" = X"OFPPR_ADD"; then shift;
1759 echo >>expout "OFPT_PORT_STATUS: ADD: 1(test): addr:aa:55:aa:55:00:0x
1762 speed: 0 Mbps now, 0 Mbps max"
1765 # OFPT_PORT_STATUS, OFPPR_DELETE
1766 ovs-vsctl del-port br0 test
1767 if test X"$1" = X"OFPPR_DELETE"; then shift;
1768 echo >>expout "OFPT_PORT_STATUS: DEL: 1(test): addr:aa:55:aa:55:00:0x
1771 speed: 0 Mbps now, 0 Mbps max"
1774 # OFPT_FLOW_REMOVED, OFPRR_DELETE
1775 ovs-ofctl add-flow br0 send_flow_rem,actions=drop
1776 ovs-ofctl --strict del-flows br0 ''
1777 if test X"$1" = X"OFPRR_DELETE"; then shift;
1778 echo >>expout "OFPT_FLOW_REMOVED: reason=delete"
1780 AT_FAIL_IF([test X"$1" != X])
1782 ovs-appctl -t ovs-ofctl ofctl/barrier
1783 echo >>expout "OFPT_BARRIER_REPLY:"
1787 s/ (xid=0x[0-9a-fA-F]*)//
1789 s/00:0.$/00:0x/' < monitor.log]],
1793 # It's a service connection so initially there should be no async messages.
1796 # Set miss_send_len to 128, turning on packet-ins for our service connection.
1797 ovs-appctl -t ovs-ofctl ofctl/send 0109000c0123456700000080
1798 check_async 2 OFPR_ACTION OFPPR_ADD OFPPR_DELETE OFPRR_DELETE
1800 # Set miss_send_len to 128 and enable invalid_ttl.
1801 ovs-appctl -t ovs-ofctl ofctl/send 0109000c0123456700040080
1802 check_async 3 OFPR_ACTION OFPR_INVALID_TTL OFPPR_ADD OFPPR_DELETE OFPRR_DELETE
1804 # Become slave, which should disable everything except port status.
1805 ovs-appctl -t ovs-ofctl ofctl/send 0104001400000002000023200000000a00000002
1806 check_async 4 OFPPR_ADD OFPPR_DELETE
1808 # Use NXT_SET_ASYNC_CONFIG to enable a patchwork of asynchronous messages.
1809 ovs-appctl -t ovs-ofctl ofctl/send 01040028000000020000232000000013000000020000000500000005000000020000000200000005
1810 check_async 5 OFPR_INVALID_TTL OFPPR_DELETE OFPRR_DELETE
1812 # Set controller ID 123.
1813 ovs-appctl -t ovs-ofctl ofctl/send 01040018000000030000232000000014000000000000007b
1814 check_async 6 OFPR_NO_MATCH OFPPR_DELETE OFPRR_DELETE
1816 # Restore controller ID 0.
1817 ovs-appctl -t ovs-ofctl ofctl/send 010400180000000300002320000000140000000000000000
1820 ovs-appctl -t ovs-ofctl ofctl/send 0104001400000002000023200000000a00000001
1821 check_async 7 OFPR_ACTION OFPPR_ADD
1823 ovs-appctl -t ovs-ofctl exit
1827 AT_SETUP([ofproto - asynchronous message control (OpenFlow 1.2)])
1829 AT_CHECK([ovs-ofctl -O OpenFlow12 monitor br0 --detach --no-chdir --pidfile])
1831 printf '\n\n--- check_async %d ---\n\n\n' $1
1835 ovs-appctl -t ovs-ofctl ofctl/barrier
1836 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
1839 # OFPT_PACKET_IN, OFPR_ACTION (controller_id=0)
1840 ovs-ofctl -O OpenFlow12 -v packet-out br0 none controller '0001020304050010203040501234'
1841 if test X"$1" = X"OFPR_ACTION"; then shift;
1842 echo >>expout "OFPT_PACKET_IN (OF1.2): total_len=14 in_port=ANY (via action) data_len=14 (unbuffered)
1843 in_port=0,vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1234"
1846 # OFPT_PACKET_IN, OFPR_NO_MATCH (controller_id=123)
1847 ovs-ofctl -O OpenFlow12 -v packet-out br0 none 'controller(reason=no_match,id=123)' '0001020304050010203040501234'
1848 if test X"$1" = X"OFPR_NO_MATCH"; then shift;
1849 echo >>expout "OFPT_PACKET_IN (OF1.2): total_len=14 in_port=ANY (via no_match) data_len=14 (unbuffered)
1850 in_port=0,vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1234"
1853 # OFPT_PACKET_IN, OFPR_INVALID_TTL (controller_id=0)
1854 ovs-ofctl -O OpenFlow12 packet-out br0 none dec_ttl '002583dfb4000026b98cb0f908004500003fb7e200000011339bac11370dac100002d7730035002b8f6d86fb0100000100000000000006626c702d7873066e696369726103636f6d00000f00'
1855 if test X"$1" = X"OFPR_INVALID_TTL"; then shift;
1856 echo >>expout "OFPT_PACKET_IN (OF1.2): total_len=76 in_port=ANY (via invalid_ttl) data_len=76 (unbuffered)
1857 udp,in_port=0,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"
1860 # OFPT_PORT_STATUS, OFPPR_ADD
1861 ovs-vsctl add-port br0 test -- set Interface test type=dummy
1862 if test X"$1" = X"OFPPR_ADD"; then shift;
1863 echo >>expout "OFPT_PORT_STATUS (OF1.2): ADD: ${INDEX}(test): addr:aa:55:aa:55:00:0x
1866 speed: 0 Mbps now, 0 Mbps max"
1869 # OFPT_PORT_STATUS, OFPPR_DELETE
1870 ovs-vsctl del-port br0 test
1871 if test X"$1" = X"OFPPR_DELETE"; then shift;
1872 echo >>expout "OFPT_PORT_STATUS (OF1.2): DEL: ${INDEX}(test): addr:aa:55:aa:55:00:0x
1875 speed: 0 Mbps now, 0 Mbps max"
1878 # OFPT_FLOW_REMOVED, OFPRR_DELETE
1879 ovs-ofctl -O OpenFlow12 add-flow br0 send_flow_rem,actions=drop
1880 ovs-ofctl -O OpenFlow12 --strict del-flows br0 ''
1881 if test X"$1" = X"OFPRR_DELETE"; then shift;
1882 echo >>expout "OFPT_FLOW_REMOVED (OF1.2): reason=delete table_id=0"
1884 AT_FAIL_IF([test X"$1" != X])
1886 ovs-appctl -t ovs-ofctl ofctl/barrier
1887 echo >>expout "OFPT_BARRIER_REPLY (OF1.2):"
1891 s/ (xid=0x[0-9a-fA-F]*)//
1893 s/00:0.$/00:0x/' < monitor.log]],
1897 # It's a service connection so initially there should be no async messages.
1900 # Set miss_send_len to 128, turning on packet-ins for our service connection.
1901 ovs-appctl -t ovs-ofctl ofctl/send 0309000c0123456700000080
1902 check_async 2 OFPR_ACTION OFPPR_ADD OFPPR_DELETE OFPRR_DELETE
1904 # Set miss_send_len to 128 and enable invalid_ttl.
1905 ovs-appctl -t ovs-ofctl ofctl/send 0309000c0123456700040080
1906 check_async 3 OFPR_ACTION OFPR_INVALID_TTL OFPPR_ADD OFPPR_DELETE OFPRR_DELETE
1908 # Become slave (OF 1.2), which should disable everything except port status.
1909 ovs-appctl -t ovs-ofctl ofctl/send 031800180000000200000003000000000000000000000001
1910 check_async 4 OFPPR_ADD OFPPR_DELETE
1912 # Use NXT_SET_ASYNC_CONFIG to enable a patchwork of asynchronous messages.
1913 ovs-appctl -t ovs-ofctl ofctl/send 03040028000000020000232000000013000000020000000500000005000000020000000200000005
1914 check_async 5 OFPR_INVALID_TTL OFPPR_DELETE OFPRR_DELETE
1916 # Set controller ID 123.
1917 ovs-appctl -t ovs-ofctl ofctl/send 03040018000000030000232000000014000000000000007b
1918 check_async 6 OFPR_NO_MATCH OFPPR_DELETE OFPRR_DELETE
1920 # Restore controller ID 0.
1921 ovs-appctl -t ovs-ofctl ofctl/send 030400180000000300002320000000140000000000000000
1923 # Become master (OF 1.2).
1924 ovs-appctl -t ovs-ofctl ofctl/send 031800180000000400000002000000000000000000000002
1925 check_async 7 OFPR_ACTION OFPPR_ADD
1927 ovs-appctl -t ovs-ofctl exit
1931 AT_SETUP([ofproto - asynchronous message control (OpenFlow 1.3)])
1933 AT_CHECK([ovs-ofctl -O OpenFlow13 monitor br0 --detach --no-chdir --pidfile])
1935 printf '\n\n--- check_async %d ---\n\n\n' $1
1939 ovs-appctl -t ovs-ofctl ofctl/barrier
1940 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
1943 # OFPT_PACKET_IN, OFPR_ACTION (controller_id=0)
1944 ovs-ofctl -O OpenFlow13 -v packet-out br0 none controller '0001020304050010203040501234'
1945 if test X"$1" = X"OFPR_ACTION"; then shift;
1946 echo >>expout "OFPT_PACKET_IN (OF1.3): total_len=14 in_port=ANY (via action) data_len=14 (unbuffered)
1947 in_port=0,vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1234"
1950 # OFPT_PACKET_IN, OFPR_NO_MATCH (controller_id=123)
1951 ovs-ofctl -O OpenFlow13 -v packet-out br0 none 'controller(reason=no_match,id=123)' '0001020304050010203040501234'
1952 if test X"$1" = X"OFPR_NO_MATCH"; then shift;
1953 echo >>expout "OFPT_PACKET_IN (OF1.3): total_len=14 in_port=ANY (via no_match) data_len=14 (unbuffered)
1954 in_port=0,vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1234"
1957 # OFPT_PACKET_IN, OFPR_INVALID_TTL (controller_id=0)
1958 ovs-ofctl -O OpenFlow13 packet-out br0 none dec_ttl '002583dfb4000026b98cb0f908004500003fb7e200000011339bac11370dac100002d7730035002b8f6d86fb0100000100000000000006626c702d7873066e696369726103636f6d00000f00'
1959 if test X"$1" = X"OFPR_INVALID_TTL"; then shift;
1960 echo >>expout "OFPT_PACKET_IN (OF1.3): total_len=76 in_port=ANY (via invalid_ttl) data_len=76 (unbuffered)
1961 udp,in_port=0,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"
1964 # OFPT_PORT_STATUS, OFPPR_ADD
1965 ovs-vsctl add-port br0 test -- set Interface test type=dummy
1966 if test X"$1" = X"OFPPR_ADD"; then shift;
1967 echo >>expout "OFPT_PORT_STATUS (OF1.3): ADD: ${INDEX}(test): addr:aa:55:aa:55:00:0x
1970 speed: 0 Mbps now, 0 Mbps max"
1973 # OFPT_PORT_STATUS, OFPPR_DELETE
1974 ovs-vsctl del-port br0 test
1975 if test X"$1" = X"OFPPR_DELETE"; then shift;
1976 echo >>expout "OFPT_PORT_STATUS (OF1.3): DEL: ${INDEX}(test): addr:aa:55:aa:55:00:0x
1979 speed: 0 Mbps now, 0 Mbps max"
1982 # OFPT_FLOW_REMOVED, OFPRR_DELETE
1983 ovs-ofctl -O OpenFlow13 add-flow br0 send_flow_rem,actions=drop
1984 ovs-ofctl -O OpenFlow13 --strict del-flows br0 ''
1985 if test X"$1" = X"OFPRR_DELETE"; then shift;
1986 echo >>expout "OFPT_FLOW_REMOVED (OF1.3): reason=delete table_id=0"
1989 # OFPT_FLOW_REMOVED, OFPRR_GROUP_DELETE
1990 ovs-ofctl -O OpenFlow13 add-group br0 group_id=1234,type=all,bucket=output:10
1991 ovs-ofctl -O OpenFlow13 add-flow br0 send_flow_rem,actions=group:1234
1992 ovs-ofctl -O OpenFlow13 --strict del-groups br0 group_id=1234
1993 if test X"$1" = X"OFPRR_DELETE"; then shift;
1994 echo >>expout "OFPT_FLOW_REMOVED (OF1.3): reason=gropu_delete table_id=0"
1997 AT_FAIL_IF([test X"$1" != X])
1999 ovs-appctl -t ovs-ofctl ofctl/barrier
2000 echo >>expout "OFPT_BARRIER_REPLY (OF1.3):"
2004 s/ (xid=0x[0-9a-fA-F]*)//
2006 s/00:0.$/00:0x/' < monitor.log]],
2010 # It's a service connection so initially there should be no async messages.
2013 # Set miss_send_len to 128, turning on packet-ins for our service connection.
2014 ovs-appctl -t ovs-ofctl ofctl/send 0409000c0123456700000080
2015 check_async 2 OFPR_ACTION OFPPR_ADD OFPPR_DELETE OFPRR_DELETE
2017 # Become slave (OF 1.3), which should disable everything except port status.
2018 ovs-appctl -t ovs-ofctl ofctl/send 041800180000000200000003000000000000000000000001
2019 check_async 3 OFPPR_ADD OFPPR_DELETE
2021 # Use OF 1.3 OFPT_SET_ASYNC to enable a patchwork of asynchronous messages.
2022 ovs-appctl -t ovs-ofctl ofctl/send 041c002000000002000000020000000500000005000000020000000200000005
2023 check_async 4 OFPR_INVALID_TTL OFPPR_DELETE OFPRR_DELETE
2025 # Set controller ID 123.
2026 ovs-appctl -t ovs-ofctl ofctl/send 04040018000000030000232000000014000000000000007b
2027 check_async 5 OFPR_NO_MATCH OFPPR_DELETE OFPRR_DELETE
2029 # Restore controller ID 0.
2030 ovs-appctl -t ovs-ofctl ofctl/send 040400180000000300002320000000140000000000000000
2032 # Become master (OF 1.3).
2033 ovs-appctl -t ovs-ofctl ofctl/send 041800180000000400000002000000000000000000000002
2034 check_async 6 OFPR_ACTION OFPPR_ADD
2036 ovs-appctl -t ovs-ofctl exit
2040 AT_SETUP([ofproto - asynchronous message control (OpenFlow 1.5)])
2042 AT_CHECK([ovs-ofctl -O OpenFlow15 monitor br0 --detach --no-chdir --pidfile])
2044 printf '\n\n--- check_async %d ---\n\n\n' $1
2048 ovs-appctl -t ovs-ofctl ofctl/barrier
2049 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
2052 # Other tests are not working with OF 1.5, and message
2053 # format may change, so leave them out.
2055 # OFPT_PORT_STATUS, OFPPR_ADD
2056 ovs-vsctl add-port br0 test -- set Interface test type=dummy
2057 if test X"$1" = X"OFPPR_ADD"; then shift;
2058 echo >>expout "OFPT_PORT_STATUS (OF1.5): ADD: ${INDEX}(test): addr:aa:55:aa:55:00:0x
2061 speed: 0 Mbps now, 0 Mbps max"
2064 # OFPT_PORT_STATUS, OFPPR_MODIFY
2065 ovs-ofctl -O OpenFlow15 -vwarn mod-port br0 test up
2066 if test X"$1" = X"OFPPR_MODIFY"; then shift;
2067 echo >>expout "OFPT_PORT_STATUS (OF1.5): MOD: ${INDEX}(test): addr:aa:55:aa:55:00:0x
2070 speed: 0 Mbps now, 0 Mbps max
2071 OFPT_PORT_STATUS (OF1.5): MOD: 2(test): addr:aa:55:aa:55:00:0x
2074 speed: 0 Mbps now, 0 Mbps max"
2077 # OFPT_PORT_STATUS, OFPPR_DELETE
2078 ovs-vsctl del-port br0 test
2079 if test X"$1" = X"OFPPR_DELETE"; then shift;
2080 echo >>expout "OFPT_PORT_STATUS (OF1.5): DEL: ${INDEX}(test): addr:aa:55:aa:55:00:0x
2083 speed: 0 Mbps now, 0 Mbps max"
2086 AT_FAIL_IF([test X"$1" != X])
2088 ovs-appctl -t ovs-ofctl ofctl/barrier
2089 echo >>expout "OFPT_BARRIER_REPLY (OF1.5):"
2093 s/ (xid=0x[0-9a-fA-F]*)//
2095 s/00:0.$/00:0x/' < monitor.log]],
2099 # It's a service connection so initially there should be no async messages.
2102 # If we don't set this, async messages are not received.
2103 # Set miss_send_len to 128, turning on packet-ins for our service connection.
2104 ovs-appctl -t ovs-ofctl ofctl/send 0609000c0123456700000080
2105 check_async 2 OFPPR_ADD OFPPR_MODIFY OFPPR_DELETE
2107 # Set-async has changed in OF 1.4 and is not yet implemented.
2109 ovs-appctl -t ovs-ofctl exit
2113 dnl This test checks that the role request/response messaging works
2114 dnl and that generation_id is handled properly.
2115 AT_SETUP([ofproto - controller role (OpenFlow 1.2)])
2117 ON_EXIT([kill `cat c1.pid c2.pid`])
2119 # Start two ovs-ofctl controller processes.
2120 AT_CAPTURE_FILE([monitor1.log])
2121 AT_CAPTURE_FILE([expout1])
2122 AT_CAPTURE_FILE([experr1])
2123 AT_CAPTURE_FILE([monitor2.log])
2124 AT_CAPTURE_FILE([expout2])
2125 AT_CAPTURE_FILE([experr2])
2127 AT_CHECK([ovs-ofctl -O OpenFlow12 monitor br0 --detach --no-chdir --pidfile=`pwd`/c$i.pid --unixctl=`pwd`/c$i])
2128 ovs-appctl -t `pwd`/c$i ofctl/barrier
2129 ovs-appctl -t `pwd`/c$i ofctl/set-output-file monitor$i.log
2133 # find out current role
2134 ovs-appctl -t `pwd`/c$i ofctl/send 031800180000000200000000000000000000000000000000
2135 echo >>experr$i "send: OFPT_ROLE_REQUEST (OF1.2): role=nochange"
2136 echo >>expout$i "OFPT_ROLE_REPLY (OF1.2): role=equal"
2139 # controller 1: Become slave (generation_id is initially undefined, so
2140 # 2^63+2 should not be stale)
2141 ovs-appctl -t `pwd`/c1 ofctl/send 031800180000000300000003000000008000000000000002
2142 echo >>experr1 "send: OFPT_ROLE_REQUEST (OF1.2): role=slave generation_id=9223372036854775810"
2143 echo >>expout1 "OFPT_ROLE_REPLY (OF1.2): role=slave generation_id=9223372036854775810"
2145 # controller 2: Become master.
2146 ovs-appctl -t `pwd`/c2 ofctl/send 031800180000000300000002000000008000000000000003
2147 echo >>experr2 "send: OFPT_ROLE_REQUEST (OF1.2): role=master generation_id=9223372036854775811"
2148 echo >>expout2 "OFPT_ROLE_REPLY (OF1.2): role=master generation_id=9223372036854775811"
2150 # controller 1: Try to become the master using a stale generation ID
2151 ovs-appctl -t `pwd`/c1 ofctl/send 031800180000000400000002000000000000000000000003
2152 echo >>experr1 "send: OFPT_ROLE_REQUEST (OF1.2): role=master generation_id=3"
2153 echo >>expout1 "OFPT_ERROR (OF1.2): OFPRRFC_STALE"
2154 echo >>expout1 "OFPT_ROLE_REQUEST (OF1.2): role=master generation_id=3"
2156 # controller 1: Become master using a valid generation ID
2157 ovs-appctl -t `pwd`/c1 ofctl/send 031800180000000500000002000000000000000000000001
2158 echo >>experr1 "send: OFPT_ROLE_REQUEST (OF1.2): role=master generation_id=1"
2159 echo >>expout1 "OFPT_ROLE_REPLY (OF1.2): role=master generation_id=1"
2162 ovs-appctl -t `pwd`/c$i ofctl/barrier
2163 echo >>expout$i "OFPT_BARRIER_REPLY (OF1.2):"
2169 AT_CHECK([grep -v '^send:' monitor$i.log | STRIP_XIDS], [0], [expout])
2171 AT_CHECK([grep '^send:' monitor$i.log | STRIP_XIDS], [0], [expout])
2176 dnl This test checks that the role request/response messaging works,
2177 dnl that generation_id is handled properly, and that role status update
2178 dnl messages are sent when a controller's role gets changed from master
2180 AT_SETUP([ofproto - controller role (OpenFlow 1.4)])
2182 ON_EXIT([kill `cat c1.pid c2.pid`])
2184 # Start two ovs-ofctl controller processes.
2185 AT_CAPTURE_FILE([monitor1.log])
2186 AT_CAPTURE_FILE([expout1])
2187 AT_CAPTURE_FILE([experr1])
2188 AT_CAPTURE_FILE([monitor2.log])
2189 AT_CAPTURE_FILE([expout2])
2190 AT_CAPTURE_FILE([experr2])
2192 AT_CHECK([ovs-ofctl -O OpenFlow14 monitor br0 --detach --no-chdir --pidfile=`pwd`/c$i.pid --unixctl=`pwd`/c$i])
2193 ovs-appctl -t `pwd`/c$i ofctl/barrier
2194 ovs-appctl -t `pwd`/c$i ofctl/set-output-file monitor$i.log
2198 # find out current role
2199 ovs-appctl -t `pwd`/c$i ofctl/send 051800180000000200000000000000000000000000000000
2200 echo >>experr$i "send: OFPT_ROLE_REQUEST (OF1.4): role=nochange"
2201 echo >>expout$i "OFPT_ROLE_REPLY (OF1.4): role=equal"
2204 # controller 1: Become slave (generation_id is initially undefined, so
2205 # 2^63+2 should not be stale)
2206 ovs-appctl -t `pwd`/c1 ofctl/send 051800180000000300000003000000008000000000000002
2207 echo >>experr1 "send: OFPT_ROLE_REQUEST (OF1.4): role=slave generation_id=9223372036854775810"
2208 echo >>expout1 "OFPT_ROLE_REPLY (OF1.4): role=slave generation_id=9223372036854775810"
2210 # controller 2: Become master.
2211 ovs-appctl -t `pwd`/c2 ofctl/send 051800180000000300000002000000008000000000000003
2212 echo >>experr2 "send: OFPT_ROLE_REQUEST (OF1.4): role=master generation_id=9223372036854775811"
2213 echo >>expout2 "OFPT_ROLE_REPLY (OF1.4): role=master generation_id=9223372036854775811"
2215 # controller 1: Try to become the master using a stale generation ID
2216 ovs-appctl -t `pwd`/c1 ofctl/send 051800180000000400000002000000000000000000000003
2217 echo >>experr1 "send: OFPT_ROLE_REQUEST (OF1.4): role=master generation_id=3"
2218 echo >>expout1 "OFPT_ERROR (OF1.4): OFPRRFC_STALE"
2219 echo >>expout1 "OFPT_ROLE_REQUEST (OF1.4): role=master generation_id=3"
2221 # controller 1: Become master using a valid generation ID
2222 ovs-appctl -t `pwd`/c1 ofctl/send 051800180000000500000002000000000000000000000001
2223 echo >>experr1 "send: OFPT_ROLE_REQUEST (OF1.4): role=master generation_id=1"
2224 echo >>expout1 "OFPT_ROLE_REPLY (OF1.4): role=master generation_id=1"
2225 echo >>expout2 "OFPT_ROLE_STATUS (OF1.4): role=slave generation_id=1 reason=master_request"
2228 ovs-appctl -t `pwd`/c$i ofctl/barrier
2229 echo >>expout$i "OFPT_BARRIER_REPLY (OF1.4):"
2235 AT_CHECK([grep -v '^send:' monitor$i.log | STRIP_XIDS], [0], [expout])
2237 AT_CHECK([grep '^send:' monitor$i.log | STRIP_XIDS], [0], [expout])
2242 dnl This test checks that OFPT_PACKET_OUT accepts both OFPP_NONE (as
2243 dnl specified by OpenFlow 1.0) and OFPP_CONTROLLER (used by some
2244 dnl controllers despite the spec) as meaning a packet that was generated
2245 dnl by the controller.
2246 AT_SETUP([ofproto - packet-out from controller (OpenFlow 1.0)])
2248 ADD_OF_PORTS([br0], [1])
2250 # Start a monitor listening for packet-ins.
2251 AT_CHECK([ovs-ofctl -P openflow10 monitor br0 --detach --no-chdir --pidfile])
2252 ovs-appctl -t ovs-ofctl ofctl/send 0109000c0123456700000080
2253 ovs-appctl -t ovs-ofctl ofctl/barrier
2254 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
2255 AT_CAPTURE_FILE([monitor.log])
2257 # Send some packet-outs with OFPP_NONE and OFPP_CONTROLLER (65533) as in_port.
2258 AT_CHECK([ovs-ofctl packet-out br0 none controller,1 '0001020304050010203040501234'])
2259 AT_CHECK([ovs-ofctl packet-out br0 controller controller,1 '0001020304050010203040505678'])
2261 # Stop the monitor and check its output.
2262 ovs-appctl -t ovs-ofctl ofctl/barrier
2263 ovs-appctl -t ovs-ofctl exit
2265 ovs-ofctl dump-ports br0
2267 AT_CHECK([sed 's/ (xid=0x[[0-9a-fA-F]]*)//' monitor.log], [0], [dnl
2268 OFPT_PACKET_IN: total_len=14 in_port=ANY (via action) data_len=14 (unbuffered)
2269 in_port=0,vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1234
2270 OFPT_PACKET_IN: total_len=14 in_port=CONTROLLER (via action) data_len=14 (unbuffered)
2271 in_port=0,vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x5678
2278 dnl This test checks that OFPT_PACKET_OUT accepts both OFPP_NONE (as
2279 dnl specified by OpenFlow 1.2) and OFPP_CONTROLLER (used by some
2280 dnl controllers despite the spec) as meaning a packet that was generated
2281 dnl by the controller.
2282 AT_SETUP([ofproto - packet-out from controller (OpenFlow 1.2)])
2285 # Start a monitor listening for packet-ins.
2286 AT_CHECK([ovs-ofctl -O OpenFlow12 monitor br0 --detach --no-chdir --pidfile])
2287 ovs-appctl -t ovs-ofctl ofctl/send 0309000c0123456700000080
2288 ovs-appctl -t ovs-ofctl ofctl/barrier
2289 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
2290 AT_CAPTURE_FILE([monitor.log])
2292 # Send some packet-outs with OFPP_NONE and OFPP_CONTROLLER (65533) as in_port.
2293 AT_CHECK([ovs-ofctl -O OpenFlow12 packet-out br0 none controller '0001020304050010203040501234'])
2294 AT_CHECK([ovs-ofctl -O OpenFlow12 packet-out br0 4294967293 controller '0001020304050010203040505678'])
2296 # Stop the monitor and check its output.
2297 ovs-appctl -t ovs-ofctl ofctl/barrier
2298 ovs-appctl -t ovs-ofctl exit
2300 AT_CHECK([sed 's/ (xid=0x[[0-9a-fA-F]]*)//' monitor.log], [0], [dnl
2301 OFPT_PACKET_IN (OF1.2): total_len=14 in_port=ANY (via action) data_len=14 (unbuffered)
2302 in_port=0,vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1234
2303 OFPT_PACKET_IN (OF1.2): total_len=14 in_port=CONTROLLER (via action) data_len=14 (unbuffered)
2304 in_port=0,vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x5678
2305 OFPT_BARRIER_REPLY (OF1.2):
2311 dnl This test checks that OFPT_PACKET_OUT accepts both OFPP_NONE (as
2312 dnl specified by OpenFlow 1.1) and OFPP_CONTROLLER (used by some
2313 dnl controllers despite the spec) as meaning a packet that was generated
2314 dnl by the controller.
2315 AT_SETUP([ofproto - packet-out from controller (OpenFlow 1.1)])
2318 # Start a monitor listening for packet-ins.
2319 AT_CHECK([ovs-ofctl -O OpenFlow11 monitor br0 --detach --no-chdir --pidfile])
2320 ovs-appctl -t ovs-ofctl ofctl/send 0209000c0123456700000080
2321 ovs-appctl -t ovs-ofctl ofctl/barrier
2322 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
2323 AT_CAPTURE_FILE([monitor.log])
2325 # Send some packet-outs with OFPP_NONE and OFPP_CONTROLLER (65533) as in_port.
2326 AT_CHECK([ovs-ofctl -O OpenFlow11 packet-out br0 none controller '0001020304050010203040501234'])
2327 AT_CHECK([ovs-ofctl -O OpenFlow11 packet-out br0 4294967293 controller '0001020304050010203040505678'])
2329 # Stop the monitor and check its output.
2330 ovs-appctl -t ovs-ofctl ofctl/barrier
2331 ovs-appctl -t ovs-ofctl exit
2333 AT_CHECK([sed 's/ (xid=0x[[0-9a-fA-F]]*)//' monitor.log], [0], [dnl
2334 OFPT_PACKET_IN (OF1.1): total_len=14 in_port=ANY (via action) data_len=14 (unbuffered)
2335 in_port=0,vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1234
2336 OFPT_PACKET_IN (OF1.1): total_len=14 in_port=CONTROLLER (via action) data_len=14 (unbuffered)
2337 in_port=0,vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x5678
2338 OFPT_BARRIER_REPLY (OF1.1):
2344 dnl This test checks that metadata is encoded in packet_in structures,
2345 dnl supported by NXAST.
2346 AT_SETUP([ofproto - packet-out with metadata (NXM)])
2349 # Start a monitor listening for packet-ins.
2350 AT_CHECK([ovs-ofctl -P nxm monitor br0 --detach --no-chdir --pidfile])
2351 ovs-appctl -t ovs-ofctl ofctl/send 0109000c0123456700000080
2352 ovs-appctl -t ovs-ofctl ofctl/barrier
2353 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
2354 AT_CAPTURE_FILE([monitor.log])
2356 # Send a packet-out with a load action to set some metadata, and forward to controller
2357 AT_CHECK([ovs-ofctl packet-out br0 controller 'load(0xfafafafa5a5a5a5a->OXM_OF_METADATA[[0..63]]), load(0xaa->NXM_NX_PKT_MARK[[]]), controller' '0001020304050010203040501234'])
2359 # Stop the monitor and check its output.
2360 ovs-appctl -t ovs-ofctl ofctl/barrier
2361 ovs-appctl -t ovs-ofctl exit
2363 AT_CHECK([sed 's/ (xid=0x[[0-9a-fA-F]]*)//' monitor.log], [0], [dnl
2364 NXT_PACKET_IN: total_len=14 in_port=CONTROLLER metadata=0xfafafafa5a5a5a5a pkt_mark=0xaa (via action) data_len=14 (unbuffered)
2365 in_port=0,vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1234
2372 dnl This test checks that metadata is encoded in packet_in structures,
2373 dnl supported by NXAST.
2374 AT_SETUP([ofproto - packet-out with metadata (OpenFlow 1.2)])
2377 # Start a monitor listening for packet-ins.
2378 AT_CHECK([ovs-ofctl -O OpenFlow12 monitor br0 --detach --no-chdir --pidfile])
2379 ovs-appctl -t ovs-ofctl ofctl/send 0309000c0123456700000080
2380 ovs-appctl -t ovs-ofctl ofctl/barrier
2381 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
2382 AT_CAPTURE_FILE([monitor.log])
2384 # Send a packet-out with a set-field action to set some metadata, and forward to controller
2385 AT_CHECK([ovs-ofctl -O OpenFlow12 packet-out br0 none 'set_field:0xfafafafa5a5a5a5a->metadata, controller' '0001020304050010203040501234'])
2387 # Stop the monitor and check its output.
2388 ovs-appctl -t ovs-ofctl ofctl/barrier
2389 ovs-appctl -t ovs-ofctl exit
2391 AT_CHECK([sed 's/ (xid=0x[[0-9a-fA-F]]*)//' monitor.log], [0], [dnl
2392 OFPT_PACKET_IN (OF1.2): total_len=14 in_port=ANY metadata=0xfafafafa5a5a5a5a (via action) data_len=14 (unbuffered)
2393 in_port=0,vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1234
2394 OFPT_BARRIER_REPLY (OF1.2):
2400 dnl This test checks that metadata is encoded in packet_in structures,
2401 dnl supported by NXAST.
2402 AT_SETUP([ofproto - packet-out with metadata and dual set_field (OpenFlow 1.3)])
2405 # Start a monitor listening for packet-ins.
2406 AT_CHECK([ovs-ofctl -O OpenFlow13 monitor br0 --detach --no-chdir --pidfile])
2407 ovs-appctl -t ovs-ofctl ofctl/send 0409000c0123456700000080
2408 ovs-appctl -t ovs-ofctl ofctl/barrier
2409 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
2410 AT_CAPTURE_FILE([monitor.log])
2412 # Send a packet-out with a couple of set-field action to set some metadata, and forward to controller
2413 AT_CHECK([ovs-ofctl -O OpenFlow13 packet-out br0 none 'set_field:0xfafafafa5a5a5a5a->metadata, set_field:0x6b->metadata, controller' '0001020304050010203040501234'])
2415 # Stop the monitor and check its output.
2416 ovs-appctl -t ovs-ofctl ofctl/barrier
2417 ovs-appctl -t ovs-ofctl exit
2419 AT_CHECK([sed 's/ (xid=0x[[0-9a-fA-F]]*)//' monitor.log], [0], [dnl
2420 OFPT_PACKET_IN (OF1.3): total_len=14 in_port=ANY metadata=0x6b (via action) data_len=14 (unbuffered)
2421 in_port=0,vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1234
2422 OFPT_BARRIER_REPLY (OF1.3):
2428 dnl This test checks that tunnel metadata is encoded in packet_in structures.
2429 AT_SETUP([ofproto - packet-out with tunnel metadata (OpenFlow 1.2)])
2432 # Start a monitor listening for packet-ins.
2433 AT_CHECK([ovs-ofctl -O OpenFlow12 monitor br0 --detach --no-chdir --pidfile])
2434 ovs-appctl -t ovs-ofctl ofctl/send 0309000c0123456700000080
2435 ovs-appctl -t ovs-ofctl ofctl/barrier
2436 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
2437 AT_CAPTURE_FILE([monitor.log])
2439 # Send a packet-out with set field actions to set some tunnel metadata, and forward to controller
2440 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'])
2442 # Stop the monitor and check its output.
2443 ovs-appctl -t ovs-ofctl ofctl/barrier
2444 ovs-appctl -t ovs-ofctl exit
2446 AT_CHECK([sed 's/ (xid=0x[[0-9a-fA-F]]*)//' monitor.log], [0], [dnl
2447 OFPT_PACKET_IN (OF1.2): total_len=14 in_port=ANY tun_id=0x1020304 tun_src=127.0.0.1 tun_dst=192.168.0.1 (via action) data_len=14 (unbuffered)
2448 in_port=0,vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1234
2449 OFPT_BARRIER_REPLY (OF1.2):
2455 m4_divert_push([PREPARE_TESTS])
2456 # Sorts groups of lines that start with a space, without moving them
2457 # past the nearest line that does not start with a space.
2467 print $_ foreach sort(@buffer);
2472 print $_ foreach sort(@buffer);
2475 m4_divert_pop([PREPARE_TESTS])
2477 AT_SETUP([ofproto - flow monitoring])
2478 AT_KEYWORDS([monitor])
2481 ovs-ofctl add-flow br0 in_port=0,dl_vlan=123,actions=output:1
2483 # Start a monitor watching the flow table and check the initial reply.
2484 ovs-ofctl monitor br0 watch: --detach --no-chdir --pidfile >monitor.log 2>&1
2485 AT_CAPTURE_FILE([monitor.log])
2486 ovs-appctl -t ovs-ofctl ofctl/barrier
2487 AT_CHECK([sed 's/ (xid=0x[[1-9a-fA-F]][[0-9a-fA-F]]*)//' monitor.log], [0],
2488 [NXST_FLOW_MONITOR reply:
2489 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=123 actions=output:1
2493 # Add, delete, and modify some flows and check the updates.
2494 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
2495 ovs-ofctl add-flow br0 in_port=0,dl_vlan=124,actions=output:2
2496 ovs-ofctl add-flow br0 in_port=0,dl_vlan=123,actions=output:5
2497 ovs-ofctl add-flow br0 in_port=0,dl_vlan=123,dl_vlan_pcp=0,actions=output:6
2498 ovs-ofctl add-flow br0 in_port=0,dl_vlan=123,dl_vlan_pcp=1,actions=output:7
2499 ovs-ofctl add-flow br0 in_port=0,dl_vlan=123,actions=output:8
2500 ovs-ofctl add-flow br0 in_port=0,dl_vlan=65535,dl_vlan_pcp=0,actions=output:9
2501 ovs-ofctl add-flow br0 in_port=0,dl_vlan=65535,dl_vlan_pcp=1,actions=output:10
2502 ovs-ofctl add-flow br0 in_port=0,dl_vlan=65535,actions=output:11
2503 ovs-ofctl add-flow br0 in_port=0,dl_vlan=8191,dl_vlan_pcp=0,actions=output:12
2504 ovs-ofctl add-flow br0 in_port=0,dl_vlan=8191,dl_vlan_pcp=1,actions=output:13
2505 ovs-ofctl add-flow br0 in_port=0,dl_vlan=8191,actions=output:14
2506 ovs-ofctl add-flow br0 in_port=0,dl_vlan=0,dl_vlan_pcp=0,actions=output:15
2507 ovs-ofctl add-flow br0 in_port=0,dl_vlan=0,dl_vlan_pcp=1,actions=output:16
2508 ovs-ofctl add-flow br0 in_port=0,dl_vlan=0,actions=output:17
2509 ovs-ofctl add-flow br0 in_port=0,dl_vlan=0,dl_vlan_pcp=0,actions=output:18
2510 ovs-ofctl add-flow br0 in_port=0,dl_vlan=0,dl_vlan_pcp=1,actions=output:19
2511 ovs-ofctl add-flow br0 in_port=0,dl_vlan=0,actions=output:20
2512 ovs-ofctl add-flow br0 in_port=0,dl_vlan_pcp=0,actions=output:21
2513 ovs-ofctl add-flow br0 in_port=0,dl_vlan_pcp=1,actions=output:22
2514 ovs-ofctl add-flow br0 in_port=0,actions=output:23
2515 ovs-ofctl mod-flows br0 dl_vlan=123,actions=output:3
2516 ovs-ofctl mod-flows br0 cookie=5,dl_vlan=123,actions=output:3
2517 ovs-ofctl del-flows br0 dl_vlan=123
2518 ovs-ofctl del-flows br0
2519 ovs-appctl -t ovs-ofctl ofctl/barrier
2520 AT_CHECK([sed 's/ (xid=0x[[1-9a-fA-F]][[0-9a-fA-F]]*)//' monitor.log | multiline_sort], [0],
2521 [NXST_FLOW_MONITOR reply (xid=0x0):
2522 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=124 actions=output:2
2523 NXST_FLOW_MONITOR reply (xid=0x0):
2524 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=123 actions=output:5
2525 NXST_FLOW_MONITOR reply (xid=0x0):
2526 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=123,dl_vlan_pcp=0 actions=output:6
2527 NXST_FLOW_MONITOR reply (xid=0x0):
2528 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=123,dl_vlan_pcp=1 actions=output:7
2529 NXST_FLOW_MONITOR reply (xid=0x0):
2530 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=123 actions=output:8
2531 NXST_FLOW_MONITOR reply (xid=0x0):
2532 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=0,dl_vlan_pcp=0 actions=output:9
2533 NXST_FLOW_MONITOR reply (xid=0x0):
2534 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=0,dl_vlan_pcp=1 actions=output:10
2535 NXST_FLOW_MONITOR reply (xid=0x0):
2536 event=ADDED table=0 cookie=0 in_port=0,vlan_tci=0x0000 actions=output:11
2537 NXST_FLOW_MONITOR reply (xid=0x0):
2538 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=4095,dl_vlan_pcp=0 actions=output:12
2539 NXST_FLOW_MONITOR reply (xid=0x0):
2540 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=4095,dl_vlan_pcp=1 actions=output:13
2541 NXST_FLOW_MONITOR reply (xid=0x0):
2542 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=4095 actions=output:14
2543 NXST_FLOW_MONITOR reply (xid=0x0):
2544 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=0,dl_vlan_pcp=0 actions=output:15
2545 NXST_FLOW_MONITOR reply (xid=0x0):
2546 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=0,dl_vlan_pcp=1 actions=output:16
2547 NXST_FLOW_MONITOR reply (xid=0x0):
2548 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=0 actions=output:17
2549 NXST_FLOW_MONITOR reply (xid=0x0):
2550 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=0,dl_vlan_pcp=0 actions=output:18
2551 NXST_FLOW_MONITOR reply (xid=0x0):
2552 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=0,dl_vlan_pcp=1 actions=output:19
2553 NXST_FLOW_MONITOR reply (xid=0x0):
2554 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=0 actions=output:20
2555 NXST_FLOW_MONITOR reply (xid=0x0):
2556 event=ADDED table=0 cookie=0 in_port=0,dl_vlan_pcp=0 actions=output:21
2557 NXST_FLOW_MONITOR reply (xid=0x0):
2558 event=ADDED table=0 cookie=0 in_port=0,dl_vlan_pcp=1 actions=output:22
2559 NXST_FLOW_MONITOR reply (xid=0x0):
2560 event=ADDED table=0 cookie=0 in_port=0 actions=output:23
2561 NXST_FLOW_MONITOR reply (xid=0x0):
2562 event=MODIFIED table=0 cookie=0 in_port=0,dl_vlan=123 actions=output:3
2563 event=MODIFIED table=0 cookie=0 in_port=0,dl_vlan=123,dl_vlan_pcp=0 actions=output:3
2564 event=MODIFIED table=0 cookie=0 in_port=0,dl_vlan=123,dl_vlan_pcp=1 actions=output:3
2565 NXST_FLOW_MONITOR reply (xid=0x0):
2566 event=MODIFIED table=0 cookie=0x5 in_port=0,dl_vlan=123 actions=output:3
2567 event=MODIFIED table=0 cookie=0x5 in_port=0,dl_vlan=123,dl_vlan_pcp=0 actions=output:3
2568 event=MODIFIED table=0 cookie=0x5 in_port=0,dl_vlan=123,dl_vlan_pcp=1 actions=output:3
2569 NXST_FLOW_MONITOR reply (xid=0x0):
2570 event=DELETED reason=delete table=0 cookie=0x5 in_port=0,dl_vlan=123 actions=output:3
2571 event=DELETED reason=delete table=0 cookie=0x5 in_port=0,dl_vlan=123,dl_vlan_pcp=0 actions=output:3
2572 event=DELETED reason=delete table=0 cookie=0x5 in_port=0,dl_vlan=123,dl_vlan_pcp=1 actions=output:3
2573 NXST_FLOW_MONITOR reply (xid=0x0):
2574 event=DELETED reason=delete table=0 cookie=0 in_port=0 actions=output:23
2575 event=DELETED reason=delete table=0 cookie=0 in_port=0,dl_vlan=0 actions=output:20
2576 event=DELETED reason=delete table=0 cookie=0 in_port=0,dl_vlan=0,dl_vlan_pcp=0 actions=output:18
2577 event=DELETED reason=delete table=0 cookie=0 in_port=0,dl_vlan=0,dl_vlan_pcp=1 actions=output:19
2578 event=DELETED reason=delete table=0 cookie=0 in_port=0,dl_vlan=124 actions=output:2
2579 event=DELETED reason=delete table=0 cookie=0 in_port=0,dl_vlan=4095 actions=output:14
2580 event=DELETED reason=delete table=0 cookie=0 in_port=0,dl_vlan=4095,dl_vlan_pcp=0 actions=output:12
2581 event=DELETED reason=delete table=0 cookie=0 in_port=0,dl_vlan=4095,dl_vlan_pcp=1 actions=output:13
2582 event=DELETED reason=delete table=0 cookie=0 in_port=0,dl_vlan_pcp=0 actions=output:21
2583 event=DELETED reason=delete table=0 cookie=0 in_port=0,dl_vlan_pcp=1 actions=output:22
2584 event=DELETED reason=delete table=0 cookie=0 in_port=0,vlan_tci=0x0000 actions=output:11
2588 # Check that our own changes are reported as full updates.
2589 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
2590 ovs-ofctl add-flow br0 in_port=1,actions=output:2
2591 ovs-ofctl add-flow br0 in_port=2,actions=output:1
2592 ovs-appctl -t ovs-ofctl ofctl/barrier
2593 ovs-appctl -t ovs-ofctl ofctl/send 010e004812345678003fffff00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003000000000000ffffffffffff0000
2594 ovs-appctl -t ovs-ofctl ofctl/barrier
2595 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip], [0], [NXST_FLOW reply:
2597 AT_CHECK([sed 's/ (xid=0x[[1-9a-fA-F]][[0-9a-fA-F]]*)//' monitor.log | multiline_sort], [0],
2598 [NXST_FLOW_MONITOR reply (xid=0x0):
2599 event=ADDED table=0 cookie=0 in_port=1 actions=output:2
2600 NXST_FLOW_MONITOR reply (xid=0x0):
2601 event=ADDED table=0 cookie=0 in_port=2 actions=output:1
2603 send: OFPT_FLOW_MOD: DEL priority=0 actions=drop
2604 NXST_FLOW_MONITOR reply (xid=0x0):
2605 event=DELETED reason=delete table=0 cookie=0 in_port=1 actions=output:2
2606 event=DELETED reason=delete table=0 cookie=0 in_port=2 actions=output:1
2610 ovs-appctl -t ovs-ofctl exit
2614 AT_SETUP([ofproto - flow monitoring with !own])
2615 AT_KEYWORDS([monitor])
2618 ovs-ofctl add-flow br0 in_port=0,dl_vlan=123,actions=output:1
2620 # Start a monitor watching the flow table and check the initial reply.
2621 ovs-ofctl monitor br0 watch:\!own --detach --no-chdir --pidfile >monitor.log 2>&1
2622 AT_CAPTURE_FILE([monitor.log])
2623 ovs-appctl -t ovs-ofctl ofctl/barrier
2624 AT_CHECK([sed 's/ (xid=0x[[1-9a-fA-F]][[0-9a-fA-F]]*)//' monitor.log], [0],
2625 [NXST_FLOW_MONITOR reply:
2626 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=123 actions=output:1
2630 # Check that our own changes are reported as abbreviations.
2631 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
2632 ovs-ofctl add-flow br0 in_port=1,actions=output:2
2633 ovs-ofctl add-flow br0 in_port=2,actions=output:1
2634 ovs-appctl -t ovs-ofctl ofctl/barrier
2635 ovs-appctl -t ovs-ofctl ofctl/send 010e004812345678003fffff00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003000000000000ffffffffffff0000
2636 ovs-appctl -t ovs-ofctl ofctl/barrier
2637 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip], [0], [NXST_FLOW reply:
2639 AT_CHECK([sed 's/ (xid=0x[[1-9a-fA-F]][[0-9a-fA-F]]*)//' monitor.log], [0],
2640 [NXST_FLOW_MONITOR reply (xid=0x0):
2641 event=ADDED table=0 cookie=0 in_port=1 actions=output:2
2642 NXST_FLOW_MONITOR reply (xid=0x0):
2643 event=ADDED table=0 cookie=0 in_port=2 actions=output:1
2645 send: OFPT_FLOW_MOD: DEL priority=0 actions=drop
2646 NXST_FLOW_MONITOR reply (xid=0x0):
2647 event=ABBREV xid=0x12345678
2651 ovs-appctl -t ovs-ofctl exit
2655 AT_SETUP([ofproto - flow monitoring with out_port])
2656 AT_KEYWORDS([monitor])
2659 ovs-ofctl add-flow br0 in_port=0,dl_vlan=121,actions=output:1
2660 ovs-ofctl add-flow br0 in_port=0,dl_vlan=122,actions=output:1
2661 ovs-ofctl add-flow br0 in_port=0,dl_vlan=123,actions=output:2
2663 # Start a monitor watching the flow table and check the initial reply.
2664 ovs-ofctl monitor br0 watch:out_port=2 --detach --no-chdir --pidfile >monitor.log 2>&1
2665 AT_CAPTURE_FILE([monitor.log])
2666 ovs-appctl -t ovs-ofctl ofctl/barrier
2667 AT_CHECK([sed 's/ (xid=0x[[1-9a-fA-F]][[0-9a-fA-F]]*)//' monitor.log], [0],
2668 [NXST_FLOW_MONITOR reply:
2669 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=123 actions=output:2
2673 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
2675 # Add, modify flows and check the updates.
2676 ovs-ofctl mod-flows br0 dl_vlan=121,actions=drop
2677 ovs-ofctl mod-flows br0 dl_vlan=122,actions=output:1,output:2
2678 ovs-appctl -t ovs-ofctl ofctl/barrier
2680 ovs-ofctl mod-flows br0 dl_vlan=123,actions=output:1,output:2
2681 ovs-appctl -t ovs-ofctl ofctl/barrier
2683 ovs-ofctl mod-flows br0 dl_vlan=122,actions=output:1
2684 ovs-appctl -t ovs-ofctl ofctl/barrier
2685 ovs-ofctl mod-flows br0 dl_vlan=123,actions=output:2
2686 ovs-appctl -t ovs-ofctl ofctl/barrier
2688 AT_CHECK([sed 's/ (xid=0x[[1-9a-fA-F]][[0-9a-fA-F]]*)//' monitor.log], [0],
2689 [NXST_FLOW_MONITOR reply (xid=0x0):
2690 event=MODIFIED table=0 cookie=0 in_port=0,dl_vlan=122 actions=output:1,output:2
2692 NXST_FLOW_MONITOR reply (xid=0x0):
2693 event=MODIFIED table=0 cookie=0 in_port=0,dl_vlan=123 actions=output:1,output:2
2695 NXST_FLOW_MONITOR reply (xid=0x0):
2696 event=MODIFIED table=0 cookie=0 in_port=0,dl_vlan=122 actions=output:1
2698 NXST_FLOW_MONITOR reply (xid=0x0):
2699 event=MODIFIED table=0 cookie=0 in_port=0,dl_vlan=123 actions=output:2
2703 ovs-appctl -t ovs-ofctl exit
2707 AT_SETUP([ofproto - flow monitoring pause and resume])
2708 AT_KEYWORDS([monitor])
2710 # The maximum socket receive buffer size is important for this test, which
2711 # tests behavior when the receive buffer overflows.
2712 if test -e /proc/sys/net/core/rmem_max; then
2714 rmem_max=`cat /proc/sys/net/core/rmem_max`
2715 elif rmem_max=`sysctl -n net.inet.tcp.recvbuf_max 2>/dev/null`; then
2718 # Don't know how to get maximum socket receive buffer on this OS
2721 # Calculate the total amount of queuing: rmem_max in the kernel, 128 kB
2722 # in ofproto sending userspace (see ofmonitor_flush() in connmgr.c).
2723 queue_size=`expr $rmem_max + 128 \* 1024`
2724 echo rmem_max=$rmem_max queue_size=$queue_size
2726 # If there's too much queuing skip the test to avoid timing out.
2727 AT_SKIP_IF([test $rmem_max -gt 1048576])
2729 # Each flow update message takes up at least 48 bytes of space in queues
2730 # and in practice more than that.
2731 n_msgs=`expr $queue_size / 48`
2736 # Start a monitor watching the flow table, then make it block.
2737 ON_EXIT([kill `cat ovs-ofctl.pid`])
2738 ovs-ofctl monitor br0 watch: --detach --no-chdir --pidfile >monitor.log 2>&1
2739 AT_CAPTURE_FILE([monitor.log])
2740 ovs-appctl -t ovs-ofctl ofctl/block
2742 # Add $n_msgs flows.
2743 (echo "in_port=2,actions=output:2"
2745 for ($i = 0; $i < '$n_msgs'; $i++) {
2746 print "cookie=1,reg1=$i,actions=drop\n";
2749 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
2750 # Check that multipart flow dumps work properly:
2751 AT_CHECK([ovs-ofctl diff-flows br0 flows.txt])
2752 AT_CHECK([ovs-ofctl add-flow br0 in_port=1,cookie=3,actions=drop])
2753 AT_CHECK([ovs-ofctl mod-flows br0 in_port=2,cookie=2,actions=output:2])
2754 AT_CHECK([ovs-ofctl del-flows br0 cookie=1/-1])
2756 ovs-appctl -t ovs-ofctl ofctl/unblock
2758 # Wait for the connection resumed.
2759 # A barrier doesn't work for this purpose.
2760 # https://www.mail-archive.com/dev@openvswitch.org/msg27013.html
2761 # https://www.mail-archive.com/dev@openvswitch.org/msg27675.html
2762 OVS_WAIT_UNTIL([grep NXT_FLOW_MONITOR_RESUMED monitor.log])
2764 ovs-appctl -t ovs-ofctl exit
2766 # Check that the flow monitor reported the same number of flows
2767 # added and deleted, but fewer than we actually added and deleted.
2768 adds=`grep -c 'ADDED.*reg1=' monitor.log`
2769 deletes=`grep -c 'DELETED.*reg1=' monitor.log`
2770 echo adds=$adds deletes=$deletes
2771 AT_CHECK([test $adds -gt 100 && test $adds -lt $n_msgs])
2772 AT_CHECK([test $adds = $deletes])
2774 # Check that the flow monitor reported everything in the expected order:
2776 # event=ADDED table=0 cookie=0x1 reg1=0x22
2778 # NXT_FLOW_MONITOR_PAUSED:
2780 # event=DELETED reason=delete table=0 cookie=0x1 reg1=0x22
2782 # event=ADDED table=0 cookie=0x3 in_port=1
2783 # event=MODIFIED table=0 cookie=0x2 in_port=2 actions=output:2
2784 # NXT_FLOW_MONITOR_RESUMED:
2786 # except that, between the PAUSED and RESUMED, the order of the ADDED
2787 # and MODIFIED lines lines depends on hash order, that is, it varies
2788 # as we change the hash function or change architecture. Therefore,
2789 # we use a couple of tests below to accept both orders.
2790 AT_CHECK([ofctl_strip < monitor.log | sed -n -e '
2793 /NXT_FLOW_MONITOR_PAUSED:/p
2794 /NXT_FLOW_MONITOR_RESUMED:/p
2795 ' > monitor.log.subset])
2796 AT_CHECK([grep -v MODIFIED monitor.log.subset], [0], [dnl
2797 event=ADDED table=0 cookie=0x1 reg1=0x22
2798 NXT_FLOW_MONITOR_PAUSED:
2799 event=DELETED reason=delete table=0 cookie=0x1 reg1=0x22
2800 event=ADDED table=0 cookie=0x3 in_port=1
2801 NXT_FLOW_MONITOR_RESUMED:
2803 AT_CHECK([grep -v ADDED monitor.log.subset], [0], [dnl
2804 NXT_FLOW_MONITOR_PAUSED:
2805 event=DELETED reason=delete table=0 cookie=0x1 reg1=0x22
2806 event=MODIFIED table=0 cookie=0x2 in_port=2 actions=output:2
2807 NXT_FLOW_MONITOR_RESUMED:
2813 AT_SETUP([ofproto - event filtering (OpenFlow 1.3)])
2814 AT_KEYWORDS([monitor])
2817 # Start a monitor, use the required protocol version
2818 ovs-ofctl -O OpenFlow13 monitor br0 --detach --no-chdir --pidfile >monitor.log 2>&1
2819 AT_CAPTURE_FILE([monitor.log])
2821 # Send an OpenFlow13 message (04), OFPT_GET_ASYNC_REQUEST (1a), length (8), xid (0a)
2822 ovs-appctl -t ovs-ofctl ofctl/send 041a00080000000a
2823 ovs-appctl -t ovs-ofctl ofctl/barrier
2825 # Check default setting
2826 read -r -d '' expected <<'EOF'
2829 AT_CHECK([ofctl_strip < monitor.log], [], [dnl
2830 send: OFPT_GET_ASYNC_REQUEST (OF1.3):
2831 OFPT_GET_ASYNC_REPLY (OF1.3):
2833 PACKET_IN: no_match action
2834 PORT_STATUS: add delete modify
2835 FLOW_REMOVED: idle hard delete
2839 PORT_STATUS: add delete modify
2841 OFPT_BARRIER_REPLY (OF1.3):
2847 AT_SETUP([ofproto - ofport_request])
2849 ADD_OF_PORTS([br0], [1], [2], [3])
2851 set_and_check_specific_ofports () {
2852 ovs-vsctl set Interface p1 ofport_request="$1" -- \
2853 set Interface p2 ofport_request="$2" -- \
2854 set Interface p3 ofport_request="$3"
2855 ofports=`ovs-vsctl get Interface p1 ofport -- \
2856 get Interface p2 ofport -- \
2857 get Interface p3 ofport`
2858 AT_CHECK_UNQUOTED([echo $ofports], [0], [$1 $2 $3
2861 for pre in '1 2 3' '1 3 2' '2 1 3' '2 3 1' '3 1 2' '3 2 1'; do
2862 for post in '1 2 3' '1 3 2' '2 1 3' '2 3 1' '3 1 2' '3 2 1'; do
2863 echo -----------------------------------------------------------
2864 echo "Check changing port numbers from $pre to $post"
2865 set_and_check_specific_ofports $pre
2866 set_and_check_specific_ofports $post
2870 ovs-vsctl del-port p3
2872 set_and_check_poorly_specified_ofports () {
2873 ovs-vsctl set Interface p1 ofport_request="$1" -- \
2874 set Interface p2 ofport_request="$2"
2875 p1=`ovs-vsctl get Interface p1 ofport`
2876 p2=`ovs-vsctl get Interface p2 ofport`
2879 AT_CHECK([test "$p1" != "$p2"])
2880 if test "$1" = "$2" && test "$1" != '[[]]'; then
2881 # One port number must be the requested one.
2882 AT_CHECK([test "$p1" = "$1" || test "$p2" = "$1"])
2883 # The other port number must be different (already tested above).
2885 AT_CHECK([test "$1" = '[[]]' || test "$p1" == "$1"])
2886 AT_CHECK([test "$2" = '[[]]' || test "$p2" == "$2"])
2889 for pre in '1 2' '[[]] 2' '1 [[]]' '[[]] [[]]' '2 1' '[[]] 1' '2 [[]]' \
2891 for post in '1 2' '[[]] 2' '1 [[]]' '[[]] [[]]' '2 1' '[[]] 1' '2 [[]]' \
2893 echo -----------------------------------------------------------
2894 echo "Check changing port numbers from $pre to $post"
2895 set_and_check_poorly_specified_ofports $pre
2896 set_and_check_poorly_specified_ofports $post
2903 AT_SETUP([ofproto - bundles, open (OpenFlow 1.4)])
2904 AT_KEYWORDS([monitor])
2907 # Start a monitor, use the required protocol version
2908 ovs-ofctl -O OpenFlow14 monitor br0 --detach --no-chdir --pidfile >monitor.log 2>&1
2909 AT_CAPTURE_FILE([monitor.log])
2911 # Send an OpenFlow14 message (05), OFPT_BUNDLE_CONTROL (21), length (10), xid (0a)
2912 ovs-appctl -t ovs-ofctl ofctl/send "05 21 00 10 00 00 00 0a 00 00 00 01 00 00 00 01"
2913 ovs-appctl -t ovs-ofctl ofctl/barrier
2914 ovs-appctl -t ovs-ofctl exit
2916 AT_CHECK([ofctl_strip < monitor.log], [], [dnl
2917 send: OFPT_BUNDLE_CONTROL (OF1.4):
2918 bundle_id=0x1 type=OPEN_REQUEST flags=atomic
2919 OFPT_BUNDLE_CONTROL (OF1.4):
2920 bundle_id=0x1 type=OPEN_REPLY flags=0
2921 OFPT_BARRIER_REPLY (OF1.4):
2927 AT_SETUP([ofproto - bundles, double open (OpenFlow 1.4)])
2928 AT_KEYWORDS([monitor])
2931 # Start a monitor, use the required protocol version
2932 ovs-ofctl -O OpenFlow14 monitor br0 --detach --no-chdir --pidfile >monitor.log 2>&1
2933 AT_CAPTURE_FILE([monitor.log])
2935 # Send twice an OpenFlow14 message (05), OFPT_BUNDLE_CONTROL (21), length (10), xid (0a)
2936 ovs-appctl -t ovs-ofctl ofctl/send "05 21 00 10 00 00 00 0a 00 00 00 01 00 00 00 01"
2937 ovs-appctl -t ovs-ofctl ofctl/barrier
2938 ovs-appctl -t ovs-ofctl ofctl/send "05 21 00 10 00 00 00 0a 00 00 00 01 00 00 00 01"
2939 ovs-appctl -t ovs-ofctl ofctl/barrier
2940 ovs-appctl -t ovs-ofctl exit
2942 AT_CHECK([ofctl_strip < monitor.log], [0], [dnl
2943 send: OFPT_BUNDLE_CONTROL (OF1.4):
2944 bundle_id=0x1 type=OPEN_REQUEST flags=atomic
2945 OFPT_BUNDLE_CONTROL (OF1.4):
2946 bundle_id=0x1 type=OPEN_REPLY flags=0
2947 OFPT_BARRIER_REPLY (OF1.4):
2948 send: OFPT_BUNDLE_CONTROL (OF1.4):
2949 bundle_id=0x1 type=OPEN_REQUEST flags=atomic
2950 OFPT_ERROR (OF1.4): OFPBFC_BAD_ID
2951 OFPT_BUNDLE_CONTROL (OF1.4):
2952 bundle_id=0x1 type=OPEN_REQUEST flags=atomic
2953 OFPT_BARRIER_REPLY (OF1.4):
2959 AT_SETUP([ofproto - bundle close without open (OpenFlow 1.4)])
2960 AT_KEYWORDS([monitor])
2963 # Start a monitor, use the required protocol version
2964 ovs-ofctl -O OpenFlow14 monitor br0 --detach --no-chdir --pidfile >monitor.log 2>&1
2965 AT_CAPTURE_FILE([monitor.log])
2967 ovs-appctl -t ovs-ofctl ofctl/send "05 21 00 10 00 00 00 0a 00 00 00 01 00 02 00 01"
2968 ovs-appctl -t ovs-ofctl ofctl/barrier
2969 ovs-appctl -t ovs-ofctl exit
2971 AT_CHECK([ofctl_strip < monitor.log], [0], [dnl
2972 send: OFPT_BUNDLE_CONTROL (OF1.4):
2973 bundle_id=0x1 type=CLOSE_REQUEST flags=atomic
2974 OFPT_ERROR (OF1.4): OFPBFC_BAD_ID
2975 OFPT_BUNDLE_CONTROL (OF1.4):
2976 bundle_id=0x1 type=CLOSE_REQUEST flags=atomic
2977 OFPT_BARRIER_REPLY (OF1.4):
2983 AT_SETUP([ofproto - bundle double close (OpenFlow 1.4)])
2984 AT_KEYWORDS([monitor])
2987 # Start a monitor, use the required protocol version
2988 ovs-ofctl -O OpenFlow14 monitor br0 --detach --no-chdir --pidfile >monitor.log 2>&1
2989 AT_CAPTURE_FILE([monitor.log])
2991 # Open, Close, Close
2992 ovs-appctl -t ovs-ofctl ofctl/send "05 21 00 10 00 00 00 0a 00 00 00 01 00 00 00 01"
2993 ovs-appctl -t ovs-ofctl ofctl/barrier
2994 ovs-appctl -t ovs-ofctl ofctl/send "05 21 00 10 00 00 00 0a 00 00 00 01 00 02 00 01"
2995 ovs-appctl -t ovs-ofctl ofctl/barrier
2996 ovs-appctl -t ovs-ofctl ofctl/send "05 21 00 10 00 00 00 0a 00 00 00 01 00 02 00 01"
2997 ovs-appctl -t ovs-ofctl ofctl/barrier
2998 ovs-appctl -t ovs-ofctl exit
3000 AT_CHECK([ofctl_strip < monitor.log], [0], [dnl
3001 send: OFPT_BUNDLE_CONTROL (OF1.4):
3002 bundle_id=0x1 type=OPEN_REQUEST flags=atomic
3003 OFPT_BUNDLE_CONTROL (OF1.4):
3004 bundle_id=0x1 type=OPEN_REPLY flags=0
3005 OFPT_BARRIER_REPLY (OF1.4):
3006 send: OFPT_BUNDLE_CONTROL (OF1.4):
3007 bundle_id=0x1 type=CLOSE_REQUEST flags=atomic
3008 OFPT_BUNDLE_CONTROL (OF1.4):
3009 bundle_id=0x1 type=CLOSE_REPLY flags=0
3010 OFPT_BARRIER_REPLY (OF1.4):
3011 send: OFPT_BUNDLE_CONTROL (OF1.4):
3012 bundle_id=0x1 type=CLOSE_REQUEST flags=atomic
3013 OFPT_ERROR (OF1.4): OFPBFC_BUNDLE_CLOSED
3014 OFPT_BUNDLE_CONTROL (OF1.4):
3015 bundle_id=0x1 type=CLOSE_REQUEST flags=atomic
3016 OFPT_BARRIER_REPLY (OF1.4):
3022 AT_SETUP([ofproto - bundle close, different flags (OpenFlow 1.4)])
3023 AT_KEYWORDS([monitor])
3026 # Start a monitor, use the required protocol version
3027 ovs-ofctl -O OpenFlow14 monitor br0 --detach --no-chdir --pidfile >monitor.log 2>&1
3028 AT_CAPTURE_FILE([monitor.log])
3030 # Open, Close, Close
3031 ovs-appctl -t ovs-ofctl ofctl/send "05 21 00 10 00 00 00 0a 00 00 00 01 00 00 00 01"
3032 ovs-appctl -t ovs-ofctl ofctl/barrier
3033 ovs-appctl -t ovs-ofctl ofctl/send "05 21 00 10 00 00 00 0a 00 00 00 01 00 02 00 02"
3034 ovs-appctl -t ovs-ofctl ofctl/barrier
3035 ovs-appctl -t ovs-ofctl exit
3037 AT_CHECK([ofctl_strip < monitor.log], [0], [dnl
3038 send: OFPT_BUNDLE_CONTROL (OF1.4):
3039 bundle_id=0x1 type=OPEN_REQUEST flags=atomic
3040 OFPT_BUNDLE_CONTROL (OF1.4):
3041 bundle_id=0x1 type=OPEN_REPLY flags=0
3042 OFPT_BARRIER_REPLY (OF1.4):
3043 send: OFPT_BUNDLE_CONTROL (OF1.4):
3044 bundle_id=0x1 type=CLOSE_REQUEST flags=ordered
3045 OFPT_ERROR (OF1.4): OFPBFC_BAD_FLAGS
3046 OFPT_BUNDLE_CONTROL (OF1.4):
3047 bundle_id=0x1 type=CLOSE_REQUEST flags=ordered
3048 OFPT_BARRIER_REPLY (OF1.4):
3054 AT_SETUP([ofproto - bundle commit without open (OpenFlow 1.4)])
3055 AT_KEYWORDS([monitor])
3058 # Start a monitor, use the required protocol version
3059 ovs-ofctl -O OpenFlow14 monitor br0 --detach --no-chdir --pidfile >monitor.log 2>&1
3060 AT_CAPTURE_FILE([monitor.log])
3062 # Open, Close, Close
3063 ovs-appctl -t ovs-ofctl ofctl/send "05 21 00 10 00 00 00 0a 00 00 00 01 00 04 00 01"
3064 ovs-appctl -t ovs-ofctl ofctl/barrier
3065 ovs-appctl -t ovs-ofctl exit
3067 AT_CHECK([ofctl_strip < monitor.log], [0], [dnl
3068 send: OFPT_BUNDLE_CONTROL (OF1.4):
3069 bundle_id=0x1 type=COMMIT_REQUEST flags=atomic
3070 OFPT_ERROR (OF1.4): OFPBFC_BAD_ID
3071 OFPT_BUNDLE_CONTROL (OF1.4):
3072 bundle_id=0x1 type=COMMIT_REQUEST flags=atomic
3073 OFPT_BARRIER_REPLY (OF1.4):
3079 AT_SETUP([ofproto - bundle commit, different flags (OpenFlow 1.4)])
3080 AT_KEYWORDS([monitor])
3083 # Start a monitor, use the required protocol version
3084 ovs-ofctl -O OpenFlow14 monitor br0 --detach --no-chdir --pidfile >monitor.log 2>&1
3085 AT_CAPTURE_FILE([monitor.log])
3087 # Open, Close, Close
3088 ovs-appctl -t ovs-ofctl ofctl/send "05 21 00 10 00 00 00 0a 00 00 00 01 00 00 00 01"
3089 ovs-appctl -t ovs-ofctl ofctl/barrier
3090 ovs-appctl -t ovs-ofctl ofctl/send "05 21 00 10 00 00 00 0a 00 00 00 01 00 04 00 02"
3091 ovs-appctl -t ovs-ofctl ofctl/barrier
3092 ovs-appctl -t ovs-ofctl exit
3094 AT_CHECK([ofctl_strip < monitor.log], [0], [dnl
3095 send: OFPT_BUNDLE_CONTROL (OF1.4):
3096 bundle_id=0x1 type=OPEN_REQUEST flags=atomic
3097 OFPT_BUNDLE_CONTROL (OF1.4):
3098 bundle_id=0x1 type=OPEN_REPLY flags=0
3099 OFPT_BARRIER_REPLY (OF1.4):
3100 send: OFPT_BUNDLE_CONTROL (OF1.4):
3101 bundle_id=0x1 type=COMMIT_REQUEST flags=ordered
3102 OFPT_ERROR (OF1.4): OFPBFC_BAD_FLAGS
3103 OFPT_BUNDLE_CONTROL (OF1.4):
3104 bundle_id=0x1 type=COMMIT_REQUEST flags=ordered
3105 OFPT_BARRIER_REPLY (OF1.4):
3111 AT_SETUP([ofproto - bundle discard without open (OpenFlow 1.4)])
3112 AT_KEYWORDS([monitor])
3115 # Start a monitor, use the required protocol version
3116 ovs-ofctl -O OpenFlow14 monitor br0 --detach --no-chdir --pidfile >monitor.log 2>&1
3117 AT_CAPTURE_FILE([monitor.log])
3119 # Open, Close, Close
3120 ovs-appctl -t ovs-ofctl ofctl/send "05 21 00 10 00 00 00 0a 00 00 00 01 00 06 00 01"
3121 ovs-appctl -t ovs-ofctl ofctl/barrier
3122 ovs-appctl -t ovs-ofctl exit
3124 AT_CHECK([ofctl_strip < monitor.log], [0], [dnl
3125 send: OFPT_BUNDLE_CONTROL (OF1.4):
3126 bundle_id=0x1 type=DISCARD_REQUEST flags=atomic
3127 OFPT_ERROR (OF1.4): OFPBFC_BAD_ID
3128 OFPT_BUNDLE_CONTROL (OF1.4):
3129 bundle_id=0x1 type=DISCARD_REQUEST flags=atomic
3130 OFPT_BARRIER_REPLY (OF1.4):