3 AT_SETUP([ofproto - echo request])
5 AT_CHECK([ovs-ofctl -vwarn probe br0])
9 AT_SETUP([ofproto - handling messages with bad version])
10 AT_KEYWORDS([monitor])
13 # Start a monitor running OpenFlow 1.0, then send the switch an OF1.1 features
15 AT_CHECK([ovs-ofctl -P standard monitor br0 --detach --no-chdir --pidfile])
16 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
17 AT_CAPTURE_FILE([monitor.log])
18 ovs-appctl -t ovs-ofctl ofctl/send 0205000801234567
19 ovs-appctl -t ovs-ofctl ofctl/barrier
20 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
22 AT_CHECK([sed 's/ (xid=0x[[0-9a-fA-F]]*)//
23 /ECHO/d' monitor.log], [0], [dnl
24 send: OFPT_FEATURES_REQUEST (OF1.1):
25 OFPT_ERROR (OF1.1): OFPBRC_BAD_VERSION
26 OFPT_FEATURES_REQUEST (OF1.1):
30 OVS_VSWITCHD_STOP(["/received OpenFlow version 0x02 != expected 01/d"])
33 AT_SETUP([ofproto - feature request, config request])
35 AT_CHECK([ovs-ofctl -vwarn show br0], [0], [stdout])
36 AT_CHECK([strip_xids < stdout], [0], [dnl
37 OFPT_FEATURES_REPLY: dpid:fedcba9876543210
38 n_tables:254, n_buffers:0
39 capabilities: FLOW_STATS TABLE_STATS PORT_STATS QUEUE_STATS ARP_MATCH_IP
40 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
41 LOCAL(br0): addr:aa:55:aa:55:00:00
44 speed: 0 Mbps now, 0 Mbps max
45 OFPT_GET_CONFIG_REPLY: frags=normal miss_send_len=0
50 AT_SETUP([ofproto - set OpenFlow port number])
52 [add-port br0 p1 -- set Interface p1 type=dummy --\
53 add-port br0 p2 -- set Interface p2 type=dummy ofport_request=99])
54 AT_CHECK([ovs-ofctl -vwarn show br0], [0], [stdout])
56 s/ (xid=0x[0-9a-fA-F]*)//
57 s/00:0.$/00:0x/' < stdout]],
59 OFPT_FEATURES_REPLY: dpid:fedcba9876543210
60 n_tables:254, n_buffers:0
61 capabilities: FLOW_STATS TABLE_STATS PORT_STATS QUEUE_STATS ARP_MATCH_IP
62 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
63 1(p1): addr:aa:55:aa:55:00:0x
66 speed: 0 Mbps now, 0 Mbps max
67 99(p2): addr:aa:55:aa:55:00:0x
70 speed: 0 Mbps now, 0 Mbps max
71 LOCAL(br0): addr:aa:55:aa:55:00:0x
74 speed: 0 Mbps now, 0 Mbps max
75 OFPT_GET_CONFIG_REPLY: frags=normal miss_send_len=0
81 dnl This is really bare-bones.
82 dnl It at least checks request and reply serialization and deserialization.
83 AT_SETUP([ofproto - port stats - (OpenFlow 1.0)])
85 AT_CHECK([ovs-ofctl -vwarn dump-ports br0], [0], [stdout])
86 AT_CHECK([strip_xids < stdout], [0], [dnl
87 OFPST_PORT reply: 1 ports
88 port LOCAL: rx pkts=0, bytes=0, drop=?, errs=?, frame=?, over=?, crc=?
89 tx pkts=0, bytes=0, drop=?, errs=?, coll=?
94 AT_SETUP([ofproto - port stats - (OpenFlow 1.2)])
96 AT_CHECK([ovs-ofctl -O OpenFlow12 -vwarn dump-ports br0], [0], [stdout])
97 AT_CHECK([strip_xids < stdout], [0], [dnl
98 OFPST_PORT reply (OF1.2): 1 ports
99 port LOCAL: rx pkts=0, bytes=0, drop=?, errs=?, frame=?, over=?, crc=?
100 tx pkts=0, bytes=0, drop=?, errs=?, coll=?
105 AT_SETUP([ofproto - port stats - (OpenFlow 1.4)])
107 AT_CHECK([ovs-ofctl -O OpenFlow14 -vwarn dump-ports br0], [0], [stdout])
108 AT_CHECK([strip_xids < stdout | sed 's/duration=[[0-9.]]*s/duration=?s/'],
110 OFPST_PORT reply (OF1.4): 1 ports
111 port LOCAL: rx pkts=0, bytes=0, drop=?, errs=?, frame=?, over=?, crc=?
112 tx pkts=0, bytes=0, drop=?, errs=?, coll=?
115 rx_custom_packets_1=0, rx_custom_packets_2=0,
120 dnl This is really bare-bones.
121 dnl It at least checks request and reply serialization and deserialization.
122 AT_SETUP([ofproto - port-desc stats (OpenFlow 1.0)])
124 AT_CHECK([ovs-ofctl -vwarn dump-ports-desc br0], [0], [stdout])
125 AT_CHECK([strip_xids < stdout], [0], [dnl
126 OFPST_PORT_DESC reply:
127 LOCAL(br0): addr:aa:55:aa:55:00:00
130 speed: 0 Mbps now, 0 Mbps max
135 dnl This is really bare-bones.
136 dnl It at least checks request and reply serialization and deserialization.
137 AT_SETUP([ofproto - port-desc stats (OpenFlow 1.2)])
139 AT_CHECK([ovs-ofctl -O OpenFlow12 -vwarn dump-ports-desc br0], [0], [stdout])
140 AT_CHECK([strip_xids < stdout], [0], [dnl
141 OFPST_PORT_DESC reply (OF1.2):
142 LOCAL(br0): addr:aa:55:aa:55:00:00
145 speed: 0 Mbps now, 0 Mbps max
150 AT_SETUP([ofproto - port-desc stats (OpenFlow 1.5)])
152 add_of_ports br0 1 2 3
153 AT_CHECK([ovs-ofctl -F OXM-OpenFlow15 -O OpenFlow15 -vwarn dump-ports-desc br0], [0], [stdout])
154 AT_CHECK([strip_xids < stdout | sed 's/00:0./00:0x/'], [0], [dnl
155 OFPST_PORT_DESC reply (OF1.5):
156 1(p1): addr:aa:55:aa:55:00:0x
159 speed: 0 Mbps now, 0 Mbps max
160 2(p2): addr:aa:55:aa:55:00:0x
163 speed: 0 Mbps now, 0 Mbps max
164 3(p3): addr:aa:55:aa:55:00:0x
167 speed: 0 Mbps now, 0 Mbps max
168 LOCAL(br0): addr:aa:55:aa:55:00:0x
171 speed: 0 Mbps now, 0 Mbps max
173 AT_CHECK([ovs-ofctl -F OXM-OpenFlow15 -O OpenFlow15 -vwarn dump-ports-desc br0 2], [0], [stdout])
174 AT_CHECK([strip_xids < stdout | sed 's/00:0./00:0x/'], [0], [dnl
175 OFPST_PORT_DESC reply (OF1.5):
176 2(p2): addr:aa:55:aa:55:00:0x
179 speed: 0 Mbps now, 0 Mbps max
184 dnl CHECK_QUEUE_STATS(label, option, format)
185 m4_define([CHECK_QUEUE_STATS], [
186 AT_SETUP([ofproto - queue stats - (OpenFlow $1)])
189 AT_CHECK([ovs-ofctl -O $2 queue-stats br0 | strip_xids], [0],
190 [OFPST_QUEUE reply$3: 1 queues
191 port LOCAL queue 0: bytes=?, pkts=?, errors=?, duration=?
194 AT_CHECK([ovs-ofctl -O $2 queue-stats br0 LOCAL | strip_xids], [0],
195 [OFPST_QUEUE reply$3: 1 queues
196 port LOCAL queue 0: bytes=?, pkts=?, errors=?, duration=?
199 AT_CHECK([ovs-ofctl -O $2 queue-stats br0 LOCAL 0 | strip_xids], [0],
200 [OFPST_QUEUE reply$3: 1 queues
201 port LOCAL queue 0: bytes=?, pkts=?, errors=?, duration=?
204 AT_CHECK([ovs-ofctl -O $2 queue-stats br0 ANY 0 | strip_xids], [0],
205 [OFPST_QUEUE reply$3: 1 queues
206 port LOCAL queue 0: bytes=?, pkts=?, errors=?, duration=?
209 AT_CHECK([ovs-ofctl -O $2 queue-stats br0 LOCAL 5 | strip_xids], [0],
210 [OFPT_ERROR$3: OFPQOFC_BAD_QUEUE
211 OFPST_QUEUE request$3: port=LOCAL queue=5
214 AT_CHECK([ovs-ofctl -O $2 queue-stats br0 ANY 5 | strip_xids], [0],
215 [OFPT_ERROR$3: OFPQOFC_BAD_QUEUE
216 OFPST_QUEUE request$3: port=ANY queue=5
219 AT_CHECK([ovs-ofctl -O $2 queue-stats br0 10 | strip_xids], [0],
220 [OFPT_ERROR$3: OFPQOFC_BAD_PORT
221 OFPST_QUEUE request$3: port=10 queue=ALL
226 CHECK_QUEUE_STATS([1.0], [OpenFlow10], [])
227 CHECK_QUEUE_STATS([1.1], [OpenFlow11], [ (OF1.1)])
228 CHECK_QUEUE_STATS([1.2], [OpenFlow12], [ (OF1.2)])
229 CHECK_QUEUE_STATS([1.3], [OpenFlow13], [ (OF1.3)])
230 CHECK_QUEUE_STATS([1.4], [OpenFlow14], [ (OF1.4)])
232 dnl This is really bare-bones.
233 dnl It at least checks request and reply serialization and deserialization.
234 AT_SETUP([ofproto - queue configuration - (OpenFlow 1.0)])
237 AT_CHECK([ovs-ofctl queue-get-config br0 1], [0], [stdout])
238 AT_CHECK([strip_xids < stdout], [0], [dnl
239 OFPT_QUEUE_GET_CONFIG_REPLY: port=1
242 AT_CHECK([ovs-ofctl queue-get-config br0], [0], [stdout])
243 AT_CHECK([strip_xids < stdout | sort], [0], [dnl
244 OFPT_QUEUE_GET_CONFIG_REPLY: port=1
245 OFPT_QUEUE_GET_CONFIG_REPLY: port=2
249 AT_CHECK([ovs-ofctl queue-get-config br0 10], [0],
250 [OFPT_ERROR (xid=0x2): OFPQOFC_BAD_PORT
251 OFPT_QUEUE_GET_CONFIG_REQUEST (xid=0x2): port=10
256 AT_SETUP([ofproto - queue configuration - (OpenFlow 1.1)])
259 AT_CHECK([ovs-ofctl -O OpenFlow11 queue-get-config br0 1], [0], [stdout])
260 AT_CHECK([strip_xids < stdout], [0], [dnl
261 OFPT_QUEUE_GET_CONFIG_REPLY (OF1.1): port=1
264 AT_CHECK([ovs-ofctl -O OpenFlow11 queue-get-config br0 10 | strip_xids], [0],
265 [OFPT_ERROR (OF1.1): OFPQOFC_BAD_PORT
266 OFPT_QUEUE_GET_CONFIG_REQUEST (OF1.1): port=10
271 AT_SETUP([ofproto - queue configuration - (OpenFlow 1.2)])
274 AT_CHECK([ovs-ofctl -O OpenFlow12 queue-get-config br0 1], [0], [stdout])
275 AT_CHECK([strip_xids < stdout], [0], [dnl
276 OFPT_QUEUE_GET_CONFIG_REPLY (OF1.2): port=1
279 AT_CHECK([ovs-ofctl -O OpenFlow12 queue-get-config br0 ANY], [0], [stdout])
280 AT_CHECK([strip_xids < stdout], [0], [dnl
281 OFPT_QUEUE_GET_CONFIG_REPLY (OF1.2): port=ANY
286 AT_CHECK([ovs-ofctl -O OpenFlow12 queue-get-config br0 10 | strip_xids], [0],
287 [OFPT_ERROR (OF1.2): OFPQOFC_BAD_PORT
288 OFPT_QUEUE_GET_CONFIG_REQUEST (OF1.2): port=10
293 AT_SETUP([ofproto - queue configuration - (OpenFlow 1.4)])
297 AT_CHECK([ovs-ofctl -O OpenFlow14 queue-get-config br0 any | strip_xids], [0],
298 [OFPST_QUEUE_DESC reply (OF1.4): port=1
306 AT_CHECK([ovs-ofctl -O OpenFlow14 queue-get-config br0 1 | strip_xids], [0],
307 [OFPST_QUEUE_DESC reply (OF1.4): port=1
311 AT_CHECK([ovs-ofctl -O OpenFlow14 queue-get-config br0 10 | strip_xids], [0],
312 [OFPT_ERROR (OF1.4): OFPQOFC_BAD_PORT
313 OFPST_QUEUE_DESC request (OF1.4): port=10
316 AT_CHECK([ovs-ofctl -O OpenFlow14 queue-get-config br0 1 2 | strip_xids], [0],
317 [OFPT_ERROR (OF1.4): OFPQOFC_BAD_QUEUE
318 OFPST_QUEUE_DESC request (OF1.4): port=1 queue=2
323 dnl This is really bare-bones.
324 dnl It at least checks request and reply serialization and deserialization.
325 dnl Actions definition listed in both supported formats (w/ actions=)
326 AT_SETUP([ofproto - del group (OpenFlow 1.0 extension)])
328 AT_DATA([groups.txt], [dnl
329 group_id=1233,type=select,selection_method=hash,bucket=output:10,bucket=output:11
330 group_id=1234,type=select,selection_method=hash,fields(eth_dst,ip_dst,tcp_dst),bucket=output:10,bucket=output:11
331 group_id=1235,type=all,bucket=actions=output:12,bucket=bucket_id:0,actions=output:10,bucket=bucket_id:1,actions=output:11
332 group_id=1236,type=select,selection_method=dp_hash,bucket=output:10,bucket=output:11
334 AT_CHECK([ovs-ofctl -O OpenFlow10 -vwarn add-groups br0 groups.txt])
335 AT_CHECK([ovs-ofctl -O OpenFlow10 -vwarn dump-groups br0 1234], [0], [stdout])
336 AT_CHECK([strip_xids < stdout], [0], [dnl
337 NXST_GROUP_DESC reply:
338 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
340 AT_CHECK([ovs-ofctl -O OpenFlow10 -vwarn del-groups br0 group_id=1234])
341 AT_CHECK([ovs-ofctl -O OpenFlow10 -vwarn dump-groups br0], [0], [stdout])
342 AT_CHECK([strip_xids < stdout | sort], [0], [dnl
343 group_id=1233,type=select,selection_method=hash,bucket=bucket_id:0,actions=output:10,bucket=bucket_id:1,actions=output:11
344 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
345 group_id=1236,type=select,selection_method=dp_hash,bucket=bucket_id:0,actions=output:10,bucket=bucket_id:1,actions=output:11
346 NXST_GROUP_DESC reply:
348 AT_CHECK([ovs-ofctl -O OpenFlow10 -vwarn del-groups br0 group_id=1234])
349 AT_CHECK([ovs-ofctl -O OpenFlow10 -vwarn dump-groups br0], [0], [stdout])
350 AT_CHECK([strip_xids < stdout | sort], [0], [dnl
351 group_id=1233,type=select,selection_method=hash,bucket=bucket_id:0,actions=output:10,bucket=bucket_id:1,actions=output:11
352 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
353 group_id=1236,type=select,selection_method=dp_hash,bucket=bucket_id:0,actions=output:10,bucket=bucket_id:1,actions=output:11
354 NXST_GROUP_DESC reply:
356 AT_CHECK([ovs-ofctl -O OpenFlow10 -vwarn del-groups br0], [0])
357 AT_CHECK([ovs-ofctl -O OpenFlow10 -vwarn dump-groups br0], [0], [stdout])
358 AT_CHECK([strip_xids < stdout], [0], [dnl
359 NXST_GROUP_DESC reply:
364 dnl This is really bare-bones.
365 dnl It at least checks request and reply serialization and deserialization.
366 dnl Actions definition listed in both supported formats (w/ actions=)
367 AT_SETUP([ofproto - del group (OpenFlow 1.1)])
369 AT_DATA([groups.txt], [dnl
370 group_id=1234,type=all,bucket=output:10
371 group_id=1235,type=all,bucket=actions=output:10
373 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn add-groups br0 groups.txt])
374 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn dump-groups br0 ], [0], [stdout])
375 AT_CHECK([strip_xids < stdout | sort], [0], [dnl
376 group_id=1234,type=all,bucket=actions=output:10
377 group_id=1235,type=all,bucket=actions=output:10
378 OFPST_GROUP_DESC reply (OF1.1):
380 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn del-groups br0 group_id=1234])
381 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn dump-groups br0], [0], [stdout])
382 AT_CHECK([strip_xids < stdout], [0], [dnl
383 OFPST_GROUP_DESC reply (OF1.1):
384 group_id=1235,type=all,bucket=actions=output:10
386 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn del-groups br0 group_id=1234])
387 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn dump-groups br0], [0], [stdout])
388 AT_CHECK([strip_xids < stdout], [0], [dnl
389 OFPST_GROUP_DESC reply (OF1.1):
390 group_id=1235,type=all,bucket=actions=output:10
392 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn del-groups br0], [0])
393 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn dump-groups br0], [0], [stdout])
394 AT_CHECK([strip_xids < stdout], [0], [dnl
395 OFPST_GROUP_DESC reply (OF1.1):
399 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn del-groups br0 group_id=0xfffffff0],
400 [1], [], [ovs-ofctl: invalid group id 4294967280
405 dnl This is really bare-bones.
406 dnl It at least checks request and reply serialization and deserialization.
407 dnl Actions definition listed in both supported formats (w/ actions=)
408 AT_SETUP([ofproto - add indirect group])
410 dnl indirect group must have exactly one bucket
411 AT_DATA([stderr], [dnl
412 OFPT_ERROR (OF1.1) (xid=0x2): OFPGMFC_INVALID_GROUP
413 OFPT_GROUP_MOD (OF1.1) (xid=0x2): ***decode error: OFPGMFC_INVALID_GROUP***
415 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn add-group br0 'group_id=1234,type=indirect'], [1], , [stderr])
416 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn add-group br0 'group_id=1235,type=indirect,bucket=output:10'])
417 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn add-group br0 'group_id=1236,type=indirect,bucket=output:10,bucket=output:11'], [1], , [stderr])
421 AT_SETUP([ofproto - group mod with mod and add_or_mod command])
423 dnl Check that mod-group for non-existing group fails without --may-create
424 AT_DATA([stderr], [dnl
425 OFPT_ERROR (OF1.3) (xid=0x2): OFPGMFC_UNKNOWN_GROUP
426 OFPT_GROUP_MOD (OF1.3) (xid=0x2):
427 MOD group_id=1234,type=indirect,bucket=actions=output:2
429 AT_CHECK([ovs-ofctl -O OpenFlow13 -vwarn mod-group br0 'group_id=1234,type=indirect,bucket=actions=2'], [1], , [stderr])
430 dnl Check that mod-group for non-existing group succeeds with --may-create
431 AT_CHECK([ovs-ofctl -O OpenFlow13 -vwarn --may-create mod-group br0 'group_id=1234,type=indirect,bucket=actions=2'])
432 AT_CHECK([ovs-ofctl -O OpenFlow13 -vwarn dump-groups br0], [0], [stdout])
433 AT_CHECK([strip_xids < stdout], [0], [dnl
434 OFPST_GROUP_DESC reply (OF1.3):
435 group_id=1234,type=indirect,bucket=actions=output:2
437 dnl Check that mod-group for existing group succeeds with --may-create
438 AT_CHECK([ovs-ofctl -O OpenFlow13 -vwarn --may-create mod-group br0 'group_id=1234,type=indirect,bucket=actions=3'])
439 AT_CHECK([ovs-ofctl -O OpenFlow13 -vwarn dump-groups br0], [0], [stdout])
440 AT_CHECK([strip_xids < stdout], [0], [dnl
441 OFPST_GROUP_DESC reply (OF1.3):
442 group_id=1234,type=indirect,bucket=actions=output:3
447 dnl This is really bare-bones.
448 dnl It at least checks request and reply serialization and deserialization.
449 dnl Actions definition listed in both supported formats (w/ actions=)
450 AT_SETUP([ofproto - del group (OpenFlow 1.5)])
452 AT_DATA([groups.txt], [dnl
453 group_id=1233,type=select,selection_method=hash,bucket=output:10,bucket=output:11
454 group_id=1234,type=select,selection_method=hash,fields(eth_dst,ip_dst,tcp_dst),bucket=output:10,bucket=output:11
455 group_id=1235,type=all,bucket=actions=output:12,bucket=bucket_id:0,actions=output:10,bucket=bucket_id:1,actions=output:11
456 group_id=1236,type=select,selection_method=dp_hash,bucket=output:10,bucket=output:11
458 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn add-groups br0 groups.txt])
459 AT_CHECK([ovs-ofctl -F OXM-OpenFlow15 -O OpenFlow15 -vwarn dump-groups br0 1234], [0], [stdout])
460 AT_CHECK([strip_xids < stdout], [0], [dnl
461 OFPST_GROUP_DESC reply (OF1.5):
462 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
464 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn del-groups br0 group_id=1234])
465 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn dump-groups br0], [0], [stdout])
466 AT_CHECK([strip_xids < stdout | sort], [0], [dnl
467 group_id=1233,type=select,selection_method=hash,bucket=bucket_id:0,actions=output:10,bucket=bucket_id:1,actions=output:11
468 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
469 group_id=1236,type=select,selection_method=dp_hash,bucket=bucket_id:0,actions=output:10,bucket=bucket_id:1,actions=output:11
470 OFPST_GROUP_DESC reply (OF1.5):
472 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn del-groups br0 group_id=1234])
473 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn dump-groups br0], [0], [stdout])
474 AT_CHECK([strip_xids < stdout | sort], [0], [dnl
475 group_id=1233,type=select,selection_method=hash,bucket=bucket_id:0,actions=output:10,bucket=bucket_id:1,actions=output:11
476 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
477 group_id=1236,type=select,selection_method=dp_hash,bucket=bucket_id:0,actions=output:10,bucket=bucket_id:1,actions=output:11
478 OFPST_GROUP_DESC reply (OF1.5):
480 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn del-groups br0], [0])
481 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn dump-groups br0], [0], [stdout])
482 AT_CHECK([strip_xids < stdout], [0], [dnl
483 OFPST_GROUP_DESC reply (OF1.5):
488 dnl This is really bare-bones.
489 dnl It at least checks request and reply serialization and deserialization.
490 AT_SETUP([ofproto - del group deletes flows])
492 AT_DATA([groups.txt], [dnl
493 group_id=1234,type=all,bucket=output:10
494 group_id=1235,type=all,bucket=output:10
496 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn add-groups br0 groups.txt])
497 AT_DATA([flows.txt], [dnl
498 tcp actions=group:1234
499 table=2 udp actions=group:1235
501 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn add-flows br0 flows.txt])
502 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn dump-flows br0 | ofctl_strip | sort],
504 table=2, udp actions=group:1235
505 tcp actions=group:1234
506 OFPST_FLOW reply (OF1.1):
508 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn del-groups br0 group_id=1234])
509 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn dump-flows br0 | ofctl_strip | sort],
511 table=2, udp actions=group:1235
512 OFPST_FLOW reply (OF1.1):
514 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn del-groups br0 group_id=1234])
515 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn dump-flows br0 | ofctl_strip | sort],
517 table=2, udp actions=group:1235
518 OFPST_FLOW reply (OF1.1):
520 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn del-groups br0])
521 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn dump-flows br0 | ofctl_strip | sort],
523 OFPST_FLOW reply (OF1.1):
528 dnl This is really bare-bones.
529 dnl It at least checks request and reply serialization and deserialization.
530 dnl Actions definition listed in both supported formats (w/ actions=)
531 AT_SETUP([ofproto - insert group buckets])
533 # Add group with no buckets.
534 AT_DATA([groups.txt], [dnl
535 group_id=1234,type=all
537 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn add-groups br0 groups.txt])
538 AT_CHECK([ovs-ofctl -F OXM-OpenFlow15 -O OpenFlow15 -vwarn dump-groups br0 1234], [0], [stdout])
539 AT_CHECK([strip_xids < stdout], [0], [dnl
540 OFPST_GROUP_DESC reply (OF1.5):
541 group_id=1234,type=all
544 # Add two buckets, using "last".
545 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])
546 AT_CHECK([ovs-ofctl -F OXM-OpenFlow15 -O OpenFlow15 -vwarn dump-groups br0 1234], [0], [stdout])
547 AT_CHECK([strip_xids < stdout], [0], [dnl
548 OFPST_GROUP_DESC reply (OF1.5):
549 group_id=1234,type=all,bucket=bucket_id:10,actions=output:10,bucket=bucket_id:11,actions=output:11
552 # Start over again, then add two buckets using "first".
553 AT_CHECK([ovs-ofctl -O OpenFlow15 --strict del-groups br0 group_id=1234])
554 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn add-group br0 group_id=1234,type=all])
555 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])
556 AT_CHECK([ovs-ofctl -F OXM-OpenFlow15 -O OpenFlow15 -vwarn dump-groups br0 1234], [0], [stdout])
557 AT_CHECK([strip_xids < stdout], [0], [dnl
558 OFPST_GROUP_DESC reply (OF1.5):
559 group_id=1234,type=all,bucket=bucket_id:10,actions=output:10,bucket=bucket_id:11,actions=output:11
562 # Add two more buckets before the existing ones.
563 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])
564 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn dump-groups br0], [0], [stdout])
565 AT_CHECK([strip_xids < stdout], [0], [dnl
566 OFPST_GROUP_DESC reply (OF1.5):
567 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
570 # Add another bucket at the end.
571 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])
572 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn dump-groups br0], [0], [stdout])
573 AT_CHECK([strip_xids < stdout], [0], [dnl
574 OFPST_GROUP_DESC reply (OF1.5):
575 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
578 # Verify that duplicate bucket IDs are rejected.
579 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])
580 AT_CHECK([strip_xids < stderr | sed '/truncated/,$d'], [0], [dnl
581 OFPT_ERROR (OF1.5): OFPGMFC_BUCKET_EXISTS
582 OFPT_GROUP_MOD (OF1.5):
583 INSERT_BUCKET command_bucket_id:last,group_id=1234,bucket=bucket_id:14,actions=output:14,bucket=bucket_id:15,actions=output:15
587 # Add another bucket just before bucket 15.
588 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn insert-buckets br0 group_id=1234,command_bucket_id=15])
589 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn dump-groups br0], [0], [stdout])
590 AT_CHECK([strip_xids < stdout], [0], [dnl
591 OFPST_GROUP_DESC reply (OF1.5):
592 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
595 # Add two more buckets just before bucket 11,
596 # getting the command from a file.
597 AT_DATA([buckets.txt], [dnl
598 group_id=1234,command_bucket_id=11,bucket=bucket_id:12,actions=output:12,bucket=bucket_id:13,actions=output:13
600 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn insert-buckets br0 - < buckets.txt])
601 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn dump-groups br0], [0], [stdout])
602 AT_CHECK([strip_xids < stdout], [0], [dnl
603 OFPST_GROUP_DESC reply (OF1.5):
604 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
607 # Add yet two more buckets.
608 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])
609 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn dump-groups br0], [0], [stdout])
610 AT_CHECK([strip_xids < stdout], [0], [dnl
611 OFPST_GROUP_DESC reply (OF1.5):
612 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
616 AT_CHECK([ovs-ofctl -O OpenFlow15 del-groups br0])
618 # Add "fast_failover" group, then insert a bucket into it and make
619 # sure that the type of the group doesn't change. (There was a bug
620 # that caused this to happen.)
621 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn add-group br0 group_id=1234,type=ff])
622 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn dump-groups br0], [0], [stdout])
623 AT_CHECK([strip_xids < stdout], [0], [dnl
624 OFPST_GROUP_DESC reply (OF1.5):
625 group_id=1234,type=ff
627 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn insert-buckets br0 group_id=1234,command_bucket_id=first,bucket=bucket_id:20,actions=output:20,bucket=bucket_id:21,actions=output:21])
628 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn dump-groups br0], [0], [stdout])
629 AT_CHECK([strip_xids < stdout], [0], [dnl
630 OFPST_GROUP_DESC reply (OF1.5):
631 group_id=1234,type=ff,bucket=bucket_id:20,actions=output:20,bucket=bucket_id:21,actions=output:21
635 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn insert-buckets br0 group_id=1234,command_bucket_id=123,type=indirect,bucket=bucket_id:0,actions=output:0,bucket=bucket_id:1,actions=output:1], [1], [],
636 [ovs-ofctl: type is not needed
638 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn insert-buckets br0 group_id=1234,command_bucket_id=123,selection_method=dp_hash,type=indirect,bucket=bucket_id:0,actions=output:0,bucket=bucket_id:1,actions=output:1], [1], [],
639 [ovs-ofctl: selection method is not needed
641 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], [],
642 [ovs-ofctl: invalid command bucket id 4294967041
644 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], [],
645 [ovs-ofctl: insert-bucket needs OpenFlow 1.5 or later ('-O OpenFlow15')
648 # Verify insert-buckets command to insert bucket with weight value for select group.
649 AT_CHECK([ovs-ofctl -O OpenFlow15 --strict del-groups br0 group_id=1234])
650 AT_DATA([groups.txt], [dnl
651 group_id=1234,type=select,selection_method=hash,bucket=bucket_id=1,weight:100,output:11
653 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn add-groups br0 groups.txt])
654 AT_CHECK([ovs-ofctl -O OpenFlow15 insert-buckets br0 group_id=1234,command_bucket_id=last,bucket=bucket_id=2,weight=100,actions=output:11])
655 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn dump-groups br0], [0], [stdout])
656 AT_CHECK([strip_xids < stdout], [0], [dnl
657 OFPST_GROUP_DESC reply (OF1.5):
658 group_id=1234,type=select,selection_method=hash,bucket=bucket_id:1,weight:100,actions=output:11,bucket=bucket_id:2,weight:100,actions=output:11
664 dnl This is really bare-bones.
665 dnl It at least checks request and reply serialization and deserialization.
666 dnl Actions definition listed in both supported formats (w/ actions=)
667 AT_SETUP([ofproto - remove group buckets])
669 AT_DATA([groups.txt], [dnl
670 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
672 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn add-groups br0 groups.txt])
673 AT_CHECK([ovs-ofctl -F OXM-OpenFlow15 -O OpenFlow15 -vwarn dump-groups br0 1234], [0], [stdout])
674 AT_CHECK([strip_xids < stdout], [0], [dnl
675 OFPST_GROUP_DESC reply (OF1.5):
676 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
678 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn remove-buckets br0 group_id=1234,command_bucket_id=first])
679 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn dump-groups br0], [0], [stdout])
680 AT_CHECK([strip_xids < stdout], [0], [dnl
681 OFPST_GROUP_DESC reply (OF1.5):
682 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
684 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn remove-buckets br0 group_id=1234,command_bucket_id=last])
685 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn dump-groups br0], [0], [stdout])
686 AT_CHECK([strip_xids < stdout], [0], [dnl
687 OFPST_GROUP_DESC reply (OF1.5):
688 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
690 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn remove-buckets br0 group_id=1234,command_bucket_id=13])
691 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn dump-groups br0], [0], [stdout])
692 AT_CHECK([strip_xids < stdout], [0], [dnl
693 OFPST_GROUP_DESC reply (OF1.5):
694 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
696 AT_DATA([buckets.txt], [dnl
699 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn remove-buckets br0 - < buckets.txt])
700 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn dump-groups br0], [0], [stdout])
701 AT_CHECK([strip_xids < stdout], [0], [dnl
702 OFPST_GROUP_DESC reply (OF1.5):
703 group_id=1234,type=all
705 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn remove-buckets br0 group_id=1234,command_bucket_id=first])
706 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn remove-buckets br0 group_id=1234,command_bucket_id=last])
707 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn remove-buckets br0 group_id=1234,command_bucket_id=all])
708 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn remove-buckets br0 group_id=1234,command_bucket_id=1], [1], [], [stderr])
709 AT_CHECK([ofctl_strip < stderr], [0], [dnl
710 OFPT_ERROR (OF1.5): OFPGMFC_UNKNOWN_BUCKET
711 OFPT_GROUP_MOD (OF1.5):
712 REMOVE_BUCKET command_bucket_id:1,group_id=1234
715 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn remove-buckets br0 group_id=1234,command_bucket_id=last], [1], [],
716 [ovs-ofctl: none of the usable flow formats (OpenFlow10,NXM,OXM-OpenFlow15) is among the allowed flow formats (OpenFlow11)
721 AT_SETUP([ofproto - bundle del group (OpenFlow 1.3)])
723 AT_DATA([groups.txt], [dnl
724 group_id=1234,type=all,bucket=output:10
725 group_id=1235,type=all,bucket=actions=output:10
727 AT_CHECK([ovs-ofctl --bundle -O OpenFlow13 -vwarn add-groups br0 groups.txt])
728 AT_CHECK([ovs-ofctl -O OpenFlow13 -vwarn dump-groups br0 ], [0], [stdout])
729 AT_CHECK([strip_xids < stdout | sort], [0], [dnl
730 group_id=1234,type=all,bucket=actions=output:10
731 group_id=1235,type=all,bucket=actions=output:10
732 OFPST_GROUP_DESC reply (OF1.3):
734 AT_CHECK([ovs-ofctl --bundle -O OpenFlow13 -vwarn del-groups br0 group_id=1234])
735 AT_CHECK([ovs-ofctl -O OpenFlow13 -vwarn dump-groups br0], [0], [stdout])
736 AT_CHECK([strip_xids < stdout], [0], [dnl
737 OFPST_GROUP_DESC reply (OF1.3):
738 group_id=1235,type=all,bucket=actions=output:10
740 AT_CHECK([ovs-ofctl --bundle -O OpenFlow13 -vwarn del-groups br0 group_id=1234])
741 AT_CHECK([ovs-ofctl -O OpenFlow13 -vwarn dump-groups br0], [0], [stdout])
742 AT_CHECK([strip_xids < stdout], [0], [dnl
743 OFPST_GROUP_DESC reply (OF1.3):
744 group_id=1235,type=all,bucket=actions=output:10
746 AT_CHECK([ovs-ofctl --bundle -O OpenFlow13 -vwarn del-groups br0], [0])
747 AT_CHECK([ovs-ofctl -O OpenFlow13 -vwarn dump-groups br0], [0], [stdout])
748 AT_CHECK([strip_xids < stdout], [0], [dnl
749 OFPST_GROUP_DESC reply (OF1.3):
753 AT_CHECK([ovs-ofctl --bundle -O OpenFlow13 -vwarn del-groups br0 group_id=0xfffffff0],
754 [1], [], [ovs-ofctl: invalid group id 4294967280
759 AT_SETUP([ofproto - bundle add indirect group])
761 dnl indirect group must have exactly one bucket
762 AT_DATA([stderr], [dnl
763 OFPT_ERROR (OF1.4) (xid=0x2): OFPGMFC_INVALID_GROUP
764 OFPT_BUNDLE_ADD_MESSAGE (OF1.4) (xid=0x2):
765 bundle_id=0 flags=atomic ordered
766 OFPT_GROUP_MOD (OF1.4) (xid=0x2): ***decode error: OFPGMFC_INVALID_GROUP***
768 AT_CHECK([ovs-ofctl --bundle -vwarn add-group br0 'group_id=1234,type=indirect'], [1], , [stderr])
769 AT_CHECK([ovs-ofctl --bundle -vwarn add-group br0 'group_id=1235,type=indirect,bucket=output:10'])
770 AT_CHECK([ovs-ofctl --bundle -vwarn add-group br0 'group_id=1236,type=indirect,bucket=output:10,bucket=output:11'], [1], , [stderr])
774 AT_SETUP([ofproto - bundle group mod with mod and add_or_mod command])
776 dnl Check that mod-group for non-existing group fails without --may-create
777 AT_DATA([stderr], [dnl
778 OFPT_ERROR (OF1.4) (xid=0x2): OFPGMFC_UNKNOWN_GROUP
779 OFPT_GROUP_MOD (OF1.4) (xid=0x2):
780 MOD group_id=1234,type=indirect,bucket=actions=output:2
782 AT_CHECK([ovs-ofctl --bundle -vwarn mod-group br0 'group_id=1234,type=indirect,bucket=actions=2'], [1], , [stderr])
783 dnl Check that mod-group for non-existing group succeeds with --may-create
784 AT_CHECK([ovs-ofctl --bundle -vwarn --may-create mod-group br0 'group_id=1234,type=indirect,bucket=actions=2'])
785 AT_CHECK([ovs-ofctl -O OpenFlow14 -vwarn dump-groups br0], [0], [stdout])
786 AT_CHECK([strip_xids < stdout], [0], [dnl
787 OFPST_GROUP_DESC reply (OF1.4):
788 group_id=1234,type=indirect,bucket=actions=output:2
790 dnl Check that mod-group for existing group succeeds with --may-create
791 AT_CHECK([ovs-ofctl --bundle -vwarn --may-create mod-group br0 'group_id=1234,type=indirect,bucket=actions=3'])
792 AT_CHECK([ovs-ofctl -O OpenFlow14 -vwarn dump-groups br0], [0], [stdout])
793 AT_CHECK([strip_xids < stdout], [0], [dnl
794 OFPST_GROUP_DESC reply (OF1.4):
795 group_id=1234,type=indirect,bucket=actions=output:3
800 AT_SETUP([ofproto - bundle del group (OpenFlow 1.5)])
802 AT_DATA([groups.txt], [dnl
803 group_id=1233,type=select,selection_method=hash,bucket=output:10,bucket=output:11
804 group_id=1234,type=select,selection_method=hash,fields(eth_dst,ip_dst,tcp_dst),bucket=output:10,bucket=output:11
805 group_id=1235,type=all,bucket=actions=output:12,bucket=bucket_id:0,actions=output:10,bucket=bucket_id:1,actions=output:11
807 AT_CHECK([ovs-ofctl --bundle -O OpenFlow15 -vwarn add-groups br0 groups.txt])
808 AT_CHECK([ovs-ofctl -F OXM-OpenFlow15 -O OpenFlow15 -vwarn dump-groups br0 1234], [0], [stdout])
809 AT_CHECK([strip_xids < stdout], [0], [dnl
810 OFPST_GROUP_DESC reply (OF1.5):
811 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
813 AT_CHECK([ovs-ofctl --bundle -O OpenFlow15 -vwarn del-groups br0 group_id=1234])
814 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn dump-groups br0], [0], [stdout])
815 AT_CHECK([strip_xids < stdout | sort], [0], [dnl
816 group_id=1233,type=select,selection_method=hash,bucket=bucket_id:0,actions=output:10,bucket=bucket_id:1,actions=output:11
817 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
818 OFPST_GROUP_DESC reply (OF1.5):
820 AT_CHECK([ovs-ofctl --bundle -O OpenFlow15 -vwarn del-groups br0 group_id=1234])
821 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn dump-groups br0], [0], [stdout])
822 AT_CHECK([strip_xids < stdout | sort], [0], [dnl
823 group_id=1233,type=select,selection_method=hash,bucket=bucket_id:0,actions=output:10,bucket=bucket_id:1,actions=output:11
824 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
825 OFPST_GROUP_DESC reply (OF1.5):
827 AT_CHECK([ovs-ofctl --bundle -O OpenFlow15 -vwarn del-groups br0], [0])
828 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn dump-groups br0], [0], [stdout])
829 AT_CHECK([strip_xids < stdout], [0], [dnl
830 OFPST_GROUP_DESC reply (OF1.5):
835 AT_SETUP([ofproto - bundle del group deletes flows])
837 AT_DATA([groups.txt], [dnl
838 group_id=1234,type=all,bucket=output:10
839 group_id=1235,type=all,bucket=output:10
841 AT_CHECK([ovs-ofctl --bundle -vwarn add-groups br0 groups.txt])
842 AT_DATA([flows.txt], [dnl
843 tcp actions=group:1234
844 table=2 udp actions=group:1235
846 AT_CHECK([ovs-ofctl --bundle -vwarn add-flows br0 flows.txt])
847 AT_CHECK([ovs-ofctl -O OpenFlow14 -vwarn dump-flows br0 | ofctl_strip | sort],
849 table=2, udp actions=group:1235
850 tcp actions=group:1234
851 OFPST_FLOW reply (OF1.4):
853 AT_CHECK([ovs-ofctl --bundle -vwarn del-groups br0 group_id=1234])
854 AT_CHECK([ovs-ofctl -O OpenFlow14 -vwarn dump-flows br0 | ofctl_strip | sort],
856 table=2, udp actions=group:1235
857 OFPST_FLOW reply (OF1.4):
859 AT_CHECK([ovs-ofctl --bundle -vwarn del-groups br0 group_id=1234])
860 AT_CHECK([ovs-ofctl -O OpenFlow14 -vwarn dump-flows br0 | ofctl_strip | sort],
862 table=2, udp actions=group:1235
863 OFPST_FLOW reply (OF1.4):
865 AT_CHECK([ovs-ofctl --bundle -vwarn del-groups br0])
866 AT_CHECK([ovs-ofctl -O OpenFlow14 -vwarn dump-flows br0 | ofctl_strip | sort],
868 OFPST_FLOW reply (OF1.4):
873 dnl This is really bare-bones.
874 dnl It at least checks request and reply serialization and deserialization.
875 dnl Actions definition listed in both supported formats (w/ actions=)
876 AT_SETUP([ofproto - bundle insert group buckets])
878 # Add group with no buckets.
879 AT_DATA([groups.txt], [dnl
880 group_id=1234,type=all
882 AT_CHECK([ovs-ofctl --bundle -O OpenFlow15 -vwarn add-groups br0 groups.txt])
883 AT_CHECK([ovs-ofctl -F OXM-OpenFlow15 -O OpenFlow15 -vwarn dump-groups br0 1234], [0], [stdout])
884 AT_CHECK([strip_xids < stdout], [0], [dnl
885 OFPST_GROUP_DESC reply (OF1.5):
886 group_id=1234,type=all
889 # Add two buckets, using "last".
890 AT_CHECK([ovs-ofctl --bundle -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])
891 AT_CHECK([ovs-ofctl -F OXM-OpenFlow15 -O OpenFlow15 -vwarn dump-groups br0 1234], [0], [stdout])
892 AT_CHECK([strip_xids < stdout], [0], [dnl
893 OFPST_GROUP_DESC reply (OF1.5):
894 group_id=1234,type=all,bucket=bucket_id:10,actions=output:10,bucket=bucket_id:11,actions=output:11
897 # Start over again, then add two buckets using "first".
898 AT_DATA([groups.txt], [dnl
900 add group_id=1234,type=all
901 insert_bucket group_id=1234,command_bucket_id=first,bucket=bucket_id:10,actions=output:10,bucket=bucket_id:11,actions=output:11
903 AT_CHECK([ovs-ofctl --bundle -O OpenFlow15 -vwarn add-groups br0 groups.txt])
904 AT_CHECK([ovs-ofctl -F OXM-OpenFlow15 -O OpenFlow15 -vwarn dump-groups br0 1234], [0], [stdout])
905 AT_CHECK([strip_xids < stdout], [0], [dnl
906 OFPST_GROUP_DESC reply (OF1.5):
907 group_id=1234,type=all,bucket=bucket_id:10,actions=output:10,bucket=bucket_id:11,actions=output:11
910 # Add two more buckets before the existing ones.
911 AT_CHECK([ovs-ofctl --bundle -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])
912 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn dump-groups br0], [0], [stdout])
913 AT_CHECK([strip_xids < stdout], [0], [dnl
914 OFPST_GROUP_DESC reply (OF1.5):
915 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
918 # Add another bucket at the end.
919 AT_CHECK([ovs-ofctl --bundle -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])
920 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn dump-groups br0], [0], [stdout])
921 AT_CHECK([strip_xids < stdout], [0], [dnl
922 OFPST_GROUP_DESC reply (OF1.5):
923 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
926 # Verify that duplicate bucket IDs are rejected.
927 AT_CHECK([ovs-ofctl --bundle -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])
928 AT_CHECK([strip_xids < stderr | sed '/talking to/,$d'], [0], [dnl
929 Error OFPGMFC_BUCKET_EXISTS for: OFPT_GROUP_MOD (OF1.5):
930 INSERT_BUCKET command_bucket_id:last,group_id=1234,bucket=bucket_id:14,actions=output:14,bucket=bucket_id:15,actions=output:15
931 Error OFPBFC_MSG_FAILED for: OFPT_BUNDLE_CONTROL (OF1.5):
932 bundle_id=0 type=COMMIT_REQUEST flags=atomic ordered
935 # Add another bucket just before bucket 15.
936 AT_CHECK([ovs-ofctl --bundle -O OpenFlow15 -vwarn insert-buckets br0 group_id=1234,command_bucket_id=15])
937 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn dump-groups br0], [0], [stdout])
938 AT_CHECK([strip_xids < stdout], [0], [dnl
939 OFPST_GROUP_DESC reply (OF1.5):
940 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
943 # Add two more buckets just before bucket 11,
944 # getting the command from a file.
945 AT_DATA([buckets.txt], [dnl
946 group_id=1234,command_bucket_id=11,bucket=bucket_id:12,actions=output:12,bucket=bucket_id:13,actions=output:13
948 AT_CHECK([ovs-ofctl --bundle -O OpenFlow15 -vwarn insert-buckets br0 - < buckets.txt])
949 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn dump-groups br0], [0], [stdout])
950 AT_CHECK([strip_xids < stdout], [0], [dnl
951 OFPST_GROUP_DESC reply (OF1.5):
952 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
955 # Add yet two more buckets.
956 AT_CHECK([ovs-ofctl --bundle -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])
957 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn dump-groups br0], [0], [stdout])
958 AT_CHECK([strip_xids < stdout], [0], [dnl
959 OFPST_GROUP_DESC reply (OF1.5):
960 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
964 AT_CHECK([ovs-ofctl --bundle -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], [],
965 [ovs-ofctl: invalid command bucket id 4294967041
967 AT_CHECK([ovs-ofctl --bundle -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], [],
968 [ovs-ofctl: insert-bucket needs OpenFlow 1.5 or later ('-O OpenFlow15')
973 AT_SETUP([ofproto - bundle remove group buckets])
975 AT_DATA([groups.txt], [dnl
976 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
978 AT_CHECK([ovs-ofctl --bundle -O OpenFlow15 -vwarn add-groups br0 groups.txt])
979 AT_CHECK([ovs-ofctl -F OXM-OpenFlow15 -O OpenFlow15 -vwarn dump-groups br0 1234], [0], [stdout])
980 AT_CHECK([strip_xids < stdout], [0], [dnl
981 OFPST_GROUP_DESC reply (OF1.5):
982 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
984 AT_CHECK([ovs-ofctl --bundle -O OpenFlow15 -vwarn remove-buckets br0 group_id=1234,command_bucket_id=first])
985 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn dump-groups br0], [0], [stdout])
986 AT_CHECK([strip_xids < stdout], [0], [dnl
987 OFPST_GROUP_DESC reply (OF1.5):
988 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
990 AT_CHECK([ovs-ofctl --bundle -O OpenFlow15 -vwarn remove-buckets br0 group_id=1234,command_bucket_id=last])
991 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn dump-groups br0], [0], [stdout])
992 AT_CHECK([strip_xids < stdout], [0], [dnl
993 OFPST_GROUP_DESC reply (OF1.5):
994 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
996 AT_CHECK([ovs-ofctl --bundle -O OpenFlow15 -vwarn remove-buckets br0 group_id=1234,command_bucket_id=13])
997 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn dump-groups br0], [0], [stdout])
998 AT_CHECK([strip_xids < stdout], [0], [dnl
999 OFPST_GROUP_DESC reply (OF1.5):
1000 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
1002 AT_DATA([buckets.txt], [dnl
1005 AT_CHECK([ovs-ofctl --bundle -O OpenFlow15 -vwarn remove-buckets br0 - < buckets.txt])
1006 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn dump-groups br0], [0], [stdout])
1007 AT_CHECK([strip_xids < stdout], [0], [dnl
1008 OFPST_GROUP_DESC reply (OF1.5):
1009 group_id=1234,type=all
1011 AT_CHECK([ovs-ofctl --bundle -O OpenFlow15 -vwarn remove-buckets br0 group_id=1234,command_bucket_id=first])
1012 AT_CHECK([ovs-ofctl --bundle -O OpenFlow15 -vwarn remove-buckets br0 group_id=1234,command_bucket_id=last])
1013 AT_CHECK([ovs-ofctl --bundle -O OpenFlow15 -vwarn remove-buckets br0 group_id=1234,command_bucket_id=all])
1014 AT_CHECK([ovs-ofctl --bundle -O OpenFlow15 -vwarn remove-buckets br0 group_id=1234,command_bucket_id=1], [1], [], [stderr])
1015 AT_CHECK([ofctl_strip < stderr | sed '/talking to/,$d'], [0], [dnl
1016 Error OFPGMFC_UNKNOWN_BUCKET for: OFPT_GROUP_MOD (OF1.5):
1017 REMOVE_BUCKET command_bucket_id:1,group_id=1234
1018 Error OFPBFC_MSG_FAILED for: OFPT_BUNDLE_CONTROL (OF1.5):
1019 bundle_id=0 type=COMMIT_REQUEST flags=atomic ordered
1022 AT_CHECK([ovs-ofctl --bundle -O OpenFlow11 -vwarn remove-buckets br0 group_id=1234,command_bucket_id=last], [1], [],
1023 [ovs-ofctl: none of the usable flow formats (OXM-OpenFlow15) is among the allowed flow formats (OXM-OpenFlow14)
1028 dnl This is really bare-bones.
1029 dnl It at least checks request and reply serialization and deserialization.
1030 AT_SETUP([ofproto - flow mod checks group availability])
1032 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn add-group br0 group_id=1234,type=all,bucket=output:10])
1033 AT_DATA([flows.txt], [dnl
1034 tcp actions=group:1234
1035 udp actions=group:1235
1037 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn add-flow br0 'tcp actions=group:1234'])
1038 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn add-flow br0 'tcp actions=group:1235'], [1], [], [stderr])
1040 AT_CHECK([strip_xids < stderr], [0],
1041 [OFPT_ERROR (OF1.1): OFPBAC_BAD_OUT_GROUP
1042 OFPT_FLOW_MOD (OF1.1): ADD tcp actions=group:1235
1047 AT_SETUP([ofproto - bundle flow mod checks group availability])
1049 AT_DATA([bundle.txt], [dnl
1050 group add group_id=1234,type=all,bucket=output:10
1051 flow add tcp actions=group:1234
1052 flow add udp actions=group:1235
1054 AT_CHECK([ovs-ofctl -vwarn bundle br0 bundle.txt], [1], [], [stderr])
1056 AT_CHECK([ofctl_strip < stderr | sed '/talking to/,$d'], [0],
1058 Error OFPBAC_BAD_OUT_GROUP for: OFPT_FLOW_MOD (OF1.4): ADD udp actions=group:1235
1059 Error OFPBFC_MSG_FAILED for: OFPT_BUNDLE_CONTROL (OF1.4):
1060 bundle_id=0 type=COMMIT_REQUEST flags=atomic ordered
1065 dnl This is really bare-bones.
1066 dnl It at least checks request and reply serialization and deserialization.
1067 AT_SETUP([ofproto - group description])
1069 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn add-group br0 group_id=1234,type=all,bucket=output:10], [0], [stdout])
1070 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn dump-groups br0], [0], [stdout])
1071 AT_CHECK([strip_xids < stdout], [0], [dnl
1072 OFPST_GROUP_DESC reply (OF1.1):
1073 group_id=1234,type=all,bucket=actions=output:10
1078 dnl This is really bare-bones.
1079 dnl It at least checks request and reply serialization and deserialization.
1080 AT_SETUP([ofproto - group features (OpenFlow 1.0 extension)])
1082 AT_CHECK([ovs-ofctl -O OpenFlow10 -vwarn dump-group-features br0], [0], [stdout])
1083 AT_CHECK([strip_xids < stdout], [0], [dnl
1084 NXST_GROUP_FEATURES reply:
1089 max_groups=0xffffff00
1090 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
1092 max_groups=0xffffff00
1093 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
1095 max_groups=0xffffff00
1096 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
1097 fast failover group:
1098 max_groups=0xffffff00
1099 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
1104 dnl This is really bare-bones.
1105 dnl It at least checks request and reply serialization and deserialization.
1106 AT_SETUP([ofproto - group features (OpenFlow 1.2)])
1108 AT_CHECK([ovs-ofctl -O OpenFlow12 -vwarn dump-group-features br0], [0], [stdout])
1109 AT_CHECK([strip_xids < stdout], [0], [dnl
1110 OFPST_GROUP_FEATURES reply (OF1.2):
1115 max_groups=0xffffff00
1116 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
1118 max_groups=0xffffff00
1119 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
1121 max_groups=0xffffff00
1122 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
1123 fast failover group:
1124 max_groups=0xffffff00
1125 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
1130 dnl This is really bare-bones.
1131 dnl It at least checks request and reply serialization and deserialization.
1132 AT_SETUP([ofproto - group stats (OpenFlow 1.0 extension)])
1134 AT_DATA([groups.txt], [dnl
1135 group_id=1234,type=all,bucket=output:10
1136 group_id=1235,type=all,bucket=output:10
1138 AT_CHECK([ovs-ofctl -O OpenFlow10 -vwarn add-groups br0 groups.txt])
1139 AT_CHECK([ovs-ofctl -O OpenFlow10 -vwarn add-flow br0 'tcp actions=group:1234'])
1140 AT_CHECK([ovs-ofctl -O OpenFlow10 -vwarn dump-group-stats br0 group_id=1234], [0], [stdout])
1141 AT_CHECK([strip_xids < stdout | sed 's/duration=[[0-9.]]*s/duration=?s/' | sort], [0], [dnl
1142 group_id=1234,duration=?s,ref_count=1,packet_count=0,byte_count=0,bucket0:packet_count=0,byte_count=0
1145 AT_CHECK([ovs-ofctl -O OpenFlow10 -vwarn dump-group-stats br0], [0], [stdout])
1146 AT_CHECK([strip_xids < stdout | sed 's/duration=[[0-9.]]*s/duration=?s/' | sort], [0], [dnl
1147 group_id=1234,duration=?s,ref_count=1,packet_count=0,byte_count=0,bucket0:packet_count=0,byte_count=0
1148 group_id=1235,duration=?s,ref_count=0,packet_count=0,byte_count=0,bucket0:packet_count=0,byte_count=0
1154 dnl This is really bare-bones.
1155 dnl It at least checks request and reply serialization and deserialization.
1156 AT_SETUP([ofproto - group stats (OpenFlow 1.1)])
1158 AT_DATA([groups.txt], [dnl
1159 group_id=1234,type=all,bucket=output:10
1160 group_id=1235,type=all,bucket=output:10
1162 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn add-groups br0 groups.txt])
1163 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn add-flow br0 'tcp actions=group:1234'])
1164 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn dump-group-stats br0 group_id=1234], [0], [stdout])
1165 AT_CHECK([strip_xids < stdout | sort], [0], [dnl
1166 group_id=1234,ref_count=1,packet_count=0,byte_count=0,bucket0:packet_count=0,byte_count=0
1167 OFPST_GROUP reply (OF1.1):
1169 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn dump-group-stats br0], [0], [stdout])
1170 AT_CHECK([strip_xids < stdout | sort], [0], [dnl
1171 group_id=1234,ref_count=1,packet_count=0,byte_count=0,bucket0:packet_count=0,byte_count=0
1172 group_id=1235,ref_count=0,packet_count=0,byte_count=0,bucket0:packet_count=0,byte_count=0
1173 OFPST_GROUP reply (OF1.1):
1178 dnl This is really bare-bones.
1179 dnl It at least checks request and reply serialization and deserialization.
1180 AT_SETUP([ofproto - group stats (OpenFlow 1.3)])
1182 AT_DATA([groups.txt], [dnl
1183 group_id=1234,type=all,bucket=output:10
1184 group_id=1235,type=all,bucket=output:10
1186 AT_CHECK([ovs-ofctl -O OpenFlow13 -vwarn add-groups br0 groups.txt])
1187 AT_CHECK([ovs-ofctl -O OpenFlow13 -vwarn add-flow br0 'tcp actions=group:1234'])
1188 AT_CHECK([ovs-ofctl -O OpenFlow13 -vwarn dump-group-stats br0 group_id=1234], [0], [stdout])
1189 AT_CHECK([strip_xids < stdout | sed 's/duration=[[0-9.]]*s/duration=?s/' | sort], [0], [dnl
1190 group_id=1234,duration=?s,ref_count=1,packet_count=0,byte_count=0,bucket0:packet_count=0,byte_count=0
1191 OFPST_GROUP reply (OF1.3):
1193 AT_CHECK([ovs-ofctl -O OpenFlow13 -vwarn dump-group-stats br0], [0], [stdout])
1194 AT_CHECK([strip_xids < stdout | sed 's/duration=[[0-9.]]*s/duration=?s/' | sort], [0], [dnl
1195 group_id=1234,duration=?s,ref_count=1,packet_count=0,byte_count=0,bucket0:packet_count=0,byte_count=0
1196 group_id=1235,duration=?s,ref_count=0,packet_count=0,byte_count=0,bucket0:packet_count=0,byte_count=0
1197 OFPST_GROUP reply (OF1.3):
1202 dnl This is really bare-bones.
1203 dnl It at least checks request and reply serialization and deserialization.
1204 AT_SETUP([ofproto - group stats (OpenFlow 1.5)])
1206 AT_DATA([groups.txt], [dnl
1207 group_id=1234,type=all,bucket=output:10
1208 group_id=1235,type=all,bucket=output:10
1210 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn add-groups br0 groups.txt])
1211 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn add-flow br0 'tcp actions=group:1234'])
1212 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn dump-group-stats br0 group_id=1234], [0], [stdout])
1213 AT_CHECK([strip_xids < stdout | sed 's/duration=[[0-9.]]*s/duration=?s/' | sort], [0], [dnl
1214 group_id=1234,duration=?s,ref_count=1,packet_count=0,byte_count=0,bucket0:packet_count=0,byte_count=0
1215 OFPST_GROUP reply (OF1.5):
1217 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn dump-group-stats br0], [0], [stdout])
1218 AT_CHECK([strip_xids < stdout | sed 's/duration=[[0-9.]]*s/duration=?s/' | sort], [0], [dnl
1219 group_id=1234,duration=?s,ref_count=1,packet_count=0,byte_count=0,bucket0:packet_count=0,byte_count=0
1220 group_id=1235,duration=?s,ref_count=0,packet_count=0,byte_count=0,bucket0:packet_count=0,byte_count=0
1221 OFPST_GROUP reply (OF1.5):
1226 dnl This is used to find that the bucket counter is not updated.
1227 AT_SETUP([ofproto - group stats after insert a new bucket (OpenFlow 1.5)])
1229 AT_DATA([groups.txt], [dnl
1230 group_id=1234,type=select,selection_method=hash bucket=bucket_id=1,weight:100,actions=output:10
1232 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn add-groups br0 groups.txt])
1233 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn insert-buckets br0 'group_id=1234, command_bucket_id=last, bucket=bucket_id=2,weight:100,actions=output:10'])
1234 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn dump-group-stats br0 group_id=1234], [0], [stdout])
1235 AT_CHECK([strip_xids < stdout | sed 's/duration=[[0-9.]]*s/duration=?s/' | sort], [0], [dnl
1236 group_id=1234,duration=?s,ref_count=0,packet_count=0,byte_count=0,bucket0:packet_count=0,byte_count=0,bucket1:packet_count=0,byte_count=0
1237 OFPST_GROUP reply (OF1.5):
1242 dnl This found a use-after-free error in bridge destruction in the
1243 dnl presence of groups.
1244 AT_SETUP([ofproto - group add then bridge delete (OpenFlow 1.3)])
1246 AT_DATA([groups.txt], [dnl
1247 group_id=1234,type=all,bucket=output:10
1248 group_id=1235,type=all,bucket=output:10
1250 dnl This checks for regression against a parser bug such that
1251 dnl "actions=resbmit(,1)" etc. was rejected as a syntax error.
1252 group_id=2345,type=select,bucket=weight:10,actions=resubmit(,1),bucket=weight:10,actions=resubmit(,2),bucket=weight:1,actions=resubmit(,3)
1254 AT_CHECK([ovs-ofctl -O OpenFlow13 -vwarn add-groups br0 groups.txt])
1255 AT_CHECK([ovs-vsctl del-br br0])
1259 AT_SETUP([ofproto - mod-port (OpenFlow 1.0)])
1261 for command_config_state in \
1263 'noflood NO_FLOOD 0' \
1265 'no-receive NO_RECV 0' \
1266 'no-forward NO_RECV,NO_FWD 0' \
1267 'no-packet-in NO_RECV,NO_FWD,NO_PACKET_IN 0' \
1268 'forward NO_RECV,NO_PACKET_IN 0' \
1269 'packet-in NO_RECV 0' \
1272 'down PORT_DOWN LINK_DOWN'
1274 printf '\n--- %s --- \n\n' "$command_config_state"
1275 set $command_config_state
1276 command=$[1] config=`echo $[2] | sed 's/,/ /g'` state=$[3]
1277 AT_CHECK([ovs-ofctl -vwarn mod-port br0 br0 $command])
1278 AT_CHECK([ovs-ofctl -vwarn show br0], [0], [stdout])
1279 AT_CHECK_UNQUOTED([strip_xids < stdout], [0], [dnl
1280 OFPT_FEATURES_REPLY: dpid:fedcba9876543210
1281 n_tables:254, n_buffers:0
1282 capabilities: FLOW_STATS TABLE_STATS PORT_STATS QUEUE_STATS ARP_MATCH_IP
1283 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
1284 LOCAL(br0): addr:aa:55:aa:55:00:00
1287 speed: 0 Mbps now, 0 Mbps max
1288 OFPT_GET_CONFIG_REPLY: frags=normal miss_send_len=0
1294 AT_SETUP([ofproto - mod-port (OpenFlow 1.2)])
1296 for command_config_state in \
1298 'no-receive NO_RECV LIVE' \
1299 'no-forward NO_RECV,NO_FWD LIVE' \
1300 'no-packet-in NO_RECV,NO_FWD,NO_PACKET_IN LIVE' \
1301 'forward NO_RECV,NO_PACKET_IN LIVE' \
1302 'packet-in NO_RECV LIVE' \
1305 'down PORT_DOWN LINK_DOWN'
1307 printf '\n--- %s --- \n\n' "$command_config_state"
1308 set $command_config_state
1309 command=$[1] config=`echo $[2] | sed 's/,/ /g'` state=$[3]
1310 AT_CHECK([ovs-ofctl -O OpenFlow12 -vwarn mod-port br0 br0 $command])
1311 AT_CHECK([ovs-ofctl -O OpenFlow12 -vwarn show br0], [0], [stdout])
1312 AT_CHECK_UNQUOTED([strip_xids < stdout], [0], [dnl
1313 OFPT_FEATURES_REPLY (OF1.2): dpid:fedcba9876543210
1314 n_tables:254, n_buffers:0
1315 capabilities: FLOW_STATS TABLE_STATS PORT_STATS GROUP_STATS QUEUE_STATS
1316 LOCAL(br0): addr:aa:55:aa:55:00:00
1319 speed: 0 Mbps now, 0 Mbps max
1320 OFPT_GET_CONFIG_REPLY (OF1.2): frags=normal miss_send_len=0
1326 AT_SETUP([ofproto - mod-port (OpenFlow 1.4)])
1328 for command_config_state in \
1330 'no-receive NO_RECV LIVE' \
1331 'no-forward NO_RECV,NO_FWD LIVE' \
1332 'no-packet-in NO_RECV,NO_FWD,NO_PACKET_IN LIVE' \
1333 'forward NO_RECV,NO_PACKET_IN LIVE' \
1334 'packet-in NO_RECV LIVE' \
1337 'down PORT_DOWN LINK_DOWN'
1339 printf '\n--- %s --- \n\n' "$command_config_state"
1340 set $command_config_state
1341 command=$[1] config=`echo $[2] | sed 's/,/ /g'` state=$[3]
1342 AT_CHECK([ovs-ofctl -O OpenFlow14 -vwarn mod-port br0 br0 $command])
1343 AT_CHECK([ovs-ofctl -O OpenFlow14 -vwarn show br0], [0], [stdout])
1344 AT_CHECK_UNQUOTED([strip_xids < stdout], [0], [dnl
1345 OFPT_FEATURES_REPLY (OF1.4): dpid:fedcba9876543210
1346 n_tables:254, n_buffers:0
1347 capabilities: FLOW_STATS TABLE_STATS PORT_STATS GROUP_STATS QUEUE_STATS BUNDLES
1348 OFPST_PORT_DESC reply (OF1.4):
1349 LOCAL(br0): addr:aa:55:aa:55:00:00
1352 speed: 0 Mbps now, 0 Mbps max
1353 OFPT_GET_CONFIG_REPLY (OF1.4): frags=normal miss_send_len=0
1359 AT_SETUP([ofproto - basic flow_mod commands (NXM)])
1361 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip], [0], [NXST_FLOW reply:
1363 AT_CHECK([echo 'in_port=2,actions=1' | ovs-ofctl add-flows br0 -])
1364 AT_CHECK([ovs-ofctl add-flow br0 in_port=1,actions=2])
1365 AT_CHECK([ovs-ofctl -F nxm add-flow br0 table=1,in_port=4,actions=3])
1366 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1367 in_port=1 actions=output:2
1368 in_port=2 actions=output:1
1369 table=1, in_port=4 actions=output:3
1372 AT_CHECK([ovs-ofctl dump-aggregate br0 table=0 | strip_xids], [0], [dnl
1373 NXST_AGGREGATE reply: packet_count=0 byte_count=0 flow_count=2
1375 AT_CHECK([ovs-ofctl del-flows br0])
1376 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip], [0], [NXST_FLOW reply:
1381 AT_SETUP([ofproto - basic flow_mod commands (OpenFlow 1.0)])
1383 AT_CHECK([ovs-ofctl -F openflow10 dump-flows br0 | ofctl_strip], [0], [OFPST_FLOW reply:
1385 AT_CHECK([echo 'in_port=2,actions=1' | ovs-ofctl -F openflow10 add-flows br0 -])
1386 AT_CHECK([ovs-ofctl -F openflow10 add-flow br0 in_port=1,actions=2])
1387 AT_CHECK([ovs-ofctl -F openflow10 add-flow br0 table=1,in_port=4,actions=3])
1388 AT_CHECK([ovs-ofctl -F openflow10 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1389 in_port=1 actions=output:2
1390 in_port=2 actions=output:1
1391 table=1, in_port=4 actions=output:3
1394 AT_CHECK([ovs-ofctl -F openflow10 dump-aggregate br0 table=0 | strip_xids], [0], [dnl
1395 OFPST_AGGREGATE reply: packet_count=0 byte_count=0 flow_count=2
1397 AT_CHECK([ovs-ofctl -F openflow10 del-flows br0])
1398 AT_CHECK([ovs-ofctl -F openflow10 dump-flows br0 | ofctl_strip], [0], [OFPST_FLOW reply:
1403 # It's really dumb that check_overlap and reset_counts are considered
1404 # part of flow state, but OpenFlow implies that it is, and OFTest and
1405 # some users insist on it.
1406 AT_SETUP([ofproto - add-flow and flags])
1408 AT_CHECK([ovs-ofctl -F openflow10 add-flow br0 check_overlap,in_port=1,actions=drop])
1409 # Prior to OF1.3, flow dumps didn't include a "flags" field.
1410 AT_CHECK([ovs-ofctl -F openflow10 dump-flows br0 | ofctl_strip], [0], [dnl
1412 in_port=1 actions=drop
1414 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip], [0], [dnl
1415 OFPST_FLOW reply (OF1.1):
1416 in_port=1 actions=drop
1418 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip], [0], [dnl
1419 OFPST_FLOW reply (OF1.2):
1420 in_port=1 actions=drop
1422 # OF1.3 makes the flags visible.
1423 AT_CHECK([ovs-ofctl -O OpenFlow13 dump-flows br0 | ofctl_strip], [0], [dnl
1424 OFPST_FLOW reply (OF1.3):
1425 check_overlap reset_counts in_port=1 actions=drop
1427 AT_CHECK([ovs-ofctl -O OpenFlow14 dump-flows br0 | ofctl_strip], [0], [dnl
1428 OFPST_FLOW reply (OF1.4):
1429 check_overlap reset_counts in_port=1 actions=drop
1431 # OF1.5 makes the flags invisible.
1432 AT_CHECK([ovs-ofctl -O OpenFlow15 dump-flows br0 | ofctl_strip], [0], [dnl
1433 OFPST_FLOW reply (OF1.5):
1434 check_overlap reset_counts in_port=1 actions=drop
1439 AT_SETUP([ofproto - basic flow_mod commands (OpenFlow 1.1)])
1441 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip], [0], [OFPST_FLOW reply (OF1.1):
1443 AT_CHECK([echo 'in_port=2,actions=1' | ovs-ofctl -O OpenFlow11 add-flows br0 -])
1444 AT_CHECK([ovs-ofctl -O OpenFlow11 add-flow br0 in_port=1,actions=2])
1445 AT_CHECK([ovs-ofctl -O OpenFlow11 add-flow br0 table=1,in_port=4,actions=3])
1446 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1447 in_port=1 actions=output:2
1448 in_port=2 actions=output:1
1449 table=1, in_port=4 actions=output:3
1450 OFPST_FLOW reply (OF1.1):
1452 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-aggregate br0 table=0 | strip_xids], [0], [dnl
1453 OFPST_AGGREGATE reply (OF1.1): packet_count=0 byte_count=0 flow_count=2
1455 AT_CHECK([ovs-ofctl -O OpenFlow11 del-flows br0])
1456 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip], [0], [OFPST_FLOW reply (OF1.1):
1457 table=1, in_port=4 actions=output:3
1462 AT_SETUP([ofproto - flow_mod negative test (OpenFlow 1.1)])
1464 [set bridge br0 protocols=OpenFlow10,OpenFlow11,OpenFlow12,OpenFlow13])
1465 AT_CHECK([ovs-ofctl add-flow -O OpenFlow11 br0 table=1,action=goto_table:2])
1467 # The error message here actually comes from ovs-ofctl, not from ovs-vswitchd,
1468 # but at least it's the same code in ofpacts_check() that issues the error.
1469 AT_CHECK([ovs-ofctl add-flow -O OpenFlow11 br0 table=1,action=goto_table:1],
1471 [ovs-ofctl: actions are invalid with specified match (OFPBIC_BAD_TABLE_ID)
1476 AT_SETUP([ofproto - set-field flow_mod commands (NXM)])
1478 AT_CHECK([ovs-ofctl add-flow br0 ipv6,table=1,in_port=3,actions=drop])
1479 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])
1480 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])
1481 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1482 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[[]]
1483 table=1, ipv6,in_port=3 actions=load:0xa6badbfffefe59fa->NXM_NX_IPV6_SRC[[0..63]],load:0xfe8001234567890a->NXM_NX_IPV6_SRC[[64..127]]
1489 AT_SETUP([ofproto - basic flow_mod commands (OpenFlow 1.2)])
1491 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip], [0], [OFPST_FLOW reply (OF1.2):
1493 AT_CHECK([echo 'in_port=2,actions=1' | ovs-ofctl -O OpenFlow12 add-flows br0 -])
1494 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 in_port=1,actions=2])
1495 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 table=1,in_port=4,actions=3])
1496 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1497 in_port=1 actions=output:2
1498 in_port=2 actions=output:1
1499 table=1, in_port=4 actions=output:3
1500 OFPST_FLOW reply (OF1.2):
1502 AT_CHECK([ovs-ofctl -O OpenFlow12 del-flows br0])
1503 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip], [0], [OFPST_FLOW reply (OF1.2):
1508 AT_SETUP([ofproto - set-field flow_mod commands (OF1.2)])
1510 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 ipv6,table=1,in_port=3,actions=drop])
1511 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])
1512 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])
1513 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1514 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
1515 table=1, ipv6,in_port=3 actions=set_field:fe80:123:4567:890a:a6ba:dbff:fefe:59fa->ipv6_src
1516 OFPST_FLOW reply (OF1.2):
1521 AT_SETUP([ofproto - dump flows with cookie])
1523 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x1,in_port=1,actions=1])
1524 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x2,in_port=2,actions=1])
1525 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x3,in_port=3,actions=1])
1526 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1527 cookie=0x1, in_port=1 actions=output:1
1528 cookie=0x2, in_port=2 actions=output:1
1529 cookie=0x3, in_port=3 actions=output:1
1532 AT_CHECK([ovs-ofctl dump-aggregate br0 table=0 | strip_xids], [0], [dnl
1533 NXST_AGGREGATE reply: packet_count=0 byte_count=0 flow_count=3
1535 AT_CHECK([ovs-ofctl dump-flows br0 cookie=0x3/-1 | ofctl_strip | sort], [0], [dnl
1536 cookie=0x3, in_port=3 actions=output:1
1539 AT_CHECK([ovs-ofctl dump-aggregate br0 cookie=0x3/-1 | strip_xids], [0], [dnl
1540 NXST_AGGREGATE reply: packet_count=0 byte_count=0 flow_count=1
1545 AT_SETUP([ofproto - mod flow with cookie change (OpenFlow 1.0)])
1547 AT_CHECK([ovs-ofctl -F openflow10 add-flow br0 cookie=0x1,in_port=1,actions=1])
1548 AT_CHECK([ovs-ofctl -F openflow10 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1549 cookie=0x1, in_port=1 actions=output:1
1553 AT_CHECK([ovs-ofctl -F openflow10 mod-flows br0 cookie=0x2,in_port=1,actions=1])
1554 AT_CHECK([ovs-ofctl -F openflow10 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1555 cookie=0x2, in_port=1 actions=output:1
1561 AT_SETUP([ofproto - mod flow with cookie change (NXM)])
1563 AT_CHECK([ovs-ofctl -F nxm add-flow br0 cookie=0x1,in_port=1,actions=1])
1564 AT_CHECK([ovs-ofctl -F nxm dump-flows br0 | ofctl_strip | sort], [0], [dnl
1565 cookie=0x1, in_port=1 actions=output:1
1569 AT_CHECK([ovs-ofctl -F nxm mod-flows br0 cookie=0x2,in_port=1,actions=1])
1570 AT_CHECK([ovs-ofctl -F nxm dump-flows br0 | ofctl_strip | sort], [0], [dnl
1571 cookie=0x2, in_port=1 actions=output:1
1577 AT_SETUP([ofproto - no mod flow with cookie change (OpenFlow 1.1)])
1579 AT_CHECK([ovs-ofctl -O OpenFlow11 add-flow br0 cookie=0x1,in_port=1,actions=1])
1580 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1581 cookie=0x1, in_port=1 actions=output:1
1582 OFPST_FLOW reply (OF1.1):
1584 AT_CHECK([ovs-ofctl -O OpenFlow11 mod-flows br0 cookie=0x2,in_port=1,actions=1])
1585 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1586 cookie=0x1, in_port=1 actions=output:1
1587 OFPST_FLOW reply (OF1.1):
1592 dnl The OpenFlow 1.2 spec states that the cookie may not be modified
1593 AT_SETUP([ofproto - no mod flow with cookie change (OpenFlow 1.2)])
1595 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 cookie=0x1,in_port=1,actions=1])
1596 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1597 cookie=0x1, in_port=1 actions=output:1
1598 OFPST_FLOW reply (OF1.2):
1601 AT_CHECK([ovs-ofctl -O OpenFlow12 mod-flows br0 cookie=0x2,in_port=1,actions=1])
1602 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1603 cookie=0x1, in_port=1 actions=output:1
1604 OFPST_FLOW reply (OF1.2):
1609 AT_SETUP([ofproto - mod flows based on cookie mask (OpenFlow 1.0)])
1611 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x1,in_port=1,actions=1])
1612 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x1,in_port=2,actions=1])
1613 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x2,in_port=3,actions=1])
1614 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1615 cookie=0x1, in_port=1 actions=output:1
1616 cookie=0x1, in_port=2 actions=output:1
1617 cookie=0x2, in_port=3 actions=output:1
1621 AT_CHECK([ovs-ofctl -F nxm mod-flows br0 cookie=0x1/0xff,actions=4])
1622 AT_CHECK([ovs-ofctl -F nxm dump-flows br0 | ofctl_strip | sort], [0], [dnl
1623 cookie=0x1, in_port=1 actions=output:4
1624 cookie=0x1, in_port=2 actions=output:4
1625 cookie=0x2, in_port=3 actions=output:1
1631 AT_SETUP([ofproto - mod flows based on cookie mask (OpenFlow 1.1)])
1633 AT_CHECK([ovs-ofctl -O OpenFlow11 add-flow br0 cookie=0x1,in_port=1,actions=1])
1634 AT_CHECK([ovs-ofctl -O OpenFlow11 add-flow br0 cookie=0x1,in_port=2,actions=1])
1635 AT_CHECK([ovs-ofctl -O OpenFlow11 add-flow br0 cookie=0x2,in_port=3,actions=1])
1636 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1637 cookie=0x1, in_port=1 actions=output:1
1638 cookie=0x1, in_port=2 actions=output:1
1639 cookie=0x2, in_port=3 actions=output:1
1640 OFPST_FLOW reply (OF1.1):
1643 AT_CHECK([ovs-ofctl -O OpenFlow11 mod-flows br0 cookie=0x1/0xff,actions=4])
1644 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1645 cookie=0x1, in_port=1 actions=output:4
1646 cookie=0x1, in_port=2 actions=output:4
1647 cookie=0x2, in_port=3 actions=output:1
1648 OFPST_FLOW reply (OF1.1):
1653 AT_SETUP([ofproto - mod flows based on cookie mask (OpenFlow 1.2)])
1655 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 cookie=0x1,in_port=1,actions=1])
1656 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 cookie=0x1,in_port=2,actions=1])
1657 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 cookie=0x2,in_port=3,actions=1])
1658 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1659 cookie=0x1, in_port=1 actions=output:1
1660 cookie=0x1, in_port=2 actions=output:1
1661 cookie=0x2, in_port=3 actions=output:1
1662 OFPST_FLOW reply (OF1.2):
1665 AT_CHECK([ovs-ofctl -O OpenFlow12 mod-flows br0 cookie=0x1/0xff,actions=4])
1666 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1667 cookie=0x1, in_port=1 actions=output:4
1668 cookie=0x1, in_port=2 actions=output:4
1669 cookie=0x2, in_port=3 actions=output:1
1670 OFPST_FLOW reply (OF1.2):
1675 dnl The OpenFlow 1.2 spec states that the cookie may not be modified
1676 AT_SETUP([ofproto - mod flows based on cookie mask with cookie change])
1678 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x1,in_port=1,actions=1])
1679 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x1,in_port=2,actions=1])
1680 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x2,in_port=3,actions=1])
1681 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1682 cookie=0x1, in_port=1 actions=output:1
1683 cookie=0x1, in_port=2 actions=output:1
1684 cookie=0x2, in_port=3 actions=output:1
1688 AT_CHECK([ovs-ofctl -F nxm mod-flows br0 cookie=1/-1,cookie=4,actions=4])
1689 AT_CHECK([ovs-ofctl -F nxm dump-flows br0 | ofctl_strip | sort], [0], [dnl
1690 cookie=0x2, in_port=3 actions=output:1
1691 cookie=0x4, in_port=1 actions=output:4
1692 cookie=0x4, in_port=2 actions=output:4
1698 AT_SETUP([ofproto - mod flow with cookie miss (mask==0) - NXM])
1700 AT_CHECK([ovs-ofctl -F nxm mod-flows br0 in_port=1,actions=1])
1701 AT_CHECK([ovs-ofctl -F nxm dump-flows br0 | ofctl_strip | sort], [0], [dnl
1702 in_port=1 actions=output:1
1708 AT_SETUP([ofproto - mod flow with cookie miss (mask==0) - OF1.1])
1710 AT_CHECK([ovs-ofctl -O openflow11 mod-flows br0 in_port=1,actions=1])
1711 AT_CHECK([ovs-ofctl -O openflow11 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1712 in_port=1 actions=output:1
1713 OFPST_FLOW reply (OF1.1):
1718 AT_SETUP([ofproto - mod flow with cookie miss (mask==0) - OF1.2])
1720 AT_CHECK([ovs-ofctl -O openflow12 mod-flows br0 in_port=1,actions=1])
1721 AT_CHECK([ovs-ofctl -O openflow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1722 OFPST_FLOW reply (OF1.2):
1727 AT_SETUP([ofproto - mod flow with cookie miss (mask!=0) - NXM])
1729 AT_CHECK([ovs-ofctl -F nxm mod-flows br0 cookie=1/1,in_port=1,actions=1])
1730 AT_CHECK([ovs-ofctl -F nxm dump-flows br0 | ofctl_strip | sort], [0], [dnl
1736 AT_SETUP([ofproto - mod flow with cookie miss (mask!=0) - OF1.1])
1738 AT_CHECK([ovs-ofctl -O openflow11 mod-flows br0 cookie=1/1,in_port=1,actions=1])
1739 AT_CHECK([ovs-ofctl -O openflow11 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1740 OFPST_FLOW reply (OF1.1):
1745 AT_SETUP([ofproto - mod flow with cookie miss (mask!=0) - OF1.2])
1747 AT_CHECK([ovs-ofctl -O openflow12 mod-flows br0 cookie=1/1,in_port=1,actions=1])
1748 AT_CHECK([ovs-ofctl -O openflow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1749 OFPST_FLOW reply (OF1.2):
1754 AT_SETUP([ofproto - del flows with cookies])
1756 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x1,in_port=1,actions=1])
1757 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x2,in_port=2,actions=1])
1758 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x3,in_port=3,actions=1])
1759 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1760 cookie=0x1, in_port=1 actions=output:1
1761 cookie=0x2, in_port=2 actions=output:1
1762 cookie=0x3, in_port=3 actions=output:1
1766 AT_CHECK([ovs-ofctl del-flows br0])
1767 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1773 AT_SETUP([ofproto - del flows based on cookie])
1775 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x1,in_port=1,actions=1])
1776 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x2,in_port=2,actions=1])
1777 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x3,in_port=3,actions=1])
1778 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1779 cookie=0x1, in_port=1 actions=output:1
1780 cookie=0x2, in_port=2 actions=output:1
1781 cookie=0x3, in_port=3 actions=output:1
1785 AT_CHECK([ovs-ofctl del-flows br0 cookie=0x3/-1])
1786 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1787 cookie=0x1, in_port=1 actions=output:1
1788 cookie=0x2, in_port=2 actions=output:1
1794 AT_SETUP([ofproto - del flows based on cookie mask])
1796 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x1,in_port=1,actions=1])
1797 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x2,in_port=2,actions=1])
1798 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x3,in_port=3,actions=1])
1799 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1800 cookie=0x1, in_port=1 actions=output:1
1801 cookie=0x2, in_port=2 actions=output:1
1802 cookie=0x3, in_port=3 actions=output:1
1805 AT_CHECK([ovs-ofctl del-flows br0 cookie=0x3/0x1])
1806 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1807 cookie=0x2, in_port=2 actions=output:1
1813 AT_SETUP([ofproto - del flows based on table id (NXM)])
1815 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x1,in_port=1,actions=1])
1816 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x2,in_port=2,table=1,actions=1])
1817 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1818 cookie=0x1, in_port=1 actions=output:1
1819 cookie=0x2, table=1, in_port=2 actions=output:1
1822 AT_CHECK([ovs-ofctl del-flows br0 table=0])
1823 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1824 cookie=0x2, table=1, in_port=2 actions=output:1
1827 AT_CHECK([ovs-ofctl del-flows br0 table=1])
1828 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1831 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x1,in_port=1,actions=1])
1832 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x2,in_port=2,table=1,actions=1])
1833 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1834 cookie=0x1, in_port=1 actions=output:1
1835 cookie=0x2, table=1, in_port=2 actions=output:1
1838 AT_CHECK([ovs-ofctl del-flows br0])
1839 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1845 AT_SETUP([ofproto - del flows based on table id (OpenFlow 1.1)])
1847 AT_CHECK([ovs-ofctl -O OpenFlow11 add-flow br0 cookie=0x1,in_port=1,actions=1])
1848 AT_CHECK([ovs-ofctl -O OpenFlow11 add-flow br0 cookie=0x2,in_port=2,table=1,actions=1])
1849 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1850 cookie=0x1, in_port=1 actions=output:1
1851 cookie=0x2, table=1, in_port=2 actions=output:1
1852 OFPST_FLOW reply (OF1.1):
1854 AT_CHECK([ovs-ofctl -O OpenFlow11 del-flows br0 table=0])
1855 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1856 cookie=0x2, table=1, in_port=2 actions=output:1
1857 OFPST_FLOW reply (OF1.1):
1859 AT_CHECK([ovs-ofctl -O OpenFlow11 del-flows br0 table=1])
1860 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1861 OFPST_FLOW reply (OF1.1):
1863 AT_CHECK([ovs-ofctl -O OpenFlow11 add-flow br0 cookie=0x1,in_port=1,actions=1])
1864 AT_CHECK([ovs-ofctl -O OpenFlow11 add-flow br0 cookie=0x2,in_port=2,table=1,actions=1])
1865 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1866 cookie=0x1, in_port=1 actions=output:1
1867 cookie=0x2, table=1, in_port=2 actions=output:1
1868 OFPST_FLOW reply (OF1.1):
1870 AT_CHECK([ovs-ofctl -O OpenFlow11 del-flows br0])
1871 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip], [0], [dnl
1872 OFPST_FLOW reply (OF1.1):
1873 cookie=0x2, table=1, in_port=2 actions=output:1
1878 AT_SETUP([ofproto - del flows based on table id (OpenFlow 1.2)])
1880 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 cookie=0x1,in_port=1,actions=1])
1881 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 cookie=0x2,in_port=2,table=1,actions=1])
1882 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1883 cookie=0x1, in_port=1 actions=output:1
1884 cookie=0x2, table=1, in_port=2 actions=output:1
1885 OFPST_FLOW reply (OF1.2):
1887 AT_CHECK([ovs-ofctl -O OpenFlow12 del-flows br0 table=0])
1888 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1889 cookie=0x2, table=1, in_port=2 actions=output:1
1890 OFPST_FLOW reply (OF1.2):
1892 AT_CHECK([ovs-ofctl -O OpenFlow12 del-flows br0 table=1])
1893 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1894 OFPST_FLOW reply (OF1.2):
1896 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 cookie=0x1,in_port=1,actions=1])
1897 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 cookie=0x2,in_port=2,table=1,actions=1])
1898 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1899 cookie=0x1, in_port=1 actions=output:1
1900 cookie=0x2, table=1, in_port=2 actions=output:1
1901 OFPST_FLOW reply (OF1.2):
1903 AT_CHECK([ovs-ofctl -O OpenFlow12 del-flows br0])
1904 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1905 OFPST_FLOW reply (OF1.2):
1910 AT_SETUP([ofproto - flow_mod with out_port matching (OpenFlow 1.0)])
1912 AT_DATA([flows.txt], [dnl
1913 in_port=1 actions=output:2
1914 in_port=2 actions=output:1,output:2,output:3
1915 in_port=3 actions=output:3,output:1,output:2
1916 in_port=4 actions=drop
1917 in_port=5 actions=output:3
1918 in_port=6 actions=output:1
1920 AT_CHECK([ovs-ofctl -F openflow10 add-flows br0 flows.txt])
1921 (cat flows.txt; echo 'OFPST_FLOW reply:') > expout
1922 AT_CHECK([ovs-ofctl -F openflow10 dump-flows br0 | ofctl_strip | sort], [0],
1925 (grep 'output:2' flows.txt; echo 'OFPST_FLOW reply:') > expout
1926 AT_CHECK([ovs-ofctl -F openflow10 dump-flows br0 out_port=2 | ofctl_strip | sort], [0], [expout])
1928 AT_CHECK([ovs-ofctl -F openflow10 del-flows br0 out_port=2])
1929 (grep -v 'output:2' flows.txt; echo 'OFPST_FLOW reply:') > expout
1930 AT_CHECK([ovs-ofctl -F openflow10 dump-flows br0 | ofctl_strip | sort], [0],
1933 AT_CHECK([ovs-ofctl -F openflow10 del-flows br0 out_port=3])
1934 (grep -v 'output:[[23]]' flows.txt; echo 'OFPST_FLOW reply:') > expout
1935 AT_CHECK([ovs-ofctl -F openflow10 dump-flows br0 | ofctl_strip | sort], [0],
1938 AT_CHECK([ovs-ofctl -F openflow10 del-flows br0 out_port=1])
1939 (grep -v 'output:[[123]]' flows.txt; echo 'OFPST_FLOW reply:') > expout
1940 AT_CHECK([ovs-ofctl -F openflow10 dump-flows br0 | ofctl_strip | sort], [0],
1946 AT_SETUP([ofproto - flow_mod with out_port matching (OpenFlow 1.1)])
1948 AT_DATA([flows.txt], [dnl
1949 in_port=1 actions=output:2
1950 in_port=2 actions=output:1,write_actions(output:2,output:3)
1951 in_port=3 actions=output:3,output:1,write_actions(output:2)
1952 in_port=4 actions=drop
1953 in_port=5 actions=write_actions(output:3)
1954 in_port=6 actions=output:1
1956 AT_CHECK([ovs-ofctl -O OpenFlow11 add-flows br0 flows.txt])
1957 (cat flows.txt; echo 'OFPST_FLOW reply (OF1.1):') > expout
1958 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0],
1961 (grep 'output:2' flows.txt; echo 'OFPST_FLOW reply (OF1.1):') > expout
1962 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 out_port=2 | ofctl_strip | sort], [0], [expout])
1964 AT_CHECK([ovs-ofctl -O OpenFlow11 del-flows br0 out_port=2])
1965 (grep -v 'output:2' flows.txt; echo 'OFPST_FLOW reply (OF1.1):') > expout
1966 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0],
1969 AT_CHECK([ovs-ofctl -O OpenFlow11 del-flows br0 out_port=3])
1970 (grep -v 'output:[[23]]' flows.txt; echo 'OFPST_FLOW reply (OF1.1):') > expout
1971 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0],
1974 AT_CHECK([ovs-ofctl -O OpenFlow11 del-flows br0 out_port=1])
1975 (grep -v 'output:[[123]]' flows.txt; echo 'OFPST_FLOW reply (OF1.1):') > expout
1976 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0],
1982 AT_SETUP([ofproto - flow_mod with out_group matching (OpenFlow 1.1)])
1984 AT_DATA([groups.txt], [dnl
1985 group_id=1,type=all,bucket=output:10
1986 group_id=2,type=all,bucket=output:10
1987 group_id=3,type=all,bucket=output:10
1989 AT_CHECK([ovs-ofctl -O OpenFlow11 add-groups br0 groups.txt])
1990 AT_DATA([flows.txt], [dnl
1991 in_port=1 actions=group:2,output:5
1992 in_port=2 actions=group:1,write_actions(group:2,group:3,output:6)
1993 in_port=3 actions=group:3,group:1,write_actions(group:2,output:3)
1994 in_port=4 actions=output:4
1995 in_port=5 actions=write_actions(output:4,group:3)
1996 in_port=6 actions=group:1
1998 AT_CHECK([ovs-ofctl -O OpenFlow11 add-flows br0 flows.txt])
1999 (cat flows.txt; echo 'OFPST_FLOW reply (OF1.1):') > expout
2000 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0],
2003 (grep 'output:3' flows.txt | grep 'group:2'; echo 'OFPST_FLOW reply (OF1.1):') > expout
2004 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 out_port=3,out_group=2 | ofctl_strip | sort], [0], [expout])
2006 AT_CHECK([ovs-ofctl -O OpenFlow11 del-flows br0 out_group=2])
2007 (grep -v 'group:2' flows.txt; echo 'OFPST_FLOW reply (OF1.1):') > expout
2008 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0],
2011 AT_CHECK([ovs-ofctl -O OpenFlow11 del-flows br0 out_group=3])
2012 (grep -v 'group:[[23]]' flows.txt; echo 'OFPST_FLOW reply (OF1.1):') > expout
2013 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0],
2016 AT_CHECK([ovs-ofctl -O OpenFlow11 del-flows br0 out_group=1])
2017 (grep -v 'group:[[123]]' flows.txt; echo 'OFPST_FLOW reply (OF1.1):') > expout
2018 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0],
2024 AT_SETUP([ofproto - bundle flow_mod with out group matching (OpenFlow 1.4)])
2026 AT_DATA([bundle.txt], [dnl
2027 group group_id=1,type=all,bucket=output:10
2028 group group_id=2,type=all,bucket=output:10
2029 group group_id=3,type=all,bucket=output:10
2030 flow in_port=1 actions=group:2,output:5
2031 flow in_port=2 actions=group:1,write_actions(group:2,group:3,output:6)
2032 flow in_port=3 actions=group:3,group:1,write_actions(group:2,output:3)
2033 flow in_port=4 actions=output:4
2034 flow in_port=5 actions=write_actions(output:4,group:3)
2035 flow in_port=6 actions=group:1
2037 AT_CHECK([ovs-ofctl bundle br0 bundle.txt])
2040 AT_DATA([flows.txt], [dnl
2041 in_port=1 actions=group:2,output:5
2042 in_port=2 actions=group:1,write_actions(group:2,group:3,output:6)
2043 in_port=3 actions=group:3,group:1,write_actions(group:2,output:3)
2044 in_port=4 actions=output:4
2045 in_port=5 actions=write_actions(output:4,group:3)
2046 in_port=6 actions=group:1
2049 (cat flows.txt; echo 'OFPST_FLOW reply (OF1.4):') > expout
2050 AT_CHECK([ovs-ofctl -O OpenFlow14 dump-flows br0 | ofctl_strip | sort], [0],
2053 (grep 'output:3' flows.txt | grep 'group:2'; echo 'OFPST_FLOW reply (OF1.4):') > expout
2054 AT_CHECK([ovs-ofctl -O OpenFlow14 dump-flows br0 out_port=3,out_group=2 | ofctl_strip | sort], [0], [expout])
2056 AT_CHECK([ovs-ofctl -O OpenFlow14 del-flows br0 out_group=2])
2057 (grep -v 'group:2' flows.txt; echo 'OFPST_FLOW reply (OF1.4):') > expout
2058 AT_CHECK([ovs-ofctl -O OpenFlow14 dump-flows br0 | ofctl_strip | sort], [0],
2061 AT_CHECK([ovs-ofctl -O OpenFlow14 del-flows br0 out_group=3])
2062 (grep -v 'group:[[23]]' flows.txt; echo 'OFPST_FLOW reply (OF1.4):') > expout
2063 AT_CHECK([ovs-ofctl -O OpenFlow14 dump-flows br0 | ofctl_strip | sort], [0],
2066 AT_CHECK([ovs-ofctl -O OpenFlow14 del-flows br0 out_group=1])
2067 (grep -v 'group:[[123]]' flows.txt; echo 'OFPST_FLOW reply (OF1.4):') > expout
2068 AT_CHECK([ovs-ofctl -O OpenFlow14 dump-flows br0 | ofctl_strip | sort], [0],
2074 AT_SETUP([ofproto - bundle packet-out (OpenFlow 1.4)])
2077 ovs-ofctl del-flows br0
2078 ovs-ofctl add-flow br0 priority=0,actions=drop
2080 # Start a monitor listening for packet-ins.
2081 AT_CHECK([ovs-ofctl -P standard monitor br0 --detach --no-chdir --pidfile])
2082 ovs-appctl -t ovs-ofctl ofctl/send 0109000c0123456700000080
2083 ovs-appctl -t ovs-ofctl ofctl/barrier
2084 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
2085 AT_CAPTURE_FILE([monitor.log])
2087 # This bundle adds a group, a flow using that group and then a
2088 # packet-out that needs them both. Finally the bundle deletes all
2089 # groups, which also deletes the flow, leaving only the drop flow in
2090 # the table. If this works properly, the packet-out should get
2091 # translated and processed before the flow disappears. Also, if the
2092 # bundle were to fail, the packet-in should not get executed.
2093 AT_DATA([bundle.txt], [dnl
2094 group group_id=1,type=all,bucket=output:controller
2095 flow in_port=6 actions=group:1
2096 packet-out in_port=6, packet=0001020304050010203040501234 actions=table
2099 AT_CHECK([ovs-ofctl bundle br0 bundle.txt])
2101 # Verify that only the drop flow remains.
2102 AT_CHECK([ovs-ofctl -O OpenFlow14 dump-flows br0 | ofctl_strip | sort], [0],
2103 [ reset_counts priority=0 actions=drop
2104 OFPST_FLOW reply (OF1.4):
2107 # Verify that the packet-in was received via controller action.
2108 AT_CHECK([sed 's/ (xid=0x[[1-9a-fA-F]][[0-9a-fA-F]]*)//' monitor.log], [0],
2109 [OFPT_PACKET_IN (xid=0x0): total_len=14 in_port=6 (via action) data_len=14 (unbuffered)
2110 vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1234
2116 AT_SETUP([ofproto - bundle packet-out, failing bundle commit (OpenFlow 1.4)])
2119 ovs-ofctl del-flows br0
2120 ovs-ofctl add-flow br0 priority=0,actions=drop
2122 # Start a monitor listening for packet-ins.
2123 AT_CHECK([ovs-ofctl -P standard monitor br0 --detach --no-chdir --pidfile])
2124 ovs-appctl -t ovs-ofctl ofctl/send 0109000c0123456700000080
2125 ovs-appctl -t ovs-ofctl ofctl/barrier
2126 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
2127 AT_CAPTURE_FILE([monitor.log])
2129 # This bundle adds a flow using that group and then a packet-out that
2130 # needs them both. Finally the bundle adds another flow that referes
2131 # to a non-existing group, causing the bundle to fail, and the
2132 # packet-in should not get executed.
2133 AT_DATA([bundle.txt], [dnl
2134 group group_id=1,type=all,bucket=output:controller
2135 flow in_port=6 actions=group:1
2136 packet-out in_port=6, packet=0001020304050010203040501234 actions=table
2137 flow in_port=7 actions=group:2
2139 AT_CHECK([ovs-ofctl bundle br0 bundle.txt 2>&1 | sed '/talking to/,$d' | strip_xids], [], [dnl
2140 Error OFPBAC_BAD_OUT_GROUP for: OFPT_FLOW_MOD (OF1.4): ADD in_port=7 actions=group:2
2141 Error OFPBFC_MSG_FAILED for: OFPT_BUNDLE_CONTROL (OF1.4):
2142 bundle_id=0 type=COMMIT_REQUEST flags=atomic ordered
2145 # Verify that only the drop flow remains.
2146 AT_CHECK([ovs-ofctl -O OpenFlow14 dump-flows br0 | ofctl_strip | sort], [0],
2147 [ reset_counts priority=0 actions=drop
2148 OFPST_FLOW reply (OF1.4):
2151 # Verify that the packet-in was NOT received via controller action.
2152 AT_CHECK([strip_xids < monitor.log], [0], [])
2157 AT_SETUP([ofproto - bundle packet-out makes bundle commit to fail(OpenFlow 1.4)])
2160 ovs-ofctl del-flows br0
2161 ovs-ofctl add-flow br0 priority=0,actions=drop
2163 # Start a monitor listening for packet-ins.
2164 AT_CHECK([ovs-ofctl -P standard monitor br0 --detach --no-chdir --pidfile])
2165 ovs-appctl -t ovs-ofctl ofctl/send 0109000c0123456700000080
2166 ovs-appctl -t ovs-ofctl ofctl/barrier
2167 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
2168 AT_CAPTURE_FILE([monitor.log])
2170 # This bundle adds a flow using that group and then a packet-out that
2171 # needs them both. Finally the bundle adds another flow that referes
2172 # to a non-existing group, causing the bundle to fail, and the
2173 # packet-in should not get executed.
2174 AT_DATA([bundle.txt], [dnl
2175 group group_id=1,type=all,bucket=output:controller
2176 flow in_port=6 actions=group:1
2177 packet-out in_port=6, packet=0001020304050010203040501234 actions=table
2178 packet-out in_port=6, packet=0001020304050010203040501234 actions=group:2
2180 AT_CHECK([ovs-ofctl bundle br0 bundle.txt 2>&1 | sed '/talking to/,$d' | strip_xids], [], [dnl
2181 Error OFPBAC_BAD_OUT_GROUP for: OFPT_PACKET_OUT (OF1.4): in_port=6 actions=group:2 data_len=14
2182 vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1234
2183 Error OFPBFC_MSG_FAILED for: OFPT_BUNDLE_CONTROL (OF1.4):
2184 bundle_id=0 type=COMMIT_REQUEST flags=atomic ordered
2187 # Verify that only the drop flow remains.
2188 AT_CHECK([ovs-ofctl -O OpenFlow14 dump-flows br0 | ofctl_strip | sort], [0],
2189 [ reset_counts priority=0 actions=drop
2190 OFPST_FLOW reply (OF1.4):
2193 # Verify that the packet-in was NOT received via controller action.
2194 AT_CHECK([strip_xids < monitor.log], [0], [])
2199 AT_SETUP([ofproto - flow table configuration (OpenFlow 1.0)])
2201 # Check the default configuration.
2203 printf 'OFPST_TABLE reply (xid=0x2):
2205 active=0, lookup=0, matched=0
2208 exact match or wildcard: in_port eth_{src,dst,type} vlan_{vid,pcp} ip_{src,dst} nw_{proto,tos} tcp_{src,dst}
2212 (head_table; echo ' tables 1...253: ditto') > expout
2213 AT_CHECK([ovs-ofctl dump-tables br0], [0], [expout])
2214 # Change the configuration.
2217 -- --id=@t0 create Flow_Table name=main \
2218 -- --id=@t1 create Flow_Table flow-limit=1024 \
2219 -- set bridge br0 'flow_tables={1=@t1,0=@t0}' \
2224 # Check that the configuration was updated.
2225 (head_table ' ("main")'; echo ' table 1:
2226 active=0, lookup=0, matched=0
2231 active=0, lookup=0, matched=0
2234 '; echo ' tables 3...253: ditto') > expout
2235 AT_CHECK([ovs-ofctl dump-tables br0], [0], [expout])
2239 dnl In-band and fail-open add "hidden rules" to table 0. These rules shouldn't
2240 dnl be visible to OpenFlow. This test checks that "dump-flows" and
2241 dnl "dump-tables" don't make them visible.
2242 AT_SETUP([ofproto - hidden rules not in table stats])
2243 # Use an IP address for a controller that won't actually exist: we
2244 # want to create in-band rules but we do not want to actually connect
2245 # to a controller (because that could mess about with our test). The
2246 # Class E range 240.0.0.0 - 255.255.255.255 seems like a good choice.
2247 OVS_VSWITCHD_START([set-controller br0 tcp:240.0.0.1:6653])
2248 for i in 1 2 3 4 5; do ovs-appctl time/warp 1000; done
2250 # Check that no hidden flows are visible in OpenFlow.
2251 AT_CHECK([ovs-ofctl dump-flows br0 | strip_xids], [0], [NXST_FLOW reply:
2254 # Check that some hidden flows related to 240.0.0.1 are actually in table 0.
2256 # We discard flows that mention table_id because we only want table 0 flows,
2257 # which in OVS is implied by the absence of a table_id.
2258 AT_CHECK([ovs-appctl bridge/dump-flows br0], [0], [stdout])
2259 AT_CHECK([test `grep '240\.0\.0\.1' stdout | grep -v table_id= | wc -l` -gt 0])
2261 # Check that dump-tables doesn't count the hidden flows.
2263 printf 'OFPST_TABLE reply:
2265 active=0, lookup=0, matched=0
2268 exact match or wildcard: in_port eth_{src,dst,type} vlan_{vid,pcp} ip_{src,dst} nw_{proto,tos} tcp_{src,dst}
2272 (head_table; echo ' tables 1...253: ditto') > expout
2273 AT_CHECK([ovs-ofctl dump-tables br0 | strip_xids], [0], [expout])
2274 OVS_VSWITCHD_STOP(["/240\.0\.0\.1/d"])
2277 AT_SETUP([ofproto - flow table configuration (OpenFlow 1.2)])
2279 # Check the default configuration.
2281 printf 'OFPST_TABLE reply (OF1.2) (xid=0x2):
2283 active=0, lookup=0, matched=0
2284 metadata: match=0xffffffffffffffff write=0xffffffffffffffff
2287 instructions (table miss and others):
2288 instructions: apply_actions clear_actions write_actions write_metadata goto_table
2289 Write-Actions and Apply-Actions features:
2290 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
2291 supported on Set-Field: metadata in_port_oxm eth_{src,dst} vlan_{vid,pcp} mpls_{label,tc} ip_{src,dst} ipv6_{src,dst,label} ip_dscp nw_ecn arp_{op,spa,tpa,sha,tha} tcp_{src,dst} udp_{src,dst} sctp_{src,dst} icmp_{type,code} icmpv6_{type,code} nd_{target,sll,tll}
2293 exact match or wildcard: metadata in_port_oxm eth_{src,dst,type} vlan_{vid,pcp} mpls_{label,tc} ip_{src,dst} ipv6_{src,dst,label} nw_proto ip_dscp nw_ecn arp_{op,spa,tpa,sha,tha} tcp_{src,dst} udp_{src,dst} sctp_{src,dst} icmp_{type,code} icmpv6_{type,code} nd_{target,sll,tll}
2299 active=0, lookup=0, matched=0
2300 metadata: match=0xffffffffffffffff write=0xffffffffffffffff
2303 instructions (table miss and others):
2304 instructions: apply_actions clear_actions write_actions write_metadata
2309 (head_table; printf ' tables 1...252: ditto\n\n'; tail_table) > expout
2310 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-tables br0], [0], [expout])
2311 # Change the configuration.
2314 -- --id=@t0 create Flow_Table name=main \
2315 -- --id=@t1 create Flow_Table flow-limit=1024 \
2316 -- set bridge br0 'flow_tables={1=@t1,0=@t0}' \
2321 # Check that the configuration was updated.
2322 (head_table ' ("main")'; echo ' table 1:
2323 active=0, lookup=0, matched=0
2324 metadata: match=0xffffffffffffffff write=0xffffffffffffffff
2331 active=0, lookup=0, matched=0
2332 metadata: match=0xffffffffffffffff write=0xffffffffffffffff
2337 '; printf ' tables 3...252: ditto\n\n'; tail_table) > expout
2338 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-tables br0], [0], [expout])
2342 AT_SETUP([ofproto - table features (OpenFlow 1.3)])
2346 metadata: match=0xffffffffffffffff write=0xffffffffffffffff
2348 instructions (table miss and others):
2350 instructions: meter apply_actions clear_actions write_actions write_metadata goto_table
2351 Write-Actions and Apply-Actions features:
2352 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
2353 supported on Set-Field: tun_{id,src,dst,ipv6_{src,dst},flags,gbp_{id,flags},erspan_{idx,ver,dir,hwid},metadata0...metadata63} metadata in_{port,port_oxm} pkt_mark ct_{mark,label} reg0...reg15 xreg0...xreg7 xxreg0...xxreg3 eth_{src,dst} vlan_{tci,vid,pcp} mpls_{label,tc,ttl} ip_{src,dst} ipv6_{src,dst,label} nw_tos ip_dscp nw_{ecn,ttl} arp_{op,spa,tpa,sha,tha} tcp_{src,dst} udp_{src,dst} sctp_{src,dst} icmp_{type,code} icmpv6_{type,code} nd_{target,sll,tll,reserved,options_type} nsh_{flags,spi,si,c1...c4,ttl}
2355 arbitrary mask: dp_hash tun_{id,src,dst,ipv6_{src,dst},flags,gbp_{id,flags},erspan_{idx,ver,dir,hwid},gtpu_{flags,msgtype},metadata0...metadata63} metadata pkt_mark ct_{state,mark,label,nw_{src,dst},ipv6_{src,dst},tp_{src,dst}} reg0...reg15 xreg0...xreg7 xxreg0...xxreg3 eth_{src,dst} vlan_{tci,vid} ip_{src,dst} ipv6_{src,dst,label} ip_frag arp_{spa,tpa,sha,tha} tcp_{src,dst,flags} udp_{src,dst} sctp_{src,dst} nd_{target,sll,tll} nsh_{flags,c1...c4}
2356 exact match or wildcard: recirc_id packet_type conj_id in_{port,port_oxm} actset_output ct_{zone,nw_proto} eth_type vlan_pcp mpls_{label,tc,bos,ttl} nw_{proto,tos} ip_dscp nw_{ecn,ttl} arp_op icmp_{type,code} icmpv6_{type,code} nd_{reserved,options_type} nsh_{mdtype,np,spi,si,ttl}
2362 metadata: match=0xffffffffffffffff write=0xffffffffffffffff
2364 instructions (table miss and others):
2365 instructions: meter apply_actions clear_actions write_actions write_metadata
2371 printf ' tables 1...252: ditto\n\n'
2372 tail_tables) > expout
2373 AT_CHECK([ovs-ofctl -O OpenFlow13 dump-table-features br0], [0], [expout])
2374 # Change the configuration.
2377 -- --id=@t0 create Flow_Table name=main \
2378 -- --id=@t1 create Flow_Table flow-limit=1024 \
2379 -- set bridge br0 'flow_tables={1=@t1,0=@t0}' \
2384 # Check that the configuration was updated.
2385 (head_table ' ("main")'
2387 metadata: match=0xffffffffffffffff write=0xffffffffffffffff
2393 metadata: match=0xffffffffffffffff write=0xffffffffffffffff
2398 tables 3...252: ditto
2400 tail_tables) > expout
2401 AT_CHECK([ovs-ofctl -O OpenFlow13 dump-table-features br0], [0], [expout])
2405 AT_SETUP([ofproto - flow table names])
2407 add_of_ports br0 1 2
2409 # Set a table name via OpenFlow 1.3 and one via OpenFlow 1.5.
2410 AT_CHECK([ovs-ofctl -O OpenFlow13 mod-table br0 0 name:xyzzy])
2411 AT_CHECK([ovs-ofctl -O OpenFlow15 mod-table br0 1 name:quux])
2412 AT_CHECK([ovs-ofctl -O OpenFlow15 dump-table-features br0 |grep '^ table'],
2415 table 1 ("quux"): ditto
2416 tables 2...252: ditto
2420 # Set some table names via OVSDB.
2423 -- --id=@t0 create Flow_Table name=zero \
2424 -- --id=@t1 create Flow_Table name=one \
2425 -- --id=@t2 create Flow_Table name=two \
2426 -- set bridge br0 'flow_tables={0=@t0,1=@t1,2=@t2}' \
2432 AT_CHECK([ovs-ofctl -O OpenFlow15 dump-table-features br0 |grep '^ table'],
2435 table 1 ("one"): ditto
2436 table 2 ("two"): ditto
2437 tables 3...252: ditto
2441 # Check that flow table parsing and dumping uses the names.
2442 AT_DATA([flows.txt], [dnl
2443 table=zero in_port=p2 actions=p1,resubmit(,one)
2444 table=one,in_port=p1,ip,actions=ct(table=two)
2445 table=one,in_port=p1,arp,actions=goto_table(two)
2447 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
2448 AT_CHECK([ovs-ofctl --names --no-stats dump-flows br0], [0], [dnl
2449 table=zero, in_port=p2 actions=output:p1,resubmit(,one)
2450 table=one, ip,in_port=p1 actions=ct(table=two)
2451 table=one, arp,in_port=p1 actions=resubmit(,two)
2453 AT_CHECK([ovs-ofctl --no-names --no-stats dump-flows br0], [0], [dnl
2454 in_port=2 actions=output:1,resubmit(,1)
2455 table=1, ip,in_port=1 actions=ct(table=2)
2456 table=1, arp,in_port=1 actions=resubmit(,2)
2459 # Setting the same table names via OpenFlow 1.3 or OpenFlow 1.5 is a no-op.
2460 AT_CHECK([ovs-ofctl -O OpenFlow13 mod-table br0 0 name:zero])
2461 AT_CHECK([ovs-ofctl -O OpenFlow15 mod-table br0 1 name:one])
2462 AT_CHECK([ovs-ofctl -O OpenFlow15 dump-table-features br0 |grep '^ table'],
2465 table 1 ("one"): ditto
2466 table 2 ("two"): ditto
2467 tables 3...252: ditto
2471 # Setting different tables names via OpenFlow 1.3 or OpenFlow 1.5 yield errors.
2472 AT_CHECK([ovs-ofctl -O OpenFlow13 mod-table br0 0 name:xyzzy], 1, [], [stderr])
2473 AT_CHECK([head -1 stderr], [0], [OFPT_ERROR (OF1.3) (xid=0x5): OFPTFFC_EPERM
2475 AT_CHECK([ovs-ofctl -O OpenFlow15 mod-table br0 1 name:quux], 1, [], [stderr])
2476 AT_CHECK([head -1 stderr], [0], [OFPT_ERROR (OF1.5) (xid=0x5): OFPTFFC_EPERM
2479 # But we can still set table names for those not set via OVSDB.
2480 AT_CHECK([ovs-ofctl -O OpenFlow13 mod-table br0 3 name:three])
2481 AT_CHECK([ovs-ofctl -O OpenFlow15 dump-table-features br0 |grep '^ table'],
2484 table 1 ("one"): ditto
2485 table 2 ("two"): ditto
2486 table 3 ("three"): ditto
2487 tables 4...252: ditto
2491 # Unsetting names via OVSDB then setting them via OpenFlow works too.
2492 AT_CHECK([ovs-vsctl remove bridge br0 Flow_Table 2])
2493 AT_CHECK([ovs-ofctl -O OpenFlow15 dump-table-features br0 |grep '^ table'],
2496 table 1 ("one"): ditto
2498 table 3 ("three"): ditto
2499 tables 4...252: ditto
2502 AT_CHECK([ovs-ofctl -O OpenFlow13 mod-table br0 2 name:foobar])
2503 AT_CHECK([ovs-ofctl -O OpenFlow15 dump-table-features br0 |grep '^ table'],
2506 table 1 ("one"): ditto
2507 table 2 ("foobar"): ditto
2508 table 3 ("three"): ditto
2509 tables 4...252: ditto
2513 # We can clear names via OpenFlow, at least if they were set that way.
2514 AT_CHECK([ovs-ofctl -O OpenFlow13 mod-table br0 2 name:])
2515 AT_CHECK([ovs-ofctl -O OpenFlow15 dump-table-features br0 |grep '^ table'],
2518 table 1 ("one"): ditto
2520 table 3 ("three"): ditto
2521 tables 4...252: ditto
2528 AT_SETUP([ofproto - table description (OpenFlow 1.4)])
2531 while test $x -lt 254; do
2534 eviction=off eviction_flags=OTHER|IMPORTANCE|LIFETIME
2538 AT_CHECK([ovs-ofctl -O OpenFlow14 dump-table-desc br0 | sed '/^$/d
2539 /^OFPST_TABLE_DESC/d'], [0], [expout])
2541 # Change the configuration.
2542 AT_CHECK([ovs-ofctl -O Openflow14 mod-table br0 0 evict])
2543 # Check that the configuration was updated.
2544 mv expout orig-expout
2545 sed -e '2s/eviction=off/eviction=on/' <orig-expout > expout
2546 AT_CHECK([ovs-ofctl -O OpenFlow14 dump-table-desc br0 | sed '/^$/d
2547 /^OFPST_TABLE_DESC/d'], [0], [expout])
2549 AT_CHECK([ovs-ofctl -O Openflow14 mod-table br0 0 vacancy:20,80])
2550 # Check that the configuration was updated.
2551 mv expout orig-expout
2552 sed -e '3s/vacancy=off/vacancy=on vacancy_down=20% vacancy_up=80% vacancy=100%/' <orig-expout > expout
2553 AT_CHECK([ovs-ofctl -O OpenFlow14 dump-table-desc br0 | sed '/^$/d
2554 /^OFPST_TABLE_DESC/d'], [0], [expout])
2558 AT_SETUP([ofproto - hard limits on flow table size (OpenFlow 1.0)])
2560 # Configure a maximum of 4 flows.
2563 -- --id=@t0 create Flow_Table flow-limit=4 \
2564 -- set bridge br0 flow_tables:0=@t0 \
2569 for in_port in 1 2 3 4; do
2570 ovs-ofctl add-flow br0 in_port=$in_port,actions=drop
2572 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
2573 in_port=1 actions=drop
2574 in_port=2 actions=drop
2575 in_port=3 actions=drop
2576 in_port=4 actions=drop
2579 # Adding another flow will be refused.
2580 AT_CHECK([ovs-ofctl add-flow br0 in_port=5,actions=drop], [1], [], [stderr])
2581 AT_CHECK([ofctl_strip < stderr], [0],
2582 [OFPT_ERROR: OFPFMFC_TABLE_FULL
2583 OFPT_FLOW_MOD: ADD in_port=5 actions=drop
2585 # Also a mod-flow that would add a flow will be refused.
2586 AT_CHECK([ovs-ofctl mod-flows br0 in_port=5,actions=drop], [1], [], [stderr])
2587 AT_CHECK([ofctl_strip < stderr], [0],
2588 [OFPT_ERROR: OFPFMFC_TABLE_FULL
2589 OFPT_FLOW_MOD: MOD in_port=5 actions=drop
2591 # Replacing or modifying an existing flow is allowed.
2592 AT_CHECK([ovs-ofctl add-flow br0 in_port=4,actions=normal])
2593 AT_CHECK([ovs-ofctl mod-flows br0 in_port=3,actions=output:1])
2594 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
2595 in_port=1 actions=drop
2596 in_port=2 actions=drop
2597 in_port=3 actions=output:1
2598 in_port=4 actions=NORMAL
2604 AT_SETUP([ofproto - hard limits on flow table size (OpenFlow 1.2)])
2606 # Configure a maximum of 4 flows.
2609 -- --id=@t0 create Flow_Table flow-limit=4 \
2610 -- set bridge br0 flow_tables:0=@t0 \
2615 for in_port in 1 2 3 4; do
2616 ovs-ofctl -O OpenFlow12 add-flow br0 in_port=$in_port,actions=drop
2618 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
2619 in_port=1 actions=drop
2620 in_port=2 actions=drop
2621 in_port=3 actions=drop
2622 in_port=4 actions=drop
2623 OFPST_FLOW reply (OF1.2):
2625 # Adding another flow will be refused.
2626 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 in_port=5,actions=drop], [1], [], [stderr])
2627 AT_CHECK([ofctl_strip < stderr], [0],
2628 [OFPT_ERROR (OF1.2): OFPFMFC_TABLE_FULL
2629 OFPT_FLOW_MOD (OF1.2): ADD in_port=5 actions=drop
2631 # Replacing or modifying an existing flow is allowed.
2632 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 in_port=4,actions=normal])
2633 AT_CHECK([ovs-ofctl -O OpenFlow12 mod-flows br0 in_port=3,actions=output:1])
2634 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
2635 in_port=1 actions=drop
2636 in_port=2 actions=drop
2637 in_port=3 actions=output:1
2638 in_port=4 actions=NORMAL
2639 OFPST_FLOW reply (OF1.2):
2644 AT_SETUP([ofproto - eviction upon table overflow (OpenFlow 1.0)])
2646 # Configure a maximum of 4 flows.
2649 -- --id=@t0 create Flow_Table flow-limit=4 overflow-policy=evict \
2650 -- set bridge br0 flow_tables:0=@t0 \
2655 for in_port in 4 3 2 1; do
2656 ovs-ofctl add-flow br0 idle_timeout=${in_port}0,in_port=$in_port,actions=drop
2658 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
2659 idle_timeout=10, in_port=1 actions=drop
2660 idle_timeout=20, in_port=2 actions=drop
2661 idle_timeout=30, in_port=3 actions=drop
2662 idle_timeout=40, in_port=4 actions=drop
2665 # Adding another flow will cause the one that expires soonest to be evicted.
2666 AT_CHECK([ovs-ofctl add-flow br0 in_port=5,actions=drop])
2667 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
2668 idle_timeout=20, in_port=2 actions=drop
2669 idle_timeout=30, in_port=3 actions=drop
2670 idle_timeout=40, in_port=4 actions=drop
2671 in_port=5 actions=drop
2674 # A mod-flow that adds a flow also causes eviction, but replacing or
2675 # modifying an existing flow doesn't.
2676 AT_CHECK([ovs-ofctl mod-flows br0 in_port=6,actions=drop])
2677 AT_CHECK([ovs-ofctl add-flow br0 in_port=4,actions=normal])
2678 AT_CHECK([ovs-ofctl mod-flows br0 in_port=3,actions=output:1])
2679 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
2680 idle_timeout=30, in_port=3 actions=output:1
2681 in_port=4 actions=NORMAL
2682 in_port=5 actions=drop
2683 in_port=6 actions=drop
2686 # Flows with no timeouts at all cannot be evicted.
2687 AT_CHECK([ovs-ofctl add-flow br0 in_port=7,actions=normal])
2688 AT_CHECK([ovs-ofctl add-flow br0 in_port=8,actions=drop], [1], [], [stderr])
2689 AT_CHECK([ofctl_strip < stderr], [0],
2690 [OFPT_ERROR: OFPFMFC_TABLE_FULL
2691 OFPT_FLOW_MOD: ADD in_port=8 actions=drop
2693 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
2694 in_port=4 actions=NORMAL
2695 in_port=5 actions=drop
2696 in_port=6 actions=drop
2697 in_port=7 actions=NORMAL
2703 AT_SETUP([ofproto - eviction upon table overflow (OpenFlow 1.2)])
2705 # Configure a maximum of 4 flows.
2708 -- --id=@t0 create Flow_Table flow-limit=4 overflow-policy=evict \
2709 -- set bridge br0 flow_tables:0=@t0 \
2714 for in_port in 4 3 2 1; do
2715 ovs-ofctl -O OpenFlow12 add-flow br0 idle_timeout=${in_port}0,in_port=$in_port,actions=drop
2717 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
2718 idle_timeout=10, in_port=1 actions=drop
2719 idle_timeout=20, in_port=2 actions=drop
2720 idle_timeout=30, in_port=3 actions=drop
2721 idle_timeout=40, in_port=4 actions=drop
2722 OFPST_FLOW reply (OF1.2):
2724 # Adding another flow will cause the one that expires soonest to be evicted.
2725 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 in_port=5,actions=drop])
2726 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
2727 idle_timeout=20, in_port=2 actions=drop
2728 idle_timeout=30, in_port=3 actions=drop
2729 idle_timeout=40, in_port=4 actions=drop
2730 in_port=5 actions=drop
2731 OFPST_FLOW reply (OF1.2):
2733 # In OpenFlow 1.2 a mod-flow does not ever add a flow and thus
2734 # has no effect on eviction
2735 AT_CHECK([ovs-ofctl -O OpenFlow12 mod-flows br0 in_port=6,actions=drop])
2736 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 in_port=4,actions=normal])
2737 AT_CHECK([ovs-ofctl -O OpenFlow12 mod-flows br0 in_port=3,actions=output:1])
2738 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
2739 idle_timeout=20, in_port=2 actions=drop
2740 idle_timeout=30, in_port=3 actions=output:1
2741 in_port=4 actions=NORMAL
2742 in_port=5 actions=drop
2743 OFPST_FLOW reply (OF1.2):
2745 # Flows with no timeouts at all cannot be evicted.
2746 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 in_port=6,actions=drop])
2747 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 in_port=7,actions=normal])
2748 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 in_port=8,actions=drop], [1], [], [stderr])
2749 AT_CHECK([ofctl_strip < stderr], [0],
2750 [OFPT_ERROR (OF1.2): OFPFMFC_TABLE_FULL
2751 OFPT_FLOW_MOD (OF1.2): ADD in_port=8 actions=drop
2753 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
2754 in_port=4 actions=NORMAL
2755 in_port=5 actions=drop
2756 in_port=6 actions=drop
2757 in_port=7 actions=NORMAL
2758 OFPST_FLOW reply (OF1.2):
2763 AT_SETUP([ofproto - eviction using importance upon table overflow (OpenFlow 1.4)])
2765 # Configure a maximum of 4 flows.
2768 -- --id=@t0 create Flow_Table name=evict flow-limit=4 \
2769 -- set bridge br0 flow_tables:0=@t0 \
2773 # Use mod-table to turn on eviction just to demonstrate that it works.
2774 AT_CHECK([ovs-ofctl -O OpenFlow14 mod-table br0 0 evict])
2776 for in_port in 4 3 2 1; do
2777 ovs-ofctl -O Openflow14 add-flow br0 importance=$((in_port + 30)),priority=$((in_port + 5)),hard_timeout=$((in_port + 500)),actions=drop
2779 AT_CHECK([ovs-ofctl -O Openflow14 dump-flows br0 | ofctl_strip | sort], [0], [dnl
2780 hard_timeout=501, importance=31, priority=6 actions=drop
2781 hard_timeout=502, importance=32, priority=7 actions=drop
2782 hard_timeout=503, importance=33, priority=8 actions=drop
2783 hard_timeout=504, importance=34, priority=9 actions=drop
2784 OFPST_FLOW reply (OF1.4):
2786 # Adding another flow will cause the one with lowest importance to be evicted.
2787 AT_CHECK([ovs-ofctl -O Openflow14 add-flow br0 hard_timeout=505,importance=35,priority=10,in_port=2,actions=drop])
2788 AT_CHECK([ovs-ofctl -O Openflow14 dump-flows br0 | ofctl_strip | sort], [0], [dnl
2789 hard_timeout=502, importance=32, priority=7 actions=drop
2790 hard_timeout=503, importance=33, priority=8 actions=drop
2791 hard_timeout=504, importance=34, priority=9 actions=drop
2792 hard_timeout=505, importance=35, priority=10,in_port=2 actions=drop
2793 OFPST_FLOW reply (OF1.4):
2795 # Disable the Eviction configuration.
2796 AT_CHECK([ovs-ofctl -O OpenFlow14 mod-table br0 0 noevict])
2797 # Adding another flow will cause the system to give error for FULL TABLE.
2798 AT_CHECK([ovs-ofctl -O Openflow14 add-flow br0 hard_timeout=506,importance=36,priority=11,actions=drop],[1], [], [stderr])
2799 AT_CHECK([ofctl_strip < stderr], [0],
2800 [OFPT_ERROR (OF1.4): OFPFMFC_TABLE_FULL
2801 OFPT_FLOW_MOD (OF1.4): ADD priority=11 hard:506 importance:36 actions=drop
2803 #Dump flows. It should show only the old values
2804 AT_CHECK([ovs-ofctl -O Openflow14 dump-flows br0 | ofctl_strip | sort], [0], [dnl
2805 hard_timeout=502, importance=32, priority=7 actions=drop
2806 hard_timeout=503, importance=33, priority=8 actions=drop
2807 hard_timeout=504, importance=34, priority=9 actions=drop
2808 hard_timeout=505, importance=35, priority=10,in_port=2 actions=drop
2809 OFPST_FLOW reply (OF1.4):
2811 # mod-flow that would modify a flow will be done successfully.
2812 AT_CHECK([ovs-ofctl -O Openflow14 mod-flows br0 in_port=2,actions=NORMAL])
2813 AT_CHECK([ovs-ofctl -O Openflow14 dump-flows br0 | ofctl_strip | sort], [0], [dnl
2814 hard_timeout=502, importance=32, priority=7 actions=drop
2815 hard_timeout=503, importance=33, priority=8 actions=drop
2816 hard_timeout=504, importance=34, priority=9 actions=drop
2817 hard_timeout=505, importance=35, priority=10,in_port=2 actions=NORMAL
2818 OFPST_FLOW reply (OF1.4):
2820 # Also a mod-flow that would add a flow will be refused.
2821 AT_CHECK([ovs-ofctl mod-flows br0 in_port=5,actions=drop], [1], [], [stderr])
2822 AT_CHECK([ofctl_strip < stderr], [0],
2823 [OFPT_ERROR: OFPFMFC_TABLE_FULL
2824 OFPT_FLOW_MOD: MOD in_port=5 actions=drop
2829 AT_SETUP([ofproto - eviction upon table overflow, with fairness (OpenFlow 1.0)])
2831 # Configure a maximum of 4 flows.
2834 -- --id=@t0 create Flow_Table name=evict flow-limit=4 \
2835 overflow-policy=evict \
2836 groups='"NXM_OF_IN_PORT[[]]"' \
2837 -- set bridge br0 flow_tables:0=@t0 \
2842 ovs-ofctl add-flows br0 - <<EOF
2843 idle_timeout=10 in_port=2 dl_src=00:44:55:66:77:88 actions=drop
2844 idle_timeout=20 in_port=1 dl_src=00:11:22:33:44:55 actions=drop
2845 idle_timeout=30 in_port=1 dl_src=00:22:33:44:55:66 actions=drop
2846 idle_timeout=40 in_port=1 dl_src=00:33:44:55:66:77 actions=drop
2848 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
2849 idle_timeout=10, in_port=2,dl_src=00:44:55:66:77:88 actions=drop
2850 idle_timeout=20, in_port=1,dl_src=00:11:22:33:44:55 actions=drop
2851 idle_timeout=30, in_port=1,dl_src=00:22:33:44:55:66 actions=drop
2852 idle_timeout=40, in_port=1,dl_src=00:33:44:55:66:77 actions=drop
2855 # Adding another flow will cause the one that expires soonest within
2856 # the largest group (those with in_port=1) to be evicted. In this
2857 # case this is not the same as the one that expires soonest overall
2858 # (which is what makes the test interesting):
2859 AT_CHECK([ovs-ofctl add-flow br0 in_port=2,dl_src=00:55:66:77:88:99,actions=drop])
2860 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
2861 idle_timeout=10, in_port=2,dl_src=00:44:55:66:77:88 actions=drop
2862 idle_timeout=30, in_port=1,dl_src=00:22:33:44:55:66 actions=drop
2863 idle_timeout=40, in_port=1,dl_src=00:33:44:55:66:77 actions=drop
2864 in_port=2,dl_src=00:55:66:77:88:99 actions=drop
2867 # Enlarge the flow limit, change the eviction policy back to strictly
2868 # based on expiration, and and add some flows.
2869 AT_CHECK([ovs-vsctl set Flow_Table evict groups='[[]]' flow-limit=7])
2870 ovs-ofctl add-flows br0 - <<EOF
2871 idle_timeout=50 in_port=2 dl_src=00:66:77:88:99:aa actions=drop
2872 idle_timeout=60 in_port=2 dl_src=00:77:88:99:aa:bb actions=drop
2873 idle_timeout=70 in_port=2 dl_src=00:88:99:aa:bb:cc actions=drop
2875 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
2876 idle_timeout=10, in_port=2,dl_src=00:44:55:66:77:88 actions=drop
2877 idle_timeout=30, in_port=1,dl_src=00:22:33:44:55:66 actions=drop
2878 idle_timeout=40, in_port=1,dl_src=00:33:44:55:66:77 actions=drop
2879 idle_timeout=50, in_port=2,dl_src=00:66:77:88:99:aa actions=drop
2880 idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=drop
2881 idle_timeout=70, in_port=2,dl_src=00:88:99:aa:bb:cc actions=drop
2882 in_port=2,dl_src=00:55:66:77:88:99 actions=drop
2885 # Adding another flow will cause the one that expires soonest overall
2887 AT_CHECK([ovs-ofctl add-flow br0 'idle_timeout=80 in_port=2 dl_src=00:99:aa:bb:cc:dd actions=drop'])
2888 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
2889 idle_timeout=30, in_port=1,dl_src=00:22:33:44:55:66 actions=drop
2890 idle_timeout=40, in_port=1,dl_src=00:33:44:55:66:77 actions=drop
2891 idle_timeout=50, in_port=2,dl_src=00:66:77:88:99:aa actions=drop
2892 idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=drop
2893 idle_timeout=70, in_port=2,dl_src=00:88:99:aa:bb:cc actions=drop
2894 idle_timeout=80, in_port=2,dl_src=00:99:aa:bb:cc:dd actions=drop
2895 in_port=2,dl_src=00:55:66:77:88:99 actions=drop
2898 # Reducing the flow limit also causes the flows that expire soonest
2899 # overall to be evicted.
2900 AT_CHECK([ovs-vsctl set Flow_Table evict flow-limit=4])
2901 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
2902 idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=drop
2903 idle_timeout=70, in_port=2,dl_src=00:88:99:aa:bb:cc actions=drop
2904 idle_timeout=80, in_port=2,dl_src=00:99:aa:bb:cc:dd actions=drop
2905 in_port=2,dl_src=00:55:66:77:88:99 actions=drop
2911 AT_SETUP([ofproto - eviction upon table overflow, with fairness (OpenFlow 1.2)])
2913 # Configure a maximum of 4 flows.
2916 -- --id=@t0 create Flow_Table name=evict flow-limit=4 \
2917 overflow-policy=evict \
2918 groups='"NXM_OF_IN_PORT[[]]"' \
2919 -- set bridge br0 flow_tables:0=@t0 \
2924 ovs-ofctl -O OpenFlow12 add-flows br0 - <<EOF
2925 idle_timeout=10 in_port=2 dl_src=00:44:55:66:77:88 actions=drop
2926 idle_timeout=20 in_port=1 dl_src=00:11:22:33:44:55 actions=drop
2927 idle_timeout=30 in_port=1 dl_src=00:22:33:44:55:66 actions=drop
2928 idle_timeout=40 in_port=1 dl_src=00:33:44:55:66:77 actions=drop
2930 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
2931 idle_timeout=10, in_port=2,dl_src=00:44:55:66:77:88 actions=drop
2932 idle_timeout=20, in_port=1,dl_src=00:11:22:33:44:55 actions=drop
2933 idle_timeout=30, in_port=1,dl_src=00:22:33:44:55:66 actions=drop
2934 idle_timeout=40, in_port=1,dl_src=00:33:44:55:66:77 actions=drop
2935 OFPST_FLOW reply (OF1.2):
2937 # Adding another flow will cause the one that expires soonest within
2938 # the largest group (those with in_port=1) to be evicted. In this
2939 # case this is not the same as the one that expires soonest overall
2940 # (which is what makes the test interesting):
2941 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 in_port=2,dl_src=00:55:66:77:88:99,actions=drop])
2942 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
2943 idle_timeout=10, in_port=2,dl_src=00:44:55:66:77:88 actions=drop
2944 idle_timeout=30, in_port=1,dl_src=00:22:33:44:55:66 actions=drop
2945 idle_timeout=40, in_port=1,dl_src=00:33:44:55:66:77 actions=drop
2946 in_port=2,dl_src=00:55:66:77:88:99 actions=drop
2947 OFPST_FLOW reply (OF1.2):
2949 # Enlarge the flow limit, change the eviction policy back to strictly
2950 # based on expiration, and and add some flows.
2951 AT_CHECK([ovs-vsctl set Flow_Table evict groups='[[]]' flow-limit=7])
2952 ovs-ofctl -O OpenFlow12 add-flows br0 - <<EOF
2953 idle_timeout=50 in_port=2 dl_src=00:66:77:88:99:aa actions=drop
2954 idle_timeout=60 in_port=2 dl_src=00:77:88:99:aa:bb actions=drop
2955 idle_timeout=70 in_port=2 dl_src=00:88:99:aa:bb:cc actions=drop
2957 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
2958 idle_timeout=10, in_port=2,dl_src=00:44:55:66:77:88 actions=drop
2959 idle_timeout=30, in_port=1,dl_src=00:22:33:44:55:66 actions=drop
2960 idle_timeout=40, in_port=1,dl_src=00:33:44:55:66:77 actions=drop
2961 idle_timeout=50, in_port=2,dl_src=00:66:77:88:99:aa actions=drop
2962 idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=drop
2963 idle_timeout=70, in_port=2,dl_src=00:88:99:aa:bb:cc actions=drop
2964 in_port=2,dl_src=00:55:66:77:88:99 actions=drop
2965 OFPST_FLOW reply (OF1.2):
2967 # Adding another flow will cause the one that expires soonest overall
2969 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'])
2970 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
2971 idle_timeout=30, in_port=1,dl_src=00:22:33:44:55:66 actions=drop
2972 idle_timeout=40, in_port=1,dl_src=00:33:44:55:66:77 actions=drop
2973 idle_timeout=50, in_port=2,dl_src=00:66:77:88:99:aa actions=drop
2974 idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=drop
2975 idle_timeout=70, in_port=2,dl_src=00:88:99:aa:bb:cc actions=drop
2976 idle_timeout=80, in_port=2,dl_src=00:99:aa:bb:cc:dd actions=drop
2977 in_port=2,dl_src=00:55:66:77:88:99 actions=drop
2978 OFPST_FLOW reply (OF1.2):
2980 # Reducing the flow limit also causes the flows that expire soonest
2981 # overall to be evicted.
2982 AT_CHECK([ovs-vsctl set Flow_Table evict flow-limit=4])
2983 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
2984 idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=drop
2985 idle_timeout=70, in_port=2,dl_src=00:88:99:aa:bb:cc actions=drop
2986 idle_timeout=80, in_port=2,dl_src=00:99:aa:bb:cc:dd actions=drop
2987 in_port=2,dl_src=00:55:66:77:88:99 actions=drop
2988 OFPST_FLOW reply (OF1.2):
2993 AT_SETUP([ofproto - eviction upon table overflow, with modified hard timeout])
2995 # Configure a maximum of 4 flows.
2998 -- --id=@t0 create Flow_Table flow-limit=4 overflow-policy=evict \
2999 -- set bridge br0 flow_tables:0=@t0 \
3003 ovs-appctl time/stop
3005 for in_port in 4 3 2 1; do
3006 ovs-ofctl add-flow br0 hard_timeout=$((10 + in_port * 3)),in_port=$in_port,actions=drop
3008 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
3009 hard_timeout=13, in_port=1 actions=drop
3010 hard_timeout=16, in_port=2 actions=drop
3011 hard_timeout=19, in_port=3 actions=drop
3012 hard_timeout=22, in_port=4 actions=drop
3015 # Sleep and modify the one that expires soonest
3016 ovs-appctl time/warp 5000
3017 AT_CHECK([ovs-ofctl mod-flows br0 in_port=1,actions=drop])
3018 # At this point the table would looks like:
3019 # in_port seconds to expire
3024 ovs-appctl time/warp 2000
3025 # Adding another flow will cause the one that expires soonest to be evicted.
3026 AT_CHECK([ovs-ofctl add-flow br0 in_port=5,actions=drop])
3027 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
3028 hard_timeout=13, in_port=1 actions=drop
3029 hard_timeout=19, in_port=3 actions=drop
3030 hard_timeout=22, in_port=4 actions=drop
3031 in_port=5 actions=drop
3037 AT_SETUP([ofproto - eviction upon table overflow, with modified idle timeout])
3038 OVS_VSWITCHD_START([add-port br0 p1 -- set interface p1 type=dummy ofport_request=1])
3039 # Configure a maximum of 4 flows.
3042 -- --id=@t0 create Flow_Table flow-limit=4 overflow-policy=evict \
3043 -- set bridge br0 flow_tables:0=@t0 \
3048 for in_port in 4 3 2 1; do
3049 ovs-ofctl add-flow br0 idle_timeout=$((10 + in_port * 3)),in_port=$in_port,actions=drop
3051 ovs-appctl time/stop
3052 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
3053 idle_timeout=13, in_port=1 actions=drop
3054 idle_timeout=16, in_port=2 actions=drop
3055 idle_timeout=19, in_port=3 actions=drop
3056 idle_timeout=22, in_port=4 actions=drop
3059 # Sleep and receive on the flow that expires soonest
3060 ovs-appctl time/warp 5000
3061 AT_CHECK([ovs-appctl netdev-dummy/receive p1 'in_port(1)'])
3062 # At this point the table would looks like:
3063 # in_port seconds to expire
3068 ovs-appctl time/warp 2000
3069 # Adding another flow will cause the one that expires soonest to be evicted.
3070 AT_CHECK([ovs-ofctl add-flow br0 in_port=5,actions=drop])
3071 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
3072 idle_timeout=19, in_port=3 actions=drop
3073 idle_timeout=22, in_port=4 actions=drop
3074 in_port=5 actions=drop
3075 n_packets=1, n_bytes=14, idle_timeout=13, in_port=1 actions=drop
3081 AT_SETUP([ofproto - asynchronous message control (OpenFlow 1.0)])
3082 OVS_VSWITCHD_START([set bridge br0 other_config:hwaddr=00:01:02:03:04:05])
3083 AT_CHECK([ovs-ofctl -P standard monitor br0 --detach --no-chdir --pidfile])
3085 printf '\n\n--- check_async %d ---\n\n\n' $1
3088 ovs-appctl -t ovs-ofctl ofctl/barrier
3089 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
3092 # OFPT_PACKET_IN, OFPR_ACTION (controller_id=0)
3093 ovs-ofctl -v packet-out br0 controller controller '0001020304050010203040501234'
3094 if test X"$1" = X"OFPR_ACTION"; then shift;
3095 echo >>expout "OFPT_PACKET_IN: total_len=14 in_port=CONTROLLER (via action) data_len=14 (unbuffered)
3096 vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1234"
3099 # OFPT_PACKET_IN, OFPR_NO_MATCH (controller_id=123)
3100 ovs-ofctl -v packet-out br0 controller 'controller(reason=no_match,id=123)' '0001020304050010203040501234'
3101 if test X"$1" = X"OFPR_NO_MATCH"; then shift;
3102 echo >>expout "OFPT_PACKET_IN: total_len=14 in_port=CONTROLLER (via no_match) data_len=14 (unbuffered)
3103 vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1234"
3106 # OFPT_PACKET_IN, OFPR_INVALID_TTL (controller_id=0)
3107 ovs-ofctl packet-out br0 "in_port=controller packet=002583dfb4000026b98cb0f908004500003eb7e200000011339bac11370dac100002d7730035002b8f6d86fb0100000100000000000006626c702d7873066e696369726103636f6d00000f00 actions=dec_ttl"
3108 if test X"$1" = X"OFPR_INVALID_TTL"; then shift;
3109 echo >>expout "OFPT_PACKET_IN: total_len=76 in_port=CONTROLLER (via invalid_ttl) data_len=76 (unbuffered)
3110 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"
3113 # OFPT_PORT_STATUS, OFPPR_ADD
3114 ovs-vsctl add-port br0 test -- set Interface test type=dummy ofport_request=1
3115 if test X"$1" = X"OFPPR_ADD"; then shift;
3116 echo >>expout "OFPT_PORT_STATUS: ADD: 1(test): addr:aa:55:aa:55:00:0x
3119 speed: 0 Mbps now, 0 Mbps max"
3122 # OFPT_PORT_STATUS, OFPPR_DELETE
3123 ovs-vsctl del-port br0 test
3124 if test X"$1" = X"OFPPR_DELETE"; then shift;
3125 echo >>expout "OFPT_PORT_STATUS: DEL: 1(test): addr:aa:55:aa:55:00:0x
3128 speed: 0 Mbps now, 0 Mbps max"
3131 # OFPT_FLOW_REMOVED, OFPRR_DELETE
3132 ovs-ofctl add-flow br0 send_flow_rem,actions=drop
3133 ovs-ofctl --strict del-flows br0 ''
3134 if test X"$1" = X"OFPRR_DELETE"; then shift;
3135 echo >>expout "OFPT_FLOW_REMOVED: reason=delete"
3137 AT_FAIL_IF([test X"$1" != X])
3139 OVS_WAIT_UNTIL([test `wc -l < "monitor.log"` -ge `wc -l < "expout"`])
3143 s/ (xid=0x[0-9a-fA-F]*)//
3145 s/00:0.$/00:0x/' < monitor.log]],
3149 # It's a service connection so initially there should be no async messages.
3152 # Set miss_send_len to 128, turning on packet-ins for our service connection.
3153 ovs-appctl -t ovs-ofctl ofctl/send 0109000c0123456700000080
3154 check_async 2 OFPR_ACTION OFPPR_ADD OFPPR_DELETE OFPRR_DELETE
3156 # Set miss_send_len to 128 and enable invalid_ttl.
3157 ovs-appctl -t ovs-ofctl ofctl/send 0109000c0123456700040080
3158 check_async 3 OFPR_ACTION OFPR_INVALID_TTL OFPPR_ADD OFPPR_DELETE OFPRR_DELETE
3160 # Become secondary, which should disable everything except port status.
3161 ovs-appctl -t ovs-ofctl ofctl/send 0104001400000002000023200000000a00000002
3162 check_async 4 OFPPR_ADD OFPPR_DELETE
3164 # Use NXT_SET_ASYNC_CONFIG to enable a patchwork of asynchronous messages.
3165 ovs-appctl -t ovs-ofctl ofctl/send 01040028000000020000232000000013000000020000000500000005000000020000000200000005
3166 check_async 5 OFPR_INVALID_TTL OFPPR_DELETE OFPRR_DELETE
3168 # Set controller ID 123.
3169 ovs-appctl -t ovs-ofctl ofctl/send 01040018000000030000232000000014000000000000007b
3170 check_async 6 OFPR_NO_MATCH OFPPR_DELETE OFPRR_DELETE
3172 # Restore controller ID 0.
3173 ovs-appctl -t ovs-ofctl ofctl/send 010400180000000300002320000000140000000000000000
3176 ovs-appctl -t ovs-ofctl ofctl/send 0104001400000002000023200000000a00000001
3177 check_async 7 OFPR_ACTION OFPPR_ADD
3179 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
3183 AT_SETUP([ofproto - asynchronous message control (OpenFlow 1.2)])
3185 AT_CHECK([ovs-ofctl -O OpenFlow12 -P standard monitor br0 --detach --no-chdir --pidfile])
3187 printf '\n\n--- check_async %d ---\n\n\n' $1
3191 ovs-appctl -t ovs-ofctl ofctl/barrier
3192 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
3195 # OFPT_PACKET_IN, OFPR_ACTION (controller_id=0)
3196 ovs-ofctl -O OpenFlow12 -v packet-out br0 none controller '0001020304050010203040501234'
3197 if test X"$1" = X"OFPR_ACTION"; then shift;
3198 echo >>expout "OFPT_PACKET_IN (OF1.2): total_len=14 in_port=ANY (via action) data_len=14 (unbuffered)
3199 vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1234"
3202 # OFPT_PACKET_IN, OFPR_NO_MATCH (controller_id=123)
3203 ovs-ofctl -O OpenFlow12 -v packet-out br0 none 'controller(reason=no_match,id=123)' '0001020304050010203040501234'
3204 if test X"$1" = X"OFPR_NO_MATCH"; then shift;
3205 echo >>expout "OFPT_PACKET_IN (OF1.2): total_len=14 in_port=ANY (via no_match) data_len=14 (unbuffered)
3206 vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1234"
3209 # OFPT_PACKET_IN, OFPR_INVALID_TTL (controller_id=0)
3210 ovs-ofctl -O OpenFlow12 packet-out br0 none dec_ttl '002583dfb4000026b98cb0f908004500003eb7e200000011339bac11370dac100002d7730035002b8f6d86fb0100000100000000000006626c702d7873066e696369726103636f6d00000f00'
3211 if test X"$1" = X"OFPR_INVALID_TTL"; then shift;
3212 echo >>expout "OFPT_PACKET_IN (OF1.2): total_len=76 in_port=ANY (via invalid_ttl) data_len=76 (unbuffered)
3213 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"
3216 # OFPT_PORT_STATUS, OFPPR_ADD
3217 ovs-vsctl add-port br0 test -- set Interface test type=dummy
3218 if test X"$1" = X"OFPPR_ADD"; then shift;
3219 echo >>expout "OFPT_PORT_STATUS (OF1.2): ADD: ${INDEX}(test): addr:aa:55:aa:55:00:0x
3222 speed: 0 Mbps now, 0 Mbps max
3223 OFPT_PORT_STATUS (OF1.2): MOD: ${INDEX}(test): addr:aa:55:aa:55:00:0x
3226 speed: 0 Mbps now, 0 Mbps max"
3229 # OFPT_PORT_STATUS, OFPPR_DELETE
3230 ovs-vsctl del-port br0 test
3231 if test X"$1" = X"OFPPR_DELETE"; then shift;
3232 echo >>expout "OFPT_PORT_STATUS (OF1.2): DEL: ${INDEX}(test): addr:aa:55:aa:55:00:0x
3235 speed: 0 Mbps now, 0 Mbps max"
3238 # OFPT_FLOW_REMOVED, OFPRR_DELETE
3239 ovs-ofctl -O OpenFlow12 add-flow br0 send_flow_rem,actions=drop
3240 ovs-ofctl -O OpenFlow12 --strict del-flows br0 ''
3241 if test X"$1" = X"OFPRR_DELETE"; then shift;
3242 echo >>expout "OFPT_FLOW_REMOVED (OF1.2): reason=delete table_id=0"
3244 AT_FAIL_IF([test X"$1" != X])
3246 OVS_WAIT_UNTIL([test `wc -l < "monitor.log"` -ge `wc -l < "expout"`])
3250 s/ (xid=0x[0-9a-fA-F]*)//
3252 s/00:0.$/00:0x/' < monitor.log]],
3256 # It's a service connection so initially there should be no async messages.
3259 # Set miss_send_len to 128, turning on packet-ins for our service connection.
3260 ovs-appctl -t ovs-ofctl ofctl/send 0309000c0123456700000080
3261 check_async 2 OFPR_ACTION OFPPR_ADD OFPPR_DELETE OFPRR_DELETE
3263 # Set miss_send_len to 128 and enable invalid_ttl.
3264 ovs-appctl -t ovs-ofctl ofctl/send 0309000c0123456700040080
3265 check_async 3 OFPR_ACTION OFPR_INVALID_TTL OFPPR_ADD OFPPR_DELETE OFPRR_DELETE
3267 # Become secondary (OF 1.2), which should disable everything except port status.
3268 ovs-appctl -t ovs-ofctl ofctl/send 031800180000000200000003000000000000000000000001
3269 check_async 4 OFPPR_ADD OFPPR_DELETE
3271 # Use NXT_SET_ASYNC_CONFIG to enable a patchwork of asynchronous messages.
3272 ovs-appctl -t ovs-ofctl ofctl/send 03040028000000020000232000000013000000020000000500000005000000020000000200000005
3273 check_async 5 OFPR_INVALID_TTL OFPPR_DELETE OFPRR_DELETE
3275 # Set controller ID 123.
3276 ovs-appctl -t ovs-ofctl ofctl/send 03040018000000030000232000000014000000000000007b
3277 check_async 6 OFPR_NO_MATCH OFPPR_DELETE OFPRR_DELETE
3279 # Restore controller ID 0.
3280 ovs-appctl -t ovs-ofctl ofctl/send 030400180000000300002320000000140000000000000000
3282 # Become primary (OF 1.2).
3283 ovs-appctl -t ovs-ofctl ofctl/send 031800180000000400000002000000000000000000000002
3284 check_async 7 OFPR_ACTION OFPPR_ADD
3286 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
3290 AT_SETUP([ofproto - asynchronous message control (OpenFlow 1.3)])
3291 OVS_VSWITCHD_START([dnl
3292 add-port br0 p1 -- set Interface p1 type=dummy ofport_request=10
3294 AT_CHECK([ovs-ofctl -O OpenFlow13 -P standard monitor br0 --detach --no-chdir --pidfile])
3296 printf '\n\n--- check_async %d ---\n\n\n' $1
3300 ovs-appctl -t ovs-ofctl ofctl/barrier
3301 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
3304 # OFPT_PACKET_IN, OFPR_ACTION (controller_id=0)
3305 # OFPR_ACTION_SET is treated as OFPR_ACTION in OpenFlow 1.3
3306 ovs-ofctl -O OpenFlow13 -v packet-out br0 none controller '0001020304050010203040501234'
3307 ovs-ofctl -O OpenFlow13 add-flow br0 'in_port=10 actions=write_actions(output(CONTROLLER))'
3308 ovs-appctl netdev-dummy/receive p1 'in_port(10),eth(src=00:10:20:30:40:50,dst=00:01:02:03:04:05),eth_type(0x1234)'
3309 if test X"$1" = X"OFPR_ACTION"; then shift;
3310 echo >>expout "OFPT_PACKET_IN (OF1.3): total_len=14 in_port=ANY (via action) data_len=14 (unbuffered)
3311 vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1234"
3312 echo >>expout "OFPT_PACKET_IN (OF1.3): cookie=0x0 total_len=14 in_port=10 (via action) data_len=14 (unbuffered)
3313 vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1234"
3316 # OFPT_PACKET_IN, OFPR_NO_MATCH (controller_id=123)
3317 ovs-ofctl -O OpenFlow13 -v packet-out br0 none 'controller(reason=no_match,id=123)' '0001020304050010203040501234'
3318 if test X"$1" = X"OFPR_NO_MATCH"; then shift;
3319 echo >>expout "OFPT_PACKET_IN (OF1.3): total_len=14 in_port=ANY (via no_match) data_len=14 (unbuffered)
3320 vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1234"
3323 # OFPT_PACKET_IN, OFPR_INVALID_TTL (controller_id=0)
3324 ovs-ofctl -O OpenFlow13 packet-out br0 none dec_ttl '002583dfb4000026b98cb0f908004500003eb7e200000011339bac11370dac100002d7730035002b8f6d86fb0100000100000000000006626c702d7873066e696369726103636f6d00000f00'
3325 if test X"$1" = X"OFPR_INVALID_TTL"; then shift;
3326 echo >>expout "OFPT_PACKET_IN (OF1.3): total_len=76 in_port=ANY (via invalid_ttl) data_len=76 (unbuffered)
3327 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"
3330 # OFPT_PORT_STATUS, OFPPR_ADD
3331 ovs-vsctl add-port br0 test -- set Interface test type=dummy
3332 if test X"$1" = X"OFPPR_ADD"; then shift;
3333 echo >>expout "OFPT_PORT_STATUS (OF1.3): ADD: ${INDEX}(test): addr:aa:55:aa:55:00:0x
3336 speed: 0 Mbps now, 0 Mbps max
3337 OFPT_PORT_STATUS (OF1.3): MOD: ${INDEX}(test): addr:aa:55:aa:55:00:0x
3340 speed: 0 Mbps now, 0 Mbps max"
3343 # OFPT_PORT_STATUS, OFPPR_DELETE
3344 ovs-vsctl del-port br0 test
3345 if test X"$1" = X"OFPPR_DELETE"; then shift;
3346 echo >>expout "OFPT_PORT_STATUS (OF1.3): DEL: ${INDEX}(test): addr:aa:55:aa:55:00:0x
3349 speed: 0 Mbps now, 0 Mbps max"
3352 # OFPT_FLOW_REMOVED, OFPRR_DELETE
3353 ovs-ofctl -O OpenFlow13 add-flow br0 send_flow_rem,actions=drop
3354 ovs-ofctl -O OpenFlow13 --strict del-flows br0 ''
3355 if test X"$1" = X"OFPRR_DELETE"; then shift;
3356 echo >>expout "OFPT_FLOW_REMOVED (OF1.3): reason=delete table_id=0"
3359 # OFPT_FLOW_REMOVED, OFPRR_GROUP_DELETE
3360 ovs-ofctl -O OpenFlow13 add-group br0 group_id=1234,type=all,bucket=output:10
3361 ovs-ofctl -O OpenFlow13 add-flow br0 send_flow_rem,actions=group:1234
3362 ovs-ofctl -O OpenFlow13 --strict del-groups br0 group_id=1234
3363 if test X"$1" = X"OFPRR_GROUP_DELETE"; then shift;
3364 echo >>expout "OFPT_FLOW_REMOVED (OF1.3): reason=group_delete table_id=0"
3367 AT_FAIL_IF([test X"$1" != X])
3369 OVS_WAIT_UNTIL([test `wc -l < "monitor.log"` -ge `wc -l < "expout"`])
3373 s/ (xid=0x[0-9a-fA-F]*)//
3375 s/00:0.$/00:0x/' < monitor.log]],
3379 # It's a service connection so initially there should be no async messages.
3382 # Set miss_send_len to 128, turning on packet-ins for our service connection.
3383 ovs-appctl -t ovs-ofctl ofctl/send 0409000c0123456700000080
3384 check_async 2 OFPR_ACTION OFPPR_ADD OFPPR_DELETE OFPRR_DELETE OFPRR_GROUP_DELETE
3386 # Become secondary (OF 1.3), which should disable everything except port status.
3387 ovs-appctl -t ovs-ofctl ofctl/send 041800180000000200000003000000000000000000000001
3388 check_async 3 OFPPR_ADD OFPPR_DELETE
3390 # Use OF 1.3 OFPT_SET_ASYNC to enable a patchwork of asynchronous messages.
3391 ovs-appctl -t ovs-ofctl ofctl/send 041c00200000000200000002000000050000000500000002000000020000000d
3392 check_async 4 OFPR_INVALID_TTL OFPPR_DELETE OFPRR_DELETE OFPRR_GROUP_DELETE
3394 # Set controller ID 123.
3395 ovs-appctl -t ovs-ofctl ofctl/send 04040018000000030000232000000014000000000000007b
3396 check_async 5 OFPR_NO_MATCH OFPPR_DELETE OFPRR_DELETE OFPRR_GROUP_DELETE
3398 # Restore controller ID 0.
3399 ovs-appctl -t ovs-ofctl ofctl/send 040400180000000300002320000000140000000000000000
3401 # Become primary (OF 1.3).
3402 ovs-appctl -t ovs-ofctl ofctl/send 041800180000000400000002000000000000000000000002
3403 check_async 6 OFPR_ACTION OFPPR_ADD
3405 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
3409 AT_SETUP([ofproto - asynchronous message control (OpenFlow 1.4)])
3410 OVS_VSWITCHD_START([dnl
3411 add-port br0 p1 -- set Interface p1 type=dummy ofport_request=10
3413 AT_CHECK([ovs-ofctl -O OpenFlow14 -P standard monitor br0 --detach --no-chdir --pidfile])
3415 echo ovs-appctl "$@"
3416 AT_CHECK([ovs-appctl "$@"], [0], [ignore], [ignore])
3419 echo ovs-ofctl --no-names "$@"
3420 AT_CHECK([ovs-ofctl --no-names "$@"])
3424 AT_CHECK([ovs-vsctl "$@"])
3427 printf '\n\n--- check_async %d ---\n\n\n' $1
3431 ovs_appctl -t ovs-ofctl ofctl/barrier
3432 ovs_appctl -t ovs-ofctl ofctl/set-output-file monitor.log
3435 # OFPT_PACKET_IN, OFPR_PACKET_OUT (controller_id=0)
3436 ovs_ofctl -O OpenFlow14 packet-out br0 none controller '0001020304050010203040501234'
3437 if test X"$1" = X"OFPR_PACKET_OUT"; then shift;
3438 echo >>expout "OFPT_PACKET_IN (OF1.4): total_len=14 in_port=ANY (via packet_out) data_len=14 (unbuffered)
3439 vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1234"
3442 # OFPT_PACKET_IN, OFPR_ACTION_SET (controller_id=0)
3443 ovs_ofctl -O OpenFlow14 add-flow br0 'in_port=10 actions=write_actions(output(CONTROLLER))'
3444 ovs_appctl netdev-dummy/receive p1 'in_port(10),eth(src=00:10:20:30:40:50,dst=00:01:02:03:04:05),eth_type(0x1234)'
3445 if test X"$1" = X"OFPR_ACTION_SET"; then shift;
3446 echo >>expout "OFPT_PACKET_IN (OF1.4): cookie=0x0 total_len=14 in_port=10 (via action_set) data_len=14 (unbuffered)
3447 vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1234"
3450 # OFPT_PACKET_IN, OFPR_NO_MATCH (controller_id=123)
3451 ovs_ofctl -O OpenFlow14 packet-out br0 none 'controller(reason=no_match,id=123)' '0001020304050010203040501234'
3452 if test X"$1" = X"OFPR_NO_MATCH"; then shift;
3453 echo >>expout "OFPT_PACKET_IN (OF1.4): total_len=14 in_port=ANY (via no_match) data_len=14 (unbuffered)
3454 vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1234"
3457 # OFPT_PACKET_IN, OFPR_INVALID_TTL (controller_id=0)
3458 ovs_ofctl -O OpenFlow14 packet-out br0 none dec_ttl '002583dfb4000026b98cb0f908004500003eb7e200000011339bac11370dac100002d7730035002b8f6d86fb0100000100000000000006626c702d7873066e696369726103636f6d00000f00'
3459 if test X"$1" = X"OFPR_INVALID_TTL"; then shift;
3460 echo >>expout "OFPT_PACKET_IN (OF1.4): total_len=76 in_port=ANY (via invalid_ttl) data_len=76 (unbuffered)
3461 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"
3464 # OFPT_PORT_STATUS, OFPPR_ADD
3465 ovs_vsctl add-port br0 test -- set Interface test type=dummy
3466 if test X"$1" = X"OFPPR_ADD"; then shift;
3467 echo >>expout "OFPT_PORT_STATUS (OF1.4): ADD: ${INDEX}(test): addr:aa:55:aa:55:00:0x
3470 speed: 0 Mbps now, 0 Mbps max
3471 OFPT_PORT_STATUS (OF1.4): MOD: ${INDEX}(test): addr:aa:55:aa:55:00:0x
3474 speed: 0 Mbps now, 0 Mbps max"
3477 # OFPT_PORT_STATUS, OFPPR_MODIFY
3478 ovs_ofctl -O OpenFlow14 -vwarn mod-port br0 test down
3479 if test X"$1" = X"OFPPR_MODIFY"; then shift;
3480 echo >>expout "OFPT_PORT_STATUS (OF1.4): MOD: ${INDEX}(test): addr:aa:55:aa:55:00:0x
3483 speed: 0 Mbps now, 0 Mbps max
3484 OFPT_PORT_STATUS (OF1.4): MOD: ${INDEX}(test): addr:aa:55:aa:55:00:0x
3487 speed: 0 Mbps now, 0 Mbps max"
3490 # OFPT_PORT_STATUS, OFPPR_DELETE
3491 ovs_vsctl del-port br0 test
3492 if test X"$1" = X"OFPPR_DELETE"; then shift;
3493 echo >>expout "OFPT_PORT_STATUS (OF1.4): DEL: ${INDEX}(test): addr:aa:55:aa:55:00:0x
3496 speed: 0 Mbps now, 0 Mbps max"
3499 # OFPT_FLOW_REMOVED, OFPRR_DELETE
3500 ovs_ofctl -O OpenFlow14 add-flow br0 send_flow_rem,actions=drop
3501 ovs-ofctl -O OpenFlow14 dump-flows br0
3502 ovs_ofctl -O OpenFlow14 --strict del-flows br0 ''
3503 ovs-ofctl -O OpenFlow14 dump-flows br0
3504 if test X"$1" = X"OFPRR_DELETE"; then shift;
3505 echo >>expout "OFPT_FLOW_REMOVED (OF1.4): reason=delete table_id=0"
3508 # OFPT_FLOW_REMOVED, OFPRR_GROUP_DELETE
3509 ovs_ofctl -O OpenFlow14 add-group br0 group_id=1234,type=all,bucket=output:10
3510 ovs_ofctl -O OpenFlow14 add-flow br0 send_flow_rem,actions=group:1234
3511 ovs_ofctl -O OpenFlow14 --strict del-groups br0 group_id=1234
3512 if test X"$1" = X"OFPRR_GROUP_DELETE"; then shift;
3513 echo >>expout "OFPT_FLOW_REMOVED (OF1.4): reason=group_delete table_id=0"
3516 # OFPT_TABLE_STATUS, OFPTR_VACANCY_UP
3517 if test X"$1" = X"OFPTR_VACANCY_UP"; then shift;
3518 AT_CHECK([ovs-vsctl -- --id=@t1 create Flow_Table flow-limit=10 -- set bridge br0 flow_tables:1=@t1], [0], [ignore], [])
3520 # Turn on vacancy events, then add flows until we're full.
3521 # With initial vacancy of 100% and vacancy_up of 80%, so that
3522 # vacancy >= vacancy_up, this enables VACANY_DOWN events, so
3523 # we get a single such message when vacancy dips below 20%.
3524 ovs_ofctl -O OpenFlow14 mod-table br0 1 vacancy:20,80
3525 ovs_ofctl -O OpenFlow14 add-flow br0 table=1,in_port=1,actions=2
3526 ovs_ofctl -O OpenFlow14 add-flow br0 table=1,in_port=2,actions=2
3527 ovs_ofctl -O OpenFlow14 add-flow br0 table=1,in_port=3,actions=2
3528 ovs_ofctl -O OpenFlow14 add-flow br0 table=1,in_port=4,actions=2
3529 ovs_ofctl -O OpenFlow14 add-flow br0 table=1,in_port=5,actions=2
3530 ovs_ofctl -O OpenFlow14 add-flow br0 table=1,in_port=6,actions=2
3531 ovs_ofctl -O OpenFlow14 add-flow br0 table=1,in_port=7,actions=2
3532 ovs_ofctl -O OpenFlow14 add-flow br0 table=1,in_port=8,actions=2
3533 ovs_ofctl -O OpenFlow14 add-flow br0 table=1,in_port=9,actions=2
3534 ovs_ofctl -O OpenFlow14 add-flow br0 table=1,in_port=10,actions=2
3535 echo >>expout "OFPT_TABLE_STATUS (OF1.4): reason=VACANCY_DOWN
3538 eviction=off eviction_flags=OTHER|IMPORTANCE|LIFETIME
3539 vacancy=on vacancy_down=20% vacancy_up=80% vacancy=10%"
3540 # Then delete flows until we're empty. Sending the
3541 # VACANCY_DOWN message enabled VACANCY_UP events, so we get a
3542 # single such message when vacancy rises above 80%.
3543 ovs_ofctl -O OpenFlow14 del-flows br0 table=1,in_port=1
3544 ovs_ofctl -O OpenFlow14 del-flows br0 table=1,in_port=2
3545 ovs_ofctl -O OpenFlow14 del-flows br0 table=1,in_port=3
3546 ovs_ofctl -O OpenFlow14 del-flows br0 table=1,in_port=4
3547 ovs_ofctl -O OpenFlow14 del-flows br0 table=1,in_port=5
3548 ovs_ofctl -O OpenFlow14 del-flows br0 table=1,in_port=6
3549 ovs_ofctl -O OpenFlow14 del-flows br0 table=1,in_port=7
3550 ovs_ofctl -O OpenFlow14 del-flows br0 table=1,in_port=8
3551 ovs_ofctl -O OpenFlow14 del-flows br0 table=1,in_port=9
3552 ovs_ofctl -O OpenFlow14 del-flows br0 table=1,in_port=10
3553 echo >>expout "OFPT_TABLE_STATUS (OF1.4): reason=VACANCY_UP
3556 eviction=off eviction_flags=OTHER|IMPORTANCE|LIFETIME
3557 vacancy=on vacancy_down=20% vacancy_up=80% vacancy=90%"
3559 # Now approach vacancy from the other direction. First
3560 # disable vacancy events. With initial vacancy of 70%, so
3561 # that vacancy < vacancy_up, this enables VACANCY_UP events.
3562 # That means that filling up the table generates no message,
3563 # but deleting all the flows generates VACANCY_UP at the point
3564 # vacancy rises above 80%.
3565 ovs_ofctl -O OpenFlow14 mod-table br0 1 novacancy
3566 ovs_ofctl -O OpenFlow14 add-flow br0 table=1,in_port=1,actions=2
3567 ovs_ofctl -O OpenFlow14 add-flow br0 table=1,in_port=2,actions=2
3568 ovs_ofctl -O OpenFlow14 add-flow br0 table=1,in_port=3,actions=2
3569 ovs_ofctl -O OpenFlow14 mod-table br0 1 vacancy:20,80
3570 ovs_ofctl -O OpenFlow14 add-flow br0 table=1,in_port=4,actions=2
3571 ovs_ofctl -O OpenFlow14 add-flow br0 table=1,in_port=5,actions=2
3572 ovs_ofctl -O OpenFlow14 add-flow br0 table=1,in_port=6,actions=2
3573 ovs_ofctl -O OpenFlow14 add-flow br0 table=1,in_port=7,actions=2
3574 ovs_ofctl -O OpenFlow14 add-flow br0 table=1,in_port=8,actions=2
3575 ovs_ofctl -O OpenFlow14 add-flow br0 table=1,in_port=9,actions=2
3576 ovs_ofctl -O OpenFlow14 add-flow br0 table=1,in_port=10,actions=2
3577 ovs_ofctl -O OpenFlow14 del-flows br0 table=1,in_port=1
3578 ovs_ofctl -O OpenFlow14 del-flows br0 table=1,in_port=2
3579 ovs_ofctl -O OpenFlow14 del-flows br0 table=1,in_port=3
3580 ovs_ofctl -O OpenFlow14 del-flows br0 table=1,in_port=4
3581 ovs_ofctl -O OpenFlow14 del-flows br0 table=1,in_port=5
3582 ovs_ofctl -O OpenFlow14 del-flows br0 table=1,in_port=6
3583 ovs_ofctl -O OpenFlow14 del-flows br0 table=1,in_port=7
3584 ovs_ofctl -O OpenFlow14 del-flows br0 table=1,in_port=8
3585 ovs_ofctl -O OpenFlow14 del-flows br0 table=1,in_port=9
3586 ovs_ofctl -O OpenFlow14 del-flows br0 table=1,in_port=10
3587 echo >>expout "OFPT_TABLE_STATUS (OF1.4): reason=VACANCY_UP
3590 eviction=off eviction_flags=OTHER|IMPORTANCE|LIFETIME
3591 vacancy=on vacancy_down=20% vacancy_up=80% vacancy=90%"
3594 AT_FAIL_IF([test X"$1" != X])
3598 s/ (xid=0x[[0-9a-fA-F]]*)//
3600 s/00:0.$/00:0x/' < monitor.log
3603 OVS_WAIT_UNTIL([test `wc -l < "monitor.log"` -ge `wc -l < "expout"`],
3604 [normalize_log | diff -u - expout])
3611 # It's a service connection so initially there should be no async messages.
3614 # Set miss_send_len to 128, turning on packet-ins for our service connection.
3615 ovs_appctl -t ovs-ofctl ofctl/send 0509000c0123456700000080
3616 check_async 2 OFPR_PACKET_OUT OFPR_ACTION_SET OFPPR_ADD OFPPR_MODIFY OFPPR_DELETE OFPRR_DELETE OFPRR_GROUP_DELETE
3618 # Become secondary (OF 1.4), which should disable everything except port status.
3619 ovs_appctl -t ovs-ofctl ofctl/send 051800180000000200000003000000000000000000000001
3620 check_async 3 OFPPR_ADD OFPPR_MODIFY OFPPR_DELETE
3622 # Use OF 1.4 OFPT_SET_ASYNC to enable a patchwork of asynchronous messages.
3623 ovs_appctl -t ovs-ofctl ofctl/send 051c0040000000020000000800000005000100080000002000020008000000020003000800000005000400080000001c00050008000000050008000800000018
3624 check_async 4 OFPR_INVALID_TTL OFPPR_DELETE OFPRR_DELETE OFPRR_GROUP_DELETE OFPTR_VACANCY_UP
3626 # Set controller ID 123.
3627 ovs_appctl -t ovs-ofctl ofctl/send 05040018000000030000232000000014000000000000007b
3628 check_async 5 OFPR_NO_MATCH OFPPR_DELETE OFPRR_DELETE OFPRR_GROUP_DELETE
3630 # Restore controller ID 0.
3631 ovs_appctl -t ovs-ofctl ofctl/send 050400180000000300002320000000140000000000000000
3633 # Become primary (OF 1.4).
3634 ovs_appctl -t ovs-ofctl ofctl/send 051800180000000400000002000000000000000000000002
3635 check_async 6 OFPR_PACKET_OUT OFPPR_ADD OFPPR_MODIFY OFPRR_DELETE
3637 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
3641 AT_SETUP([ofproto - asynchronous message control (OpenFlow 1.5)])
3643 AT_CHECK([ovs-ofctl -O OpenFlow15 -P standard monitor br0 --detach --no-chdir --pidfile])
3645 printf '\n\n--- check_async %d ---\n\n\n' $1
3649 ovs-appctl -t ovs-ofctl ofctl/barrier
3650 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
3653 # Other tests are not working with OF 1.5, and message
3654 # format may change, so leave them out.
3656 # OFPT_PORT_STATUS, OFPPR_ADD
3657 ovs-vsctl add-port br0 test -- set Interface test type=dummy
3658 if test X"$1" = X"OFPPR_ADD"; then shift;
3659 echo >>expout "OFPT_PORT_STATUS (OF1.5): ADD: ${INDEX}(test): addr:aa:55:aa:55:00:0x
3662 speed: 0 Mbps now, 0 Mbps max
3663 OFPT_PORT_STATUS (OF1.5): MOD: ${INDEX}(test): addr:aa:55:aa:55:00:0x
3666 speed: 0 Mbps now, 0 Mbps max"
3669 # OFPT_PORT_STATUS, OFPPR_MODIFY
3670 ovs-ofctl -O OpenFlow15 -vwarn mod-port br0 test down
3671 if test X"$1" = X"OFPPR_MODIFY"; then shift;
3672 echo >>expout "OFPT_PORT_STATUS (OF1.5): MOD: ${INDEX}(test): addr:aa:55:aa:55:00:0x
3675 speed: 0 Mbps now, 0 Mbps max
3676 OFPT_PORT_STATUS (OF1.5): MOD: ${INDEX}(test): addr:aa:55:aa:55:00:0x
3679 speed: 0 Mbps now, 0 Mbps max"
3682 # OFPT_PORT_STATUS, OFPPR_DELETE
3683 ovs-vsctl del-port br0 test
3684 if test X"$1" = X"OFPPR_DELETE"; then shift;
3685 echo >>expout "OFPT_PORT_STATUS (OF1.5): DEL: ${INDEX}(test): addr:aa:55:aa:55:00:0x
3688 speed: 0 Mbps now, 0 Mbps max"
3691 AT_FAIL_IF([test X"$1" != X])
3693 OVS_WAIT_UNTIL([test `wc -l < "monitor.log"` -ge `wc -l < "expout"`])
3697 s/ (xid=0x[0-9a-fA-F]*)//
3699 s/00:0.$/00:0x/' < monitor.log]],
3703 # It's a service connection so initially there should be no async messages.
3706 # If we don't set this, async messages are not received.
3707 # Set miss_send_len to 128, turning on packet-ins for our service connection.
3708 ovs-appctl -t ovs-ofctl ofctl/send 0609000c0123456700000080
3709 check_async 2 OFPPR_ADD OFPPR_MODIFY OFPPR_DELETE
3711 # Set-async has changed in OF 1.4 and is not yet implemented.
3713 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
3717 dnl This test checks that the role request/response messaging works
3718 dnl and that generation_id is handled properly.
3719 AT_SETUP([ofproto - controller role (OpenFlow 1.2)])
3721 on_exit 'kill `cat c1.pid c2.pid`'
3723 # Start two ovs-ofctl controller processes.
3724 AT_CAPTURE_FILE([monitor1.log])
3725 AT_CAPTURE_FILE([expout1])
3726 AT_CAPTURE_FILE([experr1])
3727 AT_CAPTURE_FILE([monitor2.log])
3728 AT_CAPTURE_FILE([expout2])
3729 AT_CAPTURE_FILE([experr2])
3731 AT_CHECK([ovs-ofctl -O OpenFlow12 monitor br0 --detach --no-chdir --pidfile=c$i.pid --unixctl=c$i])
3732 ovs-appctl -t `pwd`/c$i ofctl/barrier
3733 ovs-appctl -t `pwd`/c$i ofctl/set-output-file monitor$i.log
3737 # find out current role
3738 ovs-appctl -t `pwd`/c$i ofctl/send 031800180000000200000000000000000000000000000000
3739 echo >>experr$i "send: OFPT_ROLE_REQUEST (OF1.2): role=nochange"
3740 echo >>expout$i "OFPT_ROLE_REPLY (OF1.2): role=equal"
3743 # controller 1: Become secondary (generation_id is initially undefined, so
3744 # 2^63+2 should not be stale)
3745 ovs-appctl -t `pwd`/c1 ofctl/send 031800180000000300000003000000008000000000000002
3746 echo >>experr1 "send: OFPT_ROLE_REQUEST (OF1.2): role=secondary generation_id=9223372036854775810"
3747 echo >>expout1 "OFPT_ROLE_REPLY (OF1.2): role=secondary generation_id=9223372036854775810"
3749 # controller 2: Become primary.
3750 ovs-appctl -t `pwd`/c2 ofctl/send 031800180000000300000002000000008000000000000003
3751 echo >>experr2 "send: OFPT_ROLE_REQUEST (OF1.2): role=primary generation_id=9223372036854775811"
3752 echo >>expout2 "OFPT_ROLE_REPLY (OF1.2): role=primary generation_id=9223372036854775811"
3754 # controller 1: Try to become the primary using a stale generation ID
3755 ovs-appctl -t `pwd`/c1 ofctl/send 031800180000000400000002000000000000000000000003
3756 echo >>experr1 "send: OFPT_ROLE_REQUEST (OF1.2): role=primary generation_id=3"
3757 echo >>expout1 "OFPT_ERROR (OF1.2): OFPRRFC_STALE"
3758 echo >>expout1 "OFPT_ROLE_REQUEST (OF1.2): role=primary generation_id=3"
3760 # controller 1: Become primary using a valid generation ID
3761 ovs-appctl -t `pwd`/c1 ofctl/send 031800180000000500000002000000000000000000000001
3762 echo >>experr1 "send: OFPT_ROLE_REQUEST (OF1.2): role=primary generation_id=1"
3763 echo >>expout1 "OFPT_ROLE_REPLY (OF1.2): role=primary generation_id=1"
3766 ovs-appctl -t `pwd`/c$i ofctl/barrier
3767 echo >>expout$i "OFPT_BARRIER_REPLY (OF1.2):"
3773 AT_CHECK([grep -v '^send:' monitor$i.log | strip_xids], [0], [expout])
3775 AT_CHECK([grep '^send:' monitor$i.log | strip_xids], [0], [expout])
3780 dnl This test checks that the role request/response messaging works,
3781 dnl that generation_id is handled properly, and that role status update
3782 dnl messages are sent when a controller's role gets changed from primary
3784 AT_SETUP([ofproto - controller role (OpenFlow 1.4)])
3786 on_exit 'kill `cat c1.pid c2.pid`'
3788 # Start two ovs-ofctl controller processes.
3789 AT_CAPTURE_FILE([monitor1.log])
3790 AT_CAPTURE_FILE([expout1])
3791 AT_CAPTURE_FILE([experr1])
3792 AT_CAPTURE_FILE([monitor2.log])
3793 AT_CAPTURE_FILE([expout2])
3794 AT_CAPTURE_FILE([experr2])
3796 AT_CHECK([ovs-ofctl -O OpenFlow14 monitor br0 --detach --no-chdir --pidfile=c$i.pid --unixctl=c$i])
3797 ovs-appctl -t `pwd`/c$i ofctl/barrier
3798 ovs-appctl -t `pwd`/c$i ofctl/set-output-file monitor$i.log
3802 # find out current role
3803 ovs-appctl -t `pwd`/c$i ofctl/send 051800180000000200000000000000000000000000000000
3804 echo >>experr$i "send: OFPT_ROLE_REQUEST (OF1.4): role=nochange"
3805 echo >>expout$i "OFPT_ROLE_REPLY (OF1.4): role=equal"
3808 # controller 1: Become secondary (generation_id is initially undefined, so
3809 # 2^63+2 should not be stale)
3810 ovs-appctl -t `pwd`/c1 ofctl/send 051800180000000300000003000000008000000000000002
3811 echo >>experr1 "send: OFPT_ROLE_REQUEST (OF1.4): role=secondary generation_id=9223372036854775810"
3812 echo >>expout1 "OFPT_ROLE_REPLY (OF1.4): role=secondary generation_id=9223372036854775810"
3814 # controller 2: Become primary.
3815 ovs-appctl -t `pwd`/c2 ofctl/send 051800180000000300000002000000008000000000000003
3816 echo >>experr2 "send: OFPT_ROLE_REQUEST (OF1.4): role=primary generation_id=9223372036854775811"
3817 echo >>expout2 "OFPT_ROLE_REPLY (OF1.4): role=primary generation_id=9223372036854775811"
3819 # controller 1: Try to become the primary using a stale generation ID
3820 ovs-appctl -t `pwd`/c1 ofctl/send 051800180000000400000002000000000000000000000003
3821 echo >>experr1 "send: OFPT_ROLE_REQUEST (OF1.4): role=primary generation_id=3"
3822 echo >>expout1 "OFPT_ERROR (OF1.4): OFPRRFC_STALE"
3823 echo >>expout1 "OFPT_ROLE_REQUEST (OF1.4): role=primary generation_id=3"
3825 # controller 1: Become primary using a valid generation ID
3826 ovs-appctl -t `pwd`/c1 ofctl/send 051800180000000500000002000000000000000000000001
3827 echo >>experr1 "send: OFPT_ROLE_REQUEST (OF1.4): role=primary generation_id=1"
3828 echo >>expout1 "OFPT_ROLE_REPLY (OF1.4): role=primary generation_id=1"
3829 echo >>expout2 "OFPT_ROLE_STATUS (OF1.4): role=secondary generation_id=1 reason=primary_request"
3832 ovs-appctl -t `pwd`/c$i ofctl/barrier
3833 echo >>expout$i "OFPT_BARRIER_REPLY (OF1.4):"
3839 AT_CHECK([grep -v '^send:' monitor$i.log | strip_xids], [0], [expout])
3841 AT_CHECK([grep '^send:' monitor$i.log | strip_xids], [0], [expout])
3846 dnl This test checks that the role request/response messaging works,
3847 dnl that generation_id is handled properly, and that role status update
3848 dnl messages are sent when a controller's role gets changed from primary
3850 AT_SETUP([ofproto - controller role (OpenFlow 1.3)])
3852 on_exit 'kill `cat c1.pid c2.pid`'
3854 # Start two ovs-ofctl controller processes.
3855 AT_CAPTURE_FILE([monitor1.log])
3856 AT_CAPTURE_FILE([expout1])
3857 AT_CAPTURE_FILE([experr1])
3858 AT_CAPTURE_FILE([monitor2.log])
3859 AT_CAPTURE_FILE([expout2])
3860 AT_CAPTURE_FILE([experr2])
3862 AT_CHECK([ovs-ofctl -O OpenFlow13 monitor br0 --detach --no-chdir --pidfile=c$i.pid --unixctl=c$i])
3863 ovs-appctl -t `pwd`/c$i ofctl/barrier
3864 ovs-appctl -t `pwd`/c$i ofctl/set-output-file monitor$i.log
3868 # find out current role
3869 ovs-appctl -t `pwd`/c$i ofctl/send 041800180000000200000000000000000000000000000000
3870 echo >>experr$i "send: OFPT_ROLE_REQUEST (OF1.3): role=nochange"
3871 echo >>expout$i "OFPT_ROLE_REPLY (OF1.3): role=equal"
3874 # controller 1: Become secondary (generation_id is initially undefined, so
3875 # 2^63+2 should not be stale)
3876 ovs-appctl -t `pwd`/c1 ofctl/send 041800180000000300000003000000008000000000000002
3877 echo >>experr1 "send: OFPT_ROLE_REQUEST (OF1.3): role=secondary generation_id=9223372036854775810"
3878 echo >>expout1 "OFPT_ROLE_REPLY (OF1.3): role=secondary generation_id=9223372036854775810"
3880 # controller 2: Become primary.
3881 ovs-appctl -t `pwd`/c2 ofctl/send 041800180000000300000002000000008000000000000003
3882 echo >>experr2 "send: OFPT_ROLE_REQUEST (OF1.3): role=primary generation_id=9223372036854775811"
3883 echo >>expout2 "OFPT_ROLE_REPLY (OF1.3): role=primary generation_id=9223372036854775811"
3885 # controller 1: Try to become the primary using a stale generation ID
3886 ovs-appctl -t `pwd`/c1 ofctl/send 041800180000000400000002000000000000000000000003
3887 echo >>experr1 "send: OFPT_ROLE_REQUEST (OF1.3): role=primary generation_id=3"
3888 echo >>expout1 "OFPT_ERROR (OF1.3): OFPRRFC_STALE"
3889 echo >>expout1 "OFPT_ROLE_REQUEST (OF1.3): role=primary generation_id=3"
3891 # controller 1: Become primary using a valid generation ID
3892 ovs-appctl -t `pwd`/c1 ofctl/send 041800180000000500000002000000000000000000000001
3893 echo >>experr1 "send: OFPT_ROLE_REQUEST (OF1.3): role=primary generation_id=1"
3894 echo >>expout1 "OFPT_ROLE_REPLY (OF1.3): role=primary generation_id=1"
3895 echo >>expout2 "ONFT_ROLE_STATUS (OF1.3): role=secondary generation_id=1 reason=primary_request"
3898 ovs-appctl -t `pwd`/c$i ofctl/barrier
3899 echo >>expout$i "OFPT_BARRIER_REPLY (OF1.3):"
3905 AT_CHECK([grep -v '^send:' monitor$i.log | strip_xids], [0], [expout])
3907 AT_CHECK([grep '^send:' monitor$i.log | strip_xids], [0], [expout])
3912 dnl This test checks the Group and meter notifications when a group mod
3913 dnl command is sent from one controller and the reply is received by
3914 dnl other controllers.
3915 AT_SETUP([ofproto - requestforward (OpenFlow 1.4)])
3917 on_exit 'kill `cat c1.pid c2.pid c3.pid`'
3919 # Start two ovs-ofctl controller processes.
3920 AT_CAPTURE_FILE([monitor1.log])
3921 AT_CAPTURE_FILE([expout1])
3922 AT_CAPTURE_FILE([monitor2.log])
3923 AT_CAPTURE_FILE([expout2])
3924 AT_CAPTURE_FILE([monitor3.log])
3925 AT_CAPTURE_FILE([expout3])
3927 ovs-ofctl -O OpenFlow15 monitor br0 --detach --no-chdir --pidfile=c1.pid --unixctl=c1
3928 ovs-ofctl -O OpenFlow14 monitor br0 --detach --no-chdir --pidfile=c2.pid --unixctl=c2
3929 ovs-ofctl -O OpenFlow14 monitor br0 --detach --no-chdir --pidfile=c3.pid --unixctl=c3
3933 ovs-appctl -t `pwd`/c$i ofctl/barrier
3934 ovs-appctl -t `pwd`/c$i ofctl/set-output-file monitor$i.log
3938 printf '\n\n--- check_async %d ---\n\n\n' $1
3943 ovs-appctl -t `pwd`/c2 ofctl/send "050f0020000000020000000000000001 00100000 ffffffffffffffff 00000000"
3944 if test X"$1" = X"OFPGC_ADD"; then shift;
3945 echo >>expout2 "send: OFPT_GROUP_MOD (OF1.4):
3946 ADD group_id=1,type=all,bucket=actions=drop"
3947 echo >>expout1 "OFPT_REQUESTFORWARD (OF1.5): reason=group_mod
3948 ADD group_id=1,type=all,bucket=bucket_id:0,actions=drop"
3949 echo >>expout3 "OFPT_REQUESTFORWARD (OF1.4): reason=group_mod
3950 ADD group_id=1,type=all,bucket=actions=drop"
3954 ovs-appctl -t `pwd`/c2 ofctl/send "050f0020000000020001010000000001 00100000 ffffffffffffffff 00000000"
3955 if test X"$1" = X"OFPGC_MODIFY"; then shift;
3956 echo >>expout2 "send: OFPT_GROUP_MOD (OF1.4):
3957 MOD group_id=1,type=select,bucket=weight:0,actions=drop"
3958 echo >>expout1 "OFPT_REQUESTFORWARD (OF1.5): reason=group_mod
3959 MOD group_id=1,type=select,bucket=bucket_id:0,weight:0,actions=drop"
3960 echo >>expout3 "OFPT_REQUESTFORWARD (OF1.4): reason=group_mod
3961 MOD group_id=1,type=select,bucket=weight:0,actions=drop"
3964 ovs-appctl -t `pwd`/c1 ofctl/barrier
3965 echo >>expout1 "OFPT_BARRIER_REPLY (OF1.5):"
3966 ovs-appctl -t `pwd`/c2 ofctl/barrier
3967 echo >>expout2 "OFPT_BARRIER_REPLY (OF1.4):"
3968 ovs-appctl -t `pwd`/c3 ofctl/barrier
3969 echo >>expout3 "OFPT_BARRIER_REPLY (OF1.4):"
3976 s/ (xid=0x[0-9a-fA-F]*)//'< monitor$i.log]],
3981 # controller 1: Become secondary
3982 ovs-appctl -t `pwd`/c1 ofctl/send 061800180000000300000003000000008000000000000002
3984 # controller 2: Become primary
3985 ovs-appctl -t `pwd`/c2 ofctl/send 051800180000000300000002000000008000000000000003
3987 # controller 1: Become secondary
3988 ovs-appctl -t `pwd`/c3 ofctl/send 051800180000000300000003000000008000000000000004
3990 # controller 1: Enabled requestforward using set Asynchronous message
3991 ovs-appctl -t `pwd`/c1 ofctl/send 061c00280000000200000008000000050002000800000002000400080000001a000a000800000003
3993 # controller 2: Enabled requestforward using set Asynchronous message
3994 ovs-appctl -t `pwd`/c2 ofctl/send 051c002800000002000100080000000200030008000000050005000800000005000b000800000003
3996 # controller 1: Enabled requestforward using set Asynchronous message
3997 ovs-appctl -t `pwd`/c3 ofctl/send 051c00280000000200000008000000050002000800000002000400080000001a000a000800000003
3998 check_async 1 OFPGC_ADD OFPGC_MODIFY
4003 dnl This test checks the backwards compatibility of the NXT_REQUESTFORWARD
4004 dnl message type to OpenFlow 1.0, also relying on the Nicira Extensions:
4005 dnl NXT_GROUP_MOD, NXT_ROLE_REQUEST, and OFPRAW_NXT_SET_ASYNC_CONFIG2,
4006 dnl while also testing the functionality of the previous test.
4007 AT_SETUP([ofproto - NXT requestforward (OpenFlow 1.0)])
4009 on_exit 'kill `cat c1.pid c2.pid c3.pid`'
4011 # Start two ovs-ofctl controller processes.
4012 AT_CAPTURE_FILE([monitor1.log])
4013 AT_CAPTURE_FILE([expout1])
4014 AT_CAPTURE_FILE([monitor2.log])
4015 AT_CAPTURE_FILE([expout2])
4016 AT_CAPTURE_FILE([monitor3.log])
4017 AT_CAPTURE_FILE([expout3])
4019 ovs-ofctl -O OpenFlow10 monitor br0 --detach --no-chdir --pidfile=c1.pid --unixctl=c1
4020 ovs-ofctl -O OpenFlow10 monitor br0 --detach --no-chdir --pidfile=c2.pid --unixctl=c2
4021 ovs-ofctl -O OpenFlow10 monitor br0 --detach --no-chdir --pidfile=c3.pid --unixctl=c3
4025 ovs-appctl -t `pwd`/c$i ofctl/barrier
4026 ovs-appctl -t `pwd`/c$i ofctl/set-output-file monitor$i.log
4030 printf '\n\n--- check_async %d ---\n\n\n' $1
4035 # NXT_GROUP_MOD (xid=0x2):
4036 # ADD group_id=2271560481,type=select,selection_method=hash,selection_method_param=7,bucket=bucket_id:0,weight:100,watch_port:1,actions=output:1,bucket=bucket_id:1,weight:200,watch_port:2,actions=output:2,bucket=bucket_id:2,weight:200,watch_port:3,actions=output:3
4037 ovs-appctl -t `pwd`/c2 ofctl/send "01 04 00 a8 00 00 00 02 00 00 23 20 00 00 00 1f 00 00 01 00 87 65 43 21 00 60 00 00 ff ff ff ff 00 20 00 08 00 00 00 00 00 00 00 08 00 01 00 00 00 00 00 08 00 64 00 00 00 01 00 08 00 00 00 01 00 20 00 08 00 00 00 01 00 00 00 08 00 02 00 00 00 00 00 08 00 c8 00 00 00 01 00 08 00 00 00 02 00 20 00 08 00 00 00 02 00 00 00 08 00 03 00 00 00 00 00 08 00 c8 00 00 00 01 00 08 00 00 00 03 ff ff 00 28 00 00 15 40 00 00 00 01 00 00 00 00 68 61 73 68 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 07"
4038 if test X"$1" = X"OFPGC_ADD"; then shift;
4039 echo >>expout2 "send: NXT_GROUP_MOD:
4040 ADD group_id=2271560481,type=select,selection_method=hash,selection_method_param=7,bucket=bucket_id:0,weight:100,watch_port:1,actions=output:1,bucket=bucket_id:1,weight:200,watch_port:2,actions=output:2,bucket=bucket_id:2,weight:200,watch_port:3,actions=output:3"
4041 echo >>expout1 "NXT_REQUESTFORWARD: reason=group_mod
4042 ADD group_id=2271560481,type=select,selection_method=hash,selection_method_param=7,bucket=bucket_id:0,weight:100,watch_port:1,actions=output:1,bucket=bucket_id:1,weight:200,watch_port:2,actions=output:2,bucket=bucket_id:2,weight:200,watch_port:3,actions=output:3"
4043 echo >>expout3 "NXT_REQUESTFORWARD: reason=group_mod
4044 ADD group_id=2271560481,type=select,selection_method=hash,selection_method_param=7,bucket=bucket_id:0,weight:100,watch_port:1,actions=output:1,bucket=bucket_id:1,weight:200,watch_port:2,actions=output:2,bucket=bucket_id:2,weight:200,watch_port:3,actions=output:3"
4048 # NXT_GROUP_MOD (xid=0x2):
4049 # MOD group_id=2271560481,type=select,selection_method=hash,selection_method_param=7,bucket=bucket_id:0,weight:150,watch_port:1,actions=output:1,bucket=bucket_id:1,weight:150,watch_port:2,actions=output:2,bucket=bucket_id:2,weight:150,watch_port:3,actions=output:3
4050 ovs-appctl -t `pwd`/c2 ofctl/send "01 04 00 a8 00 00 00 02 00 00 23 20 00 00 00 1f 00 01 01 00 87 65 43 21 00 60 00 00 ff ff ff ff 00 20 00 08 00 00 00 00 00 00 00 08 00 01 00 00 00 00 00 08 00 96 00 00 00 01 00 08 00 00 00 01 00 20 00 08 00 00 00 01 00 00 00 08 00 02 00 00 00 00 00 08 00 96 00 00 00 01 00 08 00 00 00 02 00 20 00 08 00 00 00 02 00 00 00 08 00 03 00 00 00 00 00 08 00 96 00 00 00 01 00 08 00 00 00 03 ff ff 00 28 00 00 15 40 00 00 00 01 00 00 00 00 68 61 73 68 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 07"
4051 if test X"$1" = X"OFPGC_MODIFY"; then shift;
4052 echo >>expout2 "send: NXT_GROUP_MOD:
4053 MOD group_id=2271560481,type=select,selection_method=hash,selection_method_param=7,bucket=bucket_id:0,weight:150,watch_port:1,actions=output:1,bucket=bucket_id:1,weight:150,watch_port:2,actions=output:2,bucket=bucket_id:2,weight:150,watch_port:3,actions=output:3"
4054 echo >>expout1 "NXT_REQUESTFORWARD: reason=group_mod
4055 MOD group_id=2271560481,type=select,selection_method=hash,selection_method_param=7,bucket=bucket_id:0,weight:150,watch_port:1,actions=output:1,bucket=bucket_id:1,weight:150,watch_port:2,actions=output:2,bucket=bucket_id:2,weight:150,watch_port:3,actions=output:3"
4056 echo >>expout3 "NXT_REQUESTFORWARD: reason=group_mod
4057 MOD group_id=2271560481,type=select,selection_method=hash,selection_method_param=7,bucket=bucket_id:0,weight:150,watch_port:1,actions=output:1,bucket=bucket_id:1,weight:150,watch_port:2,actions=output:2,bucket=bucket_id:2,weight:150,watch_port:3,actions=output:3"
4060 ovs-appctl -t `pwd`/c1 ofctl/barrier
4061 echo >>expout1 "OFPT_BARRIER_REPLY:"
4062 ovs-appctl -t `pwd`/c2 ofctl/barrier
4063 echo >>expout2 "OFPT_BARRIER_REPLY:"
4064 ovs-appctl -t `pwd`/c3 ofctl/barrier
4065 echo >>expout3 "OFPT_BARRIER_REPLY:"
4072 s/ (xid=0x[0-9a-fA-F]*)//'< monitor$i.log]],
4077 # controller 1: Become secondary
4078 # NXT_ROLE_REQUEST (xid=0x3): role=secondary
4079 ovs-appctl -t `pwd`/c1 ofctl/send 0104001400000003000023200000000a00000002
4081 # controller 2: Become primary
4082 # NXT_ROLE_REQUEST (xid=0x3): role=primary
4083 ovs-appctl -t `pwd`/c2 ofctl/send 0104001400000003000023200000000a00000001
4085 # controller 1: Become secondary
4086 # NXT_ROLE_REQUEST (xid=0x3): role=secondary
4087 ovs-appctl -t `pwd`/c3 ofctl/send 0104001400000003000023200000000a00000002
4089 # controller 1: Enabled requestforward using OFPRAW_NXT_SET_ASYNC_CONFIG2
4090 ovs-appctl -t `pwd`/c1 ofctl/send 0104003000000002000023200000001b00000008000000050002000800000002000400080000001a000a000800000003
4092 # controller 2: Enabled requestforward using OFPRAW_NXT_SET_ASYNC_CONFIG2
4093 ovs-appctl -t `pwd`/c2 ofctl/send 0104003000000002000023200000001b000100080000000200030008000000050005000800000005000b000800000003
4095 # controller 1: Enabled requestforward using OFPRAW_NXT_SET_ASYNC_CONFIG2
4096 ovs-appctl -t `pwd`/c3 ofctl/send 0104003000000002000023200000001b00000008000000050002000800000002000400080000001a000a000800000003
4097 check_async 1 OFPGC_ADD OFPGC_MODIFY
4102 dnl This test checks the Group and meter notifications when a group mod
4103 dnl command is sent from one controller and the reply is received by
4104 dnl other controllers, using the ONF Extension for OF 1.3.
4105 AT_SETUP([ofproto - ONF requestforward (OpenFlow 1.3)])
4107 on_exit 'kill `cat c1.pid c2.pid c3.pid`'
4109 # Start two ovs-ofctl controller processes.
4110 AT_CAPTURE_FILE([monitor1.log])
4111 AT_CAPTURE_FILE([expout1])
4112 AT_CAPTURE_FILE([monitor2.log])
4113 AT_CAPTURE_FILE([expout2])
4114 AT_CAPTURE_FILE([monitor3.log])
4115 AT_CAPTURE_FILE([expout3])
4117 ovs-ofctl -O OpenFlow13 monitor br0 --detach --no-chdir --pidfile=c1.pid --unixctl=c1
4118 ovs-ofctl -O OpenFlow13 monitor br0 --detach --no-chdir --pidfile=c2.pid --unixctl=c2
4119 ovs-ofctl -O OpenFlow13 monitor br0 --detach --no-chdir --pidfile=c3.pid --unixctl=c3
4123 ovs-appctl -t `pwd`/c$i ofctl/barrier
4124 ovs-appctl -t `pwd`/c$i ofctl/set-output-file monitor$i.log
4128 printf '\n\n--- check_async %d ---\n\n\n' $1
4133 # OFPT_GROUP_MOD (OF1.3) (xid=0x2):
4134 # ADD group_id=1,type=all,bucket=actions=drop
4135 ovs-appctl -t `pwd`/c2 ofctl/send "040f0020000000020000000000000001 00100000 ffffffffffffffff 00000000"
4136 if test X"$1" = X"OFPGC_ADD"; then shift;
4137 echo >>expout2 "send: OFPT_GROUP_MOD (OF1.3):
4138 ADD group_id=1,type=all,bucket=actions=drop"
4139 echo >>expout1 "ONFT_REQUESTFORWARD (OF1.3): reason=group_mod
4140 ADD group_id=1,type=all,bucket=actions=drop"
4141 echo >>expout3 "ONFT_REQUESTFORWARD (OF1.3): reason=group_mod
4142 ADD group_id=1,type=all,bucket=actions=drop"
4146 # OFPT_GROUP_MOD (OF1.3) (xid=0x2):
4147 # MOD group_id=1,type=select,bucket=weight:0,actions=drop
4148 ovs-appctl -t `pwd`/c2 ofctl/send "040f0020000000020001010000000001 00100000 ffffffffffffffff 00000000"
4149 if test X"$1" = X"OFPGC_MODIFY"; then shift;
4150 echo >>expout2 "send: OFPT_GROUP_MOD (OF1.3):
4151 MOD group_id=1,type=select,bucket=weight:0,actions=drop"
4152 echo >>expout1 "ONFT_REQUESTFORWARD (OF1.3): reason=group_mod
4153 MOD group_id=1,type=select,bucket=weight:0,actions=drop"
4154 echo >>expout3 "ONFT_REQUESTFORWARD (OF1.3): reason=group_mod
4155 MOD group_id=1,type=select,bucket=weight:0,actions=drop"
4158 ovs-appctl -t `pwd`/c1 ofctl/barrier
4159 echo >>expout1 "OFPT_BARRIER_REPLY (OF1.3):"
4160 ovs-appctl -t `pwd`/c2 ofctl/barrier
4161 echo >>expout2 "OFPT_BARRIER_REPLY (OF1.3):"
4162 ovs-appctl -t `pwd`/c3 ofctl/barrier
4163 echo >>expout3 "OFPT_BARRIER_REPLY (OF1.3):"
4170 s/ (xid=0x[0-9a-fA-F]*)//'< monitor$i.log]],
4175 # controller 1: Become secondary
4176 # OFPT_ROLE_REQUEST (OF1.3) (xid=0x3): role=secondary
4177 ovs-appctl -t `pwd`/c1 ofctl/send 041800180000000300000003000000008000000000000002
4179 # controller 2: Become primary
4180 # OFPT_ROLE_REQUEST (OF1.3) (xid=0x3): role=primary
4181 ovs-appctl -t `pwd`/c2 ofctl/send 041800180000000300000002000000008000000000000003
4183 # controller 1: Become secondary
4184 # OFPT_ROLE_REQUEST (OF1.3) (xid=0x3): role=secondary
4185 ovs-appctl -t `pwd`/c3 ofctl/send 041800180000000300000003000000008000000000000004
4187 # controller 1: Enabled requestforward using OFPRAW_NXT_SET_ASYNC_CONFIG2 (necessary for OF1.3)
4188 ovs-appctl -t `pwd`/c1 ofctl/send 0404003000000002000023200000001b00000008000000050002000800000002000400080000001a000a000800000003
4190 # controller 2: Enabled requestforward using OFPRAW_NXT_SET_ASYNC_CONFIG2 (necessary for OF1.3)
4191 ovs-appctl -t `pwd`/c2 ofctl/send 0404003000000002000023200000001b000100080000000200030008000000050005000800000005000b000800000003
4193 # controller 1: Enabled requestforward using OFPRAW_NXT_SET_ASYNC_CONFIG2 (necessary for OF1.3)
4194 ovs-appctl -t `pwd`/c3 ofctl/send 0404003000000002000023200000001b00000008000000050002000800000002000400080000001a000a000800000003
4195 check_async 1 OFPGC_ADD OFPGC_MODIFY
4202 dnl This test checks that OFPT_PACKET_OUT accepts both OFPP_NONE (as
4203 dnl specified by OpenFlow 1.0) and OFPP_CONTROLLER (used by some
4204 dnl controllers despite the spec) as meaning a packet that was generated
4205 dnl by the controller.
4206 AT_SETUP([ofproto - packet-out from controller (OpenFlow 1.0)])
4210 # Start a monitor listening for packet-ins.
4211 AT_CHECK([ovs-ofctl -P standard monitor br0 --detach --no-chdir --pidfile])
4212 ovs-appctl -t ovs-ofctl ofctl/send 0109000c0123456700000080
4213 ovs-appctl -t ovs-ofctl ofctl/barrier
4214 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
4215 AT_CAPTURE_FILE([monitor.log])
4217 # Send some packet-outs with OFPP_NONE and OFPP_CONTROLLER (65533) as in_port.
4218 AT_CHECK([ovs-ofctl packet-out br0 "in_port=none packet=0001020304050010203040501234 actions=controller,1"])
4219 AT_CHECK([ovs-ofctl packet-out br0 "in_port=controller packet=0001020304050010203040505678 actions=controller,1"])
4221 # Stop the monitor and check its output.
4222 ovs-appctl -t ovs-ofctl ofctl/barrier
4223 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
4225 ovs-ofctl dump-ports br0
4227 AT_CHECK([sed 's/ (xid=0x[[0-9a-fA-F]]*)//' monitor.log], [0], [dnl
4228 OFPT_PACKET_IN: total_len=14 in_port=ANY (via action) data_len=14 (unbuffered)
4229 vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1234
4230 OFPT_PACKET_IN: total_len=14 in_port=CONTROLLER (via action) data_len=14 (unbuffered)
4231 vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x5678
4238 dnl This test checks that OFPT_PACKET_OUT accepts both OFPP_NONE (as
4239 dnl specified by OpenFlow 1.2) and OFPP_CONTROLLER (used by some
4240 dnl controllers despite the spec) as meaning a packet that was generated
4241 dnl by the controller.
4242 AT_SETUP([ofproto - packet-out from controller (OpenFlow 1.2)])
4245 # Start a monitor listening for packet-ins.
4246 AT_CHECK([ovs-ofctl -O OpenFlow12 -P standard monitor br0 --detach --no-chdir --pidfile])
4247 ovs-appctl -t ovs-ofctl ofctl/send 0309000c0123456700000080
4248 ovs-appctl -t ovs-ofctl ofctl/barrier
4249 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
4250 AT_CAPTURE_FILE([monitor.log])
4252 # Send some packet-outs with OFPP_NONE and OFPP_CONTROLLER (65533) as in_port.
4253 AT_CHECK([ovs-ofctl -O OpenFlow12 packet-out br0 none controller '0001020304050010203040501234'])
4254 AT_CHECK([ovs-ofctl -O OpenFlow12 packet-out br0 4294967293 controller '0001020304050010203040505678'])
4256 # Stop the monitor and check its output.
4257 ovs-appctl -t ovs-ofctl ofctl/barrier
4258 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
4260 AT_CHECK([sed 's/ (xid=0x[[0-9a-fA-F]]*)//' monitor.log], [0], [dnl
4261 OFPT_PACKET_IN (OF1.2): total_len=14 in_port=ANY (via action) data_len=14 (unbuffered)
4262 vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1234
4263 OFPT_PACKET_IN (OF1.2): total_len=14 in_port=CONTROLLER (via action) data_len=14 (unbuffered)
4264 vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x5678
4265 OFPT_BARRIER_REPLY (OF1.2):
4271 dnl This test checks that OFPT_PACKET_OUT accepts both OFPP_NONE (as
4272 dnl specified by OpenFlow 1.1) and OFPP_CONTROLLER (used by some
4273 dnl controllers despite the spec) as meaning a packet that was generated
4274 dnl by the controller.
4275 AT_SETUP([ofproto - packet-out from controller (OpenFlow 1.1)])
4278 # Start a monitor listening for packet-ins.
4279 AT_CHECK([ovs-ofctl -O OpenFlow11 -P standard monitor br0 --detach --no-chdir --pidfile])
4280 ovs-appctl -t ovs-ofctl ofctl/send 0209000c0123456700000080
4281 ovs-appctl -t ovs-ofctl ofctl/barrier
4282 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
4283 AT_CAPTURE_FILE([monitor.log])
4285 # Send some packet-outs with OFPP_NONE and OFPP_CONTROLLER as in_port.
4286 AT_CHECK([ovs-appctl -t ovs-ofctl ofctl/packet-out "in_port=none, packet=0001020304050010203040501234 actions=controller"])
4287 AT_CHECK([ovs-appctl -t ovs-ofctl ofctl/packet-out "in_port=controller packet=0001020304050010203040505678 actions=controller"])
4289 # Stop the monitor and check its output.
4290 ovs-appctl -t ovs-ofctl ofctl/barrier
4291 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
4293 AT_CHECK([sed 's/ (xid=0x[[0-9a-fA-F]]*)//
4294 /PACKET_OUT/d' monitor.log], [0], [dnl
4295 OFPT_PACKET_IN (OF1.1): total_len=14 in_port=ANY (via action) data_len=14 (unbuffered)
4296 vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1234
4297 OFPT_PACKET_IN (OF1.1): total_len=14 in_port=CONTROLLER (via action) data_len=14 (unbuffered)
4298 vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x5678
4299 OFPT_BARRIER_REPLY (OF1.1):
4305 AT_SETUP([ofproto - packet-out from controller (OpenFlow 1.5)])
4308 # Start a monitor listening for packet-ins.
4309 AT_CHECK([ovs-ofctl -O OpenFlow15 -P standard monitor br0 --detach --no-chdir --pidfile])
4310 ovs-appctl -t ovs-ofctl ofctl/send 0609000c0123456700000080
4311 ovs-appctl -t ovs-ofctl ofctl/barrier
4312 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
4313 AT_CAPTURE_FILE([monitor.log])
4315 # Send some packet-outs with OFPP_NONE and OFPP_CONTROLLER (65533) as in_port.
4316 AT_CHECK([ovs-ofctl -O OpenFlow15 packet-out br0 "in_port=none tun_id=0x11 metadata=0x22 packet=0001020304050010203040501234 actions=controller"])
4317 AT_CHECK([ovs-ofctl -O OpenFlow15 packet-out br0 "in_port=controller tun_id=0x11 metadata=0x33 packet=0001020304050010203040505678 actions=controller"])
4319 # Stop the monitor and check its output.
4320 ovs-appctl -t ovs-ofctl ofctl/barrier
4321 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
4323 AT_CHECK([sed 's/ (xid=0x[[0-9a-fA-F]]*)//' monitor.log], [0], [dnl
4324 OFPT_PACKET_IN (OF1.5): total_len=14 tun_id=0x11,metadata=0x22,in_port=ANY (via packet_out) data_len=14 (unbuffered)
4325 vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1234
4326 OFPT_PACKET_IN (OF1.5): total_len=14 tun_id=0x11,metadata=0x33,in_port=CONTROLLER (via packet_out) data_len=14 (unbuffered)
4327 vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x5678
4328 OFPT_BARRIER_REPLY (OF1.5):
4334 dnl This test checks that metadata and userdata are encoded in NXT_PACKET_IN2.
4335 AT_SETUP([ofproto - packet-out with metadata and userdata (NXT_PACKET_IN2)])
4338 # Start a monitor listening for packet-ins.
4339 AT_CHECK([ovs-ofctl -P nxt_packet_in2 monitor br0 --detach --no-chdir --pidfile])
4340 ovs-appctl -t ovs-ofctl ofctl/send 0109000c0123456700000080
4341 ovs-appctl -t ovs-ofctl ofctl/barrier
4342 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
4343 AT_CAPTURE_FILE([monitor.log])
4345 # Send a packet-out with a load action to set some metadata, and forward to controller
4346 AT_CHECK([ovs-ofctl packet-out br0 "in_port=controller packet=0001020304050010203040501234 actions=load(0xfafafafa5a5a5a5a->OXM_OF_METADATA[[0..63]]),load(0xaa->NXM_NX_PKT_MARK[[]]),controller(userdata=01.02.03.04.05)"])
4348 # Stop the monitor and check its output.
4349 ovs-appctl -t ovs-ofctl ofctl/barrier
4350 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
4352 AT_CHECK([sed 's/ (xid=0x[[0-9a-fA-F]]*)//' monitor.log], [0], [dnl
4353 NXT_PACKET_IN2: total_len=14 pkt_mark=0xaa,metadata=0xfafafafa5a5a5a5a,in_port=CONTROLLER (via action) data_len=14 (unbuffered)
4354 userdata=01.02.03.04.05
4355 vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1234
4362 dnl This test checks that 1.5 packet_out is properly encoded/decoded.
4363 AT_SETUP([ofproto - packet-out with set_field metadata (OpenFlow 1.5)])
4366 # Start a monitor listening for packet-ins.
4367 AT_CHECK([ovs-ofctl -P standard -O OpenFlow13 monitor br0 --detach --no-chdir --pidfile])
4368 ovs-appctl -t ovs-ofctl ofctl/send 0409000c0123456700000080
4369 ovs-appctl -t ovs-ofctl ofctl/barrier
4370 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
4371 AT_CAPTURE_FILE([monitor.log])
4373 # Send a packet-out with a couple of set-field action to set some metadata, and forward to controller
4374 AT_CHECK([ovs-ofctl -O OpenFlow15 packet-out br0 CONTROLLER 'set_field:0xfafafafa5a5a5a5a->metadata, controller' '0001020304050010203040501234'])
4376 # Stop the monitor and check its output.
4377 ovs-appctl -t ovs-ofctl ofctl/barrier
4378 ovs-appctl -t ovs-ofctl exit
4380 AT_CHECK([sed 's/ (xid=0x[[0-9a-fA-F]]*)//' monitor.log], [0], [dnl
4381 OFPT_PACKET_IN (OF1.3): total_len=14 metadata=0xfafafafa5a5a5a5a,in_port=CONTROLLER (via action) data_len=14 (unbuffered)
4382 vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1234
4383 OFPT_BARRIER_REPLY (OF1.3):
4389 dnl This test checks that packet_type PT_ETH is properly encoded/decoded in 1.5 packet_out.
4390 AT_SETUP([ofproto - packet-out with set_field metadata with packet_type PT_ETH (OpenFlow 1.5)])
4393 # Start a monitor listening for packet-ins.
4394 AT_CHECK([ovs-ofctl -P standard -O OpenFlow13 monitor br0 --detach --no-chdir --pidfile])
4395 ovs-appctl -t ovs-ofctl ofctl/send 0409000c0123456700000080
4396 ovs-appctl -t ovs-ofctl ofctl/barrier
4397 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
4398 AT_CAPTURE_FILE([monitor.log])
4400 # Send a packet-out with a couple of set-field action to set some metadata, and forward to controller
4401 AT_CHECK([ovs-ofctl -O OpenFlow15 packet-out br0 "in_port=controller packet=0001020304050010203040501234 packet_type(0,0x0) actions=set_field:0xfafafafa5a5a5a5a->metadata,controller"])
4403 # Stop the monitor and check its output.
4404 ovs-appctl -t ovs-ofctl ofctl/barrier
4405 ovs-appctl -t ovs-ofctl exit
4407 AT_CHECK([sed 's/ (xid=0x[[0-9a-fA-F]]*)//' monitor.log], [0], [dnl
4408 OFPT_PACKET_IN (OF1.3): total_len=14 metadata=0xfafafafa5a5a5a5a,in_port=CONTROLLER (via action) data_len=14 (unbuffered)
4409 vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1234
4410 OFPT_BARRIER_REPLY (OF1.3):
4416 dnl This test checks that packet_type PT_IPV4 is properly encoded/decoded in 1.5 packet_out.
4417 AT_SETUP([ofproto - packet-out with set_field metadata with packet_type PT_IPV4 on PTAP bridge (OpenFlow 1.5)])
4420 # Start a monitor listening for packet-ins.
4421 AT_CHECK([ovs-ofctl -P standard -O OpenFlow13 monitor br0 --detach --no-chdir --pidfile])
4422 ovs-appctl -t ovs-ofctl ofctl/send 0409000c0123456700000080
4423 ovs-appctl -t ovs-ofctl ofctl/barrier
4424 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
4425 AT_CAPTURE_FILE([monitor.log])
4427 # Send a packet-out with a couple of set-field action to set some metadata, and forward to controller
4428 AT_CHECK([ovs-ofctl -O OpenFlow15 packet-out br0 "in_port=controller packet=4500002012344000ff1155670a0000140a00001e006400c8000cea78ffffffff packet_type(1,0x800) actions=set_field:0xfafafafa5a5a5a5a->metadata,controller"])
4430 # Stop the monitor and check its output.
4431 ovs-appctl -t ovs-ofctl ofctl/barrier
4432 ovs-appctl -t ovs-ofctl exit
4434 AT_CHECK([sed 's/ (xid=0x[[0-9a-fA-F]]*)//' monitor.log], [0], [dnl
4435 OFPT_PACKET_IN (OF1.3): total_len=32 packet_type=(1,0x800),metadata=0xfafafafa5a5a5a5a,in_port=CONTROLLER (via action) data_len=32 (unbuffered)
4436 packet_type=(1,0x800),nw_src=10.0.0.20,nw_dst=10.0.0.30,nw_proto=17,nw_tos=0,nw_ecn=0,nw_ttl=255,tp_src=100,tp_dst=200 udp_csum:ea78
4437 OFPT_BARRIER_REPLY (OF1.3):
4443 dnl This test checks that metadata is encoded in packet_in structures,
4444 dnl supported by NXAST.
4445 AT_SETUP([ofproto - packet-out with metadata (NXM)])
4448 # Start a monitor listening for packet-ins.
4449 AT_CHECK([ovs-ofctl -P nxt_packet_in monitor br0 --detach --no-chdir --pidfile])
4450 ovs-appctl -t ovs-ofctl ofctl/send 0109000c0123456700000080
4451 ovs-appctl -t ovs-ofctl ofctl/barrier
4452 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
4453 AT_CAPTURE_FILE([monitor.log])
4455 # Send a packet-out with a load action to set some metadata, and forward to controller
4456 AT_CHECK([ovs-ofctl packet-out br0 "in_port=controller packet=0001020304050010203040501234 actions=load(0xfafafafa5a5a5a5a->OXM_OF_METADATA[[0..63]]),load(0xaa->NXM_NX_PKT_MARK[[]]),controller"])
4458 # Stop the monitor and check its output.
4459 ovs-appctl -t ovs-ofctl ofctl/barrier
4460 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
4462 AT_CHECK([sed 's/ (xid=0x[[0-9a-fA-F]]*)//' monitor.log], [0], [dnl
4463 NXT_PACKET_IN: total_len=14 pkt_mark=0xaa,metadata=0xfafafafa5a5a5a5a,in_port=CONTROLLER (via action) data_len=14 (unbuffered)
4464 vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1234
4471 dnl This test checks that metadata is encoded in packet_in structures,
4472 dnl supported by NXAST.
4473 AT_SETUP([ofproto - packet-out with metadata (OpenFlow 1.2)])
4476 # Start a monitor listening for packet-ins.
4477 AT_CHECK([ovs-ofctl -O OpenFlow12 -P standard monitor br0 --detach --no-chdir --pidfile])
4478 ovs-appctl -t ovs-ofctl ofctl/send 0309000c0123456700000080
4479 ovs-appctl -t ovs-ofctl ofctl/barrier
4480 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
4481 AT_CAPTURE_FILE([monitor.log])
4483 # Send a packet-out with a set-field action to set some metadata, and forward to controller
4484 AT_CHECK([ovs-ofctl -O OpenFlow12 packet-out br0 none 'set_field:0xfafafafa5a5a5a5a->metadata, controller' '0001020304050010203040501234'])
4486 # Stop the monitor and check its output.
4487 ovs-appctl -t ovs-ofctl ofctl/barrier
4488 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
4490 AT_CHECK([sed 's/ (xid=0x[[0-9a-fA-F]]*)//' monitor.log], [0], [dnl
4491 OFPT_PACKET_IN (OF1.2): total_len=14 metadata=0xfafafafa5a5a5a5a,in_port=ANY (via action) data_len=14 (unbuffered)
4492 vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1234
4493 OFPT_BARRIER_REPLY (OF1.2):
4499 dnl This test checks that metadata is encoded in packet_in structures,
4500 dnl supported by NXAST.
4501 AT_SETUP([ofproto - packet-out with metadata and dual set_field (OpenFlow 1.3)])
4504 # Start a monitor listening for packet-ins.
4505 AT_CHECK([ovs-ofctl -O OpenFlow13 -P standard monitor br0 --detach --no-chdir --pidfile])
4506 ovs-appctl -t ovs-ofctl ofctl/send 0409000c0123456700000080
4507 ovs-appctl -t ovs-ofctl ofctl/barrier
4508 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
4509 AT_CAPTURE_FILE([monitor.log])
4511 # Send a packet-out with a couple of set-field action to set some metadata, and forward to controller
4512 AT_CHECK([ovs-ofctl -O OpenFlow13 packet-out br0 none 'set_field:0xfafafafa5a5a5a5a->metadata, set_field:0x6b->metadata, controller' '0001020304050010203040501234'])
4514 # Stop the monitor and check its output.
4515 ovs-appctl -t ovs-ofctl ofctl/barrier
4516 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
4518 AT_CHECK([sed 's/ (xid=0x[[0-9a-fA-F]]*)//' monitor.log], [0], [dnl
4519 OFPT_PACKET_IN (OF1.3): total_len=14 metadata=0x6b,in_port=ANY (via action) data_len=14 (unbuffered)
4520 vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1234
4521 OFPT_BARRIER_REPLY (OF1.3):
4527 dnl This test checks that tunnel metadata is encoded in packet_in structures.
4528 AT_SETUP([ofproto - packet-out with tunnel metadata (OpenFlow 1.2)])
4531 # Start a monitor listening for packet-ins.
4532 AT_CHECK([ovs-ofctl -O OpenFlow12 -P standard monitor br0 --detach --no-chdir --pidfile])
4533 ovs-appctl -t ovs-ofctl ofctl/send 0309000c0123456700000080
4534 ovs-appctl -t ovs-ofctl ofctl/barrier
4535 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
4536 AT_CAPTURE_FILE([monitor.log])
4538 # Send a packet-out with set field actions to set some tunnel metadata, and forward to controller
4539 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'])
4541 # Stop the monitor and check its output.
4542 ovs-appctl -t ovs-ofctl ofctl/barrier
4543 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
4545 AT_CHECK([sed 's/ (xid=0x[[0-9a-fA-F]]*)//' monitor.log], [0], [dnl
4546 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)
4547 vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1234
4548 OFPT_BARRIER_REPLY (OF1.2):
4554 m4_divert_push([PREPARE_TESTS])
4555 # Sorts groups of lines that start with a space, without moving them
4556 # past the nearest line that does not start with a space.
4564 line = sys.stdin.readline()
4567 if line.startswith(" "):
4570 sys.stdout.write("".join(sorted(buffer)))
4571 sys.stdout.write(line)
4573 sys.stdout.write("".join(sorted(buffer)))
4577 m4_divert_pop([PREPARE_TESTS])
4579 AT_SETUP([ofproto - flow monitoring])
4580 AT_KEYWORDS([monitor])
4583 ovs-ofctl add-flow br0 in_port=0,dl_vlan=123,actions=output:1
4585 # Start a monitor watching the flow table and check the initial reply.
4586 ovs-ofctl monitor br0 watch: --detach --no-chdir --pidfile >monitor.log 2>&1
4587 AT_CAPTURE_FILE([monitor.log])
4588 ovs-appctl -t ovs-ofctl ofctl/barrier
4589 AT_CHECK([sed 's/ (xid=0x[[1-9a-fA-F]][[0-9a-fA-F]]*)//' monitor.log], [0],
4590 [NXST_FLOW_MONITOR reply:
4591 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=123 actions=output:1
4595 # Add, delete, and modify some flows and check the updates.
4596 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
4597 ovs-ofctl add-flow br0 in_port=0,dl_vlan=124,actions=output:2
4598 ovs-ofctl add-flow br0 in_port=0,dl_vlan=123,actions=output:5
4599 ovs-ofctl add-flow br0 in_port=0,dl_vlan=123,dl_vlan_pcp=0,actions=output:6
4600 ovs-ofctl add-flow br0 in_port=0,dl_vlan=123,dl_vlan_pcp=1,actions=output:7
4601 ovs-ofctl add-flow br0 in_port=0,dl_vlan=123,actions=output:8
4602 ovs-ofctl add-flow br0 in_port=0,dl_vlan=65535,dl_vlan_pcp=0,actions=output:9
4603 ovs-ofctl add-flow br0 in_port=0,dl_vlan=65535,dl_vlan_pcp=1,actions=output:10
4604 ovs-ofctl add-flow br0 in_port=0,dl_vlan=65535,actions=output:11
4605 ovs-ofctl add-flow br0 in_port=0,dl_vlan=8191,dl_vlan_pcp=0,actions=output:12
4606 ovs-ofctl add-flow br0 in_port=0,dl_vlan=8191,dl_vlan_pcp=1,actions=output:13
4607 ovs-ofctl add-flow br0 in_port=0,dl_vlan=8191,actions=output:14
4608 ovs-ofctl add-flow br0 in_port=0,dl_vlan=0,dl_vlan_pcp=0,actions=output:15
4609 ovs-ofctl add-flow br0 in_port=0,dl_vlan=0,dl_vlan_pcp=1,actions=output:16
4610 ovs-ofctl add-flow br0 in_port=0,dl_vlan=0,actions=output:17
4611 ovs-ofctl add-flow br0 in_port=0,dl_vlan=0,dl_vlan_pcp=0,actions=output:18
4612 ovs-ofctl add-flow br0 in_port=0,dl_vlan=0,dl_vlan_pcp=1,actions=output:19
4613 ovs-ofctl add-flow br0 in_port=0,dl_vlan=0,actions=output:20
4614 ovs-ofctl add-flow br0 in_port=0,dl_vlan_pcp=0,actions=output:21
4615 ovs-ofctl add-flow br0 in_port=0,dl_vlan_pcp=1,actions=output:22
4616 ovs-ofctl add-flow br0 in_port=0,actions=output:23
4617 ovs-ofctl mod-flows br0 dl_vlan=123,actions=output:3
4618 ovs-ofctl mod-flows br0 cookie=5,dl_vlan=123,actions=output:3
4619 ovs-ofctl del-flows br0 dl_vlan=123
4620 ovs-ofctl del-flows br0
4621 ovs-appctl -t ovs-ofctl ofctl/barrier
4622 AT_CHECK([sed 's/ (xid=0x[[1-9a-fA-F]][[0-9a-fA-F]]*)//' monitor.log | multiline_sort], [0],
4623 [NXST_FLOW_MONITOR reply (xid=0x0):
4624 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=124 actions=output:2
4625 NXST_FLOW_MONITOR reply (xid=0x0):
4626 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=123 actions=output:5
4627 NXST_FLOW_MONITOR reply (xid=0x0):
4628 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=123,dl_vlan_pcp=0 actions=output:6
4629 NXST_FLOW_MONITOR reply (xid=0x0):
4630 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=123,dl_vlan_pcp=1 actions=output:7
4631 NXST_FLOW_MONITOR reply (xid=0x0):
4632 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=123 actions=output:8
4633 NXST_FLOW_MONITOR reply (xid=0x0):
4634 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=0,dl_vlan_pcp=0 actions=output:9
4635 NXST_FLOW_MONITOR reply (xid=0x0):
4636 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=0,dl_vlan_pcp=1 actions=output:10
4637 NXST_FLOW_MONITOR reply (xid=0x0):
4638 event=ADDED table=0 cookie=0 in_port=0,vlan_tci=0x0000 actions=output:11
4639 NXST_FLOW_MONITOR reply (xid=0x0):
4640 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=4095,dl_vlan_pcp=0 actions=output:12
4641 NXST_FLOW_MONITOR reply (xid=0x0):
4642 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=4095,dl_vlan_pcp=1 actions=output:13
4643 NXST_FLOW_MONITOR reply (xid=0x0):
4644 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=4095 actions=output:14
4645 NXST_FLOW_MONITOR reply (xid=0x0):
4646 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=0,dl_vlan_pcp=0 actions=output:15
4647 NXST_FLOW_MONITOR reply (xid=0x0):
4648 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=0,dl_vlan_pcp=1 actions=output:16
4649 NXST_FLOW_MONITOR reply (xid=0x0):
4650 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=0 actions=output:17
4651 NXST_FLOW_MONITOR reply (xid=0x0):
4652 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=0,dl_vlan_pcp=0 actions=output:18
4653 NXST_FLOW_MONITOR reply (xid=0x0):
4654 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=0,dl_vlan_pcp=1 actions=output:19
4655 NXST_FLOW_MONITOR reply (xid=0x0):
4656 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=0 actions=output:20
4657 NXST_FLOW_MONITOR reply (xid=0x0):
4658 event=ADDED table=0 cookie=0 in_port=0,dl_vlan_pcp=0 actions=output:21
4659 NXST_FLOW_MONITOR reply (xid=0x0):
4660 event=ADDED table=0 cookie=0 in_port=0,dl_vlan_pcp=1 actions=output:22
4661 NXST_FLOW_MONITOR reply (xid=0x0):
4662 event=ADDED table=0 cookie=0 in_port=0 actions=output:23
4663 NXST_FLOW_MONITOR reply (xid=0x0):
4664 event=MODIFIED table=0 cookie=0 in_port=0,dl_vlan=123 actions=output:3
4665 event=MODIFIED table=0 cookie=0 in_port=0,dl_vlan=123,dl_vlan_pcp=0 actions=output:3
4666 event=MODIFIED table=0 cookie=0 in_port=0,dl_vlan=123,dl_vlan_pcp=1 actions=output:3
4667 NXST_FLOW_MONITOR reply (xid=0x0):
4668 event=MODIFIED table=0 cookie=0x5 in_port=0,dl_vlan=123 actions=output:3
4669 event=MODIFIED table=0 cookie=0x5 in_port=0,dl_vlan=123,dl_vlan_pcp=0 actions=output:3
4670 event=MODIFIED table=0 cookie=0x5 in_port=0,dl_vlan=123,dl_vlan_pcp=1 actions=output:3
4671 NXST_FLOW_MONITOR reply (xid=0x0):
4672 event=DELETED reason=delete table=0 cookie=0x5 in_port=0,dl_vlan=123 actions=output:3
4673 event=DELETED reason=delete table=0 cookie=0x5 in_port=0,dl_vlan=123,dl_vlan_pcp=0 actions=output:3
4674 event=DELETED reason=delete table=0 cookie=0x5 in_port=0,dl_vlan=123,dl_vlan_pcp=1 actions=output:3
4675 NXST_FLOW_MONITOR reply (xid=0x0):
4676 event=DELETED reason=delete table=0 cookie=0 in_port=0 actions=output:23
4677 event=DELETED reason=delete table=0 cookie=0 in_port=0,dl_vlan=0 actions=output:20
4678 event=DELETED reason=delete table=0 cookie=0 in_port=0,dl_vlan=0,dl_vlan_pcp=0 actions=output:18
4679 event=DELETED reason=delete table=0 cookie=0 in_port=0,dl_vlan=0,dl_vlan_pcp=1 actions=output:19
4680 event=DELETED reason=delete table=0 cookie=0 in_port=0,dl_vlan=124 actions=output:2
4681 event=DELETED reason=delete table=0 cookie=0 in_port=0,dl_vlan=4095 actions=output:14
4682 event=DELETED reason=delete table=0 cookie=0 in_port=0,dl_vlan=4095,dl_vlan_pcp=0 actions=output:12
4683 event=DELETED reason=delete table=0 cookie=0 in_port=0,dl_vlan=4095,dl_vlan_pcp=1 actions=output:13
4684 event=DELETED reason=delete table=0 cookie=0 in_port=0,dl_vlan_pcp=0 actions=output:21
4685 event=DELETED reason=delete table=0 cookie=0 in_port=0,dl_vlan_pcp=1 actions=output:22
4686 event=DELETED reason=delete table=0 cookie=0 in_port=0,vlan_tci=0x0000 actions=output:11
4690 # Check that our own changes are reported as full updates.
4691 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
4692 ovs-ofctl add-flow br0 in_port=1,actions=output:2
4693 ovs-ofctl add-flow br0 in_port=2,actions=output:1
4694 ovs-appctl -t ovs-ofctl ofctl/barrier
4695 ovs-appctl -t ovs-ofctl ofctl/send 010e004812345678003fffff00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003000000000000ffffffffffff0000
4696 ovs-appctl -t ovs-ofctl ofctl/barrier
4697 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip], [0], [NXST_FLOW reply:
4699 AT_CHECK([sed 's/ (xid=0x[[1-9a-fA-F]][[0-9a-fA-F]]*)//' monitor.log | multiline_sort], [0],
4700 [NXST_FLOW_MONITOR reply (xid=0x0):
4701 event=ADDED table=0 cookie=0 in_port=1 actions=output:2
4702 NXST_FLOW_MONITOR reply (xid=0x0):
4703 event=ADDED table=0 cookie=0 in_port=2 actions=output:1
4705 send: OFPT_FLOW_MOD: DEL priority=0 actions=drop
4706 NXST_FLOW_MONITOR reply (xid=0x0):
4707 event=DELETED reason=delete table=0 cookie=0 in_port=1 actions=output:2
4708 event=DELETED reason=delete table=0 cookie=0 in_port=2 actions=output:1
4712 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
4716 AT_SETUP([ofproto - flow monitoring with !own])
4717 AT_KEYWORDS([monitor])
4720 ovs-ofctl add-flow br0 in_port=0,dl_vlan=123,actions=output:1
4722 # Start a monitor watching the flow table and check the initial reply.
4723 ovs-ofctl monitor br0 watch:\!own --detach --no-chdir --pidfile >monitor.log 2>&1
4724 AT_CAPTURE_FILE([monitor.log])
4725 ovs-appctl -t ovs-ofctl ofctl/barrier
4726 AT_CHECK([sed 's/ (xid=0x[[1-9a-fA-F]][[0-9a-fA-F]]*)//' monitor.log], [0],
4727 [NXST_FLOW_MONITOR reply:
4728 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=123 actions=output:1
4732 # Check that our own changes are reported as abbreviations.
4733 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
4734 ovs-ofctl add-flow br0 in_port=1,actions=output:2
4735 ovs-ofctl add-flow br0 in_port=2,actions=output:1
4736 ovs-appctl -t ovs-ofctl ofctl/barrier
4737 ovs-appctl -t ovs-ofctl ofctl/send 010e004812345678003fffff00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003000000000000ffffffffffff0000
4738 ovs-appctl -t ovs-ofctl ofctl/barrier
4739 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip], [0], [NXST_FLOW reply:
4741 AT_CHECK([sed 's/ (xid=0x[[1-9a-fA-F]][[0-9a-fA-F]]*)//' monitor.log], [0],
4742 [NXST_FLOW_MONITOR reply (xid=0x0):
4743 event=ADDED table=0 cookie=0 in_port=1 actions=output:2
4744 NXST_FLOW_MONITOR reply (xid=0x0):
4745 event=ADDED table=0 cookie=0 in_port=2 actions=output:1
4747 send: OFPT_FLOW_MOD: DEL priority=0 actions=drop
4748 NXST_FLOW_MONITOR reply (xid=0x0):
4749 event=ABBREV xid=0x12345678
4753 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
4757 AT_SETUP([ofproto - flow monitoring with out_port])
4758 AT_KEYWORDS([monitor])
4761 ovs-ofctl add-flow br0 in_port=0,dl_vlan=121,actions=output:1
4762 ovs-ofctl add-flow br0 in_port=0,dl_vlan=122,actions=output:1
4763 ovs-ofctl add-flow br0 in_port=0,dl_vlan=123,actions=output:2
4765 # Start a monitor watching the flow table and check the initial reply.
4766 ovs-ofctl monitor br0 watch:out_port=2 --detach --no-chdir --pidfile >monitor.log 2>&1
4767 AT_CAPTURE_FILE([monitor.log])
4768 ovs-appctl -t ovs-ofctl ofctl/barrier
4769 AT_CHECK([sed 's/ (xid=0x[[1-9a-fA-F]][[0-9a-fA-F]]*)//' monitor.log], [0],
4770 [NXST_FLOW_MONITOR reply:
4771 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=123 actions=output:2
4775 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
4777 # Add, modify flows and check the updates.
4778 ovs-ofctl mod-flows br0 dl_vlan=121,actions=drop
4779 ovs-ofctl mod-flows br0 dl_vlan=122,actions=output:1,output:2
4780 ovs-appctl -t ovs-ofctl ofctl/barrier
4782 ovs-ofctl mod-flows br0 dl_vlan=123,actions=output:1,output:2
4783 ovs-appctl -t ovs-ofctl ofctl/barrier
4785 ovs-ofctl mod-flows br0 dl_vlan=122,actions=output:1
4786 ovs-appctl -t ovs-ofctl ofctl/barrier
4787 ovs-ofctl mod-flows br0 dl_vlan=123,actions=output:2
4788 ovs-appctl -t ovs-ofctl ofctl/barrier
4790 AT_CHECK([sed 's/ (xid=0x[[1-9a-fA-F]][[0-9a-fA-F]]*)//' monitor.log], [0],
4791 [NXST_FLOW_MONITOR reply (xid=0x0):
4792 event=MODIFIED table=0 cookie=0 in_port=0,dl_vlan=122 actions=output:1,output:2
4794 NXST_FLOW_MONITOR reply (xid=0x0):
4795 event=MODIFIED table=0 cookie=0 in_port=0,dl_vlan=123 actions=output:1,output:2
4797 NXST_FLOW_MONITOR reply (xid=0x0):
4798 event=MODIFIED table=0 cookie=0 in_port=0,dl_vlan=122 actions=output:1
4800 NXST_FLOW_MONITOR reply (xid=0x0):
4801 event=MODIFIED table=0 cookie=0 in_port=0,dl_vlan=123 actions=output:2
4805 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
4809 AT_SETUP([ofproto - flow monitoring pause and resume])
4810 AT_KEYWORDS([monitor])
4812 # The maximum socket receive buffer size is important for this test, which
4813 # tests behavior when the receive buffer overflows.
4814 if test -e /proc/sys/net/core/rmem_max; then
4816 rmem_max=`cat /proc/sys/net/core/rmem_max`
4817 elif rmem_max=`sysctl -n net.inet.tcp.recvbuf_max 2>/dev/null`; then
4820 # Don't know how to get maximum socket receive buffer on this OS
4823 # Calculate the total amount of queuing: rmem_max in the kernel, 128 kB
4824 # in ofproto sending userspace (see ofmonitor_flush() in connmgr.c).
4825 queue_size=`expr $rmem_max + 128 \* 1024`
4826 echo rmem_max=$rmem_max queue_size=$queue_size
4828 # If there's too much queuing skip the test to avoid timing out.
4829 AT_SKIP_IF([test $rmem_max -gt 1048576])
4831 # Each flow update message takes up at least 48 bytes of space in queues
4832 # and in practice more than that.
4833 n_msgs=`expr $queue_size / 48`
4838 # Start a monitor watching the flow table, then make it block.
4839 on_exit 'kill `cat ovs-ofctl.pid`'
4840 ovs-ofctl monitor br0 watch: --detach --no-chdir --pidfile >monitor.log 2>&1
4841 AT_CAPTURE_FILE([monitor.log])
4842 ovs-appctl -t ovs-ofctl ofctl/block
4844 # Add $n_msgs flows.
4845 (echo "in_port=2,actions=output:2"
4847 for i in range('$n_msgs'):
4848 print("cookie=1,reg1=%d,actions=drop" % i)
4850 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
4851 # Check that multipart flow dumps work properly:
4852 AT_CHECK([ovs-ofctl diff-flows br0 flows.txt])
4853 AT_CHECK([ovs-ofctl add-flow br0 in_port=1,cookie=3,actions=drop])
4854 AT_CHECK([ovs-ofctl mod-flows br0 in_port=2,cookie=2,actions=output:2])
4855 AT_CHECK([ovs-ofctl del-flows br0 cookie=1/-1])
4857 ovs-appctl -t ovs-ofctl ofctl/unblock
4859 # Wait for the connection resumed.
4860 # A barrier doesn't work for this purpose.
4861 # https://www.mail-archive.com/dev@openvswitch.org/msg27013.html
4862 # https://www.mail-archive.com/dev@openvswitch.org/msg27675.html
4863 OVS_WAIT_UNTIL([grep NXT_FLOW_MONITOR_RESUMED monitor.log])
4865 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
4867 # Check that the flow monitor reported the same number of flows
4868 # added and deleted, but fewer than we actually added and deleted.
4869 adds=`grep -c 'ADDED.*reg1=' monitor.log`
4870 deletes=`grep -c 'DELETED.*reg1=' monitor.log`
4871 echo adds=$adds deletes=$deletes
4872 AT_CHECK([test $adds -gt 100 && test $adds -lt $n_msgs])
4873 AT_CHECK([test $adds = $deletes])
4875 # Check that the flow monitor reported everything in the expected order:
4877 # event=ADDED table=0 cookie=0x1 reg1=0x22
4879 # NXT_FLOW_MONITOR_PAUSED:
4881 # event=DELETED reason=delete table=0 cookie=0x1 reg1=0x22
4883 # event=ADDED table=0 cookie=0x3 in_port=1
4884 # event=MODIFIED table=0 cookie=0x2 in_port=2 actions=output:2
4885 # NXT_FLOW_MONITOR_RESUMED:
4887 # except that, between the PAUSED and RESUMED, the order of the ADDED
4888 # and MODIFIED lines lines depends on hash order, that is, it varies
4889 # as we change the hash function or change architecture. Therefore,
4890 # we use a couple of tests below to accept both orders.
4891 AT_CHECK([ofctl_strip < monitor.log | sed -n -e '
4894 /NXT_FLOW_MONITOR_PAUSED:/p
4895 /NXT_FLOW_MONITOR_RESUMED:/p
4896 ' > monitor.log.subset])
4897 AT_CHECK([grep -v MODIFIED monitor.log.subset], [0], [dnl
4898 event=ADDED table=0 cookie=0x1 reg1=0x22
4899 NXT_FLOW_MONITOR_PAUSED:
4900 event=DELETED reason=delete table=0 cookie=0x1 reg1=0x22
4901 event=ADDED table=0 cookie=0x3 in_port=1
4902 NXT_FLOW_MONITOR_RESUMED:
4904 AT_CHECK([grep -v ADDED monitor.log.subset], [0], [dnl
4905 NXT_FLOW_MONITOR_PAUSED:
4906 event=DELETED reason=delete table=0 cookie=0x1 reg1=0x22
4907 event=MODIFIED table=0 cookie=0x2 in_port=2 actions=output:2
4908 NXT_FLOW_MONITOR_RESUMED:
4914 AT_SETUP([ofproto - flow monitoring usable protocols])
4915 AT_KEYWORDS([monitor])
4919 on_exit 'kill `cat ovs-ofctl.pid`'
4920 ovs-ofctl -OOpenFlow14 monitor br0 watch:udp,udp_dst=8 --detach --no-chdir --pidfile >monitor.log 2>&1
4921 AT_CAPTURE_FILE([monitor.log])
4923 # ovs-ofctl should exit because monitor is not supported in OpenFlow 1.4
4924 OVS_WAIT_UNTIL([grep "ovs-ofctl: none of the usable flow formats (OpenFlow10,NXM) is among the allowed flow formats (OXM-OpenFlow14)" monitor.log])
4926 # check that only NXM flag is returned as usable protocols for sctp_dst
4927 # and ovs-ofctl should exit since monitor is not supported in OpenFlow 1.4
4928 ovs-ofctl -OOpenFlow14 monitor br0 watch:sctp,sctp_dst=9 --detach --no-chdir --pidfile >monitor.log 2>&1
4929 OVS_WAIT_UNTIL([grep "ovs-ofctl: none of the usable flow formats (NXM) is among the allowed flow formats (OXM-OpenFlow14)" monitor.log])
4935 AT_SETUP([ofproto - event filtering (OpenFlow 1.3)])
4936 AT_KEYWORDS([monitor])
4939 # Start a monitor, use the required protocol version
4940 ovs-ofctl -O OpenFlow13 monitor br0 --detach --no-chdir --pidfile >monitor.log 2>&1
4941 AT_CAPTURE_FILE([monitor.log])
4943 # Send an OpenFlow13 message (04), OFPT_GET_ASYNC_REQUEST (1a), length (8), xid (0a)
4944 ovs-appctl -t ovs-ofctl ofctl/send 041a00080000000a
4945 ovs-appctl -t ovs-ofctl ofctl/barrier
4947 # Check default setting
4948 read -r -d '' expected <<'EOF'
4951 AT_CHECK([ofctl_strip < monitor.log], [], [dnl
4952 send: OFPT_GET_ASYNC_REQUEST (OF1.3):
4953 OFPT_GET_ASYNC_REPLY (OF1.3):
4955 PACKET_IN: no_match action
4956 PORT_STATUS: add delete modify
4957 FLOW_REMOVED: idle hard delete group_delete
4960 REQUESTFORWARD: (off)
4964 PORT_STATUS: add delete modify
4968 REQUESTFORWARD: (off)
4969 OFPT_BARRIER_REPLY (OF1.3):
4975 AT_SETUP([ofproto - ofport_request])
4977 add_of_ports br0 1 2 3
4979 set_and_check_specific_ofports () {
4980 ovs-vsctl set Interface p1 ofport_request="$1" -- \
4981 set Interface p2 ofport_request="$2" -- \
4982 set Interface p3 ofport_request="$3"
4983 ofports=`ovs-vsctl get Interface p1 ofport -- \
4984 get Interface p2 ofport -- \
4985 get Interface p3 ofport`
4986 AT_CHECK_UNQUOTED([echo $ofports], [0], [$1 $2 $3
4989 for pre in '1 2 3' '1 3 2' '2 1 3' '2 3 1' '3 1 2' '3 2 1'; do
4990 for post in '1 2 3' '1 3 2' '2 1 3' '2 3 1' '3 1 2' '3 2 1'; do
4991 echo -----------------------------------------------------------
4992 echo "Check changing port numbers from $pre to $post"
4993 set_and_check_specific_ofports $pre
4994 set_and_check_specific_ofports $post
4998 ovs-vsctl del-port p3
5000 set_and_check_poorly_specified_ofports () {
5001 ovs-vsctl set Interface p1 ofport_request="$1" -- \
5002 set Interface p2 ofport_request="$2"
5003 p1=`ovs-vsctl get Interface p1 ofport`
5004 p2=`ovs-vsctl get Interface p2 ofport`
5007 AT_CHECK([test "$p1" != "$p2"])
5008 if test "$1" = "$2" && test "$1" != '[[]]'; then
5009 # One port number must be the requested one.
5010 AT_CHECK([test "$p1" = "$1" || test "$p2" = "$1"])
5011 # The other port number must be different (already tested above).
5013 AT_CHECK([test "$1" = '[[]]' || test "$p1" = "$1"])
5014 AT_CHECK([test "$2" = '[[]]' || test "$p2" = "$2"])
5017 for pre in '1 2' '[[]] 2' '1 [[]]' '[[]] [[]]' '2 1' '[[]] 1' '2 [[]]' \
5019 for post in '1 2' '[[]] 2' '1 [[]]' '[[]] [[]]' '2 1' '[[]] 1' '2 [[]]' \
5021 echo -----------------------------------------------------------
5022 echo "Check changing port numbers from $pre to $post"
5023 set_and_check_poorly_specified_ofports $pre
5024 set_and_check_poorly_specified_ofports $post
5031 AT_SETUP([ofproto - bundle open (OpenFlow 1.4)])
5032 AT_KEYWORDS([monitor])
5035 # Start a monitor, use the required protocol version
5036 ovs-ofctl -O OpenFlow14 monitor br0 --detach --no-chdir --pidfile >monitor.log 2>&1
5037 AT_CAPTURE_FILE([monitor.log])
5039 # Send an OpenFlow14 message (05), OFPT_BUNDLE_CONTROL (21), length (10), xid (0a)
5040 ovs-appctl -t ovs-ofctl ofctl/send "05 21 00 10 00 00 00 0a 00 00 00 01 00 00 00 02"
5041 ovs-appctl -t ovs-ofctl ofctl/barrier
5042 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
5044 AT_CHECK([ofctl_strip < monitor.log], [], [dnl
5045 send: OFPT_BUNDLE_CONTROL (OF1.4):
5046 bundle_id=0x1 type=OPEN_REQUEST flags=ordered
5047 OFPT_BUNDLE_CONTROL (OF1.4):
5048 bundle_id=0x1 type=OPEN_REPLY flags=0
5049 OFPT_BARRIER_REPLY (OF1.4):
5055 AT_SETUP([ofproto - bundle double open (OpenFlow 1.4)])
5056 AT_KEYWORDS([monitor])
5059 # Start a monitor, use the required protocol version
5060 ovs-ofctl -O OpenFlow14 monitor br0 --detach --no-chdir --pidfile >monitor.log 2>&1
5061 AT_CAPTURE_FILE([monitor.log])
5063 # Send twice an OpenFlow14 message (05), OFPT_BUNDLE_CONTROL (21), length (10), xid (0a)
5064 ovs-appctl -t ovs-ofctl ofctl/send "05 21 00 10 00 00 00 0a 00 00 00 01 00 00 00 02"
5065 ovs-appctl -t ovs-ofctl ofctl/barrier
5066 ovs-appctl -t ovs-ofctl ofctl/send "05 21 00 10 00 00 00 0a 00 00 00 01 00 00 00 02"
5067 ovs-appctl -t ovs-ofctl ofctl/barrier
5068 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
5070 AT_CHECK([ofctl_strip < monitor.log], [0], [dnl
5071 send: OFPT_BUNDLE_CONTROL (OF1.4):
5072 bundle_id=0x1 type=OPEN_REQUEST flags=ordered
5073 OFPT_BUNDLE_CONTROL (OF1.4):
5074 bundle_id=0x1 type=OPEN_REPLY flags=0
5075 OFPT_BARRIER_REPLY (OF1.4):
5076 send: OFPT_BUNDLE_CONTROL (OF1.4):
5077 bundle_id=0x1 type=OPEN_REQUEST flags=ordered
5078 OFPT_ERROR (OF1.4): OFPBFC_BAD_ID
5079 OFPT_BUNDLE_CONTROL (OF1.4):
5080 bundle_id=0x1 type=OPEN_REQUEST flags=ordered
5081 OFPT_BARRIER_REPLY (OF1.4):
5087 AT_SETUP([ofproto - bundle close without open (OpenFlow 1.4)])
5088 AT_KEYWORDS([monitor])
5091 # Start a monitor, use the required protocol version
5092 ovs-ofctl -O OpenFlow14 monitor br0 --detach --no-chdir --pidfile >monitor.log 2>&1
5093 AT_CAPTURE_FILE([monitor.log])
5095 ovs-appctl -t ovs-ofctl ofctl/send "05 21 00 10 00 00 00 0a 00 00 00 01 00 02 00 02"
5096 ovs-appctl -t ovs-ofctl ofctl/barrier
5097 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
5099 AT_CHECK([ofctl_strip < monitor.log], [0], [dnl
5100 send: OFPT_BUNDLE_CONTROL (OF1.4):
5101 bundle_id=0x1 type=CLOSE_REQUEST flags=ordered
5102 OFPT_ERROR (OF1.4): OFPBFC_BAD_ID
5103 OFPT_BUNDLE_CONTROL (OF1.4):
5104 bundle_id=0x1 type=CLOSE_REQUEST flags=ordered
5105 OFPT_BARRIER_REPLY (OF1.4):
5111 AT_SETUP([ofproto - bundle double close (OpenFlow 1.4)])
5112 AT_KEYWORDS([monitor])
5115 # Start a monitor, use the required protocol version
5116 ovs-ofctl -O OpenFlow14 monitor br0 --detach --no-chdir --pidfile >monitor.log 2>&1
5117 AT_CAPTURE_FILE([monitor.log])
5119 # Open, Close, Close
5120 ovs-appctl -t ovs-ofctl ofctl/send "05 21 00 10 00 00 00 0a 00 00 00 01 00 00 00 02"
5121 ovs-appctl -t ovs-ofctl ofctl/barrier
5122 ovs-appctl -t ovs-ofctl ofctl/send "05 21 00 10 00 00 00 0a 00 00 00 01 00 02 00 02"
5123 ovs-appctl -t ovs-ofctl ofctl/barrier
5124 ovs-appctl -t ovs-ofctl ofctl/send "05 21 00 10 00 00 00 0a 00 00 00 01 00 02 00 02"
5125 ovs-appctl -t ovs-ofctl ofctl/barrier
5126 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
5128 AT_CHECK([ofctl_strip < monitor.log], [0], [dnl
5129 send: OFPT_BUNDLE_CONTROL (OF1.4):
5130 bundle_id=0x1 type=OPEN_REQUEST flags=ordered
5131 OFPT_BUNDLE_CONTROL (OF1.4):
5132 bundle_id=0x1 type=OPEN_REPLY flags=0
5133 OFPT_BARRIER_REPLY (OF1.4):
5134 send: OFPT_BUNDLE_CONTROL (OF1.4):
5135 bundle_id=0x1 type=CLOSE_REQUEST flags=ordered
5136 OFPT_BUNDLE_CONTROL (OF1.4):
5137 bundle_id=0x1 type=CLOSE_REPLY flags=0
5138 OFPT_BARRIER_REPLY (OF1.4):
5139 send: OFPT_BUNDLE_CONTROL (OF1.4):
5140 bundle_id=0x1 type=CLOSE_REQUEST flags=ordered
5141 OFPT_ERROR (OF1.4): OFPBFC_BUNDLE_CLOSED
5142 OFPT_BUNDLE_CONTROL (OF1.4):
5143 bundle_id=0x1 type=CLOSE_REQUEST flags=ordered
5144 OFPT_BARRIER_REPLY (OF1.4):
5150 AT_SETUP([ofproto - bundle close, different flags (OpenFlow 1.4)])
5151 AT_KEYWORDS([monitor])
5154 # Start a monitor, use the required protocol version
5155 ovs-ofctl -O OpenFlow14 monitor br0 --detach --no-chdir --pidfile >monitor.log 2>&1
5156 AT_CAPTURE_FILE([monitor.log])
5159 ovs-appctl -t ovs-ofctl ofctl/send "05 21 00 10 00 00 00 0a 00 00 00 01 00 00 00 02"
5160 ovs-appctl -t ovs-ofctl ofctl/barrier
5161 ovs-appctl -t ovs-ofctl ofctl/send "05 21 00 10 00 00 00 0a 00 00 00 01 00 02 00 01"
5162 ovs-appctl -t ovs-ofctl ofctl/barrier
5163 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
5165 AT_CHECK([ofctl_strip < monitor.log], [0], [dnl
5166 send: OFPT_BUNDLE_CONTROL (OF1.4):
5167 bundle_id=0x1 type=OPEN_REQUEST flags=ordered
5168 OFPT_BUNDLE_CONTROL (OF1.4):
5169 bundle_id=0x1 type=OPEN_REPLY flags=0
5170 OFPT_BARRIER_REPLY (OF1.4):
5171 send: OFPT_BUNDLE_CONTROL (OF1.4):
5172 bundle_id=0x1 type=CLOSE_REQUEST flags=atomic
5173 OFPT_ERROR (OF1.4): OFPBFC_BAD_FLAGS
5174 OFPT_BUNDLE_CONTROL (OF1.4):
5175 bundle_id=0x1 type=CLOSE_REQUEST flags=atomic
5176 OFPT_BARRIER_REPLY (OF1.4):
5182 AT_SETUP([ofproto - bundle commit without open (OpenFlow 1.4)])
5183 AT_KEYWORDS([monitor])
5186 # Start a monitor, use the required protocol version
5187 ovs-ofctl -O OpenFlow14 monitor br0 --detach --no-chdir --pidfile >monitor.log 2>&1
5188 AT_CAPTURE_FILE([monitor.log])
5191 ovs-appctl -t ovs-ofctl ofctl/send "05 21 00 10 00 00 00 0a 00 00 00 01 00 04 00 02"
5192 ovs-appctl -t ovs-ofctl ofctl/barrier
5193 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
5195 AT_CHECK([ofctl_strip < monitor.log], [0], [dnl
5196 send: OFPT_BUNDLE_CONTROL (OF1.4):
5197 bundle_id=0x1 type=COMMIT_REQUEST flags=ordered
5198 OFPT_ERROR (OF1.4): OFPBFC_BAD_ID
5199 OFPT_BUNDLE_CONTROL (OF1.4):
5200 bundle_id=0x1 type=COMMIT_REQUEST flags=ordered
5201 OFPT_BARRIER_REPLY (OF1.4):
5207 AT_SETUP([ofproto - bundle commit, different flags (OpenFlow 1.4)])
5208 AT_KEYWORDS([monitor])
5211 # Start a monitor, use the required protocol version
5212 ovs-ofctl -O OpenFlow14 monitor br0 --detach --no-chdir --pidfile >monitor.log 2>&1
5213 AT_CAPTURE_FILE([monitor.log])
5216 ovs-appctl -t ovs-ofctl ofctl/send "05 21 00 10 00 00 00 0a 00 00 00 01 00 00 00 02"
5217 ovs-appctl -t ovs-ofctl ofctl/barrier
5218 ovs-appctl -t ovs-ofctl ofctl/send "05 21 00 10 00 00 00 0a 00 00 00 01 00 04 00 01"
5219 ovs-appctl -t ovs-ofctl ofctl/barrier
5220 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
5222 AT_CHECK([ofctl_strip < monitor.log], [0], [dnl
5223 send: OFPT_BUNDLE_CONTROL (OF1.4):
5224 bundle_id=0x1 type=OPEN_REQUEST flags=ordered
5225 OFPT_BUNDLE_CONTROL (OF1.4):
5226 bundle_id=0x1 type=OPEN_REPLY flags=0
5227 OFPT_BARRIER_REPLY (OF1.4):
5228 send: OFPT_BUNDLE_CONTROL (OF1.4):
5229 bundle_id=0x1 type=COMMIT_REQUEST flags=atomic
5230 OFPT_ERROR (OF1.4): OFPBFC_BAD_FLAGS
5231 OFPT_BUNDLE_CONTROL (OF1.4):
5232 bundle_id=0x1 type=COMMIT_REQUEST flags=atomic
5233 OFPT_BARRIER_REPLY (OF1.4):
5239 AT_SETUP([ofproto - bundle discard without open (OpenFlow 1.4)])
5240 AT_KEYWORDS([monitor])
5243 # Start a monitor, use the required protocol version
5244 ovs-ofctl -O OpenFlow14 monitor br0 --detach --no-chdir --pidfile >monitor.log 2>&1
5245 AT_CAPTURE_FILE([monitor.log])
5248 ovs-appctl -t ovs-ofctl ofctl/send "05 21 00 10 00 00 00 0a 00 00 00 01 00 06 00 02"
5249 ovs-appctl -t ovs-ofctl ofctl/barrier
5250 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
5252 AT_CHECK([ofctl_strip < monitor.log], [0], [dnl
5253 send: OFPT_BUNDLE_CONTROL (OF1.4):
5254 bundle_id=0x1 type=DISCARD_REQUEST flags=ordered
5255 OFPT_ERROR (OF1.4): OFPBFC_BAD_ID
5256 OFPT_BUNDLE_CONTROL (OF1.4):
5257 bundle_id=0x1 type=DISCARD_REQUEST flags=ordered
5258 OFPT_BARRIER_REPLY (OF1.4):
5265 AT_SETUP([ofproto - bundle with multiple flow mods (OpenFlow 1.4)])
5268 AT_CHECK([ovs-appctl vlog/set vconn:dbg])
5270 AT_CHECK([ovs-ofctl --no-names del-flows br0])
5272 AT_DATA([flows.txt], [dnl
5273 add idle_timeout=50 in_port=2 dl_src=00:66:77:88:99:aa actions=1
5274 add idle_timeout=60 in_port=2 dl_src=00:77:88:99:aa:bb actions=2
5275 add idle_timeout=70 in_port=2 dl_src=00:88:99:aa:bb:cc actions=3
5276 add idle_timeout=50 in_port=2 dl_src=00:66:77:88:99:aa actions=4
5278 add idle_timeout=50 in_port=2 dl_src=00:66:77:88:99:aa actions=5
5279 add idle_timeout=60 in_port=2 dl_src=00:77:88:99:aa:bb actions=6
5280 add idle_timeout=70 in_port=2 dl_src=00:88:99:aa:bb:cc actions=7
5281 delete in_port=2 dl_src=00:88:99:aa:bb:cc
5284 AT_CHECK([ovs-ofctl --no-names --bundle add-flows br0 flows.txt])
5286 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
5287 idle_timeout=50, in_port=2,dl_src=00:66:77:88:99:aa actions=output:5
5288 idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=output:6
5292 AT_DATA([flows.txt], [dnl
5294 modify_strict in_port=2 dl_src=00:77:88:99:aa:bb actions=7
5297 AT_CHECK([ovs-ofctl --no-names --bundle add-flows br0 flows.txt])
5299 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
5300 idle_timeout=50, in_port=2,dl_src=00:66:77:88:99:aa actions=drop
5301 idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=output:7
5305 # Adding an existing flow acts as a modify, and delete_strict also works.
5306 AT_DATA([flows.txt], [dnl
5307 add idle_timeout=60 in_port=2 dl_src=00:77:88:99:aa:bb actions=8
5308 delete_strict in_port=2 dl_src=00:66:77:88:99:aa
5309 add in_port=2 dl_src=00:66:77:88:99:aa actions=drop
5312 AT_CHECK([ovs-ofctl --no-names --bundle add-flows br0 flows.txt])
5314 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
5315 idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=output:8
5316 in_port=2,dl_src=00:66:77:88:99:aa actions=drop
5320 dnl Check logs for OpenFlow trace
5322 OVS_WAIT_UNTIL([vconn_sub < ovs-vswitchd.log | test `grep -- "|vconn|DBG|unix: sent (Success): NXST_FLOW reply" | wc -l` -ge 3])
5323 AT_CHECK([print_vconn_debug | vconn_sub | ofctl_strip], [0], [dnl
5324 vconn|DBG|unix: sent (Success): OFPT_HELLO (OF1.5):
5325 version bitmap: 0x01, 0x02, 0x03, 0x04, 0x05, 0x06
5326 vconn|DBG|unix: received: OFPT_HELLO:
5327 version bitmap: 0x01
5328 vconn|DBG|unix: negotiated OpenFlow version 0x01 (we support version 0x06 and earlier, peer supports version 0x01)
5329 vconn|DBG|unix: received: OFPT_FLOW_MOD: DEL actions=drop
5330 vconn|DBG|unix: received: OFPT_BARRIER_REQUEST:
5331 vconn|DBG|unix: sent (Success): OFPT_BARRIER_REPLY:
5332 vconn|DBG|unix: sent (Success): OFPT_HELLO (OF1.5):
5333 version bitmap: 0x01, 0x02, 0x03, 0x04, 0x05, 0x06
5334 vconn|DBG|unix: received: OFPT_HELLO (OF1.4):
5335 version bitmap: 0x05
5336 vconn|DBG|unix: negotiated OpenFlow version 0x05 (we support version 0x06 and earlier, peer supports version 0x05)
5337 vconn|DBG|unix: received: OFPT_BUNDLE_CONTROL (OF1.4):
5338 bundle_id=0 type=OPEN_REQUEST flags=atomic ordered
5339 vconn|DBG|unix: sent (Success): OFPT_BUNDLE_CONTROL (OF1.4):
5340 bundle_id=0 type=OPEN_REPLY flags=0
5341 vconn|DBG|unix: received: OFPT_BUNDLE_ADD_MESSAGE (OF1.4):
5342 bundle_id=0 flags=atomic ordered
5343 OFPT_FLOW_MOD (OF1.4): ADD in_port=2,dl_src=00:66:77:88:99:aa idle:50 actions=output:1
5344 vconn|DBG|unix: received: OFPT_BUNDLE_ADD_MESSAGE (OF1.4):
5345 bundle_id=0 flags=atomic ordered
5346 OFPT_FLOW_MOD (OF1.4): ADD in_port=2,dl_src=00:77:88:99:aa:bb idle:60 actions=output:2
5347 vconn|DBG|unix: received: OFPT_BUNDLE_ADD_MESSAGE (OF1.4):
5348 bundle_id=0 flags=atomic ordered
5349 OFPT_FLOW_MOD (OF1.4): ADD in_port=2,dl_src=00:88:99:aa:bb:cc idle:70 actions=output:3
5350 vconn|DBG|unix: received: OFPT_BUNDLE_ADD_MESSAGE (OF1.4):
5351 bundle_id=0 flags=atomic ordered
5352 OFPT_FLOW_MOD (OF1.4): ADD in_port=2,dl_src=00:66:77:88:99:aa idle:50 actions=output:4
5353 vconn|DBG|unix: received: OFPT_BUNDLE_ADD_MESSAGE (OF1.4):
5354 bundle_id=0 flags=atomic ordered
5355 OFPT_FLOW_MOD (OF1.4): DEL table:255 actions=drop
5356 vconn|DBG|unix: received: OFPT_BUNDLE_ADD_MESSAGE (OF1.4):
5357 bundle_id=0 flags=atomic ordered
5358 OFPT_FLOW_MOD (OF1.4): ADD in_port=2,dl_src=00:66:77:88:99:aa idle:50 actions=output:5
5359 vconn|DBG|unix: received: OFPT_BUNDLE_ADD_MESSAGE (OF1.4):
5360 bundle_id=0 flags=atomic ordered
5361 OFPT_FLOW_MOD (OF1.4): ADD in_port=2,dl_src=00:77:88:99:aa:bb idle:60 actions=output:6
5362 vconn|DBG|unix: received: OFPT_BUNDLE_ADD_MESSAGE (OF1.4):
5363 bundle_id=0 flags=atomic ordered
5364 OFPT_FLOW_MOD (OF1.4): ADD in_port=2,dl_src=00:88:99:aa:bb:cc idle:70 actions=output:7
5365 vconn|DBG|unix: received: OFPT_BUNDLE_ADD_MESSAGE (OF1.4):
5366 bundle_id=0 flags=atomic ordered
5367 OFPT_FLOW_MOD (OF1.4): DEL table:255 in_port=2,dl_src=00:88:99:aa:bb:cc actions=drop
5368 vconn|DBG|unix: received: OFPT_BARRIER_REQUEST (OF1.4):
5369 vconn|DBG|unix: sent (Success): OFPT_BARRIER_REPLY (OF1.4):
5370 vconn|DBG|unix: received: OFPT_BUNDLE_CONTROL (OF1.4):
5371 bundle_id=0 type=COMMIT_REQUEST flags=atomic ordered
5372 vconn|DBG|unix: sent (Success): OFPT_BUNDLE_CONTROL (OF1.4):
5373 bundle_id=0 type=COMMIT_REPLY flags=0
5374 vconn|DBG|unix: sent (Success): OFPT_HELLO (OF1.5):
5375 version bitmap: 0x01, 0x02, 0x03, 0x04, 0x05, 0x06
5376 vconn|DBG|unix: received: OFPT_HELLO:
5377 version bitmap: 0x01
5378 vconn|DBG|unix: negotiated OpenFlow version 0x01 (we support version 0x06 and earlier, peer supports version 0x01)
5379 vconn|DBG|unix: received: NXT_SET_FLOW_FORMAT: format=nxm
5380 vconn|DBG|unix: received: OFPT_BARRIER_REQUEST:
5381 vconn|DBG|unix: sent (Success): OFPT_BARRIER_REPLY:
5382 vconn|DBG|unix: received: NXST_FLOW request:
5383 vconn|DBG|unix: sent (Success): NXST_FLOW reply:
5384 idle_timeout=50, in_port=2,dl_src=00:66:77:88:99:aa actions=output:5
5385 idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=output:6
5386 vconn|DBG|unix: sent (Success): OFPT_HELLO (OF1.5):
5387 version bitmap: 0x01, 0x02, 0x03, 0x04, 0x05, 0x06
5388 vconn|DBG|unix: received: OFPT_HELLO (OF1.4):
5389 version bitmap: 0x05
5390 vconn|DBG|unix: negotiated OpenFlow version 0x05 (we support version 0x06 and earlier, peer supports version 0x05)
5391 vconn|DBG|unix: received: OFPT_BUNDLE_CONTROL (OF1.4):
5392 bundle_id=0 type=OPEN_REQUEST flags=atomic ordered
5393 vconn|DBG|unix: sent (Success): OFPT_BUNDLE_CONTROL (OF1.4):
5394 bundle_id=0 type=OPEN_REPLY flags=0
5395 vconn|DBG|unix: received: OFPT_BUNDLE_ADD_MESSAGE (OF1.4):
5396 bundle_id=0 flags=atomic ordered
5397 OFPT_FLOW_MOD (OF1.4): MOD actions=drop
5398 vconn|DBG|unix: received: OFPT_BUNDLE_ADD_MESSAGE (OF1.4):
5399 bundle_id=0 flags=atomic ordered
5400 OFPT_FLOW_MOD (OF1.4): MOD_STRICT in_port=2,dl_src=00:77:88:99:aa:bb actions=output:7
5401 vconn|DBG|unix: received: OFPT_BARRIER_REQUEST (OF1.4):
5402 vconn|DBG|unix: sent (Success): OFPT_BARRIER_REPLY (OF1.4):
5403 vconn|DBG|unix: received: OFPT_BUNDLE_CONTROL (OF1.4):
5404 bundle_id=0 type=COMMIT_REQUEST flags=atomic ordered
5405 vconn|DBG|unix: sent (Success): OFPT_BUNDLE_CONTROL (OF1.4):
5406 bundle_id=0 type=COMMIT_REPLY flags=0
5407 vconn|DBG|unix: sent (Success): OFPT_HELLO (OF1.5):
5408 version bitmap: 0x01, 0x02, 0x03, 0x04, 0x05, 0x06
5409 vconn|DBG|unix: received: OFPT_HELLO:
5410 version bitmap: 0x01
5411 vconn|DBG|unix: negotiated OpenFlow version 0x01 (we support version 0x06 and earlier, peer supports version 0x01)
5412 vconn|DBG|unix: received: NXT_SET_FLOW_FORMAT: format=nxm
5413 vconn|DBG|unix: received: OFPT_BARRIER_REQUEST:
5414 vconn|DBG|unix: sent (Success): OFPT_BARRIER_REPLY:
5415 vconn|DBG|unix: received: NXST_FLOW request:
5416 vconn|DBG|unix: sent (Success): NXST_FLOW reply:
5417 idle_timeout=50, in_port=2,dl_src=00:66:77:88:99:aa actions=drop
5418 idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=output:7
5419 vconn|DBG|unix: sent (Success): OFPT_HELLO (OF1.5):
5420 version bitmap: 0x01, 0x02, 0x03, 0x04, 0x05, 0x06
5421 vconn|DBG|unix: received: OFPT_HELLO (OF1.4):
5422 version bitmap: 0x05
5423 vconn|DBG|unix: negotiated OpenFlow version 0x05 (we support version 0x06 and earlier, peer supports version 0x05)
5424 vconn|DBG|unix: received: OFPT_BUNDLE_CONTROL (OF1.4):
5425 bundle_id=0 type=OPEN_REQUEST flags=atomic ordered
5426 vconn|DBG|unix: sent (Success): OFPT_BUNDLE_CONTROL (OF1.4):
5427 bundle_id=0 type=OPEN_REPLY flags=0
5428 vconn|DBG|unix: received: OFPT_BUNDLE_ADD_MESSAGE (OF1.4):
5429 bundle_id=0 flags=atomic ordered
5430 OFPT_FLOW_MOD (OF1.4): ADD in_port=2,dl_src=00:77:88:99:aa:bb idle:60 actions=output:8
5431 vconn|DBG|unix: received: OFPT_BUNDLE_ADD_MESSAGE (OF1.4):
5432 bundle_id=0 flags=atomic ordered
5433 OFPT_FLOW_MOD (OF1.4): DEL_STRICT table:255 in_port=2,dl_src=00:66:77:88:99:aa actions=drop
5434 vconn|DBG|unix: received: OFPT_BUNDLE_ADD_MESSAGE (OF1.4):
5435 bundle_id=0 flags=atomic ordered
5436 OFPT_FLOW_MOD (OF1.4): ADD in_port=2,dl_src=00:66:77:88:99:aa actions=drop
5437 vconn|DBG|unix: received: OFPT_BARRIER_REQUEST (OF1.4):
5438 vconn|DBG|unix: sent (Success): OFPT_BARRIER_REPLY (OF1.4):
5439 vconn|DBG|unix: received: OFPT_BUNDLE_CONTROL (OF1.4):
5440 bundle_id=0 type=COMMIT_REQUEST flags=atomic ordered
5441 vconn|DBG|unix: sent (Success): OFPT_BUNDLE_CONTROL (OF1.4):
5442 bundle_id=0 type=COMMIT_REPLY flags=0
5443 vconn|DBG|unix: sent (Success): OFPT_HELLO (OF1.5):
5444 version bitmap: 0x01, 0x02, 0x03, 0x04, 0x05, 0x06
5445 vconn|DBG|unix: received: OFPT_HELLO:
5446 version bitmap: 0x01
5447 vconn|DBG|unix: negotiated OpenFlow version 0x01 (we support version 0x06 and earlier, peer supports version 0x01)
5448 vconn|DBG|unix: received: NXT_SET_FLOW_FORMAT: format=nxm
5449 vconn|DBG|unix: received: OFPT_BARRIER_REQUEST:
5450 vconn|DBG|unix: sent (Success): OFPT_BARRIER_REPLY:
5451 vconn|DBG|unix: received: NXST_FLOW request:
5452 vconn|DBG|unix: sent (Success): NXST_FLOW reply:
5453 idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=output:8
5454 in_port=2,dl_src=00:66:77:88:99:aa actions=drop
5457 AT_CHECK([grep " flow_mods in the last " ovs-vswitchd.log | sed -e 's/^.*connmgr|INFO|//' | vconn_sub], [0], [dnl
5458 br0<->unix: 1 flow_mods in the last 0 s (1 deletes)
5459 br0<->unix: 9 flow_mods in the last 0 s (7 adds, 2 deletes)
5460 br0<->unix: 2 flow_mods in the last 0 s (2 modifications)
5461 br0<->unix: 3 flow_mods in the last 0 s (2 adds, 1 deletes)
5468 AT_SETUP([ofproto - failing bundle commit (OpenFlow 1.4)])
5471 AT_CHECK([ovs-ofctl del-flows br0])
5473 ovs-ofctl add-flows br0 - <<EOF
5474 idle_timeout=50 in_port=2 dl_src=00:66:77:88:99:aa actions=11
5475 idle_timeout=60 in_port=2 dl_src=00:77:88:99:aa:bb actions=22
5476 idle_timeout=70 in_port=2 dl_src=00:88:99:aa:bb:cc actions=33
5478 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
5479 idle_timeout=50, in_port=2,dl_src=00:66:77:88:99:aa actions=output:11
5480 idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=output:22
5481 idle_timeout=70, in_port=2,dl_src=00:88:99:aa:bb:cc actions=output:33
5485 # last line uses illegal table number (OVS internal table)
5486 AT_DATA([flows.txt], [dnl
5487 add idle_timeout=50 in_port=2 dl_src=00:66:77:88:99:aa actions=1
5488 add idle_timeout=60 in_port=2 dl_src=00:77:88:99:aa:bb actions=2
5489 add idle_timeout=70 in_port=2 dl_src=00:88:99:aa:bb:cc actions=3
5490 modify idle_timeout=50 in_port=2 dl_src=00:66:77:88:99:aa actions=4
5492 add idle_timeout=50 in_port=2 dl_src=00:66:77:88:99:aa actions=5
5493 add idle_timeout=60 in_port=2 dl_src=00:77:88:99:aa:bb actions=6
5494 add idle_timeout=70 in_port=2 dl_src=00:88:99:aa:bb:cc actions=7
5495 delete in_port=2 dl_src=00:88:99:aa:bb:cc
5496 add table=254 actions=drop
5499 AT_CHECK([ovs-ofctl --bundle add-flows br0 flows.txt 2>&1 | sed '/talking to/,$d' | strip_xids],
5501 Error OFPBRC_EPERM for: OFPT_FLOW_MOD (OF1.4): ADD table:254 actions=drop
5504 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
5505 idle_timeout=50, in_port=2,dl_src=00:66:77:88:99:aa actions=output:11
5506 idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=output:22
5507 idle_timeout=70, in_port=2,dl_src=00:88:99:aa:bb:cc actions=output:33
5515 AT_SETUP([ofproto - bundle timeout (OpenFlow 1.4)])
5516 AT_KEYWORDS([monitor])
5519 # Start a monitor, use the required protocol version
5520 ovs-ofctl -O OpenFlow14 monitor br0 --detach --no-chdir --pidfile >monitor.log 2>&1
5521 AT_CAPTURE_FILE([monitor.log])
5523 ovs-appctl time/stop
5525 # Send an OpenFlow14 message (05), OFPT_BUNDLE_CONTROL (21), length (10), xid (01)
5526 ovs-appctl -t ovs-ofctl ofctl/send "05 21 00 10 00 00 00 01 00 00 00 01 00 00 00 03"
5527 ovs-appctl time/warp 8000
5528 # Send a bundle flow mod, it should keep the bundle alive.
5529 ovs-appctl -t ovs-ofctl ofctl/send "05 22 00 a0 00 00 00 02 00 00 00 01 00 00 00 03 \
5530 05 0e 00 90 00 00 00 02 00 00 00 00 00 00 00 00 \
5531 00 00 00 00 00 00 00 00 01 00 00 00 00 00 ff ff \
5532 ff ff ff ff ff ff ff ff ff ff ff ff 00 00 00 00 \
5533 00 01 00 42 80 00 00 04 00 00 00 01 80 00 08 06 \
5534 50 54 00 00 00 06 80 00 06 06 50 54 00 00 00 05 \
5535 80 00 0a 02 08 06 80 00 0c 02 00 00 80 00 2a 02 \
5536 00 02 80 00 2c 04 c0 a8 00 02 80 00 2e 04 c0 a8 \
5537 00 01 00 00 00 00 00 00 00 04 00 18 00 00 00 00 \
5538 00 00 00 10 00 00 00 03 00 00 00 00 00 00 00 00 \
5540 ovs-appctl time/warp 8000
5541 # Send a bundle close, it should keep the bundle alive.
5542 ovs-appctl -t ovs-ofctl ofctl/send "05 21 00 10 00 00 00 03 00 00 00 01 00 02 00 03"
5543 ovs-appctl time/warp 11000
5544 # Make sure that timeouts are processed after the expiry
5545 ovs-appctl time/warp 1000
5546 # Send a Commit, but too late.
5547 ovs-appctl -t ovs-ofctl ofctl/send "05 21 00 10 00 00 00 04 00 00 00 01 00 04 00 03"
5548 ovs-appctl -t ovs-ofctl ofctl/barrier
5549 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
5551 AT_CHECK([ofctl_strip < monitor.log], [], [dnl
5552 send: OFPT_BUNDLE_CONTROL (OF1.4):
5553 bundle_id=0x1 type=OPEN_REQUEST flags=atomic ordered
5554 OFPT_BUNDLE_CONTROL (OF1.4):
5555 bundle_id=0x1 type=OPEN_REPLY flags=0
5556 send: OFPT_BUNDLE_ADD_MESSAGE (OF1.4):
5557 bundle_id=0x1 flags=atomic ordered
5558 OFPT_FLOW_MOD (OF1.4): ADD table:1 priority=65535,arp,in_port=1,vlan_tci=0x0000/0x1fff,dl_src=50:54:00:00:00:06,dl_dst=50:54:00:00:00:05,arp_spa=192.168.0.2,arp_tpa=192.168.0.1,arp_op=2 actions=output:3
5559 send: OFPT_BUNDLE_CONTROL (OF1.4):
5560 bundle_id=0x1 type=CLOSE_REQUEST flags=atomic ordered
5561 OFPT_BUNDLE_CONTROL (OF1.4):
5562 bundle_id=0x1 type=CLOSE_REPLY flags=0
5563 OFPT_ERROR (OF1.4): OFPBFC_TIMEOUT
5564 OFPT_BUNDLE_CONTROL (OF1.4):
5565 bundle_id=0x1 type=OPEN_REQUEST flags=atomic ordered
5566 send: OFPT_BUNDLE_CONTROL (OF1.4):
5567 bundle_id=0x1 type=COMMIT_REQUEST flags=atomic ordered
5568 OFPT_ERROR (OF1.4): OFPBFC_BAD_ID
5569 OFPT_BUNDLE_CONTROL (OF1.4):
5570 bundle_id=0x1 type=COMMIT_REQUEST flags=atomic ordered
5571 OFPT_BARRIER_REPLY (OF1.4):
5577 AT_SETUP([ofproto - bundle custom timeout (OpenFlow 1.4)])
5578 AT_KEYWORDS([monitor])
5581 AT_CHECK([ovs-vsctl set Open_vSwitch . other_config:bundle-idle-timeout=4])
5583 # Start a monitor, use the required protocol version
5584 ovs-ofctl -O OpenFlow14 monitor br0 --detach --no-chdir --pidfile >monitor.log 2>&1
5585 AT_CAPTURE_FILE([monitor.log])
5587 ovs-appctl time/stop
5589 # Send an OpenFlow14 message (05), OFPT_BUNDLE_CONTROL (21), length (10), xid (01)
5590 ovs-appctl -t ovs-ofctl ofctl/send "05 21 00 10 00 00 00 01 00 00 00 01 00 00 00 03"
5591 ovs-appctl time/warp 2000
5592 # Send a bundle flow mod, it should keep the bundle alive.
5593 ovs-appctl -t ovs-ofctl ofctl/send "05 22 00 a0 00 00 00 02 00 00 00 01 00 00 00 03 \
5594 05 0e 00 90 00 00 00 02 00 00 00 00 00 00 00 00 \
5595 00 00 00 00 00 00 00 00 01 00 00 00 00 00 ff ff \
5596 ff ff ff ff ff ff ff ff ff ff ff ff 00 00 00 00 \
5597 00 01 00 42 80 00 00 04 00 00 00 01 80 00 08 06 \
5598 50 54 00 00 00 06 80 00 06 06 50 54 00 00 00 05 \
5599 80 00 0a 02 08 06 80 00 0c 02 00 00 80 00 2a 02 \
5600 00 02 80 00 2c 04 c0 a8 00 02 80 00 2e 04 c0 a8 \
5601 00 01 00 00 00 00 00 00 00 04 00 18 00 00 00 00 \
5602 00 00 00 10 00 00 00 03 00 00 00 00 00 00 00 00 \
5604 ovs-appctl time/warp 2000
5605 # Send a bundle close, it should keep the bundle alive.
5606 ovs-appctl -t ovs-ofctl ofctl/send "05 21 00 10 00 00 00 03 00 00 00 01 00 02 00 03"
5607 ovs-appctl time/warp 4000
5608 # Make sure that timeouts are processed after the expiry, but still before the
5609 # current timeout of 4s.
5610 ovs-appctl time/warp 1000
5611 # Send a Commit, but too late.
5612 ovs-appctl -t ovs-ofctl ofctl/send "05 21 00 10 00 00 00 04 00 00 00 01 00 04 00 03"
5613 ovs-appctl -t ovs-ofctl ofctl/barrier
5614 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
5616 AT_CHECK([ofctl_strip < monitor.log], [], [dnl
5617 send: OFPT_BUNDLE_CONTROL (OF1.4):
5618 bundle_id=0x1 type=OPEN_REQUEST flags=atomic ordered
5619 OFPT_BUNDLE_CONTROL (OF1.4):
5620 bundle_id=0x1 type=OPEN_REPLY flags=0
5621 send: OFPT_BUNDLE_ADD_MESSAGE (OF1.4):
5622 bundle_id=0x1 flags=atomic ordered
5623 OFPT_FLOW_MOD (OF1.4): ADD table:1 priority=65535,arp,in_port=1,vlan_tci=0x0000/0x1fff,dl_src=50:54:00:00:00:06,dl_dst=50:54:00:00:00:05,arp_spa=192.168.0.2,arp_tpa=192.168.0.1,arp_op=2 actions=output:3
5624 send: OFPT_BUNDLE_CONTROL (OF1.4):
5625 bundle_id=0x1 type=CLOSE_REQUEST flags=atomic ordered
5626 OFPT_BUNDLE_CONTROL (OF1.4):
5627 bundle_id=0x1 type=CLOSE_REPLY flags=0
5628 OFPT_ERROR (OF1.4): OFPBFC_TIMEOUT
5629 OFPT_BUNDLE_CONTROL (OF1.4):
5630 bundle_id=0x1 type=OPEN_REQUEST flags=atomic ordered
5631 send: OFPT_BUNDLE_CONTROL (OF1.4):
5632 bundle_id=0x1 type=COMMIT_REQUEST flags=atomic ordered
5633 OFPT_ERROR (OF1.4): OFPBFC_BAD_ID
5634 OFPT_BUNDLE_CONTROL (OF1.4):
5635 bundle_id=0x1 type=COMMIT_REQUEST flags=atomic ordered
5636 OFPT_BARRIER_REPLY (OF1.4):
5642 AT_SETUP([ofproto - bundle reset timeout to default (OpenFlow 1.4)])
5643 AT_KEYWORDS([monitor])
5646 AT_CHECK([ovs-vsctl set Open_vSwitch . other_config:bundle-idle-timeout=15])
5647 AT_CHECK([ovs-vsctl remove Open_vSwitch . other_config bundle-idle-timeout])
5649 # Start a monitor, use the required protocol version
5650 ovs-ofctl -O OpenFlow14 monitor br0 --detach --no-chdir --pidfile >monitor.log 2>&1
5651 AT_CAPTURE_FILE([monitor.log])
5653 ovs-appctl time/stop
5655 # Send an OpenFlow14 message (05), OFPT_BUNDLE_CONTROL (21), length (10), xid (01)
5656 ovs-appctl -t ovs-ofctl ofctl/send "05 21 00 10 00 00 00 01 00 00 00 01 00 00 00 03"
5657 ovs-appctl time/warp 8000
5658 # Send a bundle flow mod, it should keep the bundle alive.
5659 ovs-appctl -t ovs-ofctl ofctl/send "05 22 00 a0 00 00 00 02 00 00 00 01 00 00 00 03 \
5660 05 0e 00 90 00 00 00 02 00 00 00 00 00 00 00 00 \
5661 00 00 00 00 00 00 00 00 01 00 00 00 00 00 ff ff \
5662 ff ff ff ff ff ff ff ff ff ff ff ff 00 00 00 00 \
5663 00 01 00 42 80 00 00 04 00 00 00 01 80 00 08 06 \
5664 50 54 00 00 00 06 80 00 06 06 50 54 00 00 00 05 \
5665 80 00 0a 02 08 06 80 00 0c 02 00 00 80 00 2a 02 \
5666 00 02 80 00 2c 04 c0 a8 00 02 80 00 2e 04 c0 a8 \
5667 00 01 00 00 00 00 00 00 00 04 00 18 00 00 00 00 \
5668 00 00 00 10 00 00 00 03 00 00 00 00 00 00 00 00 \
5670 ovs-appctl time/warp 8000
5671 # Send a bundle close, it should keep the bundle alive.
5672 ovs-appctl -t ovs-ofctl ofctl/send "05 21 00 10 00 00 00 03 00 00 00 01 00 02 00 03"
5673 ovs-appctl time/warp 11000
5674 # Make sure that timeouts are processed after the expiry
5675 ovs-appctl time/warp 1000
5676 # Send a Commit, but too late.
5677 ovs-appctl -t ovs-ofctl ofctl/send "05 21 00 10 00 00 00 04 00 00 00 01 00 04 00 03"
5678 ovs-appctl -t ovs-ofctl ofctl/barrier
5679 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
5681 AT_CHECK([ofctl_strip < monitor.log], [], [dnl
5682 send: OFPT_BUNDLE_CONTROL (OF1.4):
5683 bundle_id=0x1 type=OPEN_REQUEST flags=atomic ordered
5684 OFPT_BUNDLE_CONTROL (OF1.4):
5685 bundle_id=0x1 type=OPEN_REPLY flags=0
5686 send: OFPT_BUNDLE_ADD_MESSAGE (OF1.4):
5687 bundle_id=0x1 flags=atomic ordered
5688 OFPT_FLOW_MOD (OF1.4): ADD table:1 priority=65535,arp,in_port=1,vlan_tci=0x0000/0x1fff,dl_src=50:54:00:00:00:06,dl_dst=50:54:00:00:00:05,arp_spa=192.168.0.2,arp_tpa=192.168.0.1,arp_op=2 actions=output:3
5689 send: OFPT_BUNDLE_CONTROL (OF1.4):
5690 bundle_id=0x1 type=CLOSE_REQUEST flags=atomic ordered
5691 OFPT_BUNDLE_CONTROL (OF1.4):
5692 bundle_id=0x1 type=CLOSE_REPLY flags=0
5693 OFPT_ERROR (OF1.4): OFPBFC_TIMEOUT
5694 OFPT_BUNDLE_CONTROL (OF1.4):
5695 bundle_id=0x1 type=OPEN_REQUEST flags=atomic ordered
5696 send: OFPT_BUNDLE_CONTROL (OF1.4):
5697 bundle_id=0x1 type=COMMIT_REQUEST flags=atomic ordered
5698 OFPT_ERROR (OF1.4): OFPBFC_BAD_ID
5699 OFPT_BUNDLE_CONTROL (OF1.4):
5700 bundle_id=0x1 type=COMMIT_REQUEST flags=atomic ordered
5701 OFPT_BARRIER_REPLY (OF1.4):
5707 AT_SETUP([ofproto - bundle open (OpenFlow 1.3)])
5708 AT_KEYWORDS([monitor])
5711 # Start a monitor, use the required protocol version
5712 ovs-ofctl -O OpenFlow13 monitor br0 --detach --no-chdir --pidfile >monitor.log 2>&1
5713 AT_CAPTURE_FILE([monitor.log])
5715 # Send an OpenFlow13 message (04), OFPT_EXPERIMENTER (04), length (0018),
5716 # xid (0000000a), ONF_EXPERIMENTER_ID (4F4E4600),
5717 # ONFT_BUNDLE_CONTROL (2300 = 0x08FC), bundle id (00000001),
5718 # message type (0000), and flags (0002)
5719 ovs-appctl -t ovs-ofctl ofctl/send "04 04 00 18 00 00 00 0a 4F 4E 46 00 00 00 08 FC 00 00 00 01 00 00 00 02"
5720 ovs-appctl -t ovs-ofctl ofctl/barrier
5721 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
5723 AT_CHECK([ofctl_strip < monitor.log], [], [dnl
5724 send: ONFT_BUNDLE_CONTROL (OF1.3):
5725 bundle_id=0x1 type=OPEN_REQUEST flags=ordered
5726 ONFT_BUNDLE_CONTROL (OF1.3):
5727 bundle_id=0x1 type=OPEN_REPLY flags=0
5728 OFPT_BARRIER_REPLY (OF1.3):
5734 AT_SETUP([ofproto - bundle double open (OpenFlow 1.3)])
5735 AT_KEYWORDS([monitor])
5738 # Start a monitor, use the required protocol version
5739 ovs-ofctl -O OpenFlow13 monitor br0 --detach --no-chdir --pidfile >monitor.log 2>&1
5740 AT_CAPTURE_FILE([monitor.log])
5742 # Send twice an OpenFlow13 message (04), OFPT_EXPERIMENTER (04), length (0018),
5743 # xid (0000000a), ONF_EXPERIMENTER_ID (4F4E4600),
5744 # ONFT_BUNDLE_CONTROL (2300 = 0x08FC), bundle id (00000001),
5745 # message type (0000), and flags (0002)
5746 ovs-appctl -t ovs-ofctl ofctl/send "04 04 00 18 00 00 00 0a 4F 4E 46 00 00 00 08 FC 00 00 00 01 00 00 00 02"
5747 ovs-appctl -t ovs-ofctl ofctl/barrier
5748 ovs-appctl -t ovs-ofctl ofctl/send "04 04 00 18 00 00 00 0a 4F 4E 46 00 00 00 08 FC 00 00 00 01 00 00 00 02"
5749 ovs-appctl -t ovs-ofctl ofctl/barrier
5750 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
5752 AT_CHECK([ofctl_strip < monitor.log], [0], [dnl
5753 send: ONFT_BUNDLE_CONTROL (OF1.3):
5754 bundle_id=0x1 type=OPEN_REQUEST flags=ordered
5755 ONFT_BUNDLE_CONTROL (OF1.3):
5756 bundle_id=0x1 type=OPEN_REPLY flags=0
5757 OFPT_BARRIER_REPLY (OF1.3):
5758 send: ONFT_BUNDLE_CONTROL (OF1.3):
5759 bundle_id=0x1 type=OPEN_REQUEST flags=ordered
5760 OFPT_ERROR (OF1.3): OFPBFC_BAD_ID
5761 ONFT_BUNDLE_CONTROL (OF1.3):
5762 bundle_id=0x1 type=OPEN_REQUEST flags=ordered
5763 OFPT_BARRIER_REPLY (OF1.3):
5769 AT_SETUP([ofproto - bundle close without open (OpenFlow 1.3)])
5770 AT_KEYWORDS([monitor])
5773 # Start a monitor, use the required protocol version
5774 ovs-ofctl -O OpenFlow13 monitor br0 --detach --no-chdir --pidfile >monitor.log 2>&1
5775 AT_CAPTURE_FILE([monitor.log])
5777 ovs-appctl -t ovs-ofctl ofctl/send "04 04 00 18 00 00 00 0a 4F 4E 46 00 00 00 08 FC 00 00 00 01 00 02 00 02"
5778 ovs-appctl -t ovs-ofctl ofctl/barrier
5779 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
5781 AT_CHECK([ofctl_strip < monitor.log], [0], [dnl
5782 send: ONFT_BUNDLE_CONTROL (OF1.3):
5783 bundle_id=0x1 type=CLOSE_REQUEST flags=ordered
5784 OFPT_ERROR (OF1.3): OFPBFC_BAD_ID
5785 ONFT_BUNDLE_CONTROL (OF1.3):
5786 bundle_id=0x1 type=CLOSE_REQUEST flags=ordered
5787 OFPT_BARRIER_REPLY (OF1.3):
5793 AT_SETUP([ofproto - bundle double close (OpenFlow 1.3)])
5794 AT_KEYWORDS([monitor])
5797 # Start a monitor, use the required protocol version
5798 ovs-ofctl -O OpenFlow13 monitor br0 --detach --no-chdir --pidfile >monitor.log 2>&1
5799 AT_CAPTURE_FILE([monitor.log])
5801 # Open, Close, Close
5802 ovs-appctl -t ovs-ofctl ofctl/send "04 04 00 18 00 00 00 0a 4F 4E 46 00 00 00 08 FC 00 00 00 01 00 00 00 02"
5803 ovs-appctl -t ovs-ofctl ofctl/barrier
5804 ovs-appctl -t ovs-ofctl ofctl/send "04 04 00 18 00 00 00 0a 4F 4E 46 00 00 00 08 FC 00 00 00 01 00 02 00 02"
5805 ovs-appctl -t ovs-ofctl ofctl/barrier
5806 ovs-appctl -t ovs-ofctl ofctl/send "04 04 00 18 00 00 00 0a 4F 4E 46 00 00 00 08 FC 00 00 00 01 00 02 00 02"
5807 ovs-appctl -t ovs-ofctl ofctl/barrier
5808 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
5810 AT_CHECK([ofctl_strip < monitor.log], [0], [dnl
5811 send: ONFT_BUNDLE_CONTROL (OF1.3):
5812 bundle_id=0x1 type=OPEN_REQUEST flags=ordered
5813 ONFT_BUNDLE_CONTROL (OF1.3):
5814 bundle_id=0x1 type=OPEN_REPLY flags=0
5815 OFPT_BARRIER_REPLY (OF1.3):
5816 send: ONFT_BUNDLE_CONTROL (OF1.3):
5817 bundle_id=0x1 type=CLOSE_REQUEST flags=ordered
5818 ONFT_BUNDLE_CONTROL (OF1.3):
5819 bundle_id=0x1 type=CLOSE_REPLY flags=0
5820 OFPT_BARRIER_REPLY (OF1.3):
5821 send: ONFT_BUNDLE_CONTROL (OF1.3):
5822 bundle_id=0x1 type=CLOSE_REQUEST flags=ordered
5823 OFPT_ERROR (OF1.3): OFPBFC_BUNDLE_CLOSED
5824 ONFT_BUNDLE_CONTROL (OF1.3):
5825 bundle_id=0x1 type=CLOSE_REQUEST flags=ordered
5826 OFPT_BARRIER_REPLY (OF1.3):
5832 AT_SETUP([ofproto - bundle close, different flags (OpenFlow 1.3)])
5833 AT_KEYWORDS([monitor])
5836 # Start a monitor, use the required protocol version
5837 ovs-ofctl -O OpenFlow13 monitor br0 --detach --no-chdir --pidfile >monitor.log 2>&1
5838 AT_CAPTURE_FILE([monitor.log])
5841 ovs-appctl -t ovs-ofctl ofctl/send "04 04 00 18 00 00 00 0a 4F 4E 46 00 00 00 08 FC 00 00 00 01 00 00 00 02"
5842 ovs-appctl -t ovs-ofctl ofctl/barrier
5843 ovs-appctl -t ovs-ofctl ofctl/send "04 04 00 18 00 00 00 0a 4F 4E 46 00 00 00 08 FC 00 00 00 01 00 02 00 01"
5844 ovs-appctl -t ovs-ofctl ofctl/barrier
5845 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
5847 AT_CHECK([ofctl_strip < monitor.log], [0], [dnl
5848 send: ONFT_BUNDLE_CONTROL (OF1.3):
5849 bundle_id=0x1 type=OPEN_REQUEST flags=ordered
5850 ONFT_BUNDLE_CONTROL (OF1.3):
5851 bundle_id=0x1 type=OPEN_REPLY flags=0
5852 OFPT_BARRIER_REPLY (OF1.3):
5853 send: ONFT_BUNDLE_CONTROL (OF1.3):
5854 bundle_id=0x1 type=CLOSE_REQUEST flags=atomic
5855 OFPT_ERROR (OF1.3): OFPBFC_BAD_FLAGS
5856 ONFT_BUNDLE_CONTROL (OF1.3):
5857 bundle_id=0x1 type=CLOSE_REQUEST flags=atomic
5858 OFPT_BARRIER_REPLY (OF1.3):
5864 AT_SETUP([ofproto - bundle commit without open (OpenFlow 1.3)])
5865 AT_KEYWORDS([monitor])
5868 # Start a monitor, use the required protocol version
5869 ovs-ofctl -O OpenFlow13 monitor br0 --detach --no-chdir --pidfile >monitor.log 2>&1
5870 AT_CAPTURE_FILE([monitor.log])
5873 ovs-appctl -t ovs-ofctl ofctl/send "04 04 00 18 00 00 00 0a 4F 4E 46 00 00 00 08 FC 00 00 00 01 00 04 00 02"
5874 ovs-appctl -t ovs-ofctl ofctl/barrier
5875 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
5877 AT_CHECK([ofctl_strip < monitor.log], [0], [dnl
5878 send: ONFT_BUNDLE_CONTROL (OF1.3):
5879 bundle_id=0x1 type=COMMIT_REQUEST flags=ordered
5880 OFPT_ERROR (OF1.3): OFPBFC_BAD_ID
5881 ONFT_BUNDLE_CONTROL (OF1.3):
5882 bundle_id=0x1 type=COMMIT_REQUEST flags=ordered
5883 OFPT_BARRIER_REPLY (OF1.3):
5889 AT_SETUP([ofproto - bundle commit, different flags (OpenFlow 1.3)])
5890 AT_KEYWORDS([monitor])
5893 # Start a monitor, use the required protocol version
5894 ovs-ofctl -O OpenFlow13 monitor br0 --detach --no-chdir --pidfile >monitor.log 2>&1
5895 AT_CAPTURE_FILE([monitor.log])
5898 ovs-appctl -t ovs-ofctl ofctl/send "04 04 00 18 00 00 00 0a 4F 4E 46 00 00 00 08 FC 00 00 00 01 00 00 00 02"
5899 ovs-appctl -t ovs-ofctl ofctl/barrier
5900 ovs-appctl -t ovs-ofctl ofctl/send "04 04 00 18 00 00 00 0a 4F 4E 46 00 00 00 08 FC 00 00 00 01 00 04 00 01"
5901 ovs-appctl -t ovs-ofctl ofctl/barrier
5902 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
5904 AT_CHECK([ofctl_strip < monitor.log], [0], [dnl
5905 send: ONFT_BUNDLE_CONTROL (OF1.3):
5906 bundle_id=0x1 type=OPEN_REQUEST flags=ordered
5907 ONFT_BUNDLE_CONTROL (OF1.3):
5908 bundle_id=0x1 type=OPEN_REPLY flags=0
5909 OFPT_BARRIER_REPLY (OF1.3):
5910 send: ONFT_BUNDLE_CONTROL (OF1.3):
5911 bundle_id=0x1 type=COMMIT_REQUEST flags=atomic
5912 OFPT_ERROR (OF1.3): OFPBFC_BAD_FLAGS
5913 ONFT_BUNDLE_CONTROL (OF1.3):
5914 bundle_id=0x1 type=COMMIT_REQUEST flags=atomic
5915 OFPT_BARRIER_REPLY (OF1.3):
5921 AT_SETUP([ofproto - bundle discard without open (OpenFlow 1.3)])
5922 AT_KEYWORDS([monitor])
5925 # Start a monitor, use the required protocol version
5926 ovs-ofctl -O OpenFlow13 monitor br0 --detach --no-chdir --pidfile >monitor.log 2>&1
5927 AT_CAPTURE_FILE([monitor.log])
5930 ovs-appctl -t ovs-ofctl ofctl/send "04 04 00 18 00 00 00 0a 4F 4E 46 00 00 00 08 FC 00 00 00 01 00 06 00 02"
5931 ovs-appctl -t ovs-ofctl ofctl/barrier
5932 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
5934 AT_CHECK([ofctl_strip < monitor.log], [0], [dnl
5935 send: ONFT_BUNDLE_CONTROL (OF1.3):
5936 bundle_id=0x1 type=DISCARD_REQUEST flags=ordered
5937 OFPT_ERROR (OF1.3): OFPBFC_BAD_ID
5938 ONFT_BUNDLE_CONTROL (OF1.3):
5939 bundle_id=0x1 type=DISCARD_REQUEST flags=ordered
5940 OFPT_BARRIER_REPLY (OF1.3):
5947 AT_SETUP([ofproto - bundle with multiple flow mods (OpenFlow 1.3)])
5950 AT_CHECK([ovs-appctl vlog/set vconn:dbg])
5952 AT_CHECK([ovs-ofctl --no-names del-flows br0])
5954 AT_DATA([flows.txt], [dnl
5955 add idle_timeout=50 in_port=2 dl_src=00:66:77:88:99:aa actions=1
5956 add idle_timeout=60 in_port=2 dl_src=00:77:88:99:aa:bb actions=2
5957 add idle_timeout=70 in_port=2 dl_src=00:88:99:aa:bb:cc actions=3
5958 add idle_timeout=50 in_port=2 dl_src=00:66:77:88:99:aa actions=4
5960 add idle_timeout=50 in_port=2 dl_src=00:66:77:88:99:aa actions=5
5961 add idle_timeout=60 in_port=2 dl_src=00:77:88:99:aa:bb actions=6
5962 add idle_timeout=70 in_port=2 dl_src=00:88:99:aa:bb:cc actions=7
5963 delete in_port=2 dl_src=00:88:99:aa:bb:cc
5966 AT_CHECK([ovs-ofctl -O OpenFlow13 --no-names --bundle add-flows br0 flows.txt])
5968 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
5969 idle_timeout=50, in_port=2,dl_src=00:66:77:88:99:aa actions=output:5
5970 idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=output:6
5974 AT_DATA([flows.txt], [dnl
5976 modify_strict in_port=2 dl_src=00:77:88:99:aa:bb actions=7
5979 AT_CHECK([ovs-ofctl -O OpenFlow13 --no-names --bundle add-flows br0 flows.txt])
5981 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
5982 idle_timeout=50, in_port=2,dl_src=00:66:77:88:99:aa actions=drop
5983 idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=output:7
5987 # Adding an existing flow acts as a modify, and delete_strict also works.
5988 AT_DATA([flows.txt], [dnl
5989 add idle_timeout=60 in_port=2 dl_src=00:77:88:99:aa:bb actions=8
5990 delete_strict in_port=2 dl_src=00:66:77:88:99:aa
5991 add in_port=2 dl_src=00:66:77:88:99:aa actions=drop
5994 AT_CHECK([ovs-ofctl -O OpenFlow13 --bundle --no-names add-flows br0 flows.txt])
5996 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
5997 idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=output:8
5998 in_port=2,dl_src=00:66:77:88:99:aa actions=drop
6002 dnl Check logs for OpenFlow trace
6004 OVS_WAIT_UNTIL([vconn_sub < ovs-vswitchd.log | test `grep -- "|vconn|DBG|unix: sent (Success): NXST_FLOW reply" | wc -l` -ge 3])
6005 AT_CHECK([print_vconn_debug | vconn_sub | ofctl_strip], [0], [dnl
6006 vconn|DBG|unix: sent (Success): OFPT_HELLO (OF1.5):
6007 version bitmap: 0x01, 0x02, 0x03, 0x04, 0x05, 0x06
6008 vconn|DBG|unix: received: OFPT_HELLO:
6009 version bitmap: 0x01
6010 vconn|DBG|unix: negotiated OpenFlow version 0x01 (we support version 0x06 and earlier, peer supports version 0x01)
6011 vconn|DBG|unix: received: OFPT_FLOW_MOD: DEL actions=drop
6012 vconn|DBG|unix: received: OFPT_BARRIER_REQUEST:
6013 vconn|DBG|unix: sent (Success): OFPT_BARRIER_REPLY:
6014 vconn|DBG|unix: sent (Success): OFPT_HELLO (OF1.5):
6015 version bitmap: 0x01, 0x02, 0x03, 0x04, 0x05, 0x06
6016 vconn|DBG|unix: received: OFPT_HELLO (OF1.3):
6017 version bitmap: 0x04
6018 vconn|DBG|unix: negotiated OpenFlow version 0x04 (we support version 0x06 and earlier, peer supports version 0x04)
6019 vconn|DBG|unix: received: ONFT_BUNDLE_CONTROL (OF1.3):
6020 bundle_id=0 type=OPEN_REQUEST flags=atomic ordered
6021 vconn|DBG|unix: sent (Success): ONFT_BUNDLE_CONTROL (OF1.3):
6022 bundle_id=0 type=OPEN_REPLY flags=0
6023 vconn|DBG|unix: received: ONFT_BUNDLE_ADD_MESSAGE (OF1.3):
6024 bundle_id=0 flags=atomic ordered
6025 OFPT_FLOW_MOD (OF1.3): ADD in_port=2,dl_src=00:66:77:88:99:aa idle:50 actions=output:1
6026 vconn|DBG|unix: received: ONFT_BUNDLE_ADD_MESSAGE (OF1.3):
6027 bundle_id=0 flags=atomic ordered
6028 OFPT_FLOW_MOD (OF1.3): ADD in_port=2,dl_src=00:77:88:99:aa:bb idle:60 actions=output:2
6029 vconn|DBG|unix: received: ONFT_BUNDLE_ADD_MESSAGE (OF1.3):
6030 bundle_id=0 flags=atomic ordered
6031 OFPT_FLOW_MOD (OF1.3): ADD in_port=2,dl_src=00:88:99:aa:bb:cc idle:70 actions=output:3
6032 vconn|DBG|unix: received: ONFT_BUNDLE_ADD_MESSAGE (OF1.3):
6033 bundle_id=0 flags=atomic ordered
6034 OFPT_FLOW_MOD (OF1.3): ADD in_port=2,dl_src=00:66:77:88:99:aa idle:50 actions=output:4
6035 vconn|DBG|unix: received: ONFT_BUNDLE_ADD_MESSAGE (OF1.3):
6036 bundle_id=0 flags=atomic ordered
6037 OFPT_FLOW_MOD (OF1.3): DEL table:255 actions=drop
6038 vconn|DBG|unix: received: ONFT_BUNDLE_ADD_MESSAGE (OF1.3):
6039 bundle_id=0 flags=atomic ordered
6040 OFPT_FLOW_MOD (OF1.3): ADD in_port=2,dl_src=00:66:77:88:99:aa idle:50 actions=output:5
6041 vconn|DBG|unix: received: ONFT_BUNDLE_ADD_MESSAGE (OF1.3):
6042 bundle_id=0 flags=atomic ordered
6043 OFPT_FLOW_MOD (OF1.3): ADD in_port=2,dl_src=00:77:88:99:aa:bb idle:60 actions=output:6
6044 vconn|DBG|unix: received: ONFT_BUNDLE_ADD_MESSAGE (OF1.3):
6045 bundle_id=0 flags=atomic ordered
6046 OFPT_FLOW_MOD (OF1.3): ADD in_port=2,dl_src=00:88:99:aa:bb:cc idle:70 actions=output:7
6047 vconn|DBG|unix: received: ONFT_BUNDLE_ADD_MESSAGE (OF1.3):
6048 bundle_id=0 flags=atomic ordered
6049 OFPT_FLOW_MOD (OF1.3): DEL table:255 in_port=2,dl_src=00:88:99:aa:bb:cc actions=drop
6050 vconn|DBG|unix: received: OFPT_BARRIER_REQUEST (OF1.3):
6051 vconn|DBG|unix: sent (Success): OFPT_BARRIER_REPLY (OF1.3):
6052 vconn|DBG|unix: received: ONFT_BUNDLE_CONTROL (OF1.3):
6053 bundle_id=0 type=COMMIT_REQUEST flags=atomic ordered
6054 vconn|DBG|unix: sent (Success): ONFT_BUNDLE_CONTROL (OF1.3):
6055 bundle_id=0 type=COMMIT_REPLY flags=0
6056 vconn|DBG|unix: sent (Success): OFPT_HELLO (OF1.5):
6057 version bitmap: 0x01, 0x02, 0x03, 0x04, 0x05, 0x06
6058 vconn|DBG|unix: received: OFPT_HELLO:
6059 version bitmap: 0x01
6060 vconn|DBG|unix: negotiated OpenFlow version 0x01 (we support version 0x06 and earlier, peer supports version 0x01)
6061 vconn|DBG|unix: received: NXT_SET_FLOW_FORMAT: format=nxm
6062 vconn|DBG|unix: received: OFPT_BARRIER_REQUEST:
6063 vconn|DBG|unix: sent (Success): OFPT_BARRIER_REPLY:
6064 vconn|DBG|unix: received: NXST_FLOW request:
6065 vconn|DBG|unix: sent (Success): NXST_FLOW reply:
6066 idle_timeout=50, in_port=2,dl_src=00:66:77:88:99:aa actions=output:5
6067 idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=output:6
6068 vconn|DBG|unix: sent (Success): OFPT_HELLO (OF1.5):
6069 version bitmap: 0x01, 0x02, 0x03, 0x04, 0x05, 0x06
6070 vconn|DBG|unix: received: OFPT_HELLO (OF1.3):
6071 version bitmap: 0x04
6072 vconn|DBG|unix: negotiated OpenFlow version 0x04 (we support version 0x06 and earlier, peer supports version 0x04)
6073 vconn|DBG|unix: received: ONFT_BUNDLE_CONTROL (OF1.3):
6074 bundle_id=0 type=OPEN_REQUEST flags=atomic ordered
6075 vconn|DBG|unix: sent (Success): ONFT_BUNDLE_CONTROL (OF1.3):
6076 bundle_id=0 type=OPEN_REPLY flags=0
6077 vconn|DBG|unix: received: ONFT_BUNDLE_ADD_MESSAGE (OF1.3):
6078 bundle_id=0 flags=atomic ordered
6079 OFPT_FLOW_MOD (OF1.3): MOD actions=drop
6080 vconn|DBG|unix: received: ONFT_BUNDLE_ADD_MESSAGE (OF1.3):
6081 bundle_id=0 flags=atomic ordered
6082 OFPT_FLOW_MOD (OF1.3): MOD_STRICT in_port=2,dl_src=00:77:88:99:aa:bb actions=output:7
6083 vconn|DBG|unix: received: OFPT_BARRIER_REQUEST (OF1.3):
6084 vconn|DBG|unix: sent (Success): OFPT_BARRIER_REPLY (OF1.3):
6085 vconn|DBG|unix: received: ONFT_BUNDLE_CONTROL (OF1.3):
6086 bundle_id=0 type=COMMIT_REQUEST flags=atomic ordered
6087 vconn|DBG|unix: sent (Success): ONFT_BUNDLE_CONTROL (OF1.3):
6088 bundle_id=0 type=COMMIT_REPLY flags=0
6089 vconn|DBG|unix: sent (Success): OFPT_HELLO (OF1.5):
6090 version bitmap: 0x01, 0x02, 0x03, 0x04, 0x05, 0x06
6091 vconn|DBG|unix: received: OFPT_HELLO:
6092 version bitmap: 0x01
6093 vconn|DBG|unix: negotiated OpenFlow version 0x01 (we support version 0x06 and earlier, peer supports version 0x01)
6094 vconn|DBG|unix: received: NXT_SET_FLOW_FORMAT: format=nxm
6095 vconn|DBG|unix: received: OFPT_BARRIER_REQUEST:
6096 vconn|DBG|unix: sent (Success): OFPT_BARRIER_REPLY:
6097 vconn|DBG|unix: received: NXST_FLOW request:
6098 vconn|DBG|unix: sent (Success): NXST_FLOW reply:
6099 idle_timeout=50, in_port=2,dl_src=00:66:77:88:99:aa actions=drop
6100 idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=output:7
6101 vconn|DBG|unix: sent (Success): OFPT_HELLO (OF1.5):
6102 version bitmap: 0x01, 0x02, 0x03, 0x04, 0x05, 0x06
6103 vconn|DBG|unix: received: OFPT_HELLO (OF1.3):
6104 version bitmap: 0x04
6105 vconn|DBG|unix: negotiated OpenFlow version 0x04 (we support version 0x06 and earlier, peer supports version 0x04)
6106 vconn|DBG|unix: received: ONFT_BUNDLE_CONTROL (OF1.3):
6107 bundle_id=0 type=OPEN_REQUEST flags=atomic ordered
6108 vconn|DBG|unix: sent (Success): ONFT_BUNDLE_CONTROL (OF1.3):
6109 bundle_id=0 type=OPEN_REPLY flags=0
6110 vconn|DBG|unix: received: ONFT_BUNDLE_ADD_MESSAGE (OF1.3):
6111 bundle_id=0 flags=atomic ordered
6112 OFPT_FLOW_MOD (OF1.3): ADD in_port=2,dl_src=00:77:88:99:aa:bb idle:60 actions=output:8
6113 vconn|DBG|unix: received: ONFT_BUNDLE_ADD_MESSAGE (OF1.3):
6114 bundle_id=0 flags=atomic ordered
6115 OFPT_FLOW_MOD (OF1.3): DEL_STRICT table:255 in_port=2,dl_src=00:66:77:88:99:aa actions=drop
6116 vconn|DBG|unix: received: ONFT_BUNDLE_ADD_MESSAGE (OF1.3):
6117 bundle_id=0 flags=atomic ordered
6118 OFPT_FLOW_MOD (OF1.3): ADD in_port=2,dl_src=00:66:77:88:99:aa actions=drop
6119 vconn|DBG|unix: received: OFPT_BARRIER_REQUEST (OF1.3):
6120 vconn|DBG|unix: sent (Success): OFPT_BARRIER_REPLY (OF1.3):
6121 vconn|DBG|unix: received: ONFT_BUNDLE_CONTROL (OF1.3):
6122 bundle_id=0 type=COMMIT_REQUEST flags=atomic ordered
6123 vconn|DBG|unix: sent (Success): ONFT_BUNDLE_CONTROL (OF1.3):
6124 bundle_id=0 type=COMMIT_REPLY flags=0
6125 vconn|DBG|unix: sent (Success): OFPT_HELLO (OF1.5):
6126 version bitmap: 0x01, 0x02, 0x03, 0x04, 0x05, 0x06
6127 vconn|DBG|unix: received: OFPT_HELLO:
6128 version bitmap: 0x01
6129 vconn|DBG|unix: negotiated OpenFlow version 0x01 (we support version 0x06 and earlier, peer supports version 0x01)
6130 vconn|DBG|unix: received: NXT_SET_FLOW_FORMAT: format=nxm
6131 vconn|DBG|unix: received: OFPT_BARRIER_REQUEST:
6132 vconn|DBG|unix: sent (Success): OFPT_BARRIER_REPLY:
6133 vconn|DBG|unix: received: NXST_FLOW request:
6134 vconn|DBG|unix: sent (Success): NXST_FLOW reply:
6135 idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=output:8
6136 in_port=2,dl_src=00:66:77:88:99:aa actions=drop
6143 AT_SETUP([ofproto - failing bundle add message (OpenFlow 1.3)])
6146 AT_CHECK([ovs-ofctl del-flows br0])
6148 ovs-ofctl add-flows br0 - <<EOF
6149 idle_timeout=50 in_port=2 dl_src=00:66:77:88:99:aa actions=11
6150 idle_timeout=60 in_port=2 dl_src=00:77:88:99:aa:bb actions=22
6151 idle_timeout=70 in_port=2 dl_src=00:88:99:aa:bb:cc actions=33
6153 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
6154 idle_timeout=50, in_port=2,dl_src=00:66:77:88:99:aa actions=output:11
6155 idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=output:22
6156 idle_timeout=70, in_port=2,dl_src=00:88:99:aa:bb:cc actions=output:33
6160 # last line uses illegal table number (OVS internal table)
6161 AT_DATA([flows.txt], [dnl
6162 add idle_timeout=50 in_port=2 dl_src=00:66:77:88:99:aa actions=1
6163 add idle_timeout=60 in_port=2 dl_src=00:77:88:99:aa:bb actions=2
6164 add idle_timeout=70 in_port=2 dl_src=00:88:99:aa:bb:cc actions=3
6165 modify idle_timeout=50 in_port=2 dl_src=00:66:77:88:99:aa actions=4
6167 add idle_timeout=50 in_port=2 dl_src=00:66:77:88:99:aa actions=5
6168 add idle_timeout=60 in_port=2 dl_src=00:77:88:99:aa:bb actions=6
6169 add idle_timeout=70 in_port=2 dl_src=00:88:99:aa:bb:cc actions=7
6170 delete in_port=2 dl_src=00:88:99:aa:bb:cc
6171 add table=254 actions=drop
6174 AT_CHECK([ovs-ofctl -O OpenFlow13 --bundle add-flows br0 flows.txt 2>&1 | sed '/talking to/,$d' | strip_xids],
6176 Error OFPBRC_EPERM for: OFPT_FLOW_MOD (OF1.3): ADD table:254 actions=drop
6179 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
6180 idle_timeout=50, in_port=2,dl_src=00:66:77:88:99:aa actions=output:11
6181 idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=output:22
6182 idle_timeout=70, in_port=2,dl_src=00:88:99:aa:bb:cc actions=output:33
6190 AT_SETUP([ofproto - failing bundle commit (OpenFlow 1.3)])
6193 AT_CHECK([ovs-ofctl del-flows br0])
6195 # Invalid group numbers are detected at commit time
6196 AT_DATA([flows.txt], [dnl
6197 add idle_timeout=50 in_port=2 dl_src=00:66:77:88:99:aa actions=group:1
6198 add idle_timeout=60 in_port=2 dl_src=00:77:88:99:aa:bb actions=group:2
6199 add idle_timeout=70 in_port=2 dl_src=00:88:99:aa:bb:cc actions=group:3
6202 AT_CHECK([ovs-ofctl -O OpenFlow13 --bundle add-flows br0 flows.txt 2>&1 | sed '/talking to/,$d' | strip_xids],
6204 Error OFPBAC_BAD_OUT_GROUP for: OFPT_FLOW_MOD (OF1.3): ADD in_port=2,dl_src=00:66:77:88:99:aa idle:50 actions=group:1
6205 Error OFPBFC_MSG_FAILED for: ONFT_BUNDLE_CONTROL (OF1.3):
6206 bundle_id=0 type=COMMIT_REQUEST flags=atomic ordered
6209 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
6216 AT_SETUP([ofproto - monitor flows with tun_md])
6219 AT_CHECK([ovs-ofctl add-tlv-map br0 "{class=0xffff,type=0,len=4}->tun_metadata0"])
6220 AT_CHECK([ovs-ofctl add-flow br0 tun_metadata0=0x1,actions=drop])
6222 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip], [0], [dnl
6224 tun_metadata0=0x1 actions=drop
6227 AT_CAPTURE_FILE([ofctl_monitor.log])
6228 dnl Usually ovs-ofctl monitor outputs on stderr, but the first message here
6229 dnl is put on stdout, because it is handled by ofctl in dump_transaction()
6230 dnl and not in monitor_vconn().
6231 AT_CHECK([ovs-ofctl monitor br0 65534 watch: --detach --no-chdir --pidfile >ofctl_monitor.log 2>&1])
6233 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 2])
6235 AT_CHECK([cat ofctl_monitor.log | ofctl_strip], [0], [dnl
6236 NXST_FLOW_MONITOR reply:
6237 event=ADDED table=0 cookie=0 tun_metadata0=0x1
6240 AT_CHECK([ovs-ofctl del-flows br0])
6242 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 4])
6244 AT_CHECK([cat ofctl_monitor.log | ofctl_strip], [0], [dnl
6245 NXST_FLOW_MONITOR reply:
6246 event=ADDED table=0 cookie=0 tun_metadata0=0x1
6247 NXST_FLOW_MONITOR reply:
6248 event=DELETED reason=delete table=0 cookie=0 tun_metadata0=0x1
6251 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
6253 dnl Check that vswitchd hasn't crashed
6254 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip], [0], [dnl
6261 AT_SETUP([ofproto - flow mod with tunnel metadata])
6262 AT_KEYWORDS([ofp-actions])
6265 AT_CHECK([ovs-ofctl add-tlv-map br0 "{class=0xffff,type=0,len=4}->tun_metadata0"])
6266 AT_CHECK([ovs-ofctl add-flow br0 "in_port=1 actions=move:tun_metadata0[[0..31]]->NXM_NX_REG0[[]]"])
6268 dnl Check the length of tun_metadata0 in the replied OXM header.
6269 dnl Ignore the first 0x50 bytes of hex dump from the reply msg since the NXM
6270 dnl header that describes the tunnel metadata starts at offset 0x50.
6271 AT_CHECK([ovs-ofctl dump-flows br0 -mmmm], [0], [stdout])
6272 AT_CHECK([sed -e 's/duration=[[0-9.]]*s/duration=?s/' -e 's/idle_age=[[0-9]]*/idle_age=?/' -e '/^000000[[0-4]]0 / d' stdout | strip_xids], [0], [dnl
6274 cookie=0x0, duration=?s, table=0, n_packets=0, n_bytes=0, idle_age=?, in_port=1 actions=move:NXM_NX_TUN_METADATA0[[0..31]]->NXM_NX_REG0[[]]
6275 00000050 ff ff 00 18 00 00 23 20-00 06 00 20 00 00 00 00 |......# ... ....|
6276 00000060 00 01 50 04 00 01 00 04- |..P..... |
6279 dnl Check actions that may use tun_metadata
6280 AT_CHECK([ovs-ofctl add-flow br0 "in_port=2 actions=move:tun_metadata1[[0..31]]->NXM_NX_REG0[[]]"], [1], [], [stderr])
6281 AT_CHECK([strip_xids < stderr | sed '/FLOW_MOD/,$d'], [0], [dnl
6282 OFPT_ERROR: NXFMFC_INVALID_TLV_FIELD
6285 AT_CHECK([ovs-ofctl add-flow br0 "in_port=2 actions=move:tun_metadata0[[32..63]]->NXM_NX_REG0[[]]"], [1], [], [stderr])
6286 AT_CHECK([strip_xids < stderr | sed '/FLOW_MOD/,$d'], [0], [dnl
6287 OFPT_ERROR: OFPBAC_BAD_SET_LEN
6290 AT_CHECK([ovs-ofctl add-flow br0 "in_port=2 actions=push:tun_metadata1[[0..31]]"], [1], [], [stderr])
6291 AT_CHECK([strip_xids < stderr | sed '/FLOW_MOD/,$d'], [0], [dnl
6292 OFPT_ERROR: NXFMFC_INVALID_TLV_FIELD
6295 AT_CHECK([ovs-ofctl add-flow br0 "in_port=2 actions=pop:tun_metadata0[[32..63]]"], [1], [], [stderr])
6296 AT_CHECK([strip_xids < stderr | sed '/FLOW_MOD/,$d'], [0], [dnl
6297 OFPT_ERROR: OFPBAC_BAD_SET_LEN
6300 AT_CHECK([ovs-ofctl add-flow br0 "in_port=3, actions=load:0x11223344->tun_metadata1"], [1], [], [stderr])
6301 AT_CHECK([strip_xids < stderr | sed '/FLOW_MOD/,$d'], [0], [dnl
6302 OFPT_ERROR: NXFMFC_INVALID_TLV_FIELD
6305 AT_CHECK([ovs-ofctl add-flow br0 "in_port=2 actions=output:tun_metadata1[[0..31]]"], [1], [], [stderr])
6306 AT_CHECK([strip_xids < stderr | sed '/FLOW_MOD/,$d'], [0], [dnl
6307 OFPT_ERROR: NXFMFC_INVALID_TLV_FIELD
6310 AT_CHECK([ovs-ofctl add-flow br0 "in_port=2 actions=output:tun_metadata0[[32..63]]"], [1], [], [stderr])
6311 AT_CHECK([strip_xids < stderr | sed '/FLOW_MOD/,$d'], [0], [dnl
6312 OFPT_ERROR: OFPBAC_BAD_SET_LEN
6315 AT_CHECK([ovs-ofctl add-flow br0 "in_port=2 actions=multipath(eth_src,50,modulo_n,1,0,tun_metadata1[[0..31]])"], [1], [], [stderr])
6316 AT_CHECK([strip_xids < stderr | sed '/FLOW_MOD/,$d'], [0], [dnl
6317 OFPT_ERROR: NXFMFC_INVALID_TLV_FIELD
6320 AT_CHECK([ovs-ofctl add-flow br0 "in_port=2 actions=multipath(eth_src,50,modulo_n,1,0,tun_metadata0[[32..63]])"], [1], [], [stderr])
6321 AT_CHECK([strip_xids < stderr | sed '/FLOW_MOD/,$d'], [0], [dnl
6322 OFPT_ERROR: OFPBAC_BAD_SET_LEN
6325 AT_CHECK([ovs-ofctl add-flow br0 "in_port=2 actions=bundle_load(eth_src,50,hrw,ofport,tun_metadata1[[0..31]], members:4,8)"], [1], [], [stderr])
6326 AT_CHECK([strip_xids < stderr | sed '/FLOW_MOD/,$d'], [0], [dnl
6327 OFPT_ERROR: NXFMFC_INVALID_TLV_FIELD
6330 AT_CHECK([ovs-ofctl add-flow br0 "in_port=2 actions=bundle_load(eth_src,50,hrw,ofport,tun_metadata0[[32..63]], members:4,8)"], [1], [], [stderr])
6331 AT_CHECK([strip_xids < stderr | sed '/FLOW_MOD/,$d'], [0], [dnl
6332 OFPT_ERROR: OFPBAC_BAD_SET_LEN
6335 AT_CHECK([ovs-ofctl add-flow br0 "in_port=2 actions=learn(tun_metadata1[[0..31]]=reg0[[0..31]])"], [1], [], [stderr])
6336 AT_CHECK([strip_xids < stderr | sed '/FLOW_MOD/,$d'], [0], [dnl
6337 OFPT_ERROR: NXFMFC_INVALID_TLV_FIELD
6340 AT_CHECK([ovs-ofctl add-flow br0 "in_port=2 actions=learn(tun_metadata0[[32..63]]=reg0[[0..31]])"], [1], [], [stderr])
6341 AT_CHECK([strip_xids < stderr | sed '/FLOW_MOD/,$d'], [0], [dnl
6342 OFPT_ERROR: OFPBAC_BAD_SET_LEN
6345 AT_CHECK([ovs-ofctl add-flow br0 "in_port=2 actions=clone(move:tun_metadata1[[0..31]]->reg0[[0..31]])"], [1], [], [stderr])
6346 AT_CHECK([strip_xids < stderr | sed '/FLOW_MOD/,$d'], [0], [dnl
6347 OFPT_ERROR: NXFMFC_INVALID_TLV_FIELD
6350 AT_CHECK([ovs-ofctl add-flow br0 "in_port=2 actions=clone(move:tun_metadata0[[32..63]]->reg0[[0..31]])"], [1], [], [stderr])
6351 AT_CHECK([strip_xids < stderr | sed '/FLOW_MOD/,$d'], [0], [dnl
6352 OFPT_ERROR: OFPBAC_BAD_SET_LEN
6355 AT_CHECK([ovs-ofctl add-flow br0 "ip actions=ct(commit,zone=tun_metadata1[[0..15]],exec(set_field:0x01->ct_mark))"], [1], [], [stderr])
6356 AT_CHECK([strip_xids < stderr | sed '/FLOW_MOD/,$d'], [0], [dnl
6357 OFPT_ERROR: NXFMFC_INVALID_TLV_FIELD
6360 AT_CHECK([ovs-ofctl add-flow br0 "ip actions=ct(commit,zone=tun_metadata0[[32..47]],exec(set_field:0x01->ct_mark))"], [1], [], [stderr])
6361 AT_CHECK([strip_xids < stderr | sed '/FLOW_MOD/,$d'], [0], [dnl
6362 OFPT_ERROR: OFPBAC_BAD_SET_LEN
6365 AT_CHECK([ovs-ofctl add-flow br0 "ip actions=ct(commit,zone=1,exec(move:tun_metadata1[[0..31]]->ct_mark))"], [1], [], [stderr])
6366 AT_CHECK([strip_xids < stderr | sed '/FLOW_MOD/,$d'], [0], [dnl
6367 OFPT_ERROR: NXFMFC_INVALID_TLV_FIELD
6370 AT_CHECK([ovs-ofctl add-flow br0 "ip actions=ct(commit,zone=1,exec(move:tun_metadata0[[32..63]]->ct_mark))"], [1], [], [stderr])
6371 AT_CHECK([strip_xids < stderr | sed '/FLOW_MOD/,$d'], [0], [dnl
6372 OFPT_ERROR: OFPBAC_BAD_SET_LEN
6375 dnl Check match field with tun_metadata
6376 AT_CHECK([ovs-ofctl add-flow br0 "tun_metadata0=0x11223344 actions=output:2"], [0], [], [stderr])
6377 AT_CHECK([ovs-ofctl add-flow br0 "tun_metadata1=0x11223344 actions=output:2"], [1], [], [stderr])
6378 AT_CHECK([strip_xids < stderr | sed '/FLOW_MOD/,$d'], [0], [dnl
6379 OFPT_ERROR: NXFMFC_INVALID_TLV_FIELD
6382 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip], [0], [dnl)
6384 in_port=1 actions=move:NXM_NX_TUN_METADATA0[[0..31]]->NXM_NX_REG0[[]]
6385 tun_metadata0=0x11223344 actions=output:2
6388 OVS_VSWITCHD_STOP(["/NXFMFC_INVALID_TLV_FIELD/d
6390 /OFPBAC_BAD_SET_LEN/d"])
6393 AT_SETUP([ofproto - flush flows, groups, and meters for controller change])
6394 AT_KEYWORDS([flow flows group group meter])
6397 add_flow_group_and_meter () {
6398 AT_CHECK([ovs-ofctl add-flow br0 in_port=1,actions=2])
6399 AT_CHECK([ovs-ofctl -O OpenFlow11 add-group br0 group_id=1234,type=all,bucket=output:10
6400 AT_CHECK([ovs-ofctl -O OpenFlow13 add-meter br0 'meter=1 pktps burst stats bands=type=drop rate=1 burst_size=1'])
6405 AT_CHECK([ovs-ofctl --no-stats dump-flows br0], [0], [dnl
6406 in_port=1 actions=output:2
6408 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-groups br0], [0], [dnl
6409 OFPST_GROUP_DESC reply (OF1.1) (xid=0x2):
6410 group_id=1234,type=all,bucket=actions=output:10
6412 AT_CHECK([ovs-ofctl -O OpenFlow13 dump-meters br0], [0], [dnl
6413 OFPST_METER_CONFIG reply (OF1.3) (xid=0x2):
6414 meter=1 pktps burst stats bands=
6415 type=drop rate=1 burst_size=1
6420 AT_CHECK([ovs-ofctl --no-stats dump-flows br0])
6421 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-groups br0], [0], [dnl
6422 OFPST_GROUP_DESC reply (OF1.1) (xid=0x2):
6424 AT_CHECK([ovs-ofctl -O OpenFlow13 dump-meters br0], [0], [dnl
6425 OFPST_METER_CONFIG reply (OF1.3) (xid=0x2):
6429 # Add flow, group, meter and check that they're there, without a controller.
6430 add_flow_group_and_meter
6433 # Set up a controller and verify that the flow and group were deleted,
6434 # then add them back.
6435 AT_CHECK([ovs-vsctl set-controller br0 'tcp:<invalid>:6653'])
6437 add_flow_group_and_meter
6440 # Change the controller and verify that the flow and group are still there.
6441 AT_CHECK([ovs-vsctl set-controller br0 'tcp:<invalid2>:6653'])
6444 # Clear the controller and verify that the flow and group were deleted.
6445 AT_CHECK([ovs-vsctl del-controller br0])
6448 OVS_VSWITCHD_STOP(["/<invalid/d"])