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 actset_output: exact match or wildcard
1197 pkt_mark: arbitrary mask
1198 reg0: arbitrary mask
1199 reg1: arbitrary mask
1200 reg2: arbitrary mask
1201 reg3: arbitrary mask
1202 reg4: arbitrary mask
1203 reg5: arbitrary mask
1204 reg6: arbitrary mask
1205 reg7: arbitrary mask
1206 xreg0: arbitrary mask
1207 xreg1: arbitrary mask
1208 xreg2: arbitrary mask
1209 xreg3: arbitrary mask
1210 eth_src: arbitrary mask
1211 eth_dst: arbitrary mask
1212 eth_type: exact match or wildcard
1213 vlan_tci: arbitrary mask
1214 vlan_vid: arbitrary mask
1215 vlan_pcp: exact match or wildcard
1216 mpls_label: exact match or wildcard
1217 mpls_tc: exact match or wildcard
1218 mpls_bos: exact match or wildcard
1219 ip_src: arbitrary mask
1220 ip_dst: arbitrary mask
1221 ipv6_src: arbitrary mask
1222 ipv6_dst: arbitrary mask
1223 ipv6_label: arbitrary mask
1224 nw_proto: exact match or wildcard
1225 nw_tos: exact match or wildcard
1226 ip_dscp: exact match or wildcard
1227 nw_ecn: exact match or wildcard
1228 nw_ttl: exact match or wildcard
1229 ip_frag: arbitrary mask
1230 arp_op: exact match or wildcard
1231 arp_spa: arbitrary mask
1232 arp_tpa: arbitrary mask
1233 arp_sha: arbitrary mask
1234 arp_tha: arbitrary mask
1235 tcp_src: arbitrary mask
1236 tcp_dst: arbitrary mask
1237 tcp_flags: arbitrary mask
1238 udp_src: arbitrary mask
1239 udp_dst: arbitrary mask
1240 sctp_src: arbitrary mask
1241 sctp_dst: arbitrary mask
1242 icmp_type: exact match or wildcard
1243 icmp_code: exact match or wildcard
1244 icmpv6_type: exact match or wildcard
1245 icmpv6_code: exact match or wildcard
1246 nd_target: arbitrary mask
1247 nd_sll: arbitrary mask
1248 nd_tll: arbitrary mask"
1252 AT_CHECK([ovs-ofctl -O OpenFlow13 dump-table-features br0 | sed '/^$/d
1253 /^OFPST_TABLE_FEATURES/d'], [0], [expout])
1254 # Change the configuration.
1257 -- --id=@t0 create Flow_Table name=main \
1258 -- --id=@t1 create Flow_Table flow-limit=1024 \
1259 -- set bridge br0 'flow_tables={1=@t1,0=@t0}' \
1260 | ${PERL} $srcdir/uuidfilt.pl],
1264 # Check that the configuration was updated.
1265 mv expout orig-expout
1266 sed 's/classifier/main/
1267 74s/1000000/1024/' < orig-expout > expout
1268 AT_CHECK([ovs-ofctl -O OpenFlow13 dump-table-features br0 | sed '/^$/d
1269 /^OFPST_TABLE_FEATURES/d'], [0], [expout])
1273 AT_SETUP([ofproto - hard limits on flow table size (OpenFlow 1.0)])
1275 # Configure a maximum of 4 flows.
1278 -- --id=@t0 create Flow_Table flow-limit=4 \
1279 -- set bridge br0 flow_tables:0=@t0 \
1280 | ${PERL} $srcdir/uuidfilt.pl],
1284 for in_port in 1 2 3 4; do
1285 ovs-ofctl add-flow br0 in_port=$in_port,actions=drop
1287 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1288 in_port=1 actions=drop
1289 in_port=2 actions=drop
1290 in_port=3 actions=drop
1291 in_port=4 actions=drop
1294 # Adding another flow will be refused.
1295 AT_CHECK([ovs-ofctl add-flow br0 in_port=5,actions=drop], [1], [], [stderr])
1296 AT_CHECK([head -n 1 stderr | ofctl_strip], [0],
1297 [OFPT_ERROR: OFPFMFC_TABLE_FULL
1299 # Also a mod-flow that would add a flow will be refused.
1300 AT_CHECK([ovs-ofctl mod-flows br0 in_port=5,actions=drop], [1], [], [stderr])
1301 AT_CHECK([head -n 1 stderr | ofctl_strip], [0],
1302 [OFPT_ERROR: OFPFMFC_TABLE_FULL
1304 # Replacing or modifying an existing flow is allowed.
1305 AT_CHECK([ovs-ofctl add-flow br0 in_port=4,actions=normal])
1306 AT_CHECK([ovs-ofctl mod-flows br0 in_port=3,actions=output:1])
1307 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1308 in_port=1 actions=drop
1309 in_port=2 actions=drop
1310 in_port=3 actions=output:1
1311 in_port=4 actions=NORMAL
1317 AT_SETUP([ofproto - hard limits on flow table size (OpenFlow 1.2)])
1319 # Configure a maximum of 4 flows.
1322 -- --id=@t0 create Flow_Table flow-limit=4 \
1323 -- set bridge br0 flow_tables:0=@t0 \
1324 | ${PERL} $srcdir/uuidfilt.pl],
1328 for in_port in 1 2 3 4; do
1329 ovs-ofctl -O OpenFlow12 add-flow br0 in_port=$in_port,actions=drop
1331 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1332 in_port=1 actions=drop
1333 in_port=2 actions=drop
1334 in_port=3 actions=drop
1335 in_port=4 actions=drop
1336 OFPST_FLOW reply (OF1.2):
1338 # Adding another flow will be refused.
1339 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 in_port=5,actions=drop], [1], [], [stderr])
1340 AT_CHECK([head -n 1 stderr | ofctl_strip], [0],
1341 [OFPT_ERROR (OF1.2): OFPFMFC_TABLE_FULL
1343 # Replacing or modifying an existing flow is allowed.
1344 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 in_port=4,actions=normal])
1345 AT_CHECK([ovs-ofctl -O OpenFlow12 mod-flows br0 in_port=3,actions=output:1])
1346 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1347 in_port=1 actions=drop
1348 in_port=2 actions=drop
1349 in_port=3 actions=output:1
1350 in_port=4 actions=NORMAL
1351 OFPST_FLOW reply (OF1.2):
1356 AT_SETUP([ofproto - eviction upon table overflow (OpenFlow 1.0)])
1358 # Configure a maximum of 4 flows.
1361 -- --id=@t0 create Flow_Table flow-limit=4 overflow-policy=evict \
1362 -- set bridge br0 flow_tables:0=@t0 \
1363 | ${PERL} $srcdir/uuidfilt.pl],
1367 for in_port in 4 3 2 1; do
1368 ovs-ofctl add-flow br0 idle_timeout=${in_port}0,in_port=$in_port,actions=drop
1370 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1371 idle_timeout=10, in_port=1 actions=drop
1372 idle_timeout=20, in_port=2 actions=drop
1373 idle_timeout=30, in_port=3 actions=drop
1374 idle_timeout=40, in_port=4 actions=drop
1377 # Adding another flow will cause the one that expires soonest to be evicted.
1378 AT_CHECK([ovs-ofctl add-flow br0 in_port=5,actions=drop])
1379 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1380 idle_timeout=20, in_port=2 actions=drop
1381 idle_timeout=30, in_port=3 actions=drop
1382 idle_timeout=40, in_port=4 actions=drop
1383 in_port=5 actions=drop
1386 # A mod-flow that adds a flow also causes eviction, but replacing or
1387 # modifying an existing flow doesn't.
1388 AT_CHECK([ovs-ofctl mod-flows br0 in_port=6,actions=drop])
1389 AT_CHECK([ovs-ofctl add-flow br0 in_port=4,actions=normal])
1390 AT_CHECK([ovs-ofctl mod-flows br0 in_port=3,actions=output:1])
1391 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1392 idle_timeout=30, in_port=3 actions=output:1
1393 in_port=4 actions=NORMAL
1394 in_port=5 actions=drop
1395 in_port=6 actions=drop
1398 # Flows with no timeouts at all cannot be evicted.
1399 AT_CHECK([ovs-ofctl add-flow br0 in_port=7,actions=normal])
1400 AT_CHECK([ovs-ofctl add-flow br0 in_port=8,actions=drop], [1], [], [stderr])
1401 AT_CHECK([head -n 1 stderr | ofctl_strip], [0],
1402 [OFPT_ERROR: OFPFMFC_TABLE_FULL
1404 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1405 in_port=4 actions=NORMAL
1406 in_port=5 actions=drop
1407 in_port=6 actions=drop
1408 in_port=7 actions=NORMAL
1414 AT_SETUP([ofproto - eviction upon table overflow (OpenFlow 1.2)])
1416 # Configure a maximum of 4 flows.
1419 -- --id=@t0 create Flow_Table flow-limit=4 overflow-policy=evict \
1420 -- set bridge br0 flow_tables:0=@t0 \
1421 | ${PERL} $srcdir/uuidfilt.pl],
1425 for in_port in 4 3 2 1; do
1426 ovs-ofctl -O OpenFlow12 add-flow br0 idle_timeout=${in_port}0,in_port=$in_port,actions=drop
1428 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1429 idle_timeout=10, in_port=1 actions=drop
1430 idle_timeout=20, in_port=2 actions=drop
1431 idle_timeout=30, in_port=3 actions=drop
1432 idle_timeout=40, in_port=4 actions=drop
1433 OFPST_FLOW reply (OF1.2):
1435 # Adding another flow will cause the one that expires soonest to be evicted.
1436 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 in_port=5,actions=drop])
1437 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1438 idle_timeout=20, in_port=2 actions=drop
1439 idle_timeout=30, in_port=3 actions=drop
1440 idle_timeout=40, in_port=4 actions=drop
1441 in_port=5 actions=drop
1442 OFPST_FLOW reply (OF1.2):
1444 # In Open Flow 1.2 a mod-flow does not ever add a flow and thus
1445 # has no effect on eviction
1446 AT_CHECK([ovs-ofctl -O OpenFlow12 mod-flows br0 in_port=6,actions=drop])
1447 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 in_port=4,actions=normal])
1448 AT_CHECK([ovs-ofctl -O OpenFlow12 mod-flows br0 in_port=3,actions=output:1])
1449 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1450 idle_timeout=20, in_port=2 actions=drop
1451 idle_timeout=30, in_port=3 actions=output:1
1452 in_port=4 actions=NORMAL
1453 in_port=5 actions=drop
1454 OFPST_FLOW reply (OF1.2):
1456 # Flows with no timeouts at all cannot be evicted.
1457 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 in_port=6,actions=drop])
1458 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 in_port=7,actions=normal])
1459 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 in_port=8,actions=drop], [1], [], [stderr])
1460 AT_CHECK([head -n 1 stderr | ofctl_strip], [0],
1461 [OFPT_ERROR (OF1.2): OFPFMFC_TABLE_FULL
1463 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1464 in_port=4 actions=NORMAL
1465 in_port=5 actions=drop
1466 in_port=6 actions=drop
1467 in_port=7 actions=NORMAL
1468 OFPST_FLOW reply (OF1.2):
1473 AT_SETUP([ofproto - eviction upon table overflow, with fairness (OpenFlow 1.0)])
1475 # Configure a maximum of 4 flows.
1478 -- --id=@t0 create Flow_Table name=evict flow-limit=4 \
1479 overflow-policy=evict \
1480 groups='"NXM_OF_IN_PORT[[]]"' \
1481 -- set bridge br0 flow_tables:0=@t0 \
1482 | ${PERL} $srcdir/uuidfilt.pl],
1486 ovs-ofctl add-flows br0 - <<EOF
1487 idle_timeout=10 in_port=2 dl_src=00:44:55:66:77:88 actions=drop
1488 idle_timeout=20 in_port=1 dl_src=00:11:22:33:44:55 actions=drop
1489 idle_timeout=30 in_port=1 dl_src=00:22:33:44:55:66 actions=drop
1490 idle_timeout=40 in_port=1 dl_src=00:33:44:55:66:77 actions=drop
1492 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1493 idle_timeout=10, in_port=2,dl_src=00:44:55:66:77:88 actions=drop
1494 idle_timeout=20, in_port=1,dl_src=00:11:22:33:44:55 actions=drop
1495 idle_timeout=30, in_port=1,dl_src=00:22:33:44:55:66 actions=drop
1496 idle_timeout=40, in_port=1,dl_src=00:33:44:55:66:77 actions=drop
1499 # Adding another flow will cause the one that expires soonest within
1500 # the largest group (those with in_port=1) to be evicted. In this
1501 # case this is not the same as the one that expires soonest overall
1502 # (which is what makes the test interesting):
1503 AT_CHECK([ovs-ofctl add-flow br0 in_port=2,dl_src=00:55:66:77:88:99,actions=drop])
1504 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1505 idle_timeout=10, in_port=2,dl_src=00:44:55:66:77:88 actions=drop
1506 idle_timeout=30, in_port=1,dl_src=00:22:33:44:55:66 actions=drop
1507 idle_timeout=40, in_port=1,dl_src=00:33:44:55:66:77 actions=drop
1508 in_port=2,dl_src=00:55:66:77:88:99 actions=drop
1511 # Enlarge the flow limit, change the eviction policy back to strictly
1512 # based on expiration, and and add some flows.
1513 AT_CHECK([ovs-vsctl set Flow_Table evict groups='[[]]' flow-limit=7])
1514 ovs-ofctl add-flows br0 - <<EOF
1515 idle_timeout=50 in_port=2 dl_src=00:66:77:88:99:aa actions=drop
1516 idle_timeout=60 in_port=2 dl_src=00:77:88:99:aa:bb actions=drop
1517 idle_timeout=70 in_port=2 dl_src=00:88:99:aa:bb:cc actions=drop
1519 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1520 idle_timeout=10, in_port=2,dl_src=00:44:55:66:77:88 actions=drop
1521 idle_timeout=30, in_port=1,dl_src=00:22:33:44:55:66 actions=drop
1522 idle_timeout=40, in_port=1,dl_src=00:33:44:55:66:77 actions=drop
1523 idle_timeout=50, in_port=2,dl_src=00:66:77:88:99:aa actions=drop
1524 idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=drop
1525 idle_timeout=70, in_port=2,dl_src=00:88:99:aa:bb:cc actions=drop
1526 in_port=2,dl_src=00:55:66:77:88:99 actions=drop
1529 # Adding another flow will cause the one that expires soonest overall
1531 AT_CHECK([ovs-ofctl add-flow br0 'idle_timeout=80 in_port=2 dl_src=00:99:aa:bb:cc:dd actions=drop'])
1532 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1533 idle_timeout=30, in_port=1,dl_src=00:22:33:44:55:66 actions=drop
1534 idle_timeout=40, in_port=1,dl_src=00:33:44:55:66:77 actions=drop
1535 idle_timeout=50, in_port=2,dl_src=00:66:77:88:99:aa actions=drop
1536 idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=drop
1537 idle_timeout=70, in_port=2,dl_src=00:88:99:aa:bb:cc actions=drop
1538 idle_timeout=80, in_port=2,dl_src=00:99:aa:bb:cc:dd actions=drop
1539 in_port=2,dl_src=00:55:66:77:88:99 actions=drop
1542 # Reducing the flow limit also causes the flows that expire soonest
1543 # overall to be evicted.
1544 AT_CHECK([ovs-vsctl set Flow_Table evict flow-limit=4])
1545 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1546 idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=drop
1547 idle_timeout=70, in_port=2,dl_src=00:88:99:aa:bb:cc actions=drop
1548 idle_timeout=80, in_port=2,dl_src=00:99:aa:bb:cc:dd actions=drop
1549 in_port=2,dl_src=00:55:66:77:88:99 actions=drop
1555 AT_SETUP([ofproto - eviction upon table overflow, with fairness (OpenFlow 1.2)])
1557 # Configure a maximum of 4 flows.
1560 -- --id=@t0 create Flow_Table name=evict flow-limit=4 \
1561 overflow-policy=evict \
1562 groups='"NXM_OF_IN_PORT[[]]"' \
1563 -- set bridge br0 flow_tables:0=@t0 \
1564 | ${PERL} $srcdir/uuidfilt.pl],
1568 ovs-ofctl -O OpenFlow12 add-flows br0 - <<EOF
1569 idle_timeout=10 in_port=2 dl_src=00:44:55:66:77:88 actions=drop
1570 idle_timeout=20 in_port=1 dl_src=00:11:22:33:44:55 actions=drop
1571 idle_timeout=30 in_port=1 dl_src=00:22:33:44:55:66 actions=drop
1572 idle_timeout=40 in_port=1 dl_src=00:33:44:55:66:77 actions=drop
1574 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1575 idle_timeout=10, in_port=2,dl_src=00:44:55:66:77:88 actions=drop
1576 idle_timeout=20, in_port=1,dl_src=00:11:22:33:44:55 actions=drop
1577 idle_timeout=30, in_port=1,dl_src=00:22:33:44:55:66 actions=drop
1578 idle_timeout=40, in_port=1,dl_src=00:33:44:55:66:77 actions=drop
1579 OFPST_FLOW reply (OF1.2):
1581 # Adding another flow will cause the one that expires soonest within
1582 # the largest group (those with in_port=1) to be evicted. In this
1583 # case this is not the same as the one that expires soonest overall
1584 # (which is what makes the test interesting):
1585 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 in_port=2,dl_src=00:55:66:77:88:99,actions=drop])
1586 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1587 idle_timeout=10, in_port=2,dl_src=00:44:55:66:77:88 actions=drop
1588 idle_timeout=30, in_port=1,dl_src=00:22:33:44:55:66 actions=drop
1589 idle_timeout=40, in_port=1,dl_src=00:33:44:55:66:77 actions=drop
1590 in_port=2,dl_src=00:55:66:77:88:99 actions=drop
1591 OFPST_FLOW reply (OF1.2):
1593 # Enlarge the flow limit, change the eviction policy back to strictly
1594 # based on expiration, and and add some flows.
1595 AT_CHECK([ovs-vsctl set Flow_Table evict groups='[[]]' flow-limit=7])
1596 ovs-ofctl -O OpenFlow12 add-flows br0 - <<EOF
1597 idle_timeout=50 in_port=2 dl_src=00:66:77:88:99:aa actions=drop
1598 idle_timeout=60 in_port=2 dl_src=00:77:88:99:aa:bb actions=drop
1599 idle_timeout=70 in_port=2 dl_src=00:88:99:aa:bb:cc actions=drop
1601 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1602 idle_timeout=10, in_port=2,dl_src=00:44:55:66:77:88 actions=drop
1603 idle_timeout=30, in_port=1,dl_src=00:22:33:44:55:66 actions=drop
1604 idle_timeout=40, in_port=1,dl_src=00:33:44:55:66:77 actions=drop
1605 idle_timeout=50, in_port=2,dl_src=00:66:77:88:99:aa actions=drop
1606 idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=drop
1607 idle_timeout=70, in_port=2,dl_src=00:88:99:aa:bb:cc actions=drop
1608 in_port=2,dl_src=00:55:66:77:88:99 actions=drop
1609 OFPST_FLOW reply (OF1.2):
1611 # Adding another flow will cause the one that expires soonest overall
1613 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'])
1614 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1615 idle_timeout=30, in_port=1,dl_src=00:22:33:44:55:66 actions=drop
1616 idle_timeout=40, in_port=1,dl_src=00:33:44:55:66:77 actions=drop
1617 idle_timeout=50, in_port=2,dl_src=00:66:77:88:99:aa actions=drop
1618 idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=drop
1619 idle_timeout=70, in_port=2,dl_src=00:88:99:aa:bb:cc actions=drop
1620 idle_timeout=80, in_port=2,dl_src=00:99:aa:bb:cc:dd actions=drop
1621 in_port=2,dl_src=00:55:66:77:88:99 actions=drop
1622 OFPST_FLOW reply (OF1.2):
1624 # Reducing the flow limit also causes the flows that expire soonest
1625 # overall to be evicted.
1626 AT_CHECK([ovs-vsctl set Flow_Table evict flow-limit=4])
1627 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1628 idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=drop
1629 idle_timeout=70, in_port=2,dl_src=00:88:99:aa:bb:cc actions=drop
1630 idle_timeout=80, in_port=2,dl_src=00:99:aa:bb:cc:dd actions=drop
1631 in_port=2,dl_src=00:55:66:77:88:99 actions=drop
1632 OFPST_FLOW reply (OF1.2):
1637 AT_SETUP([ofproto - eviction upon table overflow, with modified hard timeout])
1639 # Configure a maximum of 4 flows.
1642 -- --id=@t0 create Flow_Table flow-limit=4 overflow-policy=evict \
1643 -- set bridge br0 flow_tables:0=@t0 \
1644 | ${PERL} $srcdir/uuidfilt.pl],
1647 ovs-appctl time/stop
1649 for in_port in 4 3 2 1; do
1650 ovs-ofctl add-flow br0 hard_timeout=$((10 + in_port * 3)),in_port=$in_port,actions=drop
1652 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1653 hard_timeout=13, in_port=1 actions=drop
1654 hard_timeout=16, in_port=2 actions=drop
1655 hard_timeout=19, in_port=3 actions=drop
1656 hard_timeout=22, in_port=4 actions=drop
1659 # Sleep and modify the one that expires soonest
1660 ovs-appctl time/warp 5000
1661 AT_CHECK([ovs-ofctl mod-flows br0 in_port=1,actions=drop])
1662 # At this point the table would looks like:
1663 # in_port seconds to expire
1668 ovs-appctl time/warp 2000
1669 # Adding another flow will cause the one that expires soonest to be evicted.
1670 AT_CHECK([ovs-ofctl add-flow br0 in_port=5,actions=drop])
1671 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1672 hard_timeout=13, in_port=1 actions=drop
1673 hard_timeout=19, in_port=3 actions=drop
1674 hard_timeout=22, in_port=4 actions=drop
1675 in_port=5 actions=drop
1681 AT_SETUP([ofproto - eviction upon table overflow, with modified idle timeout])
1682 OVS_VSWITCHD_START([add-port br0 p1 -- set interface p1 type=dummy ofport_request=1])
1683 # Configure a maximum of 4 flows.
1686 -- --id=@t0 create Flow_Table flow-limit=4 overflow-policy=evict \
1687 -- set bridge br0 flow_tables:0=@t0 \
1688 | ${PERL} $srcdir/uuidfilt.pl],
1692 for in_port in 4 3 2 1; do
1693 ovs-ofctl add-flow br0 idle_timeout=$((10 + in_port * 3)),in_port=$in_port,actions=drop
1695 ovs-appctl time/stop
1696 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1697 idle_timeout=13, in_port=1 actions=drop
1698 idle_timeout=16, in_port=2 actions=drop
1699 idle_timeout=19, in_port=3 actions=drop
1700 idle_timeout=22, in_port=4 actions=drop
1703 # Sleep and receive on the flow that expires soonest
1704 ovs-appctl time/warp 5000
1705 AT_CHECK([ovs-appctl netdev-dummy/receive p1 'in_port(1)'])
1706 # At this point the table would looks like:
1707 # in_port seconds to expire
1712 ovs-appctl time/warp 2000
1713 # Adding another flow will cause the one that expires soonest to be evicted.
1714 AT_CHECK([ovs-ofctl add-flow br0 in_port=5,actions=drop])
1715 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1716 idle_timeout=19, in_port=3 actions=drop
1717 idle_timeout=22, in_port=4 actions=drop
1718 in_port=5 actions=drop
1719 n_packets=1, n_bytes=60, idle_timeout=13, in_port=1 actions=drop
1725 AT_SETUP([ofproto - asynchronous message control (OpenFlow 1.0)])
1727 AT_CHECK([ovs-ofctl -P openflow10 monitor br0 --detach --no-chdir --pidfile])
1729 printf '\n\n--- check_async %d ---\n\n\n' $1
1732 ovs-appctl -t ovs-ofctl ofctl/barrier
1733 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
1736 # OFPT_PACKET_IN, OFPR_ACTION (controller_id=0)
1737 ovs-ofctl -v packet-out br0 controller controller '0001020304050010203040501234'
1738 if test X"$1" = X"OFPR_ACTION"; then shift;
1739 echo >>expout "OFPT_PACKET_IN: total_len=14 in_port=CONTROLLER (via action) data_len=14 (unbuffered)
1740 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"
1743 # OFPT_PACKET_IN, OFPR_NO_MATCH (controller_id=123)
1744 ovs-ofctl -v packet-out br0 controller 'controller(reason=no_match,id=123)' '0001020304050010203040501234'
1745 if test X"$1" = X"OFPR_NO_MATCH"; then shift;
1746 echo >>expout "OFPT_PACKET_IN: total_len=14 in_port=CONTROLLER (via no_match) data_len=14 (unbuffered)
1747 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"
1750 # OFPT_PACKET_IN, OFPR_INVALID_TTL (controller_id=0)
1751 ovs-ofctl packet-out br0 controller dec_ttl '002583dfb4000026b98cb0f908004500003eb7e200000011339bac11370dac100002d7730035002b8f6d86fb0100000100000000000006626c702d7873066e696369726103636f6d00000f00'
1752 if test X"$1" = X"OFPR_INVALID_TTL"; then shift;
1753 echo >>expout "OFPT_PACKET_IN: total_len=76 in_port=CONTROLLER (via invalid_ttl) data_len=76 (unbuffered)
1754 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"
1757 # OFPT_PORT_STATUS, OFPPR_ADD
1758 ovs-vsctl add-port br0 test -- set Interface test type=dummy ofport_request=1
1759 if test X"$1" = X"OFPPR_ADD"; then shift;
1760 echo >>expout "OFPT_PORT_STATUS: ADD: 1(test): addr:aa:55:aa:55:00:0x
1763 speed: 0 Mbps now, 0 Mbps max"
1766 # OFPT_PORT_STATUS, OFPPR_DELETE
1767 ovs-vsctl del-port br0 test
1768 if test X"$1" = X"OFPPR_DELETE"; then shift;
1769 echo >>expout "OFPT_PORT_STATUS: DEL: 1(test): addr:aa:55:aa:55:00:0x
1772 speed: 0 Mbps now, 0 Mbps max"
1775 # OFPT_FLOW_REMOVED, OFPRR_DELETE
1776 ovs-ofctl add-flow br0 send_flow_rem,actions=drop
1777 ovs-ofctl --strict del-flows br0 ''
1778 if test X"$1" = X"OFPRR_DELETE"; then shift;
1779 echo >>expout "OFPT_FLOW_REMOVED: reason=delete"
1781 AT_FAIL_IF([test X"$1" != X])
1783 ovs-appctl -t ovs-ofctl ofctl/barrier
1784 echo >>expout "OFPT_BARRIER_REPLY:"
1788 s/ (xid=0x[0-9a-fA-F]*)//
1790 s/00:0.$/00:0x/' < monitor.log]],
1794 # It's a service connection so initially there should be no async messages.
1797 # Set miss_send_len to 128, turning on packet-ins for our service connection.
1798 ovs-appctl -t ovs-ofctl ofctl/send 0109000c0123456700000080
1799 check_async 2 OFPR_ACTION OFPPR_ADD OFPPR_DELETE OFPRR_DELETE
1801 # Set miss_send_len to 128 and enable invalid_ttl.
1802 ovs-appctl -t ovs-ofctl ofctl/send 0109000c0123456700040080
1803 check_async 3 OFPR_ACTION OFPR_INVALID_TTL OFPPR_ADD OFPPR_DELETE OFPRR_DELETE
1805 # Become slave, which should disable everything except port status.
1806 ovs-appctl -t ovs-ofctl ofctl/send 0104001400000002000023200000000a00000002
1807 check_async 4 OFPPR_ADD OFPPR_DELETE
1809 # Use NXT_SET_ASYNC_CONFIG to enable a patchwork of asynchronous messages.
1810 ovs-appctl -t ovs-ofctl ofctl/send 01040028000000020000232000000013000000020000000500000005000000020000000200000005
1811 check_async 5 OFPR_INVALID_TTL OFPPR_DELETE OFPRR_DELETE
1813 # Set controller ID 123.
1814 ovs-appctl -t ovs-ofctl ofctl/send 01040018000000030000232000000014000000000000007b
1815 check_async 6 OFPR_NO_MATCH OFPPR_DELETE OFPRR_DELETE
1817 # Restore controller ID 0.
1818 ovs-appctl -t ovs-ofctl ofctl/send 010400180000000300002320000000140000000000000000
1821 ovs-appctl -t ovs-ofctl ofctl/send 0104001400000002000023200000000a00000001
1822 check_async 7 OFPR_ACTION OFPPR_ADD
1824 ovs-appctl -t ovs-ofctl exit
1828 AT_SETUP([ofproto - asynchronous message control (OpenFlow 1.2)])
1830 AT_CHECK([ovs-ofctl -O OpenFlow12 monitor br0 --detach --no-chdir --pidfile])
1832 printf '\n\n--- check_async %d ---\n\n\n' $1
1836 ovs-appctl -t ovs-ofctl ofctl/barrier
1837 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
1840 # OFPT_PACKET_IN, OFPR_ACTION (controller_id=0)
1841 ovs-ofctl -O OpenFlow12 -v packet-out br0 none controller '0001020304050010203040501234'
1842 if test X"$1" = X"OFPR_ACTION"; then shift;
1843 echo >>expout "OFPT_PACKET_IN (OF1.2): total_len=14 in_port=ANY (via action) data_len=14 (unbuffered)
1844 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"
1847 # OFPT_PACKET_IN, OFPR_NO_MATCH (controller_id=123)
1848 ovs-ofctl -O OpenFlow12 -v packet-out br0 none 'controller(reason=no_match,id=123)' '0001020304050010203040501234'
1849 if test X"$1" = X"OFPR_NO_MATCH"; then shift;
1850 echo >>expout "OFPT_PACKET_IN (OF1.2): total_len=14 in_port=ANY (via no_match) data_len=14 (unbuffered)
1851 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"
1854 # OFPT_PACKET_IN, OFPR_INVALID_TTL (controller_id=0)
1855 ovs-ofctl -O OpenFlow12 packet-out br0 none dec_ttl '002583dfb4000026b98cb0f908004500003eb7e200000011339bac11370dac100002d7730035002b8f6d86fb0100000100000000000006626c702d7873066e696369726103636f6d00000f00'
1856 if test X"$1" = X"OFPR_INVALID_TTL"; then shift;
1857 echo >>expout "OFPT_PACKET_IN (OF1.2): total_len=76 in_port=ANY (via invalid_ttl) data_len=76 (unbuffered)
1858 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"
1861 # OFPT_PORT_STATUS, OFPPR_ADD
1862 ovs-vsctl add-port br0 test -- set Interface test type=dummy
1863 if test X"$1" = X"OFPPR_ADD"; then shift;
1864 echo >>expout "OFPT_PORT_STATUS (OF1.2): ADD: ${INDEX}(test): addr:aa:55:aa:55:00:0x
1867 speed: 0 Mbps now, 0 Mbps max"
1870 # OFPT_PORT_STATUS, OFPPR_DELETE
1871 ovs-vsctl del-port br0 test
1872 if test X"$1" = X"OFPPR_DELETE"; then shift;
1873 echo >>expout "OFPT_PORT_STATUS (OF1.2): DEL: ${INDEX}(test): addr:aa:55:aa:55:00:0x
1876 speed: 0 Mbps now, 0 Mbps max"
1879 # OFPT_FLOW_REMOVED, OFPRR_DELETE
1880 ovs-ofctl -O OpenFlow12 add-flow br0 send_flow_rem,actions=drop
1881 ovs-ofctl -O OpenFlow12 --strict del-flows br0 ''
1882 if test X"$1" = X"OFPRR_DELETE"; then shift;
1883 echo >>expout "OFPT_FLOW_REMOVED (OF1.2): reason=delete table_id=0"
1885 AT_FAIL_IF([test X"$1" != X])
1887 ovs-appctl -t ovs-ofctl ofctl/barrier
1888 echo >>expout "OFPT_BARRIER_REPLY (OF1.2):"
1892 s/ (xid=0x[0-9a-fA-F]*)//
1894 s/00:0.$/00:0x/' < monitor.log]],
1898 # It's a service connection so initially there should be no async messages.
1901 # Set miss_send_len to 128, turning on packet-ins for our service connection.
1902 ovs-appctl -t ovs-ofctl ofctl/send 0309000c0123456700000080
1903 check_async 2 OFPR_ACTION OFPPR_ADD OFPPR_DELETE OFPRR_DELETE
1905 # Set miss_send_len to 128 and enable invalid_ttl.
1906 ovs-appctl -t ovs-ofctl ofctl/send 0309000c0123456700040080
1907 check_async 3 OFPR_ACTION OFPR_INVALID_TTL OFPPR_ADD OFPPR_DELETE OFPRR_DELETE
1909 # Become slave (OF 1.2), which should disable everything except port status.
1910 ovs-appctl -t ovs-ofctl ofctl/send 031800180000000200000003000000000000000000000001
1911 check_async 4 OFPPR_ADD OFPPR_DELETE
1913 # Use NXT_SET_ASYNC_CONFIG to enable a patchwork of asynchronous messages.
1914 ovs-appctl -t ovs-ofctl ofctl/send 03040028000000020000232000000013000000020000000500000005000000020000000200000005
1915 check_async 5 OFPR_INVALID_TTL OFPPR_DELETE OFPRR_DELETE
1917 # Set controller ID 123.
1918 ovs-appctl -t ovs-ofctl ofctl/send 03040018000000030000232000000014000000000000007b
1919 check_async 6 OFPR_NO_MATCH OFPPR_DELETE OFPRR_DELETE
1921 # Restore controller ID 0.
1922 ovs-appctl -t ovs-ofctl ofctl/send 030400180000000300002320000000140000000000000000
1924 # Become master (OF 1.2).
1925 ovs-appctl -t ovs-ofctl ofctl/send 031800180000000400000002000000000000000000000002
1926 check_async 7 OFPR_ACTION OFPPR_ADD
1928 ovs-appctl -t ovs-ofctl exit
1932 AT_SETUP([ofproto - asynchronous message control (OpenFlow 1.3)])
1934 AT_CHECK([ovs-ofctl -O OpenFlow13 monitor br0 --detach --no-chdir --pidfile])
1936 printf '\n\n--- check_async %d ---\n\n\n' $1
1940 ovs-appctl -t ovs-ofctl ofctl/barrier
1941 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
1944 # OFPT_PACKET_IN, OFPR_ACTION (controller_id=0)
1945 ovs-ofctl -O OpenFlow13 -v packet-out br0 none controller '0001020304050010203040501234'
1946 if test X"$1" = X"OFPR_ACTION"; then shift;
1947 echo >>expout "OFPT_PACKET_IN (OF1.3): total_len=14 in_port=ANY (via action) data_len=14 (unbuffered)
1948 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"
1951 # OFPT_PACKET_IN, OFPR_NO_MATCH (controller_id=123)
1952 ovs-ofctl -O OpenFlow13 -v packet-out br0 none 'controller(reason=no_match,id=123)' '0001020304050010203040501234'
1953 if test X"$1" = X"OFPR_NO_MATCH"; then shift;
1954 echo >>expout "OFPT_PACKET_IN (OF1.3): total_len=14 in_port=ANY (via no_match) data_len=14 (unbuffered)
1955 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"
1958 # OFPT_PACKET_IN, OFPR_INVALID_TTL (controller_id=0)
1959 ovs-ofctl -O OpenFlow13 packet-out br0 none dec_ttl '002583dfb4000026b98cb0f908004500003eb7e200000011339bac11370dac100002d7730035002b8f6d86fb0100000100000000000006626c702d7873066e696369726103636f6d00000f00'
1960 if test X"$1" = X"OFPR_INVALID_TTL"; then shift;
1961 echo >>expout "OFPT_PACKET_IN (OF1.3): total_len=76 in_port=ANY (via invalid_ttl) data_len=76 (unbuffered)
1962 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"
1965 # OFPT_PORT_STATUS, OFPPR_ADD
1966 ovs-vsctl add-port br0 test -- set Interface test type=dummy
1967 if test X"$1" = X"OFPPR_ADD"; then shift;
1968 echo >>expout "OFPT_PORT_STATUS (OF1.3): ADD: ${INDEX}(test): addr:aa:55:aa:55:00:0x
1971 speed: 0 Mbps now, 0 Mbps max"
1974 # OFPT_PORT_STATUS, OFPPR_DELETE
1975 ovs-vsctl del-port br0 test
1976 if test X"$1" = X"OFPPR_DELETE"; then shift;
1977 echo >>expout "OFPT_PORT_STATUS (OF1.3): DEL: ${INDEX}(test): addr:aa:55:aa:55:00:0x
1980 speed: 0 Mbps now, 0 Mbps max"
1983 # OFPT_FLOW_REMOVED, OFPRR_DELETE
1984 ovs-ofctl -O OpenFlow13 add-flow br0 send_flow_rem,actions=drop
1985 ovs-ofctl -O OpenFlow13 --strict del-flows br0 ''
1986 if test X"$1" = X"OFPRR_DELETE"; then shift;
1987 echo >>expout "OFPT_FLOW_REMOVED (OF1.3): reason=delete table_id=0"
1990 # OFPT_FLOW_REMOVED, OFPRR_GROUP_DELETE
1991 ovs-ofctl -O OpenFlow13 add-group br0 group_id=1234,type=all,bucket=output:10
1992 ovs-ofctl -O OpenFlow13 add-flow br0 send_flow_rem,actions=group:1234
1993 ovs-ofctl -O OpenFlow13 --strict del-groups br0 group_id=1234
1994 if test X"$1" = X"OFPRR_DELETE"; then shift;
1995 echo >>expout "OFPT_FLOW_REMOVED (OF1.3): reason=gropu_delete table_id=0"
1998 AT_FAIL_IF([test X"$1" != X])
2000 ovs-appctl -t ovs-ofctl ofctl/barrier
2001 echo >>expout "OFPT_BARRIER_REPLY (OF1.3):"
2005 s/ (xid=0x[0-9a-fA-F]*)//
2007 s/00:0.$/00:0x/' < monitor.log]],
2011 # It's a service connection so initially there should be no async messages.
2014 # Set miss_send_len to 128, turning on packet-ins for our service connection.
2015 ovs-appctl -t ovs-ofctl ofctl/send 0409000c0123456700000080
2016 check_async 2 OFPR_ACTION OFPPR_ADD OFPPR_DELETE OFPRR_DELETE
2018 # Become slave (OF 1.3), which should disable everything except port status.
2019 ovs-appctl -t ovs-ofctl ofctl/send 041800180000000200000003000000000000000000000001
2020 check_async 3 OFPPR_ADD OFPPR_DELETE
2022 # Use OF 1.3 OFPT_SET_ASYNC to enable a patchwork of asynchronous messages.
2023 ovs-appctl -t ovs-ofctl ofctl/send 041c002000000002000000020000000500000005000000020000000200000005
2024 check_async 4 OFPR_INVALID_TTL OFPPR_DELETE OFPRR_DELETE
2026 # Set controller ID 123.
2027 ovs-appctl -t ovs-ofctl ofctl/send 04040018000000030000232000000014000000000000007b
2028 check_async 5 OFPR_NO_MATCH OFPPR_DELETE OFPRR_DELETE
2030 # Restore controller ID 0.
2031 ovs-appctl -t ovs-ofctl ofctl/send 040400180000000300002320000000140000000000000000
2033 # Become master (OF 1.3).
2034 ovs-appctl -t ovs-ofctl ofctl/send 041800180000000400000002000000000000000000000002
2035 check_async 6 OFPR_ACTION OFPPR_ADD
2037 ovs-appctl -t ovs-ofctl exit
2041 AT_SETUP([ofproto - asynchronous message control (OpenFlow 1.5)])
2043 AT_CHECK([ovs-ofctl -O OpenFlow15 monitor br0 --detach --no-chdir --pidfile])
2045 printf '\n\n--- check_async %d ---\n\n\n' $1
2049 ovs-appctl -t ovs-ofctl ofctl/barrier
2050 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
2053 # Other tests are not working with OF 1.5, and message
2054 # format may change, so leave them out.
2056 # OFPT_PORT_STATUS, OFPPR_ADD
2057 ovs-vsctl add-port br0 test -- set Interface test type=dummy
2058 if test X"$1" = X"OFPPR_ADD"; then shift;
2059 echo >>expout "OFPT_PORT_STATUS (OF1.5): ADD: ${INDEX}(test): addr:aa:55:aa:55:00:0x
2062 speed: 0 Mbps now, 0 Mbps max"
2065 # OFPT_PORT_STATUS, OFPPR_MODIFY
2066 ovs-ofctl -O OpenFlow15 -vwarn mod-port br0 test up
2067 if test X"$1" = X"OFPPR_MODIFY"; then shift;
2068 echo >>expout "OFPT_PORT_STATUS (OF1.5): MOD: ${INDEX}(test): addr:aa:55:aa:55:00:0x
2071 speed: 0 Mbps now, 0 Mbps max
2072 OFPT_PORT_STATUS (OF1.5): MOD: 2(test): addr:aa:55:aa:55:00:0x
2075 speed: 0 Mbps now, 0 Mbps max"
2078 # OFPT_PORT_STATUS, OFPPR_DELETE
2079 ovs-vsctl del-port br0 test
2080 if test X"$1" = X"OFPPR_DELETE"; then shift;
2081 echo >>expout "OFPT_PORT_STATUS (OF1.5): DEL: ${INDEX}(test): addr:aa:55:aa:55:00:0x
2084 speed: 0 Mbps now, 0 Mbps max"
2087 AT_FAIL_IF([test X"$1" != X])
2089 ovs-appctl -t ovs-ofctl ofctl/barrier
2090 echo >>expout "OFPT_BARRIER_REPLY (OF1.5):"
2094 s/ (xid=0x[0-9a-fA-F]*)//
2096 s/00:0.$/00:0x/' < monitor.log]],
2100 # It's a service connection so initially there should be no async messages.
2103 # If we don't set this, async messages are not received.
2104 # Set miss_send_len to 128, turning on packet-ins for our service connection.
2105 ovs-appctl -t ovs-ofctl ofctl/send 0609000c0123456700000080
2106 check_async 2 OFPPR_ADD OFPPR_MODIFY OFPPR_DELETE
2108 # Set-async has changed in OF 1.4 and is not yet implemented.
2110 ovs-appctl -t ovs-ofctl exit
2114 dnl This test checks that the role request/response messaging works
2115 dnl and that generation_id is handled properly.
2116 AT_SETUP([ofproto - controller role (OpenFlow 1.2)])
2118 ON_EXIT([kill `cat c1.pid c2.pid`])
2120 # Start two ovs-ofctl controller processes.
2121 AT_CAPTURE_FILE([monitor1.log])
2122 AT_CAPTURE_FILE([expout1])
2123 AT_CAPTURE_FILE([experr1])
2124 AT_CAPTURE_FILE([monitor2.log])
2125 AT_CAPTURE_FILE([expout2])
2126 AT_CAPTURE_FILE([experr2])
2128 AT_CHECK([ovs-ofctl -O OpenFlow12 monitor br0 --detach --no-chdir --pidfile=`pwd`/c$i.pid --unixctl=`pwd`/c$i])
2129 ovs-appctl -t `pwd`/c$i ofctl/barrier
2130 ovs-appctl -t `pwd`/c$i ofctl/set-output-file monitor$i.log
2134 # find out current role
2135 ovs-appctl -t `pwd`/c$i ofctl/send 031800180000000200000000000000000000000000000000
2136 echo >>experr$i "send: OFPT_ROLE_REQUEST (OF1.2): role=nochange"
2137 echo >>expout$i "OFPT_ROLE_REPLY (OF1.2): role=equal"
2140 # controller 1: Become slave (generation_id is initially undefined, so
2141 # 2^63+2 should not be stale)
2142 ovs-appctl -t `pwd`/c1 ofctl/send 031800180000000300000003000000008000000000000002
2143 echo >>experr1 "send: OFPT_ROLE_REQUEST (OF1.2): role=slave generation_id=9223372036854775810"
2144 echo >>expout1 "OFPT_ROLE_REPLY (OF1.2): role=slave generation_id=9223372036854775810"
2146 # controller 2: Become master.
2147 ovs-appctl -t `pwd`/c2 ofctl/send 031800180000000300000002000000008000000000000003
2148 echo >>experr2 "send: OFPT_ROLE_REQUEST (OF1.2): role=master generation_id=9223372036854775811"
2149 echo >>expout2 "OFPT_ROLE_REPLY (OF1.2): role=master generation_id=9223372036854775811"
2151 # controller 1: Try to become the master using a stale generation ID
2152 ovs-appctl -t `pwd`/c1 ofctl/send 031800180000000400000002000000000000000000000003
2153 echo >>experr1 "send: OFPT_ROLE_REQUEST (OF1.2): role=master generation_id=3"
2154 echo >>expout1 "OFPT_ERROR (OF1.2): OFPRRFC_STALE"
2155 echo >>expout1 "OFPT_ROLE_REQUEST (OF1.2): role=master generation_id=3"
2157 # controller 1: Become master using a valid generation ID
2158 ovs-appctl -t `pwd`/c1 ofctl/send 031800180000000500000002000000000000000000000001
2159 echo >>experr1 "send: OFPT_ROLE_REQUEST (OF1.2): role=master generation_id=1"
2160 echo >>expout1 "OFPT_ROLE_REPLY (OF1.2): role=master generation_id=1"
2163 ovs-appctl -t `pwd`/c$i ofctl/barrier
2164 echo >>expout$i "OFPT_BARRIER_REPLY (OF1.2):"
2170 AT_CHECK([grep -v '^send:' monitor$i.log | STRIP_XIDS], [0], [expout])
2172 AT_CHECK([grep '^send:' monitor$i.log | STRIP_XIDS], [0], [expout])
2177 dnl This test checks that the role request/response messaging works,
2178 dnl that generation_id is handled properly, and that role status update
2179 dnl messages are sent when a controller's role gets changed from master
2181 AT_SETUP([ofproto - controller role (OpenFlow 1.4)])
2183 ON_EXIT([kill `cat c1.pid c2.pid`])
2185 # Start two ovs-ofctl controller processes.
2186 AT_CAPTURE_FILE([monitor1.log])
2187 AT_CAPTURE_FILE([expout1])
2188 AT_CAPTURE_FILE([experr1])
2189 AT_CAPTURE_FILE([monitor2.log])
2190 AT_CAPTURE_FILE([expout2])
2191 AT_CAPTURE_FILE([experr2])
2193 AT_CHECK([ovs-ofctl -O OpenFlow14 monitor br0 --detach --no-chdir --pidfile=`pwd`/c$i.pid --unixctl=`pwd`/c$i])
2194 ovs-appctl -t `pwd`/c$i ofctl/barrier
2195 ovs-appctl -t `pwd`/c$i ofctl/set-output-file monitor$i.log
2199 # find out current role
2200 ovs-appctl -t `pwd`/c$i ofctl/send 051800180000000200000000000000000000000000000000
2201 echo >>experr$i "send: OFPT_ROLE_REQUEST (OF1.4): role=nochange"
2202 echo >>expout$i "OFPT_ROLE_REPLY (OF1.4): role=equal"
2205 # controller 1: Become slave (generation_id is initially undefined, so
2206 # 2^63+2 should not be stale)
2207 ovs-appctl -t `pwd`/c1 ofctl/send 051800180000000300000003000000008000000000000002
2208 echo >>experr1 "send: OFPT_ROLE_REQUEST (OF1.4): role=slave generation_id=9223372036854775810"
2209 echo >>expout1 "OFPT_ROLE_REPLY (OF1.4): role=slave generation_id=9223372036854775810"
2211 # controller 2: Become master.
2212 ovs-appctl -t `pwd`/c2 ofctl/send 051800180000000300000002000000008000000000000003
2213 echo >>experr2 "send: OFPT_ROLE_REQUEST (OF1.4): role=master generation_id=9223372036854775811"
2214 echo >>expout2 "OFPT_ROLE_REPLY (OF1.4): role=master generation_id=9223372036854775811"
2216 # controller 1: Try to become the master using a stale generation ID
2217 ovs-appctl -t `pwd`/c1 ofctl/send 051800180000000400000002000000000000000000000003
2218 echo >>experr1 "send: OFPT_ROLE_REQUEST (OF1.4): role=master generation_id=3"
2219 echo >>expout1 "OFPT_ERROR (OF1.4): OFPRRFC_STALE"
2220 echo >>expout1 "OFPT_ROLE_REQUEST (OF1.4): role=master generation_id=3"
2222 # controller 1: Become master using a valid generation ID
2223 ovs-appctl -t `pwd`/c1 ofctl/send 051800180000000500000002000000000000000000000001
2224 echo >>experr1 "send: OFPT_ROLE_REQUEST (OF1.4): role=master generation_id=1"
2225 echo >>expout1 "OFPT_ROLE_REPLY (OF1.4): role=master generation_id=1"
2226 echo >>expout2 "OFPT_ROLE_STATUS (OF1.4): role=slave generation_id=1 reason=master_request"
2229 ovs-appctl -t `pwd`/c$i ofctl/barrier
2230 echo >>expout$i "OFPT_BARRIER_REPLY (OF1.4):"
2236 AT_CHECK([grep -v '^send:' monitor$i.log | STRIP_XIDS], [0], [expout])
2238 AT_CHECK([grep '^send:' monitor$i.log | STRIP_XIDS], [0], [expout])
2243 dnl This test checks that OFPT_PACKET_OUT accepts both OFPP_NONE (as
2244 dnl specified by OpenFlow 1.0) and OFPP_CONTROLLER (used by some
2245 dnl controllers despite the spec) as meaning a packet that was generated
2246 dnl by the controller.
2247 AT_SETUP([ofproto - packet-out from controller (OpenFlow 1.0)])
2249 ADD_OF_PORTS([br0], [1])
2251 # Start a monitor listening for packet-ins.
2252 AT_CHECK([ovs-ofctl -P openflow10 monitor br0 --detach --no-chdir --pidfile])
2253 ovs-appctl -t ovs-ofctl ofctl/send 0109000c0123456700000080
2254 ovs-appctl -t ovs-ofctl ofctl/barrier
2255 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
2256 AT_CAPTURE_FILE([monitor.log])
2258 # Send some packet-outs with OFPP_NONE and OFPP_CONTROLLER (65533) as in_port.
2259 AT_CHECK([ovs-ofctl packet-out br0 none controller,1 '0001020304050010203040501234'])
2260 AT_CHECK([ovs-ofctl packet-out br0 controller controller,1 '0001020304050010203040505678'])
2262 # Stop the monitor and check its output.
2263 ovs-appctl -t ovs-ofctl ofctl/barrier
2264 ovs-appctl -t ovs-ofctl exit
2266 ovs-ofctl dump-ports br0
2268 AT_CHECK([sed 's/ (xid=0x[[0-9a-fA-F]]*)//' monitor.log], [0], [dnl
2269 OFPT_PACKET_IN: total_len=14 in_port=ANY (via action) data_len=14 (unbuffered)
2270 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
2271 OFPT_PACKET_IN: total_len=14 in_port=CONTROLLER (via action) data_len=14 (unbuffered)
2272 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
2279 dnl This test checks that OFPT_PACKET_OUT accepts both OFPP_NONE (as
2280 dnl specified by OpenFlow 1.2) and OFPP_CONTROLLER (used by some
2281 dnl controllers despite the spec) as meaning a packet that was generated
2282 dnl by the controller.
2283 AT_SETUP([ofproto - packet-out from controller (OpenFlow 1.2)])
2286 # Start a monitor listening for packet-ins.
2287 AT_CHECK([ovs-ofctl -O OpenFlow12 monitor br0 --detach --no-chdir --pidfile])
2288 ovs-appctl -t ovs-ofctl ofctl/send 0309000c0123456700000080
2289 ovs-appctl -t ovs-ofctl ofctl/barrier
2290 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
2291 AT_CAPTURE_FILE([monitor.log])
2293 # Send some packet-outs with OFPP_NONE and OFPP_CONTROLLER (65533) as in_port.
2294 AT_CHECK([ovs-ofctl -O OpenFlow12 packet-out br0 none controller '0001020304050010203040501234'])
2295 AT_CHECK([ovs-ofctl -O OpenFlow12 packet-out br0 4294967293 controller '0001020304050010203040505678'])
2297 # Stop the monitor and check its output.
2298 ovs-appctl -t ovs-ofctl ofctl/barrier
2299 ovs-appctl -t ovs-ofctl exit
2301 AT_CHECK([sed 's/ (xid=0x[[0-9a-fA-F]]*)//' monitor.log], [0], [dnl
2302 OFPT_PACKET_IN (OF1.2): total_len=14 in_port=ANY (via action) data_len=14 (unbuffered)
2303 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
2304 OFPT_PACKET_IN (OF1.2): total_len=14 in_port=CONTROLLER (via action) data_len=14 (unbuffered)
2305 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
2306 OFPT_BARRIER_REPLY (OF1.2):
2312 dnl This test checks that OFPT_PACKET_OUT accepts both OFPP_NONE (as
2313 dnl specified by OpenFlow 1.1) and OFPP_CONTROLLER (used by some
2314 dnl controllers despite the spec) as meaning a packet that was generated
2315 dnl by the controller.
2316 AT_SETUP([ofproto - packet-out from controller (OpenFlow 1.1)])
2319 # Start a monitor listening for packet-ins.
2320 AT_CHECK([ovs-ofctl -O OpenFlow11 monitor br0 --detach --no-chdir --pidfile])
2321 ovs-appctl -t ovs-ofctl ofctl/send 0209000c0123456700000080
2322 ovs-appctl -t ovs-ofctl ofctl/barrier
2323 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
2324 AT_CAPTURE_FILE([monitor.log])
2326 # Send some packet-outs with OFPP_NONE and OFPP_CONTROLLER (65533) as in_port.
2327 AT_CHECK([ovs-ofctl -O OpenFlow11 packet-out br0 none controller '0001020304050010203040501234'])
2328 AT_CHECK([ovs-ofctl -O OpenFlow11 packet-out br0 4294967293 controller '0001020304050010203040505678'])
2330 # Stop the monitor and check its output.
2331 ovs-appctl -t ovs-ofctl ofctl/barrier
2332 ovs-appctl -t ovs-ofctl exit
2334 AT_CHECK([sed 's/ (xid=0x[[0-9a-fA-F]]*)//' monitor.log], [0], [dnl
2335 OFPT_PACKET_IN (OF1.1): total_len=14 in_port=ANY (via action) data_len=14 (unbuffered)
2336 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
2337 OFPT_PACKET_IN (OF1.1): total_len=14 in_port=CONTROLLER (via action) data_len=14 (unbuffered)
2338 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
2339 OFPT_BARRIER_REPLY (OF1.1):
2345 dnl This test checks that metadata is encoded in packet_in structures,
2346 dnl supported by NXAST.
2347 AT_SETUP([ofproto - packet-out with metadata (NXM)])
2350 # Start a monitor listening for packet-ins.
2351 AT_CHECK([ovs-ofctl -P nxm monitor br0 --detach --no-chdir --pidfile])
2352 ovs-appctl -t ovs-ofctl ofctl/send 0109000c0123456700000080
2353 ovs-appctl -t ovs-ofctl ofctl/barrier
2354 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
2355 AT_CAPTURE_FILE([monitor.log])
2357 # Send a packet-out with a load action to set some metadata, and forward to controller
2358 AT_CHECK([ovs-ofctl packet-out br0 controller 'load(0xfafafafa5a5a5a5a->OXM_OF_METADATA[[0..63]]), load(0xaa->NXM_NX_PKT_MARK[[]]), controller' '0001020304050010203040501234'])
2360 # Stop the monitor and check its output.
2361 ovs-appctl -t ovs-ofctl ofctl/barrier
2362 ovs-appctl -t ovs-ofctl exit
2364 AT_CHECK([sed 's/ (xid=0x[[0-9a-fA-F]]*)//' monitor.log], [0], [dnl
2365 NXT_PACKET_IN: total_len=14 in_port=CONTROLLER metadata=0xfafafafa5a5a5a5a pkt_mark=0xaa (via action) data_len=14 (unbuffered)
2366 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
2373 dnl This test checks that metadata is encoded in packet_in structures,
2374 dnl supported by NXAST.
2375 AT_SETUP([ofproto - packet-out with metadata (OpenFlow 1.2)])
2378 # Start a monitor listening for packet-ins.
2379 AT_CHECK([ovs-ofctl -O OpenFlow12 monitor br0 --detach --no-chdir --pidfile])
2380 ovs-appctl -t ovs-ofctl ofctl/send 0309000c0123456700000080
2381 ovs-appctl -t ovs-ofctl ofctl/barrier
2382 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
2383 AT_CAPTURE_FILE([monitor.log])
2385 # Send a packet-out with a set-field action to set some metadata, and forward to controller
2386 AT_CHECK([ovs-ofctl -O OpenFlow12 packet-out br0 none 'set_field:0xfafafafa5a5a5a5a->metadata, controller' '0001020304050010203040501234'])
2388 # Stop the monitor and check its output.
2389 ovs-appctl -t ovs-ofctl ofctl/barrier
2390 ovs-appctl -t ovs-ofctl exit
2392 AT_CHECK([sed 's/ (xid=0x[[0-9a-fA-F]]*)//' monitor.log], [0], [dnl
2393 OFPT_PACKET_IN (OF1.2): total_len=14 in_port=ANY metadata=0xfafafafa5a5a5a5a (via action) data_len=14 (unbuffered)
2394 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
2395 OFPT_BARRIER_REPLY (OF1.2):
2401 dnl This test checks that metadata is encoded in packet_in structures,
2402 dnl supported by NXAST.
2403 AT_SETUP([ofproto - packet-out with metadata and dual set_field (OpenFlow 1.3)])
2406 # Start a monitor listening for packet-ins.
2407 AT_CHECK([ovs-ofctl -O OpenFlow13 monitor br0 --detach --no-chdir --pidfile])
2408 ovs-appctl -t ovs-ofctl ofctl/send 0409000c0123456700000080
2409 ovs-appctl -t ovs-ofctl ofctl/barrier
2410 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
2411 AT_CAPTURE_FILE([monitor.log])
2413 # Send a packet-out with a couple of set-field action to set some metadata, and forward to controller
2414 AT_CHECK([ovs-ofctl -O OpenFlow13 packet-out br0 none 'set_field:0xfafafafa5a5a5a5a->metadata, set_field:0x6b->metadata, controller' '0001020304050010203040501234'])
2416 # Stop the monitor and check its output.
2417 ovs-appctl -t ovs-ofctl ofctl/barrier
2418 ovs-appctl -t ovs-ofctl exit
2420 AT_CHECK([sed 's/ (xid=0x[[0-9a-fA-F]]*)//' monitor.log], [0], [dnl
2421 OFPT_PACKET_IN (OF1.3): total_len=14 in_port=ANY metadata=0x6b (via action) data_len=14 (unbuffered)
2422 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
2423 OFPT_BARRIER_REPLY (OF1.3):
2429 dnl This test checks that tunnel metadata is encoded in packet_in structures.
2430 AT_SETUP([ofproto - packet-out with tunnel metadata (OpenFlow 1.2)])
2433 # Start a monitor listening for packet-ins.
2434 AT_CHECK([ovs-ofctl -O OpenFlow12 monitor br0 --detach --no-chdir --pidfile])
2435 ovs-appctl -t ovs-ofctl ofctl/send 0309000c0123456700000080
2436 ovs-appctl -t ovs-ofctl ofctl/barrier
2437 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
2438 AT_CAPTURE_FILE([monitor.log])
2440 # Send a packet-out with set field actions to set some tunnel metadata, and forward to controller
2441 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'])
2443 # Stop the monitor and check its output.
2444 ovs-appctl -t ovs-ofctl ofctl/barrier
2445 ovs-appctl -t ovs-ofctl exit
2447 AT_CHECK([sed 's/ (xid=0x[[0-9a-fA-F]]*)//' monitor.log], [0], [dnl
2448 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)
2449 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
2450 OFPT_BARRIER_REPLY (OF1.2):
2456 m4_divert_push([PREPARE_TESTS])
2457 # Sorts groups of lines that start with a space, without moving them
2458 # past the nearest line that does not start with a space.
2468 print $_ foreach sort(@buffer);
2473 print $_ foreach sort(@buffer);
2476 m4_divert_pop([PREPARE_TESTS])
2478 AT_SETUP([ofproto - flow monitoring])
2479 AT_KEYWORDS([monitor])
2482 ovs-ofctl add-flow br0 in_port=0,dl_vlan=123,actions=output:1
2484 # Start a monitor watching the flow table and check the initial reply.
2485 ovs-ofctl monitor br0 watch: --detach --no-chdir --pidfile >monitor.log 2>&1
2486 AT_CAPTURE_FILE([monitor.log])
2487 ovs-appctl -t ovs-ofctl ofctl/barrier
2488 AT_CHECK([sed 's/ (xid=0x[[1-9a-fA-F]][[0-9a-fA-F]]*)//' monitor.log], [0],
2489 [NXST_FLOW_MONITOR reply:
2490 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=123 actions=output:1
2494 # Add, delete, and modify some flows and check the updates.
2495 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
2496 ovs-ofctl add-flow br0 in_port=0,dl_vlan=124,actions=output:2
2497 ovs-ofctl add-flow br0 in_port=0,dl_vlan=123,actions=output:5
2498 ovs-ofctl add-flow br0 in_port=0,dl_vlan=123,dl_vlan_pcp=0,actions=output:6
2499 ovs-ofctl add-flow br0 in_port=0,dl_vlan=123,dl_vlan_pcp=1,actions=output:7
2500 ovs-ofctl add-flow br0 in_port=0,dl_vlan=123,actions=output:8
2501 ovs-ofctl add-flow br0 in_port=0,dl_vlan=65535,dl_vlan_pcp=0,actions=output:9
2502 ovs-ofctl add-flow br0 in_port=0,dl_vlan=65535,dl_vlan_pcp=1,actions=output:10
2503 ovs-ofctl add-flow br0 in_port=0,dl_vlan=65535,actions=output:11
2504 ovs-ofctl add-flow br0 in_port=0,dl_vlan=8191,dl_vlan_pcp=0,actions=output:12
2505 ovs-ofctl add-flow br0 in_port=0,dl_vlan=8191,dl_vlan_pcp=1,actions=output:13
2506 ovs-ofctl add-flow br0 in_port=0,dl_vlan=8191,actions=output:14
2507 ovs-ofctl add-flow br0 in_port=0,dl_vlan=0,dl_vlan_pcp=0,actions=output:15
2508 ovs-ofctl add-flow br0 in_port=0,dl_vlan=0,dl_vlan_pcp=1,actions=output:16
2509 ovs-ofctl add-flow br0 in_port=0,dl_vlan=0,actions=output:17
2510 ovs-ofctl add-flow br0 in_port=0,dl_vlan=0,dl_vlan_pcp=0,actions=output:18
2511 ovs-ofctl add-flow br0 in_port=0,dl_vlan=0,dl_vlan_pcp=1,actions=output:19
2512 ovs-ofctl add-flow br0 in_port=0,dl_vlan=0,actions=output:20
2513 ovs-ofctl add-flow br0 in_port=0,dl_vlan_pcp=0,actions=output:21
2514 ovs-ofctl add-flow br0 in_port=0,dl_vlan_pcp=1,actions=output:22
2515 ovs-ofctl add-flow br0 in_port=0,actions=output:23
2516 ovs-ofctl mod-flows br0 dl_vlan=123,actions=output:3
2517 ovs-ofctl mod-flows br0 cookie=5,dl_vlan=123,actions=output:3
2518 ovs-ofctl del-flows br0 dl_vlan=123
2519 ovs-ofctl del-flows br0
2520 ovs-appctl -t ovs-ofctl ofctl/barrier
2521 AT_CHECK([sed 's/ (xid=0x[[1-9a-fA-F]][[0-9a-fA-F]]*)//' monitor.log | multiline_sort], [0],
2522 [NXST_FLOW_MONITOR reply (xid=0x0):
2523 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=124 actions=output:2
2524 NXST_FLOW_MONITOR reply (xid=0x0):
2525 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=123 actions=output:5
2526 NXST_FLOW_MONITOR reply (xid=0x0):
2527 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=123,dl_vlan_pcp=0 actions=output:6
2528 NXST_FLOW_MONITOR reply (xid=0x0):
2529 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=123,dl_vlan_pcp=1 actions=output:7
2530 NXST_FLOW_MONITOR reply (xid=0x0):
2531 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=123 actions=output:8
2532 NXST_FLOW_MONITOR reply (xid=0x0):
2533 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=0,dl_vlan_pcp=0 actions=output:9
2534 NXST_FLOW_MONITOR reply (xid=0x0):
2535 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=0,dl_vlan_pcp=1 actions=output:10
2536 NXST_FLOW_MONITOR reply (xid=0x0):
2537 event=ADDED table=0 cookie=0 in_port=0,vlan_tci=0x0000 actions=output:11
2538 NXST_FLOW_MONITOR reply (xid=0x0):
2539 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=4095,dl_vlan_pcp=0 actions=output:12
2540 NXST_FLOW_MONITOR reply (xid=0x0):
2541 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=4095,dl_vlan_pcp=1 actions=output:13
2542 NXST_FLOW_MONITOR reply (xid=0x0):
2543 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=4095 actions=output:14
2544 NXST_FLOW_MONITOR reply (xid=0x0):
2545 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=0,dl_vlan_pcp=0 actions=output:15
2546 NXST_FLOW_MONITOR reply (xid=0x0):
2547 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=0,dl_vlan_pcp=1 actions=output:16
2548 NXST_FLOW_MONITOR reply (xid=0x0):
2549 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=0 actions=output:17
2550 NXST_FLOW_MONITOR reply (xid=0x0):
2551 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=0,dl_vlan_pcp=0 actions=output:18
2552 NXST_FLOW_MONITOR reply (xid=0x0):
2553 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=0,dl_vlan_pcp=1 actions=output:19
2554 NXST_FLOW_MONITOR reply (xid=0x0):
2555 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=0 actions=output:20
2556 NXST_FLOW_MONITOR reply (xid=0x0):
2557 event=ADDED table=0 cookie=0 in_port=0,dl_vlan_pcp=0 actions=output:21
2558 NXST_FLOW_MONITOR reply (xid=0x0):
2559 event=ADDED table=0 cookie=0 in_port=0,dl_vlan_pcp=1 actions=output:22
2560 NXST_FLOW_MONITOR reply (xid=0x0):
2561 event=ADDED table=0 cookie=0 in_port=0 actions=output:23
2562 NXST_FLOW_MONITOR reply (xid=0x0):
2563 event=MODIFIED table=0 cookie=0 in_port=0,dl_vlan=123 actions=output:3
2564 event=MODIFIED table=0 cookie=0 in_port=0,dl_vlan=123,dl_vlan_pcp=0 actions=output:3
2565 event=MODIFIED table=0 cookie=0 in_port=0,dl_vlan=123,dl_vlan_pcp=1 actions=output:3
2566 NXST_FLOW_MONITOR reply (xid=0x0):
2567 event=MODIFIED table=0 cookie=0x5 in_port=0,dl_vlan=123 actions=output:3
2568 event=MODIFIED table=0 cookie=0x5 in_port=0,dl_vlan=123,dl_vlan_pcp=0 actions=output:3
2569 event=MODIFIED table=0 cookie=0x5 in_port=0,dl_vlan=123,dl_vlan_pcp=1 actions=output:3
2570 NXST_FLOW_MONITOR reply (xid=0x0):
2571 event=DELETED reason=delete table=0 cookie=0x5 in_port=0,dl_vlan=123 actions=output:3
2572 event=DELETED reason=delete table=0 cookie=0x5 in_port=0,dl_vlan=123,dl_vlan_pcp=0 actions=output:3
2573 event=DELETED reason=delete table=0 cookie=0x5 in_port=0,dl_vlan=123,dl_vlan_pcp=1 actions=output:3
2574 NXST_FLOW_MONITOR reply (xid=0x0):
2575 event=DELETED reason=delete table=0 cookie=0 in_port=0 actions=output:23
2576 event=DELETED reason=delete table=0 cookie=0 in_port=0,dl_vlan=0 actions=output:20
2577 event=DELETED reason=delete table=0 cookie=0 in_port=0,dl_vlan=0,dl_vlan_pcp=0 actions=output:18
2578 event=DELETED reason=delete table=0 cookie=0 in_port=0,dl_vlan=0,dl_vlan_pcp=1 actions=output:19
2579 event=DELETED reason=delete table=0 cookie=0 in_port=0,dl_vlan=124 actions=output:2
2580 event=DELETED reason=delete table=0 cookie=0 in_port=0,dl_vlan=4095 actions=output:14
2581 event=DELETED reason=delete table=0 cookie=0 in_port=0,dl_vlan=4095,dl_vlan_pcp=0 actions=output:12
2582 event=DELETED reason=delete table=0 cookie=0 in_port=0,dl_vlan=4095,dl_vlan_pcp=1 actions=output:13
2583 event=DELETED reason=delete table=0 cookie=0 in_port=0,dl_vlan_pcp=0 actions=output:21
2584 event=DELETED reason=delete table=0 cookie=0 in_port=0,dl_vlan_pcp=1 actions=output:22
2585 event=DELETED reason=delete table=0 cookie=0 in_port=0,vlan_tci=0x0000 actions=output:11
2589 # Check that our own changes are reported as full updates.
2590 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
2591 ovs-ofctl add-flow br0 in_port=1,actions=output:2
2592 ovs-ofctl add-flow br0 in_port=2,actions=output:1
2593 ovs-appctl -t ovs-ofctl ofctl/barrier
2594 ovs-appctl -t ovs-ofctl ofctl/send 010e004812345678003fffff00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003000000000000ffffffffffff0000
2595 ovs-appctl -t ovs-ofctl ofctl/barrier
2596 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip], [0], [NXST_FLOW reply:
2598 AT_CHECK([sed 's/ (xid=0x[[1-9a-fA-F]][[0-9a-fA-F]]*)//' monitor.log | multiline_sort], [0],
2599 [NXST_FLOW_MONITOR reply (xid=0x0):
2600 event=ADDED table=0 cookie=0 in_port=1 actions=output:2
2601 NXST_FLOW_MONITOR reply (xid=0x0):
2602 event=ADDED table=0 cookie=0 in_port=2 actions=output:1
2604 send: OFPT_FLOW_MOD: DEL priority=0 actions=drop
2605 NXST_FLOW_MONITOR reply (xid=0x0):
2606 event=DELETED reason=delete table=0 cookie=0 in_port=1 actions=output:2
2607 event=DELETED reason=delete table=0 cookie=0 in_port=2 actions=output:1
2611 ovs-appctl -t ovs-ofctl exit
2615 AT_SETUP([ofproto - flow monitoring with !own])
2616 AT_KEYWORDS([monitor])
2619 ovs-ofctl add-flow br0 in_port=0,dl_vlan=123,actions=output:1
2621 # Start a monitor watching the flow table and check the initial reply.
2622 ovs-ofctl monitor br0 watch:\!own --detach --no-chdir --pidfile >monitor.log 2>&1
2623 AT_CAPTURE_FILE([monitor.log])
2624 ovs-appctl -t ovs-ofctl ofctl/barrier
2625 AT_CHECK([sed 's/ (xid=0x[[1-9a-fA-F]][[0-9a-fA-F]]*)//' monitor.log], [0],
2626 [NXST_FLOW_MONITOR reply:
2627 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=123 actions=output:1
2631 # Check that our own changes are reported as abbreviations.
2632 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
2633 ovs-ofctl add-flow br0 in_port=1,actions=output:2
2634 ovs-ofctl add-flow br0 in_port=2,actions=output:1
2635 ovs-appctl -t ovs-ofctl ofctl/barrier
2636 ovs-appctl -t ovs-ofctl ofctl/send 010e004812345678003fffff00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003000000000000ffffffffffff0000
2637 ovs-appctl -t ovs-ofctl ofctl/barrier
2638 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip], [0], [NXST_FLOW reply:
2640 AT_CHECK([sed 's/ (xid=0x[[1-9a-fA-F]][[0-9a-fA-F]]*)//' monitor.log], [0],
2641 [NXST_FLOW_MONITOR reply (xid=0x0):
2642 event=ADDED table=0 cookie=0 in_port=1 actions=output:2
2643 NXST_FLOW_MONITOR reply (xid=0x0):
2644 event=ADDED table=0 cookie=0 in_port=2 actions=output:1
2646 send: OFPT_FLOW_MOD: DEL priority=0 actions=drop
2647 NXST_FLOW_MONITOR reply (xid=0x0):
2648 event=ABBREV xid=0x12345678
2652 ovs-appctl -t ovs-ofctl exit
2656 AT_SETUP([ofproto - flow monitoring with out_port])
2657 AT_KEYWORDS([monitor])
2660 ovs-ofctl add-flow br0 in_port=0,dl_vlan=121,actions=output:1
2661 ovs-ofctl add-flow br0 in_port=0,dl_vlan=122,actions=output:1
2662 ovs-ofctl add-flow br0 in_port=0,dl_vlan=123,actions=output:2
2664 # Start a monitor watching the flow table and check the initial reply.
2665 ovs-ofctl monitor br0 watch:out_port=2 --detach --no-chdir --pidfile >monitor.log 2>&1
2666 AT_CAPTURE_FILE([monitor.log])
2667 ovs-appctl -t ovs-ofctl ofctl/barrier
2668 AT_CHECK([sed 's/ (xid=0x[[1-9a-fA-F]][[0-9a-fA-F]]*)//' monitor.log], [0],
2669 [NXST_FLOW_MONITOR reply:
2670 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=123 actions=output:2
2674 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
2676 # Add, modify flows and check the updates.
2677 ovs-ofctl mod-flows br0 dl_vlan=121,actions=drop
2678 ovs-ofctl mod-flows br0 dl_vlan=122,actions=output:1,output:2
2679 ovs-appctl -t ovs-ofctl ofctl/barrier
2681 ovs-ofctl mod-flows br0 dl_vlan=123,actions=output:1,output:2
2682 ovs-appctl -t ovs-ofctl ofctl/barrier
2684 ovs-ofctl mod-flows br0 dl_vlan=122,actions=output:1
2685 ovs-appctl -t ovs-ofctl ofctl/barrier
2686 ovs-ofctl mod-flows br0 dl_vlan=123,actions=output:2
2687 ovs-appctl -t ovs-ofctl ofctl/barrier
2689 AT_CHECK([sed 's/ (xid=0x[[1-9a-fA-F]][[0-9a-fA-F]]*)//' monitor.log], [0],
2690 [NXST_FLOW_MONITOR reply (xid=0x0):
2691 event=MODIFIED table=0 cookie=0 in_port=0,dl_vlan=122 actions=output:1,output:2
2693 NXST_FLOW_MONITOR reply (xid=0x0):
2694 event=MODIFIED table=0 cookie=0 in_port=0,dl_vlan=123 actions=output:1,output:2
2696 NXST_FLOW_MONITOR reply (xid=0x0):
2697 event=MODIFIED table=0 cookie=0 in_port=0,dl_vlan=122 actions=output:1
2699 NXST_FLOW_MONITOR reply (xid=0x0):
2700 event=MODIFIED table=0 cookie=0 in_port=0,dl_vlan=123 actions=output:2
2704 ovs-appctl -t ovs-ofctl exit
2708 AT_SETUP([ofproto - flow monitoring pause and resume])
2709 AT_KEYWORDS([monitor])
2711 # The maximum socket receive buffer size is important for this test, which
2712 # tests behavior when the receive buffer overflows.
2713 if test -e /proc/sys/net/core/rmem_max; then
2715 rmem_max=`cat /proc/sys/net/core/rmem_max`
2716 elif rmem_max=`sysctl -n net.inet.tcp.recvbuf_max 2>/dev/null`; then
2719 # Don't know how to get maximum socket receive buffer on this OS
2722 # Calculate the total amount of queuing: rmem_max in the kernel, 128 kB
2723 # in ofproto sending userspace (see ofmonitor_flush() in connmgr.c).
2724 queue_size=`expr $rmem_max + 128 \* 1024`
2725 echo rmem_max=$rmem_max queue_size=$queue_size
2727 # If there's too much queuing skip the test to avoid timing out.
2728 AT_SKIP_IF([test $rmem_max -gt 1048576])
2730 # Each flow update message takes up at least 48 bytes of space in queues
2731 # and in practice more than that.
2732 n_msgs=`expr $queue_size / 48`
2737 # Start a monitor watching the flow table, then make it block.
2738 ON_EXIT([kill `cat ovs-ofctl.pid`])
2739 ovs-ofctl monitor br0 watch: --detach --no-chdir --pidfile >monitor.log 2>&1
2740 AT_CAPTURE_FILE([monitor.log])
2741 ovs-appctl -t ovs-ofctl ofctl/block
2743 # Add $n_msgs flows.
2744 (echo "in_port=2,actions=output:2"
2746 for ($i = 0; $i < '$n_msgs'; $i++) {
2747 print "cookie=1,reg1=$i,actions=drop\n";
2750 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
2751 # Check that multipart flow dumps work properly:
2752 AT_CHECK([ovs-ofctl diff-flows br0 flows.txt])
2753 AT_CHECK([ovs-ofctl add-flow br0 in_port=1,cookie=3,actions=drop])
2754 AT_CHECK([ovs-ofctl mod-flows br0 in_port=2,cookie=2,actions=output:2])
2755 AT_CHECK([ovs-ofctl del-flows br0 cookie=1/-1])
2757 ovs-appctl -t ovs-ofctl ofctl/unblock
2759 # Wait for the connection resumed.
2760 # A barrier doesn't work for this purpose.
2761 # https://www.mail-archive.com/dev@openvswitch.org/msg27013.html
2762 # https://www.mail-archive.com/dev@openvswitch.org/msg27675.html
2763 OVS_WAIT_UNTIL([grep NXT_FLOW_MONITOR_RESUMED monitor.log])
2765 ovs-appctl -t ovs-ofctl exit
2767 # Check that the flow monitor reported the same number of flows
2768 # added and deleted, but fewer than we actually added and deleted.
2769 adds=`grep -c 'ADDED.*reg1=' monitor.log`
2770 deletes=`grep -c 'DELETED.*reg1=' monitor.log`
2771 echo adds=$adds deletes=$deletes
2772 AT_CHECK([test $adds -gt 100 && test $adds -lt $n_msgs])
2773 AT_CHECK([test $adds = $deletes])
2775 # Check that the flow monitor reported everything in the expected order:
2777 # event=ADDED table=0 cookie=0x1 reg1=0x22
2779 # NXT_FLOW_MONITOR_PAUSED:
2781 # event=DELETED reason=delete table=0 cookie=0x1 reg1=0x22
2783 # event=ADDED table=0 cookie=0x3 in_port=1
2784 # event=MODIFIED table=0 cookie=0x2 in_port=2 actions=output:2
2785 # NXT_FLOW_MONITOR_RESUMED:
2787 # except that, between the PAUSED and RESUMED, the order of the ADDED
2788 # and MODIFIED lines lines depends on hash order, that is, it varies
2789 # as we change the hash function or change architecture. Therefore,
2790 # we use a couple of tests below to accept both orders.
2791 AT_CHECK([ofctl_strip < monitor.log | sed -n -e '
2794 /NXT_FLOW_MONITOR_PAUSED:/p
2795 /NXT_FLOW_MONITOR_RESUMED:/p
2796 ' > monitor.log.subset])
2797 AT_CHECK([grep -v MODIFIED monitor.log.subset], [0], [dnl
2798 event=ADDED table=0 cookie=0x1 reg1=0x22
2799 NXT_FLOW_MONITOR_PAUSED:
2800 event=DELETED reason=delete table=0 cookie=0x1 reg1=0x22
2801 event=ADDED table=0 cookie=0x3 in_port=1
2802 NXT_FLOW_MONITOR_RESUMED:
2804 AT_CHECK([grep -v ADDED monitor.log.subset], [0], [dnl
2805 NXT_FLOW_MONITOR_PAUSED:
2806 event=DELETED reason=delete table=0 cookie=0x1 reg1=0x22
2807 event=MODIFIED table=0 cookie=0x2 in_port=2 actions=output:2
2808 NXT_FLOW_MONITOR_RESUMED:
2814 AT_SETUP([ofproto - event filtering (OpenFlow 1.3)])
2815 AT_KEYWORDS([monitor])
2818 # Start a monitor, use the required protocol version
2819 ovs-ofctl -O OpenFlow13 monitor br0 --detach --no-chdir --pidfile >monitor.log 2>&1
2820 AT_CAPTURE_FILE([monitor.log])
2822 # Send an OpenFlow13 message (04), OFPT_GET_ASYNC_REQUEST (1a), length (8), xid (0a)
2823 ovs-appctl -t ovs-ofctl ofctl/send 041a00080000000a
2824 ovs-appctl -t ovs-ofctl ofctl/barrier
2826 # Check default setting
2827 read -r -d '' expected <<'EOF'
2830 AT_CHECK([ofctl_strip < monitor.log], [], [dnl
2831 send: OFPT_GET_ASYNC_REQUEST (OF1.3):
2832 OFPT_GET_ASYNC_REPLY (OF1.3):
2834 PACKET_IN: no_match action
2835 PORT_STATUS: add delete modify
2836 FLOW_REMOVED: idle hard delete
2840 PORT_STATUS: add delete modify
2842 OFPT_BARRIER_REPLY (OF1.3):
2848 AT_SETUP([ofproto - ofport_request])
2850 ADD_OF_PORTS([br0], [1], [2], [3])
2852 set_and_check_specific_ofports () {
2853 ovs-vsctl set Interface p1 ofport_request="$1" -- \
2854 set Interface p2 ofport_request="$2" -- \
2855 set Interface p3 ofport_request="$3"
2856 ofports=`ovs-vsctl get Interface p1 ofport -- \
2857 get Interface p2 ofport -- \
2858 get Interface p3 ofport`
2859 AT_CHECK_UNQUOTED([echo $ofports], [0], [$1 $2 $3
2862 for pre in '1 2 3' '1 3 2' '2 1 3' '2 3 1' '3 1 2' '3 2 1'; do
2863 for post in '1 2 3' '1 3 2' '2 1 3' '2 3 1' '3 1 2' '3 2 1'; do
2864 echo -----------------------------------------------------------
2865 echo "Check changing port numbers from $pre to $post"
2866 set_and_check_specific_ofports $pre
2867 set_and_check_specific_ofports $post
2871 ovs-vsctl del-port p3
2873 set_and_check_poorly_specified_ofports () {
2874 ovs-vsctl set Interface p1 ofport_request="$1" -- \
2875 set Interface p2 ofport_request="$2"
2876 p1=`ovs-vsctl get Interface p1 ofport`
2877 p2=`ovs-vsctl get Interface p2 ofport`
2880 AT_CHECK([test "$p1" != "$p2"])
2881 if test "$1" = "$2" && test "$1" != '[[]]'; then
2882 # One port number must be the requested one.
2883 AT_CHECK([test "$p1" = "$1" || test "$p2" = "$1"])
2884 # The other port number must be different (already tested above).
2886 AT_CHECK([test "$1" = '[[]]' || test "$p1" == "$1"])
2887 AT_CHECK([test "$2" = '[[]]' || test "$p2" == "$2"])
2890 for pre in '1 2' '[[]] 2' '1 [[]]' '[[]] [[]]' '2 1' '[[]] 1' '2 [[]]' \
2892 for post in '1 2' '[[]] 2' '1 [[]]' '[[]] [[]]' '2 1' '[[]] 1' '2 [[]]' \
2894 echo -----------------------------------------------------------
2895 echo "Check changing port numbers from $pre to $post"
2896 set_and_check_poorly_specified_ofports $pre
2897 set_and_check_poorly_specified_ofports $post
2904 AT_SETUP([ofproto - bundles, open (OpenFlow 1.4)])
2905 AT_KEYWORDS([monitor])
2908 # Start a monitor, use the required protocol version
2909 ovs-ofctl -O OpenFlow14 monitor br0 --detach --no-chdir --pidfile >monitor.log 2>&1
2910 AT_CAPTURE_FILE([monitor.log])
2912 # Send an OpenFlow14 message (05), OFPT_BUNDLE_CONTROL (21), length (10), xid (0a)
2913 ovs-appctl -t ovs-ofctl ofctl/send "05 21 00 10 00 00 00 0a 00 00 00 01 00 00 00 01"
2914 ovs-appctl -t ovs-ofctl ofctl/barrier
2915 ovs-appctl -t ovs-ofctl exit
2917 AT_CHECK([ofctl_strip < monitor.log], [], [dnl
2918 send: OFPT_BUNDLE_CONTROL (OF1.4):
2919 bundle_id=0x1 type=OPEN_REQUEST flags=atomic
2920 OFPT_BUNDLE_CONTROL (OF1.4):
2921 bundle_id=0x1 type=OPEN_REPLY flags=0
2922 OFPT_BARRIER_REPLY (OF1.4):
2928 AT_SETUP([ofproto - bundles, double open (OpenFlow 1.4)])
2929 AT_KEYWORDS([monitor])
2932 # Start a monitor, use the required protocol version
2933 ovs-ofctl -O OpenFlow14 monitor br0 --detach --no-chdir --pidfile >monitor.log 2>&1
2934 AT_CAPTURE_FILE([monitor.log])
2936 # Send twice an OpenFlow14 message (05), OFPT_BUNDLE_CONTROL (21), length (10), xid (0a)
2937 ovs-appctl -t ovs-ofctl ofctl/send "05 21 00 10 00 00 00 0a 00 00 00 01 00 00 00 01"
2938 ovs-appctl -t ovs-ofctl ofctl/barrier
2939 ovs-appctl -t ovs-ofctl ofctl/send "05 21 00 10 00 00 00 0a 00 00 00 01 00 00 00 01"
2940 ovs-appctl -t ovs-ofctl ofctl/barrier
2941 ovs-appctl -t ovs-ofctl exit
2943 AT_CHECK([ofctl_strip < monitor.log], [0], [dnl
2944 send: OFPT_BUNDLE_CONTROL (OF1.4):
2945 bundle_id=0x1 type=OPEN_REQUEST flags=atomic
2946 OFPT_BUNDLE_CONTROL (OF1.4):
2947 bundle_id=0x1 type=OPEN_REPLY flags=0
2948 OFPT_BARRIER_REPLY (OF1.4):
2949 send: OFPT_BUNDLE_CONTROL (OF1.4):
2950 bundle_id=0x1 type=OPEN_REQUEST flags=atomic
2951 OFPT_ERROR (OF1.4): OFPBFC_BAD_ID
2952 OFPT_BUNDLE_CONTROL (OF1.4):
2953 bundle_id=0x1 type=OPEN_REQUEST flags=atomic
2954 OFPT_BARRIER_REPLY (OF1.4):
2960 AT_SETUP([ofproto - bundle close without open (OpenFlow 1.4)])
2961 AT_KEYWORDS([monitor])
2964 # Start a monitor, use the required protocol version
2965 ovs-ofctl -O OpenFlow14 monitor br0 --detach --no-chdir --pidfile >monitor.log 2>&1
2966 AT_CAPTURE_FILE([monitor.log])
2968 ovs-appctl -t ovs-ofctl ofctl/send "05 21 00 10 00 00 00 0a 00 00 00 01 00 02 00 01"
2969 ovs-appctl -t ovs-ofctl ofctl/barrier
2970 ovs-appctl -t ovs-ofctl exit
2972 AT_CHECK([ofctl_strip < monitor.log], [0], [dnl
2973 send: OFPT_BUNDLE_CONTROL (OF1.4):
2974 bundle_id=0x1 type=CLOSE_REQUEST flags=atomic
2975 OFPT_ERROR (OF1.4): OFPBFC_BAD_ID
2976 OFPT_BUNDLE_CONTROL (OF1.4):
2977 bundle_id=0x1 type=CLOSE_REQUEST flags=atomic
2978 OFPT_BARRIER_REPLY (OF1.4):
2984 AT_SETUP([ofproto - bundle double close (OpenFlow 1.4)])
2985 AT_KEYWORDS([monitor])
2988 # Start a monitor, use the required protocol version
2989 ovs-ofctl -O OpenFlow14 monitor br0 --detach --no-chdir --pidfile >monitor.log 2>&1
2990 AT_CAPTURE_FILE([monitor.log])
2992 # Open, Close, Close
2993 ovs-appctl -t ovs-ofctl ofctl/send "05 21 00 10 00 00 00 0a 00 00 00 01 00 00 00 01"
2994 ovs-appctl -t ovs-ofctl ofctl/barrier
2995 ovs-appctl -t ovs-ofctl ofctl/send "05 21 00 10 00 00 00 0a 00 00 00 01 00 02 00 01"
2996 ovs-appctl -t ovs-ofctl ofctl/barrier
2997 ovs-appctl -t ovs-ofctl ofctl/send "05 21 00 10 00 00 00 0a 00 00 00 01 00 02 00 01"
2998 ovs-appctl -t ovs-ofctl ofctl/barrier
2999 ovs-appctl -t ovs-ofctl exit
3001 AT_CHECK([ofctl_strip < monitor.log], [0], [dnl
3002 send: OFPT_BUNDLE_CONTROL (OF1.4):
3003 bundle_id=0x1 type=OPEN_REQUEST flags=atomic
3004 OFPT_BUNDLE_CONTROL (OF1.4):
3005 bundle_id=0x1 type=OPEN_REPLY flags=0
3006 OFPT_BARRIER_REPLY (OF1.4):
3007 send: OFPT_BUNDLE_CONTROL (OF1.4):
3008 bundle_id=0x1 type=CLOSE_REQUEST flags=atomic
3009 OFPT_BUNDLE_CONTROL (OF1.4):
3010 bundle_id=0x1 type=CLOSE_REPLY flags=0
3011 OFPT_BARRIER_REPLY (OF1.4):
3012 send: OFPT_BUNDLE_CONTROL (OF1.4):
3013 bundle_id=0x1 type=CLOSE_REQUEST flags=atomic
3014 OFPT_ERROR (OF1.4): OFPBFC_BUNDLE_CLOSED
3015 OFPT_BUNDLE_CONTROL (OF1.4):
3016 bundle_id=0x1 type=CLOSE_REQUEST flags=atomic
3017 OFPT_BARRIER_REPLY (OF1.4):
3023 AT_SETUP([ofproto - bundle close, different flags (OpenFlow 1.4)])
3024 AT_KEYWORDS([monitor])
3027 # Start a monitor, use the required protocol version
3028 ovs-ofctl -O OpenFlow14 monitor br0 --detach --no-chdir --pidfile >monitor.log 2>&1
3029 AT_CAPTURE_FILE([monitor.log])
3031 # Open, Close, Close
3032 ovs-appctl -t ovs-ofctl ofctl/send "05 21 00 10 00 00 00 0a 00 00 00 01 00 00 00 01"
3033 ovs-appctl -t ovs-ofctl ofctl/barrier
3034 ovs-appctl -t ovs-ofctl ofctl/send "05 21 00 10 00 00 00 0a 00 00 00 01 00 02 00 02"
3035 ovs-appctl -t ovs-ofctl ofctl/barrier
3036 ovs-appctl -t ovs-ofctl exit
3038 AT_CHECK([ofctl_strip < monitor.log], [0], [dnl
3039 send: OFPT_BUNDLE_CONTROL (OF1.4):
3040 bundle_id=0x1 type=OPEN_REQUEST flags=atomic
3041 OFPT_BUNDLE_CONTROL (OF1.4):
3042 bundle_id=0x1 type=OPEN_REPLY flags=0
3043 OFPT_BARRIER_REPLY (OF1.4):
3044 send: OFPT_BUNDLE_CONTROL (OF1.4):
3045 bundle_id=0x1 type=CLOSE_REQUEST flags=ordered
3046 OFPT_ERROR (OF1.4): OFPBFC_BAD_FLAGS
3047 OFPT_BUNDLE_CONTROL (OF1.4):
3048 bundle_id=0x1 type=CLOSE_REQUEST flags=ordered
3049 OFPT_BARRIER_REPLY (OF1.4):
3055 AT_SETUP([ofproto - bundle commit without open (OpenFlow 1.4)])
3056 AT_KEYWORDS([monitor])
3059 # Start a monitor, use the required protocol version
3060 ovs-ofctl -O OpenFlow14 monitor br0 --detach --no-chdir --pidfile >monitor.log 2>&1
3061 AT_CAPTURE_FILE([monitor.log])
3063 # Open, Close, Close
3064 ovs-appctl -t ovs-ofctl ofctl/send "05 21 00 10 00 00 00 0a 00 00 00 01 00 04 00 01"
3065 ovs-appctl -t ovs-ofctl ofctl/barrier
3066 ovs-appctl -t ovs-ofctl exit
3068 AT_CHECK([ofctl_strip < monitor.log], [0], [dnl
3069 send: OFPT_BUNDLE_CONTROL (OF1.4):
3070 bundle_id=0x1 type=COMMIT_REQUEST flags=atomic
3071 OFPT_ERROR (OF1.4): OFPBFC_BAD_ID
3072 OFPT_BUNDLE_CONTROL (OF1.4):
3073 bundle_id=0x1 type=COMMIT_REQUEST flags=atomic
3074 OFPT_BARRIER_REPLY (OF1.4):
3080 AT_SETUP([ofproto - bundle commit, different flags (OpenFlow 1.4)])
3081 AT_KEYWORDS([monitor])
3084 # Start a monitor, use the required protocol version
3085 ovs-ofctl -O OpenFlow14 monitor br0 --detach --no-chdir --pidfile >monitor.log 2>&1
3086 AT_CAPTURE_FILE([monitor.log])
3088 # Open, Close, Close
3089 ovs-appctl -t ovs-ofctl ofctl/send "05 21 00 10 00 00 00 0a 00 00 00 01 00 00 00 01"
3090 ovs-appctl -t ovs-ofctl ofctl/barrier
3091 ovs-appctl -t ovs-ofctl ofctl/send "05 21 00 10 00 00 00 0a 00 00 00 01 00 04 00 02"
3092 ovs-appctl -t ovs-ofctl ofctl/barrier
3093 ovs-appctl -t ovs-ofctl exit
3095 AT_CHECK([ofctl_strip < monitor.log], [0], [dnl
3096 send: OFPT_BUNDLE_CONTROL (OF1.4):
3097 bundle_id=0x1 type=OPEN_REQUEST flags=atomic
3098 OFPT_BUNDLE_CONTROL (OF1.4):
3099 bundle_id=0x1 type=OPEN_REPLY flags=0
3100 OFPT_BARRIER_REPLY (OF1.4):
3101 send: OFPT_BUNDLE_CONTROL (OF1.4):
3102 bundle_id=0x1 type=COMMIT_REQUEST flags=ordered
3103 OFPT_ERROR (OF1.4): OFPBFC_BAD_FLAGS
3104 OFPT_BUNDLE_CONTROL (OF1.4):
3105 bundle_id=0x1 type=COMMIT_REQUEST flags=ordered
3106 OFPT_BARRIER_REPLY (OF1.4):
3112 AT_SETUP([ofproto - bundle discard without open (OpenFlow 1.4)])
3113 AT_KEYWORDS([monitor])
3116 # Start a monitor, use the required protocol version
3117 ovs-ofctl -O OpenFlow14 monitor br0 --detach --no-chdir --pidfile >monitor.log 2>&1
3118 AT_CAPTURE_FILE([monitor.log])
3120 # Open, Close, Close
3121 ovs-appctl -t ovs-ofctl ofctl/send "05 21 00 10 00 00 00 0a 00 00 00 01 00 06 00 01"
3122 ovs-appctl -t ovs-ofctl ofctl/barrier
3123 ovs-appctl -t ovs-ofctl exit
3125 AT_CHECK([ofctl_strip < monitor.log], [0], [dnl
3126 send: OFPT_BUNDLE_CONTROL (OF1.4):
3127 bundle_id=0x1 type=DISCARD_REQUEST flags=atomic
3128 OFPT_ERROR (OF1.4): OFPBFC_BAD_ID
3129 OFPT_BUNDLE_CONTROL (OF1.4):
3130 bundle_id=0x1 type=DISCARD_REQUEST flags=atomic
3131 OFPT_BARRIER_REPLY (OF1.4):