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 - del group])
181 AT_DATA([groups.txt], [dnl
182 group_id=1234,type=all,bucket=output:10
183 group_id=1235,type=all,bucket=output:10
185 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn add-groups br0 groups.txt])
186 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn del-groups br0 group_id=1234])
187 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn dump-groups br0], [0], [stdout])
188 AT_CHECK([STRIP_XIDS stdout], [0], [dnl
189 OFPST_GROUP_DESC reply (OF1.1):
190 group_id=1235,type=all,bucket=actions=output:10
192 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn del-groups br0 group_id=1234])
193 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn dump-groups br0], [0], [stdout])
194 AT_CHECK([STRIP_XIDS stdout], [0], [dnl
195 OFPST_GROUP_DESC reply (OF1.1):
196 group_id=1235,type=all,bucket=actions=output:10
198 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn del-groups br0], [0])
199 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn dump-groups br0], [0], [stdout])
200 AT_CHECK([STRIP_XIDS stdout], [0], [dnl
201 OFPST_GROUP_DESC reply (OF1.1):
206 dnl This is really bare-bones.
207 dnl It at least checks request and reply serialization and deserialization.
208 AT_SETUP([ofproto - del group deletes flows])
210 AT_DATA([groups.txt], [dnl
211 group_id=1234,type=all,bucket=output:10
212 group_id=1235,type=all,bucket=output:10
214 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn add-groups br0 groups.txt])
215 AT_DATA([flows.txt], [dnl
216 tcp actions=group:1234
217 udp actions=group:1235
219 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn add-flows br0 flows.txt])
220 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn dump-flows br0 | ofctl_strip | sort],
222 tcp actions=group:1234
223 udp actions=group:1235
224 OFPST_FLOW reply (OF1.1):
226 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn del-groups br0 group_id=1234])
227 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn dump-flows br0 | ofctl_strip | sort],
229 udp actions=group:1235
230 OFPST_FLOW reply (OF1.1):
232 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn del-groups br0 group_id=1234])
233 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn dump-flows br0 | ofctl_strip | sort],
235 udp actions=group:1235
236 OFPST_FLOW reply (OF1.1):
238 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn del-groups br0])
239 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn dump-flows br0 | ofctl_strip | sort],
241 OFPST_FLOW reply (OF1.1):
246 dnl This is really bare-bones.
247 dnl It at least checks request and reply serialization and deserialization.
248 AT_SETUP([ofproto - group description])
250 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn add-group br0 group_id=1234,type=all,bucket=output:10], [0], [stdout])
251 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn dump-groups br0], [0], [stdout])
252 AT_CHECK([STRIP_XIDS stdout], [0], [dnl
253 OFPST_GROUP_DESC reply (OF1.1):
254 group_id=1234,type=all,bucket=actions=output:10
259 dnl This is really bare-bones.
260 dnl It at least checks request and reply serialization and deserialization.
261 AT_SETUP([ofproto - group description])
263 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn add-group br0 group_id=1234,type=all,bucket=output:10])
264 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn dump-groups br0], [0], [stdout])
265 AT_CHECK([STRIP_XIDS stdout], [0], [dnl
266 OFPST_GROUP_DESC reply (OF1.1):
267 group_id=1234,type=all,bucket=actions=output:10
272 dnl This is really bare-bones.
273 dnl It at least checks request and reply serialization and deserialization.
274 AT_SETUP([ofproto - group features])
276 AT_CHECK([ovs-ofctl -O OpenFlow12 -vwarn dump-group-features br0], [0], [stdout])
277 AT_CHECK([STRIP_XIDS stdout], [0], [dnl
278 OFPST_GROUP_FEATURES reply (OF1.2):
286 dnl This is really bare-bones.
287 dnl It at least checks request and reply serialization and deserialization.
288 AT_SETUP([ofproto - group stats])
290 AT_DATA([groups.txt], [dnl
291 group_id=1234,type=all,bucket=output:10
292 group_id=1235,type=all,bucket=output:10
294 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn add-groups br0 groups.txt])
295 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn add-flow br0 'tcp actions=group:1234'])
296 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn dump-group-stats br0 group_id=1234], [0], [stdout])
297 AT_CHECK([STRIP_XIDS stdout | sort], [0], [dnl
298 group_id=1234,ref_count=1,packet_count=0,byte_count=0,bucket0:packet_count=0,byte_count=0
299 OFPST_GROUP reply (OF1.1):
301 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn dump-group-stats br0], [0], [stdout])
302 AT_CHECK([STRIP_XIDS stdout | sort], [0], [dnl
303 group_id=1234,ref_count=1,packet_count=0,byte_count=0,bucket0:packet_count=0,byte_count=0
304 group_id=1235,ref_count=0,packet_count=0,byte_count=0,bucket0:packet_count=0,byte_count=0
305 OFPST_GROUP reply (OF1.1):
310 AT_SETUP([ofproto - mod-port (OpenFlow 1.0)])
312 for command_config_state in \
314 'noflood NO_FLOOD 0' \
315 'down PORT_DOWN,NO_FLOOD LINK_DOWN' \
316 'flood PORT_DOWN LINK_DOWN' \
317 'no-receive PORT_DOWN,NO_RECV LINK_DOWN' \
318 'no-forward PORT_DOWN,NO_RECV,NO_FWD LINK_DOWN' \
319 'no-packet-in PORT_DOWN,NO_RECV,NO_FWD,NO_PACKET_IN LINK_DOWN' \
320 'forward PORT_DOWN,NO_RECV,NO_PACKET_IN LINK_DOWN' \
321 'packet-in PORT_DOWN,NO_RECV LINK_DOWN' \
325 set $command_config_state
326 command=$[1] config=`echo $[2] | sed 's/,/ /g'` state=$[3]
327 AT_CHECK([ovs-ofctl -vwarn mod-port br0 br0 $command])
328 AT_CHECK([ovs-ofctl -vwarn show br0], [0], [stdout])
329 AT_CHECK_UNQUOTED([STRIP_XIDS stdout], [0], [dnl
330 OFPT_FEATURES_REPLY: dpid:fedcba9876543210
331 n_tables:254, n_buffers:256
332 capabilities: FLOW_STATS TABLE_STATS PORT_STATS QUEUE_STATS ARP_MATCH_IP
333 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
334 LOCAL(br0): addr:aa:55:aa:55:00:00
337 speed: 0 Mbps now, 0 Mbps max
338 OFPT_GET_CONFIG_REPLY: frags=normal miss_send_len=0
344 AT_SETUP([ofproto - mod-port (OpenFlow 1.2)])
346 for command_config_state in \
348 'down PORT_DOWN LINK_DOWN' \
349 'no-receive PORT_DOWN,NO_RECV LINK_DOWN' \
350 'no-forward PORT_DOWN,NO_RECV,NO_FWD LINK_DOWN' \
351 'no-packet-in PORT_DOWN,NO_RECV,NO_FWD,NO_PACKET_IN LINK_DOWN' \
352 'forward PORT_DOWN,NO_RECV,NO_PACKET_IN LINK_DOWN' \
353 'packet-in PORT_DOWN,NO_RECV LINK_DOWN' \
357 set $command_config_state
358 command=$[1] config=`echo $[2] | sed 's/,/ /g'` state=$[3]
359 AT_CHECK([ovs-ofctl -O OpenFlow12 -vwarn mod-port br0 br0 $command])
360 AT_CHECK([ovs-ofctl -O OpenFlow12 -vwarn show br0], [0], [stdout])
361 AT_CHECK_UNQUOTED([STRIP_XIDS stdout], [0], [dnl
362 OFPT_FEATURES_REPLY (OF1.2): dpid:fedcba9876543210
363 n_tables:254, n_buffers:256
364 capabilities: FLOW_STATS TABLE_STATS PORT_STATS QUEUE_STATS
365 LOCAL(br0): addr:aa:55:aa:55:00:00
368 speed: 0 Mbps now, 0 Mbps max
369 OFPT_GET_CONFIG_REPLY (OF1.2): frags=normal miss_send_len=0
375 AT_SETUP([ofproto - basic flow_mod commands (NXM)])
377 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip], [0], [NXST_FLOW reply:
379 AT_CHECK([echo 'in_port=2,actions=1' | ovs-ofctl add-flows br0 -])
380 AT_CHECK([ovs-ofctl add-flow br0 in_port=1,actions=2])
381 AT_CHECK([ovs-ofctl -F nxm add-flow br0 table=1,in_port=4,actions=3])
382 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
383 in_port=1 actions=output:2
384 in_port=2 actions=output:1
385 table=1, in_port=4 actions=output:3
388 AT_CHECK([ovs-ofctl dump-aggregate br0 table=0 | STRIP_XIDS], [0], [dnl
389 NXST_AGGREGATE reply: packet_count=0 byte_count=0 flow_count=2
391 AT_CHECK([ovs-ofctl del-flows br0])
392 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip], [0], [NXST_FLOW reply:
397 AT_SETUP([ofproto - basic flow_mod commands (OpenFlow 1.0)])
399 AT_CHECK([ovs-ofctl -F openflow10 dump-flows br0 | ofctl_strip], [0], [OFPST_FLOW reply:
401 AT_CHECK([echo 'in_port=2,actions=1' | ovs-ofctl -F openflow10 add-flows br0 -])
402 AT_CHECK([ovs-ofctl -F openflow10 add-flow br0 in_port=1,actions=2])
403 AT_CHECK([ovs-ofctl -F openflow10 add-flow br0 table=1,in_port=4,actions=3])
404 AT_CHECK([ovs-ofctl -F openflow10 dump-flows br0 | ofctl_strip | sort], [0], [dnl
405 in_port=1 actions=output:2
406 in_port=2 actions=output:1
407 table=1, in_port=4 actions=output:3
410 AT_CHECK([ovs-ofctl -F openflow10 dump-aggregate br0 table=0 | STRIP_XIDS], [0], [dnl
411 OFPST_AGGREGATE reply: packet_count=0 byte_count=0 flow_count=2
413 AT_CHECK([ovs-ofctl -F openflow10 del-flows br0])
414 AT_CHECK([ovs-ofctl -F openflow10 dump-flows br0 | ofctl_strip], [0], [OFPST_FLOW reply:
419 AT_SETUP([ofproto - basic flow_mod commands (OpenFlow 1.1)])
421 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip], [0], [OFPST_FLOW reply (OF1.1):
423 AT_CHECK([echo 'in_port=2,actions=1' | ovs-ofctl -O OpenFlow11 add-flows br0 -])
424 AT_CHECK([ovs-ofctl -O OpenFlow11 add-flow br0 in_port=1,actions=2])
425 AT_CHECK([ovs-ofctl -O OpenFlow11 add-flow br0 table=1,in_port=4,actions=3])
426 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0], [dnl
427 in_port=1 actions=output:2
428 in_port=2 actions=output:1
429 table=1, in_port=4 actions=output:3
430 OFPST_FLOW reply (OF1.1):
432 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-aggregate br0 table=0 | STRIP_XIDS], [0], [dnl
433 OFPST_AGGREGATE reply (OF1.1): packet_count=0 byte_count=0 flow_count=2
435 AT_CHECK([ovs-ofctl -O OpenFlow11 del-flows br0])
436 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip], [0], [OFPST_FLOW reply (OF1.1):
437 table=1, in_port=4 actions=output:3
442 AT_SETUP([ofproto - flow_mod negative test (OpenFlow 1.1)])
444 [set bridge br0 protocols=OpenFlow10,OpenFlow11,OpenFlow12,OpenFlow13])
445 AT_CHECK([ovs-ofctl add-flow -O OpenFlow11 br0 table=1,action=goto_table:2])
447 # The error message here actually comes from ovs-ofctl, not from ovs-vswitchd,
448 # but at least it's the same code in ofpacts_check() that issues the error.
449 AT_CHECK([ovs-ofctl add-flow -O OpenFlow11 br0 table=1,action=goto_table:1],
451 [ovs-ofctl: actions are invalid with specified match (OFPBRC_BAD_TABLE_ID)
456 AT_SETUP([ofproto - set-field flow_mod commands (NXM)])
458 AT_CHECK([ovs-ofctl add-flow br0 ipv6,table=1,in_port=3,actions=drop])
459 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])
460 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
461 table=1, ipv6,in_port=3 actions=load:0xa6badbfffefe59fa->NXM_NX_IPV6_SRC[[0..63]],load:0xfe8001234567890a->NXM_NX_IPV6_SRC[[64..127]]
467 AT_SETUP([ofproto - basic flow_mod commands (OpenFlow 1.2)])
469 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip], [0], [OFPST_FLOW reply (OF1.2):
471 AT_CHECK([echo 'in_port=2,actions=1' | ovs-ofctl -O OpenFlow12 add-flows br0 -])
472 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 in_port=1,actions=2])
473 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 table=1,in_port=4,actions=3])
474 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
475 in_port=1 actions=output:2
476 in_port=2 actions=output:1
477 table=1, in_port=4 actions=output:3
478 OFPST_FLOW reply (OF1.2):
480 AT_CHECK([ovs-ofctl -O OpenFlow12 del-flows br0])
481 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip], [0], [OFPST_FLOW reply (OF1.2):
486 AT_SETUP([ofproto - dump flows with cookie])
488 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x1,in_port=1,actions=1])
489 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x2,in_port=2,actions=1])
490 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x3,in_port=3,actions=1])
491 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
492 cookie=0x1, in_port=1 actions=output:1
493 cookie=0x2, in_port=2 actions=output:1
494 cookie=0x3, in_port=3 actions=output:1
497 AT_CHECK([ovs-ofctl dump-aggregate br0 table=0 | STRIP_XIDS], [0], [dnl
498 NXST_AGGREGATE reply: packet_count=0 byte_count=0 flow_count=3
500 AT_CHECK([ovs-ofctl dump-flows br0 cookie=0x3/-1 | ofctl_strip | sort], [0], [dnl
501 cookie=0x3, in_port=3 actions=output:1
504 AT_CHECK([ovs-ofctl dump-aggregate br0 cookie=0x3/-1 | STRIP_XIDS], [0], [dnl
505 NXST_AGGREGATE reply: packet_count=0 byte_count=0 flow_count=1
510 AT_SETUP([ofproto - mod flow with cookie change (OpenFlow 1.0)])
512 AT_CHECK([ovs-ofctl -F openflow10 add-flow br0 cookie=0x1,in_port=1,actions=1])
513 AT_CHECK([ovs-ofctl -F openflow10 dump-flows br0 | ofctl_strip | sort], [0], [dnl
514 cookie=0x1, in_port=1 actions=output:1
518 AT_CHECK([ovs-ofctl -F openflow10 mod-flows br0 cookie=0x2,in_port=1,actions=1])
519 AT_CHECK([ovs-ofctl -F openflow10 dump-flows br0 | ofctl_strip | sort], [0], [dnl
520 cookie=0x2, in_port=1 actions=output:1
526 AT_SETUP([ofproto - mod flow with cookie change (NXM)])
528 AT_CHECK([ovs-ofctl -F nxm add-flow br0 cookie=0x1,in_port=1,actions=1])
529 AT_CHECK([ovs-ofctl -F nxm dump-flows br0 | ofctl_strip | sort], [0], [dnl
530 cookie=0x1, in_port=1 actions=output:1
534 AT_CHECK([ovs-ofctl -F nxm mod-flows br0 cookie=0x2,in_port=1,actions=1])
535 AT_CHECK([ovs-ofctl -F nxm dump-flows br0 | ofctl_strip | sort], [0], [dnl
536 cookie=0x2, in_port=1 actions=output:1
542 AT_SETUP([ofproto - no mod flow with cookie change (OpenFlow 1.1)])
544 AT_CHECK([ovs-ofctl -O OpenFlow11 add-flow br0 cookie=0x1,in_port=1,actions=1])
545 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0], [dnl
546 cookie=0x1, in_port=1 actions=output:1
547 OFPST_FLOW reply (OF1.1):
549 AT_CHECK([ovs-ofctl -O OpenFlow11 mod-flows br0 cookie=0x2,in_port=1,actions=1])
550 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0], [dnl
551 cookie=0x1, in_port=1 actions=output:1
552 OFPST_FLOW reply (OF1.1):
557 dnl The OpenFlow 1.2 spec states that the cookie may not be modified
558 AT_SETUP([ofproto - no mod flow with cookie change (OpenFlow 1.2)])
560 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 cookie=0x1,in_port=1,actions=1])
561 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
562 cookie=0x1, in_port=1 actions=output:1
563 OFPST_FLOW reply (OF1.2):
566 AT_CHECK([ovs-ofctl -O OpenFlow12 mod-flows br0 cookie=0x2,in_port=1,actions=1])
567 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
568 cookie=0x1, in_port=1 actions=output:1
569 OFPST_FLOW reply (OF1.2):
574 AT_SETUP([ofproto - mod flows based on cookie mask (OpenFlow 1.0)])
576 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x1,in_port=1,actions=1])
577 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x1,in_port=2,actions=1])
578 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x2,in_port=3,actions=1])
579 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
580 cookie=0x1, in_port=1 actions=output:1
581 cookie=0x1, in_port=2 actions=output:1
582 cookie=0x2, in_port=3 actions=output:1
586 AT_CHECK([ovs-ofctl -F nxm mod-flows br0 cookie=0x1/0xff,actions=4])
587 AT_CHECK([ovs-ofctl -F nxm dump-flows br0 | ofctl_strip | sort], [0], [dnl
588 cookie=0x1, in_port=1 actions=output:4
589 cookie=0x1, in_port=2 actions=output:4
590 cookie=0x2, in_port=3 actions=output:1
596 AT_SETUP([ofproto - mod flows based on cookie mask (OpenFlow 1.1)])
598 AT_CHECK([ovs-ofctl -O OpenFlow11 add-flow br0 cookie=0x1,in_port=1,actions=1])
599 AT_CHECK([ovs-ofctl -O OpenFlow11 add-flow br0 cookie=0x1,in_port=2,actions=1])
600 AT_CHECK([ovs-ofctl -O OpenFlow11 add-flow br0 cookie=0x2,in_port=3,actions=1])
601 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0], [dnl
602 cookie=0x1, in_port=1 actions=output:1
603 cookie=0x1, in_port=2 actions=output:1
604 cookie=0x2, in_port=3 actions=output:1
605 OFPST_FLOW reply (OF1.1):
608 AT_CHECK([ovs-ofctl -O OpenFlow11 mod-flows br0 cookie=0x1/0xff,actions=4])
609 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0], [dnl
610 cookie=0x1, in_port=1 actions=output:4
611 cookie=0x1, in_port=2 actions=output:4
612 cookie=0x2, in_port=3 actions=output:1
613 OFPST_FLOW reply (OF1.1):
618 AT_SETUP([ofproto - mod flows based on cookie mask (OpenFlow 1.2)])
620 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 cookie=0x1,in_port=1,actions=1])
621 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 cookie=0x1,in_port=2,actions=1])
622 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 cookie=0x2,in_port=3,actions=1])
623 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
624 cookie=0x1, in_port=1 actions=output:1
625 cookie=0x1, in_port=2 actions=output:1
626 cookie=0x2, in_port=3 actions=output:1
627 OFPST_FLOW reply (OF1.2):
630 AT_CHECK([ovs-ofctl -O OpenFlow12 mod-flows br0 cookie=0x1/0xff,actions=4])
631 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
632 cookie=0x1, in_port=1 actions=output:4
633 cookie=0x1, in_port=2 actions=output:4
634 cookie=0x2, in_port=3 actions=output:1
635 OFPST_FLOW reply (OF1.2):
640 dnl The OpenFlow 1.2 spec states that the cookie may not be modified
641 AT_SETUP([ofproto - mod flows based on cookie mask with cookie change])
643 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x1,in_port=1,actions=1])
644 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x1,in_port=2,actions=1])
645 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x2,in_port=3,actions=1])
646 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
647 cookie=0x1, in_port=1 actions=output:1
648 cookie=0x1, in_port=2 actions=output:1
649 cookie=0x2, in_port=3 actions=output:1
653 AT_CHECK([ovs-ofctl -F nxm mod-flows br0 cookie=1/-1,cookie=4,actions=4])
654 AT_CHECK([ovs-ofctl -F nxm dump-flows br0 | ofctl_strip | sort], [0], [dnl
655 cookie=0x2, in_port=3 actions=output:1
656 cookie=0x4, in_port=1 actions=output:4
657 cookie=0x4, in_port=2 actions=output:4
663 AT_SETUP([ofproto - mod flow with cookie miss (mask==0) - NXM])
665 AT_CHECK([ovs-ofctl -F nxm mod-flows br0 in_port=1,actions=1])
666 AT_CHECK([ovs-ofctl -F nxm dump-flows br0 | ofctl_strip | sort], [0], [dnl
667 in_port=1 actions=output:1
673 AT_SETUP([ofproto - mod flow with cookie miss (mask==0) - OF1.1])
675 AT_CHECK([ovs-ofctl -O openflow11 mod-flows br0 in_port=1,actions=1])
676 AT_CHECK([ovs-ofctl -O openflow11 dump-flows br0 | ofctl_strip | sort], [0], [dnl
677 in_port=1 actions=output:1
678 OFPST_FLOW reply (OF1.1):
683 AT_SETUP([ofproto - mod flow with cookie miss (mask==0) - OF1.2])
685 AT_CHECK([ovs-ofctl -O openflow12 mod-flows br0 in_port=1,actions=1])
686 AT_CHECK([ovs-ofctl -O openflow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
687 OFPST_FLOW reply (OF1.2):
692 AT_SETUP([ofproto - mod flow with cookie miss (mask!=0) - NXM])
694 AT_CHECK([ovs-ofctl -F nxm mod-flows br0 cookie=1/1,in_port=1,actions=1])
695 AT_CHECK([ovs-ofctl -F nxm dump-flows br0 | ofctl_strip | sort], [0], [dnl
701 AT_SETUP([ofproto - mod flow with cookie miss (mask!=0) - OF1.1])
703 AT_CHECK([ovs-ofctl -O openflow11 mod-flows br0 cookie=1/1,in_port=1,actions=1])
704 AT_CHECK([ovs-ofctl -O openflow11 dump-flows br0 | ofctl_strip | sort], [0], [dnl
705 OFPST_FLOW reply (OF1.1):
710 AT_SETUP([ofproto - mod flow with cookie miss (mask!=0) - OF1.2])
712 AT_CHECK([ovs-ofctl -O openflow12 mod-flows br0 cookie=1/1,in_port=1,actions=1])
713 AT_CHECK([ovs-ofctl -O openflow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
714 OFPST_FLOW reply (OF1.2):
719 AT_SETUP([ofproto - del flows with cookies])
721 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x1,in_port=1,actions=1])
722 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x2,in_port=2,actions=1])
723 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x3,in_port=3,actions=1])
724 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
725 cookie=0x1, in_port=1 actions=output:1
726 cookie=0x2, in_port=2 actions=output:1
727 cookie=0x3, in_port=3 actions=output:1
731 AT_CHECK([ovs-ofctl del-flows br0])
732 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
738 AT_SETUP([ofproto - del flows based on cookie])
740 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x1,in_port=1,actions=1])
741 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x2,in_port=2,actions=1])
742 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x3,in_port=3,actions=1])
743 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
744 cookie=0x1, in_port=1 actions=output:1
745 cookie=0x2, in_port=2 actions=output:1
746 cookie=0x3, in_port=3 actions=output:1
750 AT_CHECK([ovs-ofctl del-flows br0 cookie=0x3/-1])
751 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
752 cookie=0x1, in_port=1 actions=output:1
753 cookie=0x2, in_port=2 actions=output:1
759 AT_SETUP([ofproto - del flows based on cookie mask])
761 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x1,in_port=1,actions=1])
762 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x2,in_port=2,actions=1])
763 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x3,in_port=3,actions=1])
764 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
765 cookie=0x1, in_port=1 actions=output:1
766 cookie=0x2, in_port=2 actions=output:1
767 cookie=0x3, in_port=3 actions=output:1
770 AT_CHECK([ovs-ofctl del-flows br0 cookie=0x3/0x1])
771 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
772 cookie=0x2, in_port=2 actions=output:1
778 AT_SETUP([ofproto - del flows based on table id (NXM)])
780 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x1,in_port=1,actions=1])
781 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x2,in_port=2,table=1,actions=1])
782 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
783 cookie=0x1, in_port=1 actions=output:1
784 cookie=0x2, table=1, in_port=2 actions=output:1
787 AT_CHECK([ovs-ofctl del-flows br0 table=0])
788 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
789 cookie=0x2, table=1, in_port=2 actions=output:1
792 AT_CHECK([ovs-ofctl del-flows br0 table=1])
793 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
796 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x1,in_port=1,actions=1])
797 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x2,in_port=2,table=1,actions=1])
798 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
799 cookie=0x1, in_port=1 actions=output:1
800 cookie=0x2, table=1, in_port=2 actions=output:1
803 AT_CHECK([ovs-ofctl del-flows br0])
804 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
810 AT_SETUP([ofproto - del flows based on table id (OpenFlow 1.1)])
812 AT_CHECK([ovs-ofctl -O OpenFlow11 add-flow br0 cookie=0x1,in_port=1,actions=1])
813 AT_CHECK([ovs-ofctl -O OpenFlow11 add-flow br0 cookie=0x2,in_port=2,table=1,actions=1])
814 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0], [dnl
815 cookie=0x1, in_port=1 actions=output:1
816 cookie=0x2, table=1, in_port=2 actions=output:1
817 OFPST_FLOW reply (OF1.1):
819 AT_CHECK([ovs-ofctl -O OpenFlow11 del-flows br0 table=0])
820 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0], [dnl
821 cookie=0x2, table=1, in_port=2 actions=output:1
822 OFPST_FLOW reply (OF1.1):
824 AT_CHECK([ovs-ofctl -O OpenFlow11 del-flows br0 table=1])
825 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0], [dnl
826 OFPST_FLOW reply (OF1.1):
828 AT_CHECK([ovs-ofctl -O OpenFlow11 add-flow br0 cookie=0x1,in_port=1,actions=1])
829 AT_CHECK([ovs-ofctl -O OpenFlow11 add-flow br0 cookie=0x2,in_port=2,table=1,actions=1])
830 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0], [dnl
831 cookie=0x1, in_port=1 actions=output:1
832 cookie=0x2, table=1, in_port=2 actions=output:1
833 OFPST_FLOW reply (OF1.1):
835 AT_CHECK([ovs-ofctl -O OpenFlow11 del-flows br0])
836 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip], [0], [dnl
837 OFPST_FLOW reply (OF1.1):
838 cookie=0x2, table=1, in_port=2 actions=output:1
843 AT_SETUP([ofproto - del flows based on table id (OpenFlow 1.2)])
845 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 cookie=0x1,in_port=1,actions=1])
846 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 cookie=0x2,in_port=2,table=1,actions=1])
847 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
848 cookie=0x1, in_port=1 actions=output:1
849 cookie=0x2, table=1, in_port=2 actions=output:1
850 OFPST_FLOW reply (OF1.2):
852 AT_CHECK([ovs-ofctl -O OpenFlow12 del-flows br0 table=0])
853 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
854 cookie=0x2, table=1, in_port=2 actions=output:1
855 OFPST_FLOW reply (OF1.2):
857 AT_CHECK([ovs-ofctl -O OpenFlow12 del-flows br0 table=1])
858 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
859 OFPST_FLOW reply (OF1.2):
861 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 cookie=0x1,in_port=1,actions=1])
862 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 cookie=0x2,in_port=2,table=1,actions=1])
863 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
864 cookie=0x1, in_port=1 actions=output:1
865 cookie=0x2, table=1, in_port=2 actions=output:1
866 OFPST_FLOW reply (OF1.2):
868 AT_CHECK([ovs-ofctl -O OpenFlow12 del-flows br0])
869 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
870 OFPST_FLOW reply (OF1.2):
875 AT_SETUP([ofproto - flow table configuration (OpenFlow 1.0)])
877 # Check the default configuration.
878 (echo "OFPST_TABLE reply (xid=0x2): 254 tables
879 0: classifier: wild=0x3fffff, max=1000000, active=0
882 while test $x -lt 254; do
883 printf " %d: %-8s: wild=0x3fffff, max=1000000, active=0
888 AT_CHECK([ovs-ofctl dump-tables br0], [0], [expout])
889 # Change the configuration.
892 -- --id=@t0 create Flow_Table name=main \
893 -- --id=@t1 create Flow_Table flow-limit=1024 \
894 -- set bridge br0 'flow_tables={1=@t1,0=@t0}' \
895 | ${PERL} $srcdir/uuidfilt.pl],
899 # Check that the configuration was updated.
900 mv expout orig-expout
901 (echo "OFPST_TABLE reply (xid=0x2): 254 tables
902 0: main : wild=0x3fffff, max=1000000, active=0
904 1: table1 : wild=0x3fffff, max= 1024, active=0
906 tail -n +6 orig-expout) > expout
907 AT_CHECK([ovs-ofctl dump-tables br0], [0], [expout])
911 AT_SETUP([ofproto - flow table configuration (OpenFlow 1.2)])
913 # Check the default configuration.
914 (mid="wild=0xfffffffff, max=1000000,"
917 match=0xfffffffff, instructions=0x00000007, config=0x00000003
918 write_actions=0x00000000, apply_actions=0x00000000
919 write_setfields=0x0000000fffffffff
920 apply_setfields=0x0000000fffffffff
921 metadata_match=0xffffffffffffffff
922 metadata_write=0xffffffffffffffff"
923 echo "OFPST_TABLE reply (OF1.2) (xid=0x2): 254 tables
924 0: classifier: $mid active=0$tail"
926 while test $x -lt 254; do
927 printf " %d: %-8s: $mid active=0$tail
931 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-tables br0], [0], [expout])
932 # Change the configuration.
935 -- --id=@t0 create Flow_Table name=main \
936 -- --id=@t1 create Flow_Table flow-limit=1024 \
937 -- set bridge br0 'flow_tables={1=@t1,0=@t0}' \
938 | ${PERL} $srcdir/uuidfilt.pl],
942 # Check that the configuration was updated.
943 mv expout orig-expout
944 (echo "OFPST_TABLE reply (OF1.2) (xid=0x2): 254 tables
945 0: main : wild=0xfffffffff, max=1000000, active=0"
946 tail -n +3 orig-expout | head -7
947 echo " 1: table1 : wild=0xfffffffff, max= 1024, active=0"
948 tail -n +11 orig-expout) > expout
949 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-tables br0], [0], [expout])
953 AT_SETUP([ofproto - hard limits on flow table size (OpenFLow 1.0)])
955 # Configure a maximum of 4 flows.
958 -- --id=@t0 create Flow_Table flow-limit=4 \
959 -- set bridge br0 flow_tables:0=@t0 \
960 | ${PERL} $srcdir/uuidfilt.pl],
964 for in_port in 1 2 3 4; do
965 ovs-ofctl add-flow br0 in_port=$in_port,actions=drop
967 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
968 in_port=1 actions=drop
969 in_port=2 actions=drop
970 in_port=3 actions=drop
971 in_port=4 actions=drop
974 # Adding another flow will be refused.
975 AT_CHECK([ovs-ofctl add-flow br0 in_port=5,actions=drop], [1], [], [stderr])
976 AT_CHECK([head -n 1 stderr | ofctl_strip], [0],
977 [OFPT_ERROR: OFPFMFC_TABLE_FULL
979 # Also a mod-flow that would add a flow will be refused.
980 AT_CHECK([ovs-ofctl mod-flows br0 in_port=5,actions=drop], [1], [], [stderr])
981 AT_CHECK([head -n 1 stderr | ofctl_strip], [0],
982 [OFPT_ERROR: OFPFMFC_TABLE_FULL
984 # Replacing or modifying an existing flow is allowed.
985 AT_CHECK([ovs-ofctl add-flow br0 in_port=4,actions=normal])
986 AT_CHECK([ovs-ofctl mod-flows br0 in_port=3,actions=output:1])
987 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
988 in_port=1 actions=drop
989 in_port=2 actions=drop
990 in_port=3 actions=output:1
991 in_port=4 actions=NORMAL
997 AT_SETUP([ofproto - hard limits on flow table size (OpenFLow 1.2)])
999 # Configure a maximum of 4 flows.
1002 -- --id=@t0 create Flow_Table flow-limit=4 \
1003 -- set bridge br0 flow_tables:0=@t0 \
1004 | ${PERL} $srcdir/uuidfilt.pl],
1008 for in_port in 1 2 3 4; do
1009 ovs-ofctl -O OpenFlow12 add-flow br0 in_port=$in_port,actions=drop
1011 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1012 in_port=1 actions=drop
1013 in_port=2 actions=drop
1014 in_port=3 actions=drop
1015 in_port=4 actions=drop
1016 OFPST_FLOW reply (OF1.2):
1018 # Adding another flow will be refused.
1019 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 in_port=5,actions=drop], [1], [], [stderr])
1020 AT_CHECK([head -n 1 stderr | ofctl_strip], [0],
1021 [OFPT_ERROR (OF1.2): OFPFMFC_TABLE_FULL
1023 # Replacing or modifying an existing flow is allowed.
1024 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 in_port=4,actions=normal])
1025 AT_CHECK([ovs-ofctl -O OpenFlow12 mod-flows br0 in_port=3,actions=output:1])
1026 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1027 in_port=1 actions=drop
1028 in_port=2 actions=drop
1029 in_port=3 actions=output:1
1030 in_port=4 actions=NORMAL
1031 OFPST_FLOW reply (OF1.2):
1036 AT_SETUP([ofproto - eviction upon table overflow (OpenFlow 1.0)])
1038 # Configure a maximum of 4 flows.
1041 -- --id=@t0 create Flow_Table flow-limit=4 overflow-policy=evict \
1042 -- set bridge br0 flow_tables:0=@t0 \
1043 | ${PERL} $srcdir/uuidfilt.pl],
1047 for in_port in 4 3 2 1; do
1048 ovs-ofctl add-flow br0 idle_timeout=${in_port}0,in_port=$in_port,actions=drop
1050 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1051 idle_timeout=10, in_port=1 actions=drop
1052 idle_timeout=20, in_port=2 actions=drop
1053 idle_timeout=30, in_port=3 actions=drop
1054 idle_timeout=40, in_port=4 actions=drop
1057 # Adding another flow will cause the one that expires soonest to be evicted.
1058 AT_CHECK([ovs-ofctl add-flow br0 in_port=5,actions=drop])
1059 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1060 idle_timeout=20, in_port=2 actions=drop
1061 idle_timeout=30, in_port=3 actions=drop
1062 idle_timeout=40, in_port=4 actions=drop
1063 in_port=5 actions=drop
1066 # A mod-flow that adds a flow also causes eviction, but replacing or
1067 # modifying an existing flow doesn't.
1068 AT_CHECK([ovs-ofctl mod-flows br0 in_port=6,actions=drop])
1069 AT_CHECK([ovs-ofctl add-flow br0 in_port=4,actions=normal])
1070 AT_CHECK([ovs-ofctl mod-flows br0 in_port=3,actions=output:1])
1071 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1072 idle_timeout=30, in_port=3 actions=output:1
1073 in_port=4 actions=NORMAL
1074 in_port=5 actions=drop
1075 in_port=6 actions=drop
1078 # Flows with no timeouts at all cannot be evicted.
1079 AT_CHECK([ovs-ofctl add-flow br0 in_port=7,actions=normal])
1080 AT_CHECK([ovs-ofctl add-flow br0 in_port=8,actions=drop], [1], [], [stderr])
1081 AT_CHECK([head -n 1 stderr | ofctl_strip], [0],
1082 [OFPT_ERROR: OFPFMFC_TABLE_FULL
1084 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1085 in_port=4 actions=NORMAL
1086 in_port=5 actions=drop
1087 in_port=6 actions=drop
1088 in_port=7 actions=NORMAL
1094 AT_SETUP([ofproto - eviction upon table overflow (OpenFlow 1.2)])
1096 # Configure a maximum of 4 flows.
1099 -- --id=@t0 create Flow_Table flow-limit=4 overflow-policy=evict \
1100 -- set bridge br0 flow_tables:0=@t0 \
1101 | ${PERL} $srcdir/uuidfilt.pl],
1105 for in_port in 4 3 2 1; do
1106 ovs-ofctl -O OpenFlow12 add-flow br0 idle_timeout=${in_port}0,in_port=$in_port,actions=drop
1108 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1109 idle_timeout=10, in_port=1 actions=drop
1110 idle_timeout=20, in_port=2 actions=drop
1111 idle_timeout=30, in_port=3 actions=drop
1112 idle_timeout=40, in_port=4 actions=drop
1113 OFPST_FLOW reply (OF1.2):
1115 # Adding another flow will cause the one that expires soonest to be evicted.
1116 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 in_port=5,actions=drop])
1117 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1118 idle_timeout=20, in_port=2 actions=drop
1119 idle_timeout=30, in_port=3 actions=drop
1120 idle_timeout=40, in_port=4 actions=drop
1121 in_port=5 actions=drop
1122 OFPST_FLOW reply (OF1.2):
1124 # In Open Flow 1.2 a mod-flow does not ever add a flow and thus
1125 # has no effect on eviction
1126 AT_CHECK([ovs-ofctl -O OpenFlow12 mod-flows br0 in_port=6,actions=drop])
1127 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 in_port=4,actions=normal])
1128 AT_CHECK([ovs-ofctl -O OpenFlow12 mod-flows br0 in_port=3,actions=output:1])
1129 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1130 idle_timeout=20, in_port=2 actions=drop
1131 idle_timeout=30, in_port=3 actions=output:1
1132 in_port=4 actions=NORMAL
1133 in_port=5 actions=drop
1134 OFPST_FLOW reply (OF1.2):
1136 # Flows with no timeouts at all cannot be evicted.
1137 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 in_port=6,actions=drop])
1138 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 in_port=7,actions=normal])
1139 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 in_port=8,actions=drop], [1], [], [stderr])
1140 AT_CHECK([head -n 1 stderr | ofctl_strip], [0],
1141 [OFPT_ERROR (OF1.2): OFPFMFC_TABLE_FULL
1143 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1144 in_port=4 actions=NORMAL
1145 in_port=5 actions=drop
1146 in_port=6 actions=drop
1147 in_port=7 actions=NORMAL
1148 OFPST_FLOW reply (OF1.2):
1153 AT_SETUP([ofproto - eviction upon table overflow, with fairness (OpenFlow 1.0)])
1155 # Configure a maximum of 4 flows.
1158 -- --id=@t0 create Flow_Table name=evict flow-limit=4 \
1159 overflow-policy=evict \
1160 groups='"NXM_OF_IN_PORT[[]]"' \
1161 -- set bridge br0 flow_tables:0=@t0 \
1162 | ${PERL} $srcdir/uuidfilt.pl],
1166 ovs-ofctl add-flows br0 - <<EOF
1167 idle_timeout=10 in_port=2 dl_src=00:44:55:66:77:88 actions=drop
1168 idle_timeout=20 in_port=1 dl_src=00:11:22:33:44:55 actions=drop
1169 idle_timeout=30 in_port=1 dl_src=00:22:33:44:55:66 actions=drop
1170 idle_timeout=40 in_port=1 dl_src=00:33:44:55:66:77 actions=drop
1172 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1173 idle_timeout=10, in_port=2,dl_src=00:44:55:66:77:88 actions=drop
1174 idle_timeout=20, in_port=1,dl_src=00:11:22:33:44:55 actions=drop
1175 idle_timeout=30, in_port=1,dl_src=00:22:33:44:55:66 actions=drop
1176 idle_timeout=40, in_port=1,dl_src=00:33:44:55:66:77 actions=drop
1179 # Adding another flow will cause the one that expires soonest within
1180 # the largest group (those with in_port=1) to be evicted. In this
1181 # case this is not the same as the one that expires soonest overall
1182 # (which is what makes the test interesting):
1183 AT_CHECK([ovs-ofctl add-flow br0 in_port=2,dl_src=00:55:66:77:88:99,actions=drop])
1184 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1185 idle_timeout=10, in_port=2,dl_src=00:44:55:66:77:88 actions=drop
1186 idle_timeout=30, in_port=1,dl_src=00:22:33:44:55:66 actions=drop
1187 idle_timeout=40, in_port=1,dl_src=00:33:44:55:66:77 actions=drop
1188 in_port=2,dl_src=00:55:66:77:88:99 actions=drop
1191 # Enlarge the flow limit, change the eviction policy back to strictly
1192 # based on expiration, and and add some flows.
1193 AT_CHECK([ovs-vsctl set Flow_Table evict groups='[[]]' flow-limit=7])
1194 ovs-ofctl add-flows br0 - <<EOF
1195 idle_timeout=50 in_port=2 dl_src=00:66:77:88:99:aa actions=drop
1196 idle_timeout=60 in_port=2 dl_src=00:77:88:99:aa:bb actions=drop
1197 idle_timeout=70 in_port=2 dl_src=00:88:99:aa:bb:cc actions=drop
1199 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1200 idle_timeout=10, in_port=2,dl_src=00:44:55:66:77:88 actions=drop
1201 idle_timeout=30, in_port=1,dl_src=00:22:33:44:55:66 actions=drop
1202 idle_timeout=40, in_port=1,dl_src=00:33:44:55:66:77 actions=drop
1203 idle_timeout=50, in_port=2,dl_src=00:66:77:88:99:aa actions=drop
1204 idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=drop
1205 idle_timeout=70, in_port=2,dl_src=00:88:99:aa:bb:cc actions=drop
1206 in_port=2,dl_src=00:55:66:77:88:99 actions=drop
1209 # Adding another flow will cause the one that expires soonest overall
1211 AT_CHECK([ovs-ofctl add-flow br0 'idle_timeout=80 in_port=2 dl_src=00:99:aa:bb:cc:dd actions=drop'])
1212 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1213 idle_timeout=30, in_port=1,dl_src=00:22:33:44:55:66 actions=drop
1214 idle_timeout=40, in_port=1,dl_src=00:33:44:55:66:77 actions=drop
1215 idle_timeout=50, in_port=2,dl_src=00:66:77:88:99:aa actions=drop
1216 idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=drop
1217 idle_timeout=70, in_port=2,dl_src=00:88:99:aa:bb:cc actions=drop
1218 idle_timeout=80, in_port=2,dl_src=00:99:aa:bb:cc:dd actions=drop
1219 in_port=2,dl_src=00:55:66:77:88:99 actions=drop
1222 # Reducing the flow limit also causes the flows that expire soonest
1223 # overall to be evicted.
1224 AT_CHECK([ovs-vsctl set Flow_Table evict flow-limit=4])
1225 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1226 idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=drop
1227 idle_timeout=70, in_port=2,dl_src=00:88:99:aa:bb:cc actions=drop
1228 idle_timeout=80, in_port=2,dl_src=00:99:aa:bb:cc:dd actions=drop
1229 in_port=2,dl_src=00:55:66:77:88:99 actions=drop
1235 AT_SETUP([ofproto - eviction upon table overflow, with fairness (OpenFlow 1.2)])
1237 # Configure a maximum of 4 flows.
1240 -- --id=@t0 create Flow_Table name=evict flow-limit=4 \
1241 overflow-policy=evict \
1242 groups='"NXM_OF_IN_PORT[[]]"' \
1243 -- set bridge br0 flow_tables:0=@t0 \
1244 | ${PERL} $srcdir/uuidfilt.pl],
1248 ovs-ofctl -O OpenFlow12 add-flows br0 - <<EOF
1249 idle_timeout=10 in_port=2 dl_src=00:44:55:66:77:88 actions=drop
1250 idle_timeout=20 in_port=1 dl_src=00:11:22:33:44:55 actions=drop
1251 idle_timeout=30 in_port=1 dl_src=00:22:33:44:55:66 actions=drop
1252 idle_timeout=40 in_port=1 dl_src=00:33:44:55:66:77 actions=drop
1254 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1255 idle_timeout=10, in_port=2,dl_src=00:44:55:66:77:88 actions=drop
1256 idle_timeout=20, in_port=1,dl_src=00:11:22:33:44:55 actions=drop
1257 idle_timeout=30, in_port=1,dl_src=00:22:33:44:55:66 actions=drop
1258 idle_timeout=40, in_port=1,dl_src=00:33:44:55:66:77 actions=drop
1259 OFPST_FLOW reply (OF1.2):
1261 # Adding another flow will cause the one that expires soonest within
1262 # the largest group (those with in_port=1) to be evicted. In this
1263 # case this is not the same as the one that expires soonest overall
1264 # (which is what makes the test interesting):
1265 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 in_port=2,dl_src=00:55:66:77:88:99,actions=drop])
1266 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1267 idle_timeout=10, in_port=2,dl_src=00:44:55:66:77:88 actions=drop
1268 idle_timeout=30, in_port=1,dl_src=00:22:33:44:55:66 actions=drop
1269 idle_timeout=40, in_port=1,dl_src=00:33:44:55:66:77 actions=drop
1270 in_port=2,dl_src=00:55:66:77:88:99 actions=drop
1271 OFPST_FLOW reply (OF1.2):
1273 # Enlarge the flow limit, change the eviction policy back to strictly
1274 # based on expiration, and and add some flows.
1275 AT_CHECK([ovs-vsctl set Flow_Table evict groups='[[]]' flow-limit=7])
1276 ovs-ofctl -O OpenFlow12 add-flows br0 - <<EOF
1277 idle_timeout=50 in_port=2 dl_src=00:66:77:88:99:aa actions=drop
1278 idle_timeout=60 in_port=2 dl_src=00:77:88:99:aa:bb actions=drop
1279 idle_timeout=70 in_port=2 dl_src=00:88:99:aa:bb:cc actions=drop
1281 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1282 idle_timeout=10, in_port=2,dl_src=00:44:55:66:77:88 actions=drop
1283 idle_timeout=30, in_port=1,dl_src=00:22:33:44:55:66 actions=drop
1284 idle_timeout=40, in_port=1,dl_src=00:33:44:55:66:77 actions=drop
1285 idle_timeout=50, in_port=2,dl_src=00:66:77:88:99:aa actions=drop
1286 idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=drop
1287 idle_timeout=70, in_port=2,dl_src=00:88:99:aa:bb:cc actions=drop
1288 in_port=2,dl_src=00:55:66:77:88:99 actions=drop
1289 OFPST_FLOW reply (OF1.2):
1291 # Adding another flow will cause the one that expires soonest overall
1293 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'])
1294 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1295 idle_timeout=30, in_port=1,dl_src=00:22:33:44:55:66 actions=drop
1296 idle_timeout=40, in_port=1,dl_src=00:33:44:55:66:77 actions=drop
1297 idle_timeout=50, in_port=2,dl_src=00:66:77:88:99:aa actions=drop
1298 idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=drop
1299 idle_timeout=70, in_port=2,dl_src=00:88:99:aa:bb:cc actions=drop
1300 idle_timeout=80, in_port=2,dl_src=00:99:aa:bb:cc:dd actions=drop
1301 in_port=2,dl_src=00:55:66:77:88:99 actions=drop
1302 OFPST_FLOW reply (OF1.2):
1304 # Reducing the flow limit also causes the flows that expire soonest
1305 # overall to be evicted.
1306 AT_CHECK([ovs-vsctl set Flow_Table evict flow-limit=4])
1307 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1308 idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=drop
1309 idle_timeout=70, in_port=2,dl_src=00:88:99:aa:bb:cc actions=drop
1310 idle_timeout=80, in_port=2,dl_src=00:99:aa:bb:cc:dd actions=drop
1311 in_port=2,dl_src=00:55:66:77:88:99 actions=drop
1312 OFPST_FLOW reply (OF1.2):
1317 AT_SETUP([ofproto - asynchronous message control (OpenFlow 1.0)])
1319 AT_CHECK([ovs-ofctl -P openflow10 monitor br0 --detach --no-chdir --pidfile])
1321 printf '\n\n--- check_async %d ---\n\n\n' $1
1324 ovs-appctl -t ovs-ofctl ofctl/barrier
1325 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
1328 # OFPT_PACKET_IN, OFPR_ACTION (controller_id=0)
1329 ovs-ofctl -v packet-out br0 controller controller '0001020304050010203040501234'
1330 if test X"$1" = X"OFPR_ACTION"; then shift;
1331 echo >>expout "OFPT_PACKET_IN: total_len=14 in_port=CONTROLLER (via action) data_len=14 (unbuffered)
1332 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"
1335 # OFPT_PACKET_IN, OFPR_NO_MATCH (controller_id=123)
1336 ovs-ofctl -v packet-out br0 controller 'controller(reason=no_match,id=123)' '0001020304050010203040501234'
1337 if test X"$1" = X"OFPR_NO_MATCH"; then shift;
1338 echo >>expout "OFPT_PACKET_IN: total_len=14 in_port=CONTROLLER (via no_match) data_len=14 (unbuffered)
1339 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"
1342 # OFPT_PACKET_IN, OFPR_INVALID_TTL (controller_id=0)
1343 ovs-ofctl packet-out br0 controller dec_ttl '002583dfb4000026b98cb0f908004500003fb7e200000011339bac11370dac100002d7730035002b8f6d86fb0100000100000000000006626c702d7873066e696369726103636f6d00000f00'
1344 if test X"$1" = X"OFPR_INVALID_TTL"; then shift;
1345 echo >>expout "OFPT_PACKET_IN: total_len=76 in_port=CONTROLLER (via invalid_ttl) data_len=76 (unbuffered)
1346 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"
1349 # OFPT_PORT_STATUS, OFPPR_ADD
1350 ovs-vsctl add-port br0 test -- set Interface test type=dummy ofport_request=1
1351 if test X"$1" = X"OFPPR_ADD"; then shift;
1352 echo >>expout "OFPT_PORT_STATUS: ADD: 1(test): addr:aa:55:aa:55:00:0x
1355 speed: 0 Mbps now, 0 Mbps max"
1358 # OFPT_PORT_STATUS, OFPPR_DELETE
1359 ovs-vsctl del-port br0 test
1360 if test X"$1" = X"OFPPR_DELETE"; then shift;
1361 echo >>expout "OFPT_PORT_STATUS: DEL: 1(test): addr:aa:55:aa:55:00:0x
1364 speed: 0 Mbps now, 0 Mbps max"
1367 # OFPT_FLOW_REMOVED, OFPRR_DELETE
1368 ovs-ofctl add-flow br0 send_flow_rem,actions=drop
1369 ovs-ofctl --strict del-flows br0 ''
1370 if test X"$1" = X"OFPRR_DELETE"; then shift;
1371 echo >>expout "OFPT_FLOW_REMOVED: reason=delete"
1373 AT_FAIL_IF([test X"$1" != X])
1375 ovs-appctl -t ovs-ofctl ofctl/barrier
1376 echo >>expout "OFPT_BARRIER_REPLY:"
1380 s/ (xid=0x[0-9a-fA-F]*)//
1382 s/00:0.$/00:0x/' < monitor.log]],
1386 # It's a service connection so initially there should be no async messages.
1389 # Set miss_send_len to 128, turning on packet-ins for our service connection.
1390 ovs-appctl -t ovs-ofctl ofctl/send 0109000c0123456700000080
1391 check_async 2 OFPR_ACTION OFPPR_ADD OFPPR_DELETE OFPRR_DELETE
1393 # Set miss_send_len to 128 and enable invalid_ttl.
1394 ovs-appctl -t ovs-ofctl ofctl/send 0109000c0123456700040080
1395 check_async 3 OFPR_ACTION OFPR_INVALID_TTL OFPPR_ADD OFPPR_DELETE OFPRR_DELETE
1397 # Become slave, which should disable everything except port status.
1398 ovs-appctl -t ovs-ofctl ofctl/send 0104001400000002000023200000000a00000002
1399 check_async 4 OFPPR_ADD OFPPR_DELETE
1401 # Use NXT_SET_ASYNC_CONFIG to enable a patchwork of asynchronous messages.
1402 ovs-appctl -t ovs-ofctl ofctl/send 01040028000000020000232000000013000000020000000500000005000000020000000200000005
1403 check_async 5 OFPR_INVALID_TTL OFPPR_DELETE OFPRR_DELETE
1405 # Set controller ID 123.
1406 ovs-appctl -t ovs-ofctl ofctl/send 01040018000000030000232000000014000000000000007b
1407 check_async 6 OFPR_NO_MATCH OFPPR_DELETE OFPRR_DELETE
1409 # Restore controller ID 0.
1410 ovs-appctl -t ovs-ofctl ofctl/send 010400180000000300002320000000140000000000000000
1413 ovs-appctl -t ovs-ofctl ofctl/send 0104001400000002000023200000000a00000001
1414 check_async 7 OFPR_ACTION OFPPR_ADD
1416 ovs-appctl -t ovs-ofctl exit
1420 AT_SETUP([ofproto - asynchronous message control (OpenFlow 1.2)])
1422 AT_CHECK([ovs-ofctl -O OpenFlow12 monitor br0 --detach --no-chdir --pidfile])
1424 printf '\n\n--- check_async %d ---\n\n\n' $1
1428 ovs-appctl -t ovs-ofctl ofctl/barrier
1429 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
1432 # OFPT_PACKET_IN, OFPR_ACTION (controller_id=0)
1433 ovs-ofctl -O OpenFlow12 -v packet-out br0 none controller '0001020304050010203040501234'
1434 if test X"$1" = X"OFPR_ACTION"; then shift;
1435 echo >>expout "OFPT_PACKET_IN (OF1.2): total_len=14 in_port=ANY (via action) data_len=14 (unbuffered)
1436 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"
1439 # OFPT_PACKET_IN, OFPR_NO_MATCH (controller_id=123)
1440 ovs-ofctl -O OpenFlow12 -v packet-out br0 none 'controller(reason=no_match,id=123)' '0001020304050010203040501234'
1441 if test X"$1" = X"OFPR_NO_MATCH"; then shift;
1442 echo >>expout "OFPT_PACKET_IN (OF1.2): total_len=14 in_port=ANY (via no_match) data_len=14 (unbuffered)
1443 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"
1446 # OFPT_PACKET_IN, OFPR_INVALID_TTL (controller_id=0)
1447 ovs-ofctl -O OpenFlow12 packet-out br0 none dec_ttl '002583dfb4000026b98cb0f908004500003fb7e200000011339bac11370dac100002d7730035002b8f6d86fb0100000100000000000006626c702d7873066e696369726103636f6d00000f00'
1448 if test X"$1" = X"OFPR_INVALID_TTL"; then shift;
1449 echo >>expout "OFPT_PACKET_IN (OF1.2): total_len=76 in_port=ANY (via invalid_ttl) data_len=76 (unbuffered)
1450 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"
1453 # OFPT_PORT_STATUS, OFPPR_ADD
1454 ovs-vsctl add-port br0 test -- set Interface test type=dummy
1455 if test X"$1" = X"OFPPR_ADD"; then shift;
1456 echo >>expout "OFPT_PORT_STATUS (OF1.2): ADD: ${INDEX}(test): addr:aa:55:aa:55:00:0x
1459 speed: 0 Mbps now, 0 Mbps max"
1462 # OFPT_PORT_STATUS, OFPPR_DELETE
1463 ovs-vsctl del-port br0 test
1464 if test X"$1" = X"OFPPR_DELETE"; then shift;
1465 echo >>expout "OFPT_PORT_STATUS (OF1.2): DEL: ${INDEX}(test): addr:aa:55:aa:55:00:0x
1468 speed: 0 Mbps now, 0 Mbps max"
1471 # OFPT_FLOW_REMOVED, OFPRR_DELETE
1472 ovs-ofctl -O OpenFlow12 add-flow br0 send_flow_rem,actions=drop
1473 ovs-ofctl -O OpenFlow12 --strict del-flows br0 ''
1474 if test X"$1" = X"OFPRR_DELETE"; then shift;
1475 echo >>expout "OFPT_FLOW_REMOVED (OF1.2): reason=delete table_id=0"
1477 AT_FAIL_IF([test X"$1" != X])
1479 ovs-appctl -t ovs-ofctl ofctl/barrier
1480 echo >>expout "OFPT_BARRIER_REPLY (OF1.2):"
1484 s/ (xid=0x[0-9a-fA-F]*)//
1486 s/00:0.$/00:0x/' < monitor.log]],
1490 # It's a service connection so initially there should be no async messages.
1493 # Set miss_send_len to 128, turning on packet-ins for our service connection.
1494 ovs-appctl -t ovs-ofctl ofctl/send 0309000c0123456700000080
1495 check_async 2 OFPR_ACTION OFPPR_ADD OFPPR_DELETE OFPRR_DELETE
1497 # Set miss_send_len to 128 and enable invalid_ttl.
1498 ovs-appctl -t ovs-ofctl ofctl/send 0309000c0123456700040080
1499 check_async 3 OFPR_ACTION OFPR_INVALID_TTL OFPPR_ADD OFPPR_DELETE OFPRR_DELETE
1501 # Become slave (OF 1.2), which should disable everything except port status.
1502 ovs-appctl -t ovs-ofctl ofctl/send 031800180000000200000003000000000000000000000001
1503 check_async 4 OFPPR_ADD OFPPR_DELETE
1505 # Use NXT_SET_ASYNC_CONFIG to enable a patchwork of asynchronous messages.
1506 ovs-appctl -t ovs-ofctl ofctl/send 03040028000000020000232000000013000000020000000500000005000000020000000200000005
1507 check_async 5 OFPR_INVALID_TTL OFPPR_DELETE OFPRR_DELETE
1509 # Set controller ID 123.
1510 ovs-appctl -t ovs-ofctl ofctl/send 03040018000000030000232000000014000000000000007b
1511 check_async 6 OFPR_NO_MATCH OFPPR_DELETE OFPRR_DELETE
1513 # Restore controller ID 0.
1514 ovs-appctl -t ovs-ofctl ofctl/send 030400180000000300002320000000140000000000000000
1516 # Become master (OF 1.2).
1517 ovs-appctl -t ovs-ofctl ofctl/send 031800180000000400000002000000000000000000000002
1518 check_async 7 OFPR_ACTION OFPPR_ADD
1520 ovs-appctl -t ovs-ofctl exit
1524 AT_SETUP([ofproto - asynchronous message control (OpenFlow 1.3)])
1526 AT_CHECK([ovs-ofctl -O OpenFlow13 monitor br0 --detach --no-chdir --pidfile])
1528 printf '\n\n--- check_async %d ---\n\n\n' $1
1532 ovs-appctl -t ovs-ofctl ofctl/barrier
1533 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
1536 # OFPT_PACKET_IN, OFPR_ACTION (controller_id=0)
1537 ovs-ofctl -O OpenFlow13 -v packet-out br0 none controller '0001020304050010203040501234'
1538 if test X"$1" = X"OFPR_ACTION"; then shift;
1539 echo >>expout "OFPT_PACKET_IN (OF1.3): total_len=14 in_port=ANY (via action) data_len=14 (unbuffered)
1540 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"
1543 # OFPT_PACKET_IN, OFPR_NO_MATCH (controller_id=123)
1544 ovs-ofctl -O OpenFlow13 -v packet-out br0 none 'controller(reason=no_match,id=123)' '0001020304050010203040501234'
1545 if test X"$1" = X"OFPR_NO_MATCH"; then shift;
1546 echo >>expout "OFPT_PACKET_IN (OF1.3): total_len=14 in_port=ANY (via no_match) data_len=14 (unbuffered)
1547 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"
1550 # OFPT_PACKET_IN, OFPR_INVALID_TTL (controller_id=0)
1551 ovs-ofctl -O OpenFlow13 packet-out br0 none dec_ttl '002583dfb4000026b98cb0f908004500003fb7e200000011339bac11370dac100002d7730035002b8f6d86fb0100000100000000000006626c702d7873066e696369726103636f6d00000f00'
1552 if test X"$1" = X"OFPR_INVALID_TTL"; then shift;
1553 echo >>expout "OFPT_PACKET_IN (OF1.3): total_len=76 in_port=ANY (via invalid_ttl) data_len=76 (unbuffered)
1554 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"
1557 # OFPT_PORT_STATUS, OFPPR_ADD
1558 ovs-vsctl add-port br0 test -- set Interface test type=dummy
1559 if test X"$1" = X"OFPPR_ADD"; then shift;
1560 echo >>expout "OFPT_PORT_STATUS (OF1.3): ADD: ${INDEX}(test): addr:aa:55:aa:55:00:0x
1563 speed: 0 Mbps now, 0 Mbps max"
1566 # OFPT_PORT_STATUS, OFPPR_DELETE
1567 ovs-vsctl del-port br0 test
1568 if test X"$1" = X"OFPPR_DELETE"; then shift;
1569 echo >>expout "OFPT_PORT_STATUS (OF1.3): DEL: ${INDEX}(test): addr:aa:55:aa:55:00:0x
1572 speed: 0 Mbps now, 0 Mbps max"
1575 # OFPT_FLOW_REMOVED, OFPRR_DELETE
1576 ovs-ofctl -O OpenFlow13 add-flow br0 send_flow_rem,actions=drop
1577 ovs-ofctl -O OpenFlow13 --strict del-flows br0 ''
1578 if test X"$1" = X"OFPRR_DELETE"; then shift;
1579 echo >>expout "OFPT_FLOW_REMOVED (OF1.3): reason=delete table_id=0"
1581 AT_FAIL_IF([test X"$1" != X])
1583 ovs-appctl -t ovs-ofctl ofctl/barrier
1584 echo >>expout "OFPT_BARRIER_REPLY (OF1.3):"
1588 s/ (xid=0x[0-9a-fA-F]*)//
1590 s/00:0.$/00:0x/' < monitor.log]],
1594 # It's a service connection so initially there should be no async messages.
1597 # Set miss_send_len to 128, turning on packet-ins for our service connection.
1598 ovs-appctl -t ovs-ofctl ofctl/send 0409000c0123456700000080
1599 check_async 2 OFPR_ACTION OFPPR_ADD OFPPR_DELETE OFPRR_DELETE
1601 # Become slave (OF 1.3), which should disable everything except port status.
1602 ovs-appctl -t ovs-ofctl ofctl/send 041800180000000200000003000000000000000000000001
1603 check_async 3 OFPPR_ADD OFPPR_DELETE
1605 # Use OF 1.3 OFPT_SET_ASYNC to enable a patchwork of asynchronous messages.
1606 ovs-appctl -t ovs-ofctl ofctl/send 041c002000000002000000020000000500000005000000020000000200000005
1607 check_async 4 OFPR_INVALID_TTL OFPPR_DELETE OFPRR_DELETE
1609 # Set controller ID 123.
1610 ovs-appctl -t ovs-ofctl ofctl/send 04040018000000030000232000000014000000000000007b
1611 check_async 5 OFPR_NO_MATCH OFPPR_DELETE OFPRR_DELETE
1613 # Restore controller ID 0.
1614 ovs-appctl -t ovs-ofctl ofctl/send 040400180000000300002320000000140000000000000000
1616 # Become master (OF 1.3).
1617 ovs-appctl -t ovs-ofctl ofctl/send 041800180000000400000002000000000000000000000002
1618 check_async 6 OFPR_ACTION OFPPR_ADD
1620 ovs-appctl -t ovs-ofctl exit
1624 dnl This test checks that the role request/response messaging works
1625 dnl and that generation_id is handled properly.
1626 AT_SETUP([ofproto - controller role (OpenFlow 1.2)])
1628 AT_CHECK([ovs-ofctl -O OpenFlow12 monitor br0 --detach --no-chdir --pidfile])
1630 ovs-appctl -t ovs-ofctl ofctl/barrier
1631 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
1634 # find out current role
1635 ovs-appctl -t ovs-ofctl ofctl/send 031800180000000200000000000000000000000000000000
1636 echo >>expout "send: OFPT_ROLE_REQUEST (OF1.2) (xid=0x2): role=nochange"
1637 echo >>expout "OFPT_ROLE_REPLY (OF1.2) (xid=0x2): role=equal"
1639 # Become slave (generation_id is initially undefined, so 2^63+2 should not be stale)
1640 ovs-appctl -t ovs-ofctl ofctl/send 031800180000000300000003000000008000000000000002
1641 echo >>expout "send: OFPT_ROLE_REQUEST (OF1.2) (xid=0x3): role=slave generation_id=9223372036854775810"
1642 echo >>expout "OFPT_ROLE_REPLY (OF1.2) (xid=0x3): role=slave generation_id=9223372036854775810"
1644 # Try to become the master using a stale generation ID
1645 ovs-appctl -t ovs-ofctl ofctl/send 031800180000000400000002000000000000000000000002
1646 echo >>expout "send: OFPT_ROLE_REQUEST (OF1.2) (xid=0x4): role=master generation_id=2"
1647 echo >>expout "OFPT_ERROR (OF1.2) (xid=0x4): OFPRRFC_STALE"
1648 echo >>expout "OFPT_ROLE_REQUEST (OF1.2) (xid=0x4): role=master generation_id=2"
1650 # Become master using a valid generation ID
1651 ovs-appctl -t ovs-ofctl ofctl/send 031800180000000500000002000000000000000000000001
1652 echo >>expout "send: OFPT_ROLE_REQUEST (OF1.2) (xid=0x5): role=master generation_id=1"
1653 echo >>expout "OFPT_ROLE_REPLY (OF1.2) (xid=0x5): role=master generation_id=1"
1654 ovs-appctl -t ovs-ofctl ofctl/barrier
1655 echo >>expout "OFPT_BARRIER_REPLY (OF1.2) (xid=0x3):"
1657 AT_CHECK([cat monitor.log], [0], [expout])
1659 ovs-appctl -t ovs-ofctl exit
1663 dnl This test checks that OFPT_PACKET_OUT accepts both OFPP_NONE (as
1664 dnl specified by OpenFlow 1.0) and OFPP_CONTROLLER (used by some
1665 dnl controllers despite the spec) as meaning a packet that was generated
1666 dnl by the controller.
1667 AT_SETUP([ofproto - packet-out from controller (OpenFlow 1.0)])
1669 ADD_OF_PORTS([br0], [1])
1671 # Start a monitor listening for packet-ins.
1672 AT_CHECK([ovs-ofctl -P openflow10 monitor br0 --detach --no-chdir --pidfile])
1673 ovs-appctl -t ovs-ofctl ofctl/send 0109000c0123456700000080
1674 ovs-appctl -t ovs-ofctl ofctl/barrier
1675 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
1676 AT_CAPTURE_FILE([monitor.log])
1678 # Send some packet-outs with OFPP_NONE and OFPP_CONTROLLER (65533) as in_port.
1679 AT_CHECK([ovs-ofctl packet-out br0 none controller,1 '0001020304050010203040501234'])
1680 AT_CHECK([ovs-ofctl packet-out br0 controller controller,1 '0001020304050010203040505678'])
1682 # Stop the monitor and check its output.
1683 ovs-appctl -t ovs-ofctl ofctl/barrier
1684 ovs-appctl -t ovs-ofctl exit
1686 ovs-ofctl dump-ports br0
1688 AT_CHECK([sed 's/ (xid=0x[[0-9a-fA-F]]*)//' monitor.log], [0], [dnl
1689 OFPT_PACKET_IN: total_len=14 in_port=ANY (via action) data_len=14 (unbuffered)
1690 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
1691 OFPT_PACKET_IN: total_len=14 in_port=CONTROLLER (via action) data_len=14 (unbuffered)
1692 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
1699 dnl This test checks that OFPT_PACKET_OUT accepts both OFPP_NONE (as
1700 dnl specified by OpenFlow 1.2) and OFPP_CONTROLLER (used by some
1701 dnl controllers despite the spec) as meaning a packet that was generated
1702 dnl by the controller.
1703 AT_SETUP([ofproto - packet-out from controller (OpenFlow 1.2)])
1706 # Start a monitor listening for packet-ins.
1707 AT_CHECK([ovs-ofctl -O OpenFlow12 monitor br0 --detach --no-chdir --pidfile])
1708 ovs-appctl -t ovs-ofctl ofctl/send 0309000c0123456700000080
1709 ovs-appctl -t ovs-ofctl ofctl/barrier
1710 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
1711 AT_CAPTURE_FILE([monitor.log])
1713 # Send some packet-outs with OFPP_NONE and OFPP_CONTROLLER (65533) as in_port.
1714 AT_CHECK([ovs-ofctl -O OpenFlow12 packet-out br0 none controller '0001020304050010203040501234'])
1715 AT_CHECK([ovs-ofctl -O OpenFlow12 packet-out br0 4294967293 controller '0001020304050010203040505678'])
1717 # Stop the monitor and check its output.
1718 ovs-appctl -t ovs-ofctl ofctl/barrier
1719 ovs-appctl -t ovs-ofctl exit
1721 AT_CHECK([sed 's/ (xid=0x[[0-9a-fA-F]]*)//' monitor.log], [0], [dnl
1722 OFPT_PACKET_IN (OF1.2): total_len=14 in_port=ANY (via action) data_len=14 (unbuffered)
1723 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
1724 OFPT_PACKET_IN (OF1.2): total_len=14 in_port=CONTROLLER (via action) data_len=14 (unbuffered)
1725 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
1726 OFPT_BARRIER_REPLY (OF1.2):
1732 dnl This test checks that metadata is encoded in packet_in structures,
1733 dnl supported by NXAST.
1734 AT_SETUP([ofproto - packet-out with metadata (NXM)])
1737 # Start a monitor listening for packet-ins.
1738 AT_CHECK([ovs-ofctl -P nxm monitor br0 --detach --no-chdir --pidfile])
1739 ovs-appctl -t ovs-ofctl ofctl/send 0109000c0123456700000080
1740 ovs-appctl -t ovs-ofctl ofctl/barrier
1741 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
1742 AT_CAPTURE_FILE([monitor.log])
1744 # Send a packet-out with a load action to set some metadata, and forward to controller
1745 AT_CHECK([ovs-ofctl packet-out br0 controller 'load(0xfafafafa5a5a5a5a->OXM_OF_METADATA[[0..63]]), load(0xaa->NXM_NX_PKT_MARK[[]]), controller' '0001020304050010203040501234'])
1747 # Stop the monitor and check its output.
1748 ovs-appctl -t ovs-ofctl ofctl/barrier
1749 ovs-appctl -t ovs-ofctl exit
1751 AT_CHECK([sed 's/ (xid=0x[[0-9a-fA-F]]*)//' monitor.log], [0], [dnl
1752 NXT_PACKET_IN: total_len=14 in_port=CONTROLLER metadata=0xfafafafa5a5a5a5a pkt_mark=0xaa (via action) data_len=14 (unbuffered)
1753 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
1760 dnl This test checks that metadata is encoded in packet_in structures,
1761 dnl supported by NXAST.
1762 AT_SETUP([ofproto - packet-out with metadata (OpenFlow 1.2)])
1765 # Start a monitor listening for packet-ins.
1766 AT_CHECK([ovs-ofctl -O OpenFlow12 monitor br0 --detach --no-chdir --pidfile])
1767 ovs-appctl -t ovs-ofctl ofctl/send 0309000c0123456700000080
1768 ovs-appctl -t ovs-ofctl ofctl/barrier
1769 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
1770 AT_CAPTURE_FILE([monitor.log])
1772 # Send a packet-out with a load action to set some metadata, and forward to controller
1773 AT_CHECK([ovs-ofctl -O OpenFlow12 packet-out br0 none 'load(0xfafafafa5a5a5a5a->OXM_OF_METADATA[[0..63]]), controller' '0001020304050010203040501234'])
1775 # Stop the monitor and check its output.
1776 ovs-appctl -t ovs-ofctl ofctl/barrier
1777 ovs-appctl -t ovs-ofctl exit
1779 AT_CHECK([sed 's/ (xid=0x[[0-9a-fA-F]]*)//' monitor.log], [0], [dnl
1780 OFPT_PACKET_IN (OF1.2): total_len=14 in_port=ANY metadata=0xfafafafa5a5a5a5a (via action) data_len=14 (unbuffered)
1781 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
1782 OFPT_BARRIER_REPLY (OF1.2):
1788 dnl This test checks that tunnel metadata is encoded in packet_in structures.
1789 AT_SETUP([ofproto - packet-out with tunnel metadata (OpenFlow 1.2)])
1792 # Start a monitor listening for packet-ins.
1793 AT_CHECK([ovs-ofctl -O OpenFlow12 monitor br0 --detach --no-chdir --pidfile])
1794 ovs-appctl -t ovs-ofctl ofctl/send 0309000c0123456700000080
1795 ovs-appctl -t ovs-ofctl ofctl/barrier
1796 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
1797 AT_CAPTURE_FILE([monitor.log])
1799 # Send a packet-out with set field actions to set some tunnel metadata, and forward to controller
1800 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'])
1802 # Stop the monitor and check its output.
1803 ovs-appctl -t ovs-ofctl ofctl/barrier
1804 ovs-appctl -t ovs-ofctl exit
1806 AT_CHECK([sed 's/ (xid=0x[[0-9a-fA-F]]*)//' monitor.log], [0], [dnl
1807 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)
1808 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
1809 OFPT_BARRIER_REPLY (OF1.2):
1815 AT_SETUP([ofproto - flow monitoring])
1816 AT_KEYWORDS([monitor])
1819 ovs-ofctl add-flow br0 in_port=0,dl_vlan=123,actions=output:1
1821 # Start a monitor watching the flow table and check the initial reply.
1822 ovs-ofctl monitor br0 watch: --detach --no-chdir --pidfile >monitor.log 2>&1
1823 AT_CAPTURE_FILE([monitor.log])
1824 ovs-appctl -t ovs-ofctl ofctl/barrier
1825 AT_CHECK([sed 's/ (xid=0x[[1-9a-fA-F]][[0-9a-fA-F]]*)//' monitor.log], [0],
1826 [NXST_FLOW_MONITOR reply:
1827 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=123 actions=output:1
1831 # Add, delete, and modify some flows and check the updates.
1832 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
1833 ovs-ofctl add-flow br0 in_port=0,dl_vlan=124,actions=output:2
1834 ovs-ofctl add-flow br0 in_port=0,dl_vlan=123,actions=output:5
1835 ovs-ofctl add-flow br0 in_port=0,dl_vlan=123,dl_vlan_pcp=0,actions=output:6
1836 ovs-ofctl add-flow br0 in_port=0,dl_vlan=123,dl_vlan_pcp=1,actions=output:7
1837 ovs-ofctl add-flow br0 in_port=0,dl_vlan=123,actions=output:8
1838 ovs-ofctl add-flow br0 in_port=0,dl_vlan=65535,dl_vlan_pcp=0,actions=output:9
1839 ovs-ofctl add-flow br0 in_port=0,dl_vlan=65535,dl_vlan_pcp=1,actions=output:10
1840 ovs-ofctl add-flow br0 in_port=0,dl_vlan=65535,actions=output:11
1841 ovs-ofctl add-flow br0 in_port=0,dl_vlan=8191,dl_vlan_pcp=0,actions=output:12
1842 ovs-ofctl add-flow br0 in_port=0,dl_vlan=8191,dl_vlan_pcp=1,actions=output:13
1843 ovs-ofctl add-flow br0 in_port=0,dl_vlan=8191,actions=output:14
1844 ovs-ofctl add-flow br0 in_port=0,dl_vlan=0,dl_vlan_pcp=0,actions=output:15
1845 ovs-ofctl add-flow br0 in_port=0,dl_vlan=0,dl_vlan_pcp=1,actions=output:16
1846 ovs-ofctl add-flow br0 in_port=0,dl_vlan=0,actions=output:17
1847 ovs-ofctl add-flow br0 in_port=0,dl_vlan=0,dl_vlan_pcp=0,actions=output:18
1848 ovs-ofctl add-flow br0 in_port=0,dl_vlan=0,dl_vlan_pcp=1,actions=output:19
1849 ovs-ofctl add-flow br0 in_port=0,dl_vlan=0,actions=output:20
1850 ovs-ofctl add-flow br0 in_port=0,dl_vlan_pcp=0,actions=output:21
1851 ovs-ofctl add-flow br0 in_port=0,dl_vlan_pcp=1,actions=output:22
1852 ovs-ofctl add-flow br0 in_port=0,actions=output:23
1853 ovs-ofctl mod-flows br0 cookie=5,dl_vlan=123,actions=output:3
1854 ovs-ofctl del-flows br0 dl_vlan=123
1855 ovs-ofctl del-flows br0
1856 ovs-appctl -t ovs-ofctl ofctl/barrier
1858 # Sorts groups of lines that start with a space, without moving them
1859 # past the nearest line that does not start with a space.
1867 print $_ foreach sort(@buffer);
1872 print $_ foreach sort(@buffer);
1874 AT_CHECK([sed 's/ (xid=0x[[1-9a-fA-F]][[0-9a-fA-F]]*)//' monitor.log | ${PERL} -e "$sort"], [0],
1875 [NXST_FLOW_MONITOR reply (xid=0x0):
1876 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=124 actions=output:2
1877 NXST_FLOW_MONITOR reply (xid=0x0):
1878 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=123 actions=output:5
1879 NXST_FLOW_MONITOR reply (xid=0x0):
1880 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=123,dl_vlan_pcp=0 actions=output:6
1881 NXST_FLOW_MONITOR reply (xid=0x0):
1882 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=123,dl_vlan_pcp=1 actions=output:7
1883 NXST_FLOW_MONITOR reply (xid=0x0):
1884 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=123 actions=output:8
1885 NXST_FLOW_MONITOR reply (xid=0x0):
1886 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=0,dl_vlan_pcp=0 actions=output:9
1887 NXST_FLOW_MONITOR reply (xid=0x0):
1888 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=0,dl_vlan_pcp=1 actions=output:10
1889 NXST_FLOW_MONITOR reply (xid=0x0):
1890 event=ADDED table=0 cookie=0 in_port=0,vlan_tci=0x0000 actions=output:11
1891 NXST_FLOW_MONITOR reply (xid=0x0):
1892 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=4095,dl_vlan_pcp=0 actions=output:12
1893 NXST_FLOW_MONITOR reply (xid=0x0):
1894 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=4095,dl_vlan_pcp=1 actions=output:13
1895 NXST_FLOW_MONITOR reply (xid=0x0):
1896 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=4095 actions=output:14
1897 NXST_FLOW_MONITOR reply (xid=0x0):
1898 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=0,dl_vlan_pcp=0 actions=output:15
1899 NXST_FLOW_MONITOR reply (xid=0x0):
1900 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=0,dl_vlan_pcp=1 actions=output:16
1901 NXST_FLOW_MONITOR reply (xid=0x0):
1902 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=0 actions=output:17
1903 NXST_FLOW_MONITOR reply (xid=0x0):
1904 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=0,dl_vlan_pcp=0 actions=output:18
1905 NXST_FLOW_MONITOR reply (xid=0x0):
1906 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=0,dl_vlan_pcp=1 actions=output:19
1907 NXST_FLOW_MONITOR reply (xid=0x0):
1908 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=0 actions=output:20
1909 NXST_FLOW_MONITOR reply (xid=0x0):
1910 event=ADDED table=0 cookie=0 in_port=0,dl_vlan_pcp=0 actions=output:21
1911 NXST_FLOW_MONITOR reply (xid=0x0):
1912 event=ADDED table=0 cookie=0 in_port=0,dl_vlan_pcp=1 actions=output:22
1913 NXST_FLOW_MONITOR reply (xid=0x0):
1914 event=ADDED table=0 cookie=0 in_port=0 actions=output:23
1915 NXST_FLOW_MONITOR reply (xid=0x0):
1916 event=MODIFIED table=0 cookie=0x5 in_port=0,dl_vlan=123 actions=output:3
1917 event=MODIFIED table=0 cookie=0x5 in_port=0,dl_vlan=123,dl_vlan_pcp=0 actions=output:3
1918 event=MODIFIED table=0 cookie=0x5 in_port=0,dl_vlan=123,dl_vlan_pcp=1 actions=output:3
1919 NXST_FLOW_MONITOR reply (xid=0x0):
1920 event=DELETED reason=delete table=0 cookie=0x5 in_port=0,dl_vlan=123 actions=output:3
1921 event=DELETED reason=delete table=0 cookie=0x5 in_port=0,dl_vlan=123,dl_vlan_pcp=0 actions=output:3
1922 event=DELETED reason=delete table=0 cookie=0x5 in_port=0,dl_vlan=123,dl_vlan_pcp=1 actions=output:3
1923 NXST_FLOW_MONITOR reply (xid=0x0):
1924 event=DELETED reason=delete table=0 cookie=0 in_port=0 actions=output:23
1925 event=DELETED reason=delete table=0 cookie=0 in_port=0,dl_vlan=0 actions=output:20
1926 event=DELETED reason=delete table=0 cookie=0 in_port=0,dl_vlan=0,dl_vlan_pcp=0 actions=output:18
1927 event=DELETED reason=delete table=0 cookie=0 in_port=0,dl_vlan=0,dl_vlan_pcp=1 actions=output:19
1928 event=DELETED reason=delete table=0 cookie=0 in_port=0,dl_vlan=124 actions=output:2
1929 event=DELETED reason=delete table=0 cookie=0 in_port=0,dl_vlan=4095 actions=output:14
1930 event=DELETED reason=delete table=0 cookie=0 in_port=0,dl_vlan=4095,dl_vlan_pcp=0 actions=output:12
1931 event=DELETED reason=delete table=0 cookie=0 in_port=0,dl_vlan=4095,dl_vlan_pcp=1 actions=output:13
1932 event=DELETED reason=delete table=0 cookie=0 in_port=0,dl_vlan_pcp=0 actions=output:21
1933 event=DELETED reason=delete table=0 cookie=0 in_port=0,dl_vlan_pcp=1 actions=output:22
1934 event=DELETED reason=delete table=0 cookie=0 in_port=0,vlan_tci=0x0000 actions=output:11
1938 # Check that our own changes are reported as abbreviations.
1939 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
1940 ovs-ofctl add-flow br0 in_port=1,actions=output:2
1941 ovs-ofctl add-flow br0 in_port=2,actions=output:1
1942 ovs-appctl -t ovs-ofctl ofctl/barrier
1943 ovs-appctl -t ovs-ofctl ofctl/send 010e004812345678003fffff00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003000000000000ffffffffffff0000
1944 ovs-appctl -t ovs-ofctl ofctl/barrier
1945 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip], [0], [NXST_FLOW reply:
1947 AT_CHECK([sed 's/ (xid=0x[[1-9a-fA-F]][[0-9a-fA-F]]*)//' monitor.log], [0],
1948 [NXST_FLOW_MONITOR reply (xid=0x0):
1949 event=ADDED table=0 cookie=0 in_port=1 actions=output:2
1950 NXST_FLOW_MONITOR reply (xid=0x0):
1951 event=ADDED table=0 cookie=0 in_port=2 actions=output:1
1953 send: OFPT_FLOW_MOD: DEL priority=0 actions=drop
1954 NXST_FLOW_MONITOR reply (xid=0x0):
1955 event=ABBREV xid=0x12345678
1959 ovs-appctl -t ovs-ofctl exit
1963 AT_SETUP([ofproto - flow monitoring pause and resume])
1964 AT_KEYWORDS([monitor])
1966 # The maximum socket receive buffer size is important for this test, which
1967 # tests behavior when the receive buffer overflows.
1968 if test -e /proc/sys/net/core/rmem_max; then
1970 rmem_max=`cat /proc/sys/net/core/rmem_max`
1971 elif rmem_max=`sysctl -n net.inet.tcp.recvbuf_max 2>/dev/null`; then
1974 # Don't know how to get maximum socket receive buffer on this OS
1977 # Calculate the total amount of queuing: rmem_max in the kernel, 128 kB
1978 # in ofproto sending userspace (see ofmonitor_flush() in connmgr.c).
1979 queue_size=`expr $rmem_max + 128 \* 1024`
1980 echo rmem_max=$rmem_max queue_size=$queue_size
1982 # Each flow update message takes up at least 48 bytes of space in queues
1983 # and in practice more than that.
1984 n_msgs=`expr $queue_size / 48`
1989 # Start a monitor watching the flow table, then make it block.
1990 ON_EXIT([kill `cat ovs-ofctl.pid`])
1991 ovs-ofctl monitor br0 watch: --detach --no-chdir --pidfile >monitor.log 2>&1
1992 AT_CAPTURE_FILE([monitor.log])
1993 ovs-appctl -t ovs-ofctl ofctl/block
1995 # Add $n_msgs flows.
1996 (echo "in_port=2,actions=output:2"
1998 for ($i = 0; $i < '$n_msgs'; $i++) {
1999 print "cookie=1,reg1=$i,actions=drop\n";
2002 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
2003 # Check that multipart flow dumps work properly:
2004 AT_CHECK([ovs-ofctl diff-flows br0 flows.txt])
2005 AT_CHECK([ovs-ofctl add-flow br0 in_port=1,cookie=3,actions=drop])
2006 AT_CHECK([ovs-ofctl mod-flows br0 in_port=2,cookie=2,actions=output:2])
2007 AT_CHECK([ovs-ofctl del-flows br0 cookie=1/-1])
2009 ovs-appctl -t ovs-ofctl ofctl/unblock
2010 ovs-appctl -t ovs-ofctl ofctl/barrier
2012 ovs-appctl -t ovs-ofctl exit
2014 # Check that the flow monitor reported the same number of flows
2015 # added and deleted, but fewer than we actually added and deleted.
2016 adds=`grep -c 'ADDED.*reg1=' monitor.log`
2017 deletes=`grep -c 'DELETED.*reg1=' monitor.log`
2018 echo adds=$adds deletes=$deletes
2019 AT_CHECK([test $adds -gt 100 && test $adds -lt $n_msgs])
2020 AT_CHECK([test $adds = $deletes])
2022 # Check that the flow monitor reported everything in the expected order:
2024 # event=ADDED table=0 cookie=0x1 reg1=0x22
2026 # NXT_FLOW_MONITOR_PAUSED:
2028 # event=DELETED reason=delete table=0 cookie=0x1 reg1=0x22
2030 # event=ADDED table=0 cookie=0x3 in_port=1
2031 # event=MODIFIED table=0 cookie=0x2 in_port=2 actions=output:2
2032 # NXT_FLOW_MONITOR_RESUMED:
2034 # except that, between the PAUSED and RESUMED, the order of the ADDED
2035 # and MODIFIED lines lines depends on hash order, that is, it varies
2036 # as we change the hash function or change architecture. Therefore,
2037 # we use a couple of tests below to accept both orders.
2038 AT_CHECK([ofctl_strip < monitor.log | sed -n -e '
2041 /NXT_FLOW_MONITOR_PAUSED:/p
2042 /NXT_FLOW_MONITOR_RESUMED:/p
2043 ' > monitor.log.subset])
2044 AT_CHECK([grep -v MODIFIED monitor.log.subset], [0], [dnl
2045 event=ADDED table=0 cookie=0x1 reg1=0x22
2046 NXT_FLOW_MONITOR_PAUSED:
2047 event=DELETED reason=delete table=0 cookie=0x1 reg1=0x22
2048 event=ADDED table=0 cookie=0x3 in_port=1
2049 NXT_FLOW_MONITOR_RESUMED:
2051 AT_CHECK([grep -v ADDED monitor.log.subset], [0], [dnl
2052 NXT_FLOW_MONITOR_PAUSED:
2053 event=DELETED reason=delete table=0 cookie=0x1 reg1=0x22
2054 event=MODIFIED table=0 cookie=0x2 in_port=2 actions=output:2
2055 NXT_FLOW_MONITOR_RESUMED:
2061 AT_SETUP([ofproto - event filtering (OpenFlow 1.3)])
2062 AT_KEYWORDS([monitor])
2065 # Start a monitor, use the required protocol version
2066 ovs-ofctl -O OpenFlow13 monitor br0 --detach --no-chdir --pidfile >monitor.log 2>&1
2067 AT_CAPTURE_FILE([monitor.log])
2069 # Send an OpenFlow13 message (04), OFPT_GET_ASYNC_REQUEST (1a), length (8), xid (0a)
2070 ovs-appctl -t ovs-ofctl ofctl/send 041a00080000000a
2071 ovs-appctl -t ovs-ofctl ofctl/barrier
2073 # Check default setting
2074 read -r -d '' expected <<'EOF'
2077 AT_CHECK([ofctl_strip < monitor.log], [], [dnl
2078 send: OFPT_GET_ASYNC_REQUEST (OF1.3):
2079 OFPT_GET_ASYNC_REPLY (OF1.3):
2081 PACKET_IN: no_match action
2082 PORT_STATUS: add delete modify
2083 FLOW_REMOVED: idle hard delete
2087 PORT_STATUS: add delete modify
2089 OFPT_BARRIER_REPLY (OF1.3):