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 - set-field flow_mod commands (NXM)])
280 AT_CHECK([ovs-ofctl add-flow br0 ipv6,table=1,in_port=3,actions=drop])
281 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])
282 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
283 table=1, ipv6,in_port=3 actions=load:0xa6badbfffefe59fa->NXM_NX_IPV6_SRC[[0..63]],load:0xfe8001234567890a->NXM_NX_IPV6_SRC[[64..127]]
289 AT_SETUP([ofproto - basic flow_mod commands (OpenFlow 1.2)])
291 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip], [0], [OFPST_FLOW reply (OF1.2):
293 AT_CHECK([echo 'in_port=2,actions=1' | ovs-ofctl -O OpenFlow12 add-flows br0 -])
294 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 in_port=1,actions=2])
295 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 table=1,in_port=4,actions=3])
296 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
297 in_port=1 actions=output:2
298 in_port=2 actions=output:1
299 table=1, in_port=4 actions=output:3
300 OFPST_FLOW reply (OF1.2):
302 AT_CHECK([ovs-ofctl -O OpenFlow12 del-flows br0])
303 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip], [0], [OFPST_FLOW reply (OF1.2):
308 AT_SETUP([ofproto - dump flows with cookie])
310 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x1,in_port=1,actions=1])
311 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x2,in_port=2,actions=1])
312 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x3,in_port=3,actions=1])
313 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
314 cookie=0x1, in_port=1 actions=output:1
315 cookie=0x2, in_port=2 actions=output:1
316 cookie=0x3, in_port=3 actions=output:1
319 AT_CHECK([ovs-ofctl dump-aggregate br0 table=0 | STRIP_XIDS], [0], [dnl
320 NXST_AGGREGATE reply: packet_count=0 byte_count=0 flow_count=3
322 AT_CHECK([ovs-ofctl dump-flows br0 cookie=0x3/-1 | ofctl_strip | sort], [0], [dnl
323 cookie=0x3, in_port=3 actions=output:1
326 AT_CHECK([ovs-ofctl dump-aggregate br0 cookie=0x3/-1 | STRIP_XIDS], [0], [dnl
327 NXST_AGGREGATE reply: packet_count=0 byte_count=0 flow_count=1
332 AT_SETUP([ofproto - mod flow with cookie change (OpenFlow 1.0)])
334 AT_CHECK([ovs-ofctl -F openflow10 add-flow br0 cookie=0x1,in_port=1,actions=1])
335 AT_CHECK([ovs-ofctl -F openflow10 dump-flows br0 | ofctl_strip | sort], [0], [dnl
336 cookie=0x1, in_port=1 actions=output:1
340 AT_CHECK([ovs-ofctl -F openflow10 mod-flows br0 cookie=0x2,in_port=1,actions=1])
341 AT_CHECK([ovs-ofctl -F openflow10 dump-flows br0 | ofctl_strip | sort], [0], [dnl
342 cookie=0x2, in_port=1 actions=output:1
348 AT_SETUP([ofproto - mod flow with cookie change (NXM)])
350 AT_CHECK([ovs-ofctl -F nxm add-flow br0 cookie=0x1,in_port=1,actions=1])
351 AT_CHECK([ovs-ofctl -F nxm dump-flows br0 | ofctl_strip | sort], [0], [dnl
352 cookie=0x1, in_port=1 actions=output:1
356 AT_CHECK([ovs-ofctl -F nxm mod-flows br0 cookie=0x2,in_port=1,actions=1])
357 AT_CHECK([ovs-ofctl -F nxm dump-flows br0 | ofctl_strip | sort], [0], [dnl
358 cookie=0x2, in_port=1 actions=output:1
364 AT_SETUP([ofproto - no mod flow with cookie change (OpenFlow 1.1)])
366 AT_CHECK([ovs-ofctl -O OpenFlow11 add-flow br0 cookie=0x1,in_port=1,actions=1])
367 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0], [dnl
368 cookie=0x1, in_port=1 actions=output:1
369 OFPST_FLOW reply (OF1.1):
371 AT_CHECK([ovs-ofctl -O OpenFlow11 mod-flows br0 cookie=0x2,in_port=1,actions=1])
372 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0], [dnl
373 cookie=0x1, in_port=1 actions=output:1
374 OFPST_FLOW reply (OF1.1):
379 dnl The OpenFlow 1.2 spec states that the cookie may not be modified
380 AT_SETUP([ofproto - no mod flow with cookie change (OpenFlow 1.2)])
382 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 cookie=0x1,in_port=1,actions=1])
383 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
384 cookie=0x1, in_port=1 actions=output:1
385 OFPST_FLOW reply (OF1.2):
388 AT_CHECK([ovs-ofctl -O OpenFlow12 mod-flows br0 cookie=0x2,in_port=1,actions=1])
389 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
390 cookie=0x1, in_port=1 actions=output:1
391 OFPST_FLOW reply (OF1.2):
396 AT_SETUP([ofproto - mod flows based on cookie mask (OpenFlow 1.0)])
398 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x1,in_port=1,actions=1])
399 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x1,in_port=2,actions=1])
400 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x2,in_port=3,actions=1])
401 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
402 cookie=0x1, in_port=1 actions=output:1
403 cookie=0x1, in_port=2 actions=output:1
404 cookie=0x2, in_port=3 actions=output:1
408 AT_CHECK([ovs-ofctl -F nxm mod-flows br0 cookie=0x1/0xff,actions=4])
409 AT_CHECK([ovs-ofctl -F nxm dump-flows br0 | ofctl_strip | sort], [0], [dnl
410 cookie=0x1, in_port=1 actions=output:4
411 cookie=0x1, in_port=2 actions=output:4
412 cookie=0x2, in_port=3 actions=output:1
418 AT_SETUP([ofproto - mod flows based on cookie mask (OpenFlow 1.1)])
420 AT_CHECK([ovs-ofctl -O OpenFlow11 add-flow br0 cookie=0x1,in_port=1,actions=1])
421 AT_CHECK([ovs-ofctl -O OpenFlow11 add-flow br0 cookie=0x1,in_port=2,actions=1])
422 AT_CHECK([ovs-ofctl -O OpenFlow11 add-flow br0 cookie=0x2,in_port=3,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 cookie=0x1, in_port=2 actions=output:1
426 cookie=0x2, in_port=3 actions=output:1
427 OFPST_FLOW reply (OF1.1):
430 AT_CHECK([ovs-ofctl -O OpenFlow11 mod-flows br0 cookie=0x1/0xff,actions=4])
431 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0], [dnl
432 cookie=0x1, in_port=1 actions=output:4
433 cookie=0x1, in_port=2 actions=output:4
434 cookie=0x2, in_port=3 actions=output:1
435 OFPST_FLOW reply (OF1.1):
440 AT_SETUP([ofproto - mod flows based on cookie mask (OpenFlow 1.2)])
442 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 cookie=0x1,in_port=1,actions=1])
443 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 cookie=0x1,in_port=2,actions=1])
444 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 cookie=0x2,in_port=3,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 cookie=0x1, in_port=2 actions=output:1
448 cookie=0x2, in_port=3 actions=output:1
449 OFPST_FLOW reply (OF1.2):
452 AT_CHECK([ovs-ofctl -O OpenFlow12 mod-flows br0 cookie=0x1/0xff,actions=4])
453 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
454 cookie=0x1, in_port=1 actions=output:4
455 cookie=0x1, in_port=2 actions=output:4
456 cookie=0x2, in_port=3 actions=output:1
457 OFPST_FLOW reply (OF1.2):
462 dnl The OpenFlow 1.2 spec states that the cookie may not be modified
463 AT_SETUP([ofproto - mod flows based on cookie mask with cookie change])
465 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x1,in_port=1,actions=1])
466 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x1,in_port=2,actions=1])
467 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x2,in_port=3,actions=1])
468 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
469 cookie=0x1, in_port=1 actions=output:1
470 cookie=0x1, in_port=2 actions=output:1
471 cookie=0x2, in_port=3 actions=output:1
475 AT_CHECK([ovs-ofctl -F nxm mod-flows br0 cookie=1/-1,cookie=4,actions=4])
476 AT_CHECK([ovs-ofctl -F nxm dump-flows br0 | ofctl_strip | sort], [0], [dnl
477 cookie=0x2, in_port=3 actions=output:1
478 cookie=0x4, in_port=1 actions=output:4
479 cookie=0x4, in_port=2 actions=output:4
485 AT_SETUP([ofproto - mod flow with cookie miss (mask==0) - NXM])
487 AT_CHECK([ovs-ofctl -F nxm mod-flows br0 in_port=1,actions=1])
488 AT_CHECK([ovs-ofctl -F nxm dump-flows br0 | ofctl_strip | sort], [0], [dnl
489 in_port=1 actions=output:1
495 AT_SETUP([ofproto - mod flow with cookie miss (mask==0) - OF1.1])
497 AT_CHECK([ovs-ofctl -O openflow11 mod-flows br0 in_port=1,actions=1])
498 AT_CHECK([ovs-ofctl -O openflow11 dump-flows br0 | ofctl_strip | sort], [0], [dnl
499 in_port=1 actions=output:1
500 OFPST_FLOW reply (OF1.1):
505 AT_SETUP([ofproto - mod flow with cookie miss (mask==0) - OF1.2])
507 AT_CHECK([ovs-ofctl -O openflow12 mod-flows br0 in_port=1,actions=1])
508 AT_CHECK([ovs-ofctl -O openflow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
509 OFPST_FLOW reply (OF1.2):
514 AT_SETUP([ofproto - mod flow with cookie miss (mask!=0) - NXM])
516 AT_CHECK([ovs-ofctl -F nxm mod-flows br0 cookie=1/1,in_port=1,actions=1])
517 AT_CHECK([ovs-ofctl -F nxm dump-flows br0 | ofctl_strip | sort], [0], [dnl
523 AT_SETUP([ofproto - mod flow with cookie miss (mask!=0) - OF1.1])
525 AT_CHECK([ovs-ofctl -O openflow11 mod-flows br0 cookie=1/1,in_port=1,actions=1])
526 AT_CHECK([ovs-ofctl -O openflow11 dump-flows br0 | ofctl_strip | sort], [0], [dnl
527 OFPST_FLOW reply (OF1.1):
532 AT_SETUP([ofproto - mod flow with cookie miss (mask!=0) - OF1.2])
534 AT_CHECK([ovs-ofctl -O openflow12 mod-flows br0 cookie=1/1,in_port=1,actions=1])
535 AT_CHECK([ovs-ofctl -O openflow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
536 OFPST_FLOW reply (OF1.2):
541 AT_SETUP([ofproto - del flows with cookies])
543 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x1,in_port=1,actions=1])
544 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x2,in_port=2,actions=1])
545 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x3,in_port=3,actions=1])
546 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
547 cookie=0x1, in_port=1 actions=output:1
548 cookie=0x2, in_port=2 actions=output:1
549 cookie=0x3, in_port=3 actions=output:1
553 AT_CHECK([ovs-ofctl del-flows br0])
554 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
560 AT_SETUP([ofproto - del flows based on cookie])
562 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x1,in_port=1,actions=1])
563 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x2,in_port=2,actions=1])
564 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x3,in_port=3,actions=1])
565 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
566 cookie=0x1, in_port=1 actions=output:1
567 cookie=0x2, in_port=2 actions=output:1
568 cookie=0x3, in_port=3 actions=output:1
572 AT_CHECK([ovs-ofctl del-flows br0 cookie=0x3/-1])
573 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
574 cookie=0x1, in_port=1 actions=output:1
575 cookie=0x2, in_port=2 actions=output:1
581 AT_SETUP([ofproto - del flows based on cookie mask])
583 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x1,in_port=1,actions=1])
584 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x2,in_port=2,actions=1])
585 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x3,in_port=3,actions=1])
586 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
587 cookie=0x1, in_port=1 actions=output:1
588 cookie=0x2, in_port=2 actions=output:1
589 cookie=0x3, in_port=3 actions=output:1
592 AT_CHECK([ovs-ofctl del-flows br0 cookie=0x3/0x1])
593 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
594 cookie=0x2, in_port=2 actions=output:1
600 AT_SETUP([ofproto - del flows based on table id (NXM)])
602 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x1,in_port=1,actions=1])
603 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x2,in_port=2,table=1,actions=1])
604 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
605 cookie=0x1, in_port=1 actions=output:1
606 cookie=0x2, table=1, in_port=2 actions=output:1
609 AT_CHECK([ovs-ofctl del-flows br0 table=0])
610 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
611 cookie=0x2, table=1, in_port=2 actions=output:1
614 AT_CHECK([ovs-ofctl del-flows br0 table=1])
615 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
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,table=1,actions=1])
620 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
621 cookie=0x1, in_port=1 actions=output:1
622 cookie=0x2, table=1, in_port=2 actions=output:1
625 AT_CHECK([ovs-ofctl del-flows br0])
626 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
632 AT_SETUP([ofproto - del flows based on table id (OpenFlow 1.1)])
634 AT_CHECK([ovs-ofctl -O OpenFlow11 add-flow br0 cookie=0x1,in_port=1,actions=1])
635 AT_CHECK([ovs-ofctl -O OpenFlow11 add-flow br0 cookie=0x2,in_port=2,table=1,actions=1])
636 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0], [dnl
637 cookie=0x1, in_port=1 actions=output:1
638 cookie=0x2, table=1, in_port=2 actions=output:1
639 OFPST_FLOW reply (OF1.1):
641 AT_CHECK([ovs-ofctl -O OpenFlow11 del-flows br0 table=0])
642 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0], [dnl
643 cookie=0x2, table=1, in_port=2 actions=output:1
644 OFPST_FLOW reply (OF1.1):
646 AT_CHECK([ovs-ofctl -O OpenFlow11 del-flows br0 table=1])
647 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0], [dnl
648 OFPST_FLOW reply (OF1.1):
650 AT_CHECK([ovs-ofctl -O OpenFlow11 add-flow br0 cookie=0x1,in_port=1,actions=1])
651 AT_CHECK([ovs-ofctl -O OpenFlow11 add-flow br0 cookie=0x2,in_port=2,table=1,actions=1])
652 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0], [dnl
653 cookie=0x1, in_port=1 actions=output:1
654 cookie=0x2, table=1, in_port=2 actions=output:1
655 OFPST_FLOW reply (OF1.1):
657 AT_CHECK([ovs-ofctl -O OpenFlow11 del-flows br0])
658 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0], [dnl
659 OFPST_FLOW reply (OF1.1):
664 AT_SETUP([ofproto - del flows based on table id (OpenFlow 1.2)])
666 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 cookie=0x1,in_port=1,actions=1])
667 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 cookie=0x2,in_port=2,table=1,actions=1])
668 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
669 cookie=0x1, in_port=1 actions=output:1
670 cookie=0x2, table=1, in_port=2 actions=output:1
671 OFPST_FLOW reply (OF1.2):
673 AT_CHECK([ovs-ofctl -O OpenFlow12 del-flows br0 table=0])
674 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
675 cookie=0x2, table=1, in_port=2 actions=output:1
676 OFPST_FLOW reply (OF1.2):
678 AT_CHECK([ovs-ofctl -O OpenFlow12 del-flows br0 table=1])
679 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
680 OFPST_FLOW reply (OF1.2):
682 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 cookie=0x1,in_port=1,actions=1])
683 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 cookie=0x2,in_port=2,table=1,actions=1])
684 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
685 cookie=0x1, in_port=1 actions=output:1
686 cookie=0x2, table=1, in_port=2 actions=output:1
687 OFPST_FLOW reply (OF1.2):
689 AT_CHECK([ovs-ofctl -O OpenFlow12 del-flows br0])
690 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
691 OFPST_FLOW reply (OF1.2):
696 AT_SETUP([ofproto - flow table configuration (OpenFlow 1.0)])
698 # Check the default configuration.
699 (echo "OFPST_TABLE reply (xid=0x2): 254 tables
700 0: classifier: wild=0x3fffff, max=1000000, active=0
703 while test $x -lt 254; do
704 printf " %d: %-8s: wild=0x3fffff, max=1000000, active=0
709 AT_CHECK([ovs-ofctl dump-tables br0], [0], [expout])
710 # Change the configuration.
713 -- --id=@t0 create Flow_Table name=main \
714 -- --id=@t1 create Flow_Table flow-limit=1024 \
715 -- set bridge br0 'flow_tables={1=@t1,0=@t0}' \
716 | ${PERL} $srcdir/uuidfilt.pl],
720 # Check that the configuration was updated.
721 mv expout orig-expout
722 (echo "OFPST_TABLE reply (xid=0x2): 254 tables
723 0: main : wild=0x3fffff, max=1000000, active=0
725 1: table1 : wild=0x3fffff, max= 1024, active=0
727 tail -n +6 orig-expout) > expout
728 AT_CHECK([ovs-ofctl dump-tables br0], [0], [expout])
732 AT_SETUP([ofproto - flow table configuration (OpenFlow 1.2)])
734 # Check the default configuration.
735 (mid="wild=0xffffffffff, max=1000000,"
738 match=0xffffffffff, instructions=0x00000007, config=0x00000003
739 write_actions=0x00000000, apply_actions=0x00000000
740 write_setfields=0x000000ffffffffff
741 apply_setfields=0x000000ffffffffff
742 metadata_match=0xffffffffffffffff
743 metadata_write=0xffffffffffffffff"
744 echo "OFPST_TABLE reply (OF1.2) (xid=0x2): 254 tables
745 0: classifier: $mid active=0$tail"
747 while test $x -lt 254; do
748 printf " %d: %-8s: $mid active=0$tail
752 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-tables br0], [0], [expout])
753 # Change the configuration.
756 -- --id=@t0 create Flow_Table name=main \
757 -- --id=@t1 create Flow_Table flow-limit=1024 \
758 -- set bridge br0 'flow_tables={1=@t1,0=@t0}' \
759 | ${PERL} $srcdir/uuidfilt.pl],
763 # Check that the configuration was updated.
764 mv expout orig-expout
765 (echo "OFPST_TABLE reply (OF1.2) (xid=0x2): 254 tables
766 0: main : wild=0xffffffffff, max=1000000, active=0"
767 tail -n +3 orig-expout | head -7
768 echo " 1: table1 : wild=0xffffffffff, max= 1024, active=0"
769 tail -n +11 orig-expout) > expout
770 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-tables br0], [0], [expout])
774 AT_SETUP([ofproto - hard limits on flow table size (OpenFLow 1.0)])
776 # Configure a maximum of 4 flows.
779 -- --id=@t0 create Flow_Table flow-limit=4 \
780 -- set bridge br0 flow_tables:0=@t0 \
781 | ${PERL} $srcdir/uuidfilt.pl],
785 for in_port in 1 2 3 4; do
786 ovs-ofctl add-flow br0 in_port=$in_port,actions=drop
788 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
789 in_port=1 actions=drop
790 in_port=2 actions=drop
791 in_port=3 actions=drop
792 in_port=4 actions=drop
795 # Adding another flow will be refused.
796 AT_CHECK([ovs-ofctl add-flow br0 in_port=5,actions=drop], [1], [], [stderr])
797 AT_CHECK([head -n 1 stderr | ofctl_strip], [0],
798 [OFPT_ERROR: OFPFMFC_TABLE_FULL
800 # Also a mod-flow that would add a flow will be refused.
801 AT_CHECK([ovs-ofctl mod-flows br0 in_port=5,actions=drop], [1], [], [stderr])
802 AT_CHECK([head -n 1 stderr | ofctl_strip], [0],
803 [OFPT_ERROR: OFPFMFC_TABLE_FULL
805 # Replacing or modifying an existing flow is allowed.
806 AT_CHECK([ovs-ofctl add-flow br0 in_port=4,actions=normal])
807 AT_CHECK([ovs-ofctl mod-flows br0 in_port=3,actions=output:1])
808 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
809 in_port=1 actions=drop
810 in_port=2 actions=drop
811 in_port=3 actions=output:1
812 in_port=4 actions=NORMAL
818 AT_SETUP([ofproto - hard limits on flow table size (OpenFLow 1.2)])
820 # Configure a maximum of 4 flows.
823 -- --id=@t0 create Flow_Table flow-limit=4 \
824 -- set bridge br0 flow_tables:0=@t0 \
825 | ${PERL} $srcdir/uuidfilt.pl],
829 for in_port in 1 2 3 4; do
830 ovs-ofctl -O OpenFlow12 add-flow br0 in_port=$in_port,actions=drop
832 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
833 in_port=1 actions=drop
834 in_port=2 actions=drop
835 in_port=3 actions=drop
836 in_port=4 actions=drop
837 OFPST_FLOW reply (OF1.2):
839 # Adding another flow will be refused.
840 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 in_port=5,actions=drop], [1], [], [stderr])
841 AT_CHECK([head -n 1 stderr | ofctl_strip], [0],
842 [OFPT_ERROR (OF1.2): OFPFMFC_TABLE_FULL
844 # Replacing or modifying an existing flow is allowed.
845 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 in_port=4,actions=normal])
846 AT_CHECK([ovs-ofctl -O OpenFlow12 mod-flows br0 in_port=3,actions=output:1])
847 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
848 in_port=1 actions=drop
849 in_port=2 actions=drop
850 in_port=3 actions=output:1
851 in_port=4 actions=NORMAL
852 OFPST_FLOW reply (OF1.2):
857 AT_SETUP([ofproto - eviction upon table overflow (OpenFlow 1.0)])
859 # Configure a maximum of 4 flows.
862 -- --id=@t0 create Flow_Table flow-limit=4 overflow-policy=evict \
863 -- set bridge br0 flow_tables:0=@t0 \
864 | ${PERL} $srcdir/uuidfilt.pl],
868 for in_port in 4 3 2 1; do
869 ovs-ofctl add-flow br0 idle_timeout=${in_port}0,in_port=$in_port,actions=drop
871 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
872 idle_timeout=10, in_port=1 actions=drop
873 idle_timeout=20, in_port=2 actions=drop
874 idle_timeout=30, in_port=3 actions=drop
875 idle_timeout=40, in_port=4 actions=drop
878 # Adding another flow will cause the one that expires soonest to be evicted.
879 AT_CHECK([ovs-ofctl add-flow br0 in_port=5,actions=drop])
880 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
881 idle_timeout=20, in_port=2 actions=drop
882 idle_timeout=30, in_port=3 actions=drop
883 idle_timeout=40, in_port=4 actions=drop
884 in_port=5 actions=drop
887 # A mod-flow that adds a flow also causes eviction, but replacing or
888 # modifying an existing flow doesn't.
889 AT_CHECK([ovs-ofctl mod-flows br0 in_port=6,actions=drop])
890 AT_CHECK([ovs-ofctl add-flow br0 in_port=4,actions=normal])
891 AT_CHECK([ovs-ofctl mod-flows br0 in_port=3,actions=output:1])
892 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
893 idle_timeout=30, in_port=3 actions=output:1
894 in_port=4 actions=NORMAL
895 in_port=5 actions=drop
896 in_port=6 actions=drop
899 # Flows with no timeouts at all cannot be evicted.
900 AT_CHECK([ovs-ofctl add-flow br0 in_port=7,actions=normal])
901 AT_CHECK([ovs-ofctl add-flow br0 in_port=8,actions=drop], [1], [], [stderr])
902 AT_CHECK([head -n 1 stderr | ofctl_strip], [0],
903 [OFPT_ERROR: OFPFMFC_TABLE_FULL
905 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
906 in_port=4 actions=NORMAL
907 in_port=5 actions=drop
908 in_port=6 actions=drop
909 in_port=7 actions=NORMAL
915 AT_SETUP([ofproto - eviction upon table overflow (OpenFlow 1.2)])
917 # Configure a maximum of 4 flows.
920 -- --id=@t0 create Flow_Table flow-limit=4 overflow-policy=evict \
921 -- set bridge br0 flow_tables:0=@t0 \
922 | ${PERL} $srcdir/uuidfilt.pl],
926 for in_port in 4 3 2 1; do
927 ovs-ofctl -O OpenFlow12 add-flow br0 idle_timeout=${in_port}0,in_port=$in_port,actions=drop
929 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
930 idle_timeout=10, in_port=1 actions=drop
931 idle_timeout=20, in_port=2 actions=drop
932 idle_timeout=30, in_port=3 actions=drop
933 idle_timeout=40, in_port=4 actions=drop
934 OFPST_FLOW reply (OF1.2):
936 # Adding another flow will cause the one that expires soonest to be evicted.
937 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 in_port=5,actions=drop])
938 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
939 idle_timeout=20, in_port=2 actions=drop
940 idle_timeout=30, in_port=3 actions=drop
941 idle_timeout=40, in_port=4 actions=drop
942 in_port=5 actions=drop
943 OFPST_FLOW reply (OF1.2):
945 # In Open Flow 1.2 a mod-flow does not ever add a flow and thus
946 # has no effect on eviction
947 AT_CHECK([ovs-ofctl -O OpenFlow12 mod-flows br0 in_port=6,actions=drop])
948 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 in_port=4,actions=normal])
949 AT_CHECK([ovs-ofctl -O OpenFlow12 mod-flows br0 in_port=3,actions=output:1])
950 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
951 idle_timeout=20, in_port=2 actions=drop
952 idle_timeout=30, in_port=3 actions=output:1
953 in_port=4 actions=NORMAL
954 in_port=5 actions=drop
955 OFPST_FLOW reply (OF1.2):
957 # Flows with no timeouts at all cannot be evicted.
958 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 in_port=6,actions=drop])
959 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 in_port=7,actions=normal])
960 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 in_port=8,actions=drop], [1], [], [stderr])
961 AT_CHECK([head -n 1 stderr | ofctl_strip], [0],
962 [OFPT_ERROR (OF1.2): OFPFMFC_TABLE_FULL
964 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
965 in_port=4 actions=NORMAL
966 in_port=5 actions=drop
967 in_port=6 actions=drop
968 in_port=7 actions=NORMAL
969 OFPST_FLOW reply (OF1.2):
974 AT_SETUP([ofproto - eviction upon table overflow, with fairness (OpenFlow 1.0)])
976 # Configure a maximum of 4 flows.
979 -- --id=@t0 create Flow_Table name=evict flow-limit=4 \
980 overflow-policy=evict \
981 groups='"NXM_OF_IN_PORT[[]]"' \
982 -- set bridge br0 flow_tables:0=@t0 \
983 | ${PERL} $srcdir/uuidfilt.pl],
987 ovs-ofctl add-flows br0 - <<EOF
988 idle_timeout=10 in_port=2 dl_src=00:44:55:66:77:88 actions=drop
989 idle_timeout=20 in_port=1 dl_src=00:11:22:33:44:55 actions=drop
990 idle_timeout=30 in_port=1 dl_src=00:22:33:44:55:66 actions=drop
991 idle_timeout=40 in_port=1 dl_src=00:33:44:55:66:77 actions=drop
993 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
994 idle_timeout=10, in_port=2,dl_src=00:44:55:66:77:88 actions=drop
995 idle_timeout=20, in_port=1,dl_src=00:11:22:33:44:55 actions=drop
996 idle_timeout=30, in_port=1,dl_src=00:22:33:44:55:66 actions=drop
997 idle_timeout=40, in_port=1,dl_src=00:33:44:55:66:77 actions=drop
1000 # Adding another flow will cause the one that expires soonest within
1001 # the largest group (those with in_port=1) to be evicted. In this
1002 # case this is not the same as the one that expires soonest overall
1003 # (which is what makes the test interesting):
1004 AT_CHECK([ovs-ofctl add-flow br0 in_port=2,dl_src=00:55:66:77:88:99,actions=drop])
1005 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1006 idle_timeout=10, in_port=2,dl_src=00:44:55:66:77:88 actions=drop
1007 idle_timeout=30, in_port=1,dl_src=00:22:33:44:55:66 actions=drop
1008 idle_timeout=40, in_port=1,dl_src=00:33:44:55:66:77 actions=drop
1009 in_port=2,dl_src=00:55:66:77:88:99 actions=drop
1012 # Enlarge the flow limit, change the eviction policy back to strictly
1013 # based on expiration, and and add some flows.
1014 AT_CHECK([ovs-vsctl set Flow_Table evict groups='[[]]' flow-limit=7])
1015 ovs-ofctl add-flows br0 - <<EOF
1016 idle_timeout=50 in_port=2 dl_src=00:66:77:88:99:aa actions=drop
1017 idle_timeout=60 in_port=2 dl_src=00:77:88:99:aa:bb actions=drop
1018 idle_timeout=70 in_port=2 dl_src=00:88:99:aa:bb:cc actions=drop
1020 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1021 idle_timeout=10, in_port=2,dl_src=00:44:55:66:77:88 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
1024 idle_timeout=50, in_port=2,dl_src=00:66:77:88:99:aa actions=drop
1025 idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=drop
1026 idle_timeout=70, in_port=2,dl_src=00:88:99:aa:bb:cc actions=drop
1027 in_port=2,dl_src=00:55:66:77:88:99 actions=drop
1030 # Adding another flow will cause the one that expires soonest overall
1032 AT_CHECK([ovs-ofctl add-flow br0 'idle_timeout=80 in_port=2 dl_src=00:99:aa:bb:cc:dd actions=drop'])
1033 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1034 idle_timeout=30, in_port=1,dl_src=00:22:33:44:55:66 actions=drop
1035 idle_timeout=40, in_port=1,dl_src=00:33:44:55:66:77 actions=drop
1036 idle_timeout=50, in_port=2,dl_src=00:66:77:88:99:aa actions=drop
1037 idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=drop
1038 idle_timeout=70, in_port=2,dl_src=00:88:99:aa:bb:cc actions=drop
1039 idle_timeout=80, in_port=2,dl_src=00:99:aa:bb:cc:dd actions=drop
1040 in_port=2,dl_src=00:55:66:77:88:99 actions=drop
1043 # Reducing the flow limit also causes the flows that expire soonest
1044 # overall to be evicted.
1045 AT_CHECK([ovs-vsctl set Flow_Table evict flow-limit=4])
1046 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1047 idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=drop
1048 idle_timeout=70, in_port=2,dl_src=00:88:99:aa:bb:cc actions=drop
1049 idle_timeout=80, in_port=2,dl_src=00:99:aa:bb:cc:dd actions=drop
1050 in_port=2,dl_src=00:55:66:77:88:99 actions=drop
1056 AT_SETUP([ofproto - eviction upon table overflow, with fairness (OpenFlow 1.2)])
1058 # Configure a maximum of 4 flows.
1061 -- --id=@t0 create Flow_Table name=evict flow-limit=4 \
1062 overflow-policy=evict \
1063 groups='"NXM_OF_IN_PORT[[]]"' \
1064 -- set bridge br0 flow_tables:0=@t0 \
1065 | ${PERL} $srcdir/uuidfilt.pl],
1069 ovs-ofctl -O OpenFlow12 add-flows br0 - <<EOF
1070 idle_timeout=10 in_port=2 dl_src=00:44:55:66:77:88 actions=drop
1071 idle_timeout=20 in_port=1 dl_src=00:11:22:33:44:55 actions=drop
1072 idle_timeout=30 in_port=1 dl_src=00:22:33:44:55:66 actions=drop
1073 idle_timeout=40 in_port=1 dl_src=00:33:44:55:66:77 actions=drop
1075 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1076 idle_timeout=10, in_port=2,dl_src=00:44:55:66:77:88 actions=drop
1077 idle_timeout=20, in_port=1,dl_src=00:11:22:33:44:55 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 OFPST_FLOW reply (OF1.2):
1082 # Adding another flow will cause the one that expires soonest within
1083 # the largest group (those with in_port=1) to be evicted. In this
1084 # case this is not the same as the one that expires soonest overall
1085 # (which is what makes the test interesting):
1086 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 in_port=2,dl_src=00:55:66:77:88:99,actions=drop])
1087 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1088 idle_timeout=10, in_port=2,dl_src=00:44:55:66:77:88 actions=drop
1089 idle_timeout=30, in_port=1,dl_src=00:22:33:44:55:66 actions=drop
1090 idle_timeout=40, in_port=1,dl_src=00:33:44:55:66:77 actions=drop
1091 in_port=2,dl_src=00:55:66:77:88:99 actions=drop
1092 OFPST_FLOW reply (OF1.2):
1094 # Enlarge the flow limit, change the eviction policy back to strictly
1095 # based on expiration, and and add some flows.
1096 AT_CHECK([ovs-vsctl set Flow_Table evict groups='[[]]' flow-limit=7])
1097 ovs-ofctl -O OpenFlow12 add-flows br0 - <<EOF
1098 idle_timeout=50 in_port=2 dl_src=00:66:77:88:99:aa actions=drop
1099 idle_timeout=60 in_port=2 dl_src=00:77:88:99:aa:bb actions=drop
1100 idle_timeout=70 in_port=2 dl_src=00:88:99:aa:bb:cc actions=drop
1102 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1103 idle_timeout=10, in_port=2,dl_src=00:44:55:66:77:88 actions=drop
1104 idle_timeout=30, in_port=1,dl_src=00:22:33:44:55:66 actions=drop
1105 idle_timeout=40, in_port=1,dl_src=00:33:44:55:66:77 actions=drop
1106 idle_timeout=50, in_port=2,dl_src=00:66:77:88:99:aa actions=drop
1107 idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=drop
1108 idle_timeout=70, in_port=2,dl_src=00:88:99:aa:bb:cc actions=drop
1109 in_port=2,dl_src=00:55:66:77:88:99 actions=drop
1110 OFPST_FLOW reply (OF1.2):
1112 # Adding another flow will cause the one that expires soonest overall
1114 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'])
1115 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1116 idle_timeout=30, in_port=1,dl_src=00:22:33:44:55:66 actions=drop
1117 idle_timeout=40, in_port=1,dl_src=00:33:44:55:66:77 actions=drop
1118 idle_timeout=50, in_port=2,dl_src=00:66:77:88:99:aa actions=drop
1119 idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=drop
1120 idle_timeout=70, in_port=2,dl_src=00:88:99:aa:bb:cc actions=drop
1121 idle_timeout=80, in_port=2,dl_src=00:99:aa:bb:cc:dd actions=drop
1122 in_port=2,dl_src=00:55:66:77:88:99 actions=drop
1123 OFPST_FLOW reply (OF1.2):
1125 # Reducing the flow limit also causes the flows that expire soonest
1126 # overall to be evicted.
1127 AT_CHECK([ovs-vsctl set Flow_Table evict flow-limit=4])
1128 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1129 idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=drop
1130 idle_timeout=70, in_port=2,dl_src=00:88:99:aa:bb:cc actions=drop
1131 idle_timeout=80, in_port=2,dl_src=00:99:aa:bb:cc:dd actions=drop
1132 in_port=2,dl_src=00:55:66:77:88:99 actions=drop
1133 OFPST_FLOW reply (OF1.2):
1138 AT_SETUP([ofproto - asynchronous message control (OpenFlow 1.0)])
1140 AT_CHECK([ovs-ofctl -P openflow10 monitor br0 --detach --no-chdir --pidfile])
1142 printf '\n\n--- check_async %d ---\n\n\n' $1
1145 ovs-appctl -t ovs-ofctl ofctl/barrier
1146 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
1149 # OFPT_PACKET_IN, OFPR_ACTION (controller_id=0)
1150 ovs-ofctl -v packet-out br0 controller controller '0001020304050010203040501234'
1151 if test X"$1" = X"OFPR_ACTION"; then shift;
1152 echo >>expout "OFPT_PACKET_IN: total_len=14 in_port=CONTROLLER (via action) data_len=14 (unbuffered)
1153 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"
1156 # OFPT_PACKET_IN, OFPR_NO_MATCH (controller_id=123)
1157 ovs-ofctl -v packet-out br0 controller 'controller(reason=no_match,id=123)' '0001020304050010203040501234'
1158 if test X"$1" = X"OFPR_NO_MATCH"; then shift;
1159 echo >>expout "OFPT_PACKET_IN: total_len=14 in_port=CONTROLLER (via no_match) data_len=14 (unbuffered)
1160 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"
1163 # OFPT_PACKET_IN, OFPR_INVALID_TTL (controller_id=0)
1164 ovs-ofctl packet-out br0 controller dec_ttl '002583dfb4000026b98cb0f908004500003fb7e200000011339bac11370dac100002d7730035002b8f6d86fb0100000100000000000006626c702d7873066e696369726103636f6d00000f00'
1165 if test X"$1" = X"OFPR_INVALID_TTL"; then shift;
1166 echo >>expout "OFPT_PACKET_IN: total_len=76 in_port=CONTROLLER (via invalid_ttl) data_len=76 (unbuffered)
1167 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"
1170 # OFPT_PORT_STATUS, OFPPR_ADD
1171 ovs-vsctl add-port br0 test -- set Interface test type=dummy ofport_request=1
1172 if test X"$1" = X"OFPPR_ADD"; then shift;
1173 echo >>expout "OFPT_PORT_STATUS: ADD: 1(test): addr:aa:55:aa:55:00:0x
1176 speed: 0 Mbps now, 0 Mbps max"
1179 # OFPT_PORT_STATUS, OFPPR_DELETE
1180 ovs-vsctl del-port br0 test
1181 if test X"$1" = X"OFPPR_DELETE"; then shift;
1182 echo >>expout "OFPT_PORT_STATUS: DEL: 1(test): addr:aa:55:aa:55:00:0x
1185 speed: 0 Mbps now, 0 Mbps max"
1188 # OFPT_FLOW_REMOVED, OFPRR_DELETE
1189 ovs-ofctl add-flow br0 send_flow_rem,actions=drop
1190 ovs-ofctl --strict del-flows br0 ''
1191 if test X"$1" = X"OFPRR_DELETE"; then shift;
1192 echo >>expout "OFPT_FLOW_REMOVED: reason=delete"
1194 AT_FAIL_IF([test X"$1" != X])
1196 ovs-appctl -t ovs-ofctl ofctl/barrier
1197 echo >>expout "OFPT_BARRIER_REPLY:"
1201 s/ (xid=0x[0-9a-fA-F]*)//
1203 s/00:0.$/00:0x/' < monitor.log]],
1207 # It's a service connection so initially there should be no async messages.
1210 # Set miss_send_len to 128, turning on packet-ins for our service connection.
1211 ovs-appctl -t ovs-ofctl ofctl/send 0109000c0123456700000080
1212 check_async 2 OFPR_ACTION OFPPR_ADD OFPPR_DELETE OFPRR_DELETE
1214 # Set miss_send_len to 128 and enable invalid_ttl.
1215 ovs-appctl -t ovs-ofctl ofctl/send 0109000c0123456700040080
1216 check_async 3 OFPR_ACTION OFPR_INVALID_TTL OFPPR_ADD OFPPR_DELETE OFPRR_DELETE
1218 # Become slave, which should disable everything except port status.
1219 ovs-appctl -t ovs-ofctl ofctl/send 0104001400000002000023200000000a00000002
1220 check_async 4 OFPPR_ADD OFPPR_DELETE
1222 # Use NXT_SET_ASYNC_CONFIG to enable a patchwork of asynchronous messages.
1223 ovs-appctl -t ovs-ofctl ofctl/send 01040028000000020000232000000013000000020000000500000005000000020000000200000005
1224 check_async 5 OFPR_INVALID_TTL OFPPR_DELETE OFPRR_DELETE
1226 # Set controller ID 123.
1227 ovs-appctl -t ovs-ofctl ofctl/send 01040018000000030000232000000014000000000000007b
1228 check_async 6 OFPR_NO_MATCH OFPPR_DELETE OFPRR_DELETE
1230 # Restore controller ID 0.
1231 ovs-appctl -t ovs-ofctl ofctl/send 010400180000000300002320000000140000000000000000
1234 ovs-appctl -t ovs-ofctl ofctl/send 0104001400000002000023200000000a00000001
1235 check_async 7 OFPR_ACTION OFPPR_ADD
1237 ovs-appctl -t ovs-ofctl exit
1241 AT_SETUP([ofproto - asynchronous message control (OpenFlow 1.2)])
1243 AT_CHECK([ovs-ofctl -O OpenFlow12 monitor br0 --detach --no-chdir --pidfile])
1245 printf '\n\n--- check_async %d ---\n\n\n' $1
1249 ovs-appctl -t ovs-ofctl ofctl/barrier
1250 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
1253 # OFPT_PACKET_IN, OFPR_ACTION (controller_id=0)
1254 ovs-ofctl -O OpenFlow12 -v packet-out br0 none controller '0001020304050010203040501234'
1255 if test X"$1" = X"OFPR_ACTION"; then shift;
1256 echo >>expout "OFPT_PACKET_IN (OF1.2): total_len=14 in_port=ANY (via action) data_len=14 (unbuffered)
1257 metadata=0,in_port=0,vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1234"
1260 # OFPT_PACKET_IN, OFPR_NO_MATCH (controller_id=123)
1261 ovs-ofctl -O OpenFlow12 -v packet-out br0 none 'controller(reason=no_match,id=123)' '0001020304050010203040501234'
1262 if test X"$1" = X"OFPR_NO_MATCH"; then shift;
1263 echo >>expout "OFPT_PACKET_IN (OF1.2): total_len=14 in_port=ANY (via no_match) data_len=14 (unbuffered)
1264 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"
1267 # OFPT_PACKET_IN, OFPR_INVALID_TTL (controller_id=0)
1268 ovs-ofctl -O OpenFlow12 packet-out br0 none dec_ttl '002583dfb4000026b98cb0f908004500003fb7e200000011339bac11370dac100002d7730035002b8f6d86fb0100000100000000000006626c702d7873066e696369726103636f6d00000f00'
1269 if test X"$1" = X"OFPR_INVALID_TTL"; then shift;
1270 echo >>expout "OFPT_PACKET_IN (OF1.2): total_len=76 in_port=ANY (via invalid_ttl) data_len=76 (unbuffered)
1271 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"
1274 # OFPT_PORT_STATUS, OFPPR_ADD
1275 ovs-vsctl add-port br0 test -- set Interface test type=dummy
1276 if test X"$1" = X"OFPPR_ADD"; then shift;
1277 echo >>expout "OFPT_PORT_STATUS (OF1.2): ADD: ${INDEX}(test): addr:aa:55:aa:55:00:0x
1280 speed: 0 Mbps now, 0 Mbps max"
1283 # OFPT_PORT_STATUS, OFPPR_DELETE
1284 ovs-vsctl del-port br0 test
1285 if test X"$1" = X"OFPPR_DELETE"; then shift;
1286 echo >>expout "OFPT_PORT_STATUS (OF1.2): DEL: ${INDEX}(test): addr:aa:55:aa:55:00:0x
1289 speed: 0 Mbps now, 0 Mbps max"
1292 # OFPT_FLOW_REMOVED, OFPRR_DELETE
1293 ovs-ofctl -O OpenFlow12 add-flow br0 send_flow_rem,actions=drop
1294 ovs-ofctl -O OpenFlow12 --strict del-flows br0 ''
1295 if test X"$1" = X"OFPRR_DELETE"; then shift;
1296 echo >>expout "OFPT_FLOW_REMOVED (OF1.2): reason=delete table_id=0"
1298 AT_FAIL_IF([test X"$1" != X])
1300 ovs-appctl -t ovs-ofctl ofctl/barrier
1301 echo >>expout "OFPT_BARRIER_REPLY (OF1.2):"
1305 s/ (xid=0x[0-9a-fA-F]*)//
1307 s/00:0.$/00:0x/' < monitor.log]],
1311 # It's a service connection so initially there should be no async messages.
1314 # Set miss_send_len to 128, turning on packet-ins for our service connection.
1315 ovs-appctl -t ovs-ofctl ofctl/send 0309000c0123456700000080
1316 check_async 2 OFPR_ACTION OFPPR_ADD OFPPR_DELETE OFPRR_DELETE
1318 # Set miss_send_len to 128 and enable invalid_ttl.
1319 ovs-appctl -t ovs-ofctl ofctl/send 0309000c0123456700040080
1320 check_async 3 OFPR_ACTION OFPR_INVALID_TTL OFPPR_ADD OFPPR_DELETE OFPRR_DELETE
1322 # Become slave (OF 1.2), which should disable everything except port status.
1323 ovs-appctl -t ovs-ofctl ofctl/send 031800180000000200000003000000000000000000000001
1324 check_async 4 OFPPR_ADD OFPPR_DELETE
1326 # Use NXT_SET_ASYNC_CONFIG to enable a patchwork of asynchronous messages.
1327 ovs-appctl -t ovs-ofctl ofctl/send 03040028000000020000232000000013000000020000000500000005000000020000000200000005
1328 check_async 5 OFPR_INVALID_TTL OFPPR_DELETE OFPRR_DELETE
1330 # Set controller ID 123.
1331 ovs-appctl -t ovs-ofctl ofctl/send 03040018000000030000232000000014000000000000007b
1332 check_async 6 OFPR_NO_MATCH OFPPR_DELETE OFPRR_DELETE
1334 # Restore controller ID 0.
1335 ovs-appctl -t ovs-ofctl ofctl/send 030400180000000300002320000000140000000000000000
1337 # Become master (OF 1.2).
1338 ovs-appctl -t ovs-ofctl ofctl/send 031800180000000400000002000000000000000000000002
1339 check_async 7 OFPR_ACTION OFPPR_ADD
1341 ovs-appctl -t ovs-ofctl exit
1345 AT_SETUP([ofproto - asynchronous message control (OpenFlow 1.3)])
1347 AT_CHECK([ovs-ofctl -O OpenFlow13 monitor br0 --detach --no-chdir --pidfile])
1349 printf '\n\n--- check_async %d ---\n\n\n' $1
1353 ovs-appctl -t ovs-ofctl ofctl/barrier
1354 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
1357 # OFPT_PACKET_IN, OFPR_ACTION (controller_id=0)
1358 ovs-ofctl -O OpenFlow13 -v packet-out br0 none controller '0001020304050010203040501234'
1359 if test X"$1" = X"OFPR_ACTION"; then shift;
1360 echo >>expout "OFPT_PACKET_IN (OF1.3): total_len=14 in_port=ANY (via action) data_len=14 (unbuffered)
1361 metadata=0,in_port=0,vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1234"
1364 # OFPT_PACKET_IN, OFPR_NO_MATCH (controller_id=123)
1365 ovs-ofctl -O OpenFlow13 -v packet-out br0 none 'controller(reason=no_match,id=123)' '0001020304050010203040501234'
1366 if test X"$1" = X"OFPR_NO_MATCH"; then shift;
1367 echo >>expout "OFPT_PACKET_IN (OF1.3): total_len=14 in_port=ANY (via no_match) data_len=14 (unbuffered)
1368 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"
1371 # OFPT_PACKET_IN, OFPR_INVALID_TTL (controller_id=0)
1372 ovs-ofctl -O OpenFlow13 packet-out br0 none dec_ttl '002583dfb4000026b98cb0f908004500003fb7e200000011339bac11370dac100002d7730035002b8f6d86fb0100000100000000000006626c702d7873066e696369726103636f6d00000f00'
1373 if test X"$1" = X"OFPR_INVALID_TTL"; then shift;
1374 echo >>expout "OFPT_PACKET_IN (OF1.3): total_len=76 in_port=ANY (via invalid_ttl) data_len=76 (unbuffered)
1375 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"
1378 # OFPT_PORT_STATUS, OFPPR_ADD
1379 ovs-vsctl add-port br0 test -- set Interface test type=dummy
1380 if test X"$1" = X"OFPPR_ADD"; then shift;
1381 echo >>expout "OFPT_PORT_STATUS (OF1.3): ADD: ${INDEX}(test): addr:aa:55:aa:55:00:0x
1384 speed: 0 Mbps now, 0 Mbps max"
1387 # OFPT_PORT_STATUS, OFPPR_DELETE
1388 ovs-vsctl del-port br0 test
1389 if test X"$1" = X"OFPPR_DELETE"; then shift;
1390 echo >>expout "OFPT_PORT_STATUS (OF1.3): DEL: ${INDEX}(test): addr:aa:55:aa:55:00:0x
1393 speed: 0 Mbps now, 0 Mbps max"
1396 # OFPT_FLOW_REMOVED, OFPRR_DELETE
1397 ovs-ofctl -O OpenFlow13 add-flow br0 send_flow_rem,actions=drop
1398 ovs-ofctl -O OpenFlow13 --strict del-flows br0 ''
1399 if test X"$1" = X"OFPRR_DELETE"; then shift;
1400 echo >>expout "OFPT_FLOW_REMOVED (OF1.3): reason=delete table_id=0"
1402 AT_FAIL_IF([test X"$1" != X])
1404 ovs-appctl -t ovs-ofctl ofctl/barrier
1405 echo >>expout "OFPT_BARRIER_REPLY (OF1.3):"
1409 s/ (xid=0x[0-9a-fA-F]*)//
1411 s/00:0.$/00:0x/' < monitor.log]],
1415 # It's a service connection so initially there should be no async messages.
1418 # Set miss_send_len to 128, turning on packet-ins for our service connection.
1419 ovs-appctl -t ovs-ofctl ofctl/send 0409000c0123456700000080
1420 check_async 2 OFPR_ACTION OFPPR_ADD OFPPR_DELETE OFPRR_DELETE
1422 # Become slave (OF 1.3), which should disable everything except port status.
1423 ovs-appctl -t ovs-ofctl ofctl/send 041800180000000200000003000000000000000000000001
1424 check_async 3 OFPPR_ADD OFPPR_DELETE
1426 # Use OF 1.3 OFPT_SET_ASYNC to enable a patchwork of asynchronous messages.
1427 ovs-appctl -t ovs-ofctl ofctl/send 041c002000000002000000020000000500000005000000020000000200000005
1428 check_async 4 OFPR_INVALID_TTL OFPPR_DELETE OFPRR_DELETE
1430 # Set controller ID 123.
1431 ovs-appctl -t ovs-ofctl ofctl/send 04040018000000030000232000000014000000000000007b
1432 check_async 5 OFPR_NO_MATCH OFPPR_DELETE OFPRR_DELETE
1434 # Restore controller ID 0.
1435 ovs-appctl -t ovs-ofctl ofctl/send 040400180000000300002320000000140000000000000000
1437 # Become master (OF 1.3).
1438 ovs-appctl -t ovs-ofctl ofctl/send 041800180000000400000002000000000000000000000002
1439 check_async 6 OFPR_ACTION OFPPR_ADD
1441 ovs-appctl -t ovs-ofctl exit
1445 dnl This test checks that the role request/response messaging works
1446 dnl and that generation_id is handled properly.
1447 AT_SETUP([ofproto - controller role (OpenFlow 1.2)])
1449 AT_CHECK([ovs-ofctl -O OpenFlow12 monitor br0 --detach --no-chdir --pidfile])
1451 ovs-appctl -t ovs-ofctl ofctl/barrier
1452 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
1455 # find out current role
1456 ovs-appctl -t ovs-ofctl ofctl/send 031800180000000200000000000000000000000000000000
1457 echo >>expout "send: OFPT_ROLE_REQUEST (OF1.2) (xid=0x2): role=nochange"
1458 echo >>expout "OFPT_ROLE_REPLY (OF1.2) (xid=0x2): role=equal"
1460 # Become slave (generation_id is initially undefined, so 2^63+2 should not be stale)
1461 ovs-appctl -t ovs-ofctl ofctl/send 031800180000000300000003000000008000000000000002
1462 echo >>expout "send: OFPT_ROLE_REQUEST (OF1.2) (xid=0x3): role=slave generation_id=9223372036854775810"
1463 echo >>expout "OFPT_ROLE_REPLY (OF1.2) (xid=0x3): role=slave generation_id=9223372036854775810"
1465 # Try to become the master using a stale generation ID
1466 ovs-appctl -t ovs-ofctl ofctl/send 031800180000000400000002000000000000000000000002
1467 echo >>expout "send: OFPT_ROLE_REQUEST (OF1.2) (xid=0x4): role=master generation_id=2"
1468 echo >>expout "OFPT_ERROR (OF1.2) (xid=0x4): OFPRRFC_STALE"
1469 echo >>expout "OFPT_ROLE_REQUEST (OF1.2) (xid=0x4): role=master generation_id=2"
1471 # Become master using a valid generation ID
1472 ovs-appctl -t ovs-ofctl ofctl/send 031800180000000500000002000000000000000000000001
1473 echo >>expout "send: OFPT_ROLE_REQUEST (OF1.2) (xid=0x5): role=master generation_id=1"
1474 echo >>expout "OFPT_ROLE_REPLY (OF1.2) (xid=0x5): role=master generation_id=1"
1475 ovs-appctl -t ovs-ofctl ofctl/barrier
1476 echo >>expout "OFPT_BARRIER_REPLY (OF1.2) (xid=0x3):"
1478 AT_CHECK([cat monitor.log], [0], [expout])
1480 ovs-appctl -t ovs-ofctl exit
1484 dnl This test checks that OFPT_PACKET_OUT accepts both OFPP_NONE (as
1485 dnl specified by OpenFlow 1.0) and OFPP_CONTROLLER (used by some
1486 dnl controllers despite the spec) as meaning a packet that was generated
1487 dnl by the controller.
1488 AT_SETUP([ofproto - packet-out from controller (OpenFlow 1.0)])
1490 ADD_OF_PORTS([br0], [1])
1492 # Start a monitor listening for packet-ins.
1493 AT_CHECK([ovs-ofctl -P openflow10 monitor br0 --detach --no-chdir --pidfile])
1494 ovs-appctl -t ovs-ofctl ofctl/send 0109000c0123456700000080
1495 ovs-appctl -t ovs-ofctl ofctl/barrier
1496 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
1497 AT_CAPTURE_FILE([monitor.log])
1499 # Send some packet-outs with OFPP_NONE and OFPP_CONTROLLER (65533) as in_port.
1500 AT_CHECK([ovs-ofctl packet-out br0 none controller,1 '0001020304050010203040501234'])
1501 AT_CHECK([ovs-ofctl packet-out br0 controller controller,1 '0001020304050010203040505678'])
1503 # Stop the monitor and check its output.
1504 ovs-appctl -t ovs-ofctl ofctl/barrier
1505 ovs-appctl -t ovs-ofctl exit
1507 ovs-ofctl dump-ports br0
1509 AT_CHECK([sed 's/ (xid=0x[[0-9a-fA-F]]*)//' monitor.log], [0], [dnl
1510 OFPT_PACKET_IN: total_len=14 in_port=ANY (via action) data_len=14 (unbuffered)
1511 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
1512 OFPT_PACKET_IN: total_len=14 in_port=CONTROLLER (via action) data_len=14 (unbuffered)
1513 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
1520 dnl This test checks that OFPT_PACKET_OUT accepts both OFPP_NONE (as
1521 dnl specified by OpenFlow 1.2) and OFPP_CONTROLLER (used by some
1522 dnl controllers despite the spec) as meaning a packet that was generated
1523 dnl by the controller.
1524 AT_SETUP([ofproto - packet-out from controller (OpenFlow 1.2)])
1527 # Start a monitor listening for packet-ins.
1528 AT_CHECK([ovs-ofctl -O OpenFlow12 monitor br0 --detach --no-chdir --pidfile])
1529 ovs-appctl -t ovs-ofctl ofctl/send 0309000c0123456700000080
1530 ovs-appctl -t ovs-ofctl ofctl/barrier
1531 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
1532 AT_CAPTURE_FILE([monitor.log])
1534 # Send some packet-outs with OFPP_NONE and OFPP_CONTROLLER (65533) as in_port.
1535 AT_CHECK([ovs-ofctl -O OpenFlow12 packet-out br0 none controller '0001020304050010203040501234'])
1536 AT_CHECK([ovs-ofctl -O OpenFlow12 packet-out br0 4294967293 controller '0001020304050010203040505678'])
1538 # Stop the monitor and check its output.
1539 ovs-appctl -t ovs-ofctl ofctl/barrier
1540 ovs-appctl -t ovs-ofctl exit
1542 AT_CHECK([sed 's/ (xid=0x[[0-9a-fA-F]]*)//' monitor.log], [0], [dnl
1543 OFPT_PACKET_IN (OF1.2): total_len=14 in_port=ANY (via action) data_len=14 (unbuffered)
1544 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
1545 OFPT_PACKET_IN (OF1.2): total_len=14 in_port=CONTROLLER (via action) data_len=14 (unbuffered)
1546 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
1547 OFPT_BARRIER_REPLY (OF1.2):
1553 dnl This test checks that metadata is encoded in packet_in structures,
1554 dnl supported by NXAST.
1555 AT_SETUP([ofproto - packet-out with metadata (NXM)])
1558 # Start a monitor listening for packet-ins.
1559 AT_CHECK([ovs-ofctl -P nxm monitor br0 --detach --no-chdir --pidfile])
1560 ovs-appctl -t ovs-ofctl ofctl/send 0109000c0123456700000080
1561 ovs-appctl -t ovs-ofctl ofctl/barrier
1562 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
1563 AT_CAPTURE_FILE([monitor.log])
1565 # Send a packet-out with a load action to set some metadata, and forward to controller
1566 AT_CHECK([ovs-ofctl packet-out br0 controller 'load(0xfafafafa5a5a5a5a->OXM_OF_METADATA[[0..63]]), controller' '0001020304050010203040501234'])
1568 # Stop the monitor and check its output.
1569 ovs-appctl -t ovs-ofctl ofctl/barrier
1570 ovs-appctl -t ovs-ofctl exit
1572 AT_CHECK([sed 's/ (xid=0x[[0-9a-fA-F]]*)//' monitor.log], [0], [dnl
1573 NXT_PACKET_IN: total_len=14 in_port=CONTROLLER metadata=0xfafafafa5a5a5a5a (via action) data_len=14 (unbuffered)
1574 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
1581 dnl This test checks that metadata is encoded in packet_in structures,
1582 dnl supported by NXAST.
1583 AT_SETUP([ofproto - packet-out with metadata (OpenFlow 1.2)])
1586 # Start a monitor listening for packet-ins.
1587 AT_CHECK([ovs-ofctl -O OpenFlow12 monitor br0 --detach --no-chdir --pidfile])
1588 ovs-appctl -t ovs-ofctl ofctl/send 0309000c0123456700000080
1589 ovs-appctl -t ovs-ofctl ofctl/barrier
1590 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
1591 AT_CAPTURE_FILE([monitor.log])
1593 # Send a packet-out with a load action to set some metadata, and forward to controller
1594 AT_CHECK([ovs-ofctl -O OpenFlow12 packet-out br0 none 'load(0xfafafafa5a5a5a5a->OXM_OF_METADATA[[0..63]]), controller' '0001020304050010203040501234'])
1596 # Stop the monitor and check its output.
1597 ovs-appctl -t ovs-ofctl ofctl/barrier
1598 ovs-appctl -t ovs-ofctl exit
1600 AT_CHECK([sed 's/ (xid=0x[[0-9a-fA-F]]*)//' monitor.log], [0], [dnl
1601 OFPT_PACKET_IN (OF1.2): total_len=14 in_port=ANY metadata=0xfafafafa5a5a5a5a (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=0x1234
1603 OFPT_BARRIER_REPLY (OF1.2):
1609 dnl This test checks that tunnel metadata is encoded in packet_in structures.
1610 AT_SETUP([ofproto - packet-out with tunnel metadata (OpenFlow 1.2)])
1613 # Start a monitor listening for packet-ins.
1614 AT_CHECK([ovs-ofctl -O OpenFlow12 monitor br0 --detach --no-chdir --pidfile])
1615 ovs-appctl -t ovs-ofctl ofctl/send 0309000c0123456700000080
1616 ovs-appctl -t ovs-ofctl ofctl/barrier
1617 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
1618 AT_CAPTURE_FILE([monitor.log])
1620 # Send a packet-out with set field actions to set some tunnel metadata, and forward to controller
1621 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'])
1623 # Stop the monitor and check its output.
1624 ovs-appctl -t ovs-ofctl ofctl/barrier
1625 ovs-appctl -t ovs-ofctl exit
1627 AT_CHECK([sed 's/ (xid=0x[[0-9a-fA-F]]*)//' monitor.log], [0], [dnl
1628 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)
1629 metadata=0,in_port=0,vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1234
1630 OFPT_BARRIER_REPLY (OF1.2):
1636 AT_SETUP([ofproto - flow monitoring])
1637 AT_KEYWORDS([monitor])
1640 ovs-ofctl add-flow br0 in_port=0,dl_vlan=123,actions=output:1
1642 # Start a monitor watching the flow table and check the initial reply.
1643 ovs-ofctl monitor br0 watch: --detach --no-chdir --pidfile >monitor.log 2>&1
1644 AT_CAPTURE_FILE([monitor.log])
1645 ovs-appctl -t ovs-ofctl ofctl/barrier
1646 AT_CHECK([sed 's/ (xid=0x[[1-9a-fA-F]][[0-9a-fA-F]]*)//' monitor.log], [0],
1647 [NXST_FLOW_MONITOR reply:
1648 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=123 actions=output:1
1652 # Add, delete, and modify some flows and check the updates.
1653 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
1654 ovs-ofctl add-flow br0 in_port=0,dl_vlan=124,actions=output:2
1655 ovs-ofctl add-flow br0 in_port=0,dl_vlan=123,actions=output:5
1656 ovs-ofctl add-flow br0 in_port=0,dl_vlan=123,dl_vlan_pcp=0,actions=output:6
1657 ovs-ofctl add-flow br0 in_port=0,dl_vlan=123,dl_vlan_pcp=1,actions=output:7
1658 ovs-ofctl add-flow br0 in_port=0,dl_vlan=123,actions=output:8
1659 ovs-ofctl add-flow br0 in_port=0,dl_vlan=65535,dl_vlan_pcp=0,actions=output:9
1660 ovs-ofctl add-flow br0 in_port=0,dl_vlan=65535,dl_vlan_pcp=1,actions=output:10
1661 ovs-ofctl add-flow br0 in_port=0,dl_vlan=65535,actions=output:11
1662 ovs-ofctl add-flow br0 in_port=0,dl_vlan=8191,dl_vlan_pcp=0,actions=output:12
1663 ovs-ofctl add-flow br0 in_port=0,dl_vlan=8191,dl_vlan_pcp=1,actions=output:13
1664 ovs-ofctl add-flow br0 in_port=0,dl_vlan=8191,actions=output:14
1665 ovs-ofctl add-flow br0 in_port=0,dl_vlan=0,dl_vlan_pcp=0,actions=output:15
1666 ovs-ofctl add-flow br0 in_port=0,dl_vlan=0,dl_vlan_pcp=1,actions=output:16
1667 ovs-ofctl add-flow br0 in_port=0,dl_vlan=0,actions=output:17
1668 ovs-ofctl add-flow br0 in_port=0,dl_vlan=0,dl_vlan_pcp=0,actions=output:18
1669 ovs-ofctl add-flow br0 in_port=0,dl_vlan=0,dl_vlan_pcp=1,actions=output:19
1670 ovs-ofctl add-flow br0 in_port=0,dl_vlan=0,actions=output:20
1671 ovs-ofctl add-flow br0 in_port=0,dl_vlan_pcp=0,actions=output:21
1672 ovs-ofctl add-flow br0 in_port=0,dl_vlan_pcp=1,actions=output:22
1673 ovs-ofctl add-flow br0 in_port=0,actions=output:23
1674 ovs-ofctl mod-flows br0 cookie=5,dl_vlan=123,actions=output:3
1675 ovs-ofctl del-flows br0 dl_vlan=123
1676 ovs-ofctl del-flows br0
1677 ovs-appctl -t ovs-ofctl ofctl/barrier
1679 # Sorts groups of lines that start with a space, without moving them
1680 # past the nearest line that does not start with a space.
1688 print $_ foreach sort(@buffer);
1693 print $_ foreach sort(@buffer);
1695 AT_CHECK([sed 's/ (xid=0x[[1-9a-fA-F]][[0-9a-fA-F]]*)//' monitor.log | ${PERL} -e "$sort"], [0],
1696 [NXST_FLOW_MONITOR reply (xid=0x0):
1697 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=124 actions=output:2
1698 NXST_FLOW_MONITOR reply (xid=0x0):
1699 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=123 actions=output:5
1700 NXST_FLOW_MONITOR reply (xid=0x0):
1701 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=123,dl_vlan_pcp=0 actions=output:6
1702 NXST_FLOW_MONITOR reply (xid=0x0):
1703 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=123,dl_vlan_pcp=1 actions=output:7
1704 NXST_FLOW_MONITOR reply (xid=0x0):
1705 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=123 actions=output:8
1706 NXST_FLOW_MONITOR reply (xid=0x0):
1707 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=0,dl_vlan_pcp=0 actions=output:9
1708 NXST_FLOW_MONITOR reply (xid=0x0):
1709 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=0,dl_vlan_pcp=1 actions=output:10
1710 NXST_FLOW_MONITOR reply (xid=0x0):
1711 event=ADDED table=0 cookie=0 in_port=0,vlan_tci=0x0000 actions=output:11
1712 NXST_FLOW_MONITOR reply (xid=0x0):
1713 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=4095,dl_vlan_pcp=0 actions=output:12
1714 NXST_FLOW_MONITOR reply (xid=0x0):
1715 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=4095,dl_vlan_pcp=1 actions=output:13
1716 NXST_FLOW_MONITOR reply (xid=0x0):
1717 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=4095 actions=output:14
1718 NXST_FLOW_MONITOR reply (xid=0x0):
1719 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=0,dl_vlan_pcp=0 actions=output:15
1720 NXST_FLOW_MONITOR reply (xid=0x0):
1721 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=0,dl_vlan_pcp=1 actions=output:16
1722 NXST_FLOW_MONITOR reply (xid=0x0):
1723 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=0 actions=output:17
1724 NXST_FLOW_MONITOR reply (xid=0x0):
1725 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=0,dl_vlan_pcp=0 actions=output:18
1726 NXST_FLOW_MONITOR reply (xid=0x0):
1727 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=0,dl_vlan_pcp=1 actions=output:19
1728 NXST_FLOW_MONITOR reply (xid=0x0):
1729 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=0 actions=output:20
1730 NXST_FLOW_MONITOR reply (xid=0x0):
1731 event=ADDED table=0 cookie=0 in_port=0,dl_vlan_pcp=0 actions=output:21
1732 NXST_FLOW_MONITOR reply (xid=0x0):
1733 event=ADDED table=0 cookie=0 in_port=0,dl_vlan_pcp=1 actions=output:22
1734 NXST_FLOW_MONITOR reply (xid=0x0):
1735 event=ADDED table=0 cookie=0 in_port=0 actions=output:23
1736 NXST_FLOW_MONITOR reply (xid=0x0):
1737 event=MODIFIED table=0 cookie=0x5 in_port=0,dl_vlan=123 actions=output:3
1738 event=MODIFIED table=0 cookie=0x5 in_port=0,dl_vlan=123,dl_vlan_pcp=0 actions=output:3
1739 event=MODIFIED table=0 cookie=0x5 in_port=0,dl_vlan=123,dl_vlan_pcp=1 actions=output:3
1740 NXST_FLOW_MONITOR reply (xid=0x0):
1741 event=DELETED reason=delete table=0 cookie=0x5 in_port=0,dl_vlan=123 actions=output:3
1742 event=DELETED reason=delete table=0 cookie=0x5 in_port=0,dl_vlan=123,dl_vlan_pcp=0 actions=output:3
1743 event=DELETED reason=delete table=0 cookie=0x5 in_port=0,dl_vlan=123,dl_vlan_pcp=1 actions=output:3
1744 NXST_FLOW_MONITOR reply (xid=0x0):
1745 event=DELETED reason=delete table=0 cookie=0 in_port=0 actions=output:23
1746 event=DELETED reason=delete table=0 cookie=0 in_port=0,dl_vlan=0 actions=output:20
1747 event=DELETED reason=delete table=0 cookie=0 in_port=0,dl_vlan=0,dl_vlan_pcp=0 actions=output:18
1748 event=DELETED reason=delete table=0 cookie=0 in_port=0,dl_vlan=0,dl_vlan_pcp=1 actions=output:19
1749 event=DELETED reason=delete table=0 cookie=0 in_port=0,dl_vlan=124 actions=output:2
1750 event=DELETED reason=delete table=0 cookie=0 in_port=0,dl_vlan=4095 actions=output:14
1751 event=DELETED reason=delete table=0 cookie=0 in_port=0,dl_vlan=4095,dl_vlan_pcp=0 actions=output:12
1752 event=DELETED reason=delete table=0 cookie=0 in_port=0,dl_vlan=4095,dl_vlan_pcp=1 actions=output:13
1753 event=DELETED reason=delete table=0 cookie=0 in_port=0,dl_vlan_pcp=0 actions=output:21
1754 event=DELETED reason=delete table=0 cookie=0 in_port=0,dl_vlan_pcp=1 actions=output:22
1755 event=DELETED reason=delete table=0 cookie=0 in_port=0,vlan_tci=0x0000 actions=output:11
1759 # Check that our own changes are reported as abbreviations.
1760 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
1761 ovs-ofctl add-flow br0 in_port=1,actions=output:2
1762 ovs-ofctl add-flow br0 in_port=2,actions=output:1
1763 ovs-appctl -t ovs-ofctl ofctl/barrier
1764 ovs-appctl -t ovs-ofctl ofctl/send 010e004812345678003fffff00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003000000000000ffffffffffff0000
1765 ovs-appctl -t ovs-ofctl ofctl/barrier
1766 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip], [0], [NXST_FLOW reply:
1768 AT_CHECK([sed 's/ (xid=0x[[1-9a-fA-F]][[0-9a-fA-F]]*)//' monitor.log], [0],
1769 [NXST_FLOW_MONITOR reply (xid=0x0):
1770 event=ADDED table=0 cookie=0 in_port=1 actions=output:2
1771 NXST_FLOW_MONITOR reply (xid=0x0):
1772 event=ADDED table=0 cookie=0 in_port=2 actions=output:1
1774 send: OFPT_FLOW_MOD: DEL priority=0 actions=drop
1775 NXST_FLOW_MONITOR reply (xid=0x0):
1776 event=ABBREV xid=0x12345678
1780 ovs-appctl -t ovs-ofctl exit
1784 AT_SETUP([ofproto - flow monitoring pause and resume])
1785 AT_KEYWORDS([monitor])
1787 # The maximum socket receive buffer size is important for this test, which
1788 # tests behavior when the receive buffer overflows.
1789 if test -e /proc/sys/net/core/rmem_max; then
1791 rmem_max=`cat /proc/sys/net/core/rmem_max`
1792 elif rmem_max=`sysctl -n net.inet.tcp.recvbuf_max 2>/dev/null`; then
1795 # Don't know how to get maximum socket receive buffer on this OS
1798 # Calculate the total amount of queuing: rmem_max in the kernel, 128 kB
1799 # in ofproto sending userspace (see ofmonitor_flush() in connmgr.c).
1800 queue_size=`expr $rmem_max + 128 \* 1024`
1801 echo rmem_max=$rmem_max queue_size=$queue_size
1803 # Each flow update message takes up at least 48 bytes of space in queues
1804 # and in practice more than that.
1805 n_msgs=`expr $queue_size / 48`
1810 # Start a monitor watching the flow table, then make it block.
1811 ON_EXIT([kill `cat ovs-ofctl.pid`])
1812 ovs-ofctl monitor br0 watch: --detach --no-chdir --pidfile >monitor.log 2>&1
1813 AT_CAPTURE_FILE([monitor.log])
1814 ovs-appctl -t ovs-ofctl ofctl/block
1816 # Add $n_msgs flows.
1817 (echo "in_port=2,actions=output:2"
1819 for ($i = 0; $i < '$n_msgs'; $i++) {
1820 print "cookie=1,reg1=$i,actions=drop\n";
1823 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
1824 # Check that multipart flow dumps work properly:
1825 AT_CHECK([ovs-ofctl diff-flows br0 flows.txt])
1826 AT_CHECK([ovs-ofctl add-flow br0 in_port=1,cookie=3,actions=drop])
1827 AT_CHECK([ovs-ofctl mod-flows br0 in_port=2,cookie=2,actions=output:2])
1828 AT_CHECK([ovs-ofctl del-flows br0 cookie=1/-1])
1830 ovs-appctl -t ovs-ofctl ofctl/unblock
1831 ovs-appctl -t ovs-ofctl ofctl/barrier
1833 ovs-appctl -t ovs-ofctl exit
1835 # Check that the flow monitor reported the same number of flows
1836 # added and deleted, but fewer than we actually added and deleted.
1837 adds=`grep -c 'ADDED.*reg1=' monitor.log`
1838 deletes=`grep -c 'DELETED.*reg1=' monitor.log`
1839 echo adds=$adds deletes=$deletes
1840 AT_CHECK([test $adds -gt 100 && test $adds -lt $n_msgs])
1841 AT_CHECK([test $adds = $deletes])
1843 # Check that the flow monitor reported everything in the expected order:
1845 # event=ADDED table=0 cookie=0x1 reg1=0x22
1847 # NXT_FLOW_MONITOR_PAUSED:
1849 # event=DELETED reason=delete table=0 cookie=0x1 reg1=0x22
1851 # event=ADDED table=0 cookie=0x3 in_port=1
1852 # event=MODIFIED table=0 cookie=0x2 in_port=2 actions=output:2
1853 # NXT_FLOW_MONITOR_RESUMED:
1855 # except that, between the PAUSED and RESUMED, the order of the ADDED
1856 # and MODIFIED lines lines depends on hash order, that is, it varies
1857 # as we change the hash function or change architecture. Therefore,
1858 # we use a couple of tests below to accept both orders.
1859 AT_CHECK([ofctl_strip < monitor.log | sed -n -e '
1862 /NXT_FLOW_MONITOR_PAUSED:/p
1863 /NXT_FLOW_MONITOR_RESUMED:/p
1864 ' > monitor.log.subset])
1865 AT_CHECK([grep -v MODIFIED monitor.log.subset], [0], [dnl
1866 event=ADDED table=0 cookie=0x1 reg1=0x22
1867 NXT_FLOW_MONITOR_PAUSED:
1868 event=DELETED reason=delete table=0 cookie=0x1 reg1=0x22
1869 event=ADDED table=0 cookie=0x3 in_port=1
1870 NXT_FLOW_MONITOR_RESUMED:
1872 AT_CHECK([grep -v ADDED monitor.log.subset], [0], [dnl
1873 NXT_FLOW_MONITOR_PAUSED:
1874 event=DELETED reason=delete table=0 cookie=0x1 reg1=0x22
1875 event=MODIFIED table=0 cookie=0x2 in_port=2 actions=output:2
1876 NXT_FLOW_MONITOR_RESUMED: