3 AT_SETUP([ofproto - echo request])
5 AT_CHECK([ovs-ofctl -vwarn probe br0])
9 AT_SETUP([ofproto - feature request, config request])
11 AT_CHECK([ovs-ofctl -vwarn show br0], [0], [stdout])
12 AT_CHECK([STRIP_XIDS stdout], [0], [dnl
13 OFPT_FEATURES_REPLY: dpid:fedcba9876543210
14 n_tables:254, n_buffers:256
15 capabilities: FLOW_STATS TABLE_STATS PORT_STATS QUEUE_STATS ARP_MATCH_IP
16 actions: OUTPUT SET_VLAN_VID SET_VLAN_PCP STRIP_VLAN SET_DL_SRC SET_DL_DST SET_NW_SRC SET_NW_DST SET_NW_TOS SET_TP_SRC SET_TP_DST ENQUEUE
17 LOCAL(br0): addr:aa:55:aa:55:00:00
20 speed: 0 Mbps now, 0 Mbps max
21 OFPT_GET_CONFIG_REPLY: frags=normal miss_send_len=0
26 AT_SETUP([ofproto - set OpenFlow port number])
28 [add-port br0 p1 -- set Interface p1 type=dummy --\
29 add-port br0 p2 -- set Interface p2 type=dummy ofport_request=99])
30 AT_CHECK([ovs-ofctl -vwarn show br0], [0], [stdout])
32 s/ (xid=0x[0-9a-fA-F]*)//
33 s/00:0.$/00:0x/' < stdout]],
35 OFPT_FEATURES_REPLY: dpid:fedcba9876543210
36 n_tables:254, n_buffers:256
37 capabilities: FLOW_STATS TABLE_STATS PORT_STATS QUEUE_STATS ARP_MATCH_IP
38 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
39 1(p1): addr:aa:55:aa:55:00:0x
42 speed: 0 Mbps now, 0 Mbps max
43 99(p2): addr:aa:55:aa:55:00:0x
46 speed: 0 Mbps now, 0 Mbps max
47 LOCAL(br0): addr:aa:55:aa:55:00:0x
50 speed: 0 Mbps now, 0 Mbps max
51 OFPT_GET_CONFIG_REPLY: frags=normal miss_send_len=0
57 dnl This is really bare-bones.
58 dnl It at least checks request and reply serialization and deserialization.
59 AT_SETUP([ofproto - port stats - (OpenFlow 1.0)])
61 AT_CHECK([ovs-ofctl -vwarn dump-ports br0], [0], [stdout])
62 AT_CHECK([STRIP_XIDS stdout], [0], [dnl
63 OFPST_PORT reply: 1 ports
64 port LOCAL: rx pkts=0, bytes=0, drop=0, errs=0, frame=0, over=0, crc=0
65 tx pkts=0, bytes=0, drop=0, errs=0, coll=0
70 AT_SETUP([ofproto - port stats - (OpenFlow 1.2)])
72 AT_CHECK([ovs-ofctl -O OpenFlow12 -vwarn dump-ports br0], [0], [stdout])
73 AT_CHECK([STRIP_XIDS stdout], [0], [dnl
74 OFPST_PORT reply (OF1.2): 1 ports
75 port LOCAL: rx pkts=0, bytes=0, drop=0, errs=0, frame=0, over=0, crc=0
76 tx pkts=0, bytes=0, drop=0, errs=0, coll=0
81 dnl This is really bare-bones.
82 dnl It at least checks request and reply serialization and deserialization.
83 AT_SETUP([ofproto - port-desc stats (OpenFlow 1.0)])
85 AT_CHECK([ovs-ofctl -vwarn dump-ports-desc br0], [0], [stdout])
86 AT_CHECK([STRIP_XIDS stdout], [0], [dnl
87 OFPST_PORT_DESC reply:
88 LOCAL(br0): addr:aa:55:aa:55:00:00
91 speed: 0 Mbps now, 0 Mbps max
96 dnl This is really bare-bones.
97 dnl It at least checks request and reply serialization and deserialization.
98 AT_SETUP([ofproto - port-desc stats (OpenFlow 1.2)])
100 AT_CHECK([ovs-ofctl -O OpenFlow12 -vwarn dump-ports-desc br0], [0], [stdout])
101 AT_CHECK([STRIP_XIDS stdout], [0], [dnl
102 OFPST_PORT_DESC reply (OF1.2):
103 LOCAL(br0): addr:aa:55:aa:55:00:00
106 speed: 0 Mbps now, 0 Mbps max
111 dnl This is really bare-bones.
112 dnl It at least checks request and reply serialization and deserialization.
113 AT_SETUP([ofproto - queue stats - (OpenFlow 1.0)])
115 AT_CHECK([ovs-ofctl -vwarn queue-stats br0], [0], [stdout])
116 AT_CHECK([STRIP_XIDS stdout], [0], [dnl
117 OFPST_QUEUE reply: 0 queues
119 AT_CHECK([ovs-ofctl -vwarn queue-stats br0 ANY 5], [0],
120 [OFPT_ERROR (xid=0x2): OFPQOFC_BAD_QUEUE
121 OFPST_QUEUE request (xid=0x2):port=ANY queue=5
123 AT_CHECK([ovs-ofctl -vwarn queue-stats br0 10], [0],
124 [OFPT_ERROR (xid=0x2): OFPQOFC_BAD_PORT
125 OFPST_QUEUE request (xid=0x2):port=10 queue=ALL
130 AT_SETUP([ofproto - queue stats - (OpenFlow 1.2)])
132 AT_CHECK([ovs-ofctl -O OpenFlow12 -vwarn queue-stats br0], [0], [stdout])
133 AT_CHECK([STRIP_XIDS stdout], [0], [dnl
134 OFPST_QUEUE reply (OF1.2): 0 queues
136 AT_CHECK([ovs-ofctl -O OpenFlow12 -vwarn queue-stats br0 ALL 5], [0],
137 [OFPT_ERROR (OF1.2) (xid=0x2): OFPQOFC_BAD_QUEUE
138 OFPST_QUEUE request (OF1.2) (xid=0x2):port=ANY queue=5
140 AT_CHECK([ovs-ofctl -O OpenFlow12 -vwarn queue-stats br0 10], [0],
141 [OFPT_ERROR (OF1.2) (xid=0x2): OFPQOFC_BAD_PORT
142 OFPST_QUEUE request (OF1.2) (xid=0x2):port=10 queue=ALL
147 dnl This is really bare-bones.
148 dnl It at least checks request and reply serialization and deserialization.
149 AT_SETUP([ofproto - queue configuration - (OpenFlow 1.0)])
151 ADD_OF_PORTS([br0], [1], [2])
152 AT_CHECK([ovs-ofctl queue-get-config br0 1], [0], [stdout])
153 AT_CHECK([STRIP_XIDS stdout], [0], [dnl
154 OFPT_QUEUE_GET_CONFIG_REPLY: port=1
156 AT_CHECK([ovs-ofctl queue-get-config br0 10], [0],
157 [OFPT_ERROR (xid=0x2): OFPQOFC_BAD_PORT
158 OFPT_QUEUE_GET_CONFIG_REQUEST (xid=0x2): port=10
163 AT_SETUP([ofproto - queue configuration - (OpenFlow 1.2)])
165 ADD_OF_PORTS([br0], [1], [2])
166 AT_CHECK([ovs-ofctl -O OpenFlow12 queue-get-config br0 1], [0], [stdout])
167 AT_CHECK([STRIP_XIDS stdout], [0], [dnl
168 OFPT_QUEUE_GET_CONFIG_REPLY (OF1.2): port=1
170 AT_CHECK([ovs-ofctl -O OpenFlow12 queue-get-config br0 10], [0],
171 [OFPT_ERROR (OF1.2) (xid=0x2): OFPQOFC_BAD_PORT
172 OFPT_QUEUE_GET_CONFIG_REQUEST (OF1.2) (xid=0x2): port=10
177 dnl This is really bare-bones.
178 dnl It at least checks request and reply serialization and deserialization.
179 AT_SETUP([ofproto - group features])
181 AT_CHECK([ovs-ofctl -O OpenFlow12 -vwarn dump-group-features br0], [0], [stdout])
182 AT_CHECK([STRIP_XIDS stdout], [0], [dnl
183 OFPST_GROUP_FEATURES reply (OF1.2):
191 AT_SETUP([ofproto - mod-port (OpenFlow 1.0)])
193 for command_config_state in \
195 'noflood NO_FLOOD 0' \
196 'down PORT_DOWN,NO_FLOOD LINK_DOWN' \
197 'flood PORT_DOWN LINK_DOWN' \
198 'no-receive PORT_DOWN,NO_RECV LINK_DOWN' \
199 'no-forward PORT_DOWN,NO_RECV,NO_FWD LINK_DOWN' \
200 'no-packet-in PORT_DOWN,NO_RECV,NO_FWD,NO_PACKET_IN LINK_DOWN' \
201 'forward PORT_DOWN,NO_RECV,NO_PACKET_IN LINK_DOWN' \
202 'packet-in PORT_DOWN,NO_RECV LINK_DOWN' \
206 set $command_config_state
207 command=$[1] config=`echo $[2] | sed 's/,/ /g'` state=$[3]
208 AT_CHECK([ovs-ofctl -vwarn mod-port br0 br0 $command])
209 AT_CHECK([ovs-ofctl -vwarn show br0], [0], [stdout])
210 AT_CHECK_UNQUOTED([STRIP_XIDS stdout], [0], [dnl
211 OFPT_FEATURES_REPLY: dpid:fedcba9876543210
212 n_tables:254, n_buffers:256
213 capabilities: FLOW_STATS TABLE_STATS PORT_STATS QUEUE_STATS ARP_MATCH_IP
214 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
215 LOCAL(br0): addr:aa:55:aa:55:00:00
218 speed: 0 Mbps now, 0 Mbps max
219 OFPT_GET_CONFIG_REPLY: frags=normal miss_send_len=0
225 AT_SETUP([ofproto - mod-port (OpenFlow 1.2)])
227 for command_config_state in \
229 'down PORT_DOWN LINK_DOWN' \
230 'no-receive PORT_DOWN,NO_RECV LINK_DOWN' \
231 'no-forward PORT_DOWN,NO_RECV,NO_FWD LINK_DOWN' \
232 'no-packet-in PORT_DOWN,NO_RECV,NO_FWD,NO_PACKET_IN LINK_DOWN' \
233 'forward PORT_DOWN,NO_RECV,NO_PACKET_IN LINK_DOWN' \
234 'packet-in PORT_DOWN,NO_RECV LINK_DOWN' \
238 set $command_config_state
239 command=$[1] config=`echo $[2] | sed 's/,/ /g'` state=$[3]
240 AT_CHECK([ovs-ofctl -O OpenFlow12 -vwarn mod-port br0 br0 $command])
241 AT_CHECK([ovs-ofctl -O OpenFlow12 -vwarn show br0], [0], [stdout])
242 AT_CHECK_UNQUOTED([STRIP_XIDS stdout], [0], [dnl
243 OFPT_FEATURES_REPLY (OF1.2): dpid:fedcba9876543210
244 n_tables:254, n_buffers:256
245 capabilities: FLOW_STATS TABLE_STATS PORT_STATS QUEUE_STATS
246 LOCAL(br0): addr:aa:55:aa:55:00:00
249 speed: 0 Mbps now, 0 Mbps max
250 OFPT_GET_CONFIG_REPLY (OF1.2): frags=normal miss_send_len=0
256 AT_SETUP([ofproto - basic flow_mod commands (NXM)])
258 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip], [0], [NXST_FLOW reply:
260 AT_CHECK([echo 'in_port=2,actions=1' | ovs-ofctl add-flows br0 -])
261 AT_CHECK([ovs-ofctl add-flow br0 in_port=1,actions=2])
262 AT_CHECK([ovs-ofctl -F nxm add-flow br0 table=1,in_port=4,actions=3])
263 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
264 in_port=1 actions=output:2
265 in_port=2 actions=output:1
266 table=1, in_port=4 actions=output:3
269 AT_CHECK([ovs-ofctl dump-aggregate br0 table=0 | STRIP_XIDS], [0], [dnl
270 NXST_AGGREGATE reply: packet_count=0 byte_count=0 flow_count=2
272 AT_CHECK([ovs-ofctl del-flows br0])
273 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip], [0], [NXST_FLOW reply:
278 AT_SETUP([ofproto - basic flow_mod commands (OpenFlow 1.0)])
280 AT_CHECK([ovs-ofctl -F openflow10 dump-flows br0 | ofctl_strip], [0], [OFPST_FLOW reply:
282 AT_CHECK([echo 'in_port=2,actions=1' | ovs-ofctl -F openflow10 add-flows br0 -])
283 AT_CHECK([ovs-ofctl -F openflow10 add-flow br0 in_port=1,actions=2])
284 AT_CHECK([ovs-ofctl -F openflow10 add-flow br0 table=1,in_port=4,actions=3])
285 AT_CHECK([ovs-ofctl -F openflow10 dump-flows br0 | ofctl_strip | sort], [0], [dnl
286 in_port=1 actions=output:2
287 in_port=2 actions=output:1
288 table=1, in_port=4 actions=output:3
291 AT_CHECK([ovs-ofctl -F openflow10 dump-aggregate br0 table=0 | STRIP_XIDS], [0], [dnl
292 OFPST_AGGREGATE reply: packet_count=0 byte_count=0 flow_count=2
294 AT_CHECK([ovs-ofctl -F openflow10 del-flows br0])
295 AT_CHECK([ovs-ofctl -F openflow10 dump-flows br0 | ofctl_strip], [0], [OFPST_FLOW reply:
300 AT_SETUP([ofproto - basic flow_mod commands (OpenFlow 1.1)])
302 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip], [0], [OFPST_FLOW reply (OF1.1):
304 AT_CHECK([echo 'in_port=2,actions=1' | ovs-ofctl -O OpenFlow11 add-flows br0 -])
305 AT_CHECK([ovs-ofctl -O OpenFlow11 add-flow br0 in_port=1,actions=2])
306 AT_CHECK([ovs-ofctl -O OpenFlow11 add-flow br0 table=1,in_port=4,actions=3])
307 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0], [dnl
308 in_port=1 actions=output:2
309 in_port=2 actions=output:1
310 table=1, in_port=4 actions=output:3
311 OFPST_FLOW reply (OF1.1):
313 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-aggregate br0 table=0 | STRIP_XIDS], [0], [dnl
314 OFPST_AGGREGATE reply (OF1.1): packet_count=0 byte_count=0 flow_count=2
316 AT_CHECK([ovs-ofctl -O OpenFlow11 del-flows br0])
317 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip], [0], [OFPST_FLOW reply (OF1.1):
322 AT_SETUP([ofproto - flow_mod negative test (OpenFlow 1.1)])
324 [set bridge br0 protocols=OpenFlow10,OpenFlow11,OpenFlow12,OpenFlow13])
325 AT_CHECK([ovs-ofctl add-flow -O OpenFlow11 br0 table=1,action=goto_table:2])
326 AT_CHECK([ovs-ofctl add-flow -O OpenFlow11 br0 table=1,action=goto_table:1],
329 # The output should look like this:
331 # OFPT_ERROR (OF1.1) (xid=0x2): OFPBRC_BAD_TABLE_ID
332 # OFPT_FLOW_MOD (OF1.1) (xid=0x2):
333 # (***truncated to 64 bytes from 160***)
334 # 00000000 02 0e 00 a0 00 00 00 02-00 00 00 00 00 00 00 00 |................|
335 # 00000010 00 00 00 00 00 00 00 00-01 00 00 00 00 00 80 00 |................|
336 # 00000020 ff ff ff ff ff ff ff ff-ff ff ff ff 00 00 00 00 |................|
337 # 00000030 00 00 00 58 00 00 00 00-00 00 03 ff 00 00 00 00 |...X............|
339 # This 'sed' command captures the error message but drops details.
340 AT_CHECK([sed '/truncated/d
341 /^000000.0/d' stderr | STRIP_XIDS], [0],
342 [OFPT_ERROR (OF1.1): OFPBRC_BAD_TABLE_ID
343 OFPT_FLOW_MOD (OF1.1):
348 AT_SETUP([ofproto - set-field flow_mod commands (NXM)])
350 AT_CHECK([ovs-ofctl add-flow br0 ipv6,table=1,in_port=3,actions=drop])
351 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])
352 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
353 table=1, ipv6,in_port=3 actions=load:0xa6badbfffefe59fa->NXM_NX_IPV6_SRC[[0..63]],load:0xfe8001234567890a->NXM_NX_IPV6_SRC[[64..127]]
359 AT_SETUP([ofproto - basic flow_mod commands (OpenFlow 1.2)])
361 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip], [0], [OFPST_FLOW reply (OF1.2):
363 AT_CHECK([echo 'in_port=2,actions=1' | ovs-ofctl -O OpenFlow12 add-flows br0 -])
364 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 in_port=1,actions=2])
365 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 table=1,in_port=4,actions=3])
366 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
367 in_port=1 actions=output:2
368 in_port=2 actions=output:1
369 table=1, in_port=4 actions=output:3
370 OFPST_FLOW reply (OF1.2):
372 AT_CHECK([ovs-ofctl -O OpenFlow12 del-flows br0])
373 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip], [0], [OFPST_FLOW reply (OF1.2):
378 AT_SETUP([ofproto - dump flows with cookie])
380 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x1,in_port=1,actions=1])
381 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x2,in_port=2,actions=1])
382 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x3,in_port=3,actions=1])
383 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
384 cookie=0x1, in_port=1 actions=output:1
385 cookie=0x2, in_port=2 actions=output:1
386 cookie=0x3, in_port=3 actions=output:1
389 AT_CHECK([ovs-ofctl dump-aggregate br0 table=0 | STRIP_XIDS], [0], [dnl
390 NXST_AGGREGATE reply: packet_count=0 byte_count=0 flow_count=3
392 AT_CHECK([ovs-ofctl dump-flows br0 cookie=0x3/-1 | ofctl_strip | sort], [0], [dnl
393 cookie=0x3, in_port=3 actions=output:1
396 AT_CHECK([ovs-ofctl dump-aggregate br0 cookie=0x3/-1 | STRIP_XIDS], [0], [dnl
397 NXST_AGGREGATE reply: packet_count=0 byte_count=0 flow_count=1
402 AT_SETUP([ofproto - mod flow with cookie change (OpenFlow 1.0)])
404 AT_CHECK([ovs-ofctl -F openflow10 add-flow br0 cookie=0x1,in_port=1,actions=1])
405 AT_CHECK([ovs-ofctl -F openflow10 dump-flows br0 | ofctl_strip | sort], [0], [dnl
406 cookie=0x1, in_port=1 actions=output:1
410 AT_CHECK([ovs-ofctl -F openflow10 mod-flows br0 cookie=0x2,in_port=1,actions=1])
411 AT_CHECK([ovs-ofctl -F openflow10 dump-flows br0 | ofctl_strip | sort], [0], [dnl
412 cookie=0x2, in_port=1 actions=output:1
418 AT_SETUP([ofproto - mod flow with cookie change (NXM)])
420 AT_CHECK([ovs-ofctl -F nxm add-flow br0 cookie=0x1,in_port=1,actions=1])
421 AT_CHECK([ovs-ofctl -F nxm dump-flows br0 | ofctl_strip | sort], [0], [dnl
422 cookie=0x1, in_port=1 actions=output:1
426 AT_CHECK([ovs-ofctl -F nxm mod-flows br0 cookie=0x2,in_port=1,actions=1])
427 AT_CHECK([ovs-ofctl -F nxm dump-flows br0 | ofctl_strip | sort], [0], [dnl
428 cookie=0x2, in_port=1 actions=output:1
434 AT_SETUP([ofproto - no mod flow with cookie change (OpenFlow 1.1)])
436 AT_CHECK([ovs-ofctl -O OpenFlow11 add-flow br0 cookie=0x1,in_port=1,actions=1])
437 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0], [dnl
438 cookie=0x1, in_port=1 actions=output:1
439 OFPST_FLOW reply (OF1.1):
441 AT_CHECK([ovs-ofctl -O OpenFlow11 mod-flows br0 cookie=0x2,in_port=1,actions=1])
442 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0], [dnl
443 cookie=0x1, in_port=1 actions=output:1
444 OFPST_FLOW reply (OF1.1):
449 dnl The OpenFlow 1.2 spec states that the cookie may not be modified
450 AT_SETUP([ofproto - no mod flow with cookie change (OpenFlow 1.2)])
452 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 cookie=0x1,in_port=1,actions=1])
453 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
454 cookie=0x1, in_port=1 actions=output:1
455 OFPST_FLOW reply (OF1.2):
458 AT_CHECK([ovs-ofctl -O OpenFlow12 mod-flows br0 cookie=0x2,in_port=1,actions=1])
459 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
460 cookie=0x1, in_port=1 actions=output:1
461 OFPST_FLOW reply (OF1.2):
466 AT_SETUP([ofproto - mod flows based on cookie mask (OpenFlow 1.0)])
468 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x1,in_port=1,actions=1])
469 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x1,in_port=2,actions=1])
470 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x2,in_port=3,actions=1])
471 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
472 cookie=0x1, in_port=1 actions=output:1
473 cookie=0x1, in_port=2 actions=output:1
474 cookie=0x2, in_port=3 actions=output:1
478 AT_CHECK([ovs-ofctl -F nxm mod-flows br0 cookie=0x1/0xff,actions=4])
479 AT_CHECK([ovs-ofctl -F nxm dump-flows br0 | ofctl_strip | sort], [0], [dnl
480 cookie=0x1, in_port=1 actions=output:4
481 cookie=0x1, in_port=2 actions=output:4
482 cookie=0x2, in_port=3 actions=output:1
488 AT_SETUP([ofproto - mod flows based on cookie mask (OpenFlow 1.1)])
490 AT_CHECK([ovs-ofctl -O OpenFlow11 add-flow br0 cookie=0x1,in_port=1,actions=1])
491 AT_CHECK([ovs-ofctl -O OpenFlow11 add-flow br0 cookie=0x1,in_port=2,actions=1])
492 AT_CHECK([ovs-ofctl -O OpenFlow11 add-flow br0 cookie=0x2,in_port=3,actions=1])
493 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0], [dnl
494 cookie=0x1, in_port=1 actions=output:1
495 cookie=0x1, in_port=2 actions=output:1
496 cookie=0x2, in_port=3 actions=output:1
497 OFPST_FLOW reply (OF1.1):
500 AT_CHECK([ovs-ofctl -O OpenFlow11 mod-flows br0 cookie=0x1/0xff,actions=4])
501 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0], [dnl
502 cookie=0x1, in_port=1 actions=output:4
503 cookie=0x1, in_port=2 actions=output:4
504 cookie=0x2, in_port=3 actions=output:1
505 OFPST_FLOW reply (OF1.1):
510 AT_SETUP([ofproto - mod flows based on cookie mask (OpenFlow 1.2)])
512 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 cookie=0x1,in_port=1,actions=1])
513 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 cookie=0x1,in_port=2,actions=1])
514 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 cookie=0x2,in_port=3,actions=1])
515 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
516 cookie=0x1, in_port=1 actions=output:1
517 cookie=0x1, in_port=2 actions=output:1
518 cookie=0x2, in_port=3 actions=output:1
519 OFPST_FLOW reply (OF1.2):
522 AT_CHECK([ovs-ofctl -O OpenFlow12 mod-flows br0 cookie=0x1/0xff,actions=4])
523 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
524 cookie=0x1, in_port=1 actions=output:4
525 cookie=0x1, in_port=2 actions=output:4
526 cookie=0x2, in_port=3 actions=output:1
527 OFPST_FLOW reply (OF1.2):
532 dnl The OpenFlow 1.2 spec states that the cookie may not be modified
533 AT_SETUP([ofproto - mod flows based on cookie mask with cookie change])
535 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x1,in_port=1,actions=1])
536 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x1,in_port=2,actions=1])
537 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x2,in_port=3,actions=1])
538 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
539 cookie=0x1, in_port=1 actions=output:1
540 cookie=0x1, in_port=2 actions=output:1
541 cookie=0x2, in_port=3 actions=output:1
545 AT_CHECK([ovs-ofctl -F nxm mod-flows br0 cookie=1/-1,cookie=4,actions=4])
546 AT_CHECK([ovs-ofctl -F nxm dump-flows br0 | ofctl_strip | sort], [0], [dnl
547 cookie=0x2, in_port=3 actions=output:1
548 cookie=0x4, in_port=1 actions=output:4
549 cookie=0x4, in_port=2 actions=output:4
555 AT_SETUP([ofproto - mod flow with cookie miss (mask==0) - NXM])
557 AT_CHECK([ovs-ofctl -F nxm mod-flows br0 in_port=1,actions=1])
558 AT_CHECK([ovs-ofctl -F nxm dump-flows br0 | ofctl_strip | sort], [0], [dnl
559 in_port=1 actions=output:1
565 AT_SETUP([ofproto - mod flow with cookie miss (mask==0) - OF1.1])
567 AT_CHECK([ovs-ofctl -O openflow11 mod-flows br0 in_port=1,actions=1])
568 AT_CHECK([ovs-ofctl -O openflow11 dump-flows br0 | ofctl_strip | sort], [0], [dnl
569 in_port=1 actions=output:1
570 OFPST_FLOW reply (OF1.1):
575 AT_SETUP([ofproto - mod flow with cookie miss (mask==0) - OF1.2])
577 AT_CHECK([ovs-ofctl -O openflow12 mod-flows br0 in_port=1,actions=1])
578 AT_CHECK([ovs-ofctl -O openflow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
579 OFPST_FLOW reply (OF1.2):
584 AT_SETUP([ofproto - mod flow with cookie miss (mask!=0) - NXM])
586 AT_CHECK([ovs-ofctl -F nxm mod-flows br0 cookie=1/1,in_port=1,actions=1])
587 AT_CHECK([ovs-ofctl -F nxm dump-flows br0 | ofctl_strip | sort], [0], [dnl
593 AT_SETUP([ofproto - mod flow with cookie miss (mask!=0) - OF1.1])
595 AT_CHECK([ovs-ofctl -O openflow11 mod-flows br0 cookie=1/1,in_port=1,actions=1])
596 AT_CHECK([ovs-ofctl -O openflow11 dump-flows br0 | ofctl_strip | sort], [0], [dnl
597 OFPST_FLOW reply (OF1.1):
602 AT_SETUP([ofproto - mod flow with cookie miss (mask!=0) - OF1.2])
604 AT_CHECK([ovs-ofctl -O openflow12 mod-flows br0 cookie=1/1,in_port=1,actions=1])
605 AT_CHECK([ovs-ofctl -O openflow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
606 OFPST_FLOW reply (OF1.2):
611 AT_SETUP([ofproto - del flows with cookies])
613 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x1,in_port=1,actions=1])
614 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x2,in_port=2,actions=1])
615 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x3,in_port=3,actions=1])
616 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
617 cookie=0x1, in_port=1 actions=output:1
618 cookie=0x2, in_port=2 actions=output:1
619 cookie=0x3, in_port=3 actions=output:1
623 AT_CHECK([ovs-ofctl del-flows br0])
624 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
630 AT_SETUP([ofproto - del flows based on cookie])
632 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x1,in_port=1,actions=1])
633 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x2,in_port=2,actions=1])
634 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x3,in_port=3,actions=1])
635 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
636 cookie=0x1, in_port=1 actions=output:1
637 cookie=0x2, in_port=2 actions=output:1
638 cookie=0x3, in_port=3 actions=output:1
642 AT_CHECK([ovs-ofctl del-flows br0 cookie=0x3/-1])
643 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
644 cookie=0x1, in_port=1 actions=output:1
645 cookie=0x2, in_port=2 actions=output:1
651 AT_SETUP([ofproto - del flows based on cookie mask])
653 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x1,in_port=1,actions=1])
654 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x2,in_port=2,actions=1])
655 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x3,in_port=3,actions=1])
656 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
657 cookie=0x1, in_port=1 actions=output:1
658 cookie=0x2, in_port=2 actions=output:1
659 cookie=0x3, in_port=3 actions=output:1
662 AT_CHECK([ovs-ofctl del-flows br0 cookie=0x3/0x1])
663 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
664 cookie=0x2, in_port=2 actions=output:1
670 AT_SETUP([ofproto - del flows based on table id (NXM)])
672 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x1,in_port=1,actions=1])
673 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x2,in_port=2,table=1,actions=1])
674 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
675 cookie=0x1, in_port=1 actions=output:1
676 cookie=0x2, table=1, in_port=2 actions=output:1
679 AT_CHECK([ovs-ofctl del-flows br0 table=0])
680 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
681 cookie=0x2, table=1, in_port=2 actions=output:1
684 AT_CHECK([ovs-ofctl del-flows br0 table=1])
685 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
688 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x1,in_port=1,actions=1])
689 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x2,in_port=2,table=1,actions=1])
690 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
691 cookie=0x1, in_port=1 actions=output:1
692 cookie=0x2, table=1, in_port=2 actions=output:1
695 AT_CHECK([ovs-ofctl del-flows br0])
696 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
702 AT_SETUP([ofproto - del flows based on table id (OpenFlow 1.1)])
704 AT_CHECK([ovs-ofctl -O OpenFlow11 add-flow br0 cookie=0x1,in_port=1,actions=1])
705 AT_CHECK([ovs-ofctl -O OpenFlow11 add-flow br0 cookie=0x2,in_port=2,table=1,actions=1])
706 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0], [dnl
707 cookie=0x1, in_port=1 actions=output:1
708 cookie=0x2, table=1, in_port=2 actions=output:1
709 OFPST_FLOW reply (OF1.1):
711 AT_CHECK([ovs-ofctl -O OpenFlow11 del-flows br0 table=0])
712 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0], [dnl
713 cookie=0x2, table=1, in_port=2 actions=output:1
714 OFPST_FLOW reply (OF1.1):
716 AT_CHECK([ovs-ofctl -O OpenFlow11 del-flows br0 table=1])
717 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0], [dnl
718 OFPST_FLOW reply (OF1.1):
720 AT_CHECK([ovs-ofctl -O OpenFlow11 add-flow br0 cookie=0x1,in_port=1,actions=1])
721 AT_CHECK([ovs-ofctl -O OpenFlow11 add-flow br0 cookie=0x2,in_port=2,table=1,actions=1])
722 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0], [dnl
723 cookie=0x1, in_port=1 actions=output:1
724 cookie=0x2, table=1, in_port=2 actions=output:1
725 OFPST_FLOW reply (OF1.1):
727 AT_CHECK([ovs-ofctl -O OpenFlow11 del-flows br0])
728 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0], [dnl
729 OFPST_FLOW reply (OF1.1):
734 AT_SETUP([ofproto - del flows based on table id (OpenFlow 1.2)])
736 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 cookie=0x1,in_port=1,actions=1])
737 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 cookie=0x2,in_port=2,table=1,actions=1])
738 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
739 cookie=0x1, in_port=1 actions=output:1
740 cookie=0x2, table=1, in_port=2 actions=output:1
741 OFPST_FLOW reply (OF1.2):
743 AT_CHECK([ovs-ofctl -O OpenFlow12 del-flows br0 table=0])
744 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
745 cookie=0x2, table=1, in_port=2 actions=output:1
746 OFPST_FLOW reply (OF1.2):
748 AT_CHECK([ovs-ofctl -O OpenFlow12 del-flows br0 table=1])
749 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
750 OFPST_FLOW reply (OF1.2):
752 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 cookie=0x1,in_port=1,actions=1])
753 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 cookie=0x2,in_port=2,table=1,actions=1])
754 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
755 cookie=0x1, in_port=1 actions=output:1
756 cookie=0x2, table=1, in_port=2 actions=output:1
757 OFPST_FLOW reply (OF1.2):
759 AT_CHECK([ovs-ofctl -O OpenFlow12 del-flows br0])
760 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
761 OFPST_FLOW reply (OF1.2):
766 AT_SETUP([ofproto - flow table configuration (OpenFlow 1.0)])
768 # Check the default configuration.
769 (echo "OFPST_TABLE reply (xid=0x2): 254 tables
770 0: classifier: wild=0x3fffff, max=1000000, active=0
773 while test $x -lt 254; do
774 printf " %d: %-8s: wild=0x3fffff, max=1000000, active=0
779 AT_CHECK([ovs-ofctl dump-tables br0], [0], [expout])
780 # Change the configuration.
783 -- --id=@t0 create Flow_Table name=main \
784 -- --id=@t1 create Flow_Table flow-limit=1024 \
785 -- set bridge br0 'flow_tables={1=@t1,0=@t0}' \
786 | ${PERL} $srcdir/uuidfilt.pl],
790 # Check that the configuration was updated.
791 mv expout orig-expout
792 (echo "OFPST_TABLE reply (xid=0x2): 254 tables
793 0: main : wild=0x3fffff, max=1000000, active=0
795 1: table1 : wild=0x3fffff, max= 1024, active=0
797 tail -n +6 orig-expout) > expout
798 AT_CHECK([ovs-ofctl dump-tables br0], [0], [expout])
802 AT_SETUP([ofproto - flow table configuration (OpenFlow 1.2)])
804 # Check the default configuration.
805 (mid="wild=0xfffffffff, max=1000000,"
808 match=0xfffffffff, instructions=0x00000007, config=0x00000003
809 write_actions=0x00000000, apply_actions=0x00000000
810 write_setfields=0x0000000fffffffff
811 apply_setfields=0x0000000fffffffff
812 metadata_match=0xffffffffffffffff
813 metadata_write=0xffffffffffffffff"
814 echo "OFPST_TABLE reply (OF1.2) (xid=0x2): 254 tables
815 0: classifier: $mid active=0$tail"
817 while test $x -lt 254; do
818 printf " %d: %-8s: $mid active=0$tail
822 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-tables br0], [0], [expout])
823 # Change the configuration.
826 -- --id=@t0 create Flow_Table name=main \
827 -- --id=@t1 create Flow_Table flow-limit=1024 \
828 -- set bridge br0 'flow_tables={1=@t1,0=@t0}' \
829 | ${PERL} $srcdir/uuidfilt.pl],
833 # Check that the configuration was updated.
834 mv expout orig-expout
835 (echo "OFPST_TABLE reply (OF1.2) (xid=0x2): 254 tables
836 0: main : wild=0xfffffffff, max=1000000, active=0"
837 tail -n +3 orig-expout | head -7
838 echo " 1: table1 : wild=0xfffffffff, max= 1024, active=0"
839 tail -n +11 orig-expout) > expout
840 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-tables br0], [0], [expout])
844 AT_SETUP([ofproto - hard limits on flow table size (OpenFLow 1.0)])
846 # Configure a maximum of 4 flows.
849 -- --id=@t0 create Flow_Table flow-limit=4 \
850 -- set bridge br0 flow_tables:0=@t0 \
851 | ${PERL} $srcdir/uuidfilt.pl],
855 for in_port in 1 2 3 4; do
856 ovs-ofctl add-flow br0 in_port=$in_port,actions=drop
858 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
859 in_port=1 actions=drop
860 in_port=2 actions=drop
861 in_port=3 actions=drop
862 in_port=4 actions=drop
865 # Adding another flow will be refused.
866 AT_CHECK([ovs-ofctl add-flow br0 in_port=5,actions=drop], [1], [], [stderr])
867 AT_CHECK([head -n 1 stderr | ofctl_strip], [0],
868 [OFPT_ERROR: OFPFMFC_TABLE_FULL
870 # Also a mod-flow that would add a flow will be refused.
871 AT_CHECK([ovs-ofctl mod-flows br0 in_port=5,actions=drop], [1], [], [stderr])
872 AT_CHECK([head -n 1 stderr | ofctl_strip], [0],
873 [OFPT_ERROR: OFPFMFC_TABLE_FULL
875 # Replacing or modifying an existing flow is allowed.
876 AT_CHECK([ovs-ofctl add-flow br0 in_port=4,actions=normal])
877 AT_CHECK([ovs-ofctl mod-flows br0 in_port=3,actions=output:1])
878 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
879 in_port=1 actions=drop
880 in_port=2 actions=drop
881 in_port=3 actions=output:1
882 in_port=4 actions=NORMAL
888 AT_SETUP([ofproto - hard limits on flow table size (OpenFLow 1.2)])
890 # Configure a maximum of 4 flows.
893 -- --id=@t0 create Flow_Table flow-limit=4 \
894 -- set bridge br0 flow_tables:0=@t0 \
895 | ${PERL} $srcdir/uuidfilt.pl],
899 for in_port in 1 2 3 4; do
900 ovs-ofctl -O OpenFlow12 add-flow br0 in_port=$in_port,actions=drop
902 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
903 in_port=1 actions=drop
904 in_port=2 actions=drop
905 in_port=3 actions=drop
906 in_port=4 actions=drop
907 OFPST_FLOW reply (OF1.2):
909 # Adding another flow will be refused.
910 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 in_port=5,actions=drop], [1], [], [stderr])
911 AT_CHECK([head -n 1 stderr | ofctl_strip], [0],
912 [OFPT_ERROR (OF1.2): OFPFMFC_TABLE_FULL
914 # Replacing or modifying an existing flow is allowed.
915 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 in_port=4,actions=normal])
916 AT_CHECK([ovs-ofctl -O OpenFlow12 mod-flows br0 in_port=3,actions=output:1])
917 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
918 in_port=1 actions=drop
919 in_port=2 actions=drop
920 in_port=3 actions=output:1
921 in_port=4 actions=NORMAL
922 OFPST_FLOW reply (OF1.2):
927 AT_SETUP([ofproto - eviction upon table overflow (OpenFlow 1.0)])
929 # Configure a maximum of 4 flows.
932 -- --id=@t0 create Flow_Table flow-limit=4 overflow-policy=evict \
933 -- set bridge br0 flow_tables:0=@t0 \
934 | ${PERL} $srcdir/uuidfilt.pl],
938 for in_port in 4 3 2 1; do
939 ovs-ofctl add-flow br0 idle_timeout=${in_port}0,in_port=$in_port,actions=drop
941 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
942 idle_timeout=10, in_port=1 actions=drop
943 idle_timeout=20, in_port=2 actions=drop
944 idle_timeout=30, in_port=3 actions=drop
945 idle_timeout=40, in_port=4 actions=drop
948 # Adding another flow will cause the one that expires soonest to be evicted.
949 AT_CHECK([ovs-ofctl add-flow br0 in_port=5,actions=drop])
950 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
951 idle_timeout=20, in_port=2 actions=drop
952 idle_timeout=30, in_port=3 actions=drop
953 idle_timeout=40, in_port=4 actions=drop
954 in_port=5 actions=drop
957 # A mod-flow that adds a flow also causes eviction, but replacing or
958 # modifying an existing flow doesn't.
959 AT_CHECK([ovs-ofctl mod-flows br0 in_port=6,actions=drop])
960 AT_CHECK([ovs-ofctl add-flow br0 in_port=4,actions=normal])
961 AT_CHECK([ovs-ofctl mod-flows br0 in_port=3,actions=output:1])
962 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
963 idle_timeout=30, in_port=3 actions=output:1
964 in_port=4 actions=NORMAL
965 in_port=5 actions=drop
966 in_port=6 actions=drop
969 # Flows with no timeouts at all cannot be evicted.
970 AT_CHECK([ovs-ofctl add-flow br0 in_port=7,actions=normal])
971 AT_CHECK([ovs-ofctl add-flow br0 in_port=8,actions=drop], [1], [], [stderr])
972 AT_CHECK([head -n 1 stderr | ofctl_strip], [0],
973 [OFPT_ERROR: OFPFMFC_TABLE_FULL
975 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
976 in_port=4 actions=NORMAL
977 in_port=5 actions=drop
978 in_port=6 actions=drop
979 in_port=7 actions=NORMAL
985 AT_SETUP([ofproto - eviction upon table overflow (OpenFlow 1.2)])
987 # Configure a maximum of 4 flows.
990 -- --id=@t0 create Flow_Table flow-limit=4 overflow-policy=evict \
991 -- set bridge br0 flow_tables:0=@t0 \
992 | ${PERL} $srcdir/uuidfilt.pl],
996 for in_port in 4 3 2 1; do
997 ovs-ofctl -O OpenFlow12 add-flow br0 idle_timeout=${in_port}0,in_port=$in_port,actions=drop
999 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1000 idle_timeout=10, in_port=1 actions=drop
1001 idle_timeout=20, in_port=2 actions=drop
1002 idle_timeout=30, in_port=3 actions=drop
1003 idle_timeout=40, in_port=4 actions=drop
1004 OFPST_FLOW reply (OF1.2):
1006 # Adding another flow will cause the one that expires soonest to be evicted.
1007 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 in_port=5,actions=drop])
1008 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1009 idle_timeout=20, in_port=2 actions=drop
1010 idle_timeout=30, in_port=3 actions=drop
1011 idle_timeout=40, in_port=4 actions=drop
1012 in_port=5 actions=drop
1013 OFPST_FLOW reply (OF1.2):
1015 # In Open Flow 1.2 a mod-flow does not ever add a flow and thus
1016 # has no effect on eviction
1017 AT_CHECK([ovs-ofctl -O OpenFlow12 mod-flows br0 in_port=6,actions=drop])
1018 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 in_port=4,actions=normal])
1019 AT_CHECK([ovs-ofctl -O OpenFlow12 mod-flows br0 in_port=3,actions=output:1])
1020 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1021 idle_timeout=20, in_port=2 actions=drop
1022 idle_timeout=30, in_port=3 actions=output:1
1023 in_port=4 actions=NORMAL
1024 in_port=5 actions=drop
1025 OFPST_FLOW reply (OF1.2):
1027 # Flows with no timeouts at all cannot be evicted.
1028 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 in_port=6,actions=drop])
1029 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 in_port=7,actions=normal])
1030 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 in_port=8,actions=drop], [1], [], [stderr])
1031 AT_CHECK([head -n 1 stderr | ofctl_strip], [0],
1032 [OFPT_ERROR (OF1.2): OFPFMFC_TABLE_FULL
1034 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1035 in_port=4 actions=NORMAL
1036 in_port=5 actions=drop
1037 in_port=6 actions=drop
1038 in_port=7 actions=NORMAL
1039 OFPST_FLOW reply (OF1.2):
1044 AT_SETUP([ofproto - eviction upon table overflow, with fairness (OpenFlow 1.0)])
1046 # Configure a maximum of 4 flows.
1049 -- --id=@t0 create Flow_Table name=evict flow-limit=4 \
1050 overflow-policy=evict \
1051 groups='"NXM_OF_IN_PORT[[]]"' \
1052 -- set bridge br0 flow_tables:0=@t0 \
1053 | ${PERL} $srcdir/uuidfilt.pl],
1057 ovs-ofctl add-flows br0 - <<EOF
1058 idle_timeout=10 in_port=2 dl_src=00:44:55:66:77:88 actions=drop
1059 idle_timeout=20 in_port=1 dl_src=00:11:22:33:44:55 actions=drop
1060 idle_timeout=30 in_port=1 dl_src=00:22:33:44:55:66 actions=drop
1061 idle_timeout=40 in_port=1 dl_src=00:33:44:55:66:77 actions=drop
1063 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1064 idle_timeout=10, in_port=2,dl_src=00:44:55:66:77:88 actions=drop
1065 idle_timeout=20, in_port=1,dl_src=00:11:22:33:44:55 actions=drop
1066 idle_timeout=30, in_port=1,dl_src=00:22:33:44:55:66 actions=drop
1067 idle_timeout=40, in_port=1,dl_src=00:33:44:55:66:77 actions=drop
1070 # Adding another flow will cause the one that expires soonest within
1071 # the largest group (those with in_port=1) to be evicted. In this
1072 # case this is not the same as the one that expires soonest overall
1073 # (which is what makes the test interesting):
1074 AT_CHECK([ovs-ofctl add-flow br0 in_port=2,dl_src=00:55:66:77:88:99,actions=drop])
1075 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1076 idle_timeout=10, in_port=2,dl_src=00:44:55:66:77:88 actions=drop
1077 idle_timeout=30, in_port=1,dl_src=00:22:33:44:55:66 actions=drop
1078 idle_timeout=40, in_port=1,dl_src=00:33:44:55:66:77 actions=drop
1079 in_port=2,dl_src=00:55:66:77:88:99 actions=drop
1082 # Enlarge the flow limit, change the eviction policy back to strictly
1083 # based on expiration, and and add some flows.
1084 AT_CHECK([ovs-vsctl set Flow_Table evict groups='[[]]' flow-limit=7])
1085 ovs-ofctl add-flows br0 - <<EOF
1086 idle_timeout=50 in_port=2 dl_src=00:66:77:88:99:aa actions=drop
1087 idle_timeout=60 in_port=2 dl_src=00:77:88:99:aa:bb actions=drop
1088 idle_timeout=70 in_port=2 dl_src=00:88:99:aa:bb:cc actions=drop
1090 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1091 idle_timeout=10, in_port=2,dl_src=00:44:55:66:77:88 actions=drop
1092 idle_timeout=30, in_port=1,dl_src=00:22:33:44:55:66 actions=drop
1093 idle_timeout=40, in_port=1,dl_src=00:33:44:55:66:77 actions=drop
1094 idle_timeout=50, in_port=2,dl_src=00:66:77:88:99:aa actions=drop
1095 idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=drop
1096 idle_timeout=70, in_port=2,dl_src=00:88:99:aa:bb:cc actions=drop
1097 in_port=2,dl_src=00:55:66:77:88:99 actions=drop
1100 # Adding another flow will cause the one that expires soonest overall
1102 AT_CHECK([ovs-ofctl add-flow br0 'idle_timeout=80 in_port=2 dl_src=00:99:aa:bb:cc:dd actions=drop'])
1103 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1104 idle_timeout=30, in_port=1,dl_src=00:22:33:44:55:66 actions=drop
1105 idle_timeout=40, in_port=1,dl_src=00:33:44:55:66:77 actions=drop
1106 idle_timeout=50, in_port=2,dl_src=00:66:77:88:99:aa actions=drop
1107 idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=drop
1108 idle_timeout=70, in_port=2,dl_src=00:88:99:aa:bb:cc actions=drop
1109 idle_timeout=80, in_port=2,dl_src=00:99:aa:bb:cc:dd actions=drop
1110 in_port=2,dl_src=00:55:66:77:88:99 actions=drop
1113 # Reducing the flow limit also causes the flows that expire soonest
1114 # overall to be evicted.
1115 AT_CHECK([ovs-vsctl set Flow_Table evict flow-limit=4])
1116 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1117 idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=drop
1118 idle_timeout=70, in_port=2,dl_src=00:88:99:aa:bb:cc actions=drop
1119 idle_timeout=80, in_port=2,dl_src=00:99:aa:bb:cc:dd actions=drop
1120 in_port=2,dl_src=00:55:66:77:88:99 actions=drop
1126 AT_SETUP([ofproto - eviction upon table overflow, with fairness (OpenFlow 1.2)])
1128 # Configure a maximum of 4 flows.
1131 -- --id=@t0 create Flow_Table name=evict flow-limit=4 \
1132 overflow-policy=evict \
1133 groups='"NXM_OF_IN_PORT[[]]"' \
1134 -- set bridge br0 flow_tables:0=@t0 \
1135 | ${PERL} $srcdir/uuidfilt.pl],
1139 ovs-ofctl -O OpenFlow12 add-flows br0 - <<EOF
1140 idle_timeout=10 in_port=2 dl_src=00:44:55:66:77:88 actions=drop
1141 idle_timeout=20 in_port=1 dl_src=00:11:22:33:44:55 actions=drop
1142 idle_timeout=30 in_port=1 dl_src=00:22:33:44:55:66 actions=drop
1143 idle_timeout=40 in_port=1 dl_src=00:33:44:55:66:77 actions=drop
1145 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1146 idle_timeout=10, in_port=2,dl_src=00:44:55:66:77:88 actions=drop
1147 idle_timeout=20, in_port=1,dl_src=00:11:22:33:44:55 actions=drop
1148 idle_timeout=30, in_port=1,dl_src=00:22:33:44:55:66 actions=drop
1149 idle_timeout=40, in_port=1,dl_src=00:33:44:55:66:77 actions=drop
1150 OFPST_FLOW reply (OF1.2):
1152 # Adding another flow will cause the one that expires soonest within
1153 # the largest group (those with in_port=1) to be evicted. In this
1154 # case this is not the same as the one that expires soonest overall
1155 # (which is what makes the test interesting):
1156 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 in_port=2,dl_src=00:55:66:77:88:99,actions=drop])
1157 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1158 idle_timeout=10, in_port=2,dl_src=00:44:55:66:77:88 actions=drop
1159 idle_timeout=30, in_port=1,dl_src=00:22:33:44:55:66 actions=drop
1160 idle_timeout=40, in_port=1,dl_src=00:33:44:55:66:77 actions=drop
1161 in_port=2,dl_src=00:55:66:77:88:99 actions=drop
1162 OFPST_FLOW reply (OF1.2):
1164 # Enlarge the flow limit, change the eviction policy back to strictly
1165 # based on expiration, and and add some flows.
1166 AT_CHECK([ovs-vsctl set Flow_Table evict groups='[[]]' flow-limit=7])
1167 ovs-ofctl -O OpenFlow12 add-flows br0 - <<EOF
1168 idle_timeout=50 in_port=2 dl_src=00:66:77:88:99:aa actions=drop
1169 idle_timeout=60 in_port=2 dl_src=00:77:88:99:aa:bb actions=drop
1170 idle_timeout=70 in_port=2 dl_src=00:88:99:aa:bb:cc actions=drop
1172 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1173 idle_timeout=10, in_port=2,dl_src=00:44:55:66:77:88 actions=drop
1174 idle_timeout=30, in_port=1,dl_src=00:22:33:44:55:66 actions=drop
1175 idle_timeout=40, in_port=1,dl_src=00:33:44:55:66:77 actions=drop
1176 idle_timeout=50, in_port=2,dl_src=00:66:77:88:99:aa actions=drop
1177 idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=drop
1178 idle_timeout=70, in_port=2,dl_src=00:88:99:aa:bb:cc actions=drop
1179 in_port=2,dl_src=00:55:66:77:88:99 actions=drop
1180 OFPST_FLOW reply (OF1.2):
1182 # Adding another flow will cause the one that expires soonest overall
1184 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'])
1185 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1186 idle_timeout=30, in_port=1,dl_src=00:22:33:44:55:66 actions=drop
1187 idle_timeout=40, in_port=1,dl_src=00:33:44:55:66:77 actions=drop
1188 idle_timeout=50, in_port=2,dl_src=00:66:77:88:99:aa actions=drop
1189 idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=drop
1190 idle_timeout=70, in_port=2,dl_src=00:88:99:aa:bb:cc actions=drop
1191 idle_timeout=80, in_port=2,dl_src=00:99:aa:bb:cc:dd actions=drop
1192 in_port=2,dl_src=00:55:66:77:88:99 actions=drop
1193 OFPST_FLOW reply (OF1.2):
1195 # Reducing the flow limit also causes the flows that expire soonest
1196 # overall to be evicted.
1197 AT_CHECK([ovs-vsctl set Flow_Table evict flow-limit=4])
1198 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1199 idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=drop
1200 idle_timeout=70, in_port=2,dl_src=00:88:99:aa:bb:cc actions=drop
1201 idle_timeout=80, in_port=2,dl_src=00:99:aa:bb:cc:dd actions=drop
1202 in_port=2,dl_src=00:55:66:77:88:99 actions=drop
1203 OFPST_FLOW reply (OF1.2):
1208 AT_SETUP([ofproto - asynchronous message control (OpenFlow 1.0)])
1210 AT_CHECK([ovs-ofctl -P openflow10 monitor br0 --detach --no-chdir --pidfile])
1212 printf '\n\n--- check_async %d ---\n\n\n' $1
1215 ovs-appctl -t ovs-ofctl ofctl/barrier
1216 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
1219 # OFPT_PACKET_IN, OFPR_ACTION (controller_id=0)
1220 ovs-ofctl -v packet-out br0 controller controller '0001020304050010203040501234'
1221 if test X"$1" = X"OFPR_ACTION"; then shift;
1222 echo >>expout "OFPT_PACKET_IN: total_len=14 in_port=CONTROLLER (via action) data_len=14 (unbuffered)
1223 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"
1226 # OFPT_PACKET_IN, OFPR_NO_MATCH (controller_id=123)
1227 ovs-ofctl -v packet-out br0 controller 'controller(reason=no_match,id=123)' '0001020304050010203040501234'
1228 if test X"$1" = X"OFPR_NO_MATCH"; then shift;
1229 echo >>expout "OFPT_PACKET_IN: total_len=14 in_port=CONTROLLER (via no_match) data_len=14 (unbuffered)
1230 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"
1233 # OFPT_PACKET_IN, OFPR_INVALID_TTL (controller_id=0)
1234 ovs-ofctl packet-out br0 controller dec_ttl '002583dfb4000026b98cb0f908004500003fb7e200000011339bac11370dac100002d7730035002b8f6d86fb0100000100000000000006626c702d7873066e696369726103636f6d00000f00'
1235 if test X"$1" = X"OFPR_INVALID_TTL"; then shift;
1236 echo >>expout "OFPT_PACKET_IN: total_len=76 in_port=CONTROLLER (via invalid_ttl) data_len=76 (unbuffered)
1237 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"
1240 # OFPT_PORT_STATUS, OFPPR_ADD
1241 ovs-vsctl add-port br0 test -- set Interface test type=dummy ofport_request=1
1242 if test X"$1" = X"OFPPR_ADD"; then shift;
1243 echo >>expout "OFPT_PORT_STATUS: ADD: 1(test): addr:aa:55:aa:55:00:0x
1246 speed: 0 Mbps now, 0 Mbps max"
1249 # OFPT_PORT_STATUS, OFPPR_DELETE
1250 ovs-vsctl del-port br0 test
1251 if test X"$1" = X"OFPPR_DELETE"; then shift;
1252 echo >>expout "OFPT_PORT_STATUS: DEL: 1(test): addr:aa:55:aa:55:00:0x
1255 speed: 0 Mbps now, 0 Mbps max"
1258 # OFPT_FLOW_REMOVED, OFPRR_DELETE
1259 ovs-ofctl add-flow br0 send_flow_rem,actions=drop
1260 ovs-ofctl --strict del-flows br0 ''
1261 if test X"$1" = X"OFPRR_DELETE"; then shift;
1262 echo >>expout "OFPT_FLOW_REMOVED: reason=delete"
1264 AT_FAIL_IF([test X"$1" != X])
1266 ovs-appctl -t ovs-ofctl ofctl/barrier
1267 echo >>expout "OFPT_BARRIER_REPLY:"
1271 s/ (xid=0x[0-9a-fA-F]*)//
1273 s/00:0.$/00:0x/' < monitor.log]],
1277 # It's a service connection so initially there should be no async messages.
1280 # Set miss_send_len to 128, turning on packet-ins for our service connection.
1281 ovs-appctl -t ovs-ofctl ofctl/send 0109000c0123456700000080
1282 check_async 2 OFPR_ACTION OFPPR_ADD OFPPR_DELETE OFPRR_DELETE
1284 # Set miss_send_len to 128 and enable invalid_ttl.
1285 ovs-appctl -t ovs-ofctl ofctl/send 0109000c0123456700040080
1286 check_async 3 OFPR_ACTION OFPR_INVALID_TTL OFPPR_ADD OFPPR_DELETE OFPRR_DELETE
1288 # Become slave, which should disable everything except port status.
1289 ovs-appctl -t ovs-ofctl ofctl/send 0104001400000002000023200000000a00000002
1290 check_async 4 OFPPR_ADD OFPPR_DELETE
1292 # Use NXT_SET_ASYNC_CONFIG to enable a patchwork of asynchronous messages.
1293 ovs-appctl -t ovs-ofctl ofctl/send 01040028000000020000232000000013000000020000000500000005000000020000000200000005
1294 check_async 5 OFPR_INVALID_TTL OFPPR_DELETE OFPRR_DELETE
1296 # Set controller ID 123.
1297 ovs-appctl -t ovs-ofctl ofctl/send 01040018000000030000232000000014000000000000007b
1298 check_async 6 OFPR_NO_MATCH OFPPR_DELETE OFPRR_DELETE
1300 # Restore controller ID 0.
1301 ovs-appctl -t ovs-ofctl ofctl/send 010400180000000300002320000000140000000000000000
1304 ovs-appctl -t ovs-ofctl ofctl/send 0104001400000002000023200000000a00000001
1305 check_async 7 OFPR_ACTION OFPPR_ADD
1307 ovs-appctl -t ovs-ofctl exit
1311 AT_SETUP([ofproto - asynchronous message control (OpenFlow 1.2)])
1313 AT_CHECK([ovs-ofctl -O OpenFlow12 monitor br0 --detach --no-chdir --pidfile])
1315 printf '\n\n--- check_async %d ---\n\n\n' $1
1319 ovs-appctl -t ovs-ofctl ofctl/barrier
1320 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
1323 # OFPT_PACKET_IN, OFPR_ACTION (controller_id=0)
1324 ovs-ofctl -O OpenFlow12 -v packet-out br0 none controller '0001020304050010203040501234'
1325 if test X"$1" = X"OFPR_ACTION"; then shift;
1326 echo >>expout "OFPT_PACKET_IN (OF1.2): total_len=14 in_port=ANY (via action) data_len=14 (unbuffered)
1327 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"
1330 # OFPT_PACKET_IN, OFPR_NO_MATCH (controller_id=123)
1331 ovs-ofctl -O OpenFlow12 -v packet-out br0 none 'controller(reason=no_match,id=123)' '0001020304050010203040501234'
1332 if test X"$1" = X"OFPR_NO_MATCH"; then shift;
1333 echo >>expout "OFPT_PACKET_IN (OF1.2): total_len=14 in_port=ANY (via no_match) data_len=14 (unbuffered)
1334 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"
1337 # OFPT_PACKET_IN, OFPR_INVALID_TTL (controller_id=0)
1338 ovs-ofctl -O OpenFlow12 packet-out br0 none dec_ttl '002583dfb4000026b98cb0f908004500003fb7e200000011339bac11370dac100002d7730035002b8f6d86fb0100000100000000000006626c702d7873066e696369726103636f6d00000f00'
1339 if test X"$1" = X"OFPR_INVALID_TTL"; then shift;
1340 echo >>expout "OFPT_PACKET_IN (OF1.2): total_len=76 in_port=ANY (via invalid_ttl) data_len=76 (unbuffered)
1341 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"
1344 # OFPT_PORT_STATUS, OFPPR_ADD
1345 ovs-vsctl add-port br0 test -- set Interface test type=dummy
1346 if test X"$1" = X"OFPPR_ADD"; then shift;
1347 echo >>expout "OFPT_PORT_STATUS (OF1.2): ADD: ${INDEX}(test): addr:aa:55:aa:55:00:0x
1350 speed: 0 Mbps now, 0 Mbps max"
1353 # OFPT_PORT_STATUS, OFPPR_DELETE
1354 ovs-vsctl del-port br0 test
1355 if test X"$1" = X"OFPPR_DELETE"; then shift;
1356 echo >>expout "OFPT_PORT_STATUS (OF1.2): DEL: ${INDEX}(test): addr:aa:55:aa:55:00:0x
1359 speed: 0 Mbps now, 0 Mbps max"
1362 # OFPT_FLOW_REMOVED, OFPRR_DELETE
1363 ovs-ofctl -O OpenFlow12 add-flow br0 send_flow_rem,actions=drop
1364 ovs-ofctl -O OpenFlow12 --strict del-flows br0 ''
1365 if test X"$1" = X"OFPRR_DELETE"; then shift;
1366 echo >>expout "OFPT_FLOW_REMOVED (OF1.2): reason=delete table_id=0"
1368 AT_FAIL_IF([test X"$1" != X])
1370 ovs-appctl -t ovs-ofctl ofctl/barrier
1371 echo >>expout "OFPT_BARRIER_REPLY (OF1.2):"
1375 s/ (xid=0x[0-9a-fA-F]*)//
1377 s/00:0.$/00:0x/' < monitor.log]],
1381 # It's a service connection so initially there should be no async messages.
1384 # Set miss_send_len to 128, turning on packet-ins for our service connection.
1385 ovs-appctl -t ovs-ofctl ofctl/send 0309000c0123456700000080
1386 check_async 2 OFPR_ACTION OFPPR_ADD OFPPR_DELETE OFPRR_DELETE
1388 # Set miss_send_len to 128 and enable invalid_ttl.
1389 ovs-appctl -t ovs-ofctl ofctl/send 0309000c0123456700040080
1390 check_async 3 OFPR_ACTION OFPR_INVALID_TTL OFPPR_ADD OFPPR_DELETE OFPRR_DELETE
1392 # Become slave (OF 1.2), which should disable everything except port status.
1393 ovs-appctl -t ovs-ofctl ofctl/send 031800180000000200000003000000000000000000000001
1394 check_async 4 OFPPR_ADD OFPPR_DELETE
1396 # Use NXT_SET_ASYNC_CONFIG to enable a patchwork of asynchronous messages.
1397 ovs-appctl -t ovs-ofctl ofctl/send 03040028000000020000232000000013000000020000000500000005000000020000000200000005
1398 check_async 5 OFPR_INVALID_TTL OFPPR_DELETE OFPRR_DELETE
1400 # Set controller ID 123.
1401 ovs-appctl -t ovs-ofctl ofctl/send 03040018000000030000232000000014000000000000007b
1402 check_async 6 OFPR_NO_MATCH OFPPR_DELETE OFPRR_DELETE
1404 # Restore controller ID 0.
1405 ovs-appctl -t ovs-ofctl ofctl/send 030400180000000300002320000000140000000000000000
1407 # Become master (OF 1.2).
1408 ovs-appctl -t ovs-ofctl ofctl/send 031800180000000400000002000000000000000000000002
1409 check_async 7 OFPR_ACTION OFPPR_ADD
1411 ovs-appctl -t ovs-ofctl exit
1415 AT_SETUP([ofproto - asynchronous message control (OpenFlow 1.3)])
1417 AT_CHECK([ovs-ofctl -O OpenFlow13 monitor br0 --detach --no-chdir --pidfile])
1419 printf '\n\n--- check_async %d ---\n\n\n' $1
1423 ovs-appctl -t ovs-ofctl ofctl/barrier
1424 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
1427 # OFPT_PACKET_IN, OFPR_ACTION (controller_id=0)
1428 ovs-ofctl -O OpenFlow13 -v packet-out br0 none controller '0001020304050010203040501234'
1429 if test X"$1" = X"OFPR_ACTION"; then shift;
1430 echo >>expout "OFPT_PACKET_IN (OF1.3): total_len=14 in_port=ANY (via action) data_len=14 (unbuffered)
1431 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"
1434 # OFPT_PACKET_IN, OFPR_NO_MATCH (controller_id=123)
1435 ovs-ofctl -O OpenFlow13 -v packet-out br0 none 'controller(reason=no_match,id=123)' '0001020304050010203040501234'
1436 if test X"$1" = X"OFPR_NO_MATCH"; then shift;
1437 echo >>expout "OFPT_PACKET_IN (OF1.3): total_len=14 in_port=ANY (via no_match) data_len=14 (unbuffered)
1438 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"
1441 # OFPT_PACKET_IN, OFPR_INVALID_TTL (controller_id=0)
1442 ovs-ofctl -O OpenFlow13 packet-out br0 none dec_ttl '002583dfb4000026b98cb0f908004500003fb7e200000011339bac11370dac100002d7730035002b8f6d86fb0100000100000000000006626c702d7873066e696369726103636f6d00000f00'
1443 if test X"$1" = X"OFPR_INVALID_TTL"; then shift;
1444 echo >>expout "OFPT_PACKET_IN (OF1.3): total_len=76 in_port=ANY (via invalid_ttl) data_len=76 (unbuffered)
1445 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"
1448 # OFPT_PORT_STATUS, OFPPR_ADD
1449 ovs-vsctl add-port br0 test -- set Interface test type=dummy
1450 if test X"$1" = X"OFPPR_ADD"; then shift;
1451 echo >>expout "OFPT_PORT_STATUS (OF1.3): ADD: ${INDEX}(test): addr:aa:55:aa:55:00:0x
1454 speed: 0 Mbps now, 0 Mbps max"
1457 # OFPT_PORT_STATUS, OFPPR_DELETE
1458 ovs-vsctl del-port br0 test
1459 if test X"$1" = X"OFPPR_DELETE"; then shift;
1460 echo >>expout "OFPT_PORT_STATUS (OF1.3): DEL: ${INDEX}(test): addr:aa:55:aa:55:00:0x
1463 speed: 0 Mbps now, 0 Mbps max"
1466 # OFPT_FLOW_REMOVED, OFPRR_DELETE
1467 ovs-ofctl -O OpenFlow13 add-flow br0 send_flow_rem,actions=drop
1468 ovs-ofctl -O OpenFlow13 --strict del-flows br0 ''
1469 if test X"$1" = X"OFPRR_DELETE"; then shift;
1470 echo >>expout "OFPT_FLOW_REMOVED (OF1.3): reason=delete table_id=0"
1472 AT_FAIL_IF([test X"$1" != X])
1474 ovs-appctl -t ovs-ofctl ofctl/barrier
1475 echo >>expout "OFPT_BARRIER_REPLY (OF1.3):"
1479 s/ (xid=0x[0-9a-fA-F]*)//
1481 s/00:0.$/00:0x/' < monitor.log]],
1485 # It's a service connection so initially there should be no async messages.
1488 # Set miss_send_len to 128, turning on packet-ins for our service connection.
1489 ovs-appctl -t ovs-ofctl ofctl/send 0409000c0123456700000080
1490 check_async 2 OFPR_ACTION OFPPR_ADD OFPPR_DELETE OFPRR_DELETE
1492 # Become slave (OF 1.3), which should disable everything except port status.
1493 ovs-appctl -t ovs-ofctl ofctl/send 041800180000000200000003000000000000000000000001
1494 check_async 3 OFPPR_ADD OFPPR_DELETE
1496 # Use OF 1.3 OFPT_SET_ASYNC to enable a patchwork of asynchronous messages.
1497 ovs-appctl -t ovs-ofctl ofctl/send 041c002000000002000000020000000500000005000000020000000200000005
1498 check_async 4 OFPR_INVALID_TTL OFPPR_DELETE OFPRR_DELETE
1500 # Set controller ID 123.
1501 ovs-appctl -t ovs-ofctl ofctl/send 04040018000000030000232000000014000000000000007b
1502 check_async 5 OFPR_NO_MATCH OFPPR_DELETE OFPRR_DELETE
1504 # Restore controller ID 0.
1505 ovs-appctl -t ovs-ofctl ofctl/send 040400180000000300002320000000140000000000000000
1507 # Become master (OF 1.3).
1508 ovs-appctl -t ovs-ofctl ofctl/send 041800180000000400000002000000000000000000000002
1509 check_async 6 OFPR_ACTION OFPPR_ADD
1511 ovs-appctl -t ovs-ofctl exit
1515 dnl This test checks that the role request/response messaging works
1516 dnl and that generation_id is handled properly.
1517 AT_SETUP([ofproto - controller role (OpenFlow 1.2)])
1519 AT_CHECK([ovs-ofctl -O OpenFlow12 monitor br0 --detach --no-chdir --pidfile])
1521 ovs-appctl -t ovs-ofctl ofctl/barrier
1522 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
1525 # find out current role
1526 ovs-appctl -t ovs-ofctl ofctl/send 031800180000000200000000000000000000000000000000
1527 echo >>expout "send: OFPT_ROLE_REQUEST (OF1.2) (xid=0x2): role=nochange"
1528 echo >>expout "OFPT_ROLE_REPLY (OF1.2) (xid=0x2): role=equal"
1530 # Become slave (generation_id is initially undefined, so 2^63+2 should not be stale)
1531 ovs-appctl -t ovs-ofctl ofctl/send 031800180000000300000003000000008000000000000002
1532 echo >>expout "send: OFPT_ROLE_REQUEST (OF1.2) (xid=0x3): role=slave generation_id=9223372036854775810"
1533 echo >>expout "OFPT_ROLE_REPLY (OF1.2) (xid=0x3): role=slave generation_id=9223372036854775810"
1535 # Try to become the master using a stale generation ID
1536 ovs-appctl -t ovs-ofctl ofctl/send 031800180000000400000002000000000000000000000002
1537 echo >>expout "send: OFPT_ROLE_REQUEST (OF1.2) (xid=0x4): role=master generation_id=2"
1538 echo >>expout "OFPT_ERROR (OF1.2) (xid=0x4): OFPRRFC_STALE"
1539 echo >>expout "OFPT_ROLE_REQUEST (OF1.2) (xid=0x4): role=master generation_id=2"
1541 # Become master using a valid generation ID
1542 ovs-appctl -t ovs-ofctl ofctl/send 031800180000000500000002000000000000000000000001
1543 echo >>expout "send: OFPT_ROLE_REQUEST (OF1.2) (xid=0x5): role=master generation_id=1"
1544 echo >>expout "OFPT_ROLE_REPLY (OF1.2) (xid=0x5): role=master generation_id=1"
1545 ovs-appctl -t ovs-ofctl ofctl/barrier
1546 echo >>expout "OFPT_BARRIER_REPLY (OF1.2) (xid=0x3):"
1548 AT_CHECK([cat monitor.log], [0], [expout])
1550 ovs-appctl -t ovs-ofctl exit
1554 dnl This test checks that OFPT_PACKET_OUT accepts both OFPP_NONE (as
1555 dnl specified by OpenFlow 1.0) and OFPP_CONTROLLER (used by some
1556 dnl controllers despite the spec) as meaning a packet that was generated
1557 dnl by the controller.
1558 AT_SETUP([ofproto - packet-out from controller (OpenFlow 1.0)])
1560 ADD_OF_PORTS([br0], [1])
1562 # Start a monitor listening for packet-ins.
1563 AT_CHECK([ovs-ofctl -P openflow10 monitor br0 --detach --no-chdir --pidfile])
1564 ovs-appctl -t ovs-ofctl ofctl/send 0109000c0123456700000080
1565 ovs-appctl -t ovs-ofctl ofctl/barrier
1566 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
1567 AT_CAPTURE_FILE([monitor.log])
1569 # Send some packet-outs with OFPP_NONE and OFPP_CONTROLLER (65533) as in_port.
1570 AT_CHECK([ovs-ofctl packet-out br0 none controller,1 '0001020304050010203040501234'])
1571 AT_CHECK([ovs-ofctl packet-out br0 controller controller,1 '0001020304050010203040505678'])
1573 # Stop the monitor and check its output.
1574 ovs-appctl -t ovs-ofctl ofctl/barrier
1575 ovs-appctl -t ovs-ofctl exit
1577 ovs-ofctl dump-ports br0
1579 AT_CHECK([sed 's/ (xid=0x[[0-9a-fA-F]]*)//' monitor.log], [0], [dnl
1580 OFPT_PACKET_IN: total_len=14 in_port=ANY (via action) data_len=14 (unbuffered)
1581 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
1582 OFPT_PACKET_IN: total_len=14 in_port=CONTROLLER (via action) data_len=14 (unbuffered)
1583 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
1590 dnl This test checks that OFPT_PACKET_OUT accepts both OFPP_NONE (as
1591 dnl specified by OpenFlow 1.2) and OFPP_CONTROLLER (used by some
1592 dnl controllers despite the spec) as meaning a packet that was generated
1593 dnl by the controller.
1594 AT_SETUP([ofproto - packet-out from controller (OpenFlow 1.2)])
1597 # Start a monitor listening for packet-ins.
1598 AT_CHECK([ovs-ofctl -O OpenFlow12 monitor br0 --detach --no-chdir --pidfile])
1599 ovs-appctl -t ovs-ofctl ofctl/send 0309000c0123456700000080
1600 ovs-appctl -t ovs-ofctl ofctl/barrier
1601 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
1602 AT_CAPTURE_FILE([monitor.log])
1604 # Send some packet-outs with OFPP_NONE and OFPP_CONTROLLER (65533) as in_port.
1605 AT_CHECK([ovs-ofctl -O OpenFlow12 packet-out br0 none controller '0001020304050010203040501234'])
1606 AT_CHECK([ovs-ofctl -O OpenFlow12 packet-out br0 4294967293 controller '0001020304050010203040505678'])
1608 # Stop the monitor and check its output.
1609 ovs-appctl -t ovs-ofctl ofctl/barrier
1610 ovs-appctl -t ovs-ofctl exit
1612 AT_CHECK([sed 's/ (xid=0x[[0-9a-fA-F]]*)//' monitor.log], [0], [dnl
1613 OFPT_PACKET_IN (OF1.2): total_len=14 in_port=ANY (via action) data_len=14 (unbuffered)
1614 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
1615 OFPT_PACKET_IN (OF1.2): total_len=14 in_port=CONTROLLER (via action) data_len=14 (unbuffered)
1616 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
1617 OFPT_BARRIER_REPLY (OF1.2):
1623 dnl This test checks that metadata is encoded in packet_in structures,
1624 dnl supported by NXAST.
1625 AT_SETUP([ofproto - packet-out with metadata (NXM)])
1628 # Start a monitor listening for packet-ins.
1629 AT_CHECK([ovs-ofctl -P nxm monitor br0 --detach --no-chdir --pidfile])
1630 ovs-appctl -t ovs-ofctl ofctl/send 0109000c0123456700000080
1631 ovs-appctl -t ovs-ofctl ofctl/barrier
1632 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
1633 AT_CAPTURE_FILE([monitor.log])
1635 # Send a packet-out with a load action to set some metadata, and forward to controller
1636 AT_CHECK([ovs-ofctl packet-out br0 controller 'load(0xfafafafa5a5a5a5a->OXM_OF_METADATA[[0..63]]), load(0xaa->NXM_NX_PKT_MARK[[]]), controller' '0001020304050010203040501234'])
1638 # Stop the monitor and check its output.
1639 ovs-appctl -t ovs-ofctl ofctl/barrier
1640 ovs-appctl -t ovs-ofctl exit
1642 AT_CHECK([sed 's/ (xid=0x[[0-9a-fA-F]]*)//' monitor.log], [0], [dnl
1643 NXT_PACKET_IN: total_len=14 in_port=CONTROLLER metadata=0xfafafafa5a5a5a5a pkt_mark=0xaa (via action) data_len=14 (unbuffered)
1644 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
1651 dnl This test checks that metadata is encoded in packet_in structures,
1652 dnl supported by NXAST.
1653 AT_SETUP([ofproto - packet-out with metadata (OpenFlow 1.2)])
1656 # Start a monitor listening for packet-ins.
1657 AT_CHECK([ovs-ofctl -O OpenFlow12 monitor br0 --detach --no-chdir --pidfile])
1658 ovs-appctl -t ovs-ofctl ofctl/send 0309000c0123456700000080
1659 ovs-appctl -t ovs-ofctl ofctl/barrier
1660 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
1661 AT_CAPTURE_FILE([monitor.log])
1663 # Send a packet-out with a load action to set some metadata, and forward to controller
1664 AT_CHECK([ovs-ofctl -O OpenFlow12 packet-out br0 none 'load(0xfafafafa5a5a5a5a->OXM_OF_METADATA[[0..63]]), controller' '0001020304050010203040501234'])
1666 # Stop the monitor and check its output.
1667 ovs-appctl -t ovs-ofctl ofctl/barrier
1668 ovs-appctl -t ovs-ofctl exit
1670 AT_CHECK([sed 's/ (xid=0x[[0-9a-fA-F]]*)//' monitor.log], [0], [dnl
1671 OFPT_PACKET_IN (OF1.2): total_len=14 in_port=ANY metadata=0xfafafafa5a5a5a5a (via action) data_len=14 (unbuffered)
1672 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
1673 OFPT_BARRIER_REPLY (OF1.2):
1679 dnl This test checks that tunnel metadata is encoded in packet_in structures.
1680 AT_SETUP([ofproto - packet-out with tunnel metadata (OpenFlow 1.2)])
1683 # Start a monitor listening for packet-ins.
1684 AT_CHECK([ovs-ofctl -O OpenFlow12 monitor br0 --detach --no-chdir --pidfile])
1685 ovs-appctl -t ovs-ofctl ofctl/send 0309000c0123456700000080
1686 ovs-appctl -t ovs-ofctl ofctl/barrier
1687 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
1688 AT_CAPTURE_FILE([monitor.log])
1690 # Send a packet-out with set field actions to set some tunnel metadata, and forward to controller
1691 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'])
1693 # Stop the monitor and check its output.
1694 ovs-appctl -t ovs-ofctl ofctl/barrier
1695 ovs-appctl -t ovs-ofctl exit
1697 AT_CHECK([sed 's/ (xid=0x[[0-9a-fA-F]]*)//' monitor.log], [0], [dnl
1698 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)
1699 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
1700 OFPT_BARRIER_REPLY (OF1.2):
1706 AT_SETUP([ofproto - flow monitoring])
1707 AT_KEYWORDS([monitor])
1710 ovs-ofctl add-flow br0 in_port=0,dl_vlan=123,actions=output:1
1712 # Start a monitor watching the flow table and check the initial reply.
1713 ovs-ofctl monitor br0 watch: --detach --no-chdir --pidfile >monitor.log 2>&1
1714 AT_CAPTURE_FILE([monitor.log])
1715 ovs-appctl -t ovs-ofctl ofctl/barrier
1716 AT_CHECK([sed 's/ (xid=0x[[1-9a-fA-F]][[0-9a-fA-F]]*)//' monitor.log], [0],
1717 [NXST_FLOW_MONITOR reply:
1718 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=123 actions=output:1
1722 # Add, delete, and modify some flows and check the updates.
1723 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
1724 ovs-ofctl add-flow br0 in_port=0,dl_vlan=124,actions=output:2
1725 ovs-ofctl add-flow br0 in_port=0,dl_vlan=123,actions=output:5
1726 ovs-ofctl add-flow br0 in_port=0,dl_vlan=123,dl_vlan_pcp=0,actions=output:6
1727 ovs-ofctl add-flow br0 in_port=0,dl_vlan=123,dl_vlan_pcp=1,actions=output:7
1728 ovs-ofctl add-flow br0 in_port=0,dl_vlan=123,actions=output:8
1729 ovs-ofctl add-flow br0 in_port=0,dl_vlan=65535,dl_vlan_pcp=0,actions=output:9
1730 ovs-ofctl add-flow br0 in_port=0,dl_vlan=65535,dl_vlan_pcp=1,actions=output:10
1731 ovs-ofctl add-flow br0 in_port=0,dl_vlan=65535,actions=output:11
1732 ovs-ofctl add-flow br0 in_port=0,dl_vlan=8191,dl_vlan_pcp=0,actions=output:12
1733 ovs-ofctl add-flow br0 in_port=0,dl_vlan=8191,dl_vlan_pcp=1,actions=output:13
1734 ovs-ofctl add-flow br0 in_port=0,dl_vlan=8191,actions=output:14
1735 ovs-ofctl add-flow br0 in_port=0,dl_vlan=0,dl_vlan_pcp=0,actions=output:15
1736 ovs-ofctl add-flow br0 in_port=0,dl_vlan=0,dl_vlan_pcp=1,actions=output:16
1737 ovs-ofctl add-flow br0 in_port=0,dl_vlan=0,actions=output:17
1738 ovs-ofctl add-flow br0 in_port=0,dl_vlan=0,dl_vlan_pcp=0,actions=output:18
1739 ovs-ofctl add-flow br0 in_port=0,dl_vlan=0,dl_vlan_pcp=1,actions=output:19
1740 ovs-ofctl add-flow br0 in_port=0,dl_vlan=0,actions=output:20
1741 ovs-ofctl add-flow br0 in_port=0,dl_vlan_pcp=0,actions=output:21
1742 ovs-ofctl add-flow br0 in_port=0,dl_vlan_pcp=1,actions=output:22
1743 ovs-ofctl add-flow br0 in_port=0,actions=output:23
1744 ovs-ofctl mod-flows br0 cookie=5,dl_vlan=123,actions=output:3
1745 ovs-ofctl del-flows br0 dl_vlan=123
1746 ovs-ofctl del-flows br0
1747 ovs-appctl -t ovs-ofctl ofctl/barrier
1749 # Sorts groups of lines that start with a space, without moving them
1750 # past the nearest line that does not start with a space.
1758 print $_ foreach sort(@buffer);
1763 print $_ foreach sort(@buffer);
1765 AT_CHECK([sed 's/ (xid=0x[[1-9a-fA-F]][[0-9a-fA-F]]*)//' monitor.log | ${PERL} -e "$sort"], [0],
1766 [NXST_FLOW_MONITOR reply (xid=0x0):
1767 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=124 actions=output:2
1768 NXST_FLOW_MONITOR reply (xid=0x0):
1769 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=123 actions=output:5
1770 NXST_FLOW_MONITOR reply (xid=0x0):
1771 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=123,dl_vlan_pcp=0 actions=output:6
1772 NXST_FLOW_MONITOR reply (xid=0x0):
1773 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=123,dl_vlan_pcp=1 actions=output:7
1774 NXST_FLOW_MONITOR reply (xid=0x0):
1775 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=123 actions=output:8
1776 NXST_FLOW_MONITOR reply (xid=0x0):
1777 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=0,dl_vlan_pcp=0 actions=output:9
1778 NXST_FLOW_MONITOR reply (xid=0x0):
1779 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=0,dl_vlan_pcp=1 actions=output:10
1780 NXST_FLOW_MONITOR reply (xid=0x0):
1781 event=ADDED table=0 cookie=0 in_port=0,vlan_tci=0x0000 actions=output:11
1782 NXST_FLOW_MONITOR reply (xid=0x0):
1783 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=4095,dl_vlan_pcp=0 actions=output:12
1784 NXST_FLOW_MONITOR reply (xid=0x0):
1785 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=4095,dl_vlan_pcp=1 actions=output:13
1786 NXST_FLOW_MONITOR reply (xid=0x0):
1787 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=4095 actions=output:14
1788 NXST_FLOW_MONITOR reply (xid=0x0):
1789 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=0,dl_vlan_pcp=0 actions=output:15
1790 NXST_FLOW_MONITOR reply (xid=0x0):
1791 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=0,dl_vlan_pcp=1 actions=output:16
1792 NXST_FLOW_MONITOR reply (xid=0x0):
1793 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=0 actions=output:17
1794 NXST_FLOW_MONITOR reply (xid=0x0):
1795 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=0,dl_vlan_pcp=0 actions=output:18
1796 NXST_FLOW_MONITOR reply (xid=0x0):
1797 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=0,dl_vlan_pcp=1 actions=output:19
1798 NXST_FLOW_MONITOR reply (xid=0x0):
1799 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=0 actions=output:20
1800 NXST_FLOW_MONITOR reply (xid=0x0):
1801 event=ADDED table=0 cookie=0 in_port=0,dl_vlan_pcp=0 actions=output:21
1802 NXST_FLOW_MONITOR reply (xid=0x0):
1803 event=ADDED table=0 cookie=0 in_port=0,dl_vlan_pcp=1 actions=output:22
1804 NXST_FLOW_MONITOR reply (xid=0x0):
1805 event=ADDED table=0 cookie=0 in_port=0 actions=output:23
1806 NXST_FLOW_MONITOR reply (xid=0x0):
1807 event=MODIFIED table=0 cookie=0x5 in_port=0,dl_vlan=123 actions=output:3
1808 event=MODIFIED table=0 cookie=0x5 in_port=0,dl_vlan=123,dl_vlan_pcp=0 actions=output:3
1809 event=MODIFIED table=0 cookie=0x5 in_port=0,dl_vlan=123,dl_vlan_pcp=1 actions=output:3
1810 NXST_FLOW_MONITOR reply (xid=0x0):
1811 event=DELETED reason=delete table=0 cookie=0x5 in_port=0,dl_vlan=123 actions=output:3
1812 event=DELETED reason=delete table=0 cookie=0x5 in_port=0,dl_vlan=123,dl_vlan_pcp=0 actions=output:3
1813 event=DELETED reason=delete table=0 cookie=0x5 in_port=0,dl_vlan=123,dl_vlan_pcp=1 actions=output:3
1814 NXST_FLOW_MONITOR reply (xid=0x0):
1815 event=DELETED reason=delete table=0 cookie=0 in_port=0 actions=output:23
1816 event=DELETED reason=delete table=0 cookie=0 in_port=0,dl_vlan=0 actions=output:20
1817 event=DELETED reason=delete table=0 cookie=0 in_port=0,dl_vlan=0,dl_vlan_pcp=0 actions=output:18
1818 event=DELETED reason=delete table=0 cookie=0 in_port=0,dl_vlan=0,dl_vlan_pcp=1 actions=output:19
1819 event=DELETED reason=delete table=0 cookie=0 in_port=0,dl_vlan=124 actions=output:2
1820 event=DELETED reason=delete table=0 cookie=0 in_port=0,dl_vlan=4095 actions=output:14
1821 event=DELETED reason=delete table=0 cookie=0 in_port=0,dl_vlan=4095,dl_vlan_pcp=0 actions=output:12
1822 event=DELETED reason=delete table=0 cookie=0 in_port=0,dl_vlan=4095,dl_vlan_pcp=1 actions=output:13
1823 event=DELETED reason=delete table=0 cookie=0 in_port=0,dl_vlan_pcp=0 actions=output:21
1824 event=DELETED reason=delete table=0 cookie=0 in_port=0,dl_vlan_pcp=1 actions=output:22
1825 event=DELETED reason=delete table=0 cookie=0 in_port=0,vlan_tci=0x0000 actions=output:11
1829 # Check that our own changes are reported as abbreviations.
1830 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
1831 ovs-ofctl add-flow br0 in_port=1,actions=output:2
1832 ovs-ofctl add-flow br0 in_port=2,actions=output:1
1833 ovs-appctl -t ovs-ofctl ofctl/barrier
1834 ovs-appctl -t ovs-ofctl ofctl/send 010e004812345678003fffff00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003000000000000ffffffffffff0000
1835 ovs-appctl -t ovs-ofctl ofctl/barrier
1836 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip], [0], [NXST_FLOW reply:
1838 AT_CHECK([sed 's/ (xid=0x[[1-9a-fA-F]][[0-9a-fA-F]]*)//' monitor.log], [0],
1839 [NXST_FLOW_MONITOR reply (xid=0x0):
1840 event=ADDED table=0 cookie=0 in_port=1 actions=output:2
1841 NXST_FLOW_MONITOR reply (xid=0x0):
1842 event=ADDED table=0 cookie=0 in_port=2 actions=output:1
1844 send: OFPT_FLOW_MOD: DEL priority=0 actions=drop
1845 NXST_FLOW_MONITOR reply (xid=0x0):
1846 event=ABBREV xid=0x12345678
1850 ovs-appctl -t ovs-ofctl exit
1854 AT_SETUP([ofproto - flow monitoring pause and resume])
1855 AT_KEYWORDS([monitor])
1857 # The maximum socket receive buffer size is important for this test, which
1858 # tests behavior when the receive buffer overflows.
1859 if test -e /proc/sys/net/core/rmem_max; then
1861 rmem_max=`cat /proc/sys/net/core/rmem_max`
1862 elif rmem_max=`sysctl -n net.inet.tcp.recvbuf_max 2>/dev/null`; then
1865 # Don't know how to get maximum socket receive buffer on this OS
1868 # Calculate the total amount of queuing: rmem_max in the kernel, 128 kB
1869 # in ofproto sending userspace (see ofmonitor_flush() in connmgr.c).
1870 queue_size=`expr $rmem_max + 128 \* 1024`
1871 echo rmem_max=$rmem_max queue_size=$queue_size
1873 # Each flow update message takes up at least 48 bytes of space in queues
1874 # and in practice more than that.
1875 n_msgs=`expr $queue_size / 48`
1880 # Start a monitor watching the flow table, then make it block.
1881 ON_EXIT([kill `cat ovs-ofctl.pid`])
1882 ovs-ofctl monitor br0 watch: --detach --no-chdir --pidfile >monitor.log 2>&1
1883 AT_CAPTURE_FILE([monitor.log])
1884 ovs-appctl -t ovs-ofctl ofctl/block
1886 # Add $n_msgs flows.
1887 (echo "in_port=2,actions=output:2"
1889 for ($i = 0; $i < '$n_msgs'; $i++) {
1890 print "cookie=1,reg1=$i,actions=drop\n";
1893 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
1894 # Check that multipart flow dumps work properly:
1895 AT_CHECK([ovs-ofctl diff-flows br0 flows.txt])
1896 AT_CHECK([ovs-ofctl add-flow br0 in_port=1,cookie=3,actions=drop])
1897 AT_CHECK([ovs-ofctl mod-flows br0 in_port=2,cookie=2,actions=output:2])
1898 AT_CHECK([ovs-ofctl del-flows br0 cookie=1/-1])
1900 ovs-appctl -t ovs-ofctl ofctl/unblock
1901 ovs-appctl -t ovs-ofctl ofctl/barrier
1903 ovs-appctl -t ovs-ofctl exit
1905 # Check that the flow monitor reported the same number of flows
1906 # added and deleted, but fewer than we actually added and deleted.
1907 adds=`grep -c 'ADDED.*reg1=' monitor.log`
1908 deletes=`grep -c 'DELETED.*reg1=' monitor.log`
1909 echo adds=$adds deletes=$deletes
1910 AT_CHECK([test $adds -gt 100 && test $adds -lt $n_msgs])
1911 AT_CHECK([test $adds = $deletes])
1913 # Check that the flow monitor reported everything in the expected order:
1915 # event=ADDED table=0 cookie=0x1 reg1=0x22
1917 # NXT_FLOW_MONITOR_PAUSED:
1919 # event=DELETED reason=delete table=0 cookie=0x1 reg1=0x22
1921 # event=ADDED table=0 cookie=0x3 in_port=1
1922 # event=MODIFIED table=0 cookie=0x2 in_port=2 actions=output:2
1923 # NXT_FLOW_MONITOR_RESUMED:
1925 # except that, between the PAUSED and RESUMED, the order of the ADDED
1926 # and MODIFIED lines lines depends on hash order, that is, it varies
1927 # as we change the hash function or change architecture. Therefore,
1928 # we use a couple of tests below to accept both orders.
1929 AT_CHECK([ofctl_strip < monitor.log | sed -n -e '
1932 /NXT_FLOW_MONITOR_PAUSED:/p
1933 /NXT_FLOW_MONITOR_RESUMED:/p
1934 ' > monitor.log.subset])
1935 AT_CHECK([grep -v MODIFIED monitor.log.subset], [0], [dnl
1936 event=ADDED table=0 cookie=0x1 reg1=0x22
1937 NXT_FLOW_MONITOR_PAUSED:
1938 event=DELETED reason=delete table=0 cookie=0x1 reg1=0x22
1939 event=ADDED table=0 cookie=0x3 in_port=1
1940 NXT_FLOW_MONITOR_RESUMED:
1942 AT_CHECK([grep -v ADDED monitor.log.subset], [0], [dnl
1943 NXT_FLOW_MONITOR_PAUSED:
1944 event=DELETED reason=delete table=0 cookie=0x1 reg1=0x22
1945 event=MODIFIED table=0 cookie=0x2 in_port=2 actions=output:2
1946 NXT_FLOW_MONITOR_RESUMED:
1952 AT_SETUP([ofproto - event filtering (OpenFlow 1.3)])
1953 AT_KEYWORDS([monitor])
1956 # Start a monitor, use the required protocol version
1957 ovs-ofctl -O OpenFlow13 monitor br0 --detach --no-chdir --pidfile >monitor.log 2>&1
1958 AT_CAPTURE_FILE([monitor.log])
1960 # Send an OpenFlow13 message (04), OFPT_GET_ASYNC_REQUEST (1a), length (8), xid (0a)
1961 ovs-appctl -t ovs-ofctl ofctl/send 041a00080000000a
1962 ovs-appctl -t ovs-ofctl ofctl/barrier
1964 # Check default setting
1965 read -r -d '' expected <<'EOF'
1968 AT_CHECK([ofctl_strip < monitor.log], [], [dnl
1969 send: OFPT_GET_ASYNC_REQUEST (OF1.3):
1970 OFPT_GET_ASYNC_REPLY (OF1.3):
1972 PACKET_IN: no_match action
1973 PORT_STATUS: add delete modify
1974 FLOW_REMOVED: idle hard delete
1978 PORT_STATUS: add delete modify
1980 OFPT_BARRIER_REPLY (OF1.3):