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 AT_SETUP([ofproto - mod-port (OpenFlow 1.0)])
179 for command_config_state in \
181 'noflood NO_FLOOD 0' \
182 'down PORT_DOWN,NO_FLOOD LINK_DOWN' \
183 'flood PORT_DOWN LINK_DOWN' \
184 'no-receive PORT_DOWN,NO_RECV LINK_DOWN' \
185 'no-forward PORT_DOWN,NO_RECV,NO_FWD LINK_DOWN' \
186 'no-packet-in PORT_DOWN,NO_RECV,NO_FWD,NO_PACKET_IN LINK_DOWN' \
187 'forward PORT_DOWN,NO_RECV,NO_PACKET_IN LINK_DOWN' \
188 'packet-in PORT_DOWN,NO_RECV LINK_DOWN' \
192 set $command_config_state
193 command=$[1] config=`echo $[2] | sed 's/,/ /g'` state=$[3]
194 AT_CHECK([ovs-ofctl -vwarn mod-port br0 br0 $command])
195 AT_CHECK([ovs-ofctl -vwarn show br0], [0], [stdout])
196 AT_CHECK_UNQUOTED([STRIP_XIDS stdout], [0], [dnl
197 OFPT_FEATURES_REPLY: dpid:fedcba9876543210
198 n_tables:254, n_buffers:256
199 capabilities: FLOW_STATS TABLE_STATS PORT_STATS QUEUE_STATS ARP_MATCH_IP
200 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
201 LOCAL(br0): addr:aa:55:aa:55:00:00
204 speed: 0 Mbps now, 0 Mbps max
205 OFPT_GET_CONFIG_REPLY: frags=normal miss_send_len=0
211 AT_SETUP([ofproto - mod-port (OpenFlow 1.2)])
213 for command_config_state in \
215 'down PORT_DOWN LINK_DOWN' \
216 'no-receive PORT_DOWN,NO_RECV LINK_DOWN' \
217 'no-forward PORT_DOWN,NO_RECV,NO_FWD LINK_DOWN' \
218 'no-packet-in PORT_DOWN,NO_RECV,NO_FWD,NO_PACKET_IN LINK_DOWN' \
219 'forward PORT_DOWN,NO_RECV,NO_PACKET_IN LINK_DOWN' \
220 'packet-in PORT_DOWN,NO_RECV LINK_DOWN' \
224 set $command_config_state
225 command=$[1] config=`echo $[2] | sed 's/,/ /g'` state=$[3]
226 AT_CHECK([ovs-ofctl -O OpenFlow12 -vwarn mod-port br0 br0 $command])
227 AT_CHECK([ovs-ofctl -O OpenFlow12 -vwarn show br0], [0], [stdout])
228 AT_CHECK_UNQUOTED([STRIP_XIDS stdout], [0], [dnl
229 OFPT_FEATURES_REPLY (OF1.2): dpid:fedcba9876543210
230 n_tables:254, n_buffers:256
231 capabilities: FLOW_STATS TABLE_STATS PORT_STATS QUEUE_STATS
232 LOCAL(br0): addr:aa:55:aa:55:00:00
235 speed: 0 Mbps now, 0 Mbps max
236 OFPT_GET_CONFIG_REPLY (OF1.2): frags=normal miss_send_len=0
242 AT_SETUP([ofproto - basic flow_mod commands (NXM)])
244 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip], [0], [NXST_FLOW reply:
246 AT_CHECK([echo 'in_port=2,actions=1' | ovs-ofctl add-flows br0 -])
247 AT_CHECK([ovs-ofctl add-flow br0 in_port=1,actions=2])
248 AT_CHECK([ovs-ofctl -F nxm add-flow br0 table=1,in_port=4,actions=3])
249 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
250 in_port=1 actions=output:2
251 in_port=2 actions=output:1
252 table=1, in_port=4 actions=output:3
255 AT_CHECK([ovs-ofctl dump-aggregate br0 table=0 | STRIP_XIDS], [0], [dnl
256 NXST_AGGREGATE reply: packet_count=0 byte_count=0 flow_count=2
258 AT_CHECK([ovs-ofctl del-flows br0])
259 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip], [0], [NXST_FLOW reply:
264 AT_SETUP([ofproto - basic flow_mod commands (OpenFlow 1.0)])
266 AT_CHECK([ovs-ofctl -F openflow10 dump-flows br0 | ofctl_strip], [0], [OFPST_FLOW reply:
268 AT_CHECK([echo 'in_port=2,actions=1' | ovs-ofctl -F openflow10 add-flows br0 -])
269 AT_CHECK([ovs-ofctl -F openflow10 add-flow br0 in_port=1,actions=2])
270 AT_CHECK([ovs-ofctl -F openflow10 add-flow br0 table=1,in_port=4,actions=3])
271 AT_CHECK([ovs-ofctl -F openflow10 dump-flows br0 | ofctl_strip | sort], [0], [dnl
272 in_port=1 actions=output:2
273 in_port=2 actions=output:1
274 table=1, in_port=4 actions=output:3
277 AT_CHECK([ovs-ofctl -F openflow10 dump-aggregate br0 table=0 | STRIP_XIDS], [0], [dnl
278 OFPST_AGGREGATE reply: packet_count=0 byte_count=0 flow_count=2
280 AT_CHECK([ovs-ofctl -F openflow10 del-flows br0])
281 AT_CHECK([ovs-ofctl -F openflow10 dump-flows br0 | ofctl_strip], [0], [OFPST_FLOW reply:
286 AT_SETUP([ofproto - basic flow_mod commands (OpenFlow 1.1)])
288 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip], [0], [OFPST_FLOW reply (OF1.1):
290 AT_CHECK([echo 'in_port=2,actions=1' | ovs-ofctl -O OpenFlow11 add-flows br0 -])
291 AT_CHECK([ovs-ofctl -O OpenFlow11 add-flow br0 in_port=1,actions=2])
292 AT_CHECK([ovs-ofctl -O OpenFlow11 add-flow br0 table=1,in_port=4,actions=3])
293 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0], [dnl
294 in_port=1 actions=output:2
295 in_port=2 actions=output:1
296 table=1, in_port=4 actions=output:3
297 OFPST_FLOW reply (OF1.1):
299 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-aggregate br0 table=0 | STRIP_XIDS], [0], [dnl
300 OFPST_AGGREGATE reply (OF1.1): packet_count=0 byte_count=0 flow_count=2
302 AT_CHECK([ovs-ofctl -O OpenFlow11 del-flows br0])
303 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip], [0], [OFPST_FLOW reply (OF1.1):
308 AT_SETUP([ofproto - flow_mod negative test (OpenFlow 1.1)])
310 [set bridge br0 protocols=OpenFlow10,OpenFlow11,OpenFlow12,OpenFlow13])
311 AT_CHECK([ovs-ofctl add-flow -O OpenFlow11 br0 table=1,action=goto_table:2])
312 AT_CHECK([ovs-ofctl add-flow -O OpenFlow11 br0 table=1,action=goto_table:1],
315 # The output should look like this:
317 # OFPT_ERROR (OF1.1) (xid=0x2): OFPBRC_BAD_TABLE_ID
318 # OFPT_FLOW_MOD (OF1.1) (xid=0x2):
319 # (***truncated to 64 bytes from 160***)
320 # 00000000 02 0e 00 a0 00 00 00 02-00 00 00 00 00 00 00 00 |................|
321 # 00000010 00 00 00 00 00 00 00 00-01 00 00 00 00 00 80 00 |................|
322 # 00000020 ff ff ff ff ff ff ff ff-ff ff ff ff 00 00 00 00 |................|
323 # 00000030 00 00 00 58 00 00 00 00-00 00 03 ff 00 00 00 00 |...X............|
325 # This 'sed' command captures the error message but drops details.
326 AT_CHECK([sed '/truncated/d
327 /^000000.0/d' stderr | STRIP_XIDS], [0],
328 [OFPT_ERROR (OF1.1): OFPBRC_BAD_TABLE_ID
329 OFPT_FLOW_MOD (OF1.1):
334 AT_SETUP([ofproto - set-field flow_mod commands (NXM)])
336 AT_CHECK([ovs-ofctl add-flow br0 ipv6,table=1,in_port=3,actions=drop])
337 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])
338 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
339 table=1, ipv6,in_port=3 actions=load:0xa6badbfffefe59fa->NXM_NX_IPV6_SRC[[0..63]],load:0xfe8001234567890a->NXM_NX_IPV6_SRC[[64..127]]
345 AT_SETUP([ofproto - basic flow_mod commands (OpenFlow 1.2)])
347 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip], [0], [OFPST_FLOW reply (OF1.2):
349 AT_CHECK([echo 'in_port=2,actions=1' | ovs-ofctl -O OpenFlow12 add-flows br0 -])
350 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 in_port=1,actions=2])
351 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 table=1,in_port=4,actions=3])
352 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
353 in_port=1 actions=output:2
354 in_port=2 actions=output:1
355 table=1, in_port=4 actions=output:3
356 OFPST_FLOW reply (OF1.2):
358 AT_CHECK([ovs-ofctl -O OpenFlow12 del-flows br0])
359 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip], [0], [OFPST_FLOW reply (OF1.2):
364 AT_SETUP([ofproto - dump flows with cookie])
366 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x1,in_port=1,actions=1])
367 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x2,in_port=2,actions=1])
368 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x3,in_port=3,actions=1])
369 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
370 cookie=0x1, in_port=1 actions=output:1
371 cookie=0x2, in_port=2 actions=output:1
372 cookie=0x3, in_port=3 actions=output:1
375 AT_CHECK([ovs-ofctl dump-aggregate br0 table=0 | STRIP_XIDS], [0], [dnl
376 NXST_AGGREGATE reply: packet_count=0 byte_count=0 flow_count=3
378 AT_CHECK([ovs-ofctl dump-flows br0 cookie=0x3/-1 | ofctl_strip | sort], [0], [dnl
379 cookie=0x3, in_port=3 actions=output:1
382 AT_CHECK([ovs-ofctl dump-aggregate br0 cookie=0x3/-1 | STRIP_XIDS], [0], [dnl
383 NXST_AGGREGATE reply: packet_count=0 byte_count=0 flow_count=1
388 AT_SETUP([ofproto - mod flow with cookie change (OpenFlow 1.0)])
390 AT_CHECK([ovs-ofctl -F openflow10 add-flow br0 cookie=0x1,in_port=1,actions=1])
391 AT_CHECK([ovs-ofctl -F openflow10 dump-flows br0 | ofctl_strip | sort], [0], [dnl
392 cookie=0x1, in_port=1 actions=output:1
396 AT_CHECK([ovs-ofctl -F openflow10 mod-flows br0 cookie=0x2,in_port=1,actions=1])
397 AT_CHECK([ovs-ofctl -F openflow10 dump-flows br0 | ofctl_strip | sort], [0], [dnl
398 cookie=0x2, in_port=1 actions=output:1
404 AT_SETUP([ofproto - mod flow with cookie change (NXM)])
406 AT_CHECK([ovs-ofctl -F nxm add-flow br0 cookie=0x1,in_port=1,actions=1])
407 AT_CHECK([ovs-ofctl -F nxm dump-flows br0 | ofctl_strip | sort], [0], [dnl
408 cookie=0x1, in_port=1 actions=output:1
412 AT_CHECK([ovs-ofctl -F nxm mod-flows br0 cookie=0x2,in_port=1,actions=1])
413 AT_CHECK([ovs-ofctl -F nxm dump-flows br0 | ofctl_strip | sort], [0], [dnl
414 cookie=0x2, in_port=1 actions=output:1
420 AT_SETUP([ofproto - no mod flow with cookie change (OpenFlow 1.1)])
422 AT_CHECK([ovs-ofctl -O OpenFlow11 add-flow br0 cookie=0x1,in_port=1,actions=1])
423 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0], [dnl
424 cookie=0x1, in_port=1 actions=output:1
425 OFPST_FLOW reply (OF1.1):
427 AT_CHECK([ovs-ofctl -O OpenFlow11 mod-flows br0 cookie=0x2,in_port=1,actions=1])
428 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0], [dnl
429 cookie=0x1, in_port=1 actions=output:1
430 OFPST_FLOW reply (OF1.1):
435 dnl The OpenFlow 1.2 spec states that the cookie may not be modified
436 AT_SETUP([ofproto - no mod flow with cookie change (OpenFlow 1.2)])
438 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 cookie=0x1,in_port=1,actions=1])
439 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
440 cookie=0x1, in_port=1 actions=output:1
441 OFPST_FLOW reply (OF1.2):
444 AT_CHECK([ovs-ofctl -O OpenFlow12 mod-flows br0 cookie=0x2,in_port=1,actions=1])
445 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
446 cookie=0x1, in_port=1 actions=output:1
447 OFPST_FLOW reply (OF1.2):
452 AT_SETUP([ofproto - mod flows based on cookie mask (OpenFlow 1.0)])
454 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x1,in_port=1,actions=1])
455 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x1,in_port=2,actions=1])
456 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x2,in_port=3,actions=1])
457 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
458 cookie=0x1, in_port=1 actions=output:1
459 cookie=0x1, in_port=2 actions=output:1
460 cookie=0x2, in_port=3 actions=output:1
464 AT_CHECK([ovs-ofctl -F nxm mod-flows br0 cookie=0x1/0xff,actions=4])
465 AT_CHECK([ovs-ofctl -F nxm dump-flows br0 | ofctl_strip | sort], [0], [dnl
466 cookie=0x1, in_port=1 actions=output:4
467 cookie=0x1, in_port=2 actions=output:4
468 cookie=0x2, in_port=3 actions=output:1
474 AT_SETUP([ofproto - mod flows based on cookie mask (OpenFlow 1.1)])
476 AT_CHECK([ovs-ofctl -O OpenFlow11 add-flow br0 cookie=0x1,in_port=1,actions=1])
477 AT_CHECK([ovs-ofctl -O OpenFlow11 add-flow br0 cookie=0x1,in_port=2,actions=1])
478 AT_CHECK([ovs-ofctl -O OpenFlow11 add-flow br0 cookie=0x2,in_port=3,actions=1])
479 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0], [dnl
480 cookie=0x1, in_port=1 actions=output:1
481 cookie=0x1, in_port=2 actions=output:1
482 cookie=0x2, in_port=3 actions=output:1
483 OFPST_FLOW reply (OF1.1):
486 AT_CHECK([ovs-ofctl -O OpenFlow11 mod-flows br0 cookie=0x1/0xff,actions=4])
487 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0], [dnl
488 cookie=0x1, in_port=1 actions=output:4
489 cookie=0x1, in_port=2 actions=output:4
490 cookie=0x2, in_port=3 actions=output:1
491 OFPST_FLOW reply (OF1.1):
496 AT_SETUP([ofproto - mod flows based on cookie mask (OpenFlow 1.2)])
498 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 cookie=0x1,in_port=1,actions=1])
499 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 cookie=0x1,in_port=2,actions=1])
500 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 cookie=0x2,in_port=3,actions=1])
501 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
502 cookie=0x1, in_port=1 actions=output:1
503 cookie=0x1, in_port=2 actions=output:1
504 cookie=0x2, in_port=3 actions=output:1
505 OFPST_FLOW reply (OF1.2):
508 AT_CHECK([ovs-ofctl -O OpenFlow12 mod-flows br0 cookie=0x1/0xff,actions=4])
509 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
510 cookie=0x1, in_port=1 actions=output:4
511 cookie=0x1, in_port=2 actions=output:4
512 cookie=0x2, in_port=3 actions=output:1
513 OFPST_FLOW reply (OF1.2):
518 dnl The OpenFlow 1.2 spec states that the cookie may not be modified
519 AT_SETUP([ofproto - mod flows based on cookie mask with cookie change])
521 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x1,in_port=1,actions=1])
522 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x1,in_port=2,actions=1])
523 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x2,in_port=3,actions=1])
524 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
525 cookie=0x1, in_port=1 actions=output:1
526 cookie=0x1, in_port=2 actions=output:1
527 cookie=0x2, in_port=3 actions=output:1
531 AT_CHECK([ovs-ofctl -F nxm mod-flows br0 cookie=1/-1,cookie=4,actions=4])
532 AT_CHECK([ovs-ofctl -F nxm dump-flows br0 | ofctl_strip | sort], [0], [dnl
533 cookie=0x2, in_port=3 actions=output:1
534 cookie=0x4, in_port=1 actions=output:4
535 cookie=0x4, in_port=2 actions=output:4
541 AT_SETUP([ofproto - mod flow with cookie miss (mask==0) - NXM])
543 AT_CHECK([ovs-ofctl -F nxm mod-flows br0 in_port=1,actions=1])
544 AT_CHECK([ovs-ofctl -F nxm dump-flows br0 | ofctl_strip | sort], [0], [dnl
545 in_port=1 actions=output:1
551 AT_SETUP([ofproto - mod flow with cookie miss (mask==0) - OF1.1])
553 AT_CHECK([ovs-ofctl -O openflow11 mod-flows br0 in_port=1,actions=1])
554 AT_CHECK([ovs-ofctl -O openflow11 dump-flows br0 | ofctl_strip | sort], [0], [dnl
555 in_port=1 actions=output:1
556 OFPST_FLOW reply (OF1.1):
561 AT_SETUP([ofproto - mod flow with cookie miss (mask==0) - OF1.2])
563 AT_CHECK([ovs-ofctl -O openflow12 mod-flows br0 in_port=1,actions=1])
564 AT_CHECK([ovs-ofctl -O openflow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
565 OFPST_FLOW reply (OF1.2):
570 AT_SETUP([ofproto - mod flow with cookie miss (mask!=0) - NXM])
572 AT_CHECK([ovs-ofctl -F nxm mod-flows br0 cookie=1/1,in_port=1,actions=1])
573 AT_CHECK([ovs-ofctl -F nxm dump-flows br0 | ofctl_strip | sort], [0], [dnl
579 AT_SETUP([ofproto - mod flow with cookie miss (mask!=0) - OF1.1])
581 AT_CHECK([ovs-ofctl -O openflow11 mod-flows br0 cookie=1/1,in_port=1,actions=1])
582 AT_CHECK([ovs-ofctl -O openflow11 dump-flows br0 | ofctl_strip | sort], [0], [dnl
583 OFPST_FLOW reply (OF1.1):
588 AT_SETUP([ofproto - mod flow with cookie miss (mask!=0) - OF1.2])
590 AT_CHECK([ovs-ofctl -O openflow12 mod-flows br0 cookie=1/1,in_port=1,actions=1])
591 AT_CHECK([ovs-ofctl -O openflow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
592 OFPST_FLOW reply (OF1.2):
597 AT_SETUP([ofproto - del flows with cookies])
599 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x1,in_port=1,actions=1])
600 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x2,in_port=2,actions=1])
601 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x3,in_port=3,actions=1])
602 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
603 cookie=0x1, in_port=1 actions=output:1
604 cookie=0x2, in_port=2 actions=output:1
605 cookie=0x3, in_port=3 actions=output:1
609 AT_CHECK([ovs-ofctl del-flows br0])
610 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
616 AT_SETUP([ofproto - del flows based on cookie])
618 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x1,in_port=1,actions=1])
619 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x2,in_port=2,actions=1])
620 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x3,in_port=3,actions=1])
621 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
622 cookie=0x1, in_port=1 actions=output:1
623 cookie=0x2, in_port=2 actions=output:1
624 cookie=0x3, in_port=3 actions=output:1
628 AT_CHECK([ovs-ofctl del-flows br0 cookie=0x3/-1])
629 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
630 cookie=0x1, in_port=1 actions=output:1
631 cookie=0x2, in_port=2 actions=output:1
637 AT_SETUP([ofproto - del flows based on cookie mask])
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
648 AT_CHECK([ovs-ofctl del-flows br0 cookie=0x3/0x1])
649 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
650 cookie=0x2, in_port=2 actions=output:1
656 AT_SETUP([ofproto - del flows based on table id (NXM)])
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,table=1,actions=1])
660 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
661 cookie=0x1, in_port=1 actions=output:1
662 cookie=0x2, table=1, in_port=2 actions=output:1
665 AT_CHECK([ovs-ofctl del-flows br0 table=0])
666 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
667 cookie=0x2, table=1, in_port=2 actions=output:1
670 AT_CHECK([ovs-ofctl del-flows br0 table=1])
671 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
674 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x1,in_port=1,actions=1])
675 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x2,in_port=2,table=1,actions=1])
676 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
677 cookie=0x1, in_port=1 actions=output:1
678 cookie=0x2, table=1, in_port=2 actions=output:1
681 AT_CHECK([ovs-ofctl del-flows br0])
682 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
688 AT_SETUP([ofproto - del flows based on table id (OpenFlow 1.1)])
690 AT_CHECK([ovs-ofctl -O OpenFlow11 add-flow br0 cookie=0x1,in_port=1,actions=1])
691 AT_CHECK([ovs-ofctl -O OpenFlow11 add-flow br0 cookie=0x2,in_port=2,table=1,actions=1])
692 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0], [dnl
693 cookie=0x1, in_port=1 actions=output:1
694 cookie=0x2, table=1, in_port=2 actions=output:1
695 OFPST_FLOW reply (OF1.1):
697 AT_CHECK([ovs-ofctl -O OpenFlow11 del-flows br0 table=0])
698 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0], [dnl
699 cookie=0x2, table=1, in_port=2 actions=output:1
700 OFPST_FLOW reply (OF1.1):
702 AT_CHECK([ovs-ofctl -O OpenFlow11 del-flows br0 table=1])
703 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0], [dnl
704 OFPST_FLOW reply (OF1.1):
706 AT_CHECK([ovs-ofctl -O OpenFlow11 add-flow br0 cookie=0x1,in_port=1,actions=1])
707 AT_CHECK([ovs-ofctl -O OpenFlow11 add-flow br0 cookie=0x2,in_port=2,table=1,actions=1])
708 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0], [dnl
709 cookie=0x1, in_port=1 actions=output:1
710 cookie=0x2, table=1, in_port=2 actions=output:1
711 OFPST_FLOW reply (OF1.1):
713 AT_CHECK([ovs-ofctl -O OpenFlow11 del-flows br0])
714 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0], [dnl
715 OFPST_FLOW reply (OF1.1):
720 AT_SETUP([ofproto - del flows based on table id (OpenFlow 1.2)])
722 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 cookie=0x1,in_port=1,actions=1])
723 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 cookie=0x2,in_port=2,table=1,actions=1])
724 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
725 cookie=0x1, in_port=1 actions=output:1
726 cookie=0x2, table=1, in_port=2 actions=output:1
727 OFPST_FLOW reply (OF1.2):
729 AT_CHECK([ovs-ofctl -O OpenFlow12 del-flows br0 table=0])
730 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
731 cookie=0x2, table=1, in_port=2 actions=output:1
732 OFPST_FLOW reply (OF1.2):
734 AT_CHECK([ovs-ofctl -O OpenFlow12 del-flows br0 table=1])
735 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
736 OFPST_FLOW reply (OF1.2):
738 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 cookie=0x1,in_port=1,actions=1])
739 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 cookie=0x2,in_port=2,table=1,actions=1])
740 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
741 cookie=0x1, in_port=1 actions=output:1
742 cookie=0x2, table=1, in_port=2 actions=output:1
743 OFPST_FLOW reply (OF1.2):
745 AT_CHECK([ovs-ofctl -O OpenFlow12 del-flows br0])
746 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
747 OFPST_FLOW reply (OF1.2):
752 AT_SETUP([ofproto - flow table configuration (OpenFlow 1.0)])
754 # Check the default configuration.
755 (echo "OFPST_TABLE reply (xid=0x2): 254 tables
756 0: classifier: wild=0x3fffff, max=1000000, active=0
759 while test $x -lt 254; do
760 printf " %d: %-8s: wild=0x3fffff, max=1000000, active=0
765 AT_CHECK([ovs-ofctl dump-tables br0], [0], [expout])
766 # Change the configuration.
769 -- --id=@t0 create Flow_Table name=main \
770 -- --id=@t1 create Flow_Table flow-limit=1024 \
771 -- set bridge br0 'flow_tables={1=@t1,0=@t0}' \
772 | ${PERL} $srcdir/uuidfilt.pl],
776 # Check that the configuration was updated.
777 mv expout orig-expout
778 (echo "OFPST_TABLE reply (xid=0x2): 254 tables
779 0: main : wild=0x3fffff, max=1000000, active=0
781 1: table1 : wild=0x3fffff, max= 1024, active=0
783 tail -n +6 orig-expout) > expout
784 AT_CHECK([ovs-ofctl dump-tables br0], [0], [expout])
788 AT_SETUP([ofproto - flow table configuration (OpenFlow 1.2)])
790 # Check the default configuration.
791 (mid="wild=0xfffffffff, max=1000000,"
794 match=0xfffffffff, instructions=0x00000007, config=0x00000003
795 write_actions=0x00000000, apply_actions=0x00000000
796 write_setfields=0x0000000fffffffff
797 apply_setfields=0x0000000fffffffff
798 metadata_match=0xffffffffffffffff
799 metadata_write=0xffffffffffffffff"
800 echo "OFPST_TABLE reply (OF1.2) (xid=0x2): 254 tables
801 0: classifier: $mid active=0$tail"
803 while test $x -lt 254; do
804 printf " %d: %-8s: $mid active=0$tail
808 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-tables br0], [0], [expout])
809 # Change the configuration.
812 -- --id=@t0 create Flow_Table name=main \
813 -- --id=@t1 create Flow_Table flow-limit=1024 \
814 -- set bridge br0 'flow_tables={1=@t1,0=@t0}' \
815 | ${PERL} $srcdir/uuidfilt.pl],
819 # Check that the configuration was updated.
820 mv expout orig-expout
821 (echo "OFPST_TABLE reply (OF1.2) (xid=0x2): 254 tables
822 0: main : wild=0xfffffffff, max=1000000, active=0"
823 tail -n +3 orig-expout | head -7
824 echo " 1: table1 : wild=0xfffffffff, max= 1024, active=0"
825 tail -n +11 orig-expout) > expout
826 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-tables br0], [0], [expout])
830 AT_SETUP([ofproto - hard limits on flow table size (OpenFLow 1.0)])
832 # Configure a maximum of 4 flows.
835 -- --id=@t0 create Flow_Table flow-limit=4 \
836 -- set bridge br0 flow_tables:0=@t0 \
837 | ${PERL} $srcdir/uuidfilt.pl],
841 for in_port in 1 2 3 4; do
842 ovs-ofctl add-flow br0 in_port=$in_port,actions=drop
844 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
845 in_port=1 actions=drop
846 in_port=2 actions=drop
847 in_port=3 actions=drop
848 in_port=4 actions=drop
851 # Adding another flow will be refused.
852 AT_CHECK([ovs-ofctl add-flow br0 in_port=5,actions=drop], [1], [], [stderr])
853 AT_CHECK([head -n 1 stderr | ofctl_strip], [0],
854 [OFPT_ERROR: OFPFMFC_TABLE_FULL
856 # Also a mod-flow that would add a flow will be refused.
857 AT_CHECK([ovs-ofctl mod-flows br0 in_port=5,actions=drop], [1], [], [stderr])
858 AT_CHECK([head -n 1 stderr | ofctl_strip], [0],
859 [OFPT_ERROR: OFPFMFC_TABLE_FULL
861 # Replacing or modifying an existing flow is allowed.
862 AT_CHECK([ovs-ofctl add-flow br0 in_port=4,actions=normal])
863 AT_CHECK([ovs-ofctl mod-flows br0 in_port=3,actions=output:1])
864 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
865 in_port=1 actions=drop
866 in_port=2 actions=drop
867 in_port=3 actions=output:1
868 in_port=4 actions=NORMAL
874 AT_SETUP([ofproto - hard limits on flow table size (OpenFLow 1.2)])
876 # Configure a maximum of 4 flows.
879 -- --id=@t0 create Flow_Table flow-limit=4 \
880 -- set bridge br0 flow_tables:0=@t0 \
881 | ${PERL} $srcdir/uuidfilt.pl],
885 for in_port in 1 2 3 4; do
886 ovs-ofctl -O OpenFlow12 add-flow br0 in_port=$in_port,actions=drop
888 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
889 in_port=1 actions=drop
890 in_port=2 actions=drop
891 in_port=3 actions=drop
892 in_port=4 actions=drop
893 OFPST_FLOW reply (OF1.2):
895 # Adding another flow will be refused.
896 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 in_port=5,actions=drop], [1], [], [stderr])
897 AT_CHECK([head -n 1 stderr | ofctl_strip], [0],
898 [OFPT_ERROR (OF1.2): OFPFMFC_TABLE_FULL
900 # Replacing or modifying an existing flow is allowed.
901 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 in_port=4,actions=normal])
902 AT_CHECK([ovs-ofctl -O OpenFlow12 mod-flows br0 in_port=3,actions=output:1])
903 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
904 in_port=1 actions=drop
905 in_port=2 actions=drop
906 in_port=3 actions=output:1
907 in_port=4 actions=NORMAL
908 OFPST_FLOW reply (OF1.2):
913 AT_SETUP([ofproto - eviction upon table overflow (OpenFlow 1.0)])
915 # Configure a maximum of 4 flows.
918 -- --id=@t0 create Flow_Table flow-limit=4 overflow-policy=evict \
919 -- set bridge br0 flow_tables:0=@t0 \
920 | ${PERL} $srcdir/uuidfilt.pl],
924 for in_port in 4 3 2 1; do
925 ovs-ofctl add-flow br0 idle_timeout=${in_port}0,in_port=$in_port,actions=drop
927 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
928 idle_timeout=10, in_port=1 actions=drop
929 idle_timeout=20, in_port=2 actions=drop
930 idle_timeout=30, in_port=3 actions=drop
931 idle_timeout=40, in_port=4 actions=drop
934 # Adding another flow will cause the one that expires soonest to be evicted.
935 AT_CHECK([ovs-ofctl add-flow br0 in_port=5,actions=drop])
936 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
937 idle_timeout=20, in_port=2 actions=drop
938 idle_timeout=30, in_port=3 actions=drop
939 idle_timeout=40, in_port=4 actions=drop
940 in_port=5 actions=drop
943 # A mod-flow that adds a flow also causes eviction, but replacing or
944 # modifying an existing flow doesn't.
945 AT_CHECK([ovs-ofctl mod-flows br0 in_port=6,actions=drop])
946 AT_CHECK([ovs-ofctl add-flow br0 in_port=4,actions=normal])
947 AT_CHECK([ovs-ofctl mod-flows br0 in_port=3,actions=output:1])
948 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
949 idle_timeout=30, in_port=3 actions=output:1
950 in_port=4 actions=NORMAL
951 in_port=5 actions=drop
952 in_port=6 actions=drop
955 # Flows with no timeouts at all cannot be evicted.
956 AT_CHECK([ovs-ofctl add-flow br0 in_port=7,actions=normal])
957 AT_CHECK([ovs-ofctl add-flow br0 in_port=8,actions=drop], [1], [], [stderr])
958 AT_CHECK([head -n 1 stderr | ofctl_strip], [0],
959 [OFPT_ERROR: OFPFMFC_TABLE_FULL
961 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
962 in_port=4 actions=NORMAL
963 in_port=5 actions=drop
964 in_port=6 actions=drop
965 in_port=7 actions=NORMAL
971 AT_SETUP([ofproto - eviction upon table overflow (OpenFlow 1.2)])
973 # Configure a maximum of 4 flows.
976 -- --id=@t0 create Flow_Table flow-limit=4 overflow-policy=evict \
977 -- set bridge br0 flow_tables:0=@t0 \
978 | ${PERL} $srcdir/uuidfilt.pl],
982 for in_port in 4 3 2 1; do
983 ovs-ofctl -O OpenFlow12 add-flow br0 idle_timeout=${in_port}0,in_port=$in_port,actions=drop
985 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
986 idle_timeout=10, in_port=1 actions=drop
987 idle_timeout=20, in_port=2 actions=drop
988 idle_timeout=30, in_port=3 actions=drop
989 idle_timeout=40, in_port=4 actions=drop
990 OFPST_FLOW reply (OF1.2):
992 # Adding another flow will cause the one that expires soonest to be evicted.
993 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 in_port=5,actions=drop])
994 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
995 idle_timeout=20, in_port=2 actions=drop
996 idle_timeout=30, in_port=3 actions=drop
997 idle_timeout=40, in_port=4 actions=drop
998 in_port=5 actions=drop
999 OFPST_FLOW reply (OF1.2):
1001 # In Open Flow 1.2 a mod-flow does not ever add a flow and thus
1002 # has no effect on eviction
1003 AT_CHECK([ovs-ofctl -O OpenFlow12 mod-flows br0 in_port=6,actions=drop])
1004 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 in_port=4,actions=normal])
1005 AT_CHECK([ovs-ofctl -O OpenFlow12 mod-flows br0 in_port=3,actions=output:1])
1006 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1007 idle_timeout=20, in_port=2 actions=drop
1008 idle_timeout=30, in_port=3 actions=output:1
1009 in_port=4 actions=NORMAL
1010 in_port=5 actions=drop
1011 OFPST_FLOW reply (OF1.2):
1013 # Flows with no timeouts at all cannot be evicted.
1014 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 in_port=6,actions=drop])
1015 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 in_port=7,actions=normal])
1016 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 in_port=8,actions=drop], [1], [], [stderr])
1017 AT_CHECK([head -n 1 stderr | ofctl_strip], [0],
1018 [OFPT_ERROR (OF1.2): OFPFMFC_TABLE_FULL
1020 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1021 in_port=4 actions=NORMAL
1022 in_port=5 actions=drop
1023 in_port=6 actions=drop
1024 in_port=7 actions=NORMAL
1025 OFPST_FLOW reply (OF1.2):
1030 AT_SETUP([ofproto - eviction upon table overflow, with fairness (OpenFlow 1.0)])
1032 # Configure a maximum of 4 flows.
1035 -- --id=@t0 create Flow_Table name=evict flow-limit=4 \
1036 overflow-policy=evict \
1037 groups='"NXM_OF_IN_PORT[[]]"' \
1038 -- set bridge br0 flow_tables:0=@t0 \
1039 | ${PERL} $srcdir/uuidfilt.pl],
1043 ovs-ofctl add-flows br0 - <<EOF
1044 idle_timeout=10 in_port=2 dl_src=00:44:55:66:77:88 actions=drop
1045 idle_timeout=20 in_port=1 dl_src=00:11:22:33:44:55 actions=drop
1046 idle_timeout=30 in_port=1 dl_src=00:22:33:44:55:66 actions=drop
1047 idle_timeout=40 in_port=1 dl_src=00:33:44:55:66:77 actions=drop
1049 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1050 idle_timeout=10, in_port=2,dl_src=00:44:55:66:77:88 actions=drop
1051 idle_timeout=20, in_port=1,dl_src=00:11:22:33:44:55 actions=drop
1052 idle_timeout=30, in_port=1,dl_src=00:22:33:44:55:66 actions=drop
1053 idle_timeout=40, in_port=1,dl_src=00:33:44:55:66:77 actions=drop
1056 # Adding another flow will cause the one that expires soonest within
1057 # the largest group (those with in_port=1) to be evicted. In this
1058 # case this is not the same as the one that expires soonest overall
1059 # (which is what makes the test interesting):
1060 AT_CHECK([ovs-ofctl add-flow br0 in_port=2,dl_src=00:55:66:77:88:99,actions=drop])
1061 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1062 idle_timeout=10, in_port=2,dl_src=00:44:55:66:77:88 actions=drop
1063 idle_timeout=30, in_port=1,dl_src=00:22:33:44:55:66 actions=drop
1064 idle_timeout=40, in_port=1,dl_src=00:33:44:55:66:77 actions=drop
1065 in_port=2,dl_src=00:55:66:77:88:99 actions=drop
1068 # Enlarge the flow limit, change the eviction policy back to strictly
1069 # based on expiration, and and add some flows.
1070 AT_CHECK([ovs-vsctl set Flow_Table evict groups='[[]]' flow-limit=7])
1071 ovs-ofctl add-flows br0 - <<EOF
1072 idle_timeout=50 in_port=2 dl_src=00:66:77:88:99:aa actions=drop
1073 idle_timeout=60 in_port=2 dl_src=00:77:88:99:aa:bb actions=drop
1074 idle_timeout=70 in_port=2 dl_src=00:88:99:aa:bb:cc actions=drop
1076 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1077 idle_timeout=10, in_port=2,dl_src=00:44:55:66:77:88 actions=drop
1078 idle_timeout=30, in_port=1,dl_src=00:22:33:44:55:66 actions=drop
1079 idle_timeout=40, in_port=1,dl_src=00:33:44:55:66:77 actions=drop
1080 idle_timeout=50, in_port=2,dl_src=00:66:77:88:99:aa actions=drop
1081 idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=drop
1082 idle_timeout=70, in_port=2,dl_src=00:88:99:aa:bb:cc actions=drop
1083 in_port=2,dl_src=00:55:66:77:88:99 actions=drop
1086 # Adding another flow will cause the one that expires soonest overall
1088 AT_CHECK([ovs-ofctl add-flow br0 'idle_timeout=80 in_port=2 dl_src=00:99:aa:bb:cc:dd actions=drop'])
1089 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1090 idle_timeout=30, in_port=1,dl_src=00:22:33:44:55:66 actions=drop
1091 idle_timeout=40, in_port=1,dl_src=00:33:44:55:66:77 actions=drop
1092 idle_timeout=50, in_port=2,dl_src=00:66:77:88:99:aa actions=drop
1093 idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=drop
1094 idle_timeout=70, in_port=2,dl_src=00:88:99:aa:bb:cc actions=drop
1095 idle_timeout=80, in_port=2,dl_src=00:99:aa:bb:cc:dd actions=drop
1096 in_port=2,dl_src=00:55:66:77:88:99 actions=drop
1099 # Reducing the flow limit also causes the flows that expire soonest
1100 # overall to be evicted.
1101 AT_CHECK([ovs-vsctl set Flow_Table evict flow-limit=4])
1102 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1103 idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=drop
1104 idle_timeout=70, in_port=2,dl_src=00:88:99:aa:bb:cc actions=drop
1105 idle_timeout=80, in_port=2,dl_src=00:99:aa:bb:cc:dd actions=drop
1106 in_port=2,dl_src=00:55:66:77:88:99 actions=drop
1112 AT_SETUP([ofproto - eviction upon table overflow, with fairness (OpenFlow 1.2)])
1114 # Configure a maximum of 4 flows.
1117 -- --id=@t0 create Flow_Table name=evict flow-limit=4 \
1118 overflow-policy=evict \
1119 groups='"NXM_OF_IN_PORT[[]]"' \
1120 -- set bridge br0 flow_tables:0=@t0 \
1121 | ${PERL} $srcdir/uuidfilt.pl],
1125 ovs-ofctl -O OpenFlow12 add-flows br0 - <<EOF
1126 idle_timeout=10 in_port=2 dl_src=00:44:55:66:77:88 actions=drop
1127 idle_timeout=20 in_port=1 dl_src=00:11:22:33:44:55 actions=drop
1128 idle_timeout=30 in_port=1 dl_src=00:22:33:44:55:66 actions=drop
1129 idle_timeout=40 in_port=1 dl_src=00:33:44:55:66:77 actions=drop
1131 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1132 idle_timeout=10, in_port=2,dl_src=00:44:55:66:77:88 actions=drop
1133 idle_timeout=20, in_port=1,dl_src=00:11:22:33:44:55 actions=drop
1134 idle_timeout=30, in_port=1,dl_src=00:22:33:44:55:66 actions=drop
1135 idle_timeout=40, in_port=1,dl_src=00:33:44:55:66:77 actions=drop
1136 OFPST_FLOW reply (OF1.2):
1138 # Adding another flow will cause the one that expires soonest within
1139 # the largest group (those with in_port=1) to be evicted. In this
1140 # case this is not the same as the one that expires soonest overall
1141 # (which is what makes the test interesting):
1142 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 in_port=2,dl_src=00:55:66:77:88:99,actions=drop])
1143 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1144 idle_timeout=10, in_port=2,dl_src=00:44:55:66:77:88 actions=drop
1145 idle_timeout=30, in_port=1,dl_src=00:22:33:44:55:66 actions=drop
1146 idle_timeout=40, in_port=1,dl_src=00:33:44:55:66:77 actions=drop
1147 in_port=2,dl_src=00:55:66:77:88:99 actions=drop
1148 OFPST_FLOW reply (OF1.2):
1150 # Enlarge the flow limit, change the eviction policy back to strictly
1151 # based on expiration, and and add some flows.
1152 AT_CHECK([ovs-vsctl set Flow_Table evict groups='[[]]' flow-limit=7])
1153 ovs-ofctl -O OpenFlow12 add-flows br0 - <<EOF
1154 idle_timeout=50 in_port=2 dl_src=00:66:77:88:99:aa actions=drop
1155 idle_timeout=60 in_port=2 dl_src=00:77:88:99:aa:bb actions=drop
1156 idle_timeout=70 in_port=2 dl_src=00:88:99:aa:bb:cc actions=drop
1158 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1159 idle_timeout=10, in_port=2,dl_src=00:44:55:66:77:88 actions=drop
1160 idle_timeout=30, in_port=1,dl_src=00:22:33:44:55:66 actions=drop
1161 idle_timeout=40, in_port=1,dl_src=00:33:44:55:66:77 actions=drop
1162 idle_timeout=50, in_port=2,dl_src=00:66:77:88:99:aa actions=drop
1163 idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=drop
1164 idle_timeout=70, in_port=2,dl_src=00:88:99:aa:bb:cc actions=drop
1165 in_port=2,dl_src=00:55:66:77:88:99 actions=drop
1166 OFPST_FLOW reply (OF1.2):
1168 # Adding another flow will cause the one that expires soonest overall
1170 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'])
1171 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1172 idle_timeout=30, in_port=1,dl_src=00:22:33:44:55:66 actions=drop
1173 idle_timeout=40, in_port=1,dl_src=00:33:44:55:66:77 actions=drop
1174 idle_timeout=50, in_port=2,dl_src=00:66:77:88:99:aa actions=drop
1175 idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=drop
1176 idle_timeout=70, in_port=2,dl_src=00:88:99:aa:bb:cc actions=drop
1177 idle_timeout=80, in_port=2,dl_src=00:99:aa:bb:cc:dd actions=drop
1178 in_port=2,dl_src=00:55:66:77:88:99 actions=drop
1179 OFPST_FLOW reply (OF1.2):
1181 # Reducing the flow limit also causes the flows that expire soonest
1182 # overall to be evicted.
1183 AT_CHECK([ovs-vsctl set Flow_Table evict flow-limit=4])
1184 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1185 idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=drop
1186 idle_timeout=70, in_port=2,dl_src=00:88:99:aa:bb:cc actions=drop
1187 idle_timeout=80, in_port=2,dl_src=00:99:aa:bb:cc:dd actions=drop
1188 in_port=2,dl_src=00:55:66:77:88:99 actions=drop
1189 OFPST_FLOW reply (OF1.2):
1194 AT_SETUP([ofproto - asynchronous message control (OpenFlow 1.0)])
1196 AT_CHECK([ovs-ofctl -P openflow10 monitor br0 --detach --no-chdir --pidfile])
1198 printf '\n\n--- check_async %d ---\n\n\n' $1
1201 ovs-appctl -t ovs-ofctl ofctl/barrier
1202 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
1205 # OFPT_PACKET_IN, OFPR_ACTION (controller_id=0)
1206 ovs-ofctl -v packet-out br0 controller controller '0001020304050010203040501234'
1207 if test X"$1" = X"OFPR_ACTION"; then shift;
1208 echo >>expout "OFPT_PACKET_IN: total_len=14 in_port=CONTROLLER (via action) data_len=14 (unbuffered)
1209 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"
1212 # OFPT_PACKET_IN, OFPR_NO_MATCH (controller_id=123)
1213 ovs-ofctl -v packet-out br0 controller 'controller(reason=no_match,id=123)' '0001020304050010203040501234'
1214 if test X"$1" = X"OFPR_NO_MATCH"; then shift;
1215 echo >>expout "OFPT_PACKET_IN: total_len=14 in_port=CONTROLLER (via no_match) data_len=14 (unbuffered)
1216 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"
1219 # OFPT_PACKET_IN, OFPR_INVALID_TTL (controller_id=0)
1220 ovs-ofctl packet-out br0 controller dec_ttl '002583dfb4000026b98cb0f908004500003fb7e200000011339bac11370dac100002d7730035002b8f6d86fb0100000100000000000006626c702d7873066e696369726103636f6d00000f00'
1221 if test X"$1" = X"OFPR_INVALID_TTL"; then shift;
1222 echo >>expout "OFPT_PACKET_IN: total_len=76 in_port=CONTROLLER (via invalid_ttl) data_len=76 (unbuffered)
1223 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"
1226 # OFPT_PORT_STATUS, OFPPR_ADD
1227 ovs-vsctl add-port br0 test -- set Interface test type=dummy ofport_request=1
1228 if test X"$1" = X"OFPPR_ADD"; then shift;
1229 echo >>expout "OFPT_PORT_STATUS: ADD: 1(test): addr:aa:55:aa:55:00:0x
1232 speed: 0 Mbps now, 0 Mbps max"
1235 # OFPT_PORT_STATUS, OFPPR_DELETE
1236 ovs-vsctl del-port br0 test
1237 if test X"$1" = X"OFPPR_DELETE"; then shift;
1238 echo >>expout "OFPT_PORT_STATUS: DEL: 1(test): addr:aa:55:aa:55:00:0x
1241 speed: 0 Mbps now, 0 Mbps max"
1244 # OFPT_FLOW_REMOVED, OFPRR_DELETE
1245 ovs-ofctl add-flow br0 send_flow_rem,actions=drop
1246 ovs-ofctl --strict del-flows br0 ''
1247 if test X"$1" = X"OFPRR_DELETE"; then shift;
1248 echo >>expout "OFPT_FLOW_REMOVED: reason=delete"
1250 AT_FAIL_IF([test X"$1" != X])
1252 ovs-appctl -t ovs-ofctl ofctl/barrier
1253 echo >>expout "OFPT_BARRIER_REPLY:"
1257 s/ (xid=0x[0-9a-fA-F]*)//
1259 s/00:0.$/00:0x/' < monitor.log]],
1263 # It's a service connection so initially there should be no async messages.
1266 # Set miss_send_len to 128, turning on packet-ins for our service connection.
1267 ovs-appctl -t ovs-ofctl ofctl/send 0109000c0123456700000080
1268 check_async 2 OFPR_ACTION OFPPR_ADD OFPPR_DELETE OFPRR_DELETE
1270 # Set miss_send_len to 128 and enable invalid_ttl.
1271 ovs-appctl -t ovs-ofctl ofctl/send 0109000c0123456700040080
1272 check_async 3 OFPR_ACTION OFPR_INVALID_TTL OFPPR_ADD OFPPR_DELETE OFPRR_DELETE
1274 # Become slave, which should disable everything except port status.
1275 ovs-appctl -t ovs-ofctl ofctl/send 0104001400000002000023200000000a00000002
1276 check_async 4 OFPPR_ADD OFPPR_DELETE
1278 # Use NXT_SET_ASYNC_CONFIG to enable a patchwork of asynchronous messages.
1279 ovs-appctl -t ovs-ofctl ofctl/send 01040028000000020000232000000013000000020000000500000005000000020000000200000005
1280 check_async 5 OFPR_INVALID_TTL OFPPR_DELETE OFPRR_DELETE
1282 # Set controller ID 123.
1283 ovs-appctl -t ovs-ofctl ofctl/send 01040018000000030000232000000014000000000000007b
1284 check_async 6 OFPR_NO_MATCH OFPPR_DELETE OFPRR_DELETE
1286 # Restore controller ID 0.
1287 ovs-appctl -t ovs-ofctl ofctl/send 010400180000000300002320000000140000000000000000
1290 ovs-appctl -t ovs-ofctl ofctl/send 0104001400000002000023200000000a00000001
1291 check_async 7 OFPR_ACTION OFPPR_ADD
1293 ovs-appctl -t ovs-ofctl exit
1297 AT_SETUP([ofproto - asynchronous message control (OpenFlow 1.2)])
1299 AT_CHECK([ovs-ofctl -O OpenFlow12 monitor br0 --detach --no-chdir --pidfile])
1301 printf '\n\n--- check_async %d ---\n\n\n' $1
1305 ovs-appctl -t ovs-ofctl ofctl/barrier
1306 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
1309 # OFPT_PACKET_IN, OFPR_ACTION (controller_id=0)
1310 ovs-ofctl -O OpenFlow12 -v packet-out br0 none controller '0001020304050010203040501234'
1311 if test X"$1" = X"OFPR_ACTION"; then shift;
1312 echo >>expout "OFPT_PACKET_IN (OF1.2): total_len=14 in_port=ANY (via action) data_len=14 (unbuffered)
1313 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"
1316 # OFPT_PACKET_IN, OFPR_NO_MATCH (controller_id=123)
1317 ovs-ofctl -O OpenFlow12 -v packet-out br0 none 'controller(reason=no_match,id=123)' '0001020304050010203040501234'
1318 if test X"$1" = X"OFPR_NO_MATCH"; then shift;
1319 echo >>expout "OFPT_PACKET_IN (OF1.2): total_len=14 in_port=ANY (via no_match) data_len=14 (unbuffered)
1320 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"
1323 # OFPT_PACKET_IN, OFPR_INVALID_TTL (controller_id=0)
1324 ovs-ofctl -O OpenFlow12 packet-out br0 none dec_ttl '002583dfb4000026b98cb0f908004500003fb7e200000011339bac11370dac100002d7730035002b8f6d86fb0100000100000000000006626c702d7873066e696369726103636f6d00000f00'
1325 if test X"$1" = X"OFPR_INVALID_TTL"; then shift;
1326 echo >>expout "OFPT_PACKET_IN (OF1.2): total_len=76 in_port=ANY (via invalid_ttl) data_len=76 (unbuffered)
1327 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"
1330 # OFPT_PORT_STATUS, OFPPR_ADD
1331 ovs-vsctl add-port br0 test -- set Interface test type=dummy
1332 if test X"$1" = X"OFPPR_ADD"; then shift;
1333 echo >>expout "OFPT_PORT_STATUS (OF1.2): ADD: ${INDEX}(test): addr:aa:55:aa:55:00:0x
1336 speed: 0 Mbps now, 0 Mbps max"
1339 # OFPT_PORT_STATUS, OFPPR_DELETE
1340 ovs-vsctl del-port br0 test
1341 if test X"$1" = X"OFPPR_DELETE"; then shift;
1342 echo >>expout "OFPT_PORT_STATUS (OF1.2): DEL: ${INDEX}(test): addr:aa:55:aa:55:00:0x
1345 speed: 0 Mbps now, 0 Mbps max"
1348 # OFPT_FLOW_REMOVED, OFPRR_DELETE
1349 ovs-ofctl -O OpenFlow12 add-flow br0 send_flow_rem,actions=drop
1350 ovs-ofctl -O OpenFlow12 --strict del-flows br0 ''
1351 if test X"$1" = X"OFPRR_DELETE"; then shift;
1352 echo >>expout "OFPT_FLOW_REMOVED (OF1.2): reason=delete table_id=0"
1354 AT_FAIL_IF([test X"$1" != X])
1356 ovs-appctl -t ovs-ofctl ofctl/barrier
1357 echo >>expout "OFPT_BARRIER_REPLY (OF1.2):"
1361 s/ (xid=0x[0-9a-fA-F]*)//
1363 s/00:0.$/00:0x/' < monitor.log]],
1367 # It's a service connection so initially there should be no async messages.
1370 # Set miss_send_len to 128, turning on packet-ins for our service connection.
1371 ovs-appctl -t ovs-ofctl ofctl/send 0309000c0123456700000080
1372 check_async 2 OFPR_ACTION OFPPR_ADD OFPPR_DELETE OFPRR_DELETE
1374 # Set miss_send_len to 128 and enable invalid_ttl.
1375 ovs-appctl -t ovs-ofctl ofctl/send 0309000c0123456700040080
1376 check_async 3 OFPR_ACTION OFPR_INVALID_TTL OFPPR_ADD OFPPR_DELETE OFPRR_DELETE
1378 # Become slave (OF 1.2), which should disable everything except port status.
1379 ovs-appctl -t ovs-ofctl ofctl/send 031800180000000200000003000000000000000000000001
1380 check_async 4 OFPPR_ADD OFPPR_DELETE
1382 # Use NXT_SET_ASYNC_CONFIG to enable a patchwork of asynchronous messages.
1383 ovs-appctl -t ovs-ofctl ofctl/send 03040028000000020000232000000013000000020000000500000005000000020000000200000005
1384 check_async 5 OFPR_INVALID_TTL OFPPR_DELETE OFPRR_DELETE
1386 # Set controller ID 123.
1387 ovs-appctl -t ovs-ofctl ofctl/send 03040018000000030000232000000014000000000000007b
1388 check_async 6 OFPR_NO_MATCH OFPPR_DELETE OFPRR_DELETE
1390 # Restore controller ID 0.
1391 ovs-appctl -t ovs-ofctl ofctl/send 030400180000000300002320000000140000000000000000
1393 # Become master (OF 1.2).
1394 ovs-appctl -t ovs-ofctl ofctl/send 031800180000000400000002000000000000000000000002
1395 check_async 7 OFPR_ACTION OFPPR_ADD
1397 ovs-appctl -t ovs-ofctl exit
1401 AT_SETUP([ofproto - asynchronous message control (OpenFlow 1.3)])
1403 AT_CHECK([ovs-ofctl -O OpenFlow13 monitor br0 --detach --no-chdir --pidfile])
1405 printf '\n\n--- check_async %d ---\n\n\n' $1
1409 ovs-appctl -t ovs-ofctl ofctl/barrier
1410 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
1413 # OFPT_PACKET_IN, OFPR_ACTION (controller_id=0)
1414 ovs-ofctl -O OpenFlow13 -v packet-out br0 none controller '0001020304050010203040501234'
1415 if test X"$1" = X"OFPR_ACTION"; then shift;
1416 echo >>expout "OFPT_PACKET_IN (OF1.3): total_len=14 in_port=ANY (via action) data_len=14 (unbuffered)
1417 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"
1420 # OFPT_PACKET_IN, OFPR_NO_MATCH (controller_id=123)
1421 ovs-ofctl -O OpenFlow13 -v packet-out br0 none 'controller(reason=no_match,id=123)' '0001020304050010203040501234'
1422 if test X"$1" = X"OFPR_NO_MATCH"; then shift;
1423 echo >>expout "OFPT_PACKET_IN (OF1.3): total_len=14 in_port=ANY (via no_match) data_len=14 (unbuffered)
1424 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"
1427 # OFPT_PACKET_IN, OFPR_INVALID_TTL (controller_id=0)
1428 ovs-ofctl -O OpenFlow13 packet-out br0 none dec_ttl '002583dfb4000026b98cb0f908004500003fb7e200000011339bac11370dac100002d7730035002b8f6d86fb0100000100000000000006626c702d7873066e696369726103636f6d00000f00'
1429 if test X"$1" = X"OFPR_INVALID_TTL"; then shift;
1430 echo >>expout "OFPT_PACKET_IN (OF1.3): total_len=76 in_port=ANY (via invalid_ttl) data_len=76 (unbuffered)
1431 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"
1434 # OFPT_PORT_STATUS, OFPPR_ADD
1435 ovs-vsctl add-port br0 test -- set Interface test type=dummy
1436 if test X"$1" = X"OFPPR_ADD"; then shift;
1437 echo >>expout "OFPT_PORT_STATUS (OF1.3): ADD: ${INDEX}(test): addr:aa:55:aa:55:00:0x
1440 speed: 0 Mbps now, 0 Mbps max"
1443 # OFPT_PORT_STATUS, OFPPR_DELETE
1444 ovs-vsctl del-port br0 test
1445 if test X"$1" = X"OFPPR_DELETE"; then shift;
1446 echo >>expout "OFPT_PORT_STATUS (OF1.3): DEL: ${INDEX}(test): addr:aa:55:aa:55:00:0x
1449 speed: 0 Mbps now, 0 Mbps max"
1452 # OFPT_FLOW_REMOVED, OFPRR_DELETE
1453 ovs-ofctl -O OpenFlow13 add-flow br0 send_flow_rem,actions=drop
1454 ovs-ofctl -O OpenFlow13 --strict del-flows br0 ''
1455 if test X"$1" = X"OFPRR_DELETE"; then shift;
1456 echo >>expout "OFPT_FLOW_REMOVED (OF1.3): reason=delete table_id=0"
1458 AT_FAIL_IF([test X"$1" != X])
1460 ovs-appctl -t ovs-ofctl ofctl/barrier
1461 echo >>expout "OFPT_BARRIER_REPLY (OF1.3):"
1465 s/ (xid=0x[0-9a-fA-F]*)//
1467 s/00:0.$/00:0x/' < monitor.log]],
1471 # It's a service connection so initially there should be no async messages.
1474 # Set miss_send_len to 128, turning on packet-ins for our service connection.
1475 ovs-appctl -t ovs-ofctl ofctl/send 0409000c0123456700000080
1476 check_async 2 OFPR_ACTION OFPPR_ADD OFPPR_DELETE OFPRR_DELETE
1478 # Become slave (OF 1.3), which should disable everything except port status.
1479 ovs-appctl -t ovs-ofctl ofctl/send 041800180000000200000003000000000000000000000001
1480 check_async 3 OFPPR_ADD OFPPR_DELETE
1482 # Use OF 1.3 OFPT_SET_ASYNC to enable a patchwork of asynchronous messages.
1483 ovs-appctl -t ovs-ofctl ofctl/send 041c002000000002000000020000000500000005000000020000000200000005
1484 check_async 4 OFPR_INVALID_TTL OFPPR_DELETE OFPRR_DELETE
1486 # Set controller ID 123.
1487 ovs-appctl -t ovs-ofctl ofctl/send 04040018000000030000232000000014000000000000007b
1488 check_async 5 OFPR_NO_MATCH OFPPR_DELETE OFPRR_DELETE
1490 # Restore controller ID 0.
1491 ovs-appctl -t ovs-ofctl ofctl/send 040400180000000300002320000000140000000000000000
1493 # Become master (OF 1.3).
1494 ovs-appctl -t ovs-ofctl ofctl/send 041800180000000400000002000000000000000000000002
1495 check_async 6 OFPR_ACTION OFPPR_ADD
1497 ovs-appctl -t ovs-ofctl exit
1501 dnl This test checks that the role request/response messaging works
1502 dnl and that generation_id is handled properly.
1503 AT_SETUP([ofproto - controller role (OpenFlow 1.2)])
1505 AT_CHECK([ovs-ofctl -O OpenFlow12 monitor br0 --detach --no-chdir --pidfile])
1507 ovs-appctl -t ovs-ofctl ofctl/barrier
1508 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
1511 # find out current role
1512 ovs-appctl -t ovs-ofctl ofctl/send 031800180000000200000000000000000000000000000000
1513 echo >>expout "send: OFPT_ROLE_REQUEST (OF1.2) (xid=0x2): role=nochange"
1514 echo >>expout "OFPT_ROLE_REPLY (OF1.2) (xid=0x2): role=equal"
1516 # Become slave (generation_id is initially undefined, so 2^63+2 should not be stale)
1517 ovs-appctl -t ovs-ofctl ofctl/send 031800180000000300000003000000008000000000000002
1518 echo >>expout "send: OFPT_ROLE_REQUEST (OF1.2) (xid=0x3): role=slave generation_id=9223372036854775810"
1519 echo >>expout "OFPT_ROLE_REPLY (OF1.2) (xid=0x3): role=slave generation_id=9223372036854775810"
1521 # Try to become the master using a stale generation ID
1522 ovs-appctl -t ovs-ofctl ofctl/send 031800180000000400000002000000000000000000000002
1523 echo >>expout "send: OFPT_ROLE_REQUEST (OF1.2) (xid=0x4): role=master generation_id=2"
1524 echo >>expout "OFPT_ERROR (OF1.2) (xid=0x4): OFPRRFC_STALE"
1525 echo >>expout "OFPT_ROLE_REQUEST (OF1.2) (xid=0x4): role=master generation_id=2"
1527 # Become master using a valid generation ID
1528 ovs-appctl -t ovs-ofctl ofctl/send 031800180000000500000002000000000000000000000001
1529 echo >>expout "send: OFPT_ROLE_REQUEST (OF1.2) (xid=0x5): role=master generation_id=1"
1530 echo >>expout "OFPT_ROLE_REPLY (OF1.2) (xid=0x5): role=master generation_id=1"
1531 ovs-appctl -t ovs-ofctl ofctl/barrier
1532 echo >>expout "OFPT_BARRIER_REPLY (OF1.2) (xid=0x3):"
1534 AT_CHECK([cat monitor.log], [0], [expout])
1536 ovs-appctl -t ovs-ofctl exit
1540 dnl This test checks that OFPT_PACKET_OUT accepts both OFPP_NONE (as
1541 dnl specified by OpenFlow 1.0) and OFPP_CONTROLLER (used by some
1542 dnl controllers despite the spec) as meaning a packet that was generated
1543 dnl by the controller.
1544 AT_SETUP([ofproto - packet-out from controller (OpenFlow 1.0)])
1546 ADD_OF_PORTS([br0], [1])
1548 # Start a monitor listening for packet-ins.
1549 AT_CHECK([ovs-ofctl -P openflow10 monitor br0 --detach --no-chdir --pidfile])
1550 ovs-appctl -t ovs-ofctl ofctl/send 0109000c0123456700000080
1551 ovs-appctl -t ovs-ofctl ofctl/barrier
1552 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
1553 AT_CAPTURE_FILE([monitor.log])
1555 # Send some packet-outs with OFPP_NONE and OFPP_CONTROLLER (65533) as in_port.
1556 AT_CHECK([ovs-ofctl packet-out br0 none controller,1 '0001020304050010203040501234'])
1557 AT_CHECK([ovs-ofctl packet-out br0 controller controller,1 '0001020304050010203040505678'])
1559 # Stop the monitor and check its output.
1560 ovs-appctl -t ovs-ofctl ofctl/barrier
1561 ovs-appctl -t ovs-ofctl exit
1563 ovs-ofctl dump-ports br0
1565 AT_CHECK([sed 's/ (xid=0x[[0-9a-fA-F]]*)//' monitor.log], [0], [dnl
1566 OFPT_PACKET_IN: total_len=14 in_port=ANY (via action) data_len=14 (unbuffered)
1567 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
1568 OFPT_PACKET_IN: total_len=14 in_port=CONTROLLER (via action) data_len=14 (unbuffered)
1569 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
1576 dnl This test checks that OFPT_PACKET_OUT accepts both OFPP_NONE (as
1577 dnl specified by OpenFlow 1.2) and OFPP_CONTROLLER (used by some
1578 dnl controllers despite the spec) as meaning a packet that was generated
1579 dnl by the controller.
1580 AT_SETUP([ofproto - packet-out from controller (OpenFlow 1.2)])
1583 # Start a monitor listening for packet-ins.
1584 AT_CHECK([ovs-ofctl -O OpenFlow12 monitor br0 --detach --no-chdir --pidfile])
1585 ovs-appctl -t ovs-ofctl ofctl/send 0309000c0123456700000080
1586 ovs-appctl -t ovs-ofctl ofctl/barrier
1587 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
1588 AT_CAPTURE_FILE([monitor.log])
1590 # Send some packet-outs with OFPP_NONE and OFPP_CONTROLLER (65533) as in_port.
1591 AT_CHECK([ovs-ofctl -O OpenFlow12 packet-out br0 none controller '0001020304050010203040501234'])
1592 AT_CHECK([ovs-ofctl -O OpenFlow12 packet-out br0 4294967293 controller '0001020304050010203040505678'])
1594 # Stop the monitor and check its output.
1595 ovs-appctl -t ovs-ofctl ofctl/barrier
1596 ovs-appctl -t ovs-ofctl exit
1598 AT_CHECK([sed 's/ (xid=0x[[0-9a-fA-F]]*)//' monitor.log], [0], [dnl
1599 OFPT_PACKET_IN (OF1.2): total_len=14 in_port=ANY (via action) data_len=14 (unbuffered)
1600 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
1601 OFPT_PACKET_IN (OF1.2): total_len=14 in_port=CONTROLLER (via action) data_len=14 (unbuffered)
1602 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
1603 OFPT_BARRIER_REPLY (OF1.2):
1609 dnl This test checks that metadata is encoded in packet_in structures,
1610 dnl supported by NXAST.
1611 AT_SETUP([ofproto - packet-out with metadata (NXM)])
1614 # Start a monitor listening for packet-ins.
1615 AT_CHECK([ovs-ofctl -P nxm monitor br0 --detach --no-chdir --pidfile])
1616 ovs-appctl -t ovs-ofctl ofctl/send 0109000c0123456700000080
1617 ovs-appctl -t ovs-ofctl ofctl/barrier
1618 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
1619 AT_CAPTURE_FILE([monitor.log])
1621 # Send a packet-out with a load action to set some metadata, and forward to controller
1622 AT_CHECK([ovs-ofctl packet-out br0 controller 'load(0xfafafafa5a5a5a5a->OXM_OF_METADATA[[0..63]]), load(0xaa->NXM_NX_PKT_MARK[[]]), controller' '0001020304050010203040501234'])
1624 # Stop the monitor and check its output.
1625 ovs-appctl -t ovs-ofctl ofctl/barrier
1626 ovs-appctl -t ovs-ofctl exit
1628 AT_CHECK([sed 's/ (xid=0x[[0-9a-fA-F]]*)//' monitor.log], [0], [dnl
1629 NXT_PACKET_IN: total_len=14 in_port=CONTROLLER metadata=0xfafafafa5a5a5a5a pkt_mark=0xaa (via action) data_len=14 (unbuffered)
1630 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
1637 dnl This test checks that metadata is encoded in packet_in structures,
1638 dnl supported by NXAST.
1639 AT_SETUP([ofproto - packet-out with metadata (OpenFlow 1.2)])
1642 # Start a monitor listening for packet-ins.
1643 AT_CHECK([ovs-ofctl -O OpenFlow12 monitor br0 --detach --no-chdir --pidfile])
1644 ovs-appctl -t ovs-ofctl ofctl/send 0309000c0123456700000080
1645 ovs-appctl -t ovs-ofctl ofctl/barrier
1646 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
1647 AT_CAPTURE_FILE([monitor.log])
1649 # Send a packet-out with a load action to set some metadata, and forward to controller
1650 AT_CHECK([ovs-ofctl -O OpenFlow12 packet-out br0 none 'load(0xfafafafa5a5a5a5a->OXM_OF_METADATA[[0..63]]), controller' '0001020304050010203040501234'])
1652 # Stop the monitor and check its output.
1653 ovs-appctl -t ovs-ofctl ofctl/barrier
1654 ovs-appctl -t ovs-ofctl exit
1656 AT_CHECK([sed 's/ (xid=0x[[0-9a-fA-F]]*)//' monitor.log], [0], [dnl
1657 OFPT_PACKET_IN (OF1.2): total_len=14 in_port=ANY metadata=0xfafafafa5a5a5a5a (via action) data_len=14 (unbuffered)
1658 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
1659 OFPT_BARRIER_REPLY (OF1.2):
1665 dnl This test checks that tunnel metadata is encoded in packet_in structures.
1666 AT_SETUP([ofproto - packet-out with tunnel metadata (OpenFlow 1.2)])
1669 # Start a monitor listening for packet-ins.
1670 AT_CHECK([ovs-ofctl -O OpenFlow12 monitor br0 --detach --no-chdir --pidfile])
1671 ovs-appctl -t ovs-ofctl ofctl/send 0309000c0123456700000080
1672 ovs-appctl -t ovs-ofctl ofctl/barrier
1673 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
1674 AT_CAPTURE_FILE([monitor.log])
1676 # Send a packet-out with set field actions to set some tunnel metadata, and forward to controller
1677 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'])
1679 # Stop the monitor and check its output.
1680 ovs-appctl -t ovs-ofctl ofctl/barrier
1681 ovs-appctl -t ovs-ofctl exit
1683 AT_CHECK([sed 's/ (xid=0x[[0-9a-fA-F]]*)//' monitor.log], [0], [dnl
1684 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)
1685 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
1686 OFPT_BARRIER_REPLY (OF1.2):
1692 AT_SETUP([ofproto - flow monitoring])
1693 AT_KEYWORDS([monitor])
1696 ovs-ofctl add-flow br0 in_port=0,dl_vlan=123,actions=output:1
1698 # Start a monitor watching the flow table and check the initial reply.
1699 ovs-ofctl monitor br0 watch: --detach --no-chdir --pidfile >monitor.log 2>&1
1700 AT_CAPTURE_FILE([monitor.log])
1701 ovs-appctl -t ovs-ofctl ofctl/barrier
1702 AT_CHECK([sed 's/ (xid=0x[[1-9a-fA-F]][[0-9a-fA-F]]*)//' monitor.log], [0],
1703 [NXST_FLOW_MONITOR reply:
1704 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=123 actions=output:1
1708 # Add, delete, and modify some flows and check the updates.
1709 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
1710 ovs-ofctl add-flow br0 in_port=0,dl_vlan=124,actions=output:2
1711 ovs-ofctl add-flow br0 in_port=0,dl_vlan=123,actions=output:5
1712 ovs-ofctl add-flow br0 in_port=0,dl_vlan=123,dl_vlan_pcp=0,actions=output:6
1713 ovs-ofctl add-flow br0 in_port=0,dl_vlan=123,dl_vlan_pcp=1,actions=output:7
1714 ovs-ofctl add-flow br0 in_port=0,dl_vlan=123,actions=output:8
1715 ovs-ofctl add-flow br0 in_port=0,dl_vlan=65535,dl_vlan_pcp=0,actions=output:9
1716 ovs-ofctl add-flow br0 in_port=0,dl_vlan=65535,dl_vlan_pcp=1,actions=output:10
1717 ovs-ofctl add-flow br0 in_port=0,dl_vlan=65535,actions=output:11
1718 ovs-ofctl add-flow br0 in_port=0,dl_vlan=8191,dl_vlan_pcp=0,actions=output:12
1719 ovs-ofctl add-flow br0 in_port=0,dl_vlan=8191,dl_vlan_pcp=1,actions=output:13
1720 ovs-ofctl add-flow br0 in_port=0,dl_vlan=8191,actions=output:14
1721 ovs-ofctl add-flow br0 in_port=0,dl_vlan=0,dl_vlan_pcp=0,actions=output:15
1722 ovs-ofctl add-flow br0 in_port=0,dl_vlan=0,dl_vlan_pcp=1,actions=output:16
1723 ovs-ofctl add-flow br0 in_port=0,dl_vlan=0,actions=output:17
1724 ovs-ofctl add-flow br0 in_port=0,dl_vlan=0,dl_vlan_pcp=0,actions=output:18
1725 ovs-ofctl add-flow br0 in_port=0,dl_vlan=0,dl_vlan_pcp=1,actions=output:19
1726 ovs-ofctl add-flow br0 in_port=0,dl_vlan=0,actions=output:20
1727 ovs-ofctl add-flow br0 in_port=0,dl_vlan_pcp=0,actions=output:21
1728 ovs-ofctl add-flow br0 in_port=0,dl_vlan_pcp=1,actions=output:22
1729 ovs-ofctl add-flow br0 in_port=0,actions=output:23
1730 ovs-ofctl mod-flows br0 cookie=5,dl_vlan=123,actions=output:3
1731 ovs-ofctl del-flows br0 dl_vlan=123
1732 ovs-ofctl del-flows br0
1733 ovs-appctl -t ovs-ofctl ofctl/barrier
1735 # Sorts groups of lines that start with a space, without moving them
1736 # past the nearest line that does not start with a space.
1744 print $_ foreach sort(@buffer);
1749 print $_ foreach sort(@buffer);
1751 AT_CHECK([sed 's/ (xid=0x[[1-9a-fA-F]][[0-9a-fA-F]]*)//' monitor.log | ${PERL} -e "$sort"], [0],
1752 [NXST_FLOW_MONITOR reply (xid=0x0):
1753 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=124 actions=output:2
1754 NXST_FLOW_MONITOR reply (xid=0x0):
1755 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=123 actions=output:5
1756 NXST_FLOW_MONITOR reply (xid=0x0):
1757 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=123,dl_vlan_pcp=0 actions=output:6
1758 NXST_FLOW_MONITOR reply (xid=0x0):
1759 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=123,dl_vlan_pcp=1 actions=output:7
1760 NXST_FLOW_MONITOR reply (xid=0x0):
1761 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=123 actions=output:8
1762 NXST_FLOW_MONITOR reply (xid=0x0):
1763 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=0,dl_vlan_pcp=0 actions=output:9
1764 NXST_FLOW_MONITOR reply (xid=0x0):
1765 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=0,dl_vlan_pcp=1 actions=output:10
1766 NXST_FLOW_MONITOR reply (xid=0x0):
1767 event=ADDED table=0 cookie=0 in_port=0,vlan_tci=0x0000 actions=output:11
1768 NXST_FLOW_MONITOR reply (xid=0x0):
1769 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=4095,dl_vlan_pcp=0 actions=output:12
1770 NXST_FLOW_MONITOR reply (xid=0x0):
1771 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=4095,dl_vlan_pcp=1 actions=output:13
1772 NXST_FLOW_MONITOR reply (xid=0x0):
1773 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=4095 actions=output:14
1774 NXST_FLOW_MONITOR reply (xid=0x0):
1775 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=0,dl_vlan_pcp=0 actions=output:15
1776 NXST_FLOW_MONITOR reply (xid=0x0):
1777 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=0,dl_vlan_pcp=1 actions=output:16
1778 NXST_FLOW_MONITOR reply (xid=0x0):
1779 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=0 actions=output:17
1780 NXST_FLOW_MONITOR reply (xid=0x0):
1781 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=0,dl_vlan_pcp=0 actions=output:18
1782 NXST_FLOW_MONITOR reply (xid=0x0):
1783 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=0,dl_vlan_pcp=1 actions=output:19
1784 NXST_FLOW_MONITOR reply (xid=0x0):
1785 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=0 actions=output:20
1786 NXST_FLOW_MONITOR reply (xid=0x0):
1787 event=ADDED table=0 cookie=0 in_port=0,dl_vlan_pcp=0 actions=output:21
1788 NXST_FLOW_MONITOR reply (xid=0x0):
1789 event=ADDED table=0 cookie=0 in_port=0,dl_vlan_pcp=1 actions=output:22
1790 NXST_FLOW_MONITOR reply (xid=0x0):
1791 event=ADDED table=0 cookie=0 in_port=0 actions=output:23
1792 NXST_FLOW_MONITOR reply (xid=0x0):
1793 event=MODIFIED table=0 cookie=0x5 in_port=0,dl_vlan=123 actions=output:3
1794 event=MODIFIED table=0 cookie=0x5 in_port=0,dl_vlan=123,dl_vlan_pcp=0 actions=output:3
1795 event=MODIFIED table=0 cookie=0x5 in_port=0,dl_vlan=123,dl_vlan_pcp=1 actions=output:3
1796 NXST_FLOW_MONITOR reply (xid=0x0):
1797 event=DELETED reason=delete table=0 cookie=0x5 in_port=0,dl_vlan=123 actions=output:3
1798 event=DELETED reason=delete table=0 cookie=0x5 in_port=0,dl_vlan=123,dl_vlan_pcp=0 actions=output:3
1799 event=DELETED reason=delete table=0 cookie=0x5 in_port=0,dl_vlan=123,dl_vlan_pcp=1 actions=output:3
1800 NXST_FLOW_MONITOR reply (xid=0x0):
1801 event=DELETED reason=delete table=0 cookie=0 in_port=0 actions=output:23
1802 event=DELETED reason=delete table=0 cookie=0 in_port=0,dl_vlan=0 actions=output:20
1803 event=DELETED reason=delete table=0 cookie=0 in_port=0,dl_vlan=0,dl_vlan_pcp=0 actions=output:18
1804 event=DELETED reason=delete table=0 cookie=0 in_port=0,dl_vlan=0,dl_vlan_pcp=1 actions=output:19
1805 event=DELETED reason=delete table=0 cookie=0 in_port=0,dl_vlan=124 actions=output:2
1806 event=DELETED reason=delete table=0 cookie=0 in_port=0,dl_vlan=4095 actions=output:14
1807 event=DELETED reason=delete table=0 cookie=0 in_port=0,dl_vlan=4095,dl_vlan_pcp=0 actions=output:12
1808 event=DELETED reason=delete table=0 cookie=0 in_port=0,dl_vlan=4095,dl_vlan_pcp=1 actions=output:13
1809 event=DELETED reason=delete table=0 cookie=0 in_port=0,dl_vlan_pcp=0 actions=output:21
1810 event=DELETED reason=delete table=0 cookie=0 in_port=0,dl_vlan_pcp=1 actions=output:22
1811 event=DELETED reason=delete table=0 cookie=0 in_port=0,vlan_tci=0x0000 actions=output:11
1815 # Check that our own changes are reported as abbreviations.
1816 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
1817 ovs-ofctl add-flow br0 in_port=1,actions=output:2
1818 ovs-ofctl add-flow br0 in_port=2,actions=output:1
1819 ovs-appctl -t ovs-ofctl ofctl/barrier
1820 ovs-appctl -t ovs-ofctl ofctl/send 010e004812345678003fffff00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003000000000000ffffffffffff0000
1821 ovs-appctl -t ovs-ofctl ofctl/barrier
1822 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip], [0], [NXST_FLOW reply:
1824 AT_CHECK([sed 's/ (xid=0x[[1-9a-fA-F]][[0-9a-fA-F]]*)//' monitor.log], [0],
1825 [NXST_FLOW_MONITOR reply (xid=0x0):
1826 event=ADDED table=0 cookie=0 in_port=1 actions=output:2
1827 NXST_FLOW_MONITOR reply (xid=0x0):
1828 event=ADDED table=0 cookie=0 in_port=2 actions=output:1
1830 send: OFPT_FLOW_MOD: DEL priority=0 actions=drop
1831 NXST_FLOW_MONITOR reply (xid=0x0):
1832 event=ABBREV xid=0x12345678
1836 ovs-appctl -t ovs-ofctl exit
1840 AT_SETUP([ofproto - flow monitoring pause and resume])
1841 AT_KEYWORDS([monitor])
1843 # The maximum socket receive buffer size is important for this test, which
1844 # tests behavior when the receive buffer overflows.
1845 if test -e /proc/sys/net/core/rmem_max; then
1847 rmem_max=`cat /proc/sys/net/core/rmem_max`
1848 elif rmem_max=`sysctl -n net.inet.tcp.recvbuf_max 2>/dev/null`; then
1851 # Don't know how to get maximum socket receive buffer on this OS
1854 # Calculate the total amount of queuing: rmem_max in the kernel, 128 kB
1855 # in ofproto sending userspace (see ofmonitor_flush() in connmgr.c).
1856 queue_size=`expr $rmem_max + 128 \* 1024`
1857 echo rmem_max=$rmem_max queue_size=$queue_size
1859 # Each flow update message takes up at least 48 bytes of space in queues
1860 # and in practice more than that.
1861 n_msgs=`expr $queue_size / 48`
1866 # Start a monitor watching the flow table, then make it block.
1867 ON_EXIT([kill `cat ovs-ofctl.pid`])
1868 ovs-ofctl monitor br0 watch: --detach --no-chdir --pidfile >monitor.log 2>&1
1869 AT_CAPTURE_FILE([monitor.log])
1870 ovs-appctl -t ovs-ofctl ofctl/block
1872 # Add $n_msgs flows.
1873 (echo "in_port=2,actions=output:2"
1875 for ($i = 0; $i < '$n_msgs'; $i++) {
1876 print "cookie=1,reg1=$i,actions=drop\n";
1879 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
1880 # Check that multipart flow dumps work properly:
1881 AT_CHECK([ovs-ofctl diff-flows br0 flows.txt])
1882 AT_CHECK([ovs-ofctl add-flow br0 in_port=1,cookie=3,actions=drop])
1883 AT_CHECK([ovs-ofctl mod-flows br0 in_port=2,cookie=2,actions=output:2])
1884 AT_CHECK([ovs-ofctl del-flows br0 cookie=1/-1])
1886 ovs-appctl -t ovs-ofctl ofctl/unblock
1887 ovs-appctl -t ovs-ofctl ofctl/barrier
1889 ovs-appctl -t ovs-ofctl exit
1891 # Check that the flow monitor reported the same number of flows
1892 # added and deleted, but fewer than we actually added and deleted.
1893 adds=`grep -c 'ADDED.*reg1=' monitor.log`
1894 deletes=`grep -c 'DELETED.*reg1=' monitor.log`
1895 echo adds=$adds deletes=$deletes
1896 AT_CHECK([test $adds -gt 100 && test $adds -lt $n_msgs])
1897 AT_CHECK([test $adds = $deletes])
1899 # Check that the flow monitor reported everything in the expected order:
1901 # event=ADDED table=0 cookie=0x1 reg1=0x22
1903 # NXT_FLOW_MONITOR_PAUSED:
1905 # event=DELETED reason=delete table=0 cookie=0x1 reg1=0x22
1907 # event=ADDED table=0 cookie=0x3 in_port=1
1908 # event=MODIFIED table=0 cookie=0x2 in_port=2 actions=output:2
1909 # NXT_FLOW_MONITOR_RESUMED:
1911 # except that, between the PAUSED and RESUMED, the order of the ADDED
1912 # and MODIFIED lines lines depends on hash order, that is, it varies
1913 # as we change the hash function or change architecture. Therefore,
1914 # we use a couple of tests below to accept both orders.
1915 AT_CHECK([ofctl_strip < monitor.log | sed -n -e '
1918 /NXT_FLOW_MONITOR_PAUSED:/p
1919 /NXT_FLOW_MONITOR_RESUMED:/p
1920 ' > monitor.log.subset])
1921 AT_CHECK([grep -v MODIFIED monitor.log.subset], [0], [dnl
1922 event=ADDED table=0 cookie=0x1 reg1=0x22
1923 NXT_FLOW_MONITOR_PAUSED:
1924 event=DELETED reason=delete table=0 cookie=0x1 reg1=0x22
1925 event=ADDED table=0 cookie=0x3 in_port=1
1926 NXT_FLOW_MONITOR_RESUMED:
1928 AT_CHECK([grep -v ADDED monitor.log.subset], [0], [dnl
1929 NXT_FLOW_MONITOR_PAUSED:
1930 event=DELETED reason=delete table=0 cookie=0x1 reg1=0x22
1931 event=MODIFIED table=0 cookie=0x2 in_port=2 actions=output:2
1932 NXT_FLOW_MONITOR_RESUMED:
1938 AT_SETUP([ofproto - event filtering (OpenFlow 1.3)])
1939 AT_KEYWORDS([monitor])
1942 # Start a monitor, use the required protocol version
1943 ovs-ofctl -O OpenFlow13 monitor br0 --detach --no-chdir --pidfile >monitor.log 2>&1
1944 AT_CAPTURE_FILE([monitor.log])
1946 # Send an OpenFlow13 message (04), OFPT_GET_ASYNC_REQUEST (1a), length (8), xid (0a)
1947 ovs-appctl -t ovs-ofctl ofctl/send 041a00080000000a
1948 ovs-appctl -t ovs-ofctl ofctl/barrier
1950 # Check default setting
1951 read -r -d '' expected <<'EOF'
1954 AT_CHECK([ofctl_strip < monitor.log], [], [dnl
1955 send: OFPT_GET_ASYNC_REQUEST (OF1.3):
1956 OFPT_GET_ASYNC_REPLY (OF1.3):
1958 PACKET_IN: no_match action
1959 PORT_STATUS: add delete modify
1960 FLOW_REMOVED: idle hard delete
1964 PORT_STATUS: add delete modify
1966 OFPT_BARRIER_REPLY (OF1.3):