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 10], [0],
244 [OFPT_ERROR (xid=0x2): OFPQOFC_BAD_PORT
245 OFPT_QUEUE_GET_CONFIG_REQUEST (xid=0x2): port=10
250 AT_SETUP([ofproto - queue configuration - (OpenFlow 1.2)])
252 ADD_OF_PORTS([br0], [1], [2])
253 AT_CHECK([ovs-ofctl -O OpenFlow12 queue-get-config br0 1], [0], [stdout])
254 AT_CHECK([STRIP_XIDS stdout], [0], [dnl
255 OFPT_QUEUE_GET_CONFIG_REPLY (OF1.2): port=1
257 AT_CHECK([ovs-ofctl -O OpenFlow12 queue-get-config br0 10], [0],
258 [OFPT_ERROR (OF1.2) (xid=0x2): OFPQOFC_BAD_PORT
259 OFPT_QUEUE_GET_CONFIG_REQUEST (OF1.2) (xid=0x2): port=10
264 dnl This is really bare-bones.
265 dnl It at least checks request and reply serialization and deserialization.
266 dnl Actions definition listed in both supported formats (w/ actions=)
267 AT_SETUP([ofproto - no group support (OpenFlow 1.0)])
269 AT_DATA([groups.txt], [dnl
270 group_id=1234,type=all,bucket=output:10
271 group_id=1235,type=all,bucket=actions=output:10
273 AT_DATA([stderr], [dnl
274 ovs-ofctl: none of the usable flow formats (OXM,OpenFlow11) is among the allowed flow formats (OpenFlow10,NXM)
276 AT_CHECK([ovs-ofctl -O OpenFlow10 -vwarn add-groups br0 groups.txt], [1], ,[stderr])
277 AT_CHECK([ovs-ofctl -O OpenFlow10 -vwarn mod-group br0 'group_id=1234,type=all,bucket=output:10'], [1], ,[stderr])
278 AT_CHECK([ovs-ofctl -O OpenFlow10 -vwarn del-groups br0], [1], ,[stderr])
279 AT_CHECK([ovs-ofctl -O OpenFlow10 -vwarn dump-groups br0 ], [1], ,[stderr])
283 dnl This is really bare-bones.
284 dnl It at least checks request and reply serialization and deserialization.
285 dnl Actions definition listed in both supported formats (w/ actions=)
286 AT_SETUP([ofproto - del group (OpenFlow 1.1)])
288 AT_DATA([groups.txt], [dnl
289 group_id=1234,type=all,bucket=output:10
290 group_id=1235,type=all,bucket=actions=output:10
292 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn add-groups br0 groups.txt])
293 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn dump-groups br0 ], [0], [stdout])
294 AT_CHECK([STRIP_XIDS stdout], [0], [dnl
295 OFPST_GROUP_DESC reply (OF1.1):
296 group_id=1234,type=all,bucket=actions=output:10
297 group_id=1235,type=all,bucket=actions=output:10
299 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn del-groups br0 group_id=1234])
300 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn dump-groups br0], [0], [stdout])
301 AT_CHECK([STRIP_XIDS stdout], [0], [dnl
302 OFPST_GROUP_DESC reply (OF1.1):
303 group_id=1235,type=all,bucket=actions=output:10
305 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn del-groups br0 group_id=1234])
306 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn dump-groups br0], [0], [stdout])
307 AT_CHECK([STRIP_XIDS stdout], [0], [dnl
308 OFPST_GROUP_DESC reply (OF1.1):
309 group_id=1235,type=all,bucket=actions=output:10
311 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn del-groups br0], [0])
312 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn dump-groups br0], [0], [stdout])
313 AT_CHECK([STRIP_XIDS stdout], [0], [dnl
314 OFPST_GROUP_DESC reply (OF1.1):
319 dnl This is really bare-bones.
320 dnl It at least checks request and reply serialization and deserialization.
321 dnl Actions definition listed in both supported formats (w/ actions=)
322 AT_SETUP([ofproto - add indirect group])
324 dnl indirect group must have exactly one bucket
325 AT_DATA([stderr], [dnl
326 OFPT_ERROR (OF1.1) (xid=0x2): OFPGMFC_INVALID_GROUP
327 OFPT_GROUP_MOD (OF1.1) (xid=0x2): ***decode error: OFPGMFC_INVALID_GROUP***
329 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn add-group br0 'group_id=1234,type=indirect'], [1], , [stderr])
330 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn add-group br0 'group_id=1235,type=indirect,bucket=output:10'])
331 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn add-group br0 'group_id=1236,type=indirect,bucket=output:10,bucket=output:11'], [1], , [stderr])
335 dnl This is really bare-bones.
336 dnl It at least checks request and reply serialization and deserialization.
337 dnl Actions definition listed in both supported formats (w/ actions=)
338 AT_SETUP([ofproto - del group (OpenFlow 1.5)])
340 AT_DATA([groups.txt], [dnl
341 group_id=1234,type=all,bucket=output:10,bucket=output:11
342 group_id=1235,type=all,bucket=actions=output:12,bucket=bucket_id:0,actions=output:10,bucket=bucket_id:1,actions=output:11
344 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn add-groups br0 groups.txt])
345 AT_CHECK([ovs-ofctl -F OXM-OpenFlow15 -O OpenFlow15 -vwarn dump-groups br0 1234], [0], [stdout])
346 AT_CHECK([STRIP_XIDS stdout], [0], [dnl
347 OFPST_GROUP_DESC reply (OF1.5):
348 group_id=1234,type=all,bucket=bucket_id:0,actions=output:10,bucket=bucket_id:1,actions=output:11
350 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn del-groups br0 group_id=1234])
351 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn dump-groups br0], [0], [stdout])
352 AT_CHECK([STRIP_XIDS stdout], [0], [dnl
353 OFPST_GROUP_DESC reply (OF1.5):
354 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
356 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn del-groups br0 group_id=1234])
357 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn dump-groups br0], [0], [stdout])
358 AT_CHECK([STRIP_XIDS stdout], [0], [dnl
359 OFPST_GROUP_DESC reply (OF1.5):
360 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
362 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn del-groups br0], [0])
363 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn dump-groups br0], [0], [stdout])
364 AT_CHECK([STRIP_XIDS stdout], [0], [dnl
365 OFPST_GROUP_DESC reply (OF1.5):
370 dnl This is really bare-bones.
371 dnl It at least checks request and reply serialization and deserialization.
372 AT_SETUP([ofproto - del group deletes flows])
374 AT_DATA([groups.txt], [dnl
375 group_id=1234,type=all,bucket=output:10
376 group_id=1235,type=all,bucket=output:10
378 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn add-groups br0 groups.txt])
379 AT_DATA([flows.txt], [dnl
380 tcp actions=group:1234
381 udp actions=group:1235
383 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn add-flows br0 flows.txt])
384 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn dump-flows br0 | ofctl_strip | sort],
386 tcp actions=group:1234
387 udp actions=group:1235
388 OFPST_FLOW reply (OF1.1):
390 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn del-groups br0 group_id=1234])
391 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn dump-flows br0 | ofctl_strip | sort],
393 udp actions=group:1235
394 OFPST_FLOW reply (OF1.1):
396 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn del-groups br0 group_id=1234])
397 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn dump-flows br0 | ofctl_strip | sort],
399 udp actions=group:1235
400 OFPST_FLOW reply (OF1.1):
402 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn del-groups br0])
403 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn dump-flows br0 | ofctl_strip | sort],
405 OFPST_FLOW reply (OF1.1):
410 dnl This is really bare-bones.
411 dnl It at least checks request and reply serialization and deserialization.
412 dnl Actions definition listed in both supported formats (w/ actions=)
413 AT_SETUP([ofproto - insert buckets])
415 AT_DATA([groups.txt], [dnl
416 group_id=1234,type=all,bucket=bucket_id:10,actions=output:10,bucket=bucket_id:11,actions=output:11
418 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn add-groups br0 groups.txt])
419 AT_CHECK([ovs-ofctl -F OXM-OpenFlow15 -O OpenFlow15 -vwarn dump-groups br0 1234], [0], [stdout])
420 AT_CHECK([STRIP_XIDS stdout], [0], [dnl
421 OFPST_GROUP_DESC reply (OF1.5):
422 group_id=1234,type=all,bucket=bucket_id:10,actions=output:10,bucket=bucket_id:11,actions=output:11
424 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])
425 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn dump-groups br0], [0], [stdout])
426 AT_CHECK([STRIP_XIDS stdout], [0], [dnl
427 OFPST_GROUP_DESC reply (OF1.5):
428 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
430 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])
431 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn dump-groups br0], [0], [stdout])
432 AT_CHECK([STRIP_XIDS stdout], [0], [dnl
433 OFPST_GROUP_DESC reply (OF1.5):
434 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
436 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn insert-buckets br0 group_id=1234,command_bucket_id=15])
437 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn dump-groups br0], [0], [stdout])
438 AT_CHECK([STRIP_XIDS stdout], [0], [dnl
439 OFPST_GROUP_DESC reply (OF1.5):
440 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
442 AT_DATA([buckets.txt], [dnl
443 group_id=1234,command_bucket_id=11,bucket=bucket_id:12,actions=output:12,bucket=bucket_id:13,actions=output:13
445 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn insert-buckets br0 - < buckets.txt])
446 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn dump-groups br0], [0], [stdout])
447 AT_CHECK([STRIP_XIDS stdout], [0], [dnl
448 OFPST_GROUP_DESC reply (OF1.5):
449 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
451 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])
452 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn dump-groups br0], [0], [stdout])
453 AT_CHECK([STRIP_XIDS stdout], [0], [dnl
454 OFPST_GROUP_DESC reply (OF1.5):
455 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
460 dnl This is really bare-bones.
461 dnl It at least checks request and reply serialization and deserialization.
462 dnl Actions definition listed in both supported formats (w/ actions=)
463 AT_SETUP([ofproto - remove buckets])
465 AT_DATA([groups.txt], [dnl
466 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
468 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn add-groups br0 groups.txt])
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,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
474 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn remove-buckets br0 group_id=1234,command_bucket_id=first])
475 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn dump-groups br0], [0], [stdout])
476 AT_CHECK([STRIP_XIDS stdout], [0], [dnl
477 OFPST_GROUP_DESC reply (OF1.5):
478 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
480 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn remove-buckets br0 group_id=1234,command_bucket_id=last])
481 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn dump-groups br0], [0], [stdout])
482 AT_CHECK([STRIP_XIDS stdout], [0], [dnl
483 OFPST_GROUP_DESC reply (OF1.5):
484 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
486 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn remove-buckets br0 group_id=1234,command_bucket_id=13])
487 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn dump-groups br0], [0], [stdout])
488 AT_CHECK([STRIP_XIDS stdout], [0], [dnl
489 OFPST_GROUP_DESC reply (OF1.5):
490 group_id=1234,type=all,bucket=bucket_id: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
492 AT_DATA([buckets.txt], [dnl
495 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn remove-buckets br0 - < buckets.txt])
496 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn dump-groups br0], [0], [stdout])
497 AT_CHECK([STRIP_XIDS stdout], [0], [dnl
498 OFPST_GROUP_DESC reply (OF1.5):
499 group_id=1234,type=all
501 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn remove-buckets br0 group_id=1234,command_bucket_id=first])
502 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn remove-buckets br0 group_id=1234,command_bucket_id=last])
503 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn remove-buckets br0 group_id=1234,command_bucket_id=all])
504 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn remove-buckets br0 group_id=1234,command_bucket_id=1], [1], [], [stderr])
505 AT_CHECK([cat stderr | ofctl_strip], [0], [dnl
506 OFPT_ERROR (OF1.5): OFPGMFC_UNKNOWN_BUCKET
507 OFPT_GROUP_MOD (OF1.5):
508 REMOVE_BUCKET command_bucket_id:1,group_id=1234
513 dnl This is really bare-bones.
514 dnl It at least checks request and reply serialization and deserialization.
515 AT_SETUP([ofproto - flow mod checks group availability])
517 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn add-group br0 group_id=1234,type=all,bucket=output:10])
518 AT_DATA([flows.txt], [dnl
519 tcp actions=group:1234
520 udp actions=group:1235
522 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn add-flow br0 'tcp actions=group:1234'])
523 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn add-flow br0 'tcp actions=group:1235'], [1], [], [stderr])
525 # The output should look like this:
527 # 00000000 02 0e 00 98 00 00 00 02-00 00 00 00 00 00 00 00 |................|
528 # 00000010 00 00 00 00 00 00 00 00-ff 00 00 00 00 00 80 00 |................|
529 # 00000020 ff ff ff ff ff ff ff ff-ff ff ff ff 00 00 00 00 |................|
530 # 00000030 00 00 00 58 00 00 00 00-00 00 03 d7 00 00 00 00 |...X............|
532 # This 'sed' command captures the error message but drops details.
533 AT_CHECK([sed '/truncated/d
534 /^000000.0/d' stderr | STRIP_XIDS], [0],
535 [OFPT_ERROR (OF1.1): OFPBAC_BAD_OUT_GROUP
536 OFPT_FLOW_MOD (OF1.1):
541 dnl This is really bare-bones.
542 dnl It at least checks request and reply serialization and deserialization.
543 AT_SETUP([ofproto - group description])
545 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn add-group br0 group_id=1234,type=all,bucket=output:10], [0], [stdout])
546 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn dump-groups br0], [0], [stdout])
547 AT_CHECK([STRIP_XIDS stdout], [0], [dnl
548 OFPST_GROUP_DESC reply (OF1.1):
549 group_id=1234,type=all,bucket=actions=output:10
554 dnl This is really bare-bones.
555 dnl It at least checks request and reply serialization and deserialization.
556 AT_SETUP([ofproto - group description])
558 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn add-group br0 group_id=1234,type=all,bucket=output:10])
559 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn dump-groups br0], [0], [stdout])
560 AT_CHECK([STRIP_XIDS stdout], [0], [dnl
561 OFPST_GROUP_DESC reply (OF1.1):
562 group_id=1234,type=all,bucket=actions=output:10
567 dnl This is really bare-bones.
568 dnl It at least checks request and reply serialization and deserialization.
569 AT_SETUP([ofproto - group features])
571 AT_CHECK([ovs-ofctl -O OpenFlow12 -vwarn dump-group-features br0], [0], [stdout])
572 AT_CHECK([STRIP_XIDS stdout], [0], [dnl
573 OFPST_GROUP_FEATURES reply (OF1.2):
578 max_groups=0xffffff00
579 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
581 max_groups=0xffffff00
582 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
584 max_groups=0xffffff00
585 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
587 max_groups=0xffffff00
588 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
593 dnl This is really bare-bones.
594 dnl It at least checks request and reply serialization and deserialization.
595 AT_SETUP([ofproto - group stats (OpenFlow 1.1)])
597 AT_DATA([groups.txt], [dnl
598 group_id=1234,type=all,bucket=output:10
599 group_id=1235,type=all,bucket=output:10
601 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn add-groups br0 groups.txt])
602 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn add-flow br0 'tcp actions=group:1234'])
603 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn dump-group-stats br0 group_id=1234], [0], [stdout])
604 AT_CHECK([STRIP_XIDS stdout | sort], [0], [dnl
605 group_id=1234,ref_count=1,packet_count=0,byte_count=0,bucket0:packet_count=0,byte_count=0
606 OFPST_GROUP reply (OF1.1):
608 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn dump-group-stats br0], [0], [stdout])
609 AT_CHECK([STRIP_XIDS stdout | sort], [0], [dnl
610 group_id=1234,ref_count=1,packet_count=0,byte_count=0,bucket0:packet_count=0,byte_count=0
611 group_id=1235,ref_count=0,packet_count=0,byte_count=0,bucket0:packet_count=0,byte_count=0
612 OFPST_GROUP reply (OF1.1):
617 dnl This is really bare-bones.
618 dnl It at least checks request and reply serialization and deserialization.
619 AT_SETUP([ofproto - group stats (OpenFlow 1.3)])
621 AT_DATA([groups.txt], [dnl
622 group_id=1234,type=all,bucket=output:10
623 group_id=1235,type=all,bucket=output:10
625 AT_CHECK([ovs-ofctl -O OpenFlow13 -vwarn add-groups br0 groups.txt])
626 AT_CHECK([ovs-ofctl -O OpenFlow13 -vwarn add-flow br0 'tcp actions=group:1234'])
627 AT_CHECK([ovs-ofctl -O OpenFlow13 -vwarn dump-group-stats br0 group_id=1234], [0], [stdout])
628 AT_CHECK([STRIP_XIDS stdout | sed 's/duration=[[0-9.]]*s/duration=?s/' | sort], [0], [dnl
629 group_id=1234,duration=?s,ref_count=1,packet_count=0,byte_count=0,bucket0:packet_count=0,byte_count=0
630 OFPST_GROUP reply (OF1.3):
632 AT_CHECK([ovs-ofctl -O OpenFlow13 -vwarn dump-group-stats br0], [0], [stdout])
633 AT_CHECK([STRIP_XIDS stdout | sed 's/duration=[[0-9.]]*s/duration=?s/' | sort], [0], [dnl
634 group_id=1234,duration=?s,ref_count=1,packet_count=0,byte_count=0,bucket0:packet_count=0,byte_count=0
635 group_id=1235,duration=?s,ref_count=0,packet_count=0,byte_count=0,bucket0:packet_count=0,byte_count=0
636 OFPST_GROUP reply (OF1.3):
641 dnl This is really bare-bones.
642 dnl It at least checks request and reply serialization and deserialization.
643 AT_SETUP([ofproto - group stats (OpenFlow 1.5)])
645 AT_DATA([groups.txt], [dnl
646 group_id=1234,type=all,bucket=output:10
647 group_id=1235,type=all,bucket=output:10
649 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn add-groups br0 groups.txt])
650 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn add-flow br0 'tcp actions=group:1234'])
651 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn dump-group-stats br0 group_id=1234], [0], [stdout])
652 AT_CHECK([STRIP_XIDS stdout | sed 's/duration=[[0-9.]]*s/duration=?s/' | sort], [0], [dnl
653 group_id=1234,duration=?s,ref_count=1,packet_count=0,byte_count=0,bucket0:packet_count=0,byte_count=0
654 OFPST_GROUP reply (OF1.5):
656 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn dump-group-stats br0], [0], [stdout])
657 AT_CHECK([STRIP_XIDS stdout | sed 's/duration=[[0-9.]]*s/duration=?s/' | sort], [0], [dnl
658 group_id=1234,duration=?s,ref_count=1,packet_count=0,byte_count=0,bucket0:packet_count=0,byte_count=0
659 group_id=1235,duration=?s,ref_count=0,packet_count=0,byte_count=0,bucket0:packet_count=0,byte_count=0
660 OFPST_GROUP reply (OF1.5):
665 AT_SETUP([ofproto - mod-port (OpenFlow 1.0)])
667 for command_config_state in \
669 'noflood NO_FLOOD 0' \
670 'down PORT_DOWN,NO_FLOOD LINK_DOWN' \
671 'flood PORT_DOWN LINK_DOWN' \
672 'no-receive PORT_DOWN,NO_RECV LINK_DOWN' \
673 'no-forward PORT_DOWN,NO_RECV,NO_FWD LINK_DOWN' \
674 'no-packet-in PORT_DOWN,NO_RECV,NO_FWD,NO_PACKET_IN LINK_DOWN' \
675 'forward PORT_DOWN,NO_RECV,NO_PACKET_IN LINK_DOWN' \
676 'packet-in PORT_DOWN,NO_RECV LINK_DOWN' \
680 set $command_config_state
681 command=$[1] config=`echo $[2] | sed 's/,/ /g'` state=$[3]
682 AT_CHECK([ovs-ofctl -vwarn mod-port br0 br0 $command])
683 AT_CHECK([ovs-ofctl -vwarn show br0], [0], [stdout])
684 AT_CHECK_UNQUOTED([STRIP_XIDS stdout], [0], [dnl
685 OFPT_FEATURES_REPLY: dpid:fedcba9876543210
686 n_tables:254, n_buffers:256
687 capabilities: FLOW_STATS TABLE_STATS PORT_STATS QUEUE_STATS ARP_MATCH_IP
688 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
689 LOCAL(br0): addr:aa:55:aa:55:00:00
692 speed: 0 Mbps now, 0 Mbps max
693 OFPT_GET_CONFIG_REPLY: frags=normal miss_send_len=0
699 AT_SETUP([ofproto - mod-port (OpenFlow 1.2)])
701 for command_config_state in \
703 'down PORT_DOWN LINK_DOWN' \
704 'no-receive PORT_DOWN,NO_RECV LINK_DOWN' \
705 'no-forward PORT_DOWN,NO_RECV,NO_FWD LINK_DOWN' \
706 'no-packet-in PORT_DOWN,NO_RECV,NO_FWD,NO_PACKET_IN LINK_DOWN' \
707 'forward PORT_DOWN,NO_RECV,NO_PACKET_IN LINK_DOWN' \
708 'packet-in PORT_DOWN,NO_RECV LINK_DOWN' \
712 set $command_config_state
713 command=$[1] config=`echo $[2] | sed 's/,/ /g'` state=$[3]
714 AT_CHECK([ovs-ofctl -O OpenFlow12 -vwarn mod-port br0 br0 $command])
715 AT_CHECK([ovs-ofctl -O OpenFlow12 -vwarn show br0], [0], [stdout])
716 AT_CHECK_UNQUOTED([STRIP_XIDS stdout], [0], [dnl
717 OFPT_FEATURES_REPLY (OF1.2): dpid:fedcba9876543210
718 n_tables:254, n_buffers:256
719 capabilities: FLOW_STATS TABLE_STATS PORT_STATS GROUP_STATS QUEUE_STATS
720 LOCAL(br0): addr:aa:55:aa:55:00:00
723 speed: 0 Mbps now, 0 Mbps max
724 OFPT_GET_CONFIG_REPLY (OF1.2): frags=normal miss_send_len=0
730 AT_SETUP([ofproto - mod-port (OpenFlow 1.4)])
732 for command_config_state in \
734 'down PORT_DOWN LINK_DOWN' \
735 'no-receive PORT_DOWN,NO_RECV LINK_DOWN' \
736 'no-forward PORT_DOWN,NO_RECV,NO_FWD LINK_DOWN' \
737 'no-packet-in PORT_DOWN,NO_RECV,NO_FWD,NO_PACKET_IN LINK_DOWN' \
738 'forward PORT_DOWN,NO_RECV,NO_PACKET_IN LINK_DOWN' \
739 'packet-in PORT_DOWN,NO_RECV LINK_DOWN' \
743 set $command_config_state
744 command=$[1] config=`echo $[2] | sed 's/,/ /g'` state=$[3]
745 AT_CHECK([ovs-ofctl -O OpenFlow14 -vwarn mod-port br0 br0 $command])
746 AT_CHECK([ovs-ofctl -O OpenFlow14 -vwarn show br0], [0], [stdout])
747 AT_CHECK_UNQUOTED([STRIP_XIDS stdout], [0], [dnl
748 OFPT_FEATURES_REPLY (OF1.4): dpid:fedcba9876543210
749 n_tables:254, n_buffers:256
750 capabilities: FLOW_STATS TABLE_STATS PORT_STATS GROUP_STATS QUEUE_STATS
751 OFPST_PORT_DESC reply (OF1.4):
752 LOCAL(br0): addr:aa:55:aa:55:00:00
755 speed: 0 Mbps now, 0 Mbps max
756 OFPT_GET_CONFIG_REPLY (OF1.4): frags=normal miss_send_len=0
762 AT_SETUP([ofproto - basic flow_mod commands (NXM)])
764 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip], [0], [NXST_FLOW reply:
766 AT_CHECK([echo 'in_port=2,actions=1' | ovs-ofctl add-flows br0 -])
767 AT_CHECK([ovs-ofctl add-flow br0 in_port=1,actions=2])
768 AT_CHECK([ovs-ofctl -F nxm add-flow br0 table=1,in_port=4,actions=3])
769 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
770 in_port=1 actions=output:2
771 in_port=2 actions=output:1
772 table=1, in_port=4 actions=output:3
775 AT_CHECK([ovs-ofctl dump-aggregate br0 table=0 | STRIP_XIDS], [0], [dnl
776 NXST_AGGREGATE reply: packet_count=0 byte_count=0 flow_count=2
778 AT_CHECK([ovs-ofctl del-flows br0])
779 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip], [0], [NXST_FLOW reply:
784 AT_SETUP([ofproto - basic flow_mod commands (OpenFlow 1.0)])
786 AT_CHECK([ovs-ofctl -F openflow10 dump-flows br0 | ofctl_strip], [0], [OFPST_FLOW reply:
788 AT_CHECK([echo 'in_port=2,actions=1' | ovs-ofctl -F openflow10 add-flows br0 -])
789 AT_CHECK([ovs-ofctl -F openflow10 add-flow br0 in_port=1,actions=2])
790 AT_CHECK([ovs-ofctl -F openflow10 add-flow br0 table=1,in_port=4,actions=3])
791 AT_CHECK([ovs-ofctl -F openflow10 dump-flows br0 | ofctl_strip | sort], [0], [dnl
792 in_port=1 actions=output:2
793 in_port=2 actions=output:1
794 table=1, in_port=4 actions=output:3
797 AT_CHECK([ovs-ofctl -F openflow10 dump-aggregate br0 table=0 | STRIP_XIDS], [0], [dnl
798 OFPST_AGGREGATE reply: packet_count=0 byte_count=0 flow_count=2
800 AT_CHECK([ovs-ofctl -F openflow10 del-flows br0])
801 AT_CHECK([ovs-ofctl -F openflow10 dump-flows br0 | ofctl_strip], [0], [OFPST_FLOW reply:
806 AT_SETUP([ofproto - basic flow_mod commands (OpenFlow 1.1)])
808 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip], [0], [OFPST_FLOW reply (OF1.1):
810 AT_CHECK([echo 'in_port=2,actions=1' | ovs-ofctl -O OpenFlow11 add-flows br0 -])
811 AT_CHECK([ovs-ofctl -O OpenFlow11 add-flow br0 in_port=1,actions=2])
812 AT_CHECK([ovs-ofctl -O OpenFlow11 add-flow br0 table=1,in_port=4,actions=3])
813 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0], [dnl
814 in_port=1 actions=output:2
815 in_port=2 actions=output:1
816 table=1, in_port=4 actions=output:3
817 OFPST_FLOW reply (OF1.1):
819 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-aggregate br0 table=0 | STRIP_XIDS], [0], [dnl
820 OFPST_AGGREGATE reply (OF1.1): packet_count=0 byte_count=0 flow_count=2
822 AT_CHECK([ovs-ofctl -O OpenFlow11 del-flows br0])
823 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip], [0], [OFPST_FLOW reply (OF1.1):
824 table=1, in_port=4 actions=output:3
829 AT_SETUP([ofproto - flow_mod negative test (OpenFlow 1.1)])
831 [set bridge br0 protocols=OpenFlow10,OpenFlow11,OpenFlow12,OpenFlow13])
832 AT_CHECK([ovs-ofctl add-flow -O OpenFlow11 br0 table=1,action=goto_table:2])
834 # The error message here actually comes from ovs-ofctl, not from ovs-vswitchd,
835 # but at least it's the same code in ofpacts_check() that issues the error.
836 AT_CHECK([ovs-ofctl add-flow -O OpenFlow11 br0 table=1,action=goto_table:1],
838 [ovs-ofctl: actions are invalid with specified match (OFPBIC_BAD_TABLE_ID)
843 AT_SETUP([ofproto - set-field flow_mod commands (NXM)])
845 AT_CHECK([ovs-ofctl add-flow br0 ipv6,table=1,in_port=3,actions=drop])
846 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])
847 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
848 table=1, ipv6,in_port=3 actions=load:0xa6badbfffefe59fa->NXM_NX_IPV6_SRC[[0..63]],load:0xfe8001234567890a->NXM_NX_IPV6_SRC[[64..127]]
854 AT_SETUP([ofproto - basic flow_mod commands (OpenFlow 1.2)])
856 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip], [0], [OFPST_FLOW reply (OF1.2):
858 AT_CHECK([echo 'in_port=2,actions=1' | ovs-ofctl -O OpenFlow12 add-flows br0 -])
859 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 in_port=1,actions=2])
860 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 table=1,in_port=4,actions=3])
861 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
862 in_port=1 actions=output:2
863 in_port=2 actions=output:1
864 table=1, in_port=4 actions=output:3
865 OFPST_FLOW reply (OF1.2):
867 AT_CHECK([ovs-ofctl -O OpenFlow12 del-flows br0])
868 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip], [0], [OFPST_FLOW reply (OF1.2):
873 AT_SETUP([ofproto - dump flows with cookie])
875 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x1,in_port=1,actions=1])
876 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x2,in_port=2,actions=1])
877 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x3,in_port=3,actions=1])
878 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
879 cookie=0x1, in_port=1 actions=output:1
880 cookie=0x2, in_port=2 actions=output:1
881 cookie=0x3, in_port=3 actions=output:1
884 AT_CHECK([ovs-ofctl dump-aggregate br0 table=0 | STRIP_XIDS], [0], [dnl
885 NXST_AGGREGATE reply: packet_count=0 byte_count=0 flow_count=3
887 AT_CHECK([ovs-ofctl dump-flows br0 cookie=0x3/-1 | ofctl_strip | sort], [0], [dnl
888 cookie=0x3, in_port=3 actions=output:1
891 AT_CHECK([ovs-ofctl dump-aggregate br0 cookie=0x3/-1 | STRIP_XIDS], [0], [dnl
892 NXST_AGGREGATE reply: packet_count=0 byte_count=0 flow_count=1
897 AT_SETUP([ofproto - mod flow with cookie change (OpenFlow 1.0)])
899 AT_CHECK([ovs-ofctl -F openflow10 add-flow br0 cookie=0x1,in_port=1,actions=1])
900 AT_CHECK([ovs-ofctl -F openflow10 dump-flows br0 | ofctl_strip | sort], [0], [dnl
901 cookie=0x1, in_port=1 actions=output:1
905 AT_CHECK([ovs-ofctl -F openflow10 mod-flows br0 cookie=0x2,in_port=1,actions=1])
906 AT_CHECK([ovs-ofctl -F openflow10 dump-flows br0 | ofctl_strip | sort], [0], [dnl
907 cookie=0x2, in_port=1 actions=output:1
913 AT_SETUP([ofproto - mod flow with cookie change (NXM)])
915 AT_CHECK([ovs-ofctl -F nxm add-flow br0 cookie=0x1,in_port=1,actions=1])
916 AT_CHECK([ovs-ofctl -F nxm dump-flows br0 | ofctl_strip | sort], [0], [dnl
917 cookie=0x1, in_port=1 actions=output:1
921 AT_CHECK([ovs-ofctl -F nxm mod-flows br0 cookie=0x2,in_port=1,actions=1])
922 AT_CHECK([ovs-ofctl -F nxm dump-flows br0 | ofctl_strip | sort], [0], [dnl
923 cookie=0x2, in_port=1 actions=output:1
929 AT_SETUP([ofproto - no mod flow with cookie change (OpenFlow 1.1)])
931 AT_CHECK([ovs-ofctl -O OpenFlow11 add-flow br0 cookie=0x1,in_port=1,actions=1])
932 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0], [dnl
933 cookie=0x1, in_port=1 actions=output:1
934 OFPST_FLOW reply (OF1.1):
936 AT_CHECK([ovs-ofctl -O OpenFlow11 mod-flows br0 cookie=0x2,in_port=1,actions=1])
937 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0], [dnl
938 cookie=0x1, in_port=1 actions=output:1
939 OFPST_FLOW reply (OF1.1):
944 dnl The OpenFlow 1.2 spec states that the cookie may not be modified
945 AT_SETUP([ofproto - no mod flow with cookie change (OpenFlow 1.2)])
947 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 cookie=0x1,in_port=1,actions=1])
948 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
949 cookie=0x1, in_port=1 actions=output:1
950 OFPST_FLOW reply (OF1.2):
953 AT_CHECK([ovs-ofctl -O OpenFlow12 mod-flows br0 cookie=0x2,in_port=1,actions=1])
954 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
955 cookie=0x1, in_port=1 actions=output:1
956 OFPST_FLOW reply (OF1.2):
961 AT_SETUP([ofproto - mod flows based on cookie mask (OpenFlow 1.0)])
963 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x1,in_port=1,actions=1])
964 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x1,in_port=2,actions=1])
965 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x2,in_port=3,actions=1])
966 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
967 cookie=0x1, in_port=1 actions=output:1
968 cookie=0x1, in_port=2 actions=output:1
969 cookie=0x2, in_port=3 actions=output:1
973 AT_CHECK([ovs-ofctl -F nxm mod-flows br0 cookie=0x1/0xff,actions=4])
974 AT_CHECK([ovs-ofctl -F nxm dump-flows br0 | ofctl_strip | sort], [0], [dnl
975 cookie=0x1, in_port=1 actions=output:4
976 cookie=0x1, in_port=2 actions=output:4
977 cookie=0x2, in_port=3 actions=output:1
983 AT_SETUP([ofproto - mod flows based on cookie mask (OpenFlow 1.1)])
985 AT_CHECK([ovs-ofctl -O OpenFlow11 add-flow br0 cookie=0x1,in_port=1,actions=1])
986 AT_CHECK([ovs-ofctl -O OpenFlow11 add-flow br0 cookie=0x1,in_port=2,actions=1])
987 AT_CHECK([ovs-ofctl -O OpenFlow11 add-flow br0 cookie=0x2,in_port=3,actions=1])
988 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0], [dnl
989 cookie=0x1, in_port=1 actions=output:1
990 cookie=0x1, in_port=2 actions=output:1
991 cookie=0x2, in_port=3 actions=output:1
992 OFPST_FLOW reply (OF1.1):
995 AT_CHECK([ovs-ofctl -O OpenFlow11 mod-flows br0 cookie=0x1/0xff,actions=4])
996 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0], [dnl
997 cookie=0x1, in_port=1 actions=output:4
998 cookie=0x1, in_port=2 actions=output:4
999 cookie=0x2, in_port=3 actions=output:1
1000 OFPST_FLOW reply (OF1.1):
1005 AT_SETUP([ofproto - mod flows based on cookie mask (OpenFlow 1.2)])
1007 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 cookie=0x1,in_port=1,actions=1])
1008 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 cookie=0x1,in_port=2,actions=1])
1009 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 cookie=0x2,in_port=3,actions=1])
1010 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1011 cookie=0x1, in_port=1 actions=output:1
1012 cookie=0x1, in_port=2 actions=output:1
1013 cookie=0x2, in_port=3 actions=output:1
1014 OFPST_FLOW reply (OF1.2):
1017 AT_CHECK([ovs-ofctl -O OpenFlow12 mod-flows br0 cookie=0x1/0xff,actions=4])
1018 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1019 cookie=0x1, in_port=1 actions=output:4
1020 cookie=0x1, in_port=2 actions=output:4
1021 cookie=0x2, in_port=3 actions=output:1
1022 OFPST_FLOW reply (OF1.2):
1027 dnl The OpenFlow 1.2 spec states that the cookie may not be modified
1028 AT_SETUP([ofproto - mod flows based on cookie mask with cookie change])
1030 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x1,in_port=1,actions=1])
1031 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x1,in_port=2,actions=1])
1032 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x2,in_port=3,actions=1])
1033 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1034 cookie=0x1, in_port=1 actions=output:1
1035 cookie=0x1, in_port=2 actions=output:1
1036 cookie=0x2, in_port=3 actions=output:1
1040 AT_CHECK([ovs-ofctl -F nxm mod-flows br0 cookie=1/-1,cookie=4,actions=4])
1041 AT_CHECK([ovs-ofctl -F nxm dump-flows br0 | ofctl_strip | sort], [0], [dnl
1042 cookie=0x2, in_port=3 actions=output:1
1043 cookie=0x4, in_port=1 actions=output:4
1044 cookie=0x4, in_port=2 actions=output:4
1050 AT_SETUP([ofproto - mod flow with cookie miss (mask==0) - NXM])
1052 AT_CHECK([ovs-ofctl -F nxm mod-flows br0 in_port=1,actions=1])
1053 AT_CHECK([ovs-ofctl -F nxm dump-flows br0 | ofctl_strip | sort], [0], [dnl
1054 in_port=1 actions=output:1
1060 AT_SETUP([ofproto - mod flow with cookie miss (mask==0) - OF1.1])
1062 AT_CHECK([ovs-ofctl -O openflow11 mod-flows br0 in_port=1,actions=1])
1063 AT_CHECK([ovs-ofctl -O openflow11 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1064 in_port=1 actions=output:1
1065 OFPST_FLOW reply (OF1.1):
1070 AT_SETUP([ofproto - mod flow with cookie miss (mask==0) - OF1.2])
1072 AT_CHECK([ovs-ofctl -O openflow12 mod-flows br0 in_port=1,actions=1])
1073 AT_CHECK([ovs-ofctl -O openflow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1074 OFPST_FLOW reply (OF1.2):
1079 AT_SETUP([ofproto - mod flow with cookie miss (mask!=0) - NXM])
1081 AT_CHECK([ovs-ofctl -F nxm mod-flows br0 cookie=1/1,in_port=1,actions=1])
1082 AT_CHECK([ovs-ofctl -F nxm dump-flows br0 | ofctl_strip | sort], [0], [dnl
1088 AT_SETUP([ofproto - mod flow with cookie miss (mask!=0) - OF1.1])
1090 AT_CHECK([ovs-ofctl -O openflow11 mod-flows br0 cookie=1/1,in_port=1,actions=1])
1091 AT_CHECK([ovs-ofctl -O openflow11 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1092 OFPST_FLOW reply (OF1.1):
1097 AT_SETUP([ofproto - mod flow with cookie miss (mask!=0) - OF1.2])
1099 AT_CHECK([ovs-ofctl -O openflow12 mod-flows br0 cookie=1/1,in_port=1,actions=1])
1100 AT_CHECK([ovs-ofctl -O openflow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1101 OFPST_FLOW reply (OF1.2):
1106 AT_SETUP([ofproto - del flows with cookies])
1108 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x1,in_port=1,actions=1])
1109 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x2,in_port=2,actions=1])
1110 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x3,in_port=3,actions=1])
1111 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1112 cookie=0x1, in_port=1 actions=output:1
1113 cookie=0x2, in_port=2 actions=output:1
1114 cookie=0x3, in_port=3 actions=output:1
1118 AT_CHECK([ovs-ofctl del-flows br0])
1119 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1125 AT_SETUP([ofproto - del flows based on cookie])
1127 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x1,in_port=1,actions=1])
1128 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x2,in_port=2,actions=1])
1129 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x3,in_port=3,actions=1])
1130 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1131 cookie=0x1, in_port=1 actions=output:1
1132 cookie=0x2, in_port=2 actions=output:1
1133 cookie=0x3, in_port=3 actions=output:1
1137 AT_CHECK([ovs-ofctl del-flows br0 cookie=0x3/-1])
1138 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1139 cookie=0x1, in_port=1 actions=output:1
1140 cookie=0x2, in_port=2 actions=output:1
1146 AT_SETUP([ofproto - del flows based on cookie mask])
1148 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x1,in_port=1,actions=1])
1149 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x2,in_port=2,actions=1])
1150 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x3,in_port=3,actions=1])
1151 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1152 cookie=0x1, in_port=1 actions=output:1
1153 cookie=0x2, in_port=2 actions=output:1
1154 cookie=0x3, in_port=3 actions=output:1
1157 AT_CHECK([ovs-ofctl del-flows br0 cookie=0x3/0x1])
1158 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1159 cookie=0x2, in_port=2 actions=output:1
1165 AT_SETUP([ofproto - del flows based on table id (NXM)])
1167 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x1,in_port=1,actions=1])
1168 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x2,in_port=2,table=1,actions=1])
1169 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1170 cookie=0x1, in_port=1 actions=output:1
1171 cookie=0x2, table=1, in_port=2 actions=output:1
1174 AT_CHECK([ovs-ofctl del-flows br0 table=0])
1175 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1176 cookie=0x2, table=1, in_port=2 actions=output:1
1179 AT_CHECK([ovs-ofctl del-flows br0 table=1])
1180 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1183 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x1,in_port=1,actions=1])
1184 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x2,in_port=2,table=1,actions=1])
1185 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1186 cookie=0x1, in_port=1 actions=output:1
1187 cookie=0x2, table=1, in_port=2 actions=output:1
1190 AT_CHECK([ovs-ofctl del-flows br0])
1191 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1197 AT_SETUP([ofproto - del flows based on table id (OpenFlow 1.1)])
1199 AT_CHECK([ovs-ofctl -O OpenFlow11 add-flow br0 cookie=0x1,in_port=1,actions=1])
1200 AT_CHECK([ovs-ofctl -O OpenFlow11 add-flow br0 cookie=0x2,in_port=2,table=1,actions=1])
1201 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1202 cookie=0x1, in_port=1 actions=output:1
1203 cookie=0x2, table=1, in_port=2 actions=output:1
1204 OFPST_FLOW reply (OF1.1):
1206 AT_CHECK([ovs-ofctl -O OpenFlow11 del-flows br0 table=0])
1207 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1208 cookie=0x2, table=1, in_port=2 actions=output:1
1209 OFPST_FLOW reply (OF1.1):
1211 AT_CHECK([ovs-ofctl -O OpenFlow11 del-flows br0 table=1])
1212 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1213 OFPST_FLOW reply (OF1.1):
1215 AT_CHECK([ovs-ofctl -O OpenFlow11 add-flow br0 cookie=0x1,in_port=1,actions=1])
1216 AT_CHECK([ovs-ofctl -O OpenFlow11 add-flow br0 cookie=0x2,in_port=2,table=1,actions=1])
1217 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1218 cookie=0x1, in_port=1 actions=output:1
1219 cookie=0x2, table=1, in_port=2 actions=output:1
1220 OFPST_FLOW reply (OF1.1):
1222 AT_CHECK([ovs-ofctl -O OpenFlow11 del-flows br0])
1223 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip], [0], [dnl
1224 OFPST_FLOW reply (OF1.1):
1225 cookie=0x2, table=1, in_port=2 actions=output:1
1230 AT_SETUP([ofproto - del flows based on table id (OpenFlow 1.2)])
1232 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 cookie=0x1,in_port=1,actions=1])
1233 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 cookie=0x2,in_port=2,table=1,actions=1])
1234 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1235 cookie=0x1, in_port=1 actions=output:1
1236 cookie=0x2, table=1, in_port=2 actions=output:1
1237 OFPST_FLOW reply (OF1.2):
1239 AT_CHECK([ovs-ofctl -O OpenFlow12 del-flows br0 table=0])
1240 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1241 cookie=0x2, table=1, in_port=2 actions=output:1
1242 OFPST_FLOW reply (OF1.2):
1244 AT_CHECK([ovs-ofctl -O OpenFlow12 del-flows br0 table=1])
1245 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1246 OFPST_FLOW reply (OF1.2):
1248 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 cookie=0x1,in_port=1,actions=1])
1249 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 cookie=0x2,in_port=2,table=1,actions=1])
1250 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1251 cookie=0x1, in_port=1 actions=output:1
1252 cookie=0x2, table=1, in_port=2 actions=output:1
1253 OFPST_FLOW reply (OF1.2):
1255 AT_CHECK([ovs-ofctl -O OpenFlow12 del-flows br0])
1256 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1257 OFPST_FLOW reply (OF1.2):
1262 AT_SETUP([ofproto - flow table configuration (OpenFlow 1.0)])
1264 # Check the default configuration.
1265 (printf "OFPST_TABLE reply (xid=0x2):"
1268 while test $x -lt 254; do
1271 active=0, lookup=0, matched=0
1274 in_port: exact match or wildcard
1275 eth_src: exact match or wildcard
1276 eth_dst: exact match or wildcard
1277 eth_type: exact match or wildcard
1278 vlan_vid: exact match or wildcard
1279 vlan_pcp: exact match or wildcard
1280 ip_src: exact match or wildcard
1281 ip_dst: exact match or wildcard
1282 nw_proto: exact match or wildcard
1283 nw_tos: exact match or wildcard
1284 tcp_src: exact match or wildcard
1285 tcp_dst: exact match or wildcard
1290 AT_CHECK([ovs-ofctl dump-tables br0], [0], [expout])
1291 # Change the configuration.
1294 -- --id=@t0 create Flow_Table name=main \
1295 -- --id=@t1 create Flow_Table flow-limit=1024 \
1296 -- set bridge br0 'flow_tables={1=@t1,0=@t0}' \
1297 | ${PERL} $srcdir/uuidfilt.pl],
1301 # Check that the configuration was updated.
1302 mv expout orig-expout
1303 sed -e 's/classifier/main/
1304 21s/1000000/1024/' orig-expout > expout
1305 AT_CHECK([ovs-ofctl dump-tables br0], [0], [expout])
1309 dnl In-band and fail-open add "hidden rules" to table 0. These rules shouldn't
1310 dnl be visible to OpenFlow. This test checks that "dump-flows" and
1311 dnl "dump-tables" don't make them visible.
1312 AT_SETUP([ofproto - hidden rules not in table stats])
1313 # Use an IP address for a controller that won't actually exist: we
1314 # want to create in-band rules but we do not want to actually connect
1315 # to a controller (because that could mess about with our test). The
1316 # Class E range 240.0.0.0 - 255.255.255.255 seems like a good choice.
1317 OVS_VSWITCHD_START([set-controller br0 tcp:240.0.0.1:6653])
1318 for i in 1 2 3 4 5; do ovs-appctl time/warp 1000; done
1320 # Check that no hidden flows are visible in OpenFlow.
1321 AT_CHECK([ovs-ofctl dump-flows br0], [0], [NXST_FLOW reply (xid=0x4):
1324 # Check that some hidden flows related to 240.0.0.1 are actually in table 0.
1326 # We discard flows that mention table_id because we only want table 0 flows,
1327 # which in OVS is implied by the absence of a table_id.
1328 AT_CHECK([ovs-appctl bridge/dump-flows br0], [0], [stdout])
1329 AT_CHECK([test `grep '240\.0\.0\.1' stdout | grep -v table_id= | wc -l` -gt 0])
1331 # Check that dump-tables doesn't count the hidden flows.
1332 (printf "OFPST_TABLE reply (xid=0x2):"
1335 while test $x -lt 254; do
1338 active=0, lookup=0, matched=0
1341 in_port: exact match or wildcard
1342 eth_src: exact match or wildcard
1343 eth_dst: exact match or wildcard
1344 eth_type: exact match or wildcard
1345 vlan_vid: exact match or wildcard
1346 vlan_pcp: exact match or wildcard
1347 ip_src: exact match or wildcard
1348 ip_dst: exact match or wildcard
1349 nw_proto: exact match or wildcard
1350 nw_tos: exact match or wildcard
1351 tcp_src: exact match or wildcard
1352 tcp_dst: exact match or wildcard
1357 AT_CHECK([ovs-ofctl dump-tables br0], [0], [expout])
1358 OVS_VSWITCHD_STOP(["/cannot find route for controller/d"])
1361 AT_SETUP([ofproto - flow table configuration (OpenFlow 1.2)])
1363 # Check the default configuration.
1364 (printf "OFPST_TABLE reply (OF1.2) (xid=0x2):"
1367 while test $x -lt 254; do
1368 if test $x = 253; then
1374 table $x (\"$name\"):
1375 active=0, lookup=0, matched=0
1376 metadata: match=0xffffffffffffffff write=0xffffffffffffffff
1379 instructions (table miss and others):
1380 instructions: apply_actions,clear_actions,write_actions,write_metadata$goto
1381 Write-Actions and Apply-Actions features:
1382 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
1383 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 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
1385 metadata: exact match or wildcard
1386 in_port_oxm: exact match or wildcard
1387 eth_src: exact match or wildcard
1388 eth_dst: exact match or wildcard
1389 eth_type: exact match or wildcard
1390 vlan_vid: exact match or wildcard
1391 vlan_pcp: exact match or wildcard
1392 mpls_label: exact match or wildcard
1393 mpls_tc: exact match or wildcard
1394 ip_src: exact match or wildcard
1395 ip_dst: exact match or wildcard
1396 ipv6_src: exact match or wildcard
1397 ipv6_dst: exact match or wildcard
1398 ipv6_label: exact match or wildcard
1399 nw_proto: exact match or wildcard
1400 ip_dscp: exact match or wildcard
1401 nw_ecn: exact match or wildcard
1402 arp_op: exact match or wildcard
1403 arp_spa: exact match or wildcard
1404 arp_tpa: exact match or wildcard
1405 arp_sha: exact match or wildcard
1406 arp_tha: exact match or wildcard
1407 tcp_src: exact match or wildcard
1408 tcp_dst: exact match or wildcard
1409 udp_src: exact match or wildcard
1410 udp_dst: exact match or wildcard
1411 sctp_src: exact match or wildcard
1412 sctp_dst: exact match or wildcard
1413 icmp_type: exact match or wildcard
1414 icmp_code: exact match or wildcard
1415 icmpv6_type: exact match or wildcard
1416 icmpv6_code: exact match or wildcard
1417 nd_target: exact match or wildcard
1418 nd_sll: exact match or wildcard
1419 nd_tll: exact match or wildcard"
1423 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-tables br0], [0], [expout])
1424 # Change the configuration.
1427 -- --id=@t0 create Flow_Table name=main \
1428 -- --id=@t1 create Flow_Table flow-limit=1024 \
1429 -- set bridge br0 'flow_tables={1=@t1,0=@t0}' \
1430 | ${PERL} $srcdir/uuidfilt.pl],
1434 # Check that the configuration was updated.
1435 mv expout orig-expout
1436 sed 's/classifier/main/
1437 53s/1000000/1024/' < orig-expout > expout
1438 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-tables br0], [0], [expout])
1442 AT_SETUP([ofproto - table features (OpenFlow 1.3)])
1446 while test $x -lt 254; do
1448 if test $x = 253; then
1453 if test $x = 252; then
1458 next tables: $y-253"
1461 echo " table $x (\"$name\"):
1462 metadata: match=0xffffffffffffffff write=0xffffffffffffffff
1464 instructions (table miss and others):$next
1465 instructions: meter,apply_actions,clear_actions,write_actions,write_metadata$goto
1466 Write-Actions and Apply-Actions features:
1467 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
1468 supported on Set-Field: tun_id tun_src tun_dst metadata in_port in_port_oxm pkt_mark 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 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
1470 dp_hash: arbitrary mask
1471 recirc_id: exact match or wildcard
1472 tun_id: arbitrary mask
1473 tun_src: arbitrary mask
1474 tun_dst: arbitrary mask
1475 metadata: arbitrary mask
1476 in_port: exact match or wildcard
1477 in_port_oxm: exact match or wildcard
1478 actset_output: exact match or wildcard
1479 pkt_mark: arbitrary mask
1480 reg0: arbitrary mask
1481 reg1: arbitrary mask
1482 reg2: arbitrary mask
1483 reg3: arbitrary mask
1484 reg4: arbitrary mask
1485 reg5: arbitrary mask
1486 reg6: arbitrary mask
1487 reg7: arbitrary mask
1488 xreg0: arbitrary mask
1489 xreg1: arbitrary mask
1490 xreg2: arbitrary mask
1491 xreg3: arbitrary mask
1492 eth_src: arbitrary mask
1493 eth_dst: arbitrary mask
1494 eth_type: exact match or wildcard
1495 vlan_tci: arbitrary mask
1496 vlan_vid: arbitrary mask
1497 vlan_pcp: exact match or wildcard
1498 mpls_label: exact match or wildcard
1499 mpls_tc: exact match or wildcard
1500 mpls_bos: exact match or wildcard
1501 ip_src: arbitrary mask
1502 ip_dst: arbitrary mask
1503 ipv6_src: arbitrary mask
1504 ipv6_dst: arbitrary mask
1505 ipv6_label: arbitrary mask
1506 nw_proto: exact match or wildcard
1507 nw_tos: exact match or wildcard
1508 ip_dscp: exact match or wildcard
1509 nw_ecn: exact match or wildcard
1510 nw_ttl: exact match or wildcard
1511 ip_frag: arbitrary mask
1512 arp_op: exact match or wildcard
1513 arp_spa: arbitrary mask
1514 arp_tpa: arbitrary mask
1515 arp_sha: arbitrary mask
1516 arp_tha: arbitrary mask
1517 tcp_src: arbitrary mask
1518 tcp_dst: arbitrary mask
1519 tcp_flags: arbitrary mask
1520 udp_src: arbitrary mask
1521 udp_dst: arbitrary mask
1522 sctp_src: arbitrary mask
1523 sctp_dst: arbitrary mask
1524 icmp_type: exact match or wildcard
1525 icmp_code: exact match or wildcard
1526 icmpv6_type: exact match or wildcard
1527 icmpv6_code: exact match or wildcard
1528 nd_target: arbitrary mask
1529 nd_sll: arbitrary mask
1530 nd_tll: arbitrary mask"
1534 AT_CHECK([ovs-ofctl -O OpenFlow13 dump-table-features br0 | sed '/^$/d
1535 /^OFPST_TABLE_FEATURES/d'], [0], [expout])
1536 # Change the configuration.
1539 -- --id=@t0 create Flow_Table name=main \
1540 -- --id=@t1 create Flow_Table flow-limit=1024 \
1541 -- set bridge br0 'flow_tables={1=@t1,0=@t0}' \
1542 | ${PERL} $srcdir/uuidfilt.pl],
1546 # Check that the configuration was updated.
1547 mv expout orig-expout
1548 sed 's/classifier/main/
1549 74s/1000000/1024/' < orig-expout > expout
1550 AT_CHECK([ovs-ofctl -O OpenFlow13 dump-table-features br0 | sed '/^$/d
1551 /^OFPST_TABLE_FEATURES/d'], [0], [expout])
1555 AT_SETUP([ofproto - hard limits on flow table size (OpenFlow 1.0)])
1557 # Configure a maximum of 4 flows.
1560 -- --id=@t0 create Flow_Table flow-limit=4 \
1561 -- set bridge br0 flow_tables:0=@t0 \
1562 | ${PERL} $srcdir/uuidfilt.pl],
1566 for in_port in 1 2 3 4; do
1567 ovs-ofctl add-flow br0 in_port=$in_port,actions=drop
1569 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1570 in_port=1 actions=drop
1571 in_port=2 actions=drop
1572 in_port=3 actions=drop
1573 in_port=4 actions=drop
1576 # Adding another flow will be refused.
1577 AT_CHECK([ovs-ofctl add-flow br0 in_port=5,actions=drop], [1], [], [stderr])
1578 AT_CHECK([head -n 1 stderr | ofctl_strip], [0],
1579 [OFPT_ERROR: OFPFMFC_TABLE_FULL
1581 # Also a mod-flow that would add a flow will be refused.
1582 AT_CHECK([ovs-ofctl mod-flows br0 in_port=5,actions=drop], [1], [], [stderr])
1583 AT_CHECK([head -n 1 stderr | ofctl_strip], [0],
1584 [OFPT_ERROR: OFPFMFC_TABLE_FULL
1586 # Replacing or modifying an existing flow is allowed.
1587 AT_CHECK([ovs-ofctl add-flow br0 in_port=4,actions=normal])
1588 AT_CHECK([ovs-ofctl mod-flows br0 in_port=3,actions=output:1])
1589 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1590 in_port=1 actions=drop
1591 in_port=2 actions=drop
1592 in_port=3 actions=output:1
1593 in_port=4 actions=NORMAL
1599 AT_SETUP([ofproto - hard limits on flow table size (OpenFlow 1.2)])
1601 # Configure a maximum of 4 flows.
1604 -- --id=@t0 create Flow_Table flow-limit=4 \
1605 -- set bridge br0 flow_tables:0=@t0 \
1606 | ${PERL} $srcdir/uuidfilt.pl],
1610 for in_port in 1 2 3 4; do
1611 ovs-ofctl -O OpenFlow12 add-flow br0 in_port=$in_port,actions=drop
1613 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1614 in_port=1 actions=drop
1615 in_port=2 actions=drop
1616 in_port=3 actions=drop
1617 in_port=4 actions=drop
1618 OFPST_FLOW reply (OF1.2):
1620 # Adding another flow will be refused.
1621 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 in_port=5,actions=drop], [1], [], [stderr])
1622 AT_CHECK([head -n 1 stderr | ofctl_strip], [0],
1623 [OFPT_ERROR (OF1.2): OFPFMFC_TABLE_FULL
1625 # Replacing or modifying an existing flow is allowed.
1626 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 in_port=4,actions=normal])
1627 AT_CHECK([ovs-ofctl -O OpenFlow12 mod-flows br0 in_port=3,actions=output:1])
1628 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1629 in_port=1 actions=drop
1630 in_port=2 actions=drop
1631 in_port=3 actions=output:1
1632 in_port=4 actions=NORMAL
1633 OFPST_FLOW reply (OF1.2):
1638 AT_SETUP([ofproto - eviction upon table overflow (OpenFlow 1.0)])
1640 # Configure a maximum of 4 flows.
1643 -- --id=@t0 create Flow_Table flow-limit=4 overflow-policy=evict \
1644 -- set bridge br0 flow_tables:0=@t0 \
1645 | ${PERL} $srcdir/uuidfilt.pl],
1649 for in_port in 4 3 2 1; do
1650 ovs-ofctl add-flow br0 idle_timeout=${in_port}0,in_port=$in_port,actions=drop
1652 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1653 idle_timeout=10, in_port=1 actions=drop
1654 idle_timeout=20, in_port=2 actions=drop
1655 idle_timeout=30, in_port=3 actions=drop
1656 idle_timeout=40, in_port=4 actions=drop
1659 # Adding another flow will cause the one that expires soonest to be evicted.
1660 AT_CHECK([ovs-ofctl add-flow br0 in_port=5,actions=drop])
1661 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1662 idle_timeout=20, in_port=2 actions=drop
1663 idle_timeout=30, in_port=3 actions=drop
1664 idle_timeout=40, in_port=4 actions=drop
1665 in_port=5 actions=drop
1668 # A mod-flow that adds a flow also causes eviction, but replacing or
1669 # modifying an existing flow doesn't.
1670 AT_CHECK([ovs-ofctl mod-flows br0 in_port=6,actions=drop])
1671 AT_CHECK([ovs-ofctl add-flow br0 in_port=4,actions=normal])
1672 AT_CHECK([ovs-ofctl mod-flows br0 in_port=3,actions=output:1])
1673 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1674 idle_timeout=30, in_port=3 actions=output:1
1675 in_port=4 actions=NORMAL
1676 in_port=5 actions=drop
1677 in_port=6 actions=drop
1680 # Flows with no timeouts at all cannot be evicted.
1681 AT_CHECK([ovs-ofctl add-flow br0 in_port=7,actions=normal])
1682 AT_CHECK([ovs-ofctl add-flow br0 in_port=8,actions=drop], [1], [], [stderr])
1683 AT_CHECK([head -n 1 stderr | ofctl_strip], [0],
1684 [OFPT_ERROR: OFPFMFC_TABLE_FULL
1686 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1687 in_port=4 actions=NORMAL
1688 in_port=5 actions=drop
1689 in_port=6 actions=drop
1690 in_port=7 actions=NORMAL
1696 AT_SETUP([ofproto - eviction upon table overflow (OpenFlow 1.2)])
1698 # Configure a maximum of 4 flows.
1701 -- --id=@t0 create Flow_Table flow-limit=4 overflow-policy=evict \
1702 -- set bridge br0 flow_tables:0=@t0 \
1703 | ${PERL} $srcdir/uuidfilt.pl],
1707 for in_port in 4 3 2 1; do
1708 ovs-ofctl -O OpenFlow12 add-flow br0 idle_timeout=${in_port}0,in_port=$in_port,actions=drop
1710 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1711 idle_timeout=10, in_port=1 actions=drop
1712 idle_timeout=20, in_port=2 actions=drop
1713 idle_timeout=30, in_port=3 actions=drop
1714 idle_timeout=40, in_port=4 actions=drop
1715 OFPST_FLOW reply (OF1.2):
1717 # Adding another flow will cause the one that expires soonest to be evicted.
1718 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 in_port=5,actions=drop])
1719 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1720 idle_timeout=20, in_port=2 actions=drop
1721 idle_timeout=30, in_port=3 actions=drop
1722 idle_timeout=40, in_port=4 actions=drop
1723 in_port=5 actions=drop
1724 OFPST_FLOW reply (OF1.2):
1726 # In OpenFlow 1.2 a mod-flow does not ever add a flow and thus
1727 # has no effect on eviction
1728 AT_CHECK([ovs-ofctl -O OpenFlow12 mod-flows br0 in_port=6,actions=drop])
1729 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 in_port=4,actions=normal])
1730 AT_CHECK([ovs-ofctl -O OpenFlow12 mod-flows br0 in_port=3,actions=output:1])
1731 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1732 idle_timeout=20, in_port=2 actions=drop
1733 idle_timeout=30, in_port=3 actions=output:1
1734 in_port=4 actions=NORMAL
1735 in_port=5 actions=drop
1736 OFPST_FLOW reply (OF1.2):
1738 # Flows with no timeouts at all cannot be evicted.
1739 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 in_port=6,actions=drop])
1740 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 in_port=7,actions=normal])
1741 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 in_port=8,actions=drop], [1], [], [stderr])
1742 AT_CHECK([head -n 1 stderr | ofctl_strip], [0],
1743 [OFPT_ERROR (OF1.2): OFPFMFC_TABLE_FULL
1745 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1746 in_port=4 actions=NORMAL
1747 in_port=5 actions=drop
1748 in_port=6 actions=drop
1749 in_port=7 actions=NORMAL
1750 OFPST_FLOW reply (OF1.2):
1755 AT_SETUP([ofproto - eviction upon table overflow, with fairness (OpenFlow 1.0)])
1757 # Configure a maximum of 4 flows.
1760 -- --id=@t0 create Flow_Table name=evict flow-limit=4 \
1761 overflow-policy=evict \
1762 groups='"NXM_OF_IN_PORT[[]]"' \
1763 -- set bridge br0 flow_tables:0=@t0 \
1764 | ${PERL} $srcdir/uuidfilt.pl],
1768 ovs-ofctl add-flows br0 - <<EOF
1769 idle_timeout=10 in_port=2 dl_src=00:44:55:66:77:88 actions=drop
1770 idle_timeout=20 in_port=1 dl_src=00:11:22:33:44:55 actions=drop
1771 idle_timeout=30 in_port=1 dl_src=00:22:33:44:55:66 actions=drop
1772 idle_timeout=40 in_port=1 dl_src=00:33:44:55:66:77 actions=drop
1774 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1775 idle_timeout=10, in_port=2,dl_src=00:44:55:66:77:88 actions=drop
1776 idle_timeout=20, in_port=1,dl_src=00:11:22:33:44:55 actions=drop
1777 idle_timeout=30, in_port=1,dl_src=00:22:33:44:55:66 actions=drop
1778 idle_timeout=40, in_port=1,dl_src=00:33:44:55:66:77 actions=drop
1781 # Adding another flow will cause the one that expires soonest within
1782 # the largest group (those with in_port=1) to be evicted. In this
1783 # case this is not the same as the one that expires soonest overall
1784 # (which is what makes the test interesting):
1785 AT_CHECK([ovs-ofctl add-flow br0 in_port=2,dl_src=00:55:66:77:88:99,actions=drop])
1786 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1787 idle_timeout=10, in_port=2,dl_src=00:44:55:66:77:88 actions=drop
1788 idle_timeout=30, in_port=1,dl_src=00:22:33:44:55:66 actions=drop
1789 idle_timeout=40, in_port=1,dl_src=00:33:44:55:66:77 actions=drop
1790 in_port=2,dl_src=00:55:66:77:88:99 actions=drop
1793 # Enlarge the flow limit, change the eviction policy back to strictly
1794 # based on expiration, and and add some flows.
1795 AT_CHECK([ovs-vsctl set Flow_Table evict groups='[[]]' flow-limit=7])
1796 ovs-ofctl add-flows br0 - <<EOF
1797 idle_timeout=50 in_port=2 dl_src=00:66:77:88:99:aa actions=drop
1798 idle_timeout=60 in_port=2 dl_src=00:77:88:99:aa:bb actions=drop
1799 idle_timeout=70 in_port=2 dl_src=00:88:99:aa:bb:cc actions=drop
1801 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1802 idle_timeout=10, in_port=2,dl_src=00:44:55:66:77:88 actions=drop
1803 idle_timeout=30, in_port=1,dl_src=00:22:33:44:55:66 actions=drop
1804 idle_timeout=40, in_port=1,dl_src=00:33:44:55:66:77 actions=drop
1805 idle_timeout=50, in_port=2,dl_src=00:66:77:88:99:aa actions=drop
1806 idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=drop
1807 idle_timeout=70, in_port=2,dl_src=00:88:99:aa:bb:cc actions=drop
1808 in_port=2,dl_src=00:55:66:77:88:99 actions=drop
1811 # Adding another flow will cause the one that expires soonest overall
1813 AT_CHECK([ovs-ofctl add-flow br0 'idle_timeout=80 in_port=2 dl_src=00:99:aa:bb:cc:dd actions=drop'])
1814 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1815 idle_timeout=30, in_port=1,dl_src=00:22:33:44:55:66 actions=drop
1816 idle_timeout=40, in_port=1,dl_src=00:33:44:55:66:77 actions=drop
1817 idle_timeout=50, in_port=2,dl_src=00:66:77:88:99:aa actions=drop
1818 idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=drop
1819 idle_timeout=70, in_port=2,dl_src=00:88:99:aa:bb:cc actions=drop
1820 idle_timeout=80, in_port=2,dl_src=00:99:aa:bb:cc:dd actions=drop
1821 in_port=2,dl_src=00:55:66:77:88:99 actions=drop
1824 # Reducing the flow limit also causes the flows that expire soonest
1825 # overall to be evicted.
1826 AT_CHECK([ovs-vsctl set Flow_Table evict flow-limit=4])
1827 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1828 idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=drop
1829 idle_timeout=70, in_port=2,dl_src=00:88:99:aa:bb:cc actions=drop
1830 idle_timeout=80, in_port=2,dl_src=00:99:aa:bb:cc:dd actions=drop
1831 in_port=2,dl_src=00:55:66:77:88:99 actions=drop
1837 AT_SETUP([ofproto - eviction upon table overflow, with fairness (OpenFlow 1.2)])
1839 # Configure a maximum of 4 flows.
1842 -- --id=@t0 create Flow_Table name=evict flow-limit=4 \
1843 overflow-policy=evict \
1844 groups='"NXM_OF_IN_PORT[[]]"' \
1845 -- set bridge br0 flow_tables:0=@t0 \
1846 | ${PERL} $srcdir/uuidfilt.pl],
1850 ovs-ofctl -O OpenFlow12 add-flows br0 - <<EOF
1851 idle_timeout=10 in_port=2 dl_src=00:44:55:66:77:88 actions=drop
1852 idle_timeout=20 in_port=1 dl_src=00:11:22:33:44:55 actions=drop
1853 idle_timeout=30 in_port=1 dl_src=00:22:33:44:55:66 actions=drop
1854 idle_timeout=40 in_port=1 dl_src=00:33:44:55:66:77 actions=drop
1856 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1857 idle_timeout=10, in_port=2,dl_src=00:44:55:66:77:88 actions=drop
1858 idle_timeout=20, in_port=1,dl_src=00:11:22:33:44:55 actions=drop
1859 idle_timeout=30, in_port=1,dl_src=00:22:33:44:55:66 actions=drop
1860 idle_timeout=40, in_port=1,dl_src=00:33:44:55:66:77 actions=drop
1861 OFPST_FLOW reply (OF1.2):
1863 # Adding another flow will cause the one that expires soonest within
1864 # the largest group (those with in_port=1) to be evicted. In this
1865 # case this is not the same as the one that expires soonest overall
1866 # (which is what makes the test interesting):
1867 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 in_port=2,dl_src=00:55:66:77:88:99,actions=drop])
1868 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1869 idle_timeout=10, in_port=2,dl_src=00:44:55:66:77:88 actions=drop
1870 idle_timeout=30, in_port=1,dl_src=00:22:33:44:55:66 actions=drop
1871 idle_timeout=40, in_port=1,dl_src=00:33:44:55:66:77 actions=drop
1872 in_port=2,dl_src=00:55:66:77:88:99 actions=drop
1873 OFPST_FLOW reply (OF1.2):
1875 # Enlarge the flow limit, change the eviction policy back to strictly
1876 # based on expiration, and and add some flows.
1877 AT_CHECK([ovs-vsctl set Flow_Table evict groups='[[]]' flow-limit=7])
1878 ovs-ofctl -O OpenFlow12 add-flows br0 - <<EOF
1879 idle_timeout=50 in_port=2 dl_src=00:66:77:88:99:aa actions=drop
1880 idle_timeout=60 in_port=2 dl_src=00:77:88:99:aa:bb actions=drop
1881 idle_timeout=70 in_port=2 dl_src=00:88:99:aa:bb:cc actions=drop
1883 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1884 idle_timeout=10, in_port=2,dl_src=00:44:55:66:77:88 actions=drop
1885 idle_timeout=30, in_port=1,dl_src=00:22:33:44:55:66 actions=drop
1886 idle_timeout=40, in_port=1,dl_src=00:33:44:55:66:77 actions=drop
1887 idle_timeout=50, in_port=2,dl_src=00:66:77:88:99:aa actions=drop
1888 idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=drop
1889 idle_timeout=70, in_port=2,dl_src=00:88:99:aa:bb:cc actions=drop
1890 in_port=2,dl_src=00:55:66:77:88:99 actions=drop
1891 OFPST_FLOW reply (OF1.2):
1893 # Adding another flow will cause the one that expires soonest overall
1895 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'])
1896 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1897 idle_timeout=30, in_port=1,dl_src=00:22:33:44:55:66 actions=drop
1898 idle_timeout=40, in_port=1,dl_src=00:33:44:55:66:77 actions=drop
1899 idle_timeout=50, in_port=2,dl_src=00:66:77:88:99:aa actions=drop
1900 idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=drop
1901 idle_timeout=70, in_port=2,dl_src=00:88:99:aa:bb:cc actions=drop
1902 idle_timeout=80, in_port=2,dl_src=00:99:aa:bb:cc:dd actions=drop
1903 in_port=2,dl_src=00:55:66:77:88:99 actions=drop
1904 OFPST_FLOW reply (OF1.2):
1906 # Reducing the flow limit also causes the flows that expire soonest
1907 # overall to be evicted.
1908 AT_CHECK([ovs-vsctl set Flow_Table evict flow-limit=4])
1909 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1910 idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=drop
1911 idle_timeout=70, in_port=2,dl_src=00:88:99:aa:bb:cc actions=drop
1912 idle_timeout=80, in_port=2,dl_src=00:99:aa:bb:cc:dd actions=drop
1913 in_port=2,dl_src=00:55:66:77:88:99 actions=drop
1914 OFPST_FLOW reply (OF1.2):
1919 AT_SETUP([ofproto - eviction upon table overflow, with modified hard timeout])
1921 # Configure a maximum of 4 flows.
1924 -- --id=@t0 create Flow_Table flow-limit=4 overflow-policy=evict \
1925 -- set bridge br0 flow_tables:0=@t0 \
1926 | ${PERL} $srcdir/uuidfilt.pl],
1929 ovs-appctl time/stop
1931 for in_port in 4 3 2 1; do
1932 ovs-ofctl add-flow br0 hard_timeout=$((10 + in_port * 3)),in_port=$in_port,actions=drop
1934 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1935 hard_timeout=13, in_port=1 actions=drop
1936 hard_timeout=16, in_port=2 actions=drop
1937 hard_timeout=19, in_port=3 actions=drop
1938 hard_timeout=22, in_port=4 actions=drop
1941 # Sleep and modify the one that expires soonest
1942 ovs-appctl time/warp 5000
1943 AT_CHECK([ovs-ofctl mod-flows br0 in_port=1,actions=drop])
1944 # At this point the table would looks like:
1945 # in_port seconds to expire
1950 ovs-appctl time/warp 2000
1951 # Adding another flow will cause the one that expires soonest to be evicted.
1952 AT_CHECK([ovs-ofctl add-flow br0 in_port=5,actions=drop])
1953 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1954 hard_timeout=13, in_port=1 actions=drop
1955 hard_timeout=19, in_port=3 actions=drop
1956 hard_timeout=22, in_port=4 actions=drop
1957 in_port=5 actions=drop
1963 AT_SETUP([ofproto - eviction upon table overflow, with modified idle timeout])
1964 OVS_VSWITCHD_START([add-port br0 p1 -- set interface p1 type=dummy ofport_request=1])
1965 # Configure a maximum of 4 flows.
1968 -- --id=@t0 create Flow_Table flow-limit=4 overflow-policy=evict \
1969 -- set bridge br0 flow_tables:0=@t0 \
1970 | ${PERL} $srcdir/uuidfilt.pl],
1974 for in_port in 4 3 2 1; do
1975 ovs-ofctl add-flow br0 idle_timeout=$((10 + in_port * 3)),in_port=$in_port,actions=drop
1977 ovs-appctl time/stop
1978 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1979 idle_timeout=13, in_port=1 actions=drop
1980 idle_timeout=16, in_port=2 actions=drop
1981 idle_timeout=19, in_port=3 actions=drop
1982 idle_timeout=22, in_port=4 actions=drop
1985 # Sleep and receive on the flow that expires soonest
1986 ovs-appctl time/warp 5000
1987 AT_CHECK([ovs-appctl netdev-dummy/receive p1 'in_port(1)'])
1988 # At this point the table would looks like:
1989 # in_port seconds to expire
1994 ovs-appctl time/warp 2000
1995 # Adding another flow will cause the one that expires soonest to be evicted.
1996 AT_CHECK([ovs-ofctl add-flow br0 in_port=5,actions=drop])
1997 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1998 idle_timeout=19, in_port=3 actions=drop
1999 idle_timeout=22, in_port=4 actions=drop
2000 in_port=5 actions=drop
2001 n_packets=1, n_bytes=60, idle_timeout=13, in_port=1 actions=drop
2007 AT_SETUP([ofproto - asynchronous message control (OpenFlow 1.0)])
2009 AT_CHECK([ovs-ofctl -P openflow10 monitor br0 --detach --no-chdir --pidfile])
2011 printf '\n\n--- check_async %d ---\n\n\n' $1
2014 ovs-appctl -t ovs-ofctl ofctl/barrier
2015 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
2018 # OFPT_PACKET_IN, OFPR_ACTION (controller_id=0)
2019 ovs-ofctl -v packet-out br0 controller controller '0001020304050010203040501234'
2020 if test X"$1" = X"OFPR_ACTION"; then shift;
2021 echo >>expout "OFPT_PACKET_IN: total_len=14 in_port=CONTROLLER (via action) data_len=14 (unbuffered)
2022 in_port=0,vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1234"
2025 # OFPT_PACKET_IN, OFPR_NO_MATCH (controller_id=123)
2026 ovs-ofctl -v packet-out br0 controller 'controller(reason=no_match,id=123)' '0001020304050010203040501234'
2027 if test X"$1" = X"OFPR_NO_MATCH"; then shift;
2028 echo >>expout "OFPT_PACKET_IN: total_len=14 in_port=CONTROLLER (via no_match) data_len=14 (unbuffered)
2029 in_port=0,vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1234"
2032 # OFPT_PACKET_IN, OFPR_INVALID_TTL (controller_id=0)
2033 ovs-ofctl packet-out br0 controller dec_ttl '002583dfb4000026b98cb0f908004500003eb7e200000011339bac11370dac100002d7730035002b8f6d86fb0100000100000000000006626c702d7873066e696369726103636f6d00000f00'
2034 if test X"$1" = X"OFPR_INVALID_TTL"; then shift;
2035 echo >>expout "OFPT_PACKET_IN: total_len=76 in_port=CONTROLLER (via invalid_ttl) data_len=76 (unbuffered)
2036 udp,in_port=0,vlan_tci=0x0000,dl_src=00:26:b9:8c:b0:f9,dl_dst=00:25:83:df:b4:00,nw_src=172.17.55.13,nw_dst=172.16.0.2,nw_tos=0,nw_ecn=0,nw_ttl=0,tp_src=55155,tp_dst=53 udp_csum:8f6d"
2039 # OFPT_PORT_STATUS, OFPPR_ADD
2040 ovs-vsctl add-port br0 test -- set Interface test type=dummy ofport_request=1
2041 if test X"$1" = X"OFPPR_ADD"; then shift;
2042 echo >>expout "OFPT_PORT_STATUS: ADD: 1(test): addr:aa:55:aa:55:00:0x
2045 speed: 0 Mbps now, 0 Mbps max"
2048 # OFPT_PORT_STATUS, OFPPR_DELETE
2049 ovs-vsctl del-port br0 test
2050 if test X"$1" = X"OFPPR_DELETE"; then shift;
2051 echo >>expout "OFPT_PORT_STATUS: DEL: 1(test): addr:aa:55:aa:55:00:0x
2054 speed: 0 Mbps now, 0 Mbps max"
2057 # OFPT_FLOW_REMOVED, OFPRR_DELETE
2058 ovs-ofctl add-flow br0 send_flow_rem,actions=drop
2059 ovs-ofctl --strict del-flows br0 ''
2060 if test X"$1" = X"OFPRR_DELETE"; then shift;
2061 echo >>expout "OFPT_FLOW_REMOVED: reason=delete"
2063 AT_FAIL_IF([test X"$1" != X])
2065 ovs-appctl -t ovs-ofctl ofctl/barrier
2066 echo >>expout "OFPT_BARRIER_REPLY:"
2070 s/ (xid=0x[0-9a-fA-F]*)//
2072 s/00:0.$/00:0x/' < monitor.log]],
2076 # It's a service connection so initially there should be no async messages.
2079 # Set miss_send_len to 128, turning on packet-ins for our service connection.
2080 ovs-appctl -t ovs-ofctl ofctl/send 0109000c0123456700000080
2081 check_async 2 OFPR_ACTION OFPPR_ADD OFPPR_DELETE OFPRR_DELETE
2083 # Set miss_send_len to 128 and enable invalid_ttl.
2084 ovs-appctl -t ovs-ofctl ofctl/send 0109000c0123456700040080
2085 check_async 3 OFPR_ACTION OFPR_INVALID_TTL OFPPR_ADD OFPPR_DELETE OFPRR_DELETE
2087 # Become slave, which should disable everything except port status.
2088 ovs-appctl -t ovs-ofctl ofctl/send 0104001400000002000023200000000a00000002
2089 check_async 4 OFPPR_ADD OFPPR_DELETE
2091 # Use NXT_SET_ASYNC_CONFIG to enable a patchwork of asynchronous messages.
2092 ovs-appctl -t ovs-ofctl ofctl/send 01040028000000020000232000000013000000020000000500000005000000020000000200000005
2093 check_async 5 OFPR_INVALID_TTL OFPPR_DELETE OFPRR_DELETE
2095 # Set controller ID 123.
2096 ovs-appctl -t ovs-ofctl ofctl/send 01040018000000030000232000000014000000000000007b
2097 check_async 6 OFPR_NO_MATCH OFPPR_DELETE OFPRR_DELETE
2099 # Restore controller ID 0.
2100 ovs-appctl -t ovs-ofctl ofctl/send 010400180000000300002320000000140000000000000000
2103 ovs-appctl -t ovs-ofctl ofctl/send 0104001400000002000023200000000a00000001
2104 check_async 7 OFPR_ACTION OFPPR_ADD
2106 ovs-appctl -t ovs-ofctl exit
2110 AT_SETUP([ofproto - asynchronous message control (OpenFlow 1.2)])
2112 AT_CHECK([ovs-ofctl -O OpenFlow12 monitor br0 --detach --no-chdir --pidfile])
2114 printf '\n\n--- check_async %d ---\n\n\n' $1
2118 ovs-appctl -t ovs-ofctl ofctl/barrier
2119 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
2122 # OFPT_PACKET_IN, OFPR_ACTION (controller_id=0)
2123 ovs-ofctl -O OpenFlow12 -v packet-out br0 none controller '0001020304050010203040501234'
2124 if test X"$1" = X"OFPR_ACTION"; then shift;
2125 echo >>expout "OFPT_PACKET_IN (OF1.2): total_len=14 in_port=ANY (via action) data_len=14 (unbuffered)
2126 in_port=0,vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1234"
2129 # OFPT_PACKET_IN, OFPR_NO_MATCH (controller_id=123)
2130 ovs-ofctl -O OpenFlow12 -v packet-out br0 none 'controller(reason=no_match,id=123)' '0001020304050010203040501234'
2131 if test X"$1" = X"OFPR_NO_MATCH"; then shift;
2132 echo >>expout "OFPT_PACKET_IN (OF1.2): total_len=14 in_port=ANY (via no_match) data_len=14 (unbuffered)
2133 in_port=0,vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1234"
2136 # OFPT_PACKET_IN, OFPR_INVALID_TTL (controller_id=0)
2137 ovs-ofctl -O OpenFlow12 packet-out br0 none dec_ttl '002583dfb4000026b98cb0f908004500003eb7e200000011339bac11370dac100002d7730035002b8f6d86fb0100000100000000000006626c702d7873066e696369726103636f6d00000f00'
2138 if test X"$1" = X"OFPR_INVALID_TTL"; then shift;
2139 echo >>expout "OFPT_PACKET_IN (OF1.2): total_len=76 in_port=ANY (via invalid_ttl) data_len=76 (unbuffered)
2140 udp,in_port=0,vlan_tci=0x0000,dl_src=00:26:b9:8c:b0:f9,dl_dst=00:25:83:df:b4:00,nw_src=172.17.55.13,nw_dst=172.16.0.2,nw_tos=0,nw_ecn=0,nw_ttl=0,tp_src=55155,tp_dst=53 udp_csum:8f6d"
2143 # OFPT_PORT_STATUS, OFPPR_ADD
2144 ovs-vsctl add-port br0 test -- set Interface test type=dummy
2145 if test X"$1" = X"OFPPR_ADD"; then shift;
2146 echo >>expout "OFPT_PORT_STATUS (OF1.2): ADD: ${INDEX}(test): addr:aa:55:aa:55:00:0x
2149 speed: 0 Mbps now, 0 Mbps max"
2152 # OFPT_PORT_STATUS, OFPPR_DELETE
2153 ovs-vsctl del-port br0 test
2154 if test X"$1" = X"OFPPR_DELETE"; then shift;
2155 echo >>expout "OFPT_PORT_STATUS (OF1.2): DEL: ${INDEX}(test): addr:aa:55:aa:55:00:0x
2158 speed: 0 Mbps now, 0 Mbps max"
2161 # OFPT_FLOW_REMOVED, OFPRR_DELETE
2162 ovs-ofctl -O OpenFlow12 add-flow br0 send_flow_rem,actions=drop
2163 ovs-ofctl -O OpenFlow12 --strict del-flows br0 ''
2164 if test X"$1" = X"OFPRR_DELETE"; then shift;
2165 echo >>expout "OFPT_FLOW_REMOVED (OF1.2): reason=delete table_id=0"
2167 AT_FAIL_IF([test X"$1" != X])
2169 ovs-appctl -t ovs-ofctl ofctl/barrier
2170 echo >>expout "OFPT_BARRIER_REPLY (OF1.2):"
2174 s/ (xid=0x[0-9a-fA-F]*)//
2176 s/00:0.$/00:0x/' < monitor.log]],
2180 # It's a service connection so initially there should be no async messages.
2183 # Set miss_send_len to 128, turning on packet-ins for our service connection.
2184 ovs-appctl -t ovs-ofctl ofctl/send 0309000c0123456700000080
2185 check_async 2 OFPR_ACTION OFPPR_ADD OFPPR_DELETE OFPRR_DELETE
2187 # Set miss_send_len to 128 and enable invalid_ttl.
2188 ovs-appctl -t ovs-ofctl ofctl/send 0309000c0123456700040080
2189 check_async 3 OFPR_ACTION OFPR_INVALID_TTL OFPPR_ADD OFPPR_DELETE OFPRR_DELETE
2191 # Become slave (OF 1.2), which should disable everything except port status.
2192 ovs-appctl -t ovs-ofctl ofctl/send 031800180000000200000003000000000000000000000001
2193 check_async 4 OFPPR_ADD OFPPR_DELETE
2195 # Use NXT_SET_ASYNC_CONFIG to enable a patchwork of asynchronous messages.
2196 ovs-appctl -t ovs-ofctl ofctl/send 03040028000000020000232000000013000000020000000500000005000000020000000200000005
2197 check_async 5 OFPR_INVALID_TTL OFPPR_DELETE OFPRR_DELETE
2199 # Set controller ID 123.
2200 ovs-appctl -t ovs-ofctl ofctl/send 03040018000000030000232000000014000000000000007b
2201 check_async 6 OFPR_NO_MATCH OFPPR_DELETE OFPRR_DELETE
2203 # Restore controller ID 0.
2204 ovs-appctl -t ovs-ofctl ofctl/send 030400180000000300002320000000140000000000000000
2206 # Become master (OF 1.2).
2207 ovs-appctl -t ovs-ofctl ofctl/send 031800180000000400000002000000000000000000000002
2208 check_async 7 OFPR_ACTION OFPPR_ADD
2210 ovs-appctl -t ovs-ofctl exit
2214 AT_SETUP([ofproto - asynchronous message control (OpenFlow 1.3)])
2216 AT_CHECK([ovs-ofctl -O OpenFlow13 monitor br0 --detach --no-chdir --pidfile])
2218 printf '\n\n--- check_async %d ---\n\n\n' $1
2222 ovs-appctl -t ovs-ofctl ofctl/barrier
2223 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
2226 # OFPT_PACKET_IN, OFPR_ACTION (controller_id=0)
2227 ovs-ofctl -O OpenFlow13 -v packet-out br0 none controller '0001020304050010203040501234'
2228 if test X"$1" = X"OFPR_ACTION"; then shift;
2229 echo >>expout "OFPT_PACKET_IN (OF1.3): total_len=14 in_port=ANY (via action) data_len=14 (unbuffered)
2230 in_port=0,vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1234"
2233 # OFPT_PACKET_IN, OFPR_NO_MATCH (controller_id=123)
2234 ovs-ofctl -O OpenFlow13 -v packet-out br0 none 'controller(reason=no_match,id=123)' '0001020304050010203040501234'
2235 if test X"$1" = X"OFPR_NO_MATCH"; then shift;
2236 echo >>expout "OFPT_PACKET_IN (OF1.3): total_len=14 in_port=ANY (via no_match) data_len=14 (unbuffered)
2237 in_port=0,vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1234"
2240 # OFPT_PACKET_IN, OFPR_INVALID_TTL (controller_id=0)
2241 ovs-ofctl -O OpenFlow13 packet-out br0 none dec_ttl '002583dfb4000026b98cb0f908004500003eb7e200000011339bac11370dac100002d7730035002b8f6d86fb0100000100000000000006626c702d7873066e696369726103636f6d00000f00'
2242 if test X"$1" = X"OFPR_INVALID_TTL"; then shift;
2243 echo >>expout "OFPT_PACKET_IN (OF1.3): total_len=76 in_port=ANY (via invalid_ttl) data_len=76 (unbuffered)
2244 udp,in_port=0,vlan_tci=0x0000,dl_src=00:26:b9:8c:b0:f9,dl_dst=00:25:83:df:b4:00,nw_src=172.17.55.13,nw_dst=172.16.0.2,nw_tos=0,nw_ecn=0,nw_ttl=0,tp_src=55155,tp_dst=53 udp_csum:8f6d"
2247 # OFPT_PORT_STATUS, OFPPR_ADD
2248 ovs-vsctl add-port br0 test -- set Interface test type=dummy
2249 if test X"$1" = X"OFPPR_ADD"; then shift;
2250 echo >>expout "OFPT_PORT_STATUS (OF1.3): ADD: ${INDEX}(test): addr:aa:55:aa:55:00:0x
2253 speed: 0 Mbps now, 0 Mbps max"
2256 # OFPT_PORT_STATUS, OFPPR_DELETE
2257 ovs-vsctl del-port br0 test
2258 if test X"$1" = X"OFPPR_DELETE"; then shift;
2259 echo >>expout "OFPT_PORT_STATUS (OF1.3): DEL: ${INDEX}(test): addr:aa:55:aa:55:00:0x
2262 speed: 0 Mbps now, 0 Mbps max"
2265 # OFPT_FLOW_REMOVED, OFPRR_DELETE
2266 ovs-ofctl -O OpenFlow13 add-flow br0 send_flow_rem,actions=drop
2267 ovs-ofctl -O OpenFlow13 --strict del-flows br0 ''
2268 if test X"$1" = X"OFPRR_DELETE"; then shift;
2269 echo >>expout "OFPT_FLOW_REMOVED (OF1.3): reason=delete table_id=0"
2272 # OFPT_FLOW_REMOVED, OFPRR_GROUP_DELETE
2273 ovs-ofctl -O OpenFlow13 add-group br0 group_id=1234,type=all,bucket=output:10
2274 ovs-ofctl -O OpenFlow13 add-flow br0 send_flow_rem,actions=group:1234
2275 ovs-ofctl -O OpenFlow13 --strict del-groups br0 group_id=1234
2276 if test X"$1" = X"OFPRR_DELETE"; then shift;
2277 echo >>expout "OFPT_FLOW_REMOVED (OF1.3): reason=gropu_delete table_id=0"
2280 AT_FAIL_IF([test X"$1" != X])
2282 ovs-appctl -t ovs-ofctl ofctl/barrier
2283 echo >>expout "OFPT_BARRIER_REPLY (OF1.3):"
2287 s/ (xid=0x[0-9a-fA-F]*)//
2289 s/00:0.$/00:0x/' < monitor.log]],
2293 # It's a service connection so initially there should be no async messages.
2296 # Set miss_send_len to 128, turning on packet-ins for our service connection.
2297 ovs-appctl -t ovs-ofctl ofctl/send 0409000c0123456700000080
2298 check_async 2 OFPR_ACTION OFPPR_ADD OFPPR_DELETE OFPRR_DELETE
2300 # Become slave (OF 1.3), which should disable everything except port status.
2301 ovs-appctl -t ovs-ofctl ofctl/send 041800180000000200000003000000000000000000000001
2302 check_async 3 OFPPR_ADD OFPPR_DELETE
2304 # Use OF 1.3 OFPT_SET_ASYNC to enable a patchwork of asynchronous messages.
2305 ovs-appctl -t ovs-ofctl ofctl/send 041c002000000002000000020000000500000005000000020000000200000005
2306 check_async 4 OFPR_INVALID_TTL OFPPR_DELETE OFPRR_DELETE
2308 # Set controller ID 123.
2309 ovs-appctl -t ovs-ofctl ofctl/send 04040018000000030000232000000014000000000000007b
2310 check_async 5 OFPR_NO_MATCH OFPPR_DELETE OFPRR_DELETE
2312 # Restore controller ID 0.
2313 ovs-appctl -t ovs-ofctl ofctl/send 040400180000000300002320000000140000000000000000
2315 # Become master (OF 1.3).
2316 ovs-appctl -t ovs-ofctl ofctl/send 041800180000000400000002000000000000000000000002
2317 check_async 6 OFPR_ACTION OFPPR_ADD
2319 ovs-appctl -t ovs-ofctl exit
2323 AT_SETUP([ofproto - asynchronous message control (OpenFlow 1.5)])
2325 AT_CHECK([ovs-ofctl -O OpenFlow15 monitor br0 --detach --no-chdir --pidfile])
2327 printf '\n\n--- check_async %d ---\n\n\n' $1
2331 ovs-appctl -t ovs-ofctl ofctl/barrier
2332 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
2335 # Other tests are not working with OF 1.5, and message
2336 # format may change, so leave them out.
2338 # OFPT_PORT_STATUS, OFPPR_ADD
2339 ovs-vsctl add-port br0 test -- set Interface test type=dummy
2340 if test X"$1" = X"OFPPR_ADD"; then shift;
2341 echo >>expout "OFPT_PORT_STATUS (OF1.5): ADD: ${INDEX}(test): addr:aa:55:aa:55:00:0x
2344 speed: 0 Mbps now, 0 Mbps max"
2347 # OFPT_PORT_STATUS, OFPPR_MODIFY
2348 ovs-ofctl -O OpenFlow15 -vwarn mod-port br0 test up
2349 if test X"$1" = X"OFPPR_MODIFY"; then shift;
2350 echo >>expout "OFPT_PORT_STATUS (OF1.5): MOD: ${INDEX}(test): addr:aa:55:aa:55:00:0x
2353 speed: 0 Mbps now, 0 Mbps max
2354 OFPT_PORT_STATUS (OF1.5): MOD: 2(test): addr:aa:55:aa:55:00:0x
2357 speed: 0 Mbps now, 0 Mbps max"
2360 # OFPT_PORT_STATUS, OFPPR_DELETE
2361 ovs-vsctl del-port br0 test
2362 if test X"$1" = X"OFPPR_DELETE"; then shift;
2363 echo >>expout "OFPT_PORT_STATUS (OF1.5): DEL: ${INDEX}(test): addr:aa:55:aa:55:00:0x
2366 speed: 0 Mbps now, 0 Mbps max"
2369 AT_FAIL_IF([test X"$1" != X])
2371 ovs-appctl -t ovs-ofctl ofctl/barrier
2372 echo >>expout "OFPT_BARRIER_REPLY (OF1.5):"
2376 s/ (xid=0x[0-9a-fA-F]*)//
2378 s/00:0.$/00:0x/' < monitor.log]],
2382 # It's a service connection so initially there should be no async messages.
2385 # If we don't set this, async messages are not received.
2386 # Set miss_send_len to 128, turning on packet-ins for our service connection.
2387 ovs-appctl -t ovs-ofctl ofctl/send 0609000c0123456700000080
2388 check_async 2 OFPPR_ADD OFPPR_MODIFY OFPPR_DELETE
2390 # Set-async has changed in OF 1.4 and is not yet implemented.
2392 ovs-appctl -t ovs-ofctl exit
2396 dnl This test checks that the role request/response messaging works
2397 dnl and that generation_id is handled properly.
2398 AT_SETUP([ofproto - controller role (OpenFlow 1.2)])
2400 ON_EXIT([kill `cat c1.pid c2.pid`])
2402 # Start two ovs-ofctl controller processes.
2403 AT_CAPTURE_FILE([monitor1.log])
2404 AT_CAPTURE_FILE([expout1])
2405 AT_CAPTURE_FILE([experr1])
2406 AT_CAPTURE_FILE([monitor2.log])
2407 AT_CAPTURE_FILE([expout2])
2408 AT_CAPTURE_FILE([experr2])
2410 AT_CHECK([ovs-ofctl -O OpenFlow12 monitor br0 --detach --no-chdir --pidfile=`pwd`/c$i.pid --unixctl=`pwd`/c$i])
2411 ovs-appctl -t `pwd`/c$i ofctl/barrier
2412 ovs-appctl -t `pwd`/c$i ofctl/set-output-file monitor$i.log
2416 # find out current role
2417 ovs-appctl -t `pwd`/c$i ofctl/send 031800180000000200000000000000000000000000000000
2418 echo >>experr$i "send: OFPT_ROLE_REQUEST (OF1.2): role=nochange"
2419 echo >>expout$i "OFPT_ROLE_REPLY (OF1.2): role=equal"
2422 # controller 1: Become slave (generation_id is initially undefined, so
2423 # 2^63+2 should not be stale)
2424 ovs-appctl -t `pwd`/c1 ofctl/send 031800180000000300000003000000008000000000000002
2425 echo >>experr1 "send: OFPT_ROLE_REQUEST (OF1.2): role=slave generation_id=9223372036854775810"
2426 echo >>expout1 "OFPT_ROLE_REPLY (OF1.2): role=slave generation_id=9223372036854775810"
2428 # controller 2: Become master.
2429 ovs-appctl -t `pwd`/c2 ofctl/send 031800180000000300000002000000008000000000000003
2430 echo >>experr2 "send: OFPT_ROLE_REQUEST (OF1.2): role=master generation_id=9223372036854775811"
2431 echo >>expout2 "OFPT_ROLE_REPLY (OF1.2): role=master generation_id=9223372036854775811"
2433 # controller 1: Try to become the master using a stale generation ID
2434 ovs-appctl -t `pwd`/c1 ofctl/send 031800180000000400000002000000000000000000000003
2435 echo >>experr1 "send: OFPT_ROLE_REQUEST (OF1.2): role=master generation_id=3"
2436 echo >>expout1 "OFPT_ERROR (OF1.2): OFPRRFC_STALE"
2437 echo >>expout1 "OFPT_ROLE_REQUEST (OF1.2): role=master generation_id=3"
2439 # controller 1: Become master using a valid generation ID
2440 ovs-appctl -t `pwd`/c1 ofctl/send 031800180000000500000002000000000000000000000001
2441 echo >>experr1 "send: OFPT_ROLE_REQUEST (OF1.2): role=master generation_id=1"
2442 echo >>expout1 "OFPT_ROLE_REPLY (OF1.2): role=master generation_id=1"
2445 ovs-appctl -t `pwd`/c$i ofctl/barrier
2446 echo >>expout$i "OFPT_BARRIER_REPLY (OF1.2):"
2452 AT_CHECK([grep -v '^send:' monitor$i.log | STRIP_XIDS], [0], [expout])
2454 AT_CHECK([grep '^send:' monitor$i.log | STRIP_XIDS], [0], [expout])
2459 dnl This test checks that the role request/response messaging works,
2460 dnl that generation_id is handled properly, and that role status update
2461 dnl messages are sent when a controller's role gets changed from master
2463 AT_SETUP([ofproto - controller role (OpenFlow 1.4)])
2465 ON_EXIT([kill `cat c1.pid c2.pid`])
2467 # Start two ovs-ofctl controller processes.
2468 AT_CAPTURE_FILE([monitor1.log])
2469 AT_CAPTURE_FILE([expout1])
2470 AT_CAPTURE_FILE([experr1])
2471 AT_CAPTURE_FILE([monitor2.log])
2472 AT_CAPTURE_FILE([expout2])
2473 AT_CAPTURE_FILE([experr2])
2475 AT_CHECK([ovs-ofctl -O OpenFlow14 monitor br0 --detach --no-chdir --pidfile=`pwd`/c$i.pid --unixctl=`pwd`/c$i])
2476 ovs-appctl -t `pwd`/c$i ofctl/barrier
2477 ovs-appctl -t `pwd`/c$i ofctl/set-output-file monitor$i.log
2481 # find out current role
2482 ovs-appctl -t `pwd`/c$i ofctl/send 051800180000000200000000000000000000000000000000
2483 echo >>experr$i "send: OFPT_ROLE_REQUEST (OF1.4): role=nochange"
2484 echo >>expout$i "OFPT_ROLE_REPLY (OF1.4): role=equal"
2487 # controller 1: Become slave (generation_id is initially undefined, so
2488 # 2^63+2 should not be stale)
2489 ovs-appctl -t `pwd`/c1 ofctl/send 051800180000000300000003000000008000000000000002
2490 echo >>experr1 "send: OFPT_ROLE_REQUEST (OF1.4): role=slave generation_id=9223372036854775810"
2491 echo >>expout1 "OFPT_ROLE_REPLY (OF1.4): role=slave generation_id=9223372036854775810"
2493 # controller 2: Become master.
2494 ovs-appctl -t `pwd`/c2 ofctl/send 051800180000000300000002000000008000000000000003
2495 echo >>experr2 "send: OFPT_ROLE_REQUEST (OF1.4): role=master generation_id=9223372036854775811"
2496 echo >>expout2 "OFPT_ROLE_REPLY (OF1.4): role=master generation_id=9223372036854775811"
2498 # controller 1: Try to become the master using a stale generation ID
2499 ovs-appctl -t `pwd`/c1 ofctl/send 051800180000000400000002000000000000000000000003
2500 echo >>experr1 "send: OFPT_ROLE_REQUEST (OF1.4): role=master generation_id=3"
2501 echo >>expout1 "OFPT_ERROR (OF1.4): OFPRRFC_STALE"
2502 echo >>expout1 "OFPT_ROLE_REQUEST (OF1.4): role=master generation_id=3"
2504 # controller 1: Become master using a valid generation ID
2505 ovs-appctl -t `pwd`/c1 ofctl/send 051800180000000500000002000000000000000000000001
2506 echo >>experr1 "send: OFPT_ROLE_REQUEST (OF1.4): role=master generation_id=1"
2507 echo >>expout1 "OFPT_ROLE_REPLY (OF1.4): role=master generation_id=1"
2508 echo >>expout2 "OFPT_ROLE_STATUS (OF1.4): role=slave generation_id=1 reason=master_request"
2511 ovs-appctl -t `pwd`/c$i ofctl/barrier
2512 echo >>expout$i "OFPT_BARRIER_REPLY (OF1.4):"
2518 AT_CHECK([grep -v '^send:' monitor$i.log | STRIP_XIDS], [0], [expout])
2520 AT_CHECK([grep '^send:' monitor$i.log | STRIP_XIDS], [0], [expout])
2525 dnl This test checks that OFPT_PACKET_OUT accepts both OFPP_NONE (as
2526 dnl specified by OpenFlow 1.0) and OFPP_CONTROLLER (used by some
2527 dnl controllers despite the spec) as meaning a packet that was generated
2528 dnl by the controller.
2529 AT_SETUP([ofproto - packet-out from controller (OpenFlow 1.0)])
2531 ADD_OF_PORTS([br0], [1])
2533 # Start a monitor listening for packet-ins.
2534 AT_CHECK([ovs-ofctl -P openflow10 monitor br0 --detach --no-chdir --pidfile])
2535 ovs-appctl -t ovs-ofctl ofctl/send 0109000c0123456700000080
2536 ovs-appctl -t ovs-ofctl ofctl/barrier
2537 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
2538 AT_CAPTURE_FILE([monitor.log])
2540 # Send some packet-outs with OFPP_NONE and OFPP_CONTROLLER (65533) as in_port.
2541 AT_CHECK([ovs-ofctl packet-out br0 none controller,1 '0001020304050010203040501234'])
2542 AT_CHECK([ovs-ofctl packet-out br0 controller controller,1 '0001020304050010203040505678'])
2544 # Stop the monitor and check its output.
2545 ovs-appctl -t ovs-ofctl ofctl/barrier
2546 ovs-appctl -t ovs-ofctl exit
2548 ovs-ofctl dump-ports br0
2550 AT_CHECK([sed 's/ (xid=0x[[0-9a-fA-F]]*)//' monitor.log], [0], [dnl
2551 OFPT_PACKET_IN: total_len=14 in_port=ANY (via action) data_len=14 (unbuffered)
2552 in_port=0,vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1234
2553 OFPT_PACKET_IN: total_len=14 in_port=CONTROLLER (via action) data_len=14 (unbuffered)
2554 in_port=0,vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x5678
2561 dnl This test checks that OFPT_PACKET_OUT accepts both OFPP_NONE (as
2562 dnl specified by OpenFlow 1.2) and OFPP_CONTROLLER (used by some
2563 dnl controllers despite the spec) as meaning a packet that was generated
2564 dnl by the controller.
2565 AT_SETUP([ofproto - packet-out from controller (OpenFlow 1.2)])
2568 # Start a monitor listening for packet-ins.
2569 AT_CHECK([ovs-ofctl -O OpenFlow12 monitor br0 --detach --no-chdir --pidfile])
2570 ovs-appctl -t ovs-ofctl ofctl/send 0309000c0123456700000080
2571 ovs-appctl -t ovs-ofctl ofctl/barrier
2572 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
2573 AT_CAPTURE_FILE([monitor.log])
2575 # Send some packet-outs with OFPP_NONE and OFPP_CONTROLLER (65533) as in_port.
2576 AT_CHECK([ovs-ofctl -O OpenFlow12 packet-out br0 none controller '0001020304050010203040501234'])
2577 AT_CHECK([ovs-ofctl -O OpenFlow12 packet-out br0 4294967293 controller '0001020304050010203040505678'])
2579 # Stop the monitor and check its output.
2580 ovs-appctl -t ovs-ofctl ofctl/barrier
2581 ovs-appctl -t ovs-ofctl exit
2583 AT_CHECK([sed 's/ (xid=0x[[0-9a-fA-F]]*)//' monitor.log], [0], [dnl
2584 OFPT_PACKET_IN (OF1.2): total_len=14 in_port=ANY (via action) data_len=14 (unbuffered)
2585 in_port=0,vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1234
2586 OFPT_PACKET_IN (OF1.2): total_len=14 in_port=CONTROLLER (via action) data_len=14 (unbuffered)
2587 in_port=0,vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x5678
2588 OFPT_BARRIER_REPLY (OF1.2):
2594 dnl This test checks that OFPT_PACKET_OUT accepts both OFPP_NONE (as
2595 dnl specified by OpenFlow 1.1) and OFPP_CONTROLLER (used by some
2596 dnl controllers despite the spec) as meaning a packet that was generated
2597 dnl by the controller.
2598 AT_SETUP([ofproto - packet-out from controller (OpenFlow 1.1)])
2601 # Start a monitor listening for packet-ins.
2602 AT_CHECK([ovs-ofctl -O OpenFlow11 monitor br0 --detach --no-chdir --pidfile])
2603 ovs-appctl -t ovs-ofctl ofctl/send 0209000c0123456700000080
2604 ovs-appctl -t ovs-ofctl ofctl/barrier
2605 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
2606 AT_CAPTURE_FILE([monitor.log])
2608 # Send some packet-outs with OFPP_NONE and OFPP_CONTROLLER (65533) as in_port.
2609 AT_CHECK([ovs-ofctl -O OpenFlow11 packet-out br0 none controller '0001020304050010203040501234'])
2610 AT_CHECK([ovs-ofctl -O OpenFlow11 packet-out br0 4294967293 controller '0001020304050010203040505678'])
2612 # Stop the monitor and check its output.
2613 ovs-appctl -t ovs-ofctl ofctl/barrier
2614 ovs-appctl -t ovs-ofctl exit
2616 AT_CHECK([sed 's/ (xid=0x[[0-9a-fA-F]]*)//' monitor.log], [0], [dnl
2617 OFPT_PACKET_IN (OF1.1): total_len=14 in_port=ANY (via action) data_len=14 (unbuffered)
2618 in_port=0,vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1234
2619 OFPT_PACKET_IN (OF1.1): total_len=14 in_port=CONTROLLER (via action) data_len=14 (unbuffered)
2620 in_port=0,vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x5678
2621 OFPT_BARRIER_REPLY (OF1.1):
2627 dnl This test checks that metadata is encoded in packet_in structures,
2628 dnl supported by NXAST.
2629 AT_SETUP([ofproto - packet-out with metadata (NXM)])
2632 # Start a monitor listening for packet-ins.
2633 AT_CHECK([ovs-ofctl -P nxm monitor br0 --detach --no-chdir --pidfile])
2634 ovs-appctl -t ovs-ofctl ofctl/send 0109000c0123456700000080
2635 ovs-appctl -t ovs-ofctl ofctl/barrier
2636 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
2637 AT_CAPTURE_FILE([monitor.log])
2639 # Send a packet-out with a load action to set some metadata, and forward to controller
2640 AT_CHECK([ovs-ofctl packet-out br0 controller 'load(0xfafafafa5a5a5a5a->OXM_OF_METADATA[[0..63]]), load(0xaa->NXM_NX_PKT_MARK[[]]), controller' '0001020304050010203040501234'])
2642 # Stop the monitor and check its output.
2643 ovs-appctl -t ovs-ofctl ofctl/barrier
2644 ovs-appctl -t ovs-ofctl exit
2646 AT_CHECK([sed 's/ (xid=0x[[0-9a-fA-F]]*)//' monitor.log], [0], [dnl
2647 NXT_PACKET_IN: total_len=14 in_port=CONTROLLER metadata=0xfafafafa5a5a5a5a pkt_mark=0xaa (via action) data_len=14 (unbuffered)
2648 in_port=0,vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1234
2655 dnl This test checks that metadata is encoded in packet_in structures,
2656 dnl supported by NXAST.
2657 AT_SETUP([ofproto - packet-out with metadata (OpenFlow 1.2)])
2660 # Start a monitor listening for packet-ins.
2661 AT_CHECK([ovs-ofctl -O OpenFlow12 monitor br0 --detach --no-chdir --pidfile])
2662 ovs-appctl -t ovs-ofctl ofctl/send 0309000c0123456700000080
2663 ovs-appctl -t ovs-ofctl ofctl/barrier
2664 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
2665 AT_CAPTURE_FILE([monitor.log])
2667 # Send a packet-out with a set-field action to set some metadata, and forward to controller
2668 AT_CHECK([ovs-ofctl -O OpenFlow12 packet-out br0 none 'set_field:0xfafafafa5a5a5a5a->metadata, controller' '0001020304050010203040501234'])
2670 # Stop the monitor and check its output.
2671 ovs-appctl -t ovs-ofctl ofctl/barrier
2672 ovs-appctl -t ovs-ofctl exit
2674 AT_CHECK([sed 's/ (xid=0x[[0-9a-fA-F]]*)//' monitor.log], [0], [dnl
2675 OFPT_PACKET_IN (OF1.2): total_len=14 in_port=ANY metadata=0xfafafafa5a5a5a5a (via action) data_len=14 (unbuffered)
2676 in_port=0,vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1234
2677 OFPT_BARRIER_REPLY (OF1.2):
2683 dnl This test checks that metadata is encoded in packet_in structures,
2684 dnl supported by NXAST.
2685 AT_SETUP([ofproto - packet-out with metadata and dual set_field (OpenFlow 1.3)])
2688 # Start a monitor listening for packet-ins.
2689 AT_CHECK([ovs-ofctl -O OpenFlow13 monitor br0 --detach --no-chdir --pidfile])
2690 ovs-appctl -t ovs-ofctl ofctl/send 0409000c0123456700000080
2691 ovs-appctl -t ovs-ofctl ofctl/barrier
2692 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
2693 AT_CAPTURE_FILE([monitor.log])
2695 # Send a packet-out with a couple of set-field action to set some metadata, and forward to controller
2696 AT_CHECK([ovs-ofctl -O OpenFlow13 packet-out br0 none 'set_field:0xfafafafa5a5a5a5a->metadata, set_field:0x6b->metadata, controller' '0001020304050010203040501234'])
2698 # Stop the monitor and check its output.
2699 ovs-appctl -t ovs-ofctl ofctl/barrier
2700 ovs-appctl -t ovs-ofctl exit
2702 AT_CHECK([sed 's/ (xid=0x[[0-9a-fA-F]]*)//' monitor.log], [0], [dnl
2703 OFPT_PACKET_IN (OF1.3): total_len=14 in_port=ANY metadata=0x6b (via action) data_len=14 (unbuffered)
2704 in_port=0,vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1234
2705 OFPT_BARRIER_REPLY (OF1.3):
2711 dnl This test checks that tunnel metadata is encoded in packet_in structures.
2712 AT_SETUP([ofproto - packet-out with tunnel metadata (OpenFlow 1.2)])
2715 # Start a monitor listening for packet-ins.
2716 AT_CHECK([ovs-ofctl -O OpenFlow12 monitor br0 --detach --no-chdir --pidfile])
2717 ovs-appctl -t ovs-ofctl ofctl/send 0309000c0123456700000080
2718 ovs-appctl -t ovs-ofctl ofctl/barrier
2719 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
2720 AT_CAPTURE_FILE([monitor.log])
2722 # Send a packet-out with set field actions to set some tunnel metadata, and forward to controller
2723 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'])
2725 # Stop the monitor and check its output.
2726 ovs-appctl -t ovs-ofctl ofctl/barrier
2727 ovs-appctl -t ovs-ofctl exit
2729 AT_CHECK([sed 's/ (xid=0x[[0-9a-fA-F]]*)//' monitor.log], [0], [dnl
2730 OFPT_PACKET_IN (OF1.2): total_len=14 in_port=ANY tun_id=0x1020304 tun_src=127.0.0.1 tun_dst=192.168.0.1 (via action) data_len=14 (unbuffered)
2731 in_port=0,vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1234
2732 OFPT_BARRIER_REPLY (OF1.2):
2738 m4_divert_push([PREPARE_TESTS])
2739 # Sorts groups of lines that start with a space, without moving them
2740 # past the nearest line that does not start with a space.
2750 print $_ foreach sort(@buffer);
2755 print $_ foreach sort(@buffer);
2758 m4_divert_pop([PREPARE_TESTS])
2760 AT_SETUP([ofproto - flow monitoring])
2761 AT_KEYWORDS([monitor])
2764 ovs-ofctl add-flow br0 in_port=0,dl_vlan=123,actions=output:1
2766 # Start a monitor watching the flow table and check the initial reply.
2767 ovs-ofctl monitor br0 watch: --detach --no-chdir --pidfile >monitor.log 2>&1
2768 AT_CAPTURE_FILE([monitor.log])
2769 ovs-appctl -t ovs-ofctl ofctl/barrier
2770 AT_CHECK([sed 's/ (xid=0x[[1-9a-fA-F]][[0-9a-fA-F]]*)//' monitor.log], [0],
2771 [NXST_FLOW_MONITOR reply:
2772 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=123 actions=output:1
2776 # Add, delete, and modify some flows and check the updates.
2777 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
2778 ovs-ofctl add-flow br0 in_port=0,dl_vlan=124,actions=output:2
2779 ovs-ofctl add-flow br0 in_port=0,dl_vlan=123,actions=output:5
2780 ovs-ofctl add-flow br0 in_port=0,dl_vlan=123,dl_vlan_pcp=0,actions=output:6
2781 ovs-ofctl add-flow br0 in_port=0,dl_vlan=123,dl_vlan_pcp=1,actions=output:7
2782 ovs-ofctl add-flow br0 in_port=0,dl_vlan=123,actions=output:8
2783 ovs-ofctl add-flow br0 in_port=0,dl_vlan=65535,dl_vlan_pcp=0,actions=output:9
2784 ovs-ofctl add-flow br0 in_port=0,dl_vlan=65535,dl_vlan_pcp=1,actions=output:10
2785 ovs-ofctl add-flow br0 in_port=0,dl_vlan=65535,actions=output:11
2786 ovs-ofctl add-flow br0 in_port=0,dl_vlan=8191,dl_vlan_pcp=0,actions=output:12
2787 ovs-ofctl add-flow br0 in_port=0,dl_vlan=8191,dl_vlan_pcp=1,actions=output:13
2788 ovs-ofctl add-flow br0 in_port=0,dl_vlan=8191,actions=output:14
2789 ovs-ofctl add-flow br0 in_port=0,dl_vlan=0,dl_vlan_pcp=0,actions=output:15
2790 ovs-ofctl add-flow br0 in_port=0,dl_vlan=0,dl_vlan_pcp=1,actions=output:16
2791 ovs-ofctl add-flow br0 in_port=0,dl_vlan=0,actions=output:17
2792 ovs-ofctl add-flow br0 in_port=0,dl_vlan=0,dl_vlan_pcp=0,actions=output:18
2793 ovs-ofctl add-flow br0 in_port=0,dl_vlan=0,dl_vlan_pcp=1,actions=output:19
2794 ovs-ofctl add-flow br0 in_port=0,dl_vlan=0,actions=output:20
2795 ovs-ofctl add-flow br0 in_port=0,dl_vlan_pcp=0,actions=output:21
2796 ovs-ofctl add-flow br0 in_port=0,dl_vlan_pcp=1,actions=output:22
2797 ovs-ofctl add-flow br0 in_port=0,actions=output:23
2798 ovs-ofctl mod-flows br0 dl_vlan=123,actions=output:3
2799 ovs-ofctl mod-flows br0 cookie=5,dl_vlan=123,actions=output:3
2800 ovs-ofctl del-flows br0 dl_vlan=123
2801 ovs-ofctl del-flows br0
2802 ovs-appctl -t ovs-ofctl ofctl/barrier
2803 AT_CHECK([sed 's/ (xid=0x[[1-9a-fA-F]][[0-9a-fA-F]]*)//' monitor.log | multiline_sort], [0],
2804 [NXST_FLOW_MONITOR reply (xid=0x0):
2805 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=124 actions=output:2
2806 NXST_FLOW_MONITOR reply (xid=0x0):
2807 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=123 actions=output:5
2808 NXST_FLOW_MONITOR reply (xid=0x0):
2809 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=123,dl_vlan_pcp=0 actions=output:6
2810 NXST_FLOW_MONITOR reply (xid=0x0):
2811 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=123,dl_vlan_pcp=1 actions=output:7
2812 NXST_FLOW_MONITOR reply (xid=0x0):
2813 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=123 actions=output:8
2814 NXST_FLOW_MONITOR reply (xid=0x0):
2815 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=0,dl_vlan_pcp=0 actions=output:9
2816 NXST_FLOW_MONITOR reply (xid=0x0):
2817 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=0,dl_vlan_pcp=1 actions=output:10
2818 NXST_FLOW_MONITOR reply (xid=0x0):
2819 event=ADDED table=0 cookie=0 in_port=0,vlan_tci=0x0000 actions=output:11
2820 NXST_FLOW_MONITOR reply (xid=0x0):
2821 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=4095,dl_vlan_pcp=0 actions=output:12
2822 NXST_FLOW_MONITOR reply (xid=0x0):
2823 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=4095,dl_vlan_pcp=1 actions=output:13
2824 NXST_FLOW_MONITOR reply (xid=0x0):
2825 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=4095 actions=output:14
2826 NXST_FLOW_MONITOR reply (xid=0x0):
2827 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=0,dl_vlan_pcp=0 actions=output:15
2828 NXST_FLOW_MONITOR reply (xid=0x0):
2829 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=0,dl_vlan_pcp=1 actions=output:16
2830 NXST_FLOW_MONITOR reply (xid=0x0):
2831 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=0 actions=output:17
2832 NXST_FLOW_MONITOR reply (xid=0x0):
2833 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=0,dl_vlan_pcp=0 actions=output:18
2834 NXST_FLOW_MONITOR reply (xid=0x0):
2835 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=0,dl_vlan_pcp=1 actions=output:19
2836 NXST_FLOW_MONITOR reply (xid=0x0):
2837 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=0 actions=output:20
2838 NXST_FLOW_MONITOR reply (xid=0x0):
2839 event=ADDED table=0 cookie=0 in_port=0,dl_vlan_pcp=0 actions=output:21
2840 NXST_FLOW_MONITOR reply (xid=0x0):
2841 event=ADDED table=0 cookie=0 in_port=0,dl_vlan_pcp=1 actions=output:22
2842 NXST_FLOW_MONITOR reply (xid=0x0):
2843 event=ADDED table=0 cookie=0 in_port=0 actions=output:23
2844 NXST_FLOW_MONITOR reply (xid=0x0):
2845 event=MODIFIED table=0 cookie=0 in_port=0,dl_vlan=123 actions=output:3
2846 event=MODIFIED table=0 cookie=0 in_port=0,dl_vlan=123,dl_vlan_pcp=0 actions=output:3
2847 event=MODIFIED table=0 cookie=0 in_port=0,dl_vlan=123,dl_vlan_pcp=1 actions=output:3
2848 NXST_FLOW_MONITOR reply (xid=0x0):
2849 event=MODIFIED table=0 cookie=0x5 in_port=0,dl_vlan=123 actions=output:3
2850 event=MODIFIED table=0 cookie=0x5 in_port=0,dl_vlan=123,dl_vlan_pcp=0 actions=output:3
2851 event=MODIFIED table=0 cookie=0x5 in_port=0,dl_vlan=123,dl_vlan_pcp=1 actions=output:3
2852 NXST_FLOW_MONITOR reply (xid=0x0):
2853 event=DELETED reason=delete table=0 cookie=0x5 in_port=0,dl_vlan=123 actions=output:3
2854 event=DELETED reason=delete table=0 cookie=0x5 in_port=0,dl_vlan=123,dl_vlan_pcp=0 actions=output:3
2855 event=DELETED reason=delete table=0 cookie=0x5 in_port=0,dl_vlan=123,dl_vlan_pcp=1 actions=output:3
2856 NXST_FLOW_MONITOR reply (xid=0x0):
2857 event=DELETED reason=delete table=0 cookie=0 in_port=0 actions=output:23
2858 event=DELETED reason=delete table=0 cookie=0 in_port=0,dl_vlan=0 actions=output:20
2859 event=DELETED reason=delete table=0 cookie=0 in_port=0,dl_vlan=0,dl_vlan_pcp=0 actions=output:18
2860 event=DELETED reason=delete table=0 cookie=0 in_port=0,dl_vlan=0,dl_vlan_pcp=1 actions=output:19
2861 event=DELETED reason=delete table=0 cookie=0 in_port=0,dl_vlan=124 actions=output:2
2862 event=DELETED reason=delete table=0 cookie=0 in_port=0,dl_vlan=4095 actions=output:14
2863 event=DELETED reason=delete table=0 cookie=0 in_port=0,dl_vlan=4095,dl_vlan_pcp=0 actions=output:12
2864 event=DELETED reason=delete table=0 cookie=0 in_port=0,dl_vlan=4095,dl_vlan_pcp=1 actions=output:13
2865 event=DELETED reason=delete table=0 cookie=0 in_port=0,dl_vlan_pcp=0 actions=output:21
2866 event=DELETED reason=delete table=0 cookie=0 in_port=0,dl_vlan_pcp=1 actions=output:22
2867 event=DELETED reason=delete table=0 cookie=0 in_port=0,vlan_tci=0x0000 actions=output:11
2871 # Check that our own changes are reported as full updates.
2872 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
2873 ovs-ofctl add-flow br0 in_port=1,actions=output:2
2874 ovs-ofctl add-flow br0 in_port=2,actions=output:1
2875 ovs-appctl -t ovs-ofctl ofctl/barrier
2876 ovs-appctl -t ovs-ofctl ofctl/send 010e004812345678003fffff00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003000000000000ffffffffffff0000
2877 ovs-appctl -t ovs-ofctl ofctl/barrier
2878 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip], [0], [NXST_FLOW reply:
2880 AT_CHECK([sed 's/ (xid=0x[[1-9a-fA-F]][[0-9a-fA-F]]*)//' monitor.log | multiline_sort], [0],
2881 [NXST_FLOW_MONITOR reply (xid=0x0):
2882 event=ADDED table=0 cookie=0 in_port=1 actions=output:2
2883 NXST_FLOW_MONITOR reply (xid=0x0):
2884 event=ADDED table=0 cookie=0 in_port=2 actions=output:1
2886 send: OFPT_FLOW_MOD: DEL priority=0 actions=drop
2887 NXST_FLOW_MONITOR reply (xid=0x0):
2888 event=DELETED reason=delete table=0 cookie=0 in_port=1 actions=output:2
2889 event=DELETED reason=delete table=0 cookie=0 in_port=2 actions=output:1
2893 ovs-appctl -t ovs-ofctl exit
2897 AT_SETUP([ofproto - flow monitoring with !own])
2898 AT_KEYWORDS([monitor])
2901 ovs-ofctl add-flow br0 in_port=0,dl_vlan=123,actions=output:1
2903 # Start a monitor watching the flow table and check the initial reply.
2904 ovs-ofctl monitor br0 watch:\!own --detach --no-chdir --pidfile >monitor.log 2>&1
2905 AT_CAPTURE_FILE([monitor.log])
2906 ovs-appctl -t ovs-ofctl ofctl/barrier
2907 AT_CHECK([sed 's/ (xid=0x[[1-9a-fA-F]][[0-9a-fA-F]]*)//' monitor.log], [0],
2908 [NXST_FLOW_MONITOR reply:
2909 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=123 actions=output:1
2913 # Check that our own changes are reported as abbreviations.
2914 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
2915 ovs-ofctl add-flow br0 in_port=1,actions=output:2
2916 ovs-ofctl add-flow br0 in_port=2,actions=output:1
2917 ovs-appctl -t ovs-ofctl ofctl/barrier
2918 ovs-appctl -t ovs-ofctl ofctl/send 010e004812345678003fffff00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003000000000000ffffffffffff0000
2919 ovs-appctl -t ovs-ofctl ofctl/barrier
2920 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip], [0], [NXST_FLOW reply:
2922 AT_CHECK([sed 's/ (xid=0x[[1-9a-fA-F]][[0-9a-fA-F]]*)//' monitor.log], [0],
2923 [NXST_FLOW_MONITOR reply (xid=0x0):
2924 event=ADDED table=0 cookie=0 in_port=1 actions=output:2
2925 NXST_FLOW_MONITOR reply (xid=0x0):
2926 event=ADDED table=0 cookie=0 in_port=2 actions=output:1
2928 send: OFPT_FLOW_MOD: DEL priority=0 actions=drop
2929 NXST_FLOW_MONITOR reply (xid=0x0):
2930 event=ABBREV xid=0x12345678
2934 ovs-appctl -t ovs-ofctl exit
2938 AT_SETUP([ofproto - flow monitoring with out_port])
2939 AT_KEYWORDS([monitor])
2942 ovs-ofctl add-flow br0 in_port=0,dl_vlan=121,actions=output:1
2943 ovs-ofctl add-flow br0 in_port=0,dl_vlan=122,actions=output:1
2944 ovs-ofctl add-flow br0 in_port=0,dl_vlan=123,actions=output:2
2946 # Start a monitor watching the flow table and check the initial reply.
2947 ovs-ofctl monitor br0 watch:out_port=2 --detach --no-chdir --pidfile >monitor.log 2>&1
2948 AT_CAPTURE_FILE([monitor.log])
2949 ovs-appctl -t ovs-ofctl ofctl/barrier
2950 AT_CHECK([sed 's/ (xid=0x[[1-9a-fA-F]][[0-9a-fA-F]]*)//' monitor.log], [0],
2951 [NXST_FLOW_MONITOR reply:
2952 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=123 actions=output:2
2956 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
2958 # Add, modify flows and check the updates.
2959 ovs-ofctl mod-flows br0 dl_vlan=121,actions=drop
2960 ovs-ofctl mod-flows br0 dl_vlan=122,actions=output:1,output:2
2961 ovs-appctl -t ovs-ofctl ofctl/barrier
2963 ovs-ofctl mod-flows br0 dl_vlan=123,actions=output:1,output:2
2964 ovs-appctl -t ovs-ofctl ofctl/barrier
2966 ovs-ofctl mod-flows br0 dl_vlan=122,actions=output:1
2967 ovs-appctl -t ovs-ofctl ofctl/barrier
2968 ovs-ofctl mod-flows br0 dl_vlan=123,actions=output:2
2969 ovs-appctl -t ovs-ofctl ofctl/barrier
2971 AT_CHECK([sed 's/ (xid=0x[[1-9a-fA-F]][[0-9a-fA-F]]*)//' monitor.log], [0],
2972 [NXST_FLOW_MONITOR reply (xid=0x0):
2973 event=MODIFIED table=0 cookie=0 in_port=0,dl_vlan=122 actions=output:1,output:2
2975 NXST_FLOW_MONITOR reply (xid=0x0):
2976 event=MODIFIED table=0 cookie=0 in_port=0,dl_vlan=123 actions=output:1,output:2
2978 NXST_FLOW_MONITOR reply (xid=0x0):
2979 event=MODIFIED table=0 cookie=0 in_port=0,dl_vlan=122 actions=output:1
2981 NXST_FLOW_MONITOR reply (xid=0x0):
2982 event=MODIFIED table=0 cookie=0 in_port=0,dl_vlan=123 actions=output:2
2986 ovs-appctl -t ovs-ofctl exit
2990 AT_SETUP([ofproto - flow monitoring pause and resume])
2991 AT_KEYWORDS([monitor])
2993 # The maximum socket receive buffer size is important for this test, which
2994 # tests behavior when the receive buffer overflows.
2995 if test -e /proc/sys/net/core/rmem_max; then
2997 rmem_max=`cat /proc/sys/net/core/rmem_max`
2998 elif rmem_max=`sysctl -n net.inet.tcp.recvbuf_max 2>/dev/null`; then
3001 # Don't know how to get maximum socket receive buffer on this OS
3004 # Calculate the total amount of queuing: rmem_max in the kernel, 128 kB
3005 # in ofproto sending userspace (see ofmonitor_flush() in connmgr.c).
3006 queue_size=`expr $rmem_max + 128 \* 1024`
3007 echo rmem_max=$rmem_max queue_size=$queue_size
3009 # If there's too much queuing skip the test to avoid timing out.
3010 AT_SKIP_IF([test $rmem_max -gt 1048576])
3012 # Each flow update message takes up at least 48 bytes of space in queues
3013 # and in practice more than that.
3014 n_msgs=`expr $queue_size / 48`
3019 # Start a monitor watching the flow table, then make it block.
3020 ON_EXIT([kill `cat ovs-ofctl.pid`])
3021 ovs-ofctl monitor br0 watch: --detach --no-chdir --pidfile >monitor.log 2>&1
3022 AT_CAPTURE_FILE([monitor.log])
3023 ovs-appctl -t ovs-ofctl ofctl/block
3025 # Add $n_msgs flows.
3026 (echo "in_port=2,actions=output:2"
3028 for ($i = 0; $i < '$n_msgs'; $i++) {
3029 print "cookie=1,reg1=$i,actions=drop\n";
3032 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
3033 # Check that multipart flow dumps work properly:
3034 AT_CHECK([ovs-ofctl diff-flows br0 flows.txt])
3035 AT_CHECK([ovs-ofctl add-flow br0 in_port=1,cookie=3,actions=drop])
3036 AT_CHECK([ovs-ofctl mod-flows br0 in_port=2,cookie=2,actions=output:2])
3037 AT_CHECK([ovs-ofctl del-flows br0 cookie=1/-1])
3039 ovs-appctl -t ovs-ofctl ofctl/unblock
3041 # Wait for the connection resumed.
3042 # A barrier doesn't work for this purpose.
3043 # https://www.mail-archive.com/dev@openvswitch.org/msg27013.html
3044 # https://www.mail-archive.com/dev@openvswitch.org/msg27675.html
3045 OVS_WAIT_UNTIL([grep NXT_FLOW_MONITOR_RESUMED monitor.log])
3047 ovs-appctl -t ovs-ofctl exit
3049 # Check that the flow monitor reported the same number of flows
3050 # added and deleted, but fewer than we actually added and deleted.
3051 adds=`grep -c 'ADDED.*reg1=' monitor.log`
3052 deletes=`grep -c 'DELETED.*reg1=' monitor.log`
3053 echo adds=$adds deletes=$deletes
3054 AT_CHECK([test $adds -gt 100 && test $adds -lt $n_msgs])
3055 AT_CHECK([test $adds = $deletes])
3057 # Check that the flow monitor reported everything in the expected order:
3059 # event=ADDED table=0 cookie=0x1 reg1=0x22
3061 # NXT_FLOW_MONITOR_PAUSED:
3063 # event=DELETED reason=delete table=0 cookie=0x1 reg1=0x22
3065 # event=ADDED table=0 cookie=0x3 in_port=1
3066 # event=MODIFIED table=0 cookie=0x2 in_port=2 actions=output:2
3067 # NXT_FLOW_MONITOR_RESUMED:
3069 # except that, between the PAUSED and RESUMED, the order of the ADDED
3070 # and MODIFIED lines lines depends on hash order, that is, it varies
3071 # as we change the hash function or change architecture. Therefore,
3072 # we use a couple of tests below to accept both orders.
3073 AT_CHECK([ofctl_strip < monitor.log | sed -n -e '
3076 /NXT_FLOW_MONITOR_PAUSED:/p
3077 /NXT_FLOW_MONITOR_RESUMED:/p
3078 ' > monitor.log.subset])
3079 AT_CHECK([grep -v MODIFIED monitor.log.subset], [0], [dnl
3080 event=ADDED table=0 cookie=0x1 reg1=0x22
3081 NXT_FLOW_MONITOR_PAUSED:
3082 event=DELETED reason=delete table=0 cookie=0x1 reg1=0x22
3083 event=ADDED table=0 cookie=0x3 in_port=1
3084 NXT_FLOW_MONITOR_RESUMED:
3086 AT_CHECK([grep -v ADDED monitor.log.subset], [0], [dnl
3087 NXT_FLOW_MONITOR_PAUSED:
3088 event=DELETED reason=delete table=0 cookie=0x1 reg1=0x22
3089 event=MODIFIED table=0 cookie=0x2 in_port=2 actions=output:2
3090 NXT_FLOW_MONITOR_RESUMED:
3096 AT_SETUP([ofproto - event filtering (OpenFlow 1.3)])
3097 AT_KEYWORDS([monitor])
3100 # Start a monitor, use the required protocol version
3101 ovs-ofctl -O OpenFlow13 monitor br0 --detach --no-chdir --pidfile >monitor.log 2>&1
3102 AT_CAPTURE_FILE([monitor.log])
3104 # Send an OpenFlow13 message (04), OFPT_GET_ASYNC_REQUEST (1a), length (8), xid (0a)
3105 ovs-appctl -t ovs-ofctl ofctl/send 041a00080000000a
3106 ovs-appctl -t ovs-ofctl ofctl/barrier
3108 # Check default setting
3109 read -r -d '' expected <<'EOF'
3112 AT_CHECK([ofctl_strip < monitor.log], [], [dnl
3113 send: OFPT_GET_ASYNC_REQUEST (OF1.3):
3114 OFPT_GET_ASYNC_REPLY (OF1.3):
3116 PACKET_IN: no_match action
3117 PORT_STATUS: add delete modify
3118 FLOW_REMOVED: idle hard delete
3122 PORT_STATUS: add delete modify
3124 OFPT_BARRIER_REPLY (OF1.3):
3130 AT_SETUP([ofproto - ofport_request])
3132 ADD_OF_PORTS([br0], [1], [2], [3])
3134 set_and_check_specific_ofports () {
3135 ovs-vsctl set Interface p1 ofport_request="$1" -- \
3136 set Interface p2 ofport_request="$2" -- \
3137 set Interface p3 ofport_request="$3"
3138 ofports=`ovs-vsctl get Interface p1 ofport -- \
3139 get Interface p2 ofport -- \
3140 get Interface p3 ofport`
3141 AT_CHECK_UNQUOTED([echo $ofports], [0], [$1 $2 $3
3144 for pre in '1 2 3' '1 3 2' '2 1 3' '2 3 1' '3 1 2' '3 2 1'; do
3145 for post in '1 2 3' '1 3 2' '2 1 3' '2 3 1' '3 1 2' '3 2 1'; do
3146 echo -----------------------------------------------------------
3147 echo "Check changing port numbers from $pre to $post"
3148 set_and_check_specific_ofports $pre
3149 set_and_check_specific_ofports $post
3153 ovs-vsctl del-port p3
3155 set_and_check_poorly_specified_ofports () {
3156 ovs-vsctl set Interface p1 ofport_request="$1" -- \
3157 set Interface p2 ofport_request="$2"
3158 p1=`ovs-vsctl get Interface p1 ofport`
3159 p2=`ovs-vsctl get Interface p2 ofport`
3162 AT_CHECK([test "$p1" != "$p2"])
3163 if test "$1" = "$2" && test "$1" != '[[]]'; then
3164 # One port number must be the requested one.
3165 AT_CHECK([test "$p1" = "$1" || test "$p2" = "$1"])
3166 # The other port number must be different (already tested above).
3168 AT_CHECK([test "$1" = '[[]]' || test "$p1" == "$1"])
3169 AT_CHECK([test "$2" = '[[]]' || test "$p2" == "$2"])
3172 for pre in '1 2' '[[]] 2' '1 [[]]' '[[]] [[]]' '2 1' '[[]] 1' '2 [[]]' \
3174 for post in '1 2' '[[]] 2' '1 [[]]' '[[]] [[]]' '2 1' '[[]] 1' '2 [[]]' \
3176 echo -----------------------------------------------------------
3177 echo "Check changing port numbers from $pre to $post"
3178 set_and_check_poorly_specified_ofports $pre
3179 set_and_check_poorly_specified_ofports $post
3186 AT_SETUP([ofproto - bundles, open (OpenFlow 1.4)])
3187 AT_KEYWORDS([monitor])
3190 # Start a monitor, use the required protocol version
3191 ovs-ofctl -O OpenFlow14 monitor br0 --detach --no-chdir --pidfile >monitor.log 2>&1
3192 AT_CAPTURE_FILE([monitor.log])
3194 # Send an OpenFlow14 message (05), OFPT_BUNDLE_CONTROL (21), length (10), xid (0a)
3195 ovs-appctl -t ovs-ofctl ofctl/send "05 21 00 10 00 00 00 0a 00 00 00 01 00 00 00 01"
3196 ovs-appctl -t ovs-ofctl ofctl/barrier
3197 ovs-appctl -t ovs-ofctl exit
3199 AT_CHECK([ofctl_strip < monitor.log], [], [dnl
3200 send: OFPT_BUNDLE_CONTROL (OF1.4):
3201 bundle_id=0x1 type=OPEN_REQUEST flags=atomic
3202 OFPT_BUNDLE_CONTROL (OF1.4):
3203 bundle_id=0x1 type=OPEN_REPLY flags=0
3204 OFPT_BARRIER_REPLY (OF1.4):
3210 AT_SETUP([ofproto - bundles, double open (OpenFlow 1.4)])
3211 AT_KEYWORDS([monitor])
3214 # Start a monitor, use the required protocol version
3215 ovs-ofctl -O OpenFlow14 monitor br0 --detach --no-chdir --pidfile >monitor.log 2>&1
3216 AT_CAPTURE_FILE([monitor.log])
3218 # Send twice an OpenFlow14 message (05), OFPT_BUNDLE_CONTROL (21), length (10), xid (0a)
3219 ovs-appctl -t ovs-ofctl ofctl/send "05 21 00 10 00 00 00 0a 00 00 00 01 00 00 00 01"
3220 ovs-appctl -t ovs-ofctl ofctl/barrier
3221 ovs-appctl -t ovs-ofctl ofctl/send "05 21 00 10 00 00 00 0a 00 00 00 01 00 00 00 01"
3222 ovs-appctl -t ovs-ofctl ofctl/barrier
3223 ovs-appctl -t ovs-ofctl exit
3225 AT_CHECK([ofctl_strip < monitor.log], [0], [dnl
3226 send: OFPT_BUNDLE_CONTROL (OF1.4):
3227 bundle_id=0x1 type=OPEN_REQUEST flags=atomic
3228 OFPT_BUNDLE_CONTROL (OF1.4):
3229 bundle_id=0x1 type=OPEN_REPLY flags=0
3230 OFPT_BARRIER_REPLY (OF1.4):
3231 send: OFPT_BUNDLE_CONTROL (OF1.4):
3232 bundle_id=0x1 type=OPEN_REQUEST flags=atomic
3233 OFPT_ERROR (OF1.4): OFPBFC_BAD_ID
3234 OFPT_BUNDLE_CONTROL (OF1.4):
3235 bundle_id=0x1 type=OPEN_REQUEST flags=atomic
3236 OFPT_BARRIER_REPLY (OF1.4):
3242 AT_SETUP([ofproto - bundle close without open (OpenFlow 1.4)])
3243 AT_KEYWORDS([monitor])
3246 # Start a monitor, use the required protocol version
3247 ovs-ofctl -O OpenFlow14 monitor br0 --detach --no-chdir --pidfile >monitor.log 2>&1
3248 AT_CAPTURE_FILE([monitor.log])
3250 ovs-appctl -t ovs-ofctl ofctl/send "05 21 00 10 00 00 00 0a 00 00 00 01 00 02 00 01"
3251 ovs-appctl -t ovs-ofctl ofctl/barrier
3252 ovs-appctl -t ovs-ofctl exit
3254 AT_CHECK([ofctl_strip < monitor.log], [0], [dnl
3255 send: OFPT_BUNDLE_CONTROL (OF1.4):
3256 bundle_id=0x1 type=CLOSE_REQUEST flags=atomic
3257 OFPT_ERROR (OF1.4): OFPBFC_BAD_ID
3258 OFPT_BUNDLE_CONTROL (OF1.4):
3259 bundle_id=0x1 type=CLOSE_REQUEST flags=atomic
3260 OFPT_BARRIER_REPLY (OF1.4):
3266 AT_SETUP([ofproto - bundle double close (OpenFlow 1.4)])
3267 AT_KEYWORDS([monitor])
3270 # Start a monitor, use the required protocol version
3271 ovs-ofctl -O OpenFlow14 monitor br0 --detach --no-chdir --pidfile >monitor.log 2>&1
3272 AT_CAPTURE_FILE([monitor.log])
3274 # Open, Close, Close
3275 ovs-appctl -t ovs-ofctl ofctl/send "05 21 00 10 00 00 00 0a 00 00 00 01 00 00 00 01"
3276 ovs-appctl -t ovs-ofctl ofctl/barrier
3277 ovs-appctl -t ovs-ofctl ofctl/send "05 21 00 10 00 00 00 0a 00 00 00 01 00 02 00 01"
3278 ovs-appctl -t ovs-ofctl ofctl/barrier
3279 ovs-appctl -t ovs-ofctl ofctl/send "05 21 00 10 00 00 00 0a 00 00 00 01 00 02 00 01"
3280 ovs-appctl -t ovs-ofctl ofctl/barrier
3281 ovs-appctl -t ovs-ofctl exit
3283 AT_CHECK([ofctl_strip < monitor.log], [0], [dnl
3284 send: OFPT_BUNDLE_CONTROL (OF1.4):
3285 bundle_id=0x1 type=OPEN_REQUEST flags=atomic
3286 OFPT_BUNDLE_CONTROL (OF1.4):
3287 bundle_id=0x1 type=OPEN_REPLY flags=0
3288 OFPT_BARRIER_REPLY (OF1.4):
3289 send: OFPT_BUNDLE_CONTROL (OF1.4):
3290 bundle_id=0x1 type=CLOSE_REQUEST flags=atomic
3291 OFPT_BUNDLE_CONTROL (OF1.4):
3292 bundle_id=0x1 type=CLOSE_REPLY flags=0
3293 OFPT_BARRIER_REPLY (OF1.4):
3294 send: OFPT_BUNDLE_CONTROL (OF1.4):
3295 bundle_id=0x1 type=CLOSE_REQUEST flags=atomic
3296 OFPT_ERROR (OF1.4): OFPBFC_BUNDLE_CLOSED
3297 OFPT_BUNDLE_CONTROL (OF1.4):
3298 bundle_id=0x1 type=CLOSE_REQUEST flags=atomic
3299 OFPT_BARRIER_REPLY (OF1.4):
3305 AT_SETUP([ofproto - bundle close, different flags (OpenFlow 1.4)])
3306 AT_KEYWORDS([monitor])
3309 # Start a monitor, use the required protocol version
3310 ovs-ofctl -O OpenFlow14 monitor br0 --detach --no-chdir --pidfile >monitor.log 2>&1
3311 AT_CAPTURE_FILE([monitor.log])
3313 # Open, Close, Close
3314 ovs-appctl -t ovs-ofctl ofctl/send "05 21 00 10 00 00 00 0a 00 00 00 01 00 00 00 01"
3315 ovs-appctl -t ovs-ofctl ofctl/barrier
3316 ovs-appctl -t ovs-ofctl ofctl/send "05 21 00 10 00 00 00 0a 00 00 00 01 00 02 00 02"
3317 ovs-appctl -t ovs-ofctl ofctl/barrier
3318 ovs-appctl -t ovs-ofctl exit
3320 AT_CHECK([ofctl_strip < monitor.log], [0], [dnl
3321 send: OFPT_BUNDLE_CONTROL (OF1.4):
3322 bundle_id=0x1 type=OPEN_REQUEST flags=atomic
3323 OFPT_BUNDLE_CONTROL (OF1.4):
3324 bundle_id=0x1 type=OPEN_REPLY flags=0
3325 OFPT_BARRIER_REPLY (OF1.4):
3326 send: OFPT_BUNDLE_CONTROL (OF1.4):
3327 bundle_id=0x1 type=CLOSE_REQUEST flags=ordered
3328 OFPT_ERROR (OF1.4): OFPBFC_BAD_FLAGS
3329 OFPT_BUNDLE_CONTROL (OF1.4):
3330 bundle_id=0x1 type=CLOSE_REQUEST flags=ordered
3331 OFPT_BARRIER_REPLY (OF1.4):
3337 AT_SETUP([ofproto - bundle commit without open (OpenFlow 1.4)])
3338 AT_KEYWORDS([monitor])
3341 # Start a monitor, use the required protocol version
3342 ovs-ofctl -O OpenFlow14 monitor br0 --detach --no-chdir --pidfile >monitor.log 2>&1
3343 AT_CAPTURE_FILE([monitor.log])
3345 # Open, Close, Close
3346 ovs-appctl -t ovs-ofctl ofctl/send "05 21 00 10 00 00 00 0a 00 00 00 01 00 04 00 01"
3347 ovs-appctl -t ovs-ofctl ofctl/barrier
3348 ovs-appctl -t ovs-ofctl exit
3350 AT_CHECK([ofctl_strip < monitor.log], [0], [dnl
3351 send: OFPT_BUNDLE_CONTROL (OF1.4):
3352 bundle_id=0x1 type=COMMIT_REQUEST flags=atomic
3353 OFPT_ERROR (OF1.4): OFPBFC_BAD_ID
3354 OFPT_BUNDLE_CONTROL (OF1.4):
3355 bundle_id=0x1 type=COMMIT_REQUEST flags=atomic
3356 OFPT_BARRIER_REPLY (OF1.4):
3362 AT_SETUP([ofproto - bundle commit, different flags (OpenFlow 1.4)])
3363 AT_KEYWORDS([monitor])
3366 # Start a monitor, use the required protocol version
3367 ovs-ofctl -O OpenFlow14 monitor br0 --detach --no-chdir --pidfile >monitor.log 2>&1
3368 AT_CAPTURE_FILE([monitor.log])
3370 # Open, Close, Close
3371 ovs-appctl -t ovs-ofctl ofctl/send "05 21 00 10 00 00 00 0a 00 00 00 01 00 00 00 01"
3372 ovs-appctl -t ovs-ofctl ofctl/barrier
3373 ovs-appctl -t ovs-ofctl ofctl/send "05 21 00 10 00 00 00 0a 00 00 00 01 00 04 00 02"
3374 ovs-appctl -t ovs-ofctl ofctl/barrier
3375 ovs-appctl -t ovs-ofctl exit
3377 AT_CHECK([ofctl_strip < monitor.log], [0], [dnl
3378 send: OFPT_BUNDLE_CONTROL (OF1.4):
3379 bundle_id=0x1 type=OPEN_REQUEST flags=atomic
3380 OFPT_BUNDLE_CONTROL (OF1.4):
3381 bundle_id=0x1 type=OPEN_REPLY flags=0
3382 OFPT_BARRIER_REPLY (OF1.4):
3383 send: OFPT_BUNDLE_CONTROL (OF1.4):
3384 bundle_id=0x1 type=COMMIT_REQUEST flags=ordered
3385 OFPT_ERROR (OF1.4): OFPBFC_BAD_FLAGS
3386 OFPT_BUNDLE_CONTROL (OF1.4):
3387 bundle_id=0x1 type=COMMIT_REQUEST flags=ordered
3388 OFPT_BARRIER_REPLY (OF1.4):
3394 AT_SETUP([ofproto - bundle discard without open (OpenFlow 1.4)])
3395 AT_KEYWORDS([monitor])
3398 # Start a monitor, use the required protocol version
3399 ovs-ofctl -O OpenFlow14 monitor br0 --detach --no-chdir --pidfile >monitor.log 2>&1
3400 AT_CAPTURE_FILE([monitor.log])
3402 # Open, Close, Close
3403 ovs-appctl -t ovs-ofctl ofctl/send "05 21 00 10 00 00 00 0a 00 00 00 01 00 06 00 01"
3404 ovs-appctl -t ovs-ofctl ofctl/barrier
3405 ovs-appctl -t ovs-ofctl exit
3407 AT_CHECK([ofctl_strip < monitor.log], [0], [dnl
3408 send: OFPT_BUNDLE_CONTROL (OF1.4):
3409 bundle_id=0x1 type=DISCARD_REQUEST flags=atomic
3410 OFPT_ERROR (OF1.4): OFPBFC_BAD_ID
3411 OFPT_BUNDLE_CONTROL (OF1.4):
3412 bundle_id=0x1 type=DISCARD_REQUEST flags=atomic
3413 OFPT_BARRIER_REPLY (OF1.4):