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 - flow mod checks group availability])
250 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn add-group br0 group_id=1234,type=all,bucket=output:10])
251 AT_DATA([flows.txt], [dnl
252 tcp actions=group:1234
253 udp actions=group:1235
255 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn add-flow br0 'tcp actions=group:1234'])
256 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn add-flow br0 'tcp actions=group:1235'], [1], [], [stderr])
258 # The output should look like this:
260 # 00000000 02 0e 00 98 00 00 00 02-00 00 00 00 00 00 00 00 |................|
261 # 00000010 00 00 00 00 00 00 00 00-ff 00 00 00 00 00 80 00 |................|
262 # 00000020 ff ff ff ff ff ff ff ff-ff ff ff ff 00 00 00 00 |................|
263 # 00000030 00 00 00 58 00 00 00 00-00 00 03 d7 00 00 00 00 |...X............|
265 # This 'sed' command captures the error message but drops details.
266 AT_CHECK([sed '/truncated/d
267 /^000000.0/d' stderr | STRIP_XIDS], [0],
268 [OFPT_ERROR (OF1.1): OFPBAC_BAD_OUT_GROUP
269 OFPT_FLOW_MOD (OF1.1):
274 dnl This is really bare-bones.
275 dnl It at least checks request and reply serialization and deserialization.
276 AT_SETUP([ofproto - group description])
278 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn add-group br0 group_id=1234,type=all,bucket=output:10], [0], [stdout])
279 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn dump-groups br0], [0], [stdout])
280 AT_CHECK([STRIP_XIDS stdout], [0], [dnl
281 OFPST_GROUP_DESC reply (OF1.1):
282 group_id=1234,type=all,bucket=actions=output:10
287 dnl This is really bare-bones.
288 dnl It at least checks request and reply serialization and deserialization.
289 AT_SETUP([ofproto - group description])
291 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn add-group br0 group_id=1234,type=all,bucket=output:10])
292 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn dump-groups br0], [0], [stdout])
293 AT_CHECK([STRIP_XIDS stdout], [0], [dnl
294 OFPST_GROUP_DESC reply (OF1.1):
295 group_id=1234,type=all,bucket=actions=output:10
300 dnl This is really bare-bones.
301 dnl It at least checks request and reply serialization and deserialization.
302 AT_SETUP([ofproto - group features])
304 AT_CHECK([ovs-ofctl -O OpenFlow12 -vwarn dump-group-features br0], [0], [stdout])
305 AT_CHECK([STRIP_XIDS stdout], [0], [dnl
306 OFPST_GROUP_FEATURES reply (OF1.2):
314 dnl This is really bare-bones.
315 dnl It at least checks request and reply serialization and deserialization.
316 AT_SETUP([ofproto - group stats])
318 AT_DATA([groups.txt], [dnl
319 group_id=1234,type=all,bucket=output:10
320 group_id=1235,type=all,bucket=output:10
322 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn add-groups br0 groups.txt])
323 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn add-flow br0 'tcp actions=group:1234'])
324 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn dump-group-stats br0 group_id=1234], [0], [stdout])
325 AT_CHECK([STRIP_XIDS stdout | sort], [0], [dnl
326 group_id=1234,ref_count=1,packet_count=0,byte_count=0,bucket0:packet_count=0,byte_count=0
327 OFPST_GROUP reply (OF1.1):
329 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn dump-group-stats br0], [0], [stdout])
330 AT_CHECK([STRIP_XIDS stdout | sort], [0], [dnl
331 group_id=1234,ref_count=1,packet_count=0,byte_count=0,bucket0:packet_count=0,byte_count=0
332 group_id=1235,ref_count=0,packet_count=0,byte_count=0,bucket0:packet_count=0,byte_count=0
333 OFPST_GROUP reply (OF1.1):
338 AT_SETUP([ofproto - mod-port (OpenFlow 1.0)])
340 for command_config_state in \
342 'noflood NO_FLOOD 0' \
343 'down PORT_DOWN,NO_FLOOD LINK_DOWN' \
344 'flood PORT_DOWN LINK_DOWN' \
345 'no-receive PORT_DOWN,NO_RECV LINK_DOWN' \
346 'no-forward PORT_DOWN,NO_RECV,NO_FWD LINK_DOWN' \
347 'no-packet-in PORT_DOWN,NO_RECV,NO_FWD,NO_PACKET_IN LINK_DOWN' \
348 'forward PORT_DOWN,NO_RECV,NO_PACKET_IN LINK_DOWN' \
349 'packet-in PORT_DOWN,NO_RECV LINK_DOWN' \
353 set $command_config_state
354 command=$[1] config=`echo $[2] | sed 's/,/ /g'` state=$[3]
355 AT_CHECK([ovs-ofctl -vwarn mod-port br0 br0 $command])
356 AT_CHECK([ovs-ofctl -vwarn show br0], [0], [stdout])
357 AT_CHECK_UNQUOTED([STRIP_XIDS stdout], [0], [dnl
358 OFPT_FEATURES_REPLY: dpid:fedcba9876543210
359 n_tables:254, n_buffers:256
360 capabilities: FLOW_STATS TABLE_STATS PORT_STATS QUEUE_STATS ARP_MATCH_IP
361 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
362 LOCAL(br0): addr:aa:55:aa:55:00:00
365 speed: 0 Mbps now, 0 Mbps max
366 OFPT_GET_CONFIG_REPLY: frags=normal miss_send_len=0
372 AT_SETUP([ofproto - mod-port (OpenFlow 1.2)])
374 for command_config_state in \
376 'down PORT_DOWN LINK_DOWN' \
377 'no-receive PORT_DOWN,NO_RECV LINK_DOWN' \
378 'no-forward PORT_DOWN,NO_RECV,NO_FWD LINK_DOWN' \
379 'no-packet-in PORT_DOWN,NO_RECV,NO_FWD,NO_PACKET_IN LINK_DOWN' \
380 'forward PORT_DOWN,NO_RECV,NO_PACKET_IN LINK_DOWN' \
381 'packet-in PORT_DOWN,NO_RECV LINK_DOWN' \
385 set $command_config_state
386 command=$[1] config=`echo $[2] | sed 's/,/ /g'` state=$[3]
387 AT_CHECK([ovs-ofctl -O OpenFlow12 -vwarn mod-port br0 br0 $command])
388 AT_CHECK([ovs-ofctl -O OpenFlow12 -vwarn show br0], [0], [stdout])
389 AT_CHECK_UNQUOTED([STRIP_XIDS stdout], [0], [dnl
390 OFPT_FEATURES_REPLY (OF1.2): dpid:fedcba9876543210
391 n_tables:254, n_buffers:256
392 capabilities: FLOW_STATS TABLE_STATS PORT_STATS QUEUE_STATS
393 LOCAL(br0): addr:aa:55:aa:55:00:00
396 speed: 0 Mbps now, 0 Mbps max
397 OFPT_GET_CONFIG_REPLY (OF1.2): frags=normal miss_send_len=0
403 AT_SETUP([ofproto - basic flow_mod commands (NXM)])
405 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip], [0], [NXST_FLOW reply:
407 AT_CHECK([echo 'in_port=2,actions=1' | ovs-ofctl add-flows br0 -])
408 AT_CHECK([ovs-ofctl add-flow br0 in_port=1,actions=2])
409 AT_CHECK([ovs-ofctl -F nxm add-flow br0 table=1,in_port=4,actions=3])
410 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
411 in_port=1 actions=output:2
412 in_port=2 actions=output:1
413 table=1, in_port=4 actions=output:3
416 AT_CHECK([ovs-ofctl dump-aggregate br0 table=0 | STRIP_XIDS], [0], [dnl
417 NXST_AGGREGATE reply: packet_count=0 byte_count=0 flow_count=2
419 AT_CHECK([ovs-ofctl del-flows br0])
420 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip], [0], [NXST_FLOW reply:
425 AT_SETUP([ofproto - basic flow_mod commands (OpenFlow 1.0)])
427 AT_CHECK([ovs-ofctl -F openflow10 dump-flows br0 | ofctl_strip], [0], [OFPST_FLOW reply:
429 AT_CHECK([echo 'in_port=2,actions=1' | ovs-ofctl -F openflow10 add-flows br0 -])
430 AT_CHECK([ovs-ofctl -F openflow10 add-flow br0 in_port=1,actions=2])
431 AT_CHECK([ovs-ofctl -F openflow10 add-flow br0 table=1,in_port=4,actions=3])
432 AT_CHECK([ovs-ofctl -F openflow10 dump-flows br0 | ofctl_strip | sort], [0], [dnl
433 in_port=1 actions=output:2
434 in_port=2 actions=output:1
435 table=1, in_port=4 actions=output:3
438 AT_CHECK([ovs-ofctl -F openflow10 dump-aggregate br0 table=0 | STRIP_XIDS], [0], [dnl
439 OFPST_AGGREGATE reply: packet_count=0 byte_count=0 flow_count=2
441 AT_CHECK([ovs-ofctl -F openflow10 del-flows br0])
442 AT_CHECK([ovs-ofctl -F openflow10 dump-flows br0 | ofctl_strip], [0], [OFPST_FLOW reply:
447 AT_SETUP([ofproto - basic flow_mod commands (OpenFlow 1.1)])
449 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip], [0], [OFPST_FLOW reply (OF1.1):
451 AT_CHECK([echo 'in_port=2,actions=1' | ovs-ofctl -O OpenFlow11 add-flows br0 -])
452 AT_CHECK([ovs-ofctl -O OpenFlow11 add-flow br0 in_port=1,actions=2])
453 AT_CHECK([ovs-ofctl -O OpenFlow11 add-flow br0 table=1,in_port=4,actions=3])
454 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0], [dnl
455 in_port=1 actions=output:2
456 in_port=2 actions=output:1
457 table=1, in_port=4 actions=output:3
458 OFPST_FLOW reply (OF1.1):
460 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-aggregate br0 table=0 | STRIP_XIDS], [0], [dnl
461 OFPST_AGGREGATE reply (OF1.1): packet_count=0 byte_count=0 flow_count=2
463 AT_CHECK([ovs-ofctl -O OpenFlow11 del-flows br0])
464 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip], [0], [OFPST_FLOW reply (OF1.1):
465 table=1, in_port=4 actions=output:3
470 AT_SETUP([ofproto - flow_mod negative test (OpenFlow 1.1)])
472 [set bridge br0 protocols=OpenFlow10,OpenFlow11,OpenFlow12,OpenFlow13])
473 AT_CHECK([ovs-ofctl add-flow -O OpenFlow11 br0 table=1,action=goto_table:2])
475 # The error message here actually comes from ovs-ofctl, not from ovs-vswitchd,
476 # but at least it's the same code in ofpacts_check() that issues the error.
477 AT_CHECK([ovs-ofctl add-flow -O OpenFlow11 br0 table=1,action=goto_table:1],
479 [ovs-ofctl: actions are invalid with specified match (OFPBRC_BAD_TABLE_ID)
484 AT_SETUP([ofproto - set-field flow_mod commands (NXM)])
486 AT_CHECK([ovs-ofctl add-flow br0 ipv6,table=1,in_port=3,actions=drop])
487 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])
488 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
489 table=1, ipv6,in_port=3 actions=load:0xa6badbfffefe59fa->NXM_NX_IPV6_SRC[[0..63]],load:0xfe8001234567890a->NXM_NX_IPV6_SRC[[64..127]]
495 AT_SETUP([ofproto - basic flow_mod commands (OpenFlow 1.2)])
497 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip], [0], [OFPST_FLOW reply (OF1.2):
499 AT_CHECK([echo 'in_port=2,actions=1' | ovs-ofctl -O OpenFlow12 add-flows br0 -])
500 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 in_port=1,actions=2])
501 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 table=1,in_port=4,actions=3])
502 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
503 in_port=1 actions=output:2
504 in_port=2 actions=output:1
505 table=1, in_port=4 actions=output:3
506 OFPST_FLOW reply (OF1.2):
508 AT_CHECK([ovs-ofctl -O OpenFlow12 del-flows br0])
509 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip], [0], [OFPST_FLOW reply (OF1.2):
514 AT_SETUP([ofproto - dump flows with cookie])
516 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x1,in_port=1,actions=1])
517 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x2,in_port=2,actions=1])
518 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x3,in_port=3,actions=1])
519 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
520 cookie=0x1, in_port=1 actions=output:1
521 cookie=0x2, in_port=2 actions=output:1
522 cookie=0x3, in_port=3 actions=output:1
525 AT_CHECK([ovs-ofctl dump-aggregate br0 table=0 | STRIP_XIDS], [0], [dnl
526 NXST_AGGREGATE reply: packet_count=0 byte_count=0 flow_count=3
528 AT_CHECK([ovs-ofctl dump-flows br0 cookie=0x3/-1 | ofctl_strip | sort], [0], [dnl
529 cookie=0x3, in_port=3 actions=output:1
532 AT_CHECK([ovs-ofctl dump-aggregate br0 cookie=0x3/-1 | STRIP_XIDS], [0], [dnl
533 NXST_AGGREGATE reply: packet_count=0 byte_count=0 flow_count=1
538 AT_SETUP([ofproto - mod flow with cookie change (OpenFlow 1.0)])
540 AT_CHECK([ovs-ofctl -F openflow10 add-flow br0 cookie=0x1,in_port=1,actions=1])
541 AT_CHECK([ovs-ofctl -F openflow10 dump-flows br0 | ofctl_strip | sort], [0], [dnl
542 cookie=0x1, in_port=1 actions=output:1
546 AT_CHECK([ovs-ofctl -F openflow10 mod-flows br0 cookie=0x2,in_port=1,actions=1])
547 AT_CHECK([ovs-ofctl -F openflow10 dump-flows br0 | ofctl_strip | sort], [0], [dnl
548 cookie=0x2, in_port=1 actions=output:1
554 AT_SETUP([ofproto - mod flow with cookie change (NXM)])
556 AT_CHECK([ovs-ofctl -F nxm add-flow br0 cookie=0x1,in_port=1,actions=1])
557 AT_CHECK([ovs-ofctl -F nxm dump-flows br0 | ofctl_strip | sort], [0], [dnl
558 cookie=0x1, in_port=1 actions=output:1
562 AT_CHECK([ovs-ofctl -F nxm mod-flows br0 cookie=0x2,in_port=1,actions=1])
563 AT_CHECK([ovs-ofctl -F nxm dump-flows br0 | ofctl_strip | sort], [0], [dnl
564 cookie=0x2, in_port=1 actions=output:1
570 AT_SETUP([ofproto - no mod flow with cookie change (OpenFlow 1.1)])
572 AT_CHECK([ovs-ofctl -O OpenFlow11 add-flow br0 cookie=0x1,in_port=1,actions=1])
573 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0], [dnl
574 cookie=0x1, in_port=1 actions=output:1
575 OFPST_FLOW reply (OF1.1):
577 AT_CHECK([ovs-ofctl -O OpenFlow11 mod-flows br0 cookie=0x2,in_port=1,actions=1])
578 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0], [dnl
579 cookie=0x1, in_port=1 actions=output:1
580 OFPST_FLOW reply (OF1.1):
585 dnl The OpenFlow 1.2 spec states that the cookie may not be modified
586 AT_SETUP([ofproto - no mod flow with cookie change (OpenFlow 1.2)])
588 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 cookie=0x1,in_port=1,actions=1])
589 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
590 cookie=0x1, in_port=1 actions=output:1
591 OFPST_FLOW reply (OF1.2):
594 AT_CHECK([ovs-ofctl -O OpenFlow12 mod-flows br0 cookie=0x2,in_port=1,actions=1])
595 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
596 cookie=0x1, in_port=1 actions=output:1
597 OFPST_FLOW reply (OF1.2):
602 AT_SETUP([ofproto - mod flows based on cookie mask (OpenFlow 1.0)])
604 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x1,in_port=1,actions=1])
605 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x1,in_port=2,actions=1])
606 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x2,in_port=3,actions=1])
607 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
608 cookie=0x1, in_port=1 actions=output:1
609 cookie=0x1, in_port=2 actions=output:1
610 cookie=0x2, in_port=3 actions=output:1
614 AT_CHECK([ovs-ofctl -F nxm mod-flows br0 cookie=0x1/0xff,actions=4])
615 AT_CHECK([ovs-ofctl -F nxm dump-flows br0 | ofctl_strip | sort], [0], [dnl
616 cookie=0x1, in_port=1 actions=output:4
617 cookie=0x1, in_port=2 actions=output:4
618 cookie=0x2, in_port=3 actions=output:1
624 AT_SETUP([ofproto - mod flows based on cookie mask (OpenFlow 1.1)])
626 AT_CHECK([ovs-ofctl -O OpenFlow11 add-flow br0 cookie=0x1,in_port=1,actions=1])
627 AT_CHECK([ovs-ofctl -O OpenFlow11 add-flow br0 cookie=0x1,in_port=2,actions=1])
628 AT_CHECK([ovs-ofctl -O OpenFlow11 add-flow br0 cookie=0x2,in_port=3,actions=1])
629 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0], [dnl
630 cookie=0x1, in_port=1 actions=output:1
631 cookie=0x1, in_port=2 actions=output:1
632 cookie=0x2, in_port=3 actions=output:1
633 OFPST_FLOW reply (OF1.1):
636 AT_CHECK([ovs-ofctl -O OpenFlow11 mod-flows br0 cookie=0x1/0xff,actions=4])
637 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0], [dnl
638 cookie=0x1, in_port=1 actions=output:4
639 cookie=0x1, in_port=2 actions=output:4
640 cookie=0x2, in_port=3 actions=output:1
641 OFPST_FLOW reply (OF1.1):
646 AT_SETUP([ofproto - mod flows based on cookie mask (OpenFlow 1.2)])
648 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 cookie=0x1,in_port=1,actions=1])
649 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 cookie=0x1,in_port=2,actions=1])
650 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 cookie=0x2,in_port=3,actions=1])
651 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
652 cookie=0x1, in_port=1 actions=output:1
653 cookie=0x1, in_port=2 actions=output:1
654 cookie=0x2, in_port=3 actions=output:1
655 OFPST_FLOW reply (OF1.2):
658 AT_CHECK([ovs-ofctl -O OpenFlow12 mod-flows br0 cookie=0x1/0xff,actions=4])
659 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
660 cookie=0x1, in_port=1 actions=output:4
661 cookie=0x1, in_port=2 actions=output:4
662 cookie=0x2, in_port=3 actions=output:1
663 OFPST_FLOW reply (OF1.2):
668 dnl The OpenFlow 1.2 spec states that the cookie may not be modified
669 AT_SETUP([ofproto - mod flows based on cookie mask with cookie change])
671 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x1,in_port=1,actions=1])
672 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x1,in_port=2,actions=1])
673 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x2,in_port=3,actions=1])
674 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
675 cookie=0x1, in_port=1 actions=output:1
676 cookie=0x1, in_port=2 actions=output:1
677 cookie=0x2, in_port=3 actions=output:1
681 AT_CHECK([ovs-ofctl -F nxm mod-flows br0 cookie=1/-1,cookie=4,actions=4])
682 AT_CHECK([ovs-ofctl -F nxm dump-flows br0 | ofctl_strip | sort], [0], [dnl
683 cookie=0x2, in_port=3 actions=output:1
684 cookie=0x4, in_port=1 actions=output:4
685 cookie=0x4, in_port=2 actions=output:4
691 AT_SETUP([ofproto - mod flow with cookie miss (mask==0) - NXM])
693 AT_CHECK([ovs-ofctl -F nxm mod-flows br0 in_port=1,actions=1])
694 AT_CHECK([ovs-ofctl -F nxm dump-flows br0 | ofctl_strip | sort], [0], [dnl
695 in_port=1 actions=output:1
701 AT_SETUP([ofproto - mod flow with cookie miss (mask==0) - OF1.1])
703 AT_CHECK([ovs-ofctl -O openflow11 mod-flows br0 in_port=1,actions=1])
704 AT_CHECK([ovs-ofctl -O openflow11 dump-flows br0 | ofctl_strip | sort], [0], [dnl
705 in_port=1 actions=output:1
706 OFPST_FLOW reply (OF1.1):
711 AT_SETUP([ofproto - mod flow with cookie miss (mask==0) - OF1.2])
713 AT_CHECK([ovs-ofctl -O openflow12 mod-flows br0 in_port=1,actions=1])
714 AT_CHECK([ovs-ofctl -O openflow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
715 OFPST_FLOW reply (OF1.2):
720 AT_SETUP([ofproto - mod flow with cookie miss (mask!=0) - NXM])
722 AT_CHECK([ovs-ofctl -F nxm mod-flows br0 cookie=1/1,in_port=1,actions=1])
723 AT_CHECK([ovs-ofctl -F nxm dump-flows br0 | ofctl_strip | sort], [0], [dnl
729 AT_SETUP([ofproto - mod flow with cookie miss (mask!=0) - OF1.1])
731 AT_CHECK([ovs-ofctl -O openflow11 mod-flows br0 cookie=1/1,in_port=1,actions=1])
732 AT_CHECK([ovs-ofctl -O openflow11 dump-flows br0 | ofctl_strip | sort], [0], [dnl
733 OFPST_FLOW reply (OF1.1):
738 AT_SETUP([ofproto - mod flow with cookie miss (mask!=0) - OF1.2])
740 AT_CHECK([ovs-ofctl -O openflow12 mod-flows br0 cookie=1/1,in_port=1,actions=1])
741 AT_CHECK([ovs-ofctl -O openflow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
742 OFPST_FLOW reply (OF1.2):
747 AT_SETUP([ofproto - del flows with cookies])
749 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x1,in_port=1,actions=1])
750 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x2,in_port=2,actions=1])
751 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x3,in_port=3,actions=1])
752 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
753 cookie=0x1, in_port=1 actions=output:1
754 cookie=0x2, in_port=2 actions=output:1
755 cookie=0x3, in_port=3 actions=output:1
759 AT_CHECK([ovs-ofctl del-flows br0])
760 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
766 AT_SETUP([ofproto - del flows based on cookie])
768 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x1,in_port=1,actions=1])
769 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x2,in_port=2,actions=1])
770 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x3,in_port=3,actions=1])
771 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
772 cookie=0x1, in_port=1 actions=output:1
773 cookie=0x2, in_port=2 actions=output:1
774 cookie=0x3, in_port=3 actions=output:1
778 AT_CHECK([ovs-ofctl del-flows br0 cookie=0x3/-1])
779 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
780 cookie=0x1, in_port=1 actions=output:1
781 cookie=0x2, in_port=2 actions=output:1
787 AT_SETUP([ofproto - del flows based on cookie mask])
789 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x1,in_port=1,actions=1])
790 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x2,in_port=2,actions=1])
791 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x3,in_port=3,actions=1])
792 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
793 cookie=0x1, in_port=1 actions=output:1
794 cookie=0x2, in_port=2 actions=output:1
795 cookie=0x3, in_port=3 actions=output:1
798 AT_CHECK([ovs-ofctl del-flows br0 cookie=0x3/0x1])
799 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
800 cookie=0x2, in_port=2 actions=output:1
806 AT_SETUP([ofproto - del flows based on table id (NXM)])
808 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x1,in_port=1,actions=1])
809 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x2,in_port=2,table=1,actions=1])
810 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
811 cookie=0x1, in_port=1 actions=output:1
812 cookie=0x2, table=1, in_port=2 actions=output:1
815 AT_CHECK([ovs-ofctl del-flows br0 table=0])
816 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
817 cookie=0x2, table=1, in_port=2 actions=output:1
820 AT_CHECK([ovs-ofctl del-flows br0 table=1])
821 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
824 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x1,in_port=1,actions=1])
825 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x2,in_port=2,table=1,actions=1])
826 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
827 cookie=0x1, in_port=1 actions=output:1
828 cookie=0x2, table=1, in_port=2 actions=output:1
831 AT_CHECK([ovs-ofctl del-flows br0])
832 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
838 AT_SETUP([ofproto - del flows based on table id (OpenFlow 1.1)])
840 AT_CHECK([ovs-ofctl -O OpenFlow11 add-flow br0 cookie=0x1,in_port=1,actions=1])
841 AT_CHECK([ovs-ofctl -O OpenFlow11 add-flow br0 cookie=0x2,in_port=2,table=1,actions=1])
842 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0], [dnl
843 cookie=0x1, in_port=1 actions=output:1
844 cookie=0x2, table=1, in_port=2 actions=output:1
845 OFPST_FLOW reply (OF1.1):
847 AT_CHECK([ovs-ofctl -O OpenFlow11 del-flows br0 table=0])
848 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0], [dnl
849 cookie=0x2, table=1, in_port=2 actions=output:1
850 OFPST_FLOW reply (OF1.1):
852 AT_CHECK([ovs-ofctl -O OpenFlow11 del-flows br0 table=1])
853 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0], [dnl
854 OFPST_FLOW reply (OF1.1):
856 AT_CHECK([ovs-ofctl -O OpenFlow11 add-flow br0 cookie=0x1,in_port=1,actions=1])
857 AT_CHECK([ovs-ofctl -O OpenFlow11 add-flow br0 cookie=0x2,in_port=2,table=1,actions=1])
858 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0], [dnl
859 cookie=0x1, in_port=1 actions=output:1
860 cookie=0x2, table=1, in_port=2 actions=output:1
861 OFPST_FLOW reply (OF1.1):
863 AT_CHECK([ovs-ofctl -O OpenFlow11 del-flows br0])
864 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip], [0], [dnl
865 OFPST_FLOW reply (OF1.1):
866 cookie=0x2, table=1, in_port=2 actions=output:1
871 AT_SETUP([ofproto - del flows based on table id (OpenFlow 1.2)])
873 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 cookie=0x1,in_port=1,actions=1])
874 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 cookie=0x2,in_port=2,table=1,actions=1])
875 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
876 cookie=0x1, in_port=1 actions=output:1
877 cookie=0x2, table=1, in_port=2 actions=output:1
878 OFPST_FLOW reply (OF1.2):
880 AT_CHECK([ovs-ofctl -O OpenFlow12 del-flows br0 table=0])
881 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
882 cookie=0x2, table=1, in_port=2 actions=output:1
883 OFPST_FLOW reply (OF1.2):
885 AT_CHECK([ovs-ofctl -O OpenFlow12 del-flows br0 table=1])
886 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
887 OFPST_FLOW reply (OF1.2):
889 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 cookie=0x1,in_port=1,actions=1])
890 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 cookie=0x2,in_port=2,table=1,actions=1])
891 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
892 cookie=0x1, in_port=1 actions=output:1
893 cookie=0x2, table=1, in_port=2 actions=output:1
894 OFPST_FLOW reply (OF1.2):
896 AT_CHECK([ovs-ofctl -O OpenFlow12 del-flows br0])
897 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
898 OFPST_FLOW reply (OF1.2):
903 AT_SETUP([ofproto - flow table configuration (OpenFlow 1.0)])
905 # Check the default configuration.
906 (echo "OFPST_TABLE reply (xid=0x2): 254 tables
907 0: classifier: wild=0x3fffff, max=1000000, active=0
910 while test $x -lt 254; do
911 printf " %d: %-8s: wild=0x3fffff, max=1000000, active=0
916 AT_CHECK([ovs-ofctl dump-tables br0], [0], [expout])
917 # Change the configuration.
920 -- --id=@t0 create Flow_Table name=main \
921 -- --id=@t1 create Flow_Table flow-limit=1024 \
922 -- set bridge br0 'flow_tables={1=@t1,0=@t0}' \
923 | ${PERL} $srcdir/uuidfilt.pl],
927 # Check that the configuration was updated.
928 mv expout orig-expout
929 (echo "OFPST_TABLE reply (xid=0x2): 254 tables
930 0: main : wild=0x3fffff, max=1000000, active=0
932 1: table1 : wild=0x3fffff, max= 1024, active=0
934 tail -n +6 orig-expout) > expout
935 AT_CHECK([ovs-ofctl dump-tables br0], [0], [expout])
939 AT_SETUP([ofproto - flow table configuration (OpenFlow 1.2)])
941 # Check the default configuration.
942 (mid="wild=0xfffffffff, max=1000000,"
945 match=0xfffffffff, instructions=0x00000007, config=0x00000003
946 write_actions=0x00000000, apply_actions=0x00000000
947 write_setfields=0x0000000fffffffff
948 apply_setfields=0x0000000fffffffff
949 metadata_match=0xffffffffffffffff
950 metadata_write=0xffffffffffffffff"
951 echo "OFPST_TABLE reply (OF1.2) (xid=0x2): 254 tables
952 0: classifier: $mid active=0$tail"
954 while test $x -lt 254; do
955 printf " %d: %-8s: $mid active=0$tail
959 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-tables br0], [0], [expout])
960 # Change the configuration.
963 -- --id=@t0 create Flow_Table name=main \
964 -- --id=@t1 create Flow_Table flow-limit=1024 \
965 -- set bridge br0 'flow_tables={1=@t1,0=@t0}' \
966 | ${PERL} $srcdir/uuidfilt.pl],
970 # Check that the configuration was updated.
971 mv expout orig-expout
972 (echo "OFPST_TABLE reply (OF1.2) (xid=0x2): 254 tables
973 0: main : wild=0xfffffffff, max=1000000, active=0"
974 tail -n +3 orig-expout | head -7
975 echo " 1: table1 : wild=0xfffffffff, max= 1024, active=0"
976 tail -n +11 orig-expout) > expout
977 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-tables br0], [0], [expout])
981 AT_SETUP([ofproto - hard limits on flow table size (OpenFLow 1.0)])
983 # Configure a maximum of 4 flows.
986 -- --id=@t0 create Flow_Table flow-limit=4 \
987 -- set bridge br0 flow_tables:0=@t0 \
988 | ${PERL} $srcdir/uuidfilt.pl],
992 for in_port in 1 2 3 4; do
993 ovs-ofctl add-flow br0 in_port=$in_port,actions=drop
995 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
996 in_port=1 actions=drop
997 in_port=2 actions=drop
998 in_port=3 actions=drop
999 in_port=4 actions=drop
1002 # Adding another flow will be refused.
1003 AT_CHECK([ovs-ofctl add-flow br0 in_port=5,actions=drop], [1], [], [stderr])
1004 AT_CHECK([head -n 1 stderr | ofctl_strip], [0],
1005 [OFPT_ERROR: OFPFMFC_TABLE_FULL
1007 # Also a mod-flow that would add a flow will be refused.
1008 AT_CHECK([ovs-ofctl mod-flows br0 in_port=5,actions=drop], [1], [], [stderr])
1009 AT_CHECK([head -n 1 stderr | ofctl_strip], [0],
1010 [OFPT_ERROR: OFPFMFC_TABLE_FULL
1012 # Replacing or modifying an existing flow is allowed.
1013 AT_CHECK([ovs-ofctl add-flow br0 in_port=4,actions=normal])
1014 AT_CHECK([ovs-ofctl mod-flows br0 in_port=3,actions=output:1])
1015 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1016 in_port=1 actions=drop
1017 in_port=2 actions=drop
1018 in_port=3 actions=output:1
1019 in_port=4 actions=NORMAL
1025 AT_SETUP([ofproto - hard limits on flow table size (OpenFLow 1.2)])
1027 # Configure a maximum of 4 flows.
1030 -- --id=@t0 create Flow_Table flow-limit=4 \
1031 -- set bridge br0 flow_tables:0=@t0 \
1032 | ${PERL} $srcdir/uuidfilt.pl],
1036 for in_port in 1 2 3 4; do
1037 ovs-ofctl -O OpenFlow12 add-flow br0 in_port=$in_port,actions=drop
1039 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1040 in_port=1 actions=drop
1041 in_port=2 actions=drop
1042 in_port=3 actions=drop
1043 in_port=4 actions=drop
1044 OFPST_FLOW reply (OF1.2):
1046 # Adding another flow will be refused.
1047 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 in_port=5,actions=drop], [1], [], [stderr])
1048 AT_CHECK([head -n 1 stderr | ofctl_strip], [0],
1049 [OFPT_ERROR (OF1.2): OFPFMFC_TABLE_FULL
1051 # Replacing or modifying an existing flow is allowed.
1052 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 in_port=4,actions=normal])
1053 AT_CHECK([ovs-ofctl -O OpenFlow12 mod-flows br0 in_port=3,actions=output:1])
1054 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1055 in_port=1 actions=drop
1056 in_port=2 actions=drop
1057 in_port=3 actions=output:1
1058 in_port=4 actions=NORMAL
1059 OFPST_FLOW reply (OF1.2):
1064 AT_SETUP([ofproto - eviction upon table overflow (OpenFlow 1.0)])
1066 # Configure a maximum of 4 flows.
1069 -- --id=@t0 create Flow_Table flow-limit=4 overflow-policy=evict \
1070 -- set bridge br0 flow_tables:0=@t0 \
1071 | ${PERL} $srcdir/uuidfilt.pl],
1075 for in_port in 4 3 2 1; do
1076 ovs-ofctl add-flow br0 idle_timeout=${in_port}0,in_port=$in_port,actions=drop
1078 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1079 idle_timeout=10, in_port=1 actions=drop
1080 idle_timeout=20, in_port=2 actions=drop
1081 idle_timeout=30, in_port=3 actions=drop
1082 idle_timeout=40, in_port=4 actions=drop
1085 # Adding another flow will cause the one that expires soonest to be evicted.
1086 AT_CHECK([ovs-ofctl add-flow br0 in_port=5,actions=drop])
1087 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1088 idle_timeout=20, in_port=2 actions=drop
1089 idle_timeout=30, in_port=3 actions=drop
1090 idle_timeout=40, in_port=4 actions=drop
1091 in_port=5 actions=drop
1094 # A mod-flow that adds a flow also causes eviction, but replacing or
1095 # modifying an existing flow doesn't.
1096 AT_CHECK([ovs-ofctl mod-flows br0 in_port=6,actions=drop])
1097 AT_CHECK([ovs-ofctl add-flow br0 in_port=4,actions=normal])
1098 AT_CHECK([ovs-ofctl mod-flows br0 in_port=3,actions=output:1])
1099 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1100 idle_timeout=30, in_port=3 actions=output:1
1101 in_port=4 actions=NORMAL
1102 in_port=5 actions=drop
1103 in_port=6 actions=drop
1106 # Flows with no timeouts at all cannot be evicted.
1107 AT_CHECK([ovs-ofctl add-flow br0 in_port=7,actions=normal])
1108 AT_CHECK([ovs-ofctl add-flow br0 in_port=8,actions=drop], [1], [], [stderr])
1109 AT_CHECK([head -n 1 stderr | ofctl_strip], [0],
1110 [OFPT_ERROR: OFPFMFC_TABLE_FULL
1112 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1113 in_port=4 actions=NORMAL
1114 in_port=5 actions=drop
1115 in_port=6 actions=drop
1116 in_port=7 actions=NORMAL
1122 AT_SETUP([ofproto - eviction upon table overflow (OpenFlow 1.2)])
1124 # Configure a maximum of 4 flows.
1127 -- --id=@t0 create Flow_Table flow-limit=4 overflow-policy=evict \
1128 -- set bridge br0 flow_tables:0=@t0 \
1129 | ${PERL} $srcdir/uuidfilt.pl],
1133 for in_port in 4 3 2 1; do
1134 ovs-ofctl -O OpenFlow12 add-flow br0 idle_timeout=${in_port}0,in_port=$in_port,actions=drop
1136 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1137 idle_timeout=10, in_port=1 actions=drop
1138 idle_timeout=20, in_port=2 actions=drop
1139 idle_timeout=30, in_port=3 actions=drop
1140 idle_timeout=40, in_port=4 actions=drop
1141 OFPST_FLOW reply (OF1.2):
1143 # Adding another flow will cause the one that expires soonest to be evicted.
1144 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 in_port=5,actions=drop])
1145 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1146 idle_timeout=20, in_port=2 actions=drop
1147 idle_timeout=30, in_port=3 actions=drop
1148 idle_timeout=40, in_port=4 actions=drop
1149 in_port=5 actions=drop
1150 OFPST_FLOW reply (OF1.2):
1152 # In Open Flow 1.2 a mod-flow does not ever add a flow and thus
1153 # has no effect on eviction
1154 AT_CHECK([ovs-ofctl -O OpenFlow12 mod-flows br0 in_port=6,actions=drop])
1155 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 in_port=4,actions=normal])
1156 AT_CHECK([ovs-ofctl -O OpenFlow12 mod-flows br0 in_port=3,actions=output:1])
1157 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1158 idle_timeout=20, in_port=2 actions=drop
1159 idle_timeout=30, in_port=3 actions=output:1
1160 in_port=4 actions=NORMAL
1161 in_port=5 actions=drop
1162 OFPST_FLOW reply (OF1.2):
1164 # Flows with no timeouts at all cannot be evicted.
1165 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 in_port=6,actions=drop])
1166 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 in_port=7,actions=normal])
1167 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 in_port=8,actions=drop], [1], [], [stderr])
1168 AT_CHECK([head -n 1 stderr | ofctl_strip], [0],
1169 [OFPT_ERROR (OF1.2): OFPFMFC_TABLE_FULL
1171 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1172 in_port=4 actions=NORMAL
1173 in_port=5 actions=drop
1174 in_port=6 actions=drop
1175 in_port=7 actions=NORMAL
1176 OFPST_FLOW reply (OF1.2):
1181 AT_SETUP([ofproto - eviction upon table overflow, with fairness (OpenFlow 1.0)])
1183 # Configure a maximum of 4 flows.
1186 -- --id=@t0 create Flow_Table name=evict flow-limit=4 \
1187 overflow-policy=evict \
1188 groups='"NXM_OF_IN_PORT[[]]"' \
1189 -- set bridge br0 flow_tables:0=@t0 \
1190 | ${PERL} $srcdir/uuidfilt.pl],
1194 ovs-ofctl add-flows br0 - <<EOF
1195 idle_timeout=10 in_port=2 dl_src=00:44:55:66:77:88 actions=drop
1196 idle_timeout=20 in_port=1 dl_src=00:11:22:33:44:55 actions=drop
1197 idle_timeout=30 in_port=1 dl_src=00:22:33:44:55:66 actions=drop
1198 idle_timeout=40 in_port=1 dl_src=00:33:44:55:66:77 actions=drop
1200 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1201 idle_timeout=10, in_port=2,dl_src=00:44:55:66:77:88 actions=drop
1202 idle_timeout=20, in_port=1,dl_src=00:11:22:33:44:55 actions=drop
1203 idle_timeout=30, in_port=1,dl_src=00:22:33:44:55:66 actions=drop
1204 idle_timeout=40, in_port=1,dl_src=00:33:44:55:66:77 actions=drop
1207 # Adding another flow will cause the one that expires soonest within
1208 # the largest group (those with in_port=1) to be evicted. In this
1209 # case this is not the same as the one that expires soonest overall
1210 # (which is what makes the test interesting):
1211 AT_CHECK([ovs-ofctl add-flow br0 in_port=2,dl_src=00:55:66:77:88:99,actions=drop])
1212 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1213 idle_timeout=10, in_port=2,dl_src=00:44:55:66:77:88 actions=drop
1214 idle_timeout=30, in_port=1,dl_src=00:22:33:44:55:66 actions=drop
1215 idle_timeout=40, in_port=1,dl_src=00:33:44:55:66:77 actions=drop
1216 in_port=2,dl_src=00:55:66:77:88:99 actions=drop
1219 # Enlarge the flow limit, change the eviction policy back to strictly
1220 # based on expiration, and and add some flows.
1221 AT_CHECK([ovs-vsctl set Flow_Table evict groups='[[]]' flow-limit=7])
1222 ovs-ofctl add-flows br0 - <<EOF
1223 idle_timeout=50 in_port=2 dl_src=00:66:77:88:99:aa actions=drop
1224 idle_timeout=60 in_port=2 dl_src=00:77:88:99:aa:bb actions=drop
1225 idle_timeout=70 in_port=2 dl_src=00:88:99:aa:bb:cc actions=drop
1227 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1228 idle_timeout=10, in_port=2,dl_src=00:44:55:66:77:88 actions=drop
1229 idle_timeout=30, in_port=1,dl_src=00:22:33:44:55:66 actions=drop
1230 idle_timeout=40, in_port=1,dl_src=00:33:44:55:66:77 actions=drop
1231 idle_timeout=50, in_port=2,dl_src=00:66:77:88:99:aa actions=drop
1232 idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=drop
1233 idle_timeout=70, in_port=2,dl_src=00:88:99:aa:bb:cc actions=drop
1234 in_port=2,dl_src=00:55:66:77:88:99 actions=drop
1237 # Adding another flow will cause the one that expires soonest overall
1239 AT_CHECK([ovs-ofctl add-flow br0 'idle_timeout=80 in_port=2 dl_src=00:99:aa:bb:cc:dd actions=drop'])
1240 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1241 idle_timeout=30, in_port=1,dl_src=00:22:33:44:55:66 actions=drop
1242 idle_timeout=40, in_port=1,dl_src=00:33:44:55:66:77 actions=drop
1243 idle_timeout=50, in_port=2,dl_src=00:66:77:88:99:aa actions=drop
1244 idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=drop
1245 idle_timeout=70, in_port=2,dl_src=00:88:99:aa:bb:cc actions=drop
1246 idle_timeout=80, in_port=2,dl_src=00:99:aa:bb:cc:dd actions=drop
1247 in_port=2,dl_src=00:55:66:77:88:99 actions=drop
1250 # Reducing the flow limit also causes the flows that expire soonest
1251 # overall to be evicted.
1252 AT_CHECK([ovs-vsctl set Flow_Table evict flow-limit=4])
1253 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1254 idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=drop
1255 idle_timeout=70, in_port=2,dl_src=00:88:99:aa:bb:cc actions=drop
1256 idle_timeout=80, in_port=2,dl_src=00:99:aa:bb:cc:dd actions=drop
1257 in_port=2,dl_src=00:55:66:77:88:99 actions=drop
1263 AT_SETUP([ofproto - eviction upon table overflow, with fairness (OpenFlow 1.2)])
1265 # Configure a maximum of 4 flows.
1268 -- --id=@t0 create Flow_Table name=evict flow-limit=4 \
1269 overflow-policy=evict \
1270 groups='"NXM_OF_IN_PORT[[]]"' \
1271 -- set bridge br0 flow_tables:0=@t0 \
1272 | ${PERL} $srcdir/uuidfilt.pl],
1276 ovs-ofctl -O OpenFlow12 add-flows br0 - <<EOF
1277 idle_timeout=10 in_port=2 dl_src=00:44:55:66:77:88 actions=drop
1278 idle_timeout=20 in_port=1 dl_src=00:11:22:33:44:55 actions=drop
1279 idle_timeout=30 in_port=1 dl_src=00:22:33:44:55:66 actions=drop
1280 idle_timeout=40 in_port=1 dl_src=00:33:44:55:66:77 actions=drop
1282 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1283 idle_timeout=10, in_port=2,dl_src=00:44:55:66:77:88 actions=drop
1284 idle_timeout=20, in_port=1,dl_src=00:11:22:33:44:55 actions=drop
1285 idle_timeout=30, in_port=1,dl_src=00:22:33:44:55:66 actions=drop
1286 idle_timeout=40, in_port=1,dl_src=00:33:44:55:66:77 actions=drop
1287 OFPST_FLOW reply (OF1.2):
1289 # Adding another flow will cause the one that expires soonest within
1290 # the largest group (those with in_port=1) to be evicted. In this
1291 # case this is not the same as the one that expires soonest overall
1292 # (which is what makes the test interesting):
1293 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 in_port=2,dl_src=00:55:66:77:88:99,actions=drop])
1294 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1295 idle_timeout=10, in_port=2,dl_src=00:44:55:66:77:88 actions=drop
1296 idle_timeout=30, in_port=1,dl_src=00:22:33:44:55:66 actions=drop
1297 idle_timeout=40, in_port=1,dl_src=00:33:44:55:66:77 actions=drop
1298 in_port=2,dl_src=00:55:66:77:88:99 actions=drop
1299 OFPST_FLOW reply (OF1.2):
1301 # Enlarge the flow limit, change the eviction policy back to strictly
1302 # based on expiration, and and add some flows.
1303 AT_CHECK([ovs-vsctl set Flow_Table evict groups='[[]]' flow-limit=7])
1304 ovs-ofctl -O OpenFlow12 add-flows br0 - <<EOF
1305 idle_timeout=50 in_port=2 dl_src=00:66:77:88:99:aa actions=drop
1306 idle_timeout=60 in_port=2 dl_src=00:77:88:99:aa:bb actions=drop
1307 idle_timeout=70 in_port=2 dl_src=00:88:99:aa:bb:cc actions=drop
1309 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1310 idle_timeout=10, in_port=2,dl_src=00:44:55:66:77:88 actions=drop
1311 idle_timeout=30, in_port=1,dl_src=00:22:33:44:55:66 actions=drop
1312 idle_timeout=40, in_port=1,dl_src=00:33:44:55:66:77 actions=drop
1313 idle_timeout=50, in_port=2,dl_src=00:66:77:88:99:aa actions=drop
1314 idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=drop
1315 idle_timeout=70, in_port=2,dl_src=00:88:99:aa:bb:cc actions=drop
1316 in_port=2,dl_src=00:55:66:77:88:99 actions=drop
1317 OFPST_FLOW reply (OF1.2):
1319 # Adding another flow will cause the one that expires soonest overall
1321 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'])
1322 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1323 idle_timeout=30, in_port=1,dl_src=00:22:33:44:55:66 actions=drop
1324 idle_timeout=40, in_port=1,dl_src=00:33:44:55:66:77 actions=drop
1325 idle_timeout=50, in_port=2,dl_src=00:66:77:88:99:aa actions=drop
1326 idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=drop
1327 idle_timeout=70, in_port=2,dl_src=00:88:99:aa:bb:cc actions=drop
1328 idle_timeout=80, in_port=2,dl_src=00:99:aa:bb:cc:dd actions=drop
1329 in_port=2,dl_src=00:55:66:77:88:99 actions=drop
1330 OFPST_FLOW reply (OF1.2):
1332 # Reducing the flow limit also causes the flows that expire soonest
1333 # overall to be evicted.
1334 AT_CHECK([ovs-vsctl set Flow_Table evict flow-limit=4])
1335 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1336 idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=drop
1337 idle_timeout=70, in_port=2,dl_src=00:88:99:aa:bb:cc actions=drop
1338 idle_timeout=80, in_port=2,dl_src=00:99:aa:bb:cc:dd actions=drop
1339 in_port=2,dl_src=00:55:66:77:88:99 actions=drop
1340 OFPST_FLOW reply (OF1.2):
1345 AT_SETUP([ofproto - asynchronous message control (OpenFlow 1.0)])
1347 AT_CHECK([ovs-ofctl -P openflow10 monitor br0 --detach --no-chdir --pidfile])
1349 printf '\n\n--- check_async %d ---\n\n\n' $1
1352 ovs-appctl -t ovs-ofctl ofctl/barrier
1353 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
1356 # OFPT_PACKET_IN, OFPR_ACTION (controller_id=0)
1357 ovs-ofctl -v packet-out br0 controller controller '0001020304050010203040501234'
1358 if test X"$1" = X"OFPR_ACTION"; then shift;
1359 echo >>expout "OFPT_PACKET_IN: total_len=14 in_port=CONTROLLER (via action) data_len=14 (unbuffered)
1360 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"
1363 # OFPT_PACKET_IN, OFPR_NO_MATCH (controller_id=123)
1364 ovs-ofctl -v packet-out br0 controller 'controller(reason=no_match,id=123)' '0001020304050010203040501234'
1365 if test X"$1" = X"OFPR_NO_MATCH"; then shift;
1366 echo >>expout "OFPT_PACKET_IN: total_len=14 in_port=CONTROLLER (via no_match) data_len=14 (unbuffered)
1367 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"
1370 # OFPT_PACKET_IN, OFPR_INVALID_TTL (controller_id=0)
1371 ovs-ofctl packet-out br0 controller dec_ttl '002583dfb4000026b98cb0f908004500003fb7e200000011339bac11370dac100002d7730035002b8f6d86fb0100000100000000000006626c702d7873066e696369726103636f6d00000f00'
1372 if test X"$1" = X"OFPR_INVALID_TTL"; then shift;
1373 echo >>expout "OFPT_PACKET_IN: total_len=76 in_port=CONTROLLER (via invalid_ttl) data_len=76 (unbuffered)
1374 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"
1377 # OFPT_PORT_STATUS, OFPPR_ADD
1378 ovs-vsctl add-port br0 test -- set Interface test type=dummy ofport_request=1
1379 if test X"$1" = X"OFPPR_ADD"; then shift;
1380 echo >>expout "OFPT_PORT_STATUS: ADD: 1(test): addr:aa:55:aa:55:00:0x
1383 speed: 0 Mbps now, 0 Mbps max"
1386 # OFPT_PORT_STATUS, OFPPR_DELETE
1387 ovs-vsctl del-port br0 test
1388 if test X"$1" = X"OFPPR_DELETE"; then shift;
1389 echo >>expout "OFPT_PORT_STATUS: DEL: 1(test): addr:aa:55:aa:55:00:0x
1392 speed: 0 Mbps now, 0 Mbps max"
1395 # OFPT_FLOW_REMOVED, OFPRR_DELETE
1396 ovs-ofctl add-flow br0 send_flow_rem,actions=drop
1397 ovs-ofctl --strict del-flows br0 ''
1398 if test X"$1" = X"OFPRR_DELETE"; then shift;
1399 echo >>expout "OFPT_FLOW_REMOVED: reason=delete"
1401 AT_FAIL_IF([test X"$1" != X])
1403 ovs-appctl -t ovs-ofctl ofctl/barrier
1404 echo >>expout "OFPT_BARRIER_REPLY:"
1408 s/ (xid=0x[0-9a-fA-F]*)//
1410 s/00:0.$/00:0x/' < monitor.log]],
1414 # It's a service connection so initially there should be no async messages.
1417 # Set miss_send_len to 128, turning on packet-ins for our service connection.
1418 ovs-appctl -t ovs-ofctl ofctl/send 0109000c0123456700000080
1419 check_async 2 OFPR_ACTION OFPPR_ADD OFPPR_DELETE OFPRR_DELETE
1421 # Set miss_send_len to 128 and enable invalid_ttl.
1422 ovs-appctl -t ovs-ofctl ofctl/send 0109000c0123456700040080
1423 check_async 3 OFPR_ACTION OFPR_INVALID_TTL OFPPR_ADD OFPPR_DELETE OFPRR_DELETE
1425 # Become slave, which should disable everything except port status.
1426 ovs-appctl -t ovs-ofctl ofctl/send 0104001400000002000023200000000a00000002
1427 check_async 4 OFPPR_ADD OFPPR_DELETE
1429 # Use NXT_SET_ASYNC_CONFIG to enable a patchwork of asynchronous messages.
1430 ovs-appctl -t ovs-ofctl ofctl/send 01040028000000020000232000000013000000020000000500000005000000020000000200000005
1431 check_async 5 OFPR_INVALID_TTL OFPPR_DELETE OFPRR_DELETE
1433 # Set controller ID 123.
1434 ovs-appctl -t ovs-ofctl ofctl/send 01040018000000030000232000000014000000000000007b
1435 check_async 6 OFPR_NO_MATCH OFPPR_DELETE OFPRR_DELETE
1437 # Restore controller ID 0.
1438 ovs-appctl -t ovs-ofctl ofctl/send 010400180000000300002320000000140000000000000000
1441 ovs-appctl -t ovs-ofctl ofctl/send 0104001400000002000023200000000a00000001
1442 check_async 7 OFPR_ACTION OFPPR_ADD
1444 ovs-appctl -t ovs-ofctl exit
1448 AT_SETUP([ofproto - asynchronous message control (OpenFlow 1.2)])
1450 AT_CHECK([ovs-ofctl -O OpenFlow12 monitor br0 --detach --no-chdir --pidfile])
1452 printf '\n\n--- check_async %d ---\n\n\n' $1
1456 ovs-appctl -t ovs-ofctl ofctl/barrier
1457 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
1460 # OFPT_PACKET_IN, OFPR_ACTION (controller_id=0)
1461 ovs-ofctl -O OpenFlow12 -v packet-out br0 none controller '0001020304050010203040501234'
1462 if test X"$1" = X"OFPR_ACTION"; then shift;
1463 echo >>expout "OFPT_PACKET_IN (OF1.2): total_len=14 in_port=ANY (via action) data_len=14 (unbuffered)
1464 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"
1467 # OFPT_PACKET_IN, OFPR_NO_MATCH (controller_id=123)
1468 ovs-ofctl -O OpenFlow12 -v packet-out br0 none 'controller(reason=no_match,id=123)' '0001020304050010203040501234'
1469 if test X"$1" = X"OFPR_NO_MATCH"; then shift;
1470 echo >>expout "OFPT_PACKET_IN (OF1.2): total_len=14 in_port=ANY (via no_match) data_len=14 (unbuffered)
1471 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"
1474 # OFPT_PACKET_IN, OFPR_INVALID_TTL (controller_id=0)
1475 ovs-ofctl -O OpenFlow12 packet-out br0 none dec_ttl '002583dfb4000026b98cb0f908004500003fb7e200000011339bac11370dac100002d7730035002b8f6d86fb0100000100000000000006626c702d7873066e696369726103636f6d00000f00'
1476 if test X"$1" = X"OFPR_INVALID_TTL"; then shift;
1477 echo >>expout "OFPT_PACKET_IN (OF1.2): total_len=76 in_port=ANY (via invalid_ttl) data_len=76 (unbuffered)
1478 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"
1481 # OFPT_PORT_STATUS, OFPPR_ADD
1482 ovs-vsctl add-port br0 test -- set Interface test type=dummy
1483 if test X"$1" = X"OFPPR_ADD"; then shift;
1484 echo >>expout "OFPT_PORT_STATUS (OF1.2): ADD: ${INDEX}(test): addr:aa:55:aa:55:00:0x
1487 speed: 0 Mbps now, 0 Mbps max"
1490 # OFPT_PORT_STATUS, OFPPR_DELETE
1491 ovs-vsctl del-port br0 test
1492 if test X"$1" = X"OFPPR_DELETE"; then shift;
1493 echo >>expout "OFPT_PORT_STATUS (OF1.2): DEL: ${INDEX}(test): addr:aa:55:aa:55:00:0x
1496 speed: 0 Mbps now, 0 Mbps max"
1499 # OFPT_FLOW_REMOVED, OFPRR_DELETE
1500 ovs-ofctl -O OpenFlow12 add-flow br0 send_flow_rem,actions=drop
1501 ovs-ofctl -O OpenFlow12 --strict del-flows br0 ''
1502 if test X"$1" = X"OFPRR_DELETE"; then shift;
1503 echo >>expout "OFPT_FLOW_REMOVED (OF1.2): reason=delete table_id=0"
1505 AT_FAIL_IF([test X"$1" != X])
1507 ovs-appctl -t ovs-ofctl ofctl/barrier
1508 echo >>expout "OFPT_BARRIER_REPLY (OF1.2):"
1512 s/ (xid=0x[0-9a-fA-F]*)//
1514 s/00:0.$/00:0x/' < monitor.log]],
1518 # It's a service connection so initially there should be no async messages.
1521 # Set miss_send_len to 128, turning on packet-ins for our service connection.
1522 ovs-appctl -t ovs-ofctl ofctl/send 0309000c0123456700000080
1523 check_async 2 OFPR_ACTION OFPPR_ADD OFPPR_DELETE OFPRR_DELETE
1525 # Set miss_send_len to 128 and enable invalid_ttl.
1526 ovs-appctl -t ovs-ofctl ofctl/send 0309000c0123456700040080
1527 check_async 3 OFPR_ACTION OFPR_INVALID_TTL OFPPR_ADD OFPPR_DELETE OFPRR_DELETE
1529 # Become slave (OF 1.2), which should disable everything except port status.
1530 ovs-appctl -t ovs-ofctl ofctl/send 031800180000000200000003000000000000000000000001
1531 check_async 4 OFPPR_ADD OFPPR_DELETE
1533 # Use NXT_SET_ASYNC_CONFIG to enable a patchwork of asynchronous messages.
1534 ovs-appctl -t ovs-ofctl ofctl/send 03040028000000020000232000000013000000020000000500000005000000020000000200000005
1535 check_async 5 OFPR_INVALID_TTL OFPPR_DELETE OFPRR_DELETE
1537 # Set controller ID 123.
1538 ovs-appctl -t ovs-ofctl ofctl/send 03040018000000030000232000000014000000000000007b
1539 check_async 6 OFPR_NO_MATCH OFPPR_DELETE OFPRR_DELETE
1541 # Restore controller ID 0.
1542 ovs-appctl -t ovs-ofctl ofctl/send 030400180000000300002320000000140000000000000000
1544 # Become master (OF 1.2).
1545 ovs-appctl -t ovs-ofctl ofctl/send 031800180000000400000002000000000000000000000002
1546 check_async 7 OFPR_ACTION OFPPR_ADD
1548 ovs-appctl -t ovs-ofctl exit
1552 AT_SETUP([ofproto - asynchronous message control (OpenFlow 1.3)])
1554 AT_CHECK([ovs-ofctl -O OpenFlow13 monitor br0 --detach --no-chdir --pidfile])
1556 printf '\n\n--- check_async %d ---\n\n\n' $1
1560 ovs-appctl -t ovs-ofctl ofctl/barrier
1561 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
1564 # OFPT_PACKET_IN, OFPR_ACTION (controller_id=0)
1565 ovs-ofctl -O OpenFlow13 -v packet-out br0 none controller '0001020304050010203040501234'
1566 if test X"$1" = X"OFPR_ACTION"; then shift;
1567 echo >>expout "OFPT_PACKET_IN (OF1.3): total_len=14 in_port=ANY (via action) data_len=14 (unbuffered)
1568 metadata=0,in_port=0,vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1234"
1571 # OFPT_PACKET_IN, OFPR_NO_MATCH (controller_id=123)
1572 ovs-ofctl -O OpenFlow13 -v packet-out br0 none 'controller(reason=no_match,id=123)' '0001020304050010203040501234'
1573 if test X"$1" = X"OFPR_NO_MATCH"; then shift;
1574 echo >>expout "OFPT_PACKET_IN (OF1.3): total_len=14 in_port=ANY (via no_match) data_len=14 (unbuffered)
1575 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"
1578 # OFPT_PACKET_IN, OFPR_INVALID_TTL (controller_id=0)
1579 ovs-ofctl -O OpenFlow13 packet-out br0 none dec_ttl '002583dfb4000026b98cb0f908004500003fb7e200000011339bac11370dac100002d7730035002b8f6d86fb0100000100000000000006626c702d7873066e696369726103636f6d00000f00'
1580 if test X"$1" = X"OFPR_INVALID_TTL"; then shift;
1581 echo >>expout "OFPT_PACKET_IN (OF1.3): total_len=76 in_port=ANY (via invalid_ttl) data_len=76 (unbuffered)
1582 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"
1585 # OFPT_PORT_STATUS, OFPPR_ADD
1586 ovs-vsctl add-port br0 test -- set Interface test type=dummy
1587 if test X"$1" = X"OFPPR_ADD"; then shift;
1588 echo >>expout "OFPT_PORT_STATUS (OF1.3): ADD: ${INDEX}(test): addr:aa:55:aa:55:00:0x
1591 speed: 0 Mbps now, 0 Mbps max"
1594 # OFPT_PORT_STATUS, OFPPR_DELETE
1595 ovs-vsctl del-port br0 test
1596 if test X"$1" = X"OFPPR_DELETE"; then shift;
1597 echo >>expout "OFPT_PORT_STATUS (OF1.3): DEL: ${INDEX}(test): addr:aa:55:aa:55:00:0x
1600 speed: 0 Mbps now, 0 Mbps max"
1603 # OFPT_FLOW_REMOVED, OFPRR_DELETE
1604 ovs-ofctl -O OpenFlow13 add-flow br0 send_flow_rem,actions=drop
1605 ovs-ofctl -O OpenFlow13 --strict del-flows br0 ''
1606 if test X"$1" = X"OFPRR_DELETE"; then shift;
1607 echo >>expout "OFPT_FLOW_REMOVED (OF1.3): reason=delete table_id=0"
1609 AT_FAIL_IF([test X"$1" != X])
1611 ovs-appctl -t ovs-ofctl ofctl/barrier
1612 echo >>expout "OFPT_BARRIER_REPLY (OF1.3):"
1616 s/ (xid=0x[0-9a-fA-F]*)//
1618 s/00:0.$/00:0x/' < monitor.log]],
1622 # It's a service connection so initially there should be no async messages.
1625 # Set miss_send_len to 128, turning on packet-ins for our service connection.
1626 ovs-appctl -t ovs-ofctl ofctl/send 0409000c0123456700000080
1627 check_async 2 OFPR_ACTION OFPPR_ADD OFPPR_DELETE OFPRR_DELETE
1629 # Become slave (OF 1.3), which should disable everything except port status.
1630 ovs-appctl -t ovs-ofctl ofctl/send 041800180000000200000003000000000000000000000001
1631 check_async 3 OFPPR_ADD OFPPR_DELETE
1633 # Use OF 1.3 OFPT_SET_ASYNC to enable a patchwork of asynchronous messages.
1634 ovs-appctl -t ovs-ofctl ofctl/send 041c002000000002000000020000000500000005000000020000000200000005
1635 check_async 4 OFPR_INVALID_TTL OFPPR_DELETE OFPRR_DELETE
1637 # Set controller ID 123.
1638 ovs-appctl -t ovs-ofctl ofctl/send 04040018000000030000232000000014000000000000007b
1639 check_async 5 OFPR_NO_MATCH OFPPR_DELETE OFPRR_DELETE
1641 # Restore controller ID 0.
1642 ovs-appctl -t ovs-ofctl ofctl/send 040400180000000300002320000000140000000000000000
1644 # Become master (OF 1.3).
1645 ovs-appctl -t ovs-ofctl ofctl/send 041800180000000400000002000000000000000000000002
1646 check_async 6 OFPR_ACTION OFPPR_ADD
1648 ovs-appctl -t ovs-ofctl exit
1652 dnl This test checks that the role request/response messaging works
1653 dnl and that generation_id is handled properly.
1654 AT_SETUP([ofproto - controller role (OpenFlow 1.2)])
1656 AT_CHECK([ovs-ofctl -O OpenFlow12 monitor br0 --detach --no-chdir --pidfile])
1658 ovs-appctl -t ovs-ofctl ofctl/barrier
1659 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
1662 # find out current role
1663 ovs-appctl -t ovs-ofctl ofctl/send 031800180000000200000000000000000000000000000000
1664 echo >>expout "send: OFPT_ROLE_REQUEST (OF1.2) (xid=0x2): role=nochange"
1665 echo >>expout "OFPT_ROLE_REPLY (OF1.2) (xid=0x2): role=equal"
1667 # Become slave (generation_id is initially undefined, so 2^63+2 should not be stale)
1668 ovs-appctl -t ovs-ofctl ofctl/send 031800180000000300000003000000008000000000000002
1669 echo >>expout "send: OFPT_ROLE_REQUEST (OF1.2) (xid=0x3): role=slave generation_id=9223372036854775810"
1670 echo >>expout "OFPT_ROLE_REPLY (OF1.2) (xid=0x3): role=slave generation_id=9223372036854775810"
1672 # Try to become the master using a stale generation ID
1673 ovs-appctl -t ovs-ofctl ofctl/send 031800180000000400000002000000000000000000000002
1674 echo >>expout "send: OFPT_ROLE_REQUEST (OF1.2) (xid=0x4): role=master generation_id=2"
1675 echo >>expout "OFPT_ERROR (OF1.2) (xid=0x4): OFPRRFC_STALE"
1676 echo >>expout "OFPT_ROLE_REQUEST (OF1.2) (xid=0x4): role=master generation_id=2"
1678 # Become master using a valid generation ID
1679 ovs-appctl -t ovs-ofctl ofctl/send 031800180000000500000002000000000000000000000001
1680 echo >>expout "send: OFPT_ROLE_REQUEST (OF1.2) (xid=0x5): role=master generation_id=1"
1681 echo >>expout "OFPT_ROLE_REPLY (OF1.2) (xid=0x5): role=master generation_id=1"
1682 ovs-appctl -t ovs-ofctl ofctl/barrier
1683 echo >>expout "OFPT_BARRIER_REPLY (OF1.2) (xid=0x3):"
1685 AT_CHECK([cat monitor.log], [0], [expout])
1687 ovs-appctl -t ovs-ofctl exit
1691 dnl This test checks that OFPT_PACKET_OUT accepts both OFPP_NONE (as
1692 dnl specified by OpenFlow 1.0) and OFPP_CONTROLLER (used by some
1693 dnl controllers despite the spec) as meaning a packet that was generated
1694 dnl by the controller.
1695 AT_SETUP([ofproto - packet-out from controller (OpenFlow 1.0)])
1697 ADD_OF_PORTS([br0], [1])
1699 # Start a monitor listening for packet-ins.
1700 AT_CHECK([ovs-ofctl -P openflow10 monitor br0 --detach --no-chdir --pidfile])
1701 ovs-appctl -t ovs-ofctl ofctl/send 0109000c0123456700000080
1702 ovs-appctl -t ovs-ofctl ofctl/barrier
1703 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
1704 AT_CAPTURE_FILE([monitor.log])
1706 # Send some packet-outs with OFPP_NONE and OFPP_CONTROLLER (65533) as in_port.
1707 AT_CHECK([ovs-ofctl packet-out br0 none controller,1 '0001020304050010203040501234'])
1708 AT_CHECK([ovs-ofctl packet-out br0 controller controller,1 '0001020304050010203040505678'])
1710 # Stop the monitor and check its output.
1711 ovs-appctl -t ovs-ofctl ofctl/barrier
1712 ovs-appctl -t ovs-ofctl exit
1714 ovs-ofctl dump-ports br0
1716 AT_CHECK([sed 's/ (xid=0x[[0-9a-fA-F]]*)//' monitor.log], [0], [dnl
1717 OFPT_PACKET_IN: total_len=14 in_port=ANY (via action) data_len=14 (unbuffered)
1718 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
1719 OFPT_PACKET_IN: total_len=14 in_port=CONTROLLER (via action) data_len=14 (unbuffered)
1720 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
1727 dnl This test checks that OFPT_PACKET_OUT accepts both OFPP_NONE (as
1728 dnl specified by OpenFlow 1.2) and OFPP_CONTROLLER (used by some
1729 dnl controllers despite the spec) as meaning a packet that was generated
1730 dnl by the controller.
1731 AT_SETUP([ofproto - packet-out from controller (OpenFlow 1.2)])
1734 # Start a monitor listening for packet-ins.
1735 AT_CHECK([ovs-ofctl -O OpenFlow12 monitor br0 --detach --no-chdir --pidfile])
1736 ovs-appctl -t ovs-ofctl ofctl/send 0309000c0123456700000080
1737 ovs-appctl -t ovs-ofctl ofctl/barrier
1738 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
1739 AT_CAPTURE_FILE([monitor.log])
1741 # Send some packet-outs with OFPP_NONE and OFPP_CONTROLLER (65533) as in_port.
1742 AT_CHECK([ovs-ofctl -O OpenFlow12 packet-out br0 none controller '0001020304050010203040501234'])
1743 AT_CHECK([ovs-ofctl -O OpenFlow12 packet-out br0 4294967293 controller '0001020304050010203040505678'])
1745 # Stop the monitor and check its output.
1746 ovs-appctl -t ovs-ofctl ofctl/barrier
1747 ovs-appctl -t ovs-ofctl exit
1749 AT_CHECK([sed 's/ (xid=0x[[0-9a-fA-F]]*)//' monitor.log], [0], [dnl
1750 OFPT_PACKET_IN (OF1.2): total_len=14 in_port=ANY (via action) data_len=14 (unbuffered)
1751 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
1752 OFPT_PACKET_IN (OF1.2): total_len=14 in_port=CONTROLLER (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=0x5678
1754 OFPT_BARRIER_REPLY (OF1.2):
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 (NXM)])
1765 # Start a monitor listening for packet-ins.
1766 AT_CHECK([ovs-ofctl -P nxm monitor br0 --detach --no-chdir --pidfile])
1767 ovs-appctl -t ovs-ofctl ofctl/send 0109000c0123456700000080
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 packet-out br0 controller 'load(0xfafafafa5a5a5a5a->OXM_OF_METADATA[[0..63]]), load(0xaa->NXM_NX_PKT_MARK[[]]), 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 NXT_PACKET_IN: total_len=14 in_port=CONTROLLER metadata=0xfafafafa5a5a5a5a pkt_mark=0xaa (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
1788 dnl This test checks that metadata is encoded in packet_in structures,
1789 dnl supported by NXAST.
1790 AT_SETUP([ofproto - packet-out with metadata (OpenFlow 1.2)])
1793 # Start a monitor listening for packet-ins.
1794 AT_CHECK([ovs-ofctl -O OpenFlow12 monitor br0 --detach --no-chdir --pidfile])
1795 ovs-appctl -t ovs-ofctl ofctl/send 0309000c0123456700000080
1796 ovs-appctl -t ovs-ofctl ofctl/barrier
1797 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
1798 AT_CAPTURE_FILE([monitor.log])
1800 # Send a packet-out with a load action to set some metadata, and forward to controller
1801 AT_CHECK([ovs-ofctl -O OpenFlow12 packet-out br0 none 'load(0xfafafafa5a5a5a5a->OXM_OF_METADATA[[0..63]]), controller' '0001020304050010203040501234'])
1803 # Stop the monitor and check its output.
1804 ovs-appctl -t ovs-ofctl ofctl/barrier
1805 ovs-appctl -t ovs-ofctl exit
1807 AT_CHECK([sed 's/ (xid=0x[[0-9a-fA-F]]*)//' monitor.log], [0], [dnl
1808 OFPT_PACKET_IN (OF1.2): total_len=14 in_port=ANY metadata=0xfafafafa5a5a5a5a (via action) data_len=14 (unbuffered)
1809 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
1810 OFPT_BARRIER_REPLY (OF1.2):
1816 dnl This test checks that tunnel metadata is encoded in packet_in structures.
1817 AT_SETUP([ofproto - packet-out with tunnel metadata (OpenFlow 1.2)])
1820 # Start a monitor listening for packet-ins.
1821 AT_CHECK([ovs-ofctl -O OpenFlow12 monitor br0 --detach --no-chdir --pidfile])
1822 ovs-appctl -t ovs-ofctl ofctl/send 0309000c0123456700000080
1823 ovs-appctl -t ovs-ofctl ofctl/barrier
1824 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
1825 AT_CAPTURE_FILE([monitor.log])
1827 # Send a packet-out with set field actions to set some tunnel metadata, and forward to controller
1828 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'])
1830 # Stop the monitor and check its output.
1831 ovs-appctl -t ovs-ofctl ofctl/barrier
1832 ovs-appctl -t ovs-ofctl exit
1834 AT_CHECK([sed 's/ (xid=0x[[0-9a-fA-F]]*)//' monitor.log], [0], [dnl
1835 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)
1836 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
1837 OFPT_BARRIER_REPLY (OF1.2):
1843 AT_SETUP([ofproto - flow monitoring])
1844 AT_KEYWORDS([monitor])
1847 ovs-ofctl add-flow br0 in_port=0,dl_vlan=123,actions=output:1
1849 # Start a monitor watching the flow table and check the initial reply.
1850 ovs-ofctl monitor br0 watch: --detach --no-chdir --pidfile >monitor.log 2>&1
1851 AT_CAPTURE_FILE([monitor.log])
1852 ovs-appctl -t ovs-ofctl ofctl/barrier
1853 AT_CHECK([sed 's/ (xid=0x[[1-9a-fA-F]][[0-9a-fA-F]]*)//' monitor.log], [0],
1854 [NXST_FLOW_MONITOR reply:
1855 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=123 actions=output:1
1859 # Add, delete, and modify some flows and check the updates.
1860 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
1861 ovs-ofctl add-flow br0 in_port=0,dl_vlan=124,actions=output:2
1862 ovs-ofctl add-flow br0 in_port=0,dl_vlan=123,actions=output:5
1863 ovs-ofctl add-flow br0 in_port=0,dl_vlan=123,dl_vlan_pcp=0,actions=output:6
1864 ovs-ofctl add-flow br0 in_port=0,dl_vlan=123,dl_vlan_pcp=1,actions=output:7
1865 ovs-ofctl add-flow br0 in_port=0,dl_vlan=123,actions=output:8
1866 ovs-ofctl add-flow br0 in_port=0,dl_vlan=65535,dl_vlan_pcp=0,actions=output:9
1867 ovs-ofctl add-flow br0 in_port=0,dl_vlan=65535,dl_vlan_pcp=1,actions=output:10
1868 ovs-ofctl add-flow br0 in_port=0,dl_vlan=65535,actions=output:11
1869 ovs-ofctl add-flow br0 in_port=0,dl_vlan=8191,dl_vlan_pcp=0,actions=output:12
1870 ovs-ofctl add-flow br0 in_port=0,dl_vlan=8191,dl_vlan_pcp=1,actions=output:13
1871 ovs-ofctl add-flow br0 in_port=0,dl_vlan=8191,actions=output:14
1872 ovs-ofctl add-flow br0 in_port=0,dl_vlan=0,dl_vlan_pcp=0,actions=output:15
1873 ovs-ofctl add-flow br0 in_port=0,dl_vlan=0,dl_vlan_pcp=1,actions=output:16
1874 ovs-ofctl add-flow br0 in_port=0,dl_vlan=0,actions=output:17
1875 ovs-ofctl add-flow br0 in_port=0,dl_vlan=0,dl_vlan_pcp=0,actions=output:18
1876 ovs-ofctl add-flow br0 in_port=0,dl_vlan=0,dl_vlan_pcp=1,actions=output:19
1877 ovs-ofctl add-flow br0 in_port=0,dl_vlan=0,actions=output:20
1878 ovs-ofctl add-flow br0 in_port=0,dl_vlan_pcp=0,actions=output:21
1879 ovs-ofctl add-flow br0 in_port=0,dl_vlan_pcp=1,actions=output:22
1880 ovs-ofctl add-flow br0 in_port=0,actions=output:23
1881 ovs-ofctl mod-flows br0 cookie=5,dl_vlan=123,actions=output:3
1882 ovs-ofctl del-flows br0 dl_vlan=123
1883 ovs-ofctl del-flows br0
1884 ovs-appctl -t ovs-ofctl ofctl/barrier
1886 # Sorts groups of lines that start with a space, without moving them
1887 # past the nearest line that does not start with a space.
1895 print $_ foreach sort(@buffer);
1900 print $_ foreach sort(@buffer);
1902 AT_CHECK([sed 's/ (xid=0x[[1-9a-fA-F]][[0-9a-fA-F]]*)//' monitor.log | ${PERL} -e "$sort"], [0],
1903 [NXST_FLOW_MONITOR reply (xid=0x0):
1904 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=124 actions=output:2
1905 NXST_FLOW_MONITOR reply (xid=0x0):
1906 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=123 actions=output:5
1907 NXST_FLOW_MONITOR reply (xid=0x0):
1908 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=123,dl_vlan_pcp=0 actions=output:6
1909 NXST_FLOW_MONITOR reply (xid=0x0):
1910 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=123,dl_vlan_pcp=1 actions=output:7
1911 NXST_FLOW_MONITOR reply (xid=0x0):
1912 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=123 actions=output:8
1913 NXST_FLOW_MONITOR reply (xid=0x0):
1914 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=0,dl_vlan_pcp=0 actions=output:9
1915 NXST_FLOW_MONITOR reply (xid=0x0):
1916 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=0,dl_vlan_pcp=1 actions=output:10
1917 NXST_FLOW_MONITOR reply (xid=0x0):
1918 event=ADDED table=0 cookie=0 in_port=0,vlan_tci=0x0000 actions=output:11
1919 NXST_FLOW_MONITOR reply (xid=0x0):
1920 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=4095,dl_vlan_pcp=0 actions=output:12
1921 NXST_FLOW_MONITOR reply (xid=0x0):
1922 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=4095,dl_vlan_pcp=1 actions=output:13
1923 NXST_FLOW_MONITOR reply (xid=0x0):
1924 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=4095 actions=output:14
1925 NXST_FLOW_MONITOR reply (xid=0x0):
1926 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=0,dl_vlan_pcp=0 actions=output:15
1927 NXST_FLOW_MONITOR reply (xid=0x0):
1928 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=0,dl_vlan_pcp=1 actions=output:16
1929 NXST_FLOW_MONITOR reply (xid=0x0):
1930 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=0 actions=output:17
1931 NXST_FLOW_MONITOR reply (xid=0x0):
1932 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=0,dl_vlan_pcp=0 actions=output:18
1933 NXST_FLOW_MONITOR reply (xid=0x0):
1934 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=0,dl_vlan_pcp=1 actions=output:19
1935 NXST_FLOW_MONITOR reply (xid=0x0):
1936 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=0 actions=output:20
1937 NXST_FLOW_MONITOR reply (xid=0x0):
1938 event=ADDED table=0 cookie=0 in_port=0,dl_vlan_pcp=0 actions=output:21
1939 NXST_FLOW_MONITOR reply (xid=0x0):
1940 event=ADDED table=0 cookie=0 in_port=0,dl_vlan_pcp=1 actions=output:22
1941 NXST_FLOW_MONITOR reply (xid=0x0):
1942 event=ADDED table=0 cookie=0 in_port=0 actions=output:23
1943 NXST_FLOW_MONITOR reply (xid=0x0):
1944 event=MODIFIED table=0 cookie=0x5 in_port=0,dl_vlan=123 actions=output:3
1945 event=MODIFIED table=0 cookie=0x5 in_port=0,dl_vlan=123,dl_vlan_pcp=0 actions=output:3
1946 event=MODIFIED table=0 cookie=0x5 in_port=0,dl_vlan=123,dl_vlan_pcp=1 actions=output:3
1947 NXST_FLOW_MONITOR reply (xid=0x0):
1948 event=DELETED reason=delete table=0 cookie=0x5 in_port=0,dl_vlan=123 actions=output:3
1949 event=DELETED reason=delete table=0 cookie=0x5 in_port=0,dl_vlan=123,dl_vlan_pcp=0 actions=output:3
1950 event=DELETED reason=delete table=0 cookie=0x5 in_port=0,dl_vlan=123,dl_vlan_pcp=1 actions=output:3
1951 NXST_FLOW_MONITOR reply (xid=0x0):
1952 event=DELETED reason=delete table=0 cookie=0 in_port=0 actions=output:23
1953 event=DELETED reason=delete table=0 cookie=0 in_port=0,dl_vlan=0 actions=output:20
1954 event=DELETED reason=delete table=0 cookie=0 in_port=0,dl_vlan=0,dl_vlan_pcp=0 actions=output:18
1955 event=DELETED reason=delete table=0 cookie=0 in_port=0,dl_vlan=0,dl_vlan_pcp=1 actions=output:19
1956 event=DELETED reason=delete table=0 cookie=0 in_port=0,dl_vlan=124 actions=output:2
1957 event=DELETED reason=delete table=0 cookie=0 in_port=0,dl_vlan=4095 actions=output:14
1958 event=DELETED reason=delete table=0 cookie=0 in_port=0,dl_vlan=4095,dl_vlan_pcp=0 actions=output:12
1959 event=DELETED reason=delete table=0 cookie=0 in_port=0,dl_vlan=4095,dl_vlan_pcp=1 actions=output:13
1960 event=DELETED reason=delete table=0 cookie=0 in_port=0,dl_vlan_pcp=0 actions=output:21
1961 event=DELETED reason=delete table=0 cookie=0 in_port=0,dl_vlan_pcp=1 actions=output:22
1962 event=DELETED reason=delete table=0 cookie=0 in_port=0,vlan_tci=0x0000 actions=output:11
1966 # Check that our own changes are reported as abbreviations.
1967 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
1968 ovs-ofctl add-flow br0 in_port=1,actions=output:2
1969 ovs-ofctl add-flow br0 in_port=2,actions=output:1
1970 ovs-appctl -t ovs-ofctl ofctl/barrier
1971 ovs-appctl -t ovs-ofctl ofctl/send 010e004812345678003fffff00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003000000000000ffffffffffff0000
1972 ovs-appctl -t ovs-ofctl ofctl/barrier
1973 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip], [0], [NXST_FLOW reply:
1975 AT_CHECK([sed 's/ (xid=0x[[1-9a-fA-F]][[0-9a-fA-F]]*)//' monitor.log], [0],
1976 [NXST_FLOW_MONITOR reply (xid=0x0):
1977 event=ADDED table=0 cookie=0 in_port=1 actions=output:2
1978 NXST_FLOW_MONITOR reply (xid=0x0):
1979 event=ADDED table=0 cookie=0 in_port=2 actions=output:1
1981 send: OFPT_FLOW_MOD: DEL priority=0 actions=drop
1982 NXST_FLOW_MONITOR reply (xid=0x0):
1983 event=ABBREV xid=0x12345678
1987 ovs-appctl -t ovs-ofctl exit
1991 AT_SETUP([ofproto - flow monitoring pause and resume])
1992 AT_KEYWORDS([monitor])
1994 # The maximum socket receive buffer size is important for this test, which
1995 # tests behavior when the receive buffer overflows.
1996 if test -e /proc/sys/net/core/rmem_max; then
1998 rmem_max=`cat /proc/sys/net/core/rmem_max`
1999 elif rmem_max=`sysctl -n net.inet.tcp.recvbuf_max 2>/dev/null`; then
2002 # Don't know how to get maximum socket receive buffer on this OS
2005 # Calculate the total amount of queuing: rmem_max in the kernel, 128 kB
2006 # in ofproto sending userspace (see ofmonitor_flush() in connmgr.c).
2007 queue_size=`expr $rmem_max + 128 \* 1024`
2008 echo rmem_max=$rmem_max queue_size=$queue_size
2010 # Each flow update message takes up at least 48 bytes of space in queues
2011 # and in practice more than that.
2012 n_msgs=`expr $queue_size / 48`
2017 # Start a monitor watching the flow table, then make it block.
2018 ON_EXIT([kill `cat ovs-ofctl.pid`])
2019 ovs-ofctl monitor br0 watch: --detach --no-chdir --pidfile >monitor.log 2>&1
2020 AT_CAPTURE_FILE([monitor.log])
2021 ovs-appctl -t ovs-ofctl ofctl/block
2023 # Add $n_msgs flows.
2024 (echo "in_port=2,actions=output:2"
2026 for ($i = 0; $i < '$n_msgs'; $i++) {
2027 print "cookie=1,reg1=$i,actions=drop\n";
2030 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
2031 # Check that multipart flow dumps work properly:
2032 AT_CHECK([ovs-ofctl diff-flows br0 flows.txt])
2033 AT_CHECK([ovs-ofctl add-flow br0 in_port=1,cookie=3,actions=drop])
2034 AT_CHECK([ovs-ofctl mod-flows br0 in_port=2,cookie=2,actions=output:2])
2035 AT_CHECK([ovs-ofctl del-flows br0 cookie=1/-1])
2037 ovs-appctl -t ovs-ofctl ofctl/unblock
2038 ovs-appctl -t ovs-ofctl ofctl/barrier
2040 ovs-appctl -t ovs-ofctl exit
2042 # Check that the flow monitor reported the same number of flows
2043 # added and deleted, but fewer than we actually added and deleted.
2044 adds=`grep -c 'ADDED.*reg1=' monitor.log`
2045 deletes=`grep -c 'DELETED.*reg1=' monitor.log`
2046 echo adds=$adds deletes=$deletes
2047 AT_CHECK([test $adds -gt 100 && test $adds -lt $n_msgs])
2048 AT_CHECK([test $adds = $deletes])
2050 # Check that the flow monitor reported everything in the expected order:
2052 # event=ADDED table=0 cookie=0x1 reg1=0x22
2054 # NXT_FLOW_MONITOR_PAUSED:
2056 # event=DELETED reason=delete table=0 cookie=0x1 reg1=0x22
2058 # event=ADDED table=0 cookie=0x3 in_port=1
2059 # event=MODIFIED table=0 cookie=0x2 in_port=2 actions=output:2
2060 # NXT_FLOW_MONITOR_RESUMED:
2062 # except that, between the PAUSED and RESUMED, the order of the ADDED
2063 # and MODIFIED lines lines depends on hash order, that is, it varies
2064 # as we change the hash function or change architecture. Therefore,
2065 # we use a couple of tests below to accept both orders.
2066 AT_CHECK([ofctl_strip < monitor.log | sed -n -e '
2069 /NXT_FLOW_MONITOR_PAUSED:/p
2070 /NXT_FLOW_MONITOR_RESUMED:/p
2071 ' > monitor.log.subset])
2072 AT_CHECK([grep -v MODIFIED monitor.log.subset], [0], [dnl
2073 event=ADDED table=0 cookie=0x1 reg1=0x22
2074 NXT_FLOW_MONITOR_PAUSED:
2075 event=DELETED reason=delete table=0 cookie=0x1 reg1=0x22
2076 event=ADDED table=0 cookie=0x3 in_port=1
2077 NXT_FLOW_MONITOR_RESUMED:
2079 AT_CHECK([grep -v ADDED monitor.log.subset], [0], [dnl
2080 NXT_FLOW_MONITOR_PAUSED:
2081 event=DELETED reason=delete table=0 cookie=0x1 reg1=0x22
2082 event=MODIFIED table=0 cookie=0x2 in_port=2 actions=output:2
2083 NXT_FLOW_MONITOR_RESUMED:
2089 AT_SETUP([ofproto - event filtering (OpenFlow 1.3)])
2090 AT_KEYWORDS([monitor])
2093 # Start a monitor, use the required protocol version
2094 ovs-ofctl -O OpenFlow13 monitor br0 --detach --no-chdir --pidfile >monitor.log 2>&1
2095 AT_CAPTURE_FILE([monitor.log])
2097 # Send an OpenFlow13 message (04), OFPT_GET_ASYNC_REQUEST (1a), length (8), xid (0a)
2098 ovs-appctl -t ovs-ofctl ofctl/send 041a00080000000a
2099 ovs-appctl -t ovs-ofctl ofctl/barrier
2101 # Check default setting
2102 read -r -d '' expected <<'EOF'
2105 AT_CHECK([ofctl_strip < monitor.log], [], [dnl
2106 send: OFPT_GET_ASYNC_REQUEST (OF1.3):
2107 OFPT_GET_ASYNC_REPLY (OF1.3):
2109 PACKET_IN: no_match action
2110 PORT_STATUS: add delete modify
2111 FLOW_REMOVED: idle hard delete
2115 PORT_STATUS: add delete modify
2117 OFPT_BARRIER_REPLY (OF1.3):