3 AT_SETUP([ofproto - echo request])
5 AT_CHECK([ovs-ofctl -vwarn probe br0])
9 AT_SETUP([ofproto - handling messages with bad version])
12 # Start a monitor running OpenFlow 1.0, then send the switch an OF1.1 features
14 AT_CHECK([ovs-ofctl -P openflow10 monitor br0 --detach --no-chdir --pidfile])
15 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
16 AT_CAPTURE_FILE([monitor.log])
17 ovs-appctl -t ovs-ofctl ofctl/send 0205000801234567
18 ovs-appctl -t ovs-ofctl ofctl/barrier
19 ovs-appctl -t ovs-ofctl exit
21 AT_CHECK([sed 's/ (xid=0x[[0-9a-fA-F]]*)//
22 /ECHO/d' monitor.log], [0], [dnl
23 send: OFPT_FEATURES_REQUEST (OF1.1):
24 OFPT_ERROR (OF1.1): OFPBRC_BAD_VERSION
25 OFPT_FEATURES_REQUEST (OF1.1):
29 OVS_VSWITCHD_STOP(["/received OpenFlow version 0x02 != expected 01/d"])
32 AT_SETUP([ofproto - feature request, config request])
34 AT_CHECK([ovs-ofctl -vwarn show br0], [0], [stdout])
35 AT_CHECK([STRIP_XIDS stdout], [0], [dnl
36 OFPT_FEATURES_REPLY: dpid:fedcba9876543210
37 n_tables:254, n_buffers:256
38 capabilities: FLOW_STATS TABLE_STATS PORT_STATS QUEUE_STATS ARP_MATCH_IP
39 actions: output enqueue set_vlan_vid set_vlan_pcp strip_vlan mod_dl_src mod_dl_dst mod_nw_src mod_nw_dst mod_nw_tos mod_tp_src mod_tp_dst
40 LOCAL(br0): addr:aa:55:aa:55:00:00
43 speed: 0 Mbps now, 0 Mbps max
44 OFPT_GET_CONFIG_REPLY: frags=normal miss_send_len=0
49 AT_SETUP([ofproto - set OpenFlow port number])
51 [add-port br0 p1 -- set Interface p1 type=dummy --\
52 add-port br0 p2 -- set Interface p2 type=dummy ofport_request=99])
53 AT_CHECK([ovs-ofctl -vwarn show br0], [0], [stdout])
55 s/ (xid=0x[0-9a-fA-F]*)//
56 s/00:0.$/00:0x/' < stdout]],
58 OFPT_FEATURES_REPLY: dpid:fedcba9876543210
59 n_tables:254, n_buffers:256
60 capabilities: FLOW_STATS TABLE_STATS PORT_STATS QUEUE_STATS ARP_MATCH_IP
61 actions: output enqueue set_vlan_vid set_vlan_pcp strip_vlan mod_dl_src mod_dl_dst mod_nw_src mod_nw_dst mod_nw_tos mod_tp_src mod_tp_dst
62 1(p1): addr:aa:55:aa:55:00:0x
65 speed: 0 Mbps now, 0 Mbps max
66 99(p2): addr:aa:55:aa:55:00:0x
69 speed: 0 Mbps now, 0 Mbps max
70 LOCAL(br0): addr:aa:55:aa:55:00:0x
73 speed: 0 Mbps now, 0 Mbps max
74 OFPT_GET_CONFIG_REPLY: frags=normal miss_send_len=0
80 dnl This is really bare-bones.
81 dnl It at least checks request and reply serialization and deserialization.
82 AT_SETUP([ofproto - port stats - (OpenFlow 1.0)])
84 AT_CHECK([ovs-ofctl -vwarn dump-ports br0], [0], [stdout])
85 AT_CHECK([STRIP_XIDS stdout], [0], [dnl
86 OFPST_PORT reply: 1 ports
87 port LOCAL: rx pkts=0, bytes=0, drop=0, errs=0, frame=0, over=0, crc=0
88 tx pkts=0, bytes=0, drop=0, errs=0, coll=0
93 AT_SETUP([ofproto - port stats - (OpenFlow 1.2)])
95 AT_CHECK([ovs-ofctl -O OpenFlow12 -vwarn dump-ports br0], [0], [stdout])
96 AT_CHECK([STRIP_XIDS stdout], [0], [dnl
97 OFPST_PORT reply (OF1.2): 1 ports
98 port LOCAL: rx pkts=0, bytes=0, drop=0, errs=0, frame=0, over=0, crc=0
99 tx pkts=0, bytes=0, drop=0, errs=0, coll=0
104 AT_SETUP([ofproto - port stats - (OpenFlow 1.4)])
106 AT_CHECK([ovs-ofctl -O OpenFlow14 -vwarn dump-ports br0], [0], [stdout])
107 AT_CHECK([STRIP_XIDS stdout | sed 's/duration=[[0-9.]]*s/duration=?s/'],
109 OFPST_PORT reply (OF1.4): 1 ports
110 port LOCAL: rx pkts=0, bytes=0, drop=0, errs=0, frame=0, over=0, crc=0
111 tx pkts=0, bytes=0, drop=0, errs=0, coll=0
117 dnl This is really bare-bones.
118 dnl It at least checks request and reply serialization and deserialization.
119 AT_SETUP([ofproto - port-desc stats (OpenFlow 1.0)])
121 AT_CHECK([ovs-ofctl -vwarn dump-ports-desc br0], [0], [stdout])
122 AT_CHECK([STRIP_XIDS stdout], [0], [dnl
123 OFPST_PORT_DESC reply:
124 LOCAL(br0): addr:aa:55:aa:55:00:00
127 speed: 0 Mbps now, 0 Mbps max
132 dnl This is really bare-bones.
133 dnl It at least checks request and reply serialization and deserialization.
134 AT_SETUP([ofproto - port-desc stats (OpenFlow 1.2)])
136 AT_CHECK([ovs-ofctl -O OpenFlow12 -vwarn dump-ports-desc br0], [0], [stdout])
137 AT_CHECK([STRIP_XIDS stdout], [0], [dnl
138 OFPST_PORT_DESC reply (OF1.2):
139 LOCAL(br0): addr:aa:55:aa:55:00:00
142 speed: 0 Mbps now, 0 Mbps max
147 AT_SETUP([ofproto - port-desc stats (OpenFlow 1.5)])
149 ADD_OF_PORTS([br0], 1, 2, 3)
150 AT_CHECK([ovs-ofctl -F OXM-OpenFlow15 -O OpenFlow15 -vwarn dump-ports-desc br0], [0], [stdout])
151 AT_CHECK([STRIP_XIDS stdout | sed 's/00:0./00:0x/'], [0], [dnl
152 OFPST_PORT_DESC reply (OF1.5):
153 1(p1): addr:aa:55:aa:55:00:0x
156 speed: 0 Mbps now, 0 Mbps max
157 2(p2): addr:aa:55:aa:55:00:0x
160 speed: 0 Mbps now, 0 Mbps max
161 3(p3): addr:aa:55:aa:55:00:0x
164 speed: 0 Mbps now, 0 Mbps max
165 LOCAL(br0): addr:aa:55:aa:55:00:0x
168 speed: 0 Mbps now, 0 Mbps max
170 AT_CHECK([ovs-ofctl -F OXM-OpenFlow15 -O OpenFlow15 -vwarn dump-ports-desc br0 2], [0], [stdout])
171 AT_CHECK([STRIP_XIDS stdout | sed 's/00:0./00:0x/'], [0], [dnl
172 OFPST_PORT_DESC reply (OF1.5):
173 2(p2): addr:aa:55:aa:55:00:0x
176 speed: 0 Mbps now, 0 Mbps max
181 dnl This is really bare-bones.
182 dnl It at least checks request and reply serialization and deserialization.
183 AT_SETUP([ofproto - queue stats - (OpenFlow 1.0)])
185 AT_CHECK([ovs-ofctl -vwarn queue-stats br0], [0], [stdout])
186 AT_CHECK([STRIP_XIDS stdout], [0], [dnl
187 OFPST_QUEUE reply: 0 queues
189 AT_CHECK([ovs-ofctl -vwarn queue-stats br0 ANY 5], [0],
190 [OFPT_ERROR (xid=0x2): OFPQOFC_BAD_QUEUE
191 OFPST_QUEUE request (xid=0x2):port=ANY queue=5
193 AT_CHECK([ovs-ofctl -vwarn queue-stats br0 10], [0],
194 [OFPT_ERROR (xid=0x2): OFPQOFC_BAD_PORT
195 OFPST_QUEUE request (xid=0x2):port=10 queue=ALL
200 AT_SETUP([ofproto - queue stats - (OpenFlow 1.2)])
202 AT_CHECK([ovs-ofctl -O OpenFlow12 -vwarn queue-stats br0], [0], [stdout])
203 AT_CHECK([STRIP_XIDS stdout], [0], [dnl
204 OFPST_QUEUE reply (OF1.2): 0 queues
206 AT_CHECK([ovs-ofctl -O OpenFlow12 -vwarn queue-stats br0 ALL 5], [0],
207 [OFPT_ERROR (OF1.2) (xid=0x2): OFPQOFC_BAD_QUEUE
208 OFPST_QUEUE request (OF1.2) (xid=0x2):port=ANY queue=5
210 AT_CHECK([ovs-ofctl -O OpenFlow12 -vwarn queue-stats br0 10], [0],
211 [OFPT_ERROR (OF1.2) (xid=0x2): OFPQOFC_BAD_PORT
212 OFPST_QUEUE request (OF1.2) (xid=0x2):port=10 queue=ALL
217 AT_SETUP([ofproto - queue stats - (OpenFlow 1.4)])
219 AT_CHECK([ovs-ofctl -O OpenFlow14 -vwarn queue-stats br0], [0], [stdout])
220 AT_CHECK([STRIP_XIDS stdout], [0], [dnl
221 OFPST_QUEUE reply (OF1.4): 0 queues
223 AT_CHECK([ovs-ofctl -O OpenFlow14 -vwarn queue-stats br0 ALL 5], [0],
224 [OFPT_ERROR (OF1.4) (xid=0x2): OFPQOFC_BAD_QUEUE
225 OFPST_QUEUE request (OF1.4) (xid=0x2):port=ANY queue=5
227 AT_CHECK([ovs-ofctl -O OpenFlow14 -vwarn queue-stats br0 10], [0],
228 [OFPT_ERROR (OF1.4) (xid=0x2): OFPQOFC_BAD_PORT
229 OFPST_QUEUE request (OF1.4) (xid=0x2):port=10 queue=ALL
234 dnl This is really bare-bones.
235 dnl It at least checks request and reply serialization and deserialization.
236 AT_SETUP([ofproto - queue configuration - (OpenFlow 1.0)])
238 ADD_OF_PORTS([br0], [1], [2])
239 AT_CHECK([ovs-ofctl queue-get-config br0 1], [0], [stdout])
240 AT_CHECK([STRIP_XIDS stdout], [0], [dnl
241 OFPT_QUEUE_GET_CONFIG_REPLY: port=1
243 AT_CHECK([ovs-ofctl queue-get-config br0], [0], [stdout])
244 AT_CHECK([STRIP_XIDS stdout | sort], [0], [dnl
245 OFPT_QUEUE_GET_CONFIG_REPLY: port=1
246 OFPT_QUEUE_GET_CONFIG_REPLY: port=2
248 AT_CHECK([ovs-ofctl queue-get-config br0 10], [0],
249 [OFPT_ERROR (xid=0x2): OFPQOFC_BAD_PORT
250 OFPT_QUEUE_GET_CONFIG_REQUEST (xid=0x2): port=10
255 AT_SETUP([ofproto - queue configuration - (OpenFlow 1.2)])
257 ADD_OF_PORTS([br0], [1], [2])
258 AT_CHECK([ovs-ofctl -O OpenFlow12 queue-get-config br0 1], [0], [stdout])
259 AT_CHECK([STRIP_XIDS stdout], [0], [dnl
260 OFPT_QUEUE_GET_CONFIG_REPLY (OF1.2): port=1
262 AT_CHECK([ovs-ofctl -O OpenFlow12 queue-get-config br0 ANY], [0], [stdout])
263 AT_CHECK([STRIP_XIDS stdout], [0], [dnl
264 OFPT_QUEUE_GET_CONFIG_REPLY (OF1.2): port=ANY
266 AT_CHECK([ovs-ofctl -O OpenFlow12 queue-get-config br0 10], [0],
267 [OFPT_ERROR (OF1.2) (xid=0x2): OFPQOFC_BAD_PORT
268 OFPT_QUEUE_GET_CONFIG_REQUEST (OF1.2) (xid=0x2): port=10
273 dnl This is really bare-bones.
274 dnl It at least checks request and reply serialization and deserialization.
275 dnl Actions definition listed in both supported formats (w/ actions=)
276 AT_SETUP([ofproto - no group support (OpenFlow 1.0)])
278 AT_DATA([groups.txt], [dnl
279 group_id=1234,type=all,bucket=output:10
280 group_id=1235,type=all,bucket=actions=output:10
282 AT_DATA([stderr], [dnl
283 ovs-ofctl: none of the usable flow formats (OXM,OpenFlow11) is among the allowed flow formats (OpenFlow10,NXM)
285 AT_CHECK([ovs-ofctl -O OpenFlow10 -vwarn add-groups br0 groups.txt], [1], ,[stderr])
286 AT_CHECK([ovs-ofctl -O OpenFlow10 -vwarn mod-group br0 'group_id=1234,type=all,bucket=output:10'], [1], ,[stderr])
287 AT_CHECK([ovs-ofctl -O OpenFlow10 -vwarn del-groups br0], [1], ,[stderr])
288 AT_CHECK([ovs-ofctl -O OpenFlow10 -vwarn dump-groups br0 ], [1], ,[stderr])
292 dnl This is really bare-bones.
293 dnl It at least checks request and reply serialization and deserialization.
294 dnl Actions definition listed in both supported formats (w/ actions=)
295 AT_SETUP([ofproto - del group (OpenFlow 1.1)])
297 AT_DATA([groups.txt], [dnl
298 group_id=1234,type=all,bucket=output:10
299 group_id=1235,type=all,bucket=actions=output:10
301 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn add-groups br0 groups.txt])
302 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn dump-groups br0 ], [0], [stdout])
303 AT_CHECK([STRIP_XIDS stdout], [0], [dnl
304 OFPST_GROUP_DESC reply (OF1.1):
305 group_id=1234,type=all,bucket=actions=output:10
306 group_id=1235,type=all,bucket=actions=output:10
308 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn del-groups br0 group_id=1234])
309 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn dump-groups br0], [0], [stdout])
310 AT_CHECK([STRIP_XIDS stdout], [0], [dnl
311 OFPST_GROUP_DESC reply (OF1.1):
312 group_id=1235,type=all,bucket=actions=output:10
314 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn del-groups br0 group_id=1234])
315 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn dump-groups br0], [0], [stdout])
316 AT_CHECK([STRIP_XIDS stdout], [0], [dnl
317 OFPST_GROUP_DESC reply (OF1.1):
318 group_id=1235,type=all,bucket=actions=output:10
320 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn del-groups br0], [0])
321 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn dump-groups br0], [0], [stdout])
322 AT_CHECK([STRIP_XIDS stdout], [0], [dnl
323 OFPST_GROUP_DESC reply (OF1.1):
327 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn del-groups br0 group_id=0xfffffff0],
328 [1], [], [ovs-ofctl: invalid group id 4294967280
333 dnl This is really bare-bones.
334 dnl It at least checks request and reply serialization and deserialization.
335 dnl Actions definition listed in both supported formats (w/ actions=)
336 AT_SETUP([ofproto - add indirect group])
338 dnl indirect group must have exactly one bucket
339 AT_DATA([stderr], [dnl
340 OFPT_ERROR (OF1.1) (xid=0x2): OFPGMFC_INVALID_GROUP
341 OFPT_GROUP_MOD (OF1.1) (xid=0x2): ***decode error: OFPGMFC_INVALID_GROUP***
343 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn add-group br0 'group_id=1234,type=indirect'], [1], , [stderr])
344 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn add-group br0 'group_id=1235,type=indirect,bucket=output:10'])
345 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn add-group br0 'group_id=1236,type=indirect,bucket=output:10,bucket=output:11'], [1], , [stderr])
349 dnl This is really bare-bones.
350 dnl It at least checks request and reply serialization and deserialization.
351 dnl Actions definition listed in both supported formats (w/ actions=)
352 AT_SETUP([ofproto - del group (OpenFlow 1.5)])
354 AT_DATA([groups.txt], [dnl
355 group_id=1233,type=select,selection_method=hash,bucket=output:10,bucket=output:11
356 group_id=1234,type=select,selection_method=hash,fields(eth_dst,ip_dst,tcp_dst),bucket=output:10,bucket=output:11
357 group_id=1235,type=all,bucket=actions=output:12,bucket=bucket_id:0,actions=output:10,bucket=bucket_id:1,actions=output:11
359 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn add-groups br0 groups.txt])
360 AT_CHECK([ovs-ofctl -F OXM-OpenFlow15 -O OpenFlow15 -vwarn dump-groups br0 1234], [0], [stdout])
361 AT_CHECK([STRIP_XIDS stdout], [0], [dnl
362 OFPST_GROUP_DESC reply (OF1.5):
363 group_id=1234,type=select,selection_method=hash,fields(eth_dst,ip_dst,tcp_dst),bucket=bucket_id:0,actions=output:10,bucket=bucket_id:1,actions=output:11
365 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn del-groups br0 group_id=1234])
366 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn dump-groups br0], [0], [stdout])
367 AT_CHECK([STRIP_XIDS stdout], [0], [dnl
368 OFPST_GROUP_DESC reply (OF1.5):
369 group_id=1235,type=all,bucket=bucket_id:2,actions=output:12,bucket=bucket_id:0,actions=output:10,bucket=bucket_id:1,actions=output:11
370 group_id=1233,type=select,selection_method=hash,bucket=bucket_id:0,actions=output:10,bucket=bucket_id:1,actions=output:11
372 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn del-groups br0 group_id=1234])
373 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn dump-groups br0], [0], [stdout])
374 AT_CHECK([STRIP_XIDS stdout], [0], [dnl
375 OFPST_GROUP_DESC reply (OF1.5):
376 group_id=1235,type=all,bucket=bucket_id:2,actions=output:12,bucket=bucket_id:0,actions=output:10,bucket=bucket_id:1,actions=output:11
377 group_id=1233,type=select,selection_method=hash,bucket=bucket_id:0,actions=output:10,bucket=bucket_id:1,actions=output:11
379 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn del-groups br0], [0])
380 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn dump-groups br0], [0], [stdout])
381 AT_CHECK([STRIP_XIDS stdout], [0], [dnl
382 OFPST_GROUP_DESC reply (OF1.5):
387 dnl This is really bare-bones.
388 dnl It at least checks request and reply serialization and deserialization.
389 AT_SETUP([ofproto - del group deletes flows])
391 AT_DATA([groups.txt], [dnl
392 group_id=1234,type=all,bucket=output:10
393 group_id=1235,type=all,bucket=output:10
395 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn add-groups br0 groups.txt])
396 AT_DATA([flows.txt], [dnl
397 tcp actions=group:1234
398 table=2 udp actions=group:1235
400 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn add-flows br0 flows.txt])
401 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn dump-flows br0 | ofctl_strip | sort],
403 table=2, udp actions=group:1235
404 tcp actions=group:1234
405 OFPST_FLOW reply (OF1.1):
407 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn del-groups br0 group_id=1234])
408 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn dump-flows br0 | ofctl_strip | sort],
410 table=2, udp actions=group:1235
411 OFPST_FLOW reply (OF1.1):
413 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn del-groups br0 group_id=1234])
414 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn dump-flows br0 | ofctl_strip | sort],
416 table=2, udp actions=group:1235
417 OFPST_FLOW reply (OF1.1):
419 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn del-groups br0])
420 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn dump-flows br0 | ofctl_strip | sort],
422 OFPST_FLOW reply (OF1.1):
427 dnl This is really bare-bones.
428 dnl It at least checks request and reply serialization and deserialization.
429 dnl Actions definition listed in both supported formats (w/ actions=)
430 AT_SETUP([ofproto - insert buckets])
432 # Add group with no buckets.
433 AT_DATA([groups.txt], [dnl
434 group_id=1234,type=all
436 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn add-groups br0 groups.txt])
437 AT_CHECK([ovs-ofctl -F OXM-OpenFlow15 -O OpenFlow15 -vwarn dump-groups br0 1234], [0], [stdout])
438 AT_CHECK([STRIP_XIDS stdout], [0], [dnl
439 OFPST_GROUP_DESC reply (OF1.5):
440 group_id=1234,type=all
443 # Add two buckets, using "last".
444 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn insert-buckets br0 group_id=1234,command_bucket_id=last,bucket=bucket_id:10,actions=output:10,bucket=bucket_id:11,actions=output:11])
445 AT_CHECK([ovs-ofctl -F OXM-OpenFlow15 -O OpenFlow15 -vwarn dump-groups br0 1234], [0], [stdout])
446 AT_CHECK([STRIP_XIDS stdout], [0], [dnl
447 OFPST_GROUP_DESC reply (OF1.5):
448 group_id=1234,type=all,bucket=bucket_id:10,actions=output:10,bucket=bucket_id:11,actions=output:11
451 # Start over again, then add two buckets using "first".
452 AT_CHECK([ovs-ofctl -O OpenFlow15 --strict del-groups br0 group_id=1234])
453 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn add-group br0 group_id=1234,type=all])
454 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn insert-buckets br0 group_id=1234,command_bucket_id=first,bucket=bucket_id:10,actions=output:10,bucket=bucket_id:11,actions=output:11])
455 AT_CHECK([ovs-ofctl -F OXM-OpenFlow15 -O OpenFlow15 -vwarn dump-groups br0 1234], [0], [stdout])
456 AT_CHECK([STRIP_XIDS stdout], [0], [dnl
457 OFPST_GROUP_DESC reply (OF1.5):
458 group_id=1234,type=all,bucket=bucket_id:10,actions=output:10,bucket=bucket_id:11,actions=output:11
461 # Add two more buckets before the existing ones.
462 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn insert-buckets br0 group_id=1234,command_bucket_id=first,bucket=bucket_id:0,actions=output:0,bucket=bucket_id:1,actions=output:1])
463 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn dump-groups br0], [0], [stdout])
464 AT_CHECK([STRIP_XIDS stdout], [0], [dnl
465 OFPST_GROUP_DESC reply (OF1.5):
466 group_id=1234,type=all,bucket=bucket_id:0,actions=output:0,bucket=bucket_id:1,actions=output:1,bucket=bucket_id:10,actions=output:10,bucket=bucket_id:11,actions=output:11
469 # Add another bucket at the end.
470 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn insert-buckets br0 group_id=1234,command_bucket_id=last,bucket=bucket_id:14,actions=output:14,bucket=bucket_id:15,actions=output:15])
471 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn dump-groups br0], [0], [stdout])
472 AT_CHECK([STRIP_XIDS stdout], [0], [dnl
473 OFPST_GROUP_DESC reply (OF1.5):
474 group_id=1234,type=all,bucket=bucket_id:0,actions=output:0,bucket=bucket_id:1,actions=output:1,bucket=bucket_id:10,actions=output:10,bucket=bucket_id:11,actions=output:11,bucket=bucket_id:14,actions=output:14,bucket=bucket_id:15,actions=output:15
477 # Verify that duplicate bucket IDs are rejected.
478 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn insert-buckets br0 group_id=1234,command_bucket_id=last,bucket=bucket_id:14,actions=output:14,bucket=bucket_id:15,actions=output:15], [1], [], [stderr])
479 AT_CHECK([STRIP_XIDS stderr | sed '/truncated/,$d'], [0], [dnl
480 OFPT_ERROR (OF1.5): OFPGMFC_BUCKET_EXISTS
481 OFPT_GROUP_MOD (OF1.5):
485 # Add another bucket just before bucket 15.
486 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn insert-buckets br0 group_id=1234,command_bucket_id=15])
487 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn dump-groups br0], [0], [stdout])
488 AT_CHECK([STRIP_XIDS stdout], [0], [dnl
489 OFPST_GROUP_DESC reply (OF1.5):
490 group_id=1234,type=all,bucket=bucket_id:0,actions=output:0,bucket=bucket_id:1,actions=output:1,bucket=bucket_id:10,actions=output:10,bucket=bucket_id:11,actions=output:11,bucket=bucket_id:14,actions=output:14,bucket=bucket_id:15,actions=output:15
493 # Add two more buckets just before bucket 11,
494 # getting the command from a file.
495 AT_DATA([buckets.txt], [dnl
496 group_id=1234,command_bucket_id=11,bucket=bucket_id:12,actions=output:12,bucket=bucket_id:13,actions=output:13
498 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn insert-buckets br0 - < buckets.txt])
499 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn dump-groups br0], [0], [stdout])
500 AT_CHECK([STRIP_XIDS stdout], [0], [dnl
501 OFPST_GROUP_DESC reply (OF1.5):
502 group_id=1234,type=all,bucket=bucket_id:0,actions=output:0,bucket=bucket_id:1,actions=output:1,bucket=bucket_id:10,actions=output:10,bucket=bucket_id:11,actions=output:11,bucket=bucket_id:12,actions=output:12,bucket=bucket_id:13,actions=output:13,bucket=bucket_id:14,actions=output:14,bucket=bucket_id:15,actions=output:15
505 # Add yet two more buckets.
506 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn insert-buckets br0 group_id=1234,command_bucket_id=15,bucket=bucket_id:20,actions=output:20,bucket=bucket_id:21,actions=output:21])
507 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn dump-groups br0], [0], [stdout])
508 AT_CHECK([STRIP_XIDS stdout], [0], [dnl
509 OFPST_GROUP_DESC reply (OF1.5):
510 group_id=1234,type=all,bucket=bucket_id:0,actions=output:0,bucket=bucket_id:1,actions=output:1,bucket=bucket_id:10,actions=output:10,bucket=bucket_id:11,actions=output:11,bucket=bucket_id:12,actions=output:12,bucket=bucket_id:13,actions=output:13,bucket=bucket_id:14,actions=output:14,bucket=bucket_id:15,actions=output:15,bucket=bucket_id:20,actions=output:20,bucket=bucket_id:21,actions=output:21
514 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn insert-buckets br0 group_id=1234,command_bucket_id=0xffffff01,bucket=bucket_id:0,actions=output:0,bucket=bucket_id:1,actions=output:1], [1], [],
515 [ovs-ofctl: invalid command bucket id 4294967041
517 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn insert-buckets br0 group_id=1234,command_bucket_id=first,bucket=bucket_id:0,actions=output:0,bucket=bucket_id:1,actions=output:1], [1], [],
518 [ovs-ofctl: insert-bucket needs OpenFlow 1.5 or later ('-O OpenFlow15')
523 dnl This is really bare-bones.
524 dnl It at least checks request and reply serialization and deserialization.
525 dnl Actions definition listed in both supported formats (w/ actions=)
526 AT_SETUP([ofproto - remove buckets])
528 AT_DATA([groups.txt], [dnl
529 group_id=1234,type=all,bucket=bucket_id:10,actions=output:10,bucket=bucket_id:11,actions=output:11,bucket=bucket_id:12,actions=output:12,bucket=bucket_id:13,actions=output:13,bucket=bucket_id:14,actions=output:14,bucket=bucket_id:15,actions=output:15,bucket=bucket_id:16,actions=output:16
531 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn add-groups br0 groups.txt])
532 AT_CHECK([ovs-ofctl -F OXM-OpenFlow15 -O OpenFlow15 -vwarn dump-groups br0 1234], [0], [stdout])
533 AT_CHECK([STRIP_XIDS stdout], [0], [dnl
534 OFPST_GROUP_DESC reply (OF1.5):
535 group_id=1234,type=all,bucket=bucket_id:10,actions=output:10,bucket=bucket_id:11,actions=output:11,bucket=bucket_id:12,actions=output:12,bucket=bucket_id:13,actions=output:13,bucket=bucket_id:14,actions=output:14,bucket=bucket_id:15,actions=output:15,bucket=bucket_id:16,actions=output:16
537 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn remove-buckets br0 group_id=1234,command_bucket_id=first])
538 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn dump-groups br0], [0], [stdout])
539 AT_CHECK([STRIP_XIDS stdout], [0], [dnl
540 OFPST_GROUP_DESC reply (OF1.5):
541 group_id=1234,type=all,bucket=bucket_id:11,actions=output:11,bucket=bucket_id:12,actions=output:12,bucket=bucket_id:13,actions=output:13,bucket=bucket_id:14,actions=output:14,bucket=bucket_id:15,actions=output:15,bucket=bucket_id:16,actions=output:16
543 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn remove-buckets br0 group_id=1234,command_bucket_id=last])
544 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn dump-groups br0], [0], [stdout])
545 AT_CHECK([STRIP_XIDS stdout], [0], [dnl
546 OFPST_GROUP_DESC reply (OF1.5):
547 group_id=1234,type=all,bucket=bucket_id:11,actions=output:11,bucket=bucket_id:12,actions=output:12,bucket=bucket_id:13,actions=output:13,bucket=bucket_id:14,actions=output:14,bucket=bucket_id:15,actions=output:15
549 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn remove-buckets br0 group_id=1234,command_bucket_id=13])
550 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn dump-groups br0], [0], [stdout])
551 AT_CHECK([STRIP_XIDS stdout], [0], [dnl
552 OFPST_GROUP_DESC reply (OF1.5):
553 group_id=1234,type=all,bucket=bucket_id:11,actions=output:11,bucket=bucket_id:12,actions=output:12,bucket=bucket_id:14,actions=output:14,bucket=bucket_id:15,actions=output:15
555 AT_DATA([buckets.txt], [dnl
558 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn remove-buckets br0 - < buckets.txt])
559 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn dump-groups br0], [0], [stdout])
560 AT_CHECK([STRIP_XIDS stdout], [0], [dnl
561 OFPST_GROUP_DESC reply (OF1.5):
562 group_id=1234,type=all
564 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn remove-buckets br0 group_id=1234,command_bucket_id=first])
565 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn remove-buckets br0 group_id=1234,command_bucket_id=last])
566 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn remove-buckets br0 group_id=1234,command_bucket_id=all])
567 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn remove-buckets br0 group_id=1234,command_bucket_id=1], [1], [], [stderr])
568 AT_CHECK([cat stderr | ofctl_strip], [0], [dnl
569 OFPT_ERROR (OF1.5): OFPGMFC_UNKNOWN_BUCKET
570 OFPT_GROUP_MOD (OF1.5):
571 REMOVE_BUCKET command_bucket_id:1,group_id=1234
574 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn remove-buckets br0 group_id=1234,command_bucket_id=last], [1], [],
575 [ovs-ofctl: remove-bucket needs OpenFlow 1.5 or later ('-O OpenFlow15')
580 dnl This is really bare-bones.
581 dnl It at least checks request and reply serialization and deserialization.
582 AT_SETUP([ofproto - flow mod checks group availability])
584 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn add-group br0 group_id=1234,type=all,bucket=output:10])
585 AT_DATA([flows.txt], [dnl
586 tcp actions=group:1234
587 udp actions=group:1235
589 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn add-flow br0 'tcp actions=group:1234'])
590 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn add-flow br0 'tcp actions=group:1235'], [1], [], [stderr])
592 # The output should look like this:
594 # 00000000 02 0e 00 98 00 00 00 02-00 00 00 00 00 00 00 00 |................|
595 # 00000010 00 00 00 00 00 00 00 00-ff 00 00 00 00 00 80 00 |................|
596 # 00000020 ff ff ff ff ff ff ff ff-ff ff ff ff 00 00 00 00 |................|
597 # 00000030 00 00 00 58 00 00 00 00-00 00 03 d7 00 00 00 00 |...X............|
599 # This 'sed' command captures the error message but drops details.
600 AT_CHECK([sed '/truncated/d
601 /^000000.0/d' stderr | STRIP_XIDS], [0],
602 [OFPT_ERROR (OF1.1): OFPBAC_BAD_OUT_GROUP
603 OFPT_FLOW_MOD (OF1.1):
608 dnl This is really bare-bones.
609 dnl It at least checks request and reply serialization and deserialization.
610 AT_SETUP([ofproto - group description])
612 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn add-group br0 group_id=1234,type=all,bucket=output:10], [0], [stdout])
613 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn dump-groups br0], [0], [stdout])
614 AT_CHECK([STRIP_XIDS stdout], [0], [dnl
615 OFPST_GROUP_DESC reply (OF1.1):
616 group_id=1234,type=all,bucket=actions=output:10
621 dnl This is really bare-bones.
622 dnl It at least checks request and reply serialization and deserialization.
623 AT_SETUP([ofproto - group description])
625 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn add-group br0 group_id=1234,type=all,bucket=output:10])
626 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn dump-groups br0], [0], [stdout])
627 AT_CHECK([STRIP_XIDS stdout], [0], [dnl
628 OFPST_GROUP_DESC reply (OF1.1):
629 group_id=1234,type=all,bucket=actions=output:10
634 dnl This is really bare-bones.
635 dnl It at least checks request and reply serialization and deserialization.
636 AT_SETUP([ofproto - group features])
638 AT_CHECK([ovs-ofctl -O OpenFlow12 -vwarn dump-group-features br0], [0], [stdout])
639 AT_CHECK([STRIP_XIDS stdout], [0], [dnl
640 OFPST_GROUP_FEATURES reply (OF1.2):
645 max_groups=0xffffff00
646 actions: output group set_field strip_vlan push_vlan mod_nw_ttl dec_ttl set_mpls_ttl dec_mpls_ttl push_mpls pop_mpls set_queue
648 max_groups=0xffffff00
649 actions: output group set_field strip_vlan push_vlan mod_nw_ttl dec_ttl set_mpls_ttl dec_mpls_ttl push_mpls pop_mpls set_queue
651 max_groups=0xffffff00
652 actions: output group set_field strip_vlan push_vlan mod_nw_ttl dec_ttl set_mpls_ttl dec_mpls_ttl push_mpls pop_mpls set_queue
654 max_groups=0xffffff00
655 actions: output group set_field strip_vlan push_vlan mod_nw_ttl dec_ttl set_mpls_ttl dec_mpls_ttl push_mpls pop_mpls set_queue
660 dnl This is really bare-bones.
661 dnl It at least checks request and reply serialization and deserialization.
662 AT_SETUP([ofproto - group stats (OpenFlow 1.1)])
664 AT_DATA([groups.txt], [dnl
665 group_id=1234,type=all,bucket=output:10
666 group_id=1235,type=all,bucket=output:10
668 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn add-groups br0 groups.txt])
669 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn add-flow br0 'tcp actions=group:1234'])
670 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn dump-group-stats br0 group_id=1234], [0], [stdout])
671 AT_CHECK([STRIP_XIDS stdout | sort], [0], [dnl
672 group_id=1234,ref_count=1,packet_count=0,byte_count=0,bucket0:packet_count=0,byte_count=0
673 OFPST_GROUP reply (OF1.1):
675 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn dump-group-stats br0], [0], [stdout])
676 AT_CHECK([STRIP_XIDS stdout | sort], [0], [dnl
677 group_id=1234,ref_count=1,packet_count=0,byte_count=0,bucket0:packet_count=0,byte_count=0
678 group_id=1235,ref_count=0,packet_count=0,byte_count=0,bucket0:packet_count=0,byte_count=0
679 OFPST_GROUP reply (OF1.1):
684 dnl This is really bare-bones.
685 dnl It at least checks request and reply serialization and deserialization.
686 AT_SETUP([ofproto - group stats (OpenFlow 1.3)])
688 AT_DATA([groups.txt], [dnl
689 group_id=1234,type=all,bucket=output:10
690 group_id=1235,type=all,bucket=output:10
692 AT_CHECK([ovs-ofctl -O OpenFlow13 -vwarn add-groups br0 groups.txt])
693 AT_CHECK([ovs-ofctl -O OpenFlow13 -vwarn add-flow br0 'tcp actions=group:1234'])
694 AT_CHECK([ovs-ofctl -O OpenFlow13 -vwarn dump-group-stats br0 group_id=1234], [0], [stdout])
695 AT_CHECK([STRIP_XIDS stdout | sed 's/duration=[[0-9.]]*s/duration=?s/' | sort], [0], [dnl
696 group_id=1234,duration=?s,ref_count=1,packet_count=0,byte_count=0,bucket0:packet_count=0,byte_count=0
697 OFPST_GROUP reply (OF1.3):
699 AT_CHECK([ovs-ofctl -O OpenFlow13 -vwarn dump-group-stats br0], [0], [stdout])
700 AT_CHECK([STRIP_XIDS stdout | sed 's/duration=[[0-9.]]*s/duration=?s/' | sort], [0], [dnl
701 group_id=1234,duration=?s,ref_count=1,packet_count=0,byte_count=0,bucket0:packet_count=0,byte_count=0
702 group_id=1235,duration=?s,ref_count=0,packet_count=0,byte_count=0,bucket0:packet_count=0,byte_count=0
703 OFPST_GROUP reply (OF1.3):
708 dnl This is really bare-bones.
709 dnl It at least checks request and reply serialization and deserialization.
710 AT_SETUP([ofproto - group stats (OpenFlow 1.5)])
712 AT_DATA([groups.txt], [dnl
713 group_id=1234,type=all,bucket=output:10
714 group_id=1235,type=all,bucket=output:10
716 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn add-groups br0 groups.txt])
717 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn add-flow br0 'tcp actions=group:1234'])
718 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn dump-group-stats br0 group_id=1234], [0], [stdout])
719 AT_CHECK([STRIP_XIDS stdout | sed 's/duration=[[0-9.]]*s/duration=?s/' | sort], [0], [dnl
720 group_id=1234,duration=?s,ref_count=1,packet_count=0,byte_count=0,bucket0:packet_count=0,byte_count=0
721 OFPST_GROUP reply (OF1.5):
723 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn dump-group-stats br0], [0], [stdout])
724 AT_CHECK([STRIP_XIDS stdout | sed 's/duration=[[0-9.]]*s/duration=?s/' | sort], [0], [dnl
725 group_id=1234,duration=?s,ref_count=1,packet_count=0,byte_count=0,bucket0:packet_count=0,byte_count=0
726 group_id=1235,duration=?s,ref_count=0,packet_count=0,byte_count=0,bucket0:packet_count=0,byte_count=0
727 OFPST_GROUP reply (OF1.5):
732 dnl This found a use-after-free error in bridge destruction in the
733 dnl presence of groups.
734 AT_SETUP([ofproto - group add then bridge delete (OpenFlow 1.3)])
736 AT_DATA([groups.txt], [dnl
737 group_id=1234,type=all,bucket=output:10
738 group_id=1235,type=all,bucket=output:10
740 AT_CHECK([ovs-ofctl -O OpenFlow13 -vwarn add-groups br0 groups.txt])
741 AT_CHECK([ovs-vsctl del-br br0])
745 AT_SETUP([ofproto - mod-port (OpenFlow 1.0)])
747 for command_config_state in \
749 'noflood NO_FLOOD 0' \
750 'down PORT_DOWN,NO_FLOOD LINK_DOWN' \
751 'flood PORT_DOWN LINK_DOWN' \
752 'no-receive PORT_DOWN,NO_RECV LINK_DOWN' \
753 'no-forward PORT_DOWN,NO_RECV,NO_FWD LINK_DOWN' \
754 'no-packet-in PORT_DOWN,NO_RECV,NO_FWD,NO_PACKET_IN LINK_DOWN' \
755 'forward PORT_DOWN,NO_RECV,NO_PACKET_IN LINK_DOWN' \
756 'packet-in PORT_DOWN,NO_RECV LINK_DOWN' \
760 set $command_config_state
761 command=$[1] config=`echo $[2] | sed 's/,/ /g'` state=$[3]
762 AT_CHECK([ovs-ofctl -vwarn mod-port br0 br0 $command])
763 AT_CHECK([ovs-ofctl -vwarn show br0], [0], [stdout])
764 AT_CHECK_UNQUOTED([STRIP_XIDS stdout], [0], [dnl
765 OFPT_FEATURES_REPLY: dpid:fedcba9876543210
766 n_tables:254, n_buffers:256
767 capabilities: FLOW_STATS TABLE_STATS PORT_STATS QUEUE_STATS ARP_MATCH_IP
768 actions: output enqueue set_vlan_vid set_vlan_pcp strip_vlan mod_dl_src mod_dl_dst mod_nw_src mod_nw_dst mod_nw_tos mod_tp_src mod_tp_dst
769 LOCAL(br0): addr:aa:55:aa:55:00:00
772 speed: 0 Mbps now, 0 Mbps max
773 OFPT_GET_CONFIG_REPLY: frags=normal miss_send_len=0
779 AT_SETUP([ofproto - mod-port (OpenFlow 1.2)])
781 for command_config_state in \
783 'down PORT_DOWN LINK_DOWN' \
784 'no-receive PORT_DOWN,NO_RECV LINK_DOWN' \
785 'no-forward PORT_DOWN,NO_RECV,NO_FWD LINK_DOWN' \
786 'no-packet-in PORT_DOWN,NO_RECV,NO_FWD,NO_PACKET_IN LINK_DOWN' \
787 'forward PORT_DOWN,NO_RECV,NO_PACKET_IN LINK_DOWN' \
788 'packet-in PORT_DOWN,NO_RECV LINK_DOWN' \
792 set $command_config_state
793 command=$[1] config=`echo $[2] | sed 's/,/ /g'` state=$[3]
794 AT_CHECK([ovs-ofctl -O OpenFlow12 -vwarn mod-port br0 br0 $command])
795 AT_CHECK([ovs-ofctl -O OpenFlow12 -vwarn show br0], [0], [stdout])
796 AT_CHECK_UNQUOTED([STRIP_XIDS stdout], [0], [dnl
797 OFPT_FEATURES_REPLY (OF1.2): dpid:fedcba9876543210
798 n_tables:254, n_buffers:256
799 capabilities: FLOW_STATS TABLE_STATS PORT_STATS GROUP_STATS QUEUE_STATS
800 LOCAL(br0): addr:aa:55:aa:55:00:00
803 speed: 0 Mbps now, 0 Mbps max
804 OFPT_GET_CONFIG_REPLY (OF1.2): frags=normal miss_send_len=0
810 AT_SETUP([ofproto - mod-port (OpenFlow 1.4)])
812 for command_config_state in \
814 'down PORT_DOWN LINK_DOWN' \
815 'no-receive PORT_DOWN,NO_RECV LINK_DOWN' \
816 'no-forward PORT_DOWN,NO_RECV,NO_FWD LINK_DOWN' \
817 'no-packet-in PORT_DOWN,NO_RECV,NO_FWD,NO_PACKET_IN LINK_DOWN' \
818 'forward PORT_DOWN,NO_RECV,NO_PACKET_IN LINK_DOWN' \
819 'packet-in PORT_DOWN,NO_RECV LINK_DOWN' \
823 set $command_config_state
824 command=$[1] config=`echo $[2] | sed 's/,/ /g'` state=$[3]
825 AT_CHECK([ovs-ofctl -O OpenFlow14 -vwarn mod-port br0 br0 $command])
826 AT_CHECK([ovs-ofctl -O OpenFlow14 -vwarn show br0], [0], [stdout])
827 AT_CHECK_UNQUOTED([STRIP_XIDS stdout], [0], [dnl
828 OFPT_FEATURES_REPLY (OF1.4): dpid:fedcba9876543210
829 n_tables:254, n_buffers:256
830 capabilities: FLOW_STATS TABLE_STATS PORT_STATS GROUP_STATS QUEUE_STATS
831 OFPST_PORT_DESC reply (OF1.4):
832 LOCAL(br0): addr:aa:55:aa:55:00:00
835 speed: 0 Mbps now, 0 Mbps max
836 OFPT_GET_CONFIG_REPLY (OF1.4): frags=normal miss_send_len=0
842 AT_SETUP([ofproto - basic flow_mod commands (NXM)])
844 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip], [0], [NXST_FLOW reply:
846 AT_CHECK([echo 'in_port=2,actions=1' | ovs-ofctl add-flows br0 -])
847 AT_CHECK([ovs-ofctl add-flow br0 in_port=1,actions=2])
848 AT_CHECK([ovs-ofctl -F nxm add-flow br0 table=1,in_port=4,actions=3])
849 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
850 in_port=1 actions=output:2
851 in_port=2 actions=output:1
852 table=1, in_port=4 actions=output:3
855 AT_CHECK([ovs-ofctl dump-aggregate br0 table=0 | STRIP_XIDS], [0], [dnl
856 NXST_AGGREGATE reply: packet_count=0 byte_count=0 flow_count=2
858 AT_CHECK([ovs-ofctl del-flows br0])
859 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip], [0], [NXST_FLOW reply:
864 AT_SETUP([ofproto - basic flow_mod commands (OpenFlow 1.0)])
866 AT_CHECK([ovs-ofctl -F openflow10 dump-flows br0 | ofctl_strip], [0], [OFPST_FLOW reply:
868 AT_CHECK([echo 'in_port=2,actions=1' | ovs-ofctl -F openflow10 add-flows br0 -])
869 AT_CHECK([ovs-ofctl -F openflow10 add-flow br0 in_port=1,actions=2])
870 AT_CHECK([ovs-ofctl -F openflow10 add-flow br0 table=1,in_port=4,actions=3])
871 AT_CHECK([ovs-ofctl -F openflow10 dump-flows br0 | ofctl_strip | sort], [0], [dnl
872 in_port=1 actions=output:2
873 in_port=2 actions=output:1
874 table=1, in_port=4 actions=output:3
877 AT_CHECK([ovs-ofctl -F openflow10 dump-aggregate br0 table=0 | STRIP_XIDS], [0], [dnl
878 OFPST_AGGREGATE reply: packet_count=0 byte_count=0 flow_count=2
880 AT_CHECK([ovs-ofctl -F openflow10 del-flows br0])
881 AT_CHECK([ovs-ofctl -F openflow10 dump-flows br0 | ofctl_strip], [0], [OFPST_FLOW reply:
886 # It's really dumb that check_overlap and reset_counts are considered
887 # part of flow state, but OpenFlow implies that it is, and OFTest and
888 # some users insist on it.
889 AT_SETUP([ofproto - add-flow and flags])
891 AT_CHECK([ovs-ofctl -F openflow10 add-flow br0 check_overlap,in_port=1,actions=drop])
892 # Prior to OF1.3, flow dumps didn't include a "flags" field.
893 AT_CHECK([ovs-ofctl -F openflow10 dump-flows br0 | ofctl_strip], [0], [dnl
895 in_port=1 actions=drop
897 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip], [0], [dnl
898 OFPST_FLOW reply (OF1.1):
899 in_port=1 actions=drop
901 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip], [0], [dnl
902 OFPST_FLOW reply (OF1.2):
903 in_port=1 actions=drop
905 # OF1.3 makes the flags visible.
906 AT_CHECK([ovs-ofctl -O OpenFlow13 dump-flows br0 | ofctl_strip], [0], [dnl
907 OFPST_FLOW reply (OF1.3):
908 check_overlap reset_counts in_port=1 actions=drop
910 AT_CHECK([ovs-ofctl -O OpenFlow14 dump-flows br0 | ofctl_strip], [0], [dnl
911 OFPST_FLOW reply (OF1.4):
912 check_overlap reset_counts in_port=1 actions=drop
914 AT_CHECK([ovs-ofctl -O OpenFlow15 dump-flows br0 | ofctl_strip], [0], [dnl
915 OFPST_FLOW reply (OF1.5):
916 check_overlap reset_counts in_port=1 actions=drop
921 AT_SETUP([ofproto - basic flow_mod commands (OpenFlow 1.1)])
923 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip], [0], [OFPST_FLOW reply (OF1.1):
925 AT_CHECK([echo 'in_port=2,actions=1' | ovs-ofctl -O OpenFlow11 add-flows br0 -])
926 AT_CHECK([ovs-ofctl -O OpenFlow11 add-flow br0 in_port=1,actions=2])
927 AT_CHECK([ovs-ofctl -O OpenFlow11 add-flow br0 table=1,in_port=4,actions=3])
928 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0], [dnl
929 in_port=1 actions=output:2
930 in_port=2 actions=output:1
931 table=1, in_port=4 actions=output:3
932 OFPST_FLOW reply (OF1.1):
934 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-aggregate br0 table=0 | STRIP_XIDS], [0], [dnl
935 OFPST_AGGREGATE reply (OF1.1): packet_count=0 byte_count=0 flow_count=2
937 AT_CHECK([ovs-ofctl -O OpenFlow11 del-flows br0])
938 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip], [0], [OFPST_FLOW reply (OF1.1):
939 table=1, in_port=4 actions=output:3
944 AT_SETUP([ofproto - flow_mod negative test (OpenFlow 1.1)])
946 [set bridge br0 protocols=OpenFlow10,OpenFlow11,OpenFlow12,OpenFlow13])
947 AT_CHECK([ovs-ofctl add-flow -O OpenFlow11 br0 table=1,action=goto_table:2])
949 # The error message here actually comes from ovs-ofctl, not from ovs-vswitchd,
950 # but at least it's the same code in ofpacts_check() that issues the error.
951 AT_CHECK([ovs-ofctl add-flow -O OpenFlow11 br0 table=1,action=goto_table:1],
953 [ovs-ofctl: actions are invalid with specified match (OFPBIC_BAD_TABLE_ID)
958 AT_SETUP([ofproto - set-field flow_mod commands (NXM)])
960 AT_CHECK([ovs-ofctl add-flow br0 ipv6,table=1,in_port=3,actions=drop])
961 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])
962 AT_CHECK([ovs-ofctl add-flow br0 icmp6,icmp_type=136,table=1,in_port=3,actions=set_field:fe80:8675:3097:890a:a6ba:dbff:f00d:59fa-\>nd_target,set_field:cc:dd:ee:ff:00:11-\>nd_tll])
963 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
964 table=1, icmp6,in_port=3,icmp_type=136 actions=load:0xa6badbfff00d59fa->NXM_NX_ND_TARGET[[0..63]],load:0xfe8086753097890a->NXM_NX_ND_TARGET[[64..127]],load:0xccddeeff0011->NXM_NX_ND_TLL[[]]
965 table=1, ipv6,in_port=3 actions=load:0xa6badbfffefe59fa->NXM_NX_IPV6_SRC[[0..63]],load:0xfe8001234567890a->NXM_NX_IPV6_SRC[[64..127]]
971 AT_SETUP([ofproto - basic flow_mod commands (OpenFlow 1.2)])
973 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip], [0], [OFPST_FLOW reply (OF1.2):
975 AT_CHECK([echo 'in_port=2,actions=1' | ovs-ofctl -O OpenFlow12 add-flows br0 -])
976 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 in_port=1,actions=2])
977 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 table=1,in_port=4,actions=3])
978 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
979 in_port=1 actions=output:2
980 in_port=2 actions=output:1
981 table=1, in_port=4 actions=output:3
982 OFPST_FLOW reply (OF1.2):
984 AT_CHECK([ovs-ofctl -O OpenFlow12 del-flows br0])
985 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip], [0], [OFPST_FLOW reply (OF1.2):
990 AT_SETUP([ofproto - set-field flow_mod commands (OF1.2)])
992 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 ipv6,table=1,in_port=3,actions=drop])
993 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 ipv6,table=1,in_port=3,actions=set_field:fe80:0123:4567:890a:a6ba:dbff:fefe:59fa-\>ipv6_src])
994 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 icmp6,icmp_type=136,table=1,in_port=3,actions=set_field:fe80:8675:3097:890a:a6ba:dbff:f00d:59fa-\>nd_target,set_field:cc:dd:ee:ff:00:11-\>nd_tll])
995 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
996 table=1, icmp6,in_port=3,icmp_type=136 actions=set_field:fe80:8675:3097:890a:a6ba:dbff:f00d:59fa->nd_target,set_field:cc:dd:ee:ff:00:11->nd_tll
997 table=1, ipv6,in_port=3 actions=set_field:fe80:123:4567:890a:a6ba:dbff:fefe:59fa->ipv6_src
998 OFPST_FLOW reply (OF1.2):
1003 AT_SETUP([ofproto - dump flows with cookie])
1005 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x1,in_port=1,actions=1])
1006 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x2,in_port=2,actions=1])
1007 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x3,in_port=3,actions=1])
1008 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1009 cookie=0x1, in_port=1 actions=output:1
1010 cookie=0x2, in_port=2 actions=output:1
1011 cookie=0x3, in_port=3 actions=output:1
1014 AT_CHECK([ovs-ofctl dump-aggregate br0 table=0 | STRIP_XIDS], [0], [dnl
1015 NXST_AGGREGATE reply: packet_count=0 byte_count=0 flow_count=3
1017 AT_CHECK([ovs-ofctl dump-flows br0 cookie=0x3/-1 | ofctl_strip | sort], [0], [dnl
1018 cookie=0x3, in_port=3 actions=output:1
1021 AT_CHECK([ovs-ofctl dump-aggregate br0 cookie=0x3/-1 | STRIP_XIDS], [0], [dnl
1022 NXST_AGGREGATE reply: packet_count=0 byte_count=0 flow_count=1
1027 AT_SETUP([ofproto - mod flow with cookie change (OpenFlow 1.0)])
1029 AT_CHECK([ovs-ofctl -F openflow10 add-flow br0 cookie=0x1,in_port=1,actions=1])
1030 AT_CHECK([ovs-ofctl -F openflow10 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1031 cookie=0x1, in_port=1 actions=output:1
1035 AT_CHECK([ovs-ofctl -F openflow10 mod-flows br0 cookie=0x2,in_port=1,actions=1])
1036 AT_CHECK([ovs-ofctl -F openflow10 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1037 cookie=0x2, in_port=1 actions=output:1
1043 AT_SETUP([ofproto - mod flow with cookie change (NXM)])
1045 AT_CHECK([ovs-ofctl -F nxm add-flow br0 cookie=0x1,in_port=1,actions=1])
1046 AT_CHECK([ovs-ofctl -F nxm dump-flows br0 | ofctl_strip | sort], [0], [dnl
1047 cookie=0x1, in_port=1 actions=output:1
1051 AT_CHECK([ovs-ofctl -F nxm mod-flows br0 cookie=0x2,in_port=1,actions=1])
1052 AT_CHECK([ovs-ofctl -F nxm dump-flows br0 | ofctl_strip | sort], [0], [dnl
1053 cookie=0x2, in_port=1 actions=output:1
1059 AT_SETUP([ofproto - no mod flow with cookie change (OpenFlow 1.1)])
1061 AT_CHECK([ovs-ofctl -O OpenFlow11 add-flow br0 cookie=0x1,in_port=1,actions=1])
1062 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1063 cookie=0x1, in_port=1 actions=output:1
1064 OFPST_FLOW reply (OF1.1):
1066 AT_CHECK([ovs-ofctl -O OpenFlow11 mod-flows br0 cookie=0x2,in_port=1,actions=1])
1067 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1068 cookie=0x1, in_port=1 actions=output:1
1069 OFPST_FLOW reply (OF1.1):
1074 dnl The OpenFlow 1.2 spec states that the cookie may not be modified
1075 AT_SETUP([ofproto - no mod flow with cookie change (OpenFlow 1.2)])
1077 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 cookie=0x1,in_port=1,actions=1])
1078 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1079 cookie=0x1, in_port=1 actions=output:1
1080 OFPST_FLOW reply (OF1.2):
1083 AT_CHECK([ovs-ofctl -O OpenFlow12 mod-flows br0 cookie=0x2,in_port=1,actions=1])
1084 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1085 cookie=0x1, in_port=1 actions=output:1
1086 OFPST_FLOW reply (OF1.2):
1091 AT_SETUP([ofproto - mod flows based on cookie mask (OpenFlow 1.0)])
1093 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x1,in_port=1,actions=1])
1094 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x1,in_port=2,actions=1])
1095 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x2,in_port=3,actions=1])
1096 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1097 cookie=0x1, in_port=1 actions=output:1
1098 cookie=0x1, in_port=2 actions=output:1
1099 cookie=0x2, in_port=3 actions=output:1
1103 AT_CHECK([ovs-ofctl -F nxm mod-flows br0 cookie=0x1/0xff,actions=4])
1104 AT_CHECK([ovs-ofctl -F nxm dump-flows br0 | ofctl_strip | sort], [0], [dnl
1105 cookie=0x1, in_port=1 actions=output:4
1106 cookie=0x1, in_port=2 actions=output:4
1107 cookie=0x2, in_port=3 actions=output:1
1113 AT_SETUP([ofproto - mod flows based on cookie mask (OpenFlow 1.1)])
1115 AT_CHECK([ovs-ofctl -O OpenFlow11 add-flow br0 cookie=0x1,in_port=1,actions=1])
1116 AT_CHECK([ovs-ofctl -O OpenFlow11 add-flow br0 cookie=0x1,in_port=2,actions=1])
1117 AT_CHECK([ovs-ofctl -O OpenFlow11 add-flow br0 cookie=0x2,in_port=3,actions=1])
1118 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1119 cookie=0x1, in_port=1 actions=output:1
1120 cookie=0x1, in_port=2 actions=output:1
1121 cookie=0x2, in_port=3 actions=output:1
1122 OFPST_FLOW reply (OF1.1):
1125 AT_CHECK([ovs-ofctl -O OpenFlow11 mod-flows br0 cookie=0x1/0xff,actions=4])
1126 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1127 cookie=0x1, in_port=1 actions=output:4
1128 cookie=0x1, in_port=2 actions=output:4
1129 cookie=0x2, in_port=3 actions=output:1
1130 OFPST_FLOW reply (OF1.1):
1135 AT_SETUP([ofproto - mod flows based on cookie mask (OpenFlow 1.2)])
1137 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 cookie=0x1,in_port=1,actions=1])
1138 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 cookie=0x1,in_port=2,actions=1])
1139 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 cookie=0x2,in_port=3,actions=1])
1140 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1141 cookie=0x1, in_port=1 actions=output:1
1142 cookie=0x1, in_port=2 actions=output:1
1143 cookie=0x2, in_port=3 actions=output:1
1144 OFPST_FLOW reply (OF1.2):
1147 AT_CHECK([ovs-ofctl -O OpenFlow12 mod-flows br0 cookie=0x1/0xff,actions=4])
1148 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1149 cookie=0x1, in_port=1 actions=output:4
1150 cookie=0x1, in_port=2 actions=output:4
1151 cookie=0x2, in_port=3 actions=output:1
1152 OFPST_FLOW reply (OF1.2):
1157 dnl The OpenFlow 1.2 spec states that the cookie may not be modified
1158 AT_SETUP([ofproto - mod flows based on cookie mask with cookie change])
1160 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x1,in_port=1,actions=1])
1161 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x1,in_port=2,actions=1])
1162 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x2,in_port=3,actions=1])
1163 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1164 cookie=0x1, in_port=1 actions=output:1
1165 cookie=0x1, in_port=2 actions=output:1
1166 cookie=0x2, in_port=3 actions=output:1
1170 AT_CHECK([ovs-ofctl -F nxm mod-flows br0 cookie=1/-1,cookie=4,actions=4])
1171 AT_CHECK([ovs-ofctl -F nxm dump-flows br0 | ofctl_strip | sort], [0], [dnl
1172 cookie=0x2, in_port=3 actions=output:1
1173 cookie=0x4, in_port=1 actions=output:4
1174 cookie=0x4, in_port=2 actions=output:4
1180 AT_SETUP([ofproto - mod flow with cookie miss (mask==0) - NXM])
1182 AT_CHECK([ovs-ofctl -F nxm mod-flows br0 in_port=1,actions=1])
1183 AT_CHECK([ovs-ofctl -F nxm dump-flows br0 | ofctl_strip | sort], [0], [dnl
1184 in_port=1 actions=output:1
1190 AT_SETUP([ofproto - mod flow with cookie miss (mask==0) - OF1.1])
1192 AT_CHECK([ovs-ofctl -O openflow11 mod-flows br0 in_port=1,actions=1])
1193 AT_CHECK([ovs-ofctl -O openflow11 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1194 in_port=1 actions=output:1
1195 OFPST_FLOW reply (OF1.1):
1200 AT_SETUP([ofproto - mod flow with cookie miss (mask==0) - OF1.2])
1202 AT_CHECK([ovs-ofctl -O openflow12 mod-flows br0 in_port=1,actions=1])
1203 AT_CHECK([ovs-ofctl -O openflow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1204 OFPST_FLOW reply (OF1.2):
1209 AT_SETUP([ofproto - mod flow with cookie miss (mask!=0) - NXM])
1211 AT_CHECK([ovs-ofctl -F nxm mod-flows br0 cookie=1/1,in_port=1,actions=1])
1212 AT_CHECK([ovs-ofctl -F nxm dump-flows br0 | ofctl_strip | sort], [0], [dnl
1218 AT_SETUP([ofproto - mod flow with cookie miss (mask!=0) - OF1.1])
1220 AT_CHECK([ovs-ofctl -O openflow11 mod-flows br0 cookie=1/1,in_port=1,actions=1])
1221 AT_CHECK([ovs-ofctl -O openflow11 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1222 OFPST_FLOW reply (OF1.1):
1227 AT_SETUP([ofproto - mod flow with cookie miss (mask!=0) - OF1.2])
1229 AT_CHECK([ovs-ofctl -O openflow12 mod-flows br0 cookie=1/1,in_port=1,actions=1])
1230 AT_CHECK([ovs-ofctl -O openflow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1231 OFPST_FLOW reply (OF1.2):
1236 AT_SETUP([ofproto - del flows with cookies])
1238 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x1,in_port=1,actions=1])
1239 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x2,in_port=2,actions=1])
1240 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x3,in_port=3,actions=1])
1241 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1242 cookie=0x1, in_port=1 actions=output:1
1243 cookie=0x2, in_port=2 actions=output:1
1244 cookie=0x3, in_port=3 actions=output:1
1248 AT_CHECK([ovs-ofctl del-flows br0])
1249 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1255 AT_SETUP([ofproto - del flows based on cookie])
1257 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x1,in_port=1,actions=1])
1258 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x2,in_port=2,actions=1])
1259 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x3,in_port=3,actions=1])
1260 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1261 cookie=0x1, in_port=1 actions=output:1
1262 cookie=0x2, in_port=2 actions=output:1
1263 cookie=0x3, in_port=3 actions=output:1
1267 AT_CHECK([ovs-ofctl del-flows br0 cookie=0x3/-1])
1268 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1269 cookie=0x1, in_port=1 actions=output:1
1270 cookie=0x2, in_port=2 actions=output:1
1276 AT_SETUP([ofproto - del flows based on cookie mask])
1278 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x1,in_port=1,actions=1])
1279 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x2,in_port=2,actions=1])
1280 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x3,in_port=3,actions=1])
1281 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1282 cookie=0x1, in_port=1 actions=output:1
1283 cookie=0x2, in_port=2 actions=output:1
1284 cookie=0x3, in_port=3 actions=output:1
1287 AT_CHECK([ovs-ofctl del-flows br0 cookie=0x3/0x1])
1288 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1289 cookie=0x2, in_port=2 actions=output:1
1295 AT_SETUP([ofproto - del flows based on table id (NXM)])
1297 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x1,in_port=1,actions=1])
1298 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x2,in_port=2,table=1,actions=1])
1299 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1300 cookie=0x1, in_port=1 actions=output:1
1301 cookie=0x2, table=1, in_port=2 actions=output:1
1304 AT_CHECK([ovs-ofctl del-flows br0 table=0])
1305 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1306 cookie=0x2, table=1, in_port=2 actions=output:1
1309 AT_CHECK([ovs-ofctl del-flows br0 table=1])
1310 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1313 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x1,in_port=1,actions=1])
1314 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x2,in_port=2,table=1,actions=1])
1315 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1316 cookie=0x1, in_port=1 actions=output:1
1317 cookie=0x2, table=1, in_port=2 actions=output:1
1320 AT_CHECK([ovs-ofctl del-flows br0])
1321 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1327 AT_SETUP([ofproto - del flows based on table id (OpenFlow 1.1)])
1329 AT_CHECK([ovs-ofctl -O OpenFlow11 add-flow br0 cookie=0x1,in_port=1,actions=1])
1330 AT_CHECK([ovs-ofctl -O OpenFlow11 add-flow br0 cookie=0x2,in_port=2,table=1,actions=1])
1331 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1332 cookie=0x1, in_port=1 actions=output:1
1333 cookie=0x2, table=1, in_port=2 actions=output:1
1334 OFPST_FLOW reply (OF1.1):
1336 AT_CHECK([ovs-ofctl -O OpenFlow11 del-flows br0 table=0])
1337 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1338 cookie=0x2, table=1, in_port=2 actions=output:1
1339 OFPST_FLOW reply (OF1.1):
1341 AT_CHECK([ovs-ofctl -O OpenFlow11 del-flows br0 table=1])
1342 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1343 OFPST_FLOW reply (OF1.1):
1345 AT_CHECK([ovs-ofctl -O OpenFlow11 add-flow br0 cookie=0x1,in_port=1,actions=1])
1346 AT_CHECK([ovs-ofctl -O OpenFlow11 add-flow br0 cookie=0x2,in_port=2,table=1,actions=1])
1347 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1348 cookie=0x1, in_port=1 actions=output:1
1349 cookie=0x2, table=1, in_port=2 actions=output:1
1350 OFPST_FLOW reply (OF1.1):
1352 AT_CHECK([ovs-ofctl -O OpenFlow11 del-flows br0])
1353 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip], [0], [dnl
1354 OFPST_FLOW reply (OF1.1):
1355 cookie=0x2, table=1, in_port=2 actions=output:1
1360 AT_SETUP([ofproto - del flows based on table id (OpenFlow 1.2)])
1362 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 cookie=0x1,in_port=1,actions=1])
1363 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 cookie=0x2,in_port=2,table=1,actions=1])
1364 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1365 cookie=0x1, in_port=1 actions=output:1
1366 cookie=0x2, table=1, in_port=2 actions=output:1
1367 OFPST_FLOW reply (OF1.2):
1369 AT_CHECK([ovs-ofctl -O OpenFlow12 del-flows br0 table=0])
1370 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1371 cookie=0x2, table=1, in_port=2 actions=output:1
1372 OFPST_FLOW reply (OF1.2):
1374 AT_CHECK([ovs-ofctl -O OpenFlow12 del-flows br0 table=1])
1375 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1376 OFPST_FLOW reply (OF1.2):
1378 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 cookie=0x1,in_port=1,actions=1])
1379 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 cookie=0x2,in_port=2,table=1,actions=1])
1380 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1381 cookie=0x1, in_port=1 actions=output:1
1382 cookie=0x2, table=1, in_port=2 actions=output:1
1383 OFPST_FLOW reply (OF1.2):
1385 AT_CHECK([ovs-ofctl -O OpenFlow12 del-flows br0])
1386 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1387 OFPST_FLOW reply (OF1.2):
1392 AT_SETUP([ofproto - flow_mod with out_port matching (OpenFlow 1.0)])
1394 AT_DATA([flows.txt], [dnl
1395 in_port=1 actions=output:2
1396 in_port=2 actions=output:1,output:2,output:3
1397 in_port=3 actions=output:3,output:1,output:2
1398 in_port=4 actions=drop
1399 in_port=5 actions=output:3
1400 in_port=6 actions=output:1
1402 AT_CHECK([ovs-ofctl -F openflow10 add-flows br0 flows.txt])
1403 (cat flows.txt; echo 'OFPST_FLOW reply:') > expout
1404 AT_CHECK([ovs-ofctl -F openflow10 dump-flows br0 | ofctl_strip | sort], [0],
1407 (grep 'output:2' flows.txt; echo 'OFPST_FLOW reply:') > expout
1408 AT_CHECK([ovs-ofctl -F openflow10 dump-flows br0 out_port=2 | ofctl_strip | sort], [0], [expout])
1410 AT_CHECK([ovs-ofctl -F openflow10 del-flows br0 out_port=2])
1411 (grep -v 'output:2' flows.txt; echo 'OFPST_FLOW reply:') > expout
1412 AT_CHECK([ovs-ofctl -F openflow10 dump-flows br0 | ofctl_strip | sort], [0],
1415 AT_CHECK([ovs-ofctl -F openflow10 del-flows br0 out_port=3])
1416 (grep -v 'output:[[23]]' flows.txt; echo 'OFPST_FLOW reply:') > expout
1417 AT_CHECK([ovs-ofctl -F openflow10 dump-flows br0 | ofctl_strip | sort], [0],
1420 AT_CHECK([ovs-ofctl -F openflow10 del-flows br0 out_port=1])
1421 (grep -v 'output:[[123]]' flows.txt; echo 'OFPST_FLOW reply:') > expout
1422 AT_CHECK([ovs-ofctl -F openflow10 dump-flows br0 | ofctl_strip | sort], [0],
1428 AT_SETUP([ofproto - flow_mod with out_port matching (OpenFlow 1.1)])
1430 AT_DATA([flows.txt], [dnl
1431 in_port=1 actions=output:2
1432 in_port=2 actions=output:1,write_actions(output:2,output:3)
1433 in_port=3 actions=output:3,output:1,write_actions(output:2)
1434 in_port=4 actions=drop
1435 in_port=5 actions=write_actions(output:3)
1436 in_port=6 actions=output:1
1438 AT_CHECK([ovs-ofctl -O OpenFlow11 add-flows br0 flows.txt])
1439 (cat flows.txt; echo 'OFPST_FLOW reply (OF1.1):') > expout
1440 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0],
1443 (grep 'output:2' flows.txt; echo 'OFPST_FLOW reply (OF1.1):') > expout
1444 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 out_port=2 | ofctl_strip | sort], [0], [expout])
1446 AT_CHECK([ovs-ofctl -O OpenFlow11 del-flows br0 out_port=2])
1447 (grep -v 'output:2' flows.txt; echo 'OFPST_FLOW reply (OF1.1):') > expout
1448 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0],
1451 AT_CHECK([ovs-ofctl -O OpenFlow11 del-flows br0 out_port=3])
1452 (grep -v 'output:[[23]]' flows.txt; echo 'OFPST_FLOW reply (OF1.1):') > expout
1453 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0],
1456 AT_CHECK([ovs-ofctl -O OpenFlow11 del-flows br0 out_port=1])
1457 (grep -v 'output:[[123]]' flows.txt; echo 'OFPST_FLOW reply (OF1.1):') > expout
1458 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0],
1464 AT_SETUP([ofproto - flow_mod with out_group matching (OpenFlow 1.1)])
1466 AT_DATA([groups.txt], [dnl
1467 group_id=1,type=all,bucket=output:10
1468 group_id=2,type=all,bucket=output:10
1469 group_id=3,type=all,bucket=output:10
1471 AT_CHECK([ovs-ofctl -O OpenFlow11 add-groups br0 groups.txt])
1472 AT_DATA([flows.txt], [dnl
1473 in_port=1 actions=group:2,output:5
1474 in_port=2 actions=group:1,write_actions(group:2,group:3,output:6)
1475 in_port=3 actions=group:3,group:1,write_actions(group:2,output:3)
1476 in_port=4 actions=output:4
1477 in_port=5 actions=write_actions(output:4,group:3)
1478 in_port=6 actions=group:1
1480 AT_CHECK([ovs-ofctl -O OpenFlow11 add-flows br0 flows.txt])
1481 (cat flows.txt; echo 'OFPST_FLOW reply (OF1.1):') > expout
1482 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0],
1485 (grep 'output:3' flows.txt | grep 'group:2'; echo 'OFPST_FLOW reply (OF1.1):') > expout
1486 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 out_port=3,out_group=2 | ofctl_strip | sort], [0], [expout])
1488 AT_CHECK([ovs-ofctl -O OpenFlow11 del-flows br0 out_group=2])
1489 (grep -v 'group:2' flows.txt; echo 'OFPST_FLOW reply (OF1.1):') > expout
1490 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0],
1493 AT_CHECK([ovs-ofctl -O OpenFlow11 del-flows br0 out_group=3])
1494 (grep -v 'group:[[23]]' flows.txt; echo 'OFPST_FLOW reply (OF1.1):') > expout
1495 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0],
1498 AT_CHECK([ovs-ofctl -O OpenFlow11 del-flows br0 out_group=1])
1499 (grep -v 'group:[[123]]' flows.txt; echo 'OFPST_FLOW reply (OF1.1):') > expout
1500 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0],
1506 AT_SETUP([ofproto - flow table configuration (OpenFlow 1.0)])
1508 # Check the default configuration.
1510 printf 'OFPST_TABLE reply (xid=0x2):
1512 active=0, lookup=0, matched=0
1515 in_port: exact match or wildcard
1516 eth_src: exact match or wildcard
1517 eth_dst: exact match or wildcard
1518 eth_type: exact match or wildcard
1519 vlan_vid: exact match or wildcard
1520 vlan_pcp: exact match or wildcard
1521 ip_src: exact match or wildcard
1522 ip_dst: exact match or wildcard
1523 nw_proto: exact match or wildcard
1524 nw_tos: exact match or wildcard
1525 tcp_src: exact match or wildcard
1526 tcp_dst: exact match or wildcard
1531 for i in `seq $1 $2`; do
1532 printf ' table %d ("table%d"): ditto\n' $i $i
1535 (head_table classifier; ditto 1 253) > expout
1536 AT_CHECK([ovs-ofctl dump-tables br0], [0], [expout])
1537 # Change the configuration.
1540 -- --id=@t0 create Flow_Table name=main \
1541 -- --id=@t1 create Flow_Table flow-limit=1024 \
1542 -- set bridge br0 'flow_tables={1=@t1,0=@t0}' \
1543 | ${PERL} $srcdir/uuidfilt.pl],
1547 # Check that the configuration was updated.
1548 (head_table main; echo ' table 1 ("table1"):
1549 active=0, lookup=0, matched=0
1554 active=0, lookup=0, matched=0
1557 '; ditto 3 253) > expout
1558 AT_CHECK([ovs-ofctl dump-tables br0], [0], [expout])
1562 dnl In-band and fail-open add "hidden rules" to table 0. These rules shouldn't
1563 dnl be visible to OpenFlow. This test checks that "dump-flows" and
1564 dnl "dump-tables" don't make them visible.
1565 AT_SETUP([ofproto - hidden rules not in table stats])
1566 # Use an IP address for a controller that won't actually exist: we
1567 # want to create in-band rules but we do not want to actually connect
1568 # to a controller (because that could mess about with our test). The
1569 # Class E range 240.0.0.0 - 255.255.255.255 seems like a good choice.
1570 OVS_VSWITCHD_START([set-controller br0 tcp:240.0.0.1:6653])
1571 for i in 1 2 3 4 5; do ovs-appctl time/warp 1000; done
1573 # Check that no hidden flows are visible in OpenFlow.
1574 AT_CHECK([ovs-ofctl dump-flows br0], [0], [NXST_FLOW reply (xid=0x4):
1577 # Check that some hidden flows related to 240.0.0.1 are actually in table 0.
1579 # We discard flows that mention table_id because we only want table 0 flows,
1580 # which in OVS is implied by the absence of a table_id.
1581 AT_CHECK([ovs-appctl bridge/dump-flows br0], [0], [stdout])
1582 AT_CHECK([test `grep '240\.0\.0\.1' stdout | grep -v table_id= | wc -l` -gt 0])
1584 # Check that dump-tables doesn't count the hidden flows.
1586 printf 'OFPST_TABLE reply (xid=0x2):
1588 active=0, lookup=0, matched=0
1591 in_port: exact match or wildcard
1592 eth_src: exact match or wildcard
1593 eth_dst: exact match or wildcard
1594 eth_type: exact match or wildcard
1595 vlan_vid: exact match or wildcard
1596 vlan_pcp: exact match or wildcard
1597 ip_src: exact match or wildcard
1598 ip_dst: exact match or wildcard
1599 nw_proto: exact match or wildcard
1600 nw_tos: exact match or wildcard
1601 tcp_src: exact match or wildcard
1602 tcp_dst: exact match or wildcard
1607 for i in `seq $1 $2`; do
1608 printf ' table %d ("table%d"): ditto\n' $i $i
1611 (head_table classifier; ditto 1 253) > expout
1612 AT_CHECK([ovs-ofctl dump-tables br0], [0], [expout])
1613 OVS_VSWITCHD_STOP(["/240\.0\.0\.1/d"])
1616 AT_SETUP([ofproto - flow table configuration (OpenFlow 1.2)])
1618 # Check the default configuration.
1620 printf 'OFPST_TABLE reply (OF1.2) (xid=0x2):
1622 active=0, lookup=0, matched=0
1623 metadata: match=0xffffffffffffffff write=0xffffffffffffffff
1626 instructions (table miss and others):
1627 instructions: apply_actions,clear_actions,write_actions,write_metadata,goto_table
1628 Write-Actions and Apply-Actions features:
1629 actions: output group set_field strip_vlan push_vlan mod_nw_ttl dec_ttl set_mpls_ttl dec_mpls_ttl push_mpls pop_mpls set_queue
1630 supported on Set-Field: metadata in_port_oxm eth_src eth_dst vlan_vid vlan_pcp mpls_label mpls_tc ip_src ip_dst ipv6_src ipv6_dst ipv6_label ip_dscp nw_ecn arp_op arp_spa arp_tpa arp_sha arp_tha tcp_src tcp_dst udp_src udp_dst sctp_src sctp_dst icmp_type icmp_code icmpv6_type icmpv6_code nd_target nd_sll nd_tll
1632 metadata: exact match or wildcard
1633 in_port_oxm: exact match or wildcard
1634 eth_src: exact match or wildcard
1635 eth_dst: exact match or wildcard
1636 eth_type: exact match or wildcard
1637 vlan_vid: exact match or wildcard
1638 vlan_pcp: exact match or wildcard
1639 mpls_label: exact match or wildcard
1640 mpls_tc: exact match or wildcard
1641 ip_src: exact match or wildcard
1642 ip_dst: exact match or wildcard
1643 ipv6_src: exact match or wildcard
1644 ipv6_dst: exact match or wildcard
1645 ipv6_label: exact match or wildcard
1646 nw_proto: exact match or wildcard
1647 ip_dscp: exact match or wildcard
1648 nw_ecn: exact match or wildcard
1649 arp_op: exact match or wildcard
1650 arp_spa: exact match or wildcard
1651 arp_tpa: exact match or wildcard
1652 arp_sha: exact match or wildcard
1653 arp_tha: exact match or wildcard
1654 tcp_src: exact match or wildcard
1655 tcp_dst: exact match or wildcard
1656 udp_src: exact match or wildcard
1657 udp_dst: exact match or wildcard
1658 sctp_src: exact match or wildcard
1659 sctp_dst: exact match or wildcard
1660 icmp_type: exact match or wildcard
1661 icmp_code: exact match or wildcard
1662 icmpv6_type: exact match or wildcard
1663 icmpv6_code: exact match or wildcard
1664 nd_target: exact match or wildcard
1665 nd_sll: exact match or wildcard
1666 nd_tll: exact match or wildcard
1671 for i in `seq $1 $2`; do
1672 printf ' table %d ("table%d"): ditto\n' $i $i
1676 printf ' table 253 ("table253"):
1677 active=0, lookup=0, matched=0
1678 metadata: match=0xffffffffffffffff write=0xffffffffffffffff
1681 instructions (table miss and others):
1682 instructions: apply_actions,clear_actions,write_actions,write_metadata
1687 (head_table classifier; ditto 1 252; tail_table) > expout
1688 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-tables br0], [0], [expout])
1689 # Change the configuration.
1692 -- --id=@t0 create Flow_Table name=main \
1693 -- --id=@t1 create Flow_Table flow-limit=1024 \
1694 -- set bridge br0 'flow_tables={1=@t1,0=@t0}' \
1695 | ${PERL} $srcdir/uuidfilt.pl],
1699 # Check that the configuration was updated.
1700 (head_table main; echo ' table 1 ("table1"):
1701 active=0, lookup=0, matched=0
1702 metadata: match=0xffffffffffffffff write=0xffffffffffffffff
1709 active=0, lookup=0, matched=0
1710 metadata: match=0xffffffffffffffff write=0xffffffffffffffff
1715 '; ditto 3 252; tail_table) > expout
1716 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-tables br0], [0], [expout])
1720 AT_SETUP([ofproto - table features (OpenFlow 1.3)])
1723 printf ' table 0 ("%s"):
1724 metadata: match=0xffffffffffffffff write=0xffffffffffffffff
1726 instructions (table miss and others):
1728 instructions: meter,apply_actions,clear_actions,write_actions,write_metadata,goto_table
1729 Write-Actions and Apply-Actions features:
1730 actions: output group set_field strip_vlan push_vlan mod_nw_ttl dec_ttl set_mpls_ttl dec_mpls_ttl push_mpls pop_mpls set_queue
1731 supported on Set-Field: tun_id tun_src tun_dst tun_ipv6_src tun_ipv6_dst tun_flags tun_gbp_id tun_gbp_flags tun_metadata0 dnl
1732 tun_metadata1 tun_metadata2 tun_metadata3 tun_metadata4 tun_metadata5 tun_metadata6 tun_metadata7 tun_metadata8 tun_metadata9 tun_metadata10 tun_metadata11 tun_metadata12 tun_metadata13 tun_metadata14 tun_metadata15 tun_metadata16 tun_metadata17 tun_metadata18 tun_metadata19 tun_metadata20 tun_metadata21 tun_metadata22 tun_metadata23 tun_metadata24 tun_metadata25 tun_metadata26 tun_metadata27 tun_metadata28 tun_metadata29 tun_metadata30 tun_metadata31 tun_metadata32 tun_metadata33 tun_metadata34 tun_metadata35 tun_metadata36 tun_metadata37 tun_metadata38 tun_metadata39 tun_metadata40 tun_metadata41 tun_metadata42 tun_metadata43 tun_metadata44 tun_metadata45 tun_metadata46 tun_metadata47 tun_metadata48 tun_metadata49 tun_metadata50 tun_metadata51 tun_metadata52 tun_metadata53 tun_metadata54 tun_metadata55 tun_metadata56 tun_metadata57 tun_metadata58 tun_metadata59 tun_metadata60 tun_metadata61 tun_metadata62 tun_metadata63 dnl
1733 metadata in_port in_port_oxm pkt_mark ct_mark ct_label reg0 reg1 reg2 reg3 reg4 reg5 reg6 reg7 xreg0 xreg1 xreg2 xreg3 eth_src eth_dst vlan_tci vlan_vid vlan_pcp mpls_label mpls_tc ip_src ip_dst ipv6_src ipv6_dst ipv6_label nw_tos ip_dscp nw_ecn nw_ttl arp_op arp_spa arp_tpa arp_sha arp_tha tcp_src tcp_dst udp_src udp_dst sctp_src sctp_dst icmp_type icmp_code icmpv6_type icmpv6_code nd_target nd_sll nd_tll
1735 dp_hash: arbitrary mask
1736 recirc_id: exact match or wildcard
1737 conj_id: exact match or wildcard
1738 tun_id: arbitrary mask
1739 tun_src: arbitrary mask
1740 tun_dst: arbitrary mask
1741 tun_ipv6_src: arbitrary mask
1742 tun_ipv6_dst: arbitrary mask
1743 tun_flags: arbitrary mask
1744 tun_gbp_id: arbitrary mask
1745 tun_gbp_flags: arbitrary mask
1746 tun_metadata0: arbitrary mask
1747 tun_metadata1: arbitrary mask
1748 tun_metadata2: arbitrary mask
1749 tun_metadata3: arbitrary mask
1750 tun_metadata4: arbitrary mask
1751 tun_metadata5: arbitrary mask
1752 tun_metadata6: arbitrary mask
1753 tun_metadata7: arbitrary mask
1754 tun_metadata8: arbitrary mask
1755 tun_metadata9: arbitrary mask
1756 tun_metadata10: arbitrary mask
1757 tun_metadata11: arbitrary mask
1758 tun_metadata12: arbitrary mask
1759 tun_metadata13: arbitrary mask
1760 tun_metadata14: arbitrary mask
1761 tun_metadata15: arbitrary mask
1762 tun_metadata16: arbitrary mask
1763 tun_metadata17: arbitrary mask
1764 tun_metadata18: arbitrary mask
1765 tun_metadata19: arbitrary mask
1766 tun_metadata20: arbitrary mask
1767 tun_metadata21: arbitrary mask
1768 tun_metadata22: arbitrary mask
1769 tun_metadata23: arbitrary mask
1770 tun_metadata24: arbitrary mask
1771 tun_metadata25: arbitrary mask
1772 tun_metadata26: arbitrary mask
1773 tun_metadata27: arbitrary mask
1774 tun_metadata28: arbitrary mask
1775 tun_metadata29: arbitrary mask
1776 tun_metadata30: arbitrary mask
1777 tun_metadata31: arbitrary mask
1778 tun_metadata32: arbitrary mask
1779 tun_metadata33: arbitrary mask
1780 tun_metadata34: arbitrary mask
1781 tun_metadata35: arbitrary mask
1782 tun_metadata36: arbitrary mask
1783 tun_metadata37: arbitrary mask
1784 tun_metadata38: arbitrary mask
1785 tun_metadata39: arbitrary mask
1786 tun_metadata40: arbitrary mask
1787 tun_metadata41: arbitrary mask
1788 tun_metadata42: arbitrary mask
1789 tun_metadata43: arbitrary mask
1790 tun_metadata44: arbitrary mask
1791 tun_metadata45: arbitrary mask
1792 tun_metadata46: arbitrary mask
1793 tun_metadata47: arbitrary mask
1794 tun_metadata48: arbitrary mask
1795 tun_metadata49: arbitrary mask
1796 tun_metadata50: arbitrary mask
1797 tun_metadata51: arbitrary mask
1798 tun_metadata52: arbitrary mask
1799 tun_metadata53: arbitrary mask
1800 tun_metadata54: arbitrary mask
1801 tun_metadata55: arbitrary mask
1802 tun_metadata56: arbitrary mask
1803 tun_metadata57: arbitrary mask
1804 tun_metadata58: arbitrary mask
1805 tun_metadata59: arbitrary mask
1806 tun_metadata60: arbitrary mask
1807 tun_metadata61: arbitrary mask
1808 tun_metadata62: arbitrary mask
1809 tun_metadata63: arbitrary mask
1810 metadata: arbitrary mask
1811 in_port: exact match or wildcard
1812 in_port_oxm: exact match or wildcard
1813 actset_output: exact match or wildcard
1814 pkt_mark: arbitrary mask
1815 ct_state: arbitrary mask
1816 ct_zone: exact match or wildcard
1817 ct_mark: arbitrary mask
1818 ct_label: arbitrary mask
1819 reg0: arbitrary mask
1820 reg1: arbitrary mask
1821 reg2: arbitrary mask
1822 reg3: arbitrary mask
1823 reg4: arbitrary mask
1824 reg5: arbitrary mask
1825 reg6: arbitrary mask
1826 reg7: arbitrary mask
1827 xreg0: arbitrary mask
1828 xreg1: arbitrary mask
1829 xreg2: arbitrary mask
1830 xreg3: arbitrary mask
1831 eth_src: arbitrary mask
1832 eth_dst: arbitrary mask
1833 eth_type: exact match or wildcard
1834 vlan_tci: arbitrary mask
1835 vlan_vid: arbitrary mask
1836 vlan_pcp: exact match or wildcard
1837 mpls_label: exact match or wildcard
1838 mpls_tc: exact match or wildcard
1839 mpls_bos: exact match or wildcard
1840 ip_src: arbitrary mask
1841 ip_dst: arbitrary mask
1842 ipv6_src: arbitrary mask
1843 ipv6_dst: arbitrary mask
1844 ipv6_label: arbitrary mask
1845 nw_proto: exact match or wildcard
1846 nw_tos: exact match or wildcard
1847 ip_dscp: exact match or wildcard
1848 nw_ecn: exact match or wildcard
1849 nw_ttl: exact match or wildcard
1850 ip_frag: arbitrary mask
1851 arp_op: exact match or wildcard
1852 arp_spa: arbitrary mask
1853 arp_tpa: arbitrary mask
1854 arp_sha: arbitrary mask
1855 arp_tha: arbitrary mask
1856 tcp_src: arbitrary mask
1857 tcp_dst: arbitrary mask
1858 tcp_flags: arbitrary mask
1859 udp_src: arbitrary mask
1860 udp_dst: arbitrary mask
1861 sctp_src: arbitrary mask
1862 sctp_dst: arbitrary mask
1863 icmp_type: exact match or wildcard
1864 icmp_code: exact match or wildcard
1865 icmpv6_type: exact match or wildcard
1866 icmpv6_code: exact match or wildcard
1867 nd_target: arbitrary mask
1868 nd_sll: arbitrary mask
1869 nd_tll: arbitrary mask
1874 printf ' table %d ("%s"):
1875 metadata: match=0xffffffffffffffff write=0xffffffffffffffff
1877 instructions (table miss and others):
1883 ' $1 $2 $3 `expr $1 + 1`
1886 echo ' table 252 ("table252"):
1887 metadata: match=0xffffffffffffffff write=0xffffffffffffffff
1889 instructions (table miss and others):
1895 table 253 ("table253"):
1896 metadata: match=0xffffffffffffffff write=0xffffffffffffffff
1898 instructions (table miss and others):
1899 instructions: meter,apply_actions,clear_actions,write_actions,write_metadata
1904 (head_table classifier
1905 for i in `seq 1 251`; do
1906 ditto $i table$i 1000000
1908 tail_tables) > expout
1909 AT_CHECK([ovs-ofctl -O OpenFlow13 dump-table-features br0], [0], [expout])
1910 # Change the configuration.
1913 -- --id=@t0 create Flow_Table name=main \
1914 -- --id=@t1 create Flow_Table flow-limit=1024 \
1915 -- set bridge br0 'flow_tables={1=@t1,0=@t0}' \
1916 | ${PERL} $srcdir/uuidfilt.pl],
1920 # Check that the configuration was updated.
1923 for i in `seq 2 251`; do
1924 ditto $i table$i 1000000
1926 tail_tables) > expout
1927 AT_CHECK([ovs-ofctl -O OpenFlow13 dump-table-features br0], [0], [expout])
1931 AT_SETUP([ofproto - table description (OpenFlow 1.4)])
1934 while test $x -lt 254; do
1937 eviction=off eviction_flags=OTHER|IMPORTANCE|LIFETIME
1941 AT_CHECK([ovs-ofctl -O OpenFlow14 dump-table-desc br0 | sed '/^$/d
1942 /^OFPST_TABLE_DESC/d'], [0], [expout])
1944 # Change the configuration.
1945 AT_CHECK([ovs-ofctl -O Openflow14 mod-table br0 0 evict])
1946 # Check that the configuration was updated.
1947 mv expout orig-expout
1948 sed -e '2s/eviction=off/eviction=on/' <orig-expout > expout
1949 AT_CHECK([ovs-ofctl -O OpenFlow14 dump-table-desc br0 | sed '/^$/d
1950 /^OFPST_TABLE_DESC/d'], [0], [expout])
1952 AT_CHECK([ovs-ofctl -O Openflow14 mod-table br0 0 vacancy:20,80])
1953 # Check that the configuration was updated.
1954 mv expout orig-expout
1955 sed -e '3s/vacancy=off/vacancy=on vacancy_down=20% vacancy_up=80% vacancy=0%/' <orig-expout > expout
1956 AT_CHECK([ovs-ofctl -O OpenFlow14 dump-table-desc br0 | sed '/^$/d
1957 /^OFPST_TABLE_DESC/d'], [0], [expout])
1961 AT_SETUP([ofproto - hard limits on flow table size (OpenFlow 1.0)])
1963 # Configure a maximum of 4 flows.
1966 -- --id=@t0 create Flow_Table flow-limit=4 \
1967 -- set bridge br0 flow_tables:0=@t0 \
1968 | ${PERL} $srcdir/uuidfilt.pl],
1972 for in_port in 1 2 3 4; do
1973 ovs-ofctl add-flow br0 in_port=$in_port,actions=drop
1975 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1976 in_port=1 actions=drop
1977 in_port=2 actions=drop
1978 in_port=3 actions=drop
1979 in_port=4 actions=drop
1982 # Adding another flow will be refused.
1983 AT_CHECK([ovs-ofctl add-flow br0 in_port=5,actions=drop], [1], [], [stderr])
1984 AT_CHECK([head -n 1 stderr | ofctl_strip], [0],
1985 [OFPT_ERROR: OFPFMFC_TABLE_FULL
1987 # Also a mod-flow that would add a flow will be refused.
1988 AT_CHECK([ovs-ofctl mod-flows br0 in_port=5,actions=drop], [1], [], [stderr])
1989 AT_CHECK([head -n 1 stderr | ofctl_strip], [0],
1990 [OFPT_ERROR: OFPFMFC_TABLE_FULL
1992 # Replacing or modifying an existing flow is allowed.
1993 AT_CHECK([ovs-ofctl add-flow br0 in_port=4,actions=normal])
1994 AT_CHECK([ovs-ofctl mod-flows br0 in_port=3,actions=output:1])
1995 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1996 in_port=1 actions=drop
1997 in_port=2 actions=drop
1998 in_port=3 actions=output:1
1999 in_port=4 actions=NORMAL
2005 AT_SETUP([ofproto - hard limits on flow table size (OpenFlow 1.2)])
2007 # Configure a maximum of 4 flows.
2010 -- --id=@t0 create Flow_Table flow-limit=4 \
2011 -- set bridge br0 flow_tables:0=@t0 \
2012 | ${PERL} $srcdir/uuidfilt.pl],
2016 for in_port in 1 2 3 4; do
2017 ovs-ofctl -O OpenFlow12 add-flow br0 in_port=$in_port,actions=drop
2019 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
2020 in_port=1 actions=drop
2021 in_port=2 actions=drop
2022 in_port=3 actions=drop
2023 in_port=4 actions=drop
2024 OFPST_FLOW reply (OF1.2):
2026 # Adding another flow will be refused.
2027 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 in_port=5,actions=drop], [1], [], [stderr])
2028 AT_CHECK([head -n 1 stderr | ofctl_strip], [0],
2029 [OFPT_ERROR (OF1.2): OFPFMFC_TABLE_FULL
2031 # Replacing or modifying an existing flow is allowed.
2032 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 in_port=4,actions=normal])
2033 AT_CHECK([ovs-ofctl -O OpenFlow12 mod-flows br0 in_port=3,actions=output:1])
2034 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
2035 in_port=1 actions=drop
2036 in_port=2 actions=drop
2037 in_port=3 actions=output:1
2038 in_port=4 actions=NORMAL
2039 OFPST_FLOW reply (OF1.2):
2044 AT_SETUP([ofproto - eviction upon table overflow (OpenFlow 1.0)])
2046 # Configure a maximum of 4 flows.
2049 -- --id=@t0 create Flow_Table flow-limit=4 overflow-policy=evict \
2050 -- set bridge br0 flow_tables:0=@t0 \
2051 | ${PERL} $srcdir/uuidfilt.pl],
2055 for in_port in 4 3 2 1; do
2056 ovs-ofctl add-flow br0 idle_timeout=${in_port}0,in_port=$in_port,actions=drop
2058 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
2059 idle_timeout=10, in_port=1 actions=drop
2060 idle_timeout=20, in_port=2 actions=drop
2061 idle_timeout=30, in_port=3 actions=drop
2062 idle_timeout=40, in_port=4 actions=drop
2065 # Adding another flow will cause the one that expires soonest to be evicted.
2066 AT_CHECK([ovs-ofctl add-flow br0 in_port=5,actions=drop])
2067 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
2068 idle_timeout=20, in_port=2 actions=drop
2069 idle_timeout=30, in_port=3 actions=drop
2070 idle_timeout=40, in_port=4 actions=drop
2071 in_port=5 actions=drop
2074 # A mod-flow that adds a flow also causes eviction, but replacing or
2075 # modifying an existing flow doesn't.
2076 AT_CHECK([ovs-ofctl mod-flows br0 in_port=6,actions=drop])
2077 AT_CHECK([ovs-ofctl add-flow br0 in_port=4,actions=normal])
2078 AT_CHECK([ovs-ofctl mod-flows br0 in_port=3,actions=output:1])
2079 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
2080 idle_timeout=30, in_port=3 actions=output:1
2081 in_port=4 actions=NORMAL
2082 in_port=5 actions=drop
2083 in_port=6 actions=drop
2086 # Flows with no timeouts at all cannot be evicted.
2087 AT_CHECK([ovs-ofctl add-flow br0 in_port=7,actions=normal])
2088 AT_CHECK([ovs-ofctl add-flow br0 in_port=8,actions=drop], [1], [], [stderr])
2089 AT_CHECK([head -n 1 stderr | ofctl_strip], [0],
2090 [OFPT_ERROR: OFPFMFC_TABLE_FULL
2092 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
2093 in_port=4 actions=NORMAL
2094 in_port=5 actions=drop
2095 in_port=6 actions=drop
2096 in_port=7 actions=NORMAL
2102 AT_SETUP([ofproto - eviction upon table overflow (OpenFlow 1.2)])
2104 # Configure a maximum of 4 flows.
2107 -- --id=@t0 create Flow_Table flow-limit=4 overflow-policy=evict \
2108 -- set bridge br0 flow_tables:0=@t0 \
2109 | ${PERL} $srcdir/uuidfilt.pl],
2113 for in_port in 4 3 2 1; do
2114 ovs-ofctl -O OpenFlow12 add-flow br0 idle_timeout=${in_port}0,in_port=$in_port,actions=drop
2116 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
2117 idle_timeout=10, in_port=1 actions=drop
2118 idle_timeout=20, in_port=2 actions=drop
2119 idle_timeout=30, in_port=3 actions=drop
2120 idle_timeout=40, in_port=4 actions=drop
2121 OFPST_FLOW reply (OF1.2):
2123 # Adding another flow will cause the one that expires soonest to be evicted.
2124 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 in_port=5,actions=drop])
2125 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
2126 idle_timeout=20, in_port=2 actions=drop
2127 idle_timeout=30, in_port=3 actions=drop
2128 idle_timeout=40, in_port=4 actions=drop
2129 in_port=5 actions=drop
2130 OFPST_FLOW reply (OF1.2):
2132 # In OpenFlow 1.2 a mod-flow does not ever add a flow and thus
2133 # has no effect on eviction
2134 AT_CHECK([ovs-ofctl -O OpenFlow12 mod-flows br0 in_port=6,actions=drop])
2135 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 in_port=4,actions=normal])
2136 AT_CHECK([ovs-ofctl -O OpenFlow12 mod-flows br0 in_port=3,actions=output:1])
2137 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
2138 idle_timeout=20, in_port=2 actions=drop
2139 idle_timeout=30, in_port=3 actions=output:1
2140 in_port=4 actions=NORMAL
2141 in_port=5 actions=drop
2142 OFPST_FLOW reply (OF1.2):
2144 # Flows with no timeouts at all cannot be evicted.
2145 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 in_port=6,actions=drop])
2146 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 in_port=7,actions=normal])
2147 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 in_port=8,actions=drop], [1], [], [stderr])
2148 AT_CHECK([head -n 1 stderr | ofctl_strip], [0],
2149 [OFPT_ERROR (OF1.2): OFPFMFC_TABLE_FULL
2151 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
2152 in_port=4 actions=NORMAL
2153 in_port=5 actions=drop
2154 in_port=6 actions=drop
2155 in_port=7 actions=NORMAL
2156 OFPST_FLOW reply (OF1.2):
2161 AT_SETUP([ofproto - eviction using importance upon table overflow (OpenFlow 1.4)])
2163 # Configure a maximum of 4 flows.
2166 -- --id=@t0 create Flow_Table name=evict flow-limit=4 \
2167 -- set bridge br0 flow_tables:0=@t0 \
2168 | ${PERL} $srcdir/uuidfilt.pl],
2171 # Use mod-table to turn on eviction just to demonstrate that it works.
2172 AT_CHECK([ovs-ofctl -O OpenFlow14 mod-table br0 0 evict])
2174 for in_port in 4 3 2 1; do
2175 ovs-ofctl -O Openflow14 add-flow br0 importance=$((in_port + 30)),priority=$((in_port + 5)),hard_timeout=$((in_port + 500)),actions=drop
2177 AT_CHECK([ovs-ofctl -O Openflow14 dump-flows br0 | ofctl_strip | sort], [0], [dnl
2178 hard_timeout=501, importance=31, priority=6 actions=drop
2179 hard_timeout=502, importance=32, priority=7 actions=drop
2180 hard_timeout=503, importance=33, priority=8 actions=drop
2181 hard_timeout=504, importance=34, priority=9 actions=drop
2182 OFPST_FLOW reply (OF1.4):
2184 # Adding another flow will cause the one with lowest importance to be evicted.
2185 AT_CHECK([ovs-ofctl -O Openflow14 add-flow br0 hard_timeout=505,importance=35,priority=10,in_port=2,actions=drop])
2186 AT_CHECK([ovs-ofctl -O Openflow14 dump-flows br0 | ofctl_strip | sort], [0], [dnl
2187 hard_timeout=502, importance=32, priority=7 actions=drop
2188 hard_timeout=503, importance=33, priority=8 actions=drop
2189 hard_timeout=504, importance=34, priority=9 actions=drop
2190 hard_timeout=505, importance=35, priority=10,in_port=2 actions=drop
2191 OFPST_FLOW reply (OF1.4):
2193 # Disable the Eviction configuration.
2194 AT_CHECK([ovs-ofctl -O OpenFlow14 mod-table br0 0 noevict])
2195 # Adding another flow will cause the system to give error for FULL TABLE.
2196 AT_CHECK([ovs-ofctl -O Openflow14 add-flow br0 hard_timeout=506,importance=36,priority=11,actions=drop],[1], [], [stderr])
2197 AT_CHECK([head -n 1 stderr | ofctl_strip], [0],
2198 [OFPT_ERROR (OF1.4): OFPFMFC_TABLE_FULL
2200 #Dump flows. It should show only the old values
2201 AT_CHECK([ovs-ofctl -O Openflow14 dump-flows br0 | ofctl_strip | sort], [0], [dnl
2202 hard_timeout=502, importance=32, priority=7 actions=drop
2203 hard_timeout=503, importance=33, priority=8 actions=drop
2204 hard_timeout=504, importance=34, priority=9 actions=drop
2205 hard_timeout=505, importance=35, priority=10,in_port=2 actions=drop
2206 OFPST_FLOW reply (OF1.4):
2208 # mod-flow that would modify a flow will be done successfully.
2209 AT_CHECK([ovs-ofctl -O Openflow14 mod-flows br0 in_port=2,actions=NORMAL])
2210 AT_CHECK([ovs-ofctl -O Openflow14 dump-flows br0 | ofctl_strip | sort], [0], [dnl
2211 hard_timeout=502, importance=32, priority=7 actions=drop
2212 hard_timeout=503, importance=33, priority=8 actions=drop
2213 hard_timeout=504, importance=34, priority=9 actions=drop
2214 hard_timeout=505, importance=35, priority=10,in_port=2 actions=NORMAL
2215 OFPST_FLOW reply (OF1.4):
2217 # Also a mod-flow that would add a flow will be refused.
2218 AT_CHECK([ovs-ofctl mod-flows br0 in_port=5,actions=drop], [1], [], [stderr])
2219 AT_CHECK([head -n 1 stderr | ofctl_strip], [0],
2220 [OFPT_ERROR: OFPFMFC_TABLE_FULL
2225 AT_SETUP([ofproto - eviction upon table overflow, with fairness (OpenFlow 1.0)])
2227 # Configure a maximum of 4 flows.
2230 -- --id=@t0 create Flow_Table name=evict flow-limit=4 \
2231 overflow-policy=evict \
2232 groups='"NXM_OF_IN_PORT[[]]"' \
2233 -- set bridge br0 flow_tables:0=@t0 \
2234 | ${PERL} $srcdir/uuidfilt.pl],
2238 ovs-ofctl add-flows br0 - <<EOF
2239 idle_timeout=10 in_port=2 dl_src=00:44:55:66:77:88 actions=drop
2240 idle_timeout=20 in_port=1 dl_src=00:11:22:33:44:55 actions=drop
2241 idle_timeout=30 in_port=1 dl_src=00:22:33:44:55:66 actions=drop
2242 idle_timeout=40 in_port=1 dl_src=00:33:44:55:66:77 actions=drop
2244 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
2245 idle_timeout=10, in_port=2,dl_src=00:44:55:66:77:88 actions=drop
2246 idle_timeout=20, in_port=1,dl_src=00:11:22:33:44:55 actions=drop
2247 idle_timeout=30, in_port=1,dl_src=00:22:33:44:55:66 actions=drop
2248 idle_timeout=40, in_port=1,dl_src=00:33:44:55:66:77 actions=drop
2251 # Adding another flow will cause the one that expires soonest within
2252 # the largest group (those with in_port=1) to be evicted. In this
2253 # case this is not the same as the one that expires soonest overall
2254 # (which is what makes the test interesting):
2255 AT_CHECK([ovs-ofctl add-flow br0 in_port=2,dl_src=00:55:66:77:88:99,actions=drop])
2256 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
2257 idle_timeout=10, in_port=2,dl_src=00:44:55:66:77:88 actions=drop
2258 idle_timeout=30, in_port=1,dl_src=00:22:33:44:55:66 actions=drop
2259 idle_timeout=40, in_port=1,dl_src=00:33:44:55:66:77 actions=drop
2260 in_port=2,dl_src=00:55:66:77:88:99 actions=drop
2263 # Enlarge the flow limit, change the eviction policy back to strictly
2264 # based on expiration, and and add some flows.
2265 AT_CHECK([ovs-vsctl set Flow_Table evict groups='[[]]' flow-limit=7])
2266 ovs-ofctl add-flows br0 - <<EOF
2267 idle_timeout=50 in_port=2 dl_src=00:66:77:88:99:aa actions=drop
2268 idle_timeout=60 in_port=2 dl_src=00:77:88:99:aa:bb actions=drop
2269 idle_timeout=70 in_port=2 dl_src=00:88:99:aa:bb:cc actions=drop
2271 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
2272 idle_timeout=10, in_port=2,dl_src=00:44:55:66:77:88 actions=drop
2273 idle_timeout=30, in_port=1,dl_src=00:22:33:44:55:66 actions=drop
2274 idle_timeout=40, in_port=1,dl_src=00:33:44:55:66:77 actions=drop
2275 idle_timeout=50, in_port=2,dl_src=00:66:77:88:99:aa actions=drop
2276 idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=drop
2277 idle_timeout=70, in_port=2,dl_src=00:88:99:aa:bb:cc actions=drop
2278 in_port=2,dl_src=00:55:66:77:88:99 actions=drop
2281 # Adding another flow will cause the one that expires soonest overall
2283 AT_CHECK([ovs-ofctl add-flow br0 'idle_timeout=80 in_port=2 dl_src=00:99:aa:bb:cc:dd actions=drop'])
2284 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
2285 idle_timeout=30, in_port=1,dl_src=00:22:33:44:55:66 actions=drop
2286 idle_timeout=40, in_port=1,dl_src=00:33:44:55:66:77 actions=drop
2287 idle_timeout=50, in_port=2,dl_src=00:66:77:88:99:aa actions=drop
2288 idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=drop
2289 idle_timeout=70, in_port=2,dl_src=00:88:99:aa:bb:cc actions=drop
2290 idle_timeout=80, in_port=2,dl_src=00:99:aa:bb:cc:dd actions=drop
2291 in_port=2,dl_src=00:55:66:77:88:99 actions=drop
2294 # Reducing the flow limit also causes the flows that expire soonest
2295 # overall to be evicted.
2296 AT_CHECK([ovs-vsctl set Flow_Table evict flow-limit=4])
2297 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
2298 idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=drop
2299 idle_timeout=70, in_port=2,dl_src=00:88:99:aa:bb:cc actions=drop
2300 idle_timeout=80, in_port=2,dl_src=00:99:aa:bb:cc:dd actions=drop
2301 in_port=2,dl_src=00:55:66:77:88:99 actions=drop
2307 AT_SETUP([ofproto - eviction upon table overflow, with fairness (OpenFlow 1.2)])
2309 # Configure a maximum of 4 flows.
2312 -- --id=@t0 create Flow_Table name=evict flow-limit=4 \
2313 overflow-policy=evict \
2314 groups='"NXM_OF_IN_PORT[[]]"' \
2315 -- set bridge br0 flow_tables:0=@t0 \
2316 | ${PERL} $srcdir/uuidfilt.pl],
2320 ovs-ofctl -O OpenFlow12 add-flows br0 - <<EOF
2321 idle_timeout=10 in_port=2 dl_src=00:44:55:66:77:88 actions=drop
2322 idle_timeout=20 in_port=1 dl_src=00:11:22:33:44:55 actions=drop
2323 idle_timeout=30 in_port=1 dl_src=00:22:33:44:55:66 actions=drop
2324 idle_timeout=40 in_port=1 dl_src=00:33:44:55:66:77 actions=drop
2326 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
2327 idle_timeout=10, in_port=2,dl_src=00:44:55:66:77:88 actions=drop
2328 idle_timeout=20, in_port=1,dl_src=00:11:22:33:44:55 actions=drop
2329 idle_timeout=30, in_port=1,dl_src=00:22:33:44:55:66 actions=drop
2330 idle_timeout=40, in_port=1,dl_src=00:33:44:55:66:77 actions=drop
2331 OFPST_FLOW reply (OF1.2):
2333 # Adding another flow will cause the one that expires soonest within
2334 # the largest group (those with in_port=1) to be evicted. In this
2335 # case this is not the same as the one that expires soonest overall
2336 # (which is what makes the test interesting):
2337 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 in_port=2,dl_src=00:55:66:77:88:99,actions=drop])
2338 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
2339 idle_timeout=10, in_port=2,dl_src=00:44:55:66:77:88 actions=drop
2340 idle_timeout=30, in_port=1,dl_src=00:22:33:44:55:66 actions=drop
2341 idle_timeout=40, in_port=1,dl_src=00:33:44:55:66:77 actions=drop
2342 in_port=2,dl_src=00:55:66:77:88:99 actions=drop
2343 OFPST_FLOW reply (OF1.2):
2345 # Enlarge the flow limit, change the eviction policy back to strictly
2346 # based on expiration, and and add some flows.
2347 AT_CHECK([ovs-vsctl set Flow_Table evict groups='[[]]' flow-limit=7])
2348 ovs-ofctl -O OpenFlow12 add-flows br0 - <<EOF
2349 idle_timeout=50 in_port=2 dl_src=00:66:77:88:99:aa actions=drop
2350 idle_timeout=60 in_port=2 dl_src=00:77:88:99:aa:bb actions=drop
2351 idle_timeout=70 in_port=2 dl_src=00:88:99:aa:bb:cc actions=drop
2353 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
2354 idle_timeout=10, in_port=2,dl_src=00:44:55:66:77:88 actions=drop
2355 idle_timeout=30, in_port=1,dl_src=00:22:33:44:55:66 actions=drop
2356 idle_timeout=40, in_port=1,dl_src=00:33:44:55:66:77 actions=drop
2357 idle_timeout=50, in_port=2,dl_src=00:66:77:88:99:aa actions=drop
2358 idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=drop
2359 idle_timeout=70, in_port=2,dl_src=00:88:99:aa:bb:cc actions=drop
2360 in_port=2,dl_src=00:55:66:77:88:99 actions=drop
2361 OFPST_FLOW reply (OF1.2):
2363 # Adding another flow will cause the one that expires soonest overall
2365 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'])
2366 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
2367 idle_timeout=30, in_port=1,dl_src=00:22:33:44:55:66 actions=drop
2368 idle_timeout=40, in_port=1,dl_src=00:33:44:55:66:77 actions=drop
2369 idle_timeout=50, in_port=2,dl_src=00:66:77:88:99:aa actions=drop
2370 idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=drop
2371 idle_timeout=70, in_port=2,dl_src=00:88:99:aa:bb:cc actions=drop
2372 idle_timeout=80, in_port=2,dl_src=00:99:aa:bb:cc:dd actions=drop
2373 in_port=2,dl_src=00:55:66:77:88:99 actions=drop
2374 OFPST_FLOW reply (OF1.2):
2376 # Reducing the flow limit also causes the flows that expire soonest
2377 # overall to be evicted.
2378 AT_CHECK([ovs-vsctl set Flow_Table evict flow-limit=4])
2379 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
2380 idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=drop
2381 idle_timeout=70, in_port=2,dl_src=00:88:99:aa:bb:cc actions=drop
2382 idle_timeout=80, in_port=2,dl_src=00:99:aa:bb:cc:dd actions=drop
2383 in_port=2,dl_src=00:55:66:77:88:99 actions=drop
2384 OFPST_FLOW reply (OF1.2):
2389 AT_SETUP([ofproto - eviction upon table overflow, with modified hard timeout])
2391 # Configure a maximum of 4 flows.
2394 -- --id=@t0 create Flow_Table flow-limit=4 overflow-policy=evict \
2395 -- set bridge br0 flow_tables:0=@t0 \
2396 | ${PERL} $srcdir/uuidfilt.pl],
2399 ovs-appctl time/stop
2401 for in_port in 4 3 2 1; do
2402 ovs-ofctl add-flow br0 hard_timeout=$((10 + in_port * 3)),in_port=$in_port,actions=drop
2404 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
2405 hard_timeout=13, in_port=1 actions=drop
2406 hard_timeout=16, in_port=2 actions=drop
2407 hard_timeout=19, in_port=3 actions=drop
2408 hard_timeout=22, in_port=4 actions=drop
2411 # Sleep and modify the one that expires soonest
2412 ovs-appctl time/warp 5000
2413 AT_CHECK([ovs-ofctl mod-flows br0 in_port=1,actions=drop])
2414 # At this point the table would looks like:
2415 # in_port seconds to expire
2420 ovs-appctl time/warp 2000
2421 # Adding another flow will cause the one that expires soonest to be evicted.
2422 AT_CHECK([ovs-ofctl add-flow br0 in_port=5,actions=drop])
2423 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
2424 hard_timeout=13, in_port=1 actions=drop
2425 hard_timeout=19, in_port=3 actions=drop
2426 hard_timeout=22, in_port=4 actions=drop
2427 in_port=5 actions=drop
2433 AT_SETUP([ofproto - eviction upon table overflow, with modified idle timeout])
2434 OVS_VSWITCHD_START([add-port br0 p1 -- set interface p1 type=dummy ofport_request=1])
2435 # Configure a maximum of 4 flows.
2438 -- --id=@t0 create Flow_Table flow-limit=4 overflow-policy=evict \
2439 -- set bridge br0 flow_tables:0=@t0 \
2440 | ${PERL} $srcdir/uuidfilt.pl],
2444 for in_port in 4 3 2 1; do
2445 ovs-ofctl add-flow br0 idle_timeout=$((10 + in_port * 3)),in_port=$in_port,actions=drop
2447 ovs-appctl time/stop
2448 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
2449 idle_timeout=13, in_port=1 actions=drop
2450 idle_timeout=16, in_port=2 actions=drop
2451 idle_timeout=19, in_port=3 actions=drop
2452 idle_timeout=22, in_port=4 actions=drop
2455 # Sleep and receive on the flow that expires soonest
2456 ovs-appctl time/warp 5000
2457 AT_CHECK([ovs-appctl netdev-dummy/receive p1 'in_port(1)'])
2458 # At this point the table would looks like:
2459 # in_port seconds to expire
2464 ovs-appctl time/warp 2000
2465 # Adding another flow will cause the one that expires soonest to be evicted.
2466 AT_CHECK([ovs-ofctl add-flow br0 in_port=5,actions=drop])
2467 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
2468 idle_timeout=19, in_port=3 actions=drop
2469 idle_timeout=22, in_port=4 actions=drop
2470 in_port=5 actions=drop
2471 n_packets=1, n_bytes=60, idle_timeout=13, in_port=1 actions=drop
2477 AT_SETUP([ofproto - asynchronous message control (OpenFlow 1.0)])
2479 AT_CHECK([ovs-ofctl -P openflow10 monitor br0 --detach --no-chdir --pidfile])
2481 printf '\n\n--- check_async %d ---\n\n\n' $1
2484 ovs-appctl -t ovs-ofctl ofctl/barrier
2485 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
2488 # OFPT_PACKET_IN, OFPR_ACTION (controller_id=0)
2489 ovs-ofctl -v packet-out br0 controller controller '0001020304050010203040501234'
2490 if test X"$1" = X"OFPR_ACTION"; then shift;
2491 echo >>expout "OFPT_PACKET_IN: total_len=14 in_port=CONTROLLER (via action) data_len=14 (unbuffered)
2492 vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1234"
2495 # OFPT_PACKET_IN, OFPR_NO_MATCH (controller_id=123)
2496 ovs-ofctl -v packet-out br0 controller 'controller(reason=no_match,id=123)' '0001020304050010203040501234'
2497 if test X"$1" = X"OFPR_NO_MATCH"; then shift;
2498 echo >>expout "OFPT_PACKET_IN: total_len=14 in_port=CONTROLLER (via no_match) data_len=14 (unbuffered)
2499 vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1234"
2502 # OFPT_PACKET_IN, OFPR_INVALID_TTL (controller_id=0)
2503 ovs-ofctl packet-out br0 controller dec_ttl '002583dfb4000026b98cb0f908004500003eb7e200000011339bac11370dac100002d7730035002b8f6d86fb0100000100000000000006626c702d7873066e696369726103636f6d00000f00'
2504 if test X"$1" = X"OFPR_INVALID_TTL"; then shift;
2505 echo >>expout "OFPT_PACKET_IN: total_len=76 in_port=CONTROLLER (via invalid_ttl) data_len=76 (unbuffered)
2506 udp,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"
2509 # OFPT_PORT_STATUS, OFPPR_ADD
2510 ovs-vsctl add-port br0 test -- set Interface test type=dummy ofport_request=1
2511 if test X"$1" = X"OFPPR_ADD"; then shift;
2512 echo >>expout "OFPT_PORT_STATUS: ADD: 1(test): addr:aa:55:aa:55:00:0x
2515 speed: 0 Mbps now, 0 Mbps max"
2518 # OFPT_PORT_STATUS, OFPPR_DELETE
2519 ovs-vsctl del-port br0 test
2520 if test X"$1" = X"OFPPR_DELETE"; then shift;
2521 echo >>expout "OFPT_PORT_STATUS: DEL: 1(test): addr:aa:55:aa:55:00:0x
2524 speed: 0 Mbps now, 0 Mbps max"
2527 # OFPT_FLOW_REMOVED, OFPRR_DELETE
2528 ovs-ofctl add-flow br0 send_flow_rem,actions=drop
2529 ovs-ofctl --strict del-flows br0 ''
2530 if test X"$1" = X"OFPRR_DELETE"; then shift;
2531 echo >>expout "OFPT_FLOW_REMOVED: reason=delete"
2533 AT_FAIL_IF([test X"$1" != X])
2535 ovs-appctl -t ovs-ofctl ofctl/barrier
2536 echo >>expout "OFPT_BARRIER_REPLY:"
2540 s/ (xid=0x[0-9a-fA-F]*)//
2542 s/00:0.$/00:0x/' < monitor.log]],
2546 # It's a service connection so initially there should be no async messages.
2549 # Set miss_send_len to 128, turning on packet-ins for our service connection.
2550 ovs-appctl -t ovs-ofctl ofctl/send 0109000c0123456700000080
2551 check_async 2 OFPR_ACTION OFPPR_ADD OFPPR_DELETE OFPRR_DELETE
2553 # Set miss_send_len to 128 and enable invalid_ttl.
2554 ovs-appctl -t ovs-ofctl ofctl/send 0109000c0123456700040080
2555 check_async 3 OFPR_ACTION OFPR_INVALID_TTL OFPPR_ADD OFPPR_DELETE OFPRR_DELETE
2557 # Become slave, which should disable everything except port status.
2558 ovs-appctl -t ovs-ofctl ofctl/send 0104001400000002000023200000000a00000002
2559 check_async 4 OFPPR_ADD OFPPR_DELETE
2561 # Use NXT_SET_ASYNC_CONFIG to enable a patchwork of asynchronous messages.
2562 ovs-appctl -t ovs-ofctl ofctl/send 01040028000000020000232000000013000000020000000500000005000000020000000200000005
2563 check_async 5 OFPR_INVALID_TTL OFPPR_DELETE OFPRR_DELETE
2565 # Set controller ID 123.
2566 ovs-appctl -t ovs-ofctl ofctl/send 01040018000000030000232000000014000000000000007b
2567 check_async 6 OFPR_NO_MATCH OFPPR_DELETE OFPRR_DELETE
2569 # Restore controller ID 0.
2570 ovs-appctl -t ovs-ofctl ofctl/send 010400180000000300002320000000140000000000000000
2573 ovs-appctl -t ovs-ofctl ofctl/send 0104001400000002000023200000000a00000001
2574 check_async 7 OFPR_ACTION OFPPR_ADD
2576 ovs-appctl -t ovs-ofctl exit
2580 AT_SETUP([ofproto - asynchronous message control (OpenFlow 1.2)])
2582 AT_CHECK([ovs-ofctl -O OpenFlow12 monitor br0 --detach --no-chdir --pidfile])
2584 printf '\n\n--- check_async %d ---\n\n\n' $1
2588 ovs-appctl -t ovs-ofctl ofctl/barrier
2589 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
2592 # OFPT_PACKET_IN, OFPR_ACTION (controller_id=0)
2593 ovs-ofctl -O OpenFlow12 -v packet-out br0 none controller '0001020304050010203040501234'
2594 if test X"$1" = X"OFPR_ACTION"; then shift;
2595 echo >>expout "OFPT_PACKET_IN (OF1.2): total_len=14 in_port=ANY (via action) data_len=14 (unbuffered)
2596 vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1234"
2599 # OFPT_PACKET_IN, OFPR_NO_MATCH (controller_id=123)
2600 ovs-ofctl -O OpenFlow12 -v packet-out br0 none 'controller(reason=no_match,id=123)' '0001020304050010203040501234'
2601 if test X"$1" = X"OFPR_NO_MATCH"; then shift;
2602 echo >>expout "OFPT_PACKET_IN (OF1.2): total_len=14 in_port=ANY (via no_match) data_len=14 (unbuffered)
2603 vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1234"
2606 # OFPT_PACKET_IN, OFPR_INVALID_TTL (controller_id=0)
2607 ovs-ofctl -O OpenFlow12 packet-out br0 none dec_ttl '002583dfb4000026b98cb0f908004500003eb7e200000011339bac11370dac100002d7730035002b8f6d86fb0100000100000000000006626c702d7873066e696369726103636f6d00000f00'
2608 if test X"$1" = X"OFPR_INVALID_TTL"; then shift;
2609 echo >>expout "OFPT_PACKET_IN (OF1.2): total_len=76 in_port=ANY (via invalid_ttl) data_len=76 (unbuffered)
2610 udp,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"
2613 # OFPT_PORT_STATUS, OFPPR_ADD
2614 ovs-vsctl add-port br0 test -- set Interface test type=dummy
2615 if test X"$1" = X"OFPPR_ADD"; then shift;
2616 echo >>expout "OFPT_PORT_STATUS (OF1.2): ADD: ${INDEX}(test): addr:aa:55:aa:55:00:0x
2619 speed: 0 Mbps now, 0 Mbps max"
2622 # OFPT_PORT_STATUS, OFPPR_DELETE
2623 ovs-vsctl del-port br0 test
2624 if test X"$1" = X"OFPPR_DELETE"; then shift;
2625 echo >>expout "OFPT_PORT_STATUS (OF1.2): DEL: ${INDEX}(test): addr:aa:55:aa:55:00:0x
2628 speed: 0 Mbps now, 0 Mbps max"
2631 # OFPT_FLOW_REMOVED, OFPRR_DELETE
2632 ovs-ofctl -O OpenFlow12 add-flow br0 send_flow_rem,actions=drop
2633 ovs-ofctl -O OpenFlow12 --strict del-flows br0 ''
2634 if test X"$1" = X"OFPRR_DELETE"; then shift;
2635 echo >>expout "OFPT_FLOW_REMOVED (OF1.2): reason=delete table_id=0"
2637 AT_FAIL_IF([test X"$1" != X])
2643 s/ (xid=0x[0-9a-fA-F]*)//
2645 s/00:0.$/00:0x/' < monitor.log]],
2649 # It's a service connection so initially there should be no async messages.
2652 # Set miss_send_len to 128, turning on packet-ins for our service connection.
2653 ovs-appctl -t ovs-ofctl ofctl/send 0309000c0123456700000080
2654 check_async 2 OFPR_ACTION OFPPR_ADD OFPPR_DELETE OFPRR_DELETE
2656 # Set miss_send_len to 128 and enable invalid_ttl.
2657 ovs-appctl -t ovs-ofctl ofctl/send 0309000c0123456700040080
2658 check_async 3 OFPR_ACTION OFPR_INVALID_TTL OFPPR_ADD OFPPR_DELETE OFPRR_DELETE
2660 # Become slave (OF 1.2), which should disable everything except port status.
2661 ovs-appctl -t ovs-ofctl ofctl/send 031800180000000200000003000000000000000000000001
2662 check_async 4 OFPPR_ADD OFPPR_DELETE
2664 # Use NXT_SET_ASYNC_CONFIG to enable a patchwork of asynchronous messages.
2665 ovs-appctl -t ovs-ofctl ofctl/send 03040028000000020000232000000013000000020000000500000005000000020000000200000005
2666 check_async 5 OFPR_INVALID_TTL OFPPR_DELETE OFPRR_DELETE
2668 # Set controller ID 123.
2669 ovs-appctl -t ovs-ofctl ofctl/send 03040018000000030000232000000014000000000000007b
2670 check_async 6 OFPR_NO_MATCH OFPPR_DELETE OFPRR_DELETE
2672 # Restore controller ID 0.
2673 ovs-appctl -t ovs-ofctl ofctl/send 030400180000000300002320000000140000000000000000
2675 # Become master (OF 1.2).
2676 ovs-appctl -t ovs-ofctl ofctl/send 031800180000000400000002000000000000000000000002
2677 check_async 7 OFPR_ACTION OFPPR_ADD
2679 ovs-appctl -t ovs-ofctl exit
2683 AT_SETUP([ofproto - asynchronous message control (OpenFlow 1.3)])
2685 AT_CHECK([ovs-ofctl -O OpenFlow13 monitor br0 --detach --no-chdir --pidfile])
2687 printf '\n\n--- check_async %d ---\n\n\n' $1
2691 ovs-appctl -t ovs-ofctl ofctl/barrier
2692 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
2695 # OFPT_PACKET_IN, OFPR_ACTION (controller_id=0)
2696 ovs-ofctl -O OpenFlow13 -v packet-out br0 none controller '0001020304050010203040501234'
2697 if test X"$1" = X"OFPR_ACTION"; then shift;
2698 echo >>expout "OFPT_PACKET_IN (OF1.3): total_len=14 in_port=ANY (via action) data_len=14 (unbuffered)
2699 vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1234"
2702 # OFPT_PACKET_IN, OFPR_NO_MATCH (controller_id=123)
2703 ovs-ofctl -O OpenFlow13 -v packet-out br0 none 'controller(reason=no_match,id=123)' '0001020304050010203040501234'
2704 if test X"$1" = X"OFPR_NO_MATCH"; then shift;
2705 echo >>expout "OFPT_PACKET_IN (OF1.3): total_len=14 in_port=ANY (via no_match) data_len=14 (unbuffered)
2706 vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1234"
2709 # OFPT_PACKET_IN, OFPR_INVALID_TTL (controller_id=0)
2710 ovs-ofctl -O OpenFlow13 packet-out br0 none dec_ttl '002583dfb4000026b98cb0f908004500003eb7e200000011339bac11370dac100002d7730035002b8f6d86fb0100000100000000000006626c702d7873066e696369726103636f6d00000f00'
2711 if test X"$1" = X"OFPR_INVALID_TTL"; then shift;
2712 echo >>expout "OFPT_PACKET_IN (OF1.3): total_len=76 in_port=ANY (via invalid_ttl) data_len=76 (unbuffered)
2713 udp,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"
2716 # OFPT_PORT_STATUS, OFPPR_ADD
2717 ovs-vsctl add-port br0 test -- set Interface test type=dummy
2718 if test X"$1" = X"OFPPR_ADD"; then shift;
2719 echo >>expout "OFPT_PORT_STATUS (OF1.3): ADD: ${INDEX}(test): addr:aa:55:aa:55:00:0x
2722 speed: 0 Mbps now, 0 Mbps max"
2725 # OFPT_PORT_STATUS, OFPPR_DELETE
2726 ovs-vsctl del-port br0 test
2727 if test X"$1" = X"OFPPR_DELETE"; then shift;
2728 echo >>expout "OFPT_PORT_STATUS (OF1.3): DEL: ${INDEX}(test): addr:aa:55:aa:55:00:0x
2731 speed: 0 Mbps now, 0 Mbps max"
2734 # OFPT_FLOW_REMOVED, OFPRR_DELETE
2735 ovs-ofctl -O OpenFlow13 add-flow br0 send_flow_rem,actions=drop
2736 ovs-ofctl -O OpenFlow13 --strict del-flows br0 ''
2737 if test X"$1" = X"OFPRR_DELETE"; then shift;
2738 echo >>expout "OFPT_FLOW_REMOVED (OF1.3): reason=delete table_id=0"
2741 # OFPT_FLOW_REMOVED, OFPRR_GROUP_DELETE
2742 ovs-ofctl -O OpenFlow13 add-group br0 group_id=1234,type=all,bucket=output:10
2743 ovs-ofctl -O OpenFlow13 add-flow br0 send_flow_rem,actions=group:1234
2744 ovs-ofctl -O OpenFlow13 --strict del-groups br0 group_id=1234
2745 if test X"$1" = X"OFPRR_DELETE"; then shift;
2746 echo >>expout "OFPT_FLOW_REMOVED (OF1.3): reason=gropu_delete table_id=0"
2749 AT_FAIL_IF([test X"$1" != X])
2751 ovs-appctl -t ovs-ofctl ofctl/barrier
2752 echo >>expout "OFPT_BARRIER_REPLY (OF1.3):"
2756 s/ (xid=0x[0-9a-fA-F]*)//
2758 s/00:0.$/00:0x/' < monitor.log]],
2762 # It's a service connection so initially there should be no async messages.
2765 # Set miss_send_len to 128, turning on packet-ins for our service connection.
2766 ovs-appctl -t ovs-ofctl ofctl/send 0409000c0123456700000080
2767 check_async 2 OFPR_ACTION OFPPR_ADD OFPPR_DELETE OFPRR_DELETE
2769 # Become slave (OF 1.3), which should disable everything except port status.
2770 ovs-appctl -t ovs-ofctl ofctl/send 041800180000000200000003000000000000000000000001
2771 check_async 3 OFPPR_ADD OFPPR_DELETE
2773 # Use OF 1.3 OFPT_SET_ASYNC to enable a patchwork of asynchronous messages.
2774 ovs-appctl -t ovs-ofctl ofctl/send 041c002000000002000000020000000500000005000000020000000200000005
2775 check_async 4 OFPR_INVALID_TTL OFPPR_DELETE OFPRR_DELETE
2777 # Set controller ID 123.
2778 ovs-appctl -t ovs-ofctl ofctl/send 04040018000000030000232000000014000000000000007b
2779 check_async 5 OFPR_NO_MATCH OFPPR_DELETE OFPRR_DELETE
2781 # Restore controller ID 0.
2782 ovs-appctl -t ovs-ofctl ofctl/send 040400180000000300002320000000140000000000000000
2784 # Become master (OF 1.3).
2785 ovs-appctl -t ovs-ofctl ofctl/send 041800180000000400000002000000000000000000000002
2786 check_async 6 OFPR_ACTION OFPPR_ADD
2788 ovs-appctl -t ovs-ofctl exit
2792 AT_SETUP([ofproto - asynchronous message control (OpenFlow 1.4)])
2794 AT_CHECK([ovs-ofctl -O OpenFlow14 monitor br0 --detach --no-chdir --pidfile])
2796 printf '\n\n--- check_async %d ---\n\n\n' $1
2800 ovs-appctl -t ovs-ofctl ofctl/barrier
2801 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
2804 # OFPT_PACKET_IN, OFPR_ACTION (controller_id=0)
2805 ovs-ofctl -O OpenFlow14 -v packet-out br0 none controller '0001020304050010203040501234'
2806 if test X"$1" = X"OFPR_ACTION"; then shift;
2807 echo >>expout "OFPT_PACKET_IN (OF1.4): total_len=14 in_port=ANY (via action) data_len=14 (unbuffered)
2808 vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1234"
2811 # OFPT_PACKET_IN, OFPR_NO_MATCH (controller_id=123)
2812 ovs-ofctl -O OpenFlow14 -v packet-out br0 none 'controller(reason=no_match,id=123)' '0001020304050010203040501234'
2813 if test X"$1" = X"OFPR_NO_MATCH"; then shift;
2814 echo >>expout "OFPT_PACKET_IN (OF1.4): total_len=14 in_port=ANY (via no_match) data_len=14 (unbuffered)
2815 vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1234"
2818 # OFPT_PACKET_IN, OFPR_INVALID_TTL (controller_id=0)
2819 ovs-ofctl -O OpenFlow14 packet-out br0 none dec_ttl '002583dfb4000026b98cb0f908004500003eb7e200000011339bac11370dac100002d7730035002b8f6d86fb0100000100000000000006626c702d7873066e696369726103636f6d00000f00'
2820 if test X"$1" = X"OFPR_INVALID_TTL"; then shift;
2821 echo >>expout "OFPT_PACKET_IN (OF1.4): total_len=76 in_port=ANY (via invalid_ttl) data_len=76 (unbuffered)
2822 udp,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"
2825 # OFPT_PORT_STATUS, OFPPR_ADD
2826 ovs-vsctl add-port br0 test -- set Interface test type=dummy
2827 if test X"$1" = X"OFPPR_ADD"; then shift;
2828 echo >>expout "OFPT_PORT_STATUS (OF1.4): ADD: ${INDEX}(test): addr:aa:55:aa:55:00:0x
2831 speed: 0 Mbps now, 0 Mbps max"
2834 # OFPT_PORT_STATUS, OFPPR_MODIFY
2835 ovs-ofctl -O OpenFlow14 -vwarn mod-port br0 test up
2836 if test X"$1" = X"OFPPR_MODIFY"; then shift;
2837 echo >>expout "OFPT_PORT_STATUS (OF1.4): MOD: ${INDEX}(test): addr:aa:55:aa:55:00:0x
2840 speed: 0 Mbps now, 0 Mbps max
2841 OFPT_PORT_STATUS (OF1.4): MOD: ${INDEX}(test): addr:aa:55:aa:55:00:0x
2844 speed: 0 Mbps now, 0 Mbps max"
2847 # OFPT_PORT_STATUS, OFPPR_DELETE
2848 ovs-vsctl del-port br0 test
2849 if test X"$1" = X"OFPPR_DELETE"; then shift;
2850 echo >>expout "OFPT_PORT_STATUS (OF1.4): DEL: ${INDEX}(test): addr:aa:55:aa:55:00:0x
2853 speed: 0 Mbps now, 0 Mbps max"
2856 # OFPT_FLOW_REMOVED, OFPRR_DELETE
2857 ovs-ofctl -O OpenFlow14 add-flow br0 send_flow_rem,actions=drop
2858 ovs-ofctl -O OpenFlow14 --strict del-flows br0 ''
2859 if test X"$1" = X"OFPRR_DELETE"; then shift;
2860 echo >>expout "OFPT_FLOW_REMOVED (OF1.4): reason=delete table_id=0"
2863 # OFPT_FLOW_REMOVED, OFPRR_GROUP_DELETE
2864 ovs-ofctl -O OpenFlow14 add-group br0 group_id=1234,type=all,bucket=output:10
2865 ovs-ofctl -O OpenFlow14 add-flow br0 send_flow_rem,actions=group:1234
2866 ovs-ofctl -O OpenFlow14 --strict del-groups br0 group_id=1234
2867 if test X"$1" = X"OFPRR_GROUP_DELETE"; then shift;
2868 echo >>expout "OFPT_FLOW_REMOVED (OF1.4): reason=group_delete table_id=0"
2871 AT_FAIL_IF([test X"$1" != X])
2873 ovs-appctl -t ovs-ofctl ofctl/barrier
2874 echo >>expout "OFPT_BARRIER_REPLY (OF1.4):"
2878 s/ (xid=0x[0-9a-fA-F]*)//
2880 s/00:0.$/00:0x/' < monitor.log]],
2884 # It's a service connection so initially there should be no async messages.
2887 # Set miss_send_len to 128, turning on packet-ins for our service connection.
2888 ovs-appctl -t ovs-ofctl ofctl/send 0509000c0123456700000080
2889 check_async 2 OFPR_ACTION OFPPR_ADD OFPPR_MODIFY OFPPR_DELETE OFPRR_DELETE OFPRR_GROUP_DELETE
2891 # Become slave (OF 1.4), which should disable everything except port status.
2892 ovs-appctl -t ovs-ofctl ofctl/send 051800180000000200000003000000000000000000000001
2893 check_async 3 OFPPR_ADD OFPPR_MODIFY OFPPR_DELETE
2895 # Use OF 1.4 OFPT_SET_ASYNC to enable a patchwork of asynchronous messages.
2896 ovs-appctl -t ovs-ofctl ofctl/send 051c0038000000020000000800000005000100080000000200020008000000020003000800000005000400080000001c0005000800000005
2897 check_async 4 OFPR_INVALID_TTL OFPPR_DELETE OFPRR_DELETE OFPRR_GROUP_DELETE
2899 # Set controller ID 123.
2900 ovs-appctl -t ovs-ofctl ofctl/send 05040018000000030000232000000014000000000000007b
2901 check_async 5 OFPR_NO_MATCH OFPPR_DELETE OFPRR_DELETE OFPRR_GROUP_DELETE
2903 # Restore controller ID 0.
2904 ovs-appctl -t ovs-ofctl ofctl/send 050400180000000300002320000000140000000000000000
2906 # Become master (OF 1.4).
2907 ovs-appctl -t ovs-ofctl ofctl/send 051800180000000400000002000000000000000000000002
2908 check_async 6 OFPR_ACTION OFPPR_ADD OFPPR_MODIFY OFPRR_DELETE
2910 ovs-appctl -t ovs-ofctl exit
2914 AT_SETUP([ofproto - asynchronous message control (OpenFlow 1.5)])
2916 AT_CHECK([ovs-ofctl -O OpenFlow15 monitor br0 --detach --no-chdir --pidfile])
2918 printf '\n\n--- check_async %d ---\n\n\n' $1
2922 ovs-appctl -t ovs-ofctl ofctl/barrier
2923 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
2926 # Other tests are not working with OF 1.5, and message
2927 # format may change, so leave them out.
2929 # OFPT_PORT_STATUS, OFPPR_ADD
2930 ovs-vsctl add-port br0 test -- set Interface test type=dummy
2931 if test X"$1" = X"OFPPR_ADD"; then shift;
2932 echo >>expout "OFPT_PORT_STATUS (OF1.5): ADD: ${INDEX}(test): addr:aa:55:aa:55:00:0x
2935 speed: 0 Mbps now, 0 Mbps max"
2938 # OFPT_PORT_STATUS, OFPPR_MODIFY
2939 ovs-ofctl -O OpenFlow15 -vwarn mod-port br0 test up
2940 if test X"$1" = X"OFPPR_MODIFY"; then shift;
2941 echo >>expout "OFPT_PORT_STATUS (OF1.5): MOD: ${INDEX}(test): addr:aa:55:aa:55:00:0x
2944 speed: 0 Mbps now, 0 Mbps max
2945 OFPT_PORT_STATUS (OF1.5): MOD: 2(test): addr:aa:55:aa:55:00:0x
2948 speed: 0 Mbps now, 0 Mbps max"
2951 # OFPT_PORT_STATUS, OFPPR_DELETE
2952 ovs-vsctl del-port br0 test
2953 if test X"$1" = X"OFPPR_DELETE"; then shift;
2954 echo >>expout "OFPT_PORT_STATUS (OF1.5): DEL: ${INDEX}(test): addr:aa:55:aa:55:00:0x
2957 speed: 0 Mbps now, 0 Mbps max"
2960 AT_FAIL_IF([test X"$1" != X])
2962 ovs-appctl -t ovs-ofctl ofctl/barrier
2963 echo >>expout "OFPT_BARRIER_REPLY (OF1.5):"
2967 s/ (xid=0x[0-9a-fA-F]*)//
2969 s/00:0.$/00:0x/' < monitor.log]],
2973 # It's a service connection so initially there should be no async messages.
2976 # If we don't set this, async messages are not received.
2977 # Set miss_send_len to 128, turning on packet-ins for our service connection.
2978 ovs-appctl -t ovs-ofctl ofctl/send 0609000c0123456700000080
2979 check_async 2 OFPPR_ADD OFPPR_MODIFY OFPPR_DELETE
2981 # Set-async has changed in OF 1.4 and is not yet implemented.
2983 ovs-appctl -t ovs-ofctl exit
2987 dnl This test checks that the role request/response messaging works
2988 dnl and that generation_id is handled properly.
2989 AT_SETUP([ofproto - controller role (OpenFlow 1.2)])
2991 on_exit 'kill `cat c1.pid c2.pid`'
2993 # Start two ovs-ofctl controller processes.
2994 AT_CAPTURE_FILE([monitor1.log])
2995 AT_CAPTURE_FILE([expout1])
2996 AT_CAPTURE_FILE([experr1])
2997 AT_CAPTURE_FILE([monitor2.log])
2998 AT_CAPTURE_FILE([expout2])
2999 AT_CAPTURE_FILE([experr2])
3001 AT_CHECK([ovs-ofctl -O OpenFlow12 monitor br0 --detach --no-chdir --pidfile=`pwd`/c$i.pid --unixctl=`pwd`/c$i])
3002 ovs-appctl -t `pwd`/c$i ofctl/barrier
3003 ovs-appctl -t `pwd`/c$i ofctl/set-output-file monitor$i.log
3007 # find out current role
3008 ovs-appctl -t `pwd`/c$i ofctl/send 031800180000000200000000000000000000000000000000
3009 echo >>experr$i "send: OFPT_ROLE_REQUEST (OF1.2): role=nochange"
3010 echo >>expout$i "OFPT_ROLE_REPLY (OF1.2): role=equal"
3013 # controller 1: Become slave (generation_id is initially undefined, so
3014 # 2^63+2 should not be stale)
3015 ovs-appctl -t `pwd`/c1 ofctl/send 031800180000000300000003000000008000000000000002
3016 echo >>experr1 "send: OFPT_ROLE_REQUEST (OF1.2): role=slave generation_id=9223372036854775810"
3017 echo >>expout1 "OFPT_ROLE_REPLY (OF1.2): role=slave generation_id=9223372036854775810"
3019 # controller 2: Become master.
3020 ovs-appctl -t `pwd`/c2 ofctl/send 031800180000000300000002000000008000000000000003
3021 echo >>experr2 "send: OFPT_ROLE_REQUEST (OF1.2): role=master generation_id=9223372036854775811"
3022 echo >>expout2 "OFPT_ROLE_REPLY (OF1.2): role=master generation_id=9223372036854775811"
3024 # controller 1: Try to become the master using a stale generation ID
3025 ovs-appctl -t `pwd`/c1 ofctl/send 031800180000000400000002000000000000000000000003
3026 echo >>experr1 "send: OFPT_ROLE_REQUEST (OF1.2): role=master generation_id=3"
3027 echo >>expout1 "OFPT_ERROR (OF1.2): OFPRRFC_STALE"
3028 echo >>expout1 "OFPT_ROLE_REQUEST (OF1.2): role=master generation_id=3"
3030 # controller 1: Become master using a valid generation ID
3031 ovs-appctl -t `pwd`/c1 ofctl/send 031800180000000500000002000000000000000000000001
3032 echo >>experr1 "send: OFPT_ROLE_REQUEST (OF1.2): role=master generation_id=1"
3033 echo >>expout1 "OFPT_ROLE_REPLY (OF1.2): role=master generation_id=1"
3036 ovs-appctl -t `pwd`/c$i ofctl/barrier
3037 echo >>expout$i "OFPT_BARRIER_REPLY (OF1.2):"
3043 AT_CHECK([grep -v '^send:' monitor$i.log | STRIP_XIDS], [0], [expout])
3045 AT_CHECK([grep '^send:' monitor$i.log | STRIP_XIDS], [0], [expout])
3050 dnl This test checks that the role request/response messaging works,
3051 dnl that generation_id is handled properly, and that role status update
3052 dnl messages are sent when a controller's role gets changed from master
3054 AT_SETUP([ofproto - controller role (OpenFlow 1.4)])
3056 on_exit 'kill `cat c1.pid c2.pid`'
3058 # Start two ovs-ofctl controller processes.
3059 AT_CAPTURE_FILE([monitor1.log])
3060 AT_CAPTURE_FILE([expout1])
3061 AT_CAPTURE_FILE([experr1])
3062 AT_CAPTURE_FILE([monitor2.log])
3063 AT_CAPTURE_FILE([expout2])
3064 AT_CAPTURE_FILE([experr2])
3066 AT_CHECK([ovs-ofctl -O OpenFlow14 monitor br0 --detach --no-chdir --pidfile=`pwd`/c$i.pid --unixctl=`pwd`/c$i])
3067 ovs-appctl -t `pwd`/c$i ofctl/barrier
3068 ovs-appctl -t `pwd`/c$i ofctl/set-output-file monitor$i.log
3072 # find out current role
3073 ovs-appctl -t `pwd`/c$i ofctl/send 051800180000000200000000000000000000000000000000
3074 echo >>experr$i "send: OFPT_ROLE_REQUEST (OF1.4): role=nochange"
3075 echo >>expout$i "OFPT_ROLE_REPLY (OF1.4): role=equal"
3078 # controller 1: Become slave (generation_id is initially undefined, so
3079 # 2^63+2 should not be stale)
3080 ovs-appctl -t `pwd`/c1 ofctl/send 051800180000000300000003000000008000000000000002
3081 echo >>experr1 "send: OFPT_ROLE_REQUEST (OF1.4): role=slave generation_id=9223372036854775810"
3082 echo >>expout1 "OFPT_ROLE_REPLY (OF1.4): role=slave generation_id=9223372036854775810"
3084 # controller 2: Become master.
3085 ovs-appctl -t `pwd`/c2 ofctl/send 051800180000000300000002000000008000000000000003
3086 echo >>experr2 "send: OFPT_ROLE_REQUEST (OF1.4): role=master generation_id=9223372036854775811"
3087 echo >>expout2 "OFPT_ROLE_REPLY (OF1.4): role=master generation_id=9223372036854775811"
3089 # controller 1: Try to become the master using a stale generation ID
3090 ovs-appctl -t `pwd`/c1 ofctl/send 051800180000000400000002000000000000000000000003
3091 echo >>experr1 "send: OFPT_ROLE_REQUEST (OF1.4): role=master generation_id=3"
3092 echo >>expout1 "OFPT_ERROR (OF1.4): OFPRRFC_STALE"
3093 echo >>expout1 "OFPT_ROLE_REQUEST (OF1.4): role=master generation_id=3"
3095 # controller 1: Become master using a valid generation ID
3096 ovs-appctl -t `pwd`/c1 ofctl/send 051800180000000500000002000000000000000000000001
3097 echo >>experr1 "send: OFPT_ROLE_REQUEST (OF1.4): role=master generation_id=1"
3098 echo >>expout1 "OFPT_ROLE_REPLY (OF1.4): role=master generation_id=1"
3099 echo >>expout2 "OFPT_ROLE_STATUS (OF1.4): role=slave generation_id=1 reason=master_request"
3102 ovs-appctl -t `pwd`/c$i ofctl/barrier
3103 echo >>expout$i "OFPT_BARRIER_REPLY (OF1.4):"
3109 AT_CHECK([grep -v '^send:' monitor$i.log | STRIP_XIDS], [0], [expout])
3111 AT_CHECK([grep '^send:' monitor$i.log | STRIP_XIDS], [0], [expout])
3116 dnl This test checks the Group and meter notifications when a group mod
3117 dnl command is sent from one controller and the reply is received by
3118 dnl other controllers.
3119 AT_SETUP([ofproto - requestforward (OpenFlow 1.4)])
3121 on_exit 'kill `cat c1.pid c2.pid c3.pid`'
3123 # Start two ovs-ofctl controller processes.
3124 AT_CAPTURE_FILE([monitor1.log])
3125 AT_CAPTURE_FILE([expout1])
3126 AT_CAPTURE_FILE([monitor2.log])
3127 AT_CAPTURE_FILE([expout2])
3128 AT_CAPTURE_FILE([monitor3.log])
3129 AT_CAPTURE_FILE([expout3])
3131 ovs-ofctl -O OpenFlow15 monitor br0 --detach --no-chdir --pidfile=`pwd`/c1.pid --unixctl=`pwd`/c1
3132 ovs-ofctl -O OpenFlow14 monitor br0 --detach --no-chdir --pidfile=`pwd`/c2.pid --unixctl=`pwd`/c2
3133 ovs-ofctl -O OpenFlow14 monitor br0 --detach --no-chdir --pidfile=`pwd`/c3.pid --unixctl=`pwd`/c3
3137 ovs-appctl -t `pwd`/c$i ofctl/barrier
3138 ovs-appctl -t `pwd`/c$i ofctl/set-output-file monitor$i.log
3142 printf '\n\n--- check_async %d ---\n\n\n' $1
3147 ovs-appctl -t `pwd`/c2 ofctl/send 050f0010000000020000000000000001
3148 if test X"$1" = X"OFPGC_ADD"; then shift;
3149 echo >>expout2 "send: OFPT_GROUP_MOD (OF1.4):
3150 ADD group_id=1,type=all"
3151 echo >>expout1 "OFPT_REQUESTFORWARD (OF1.5): reason=group_mod
3152 ADD group_id=1,type=all"
3153 echo >>expout3 "OFPT_REQUESTFORWARD (OF1.4): reason=group_mod
3154 ADD group_id=1,type=all"
3158 ovs-appctl -t `pwd`/c2 ofctl/send 050f0010000000020001010000000001
3159 if test X"$1" = X"OFPGC_MODIFY"; then shift;
3160 echo >>expout2 "send: OFPT_GROUP_MOD (OF1.4):
3161 MOD group_id=1,type=select"
3162 echo >>expout1 "OFPT_REQUESTFORWARD (OF1.5): reason=group_mod
3163 MOD group_id=1,type=select"
3164 echo >>expout3 "OFPT_REQUESTFORWARD (OF1.4): reason=group_mod
3165 MOD group_id=1,type=select"
3168 ovs-appctl -t `pwd`/c1 ofctl/barrier
3169 echo >>expout1 "OFPT_BARRIER_REPLY (OF1.5):"
3170 ovs-appctl -t `pwd`/c2 ofctl/barrier
3171 echo >>expout2 "OFPT_BARRIER_REPLY (OF1.4):"
3172 ovs-appctl -t `pwd`/c3 ofctl/barrier
3173 echo >>expout3 "OFPT_BARRIER_REPLY (OF1.4):"
3180 s/ (xid=0x[0-9a-fA-F]*)//'< monitor$i.log]],
3185 # controller 1: Become slave
3186 ovs-appctl -t `pwd`/c1 ofctl/send 061800180000000300000003000000008000000000000002
3188 # controller 2: Become master
3189 ovs-appctl -t `pwd`/c2 ofctl/send 051800180000000300000002000000008000000000000003
3191 # controller 1: Become slave
3192 ovs-appctl -t `pwd`/c3 ofctl/send 051800180000000300000003000000008000000000000004
3194 # controller 1: Enabled requestforward using set Asynchronous message
3195 ovs-appctl -t `pwd`/c1 ofctl/send 061c00280000000200000008000000050002000800000002000400080000001a000a000800000003
3197 # controller 2: Enabled requestforward using set Asynchronous message
3198 ovs-appctl -t `pwd`/c2 ofctl/send 051c002800000002000100080000000200030008000000050005000800000005000b000800000003
3200 # controller 1: Enabled requestforward using set Asynchronous message
3201 ovs-appctl -t `pwd`/c3 ofctl/send 051c00280000000200000008000000050002000800000002000400080000001a000a000800000003
3202 check_async 1 OFPGC_ADD OFPGC_MODIFY
3207 dnl This test checks that OFPT_PACKET_OUT accepts both OFPP_NONE (as
3208 dnl specified by OpenFlow 1.0) and OFPP_CONTROLLER (used by some
3209 dnl controllers despite the spec) as meaning a packet that was generated
3210 dnl by the controller.
3211 AT_SETUP([ofproto - packet-out from controller (OpenFlow 1.0)])
3213 ADD_OF_PORTS([br0], [1])
3215 # Start a monitor listening for packet-ins.
3216 AT_CHECK([ovs-ofctl -P openflow10 monitor br0 --detach --no-chdir --pidfile])
3217 ovs-appctl -t ovs-ofctl ofctl/send 0109000c0123456700000080
3218 ovs-appctl -t ovs-ofctl ofctl/barrier
3219 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
3220 AT_CAPTURE_FILE([monitor.log])
3222 # Send some packet-outs with OFPP_NONE and OFPP_CONTROLLER (65533) as in_port.
3223 AT_CHECK([ovs-ofctl packet-out br0 none controller,1 '0001020304050010203040501234'])
3224 AT_CHECK([ovs-ofctl packet-out br0 controller controller,1 '0001020304050010203040505678'])
3226 # Stop the monitor and check its output.
3227 ovs-appctl -t ovs-ofctl ofctl/barrier
3228 ovs-appctl -t ovs-ofctl exit
3230 ovs-ofctl dump-ports br0
3232 AT_CHECK([sed 's/ (xid=0x[[0-9a-fA-F]]*)//' monitor.log], [0], [dnl
3233 OFPT_PACKET_IN: total_len=14 in_port=ANY (via action) data_len=14 (unbuffered)
3234 vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1234
3235 OFPT_PACKET_IN: total_len=14 in_port=CONTROLLER (via action) data_len=14 (unbuffered)
3236 vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x5678
3243 dnl This test checks that OFPT_PACKET_OUT accepts both OFPP_NONE (as
3244 dnl specified by OpenFlow 1.2) and OFPP_CONTROLLER (used by some
3245 dnl controllers despite the spec) as meaning a packet that was generated
3246 dnl by the controller.
3247 AT_SETUP([ofproto - packet-out from controller (OpenFlow 1.2)])
3250 # Start a monitor listening for packet-ins.
3251 AT_CHECK([ovs-ofctl -O OpenFlow12 monitor br0 --detach --no-chdir --pidfile])
3252 ovs-appctl -t ovs-ofctl ofctl/send 0309000c0123456700000080
3253 ovs-appctl -t ovs-ofctl ofctl/barrier
3254 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
3255 AT_CAPTURE_FILE([monitor.log])
3257 # Send some packet-outs with OFPP_NONE and OFPP_CONTROLLER (65533) as in_port.
3258 AT_CHECK([ovs-ofctl -O OpenFlow12 packet-out br0 none controller '0001020304050010203040501234'])
3259 AT_CHECK([ovs-ofctl -O OpenFlow12 packet-out br0 4294967293 controller '0001020304050010203040505678'])
3261 # Stop the monitor and check its output.
3262 ovs-appctl -t ovs-ofctl ofctl/barrier
3263 ovs-appctl -t ovs-ofctl exit
3265 AT_CHECK([sed 's/ (xid=0x[[0-9a-fA-F]]*)//' monitor.log], [0], [dnl
3266 OFPT_PACKET_IN (OF1.2): total_len=14 in_port=ANY (via action) data_len=14 (unbuffered)
3267 vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1234
3268 OFPT_PACKET_IN (OF1.2): total_len=14 in_port=CONTROLLER (via action) data_len=14 (unbuffered)
3269 vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x5678
3270 OFPT_BARRIER_REPLY (OF1.2):
3276 dnl This test checks that OFPT_PACKET_OUT accepts both OFPP_NONE (as
3277 dnl specified by OpenFlow 1.1) and OFPP_CONTROLLER (used by some
3278 dnl controllers despite the spec) as meaning a packet that was generated
3279 dnl by the controller.
3280 AT_SETUP([ofproto - packet-out from controller (OpenFlow 1.1)])
3283 # Start a monitor listening for packet-ins.
3284 AT_CHECK([ovs-ofctl -O OpenFlow11 monitor br0 --detach --no-chdir --pidfile])
3285 ovs-appctl -t ovs-ofctl ofctl/send 0209000c0123456700000080
3286 ovs-appctl -t ovs-ofctl ofctl/barrier
3287 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
3288 AT_CAPTURE_FILE([monitor.log])
3290 # Send some packet-outs with OFPP_NONE and OFPP_CONTROLLER (65533) as in_port.
3291 AT_CHECK([ovs-ofctl -O OpenFlow11 packet-out br0 none controller '0001020304050010203040501234'])
3292 AT_CHECK([ovs-ofctl -O OpenFlow11 packet-out br0 4294967293 controller '0001020304050010203040505678'])
3294 # Stop the monitor and check its output.
3295 ovs-appctl -t ovs-ofctl ofctl/barrier
3296 ovs-appctl -t ovs-ofctl exit
3298 AT_CHECK([sed 's/ (xid=0x[[0-9a-fA-F]]*)//' monitor.log], [0], [dnl
3299 OFPT_PACKET_IN (OF1.1): total_len=14 in_port=ANY (via action) data_len=14 (unbuffered)
3300 vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1234
3301 OFPT_PACKET_IN (OF1.1): total_len=14 in_port=CONTROLLER (via action) data_len=14 (unbuffered)
3302 vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x5678
3303 OFPT_BARRIER_REPLY (OF1.1):
3309 dnl This test checks that metadata is encoded in packet_in structures,
3310 dnl supported by NXAST.
3311 AT_SETUP([ofproto - packet-out with metadata (NXM)])
3314 # Start a monitor listening for packet-ins.
3315 AT_CHECK([ovs-ofctl -P nxm monitor br0 --detach --no-chdir --pidfile])
3316 ovs-appctl -t ovs-ofctl ofctl/send 0109000c0123456700000080
3317 ovs-appctl -t ovs-ofctl ofctl/barrier
3318 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
3319 AT_CAPTURE_FILE([monitor.log])
3321 # Send a packet-out with a load action to set some metadata, and forward to controller
3322 AT_CHECK([ovs-ofctl packet-out br0 controller 'load(0xfafafafa5a5a5a5a->OXM_OF_METADATA[[0..63]]), load(0xaa->NXM_NX_PKT_MARK[[]]), controller' '0001020304050010203040501234'])
3324 # Stop the monitor and check its output.
3325 ovs-appctl -t ovs-ofctl ofctl/barrier
3326 ovs-appctl -t ovs-ofctl exit
3328 AT_CHECK([sed 's/ (xid=0x[[0-9a-fA-F]]*)//' monitor.log], [0], [dnl
3329 NXT_PACKET_IN: total_len=14 pkt_mark=0xaa,metadata=0xfafafafa5a5a5a5a,in_port=CONTROLLER (via action) data_len=14 (unbuffered)
3330 vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1234
3337 dnl This test checks that metadata is encoded in packet_in structures,
3338 dnl supported by NXAST.
3339 AT_SETUP([ofproto - packet-out with metadata (OpenFlow 1.2)])
3342 # Start a monitor listening for packet-ins.
3343 AT_CHECK([ovs-ofctl -O OpenFlow12 monitor br0 --detach --no-chdir --pidfile])
3344 ovs-appctl -t ovs-ofctl ofctl/send 0309000c0123456700000080
3345 ovs-appctl -t ovs-ofctl ofctl/barrier
3346 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
3347 AT_CAPTURE_FILE([monitor.log])
3349 # Send a packet-out with a set-field action to set some metadata, and forward to controller
3350 AT_CHECK([ovs-ofctl -O OpenFlow12 packet-out br0 none 'set_field:0xfafafafa5a5a5a5a->metadata, controller' '0001020304050010203040501234'])
3352 # Stop the monitor and check its output.
3353 ovs-appctl -t ovs-ofctl ofctl/barrier
3354 ovs-appctl -t ovs-ofctl exit
3356 AT_CHECK([sed 's/ (xid=0x[[0-9a-fA-F]]*)//' monitor.log], [0], [dnl
3357 OFPT_PACKET_IN (OF1.2): total_len=14 metadata=0xfafafafa5a5a5a5a,in_port=ANY (via action) data_len=14 (unbuffered)
3358 vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1234
3359 OFPT_BARRIER_REPLY (OF1.2):
3365 dnl This test checks that metadata is encoded in packet_in structures,
3366 dnl supported by NXAST.
3367 AT_SETUP([ofproto - packet-out with metadata and dual set_field (OpenFlow 1.3)])
3370 # Start a monitor listening for packet-ins.
3371 AT_CHECK([ovs-ofctl -O OpenFlow13 monitor br0 --detach --no-chdir --pidfile])
3372 ovs-appctl -t ovs-ofctl ofctl/send 0409000c0123456700000080
3373 ovs-appctl -t ovs-ofctl ofctl/barrier
3374 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
3375 AT_CAPTURE_FILE([monitor.log])
3377 # Send a packet-out with a couple of set-field action to set some metadata, and forward to controller
3378 AT_CHECK([ovs-ofctl -O OpenFlow13 packet-out br0 none 'set_field:0xfafafafa5a5a5a5a->metadata, set_field:0x6b->metadata, controller' '0001020304050010203040501234'])
3380 # Stop the monitor and check its output.
3381 ovs-appctl -t ovs-ofctl ofctl/barrier
3382 ovs-appctl -t ovs-ofctl exit
3384 AT_CHECK([sed 's/ (xid=0x[[0-9a-fA-F]]*)//' monitor.log], [0], [dnl
3385 OFPT_PACKET_IN (OF1.3): total_len=14 metadata=0x6b,in_port=ANY (via action) data_len=14 (unbuffered)
3386 vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1234
3387 OFPT_BARRIER_REPLY (OF1.3):
3393 dnl This test checks that tunnel metadata is encoded in packet_in structures.
3394 AT_SETUP([ofproto - packet-out with tunnel metadata (OpenFlow 1.2)])
3397 # Start a monitor listening for packet-ins.
3398 AT_CHECK([ovs-ofctl -O OpenFlow12 monitor br0 --detach --no-chdir --pidfile])
3399 ovs-appctl -t ovs-ofctl ofctl/send 0309000c0123456700000080
3400 ovs-appctl -t ovs-ofctl ofctl/barrier
3401 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
3402 AT_CAPTURE_FILE([monitor.log])
3404 # Send a packet-out with set field actions to set some tunnel metadata, and forward to controller
3405 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'])
3407 # Stop the monitor and check its output.
3408 ovs-appctl -t ovs-ofctl ofctl/barrier
3409 ovs-appctl -t ovs-ofctl exit
3411 AT_CHECK([sed 's/ (xid=0x[[0-9a-fA-F]]*)//' monitor.log], [0], [dnl
3412 OFPT_PACKET_IN (OF1.2): total_len=14 tun_id=0x1020304,tun_src=127.0.0.1,tun_dst=192.168.0.1,in_port=ANY (via action) data_len=14 (unbuffered)
3413 vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1234
3414 OFPT_BARRIER_REPLY (OF1.2):
3420 m4_divert_push([PREPARE_TESTS])
3421 # Sorts groups of lines that start with a space, without moving them
3422 # past the nearest line that does not start with a space.
3432 print $_ foreach sort(@buffer);
3437 print $_ foreach sort(@buffer);
3440 m4_divert_pop([PREPARE_TESTS])
3442 AT_SETUP([ofproto - flow monitoring])
3443 AT_KEYWORDS([monitor])
3446 ovs-ofctl add-flow br0 in_port=0,dl_vlan=123,actions=output:1
3448 # Start a monitor watching the flow table and check the initial reply.
3449 ovs-ofctl monitor br0 watch: --detach --no-chdir --pidfile >monitor.log 2>&1
3450 AT_CAPTURE_FILE([monitor.log])
3451 ovs-appctl -t ovs-ofctl ofctl/barrier
3452 AT_CHECK([sed 's/ (xid=0x[[1-9a-fA-F]][[0-9a-fA-F]]*)//' monitor.log], [0],
3453 [NXST_FLOW_MONITOR reply:
3454 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=123 actions=output:1
3458 # Add, delete, and modify some flows and check the updates.
3459 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
3460 ovs-ofctl add-flow br0 in_port=0,dl_vlan=124,actions=output:2
3461 ovs-ofctl add-flow br0 in_port=0,dl_vlan=123,actions=output:5
3462 ovs-ofctl add-flow br0 in_port=0,dl_vlan=123,dl_vlan_pcp=0,actions=output:6
3463 ovs-ofctl add-flow br0 in_port=0,dl_vlan=123,dl_vlan_pcp=1,actions=output:7
3464 ovs-ofctl add-flow br0 in_port=0,dl_vlan=123,actions=output:8
3465 ovs-ofctl add-flow br0 in_port=0,dl_vlan=65535,dl_vlan_pcp=0,actions=output:9
3466 ovs-ofctl add-flow br0 in_port=0,dl_vlan=65535,dl_vlan_pcp=1,actions=output:10
3467 ovs-ofctl add-flow br0 in_port=0,dl_vlan=65535,actions=output:11
3468 ovs-ofctl add-flow br0 in_port=0,dl_vlan=8191,dl_vlan_pcp=0,actions=output:12
3469 ovs-ofctl add-flow br0 in_port=0,dl_vlan=8191,dl_vlan_pcp=1,actions=output:13
3470 ovs-ofctl add-flow br0 in_port=0,dl_vlan=8191,actions=output:14
3471 ovs-ofctl add-flow br0 in_port=0,dl_vlan=0,dl_vlan_pcp=0,actions=output:15
3472 ovs-ofctl add-flow br0 in_port=0,dl_vlan=0,dl_vlan_pcp=1,actions=output:16
3473 ovs-ofctl add-flow br0 in_port=0,dl_vlan=0,actions=output:17
3474 ovs-ofctl add-flow br0 in_port=0,dl_vlan=0,dl_vlan_pcp=0,actions=output:18
3475 ovs-ofctl add-flow br0 in_port=0,dl_vlan=0,dl_vlan_pcp=1,actions=output:19
3476 ovs-ofctl add-flow br0 in_port=0,dl_vlan=0,actions=output:20
3477 ovs-ofctl add-flow br0 in_port=0,dl_vlan_pcp=0,actions=output:21
3478 ovs-ofctl add-flow br0 in_port=0,dl_vlan_pcp=1,actions=output:22
3479 ovs-ofctl add-flow br0 in_port=0,actions=output:23
3480 ovs-ofctl mod-flows br0 dl_vlan=123,actions=output:3
3481 ovs-ofctl mod-flows br0 cookie=5,dl_vlan=123,actions=output:3
3482 ovs-ofctl del-flows br0 dl_vlan=123
3483 ovs-ofctl del-flows br0
3484 ovs-appctl -t ovs-ofctl ofctl/barrier
3485 AT_CHECK([sed 's/ (xid=0x[[1-9a-fA-F]][[0-9a-fA-F]]*)//' monitor.log | multiline_sort], [0],
3486 [NXST_FLOW_MONITOR reply (xid=0x0):
3487 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=124 actions=output:2
3488 NXST_FLOW_MONITOR reply (xid=0x0):
3489 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=123 actions=output:5
3490 NXST_FLOW_MONITOR reply (xid=0x0):
3491 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=123,dl_vlan_pcp=0 actions=output:6
3492 NXST_FLOW_MONITOR reply (xid=0x0):
3493 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=123,dl_vlan_pcp=1 actions=output:7
3494 NXST_FLOW_MONITOR reply (xid=0x0):
3495 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=123 actions=output:8
3496 NXST_FLOW_MONITOR reply (xid=0x0):
3497 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=0,dl_vlan_pcp=0 actions=output:9
3498 NXST_FLOW_MONITOR reply (xid=0x0):
3499 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=0,dl_vlan_pcp=1 actions=output:10
3500 NXST_FLOW_MONITOR reply (xid=0x0):
3501 event=ADDED table=0 cookie=0 in_port=0,vlan_tci=0x0000 actions=output:11
3502 NXST_FLOW_MONITOR reply (xid=0x0):
3503 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=4095,dl_vlan_pcp=0 actions=output:12
3504 NXST_FLOW_MONITOR reply (xid=0x0):
3505 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=4095,dl_vlan_pcp=1 actions=output:13
3506 NXST_FLOW_MONITOR reply (xid=0x0):
3507 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=4095 actions=output:14
3508 NXST_FLOW_MONITOR reply (xid=0x0):
3509 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=0,dl_vlan_pcp=0 actions=output:15
3510 NXST_FLOW_MONITOR reply (xid=0x0):
3511 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=0,dl_vlan_pcp=1 actions=output:16
3512 NXST_FLOW_MONITOR reply (xid=0x0):
3513 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=0 actions=output:17
3514 NXST_FLOW_MONITOR reply (xid=0x0):
3515 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=0,dl_vlan_pcp=0 actions=output:18
3516 NXST_FLOW_MONITOR reply (xid=0x0):
3517 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=0,dl_vlan_pcp=1 actions=output:19
3518 NXST_FLOW_MONITOR reply (xid=0x0):
3519 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=0 actions=output:20
3520 NXST_FLOW_MONITOR reply (xid=0x0):
3521 event=ADDED table=0 cookie=0 in_port=0,dl_vlan_pcp=0 actions=output:21
3522 NXST_FLOW_MONITOR reply (xid=0x0):
3523 event=ADDED table=0 cookie=0 in_port=0,dl_vlan_pcp=1 actions=output:22
3524 NXST_FLOW_MONITOR reply (xid=0x0):
3525 event=ADDED table=0 cookie=0 in_port=0 actions=output:23
3526 NXST_FLOW_MONITOR reply (xid=0x0):
3527 event=MODIFIED table=0 cookie=0 in_port=0,dl_vlan=123 actions=output:3
3528 event=MODIFIED table=0 cookie=0 in_port=0,dl_vlan=123,dl_vlan_pcp=0 actions=output:3
3529 event=MODIFIED table=0 cookie=0 in_port=0,dl_vlan=123,dl_vlan_pcp=1 actions=output:3
3530 NXST_FLOW_MONITOR reply (xid=0x0):
3531 event=MODIFIED table=0 cookie=0x5 in_port=0,dl_vlan=123 actions=output:3
3532 event=MODIFIED table=0 cookie=0x5 in_port=0,dl_vlan=123,dl_vlan_pcp=0 actions=output:3
3533 event=MODIFIED table=0 cookie=0x5 in_port=0,dl_vlan=123,dl_vlan_pcp=1 actions=output:3
3534 NXST_FLOW_MONITOR reply (xid=0x0):
3535 event=DELETED reason=delete table=0 cookie=0x5 in_port=0,dl_vlan=123 actions=output:3
3536 event=DELETED reason=delete table=0 cookie=0x5 in_port=0,dl_vlan=123,dl_vlan_pcp=0 actions=output:3
3537 event=DELETED reason=delete table=0 cookie=0x5 in_port=0,dl_vlan=123,dl_vlan_pcp=1 actions=output:3
3538 NXST_FLOW_MONITOR reply (xid=0x0):
3539 event=DELETED reason=delete table=0 cookie=0 in_port=0 actions=output:23
3540 event=DELETED reason=delete table=0 cookie=0 in_port=0,dl_vlan=0 actions=output:20
3541 event=DELETED reason=delete table=0 cookie=0 in_port=0,dl_vlan=0,dl_vlan_pcp=0 actions=output:18
3542 event=DELETED reason=delete table=0 cookie=0 in_port=0,dl_vlan=0,dl_vlan_pcp=1 actions=output:19
3543 event=DELETED reason=delete table=0 cookie=0 in_port=0,dl_vlan=124 actions=output:2
3544 event=DELETED reason=delete table=0 cookie=0 in_port=0,dl_vlan=4095 actions=output:14
3545 event=DELETED reason=delete table=0 cookie=0 in_port=0,dl_vlan=4095,dl_vlan_pcp=0 actions=output:12
3546 event=DELETED reason=delete table=0 cookie=0 in_port=0,dl_vlan=4095,dl_vlan_pcp=1 actions=output:13
3547 event=DELETED reason=delete table=0 cookie=0 in_port=0,dl_vlan_pcp=0 actions=output:21
3548 event=DELETED reason=delete table=0 cookie=0 in_port=0,dl_vlan_pcp=1 actions=output:22
3549 event=DELETED reason=delete table=0 cookie=0 in_port=0,vlan_tci=0x0000 actions=output:11
3553 # Check that our own changes are reported as full updates.
3554 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
3555 ovs-ofctl add-flow br0 in_port=1,actions=output:2
3556 ovs-ofctl add-flow br0 in_port=2,actions=output:1
3557 ovs-appctl -t ovs-ofctl ofctl/barrier
3558 ovs-appctl -t ovs-ofctl ofctl/send 010e004812345678003fffff00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003000000000000ffffffffffff0000
3559 ovs-appctl -t ovs-ofctl ofctl/barrier
3560 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip], [0], [NXST_FLOW reply:
3562 AT_CHECK([sed 's/ (xid=0x[[1-9a-fA-F]][[0-9a-fA-F]]*)//' monitor.log | multiline_sort], [0],
3563 [NXST_FLOW_MONITOR reply (xid=0x0):
3564 event=ADDED table=0 cookie=0 in_port=1 actions=output:2
3565 NXST_FLOW_MONITOR reply (xid=0x0):
3566 event=ADDED table=0 cookie=0 in_port=2 actions=output:1
3568 send: OFPT_FLOW_MOD: DEL priority=0 actions=drop
3569 NXST_FLOW_MONITOR reply (xid=0x0):
3570 event=DELETED reason=delete table=0 cookie=0 in_port=1 actions=output:2
3571 event=DELETED reason=delete table=0 cookie=0 in_port=2 actions=output:1
3575 ovs-appctl -t ovs-ofctl exit
3579 AT_SETUP([ofproto - flow monitoring with !own])
3580 AT_KEYWORDS([monitor])
3583 ovs-ofctl add-flow br0 in_port=0,dl_vlan=123,actions=output:1
3585 # Start a monitor watching the flow table and check the initial reply.
3586 ovs-ofctl monitor br0 watch:\!own --detach --no-chdir --pidfile >monitor.log 2>&1
3587 AT_CAPTURE_FILE([monitor.log])
3588 ovs-appctl -t ovs-ofctl ofctl/barrier
3589 AT_CHECK([sed 's/ (xid=0x[[1-9a-fA-F]][[0-9a-fA-F]]*)//' monitor.log], [0],
3590 [NXST_FLOW_MONITOR reply:
3591 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=123 actions=output:1
3595 # Check that our own changes are reported as abbreviations.
3596 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
3597 ovs-ofctl add-flow br0 in_port=1,actions=output:2
3598 ovs-ofctl add-flow br0 in_port=2,actions=output:1
3599 ovs-appctl -t ovs-ofctl ofctl/barrier
3600 ovs-appctl -t ovs-ofctl ofctl/send 010e004812345678003fffff00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003000000000000ffffffffffff0000
3601 ovs-appctl -t ovs-ofctl ofctl/barrier
3602 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip], [0], [NXST_FLOW reply:
3604 AT_CHECK([sed 's/ (xid=0x[[1-9a-fA-F]][[0-9a-fA-F]]*)//' monitor.log], [0],
3605 [NXST_FLOW_MONITOR reply (xid=0x0):
3606 event=ADDED table=0 cookie=0 in_port=1 actions=output:2
3607 NXST_FLOW_MONITOR reply (xid=0x0):
3608 event=ADDED table=0 cookie=0 in_port=2 actions=output:1
3610 send: OFPT_FLOW_MOD: DEL priority=0 actions=drop
3611 NXST_FLOW_MONITOR reply (xid=0x0):
3612 event=ABBREV xid=0x12345678
3616 ovs-appctl -t ovs-ofctl exit
3620 AT_SETUP([ofproto - flow monitoring with out_port])
3621 AT_KEYWORDS([monitor])
3624 ovs-ofctl add-flow br0 in_port=0,dl_vlan=121,actions=output:1
3625 ovs-ofctl add-flow br0 in_port=0,dl_vlan=122,actions=output:1
3626 ovs-ofctl add-flow br0 in_port=0,dl_vlan=123,actions=output:2
3628 # Start a monitor watching the flow table and check the initial reply.
3629 ovs-ofctl monitor br0 watch:out_port=2 --detach --no-chdir --pidfile >monitor.log 2>&1
3630 AT_CAPTURE_FILE([monitor.log])
3631 ovs-appctl -t ovs-ofctl ofctl/barrier
3632 AT_CHECK([sed 's/ (xid=0x[[1-9a-fA-F]][[0-9a-fA-F]]*)//' monitor.log], [0],
3633 [NXST_FLOW_MONITOR reply:
3634 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=123 actions=output:2
3638 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
3640 # Add, modify flows and check the updates.
3641 ovs-ofctl mod-flows br0 dl_vlan=121,actions=drop
3642 ovs-ofctl mod-flows br0 dl_vlan=122,actions=output:1,output:2
3643 ovs-appctl -t ovs-ofctl ofctl/barrier
3645 ovs-ofctl mod-flows br0 dl_vlan=123,actions=output:1,output:2
3646 ovs-appctl -t ovs-ofctl ofctl/barrier
3648 ovs-ofctl mod-flows br0 dl_vlan=122,actions=output:1
3649 ovs-appctl -t ovs-ofctl ofctl/barrier
3650 ovs-ofctl mod-flows br0 dl_vlan=123,actions=output:2
3651 ovs-appctl -t ovs-ofctl ofctl/barrier
3653 AT_CHECK([sed 's/ (xid=0x[[1-9a-fA-F]][[0-9a-fA-F]]*)//' monitor.log], [0],
3654 [NXST_FLOW_MONITOR reply (xid=0x0):
3655 event=MODIFIED table=0 cookie=0 in_port=0,dl_vlan=122 actions=output:1,output:2
3657 NXST_FLOW_MONITOR reply (xid=0x0):
3658 event=MODIFIED table=0 cookie=0 in_port=0,dl_vlan=123 actions=output:1,output:2
3660 NXST_FLOW_MONITOR reply (xid=0x0):
3661 event=MODIFIED table=0 cookie=0 in_port=0,dl_vlan=122 actions=output:1
3663 NXST_FLOW_MONITOR reply (xid=0x0):
3664 event=MODIFIED table=0 cookie=0 in_port=0,dl_vlan=123 actions=output:2
3668 ovs-appctl -t ovs-ofctl exit
3672 AT_SETUP([ofproto - flow monitoring pause and resume])
3673 AT_KEYWORDS([monitor])
3675 # The maximum socket receive buffer size is important for this test, which
3676 # tests behavior when the receive buffer overflows.
3677 if test -e /proc/sys/net/core/rmem_max; then
3679 rmem_max=`cat /proc/sys/net/core/rmem_max`
3680 elif rmem_max=`sysctl -n net.inet.tcp.recvbuf_max 2>/dev/null`; then
3683 # Don't know how to get maximum socket receive buffer on this OS
3686 # Calculate the total amount of queuing: rmem_max in the kernel, 128 kB
3687 # in ofproto sending userspace (see ofmonitor_flush() in connmgr.c).
3688 queue_size=`expr $rmem_max + 128 \* 1024`
3689 echo rmem_max=$rmem_max queue_size=$queue_size
3691 # If there's too much queuing skip the test to avoid timing out.
3692 AT_SKIP_IF([test $rmem_max -gt 1048576])
3694 # Each flow update message takes up at least 48 bytes of space in queues
3695 # and in practice more than that.
3696 n_msgs=`expr $queue_size / 48`
3701 # Start a monitor watching the flow table, then make it block.
3702 on_exit 'kill `cat ovs-ofctl.pid`'
3703 ovs-ofctl monitor br0 watch: --detach --no-chdir --pidfile >monitor.log 2>&1
3704 AT_CAPTURE_FILE([monitor.log])
3705 ovs-appctl -t ovs-ofctl ofctl/block
3707 # Add $n_msgs flows.
3708 (echo "in_port=2,actions=output:2"
3710 for ($i = 0; $i < '$n_msgs'; $i++) {
3711 print "cookie=1,reg1=$i,actions=drop\n";
3714 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
3715 # Check that multipart flow dumps work properly:
3716 AT_CHECK([ovs-ofctl diff-flows br0 flows.txt])
3717 AT_CHECK([ovs-ofctl add-flow br0 in_port=1,cookie=3,actions=drop])
3718 AT_CHECK([ovs-ofctl mod-flows br0 in_port=2,cookie=2,actions=output:2])
3719 AT_CHECK([ovs-ofctl del-flows br0 cookie=1/-1])
3721 ovs-appctl -t ovs-ofctl ofctl/unblock
3723 # Wait for the connection resumed.
3724 # A barrier doesn't work for this purpose.
3725 # https://www.mail-archive.com/dev@openvswitch.org/msg27013.html
3726 # https://www.mail-archive.com/dev@openvswitch.org/msg27675.html
3727 OVS_WAIT_UNTIL([grep NXT_FLOW_MONITOR_RESUMED monitor.log])
3729 ovs-appctl -t ovs-ofctl exit
3731 # Check that the flow monitor reported the same number of flows
3732 # added and deleted, but fewer than we actually added and deleted.
3733 adds=`grep -c 'ADDED.*reg1=' monitor.log`
3734 deletes=`grep -c 'DELETED.*reg1=' monitor.log`
3735 echo adds=$adds deletes=$deletes
3736 AT_CHECK([test $adds -gt 100 && test $adds -lt $n_msgs])
3737 AT_CHECK([test $adds = $deletes])
3739 # Check that the flow monitor reported everything in the expected order:
3741 # event=ADDED table=0 cookie=0x1 reg1=0x22
3743 # NXT_FLOW_MONITOR_PAUSED:
3745 # event=DELETED reason=delete table=0 cookie=0x1 reg1=0x22
3747 # event=ADDED table=0 cookie=0x3 in_port=1
3748 # event=MODIFIED table=0 cookie=0x2 in_port=2 actions=output:2
3749 # NXT_FLOW_MONITOR_RESUMED:
3751 # except that, between the PAUSED and RESUMED, the order of the ADDED
3752 # and MODIFIED lines lines depends on hash order, that is, it varies
3753 # as we change the hash function or change architecture. Therefore,
3754 # we use a couple of tests below to accept both orders.
3755 AT_CHECK([ofctl_strip < monitor.log | sed -n -e '
3758 /NXT_FLOW_MONITOR_PAUSED:/p
3759 /NXT_FLOW_MONITOR_RESUMED:/p
3760 ' > monitor.log.subset])
3761 AT_CHECK([grep -v MODIFIED monitor.log.subset], [0], [dnl
3762 event=ADDED table=0 cookie=0x1 reg1=0x22
3763 NXT_FLOW_MONITOR_PAUSED:
3764 event=DELETED reason=delete table=0 cookie=0x1 reg1=0x22
3765 event=ADDED table=0 cookie=0x3 in_port=1
3766 NXT_FLOW_MONITOR_RESUMED:
3768 AT_CHECK([grep -v ADDED monitor.log.subset], [0], [dnl
3769 NXT_FLOW_MONITOR_PAUSED:
3770 event=DELETED reason=delete table=0 cookie=0x1 reg1=0x22
3771 event=MODIFIED table=0 cookie=0x2 in_port=2 actions=output:2
3772 NXT_FLOW_MONITOR_RESUMED:
3778 AT_SETUP([ofproto - event filtering (OpenFlow 1.3)])
3779 AT_KEYWORDS([monitor])
3782 # Start a monitor, use the required protocol version
3783 ovs-ofctl -O OpenFlow13 monitor br0 --detach --no-chdir --pidfile >monitor.log 2>&1
3784 AT_CAPTURE_FILE([monitor.log])
3786 # Send an OpenFlow13 message (04), OFPT_GET_ASYNC_REQUEST (1a), length (8), xid (0a)
3787 ovs-appctl -t ovs-ofctl ofctl/send 041a00080000000a
3788 ovs-appctl -t ovs-ofctl ofctl/barrier
3790 # Check default setting
3791 read -r -d '' expected <<'EOF'
3794 AT_CHECK([ofctl_strip < monitor.log], [], [dnl
3795 send: OFPT_GET_ASYNC_REQUEST (OF1.3):
3796 OFPT_GET_ASYNC_REPLY (OF1.3):
3798 PACKET_IN: no_match action
3799 PORT_STATUS: add delete modify
3800 FLOW_REMOVED: idle hard delete
3804 PORT_STATUS: add delete modify
3806 OFPT_BARRIER_REPLY (OF1.3):
3812 AT_SETUP([ofproto - ofport_request])
3814 ADD_OF_PORTS([br0], [1], [2], [3])
3816 set_and_check_specific_ofports () {
3817 ovs-vsctl set Interface p1 ofport_request="$1" -- \
3818 set Interface p2 ofport_request="$2" -- \
3819 set Interface p3 ofport_request="$3"
3820 ofports=`ovs-vsctl get Interface p1 ofport -- \
3821 get Interface p2 ofport -- \
3822 get Interface p3 ofport`
3823 AT_CHECK_UNQUOTED([echo $ofports], [0], [$1 $2 $3
3826 for pre in '1 2 3' '1 3 2' '2 1 3' '2 3 1' '3 1 2' '3 2 1'; do
3827 for post in '1 2 3' '1 3 2' '2 1 3' '2 3 1' '3 1 2' '3 2 1'; do
3828 echo -----------------------------------------------------------
3829 echo "Check changing port numbers from $pre to $post"
3830 set_and_check_specific_ofports $pre
3831 set_and_check_specific_ofports $post
3835 ovs-vsctl del-port p3
3837 set_and_check_poorly_specified_ofports () {
3838 ovs-vsctl set Interface p1 ofport_request="$1" -- \
3839 set Interface p2 ofport_request="$2"
3840 p1=`ovs-vsctl get Interface p1 ofport`
3841 p2=`ovs-vsctl get Interface p2 ofport`
3844 AT_CHECK([test "$p1" != "$p2"])
3845 if test "$1" = "$2" && test "$1" != '[[]]'; then
3846 # One port number must be the requested one.
3847 AT_CHECK([test "$p1" = "$1" || test "$p2" = "$1"])
3848 # The other port number must be different (already tested above).
3850 AT_CHECK([test "$1" = '[[]]' || test "$p1" = "$1"])
3851 AT_CHECK([test "$2" = '[[]]' || test "$p2" = "$2"])
3854 for pre in '1 2' '[[]] 2' '1 [[]]' '[[]] [[]]' '2 1' '[[]] 1' '2 [[]]' \
3856 for post in '1 2' '[[]] 2' '1 [[]]' '[[]] [[]]' '2 1' '[[]] 1' '2 [[]]' \
3858 echo -----------------------------------------------------------
3859 echo "Check changing port numbers from $pre to $post"
3860 set_and_check_poorly_specified_ofports $pre
3861 set_and_check_poorly_specified_ofports $post
3868 AT_SETUP([ofproto - bundles, open (OpenFlow 1.4)])
3869 AT_KEYWORDS([monitor])
3872 # Start a monitor, use the required protocol version
3873 ovs-ofctl -O OpenFlow14 monitor br0 --detach --no-chdir --pidfile >monitor.log 2>&1
3874 AT_CAPTURE_FILE([monitor.log])
3876 # Send an OpenFlow14 message (05), OFPT_BUNDLE_CONTROL (21), length (10), xid (0a)
3877 ovs-appctl -t ovs-ofctl ofctl/send "05 21 00 10 00 00 00 0a 00 00 00 01 00 00 00 02"
3878 ovs-appctl -t ovs-ofctl ofctl/barrier
3879 ovs-appctl -t ovs-ofctl exit
3881 AT_CHECK([ofctl_strip < monitor.log], [], [dnl
3882 send: OFPT_BUNDLE_CONTROL (OF1.4):
3883 bundle_id=0x1 type=OPEN_REQUEST flags=ordered
3884 OFPT_BUNDLE_CONTROL (OF1.4):
3885 bundle_id=0x1 type=OPEN_REPLY flags=0
3886 OFPT_BARRIER_REPLY (OF1.4):
3892 AT_SETUP([ofproto - bundles, double open (OpenFlow 1.4)])
3893 AT_KEYWORDS([monitor])
3896 # Start a monitor, use the required protocol version
3897 ovs-ofctl -O OpenFlow14 monitor br0 --detach --no-chdir --pidfile >monitor.log 2>&1
3898 AT_CAPTURE_FILE([monitor.log])
3900 # Send twice an OpenFlow14 message (05), OFPT_BUNDLE_CONTROL (21), length (10), xid (0a)
3901 ovs-appctl -t ovs-ofctl ofctl/send "05 21 00 10 00 00 00 0a 00 00 00 01 00 00 00 02"
3902 ovs-appctl -t ovs-ofctl ofctl/barrier
3903 ovs-appctl -t ovs-ofctl ofctl/send "05 21 00 10 00 00 00 0a 00 00 00 01 00 00 00 02"
3904 ovs-appctl -t ovs-ofctl ofctl/barrier
3905 ovs-appctl -t ovs-ofctl exit
3907 AT_CHECK([ofctl_strip < monitor.log], [0], [dnl
3908 send: OFPT_BUNDLE_CONTROL (OF1.4):
3909 bundle_id=0x1 type=OPEN_REQUEST flags=ordered
3910 OFPT_BUNDLE_CONTROL (OF1.4):
3911 bundle_id=0x1 type=OPEN_REPLY flags=0
3912 OFPT_BARRIER_REPLY (OF1.4):
3913 send: OFPT_BUNDLE_CONTROL (OF1.4):
3914 bundle_id=0x1 type=OPEN_REQUEST flags=ordered
3915 OFPT_ERROR (OF1.4): OFPBFC_BAD_ID
3916 OFPT_BUNDLE_CONTROL (OF1.4):
3917 bundle_id=0x1 type=OPEN_REQUEST flags=ordered
3918 OFPT_BARRIER_REPLY (OF1.4):
3924 AT_SETUP([ofproto - bundle close without open (OpenFlow 1.4)])
3925 AT_KEYWORDS([monitor])
3928 # Start a monitor, use the required protocol version
3929 ovs-ofctl -O OpenFlow14 monitor br0 --detach --no-chdir --pidfile >monitor.log 2>&1
3930 AT_CAPTURE_FILE([monitor.log])
3932 ovs-appctl -t ovs-ofctl ofctl/send "05 21 00 10 00 00 00 0a 00 00 00 01 00 02 00 02"
3933 ovs-appctl -t ovs-ofctl ofctl/barrier
3934 ovs-appctl -t ovs-ofctl exit
3936 AT_CHECK([ofctl_strip < monitor.log], [0], [dnl
3937 send: OFPT_BUNDLE_CONTROL (OF1.4):
3938 bundle_id=0x1 type=CLOSE_REQUEST flags=ordered
3939 OFPT_ERROR (OF1.4): OFPBFC_BAD_ID
3940 OFPT_BUNDLE_CONTROL (OF1.4):
3941 bundle_id=0x1 type=CLOSE_REQUEST flags=ordered
3942 OFPT_BARRIER_REPLY (OF1.4):
3948 AT_SETUP([ofproto - bundle double close (OpenFlow 1.4)])
3949 AT_KEYWORDS([monitor])
3952 # Start a monitor, use the required protocol version
3953 ovs-ofctl -O OpenFlow14 monitor br0 --detach --no-chdir --pidfile >monitor.log 2>&1
3954 AT_CAPTURE_FILE([monitor.log])
3956 # Open, Close, Close
3957 ovs-appctl -t ovs-ofctl ofctl/send "05 21 00 10 00 00 00 0a 00 00 00 01 00 00 00 02"
3958 ovs-appctl -t ovs-ofctl ofctl/barrier
3959 ovs-appctl -t ovs-ofctl ofctl/send "05 21 00 10 00 00 00 0a 00 00 00 01 00 02 00 02"
3960 ovs-appctl -t ovs-ofctl ofctl/barrier
3961 ovs-appctl -t ovs-ofctl ofctl/send "05 21 00 10 00 00 00 0a 00 00 00 01 00 02 00 02"
3962 ovs-appctl -t ovs-ofctl ofctl/barrier
3963 ovs-appctl -t ovs-ofctl exit
3965 AT_CHECK([ofctl_strip < monitor.log], [0], [dnl
3966 send: OFPT_BUNDLE_CONTROL (OF1.4):
3967 bundle_id=0x1 type=OPEN_REQUEST flags=ordered
3968 OFPT_BUNDLE_CONTROL (OF1.4):
3969 bundle_id=0x1 type=OPEN_REPLY flags=0
3970 OFPT_BARRIER_REPLY (OF1.4):
3971 send: OFPT_BUNDLE_CONTROL (OF1.4):
3972 bundle_id=0x1 type=CLOSE_REQUEST flags=ordered
3973 OFPT_BUNDLE_CONTROL (OF1.4):
3974 bundle_id=0x1 type=CLOSE_REPLY flags=0
3975 OFPT_BARRIER_REPLY (OF1.4):
3976 send: OFPT_BUNDLE_CONTROL (OF1.4):
3977 bundle_id=0x1 type=CLOSE_REQUEST flags=ordered
3978 OFPT_ERROR (OF1.4): OFPBFC_BUNDLE_CLOSED
3979 OFPT_BUNDLE_CONTROL (OF1.4):
3980 bundle_id=0x1 type=CLOSE_REQUEST flags=ordered
3981 OFPT_BARRIER_REPLY (OF1.4):
3987 AT_SETUP([ofproto - bundle close, different flags (OpenFlow 1.4)])
3988 AT_KEYWORDS([monitor])
3991 # Start a monitor, use the required protocol version
3992 ovs-ofctl -O OpenFlow14 monitor br0 --detach --no-chdir --pidfile >monitor.log 2>&1
3993 AT_CAPTURE_FILE([monitor.log])
3995 # Open, Close, Close
3996 ovs-appctl -t ovs-ofctl ofctl/send "05 21 00 10 00 00 00 0a 00 00 00 01 00 00 00 02"
3997 ovs-appctl -t ovs-ofctl ofctl/barrier
3998 ovs-appctl -t ovs-ofctl ofctl/send "05 21 00 10 00 00 00 0a 00 00 00 01 00 02 00 01"
3999 ovs-appctl -t ovs-ofctl ofctl/barrier
4000 ovs-appctl -t ovs-ofctl exit
4002 AT_CHECK([ofctl_strip < monitor.log], [0], [dnl
4003 send: OFPT_BUNDLE_CONTROL (OF1.4):
4004 bundle_id=0x1 type=OPEN_REQUEST flags=ordered
4005 OFPT_BUNDLE_CONTROL (OF1.4):
4006 bundle_id=0x1 type=OPEN_REPLY flags=0
4007 OFPT_BARRIER_REPLY (OF1.4):
4008 send: OFPT_BUNDLE_CONTROL (OF1.4):
4009 bundle_id=0x1 type=CLOSE_REQUEST flags=atomic
4010 OFPT_ERROR (OF1.4): OFPBFC_BAD_FLAGS
4011 OFPT_BUNDLE_CONTROL (OF1.4):
4012 bundle_id=0x1 type=CLOSE_REQUEST flags=atomic
4013 OFPT_BARRIER_REPLY (OF1.4):
4019 AT_SETUP([ofproto - bundle commit without open (OpenFlow 1.4)])
4020 AT_KEYWORDS([monitor])
4023 # Start a monitor, use the required protocol version
4024 ovs-ofctl -O OpenFlow14 monitor br0 --detach --no-chdir --pidfile >monitor.log 2>&1
4025 AT_CAPTURE_FILE([monitor.log])
4027 # Open, Close, Close
4028 ovs-appctl -t ovs-ofctl ofctl/send "05 21 00 10 00 00 00 0a 00 00 00 01 00 04 00 02"
4029 ovs-appctl -t ovs-ofctl ofctl/barrier
4030 ovs-appctl -t ovs-ofctl exit
4032 AT_CHECK([ofctl_strip < monitor.log], [0], [dnl
4033 send: OFPT_BUNDLE_CONTROL (OF1.4):
4034 bundle_id=0x1 type=COMMIT_REQUEST flags=ordered
4035 OFPT_ERROR (OF1.4): OFPBFC_BAD_ID
4036 OFPT_BUNDLE_CONTROL (OF1.4):
4037 bundle_id=0x1 type=COMMIT_REQUEST flags=ordered
4038 OFPT_BARRIER_REPLY (OF1.4):
4044 AT_SETUP([ofproto - bundle commit, different flags (OpenFlow 1.4)])
4045 AT_KEYWORDS([monitor])
4048 # Start a monitor, use the required protocol version
4049 ovs-ofctl -O OpenFlow14 monitor br0 --detach --no-chdir --pidfile >monitor.log 2>&1
4050 AT_CAPTURE_FILE([monitor.log])
4052 # Open, Close, Close
4053 ovs-appctl -t ovs-ofctl ofctl/send "05 21 00 10 00 00 00 0a 00 00 00 01 00 00 00 02"
4054 ovs-appctl -t ovs-ofctl ofctl/barrier
4055 ovs-appctl -t ovs-ofctl ofctl/send "05 21 00 10 00 00 00 0a 00 00 00 01 00 04 00 01"
4056 ovs-appctl -t ovs-ofctl ofctl/barrier
4057 ovs-appctl -t ovs-ofctl exit
4059 AT_CHECK([ofctl_strip < monitor.log], [0], [dnl
4060 send: OFPT_BUNDLE_CONTROL (OF1.4):
4061 bundle_id=0x1 type=OPEN_REQUEST flags=ordered
4062 OFPT_BUNDLE_CONTROL (OF1.4):
4063 bundle_id=0x1 type=OPEN_REPLY flags=0
4064 OFPT_BARRIER_REPLY (OF1.4):
4065 send: OFPT_BUNDLE_CONTROL (OF1.4):
4066 bundle_id=0x1 type=COMMIT_REQUEST flags=atomic
4067 OFPT_ERROR (OF1.4): OFPBFC_BAD_FLAGS
4068 OFPT_BUNDLE_CONTROL (OF1.4):
4069 bundle_id=0x1 type=COMMIT_REQUEST flags=atomic
4070 OFPT_BARRIER_REPLY (OF1.4):
4076 AT_SETUP([ofproto - bundle discard without open (OpenFlow 1.4)])
4077 AT_KEYWORDS([monitor])
4080 # Start a monitor, use the required protocol version
4081 ovs-ofctl -O OpenFlow14 monitor br0 --detach --no-chdir --pidfile >monitor.log 2>&1
4082 AT_CAPTURE_FILE([monitor.log])
4084 # Open, Close, Close
4085 ovs-appctl -t ovs-ofctl ofctl/send "05 21 00 10 00 00 00 0a 00 00 00 01 00 06 00 02"
4086 ovs-appctl -t ovs-ofctl ofctl/barrier
4087 ovs-appctl -t ovs-ofctl exit
4089 AT_CHECK([ofctl_strip < monitor.log], [0], [dnl
4090 send: OFPT_BUNDLE_CONTROL (OF1.4):
4091 bundle_id=0x1 type=DISCARD_REQUEST flags=ordered
4092 OFPT_ERROR (OF1.4): OFPBFC_BAD_ID
4093 OFPT_BUNDLE_CONTROL (OF1.4):
4094 bundle_id=0x1 type=DISCARD_REQUEST flags=ordered
4095 OFPT_BARRIER_REPLY (OF1.4):
4102 AT_SETUP([ofproto - bundle with multiple flow mods (OpenFlow 1.4)])
4103 AT_KEYWORDS([monitor])
4106 AT_CHECK([ovs-appctl vlog/set vconn:dbg])
4108 AT_CHECK([ovs-ofctl del-flows br0])
4110 AT_DATA([flows.txt], [dnl
4111 add idle_timeout=50 in_port=2 dl_src=00:66:77:88:99:aa actions=1
4112 add idle_timeout=60 in_port=2 dl_src=00:77:88:99:aa:bb actions=2
4113 add idle_timeout=70 in_port=2 dl_src=00:88:99:aa:bb:cc actions=3
4114 add idle_timeout=50 in_port=2 dl_src=00:66:77:88:99:aa actions=4
4116 add idle_timeout=50 in_port=2 dl_src=00:66:77:88:99:aa actions=5
4117 add idle_timeout=60 in_port=2 dl_src=00:77:88:99:aa:bb actions=6
4118 add idle_timeout=70 in_port=2 dl_src=00:88:99:aa:bb:cc actions=7
4119 delete in_port=2 dl_src=00:88:99:aa:bb:cc
4122 AT_CHECK([ovs-ofctl --bundle add-flows br0 flows.txt])
4124 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
4125 idle_timeout=50, in_port=2,dl_src=00:66:77:88:99:aa actions=output:5
4126 idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=output:6
4130 AT_DATA([flows.txt], [dnl
4132 modify_strict in_port=2 dl_src=00:77:88:99:aa:bb actions=7
4135 AT_CHECK([ovs-ofctl --bundle add-flows br0 flows.txt])
4137 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
4138 idle_timeout=50, in_port=2,dl_src=00:66:77:88:99:aa actions=drop
4139 idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=output:7
4143 # Adding an existing flow acts as a modify, and delete_strict also works.
4144 AT_DATA([flows.txt], [dnl
4145 add idle_timeout=60 in_port=2 dl_src=00:77:88:99:aa:bb actions=8
4146 delete_strict in_port=2 dl_src=00:66:77:88:99:aa
4147 add in_port=2 dl_src=00:66:77:88:99:aa actions=drop
4150 AT_CHECK([ovs-ofctl --bundle add-flows br0 flows.txt])
4152 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
4153 idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=output:8
4154 in_port=2,dl_src=00:66:77:88:99:aa actions=drop
4158 dnl Check logs for OpenFlow trace
4160 OVS_WAIT_UNTIL([cat ovs-vswitchd.log | vconn_sub | test `grep -- "|vconn|DBG|unix: sent (Success): NXST_FLOW reply" | wc -l` -ge 3])
4161 AT_CHECK([print_vconn_debug | vconn_sub | ofctl_strip], [0], [dnl
4162 vconn|DBG|unix: sent (Success): OFPT_HELLO (OF1.5):
4163 version bitmap: 0x01, 0x02, 0x03, 0x04, 0x05, 0x06
4164 vconn|DBG|unix: received: OFPT_HELLO:
4165 version bitmap: 0x01
4166 vconn|DBG|unix: negotiated OpenFlow version 0x01 (we support version 0x06 and earlier, peer supports version 0x01)
4167 vconn|DBG|unix: received: OFPT_FLOW_MOD: DEL actions=drop
4168 vconn|DBG|unix: received: OFPT_BARRIER_REQUEST:
4169 vconn|DBG|unix: sent (Success): OFPT_BARRIER_REPLY:
4170 vconn|DBG|unix: sent (Success): OFPT_HELLO (OF1.5):
4171 version bitmap: 0x01, 0x02, 0x03, 0x04, 0x05, 0x06
4172 vconn|DBG|unix: received: OFPT_HELLO (OF1.4):
4173 version bitmap: 0x05
4174 vconn|DBG|unix: negotiated OpenFlow version 0x05 (we support version 0x06 and earlier, peer supports version 0x05)
4175 vconn|DBG|unix: received: OFPT_BUNDLE_CONTROL (OF1.4):
4176 bundle_id=0 type=OPEN_REQUEST flags=atomic ordered
4177 vconn|DBG|unix: sent (Success): OFPT_BUNDLE_CONTROL (OF1.4):
4178 bundle_id=0 type=OPEN_REPLY flags=0
4179 vconn|DBG|unix: received: OFPT_BUNDLE_ADD_MESSAGE (OF1.4):
4180 bundle_id=0 flags=atomic ordered
4181 OFPT_FLOW_MOD (OF1.4): ADD in_port=2,dl_src=00:66:77:88:99:aa idle:50 actions=output:1
4182 vconn|DBG|unix: received: OFPT_BUNDLE_ADD_MESSAGE (OF1.4):
4183 bundle_id=0 flags=atomic ordered
4184 OFPT_FLOW_MOD (OF1.4): ADD in_port=2,dl_src=00:77:88:99:aa:bb idle:60 actions=output:2
4185 vconn|DBG|unix: received: OFPT_BUNDLE_ADD_MESSAGE (OF1.4):
4186 bundle_id=0 flags=atomic ordered
4187 OFPT_FLOW_MOD (OF1.4): ADD in_port=2,dl_src=00:88:99:aa:bb:cc idle:70 actions=output:3
4188 vconn|DBG|unix: received: OFPT_BUNDLE_ADD_MESSAGE (OF1.4):
4189 bundle_id=0 flags=atomic ordered
4190 OFPT_FLOW_MOD (OF1.4): ADD in_port=2,dl_src=00:66:77:88:99:aa idle:50 actions=output:4
4191 vconn|DBG|unix: received: OFPT_BUNDLE_ADD_MESSAGE (OF1.4):
4192 bundle_id=0 flags=atomic ordered
4193 OFPT_FLOW_MOD (OF1.4): DEL table:255 actions=drop
4194 vconn|DBG|unix: received: OFPT_BUNDLE_ADD_MESSAGE (OF1.4):
4195 bundle_id=0 flags=atomic ordered
4196 OFPT_FLOW_MOD (OF1.4): ADD in_port=2,dl_src=00:66:77:88:99:aa idle:50 actions=output:5
4197 vconn|DBG|unix: received: OFPT_BUNDLE_ADD_MESSAGE (OF1.4):
4198 bundle_id=0 flags=atomic ordered
4199 OFPT_FLOW_MOD (OF1.4): ADD in_port=2,dl_src=00:77:88:99:aa:bb idle:60 actions=output:6
4200 vconn|DBG|unix: received: OFPT_BUNDLE_ADD_MESSAGE (OF1.4):
4201 bundle_id=0 flags=atomic ordered
4202 OFPT_FLOW_MOD (OF1.4): ADD in_port=2,dl_src=00:88:99:aa:bb:cc idle:70 actions=output:7
4203 vconn|DBG|unix: received: OFPT_BUNDLE_ADD_MESSAGE (OF1.4):
4204 bundle_id=0 flags=atomic ordered
4205 OFPT_FLOW_MOD (OF1.4): DEL table:255 in_port=2,dl_src=00:88:99:aa:bb:cc actions=drop
4206 vconn|DBG|unix: received: OFPT_BUNDLE_CONTROL (OF1.4):
4207 bundle_id=0 type=COMMIT_REQUEST flags=atomic ordered
4208 vconn|DBG|unix: sent (Success): OFPT_BUNDLE_CONTROL (OF1.4):
4209 bundle_id=0 type=COMMIT_REPLY flags=0
4210 vconn|DBG|unix: sent (Success): OFPT_HELLO (OF1.5):
4211 version bitmap: 0x01, 0x02, 0x03, 0x04, 0x05, 0x06
4212 vconn|DBG|unix: received: OFPT_HELLO:
4213 version bitmap: 0x01
4214 vconn|DBG|unix: negotiated OpenFlow version 0x01 (we support version 0x06 and earlier, peer supports version 0x01)
4215 vconn|DBG|unix: received: NXT_SET_FLOW_FORMAT: format=nxm
4216 vconn|DBG|unix: received: OFPT_BARRIER_REQUEST:
4217 vconn|DBG|unix: sent (Success): OFPT_BARRIER_REPLY:
4218 vconn|DBG|unix: received: NXST_FLOW request:
4219 vconn|DBG|unix: sent (Success): NXST_FLOW reply:
4220 idle_timeout=50, in_port=2,dl_src=00:66:77:88:99:aa actions=output:5
4221 idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=output:6
4222 vconn|DBG|unix: sent (Success): OFPT_HELLO (OF1.5):
4223 version bitmap: 0x01, 0x02, 0x03, 0x04, 0x05, 0x06
4224 vconn|DBG|unix: received: OFPT_HELLO (OF1.4):
4225 version bitmap: 0x05
4226 vconn|DBG|unix: negotiated OpenFlow version 0x05 (we support version 0x06 and earlier, peer supports version 0x05)
4227 vconn|DBG|unix: received: OFPT_BUNDLE_CONTROL (OF1.4):
4228 bundle_id=0 type=OPEN_REQUEST flags=atomic ordered
4229 vconn|DBG|unix: sent (Success): OFPT_BUNDLE_CONTROL (OF1.4):
4230 bundle_id=0 type=OPEN_REPLY flags=0
4231 vconn|DBG|unix: received: OFPT_BUNDLE_ADD_MESSAGE (OF1.4):
4232 bundle_id=0 flags=atomic ordered
4233 OFPT_FLOW_MOD (OF1.4): MOD actions=drop
4234 vconn|DBG|unix: received: OFPT_BUNDLE_ADD_MESSAGE (OF1.4):
4235 bundle_id=0 flags=atomic ordered
4236 OFPT_FLOW_MOD (OF1.4): MOD_STRICT in_port=2,dl_src=00:77:88:99:aa:bb actions=output:7
4237 vconn|DBG|unix: received: OFPT_BUNDLE_CONTROL (OF1.4):
4238 bundle_id=0 type=COMMIT_REQUEST flags=atomic ordered
4239 vconn|DBG|unix: sent (Success): OFPT_BUNDLE_CONTROL (OF1.4):
4240 bundle_id=0 type=COMMIT_REPLY flags=0
4241 vconn|DBG|unix: sent (Success): OFPT_HELLO (OF1.5):
4242 version bitmap: 0x01, 0x02, 0x03, 0x04, 0x05, 0x06
4243 vconn|DBG|unix: received: OFPT_HELLO:
4244 version bitmap: 0x01
4245 vconn|DBG|unix: negotiated OpenFlow version 0x01 (we support version 0x06 and earlier, peer supports version 0x01)
4246 vconn|DBG|unix: received: NXT_SET_FLOW_FORMAT: format=nxm
4247 vconn|DBG|unix: received: OFPT_BARRIER_REQUEST:
4248 vconn|DBG|unix: sent (Success): OFPT_BARRIER_REPLY:
4249 vconn|DBG|unix: received: NXST_FLOW request:
4250 vconn|DBG|unix: sent (Success): NXST_FLOW reply:
4251 idle_timeout=50, in_port=2,dl_src=00:66:77:88:99:aa actions=drop
4252 idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=output:7
4253 vconn|DBG|unix: sent (Success): OFPT_HELLO (OF1.5):
4254 version bitmap: 0x01, 0x02, 0x03, 0x04, 0x05, 0x06
4255 vconn|DBG|unix: received: OFPT_HELLO (OF1.4):
4256 version bitmap: 0x05
4257 vconn|DBG|unix: negotiated OpenFlow version 0x05 (we support version 0x06 and earlier, peer supports version 0x05)
4258 vconn|DBG|unix: received: OFPT_BUNDLE_CONTROL (OF1.4):
4259 bundle_id=0 type=OPEN_REQUEST flags=atomic ordered
4260 vconn|DBG|unix: sent (Success): OFPT_BUNDLE_CONTROL (OF1.4):
4261 bundle_id=0 type=OPEN_REPLY flags=0
4262 vconn|DBG|unix: received: OFPT_BUNDLE_ADD_MESSAGE (OF1.4):
4263 bundle_id=0 flags=atomic ordered
4264 OFPT_FLOW_MOD (OF1.4): ADD in_port=2,dl_src=00:77:88:99:aa:bb idle:60 actions=output:8
4265 vconn|DBG|unix: received: OFPT_BUNDLE_ADD_MESSAGE (OF1.4):
4266 bundle_id=0 flags=atomic ordered
4267 OFPT_FLOW_MOD (OF1.4): DEL_STRICT table:255 in_port=2,dl_src=00:66:77:88:99:aa actions=drop
4268 vconn|DBG|unix: received: OFPT_BUNDLE_ADD_MESSAGE (OF1.4):
4269 bundle_id=0 flags=atomic ordered
4270 OFPT_FLOW_MOD (OF1.4): ADD in_port=2,dl_src=00:66:77:88:99:aa actions=drop
4271 vconn|DBG|unix: received: OFPT_BUNDLE_CONTROL (OF1.4):
4272 bundle_id=0 type=COMMIT_REQUEST flags=atomic ordered
4273 vconn|DBG|unix: sent (Success): OFPT_BUNDLE_CONTROL (OF1.4):
4274 bundle_id=0 type=COMMIT_REPLY flags=0
4275 vconn|DBG|unix: sent (Success): OFPT_HELLO (OF1.5):
4276 version bitmap: 0x01, 0x02, 0x03, 0x04, 0x05, 0x06
4277 vconn|DBG|unix: received: OFPT_HELLO:
4278 version bitmap: 0x01
4279 vconn|DBG|unix: negotiated OpenFlow version 0x01 (we support version 0x06 and earlier, peer supports version 0x01)
4280 vconn|DBG|unix: received: NXT_SET_FLOW_FORMAT: format=nxm
4281 vconn|DBG|unix: received: OFPT_BARRIER_REQUEST:
4282 vconn|DBG|unix: sent (Success): OFPT_BARRIER_REPLY:
4283 vconn|DBG|unix: received: NXST_FLOW request:
4284 vconn|DBG|unix: sent (Success): NXST_FLOW reply:
4285 idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=output:8
4286 in_port=2,dl_src=00:66:77:88:99:aa actions=drop
4293 AT_SETUP([ofproto - failing bundle commit (OpenFlow 1.4)])
4294 AT_KEYWORDS([monitor])
4297 AT_CHECK([ovs-ofctl del-flows br0])
4299 ovs-ofctl add-flows br0 - <<EOF
4300 idle_timeout=50 in_port=2 dl_src=00:66:77:88:99:aa actions=11
4301 idle_timeout=60 in_port=2 dl_src=00:77:88:99:aa:bb actions=22
4302 idle_timeout=70 in_port=2 dl_src=00:88:99:aa:bb:cc actions=33
4304 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
4305 idle_timeout=50, in_port=2,dl_src=00:66:77:88:99:aa actions=output:11
4306 idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=output:22
4307 idle_timeout=70, in_port=2,dl_src=00:88:99:aa:bb:cc actions=output:33
4311 # last line uses illegal table number (OVS internal table)
4312 AT_DATA([flows.txt], [dnl
4313 add idle_timeout=50 in_port=2 dl_src=00:66:77:88:99:aa actions=1
4314 add idle_timeout=60 in_port=2 dl_src=00:77:88:99:aa:bb actions=2
4315 add idle_timeout=70 in_port=2 dl_src=00:88:99:aa:bb:cc actions=3
4316 modify idle_timeout=50 in_port=2 dl_src=00:66:77:88:99:aa actions=4
4318 add idle_timeout=50 in_port=2 dl_src=00:66:77:88:99:aa actions=5
4319 add idle_timeout=60 in_port=2 dl_src=00:77:88:99:aa:bb actions=6
4320 add idle_timeout=70 in_port=2 dl_src=00:88:99:aa:bb:cc actions=7
4321 delete in_port=2 dl_src=00:88:99:aa:bb:cc
4322 add table=254 actions=drop
4325 AT_CHECK([ovs-ofctl --bundle add-flows br0 flows.txt 2>&1 | sed '/|WARN|/d
4326 s/unix:.*br0\.mgmt/unix:br0.mgmt/' | sed 's/(.* error)/(error)/'],
4328 OFPT_ERROR (OF1.4) (xid=0xb): OFPBRC_EPERM
4329 OFPT_FLOW_MOD (OF1.4) (xid=0xb): ADD table:254 actions=drop
4330 OFPT_ERROR (OF1.4) (xid=0xd): OFPBFC_MSG_FAILED
4331 OFPT_BUNDLE_CONTROL (OF1.4) (xid=0xd):
4332 bundle_id=0 type=COMMIT_REQUEST flags=atomic ordered
4333 ovs-ofctl: talking to unix:br0.mgmt (error)
4336 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
4337 idle_timeout=50, in_port=2,dl_src=00:66:77:88:99:aa actions=output:11
4338 idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=output:22
4339 idle_timeout=70, in_port=2,dl_src=00:88:99:aa:bb:cc actions=output:33