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 description])
181 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn add-group br0 group_id=1234,type=all,bucket=output:10])
182 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn dump-groups br0], [0], [stdout])
183 AT_CHECK([STRIP_XIDS stdout], [0], [dnl
184 OFPST_GROUP_DESC reply (OF1.1):
185 group_id=1234,type=all,bucket=actions=output:10
190 dnl This is really bare-bones.
191 dnl It at least checks request and reply serialization and deserialization.
192 AT_SETUP([ofproto - group features])
194 AT_CHECK([ovs-ofctl -O OpenFlow12 -vwarn dump-group-features br0], [0], [stdout])
195 AT_CHECK([STRIP_XIDS stdout], [0], [dnl
196 OFPST_GROUP_FEATURES reply (OF1.2):
204 dnl This is really bare-bones.
205 dnl It at least checks request and reply serialization and deserialization.
206 AT_SETUP([ofproto - group stats])
208 AT_DATA([groups.txt], [dnl
209 group_id=1234,type=all,bucket=output:10
210 group_id=1235,type=all,bucket=output:10
212 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn add-groups br0 groups.txt])
213 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn add-flow br0 'tcp actions=group:1234'])
214 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn dump-group-stats br0 group_id=1234], [0], [stdout])
215 AT_CHECK([STRIP_XIDS stdout | sort], [0], [dnl
216 group_id=1234,ref_count=1,packet_count=0,byte_count=0,bucket0:packet_count=0,byte_count=0
217 OFPST_GROUP reply (OF1.1):
219 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn dump-group-stats br0], [0], [stdout])
220 AT_CHECK([STRIP_XIDS stdout | sort], [0], [dnl
221 group_id=1234,ref_count=1,packet_count=0,byte_count=0,bucket0:packet_count=0,byte_count=0
222 group_id=1235,ref_count=0,packet_count=0,byte_count=0,bucket0:packet_count=0,byte_count=0
223 OFPST_GROUP reply (OF1.1):
228 AT_SETUP([ofproto - mod-port (OpenFlow 1.0)])
230 for command_config_state in \
232 'noflood NO_FLOOD 0' \
233 'down PORT_DOWN,NO_FLOOD LINK_DOWN' \
234 'flood PORT_DOWN LINK_DOWN' \
235 'no-receive PORT_DOWN,NO_RECV LINK_DOWN' \
236 'no-forward PORT_DOWN,NO_RECV,NO_FWD LINK_DOWN' \
237 'no-packet-in PORT_DOWN,NO_RECV,NO_FWD,NO_PACKET_IN LINK_DOWN' \
238 'forward PORT_DOWN,NO_RECV,NO_PACKET_IN LINK_DOWN' \
239 'packet-in PORT_DOWN,NO_RECV LINK_DOWN' \
243 set $command_config_state
244 command=$[1] config=`echo $[2] | sed 's/,/ /g'` state=$[3]
245 AT_CHECK([ovs-ofctl -vwarn mod-port br0 br0 $command])
246 AT_CHECK([ovs-ofctl -vwarn show br0], [0], [stdout])
247 AT_CHECK_UNQUOTED([STRIP_XIDS stdout], [0], [dnl
248 OFPT_FEATURES_REPLY: dpid:fedcba9876543210
249 n_tables:254, n_buffers:256
250 capabilities: FLOW_STATS TABLE_STATS PORT_STATS QUEUE_STATS ARP_MATCH_IP
251 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
252 LOCAL(br0): addr:aa:55:aa:55:00:00
255 speed: 0 Mbps now, 0 Mbps max
256 OFPT_GET_CONFIG_REPLY: frags=normal miss_send_len=0
262 AT_SETUP([ofproto - mod-port (OpenFlow 1.2)])
264 for command_config_state in \
266 'down PORT_DOWN LINK_DOWN' \
267 'no-receive PORT_DOWN,NO_RECV LINK_DOWN' \
268 'no-forward PORT_DOWN,NO_RECV,NO_FWD LINK_DOWN' \
269 'no-packet-in PORT_DOWN,NO_RECV,NO_FWD,NO_PACKET_IN LINK_DOWN' \
270 'forward PORT_DOWN,NO_RECV,NO_PACKET_IN LINK_DOWN' \
271 'packet-in PORT_DOWN,NO_RECV LINK_DOWN' \
275 set $command_config_state
276 command=$[1] config=`echo $[2] | sed 's/,/ /g'` state=$[3]
277 AT_CHECK([ovs-ofctl -O OpenFlow12 -vwarn mod-port br0 br0 $command])
278 AT_CHECK([ovs-ofctl -O OpenFlow12 -vwarn show br0], [0], [stdout])
279 AT_CHECK_UNQUOTED([STRIP_XIDS stdout], [0], [dnl
280 OFPT_FEATURES_REPLY (OF1.2): dpid:fedcba9876543210
281 n_tables:254, n_buffers:256
282 capabilities: FLOW_STATS TABLE_STATS PORT_STATS QUEUE_STATS
283 LOCAL(br0): addr:aa:55:aa:55:00:00
286 speed: 0 Mbps now, 0 Mbps max
287 OFPT_GET_CONFIG_REPLY (OF1.2): frags=normal miss_send_len=0
293 AT_SETUP([ofproto - basic flow_mod commands (NXM)])
295 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip], [0], [NXST_FLOW reply:
297 AT_CHECK([echo 'in_port=2,actions=1' | ovs-ofctl add-flows br0 -])
298 AT_CHECK([ovs-ofctl add-flow br0 in_port=1,actions=2])
299 AT_CHECK([ovs-ofctl -F nxm add-flow br0 table=1,in_port=4,actions=3])
300 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
301 in_port=1 actions=output:2
302 in_port=2 actions=output:1
303 table=1, in_port=4 actions=output:3
306 AT_CHECK([ovs-ofctl dump-aggregate br0 table=0 | STRIP_XIDS], [0], [dnl
307 NXST_AGGREGATE reply: packet_count=0 byte_count=0 flow_count=2
309 AT_CHECK([ovs-ofctl del-flows br0])
310 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip], [0], [NXST_FLOW reply:
315 AT_SETUP([ofproto - basic flow_mod commands (OpenFlow 1.0)])
317 AT_CHECK([ovs-ofctl -F openflow10 dump-flows br0 | ofctl_strip], [0], [OFPST_FLOW reply:
319 AT_CHECK([echo 'in_port=2,actions=1' | ovs-ofctl -F openflow10 add-flows br0 -])
320 AT_CHECK([ovs-ofctl -F openflow10 add-flow br0 in_port=1,actions=2])
321 AT_CHECK([ovs-ofctl -F openflow10 add-flow br0 table=1,in_port=4,actions=3])
322 AT_CHECK([ovs-ofctl -F openflow10 dump-flows br0 | ofctl_strip | sort], [0], [dnl
323 in_port=1 actions=output:2
324 in_port=2 actions=output:1
325 table=1, in_port=4 actions=output:3
328 AT_CHECK([ovs-ofctl -F openflow10 dump-aggregate br0 table=0 | STRIP_XIDS], [0], [dnl
329 OFPST_AGGREGATE reply: packet_count=0 byte_count=0 flow_count=2
331 AT_CHECK([ovs-ofctl -F openflow10 del-flows br0])
332 AT_CHECK([ovs-ofctl -F openflow10 dump-flows br0 | ofctl_strip], [0], [OFPST_FLOW reply:
337 AT_SETUP([ofproto - basic flow_mod commands (OpenFlow 1.1)])
339 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip], [0], [OFPST_FLOW reply (OF1.1):
341 AT_CHECK([echo 'in_port=2,actions=1' | ovs-ofctl -O OpenFlow11 add-flows br0 -])
342 AT_CHECK([ovs-ofctl -O OpenFlow11 add-flow br0 in_port=1,actions=2])
343 AT_CHECK([ovs-ofctl -O OpenFlow11 add-flow br0 table=1,in_port=4,actions=3])
344 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0], [dnl
345 in_port=1 actions=output:2
346 in_port=2 actions=output:1
347 table=1, in_port=4 actions=output:3
348 OFPST_FLOW reply (OF1.1):
350 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-aggregate br0 table=0 | STRIP_XIDS], [0], [dnl
351 OFPST_AGGREGATE reply (OF1.1): packet_count=0 byte_count=0 flow_count=2
353 AT_CHECK([ovs-ofctl -O OpenFlow11 del-flows br0])
354 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip], [0], [OFPST_FLOW reply (OF1.1):
355 table=1, in_port=4 actions=output:3
360 AT_SETUP([ofproto - flow_mod negative test (OpenFlow 1.1)])
362 [set bridge br0 protocols=OpenFlow10,OpenFlow11,OpenFlow12,OpenFlow13])
363 AT_CHECK([ovs-ofctl add-flow -O OpenFlow11 br0 table=1,action=goto_table:2])
365 # The error message here actually comes from ovs-ofctl, not from ovs-vswitchd,
366 # but at least it's the same code in ofpacts_check() that issues the error.
367 AT_CHECK([ovs-ofctl add-flow -O OpenFlow11 br0 table=1,action=goto_table:1],
369 [ovs-ofctl: actions are invalid with specified match (OFPBRC_BAD_TABLE_ID)
374 AT_SETUP([ofproto - set-field flow_mod commands (NXM)])
376 AT_CHECK([ovs-ofctl add-flow br0 ipv6,table=1,in_port=3,actions=drop])
377 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])
378 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
379 table=1, ipv6,in_port=3 actions=load:0xa6badbfffefe59fa->NXM_NX_IPV6_SRC[[0..63]],load:0xfe8001234567890a->NXM_NX_IPV6_SRC[[64..127]]
385 AT_SETUP([ofproto - basic flow_mod commands (OpenFlow 1.2)])
387 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip], [0], [OFPST_FLOW reply (OF1.2):
389 AT_CHECK([echo 'in_port=2,actions=1' | ovs-ofctl -O OpenFlow12 add-flows br0 -])
390 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 in_port=1,actions=2])
391 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 table=1,in_port=4,actions=3])
392 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
393 in_port=1 actions=output:2
394 in_port=2 actions=output:1
395 table=1, in_port=4 actions=output:3
396 OFPST_FLOW reply (OF1.2):
398 AT_CHECK([ovs-ofctl -O OpenFlow12 del-flows br0])
399 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip], [0], [OFPST_FLOW reply (OF1.2):
404 AT_SETUP([ofproto - dump flows with cookie])
406 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x1,in_port=1,actions=1])
407 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x2,in_port=2,actions=1])
408 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x3,in_port=3,actions=1])
409 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
410 cookie=0x1, in_port=1 actions=output:1
411 cookie=0x2, in_port=2 actions=output:1
412 cookie=0x3, in_port=3 actions=output:1
415 AT_CHECK([ovs-ofctl dump-aggregate br0 table=0 | STRIP_XIDS], [0], [dnl
416 NXST_AGGREGATE reply: packet_count=0 byte_count=0 flow_count=3
418 AT_CHECK([ovs-ofctl dump-flows br0 cookie=0x3/-1 | ofctl_strip | sort], [0], [dnl
419 cookie=0x3, in_port=3 actions=output:1
422 AT_CHECK([ovs-ofctl dump-aggregate br0 cookie=0x3/-1 | STRIP_XIDS], [0], [dnl
423 NXST_AGGREGATE reply: packet_count=0 byte_count=0 flow_count=1
428 AT_SETUP([ofproto - mod flow with cookie change (OpenFlow 1.0)])
430 AT_CHECK([ovs-ofctl -F openflow10 add-flow br0 cookie=0x1,in_port=1,actions=1])
431 AT_CHECK([ovs-ofctl -F openflow10 dump-flows br0 | ofctl_strip | sort], [0], [dnl
432 cookie=0x1, in_port=1 actions=output:1
436 AT_CHECK([ovs-ofctl -F openflow10 mod-flows br0 cookie=0x2,in_port=1,actions=1])
437 AT_CHECK([ovs-ofctl -F openflow10 dump-flows br0 | ofctl_strip | sort], [0], [dnl
438 cookie=0x2, in_port=1 actions=output:1
444 AT_SETUP([ofproto - mod flow with cookie change (NXM)])
446 AT_CHECK([ovs-ofctl -F nxm add-flow br0 cookie=0x1,in_port=1,actions=1])
447 AT_CHECK([ovs-ofctl -F nxm dump-flows br0 | ofctl_strip | sort], [0], [dnl
448 cookie=0x1, in_port=1 actions=output:1
452 AT_CHECK([ovs-ofctl -F nxm mod-flows br0 cookie=0x2,in_port=1,actions=1])
453 AT_CHECK([ovs-ofctl -F nxm dump-flows br0 | ofctl_strip | sort], [0], [dnl
454 cookie=0x2, in_port=1 actions=output:1
460 AT_SETUP([ofproto - no mod flow with cookie change (OpenFlow 1.1)])
462 AT_CHECK([ovs-ofctl -O OpenFlow11 add-flow br0 cookie=0x1,in_port=1,actions=1])
463 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0], [dnl
464 cookie=0x1, in_port=1 actions=output:1
465 OFPST_FLOW reply (OF1.1):
467 AT_CHECK([ovs-ofctl -O OpenFlow11 mod-flows br0 cookie=0x2,in_port=1,actions=1])
468 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0], [dnl
469 cookie=0x1, in_port=1 actions=output:1
470 OFPST_FLOW reply (OF1.1):
475 dnl The OpenFlow 1.2 spec states that the cookie may not be modified
476 AT_SETUP([ofproto - no mod flow with cookie change (OpenFlow 1.2)])
478 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 cookie=0x1,in_port=1,actions=1])
479 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
480 cookie=0x1, in_port=1 actions=output:1
481 OFPST_FLOW reply (OF1.2):
484 AT_CHECK([ovs-ofctl -O OpenFlow12 mod-flows br0 cookie=0x2,in_port=1,actions=1])
485 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
486 cookie=0x1, in_port=1 actions=output:1
487 OFPST_FLOW reply (OF1.2):
492 AT_SETUP([ofproto - mod flows based on cookie mask (OpenFlow 1.0)])
494 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x1,in_port=1,actions=1])
495 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x1,in_port=2,actions=1])
496 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x2,in_port=3,actions=1])
497 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
498 cookie=0x1, in_port=1 actions=output:1
499 cookie=0x1, in_port=2 actions=output:1
500 cookie=0x2, in_port=3 actions=output:1
504 AT_CHECK([ovs-ofctl -F nxm mod-flows br0 cookie=0x1/0xff,actions=4])
505 AT_CHECK([ovs-ofctl -F nxm dump-flows br0 | ofctl_strip | sort], [0], [dnl
506 cookie=0x1, in_port=1 actions=output:4
507 cookie=0x1, in_port=2 actions=output:4
508 cookie=0x2, in_port=3 actions=output:1
514 AT_SETUP([ofproto - mod flows based on cookie mask (OpenFlow 1.1)])
516 AT_CHECK([ovs-ofctl -O OpenFlow11 add-flow br0 cookie=0x1,in_port=1,actions=1])
517 AT_CHECK([ovs-ofctl -O OpenFlow11 add-flow br0 cookie=0x1,in_port=2,actions=1])
518 AT_CHECK([ovs-ofctl -O OpenFlow11 add-flow br0 cookie=0x2,in_port=3,actions=1])
519 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0], [dnl
520 cookie=0x1, in_port=1 actions=output:1
521 cookie=0x1, in_port=2 actions=output:1
522 cookie=0x2, in_port=3 actions=output:1
523 OFPST_FLOW reply (OF1.1):
526 AT_CHECK([ovs-ofctl -O OpenFlow11 mod-flows br0 cookie=0x1/0xff,actions=4])
527 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0], [dnl
528 cookie=0x1, in_port=1 actions=output:4
529 cookie=0x1, in_port=2 actions=output:4
530 cookie=0x2, in_port=3 actions=output:1
531 OFPST_FLOW reply (OF1.1):
536 AT_SETUP([ofproto - mod flows based on cookie mask (OpenFlow 1.2)])
538 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 cookie=0x1,in_port=1,actions=1])
539 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 cookie=0x1,in_port=2,actions=1])
540 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 cookie=0x2,in_port=3,actions=1])
541 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
542 cookie=0x1, in_port=1 actions=output:1
543 cookie=0x1, in_port=2 actions=output:1
544 cookie=0x2, in_port=3 actions=output:1
545 OFPST_FLOW reply (OF1.2):
548 AT_CHECK([ovs-ofctl -O OpenFlow12 mod-flows br0 cookie=0x1/0xff,actions=4])
549 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
550 cookie=0x1, in_port=1 actions=output:4
551 cookie=0x1, in_port=2 actions=output:4
552 cookie=0x2, in_port=3 actions=output:1
553 OFPST_FLOW reply (OF1.2):
558 dnl The OpenFlow 1.2 spec states that the cookie may not be modified
559 AT_SETUP([ofproto - mod flows based on cookie mask with cookie change])
561 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x1,in_port=1,actions=1])
562 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x1,in_port=2,actions=1])
563 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x2,in_port=3,actions=1])
564 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
565 cookie=0x1, in_port=1 actions=output:1
566 cookie=0x1, in_port=2 actions=output:1
567 cookie=0x2, in_port=3 actions=output:1
571 AT_CHECK([ovs-ofctl -F nxm mod-flows br0 cookie=1/-1,cookie=4,actions=4])
572 AT_CHECK([ovs-ofctl -F nxm dump-flows br0 | ofctl_strip | sort], [0], [dnl
573 cookie=0x2, in_port=3 actions=output:1
574 cookie=0x4, in_port=1 actions=output:4
575 cookie=0x4, in_port=2 actions=output:4
581 AT_SETUP([ofproto - mod flow with cookie miss (mask==0) - NXM])
583 AT_CHECK([ovs-ofctl -F nxm mod-flows br0 in_port=1,actions=1])
584 AT_CHECK([ovs-ofctl -F nxm dump-flows br0 | ofctl_strip | sort], [0], [dnl
585 in_port=1 actions=output:1
591 AT_SETUP([ofproto - mod flow with cookie miss (mask==0) - OF1.1])
593 AT_CHECK([ovs-ofctl -O openflow11 mod-flows br0 in_port=1,actions=1])
594 AT_CHECK([ovs-ofctl -O openflow11 dump-flows br0 | ofctl_strip | sort], [0], [dnl
595 in_port=1 actions=output:1
596 OFPST_FLOW reply (OF1.1):
601 AT_SETUP([ofproto - mod flow with cookie miss (mask==0) - OF1.2])
603 AT_CHECK([ovs-ofctl -O openflow12 mod-flows br0 in_port=1,actions=1])
604 AT_CHECK([ovs-ofctl -O openflow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
605 OFPST_FLOW reply (OF1.2):
610 AT_SETUP([ofproto - mod flow with cookie miss (mask!=0) - NXM])
612 AT_CHECK([ovs-ofctl -F nxm mod-flows br0 cookie=1/1,in_port=1,actions=1])
613 AT_CHECK([ovs-ofctl -F nxm dump-flows br0 | ofctl_strip | sort], [0], [dnl
619 AT_SETUP([ofproto - mod flow with cookie miss (mask!=0) - OF1.1])
621 AT_CHECK([ovs-ofctl -O openflow11 mod-flows br0 cookie=1/1,in_port=1,actions=1])
622 AT_CHECK([ovs-ofctl -O openflow11 dump-flows br0 | ofctl_strip | sort], [0], [dnl
623 OFPST_FLOW reply (OF1.1):
628 AT_SETUP([ofproto - mod flow with cookie miss (mask!=0) - OF1.2])
630 AT_CHECK([ovs-ofctl -O openflow12 mod-flows br0 cookie=1/1,in_port=1,actions=1])
631 AT_CHECK([ovs-ofctl -O openflow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
632 OFPST_FLOW reply (OF1.2):
637 AT_SETUP([ofproto - del flows with cookies])
639 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x1,in_port=1,actions=1])
640 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x2,in_port=2,actions=1])
641 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x3,in_port=3,actions=1])
642 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
643 cookie=0x1, in_port=1 actions=output:1
644 cookie=0x2, in_port=2 actions=output:1
645 cookie=0x3, in_port=3 actions=output:1
649 AT_CHECK([ovs-ofctl del-flows br0])
650 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
656 AT_SETUP([ofproto - del flows based on cookie])
658 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x1,in_port=1,actions=1])
659 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x2,in_port=2,actions=1])
660 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x3,in_port=3,actions=1])
661 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
662 cookie=0x1, in_port=1 actions=output:1
663 cookie=0x2, in_port=2 actions=output:1
664 cookie=0x3, in_port=3 actions=output:1
668 AT_CHECK([ovs-ofctl del-flows br0 cookie=0x3/-1])
669 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
670 cookie=0x1, in_port=1 actions=output:1
671 cookie=0x2, in_port=2 actions=output:1
677 AT_SETUP([ofproto - del flows based on cookie mask])
679 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x1,in_port=1,actions=1])
680 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x2,in_port=2,actions=1])
681 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x3,in_port=3,actions=1])
682 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
683 cookie=0x1, in_port=1 actions=output:1
684 cookie=0x2, in_port=2 actions=output:1
685 cookie=0x3, in_port=3 actions=output:1
688 AT_CHECK([ovs-ofctl del-flows br0 cookie=0x3/0x1])
689 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
690 cookie=0x2, in_port=2 actions=output:1
696 AT_SETUP([ofproto - del flows based on table id (NXM)])
698 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x1,in_port=1,actions=1])
699 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x2,in_port=2,table=1,actions=1])
700 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
701 cookie=0x1, in_port=1 actions=output:1
702 cookie=0x2, table=1, in_port=2 actions=output:1
705 AT_CHECK([ovs-ofctl del-flows br0 table=0])
706 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
707 cookie=0x2, table=1, in_port=2 actions=output:1
710 AT_CHECK([ovs-ofctl del-flows br0 table=1])
711 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
714 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x1,in_port=1,actions=1])
715 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x2,in_port=2,table=1,actions=1])
716 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
717 cookie=0x1, in_port=1 actions=output:1
718 cookie=0x2, table=1, in_port=2 actions=output:1
721 AT_CHECK([ovs-ofctl del-flows br0])
722 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
728 AT_SETUP([ofproto - del flows based on table id (OpenFlow 1.1)])
730 AT_CHECK([ovs-ofctl -O OpenFlow11 add-flow br0 cookie=0x1,in_port=1,actions=1])
731 AT_CHECK([ovs-ofctl -O OpenFlow11 add-flow br0 cookie=0x2,in_port=2,table=1,actions=1])
732 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0], [dnl
733 cookie=0x1, in_port=1 actions=output:1
734 cookie=0x2, table=1, in_port=2 actions=output:1
735 OFPST_FLOW reply (OF1.1):
737 AT_CHECK([ovs-ofctl -O OpenFlow11 del-flows br0 table=0])
738 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0], [dnl
739 cookie=0x2, table=1, in_port=2 actions=output:1
740 OFPST_FLOW reply (OF1.1):
742 AT_CHECK([ovs-ofctl -O OpenFlow11 del-flows br0 table=1])
743 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0], [dnl
744 OFPST_FLOW reply (OF1.1):
746 AT_CHECK([ovs-ofctl -O OpenFlow11 add-flow br0 cookie=0x1,in_port=1,actions=1])
747 AT_CHECK([ovs-ofctl -O OpenFlow11 add-flow br0 cookie=0x2,in_port=2,table=1,actions=1])
748 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0], [dnl
749 cookie=0x1, in_port=1 actions=output:1
750 cookie=0x2, table=1, in_port=2 actions=output:1
751 OFPST_FLOW reply (OF1.1):
753 AT_CHECK([ovs-ofctl -O OpenFlow11 del-flows br0])
754 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip], [0], [dnl
755 OFPST_FLOW reply (OF1.1):
756 cookie=0x2, table=1, in_port=2 actions=output:1
761 AT_SETUP([ofproto - del flows based on table id (OpenFlow 1.2)])
763 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 cookie=0x1,in_port=1,actions=1])
764 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 cookie=0x2,in_port=2,table=1,actions=1])
765 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
766 cookie=0x1, in_port=1 actions=output:1
767 cookie=0x2, table=1, in_port=2 actions=output:1
768 OFPST_FLOW reply (OF1.2):
770 AT_CHECK([ovs-ofctl -O OpenFlow12 del-flows br0 table=0])
771 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
772 cookie=0x2, table=1, in_port=2 actions=output:1
773 OFPST_FLOW reply (OF1.2):
775 AT_CHECK([ovs-ofctl -O OpenFlow12 del-flows br0 table=1])
776 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
777 OFPST_FLOW reply (OF1.2):
779 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 cookie=0x1,in_port=1,actions=1])
780 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 cookie=0x2,in_port=2,table=1,actions=1])
781 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
782 cookie=0x1, in_port=1 actions=output:1
783 cookie=0x2, table=1, in_port=2 actions=output:1
784 OFPST_FLOW reply (OF1.2):
786 AT_CHECK([ovs-ofctl -O OpenFlow12 del-flows br0])
787 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
788 OFPST_FLOW reply (OF1.2):
793 AT_SETUP([ofproto - flow table configuration (OpenFlow 1.0)])
795 # Check the default configuration.
796 (echo "OFPST_TABLE reply (xid=0x2): 254 tables
797 0: classifier: wild=0x3fffff, max=1000000, active=0
800 while test $x -lt 254; do
801 printf " %d: %-8s: wild=0x3fffff, max=1000000, active=0
806 AT_CHECK([ovs-ofctl dump-tables br0], [0], [expout])
807 # Change the configuration.
810 -- --id=@t0 create Flow_Table name=main \
811 -- --id=@t1 create Flow_Table flow-limit=1024 \
812 -- set bridge br0 'flow_tables={1=@t1,0=@t0}' \
813 | ${PERL} $srcdir/uuidfilt.pl],
817 # Check that the configuration was updated.
818 mv expout orig-expout
819 (echo "OFPST_TABLE reply (xid=0x2): 254 tables
820 0: main : wild=0x3fffff, max=1000000, active=0
822 1: table1 : wild=0x3fffff, max= 1024, active=0
824 tail -n +6 orig-expout) > expout
825 AT_CHECK([ovs-ofctl dump-tables br0], [0], [expout])
829 AT_SETUP([ofproto - flow table configuration (OpenFlow 1.2)])
831 # Check the default configuration.
832 (mid="wild=0xfffffffff, max=1000000,"
835 match=0xfffffffff, instructions=0x00000007, config=0x00000003
836 write_actions=0x00000000, apply_actions=0x00000000
837 write_setfields=0x0000000fffffffff
838 apply_setfields=0x0000000fffffffff
839 metadata_match=0xffffffffffffffff
840 metadata_write=0xffffffffffffffff"
841 echo "OFPST_TABLE reply (OF1.2) (xid=0x2): 254 tables
842 0: classifier: $mid active=0$tail"
844 while test $x -lt 254; do
845 printf " %d: %-8s: $mid active=0$tail
849 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-tables br0], [0], [expout])
850 # Change the configuration.
853 -- --id=@t0 create Flow_Table name=main \
854 -- --id=@t1 create Flow_Table flow-limit=1024 \
855 -- set bridge br0 'flow_tables={1=@t1,0=@t0}' \
856 | ${PERL} $srcdir/uuidfilt.pl],
860 # Check that the configuration was updated.
861 mv expout orig-expout
862 (echo "OFPST_TABLE reply (OF1.2) (xid=0x2): 254 tables
863 0: main : wild=0xfffffffff, max=1000000, active=0"
864 tail -n +3 orig-expout | head -7
865 echo " 1: table1 : wild=0xfffffffff, max= 1024, active=0"
866 tail -n +11 orig-expout) > expout
867 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-tables br0], [0], [expout])
871 AT_SETUP([ofproto - hard limits on flow table size (OpenFLow 1.0)])
873 # Configure a maximum of 4 flows.
876 -- --id=@t0 create Flow_Table flow-limit=4 \
877 -- set bridge br0 flow_tables:0=@t0 \
878 | ${PERL} $srcdir/uuidfilt.pl],
882 for in_port in 1 2 3 4; do
883 ovs-ofctl add-flow br0 in_port=$in_port,actions=drop
885 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
886 in_port=1 actions=drop
887 in_port=2 actions=drop
888 in_port=3 actions=drop
889 in_port=4 actions=drop
892 # Adding another flow will be refused.
893 AT_CHECK([ovs-ofctl add-flow br0 in_port=5,actions=drop], [1], [], [stderr])
894 AT_CHECK([head -n 1 stderr | ofctl_strip], [0],
895 [OFPT_ERROR: OFPFMFC_TABLE_FULL
897 # Also a mod-flow that would add a flow will be refused.
898 AT_CHECK([ovs-ofctl mod-flows br0 in_port=5,actions=drop], [1], [], [stderr])
899 AT_CHECK([head -n 1 stderr | ofctl_strip], [0],
900 [OFPT_ERROR: OFPFMFC_TABLE_FULL
902 # Replacing or modifying an existing flow is allowed.
903 AT_CHECK([ovs-ofctl add-flow br0 in_port=4,actions=normal])
904 AT_CHECK([ovs-ofctl mod-flows br0 in_port=3,actions=output:1])
905 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
906 in_port=1 actions=drop
907 in_port=2 actions=drop
908 in_port=3 actions=output:1
909 in_port=4 actions=NORMAL
915 AT_SETUP([ofproto - hard limits on flow table size (OpenFLow 1.2)])
917 # Configure a maximum of 4 flows.
920 -- --id=@t0 create Flow_Table flow-limit=4 \
921 -- set bridge br0 flow_tables:0=@t0 \
922 | ${PERL} $srcdir/uuidfilt.pl],
926 for in_port in 1 2 3 4; do
927 ovs-ofctl -O OpenFlow12 add-flow br0 in_port=$in_port,actions=drop
929 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
930 in_port=1 actions=drop
931 in_port=2 actions=drop
932 in_port=3 actions=drop
933 in_port=4 actions=drop
934 OFPST_FLOW reply (OF1.2):
936 # Adding another flow will be refused.
937 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 in_port=5,actions=drop], [1], [], [stderr])
938 AT_CHECK([head -n 1 stderr | ofctl_strip], [0],
939 [OFPT_ERROR (OF1.2): OFPFMFC_TABLE_FULL
941 # Replacing or modifying an existing flow is allowed.
942 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 in_port=4,actions=normal])
943 AT_CHECK([ovs-ofctl -O OpenFlow12 mod-flows br0 in_port=3,actions=output:1])
944 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
945 in_port=1 actions=drop
946 in_port=2 actions=drop
947 in_port=3 actions=output:1
948 in_port=4 actions=NORMAL
949 OFPST_FLOW reply (OF1.2):
954 AT_SETUP([ofproto - eviction upon table overflow (OpenFlow 1.0)])
956 # Configure a maximum of 4 flows.
959 -- --id=@t0 create Flow_Table flow-limit=4 overflow-policy=evict \
960 -- set bridge br0 flow_tables:0=@t0 \
961 | ${PERL} $srcdir/uuidfilt.pl],
965 for in_port in 4 3 2 1; do
966 ovs-ofctl add-flow br0 idle_timeout=${in_port}0,in_port=$in_port,actions=drop
968 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
969 idle_timeout=10, in_port=1 actions=drop
970 idle_timeout=20, in_port=2 actions=drop
971 idle_timeout=30, in_port=3 actions=drop
972 idle_timeout=40, in_port=4 actions=drop
975 # Adding another flow will cause the one that expires soonest to be evicted.
976 AT_CHECK([ovs-ofctl add-flow br0 in_port=5,actions=drop])
977 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
978 idle_timeout=20, in_port=2 actions=drop
979 idle_timeout=30, in_port=3 actions=drop
980 idle_timeout=40, in_port=4 actions=drop
981 in_port=5 actions=drop
984 # A mod-flow that adds a flow also causes eviction, but replacing or
985 # modifying an existing flow doesn't.
986 AT_CHECK([ovs-ofctl mod-flows br0 in_port=6,actions=drop])
987 AT_CHECK([ovs-ofctl add-flow br0 in_port=4,actions=normal])
988 AT_CHECK([ovs-ofctl mod-flows br0 in_port=3,actions=output:1])
989 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
990 idle_timeout=30, in_port=3 actions=output:1
991 in_port=4 actions=NORMAL
992 in_port=5 actions=drop
993 in_port=6 actions=drop
996 # Flows with no timeouts at all cannot be evicted.
997 AT_CHECK([ovs-ofctl add-flow br0 in_port=7,actions=normal])
998 AT_CHECK([ovs-ofctl add-flow br0 in_port=8,actions=drop], [1], [], [stderr])
999 AT_CHECK([head -n 1 stderr | ofctl_strip], [0],
1000 [OFPT_ERROR: OFPFMFC_TABLE_FULL
1002 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1003 in_port=4 actions=NORMAL
1004 in_port=5 actions=drop
1005 in_port=6 actions=drop
1006 in_port=7 actions=NORMAL
1012 AT_SETUP([ofproto - eviction upon table overflow (OpenFlow 1.2)])
1014 # Configure a maximum of 4 flows.
1017 -- --id=@t0 create Flow_Table flow-limit=4 overflow-policy=evict \
1018 -- set bridge br0 flow_tables:0=@t0 \
1019 | ${PERL} $srcdir/uuidfilt.pl],
1023 for in_port in 4 3 2 1; do
1024 ovs-ofctl -O OpenFlow12 add-flow br0 idle_timeout=${in_port}0,in_port=$in_port,actions=drop
1026 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1027 idle_timeout=10, in_port=1 actions=drop
1028 idle_timeout=20, in_port=2 actions=drop
1029 idle_timeout=30, in_port=3 actions=drop
1030 idle_timeout=40, in_port=4 actions=drop
1031 OFPST_FLOW reply (OF1.2):
1033 # Adding another flow will cause the one that expires soonest to be evicted.
1034 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 in_port=5,actions=drop])
1035 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1036 idle_timeout=20, in_port=2 actions=drop
1037 idle_timeout=30, in_port=3 actions=drop
1038 idle_timeout=40, in_port=4 actions=drop
1039 in_port=5 actions=drop
1040 OFPST_FLOW reply (OF1.2):
1042 # In Open Flow 1.2 a mod-flow does not ever add a flow and thus
1043 # has no effect on eviction
1044 AT_CHECK([ovs-ofctl -O OpenFlow12 mod-flows br0 in_port=6,actions=drop])
1045 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 in_port=4,actions=normal])
1046 AT_CHECK([ovs-ofctl -O OpenFlow12 mod-flows br0 in_port=3,actions=output:1])
1047 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1048 idle_timeout=20, in_port=2 actions=drop
1049 idle_timeout=30, in_port=3 actions=output:1
1050 in_port=4 actions=NORMAL
1051 in_port=5 actions=drop
1052 OFPST_FLOW reply (OF1.2):
1054 # Flows with no timeouts at all cannot be evicted.
1055 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 in_port=6,actions=drop])
1056 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 in_port=7,actions=normal])
1057 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 in_port=8,actions=drop], [1], [], [stderr])
1058 AT_CHECK([head -n 1 stderr | ofctl_strip], [0],
1059 [OFPT_ERROR (OF1.2): OFPFMFC_TABLE_FULL
1061 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1062 in_port=4 actions=NORMAL
1063 in_port=5 actions=drop
1064 in_port=6 actions=drop
1065 in_port=7 actions=NORMAL
1066 OFPST_FLOW reply (OF1.2):
1071 AT_SETUP([ofproto - eviction upon table overflow, with fairness (OpenFlow 1.0)])
1073 # Configure a maximum of 4 flows.
1076 -- --id=@t0 create Flow_Table name=evict flow-limit=4 \
1077 overflow-policy=evict \
1078 groups='"NXM_OF_IN_PORT[[]]"' \
1079 -- set bridge br0 flow_tables:0=@t0 \
1080 | ${PERL} $srcdir/uuidfilt.pl],
1084 ovs-ofctl add-flows br0 - <<EOF
1085 idle_timeout=10 in_port=2 dl_src=00:44:55:66:77:88 actions=drop
1086 idle_timeout=20 in_port=1 dl_src=00:11:22:33:44:55 actions=drop
1087 idle_timeout=30 in_port=1 dl_src=00:22:33:44:55:66 actions=drop
1088 idle_timeout=40 in_port=1 dl_src=00:33:44:55:66:77 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=20, in_port=1,dl_src=00:11:22:33:44:55 actions=drop
1093 idle_timeout=30, in_port=1,dl_src=00:22:33:44:55:66 actions=drop
1094 idle_timeout=40, in_port=1,dl_src=00:33:44:55:66:77 actions=drop
1097 # Adding another flow will cause the one that expires soonest within
1098 # the largest group (those with in_port=1) to be evicted. In this
1099 # case this is not the same as the one that expires soonest overall
1100 # (which is what makes the test interesting):
1101 AT_CHECK([ovs-ofctl add-flow br0 in_port=2,dl_src=00:55:66:77:88:99,actions=drop])
1102 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1103 idle_timeout=10, in_port=2,dl_src=00:44:55:66:77:88 actions=drop
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 in_port=2,dl_src=00:55:66:77:88:99 actions=drop
1109 # Enlarge the flow limit, change the eviction policy back to strictly
1110 # based on expiration, and and add some flows.
1111 AT_CHECK([ovs-vsctl set Flow_Table evict groups='[[]]' flow-limit=7])
1112 ovs-ofctl add-flows br0 - <<EOF
1113 idle_timeout=50 in_port=2 dl_src=00:66:77:88:99:aa actions=drop
1114 idle_timeout=60 in_port=2 dl_src=00:77:88:99:aa:bb actions=drop
1115 idle_timeout=70 in_port=2 dl_src=00:88:99:aa:bb:cc actions=drop
1117 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1118 idle_timeout=10, in_port=2,dl_src=00:44:55:66:77:88 actions=drop
1119 idle_timeout=30, in_port=1,dl_src=00:22:33:44:55:66 actions=drop
1120 idle_timeout=40, in_port=1,dl_src=00:33:44:55:66:77 actions=drop
1121 idle_timeout=50, in_port=2,dl_src=00:66:77:88:99:aa actions=drop
1122 idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=drop
1123 idle_timeout=70, in_port=2,dl_src=00:88:99:aa:bb:cc actions=drop
1124 in_port=2,dl_src=00:55:66:77:88:99 actions=drop
1127 # Adding another flow will cause the one that expires soonest overall
1129 AT_CHECK([ovs-ofctl add-flow br0 'idle_timeout=80 in_port=2 dl_src=00:99:aa:bb:cc:dd actions=drop'])
1130 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1131 idle_timeout=30, in_port=1,dl_src=00:22:33:44:55:66 actions=drop
1132 idle_timeout=40, in_port=1,dl_src=00:33:44:55:66:77 actions=drop
1133 idle_timeout=50, in_port=2,dl_src=00:66:77:88:99:aa actions=drop
1134 idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=drop
1135 idle_timeout=70, in_port=2,dl_src=00:88:99:aa:bb:cc actions=drop
1136 idle_timeout=80, in_port=2,dl_src=00:99:aa:bb:cc:dd actions=drop
1137 in_port=2,dl_src=00:55:66:77:88:99 actions=drop
1140 # Reducing the flow limit also causes the flows that expire soonest
1141 # overall to be evicted.
1142 AT_CHECK([ovs-vsctl set Flow_Table evict flow-limit=4])
1143 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1144 idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=drop
1145 idle_timeout=70, in_port=2,dl_src=00:88:99:aa:bb:cc actions=drop
1146 idle_timeout=80, in_port=2,dl_src=00:99:aa:bb:cc:dd actions=drop
1147 in_port=2,dl_src=00:55:66:77:88:99 actions=drop
1153 AT_SETUP([ofproto - eviction upon table overflow, with fairness (OpenFlow 1.2)])
1155 # Configure a maximum of 4 flows.
1158 -- --id=@t0 create Flow_Table name=evict flow-limit=4 \
1159 overflow-policy=evict \
1160 groups='"NXM_OF_IN_PORT[[]]"' \
1161 -- set bridge br0 flow_tables:0=@t0 \
1162 | ${PERL} $srcdir/uuidfilt.pl],
1166 ovs-ofctl -O OpenFlow12 add-flows br0 - <<EOF
1167 idle_timeout=10 in_port=2 dl_src=00:44:55:66:77:88 actions=drop
1168 idle_timeout=20 in_port=1 dl_src=00:11:22:33:44:55 actions=drop
1169 idle_timeout=30 in_port=1 dl_src=00:22:33:44:55:66 actions=drop
1170 idle_timeout=40 in_port=1 dl_src=00:33:44:55:66:77 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=20, in_port=1,dl_src=00:11:22:33:44:55 actions=drop
1175 idle_timeout=30, in_port=1,dl_src=00:22:33:44:55:66 actions=drop
1176 idle_timeout=40, in_port=1,dl_src=00:33:44:55:66:77 actions=drop
1177 OFPST_FLOW reply (OF1.2):
1179 # Adding another flow will cause the one that expires soonest within
1180 # the largest group (those with in_port=1) to be evicted. In this
1181 # case this is not the same as the one that expires soonest overall
1182 # (which is what makes the test interesting):
1183 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 in_port=2,dl_src=00:55:66:77:88:99,actions=drop])
1184 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1185 idle_timeout=10, in_port=2,dl_src=00:44:55:66:77:88 actions=drop
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 in_port=2,dl_src=00:55:66:77:88:99 actions=drop
1189 OFPST_FLOW reply (OF1.2):
1191 # Enlarge the flow limit, change the eviction policy back to strictly
1192 # based on expiration, and and add some flows.
1193 AT_CHECK([ovs-vsctl set Flow_Table evict groups='[[]]' flow-limit=7])
1194 ovs-ofctl -O OpenFlow12 add-flows br0 - <<EOF
1195 idle_timeout=50 in_port=2 dl_src=00:66:77:88:99:aa actions=drop
1196 idle_timeout=60 in_port=2 dl_src=00:77:88:99:aa:bb actions=drop
1197 idle_timeout=70 in_port=2 dl_src=00:88:99:aa:bb:cc actions=drop
1199 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1200 idle_timeout=10, in_port=2,dl_src=00:44:55:66:77:88 actions=drop
1201 idle_timeout=30, in_port=1,dl_src=00:22:33:44:55:66 actions=drop
1202 idle_timeout=40, in_port=1,dl_src=00:33:44:55:66:77 actions=drop
1203 idle_timeout=50, in_port=2,dl_src=00:66:77:88:99:aa actions=drop
1204 idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=drop
1205 idle_timeout=70, in_port=2,dl_src=00:88:99:aa:bb:cc actions=drop
1206 in_port=2,dl_src=00:55:66:77:88:99 actions=drop
1207 OFPST_FLOW reply (OF1.2):
1209 # Adding another flow will cause the one that expires soonest overall
1211 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'])
1212 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1213 idle_timeout=30, in_port=1,dl_src=00:22:33:44:55:66 actions=drop
1214 idle_timeout=40, in_port=1,dl_src=00:33:44:55:66:77 actions=drop
1215 idle_timeout=50, in_port=2,dl_src=00:66:77:88:99:aa actions=drop
1216 idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=drop
1217 idle_timeout=70, in_port=2,dl_src=00:88:99:aa:bb:cc actions=drop
1218 idle_timeout=80, in_port=2,dl_src=00:99:aa:bb:cc:dd actions=drop
1219 in_port=2,dl_src=00:55:66:77:88:99 actions=drop
1220 OFPST_FLOW reply (OF1.2):
1222 # Reducing the flow limit also causes the flows that expire soonest
1223 # overall to be evicted.
1224 AT_CHECK([ovs-vsctl set Flow_Table evict flow-limit=4])
1225 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1226 idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=drop
1227 idle_timeout=70, in_port=2,dl_src=00:88:99:aa:bb:cc actions=drop
1228 idle_timeout=80, in_port=2,dl_src=00:99:aa:bb:cc:dd actions=drop
1229 in_port=2,dl_src=00:55:66:77:88:99 actions=drop
1230 OFPST_FLOW reply (OF1.2):
1235 AT_SETUP([ofproto - asynchronous message control (OpenFlow 1.0)])
1237 AT_CHECK([ovs-ofctl -P openflow10 monitor br0 --detach --no-chdir --pidfile])
1239 printf '\n\n--- check_async %d ---\n\n\n' $1
1242 ovs-appctl -t ovs-ofctl ofctl/barrier
1243 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
1246 # OFPT_PACKET_IN, OFPR_ACTION (controller_id=0)
1247 ovs-ofctl -v packet-out br0 controller controller '0001020304050010203040501234'
1248 if test X"$1" = X"OFPR_ACTION"; then shift;
1249 echo >>expout "OFPT_PACKET_IN: total_len=14 in_port=CONTROLLER (via action) data_len=14 (unbuffered)
1250 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"
1253 # OFPT_PACKET_IN, OFPR_NO_MATCH (controller_id=123)
1254 ovs-ofctl -v packet-out br0 controller 'controller(reason=no_match,id=123)' '0001020304050010203040501234'
1255 if test X"$1" = X"OFPR_NO_MATCH"; then shift;
1256 echo >>expout "OFPT_PACKET_IN: total_len=14 in_port=CONTROLLER (via no_match) data_len=14 (unbuffered)
1257 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"
1260 # OFPT_PACKET_IN, OFPR_INVALID_TTL (controller_id=0)
1261 ovs-ofctl packet-out br0 controller dec_ttl '002583dfb4000026b98cb0f908004500003fb7e200000011339bac11370dac100002d7730035002b8f6d86fb0100000100000000000006626c702d7873066e696369726103636f6d00000f00'
1262 if test X"$1" = X"OFPR_INVALID_TTL"; then shift;
1263 echo >>expout "OFPT_PACKET_IN: total_len=76 in_port=CONTROLLER (via invalid_ttl) data_len=76 (unbuffered)
1264 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"
1267 # OFPT_PORT_STATUS, OFPPR_ADD
1268 ovs-vsctl add-port br0 test -- set Interface test type=dummy ofport_request=1
1269 if test X"$1" = X"OFPPR_ADD"; then shift;
1270 echo >>expout "OFPT_PORT_STATUS: ADD: 1(test): addr:aa:55:aa:55:00:0x
1273 speed: 0 Mbps now, 0 Mbps max"
1276 # OFPT_PORT_STATUS, OFPPR_DELETE
1277 ovs-vsctl del-port br0 test
1278 if test X"$1" = X"OFPPR_DELETE"; then shift;
1279 echo >>expout "OFPT_PORT_STATUS: DEL: 1(test): addr:aa:55:aa:55:00:0x
1282 speed: 0 Mbps now, 0 Mbps max"
1285 # OFPT_FLOW_REMOVED, OFPRR_DELETE
1286 ovs-ofctl add-flow br0 send_flow_rem,actions=drop
1287 ovs-ofctl --strict del-flows br0 ''
1288 if test X"$1" = X"OFPRR_DELETE"; then shift;
1289 echo >>expout "OFPT_FLOW_REMOVED: reason=delete"
1291 AT_FAIL_IF([test X"$1" != X])
1293 ovs-appctl -t ovs-ofctl ofctl/barrier
1294 echo >>expout "OFPT_BARRIER_REPLY:"
1298 s/ (xid=0x[0-9a-fA-F]*)//
1300 s/00:0.$/00:0x/' < monitor.log]],
1304 # It's a service connection so initially there should be no async messages.
1307 # Set miss_send_len to 128, turning on packet-ins for our service connection.
1308 ovs-appctl -t ovs-ofctl ofctl/send 0109000c0123456700000080
1309 check_async 2 OFPR_ACTION OFPPR_ADD OFPPR_DELETE OFPRR_DELETE
1311 # Set miss_send_len to 128 and enable invalid_ttl.
1312 ovs-appctl -t ovs-ofctl ofctl/send 0109000c0123456700040080
1313 check_async 3 OFPR_ACTION OFPR_INVALID_TTL OFPPR_ADD OFPPR_DELETE OFPRR_DELETE
1315 # Become slave, which should disable everything except port status.
1316 ovs-appctl -t ovs-ofctl ofctl/send 0104001400000002000023200000000a00000002
1317 check_async 4 OFPPR_ADD OFPPR_DELETE
1319 # Use NXT_SET_ASYNC_CONFIG to enable a patchwork of asynchronous messages.
1320 ovs-appctl -t ovs-ofctl ofctl/send 01040028000000020000232000000013000000020000000500000005000000020000000200000005
1321 check_async 5 OFPR_INVALID_TTL OFPPR_DELETE OFPRR_DELETE
1323 # Set controller ID 123.
1324 ovs-appctl -t ovs-ofctl ofctl/send 01040018000000030000232000000014000000000000007b
1325 check_async 6 OFPR_NO_MATCH OFPPR_DELETE OFPRR_DELETE
1327 # Restore controller ID 0.
1328 ovs-appctl -t ovs-ofctl ofctl/send 010400180000000300002320000000140000000000000000
1331 ovs-appctl -t ovs-ofctl ofctl/send 0104001400000002000023200000000a00000001
1332 check_async 7 OFPR_ACTION OFPPR_ADD
1334 ovs-appctl -t ovs-ofctl exit
1338 AT_SETUP([ofproto - asynchronous message control (OpenFlow 1.2)])
1340 AT_CHECK([ovs-ofctl -O OpenFlow12 monitor br0 --detach --no-chdir --pidfile])
1342 printf '\n\n--- check_async %d ---\n\n\n' $1
1346 ovs-appctl -t ovs-ofctl ofctl/barrier
1347 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
1350 # OFPT_PACKET_IN, OFPR_ACTION (controller_id=0)
1351 ovs-ofctl -O OpenFlow12 -v packet-out br0 none controller '0001020304050010203040501234'
1352 if test X"$1" = X"OFPR_ACTION"; then shift;
1353 echo >>expout "OFPT_PACKET_IN (OF1.2): total_len=14 in_port=ANY (via action) data_len=14 (unbuffered)
1354 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"
1357 # OFPT_PACKET_IN, OFPR_NO_MATCH (controller_id=123)
1358 ovs-ofctl -O OpenFlow12 -v packet-out br0 none 'controller(reason=no_match,id=123)' '0001020304050010203040501234'
1359 if test X"$1" = X"OFPR_NO_MATCH"; then shift;
1360 echo >>expout "OFPT_PACKET_IN (OF1.2): total_len=14 in_port=ANY (via no_match) data_len=14 (unbuffered)
1361 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"
1364 # OFPT_PACKET_IN, OFPR_INVALID_TTL (controller_id=0)
1365 ovs-ofctl -O OpenFlow12 packet-out br0 none dec_ttl '002583dfb4000026b98cb0f908004500003fb7e200000011339bac11370dac100002d7730035002b8f6d86fb0100000100000000000006626c702d7873066e696369726103636f6d00000f00'
1366 if test X"$1" = X"OFPR_INVALID_TTL"; then shift;
1367 echo >>expout "OFPT_PACKET_IN (OF1.2): total_len=76 in_port=ANY (via invalid_ttl) data_len=76 (unbuffered)
1368 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"
1371 # OFPT_PORT_STATUS, OFPPR_ADD
1372 ovs-vsctl add-port br0 test -- set Interface test type=dummy
1373 if test X"$1" = X"OFPPR_ADD"; then shift;
1374 echo >>expout "OFPT_PORT_STATUS (OF1.2): ADD: ${INDEX}(test): addr:aa:55:aa:55:00:0x
1377 speed: 0 Mbps now, 0 Mbps max"
1380 # OFPT_PORT_STATUS, OFPPR_DELETE
1381 ovs-vsctl del-port br0 test
1382 if test X"$1" = X"OFPPR_DELETE"; then shift;
1383 echo >>expout "OFPT_PORT_STATUS (OF1.2): DEL: ${INDEX}(test): addr:aa:55:aa:55:00:0x
1386 speed: 0 Mbps now, 0 Mbps max"
1389 # OFPT_FLOW_REMOVED, OFPRR_DELETE
1390 ovs-ofctl -O OpenFlow12 add-flow br0 send_flow_rem,actions=drop
1391 ovs-ofctl -O OpenFlow12 --strict del-flows br0 ''
1392 if test X"$1" = X"OFPRR_DELETE"; then shift;
1393 echo >>expout "OFPT_FLOW_REMOVED (OF1.2): reason=delete table_id=0"
1395 AT_FAIL_IF([test X"$1" != X])
1397 ovs-appctl -t ovs-ofctl ofctl/barrier
1398 echo >>expout "OFPT_BARRIER_REPLY (OF1.2):"
1402 s/ (xid=0x[0-9a-fA-F]*)//
1404 s/00:0.$/00:0x/' < monitor.log]],
1408 # It's a service connection so initially there should be no async messages.
1411 # Set miss_send_len to 128, turning on packet-ins for our service connection.
1412 ovs-appctl -t ovs-ofctl ofctl/send 0309000c0123456700000080
1413 check_async 2 OFPR_ACTION OFPPR_ADD OFPPR_DELETE OFPRR_DELETE
1415 # Set miss_send_len to 128 and enable invalid_ttl.
1416 ovs-appctl -t ovs-ofctl ofctl/send 0309000c0123456700040080
1417 check_async 3 OFPR_ACTION OFPR_INVALID_TTL OFPPR_ADD OFPPR_DELETE OFPRR_DELETE
1419 # Become slave (OF 1.2), which should disable everything except port status.
1420 ovs-appctl -t ovs-ofctl ofctl/send 031800180000000200000003000000000000000000000001
1421 check_async 4 OFPPR_ADD OFPPR_DELETE
1423 # Use NXT_SET_ASYNC_CONFIG to enable a patchwork of asynchronous messages.
1424 ovs-appctl -t ovs-ofctl ofctl/send 03040028000000020000232000000013000000020000000500000005000000020000000200000005
1425 check_async 5 OFPR_INVALID_TTL OFPPR_DELETE OFPRR_DELETE
1427 # Set controller ID 123.
1428 ovs-appctl -t ovs-ofctl ofctl/send 03040018000000030000232000000014000000000000007b
1429 check_async 6 OFPR_NO_MATCH OFPPR_DELETE OFPRR_DELETE
1431 # Restore controller ID 0.
1432 ovs-appctl -t ovs-ofctl ofctl/send 030400180000000300002320000000140000000000000000
1434 # Become master (OF 1.2).
1435 ovs-appctl -t ovs-ofctl ofctl/send 031800180000000400000002000000000000000000000002
1436 check_async 7 OFPR_ACTION OFPPR_ADD
1438 ovs-appctl -t ovs-ofctl exit
1442 AT_SETUP([ofproto - asynchronous message control (OpenFlow 1.3)])
1444 AT_CHECK([ovs-ofctl -O OpenFlow13 monitor br0 --detach --no-chdir --pidfile])
1446 printf '\n\n--- check_async %d ---\n\n\n' $1
1450 ovs-appctl -t ovs-ofctl ofctl/barrier
1451 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
1454 # OFPT_PACKET_IN, OFPR_ACTION (controller_id=0)
1455 ovs-ofctl -O OpenFlow13 -v packet-out br0 none controller '0001020304050010203040501234'
1456 if test X"$1" = X"OFPR_ACTION"; then shift;
1457 echo >>expout "OFPT_PACKET_IN (OF1.3): total_len=14 in_port=ANY (via action) data_len=14 (unbuffered)
1458 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"
1461 # OFPT_PACKET_IN, OFPR_NO_MATCH (controller_id=123)
1462 ovs-ofctl -O OpenFlow13 -v packet-out br0 none 'controller(reason=no_match,id=123)' '0001020304050010203040501234'
1463 if test X"$1" = X"OFPR_NO_MATCH"; then shift;
1464 echo >>expout "OFPT_PACKET_IN (OF1.3): total_len=14 in_port=ANY (via no_match) data_len=14 (unbuffered)
1465 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"
1468 # OFPT_PACKET_IN, OFPR_INVALID_TTL (controller_id=0)
1469 ovs-ofctl -O OpenFlow13 packet-out br0 none dec_ttl '002583dfb4000026b98cb0f908004500003fb7e200000011339bac11370dac100002d7730035002b8f6d86fb0100000100000000000006626c702d7873066e696369726103636f6d00000f00'
1470 if test X"$1" = X"OFPR_INVALID_TTL"; then shift;
1471 echo >>expout "OFPT_PACKET_IN (OF1.3): total_len=76 in_port=ANY (via invalid_ttl) data_len=76 (unbuffered)
1472 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"
1475 # OFPT_PORT_STATUS, OFPPR_ADD
1476 ovs-vsctl add-port br0 test -- set Interface test type=dummy
1477 if test X"$1" = X"OFPPR_ADD"; then shift;
1478 echo >>expout "OFPT_PORT_STATUS (OF1.3): ADD: ${INDEX}(test): addr:aa:55:aa:55:00:0x
1481 speed: 0 Mbps now, 0 Mbps max"
1484 # OFPT_PORT_STATUS, OFPPR_DELETE
1485 ovs-vsctl del-port br0 test
1486 if test X"$1" = X"OFPPR_DELETE"; then shift;
1487 echo >>expout "OFPT_PORT_STATUS (OF1.3): DEL: ${INDEX}(test): addr:aa:55:aa:55:00:0x
1490 speed: 0 Mbps now, 0 Mbps max"
1493 # OFPT_FLOW_REMOVED, OFPRR_DELETE
1494 ovs-ofctl -O OpenFlow13 add-flow br0 send_flow_rem,actions=drop
1495 ovs-ofctl -O OpenFlow13 --strict del-flows br0 ''
1496 if test X"$1" = X"OFPRR_DELETE"; then shift;
1497 echo >>expout "OFPT_FLOW_REMOVED (OF1.3): reason=delete table_id=0"
1499 AT_FAIL_IF([test X"$1" != X])
1501 ovs-appctl -t ovs-ofctl ofctl/barrier
1502 echo >>expout "OFPT_BARRIER_REPLY (OF1.3):"
1506 s/ (xid=0x[0-9a-fA-F]*)//
1508 s/00:0.$/00:0x/' < monitor.log]],
1512 # It's a service connection so initially there should be no async messages.
1515 # Set miss_send_len to 128, turning on packet-ins for our service connection.
1516 ovs-appctl -t ovs-ofctl ofctl/send 0409000c0123456700000080
1517 check_async 2 OFPR_ACTION OFPPR_ADD OFPPR_DELETE OFPRR_DELETE
1519 # Become slave (OF 1.3), which should disable everything except port status.
1520 ovs-appctl -t ovs-ofctl ofctl/send 041800180000000200000003000000000000000000000001
1521 check_async 3 OFPPR_ADD OFPPR_DELETE
1523 # Use OF 1.3 OFPT_SET_ASYNC to enable a patchwork of asynchronous messages.
1524 ovs-appctl -t ovs-ofctl ofctl/send 041c002000000002000000020000000500000005000000020000000200000005
1525 check_async 4 OFPR_INVALID_TTL OFPPR_DELETE OFPRR_DELETE
1527 # Set controller ID 123.
1528 ovs-appctl -t ovs-ofctl ofctl/send 04040018000000030000232000000014000000000000007b
1529 check_async 5 OFPR_NO_MATCH OFPPR_DELETE OFPRR_DELETE
1531 # Restore controller ID 0.
1532 ovs-appctl -t ovs-ofctl ofctl/send 040400180000000300002320000000140000000000000000
1534 # Become master (OF 1.3).
1535 ovs-appctl -t ovs-ofctl ofctl/send 041800180000000400000002000000000000000000000002
1536 check_async 6 OFPR_ACTION OFPPR_ADD
1538 ovs-appctl -t ovs-ofctl exit
1542 dnl This test checks that the role request/response messaging works
1543 dnl and that generation_id is handled properly.
1544 AT_SETUP([ofproto - controller role (OpenFlow 1.2)])
1546 AT_CHECK([ovs-ofctl -O OpenFlow12 monitor br0 --detach --no-chdir --pidfile])
1548 ovs-appctl -t ovs-ofctl ofctl/barrier
1549 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
1552 # find out current role
1553 ovs-appctl -t ovs-ofctl ofctl/send 031800180000000200000000000000000000000000000000
1554 echo >>expout "send: OFPT_ROLE_REQUEST (OF1.2) (xid=0x2): role=nochange"
1555 echo >>expout "OFPT_ROLE_REPLY (OF1.2) (xid=0x2): role=equal"
1557 # Become slave (generation_id is initially undefined, so 2^63+2 should not be stale)
1558 ovs-appctl -t ovs-ofctl ofctl/send 031800180000000300000003000000008000000000000002
1559 echo >>expout "send: OFPT_ROLE_REQUEST (OF1.2) (xid=0x3): role=slave generation_id=9223372036854775810"
1560 echo >>expout "OFPT_ROLE_REPLY (OF1.2) (xid=0x3): role=slave generation_id=9223372036854775810"
1562 # Try to become the master using a stale generation ID
1563 ovs-appctl -t ovs-ofctl ofctl/send 031800180000000400000002000000000000000000000002
1564 echo >>expout "send: OFPT_ROLE_REQUEST (OF1.2) (xid=0x4): role=master generation_id=2"
1565 echo >>expout "OFPT_ERROR (OF1.2) (xid=0x4): OFPRRFC_STALE"
1566 echo >>expout "OFPT_ROLE_REQUEST (OF1.2) (xid=0x4): role=master generation_id=2"
1568 # Become master using a valid generation ID
1569 ovs-appctl -t ovs-ofctl ofctl/send 031800180000000500000002000000000000000000000001
1570 echo >>expout "send: OFPT_ROLE_REQUEST (OF1.2) (xid=0x5): role=master generation_id=1"
1571 echo >>expout "OFPT_ROLE_REPLY (OF1.2) (xid=0x5): role=master generation_id=1"
1572 ovs-appctl -t ovs-ofctl ofctl/barrier
1573 echo >>expout "OFPT_BARRIER_REPLY (OF1.2) (xid=0x3):"
1575 AT_CHECK([cat monitor.log], [0], [expout])
1577 ovs-appctl -t ovs-ofctl exit
1581 dnl This test checks that OFPT_PACKET_OUT accepts both OFPP_NONE (as
1582 dnl specified by OpenFlow 1.0) and OFPP_CONTROLLER (used by some
1583 dnl controllers despite the spec) as meaning a packet that was generated
1584 dnl by the controller.
1585 AT_SETUP([ofproto - packet-out from controller (OpenFlow 1.0)])
1587 ADD_OF_PORTS([br0], [1])
1589 # Start a monitor listening for packet-ins.
1590 AT_CHECK([ovs-ofctl -P openflow10 monitor br0 --detach --no-chdir --pidfile])
1591 ovs-appctl -t ovs-ofctl ofctl/send 0109000c0123456700000080
1592 ovs-appctl -t ovs-ofctl ofctl/barrier
1593 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
1594 AT_CAPTURE_FILE([monitor.log])
1596 # Send some packet-outs with OFPP_NONE and OFPP_CONTROLLER (65533) as in_port.
1597 AT_CHECK([ovs-ofctl packet-out br0 none controller,1 '0001020304050010203040501234'])
1598 AT_CHECK([ovs-ofctl packet-out br0 controller controller,1 '0001020304050010203040505678'])
1600 # Stop the monitor and check its output.
1601 ovs-appctl -t ovs-ofctl ofctl/barrier
1602 ovs-appctl -t ovs-ofctl exit
1604 ovs-ofctl dump-ports br0
1606 AT_CHECK([sed 's/ (xid=0x[[0-9a-fA-F]]*)//' monitor.log], [0], [dnl
1607 OFPT_PACKET_IN: total_len=14 in_port=ANY (via action) data_len=14 (unbuffered)
1608 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
1609 OFPT_PACKET_IN: total_len=14 in_port=CONTROLLER (via action) data_len=14 (unbuffered)
1610 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 dnl This test checks that OFPT_PACKET_OUT accepts both OFPP_NONE (as
1618 dnl specified by OpenFlow 1.2) and OFPP_CONTROLLER (used by some
1619 dnl controllers despite the spec) as meaning a packet that was generated
1620 dnl by the controller.
1621 AT_SETUP([ofproto - packet-out from controller (OpenFlow 1.2)])
1624 # Start a monitor listening for packet-ins.
1625 AT_CHECK([ovs-ofctl -O OpenFlow12 monitor br0 --detach --no-chdir --pidfile])
1626 ovs-appctl -t ovs-ofctl ofctl/send 0309000c0123456700000080
1627 ovs-appctl -t ovs-ofctl ofctl/barrier
1628 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
1629 AT_CAPTURE_FILE([monitor.log])
1631 # Send some packet-outs with OFPP_NONE and OFPP_CONTROLLER (65533) as in_port.
1632 AT_CHECK([ovs-ofctl -O OpenFlow12 packet-out br0 none controller '0001020304050010203040501234'])
1633 AT_CHECK([ovs-ofctl -O OpenFlow12 packet-out br0 4294967293 controller '0001020304050010203040505678'])
1635 # Stop the monitor and check its output.
1636 ovs-appctl -t ovs-ofctl ofctl/barrier
1637 ovs-appctl -t ovs-ofctl exit
1639 AT_CHECK([sed 's/ (xid=0x[[0-9a-fA-F]]*)//' monitor.log], [0], [dnl
1640 OFPT_PACKET_IN (OF1.2): total_len=14 in_port=ANY (via action) data_len=14 (unbuffered)
1641 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
1642 OFPT_PACKET_IN (OF1.2): total_len=14 in_port=CONTROLLER (via action) data_len=14 (unbuffered)
1643 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
1644 OFPT_BARRIER_REPLY (OF1.2):
1650 dnl This test checks that metadata is encoded in packet_in structures,
1651 dnl supported by NXAST.
1652 AT_SETUP([ofproto - packet-out with metadata (NXM)])
1655 # Start a monitor listening for packet-ins.
1656 AT_CHECK([ovs-ofctl -P nxm monitor br0 --detach --no-chdir --pidfile])
1657 ovs-appctl -t ovs-ofctl ofctl/send 0109000c0123456700000080
1658 ovs-appctl -t ovs-ofctl ofctl/barrier
1659 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
1660 AT_CAPTURE_FILE([monitor.log])
1662 # Send a packet-out with a load action to set some metadata, and forward to controller
1663 AT_CHECK([ovs-ofctl packet-out br0 controller 'load(0xfafafafa5a5a5a5a->OXM_OF_METADATA[[0..63]]), load(0xaa->NXM_NX_PKT_MARK[[]]), controller' '0001020304050010203040501234'])
1665 # Stop the monitor and check its output.
1666 ovs-appctl -t ovs-ofctl ofctl/barrier
1667 ovs-appctl -t ovs-ofctl exit
1669 AT_CHECK([sed 's/ (xid=0x[[0-9a-fA-F]]*)//' monitor.log], [0], [dnl
1670 NXT_PACKET_IN: total_len=14 in_port=CONTROLLER metadata=0xfafafafa5a5a5a5a pkt_mark=0xaa (via action) data_len=14 (unbuffered)
1671 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
1678 dnl This test checks that metadata is encoded in packet_in structures,
1679 dnl supported by NXAST.
1680 AT_SETUP([ofproto - packet-out with 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 a load action to set some metadata, and forward to controller
1691 AT_CHECK([ovs-ofctl -O OpenFlow12 packet-out br0 none 'load(0xfafafafa5a5a5a5a->OXM_OF_METADATA[[0..63]]), 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 metadata=0xfafafafa5a5a5a5a (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 dnl This test checks that tunnel metadata is encoded in packet_in structures.
1707 AT_SETUP([ofproto - packet-out with tunnel metadata (OpenFlow 1.2)])
1710 # Start a monitor listening for packet-ins.
1711 AT_CHECK([ovs-ofctl -O OpenFlow12 monitor br0 --detach --no-chdir --pidfile])
1712 ovs-appctl -t ovs-ofctl ofctl/send 0309000c0123456700000080
1713 ovs-appctl -t ovs-ofctl ofctl/barrier
1714 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
1715 AT_CAPTURE_FILE([monitor.log])
1717 # Send a packet-out with set field actions to set some tunnel metadata, and forward to controller
1718 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'])
1720 # Stop the monitor and check its output.
1721 ovs-appctl -t ovs-ofctl ofctl/barrier
1722 ovs-appctl -t ovs-ofctl exit
1724 AT_CHECK([sed 's/ (xid=0x[[0-9a-fA-F]]*)//' monitor.log], [0], [dnl
1725 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)
1726 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_BARRIER_REPLY (OF1.2):
1733 AT_SETUP([ofproto - flow monitoring])
1734 AT_KEYWORDS([monitor])
1737 ovs-ofctl add-flow br0 in_port=0,dl_vlan=123,actions=output:1
1739 # Start a monitor watching the flow table and check the initial reply.
1740 ovs-ofctl monitor br0 watch: --detach --no-chdir --pidfile >monitor.log 2>&1
1741 AT_CAPTURE_FILE([monitor.log])
1742 ovs-appctl -t ovs-ofctl ofctl/barrier
1743 AT_CHECK([sed 's/ (xid=0x[[1-9a-fA-F]][[0-9a-fA-F]]*)//' monitor.log], [0],
1744 [NXST_FLOW_MONITOR reply:
1745 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=123 actions=output:1
1749 # Add, delete, and modify some flows and check the updates.
1750 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
1751 ovs-ofctl add-flow br0 in_port=0,dl_vlan=124,actions=output:2
1752 ovs-ofctl add-flow br0 in_port=0,dl_vlan=123,actions=output:5
1753 ovs-ofctl add-flow br0 in_port=0,dl_vlan=123,dl_vlan_pcp=0,actions=output:6
1754 ovs-ofctl add-flow br0 in_port=0,dl_vlan=123,dl_vlan_pcp=1,actions=output:7
1755 ovs-ofctl add-flow br0 in_port=0,dl_vlan=123,actions=output:8
1756 ovs-ofctl add-flow br0 in_port=0,dl_vlan=65535,dl_vlan_pcp=0,actions=output:9
1757 ovs-ofctl add-flow br0 in_port=0,dl_vlan=65535,dl_vlan_pcp=1,actions=output:10
1758 ovs-ofctl add-flow br0 in_port=0,dl_vlan=65535,actions=output:11
1759 ovs-ofctl add-flow br0 in_port=0,dl_vlan=8191,dl_vlan_pcp=0,actions=output:12
1760 ovs-ofctl add-flow br0 in_port=0,dl_vlan=8191,dl_vlan_pcp=1,actions=output:13
1761 ovs-ofctl add-flow br0 in_port=0,dl_vlan=8191,actions=output:14
1762 ovs-ofctl add-flow br0 in_port=0,dl_vlan=0,dl_vlan_pcp=0,actions=output:15
1763 ovs-ofctl add-flow br0 in_port=0,dl_vlan=0,dl_vlan_pcp=1,actions=output:16
1764 ovs-ofctl add-flow br0 in_port=0,dl_vlan=0,actions=output:17
1765 ovs-ofctl add-flow br0 in_port=0,dl_vlan=0,dl_vlan_pcp=0,actions=output:18
1766 ovs-ofctl add-flow br0 in_port=0,dl_vlan=0,dl_vlan_pcp=1,actions=output:19
1767 ovs-ofctl add-flow br0 in_port=0,dl_vlan=0,actions=output:20
1768 ovs-ofctl add-flow br0 in_port=0,dl_vlan_pcp=0,actions=output:21
1769 ovs-ofctl add-flow br0 in_port=0,dl_vlan_pcp=1,actions=output:22
1770 ovs-ofctl add-flow br0 in_port=0,actions=output:23
1771 ovs-ofctl mod-flows br0 cookie=5,dl_vlan=123,actions=output:3
1772 ovs-ofctl del-flows br0 dl_vlan=123
1773 ovs-ofctl del-flows br0
1774 ovs-appctl -t ovs-ofctl ofctl/barrier
1776 # Sorts groups of lines that start with a space, without moving them
1777 # past the nearest line that does not start with a space.
1785 print $_ foreach sort(@buffer);
1790 print $_ foreach sort(@buffer);
1792 AT_CHECK([sed 's/ (xid=0x[[1-9a-fA-F]][[0-9a-fA-F]]*)//' monitor.log | ${PERL} -e "$sort"], [0],
1793 [NXST_FLOW_MONITOR reply (xid=0x0):
1794 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=124 actions=output:2
1795 NXST_FLOW_MONITOR reply (xid=0x0):
1796 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=123 actions=output:5
1797 NXST_FLOW_MONITOR reply (xid=0x0):
1798 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=123,dl_vlan_pcp=0 actions=output:6
1799 NXST_FLOW_MONITOR reply (xid=0x0):
1800 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=123,dl_vlan_pcp=1 actions=output:7
1801 NXST_FLOW_MONITOR reply (xid=0x0):
1802 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=123 actions=output:8
1803 NXST_FLOW_MONITOR reply (xid=0x0):
1804 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=0,dl_vlan_pcp=0 actions=output:9
1805 NXST_FLOW_MONITOR reply (xid=0x0):
1806 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=0,dl_vlan_pcp=1 actions=output:10
1807 NXST_FLOW_MONITOR reply (xid=0x0):
1808 event=ADDED table=0 cookie=0 in_port=0,vlan_tci=0x0000 actions=output:11
1809 NXST_FLOW_MONITOR reply (xid=0x0):
1810 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=4095,dl_vlan_pcp=0 actions=output:12
1811 NXST_FLOW_MONITOR reply (xid=0x0):
1812 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=4095,dl_vlan_pcp=1 actions=output:13
1813 NXST_FLOW_MONITOR reply (xid=0x0):
1814 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=4095 actions=output:14
1815 NXST_FLOW_MONITOR reply (xid=0x0):
1816 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=0,dl_vlan_pcp=0 actions=output:15
1817 NXST_FLOW_MONITOR reply (xid=0x0):
1818 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=0,dl_vlan_pcp=1 actions=output:16
1819 NXST_FLOW_MONITOR reply (xid=0x0):
1820 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=0 actions=output:17
1821 NXST_FLOW_MONITOR reply (xid=0x0):
1822 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=0,dl_vlan_pcp=0 actions=output:18
1823 NXST_FLOW_MONITOR reply (xid=0x0):
1824 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=0,dl_vlan_pcp=1 actions=output:19
1825 NXST_FLOW_MONITOR reply (xid=0x0):
1826 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=0 actions=output:20
1827 NXST_FLOW_MONITOR reply (xid=0x0):
1828 event=ADDED table=0 cookie=0 in_port=0,dl_vlan_pcp=0 actions=output:21
1829 NXST_FLOW_MONITOR reply (xid=0x0):
1830 event=ADDED table=0 cookie=0 in_port=0,dl_vlan_pcp=1 actions=output:22
1831 NXST_FLOW_MONITOR reply (xid=0x0):
1832 event=ADDED table=0 cookie=0 in_port=0 actions=output:23
1833 NXST_FLOW_MONITOR reply (xid=0x0):
1834 event=MODIFIED table=0 cookie=0x5 in_port=0,dl_vlan=123 actions=output:3
1835 event=MODIFIED table=0 cookie=0x5 in_port=0,dl_vlan=123,dl_vlan_pcp=0 actions=output:3
1836 event=MODIFIED table=0 cookie=0x5 in_port=0,dl_vlan=123,dl_vlan_pcp=1 actions=output:3
1837 NXST_FLOW_MONITOR reply (xid=0x0):
1838 event=DELETED reason=delete table=0 cookie=0x5 in_port=0,dl_vlan=123 actions=output:3
1839 event=DELETED reason=delete table=0 cookie=0x5 in_port=0,dl_vlan=123,dl_vlan_pcp=0 actions=output:3
1840 event=DELETED reason=delete table=0 cookie=0x5 in_port=0,dl_vlan=123,dl_vlan_pcp=1 actions=output:3
1841 NXST_FLOW_MONITOR reply (xid=0x0):
1842 event=DELETED reason=delete table=0 cookie=0 in_port=0 actions=output:23
1843 event=DELETED reason=delete table=0 cookie=0 in_port=0,dl_vlan=0 actions=output:20
1844 event=DELETED reason=delete table=0 cookie=0 in_port=0,dl_vlan=0,dl_vlan_pcp=0 actions=output:18
1845 event=DELETED reason=delete table=0 cookie=0 in_port=0,dl_vlan=0,dl_vlan_pcp=1 actions=output:19
1846 event=DELETED reason=delete table=0 cookie=0 in_port=0,dl_vlan=124 actions=output:2
1847 event=DELETED reason=delete table=0 cookie=0 in_port=0,dl_vlan=4095 actions=output:14
1848 event=DELETED reason=delete table=0 cookie=0 in_port=0,dl_vlan=4095,dl_vlan_pcp=0 actions=output:12
1849 event=DELETED reason=delete table=0 cookie=0 in_port=0,dl_vlan=4095,dl_vlan_pcp=1 actions=output:13
1850 event=DELETED reason=delete table=0 cookie=0 in_port=0,dl_vlan_pcp=0 actions=output:21
1851 event=DELETED reason=delete table=0 cookie=0 in_port=0,dl_vlan_pcp=1 actions=output:22
1852 event=DELETED reason=delete table=0 cookie=0 in_port=0,vlan_tci=0x0000 actions=output:11
1856 # Check that our own changes are reported as abbreviations.
1857 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
1858 ovs-ofctl add-flow br0 in_port=1,actions=output:2
1859 ovs-ofctl add-flow br0 in_port=2,actions=output:1
1860 ovs-appctl -t ovs-ofctl ofctl/barrier
1861 ovs-appctl -t ovs-ofctl ofctl/send 010e004812345678003fffff00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003000000000000ffffffffffff0000
1862 ovs-appctl -t ovs-ofctl ofctl/barrier
1863 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip], [0], [NXST_FLOW reply:
1865 AT_CHECK([sed 's/ (xid=0x[[1-9a-fA-F]][[0-9a-fA-F]]*)//' monitor.log], [0],
1866 [NXST_FLOW_MONITOR reply (xid=0x0):
1867 event=ADDED table=0 cookie=0 in_port=1 actions=output:2
1868 NXST_FLOW_MONITOR reply (xid=0x0):
1869 event=ADDED table=0 cookie=0 in_port=2 actions=output:1
1871 send: OFPT_FLOW_MOD: DEL priority=0 actions=drop
1872 NXST_FLOW_MONITOR reply (xid=0x0):
1873 event=ABBREV xid=0x12345678
1877 ovs-appctl -t ovs-ofctl exit
1881 AT_SETUP([ofproto - flow monitoring pause and resume])
1882 AT_KEYWORDS([monitor])
1884 # The maximum socket receive buffer size is important for this test, which
1885 # tests behavior when the receive buffer overflows.
1886 if test -e /proc/sys/net/core/rmem_max; then
1888 rmem_max=`cat /proc/sys/net/core/rmem_max`
1889 elif rmem_max=`sysctl -n net.inet.tcp.recvbuf_max 2>/dev/null`; then
1892 # Don't know how to get maximum socket receive buffer on this OS
1895 # Calculate the total amount of queuing: rmem_max in the kernel, 128 kB
1896 # in ofproto sending userspace (see ofmonitor_flush() in connmgr.c).
1897 queue_size=`expr $rmem_max + 128 \* 1024`
1898 echo rmem_max=$rmem_max queue_size=$queue_size
1900 # Each flow update message takes up at least 48 bytes of space in queues
1901 # and in practice more than that.
1902 n_msgs=`expr $queue_size / 48`
1907 # Start a monitor watching the flow table, then make it block.
1908 ON_EXIT([kill `cat ovs-ofctl.pid`])
1909 ovs-ofctl monitor br0 watch: --detach --no-chdir --pidfile >monitor.log 2>&1
1910 AT_CAPTURE_FILE([monitor.log])
1911 ovs-appctl -t ovs-ofctl ofctl/block
1913 # Add $n_msgs flows.
1914 (echo "in_port=2,actions=output:2"
1916 for ($i = 0; $i < '$n_msgs'; $i++) {
1917 print "cookie=1,reg1=$i,actions=drop\n";
1920 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
1921 # Check that multipart flow dumps work properly:
1922 AT_CHECK([ovs-ofctl diff-flows br0 flows.txt])
1923 AT_CHECK([ovs-ofctl add-flow br0 in_port=1,cookie=3,actions=drop])
1924 AT_CHECK([ovs-ofctl mod-flows br0 in_port=2,cookie=2,actions=output:2])
1925 AT_CHECK([ovs-ofctl del-flows br0 cookie=1/-1])
1927 ovs-appctl -t ovs-ofctl ofctl/unblock
1928 ovs-appctl -t ovs-ofctl ofctl/barrier
1930 ovs-appctl -t ovs-ofctl exit
1932 # Check that the flow monitor reported the same number of flows
1933 # added and deleted, but fewer than we actually added and deleted.
1934 adds=`grep -c 'ADDED.*reg1=' monitor.log`
1935 deletes=`grep -c 'DELETED.*reg1=' monitor.log`
1936 echo adds=$adds deletes=$deletes
1937 AT_CHECK([test $adds -gt 100 && test $adds -lt $n_msgs])
1938 AT_CHECK([test $adds = $deletes])
1940 # Check that the flow monitor reported everything in the expected order:
1942 # event=ADDED table=0 cookie=0x1 reg1=0x22
1944 # NXT_FLOW_MONITOR_PAUSED:
1946 # event=DELETED reason=delete table=0 cookie=0x1 reg1=0x22
1948 # event=ADDED table=0 cookie=0x3 in_port=1
1949 # event=MODIFIED table=0 cookie=0x2 in_port=2 actions=output:2
1950 # NXT_FLOW_MONITOR_RESUMED:
1952 # except that, between the PAUSED and RESUMED, the order of the ADDED
1953 # and MODIFIED lines lines depends on hash order, that is, it varies
1954 # as we change the hash function or change architecture. Therefore,
1955 # we use a couple of tests below to accept both orders.
1956 AT_CHECK([ofctl_strip < monitor.log | sed -n -e '
1959 /NXT_FLOW_MONITOR_PAUSED:/p
1960 /NXT_FLOW_MONITOR_RESUMED:/p
1961 ' > monitor.log.subset])
1962 AT_CHECK([grep -v MODIFIED monitor.log.subset], [0], [dnl
1963 event=ADDED table=0 cookie=0x1 reg1=0x22
1964 NXT_FLOW_MONITOR_PAUSED:
1965 event=DELETED reason=delete table=0 cookie=0x1 reg1=0x22
1966 event=ADDED table=0 cookie=0x3 in_port=1
1967 NXT_FLOW_MONITOR_RESUMED:
1969 AT_CHECK([grep -v ADDED monitor.log.subset], [0], [dnl
1970 NXT_FLOW_MONITOR_PAUSED:
1971 event=DELETED reason=delete table=0 cookie=0x1 reg1=0x22
1972 event=MODIFIED table=0 cookie=0x2 in_port=2 actions=output:2
1973 NXT_FLOW_MONITOR_RESUMED:
1979 AT_SETUP([ofproto - event filtering (OpenFlow 1.3)])
1980 AT_KEYWORDS([monitor])
1983 # Start a monitor, use the required protocol version
1984 ovs-ofctl -O OpenFlow13 monitor br0 --detach --no-chdir --pidfile >monitor.log 2>&1
1985 AT_CAPTURE_FILE([monitor.log])
1987 # Send an OpenFlow13 message (04), OFPT_GET_ASYNC_REQUEST (1a), length (8), xid (0a)
1988 ovs-appctl -t ovs-ofctl ofctl/send 041a00080000000a
1989 ovs-appctl -t ovs-ofctl ofctl/barrier
1991 # Check default setting
1992 read -r -d '' expected <<'EOF'
1995 AT_CHECK([ofctl_strip < monitor.log], [], [dnl
1996 send: OFPT_GET_ASYNC_REQUEST (OF1.3):
1997 OFPT_GET_ASYNC_REPLY (OF1.3):
1999 PACKET_IN: no_match action
2000 PORT_STATUS: add delete modify
2001 FLOW_REMOVED: idle hard delete
2005 PORT_STATUS: add delete modify
2007 OFPT_BARRIER_REPLY (OF1.3):