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 AT_SETUP([ofproto - mod-port (OpenFlow 1.0)])
149 for command_config_state in \
151 'noflood NO_FLOOD 0' \
152 'down PORT_DOWN,NO_FLOOD LINK_DOWN' \
153 'flood PORT_DOWN LINK_DOWN' \
154 'no-receive PORT_DOWN,NO_RECV LINK_DOWN' \
155 'no-forward PORT_DOWN,NO_RECV,NO_FWD LINK_DOWN' \
156 'no-packet-in PORT_DOWN,NO_RECV,NO_FWD,NO_PACKET_IN LINK_DOWN' \
157 'forward PORT_DOWN,NO_RECV,NO_PACKET_IN LINK_DOWN' \
158 'packet-in PORT_DOWN,NO_RECV LINK_DOWN' \
162 set $command_config_state
163 command=$[1] config=`echo $[2] | sed 's/,/ /g'` state=$[3]
164 AT_CHECK([ovs-ofctl -vwarn mod-port br0 br0 $command])
165 AT_CHECK([ovs-ofctl -vwarn show br0], [0], [stdout])
166 AT_CHECK_UNQUOTED([STRIP_XIDS stdout], [0], [dnl
167 OFPT_FEATURES_REPLY: dpid:fedcba9876543210
168 n_tables:254, n_buffers:256
169 capabilities: FLOW_STATS TABLE_STATS PORT_STATS QUEUE_STATS ARP_MATCH_IP
170 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
171 LOCAL(br0): addr:aa:55:aa:55:00:00
174 speed: 0 Mbps now, 0 Mbps max
175 OFPT_GET_CONFIG_REPLY: frags=normal miss_send_len=0
181 AT_SETUP([ofproto - mod-port (OpenFlow 1.2)])
183 for command_config_state in \
185 'down PORT_DOWN LINK_DOWN' \
186 'no-receive PORT_DOWN,NO_RECV LINK_DOWN' \
187 'no-forward PORT_DOWN,NO_RECV,NO_FWD LINK_DOWN' \
188 'no-packet-in PORT_DOWN,NO_RECV,NO_FWD,NO_PACKET_IN LINK_DOWN' \
189 'forward PORT_DOWN,NO_RECV,NO_PACKET_IN LINK_DOWN' \
190 'packet-in PORT_DOWN,NO_RECV LINK_DOWN' \
194 set $command_config_state
195 command=$[1] config=`echo $[2] | sed 's/,/ /g'` state=$[3]
196 AT_CHECK([ovs-ofctl -O OpenFlow12 -vwarn mod-port br0 br0 $command])
197 AT_CHECK([ovs-ofctl -O OpenFlow12 -vwarn show br0], [0], [stdout])
198 AT_CHECK_UNQUOTED([STRIP_XIDS stdout], [0], [dnl
199 OFPT_FEATURES_REPLY (OF1.2): dpid:fedcba9876543210
200 n_tables:254, n_buffers:256
201 capabilities: FLOW_STATS TABLE_STATS PORT_STATS QUEUE_STATS
202 LOCAL(br0): addr:aa:55:aa:55:00:00
205 speed: 0 Mbps now, 0 Mbps max
206 OFPT_GET_CONFIG_REPLY (OF1.2): frags=normal miss_send_len=0
212 AT_SETUP([ofproto - basic flow_mod commands (NXM)])
214 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip], [0], [NXST_FLOW reply:
216 AT_CHECK([echo 'in_port=2,actions=1' | ovs-ofctl add-flows br0 -])
217 AT_CHECK([ovs-ofctl add-flow br0 in_port=1,actions=2])
218 AT_CHECK([ovs-ofctl -F nxm add-flow br0 table=1,in_port=4,actions=3])
219 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
220 in_port=1 actions=output:2
221 in_port=2 actions=output:1
222 table=1, in_port=4 actions=output:3
225 AT_CHECK([ovs-ofctl dump-aggregate br0 table=0 | STRIP_XIDS], [0], [dnl
226 NXST_AGGREGATE reply: packet_count=0 byte_count=0 flow_count=2
228 AT_CHECK([ovs-ofctl del-flows br0])
229 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip], [0], [NXST_FLOW reply:
234 AT_SETUP([ofproto - basic flow_mod commands (OpenFlow 1.0)])
236 AT_CHECK([ovs-ofctl -F openflow10 dump-flows br0 | ofctl_strip], [0], [OFPST_FLOW reply:
238 AT_CHECK([echo 'in_port=2,actions=1' | ovs-ofctl -F openflow10 add-flows br0 -])
239 AT_CHECK([ovs-ofctl -F openflow10 add-flow br0 in_port=1,actions=2])
240 AT_CHECK([ovs-ofctl -F openflow10 add-flow br0 table=1,in_port=4,actions=3])
241 AT_CHECK([ovs-ofctl -F openflow10 dump-flows br0 | ofctl_strip | sort], [0], [dnl
242 in_port=1 actions=output:2
243 in_port=2 actions=output:1
244 table=1, in_port=4 actions=output:3
247 AT_CHECK([ovs-ofctl -F openflow10 dump-aggregate br0 table=0 | STRIP_XIDS], [0], [dnl
248 OFPST_AGGREGATE reply: packet_count=0 byte_count=0 flow_count=2
250 AT_CHECK([ovs-ofctl -F openflow10 del-flows br0])
251 AT_CHECK([ovs-ofctl -F openflow10 dump-flows br0 | ofctl_strip], [0], [OFPST_FLOW reply:
256 AT_SETUP([ofproto - basic flow_mod commands (OpenFlow 1.1)])
258 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip], [0], [OFPST_FLOW reply (OF1.1):
260 AT_CHECK([echo 'in_port=2,actions=1' | ovs-ofctl -O OpenFlow11 add-flows br0 -])
261 AT_CHECK([ovs-ofctl -O OpenFlow11 add-flow br0 in_port=1,actions=2])
262 AT_CHECK([ovs-ofctl -O OpenFlow11 add-flow br0 table=1,in_port=4,actions=3])
263 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0], [dnl
264 in_port=1 actions=output:2
265 in_port=2 actions=output:1
266 table=1, in_port=4 actions=output:3
267 OFPST_FLOW reply (OF1.1):
269 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-aggregate br0 table=0 | STRIP_XIDS], [0], [dnl
270 OFPST_AGGREGATE reply (OF1.1): packet_count=0 byte_count=0 flow_count=2
272 AT_CHECK([ovs-ofctl -O OpenFlow11 del-flows br0])
273 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip], [0], [OFPST_FLOW reply (OF1.1):
278 AT_SETUP([ofproto - flow_mod negative test (OpenFlow 1.1)])
280 [set bridge br0 protocols=OpenFlow10,OpenFlow11,OpenFlow12,OpenFlow13])
281 AT_CHECK([ovs-ofctl add-flow -O OpenFlow11 br0 table=1,action=goto_table:2])
282 AT_CHECK([ovs-ofctl add-flow -O OpenFlow11 br0 table=1,action=goto_table:1],
285 # The output should look like this:
287 # OFPT_ERROR (OF1.1) (xid=0x2): OFPBRC_BAD_TABLE_ID
288 # OFPT_FLOW_MOD (OF1.1) (xid=0x2):
289 # (***truncated to 64 bytes from 160***)
290 # 00000000 02 0e 00 a0 00 00 00 02-00 00 00 00 00 00 00 00 |................|
291 # 00000010 00 00 00 00 00 00 00 00-01 00 00 00 00 00 80 00 |................|
292 # 00000020 ff ff ff ff ff ff ff ff-ff ff ff ff 00 00 00 00 |................|
293 # 00000030 00 00 00 58 00 00 00 00-00 00 03 ff 00 00 00 00 |...X............|
295 # This 'sed' command captures the error message but drops details.
296 AT_CHECK([sed '/truncated/d
297 /^000000.0/d' stderr | STRIP_XIDS], [0],
298 [OFPT_ERROR (OF1.1): OFPBRC_BAD_TABLE_ID
299 OFPT_FLOW_MOD (OF1.1):
304 AT_SETUP([ofproto - set-field flow_mod commands (NXM)])
306 AT_CHECK([ovs-ofctl add-flow br0 ipv6,table=1,in_port=3,actions=drop])
307 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])
308 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
309 table=1, ipv6,in_port=3 actions=load:0xa6badbfffefe59fa->NXM_NX_IPV6_SRC[[0..63]],load:0xfe8001234567890a->NXM_NX_IPV6_SRC[[64..127]]
315 AT_SETUP([ofproto - basic flow_mod commands (OpenFlow 1.2)])
317 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip], [0], [OFPST_FLOW reply (OF1.2):
319 AT_CHECK([echo 'in_port=2,actions=1' | ovs-ofctl -O OpenFlow12 add-flows br0 -])
320 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 in_port=1,actions=2])
321 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 table=1,in_port=4,actions=3])
322 AT_CHECK([ovs-ofctl -O OpenFlow12 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
326 OFPST_FLOW reply (OF1.2):
328 AT_CHECK([ovs-ofctl -O OpenFlow12 del-flows br0])
329 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip], [0], [OFPST_FLOW reply (OF1.2):
334 AT_SETUP([ofproto - dump flows with cookie])
336 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x1,in_port=1,actions=1])
337 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x2,in_port=2,actions=1])
338 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x3,in_port=3,actions=1])
339 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
340 cookie=0x1, in_port=1 actions=output:1
341 cookie=0x2, in_port=2 actions=output:1
342 cookie=0x3, in_port=3 actions=output:1
345 AT_CHECK([ovs-ofctl dump-aggregate br0 table=0 | STRIP_XIDS], [0], [dnl
346 NXST_AGGREGATE reply: packet_count=0 byte_count=0 flow_count=3
348 AT_CHECK([ovs-ofctl dump-flows br0 cookie=0x3/-1 | ofctl_strip | sort], [0], [dnl
349 cookie=0x3, in_port=3 actions=output:1
352 AT_CHECK([ovs-ofctl dump-aggregate br0 cookie=0x3/-1 | STRIP_XIDS], [0], [dnl
353 NXST_AGGREGATE reply: packet_count=0 byte_count=0 flow_count=1
358 AT_SETUP([ofproto - mod flow with cookie change (OpenFlow 1.0)])
360 AT_CHECK([ovs-ofctl -F openflow10 add-flow br0 cookie=0x1,in_port=1,actions=1])
361 AT_CHECK([ovs-ofctl -F openflow10 dump-flows br0 | ofctl_strip | sort], [0], [dnl
362 cookie=0x1, in_port=1 actions=output:1
366 AT_CHECK([ovs-ofctl -F openflow10 mod-flows br0 cookie=0x2,in_port=1,actions=1])
367 AT_CHECK([ovs-ofctl -F openflow10 dump-flows br0 | ofctl_strip | sort], [0], [dnl
368 cookie=0x2, in_port=1 actions=output:1
374 AT_SETUP([ofproto - mod flow with cookie change (NXM)])
376 AT_CHECK([ovs-ofctl -F nxm add-flow br0 cookie=0x1,in_port=1,actions=1])
377 AT_CHECK([ovs-ofctl -F nxm dump-flows br0 | ofctl_strip | sort], [0], [dnl
378 cookie=0x1, in_port=1 actions=output:1
382 AT_CHECK([ovs-ofctl -F nxm mod-flows br0 cookie=0x2,in_port=1,actions=1])
383 AT_CHECK([ovs-ofctl -F nxm dump-flows br0 | ofctl_strip | sort], [0], [dnl
384 cookie=0x2, in_port=1 actions=output:1
390 AT_SETUP([ofproto - no mod flow with cookie change (OpenFlow 1.1)])
392 AT_CHECK([ovs-ofctl -O OpenFlow11 add-flow br0 cookie=0x1,in_port=1,actions=1])
393 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0], [dnl
394 cookie=0x1, in_port=1 actions=output:1
395 OFPST_FLOW reply (OF1.1):
397 AT_CHECK([ovs-ofctl -O OpenFlow11 mod-flows br0 cookie=0x2,in_port=1,actions=1])
398 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0], [dnl
399 cookie=0x1, in_port=1 actions=output:1
400 OFPST_FLOW reply (OF1.1):
405 dnl The OpenFlow 1.2 spec states that the cookie may not be modified
406 AT_SETUP([ofproto - no mod flow with cookie change (OpenFlow 1.2)])
408 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 cookie=0x1,in_port=1,actions=1])
409 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
410 cookie=0x1, in_port=1 actions=output:1
411 OFPST_FLOW reply (OF1.2):
414 AT_CHECK([ovs-ofctl -O OpenFlow12 mod-flows br0 cookie=0x2,in_port=1,actions=1])
415 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
416 cookie=0x1, in_port=1 actions=output:1
417 OFPST_FLOW reply (OF1.2):
422 AT_SETUP([ofproto - mod flows based on cookie mask (OpenFlow 1.0)])
424 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x1,in_port=1,actions=1])
425 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x1,in_port=2,actions=1])
426 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x2,in_port=3,actions=1])
427 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
428 cookie=0x1, in_port=1 actions=output:1
429 cookie=0x1, in_port=2 actions=output:1
430 cookie=0x2, in_port=3 actions=output:1
434 AT_CHECK([ovs-ofctl -F nxm mod-flows br0 cookie=0x1/0xff,actions=4])
435 AT_CHECK([ovs-ofctl -F nxm dump-flows br0 | ofctl_strip | sort], [0], [dnl
436 cookie=0x1, in_port=1 actions=output:4
437 cookie=0x1, in_port=2 actions=output:4
438 cookie=0x2, in_port=3 actions=output:1
444 AT_SETUP([ofproto - mod flows based on cookie mask (OpenFlow 1.1)])
446 AT_CHECK([ovs-ofctl -O OpenFlow11 add-flow br0 cookie=0x1,in_port=1,actions=1])
447 AT_CHECK([ovs-ofctl -O OpenFlow11 add-flow br0 cookie=0x1,in_port=2,actions=1])
448 AT_CHECK([ovs-ofctl -O OpenFlow11 add-flow br0 cookie=0x2,in_port=3,actions=1])
449 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0], [dnl
450 cookie=0x1, in_port=1 actions=output:1
451 cookie=0x1, in_port=2 actions=output:1
452 cookie=0x2, in_port=3 actions=output:1
453 OFPST_FLOW reply (OF1.1):
456 AT_CHECK([ovs-ofctl -O OpenFlow11 mod-flows br0 cookie=0x1/0xff,actions=4])
457 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0], [dnl
458 cookie=0x1, in_port=1 actions=output:4
459 cookie=0x1, in_port=2 actions=output:4
460 cookie=0x2, in_port=3 actions=output:1
461 OFPST_FLOW reply (OF1.1):
466 AT_SETUP([ofproto - mod flows based on cookie mask (OpenFlow 1.2)])
468 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 cookie=0x1,in_port=1,actions=1])
469 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 cookie=0x1,in_port=2,actions=1])
470 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 cookie=0x2,in_port=3,actions=1])
471 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
472 cookie=0x1, in_port=1 actions=output:1
473 cookie=0x1, in_port=2 actions=output:1
474 cookie=0x2, in_port=3 actions=output:1
475 OFPST_FLOW reply (OF1.2):
478 AT_CHECK([ovs-ofctl -O OpenFlow12 mod-flows br0 cookie=0x1/0xff,actions=4])
479 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
480 cookie=0x1, in_port=1 actions=output:4
481 cookie=0x1, in_port=2 actions=output:4
482 cookie=0x2, in_port=3 actions=output:1
483 OFPST_FLOW reply (OF1.2):
488 dnl The OpenFlow 1.2 spec states that the cookie may not be modified
489 AT_SETUP([ofproto - mod flows based on cookie mask with cookie change])
491 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x1,in_port=1,actions=1])
492 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x1,in_port=2,actions=1])
493 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x2,in_port=3,actions=1])
494 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
495 cookie=0x1, in_port=1 actions=output:1
496 cookie=0x1, in_port=2 actions=output:1
497 cookie=0x2, in_port=3 actions=output:1
501 AT_CHECK([ovs-ofctl -F nxm mod-flows br0 cookie=1/-1,cookie=4,actions=4])
502 AT_CHECK([ovs-ofctl -F nxm dump-flows br0 | ofctl_strip | sort], [0], [dnl
503 cookie=0x2, in_port=3 actions=output:1
504 cookie=0x4, in_port=1 actions=output:4
505 cookie=0x4, in_port=2 actions=output:4
511 AT_SETUP([ofproto - mod flow with cookie miss (mask==0) - NXM])
513 AT_CHECK([ovs-ofctl -F nxm mod-flows br0 in_port=1,actions=1])
514 AT_CHECK([ovs-ofctl -F nxm dump-flows br0 | ofctl_strip | sort], [0], [dnl
515 in_port=1 actions=output:1
521 AT_SETUP([ofproto - mod flow with cookie miss (mask==0) - OF1.1])
523 AT_CHECK([ovs-ofctl -O openflow11 mod-flows br0 in_port=1,actions=1])
524 AT_CHECK([ovs-ofctl -O openflow11 dump-flows br0 | ofctl_strip | sort], [0], [dnl
525 in_port=1 actions=output:1
526 OFPST_FLOW reply (OF1.1):
531 AT_SETUP([ofproto - mod flow with cookie miss (mask==0) - OF1.2])
533 AT_CHECK([ovs-ofctl -O openflow12 mod-flows br0 in_port=1,actions=1])
534 AT_CHECK([ovs-ofctl -O openflow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
535 OFPST_FLOW reply (OF1.2):
540 AT_SETUP([ofproto - mod flow with cookie miss (mask!=0) - NXM])
542 AT_CHECK([ovs-ofctl -F nxm mod-flows br0 cookie=1/1,in_port=1,actions=1])
543 AT_CHECK([ovs-ofctl -F nxm dump-flows br0 | ofctl_strip | sort], [0], [dnl
549 AT_SETUP([ofproto - mod flow with cookie miss (mask!=0) - OF1.1])
551 AT_CHECK([ovs-ofctl -O openflow11 mod-flows br0 cookie=1/1,in_port=1,actions=1])
552 AT_CHECK([ovs-ofctl -O openflow11 dump-flows br0 | ofctl_strip | sort], [0], [dnl
553 OFPST_FLOW reply (OF1.1):
558 AT_SETUP([ofproto - mod flow with cookie miss (mask!=0) - OF1.2])
560 AT_CHECK([ovs-ofctl -O openflow12 mod-flows br0 cookie=1/1,in_port=1,actions=1])
561 AT_CHECK([ovs-ofctl -O openflow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
562 OFPST_FLOW reply (OF1.2):
567 AT_SETUP([ofproto - del flows with cookies])
569 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x1,in_port=1,actions=1])
570 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x2,in_port=2,actions=1])
571 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x3,in_port=3,actions=1])
572 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
573 cookie=0x1, in_port=1 actions=output:1
574 cookie=0x2, in_port=2 actions=output:1
575 cookie=0x3, in_port=3 actions=output:1
579 AT_CHECK([ovs-ofctl del-flows br0])
580 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
586 AT_SETUP([ofproto - del flows based on cookie])
588 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x1,in_port=1,actions=1])
589 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x2,in_port=2,actions=1])
590 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x3,in_port=3,actions=1])
591 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
592 cookie=0x1, in_port=1 actions=output:1
593 cookie=0x2, in_port=2 actions=output:1
594 cookie=0x3, in_port=3 actions=output:1
598 AT_CHECK([ovs-ofctl del-flows br0 cookie=0x3/-1])
599 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
600 cookie=0x1, in_port=1 actions=output:1
601 cookie=0x2, in_port=2 actions=output:1
607 AT_SETUP([ofproto - del flows based on cookie mask])
609 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x1,in_port=1,actions=1])
610 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x2,in_port=2,actions=1])
611 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x3,in_port=3,actions=1])
612 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
613 cookie=0x1, in_port=1 actions=output:1
614 cookie=0x2, in_port=2 actions=output:1
615 cookie=0x3, in_port=3 actions=output:1
618 AT_CHECK([ovs-ofctl del-flows br0 cookie=0x3/0x1])
619 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
620 cookie=0x2, in_port=2 actions=output:1
626 AT_SETUP([ofproto - del flows based on table id (NXM)])
628 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x1,in_port=1,actions=1])
629 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x2,in_port=2,table=1,actions=1])
630 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
631 cookie=0x1, in_port=1 actions=output:1
632 cookie=0x2, table=1, in_port=2 actions=output:1
635 AT_CHECK([ovs-ofctl del-flows br0 table=0])
636 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
637 cookie=0x2, table=1, in_port=2 actions=output:1
640 AT_CHECK([ovs-ofctl del-flows br0 table=1])
641 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
644 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x1,in_port=1,actions=1])
645 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x2,in_port=2,table=1,actions=1])
646 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
647 cookie=0x1, in_port=1 actions=output:1
648 cookie=0x2, table=1, in_port=2 actions=output:1
651 AT_CHECK([ovs-ofctl del-flows br0])
652 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
658 AT_SETUP([ofproto - del flows based on table id (OpenFlow 1.1)])
660 AT_CHECK([ovs-ofctl -O OpenFlow11 add-flow br0 cookie=0x1,in_port=1,actions=1])
661 AT_CHECK([ovs-ofctl -O OpenFlow11 add-flow br0 cookie=0x2,in_port=2,table=1,actions=1])
662 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0], [dnl
663 cookie=0x1, in_port=1 actions=output:1
664 cookie=0x2, table=1, in_port=2 actions=output:1
665 OFPST_FLOW reply (OF1.1):
667 AT_CHECK([ovs-ofctl -O OpenFlow11 del-flows br0 table=0])
668 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0], [dnl
669 cookie=0x2, table=1, in_port=2 actions=output:1
670 OFPST_FLOW reply (OF1.1):
672 AT_CHECK([ovs-ofctl -O OpenFlow11 del-flows br0 table=1])
673 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0], [dnl
674 OFPST_FLOW reply (OF1.1):
676 AT_CHECK([ovs-ofctl -O OpenFlow11 add-flow br0 cookie=0x1,in_port=1,actions=1])
677 AT_CHECK([ovs-ofctl -O OpenFlow11 add-flow br0 cookie=0x2,in_port=2,table=1,actions=1])
678 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0], [dnl
679 cookie=0x1, in_port=1 actions=output:1
680 cookie=0x2, table=1, in_port=2 actions=output:1
681 OFPST_FLOW reply (OF1.1):
683 AT_CHECK([ovs-ofctl -O OpenFlow11 del-flows br0])
684 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0], [dnl
685 OFPST_FLOW reply (OF1.1):
690 AT_SETUP([ofproto - del flows based on table id (OpenFlow 1.2)])
692 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 cookie=0x1,in_port=1,actions=1])
693 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 cookie=0x2,in_port=2,table=1,actions=1])
694 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
695 cookie=0x1, in_port=1 actions=output:1
696 cookie=0x2, table=1, in_port=2 actions=output:1
697 OFPST_FLOW reply (OF1.2):
699 AT_CHECK([ovs-ofctl -O OpenFlow12 del-flows br0 table=0])
700 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
701 cookie=0x2, table=1, in_port=2 actions=output:1
702 OFPST_FLOW reply (OF1.2):
704 AT_CHECK([ovs-ofctl -O OpenFlow12 del-flows br0 table=1])
705 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
706 OFPST_FLOW reply (OF1.2):
708 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 cookie=0x1,in_port=1,actions=1])
709 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 cookie=0x2,in_port=2,table=1,actions=1])
710 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
711 cookie=0x1, in_port=1 actions=output:1
712 cookie=0x2, table=1, in_port=2 actions=output:1
713 OFPST_FLOW reply (OF1.2):
715 AT_CHECK([ovs-ofctl -O OpenFlow12 del-flows br0])
716 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
717 OFPST_FLOW reply (OF1.2):
722 AT_SETUP([ofproto - flow table configuration (OpenFlow 1.0)])
724 # Check the default configuration.
725 (echo "OFPST_TABLE reply (xid=0x2): 254 tables
726 0: classifier: wild=0x3fffff, max=1000000, active=0
729 while test $x -lt 254; do
730 printf " %d: %-8s: wild=0x3fffff, max=1000000, active=0
735 AT_CHECK([ovs-ofctl dump-tables br0], [0], [expout])
736 # Change the configuration.
739 -- --id=@t0 create Flow_Table name=main \
740 -- --id=@t1 create Flow_Table flow-limit=1024 \
741 -- set bridge br0 'flow_tables={1=@t1,0=@t0}' \
742 | ${PERL} $srcdir/uuidfilt.pl],
746 # Check that the configuration was updated.
747 mv expout orig-expout
748 (echo "OFPST_TABLE reply (xid=0x2): 254 tables
749 0: main : wild=0x3fffff, max=1000000, active=0
751 1: table1 : wild=0x3fffff, max= 1024, active=0
753 tail -n +6 orig-expout) > expout
754 AT_CHECK([ovs-ofctl dump-tables br0], [0], [expout])
758 AT_SETUP([ofproto - flow table configuration (OpenFlow 1.2)])
760 # Check the default configuration.
761 (mid="wild=0xfffffffff, max=1000000,"
764 match=0xfffffffff, instructions=0x00000007, config=0x00000003
765 write_actions=0x00000000, apply_actions=0x00000000
766 write_setfields=0x0000000fffffffff
767 apply_setfields=0x0000000fffffffff
768 metadata_match=0xffffffffffffffff
769 metadata_write=0xffffffffffffffff"
770 echo "OFPST_TABLE reply (OF1.2) (xid=0x2): 254 tables
771 0: classifier: $mid active=0$tail"
773 while test $x -lt 254; do
774 printf " %d: %-8s: $mid active=0$tail
778 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-tables br0], [0], [expout])
779 # Change the configuration.
782 -- --id=@t0 create Flow_Table name=main \
783 -- --id=@t1 create Flow_Table flow-limit=1024 \
784 -- set bridge br0 'flow_tables={1=@t1,0=@t0}' \
785 | ${PERL} $srcdir/uuidfilt.pl],
789 # Check that the configuration was updated.
790 mv expout orig-expout
791 (echo "OFPST_TABLE reply (OF1.2) (xid=0x2): 254 tables
792 0: main : wild=0xfffffffff, max=1000000, active=0"
793 tail -n +3 orig-expout | head -7
794 echo " 1: table1 : wild=0xfffffffff, max= 1024, active=0"
795 tail -n +11 orig-expout) > expout
796 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-tables br0], [0], [expout])
800 AT_SETUP([ofproto - hard limits on flow table size (OpenFLow 1.0)])
802 # Configure a maximum of 4 flows.
805 -- --id=@t0 create Flow_Table flow-limit=4 \
806 -- set bridge br0 flow_tables:0=@t0 \
807 | ${PERL} $srcdir/uuidfilt.pl],
811 for in_port in 1 2 3 4; do
812 ovs-ofctl add-flow br0 in_port=$in_port,actions=drop
814 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
815 in_port=1 actions=drop
816 in_port=2 actions=drop
817 in_port=3 actions=drop
818 in_port=4 actions=drop
821 # Adding another flow will be refused.
822 AT_CHECK([ovs-ofctl add-flow br0 in_port=5,actions=drop], [1], [], [stderr])
823 AT_CHECK([head -n 1 stderr | ofctl_strip], [0],
824 [OFPT_ERROR: OFPFMFC_TABLE_FULL
826 # Also a mod-flow that would add a flow will be refused.
827 AT_CHECK([ovs-ofctl mod-flows br0 in_port=5,actions=drop], [1], [], [stderr])
828 AT_CHECK([head -n 1 stderr | ofctl_strip], [0],
829 [OFPT_ERROR: OFPFMFC_TABLE_FULL
831 # Replacing or modifying an existing flow is allowed.
832 AT_CHECK([ovs-ofctl add-flow br0 in_port=4,actions=normal])
833 AT_CHECK([ovs-ofctl mod-flows br0 in_port=3,actions=output:1])
834 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
835 in_port=1 actions=drop
836 in_port=2 actions=drop
837 in_port=3 actions=output:1
838 in_port=4 actions=NORMAL
844 AT_SETUP([ofproto - hard limits on flow table size (OpenFLow 1.2)])
846 # Configure a maximum of 4 flows.
849 -- --id=@t0 create Flow_Table flow-limit=4 \
850 -- set bridge br0 flow_tables:0=@t0 \
851 | ${PERL} $srcdir/uuidfilt.pl],
855 for in_port in 1 2 3 4; do
856 ovs-ofctl -O OpenFlow12 add-flow br0 in_port=$in_port,actions=drop
858 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
859 in_port=1 actions=drop
860 in_port=2 actions=drop
861 in_port=3 actions=drop
862 in_port=4 actions=drop
863 OFPST_FLOW reply (OF1.2):
865 # Adding another flow will be refused.
866 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 in_port=5,actions=drop], [1], [], [stderr])
867 AT_CHECK([head -n 1 stderr | ofctl_strip], [0],
868 [OFPT_ERROR (OF1.2): OFPFMFC_TABLE_FULL
870 # Replacing or modifying an existing flow is allowed.
871 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 in_port=4,actions=normal])
872 AT_CHECK([ovs-ofctl -O OpenFlow12 mod-flows br0 in_port=3,actions=output:1])
873 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
874 in_port=1 actions=drop
875 in_port=2 actions=drop
876 in_port=3 actions=output:1
877 in_port=4 actions=NORMAL
878 OFPST_FLOW reply (OF1.2):
883 AT_SETUP([ofproto - eviction upon table overflow (OpenFlow 1.0)])
885 # Configure a maximum of 4 flows.
888 -- --id=@t0 create Flow_Table flow-limit=4 overflow-policy=evict \
889 -- set bridge br0 flow_tables:0=@t0 \
890 | ${PERL} $srcdir/uuidfilt.pl],
894 for in_port in 4 3 2 1; do
895 ovs-ofctl add-flow br0 idle_timeout=${in_port}0,in_port=$in_port,actions=drop
897 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
898 idle_timeout=10, in_port=1 actions=drop
899 idle_timeout=20, in_port=2 actions=drop
900 idle_timeout=30, in_port=3 actions=drop
901 idle_timeout=40, in_port=4 actions=drop
904 # Adding another flow will cause the one that expires soonest to be evicted.
905 AT_CHECK([ovs-ofctl add-flow br0 in_port=5,actions=drop])
906 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
907 idle_timeout=20, in_port=2 actions=drop
908 idle_timeout=30, in_port=3 actions=drop
909 idle_timeout=40, in_port=4 actions=drop
910 in_port=5 actions=drop
913 # A mod-flow that adds a flow also causes eviction, but replacing or
914 # modifying an existing flow doesn't.
915 AT_CHECK([ovs-ofctl mod-flows br0 in_port=6,actions=drop])
916 AT_CHECK([ovs-ofctl add-flow br0 in_port=4,actions=normal])
917 AT_CHECK([ovs-ofctl mod-flows br0 in_port=3,actions=output:1])
918 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
919 idle_timeout=30, in_port=3 actions=output:1
920 in_port=4 actions=NORMAL
921 in_port=5 actions=drop
922 in_port=6 actions=drop
925 # Flows with no timeouts at all cannot be evicted.
926 AT_CHECK([ovs-ofctl add-flow br0 in_port=7,actions=normal])
927 AT_CHECK([ovs-ofctl add-flow br0 in_port=8,actions=drop], [1], [], [stderr])
928 AT_CHECK([head -n 1 stderr | ofctl_strip], [0],
929 [OFPT_ERROR: OFPFMFC_TABLE_FULL
931 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
932 in_port=4 actions=NORMAL
933 in_port=5 actions=drop
934 in_port=6 actions=drop
935 in_port=7 actions=NORMAL
941 AT_SETUP([ofproto - eviction upon table overflow (OpenFlow 1.2)])
943 # Configure a maximum of 4 flows.
946 -- --id=@t0 create Flow_Table flow-limit=4 overflow-policy=evict \
947 -- set bridge br0 flow_tables:0=@t0 \
948 | ${PERL} $srcdir/uuidfilt.pl],
952 for in_port in 4 3 2 1; do
953 ovs-ofctl -O OpenFlow12 add-flow br0 idle_timeout=${in_port}0,in_port=$in_port,actions=drop
955 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
956 idle_timeout=10, in_port=1 actions=drop
957 idle_timeout=20, in_port=2 actions=drop
958 idle_timeout=30, in_port=3 actions=drop
959 idle_timeout=40, in_port=4 actions=drop
960 OFPST_FLOW reply (OF1.2):
962 # Adding another flow will cause the one that expires soonest to be evicted.
963 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 in_port=5,actions=drop])
964 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
965 idle_timeout=20, in_port=2 actions=drop
966 idle_timeout=30, in_port=3 actions=drop
967 idle_timeout=40, in_port=4 actions=drop
968 in_port=5 actions=drop
969 OFPST_FLOW reply (OF1.2):
971 # In Open Flow 1.2 a mod-flow does not ever add a flow and thus
972 # has no effect on eviction
973 AT_CHECK([ovs-ofctl -O OpenFlow12 mod-flows br0 in_port=6,actions=drop])
974 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 in_port=4,actions=normal])
975 AT_CHECK([ovs-ofctl -O OpenFlow12 mod-flows br0 in_port=3,actions=output:1])
976 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
977 idle_timeout=20, in_port=2 actions=drop
978 idle_timeout=30, in_port=3 actions=output:1
979 in_port=4 actions=NORMAL
980 in_port=5 actions=drop
981 OFPST_FLOW reply (OF1.2):
983 # Flows with no timeouts at all cannot be evicted.
984 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 in_port=6,actions=drop])
985 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 in_port=7,actions=normal])
986 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 in_port=8,actions=drop], [1], [], [stderr])
987 AT_CHECK([head -n 1 stderr | ofctl_strip], [0],
988 [OFPT_ERROR (OF1.2): OFPFMFC_TABLE_FULL
990 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
991 in_port=4 actions=NORMAL
992 in_port=5 actions=drop
993 in_port=6 actions=drop
994 in_port=7 actions=NORMAL
995 OFPST_FLOW reply (OF1.2):
1000 AT_SETUP([ofproto - eviction upon table overflow, with fairness (OpenFlow 1.0)])
1002 # Configure a maximum of 4 flows.
1005 -- --id=@t0 create Flow_Table name=evict flow-limit=4 \
1006 overflow-policy=evict \
1007 groups='"NXM_OF_IN_PORT[[]]"' \
1008 -- set bridge br0 flow_tables:0=@t0 \
1009 | ${PERL} $srcdir/uuidfilt.pl],
1013 ovs-ofctl add-flows br0 - <<EOF
1014 idle_timeout=10 in_port=2 dl_src=00:44:55:66:77:88 actions=drop
1015 idle_timeout=20 in_port=1 dl_src=00:11:22:33:44:55 actions=drop
1016 idle_timeout=30 in_port=1 dl_src=00:22:33:44:55:66 actions=drop
1017 idle_timeout=40 in_port=1 dl_src=00:33:44:55:66:77 actions=drop
1019 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1020 idle_timeout=10, in_port=2,dl_src=00:44:55:66:77:88 actions=drop
1021 idle_timeout=20, in_port=1,dl_src=00:11:22:33:44:55 actions=drop
1022 idle_timeout=30, in_port=1,dl_src=00:22:33:44:55:66 actions=drop
1023 idle_timeout=40, in_port=1,dl_src=00:33:44:55:66:77 actions=drop
1026 # Adding another flow will cause the one that expires soonest within
1027 # the largest group (those with in_port=1) to be evicted. In this
1028 # case this is not the same as the one that expires soonest overall
1029 # (which is what makes the test interesting):
1030 AT_CHECK([ovs-ofctl add-flow br0 in_port=2,dl_src=00:55:66:77:88:99,actions=drop])
1031 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1032 idle_timeout=10, in_port=2,dl_src=00:44:55:66:77:88 actions=drop
1033 idle_timeout=30, in_port=1,dl_src=00:22:33:44:55:66 actions=drop
1034 idle_timeout=40, in_port=1,dl_src=00:33:44:55:66:77 actions=drop
1035 in_port=2,dl_src=00:55:66:77:88:99 actions=drop
1038 # Enlarge the flow limit, change the eviction policy back to strictly
1039 # based on expiration, and and add some flows.
1040 AT_CHECK([ovs-vsctl set Flow_Table evict groups='[[]]' flow-limit=7])
1041 ovs-ofctl add-flows br0 - <<EOF
1042 idle_timeout=50 in_port=2 dl_src=00:66:77:88:99:aa actions=drop
1043 idle_timeout=60 in_port=2 dl_src=00:77:88:99:aa:bb actions=drop
1044 idle_timeout=70 in_port=2 dl_src=00:88:99:aa:bb:cc actions=drop
1046 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1047 idle_timeout=10, in_port=2,dl_src=00:44:55:66:77:88 actions=drop
1048 idle_timeout=30, in_port=1,dl_src=00:22:33:44:55:66 actions=drop
1049 idle_timeout=40, in_port=1,dl_src=00:33:44:55:66:77 actions=drop
1050 idle_timeout=50, in_port=2,dl_src=00:66:77:88:99:aa actions=drop
1051 idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=drop
1052 idle_timeout=70, in_port=2,dl_src=00:88:99:aa:bb:cc actions=drop
1053 in_port=2,dl_src=00:55:66:77:88:99 actions=drop
1056 # Adding another flow will cause the one that expires soonest overall
1058 AT_CHECK([ovs-ofctl add-flow br0 'idle_timeout=80 in_port=2 dl_src=00:99:aa:bb:cc:dd actions=drop'])
1059 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1060 idle_timeout=30, in_port=1,dl_src=00:22:33:44:55:66 actions=drop
1061 idle_timeout=40, in_port=1,dl_src=00:33:44:55:66:77 actions=drop
1062 idle_timeout=50, in_port=2,dl_src=00:66:77:88:99:aa actions=drop
1063 idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=drop
1064 idle_timeout=70, in_port=2,dl_src=00:88:99:aa:bb:cc actions=drop
1065 idle_timeout=80, in_port=2,dl_src=00:99:aa:bb:cc:dd actions=drop
1066 in_port=2,dl_src=00:55:66:77:88:99 actions=drop
1069 # Reducing the flow limit also causes the flows that expire soonest
1070 # overall to be evicted.
1071 AT_CHECK([ovs-vsctl set Flow_Table evict flow-limit=4])
1072 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
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
1075 idle_timeout=80, in_port=2,dl_src=00:99:aa:bb:cc:dd actions=drop
1076 in_port=2,dl_src=00:55:66:77:88:99 actions=drop
1082 AT_SETUP([ofproto - eviction upon table overflow, with fairness (OpenFlow 1.2)])
1084 # Configure a maximum of 4 flows.
1087 -- --id=@t0 create Flow_Table name=evict flow-limit=4 \
1088 overflow-policy=evict \
1089 groups='"NXM_OF_IN_PORT[[]]"' \
1090 -- set bridge br0 flow_tables:0=@t0 \
1091 | ${PERL} $srcdir/uuidfilt.pl],
1095 ovs-ofctl -O OpenFlow12 add-flows br0 - <<EOF
1096 idle_timeout=10 in_port=2 dl_src=00:44:55:66:77:88 actions=drop
1097 idle_timeout=20 in_port=1 dl_src=00:11:22:33:44:55 actions=drop
1098 idle_timeout=30 in_port=1 dl_src=00:22:33:44:55:66 actions=drop
1099 idle_timeout=40 in_port=1 dl_src=00:33:44:55:66:77 actions=drop
1101 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1102 idle_timeout=10, in_port=2,dl_src=00:44:55:66:77:88 actions=drop
1103 idle_timeout=20, in_port=1,dl_src=00:11:22:33:44:55 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 OFPST_FLOW reply (OF1.2):
1108 # Adding another flow will cause the one that expires soonest within
1109 # the largest group (those with in_port=1) to be evicted. In this
1110 # case this is not the same as the one that expires soonest overall
1111 # (which is what makes the test interesting):
1112 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 in_port=2,dl_src=00:55:66:77:88:99,actions=drop])
1113 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1114 idle_timeout=10, in_port=2,dl_src=00:44:55:66:77:88 actions=drop
1115 idle_timeout=30, in_port=1,dl_src=00:22:33:44:55:66 actions=drop
1116 idle_timeout=40, in_port=1,dl_src=00:33:44:55:66:77 actions=drop
1117 in_port=2,dl_src=00:55:66:77:88:99 actions=drop
1118 OFPST_FLOW reply (OF1.2):
1120 # Enlarge the flow limit, change the eviction policy back to strictly
1121 # based on expiration, and and add some flows.
1122 AT_CHECK([ovs-vsctl set Flow_Table evict groups='[[]]' flow-limit=7])
1123 ovs-ofctl -O OpenFlow12 add-flows br0 - <<EOF
1124 idle_timeout=50 in_port=2 dl_src=00:66:77:88:99:aa actions=drop
1125 idle_timeout=60 in_port=2 dl_src=00:77:88:99:aa:bb actions=drop
1126 idle_timeout=70 in_port=2 dl_src=00:88:99:aa:bb:cc actions=drop
1128 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1129 idle_timeout=10, in_port=2,dl_src=00:44:55:66:77:88 actions=drop
1130 idle_timeout=30, in_port=1,dl_src=00:22:33:44:55:66 actions=drop
1131 idle_timeout=40, in_port=1,dl_src=00:33:44:55:66:77 actions=drop
1132 idle_timeout=50, in_port=2,dl_src=00:66:77:88:99:aa actions=drop
1133 idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=drop
1134 idle_timeout=70, in_port=2,dl_src=00:88:99:aa:bb:cc actions=drop
1135 in_port=2,dl_src=00:55:66:77:88:99 actions=drop
1136 OFPST_FLOW reply (OF1.2):
1138 # Adding another flow will cause the one that expires soonest overall
1140 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'])
1141 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1142 idle_timeout=30, in_port=1,dl_src=00:22:33:44:55:66 actions=drop
1143 idle_timeout=40, in_port=1,dl_src=00:33:44:55:66:77 actions=drop
1144 idle_timeout=50, in_port=2,dl_src=00:66:77:88:99:aa actions=drop
1145 idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=drop
1146 idle_timeout=70, in_port=2,dl_src=00:88:99:aa:bb:cc actions=drop
1147 idle_timeout=80, in_port=2,dl_src=00:99:aa:bb:cc:dd actions=drop
1148 in_port=2,dl_src=00:55:66:77:88:99 actions=drop
1149 OFPST_FLOW reply (OF1.2):
1151 # Reducing the flow limit also causes the flows that expire soonest
1152 # overall to be evicted.
1153 AT_CHECK([ovs-vsctl set Flow_Table evict flow-limit=4])
1154 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
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
1157 idle_timeout=80, in_port=2,dl_src=00:99:aa:bb:cc:dd actions=drop
1158 in_port=2,dl_src=00:55:66:77:88:99 actions=drop
1159 OFPST_FLOW reply (OF1.2):
1164 AT_SETUP([ofproto - asynchronous message control (OpenFlow 1.0)])
1166 AT_CHECK([ovs-ofctl -P openflow10 monitor br0 --detach --no-chdir --pidfile])
1168 printf '\n\n--- check_async %d ---\n\n\n' $1
1171 ovs-appctl -t ovs-ofctl ofctl/barrier
1172 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
1175 # OFPT_PACKET_IN, OFPR_ACTION (controller_id=0)
1176 ovs-ofctl -v packet-out br0 controller controller '0001020304050010203040501234'
1177 if test X"$1" = X"OFPR_ACTION"; then shift;
1178 echo >>expout "OFPT_PACKET_IN: total_len=14 in_port=CONTROLLER (via action) data_len=14 (unbuffered)
1179 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"
1182 # OFPT_PACKET_IN, OFPR_NO_MATCH (controller_id=123)
1183 ovs-ofctl -v packet-out br0 controller 'controller(reason=no_match,id=123)' '0001020304050010203040501234'
1184 if test X"$1" = X"OFPR_NO_MATCH"; then shift;
1185 echo >>expout "OFPT_PACKET_IN: total_len=14 in_port=CONTROLLER (via no_match) data_len=14 (unbuffered)
1186 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"
1189 # OFPT_PACKET_IN, OFPR_INVALID_TTL (controller_id=0)
1190 ovs-ofctl packet-out br0 controller dec_ttl '002583dfb4000026b98cb0f908004500003fb7e200000011339bac11370dac100002d7730035002b8f6d86fb0100000100000000000006626c702d7873066e696369726103636f6d00000f00'
1191 if test X"$1" = X"OFPR_INVALID_TTL"; then shift;
1192 echo >>expout "OFPT_PACKET_IN: total_len=76 in_port=CONTROLLER (via invalid_ttl) data_len=76 (unbuffered)
1193 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"
1196 # OFPT_PORT_STATUS, OFPPR_ADD
1197 ovs-vsctl add-port br0 test -- set Interface test type=dummy ofport_request=1
1198 if test X"$1" = X"OFPPR_ADD"; then shift;
1199 echo >>expout "OFPT_PORT_STATUS: ADD: 1(test): addr:aa:55:aa:55:00:0x
1202 speed: 0 Mbps now, 0 Mbps max"
1205 # OFPT_PORT_STATUS, OFPPR_DELETE
1206 ovs-vsctl del-port br0 test
1207 if test X"$1" = X"OFPPR_DELETE"; then shift;
1208 echo >>expout "OFPT_PORT_STATUS: DEL: 1(test): addr:aa:55:aa:55:00:0x
1211 speed: 0 Mbps now, 0 Mbps max"
1214 # OFPT_FLOW_REMOVED, OFPRR_DELETE
1215 ovs-ofctl add-flow br0 send_flow_rem,actions=drop
1216 ovs-ofctl --strict del-flows br0 ''
1217 if test X"$1" = X"OFPRR_DELETE"; then shift;
1218 echo >>expout "OFPT_FLOW_REMOVED: reason=delete"
1220 AT_FAIL_IF([test X"$1" != X])
1222 ovs-appctl -t ovs-ofctl ofctl/barrier
1223 echo >>expout "OFPT_BARRIER_REPLY:"
1227 s/ (xid=0x[0-9a-fA-F]*)//
1229 s/00:0.$/00:0x/' < monitor.log]],
1233 # It's a service connection so initially there should be no async messages.
1236 # Set miss_send_len to 128, turning on packet-ins for our service connection.
1237 ovs-appctl -t ovs-ofctl ofctl/send 0109000c0123456700000080
1238 check_async 2 OFPR_ACTION OFPPR_ADD OFPPR_DELETE OFPRR_DELETE
1240 # Set miss_send_len to 128 and enable invalid_ttl.
1241 ovs-appctl -t ovs-ofctl ofctl/send 0109000c0123456700040080
1242 check_async 3 OFPR_ACTION OFPR_INVALID_TTL OFPPR_ADD OFPPR_DELETE OFPRR_DELETE
1244 # Become slave, which should disable everything except port status.
1245 ovs-appctl -t ovs-ofctl ofctl/send 0104001400000002000023200000000a00000002
1246 check_async 4 OFPPR_ADD OFPPR_DELETE
1248 # Use NXT_SET_ASYNC_CONFIG to enable a patchwork of asynchronous messages.
1249 ovs-appctl -t ovs-ofctl ofctl/send 01040028000000020000232000000013000000020000000500000005000000020000000200000005
1250 check_async 5 OFPR_INVALID_TTL OFPPR_DELETE OFPRR_DELETE
1252 # Set controller ID 123.
1253 ovs-appctl -t ovs-ofctl ofctl/send 01040018000000030000232000000014000000000000007b
1254 check_async 6 OFPR_NO_MATCH OFPPR_DELETE OFPRR_DELETE
1256 # Restore controller ID 0.
1257 ovs-appctl -t ovs-ofctl ofctl/send 010400180000000300002320000000140000000000000000
1260 ovs-appctl -t ovs-ofctl ofctl/send 0104001400000002000023200000000a00000001
1261 check_async 7 OFPR_ACTION OFPPR_ADD
1263 ovs-appctl -t ovs-ofctl exit
1267 AT_SETUP([ofproto - asynchronous message control (OpenFlow 1.2)])
1269 AT_CHECK([ovs-ofctl -O OpenFlow12 monitor br0 --detach --no-chdir --pidfile])
1271 printf '\n\n--- check_async %d ---\n\n\n' $1
1275 ovs-appctl -t ovs-ofctl ofctl/barrier
1276 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
1279 # OFPT_PACKET_IN, OFPR_ACTION (controller_id=0)
1280 ovs-ofctl -O OpenFlow12 -v packet-out br0 none controller '0001020304050010203040501234'
1281 if test X"$1" = X"OFPR_ACTION"; then shift;
1282 echo >>expout "OFPT_PACKET_IN (OF1.2): total_len=14 in_port=ANY (via action) data_len=14 (unbuffered)
1283 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"
1286 # OFPT_PACKET_IN, OFPR_NO_MATCH (controller_id=123)
1287 ovs-ofctl -O OpenFlow12 -v packet-out br0 none 'controller(reason=no_match,id=123)' '0001020304050010203040501234'
1288 if test X"$1" = X"OFPR_NO_MATCH"; then shift;
1289 echo >>expout "OFPT_PACKET_IN (OF1.2): total_len=14 in_port=ANY (via no_match) data_len=14 (unbuffered)
1290 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"
1293 # OFPT_PACKET_IN, OFPR_INVALID_TTL (controller_id=0)
1294 ovs-ofctl -O OpenFlow12 packet-out br0 none dec_ttl '002583dfb4000026b98cb0f908004500003fb7e200000011339bac11370dac100002d7730035002b8f6d86fb0100000100000000000006626c702d7873066e696369726103636f6d00000f00'
1295 if test X"$1" = X"OFPR_INVALID_TTL"; then shift;
1296 echo >>expout "OFPT_PACKET_IN (OF1.2): total_len=76 in_port=ANY (via invalid_ttl) data_len=76 (unbuffered)
1297 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"
1300 # OFPT_PORT_STATUS, OFPPR_ADD
1301 ovs-vsctl add-port br0 test -- set Interface test type=dummy
1302 if test X"$1" = X"OFPPR_ADD"; then shift;
1303 echo >>expout "OFPT_PORT_STATUS (OF1.2): ADD: ${INDEX}(test): addr:aa:55:aa:55:00:0x
1306 speed: 0 Mbps now, 0 Mbps max"
1309 # OFPT_PORT_STATUS, OFPPR_DELETE
1310 ovs-vsctl del-port br0 test
1311 if test X"$1" = X"OFPPR_DELETE"; then shift;
1312 echo >>expout "OFPT_PORT_STATUS (OF1.2): DEL: ${INDEX}(test): addr:aa:55:aa:55:00:0x
1315 speed: 0 Mbps now, 0 Mbps max"
1318 # OFPT_FLOW_REMOVED, OFPRR_DELETE
1319 ovs-ofctl -O OpenFlow12 add-flow br0 send_flow_rem,actions=drop
1320 ovs-ofctl -O OpenFlow12 --strict del-flows br0 ''
1321 if test X"$1" = X"OFPRR_DELETE"; then shift;
1322 echo >>expout "OFPT_FLOW_REMOVED (OF1.2): reason=delete table_id=0"
1324 AT_FAIL_IF([test X"$1" != X])
1326 ovs-appctl -t ovs-ofctl ofctl/barrier
1327 echo >>expout "OFPT_BARRIER_REPLY (OF1.2):"
1331 s/ (xid=0x[0-9a-fA-F]*)//
1333 s/00:0.$/00:0x/' < monitor.log]],
1337 # It's a service connection so initially there should be no async messages.
1340 # Set miss_send_len to 128, turning on packet-ins for our service connection.
1341 ovs-appctl -t ovs-ofctl ofctl/send 0309000c0123456700000080
1342 check_async 2 OFPR_ACTION OFPPR_ADD OFPPR_DELETE OFPRR_DELETE
1344 # Set miss_send_len to 128 and enable invalid_ttl.
1345 ovs-appctl -t ovs-ofctl ofctl/send 0309000c0123456700040080
1346 check_async 3 OFPR_ACTION OFPR_INVALID_TTL OFPPR_ADD OFPPR_DELETE OFPRR_DELETE
1348 # Become slave (OF 1.2), which should disable everything except port status.
1349 ovs-appctl -t ovs-ofctl ofctl/send 031800180000000200000003000000000000000000000001
1350 check_async 4 OFPPR_ADD OFPPR_DELETE
1352 # Use NXT_SET_ASYNC_CONFIG to enable a patchwork of asynchronous messages.
1353 ovs-appctl -t ovs-ofctl ofctl/send 03040028000000020000232000000013000000020000000500000005000000020000000200000005
1354 check_async 5 OFPR_INVALID_TTL OFPPR_DELETE OFPRR_DELETE
1356 # Set controller ID 123.
1357 ovs-appctl -t ovs-ofctl ofctl/send 03040018000000030000232000000014000000000000007b
1358 check_async 6 OFPR_NO_MATCH OFPPR_DELETE OFPRR_DELETE
1360 # Restore controller ID 0.
1361 ovs-appctl -t ovs-ofctl ofctl/send 030400180000000300002320000000140000000000000000
1363 # Become master (OF 1.2).
1364 ovs-appctl -t ovs-ofctl ofctl/send 031800180000000400000002000000000000000000000002
1365 check_async 7 OFPR_ACTION OFPPR_ADD
1367 ovs-appctl -t ovs-ofctl exit
1371 AT_SETUP([ofproto - asynchronous message control (OpenFlow 1.3)])
1373 AT_CHECK([ovs-ofctl -O OpenFlow13 monitor br0 --detach --no-chdir --pidfile])
1375 printf '\n\n--- check_async %d ---\n\n\n' $1
1379 ovs-appctl -t ovs-ofctl ofctl/barrier
1380 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
1383 # OFPT_PACKET_IN, OFPR_ACTION (controller_id=0)
1384 ovs-ofctl -O OpenFlow13 -v packet-out br0 none controller '0001020304050010203040501234'
1385 if test X"$1" = X"OFPR_ACTION"; then shift;
1386 echo >>expout "OFPT_PACKET_IN (OF1.3): total_len=14 in_port=ANY (via action) data_len=14 (unbuffered)
1387 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"
1390 # OFPT_PACKET_IN, OFPR_NO_MATCH (controller_id=123)
1391 ovs-ofctl -O OpenFlow13 -v packet-out br0 none 'controller(reason=no_match,id=123)' '0001020304050010203040501234'
1392 if test X"$1" = X"OFPR_NO_MATCH"; then shift;
1393 echo >>expout "OFPT_PACKET_IN (OF1.3): total_len=14 in_port=ANY (via no_match) data_len=14 (unbuffered)
1394 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"
1397 # OFPT_PACKET_IN, OFPR_INVALID_TTL (controller_id=0)
1398 ovs-ofctl -O OpenFlow13 packet-out br0 none dec_ttl '002583dfb4000026b98cb0f908004500003fb7e200000011339bac11370dac100002d7730035002b8f6d86fb0100000100000000000006626c702d7873066e696369726103636f6d00000f00'
1399 if test X"$1" = X"OFPR_INVALID_TTL"; then shift;
1400 echo >>expout "OFPT_PACKET_IN (OF1.3): total_len=76 in_port=ANY (via invalid_ttl) data_len=76 (unbuffered)
1401 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"
1404 # OFPT_PORT_STATUS, OFPPR_ADD
1405 ovs-vsctl add-port br0 test -- set Interface test type=dummy
1406 if test X"$1" = X"OFPPR_ADD"; then shift;
1407 echo >>expout "OFPT_PORT_STATUS (OF1.3): ADD: ${INDEX}(test): addr:aa:55:aa:55:00:0x
1410 speed: 0 Mbps now, 0 Mbps max"
1413 # OFPT_PORT_STATUS, OFPPR_DELETE
1414 ovs-vsctl del-port br0 test
1415 if test X"$1" = X"OFPPR_DELETE"; then shift;
1416 echo >>expout "OFPT_PORT_STATUS (OF1.3): DEL: ${INDEX}(test): addr:aa:55:aa:55:00:0x
1419 speed: 0 Mbps now, 0 Mbps max"
1422 # OFPT_FLOW_REMOVED, OFPRR_DELETE
1423 ovs-ofctl -O OpenFlow13 add-flow br0 send_flow_rem,actions=drop
1424 ovs-ofctl -O OpenFlow13 --strict del-flows br0 ''
1425 if test X"$1" = X"OFPRR_DELETE"; then shift;
1426 echo >>expout "OFPT_FLOW_REMOVED (OF1.3): reason=delete table_id=0"
1428 AT_FAIL_IF([test X"$1" != X])
1430 ovs-appctl -t ovs-ofctl ofctl/barrier
1431 echo >>expout "OFPT_BARRIER_REPLY (OF1.3):"
1435 s/ (xid=0x[0-9a-fA-F]*)//
1437 s/00:0.$/00:0x/' < monitor.log]],
1441 # It's a service connection so initially there should be no async messages.
1444 # Set miss_send_len to 128, turning on packet-ins for our service connection.
1445 ovs-appctl -t ovs-ofctl ofctl/send 0409000c0123456700000080
1446 check_async 2 OFPR_ACTION OFPPR_ADD OFPPR_DELETE OFPRR_DELETE
1448 # Become slave (OF 1.3), which should disable everything except port status.
1449 ovs-appctl -t ovs-ofctl ofctl/send 041800180000000200000003000000000000000000000001
1450 check_async 3 OFPPR_ADD OFPPR_DELETE
1452 # Use OF 1.3 OFPT_SET_ASYNC to enable a patchwork of asynchronous messages.
1453 ovs-appctl -t ovs-ofctl ofctl/send 041c002000000002000000020000000500000005000000020000000200000005
1454 check_async 4 OFPR_INVALID_TTL OFPPR_DELETE OFPRR_DELETE
1456 # Set controller ID 123.
1457 ovs-appctl -t ovs-ofctl ofctl/send 04040018000000030000232000000014000000000000007b
1458 check_async 5 OFPR_NO_MATCH OFPPR_DELETE OFPRR_DELETE
1460 # Restore controller ID 0.
1461 ovs-appctl -t ovs-ofctl ofctl/send 040400180000000300002320000000140000000000000000
1463 # Become master (OF 1.3).
1464 ovs-appctl -t ovs-ofctl ofctl/send 041800180000000400000002000000000000000000000002
1465 check_async 6 OFPR_ACTION OFPPR_ADD
1467 ovs-appctl -t ovs-ofctl exit
1471 dnl This test checks that the role request/response messaging works
1472 dnl and that generation_id is handled properly.
1473 AT_SETUP([ofproto - controller role (OpenFlow 1.2)])
1475 AT_CHECK([ovs-ofctl -O OpenFlow12 monitor br0 --detach --no-chdir --pidfile])
1477 ovs-appctl -t ovs-ofctl ofctl/barrier
1478 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
1481 # find out current role
1482 ovs-appctl -t ovs-ofctl ofctl/send 031800180000000200000000000000000000000000000000
1483 echo >>expout "send: OFPT_ROLE_REQUEST (OF1.2) (xid=0x2): role=nochange"
1484 echo >>expout "OFPT_ROLE_REPLY (OF1.2) (xid=0x2): role=equal"
1486 # Become slave (generation_id is initially undefined, so 2^63+2 should not be stale)
1487 ovs-appctl -t ovs-ofctl ofctl/send 031800180000000300000003000000008000000000000002
1488 echo >>expout "send: OFPT_ROLE_REQUEST (OF1.2) (xid=0x3): role=slave generation_id=9223372036854775810"
1489 echo >>expout "OFPT_ROLE_REPLY (OF1.2) (xid=0x3): role=slave generation_id=9223372036854775810"
1491 # Try to become the master using a stale generation ID
1492 ovs-appctl -t ovs-ofctl ofctl/send 031800180000000400000002000000000000000000000002
1493 echo >>expout "send: OFPT_ROLE_REQUEST (OF1.2) (xid=0x4): role=master generation_id=2"
1494 echo >>expout "OFPT_ERROR (OF1.2) (xid=0x4): OFPRRFC_STALE"
1495 echo >>expout "OFPT_ROLE_REQUEST (OF1.2) (xid=0x4): role=master generation_id=2"
1497 # Become master using a valid generation ID
1498 ovs-appctl -t ovs-ofctl ofctl/send 031800180000000500000002000000000000000000000001
1499 echo >>expout "send: OFPT_ROLE_REQUEST (OF1.2) (xid=0x5): role=master generation_id=1"
1500 echo >>expout "OFPT_ROLE_REPLY (OF1.2) (xid=0x5): role=master generation_id=1"
1501 ovs-appctl -t ovs-ofctl ofctl/barrier
1502 echo >>expout "OFPT_BARRIER_REPLY (OF1.2) (xid=0x3):"
1504 AT_CHECK([cat monitor.log], [0], [expout])
1506 ovs-appctl -t ovs-ofctl exit
1510 dnl This test checks that OFPT_PACKET_OUT accepts both OFPP_NONE (as
1511 dnl specified by OpenFlow 1.0) and OFPP_CONTROLLER (used by some
1512 dnl controllers despite the spec) as meaning a packet that was generated
1513 dnl by the controller.
1514 AT_SETUP([ofproto - packet-out from controller (OpenFlow 1.0)])
1516 ADD_OF_PORTS([br0], [1])
1518 # Start a monitor listening for packet-ins.
1519 AT_CHECK([ovs-ofctl -P openflow10 monitor br0 --detach --no-chdir --pidfile])
1520 ovs-appctl -t ovs-ofctl ofctl/send 0109000c0123456700000080
1521 ovs-appctl -t ovs-ofctl ofctl/barrier
1522 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
1523 AT_CAPTURE_FILE([monitor.log])
1525 # Send some packet-outs with OFPP_NONE and OFPP_CONTROLLER (65533) as in_port.
1526 AT_CHECK([ovs-ofctl packet-out br0 none controller,1 '0001020304050010203040501234'])
1527 AT_CHECK([ovs-ofctl packet-out br0 controller controller,1 '0001020304050010203040505678'])
1529 # Stop the monitor and check its output.
1530 ovs-appctl -t ovs-ofctl ofctl/barrier
1531 ovs-appctl -t ovs-ofctl exit
1533 ovs-ofctl dump-ports br0
1535 AT_CHECK([sed 's/ (xid=0x[[0-9a-fA-F]]*)//' monitor.log], [0], [dnl
1536 OFPT_PACKET_IN: total_len=14 in_port=ANY (via action) data_len=14 (unbuffered)
1537 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
1538 OFPT_PACKET_IN: total_len=14 in_port=CONTROLLER (via action) data_len=14 (unbuffered)
1539 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
1546 dnl This test checks that OFPT_PACKET_OUT accepts both OFPP_NONE (as
1547 dnl specified by OpenFlow 1.2) and OFPP_CONTROLLER (used by some
1548 dnl controllers despite the spec) as meaning a packet that was generated
1549 dnl by the controller.
1550 AT_SETUP([ofproto - packet-out from controller (OpenFlow 1.2)])
1553 # Start a monitor listening for packet-ins.
1554 AT_CHECK([ovs-ofctl -O OpenFlow12 monitor br0 --detach --no-chdir --pidfile])
1555 ovs-appctl -t ovs-ofctl ofctl/send 0309000c0123456700000080
1556 ovs-appctl -t ovs-ofctl ofctl/barrier
1557 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
1558 AT_CAPTURE_FILE([monitor.log])
1560 # Send some packet-outs with OFPP_NONE and OFPP_CONTROLLER (65533) as in_port.
1561 AT_CHECK([ovs-ofctl -O OpenFlow12 packet-out br0 none controller '0001020304050010203040501234'])
1562 AT_CHECK([ovs-ofctl -O OpenFlow12 packet-out br0 4294967293 controller '0001020304050010203040505678'])
1564 # Stop the monitor and check its output.
1565 ovs-appctl -t ovs-ofctl ofctl/barrier
1566 ovs-appctl -t ovs-ofctl exit
1568 AT_CHECK([sed 's/ (xid=0x[[0-9a-fA-F]]*)//' monitor.log], [0], [dnl
1569 OFPT_PACKET_IN (OF1.2): total_len=14 in_port=ANY (via action) data_len=14 (unbuffered)
1570 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
1571 OFPT_PACKET_IN (OF1.2): total_len=14 in_port=CONTROLLER (via action) data_len=14 (unbuffered)
1572 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
1573 OFPT_BARRIER_REPLY (OF1.2):
1579 dnl This test checks that metadata is encoded in packet_in structures,
1580 dnl supported by NXAST.
1581 AT_SETUP([ofproto - packet-out with metadata (NXM)])
1584 # Start a monitor listening for packet-ins.
1585 AT_CHECK([ovs-ofctl -P nxm monitor br0 --detach --no-chdir --pidfile])
1586 ovs-appctl -t ovs-ofctl ofctl/send 0109000c0123456700000080
1587 ovs-appctl -t ovs-ofctl ofctl/barrier
1588 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
1589 AT_CAPTURE_FILE([monitor.log])
1591 # Send a packet-out with a load action to set some metadata, and forward to controller
1592 AT_CHECK([ovs-ofctl packet-out br0 controller 'load(0xfafafafa5a5a5a5a->OXM_OF_METADATA[[0..63]]), load(0xaa->NXM_NX_PKT_MARK[[]]), controller' '0001020304050010203040501234'])
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 NXT_PACKET_IN: total_len=14 in_port=CONTROLLER metadata=0xfafafafa5a5a5a5a pkt_mark=0xaa (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
1607 dnl This test checks that metadata is encoded in packet_in structures,
1608 dnl supported by NXAST.
1609 AT_SETUP([ofproto - packet-out with metadata (OpenFlow 1.2)])
1612 # Start a monitor listening for packet-ins.
1613 AT_CHECK([ovs-ofctl -O OpenFlow12 monitor br0 --detach --no-chdir --pidfile])
1614 ovs-appctl -t ovs-ofctl ofctl/send 0309000c0123456700000080
1615 ovs-appctl -t ovs-ofctl ofctl/barrier
1616 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
1617 AT_CAPTURE_FILE([monitor.log])
1619 # Send a packet-out with a load action to set some metadata, and forward to controller
1620 AT_CHECK([ovs-ofctl -O OpenFlow12 packet-out br0 none 'load(0xfafafafa5a5a5a5a->OXM_OF_METADATA[[0..63]]), controller' '0001020304050010203040501234'])
1622 # Stop the monitor and check its output.
1623 ovs-appctl -t ovs-ofctl ofctl/barrier
1624 ovs-appctl -t ovs-ofctl exit
1626 AT_CHECK([sed 's/ (xid=0x[[0-9a-fA-F]]*)//' monitor.log], [0], [dnl
1627 OFPT_PACKET_IN (OF1.2): total_len=14 in_port=ANY metadata=0xfafafafa5a5a5a5a (via action) data_len=14 (unbuffered)
1628 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
1629 OFPT_BARRIER_REPLY (OF1.2):
1635 dnl This test checks that tunnel metadata is encoded in packet_in structures.
1636 AT_SETUP([ofproto - packet-out with tunnel metadata (OpenFlow 1.2)])
1639 # Start a monitor listening for packet-ins.
1640 AT_CHECK([ovs-ofctl -O OpenFlow12 monitor br0 --detach --no-chdir --pidfile])
1641 ovs-appctl -t ovs-ofctl ofctl/send 0309000c0123456700000080
1642 ovs-appctl -t ovs-ofctl ofctl/barrier
1643 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
1644 AT_CAPTURE_FILE([monitor.log])
1646 # Send a packet-out with set field actions to set some tunnel metadata, and forward to controller
1647 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'])
1649 # Stop the monitor and check its output.
1650 ovs-appctl -t ovs-ofctl ofctl/barrier
1651 ovs-appctl -t ovs-ofctl exit
1653 AT_CHECK([sed 's/ (xid=0x[[0-9a-fA-F]]*)//' monitor.log], [0], [dnl
1654 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)
1655 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
1656 OFPT_BARRIER_REPLY (OF1.2):
1662 AT_SETUP([ofproto - flow monitoring])
1663 AT_KEYWORDS([monitor])
1666 ovs-ofctl add-flow br0 in_port=0,dl_vlan=123,actions=output:1
1668 # Start a monitor watching the flow table and check the initial reply.
1669 ovs-ofctl monitor br0 watch: --detach --no-chdir --pidfile >monitor.log 2>&1
1670 AT_CAPTURE_FILE([monitor.log])
1671 ovs-appctl -t ovs-ofctl ofctl/barrier
1672 AT_CHECK([sed 's/ (xid=0x[[1-9a-fA-F]][[0-9a-fA-F]]*)//' monitor.log], [0],
1673 [NXST_FLOW_MONITOR reply:
1674 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=123 actions=output:1
1678 # Add, delete, and modify some flows and check the updates.
1679 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
1680 ovs-ofctl add-flow br0 in_port=0,dl_vlan=124,actions=output:2
1681 ovs-ofctl add-flow br0 in_port=0,dl_vlan=123,actions=output:5
1682 ovs-ofctl add-flow br0 in_port=0,dl_vlan=123,dl_vlan_pcp=0,actions=output:6
1683 ovs-ofctl add-flow br0 in_port=0,dl_vlan=123,dl_vlan_pcp=1,actions=output:7
1684 ovs-ofctl add-flow br0 in_port=0,dl_vlan=123,actions=output:8
1685 ovs-ofctl add-flow br0 in_port=0,dl_vlan=65535,dl_vlan_pcp=0,actions=output:9
1686 ovs-ofctl add-flow br0 in_port=0,dl_vlan=65535,dl_vlan_pcp=1,actions=output:10
1687 ovs-ofctl add-flow br0 in_port=0,dl_vlan=65535,actions=output:11
1688 ovs-ofctl add-flow br0 in_port=0,dl_vlan=8191,dl_vlan_pcp=0,actions=output:12
1689 ovs-ofctl add-flow br0 in_port=0,dl_vlan=8191,dl_vlan_pcp=1,actions=output:13
1690 ovs-ofctl add-flow br0 in_port=0,dl_vlan=8191,actions=output:14
1691 ovs-ofctl add-flow br0 in_port=0,dl_vlan=0,dl_vlan_pcp=0,actions=output:15
1692 ovs-ofctl add-flow br0 in_port=0,dl_vlan=0,dl_vlan_pcp=1,actions=output:16
1693 ovs-ofctl add-flow br0 in_port=0,dl_vlan=0,actions=output:17
1694 ovs-ofctl add-flow br0 in_port=0,dl_vlan=0,dl_vlan_pcp=0,actions=output:18
1695 ovs-ofctl add-flow br0 in_port=0,dl_vlan=0,dl_vlan_pcp=1,actions=output:19
1696 ovs-ofctl add-flow br0 in_port=0,dl_vlan=0,actions=output:20
1697 ovs-ofctl add-flow br0 in_port=0,dl_vlan_pcp=0,actions=output:21
1698 ovs-ofctl add-flow br0 in_port=0,dl_vlan_pcp=1,actions=output:22
1699 ovs-ofctl add-flow br0 in_port=0,actions=output:23
1700 ovs-ofctl mod-flows br0 cookie=5,dl_vlan=123,actions=output:3
1701 ovs-ofctl del-flows br0 dl_vlan=123
1702 ovs-ofctl del-flows br0
1703 ovs-appctl -t ovs-ofctl ofctl/barrier
1705 # Sorts groups of lines that start with a space, without moving them
1706 # past the nearest line that does not start with a space.
1714 print $_ foreach sort(@buffer);
1719 print $_ foreach sort(@buffer);
1721 AT_CHECK([sed 's/ (xid=0x[[1-9a-fA-F]][[0-9a-fA-F]]*)//' monitor.log | ${PERL} -e "$sort"], [0],
1722 [NXST_FLOW_MONITOR reply (xid=0x0):
1723 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=124 actions=output:2
1724 NXST_FLOW_MONITOR reply (xid=0x0):
1725 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=123 actions=output:5
1726 NXST_FLOW_MONITOR reply (xid=0x0):
1727 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=123,dl_vlan_pcp=0 actions=output:6
1728 NXST_FLOW_MONITOR reply (xid=0x0):
1729 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=123,dl_vlan_pcp=1 actions=output:7
1730 NXST_FLOW_MONITOR reply (xid=0x0):
1731 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=123 actions=output:8
1732 NXST_FLOW_MONITOR reply (xid=0x0):
1733 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=0,dl_vlan_pcp=0 actions=output:9
1734 NXST_FLOW_MONITOR reply (xid=0x0):
1735 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=0,dl_vlan_pcp=1 actions=output:10
1736 NXST_FLOW_MONITOR reply (xid=0x0):
1737 event=ADDED table=0 cookie=0 in_port=0,vlan_tci=0x0000 actions=output:11
1738 NXST_FLOW_MONITOR reply (xid=0x0):
1739 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=4095,dl_vlan_pcp=0 actions=output:12
1740 NXST_FLOW_MONITOR reply (xid=0x0):
1741 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=4095,dl_vlan_pcp=1 actions=output:13
1742 NXST_FLOW_MONITOR reply (xid=0x0):
1743 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=4095 actions=output:14
1744 NXST_FLOW_MONITOR reply (xid=0x0):
1745 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=0,dl_vlan_pcp=0 actions=output:15
1746 NXST_FLOW_MONITOR reply (xid=0x0):
1747 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=0,dl_vlan_pcp=1 actions=output:16
1748 NXST_FLOW_MONITOR reply (xid=0x0):
1749 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=0 actions=output:17
1750 NXST_FLOW_MONITOR reply (xid=0x0):
1751 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=0,dl_vlan_pcp=0 actions=output:18
1752 NXST_FLOW_MONITOR reply (xid=0x0):
1753 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=0,dl_vlan_pcp=1 actions=output:19
1754 NXST_FLOW_MONITOR reply (xid=0x0):
1755 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=0 actions=output:20
1756 NXST_FLOW_MONITOR reply (xid=0x0):
1757 event=ADDED table=0 cookie=0 in_port=0,dl_vlan_pcp=0 actions=output:21
1758 NXST_FLOW_MONITOR reply (xid=0x0):
1759 event=ADDED table=0 cookie=0 in_port=0,dl_vlan_pcp=1 actions=output:22
1760 NXST_FLOW_MONITOR reply (xid=0x0):
1761 event=ADDED table=0 cookie=0 in_port=0 actions=output:23
1762 NXST_FLOW_MONITOR reply (xid=0x0):
1763 event=MODIFIED table=0 cookie=0x5 in_port=0,dl_vlan=123 actions=output:3
1764 event=MODIFIED table=0 cookie=0x5 in_port=0,dl_vlan=123,dl_vlan_pcp=0 actions=output:3
1765 event=MODIFIED table=0 cookie=0x5 in_port=0,dl_vlan=123,dl_vlan_pcp=1 actions=output:3
1766 NXST_FLOW_MONITOR reply (xid=0x0):
1767 event=DELETED reason=delete table=0 cookie=0x5 in_port=0,dl_vlan=123 actions=output:3
1768 event=DELETED reason=delete table=0 cookie=0x5 in_port=0,dl_vlan=123,dl_vlan_pcp=0 actions=output:3
1769 event=DELETED reason=delete table=0 cookie=0x5 in_port=0,dl_vlan=123,dl_vlan_pcp=1 actions=output:3
1770 NXST_FLOW_MONITOR reply (xid=0x0):
1771 event=DELETED reason=delete table=0 cookie=0 in_port=0 actions=output:23
1772 event=DELETED reason=delete table=0 cookie=0 in_port=0,dl_vlan=0 actions=output:20
1773 event=DELETED reason=delete table=0 cookie=0 in_port=0,dl_vlan=0,dl_vlan_pcp=0 actions=output:18
1774 event=DELETED reason=delete table=0 cookie=0 in_port=0,dl_vlan=0,dl_vlan_pcp=1 actions=output:19
1775 event=DELETED reason=delete table=0 cookie=0 in_port=0,dl_vlan=124 actions=output:2
1776 event=DELETED reason=delete table=0 cookie=0 in_port=0,dl_vlan=4095 actions=output:14
1777 event=DELETED reason=delete table=0 cookie=0 in_port=0,dl_vlan=4095,dl_vlan_pcp=0 actions=output:12
1778 event=DELETED reason=delete table=0 cookie=0 in_port=0,dl_vlan=4095,dl_vlan_pcp=1 actions=output:13
1779 event=DELETED reason=delete table=0 cookie=0 in_port=0,dl_vlan_pcp=0 actions=output:21
1780 event=DELETED reason=delete table=0 cookie=0 in_port=0,dl_vlan_pcp=1 actions=output:22
1781 event=DELETED reason=delete table=0 cookie=0 in_port=0,vlan_tci=0x0000 actions=output:11
1785 # Check that our own changes are reported as abbreviations.
1786 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
1787 ovs-ofctl add-flow br0 in_port=1,actions=output:2
1788 ovs-ofctl add-flow br0 in_port=2,actions=output:1
1789 ovs-appctl -t ovs-ofctl ofctl/barrier
1790 ovs-appctl -t ovs-ofctl ofctl/send 010e004812345678003fffff00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003000000000000ffffffffffff0000
1791 ovs-appctl -t ovs-ofctl ofctl/barrier
1792 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip], [0], [NXST_FLOW reply:
1794 AT_CHECK([sed 's/ (xid=0x[[1-9a-fA-F]][[0-9a-fA-F]]*)//' monitor.log], [0],
1795 [NXST_FLOW_MONITOR reply (xid=0x0):
1796 event=ADDED table=0 cookie=0 in_port=1 actions=output:2
1797 NXST_FLOW_MONITOR reply (xid=0x0):
1798 event=ADDED table=0 cookie=0 in_port=2 actions=output:1
1800 send: OFPT_FLOW_MOD: DEL priority=0 actions=drop
1801 NXST_FLOW_MONITOR reply (xid=0x0):
1802 event=ABBREV xid=0x12345678
1806 ovs-appctl -t ovs-ofctl exit
1810 AT_SETUP([ofproto - flow monitoring pause and resume])
1811 AT_KEYWORDS([monitor])
1813 # The maximum socket receive buffer size is important for this test, which
1814 # tests behavior when the receive buffer overflows.
1815 if test -e /proc/sys/net/core/rmem_max; then
1817 rmem_max=`cat /proc/sys/net/core/rmem_max`
1818 elif rmem_max=`sysctl -n net.inet.tcp.recvbuf_max 2>/dev/null`; then
1821 # Don't know how to get maximum socket receive buffer on this OS
1824 # Calculate the total amount of queuing: rmem_max in the kernel, 128 kB
1825 # in ofproto sending userspace (see ofmonitor_flush() in connmgr.c).
1826 queue_size=`expr $rmem_max + 128 \* 1024`
1827 echo rmem_max=$rmem_max queue_size=$queue_size
1829 # Each flow update message takes up at least 48 bytes of space in queues
1830 # and in practice more than that.
1831 n_msgs=`expr $queue_size / 48`
1836 # Start a monitor watching the flow table, then make it block.
1837 ON_EXIT([kill `cat ovs-ofctl.pid`])
1838 ovs-ofctl monitor br0 watch: --detach --no-chdir --pidfile >monitor.log 2>&1
1839 AT_CAPTURE_FILE([monitor.log])
1840 ovs-appctl -t ovs-ofctl ofctl/block
1842 # Add $n_msgs flows.
1843 (echo "in_port=2,actions=output:2"
1845 for ($i = 0; $i < '$n_msgs'; $i++) {
1846 print "cookie=1,reg1=$i,actions=drop\n";
1849 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
1850 # Check that multipart flow dumps work properly:
1851 AT_CHECK([ovs-ofctl diff-flows br0 flows.txt])
1852 AT_CHECK([ovs-ofctl add-flow br0 in_port=1,cookie=3,actions=drop])
1853 AT_CHECK([ovs-ofctl mod-flows br0 in_port=2,cookie=2,actions=output:2])
1854 AT_CHECK([ovs-ofctl del-flows br0 cookie=1/-1])
1856 ovs-appctl -t ovs-ofctl ofctl/unblock
1857 ovs-appctl -t ovs-ofctl ofctl/barrier
1859 ovs-appctl -t ovs-ofctl exit
1861 # Check that the flow monitor reported the same number of flows
1862 # added and deleted, but fewer than we actually added and deleted.
1863 adds=`grep -c 'ADDED.*reg1=' monitor.log`
1864 deletes=`grep -c 'DELETED.*reg1=' monitor.log`
1865 echo adds=$adds deletes=$deletes
1866 AT_CHECK([test $adds -gt 100 && test $adds -lt $n_msgs])
1867 AT_CHECK([test $adds = $deletes])
1869 # Check that the flow monitor reported everything in the expected order:
1871 # event=ADDED table=0 cookie=0x1 reg1=0x22
1873 # NXT_FLOW_MONITOR_PAUSED:
1875 # event=DELETED reason=delete table=0 cookie=0x1 reg1=0x22
1877 # event=ADDED table=0 cookie=0x3 in_port=1
1878 # event=MODIFIED table=0 cookie=0x2 in_port=2 actions=output:2
1879 # NXT_FLOW_MONITOR_RESUMED:
1881 # except that, between the PAUSED and RESUMED, the order of the ADDED
1882 # and MODIFIED lines lines depends on hash order, that is, it varies
1883 # as we change the hash function or change architecture. Therefore,
1884 # we use a couple of tests below to accept both orders.
1885 AT_CHECK([ofctl_strip < monitor.log | sed -n -e '
1888 /NXT_FLOW_MONITOR_PAUSED:/p
1889 /NXT_FLOW_MONITOR_RESUMED:/p
1890 ' > monitor.log.subset])
1891 AT_CHECK([grep -v MODIFIED monitor.log.subset], [0], [dnl
1892 event=ADDED table=0 cookie=0x1 reg1=0x22
1893 NXT_FLOW_MONITOR_PAUSED:
1894 event=DELETED reason=delete table=0 cookie=0x1 reg1=0x22
1895 event=ADDED table=0 cookie=0x3 in_port=1
1896 NXT_FLOW_MONITOR_RESUMED:
1898 AT_CHECK([grep -v ADDED monitor.log.subset], [0], [dnl
1899 NXT_FLOW_MONITOR_PAUSED:
1900 event=DELETED reason=delete table=0 cookie=0x1 reg1=0x22
1901 event=MODIFIED table=0 cookie=0x2 in_port=2 actions=output:2
1902 NXT_FLOW_MONITOR_RESUMED:
1908 AT_SETUP([ofproto - event filtering (OpenFlow 1.3)])
1909 AT_KEYWORDS([monitor])
1912 # Start a monitor, use the required protocol version
1913 ovs-ofctl -O OpenFlow13 monitor br0 --detach --no-chdir --pidfile >monitor.log 2>&1
1914 AT_CAPTURE_FILE([monitor.log])
1916 # Send an OpenFlow13 message (04), OFPT_GET_ASYNC_REQUEST (1a), length (8), xid (0a)
1917 ovs-appctl -t ovs-ofctl ofctl/send 041a00080000000a
1918 ovs-appctl -t ovs-ofctl ofctl/barrier
1920 # Check default setting
1921 read -r -d '' expected <<'EOF'
1924 AT_CHECK([ofctl_strip < monitor.log], [], [dnl
1925 send: OFPT_GET_ASYNC_REQUEST (OF1.3):
1926 OFPT_GET_ASYNC_REPLY (OF1.3):
1928 PACKET_IN: no_match action
1929 PORT_STATUS: add delete modify
1930 FLOW_REMOVED: idle hard delete
1934 PORT_STATUS: add delete modify
1936 OFPT_BARRIER_REPLY (OF1.3):