3 AT_SETUP([ofproto - echo request])
5 AT_CHECK([ovs-ofctl -vwarn probe br0])
9 AT_SETUP([ofproto - handling messages with bad version])
12 # Start a monitor running OpenFlow 1.0, then send the switch an OF1.1 features
14 AT_CHECK([ovs-ofctl -P openflow10 monitor br0 --detach --no-chdir --pidfile])
15 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
16 AT_CAPTURE_FILE([monitor.log])
17 ovs-appctl -t ovs-ofctl ofctl/send 0205000801234567
18 ovs-appctl -t ovs-ofctl ofctl/barrier
19 ovs-appctl -t ovs-ofctl exit
21 AT_CHECK([sed 's/ (xid=0x[[0-9a-fA-F]]*)//
22 /ECHO/d' monitor.log], [0], [dnl
23 send: OFPT_FEATURES_REQUEST (OF1.1):
24 OFPT_ERROR (OF1.1): OFPBRC_BAD_VERSION
25 OFPT_FEATURES_REQUEST (OF1.1):
29 OVS_VSWITCHD_STOP(["/received OpenFlow version 0x02 != expected 01/d"])
32 AT_SETUP([ofproto - feature request, config request])
34 AT_CHECK([ovs-ofctl -vwarn show br0], [0], [stdout])
35 AT_CHECK([STRIP_XIDS stdout], [0], [dnl
36 OFPT_FEATURES_REPLY: dpid:fedcba9876543210
37 n_tables:254, n_buffers:256
38 capabilities: FLOW_STATS TABLE_STATS PORT_STATS QUEUE_STATS ARP_MATCH_IP
39 actions: output enqueue set_vlan_vid set_vlan_pcp strip_vlan mod_dl_src mod_dl_dst mod_nw_src mod_nw_dst mod_nw_tos mod_tp_src mod_tp_dst
40 LOCAL(br0): addr:aa:55:aa:55:00:00
43 speed: 0 Mbps now, 0 Mbps max
44 OFPT_GET_CONFIG_REPLY: frags=normal miss_send_len=0
49 AT_SETUP([ofproto - set OpenFlow port number])
51 [add-port br0 p1 -- set Interface p1 type=dummy --\
52 add-port br0 p2 -- set Interface p2 type=dummy ofport_request=99])
53 AT_CHECK([ovs-ofctl -vwarn show br0], [0], [stdout])
55 s/ (xid=0x[0-9a-fA-F]*)//
56 s/00:0.$/00:0x/' < stdout]],
58 OFPT_FEATURES_REPLY: dpid:fedcba9876543210
59 n_tables:254, n_buffers:256
60 capabilities: FLOW_STATS TABLE_STATS PORT_STATS QUEUE_STATS ARP_MATCH_IP
61 actions: output enqueue set_vlan_vid set_vlan_pcp strip_vlan mod_dl_src mod_dl_dst mod_nw_src mod_nw_dst mod_nw_tos mod_tp_src mod_tp_dst
62 1(p1): addr:aa:55:aa:55:00:0x
65 speed: 0 Mbps now, 0 Mbps max
66 99(p2): addr:aa:55:aa:55:00:0x
69 speed: 0 Mbps now, 0 Mbps max
70 LOCAL(br0): addr:aa:55:aa:55:00:0x
73 speed: 0 Mbps now, 0 Mbps max
74 OFPT_GET_CONFIG_REPLY: frags=normal miss_send_len=0
80 dnl This is really bare-bones.
81 dnl It at least checks request and reply serialization and deserialization.
82 AT_SETUP([ofproto - port stats - (OpenFlow 1.0)])
84 AT_CHECK([ovs-ofctl -vwarn dump-ports br0], [0], [stdout])
85 AT_CHECK([STRIP_XIDS stdout], [0], [dnl
86 OFPST_PORT reply: 1 ports
87 port LOCAL: rx pkts=0, bytes=0, drop=0, errs=0, frame=0, over=0, crc=0
88 tx pkts=0, bytes=0, drop=0, errs=0, coll=0
93 AT_SETUP([ofproto - port stats - (OpenFlow 1.2)])
95 AT_CHECK([ovs-ofctl -O OpenFlow12 -vwarn dump-ports br0], [0], [stdout])
96 AT_CHECK([STRIP_XIDS stdout], [0], [dnl
97 OFPST_PORT reply (OF1.2): 1 ports
98 port LOCAL: rx pkts=0, bytes=0, drop=0, errs=0, frame=0, over=0, crc=0
99 tx pkts=0, bytes=0, drop=0, errs=0, coll=0
104 AT_SETUP([ofproto - port stats - (OpenFlow 1.4)])
106 AT_CHECK([ovs-ofctl -O OpenFlow14 -vwarn dump-ports br0], [0], [stdout])
107 AT_CHECK([STRIP_XIDS stdout | sed 's/duration=[[0-9.]]*s/duration=?s/'],
109 OFPST_PORT reply (OF1.4): 1 ports
110 port LOCAL: rx pkts=0, bytes=0, drop=0, errs=0, frame=0, over=0, crc=0
111 tx pkts=0, bytes=0, drop=0, errs=0, coll=0
117 dnl This is really bare-bones.
118 dnl It at least checks request and reply serialization and deserialization.
119 AT_SETUP([ofproto - port-desc stats (OpenFlow 1.0)])
121 AT_CHECK([ovs-ofctl -vwarn dump-ports-desc br0], [0], [stdout])
122 AT_CHECK([STRIP_XIDS stdout], [0], [dnl
123 OFPST_PORT_DESC reply:
124 LOCAL(br0): addr:aa:55:aa:55:00:00
127 speed: 0 Mbps now, 0 Mbps max
132 dnl This is really bare-bones.
133 dnl It at least checks request and reply serialization and deserialization.
134 AT_SETUP([ofproto - port-desc stats (OpenFlow 1.2)])
136 AT_CHECK([ovs-ofctl -O OpenFlow12 -vwarn dump-ports-desc br0], [0], [stdout])
137 AT_CHECK([STRIP_XIDS stdout], [0], [dnl
138 OFPST_PORT_DESC reply (OF1.2):
139 LOCAL(br0): addr:aa:55:aa:55:00:00
142 speed: 0 Mbps now, 0 Mbps max
147 AT_SETUP([ofproto - port-desc stats (OpenFlow 1.5)])
149 ADD_OF_PORTS([br0], 1, 2, 3)
150 AT_CHECK([ovs-ofctl -F OXM-OpenFlow15 -O OpenFlow15 -vwarn dump-ports-desc br0], [0], [stdout])
151 AT_CHECK([STRIP_XIDS stdout | sed 's/00:0./00:0x/'], [0], [dnl
152 OFPST_PORT_DESC reply (OF1.5):
153 1(p1): addr:aa:55:aa:55:00:0x
156 speed: 0 Mbps now, 0 Mbps max
157 2(p2): addr:aa:55:aa:55:00:0x
160 speed: 0 Mbps now, 0 Mbps max
161 3(p3): addr:aa:55:aa:55:00:0x
164 speed: 0 Mbps now, 0 Mbps max
165 LOCAL(br0): addr:aa:55:aa:55:00:0x
168 speed: 0 Mbps now, 0 Mbps max
170 AT_CHECK([ovs-ofctl -F OXM-OpenFlow15 -O OpenFlow15 -vwarn dump-ports-desc br0 2], [0], [stdout])
171 AT_CHECK([STRIP_XIDS stdout | sed 's/00:0./00:0x/'], [0], [dnl
172 OFPST_PORT_DESC reply (OF1.5):
173 2(p2): addr:aa:55:aa:55:00:0x
176 speed: 0 Mbps now, 0 Mbps max
181 dnl This is really bare-bones.
182 dnl It at least checks request and reply serialization and deserialization.
183 AT_SETUP([ofproto - queue stats - (OpenFlow 1.0)])
185 AT_CHECK([ovs-ofctl -vwarn queue-stats br0], [0], [stdout])
186 AT_CHECK([STRIP_XIDS stdout], [0], [dnl
187 OFPST_QUEUE reply: 0 queues
189 AT_CHECK([ovs-ofctl -vwarn queue-stats br0 ANY 5], [0],
190 [OFPT_ERROR (xid=0x2): OFPQOFC_BAD_QUEUE
191 OFPST_QUEUE request (xid=0x2): port=ANY queue=5
193 AT_CHECK([ovs-ofctl -vwarn queue-stats br0 10], [0],
194 [OFPT_ERROR (xid=0x2): OFPQOFC_BAD_PORT
195 OFPST_QUEUE request (xid=0x2): port=10 queue=ALL
200 AT_SETUP([ofproto - queue stats - (OpenFlow 1.2)])
202 AT_CHECK([ovs-ofctl -O OpenFlow12 -vwarn queue-stats br0], [0], [stdout])
203 AT_CHECK([STRIP_XIDS stdout], [0], [dnl
204 OFPST_QUEUE reply (OF1.2): 0 queues
206 AT_CHECK([ovs-ofctl -O OpenFlow12 -vwarn queue-stats br0 ALL 5], [0],
207 [OFPT_ERROR (OF1.2) (xid=0x2): OFPQOFC_BAD_QUEUE
208 OFPST_QUEUE request (OF1.2) (xid=0x2): port=ANY queue=5
210 AT_CHECK([ovs-ofctl -O OpenFlow12 -vwarn queue-stats br0 10], [0],
211 [OFPT_ERROR (OF1.2) (xid=0x2): OFPQOFC_BAD_PORT
212 OFPST_QUEUE request (OF1.2) (xid=0x2): port=10 queue=ALL
217 AT_SETUP([ofproto - queue stats - (OpenFlow 1.4)])
219 AT_CHECK([ovs-ofctl -O OpenFlow14 -vwarn queue-stats br0], [0], [stdout])
220 AT_CHECK([STRIP_XIDS stdout], [0], [dnl
221 OFPST_QUEUE reply (OF1.4): 0 queues
223 AT_CHECK([ovs-ofctl -O OpenFlow14 -vwarn queue-stats br0 ALL 5], [0],
224 [OFPT_ERROR (OF1.4) (xid=0x2): OFPQOFC_BAD_QUEUE
225 OFPST_QUEUE request (OF1.4) (xid=0x2): port=ANY queue=5
227 AT_CHECK([ovs-ofctl -O OpenFlow14 -vwarn queue-stats br0 10], [0],
228 [OFPT_ERROR (OF1.4) (xid=0x2): OFPQOFC_BAD_PORT
229 OFPST_QUEUE request (OF1.4) (xid=0x2): port=10 queue=ALL
234 dnl This is really bare-bones.
235 dnl It at least checks request and reply serialization and deserialization.
236 AT_SETUP([ofproto - queue configuration - (OpenFlow 1.0)])
238 ADD_OF_PORTS([br0], [1], [2])
239 AT_CHECK([ovs-ofctl queue-get-config br0 1], [0], [stdout])
240 AT_CHECK([STRIP_XIDS stdout], [0], [dnl
241 OFPT_QUEUE_GET_CONFIG_REPLY: port=1
243 AT_CHECK([ovs-ofctl queue-get-config br0], [0], [stdout])
244 AT_CHECK([STRIP_XIDS stdout | sort], [0], [dnl
245 OFPT_QUEUE_GET_CONFIG_REPLY: port=1
246 OFPT_QUEUE_GET_CONFIG_REPLY: port=2
248 AT_CHECK([ovs-ofctl queue-get-config br0 10], [0],
249 [OFPT_ERROR (xid=0x2): OFPQOFC_BAD_PORT
250 OFPT_QUEUE_GET_CONFIG_REQUEST (xid=0x2): port=10
255 AT_SETUP([ofproto - queue configuration - (OpenFlow 1.1)])
257 ADD_OF_PORTS([br0], [1], [2])
258 AT_CHECK([ovs-ofctl -O OpenFlow12 queue-get-config br0 1], [0], [stdout])
259 AT_CHECK([STRIP_XIDS stdout], [0], [dnl
260 OFPT_QUEUE_GET_CONFIG_REPLY (OF1.2): port=1
262 AT_CHECK([ovs-ofctl -O OpenFlow12 queue-get-config br0 10], [0],
263 [OFPT_ERROR (OF1.2) (xid=0x2): OFPQOFC_BAD_PORT
264 OFPT_QUEUE_GET_CONFIG_REQUEST (OF1.2) (xid=0x2): port=10
269 AT_SETUP([ofproto - queue configuration - (OpenFlow 1.2)])
271 ADD_OF_PORTS([br0], [1], [2])
272 AT_CHECK([ovs-ofctl -O OpenFlow12 queue-get-config br0 1], [0], [stdout])
273 AT_CHECK([STRIP_XIDS stdout], [0], [dnl
274 OFPT_QUEUE_GET_CONFIG_REPLY (OF1.2): port=1
276 AT_CHECK([ovs-ofctl -O OpenFlow12 queue-get-config br0 ANY], [0], [stdout])
277 AT_CHECK([STRIP_XIDS stdout], [0], [dnl
278 OFPT_QUEUE_GET_CONFIG_REPLY (OF1.2): port=ANY
280 AT_CHECK([ovs-ofctl -O OpenFlow12 queue-get-config br0 10], [0],
281 [OFPT_ERROR (OF1.2) (xid=0x2): OFPQOFC_BAD_PORT
282 OFPT_QUEUE_GET_CONFIG_REQUEST (OF1.2) (xid=0x2): port=10
287 dnl This is really bare-bones.
288 dnl It at least checks request and reply serialization and deserialization.
289 dnl Actions definition listed in both supported formats (w/ actions=)
290 AT_SETUP([ofproto - no group support (OpenFlow 1.0)])
292 AT_DATA([groups.txt], [dnl
293 group_id=1234,type=all,bucket=output:10
294 group_id=1235,type=all,bucket=actions=output:10
296 AT_DATA([stderr], [dnl
297 ovs-ofctl: none of the usable flow formats (OXM,OpenFlow11) is among the allowed flow formats (OpenFlow10,NXM)
299 AT_CHECK([ovs-ofctl -O OpenFlow10 -vwarn add-groups br0 groups.txt], [1], ,[stderr])
300 AT_CHECK([ovs-ofctl -O OpenFlow10 -vwarn mod-group br0 'group_id=1234,type=all,bucket=output:10'], [1], ,[stderr])
301 AT_CHECK([ovs-ofctl -O OpenFlow10 -vwarn del-groups br0], [1], ,[stderr])
302 AT_CHECK([ovs-ofctl -O OpenFlow10 -vwarn dump-groups br0 ], [1], ,[stderr])
306 dnl This is really bare-bones.
307 dnl It at least checks request and reply serialization and deserialization.
308 dnl Actions definition listed in both supported formats (w/ actions=)
309 AT_SETUP([ofproto - del group (OpenFlow 1.1)])
311 AT_DATA([groups.txt], [dnl
312 group_id=1234,type=all,bucket=output:10
313 group_id=1235,type=all,bucket=actions=output:10
315 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn add-groups br0 groups.txt])
316 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn dump-groups br0 ], [0], [stdout])
317 AT_CHECK([STRIP_XIDS stdout], [0], [dnl
318 OFPST_GROUP_DESC reply (OF1.1):
319 group_id=1234,type=all,bucket=actions=output:10
320 group_id=1235,type=all,bucket=actions=output:10
322 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn del-groups br0 group_id=1234])
323 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn dump-groups br0], [0], [stdout])
324 AT_CHECK([STRIP_XIDS stdout], [0], [dnl
325 OFPST_GROUP_DESC reply (OF1.1):
326 group_id=1235,type=all,bucket=actions=output:10
328 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn del-groups br0 group_id=1234])
329 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn dump-groups br0], [0], [stdout])
330 AT_CHECK([STRIP_XIDS stdout], [0], [dnl
331 OFPST_GROUP_DESC reply (OF1.1):
332 group_id=1235,type=all,bucket=actions=output:10
334 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn del-groups br0], [0])
335 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn dump-groups br0], [0], [stdout])
336 AT_CHECK([STRIP_XIDS stdout], [0], [dnl
337 OFPST_GROUP_DESC reply (OF1.1):
341 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn del-groups br0 group_id=0xfffffff0],
342 [1], [], [ovs-ofctl: invalid group id 4294967280
347 dnl This is really bare-bones.
348 dnl It at least checks request and reply serialization and deserialization.
349 dnl Actions definition listed in both supported formats (w/ actions=)
350 AT_SETUP([ofproto - add indirect group])
352 dnl indirect group must have exactly one bucket
353 AT_DATA([stderr], [dnl
354 OFPT_ERROR (OF1.1) (xid=0x2): OFPGMFC_INVALID_GROUP
355 OFPT_GROUP_MOD (OF1.1) (xid=0x2): ***decode error: OFPGMFC_INVALID_GROUP***
357 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn add-group br0 'group_id=1234,type=indirect'], [1], , [stderr])
358 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn add-group br0 'group_id=1235,type=indirect,bucket=output:10'])
359 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn add-group br0 'group_id=1236,type=indirect,bucket=output:10,bucket=output:11'], [1], , [stderr])
363 dnl This is really bare-bones.
364 dnl It at least checks request and reply serialization and deserialization.
365 dnl Actions definition listed in both supported formats (w/ actions=)
366 AT_SETUP([ofproto - del group (OpenFlow 1.5)])
368 AT_DATA([groups.txt], [dnl
369 group_id=1233,type=select,selection_method=hash,bucket=output:10,bucket=output:11
370 group_id=1234,type=select,selection_method=hash,fields(eth_dst,ip_dst,tcp_dst),bucket=output:10,bucket=output:11
371 group_id=1235,type=all,bucket=actions=output:12,bucket=bucket_id:0,actions=output:10,bucket=bucket_id:1,actions=output:11
373 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn add-groups br0 groups.txt])
374 AT_CHECK([ovs-ofctl -F OXM-OpenFlow15 -O OpenFlow15 -vwarn dump-groups br0 1234], [0], [stdout])
375 AT_CHECK([STRIP_XIDS stdout], [0], [dnl
376 OFPST_GROUP_DESC reply (OF1.5):
377 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
379 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn del-groups br0 group_id=1234])
380 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn dump-groups br0], [0], [stdout])
381 AT_CHECK([STRIP_XIDS stdout], [0], [dnl
382 OFPST_GROUP_DESC reply (OF1.5):
383 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
384 group_id=1233,type=select,selection_method=hash,bucket=bucket_id:0,actions=output:10,bucket=bucket_id:1,actions=output:11
386 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn del-groups br0 group_id=1234])
387 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn dump-groups br0], [0], [stdout])
388 AT_CHECK([STRIP_XIDS stdout], [0], [dnl
389 OFPST_GROUP_DESC reply (OF1.5):
390 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
391 group_id=1233,type=select,selection_method=hash,bucket=bucket_id:0,actions=output:10,bucket=bucket_id:1,actions=output:11
393 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn del-groups br0], [0])
394 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn dump-groups br0], [0], [stdout])
395 AT_CHECK([STRIP_XIDS stdout], [0], [dnl
396 OFPST_GROUP_DESC reply (OF1.5):
401 dnl This is really bare-bones.
402 dnl It at least checks request and reply serialization and deserialization.
403 AT_SETUP([ofproto - del group deletes flows])
405 AT_DATA([groups.txt], [dnl
406 group_id=1234,type=all,bucket=output:10
407 group_id=1235,type=all,bucket=output:10
409 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn add-groups br0 groups.txt])
410 AT_DATA([flows.txt], [dnl
411 tcp actions=group:1234
412 table=2 udp actions=group:1235
414 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn add-flows br0 flows.txt])
415 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn dump-flows br0 | ofctl_strip | sort],
417 table=2, udp actions=group:1235
418 tcp actions=group:1234
419 OFPST_FLOW reply (OF1.1):
421 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn del-groups br0 group_id=1234])
422 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn dump-flows br0 | ofctl_strip | sort],
424 table=2, udp actions=group:1235
425 OFPST_FLOW reply (OF1.1):
427 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn del-groups br0 group_id=1234])
428 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn dump-flows br0 | ofctl_strip | sort],
430 table=2, udp actions=group:1235
431 OFPST_FLOW reply (OF1.1):
433 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn del-groups br0])
434 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn dump-flows br0 | ofctl_strip | sort],
436 OFPST_FLOW reply (OF1.1):
441 dnl This is really bare-bones.
442 dnl It at least checks request and reply serialization and deserialization.
443 dnl Actions definition listed in both supported formats (w/ actions=)
444 AT_SETUP([ofproto - insert buckets])
446 # Add group with no buckets.
447 AT_DATA([groups.txt], [dnl
448 group_id=1234,type=all
450 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn add-groups br0 groups.txt])
451 AT_CHECK([ovs-ofctl -F OXM-OpenFlow15 -O OpenFlow15 -vwarn dump-groups br0 1234], [0], [stdout])
452 AT_CHECK([STRIP_XIDS stdout], [0], [dnl
453 OFPST_GROUP_DESC reply (OF1.5):
454 group_id=1234,type=all
457 # Add two buckets, using "last".
458 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])
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=all,bucket=bucket_id:10,actions=output:10,bucket=bucket_id:11,actions=output:11
465 # Start over again, then add two buckets using "first".
466 AT_CHECK([ovs-ofctl -O OpenFlow15 --strict del-groups br0 group_id=1234])
467 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn add-group br0 group_id=1234,type=all])
468 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])
469 AT_CHECK([ovs-ofctl -F OXM-OpenFlow15 -O OpenFlow15 -vwarn dump-groups br0 1234], [0], [stdout])
470 AT_CHECK([STRIP_XIDS stdout], [0], [dnl
471 OFPST_GROUP_DESC reply (OF1.5):
472 group_id=1234,type=all,bucket=bucket_id:10,actions=output:10,bucket=bucket_id:11,actions=output:11
475 # Add two more buckets before the existing ones.
476 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])
477 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn dump-groups br0], [0], [stdout])
478 AT_CHECK([STRIP_XIDS stdout], [0], [dnl
479 OFPST_GROUP_DESC reply (OF1.5):
480 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
483 # Add another bucket at the end.
484 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])
485 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn dump-groups br0], [0], [stdout])
486 AT_CHECK([STRIP_XIDS stdout], [0], [dnl
487 OFPST_GROUP_DESC reply (OF1.5):
488 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
491 # Verify that duplicate bucket IDs are rejected.
492 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])
493 AT_CHECK([STRIP_XIDS stderr | sed '/truncated/,$d'], [0], [dnl
494 OFPT_ERROR (OF1.5): OFPGMFC_BUCKET_EXISTS
495 OFPT_GROUP_MOD (OF1.5):
499 # Add another bucket just before bucket 15.
500 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn insert-buckets br0 group_id=1234,command_bucket_id=15])
501 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn dump-groups br0], [0], [stdout])
502 AT_CHECK([STRIP_XIDS stdout], [0], [dnl
503 OFPST_GROUP_DESC reply (OF1.5):
504 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
507 # Add two more buckets just before bucket 11,
508 # getting the command from a file.
509 AT_DATA([buckets.txt], [dnl
510 group_id=1234,command_bucket_id=11,bucket=bucket_id:12,actions=output:12,bucket=bucket_id:13,actions=output:13
512 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn insert-buckets br0 - < buckets.txt])
513 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn dump-groups br0], [0], [stdout])
514 AT_CHECK([STRIP_XIDS stdout], [0], [dnl
515 OFPST_GROUP_DESC reply (OF1.5):
516 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
519 # Add yet two more buckets.
520 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])
521 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn dump-groups br0], [0], [stdout])
522 AT_CHECK([STRIP_XIDS stdout], [0], [dnl
523 OFPST_GROUP_DESC reply (OF1.5):
524 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
528 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], [],
529 [ovs-ofctl: invalid command bucket id 4294967041
531 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], [],
532 [ovs-ofctl: insert-bucket needs OpenFlow 1.5 or later ('-O OpenFlow15')
537 dnl This is really bare-bones.
538 dnl It at least checks request and reply serialization and deserialization.
539 dnl Actions definition listed in both supported formats (w/ actions=)
540 AT_SETUP([ofproto - remove buckets])
542 AT_DATA([groups.txt], [dnl
543 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
545 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn add-groups br0 groups.txt])
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,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
551 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn remove-buckets br0 group_id=1234,command_bucket_id=first])
552 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn dump-groups br0], [0], [stdout])
553 AT_CHECK([STRIP_XIDS stdout], [0], [dnl
554 OFPST_GROUP_DESC reply (OF1.5):
555 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
557 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn remove-buckets br0 group_id=1234,command_bucket_id=last])
558 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn dump-groups br0], [0], [stdout])
559 AT_CHECK([STRIP_XIDS stdout], [0], [dnl
560 OFPST_GROUP_DESC reply (OF1.5):
561 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
563 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn remove-buckets br0 group_id=1234,command_bucket_id=13])
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: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
569 AT_DATA([buckets.txt], [dnl
572 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn remove-buckets br0 - < buckets.txt])
573 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn dump-groups br0], [0], [stdout])
574 AT_CHECK([STRIP_XIDS stdout], [0], [dnl
575 OFPST_GROUP_DESC reply (OF1.5):
576 group_id=1234,type=all
578 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn remove-buckets br0 group_id=1234,command_bucket_id=first])
579 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn remove-buckets br0 group_id=1234,command_bucket_id=last])
580 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn remove-buckets br0 group_id=1234,command_bucket_id=all])
581 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn remove-buckets br0 group_id=1234,command_bucket_id=1], [1], [], [stderr])
582 AT_CHECK([cat stderr | ofctl_strip], [0], [dnl
583 OFPT_ERROR (OF1.5): OFPGMFC_UNKNOWN_BUCKET
584 OFPT_GROUP_MOD (OF1.5):
585 REMOVE_BUCKET command_bucket_id:1,group_id=1234
588 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn remove-buckets br0 group_id=1234,command_bucket_id=last], [1], [],
589 [ovs-ofctl: remove-bucket needs OpenFlow 1.5 or later ('-O OpenFlow15')
594 dnl This is really bare-bones.
595 dnl It at least checks request and reply serialization and deserialization.
596 AT_SETUP([ofproto - flow mod checks group availability])
598 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn add-group br0 group_id=1234,type=all,bucket=output:10])
599 AT_DATA([flows.txt], [dnl
600 tcp actions=group:1234
601 udp actions=group:1235
603 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn add-flow br0 'tcp actions=group:1234'])
604 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn add-flow br0 'tcp actions=group:1235'], [1], [], [stderr])
606 # The output should look like this:
608 # 00000000 02 0e 00 98 00 00 00 02-00 00 00 00 00 00 00 00 |................|
609 # 00000010 00 00 00 00 00 00 00 00-ff 00 00 00 00 00 80 00 |................|
610 # 00000020 ff ff ff ff ff ff ff ff-ff ff ff ff 00 00 00 00 |................|
611 # 00000030 00 00 00 58 00 00 00 00-00 00 03 d7 00 00 00 00 |...X............|
613 # This 'sed' command captures the error message but drops details.
614 AT_CHECK([sed '/truncated/d
615 /^000000.0/d' stderr | STRIP_XIDS], [0],
616 [OFPT_ERROR (OF1.1): OFPBAC_BAD_OUT_GROUP
617 OFPT_FLOW_MOD (OF1.1):
622 dnl This is really bare-bones.
623 dnl It at least checks request and reply serialization and deserialization.
624 AT_SETUP([ofproto - group description])
626 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn add-group br0 group_id=1234,type=all,bucket=output:10], [0], [stdout])
627 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn dump-groups br0], [0], [stdout])
628 AT_CHECK([STRIP_XIDS stdout], [0], [dnl
629 OFPST_GROUP_DESC reply (OF1.1):
630 group_id=1234,type=all,bucket=actions=output:10
635 dnl This is really bare-bones.
636 dnl It at least checks request and reply serialization and deserialization.
637 AT_SETUP([ofproto - group description])
639 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn add-group br0 group_id=1234,type=all,bucket=output:10])
640 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn dump-groups br0], [0], [stdout])
641 AT_CHECK([STRIP_XIDS stdout], [0], [dnl
642 OFPST_GROUP_DESC reply (OF1.1):
643 group_id=1234,type=all,bucket=actions=output:10
648 dnl This is really bare-bones.
649 dnl It at least checks request and reply serialization and deserialization.
650 AT_SETUP([ofproto - group features])
652 AT_CHECK([ovs-ofctl -O OpenFlow12 -vwarn dump-group-features br0], [0], [stdout])
653 AT_CHECK([STRIP_XIDS stdout], [0], [dnl
654 OFPST_GROUP_FEATURES reply (OF1.2):
659 max_groups=0xffffff00
660 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
662 max_groups=0xffffff00
663 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
665 max_groups=0xffffff00
666 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
668 max_groups=0xffffff00
669 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
674 dnl This is really bare-bones.
675 dnl It at least checks request and reply serialization and deserialization.
676 AT_SETUP([ofproto - group stats (OpenFlow 1.1)])
678 AT_DATA([groups.txt], [dnl
679 group_id=1234,type=all,bucket=output:10
680 group_id=1235,type=all,bucket=output:10
682 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn add-groups br0 groups.txt])
683 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn add-flow br0 'tcp actions=group:1234'])
684 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn dump-group-stats br0 group_id=1234], [0], [stdout])
685 AT_CHECK([STRIP_XIDS stdout | sort], [0], [dnl
686 group_id=1234,ref_count=1,packet_count=0,byte_count=0,bucket0:packet_count=0,byte_count=0
687 OFPST_GROUP reply (OF1.1):
689 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn dump-group-stats br0], [0], [stdout])
690 AT_CHECK([STRIP_XIDS stdout | sort], [0], [dnl
691 group_id=1234,ref_count=1,packet_count=0,byte_count=0,bucket0:packet_count=0,byte_count=0
692 group_id=1235,ref_count=0,packet_count=0,byte_count=0,bucket0:packet_count=0,byte_count=0
693 OFPST_GROUP reply (OF1.1):
698 dnl This is really bare-bones.
699 dnl It at least checks request and reply serialization and deserialization.
700 AT_SETUP([ofproto - group stats (OpenFlow 1.3)])
702 AT_DATA([groups.txt], [dnl
703 group_id=1234,type=all,bucket=output:10
704 group_id=1235,type=all,bucket=output:10
706 AT_CHECK([ovs-ofctl -O OpenFlow13 -vwarn add-groups br0 groups.txt])
707 AT_CHECK([ovs-ofctl -O OpenFlow13 -vwarn add-flow br0 'tcp actions=group:1234'])
708 AT_CHECK([ovs-ofctl -O OpenFlow13 -vwarn dump-group-stats br0 group_id=1234], [0], [stdout])
709 AT_CHECK([STRIP_XIDS stdout | sed 's/duration=[[0-9.]]*s/duration=?s/' | sort], [0], [dnl
710 group_id=1234,duration=?s,ref_count=1,packet_count=0,byte_count=0,bucket0:packet_count=0,byte_count=0
711 OFPST_GROUP reply (OF1.3):
713 AT_CHECK([ovs-ofctl -O OpenFlow13 -vwarn dump-group-stats br0], [0], [stdout])
714 AT_CHECK([STRIP_XIDS stdout | sed 's/duration=[[0-9.]]*s/duration=?s/' | sort], [0], [dnl
715 group_id=1234,duration=?s,ref_count=1,packet_count=0,byte_count=0,bucket0:packet_count=0,byte_count=0
716 group_id=1235,duration=?s,ref_count=0,packet_count=0,byte_count=0,bucket0:packet_count=0,byte_count=0
717 OFPST_GROUP reply (OF1.3):
722 dnl This is really bare-bones.
723 dnl It at least checks request and reply serialization and deserialization.
724 AT_SETUP([ofproto - group stats (OpenFlow 1.5)])
726 AT_DATA([groups.txt], [dnl
727 group_id=1234,type=all,bucket=output:10
728 group_id=1235,type=all,bucket=output:10
730 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn add-groups br0 groups.txt])
731 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn add-flow br0 'tcp actions=group:1234'])
732 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn dump-group-stats br0 group_id=1234], [0], [stdout])
733 AT_CHECK([STRIP_XIDS stdout | sed 's/duration=[[0-9.]]*s/duration=?s/' | sort], [0], [dnl
734 group_id=1234,duration=?s,ref_count=1,packet_count=0,byte_count=0,bucket0:packet_count=0,byte_count=0
735 OFPST_GROUP reply (OF1.5):
737 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn dump-group-stats br0], [0], [stdout])
738 AT_CHECK([STRIP_XIDS stdout | sed 's/duration=[[0-9.]]*s/duration=?s/' | sort], [0], [dnl
739 group_id=1234,duration=?s,ref_count=1,packet_count=0,byte_count=0,bucket0:packet_count=0,byte_count=0
740 group_id=1235,duration=?s,ref_count=0,packet_count=0,byte_count=0,bucket0:packet_count=0,byte_count=0
741 OFPST_GROUP reply (OF1.5):
746 dnl This found a use-after-free error in bridge destruction in the
747 dnl presence of groups.
748 AT_SETUP([ofproto - group add then bridge delete (OpenFlow 1.3)])
750 AT_DATA([groups.txt], [dnl
751 group_id=1234,type=all,bucket=output:10
752 group_id=1235,type=all,bucket=output:10
754 AT_CHECK([ovs-ofctl -O OpenFlow13 -vwarn add-groups br0 groups.txt])
755 AT_CHECK([ovs-vsctl del-br br0])
759 AT_SETUP([ofproto - mod-port (OpenFlow 1.0)])
761 for command_config_state in \
763 'noflood NO_FLOOD 0' \
764 'down PORT_DOWN,NO_FLOOD LINK_DOWN' \
765 'flood PORT_DOWN LINK_DOWN' \
766 'no-receive PORT_DOWN,NO_RECV LINK_DOWN' \
767 'no-forward PORT_DOWN,NO_RECV,NO_FWD LINK_DOWN' \
768 'no-packet-in PORT_DOWN,NO_RECV,NO_FWD,NO_PACKET_IN LINK_DOWN' \
769 'forward PORT_DOWN,NO_RECV,NO_PACKET_IN LINK_DOWN' \
770 'packet-in PORT_DOWN,NO_RECV LINK_DOWN' \
774 set $command_config_state
775 command=$[1] config=`echo $[2] | sed 's/,/ /g'` state=$[3]
776 AT_CHECK([ovs-ofctl -vwarn mod-port br0 br0 $command])
777 AT_CHECK([ovs-ofctl -vwarn show br0], [0], [stdout])
778 AT_CHECK_UNQUOTED([STRIP_XIDS stdout], [0], [dnl
779 OFPT_FEATURES_REPLY: dpid:fedcba9876543210
780 n_tables:254, n_buffers:256
781 capabilities: FLOW_STATS TABLE_STATS PORT_STATS QUEUE_STATS ARP_MATCH_IP
782 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
783 LOCAL(br0): addr:aa:55:aa:55:00:00
786 speed: 0 Mbps now, 0 Mbps max
787 OFPT_GET_CONFIG_REPLY: frags=normal miss_send_len=0
793 AT_SETUP([ofproto - mod-port (OpenFlow 1.2)])
795 for command_config_state in \
797 'down PORT_DOWN LINK_DOWN' \
798 'no-receive PORT_DOWN,NO_RECV LINK_DOWN' \
799 'no-forward PORT_DOWN,NO_RECV,NO_FWD LINK_DOWN' \
800 'no-packet-in PORT_DOWN,NO_RECV,NO_FWD,NO_PACKET_IN LINK_DOWN' \
801 'forward PORT_DOWN,NO_RECV,NO_PACKET_IN LINK_DOWN' \
802 'packet-in PORT_DOWN,NO_RECV LINK_DOWN' \
806 set $command_config_state
807 command=$[1] config=`echo $[2] | sed 's/,/ /g'` state=$[3]
808 AT_CHECK([ovs-ofctl -O OpenFlow12 -vwarn mod-port br0 br0 $command])
809 AT_CHECK([ovs-ofctl -O OpenFlow12 -vwarn show br0], [0], [stdout])
810 AT_CHECK_UNQUOTED([STRIP_XIDS stdout], [0], [dnl
811 OFPT_FEATURES_REPLY (OF1.2): dpid:fedcba9876543210
812 n_tables:254, n_buffers:256
813 capabilities: FLOW_STATS TABLE_STATS PORT_STATS GROUP_STATS QUEUE_STATS
814 LOCAL(br0): addr:aa:55:aa:55:00:00
817 speed: 0 Mbps now, 0 Mbps max
818 OFPT_GET_CONFIG_REPLY (OF1.2): frags=normal miss_send_len=0
824 AT_SETUP([ofproto - mod-port (OpenFlow 1.4)])
826 for command_config_state in \
828 'down PORT_DOWN LINK_DOWN' \
829 'no-receive PORT_DOWN,NO_RECV LINK_DOWN' \
830 'no-forward PORT_DOWN,NO_RECV,NO_FWD LINK_DOWN' \
831 'no-packet-in PORT_DOWN,NO_RECV,NO_FWD,NO_PACKET_IN LINK_DOWN' \
832 'forward PORT_DOWN,NO_RECV,NO_PACKET_IN LINK_DOWN' \
833 'packet-in PORT_DOWN,NO_RECV LINK_DOWN' \
837 set $command_config_state
838 command=$[1] config=`echo $[2] | sed 's/,/ /g'` state=$[3]
839 AT_CHECK([ovs-ofctl -O OpenFlow14 -vwarn mod-port br0 br0 $command])
840 AT_CHECK([ovs-ofctl -O OpenFlow14 -vwarn show br0], [0], [stdout])
841 AT_CHECK_UNQUOTED([STRIP_XIDS stdout], [0], [dnl
842 OFPT_FEATURES_REPLY (OF1.4): dpid:fedcba9876543210
843 n_tables:254, n_buffers:256
844 capabilities: FLOW_STATS TABLE_STATS PORT_STATS GROUP_STATS QUEUE_STATS
845 OFPST_PORT_DESC reply (OF1.4):
846 LOCAL(br0): addr:aa:55:aa:55:00:00
849 speed: 0 Mbps now, 0 Mbps max
850 OFPT_GET_CONFIG_REPLY (OF1.4): frags=normal miss_send_len=0
856 AT_SETUP([ofproto - basic flow_mod commands (NXM)])
858 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip], [0], [NXST_FLOW reply:
860 AT_CHECK([echo 'in_port=2,actions=1' | ovs-ofctl add-flows br0 -])
861 AT_CHECK([ovs-ofctl add-flow br0 in_port=1,actions=2])
862 AT_CHECK([ovs-ofctl -F nxm add-flow br0 table=1,in_port=4,actions=3])
863 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
864 in_port=1 actions=output:2
865 in_port=2 actions=output:1
866 table=1, in_port=4 actions=output:3
869 AT_CHECK([ovs-ofctl dump-aggregate br0 table=0 | STRIP_XIDS], [0], [dnl
870 NXST_AGGREGATE reply: packet_count=0 byte_count=0 flow_count=2
872 AT_CHECK([ovs-ofctl del-flows br0])
873 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip], [0], [NXST_FLOW reply:
878 AT_SETUP([ofproto - basic flow_mod commands (OpenFlow 1.0)])
880 AT_CHECK([ovs-ofctl -F openflow10 dump-flows br0 | ofctl_strip], [0], [OFPST_FLOW reply:
882 AT_CHECK([echo 'in_port=2,actions=1' | ovs-ofctl -F openflow10 add-flows br0 -])
883 AT_CHECK([ovs-ofctl -F openflow10 add-flow br0 in_port=1,actions=2])
884 AT_CHECK([ovs-ofctl -F openflow10 add-flow br0 table=1,in_port=4,actions=3])
885 AT_CHECK([ovs-ofctl -F openflow10 dump-flows br0 | ofctl_strip | sort], [0], [dnl
886 in_port=1 actions=output:2
887 in_port=2 actions=output:1
888 table=1, in_port=4 actions=output:3
891 AT_CHECK([ovs-ofctl -F openflow10 dump-aggregate br0 table=0 | STRIP_XIDS], [0], [dnl
892 OFPST_AGGREGATE reply: packet_count=0 byte_count=0 flow_count=2
894 AT_CHECK([ovs-ofctl -F openflow10 del-flows br0])
895 AT_CHECK([ovs-ofctl -F openflow10 dump-flows br0 | ofctl_strip], [0], [OFPST_FLOW reply:
900 # It's really dumb that check_overlap and reset_counts are considered
901 # part of flow state, but OpenFlow implies that it is, and OFTest and
902 # some users insist on it.
903 AT_SETUP([ofproto - add-flow and flags])
905 AT_CHECK([ovs-ofctl -F openflow10 add-flow br0 check_overlap,in_port=1,actions=drop])
906 # Prior to OF1.3, flow dumps didn't include a "flags" field.
907 AT_CHECK([ovs-ofctl -F openflow10 dump-flows br0 | ofctl_strip], [0], [dnl
909 in_port=1 actions=drop
911 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip], [0], [dnl
912 OFPST_FLOW reply (OF1.1):
913 in_port=1 actions=drop
915 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip], [0], [dnl
916 OFPST_FLOW reply (OF1.2):
917 in_port=1 actions=drop
919 # OF1.3 makes the flags visible.
920 AT_CHECK([ovs-ofctl -O OpenFlow13 dump-flows br0 | ofctl_strip], [0], [dnl
921 OFPST_FLOW reply (OF1.3):
922 check_overlap reset_counts in_port=1 actions=drop
924 AT_CHECK([ovs-ofctl -O OpenFlow14 dump-flows br0 | ofctl_strip], [0], [dnl
925 OFPST_FLOW reply (OF1.4):
926 check_overlap reset_counts in_port=1 actions=drop
928 AT_CHECK([ovs-ofctl -O OpenFlow15 dump-flows br0 | ofctl_strip], [0], [dnl
929 OFPST_FLOW reply (OF1.5):
930 check_overlap reset_counts in_port=1 actions=drop
935 AT_SETUP([ofproto - basic flow_mod commands (OpenFlow 1.1)])
937 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip], [0], [OFPST_FLOW reply (OF1.1):
939 AT_CHECK([echo 'in_port=2,actions=1' | ovs-ofctl -O OpenFlow11 add-flows br0 -])
940 AT_CHECK([ovs-ofctl -O OpenFlow11 add-flow br0 in_port=1,actions=2])
941 AT_CHECK([ovs-ofctl -O OpenFlow11 add-flow br0 table=1,in_port=4,actions=3])
942 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0], [dnl
943 in_port=1 actions=output:2
944 in_port=2 actions=output:1
945 table=1, in_port=4 actions=output:3
946 OFPST_FLOW reply (OF1.1):
948 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-aggregate br0 table=0 | STRIP_XIDS], [0], [dnl
949 OFPST_AGGREGATE reply (OF1.1): packet_count=0 byte_count=0 flow_count=2
951 AT_CHECK([ovs-ofctl -O OpenFlow11 del-flows br0])
952 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip], [0], [OFPST_FLOW reply (OF1.1):
953 table=1, in_port=4 actions=output:3
958 AT_SETUP([ofproto - flow_mod negative test (OpenFlow 1.1)])
960 [set bridge br0 protocols=OpenFlow10,OpenFlow11,OpenFlow12,OpenFlow13])
961 AT_CHECK([ovs-ofctl add-flow -O OpenFlow11 br0 table=1,action=goto_table:2])
963 # The error message here actually comes from ovs-ofctl, not from ovs-vswitchd,
964 # but at least it's the same code in ofpacts_check() that issues the error.
965 AT_CHECK([ovs-ofctl add-flow -O OpenFlow11 br0 table=1,action=goto_table:1],
967 [ovs-ofctl: actions are invalid with specified match (OFPBIC_BAD_TABLE_ID)
972 AT_SETUP([ofproto - set-field flow_mod commands (NXM)])
974 AT_CHECK([ovs-ofctl add-flow br0 ipv6,table=1,in_port=3,actions=drop])
975 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])
976 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])
977 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
978 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[[]]
979 table=1, ipv6,in_port=3 actions=load:0xa6badbfffefe59fa->NXM_NX_IPV6_SRC[[0..63]],load:0xfe8001234567890a->NXM_NX_IPV6_SRC[[64..127]]
985 AT_SETUP([ofproto - basic flow_mod commands (OpenFlow 1.2)])
987 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip], [0], [OFPST_FLOW reply (OF1.2):
989 AT_CHECK([echo 'in_port=2,actions=1' | ovs-ofctl -O OpenFlow12 add-flows br0 -])
990 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 in_port=1,actions=2])
991 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 table=1,in_port=4,actions=3])
992 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
993 in_port=1 actions=output:2
994 in_port=2 actions=output:1
995 table=1, in_port=4 actions=output:3
996 OFPST_FLOW reply (OF1.2):
998 AT_CHECK([ovs-ofctl -O OpenFlow12 del-flows br0])
999 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip], [0], [OFPST_FLOW reply (OF1.2):
1004 AT_SETUP([ofproto - set-field flow_mod commands (OF1.2)])
1006 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 ipv6,table=1,in_port=3,actions=drop])
1007 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])
1008 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])
1009 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1010 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
1011 table=1, ipv6,in_port=3 actions=set_field:fe80:123:4567:890a:a6ba:dbff:fefe:59fa->ipv6_src
1012 OFPST_FLOW reply (OF1.2):
1017 AT_SETUP([ofproto - dump flows with cookie])
1019 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x1,in_port=1,actions=1])
1020 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x2,in_port=2,actions=1])
1021 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x3,in_port=3,actions=1])
1022 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1023 cookie=0x1, in_port=1 actions=output:1
1024 cookie=0x2, in_port=2 actions=output:1
1025 cookie=0x3, in_port=3 actions=output:1
1028 AT_CHECK([ovs-ofctl dump-aggregate br0 table=0 | STRIP_XIDS], [0], [dnl
1029 NXST_AGGREGATE reply: packet_count=0 byte_count=0 flow_count=3
1031 AT_CHECK([ovs-ofctl dump-flows br0 cookie=0x3/-1 | ofctl_strip | sort], [0], [dnl
1032 cookie=0x3, in_port=3 actions=output:1
1035 AT_CHECK([ovs-ofctl dump-aggregate br0 cookie=0x3/-1 | STRIP_XIDS], [0], [dnl
1036 NXST_AGGREGATE reply: packet_count=0 byte_count=0 flow_count=1
1041 AT_SETUP([ofproto - mod flow with cookie change (OpenFlow 1.0)])
1043 AT_CHECK([ovs-ofctl -F openflow10 add-flow br0 cookie=0x1,in_port=1,actions=1])
1044 AT_CHECK([ovs-ofctl -F openflow10 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1045 cookie=0x1, in_port=1 actions=output:1
1049 AT_CHECK([ovs-ofctl -F openflow10 mod-flows br0 cookie=0x2,in_port=1,actions=1])
1050 AT_CHECK([ovs-ofctl -F openflow10 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1051 cookie=0x2, in_port=1 actions=output:1
1057 AT_SETUP([ofproto - mod flow with cookie change (NXM)])
1059 AT_CHECK([ovs-ofctl -F nxm add-flow br0 cookie=0x1,in_port=1,actions=1])
1060 AT_CHECK([ovs-ofctl -F nxm dump-flows br0 | ofctl_strip | sort], [0], [dnl
1061 cookie=0x1, in_port=1 actions=output:1
1065 AT_CHECK([ovs-ofctl -F nxm mod-flows br0 cookie=0x2,in_port=1,actions=1])
1066 AT_CHECK([ovs-ofctl -F nxm dump-flows br0 | ofctl_strip | sort], [0], [dnl
1067 cookie=0x2, in_port=1 actions=output:1
1073 AT_SETUP([ofproto - no mod flow with cookie change (OpenFlow 1.1)])
1075 AT_CHECK([ovs-ofctl -O OpenFlow11 add-flow br0 cookie=0x1,in_port=1,actions=1])
1076 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1077 cookie=0x1, in_port=1 actions=output:1
1078 OFPST_FLOW reply (OF1.1):
1080 AT_CHECK([ovs-ofctl -O OpenFlow11 mod-flows br0 cookie=0x2,in_port=1,actions=1])
1081 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1082 cookie=0x1, in_port=1 actions=output:1
1083 OFPST_FLOW reply (OF1.1):
1088 dnl The OpenFlow 1.2 spec states that the cookie may not be modified
1089 AT_SETUP([ofproto - no mod flow with cookie change (OpenFlow 1.2)])
1091 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 cookie=0x1,in_port=1,actions=1])
1092 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1093 cookie=0x1, in_port=1 actions=output:1
1094 OFPST_FLOW reply (OF1.2):
1097 AT_CHECK([ovs-ofctl -O OpenFlow12 mod-flows br0 cookie=0x2,in_port=1,actions=1])
1098 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1099 cookie=0x1, in_port=1 actions=output:1
1100 OFPST_FLOW reply (OF1.2):
1105 AT_SETUP([ofproto - mod flows based on cookie mask (OpenFlow 1.0)])
1107 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x1,in_port=1,actions=1])
1108 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x1,in_port=2,actions=1])
1109 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x2,in_port=3,actions=1])
1110 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1111 cookie=0x1, in_port=1 actions=output:1
1112 cookie=0x1, in_port=2 actions=output:1
1113 cookie=0x2, in_port=3 actions=output:1
1117 AT_CHECK([ovs-ofctl -F nxm mod-flows br0 cookie=0x1/0xff,actions=4])
1118 AT_CHECK([ovs-ofctl -F nxm dump-flows br0 | ofctl_strip | sort], [0], [dnl
1119 cookie=0x1, in_port=1 actions=output:4
1120 cookie=0x1, in_port=2 actions=output:4
1121 cookie=0x2, in_port=3 actions=output:1
1127 AT_SETUP([ofproto - mod flows based on cookie mask (OpenFlow 1.1)])
1129 AT_CHECK([ovs-ofctl -O OpenFlow11 add-flow br0 cookie=0x1,in_port=1,actions=1])
1130 AT_CHECK([ovs-ofctl -O OpenFlow11 add-flow br0 cookie=0x1,in_port=2,actions=1])
1131 AT_CHECK([ovs-ofctl -O OpenFlow11 add-flow br0 cookie=0x2,in_port=3,actions=1])
1132 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1133 cookie=0x1, in_port=1 actions=output:1
1134 cookie=0x1, in_port=2 actions=output:1
1135 cookie=0x2, in_port=3 actions=output:1
1136 OFPST_FLOW reply (OF1.1):
1139 AT_CHECK([ovs-ofctl -O OpenFlow11 mod-flows br0 cookie=0x1/0xff,actions=4])
1140 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1141 cookie=0x1, in_port=1 actions=output:4
1142 cookie=0x1, in_port=2 actions=output:4
1143 cookie=0x2, in_port=3 actions=output:1
1144 OFPST_FLOW reply (OF1.1):
1149 AT_SETUP([ofproto - mod flows based on cookie mask (OpenFlow 1.2)])
1151 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 cookie=0x1,in_port=1,actions=1])
1152 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 cookie=0x1,in_port=2,actions=1])
1153 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 cookie=0x2,in_port=3,actions=1])
1154 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1155 cookie=0x1, in_port=1 actions=output:1
1156 cookie=0x1, in_port=2 actions=output:1
1157 cookie=0x2, in_port=3 actions=output:1
1158 OFPST_FLOW reply (OF1.2):
1161 AT_CHECK([ovs-ofctl -O OpenFlow12 mod-flows br0 cookie=0x1/0xff,actions=4])
1162 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1163 cookie=0x1, in_port=1 actions=output:4
1164 cookie=0x1, in_port=2 actions=output:4
1165 cookie=0x2, in_port=3 actions=output:1
1166 OFPST_FLOW reply (OF1.2):
1171 dnl The OpenFlow 1.2 spec states that the cookie may not be modified
1172 AT_SETUP([ofproto - mod flows based on cookie mask with cookie change])
1174 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x1,in_port=1,actions=1])
1175 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x1,in_port=2,actions=1])
1176 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x2,in_port=3,actions=1])
1177 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1178 cookie=0x1, in_port=1 actions=output:1
1179 cookie=0x1, in_port=2 actions=output:1
1180 cookie=0x2, in_port=3 actions=output:1
1184 AT_CHECK([ovs-ofctl -F nxm mod-flows br0 cookie=1/-1,cookie=4,actions=4])
1185 AT_CHECK([ovs-ofctl -F nxm dump-flows br0 | ofctl_strip | sort], [0], [dnl
1186 cookie=0x2, in_port=3 actions=output:1
1187 cookie=0x4, in_port=1 actions=output:4
1188 cookie=0x4, in_port=2 actions=output:4
1194 AT_SETUP([ofproto - mod flow with cookie miss (mask==0) - NXM])
1196 AT_CHECK([ovs-ofctl -F nxm mod-flows br0 in_port=1,actions=1])
1197 AT_CHECK([ovs-ofctl -F nxm dump-flows br0 | ofctl_strip | sort], [0], [dnl
1198 in_port=1 actions=output:1
1204 AT_SETUP([ofproto - mod flow with cookie miss (mask==0) - OF1.1])
1206 AT_CHECK([ovs-ofctl -O openflow11 mod-flows br0 in_port=1,actions=1])
1207 AT_CHECK([ovs-ofctl -O openflow11 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1208 in_port=1 actions=output:1
1209 OFPST_FLOW reply (OF1.1):
1214 AT_SETUP([ofproto - mod flow with cookie miss (mask==0) - OF1.2])
1216 AT_CHECK([ovs-ofctl -O openflow12 mod-flows br0 in_port=1,actions=1])
1217 AT_CHECK([ovs-ofctl -O openflow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1218 OFPST_FLOW reply (OF1.2):
1223 AT_SETUP([ofproto - mod flow with cookie miss (mask!=0) - NXM])
1225 AT_CHECK([ovs-ofctl -F nxm mod-flows br0 cookie=1/1,in_port=1,actions=1])
1226 AT_CHECK([ovs-ofctl -F nxm dump-flows br0 | ofctl_strip | sort], [0], [dnl
1232 AT_SETUP([ofproto - mod flow with cookie miss (mask!=0) - OF1.1])
1234 AT_CHECK([ovs-ofctl -O openflow11 mod-flows br0 cookie=1/1,in_port=1,actions=1])
1235 AT_CHECK([ovs-ofctl -O openflow11 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1236 OFPST_FLOW reply (OF1.1):
1241 AT_SETUP([ofproto - mod flow with cookie miss (mask!=0) - OF1.2])
1243 AT_CHECK([ovs-ofctl -O openflow12 mod-flows br0 cookie=1/1,in_port=1,actions=1])
1244 AT_CHECK([ovs-ofctl -O openflow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1245 OFPST_FLOW reply (OF1.2):
1250 AT_SETUP([ofproto - del flows with cookies])
1252 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x1,in_port=1,actions=1])
1253 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x2,in_port=2,actions=1])
1254 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x3,in_port=3,actions=1])
1255 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1256 cookie=0x1, in_port=1 actions=output:1
1257 cookie=0x2, in_port=2 actions=output:1
1258 cookie=0x3, in_port=3 actions=output:1
1262 AT_CHECK([ovs-ofctl del-flows br0])
1263 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1269 AT_SETUP([ofproto - del flows based on cookie])
1271 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x1,in_port=1,actions=1])
1272 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x2,in_port=2,actions=1])
1273 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x3,in_port=3,actions=1])
1274 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1275 cookie=0x1, in_port=1 actions=output:1
1276 cookie=0x2, in_port=2 actions=output:1
1277 cookie=0x3, in_port=3 actions=output:1
1281 AT_CHECK([ovs-ofctl del-flows br0 cookie=0x3/-1])
1282 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1283 cookie=0x1, in_port=1 actions=output:1
1284 cookie=0x2, in_port=2 actions=output:1
1290 AT_SETUP([ofproto - del flows based on cookie mask])
1292 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x1,in_port=1,actions=1])
1293 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x2,in_port=2,actions=1])
1294 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x3,in_port=3,actions=1])
1295 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1296 cookie=0x1, in_port=1 actions=output:1
1297 cookie=0x2, in_port=2 actions=output:1
1298 cookie=0x3, in_port=3 actions=output:1
1301 AT_CHECK([ovs-ofctl del-flows br0 cookie=0x3/0x1])
1302 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1303 cookie=0x2, in_port=2 actions=output:1
1309 AT_SETUP([ofproto - del flows based on table id (NXM)])
1311 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x1,in_port=1,actions=1])
1312 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x2,in_port=2,table=1,actions=1])
1313 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1314 cookie=0x1, in_port=1 actions=output:1
1315 cookie=0x2, table=1, in_port=2 actions=output:1
1318 AT_CHECK([ovs-ofctl del-flows br0 table=0])
1319 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1320 cookie=0x2, table=1, in_port=2 actions=output:1
1323 AT_CHECK([ovs-ofctl del-flows br0 table=1])
1324 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1327 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x1,in_port=1,actions=1])
1328 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x2,in_port=2,table=1,actions=1])
1329 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1330 cookie=0x1, in_port=1 actions=output:1
1331 cookie=0x2, table=1, in_port=2 actions=output:1
1334 AT_CHECK([ovs-ofctl del-flows br0])
1335 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1341 AT_SETUP([ofproto - del flows based on table id (OpenFlow 1.1)])
1343 AT_CHECK([ovs-ofctl -O OpenFlow11 add-flow br0 cookie=0x1,in_port=1,actions=1])
1344 AT_CHECK([ovs-ofctl -O OpenFlow11 add-flow br0 cookie=0x2,in_port=2,table=1,actions=1])
1345 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1346 cookie=0x1, in_port=1 actions=output:1
1347 cookie=0x2, table=1, in_port=2 actions=output:1
1348 OFPST_FLOW reply (OF1.1):
1350 AT_CHECK([ovs-ofctl -O OpenFlow11 del-flows br0 table=0])
1351 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1352 cookie=0x2, table=1, in_port=2 actions=output:1
1353 OFPST_FLOW reply (OF1.1):
1355 AT_CHECK([ovs-ofctl -O OpenFlow11 del-flows br0 table=1])
1356 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1357 OFPST_FLOW reply (OF1.1):
1359 AT_CHECK([ovs-ofctl -O OpenFlow11 add-flow br0 cookie=0x1,in_port=1,actions=1])
1360 AT_CHECK([ovs-ofctl -O OpenFlow11 add-flow br0 cookie=0x2,in_port=2,table=1,actions=1])
1361 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1362 cookie=0x1, in_port=1 actions=output:1
1363 cookie=0x2, table=1, in_port=2 actions=output:1
1364 OFPST_FLOW reply (OF1.1):
1366 AT_CHECK([ovs-ofctl -O OpenFlow11 del-flows br0])
1367 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip], [0], [dnl
1368 OFPST_FLOW reply (OF1.1):
1369 cookie=0x2, table=1, in_port=2 actions=output:1
1374 AT_SETUP([ofproto - del flows based on table id (OpenFlow 1.2)])
1376 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 cookie=0x1,in_port=1,actions=1])
1377 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 cookie=0x2,in_port=2,table=1,actions=1])
1378 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1379 cookie=0x1, in_port=1 actions=output:1
1380 cookie=0x2, table=1, in_port=2 actions=output:1
1381 OFPST_FLOW reply (OF1.2):
1383 AT_CHECK([ovs-ofctl -O OpenFlow12 del-flows br0 table=0])
1384 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1385 cookie=0x2, table=1, in_port=2 actions=output:1
1386 OFPST_FLOW reply (OF1.2):
1388 AT_CHECK([ovs-ofctl -O OpenFlow12 del-flows br0 table=1])
1389 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1390 OFPST_FLOW reply (OF1.2):
1392 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 cookie=0x1,in_port=1,actions=1])
1393 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 cookie=0x2,in_port=2,table=1,actions=1])
1394 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1395 cookie=0x1, in_port=1 actions=output:1
1396 cookie=0x2, table=1, in_port=2 actions=output:1
1397 OFPST_FLOW reply (OF1.2):
1399 AT_CHECK([ovs-ofctl -O OpenFlow12 del-flows br0])
1400 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1401 OFPST_FLOW reply (OF1.2):
1406 AT_SETUP([ofproto - flow_mod with out_port matching (OpenFlow 1.0)])
1408 AT_DATA([flows.txt], [dnl
1409 in_port=1 actions=output:2
1410 in_port=2 actions=output:1,output:2,output:3
1411 in_port=3 actions=output:3,output:1,output:2
1412 in_port=4 actions=drop
1413 in_port=5 actions=output:3
1414 in_port=6 actions=output:1
1416 AT_CHECK([ovs-ofctl -F openflow10 add-flows br0 flows.txt])
1417 (cat flows.txt; echo 'OFPST_FLOW reply:') > expout
1418 AT_CHECK([ovs-ofctl -F openflow10 dump-flows br0 | ofctl_strip | sort], [0],
1421 (grep 'output:2' flows.txt; echo 'OFPST_FLOW reply:') > expout
1422 AT_CHECK([ovs-ofctl -F openflow10 dump-flows br0 out_port=2 | ofctl_strip | sort], [0], [expout])
1424 AT_CHECK([ovs-ofctl -F openflow10 del-flows br0 out_port=2])
1425 (grep -v 'output:2' flows.txt; echo 'OFPST_FLOW reply:') > expout
1426 AT_CHECK([ovs-ofctl -F openflow10 dump-flows br0 | ofctl_strip | sort], [0],
1429 AT_CHECK([ovs-ofctl -F openflow10 del-flows br0 out_port=3])
1430 (grep -v 'output:[[23]]' flows.txt; echo 'OFPST_FLOW reply:') > expout
1431 AT_CHECK([ovs-ofctl -F openflow10 dump-flows br0 | ofctl_strip | sort], [0],
1434 AT_CHECK([ovs-ofctl -F openflow10 del-flows br0 out_port=1])
1435 (grep -v 'output:[[123]]' flows.txt; echo 'OFPST_FLOW reply:') > expout
1436 AT_CHECK([ovs-ofctl -F openflow10 dump-flows br0 | ofctl_strip | sort], [0],
1442 AT_SETUP([ofproto - flow_mod with out_port matching (OpenFlow 1.1)])
1444 AT_DATA([flows.txt], [dnl
1445 in_port=1 actions=output:2
1446 in_port=2 actions=output:1,write_actions(output:2,output:3)
1447 in_port=3 actions=output:3,output:1,write_actions(output:2)
1448 in_port=4 actions=drop
1449 in_port=5 actions=write_actions(output:3)
1450 in_port=6 actions=output:1
1452 AT_CHECK([ovs-ofctl -O OpenFlow11 add-flows br0 flows.txt])
1453 (cat flows.txt; echo 'OFPST_FLOW reply (OF1.1):') > expout
1454 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0],
1457 (grep 'output:2' flows.txt; echo 'OFPST_FLOW reply (OF1.1):') > expout
1458 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 out_port=2 | ofctl_strip | sort], [0], [expout])
1460 AT_CHECK([ovs-ofctl -O OpenFlow11 del-flows br0 out_port=2])
1461 (grep -v 'output:2' flows.txt; echo 'OFPST_FLOW reply (OF1.1):') > expout
1462 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0],
1465 AT_CHECK([ovs-ofctl -O OpenFlow11 del-flows br0 out_port=3])
1466 (grep -v 'output:[[23]]' flows.txt; echo 'OFPST_FLOW reply (OF1.1):') > expout
1467 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0],
1470 AT_CHECK([ovs-ofctl -O OpenFlow11 del-flows br0 out_port=1])
1471 (grep -v 'output:[[123]]' flows.txt; echo 'OFPST_FLOW reply (OF1.1):') > expout
1472 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0],
1478 AT_SETUP([ofproto - flow_mod with out_group matching (OpenFlow 1.1)])
1480 AT_DATA([groups.txt], [dnl
1481 group_id=1,type=all,bucket=output:10
1482 group_id=2,type=all,bucket=output:10
1483 group_id=3,type=all,bucket=output:10
1485 AT_CHECK([ovs-ofctl -O OpenFlow11 add-groups br0 groups.txt])
1486 AT_DATA([flows.txt], [dnl
1487 in_port=1 actions=group:2,output:5
1488 in_port=2 actions=group:1,write_actions(group:2,group:3,output:6)
1489 in_port=3 actions=group:3,group:1,write_actions(group:2,output:3)
1490 in_port=4 actions=output:4
1491 in_port=5 actions=write_actions(output:4,group:3)
1492 in_port=6 actions=group:1
1494 AT_CHECK([ovs-ofctl -O OpenFlow11 add-flows br0 flows.txt])
1495 (cat flows.txt; echo 'OFPST_FLOW reply (OF1.1):') > expout
1496 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0],
1499 (grep 'output:3' flows.txt | grep 'group:2'; echo 'OFPST_FLOW reply (OF1.1):') > expout
1500 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 out_port=3,out_group=2 | ofctl_strip | sort], [0], [expout])
1502 AT_CHECK([ovs-ofctl -O OpenFlow11 del-flows br0 out_group=2])
1503 (grep -v 'group:2' flows.txt; echo 'OFPST_FLOW reply (OF1.1):') > expout
1504 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0],
1507 AT_CHECK([ovs-ofctl -O OpenFlow11 del-flows br0 out_group=3])
1508 (grep -v 'group:[[23]]' flows.txt; echo 'OFPST_FLOW reply (OF1.1):') > expout
1509 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0],
1512 AT_CHECK([ovs-ofctl -O OpenFlow11 del-flows br0 out_group=1])
1513 (grep -v 'group:[[123]]' flows.txt; echo 'OFPST_FLOW reply (OF1.1):') > expout
1514 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0],
1520 AT_SETUP([ofproto - flow table configuration (OpenFlow 1.0)])
1522 # Check the default configuration.
1524 printf 'OFPST_TABLE reply (xid=0x2):
1526 active=0, lookup=0, matched=0
1529 in_port: exact match or wildcard
1530 eth_src: exact match or wildcard
1531 eth_dst: exact match or wildcard
1532 eth_type: exact match or wildcard
1533 vlan_vid: exact match or wildcard
1534 vlan_pcp: exact match or wildcard
1535 ip_src: exact match or wildcard
1536 ip_dst: exact match or wildcard
1537 nw_proto: exact match or wildcard
1538 nw_tos: exact match or wildcard
1539 tcp_src: exact match or wildcard
1540 tcp_dst: exact match or wildcard
1545 for i in `seq $1 $2`; do
1546 printf ' table %d ("table%d"): ditto\n' $i $i
1549 (head_table classifier; ditto 1 253) > expout
1550 AT_CHECK([ovs-ofctl dump-tables br0], [0], [expout])
1551 # Change the configuration.
1554 -- --id=@t0 create Flow_Table name=main \
1555 -- --id=@t1 create Flow_Table flow-limit=1024 \
1556 -- set bridge br0 'flow_tables={1=@t1,0=@t0}' \
1557 | ${PERL} $srcdir/uuidfilt.pl],
1561 # Check that the configuration was updated.
1562 (head_table main; echo ' table 1 ("table1"):
1563 active=0, lookup=0, matched=0
1568 active=0, lookup=0, matched=0
1571 '; ditto 3 253) > expout
1572 AT_CHECK([ovs-ofctl dump-tables br0], [0], [expout])
1576 dnl In-band and fail-open add "hidden rules" to table 0. These rules shouldn't
1577 dnl be visible to OpenFlow. This test checks that "dump-flows" and
1578 dnl "dump-tables" don't make them visible.
1579 AT_SETUP([ofproto - hidden rules not in table stats])
1580 # Use an IP address for a controller that won't actually exist: we
1581 # want to create in-band rules but we do not want to actually connect
1582 # to a controller (because that could mess about with our test). The
1583 # Class E range 240.0.0.0 - 255.255.255.255 seems like a good choice.
1584 OVS_VSWITCHD_START([set-controller br0 tcp:240.0.0.1:6653])
1585 for i in 1 2 3 4 5; do ovs-appctl time/warp 1000; done
1587 # Check that no hidden flows are visible in OpenFlow.
1588 AT_CHECK([ovs-ofctl dump-flows br0], [0], [NXST_FLOW reply (xid=0x4):
1591 # Check that some hidden flows related to 240.0.0.1 are actually in table 0.
1593 # We discard flows that mention table_id because we only want table 0 flows,
1594 # which in OVS is implied by the absence of a table_id.
1595 AT_CHECK([ovs-appctl bridge/dump-flows br0], [0], [stdout])
1596 AT_CHECK([test `grep '240\.0\.0\.1' stdout | grep -v table_id= | wc -l` -gt 0])
1598 # Check that dump-tables doesn't count the hidden flows.
1600 printf 'OFPST_TABLE reply (xid=0x2):
1602 active=0, lookup=0, matched=0
1605 in_port: exact match or wildcard
1606 eth_src: exact match or wildcard
1607 eth_dst: exact match or wildcard
1608 eth_type: exact match or wildcard
1609 vlan_vid: exact match or wildcard
1610 vlan_pcp: exact match or wildcard
1611 ip_src: exact match or wildcard
1612 ip_dst: exact match or wildcard
1613 nw_proto: exact match or wildcard
1614 nw_tos: exact match or wildcard
1615 tcp_src: exact match or wildcard
1616 tcp_dst: exact match or wildcard
1621 for i in `seq $1 $2`; do
1622 printf ' table %d ("table%d"): ditto\n' $i $i
1625 (head_table classifier; ditto 1 253) > expout
1626 AT_CHECK([ovs-ofctl dump-tables br0], [0], [expout])
1627 OVS_VSWITCHD_STOP(["/240\.0\.0\.1/d"])
1630 AT_SETUP([ofproto - flow table configuration (OpenFlow 1.2)])
1632 # Check the default configuration.
1634 printf 'OFPST_TABLE reply (OF1.2) (xid=0x2):
1636 active=0, lookup=0, matched=0
1637 metadata: match=0xffffffffffffffff write=0xffffffffffffffff
1640 instructions (table miss and others):
1641 instructions: apply_actions,clear_actions,write_actions,write_metadata,goto_table
1642 Write-Actions and Apply-Actions features:
1643 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
1644 supported on Set-Field: metadata in_port_oxm eth_src eth_dst vlan_vid vlan_pcp mpls_label mpls_tc ip_src ip_dst ipv6_src ipv6_dst ipv6_label ip_dscp nw_ecn arp_op arp_spa arp_tpa arp_sha arp_tha tcp_src tcp_dst udp_src udp_dst sctp_src sctp_dst icmp_type icmp_code icmpv6_type icmpv6_code nd_target nd_sll nd_tll
1646 metadata: exact match or wildcard
1647 in_port_oxm: exact match or wildcard
1648 eth_src: exact match or wildcard
1649 eth_dst: exact match or wildcard
1650 eth_type: exact match or wildcard
1651 vlan_vid: exact match or wildcard
1652 vlan_pcp: exact match or wildcard
1653 mpls_label: exact match or wildcard
1654 mpls_tc: exact match or wildcard
1655 ip_src: exact match or wildcard
1656 ip_dst: exact match or wildcard
1657 ipv6_src: exact match or wildcard
1658 ipv6_dst: exact match or wildcard
1659 ipv6_label: exact match or wildcard
1660 nw_proto: exact match or wildcard
1661 ip_dscp: exact match or wildcard
1662 nw_ecn: exact match or wildcard
1663 arp_op: exact match or wildcard
1664 arp_spa: exact match or wildcard
1665 arp_tpa: exact match or wildcard
1666 arp_sha: exact match or wildcard
1667 arp_tha: exact match or wildcard
1668 tcp_src: exact match or wildcard
1669 tcp_dst: exact match or wildcard
1670 udp_src: exact match or wildcard
1671 udp_dst: exact match or wildcard
1672 sctp_src: exact match or wildcard
1673 sctp_dst: exact match or wildcard
1674 icmp_type: exact match or wildcard
1675 icmp_code: exact match or wildcard
1676 icmpv6_type: exact match or wildcard
1677 icmpv6_code: exact match or wildcard
1678 nd_target: exact match or wildcard
1679 nd_sll: exact match or wildcard
1680 nd_tll: exact match or wildcard
1685 for i in `seq $1 $2`; do
1686 printf ' table %d ("table%d"): ditto\n' $i $i
1690 printf ' table 253 ("table253"):
1691 active=0, lookup=0, matched=0
1692 metadata: match=0xffffffffffffffff write=0xffffffffffffffff
1695 instructions (table miss and others):
1696 instructions: apply_actions,clear_actions,write_actions,write_metadata
1701 (head_table classifier; ditto 1 252; tail_table) > expout
1702 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-tables br0], [0], [expout])
1703 # Change the configuration.
1706 -- --id=@t0 create Flow_Table name=main \
1707 -- --id=@t1 create Flow_Table flow-limit=1024 \
1708 -- set bridge br0 'flow_tables={1=@t1,0=@t0}' \
1709 | ${PERL} $srcdir/uuidfilt.pl],
1713 # Check that the configuration was updated.
1714 (head_table main; echo ' table 1 ("table1"):
1715 active=0, lookup=0, matched=0
1716 metadata: match=0xffffffffffffffff write=0xffffffffffffffff
1723 active=0, lookup=0, matched=0
1724 metadata: match=0xffffffffffffffff write=0xffffffffffffffff
1729 '; ditto 3 252; tail_table) > expout
1730 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-tables br0], [0], [expout])
1734 AT_SETUP([ofproto - table features (OpenFlow 1.3)])
1737 printf ' table 0 ("%s"):
1738 metadata: match=0xffffffffffffffff write=0xffffffffffffffff
1740 instructions (table miss and others):
1742 instructions: meter,apply_actions,clear_actions,write_actions,write_metadata,goto_table
1743 Write-Actions and Apply-Actions features:
1744 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
1745 supported on Set-Field: tun_id tun_src tun_dst tun_ipv6_src tun_ipv6_dst tun_flags tun_gbp_id tun_gbp_flags tun_metadata0 dnl
1746 tun_metadata1 tun_metadata2 tun_metadata3 tun_metadata4 tun_metadata5 tun_metadata6 tun_metadata7 tun_metadata8 tun_metadata9 tun_metadata10 tun_metadata11 tun_metadata12 tun_metadata13 tun_metadata14 tun_metadata15 tun_metadata16 tun_metadata17 tun_metadata18 tun_metadata19 tun_metadata20 tun_metadata21 tun_metadata22 tun_metadata23 tun_metadata24 tun_metadata25 tun_metadata26 tun_metadata27 tun_metadata28 tun_metadata29 tun_metadata30 tun_metadata31 tun_metadata32 tun_metadata33 tun_metadata34 tun_metadata35 tun_metadata36 tun_metadata37 tun_metadata38 tun_metadata39 tun_metadata40 tun_metadata41 tun_metadata42 tun_metadata43 tun_metadata44 tun_metadata45 tun_metadata46 tun_metadata47 tun_metadata48 tun_metadata49 tun_metadata50 tun_metadata51 tun_metadata52 tun_metadata53 tun_metadata54 tun_metadata55 tun_metadata56 tun_metadata57 tun_metadata58 tun_metadata59 tun_metadata60 tun_metadata61 tun_metadata62 tun_metadata63 dnl
1747 metadata in_port in_port_oxm pkt_mark ct_mark ct_label reg0 reg1 reg2 reg3 reg4 reg5 reg6 reg7 xreg0 xreg1 xreg2 xreg3 eth_src eth_dst vlan_tci vlan_vid vlan_pcp mpls_label mpls_tc ip_src ip_dst ipv6_src ipv6_dst ipv6_label nw_tos ip_dscp nw_ecn nw_ttl arp_op arp_spa arp_tpa arp_sha arp_tha tcp_src tcp_dst udp_src udp_dst sctp_src sctp_dst icmp_type icmp_code icmpv6_type icmpv6_code nd_target nd_sll nd_tll
1749 dp_hash: arbitrary mask
1750 recirc_id: exact match or wildcard
1751 conj_id: exact match or wildcard
1752 tun_id: arbitrary mask
1753 tun_src: arbitrary mask
1754 tun_dst: arbitrary mask
1755 tun_ipv6_src: arbitrary mask
1756 tun_ipv6_dst: arbitrary mask
1757 tun_flags: arbitrary mask
1758 tun_gbp_id: arbitrary mask
1759 tun_gbp_flags: arbitrary mask
1760 tun_metadata0: arbitrary mask
1761 tun_metadata1: arbitrary mask
1762 tun_metadata2: arbitrary mask
1763 tun_metadata3: arbitrary mask
1764 tun_metadata4: arbitrary mask
1765 tun_metadata5: arbitrary mask
1766 tun_metadata6: arbitrary mask
1767 tun_metadata7: arbitrary mask
1768 tun_metadata8: arbitrary mask
1769 tun_metadata9: arbitrary mask
1770 tun_metadata10: arbitrary mask
1771 tun_metadata11: arbitrary mask
1772 tun_metadata12: arbitrary mask
1773 tun_metadata13: arbitrary mask
1774 tun_metadata14: arbitrary mask
1775 tun_metadata15: arbitrary mask
1776 tun_metadata16: arbitrary mask
1777 tun_metadata17: arbitrary mask
1778 tun_metadata18: arbitrary mask
1779 tun_metadata19: arbitrary mask
1780 tun_metadata20: arbitrary mask
1781 tun_metadata21: arbitrary mask
1782 tun_metadata22: arbitrary mask
1783 tun_metadata23: arbitrary mask
1784 tun_metadata24: arbitrary mask
1785 tun_metadata25: arbitrary mask
1786 tun_metadata26: arbitrary mask
1787 tun_metadata27: arbitrary mask
1788 tun_metadata28: arbitrary mask
1789 tun_metadata29: arbitrary mask
1790 tun_metadata30: arbitrary mask
1791 tun_metadata31: arbitrary mask
1792 tun_metadata32: arbitrary mask
1793 tun_metadata33: arbitrary mask
1794 tun_metadata34: arbitrary mask
1795 tun_metadata35: arbitrary mask
1796 tun_metadata36: arbitrary mask
1797 tun_metadata37: arbitrary mask
1798 tun_metadata38: arbitrary mask
1799 tun_metadata39: arbitrary mask
1800 tun_metadata40: arbitrary mask
1801 tun_metadata41: arbitrary mask
1802 tun_metadata42: arbitrary mask
1803 tun_metadata43: arbitrary mask
1804 tun_metadata44: arbitrary mask
1805 tun_metadata45: arbitrary mask
1806 tun_metadata46: arbitrary mask
1807 tun_metadata47: arbitrary mask
1808 tun_metadata48: arbitrary mask
1809 tun_metadata49: arbitrary mask
1810 tun_metadata50: arbitrary mask
1811 tun_metadata51: arbitrary mask
1812 tun_metadata52: arbitrary mask
1813 tun_metadata53: arbitrary mask
1814 tun_metadata54: arbitrary mask
1815 tun_metadata55: arbitrary mask
1816 tun_metadata56: arbitrary mask
1817 tun_metadata57: arbitrary mask
1818 tun_metadata58: arbitrary mask
1819 tun_metadata59: arbitrary mask
1820 tun_metadata60: arbitrary mask
1821 tun_metadata61: arbitrary mask
1822 tun_metadata62: arbitrary mask
1823 tun_metadata63: arbitrary mask
1824 metadata: arbitrary mask
1825 in_port: exact match or wildcard
1826 in_port_oxm: exact match or wildcard
1827 actset_output: exact match or wildcard
1828 pkt_mark: arbitrary mask
1829 ct_state: arbitrary mask
1830 ct_zone: exact match or wildcard
1831 ct_mark: arbitrary mask
1832 ct_label: arbitrary mask
1833 reg0: arbitrary mask
1834 reg1: arbitrary mask
1835 reg2: arbitrary mask
1836 reg3: arbitrary mask
1837 reg4: arbitrary mask
1838 reg5: arbitrary mask
1839 reg6: arbitrary mask
1840 reg7: arbitrary mask
1841 xreg0: arbitrary mask
1842 xreg1: arbitrary mask
1843 xreg2: arbitrary mask
1844 xreg3: arbitrary mask
1845 eth_src: arbitrary mask
1846 eth_dst: arbitrary mask
1847 eth_type: exact match or wildcard
1848 vlan_tci: arbitrary mask
1849 vlan_vid: arbitrary mask
1850 vlan_pcp: exact match or wildcard
1851 mpls_label: exact match or wildcard
1852 mpls_tc: exact match or wildcard
1853 mpls_bos: exact match or wildcard
1854 ip_src: arbitrary mask
1855 ip_dst: arbitrary mask
1856 ipv6_src: arbitrary mask
1857 ipv6_dst: arbitrary mask
1858 ipv6_label: arbitrary mask
1859 nw_proto: exact match or wildcard
1860 nw_tos: exact match or wildcard
1861 ip_dscp: exact match or wildcard
1862 nw_ecn: exact match or wildcard
1863 nw_ttl: exact match or wildcard
1864 ip_frag: arbitrary mask
1865 arp_op: exact match or wildcard
1866 arp_spa: arbitrary mask
1867 arp_tpa: arbitrary mask
1868 arp_sha: arbitrary mask
1869 arp_tha: arbitrary mask
1870 tcp_src: arbitrary mask
1871 tcp_dst: arbitrary mask
1872 tcp_flags: arbitrary mask
1873 udp_src: arbitrary mask
1874 udp_dst: arbitrary mask
1875 sctp_src: arbitrary mask
1876 sctp_dst: arbitrary mask
1877 icmp_type: exact match or wildcard
1878 icmp_code: exact match or wildcard
1879 icmpv6_type: exact match or wildcard
1880 icmpv6_code: exact match or wildcard
1881 nd_target: arbitrary mask
1882 nd_sll: arbitrary mask
1883 nd_tll: arbitrary mask
1888 printf ' table %d ("%s"):
1889 metadata: match=0xffffffffffffffff write=0xffffffffffffffff
1891 instructions (table miss and others):
1897 ' $1 $2 $3 `expr $1 + 1`
1900 echo ' table 252 ("table252"):
1901 metadata: match=0xffffffffffffffff write=0xffffffffffffffff
1903 instructions (table miss and others):
1909 table 253 ("table253"):
1910 metadata: match=0xffffffffffffffff write=0xffffffffffffffff
1912 instructions (table miss and others):
1913 instructions: meter,apply_actions,clear_actions,write_actions,write_metadata
1918 (head_table classifier
1919 for i in `seq 1 251`; do
1920 ditto $i table$i 1000000
1922 tail_tables) > expout
1923 AT_CHECK([ovs-ofctl -O OpenFlow13 dump-table-features br0], [0], [expout])
1924 # Change the configuration.
1927 -- --id=@t0 create Flow_Table name=main \
1928 -- --id=@t1 create Flow_Table flow-limit=1024 \
1929 -- set bridge br0 'flow_tables={1=@t1,0=@t0}' \
1930 | ${PERL} $srcdir/uuidfilt.pl],
1934 # Check that the configuration was updated.
1937 for i in `seq 2 251`; do
1938 ditto $i table$i 1000000
1940 tail_tables) > expout
1941 AT_CHECK([ovs-ofctl -O OpenFlow13 dump-table-features br0], [0], [expout])
1945 AT_SETUP([ofproto - table description (OpenFlow 1.4)])
1948 while test $x -lt 254; do
1951 eviction=off eviction_flags=OTHER|IMPORTANCE|LIFETIME
1955 AT_CHECK([ovs-ofctl -O OpenFlow14 dump-table-desc br0 | sed '/^$/d
1956 /^OFPST_TABLE_DESC/d'], [0], [expout])
1958 # Change the configuration.
1959 AT_CHECK([ovs-ofctl -O Openflow14 mod-table br0 0 evict])
1960 # Check that the configuration was updated.
1961 mv expout orig-expout
1962 sed -e '2s/eviction=off/eviction=on/' <orig-expout > expout
1963 AT_CHECK([ovs-ofctl -O OpenFlow14 dump-table-desc br0 | sed '/^$/d
1964 /^OFPST_TABLE_DESC/d'], [0], [expout])
1966 AT_CHECK([ovs-ofctl -O Openflow14 mod-table br0 0 vacancy:20,80])
1967 # Check that the configuration was updated.
1968 mv expout orig-expout
1969 sed -e '3s/vacancy=off/vacancy=on vacancy_down=20% vacancy_up=80% vacancy=0%/' <orig-expout > expout
1970 AT_CHECK([ovs-ofctl -O OpenFlow14 dump-table-desc br0 | sed '/^$/d
1971 /^OFPST_TABLE_DESC/d'], [0], [expout])
1975 AT_SETUP([ofproto - hard limits on flow table size (OpenFlow 1.0)])
1977 # Configure a maximum of 4 flows.
1980 -- --id=@t0 create Flow_Table flow-limit=4 \
1981 -- set bridge br0 flow_tables:0=@t0 \
1982 | ${PERL} $srcdir/uuidfilt.pl],
1986 for in_port in 1 2 3 4; do
1987 ovs-ofctl add-flow br0 in_port=$in_port,actions=drop
1989 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1990 in_port=1 actions=drop
1991 in_port=2 actions=drop
1992 in_port=3 actions=drop
1993 in_port=4 actions=drop
1996 # Adding another flow will be refused.
1997 AT_CHECK([ovs-ofctl add-flow br0 in_port=5,actions=drop], [1], [], [stderr])
1998 AT_CHECK([head -n 1 stderr | ofctl_strip], [0],
1999 [OFPT_ERROR: OFPFMFC_TABLE_FULL
2001 # Also a mod-flow that would add a flow will be refused.
2002 AT_CHECK([ovs-ofctl mod-flows br0 in_port=5,actions=drop], [1], [], [stderr])
2003 AT_CHECK([head -n 1 stderr | ofctl_strip], [0],
2004 [OFPT_ERROR: OFPFMFC_TABLE_FULL
2006 # Replacing or modifying an existing flow is allowed.
2007 AT_CHECK([ovs-ofctl add-flow br0 in_port=4,actions=normal])
2008 AT_CHECK([ovs-ofctl mod-flows br0 in_port=3,actions=output:1])
2009 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
2010 in_port=1 actions=drop
2011 in_port=2 actions=drop
2012 in_port=3 actions=output:1
2013 in_port=4 actions=NORMAL
2019 AT_SETUP([ofproto - hard limits on flow table size (OpenFlow 1.2)])
2021 # Configure a maximum of 4 flows.
2024 -- --id=@t0 create Flow_Table flow-limit=4 \
2025 -- set bridge br0 flow_tables:0=@t0 \
2026 | ${PERL} $srcdir/uuidfilt.pl],
2030 for in_port in 1 2 3 4; do
2031 ovs-ofctl -O OpenFlow12 add-flow br0 in_port=$in_port,actions=drop
2033 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
2034 in_port=1 actions=drop
2035 in_port=2 actions=drop
2036 in_port=3 actions=drop
2037 in_port=4 actions=drop
2038 OFPST_FLOW reply (OF1.2):
2040 # Adding another flow will be refused.
2041 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 in_port=5,actions=drop], [1], [], [stderr])
2042 AT_CHECK([head -n 1 stderr | ofctl_strip], [0],
2043 [OFPT_ERROR (OF1.2): OFPFMFC_TABLE_FULL
2045 # Replacing or modifying an existing flow is allowed.
2046 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 in_port=4,actions=normal])
2047 AT_CHECK([ovs-ofctl -O OpenFlow12 mod-flows br0 in_port=3,actions=output:1])
2048 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
2049 in_port=1 actions=drop
2050 in_port=2 actions=drop
2051 in_port=3 actions=output:1
2052 in_port=4 actions=NORMAL
2053 OFPST_FLOW reply (OF1.2):
2058 AT_SETUP([ofproto - eviction upon table overflow (OpenFlow 1.0)])
2060 # Configure a maximum of 4 flows.
2063 -- --id=@t0 create Flow_Table flow-limit=4 overflow-policy=evict \
2064 -- set bridge br0 flow_tables:0=@t0 \
2065 | ${PERL} $srcdir/uuidfilt.pl],
2069 for in_port in 4 3 2 1; do
2070 ovs-ofctl add-flow br0 idle_timeout=${in_port}0,in_port=$in_port,actions=drop
2072 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
2073 idle_timeout=10, in_port=1 actions=drop
2074 idle_timeout=20, in_port=2 actions=drop
2075 idle_timeout=30, in_port=3 actions=drop
2076 idle_timeout=40, in_port=4 actions=drop
2079 # Adding another flow will cause the one that expires soonest to be evicted.
2080 AT_CHECK([ovs-ofctl add-flow br0 in_port=5,actions=drop])
2081 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
2082 idle_timeout=20, in_port=2 actions=drop
2083 idle_timeout=30, in_port=3 actions=drop
2084 idle_timeout=40, in_port=4 actions=drop
2085 in_port=5 actions=drop
2088 # A mod-flow that adds a flow also causes eviction, but replacing or
2089 # modifying an existing flow doesn't.
2090 AT_CHECK([ovs-ofctl mod-flows br0 in_port=6,actions=drop])
2091 AT_CHECK([ovs-ofctl add-flow br0 in_port=4,actions=normal])
2092 AT_CHECK([ovs-ofctl mod-flows br0 in_port=3,actions=output:1])
2093 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
2094 idle_timeout=30, in_port=3 actions=output:1
2095 in_port=4 actions=NORMAL
2096 in_port=5 actions=drop
2097 in_port=6 actions=drop
2100 # Flows with no timeouts at all cannot be evicted.
2101 AT_CHECK([ovs-ofctl add-flow br0 in_port=7,actions=normal])
2102 AT_CHECK([ovs-ofctl add-flow br0 in_port=8,actions=drop], [1], [], [stderr])
2103 AT_CHECK([head -n 1 stderr | ofctl_strip], [0],
2104 [OFPT_ERROR: OFPFMFC_TABLE_FULL
2106 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
2107 in_port=4 actions=NORMAL
2108 in_port=5 actions=drop
2109 in_port=6 actions=drop
2110 in_port=7 actions=NORMAL
2116 AT_SETUP([ofproto - eviction upon table overflow (OpenFlow 1.2)])
2118 # Configure a maximum of 4 flows.
2121 -- --id=@t0 create Flow_Table flow-limit=4 overflow-policy=evict \
2122 -- set bridge br0 flow_tables:0=@t0 \
2123 | ${PERL} $srcdir/uuidfilt.pl],
2127 for in_port in 4 3 2 1; do
2128 ovs-ofctl -O OpenFlow12 add-flow br0 idle_timeout=${in_port}0,in_port=$in_port,actions=drop
2130 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
2131 idle_timeout=10, in_port=1 actions=drop
2132 idle_timeout=20, in_port=2 actions=drop
2133 idle_timeout=30, in_port=3 actions=drop
2134 idle_timeout=40, in_port=4 actions=drop
2135 OFPST_FLOW reply (OF1.2):
2137 # Adding another flow will cause the one that expires soonest to be evicted.
2138 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 in_port=5,actions=drop])
2139 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
2140 idle_timeout=20, in_port=2 actions=drop
2141 idle_timeout=30, in_port=3 actions=drop
2142 idle_timeout=40, in_port=4 actions=drop
2143 in_port=5 actions=drop
2144 OFPST_FLOW reply (OF1.2):
2146 # In OpenFlow 1.2 a mod-flow does not ever add a flow and thus
2147 # has no effect on eviction
2148 AT_CHECK([ovs-ofctl -O OpenFlow12 mod-flows br0 in_port=6,actions=drop])
2149 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 in_port=4,actions=normal])
2150 AT_CHECK([ovs-ofctl -O OpenFlow12 mod-flows br0 in_port=3,actions=output:1])
2151 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
2152 idle_timeout=20, in_port=2 actions=drop
2153 idle_timeout=30, in_port=3 actions=output:1
2154 in_port=4 actions=NORMAL
2155 in_port=5 actions=drop
2156 OFPST_FLOW reply (OF1.2):
2158 # Flows with no timeouts at all cannot be evicted.
2159 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 in_port=6,actions=drop])
2160 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 in_port=7,actions=normal])
2161 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 in_port=8,actions=drop], [1], [], [stderr])
2162 AT_CHECK([head -n 1 stderr | ofctl_strip], [0],
2163 [OFPT_ERROR (OF1.2): OFPFMFC_TABLE_FULL
2165 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
2166 in_port=4 actions=NORMAL
2167 in_port=5 actions=drop
2168 in_port=6 actions=drop
2169 in_port=7 actions=NORMAL
2170 OFPST_FLOW reply (OF1.2):
2175 AT_SETUP([ofproto - eviction using importance upon table overflow (OpenFlow 1.4)])
2177 # Configure a maximum of 4 flows.
2180 -- --id=@t0 create Flow_Table name=evict flow-limit=4 \
2181 -- set bridge br0 flow_tables:0=@t0 \
2182 | ${PERL} $srcdir/uuidfilt.pl],
2185 # Use mod-table to turn on eviction just to demonstrate that it works.
2186 AT_CHECK([ovs-ofctl -O OpenFlow14 mod-table br0 0 evict])
2188 for in_port in 4 3 2 1; do
2189 ovs-ofctl -O Openflow14 add-flow br0 importance=$((in_port + 30)),priority=$((in_port + 5)),hard_timeout=$((in_port + 500)),actions=drop
2191 AT_CHECK([ovs-ofctl -O Openflow14 dump-flows br0 | ofctl_strip | sort], [0], [dnl
2192 hard_timeout=501, importance=31, priority=6 actions=drop
2193 hard_timeout=502, importance=32, priority=7 actions=drop
2194 hard_timeout=503, importance=33, priority=8 actions=drop
2195 hard_timeout=504, importance=34, priority=9 actions=drop
2196 OFPST_FLOW reply (OF1.4):
2198 # Adding another flow will cause the one with lowest importance to be evicted.
2199 AT_CHECK([ovs-ofctl -O Openflow14 add-flow br0 hard_timeout=505,importance=35,priority=10,in_port=2,actions=drop])
2200 AT_CHECK([ovs-ofctl -O Openflow14 dump-flows br0 | ofctl_strip | sort], [0], [dnl
2201 hard_timeout=502, importance=32, priority=7 actions=drop
2202 hard_timeout=503, importance=33, priority=8 actions=drop
2203 hard_timeout=504, importance=34, priority=9 actions=drop
2204 hard_timeout=505, importance=35, priority=10,in_port=2 actions=drop
2205 OFPST_FLOW reply (OF1.4):
2207 # Disable the Eviction configuration.
2208 AT_CHECK([ovs-ofctl -O OpenFlow14 mod-table br0 0 noevict])
2209 # Adding another flow will cause the system to give error for FULL TABLE.
2210 AT_CHECK([ovs-ofctl -O Openflow14 add-flow br0 hard_timeout=506,importance=36,priority=11,actions=drop],[1], [], [stderr])
2211 AT_CHECK([head -n 1 stderr | ofctl_strip], [0],
2212 [OFPT_ERROR (OF1.4): OFPFMFC_TABLE_FULL
2214 #Dump flows. It should show only the old values
2215 AT_CHECK([ovs-ofctl -O Openflow14 dump-flows br0 | ofctl_strip | sort], [0], [dnl
2216 hard_timeout=502, importance=32, priority=7 actions=drop
2217 hard_timeout=503, importance=33, priority=8 actions=drop
2218 hard_timeout=504, importance=34, priority=9 actions=drop
2219 hard_timeout=505, importance=35, priority=10,in_port=2 actions=drop
2220 OFPST_FLOW reply (OF1.4):
2222 # mod-flow that would modify a flow will be done successfully.
2223 AT_CHECK([ovs-ofctl -O Openflow14 mod-flows br0 in_port=2,actions=NORMAL])
2224 AT_CHECK([ovs-ofctl -O Openflow14 dump-flows br0 | ofctl_strip | sort], [0], [dnl
2225 hard_timeout=502, importance=32, priority=7 actions=drop
2226 hard_timeout=503, importance=33, priority=8 actions=drop
2227 hard_timeout=504, importance=34, priority=9 actions=drop
2228 hard_timeout=505, importance=35, priority=10,in_port=2 actions=NORMAL
2229 OFPST_FLOW reply (OF1.4):
2231 # Also a mod-flow that would add a flow will be refused.
2232 AT_CHECK([ovs-ofctl mod-flows br0 in_port=5,actions=drop], [1], [], [stderr])
2233 AT_CHECK([head -n 1 stderr | ofctl_strip], [0],
2234 [OFPT_ERROR: OFPFMFC_TABLE_FULL
2239 AT_SETUP([ofproto - eviction upon table overflow, with fairness (OpenFlow 1.0)])
2241 # Configure a maximum of 4 flows.
2244 -- --id=@t0 create Flow_Table name=evict flow-limit=4 \
2245 overflow-policy=evict \
2246 groups='"NXM_OF_IN_PORT[[]]"' \
2247 -- set bridge br0 flow_tables:0=@t0 \
2248 | ${PERL} $srcdir/uuidfilt.pl],
2252 ovs-ofctl add-flows br0 - <<EOF
2253 idle_timeout=10 in_port=2 dl_src=00:44:55:66:77:88 actions=drop
2254 idle_timeout=20 in_port=1 dl_src=00:11:22:33:44:55 actions=drop
2255 idle_timeout=30 in_port=1 dl_src=00:22:33:44:55:66 actions=drop
2256 idle_timeout=40 in_port=1 dl_src=00:33:44:55:66:77 actions=drop
2258 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
2259 idle_timeout=10, in_port=2,dl_src=00:44:55:66:77:88 actions=drop
2260 idle_timeout=20, in_port=1,dl_src=00:11:22:33:44:55 actions=drop
2261 idle_timeout=30, in_port=1,dl_src=00:22:33:44:55:66 actions=drop
2262 idle_timeout=40, in_port=1,dl_src=00:33:44:55:66:77 actions=drop
2265 # Adding another flow will cause the one that expires soonest within
2266 # the largest group (those with in_port=1) to be evicted. In this
2267 # case this is not the same as the one that expires soonest overall
2268 # (which is what makes the test interesting):
2269 AT_CHECK([ovs-ofctl add-flow br0 in_port=2,dl_src=00:55:66:77:88:99,actions=drop])
2270 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
2271 idle_timeout=10, in_port=2,dl_src=00:44:55:66:77:88 actions=drop
2272 idle_timeout=30, in_port=1,dl_src=00:22:33:44:55:66 actions=drop
2273 idle_timeout=40, in_port=1,dl_src=00:33:44:55:66:77 actions=drop
2274 in_port=2,dl_src=00:55:66:77:88:99 actions=drop
2277 # Enlarge the flow limit, change the eviction policy back to strictly
2278 # based on expiration, and and add some flows.
2279 AT_CHECK([ovs-vsctl set Flow_Table evict groups='[[]]' flow-limit=7])
2280 ovs-ofctl add-flows br0 - <<EOF
2281 idle_timeout=50 in_port=2 dl_src=00:66:77:88:99:aa actions=drop
2282 idle_timeout=60 in_port=2 dl_src=00:77:88:99:aa:bb actions=drop
2283 idle_timeout=70 in_port=2 dl_src=00:88:99:aa:bb:cc actions=drop
2285 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
2286 idle_timeout=10, in_port=2,dl_src=00:44:55:66:77:88 actions=drop
2287 idle_timeout=30, in_port=1,dl_src=00:22:33:44:55:66 actions=drop
2288 idle_timeout=40, in_port=1,dl_src=00:33:44:55:66:77 actions=drop
2289 idle_timeout=50, in_port=2,dl_src=00:66:77:88:99:aa actions=drop
2290 idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=drop
2291 idle_timeout=70, in_port=2,dl_src=00:88:99:aa:bb:cc actions=drop
2292 in_port=2,dl_src=00:55:66:77:88:99 actions=drop
2295 # Adding another flow will cause the one that expires soonest overall
2297 AT_CHECK([ovs-ofctl add-flow br0 'idle_timeout=80 in_port=2 dl_src=00:99:aa:bb:cc:dd actions=drop'])
2298 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
2299 idle_timeout=30, in_port=1,dl_src=00:22:33:44:55:66 actions=drop
2300 idle_timeout=40, in_port=1,dl_src=00:33:44:55:66:77 actions=drop
2301 idle_timeout=50, in_port=2,dl_src=00:66:77:88:99:aa actions=drop
2302 idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=drop
2303 idle_timeout=70, in_port=2,dl_src=00:88:99:aa:bb:cc actions=drop
2304 idle_timeout=80, in_port=2,dl_src=00:99:aa:bb:cc:dd actions=drop
2305 in_port=2,dl_src=00:55:66:77:88:99 actions=drop
2308 # Reducing the flow limit also causes the flows that expire soonest
2309 # overall to be evicted.
2310 AT_CHECK([ovs-vsctl set Flow_Table evict flow-limit=4])
2311 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
2312 idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=drop
2313 idle_timeout=70, in_port=2,dl_src=00:88:99:aa:bb:cc actions=drop
2314 idle_timeout=80, in_port=2,dl_src=00:99:aa:bb:cc:dd actions=drop
2315 in_port=2,dl_src=00:55:66:77:88:99 actions=drop
2321 AT_SETUP([ofproto - eviction upon table overflow, with fairness (OpenFlow 1.2)])
2323 # Configure a maximum of 4 flows.
2326 -- --id=@t0 create Flow_Table name=evict flow-limit=4 \
2327 overflow-policy=evict \
2328 groups='"NXM_OF_IN_PORT[[]]"' \
2329 -- set bridge br0 flow_tables:0=@t0 \
2330 | ${PERL} $srcdir/uuidfilt.pl],
2334 ovs-ofctl -O OpenFlow12 add-flows br0 - <<EOF
2335 idle_timeout=10 in_port=2 dl_src=00:44:55:66:77:88 actions=drop
2336 idle_timeout=20 in_port=1 dl_src=00:11:22:33:44:55 actions=drop
2337 idle_timeout=30 in_port=1 dl_src=00:22:33:44:55:66 actions=drop
2338 idle_timeout=40 in_port=1 dl_src=00:33:44:55:66:77 actions=drop
2340 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
2341 idle_timeout=10, in_port=2,dl_src=00:44:55:66:77:88 actions=drop
2342 idle_timeout=20, in_port=1,dl_src=00:11:22:33:44:55 actions=drop
2343 idle_timeout=30, in_port=1,dl_src=00:22:33:44:55:66 actions=drop
2344 idle_timeout=40, in_port=1,dl_src=00:33:44:55:66:77 actions=drop
2345 OFPST_FLOW reply (OF1.2):
2347 # Adding another flow will cause the one that expires soonest within
2348 # the largest group (those with in_port=1) to be evicted. In this
2349 # case this is not the same as the one that expires soonest overall
2350 # (which is what makes the test interesting):
2351 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 in_port=2,dl_src=00:55:66:77:88:99,actions=drop])
2352 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
2353 idle_timeout=10, in_port=2,dl_src=00:44:55:66:77:88 actions=drop
2354 idle_timeout=30, in_port=1,dl_src=00:22:33:44:55:66 actions=drop
2355 idle_timeout=40, in_port=1,dl_src=00:33:44:55:66:77 actions=drop
2356 in_port=2,dl_src=00:55:66:77:88:99 actions=drop
2357 OFPST_FLOW reply (OF1.2):
2359 # Enlarge the flow limit, change the eviction policy back to strictly
2360 # based on expiration, and and add some flows.
2361 AT_CHECK([ovs-vsctl set Flow_Table evict groups='[[]]' flow-limit=7])
2362 ovs-ofctl -O OpenFlow12 add-flows br0 - <<EOF
2363 idle_timeout=50 in_port=2 dl_src=00:66:77:88:99:aa actions=drop
2364 idle_timeout=60 in_port=2 dl_src=00:77:88:99:aa:bb actions=drop
2365 idle_timeout=70 in_port=2 dl_src=00:88:99:aa:bb:cc actions=drop
2367 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
2368 idle_timeout=10, in_port=2,dl_src=00:44:55:66:77:88 actions=drop
2369 idle_timeout=30, in_port=1,dl_src=00:22:33:44:55:66 actions=drop
2370 idle_timeout=40, in_port=1,dl_src=00:33:44:55:66:77 actions=drop
2371 idle_timeout=50, in_port=2,dl_src=00:66:77:88:99:aa actions=drop
2372 idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=drop
2373 idle_timeout=70, in_port=2,dl_src=00:88:99:aa:bb:cc actions=drop
2374 in_port=2,dl_src=00:55:66:77:88:99 actions=drop
2375 OFPST_FLOW reply (OF1.2):
2377 # Adding another flow will cause the one that expires soonest overall
2379 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'])
2380 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
2381 idle_timeout=30, in_port=1,dl_src=00:22:33:44:55:66 actions=drop
2382 idle_timeout=40, in_port=1,dl_src=00:33:44:55:66:77 actions=drop
2383 idle_timeout=50, in_port=2,dl_src=00:66:77:88:99:aa actions=drop
2384 idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=drop
2385 idle_timeout=70, in_port=2,dl_src=00:88:99:aa:bb:cc actions=drop
2386 idle_timeout=80, in_port=2,dl_src=00:99:aa:bb:cc:dd actions=drop
2387 in_port=2,dl_src=00:55:66:77:88:99 actions=drop
2388 OFPST_FLOW reply (OF1.2):
2390 # Reducing the flow limit also causes the flows that expire soonest
2391 # overall to be evicted.
2392 AT_CHECK([ovs-vsctl set Flow_Table evict flow-limit=4])
2393 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
2394 idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=drop
2395 idle_timeout=70, in_port=2,dl_src=00:88:99:aa:bb:cc actions=drop
2396 idle_timeout=80, in_port=2,dl_src=00:99:aa:bb:cc:dd actions=drop
2397 in_port=2,dl_src=00:55:66:77:88:99 actions=drop
2398 OFPST_FLOW reply (OF1.2):
2403 AT_SETUP([ofproto - eviction upon table overflow, with modified hard timeout])
2405 # Configure a maximum of 4 flows.
2408 -- --id=@t0 create Flow_Table flow-limit=4 overflow-policy=evict \
2409 -- set bridge br0 flow_tables:0=@t0 \
2410 | ${PERL} $srcdir/uuidfilt.pl],
2413 ovs-appctl time/stop
2415 for in_port in 4 3 2 1; do
2416 ovs-ofctl add-flow br0 hard_timeout=$((10 + in_port * 3)),in_port=$in_port,actions=drop
2418 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
2419 hard_timeout=13, in_port=1 actions=drop
2420 hard_timeout=16, in_port=2 actions=drop
2421 hard_timeout=19, in_port=3 actions=drop
2422 hard_timeout=22, in_port=4 actions=drop
2425 # Sleep and modify the one that expires soonest
2426 ovs-appctl time/warp 5000
2427 AT_CHECK([ovs-ofctl mod-flows br0 in_port=1,actions=drop])
2428 # At this point the table would looks like:
2429 # in_port seconds to expire
2434 ovs-appctl time/warp 2000
2435 # Adding another flow will cause the one that expires soonest to be evicted.
2436 AT_CHECK([ovs-ofctl add-flow br0 in_port=5,actions=drop])
2437 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
2438 hard_timeout=13, in_port=1 actions=drop
2439 hard_timeout=19, in_port=3 actions=drop
2440 hard_timeout=22, in_port=4 actions=drop
2441 in_port=5 actions=drop
2447 AT_SETUP([ofproto - eviction upon table overflow, with modified idle timeout])
2448 OVS_VSWITCHD_START([add-port br0 p1 -- set interface p1 type=dummy ofport_request=1])
2449 # Configure a maximum of 4 flows.
2452 -- --id=@t0 create Flow_Table flow-limit=4 overflow-policy=evict \
2453 -- set bridge br0 flow_tables:0=@t0 \
2454 | ${PERL} $srcdir/uuidfilt.pl],
2458 for in_port in 4 3 2 1; do
2459 ovs-ofctl add-flow br0 idle_timeout=$((10 + in_port * 3)),in_port=$in_port,actions=drop
2461 ovs-appctl time/stop
2462 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
2463 idle_timeout=13, in_port=1 actions=drop
2464 idle_timeout=16, in_port=2 actions=drop
2465 idle_timeout=19, in_port=3 actions=drop
2466 idle_timeout=22, in_port=4 actions=drop
2469 # Sleep and receive on the flow that expires soonest
2470 ovs-appctl time/warp 5000
2471 AT_CHECK([ovs-appctl netdev-dummy/receive p1 'in_port(1)'])
2472 # At this point the table would looks like:
2473 # in_port seconds to expire
2478 ovs-appctl time/warp 2000
2479 # Adding another flow will cause the one that expires soonest to be evicted.
2480 AT_CHECK([ovs-ofctl add-flow br0 in_port=5,actions=drop])
2481 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
2482 idle_timeout=19, in_port=3 actions=drop
2483 idle_timeout=22, in_port=4 actions=drop
2484 in_port=5 actions=drop
2485 n_packets=1, n_bytes=60, idle_timeout=13, in_port=1 actions=drop
2491 AT_SETUP([ofproto - asynchronous message control (OpenFlow 1.0)])
2493 AT_CHECK([ovs-ofctl -P openflow10 monitor br0 --detach --no-chdir --pidfile])
2495 printf '\n\n--- check_async %d ---\n\n\n' $1
2498 ovs-appctl -t ovs-ofctl ofctl/barrier
2499 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
2502 # OFPT_PACKET_IN, OFPR_ACTION (controller_id=0)
2503 ovs-ofctl -v packet-out br0 controller controller '0001020304050010203040501234'
2504 if test X"$1" = X"OFPR_ACTION"; then shift;
2505 echo >>expout "OFPT_PACKET_IN: total_len=14 in_port=CONTROLLER (via action) data_len=14 (unbuffered)
2506 vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1234"
2509 # OFPT_PACKET_IN, OFPR_NO_MATCH (controller_id=123)
2510 ovs-ofctl -v packet-out br0 controller 'controller(reason=no_match,id=123)' '0001020304050010203040501234'
2511 if test X"$1" = X"OFPR_NO_MATCH"; then shift;
2512 echo >>expout "OFPT_PACKET_IN: total_len=14 in_port=CONTROLLER (via no_match) data_len=14 (unbuffered)
2513 vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1234"
2516 # OFPT_PACKET_IN, OFPR_INVALID_TTL (controller_id=0)
2517 ovs-ofctl packet-out br0 controller dec_ttl '002583dfb4000026b98cb0f908004500003eb7e200000011339bac11370dac100002d7730035002b8f6d86fb0100000100000000000006626c702d7873066e696369726103636f6d00000f00'
2518 if test X"$1" = X"OFPR_INVALID_TTL"; then shift;
2519 echo >>expout "OFPT_PACKET_IN: total_len=76 in_port=CONTROLLER (via invalid_ttl) data_len=76 (unbuffered)
2520 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"
2523 # OFPT_PORT_STATUS, OFPPR_ADD
2524 ovs-vsctl add-port br0 test -- set Interface test type=dummy ofport_request=1
2525 if test X"$1" = X"OFPPR_ADD"; then shift;
2526 echo >>expout "OFPT_PORT_STATUS: ADD: 1(test): addr:aa:55:aa:55:00:0x
2529 speed: 0 Mbps now, 0 Mbps max"
2532 # OFPT_PORT_STATUS, OFPPR_DELETE
2533 ovs-vsctl del-port br0 test
2534 if test X"$1" = X"OFPPR_DELETE"; then shift;
2535 echo >>expout "OFPT_PORT_STATUS: DEL: 1(test): addr:aa:55:aa:55:00:0x
2538 speed: 0 Mbps now, 0 Mbps max"
2541 # OFPT_FLOW_REMOVED, OFPRR_DELETE
2542 ovs-ofctl add-flow br0 send_flow_rem,actions=drop
2543 ovs-ofctl --strict del-flows br0 ''
2544 if test X"$1" = X"OFPRR_DELETE"; then shift;
2545 echo >>expout "OFPT_FLOW_REMOVED: reason=delete"
2547 AT_FAIL_IF([test X"$1" != X])
2549 ovs-appctl -t ovs-ofctl ofctl/barrier
2550 echo >>expout "OFPT_BARRIER_REPLY:"
2554 s/ (xid=0x[0-9a-fA-F]*)//
2556 s/00:0.$/00:0x/' < monitor.log]],
2560 # It's a service connection so initially there should be no async messages.
2563 # Set miss_send_len to 128, turning on packet-ins for our service connection.
2564 ovs-appctl -t ovs-ofctl ofctl/send 0109000c0123456700000080
2565 check_async 2 OFPR_ACTION OFPPR_ADD OFPPR_DELETE OFPRR_DELETE
2567 # Set miss_send_len to 128 and enable invalid_ttl.
2568 ovs-appctl -t ovs-ofctl ofctl/send 0109000c0123456700040080
2569 check_async 3 OFPR_ACTION OFPR_INVALID_TTL OFPPR_ADD OFPPR_DELETE OFPRR_DELETE
2571 # Become slave, which should disable everything except port status.
2572 ovs-appctl -t ovs-ofctl ofctl/send 0104001400000002000023200000000a00000002
2573 check_async 4 OFPPR_ADD OFPPR_DELETE
2575 # Use NXT_SET_ASYNC_CONFIG to enable a patchwork of asynchronous messages.
2576 ovs-appctl -t ovs-ofctl ofctl/send 01040028000000020000232000000013000000020000000500000005000000020000000200000005
2577 check_async 5 OFPR_INVALID_TTL OFPPR_DELETE OFPRR_DELETE
2579 # Set controller ID 123.
2580 ovs-appctl -t ovs-ofctl ofctl/send 01040018000000030000232000000014000000000000007b
2581 check_async 6 OFPR_NO_MATCH OFPPR_DELETE OFPRR_DELETE
2583 # Restore controller ID 0.
2584 ovs-appctl -t ovs-ofctl ofctl/send 010400180000000300002320000000140000000000000000
2587 ovs-appctl -t ovs-ofctl ofctl/send 0104001400000002000023200000000a00000001
2588 check_async 7 OFPR_ACTION OFPPR_ADD
2590 ovs-appctl -t ovs-ofctl exit
2594 AT_SETUP([ofproto - asynchronous message control (OpenFlow 1.2)])
2596 AT_CHECK([ovs-ofctl -O OpenFlow12 monitor br0 --detach --no-chdir --pidfile])
2598 printf '\n\n--- check_async %d ---\n\n\n' $1
2602 ovs-appctl -t ovs-ofctl ofctl/barrier
2603 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
2606 # OFPT_PACKET_IN, OFPR_ACTION (controller_id=0)
2607 ovs-ofctl -O OpenFlow12 -v packet-out br0 none controller '0001020304050010203040501234'
2608 if test X"$1" = X"OFPR_ACTION"; then shift;
2609 echo >>expout "OFPT_PACKET_IN (OF1.2): total_len=14 in_port=ANY (via action) data_len=14 (unbuffered)
2610 vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1234"
2613 # OFPT_PACKET_IN, OFPR_NO_MATCH (controller_id=123)
2614 ovs-ofctl -O OpenFlow12 -v packet-out br0 none 'controller(reason=no_match,id=123)' '0001020304050010203040501234'
2615 if test X"$1" = X"OFPR_NO_MATCH"; then shift;
2616 echo >>expout "OFPT_PACKET_IN (OF1.2): total_len=14 in_port=ANY (via no_match) data_len=14 (unbuffered)
2617 vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1234"
2620 # OFPT_PACKET_IN, OFPR_INVALID_TTL (controller_id=0)
2621 ovs-ofctl -O OpenFlow12 packet-out br0 none dec_ttl '002583dfb4000026b98cb0f908004500003eb7e200000011339bac11370dac100002d7730035002b8f6d86fb0100000100000000000006626c702d7873066e696369726103636f6d00000f00'
2622 if test X"$1" = X"OFPR_INVALID_TTL"; then shift;
2623 echo >>expout "OFPT_PACKET_IN (OF1.2): total_len=76 in_port=ANY (via invalid_ttl) data_len=76 (unbuffered)
2624 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"
2627 # OFPT_PORT_STATUS, OFPPR_ADD
2628 ovs-vsctl add-port br0 test -- set Interface test type=dummy
2629 if test X"$1" = X"OFPPR_ADD"; then shift;
2630 echo >>expout "OFPT_PORT_STATUS (OF1.2): ADD: ${INDEX}(test): addr:aa:55:aa:55:00:0x
2633 speed: 0 Mbps now, 0 Mbps max"
2636 # OFPT_PORT_STATUS, OFPPR_DELETE
2637 ovs-vsctl del-port br0 test
2638 if test X"$1" = X"OFPPR_DELETE"; then shift;
2639 echo >>expout "OFPT_PORT_STATUS (OF1.2): DEL: ${INDEX}(test): addr:aa:55:aa:55:00:0x
2642 speed: 0 Mbps now, 0 Mbps max"
2645 # OFPT_FLOW_REMOVED, OFPRR_DELETE
2646 ovs-ofctl -O OpenFlow12 add-flow br0 send_flow_rem,actions=drop
2647 ovs-ofctl -O OpenFlow12 --strict del-flows br0 ''
2648 if test X"$1" = X"OFPRR_DELETE"; then shift;
2649 echo >>expout "OFPT_FLOW_REMOVED (OF1.2): reason=delete table_id=0"
2651 AT_FAIL_IF([test X"$1" != X])
2657 s/ (xid=0x[0-9a-fA-F]*)//
2659 s/00:0.$/00:0x/' < monitor.log]],
2663 # It's a service connection so initially there should be no async messages.
2666 # Set miss_send_len to 128, turning on packet-ins for our service connection.
2667 ovs-appctl -t ovs-ofctl ofctl/send 0309000c0123456700000080
2668 check_async 2 OFPR_ACTION OFPPR_ADD OFPPR_DELETE OFPRR_DELETE
2670 # Set miss_send_len to 128 and enable invalid_ttl.
2671 ovs-appctl -t ovs-ofctl ofctl/send 0309000c0123456700040080
2672 check_async 3 OFPR_ACTION OFPR_INVALID_TTL OFPPR_ADD OFPPR_DELETE OFPRR_DELETE
2674 # Become slave (OF 1.2), which should disable everything except port status.
2675 ovs-appctl -t ovs-ofctl ofctl/send 031800180000000200000003000000000000000000000001
2676 check_async 4 OFPPR_ADD OFPPR_DELETE
2678 # Use NXT_SET_ASYNC_CONFIG to enable a patchwork of asynchronous messages.
2679 ovs-appctl -t ovs-ofctl ofctl/send 03040028000000020000232000000013000000020000000500000005000000020000000200000005
2680 check_async 5 OFPR_INVALID_TTL OFPPR_DELETE OFPRR_DELETE
2682 # Set controller ID 123.
2683 ovs-appctl -t ovs-ofctl ofctl/send 03040018000000030000232000000014000000000000007b
2684 check_async 6 OFPR_NO_MATCH OFPPR_DELETE OFPRR_DELETE
2686 # Restore controller ID 0.
2687 ovs-appctl -t ovs-ofctl ofctl/send 030400180000000300002320000000140000000000000000
2689 # Become master (OF 1.2).
2690 ovs-appctl -t ovs-ofctl ofctl/send 031800180000000400000002000000000000000000000002
2691 check_async 7 OFPR_ACTION OFPPR_ADD
2693 ovs-appctl -t ovs-ofctl exit
2697 AT_SETUP([ofproto - asynchronous message control (OpenFlow 1.3)])
2699 AT_CHECK([ovs-ofctl -O OpenFlow13 monitor br0 --detach --no-chdir --pidfile])
2701 printf '\n\n--- check_async %d ---\n\n\n' $1
2705 ovs-appctl -t ovs-ofctl ofctl/barrier
2706 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
2709 # OFPT_PACKET_IN, OFPR_ACTION (controller_id=0)
2710 ovs-ofctl -O OpenFlow13 -v packet-out br0 none controller '0001020304050010203040501234'
2711 if test X"$1" = X"OFPR_ACTION"; then shift;
2712 echo >>expout "OFPT_PACKET_IN (OF1.3): total_len=14 in_port=ANY (via action) data_len=14 (unbuffered)
2713 vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1234"
2716 # OFPT_PACKET_IN, OFPR_NO_MATCH (controller_id=123)
2717 ovs-ofctl -O OpenFlow13 -v packet-out br0 none 'controller(reason=no_match,id=123)' '0001020304050010203040501234'
2718 if test X"$1" = X"OFPR_NO_MATCH"; then shift;
2719 echo >>expout "OFPT_PACKET_IN (OF1.3): total_len=14 in_port=ANY (via no_match) data_len=14 (unbuffered)
2720 vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1234"
2723 # OFPT_PACKET_IN, OFPR_INVALID_TTL (controller_id=0)
2724 ovs-ofctl -O OpenFlow13 packet-out br0 none dec_ttl '002583dfb4000026b98cb0f908004500003eb7e200000011339bac11370dac100002d7730035002b8f6d86fb0100000100000000000006626c702d7873066e696369726103636f6d00000f00'
2725 if test X"$1" = X"OFPR_INVALID_TTL"; then shift;
2726 echo >>expout "OFPT_PACKET_IN (OF1.3): total_len=76 in_port=ANY (via invalid_ttl) data_len=76 (unbuffered)
2727 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"
2730 # OFPT_PORT_STATUS, OFPPR_ADD
2731 ovs-vsctl add-port br0 test -- set Interface test type=dummy
2732 if test X"$1" = X"OFPPR_ADD"; then shift;
2733 echo >>expout "OFPT_PORT_STATUS (OF1.3): ADD: ${INDEX}(test): addr:aa:55:aa:55:00:0x
2736 speed: 0 Mbps now, 0 Mbps max"
2739 # OFPT_PORT_STATUS, OFPPR_DELETE
2740 ovs-vsctl del-port br0 test
2741 if test X"$1" = X"OFPPR_DELETE"; then shift;
2742 echo >>expout "OFPT_PORT_STATUS (OF1.3): DEL: ${INDEX}(test): addr:aa:55:aa:55:00:0x
2745 speed: 0 Mbps now, 0 Mbps max"
2748 # OFPT_FLOW_REMOVED, OFPRR_DELETE
2749 ovs-ofctl -O OpenFlow13 add-flow br0 send_flow_rem,actions=drop
2750 ovs-ofctl -O OpenFlow13 --strict del-flows br0 ''
2751 if test X"$1" = X"OFPRR_DELETE"; then shift;
2752 echo >>expout "OFPT_FLOW_REMOVED (OF1.3): reason=delete table_id=0"
2755 # OFPT_FLOW_REMOVED, OFPRR_GROUP_DELETE
2756 ovs-ofctl -O OpenFlow13 add-group br0 group_id=1234,type=all,bucket=output:10
2757 ovs-ofctl -O OpenFlow13 add-flow br0 send_flow_rem,actions=group:1234
2758 ovs-ofctl -O OpenFlow13 --strict del-groups br0 group_id=1234
2759 if test X"$1" = X"OFPRR_DELETE"; then shift;
2760 echo >>expout "OFPT_FLOW_REMOVED (OF1.3): reason=gropu_delete table_id=0"
2763 AT_FAIL_IF([test X"$1" != X])
2765 ovs-appctl -t ovs-ofctl ofctl/barrier
2766 echo >>expout "OFPT_BARRIER_REPLY (OF1.3):"
2770 s/ (xid=0x[0-9a-fA-F]*)//
2772 s/00:0.$/00:0x/' < monitor.log]],
2776 # It's a service connection so initially there should be no async messages.
2779 # Set miss_send_len to 128, turning on packet-ins for our service connection.
2780 ovs-appctl -t ovs-ofctl ofctl/send 0409000c0123456700000080
2781 check_async 2 OFPR_ACTION OFPPR_ADD OFPPR_DELETE OFPRR_DELETE
2783 # Become slave (OF 1.3), which should disable everything except port status.
2784 ovs-appctl -t ovs-ofctl ofctl/send 041800180000000200000003000000000000000000000001
2785 check_async 3 OFPPR_ADD OFPPR_DELETE
2787 # Use OF 1.3 OFPT_SET_ASYNC to enable a patchwork of asynchronous messages.
2788 ovs-appctl -t ovs-ofctl ofctl/send 041c002000000002000000020000000500000005000000020000000200000005
2789 check_async 4 OFPR_INVALID_TTL OFPPR_DELETE OFPRR_DELETE
2791 # Set controller ID 123.
2792 ovs-appctl -t ovs-ofctl ofctl/send 04040018000000030000232000000014000000000000007b
2793 check_async 5 OFPR_NO_MATCH OFPPR_DELETE OFPRR_DELETE
2795 # Restore controller ID 0.
2796 ovs-appctl -t ovs-ofctl ofctl/send 040400180000000300002320000000140000000000000000
2798 # Become master (OF 1.3).
2799 ovs-appctl -t ovs-ofctl ofctl/send 041800180000000400000002000000000000000000000002
2800 check_async 6 OFPR_ACTION OFPPR_ADD
2802 ovs-appctl -t ovs-ofctl exit
2806 AT_SETUP([ofproto - asynchronous message control (OpenFlow 1.4)])
2808 AT_CHECK([ovs-ofctl -O OpenFlow14 monitor br0 --detach --no-chdir --pidfile])
2810 printf '\n\n--- check_async %d ---\n\n\n' $1
2814 ovs-appctl -t ovs-ofctl ofctl/barrier
2815 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
2818 # OFPT_PACKET_IN, OFPR_ACTION (controller_id=0)
2819 ovs-ofctl -O OpenFlow14 -v packet-out br0 none controller '0001020304050010203040501234'
2820 if test X"$1" = X"OFPR_ACTION"; then shift;
2821 echo >>expout "OFPT_PACKET_IN (OF1.4): total_len=14 in_port=ANY (via action) data_len=14 (unbuffered)
2822 vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1234"
2825 # OFPT_PACKET_IN, OFPR_NO_MATCH (controller_id=123)
2826 ovs-ofctl -O OpenFlow14 -v packet-out br0 none 'controller(reason=no_match,id=123)' '0001020304050010203040501234'
2827 if test X"$1" = X"OFPR_NO_MATCH"; then shift;
2828 echo >>expout "OFPT_PACKET_IN (OF1.4): total_len=14 in_port=ANY (via no_match) data_len=14 (unbuffered)
2829 vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1234"
2832 # OFPT_PACKET_IN, OFPR_INVALID_TTL (controller_id=0)
2833 ovs-ofctl -O OpenFlow14 packet-out br0 none dec_ttl '002583dfb4000026b98cb0f908004500003eb7e200000011339bac11370dac100002d7730035002b8f6d86fb0100000100000000000006626c702d7873066e696369726103636f6d00000f00'
2834 if test X"$1" = X"OFPR_INVALID_TTL"; then shift;
2835 echo >>expout "OFPT_PACKET_IN (OF1.4): total_len=76 in_port=ANY (via invalid_ttl) data_len=76 (unbuffered)
2836 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"
2839 # OFPT_PORT_STATUS, OFPPR_ADD
2840 ovs-vsctl add-port br0 test -- set Interface test type=dummy
2841 if test X"$1" = X"OFPPR_ADD"; then shift;
2842 echo >>expout "OFPT_PORT_STATUS (OF1.4): ADD: ${INDEX}(test): addr:aa:55:aa:55:00:0x
2845 speed: 0 Mbps now, 0 Mbps max"
2848 # OFPT_PORT_STATUS, OFPPR_MODIFY
2849 ovs-ofctl -O OpenFlow14 -vwarn mod-port br0 test up
2850 if test X"$1" = X"OFPPR_MODIFY"; then shift;
2851 echo >>expout "OFPT_PORT_STATUS (OF1.4): MOD: ${INDEX}(test): addr:aa:55:aa:55:00:0x
2854 speed: 0 Mbps now, 0 Mbps max
2855 OFPT_PORT_STATUS (OF1.4): MOD: ${INDEX}(test): addr:aa:55:aa:55:00:0x
2858 speed: 0 Mbps now, 0 Mbps max"
2861 # OFPT_PORT_STATUS, OFPPR_DELETE
2862 ovs-vsctl del-port br0 test
2863 if test X"$1" = X"OFPPR_DELETE"; then shift;
2864 echo >>expout "OFPT_PORT_STATUS (OF1.4): DEL: ${INDEX}(test): addr:aa:55:aa:55:00:0x
2867 speed: 0 Mbps now, 0 Mbps max"
2870 # OFPT_FLOW_REMOVED, OFPRR_DELETE
2871 ovs-ofctl -O OpenFlow14 add-flow br0 send_flow_rem,actions=drop
2872 ovs-ofctl -O OpenFlow14 --strict del-flows br0 ''
2873 if test X"$1" = X"OFPRR_DELETE"; then shift;
2874 echo >>expout "OFPT_FLOW_REMOVED (OF1.4): reason=delete table_id=0"
2877 # OFPT_FLOW_REMOVED, OFPRR_GROUP_DELETE
2878 ovs-ofctl -O OpenFlow14 add-group br0 group_id=1234,type=all,bucket=output:10
2879 ovs-ofctl -O OpenFlow14 add-flow br0 send_flow_rem,actions=group:1234
2880 ovs-ofctl -O OpenFlow14 --strict del-groups br0 group_id=1234
2881 if test X"$1" = X"OFPRR_GROUP_DELETE"; then shift;
2882 echo >>expout "OFPT_FLOW_REMOVED (OF1.4): reason=group_delete table_id=0"
2885 AT_FAIL_IF([test X"$1" != X])
2887 ovs-appctl -t ovs-ofctl ofctl/barrier
2888 echo >>expout "OFPT_BARRIER_REPLY (OF1.4):"
2892 s/ (xid=0x[0-9a-fA-F]*)//
2894 s/00:0.$/00:0x/' < monitor.log]],
2898 # It's a service connection so initially there should be no async messages.
2901 # Set miss_send_len to 128, turning on packet-ins for our service connection.
2902 ovs-appctl -t ovs-ofctl ofctl/send 0509000c0123456700000080
2903 check_async 2 OFPR_ACTION OFPPR_ADD OFPPR_MODIFY OFPPR_DELETE OFPRR_DELETE OFPRR_GROUP_DELETE
2905 # Become slave (OF 1.4), which should disable everything except port status.
2906 ovs-appctl -t ovs-ofctl ofctl/send 051800180000000200000003000000000000000000000001
2907 check_async 3 OFPPR_ADD OFPPR_MODIFY OFPPR_DELETE
2909 # Use OF 1.4 OFPT_SET_ASYNC to enable a patchwork of asynchronous messages.
2910 ovs-appctl -t ovs-ofctl ofctl/send 051c0038000000020000000800000005000100080000000200020008000000020003000800000005000400080000001c0005000800000005
2911 check_async 4 OFPR_INVALID_TTL OFPPR_DELETE OFPRR_DELETE OFPRR_GROUP_DELETE
2913 # Set controller ID 123.
2914 ovs-appctl -t ovs-ofctl ofctl/send 05040018000000030000232000000014000000000000007b
2915 check_async 5 OFPR_NO_MATCH OFPPR_DELETE OFPRR_DELETE OFPRR_GROUP_DELETE
2917 # Restore controller ID 0.
2918 ovs-appctl -t ovs-ofctl ofctl/send 050400180000000300002320000000140000000000000000
2920 # Become master (OF 1.4).
2921 ovs-appctl -t ovs-ofctl ofctl/send 051800180000000400000002000000000000000000000002
2922 check_async 6 OFPR_ACTION OFPPR_ADD OFPPR_MODIFY OFPRR_DELETE
2924 ovs-appctl -t ovs-ofctl exit
2928 AT_SETUP([ofproto - asynchronous message control (OpenFlow 1.5)])
2930 AT_CHECK([ovs-ofctl -O OpenFlow15 monitor br0 --detach --no-chdir --pidfile])
2932 printf '\n\n--- check_async %d ---\n\n\n' $1
2936 ovs-appctl -t ovs-ofctl ofctl/barrier
2937 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
2940 # Other tests are not working with OF 1.5, and message
2941 # format may change, so leave them out.
2943 # OFPT_PORT_STATUS, OFPPR_ADD
2944 ovs-vsctl add-port br0 test -- set Interface test type=dummy
2945 if test X"$1" = X"OFPPR_ADD"; then shift;
2946 echo >>expout "OFPT_PORT_STATUS (OF1.5): ADD: ${INDEX}(test): addr:aa:55:aa:55:00:0x
2949 speed: 0 Mbps now, 0 Mbps max"
2952 # OFPT_PORT_STATUS, OFPPR_MODIFY
2953 ovs-ofctl -O OpenFlow15 -vwarn mod-port br0 test up
2954 if test X"$1" = X"OFPPR_MODIFY"; then shift;
2955 echo >>expout "OFPT_PORT_STATUS (OF1.5): MOD: ${INDEX}(test): addr:aa:55:aa:55:00:0x
2958 speed: 0 Mbps now, 0 Mbps max
2959 OFPT_PORT_STATUS (OF1.5): MOD: 2(test): addr:aa:55:aa:55:00:0x
2962 speed: 0 Mbps now, 0 Mbps max"
2965 # OFPT_PORT_STATUS, OFPPR_DELETE
2966 ovs-vsctl del-port br0 test
2967 if test X"$1" = X"OFPPR_DELETE"; then shift;
2968 echo >>expout "OFPT_PORT_STATUS (OF1.5): DEL: ${INDEX}(test): addr:aa:55:aa:55:00:0x
2971 speed: 0 Mbps now, 0 Mbps max"
2974 AT_FAIL_IF([test X"$1" != X])
2976 ovs-appctl -t ovs-ofctl ofctl/barrier
2977 echo >>expout "OFPT_BARRIER_REPLY (OF1.5):"
2981 s/ (xid=0x[0-9a-fA-F]*)//
2983 s/00:0.$/00:0x/' < monitor.log]],
2987 # It's a service connection so initially there should be no async messages.
2990 # If we don't set this, async messages are not received.
2991 # Set miss_send_len to 128, turning on packet-ins for our service connection.
2992 ovs-appctl -t ovs-ofctl ofctl/send 0609000c0123456700000080
2993 check_async 2 OFPPR_ADD OFPPR_MODIFY OFPPR_DELETE
2995 # Set-async has changed in OF 1.4 and is not yet implemented.
2997 ovs-appctl -t ovs-ofctl exit
3001 dnl This test checks that the role request/response messaging works
3002 dnl and that generation_id is handled properly.
3003 AT_SETUP([ofproto - controller role (OpenFlow 1.2)])
3005 on_exit 'kill `cat c1.pid c2.pid`'
3007 # Start two ovs-ofctl controller processes.
3008 AT_CAPTURE_FILE([monitor1.log])
3009 AT_CAPTURE_FILE([expout1])
3010 AT_CAPTURE_FILE([experr1])
3011 AT_CAPTURE_FILE([monitor2.log])
3012 AT_CAPTURE_FILE([expout2])
3013 AT_CAPTURE_FILE([experr2])
3015 AT_CHECK([ovs-ofctl -O OpenFlow12 monitor br0 --detach --no-chdir --pidfile=`pwd`/c$i.pid --unixctl=`pwd`/c$i])
3016 ovs-appctl -t `pwd`/c$i ofctl/barrier
3017 ovs-appctl -t `pwd`/c$i ofctl/set-output-file monitor$i.log
3021 # find out current role
3022 ovs-appctl -t `pwd`/c$i ofctl/send 031800180000000200000000000000000000000000000000
3023 echo >>experr$i "send: OFPT_ROLE_REQUEST (OF1.2): role=nochange"
3024 echo >>expout$i "OFPT_ROLE_REPLY (OF1.2): role=equal"
3027 # controller 1: Become slave (generation_id is initially undefined, so
3028 # 2^63+2 should not be stale)
3029 ovs-appctl -t `pwd`/c1 ofctl/send 031800180000000300000003000000008000000000000002
3030 echo >>experr1 "send: OFPT_ROLE_REQUEST (OF1.2): role=slave generation_id=9223372036854775810"
3031 echo >>expout1 "OFPT_ROLE_REPLY (OF1.2): role=slave generation_id=9223372036854775810"
3033 # controller 2: Become master.
3034 ovs-appctl -t `pwd`/c2 ofctl/send 031800180000000300000002000000008000000000000003
3035 echo >>experr2 "send: OFPT_ROLE_REQUEST (OF1.2): role=master generation_id=9223372036854775811"
3036 echo >>expout2 "OFPT_ROLE_REPLY (OF1.2): role=master generation_id=9223372036854775811"
3038 # controller 1: Try to become the master using a stale generation ID
3039 ovs-appctl -t `pwd`/c1 ofctl/send 031800180000000400000002000000000000000000000003
3040 echo >>experr1 "send: OFPT_ROLE_REQUEST (OF1.2): role=master generation_id=3"
3041 echo >>expout1 "OFPT_ERROR (OF1.2): OFPRRFC_STALE"
3042 echo >>expout1 "OFPT_ROLE_REQUEST (OF1.2): role=master generation_id=3"
3044 # controller 1: Become master using a valid generation ID
3045 ovs-appctl -t `pwd`/c1 ofctl/send 031800180000000500000002000000000000000000000001
3046 echo >>experr1 "send: OFPT_ROLE_REQUEST (OF1.2): role=master generation_id=1"
3047 echo >>expout1 "OFPT_ROLE_REPLY (OF1.2): role=master generation_id=1"
3050 ovs-appctl -t `pwd`/c$i ofctl/barrier
3051 echo >>expout$i "OFPT_BARRIER_REPLY (OF1.2):"
3057 AT_CHECK([grep -v '^send:' monitor$i.log | STRIP_XIDS], [0], [expout])
3059 AT_CHECK([grep '^send:' monitor$i.log | STRIP_XIDS], [0], [expout])
3064 dnl This test checks that the role request/response messaging works,
3065 dnl that generation_id is handled properly, and that role status update
3066 dnl messages are sent when a controller's role gets changed from master
3068 AT_SETUP([ofproto - controller role (OpenFlow 1.4)])
3070 on_exit 'kill `cat c1.pid c2.pid`'
3072 # Start two ovs-ofctl controller processes.
3073 AT_CAPTURE_FILE([monitor1.log])
3074 AT_CAPTURE_FILE([expout1])
3075 AT_CAPTURE_FILE([experr1])
3076 AT_CAPTURE_FILE([monitor2.log])
3077 AT_CAPTURE_FILE([expout2])
3078 AT_CAPTURE_FILE([experr2])
3080 AT_CHECK([ovs-ofctl -O OpenFlow14 monitor br0 --detach --no-chdir --pidfile=`pwd`/c$i.pid --unixctl=`pwd`/c$i])
3081 ovs-appctl -t `pwd`/c$i ofctl/barrier
3082 ovs-appctl -t `pwd`/c$i ofctl/set-output-file monitor$i.log
3086 # find out current role
3087 ovs-appctl -t `pwd`/c$i ofctl/send 051800180000000200000000000000000000000000000000
3088 echo >>experr$i "send: OFPT_ROLE_REQUEST (OF1.4): role=nochange"
3089 echo >>expout$i "OFPT_ROLE_REPLY (OF1.4): role=equal"
3092 # controller 1: Become slave (generation_id is initially undefined, so
3093 # 2^63+2 should not be stale)
3094 ovs-appctl -t `pwd`/c1 ofctl/send 051800180000000300000003000000008000000000000002
3095 echo >>experr1 "send: OFPT_ROLE_REQUEST (OF1.4): role=slave generation_id=9223372036854775810"
3096 echo >>expout1 "OFPT_ROLE_REPLY (OF1.4): role=slave generation_id=9223372036854775810"
3098 # controller 2: Become master.
3099 ovs-appctl -t `pwd`/c2 ofctl/send 051800180000000300000002000000008000000000000003
3100 echo >>experr2 "send: OFPT_ROLE_REQUEST (OF1.4): role=master generation_id=9223372036854775811"
3101 echo >>expout2 "OFPT_ROLE_REPLY (OF1.4): role=master generation_id=9223372036854775811"
3103 # controller 1: Try to become the master using a stale generation ID
3104 ovs-appctl -t `pwd`/c1 ofctl/send 051800180000000400000002000000000000000000000003
3105 echo >>experr1 "send: OFPT_ROLE_REQUEST (OF1.4): role=master generation_id=3"
3106 echo >>expout1 "OFPT_ERROR (OF1.4): OFPRRFC_STALE"
3107 echo >>expout1 "OFPT_ROLE_REQUEST (OF1.4): role=master generation_id=3"
3109 # controller 1: Become master using a valid generation ID
3110 ovs-appctl -t `pwd`/c1 ofctl/send 051800180000000500000002000000000000000000000001
3111 echo >>experr1 "send: OFPT_ROLE_REQUEST (OF1.4): role=master generation_id=1"
3112 echo >>expout1 "OFPT_ROLE_REPLY (OF1.4): role=master generation_id=1"
3113 echo >>expout2 "OFPT_ROLE_STATUS (OF1.4): role=slave generation_id=1 reason=master_request"
3116 ovs-appctl -t `pwd`/c$i ofctl/barrier
3117 echo >>expout$i "OFPT_BARRIER_REPLY (OF1.4):"
3123 AT_CHECK([grep -v '^send:' monitor$i.log | STRIP_XIDS], [0], [expout])
3125 AT_CHECK([grep '^send:' monitor$i.log | STRIP_XIDS], [0], [expout])
3130 dnl This test checks the Group and meter notifications when a group mod
3131 dnl command is sent from one controller and the reply is received by
3132 dnl other controllers.
3133 AT_SETUP([ofproto - requestforward (OpenFlow 1.4)])
3135 on_exit 'kill `cat c1.pid c2.pid c3.pid`'
3137 # Start two ovs-ofctl controller processes.
3138 AT_CAPTURE_FILE([monitor1.log])
3139 AT_CAPTURE_FILE([expout1])
3140 AT_CAPTURE_FILE([monitor2.log])
3141 AT_CAPTURE_FILE([expout2])
3142 AT_CAPTURE_FILE([monitor3.log])
3143 AT_CAPTURE_FILE([expout3])
3145 ovs-ofctl -O OpenFlow15 monitor br0 --detach --no-chdir --pidfile=`pwd`/c1.pid --unixctl=`pwd`/c1
3146 ovs-ofctl -O OpenFlow14 monitor br0 --detach --no-chdir --pidfile=`pwd`/c2.pid --unixctl=`pwd`/c2
3147 ovs-ofctl -O OpenFlow14 monitor br0 --detach --no-chdir --pidfile=`pwd`/c3.pid --unixctl=`pwd`/c3
3151 ovs-appctl -t `pwd`/c$i ofctl/barrier
3152 ovs-appctl -t `pwd`/c$i ofctl/set-output-file monitor$i.log
3156 printf '\n\n--- check_async %d ---\n\n\n' $1
3161 ovs-appctl -t `pwd`/c2 ofctl/send "050f0020000000020000000000000001 00100000 ffffffffffffffff 00000000"
3162 if test X"$1" = X"OFPGC_ADD"; then shift;
3163 echo >>expout2 "send: OFPT_GROUP_MOD (OF1.4):
3164 ADD group_id=1,type=all,bucket=actions=drop"
3165 echo >>expout1 "OFPT_REQUESTFORWARD (OF1.5): reason=group_mod
3166 ADD group_id=1,type=all,bucket=bucket_id:0,actions=drop"
3167 echo >>expout3 "OFPT_REQUESTFORWARD (OF1.4): reason=group_mod
3168 ADD group_id=1,type=all,bucket=actions=drop"
3172 ovs-appctl -t `pwd`/c2 ofctl/send "050f0020000000020001010000000001 00100000 ffffffffffffffff 00000000"
3173 if test X"$1" = X"OFPGC_MODIFY"; then shift;
3174 echo >>expout2 "send: OFPT_GROUP_MOD (OF1.4):
3175 MOD group_id=1,type=select,bucket=weight:0,actions=drop"
3176 echo >>expout1 "OFPT_REQUESTFORWARD (OF1.5): reason=group_mod
3177 MOD group_id=1,type=select,bucket=bucket_id:0,weight:0,actions=drop"
3178 echo >>expout3 "OFPT_REQUESTFORWARD (OF1.4): reason=group_mod
3179 MOD group_id=1,type=select,bucket=weight:0,actions=drop"
3182 ovs-appctl -t `pwd`/c1 ofctl/barrier
3183 echo >>expout1 "OFPT_BARRIER_REPLY (OF1.5):"
3184 ovs-appctl -t `pwd`/c2 ofctl/barrier
3185 echo >>expout2 "OFPT_BARRIER_REPLY (OF1.4):"
3186 ovs-appctl -t `pwd`/c3 ofctl/barrier
3187 echo >>expout3 "OFPT_BARRIER_REPLY (OF1.4):"
3194 s/ (xid=0x[0-9a-fA-F]*)//'< monitor$i.log]],
3199 # controller 1: Become slave
3200 ovs-appctl -t `pwd`/c1 ofctl/send 061800180000000300000003000000008000000000000002
3202 # controller 2: Become master
3203 ovs-appctl -t `pwd`/c2 ofctl/send 051800180000000300000002000000008000000000000003
3205 # controller 1: Become slave
3206 ovs-appctl -t `pwd`/c3 ofctl/send 051800180000000300000003000000008000000000000004
3208 # controller 1: Enabled requestforward using set Asynchronous message
3209 ovs-appctl -t `pwd`/c1 ofctl/send 061c00280000000200000008000000050002000800000002000400080000001a000a000800000003
3211 # controller 2: Enabled requestforward using set Asynchronous message
3212 ovs-appctl -t `pwd`/c2 ofctl/send 051c002800000002000100080000000200030008000000050005000800000005000b000800000003
3214 # controller 1: Enabled requestforward using set Asynchronous message
3215 ovs-appctl -t `pwd`/c3 ofctl/send 051c00280000000200000008000000050002000800000002000400080000001a000a000800000003
3216 check_async 1 OFPGC_ADD OFPGC_MODIFY
3221 dnl This test checks that OFPT_PACKET_OUT accepts both OFPP_NONE (as
3222 dnl specified by OpenFlow 1.0) and OFPP_CONTROLLER (used by some
3223 dnl controllers despite the spec) as meaning a packet that was generated
3224 dnl by the controller.
3225 AT_SETUP([ofproto - packet-out from controller (OpenFlow 1.0)])
3227 ADD_OF_PORTS([br0], [1])
3229 # Start a monitor listening for packet-ins.
3230 AT_CHECK([ovs-ofctl -P openflow10 monitor br0 --detach --no-chdir --pidfile])
3231 ovs-appctl -t ovs-ofctl ofctl/send 0109000c0123456700000080
3232 ovs-appctl -t ovs-ofctl ofctl/barrier
3233 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
3234 AT_CAPTURE_FILE([monitor.log])
3236 # Send some packet-outs with OFPP_NONE and OFPP_CONTROLLER (65533) as in_port.
3237 AT_CHECK([ovs-ofctl packet-out br0 none controller,1 '0001020304050010203040501234'])
3238 AT_CHECK([ovs-ofctl packet-out br0 controller controller,1 '0001020304050010203040505678'])
3240 # Stop the monitor and check its output.
3241 ovs-appctl -t ovs-ofctl ofctl/barrier
3242 ovs-appctl -t ovs-ofctl exit
3244 ovs-ofctl dump-ports br0
3246 AT_CHECK([sed 's/ (xid=0x[[0-9a-fA-F]]*)//' monitor.log], [0], [dnl
3247 OFPT_PACKET_IN: total_len=14 in_port=ANY (via action) data_len=14 (unbuffered)
3248 vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1234
3249 OFPT_PACKET_IN: total_len=14 in_port=CONTROLLER (via action) data_len=14 (unbuffered)
3250 vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x5678
3257 dnl This test checks that OFPT_PACKET_OUT accepts both OFPP_NONE (as
3258 dnl specified by OpenFlow 1.2) and OFPP_CONTROLLER (used by some
3259 dnl controllers despite the spec) as meaning a packet that was generated
3260 dnl by the controller.
3261 AT_SETUP([ofproto - packet-out from controller (OpenFlow 1.2)])
3264 # Start a monitor listening for packet-ins.
3265 AT_CHECK([ovs-ofctl -O OpenFlow12 monitor br0 --detach --no-chdir --pidfile])
3266 ovs-appctl -t ovs-ofctl ofctl/send 0309000c0123456700000080
3267 ovs-appctl -t ovs-ofctl ofctl/barrier
3268 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
3269 AT_CAPTURE_FILE([monitor.log])
3271 # Send some packet-outs with OFPP_NONE and OFPP_CONTROLLER (65533) as in_port.
3272 AT_CHECK([ovs-ofctl -O OpenFlow12 packet-out br0 none controller '0001020304050010203040501234'])
3273 AT_CHECK([ovs-ofctl -O OpenFlow12 packet-out br0 4294967293 controller '0001020304050010203040505678'])
3275 # Stop the monitor and check its output.
3276 ovs-appctl -t ovs-ofctl ofctl/barrier
3277 ovs-appctl -t ovs-ofctl exit
3279 AT_CHECK([sed 's/ (xid=0x[[0-9a-fA-F]]*)//' monitor.log], [0], [dnl
3280 OFPT_PACKET_IN (OF1.2): total_len=14 in_port=ANY (via action) data_len=14 (unbuffered)
3281 vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1234
3282 OFPT_PACKET_IN (OF1.2): total_len=14 in_port=CONTROLLER (via action) data_len=14 (unbuffered)
3283 vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x5678
3284 OFPT_BARRIER_REPLY (OF1.2):
3290 dnl This test checks that OFPT_PACKET_OUT accepts both OFPP_NONE (as
3291 dnl specified by OpenFlow 1.1) and OFPP_CONTROLLER (used by some
3292 dnl controllers despite the spec) as meaning a packet that was generated
3293 dnl by the controller.
3294 AT_SETUP([ofproto - packet-out from controller (OpenFlow 1.1)])
3297 # Start a monitor listening for packet-ins.
3298 AT_CHECK([ovs-ofctl -O OpenFlow11 monitor br0 --detach --no-chdir --pidfile])
3299 ovs-appctl -t ovs-ofctl ofctl/send 0209000c0123456700000080
3300 ovs-appctl -t ovs-ofctl ofctl/barrier
3301 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
3302 AT_CAPTURE_FILE([monitor.log])
3304 # Send some packet-outs with OFPP_NONE and OFPP_CONTROLLER (65533) as in_port.
3305 AT_CHECK([ovs-ofctl -O OpenFlow11 packet-out br0 none controller '0001020304050010203040501234'])
3306 AT_CHECK([ovs-ofctl -O OpenFlow11 packet-out br0 4294967293 controller '0001020304050010203040505678'])
3308 # Stop the monitor and check its output.
3309 ovs-appctl -t ovs-ofctl ofctl/barrier
3310 ovs-appctl -t ovs-ofctl exit
3312 AT_CHECK([sed 's/ (xid=0x[[0-9a-fA-F]]*)//' monitor.log], [0], [dnl
3313 OFPT_PACKET_IN (OF1.1): total_len=14 in_port=ANY (via action) data_len=14 (unbuffered)
3314 vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1234
3315 OFPT_PACKET_IN (OF1.1): total_len=14 in_port=CONTROLLER (via action) data_len=14 (unbuffered)
3316 vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x5678
3317 OFPT_BARRIER_REPLY (OF1.1):
3323 dnl This test checks that metadata is encoded in packet_in structures,
3324 dnl supported by NXAST.
3325 AT_SETUP([ofproto - packet-out with metadata (NXM)])
3328 # Start a monitor listening for packet-ins.
3329 AT_CHECK([ovs-ofctl -P nxm monitor br0 --detach --no-chdir --pidfile])
3330 ovs-appctl -t ovs-ofctl ofctl/send 0109000c0123456700000080
3331 ovs-appctl -t ovs-ofctl ofctl/barrier
3332 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
3333 AT_CAPTURE_FILE([monitor.log])
3335 # Send a packet-out with a load action to set some metadata, and forward to controller
3336 AT_CHECK([ovs-ofctl packet-out br0 controller 'load(0xfafafafa5a5a5a5a->OXM_OF_METADATA[[0..63]]), load(0xaa->NXM_NX_PKT_MARK[[]]), controller' '0001020304050010203040501234'])
3338 # Stop the monitor and check its output.
3339 ovs-appctl -t ovs-ofctl ofctl/barrier
3340 ovs-appctl -t ovs-ofctl exit
3342 AT_CHECK([sed 's/ (xid=0x[[0-9a-fA-F]]*)//' monitor.log], [0], [dnl
3343 NXT_PACKET_IN: total_len=14 pkt_mark=0xaa,metadata=0xfafafafa5a5a5a5a,in_port=CONTROLLER (via action) data_len=14 (unbuffered)
3344 vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1234
3351 dnl This test checks that metadata is encoded in packet_in structures,
3352 dnl supported by NXAST.
3353 AT_SETUP([ofproto - packet-out with metadata (OpenFlow 1.2)])
3356 # Start a monitor listening for packet-ins.
3357 AT_CHECK([ovs-ofctl -O OpenFlow12 monitor br0 --detach --no-chdir --pidfile])
3358 ovs-appctl -t ovs-ofctl ofctl/send 0309000c0123456700000080
3359 ovs-appctl -t ovs-ofctl ofctl/barrier
3360 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
3361 AT_CAPTURE_FILE([monitor.log])
3363 # Send a packet-out with a set-field action to set some metadata, and forward to controller
3364 AT_CHECK([ovs-ofctl -O OpenFlow12 packet-out br0 none 'set_field:0xfafafafa5a5a5a5a->metadata, controller' '0001020304050010203040501234'])
3366 # Stop the monitor and check its output.
3367 ovs-appctl -t ovs-ofctl ofctl/barrier
3368 ovs-appctl -t ovs-ofctl exit
3370 AT_CHECK([sed 's/ (xid=0x[[0-9a-fA-F]]*)//' monitor.log], [0], [dnl
3371 OFPT_PACKET_IN (OF1.2): total_len=14 metadata=0xfafafafa5a5a5a5a,in_port=ANY (via action) data_len=14 (unbuffered)
3372 vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1234
3373 OFPT_BARRIER_REPLY (OF1.2):
3379 dnl This test checks that metadata is encoded in packet_in structures,
3380 dnl supported by NXAST.
3381 AT_SETUP([ofproto - packet-out with metadata and dual set_field (OpenFlow 1.3)])
3384 # Start a monitor listening for packet-ins.
3385 AT_CHECK([ovs-ofctl -O OpenFlow13 monitor br0 --detach --no-chdir --pidfile])
3386 ovs-appctl -t ovs-ofctl ofctl/send 0409000c0123456700000080
3387 ovs-appctl -t ovs-ofctl ofctl/barrier
3388 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
3389 AT_CAPTURE_FILE([monitor.log])
3391 # Send a packet-out with a couple of set-field action to set some metadata, and forward to controller
3392 AT_CHECK([ovs-ofctl -O OpenFlow13 packet-out br0 none 'set_field:0xfafafafa5a5a5a5a->metadata, set_field:0x6b->metadata, controller' '0001020304050010203040501234'])
3394 # Stop the monitor and check its output.
3395 ovs-appctl -t ovs-ofctl ofctl/barrier
3396 ovs-appctl -t ovs-ofctl exit
3398 AT_CHECK([sed 's/ (xid=0x[[0-9a-fA-F]]*)//' monitor.log], [0], [dnl
3399 OFPT_PACKET_IN (OF1.3): total_len=14 metadata=0x6b,in_port=ANY (via action) data_len=14 (unbuffered)
3400 vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1234
3401 OFPT_BARRIER_REPLY (OF1.3):
3407 dnl This test checks that tunnel metadata is encoded in packet_in structures.
3408 AT_SETUP([ofproto - packet-out with tunnel metadata (OpenFlow 1.2)])
3411 # Start a monitor listening for packet-ins.
3412 AT_CHECK([ovs-ofctl -O OpenFlow12 monitor br0 --detach --no-chdir --pidfile])
3413 ovs-appctl -t ovs-ofctl ofctl/send 0309000c0123456700000080
3414 ovs-appctl -t ovs-ofctl ofctl/barrier
3415 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
3416 AT_CAPTURE_FILE([monitor.log])
3418 # Send a packet-out with set field actions to set some tunnel metadata, and forward to controller
3419 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'])
3421 # Stop the monitor and check its output.
3422 ovs-appctl -t ovs-ofctl ofctl/barrier
3423 ovs-appctl -t ovs-ofctl exit
3425 AT_CHECK([sed 's/ (xid=0x[[0-9a-fA-F]]*)//' monitor.log], [0], [dnl
3426 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)
3427 vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1234
3428 OFPT_BARRIER_REPLY (OF1.2):
3434 m4_divert_push([PREPARE_TESTS])
3435 # Sorts groups of lines that start with a space, without moving them
3436 # past the nearest line that does not start with a space.
3446 print $_ foreach sort(@buffer);
3451 print $_ foreach sort(@buffer);
3454 m4_divert_pop([PREPARE_TESTS])
3456 AT_SETUP([ofproto - flow monitoring])
3457 AT_KEYWORDS([monitor])
3460 ovs-ofctl add-flow br0 in_port=0,dl_vlan=123,actions=output:1
3462 # Start a monitor watching the flow table and check the initial reply.
3463 ovs-ofctl monitor br0 watch: --detach --no-chdir --pidfile >monitor.log 2>&1
3464 AT_CAPTURE_FILE([monitor.log])
3465 ovs-appctl -t ovs-ofctl ofctl/barrier
3466 AT_CHECK([sed 's/ (xid=0x[[1-9a-fA-F]][[0-9a-fA-F]]*)//' monitor.log], [0],
3467 [NXST_FLOW_MONITOR reply:
3468 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=123 actions=output:1
3472 # Add, delete, and modify some flows and check the updates.
3473 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
3474 ovs-ofctl add-flow br0 in_port=0,dl_vlan=124,actions=output:2
3475 ovs-ofctl add-flow br0 in_port=0,dl_vlan=123,actions=output:5
3476 ovs-ofctl add-flow br0 in_port=0,dl_vlan=123,dl_vlan_pcp=0,actions=output:6
3477 ovs-ofctl add-flow br0 in_port=0,dl_vlan=123,dl_vlan_pcp=1,actions=output:7
3478 ovs-ofctl add-flow br0 in_port=0,dl_vlan=123,actions=output:8
3479 ovs-ofctl add-flow br0 in_port=0,dl_vlan=65535,dl_vlan_pcp=0,actions=output:9
3480 ovs-ofctl add-flow br0 in_port=0,dl_vlan=65535,dl_vlan_pcp=1,actions=output:10
3481 ovs-ofctl add-flow br0 in_port=0,dl_vlan=65535,actions=output:11
3482 ovs-ofctl add-flow br0 in_port=0,dl_vlan=8191,dl_vlan_pcp=0,actions=output:12
3483 ovs-ofctl add-flow br0 in_port=0,dl_vlan=8191,dl_vlan_pcp=1,actions=output:13
3484 ovs-ofctl add-flow br0 in_port=0,dl_vlan=8191,actions=output:14
3485 ovs-ofctl add-flow br0 in_port=0,dl_vlan=0,dl_vlan_pcp=0,actions=output:15
3486 ovs-ofctl add-flow br0 in_port=0,dl_vlan=0,dl_vlan_pcp=1,actions=output:16
3487 ovs-ofctl add-flow br0 in_port=0,dl_vlan=0,actions=output:17
3488 ovs-ofctl add-flow br0 in_port=0,dl_vlan=0,dl_vlan_pcp=0,actions=output:18
3489 ovs-ofctl add-flow br0 in_port=0,dl_vlan=0,dl_vlan_pcp=1,actions=output:19
3490 ovs-ofctl add-flow br0 in_port=0,dl_vlan=0,actions=output:20
3491 ovs-ofctl add-flow br0 in_port=0,dl_vlan_pcp=0,actions=output:21
3492 ovs-ofctl add-flow br0 in_port=0,dl_vlan_pcp=1,actions=output:22
3493 ovs-ofctl add-flow br0 in_port=0,actions=output:23
3494 ovs-ofctl mod-flows br0 dl_vlan=123,actions=output:3
3495 ovs-ofctl mod-flows br0 cookie=5,dl_vlan=123,actions=output:3
3496 ovs-ofctl del-flows br0 dl_vlan=123
3497 ovs-ofctl del-flows br0
3498 ovs-appctl -t ovs-ofctl ofctl/barrier
3499 AT_CHECK([sed 's/ (xid=0x[[1-9a-fA-F]][[0-9a-fA-F]]*)//' monitor.log | multiline_sort], [0],
3500 [NXST_FLOW_MONITOR reply (xid=0x0):
3501 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=124 actions=output:2
3502 NXST_FLOW_MONITOR reply (xid=0x0):
3503 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=123 actions=output:5
3504 NXST_FLOW_MONITOR reply (xid=0x0):
3505 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=123,dl_vlan_pcp=0 actions=output:6
3506 NXST_FLOW_MONITOR reply (xid=0x0):
3507 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=123,dl_vlan_pcp=1 actions=output:7
3508 NXST_FLOW_MONITOR reply (xid=0x0):
3509 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=123 actions=output:8
3510 NXST_FLOW_MONITOR reply (xid=0x0):
3511 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=0,dl_vlan_pcp=0 actions=output:9
3512 NXST_FLOW_MONITOR reply (xid=0x0):
3513 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=0,dl_vlan_pcp=1 actions=output:10
3514 NXST_FLOW_MONITOR reply (xid=0x0):
3515 event=ADDED table=0 cookie=0 in_port=0,vlan_tci=0x0000 actions=output:11
3516 NXST_FLOW_MONITOR reply (xid=0x0):
3517 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=4095,dl_vlan_pcp=0 actions=output:12
3518 NXST_FLOW_MONITOR reply (xid=0x0):
3519 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=4095,dl_vlan_pcp=1 actions=output:13
3520 NXST_FLOW_MONITOR reply (xid=0x0):
3521 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=4095 actions=output:14
3522 NXST_FLOW_MONITOR reply (xid=0x0):
3523 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=0,dl_vlan_pcp=0 actions=output:15
3524 NXST_FLOW_MONITOR reply (xid=0x0):
3525 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=0,dl_vlan_pcp=1 actions=output:16
3526 NXST_FLOW_MONITOR reply (xid=0x0):
3527 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=0 actions=output:17
3528 NXST_FLOW_MONITOR reply (xid=0x0):
3529 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=0,dl_vlan_pcp=0 actions=output:18
3530 NXST_FLOW_MONITOR reply (xid=0x0):
3531 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=0,dl_vlan_pcp=1 actions=output:19
3532 NXST_FLOW_MONITOR reply (xid=0x0):
3533 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=0 actions=output:20
3534 NXST_FLOW_MONITOR reply (xid=0x0):
3535 event=ADDED table=0 cookie=0 in_port=0,dl_vlan_pcp=0 actions=output:21
3536 NXST_FLOW_MONITOR reply (xid=0x0):
3537 event=ADDED table=0 cookie=0 in_port=0,dl_vlan_pcp=1 actions=output:22
3538 NXST_FLOW_MONITOR reply (xid=0x0):
3539 event=ADDED table=0 cookie=0 in_port=0 actions=output:23
3540 NXST_FLOW_MONITOR reply (xid=0x0):
3541 event=MODIFIED table=0 cookie=0 in_port=0,dl_vlan=123 actions=output:3
3542 event=MODIFIED table=0 cookie=0 in_port=0,dl_vlan=123,dl_vlan_pcp=0 actions=output:3
3543 event=MODIFIED table=0 cookie=0 in_port=0,dl_vlan=123,dl_vlan_pcp=1 actions=output:3
3544 NXST_FLOW_MONITOR reply (xid=0x0):
3545 event=MODIFIED table=0 cookie=0x5 in_port=0,dl_vlan=123 actions=output:3
3546 event=MODIFIED table=0 cookie=0x5 in_port=0,dl_vlan=123,dl_vlan_pcp=0 actions=output:3
3547 event=MODIFIED table=0 cookie=0x5 in_port=0,dl_vlan=123,dl_vlan_pcp=1 actions=output:3
3548 NXST_FLOW_MONITOR reply (xid=0x0):
3549 event=DELETED reason=delete table=0 cookie=0x5 in_port=0,dl_vlan=123 actions=output:3
3550 event=DELETED reason=delete table=0 cookie=0x5 in_port=0,dl_vlan=123,dl_vlan_pcp=0 actions=output:3
3551 event=DELETED reason=delete table=0 cookie=0x5 in_port=0,dl_vlan=123,dl_vlan_pcp=1 actions=output:3
3552 NXST_FLOW_MONITOR reply (xid=0x0):
3553 event=DELETED reason=delete table=0 cookie=0 in_port=0 actions=output:23
3554 event=DELETED reason=delete table=0 cookie=0 in_port=0,dl_vlan=0 actions=output:20
3555 event=DELETED reason=delete table=0 cookie=0 in_port=0,dl_vlan=0,dl_vlan_pcp=0 actions=output:18
3556 event=DELETED reason=delete table=0 cookie=0 in_port=0,dl_vlan=0,dl_vlan_pcp=1 actions=output:19
3557 event=DELETED reason=delete table=0 cookie=0 in_port=0,dl_vlan=124 actions=output:2
3558 event=DELETED reason=delete table=0 cookie=0 in_port=0,dl_vlan=4095 actions=output:14
3559 event=DELETED reason=delete table=0 cookie=0 in_port=0,dl_vlan=4095,dl_vlan_pcp=0 actions=output:12
3560 event=DELETED reason=delete table=0 cookie=0 in_port=0,dl_vlan=4095,dl_vlan_pcp=1 actions=output:13
3561 event=DELETED reason=delete table=0 cookie=0 in_port=0,dl_vlan_pcp=0 actions=output:21
3562 event=DELETED reason=delete table=0 cookie=0 in_port=0,dl_vlan_pcp=1 actions=output:22
3563 event=DELETED reason=delete table=0 cookie=0 in_port=0,vlan_tci=0x0000 actions=output:11
3567 # Check that our own changes are reported as full updates.
3568 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
3569 ovs-ofctl add-flow br0 in_port=1,actions=output:2
3570 ovs-ofctl add-flow br0 in_port=2,actions=output:1
3571 ovs-appctl -t ovs-ofctl ofctl/barrier
3572 ovs-appctl -t ovs-ofctl ofctl/send 010e004812345678003fffff00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003000000000000ffffffffffff0000
3573 ovs-appctl -t ovs-ofctl ofctl/barrier
3574 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip], [0], [NXST_FLOW reply:
3576 AT_CHECK([sed 's/ (xid=0x[[1-9a-fA-F]][[0-9a-fA-F]]*)//' monitor.log | multiline_sort], [0],
3577 [NXST_FLOW_MONITOR reply (xid=0x0):
3578 event=ADDED table=0 cookie=0 in_port=1 actions=output:2
3579 NXST_FLOW_MONITOR reply (xid=0x0):
3580 event=ADDED table=0 cookie=0 in_port=2 actions=output:1
3582 send: OFPT_FLOW_MOD: DEL priority=0 actions=drop
3583 NXST_FLOW_MONITOR reply (xid=0x0):
3584 event=DELETED reason=delete table=0 cookie=0 in_port=1 actions=output:2
3585 event=DELETED reason=delete table=0 cookie=0 in_port=2 actions=output:1
3589 ovs-appctl -t ovs-ofctl exit
3593 AT_SETUP([ofproto - flow monitoring with !own])
3594 AT_KEYWORDS([monitor])
3597 ovs-ofctl add-flow br0 in_port=0,dl_vlan=123,actions=output:1
3599 # Start a monitor watching the flow table and check the initial reply.
3600 ovs-ofctl monitor br0 watch:\!own --detach --no-chdir --pidfile >monitor.log 2>&1
3601 AT_CAPTURE_FILE([monitor.log])
3602 ovs-appctl -t ovs-ofctl ofctl/barrier
3603 AT_CHECK([sed 's/ (xid=0x[[1-9a-fA-F]][[0-9a-fA-F]]*)//' monitor.log], [0],
3604 [NXST_FLOW_MONITOR reply:
3605 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=123 actions=output:1
3609 # Check that our own changes are reported as abbreviations.
3610 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
3611 ovs-ofctl add-flow br0 in_port=1,actions=output:2
3612 ovs-ofctl add-flow br0 in_port=2,actions=output:1
3613 ovs-appctl -t ovs-ofctl ofctl/barrier
3614 ovs-appctl -t ovs-ofctl ofctl/send 010e004812345678003fffff00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003000000000000ffffffffffff0000
3615 ovs-appctl -t ovs-ofctl ofctl/barrier
3616 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip], [0], [NXST_FLOW reply:
3618 AT_CHECK([sed 's/ (xid=0x[[1-9a-fA-F]][[0-9a-fA-F]]*)//' monitor.log], [0],
3619 [NXST_FLOW_MONITOR reply (xid=0x0):
3620 event=ADDED table=0 cookie=0 in_port=1 actions=output:2
3621 NXST_FLOW_MONITOR reply (xid=0x0):
3622 event=ADDED table=0 cookie=0 in_port=2 actions=output:1
3624 send: OFPT_FLOW_MOD: DEL priority=0 actions=drop
3625 NXST_FLOW_MONITOR reply (xid=0x0):
3626 event=ABBREV xid=0x12345678
3630 ovs-appctl -t ovs-ofctl exit
3634 AT_SETUP([ofproto - flow monitoring with out_port])
3635 AT_KEYWORDS([monitor])
3638 ovs-ofctl add-flow br0 in_port=0,dl_vlan=121,actions=output:1
3639 ovs-ofctl add-flow br0 in_port=0,dl_vlan=122,actions=output:1
3640 ovs-ofctl add-flow br0 in_port=0,dl_vlan=123,actions=output:2
3642 # Start a monitor watching the flow table and check the initial reply.
3643 ovs-ofctl monitor br0 watch:out_port=2 --detach --no-chdir --pidfile >monitor.log 2>&1
3644 AT_CAPTURE_FILE([monitor.log])
3645 ovs-appctl -t ovs-ofctl ofctl/barrier
3646 AT_CHECK([sed 's/ (xid=0x[[1-9a-fA-F]][[0-9a-fA-F]]*)//' monitor.log], [0],
3647 [NXST_FLOW_MONITOR reply:
3648 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=123 actions=output:2
3652 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
3654 # Add, modify flows and check the updates.
3655 ovs-ofctl mod-flows br0 dl_vlan=121,actions=drop
3656 ovs-ofctl mod-flows br0 dl_vlan=122,actions=output:1,output:2
3657 ovs-appctl -t ovs-ofctl ofctl/barrier
3659 ovs-ofctl mod-flows br0 dl_vlan=123,actions=output:1,output:2
3660 ovs-appctl -t ovs-ofctl ofctl/barrier
3662 ovs-ofctl mod-flows br0 dl_vlan=122,actions=output:1
3663 ovs-appctl -t ovs-ofctl ofctl/barrier
3664 ovs-ofctl mod-flows br0 dl_vlan=123,actions=output:2
3665 ovs-appctl -t ovs-ofctl ofctl/barrier
3667 AT_CHECK([sed 's/ (xid=0x[[1-9a-fA-F]][[0-9a-fA-F]]*)//' monitor.log], [0],
3668 [NXST_FLOW_MONITOR reply (xid=0x0):
3669 event=MODIFIED table=0 cookie=0 in_port=0,dl_vlan=122 actions=output:1,output:2
3671 NXST_FLOW_MONITOR reply (xid=0x0):
3672 event=MODIFIED table=0 cookie=0 in_port=0,dl_vlan=123 actions=output:1,output:2
3674 NXST_FLOW_MONITOR reply (xid=0x0):
3675 event=MODIFIED table=0 cookie=0 in_port=0,dl_vlan=122 actions=output:1
3677 NXST_FLOW_MONITOR reply (xid=0x0):
3678 event=MODIFIED table=0 cookie=0 in_port=0,dl_vlan=123 actions=output:2
3682 ovs-appctl -t ovs-ofctl exit
3686 AT_SETUP([ofproto - flow monitoring pause and resume])
3687 AT_KEYWORDS([monitor])
3689 # The maximum socket receive buffer size is important for this test, which
3690 # tests behavior when the receive buffer overflows.
3691 if test -e /proc/sys/net/core/rmem_max; then
3693 rmem_max=`cat /proc/sys/net/core/rmem_max`
3694 elif rmem_max=`sysctl -n net.inet.tcp.recvbuf_max 2>/dev/null`; then
3697 # Don't know how to get maximum socket receive buffer on this OS
3700 # Calculate the total amount of queuing: rmem_max in the kernel, 128 kB
3701 # in ofproto sending userspace (see ofmonitor_flush() in connmgr.c).
3702 queue_size=`expr $rmem_max + 128 \* 1024`
3703 echo rmem_max=$rmem_max queue_size=$queue_size
3705 # If there's too much queuing skip the test to avoid timing out.
3706 AT_SKIP_IF([test $rmem_max -gt 1048576])
3708 # Each flow update message takes up at least 48 bytes of space in queues
3709 # and in practice more than that.
3710 n_msgs=`expr $queue_size / 48`
3715 # Start a monitor watching the flow table, then make it block.
3716 on_exit 'kill `cat ovs-ofctl.pid`'
3717 ovs-ofctl monitor br0 watch: --detach --no-chdir --pidfile >monitor.log 2>&1
3718 AT_CAPTURE_FILE([monitor.log])
3719 ovs-appctl -t ovs-ofctl ofctl/block
3721 # Add $n_msgs flows.
3722 (echo "in_port=2,actions=output:2"
3724 for ($i = 0; $i < '$n_msgs'; $i++) {
3725 print "cookie=1,reg1=$i,actions=drop\n";
3728 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
3729 # Check that multipart flow dumps work properly:
3730 AT_CHECK([ovs-ofctl diff-flows br0 flows.txt])
3731 AT_CHECK([ovs-ofctl add-flow br0 in_port=1,cookie=3,actions=drop])
3732 AT_CHECK([ovs-ofctl mod-flows br0 in_port=2,cookie=2,actions=output:2])
3733 AT_CHECK([ovs-ofctl del-flows br0 cookie=1/-1])
3735 ovs-appctl -t ovs-ofctl ofctl/unblock
3737 # Wait for the connection resumed.
3738 # A barrier doesn't work for this purpose.
3739 # https://www.mail-archive.com/dev@openvswitch.org/msg27013.html
3740 # https://www.mail-archive.com/dev@openvswitch.org/msg27675.html
3741 OVS_WAIT_UNTIL([grep NXT_FLOW_MONITOR_RESUMED monitor.log])
3743 ovs-appctl -t ovs-ofctl exit
3745 # Check that the flow monitor reported the same number of flows
3746 # added and deleted, but fewer than we actually added and deleted.
3747 adds=`grep -c 'ADDED.*reg1=' monitor.log`
3748 deletes=`grep -c 'DELETED.*reg1=' monitor.log`
3749 echo adds=$adds deletes=$deletes
3750 AT_CHECK([test $adds -gt 100 && test $adds -lt $n_msgs])
3751 AT_CHECK([test $adds = $deletes])
3753 # Check that the flow monitor reported everything in the expected order:
3755 # event=ADDED table=0 cookie=0x1 reg1=0x22
3757 # NXT_FLOW_MONITOR_PAUSED:
3759 # event=DELETED reason=delete table=0 cookie=0x1 reg1=0x22
3761 # event=ADDED table=0 cookie=0x3 in_port=1
3762 # event=MODIFIED table=0 cookie=0x2 in_port=2 actions=output:2
3763 # NXT_FLOW_MONITOR_RESUMED:
3765 # except that, between the PAUSED and RESUMED, the order of the ADDED
3766 # and MODIFIED lines lines depends on hash order, that is, it varies
3767 # as we change the hash function or change architecture. Therefore,
3768 # we use a couple of tests below to accept both orders.
3769 AT_CHECK([ofctl_strip < monitor.log | sed -n -e '
3772 /NXT_FLOW_MONITOR_PAUSED:/p
3773 /NXT_FLOW_MONITOR_RESUMED:/p
3774 ' > monitor.log.subset])
3775 AT_CHECK([grep -v MODIFIED monitor.log.subset], [0], [dnl
3776 event=ADDED table=0 cookie=0x1 reg1=0x22
3777 NXT_FLOW_MONITOR_PAUSED:
3778 event=DELETED reason=delete table=0 cookie=0x1 reg1=0x22
3779 event=ADDED table=0 cookie=0x3 in_port=1
3780 NXT_FLOW_MONITOR_RESUMED:
3782 AT_CHECK([grep -v ADDED monitor.log.subset], [0], [dnl
3783 NXT_FLOW_MONITOR_PAUSED:
3784 event=DELETED reason=delete table=0 cookie=0x1 reg1=0x22
3785 event=MODIFIED table=0 cookie=0x2 in_port=2 actions=output:2
3786 NXT_FLOW_MONITOR_RESUMED:
3792 AT_SETUP([ofproto - event filtering (OpenFlow 1.3)])
3793 AT_KEYWORDS([monitor])
3796 # Start a monitor, use the required protocol version
3797 ovs-ofctl -O OpenFlow13 monitor br0 --detach --no-chdir --pidfile >monitor.log 2>&1
3798 AT_CAPTURE_FILE([monitor.log])
3800 # Send an OpenFlow13 message (04), OFPT_GET_ASYNC_REQUEST (1a), length (8), xid (0a)
3801 ovs-appctl -t ovs-ofctl ofctl/send 041a00080000000a
3802 ovs-appctl -t ovs-ofctl ofctl/barrier
3804 # Check default setting
3805 read -r -d '' expected <<'EOF'
3808 AT_CHECK([ofctl_strip < monitor.log], [], [dnl
3809 send: OFPT_GET_ASYNC_REQUEST (OF1.3):
3810 OFPT_GET_ASYNC_REPLY (OF1.3):
3812 PACKET_IN: no_match action
3813 PORT_STATUS: add delete modify
3814 FLOW_REMOVED: idle hard delete
3818 PORT_STATUS: add delete modify
3820 OFPT_BARRIER_REPLY (OF1.3):
3826 AT_SETUP([ofproto - ofport_request])
3828 ADD_OF_PORTS([br0], [1], [2], [3])
3830 set_and_check_specific_ofports () {
3831 ovs-vsctl set Interface p1 ofport_request="$1" -- \
3832 set Interface p2 ofport_request="$2" -- \
3833 set Interface p3 ofport_request="$3"
3834 ofports=`ovs-vsctl get Interface p1 ofport -- \
3835 get Interface p2 ofport -- \
3836 get Interface p3 ofport`
3837 AT_CHECK_UNQUOTED([echo $ofports], [0], [$1 $2 $3
3840 for pre in '1 2 3' '1 3 2' '2 1 3' '2 3 1' '3 1 2' '3 2 1'; do
3841 for post in '1 2 3' '1 3 2' '2 1 3' '2 3 1' '3 1 2' '3 2 1'; do
3842 echo -----------------------------------------------------------
3843 echo "Check changing port numbers from $pre to $post"
3844 set_and_check_specific_ofports $pre
3845 set_and_check_specific_ofports $post
3849 ovs-vsctl del-port p3
3851 set_and_check_poorly_specified_ofports () {
3852 ovs-vsctl set Interface p1 ofport_request="$1" -- \
3853 set Interface p2 ofport_request="$2"
3854 p1=`ovs-vsctl get Interface p1 ofport`
3855 p2=`ovs-vsctl get Interface p2 ofport`
3858 AT_CHECK([test "$p1" != "$p2"])
3859 if test "$1" = "$2" && test "$1" != '[[]]'; then
3860 # One port number must be the requested one.
3861 AT_CHECK([test "$p1" = "$1" || test "$p2" = "$1"])
3862 # The other port number must be different (already tested above).
3864 AT_CHECK([test "$1" = '[[]]' || test "$p1" = "$1"])
3865 AT_CHECK([test "$2" = '[[]]' || test "$p2" = "$2"])
3868 for pre in '1 2' '[[]] 2' '1 [[]]' '[[]] [[]]' '2 1' '[[]] 1' '2 [[]]' \
3870 for post in '1 2' '[[]] 2' '1 [[]]' '[[]] [[]]' '2 1' '[[]] 1' '2 [[]]' \
3872 echo -----------------------------------------------------------
3873 echo "Check changing port numbers from $pre to $post"
3874 set_and_check_poorly_specified_ofports $pre
3875 set_and_check_poorly_specified_ofports $post
3882 AT_SETUP([ofproto - bundles, open (OpenFlow 1.4)])
3883 AT_KEYWORDS([monitor])
3886 # Start a monitor, use the required protocol version
3887 ovs-ofctl -O OpenFlow14 monitor br0 --detach --no-chdir --pidfile >monitor.log 2>&1
3888 AT_CAPTURE_FILE([monitor.log])
3890 # Send an OpenFlow14 message (05), OFPT_BUNDLE_CONTROL (21), length (10), xid (0a)
3891 ovs-appctl -t ovs-ofctl ofctl/send "05 21 00 10 00 00 00 0a 00 00 00 01 00 00 00 02"
3892 ovs-appctl -t ovs-ofctl ofctl/barrier
3893 ovs-appctl -t ovs-ofctl exit
3895 AT_CHECK([ofctl_strip < monitor.log], [], [dnl
3896 send: OFPT_BUNDLE_CONTROL (OF1.4):
3897 bundle_id=0x1 type=OPEN_REQUEST flags=ordered
3898 OFPT_BUNDLE_CONTROL (OF1.4):
3899 bundle_id=0x1 type=OPEN_REPLY flags=0
3900 OFPT_BARRIER_REPLY (OF1.4):
3906 AT_SETUP([ofproto - bundles, double open (OpenFlow 1.4)])
3907 AT_KEYWORDS([monitor])
3910 # Start a monitor, use the required protocol version
3911 ovs-ofctl -O OpenFlow14 monitor br0 --detach --no-chdir --pidfile >monitor.log 2>&1
3912 AT_CAPTURE_FILE([monitor.log])
3914 # Send twice an OpenFlow14 message (05), OFPT_BUNDLE_CONTROL (21), length (10), xid (0a)
3915 ovs-appctl -t ovs-ofctl ofctl/send "05 21 00 10 00 00 00 0a 00 00 00 01 00 00 00 02"
3916 ovs-appctl -t ovs-ofctl ofctl/barrier
3917 ovs-appctl -t ovs-ofctl ofctl/send "05 21 00 10 00 00 00 0a 00 00 00 01 00 00 00 02"
3918 ovs-appctl -t ovs-ofctl ofctl/barrier
3919 ovs-appctl -t ovs-ofctl exit
3921 AT_CHECK([ofctl_strip < monitor.log], [0], [dnl
3922 send: OFPT_BUNDLE_CONTROL (OF1.4):
3923 bundle_id=0x1 type=OPEN_REQUEST flags=ordered
3924 OFPT_BUNDLE_CONTROL (OF1.4):
3925 bundle_id=0x1 type=OPEN_REPLY flags=0
3926 OFPT_BARRIER_REPLY (OF1.4):
3927 send: OFPT_BUNDLE_CONTROL (OF1.4):
3928 bundle_id=0x1 type=OPEN_REQUEST flags=ordered
3929 OFPT_ERROR (OF1.4): OFPBFC_BAD_ID
3930 OFPT_BUNDLE_CONTROL (OF1.4):
3931 bundle_id=0x1 type=OPEN_REQUEST flags=ordered
3932 OFPT_BARRIER_REPLY (OF1.4):
3938 AT_SETUP([ofproto - bundle close without open (OpenFlow 1.4)])
3939 AT_KEYWORDS([monitor])
3942 # Start a monitor, use the required protocol version
3943 ovs-ofctl -O OpenFlow14 monitor br0 --detach --no-chdir --pidfile >monitor.log 2>&1
3944 AT_CAPTURE_FILE([monitor.log])
3946 ovs-appctl -t ovs-ofctl ofctl/send "05 21 00 10 00 00 00 0a 00 00 00 01 00 02 00 02"
3947 ovs-appctl -t ovs-ofctl ofctl/barrier
3948 ovs-appctl -t ovs-ofctl exit
3950 AT_CHECK([ofctl_strip < monitor.log], [0], [dnl
3951 send: OFPT_BUNDLE_CONTROL (OF1.4):
3952 bundle_id=0x1 type=CLOSE_REQUEST flags=ordered
3953 OFPT_ERROR (OF1.4): OFPBFC_BAD_ID
3954 OFPT_BUNDLE_CONTROL (OF1.4):
3955 bundle_id=0x1 type=CLOSE_REQUEST flags=ordered
3956 OFPT_BARRIER_REPLY (OF1.4):
3962 AT_SETUP([ofproto - bundle double close (OpenFlow 1.4)])
3963 AT_KEYWORDS([monitor])
3966 # Start a monitor, use the required protocol version
3967 ovs-ofctl -O OpenFlow14 monitor br0 --detach --no-chdir --pidfile >monitor.log 2>&1
3968 AT_CAPTURE_FILE([monitor.log])
3970 # Open, Close, Close
3971 ovs-appctl -t ovs-ofctl ofctl/send "05 21 00 10 00 00 00 0a 00 00 00 01 00 00 00 02"
3972 ovs-appctl -t ovs-ofctl ofctl/barrier
3973 ovs-appctl -t ovs-ofctl ofctl/send "05 21 00 10 00 00 00 0a 00 00 00 01 00 02 00 02"
3974 ovs-appctl -t ovs-ofctl ofctl/barrier
3975 ovs-appctl -t ovs-ofctl ofctl/send "05 21 00 10 00 00 00 0a 00 00 00 01 00 02 00 02"
3976 ovs-appctl -t ovs-ofctl ofctl/barrier
3977 ovs-appctl -t ovs-ofctl exit
3979 AT_CHECK([ofctl_strip < monitor.log], [0], [dnl
3980 send: OFPT_BUNDLE_CONTROL (OF1.4):
3981 bundle_id=0x1 type=OPEN_REQUEST flags=ordered
3982 OFPT_BUNDLE_CONTROL (OF1.4):
3983 bundle_id=0x1 type=OPEN_REPLY flags=0
3984 OFPT_BARRIER_REPLY (OF1.4):
3985 send: OFPT_BUNDLE_CONTROL (OF1.4):
3986 bundle_id=0x1 type=CLOSE_REQUEST flags=ordered
3987 OFPT_BUNDLE_CONTROL (OF1.4):
3988 bundle_id=0x1 type=CLOSE_REPLY flags=0
3989 OFPT_BARRIER_REPLY (OF1.4):
3990 send: OFPT_BUNDLE_CONTROL (OF1.4):
3991 bundle_id=0x1 type=CLOSE_REQUEST flags=ordered
3992 OFPT_ERROR (OF1.4): OFPBFC_BUNDLE_CLOSED
3993 OFPT_BUNDLE_CONTROL (OF1.4):
3994 bundle_id=0x1 type=CLOSE_REQUEST flags=ordered
3995 OFPT_BARRIER_REPLY (OF1.4):
4001 AT_SETUP([ofproto - bundle close, different flags (OpenFlow 1.4)])
4002 AT_KEYWORDS([monitor])
4005 # Start a monitor, use the required protocol version
4006 ovs-ofctl -O OpenFlow14 monitor br0 --detach --no-chdir --pidfile >monitor.log 2>&1
4007 AT_CAPTURE_FILE([monitor.log])
4009 # Open, Close, Close
4010 ovs-appctl -t ovs-ofctl ofctl/send "05 21 00 10 00 00 00 0a 00 00 00 01 00 00 00 02"
4011 ovs-appctl -t ovs-ofctl ofctl/barrier
4012 ovs-appctl -t ovs-ofctl ofctl/send "05 21 00 10 00 00 00 0a 00 00 00 01 00 02 00 01"
4013 ovs-appctl -t ovs-ofctl ofctl/barrier
4014 ovs-appctl -t ovs-ofctl exit
4016 AT_CHECK([ofctl_strip < monitor.log], [0], [dnl
4017 send: OFPT_BUNDLE_CONTROL (OF1.4):
4018 bundle_id=0x1 type=OPEN_REQUEST flags=ordered
4019 OFPT_BUNDLE_CONTROL (OF1.4):
4020 bundle_id=0x1 type=OPEN_REPLY flags=0
4021 OFPT_BARRIER_REPLY (OF1.4):
4022 send: OFPT_BUNDLE_CONTROL (OF1.4):
4023 bundle_id=0x1 type=CLOSE_REQUEST flags=atomic
4024 OFPT_ERROR (OF1.4): OFPBFC_BAD_FLAGS
4025 OFPT_BUNDLE_CONTROL (OF1.4):
4026 bundle_id=0x1 type=CLOSE_REQUEST flags=atomic
4027 OFPT_BARRIER_REPLY (OF1.4):
4033 AT_SETUP([ofproto - bundle commit without open (OpenFlow 1.4)])
4034 AT_KEYWORDS([monitor])
4037 # Start a monitor, use the required protocol version
4038 ovs-ofctl -O OpenFlow14 monitor br0 --detach --no-chdir --pidfile >monitor.log 2>&1
4039 AT_CAPTURE_FILE([monitor.log])
4041 # Open, Close, Close
4042 ovs-appctl -t ovs-ofctl ofctl/send "05 21 00 10 00 00 00 0a 00 00 00 01 00 04 00 02"
4043 ovs-appctl -t ovs-ofctl ofctl/barrier
4044 ovs-appctl -t ovs-ofctl exit
4046 AT_CHECK([ofctl_strip < monitor.log], [0], [dnl
4047 send: OFPT_BUNDLE_CONTROL (OF1.4):
4048 bundle_id=0x1 type=COMMIT_REQUEST flags=ordered
4049 OFPT_ERROR (OF1.4): OFPBFC_BAD_ID
4050 OFPT_BUNDLE_CONTROL (OF1.4):
4051 bundle_id=0x1 type=COMMIT_REQUEST flags=ordered
4052 OFPT_BARRIER_REPLY (OF1.4):
4058 AT_SETUP([ofproto - bundle commit, different flags (OpenFlow 1.4)])
4059 AT_KEYWORDS([monitor])
4062 # Start a monitor, use the required protocol version
4063 ovs-ofctl -O OpenFlow14 monitor br0 --detach --no-chdir --pidfile >monitor.log 2>&1
4064 AT_CAPTURE_FILE([monitor.log])
4066 # Open, Close, Close
4067 ovs-appctl -t ovs-ofctl ofctl/send "05 21 00 10 00 00 00 0a 00 00 00 01 00 00 00 02"
4068 ovs-appctl -t ovs-ofctl ofctl/barrier
4069 ovs-appctl -t ovs-ofctl ofctl/send "05 21 00 10 00 00 00 0a 00 00 00 01 00 04 00 01"
4070 ovs-appctl -t ovs-ofctl ofctl/barrier
4071 ovs-appctl -t ovs-ofctl exit
4073 AT_CHECK([ofctl_strip < monitor.log], [0], [dnl
4074 send: OFPT_BUNDLE_CONTROL (OF1.4):
4075 bundle_id=0x1 type=OPEN_REQUEST flags=ordered
4076 OFPT_BUNDLE_CONTROL (OF1.4):
4077 bundle_id=0x1 type=OPEN_REPLY flags=0
4078 OFPT_BARRIER_REPLY (OF1.4):
4079 send: OFPT_BUNDLE_CONTROL (OF1.4):
4080 bundle_id=0x1 type=COMMIT_REQUEST flags=atomic
4081 OFPT_ERROR (OF1.4): OFPBFC_BAD_FLAGS
4082 OFPT_BUNDLE_CONTROL (OF1.4):
4083 bundle_id=0x1 type=COMMIT_REQUEST flags=atomic
4084 OFPT_BARRIER_REPLY (OF1.4):
4090 AT_SETUP([ofproto - bundle discard without open (OpenFlow 1.4)])
4091 AT_KEYWORDS([monitor])
4094 # Start a monitor, use the required protocol version
4095 ovs-ofctl -O OpenFlow14 monitor br0 --detach --no-chdir --pidfile >monitor.log 2>&1
4096 AT_CAPTURE_FILE([monitor.log])
4098 # Open, Close, Close
4099 ovs-appctl -t ovs-ofctl ofctl/send "05 21 00 10 00 00 00 0a 00 00 00 01 00 06 00 02"
4100 ovs-appctl -t ovs-ofctl ofctl/barrier
4101 ovs-appctl -t ovs-ofctl exit
4103 AT_CHECK([ofctl_strip < monitor.log], [0], [dnl
4104 send: OFPT_BUNDLE_CONTROL (OF1.4):
4105 bundle_id=0x1 type=DISCARD_REQUEST flags=ordered
4106 OFPT_ERROR (OF1.4): OFPBFC_BAD_ID
4107 OFPT_BUNDLE_CONTROL (OF1.4):
4108 bundle_id=0x1 type=DISCARD_REQUEST flags=ordered
4109 OFPT_BARRIER_REPLY (OF1.4):
4116 AT_SETUP([ofproto - bundle with multiple flow mods (OpenFlow 1.4)])
4117 AT_KEYWORDS([monitor])
4120 AT_CHECK([ovs-appctl vlog/set vconn:dbg])
4122 AT_CHECK([ovs-ofctl del-flows br0])
4124 AT_DATA([flows.txt], [dnl
4125 add idle_timeout=50 in_port=2 dl_src=00:66:77:88:99:aa actions=1
4126 add idle_timeout=60 in_port=2 dl_src=00:77:88:99:aa:bb actions=2
4127 add idle_timeout=70 in_port=2 dl_src=00:88:99:aa:bb:cc actions=3
4128 add idle_timeout=50 in_port=2 dl_src=00:66:77:88:99:aa actions=4
4130 add idle_timeout=50 in_port=2 dl_src=00:66:77:88:99:aa actions=5
4131 add idle_timeout=60 in_port=2 dl_src=00:77:88:99:aa:bb actions=6
4132 add idle_timeout=70 in_port=2 dl_src=00:88:99:aa:bb:cc actions=7
4133 delete in_port=2 dl_src=00:88:99:aa:bb:cc
4136 AT_CHECK([ovs-ofctl --bundle add-flows br0 flows.txt])
4138 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
4139 idle_timeout=50, in_port=2,dl_src=00:66:77:88:99:aa actions=output:5
4140 idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=output:6
4144 AT_DATA([flows.txt], [dnl
4146 modify_strict in_port=2 dl_src=00:77:88:99:aa:bb actions=7
4149 AT_CHECK([ovs-ofctl --bundle add-flows br0 flows.txt])
4151 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
4152 idle_timeout=50, in_port=2,dl_src=00:66:77:88:99:aa actions=drop
4153 idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=output:7
4157 # Adding an existing flow acts as a modify, and delete_strict also works.
4158 AT_DATA([flows.txt], [dnl
4159 add idle_timeout=60 in_port=2 dl_src=00:77:88:99:aa:bb actions=8
4160 delete_strict in_port=2 dl_src=00:66:77:88:99:aa
4161 add in_port=2 dl_src=00:66:77:88:99:aa actions=drop
4164 AT_CHECK([ovs-ofctl --bundle add-flows br0 flows.txt])
4166 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
4167 idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=output:8
4168 in_port=2,dl_src=00:66:77:88:99:aa actions=drop
4172 dnl Check logs for OpenFlow trace
4174 OVS_WAIT_UNTIL([cat ovs-vswitchd.log | vconn_sub | test `grep -- "|vconn|DBG|unix: sent (Success): NXST_FLOW reply" | wc -l` -ge 3])
4175 AT_CHECK([print_vconn_debug | vconn_sub | ofctl_strip], [0], [dnl
4176 vconn|DBG|unix: sent (Success): OFPT_HELLO (OF1.5):
4177 version bitmap: 0x01, 0x02, 0x03, 0x04, 0x05, 0x06
4178 vconn|DBG|unix: received: OFPT_HELLO:
4179 version bitmap: 0x01
4180 vconn|DBG|unix: negotiated OpenFlow version 0x01 (we support version 0x06 and earlier, peer supports version 0x01)
4181 vconn|DBG|unix: received: OFPT_FLOW_MOD: DEL actions=drop
4182 vconn|DBG|unix: received: OFPT_BARRIER_REQUEST:
4183 vconn|DBG|unix: sent (Success): OFPT_BARRIER_REPLY:
4184 vconn|DBG|unix: sent (Success): OFPT_HELLO (OF1.5):
4185 version bitmap: 0x01, 0x02, 0x03, 0x04, 0x05, 0x06
4186 vconn|DBG|unix: received: OFPT_HELLO (OF1.4):
4187 version bitmap: 0x05
4188 vconn|DBG|unix: negotiated OpenFlow version 0x05 (we support version 0x06 and earlier, peer supports version 0x05)
4189 vconn|DBG|unix: received: OFPT_BUNDLE_CONTROL (OF1.4):
4190 bundle_id=0 type=OPEN_REQUEST flags=atomic ordered
4191 vconn|DBG|unix: sent (Success): OFPT_BUNDLE_CONTROL (OF1.4):
4192 bundle_id=0 type=OPEN_REPLY flags=0
4193 vconn|DBG|unix: received: OFPT_BUNDLE_ADD_MESSAGE (OF1.4):
4194 bundle_id=0 flags=atomic ordered
4195 OFPT_FLOW_MOD (OF1.4): ADD in_port=2,dl_src=00:66:77:88:99:aa idle:50 actions=output:1
4196 vconn|DBG|unix: received: OFPT_BUNDLE_ADD_MESSAGE (OF1.4):
4197 bundle_id=0 flags=atomic ordered
4198 OFPT_FLOW_MOD (OF1.4): ADD in_port=2,dl_src=00:77:88:99:aa:bb idle:60 actions=output:2
4199 vconn|DBG|unix: received: OFPT_BUNDLE_ADD_MESSAGE (OF1.4):
4200 bundle_id=0 flags=atomic ordered
4201 OFPT_FLOW_MOD (OF1.4): ADD in_port=2,dl_src=00:88:99:aa:bb:cc idle:70 actions=output:3
4202 vconn|DBG|unix: received: OFPT_BUNDLE_ADD_MESSAGE (OF1.4):
4203 bundle_id=0 flags=atomic ordered
4204 OFPT_FLOW_MOD (OF1.4): ADD in_port=2,dl_src=00:66:77:88:99:aa idle:50 actions=output:4
4205 vconn|DBG|unix: received: OFPT_BUNDLE_ADD_MESSAGE (OF1.4):
4206 bundle_id=0 flags=atomic ordered
4207 OFPT_FLOW_MOD (OF1.4): DEL table:255 actions=drop
4208 vconn|DBG|unix: received: OFPT_BUNDLE_ADD_MESSAGE (OF1.4):
4209 bundle_id=0 flags=atomic ordered
4210 OFPT_FLOW_MOD (OF1.4): ADD in_port=2,dl_src=00:66:77:88:99:aa idle:50 actions=output:5
4211 vconn|DBG|unix: received: OFPT_BUNDLE_ADD_MESSAGE (OF1.4):
4212 bundle_id=0 flags=atomic ordered
4213 OFPT_FLOW_MOD (OF1.4): ADD in_port=2,dl_src=00:77:88:99:aa:bb idle:60 actions=output:6
4214 vconn|DBG|unix: received: OFPT_BUNDLE_ADD_MESSAGE (OF1.4):
4215 bundle_id=0 flags=atomic ordered
4216 OFPT_FLOW_MOD (OF1.4): ADD in_port=2,dl_src=00:88:99:aa:bb:cc idle:70 actions=output:7
4217 vconn|DBG|unix: received: OFPT_BUNDLE_ADD_MESSAGE (OF1.4):
4218 bundle_id=0 flags=atomic ordered
4219 OFPT_FLOW_MOD (OF1.4): DEL table:255 in_port=2,dl_src=00:88:99:aa:bb:cc actions=drop
4220 vconn|DBG|unix: received: OFPT_BUNDLE_CONTROL (OF1.4):
4221 bundle_id=0 type=COMMIT_REQUEST flags=atomic ordered
4222 vconn|DBG|unix: sent (Success): OFPT_BUNDLE_CONTROL (OF1.4):
4223 bundle_id=0 type=COMMIT_REPLY flags=0
4224 vconn|DBG|unix: sent (Success): OFPT_HELLO (OF1.5):
4225 version bitmap: 0x01, 0x02, 0x03, 0x04, 0x05, 0x06
4226 vconn|DBG|unix: received: OFPT_HELLO:
4227 version bitmap: 0x01
4228 vconn|DBG|unix: negotiated OpenFlow version 0x01 (we support version 0x06 and earlier, peer supports version 0x01)
4229 vconn|DBG|unix: received: NXT_SET_FLOW_FORMAT: format=nxm
4230 vconn|DBG|unix: received: OFPT_BARRIER_REQUEST:
4231 vconn|DBG|unix: sent (Success): OFPT_BARRIER_REPLY:
4232 vconn|DBG|unix: received: NXST_FLOW request:
4233 vconn|DBG|unix: sent (Success): NXST_FLOW reply:
4234 idle_timeout=50, in_port=2,dl_src=00:66:77:88:99:aa actions=output:5
4235 idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=output:6
4236 vconn|DBG|unix: sent (Success): OFPT_HELLO (OF1.5):
4237 version bitmap: 0x01, 0x02, 0x03, 0x04, 0x05, 0x06
4238 vconn|DBG|unix: received: OFPT_HELLO (OF1.4):
4239 version bitmap: 0x05
4240 vconn|DBG|unix: negotiated OpenFlow version 0x05 (we support version 0x06 and earlier, peer supports version 0x05)
4241 vconn|DBG|unix: received: OFPT_BUNDLE_CONTROL (OF1.4):
4242 bundle_id=0 type=OPEN_REQUEST flags=atomic ordered
4243 vconn|DBG|unix: sent (Success): OFPT_BUNDLE_CONTROL (OF1.4):
4244 bundle_id=0 type=OPEN_REPLY flags=0
4245 vconn|DBG|unix: received: OFPT_BUNDLE_ADD_MESSAGE (OF1.4):
4246 bundle_id=0 flags=atomic ordered
4247 OFPT_FLOW_MOD (OF1.4): MOD actions=drop
4248 vconn|DBG|unix: received: OFPT_BUNDLE_ADD_MESSAGE (OF1.4):
4249 bundle_id=0 flags=atomic ordered
4250 OFPT_FLOW_MOD (OF1.4): MOD_STRICT in_port=2,dl_src=00:77:88:99:aa:bb actions=output:7
4251 vconn|DBG|unix: received: OFPT_BUNDLE_CONTROL (OF1.4):
4252 bundle_id=0 type=COMMIT_REQUEST flags=atomic ordered
4253 vconn|DBG|unix: sent (Success): OFPT_BUNDLE_CONTROL (OF1.4):
4254 bundle_id=0 type=COMMIT_REPLY flags=0
4255 vconn|DBG|unix: sent (Success): OFPT_HELLO (OF1.5):
4256 version bitmap: 0x01, 0x02, 0x03, 0x04, 0x05, 0x06
4257 vconn|DBG|unix: received: OFPT_HELLO:
4258 version bitmap: 0x01
4259 vconn|DBG|unix: negotiated OpenFlow version 0x01 (we support version 0x06 and earlier, peer supports version 0x01)
4260 vconn|DBG|unix: received: NXT_SET_FLOW_FORMAT: format=nxm
4261 vconn|DBG|unix: received: OFPT_BARRIER_REQUEST:
4262 vconn|DBG|unix: sent (Success): OFPT_BARRIER_REPLY:
4263 vconn|DBG|unix: received: NXST_FLOW request:
4264 vconn|DBG|unix: sent (Success): NXST_FLOW reply:
4265 idle_timeout=50, in_port=2,dl_src=00:66:77:88:99:aa actions=drop
4266 idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=output:7
4267 vconn|DBG|unix: sent (Success): OFPT_HELLO (OF1.5):
4268 version bitmap: 0x01, 0x02, 0x03, 0x04, 0x05, 0x06
4269 vconn|DBG|unix: received: OFPT_HELLO (OF1.4):
4270 version bitmap: 0x05
4271 vconn|DBG|unix: negotiated OpenFlow version 0x05 (we support version 0x06 and earlier, peer supports version 0x05)
4272 vconn|DBG|unix: received: OFPT_BUNDLE_CONTROL (OF1.4):
4273 bundle_id=0 type=OPEN_REQUEST flags=atomic ordered
4274 vconn|DBG|unix: sent (Success): OFPT_BUNDLE_CONTROL (OF1.4):
4275 bundle_id=0 type=OPEN_REPLY flags=0
4276 vconn|DBG|unix: received: OFPT_BUNDLE_ADD_MESSAGE (OF1.4):
4277 bundle_id=0 flags=atomic ordered
4278 OFPT_FLOW_MOD (OF1.4): ADD in_port=2,dl_src=00:77:88:99:aa:bb idle:60 actions=output:8
4279 vconn|DBG|unix: received: OFPT_BUNDLE_ADD_MESSAGE (OF1.4):
4280 bundle_id=0 flags=atomic ordered
4281 OFPT_FLOW_MOD (OF1.4): DEL_STRICT table:255 in_port=2,dl_src=00:66:77:88:99:aa actions=drop
4282 vconn|DBG|unix: received: OFPT_BUNDLE_ADD_MESSAGE (OF1.4):
4283 bundle_id=0 flags=atomic ordered
4284 OFPT_FLOW_MOD (OF1.4): ADD in_port=2,dl_src=00:66:77:88:99:aa actions=drop
4285 vconn|DBG|unix: received: OFPT_BUNDLE_CONTROL (OF1.4):
4286 bundle_id=0 type=COMMIT_REQUEST flags=atomic ordered
4287 vconn|DBG|unix: sent (Success): OFPT_BUNDLE_CONTROL (OF1.4):
4288 bundle_id=0 type=COMMIT_REPLY flags=0
4289 vconn|DBG|unix: sent (Success): OFPT_HELLO (OF1.5):
4290 version bitmap: 0x01, 0x02, 0x03, 0x04, 0x05, 0x06
4291 vconn|DBG|unix: received: OFPT_HELLO:
4292 version bitmap: 0x01
4293 vconn|DBG|unix: negotiated OpenFlow version 0x01 (we support version 0x06 and earlier, peer supports version 0x01)
4294 vconn|DBG|unix: received: NXT_SET_FLOW_FORMAT: format=nxm
4295 vconn|DBG|unix: received: OFPT_BARRIER_REQUEST:
4296 vconn|DBG|unix: sent (Success): OFPT_BARRIER_REPLY:
4297 vconn|DBG|unix: received: NXST_FLOW request:
4298 vconn|DBG|unix: sent (Success): NXST_FLOW reply:
4299 idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=output:8
4300 in_port=2,dl_src=00:66:77:88:99:aa actions=drop
4307 AT_SETUP([ofproto - failing bundle commit (OpenFlow 1.4)])
4308 AT_KEYWORDS([monitor])
4311 AT_CHECK([ovs-ofctl del-flows br0])
4313 ovs-ofctl add-flows br0 - <<EOF
4314 idle_timeout=50 in_port=2 dl_src=00:66:77:88:99:aa actions=11
4315 idle_timeout=60 in_port=2 dl_src=00:77:88:99:aa:bb actions=22
4316 idle_timeout=70 in_port=2 dl_src=00:88:99:aa:bb:cc actions=33
4318 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
4319 idle_timeout=50, in_port=2,dl_src=00:66:77:88:99:aa actions=output:11
4320 idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=output:22
4321 idle_timeout=70, in_port=2,dl_src=00:88:99:aa:bb:cc actions=output:33
4325 # last line uses illegal table number (OVS internal table)
4326 AT_DATA([flows.txt], [dnl
4327 add idle_timeout=50 in_port=2 dl_src=00:66:77:88:99:aa actions=1
4328 add idle_timeout=60 in_port=2 dl_src=00:77:88:99:aa:bb actions=2
4329 add idle_timeout=70 in_port=2 dl_src=00:88:99:aa:bb:cc actions=3
4330 modify idle_timeout=50 in_port=2 dl_src=00:66:77:88:99:aa actions=4
4332 add idle_timeout=50 in_port=2 dl_src=00:66:77:88:99:aa actions=5
4333 add idle_timeout=60 in_port=2 dl_src=00:77:88:99:aa:bb actions=6
4334 add idle_timeout=70 in_port=2 dl_src=00:88:99:aa:bb:cc actions=7
4335 delete in_port=2 dl_src=00:88:99:aa:bb:cc
4336 add table=254 actions=drop
4339 AT_CHECK([ovs-ofctl --bundle add-flows br0 flows.txt 2>&1 | sed '/|WARN|/d
4340 s/unix:.*br0\.mgmt/unix:br0.mgmt/' | sed 's/(.* error)/(error)/'],
4342 OFPT_ERROR (OF1.4) (xid=0xb): OFPBRC_EPERM
4343 OFPT_FLOW_MOD (OF1.4) (xid=0xb): ADD table:254 actions=drop
4344 OFPT_ERROR (OF1.4) (xid=0xd): OFPBFC_MSG_FAILED
4345 OFPT_BUNDLE_CONTROL (OF1.4) (xid=0xd):
4346 bundle_id=0 type=COMMIT_REQUEST flags=atomic ordered
4347 ovs-ofctl: talking to unix:br0.mgmt (error)
4350 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
4351 idle_timeout=50, in_port=2,dl_src=00:66:77:88:99:aa actions=output:11
4352 idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=output:22
4353 idle_timeout=70, in_port=2,dl_src=00:88:99:aa:bb:cc actions=output:33