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=bucket_id:0,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):
420 max_groups=0xffffff00
421 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
423 max_groups=0xffffff00
424 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
426 max_groups=0xffffff00
427 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
429 max_groups=0xffffff00
430 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
435 dnl This is really bare-bones.
436 dnl It at least checks request and reply serialization and deserialization.
437 AT_SETUP([ofproto - group stats (OpenFlow 1.1)])
439 AT_DATA([groups.txt], [dnl
440 group_id=1234,type=all,bucket=output:10
441 group_id=1235,type=all,bucket=output:10
443 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn add-groups br0 groups.txt])
444 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn add-flow br0 'tcp actions=group:1234'])
445 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn dump-group-stats br0 group_id=1234], [0], [stdout])
446 AT_CHECK([STRIP_XIDS stdout | sort], [0], [dnl
447 group_id=1234,ref_count=1,packet_count=0,byte_count=0,bucket0:packet_count=0,byte_count=0
448 OFPST_GROUP reply (OF1.1):
450 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn dump-group-stats br0], [0], [stdout])
451 AT_CHECK([STRIP_XIDS stdout | sort], [0], [dnl
452 group_id=1234,ref_count=1,packet_count=0,byte_count=0,bucket0:packet_count=0,byte_count=0
453 group_id=1235,ref_count=0,packet_count=0,byte_count=0,bucket0:packet_count=0,byte_count=0
454 OFPST_GROUP reply (OF1.1):
459 dnl This is really bare-bones.
460 dnl It at least checks request and reply serialization and deserialization.
461 AT_SETUP([ofproto - group stats (OpenFlow 1.3)])
463 AT_DATA([groups.txt], [dnl
464 group_id=1234,type=all,bucket=output:10
465 group_id=1235,type=all,bucket=output:10
467 AT_CHECK([ovs-ofctl -O OpenFlow13 -vwarn add-groups br0 groups.txt])
468 AT_CHECK([ovs-ofctl -O OpenFlow13 -vwarn add-flow br0 'tcp actions=group:1234'])
469 AT_CHECK([ovs-ofctl -O OpenFlow13 -vwarn dump-group-stats br0 group_id=1234], [0], [stdout])
470 AT_CHECK([STRIP_XIDS stdout | sed 's/duration=[[0-9.]]*s/duration=?s/' | sort], [0], [dnl
471 group_id=1234,duration=?s,ref_count=1,packet_count=0,byte_count=0,bucket0:packet_count=0,byte_count=0
472 OFPST_GROUP reply (OF1.3):
474 AT_CHECK([ovs-ofctl -O OpenFlow13 -vwarn dump-group-stats br0], [0], [stdout])
475 AT_CHECK([STRIP_XIDS stdout | sed 's/duration=[[0-9.]]*s/duration=?s/' | sort], [0], [dnl
476 group_id=1234,duration=?s,ref_count=1,packet_count=0,byte_count=0,bucket0:packet_count=0,byte_count=0
477 group_id=1235,duration=?s,ref_count=0,packet_count=0,byte_count=0,bucket0:packet_count=0,byte_count=0
478 OFPST_GROUP reply (OF1.3):
483 AT_SETUP([ofproto - mod-port (OpenFlow 1.0)])
485 for command_config_state in \
487 'noflood NO_FLOOD 0' \
488 'down PORT_DOWN,NO_FLOOD LINK_DOWN' \
489 'flood PORT_DOWN LINK_DOWN' \
490 'no-receive PORT_DOWN,NO_RECV LINK_DOWN' \
491 'no-forward PORT_DOWN,NO_RECV,NO_FWD LINK_DOWN' \
492 'no-packet-in PORT_DOWN,NO_RECV,NO_FWD,NO_PACKET_IN LINK_DOWN' \
493 'forward PORT_DOWN,NO_RECV,NO_PACKET_IN LINK_DOWN' \
494 'packet-in PORT_DOWN,NO_RECV LINK_DOWN' \
498 set $command_config_state
499 command=$[1] config=`echo $[2] | sed 's/,/ /g'` state=$[3]
500 AT_CHECK([ovs-ofctl -vwarn mod-port br0 br0 $command])
501 AT_CHECK([ovs-ofctl -vwarn show br0], [0], [stdout])
502 AT_CHECK_UNQUOTED([STRIP_XIDS stdout], [0], [dnl
503 OFPT_FEATURES_REPLY: dpid:fedcba9876543210
504 n_tables:254, n_buffers:256
505 capabilities: FLOW_STATS TABLE_STATS PORT_STATS QUEUE_STATS ARP_MATCH_IP
506 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
507 LOCAL(br0): addr:aa:55:aa:55:00:00
510 speed: 0 Mbps now, 0 Mbps max
511 OFPT_GET_CONFIG_REPLY: frags=normal miss_send_len=0
517 AT_SETUP([ofproto - mod-port (OpenFlow 1.2)])
519 for command_config_state in \
521 'down PORT_DOWN LINK_DOWN' \
522 'no-receive PORT_DOWN,NO_RECV LINK_DOWN' \
523 'no-forward PORT_DOWN,NO_RECV,NO_FWD LINK_DOWN' \
524 'no-packet-in PORT_DOWN,NO_RECV,NO_FWD,NO_PACKET_IN LINK_DOWN' \
525 'forward PORT_DOWN,NO_RECV,NO_PACKET_IN LINK_DOWN' \
526 'packet-in PORT_DOWN,NO_RECV LINK_DOWN' \
530 set $command_config_state
531 command=$[1] config=`echo $[2] | sed 's/,/ /g'` state=$[3]
532 AT_CHECK([ovs-ofctl -O OpenFlow12 -vwarn mod-port br0 br0 $command])
533 AT_CHECK([ovs-ofctl -O OpenFlow12 -vwarn show br0], [0], [stdout])
534 AT_CHECK_UNQUOTED([STRIP_XIDS stdout], [0], [dnl
535 OFPT_FEATURES_REPLY (OF1.2): dpid:fedcba9876543210
536 n_tables:254, n_buffers:256
537 capabilities: FLOW_STATS TABLE_STATS PORT_STATS GROUP_STATS QUEUE_STATS
538 LOCAL(br0): addr:aa:55:aa:55:00:00
541 speed: 0 Mbps now, 0 Mbps max
542 OFPT_GET_CONFIG_REPLY (OF1.2): frags=normal miss_send_len=0
548 AT_SETUP([ofproto - mod-port (OpenFlow 1.4)])
550 for command_config_state in \
552 'down PORT_DOWN LINK_DOWN' \
553 'no-receive PORT_DOWN,NO_RECV LINK_DOWN' \
554 'no-forward PORT_DOWN,NO_RECV,NO_FWD LINK_DOWN' \
555 'no-packet-in PORT_DOWN,NO_RECV,NO_FWD,NO_PACKET_IN LINK_DOWN' \
556 'forward PORT_DOWN,NO_RECV,NO_PACKET_IN LINK_DOWN' \
557 'packet-in PORT_DOWN,NO_RECV LINK_DOWN' \
561 set $command_config_state
562 command=$[1] config=`echo $[2] | sed 's/,/ /g'` state=$[3]
563 AT_CHECK([ovs-ofctl -O OpenFlow14 -vwarn mod-port br0 br0 $command])
564 AT_CHECK([ovs-ofctl -O OpenFlow14 -vwarn show br0], [0], [stdout])
565 AT_CHECK_UNQUOTED([STRIP_XIDS stdout], [0], [dnl
566 OFPT_FEATURES_REPLY (OF1.4): dpid:fedcba9876543210
567 n_tables:254, n_buffers:256
568 capabilities: FLOW_STATS TABLE_STATS PORT_STATS GROUP_STATS QUEUE_STATS
569 OFPST_PORT_DESC reply (OF1.4):
570 LOCAL(br0): addr:aa:55:aa:55:00:00
573 speed: 0 Mbps now, 0 Mbps max
574 OFPT_GET_CONFIG_REPLY (OF1.4): frags=normal miss_send_len=0
580 AT_SETUP([ofproto - basic flow_mod commands (NXM)])
582 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip], [0], [NXST_FLOW reply:
584 AT_CHECK([echo 'in_port=2,actions=1' | ovs-ofctl add-flows br0 -])
585 AT_CHECK([ovs-ofctl add-flow br0 in_port=1,actions=2])
586 AT_CHECK([ovs-ofctl -F nxm add-flow br0 table=1,in_port=4,actions=3])
587 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
588 in_port=1 actions=output:2
589 in_port=2 actions=output:1
590 table=1, in_port=4 actions=output:3
593 AT_CHECK([ovs-ofctl dump-aggregate br0 table=0 | STRIP_XIDS], [0], [dnl
594 NXST_AGGREGATE reply: packet_count=0 byte_count=0 flow_count=2
596 AT_CHECK([ovs-ofctl del-flows br0])
597 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip], [0], [NXST_FLOW reply:
602 AT_SETUP([ofproto - basic flow_mod commands (OpenFlow 1.0)])
604 AT_CHECK([ovs-ofctl -F openflow10 dump-flows br0 | ofctl_strip], [0], [OFPST_FLOW reply:
606 AT_CHECK([echo 'in_port=2,actions=1' | ovs-ofctl -F openflow10 add-flows br0 -])
607 AT_CHECK([ovs-ofctl -F openflow10 add-flow br0 in_port=1,actions=2])
608 AT_CHECK([ovs-ofctl -F openflow10 add-flow br0 table=1,in_port=4,actions=3])
609 AT_CHECK([ovs-ofctl -F openflow10 dump-flows br0 | ofctl_strip | sort], [0], [dnl
610 in_port=1 actions=output:2
611 in_port=2 actions=output:1
612 table=1, in_port=4 actions=output:3
615 AT_CHECK([ovs-ofctl -F openflow10 dump-aggregate br0 table=0 | STRIP_XIDS], [0], [dnl
616 OFPST_AGGREGATE reply: packet_count=0 byte_count=0 flow_count=2
618 AT_CHECK([ovs-ofctl -F openflow10 del-flows br0])
619 AT_CHECK([ovs-ofctl -F openflow10 dump-flows br0 | ofctl_strip], [0], [OFPST_FLOW reply:
624 AT_SETUP([ofproto - basic flow_mod commands (OpenFlow 1.1)])
626 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip], [0], [OFPST_FLOW reply (OF1.1):
628 AT_CHECK([echo 'in_port=2,actions=1' | ovs-ofctl -O OpenFlow11 add-flows br0 -])
629 AT_CHECK([ovs-ofctl -O OpenFlow11 add-flow br0 in_port=1,actions=2])
630 AT_CHECK([ovs-ofctl -O OpenFlow11 add-flow br0 table=1,in_port=4,actions=3])
631 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0], [dnl
632 in_port=1 actions=output:2
633 in_port=2 actions=output:1
634 table=1, in_port=4 actions=output:3
635 OFPST_FLOW reply (OF1.1):
637 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-aggregate br0 table=0 | STRIP_XIDS], [0], [dnl
638 OFPST_AGGREGATE reply (OF1.1): packet_count=0 byte_count=0 flow_count=2
640 AT_CHECK([ovs-ofctl -O OpenFlow11 del-flows br0])
641 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip], [0], [OFPST_FLOW reply (OF1.1):
642 table=1, in_port=4 actions=output:3
647 AT_SETUP([ofproto - flow_mod negative test (OpenFlow 1.1)])
649 [set bridge br0 protocols=OpenFlow10,OpenFlow11,OpenFlow12,OpenFlow13])
650 AT_CHECK([ovs-ofctl add-flow -O OpenFlow11 br0 table=1,action=goto_table:2])
652 # The error message here actually comes from ovs-ofctl, not from ovs-vswitchd,
653 # but at least it's the same code in ofpacts_check() that issues the error.
654 AT_CHECK([ovs-ofctl add-flow -O OpenFlow11 br0 table=1,action=goto_table:1],
656 [ovs-ofctl: actions are invalid with specified match (OFPBIC_BAD_TABLE_ID)
661 AT_SETUP([ofproto - set-field flow_mod commands (NXM)])
663 AT_CHECK([ovs-ofctl add-flow br0 ipv6,table=1,in_port=3,actions=drop])
664 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])
665 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
666 table=1, ipv6,in_port=3 actions=load:0xa6badbfffefe59fa->NXM_NX_IPV6_SRC[[0..63]],load:0xfe8001234567890a->NXM_NX_IPV6_SRC[[64..127]]
672 AT_SETUP([ofproto - basic flow_mod commands (OpenFlow 1.2)])
674 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip], [0], [OFPST_FLOW reply (OF1.2):
676 AT_CHECK([echo 'in_port=2,actions=1' | ovs-ofctl -O OpenFlow12 add-flows br0 -])
677 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 in_port=1,actions=2])
678 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 table=1,in_port=4,actions=3])
679 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
680 in_port=1 actions=output:2
681 in_port=2 actions=output:1
682 table=1, in_port=4 actions=output:3
683 OFPST_FLOW reply (OF1.2):
685 AT_CHECK([ovs-ofctl -O OpenFlow12 del-flows br0])
686 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip], [0], [OFPST_FLOW reply (OF1.2):
691 AT_SETUP([ofproto - dump flows with cookie])
693 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x1,in_port=1,actions=1])
694 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x2,in_port=2,actions=1])
695 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x3,in_port=3,actions=1])
696 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
697 cookie=0x1, in_port=1 actions=output:1
698 cookie=0x2, in_port=2 actions=output:1
699 cookie=0x3, in_port=3 actions=output:1
702 AT_CHECK([ovs-ofctl dump-aggregate br0 table=0 | STRIP_XIDS], [0], [dnl
703 NXST_AGGREGATE reply: packet_count=0 byte_count=0 flow_count=3
705 AT_CHECK([ovs-ofctl dump-flows br0 cookie=0x3/-1 | ofctl_strip | sort], [0], [dnl
706 cookie=0x3, in_port=3 actions=output:1
709 AT_CHECK([ovs-ofctl dump-aggregate br0 cookie=0x3/-1 | STRIP_XIDS], [0], [dnl
710 NXST_AGGREGATE reply: packet_count=0 byte_count=0 flow_count=1
715 AT_SETUP([ofproto - mod flow with cookie change (OpenFlow 1.0)])
717 AT_CHECK([ovs-ofctl -F openflow10 add-flow br0 cookie=0x1,in_port=1,actions=1])
718 AT_CHECK([ovs-ofctl -F openflow10 dump-flows br0 | ofctl_strip | sort], [0], [dnl
719 cookie=0x1, in_port=1 actions=output:1
723 AT_CHECK([ovs-ofctl -F openflow10 mod-flows br0 cookie=0x2,in_port=1,actions=1])
724 AT_CHECK([ovs-ofctl -F openflow10 dump-flows br0 | ofctl_strip | sort], [0], [dnl
725 cookie=0x2, in_port=1 actions=output:1
731 AT_SETUP([ofproto - mod flow with cookie change (NXM)])
733 AT_CHECK([ovs-ofctl -F nxm add-flow br0 cookie=0x1,in_port=1,actions=1])
734 AT_CHECK([ovs-ofctl -F nxm dump-flows br0 | ofctl_strip | sort], [0], [dnl
735 cookie=0x1, in_port=1 actions=output:1
739 AT_CHECK([ovs-ofctl -F nxm mod-flows br0 cookie=0x2,in_port=1,actions=1])
740 AT_CHECK([ovs-ofctl -F nxm dump-flows br0 | ofctl_strip | sort], [0], [dnl
741 cookie=0x2, in_port=1 actions=output:1
747 AT_SETUP([ofproto - no mod flow with cookie change (OpenFlow 1.1)])
749 AT_CHECK([ovs-ofctl -O OpenFlow11 add-flow br0 cookie=0x1,in_port=1,actions=1])
750 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0], [dnl
751 cookie=0x1, in_port=1 actions=output:1
752 OFPST_FLOW reply (OF1.1):
754 AT_CHECK([ovs-ofctl -O OpenFlow11 mod-flows br0 cookie=0x2,in_port=1,actions=1])
755 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0], [dnl
756 cookie=0x1, in_port=1 actions=output:1
757 OFPST_FLOW reply (OF1.1):
762 dnl The OpenFlow 1.2 spec states that the cookie may not be modified
763 AT_SETUP([ofproto - no mod flow with cookie change (OpenFlow 1.2)])
765 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 cookie=0x1,in_port=1,actions=1])
766 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
767 cookie=0x1, in_port=1 actions=output:1
768 OFPST_FLOW reply (OF1.2):
771 AT_CHECK([ovs-ofctl -O OpenFlow12 mod-flows br0 cookie=0x2,in_port=1,actions=1])
772 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
773 cookie=0x1, in_port=1 actions=output:1
774 OFPST_FLOW reply (OF1.2):
779 AT_SETUP([ofproto - mod flows based on cookie mask (OpenFlow 1.0)])
781 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x1,in_port=1,actions=1])
782 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x1,in_port=2,actions=1])
783 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x2,in_port=3,actions=1])
784 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
785 cookie=0x1, in_port=1 actions=output:1
786 cookie=0x1, in_port=2 actions=output:1
787 cookie=0x2, in_port=3 actions=output:1
791 AT_CHECK([ovs-ofctl -F nxm mod-flows br0 cookie=0x1/0xff,actions=4])
792 AT_CHECK([ovs-ofctl -F nxm dump-flows br0 | ofctl_strip | sort], [0], [dnl
793 cookie=0x1, in_port=1 actions=output:4
794 cookie=0x1, in_port=2 actions=output:4
795 cookie=0x2, in_port=3 actions=output:1
801 AT_SETUP([ofproto - mod flows based on cookie mask (OpenFlow 1.1)])
803 AT_CHECK([ovs-ofctl -O OpenFlow11 add-flow br0 cookie=0x1,in_port=1,actions=1])
804 AT_CHECK([ovs-ofctl -O OpenFlow11 add-flow br0 cookie=0x1,in_port=2,actions=1])
805 AT_CHECK([ovs-ofctl -O OpenFlow11 add-flow br0 cookie=0x2,in_port=3,actions=1])
806 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0], [dnl
807 cookie=0x1, in_port=1 actions=output:1
808 cookie=0x1, in_port=2 actions=output:1
809 cookie=0x2, in_port=3 actions=output:1
810 OFPST_FLOW reply (OF1.1):
813 AT_CHECK([ovs-ofctl -O OpenFlow11 mod-flows br0 cookie=0x1/0xff,actions=4])
814 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0], [dnl
815 cookie=0x1, in_port=1 actions=output:4
816 cookie=0x1, in_port=2 actions=output:4
817 cookie=0x2, in_port=3 actions=output:1
818 OFPST_FLOW reply (OF1.1):
823 AT_SETUP([ofproto - mod flows based on cookie mask (OpenFlow 1.2)])
825 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 cookie=0x1,in_port=1,actions=1])
826 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 cookie=0x1,in_port=2,actions=1])
827 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 cookie=0x2,in_port=3,actions=1])
828 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
829 cookie=0x1, in_port=1 actions=output:1
830 cookie=0x1, in_port=2 actions=output:1
831 cookie=0x2, in_port=3 actions=output:1
832 OFPST_FLOW reply (OF1.2):
835 AT_CHECK([ovs-ofctl -O OpenFlow12 mod-flows br0 cookie=0x1/0xff,actions=4])
836 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
837 cookie=0x1, in_port=1 actions=output:4
838 cookie=0x1, in_port=2 actions=output:4
839 cookie=0x2, in_port=3 actions=output:1
840 OFPST_FLOW reply (OF1.2):
845 dnl The OpenFlow 1.2 spec states that the cookie may not be modified
846 AT_SETUP([ofproto - mod flows based on cookie mask with cookie change])
848 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x1,in_port=1,actions=1])
849 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x1,in_port=2,actions=1])
850 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x2,in_port=3,actions=1])
851 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
852 cookie=0x1, in_port=1 actions=output:1
853 cookie=0x1, in_port=2 actions=output:1
854 cookie=0x2, in_port=3 actions=output:1
858 AT_CHECK([ovs-ofctl -F nxm mod-flows br0 cookie=1/-1,cookie=4,actions=4])
859 AT_CHECK([ovs-ofctl -F nxm dump-flows br0 | ofctl_strip | sort], [0], [dnl
860 cookie=0x2, in_port=3 actions=output:1
861 cookie=0x4, in_port=1 actions=output:4
862 cookie=0x4, in_port=2 actions=output:4
868 AT_SETUP([ofproto - mod flow with cookie miss (mask==0) - NXM])
870 AT_CHECK([ovs-ofctl -F nxm mod-flows br0 in_port=1,actions=1])
871 AT_CHECK([ovs-ofctl -F nxm dump-flows br0 | ofctl_strip | sort], [0], [dnl
872 in_port=1 actions=output:1
878 AT_SETUP([ofproto - mod flow with cookie miss (mask==0) - OF1.1])
880 AT_CHECK([ovs-ofctl -O openflow11 mod-flows br0 in_port=1,actions=1])
881 AT_CHECK([ovs-ofctl -O openflow11 dump-flows br0 | ofctl_strip | sort], [0], [dnl
882 in_port=1 actions=output:1
883 OFPST_FLOW reply (OF1.1):
888 AT_SETUP([ofproto - mod flow with cookie miss (mask==0) - OF1.2])
890 AT_CHECK([ovs-ofctl -O openflow12 mod-flows br0 in_port=1,actions=1])
891 AT_CHECK([ovs-ofctl -O openflow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
892 OFPST_FLOW reply (OF1.2):
897 AT_SETUP([ofproto - mod flow with cookie miss (mask!=0) - NXM])
899 AT_CHECK([ovs-ofctl -F nxm mod-flows br0 cookie=1/1,in_port=1,actions=1])
900 AT_CHECK([ovs-ofctl -F nxm dump-flows br0 | ofctl_strip | sort], [0], [dnl
906 AT_SETUP([ofproto - mod flow with cookie miss (mask!=0) - OF1.1])
908 AT_CHECK([ovs-ofctl -O openflow11 mod-flows br0 cookie=1/1,in_port=1,actions=1])
909 AT_CHECK([ovs-ofctl -O openflow11 dump-flows br0 | ofctl_strip | sort], [0], [dnl
910 OFPST_FLOW reply (OF1.1):
915 AT_SETUP([ofproto - mod flow with cookie miss (mask!=0) - OF1.2])
917 AT_CHECK([ovs-ofctl -O openflow12 mod-flows br0 cookie=1/1,in_port=1,actions=1])
918 AT_CHECK([ovs-ofctl -O openflow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
919 OFPST_FLOW reply (OF1.2):
924 AT_SETUP([ofproto - del flows with cookies])
926 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x1,in_port=1,actions=1])
927 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x2,in_port=2,actions=1])
928 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x3,in_port=3,actions=1])
929 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
930 cookie=0x1, in_port=1 actions=output:1
931 cookie=0x2, in_port=2 actions=output:1
932 cookie=0x3, in_port=3 actions=output:1
936 AT_CHECK([ovs-ofctl del-flows br0])
937 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
943 AT_SETUP([ofproto - del flows based on cookie])
945 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x1,in_port=1,actions=1])
946 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x2,in_port=2,actions=1])
947 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x3,in_port=3,actions=1])
948 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
949 cookie=0x1, in_port=1 actions=output:1
950 cookie=0x2, in_port=2 actions=output:1
951 cookie=0x3, in_port=3 actions=output:1
955 AT_CHECK([ovs-ofctl del-flows br0 cookie=0x3/-1])
956 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
957 cookie=0x1, in_port=1 actions=output:1
958 cookie=0x2, in_port=2 actions=output:1
964 AT_SETUP([ofproto - del flows based on cookie mask])
966 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x1,in_port=1,actions=1])
967 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x2,in_port=2,actions=1])
968 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x3,in_port=3,actions=1])
969 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
970 cookie=0x1, in_port=1 actions=output:1
971 cookie=0x2, in_port=2 actions=output:1
972 cookie=0x3, in_port=3 actions=output:1
975 AT_CHECK([ovs-ofctl del-flows br0 cookie=0x3/0x1])
976 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
977 cookie=0x2, in_port=2 actions=output:1
983 AT_SETUP([ofproto - del flows based on table id (NXM)])
985 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x1,in_port=1,actions=1])
986 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x2,in_port=2,table=1,actions=1])
987 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
988 cookie=0x1, in_port=1 actions=output:1
989 cookie=0x2, table=1, in_port=2 actions=output:1
992 AT_CHECK([ovs-ofctl del-flows br0 table=0])
993 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
994 cookie=0x2, table=1, in_port=2 actions=output:1
997 AT_CHECK([ovs-ofctl del-flows br0 table=1])
998 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1001 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x1,in_port=1,actions=1])
1002 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x2,in_port=2,table=1,actions=1])
1003 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1004 cookie=0x1, in_port=1 actions=output:1
1005 cookie=0x2, table=1, in_port=2 actions=output:1
1008 AT_CHECK([ovs-ofctl del-flows br0])
1009 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1015 AT_SETUP([ofproto - del flows based on table id (OpenFlow 1.1)])
1017 AT_CHECK([ovs-ofctl -O OpenFlow11 add-flow br0 cookie=0x1,in_port=1,actions=1])
1018 AT_CHECK([ovs-ofctl -O OpenFlow11 add-flow br0 cookie=0x2,in_port=2,table=1,actions=1])
1019 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1020 cookie=0x1, in_port=1 actions=output:1
1021 cookie=0x2, table=1, in_port=2 actions=output:1
1022 OFPST_FLOW reply (OF1.1):
1024 AT_CHECK([ovs-ofctl -O OpenFlow11 del-flows br0 table=0])
1025 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1026 cookie=0x2, table=1, in_port=2 actions=output:1
1027 OFPST_FLOW reply (OF1.1):
1029 AT_CHECK([ovs-ofctl -O OpenFlow11 del-flows br0 table=1])
1030 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1031 OFPST_FLOW reply (OF1.1):
1033 AT_CHECK([ovs-ofctl -O OpenFlow11 add-flow br0 cookie=0x1,in_port=1,actions=1])
1034 AT_CHECK([ovs-ofctl -O OpenFlow11 add-flow br0 cookie=0x2,in_port=2,table=1,actions=1])
1035 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1036 cookie=0x1, in_port=1 actions=output:1
1037 cookie=0x2, table=1, in_port=2 actions=output:1
1038 OFPST_FLOW reply (OF1.1):
1040 AT_CHECK([ovs-ofctl -O OpenFlow11 del-flows br0])
1041 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip], [0], [dnl
1042 OFPST_FLOW reply (OF1.1):
1043 cookie=0x2, table=1, in_port=2 actions=output:1
1048 AT_SETUP([ofproto - del flows based on table id (OpenFlow 1.2)])
1050 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 cookie=0x1,in_port=1,actions=1])
1051 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 cookie=0x2,in_port=2,table=1,actions=1])
1052 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1053 cookie=0x1, in_port=1 actions=output:1
1054 cookie=0x2, table=1, in_port=2 actions=output:1
1055 OFPST_FLOW reply (OF1.2):
1057 AT_CHECK([ovs-ofctl -O OpenFlow12 del-flows br0 table=0])
1058 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1059 cookie=0x2, table=1, in_port=2 actions=output:1
1060 OFPST_FLOW reply (OF1.2):
1062 AT_CHECK([ovs-ofctl -O OpenFlow12 del-flows br0 table=1])
1063 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1064 OFPST_FLOW reply (OF1.2):
1066 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 cookie=0x1,in_port=1,actions=1])
1067 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 cookie=0x2,in_port=2,table=1,actions=1])
1068 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1069 cookie=0x1, in_port=1 actions=output:1
1070 cookie=0x2, table=1, in_port=2 actions=output:1
1071 OFPST_FLOW reply (OF1.2):
1073 AT_CHECK([ovs-ofctl -O OpenFlow12 del-flows br0])
1074 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1075 OFPST_FLOW reply (OF1.2):
1080 AT_SETUP([ofproto - flow table configuration (OpenFlow 1.0)])
1082 # Check the default configuration.
1083 (printf "OFPST_TABLE reply (xid=0x2):"
1086 while test $x -lt 254; do
1089 active=0, lookup=0, matched=0
1092 in_port: exact match or wildcard
1093 eth_src: exact match or wildcard
1094 eth_dst: exact match or wildcard
1095 eth_type: exact match or wildcard
1096 vlan_vid: exact match or wildcard
1097 vlan_pcp: exact match or wildcard
1098 ip_src: exact match or wildcard
1099 ip_dst: exact match or wildcard
1100 nw_proto: exact match or wildcard
1101 nw_tos: exact match or wildcard
1102 tcp_src: exact match or wildcard
1103 tcp_dst: exact match or wildcard
1108 AT_CHECK([ovs-ofctl dump-tables br0], [0], [expout])
1109 # Change the configuration.
1112 -- --id=@t0 create Flow_Table name=main \
1113 -- --id=@t1 create Flow_Table flow-limit=1024 \
1114 -- set bridge br0 'flow_tables={1=@t1,0=@t0}' \
1115 | ${PERL} $srcdir/uuidfilt.pl],
1119 # Check that the configuration was updated.
1120 mv expout orig-expout
1121 sed -e 's/classifier/main/
1122 21s/1000000/1024/' orig-expout > expout
1123 AT_CHECK([ovs-ofctl dump-tables br0], [0], [expout])
1127 AT_SETUP([ofproto - flow table configuration (OpenFlow 1.2)])
1129 # Check the default configuration.
1130 (printf "OFPST_TABLE reply (OF1.2) (xid=0x2):"
1133 while test $x -lt 254; do
1135 table $x (\"$name\"):
1136 active=0, lookup=0, matched=0
1137 metadata: match=0xffffffffffffffff write=0xffffffffffffffff
1140 instructions (table miss and others):
1141 instructions: apply_actions,clear_actions,write_actions,write_metadata,goto_table
1142 Write-Actions and Apply-Actions features:
1143 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
1144 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
1146 metadata: exact match or wildcard
1147 in_port_oxm: exact match or wildcard
1148 eth_src: exact match or wildcard
1149 eth_dst: exact match or wildcard
1150 eth_type: exact match or wildcard
1151 vlan_vid: exact match or wildcard
1152 vlan_pcp: exact match or wildcard
1153 mpls_label: exact match or wildcard
1154 mpls_tc: exact match or wildcard
1155 ip_src: exact match or wildcard
1156 ip_dst: exact match or wildcard
1157 ipv6_src: exact match or wildcard
1158 ipv6_dst: exact match or wildcard
1159 ipv6_label: exact match or wildcard
1160 nw_proto: exact match or wildcard
1161 ip_dscp: exact match or wildcard
1162 nw_ecn: exact match or wildcard
1163 arp_op: exact match or wildcard
1164 arp_spa: exact match or wildcard
1165 arp_tpa: exact match or wildcard
1166 arp_sha: exact match or wildcard
1167 arp_tha: exact match or wildcard
1168 tcp_src: exact match or wildcard
1169 tcp_dst: exact match or wildcard
1170 udp_src: exact match or wildcard
1171 udp_dst: exact match or wildcard
1172 sctp_src: exact match or wildcard
1173 sctp_dst: exact match or wildcard
1174 icmp_type: exact match or wildcard
1175 icmp_code: exact match or wildcard
1176 icmpv6_type: exact match or wildcard
1177 icmpv6_code: exact match or wildcard
1178 nd_target: exact match or wildcard
1179 nd_sll: exact match or wildcard
1180 nd_tll: exact match or wildcard"
1184 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-tables br0], [0], [expout])
1185 # Change the configuration.
1188 -- --id=@t0 create Flow_Table name=main \
1189 -- --id=@t1 create Flow_Table flow-limit=1024 \
1190 -- set bridge br0 'flow_tables={1=@t1,0=@t0}' \
1191 | ${PERL} $srcdir/uuidfilt.pl],
1195 # Check that the configuration was updated.
1196 mv expout orig-expout
1197 sed 's/classifier/main/
1198 53s/1000000/1024/' < orig-expout > expout
1199 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-tables br0], [0], [expout])
1203 AT_SETUP([ofproto - table features (OpenFlow 1.3)])
1207 while test $x -lt 254; do
1209 if test $x = 253; then
1214 echo " table $x (\"$name\"):
1215 metadata: match=0xffffffffffffffff write=0xffffffffffffffff
1217 instructions (table miss and others):
1219 instructions: meter,apply_actions,clear_actions,write_actions,write_metadata,goto_table
1220 Write-Actions and Apply-Actions features:
1221 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
1222 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
1224 dp_hash: arbitrary mask
1225 recirc_id: exact match or wildcard
1226 tun_id: arbitrary mask
1227 tun_src: arbitrary mask
1228 tun_dst: arbitrary mask
1229 metadata: arbitrary mask
1230 in_port: exact match or wildcard
1231 in_port_oxm: exact match or wildcard
1232 actset_output: exact match or wildcard
1233 pkt_mark: arbitrary mask
1234 reg0: arbitrary mask
1235 reg1: arbitrary mask
1236 reg2: arbitrary mask
1237 reg3: arbitrary mask
1238 reg4: arbitrary mask
1239 reg5: arbitrary mask
1240 reg6: arbitrary mask
1241 reg7: arbitrary mask
1242 xreg0: arbitrary mask
1243 xreg1: arbitrary mask
1244 xreg2: arbitrary mask
1245 xreg3: arbitrary mask
1246 eth_src: arbitrary mask
1247 eth_dst: arbitrary mask
1248 eth_type: exact match or wildcard
1249 vlan_tci: arbitrary mask
1250 vlan_vid: arbitrary mask
1251 vlan_pcp: exact match or wildcard
1252 mpls_label: exact match or wildcard
1253 mpls_tc: exact match or wildcard
1254 mpls_bos: exact match or wildcard
1255 ip_src: arbitrary mask
1256 ip_dst: arbitrary mask
1257 ipv6_src: arbitrary mask
1258 ipv6_dst: arbitrary mask
1259 ipv6_label: arbitrary mask
1260 nw_proto: exact match or wildcard
1261 nw_tos: exact match or wildcard
1262 ip_dscp: exact match or wildcard
1263 nw_ecn: exact match or wildcard
1264 nw_ttl: exact match or wildcard
1265 ip_frag: arbitrary mask
1266 arp_op: exact match or wildcard
1267 arp_spa: arbitrary mask
1268 arp_tpa: arbitrary mask
1269 arp_sha: arbitrary mask
1270 arp_tha: arbitrary mask
1271 tcp_src: arbitrary mask
1272 tcp_dst: arbitrary mask
1273 tcp_flags: arbitrary mask
1274 udp_src: arbitrary mask
1275 udp_dst: arbitrary mask
1276 sctp_src: arbitrary mask
1277 sctp_dst: arbitrary mask
1278 icmp_type: exact match or wildcard
1279 icmp_code: exact match or wildcard
1280 icmpv6_type: exact match or wildcard
1281 icmpv6_code: exact match or wildcard
1282 nd_target: arbitrary mask
1283 nd_sll: arbitrary mask
1284 nd_tll: arbitrary mask"
1288 AT_CHECK([ovs-ofctl -O OpenFlow13 dump-table-features br0 | sed '/^$/d
1289 /^OFPST_TABLE_FEATURES/d'], [0], [expout])
1290 # Change the configuration.
1293 -- --id=@t0 create Flow_Table name=main \
1294 -- --id=@t1 create Flow_Table flow-limit=1024 \
1295 -- set bridge br0 'flow_tables={1=@t1,0=@t0}' \
1296 | ${PERL} $srcdir/uuidfilt.pl],
1300 # Check that the configuration was updated.
1301 mv expout orig-expout
1302 sed 's/classifier/main/
1303 74s/1000000/1024/' < orig-expout > expout
1304 AT_CHECK([ovs-ofctl -O OpenFlow13 dump-table-features br0 | sed '/^$/d
1305 /^OFPST_TABLE_FEATURES/d'], [0], [expout])
1309 AT_SETUP([ofproto - hard limits on flow table size (OpenFlow 1.0)])
1311 # Configure a maximum of 4 flows.
1314 -- --id=@t0 create Flow_Table flow-limit=4 \
1315 -- set bridge br0 flow_tables:0=@t0 \
1316 | ${PERL} $srcdir/uuidfilt.pl],
1320 for in_port in 1 2 3 4; do
1321 ovs-ofctl add-flow br0 in_port=$in_port,actions=drop
1323 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1324 in_port=1 actions=drop
1325 in_port=2 actions=drop
1326 in_port=3 actions=drop
1327 in_port=4 actions=drop
1330 # Adding another flow will be refused.
1331 AT_CHECK([ovs-ofctl add-flow br0 in_port=5,actions=drop], [1], [], [stderr])
1332 AT_CHECK([head -n 1 stderr | ofctl_strip], [0],
1333 [OFPT_ERROR: OFPFMFC_TABLE_FULL
1335 # Also a mod-flow that would add a flow will be refused.
1336 AT_CHECK([ovs-ofctl mod-flows br0 in_port=5,actions=drop], [1], [], [stderr])
1337 AT_CHECK([head -n 1 stderr | ofctl_strip], [0],
1338 [OFPT_ERROR: OFPFMFC_TABLE_FULL
1340 # Replacing or modifying an existing flow is allowed.
1341 AT_CHECK([ovs-ofctl add-flow br0 in_port=4,actions=normal])
1342 AT_CHECK([ovs-ofctl mod-flows br0 in_port=3,actions=output:1])
1343 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1344 in_port=1 actions=drop
1345 in_port=2 actions=drop
1346 in_port=3 actions=output:1
1347 in_port=4 actions=NORMAL
1353 AT_SETUP([ofproto - hard limits on flow table size (OpenFlow 1.2)])
1355 # Configure a maximum of 4 flows.
1358 -- --id=@t0 create Flow_Table flow-limit=4 \
1359 -- set bridge br0 flow_tables:0=@t0 \
1360 | ${PERL} $srcdir/uuidfilt.pl],
1364 for in_port in 1 2 3 4; do
1365 ovs-ofctl -O OpenFlow12 add-flow br0 in_port=$in_port,actions=drop
1367 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1368 in_port=1 actions=drop
1369 in_port=2 actions=drop
1370 in_port=3 actions=drop
1371 in_port=4 actions=drop
1372 OFPST_FLOW reply (OF1.2):
1374 # Adding another flow will be refused.
1375 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 in_port=5,actions=drop], [1], [], [stderr])
1376 AT_CHECK([head -n 1 stderr | ofctl_strip], [0],
1377 [OFPT_ERROR (OF1.2): OFPFMFC_TABLE_FULL
1379 # Replacing or modifying an existing flow is allowed.
1380 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 in_port=4,actions=normal])
1381 AT_CHECK([ovs-ofctl -O OpenFlow12 mod-flows br0 in_port=3,actions=output:1])
1382 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1383 in_port=1 actions=drop
1384 in_port=2 actions=drop
1385 in_port=3 actions=output:1
1386 in_port=4 actions=NORMAL
1387 OFPST_FLOW reply (OF1.2):
1392 AT_SETUP([ofproto - eviction upon table overflow (OpenFlow 1.0)])
1394 # Configure a maximum of 4 flows.
1397 -- --id=@t0 create Flow_Table flow-limit=4 overflow-policy=evict \
1398 -- set bridge br0 flow_tables:0=@t0 \
1399 | ${PERL} $srcdir/uuidfilt.pl],
1403 for in_port in 4 3 2 1; do
1404 ovs-ofctl add-flow br0 idle_timeout=${in_port}0,in_port=$in_port,actions=drop
1406 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1407 idle_timeout=10, in_port=1 actions=drop
1408 idle_timeout=20, in_port=2 actions=drop
1409 idle_timeout=30, in_port=3 actions=drop
1410 idle_timeout=40, in_port=4 actions=drop
1413 # Adding another flow will cause the one that expires soonest to be evicted.
1414 AT_CHECK([ovs-ofctl add-flow br0 in_port=5,actions=drop])
1415 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1416 idle_timeout=20, in_port=2 actions=drop
1417 idle_timeout=30, in_port=3 actions=drop
1418 idle_timeout=40, in_port=4 actions=drop
1419 in_port=5 actions=drop
1422 # A mod-flow that adds a flow also causes eviction, but replacing or
1423 # modifying an existing flow doesn't.
1424 AT_CHECK([ovs-ofctl mod-flows br0 in_port=6,actions=drop])
1425 AT_CHECK([ovs-ofctl add-flow br0 in_port=4,actions=normal])
1426 AT_CHECK([ovs-ofctl mod-flows br0 in_port=3,actions=output:1])
1427 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1428 idle_timeout=30, in_port=3 actions=output:1
1429 in_port=4 actions=NORMAL
1430 in_port=5 actions=drop
1431 in_port=6 actions=drop
1434 # Flows with no timeouts at all cannot be evicted.
1435 AT_CHECK([ovs-ofctl add-flow br0 in_port=7,actions=normal])
1436 AT_CHECK([ovs-ofctl add-flow br0 in_port=8,actions=drop], [1], [], [stderr])
1437 AT_CHECK([head -n 1 stderr | ofctl_strip], [0],
1438 [OFPT_ERROR: OFPFMFC_TABLE_FULL
1440 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1441 in_port=4 actions=NORMAL
1442 in_port=5 actions=drop
1443 in_port=6 actions=drop
1444 in_port=7 actions=NORMAL
1450 AT_SETUP([ofproto - eviction upon table overflow (OpenFlow 1.2)])
1452 # Configure a maximum of 4 flows.
1455 -- --id=@t0 create Flow_Table flow-limit=4 overflow-policy=evict \
1456 -- set bridge br0 flow_tables:0=@t0 \
1457 | ${PERL} $srcdir/uuidfilt.pl],
1461 for in_port in 4 3 2 1; do
1462 ovs-ofctl -O OpenFlow12 add-flow br0 idle_timeout=${in_port}0,in_port=$in_port,actions=drop
1464 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1465 idle_timeout=10, in_port=1 actions=drop
1466 idle_timeout=20, in_port=2 actions=drop
1467 idle_timeout=30, in_port=3 actions=drop
1468 idle_timeout=40, in_port=4 actions=drop
1469 OFPST_FLOW reply (OF1.2):
1471 # Adding another flow will cause the one that expires soonest to be evicted.
1472 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 in_port=5,actions=drop])
1473 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1474 idle_timeout=20, in_port=2 actions=drop
1475 idle_timeout=30, in_port=3 actions=drop
1476 idle_timeout=40, in_port=4 actions=drop
1477 in_port=5 actions=drop
1478 OFPST_FLOW reply (OF1.2):
1480 # In Open Flow 1.2 a mod-flow does not ever add a flow and thus
1481 # has no effect on eviction
1482 AT_CHECK([ovs-ofctl -O OpenFlow12 mod-flows br0 in_port=6,actions=drop])
1483 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 in_port=4,actions=normal])
1484 AT_CHECK([ovs-ofctl -O OpenFlow12 mod-flows br0 in_port=3,actions=output:1])
1485 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1486 idle_timeout=20, in_port=2 actions=drop
1487 idle_timeout=30, in_port=3 actions=output:1
1488 in_port=4 actions=NORMAL
1489 in_port=5 actions=drop
1490 OFPST_FLOW reply (OF1.2):
1492 # Flows with no timeouts at all cannot be evicted.
1493 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 in_port=6,actions=drop])
1494 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 in_port=7,actions=normal])
1495 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 in_port=8,actions=drop], [1], [], [stderr])
1496 AT_CHECK([head -n 1 stderr | ofctl_strip], [0],
1497 [OFPT_ERROR (OF1.2): OFPFMFC_TABLE_FULL
1499 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1500 in_port=4 actions=NORMAL
1501 in_port=5 actions=drop
1502 in_port=6 actions=drop
1503 in_port=7 actions=NORMAL
1504 OFPST_FLOW reply (OF1.2):
1509 AT_SETUP([ofproto - eviction upon table overflow, with fairness (OpenFlow 1.0)])
1511 # Configure a maximum of 4 flows.
1514 -- --id=@t0 create Flow_Table name=evict flow-limit=4 \
1515 overflow-policy=evict \
1516 groups='"NXM_OF_IN_PORT[[]]"' \
1517 -- set bridge br0 flow_tables:0=@t0 \
1518 | ${PERL} $srcdir/uuidfilt.pl],
1522 ovs-ofctl add-flows br0 - <<EOF
1523 idle_timeout=10 in_port=2 dl_src=00:44:55:66:77:88 actions=drop
1524 idle_timeout=20 in_port=1 dl_src=00:11:22:33:44:55 actions=drop
1525 idle_timeout=30 in_port=1 dl_src=00:22:33:44:55:66 actions=drop
1526 idle_timeout=40 in_port=1 dl_src=00:33:44:55:66:77 actions=drop
1528 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1529 idle_timeout=10, in_port=2,dl_src=00:44:55:66:77:88 actions=drop
1530 idle_timeout=20, in_port=1,dl_src=00:11:22:33:44:55 actions=drop
1531 idle_timeout=30, in_port=1,dl_src=00:22:33:44:55:66 actions=drop
1532 idle_timeout=40, in_port=1,dl_src=00:33:44:55:66:77 actions=drop
1535 # Adding another flow will cause the one that expires soonest within
1536 # the largest group (those with in_port=1) to be evicted. In this
1537 # case this is not the same as the one that expires soonest overall
1538 # (which is what makes the test interesting):
1539 AT_CHECK([ovs-ofctl add-flow br0 in_port=2,dl_src=00:55:66:77:88:99,actions=drop])
1540 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1541 idle_timeout=10, in_port=2,dl_src=00:44:55:66:77:88 actions=drop
1542 idle_timeout=30, in_port=1,dl_src=00:22:33:44:55:66 actions=drop
1543 idle_timeout=40, in_port=1,dl_src=00:33:44:55:66:77 actions=drop
1544 in_port=2,dl_src=00:55:66:77:88:99 actions=drop
1547 # Enlarge the flow limit, change the eviction policy back to strictly
1548 # based on expiration, and and add some flows.
1549 AT_CHECK([ovs-vsctl set Flow_Table evict groups='[[]]' flow-limit=7])
1550 ovs-ofctl add-flows br0 - <<EOF
1551 idle_timeout=50 in_port=2 dl_src=00:66:77:88:99:aa actions=drop
1552 idle_timeout=60 in_port=2 dl_src=00:77:88:99:aa:bb actions=drop
1553 idle_timeout=70 in_port=2 dl_src=00:88:99:aa:bb:cc actions=drop
1555 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1556 idle_timeout=10, in_port=2,dl_src=00:44:55:66:77:88 actions=drop
1557 idle_timeout=30, in_port=1,dl_src=00:22:33:44:55:66 actions=drop
1558 idle_timeout=40, in_port=1,dl_src=00:33:44:55:66:77 actions=drop
1559 idle_timeout=50, in_port=2,dl_src=00:66:77:88:99:aa actions=drop
1560 idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=drop
1561 idle_timeout=70, in_port=2,dl_src=00:88:99:aa:bb:cc actions=drop
1562 in_port=2,dl_src=00:55:66:77:88:99 actions=drop
1565 # Adding another flow will cause the one that expires soonest overall
1567 AT_CHECK([ovs-ofctl add-flow br0 'idle_timeout=80 in_port=2 dl_src=00:99:aa:bb:cc:dd actions=drop'])
1568 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1569 idle_timeout=30, in_port=1,dl_src=00:22:33:44:55:66 actions=drop
1570 idle_timeout=40, in_port=1,dl_src=00:33:44:55:66:77 actions=drop
1571 idle_timeout=50, in_port=2,dl_src=00:66:77:88:99:aa actions=drop
1572 idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=drop
1573 idle_timeout=70, in_port=2,dl_src=00:88:99:aa:bb:cc actions=drop
1574 idle_timeout=80, in_port=2,dl_src=00:99:aa:bb:cc:dd actions=drop
1575 in_port=2,dl_src=00:55:66:77:88:99 actions=drop
1578 # Reducing the flow limit also causes the flows that expire soonest
1579 # overall to be evicted.
1580 AT_CHECK([ovs-vsctl set Flow_Table evict flow-limit=4])
1581 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1582 idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=drop
1583 idle_timeout=70, in_port=2,dl_src=00:88:99:aa:bb:cc actions=drop
1584 idle_timeout=80, in_port=2,dl_src=00:99:aa:bb:cc:dd actions=drop
1585 in_port=2,dl_src=00:55:66:77:88:99 actions=drop
1591 AT_SETUP([ofproto - eviction upon table overflow, with fairness (OpenFlow 1.2)])
1593 # Configure a maximum of 4 flows.
1596 -- --id=@t0 create Flow_Table name=evict flow-limit=4 \
1597 overflow-policy=evict \
1598 groups='"NXM_OF_IN_PORT[[]]"' \
1599 -- set bridge br0 flow_tables:0=@t0 \
1600 | ${PERL} $srcdir/uuidfilt.pl],
1604 ovs-ofctl -O OpenFlow12 add-flows br0 - <<EOF
1605 idle_timeout=10 in_port=2 dl_src=00:44:55:66:77:88 actions=drop
1606 idle_timeout=20 in_port=1 dl_src=00:11:22:33:44:55 actions=drop
1607 idle_timeout=30 in_port=1 dl_src=00:22:33:44:55:66 actions=drop
1608 idle_timeout=40 in_port=1 dl_src=00:33:44:55:66:77 actions=drop
1610 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1611 idle_timeout=10, in_port=2,dl_src=00:44:55:66:77:88 actions=drop
1612 idle_timeout=20, in_port=1,dl_src=00:11:22:33:44:55 actions=drop
1613 idle_timeout=30, in_port=1,dl_src=00:22:33:44:55:66 actions=drop
1614 idle_timeout=40, in_port=1,dl_src=00:33:44:55:66:77 actions=drop
1615 OFPST_FLOW reply (OF1.2):
1617 # Adding another flow will cause the one that expires soonest within
1618 # the largest group (those with in_port=1) to be evicted. In this
1619 # case this is not the same as the one that expires soonest overall
1620 # (which is what makes the test interesting):
1621 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 in_port=2,dl_src=00:55:66:77:88:99,actions=drop])
1622 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1623 idle_timeout=10, in_port=2,dl_src=00:44:55:66:77:88 actions=drop
1624 idle_timeout=30, in_port=1,dl_src=00:22:33:44:55:66 actions=drop
1625 idle_timeout=40, in_port=1,dl_src=00:33:44:55:66:77 actions=drop
1626 in_port=2,dl_src=00:55:66:77:88:99 actions=drop
1627 OFPST_FLOW reply (OF1.2):
1629 # Enlarge the flow limit, change the eviction policy back to strictly
1630 # based on expiration, and and add some flows.
1631 AT_CHECK([ovs-vsctl set Flow_Table evict groups='[[]]' flow-limit=7])
1632 ovs-ofctl -O OpenFlow12 add-flows br0 - <<EOF
1633 idle_timeout=50 in_port=2 dl_src=00:66:77:88:99:aa actions=drop
1634 idle_timeout=60 in_port=2 dl_src=00:77:88:99:aa:bb actions=drop
1635 idle_timeout=70 in_port=2 dl_src=00:88:99:aa:bb:cc actions=drop
1637 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1638 idle_timeout=10, in_port=2,dl_src=00:44:55:66:77:88 actions=drop
1639 idle_timeout=30, in_port=1,dl_src=00:22:33:44:55:66 actions=drop
1640 idle_timeout=40, in_port=1,dl_src=00:33:44:55:66:77 actions=drop
1641 idle_timeout=50, in_port=2,dl_src=00:66:77:88:99:aa actions=drop
1642 idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=drop
1643 idle_timeout=70, in_port=2,dl_src=00:88:99:aa:bb:cc actions=drop
1644 in_port=2,dl_src=00:55:66:77:88:99 actions=drop
1645 OFPST_FLOW reply (OF1.2):
1647 # Adding another flow will cause the one that expires soonest overall
1649 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'])
1650 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1651 idle_timeout=30, in_port=1,dl_src=00:22:33:44:55:66 actions=drop
1652 idle_timeout=40, in_port=1,dl_src=00:33:44:55:66:77 actions=drop
1653 idle_timeout=50, in_port=2,dl_src=00:66:77:88:99:aa actions=drop
1654 idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=drop
1655 idle_timeout=70, in_port=2,dl_src=00:88:99:aa:bb:cc actions=drop
1656 idle_timeout=80, in_port=2,dl_src=00:99:aa:bb:cc:dd actions=drop
1657 in_port=2,dl_src=00:55:66:77:88:99 actions=drop
1658 OFPST_FLOW reply (OF1.2):
1660 # Reducing the flow limit also causes the flows that expire soonest
1661 # overall to be evicted.
1662 AT_CHECK([ovs-vsctl set Flow_Table evict flow-limit=4])
1663 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1664 idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=drop
1665 idle_timeout=70, in_port=2,dl_src=00:88:99:aa:bb:cc actions=drop
1666 idle_timeout=80, in_port=2,dl_src=00:99:aa:bb:cc:dd actions=drop
1667 in_port=2,dl_src=00:55:66:77:88:99 actions=drop
1668 OFPST_FLOW reply (OF1.2):
1673 AT_SETUP([ofproto - eviction upon table overflow, with modified hard timeout])
1675 # Configure a maximum of 4 flows.
1678 -- --id=@t0 create Flow_Table flow-limit=4 overflow-policy=evict \
1679 -- set bridge br0 flow_tables:0=@t0 \
1680 | ${PERL} $srcdir/uuidfilt.pl],
1683 ovs-appctl time/stop
1685 for in_port in 4 3 2 1; do
1686 ovs-ofctl add-flow br0 hard_timeout=$((10 + in_port * 3)),in_port=$in_port,actions=drop
1688 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1689 hard_timeout=13, in_port=1 actions=drop
1690 hard_timeout=16, in_port=2 actions=drop
1691 hard_timeout=19, in_port=3 actions=drop
1692 hard_timeout=22, in_port=4 actions=drop
1695 # Sleep and modify the one that expires soonest
1696 ovs-appctl time/warp 5000
1697 AT_CHECK([ovs-ofctl mod-flows br0 in_port=1,actions=drop])
1698 # At this point the table would looks like:
1699 # in_port seconds to expire
1704 ovs-appctl time/warp 2000
1705 # Adding another flow will cause the one that expires soonest to be evicted.
1706 AT_CHECK([ovs-ofctl add-flow br0 in_port=5,actions=drop])
1707 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1708 hard_timeout=13, in_port=1 actions=drop
1709 hard_timeout=19, in_port=3 actions=drop
1710 hard_timeout=22, in_port=4 actions=drop
1711 in_port=5 actions=drop
1717 AT_SETUP([ofproto - eviction upon table overflow, with modified idle timeout])
1718 OVS_VSWITCHD_START([add-port br0 p1 -- set interface p1 type=dummy ofport_request=1])
1719 # Configure a maximum of 4 flows.
1722 -- --id=@t0 create Flow_Table flow-limit=4 overflow-policy=evict \
1723 -- set bridge br0 flow_tables:0=@t0 \
1724 | ${PERL} $srcdir/uuidfilt.pl],
1728 for in_port in 4 3 2 1; do
1729 ovs-ofctl add-flow br0 idle_timeout=$((10 + in_port * 3)),in_port=$in_port,actions=drop
1731 ovs-appctl time/stop
1732 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1733 idle_timeout=13, in_port=1 actions=drop
1734 idle_timeout=16, in_port=2 actions=drop
1735 idle_timeout=19, in_port=3 actions=drop
1736 idle_timeout=22, in_port=4 actions=drop
1739 # Sleep and receive on the flow that expires soonest
1740 ovs-appctl time/warp 5000
1741 AT_CHECK([ovs-appctl netdev-dummy/receive p1 'in_port(1)'])
1742 # At this point the table would looks like:
1743 # in_port seconds to expire
1748 ovs-appctl time/warp 2000
1749 # Adding another flow will cause the one that expires soonest to be evicted.
1750 AT_CHECK([ovs-ofctl add-flow br0 in_port=5,actions=drop])
1751 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1752 idle_timeout=19, in_port=3 actions=drop
1753 idle_timeout=22, in_port=4 actions=drop
1754 in_port=5 actions=drop
1755 n_packets=1, n_bytes=60, idle_timeout=13, in_port=1 actions=drop
1761 AT_SETUP([ofproto - asynchronous message control (OpenFlow 1.0)])
1763 AT_CHECK([ovs-ofctl -P openflow10 monitor br0 --detach --no-chdir --pidfile])
1765 printf '\n\n--- check_async %d ---\n\n\n' $1
1768 ovs-appctl -t ovs-ofctl ofctl/barrier
1769 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
1772 # OFPT_PACKET_IN, OFPR_ACTION (controller_id=0)
1773 ovs-ofctl -v packet-out br0 controller controller '0001020304050010203040501234'
1774 if test X"$1" = X"OFPR_ACTION"; then shift;
1775 echo >>expout "OFPT_PACKET_IN: total_len=14 in_port=CONTROLLER (via action) data_len=14 (unbuffered)
1776 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"
1779 # OFPT_PACKET_IN, OFPR_NO_MATCH (controller_id=123)
1780 ovs-ofctl -v packet-out br0 controller 'controller(reason=no_match,id=123)' '0001020304050010203040501234'
1781 if test X"$1" = X"OFPR_NO_MATCH"; then shift;
1782 echo >>expout "OFPT_PACKET_IN: total_len=14 in_port=CONTROLLER (via no_match) data_len=14 (unbuffered)
1783 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"
1786 # OFPT_PACKET_IN, OFPR_INVALID_TTL (controller_id=0)
1787 ovs-ofctl packet-out br0 controller dec_ttl '002583dfb4000026b98cb0f908004500003eb7e200000011339bac11370dac100002d7730035002b8f6d86fb0100000100000000000006626c702d7873066e696369726103636f6d00000f00'
1788 if test X"$1" = X"OFPR_INVALID_TTL"; then shift;
1789 echo >>expout "OFPT_PACKET_IN: total_len=76 in_port=CONTROLLER (via invalid_ttl) data_len=76 (unbuffered)
1790 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"
1793 # OFPT_PORT_STATUS, OFPPR_ADD
1794 ovs-vsctl add-port br0 test -- set Interface test type=dummy ofport_request=1
1795 if test X"$1" = X"OFPPR_ADD"; then shift;
1796 echo >>expout "OFPT_PORT_STATUS: ADD: 1(test): addr:aa:55:aa:55:00:0x
1799 speed: 0 Mbps now, 0 Mbps max"
1802 # OFPT_PORT_STATUS, OFPPR_DELETE
1803 ovs-vsctl del-port br0 test
1804 if test X"$1" = X"OFPPR_DELETE"; then shift;
1805 echo >>expout "OFPT_PORT_STATUS: DEL: 1(test): addr:aa:55:aa:55:00:0x
1808 speed: 0 Mbps now, 0 Mbps max"
1811 # OFPT_FLOW_REMOVED, OFPRR_DELETE
1812 ovs-ofctl add-flow br0 send_flow_rem,actions=drop
1813 ovs-ofctl --strict del-flows br0 ''
1814 if test X"$1" = X"OFPRR_DELETE"; then shift;
1815 echo >>expout "OFPT_FLOW_REMOVED: reason=delete"
1817 AT_FAIL_IF([test X"$1" != X])
1819 ovs-appctl -t ovs-ofctl ofctl/barrier
1820 echo >>expout "OFPT_BARRIER_REPLY:"
1824 s/ (xid=0x[0-9a-fA-F]*)//
1826 s/00:0.$/00:0x/' < monitor.log]],
1830 # It's a service connection so initially there should be no async messages.
1833 # Set miss_send_len to 128, turning on packet-ins for our service connection.
1834 ovs-appctl -t ovs-ofctl ofctl/send 0109000c0123456700000080
1835 check_async 2 OFPR_ACTION OFPPR_ADD OFPPR_DELETE OFPRR_DELETE
1837 # Set miss_send_len to 128 and enable invalid_ttl.
1838 ovs-appctl -t ovs-ofctl ofctl/send 0109000c0123456700040080
1839 check_async 3 OFPR_ACTION OFPR_INVALID_TTL OFPPR_ADD OFPPR_DELETE OFPRR_DELETE
1841 # Become slave, which should disable everything except port status.
1842 ovs-appctl -t ovs-ofctl ofctl/send 0104001400000002000023200000000a00000002
1843 check_async 4 OFPPR_ADD OFPPR_DELETE
1845 # Use NXT_SET_ASYNC_CONFIG to enable a patchwork of asynchronous messages.
1846 ovs-appctl -t ovs-ofctl ofctl/send 01040028000000020000232000000013000000020000000500000005000000020000000200000005
1847 check_async 5 OFPR_INVALID_TTL OFPPR_DELETE OFPRR_DELETE
1849 # Set controller ID 123.
1850 ovs-appctl -t ovs-ofctl ofctl/send 01040018000000030000232000000014000000000000007b
1851 check_async 6 OFPR_NO_MATCH OFPPR_DELETE OFPRR_DELETE
1853 # Restore controller ID 0.
1854 ovs-appctl -t ovs-ofctl ofctl/send 010400180000000300002320000000140000000000000000
1857 ovs-appctl -t ovs-ofctl ofctl/send 0104001400000002000023200000000a00000001
1858 check_async 7 OFPR_ACTION OFPPR_ADD
1860 ovs-appctl -t ovs-ofctl exit
1864 AT_SETUP([ofproto - asynchronous message control (OpenFlow 1.2)])
1866 AT_CHECK([ovs-ofctl -O OpenFlow12 monitor br0 --detach --no-chdir --pidfile])
1868 printf '\n\n--- check_async %d ---\n\n\n' $1
1872 ovs-appctl -t ovs-ofctl ofctl/barrier
1873 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
1876 # OFPT_PACKET_IN, OFPR_ACTION (controller_id=0)
1877 ovs-ofctl -O OpenFlow12 -v packet-out br0 none controller '0001020304050010203040501234'
1878 if test X"$1" = X"OFPR_ACTION"; then shift;
1879 echo >>expout "OFPT_PACKET_IN (OF1.2): total_len=14 in_port=ANY (via action) data_len=14 (unbuffered)
1880 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"
1883 # OFPT_PACKET_IN, OFPR_NO_MATCH (controller_id=123)
1884 ovs-ofctl -O OpenFlow12 -v packet-out br0 none 'controller(reason=no_match,id=123)' '0001020304050010203040501234'
1885 if test X"$1" = X"OFPR_NO_MATCH"; then shift;
1886 echo >>expout "OFPT_PACKET_IN (OF1.2): total_len=14 in_port=ANY (via no_match) data_len=14 (unbuffered)
1887 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"
1890 # OFPT_PACKET_IN, OFPR_INVALID_TTL (controller_id=0)
1891 ovs-ofctl -O OpenFlow12 packet-out br0 none dec_ttl '002583dfb4000026b98cb0f908004500003eb7e200000011339bac11370dac100002d7730035002b8f6d86fb0100000100000000000006626c702d7873066e696369726103636f6d00000f00'
1892 if test X"$1" = X"OFPR_INVALID_TTL"; then shift;
1893 echo >>expout "OFPT_PACKET_IN (OF1.2): total_len=76 in_port=ANY (via invalid_ttl) data_len=76 (unbuffered)
1894 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"
1897 # OFPT_PORT_STATUS, OFPPR_ADD
1898 ovs-vsctl add-port br0 test -- set Interface test type=dummy
1899 if test X"$1" = X"OFPPR_ADD"; then shift;
1900 echo >>expout "OFPT_PORT_STATUS (OF1.2): ADD: ${INDEX}(test): addr:aa:55:aa:55:00:0x
1903 speed: 0 Mbps now, 0 Mbps max"
1906 # OFPT_PORT_STATUS, OFPPR_DELETE
1907 ovs-vsctl del-port br0 test
1908 if test X"$1" = X"OFPPR_DELETE"; then shift;
1909 echo >>expout "OFPT_PORT_STATUS (OF1.2): DEL: ${INDEX}(test): addr:aa:55:aa:55:00:0x
1912 speed: 0 Mbps now, 0 Mbps max"
1915 # OFPT_FLOW_REMOVED, OFPRR_DELETE
1916 ovs-ofctl -O OpenFlow12 add-flow br0 send_flow_rem,actions=drop
1917 ovs-ofctl -O OpenFlow12 --strict del-flows br0 ''
1918 if test X"$1" = X"OFPRR_DELETE"; then shift;
1919 echo >>expout "OFPT_FLOW_REMOVED (OF1.2): reason=delete table_id=0"
1921 AT_FAIL_IF([test X"$1" != X])
1923 ovs-appctl -t ovs-ofctl ofctl/barrier
1924 echo >>expout "OFPT_BARRIER_REPLY (OF1.2):"
1928 s/ (xid=0x[0-9a-fA-F]*)//
1930 s/00:0.$/00:0x/' < monitor.log]],
1934 # It's a service connection so initially there should be no async messages.
1937 # Set miss_send_len to 128, turning on packet-ins for our service connection.
1938 ovs-appctl -t ovs-ofctl ofctl/send 0309000c0123456700000080
1939 check_async 2 OFPR_ACTION OFPPR_ADD OFPPR_DELETE OFPRR_DELETE
1941 # Set miss_send_len to 128 and enable invalid_ttl.
1942 ovs-appctl -t ovs-ofctl ofctl/send 0309000c0123456700040080
1943 check_async 3 OFPR_ACTION OFPR_INVALID_TTL OFPPR_ADD OFPPR_DELETE OFPRR_DELETE
1945 # Become slave (OF 1.2), which should disable everything except port status.
1946 ovs-appctl -t ovs-ofctl ofctl/send 031800180000000200000003000000000000000000000001
1947 check_async 4 OFPPR_ADD OFPPR_DELETE
1949 # Use NXT_SET_ASYNC_CONFIG to enable a patchwork of asynchronous messages.
1950 ovs-appctl -t ovs-ofctl ofctl/send 03040028000000020000232000000013000000020000000500000005000000020000000200000005
1951 check_async 5 OFPR_INVALID_TTL OFPPR_DELETE OFPRR_DELETE
1953 # Set controller ID 123.
1954 ovs-appctl -t ovs-ofctl ofctl/send 03040018000000030000232000000014000000000000007b
1955 check_async 6 OFPR_NO_MATCH OFPPR_DELETE OFPRR_DELETE
1957 # Restore controller ID 0.
1958 ovs-appctl -t ovs-ofctl ofctl/send 030400180000000300002320000000140000000000000000
1960 # Become master (OF 1.2).
1961 ovs-appctl -t ovs-ofctl ofctl/send 031800180000000400000002000000000000000000000002
1962 check_async 7 OFPR_ACTION OFPPR_ADD
1964 ovs-appctl -t ovs-ofctl exit
1968 AT_SETUP([ofproto - asynchronous message control (OpenFlow 1.3)])
1970 AT_CHECK([ovs-ofctl -O OpenFlow13 monitor br0 --detach --no-chdir --pidfile])
1972 printf '\n\n--- check_async %d ---\n\n\n' $1
1976 ovs-appctl -t ovs-ofctl ofctl/barrier
1977 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
1980 # OFPT_PACKET_IN, OFPR_ACTION (controller_id=0)
1981 ovs-ofctl -O OpenFlow13 -v packet-out br0 none controller '0001020304050010203040501234'
1982 if test X"$1" = X"OFPR_ACTION"; then shift;
1983 echo >>expout "OFPT_PACKET_IN (OF1.3): total_len=14 in_port=ANY (via action) data_len=14 (unbuffered)
1984 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"
1987 # OFPT_PACKET_IN, OFPR_NO_MATCH (controller_id=123)
1988 ovs-ofctl -O OpenFlow13 -v packet-out br0 none 'controller(reason=no_match,id=123)' '0001020304050010203040501234'
1989 if test X"$1" = X"OFPR_NO_MATCH"; then shift;
1990 echo >>expout "OFPT_PACKET_IN (OF1.3): total_len=14 in_port=ANY (via no_match) data_len=14 (unbuffered)
1991 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"
1994 # OFPT_PACKET_IN, OFPR_INVALID_TTL (controller_id=0)
1995 ovs-ofctl -O OpenFlow13 packet-out br0 none dec_ttl '002583dfb4000026b98cb0f908004500003eb7e200000011339bac11370dac100002d7730035002b8f6d86fb0100000100000000000006626c702d7873066e696369726103636f6d00000f00'
1996 if test X"$1" = X"OFPR_INVALID_TTL"; then shift;
1997 echo >>expout "OFPT_PACKET_IN (OF1.3): total_len=76 in_port=ANY (via invalid_ttl) data_len=76 (unbuffered)
1998 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"
2001 # OFPT_PORT_STATUS, OFPPR_ADD
2002 ovs-vsctl add-port br0 test -- set Interface test type=dummy
2003 if test X"$1" = X"OFPPR_ADD"; then shift;
2004 echo >>expout "OFPT_PORT_STATUS (OF1.3): ADD: ${INDEX}(test): addr:aa:55:aa:55:00:0x
2007 speed: 0 Mbps now, 0 Mbps max"
2010 # OFPT_PORT_STATUS, OFPPR_DELETE
2011 ovs-vsctl del-port br0 test
2012 if test X"$1" = X"OFPPR_DELETE"; then shift;
2013 echo >>expout "OFPT_PORT_STATUS (OF1.3): DEL: ${INDEX}(test): addr:aa:55:aa:55:00:0x
2016 speed: 0 Mbps now, 0 Mbps max"
2019 # OFPT_FLOW_REMOVED, OFPRR_DELETE
2020 ovs-ofctl -O OpenFlow13 add-flow br0 send_flow_rem,actions=drop
2021 ovs-ofctl -O OpenFlow13 --strict del-flows br0 ''
2022 if test X"$1" = X"OFPRR_DELETE"; then shift;
2023 echo >>expout "OFPT_FLOW_REMOVED (OF1.3): reason=delete table_id=0"
2026 # OFPT_FLOW_REMOVED, OFPRR_GROUP_DELETE
2027 ovs-ofctl -O OpenFlow13 add-group br0 group_id=1234,type=all,bucket=output:10
2028 ovs-ofctl -O OpenFlow13 add-flow br0 send_flow_rem,actions=group:1234
2029 ovs-ofctl -O OpenFlow13 --strict del-groups br0 group_id=1234
2030 if test X"$1" = X"OFPRR_DELETE"; then shift;
2031 echo >>expout "OFPT_FLOW_REMOVED (OF1.3): reason=gropu_delete table_id=0"
2034 AT_FAIL_IF([test X"$1" != X])
2036 ovs-appctl -t ovs-ofctl ofctl/barrier
2037 echo >>expout "OFPT_BARRIER_REPLY (OF1.3):"
2041 s/ (xid=0x[0-9a-fA-F]*)//
2043 s/00:0.$/00:0x/' < monitor.log]],
2047 # It's a service connection so initially there should be no async messages.
2050 # Set miss_send_len to 128, turning on packet-ins for our service connection.
2051 ovs-appctl -t ovs-ofctl ofctl/send 0409000c0123456700000080
2052 check_async 2 OFPR_ACTION OFPPR_ADD OFPPR_DELETE OFPRR_DELETE
2054 # Become slave (OF 1.3), which should disable everything except port status.
2055 ovs-appctl -t ovs-ofctl ofctl/send 041800180000000200000003000000000000000000000001
2056 check_async 3 OFPPR_ADD OFPPR_DELETE
2058 # Use OF 1.3 OFPT_SET_ASYNC to enable a patchwork of asynchronous messages.
2059 ovs-appctl -t ovs-ofctl ofctl/send 041c002000000002000000020000000500000005000000020000000200000005
2060 check_async 4 OFPR_INVALID_TTL OFPPR_DELETE OFPRR_DELETE
2062 # Set controller ID 123.
2063 ovs-appctl -t ovs-ofctl ofctl/send 04040018000000030000232000000014000000000000007b
2064 check_async 5 OFPR_NO_MATCH OFPPR_DELETE OFPRR_DELETE
2066 # Restore controller ID 0.
2067 ovs-appctl -t ovs-ofctl ofctl/send 040400180000000300002320000000140000000000000000
2069 # Become master (OF 1.3).
2070 ovs-appctl -t ovs-ofctl ofctl/send 041800180000000400000002000000000000000000000002
2071 check_async 6 OFPR_ACTION OFPPR_ADD
2073 ovs-appctl -t ovs-ofctl exit
2077 AT_SETUP([ofproto - asynchronous message control (OpenFlow 1.5)])
2079 AT_CHECK([ovs-ofctl -O OpenFlow15 monitor br0 --detach --no-chdir --pidfile])
2081 printf '\n\n--- check_async %d ---\n\n\n' $1
2085 ovs-appctl -t ovs-ofctl ofctl/barrier
2086 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
2089 # Other tests are not working with OF 1.5, and message
2090 # format may change, so leave them out.
2092 # OFPT_PORT_STATUS, OFPPR_ADD
2093 ovs-vsctl add-port br0 test -- set Interface test type=dummy
2094 if test X"$1" = X"OFPPR_ADD"; then shift;
2095 echo >>expout "OFPT_PORT_STATUS (OF1.5): ADD: ${INDEX}(test): addr:aa:55:aa:55:00:0x
2098 speed: 0 Mbps now, 0 Mbps max"
2101 # OFPT_PORT_STATUS, OFPPR_MODIFY
2102 ovs-ofctl -O OpenFlow15 -vwarn mod-port br0 test up
2103 if test X"$1" = X"OFPPR_MODIFY"; then shift;
2104 echo >>expout "OFPT_PORT_STATUS (OF1.5): MOD: ${INDEX}(test): addr:aa:55:aa:55:00:0x
2107 speed: 0 Mbps now, 0 Mbps max
2108 OFPT_PORT_STATUS (OF1.5): MOD: 2(test): addr:aa:55:aa:55:00:0x
2111 speed: 0 Mbps now, 0 Mbps max"
2114 # OFPT_PORT_STATUS, OFPPR_DELETE
2115 ovs-vsctl del-port br0 test
2116 if test X"$1" = X"OFPPR_DELETE"; then shift;
2117 echo >>expout "OFPT_PORT_STATUS (OF1.5): DEL: ${INDEX}(test): addr:aa:55:aa:55:00:0x
2120 speed: 0 Mbps now, 0 Mbps max"
2123 AT_FAIL_IF([test X"$1" != X])
2125 ovs-appctl -t ovs-ofctl ofctl/barrier
2126 echo >>expout "OFPT_BARRIER_REPLY (OF1.5):"
2130 s/ (xid=0x[0-9a-fA-F]*)//
2132 s/00:0.$/00:0x/' < monitor.log]],
2136 # It's a service connection so initially there should be no async messages.
2139 # If we don't set this, async messages are not received.
2140 # Set miss_send_len to 128, turning on packet-ins for our service connection.
2141 ovs-appctl -t ovs-ofctl ofctl/send 0609000c0123456700000080
2142 check_async 2 OFPPR_ADD OFPPR_MODIFY OFPPR_DELETE
2144 # Set-async has changed in OF 1.4 and is not yet implemented.
2146 ovs-appctl -t ovs-ofctl exit
2150 dnl This test checks that the role request/response messaging works
2151 dnl and that generation_id is handled properly.
2152 AT_SETUP([ofproto - controller role (OpenFlow 1.2)])
2154 ON_EXIT([kill `cat c1.pid c2.pid`])
2156 # Start two ovs-ofctl controller processes.
2157 AT_CAPTURE_FILE([monitor1.log])
2158 AT_CAPTURE_FILE([expout1])
2159 AT_CAPTURE_FILE([experr1])
2160 AT_CAPTURE_FILE([monitor2.log])
2161 AT_CAPTURE_FILE([expout2])
2162 AT_CAPTURE_FILE([experr2])
2164 AT_CHECK([ovs-ofctl -O OpenFlow12 monitor br0 --detach --no-chdir --pidfile=`pwd`/c$i.pid --unixctl=`pwd`/c$i])
2165 ovs-appctl -t `pwd`/c$i ofctl/barrier
2166 ovs-appctl -t `pwd`/c$i ofctl/set-output-file monitor$i.log
2170 # find out current role
2171 ovs-appctl -t `pwd`/c$i ofctl/send 031800180000000200000000000000000000000000000000
2172 echo >>experr$i "send: OFPT_ROLE_REQUEST (OF1.2): role=nochange"
2173 echo >>expout$i "OFPT_ROLE_REPLY (OF1.2): role=equal"
2176 # controller 1: Become slave (generation_id is initially undefined, so
2177 # 2^63+2 should not be stale)
2178 ovs-appctl -t `pwd`/c1 ofctl/send 031800180000000300000003000000008000000000000002
2179 echo >>experr1 "send: OFPT_ROLE_REQUEST (OF1.2): role=slave generation_id=9223372036854775810"
2180 echo >>expout1 "OFPT_ROLE_REPLY (OF1.2): role=slave generation_id=9223372036854775810"
2182 # controller 2: Become master.
2183 ovs-appctl -t `pwd`/c2 ofctl/send 031800180000000300000002000000008000000000000003
2184 echo >>experr2 "send: OFPT_ROLE_REQUEST (OF1.2): role=master generation_id=9223372036854775811"
2185 echo >>expout2 "OFPT_ROLE_REPLY (OF1.2): role=master generation_id=9223372036854775811"
2187 # controller 1: Try to become the master using a stale generation ID
2188 ovs-appctl -t `pwd`/c1 ofctl/send 031800180000000400000002000000000000000000000003
2189 echo >>experr1 "send: OFPT_ROLE_REQUEST (OF1.2): role=master generation_id=3"
2190 echo >>expout1 "OFPT_ERROR (OF1.2): OFPRRFC_STALE"
2191 echo >>expout1 "OFPT_ROLE_REQUEST (OF1.2): role=master generation_id=3"
2193 # controller 1: Become master using a valid generation ID
2194 ovs-appctl -t `pwd`/c1 ofctl/send 031800180000000500000002000000000000000000000001
2195 echo >>experr1 "send: OFPT_ROLE_REQUEST (OF1.2): role=master generation_id=1"
2196 echo >>expout1 "OFPT_ROLE_REPLY (OF1.2): role=master generation_id=1"
2199 ovs-appctl -t `pwd`/c$i ofctl/barrier
2200 echo >>expout$i "OFPT_BARRIER_REPLY (OF1.2):"
2206 AT_CHECK([grep -v '^send:' monitor$i.log | STRIP_XIDS], [0], [expout])
2208 AT_CHECK([grep '^send:' monitor$i.log | STRIP_XIDS], [0], [expout])
2213 dnl This test checks that the role request/response messaging works,
2214 dnl that generation_id is handled properly, and that role status update
2215 dnl messages are sent when a controller's role gets changed from master
2217 AT_SETUP([ofproto - controller role (OpenFlow 1.4)])
2219 ON_EXIT([kill `cat c1.pid c2.pid`])
2221 # Start two ovs-ofctl controller processes.
2222 AT_CAPTURE_FILE([monitor1.log])
2223 AT_CAPTURE_FILE([expout1])
2224 AT_CAPTURE_FILE([experr1])
2225 AT_CAPTURE_FILE([monitor2.log])
2226 AT_CAPTURE_FILE([expout2])
2227 AT_CAPTURE_FILE([experr2])
2229 AT_CHECK([ovs-ofctl -O OpenFlow14 monitor br0 --detach --no-chdir --pidfile=`pwd`/c$i.pid --unixctl=`pwd`/c$i])
2230 ovs-appctl -t `pwd`/c$i ofctl/barrier
2231 ovs-appctl -t `pwd`/c$i ofctl/set-output-file monitor$i.log
2235 # find out current role
2236 ovs-appctl -t `pwd`/c$i ofctl/send 051800180000000200000000000000000000000000000000
2237 echo >>experr$i "send: OFPT_ROLE_REQUEST (OF1.4): role=nochange"
2238 echo >>expout$i "OFPT_ROLE_REPLY (OF1.4): role=equal"
2241 # controller 1: Become slave (generation_id is initially undefined, so
2242 # 2^63+2 should not be stale)
2243 ovs-appctl -t `pwd`/c1 ofctl/send 051800180000000300000003000000008000000000000002
2244 echo >>experr1 "send: OFPT_ROLE_REQUEST (OF1.4): role=slave generation_id=9223372036854775810"
2245 echo >>expout1 "OFPT_ROLE_REPLY (OF1.4): role=slave generation_id=9223372036854775810"
2247 # controller 2: Become master.
2248 ovs-appctl -t `pwd`/c2 ofctl/send 051800180000000300000002000000008000000000000003
2249 echo >>experr2 "send: OFPT_ROLE_REQUEST (OF1.4): role=master generation_id=9223372036854775811"
2250 echo >>expout2 "OFPT_ROLE_REPLY (OF1.4): role=master generation_id=9223372036854775811"
2252 # controller 1: Try to become the master using a stale generation ID
2253 ovs-appctl -t `pwd`/c1 ofctl/send 051800180000000400000002000000000000000000000003
2254 echo >>experr1 "send: OFPT_ROLE_REQUEST (OF1.4): role=master generation_id=3"
2255 echo >>expout1 "OFPT_ERROR (OF1.4): OFPRRFC_STALE"
2256 echo >>expout1 "OFPT_ROLE_REQUEST (OF1.4): role=master generation_id=3"
2258 # controller 1: Become master using a valid generation ID
2259 ovs-appctl -t `pwd`/c1 ofctl/send 051800180000000500000002000000000000000000000001
2260 echo >>experr1 "send: OFPT_ROLE_REQUEST (OF1.4): role=master generation_id=1"
2261 echo >>expout1 "OFPT_ROLE_REPLY (OF1.4): role=master generation_id=1"
2262 echo >>expout2 "OFPT_ROLE_STATUS (OF1.4): role=slave generation_id=1 reason=master_request"
2265 ovs-appctl -t `pwd`/c$i ofctl/barrier
2266 echo >>expout$i "OFPT_BARRIER_REPLY (OF1.4):"
2272 AT_CHECK([grep -v '^send:' monitor$i.log | STRIP_XIDS], [0], [expout])
2274 AT_CHECK([grep '^send:' monitor$i.log | STRIP_XIDS], [0], [expout])
2279 dnl This test checks that OFPT_PACKET_OUT accepts both OFPP_NONE (as
2280 dnl specified by OpenFlow 1.0) 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.0)])
2285 ADD_OF_PORTS([br0], [1])
2287 # Start a monitor listening for packet-ins.
2288 AT_CHECK([ovs-ofctl -P openflow10 monitor br0 --detach --no-chdir --pidfile])
2289 ovs-appctl -t ovs-ofctl ofctl/send 0109000c0123456700000080
2290 ovs-appctl -t ovs-ofctl ofctl/barrier
2291 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
2292 AT_CAPTURE_FILE([monitor.log])
2294 # Send some packet-outs with OFPP_NONE and OFPP_CONTROLLER (65533) as in_port.
2295 AT_CHECK([ovs-ofctl packet-out br0 none controller,1 '0001020304050010203040501234'])
2296 AT_CHECK([ovs-ofctl packet-out br0 controller controller,1 '0001020304050010203040505678'])
2298 # Stop the monitor and check its output.
2299 ovs-appctl -t ovs-ofctl ofctl/barrier
2300 ovs-appctl -t ovs-ofctl exit
2302 ovs-ofctl dump-ports br0
2304 AT_CHECK([sed 's/ (xid=0x[[0-9a-fA-F]]*)//' monitor.log], [0], [dnl
2305 OFPT_PACKET_IN: total_len=14 in_port=ANY (via action) data_len=14 (unbuffered)
2306 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
2307 OFPT_PACKET_IN: total_len=14 in_port=CONTROLLER (via action) data_len=14 (unbuffered)
2308 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
2315 dnl This test checks that OFPT_PACKET_OUT accepts both OFPP_NONE (as
2316 dnl specified by OpenFlow 1.2) and OFPP_CONTROLLER (used by some
2317 dnl controllers despite the spec) as meaning a packet that was generated
2318 dnl by the controller.
2319 AT_SETUP([ofproto - packet-out from controller (OpenFlow 1.2)])
2322 # Start a monitor listening for packet-ins.
2323 AT_CHECK([ovs-ofctl -O OpenFlow12 monitor br0 --detach --no-chdir --pidfile])
2324 ovs-appctl -t ovs-ofctl ofctl/send 0309000c0123456700000080
2325 ovs-appctl -t ovs-ofctl ofctl/barrier
2326 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
2327 AT_CAPTURE_FILE([monitor.log])
2329 # Send some packet-outs with OFPP_NONE and OFPP_CONTROLLER (65533) as in_port.
2330 AT_CHECK([ovs-ofctl -O OpenFlow12 packet-out br0 none controller '0001020304050010203040501234'])
2331 AT_CHECK([ovs-ofctl -O OpenFlow12 packet-out br0 4294967293 controller '0001020304050010203040505678'])
2333 # Stop the monitor and check its output.
2334 ovs-appctl -t ovs-ofctl ofctl/barrier
2335 ovs-appctl -t ovs-ofctl exit
2337 AT_CHECK([sed 's/ (xid=0x[[0-9a-fA-F]]*)//' monitor.log], [0], [dnl
2338 OFPT_PACKET_IN (OF1.2): total_len=14 in_port=ANY (via action) data_len=14 (unbuffered)
2339 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
2340 OFPT_PACKET_IN (OF1.2): total_len=14 in_port=CONTROLLER (via action) data_len=14 (unbuffered)
2341 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
2342 OFPT_BARRIER_REPLY (OF1.2):
2348 dnl This test checks that OFPT_PACKET_OUT accepts both OFPP_NONE (as
2349 dnl specified by OpenFlow 1.1) and OFPP_CONTROLLER (used by some
2350 dnl controllers despite the spec) as meaning a packet that was generated
2351 dnl by the controller.
2352 AT_SETUP([ofproto - packet-out from controller (OpenFlow 1.1)])
2355 # Start a monitor listening for packet-ins.
2356 AT_CHECK([ovs-ofctl -O OpenFlow11 monitor br0 --detach --no-chdir --pidfile])
2357 ovs-appctl -t ovs-ofctl ofctl/send 0209000c0123456700000080
2358 ovs-appctl -t ovs-ofctl ofctl/barrier
2359 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
2360 AT_CAPTURE_FILE([monitor.log])
2362 # Send some packet-outs with OFPP_NONE and OFPP_CONTROLLER (65533) as in_port.
2363 AT_CHECK([ovs-ofctl -O OpenFlow11 packet-out br0 none controller '0001020304050010203040501234'])
2364 AT_CHECK([ovs-ofctl -O OpenFlow11 packet-out br0 4294967293 controller '0001020304050010203040505678'])
2366 # Stop the monitor and check its output.
2367 ovs-appctl -t ovs-ofctl ofctl/barrier
2368 ovs-appctl -t ovs-ofctl exit
2370 AT_CHECK([sed 's/ (xid=0x[[0-9a-fA-F]]*)//' monitor.log], [0], [dnl
2371 OFPT_PACKET_IN (OF1.1): total_len=14 in_port=ANY (via action) data_len=14 (unbuffered)
2372 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 OFPT_PACKET_IN (OF1.1): total_len=14 in_port=CONTROLLER (via action) data_len=14 (unbuffered)
2374 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
2375 OFPT_BARRIER_REPLY (OF1.1):
2381 dnl This test checks that metadata is encoded in packet_in structures,
2382 dnl supported by NXAST.
2383 AT_SETUP([ofproto - packet-out with metadata (NXM)])
2386 # Start a monitor listening for packet-ins.
2387 AT_CHECK([ovs-ofctl -P nxm monitor br0 --detach --no-chdir --pidfile])
2388 ovs-appctl -t ovs-ofctl ofctl/send 0109000c0123456700000080
2389 ovs-appctl -t ovs-ofctl ofctl/barrier
2390 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
2391 AT_CAPTURE_FILE([monitor.log])
2393 # Send a packet-out with a load action to set some metadata, and forward to controller
2394 AT_CHECK([ovs-ofctl packet-out br0 controller 'load(0xfafafafa5a5a5a5a->OXM_OF_METADATA[[0..63]]), load(0xaa->NXM_NX_PKT_MARK[[]]), controller' '0001020304050010203040501234'])
2396 # Stop the monitor and check its output.
2397 ovs-appctl -t ovs-ofctl ofctl/barrier
2398 ovs-appctl -t ovs-ofctl exit
2400 AT_CHECK([sed 's/ (xid=0x[[0-9a-fA-F]]*)//' monitor.log], [0], [dnl
2401 NXT_PACKET_IN: total_len=14 in_port=CONTROLLER metadata=0xfafafafa5a5a5a5a pkt_mark=0xaa (via action) data_len=14 (unbuffered)
2402 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
2409 dnl This test checks that metadata is encoded in packet_in structures,
2410 dnl supported by NXAST.
2411 AT_SETUP([ofproto - packet-out with metadata (OpenFlow 1.2)])
2414 # Start a monitor listening for packet-ins.
2415 AT_CHECK([ovs-ofctl -O OpenFlow12 monitor br0 --detach --no-chdir --pidfile])
2416 ovs-appctl -t ovs-ofctl ofctl/send 0309000c0123456700000080
2417 ovs-appctl -t ovs-ofctl ofctl/barrier
2418 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
2419 AT_CAPTURE_FILE([monitor.log])
2421 # Send a packet-out with a set-field action to set some metadata, and forward to controller
2422 AT_CHECK([ovs-ofctl -O OpenFlow12 packet-out br0 none 'set_field:0xfafafafa5a5a5a5a->metadata, controller' '0001020304050010203040501234'])
2424 # Stop the monitor and check its output.
2425 ovs-appctl -t ovs-ofctl ofctl/barrier
2426 ovs-appctl -t ovs-ofctl exit
2428 AT_CHECK([sed 's/ (xid=0x[[0-9a-fA-F]]*)//' monitor.log], [0], [dnl
2429 OFPT_PACKET_IN (OF1.2): total_len=14 in_port=ANY metadata=0xfafafafa5a5a5a5a (via action) data_len=14 (unbuffered)
2430 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
2431 OFPT_BARRIER_REPLY (OF1.2):
2437 dnl This test checks that metadata is encoded in packet_in structures,
2438 dnl supported by NXAST.
2439 AT_SETUP([ofproto - packet-out with metadata and dual set_field (OpenFlow 1.3)])
2442 # Start a monitor listening for packet-ins.
2443 AT_CHECK([ovs-ofctl -O OpenFlow13 monitor br0 --detach --no-chdir --pidfile])
2444 ovs-appctl -t ovs-ofctl ofctl/send 0409000c0123456700000080
2445 ovs-appctl -t ovs-ofctl ofctl/barrier
2446 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
2447 AT_CAPTURE_FILE([monitor.log])
2449 # Send a packet-out with a couple of set-field action to set some metadata, and forward to controller
2450 AT_CHECK([ovs-ofctl -O OpenFlow13 packet-out br0 none 'set_field:0xfafafafa5a5a5a5a->metadata, set_field:0x6b->metadata, controller' '0001020304050010203040501234'])
2452 # Stop the monitor and check its output.
2453 ovs-appctl -t ovs-ofctl ofctl/barrier
2454 ovs-appctl -t ovs-ofctl exit
2456 AT_CHECK([sed 's/ (xid=0x[[0-9a-fA-F]]*)//' monitor.log], [0], [dnl
2457 OFPT_PACKET_IN (OF1.3): total_len=14 in_port=ANY metadata=0x6b (via action) data_len=14 (unbuffered)
2458 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
2459 OFPT_BARRIER_REPLY (OF1.3):
2465 dnl This test checks that tunnel metadata is encoded in packet_in structures.
2466 AT_SETUP([ofproto - packet-out with tunnel metadata (OpenFlow 1.2)])
2469 # Start a monitor listening for packet-ins.
2470 AT_CHECK([ovs-ofctl -O OpenFlow12 monitor br0 --detach --no-chdir --pidfile])
2471 ovs-appctl -t ovs-ofctl ofctl/send 0309000c0123456700000080
2472 ovs-appctl -t ovs-ofctl ofctl/barrier
2473 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
2474 AT_CAPTURE_FILE([monitor.log])
2476 # Send a packet-out with set field actions to set some tunnel metadata, and forward to controller
2477 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'])
2479 # Stop the monitor and check its output.
2480 ovs-appctl -t ovs-ofctl ofctl/barrier
2481 ovs-appctl -t ovs-ofctl exit
2483 AT_CHECK([sed 's/ (xid=0x[[0-9a-fA-F]]*)//' monitor.log], [0], [dnl
2484 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)
2485 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
2486 OFPT_BARRIER_REPLY (OF1.2):
2492 m4_divert_push([PREPARE_TESTS])
2493 # Sorts groups of lines that start with a space, without moving them
2494 # past the nearest line that does not start with a space.
2504 print $_ foreach sort(@buffer);
2509 print $_ foreach sort(@buffer);
2512 m4_divert_pop([PREPARE_TESTS])
2514 AT_SETUP([ofproto - flow monitoring])
2515 AT_KEYWORDS([monitor])
2518 ovs-ofctl add-flow br0 in_port=0,dl_vlan=123,actions=output:1
2520 # Start a monitor watching the flow table and check the initial reply.
2521 ovs-ofctl monitor br0 watch: --detach --no-chdir --pidfile >monitor.log 2>&1
2522 AT_CAPTURE_FILE([monitor.log])
2523 ovs-appctl -t ovs-ofctl ofctl/barrier
2524 AT_CHECK([sed 's/ (xid=0x[[1-9a-fA-F]][[0-9a-fA-F]]*)//' monitor.log], [0],
2525 [NXST_FLOW_MONITOR reply:
2526 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=123 actions=output:1
2530 # Add, delete, and modify some flows and check the updates.
2531 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
2532 ovs-ofctl add-flow br0 in_port=0,dl_vlan=124,actions=output:2
2533 ovs-ofctl add-flow br0 in_port=0,dl_vlan=123,actions=output:5
2534 ovs-ofctl add-flow br0 in_port=0,dl_vlan=123,dl_vlan_pcp=0,actions=output:6
2535 ovs-ofctl add-flow br0 in_port=0,dl_vlan=123,dl_vlan_pcp=1,actions=output:7
2536 ovs-ofctl add-flow br0 in_port=0,dl_vlan=123,actions=output:8
2537 ovs-ofctl add-flow br0 in_port=0,dl_vlan=65535,dl_vlan_pcp=0,actions=output:9
2538 ovs-ofctl add-flow br0 in_port=0,dl_vlan=65535,dl_vlan_pcp=1,actions=output:10
2539 ovs-ofctl add-flow br0 in_port=0,dl_vlan=65535,actions=output:11
2540 ovs-ofctl add-flow br0 in_port=0,dl_vlan=8191,dl_vlan_pcp=0,actions=output:12
2541 ovs-ofctl add-flow br0 in_port=0,dl_vlan=8191,dl_vlan_pcp=1,actions=output:13
2542 ovs-ofctl add-flow br0 in_port=0,dl_vlan=8191,actions=output:14
2543 ovs-ofctl add-flow br0 in_port=0,dl_vlan=0,dl_vlan_pcp=0,actions=output:15
2544 ovs-ofctl add-flow br0 in_port=0,dl_vlan=0,dl_vlan_pcp=1,actions=output:16
2545 ovs-ofctl add-flow br0 in_port=0,dl_vlan=0,actions=output:17
2546 ovs-ofctl add-flow br0 in_port=0,dl_vlan=0,dl_vlan_pcp=0,actions=output:18
2547 ovs-ofctl add-flow br0 in_port=0,dl_vlan=0,dl_vlan_pcp=1,actions=output:19
2548 ovs-ofctl add-flow br0 in_port=0,dl_vlan=0,actions=output:20
2549 ovs-ofctl add-flow br0 in_port=0,dl_vlan_pcp=0,actions=output:21
2550 ovs-ofctl add-flow br0 in_port=0,dl_vlan_pcp=1,actions=output:22
2551 ovs-ofctl add-flow br0 in_port=0,actions=output:23
2552 ovs-ofctl mod-flows br0 dl_vlan=123,actions=output:3
2553 ovs-ofctl mod-flows br0 cookie=5,dl_vlan=123,actions=output:3
2554 ovs-ofctl del-flows br0 dl_vlan=123
2555 ovs-ofctl del-flows br0
2556 ovs-appctl -t ovs-ofctl ofctl/barrier
2557 AT_CHECK([sed 's/ (xid=0x[[1-9a-fA-F]][[0-9a-fA-F]]*)//' monitor.log | multiline_sort], [0],
2558 [NXST_FLOW_MONITOR reply (xid=0x0):
2559 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=124 actions=output:2
2560 NXST_FLOW_MONITOR reply (xid=0x0):
2561 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=123 actions=output:5
2562 NXST_FLOW_MONITOR reply (xid=0x0):
2563 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=123,dl_vlan_pcp=0 actions=output:6
2564 NXST_FLOW_MONITOR reply (xid=0x0):
2565 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=123,dl_vlan_pcp=1 actions=output:7
2566 NXST_FLOW_MONITOR reply (xid=0x0):
2567 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=123 actions=output:8
2568 NXST_FLOW_MONITOR reply (xid=0x0):
2569 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=0,dl_vlan_pcp=0 actions=output:9
2570 NXST_FLOW_MONITOR reply (xid=0x0):
2571 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=0,dl_vlan_pcp=1 actions=output:10
2572 NXST_FLOW_MONITOR reply (xid=0x0):
2573 event=ADDED table=0 cookie=0 in_port=0,vlan_tci=0x0000 actions=output:11
2574 NXST_FLOW_MONITOR reply (xid=0x0):
2575 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=4095,dl_vlan_pcp=0 actions=output:12
2576 NXST_FLOW_MONITOR reply (xid=0x0):
2577 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=4095,dl_vlan_pcp=1 actions=output:13
2578 NXST_FLOW_MONITOR reply (xid=0x0):
2579 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=4095 actions=output:14
2580 NXST_FLOW_MONITOR reply (xid=0x0):
2581 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=0,dl_vlan_pcp=0 actions=output:15
2582 NXST_FLOW_MONITOR reply (xid=0x0):
2583 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=0,dl_vlan_pcp=1 actions=output:16
2584 NXST_FLOW_MONITOR reply (xid=0x0):
2585 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=0 actions=output:17
2586 NXST_FLOW_MONITOR reply (xid=0x0):
2587 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=0,dl_vlan_pcp=0 actions=output:18
2588 NXST_FLOW_MONITOR reply (xid=0x0):
2589 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=0,dl_vlan_pcp=1 actions=output:19
2590 NXST_FLOW_MONITOR reply (xid=0x0):
2591 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=0 actions=output:20
2592 NXST_FLOW_MONITOR reply (xid=0x0):
2593 event=ADDED table=0 cookie=0 in_port=0,dl_vlan_pcp=0 actions=output:21
2594 NXST_FLOW_MONITOR reply (xid=0x0):
2595 event=ADDED table=0 cookie=0 in_port=0,dl_vlan_pcp=1 actions=output:22
2596 NXST_FLOW_MONITOR reply (xid=0x0):
2597 event=ADDED table=0 cookie=0 in_port=0 actions=output:23
2598 NXST_FLOW_MONITOR reply (xid=0x0):
2599 event=MODIFIED table=0 cookie=0 in_port=0,dl_vlan=123 actions=output:3
2600 event=MODIFIED table=0 cookie=0 in_port=0,dl_vlan=123,dl_vlan_pcp=0 actions=output:3
2601 event=MODIFIED table=0 cookie=0 in_port=0,dl_vlan=123,dl_vlan_pcp=1 actions=output:3
2602 NXST_FLOW_MONITOR reply (xid=0x0):
2603 event=MODIFIED table=0 cookie=0x5 in_port=0,dl_vlan=123 actions=output:3
2604 event=MODIFIED table=0 cookie=0x5 in_port=0,dl_vlan=123,dl_vlan_pcp=0 actions=output:3
2605 event=MODIFIED table=0 cookie=0x5 in_port=0,dl_vlan=123,dl_vlan_pcp=1 actions=output:3
2606 NXST_FLOW_MONITOR reply (xid=0x0):
2607 event=DELETED reason=delete table=0 cookie=0x5 in_port=0,dl_vlan=123 actions=output:3
2608 event=DELETED reason=delete table=0 cookie=0x5 in_port=0,dl_vlan=123,dl_vlan_pcp=0 actions=output:3
2609 event=DELETED reason=delete table=0 cookie=0x5 in_port=0,dl_vlan=123,dl_vlan_pcp=1 actions=output:3
2610 NXST_FLOW_MONITOR reply (xid=0x0):
2611 event=DELETED reason=delete table=0 cookie=0 in_port=0 actions=output:23
2612 event=DELETED reason=delete table=0 cookie=0 in_port=0,dl_vlan=0 actions=output:20
2613 event=DELETED reason=delete table=0 cookie=0 in_port=0,dl_vlan=0,dl_vlan_pcp=0 actions=output:18
2614 event=DELETED reason=delete table=0 cookie=0 in_port=0,dl_vlan=0,dl_vlan_pcp=1 actions=output:19
2615 event=DELETED reason=delete table=0 cookie=0 in_port=0,dl_vlan=124 actions=output:2
2616 event=DELETED reason=delete table=0 cookie=0 in_port=0,dl_vlan=4095 actions=output:14
2617 event=DELETED reason=delete table=0 cookie=0 in_port=0,dl_vlan=4095,dl_vlan_pcp=0 actions=output:12
2618 event=DELETED reason=delete table=0 cookie=0 in_port=0,dl_vlan=4095,dl_vlan_pcp=1 actions=output:13
2619 event=DELETED reason=delete table=0 cookie=0 in_port=0,dl_vlan_pcp=0 actions=output:21
2620 event=DELETED reason=delete table=0 cookie=0 in_port=0,dl_vlan_pcp=1 actions=output:22
2621 event=DELETED reason=delete table=0 cookie=0 in_port=0,vlan_tci=0x0000 actions=output:11
2625 # Check that our own changes are reported as full updates.
2626 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
2627 ovs-ofctl add-flow br0 in_port=1,actions=output:2
2628 ovs-ofctl add-flow br0 in_port=2,actions=output:1
2629 ovs-appctl -t ovs-ofctl ofctl/barrier
2630 ovs-appctl -t ovs-ofctl ofctl/send 010e004812345678003fffff00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003000000000000ffffffffffff0000
2631 ovs-appctl -t ovs-ofctl ofctl/barrier
2632 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip], [0], [NXST_FLOW reply:
2634 AT_CHECK([sed 's/ (xid=0x[[1-9a-fA-F]][[0-9a-fA-F]]*)//' monitor.log | multiline_sort], [0],
2635 [NXST_FLOW_MONITOR reply (xid=0x0):
2636 event=ADDED table=0 cookie=0 in_port=1 actions=output:2
2637 NXST_FLOW_MONITOR reply (xid=0x0):
2638 event=ADDED table=0 cookie=0 in_port=2 actions=output:1
2640 send: OFPT_FLOW_MOD: DEL priority=0 actions=drop
2641 NXST_FLOW_MONITOR reply (xid=0x0):
2642 event=DELETED reason=delete table=0 cookie=0 in_port=1 actions=output:2
2643 event=DELETED reason=delete table=0 cookie=0 in_port=2 actions=output:1
2647 ovs-appctl -t ovs-ofctl exit
2651 AT_SETUP([ofproto - flow monitoring with !own])
2652 AT_KEYWORDS([monitor])
2655 ovs-ofctl add-flow br0 in_port=0,dl_vlan=123,actions=output:1
2657 # Start a monitor watching the flow table and check the initial reply.
2658 ovs-ofctl monitor br0 watch:\!own --detach --no-chdir --pidfile >monitor.log 2>&1
2659 AT_CAPTURE_FILE([monitor.log])
2660 ovs-appctl -t ovs-ofctl ofctl/barrier
2661 AT_CHECK([sed 's/ (xid=0x[[1-9a-fA-F]][[0-9a-fA-F]]*)//' monitor.log], [0],
2662 [NXST_FLOW_MONITOR reply:
2663 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=123 actions=output:1
2667 # Check that our own changes are reported as abbreviations.
2668 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
2669 ovs-ofctl add-flow br0 in_port=1,actions=output:2
2670 ovs-ofctl add-flow br0 in_port=2,actions=output:1
2671 ovs-appctl -t ovs-ofctl ofctl/barrier
2672 ovs-appctl -t ovs-ofctl ofctl/send 010e004812345678003fffff00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003000000000000ffffffffffff0000
2673 ovs-appctl -t ovs-ofctl ofctl/barrier
2674 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip], [0], [NXST_FLOW reply:
2676 AT_CHECK([sed 's/ (xid=0x[[1-9a-fA-F]][[0-9a-fA-F]]*)//' monitor.log], [0],
2677 [NXST_FLOW_MONITOR reply (xid=0x0):
2678 event=ADDED table=0 cookie=0 in_port=1 actions=output:2
2679 NXST_FLOW_MONITOR reply (xid=0x0):
2680 event=ADDED table=0 cookie=0 in_port=2 actions=output:1
2682 send: OFPT_FLOW_MOD: DEL priority=0 actions=drop
2683 NXST_FLOW_MONITOR reply (xid=0x0):
2684 event=ABBREV xid=0x12345678
2688 ovs-appctl -t ovs-ofctl exit
2692 AT_SETUP([ofproto - flow monitoring with out_port])
2693 AT_KEYWORDS([monitor])
2696 ovs-ofctl add-flow br0 in_port=0,dl_vlan=121,actions=output:1
2697 ovs-ofctl add-flow br0 in_port=0,dl_vlan=122,actions=output:1
2698 ovs-ofctl add-flow br0 in_port=0,dl_vlan=123,actions=output:2
2700 # Start a monitor watching the flow table and check the initial reply.
2701 ovs-ofctl monitor br0 watch:out_port=2 --detach --no-chdir --pidfile >monitor.log 2>&1
2702 AT_CAPTURE_FILE([monitor.log])
2703 ovs-appctl -t ovs-ofctl ofctl/barrier
2704 AT_CHECK([sed 's/ (xid=0x[[1-9a-fA-F]][[0-9a-fA-F]]*)//' monitor.log], [0],
2705 [NXST_FLOW_MONITOR reply:
2706 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=123 actions=output:2
2710 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
2712 # Add, modify flows and check the updates.
2713 ovs-ofctl mod-flows br0 dl_vlan=121,actions=drop
2714 ovs-ofctl mod-flows br0 dl_vlan=122,actions=output:1,output:2
2715 ovs-appctl -t ovs-ofctl ofctl/barrier
2717 ovs-ofctl mod-flows br0 dl_vlan=123,actions=output:1,output:2
2718 ovs-appctl -t ovs-ofctl ofctl/barrier
2720 ovs-ofctl mod-flows br0 dl_vlan=122,actions=output:1
2721 ovs-appctl -t ovs-ofctl ofctl/barrier
2722 ovs-ofctl mod-flows br0 dl_vlan=123,actions=output:2
2723 ovs-appctl -t ovs-ofctl ofctl/barrier
2725 AT_CHECK([sed 's/ (xid=0x[[1-9a-fA-F]][[0-9a-fA-F]]*)//' monitor.log], [0],
2726 [NXST_FLOW_MONITOR reply (xid=0x0):
2727 event=MODIFIED table=0 cookie=0 in_port=0,dl_vlan=122 actions=output:1,output:2
2729 NXST_FLOW_MONITOR reply (xid=0x0):
2730 event=MODIFIED table=0 cookie=0 in_port=0,dl_vlan=123 actions=output:1,output:2
2732 NXST_FLOW_MONITOR reply (xid=0x0):
2733 event=MODIFIED table=0 cookie=0 in_port=0,dl_vlan=122 actions=output:1
2735 NXST_FLOW_MONITOR reply (xid=0x0):
2736 event=MODIFIED table=0 cookie=0 in_port=0,dl_vlan=123 actions=output:2
2740 ovs-appctl -t ovs-ofctl exit
2744 AT_SETUP([ofproto - flow monitoring pause and resume])
2745 AT_KEYWORDS([monitor])
2747 # The maximum socket receive buffer size is important for this test, which
2748 # tests behavior when the receive buffer overflows.
2749 if test -e /proc/sys/net/core/rmem_max; then
2751 rmem_max=`cat /proc/sys/net/core/rmem_max`
2752 elif rmem_max=`sysctl -n net.inet.tcp.recvbuf_max 2>/dev/null`; then
2755 # Don't know how to get maximum socket receive buffer on this OS
2758 # Calculate the total amount of queuing: rmem_max in the kernel, 128 kB
2759 # in ofproto sending userspace (see ofmonitor_flush() in connmgr.c).
2760 queue_size=`expr $rmem_max + 128 \* 1024`
2761 echo rmem_max=$rmem_max queue_size=$queue_size
2763 # If there's too much queuing skip the test to avoid timing out.
2764 AT_SKIP_IF([test $rmem_max -gt 1048576])
2766 # Each flow update message takes up at least 48 bytes of space in queues
2767 # and in practice more than that.
2768 n_msgs=`expr $queue_size / 48`
2773 # Start a monitor watching the flow table, then make it block.
2774 ON_EXIT([kill `cat ovs-ofctl.pid`])
2775 ovs-ofctl monitor br0 watch: --detach --no-chdir --pidfile >monitor.log 2>&1
2776 AT_CAPTURE_FILE([monitor.log])
2777 ovs-appctl -t ovs-ofctl ofctl/block
2779 # Add $n_msgs flows.
2780 (echo "in_port=2,actions=output:2"
2782 for ($i = 0; $i < '$n_msgs'; $i++) {
2783 print "cookie=1,reg1=$i,actions=drop\n";
2786 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
2787 # Check that multipart flow dumps work properly:
2788 AT_CHECK([ovs-ofctl diff-flows br0 flows.txt])
2789 AT_CHECK([ovs-ofctl add-flow br0 in_port=1,cookie=3,actions=drop])
2790 AT_CHECK([ovs-ofctl mod-flows br0 in_port=2,cookie=2,actions=output:2])
2791 AT_CHECK([ovs-ofctl del-flows br0 cookie=1/-1])
2793 ovs-appctl -t ovs-ofctl ofctl/unblock
2795 # Wait for the connection resumed.
2796 # A barrier doesn't work for this purpose.
2797 # https://www.mail-archive.com/dev@openvswitch.org/msg27013.html
2798 # https://www.mail-archive.com/dev@openvswitch.org/msg27675.html
2799 OVS_WAIT_UNTIL([grep NXT_FLOW_MONITOR_RESUMED monitor.log])
2801 ovs-appctl -t ovs-ofctl exit
2803 # Check that the flow monitor reported the same number of flows
2804 # added and deleted, but fewer than we actually added and deleted.
2805 adds=`grep -c 'ADDED.*reg1=' monitor.log`
2806 deletes=`grep -c 'DELETED.*reg1=' monitor.log`
2807 echo adds=$adds deletes=$deletes
2808 AT_CHECK([test $adds -gt 100 && test $adds -lt $n_msgs])
2809 AT_CHECK([test $adds = $deletes])
2811 # Check that the flow monitor reported everything in the expected order:
2813 # event=ADDED table=0 cookie=0x1 reg1=0x22
2815 # NXT_FLOW_MONITOR_PAUSED:
2817 # event=DELETED reason=delete table=0 cookie=0x1 reg1=0x22
2819 # event=ADDED table=0 cookie=0x3 in_port=1
2820 # event=MODIFIED table=0 cookie=0x2 in_port=2 actions=output:2
2821 # NXT_FLOW_MONITOR_RESUMED:
2823 # except that, between the PAUSED and RESUMED, the order of the ADDED
2824 # and MODIFIED lines lines depends on hash order, that is, it varies
2825 # as we change the hash function or change architecture. Therefore,
2826 # we use a couple of tests below to accept both orders.
2827 AT_CHECK([ofctl_strip < monitor.log | sed -n -e '
2830 /NXT_FLOW_MONITOR_PAUSED:/p
2831 /NXT_FLOW_MONITOR_RESUMED:/p
2832 ' > monitor.log.subset])
2833 AT_CHECK([grep -v MODIFIED monitor.log.subset], [0], [dnl
2834 event=ADDED table=0 cookie=0x1 reg1=0x22
2835 NXT_FLOW_MONITOR_PAUSED:
2836 event=DELETED reason=delete table=0 cookie=0x1 reg1=0x22
2837 event=ADDED table=0 cookie=0x3 in_port=1
2838 NXT_FLOW_MONITOR_RESUMED:
2840 AT_CHECK([grep -v ADDED monitor.log.subset], [0], [dnl
2841 NXT_FLOW_MONITOR_PAUSED:
2842 event=DELETED reason=delete table=0 cookie=0x1 reg1=0x22
2843 event=MODIFIED table=0 cookie=0x2 in_port=2 actions=output:2
2844 NXT_FLOW_MONITOR_RESUMED:
2850 AT_SETUP([ofproto - event filtering (OpenFlow 1.3)])
2851 AT_KEYWORDS([monitor])
2854 # Start a monitor, use the required protocol version
2855 ovs-ofctl -O OpenFlow13 monitor br0 --detach --no-chdir --pidfile >monitor.log 2>&1
2856 AT_CAPTURE_FILE([monitor.log])
2858 # Send an OpenFlow13 message (04), OFPT_GET_ASYNC_REQUEST (1a), length (8), xid (0a)
2859 ovs-appctl -t ovs-ofctl ofctl/send 041a00080000000a
2860 ovs-appctl -t ovs-ofctl ofctl/barrier
2862 # Check default setting
2863 read -r -d '' expected <<'EOF'
2866 AT_CHECK([ofctl_strip < monitor.log], [], [dnl
2867 send: OFPT_GET_ASYNC_REQUEST (OF1.3):
2868 OFPT_GET_ASYNC_REPLY (OF1.3):
2870 PACKET_IN: no_match action
2871 PORT_STATUS: add delete modify
2872 FLOW_REMOVED: idle hard delete
2876 PORT_STATUS: add delete modify
2878 OFPT_BARRIER_REPLY (OF1.3):
2884 AT_SETUP([ofproto - ofport_request])
2886 ADD_OF_PORTS([br0], [1], [2], [3])
2888 set_and_check_specific_ofports () {
2889 ovs-vsctl set Interface p1 ofport_request="$1" -- \
2890 set Interface p2 ofport_request="$2" -- \
2891 set Interface p3 ofport_request="$3"
2892 ofports=`ovs-vsctl get Interface p1 ofport -- \
2893 get Interface p2 ofport -- \
2894 get Interface p3 ofport`
2895 AT_CHECK_UNQUOTED([echo $ofports], [0], [$1 $2 $3
2898 for pre in '1 2 3' '1 3 2' '2 1 3' '2 3 1' '3 1 2' '3 2 1'; do
2899 for post in '1 2 3' '1 3 2' '2 1 3' '2 3 1' '3 1 2' '3 2 1'; do
2900 echo -----------------------------------------------------------
2901 echo "Check changing port numbers from $pre to $post"
2902 set_and_check_specific_ofports $pre
2903 set_and_check_specific_ofports $post
2907 ovs-vsctl del-port p3
2909 set_and_check_poorly_specified_ofports () {
2910 ovs-vsctl set Interface p1 ofport_request="$1" -- \
2911 set Interface p2 ofport_request="$2"
2912 p1=`ovs-vsctl get Interface p1 ofport`
2913 p2=`ovs-vsctl get Interface p2 ofport`
2916 AT_CHECK([test "$p1" != "$p2"])
2917 if test "$1" = "$2" && test "$1" != '[[]]'; then
2918 # One port number must be the requested one.
2919 AT_CHECK([test "$p1" = "$1" || test "$p2" = "$1"])
2920 # The other port number must be different (already tested above).
2922 AT_CHECK([test "$1" = '[[]]' || test "$p1" == "$1"])
2923 AT_CHECK([test "$2" = '[[]]' || test "$p2" == "$2"])
2926 for pre in '1 2' '[[]] 2' '1 [[]]' '[[]] [[]]' '2 1' '[[]] 1' '2 [[]]' \
2928 for post in '1 2' '[[]] 2' '1 [[]]' '[[]] [[]]' '2 1' '[[]] 1' '2 [[]]' \
2930 echo -----------------------------------------------------------
2931 echo "Check changing port numbers from $pre to $post"
2932 set_and_check_poorly_specified_ofports $pre
2933 set_and_check_poorly_specified_ofports $post
2940 AT_SETUP([ofproto - bundles, open (OpenFlow 1.4)])
2941 AT_KEYWORDS([monitor])
2944 # Start a monitor, use the required protocol version
2945 ovs-ofctl -O OpenFlow14 monitor br0 --detach --no-chdir --pidfile >monitor.log 2>&1
2946 AT_CAPTURE_FILE([monitor.log])
2948 # Send an OpenFlow14 message (05), OFPT_BUNDLE_CONTROL (21), length (10), xid (0a)
2949 ovs-appctl -t ovs-ofctl ofctl/send "05 21 00 10 00 00 00 0a 00 00 00 01 00 00 00 01"
2950 ovs-appctl -t ovs-ofctl ofctl/barrier
2951 ovs-appctl -t ovs-ofctl exit
2953 AT_CHECK([ofctl_strip < monitor.log], [], [dnl
2954 send: OFPT_BUNDLE_CONTROL (OF1.4):
2955 bundle_id=0x1 type=OPEN_REQUEST flags=atomic
2956 OFPT_BUNDLE_CONTROL (OF1.4):
2957 bundle_id=0x1 type=OPEN_REPLY flags=0
2958 OFPT_BARRIER_REPLY (OF1.4):
2964 AT_SETUP([ofproto - bundles, double open (OpenFlow 1.4)])
2965 AT_KEYWORDS([monitor])
2968 # Start a monitor, use the required protocol version
2969 ovs-ofctl -O OpenFlow14 monitor br0 --detach --no-chdir --pidfile >monitor.log 2>&1
2970 AT_CAPTURE_FILE([monitor.log])
2972 # Send twice an OpenFlow14 message (05), OFPT_BUNDLE_CONTROL (21), length (10), xid (0a)
2973 ovs-appctl -t ovs-ofctl ofctl/send "05 21 00 10 00 00 00 0a 00 00 00 01 00 00 00 01"
2974 ovs-appctl -t ovs-ofctl ofctl/barrier
2975 ovs-appctl -t ovs-ofctl ofctl/send "05 21 00 10 00 00 00 0a 00 00 00 01 00 00 00 01"
2976 ovs-appctl -t ovs-ofctl ofctl/barrier
2977 ovs-appctl -t ovs-ofctl exit
2979 AT_CHECK([ofctl_strip < monitor.log], [0], [dnl
2980 send: OFPT_BUNDLE_CONTROL (OF1.4):
2981 bundle_id=0x1 type=OPEN_REQUEST flags=atomic
2982 OFPT_BUNDLE_CONTROL (OF1.4):
2983 bundle_id=0x1 type=OPEN_REPLY flags=0
2984 OFPT_BARRIER_REPLY (OF1.4):
2985 send: OFPT_BUNDLE_CONTROL (OF1.4):
2986 bundle_id=0x1 type=OPEN_REQUEST flags=atomic
2987 OFPT_ERROR (OF1.4): OFPBFC_BAD_ID
2988 OFPT_BUNDLE_CONTROL (OF1.4):
2989 bundle_id=0x1 type=OPEN_REQUEST flags=atomic
2990 OFPT_BARRIER_REPLY (OF1.4):
2996 AT_SETUP([ofproto - bundle close without open (OpenFlow 1.4)])
2997 AT_KEYWORDS([monitor])
3000 # Start a monitor, use the required protocol version
3001 ovs-ofctl -O OpenFlow14 monitor br0 --detach --no-chdir --pidfile >monitor.log 2>&1
3002 AT_CAPTURE_FILE([monitor.log])
3004 ovs-appctl -t ovs-ofctl ofctl/send "05 21 00 10 00 00 00 0a 00 00 00 01 00 02 00 01"
3005 ovs-appctl -t ovs-ofctl ofctl/barrier
3006 ovs-appctl -t ovs-ofctl exit
3008 AT_CHECK([ofctl_strip < monitor.log], [0], [dnl
3009 send: OFPT_BUNDLE_CONTROL (OF1.4):
3010 bundle_id=0x1 type=CLOSE_REQUEST flags=atomic
3011 OFPT_ERROR (OF1.4): OFPBFC_BAD_ID
3012 OFPT_BUNDLE_CONTROL (OF1.4):
3013 bundle_id=0x1 type=CLOSE_REQUEST flags=atomic
3014 OFPT_BARRIER_REPLY (OF1.4):
3020 AT_SETUP([ofproto - bundle double close (OpenFlow 1.4)])
3021 AT_KEYWORDS([monitor])
3024 # Start a monitor, use the required protocol version
3025 ovs-ofctl -O OpenFlow14 monitor br0 --detach --no-chdir --pidfile >monitor.log 2>&1
3026 AT_CAPTURE_FILE([monitor.log])
3028 # Open, Close, Close
3029 ovs-appctl -t ovs-ofctl ofctl/send "05 21 00 10 00 00 00 0a 00 00 00 01 00 00 00 01"
3030 ovs-appctl -t ovs-ofctl ofctl/barrier
3031 ovs-appctl -t ovs-ofctl ofctl/send "05 21 00 10 00 00 00 0a 00 00 00 01 00 02 00 01"
3032 ovs-appctl -t ovs-ofctl ofctl/barrier
3033 ovs-appctl -t ovs-ofctl ofctl/send "05 21 00 10 00 00 00 0a 00 00 00 01 00 02 00 01"
3034 ovs-appctl -t ovs-ofctl ofctl/barrier
3035 ovs-appctl -t ovs-ofctl exit
3037 AT_CHECK([ofctl_strip < monitor.log], [0], [dnl
3038 send: OFPT_BUNDLE_CONTROL (OF1.4):
3039 bundle_id=0x1 type=OPEN_REQUEST flags=atomic
3040 OFPT_BUNDLE_CONTROL (OF1.4):
3041 bundle_id=0x1 type=OPEN_REPLY flags=0
3042 OFPT_BARRIER_REPLY (OF1.4):
3043 send: OFPT_BUNDLE_CONTROL (OF1.4):
3044 bundle_id=0x1 type=CLOSE_REQUEST flags=atomic
3045 OFPT_BUNDLE_CONTROL (OF1.4):
3046 bundle_id=0x1 type=CLOSE_REPLY flags=0
3047 OFPT_BARRIER_REPLY (OF1.4):
3048 send: OFPT_BUNDLE_CONTROL (OF1.4):
3049 bundle_id=0x1 type=CLOSE_REQUEST flags=atomic
3050 OFPT_ERROR (OF1.4): OFPBFC_BUNDLE_CLOSED
3051 OFPT_BUNDLE_CONTROL (OF1.4):
3052 bundle_id=0x1 type=CLOSE_REQUEST flags=atomic
3053 OFPT_BARRIER_REPLY (OF1.4):
3059 AT_SETUP([ofproto - bundle close, different flags (OpenFlow 1.4)])
3060 AT_KEYWORDS([monitor])
3063 # Start a monitor, use the required protocol version
3064 ovs-ofctl -O OpenFlow14 monitor br0 --detach --no-chdir --pidfile >monitor.log 2>&1
3065 AT_CAPTURE_FILE([monitor.log])
3067 # Open, Close, Close
3068 ovs-appctl -t ovs-ofctl ofctl/send "05 21 00 10 00 00 00 0a 00 00 00 01 00 00 00 01"
3069 ovs-appctl -t ovs-ofctl ofctl/barrier
3070 ovs-appctl -t ovs-ofctl ofctl/send "05 21 00 10 00 00 00 0a 00 00 00 01 00 02 00 02"
3071 ovs-appctl -t ovs-ofctl ofctl/barrier
3072 ovs-appctl -t ovs-ofctl exit
3074 AT_CHECK([ofctl_strip < monitor.log], [0], [dnl
3075 send: OFPT_BUNDLE_CONTROL (OF1.4):
3076 bundle_id=0x1 type=OPEN_REQUEST flags=atomic
3077 OFPT_BUNDLE_CONTROL (OF1.4):
3078 bundle_id=0x1 type=OPEN_REPLY flags=0
3079 OFPT_BARRIER_REPLY (OF1.4):
3080 send: OFPT_BUNDLE_CONTROL (OF1.4):
3081 bundle_id=0x1 type=CLOSE_REQUEST flags=ordered
3082 OFPT_ERROR (OF1.4): OFPBFC_BAD_FLAGS
3083 OFPT_BUNDLE_CONTROL (OF1.4):
3084 bundle_id=0x1 type=CLOSE_REQUEST flags=ordered
3085 OFPT_BARRIER_REPLY (OF1.4):
3091 AT_SETUP([ofproto - bundle commit without open (OpenFlow 1.4)])
3092 AT_KEYWORDS([monitor])
3095 # Start a monitor, use the required protocol version
3096 ovs-ofctl -O OpenFlow14 monitor br0 --detach --no-chdir --pidfile >monitor.log 2>&1
3097 AT_CAPTURE_FILE([monitor.log])
3099 # Open, Close, Close
3100 ovs-appctl -t ovs-ofctl ofctl/send "05 21 00 10 00 00 00 0a 00 00 00 01 00 04 00 01"
3101 ovs-appctl -t ovs-ofctl ofctl/barrier
3102 ovs-appctl -t ovs-ofctl exit
3104 AT_CHECK([ofctl_strip < monitor.log], [0], [dnl
3105 send: OFPT_BUNDLE_CONTROL (OF1.4):
3106 bundle_id=0x1 type=COMMIT_REQUEST flags=atomic
3107 OFPT_ERROR (OF1.4): OFPBFC_BAD_ID
3108 OFPT_BUNDLE_CONTROL (OF1.4):
3109 bundle_id=0x1 type=COMMIT_REQUEST flags=atomic
3110 OFPT_BARRIER_REPLY (OF1.4):
3116 AT_SETUP([ofproto - bundle commit, different flags (OpenFlow 1.4)])
3117 AT_KEYWORDS([monitor])
3120 # Start a monitor, use the required protocol version
3121 ovs-ofctl -O OpenFlow14 monitor br0 --detach --no-chdir --pidfile >monitor.log 2>&1
3122 AT_CAPTURE_FILE([monitor.log])
3124 # Open, Close, Close
3125 ovs-appctl -t ovs-ofctl ofctl/send "05 21 00 10 00 00 00 0a 00 00 00 01 00 00 00 01"
3126 ovs-appctl -t ovs-ofctl ofctl/barrier
3127 ovs-appctl -t ovs-ofctl ofctl/send "05 21 00 10 00 00 00 0a 00 00 00 01 00 04 00 02"
3128 ovs-appctl -t ovs-ofctl ofctl/barrier
3129 ovs-appctl -t ovs-ofctl exit
3131 AT_CHECK([ofctl_strip < monitor.log], [0], [dnl
3132 send: OFPT_BUNDLE_CONTROL (OF1.4):
3133 bundle_id=0x1 type=OPEN_REQUEST flags=atomic
3134 OFPT_BUNDLE_CONTROL (OF1.4):
3135 bundle_id=0x1 type=OPEN_REPLY flags=0
3136 OFPT_BARRIER_REPLY (OF1.4):
3137 send: OFPT_BUNDLE_CONTROL (OF1.4):
3138 bundle_id=0x1 type=COMMIT_REQUEST flags=ordered
3139 OFPT_ERROR (OF1.4): OFPBFC_BAD_FLAGS
3140 OFPT_BUNDLE_CONTROL (OF1.4):
3141 bundle_id=0x1 type=COMMIT_REQUEST flags=ordered
3142 OFPT_BARRIER_REPLY (OF1.4):
3148 AT_SETUP([ofproto - bundle discard without open (OpenFlow 1.4)])
3149 AT_KEYWORDS([monitor])
3152 # Start a monitor, use the required protocol version
3153 ovs-ofctl -O OpenFlow14 monitor br0 --detach --no-chdir --pidfile >monitor.log 2>&1
3154 AT_CAPTURE_FILE([monitor.log])
3156 # Open, Close, Close
3157 ovs-appctl -t ovs-ofctl ofctl/send "05 21 00 10 00 00 00 0a 00 00 00 01 00 06 00 01"
3158 ovs-appctl -t ovs-ofctl ofctl/barrier
3159 ovs-appctl -t ovs-ofctl exit
3161 AT_CHECK([ofctl_strip < monitor.log], [0], [dnl
3162 send: OFPT_BUNDLE_CONTROL (OF1.4):
3163 bundle_id=0x1 type=DISCARD_REQUEST flags=atomic
3164 OFPT_ERROR (OF1.4): OFPBFC_BAD_ID
3165 OFPT_BUNDLE_CONTROL (OF1.4):
3166 bundle_id=0x1 type=DISCARD_REQUEST flags=atomic
3167 OFPT_BARRIER_REPLY (OF1.4):