3 AT_SETUP([ofproto - echo request])
5 AT_CHECK([ovs-ofctl -vwarn probe br0])
9 AT_SETUP([ofproto - feature request, config request])
11 AT_CHECK([ovs-ofctl -vwarn show br0], [0], [stdout])
12 AT_CHECK([STRIP_XIDS stdout], [0], [dnl
13 OFPT_FEATURES_REPLY: dpid:fedcba9876543210
14 n_tables:254, n_buffers:256
15 capabilities: FLOW_STATS TABLE_STATS PORT_STATS QUEUE_STATS ARP_MATCH_IP
16 actions: OUTPUT SET_VLAN_VID SET_VLAN_PCP STRIP_VLAN SET_DL_SRC SET_DL_DST SET_NW_SRC SET_NW_DST SET_NW_TOS SET_TP_SRC SET_TP_DST ENQUEUE
17 LOCAL(br0): addr:aa:55:aa:55:00:00
20 speed: 0 Mbps now, 0 Mbps max
21 OFPT_GET_CONFIG_REPLY: frags=normal miss_send_len=0
26 AT_SETUP([ofproto - set OpenFlow port number])
28 [add-port br0 p1 -- set Interface p1 type=dummy --\
29 add-port br0 p2 -- set Interface p2 type=dummy ofport_request=99])
30 AT_CHECK([ovs-ofctl -vwarn show br0], [0], [stdout])
32 s/ (xid=0x[0-9a-fA-F]*)//
33 s/00:0.$/00:0x/' < stdout]],
35 OFPT_FEATURES_REPLY: dpid:fedcba9876543210
36 n_tables:254, n_buffers:256
37 capabilities: FLOW_STATS TABLE_STATS PORT_STATS QUEUE_STATS ARP_MATCH_IP
38 actions: OUTPUT SET_VLAN_VID SET_VLAN_PCP STRIP_VLAN SET_DL_SRC SET_DL_DST SET_NW_SRC SET_NW_DST SET_NW_TOS SET_TP_SRC SET_TP_DST ENQUEUE
39 1(p1): addr:aa:55:aa:55:00:0x
42 speed: 0 Mbps now, 0 Mbps max
43 99(p2): addr:aa:55:aa:55:00:0x
46 speed: 0 Mbps now, 0 Mbps max
47 LOCAL(br0): addr:aa:55:aa:55:00:0x
50 speed: 0 Mbps now, 0 Mbps max
51 OFPT_GET_CONFIG_REPLY: frags=normal miss_send_len=0
57 dnl This is really bare-bones.
58 dnl It at least checks request and reply serialization and deserialization.
59 AT_SETUP([ofproto - port stats - (OpenFlow 1.0)])
61 AT_CHECK([ovs-ofctl -vwarn dump-ports br0], [0], [stdout])
62 AT_CHECK([STRIP_XIDS stdout], [0], [dnl
63 OFPST_PORT reply: 1 ports
64 port LOCAL: rx pkts=0, bytes=0, drop=0, errs=0, frame=0, over=0, crc=0
65 tx pkts=0, bytes=0, drop=0, errs=0, coll=0
70 AT_SETUP([ofproto - port stats - (OpenFlow 1.2)])
72 AT_CHECK([ovs-ofctl -O OpenFlow12 -vwarn dump-ports br0], [0], [stdout])
73 AT_CHECK([STRIP_XIDS stdout], [0], [dnl
74 OFPST_PORT reply (OF1.2): 1 ports
75 port LOCAL: rx pkts=0, bytes=0, drop=0, errs=0, frame=0, over=0, crc=0
76 tx pkts=0, bytes=0, drop=0, errs=0, coll=0
81 dnl This is really bare-bones.
82 dnl It at least checks request and reply serialization and deserialization.
83 AT_SETUP([ofproto - port-desc stats (OpenFlow 1.0)])
85 AT_CHECK([ovs-ofctl -vwarn dump-ports-desc br0], [0], [stdout])
86 AT_CHECK([STRIP_XIDS stdout], [0], [dnl
87 OFPST_PORT_DESC reply:
88 LOCAL(br0): addr:aa:55:aa:55:00:00
91 speed: 0 Mbps now, 0 Mbps max
96 dnl This is really bare-bones.
97 dnl It at least checks request and reply serialization and deserialization.
98 AT_SETUP([ofproto - port-desc stats (OpenFlow 1.2)])
100 AT_CHECK([ovs-ofctl -O OpenFlow12 -vwarn dump-ports-desc br0], [0], [stdout])
101 AT_CHECK([STRIP_XIDS stdout], [0], [dnl
102 OFPST_PORT_DESC reply (OF1.2):
103 LOCAL(br0): addr:aa:55:aa:55:00:00
106 speed: 0 Mbps now, 0 Mbps max
111 dnl This is really bare-bones.
112 dnl It at least checks request and reply serialization and deserialization.
113 AT_SETUP([ofproto - queue stats - (OpenFlow 1.0)])
115 AT_CHECK([ovs-ofctl -vwarn queue-stats br0], [0], [stdout])
116 AT_CHECK([STRIP_XIDS stdout], [0], [dnl
117 OFPST_QUEUE reply: 0 queues
119 AT_CHECK([ovs-ofctl -vwarn queue-stats br0 ANY 5], [0],
120 [OFPT_ERROR (xid=0x2): OFPQOFC_BAD_QUEUE
121 OFPST_QUEUE request (xid=0x2):port=ANY queue=5
123 AT_CHECK([ovs-ofctl -vwarn queue-stats br0 10], [0],
124 [OFPT_ERROR (xid=0x2): OFPQOFC_BAD_PORT
125 OFPST_QUEUE request (xid=0x2):port=10 queue=ALL
130 AT_SETUP([ofproto - queue stats - (OpenFlow 1.2)])
132 AT_CHECK([ovs-ofctl -O OpenFlow12 -vwarn queue-stats br0], [0], [stdout])
133 AT_CHECK([STRIP_XIDS stdout], [0], [dnl
134 OFPST_QUEUE reply (OF1.2): 0 queues
136 AT_CHECK([ovs-ofctl -O OpenFlow12 -vwarn queue-stats br0 ALL 5], [0],
137 [OFPT_ERROR (OF1.2) (xid=0x2): OFPQOFC_BAD_QUEUE
138 OFPST_QUEUE request (OF1.2) (xid=0x2):port=ANY queue=5
140 AT_CHECK([ovs-ofctl -O OpenFlow12 -vwarn queue-stats br0 10], [0],
141 [OFPT_ERROR (OF1.2) (xid=0x2): OFPQOFC_BAD_PORT
142 OFPST_QUEUE request (OF1.2) (xid=0x2):port=10 queue=ALL
147 dnl This is really bare-bones.
148 dnl It at least checks request and reply serialization and deserialization.
149 AT_SETUP([ofproto - queue configuration - (OpenFlow 1.0)])
151 ADD_OF_PORTS([br0], [1], [2])
152 AT_CHECK([ovs-ofctl queue-get-config br0 1], [0], [stdout])
153 AT_CHECK([STRIP_XIDS stdout], [0], [dnl
154 OFPT_QUEUE_GET_CONFIG_REPLY: port=1
156 AT_CHECK([ovs-ofctl queue-get-config br0 10], [0],
157 [OFPT_ERROR (xid=0x2): OFPQOFC_BAD_PORT
158 OFPT_QUEUE_GET_CONFIG_REQUEST (xid=0x2): port=10
163 AT_SETUP([ofproto - queue configuration - (OpenFlow 1.2)])
165 ADD_OF_PORTS([br0], [1], [2])
166 AT_CHECK([ovs-ofctl -O OpenFlow12 queue-get-config br0 1], [0], [stdout])
167 AT_CHECK([STRIP_XIDS stdout], [0], [dnl
168 OFPT_QUEUE_GET_CONFIG_REPLY (OF1.2): port=1
170 AT_CHECK([ovs-ofctl -O OpenFlow12 queue-get-config br0 10], [0],
171 [OFPT_ERROR (OF1.2) (xid=0x2): OFPQOFC_BAD_PORT
172 OFPT_QUEUE_GET_CONFIG_REQUEST (OF1.2) (xid=0x2): port=10
177 dnl This is really bare-bones.
178 dnl It at least checks request and reply serialization and deserialization.
179 AT_SETUP([ofproto - group features])
181 AT_CHECK([ovs-ofctl -O OpenFlow12 -vwarn dump-group-features br0], [0], [stdout])
182 AT_CHECK([STRIP_XIDS stdout], [0], [dnl
183 OFPST_GROUP_FEATURES reply (OF1.2):
191 AT_SETUP([ofproto - mod-port (OpenFlow 1.0)])
193 for command_config_state in \
195 'noflood NO_FLOOD 0' \
196 'down PORT_DOWN,NO_FLOOD LINK_DOWN' \
197 'flood PORT_DOWN LINK_DOWN' \
198 'no-receive PORT_DOWN,NO_RECV LINK_DOWN' \
199 'no-forward PORT_DOWN,NO_RECV,NO_FWD LINK_DOWN' \
200 'no-packet-in PORT_DOWN,NO_RECV,NO_FWD,NO_PACKET_IN LINK_DOWN' \
201 'forward PORT_DOWN,NO_RECV,NO_PACKET_IN LINK_DOWN' \
202 'packet-in PORT_DOWN,NO_RECV LINK_DOWN' \
206 set $command_config_state
207 command=$[1] config=`echo $[2] | sed 's/,/ /g'` state=$[3]
208 AT_CHECK([ovs-ofctl -vwarn mod-port br0 br0 $command])
209 AT_CHECK([ovs-ofctl -vwarn show br0], [0], [stdout])
210 AT_CHECK_UNQUOTED([STRIP_XIDS stdout], [0], [dnl
211 OFPT_FEATURES_REPLY: dpid:fedcba9876543210
212 n_tables:254, n_buffers:256
213 capabilities: FLOW_STATS TABLE_STATS PORT_STATS QUEUE_STATS ARP_MATCH_IP
214 actions: OUTPUT SET_VLAN_VID SET_VLAN_PCP STRIP_VLAN SET_DL_SRC SET_DL_DST SET_NW_SRC SET_NW_DST SET_NW_TOS SET_TP_SRC SET_TP_DST ENQUEUE
215 LOCAL(br0): addr:aa:55:aa:55:00:00
218 speed: 0 Mbps now, 0 Mbps max
219 OFPT_GET_CONFIG_REPLY: frags=normal miss_send_len=0
225 AT_SETUP([ofproto - mod-port (OpenFlow 1.2)])
227 for command_config_state in \
229 'down PORT_DOWN LINK_DOWN' \
230 'no-receive PORT_DOWN,NO_RECV LINK_DOWN' \
231 'no-forward PORT_DOWN,NO_RECV,NO_FWD LINK_DOWN' \
232 'no-packet-in PORT_DOWN,NO_RECV,NO_FWD,NO_PACKET_IN LINK_DOWN' \
233 'forward PORT_DOWN,NO_RECV,NO_PACKET_IN LINK_DOWN' \
234 'packet-in PORT_DOWN,NO_RECV LINK_DOWN' \
238 set $command_config_state
239 command=$[1] config=`echo $[2] | sed 's/,/ /g'` state=$[3]
240 AT_CHECK([ovs-ofctl -O OpenFlow12 -vwarn mod-port br0 br0 $command])
241 AT_CHECK([ovs-ofctl -O OpenFlow12 -vwarn show br0], [0], [stdout])
242 AT_CHECK_UNQUOTED([STRIP_XIDS stdout], [0], [dnl
243 OFPT_FEATURES_REPLY (OF1.2): dpid:fedcba9876543210
244 n_tables:254, n_buffers:256
245 capabilities: FLOW_STATS TABLE_STATS PORT_STATS QUEUE_STATS
246 LOCAL(br0): addr:aa:55:aa:55:00:00
249 speed: 0 Mbps now, 0 Mbps max
250 OFPT_GET_CONFIG_REPLY (OF1.2): frags=normal miss_send_len=0
256 AT_SETUP([ofproto - basic flow_mod commands (NXM)])
258 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip], [0], [NXST_FLOW reply:
260 AT_CHECK([echo 'in_port=2,actions=1' | ovs-ofctl add-flows br0 -])
261 AT_CHECK([ovs-ofctl add-flow br0 in_port=1,actions=2])
262 AT_CHECK([ovs-ofctl -F nxm add-flow br0 table=1,in_port=4,actions=3])
263 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
264 in_port=1 actions=output:2
265 in_port=2 actions=output:1
266 table=1, in_port=4 actions=output:3
269 AT_CHECK([ovs-ofctl dump-aggregate br0 table=0 | STRIP_XIDS], [0], [dnl
270 NXST_AGGREGATE reply: packet_count=0 byte_count=0 flow_count=2
272 AT_CHECK([ovs-ofctl del-flows br0])
273 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip], [0], [NXST_FLOW reply:
278 AT_SETUP([ofproto - basic flow_mod commands (OpenFlow 1.0)])
280 AT_CHECK([ovs-ofctl -F openflow10 dump-flows br0 | ofctl_strip], [0], [OFPST_FLOW reply:
282 AT_CHECK([echo 'in_port=2,actions=1' | ovs-ofctl -F openflow10 add-flows br0 -])
283 AT_CHECK([ovs-ofctl -F openflow10 add-flow br0 in_port=1,actions=2])
284 AT_CHECK([ovs-ofctl -F openflow10 add-flow br0 table=1,in_port=4,actions=3])
285 AT_CHECK([ovs-ofctl -F openflow10 dump-flows br0 | ofctl_strip | sort], [0], [dnl
286 in_port=1 actions=output:2
287 in_port=2 actions=output:1
288 table=1, in_port=4 actions=output:3
291 AT_CHECK([ovs-ofctl -F openflow10 dump-aggregate br0 table=0 | STRIP_XIDS], [0], [dnl
292 OFPST_AGGREGATE reply: packet_count=0 byte_count=0 flow_count=2
294 AT_CHECK([ovs-ofctl -F openflow10 del-flows br0])
295 AT_CHECK([ovs-ofctl -F openflow10 dump-flows br0 | ofctl_strip], [0], [OFPST_FLOW reply:
300 AT_SETUP([ofproto - basic flow_mod commands (OpenFlow 1.1)])
302 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip], [0], [OFPST_FLOW reply (OF1.1):
304 AT_CHECK([echo 'in_port=2,actions=1' | ovs-ofctl -O OpenFlow11 add-flows br0 -])
305 AT_CHECK([ovs-ofctl -O OpenFlow11 add-flow br0 in_port=1,actions=2])
306 AT_CHECK([ovs-ofctl -O OpenFlow11 add-flow br0 table=1,in_port=4,actions=3])
307 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0], [dnl
308 in_port=1 actions=output:2
309 in_port=2 actions=output:1
310 table=1, in_port=4 actions=output:3
311 OFPST_FLOW reply (OF1.1):
313 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-aggregate br0 table=0 | STRIP_XIDS], [0], [dnl
314 OFPST_AGGREGATE reply (OF1.1): packet_count=0 byte_count=0 flow_count=2
316 AT_CHECK([ovs-ofctl -O OpenFlow11 del-flows br0])
317 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip], [0], [OFPST_FLOW reply (OF1.1):
318 table=1, in_port=4 actions=output:3
323 AT_SETUP([ofproto - flow_mod negative test (OpenFlow 1.1)])
325 [set bridge br0 protocols=OpenFlow10,OpenFlow11,OpenFlow12,OpenFlow13])
326 AT_CHECK([ovs-ofctl add-flow -O OpenFlow11 br0 table=1,action=goto_table:2])
328 # The error message here actually comes from ovs-ofctl, not from ovs-vswitchd,
329 # but at least it's the same code in ofpacts_check() that issues the error.
330 AT_CHECK([ovs-ofctl add-flow -O OpenFlow11 br0 table=1,action=goto_table:1],
332 [ovs-ofctl: actions are invalid with specified match (OFPBRC_BAD_TABLE_ID)
337 AT_SETUP([ofproto - set-field flow_mod commands (NXM)])
339 AT_CHECK([ovs-ofctl add-flow br0 ipv6,table=1,in_port=3,actions=drop])
340 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])
341 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
342 table=1, ipv6,in_port=3 actions=load:0xa6badbfffefe59fa->NXM_NX_IPV6_SRC[[0..63]],load:0xfe8001234567890a->NXM_NX_IPV6_SRC[[64..127]]
348 AT_SETUP([ofproto - basic flow_mod commands (OpenFlow 1.2)])
350 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip], [0], [OFPST_FLOW reply (OF1.2):
352 AT_CHECK([echo 'in_port=2,actions=1' | ovs-ofctl -O OpenFlow12 add-flows br0 -])
353 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 in_port=1,actions=2])
354 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 table=1,in_port=4,actions=3])
355 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
356 in_port=1 actions=output:2
357 in_port=2 actions=output:1
358 table=1, in_port=4 actions=output:3
359 OFPST_FLOW reply (OF1.2):
361 AT_CHECK([ovs-ofctl -O OpenFlow12 del-flows br0])
362 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip], [0], [OFPST_FLOW reply (OF1.2):
367 AT_SETUP([ofproto - dump flows with cookie])
369 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x1,in_port=1,actions=1])
370 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x2,in_port=2,actions=1])
371 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x3,in_port=3,actions=1])
372 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
373 cookie=0x1, in_port=1 actions=output:1
374 cookie=0x2, in_port=2 actions=output:1
375 cookie=0x3, in_port=3 actions=output:1
378 AT_CHECK([ovs-ofctl dump-aggregate br0 table=0 | STRIP_XIDS], [0], [dnl
379 NXST_AGGREGATE reply: packet_count=0 byte_count=0 flow_count=3
381 AT_CHECK([ovs-ofctl dump-flows br0 cookie=0x3/-1 | ofctl_strip | sort], [0], [dnl
382 cookie=0x3, in_port=3 actions=output:1
385 AT_CHECK([ovs-ofctl dump-aggregate br0 cookie=0x3/-1 | STRIP_XIDS], [0], [dnl
386 NXST_AGGREGATE reply: packet_count=0 byte_count=0 flow_count=1
391 AT_SETUP([ofproto - mod flow with cookie change (OpenFlow 1.0)])
393 AT_CHECK([ovs-ofctl -F openflow10 add-flow br0 cookie=0x1,in_port=1,actions=1])
394 AT_CHECK([ovs-ofctl -F openflow10 dump-flows br0 | ofctl_strip | sort], [0], [dnl
395 cookie=0x1, in_port=1 actions=output:1
399 AT_CHECK([ovs-ofctl -F openflow10 mod-flows br0 cookie=0x2,in_port=1,actions=1])
400 AT_CHECK([ovs-ofctl -F openflow10 dump-flows br0 | ofctl_strip | sort], [0], [dnl
401 cookie=0x2, in_port=1 actions=output:1
407 AT_SETUP([ofproto - mod flow with cookie change (NXM)])
409 AT_CHECK([ovs-ofctl -F nxm add-flow br0 cookie=0x1,in_port=1,actions=1])
410 AT_CHECK([ovs-ofctl -F nxm dump-flows br0 | ofctl_strip | sort], [0], [dnl
411 cookie=0x1, in_port=1 actions=output:1
415 AT_CHECK([ovs-ofctl -F nxm mod-flows br0 cookie=0x2,in_port=1,actions=1])
416 AT_CHECK([ovs-ofctl -F nxm dump-flows br0 | ofctl_strip | sort], [0], [dnl
417 cookie=0x2, in_port=1 actions=output:1
423 AT_SETUP([ofproto - no mod flow with cookie change (OpenFlow 1.1)])
425 AT_CHECK([ovs-ofctl -O OpenFlow11 add-flow br0 cookie=0x1,in_port=1,actions=1])
426 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0], [dnl
427 cookie=0x1, in_port=1 actions=output:1
428 OFPST_FLOW reply (OF1.1):
430 AT_CHECK([ovs-ofctl -O OpenFlow11 mod-flows br0 cookie=0x2,in_port=1,actions=1])
431 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0], [dnl
432 cookie=0x1, in_port=1 actions=output:1
433 OFPST_FLOW reply (OF1.1):
438 dnl The OpenFlow 1.2 spec states that the cookie may not be modified
439 AT_SETUP([ofproto - no mod flow with cookie change (OpenFlow 1.2)])
441 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 cookie=0x1,in_port=1,actions=1])
442 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
443 cookie=0x1, in_port=1 actions=output:1
444 OFPST_FLOW reply (OF1.2):
447 AT_CHECK([ovs-ofctl -O OpenFlow12 mod-flows br0 cookie=0x2,in_port=1,actions=1])
448 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
449 cookie=0x1, in_port=1 actions=output:1
450 OFPST_FLOW reply (OF1.2):
455 AT_SETUP([ofproto - mod flows based on cookie mask (OpenFlow 1.0)])
457 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x1,in_port=1,actions=1])
458 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x1,in_port=2,actions=1])
459 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x2,in_port=3,actions=1])
460 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
461 cookie=0x1, in_port=1 actions=output:1
462 cookie=0x1, in_port=2 actions=output:1
463 cookie=0x2, in_port=3 actions=output:1
467 AT_CHECK([ovs-ofctl -F nxm mod-flows br0 cookie=0x1/0xff,actions=4])
468 AT_CHECK([ovs-ofctl -F nxm dump-flows br0 | ofctl_strip | sort], [0], [dnl
469 cookie=0x1, in_port=1 actions=output:4
470 cookie=0x1, in_port=2 actions=output:4
471 cookie=0x2, in_port=3 actions=output:1
477 AT_SETUP([ofproto - mod flows based on cookie mask (OpenFlow 1.1)])
479 AT_CHECK([ovs-ofctl -O OpenFlow11 add-flow br0 cookie=0x1,in_port=1,actions=1])
480 AT_CHECK([ovs-ofctl -O OpenFlow11 add-flow br0 cookie=0x1,in_port=2,actions=1])
481 AT_CHECK([ovs-ofctl -O OpenFlow11 add-flow br0 cookie=0x2,in_port=3,actions=1])
482 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0], [dnl
483 cookie=0x1, in_port=1 actions=output:1
484 cookie=0x1, in_port=2 actions=output:1
485 cookie=0x2, in_port=3 actions=output:1
486 OFPST_FLOW reply (OF1.1):
489 AT_CHECK([ovs-ofctl -O OpenFlow11 mod-flows br0 cookie=0x1/0xff,actions=4])
490 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0], [dnl
491 cookie=0x1, in_port=1 actions=output:4
492 cookie=0x1, in_port=2 actions=output:4
493 cookie=0x2, in_port=3 actions=output:1
494 OFPST_FLOW reply (OF1.1):
499 AT_SETUP([ofproto - mod flows based on cookie mask (OpenFlow 1.2)])
501 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 cookie=0x1,in_port=1,actions=1])
502 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 cookie=0x1,in_port=2,actions=1])
503 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 cookie=0x2,in_port=3,actions=1])
504 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
505 cookie=0x1, in_port=1 actions=output:1
506 cookie=0x1, in_port=2 actions=output:1
507 cookie=0x2, in_port=3 actions=output:1
508 OFPST_FLOW reply (OF1.2):
511 AT_CHECK([ovs-ofctl -O OpenFlow12 mod-flows br0 cookie=0x1/0xff,actions=4])
512 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
513 cookie=0x1, in_port=1 actions=output:4
514 cookie=0x1, in_port=2 actions=output:4
515 cookie=0x2, in_port=3 actions=output:1
516 OFPST_FLOW reply (OF1.2):
521 dnl The OpenFlow 1.2 spec states that the cookie may not be modified
522 AT_SETUP([ofproto - mod flows based on cookie mask with cookie change])
524 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x1,in_port=1,actions=1])
525 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x1,in_port=2,actions=1])
526 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x2,in_port=3,actions=1])
527 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
528 cookie=0x1, in_port=1 actions=output:1
529 cookie=0x1, in_port=2 actions=output:1
530 cookie=0x2, in_port=3 actions=output:1
534 AT_CHECK([ovs-ofctl -F nxm mod-flows br0 cookie=1/-1,cookie=4,actions=4])
535 AT_CHECK([ovs-ofctl -F nxm dump-flows br0 | ofctl_strip | sort], [0], [dnl
536 cookie=0x2, in_port=3 actions=output:1
537 cookie=0x4, in_port=1 actions=output:4
538 cookie=0x4, in_port=2 actions=output:4
544 AT_SETUP([ofproto - mod flow with cookie miss (mask==0) - NXM])
546 AT_CHECK([ovs-ofctl -F nxm mod-flows br0 in_port=1,actions=1])
547 AT_CHECK([ovs-ofctl -F nxm dump-flows br0 | ofctl_strip | sort], [0], [dnl
548 in_port=1 actions=output:1
554 AT_SETUP([ofproto - mod flow with cookie miss (mask==0) - OF1.1])
556 AT_CHECK([ovs-ofctl -O openflow11 mod-flows br0 in_port=1,actions=1])
557 AT_CHECK([ovs-ofctl -O openflow11 dump-flows br0 | ofctl_strip | sort], [0], [dnl
558 in_port=1 actions=output:1
559 OFPST_FLOW reply (OF1.1):
564 AT_SETUP([ofproto - mod flow with cookie miss (mask==0) - OF1.2])
566 AT_CHECK([ovs-ofctl -O openflow12 mod-flows br0 in_port=1,actions=1])
567 AT_CHECK([ovs-ofctl -O openflow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
568 OFPST_FLOW reply (OF1.2):
573 AT_SETUP([ofproto - mod flow with cookie miss (mask!=0) - NXM])
575 AT_CHECK([ovs-ofctl -F nxm mod-flows br0 cookie=1/1,in_port=1,actions=1])
576 AT_CHECK([ovs-ofctl -F nxm dump-flows br0 | ofctl_strip | sort], [0], [dnl
582 AT_SETUP([ofproto - mod flow with cookie miss (mask!=0) - OF1.1])
584 AT_CHECK([ovs-ofctl -O openflow11 mod-flows br0 cookie=1/1,in_port=1,actions=1])
585 AT_CHECK([ovs-ofctl -O openflow11 dump-flows br0 | ofctl_strip | sort], [0], [dnl
586 OFPST_FLOW reply (OF1.1):
591 AT_SETUP([ofproto - mod flow with cookie miss (mask!=0) - OF1.2])
593 AT_CHECK([ovs-ofctl -O openflow12 mod-flows br0 cookie=1/1,in_port=1,actions=1])
594 AT_CHECK([ovs-ofctl -O openflow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
595 OFPST_FLOW reply (OF1.2):
600 AT_SETUP([ofproto - del flows with cookies])
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,actions=1])
604 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x3,in_port=3,actions=1])
605 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
606 cookie=0x1, in_port=1 actions=output:1
607 cookie=0x2, in_port=2 actions=output:1
608 cookie=0x3, in_port=3 actions=output:1
612 AT_CHECK([ovs-ofctl del-flows br0])
613 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
619 AT_SETUP([ofproto - del flows based on cookie])
621 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x1,in_port=1,actions=1])
622 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x2,in_port=2,actions=1])
623 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x3,in_port=3,actions=1])
624 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
625 cookie=0x1, in_port=1 actions=output:1
626 cookie=0x2, in_port=2 actions=output:1
627 cookie=0x3, in_port=3 actions=output:1
631 AT_CHECK([ovs-ofctl del-flows br0 cookie=0x3/-1])
632 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
633 cookie=0x1, in_port=1 actions=output:1
634 cookie=0x2, in_port=2 actions=output:1
640 AT_SETUP([ofproto - del flows based on cookie mask])
642 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x1,in_port=1,actions=1])
643 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x2,in_port=2,actions=1])
644 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x3,in_port=3,actions=1])
645 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
646 cookie=0x1, in_port=1 actions=output:1
647 cookie=0x2, in_port=2 actions=output:1
648 cookie=0x3, in_port=3 actions=output:1
651 AT_CHECK([ovs-ofctl del-flows br0 cookie=0x3/0x1])
652 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
653 cookie=0x2, in_port=2 actions=output:1
659 AT_SETUP([ofproto - del flows based on table id (NXM)])
661 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x1,in_port=1,actions=1])
662 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x2,in_port=2,table=1,actions=1])
663 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
664 cookie=0x1, in_port=1 actions=output:1
665 cookie=0x2, table=1, in_port=2 actions=output:1
668 AT_CHECK([ovs-ofctl del-flows br0 table=0])
669 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
670 cookie=0x2, table=1, in_port=2 actions=output:1
673 AT_CHECK([ovs-ofctl del-flows br0 table=1])
674 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
677 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x1,in_port=1,actions=1])
678 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x2,in_port=2,table=1,actions=1])
679 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
680 cookie=0x1, in_port=1 actions=output:1
681 cookie=0x2, table=1, in_port=2 actions=output:1
684 AT_CHECK([ovs-ofctl del-flows br0])
685 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
691 AT_SETUP([ofproto - del flows based on table id (OpenFlow 1.1)])
693 AT_CHECK([ovs-ofctl -O OpenFlow11 add-flow br0 cookie=0x1,in_port=1,actions=1])
694 AT_CHECK([ovs-ofctl -O OpenFlow11 add-flow br0 cookie=0x2,in_port=2,table=1,actions=1])
695 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0], [dnl
696 cookie=0x1, in_port=1 actions=output:1
697 cookie=0x2, table=1, in_port=2 actions=output:1
698 OFPST_FLOW reply (OF1.1):
700 AT_CHECK([ovs-ofctl -O OpenFlow11 del-flows br0 table=0])
701 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0], [dnl
702 cookie=0x2, table=1, in_port=2 actions=output:1
703 OFPST_FLOW reply (OF1.1):
705 AT_CHECK([ovs-ofctl -O OpenFlow11 del-flows br0 table=1])
706 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0], [dnl
707 OFPST_FLOW reply (OF1.1):
709 AT_CHECK([ovs-ofctl -O OpenFlow11 add-flow br0 cookie=0x1,in_port=1,actions=1])
710 AT_CHECK([ovs-ofctl -O OpenFlow11 add-flow br0 cookie=0x2,in_port=2,table=1,actions=1])
711 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0], [dnl
712 cookie=0x1, in_port=1 actions=output:1
713 cookie=0x2, table=1, in_port=2 actions=output:1
714 OFPST_FLOW reply (OF1.1):
716 AT_CHECK([ovs-ofctl -O OpenFlow11 del-flows br0])
717 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip], [0], [dnl
718 OFPST_FLOW reply (OF1.1):
719 cookie=0x2, table=1, in_port=2 actions=output:1
724 AT_SETUP([ofproto - del flows based on table id (OpenFlow 1.2)])
726 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 cookie=0x1,in_port=1,actions=1])
727 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 cookie=0x2,in_port=2,table=1,actions=1])
728 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
729 cookie=0x1, in_port=1 actions=output:1
730 cookie=0x2, table=1, in_port=2 actions=output:1
731 OFPST_FLOW reply (OF1.2):
733 AT_CHECK([ovs-ofctl -O OpenFlow12 del-flows br0 table=0])
734 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
735 cookie=0x2, table=1, in_port=2 actions=output:1
736 OFPST_FLOW reply (OF1.2):
738 AT_CHECK([ovs-ofctl -O OpenFlow12 del-flows br0 table=1])
739 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
740 OFPST_FLOW reply (OF1.2):
742 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 cookie=0x1,in_port=1,actions=1])
743 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 cookie=0x2,in_port=2,table=1,actions=1])
744 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
745 cookie=0x1, in_port=1 actions=output:1
746 cookie=0x2, table=1, in_port=2 actions=output:1
747 OFPST_FLOW reply (OF1.2):
749 AT_CHECK([ovs-ofctl -O OpenFlow12 del-flows br0])
750 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
751 OFPST_FLOW reply (OF1.2):
756 AT_SETUP([ofproto - flow table configuration (OpenFlow 1.0)])
758 # Check the default configuration.
759 (echo "OFPST_TABLE reply (xid=0x2): 254 tables
760 0: classifier: wild=0x3fffff, max=1000000, active=0
763 while test $x -lt 254; do
764 printf " %d: %-8s: wild=0x3fffff, max=1000000, active=0
769 AT_CHECK([ovs-ofctl dump-tables br0], [0], [expout])
770 # Change the configuration.
773 -- --id=@t0 create Flow_Table name=main \
774 -- --id=@t1 create Flow_Table flow-limit=1024 \
775 -- set bridge br0 'flow_tables={1=@t1,0=@t0}' \
776 | ${PERL} $srcdir/uuidfilt.pl],
780 # Check that the configuration was updated.
781 mv expout orig-expout
782 (echo "OFPST_TABLE reply (xid=0x2): 254 tables
783 0: main : wild=0x3fffff, max=1000000, active=0
785 1: table1 : wild=0x3fffff, max= 1024, active=0
787 tail -n +6 orig-expout) > expout
788 AT_CHECK([ovs-ofctl dump-tables br0], [0], [expout])
792 AT_SETUP([ofproto - flow table configuration (OpenFlow 1.2)])
794 # Check the default configuration.
795 (mid="wild=0xfffffffff, max=1000000,"
798 match=0xfffffffff, instructions=0x00000007, config=0x00000003
799 write_actions=0x00000000, apply_actions=0x00000000
800 write_setfields=0x0000000fffffffff
801 apply_setfields=0x0000000fffffffff
802 metadata_match=0xffffffffffffffff
803 metadata_write=0xffffffffffffffff"
804 echo "OFPST_TABLE reply (OF1.2) (xid=0x2): 254 tables
805 0: classifier: $mid active=0$tail"
807 while test $x -lt 254; do
808 printf " %d: %-8s: $mid active=0$tail
812 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-tables br0], [0], [expout])
813 # Change the configuration.
816 -- --id=@t0 create Flow_Table name=main \
817 -- --id=@t1 create Flow_Table flow-limit=1024 \
818 -- set bridge br0 'flow_tables={1=@t1,0=@t0}' \
819 | ${PERL} $srcdir/uuidfilt.pl],
823 # Check that the configuration was updated.
824 mv expout orig-expout
825 (echo "OFPST_TABLE reply (OF1.2) (xid=0x2): 254 tables
826 0: main : wild=0xfffffffff, max=1000000, active=0"
827 tail -n +3 orig-expout | head -7
828 echo " 1: table1 : wild=0xfffffffff, max= 1024, active=0"
829 tail -n +11 orig-expout) > expout
830 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-tables br0], [0], [expout])
834 AT_SETUP([ofproto - hard limits on flow table size (OpenFLow 1.0)])
836 # Configure a maximum of 4 flows.
839 -- --id=@t0 create Flow_Table flow-limit=4 \
840 -- set bridge br0 flow_tables:0=@t0 \
841 | ${PERL} $srcdir/uuidfilt.pl],
845 for in_port in 1 2 3 4; do
846 ovs-ofctl add-flow br0 in_port=$in_port,actions=drop
848 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
849 in_port=1 actions=drop
850 in_port=2 actions=drop
851 in_port=3 actions=drop
852 in_port=4 actions=drop
855 # Adding another flow will be refused.
856 AT_CHECK([ovs-ofctl add-flow br0 in_port=5,actions=drop], [1], [], [stderr])
857 AT_CHECK([head -n 1 stderr | ofctl_strip], [0],
858 [OFPT_ERROR: OFPFMFC_TABLE_FULL
860 # Also a mod-flow that would add a flow will be refused.
861 AT_CHECK([ovs-ofctl mod-flows br0 in_port=5,actions=drop], [1], [], [stderr])
862 AT_CHECK([head -n 1 stderr | ofctl_strip], [0],
863 [OFPT_ERROR: OFPFMFC_TABLE_FULL
865 # Replacing or modifying an existing flow is allowed.
866 AT_CHECK([ovs-ofctl add-flow br0 in_port=4,actions=normal])
867 AT_CHECK([ovs-ofctl mod-flows br0 in_port=3,actions=output:1])
868 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
869 in_port=1 actions=drop
870 in_port=2 actions=drop
871 in_port=3 actions=output:1
872 in_port=4 actions=NORMAL
878 AT_SETUP([ofproto - hard limits on flow table size (OpenFLow 1.2)])
880 # Configure a maximum of 4 flows.
883 -- --id=@t0 create Flow_Table flow-limit=4 \
884 -- set bridge br0 flow_tables:0=@t0 \
885 | ${PERL} $srcdir/uuidfilt.pl],
889 for in_port in 1 2 3 4; do
890 ovs-ofctl -O OpenFlow12 add-flow br0 in_port=$in_port,actions=drop
892 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
893 in_port=1 actions=drop
894 in_port=2 actions=drop
895 in_port=3 actions=drop
896 in_port=4 actions=drop
897 OFPST_FLOW reply (OF1.2):
899 # Adding another flow will be refused.
900 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 in_port=5,actions=drop], [1], [], [stderr])
901 AT_CHECK([head -n 1 stderr | ofctl_strip], [0],
902 [OFPT_ERROR (OF1.2): OFPFMFC_TABLE_FULL
904 # Replacing or modifying an existing flow is allowed.
905 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 in_port=4,actions=normal])
906 AT_CHECK([ovs-ofctl -O OpenFlow12 mod-flows br0 in_port=3,actions=output:1])
907 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
908 in_port=1 actions=drop
909 in_port=2 actions=drop
910 in_port=3 actions=output:1
911 in_port=4 actions=NORMAL
912 OFPST_FLOW reply (OF1.2):
917 AT_SETUP([ofproto - eviction upon table overflow (OpenFlow 1.0)])
919 # Configure a maximum of 4 flows.
922 -- --id=@t0 create Flow_Table flow-limit=4 overflow-policy=evict \
923 -- set bridge br0 flow_tables:0=@t0 \
924 | ${PERL} $srcdir/uuidfilt.pl],
928 for in_port in 4 3 2 1; do
929 ovs-ofctl add-flow br0 idle_timeout=${in_port}0,in_port=$in_port,actions=drop
931 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
932 idle_timeout=10, in_port=1 actions=drop
933 idle_timeout=20, in_port=2 actions=drop
934 idle_timeout=30, in_port=3 actions=drop
935 idle_timeout=40, in_port=4 actions=drop
938 # Adding another flow will cause the one that expires soonest to be evicted.
939 AT_CHECK([ovs-ofctl add-flow br0 in_port=5,actions=drop])
940 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
941 idle_timeout=20, in_port=2 actions=drop
942 idle_timeout=30, in_port=3 actions=drop
943 idle_timeout=40, in_port=4 actions=drop
944 in_port=5 actions=drop
947 # A mod-flow that adds a flow also causes eviction, but replacing or
948 # modifying an existing flow doesn't.
949 AT_CHECK([ovs-ofctl mod-flows br0 in_port=6,actions=drop])
950 AT_CHECK([ovs-ofctl add-flow br0 in_port=4,actions=normal])
951 AT_CHECK([ovs-ofctl mod-flows br0 in_port=3,actions=output:1])
952 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
953 idle_timeout=30, in_port=3 actions=output:1
954 in_port=4 actions=NORMAL
955 in_port=5 actions=drop
956 in_port=6 actions=drop
959 # Flows with no timeouts at all cannot be evicted.
960 AT_CHECK([ovs-ofctl add-flow br0 in_port=7,actions=normal])
961 AT_CHECK([ovs-ofctl add-flow br0 in_port=8,actions=drop], [1], [], [stderr])
962 AT_CHECK([head -n 1 stderr | ofctl_strip], [0],
963 [OFPT_ERROR: OFPFMFC_TABLE_FULL
965 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
966 in_port=4 actions=NORMAL
967 in_port=5 actions=drop
968 in_port=6 actions=drop
969 in_port=7 actions=NORMAL
975 AT_SETUP([ofproto - eviction upon table overflow (OpenFlow 1.2)])
977 # Configure a maximum of 4 flows.
980 -- --id=@t0 create Flow_Table flow-limit=4 overflow-policy=evict \
981 -- set bridge br0 flow_tables:0=@t0 \
982 | ${PERL} $srcdir/uuidfilt.pl],
986 for in_port in 4 3 2 1; do
987 ovs-ofctl -O OpenFlow12 add-flow br0 idle_timeout=${in_port}0,in_port=$in_port,actions=drop
989 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
990 idle_timeout=10, in_port=1 actions=drop
991 idle_timeout=20, in_port=2 actions=drop
992 idle_timeout=30, in_port=3 actions=drop
993 idle_timeout=40, in_port=4 actions=drop
994 OFPST_FLOW reply (OF1.2):
996 # Adding another flow will cause the one that expires soonest to be evicted.
997 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 in_port=5,actions=drop])
998 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
999 idle_timeout=20, in_port=2 actions=drop
1000 idle_timeout=30, in_port=3 actions=drop
1001 idle_timeout=40, in_port=4 actions=drop
1002 in_port=5 actions=drop
1003 OFPST_FLOW reply (OF1.2):
1005 # In Open Flow 1.2 a mod-flow does not ever add a flow and thus
1006 # has no effect on eviction
1007 AT_CHECK([ovs-ofctl -O OpenFlow12 mod-flows br0 in_port=6,actions=drop])
1008 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 in_port=4,actions=normal])
1009 AT_CHECK([ovs-ofctl -O OpenFlow12 mod-flows br0 in_port=3,actions=output:1])
1010 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1011 idle_timeout=20, in_port=2 actions=drop
1012 idle_timeout=30, in_port=3 actions=output:1
1013 in_port=4 actions=NORMAL
1014 in_port=5 actions=drop
1015 OFPST_FLOW reply (OF1.2):
1017 # Flows with no timeouts at all cannot be evicted.
1018 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 in_port=6,actions=drop])
1019 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 in_port=7,actions=normal])
1020 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 in_port=8,actions=drop], [1], [], [stderr])
1021 AT_CHECK([head -n 1 stderr | ofctl_strip], [0],
1022 [OFPT_ERROR (OF1.2): OFPFMFC_TABLE_FULL
1024 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1025 in_port=4 actions=NORMAL
1026 in_port=5 actions=drop
1027 in_port=6 actions=drop
1028 in_port=7 actions=NORMAL
1029 OFPST_FLOW reply (OF1.2):
1034 AT_SETUP([ofproto - eviction upon table overflow, with fairness (OpenFlow 1.0)])
1036 # Configure a maximum of 4 flows.
1039 -- --id=@t0 create Flow_Table name=evict flow-limit=4 \
1040 overflow-policy=evict \
1041 groups='"NXM_OF_IN_PORT[[]]"' \
1042 -- set bridge br0 flow_tables:0=@t0 \
1043 | ${PERL} $srcdir/uuidfilt.pl],
1047 ovs-ofctl add-flows br0 - <<EOF
1048 idle_timeout=10 in_port=2 dl_src=00:44:55:66:77:88 actions=drop
1049 idle_timeout=20 in_port=1 dl_src=00:11:22:33:44:55 actions=drop
1050 idle_timeout=30 in_port=1 dl_src=00:22:33:44:55:66 actions=drop
1051 idle_timeout=40 in_port=1 dl_src=00:33:44:55:66:77 actions=drop
1053 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1054 idle_timeout=10, in_port=2,dl_src=00:44:55:66:77:88 actions=drop
1055 idle_timeout=20, in_port=1,dl_src=00:11:22:33:44:55 actions=drop
1056 idle_timeout=30, in_port=1,dl_src=00:22:33:44:55:66 actions=drop
1057 idle_timeout=40, in_port=1,dl_src=00:33:44:55:66:77 actions=drop
1060 # Adding another flow will cause the one that expires soonest within
1061 # the largest group (those with in_port=1) to be evicted. In this
1062 # case this is not the same as the one that expires soonest overall
1063 # (which is what makes the test interesting):
1064 AT_CHECK([ovs-ofctl add-flow br0 in_port=2,dl_src=00:55:66:77:88:99,actions=drop])
1065 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1066 idle_timeout=10, in_port=2,dl_src=00:44:55:66:77:88 actions=drop
1067 idle_timeout=30, in_port=1,dl_src=00:22:33:44:55:66 actions=drop
1068 idle_timeout=40, in_port=1,dl_src=00:33:44:55:66:77 actions=drop
1069 in_port=2,dl_src=00:55:66:77:88:99 actions=drop
1072 # Enlarge the flow limit, change the eviction policy back to strictly
1073 # based on expiration, and and add some flows.
1074 AT_CHECK([ovs-vsctl set Flow_Table evict groups='[[]]' flow-limit=7])
1075 ovs-ofctl add-flows br0 - <<EOF
1076 idle_timeout=50 in_port=2 dl_src=00:66:77:88:99:aa actions=drop
1077 idle_timeout=60 in_port=2 dl_src=00:77:88:99:aa:bb actions=drop
1078 idle_timeout=70 in_port=2 dl_src=00:88:99:aa:bb:cc actions=drop
1080 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1081 idle_timeout=10, in_port=2,dl_src=00:44:55:66:77:88 actions=drop
1082 idle_timeout=30, in_port=1,dl_src=00:22:33:44:55:66 actions=drop
1083 idle_timeout=40, in_port=1,dl_src=00:33:44:55:66:77 actions=drop
1084 idle_timeout=50, in_port=2,dl_src=00:66:77:88:99:aa actions=drop
1085 idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=drop
1086 idle_timeout=70, in_port=2,dl_src=00:88:99:aa:bb:cc actions=drop
1087 in_port=2,dl_src=00:55:66:77:88:99 actions=drop
1090 # Adding another flow will cause the one that expires soonest overall
1092 AT_CHECK([ovs-ofctl add-flow br0 'idle_timeout=80 in_port=2 dl_src=00:99:aa:bb:cc:dd actions=drop'])
1093 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1094 idle_timeout=30, in_port=1,dl_src=00:22:33:44:55:66 actions=drop
1095 idle_timeout=40, in_port=1,dl_src=00:33:44:55:66:77 actions=drop
1096 idle_timeout=50, in_port=2,dl_src=00:66:77:88:99:aa actions=drop
1097 idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=drop
1098 idle_timeout=70, in_port=2,dl_src=00:88:99:aa:bb:cc actions=drop
1099 idle_timeout=80, in_port=2,dl_src=00:99:aa:bb:cc:dd actions=drop
1100 in_port=2,dl_src=00:55:66:77:88:99 actions=drop
1103 # Reducing the flow limit also causes the flows that expire soonest
1104 # overall to be evicted.
1105 AT_CHECK([ovs-vsctl set Flow_Table evict flow-limit=4])
1106 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1107 idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=drop
1108 idle_timeout=70, in_port=2,dl_src=00:88:99:aa:bb:cc actions=drop
1109 idle_timeout=80, in_port=2,dl_src=00:99:aa:bb:cc:dd actions=drop
1110 in_port=2,dl_src=00:55:66:77:88:99 actions=drop
1116 AT_SETUP([ofproto - eviction upon table overflow, with fairness (OpenFlow 1.2)])
1118 # Configure a maximum of 4 flows.
1121 -- --id=@t0 create Flow_Table name=evict flow-limit=4 \
1122 overflow-policy=evict \
1123 groups='"NXM_OF_IN_PORT[[]]"' \
1124 -- set bridge br0 flow_tables:0=@t0 \
1125 | ${PERL} $srcdir/uuidfilt.pl],
1129 ovs-ofctl -O OpenFlow12 add-flows br0 - <<EOF
1130 idle_timeout=10 in_port=2 dl_src=00:44:55:66:77:88 actions=drop
1131 idle_timeout=20 in_port=1 dl_src=00:11:22:33:44:55 actions=drop
1132 idle_timeout=30 in_port=1 dl_src=00:22:33:44:55:66 actions=drop
1133 idle_timeout=40 in_port=1 dl_src=00:33:44:55:66:77 actions=drop
1135 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1136 idle_timeout=10, in_port=2,dl_src=00:44:55:66:77:88 actions=drop
1137 idle_timeout=20, in_port=1,dl_src=00:11:22:33:44:55 actions=drop
1138 idle_timeout=30, in_port=1,dl_src=00:22:33:44:55:66 actions=drop
1139 idle_timeout=40, in_port=1,dl_src=00:33:44:55:66:77 actions=drop
1140 OFPST_FLOW reply (OF1.2):
1142 # Adding another flow will cause the one that expires soonest within
1143 # the largest group (those with in_port=1) to be evicted. In this
1144 # case this is not the same as the one that expires soonest overall
1145 # (which is what makes the test interesting):
1146 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 in_port=2,dl_src=00:55:66:77:88:99,actions=drop])
1147 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1148 idle_timeout=10, in_port=2,dl_src=00:44:55:66:77:88 actions=drop
1149 idle_timeout=30, in_port=1,dl_src=00:22:33:44:55:66 actions=drop
1150 idle_timeout=40, in_port=1,dl_src=00:33:44:55:66:77 actions=drop
1151 in_port=2,dl_src=00:55:66:77:88:99 actions=drop
1152 OFPST_FLOW reply (OF1.2):
1154 # Enlarge the flow limit, change the eviction policy back to strictly
1155 # based on expiration, and and add some flows.
1156 AT_CHECK([ovs-vsctl set Flow_Table evict groups='[[]]' flow-limit=7])
1157 ovs-ofctl -O OpenFlow12 add-flows br0 - <<EOF
1158 idle_timeout=50 in_port=2 dl_src=00:66:77:88:99:aa actions=drop
1159 idle_timeout=60 in_port=2 dl_src=00:77:88:99:aa:bb actions=drop
1160 idle_timeout=70 in_port=2 dl_src=00:88:99:aa:bb:cc actions=drop
1162 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1163 idle_timeout=10, in_port=2,dl_src=00:44:55:66:77:88 actions=drop
1164 idle_timeout=30, in_port=1,dl_src=00:22:33:44:55:66 actions=drop
1165 idle_timeout=40, in_port=1,dl_src=00:33:44:55:66:77 actions=drop
1166 idle_timeout=50, in_port=2,dl_src=00:66:77:88:99:aa actions=drop
1167 idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=drop
1168 idle_timeout=70, in_port=2,dl_src=00:88:99:aa:bb:cc actions=drop
1169 in_port=2,dl_src=00:55:66:77:88:99 actions=drop
1170 OFPST_FLOW reply (OF1.2):
1172 # Adding another flow will cause the one that expires soonest overall
1174 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'])
1175 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1176 idle_timeout=30, in_port=1,dl_src=00:22:33:44:55:66 actions=drop
1177 idle_timeout=40, in_port=1,dl_src=00:33:44:55:66:77 actions=drop
1178 idle_timeout=50, in_port=2,dl_src=00:66:77:88:99:aa actions=drop
1179 idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=drop
1180 idle_timeout=70, in_port=2,dl_src=00:88:99:aa:bb:cc actions=drop
1181 idle_timeout=80, in_port=2,dl_src=00:99:aa:bb:cc:dd actions=drop
1182 in_port=2,dl_src=00:55:66:77:88:99 actions=drop
1183 OFPST_FLOW reply (OF1.2):
1185 # Reducing the flow limit also causes the flows that expire soonest
1186 # overall to be evicted.
1187 AT_CHECK([ovs-vsctl set Flow_Table evict flow-limit=4])
1188 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1189 idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=drop
1190 idle_timeout=70, in_port=2,dl_src=00:88:99:aa:bb:cc actions=drop
1191 idle_timeout=80, in_port=2,dl_src=00:99:aa:bb:cc:dd actions=drop
1192 in_port=2,dl_src=00:55:66:77:88:99 actions=drop
1193 OFPST_FLOW reply (OF1.2):
1198 AT_SETUP([ofproto - asynchronous message control (OpenFlow 1.0)])
1200 AT_CHECK([ovs-ofctl -P openflow10 monitor br0 --detach --no-chdir --pidfile])
1202 printf '\n\n--- check_async %d ---\n\n\n' $1
1205 ovs-appctl -t ovs-ofctl ofctl/barrier
1206 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
1209 # OFPT_PACKET_IN, OFPR_ACTION (controller_id=0)
1210 ovs-ofctl -v packet-out br0 controller controller '0001020304050010203040501234'
1211 if test X"$1" = X"OFPR_ACTION"; then shift;
1212 echo >>expout "OFPT_PACKET_IN: total_len=14 in_port=CONTROLLER (via action) data_len=14 (unbuffered)
1213 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"
1216 # OFPT_PACKET_IN, OFPR_NO_MATCH (controller_id=123)
1217 ovs-ofctl -v packet-out br0 controller 'controller(reason=no_match,id=123)' '0001020304050010203040501234'
1218 if test X"$1" = X"OFPR_NO_MATCH"; then shift;
1219 echo >>expout "OFPT_PACKET_IN: total_len=14 in_port=CONTROLLER (via no_match) data_len=14 (unbuffered)
1220 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"
1223 # OFPT_PACKET_IN, OFPR_INVALID_TTL (controller_id=0)
1224 ovs-ofctl packet-out br0 controller dec_ttl '002583dfb4000026b98cb0f908004500003fb7e200000011339bac11370dac100002d7730035002b8f6d86fb0100000100000000000006626c702d7873066e696369726103636f6d00000f00'
1225 if test X"$1" = X"OFPR_INVALID_TTL"; then shift;
1226 echo >>expout "OFPT_PACKET_IN: total_len=76 in_port=CONTROLLER (via invalid_ttl) data_len=76 (unbuffered)
1227 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"
1230 # OFPT_PORT_STATUS, OFPPR_ADD
1231 ovs-vsctl add-port br0 test -- set Interface test type=dummy ofport_request=1
1232 if test X"$1" = X"OFPPR_ADD"; then shift;
1233 echo >>expout "OFPT_PORT_STATUS: ADD: 1(test): addr:aa:55:aa:55:00:0x
1236 speed: 0 Mbps now, 0 Mbps max"
1239 # OFPT_PORT_STATUS, OFPPR_DELETE
1240 ovs-vsctl del-port br0 test
1241 if test X"$1" = X"OFPPR_DELETE"; then shift;
1242 echo >>expout "OFPT_PORT_STATUS: DEL: 1(test): addr:aa:55:aa:55:00:0x
1245 speed: 0 Mbps now, 0 Mbps max"
1248 # OFPT_FLOW_REMOVED, OFPRR_DELETE
1249 ovs-ofctl add-flow br0 send_flow_rem,actions=drop
1250 ovs-ofctl --strict del-flows br0 ''
1251 if test X"$1" = X"OFPRR_DELETE"; then shift;
1252 echo >>expout "OFPT_FLOW_REMOVED: reason=delete"
1254 AT_FAIL_IF([test X"$1" != X])
1256 ovs-appctl -t ovs-ofctl ofctl/barrier
1257 echo >>expout "OFPT_BARRIER_REPLY:"
1261 s/ (xid=0x[0-9a-fA-F]*)//
1263 s/00:0.$/00:0x/' < monitor.log]],
1267 # It's a service connection so initially there should be no async messages.
1270 # Set miss_send_len to 128, turning on packet-ins for our service connection.
1271 ovs-appctl -t ovs-ofctl ofctl/send 0109000c0123456700000080
1272 check_async 2 OFPR_ACTION OFPPR_ADD OFPPR_DELETE OFPRR_DELETE
1274 # Set miss_send_len to 128 and enable invalid_ttl.
1275 ovs-appctl -t ovs-ofctl ofctl/send 0109000c0123456700040080
1276 check_async 3 OFPR_ACTION OFPR_INVALID_TTL OFPPR_ADD OFPPR_DELETE OFPRR_DELETE
1278 # Become slave, which should disable everything except port status.
1279 ovs-appctl -t ovs-ofctl ofctl/send 0104001400000002000023200000000a00000002
1280 check_async 4 OFPPR_ADD OFPPR_DELETE
1282 # Use NXT_SET_ASYNC_CONFIG to enable a patchwork of asynchronous messages.
1283 ovs-appctl -t ovs-ofctl ofctl/send 01040028000000020000232000000013000000020000000500000005000000020000000200000005
1284 check_async 5 OFPR_INVALID_TTL OFPPR_DELETE OFPRR_DELETE
1286 # Set controller ID 123.
1287 ovs-appctl -t ovs-ofctl ofctl/send 01040018000000030000232000000014000000000000007b
1288 check_async 6 OFPR_NO_MATCH OFPPR_DELETE OFPRR_DELETE
1290 # Restore controller ID 0.
1291 ovs-appctl -t ovs-ofctl ofctl/send 010400180000000300002320000000140000000000000000
1294 ovs-appctl -t ovs-ofctl ofctl/send 0104001400000002000023200000000a00000001
1295 check_async 7 OFPR_ACTION OFPPR_ADD
1297 ovs-appctl -t ovs-ofctl exit
1301 AT_SETUP([ofproto - asynchronous message control (OpenFlow 1.2)])
1303 AT_CHECK([ovs-ofctl -O OpenFlow12 monitor br0 --detach --no-chdir --pidfile])
1305 printf '\n\n--- check_async %d ---\n\n\n' $1
1309 ovs-appctl -t ovs-ofctl ofctl/barrier
1310 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
1313 # OFPT_PACKET_IN, OFPR_ACTION (controller_id=0)
1314 ovs-ofctl -O OpenFlow12 -v packet-out br0 none controller '0001020304050010203040501234'
1315 if test X"$1" = X"OFPR_ACTION"; then shift;
1316 echo >>expout "OFPT_PACKET_IN (OF1.2): total_len=14 in_port=ANY (via action) data_len=14 (unbuffered)
1317 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"
1320 # OFPT_PACKET_IN, OFPR_NO_MATCH (controller_id=123)
1321 ovs-ofctl -O OpenFlow12 -v packet-out br0 none 'controller(reason=no_match,id=123)' '0001020304050010203040501234'
1322 if test X"$1" = X"OFPR_NO_MATCH"; then shift;
1323 echo >>expout "OFPT_PACKET_IN (OF1.2): total_len=14 in_port=ANY (via no_match) data_len=14 (unbuffered)
1324 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"
1327 # OFPT_PACKET_IN, OFPR_INVALID_TTL (controller_id=0)
1328 ovs-ofctl -O OpenFlow12 packet-out br0 none dec_ttl '002583dfb4000026b98cb0f908004500003fb7e200000011339bac11370dac100002d7730035002b8f6d86fb0100000100000000000006626c702d7873066e696369726103636f6d00000f00'
1329 if test X"$1" = X"OFPR_INVALID_TTL"; then shift;
1330 echo >>expout "OFPT_PACKET_IN (OF1.2): total_len=76 in_port=ANY (via invalid_ttl) data_len=76 (unbuffered)
1331 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"
1334 # OFPT_PORT_STATUS, OFPPR_ADD
1335 ovs-vsctl add-port br0 test -- set Interface test type=dummy
1336 if test X"$1" = X"OFPPR_ADD"; then shift;
1337 echo >>expout "OFPT_PORT_STATUS (OF1.2): ADD: ${INDEX}(test): addr:aa:55:aa:55:00:0x
1340 speed: 0 Mbps now, 0 Mbps max"
1343 # OFPT_PORT_STATUS, OFPPR_DELETE
1344 ovs-vsctl del-port br0 test
1345 if test X"$1" = X"OFPPR_DELETE"; then shift;
1346 echo >>expout "OFPT_PORT_STATUS (OF1.2): DEL: ${INDEX}(test): addr:aa:55:aa:55:00:0x
1349 speed: 0 Mbps now, 0 Mbps max"
1352 # OFPT_FLOW_REMOVED, OFPRR_DELETE
1353 ovs-ofctl -O OpenFlow12 add-flow br0 send_flow_rem,actions=drop
1354 ovs-ofctl -O OpenFlow12 --strict del-flows br0 ''
1355 if test X"$1" = X"OFPRR_DELETE"; then shift;
1356 echo >>expout "OFPT_FLOW_REMOVED (OF1.2): reason=delete table_id=0"
1358 AT_FAIL_IF([test X"$1" != X])
1360 ovs-appctl -t ovs-ofctl ofctl/barrier
1361 echo >>expout "OFPT_BARRIER_REPLY (OF1.2):"
1365 s/ (xid=0x[0-9a-fA-F]*)//
1367 s/00:0.$/00:0x/' < monitor.log]],
1371 # It's a service connection so initially there should be no async messages.
1374 # Set miss_send_len to 128, turning on packet-ins for our service connection.
1375 ovs-appctl -t ovs-ofctl ofctl/send 0309000c0123456700000080
1376 check_async 2 OFPR_ACTION OFPPR_ADD OFPPR_DELETE OFPRR_DELETE
1378 # Set miss_send_len to 128 and enable invalid_ttl.
1379 ovs-appctl -t ovs-ofctl ofctl/send 0309000c0123456700040080
1380 check_async 3 OFPR_ACTION OFPR_INVALID_TTL OFPPR_ADD OFPPR_DELETE OFPRR_DELETE
1382 # Become slave (OF 1.2), which should disable everything except port status.
1383 ovs-appctl -t ovs-ofctl ofctl/send 031800180000000200000003000000000000000000000001
1384 check_async 4 OFPPR_ADD OFPPR_DELETE
1386 # Use NXT_SET_ASYNC_CONFIG to enable a patchwork of asynchronous messages.
1387 ovs-appctl -t ovs-ofctl ofctl/send 03040028000000020000232000000013000000020000000500000005000000020000000200000005
1388 check_async 5 OFPR_INVALID_TTL OFPPR_DELETE OFPRR_DELETE
1390 # Set controller ID 123.
1391 ovs-appctl -t ovs-ofctl ofctl/send 03040018000000030000232000000014000000000000007b
1392 check_async 6 OFPR_NO_MATCH OFPPR_DELETE OFPRR_DELETE
1394 # Restore controller ID 0.
1395 ovs-appctl -t ovs-ofctl ofctl/send 030400180000000300002320000000140000000000000000
1397 # Become master (OF 1.2).
1398 ovs-appctl -t ovs-ofctl ofctl/send 031800180000000400000002000000000000000000000002
1399 check_async 7 OFPR_ACTION OFPPR_ADD
1401 ovs-appctl -t ovs-ofctl exit
1405 AT_SETUP([ofproto - asynchronous message control (OpenFlow 1.3)])
1407 AT_CHECK([ovs-ofctl -O OpenFlow13 monitor br0 --detach --no-chdir --pidfile])
1409 printf '\n\n--- check_async %d ---\n\n\n' $1
1413 ovs-appctl -t ovs-ofctl ofctl/barrier
1414 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
1417 # OFPT_PACKET_IN, OFPR_ACTION (controller_id=0)
1418 ovs-ofctl -O OpenFlow13 -v packet-out br0 none controller '0001020304050010203040501234'
1419 if test X"$1" = X"OFPR_ACTION"; then shift;
1420 echo >>expout "OFPT_PACKET_IN (OF1.3): total_len=14 in_port=ANY (via action) data_len=14 (unbuffered)
1421 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"
1424 # OFPT_PACKET_IN, OFPR_NO_MATCH (controller_id=123)
1425 ovs-ofctl -O OpenFlow13 -v packet-out br0 none 'controller(reason=no_match,id=123)' '0001020304050010203040501234'
1426 if test X"$1" = X"OFPR_NO_MATCH"; then shift;
1427 echo >>expout "OFPT_PACKET_IN (OF1.3): total_len=14 in_port=ANY (via no_match) data_len=14 (unbuffered)
1428 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"
1431 # OFPT_PACKET_IN, OFPR_INVALID_TTL (controller_id=0)
1432 ovs-ofctl -O OpenFlow13 packet-out br0 none dec_ttl '002583dfb4000026b98cb0f908004500003fb7e200000011339bac11370dac100002d7730035002b8f6d86fb0100000100000000000006626c702d7873066e696369726103636f6d00000f00'
1433 if test X"$1" = X"OFPR_INVALID_TTL"; then shift;
1434 echo >>expout "OFPT_PACKET_IN (OF1.3): total_len=76 in_port=ANY (via invalid_ttl) data_len=76 (unbuffered)
1435 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"
1438 # OFPT_PORT_STATUS, OFPPR_ADD
1439 ovs-vsctl add-port br0 test -- set Interface test type=dummy
1440 if test X"$1" = X"OFPPR_ADD"; then shift;
1441 echo >>expout "OFPT_PORT_STATUS (OF1.3): ADD: ${INDEX}(test): addr:aa:55:aa:55:00:0x
1444 speed: 0 Mbps now, 0 Mbps max"
1447 # OFPT_PORT_STATUS, OFPPR_DELETE
1448 ovs-vsctl del-port br0 test
1449 if test X"$1" = X"OFPPR_DELETE"; then shift;
1450 echo >>expout "OFPT_PORT_STATUS (OF1.3): DEL: ${INDEX}(test): addr:aa:55:aa:55:00:0x
1453 speed: 0 Mbps now, 0 Mbps max"
1456 # OFPT_FLOW_REMOVED, OFPRR_DELETE
1457 ovs-ofctl -O OpenFlow13 add-flow br0 send_flow_rem,actions=drop
1458 ovs-ofctl -O OpenFlow13 --strict del-flows br0 ''
1459 if test X"$1" = X"OFPRR_DELETE"; then shift;
1460 echo >>expout "OFPT_FLOW_REMOVED (OF1.3): reason=delete table_id=0"
1462 AT_FAIL_IF([test X"$1" != X])
1464 ovs-appctl -t ovs-ofctl ofctl/barrier
1465 echo >>expout "OFPT_BARRIER_REPLY (OF1.3):"
1469 s/ (xid=0x[0-9a-fA-F]*)//
1471 s/00:0.$/00:0x/' < monitor.log]],
1475 # It's a service connection so initially there should be no async messages.
1478 # Set miss_send_len to 128, turning on packet-ins for our service connection.
1479 ovs-appctl -t ovs-ofctl ofctl/send 0409000c0123456700000080
1480 check_async 2 OFPR_ACTION OFPPR_ADD OFPPR_DELETE OFPRR_DELETE
1482 # Become slave (OF 1.3), which should disable everything except port status.
1483 ovs-appctl -t ovs-ofctl ofctl/send 041800180000000200000003000000000000000000000001
1484 check_async 3 OFPPR_ADD OFPPR_DELETE
1486 # Use OF 1.3 OFPT_SET_ASYNC to enable a patchwork of asynchronous messages.
1487 ovs-appctl -t ovs-ofctl ofctl/send 041c002000000002000000020000000500000005000000020000000200000005
1488 check_async 4 OFPR_INVALID_TTL OFPPR_DELETE OFPRR_DELETE
1490 # Set controller ID 123.
1491 ovs-appctl -t ovs-ofctl ofctl/send 04040018000000030000232000000014000000000000007b
1492 check_async 5 OFPR_NO_MATCH OFPPR_DELETE OFPRR_DELETE
1494 # Restore controller ID 0.
1495 ovs-appctl -t ovs-ofctl ofctl/send 040400180000000300002320000000140000000000000000
1497 # Become master (OF 1.3).
1498 ovs-appctl -t ovs-ofctl ofctl/send 041800180000000400000002000000000000000000000002
1499 check_async 6 OFPR_ACTION OFPPR_ADD
1501 ovs-appctl -t ovs-ofctl exit
1505 dnl This test checks that the role request/response messaging works
1506 dnl and that generation_id is handled properly.
1507 AT_SETUP([ofproto - controller role (OpenFlow 1.2)])
1509 AT_CHECK([ovs-ofctl -O OpenFlow12 monitor br0 --detach --no-chdir --pidfile])
1511 ovs-appctl -t ovs-ofctl ofctl/barrier
1512 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
1515 # find out current role
1516 ovs-appctl -t ovs-ofctl ofctl/send 031800180000000200000000000000000000000000000000
1517 echo >>expout "send: OFPT_ROLE_REQUEST (OF1.2) (xid=0x2): role=nochange"
1518 echo >>expout "OFPT_ROLE_REPLY (OF1.2) (xid=0x2): role=equal"
1520 # Become slave (generation_id is initially undefined, so 2^63+2 should not be stale)
1521 ovs-appctl -t ovs-ofctl ofctl/send 031800180000000300000003000000008000000000000002
1522 echo >>expout "send: OFPT_ROLE_REQUEST (OF1.2) (xid=0x3): role=slave generation_id=9223372036854775810"
1523 echo >>expout "OFPT_ROLE_REPLY (OF1.2) (xid=0x3): role=slave generation_id=9223372036854775810"
1525 # Try to become the master using a stale generation ID
1526 ovs-appctl -t ovs-ofctl ofctl/send 031800180000000400000002000000000000000000000002
1527 echo >>expout "send: OFPT_ROLE_REQUEST (OF1.2) (xid=0x4): role=master generation_id=2"
1528 echo >>expout "OFPT_ERROR (OF1.2) (xid=0x4): OFPRRFC_STALE"
1529 echo >>expout "OFPT_ROLE_REQUEST (OF1.2) (xid=0x4): role=master generation_id=2"
1531 # Become master using a valid generation ID
1532 ovs-appctl -t ovs-ofctl ofctl/send 031800180000000500000002000000000000000000000001
1533 echo >>expout "send: OFPT_ROLE_REQUEST (OF1.2) (xid=0x5): role=master generation_id=1"
1534 echo >>expout "OFPT_ROLE_REPLY (OF1.2) (xid=0x5): role=master generation_id=1"
1535 ovs-appctl -t ovs-ofctl ofctl/barrier
1536 echo >>expout "OFPT_BARRIER_REPLY (OF1.2) (xid=0x3):"
1538 AT_CHECK([cat monitor.log], [0], [expout])
1540 ovs-appctl -t ovs-ofctl exit
1544 dnl This test checks that OFPT_PACKET_OUT accepts both OFPP_NONE (as
1545 dnl specified by OpenFlow 1.0) and OFPP_CONTROLLER (used by some
1546 dnl controllers despite the spec) as meaning a packet that was generated
1547 dnl by the controller.
1548 AT_SETUP([ofproto - packet-out from controller (OpenFlow 1.0)])
1550 ADD_OF_PORTS([br0], [1])
1552 # Start a monitor listening for packet-ins.
1553 AT_CHECK([ovs-ofctl -P openflow10 monitor br0 --detach --no-chdir --pidfile])
1554 ovs-appctl -t ovs-ofctl ofctl/send 0109000c0123456700000080
1555 ovs-appctl -t ovs-ofctl ofctl/barrier
1556 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
1557 AT_CAPTURE_FILE([monitor.log])
1559 # Send some packet-outs with OFPP_NONE and OFPP_CONTROLLER (65533) as in_port.
1560 AT_CHECK([ovs-ofctl packet-out br0 none controller,1 '0001020304050010203040501234'])
1561 AT_CHECK([ovs-ofctl packet-out br0 controller controller,1 '0001020304050010203040505678'])
1563 # Stop the monitor and check its output.
1564 ovs-appctl -t ovs-ofctl ofctl/barrier
1565 ovs-appctl -t ovs-ofctl exit
1567 ovs-ofctl dump-ports br0
1569 AT_CHECK([sed 's/ (xid=0x[[0-9a-fA-F]]*)//' monitor.log], [0], [dnl
1570 OFPT_PACKET_IN: total_len=14 in_port=ANY (via action) data_len=14 (unbuffered)
1571 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
1572 OFPT_PACKET_IN: total_len=14 in_port=CONTROLLER (via action) data_len=14 (unbuffered)
1573 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
1580 dnl This test checks that OFPT_PACKET_OUT accepts both OFPP_NONE (as
1581 dnl specified by OpenFlow 1.2) and OFPP_CONTROLLER (used by some
1582 dnl controllers despite the spec) as meaning a packet that was generated
1583 dnl by the controller.
1584 AT_SETUP([ofproto - packet-out from controller (OpenFlow 1.2)])
1587 # Start a monitor listening for packet-ins.
1588 AT_CHECK([ovs-ofctl -O OpenFlow12 monitor br0 --detach --no-chdir --pidfile])
1589 ovs-appctl -t ovs-ofctl ofctl/send 0309000c0123456700000080
1590 ovs-appctl -t ovs-ofctl ofctl/barrier
1591 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
1592 AT_CAPTURE_FILE([monitor.log])
1594 # Send some packet-outs with OFPP_NONE and OFPP_CONTROLLER (65533) as in_port.
1595 AT_CHECK([ovs-ofctl -O OpenFlow12 packet-out br0 none controller '0001020304050010203040501234'])
1596 AT_CHECK([ovs-ofctl -O OpenFlow12 packet-out br0 4294967293 controller '0001020304050010203040505678'])
1598 # Stop the monitor and check its output.
1599 ovs-appctl -t ovs-ofctl ofctl/barrier
1600 ovs-appctl -t ovs-ofctl exit
1602 AT_CHECK([sed 's/ (xid=0x[[0-9a-fA-F]]*)//' monitor.log], [0], [dnl
1603 OFPT_PACKET_IN (OF1.2): total_len=14 in_port=ANY (via action) data_len=14 (unbuffered)
1604 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
1605 OFPT_PACKET_IN (OF1.2): total_len=14 in_port=CONTROLLER (via action) data_len=14 (unbuffered)
1606 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
1607 OFPT_BARRIER_REPLY (OF1.2):
1613 dnl This test checks that metadata is encoded in packet_in structures,
1614 dnl supported by NXAST.
1615 AT_SETUP([ofproto - packet-out with metadata (NXM)])
1618 # Start a monitor listening for packet-ins.
1619 AT_CHECK([ovs-ofctl -P nxm monitor br0 --detach --no-chdir --pidfile])
1620 ovs-appctl -t ovs-ofctl ofctl/send 0109000c0123456700000080
1621 ovs-appctl -t ovs-ofctl ofctl/barrier
1622 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
1623 AT_CAPTURE_FILE([monitor.log])
1625 # Send a packet-out with a load action to set some metadata, and forward to controller
1626 AT_CHECK([ovs-ofctl packet-out br0 controller 'load(0xfafafafa5a5a5a5a->OXM_OF_METADATA[[0..63]]), load(0xaa->NXM_NX_PKT_MARK[[]]), controller' '0001020304050010203040501234'])
1628 # Stop the monitor and check its output.
1629 ovs-appctl -t ovs-ofctl ofctl/barrier
1630 ovs-appctl -t ovs-ofctl exit
1632 AT_CHECK([sed 's/ (xid=0x[[0-9a-fA-F]]*)//' monitor.log], [0], [dnl
1633 NXT_PACKET_IN: total_len=14 in_port=CONTROLLER metadata=0xfafafafa5a5a5a5a pkt_mark=0xaa (via action) data_len=14 (unbuffered)
1634 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
1641 dnl This test checks that metadata is encoded in packet_in structures,
1642 dnl supported by NXAST.
1643 AT_SETUP([ofproto - packet-out with metadata (OpenFlow 1.2)])
1646 # Start a monitor listening for packet-ins.
1647 AT_CHECK([ovs-ofctl -O OpenFlow12 monitor br0 --detach --no-chdir --pidfile])
1648 ovs-appctl -t ovs-ofctl ofctl/send 0309000c0123456700000080
1649 ovs-appctl -t ovs-ofctl ofctl/barrier
1650 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
1651 AT_CAPTURE_FILE([monitor.log])
1653 # Send a packet-out with a load action to set some metadata, and forward to controller
1654 AT_CHECK([ovs-ofctl -O OpenFlow12 packet-out br0 none 'load(0xfafafafa5a5a5a5a->OXM_OF_METADATA[[0..63]]), controller' '0001020304050010203040501234'])
1656 # Stop the monitor and check its output.
1657 ovs-appctl -t ovs-ofctl ofctl/barrier
1658 ovs-appctl -t ovs-ofctl exit
1660 AT_CHECK([sed 's/ (xid=0x[[0-9a-fA-F]]*)//' monitor.log], [0], [dnl
1661 OFPT_PACKET_IN (OF1.2): total_len=14 in_port=ANY metadata=0xfafafafa5a5a5a5a (via action) data_len=14 (unbuffered)
1662 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
1663 OFPT_BARRIER_REPLY (OF1.2):
1669 dnl This test checks that tunnel metadata is encoded in packet_in structures.
1670 AT_SETUP([ofproto - packet-out with tunnel metadata (OpenFlow 1.2)])
1673 # Start a monitor listening for packet-ins.
1674 AT_CHECK([ovs-ofctl -O OpenFlow12 monitor br0 --detach --no-chdir --pidfile])
1675 ovs-appctl -t ovs-ofctl ofctl/send 0309000c0123456700000080
1676 ovs-appctl -t ovs-ofctl ofctl/barrier
1677 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
1678 AT_CAPTURE_FILE([monitor.log])
1680 # Send a packet-out with set field actions to set some tunnel metadata, and forward to controller
1681 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'])
1683 # Stop the monitor and check its output.
1684 ovs-appctl -t ovs-ofctl ofctl/barrier
1685 ovs-appctl -t ovs-ofctl exit
1687 AT_CHECK([sed 's/ (xid=0x[[0-9a-fA-F]]*)//' monitor.log], [0], [dnl
1688 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)
1689 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
1690 OFPT_BARRIER_REPLY (OF1.2):
1696 AT_SETUP([ofproto - flow monitoring])
1697 AT_KEYWORDS([monitor])
1700 ovs-ofctl add-flow br0 in_port=0,dl_vlan=123,actions=output:1
1702 # Start a monitor watching the flow table and check the initial reply.
1703 ovs-ofctl monitor br0 watch: --detach --no-chdir --pidfile >monitor.log 2>&1
1704 AT_CAPTURE_FILE([monitor.log])
1705 ovs-appctl -t ovs-ofctl ofctl/barrier
1706 AT_CHECK([sed 's/ (xid=0x[[1-9a-fA-F]][[0-9a-fA-F]]*)//' monitor.log], [0],
1707 [NXST_FLOW_MONITOR reply:
1708 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=123 actions=output:1
1712 # Add, delete, and modify some flows and check the updates.
1713 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
1714 ovs-ofctl add-flow br0 in_port=0,dl_vlan=124,actions=output:2
1715 ovs-ofctl add-flow br0 in_port=0,dl_vlan=123,actions=output:5
1716 ovs-ofctl add-flow br0 in_port=0,dl_vlan=123,dl_vlan_pcp=0,actions=output:6
1717 ovs-ofctl add-flow br0 in_port=0,dl_vlan=123,dl_vlan_pcp=1,actions=output:7
1718 ovs-ofctl add-flow br0 in_port=0,dl_vlan=123,actions=output:8
1719 ovs-ofctl add-flow br0 in_port=0,dl_vlan=65535,dl_vlan_pcp=0,actions=output:9
1720 ovs-ofctl add-flow br0 in_port=0,dl_vlan=65535,dl_vlan_pcp=1,actions=output:10
1721 ovs-ofctl add-flow br0 in_port=0,dl_vlan=65535,actions=output:11
1722 ovs-ofctl add-flow br0 in_port=0,dl_vlan=8191,dl_vlan_pcp=0,actions=output:12
1723 ovs-ofctl add-flow br0 in_port=0,dl_vlan=8191,dl_vlan_pcp=1,actions=output:13
1724 ovs-ofctl add-flow br0 in_port=0,dl_vlan=8191,actions=output:14
1725 ovs-ofctl add-flow br0 in_port=0,dl_vlan=0,dl_vlan_pcp=0,actions=output:15
1726 ovs-ofctl add-flow br0 in_port=0,dl_vlan=0,dl_vlan_pcp=1,actions=output:16
1727 ovs-ofctl add-flow br0 in_port=0,dl_vlan=0,actions=output:17
1728 ovs-ofctl add-flow br0 in_port=0,dl_vlan=0,dl_vlan_pcp=0,actions=output:18
1729 ovs-ofctl add-flow br0 in_port=0,dl_vlan=0,dl_vlan_pcp=1,actions=output:19
1730 ovs-ofctl add-flow br0 in_port=0,dl_vlan=0,actions=output:20
1731 ovs-ofctl add-flow br0 in_port=0,dl_vlan_pcp=0,actions=output:21
1732 ovs-ofctl add-flow br0 in_port=0,dl_vlan_pcp=1,actions=output:22
1733 ovs-ofctl add-flow br0 in_port=0,actions=output:23
1734 ovs-ofctl mod-flows br0 cookie=5,dl_vlan=123,actions=output:3
1735 ovs-ofctl del-flows br0 dl_vlan=123
1736 ovs-ofctl del-flows br0
1737 ovs-appctl -t ovs-ofctl ofctl/barrier
1739 # Sorts groups of lines that start with a space, without moving them
1740 # past the nearest line that does not start with a space.
1748 print $_ foreach sort(@buffer);
1753 print $_ foreach sort(@buffer);
1755 AT_CHECK([sed 's/ (xid=0x[[1-9a-fA-F]][[0-9a-fA-F]]*)//' monitor.log | ${PERL} -e "$sort"], [0],
1756 [NXST_FLOW_MONITOR reply (xid=0x0):
1757 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=124 actions=output:2
1758 NXST_FLOW_MONITOR reply (xid=0x0):
1759 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=123 actions=output:5
1760 NXST_FLOW_MONITOR reply (xid=0x0):
1761 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=123,dl_vlan_pcp=0 actions=output:6
1762 NXST_FLOW_MONITOR reply (xid=0x0):
1763 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=123,dl_vlan_pcp=1 actions=output:7
1764 NXST_FLOW_MONITOR reply (xid=0x0):
1765 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=123 actions=output:8
1766 NXST_FLOW_MONITOR reply (xid=0x0):
1767 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=0,dl_vlan_pcp=0 actions=output:9
1768 NXST_FLOW_MONITOR reply (xid=0x0):
1769 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=0,dl_vlan_pcp=1 actions=output:10
1770 NXST_FLOW_MONITOR reply (xid=0x0):
1771 event=ADDED table=0 cookie=0 in_port=0,vlan_tci=0x0000 actions=output:11
1772 NXST_FLOW_MONITOR reply (xid=0x0):
1773 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=4095,dl_vlan_pcp=0 actions=output:12
1774 NXST_FLOW_MONITOR reply (xid=0x0):
1775 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=4095,dl_vlan_pcp=1 actions=output:13
1776 NXST_FLOW_MONITOR reply (xid=0x0):
1777 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=4095 actions=output:14
1778 NXST_FLOW_MONITOR reply (xid=0x0):
1779 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=0,dl_vlan_pcp=0 actions=output:15
1780 NXST_FLOW_MONITOR reply (xid=0x0):
1781 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=0,dl_vlan_pcp=1 actions=output:16
1782 NXST_FLOW_MONITOR reply (xid=0x0):
1783 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=0 actions=output:17
1784 NXST_FLOW_MONITOR reply (xid=0x0):
1785 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=0,dl_vlan_pcp=0 actions=output:18
1786 NXST_FLOW_MONITOR reply (xid=0x0):
1787 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=0,dl_vlan_pcp=1 actions=output:19
1788 NXST_FLOW_MONITOR reply (xid=0x0):
1789 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=0 actions=output:20
1790 NXST_FLOW_MONITOR reply (xid=0x0):
1791 event=ADDED table=0 cookie=0 in_port=0,dl_vlan_pcp=0 actions=output:21
1792 NXST_FLOW_MONITOR reply (xid=0x0):
1793 event=ADDED table=0 cookie=0 in_port=0,dl_vlan_pcp=1 actions=output:22
1794 NXST_FLOW_MONITOR reply (xid=0x0):
1795 event=ADDED table=0 cookie=0 in_port=0 actions=output:23
1796 NXST_FLOW_MONITOR reply (xid=0x0):
1797 event=MODIFIED table=0 cookie=0x5 in_port=0,dl_vlan=123 actions=output:3
1798 event=MODIFIED table=0 cookie=0x5 in_port=0,dl_vlan=123,dl_vlan_pcp=0 actions=output:3
1799 event=MODIFIED table=0 cookie=0x5 in_port=0,dl_vlan=123,dl_vlan_pcp=1 actions=output:3
1800 NXST_FLOW_MONITOR reply (xid=0x0):
1801 event=DELETED reason=delete table=0 cookie=0x5 in_port=0,dl_vlan=123 actions=output:3
1802 event=DELETED reason=delete table=0 cookie=0x5 in_port=0,dl_vlan=123,dl_vlan_pcp=0 actions=output:3
1803 event=DELETED reason=delete table=0 cookie=0x5 in_port=0,dl_vlan=123,dl_vlan_pcp=1 actions=output:3
1804 NXST_FLOW_MONITOR reply (xid=0x0):
1805 event=DELETED reason=delete table=0 cookie=0 in_port=0 actions=output:23
1806 event=DELETED reason=delete table=0 cookie=0 in_port=0,dl_vlan=0 actions=output:20
1807 event=DELETED reason=delete table=0 cookie=0 in_port=0,dl_vlan=0,dl_vlan_pcp=0 actions=output:18
1808 event=DELETED reason=delete table=0 cookie=0 in_port=0,dl_vlan=0,dl_vlan_pcp=1 actions=output:19
1809 event=DELETED reason=delete table=0 cookie=0 in_port=0,dl_vlan=124 actions=output:2
1810 event=DELETED reason=delete table=0 cookie=0 in_port=0,dl_vlan=4095 actions=output:14
1811 event=DELETED reason=delete table=0 cookie=0 in_port=0,dl_vlan=4095,dl_vlan_pcp=0 actions=output:12
1812 event=DELETED reason=delete table=0 cookie=0 in_port=0,dl_vlan=4095,dl_vlan_pcp=1 actions=output:13
1813 event=DELETED reason=delete table=0 cookie=0 in_port=0,dl_vlan_pcp=0 actions=output:21
1814 event=DELETED reason=delete table=0 cookie=0 in_port=0,dl_vlan_pcp=1 actions=output:22
1815 event=DELETED reason=delete table=0 cookie=0 in_port=0,vlan_tci=0x0000 actions=output:11
1819 # Check that our own changes are reported as abbreviations.
1820 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
1821 ovs-ofctl add-flow br0 in_port=1,actions=output:2
1822 ovs-ofctl add-flow br0 in_port=2,actions=output:1
1823 ovs-appctl -t ovs-ofctl ofctl/barrier
1824 ovs-appctl -t ovs-ofctl ofctl/send 010e004812345678003fffff00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003000000000000ffffffffffff0000
1825 ovs-appctl -t ovs-ofctl ofctl/barrier
1826 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip], [0], [NXST_FLOW reply:
1828 AT_CHECK([sed 's/ (xid=0x[[1-9a-fA-F]][[0-9a-fA-F]]*)//' monitor.log], [0],
1829 [NXST_FLOW_MONITOR reply (xid=0x0):
1830 event=ADDED table=0 cookie=0 in_port=1 actions=output:2
1831 NXST_FLOW_MONITOR reply (xid=0x0):
1832 event=ADDED table=0 cookie=0 in_port=2 actions=output:1
1834 send: OFPT_FLOW_MOD: DEL priority=0 actions=drop
1835 NXST_FLOW_MONITOR reply (xid=0x0):
1836 event=ABBREV xid=0x12345678
1840 ovs-appctl -t ovs-ofctl exit
1844 AT_SETUP([ofproto - flow monitoring pause and resume])
1845 AT_KEYWORDS([monitor])
1847 # The maximum socket receive buffer size is important for this test, which
1848 # tests behavior when the receive buffer overflows.
1849 if test -e /proc/sys/net/core/rmem_max; then
1851 rmem_max=`cat /proc/sys/net/core/rmem_max`
1852 elif rmem_max=`sysctl -n net.inet.tcp.recvbuf_max 2>/dev/null`; then
1855 # Don't know how to get maximum socket receive buffer on this OS
1858 # Calculate the total amount of queuing: rmem_max in the kernel, 128 kB
1859 # in ofproto sending userspace (see ofmonitor_flush() in connmgr.c).
1860 queue_size=`expr $rmem_max + 128 \* 1024`
1861 echo rmem_max=$rmem_max queue_size=$queue_size
1863 # Each flow update message takes up at least 48 bytes of space in queues
1864 # and in practice more than that.
1865 n_msgs=`expr $queue_size / 48`
1870 # Start a monitor watching the flow table, then make it block.
1871 ON_EXIT([kill `cat ovs-ofctl.pid`])
1872 ovs-ofctl monitor br0 watch: --detach --no-chdir --pidfile >monitor.log 2>&1
1873 AT_CAPTURE_FILE([monitor.log])
1874 ovs-appctl -t ovs-ofctl ofctl/block
1876 # Add $n_msgs flows.
1877 (echo "in_port=2,actions=output:2"
1879 for ($i = 0; $i < '$n_msgs'; $i++) {
1880 print "cookie=1,reg1=$i,actions=drop\n";
1883 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
1884 # Check that multipart flow dumps work properly:
1885 AT_CHECK([ovs-ofctl diff-flows br0 flows.txt])
1886 AT_CHECK([ovs-ofctl add-flow br0 in_port=1,cookie=3,actions=drop])
1887 AT_CHECK([ovs-ofctl mod-flows br0 in_port=2,cookie=2,actions=output:2])
1888 AT_CHECK([ovs-ofctl del-flows br0 cookie=1/-1])
1890 ovs-appctl -t ovs-ofctl ofctl/unblock
1891 ovs-appctl -t ovs-ofctl ofctl/barrier
1893 ovs-appctl -t ovs-ofctl exit
1895 # Check that the flow monitor reported the same number of flows
1896 # added and deleted, but fewer than we actually added and deleted.
1897 adds=`grep -c 'ADDED.*reg1=' monitor.log`
1898 deletes=`grep -c 'DELETED.*reg1=' monitor.log`
1899 echo adds=$adds deletes=$deletes
1900 AT_CHECK([test $adds -gt 100 && test $adds -lt $n_msgs])
1901 AT_CHECK([test $adds = $deletes])
1903 # Check that the flow monitor reported everything in the expected order:
1905 # event=ADDED table=0 cookie=0x1 reg1=0x22
1907 # NXT_FLOW_MONITOR_PAUSED:
1909 # event=DELETED reason=delete table=0 cookie=0x1 reg1=0x22
1911 # event=ADDED table=0 cookie=0x3 in_port=1
1912 # event=MODIFIED table=0 cookie=0x2 in_port=2 actions=output:2
1913 # NXT_FLOW_MONITOR_RESUMED:
1915 # except that, between the PAUSED and RESUMED, the order of the ADDED
1916 # and MODIFIED lines lines depends on hash order, that is, it varies
1917 # as we change the hash function or change architecture. Therefore,
1918 # we use a couple of tests below to accept both orders.
1919 AT_CHECK([ofctl_strip < monitor.log | sed -n -e '
1922 /NXT_FLOW_MONITOR_PAUSED:/p
1923 /NXT_FLOW_MONITOR_RESUMED:/p
1924 ' > monitor.log.subset])
1925 AT_CHECK([grep -v MODIFIED monitor.log.subset], [0], [dnl
1926 event=ADDED table=0 cookie=0x1 reg1=0x22
1927 NXT_FLOW_MONITOR_PAUSED:
1928 event=DELETED reason=delete table=0 cookie=0x1 reg1=0x22
1929 event=ADDED table=0 cookie=0x3 in_port=1
1930 NXT_FLOW_MONITOR_RESUMED:
1932 AT_CHECK([grep -v ADDED monitor.log.subset], [0], [dnl
1933 NXT_FLOW_MONITOR_PAUSED:
1934 event=DELETED reason=delete table=0 cookie=0x1 reg1=0x22
1935 event=MODIFIED table=0 cookie=0x2 in_port=2 actions=output:2
1936 NXT_FLOW_MONITOR_RESUMED:
1942 AT_SETUP([ofproto - event filtering (OpenFlow 1.3)])
1943 AT_KEYWORDS([monitor])
1946 # Start a monitor, use the required protocol version
1947 ovs-ofctl -O OpenFlow13 monitor br0 --detach --no-chdir --pidfile >monitor.log 2>&1
1948 AT_CAPTURE_FILE([monitor.log])
1950 # Send an OpenFlow13 message (04), OFPT_GET_ASYNC_REQUEST (1a), length (8), xid (0a)
1951 ovs-appctl -t ovs-ofctl ofctl/send 041a00080000000a
1952 ovs-appctl -t ovs-ofctl ofctl/barrier
1954 # Check default setting
1955 read -r -d '' expected <<'EOF'
1958 AT_CHECK([ofctl_strip < monitor.log], [], [dnl
1959 send: OFPT_GET_ASYNC_REQUEST (OF1.3):
1960 OFPT_GET_ASYNC_REPLY (OF1.3):
1962 PACKET_IN: no_match action
1963 PORT_STATUS: add delete modify
1964 FLOW_REMOVED: idle hard delete
1968 PORT_STATUS: add delete modify
1970 OFPT_BARRIER_REPLY (OF1.3):