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=select,selection_method=hash,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=select,selection_method=hash,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 add-flow br0 icmp6,icmp_type=136,table=1,in_port=3,actions=set_field:fe80:8675:3097:890a:a6ba:dbff:f00d:59fa-\>nd_target,set_field:cc:dd:ee:ff:00:11-\>nd_tll])
848 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
849 table=1, icmp6,in_port=3,icmp_type=136 actions=load:0xa6badbfff00d59fa->NXM_NX_ND_TARGET[[0..63]],load:0xfe8086753097890a->NXM_NX_ND_TARGET[[64..127]],load:0xccddeeff0011->NXM_NX_ND_TLL[[]]
850 table=1, ipv6,in_port=3 actions=load:0xa6badbfffefe59fa->NXM_NX_IPV6_SRC[[0..63]],load:0xfe8001234567890a->NXM_NX_IPV6_SRC[[64..127]]
856 AT_SETUP([ofproto - basic flow_mod commands (OpenFlow 1.2)])
858 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip], [0], [OFPST_FLOW reply (OF1.2):
860 AT_CHECK([echo 'in_port=2,actions=1' | ovs-ofctl -O OpenFlow12 add-flows br0 -])
861 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 in_port=1,actions=2])
862 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 table=1,in_port=4,actions=3])
863 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
864 in_port=1 actions=output:2
865 in_port=2 actions=output:1
866 table=1, in_port=4 actions=output:3
867 OFPST_FLOW reply (OF1.2):
869 AT_CHECK([ovs-ofctl -O OpenFlow12 del-flows br0])
870 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip], [0], [OFPST_FLOW reply (OF1.2):
875 AT_SETUP([ofproto - set-field flow_mod commands (OF1.2)])
877 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 ipv6,table=1,in_port=3,actions=drop])
878 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 ipv6,table=1,in_port=3,actions=set_field:fe80:0123:4567:890a:a6ba:dbff:fefe:59fa-\>ipv6_src])
879 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 icmp6,icmp_type=136,table=1,in_port=3,actions=set_field:fe80:8675:3097:890a:a6ba:dbff:f00d:59fa-\>nd_target,set_field:cc:dd:ee:ff:00:11-\>nd_tll])
880 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
881 table=1, icmp6,in_port=3,icmp_type=136 actions=set_field:fe80:8675:3097:890a:a6ba:dbff:f00d:59fa->nd_target,set_field:cc:dd:ee:ff:00:11->nd_tll
882 table=1, ipv6,in_port=3 actions=set_field:fe80:123:4567:890a:a6ba:dbff:fefe:59fa->ipv6_src
883 OFPST_FLOW reply (OF1.2):
888 AT_SETUP([ofproto - dump flows with cookie])
890 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x1,in_port=1,actions=1])
891 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x2,in_port=2,actions=1])
892 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x3,in_port=3,actions=1])
893 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
894 cookie=0x1, in_port=1 actions=output:1
895 cookie=0x2, in_port=2 actions=output:1
896 cookie=0x3, in_port=3 actions=output:1
899 AT_CHECK([ovs-ofctl dump-aggregate br0 table=0 | STRIP_XIDS], [0], [dnl
900 NXST_AGGREGATE reply: packet_count=0 byte_count=0 flow_count=3
902 AT_CHECK([ovs-ofctl dump-flows br0 cookie=0x3/-1 | ofctl_strip | sort], [0], [dnl
903 cookie=0x3, in_port=3 actions=output:1
906 AT_CHECK([ovs-ofctl dump-aggregate br0 cookie=0x3/-1 | STRIP_XIDS], [0], [dnl
907 NXST_AGGREGATE reply: packet_count=0 byte_count=0 flow_count=1
912 AT_SETUP([ofproto - mod flow with cookie change (OpenFlow 1.0)])
914 AT_CHECK([ovs-ofctl -F openflow10 add-flow br0 cookie=0x1,in_port=1,actions=1])
915 AT_CHECK([ovs-ofctl -F openflow10 dump-flows br0 | ofctl_strip | sort], [0], [dnl
916 cookie=0x1, in_port=1 actions=output:1
920 AT_CHECK([ovs-ofctl -F openflow10 mod-flows br0 cookie=0x2,in_port=1,actions=1])
921 AT_CHECK([ovs-ofctl -F openflow10 dump-flows br0 | ofctl_strip | sort], [0], [dnl
922 cookie=0x2, in_port=1 actions=output:1
928 AT_SETUP([ofproto - mod flow with cookie change (NXM)])
930 AT_CHECK([ovs-ofctl -F nxm add-flow br0 cookie=0x1,in_port=1,actions=1])
931 AT_CHECK([ovs-ofctl -F nxm dump-flows br0 | ofctl_strip | sort], [0], [dnl
932 cookie=0x1, in_port=1 actions=output:1
936 AT_CHECK([ovs-ofctl -F nxm mod-flows br0 cookie=0x2,in_port=1,actions=1])
937 AT_CHECK([ovs-ofctl -F nxm dump-flows br0 | ofctl_strip | sort], [0], [dnl
938 cookie=0x2, in_port=1 actions=output:1
944 AT_SETUP([ofproto - no mod flow with cookie change (OpenFlow 1.1)])
946 AT_CHECK([ovs-ofctl -O OpenFlow11 add-flow br0 cookie=0x1,in_port=1,actions=1])
947 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0], [dnl
948 cookie=0x1, in_port=1 actions=output:1
949 OFPST_FLOW reply (OF1.1):
951 AT_CHECK([ovs-ofctl -O OpenFlow11 mod-flows br0 cookie=0x2,in_port=1,actions=1])
952 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0], [dnl
953 cookie=0x1, in_port=1 actions=output:1
954 OFPST_FLOW reply (OF1.1):
959 dnl The OpenFlow 1.2 spec states that the cookie may not be modified
960 AT_SETUP([ofproto - no mod flow with cookie change (OpenFlow 1.2)])
962 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 cookie=0x1,in_port=1,actions=1])
963 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
964 cookie=0x1, in_port=1 actions=output:1
965 OFPST_FLOW reply (OF1.2):
968 AT_CHECK([ovs-ofctl -O OpenFlow12 mod-flows br0 cookie=0x2,in_port=1,actions=1])
969 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
970 cookie=0x1, in_port=1 actions=output:1
971 OFPST_FLOW reply (OF1.2):
976 AT_SETUP([ofproto - mod flows based on cookie mask (OpenFlow 1.0)])
978 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x1,in_port=1,actions=1])
979 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x1,in_port=2,actions=1])
980 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x2,in_port=3,actions=1])
981 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
982 cookie=0x1, in_port=1 actions=output:1
983 cookie=0x1, in_port=2 actions=output:1
984 cookie=0x2, in_port=3 actions=output:1
988 AT_CHECK([ovs-ofctl -F nxm mod-flows br0 cookie=0x1/0xff,actions=4])
989 AT_CHECK([ovs-ofctl -F nxm dump-flows br0 | ofctl_strip | sort], [0], [dnl
990 cookie=0x1, in_port=1 actions=output:4
991 cookie=0x1, in_port=2 actions=output:4
992 cookie=0x2, in_port=3 actions=output:1
998 AT_SETUP([ofproto - mod flows based on cookie mask (OpenFlow 1.1)])
1000 AT_CHECK([ovs-ofctl -O OpenFlow11 add-flow br0 cookie=0x1,in_port=1,actions=1])
1001 AT_CHECK([ovs-ofctl -O OpenFlow11 add-flow br0 cookie=0x1,in_port=2,actions=1])
1002 AT_CHECK([ovs-ofctl -O OpenFlow11 add-flow br0 cookie=0x2,in_port=3,actions=1])
1003 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1004 cookie=0x1, in_port=1 actions=output:1
1005 cookie=0x1, in_port=2 actions=output:1
1006 cookie=0x2, in_port=3 actions=output:1
1007 OFPST_FLOW reply (OF1.1):
1010 AT_CHECK([ovs-ofctl -O OpenFlow11 mod-flows br0 cookie=0x1/0xff,actions=4])
1011 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1012 cookie=0x1, in_port=1 actions=output:4
1013 cookie=0x1, in_port=2 actions=output:4
1014 cookie=0x2, in_port=3 actions=output:1
1015 OFPST_FLOW reply (OF1.1):
1020 AT_SETUP([ofproto - mod flows based on cookie mask (OpenFlow 1.2)])
1022 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 cookie=0x1,in_port=1,actions=1])
1023 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 cookie=0x1,in_port=2,actions=1])
1024 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 cookie=0x2,in_port=3,actions=1])
1025 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1026 cookie=0x1, in_port=1 actions=output:1
1027 cookie=0x1, in_port=2 actions=output:1
1028 cookie=0x2, in_port=3 actions=output:1
1029 OFPST_FLOW reply (OF1.2):
1032 AT_CHECK([ovs-ofctl -O OpenFlow12 mod-flows br0 cookie=0x1/0xff,actions=4])
1033 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1034 cookie=0x1, in_port=1 actions=output:4
1035 cookie=0x1, in_port=2 actions=output:4
1036 cookie=0x2, in_port=3 actions=output:1
1037 OFPST_FLOW reply (OF1.2):
1042 dnl The OpenFlow 1.2 spec states that the cookie may not be modified
1043 AT_SETUP([ofproto - mod flows based on cookie mask with cookie change])
1045 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x1,in_port=1,actions=1])
1046 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x1,in_port=2,actions=1])
1047 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x2,in_port=3,actions=1])
1048 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1049 cookie=0x1, in_port=1 actions=output:1
1050 cookie=0x1, in_port=2 actions=output:1
1051 cookie=0x2, in_port=3 actions=output:1
1055 AT_CHECK([ovs-ofctl -F nxm mod-flows br0 cookie=1/-1,cookie=4,actions=4])
1056 AT_CHECK([ovs-ofctl -F nxm dump-flows br0 | ofctl_strip | sort], [0], [dnl
1057 cookie=0x2, in_port=3 actions=output:1
1058 cookie=0x4, in_port=1 actions=output:4
1059 cookie=0x4, in_port=2 actions=output:4
1065 AT_SETUP([ofproto - mod flow with cookie miss (mask==0) - NXM])
1067 AT_CHECK([ovs-ofctl -F nxm mod-flows br0 in_port=1,actions=1])
1068 AT_CHECK([ovs-ofctl -F nxm dump-flows br0 | ofctl_strip | sort], [0], [dnl
1069 in_port=1 actions=output:1
1075 AT_SETUP([ofproto - mod flow with cookie miss (mask==0) - OF1.1])
1077 AT_CHECK([ovs-ofctl -O openflow11 mod-flows br0 in_port=1,actions=1])
1078 AT_CHECK([ovs-ofctl -O openflow11 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1079 in_port=1 actions=output:1
1080 OFPST_FLOW reply (OF1.1):
1085 AT_SETUP([ofproto - mod flow with cookie miss (mask==0) - OF1.2])
1087 AT_CHECK([ovs-ofctl -O openflow12 mod-flows br0 in_port=1,actions=1])
1088 AT_CHECK([ovs-ofctl -O openflow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1089 OFPST_FLOW reply (OF1.2):
1094 AT_SETUP([ofproto - mod flow with cookie miss (mask!=0) - NXM])
1096 AT_CHECK([ovs-ofctl -F nxm mod-flows br0 cookie=1/1,in_port=1,actions=1])
1097 AT_CHECK([ovs-ofctl -F nxm dump-flows br0 | ofctl_strip | sort], [0], [dnl
1103 AT_SETUP([ofproto - mod flow with cookie miss (mask!=0) - OF1.1])
1105 AT_CHECK([ovs-ofctl -O openflow11 mod-flows br0 cookie=1/1,in_port=1,actions=1])
1106 AT_CHECK([ovs-ofctl -O openflow11 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1107 OFPST_FLOW reply (OF1.1):
1112 AT_SETUP([ofproto - mod flow with cookie miss (mask!=0) - OF1.2])
1114 AT_CHECK([ovs-ofctl -O openflow12 mod-flows br0 cookie=1/1,in_port=1,actions=1])
1115 AT_CHECK([ovs-ofctl -O openflow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1116 OFPST_FLOW reply (OF1.2):
1121 AT_SETUP([ofproto - del flows with cookies])
1123 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x1,in_port=1,actions=1])
1124 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x2,in_port=2,actions=1])
1125 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x3,in_port=3,actions=1])
1126 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1127 cookie=0x1, in_port=1 actions=output:1
1128 cookie=0x2, in_port=2 actions=output:1
1129 cookie=0x3, in_port=3 actions=output:1
1133 AT_CHECK([ovs-ofctl del-flows br0])
1134 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1140 AT_SETUP([ofproto - del flows based on cookie])
1142 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x1,in_port=1,actions=1])
1143 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x2,in_port=2,actions=1])
1144 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x3,in_port=3,actions=1])
1145 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1146 cookie=0x1, in_port=1 actions=output:1
1147 cookie=0x2, in_port=2 actions=output:1
1148 cookie=0x3, in_port=3 actions=output:1
1152 AT_CHECK([ovs-ofctl del-flows br0 cookie=0x3/-1])
1153 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1154 cookie=0x1, in_port=1 actions=output:1
1155 cookie=0x2, in_port=2 actions=output:1
1161 AT_SETUP([ofproto - del flows based on cookie mask])
1163 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x1,in_port=1,actions=1])
1164 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x2,in_port=2,actions=1])
1165 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x3,in_port=3,actions=1])
1166 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1167 cookie=0x1, in_port=1 actions=output:1
1168 cookie=0x2, in_port=2 actions=output:1
1169 cookie=0x3, in_port=3 actions=output:1
1172 AT_CHECK([ovs-ofctl del-flows br0 cookie=0x3/0x1])
1173 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1174 cookie=0x2, in_port=2 actions=output:1
1180 AT_SETUP([ofproto - del flows based on table id (NXM)])
1182 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x1,in_port=1,actions=1])
1183 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x2,in_port=2,table=1,actions=1])
1184 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1185 cookie=0x1, in_port=1 actions=output:1
1186 cookie=0x2, table=1, in_port=2 actions=output:1
1189 AT_CHECK([ovs-ofctl del-flows br0 table=0])
1190 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1191 cookie=0x2, table=1, in_port=2 actions=output:1
1194 AT_CHECK([ovs-ofctl del-flows br0 table=1])
1195 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1198 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x1,in_port=1,actions=1])
1199 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x2,in_port=2,table=1,actions=1])
1200 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1201 cookie=0x1, in_port=1 actions=output:1
1202 cookie=0x2, table=1, in_port=2 actions=output:1
1205 AT_CHECK([ovs-ofctl del-flows br0])
1206 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1212 AT_SETUP([ofproto - del flows based on table id (OpenFlow 1.1)])
1214 AT_CHECK([ovs-ofctl -O OpenFlow11 add-flow br0 cookie=0x1,in_port=1,actions=1])
1215 AT_CHECK([ovs-ofctl -O OpenFlow11 add-flow br0 cookie=0x2,in_port=2,table=1,actions=1])
1216 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1217 cookie=0x1, in_port=1 actions=output:1
1218 cookie=0x2, table=1, in_port=2 actions=output:1
1219 OFPST_FLOW reply (OF1.1):
1221 AT_CHECK([ovs-ofctl -O OpenFlow11 del-flows br0 table=0])
1222 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1223 cookie=0x2, table=1, in_port=2 actions=output:1
1224 OFPST_FLOW reply (OF1.1):
1226 AT_CHECK([ovs-ofctl -O OpenFlow11 del-flows br0 table=1])
1227 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1228 OFPST_FLOW reply (OF1.1):
1230 AT_CHECK([ovs-ofctl -O OpenFlow11 add-flow br0 cookie=0x1,in_port=1,actions=1])
1231 AT_CHECK([ovs-ofctl -O OpenFlow11 add-flow br0 cookie=0x2,in_port=2,table=1,actions=1])
1232 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1233 cookie=0x1, in_port=1 actions=output:1
1234 cookie=0x2, table=1, in_port=2 actions=output:1
1235 OFPST_FLOW reply (OF1.1):
1237 AT_CHECK([ovs-ofctl -O OpenFlow11 del-flows br0])
1238 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip], [0], [dnl
1239 OFPST_FLOW reply (OF1.1):
1240 cookie=0x2, table=1, in_port=2 actions=output:1
1245 AT_SETUP([ofproto - del flows based on table id (OpenFlow 1.2)])
1247 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 cookie=0x1,in_port=1,actions=1])
1248 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 cookie=0x2,in_port=2,table=1,actions=1])
1249 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1250 cookie=0x1, in_port=1 actions=output:1
1251 cookie=0x2, table=1, in_port=2 actions=output:1
1252 OFPST_FLOW reply (OF1.2):
1254 AT_CHECK([ovs-ofctl -O OpenFlow12 del-flows br0 table=0])
1255 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1256 cookie=0x2, table=1, in_port=2 actions=output:1
1257 OFPST_FLOW reply (OF1.2):
1259 AT_CHECK([ovs-ofctl -O OpenFlow12 del-flows br0 table=1])
1260 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1261 OFPST_FLOW reply (OF1.2):
1263 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 cookie=0x1,in_port=1,actions=1])
1264 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 cookie=0x2,in_port=2,table=1,actions=1])
1265 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1266 cookie=0x1, in_port=1 actions=output:1
1267 cookie=0x2, table=1, in_port=2 actions=output:1
1268 OFPST_FLOW reply (OF1.2):
1270 AT_CHECK([ovs-ofctl -O OpenFlow12 del-flows br0])
1271 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1272 OFPST_FLOW reply (OF1.2):
1277 AT_SETUP([ofproto - flow table configuration (OpenFlow 1.0)])
1279 # Check the default configuration.
1280 (printf "OFPST_TABLE reply (xid=0x2):"
1283 while test $x -lt 254; do
1286 active=0, lookup=0, matched=0
1289 in_port: exact match or wildcard
1290 eth_src: exact match or wildcard
1291 eth_dst: exact match or wildcard
1292 eth_type: exact match or wildcard
1293 vlan_vid: exact match or wildcard
1294 vlan_pcp: exact match or wildcard
1295 ip_src: exact match or wildcard
1296 ip_dst: exact match or wildcard
1297 nw_proto: exact match or wildcard
1298 nw_tos: exact match or wildcard
1299 tcp_src: exact match or wildcard
1300 tcp_dst: exact match or wildcard
1305 AT_CHECK([ovs-ofctl dump-tables br0], [0], [expout])
1306 # Change the configuration.
1309 -- --id=@t0 create Flow_Table name=main \
1310 -- --id=@t1 create Flow_Table flow-limit=1024 \
1311 -- set bridge br0 'flow_tables={1=@t1,0=@t0}' \
1312 | ${PERL} $srcdir/uuidfilt.pl],
1316 # Check that the configuration was updated.
1317 mv expout orig-expout
1318 sed -e 's/classifier/main/
1319 21s/1000000/1024/' orig-expout > expout
1320 AT_CHECK([ovs-ofctl dump-tables br0], [0], [expout])
1324 dnl In-band and fail-open add "hidden rules" to table 0. These rules shouldn't
1325 dnl be visible to OpenFlow. This test checks that "dump-flows" and
1326 dnl "dump-tables" don't make them visible.
1327 AT_SETUP([ofproto - hidden rules not in table stats])
1328 # Use an IP address for a controller that won't actually exist: we
1329 # want to create in-band rules but we do not want to actually connect
1330 # to a controller (because that could mess about with our test). The
1331 # Class E range 240.0.0.0 - 255.255.255.255 seems like a good choice.
1332 OVS_VSWITCHD_START([set-controller br0 tcp:240.0.0.1:6653])
1333 for i in 1 2 3 4 5; do ovs-appctl time/warp 1000; done
1335 # Check that no hidden flows are visible in OpenFlow.
1336 AT_CHECK([ovs-ofctl dump-flows br0], [0], [NXST_FLOW reply (xid=0x4):
1339 # Check that some hidden flows related to 240.0.0.1 are actually in table 0.
1341 # We discard flows that mention table_id because we only want table 0 flows,
1342 # which in OVS is implied by the absence of a table_id.
1343 AT_CHECK([ovs-appctl bridge/dump-flows br0], [0], [stdout])
1344 AT_CHECK([test `grep '240\.0\.0\.1' stdout | grep -v table_id= | wc -l` -gt 0])
1346 # Check that dump-tables doesn't count the hidden flows.
1347 (printf "OFPST_TABLE reply (xid=0x2):"
1350 while test $x -lt 254; do
1353 active=0, lookup=0, matched=0
1356 in_port: exact match or wildcard
1357 eth_src: exact match or wildcard
1358 eth_dst: exact match or wildcard
1359 eth_type: exact match or wildcard
1360 vlan_vid: exact match or wildcard
1361 vlan_pcp: exact match or wildcard
1362 ip_src: exact match or wildcard
1363 ip_dst: exact match or wildcard
1364 nw_proto: exact match or wildcard
1365 nw_tos: exact match or wildcard
1366 tcp_src: exact match or wildcard
1367 tcp_dst: exact match or wildcard
1372 AT_CHECK([ovs-ofctl dump-tables br0], [0], [expout])
1373 OVS_VSWITCHD_STOP(["/cannot find route for controller/d"])
1376 AT_SETUP([ofproto - flow table configuration (OpenFlow 1.2)])
1378 # Check the default configuration.
1379 (printf "OFPST_TABLE reply (OF1.2) (xid=0x2):"
1382 while test $x -lt 254; do
1383 if test $x = 253; then
1389 table $x (\"$name\"):
1390 active=0, lookup=0, matched=0
1391 metadata: match=0xffffffffffffffff write=0xffffffffffffffff
1394 instructions (table miss and others):
1395 instructions: apply_actions,clear_actions,write_actions,write_metadata$goto
1396 Write-Actions and Apply-Actions features:
1397 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
1398 supported on Set-Field: metadata in_port_oxm eth_src eth_dst vlan_vid vlan_pcp mpls_label mpls_tc ip_src ip_dst ipv6_src ipv6_dst ipv6_label ip_dscp nw_ecn arp_op arp_spa arp_tpa arp_sha arp_tha tcp_src tcp_dst udp_src udp_dst sctp_src sctp_dst nd_target nd_sll nd_tll
1400 metadata: exact match or wildcard
1401 in_port_oxm: exact match or wildcard
1402 eth_src: exact match or wildcard
1403 eth_dst: exact match or wildcard
1404 eth_type: exact match or wildcard
1405 vlan_vid: exact match or wildcard
1406 vlan_pcp: exact match or wildcard
1407 mpls_label: exact match or wildcard
1408 mpls_tc: exact match or wildcard
1409 ip_src: exact match or wildcard
1410 ip_dst: exact match or wildcard
1411 ipv6_src: exact match or wildcard
1412 ipv6_dst: exact match or wildcard
1413 ipv6_label: exact match or wildcard
1414 nw_proto: exact match or wildcard
1415 ip_dscp: exact match or wildcard
1416 nw_ecn: exact match or wildcard
1417 arp_op: exact match or wildcard
1418 arp_spa: exact match or wildcard
1419 arp_tpa: exact match or wildcard
1420 arp_sha: exact match or wildcard
1421 arp_tha: exact match or wildcard
1422 tcp_src: exact match or wildcard
1423 tcp_dst: exact match or wildcard
1424 udp_src: exact match or wildcard
1425 udp_dst: exact match or wildcard
1426 sctp_src: exact match or wildcard
1427 sctp_dst: exact match or wildcard
1428 icmp_type: exact match or wildcard
1429 icmp_code: exact match or wildcard
1430 icmpv6_type: exact match or wildcard
1431 icmpv6_code: exact match or wildcard
1432 nd_target: exact match or wildcard
1433 nd_sll: exact match or wildcard
1434 nd_tll: exact match or wildcard"
1438 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-tables br0], [0], [expout])
1439 # Change the configuration.
1442 -- --id=@t0 create Flow_Table name=main \
1443 -- --id=@t1 create Flow_Table flow-limit=1024 \
1444 -- set bridge br0 'flow_tables={1=@t1,0=@t0}' \
1445 | ${PERL} $srcdir/uuidfilt.pl],
1449 # Check that the configuration was updated.
1450 mv expout orig-expout
1451 sed 's/classifier/main/
1452 53s/1000000/1024/' < orig-expout > expout
1453 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-tables br0], [0], [expout])
1457 AT_SETUP([ofproto - table features (OpenFlow 1.3)])
1461 while test $x -lt 254; do
1463 if test $x = 253; then
1468 if test $x = 252; then
1473 next tables: $y-253"
1476 echo " table $x (\"$name\"):
1477 metadata: match=0xffffffffffffffff write=0xffffffffffffffff
1479 instructions (table miss and others):$next
1480 instructions: meter,apply_actions,clear_actions,write_actions,write_metadata$goto
1481 Write-Actions and Apply-Actions features:
1482 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
1483 supported on Set-Field: tun_id tun_src tun_dst tun_gbp_id tun_gbp_flags 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 ipv6_label nw_tos ip_dscp nw_ecn nw_ttl arp_op arp_spa arp_tpa arp_sha arp_tha tcp_src tcp_dst udp_src udp_dst sctp_src sctp_dst nd_target nd_sll nd_tll
1485 dp_hash: arbitrary mask
1486 recirc_id: exact match or wildcard
1487 conj_id: exact match or wildcard
1488 tun_id: arbitrary mask
1489 tun_src: arbitrary mask
1490 tun_dst: arbitrary mask
1491 tun_gbp_id: arbitrary mask
1492 tun_gbp_flags: arbitrary mask
1493 metadata: arbitrary mask
1494 in_port: exact match or wildcard
1495 in_port_oxm: exact match or wildcard
1496 actset_output: exact match or wildcard
1497 pkt_mark: arbitrary mask
1498 reg0: arbitrary mask
1499 reg1: arbitrary mask
1500 reg2: arbitrary mask
1501 reg3: arbitrary mask
1502 reg4: arbitrary mask
1503 reg5: arbitrary mask
1504 reg6: arbitrary mask
1505 reg7: arbitrary mask
1506 xreg0: arbitrary mask
1507 xreg1: arbitrary mask
1508 xreg2: arbitrary mask
1509 xreg3: arbitrary mask
1510 eth_src: arbitrary mask
1511 eth_dst: arbitrary mask
1512 eth_type: exact match or wildcard
1513 vlan_tci: arbitrary mask
1514 vlan_vid: arbitrary mask
1515 vlan_pcp: exact match or wildcard
1516 mpls_label: exact match or wildcard
1517 mpls_tc: exact match or wildcard
1518 mpls_bos: exact match or wildcard
1519 ip_src: arbitrary mask
1520 ip_dst: arbitrary mask
1521 ipv6_src: arbitrary mask
1522 ipv6_dst: arbitrary mask
1523 ipv6_label: arbitrary mask
1524 nw_proto: exact match or wildcard
1525 nw_tos: exact match or wildcard
1526 ip_dscp: exact match or wildcard
1527 nw_ecn: exact match or wildcard
1528 nw_ttl: exact match or wildcard
1529 ip_frag: arbitrary mask
1530 arp_op: exact match or wildcard
1531 arp_spa: arbitrary mask
1532 arp_tpa: arbitrary mask
1533 arp_sha: arbitrary mask
1534 arp_tha: arbitrary mask
1535 tcp_src: arbitrary mask
1536 tcp_dst: arbitrary mask
1537 tcp_flags: arbitrary mask
1538 udp_src: arbitrary mask
1539 udp_dst: arbitrary mask
1540 sctp_src: arbitrary mask
1541 sctp_dst: arbitrary mask
1542 icmp_type: exact match or wildcard
1543 icmp_code: exact match or wildcard
1544 icmpv6_type: exact match or wildcard
1545 icmpv6_code: exact match or wildcard
1546 nd_target: arbitrary mask
1547 nd_sll: arbitrary mask
1548 nd_tll: arbitrary mask"
1552 AT_CHECK([ovs-ofctl -O OpenFlow13 dump-table-features br0 | sed '/^$/d
1553 /^OFPST_TABLE_FEATURES/d'], [0], [expout])
1554 # Change the configuration.
1557 -- --id=@t0 create Flow_Table name=main \
1558 -- --id=@t1 create Flow_Table flow-limit=1024 \
1559 -- set bridge br0 'flow_tables={1=@t1,0=@t0}' \
1560 | ${PERL} $srcdir/uuidfilt.pl],
1564 # Check that the configuration was updated.
1565 mv expout orig-expout
1566 sed 's/classifier/main/
1567 77s/1000000/1024/' < orig-expout > expout
1568 AT_CHECK([ovs-ofctl -O OpenFlow13 dump-table-features br0 | sed '/^$/d
1569 /^OFPST_TABLE_FEATURES/d'], [0], [expout])
1573 AT_SETUP([ofproto - hard limits on flow table size (OpenFlow 1.0)])
1575 # Configure a maximum of 4 flows.
1578 -- --id=@t0 create Flow_Table flow-limit=4 \
1579 -- set bridge br0 flow_tables:0=@t0 \
1580 | ${PERL} $srcdir/uuidfilt.pl],
1584 for in_port in 1 2 3 4; do
1585 ovs-ofctl add-flow br0 in_port=$in_port,actions=drop
1587 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1588 in_port=1 actions=drop
1589 in_port=2 actions=drop
1590 in_port=3 actions=drop
1591 in_port=4 actions=drop
1594 # Adding another flow will be refused.
1595 AT_CHECK([ovs-ofctl add-flow br0 in_port=5,actions=drop], [1], [], [stderr])
1596 AT_CHECK([head -n 1 stderr | ofctl_strip], [0],
1597 [OFPT_ERROR: OFPFMFC_TABLE_FULL
1599 # Also a mod-flow that would add a flow will be refused.
1600 AT_CHECK([ovs-ofctl mod-flows br0 in_port=5,actions=drop], [1], [], [stderr])
1601 AT_CHECK([head -n 1 stderr | ofctl_strip], [0],
1602 [OFPT_ERROR: OFPFMFC_TABLE_FULL
1604 # Replacing or modifying an existing flow is allowed.
1605 AT_CHECK([ovs-ofctl add-flow br0 in_port=4,actions=normal])
1606 AT_CHECK([ovs-ofctl mod-flows br0 in_port=3,actions=output:1])
1607 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1608 in_port=1 actions=drop
1609 in_port=2 actions=drop
1610 in_port=3 actions=output:1
1611 in_port=4 actions=NORMAL
1617 AT_SETUP([ofproto - hard limits on flow table size (OpenFlow 1.2)])
1619 # Configure a maximum of 4 flows.
1622 -- --id=@t0 create Flow_Table flow-limit=4 \
1623 -- set bridge br0 flow_tables:0=@t0 \
1624 | ${PERL} $srcdir/uuidfilt.pl],
1628 for in_port in 1 2 3 4; do
1629 ovs-ofctl -O OpenFlow12 add-flow br0 in_port=$in_port,actions=drop
1631 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1632 in_port=1 actions=drop
1633 in_port=2 actions=drop
1634 in_port=3 actions=drop
1635 in_port=4 actions=drop
1636 OFPST_FLOW reply (OF1.2):
1638 # Adding another flow will be refused.
1639 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 in_port=5,actions=drop], [1], [], [stderr])
1640 AT_CHECK([head -n 1 stderr | ofctl_strip], [0],
1641 [OFPT_ERROR (OF1.2): OFPFMFC_TABLE_FULL
1643 # Replacing or modifying an existing flow is allowed.
1644 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 in_port=4,actions=normal])
1645 AT_CHECK([ovs-ofctl -O OpenFlow12 mod-flows br0 in_port=3,actions=output:1])
1646 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1647 in_port=1 actions=drop
1648 in_port=2 actions=drop
1649 in_port=3 actions=output:1
1650 in_port=4 actions=NORMAL
1651 OFPST_FLOW reply (OF1.2):
1656 AT_SETUP([ofproto - eviction upon table overflow (OpenFlow 1.0)])
1658 # Configure a maximum of 4 flows.
1661 -- --id=@t0 create Flow_Table flow-limit=4 overflow-policy=evict \
1662 -- set bridge br0 flow_tables:0=@t0 \
1663 | ${PERL} $srcdir/uuidfilt.pl],
1667 for in_port in 4 3 2 1; do
1668 ovs-ofctl add-flow br0 idle_timeout=${in_port}0,in_port=$in_port,actions=drop
1670 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1671 idle_timeout=10, in_port=1 actions=drop
1672 idle_timeout=20, in_port=2 actions=drop
1673 idle_timeout=30, in_port=3 actions=drop
1674 idle_timeout=40, in_port=4 actions=drop
1677 # Adding another flow will cause the one that expires soonest to be evicted.
1678 AT_CHECK([ovs-ofctl add-flow br0 in_port=5,actions=drop])
1679 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1680 idle_timeout=20, in_port=2 actions=drop
1681 idle_timeout=30, in_port=3 actions=drop
1682 idle_timeout=40, in_port=4 actions=drop
1683 in_port=5 actions=drop
1686 # A mod-flow that adds a flow also causes eviction, but replacing or
1687 # modifying an existing flow doesn't.
1688 AT_CHECK([ovs-ofctl mod-flows br0 in_port=6,actions=drop])
1689 AT_CHECK([ovs-ofctl add-flow br0 in_port=4,actions=normal])
1690 AT_CHECK([ovs-ofctl mod-flows br0 in_port=3,actions=output:1])
1691 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1692 idle_timeout=30, in_port=3 actions=output:1
1693 in_port=4 actions=NORMAL
1694 in_port=5 actions=drop
1695 in_port=6 actions=drop
1698 # Flows with no timeouts at all cannot be evicted.
1699 AT_CHECK([ovs-ofctl add-flow br0 in_port=7,actions=normal])
1700 AT_CHECK([ovs-ofctl add-flow br0 in_port=8,actions=drop], [1], [], [stderr])
1701 AT_CHECK([head -n 1 stderr | ofctl_strip], [0],
1702 [OFPT_ERROR: OFPFMFC_TABLE_FULL
1704 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1705 in_port=4 actions=NORMAL
1706 in_port=5 actions=drop
1707 in_port=6 actions=drop
1708 in_port=7 actions=NORMAL
1714 AT_SETUP([ofproto - eviction upon table overflow (OpenFlow 1.2)])
1716 # Configure a maximum of 4 flows.
1719 -- --id=@t0 create Flow_Table flow-limit=4 overflow-policy=evict \
1720 -- set bridge br0 flow_tables:0=@t0 \
1721 | ${PERL} $srcdir/uuidfilt.pl],
1725 for in_port in 4 3 2 1; do
1726 ovs-ofctl -O OpenFlow12 add-flow br0 idle_timeout=${in_port}0,in_port=$in_port,actions=drop
1728 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1729 idle_timeout=10, in_port=1 actions=drop
1730 idle_timeout=20, in_port=2 actions=drop
1731 idle_timeout=30, in_port=3 actions=drop
1732 idle_timeout=40, in_port=4 actions=drop
1733 OFPST_FLOW reply (OF1.2):
1735 # Adding another flow will cause the one that expires soonest to be evicted.
1736 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 in_port=5,actions=drop])
1737 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1738 idle_timeout=20, in_port=2 actions=drop
1739 idle_timeout=30, in_port=3 actions=drop
1740 idle_timeout=40, in_port=4 actions=drop
1741 in_port=5 actions=drop
1742 OFPST_FLOW reply (OF1.2):
1744 # In OpenFlow 1.2 a mod-flow does not ever add a flow and thus
1745 # has no effect on eviction
1746 AT_CHECK([ovs-ofctl -O OpenFlow12 mod-flows br0 in_port=6,actions=drop])
1747 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 in_port=4,actions=normal])
1748 AT_CHECK([ovs-ofctl -O OpenFlow12 mod-flows br0 in_port=3,actions=output:1])
1749 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1750 idle_timeout=20, in_port=2 actions=drop
1751 idle_timeout=30, in_port=3 actions=output:1
1752 in_port=4 actions=NORMAL
1753 in_port=5 actions=drop
1754 OFPST_FLOW reply (OF1.2):
1756 # Flows with no timeouts at all cannot be evicted.
1757 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 in_port=6,actions=drop])
1758 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 in_port=7,actions=normal])
1759 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 in_port=8,actions=drop], [1], [], [stderr])
1760 AT_CHECK([head -n 1 stderr | ofctl_strip], [0],
1761 [OFPT_ERROR (OF1.2): OFPFMFC_TABLE_FULL
1763 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1764 in_port=4 actions=NORMAL
1765 in_port=5 actions=drop
1766 in_port=6 actions=drop
1767 in_port=7 actions=NORMAL
1768 OFPST_FLOW reply (OF1.2):
1773 AT_SETUP([ofproto - eviction upon table overflow, with fairness (OpenFlow 1.0)])
1775 # Configure a maximum of 4 flows.
1778 -- --id=@t0 create Flow_Table name=evict flow-limit=4 \
1779 overflow-policy=evict \
1780 groups='"NXM_OF_IN_PORT[[]]"' \
1781 -- set bridge br0 flow_tables:0=@t0 \
1782 | ${PERL} $srcdir/uuidfilt.pl],
1786 ovs-ofctl add-flows br0 - <<EOF
1787 idle_timeout=10 in_port=2 dl_src=00:44:55:66:77:88 actions=drop
1788 idle_timeout=20 in_port=1 dl_src=00:11:22:33:44:55 actions=drop
1789 idle_timeout=30 in_port=1 dl_src=00:22:33:44:55:66 actions=drop
1790 idle_timeout=40 in_port=1 dl_src=00:33:44:55:66:77 actions=drop
1792 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1793 idle_timeout=10, in_port=2,dl_src=00:44:55:66:77:88 actions=drop
1794 idle_timeout=20, in_port=1,dl_src=00:11:22:33:44:55 actions=drop
1795 idle_timeout=30, in_port=1,dl_src=00:22:33:44:55:66 actions=drop
1796 idle_timeout=40, in_port=1,dl_src=00:33:44:55:66:77 actions=drop
1799 # Adding another flow will cause the one that expires soonest within
1800 # the largest group (those with in_port=1) to be evicted. In this
1801 # case this is not the same as the one that expires soonest overall
1802 # (which is what makes the test interesting):
1803 AT_CHECK([ovs-ofctl add-flow br0 in_port=2,dl_src=00:55:66:77:88:99,actions=drop])
1804 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1805 idle_timeout=10, in_port=2,dl_src=00:44:55:66:77:88 actions=drop
1806 idle_timeout=30, in_port=1,dl_src=00:22:33:44:55:66 actions=drop
1807 idle_timeout=40, in_port=1,dl_src=00:33:44:55:66:77 actions=drop
1808 in_port=2,dl_src=00:55:66:77:88:99 actions=drop
1811 # Enlarge the flow limit, change the eviction policy back to strictly
1812 # based on expiration, and and add some flows.
1813 AT_CHECK([ovs-vsctl set Flow_Table evict groups='[[]]' flow-limit=7])
1814 ovs-ofctl add-flows br0 - <<EOF
1815 idle_timeout=50 in_port=2 dl_src=00:66:77:88:99:aa actions=drop
1816 idle_timeout=60 in_port=2 dl_src=00:77:88:99:aa:bb actions=drop
1817 idle_timeout=70 in_port=2 dl_src=00:88:99:aa:bb:cc actions=drop
1819 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1820 idle_timeout=10, in_port=2,dl_src=00:44:55:66:77:88 actions=drop
1821 idle_timeout=30, in_port=1,dl_src=00:22:33:44:55:66 actions=drop
1822 idle_timeout=40, in_port=1,dl_src=00:33:44:55:66:77 actions=drop
1823 idle_timeout=50, in_port=2,dl_src=00:66:77:88:99:aa actions=drop
1824 idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=drop
1825 idle_timeout=70, in_port=2,dl_src=00:88:99:aa:bb:cc actions=drop
1826 in_port=2,dl_src=00:55:66:77:88:99 actions=drop
1829 # Adding another flow will cause the one that expires soonest overall
1831 AT_CHECK([ovs-ofctl add-flow br0 'idle_timeout=80 in_port=2 dl_src=00:99:aa:bb:cc:dd actions=drop'])
1832 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1833 idle_timeout=30, in_port=1,dl_src=00:22:33:44:55:66 actions=drop
1834 idle_timeout=40, in_port=1,dl_src=00:33:44:55:66:77 actions=drop
1835 idle_timeout=50, in_port=2,dl_src=00:66:77:88:99:aa actions=drop
1836 idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=drop
1837 idle_timeout=70, in_port=2,dl_src=00:88:99:aa:bb:cc actions=drop
1838 idle_timeout=80, in_port=2,dl_src=00:99:aa:bb:cc:dd actions=drop
1839 in_port=2,dl_src=00:55:66:77:88:99 actions=drop
1842 # Reducing the flow limit also causes the flows that expire soonest
1843 # overall to be evicted.
1844 AT_CHECK([ovs-vsctl set Flow_Table evict flow-limit=4])
1845 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1846 idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=drop
1847 idle_timeout=70, in_port=2,dl_src=00:88:99:aa:bb:cc actions=drop
1848 idle_timeout=80, in_port=2,dl_src=00:99:aa:bb:cc:dd actions=drop
1849 in_port=2,dl_src=00:55:66:77:88:99 actions=drop
1855 AT_SETUP([ofproto - eviction upon table overflow, with fairness (OpenFlow 1.2)])
1857 # Configure a maximum of 4 flows.
1860 -- --id=@t0 create Flow_Table name=evict flow-limit=4 \
1861 overflow-policy=evict \
1862 groups='"NXM_OF_IN_PORT[[]]"' \
1863 -- set bridge br0 flow_tables:0=@t0 \
1864 | ${PERL} $srcdir/uuidfilt.pl],
1868 ovs-ofctl -O OpenFlow12 add-flows br0 - <<EOF
1869 idle_timeout=10 in_port=2 dl_src=00:44:55:66:77:88 actions=drop
1870 idle_timeout=20 in_port=1 dl_src=00:11:22:33:44:55 actions=drop
1871 idle_timeout=30 in_port=1 dl_src=00:22:33:44:55:66 actions=drop
1872 idle_timeout=40 in_port=1 dl_src=00:33:44:55:66:77 actions=drop
1874 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1875 idle_timeout=10, in_port=2,dl_src=00:44:55:66:77:88 actions=drop
1876 idle_timeout=20, in_port=1,dl_src=00:11:22:33:44:55 actions=drop
1877 idle_timeout=30, in_port=1,dl_src=00:22:33:44:55:66 actions=drop
1878 idle_timeout=40, in_port=1,dl_src=00:33:44:55:66:77 actions=drop
1879 OFPST_FLOW reply (OF1.2):
1881 # Adding another flow will cause the one that expires soonest within
1882 # the largest group (those with in_port=1) to be evicted. In this
1883 # case this is not the same as the one that expires soonest overall
1884 # (which is what makes the test interesting):
1885 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 in_port=2,dl_src=00:55:66:77:88:99,actions=drop])
1886 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1887 idle_timeout=10, in_port=2,dl_src=00:44:55:66:77:88 actions=drop
1888 idle_timeout=30, in_port=1,dl_src=00:22:33:44:55:66 actions=drop
1889 idle_timeout=40, in_port=1,dl_src=00:33:44:55:66:77 actions=drop
1890 in_port=2,dl_src=00:55:66:77:88:99 actions=drop
1891 OFPST_FLOW reply (OF1.2):
1893 # Enlarge the flow limit, change the eviction policy back to strictly
1894 # based on expiration, and and add some flows.
1895 AT_CHECK([ovs-vsctl set Flow_Table evict groups='[[]]' flow-limit=7])
1896 ovs-ofctl -O OpenFlow12 add-flows br0 - <<EOF
1897 idle_timeout=50 in_port=2 dl_src=00:66:77:88:99:aa actions=drop
1898 idle_timeout=60 in_port=2 dl_src=00:77:88:99:aa:bb actions=drop
1899 idle_timeout=70 in_port=2 dl_src=00:88:99:aa:bb:cc actions=drop
1901 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1902 idle_timeout=10, in_port=2,dl_src=00:44:55:66:77:88 actions=drop
1903 idle_timeout=30, in_port=1,dl_src=00:22:33:44:55:66 actions=drop
1904 idle_timeout=40, in_port=1,dl_src=00:33:44:55:66:77 actions=drop
1905 idle_timeout=50, in_port=2,dl_src=00:66:77:88:99:aa actions=drop
1906 idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=drop
1907 idle_timeout=70, in_port=2,dl_src=00:88:99:aa:bb:cc actions=drop
1908 in_port=2,dl_src=00:55:66:77:88:99 actions=drop
1909 OFPST_FLOW reply (OF1.2):
1911 # Adding another flow will cause the one that expires soonest overall
1913 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'])
1914 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1915 idle_timeout=30, in_port=1,dl_src=00:22:33:44:55:66 actions=drop
1916 idle_timeout=40, in_port=1,dl_src=00:33:44:55:66:77 actions=drop
1917 idle_timeout=50, in_port=2,dl_src=00:66:77:88:99:aa actions=drop
1918 idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=drop
1919 idle_timeout=70, in_port=2,dl_src=00:88:99:aa:bb:cc actions=drop
1920 idle_timeout=80, in_port=2,dl_src=00:99:aa:bb:cc:dd actions=drop
1921 in_port=2,dl_src=00:55:66:77:88:99 actions=drop
1922 OFPST_FLOW reply (OF1.2):
1924 # Reducing the flow limit also causes the flows that expire soonest
1925 # overall to be evicted.
1926 AT_CHECK([ovs-vsctl set Flow_Table evict flow-limit=4])
1927 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1928 idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=drop
1929 idle_timeout=70, in_port=2,dl_src=00:88:99:aa:bb:cc actions=drop
1930 idle_timeout=80, in_port=2,dl_src=00:99:aa:bb:cc:dd actions=drop
1931 in_port=2,dl_src=00:55:66:77:88:99 actions=drop
1932 OFPST_FLOW reply (OF1.2):
1937 AT_SETUP([ofproto - eviction upon table overflow, with modified hard timeout])
1939 # Configure a maximum of 4 flows.
1942 -- --id=@t0 create Flow_Table flow-limit=4 overflow-policy=evict \
1943 -- set bridge br0 flow_tables:0=@t0 \
1944 | ${PERL} $srcdir/uuidfilt.pl],
1947 ovs-appctl time/stop
1949 for in_port in 4 3 2 1; do
1950 ovs-ofctl add-flow br0 hard_timeout=$((10 + in_port * 3)),in_port=$in_port,actions=drop
1952 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1953 hard_timeout=13, in_port=1 actions=drop
1954 hard_timeout=16, in_port=2 actions=drop
1955 hard_timeout=19, in_port=3 actions=drop
1956 hard_timeout=22, in_port=4 actions=drop
1959 # Sleep and modify the one that expires soonest
1960 ovs-appctl time/warp 5000
1961 AT_CHECK([ovs-ofctl mod-flows br0 in_port=1,actions=drop])
1962 # At this point the table would looks like:
1963 # in_port seconds to expire
1968 ovs-appctl time/warp 2000
1969 # Adding another flow will cause the one that expires soonest to be evicted.
1970 AT_CHECK([ovs-ofctl add-flow br0 in_port=5,actions=drop])
1971 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1972 hard_timeout=13, in_port=1 actions=drop
1973 hard_timeout=19, in_port=3 actions=drop
1974 hard_timeout=22, in_port=4 actions=drop
1975 in_port=5 actions=drop
1981 AT_SETUP([ofproto - eviction upon table overflow, with modified idle timeout])
1982 OVS_VSWITCHD_START([add-port br0 p1 -- set interface p1 type=dummy ofport_request=1])
1983 # Configure a maximum of 4 flows.
1986 -- --id=@t0 create Flow_Table flow-limit=4 overflow-policy=evict \
1987 -- set bridge br0 flow_tables:0=@t0 \
1988 | ${PERL} $srcdir/uuidfilt.pl],
1992 for in_port in 4 3 2 1; do
1993 ovs-ofctl add-flow br0 idle_timeout=$((10 + in_port * 3)),in_port=$in_port,actions=drop
1995 ovs-appctl time/stop
1996 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1997 idle_timeout=13, in_port=1 actions=drop
1998 idle_timeout=16, in_port=2 actions=drop
1999 idle_timeout=19, in_port=3 actions=drop
2000 idle_timeout=22, in_port=4 actions=drop
2003 # Sleep and receive on the flow that expires soonest
2004 ovs-appctl time/warp 5000
2005 AT_CHECK([ovs-appctl netdev-dummy/receive p1 'in_port(1)'])
2006 # At this point the table would looks like:
2007 # in_port seconds to expire
2012 ovs-appctl time/warp 2000
2013 # Adding another flow will cause the one that expires soonest to be evicted.
2014 AT_CHECK([ovs-ofctl add-flow br0 in_port=5,actions=drop])
2015 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
2016 idle_timeout=19, in_port=3 actions=drop
2017 idle_timeout=22, in_port=4 actions=drop
2018 in_port=5 actions=drop
2019 n_packets=1, n_bytes=60, idle_timeout=13, in_port=1 actions=drop
2025 AT_SETUP([ofproto - asynchronous message control (OpenFlow 1.0)])
2027 AT_CHECK([ovs-ofctl -P openflow10 monitor br0 --detach --no-chdir --pidfile])
2029 printf '\n\n--- check_async %d ---\n\n\n' $1
2032 ovs-appctl -t ovs-ofctl ofctl/barrier
2033 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
2036 # OFPT_PACKET_IN, OFPR_ACTION (controller_id=0)
2037 ovs-ofctl -v packet-out br0 controller controller '0001020304050010203040501234'
2038 if test X"$1" = X"OFPR_ACTION"; then shift;
2039 echo >>expout "OFPT_PACKET_IN: total_len=14 in_port=CONTROLLER (via action) data_len=14 (unbuffered)
2040 vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1234"
2043 # OFPT_PACKET_IN, OFPR_NO_MATCH (controller_id=123)
2044 ovs-ofctl -v packet-out br0 controller 'controller(reason=no_match,id=123)' '0001020304050010203040501234'
2045 if test X"$1" = X"OFPR_NO_MATCH"; then shift;
2046 echo >>expout "OFPT_PACKET_IN: total_len=14 in_port=CONTROLLER (via no_match) data_len=14 (unbuffered)
2047 vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1234"
2050 # OFPT_PACKET_IN, OFPR_INVALID_TTL (controller_id=0)
2051 ovs-ofctl packet-out br0 controller dec_ttl '002583dfb4000026b98cb0f908004500003eb7e200000011339bac11370dac100002d7730035002b8f6d86fb0100000100000000000006626c702d7873066e696369726103636f6d00000f00'
2052 if test X"$1" = X"OFPR_INVALID_TTL"; then shift;
2053 echo >>expout "OFPT_PACKET_IN: total_len=76 in_port=CONTROLLER (via invalid_ttl) data_len=76 (unbuffered)
2054 udp,vlan_tci=0x0000,dl_src=00:26:b9:8c:b0:f9,dl_dst=00:25:83:df:b4:00,nw_src=172.17.55.13,nw_dst=172.16.0.2,nw_tos=0,nw_ecn=0,nw_ttl=0,tp_src=55155,tp_dst=53 udp_csum:8f6d"
2057 # OFPT_PORT_STATUS, OFPPR_ADD
2058 ovs-vsctl add-port br0 test -- set Interface test type=dummy ofport_request=1
2059 if test X"$1" = X"OFPPR_ADD"; then shift;
2060 echo >>expout "OFPT_PORT_STATUS: ADD: 1(test): addr:aa:55:aa:55:00:0x
2063 speed: 0 Mbps now, 0 Mbps max"
2066 # OFPT_PORT_STATUS, OFPPR_DELETE
2067 ovs-vsctl del-port br0 test
2068 if test X"$1" = X"OFPPR_DELETE"; then shift;
2069 echo >>expout "OFPT_PORT_STATUS: DEL: 1(test): addr:aa:55:aa:55:00:0x
2072 speed: 0 Mbps now, 0 Mbps max"
2075 # OFPT_FLOW_REMOVED, OFPRR_DELETE
2076 ovs-ofctl add-flow br0 send_flow_rem,actions=drop
2077 ovs-ofctl --strict del-flows br0 ''
2078 if test X"$1" = X"OFPRR_DELETE"; then shift;
2079 echo >>expout "OFPT_FLOW_REMOVED: reason=delete"
2081 AT_FAIL_IF([test X"$1" != X])
2083 ovs-appctl -t ovs-ofctl ofctl/barrier
2084 echo >>expout "OFPT_BARRIER_REPLY:"
2088 s/ (xid=0x[0-9a-fA-F]*)//
2090 s/00:0.$/00:0x/' < monitor.log]],
2094 # It's a service connection so initially there should be no async messages.
2097 # Set miss_send_len to 128, turning on packet-ins for our service connection.
2098 ovs-appctl -t ovs-ofctl ofctl/send 0109000c0123456700000080
2099 check_async 2 OFPR_ACTION OFPPR_ADD OFPPR_DELETE OFPRR_DELETE
2101 # Set miss_send_len to 128 and enable invalid_ttl.
2102 ovs-appctl -t ovs-ofctl ofctl/send 0109000c0123456700040080
2103 check_async 3 OFPR_ACTION OFPR_INVALID_TTL OFPPR_ADD OFPPR_DELETE OFPRR_DELETE
2105 # Become slave, which should disable everything except port status.
2106 ovs-appctl -t ovs-ofctl ofctl/send 0104001400000002000023200000000a00000002
2107 check_async 4 OFPPR_ADD OFPPR_DELETE
2109 # Use NXT_SET_ASYNC_CONFIG to enable a patchwork of asynchronous messages.
2110 ovs-appctl -t ovs-ofctl ofctl/send 01040028000000020000232000000013000000020000000500000005000000020000000200000005
2111 check_async 5 OFPR_INVALID_TTL OFPPR_DELETE OFPRR_DELETE
2113 # Set controller ID 123.
2114 ovs-appctl -t ovs-ofctl ofctl/send 01040018000000030000232000000014000000000000007b
2115 check_async 6 OFPR_NO_MATCH OFPPR_DELETE OFPRR_DELETE
2117 # Restore controller ID 0.
2118 ovs-appctl -t ovs-ofctl ofctl/send 010400180000000300002320000000140000000000000000
2121 ovs-appctl -t ovs-ofctl ofctl/send 0104001400000002000023200000000a00000001
2122 check_async 7 OFPR_ACTION OFPPR_ADD
2124 ovs-appctl -t ovs-ofctl exit
2128 AT_SETUP([ofproto - asynchronous message control (OpenFlow 1.2)])
2130 AT_CHECK([ovs-ofctl -O OpenFlow12 monitor br0 --detach --no-chdir --pidfile])
2132 printf '\n\n--- check_async %d ---\n\n\n' $1
2136 ovs-appctl -t ovs-ofctl ofctl/barrier
2137 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
2140 # OFPT_PACKET_IN, OFPR_ACTION (controller_id=0)
2141 ovs-ofctl -O OpenFlow12 -v packet-out br0 none controller '0001020304050010203040501234'
2142 if test X"$1" = X"OFPR_ACTION"; then shift;
2143 echo >>expout "OFPT_PACKET_IN (OF1.2): total_len=14 in_port=ANY (via action) data_len=14 (unbuffered)
2144 vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1234"
2147 # OFPT_PACKET_IN, OFPR_NO_MATCH (controller_id=123)
2148 ovs-ofctl -O OpenFlow12 -v packet-out br0 none 'controller(reason=no_match,id=123)' '0001020304050010203040501234'
2149 if test X"$1" = X"OFPR_NO_MATCH"; then shift;
2150 echo >>expout "OFPT_PACKET_IN (OF1.2): total_len=14 in_port=ANY (via no_match) data_len=14 (unbuffered)
2151 vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1234"
2154 # OFPT_PACKET_IN, OFPR_INVALID_TTL (controller_id=0)
2155 ovs-ofctl -O OpenFlow12 packet-out br0 none dec_ttl '002583dfb4000026b98cb0f908004500003eb7e200000011339bac11370dac100002d7730035002b8f6d86fb0100000100000000000006626c702d7873066e696369726103636f6d00000f00'
2156 if test X"$1" = X"OFPR_INVALID_TTL"; then shift;
2157 echo >>expout "OFPT_PACKET_IN (OF1.2): total_len=76 in_port=ANY (via invalid_ttl) data_len=76 (unbuffered)
2158 udp,vlan_tci=0x0000,dl_src=00:26:b9:8c:b0:f9,dl_dst=00:25:83:df:b4:00,nw_src=172.17.55.13,nw_dst=172.16.0.2,nw_tos=0,nw_ecn=0,nw_ttl=0,tp_src=55155,tp_dst=53 udp_csum:8f6d"
2161 # OFPT_PORT_STATUS, OFPPR_ADD
2162 ovs-vsctl add-port br0 test -- set Interface test type=dummy
2163 if test X"$1" = X"OFPPR_ADD"; then shift;
2164 echo >>expout "OFPT_PORT_STATUS (OF1.2): ADD: ${INDEX}(test): addr:aa:55:aa:55:00:0x
2167 speed: 0 Mbps now, 0 Mbps max"
2170 # OFPT_PORT_STATUS, OFPPR_DELETE
2171 ovs-vsctl del-port br0 test
2172 if test X"$1" = X"OFPPR_DELETE"; then shift;
2173 echo >>expout "OFPT_PORT_STATUS (OF1.2): DEL: ${INDEX}(test): addr:aa:55:aa:55:00:0x
2176 speed: 0 Mbps now, 0 Mbps max"
2179 # OFPT_FLOW_REMOVED, OFPRR_DELETE
2180 ovs-ofctl -O OpenFlow12 add-flow br0 send_flow_rem,actions=drop
2181 ovs-ofctl -O OpenFlow12 --strict del-flows br0 ''
2182 if test X"$1" = X"OFPRR_DELETE"; then shift;
2183 echo >>expout "OFPT_FLOW_REMOVED (OF1.2): reason=delete table_id=0"
2185 AT_FAIL_IF([test X"$1" != X])
2187 ovs-appctl -t ovs-ofctl ofctl/barrier
2188 echo >>expout "OFPT_BARRIER_REPLY (OF1.2):"
2192 s/ (xid=0x[0-9a-fA-F]*)//
2194 s/00:0.$/00:0x/' < monitor.log]],
2198 # It's a service connection so initially there should be no async messages.
2201 # Set miss_send_len to 128, turning on packet-ins for our service connection.
2202 ovs-appctl -t ovs-ofctl ofctl/send 0309000c0123456700000080
2203 check_async 2 OFPR_ACTION OFPPR_ADD OFPPR_DELETE OFPRR_DELETE
2205 # Set miss_send_len to 128 and enable invalid_ttl.
2206 ovs-appctl -t ovs-ofctl ofctl/send 0309000c0123456700040080
2207 check_async 3 OFPR_ACTION OFPR_INVALID_TTL OFPPR_ADD OFPPR_DELETE OFPRR_DELETE
2209 # Become slave (OF 1.2), which should disable everything except port status.
2210 ovs-appctl -t ovs-ofctl ofctl/send 031800180000000200000003000000000000000000000001
2211 check_async 4 OFPPR_ADD OFPPR_DELETE
2213 # Use NXT_SET_ASYNC_CONFIG to enable a patchwork of asynchronous messages.
2214 ovs-appctl -t ovs-ofctl ofctl/send 03040028000000020000232000000013000000020000000500000005000000020000000200000005
2215 check_async 5 OFPR_INVALID_TTL OFPPR_DELETE OFPRR_DELETE
2217 # Set controller ID 123.
2218 ovs-appctl -t ovs-ofctl ofctl/send 03040018000000030000232000000014000000000000007b
2219 check_async 6 OFPR_NO_MATCH OFPPR_DELETE OFPRR_DELETE
2221 # Restore controller ID 0.
2222 ovs-appctl -t ovs-ofctl ofctl/send 030400180000000300002320000000140000000000000000
2224 # Become master (OF 1.2).
2225 ovs-appctl -t ovs-ofctl ofctl/send 031800180000000400000002000000000000000000000002
2226 check_async 7 OFPR_ACTION OFPPR_ADD
2228 ovs-appctl -t ovs-ofctl exit
2232 AT_SETUP([ofproto - asynchronous message control (OpenFlow 1.3)])
2234 AT_CHECK([ovs-ofctl -O OpenFlow13 monitor br0 --detach --no-chdir --pidfile])
2236 printf '\n\n--- check_async %d ---\n\n\n' $1
2240 ovs-appctl -t ovs-ofctl ofctl/barrier
2241 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
2244 # OFPT_PACKET_IN, OFPR_ACTION (controller_id=0)
2245 ovs-ofctl -O OpenFlow13 -v packet-out br0 none controller '0001020304050010203040501234'
2246 if test X"$1" = X"OFPR_ACTION"; then shift;
2247 echo >>expout "OFPT_PACKET_IN (OF1.3): total_len=14 in_port=ANY (via action) data_len=14 (unbuffered)
2248 vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1234"
2251 # OFPT_PACKET_IN, OFPR_NO_MATCH (controller_id=123)
2252 ovs-ofctl -O OpenFlow13 -v packet-out br0 none 'controller(reason=no_match,id=123)' '0001020304050010203040501234'
2253 if test X"$1" = X"OFPR_NO_MATCH"; then shift;
2254 echo >>expout "OFPT_PACKET_IN (OF1.3): total_len=14 in_port=ANY (via no_match) data_len=14 (unbuffered)
2255 vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1234"
2258 # OFPT_PACKET_IN, OFPR_INVALID_TTL (controller_id=0)
2259 ovs-ofctl -O OpenFlow13 packet-out br0 none dec_ttl '002583dfb4000026b98cb0f908004500003eb7e200000011339bac11370dac100002d7730035002b8f6d86fb0100000100000000000006626c702d7873066e696369726103636f6d00000f00'
2260 if test X"$1" = X"OFPR_INVALID_TTL"; then shift;
2261 echo >>expout "OFPT_PACKET_IN (OF1.3): total_len=76 in_port=ANY (via invalid_ttl) data_len=76 (unbuffered)
2262 udp,vlan_tci=0x0000,dl_src=00:26:b9:8c:b0:f9,dl_dst=00:25:83:df:b4:00,nw_src=172.17.55.13,nw_dst=172.16.0.2,nw_tos=0,nw_ecn=0,nw_ttl=0,tp_src=55155,tp_dst=53 udp_csum:8f6d"
2265 # OFPT_PORT_STATUS, OFPPR_ADD
2266 ovs-vsctl add-port br0 test -- set Interface test type=dummy
2267 if test X"$1" = X"OFPPR_ADD"; then shift;
2268 echo >>expout "OFPT_PORT_STATUS (OF1.3): ADD: ${INDEX}(test): addr:aa:55:aa:55:00:0x
2271 speed: 0 Mbps now, 0 Mbps max"
2274 # OFPT_PORT_STATUS, OFPPR_DELETE
2275 ovs-vsctl del-port br0 test
2276 if test X"$1" = X"OFPPR_DELETE"; then shift;
2277 echo >>expout "OFPT_PORT_STATUS (OF1.3): DEL: ${INDEX}(test): addr:aa:55:aa:55:00:0x
2280 speed: 0 Mbps now, 0 Mbps max"
2283 # OFPT_FLOW_REMOVED, OFPRR_DELETE
2284 ovs-ofctl -O OpenFlow13 add-flow br0 send_flow_rem,actions=drop
2285 ovs-ofctl -O OpenFlow13 --strict del-flows br0 ''
2286 if test X"$1" = X"OFPRR_DELETE"; then shift;
2287 echo >>expout "OFPT_FLOW_REMOVED (OF1.3): reason=delete table_id=0"
2290 # OFPT_FLOW_REMOVED, OFPRR_GROUP_DELETE
2291 ovs-ofctl -O OpenFlow13 add-group br0 group_id=1234,type=all,bucket=output:10
2292 ovs-ofctl -O OpenFlow13 add-flow br0 send_flow_rem,actions=group:1234
2293 ovs-ofctl -O OpenFlow13 --strict del-groups br0 group_id=1234
2294 if test X"$1" = X"OFPRR_DELETE"; then shift;
2295 echo >>expout "OFPT_FLOW_REMOVED (OF1.3): reason=gropu_delete table_id=0"
2298 AT_FAIL_IF([test X"$1" != X])
2300 ovs-appctl -t ovs-ofctl ofctl/barrier
2301 echo >>expout "OFPT_BARRIER_REPLY (OF1.3):"
2305 s/ (xid=0x[0-9a-fA-F]*)//
2307 s/00:0.$/00:0x/' < monitor.log]],
2311 # It's a service connection so initially there should be no async messages.
2314 # Set miss_send_len to 128, turning on packet-ins for our service connection.
2315 ovs-appctl -t ovs-ofctl ofctl/send 0409000c0123456700000080
2316 check_async 2 OFPR_ACTION OFPPR_ADD OFPPR_DELETE OFPRR_DELETE
2318 # Become slave (OF 1.3), which should disable everything except port status.
2319 ovs-appctl -t ovs-ofctl ofctl/send 041800180000000200000003000000000000000000000001
2320 check_async 3 OFPPR_ADD OFPPR_DELETE
2322 # Use OF 1.3 OFPT_SET_ASYNC to enable a patchwork of asynchronous messages.
2323 ovs-appctl -t ovs-ofctl ofctl/send 041c002000000002000000020000000500000005000000020000000200000005
2324 check_async 4 OFPR_INVALID_TTL OFPPR_DELETE OFPRR_DELETE
2326 # Set controller ID 123.
2327 ovs-appctl -t ovs-ofctl ofctl/send 04040018000000030000232000000014000000000000007b
2328 check_async 5 OFPR_NO_MATCH OFPPR_DELETE OFPRR_DELETE
2330 # Restore controller ID 0.
2331 ovs-appctl -t ovs-ofctl ofctl/send 040400180000000300002320000000140000000000000000
2333 # Become master (OF 1.3).
2334 ovs-appctl -t ovs-ofctl ofctl/send 041800180000000400000002000000000000000000000002
2335 check_async 6 OFPR_ACTION OFPPR_ADD
2337 ovs-appctl -t ovs-ofctl exit
2341 AT_SETUP([ofproto - asynchronous message control (OpenFlow 1.5)])
2343 AT_CHECK([ovs-ofctl -O OpenFlow15 monitor br0 --detach --no-chdir --pidfile])
2345 printf '\n\n--- check_async %d ---\n\n\n' $1
2349 ovs-appctl -t ovs-ofctl ofctl/barrier
2350 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
2353 # Other tests are not working with OF 1.5, and message
2354 # format may change, so leave them out.
2356 # OFPT_PORT_STATUS, OFPPR_ADD
2357 ovs-vsctl add-port br0 test -- set Interface test type=dummy
2358 if test X"$1" = X"OFPPR_ADD"; then shift;
2359 echo >>expout "OFPT_PORT_STATUS (OF1.5): ADD: ${INDEX}(test): addr:aa:55:aa:55:00:0x
2362 speed: 0 Mbps now, 0 Mbps max"
2365 # OFPT_PORT_STATUS, OFPPR_MODIFY
2366 ovs-ofctl -O OpenFlow15 -vwarn mod-port br0 test up
2367 if test X"$1" = X"OFPPR_MODIFY"; then shift;
2368 echo >>expout "OFPT_PORT_STATUS (OF1.5): MOD: ${INDEX}(test): addr:aa:55:aa:55:00:0x
2371 speed: 0 Mbps now, 0 Mbps max
2372 OFPT_PORT_STATUS (OF1.5): MOD: 2(test): addr:aa:55:aa:55:00:0x
2375 speed: 0 Mbps now, 0 Mbps max"
2378 # OFPT_PORT_STATUS, OFPPR_DELETE
2379 ovs-vsctl del-port br0 test
2380 if test X"$1" = X"OFPPR_DELETE"; then shift;
2381 echo >>expout "OFPT_PORT_STATUS (OF1.5): DEL: ${INDEX}(test): addr:aa:55:aa:55:00:0x
2384 speed: 0 Mbps now, 0 Mbps max"
2387 AT_FAIL_IF([test X"$1" != X])
2389 ovs-appctl -t ovs-ofctl ofctl/barrier
2390 echo >>expout "OFPT_BARRIER_REPLY (OF1.5):"
2394 s/ (xid=0x[0-9a-fA-F]*)//
2396 s/00:0.$/00:0x/' < monitor.log]],
2400 # It's a service connection so initially there should be no async messages.
2403 # If we don't set this, async messages are not received.
2404 # Set miss_send_len to 128, turning on packet-ins for our service connection.
2405 ovs-appctl -t ovs-ofctl ofctl/send 0609000c0123456700000080
2406 check_async 2 OFPPR_ADD OFPPR_MODIFY OFPPR_DELETE
2408 # Set-async has changed in OF 1.4 and is not yet implemented.
2410 ovs-appctl -t ovs-ofctl exit
2414 dnl This test checks that the role request/response messaging works
2415 dnl and that generation_id is handled properly.
2416 AT_SETUP([ofproto - controller role (OpenFlow 1.2)])
2418 ON_EXIT([kill `cat c1.pid c2.pid`])
2420 # Start two ovs-ofctl controller processes.
2421 AT_CAPTURE_FILE([monitor1.log])
2422 AT_CAPTURE_FILE([expout1])
2423 AT_CAPTURE_FILE([experr1])
2424 AT_CAPTURE_FILE([monitor2.log])
2425 AT_CAPTURE_FILE([expout2])
2426 AT_CAPTURE_FILE([experr2])
2428 AT_CHECK([ovs-ofctl -O OpenFlow12 monitor br0 --detach --no-chdir --pidfile=`pwd`/c$i.pid --unixctl=`pwd`/c$i])
2429 ovs-appctl -t `pwd`/c$i ofctl/barrier
2430 ovs-appctl -t `pwd`/c$i ofctl/set-output-file monitor$i.log
2434 # find out current role
2435 ovs-appctl -t `pwd`/c$i ofctl/send 031800180000000200000000000000000000000000000000
2436 echo >>experr$i "send: OFPT_ROLE_REQUEST (OF1.2): role=nochange"
2437 echo >>expout$i "OFPT_ROLE_REPLY (OF1.2): role=equal"
2440 # controller 1: Become slave (generation_id is initially undefined, so
2441 # 2^63+2 should not be stale)
2442 ovs-appctl -t `pwd`/c1 ofctl/send 031800180000000300000003000000008000000000000002
2443 echo >>experr1 "send: OFPT_ROLE_REQUEST (OF1.2): role=slave generation_id=9223372036854775810"
2444 echo >>expout1 "OFPT_ROLE_REPLY (OF1.2): role=slave generation_id=9223372036854775810"
2446 # controller 2: Become master.
2447 ovs-appctl -t `pwd`/c2 ofctl/send 031800180000000300000002000000008000000000000003
2448 echo >>experr2 "send: OFPT_ROLE_REQUEST (OF1.2): role=master generation_id=9223372036854775811"
2449 echo >>expout2 "OFPT_ROLE_REPLY (OF1.2): role=master generation_id=9223372036854775811"
2451 # controller 1: Try to become the master using a stale generation ID
2452 ovs-appctl -t `pwd`/c1 ofctl/send 031800180000000400000002000000000000000000000003
2453 echo >>experr1 "send: OFPT_ROLE_REQUEST (OF1.2): role=master generation_id=3"
2454 echo >>expout1 "OFPT_ERROR (OF1.2): OFPRRFC_STALE"
2455 echo >>expout1 "OFPT_ROLE_REQUEST (OF1.2): role=master generation_id=3"
2457 # controller 1: Become master using a valid generation ID
2458 ovs-appctl -t `pwd`/c1 ofctl/send 031800180000000500000002000000000000000000000001
2459 echo >>experr1 "send: OFPT_ROLE_REQUEST (OF1.2): role=master generation_id=1"
2460 echo >>expout1 "OFPT_ROLE_REPLY (OF1.2): role=master generation_id=1"
2463 ovs-appctl -t `pwd`/c$i ofctl/barrier
2464 echo >>expout$i "OFPT_BARRIER_REPLY (OF1.2):"
2470 AT_CHECK([grep -v '^send:' monitor$i.log | STRIP_XIDS], [0], [expout])
2472 AT_CHECK([grep '^send:' monitor$i.log | STRIP_XIDS], [0], [expout])
2477 dnl This test checks that the role request/response messaging works,
2478 dnl that generation_id is handled properly, and that role status update
2479 dnl messages are sent when a controller's role gets changed from master
2481 AT_SETUP([ofproto - controller role (OpenFlow 1.4)])
2483 ON_EXIT([kill `cat c1.pid c2.pid`])
2485 # Start two ovs-ofctl controller processes.
2486 AT_CAPTURE_FILE([monitor1.log])
2487 AT_CAPTURE_FILE([expout1])
2488 AT_CAPTURE_FILE([experr1])
2489 AT_CAPTURE_FILE([monitor2.log])
2490 AT_CAPTURE_FILE([expout2])
2491 AT_CAPTURE_FILE([experr2])
2493 AT_CHECK([ovs-ofctl -O OpenFlow14 monitor br0 --detach --no-chdir --pidfile=`pwd`/c$i.pid --unixctl=`pwd`/c$i])
2494 ovs-appctl -t `pwd`/c$i ofctl/barrier
2495 ovs-appctl -t `pwd`/c$i ofctl/set-output-file monitor$i.log
2499 # find out current role
2500 ovs-appctl -t `pwd`/c$i ofctl/send 051800180000000200000000000000000000000000000000
2501 echo >>experr$i "send: OFPT_ROLE_REQUEST (OF1.4): role=nochange"
2502 echo >>expout$i "OFPT_ROLE_REPLY (OF1.4): role=equal"
2505 # controller 1: Become slave (generation_id is initially undefined, so
2506 # 2^63+2 should not be stale)
2507 ovs-appctl -t `pwd`/c1 ofctl/send 051800180000000300000003000000008000000000000002
2508 echo >>experr1 "send: OFPT_ROLE_REQUEST (OF1.4): role=slave generation_id=9223372036854775810"
2509 echo >>expout1 "OFPT_ROLE_REPLY (OF1.4): role=slave generation_id=9223372036854775810"
2511 # controller 2: Become master.
2512 ovs-appctl -t `pwd`/c2 ofctl/send 051800180000000300000002000000008000000000000003
2513 echo >>experr2 "send: OFPT_ROLE_REQUEST (OF1.4): role=master generation_id=9223372036854775811"
2514 echo >>expout2 "OFPT_ROLE_REPLY (OF1.4): role=master generation_id=9223372036854775811"
2516 # controller 1: Try to become the master using a stale generation ID
2517 ovs-appctl -t `pwd`/c1 ofctl/send 051800180000000400000002000000000000000000000003
2518 echo >>experr1 "send: OFPT_ROLE_REQUEST (OF1.4): role=master generation_id=3"
2519 echo >>expout1 "OFPT_ERROR (OF1.4): OFPRRFC_STALE"
2520 echo >>expout1 "OFPT_ROLE_REQUEST (OF1.4): role=master generation_id=3"
2522 # controller 1: Become master using a valid generation ID
2523 ovs-appctl -t `pwd`/c1 ofctl/send 051800180000000500000002000000000000000000000001
2524 echo >>experr1 "send: OFPT_ROLE_REQUEST (OF1.4): role=master generation_id=1"
2525 echo >>expout1 "OFPT_ROLE_REPLY (OF1.4): role=master generation_id=1"
2526 echo >>expout2 "OFPT_ROLE_STATUS (OF1.4): role=slave generation_id=1 reason=master_request"
2529 ovs-appctl -t `pwd`/c$i ofctl/barrier
2530 echo >>expout$i "OFPT_BARRIER_REPLY (OF1.4):"
2536 AT_CHECK([grep -v '^send:' monitor$i.log | STRIP_XIDS], [0], [expout])
2538 AT_CHECK([grep '^send:' monitor$i.log | STRIP_XIDS], [0], [expout])
2543 dnl This test checks that OFPT_PACKET_OUT accepts both OFPP_NONE (as
2544 dnl specified by OpenFlow 1.0) and OFPP_CONTROLLER (used by some
2545 dnl controllers despite the spec) as meaning a packet that was generated
2546 dnl by the controller.
2547 AT_SETUP([ofproto - packet-out from controller (OpenFlow 1.0)])
2549 ADD_OF_PORTS([br0], [1])
2551 # Start a monitor listening for packet-ins.
2552 AT_CHECK([ovs-ofctl -P openflow10 monitor br0 --detach --no-chdir --pidfile])
2553 ovs-appctl -t ovs-ofctl ofctl/send 0109000c0123456700000080
2554 ovs-appctl -t ovs-ofctl ofctl/barrier
2555 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
2556 AT_CAPTURE_FILE([monitor.log])
2558 # Send some packet-outs with OFPP_NONE and OFPP_CONTROLLER (65533) as in_port.
2559 AT_CHECK([ovs-ofctl packet-out br0 none controller,1 '0001020304050010203040501234'])
2560 AT_CHECK([ovs-ofctl packet-out br0 controller controller,1 '0001020304050010203040505678'])
2562 # Stop the monitor and check its output.
2563 ovs-appctl -t ovs-ofctl ofctl/barrier
2564 ovs-appctl -t ovs-ofctl exit
2566 ovs-ofctl dump-ports br0
2568 AT_CHECK([sed 's/ (xid=0x[[0-9a-fA-F]]*)//' monitor.log], [0], [dnl
2569 OFPT_PACKET_IN: total_len=14 in_port=ANY (via action) data_len=14 (unbuffered)
2570 vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1234
2571 OFPT_PACKET_IN: total_len=14 in_port=CONTROLLER (via action) data_len=14 (unbuffered)
2572 vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x5678
2579 dnl This test checks that OFPT_PACKET_OUT accepts both OFPP_NONE (as
2580 dnl specified by OpenFlow 1.2) and OFPP_CONTROLLER (used by some
2581 dnl controllers despite the spec) as meaning a packet that was generated
2582 dnl by the controller.
2583 AT_SETUP([ofproto - packet-out from controller (OpenFlow 1.2)])
2586 # Start a monitor listening for packet-ins.
2587 AT_CHECK([ovs-ofctl -O OpenFlow12 monitor br0 --detach --no-chdir --pidfile])
2588 ovs-appctl -t ovs-ofctl ofctl/send 0309000c0123456700000080
2589 ovs-appctl -t ovs-ofctl ofctl/barrier
2590 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
2591 AT_CAPTURE_FILE([monitor.log])
2593 # Send some packet-outs with OFPP_NONE and OFPP_CONTROLLER (65533) as in_port.
2594 AT_CHECK([ovs-ofctl -O OpenFlow12 packet-out br0 none controller '0001020304050010203040501234'])
2595 AT_CHECK([ovs-ofctl -O OpenFlow12 packet-out br0 4294967293 controller '0001020304050010203040505678'])
2597 # Stop the monitor and check its output.
2598 ovs-appctl -t ovs-ofctl ofctl/barrier
2599 ovs-appctl -t ovs-ofctl exit
2601 AT_CHECK([sed 's/ (xid=0x[[0-9a-fA-F]]*)//' monitor.log], [0], [dnl
2602 OFPT_PACKET_IN (OF1.2): total_len=14 in_port=ANY (via action) data_len=14 (unbuffered)
2603 vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1234
2604 OFPT_PACKET_IN (OF1.2): total_len=14 in_port=CONTROLLER (via action) data_len=14 (unbuffered)
2605 vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x5678
2606 OFPT_BARRIER_REPLY (OF1.2):
2612 dnl This test checks that OFPT_PACKET_OUT accepts both OFPP_NONE (as
2613 dnl specified by OpenFlow 1.1) and OFPP_CONTROLLER (used by some
2614 dnl controllers despite the spec) as meaning a packet that was generated
2615 dnl by the controller.
2616 AT_SETUP([ofproto - packet-out from controller (OpenFlow 1.1)])
2619 # Start a monitor listening for packet-ins.
2620 AT_CHECK([ovs-ofctl -O OpenFlow11 monitor br0 --detach --no-chdir --pidfile])
2621 ovs-appctl -t ovs-ofctl ofctl/send 0209000c0123456700000080
2622 ovs-appctl -t ovs-ofctl ofctl/barrier
2623 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
2624 AT_CAPTURE_FILE([monitor.log])
2626 # Send some packet-outs with OFPP_NONE and OFPP_CONTROLLER (65533) as in_port.
2627 AT_CHECK([ovs-ofctl -O OpenFlow11 packet-out br0 none controller '0001020304050010203040501234'])
2628 AT_CHECK([ovs-ofctl -O OpenFlow11 packet-out br0 4294967293 controller '0001020304050010203040505678'])
2630 # Stop the monitor and check its output.
2631 ovs-appctl -t ovs-ofctl ofctl/barrier
2632 ovs-appctl -t ovs-ofctl exit
2634 AT_CHECK([sed 's/ (xid=0x[[0-9a-fA-F]]*)//' monitor.log], [0], [dnl
2635 OFPT_PACKET_IN (OF1.1): total_len=14 in_port=ANY (via action) data_len=14 (unbuffered)
2636 vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1234
2637 OFPT_PACKET_IN (OF1.1): total_len=14 in_port=CONTROLLER (via action) data_len=14 (unbuffered)
2638 vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x5678
2639 OFPT_BARRIER_REPLY (OF1.1):
2645 dnl This test checks that metadata is encoded in packet_in structures,
2646 dnl supported by NXAST.
2647 AT_SETUP([ofproto - packet-out with metadata (NXM)])
2650 # Start a monitor listening for packet-ins.
2651 AT_CHECK([ovs-ofctl -P nxm monitor br0 --detach --no-chdir --pidfile])
2652 ovs-appctl -t ovs-ofctl ofctl/send 0109000c0123456700000080
2653 ovs-appctl -t ovs-ofctl ofctl/barrier
2654 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
2655 AT_CAPTURE_FILE([monitor.log])
2657 # Send a packet-out with a load action to set some metadata, and forward to controller
2658 AT_CHECK([ovs-ofctl packet-out br0 controller 'load(0xfafafafa5a5a5a5a->OXM_OF_METADATA[[0..63]]), load(0xaa->NXM_NX_PKT_MARK[[]]), controller' '0001020304050010203040501234'])
2660 # Stop the monitor and check its output.
2661 ovs-appctl -t ovs-ofctl ofctl/barrier
2662 ovs-appctl -t ovs-ofctl exit
2664 AT_CHECK([sed 's/ (xid=0x[[0-9a-fA-F]]*)//' monitor.log], [0], [dnl
2665 NXT_PACKET_IN: total_len=14 in_port=CONTROLLER metadata=0xfafafafa5a5a5a5a pkt_mark=0xaa (via action) data_len=14 (unbuffered)
2666 vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1234
2673 dnl This test checks that metadata is encoded in packet_in structures,
2674 dnl supported by NXAST.
2675 AT_SETUP([ofproto - packet-out with metadata (OpenFlow 1.2)])
2678 # Start a monitor listening for packet-ins.
2679 AT_CHECK([ovs-ofctl -O OpenFlow12 monitor br0 --detach --no-chdir --pidfile])
2680 ovs-appctl -t ovs-ofctl ofctl/send 0309000c0123456700000080
2681 ovs-appctl -t ovs-ofctl ofctl/barrier
2682 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
2683 AT_CAPTURE_FILE([monitor.log])
2685 # Send a packet-out with a set-field action to set some metadata, and forward to controller
2686 AT_CHECK([ovs-ofctl -O OpenFlow12 packet-out br0 none 'set_field:0xfafafafa5a5a5a5a->metadata, controller' '0001020304050010203040501234'])
2688 # Stop the monitor and check its output.
2689 ovs-appctl -t ovs-ofctl ofctl/barrier
2690 ovs-appctl -t ovs-ofctl exit
2692 AT_CHECK([sed 's/ (xid=0x[[0-9a-fA-F]]*)//' monitor.log], [0], [dnl
2693 OFPT_PACKET_IN (OF1.2): total_len=14 in_port=ANY metadata=0xfafafafa5a5a5a5a (via action) data_len=14 (unbuffered)
2694 vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1234
2695 OFPT_BARRIER_REPLY (OF1.2):
2701 dnl This test checks that metadata is encoded in packet_in structures,
2702 dnl supported by NXAST.
2703 AT_SETUP([ofproto - packet-out with metadata and dual set_field (OpenFlow 1.3)])
2706 # Start a monitor listening for packet-ins.
2707 AT_CHECK([ovs-ofctl -O OpenFlow13 monitor br0 --detach --no-chdir --pidfile])
2708 ovs-appctl -t ovs-ofctl ofctl/send 0409000c0123456700000080
2709 ovs-appctl -t ovs-ofctl ofctl/barrier
2710 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
2711 AT_CAPTURE_FILE([monitor.log])
2713 # Send a packet-out with a couple of set-field action to set some metadata, and forward to controller
2714 AT_CHECK([ovs-ofctl -O OpenFlow13 packet-out br0 none 'set_field:0xfafafafa5a5a5a5a->metadata, set_field:0x6b->metadata, controller' '0001020304050010203040501234'])
2716 # Stop the monitor and check its output.
2717 ovs-appctl -t ovs-ofctl ofctl/barrier
2718 ovs-appctl -t ovs-ofctl exit
2720 AT_CHECK([sed 's/ (xid=0x[[0-9a-fA-F]]*)//' monitor.log], [0], [dnl
2721 OFPT_PACKET_IN (OF1.3): total_len=14 in_port=ANY metadata=0x6b (via action) data_len=14 (unbuffered)
2722 vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1234
2723 OFPT_BARRIER_REPLY (OF1.3):
2729 dnl This test checks that tunnel metadata is encoded in packet_in structures.
2730 AT_SETUP([ofproto - packet-out with tunnel metadata (OpenFlow 1.2)])
2733 # Start a monitor listening for packet-ins.
2734 AT_CHECK([ovs-ofctl -O OpenFlow12 monitor br0 --detach --no-chdir --pidfile])
2735 ovs-appctl -t ovs-ofctl ofctl/send 0309000c0123456700000080
2736 ovs-appctl -t ovs-ofctl ofctl/barrier
2737 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
2738 AT_CAPTURE_FILE([monitor.log])
2740 # Send a packet-out with set field actions to set some tunnel metadata, and forward to controller
2741 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'])
2743 # Stop the monitor and check its output.
2744 ovs-appctl -t ovs-ofctl ofctl/barrier
2745 ovs-appctl -t ovs-ofctl exit
2747 AT_CHECK([sed 's/ (xid=0x[[0-9a-fA-F]]*)//' monitor.log], [0], [dnl
2748 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)
2749 vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1234
2750 OFPT_BARRIER_REPLY (OF1.2):
2756 m4_divert_push([PREPARE_TESTS])
2757 # Sorts groups of lines that start with a space, without moving them
2758 # past the nearest line that does not start with a space.
2768 print $_ foreach sort(@buffer);
2773 print $_ foreach sort(@buffer);
2776 m4_divert_pop([PREPARE_TESTS])
2778 AT_SETUP([ofproto - flow monitoring])
2779 AT_KEYWORDS([monitor])
2782 ovs-ofctl add-flow br0 in_port=0,dl_vlan=123,actions=output:1
2784 # Start a monitor watching the flow table and check the initial reply.
2785 ovs-ofctl monitor br0 watch: --detach --no-chdir --pidfile >monitor.log 2>&1
2786 AT_CAPTURE_FILE([monitor.log])
2787 ovs-appctl -t ovs-ofctl ofctl/barrier
2788 AT_CHECK([sed 's/ (xid=0x[[1-9a-fA-F]][[0-9a-fA-F]]*)//' monitor.log], [0],
2789 [NXST_FLOW_MONITOR reply:
2790 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=123 actions=output:1
2794 # Add, delete, and modify some flows and check the updates.
2795 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
2796 ovs-ofctl add-flow br0 in_port=0,dl_vlan=124,actions=output:2
2797 ovs-ofctl add-flow br0 in_port=0,dl_vlan=123,actions=output:5
2798 ovs-ofctl add-flow br0 in_port=0,dl_vlan=123,dl_vlan_pcp=0,actions=output:6
2799 ovs-ofctl add-flow br0 in_port=0,dl_vlan=123,dl_vlan_pcp=1,actions=output:7
2800 ovs-ofctl add-flow br0 in_port=0,dl_vlan=123,actions=output:8
2801 ovs-ofctl add-flow br0 in_port=0,dl_vlan=65535,dl_vlan_pcp=0,actions=output:9
2802 ovs-ofctl add-flow br0 in_port=0,dl_vlan=65535,dl_vlan_pcp=1,actions=output:10
2803 ovs-ofctl add-flow br0 in_port=0,dl_vlan=65535,actions=output:11
2804 ovs-ofctl add-flow br0 in_port=0,dl_vlan=8191,dl_vlan_pcp=0,actions=output:12
2805 ovs-ofctl add-flow br0 in_port=0,dl_vlan=8191,dl_vlan_pcp=1,actions=output:13
2806 ovs-ofctl add-flow br0 in_port=0,dl_vlan=8191,actions=output:14
2807 ovs-ofctl add-flow br0 in_port=0,dl_vlan=0,dl_vlan_pcp=0,actions=output:15
2808 ovs-ofctl add-flow br0 in_port=0,dl_vlan=0,dl_vlan_pcp=1,actions=output:16
2809 ovs-ofctl add-flow br0 in_port=0,dl_vlan=0,actions=output:17
2810 ovs-ofctl add-flow br0 in_port=0,dl_vlan=0,dl_vlan_pcp=0,actions=output:18
2811 ovs-ofctl add-flow br0 in_port=0,dl_vlan=0,dl_vlan_pcp=1,actions=output:19
2812 ovs-ofctl add-flow br0 in_port=0,dl_vlan=0,actions=output:20
2813 ovs-ofctl add-flow br0 in_port=0,dl_vlan_pcp=0,actions=output:21
2814 ovs-ofctl add-flow br0 in_port=0,dl_vlan_pcp=1,actions=output:22
2815 ovs-ofctl add-flow br0 in_port=0,actions=output:23
2816 ovs-ofctl mod-flows br0 dl_vlan=123,actions=output:3
2817 ovs-ofctl mod-flows br0 cookie=5,dl_vlan=123,actions=output:3
2818 ovs-ofctl del-flows br0 dl_vlan=123
2819 ovs-ofctl del-flows br0
2820 ovs-appctl -t ovs-ofctl ofctl/barrier
2821 AT_CHECK([sed 's/ (xid=0x[[1-9a-fA-F]][[0-9a-fA-F]]*)//' monitor.log | multiline_sort], [0],
2822 [NXST_FLOW_MONITOR reply (xid=0x0):
2823 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=124 actions=output:2
2824 NXST_FLOW_MONITOR reply (xid=0x0):
2825 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=123 actions=output:5
2826 NXST_FLOW_MONITOR reply (xid=0x0):
2827 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=123,dl_vlan_pcp=0 actions=output:6
2828 NXST_FLOW_MONITOR reply (xid=0x0):
2829 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=123,dl_vlan_pcp=1 actions=output:7
2830 NXST_FLOW_MONITOR reply (xid=0x0):
2831 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=123 actions=output:8
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:9
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:10
2836 NXST_FLOW_MONITOR reply (xid=0x0):
2837 event=ADDED table=0 cookie=0 in_port=0,vlan_tci=0x0000 actions=output:11
2838 NXST_FLOW_MONITOR reply (xid=0x0):
2839 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=4095,dl_vlan_pcp=0 actions=output:12
2840 NXST_FLOW_MONITOR reply (xid=0x0):
2841 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=4095,dl_vlan_pcp=1 actions=output:13
2842 NXST_FLOW_MONITOR reply (xid=0x0):
2843 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=4095 actions=output:14
2844 NXST_FLOW_MONITOR reply (xid=0x0):
2845 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=0,dl_vlan_pcp=0 actions=output:15
2846 NXST_FLOW_MONITOR reply (xid=0x0):
2847 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=0,dl_vlan_pcp=1 actions=output:16
2848 NXST_FLOW_MONITOR reply (xid=0x0):
2849 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=0 actions=output:17
2850 NXST_FLOW_MONITOR reply (xid=0x0):
2851 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=0,dl_vlan_pcp=0 actions=output:18
2852 NXST_FLOW_MONITOR reply (xid=0x0):
2853 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=0,dl_vlan_pcp=1 actions=output:19
2854 NXST_FLOW_MONITOR reply (xid=0x0):
2855 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=0 actions=output:20
2856 NXST_FLOW_MONITOR reply (xid=0x0):
2857 event=ADDED table=0 cookie=0 in_port=0,dl_vlan_pcp=0 actions=output:21
2858 NXST_FLOW_MONITOR reply (xid=0x0):
2859 event=ADDED table=0 cookie=0 in_port=0,dl_vlan_pcp=1 actions=output:22
2860 NXST_FLOW_MONITOR reply (xid=0x0):
2861 event=ADDED table=0 cookie=0 in_port=0 actions=output:23
2862 NXST_FLOW_MONITOR reply (xid=0x0):
2863 event=MODIFIED table=0 cookie=0 in_port=0,dl_vlan=123 actions=output:3
2864 event=MODIFIED table=0 cookie=0 in_port=0,dl_vlan=123,dl_vlan_pcp=0 actions=output:3
2865 event=MODIFIED table=0 cookie=0 in_port=0,dl_vlan=123,dl_vlan_pcp=1 actions=output:3
2866 NXST_FLOW_MONITOR reply (xid=0x0):
2867 event=MODIFIED table=0 cookie=0x5 in_port=0,dl_vlan=123 actions=output:3
2868 event=MODIFIED table=0 cookie=0x5 in_port=0,dl_vlan=123,dl_vlan_pcp=0 actions=output:3
2869 event=MODIFIED table=0 cookie=0x5 in_port=0,dl_vlan=123,dl_vlan_pcp=1 actions=output:3
2870 NXST_FLOW_MONITOR reply (xid=0x0):
2871 event=DELETED reason=delete table=0 cookie=0x5 in_port=0,dl_vlan=123 actions=output:3
2872 event=DELETED reason=delete table=0 cookie=0x5 in_port=0,dl_vlan=123,dl_vlan_pcp=0 actions=output:3
2873 event=DELETED reason=delete table=0 cookie=0x5 in_port=0,dl_vlan=123,dl_vlan_pcp=1 actions=output:3
2874 NXST_FLOW_MONITOR reply (xid=0x0):
2875 event=DELETED reason=delete table=0 cookie=0 in_port=0 actions=output:23
2876 event=DELETED reason=delete table=0 cookie=0 in_port=0,dl_vlan=0 actions=output:20
2877 event=DELETED reason=delete table=0 cookie=0 in_port=0,dl_vlan=0,dl_vlan_pcp=0 actions=output:18
2878 event=DELETED reason=delete table=0 cookie=0 in_port=0,dl_vlan=0,dl_vlan_pcp=1 actions=output:19
2879 event=DELETED reason=delete table=0 cookie=0 in_port=0,dl_vlan=124 actions=output:2
2880 event=DELETED reason=delete table=0 cookie=0 in_port=0,dl_vlan=4095 actions=output:14
2881 event=DELETED reason=delete table=0 cookie=0 in_port=0,dl_vlan=4095,dl_vlan_pcp=0 actions=output:12
2882 event=DELETED reason=delete table=0 cookie=0 in_port=0,dl_vlan=4095,dl_vlan_pcp=1 actions=output:13
2883 event=DELETED reason=delete table=0 cookie=0 in_port=0,dl_vlan_pcp=0 actions=output:21
2884 event=DELETED reason=delete table=0 cookie=0 in_port=0,dl_vlan_pcp=1 actions=output:22
2885 event=DELETED reason=delete table=0 cookie=0 in_port=0,vlan_tci=0x0000 actions=output:11
2889 # Check that our own changes are reported as full updates.
2890 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
2891 ovs-ofctl add-flow br0 in_port=1,actions=output:2
2892 ovs-ofctl add-flow br0 in_port=2,actions=output:1
2893 ovs-appctl -t ovs-ofctl ofctl/barrier
2894 ovs-appctl -t ovs-ofctl ofctl/send 010e004812345678003fffff00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003000000000000ffffffffffff0000
2895 ovs-appctl -t ovs-ofctl ofctl/barrier
2896 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip], [0], [NXST_FLOW reply:
2898 AT_CHECK([sed 's/ (xid=0x[[1-9a-fA-F]][[0-9a-fA-F]]*)//' monitor.log | multiline_sort], [0],
2899 [NXST_FLOW_MONITOR reply (xid=0x0):
2900 event=ADDED table=0 cookie=0 in_port=1 actions=output:2
2901 NXST_FLOW_MONITOR reply (xid=0x0):
2902 event=ADDED table=0 cookie=0 in_port=2 actions=output:1
2904 send: OFPT_FLOW_MOD: DEL priority=0 actions=drop
2905 NXST_FLOW_MONITOR reply (xid=0x0):
2906 event=DELETED reason=delete table=0 cookie=0 in_port=1 actions=output:2
2907 event=DELETED reason=delete table=0 cookie=0 in_port=2 actions=output:1
2911 ovs-appctl -t ovs-ofctl exit
2915 AT_SETUP([ofproto - flow monitoring with !own])
2916 AT_KEYWORDS([monitor])
2919 ovs-ofctl add-flow br0 in_port=0,dl_vlan=123,actions=output:1
2921 # Start a monitor watching the flow table and check the initial reply.
2922 ovs-ofctl monitor br0 watch:\!own --detach --no-chdir --pidfile >monitor.log 2>&1
2923 AT_CAPTURE_FILE([monitor.log])
2924 ovs-appctl -t ovs-ofctl ofctl/barrier
2925 AT_CHECK([sed 's/ (xid=0x[[1-9a-fA-F]][[0-9a-fA-F]]*)//' monitor.log], [0],
2926 [NXST_FLOW_MONITOR reply:
2927 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=123 actions=output:1
2931 # Check that our own changes are reported as abbreviations.
2932 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
2933 ovs-ofctl add-flow br0 in_port=1,actions=output:2
2934 ovs-ofctl add-flow br0 in_port=2,actions=output:1
2935 ovs-appctl -t ovs-ofctl ofctl/barrier
2936 ovs-appctl -t ovs-ofctl ofctl/send 010e004812345678003fffff00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003000000000000ffffffffffff0000
2937 ovs-appctl -t ovs-ofctl ofctl/barrier
2938 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip], [0], [NXST_FLOW reply:
2940 AT_CHECK([sed 's/ (xid=0x[[1-9a-fA-F]][[0-9a-fA-F]]*)//' monitor.log], [0],
2941 [NXST_FLOW_MONITOR reply (xid=0x0):
2942 event=ADDED table=0 cookie=0 in_port=1 actions=output:2
2943 NXST_FLOW_MONITOR reply (xid=0x0):
2944 event=ADDED table=0 cookie=0 in_port=2 actions=output:1
2946 send: OFPT_FLOW_MOD: DEL priority=0 actions=drop
2947 NXST_FLOW_MONITOR reply (xid=0x0):
2948 event=ABBREV xid=0x12345678
2952 ovs-appctl -t ovs-ofctl exit
2956 AT_SETUP([ofproto - flow monitoring with out_port])
2957 AT_KEYWORDS([monitor])
2960 ovs-ofctl add-flow br0 in_port=0,dl_vlan=121,actions=output:1
2961 ovs-ofctl add-flow br0 in_port=0,dl_vlan=122,actions=output:1
2962 ovs-ofctl add-flow br0 in_port=0,dl_vlan=123,actions=output:2
2964 # Start a monitor watching the flow table and check the initial reply.
2965 ovs-ofctl monitor br0 watch:out_port=2 --detach --no-chdir --pidfile >monitor.log 2>&1
2966 AT_CAPTURE_FILE([monitor.log])
2967 ovs-appctl -t ovs-ofctl ofctl/barrier
2968 AT_CHECK([sed 's/ (xid=0x[[1-9a-fA-F]][[0-9a-fA-F]]*)//' monitor.log], [0],
2969 [NXST_FLOW_MONITOR reply:
2970 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=123 actions=output:2
2974 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
2976 # Add, modify flows and check the updates.
2977 ovs-ofctl mod-flows br0 dl_vlan=121,actions=drop
2978 ovs-ofctl mod-flows br0 dl_vlan=122,actions=output:1,output:2
2979 ovs-appctl -t ovs-ofctl ofctl/barrier
2981 ovs-ofctl mod-flows br0 dl_vlan=123,actions=output:1,output:2
2982 ovs-appctl -t ovs-ofctl ofctl/barrier
2984 ovs-ofctl mod-flows br0 dl_vlan=122,actions=output:1
2985 ovs-appctl -t ovs-ofctl ofctl/barrier
2986 ovs-ofctl mod-flows br0 dl_vlan=123,actions=output:2
2987 ovs-appctl -t ovs-ofctl ofctl/barrier
2989 AT_CHECK([sed 's/ (xid=0x[[1-9a-fA-F]][[0-9a-fA-F]]*)//' monitor.log], [0],
2990 [NXST_FLOW_MONITOR reply (xid=0x0):
2991 event=MODIFIED table=0 cookie=0 in_port=0,dl_vlan=122 actions=output:1,output:2
2993 NXST_FLOW_MONITOR reply (xid=0x0):
2994 event=MODIFIED table=0 cookie=0 in_port=0,dl_vlan=123 actions=output:1,output:2
2996 NXST_FLOW_MONITOR reply (xid=0x0):
2997 event=MODIFIED table=0 cookie=0 in_port=0,dl_vlan=122 actions=output:1
2999 NXST_FLOW_MONITOR reply (xid=0x0):
3000 event=MODIFIED table=0 cookie=0 in_port=0,dl_vlan=123 actions=output:2
3004 ovs-appctl -t ovs-ofctl exit
3008 AT_SETUP([ofproto - flow monitoring pause and resume])
3009 AT_KEYWORDS([monitor])
3011 # The maximum socket receive buffer size is important for this test, which
3012 # tests behavior when the receive buffer overflows.
3013 if test -e /proc/sys/net/core/rmem_max; then
3015 rmem_max=`cat /proc/sys/net/core/rmem_max`
3016 elif rmem_max=`sysctl -n net.inet.tcp.recvbuf_max 2>/dev/null`; then
3019 # Don't know how to get maximum socket receive buffer on this OS
3022 # Calculate the total amount of queuing: rmem_max in the kernel, 128 kB
3023 # in ofproto sending userspace (see ofmonitor_flush() in connmgr.c).
3024 queue_size=`expr $rmem_max + 128 \* 1024`
3025 echo rmem_max=$rmem_max queue_size=$queue_size
3027 # If there's too much queuing skip the test to avoid timing out.
3028 AT_SKIP_IF([test $rmem_max -gt 1048576])
3030 # Each flow update message takes up at least 48 bytes of space in queues
3031 # and in practice more than that.
3032 n_msgs=`expr $queue_size / 48`
3037 # Start a monitor watching the flow table, then make it block.
3038 ON_EXIT([kill `cat ovs-ofctl.pid`])
3039 ovs-ofctl monitor br0 watch: --detach --no-chdir --pidfile >monitor.log 2>&1
3040 AT_CAPTURE_FILE([monitor.log])
3041 ovs-appctl -t ovs-ofctl ofctl/block
3043 # Add $n_msgs flows.
3044 (echo "in_port=2,actions=output:2"
3046 for ($i = 0; $i < '$n_msgs'; $i++) {
3047 print "cookie=1,reg1=$i,actions=drop\n";
3050 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
3051 # Check that multipart flow dumps work properly:
3052 AT_CHECK([ovs-ofctl diff-flows br0 flows.txt])
3053 AT_CHECK([ovs-ofctl add-flow br0 in_port=1,cookie=3,actions=drop])
3054 AT_CHECK([ovs-ofctl mod-flows br0 in_port=2,cookie=2,actions=output:2])
3055 AT_CHECK([ovs-ofctl del-flows br0 cookie=1/-1])
3057 ovs-appctl -t ovs-ofctl ofctl/unblock
3059 # Wait for the connection resumed.
3060 # A barrier doesn't work for this purpose.
3061 # https://www.mail-archive.com/dev@openvswitch.org/msg27013.html
3062 # https://www.mail-archive.com/dev@openvswitch.org/msg27675.html
3063 OVS_WAIT_UNTIL([grep NXT_FLOW_MONITOR_RESUMED monitor.log])
3065 ovs-appctl -t ovs-ofctl exit
3067 # Check that the flow monitor reported the same number of flows
3068 # added and deleted, but fewer than we actually added and deleted.
3069 adds=`grep -c 'ADDED.*reg1=' monitor.log`
3070 deletes=`grep -c 'DELETED.*reg1=' monitor.log`
3071 echo adds=$adds deletes=$deletes
3072 AT_CHECK([test $adds -gt 100 && test $adds -lt $n_msgs])
3073 AT_CHECK([test $adds = $deletes])
3075 # Check that the flow monitor reported everything in the expected order:
3077 # event=ADDED table=0 cookie=0x1 reg1=0x22
3079 # NXT_FLOW_MONITOR_PAUSED:
3081 # event=DELETED reason=delete table=0 cookie=0x1 reg1=0x22
3083 # event=ADDED table=0 cookie=0x3 in_port=1
3084 # event=MODIFIED table=0 cookie=0x2 in_port=2 actions=output:2
3085 # NXT_FLOW_MONITOR_RESUMED:
3087 # except that, between the PAUSED and RESUMED, the order of the ADDED
3088 # and MODIFIED lines lines depends on hash order, that is, it varies
3089 # as we change the hash function or change architecture. Therefore,
3090 # we use a couple of tests below to accept both orders.
3091 AT_CHECK([ofctl_strip < monitor.log | sed -n -e '
3094 /NXT_FLOW_MONITOR_PAUSED:/p
3095 /NXT_FLOW_MONITOR_RESUMED:/p
3096 ' > monitor.log.subset])
3097 AT_CHECK([grep -v MODIFIED monitor.log.subset], [0], [dnl
3098 event=ADDED table=0 cookie=0x1 reg1=0x22
3099 NXT_FLOW_MONITOR_PAUSED:
3100 event=DELETED reason=delete table=0 cookie=0x1 reg1=0x22
3101 event=ADDED table=0 cookie=0x3 in_port=1
3102 NXT_FLOW_MONITOR_RESUMED:
3104 AT_CHECK([grep -v ADDED monitor.log.subset], [0], [dnl
3105 NXT_FLOW_MONITOR_PAUSED:
3106 event=DELETED reason=delete table=0 cookie=0x1 reg1=0x22
3107 event=MODIFIED table=0 cookie=0x2 in_port=2 actions=output:2
3108 NXT_FLOW_MONITOR_RESUMED:
3114 AT_SETUP([ofproto - event filtering (OpenFlow 1.3)])
3115 AT_KEYWORDS([monitor])
3118 # Start a monitor, use the required protocol version
3119 ovs-ofctl -O OpenFlow13 monitor br0 --detach --no-chdir --pidfile >monitor.log 2>&1
3120 AT_CAPTURE_FILE([monitor.log])
3122 # Send an OpenFlow13 message (04), OFPT_GET_ASYNC_REQUEST (1a), length (8), xid (0a)
3123 ovs-appctl -t ovs-ofctl ofctl/send 041a00080000000a
3124 ovs-appctl -t ovs-ofctl ofctl/barrier
3126 # Check default setting
3127 read -r -d '' expected <<'EOF'
3130 AT_CHECK([ofctl_strip < monitor.log], [], [dnl
3131 send: OFPT_GET_ASYNC_REQUEST (OF1.3):
3132 OFPT_GET_ASYNC_REPLY (OF1.3):
3134 PACKET_IN: no_match action
3135 PORT_STATUS: add delete modify
3136 FLOW_REMOVED: idle hard delete
3140 PORT_STATUS: add delete modify
3142 OFPT_BARRIER_REPLY (OF1.3):
3148 AT_SETUP([ofproto - ofport_request])
3150 ADD_OF_PORTS([br0], [1], [2], [3])
3152 set_and_check_specific_ofports () {
3153 ovs-vsctl set Interface p1 ofport_request="$1" -- \
3154 set Interface p2 ofport_request="$2" -- \
3155 set Interface p3 ofport_request="$3"
3156 ofports=`ovs-vsctl get Interface p1 ofport -- \
3157 get Interface p2 ofport -- \
3158 get Interface p3 ofport`
3159 AT_CHECK_UNQUOTED([echo $ofports], [0], [$1 $2 $3
3162 for pre in '1 2 3' '1 3 2' '2 1 3' '2 3 1' '3 1 2' '3 2 1'; do
3163 for post in '1 2 3' '1 3 2' '2 1 3' '2 3 1' '3 1 2' '3 2 1'; do
3164 echo -----------------------------------------------------------
3165 echo "Check changing port numbers from $pre to $post"
3166 set_and_check_specific_ofports $pre
3167 set_and_check_specific_ofports $post
3171 ovs-vsctl del-port p3
3173 set_and_check_poorly_specified_ofports () {
3174 ovs-vsctl set Interface p1 ofport_request="$1" -- \
3175 set Interface p2 ofport_request="$2"
3176 p1=`ovs-vsctl get Interface p1 ofport`
3177 p2=`ovs-vsctl get Interface p2 ofport`
3180 AT_CHECK([test "$p1" != "$p2"])
3181 if test "$1" = "$2" && test "$1" != '[[]]'; then
3182 # One port number must be the requested one.
3183 AT_CHECK([test "$p1" = "$1" || test "$p2" = "$1"])
3184 # The other port number must be different (already tested above).
3186 AT_CHECK([test "$1" = '[[]]' || test "$p1" == "$1"])
3187 AT_CHECK([test "$2" = '[[]]' || test "$p2" == "$2"])
3190 for pre in '1 2' '[[]] 2' '1 [[]]' '[[]] [[]]' '2 1' '[[]] 1' '2 [[]]' \
3192 for post in '1 2' '[[]] 2' '1 [[]]' '[[]] [[]]' '2 1' '[[]] 1' '2 [[]]' \
3194 echo -----------------------------------------------------------
3195 echo "Check changing port numbers from $pre to $post"
3196 set_and_check_poorly_specified_ofports $pre
3197 set_and_check_poorly_specified_ofports $post
3204 AT_SETUP([ofproto - bundles, open (OpenFlow 1.4)])
3205 AT_KEYWORDS([monitor])
3208 # Start a monitor, use the required protocol version
3209 ovs-ofctl -O OpenFlow14 monitor br0 --detach --no-chdir --pidfile >monitor.log 2>&1
3210 AT_CAPTURE_FILE([monitor.log])
3212 # Send an OpenFlow14 message (05), OFPT_BUNDLE_CONTROL (21), length (10), xid (0a)
3213 ovs-appctl -t ovs-ofctl ofctl/send "05 21 00 10 00 00 00 0a 00 00 00 01 00 00 00 01"
3214 ovs-appctl -t ovs-ofctl ofctl/barrier
3215 ovs-appctl -t ovs-ofctl exit
3217 AT_CHECK([ofctl_strip < monitor.log], [], [dnl
3218 send: OFPT_BUNDLE_CONTROL (OF1.4):
3219 bundle_id=0x1 type=OPEN_REQUEST flags=atomic
3220 OFPT_BUNDLE_CONTROL (OF1.4):
3221 bundle_id=0x1 type=OPEN_REPLY flags=0
3222 OFPT_BARRIER_REPLY (OF1.4):
3228 AT_SETUP([ofproto - bundles, double open (OpenFlow 1.4)])
3229 AT_KEYWORDS([monitor])
3232 # Start a monitor, use the required protocol version
3233 ovs-ofctl -O OpenFlow14 monitor br0 --detach --no-chdir --pidfile >monitor.log 2>&1
3234 AT_CAPTURE_FILE([monitor.log])
3236 # Send twice an OpenFlow14 message (05), OFPT_BUNDLE_CONTROL (21), length (10), xid (0a)
3237 ovs-appctl -t ovs-ofctl ofctl/send "05 21 00 10 00 00 00 0a 00 00 00 01 00 00 00 01"
3238 ovs-appctl -t ovs-ofctl ofctl/barrier
3239 ovs-appctl -t ovs-ofctl ofctl/send "05 21 00 10 00 00 00 0a 00 00 00 01 00 00 00 01"
3240 ovs-appctl -t ovs-ofctl ofctl/barrier
3241 ovs-appctl -t ovs-ofctl exit
3243 AT_CHECK([ofctl_strip < monitor.log], [0], [dnl
3244 send: OFPT_BUNDLE_CONTROL (OF1.4):
3245 bundle_id=0x1 type=OPEN_REQUEST flags=atomic
3246 OFPT_BUNDLE_CONTROL (OF1.4):
3247 bundle_id=0x1 type=OPEN_REPLY flags=0
3248 OFPT_BARRIER_REPLY (OF1.4):
3249 send: OFPT_BUNDLE_CONTROL (OF1.4):
3250 bundle_id=0x1 type=OPEN_REQUEST flags=atomic
3251 OFPT_ERROR (OF1.4): OFPBFC_BAD_ID
3252 OFPT_BUNDLE_CONTROL (OF1.4):
3253 bundle_id=0x1 type=OPEN_REQUEST flags=atomic
3254 OFPT_BARRIER_REPLY (OF1.4):
3260 AT_SETUP([ofproto - bundle close without open (OpenFlow 1.4)])
3261 AT_KEYWORDS([monitor])
3264 # Start a monitor, use the required protocol version
3265 ovs-ofctl -O OpenFlow14 monitor br0 --detach --no-chdir --pidfile >monitor.log 2>&1
3266 AT_CAPTURE_FILE([monitor.log])
3268 ovs-appctl -t ovs-ofctl ofctl/send "05 21 00 10 00 00 00 0a 00 00 00 01 00 02 00 01"
3269 ovs-appctl -t ovs-ofctl ofctl/barrier
3270 ovs-appctl -t ovs-ofctl exit
3272 AT_CHECK([ofctl_strip < monitor.log], [0], [dnl
3273 send: OFPT_BUNDLE_CONTROL (OF1.4):
3274 bundle_id=0x1 type=CLOSE_REQUEST flags=atomic
3275 OFPT_ERROR (OF1.4): OFPBFC_BAD_ID
3276 OFPT_BUNDLE_CONTROL (OF1.4):
3277 bundle_id=0x1 type=CLOSE_REQUEST flags=atomic
3278 OFPT_BARRIER_REPLY (OF1.4):
3284 AT_SETUP([ofproto - bundle double close (OpenFlow 1.4)])
3285 AT_KEYWORDS([monitor])
3288 # Start a monitor, use the required protocol version
3289 ovs-ofctl -O OpenFlow14 monitor br0 --detach --no-chdir --pidfile >monitor.log 2>&1
3290 AT_CAPTURE_FILE([monitor.log])
3292 # Open, Close, Close
3293 ovs-appctl -t ovs-ofctl ofctl/send "05 21 00 10 00 00 00 0a 00 00 00 01 00 00 00 01"
3294 ovs-appctl -t ovs-ofctl ofctl/barrier
3295 ovs-appctl -t ovs-ofctl ofctl/send "05 21 00 10 00 00 00 0a 00 00 00 01 00 02 00 01"
3296 ovs-appctl -t ovs-ofctl ofctl/barrier
3297 ovs-appctl -t ovs-ofctl ofctl/send "05 21 00 10 00 00 00 0a 00 00 00 01 00 02 00 01"
3298 ovs-appctl -t ovs-ofctl ofctl/barrier
3299 ovs-appctl -t ovs-ofctl exit
3301 AT_CHECK([ofctl_strip < monitor.log], [0], [dnl
3302 send: OFPT_BUNDLE_CONTROL (OF1.4):
3303 bundle_id=0x1 type=OPEN_REQUEST flags=atomic
3304 OFPT_BUNDLE_CONTROL (OF1.4):
3305 bundle_id=0x1 type=OPEN_REPLY flags=0
3306 OFPT_BARRIER_REPLY (OF1.4):
3307 send: OFPT_BUNDLE_CONTROL (OF1.4):
3308 bundle_id=0x1 type=CLOSE_REQUEST flags=atomic
3309 OFPT_BUNDLE_CONTROL (OF1.4):
3310 bundle_id=0x1 type=CLOSE_REPLY flags=0
3311 OFPT_BARRIER_REPLY (OF1.4):
3312 send: OFPT_BUNDLE_CONTROL (OF1.4):
3313 bundle_id=0x1 type=CLOSE_REQUEST flags=atomic
3314 OFPT_ERROR (OF1.4): OFPBFC_BUNDLE_CLOSED
3315 OFPT_BUNDLE_CONTROL (OF1.4):
3316 bundle_id=0x1 type=CLOSE_REQUEST flags=atomic
3317 OFPT_BARRIER_REPLY (OF1.4):
3323 AT_SETUP([ofproto - bundle close, different flags (OpenFlow 1.4)])
3324 AT_KEYWORDS([monitor])
3327 # Start a monitor, use the required protocol version
3328 ovs-ofctl -O OpenFlow14 monitor br0 --detach --no-chdir --pidfile >monitor.log 2>&1
3329 AT_CAPTURE_FILE([monitor.log])
3331 # Open, Close, Close
3332 ovs-appctl -t ovs-ofctl ofctl/send "05 21 00 10 00 00 00 0a 00 00 00 01 00 00 00 01"
3333 ovs-appctl -t ovs-ofctl ofctl/barrier
3334 ovs-appctl -t ovs-ofctl ofctl/send "05 21 00 10 00 00 00 0a 00 00 00 01 00 02 00 02"
3335 ovs-appctl -t ovs-ofctl ofctl/barrier
3336 ovs-appctl -t ovs-ofctl exit
3338 AT_CHECK([ofctl_strip < monitor.log], [0], [dnl
3339 send: OFPT_BUNDLE_CONTROL (OF1.4):
3340 bundle_id=0x1 type=OPEN_REQUEST flags=atomic
3341 OFPT_BUNDLE_CONTROL (OF1.4):
3342 bundle_id=0x1 type=OPEN_REPLY flags=0
3343 OFPT_BARRIER_REPLY (OF1.4):
3344 send: OFPT_BUNDLE_CONTROL (OF1.4):
3345 bundle_id=0x1 type=CLOSE_REQUEST flags=ordered
3346 OFPT_ERROR (OF1.4): OFPBFC_BAD_FLAGS
3347 OFPT_BUNDLE_CONTROL (OF1.4):
3348 bundle_id=0x1 type=CLOSE_REQUEST flags=ordered
3349 OFPT_BARRIER_REPLY (OF1.4):
3355 AT_SETUP([ofproto - bundle commit without open (OpenFlow 1.4)])
3356 AT_KEYWORDS([monitor])
3359 # Start a monitor, use the required protocol version
3360 ovs-ofctl -O OpenFlow14 monitor br0 --detach --no-chdir --pidfile >monitor.log 2>&1
3361 AT_CAPTURE_FILE([monitor.log])
3363 # Open, Close, Close
3364 ovs-appctl -t ovs-ofctl ofctl/send "05 21 00 10 00 00 00 0a 00 00 00 01 00 04 00 01"
3365 ovs-appctl -t ovs-ofctl ofctl/barrier
3366 ovs-appctl -t ovs-ofctl exit
3368 AT_CHECK([ofctl_strip < monitor.log], [0], [dnl
3369 send: OFPT_BUNDLE_CONTROL (OF1.4):
3370 bundle_id=0x1 type=COMMIT_REQUEST flags=atomic
3371 OFPT_ERROR (OF1.4): OFPBFC_BAD_ID
3372 OFPT_BUNDLE_CONTROL (OF1.4):
3373 bundle_id=0x1 type=COMMIT_REQUEST flags=atomic
3374 OFPT_BARRIER_REPLY (OF1.4):
3380 AT_SETUP([ofproto - bundle commit, different flags (OpenFlow 1.4)])
3381 AT_KEYWORDS([monitor])
3384 # Start a monitor, use the required protocol version
3385 ovs-ofctl -O OpenFlow14 monitor br0 --detach --no-chdir --pidfile >monitor.log 2>&1
3386 AT_CAPTURE_FILE([monitor.log])
3388 # Open, Close, Close
3389 ovs-appctl -t ovs-ofctl ofctl/send "05 21 00 10 00 00 00 0a 00 00 00 01 00 00 00 01"
3390 ovs-appctl -t ovs-ofctl ofctl/barrier
3391 ovs-appctl -t ovs-ofctl ofctl/send "05 21 00 10 00 00 00 0a 00 00 00 01 00 04 00 02"
3392 ovs-appctl -t ovs-ofctl ofctl/barrier
3393 ovs-appctl -t ovs-ofctl exit
3395 AT_CHECK([ofctl_strip < monitor.log], [0], [dnl
3396 send: OFPT_BUNDLE_CONTROL (OF1.4):
3397 bundle_id=0x1 type=OPEN_REQUEST flags=atomic
3398 OFPT_BUNDLE_CONTROL (OF1.4):
3399 bundle_id=0x1 type=OPEN_REPLY flags=0
3400 OFPT_BARRIER_REPLY (OF1.4):
3401 send: OFPT_BUNDLE_CONTROL (OF1.4):
3402 bundle_id=0x1 type=COMMIT_REQUEST flags=ordered
3403 OFPT_ERROR (OF1.4): OFPBFC_BAD_FLAGS
3404 OFPT_BUNDLE_CONTROL (OF1.4):
3405 bundle_id=0x1 type=COMMIT_REQUEST flags=ordered
3406 OFPT_BARRIER_REPLY (OF1.4):
3412 AT_SETUP([ofproto - bundle discard without open (OpenFlow 1.4)])
3413 AT_KEYWORDS([monitor])
3416 # Start a monitor, use the required protocol version
3417 ovs-ofctl -O OpenFlow14 monitor br0 --detach --no-chdir --pidfile >monitor.log 2>&1
3418 AT_CAPTURE_FILE([monitor.log])
3420 # Open, Close, Close
3421 ovs-appctl -t ovs-ofctl ofctl/send "05 21 00 10 00 00 00 0a 00 00 00 01 00 06 00 01"
3422 ovs-appctl -t ovs-ofctl ofctl/barrier
3423 ovs-appctl -t ovs-ofctl exit
3425 AT_CHECK([ofctl_strip < monitor.log], [0], [dnl
3426 send: OFPT_BUNDLE_CONTROL (OF1.4):
3427 bundle_id=0x1 type=DISCARD_REQUEST flags=atomic
3428 OFPT_ERROR (OF1.4): OFPBFC_BAD_ID
3429 OFPT_BUNDLE_CONTROL (OF1.4):
3430 bundle_id=0x1 type=DISCARD_REQUEST flags=atomic
3431 OFPT_BARRIER_REPLY (OF1.4):