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 SET_VLAN_VID SET_VLAN_PCP STRIP_VLAN SET_DL_SRC SET_DL_DST SET_NW_SRC SET_NW_DST SET_NW_TOS SET_TP_SRC SET_TP_DST ENQUEUE
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 SET_VLAN_VID SET_VLAN_PCP STRIP_VLAN SET_DL_SRC SET_DL_DST SET_NW_SRC SET_NW_DST SET_NW_TOS SET_TP_SRC SET_TP_DST ENQUEUE
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 dnl This is really bare-bones.
148 dnl It at least checks request and reply serialization and deserialization.
149 AT_SETUP([ofproto - queue stats - (OpenFlow 1.0)])
151 AT_CHECK([ovs-ofctl -vwarn queue-stats br0], [0], [stdout])
152 AT_CHECK([STRIP_XIDS stdout], [0], [dnl
153 OFPST_QUEUE reply: 0 queues
155 AT_CHECK([ovs-ofctl -vwarn queue-stats br0 ANY 5], [0],
156 [OFPT_ERROR (xid=0x2): OFPQOFC_BAD_QUEUE
157 OFPST_QUEUE request (xid=0x2):port=ANY queue=5
159 AT_CHECK([ovs-ofctl -vwarn queue-stats br0 10], [0],
160 [OFPT_ERROR (xid=0x2): OFPQOFC_BAD_PORT
161 OFPST_QUEUE request (xid=0x2):port=10 queue=ALL
166 AT_SETUP([ofproto - queue stats - (OpenFlow 1.2)])
168 AT_CHECK([ovs-ofctl -O OpenFlow12 -vwarn queue-stats br0], [0], [stdout])
169 AT_CHECK([STRIP_XIDS stdout], [0], [dnl
170 OFPST_QUEUE reply (OF1.2): 0 queues
172 AT_CHECK([ovs-ofctl -O OpenFlow12 -vwarn queue-stats br0 ALL 5], [0],
173 [OFPT_ERROR (OF1.2) (xid=0x2): OFPQOFC_BAD_QUEUE
174 OFPST_QUEUE request (OF1.2) (xid=0x2):port=ANY queue=5
176 AT_CHECK([ovs-ofctl -O OpenFlow12 -vwarn queue-stats br0 10], [0],
177 [OFPT_ERROR (OF1.2) (xid=0x2): OFPQOFC_BAD_PORT
178 OFPST_QUEUE request (OF1.2) (xid=0x2):port=10 queue=ALL
183 dnl This is really bare-bones.
184 dnl It at least checks request and reply serialization and deserialization.
185 AT_SETUP([ofproto - queue configuration - (OpenFlow 1.0)])
187 ADD_OF_PORTS([br0], [1], [2])
188 AT_CHECK([ovs-ofctl queue-get-config br0 1], [0], [stdout])
189 AT_CHECK([STRIP_XIDS stdout], [0], [dnl
190 OFPT_QUEUE_GET_CONFIG_REPLY: port=1
192 AT_CHECK([ovs-ofctl queue-get-config br0 10], [0],
193 [OFPT_ERROR (xid=0x2): OFPQOFC_BAD_PORT
194 OFPT_QUEUE_GET_CONFIG_REQUEST (xid=0x2): port=10
199 AT_SETUP([ofproto - queue configuration - (OpenFlow 1.2)])
201 ADD_OF_PORTS([br0], [1], [2])
202 AT_CHECK([ovs-ofctl -O OpenFlow12 queue-get-config br0 1], [0], [stdout])
203 AT_CHECK([STRIP_XIDS stdout], [0], [dnl
204 OFPT_QUEUE_GET_CONFIG_REPLY (OF1.2): port=1
206 AT_CHECK([ovs-ofctl -O OpenFlow12 queue-get-config br0 10], [0],
207 [OFPT_ERROR (OF1.2) (xid=0x2): OFPQOFC_BAD_PORT
208 OFPT_QUEUE_GET_CONFIG_REQUEST (OF1.2) (xid=0x2): port=10
213 dnl This is really bare-bones.
214 dnl It at least checks request and reply serialization and deserialization.
215 AT_SETUP([ofproto - del group])
217 AT_DATA([groups.txt], [dnl
218 group_id=1234,type=all,bucket=output:10
219 group_id=1235,type=all,bucket=output:10
221 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn add-groups br0 groups.txt])
222 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn del-groups br0 group_id=1234])
223 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn dump-groups br0], [0], [stdout])
224 AT_CHECK([STRIP_XIDS stdout], [0], [dnl
225 OFPST_GROUP_DESC reply (OF1.1):
226 group_id=1235,type=all,bucket=actions=output:10
228 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn del-groups br0 group_id=1234])
229 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn dump-groups br0], [0], [stdout])
230 AT_CHECK([STRIP_XIDS stdout], [0], [dnl
231 OFPST_GROUP_DESC reply (OF1.1):
232 group_id=1235,type=all,bucket=actions=output:10
234 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn del-groups br0], [0])
235 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn dump-groups br0], [0], [stdout])
236 AT_CHECK([STRIP_XIDS stdout], [0], [dnl
237 OFPST_GROUP_DESC reply (OF1.1):
242 dnl This is really bare-bones.
243 dnl It at least checks request and reply serialization and deserialization.
244 AT_SETUP([ofproto - del group deletes flows])
246 AT_DATA([groups.txt], [dnl
247 group_id=1234,type=all,bucket=output:10
248 group_id=1235,type=all,bucket=output:10
250 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn add-groups br0 groups.txt])
251 AT_DATA([flows.txt], [dnl
252 tcp actions=group:1234
253 udp actions=group:1235
255 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn add-flows br0 flows.txt])
256 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn dump-flows br0 | ofctl_strip | sort],
258 tcp actions=group:1234
259 udp actions=group:1235
260 OFPST_FLOW reply (OF1.1):
262 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn del-groups br0 group_id=1234])
263 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn dump-flows br0 | ofctl_strip | sort],
265 udp actions=group:1235
266 OFPST_FLOW reply (OF1.1):
268 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn del-groups br0 group_id=1234])
269 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn dump-flows br0 | ofctl_strip | sort],
271 udp actions=group:1235
272 OFPST_FLOW reply (OF1.1):
274 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn del-groups br0])
275 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn dump-flows br0 | ofctl_strip | sort],
277 OFPST_FLOW reply (OF1.1):
282 dnl This is really bare-bones.
283 dnl It at least checks request and reply serialization and deserialization.
284 AT_SETUP([ofproto - flow mod checks group availability])
286 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn add-group br0 group_id=1234,type=all,bucket=output:10])
287 AT_DATA([flows.txt], [dnl
288 tcp actions=group:1234
289 udp actions=group:1235
291 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn add-flow br0 'tcp actions=group:1234'])
292 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn add-flow br0 'tcp actions=group:1235'], [1], [], [stderr])
294 # The output should look like this:
296 # 00000000 02 0e 00 98 00 00 00 02-00 00 00 00 00 00 00 00 |................|
297 # 00000010 00 00 00 00 00 00 00 00-ff 00 00 00 00 00 80 00 |................|
298 # 00000020 ff ff ff ff ff ff ff ff-ff ff ff ff 00 00 00 00 |................|
299 # 00000030 00 00 00 58 00 00 00 00-00 00 03 d7 00 00 00 00 |...X............|
301 # This 'sed' command captures the error message but drops details.
302 AT_CHECK([sed '/truncated/d
303 /^000000.0/d' stderr | STRIP_XIDS], [0],
304 [OFPT_ERROR (OF1.1): OFPBAC_BAD_OUT_GROUP
305 OFPT_FLOW_MOD (OF1.1):
310 dnl This is really bare-bones.
311 dnl It at least checks request and reply serialization and deserialization.
312 AT_SETUP([ofproto - group description])
314 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn add-group br0 group_id=1234,type=all,bucket=output:10], [0], [stdout])
315 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn dump-groups br0], [0], [stdout])
316 AT_CHECK([STRIP_XIDS stdout], [0], [dnl
317 OFPST_GROUP_DESC reply (OF1.1):
318 group_id=1234,type=all,bucket=actions=output:10
323 dnl This is really bare-bones.
324 dnl It at least checks request and reply serialization and deserialization.
325 AT_SETUP([ofproto - group description])
327 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn add-group br0 group_id=1234,type=all,bucket=output:10])
328 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn dump-groups br0], [0], [stdout])
329 AT_CHECK([STRIP_XIDS stdout], [0], [dnl
330 OFPST_GROUP_DESC reply (OF1.1):
331 group_id=1234,type=all,bucket=actions=output:10
336 dnl This is really bare-bones.
337 dnl It at least checks request and reply serialization and deserialization.
338 AT_SETUP([ofproto - group features])
340 AT_CHECK([ovs-ofctl -O OpenFlow12 -vwarn dump-group-features br0], [0], [stdout])
341 AT_CHECK([STRIP_XIDS stdout], [0], [dnl
342 OFPST_GROUP_FEATURES reply (OF1.2):
350 dnl This is really bare-bones.
351 dnl It at least checks request and reply serialization and deserialization.
352 AT_SETUP([ofproto - group stats])
354 AT_DATA([groups.txt], [dnl
355 group_id=1234,type=all,bucket=output:10
356 group_id=1235,type=all,bucket=output:10
358 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn add-groups br0 groups.txt])
359 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn add-flow br0 'tcp actions=group:1234'])
360 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn dump-group-stats br0 group_id=1234], [0], [stdout])
361 AT_CHECK([STRIP_XIDS stdout | sort], [0], [dnl
362 group_id=1234,ref_count=1,packet_count=0,byte_count=0,bucket0:packet_count=0,byte_count=0
363 OFPST_GROUP reply (OF1.1):
365 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn dump-group-stats br0], [0], [stdout])
366 AT_CHECK([STRIP_XIDS stdout | sort], [0], [dnl
367 group_id=1234,ref_count=1,packet_count=0,byte_count=0,bucket0:packet_count=0,byte_count=0
368 group_id=1235,ref_count=0,packet_count=0,byte_count=0,bucket0:packet_count=0,byte_count=0
369 OFPST_GROUP reply (OF1.1):
374 AT_SETUP([ofproto - mod-port (OpenFlow 1.0)])
376 for command_config_state in \
378 'noflood NO_FLOOD 0' \
379 'down PORT_DOWN,NO_FLOOD LINK_DOWN' \
380 'flood PORT_DOWN LINK_DOWN' \
381 'no-receive PORT_DOWN,NO_RECV LINK_DOWN' \
382 'no-forward PORT_DOWN,NO_RECV,NO_FWD LINK_DOWN' \
383 'no-packet-in PORT_DOWN,NO_RECV,NO_FWD,NO_PACKET_IN LINK_DOWN' \
384 'forward PORT_DOWN,NO_RECV,NO_PACKET_IN LINK_DOWN' \
385 'packet-in PORT_DOWN,NO_RECV LINK_DOWN' \
389 set $command_config_state
390 command=$[1] config=`echo $[2] | sed 's/,/ /g'` state=$[3]
391 AT_CHECK([ovs-ofctl -vwarn mod-port br0 br0 $command])
392 AT_CHECK([ovs-ofctl -vwarn show br0], [0], [stdout])
393 AT_CHECK_UNQUOTED([STRIP_XIDS stdout], [0], [dnl
394 OFPT_FEATURES_REPLY: dpid:fedcba9876543210
395 n_tables:254, n_buffers:256
396 capabilities: FLOW_STATS TABLE_STATS PORT_STATS QUEUE_STATS ARP_MATCH_IP
397 actions: OUTPUT SET_VLAN_VID SET_VLAN_PCP STRIP_VLAN SET_DL_SRC SET_DL_DST SET_NW_SRC SET_NW_DST SET_NW_TOS SET_TP_SRC SET_TP_DST ENQUEUE
398 LOCAL(br0): addr:aa:55:aa:55:00:00
401 speed: 0 Mbps now, 0 Mbps max
402 OFPT_GET_CONFIG_REPLY: frags=normal miss_send_len=0
408 AT_SETUP([ofproto - mod-port (OpenFlow 1.2)])
410 for command_config_state in \
412 'down PORT_DOWN LINK_DOWN' \
413 'no-receive PORT_DOWN,NO_RECV LINK_DOWN' \
414 'no-forward PORT_DOWN,NO_RECV,NO_FWD LINK_DOWN' \
415 'no-packet-in PORT_DOWN,NO_RECV,NO_FWD,NO_PACKET_IN LINK_DOWN' \
416 'forward PORT_DOWN,NO_RECV,NO_PACKET_IN LINK_DOWN' \
417 'packet-in PORT_DOWN,NO_RECV LINK_DOWN' \
421 set $command_config_state
422 command=$[1] config=`echo $[2] | sed 's/,/ /g'` state=$[3]
423 AT_CHECK([ovs-ofctl -O OpenFlow12 -vwarn mod-port br0 br0 $command])
424 AT_CHECK([ovs-ofctl -O OpenFlow12 -vwarn show br0], [0], [stdout])
425 AT_CHECK_UNQUOTED([STRIP_XIDS stdout], [0], [dnl
426 OFPT_FEATURES_REPLY (OF1.2): dpid:fedcba9876543210
427 n_tables:254, n_buffers:256
428 capabilities: FLOW_STATS TABLE_STATS PORT_STATS QUEUE_STATS
429 LOCAL(br0): addr:aa:55:aa:55:00:00
432 speed: 0 Mbps now, 0 Mbps max
433 OFPT_GET_CONFIG_REPLY (OF1.2): frags=normal miss_send_len=0
439 AT_SETUP([ofproto - mod-port (OpenFlow 1.4)])
441 for command_config_state in \
443 'down PORT_DOWN LINK_DOWN' \
444 'no-receive PORT_DOWN,NO_RECV LINK_DOWN' \
445 'no-forward PORT_DOWN,NO_RECV,NO_FWD LINK_DOWN' \
446 'no-packet-in PORT_DOWN,NO_RECV,NO_FWD,NO_PACKET_IN LINK_DOWN' \
447 'forward PORT_DOWN,NO_RECV,NO_PACKET_IN LINK_DOWN' \
448 'packet-in PORT_DOWN,NO_RECV LINK_DOWN' \
452 set $command_config_state
453 command=$[1] config=`echo $[2] | sed 's/,/ /g'` state=$[3]
454 AT_CHECK([ovs-ofctl -O OpenFlow14 -vwarn mod-port br0 br0 $command])
455 AT_CHECK([ovs-ofctl -O OpenFlow14 -vwarn show br0], [0], [stdout])
456 AT_CHECK_UNQUOTED([STRIP_XIDS stdout], [0], [dnl
457 OFPT_FEATURES_REPLY (OF1.4): dpid:fedcba9876543210
458 n_tables:254, n_buffers:256
459 capabilities: FLOW_STATS TABLE_STATS PORT_STATS QUEUE_STATS
460 OFPST_PORT_DESC reply (OF1.4):
461 LOCAL(br0): addr:aa:55:aa:55:00:00
464 speed: 0 Mbps now, 0 Mbps max
465 OFPT_GET_CONFIG_REPLY (OF1.4): frags=normal miss_send_len=0
471 AT_SETUP([ofproto - basic flow_mod commands (NXM)])
473 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip], [0], [NXST_FLOW reply:
475 AT_CHECK([echo 'in_port=2,actions=1' | ovs-ofctl add-flows br0 -])
476 AT_CHECK([ovs-ofctl add-flow br0 in_port=1,actions=2])
477 AT_CHECK([ovs-ofctl -F nxm add-flow br0 table=1,in_port=4,actions=3])
478 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
479 in_port=1 actions=output:2
480 in_port=2 actions=output:1
481 table=1, in_port=4 actions=output:3
484 AT_CHECK([ovs-ofctl dump-aggregate br0 table=0 | STRIP_XIDS], [0], [dnl
485 NXST_AGGREGATE reply: packet_count=0 byte_count=0 flow_count=2
487 AT_CHECK([ovs-ofctl del-flows br0])
488 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip], [0], [NXST_FLOW reply:
493 AT_SETUP([ofproto - basic flow_mod commands (OpenFlow 1.0)])
495 AT_CHECK([ovs-ofctl -F openflow10 dump-flows br0 | ofctl_strip], [0], [OFPST_FLOW reply:
497 AT_CHECK([echo 'in_port=2,actions=1' | ovs-ofctl -F openflow10 add-flows br0 -])
498 AT_CHECK([ovs-ofctl -F openflow10 add-flow br0 in_port=1,actions=2])
499 AT_CHECK([ovs-ofctl -F openflow10 add-flow br0 table=1,in_port=4,actions=3])
500 AT_CHECK([ovs-ofctl -F openflow10 dump-flows br0 | ofctl_strip | sort], [0], [dnl
501 in_port=1 actions=output:2
502 in_port=2 actions=output:1
503 table=1, in_port=4 actions=output:3
506 AT_CHECK([ovs-ofctl -F openflow10 dump-aggregate br0 table=0 | STRIP_XIDS], [0], [dnl
507 OFPST_AGGREGATE reply: packet_count=0 byte_count=0 flow_count=2
509 AT_CHECK([ovs-ofctl -F openflow10 del-flows br0])
510 AT_CHECK([ovs-ofctl -F openflow10 dump-flows br0 | ofctl_strip], [0], [OFPST_FLOW reply:
515 AT_SETUP([ofproto - basic flow_mod commands (OpenFlow 1.1)])
517 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip], [0], [OFPST_FLOW reply (OF1.1):
519 AT_CHECK([echo 'in_port=2,actions=1' | ovs-ofctl -O OpenFlow11 add-flows br0 -])
520 AT_CHECK([ovs-ofctl -O OpenFlow11 add-flow br0 in_port=1,actions=2])
521 AT_CHECK([ovs-ofctl -O OpenFlow11 add-flow br0 table=1,in_port=4,actions=3])
522 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0], [dnl
523 in_port=1 actions=output:2
524 in_port=2 actions=output:1
525 table=1, in_port=4 actions=output:3
526 OFPST_FLOW reply (OF1.1):
528 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-aggregate br0 table=0 | STRIP_XIDS], [0], [dnl
529 OFPST_AGGREGATE reply (OF1.1): packet_count=0 byte_count=0 flow_count=2
531 AT_CHECK([ovs-ofctl -O OpenFlow11 del-flows br0])
532 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip], [0], [OFPST_FLOW reply (OF1.1):
533 table=1, in_port=4 actions=output:3
538 AT_SETUP([ofproto - flow_mod negative test (OpenFlow 1.1)])
540 [set bridge br0 protocols=OpenFlow10,OpenFlow11,OpenFlow12,OpenFlow13])
541 AT_CHECK([ovs-ofctl add-flow -O OpenFlow11 br0 table=1,action=goto_table:2])
543 # The error message here actually comes from ovs-ofctl, not from ovs-vswitchd,
544 # but at least it's the same code in ofpacts_check() that issues the error.
545 AT_CHECK([ovs-ofctl add-flow -O OpenFlow11 br0 table=1,action=goto_table:1],
547 [ovs-ofctl: actions are invalid with specified match (OFPBRC_BAD_TABLE_ID)
552 AT_SETUP([ofproto - set-field flow_mod commands (NXM)])
554 AT_CHECK([ovs-ofctl add-flow br0 ipv6,table=1,in_port=3,actions=drop])
555 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])
556 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
557 table=1, ipv6,in_port=3 actions=load:0xa6badbfffefe59fa->NXM_NX_IPV6_SRC[[0..63]],load:0xfe8001234567890a->NXM_NX_IPV6_SRC[[64..127]]
563 AT_SETUP([ofproto - basic flow_mod commands (OpenFlow 1.2)])
565 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip], [0], [OFPST_FLOW reply (OF1.2):
567 AT_CHECK([echo 'in_port=2,actions=1' | ovs-ofctl -O OpenFlow12 add-flows br0 -])
568 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 in_port=1,actions=2])
569 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 table=1,in_port=4,actions=3])
570 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
571 in_port=1 actions=output:2
572 in_port=2 actions=output:1
573 table=1, in_port=4 actions=output:3
574 OFPST_FLOW reply (OF1.2):
576 AT_CHECK([ovs-ofctl -O OpenFlow12 del-flows br0])
577 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip], [0], [OFPST_FLOW reply (OF1.2):
582 AT_SETUP([ofproto - dump flows with cookie])
584 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x1,in_port=1,actions=1])
585 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x2,in_port=2,actions=1])
586 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x3,in_port=3,actions=1])
587 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
588 cookie=0x1, in_port=1 actions=output:1
589 cookie=0x2, in_port=2 actions=output:1
590 cookie=0x3, in_port=3 actions=output:1
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=3
596 AT_CHECK([ovs-ofctl dump-flows br0 cookie=0x3/-1 | ofctl_strip | sort], [0], [dnl
597 cookie=0x3, in_port=3 actions=output:1
600 AT_CHECK([ovs-ofctl dump-aggregate br0 cookie=0x3/-1 | STRIP_XIDS], [0], [dnl
601 NXST_AGGREGATE reply: packet_count=0 byte_count=0 flow_count=1
606 AT_SETUP([ofproto - mod flow with cookie change (OpenFlow 1.0)])
608 AT_CHECK([ovs-ofctl -F openflow10 add-flow br0 cookie=0x1,in_port=1,actions=1])
609 AT_CHECK([ovs-ofctl -F openflow10 dump-flows br0 | ofctl_strip | sort], [0], [dnl
610 cookie=0x1, in_port=1 actions=output:1
614 AT_CHECK([ovs-ofctl -F openflow10 mod-flows br0 cookie=0x2,in_port=1,actions=1])
615 AT_CHECK([ovs-ofctl -F openflow10 dump-flows br0 | ofctl_strip | sort], [0], [dnl
616 cookie=0x2, in_port=1 actions=output:1
622 AT_SETUP([ofproto - mod flow with cookie change (NXM)])
624 AT_CHECK([ovs-ofctl -F nxm add-flow br0 cookie=0x1,in_port=1,actions=1])
625 AT_CHECK([ovs-ofctl -F nxm dump-flows br0 | ofctl_strip | sort], [0], [dnl
626 cookie=0x1, in_port=1 actions=output:1
630 AT_CHECK([ovs-ofctl -F nxm mod-flows br0 cookie=0x2,in_port=1,actions=1])
631 AT_CHECK([ovs-ofctl -F nxm dump-flows br0 | ofctl_strip | sort], [0], [dnl
632 cookie=0x2, in_port=1 actions=output:1
638 AT_SETUP([ofproto - no mod flow with cookie change (OpenFlow 1.1)])
640 AT_CHECK([ovs-ofctl -O OpenFlow11 add-flow br0 cookie=0x1,in_port=1,actions=1])
641 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0], [dnl
642 cookie=0x1, in_port=1 actions=output:1
643 OFPST_FLOW reply (OF1.1):
645 AT_CHECK([ovs-ofctl -O OpenFlow11 mod-flows br0 cookie=0x2,in_port=1,actions=1])
646 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0], [dnl
647 cookie=0x1, in_port=1 actions=output:1
648 OFPST_FLOW reply (OF1.1):
653 dnl The OpenFlow 1.2 spec states that the cookie may not be modified
654 AT_SETUP([ofproto - no mod flow with cookie change (OpenFlow 1.2)])
656 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 cookie=0x1,in_port=1,actions=1])
657 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
658 cookie=0x1, in_port=1 actions=output:1
659 OFPST_FLOW reply (OF1.2):
662 AT_CHECK([ovs-ofctl -O OpenFlow12 mod-flows br0 cookie=0x2,in_port=1,actions=1])
663 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
664 cookie=0x1, in_port=1 actions=output:1
665 OFPST_FLOW reply (OF1.2):
670 AT_SETUP([ofproto - mod flows based on cookie mask (OpenFlow 1.0)])
672 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x1,in_port=1,actions=1])
673 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x1,in_port=2,actions=1])
674 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x2,in_port=3,actions=1])
675 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
676 cookie=0x1, in_port=1 actions=output:1
677 cookie=0x1, in_port=2 actions=output:1
678 cookie=0x2, in_port=3 actions=output:1
682 AT_CHECK([ovs-ofctl -F nxm mod-flows br0 cookie=0x1/0xff,actions=4])
683 AT_CHECK([ovs-ofctl -F nxm dump-flows br0 | ofctl_strip | sort], [0], [dnl
684 cookie=0x1, in_port=1 actions=output:4
685 cookie=0x1, in_port=2 actions=output:4
686 cookie=0x2, in_port=3 actions=output:1
692 AT_SETUP([ofproto - mod flows based on cookie mask (OpenFlow 1.1)])
694 AT_CHECK([ovs-ofctl -O OpenFlow11 add-flow br0 cookie=0x1,in_port=1,actions=1])
695 AT_CHECK([ovs-ofctl -O OpenFlow11 add-flow br0 cookie=0x1,in_port=2,actions=1])
696 AT_CHECK([ovs-ofctl -O OpenFlow11 add-flow br0 cookie=0x2,in_port=3,actions=1])
697 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0], [dnl
698 cookie=0x1, in_port=1 actions=output:1
699 cookie=0x1, in_port=2 actions=output:1
700 cookie=0x2, in_port=3 actions=output:1
701 OFPST_FLOW reply (OF1.1):
704 AT_CHECK([ovs-ofctl -O OpenFlow11 mod-flows br0 cookie=0x1/0xff,actions=4])
705 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0], [dnl
706 cookie=0x1, in_port=1 actions=output:4
707 cookie=0x1, in_port=2 actions=output:4
708 cookie=0x2, in_port=3 actions=output:1
709 OFPST_FLOW reply (OF1.1):
714 AT_SETUP([ofproto - mod flows based on cookie mask (OpenFlow 1.2)])
716 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 cookie=0x1,in_port=1,actions=1])
717 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 cookie=0x1,in_port=2,actions=1])
718 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 cookie=0x2,in_port=3,actions=1])
719 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
720 cookie=0x1, in_port=1 actions=output:1
721 cookie=0x1, in_port=2 actions=output:1
722 cookie=0x2, in_port=3 actions=output:1
723 OFPST_FLOW reply (OF1.2):
726 AT_CHECK([ovs-ofctl -O OpenFlow12 mod-flows br0 cookie=0x1/0xff,actions=4])
727 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
728 cookie=0x1, in_port=1 actions=output:4
729 cookie=0x1, in_port=2 actions=output:4
730 cookie=0x2, in_port=3 actions=output:1
731 OFPST_FLOW reply (OF1.2):
736 dnl The OpenFlow 1.2 spec states that the cookie may not be modified
737 AT_SETUP([ofproto - mod flows based on cookie mask with cookie change])
739 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x1,in_port=1,actions=1])
740 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x1,in_port=2,actions=1])
741 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x2,in_port=3,actions=1])
742 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
743 cookie=0x1, in_port=1 actions=output:1
744 cookie=0x1, in_port=2 actions=output:1
745 cookie=0x2, in_port=3 actions=output:1
749 AT_CHECK([ovs-ofctl -F nxm mod-flows br0 cookie=1/-1,cookie=4,actions=4])
750 AT_CHECK([ovs-ofctl -F nxm dump-flows br0 | ofctl_strip | sort], [0], [dnl
751 cookie=0x2, in_port=3 actions=output:1
752 cookie=0x4, in_port=1 actions=output:4
753 cookie=0x4, in_port=2 actions=output:4
759 AT_SETUP([ofproto - mod flow with cookie miss (mask==0) - NXM])
761 AT_CHECK([ovs-ofctl -F nxm mod-flows br0 in_port=1,actions=1])
762 AT_CHECK([ovs-ofctl -F nxm dump-flows br0 | ofctl_strip | sort], [0], [dnl
763 in_port=1 actions=output:1
769 AT_SETUP([ofproto - mod flow with cookie miss (mask==0) - OF1.1])
771 AT_CHECK([ovs-ofctl -O openflow11 mod-flows br0 in_port=1,actions=1])
772 AT_CHECK([ovs-ofctl -O openflow11 dump-flows br0 | ofctl_strip | sort], [0], [dnl
773 in_port=1 actions=output:1
774 OFPST_FLOW reply (OF1.1):
779 AT_SETUP([ofproto - mod flow with cookie miss (mask==0) - OF1.2])
781 AT_CHECK([ovs-ofctl -O openflow12 mod-flows br0 in_port=1,actions=1])
782 AT_CHECK([ovs-ofctl -O openflow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
783 OFPST_FLOW reply (OF1.2):
788 AT_SETUP([ofproto - mod flow with cookie miss (mask!=0) - NXM])
790 AT_CHECK([ovs-ofctl -F nxm mod-flows br0 cookie=1/1,in_port=1,actions=1])
791 AT_CHECK([ovs-ofctl -F nxm dump-flows br0 | ofctl_strip | sort], [0], [dnl
797 AT_SETUP([ofproto - mod flow with cookie miss (mask!=0) - OF1.1])
799 AT_CHECK([ovs-ofctl -O openflow11 mod-flows br0 cookie=1/1,in_port=1,actions=1])
800 AT_CHECK([ovs-ofctl -O openflow11 dump-flows br0 | ofctl_strip | sort], [0], [dnl
801 OFPST_FLOW reply (OF1.1):
806 AT_SETUP([ofproto - mod flow with cookie miss (mask!=0) - OF1.2])
808 AT_CHECK([ovs-ofctl -O openflow12 mod-flows br0 cookie=1/1,in_port=1,actions=1])
809 AT_CHECK([ovs-ofctl -O openflow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
810 OFPST_FLOW reply (OF1.2):
815 AT_SETUP([ofproto - del flows with cookies])
817 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x1,in_port=1,actions=1])
818 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x2,in_port=2,actions=1])
819 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x3,in_port=3,actions=1])
820 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
821 cookie=0x1, in_port=1 actions=output:1
822 cookie=0x2, in_port=2 actions=output:1
823 cookie=0x3, in_port=3 actions=output:1
827 AT_CHECK([ovs-ofctl del-flows br0])
828 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
834 AT_SETUP([ofproto - del flows based on cookie])
836 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x1,in_port=1,actions=1])
837 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x2,in_port=2,actions=1])
838 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x3,in_port=3,actions=1])
839 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
840 cookie=0x1, in_port=1 actions=output:1
841 cookie=0x2, in_port=2 actions=output:1
842 cookie=0x3, in_port=3 actions=output:1
846 AT_CHECK([ovs-ofctl del-flows br0 cookie=0x3/-1])
847 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
848 cookie=0x1, in_port=1 actions=output:1
849 cookie=0x2, in_port=2 actions=output:1
855 AT_SETUP([ofproto - del flows based on cookie mask])
857 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x1,in_port=1,actions=1])
858 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x2,in_port=2,actions=1])
859 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x3,in_port=3,actions=1])
860 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
861 cookie=0x1, in_port=1 actions=output:1
862 cookie=0x2, in_port=2 actions=output:1
863 cookie=0x3, in_port=3 actions=output:1
866 AT_CHECK([ovs-ofctl del-flows br0 cookie=0x3/0x1])
867 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
868 cookie=0x2, in_port=2 actions=output:1
874 AT_SETUP([ofproto - del flows based on table id (NXM)])
876 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x1,in_port=1,actions=1])
877 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x2,in_port=2,table=1,actions=1])
878 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
879 cookie=0x1, in_port=1 actions=output:1
880 cookie=0x2, table=1, in_port=2 actions=output:1
883 AT_CHECK([ovs-ofctl del-flows br0 table=0])
884 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
885 cookie=0x2, table=1, in_port=2 actions=output:1
888 AT_CHECK([ovs-ofctl del-flows br0 table=1])
889 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
892 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x1,in_port=1,actions=1])
893 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x2,in_port=2,table=1,actions=1])
894 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
895 cookie=0x1, in_port=1 actions=output:1
896 cookie=0x2, table=1, in_port=2 actions=output:1
899 AT_CHECK([ovs-ofctl del-flows br0])
900 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
906 AT_SETUP([ofproto - del flows based on table id (OpenFlow 1.1)])
908 AT_CHECK([ovs-ofctl -O OpenFlow11 add-flow br0 cookie=0x1,in_port=1,actions=1])
909 AT_CHECK([ovs-ofctl -O OpenFlow11 add-flow br0 cookie=0x2,in_port=2,table=1,actions=1])
910 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0], [dnl
911 cookie=0x1, in_port=1 actions=output:1
912 cookie=0x2, table=1, in_port=2 actions=output:1
913 OFPST_FLOW reply (OF1.1):
915 AT_CHECK([ovs-ofctl -O OpenFlow11 del-flows br0 table=0])
916 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0], [dnl
917 cookie=0x2, table=1, in_port=2 actions=output:1
918 OFPST_FLOW reply (OF1.1):
920 AT_CHECK([ovs-ofctl -O OpenFlow11 del-flows br0 table=1])
921 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0], [dnl
922 OFPST_FLOW reply (OF1.1):
924 AT_CHECK([ovs-ofctl -O OpenFlow11 add-flow br0 cookie=0x1,in_port=1,actions=1])
925 AT_CHECK([ovs-ofctl -O OpenFlow11 add-flow br0 cookie=0x2,in_port=2,table=1,actions=1])
926 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0], [dnl
927 cookie=0x1, in_port=1 actions=output:1
928 cookie=0x2, table=1, in_port=2 actions=output:1
929 OFPST_FLOW reply (OF1.1):
931 AT_CHECK([ovs-ofctl -O OpenFlow11 del-flows br0])
932 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip], [0], [dnl
933 OFPST_FLOW reply (OF1.1):
934 cookie=0x2, table=1, in_port=2 actions=output:1
939 AT_SETUP([ofproto - del flows based on table id (OpenFlow 1.2)])
941 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 cookie=0x1,in_port=1,actions=1])
942 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 cookie=0x2,in_port=2,table=1,actions=1])
943 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
944 cookie=0x1, in_port=1 actions=output:1
945 cookie=0x2, table=1, in_port=2 actions=output:1
946 OFPST_FLOW reply (OF1.2):
948 AT_CHECK([ovs-ofctl -O OpenFlow12 del-flows br0 table=0])
949 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
950 cookie=0x2, table=1, in_port=2 actions=output:1
951 OFPST_FLOW reply (OF1.2):
953 AT_CHECK([ovs-ofctl -O OpenFlow12 del-flows br0 table=1])
954 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
955 OFPST_FLOW reply (OF1.2):
957 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 cookie=0x1,in_port=1,actions=1])
958 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 cookie=0x2,in_port=2,table=1,actions=1])
959 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
960 cookie=0x1, in_port=1 actions=output:1
961 cookie=0x2, table=1, in_port=2 actions=output:1
962 OFPST_FLOW reply (OF1.2):
964 AT_CHECK([ovs-ofctl -O OpenFlow12 del-flows br0])
965 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
966 OFPST_FLOW reply (OF1.2):
971 AT_SETUP([ofproto - flow table configuration (OpenFlow 1.0)])
973 # Check the default configuration.
974 (echo "OFPST_TABLE reply (xid=0x2): 254 tables
975 0: classifier: wild=0x3fffff, max=1000000, active=0
978 while test $x -lt 254; do
979 printf " %d: %-8s: wild=0x3fffff, max=1000000, active=0
984 AT_CHECK([ovs-ofctl dump-tables br0], [0], [expout])
985 # Change the configuration.
988 -- --id=@t0 create Flow_Table name=main \
989 -- --id=@t1 create Flow_Table flow-limit=1024 \
990 -- set bridge br0 'flow_tables={1=@t1,0=@t0}' \
991 | ${PERL} $srcdir/uuidfilt.pl],
995 # Check that the configuration was updated.
996 mv expout orig-expout
997 (echo "OFPST_TABLE reply (xid=0x2): 254 tables
998 0: main : wild=0x3fffff, max=1000000, active=0
1000 1: table1 : wild=0x3fffff, max= 1024, active=0
1001 lookup=0, matched=0"
1002 tail -n +6 orig-expout) > expout
1003 AT_CHECK([ovs-ofctl dump-tables br0], [0], [expout])
1007 AT_SETUP([ofproto - flow table configuration (OpenFlow 1.2)])
1009 # Check the default configuration.
1010 (mid="wild=0xfffffffff, max=1000000,"
1013 match=0xfffffffff, instructions=0x00000007, config=0x00000003
1014 write_actions=0x00000000, apply_actions=0x00000000
1015 write_setfields=0x0000000fffffffff
1016 apply_setfields=0x0000000fffffffff
1017 metadata_match=0xffffffffffffffff
1018 metadata_write=0xffffffffffffffff"
1019 echo "OFPST_TABLE reply (OF1.2) (xid=0x2): 254 tables
1020 0: classifier: $mid active=0$tail"
1022 while test $x -lt 254; do
1023 printf " %d: %-8s: $mid active=0$tail
1027 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-tables br0], [0], [expout])
1028 # Change the configuration.
1031 -- --id=@t0 create Flow_Table name=main \
1032 -- --id=@t1 create Flow_Table flow-limit=1024 \
1033 -- set bridge br0 'flow_tables={1=@t1,0=@t0}' \
1034 | ${PERL} $srcdir/uuidfilt.pl],
1038 # Check that the configuration was updated.
1039 mv expout orig-expout
1040 (echo "OFPST_TABLE reply (OF1.2) (xid=0x2): 254 tables
1041 0: main : wild=0xfffffffff, max=1000000, active=0"
1042 tail -n +3 orig-expout | head -7
1043 echo " 1: table1 : wild=0xfffffffff, max= 1024, active=0"
1044 tail -n +11 orig-expout) > expout
1045 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-tables br0], [0], [expout])
1049 AT_SETUP([ofproto - hard limits on flow table size (OpenFlow 1.0)])
1051 # Configure a maximum of 4 flows.
1054 -- --id=@t0 create Flow_Table flow-limit=4 \
1055 -- set bridge br0 flow_tables:0=@t0 \
1056 | ${PERL} $srcdir/uuidfilt.pl],
1060 for in_port in 1 2 3 4; do
1061 ovs-ofctl add-flow br0 in_port=$in_port,actions=drop
1063 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1064 in_port=1 actions=drop
1065 in_port=2 actions=drop
1066 in_port=3 actions=drop
1067 in_port=4 actions=drop
1070 # Adding another flow will be refused.
1071 AT_CHECK([ovs-ofctl add-flow br0 in_port=5,actions=drop], [1], [], [stderr])
1072 AT_CHECK([head -n 1 stderr | ofctl_strip], [0],
1073 [OFPT_ERROR: OFPFMFC_TABLE_FULL
1075 # Also a mod-flow that would add a flow will be refused.
1076 AT_CHECK([ovs-ofctl mod-flows br0 in_port=5,actions=drop], [1], [], [stderr])
1077 AT_CHECK([head -n 1 stderr | ofctl_strip], [0],
1078 [OFPT_ERROR: OFPFMFC_TABLE_FULL
1080 # Replacing or modifying an existing flow is allowed.
1081 AT_CHECK([ovs-ofctl add-flow br0 in_port=4,actions=normal])
1082 AT_CHECK([ovs-ofctl mod-flows br0 in_port=3,actions=output:1])
1083 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1084 in_port=1 actions=drop
1085 in_port=2 actions=drop
1086 in_port=3 actions=output:1
1087 in_port=4 actions=NORMAL
1093 AT_SETUP([ofproto - hard limits on flow table size (OpenFlow 1.2)])
1095 # Configure a maximum of 4 flows.
1098 -- --id=@t0 create Flow_Table flow-limit=4 \
1099 -- set bridge br0 flow_tables:0=@t0 \
1100 | ${PERL} $srcdir/uuidfilt.pl],
1104 for in_port in 1 2 3 4; do
1105 ovs-ofctl -O OpenFlow12 add-flow br0 in_port=$in_port,actions=drop
1107 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1108 in_port=1 actions=drop
1109 in_port=2 actions=drop
1110 in_port=3 actions=drop
1111 in_port=4 actions=drop
1112 OFPST_FLOW reply (OF1.2):
1114 # Adding another flow will be refused.
1115 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 in_port=5,actions=drop], [1], [], [stderr])
1116 AT_CHECK([head -n 1 stderr | ofctl_strip], [0],
1117 [OFPT_ERROR (OF1.2): OFPFMFC_TABLE_FULL
1119 # Replacing or modifying an existing flow is allowed.
1120 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 in_port=4,actions=normal])
1121 AT_CHECK([ovs-ofctl -O OpenFlow12 mod-flows br0 in_port=3,actions=output:1])
1122 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1123 in_port=1 actions=drop
1124 in_port=2 actions=drop
1125 in_port=3 actions=output:1
1126 in_port=4 actions=NORMAL
1127 OFPST_FLOW reply (OF1.2):
1132 AT_SETUP([ofproto - eviction upon table overflow (OpenFlow 1.0)])
1134 # Configure a maximum of 4 flows.
1137 -- --id=@t0 create Flow_Table flow-limit=4 overflow-policy=evict \
1138 -- set bridge br0 flow_tables:0=@t0 \
1139 | ${PERL} $srcdir/uuidfilt.pl],
1143 for in_port in 4 3 2 1; do
1144 ovs-ofctl add-flow br0 idle_timeout=${in_port}0,in_port=$in_port,actions=drop
1146 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1147 idle_timeout=10, in_port=1 actions=drop
1148 idle_timeout=20, in_port=2 actions=drop
1149 idle_timeout=30, in_port=3 actions=drop
1150 idle_timeout=40, in_port=4 actions=drop
1153 # Adding another flow will cause the one that expires soonest to be evicted.
1154 AT_CHECK([ovs-ofctl add-flow br0 in_port=5,actions=drop])
1155 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1156 idle_timeout=20, in_port=2 actions=drop
1157 idle_timeout=30, in_port=3 actions=drop
1158 idle_timeout=40, in_port=4 actions=drop
1159 in_port=5 actions=drop
1162 # A mod-flow that adds a flow also causes eviction, but replacing or
1163 # modifying an existing flow doesn't.
1164 AT_CHECK([ovs-ofctl mod-flows br0 in_port=6,actions=drop])
1165 AT_CHECK([ovs-ofctl add-flow br0 in_port=4,actions=normal])
1166 AT_CHECK([ovs-ofctl mod-flows br0 in_port=3,actions=output:1])
1167 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1168 idle_timeout=30, in_port=3 actions=output:1
1169 in_port=4 actions=NORMAL
1170 in_port=5 actions=drop
1171 in_port=6 actions=drop
1174 # Flows with no timeouts at all cannot be evicted.
1175 AT_CHECK([ovs-ofctl add-flow br0 in_port=7,actions=normal])
1176 AT_CHECK([ovs-ofctl add-flow br0 in_port=8,actions=drop], [1], [], [stderr])
1177 AT_CHECK([head -n 1 stderr | ofctl_strip], [0],
1178 [OFPT_ERROR: OFPFMFC_TABLE_FULL
1180 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1181 in_port=4 actions=NORMAL
1182 in_port=5 actions=drop
1183 in_port=6 actions=drop
1184 in_port=7 actions=NORMAL
1190 AT_SETUP([ofproto - eviction upon table overflow (OpenFlow 1.2)])
1192 # Configure a maximum of 4 flows.
1195 -- --id=@t0 create Flow_Table flow-limit=4 overflow-policy=evict \
1196 -- set bridge br0 flow_tables:0=@t0 \
1197 | ${PERL} $srcdir/uuidfilt.pl],
1201 for in_port in 4 3 2 1; do
1202 ovs-ofctl -O OpenFlow12 add-flow br0 idle_timeout=${in_port}0,in_port=$in_port,actions=drop
1204 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1205 idle_timeout=10, in_port=1 actions=drop
1206 idle_timeout=20, in_port=2 actions=drop
1207 idle_timeout=30, in_port=3 actions=drop
1208 idle_timeout=40, in_port=4 actions=drop
1209 OFPST_FLOW reply (OF1.2):
1211 # Adding another flow will cause the one that expires soonest to be evicted.
1212 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 in_port=5,actions=drop])
1213 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1214 idle_timeout=20, in_port=2 actions=drop
1215 idle_timeout=30, in_port=3 actions=drop
1216 idle_timeout=40, in_port=4 actions=drop
1217 in_port=5 actions=drop
1218 OFPST_FLOW reply (OF1.2):
1220 # In Open Flow 1.2 a mod-flow does not ever add a flow and thus
1221 # has no effect on eviction
1222 AT_CHECK([ovs-ofctl -O OpenFlow12 mod-flows br0 in_port=6,actions=drop])
1223 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 in_port=4,actions=normal])
1224 AT_CHECK([ovs-ofctl -O OpenFlow12 mod-flows br0 in_port=3,actions=output:1])
1225 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1226 idle_timeout=20, in_port=2 actions=drop
1227 idle_timeout=30, in_port=3 actions=output:1
1228 in_port=4 actions=NORMAL
1229 in_port=5 actions=drop
1230 OFPST_FLOW reply (OF1.2):
1232 # Flows with no timeouts at all cannot be evicted.
1233 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 in_port=6,actions=drop])
1234 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 in_port=7,actions=normal])
1235 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 in_port=8,actions=drop], [1], [], [stderr])
1236 AT_CHECK([head -n 1 stderr | ofctl_strip], [0],
1237 [OFPT_ERROR (OF1.2): OFPFMFC_TABLE_FULL
1239 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1240 in_port=4 actions=NORMAL
1241 in_port=5 actions=drop
1242 in_port=6 actions=drop
1243 in_port=7 actions=NORMAL
1244 OFPST_FLOW reply (OF1.2):
1249 AT_SETUP([ofproto - eviction upon table overflow, with fairness (OpenFlow 1.0)])
1251 # Configure a maximum of 4 flows.
1254 -- --id=@t0 create Flow_Table name=evict flow-limit=4 \
1255 overflow-policy=evict \
1256 groups='"NXM_OF_IN_PORT[[]]"' \
1257 -- set bridge br0 flow_tables:0=@t0 \
1258 | ${PERL} $srcdir/uuidfilt.pl],
1262 ovs-ofctl add-flows br0 - <<EOF
1263 idle_timeout=10 in_port=2 dl_src=00:44:55:66:77:88 actions=drop
1264 idle_timeout=20 in_port=1 dl_src=00:11:22:33:44:55 actions=drop
1265 idle_timeout=30 in_port=1 dl_src=00:22:33:44:55:66 actions=drop
1266 idle_timeout=40 in_port=1 dl_src=00:33:44:55:66:77 actions=drop
1268 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1269 idle_timeout=10, in_port=2,dl_src=00:44:55:66:77:88 actions=drop
1270 idle_timeout=20, in_port=1,dl_src=00:11:22:33:44:55 actions=drop
1271 idle_timeout=30, in_port=1,dl_src=00:22:33:44:55:66 actions=drop
1272 idle_timeout=40, in_port=1,dl_src=00:33:44:55:66:77 actions=drop
1275 # Adding another flow will cause the one that expires soonest within
1276 # the largest group (those with in_port=1) to be evicted. In this
1277 # case this is not the same as the one that expires soonest overall
1278 # (which is what makes the test interesting):
1279 AT_CHECK([ovs-ofctl add-flow br0 in_port=2,dl_src=00:55:66:77:88:99,actions=drop])
1280 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1281 idle_timeout=10, in_port=2,dl_src=00:44:55:66:77:88 actions=drop
1282 idle_timeout=30, in_port=1,dl_src=00:22:33:44:55:66 actions=drop
1283 idle_timeout=40, in_port=1,dl_src=00:33:44:55:66:77 actions=drop
1284 in_port=2,dl_src=00:55:66:77:88:99 actions=drop
1287 # Enlarge the flow limit, change the eviction policy back to strictly
1288 # based on expiration, and and add some flows.
1289 AT_CHECK([ovs-vsctl set Flow_Table evict groups='[[]]' flow-limit=7])
1290 ovs-ofctl add-flows br0 - <<EOF
1291 idle_timeout=50 in_port=2 dl_src=00:66:77:88:99:aa actions=drop
1292 idle_timeout=60 in_port=2 dl_src=00:77:88:99:aa:bb actions=drop
1293 idle_timeout=70 in_port=2 dl_src=00:88:99:aa:bb:cc actions=drop
1295 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1296 idle_timeout=10, in_port=2,dl_src=00:44:55:66:77:88 actions=drop
1297 idle_timeout=30, in_port=1,dl_src=00:22:33:44:55:66 actions=drop
1298 idle_timeout=40, in_port=1,dl_src=00:33:44:55:66:77 actions=drop
1299 idle_timeout=50, in_port=2,dl_src=00:66:77:88:99:aa actions=drop
1300 idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=drop
1301 idle_timeout=70, in_port=2,dl_src=00:88:99:aa:bb:cc actions=drop
1302 in_port=2,dl_src=00:55:66:77:88:99 actions=drop
1305 # Adding another flow will cause the one that expires soonest overall
1307 AT_CHECK([ovs-ofctl add-flow br0 'idle_timeout=80 in_port=2 dl_src=00:99:aa:bb:cc:dd actions=drop'])
1308 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1309 idle_timeout=30, in_port=1,dl_src=00:22:33:44:55:66 actions=drop
1310 idle_timeout=40, in_port=1,dl_src=00:33:44:55:66:77 actions=drop
1311 idle_timeout=50, in_port=2,dl_src=00:66:77:88:99:aa actions=drop
1312 idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=drop
1313 idle_timeout=70, in_port=2,dl_src=00:88:99:aa:bb:cc actions=drop
1314 idle_timeout=80, in_port=2,dl_src=00:99:aa:bb:cc:dd actions=drop
1315 in_port=2,dl_src=00:55:66:77:88:99 actions=drop
1318 # Reducing the flow limit also causes the flows that expire soonest
1319 # overall to be evicted.
1320 AT_CHECK([ovs-vsctl set Flow_Table evict flow-limit=4])
1321 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1322 idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=drop
1323 idle_timeout=70, in_port=2,dl_src=00:88:99:aa:bb:cc actions=drop
1324 idle_timeout=80, in_port=2,dl_src=00:99:aa:bb:cc:dd actions=drop
1325 in_port=2,dl_src=00:55:66:77:88:99 actions=drop
1331 AT_SETUP([ofproto - eviction upon table overflow, with fairness (OpenFlow 1.2)])
1333 # Configure a maximum of 4 flows.
1336 -- --id=@t0 create Flow_Table name=evict flow-limit=4 \
1337 overflow-policy=evict \
1338 groups='"NXM_OF_IN_PORT[[]]"' \
1339 -- set bridge br0 flow_tables:0=@t0 \
1340 | ${PERL} $srcdir/uuidfilt.pl],
1344 ovs-ofctl -O OpenFlow12 add-flows br0 - <<EOF
1345 idle_timeout=10 in_port=2 dl_src=00:44:55:66:77:88 actions=drop
1346 idle_timeout=20 in_port=1 dl_src=00:11:22:33:44:55 actions=drop
1347 idle_timeout=30 in_port=1 dl_src=00:22:33:44:55:66 actions=drop
1348 idle_timeout=40 in_port=1 dl_src=00:33:44:55:66:77 actions=drop
1350 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1351 idle_timeout=10, in_port=2,dl_src=00:44:55:66:77:88 actions=drop
1352 idle_timeout=20, in_port=1,dl_src=00:11:22:33:44:55 actions=drop
1353 idle_timeout=30, in_port=1,dl_src=00:22:33:44:55:66 actions=drop
1354 idle_timeout=40, in_port=1,dl_src=00:33:44:55:66:77 actions=drop
1355 OFPST_FLOW reply (OF1.2):
1357 # Adding another flow will cause the one that expires soonest within
1358 # the largest group (those with in_port=1) to be evicted. In this
1359 # case this is not the same as the one that expires soonest overall
1360 # (which is what makes the test interesting):
1361 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 in_port=2,dl_src=00:55:66:77:88:99,actions=drop])
1362 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1363 idle_timeout=10, in_port=2,dl_src=00:44:55:66:77:88 actions=drop
1364 idle_timeout=30, in_port=1,dl_src=00:22:33:44:55:66 actions=drop
1365 idle_timeout=40, in_port=1,dl_src=00:33:44:55:66:77 actions=drop
1366 in_port=2,dl_src=00:55:66:77:88:99 actions=drop
1367 OFPST_FLOW reply (OF1.2):
1369 # Enlarge the flow limit, change the eviction policy back to strictly
1370 # based on expiration, and and add some flows.
1371 AT_CHECK([ovs-vsctl set Flow_Table evict groups='[[]]' flow-limit=7])
1372 ovs-ofctl -O OpenFlow12 add-flows br0 - <<EOF
1373 idle_timeout=50 in_port=2 dl_src=00:66:77:88:99:aa actions=drop
1374 idle_timeout=60 in_port=2 dl_src=00:77:88:99:aa:bb actions=drop
1375 idle_timeout=70 in_port=2 dl_src=00:88:99:aa:bb:cc actions=drop
1377 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1378 idle_timeout=10, in_port=2,dl_src=00:44:55:66:77:88 actions=drop
1379 idle_timeout=30, in_port=1,dl_src=00:22:33:44:55:66 actions=drop
1380 idle_timeout=40, in_port=1,dl_src=00:33:44:55:66:77 actions=drop
1381 idle_timeout=50, in_port=2,dl_src=00:66:77:88:99:aa actions=drop
1382 idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=drop
1383 idle_timeout=70, in_port=2,dl_src=00:88:99:aa:bb:cc actions=drop
1384 in_port=2,dl_src=00:55:66:77:88:99 actions=drop
1385 OFPST_FLOW reply (OF1.2):
1387 # Adding another flow will cause the one that expires soonest overall
1389 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'])
1390 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1391 idle_timeout=30, in_port=1,dl_src=00:22:33:44:55:66 actions=drop
1392 idle_timeout=40, in_port=1,dl_src=00:33:44:55:66:77 actions=drop
1393 idle_timeout=50, in_port=2,dl_src=00:66:77:88:99:aa actions=drop
1394 idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=drop
1395 idle_timeout=70, in_port=2,dl_src=00:88:99:aa:bb:cc actions=drop
1396 idle_timeout=80, in_port=2,dl_src=00:99:aa:bb:cc:dd actions=drop
1397 in_port=2,dl_src=00:55:66:77:88:99 actions=drop
1398 OFPST_FLOW reply (OF1.2):
1400 # Reducing the flow limit also causes the flows that expire soonest
1401 # overall to be evicted.
1402 AT_CHECK([ovs-vsctl set Flow_Table evict flow-limit=4])
1403 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1404 idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=drop
1405 idle_timeout=70, in_port=2,dl_src=00:88:99:aa:bb:cc actions=drop
1406 idle_timeout=80, in_port=2,dl_src=00:99:aa:bb:cc:dd actions=drop
1407 in_port=2,dl_src=00:55:66:77:88:99 actions=drop
1408 OFPST_FLOW reply (OF1.2):
1413 AT_SETUP([ofproto - eviction upon table overflow, with modified hard timeout])
1415 # Configure a maximum of 4 flows.
1418 -- --id=@t0 create Flow_Table flow-limit=4 overflow-policy=evict \
1419 -- set bridge br0 flow_tables:0=@t0 \
1420 | ${PERL} $srcdir/uuidfilt.pl],
1423 ovs-appctl time/stop
1425 for in_port in 4 3 2 1; do
1426 ovs-ofctl add-flow br0 hard_timeout=$((10 + in_port * 3)),in_port=$in_port,actions=drop
1428 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1429 hard_timeout=13, in_port=1 actions=drop
1430 hard_timeout=16, in_port=2 actions=drop
1431 hard_timeout=19, in_port=3 actions=drop
1432 hard_timeout=22, in_port=4 actions=drop
1435 # Sleep and modify the one that expires soonest
1436 ovs-appctl time/warp 5000
1437 AT_CHECK([ovs-ofctl mod-flows br0 in_port=1,actions=drop])
1438 # At this point the table would looks like:
1439 # in_port seconds to expire
1444 ovs-appctl time/warp 2000
1445 # Adding another flow will cause the one that expires soonest to be evicted.
1446 AT_CHECK([ovs-ofctl add-flow br0 in_port=5,actions=drop])
1447 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1448 hard_timeout=13, in_port=1 actions=drop
1449 hard_timeout=19, in_port=3 actions=drop
1450 hard_timeout=22, in_port=4 actions=drop
1451 in_port=5 actions=drop
1457 AT_SETUP([ofproto - eviction upon table overflow, with modified idle timeout])
1458 OVS_VSWITCHD_START([add-port br0 p1 -- set interface p1 type=dummy ofport_request=1])
1459 # Configure a maximum of 4 flows.
1462 -- --id=@t0 create Flow_Table flow-limit=4 overflow-policy=evict \
1463 -- set bridge br0 flow_tables:0=@t0 \
1464 | ${PERL} $srcdir/uuidfilt.pl],
1468 for in_port in 4 3 2 1; do
1469 ovs-ofctl add-flow br0 idle_timeout=$((10 + in_port * 3)),in_port=$in_port,actions=drop
1471 ovs-appctl time/stop
1472 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1473 idle_timeout=13, in_port=1 actions=drop
1474 idle_timeout=16, in_port=2 actions=drop
1475 idle_timeout=19, in_port=3 actions=drop
1476 idle_timeout=22, in_port=4 actions=drop
1479 # Sleep and receive on the flow that expires soonest
1480 ovs-appctl time/warp 5000
1481 AT_CHECK([ovs-appctl netdev-dummy/receive p1 'in_port(1)'])
1482 # At this point the table would looks like:
1483 # in_port seconds to expire
1488 ovs-appctl time/warp 2000
1489 # Adding another flow will cause the one that expires soonest to be evicted.
1490 AT_CHECK([ovs-ofctl add-flow br0 in_port=5,actions=drop])
1491 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1492 idle_timeout=19, in_port=3 actions=drop
1493 idle_timeout=22, in_port=4 actions=drop
1494 in_port=5 actions=drop
1495 n_packets=1, n_bytes=60, idle_timeout=13, in_port=1 actions=drop
1501 AT_SETUP([ofproto - asynchronous message control (OpenFlow 1.0)])
1503 AT_CHECK([ovs-ofctl -P openflow10 monitor br0 --detach --no-chdir --pidfile])
1505 printf '\n\n--- check_async %d ---\n\n\n' $1
1508 ovs-appctl -t ovs-ofctl ofctl/barrier
1509 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
1512 # OFPT_PACKET_IN, OFPR_ACTION (controller_id=0)
1513 ovs-ofctl -v packet-out br0 controller controller '0001020304050010203040501234'
1514 if test X"$1" = X"OFPR_ACTION"; then shift;
1515 echo >>expout "OFPT_PACKET_IN: total_len=14 in_port=CONTROLLER (via action) data_len=14 (unbuffered)
1516 metadata=0,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"
1519 # OFPT_PACKET_IN, OFPR_NO_MATCH (controller_id=123)
1520 ovs-ofctl -v packet-out br0 controller 'controller(reason=no_match,id=123)' '0001020304050010203040501234'
1521 if test X"$1" = X"OFPR_NO_MATCH"; then shift;
1522 echo >>expout "OFPT_PACKET_IN: total_len=14 in_port=CONTROLLER (via no_match) data_len=14 (unbuffered)
1523 metadata=0,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"
1526 # OFPT_PACKET_IN, OFPR_INVALID_TTL (controller_id=0)
1527 ovs-ofctl packet-out br0 controller dec_ttl '002583dfb4000026b98cb0f908004500003fb7e200000011339bac11370dac100002d7730035002b8f6d86fb0100000100000000000006626c702d7873066e696369726103636f6d00000f00'
1528 if test X"$1" = X"OFPR_INVALID_TTL"; then shift;
1529 echo >>expout "OFPT_PACKET_IN: total_len=76 in_port=CONTROLLER (via invalid_ttl) data_len=76 (unbuffered)
1530 udp,metadata=0,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"
1533 # OFPT_PORT_STATUS, OFPPR_ADD
1534 ovs-vsctl add-port br0 test -- set Interface test type=dummy ofport_request=1
1535 if test X"$1" = X"OFPPR_ADD"; then shift;
1536 echo >>expout "OFPT_PORT_STATUS: ADD: 1(test): addr:aa:55:aa:55:00:0x
1539 speed: 0 Mbps now, 0 Mbps max"
1542 # OFPT_PORT_STATUS, OFPPR_DELETE
1543 ovs-vsctl del-port br0 test
1544 if test X"$1" = X"OFPPR_DELETE"; then shift;
1545 echo >>expout "OFPT_PORT_STATUS: DEL: 1(test): addr:aa:55:aa:55:00:0x
1548 speed: 0 Mbps now, 0 Mbps max"
1551 # OFPT_FLOW_REMOVED, OFPRR_DELETE
1552 ovs-ofctl add-flow br0 send_flow_rem,actions=drop
1553 ovs-ofctl --strict del-flows br0 ''
1554 if test X"$1" = X"OFPRR_DELETE"; then shift;
1555 echo >>expout "OFPT_FLOW_REMOVED: reason=delete"
1557 AT_FAIL_IF([test X"$1" != X])
1559 ovs-appctl -t ovs-ofctl ofctl/barrier
1560 echo >>expout "OFPT_BARRIER_REPLY:"
1564 s/ (xid=0x[0-9a-fA-F]*)//
1566 s/00:0.$/00:0x/' < monitor.log]],
1570 # It's a service connection so initially there should be no async messages.
1573 # Set miss_send_len to 128, turning on packet-ins for our service connection.
1574 ovs-appctl -t ovs-ofctl ofctl/send 0109000c0123456700000080
1575 check_async 2 OFPR_ACTION OFPPR_ADD OFPPR_DELETE OFPRR_DELETE
1577 # Set miss_send_len to 128 and enable invalid_ttl.
1578 ovs-appctl -t ovs-ofctl ofctl/send 0109000c0123456700040080
1579 check_async 3 OFPR_ACTION OFPR_INVALID_TTL OFPPR_ADD OFPPR_DELETE OFPRR_DELETE
1581 # Become slave, which should disable everything except port status.
1582 ovs-appctl -t ovs-ofctl ofctl/send 0104001400000002000023200000000a00000002
1583 check_async 4 OFPPR_ADD OFPPR_DELETE
1585 # Use NXT_SET_ASYNC_CONFIG to enable a patchwork of asynchronous messages.
1586 ovs-appctl -t ovs-ofctl ofctl/send 01040028000000020000232000000013000000020000000500000005000000020000000200000005
1587 check_async 5 OFPR_INVALID_TTL OFPPR_DELETE OFPRR_DELETE
1589 # Set controller ID 123.
1590 ovs-appctl -t ovs-ofctl ofctl/send 01040018000000030000232000000014000000000000007b
1591 check_async 6 OFPR_NO_MATCH OFPPR_DELETE OFPRR_DELETE
1593 # Restore controller ID 0.
1594 ovs-appctl -t ovs-ofctl ofctl/send 010400180000000300002320000000140000000000000000
1597 ovs-appctl -t ovs-ofctl ofctl/send 0104001400000002000023200000000a00000001
1598 check_async 7 OFPR_ACTION OFPPR_ADD
1600 ovs-appctl -t ovs-ofctl exit
1604 AT_SETUP([ofproto - asynchronous message control (OpenFlow 1.2)])
1606 AT_CHECK([ovs-ofctl -O OpenFlow12 monitor br0 --detach --no-chdir --pidfile])
1608 printf '\n\n--- check_async %d ---\n\n\n' $1
1612 ovs-appctl -t ovs-ofctl ofctl/barrier
1613 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
1616 # OFPT_PACKET_IN, OFPR_ACTION (controller_id=0)
1617 ovs-ofctl -O OpenFlow12 -v packet-out br0 none controller '0001020304050010203040501234'
1618 if test X"$1" = X"OFPR_ACTION"; then shift;
1619 echo >>expout "OFPT_PACKET_IN (OF1.2): total_len=14 in_port=ANY (via action) data_len=14 (unbuffered)
1620 metadata=0,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"
1623 # OFPT_PACKET_IN, OFPR_NO_MATCH (controller_id=123)
1624 ovs-ofctl -O OpenFlow12 -v packet-out br0 none 'controller(reason=no_match,id=123)' '0001020304050010203040501234'
1625 if test X"$1" = X"OFPR_NO_MATCH"; then shift;
1626 echo >>expout "OFPT_PACKET_IN (OF1.2): total_len=14 in_port=ANY (via no_match) data_len=14 (unbuffered)
1627 metadata=0,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"
1630 # OFPT_PACKET_IN, OFPR_INVALID_TTL (controller_id=0)
1631 ovs-ofctl -O OpenFlow12 packet-out br0 none dec_ttl '002583dfb4000026b98cb0f908004500003fb7e200000011339bac11370dac100002d7730035002b8f6d86fb0100000100000000000006626c702d7873066e696369726103636f6d00000f00'
1632 if test X"$1" = X"OFPR_INVALID_TTL"; then shift;
1633 echo >>expout "OFPT_PACKET_IN (OF1.2): total_len=76 in_port=ANY (via invalid_ttl) data_len=76 (unbuffered)
1634 udp,metadata=0,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"
1637 # OFPT_PORT_STATUS, OFPPR_ADD
1638 ovs-vsctl add-port br0 test -- set Interface test type=dummy
1639 if test X"$1" = X"OFPPR_ADD"; then shift;
1640 echo >>expout "OFPT_PORT_STATUS (OF1.2): ADD: ${INDEX}(test): addr:aa:55:aa:55:00:0x
1643 speed: 0 Mbps now, 0 Mbps max"
1646 # OFPT_PORT_STATUS, OFPPR_DELETE
1647 ovs-vsctl del-port br0 test
1648 if test X"$1" = X"OFPPR_DELETE"; then shift;
1649 echo >>expout "OFPT_PORT_STATUS (OF1.2): DEL: ${INDEX}(test): addr:aa:55:aa:55:00:0x
1652 speed: 0 Mbps now, 0 Mbps max"
1655 # OFPT_FLOW_REMOVED, OFPRR_DELETE
1656 ovs-ofctl -O OpenFlow12 add-flow br0 send_flow_rem,actions=drop
1657 ovs-ofctl -O OpenFlow12 --strict del-flows br0 ''
1658 if test X"$1" = X"OFPRR_DELETE"; then shift;
1659 echo >>expout "OFPT_FLOW_REMOVED (OF1.2): reason=delete table_id=0"
1661 AT_FAIL_IF([test X"$1" != X])
1663 ovs-appctl -t ovs-ofctl ofctl/barrier
1664 echo >>expout "OFPT_BARRIER_REPLY (OF1.2):"
1668 s/ (xid=0x[0-9a-fA-F]*)//
1670 s/00:0.$/00:0x/' < monitor.log]],
1674 # It's a service connection so initially there should be no async messages.
1677 # Set miss_send_len to 128, turning on packet-ins for our service connection.
1678 ovs-appctl -t ovs-ofctl ofctl/send 0309000c0123456700000080
1679 check_async 2 OFPR_ACTION OFPPR_ADD OFPPR_DELETE OFPRR_DELETE
1681 # Set miss_send_len to 128 and enable invalid_ttl.
1682 ovs-appctl -t ovs-ofctl ofctl/send 0309000c0123456700040080
1683 check_async 3 OFPR_ACTION OFPR_INVALID_TTL OFPPR_ADD OFPPR_DELETE OFPRR_DELETE
1685 # Become slave (OF 1.2), which should disable everything except port status.
1686 ovs-appctl -t ovs-ofctl ofctl/send 031800180000000200000003000000000000000000000001
1687 check_async 4 OFPPR_ADD OFPPR_DELETE
1689 # Use NXT_SET_ASYNC_CONFIG to enable a patchwork of asynchronous messages.
1690 ovs-appctl -t ovs-ofctl ofctl/send 03040028000000020000232000000013000000020000000500000005000000020000000200000005
1691 check_async 5 OFPR_INVALID_TTL OFPPR_DELETE OFPRR_DELETE
1693 # Set controller ID 123.
1694 ovs-appctl -t ovs-ofctl ofctl/send 03040018000000030000232000000014000000000000007b
1695 check_async 6 OFPR_NO_MATCH OFPPR_DELETE OFPRR_DELETE
1697 # Restore controller ID 0.
1698 ovs-appctl -t ovs-ofctl ofctl/send 030400180000000300002320000000140000000000000000
1700 # Become master (OF 1.2).
1701 ovs-appctl -t ovs-ofctl ofctl/send 031800180000000400000002000000000000000000000002
1702 check_async 7 OFPR_ACTION OFPPR_ADD
1704 ovs-appctl -t ovs-ofctl exit
1708 AT_SETUP([ofproto - asynchronous message control (OpenFlow 1.3)])
1710 AT_CHECK([ovs-ofctl -O OpenFlow13 monitor br0 --detach --no-chdir --pidfile])
1712 printf '\n\n--- check_async %d ---\n\n\n' $1
1716 ovs-appctl -t ovs-ofctl ofctl/barrier
1717 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
1720 # OFPT_PACKET_IN, OFPR_ACTION (controller_id=0)
1721 ovs-ofctl -O OpenFlow13 -v packet-out br0 none controller '0001020304050010203040501234'
1722 if test X"$1" = X"OFPR_ACTION"; then shift;
1723 echo >>expout "OFPT_PACKET_IN (OF1.3): total_len=14 in_port=ANY (via action) data_len=14 (unbuffered)
1724 metadata=0,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"
1727 # OFPT_PACKET_IN, OFPR_NO_MATCH (controller_id=123)
1728 ovs-ofctl -O OpenFlow13 -v packet-out br0 none 'controller(reason=no_match,id=123)' '0001020304050010203040501234'
1729 if test X"$1" = X"OFPR_NO_MATCH"; then shift;
1730 echo >>expout "OFPT_PACKET_IN (OF1.3): total_len=14 in_port=ANY (via no_match) data_len=14 (unbuffered)
1731 metadata=0,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"
1734 # OFPT_PACKET_IN, OFPR_INVALID_TTL (controller_id=0)
1735 ovs-ofctl -O OpenFlow13 packet-out br0 none dec_ttl '002583dfb4000026b98cb0f908004500003fb7e200000011339bac11370dac100002d7730035002b8f6d86fb0100000100000000000006626c702d7873066e696369726103636f6d00000f00'
1736 if test X"$1" = X"OFPR_INVALID_TTL"; then shift;
1737 echo >>expout "OFPT_PACKET_IN (OF1.3): total_len=76 in_port=ANY (via invalid_ttl) data_len=76 (unbuffered)
1738 udp,metadata=0,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"
1741 # OFPT_PORT_STATUS, OFPPR_ADD
1742 ovs-vsctl add-port br0 test -- set Interface test type=dummy
1743 if test X"$1" = X"OFPPR_ADD"; then shift;
1744 echo >>expout "OFPT_PORT_STATUS (OF1.3): ADD: ${INDEX}(test): addr:aa:55:aa:55:00:0x
1747 speed: 0 Mbps now, 0 Mbps max"
1750 # OFPT_PORT_STATUS, OFPPR_DELETE
1751 ovs-vsctl del-port br0 test
1752 if test X"$1" = X"OFPPR_DELETE"; then shift;
1753 echo >>expout "OFPT_PORT_STATUS (OF1.3): DEL: ${INDEX}(test): addr:aa:55:aa:55:00:0x
1756 speed: 0 Mbps now, 0 Mbps max"
1759 # OFPT_FLOW_REMOVED, OFPRR_DELETE
1760 ovs-ofctl -O OpenFlow13 add-flow br0 send_flow_rem,actions=drop
1761 ovs-ofctl -O OpenFlow13 --strict del-flows br0 ''
1762 if test X"$1" = X"OFPRR_DELETE"; then shift;
1763 echo >>expout "OFPT_FLOW_REMOVED (OF1.3): reason=delete table_id=0"
1765 AT_FAIL_IF([test X"$1" != X])
1767 ovs-appctl -t ovs-ofctl ofctl/barrier
1768 echo >>expout "OFPT_BARRIER_REPLY (OF1.3):"
1772 s/ (xid=0x[0-9a-fA-F]*)//
1774 s/00:0.$/00:0x/' < monitor.log]],
1778 # It's a service connection so initially there should be no async messages.
1781 # Set miss_send_len to 128, turning on packet-ins for our service connection.
1782 ovs-appctl -t ovs-ofctl ofctl/send 0409000c0123456700000080
1783 check_async 2 OFPR_ACTION OFPPR_ADD OFPPR_DELETE OFPRR_DELETE
1785 # Become slave (OF 1.3), which should disable everything except port status.
1786 ovs-appctl -t ovs-ofctl ofctl/send 041800180000000200000003000000000000000000000001
1787 check_async 3 OFPPR_ADD OFPPR_DELETE
1789 # Use OF 1.3 OFPT_SET_ASYNC to enable a patchwork of asynchronous messages.
1790 ovs-appctl -t ovs-ofctl ofctl/send 041c002000000002000000020000000500000005000000020000000200000005
1791 check_async 4 OFPR_INVALID_TTL OFPPR_DELETE OFPRR_DELETE
1793 # Set controller ID 123.
1794 ovs-appctl -t ovs-ofctl ofctl/send 04040018000000030000232000000014000000000000007b
1795 check_async 5 OFPR_NO_MATCH OFPPR_DELETE OFPRR_DELETE
1797 # Restore controller ID 0.
1798 ovs-appctl -t ovs-ofctl ofctl/send 040400180000000300002320000000140000000000000000
1800 # Become master (OF 1.3).
1801 ovs-appctl -t ovs-ofctl ofctl/send 041800180000000400000002000000000000000000000002
1802 check_async 6 OFPR_ACTION OFPPR_ADD
1804 ovs-appctl -t ovs-ofctl exit
1808 dnl This test checks that the role request/response messaging works
1809 dnl and that generation_id is handled properly.
1810 AT_SETUP([ofproto - controller role (OpenFlow 1.2)])
1812 AT_CHECK([ovs-ofctl -O OpenFlow12 monitor br0 --detach --no-chdir --pidfile])
1814 ovs-appctl -t ovs-ofctl ofctl/barrier
1815 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
1819 # find out current role
1820 ovs-appctl -t ovs-ofctl ofctl/send 031800180000000200000000000000000000000000000000
1821 echo >>experr "send: OFPT_ROLE_REQUEST (OF1.2) (xid=0x2): role=nochange"
1822 echo >>expout "OFPT_ROLE_REPLY (OF1.2) (xid=0x2): role=equal"
1824 # Become slave (generation_id is initially undefined, so 2^63+2 should not be stale)
1825 ovs-appctl -t ovs-ofctl ofctl/send 031800180000000300000003000000008000000000000002
1826 echo >>experr "send: OFPT_ROLE_REQUEST (OF1.2) (xid=0x3): role=slave generation_id=9223372036854775810"
1827 echo >>expout "OFPT_ROLE_REPLY (OF1.2) (xid=0x3): role=slave generation_id=9223372036854775810"
1829 # Try to become the master using a stale generation ID
1830 ovs-appctl -t ovs-ofctl ofctl/send 031800180000000400000002000000000000000000000002
1831 echo >>experr "send: OFPT_ROLE_REQUEST (OF1.2) (xid=0x4): role=master generation_id=2"
1832 echo >>expout "OFPT_ERROR (OF1.2) (xid=0x4): OFPRRFC_STALE"
1833 echo >>expout "OFPT_ROLE_REQUEST (OF1.2) (xid=0x4): role=master generation_id=2"
1835 # Become master using a valid generation ID
1836 ovs-appctl -t ovs-ofctl ofctl/send 031800180000000500000002000000000000000000000001
1837 echo >>experr "send: OFPT_ROLE_REQUEST (OF1.2) (xid=0x5): role=master generation_id=1"
1838 echo >>expout "OFPT_ROLE_REPLY (OF1.2) (xid=0x5): role=master generation_id=1"
1839 ovs-appctl -t ovs-ofctl ofctl/barrier
1840 echo >>expout "OFPT_BARRIER_REPLY (OF1.2) (xid=0x3):"
1842 AT_CHECK([grep -v '^send:' monitor.log], [0], [expout])
1844 AT_CHECK([grep '^send:' monitor.log], [0], [expout])
1846 ovs-appctl -t ovs-ofctl exit
1850 dnl This test checks that OFPT_PACKET_OUT accepts both OFPP_NONE (as
1851 dnl specified by OpenFlow 1.0) and OFPP_CONTROLLER (used by some
1852 dnl controllers despite the spec) as meaning a packet that was generated
1853 dnl by the controller.
1854 AT_SETUP([ofproto - packet-out from controller (OpenFlow 1.0)])
1856 ADD_OF_PORTS([br0], [1])
1858 # Start a monitor listening for packet-ins.
1859 AT_CHECK([ovs-ofctl -P openflow10 monitor br0 --detach --no-chdir --pidfile])
1860 ovs-appctl -t ovs-ofctl ofctl/send 0109000c0123456700000080
1861 ovs-appctl -t ovs-ofctl ofctl/barrier
1862 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
1863 AT_CAPTURE_FILE([monitor.log])
1865 # Send some packet-outs with OFPP_NONE and OFPP_CONTROLLER (65533) as in_port.
1866 AT_CHECK([ovs-ofctl packet-out br0 none controller,1 '0001020304050010203040501234'])
1867 AT_CHECK([ovs-ofctl packet-out br0 controller controller,1 '0001020304050010203040505678'])
1869 # Stop the monitor and check its output.
1870 ovs-appctl -t ovs-ofctl ofctl/barrier
1871 ovs-appctl -t ovs-ofctl exit
1873 ovs-ofctl dump-ports br0
1875 AT_CHECK([sed 's/ (xid=0x[[0-9a-fA-F]]*)//' monitor.log], [0], [dnl
1876 OFPT_PACKET_IN: total_len=14 in_port=ANY (via action) data_len=14 (unbuffered)
1877 metadata=0,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
1878 OFPT_PACKET_IN: total_len=14 in_port=CONTROLLER (via action) data_len=14 (unbuffered)
1879 metadata=0,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
1886 dnl This test checks that OFPT_PACKET_OUT accepts both OFPP_NONE (as
1887 dnl specified by OpenFlow 1.2) and OFPP_CONTROLLER (used by some
1888 dnl controllers despite the spec) as meaning a packet that was generated
1889 dnl by the controller.
1890 AT_SETUP([ofproto - packet-out from controller (OpenFlow 1.2)])
1893 # Start a monitor listening for packet-ins.
1894 AT_CHECK([ovs-ofctl -O OpenFlow12 monitor br0 --detach --no-chdir --pidfile])
1895 ovs-appctl -t ovs-ofctl ofctl/send 0309000c0123456700000080
1896 ovs-appctl -t ovs-ofctl ofctl/barrier
1897 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
1898 AT_CAPTURE_FILE([monitor.log])
1900 # Send some packet-outs with OFPP_NONE and OFPP_CONTROLLER (65533) as in_port.
1901 AT_CHECK([ovs-ofctl -O OpenFlow12 packet-out br0 none controller '0001020304050010203040501234'])
1902 AT_CHECK([ovs-ofctl -O OpenFlow12 packet-out br0 4294967293 controller '0001020304050010203040505678'])
1904 # Stop the monitor and check its output.
1905 ovs-appctl -t ovs-ofctl ofctl/barrier
1906 ovs-appctl -t ovs-ofctl exit
1908 AT_CHECK([sed 's/ (xid=0x[[0-9a-fA-F]]*)//' monitor.log], [0], [dnl
1909 OFPT_PACKET_IN (OF1.2): total_len=14 in_port=ANY (via action) data_len=14 (unbuffered)
1910 metadata=0,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
1911 OFPT_PACKET_IN (OF1.2): total_len=14 in_port=CONTROLLER (via action) data_len=14 (unbuffered)
1912 metadata=0,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
1913 OFPT_BARRIER_REPLY (OF1.2):
1919 dnl This test checks that OFPT_PACKET_OUT accepts both OFPP_NONE (as
1920 dnl specified by OpenFlow 1.1) and OFPP_CONTROLLER (used by some
1921 dnl controllers despite the spec) as meaning a packet that was generated
1922 dnl by the controller.
1923 AT_SETUP([ofproto - packet-out from controller (OpenFlow 1.1)])
1926 # Start a monitor listening for packet-ins.
1927 AT_CHECK([ovs-ofctl -O OpenFlow11 monitor br0 --detach --no-chdir --pidfile])
1928 ovs-appctl -t ovs-ofctl ofctl/send 0209000c0123456700000080
1929 ovs-appctl -t ovs-ofctl ofctl/barrier
1930 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
1931 AT_CAPTURE_FILE([monitor.log])
1933 # Send some packet-outs with OFPP_NONE and OFPP_CONTROLLER (65533) as in_port.
1934 AT_CHECK([ovs-ofctl -O OpenFlow11 packet-out br0 none controller '0001020304050010203040501234'])
1935 AT_CHECK([ovs-ofctl -O OpenFlow11 packet-out br0 4294967293 controller '0001020304050010203040505678'])
1937 # Stop the monitor and check its output.
1938 ovs-appctl -t ovs-ofctl ofctl/barrier
1939 ovs-appctl -t ovs-ofctl exit
1941 AT_CHECK([sed 's/ (xid=0x[[0-9a-fA-F]]*)//' monitor.log], [0], [dnl
1942 OFPT_PACKET_IN (OF1.1): total_len=14 in_port=ANY (via action) data_len=14 (unbuffered)
1943 metadata=0,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
1944 OFPT_PACKET_IN (OF1.1): total_len=14 in_port=CONTROLLER (via action) data_len=14 (unbuffered)
1945 metadata=0,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
1946 OFPT_BARRIER_REPLY (OF1.1):
1952 dnl This test checks that metadata is encoded in packet_in structures,
1953 dnl supported by NXAST.
1954 AT_SETUP([ofproto - packet-out with metadata (NXM)])
1957 # Start a monitor listening for packet-ins.
1958 AT_CHECK([ovs-ofctl -P nxm monitor br0 --detach --no-chdir --pidfile])
1959 ovs-appctl -t ovs-ofctl ofctl/send 0109000c0123456700000080
1960 ovs-appctl -t ovs-ofctl ofctl/barrier
1961 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
1962 AT_CAPTURE_FILE([monitor.log])
1964 # Send a packet-out with a load action to set some metadata, and forward to controller
1965 AT_CHECK([ovs-ofctl packet-out br0 controller 'load(0xfafafafa5a5a5a5a->OXM_OF_METADATA[[0..63]]), load(0xaa->NXM_NX_PKT_MARK[[]]), controller' '0001020304050010203040501234'])
1967 # Stop the monitor and check its output.
1968 ovs-appctl -t ovs-ofctl ofctl/barrier
1969 ovs-appctl -t ovs-ofctl exit
1971 AT_CHECK([sed 's/ (xid=0x[[0-9a-fA-F]]*)//' monitor.log], [0], [dnl
1972 NXT_PACKET_IN: total_len=14 in_port=CONTROLLER metadata=0xfafafafa5a5a5a5a pkt_mark=0xaa (via action) data_len=14 (unbuffered)
1973 metadata=0,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
1980 dnl This test checks that metadata is encoded in packet_in structures,
1981 dnl supported by NXAST.
1982 AT_SETUP([ofproto - packet-out with metadata (OpenFlow 1.2)])
1985 # Start a monitor listening for packet-ins.
1986 AT_CHECK([ovs-ofctl -O OpenFlow12 monitor br0 --detach --no-chdir --pidfile])
1987 ovs-appctl -t ovs-ofctl ofctl/send 0309000c0123456700000080
1988 ovs-appctl -t ovs-ofctl ofctl/barrier
1989 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
1990 AT_CAPTURE_FILE([monitor.log])
1992 # Send a packet-out with a load action to set some metadata, and forward to controller
1993 AT_CHECK([ovs-ofctl -O OpenFlow12 packet-out br0 none 'load(0xfafafafa5a5a5a5a->OXM_OF_METADATA[[0..63]]), controller' '0001020304050010203040501234'])
1995 # Stop the monitor and check its output.
1996 ovs-appctl -t ovs-ofctl ofctl/barrier
1997 ovs-appctl -t ovs-ofctl exit
1999 AT_CHECK([sed 's/ (xid=0x[[0-9a-fA-F]]*)//' monitor.log], [0], [dnl
2000 OFPT_PACKET_IN (OF1.2): total_len=14 in_port=ANY metadata=0xfafafafa5a5a5a5a (via action) data_len=14 (unbuffered)
2001 metadata=0,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
2002 OFPT_BARRIER_REPLY (OF1.2):
2008 dnl This test checks that tunnel metadata is encoded in packet_in structures.
2009 AT_SETUP([ofproto - packet-out with tunnel metadata (OpenFlow 1.2)])
2012 # Start a monitor listening for packet-ins.
2013 AT_CHECK([ovs-ofctl -O OpenFlow12 monitor br0 --detach --no-chdir --pidfile])
2014 ovs-appctl -t ovs-ofctl ofctl/send 0309000c0123456700000080
2015 ovs-appctl -t ovs-ofctl ofctl/barrier
2016 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
2017 AT_CAPTURE_FILE([monitor.log])
2019 # Send a packet-out with set field actions to set some tunnel metadata, and forward to controller
2020 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'])
2022 # Stop the monitor and check its output.
2023 ovs-appctl -t ovs-ofctl ofctl/barrier
2024 ovs-appctl -t ovs-ofctl exit
2026 AT_CHECK([sed 's/ (xid=0x[[0-9a-fA-F]]*)//' monitor.log], [0], [dnl
2027 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)
2028 metadata=0,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
2029 OFPT_BARRIER_REPLY (OF1.2):
2035 AT_SETUP([ofproto - flow monitoring])
2036 AT_KEYWORDS([monitor])
2039 ovs-ofctl add-flow br0 in_port=0,dl_vlan=123,actions=output:1
2041 # Start a monitor watching the flow table and check the initial reply.
2042 ovs-ofctl monitor br0 watch: --detach --no-chdir --pidfile >monitor.log 2>&1
2043 AT_CAPTURE_FILE([monitor.log])
2044 ovs-appctl -t ovs-ofctl ofctl/barrier
2045 AT_CHECK([sed 's/ (xid=0x[[1-9a-fA-F]][[0-9a-fA-F]]*)//' monitor.log], [0],
2046 [NXST_FLOW_MONITOR reply:
2047 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=123 actions=output:1
2051 # Add, delete, and modify some flows and check the updates.
2052 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
2053 ovs-ofctl add-flow br0 in_port=0,dl_vlan=124,actions=output:2
2054 ovs-ofctl add-flow br0 in_port=0,dl_vlan=123,actions=output:5
2055 ovs-ofctl add-flow br0 in_port=0,dl_vlan=123,dl_vlan_pcp=0,actions=output:6
2056 ovs-ofctl add-flow br0 in_port=0,dl_vlan=123,dl_vlan_pcp=1,actions=output:7
2057 ovs-ofctl add-flow br0 in_port=0,dl_vlan=123,actions=output:8
2058 ovs-ofctl add-flow br0 in_port=0,dl_vlan=65535,dl_vlan_pcp=0,actions=output:9
2059 ovs-ofctl add-flow br0 in_port=0,dl_vlan=65535,dl_vlan_pcp=1,actions=output:10
2060 ovs-ofctl add-flow br0 in_port=0,dl_vlan=65535,actions=output:11
2061 ovs-ofctl add-flow br0 in_port=0,dl_vlan=8191,dl_vlan_pcp=0,actions=output:12
2062 ovs-ofctl add-flow br0 in_port=0,dl_vlan=8191,dl_vlan_pcp=1,actions=output:13
2063 ovs-ofctl add-flow br0 in_port=0,dl_vlan=8191,actions=output:14
2064 ovs-ofctl add-flow br0 in_port=0,dl_vlan=0,dl_vlan_pcp=0,actions=output:15
2065 ovs-ofctl add-flow br0 in_port=0,dl_vlan=0,dl_vlan_pcp=1,actions=output:16
2066 ovs-ofctl add-flow br0 in_port=0,dl_vlan=0,actions=output:17
2067 ovs-ofctl add-flow br0 in_port=0,dl_vlan=0,dl_vlan_pcp=0,actions=output:18
2068 ovs-ofctl add-flow br0 in_port=0,dl_vlan=0,dl_vlan_pcp=1,actions=output:19
2069 ovs-ofctl add-flow br0 in_port=0,dl_vlan=0,actions=output:20
2070 ovs-ofctl add-flow br0 in_port=0,dl_vlan_pcp=0,actions=output:21
2071 ovs-ofctl add-flow br0 in_port=0,dl_vlan_pcp=1,actions=output:22
2072 ovs-ofctl add-flow br0 in_port=0,actions=output:23
2073 ovs-ofctl mod-flows br0 cookie=5,dl_vlan=123,actions=output:3
2074 ovs-ofctl del-flows br0 dl_vlan=123
2075 ovs-ofctl del-flows br0
2076 ovs-appctl -t ovs-ofctl ofctl/barrier
2078 # Sorts groups of lines that start with a space, without moving them
2079 # past the nearest line that does not start with a space.
2087 print $_ foreach sort(@buffer);
2092 print $_ foreach sort(@buffer);
2094 AT_CHECK([sed 's/ (xid=0x[[1-9a-fA-F]][[0-9a-fA-F]]*)//' monitor.log | ${PERL} -e "$sort"], [0],
2095 [NXST_FLOW_MONITOR reply (xid=0x0):
2096 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=124 actions=output:2
2097 NXST_FLOW_MONITOR reply (xid=0x0):
2098 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=123 actions=output:5
2099 NXST_FLOW_MONITOR reply (xid=0x0):
2100 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=123,dl_vlan_pcp=0 actions=output:6
2101 NXST_FLOW_MONITOR reply (xid=0x0):
2102 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=123,dl_vlan_pcp=1 actions=output:7
2103 NXST_FLOW_MONITOR reply (xid=0x0):
2104 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=123 actions=output:8
2105 NXST_FLOW_MONITOR reply (xid=0x0):
2106 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=0,dl_vlan_pcp=0 actions=output:9
2107 NXST_FLOW_MONITOR reply (xid=0x0):
2108 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=0,dl_vlan_pcp=1 actions=output:10
2109 NXST_FLOW_MONITOR reply (xid=0x0):
2110 event=ADDED table=0 cookie=0 in_port=0,vlan_tci=0x0000 actions=output:11
2111 NXST_FLOW_MONITOR reply (xid=0x0):
2112 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=4095,dl_vlan_pcp=0 actions=output:12
2113 NXST_FLOW_MONITOR reply (xid=0x0):
2114 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=4095,dl_vlan_pcp=1 actions=output:13
2115 NXST_FLOW_MONITOR reply (xid=0x0):
2116 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=4095 actions=output:14
2117 NXST_FLOW_MONITOR reply (xid=0x0):
2118 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=0,dl_vlan_pcp=0 actions=output:15
2119 NXST_FLOW_MONITOR reply (xid=0x0):
2120 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=0,dl_vlan_pcp=1 actions=output:16
2121 NXST_FLOW_MONITOR reply (xid=0x0):
2122 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=0 actions=output:17
2123 NXST_FLOW_MONITOR reply (xid=0x0):
2124 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=0,dl_vlan_pcp=0 actions=output:18
2125 NXST_FLOW_MONITOR reply (xid=0x0):
2126 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=0,dl_vlan_pcp=1 actions=output:19
2127 NXST_FLOW_MONITOR reply (xid=0x0):
2128 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=0 actions=output:20
2129 NXST_FLOW_MONITOR reply (xid=0x0):
2130 event=ADDED table=0 cookie=0 in_port=0,dl_vlan_pcp=0 actions=output:21
2131 NXST_FLOW_MONITOR reply (xid=0x0):
2132 event=ADDED table=0 cookie=0 in_port=0,dl_vlan_pcp=1 actions=output:22
2133 NXST_FLOW_MONITOR reply (xid=0x0):
2134 event=ADDED table=0 cookie=0 in_port=0 actions=output:23
2135 NXST_FLOW_MONITOR reply (xid=0x0):
2136 event=MODIFIED table=0 cookie=0x5 in_port=0,dl_vlan=123 actions=output:3
2137 event=MODIFIED table=0 cookie=0x5 in_port=0,dl_vlan=123,dl_vlan_pcp=0 actions=output:3
2138 event=MODIFIED table=0 cookie=0x5 in_port=0,dl_vlan=123,dl_vlan_pcp=1 actions=output:3
2139 NXST_FLOW_MONITOR reply (xid=0x0):
2140 event=DELETED reason=delete table=0 cookie=0x5 in_port=0,dl_vlan=123 actions=output:3
2141 event=DELETED reason=delete table=0 cookie=0x5 in_port=0,dl_vlan=123,dl_vlan_pcp=0 actions=output:3
2142 event=DELETED reason=delete table=0 cookie=0x5 in_port=0,dl_vlan=123,dl_vlan_pcp=1 actions=output:3
2143 NXST_FLOW_MONITOR reply (xid=0x0):
2144 event=DELETED reason=delete table=0 cookie=0 in_port=0 actions=output:23
2145 event=DELETED reason=delete table=0 cookie=0 in_port=0,dl_vlan=0 actions=output:20
2146 event=DELETED reason=delete table=0 cookie=0 in_port=0,dl_vlan=0,dl_vlan_pcp=0 actions=output:18
2147 event=DELETED reason=delete table=0 cookie=0 in_port=0,dl_vlan=0,dl_vlan_pcp=1 actions=output:19
2148 event=DELETED reason=delete table=0 cookie=0 in_port=0,dl_vlan=124 actions=output:2
2149 event=DELETED reason=delete table=0 cookie=0 in_port=0,dl_vlan=4095 actions=output:14
2150 event=DELETED reason=delete table=0 cookie=0 in_port=0,dl_vlan=4095,dl_vlan_pcp=0 actions=output:12
2151 event=DELETED reason=delete table=0 cookie=0 in_port=0,dl_vlan=4095,dl_vlan_pcp=1 actions=output:13
2152 event=DELETED reason=delete table=0 cookie=0 in_port=0,dl_vlan_pcp=0 actions=output:21
2153 event=DELETED reason=delete table=0 cookie=0 in_port=0,dl_vlan_pcp=1 actions=output:22
2154 event=DELETED reason=delete table=0 cookie=0 in_port=0,vlan_tci=0x0000 actions=output:11
2158 # Check that our own changes are reported as abbreviations.
2159 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
2160 ovs-ofctl add-flow br0 in_port=1,actions=output:2
2161 ovs-ofctl add-flow br0 in_port=2,actions=output:1
2162 ovs-appctl -t ovs-ofctl ofctl/barrier
2163 ovs-appctl -t ovs-ofctl ofctl/send 010e004812345678003fffff00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003000000000000ffffffffffff0000
2164 ovs-appctl -t ovs-ofctl ofctl/barrier
2165 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip], [0], [NXST_FLOW reply:
2167 AT_CHECK([sed 's/ (xid=0x[[1-9a-fA-F]][[0-9a-fA-F]]*)//' monitor.log], [0],
2168 [NXST_FLOW_MONITOR reply (xid=0x0):
2169 event=ADDED table=0 cookie=0 in_port=1 actions=output:2
2170 NXST_FLOW_MONITOR reply (xid=0x0):
2171 event=ADDED table=0 cookie=0 in_port=2 actions=output:1
2173 send: OFPT_FLOW_MOD: DEL priority=0 actions=drop
2174 NXST_FLOW_MONITOR reply (xid=0x0):
2175 event=ABBREV xid=0x12345678
2179 ovs-appctl -t ovs-ofctl exit
2183 AT_SETUP([ofproto - flow monitoring pause and resume])
2184 AT_KEYWORDS([monitor])
2186 # The maximum socket receive buffer size is important for this test, which
2187 # tests behavior when the receive buffer overflows.
2188 if test -e /proc/sys/net/core/rmem_max; then
2190 rmem_max=`cat /proc/sys/net/core/rmem_max`
2191 elif rmem_max=`sysctl -n net.inet.tcp.recvbuf_max 2>/dev/null`; then
2194 # Don't know how to get maximum socket receive buffer on this OS
2197 # Calculate the total amount of queuing: rmem_max in the kernel, 128 kB
2198 # in ofproto sending userspace (see ofmonitor_flush() in connmgr.c).
2199 queue_size=`expr $rmem_max + 128 \* 1024`
2200 echo rmem_max=$rmem_max queue_size=$queue_size
2202 # If there's too much queuing skip the test to avoid timing out.
2203 AT_SKIP_IF([test $rmem_max -gt 1048576])
2205 # Each flow update message takes up at least 48 bytes of space in queues
2206 # and in practice more than that.
2207 n_msgs=`expr $queue_size / 48`
2212 # Start a monitor watching the flow table, then make it block.
2213 ON_EXIT([kill `cat ovs-ofctl.pid`])
2214 ovs-ofctl monitor br0 watch: --detach --no-chdir --pidfile >monitor.log 2>&1
2215 AT_CAPTURE_FILE([monitor.log])
2216 ovs-appctl -t ovs-ofctl ofctl/block
2218 # Add $n_msgs flows.
2219 (echo "in_port=2,actions=output:2"
2221 for ($i = 0; $i < '$n_msgs'; $i++) {
2222 print "cookie=1,reg1=$i,actions=drop\n";
2225 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
2226 # Check that multipart flow dumps work properly:
2227 AT_CHECK([ovs-ofctl diff-flows br0 flows.txt])
2228 AT_CHECK([ovs-ofctl add-flow br0 in_port=1,cookie=3,actions=drop])
2229 AT_CHECK([ovs-ofctl mod-flows br0 in_port=2,cookie=2,actions=output:2])
2230 AT_CHECK([ovs-ofctl del-flows br0 cookie=1/-1])
2232 ovs-appctl -t ovs-ofctl ofctl/unblock
2234 # Wait for the connection resumed.
2235 # A barrier doesn't work for this purpose.
2236 # https://www.mail-archive.com/dev@openvswitch.org/msg27013.html
2237 # https://www.mail-archive.com/dev@openvswitch.org/msg27675.html
2238 OVS_WAIT_UNTIL([grep NXT_FLOW_MONITOR_RESUMED monitor.log])
2240 ovs-appctl -t ovs-ofctl exit
2242 # Check that the flow monitor reported the same number of flows
2243 # added and deleted, but fewer than we actually added and deleted.
2244 adds=`grep -c 'ADDED.*reg1=' monitor.log`
2245 deletes=`grep -c 'DELETED.*reg1=' monitor.log`
2246 echo adds=$adds deletes=$deletes
2247 AT_CHECK([test $adds -gt 100 && test $adds -lt $n_msgs])
2248 AT_CHECK([test $adds = $deletes])
2250 # Check that the flow monitor reported everything in the expected order:
2252 # event=ADDED table=0 cookie=0x1 reg1=0x22
2254 # NXT_FLOW_MONITOR_PAUSED:
2256 # event=DELETED reason=delete table=0 cookie=0x1 reg1=0x22
2258 # event=ADDED table=0 cookie=0x3 in_port=1
2259 # event=MODIFIED table=0 cookie=0x2 in_port=2 actions=output:2
2260 # NXT_FLOW_MONITOR_RESUMED:
2262 # except that, between the PAUSED and RESUMED, the order of the ADDED
2263 # and MODIFIED lines lines depends on hash order, that is, it varies
2264 # as we change the hash function or change architecture. Therefore,
2265 # we use a couple of tests below to accept both orders.
2266 AT_CHECK([ofctl_strip < monitor.log | sed -n -e '
2269 /NXT_FLOW_MONITOR_PAUSED:/p
2270 /NXT_FLOW_MONITOR_RESUMED:/p
2271 ' > monitor.log.subset])
2272 AT_CHECK([grep -v MODIFIED monitor.log.subset], [0], [dnl
2273 event=ADDED table=0 cookie=0x1 reg1=0x22
2274 NXT_FLOW_MONITOR_PAUSED:
2275 event=DELETED reason=delete table=0 cookie=0x1 reg1=0x22
2276 event=ADDED table=0 cookie=0x3 in_port=1
2277 NXT_FLOW_MONITOR_RESUMED:
2279 AT_CHECK([grep -v ADDED monitor.log.subset], [0], [dnl
2280 NXT_FLOW_MONITOR_PAUSED:
2281 event=DELETED reason=delete table=0 cookie=0x1 reg1=0x22
2282 event=MODIFIED table=0 cookie=0x2 in_port=2 actions=output:2
2283 NXT_FLOW_MONITOR_RESUMED:
2289 AT_SETUP([ofproto - event filtering (OpenFlow 1.3)])
2290 AT_KEYWORDS([monitor])
2293 # Start a monitor, use the required protocol version
2294 ovs-ofctl -O OpenFlow13 monitor br0 --detach --no-chdir --pidfile >monitor.log 2>&1
2295 AT_CAPTURE_FILE([monitor.log])
2297 # Send an OpenFlow13 message (04), OFPT_GET_ASYNC_REQUEST (1a), length (8), xid (0a)
2298 ovs-appctl -t ovs-ofctl ofctl/send 041a00080000000a
2299 ovs-appctl -t ovs-ofctl ofctl/barrier
2301 # Check default setting
2302 read -r -d '' expected <<'EOF'
2305 AT_CHECK([ofctl_strip < monitor.log], [], [dnl
2306 send: OFPT_GET_ASYNC_REQUEST (OF1.3):
2307 OFPT_GET_ASYNC_REPLY (OF1.3):
2309 PACKET_IN: no_match action
2310 PORT_STATUS: add delete modify
2311 FLOW_REMOVED: idle hard delete
2315 PORT_STATUS: add delete modify
2317 OFPT_BARRIER_REPLY (OF1.3):
2323 AT_SETUP([ofproto - ofport_request])
2325 ADD_OF_PORTS([br0], [1], [2], [3])
2327 set_and_check_specific_ofports () {
2328 ovs-vsctl set Interface p1 ofport_request="$1" -- \
2329 set Interface p2 ofport_request="$2" -- \
2330 set Interface p3 ofport_request="$3"
2331 ofports=`ovs-vsctl get Interface p1 ofport -- \
2332 get Interface p2 ofport -- \
2333 get Interface p3 ofport`
2334 AT_CHECK_UNQUOTED([echo $ofports], [0], [$1 $2 $3
2337 for pre in '1 2 3' '1 3 2' '2 1 3' '2 3 1' '3 1 2' '3 2 1'; do
2338 for post in '1 2 3' '1 3 2' '2 1 3' '2 3 1' '3 1 2' '3 2 1'; do
2339 echo -----------------------------------------------------------
2340 echo "Check changing port numbers from $pre to $post"
2341 set_and_check_ofports $pre
2342 set_and_check_ofports $post
2346 ovs-vsctl del-port p3
2348 set_and_check_poorly_specified_ofports () {
2349 ovs-vsctl set Interface p1 ofport_request="$1" -- \
2350 set Interface p2 ofport_request="$2"
2351 p1=`ovs-vsctl get Interface p1 ofport`
2352 p2=`ovs-vsctl get Interface p2 ofport`
2355 AT_CHECK([test "$p1" != "$p2"])
2356 if test "$1" = "$2" && test "$1" != '[[]]'; then
2357 # One port number must be the requested one.
2358 AT_CHECK([test "$p1" = "$1" || test "$p2" = "$1"])
2359 # The other port number must be different (already tested above).
2361 AT_CHECK([test "$1" = '[[]]' || test "$p1" == "$1"])
2362 AT_CHECK([test "$2" = '[[]]' || test "$p2" == "$2"])
2365 for pre in '1 2' '[[]] 2' '1 [[]]' '[[]] [[]]' '2 1' '[[]] 1' '2 [[]]' \
2367 for post in '1 2' '[[]] 2' '1 [[]]' '[[]] [[]]' '2 1' '[[]] 1' '2 [[]]' \
2369 echo -----------------------------------------------------------
2370 echo "Check changing port numbers from $pre to $post"
2371 set_and_check_poorly_specified_ofports $pre
2372 set_and_check_poorly_specified_ofports $post
2379 AT_SETUP([ofproto - bundles, open (OpenFlow 1.4)])
2380 AT_KEYWORDS([monitor])
2383 # Start a monitor, use the required protocol version
2384 ovs-ofctl -O OpenFlow14 monitor br0 --detach --no-chdir --pidfile >monitor.log 2>&1
2385 AT_CAPTURE_FILE([monitor.log])
2387 # Send an OpenFlow14 message (05), OFPT_BUNDLE_CONTROL (21), length (10), xid (0a)
2388 ovs-appctl -t ovs-ofctl ofctl/send "05 21 00 10 00 00 00 0a 00 00 00 01 00 00 00 01"
2389 ovs-appctl -t ovs-ofctl ofctl/barrier
2390 ovs-appctl -t ovs-ofctl exit
2392 AT_CHECK([ofctl_strip < monitor.log], [], [dnl
2393 send: OFPT_BUNDLE_CONTROL (OF1.4):
2394 bundle_id=0x1 type=OPEN_REQUEST flags=atomic
2395 OFPT_BUNDLE_CONTROL (OF1.4):
2396 bundle_id=0x1 type=OPEN_REPLY flags=0
2397 OFPT_BARRIER_REPLY (OF1.4):
2403 AT_SETUP([ofproto - bundles, double open (OpenFlow 1.4)])
2404 AT_KEYWORDS([monitor])
2407 # Start a monitor, use the required protocol version
2408 ovs-ofctl -O OpenFlow14 monitor br0 --detach --no-chdir --pidfile >monitor.log 2>&1
2409 AT_CAPTURE_FILE([monitor.log])
2411 # Send twice an OpenFlow14 message (05), OFPT_BUNDLE_CONTROL (21), length (10), xid (0a)
2412 ovs-appctl -t ovs-ofctl ofctl/send "05 21 00 10 00 00 00 0a 00 00 00 01 00 00 00 01"
2413 ovs-appctl -t ovs-ofctl ofctl/barrier
2414 ovs-appctl -t ovs-ofctl ofctl/send "05 21 00 10 00 00 00 0a 00 00 00 01 00 00 00 01"
2415 ovs-appctl -t ovs-ofctl ofctl/barrier
2416 ovs-appctl -t ovs-ofctl exit
2418 AT_CHECK([ofctl_strip < monitor.log], [0], [dnl
2419 send: OFPT_BUNDLE_CONTROL (OF1.4):
2420 bundle_id=0x1 type=OPEN_REQUEST flags=atomic
2421 OFPT_BUNDLE_CONTROL (OF1.4):
2422 bundle_id=0x1 type=OPEN_REPLY flags=0
2423 OFPT_BARRIER_REPLY (OF1.4):
2424 send: OFPT_BUNDLE_CONTROL (OF1.4):
2425 bundle_id=0x1 type=OPEN_REQUEST flags=atomic
2426 OFPT_ERROR (OF1.4): OFPBFC_BAD_ID
2427 OFPT_BUNDLE_CONTROL (OF1.4):
2428 bundle_id=0x1 type=OPEN_REQUEST flags=atomic
2429 OFPT_BARRIER_REPLY (OF1.4):
2435 AT_SETUP([ofproto - bundle close without open (OpenFlow 1.4)])
2436 AT_KEYWORDS([monitor])
2439 # Start a monitor, use the required protocol version
2440 ovs-ofctl -O OpenFlow14 monitor br0 --detach --no-chdir --pidfile >monitor.log 2>&1
2441 AT_CAPTURE_FILE([monitor.log])
2443 ovs-appctl -t ovs-ofctl ofctl/send "05 21 00 10 00 00 00 0a 00 00 00 01 00 02 00 01"
2444 ovs-appctl -t ovs-ofctl ofctl/barrier
2445 ovs-appctl -t ovs-ofctl exit
2447 AT_CHECK([ofctl_strip < monitor.log], [0], [dnl
2448 send: OFPT_BUNDLE_CONTROL (OF1.4):
2449 bundle_id=0x1 type=CLOSE_REQUEST flags=atomic
2450 OFPT_ERROR (OF1.4): OFPBFC_BAD_ID
2451 OFPT_BUNDLE_CONTROL (OF1.4):
2452 bundle_id=0x1 type=CLOSE_REQUEST flags=atomic
2453 OFPT_BARRIER_REPLY (OF1.4):
2459 AT_SETUP([ofproto - bundle double close (OpenFlow 1.4)])
2460 AT_KEYWORDS([monitor])
2463 # Start a monitor, use the required protocol version
2464 ovs-ofctl -O OpenFlow14 monitor br0 --detach --no-chdir --pidfile >monitor.log 2>&1
2465 AT_CAPTURE_FILE([monitor.log])
2467 # Open, Close, Close
2468 ovs-appctl -t ovs-ofctl ofctl/send "05 21 00 10 00 00 00 0a 00 00 00 01 00 00 00 01"
2469 ovs-appctl -t ovs-ofctl ofctl/barrier
2470 ovs-appctl -t ovs-ofctl ofctl/send "05 21 00 10 00 00 00 0a 00 00 00 01 00 02 00 01"
2471 ovs-appctl -t ovs-ofctl ofctl/barrier
2472 ovs-appctl -t ovs-ofctl ofctl/send "05 21 00 10 00 00 00 0a 00 00 00 01 00 02 00 01"
2473 ovs-appctl -t ovs-ofctl ofctl/barrier
2474 ovs-appctl -t ovs-ofctl exit
2476 AT_CHECK([ofctl_strip < monitor.log], [0], [dnl
2477 send: OFPT_BUNDLE_CONTROL (OF1.4):
2478 bundle_id=0x1 type=OPEN_REQUEST flags=atomic
2479 OFPT_BUNDLE_CONTROL (OF1.4):
2480 bundle_id=0x1 type=OPEN_REPLY flags=0
2481 OFPT_BARRIER_REPLY (OF1.4):
2482 send: OFPT_BUNDLE_CONTROL (OF1.4):
2483 bundle_id=0x1 type=CLOSE_REQUEST flags=atomic
2484 OFPT_BUNDLE_CONTROL (OF1.4):
2485 bundle_id=0x1 type=CLOSE_REPLY flags=0
2486 OFPT_BARRIER_REPLY (OF1.4):
2487 send: OFPT_BUNDLE_CONTROL (OF1.4):
2488 bundle_id=0x1 type=CLOSE_REQUEST flags=atomic
2489 OFPT_ERROR (OF1.4): OFPBFC_BUNDLE_CLOSED
2490 OFPT_BUNDLE_CONTROL (OF1.4):
2491 bundle_id=0x1 type=CLOSE_REQUEST flags=atomic
2492 OFPT_BARRIER_REPLY (OF1.4):
2498 AT_SETUP([ofproto - bundle close, different flags (OpenFlow 1.4)])
2499 AT_KEYWORDS([monitor])
2502 # Start a monitor, use the required protocol version
2503 ovs-ofctl -O OpenFlow14 monitor br0 --detach --no-chdir --pidfile >monitor.log 2>&1
2504 AT_CAPTURE_FILE([monitor.log])
2506 # Open, Close, Close
2507 ovs-appctl -t ovs-ofctl ofctl/send "05 21 00 10 00 00 00 0a 00 00 00 01 00 00 00 01"
2508 ovs-appctl -t ovs-ofctl ofctl/barrier
2509 ovs-appctl -t ovs-ofctl ofctl/send "05 21 00 10 00 00 00 0a 00 00 00 01 00 02 00 02"
2510 ovs-appctl -t ovs-ofctl ofctl/barrier
2511 ovs-appctl -t ovs-ofctl exit
2513 AT_CHECK([ofctl_strip < monitor.log], [0], [dnl
2514 send: OFPT_BUNDLE_CONTROL (OF1.4):
2515 bundle_id=0x1 type=OPEN_REQUEST flags=atomic
2516 OFPT_BUNDLE_CONTROL (OF1.4):
2517 bundle_id=0x1 type=OPEN_REPLY flags=0
2518 OFPT_BARRIER_REPLY (OF1.4):
2519 send: OFPT_BUNDLE_CONTROL (OF1.4):
2520 bundle_id=0x1 type=CLOSE_REQUEST flags=ordered
2521 OFPT_ERROR (OF1.4): OFPBFC_BAD_FLAGS
2522 OFPT_BUNDLE_CONTROL (OF1.4):
2523 bundle_id=0x1 type=CLOSE_REQUEST flags=ordered
2524 OFPT_BARRIER_REPLY (OF1.4):
2530 AT_SETUP([ofproto - bundle commit without open (OpenFlow 1.4)])
2531 AT_KEYWORDS([monitor])
2534 # Start a monitor, use the required protocol version
2535 ovs-ofctl -O OpenFlow14 monitor br0 --detach --no-chdir --pidfile >monitor.log 2>&1
2536 AT_CAPTURE_FILE([monitor.log])
2538 # Open, Close, Close
2539 ovs-appctl -t ovs-ofctl ofctl/send "05 21 00 10 00 00 00 0a 00 00 00 01 00 04 00 01"
2540 ovs-appctl -t ovs-ofctl ofctl/barrier
2541 ovs-appctl -t ovs-ofctl exit
2543 AT_CHECK([ofctl_strip < monitor.log], [0], [dnl
2544 send: OFPT_BUNDLE_CONTROL (OF1.4):
2545 bundle_id=0x1 type=COMMIT_REQUEST flags=atomic
2546 OFPT_ERROR (OF1.4): OFPBFC_BAD_ID
2547 OFPT_BUNDLE_CONTROL (OF1.4):
2548 bundle_id=0x1 type=COMMIT_REQUEST flags=atomic
2549 OFPT_BARRIER_REPLY (OF1.4):
2555 AT_SETUP([ofproto - bundle commit, different flags (OpenFlow 1.4)])
2556 AT_KEYWORDS([monitor])
2559 # Start a monitor, use the required protocol version
2560 ovs-ofctl -O OpenFlow14 monitor br0 --detach --no-chdir --pidfile >monitor.log 2>&1
2561 AT_CAPTURE_FILE([monitor.log])
2563 # Open, Close, Close
2564 ovs-appctl -t ovs-ofctl ofctl/send "05 21 00 10 00 00 00 0a 00 00 00 01 00 00 00 01"
2565 ovs-appctl -t ovs-ofctl ofctl/barrier
2566 ovs-appctl -t ovs-ofctl ofctl/send "05 21 00 10 00 00 00 0a 00 00 00 01 00 04 00 02"
2567 ovs-appctl -t ovs-ofctl ofctl/barrier
2568 ovs-appctl -t ovs-ofctl exit
2570 AT_CHECK([ofctl_strip < monitor.log], [0], [dnl
2571 send: OFPT_BUNDLE_CONTROL (OF1.4):
2572 bundle_id=0x1 type=OPEN_REQUEST flags=atomic
2573 OFPT_BUNDLE_CONTROL (OF1.4):
2574 bundle_id=0x1 type=OPEN_REPLY flags=0
2575 OFPT_BARRIER_REPLY (OF1.4):
2576 send: OFPT_BUNDLE_CONTROL (OF1.4):
2577 bundle_id=0x1 type=COMMIT_REQUEST flags=ordered
2578 OFPT_ERROR (OF1.4): OFPBFC_BAD_FLAGS
2579 OFPT_BUNDLE_CONTROL (OF1.4):
2580 bundle_id=0x1 type=COMMIT_REQUEST flags=ordered
2581 OFPT_BARRIER_REPLY (OF1.4):
2587 AT_SETUP([ofproto - bundle discard without open (OpenFlow 1.4)])
2588 AT_KEYWORDS([monitor])
2591 # Start a monitor, use the required protocol version
2592 ovs-ofctl -O OpenFlow14 monitor br0 --detach --no-chdir --pidfile >monitor.log 2>&1
2593 AT_CAPTURE_FILE([monitor.log])
2595 # Open, Close, Close
2596 ovs-appctl -t ovs-ofctl ofctl/send "05 21 00 10 00 00 00 0a 00 00 00 01 00 06 00 01"
2597 ovs-appctl -t ovs-ofctl ofctl/barrier
2598 ovs-appctl -t ovs-ofctl exit
2600 AT_CHECK([ofctl_strip < monitor.log], [0], [dnl
2601 send: OFPT_BUNDLE_CONTROL (OF1.4):
2602 bundle_id=0x1 type=DISCARD_REQUEST flags=atomic
2603 OFPT_ERROR (OF1.4): OFPBFC_BAD_ID
2604 OFPT_BUNDLE_CONTROL (OF1.4):
2605 bundle_id=0x1 type=DISCARD_REQUEST flags=atomic
2606 OFPT_BARRIER_REPLY (OF1.4):