3 AT_SETUP([ofproto - echo request])
5 AT_CHECK([ovs-ofctl -vwarn probe br0])
9 AT_SETUP([ofproto - handling messages with bad version])
12 # Start a monitor running OpenFlow 1.0, then send the switch an OF1.1 features
14 AT_CHECK([ovs-ofctl -P openflow10 monitor br0 --detach --no-chdir --pidfile])
15 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
16 AT_CAPTURE_FILE([monitor.log])
17 ovs-appctl -t ovs-ofctl ofctl/send 0205000801234567
18 ovs-appctl -t ovs-ofctl ofctl/barrier
19 ovs-appctl -t ovs-ofctl exit
21 AT_CHECK([sed 's/ (xid=0x[[0-9a-fA-F]]*)//
22 /ECHO/d' monitor.log], [0], [dnl
23 send: OFPT_FEATURES_REQUEST (OF1.1):
24 OFPT_ERROR (OF1.1): OFPBRC_BAD_VERSION
25 OFPT_FEATURES_REQUEST (OF1.1):
29 OVS_VSWITCHD_STOP(["/received OpenFlow version 0x02 != expected 01/d"])
32 AT_SETUP([ofproto - feature request, config request])
34 AT_CHECK([ovs-ofctl -vwarn show br0], [0], [stdout])
35 AT_CHECK([STRIP_XIDS stdout], [0], [dnl
36 OFPT_FEATURES_REPLY: dpid:fedcba9876543210
37 n_tables:254, n_buffers:256
38 capabilities: FLOW_STATS TABLE_STATS PORT_STATS QUEUE_STATS ARP_MATCH_IP
39 actions: output enqueue set_vlan_vid set_vlan_pcp strip_vlan mod_dl_src mod_dl_dst mod_nw_src mod_nw_dst mod_nw_tos mod_tp_src mod_tp_dst
40 LOCAL(br0): addr:aa:55:aa:55:00:00
43 speed: 0 Mbps now, 0 Mbps max
44 OFPT_GET_CONFIG_REPLY: frags=normal miss_send_len=0
49 AT_SETUP([ofproto - set OpenFlow port number])
51 [add-port br0 p1 -- set Interface p1 type=dummy --\
52 add-port br0 p2 -- set Interface p2 type=dummy ofport_request=99])
53 AT_CHECK([ovs-ofctl -vwarn show br0], [0], [stdout])
55 s/ (xid=0x[0-9a-fA-F]*)//
56 s/00:0.$/00:0x/' < stdout]],
58 OFPT_FEATURES_REPLY: dpid:fedcba9876543210
59 n_tables:254, n_buffers:256
60 capabilities: FLOW_STATS TABLE_STATS PORT_STATS QUEUE_STATS ARP_MATCH_IP
61 actions: output enqueue set_vlan_vid set_vlan_pcp strip_vlan mod_dl_src mod_dl_dst mod_nw_src mod_nw_dst mod_nw_tos mod_tp_src mod_tp_dst
62 1(p1): addr:aa:55:aa:55:00:0x
65 speed: 0 Mbps now, 0 Mbps max
66 99(p2): addr:aa:55:aa:55:00:0x
69 speed: 0 Mbps now, 0 Mbps max
70 LOCAL(br0): addr:aa:55:aa:55:00:0x
73 speed: 0 Mbps now, 0 Mbps max
74 OFPT_GET_CONFIG_REPLY: frags=normal miss_send_len=0
80 dnl This is really bare-bones.
81 dnl It at least checks request and reply serialization and deserialization.
82 AT_SETUP([ofproto - port stats - (OpenFlow 1.0)])
84 AT_CHECK([ovs-ofctl -vwarn dump-ports br0], [0], [stdout])
85 AT_CHECK([STRIP_XIDS stdout], [0], [dnl
86 OFPST_PORT reply: 1 ports
87 port LOCAL: rx pkts=0, bytes=0, drop=0, errs=0, frame=0, over=0, crc=0
88 tx pkts=0, bytes=0, drop=0, errs=0, coll=0
93 AT_SETUP([ofproto - port stats - (OpenFlow 1.2)])
95 AT_CHECK([ovs-ofctl -O OpenFlow12 -vwarn dump-ports br0], [0], [stdout])
96 AT_CHECK([STRIP_XIDS stdout], [0], [dnl
97 OFPST_PORT reply (OF1.2): 1 ports
98 port LOCAL: rx pkts=0, bytes=0, drop=0, errs=0, frame=0, over=0, crc=0
99 tx pkts=0, bytes=0, drop=0, errs=0, coll=0
104 AT_SETUP([ofproto - port stats - (OpenFlow 1.4)])
106 AT_CHECK([ovs-ofctl -O OpenFlow14 -vwarn dump-ports br0], [0], [stdout])
107 AT_CHECK([STRIP_XIDS stdout | sed 's/duration=[[0-9.]]*s/duration=?s/'],
109 OFPST_PORT reply (OF1.4): 1 ports
110 port LOCAL: rx pkts=0, bytes=0, drop=0, errs=0, frame=0, over=0, crc=0
111 tx pkts=0, bytes=0, drop=0, errs=0, coll=0
117 dnl This is really bare-bones.
118 dnl It at least checks request and reply serialization and deserialization.
119 AT_SETUP([ofproto - port-desc stats (OpenFlow 1.0)])
121 AT_CHECK([ovs-ofctl -vwarn dump-ports-desc br0], [0], [stdout])
122 AT_CHECK([STRIP_XIDS stdout], [0], [dnl
123 OFPST_PORT_DESC reply:
124 LOCAL(br0): addr:aa:55:aa:55:00:00
127 speed: 0 Mbps now, 0 Mbps max
132 dnl This is really bare-bones.
133 dnl It at least checks request and reply serialization and deserialization.
134 AT_SETUP([ofproto - port-desc stats (OpenFlow 1.2)])
136 AT_CHECK([ovs-ofctl -O OpenFlow12 -vwarn dump-ports-desc br0], [0], [stdout])
137 AT_CHECK([STRIP_XIDS stdout], [0], [dnl
138 OFPST_PORT_DESC reply (OF1.2):
139 LOCAL(br0): addr:aa:55:aa:55:00:00
142 speed: 0 Mbps now, 0 Mbps max
147 AT_SETUP([ofproto - port-desc stats (OpenFlow 1.5)])
149 ADD_OF_PORTS([br0], 1, 2, 3)
150 AT_CHECK([ovs-ofctl -F OXM-OpenFlow15 -O OpenFlow15 -vwarn dump-ports-desc br0], [0], [stdout])
151 AT_CHECK([STRIP_XIDS stdout | sed 's/00:0./00:0x/'], [0], [dnl
152 OFPST_PORT_DESC reply (OF1.5):
153 1(p1): addr:aa:55:aa:55:00:0x
156 speed: 0 Mbps now, 0 Mbps max
157 2(p2): addr:aa:55:aa:55:00:0x
160 speed: 0 Mbps now, 0 Mbps max
161 3(p3): addr:aa:55:aa:55:00:0x
164 speed: 0 Mbps now, 0 Mbps max
165 LOCAL(br0): addr:aa:55:aa:55:00:0x
168 speed: 0 Mbps now, 0 Mbps max
170 AT_CHECK([ovs-ofctl -F OXM-OpenFlow15 -O OpenFlow15 -vwarn dump-ports-desc br0 2], [0], [stdout])
171 AT_CHECK([STRIP_XIDS stdout | sed 's/00:0./00:0x/'], [0], [dnl
172 OFPST_PORT_DESC reply (OF1.5):
173 2(p2): addr:aa:55:aa:55:00:0x
176 speed: 0 Mbps now, 0 Mbps max
181 dnl This is really bare-bones.
182 dnl It at least checks request and reply serialization and deserialization.
183 AT_SETUP([ofproto - queue stats - (OpenFlow 1.0)])
185 AT_CHECK([ovs-ofctl -vwarn queue-stats br0], [0], [stdout])
186 AT_CHECK([STRIP_XIDS stdout], [0], [dnl
187 OFPST_QUEUE reply: 0 queues
189 AT_CHECK([ovs-ofctl -vwarn queue-stats br0 ANY 5], [0],
190 [OFPT_ERROR (xid=0x2): OFPQOFC_BAD_QUEUE
191 OFPST_QUEUE request (xid=0x2):port=ANY queue=5
193 AT_CHECK([ovs-ofctl -vwarn queue-stats br0 10], [0],
194 [OFPT_ERROR (xid=0x2): OFPQOFC_BAD_PORT
195 OFPST_QUEUE request (xid=0x2):port=10 queue=ALL
200 AT_SETUP([ofproto - queue stats - (OpenFlow 1.2)])
202 AT_CHECK([ovs-ofctl -O OpenFlow12 -vwarn queue-stats br0], [0], [stdout])
203 AT_CHECK([STRIP_XIDS stdout], [0], [dnl
204 OFPST_QUEUE reply (OF1.2): 0 queues
206 AT_CHECK([ovs-ofctl -O OpenFlow12 -vwarn queue-stats br0 ALL 5], [0],
207 [OFPT_ERROR (OF1.2) (xid=0x2): OFPQOFC_BAD_QUEUE
208 OFPST_QUEUE request (OF1.2) (xid=0x2):port=ANY queue=5
210 AT_CHECK([ovs-ofctl -O OpenFlow12 -vwarn queue-stats br0 10], [0],
211 [OFPT_ERROR (OF1.2) (xid=0x2): OFPQOFC_BAD_PORT
212 OFPST_QUEUE request (OF1.2) (xid=0x2):port=10 queue=ALL
217 AT_SETUP([ofproto - queue stats - (OpenFlow 1.4)])
219 AT_CHECK([ovs-ofctl -O OpenFlow14 -vwarn queue-stats br0], [0], [stdout])
220 AT_CHECK([STRIP_XIDS stdout], [0], [dnl
221 OFPST_QUEUE reply (OF1.4): 0 queues
223 AT_CHECK([ovs-ofctl -O OpenFlow14 -vwarn queue-stats br0 ALL 5], [0],
224 [OFPT_ERROR (OF1.4) (xid=0x2): OFPQOFC_BAD_QUEUE
225 OFPST_QUEUE request (OF1.4) (xid=0x2):port=ANY queue=5
227 AT_CHECK([ovs-ofctl -O OpenFlow14 -vwarn queue-stats br0 10], [0],
228 [OFPT_ERROR (OF1.4) (xid=0x2): OFPQOFC_BAD_PORT
229 OFPST_QUEUE request (OF1.4) (xid=0x2):port=10 queue=ALL
234 dnl This is really bare-bones.
235 dnl It at least checks request and reply serialization and deserialization.
236 AT_SETUP([ofproto - queue configuration - (OpenFlow 1.0)])
238 ADD_OF_PORTS([br0], [1], [2])
239 AT_CHECK([ovs-ofctl queue-get-config br0 1], [0], [stdout])
240 AT_CHECK([STRIP_XIDS stdout], [0], [dnl
241 OFPT_QUEUE_GET_CONFIG_REPLY: port=1
243 AT_CHECK([ovs-ofctl queue-get-config br0 10], [0],
244 [OFPT_ERROR (xid=0x2): OFPQOFC_BAD_PORT
245 OFPT_QUEUE_GET_CONFIG_REQUEST (xid=0x2): port=10
250 AT_SETUP([ofproto - queue configuration - (OpenFlow 1.2)])
252 ADD_OF_PORTS([br0], [1], [2])
253 AT_CHECK([ovs-ofctl -O OpenFlow12 queue-get-config br0 1], [0], [stdout])
254 AT_CHECK([STRIP_XIDS stdout], [0], [dnl
255 OFPT_QUEUE_GET_CONFIG_REPLY (OF1.2): port=1
257 AT_CHECK([ovs-ofctl -O OpenFlow12 queue-get-config br0 10], [0],
258 [OFPT_ERROR (OF1.2) (xid=0x2): OFPQOFC_BAD_PORT
259 OFPT_QUEUE_GET_CONFIG_REQUEST (OF1.2) (xid=0x2): port=10
264 dnl This is really bare-bones.
265 dnl It at least checks request and reply serialization and deserialization.
266 dnl Actions definition listed in both supported formats (w/ actions=)
267 AT_SETUP([ofproto - no group support (OpenFlow 1.0)])
269 AT_DATA([groups.txt], [dnl
270 group_id=1234,type=all,bucket=output:10
271 group_id=1235,type=all,bucket=actions=output:10
273 AT_DATA([stderr], [dnl
274 ovs-ofctl: none of the usable flow formats (OXM,OpenFlow11) is among the allowed flow formats (OpenFlow10,NXM)
276 AT_CHECK([ovs-ofctl -O OpenFlow10 -vwarn add-groups br0 groups.txt], [1], ,[stderr])
277 AT_CHECK([ovs-ofctl -O OpenFlow10 -vwarn mod-group br0 'group_id=1234,type=all,bucket=output:10'], [1], ,[stderr])
278 AT_CHECK([ovs-ofctl -O OpenFlow10 -vwarn del-groups br0], [1], ,[stderr])
279 AT_CHECK([ovs-ofctl -O OpenFlow10 -vwarn dump-groups br0 ], [1], ,[stderr])
283 dnl This is really bare-bones.
284 dnl It at least checks request and reply serialization and deserialization.
285 dnl Actions definition listed in both supported formats (w/ actions=)
286 AT_SETUP([ofproto - del group (OpenFlow 1.1)])
288 AT_DATA([groups.txt], [dnl
289 group_id=1234,type=all,bucket=output:10
290 group_id=1235,type=all,bucket=actions=output:10
292 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn add-groups br0 groups.txt])
293 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn dump-groups br0 ], [0], [stdout])
294 AT_CHECK([STRIP_XIDS stdout], [0], [dnl
295 OFPST_GROUP_DESC reply (OF1.1):
296 group_id=1234,type=all,bucket=actions=output:10
297 group_id=1235,type=all,bucket=actions=output:10
299 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn del-groups br0 group_id=1234])
300 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn dump-groups br0], [0], [stdout])
301 AT_CHECK([STRIP_XIDS stdout], [0], [dnl
302 OFPST_GROUP_DESC reply (OF1.1):
303 group_id=1235,type=all,bucket=actions=output:10
305 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn del-groups br0 group_id=1234])
306 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn dump-groups br0], [0], [stdout])
307 AT_CHECK([STRIP_XIDS stdout], [0], [dnl
308 OFPST_GROUP_DESC reply (OF1.1):
309 group_id=1235,type=all,bucket=actions=output:10
311 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn del-groups br0], [0])
312 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn dump-groups br0], [0], [stdout])
313 AT_CHECK([STRIP_XIDS stdout], [0], [dnl
314 OFPST_GROUP_DESC reply (OF1.1):
319 dnl This is really bare-bones.
320 dnl It at least checks request and reply serialization and deserialization.
321 dnl Actions definition listed in both supported formats (w/ actions=)
322 AT_SETUP([ofproto - add indirect group])
324 dnl indirect group must have exactly one bucket
325 AT_DATA([stderr], [dnl
326 OFPT_ERROR (OF1.1) (xid=0x2): OFPGMFC_INVALID_GROUP
327 OFPT_GROUP_MOD (OF1.1) (xid=0x2): ***decode error: OFPGMFC_INVALID_GROUP***
329 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn add-group br0 'group_id=1234,type=indirect'], [1], , [stderr])
330 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn add-group br0 'group_id=1235,type=indirect,bucket=output:10'])
331 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn add-group br0 'group_id=1236,type=indirect,bucket=output:10,bucket=output:11'], [1], , [stderr])
335 dnl This is really bare-bones.
336 dnl It at least checks request and reply serialization and deserialization.
337 dnl Actions definition listed in both supported formats (w/ actions=)
338 AT_SETUP([ofproto - del group (OpenFlow 1.5)])
340 AT_DATA([groups.txt], [dnl
341 group_id=1234,type=all,bucket=output:10,bucket=output:11
342 group_id=1235,type=all,bucket=actions=output:12,bucket=bucket_id:0,actions=output:10,bucket=bucket_id:1,actions=output:11
344 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn add-groups br0 groups.txt])
345 AT_CHECK([ovs-ofctl -F OXM-OpenFlow15 -O OpenFlow15 -vwarn dump-groups br0 1234], [0], [stdout])
346 AT_CHECK([STRIP_XIDS stdout], [0], [dnl
347 OFPST_GROUP_DESC reply (OF1.5):
348 group_id=1234,type=all,bucket=bucket_id:0,actions=output:10,bucket=bucket_id:1,actions=output:11
350 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn del-groups br0 group_id=1234])
351 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn dump-groups br0], [0], [stdout])
352 AT_CHECK([STRIP_XIDS stdout], [0], [dnl
353 OFPST_GROUP_DESC reply (OF1.5):
354 group_id=1235,type=all,bucket=bucket_id:2,actions=output:12,bucket=bucket_id:0,actions=output:10,bucket=bucket_id:1,actions=output:11
356 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn del-groups br0 group_id=1234])
357 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn dump-groups br0], [0], [stdout])
358 AT_CHECK([STRIP_XIDS stdout], [0], [dnl
359 OFPST_GROUP_DESC reply (OF1.5):
360 group_id=1235,type=all,bucket=bucket_id:2,actions=output:12,bucket=bucket_id:0,actions=output:10,bucket=bucket_id:1,actions=output:11
362 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn del-groups br0], [0])
363 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn dump-groups br0], [0], [stdout])
364 AT_CHECK([STRIP_XIDS stdout], [0], [dnl
365 OFPST_GROUP_DESC reply (OF1.5):
370 dnl This is really bare-bones.
371 dnl It at least checks request and reply serialization and deserialization.
372 AT_SETUP([ofproto - del group deletes flows])
374 AT_DATA([groups.txt], [dnl
375 group_id=1234,type=all,bucket=output:10
376 group_id=1235,type=all,bucket=output:10
378 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn add-groups br0 groups.txt])
379 AT_DATA([flows.txt], [dnl
380 tcp actions=group:1234
381 udp actions=group:1235
383 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn add-flows br0 flows.txt])
384 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn dump-flows br0 | ofctl_strip | sort],
386 tcp actions=group:1234
387 udp actions=group:1235
388 OFPST_FLOW reply (OF1.1):
390 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn del-groups br0 group_id=1234])
391 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn dump-flows br0 | ofctl_strip | sort],
393 udp actions=group:1235
394 OFPST_FLOW reply (OF1.1):
396 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn del-groups br0 group_id=1234])
397 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn dump-flows br0 | ofctl_strip | sort],
399 udp actions=group:1235
400 OFPST_FLOW reply (OF1.1):
402 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn del-groups br0])
403 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn dump-flows br0 | ofctl_strip | sort],
405 OFPST_FLOW reply (OF1.1):
410 dnl This is really bare-bones.
411 dnl It at least checks request and reply serialization and deserialization.
412 dnl Actions definition listed in both supported formats (w/ actions=)
413 AT_SETUP([ofproto - insert buckets])
415 AT_DATA([groups.txt], [dnl
416 group_id=1234,type=all,bucket=bucket_id:10,actions=output:10,bucket=bucket_id:11,actions=output:11
418 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn add-groups br0 groups.txt])
419 AT_CHECK([ovs-ofctl -F OXM-OpenFlow15 -O OpenFlow15 -vwarn dump-groups br0 1234], [0], [stdout])
420 AT_CHECK([STRIP_XIDS stdout], [0], [dnl
421 OFPST_GROUP_DESC reply (OF1.5):
422 group_id=1234,type=all,bucket=bucket_id:10,actions=output:10,bucket=bucket_id:11,actions=output:11
424 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn insert-buckets br0 group_id=1234,command_bucket_id=first,bucket=bucket_id:0,actions=output:0,bucket=bucket_id:1,actions=output:1])
425 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn dump-groups br0], [0], [stdout])
426 AT_CHECK([STRIP_XIDS stdout], [0], [dnl
427 OFPST_GROUP_DESC reply (OF1.5):
428 group_id=1234,type=all,bucket=bucket_id:0,actions=output:0,bucket=bucket_id:1,actions=output:1,bucket=bucket_id:10,actions=output:10,bucket=bucket_id:11,actions=output:11
430 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn insert-buckets br0 group_id=1234,command_bucket_id=last,bucket=bucket_id:14,actions=output:14,bucket=bucket_id:15,actions=output:15])
431 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn dump-groups br0], [0], [stdout])
432 AT_CHECK([STRIP_XIDS stdout], [0], [dnl
433 OFPST_GROUP_DESC reply (OF1.5):
434 group_id=1234,type=all,bucket=bucket_id:0,actions=output:0,bucket=bucket_id:1,actions=output:1,bucket=bucket_id:10,actions=output:10,bucket=bucket_id:11,actions=output:11,bucket=bucket_id:14,actions=output:14,bucket=bucket_id:15,actions=output:15
436 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn insert-buckets br0 group_id=1234,command_bucket_id=15])
437 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn dump-groups br0], [0], [stdout])
438 AT_CHECK([STRIP_XIDS stdout], [0], [dnl
439 OFPST_GROUP_DESC reply (OF1.5):
440 group_id=1234,type=all,bucket=bucket_id:0,actions=output:0,bucket=bucket_id:1,actions=output:1,bucket=bucket_id:10,actions=output:10,bucket=bucket_id:11,actions=output:11,bucket=bucket_id:14,actions=output:14,bucket=bucket_id:15,actions=output:15
442 AT_DATA([buckets.txt], [dnl
443 group_id=1234,command_bucket_id=11,bucket=bucket_id:12,actions=output:12,bucket=bucket_id:13,actions=output:13
445 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn insert-buckets br0 - < buckets.txt])
446 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn dump-groups br0], [0], [stdout])
447 AT_CHECK([STRIP_XIDS stdout], [0], [dnl
448 OFPST_GROUP_DESC reply (OF1.5):
449 group_id=1234,type=all,bucket=bucket_id:0,actions=output:0,bucket=bucket_id:1,actions=output:1,bucket=bucket_id:10,actions=output:10,bucket=bucket_id:11,actions=output:11,bucket=bucket_id:12,actions=output:12,bucket=bucket_id:13,actions=output:13,bucket=bucket_id:14,actions=output:14,bucket=bucket_id:15,actions=output:15
451 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn insert-buckets br0 group_id=1234,command_bucket_id=15,bucket=bucket_id:20,actions=output:20,bucket=bucket_id:21,actions=output:21])
452 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn dump-groups br0], [0], [stdout])
453 AT_CHECK([STRIP_XIDS stdout], [0], [dnl
454 OFPST_GROUP_DESC reply (OF1.5):
455 group_id=1234,type=all,bucket=bucket_id:0,actions=output:0,bucket=bucket_id:1,actions=output:1,bucket=bucket_id:10,actions=output:10,bucket=bucket_id:11,actions=output:11,bucket=bucket_id:12,actions=output:12,bucket=bucket_id:13,actions=output:13,bucket=bucket_id:14,actions=output:14,bucket=bucket_id:15,actions=output:15,bucket=bucket_id:20,actions=output:20,bucket=bucket_id:21,actions=output:21
460 dnl This is really bare-bones.
461 dnl It at least checks request and reply serialization and deserialization.
462 dnl Actions definition listed in both supported formats (w/ actions=)
463 AT_SETUP([ofproto - remove buckets])
465 AT_DATA([groups.txt], [dnl
466 group_id=1234,type=all,bucket=bucket_id:10,actions=output:10,bucket=bucket_id:11,actions=output:11,bucket=bucket_id:12,actions=output:12,bucket=bucket_id:13,actions=output:13,bucket=bucket_id:14,actions=output:14,bucket=bucket_id:15,actions=output:15,bucket=bucket_id:16,actions=output:16
468 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn add-groups br0 groups.txt])
469 AT_CHECK([ovs-ofctl -F OXM-OpenFlow15 -O OpenFlow15 -vwarn dump-groups br0 1234], [0], [stdout])
470 AT_CHECK([STRIP_XIDS stdout], [0], [dnl
471 OFPST_GROUP_DESC reply (OF1.5):
472 group_id=1234,type=all,bucket=bucket_id:10,actions=output:10,bucket=bucket_id:11,actions=output:11,bucket=bucket_id:12,actions=output:12,bucket=bucket_id:13,actions=output:13,bucket=bucket_id:14,actions=output:14,bucket=bucket_id:15,actions=output:15,bucket=bucket_id:16,actions=output:16
474 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn remove-buckets br0 group_id=1234,command_bucket_id=first])
475 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn dump-groups br0], [0], [stdout])
476 AT_CHECK([STRIP_XIDS stdout], [0], [dnl
477 OFPST_GROUP_DESC reply (OF1.5):
478 group_id=1234,type=all,bucket=bucket_id:11,actions=output:11,bucket=bucket_id:12,actions=output:12,bucket=bucket_id:13,actions=output:13,bucket=bucket_id:14,actions=output:14,bucket=bucket_id:15,actions=output:15,bucket=bucket_id:16,actions=output:16
480 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn remove-buckets br0 group_id=1234,command_bucket_id=last])
481 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn dump-groups br0], [0], [stdout])
482 AT_CHECK([STRIP_XIDS stdout], [0], [dnl
483 OFPST_GROUP_DESC reply (OF1.5):
484 group_id=1234,type=all,bucket=bucket_id:11,actions=output:11,bucket=bucket_id:12,actions=output:12,bucket=bucket_id:13,actions=output:13,bucket=bucket_id:14,actions=output:14,bucket=bucket_id:15,actions=output:15
486 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn remove-buckets br0 group_id=1234,command_bucket_id=13])
487 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn dump-groups br0], [0], [stdout])
488 AT_CHECK([STRIP_XIDS stdout], [0], [dnl
489 OFPST_GROUP_DESC reply (OF1.5):
490 group_id=1234,type=all,bucket=bucket_id:11,actions=output:11,bucket=bucket_id:12,actions=output:12,bucket=bucket_id:14,actions=output:14,bucket=bucket_id:15,actions=output:15
492 AT_DATA([buckets.txt], [dnl
495 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn remove-buckets br0 - < buckets.txt])
496 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn dump-groups br0], [0], [stdout])
497 AT_CHECK([STRIP_XIDS stdout], [0], [dnl
498 OFPST_GROUP_DESC reply (OF1.5):
499 group_id=1234,type=all
501 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn remove-buckets br0 group_id=1234,command_bucket_id=first])
502 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn remove-buckets br0 group_id=1234,command_bucket_id=last])
503 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn remove-buckets br0 group_id=1234,command_bucket_id=all])
504 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn remove-buckets br0 group_id=1234,command_bucket_id=1], [1], [], [stderr])
505 AT_CHECK([cat stderr | ofctl_strip], [0], [dnl
506 OFPT_ERROR (OF1.5): OFPGMFC_UNKNOWN_BUCKET
507 OFPT_GROUP_MOD (OF1.5):
508 REMOVE_BUCKET command_bucket_id:1,group_id=1234
513 dnl This is really bare-bones.
514 dnl It at least checks request and reply serialization and deserialization.
515 AT_SETUP([ofproto - flow mod checks group availability])
517 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn add-group br0 group_id=1234,type=all,bucket=output:10])
518 AT_DATA([flows.txt], [dnl
519 tcp actions=group:1234
520 udp actions=group:1235
522 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn add-flow br0 'tcp actions=group:1234'])
523 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn add-flow br0 'tcp actions=group:1235'], [1], [], [stderr])
525 # The output should look like this:
527 # 00000000 02 0e 00 98 00 00 00 02-00 00 00 00 00 00 00 00 |................|
528 # 00000010 00 00 00 00 00 00 00 00-ff 00 00 00 00 00 80 00 |................|
529 # 00000020 ff ff ff ff ff ff ff ff-ff ff ff ff 00 00 00 00 |................|
530 # 00000030 00 00 00 58 00 00 00 00-00 00 03 d7 00 00 00 00 |...X............|
532 # This 'sed' command captures the error message but drops details.
533 AT_CHECK([sed '/truncated/d
534 /^000000.0/d' stderr | STRIP_XIDS], [0],
535 [OFPT_ERROR (OF1.1): OFPBAC_BAD_OUT_GROUP
536 OFPT_FLOW_MOD (OF1.1):
541 dnl This is really bare-bones.
542 dnl It at least checks request and reply serialization and deserialization.
543 AT_SETUP([ofproto - group description])
545 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn add-group br0 group_id=1234,type=all,bucket=output:10], [0], [stdout])
546 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn dump-groups br0], [0], [stdout])
547 AT_CHECK([STRIP_XIDS stdout], [0], [dnl
548 OFPST_GROUP_DESC reply (OF1.1):
549 group_id=1234,type=all,bucket=actions=output:10
554 dnl This is really bare-bones.
555 dnl It at least checks request and reply serialization and deserialization.
556 AT_SETUP([ofproto - group description])
558 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn add-group br0 group_id=1234,type=all,bucket=output:10])
559 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn dump-groups br0], [0], [stdout])
560 AT_CHECK([STRIP_XIDS stdout], [0], [dnl
561 OFPST_GROUP_DESC reply (OF1.1):
562 group_id=1234,type=all,bucket=actions=output:10
567 dnl This is really bare-bones.
568 dnl It at least checks request and reply serialization and deserialization.
569 AT_SETUP([ofproto - group features])
571 AT_CHECK([ovs-ofctl -O OpenFlow12 -vwarn dump-group-features br0], [0], [stdout])
572 AT_CHECK([STRIP_XIDS stdout], [0], [dnl
573 OFPST_GROUP_FEATURES reply (OF1.2):
578 max_groups=0xffffff00
579 actions: output group set_field strip_vlan push_vlan mod_nw_ttl dec_ttl set_mpls_ttl dec_mpls_ttl push_mpls pop_mpls set_queue
581 max_groups=0xffffff00
582 actions: output group set_field strip_vlan push_vlan mod_nw_ttl dec_ttl set_mpls_ttl dec_mpls_ttl push_mpls pop_mpls set_queue
584 max_groups=0xffffff00
585 actions: output group set_field strip_vlan push_vlan mod_nw_ttl dec_ttl set_mpls_ttl dec_mpls_ttl push_mpls pop_mpls set_queue
587 max_groups=0xffffff00
588 actions: output group set_field strip_vlan push_vlan mod_nw_ttl dec_ttl set_mpls_ttl dec_mpls_ttl push_mpls pop_mpls set_queue
593 dnl This is really bare-bones.
594 dnl It at least checks request and reply serialization and deserialization.
595 AT_SETUP([ofproto - group stats (OpenFlow 1.1)])
597 AT_DATA([groups.txt], [dnl
598 group_id=1234,type=all,bucket=output:10
599 group_id=1235,type=all,bucket=output:10
601 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn add-groups br0 groups.txt])
602 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn add-flow br0 'tcp actions=group:1234'])
603 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn dump-group-stats br0 group_id=1234], [0], [stdout])
604 AT_CHECK([STRIP_XIDS stdout | sort], [0], [dnl
605 group_id=1234,ref_count=1,packet_count=0,byte_count=0,bucket0:packet_count=0,byte_count=0
606 OFPST_GROUP reply (OF1.1):
608 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn dump-group-stats br0], [0], [stdout])
609 AT_CHECK([STRIP_XIDS stdout | sort], [0], [dnl
610 group_id=1234,ref_count=1,packet_count=0,byte_count=0,bucket0:packet_count=0,byte_count=0
611 group_id=1235,ref_count=0,packet_count=0,byte_count=0,bucket0:packet_count=0,byte_count=0
612 OFPST_GROUP reply (OF1.1):
617 dnl This is really bare-bones.
618 dnl It at least checks request and reply serialization and deserialization.
619 AT_SETUP([ofproto - group stats (OpenFlow 1.3)])
621 AT_DATA([groups.txt], [dnl
622 group_id=1234,type=all,bucket=output:10
623 group_id=1235,type=all,bucket=output:10
625 AT_CHECK([ovs-ofctl -O OpenFlow13 -vwarn add-groups br0 groups.txt])
626 AT_CHECK([ovs-ofctl -O OpenFlow13 -vwarn add-flow br0 'tcp actions=group:1234'])
627 AT_CHECK([ovs-ofctl -O OpenFlow13 -vwarn dump-group-stats br0 group_id=1234], [0], [stdout])
628 AT_CHECK([STRIP_XIDS stdout | sed 's/duration=[[0-9.]]*s/duration=?s/' | sort], [0], [dnl
629 group_id=1234,duration=?s,ref_count=1,packet_count=0,byte_count=0,bucket0:packet_count=0,byte_count=0
630 OFPST_GROUP reply (OF1.3):
632 AT_CHECK([ovs-ofctl -O OpenFlow13 -vwarn dump-group-stats br0], [0], [stdout])
633 AT_CHECK([STRIP_XIDS stdout | sed 's/duration=[[0-9.]]*s/duration=?s/' | sort], [0], [dnl
634 group_id=1234,duration=?s,ref_count=1,packet_count=0,byte_count=0,bucket0:packet_count=0,byte_count=0
635 group_id=1235,duration=?s,ref_count=0,packet_count=0,byte_count=0,bucket0:packet_count=0,byte_count=0
636 OFPST_GROUP reply (OF1.3):
641 dnl This is really bare-bones.
642 dnl It at least checks request and reply serialization and deserialization.
643 AT_SETUP([ofproto - group stats (OpenFlow 1.5)])
645 AT_DATA([groups.txt], [dnl
646 group_id=1234,type=all,bucket=output:10
647 group_id=1235,type=all,bucket=output:10
649 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn add-groups br0 groups.txt])
650 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn add-flow br0 'tcp actions=group:1234'])
651 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn dump-group-stats br0 group_id=1234], [0], [stdout])
652 AT_CHECK([STRIP_XIDS stdout | sed 's/duration=[[0-9.]]*s/duration=?s/' | sort], [0], [dnl
653 group_id=1234,duration=?s,ref_count=1,packet_count=0,byte_count=0,bucket0:packet_count=0,byte_count=0
654 OFPST_GROUP reply (OF1.5):
656 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn dump-group-stats br0], [0], [stdout])
657 AT_CHECK([STRIP_XIDS stdout | sed 's/duration=[[0-9.]]*s/duration=?s/' | sort], [0], [dnl
658 group_id=1234,duration=?s,ref_count=1,packet_count=0,byte_count=0,bucket0:packet_count=0,byte_count=0
659 group_id=1235,duration=?s,ref_count=0,packet_count=0,byte_count=0,bucket0:packet_count=0,byte_count=0
660 OFPST_GROUP reply (OF1.5):
665 AT_SETUP([ofproto - mod-port (OpenFlow 1.0)])
667 for command_config_state in \
669 'noflood NO_FLOOD 0' \
670 'down PORT_DOWN,NO_FLOOD LINK_DOWN' \
671 'flood PORT_DOWN LINK_DOWN' \
672 'no-receive PORT_DOWN,NO_RECV LINK_DOWN' \
673 'no-forward PORT_DOWN,NO_RECV,NO_FWD LINK_DOWN' \
674 'no-packet-in PORT_DOWN,NO_RECV,NO_FWD,NO_PACKET_IN LINK_DOWN' \
675 'forward PORT_DOWN,NO_RECV,NO_PACKET_IN LINK_DOWN' \
676 'packet-in PORT_DOWN,NO_RECV LINK_DOWN' \
680 set $command_config_state
681 command=$[1] config=`echo $[2] | sed 's/,/ /g'` state=$[3]
682 AT_CHECK([ovs-ofctl -vwarn mod-port br0 br0 $command])
683 AT_CHECK([ovs-ofctl -vwarn show br0], [0], [stdout])
684 AT_CHECK_UNQUOTED([STRIP_XIDS stdout], [0], [dnl
685 OFPT_FEATURES_REPLY: dpid:fedcba9876543210
686 n_tables:254, n_buffers:256
687 capabilities: FLOW_STATS TABLE_STATS PORT_STATS QUEUE_STATS ARP_MATCH_IP
688 actions: output enqueue set_vlan_vid set_vlan_pcp strip_vlan mod_dl_src mod_dl_dst mod_nw_src mod_nw_dst mod_nw_tos mod_tp_src mod_tp_dst
689 LOCAL(br0): addr:aa:55:aa:55:00:00
692 speed: 0 Mbps now, 0 Mbps max
693 OFPT_GET_CONFIG_REPLY: frags=normal miss_send_len=0
699 AT_SETUP([ofproto - mod-port (OpenFlow 1.2)])
701 for command_config_state in \
703 'down PORT_DOWN LINK_DOWN' \
704 'no-receive PORT_DOWN,NO_RECV LINK_DOWN' \
705 'no-forward PORT_DOWN,NO_RECV,NO_FWD LINK_DOWN' \
706 'no-packet-in PORT_DOWN,NO_RECV,NO_FWD,NO_PACKET_IN LINK_DOWN' \
707 'forward PORT_DOWN,NO_RECV,NO_PACKET_IN LINK_DOWN' \
708 'packet-in PORT_DOWN,NO_RECV LINK_DOWN' \
712 set $command_config_state
713 command=$[1] config=`echo $[2] | sed 's/,/ /g'` state=$[3]
714 AT_CHECK([ovs-ofctl -O OpenFlow12 -vwarn mod-port br0 br0 $command])
715 AT_CHECK([ovs-ofctl -O OpenFlow12 -vwarn show br0], [0], [stdout])
716 AT_CHECK_UNQUOTED([STRIP_XIDS stdout], [0], [dnl
717 OFPT_FEATURES_REPLY (OF1.2): dpid:fedcba9876543210
718 n_tables:254, n_buffers:256
719 capabilities: FLOW_STATS TABLE_STATS PORT_STATS GROUP_STATS QUEUE_STATS
720 LOCAL(br0): addr:aa:55:aa:55:00:00
723 speed: 0 Mbps now, 0 Mbps max
724 OFPT_GET_CONFIG_REPLY (OF1.2): frags=normal miss_send_len=0
730 AT_SETUP([ofproto - mod-port (OpenFlow 1.4)])
732 for command_config_state in \
734 'down PORT_DOWN LINK_DOWN' \
735 'no-receive PORT_DOWN,NO_RECV LINK_DOWN' \
736 'no-forward PORT_DOWN,NO_RECV,NO_FWD LINK_DOWN' \
737 'no-packet-in PORT_DOWN,NO_RECV,NO_FWD,NO_PACKET_IN LINK_DOWN' \
738 'forward PORT_DOWN,NO_RECV,NO_PACKET_IN LINK_DOWN' \
739 'packet-in PORT_DOWN,NO_RECV LINK_DOWN' \
743 set $command_config_state
744 command=$[1] config=`echo $[2] | sed 's/,/ /g'` state=$[3]
745 AT_CHECK([ovs-ofctl -O OpenFlow14 -vwarn mod-port br0 br0 $command])
746 AT_CHECK([ovs-ofctl -O OpenFlow14 -vwarn show br0], [0], [stdout])
747 AT_CHECK_UNQUOTED([STRIP_XIDS stdout], [0], [dnl
748 OFPT_FEATURES_REPLY (OF1.4): dpid:fedcba9876543210
749 n_tables:254, n_buffers:256
750 capabilities: FLOW_STATS TABLE_STATS PORT_STATS GROUP_STATS QUEUE_STATS
751 OFPST_PORT_DESC reply (OF1.4):
752 LOCAL(br0): addr:aa:55:aa:55:00:00
755 speed: 0 Mbps now, 0 Mbps max
756 OFPT_GET_CONFIG_REPLY (OF1.4): frags=normal miss_send_len=0
762 AT_SETUP([ofproto - basic flow_mod commands (NXM)])
764 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip], [0], [NXST_FLOW reply:
766 AT_CHECK([echo 'in_port=2,actions=1' | ovs-ofctl add-flows br0 -])
767 AT_CHECK([ovs-ofctl add-flow br0 in_port=1,actions=2])
768 AT_CHECK([ovs-ofctl -F nxm add-flow br0 table=1,in_port=4,actions=3])
769 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
770 in_port=1 actions=output:2
771 in_port=2 actions=output:1
772 table=1, in_port=4 actions=output:3
775 AT_CHECK([ovs-ofctl dump-aggregate br0 table=0 | STRIP_XIDS], [0], [dnl
776 NXST_AGGREGATE reply: packet_count=0 byte_count=0 flow_count=2
778 AT_CHECK([ovs-ofctl del-flows br0])
779 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip], [0], [NXST_FLOW reply:
784 AT_SETUP([ofproto - basic flow_mod commands (OpenFlow 1.0)])
786 AT_CHECK([ovs-ofctl -F openflow10 dump-flows br0 | ofctl_strip], [0], [OFPST_FLOW reply:
788 AT_CHECK([echo 'in_port=2,actions=1' | ovs-ofctl -F openflow10 add-flows br0 -])
789 AT_CHECK([ovs-ofctl -F openflow10 add-flow br0 in_port=1,actions=2])
790 AT_CHECK([ovs-ofctl -F openflow10 add-flow br0 table=1,in_port=4,actions=3])
791 AT_CHECK([ovs-ofctl -F openflow10 dump-flows br0 | ofctl_strip | sort], [0], [dnl
792 in_port=1 actions=output:2
793 in_port=2 actions=output:1
794 table=1, in_port=4 actions=output:3
797 AT_CHECK([ovs-ofctl -F openflow10 dump-aggregate br0 table=0 | STRIP_XIDS], [0], [dnl
798 OFPST_AGGREGATE reply: packet_count=0 byte_count=0 flow_count=2
800 AT_CHECK([ovs-ofctl -F openflow10 del-flows br0])
801 AT_CHECK([ovs-ofctl -F openflow10 dump-flows br0 | ofctl_strip], [0], [OFPST_FLOW reply:
806 AT_SETUP([ofproto - basic flow_mod commands (OpenFlow 1.1)])
808 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip], [0], [OFPST_FLOW reply (OF1.1):
810 AT_CHECK([echo 'in_port=2,actions=1' | ovs-ofctl -O OpenFlow11 add-flows br0 -])
811 AT_CHECK([ovs-ofctl -O OpenFlow11 add-flow br0 in_port=1,actions=2])
812 AT_CHECK([ovs-ofctl -O OpenFlow11 add-flow br0 table=1,in_port=4,actions=3])
813 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0], [dnl
814 in_port=1 actions=output:2
815 in_port=2 actions=output:1
816 table=1, in_port=4 actions=output:3
817 OFPST_FLOW reply (OF1.1):
819 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-aggregate br0 table=0 | STRIP_XIDS], [0], [dnl
820 OFPST_AGGREGATE reply (OF1.1): packet_count=0 byte_count=0 flow_count=2
822 AT_CHECK([ovs-ofctl -O OpenFlow11 del-flows br0])
823 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip], [0], [OFPST_FLOW reply (OF1.1):
824 table=1, in_port=4 actions=output:3
829 AT_SETUP([ofproto - flow_mod negative test (OpenFlow 1.1)])
831 [set bridge br0 protocols=OpenFlow10,OpenFlow11,OpenFlow12,OpenFlow13])
832 AT_CHECK([ovs-ofctl add-flow -O OpenFlow11 br0 table=1,action=goto_table:2])
834 # The error message here actually comes from ovs-ofctl, not from ovs-vswitchd,
835 # but at least it's the same code in ofpacts_check() that issues the error.
836 AT_CHECK([ovs-ofctl add-flow -O OpenFlow11 br0 table=1,action=goto_table:1],
838 [ovs-ofctl: actions are invalid with specified match (OFPBIC_BAD_TABLE_ID)
843 AT_SETUP([ofproto - set-field flow_mod commands (NXM)])
845 AT_CHECK([ovs-ofctl add-flow br0 ipv6,table=1,in_port=3,actions=drop])
846 AT_CHECK([ovs-ofctl add-flow br0 ipv6,table=1,in_port=3,actions=set_field:fe80:0123:4567:890a:a6ba:dbff:fefe:59fa-\>ipv6_src])
847 AT_CHECK([ovs-ofctl 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 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 metadata: arbitrary mask
1492 in_port: exact match or wildcard
1493 in_port_oxm: exact match or wildcard
1494 actset_output: exact match or wildcard
1495 pkt_mark: arbitrary mask
1496 reg0: arbitrary mask
1497 reg1: arbitrary mask
1498 reg2: arbitrary mask
1499 reg3: arbitrary mask
1500 reg4: arbitrary mask
1501 reg5: arbitrary mask
1502 reg6: arbitrary mask
1503 reg7: arbitrary mask
1504 xreg0: arbitrary mask
1505 xreg1: arbitrary mask
1506 xreg2: arbitrary mask
1507 xreg3: arbitrary mask
1508 eth_src: arbitrary mask
1509 eth_dst: arbitrary mask
1510 eth_type: exact match or wildcard
1511 vlan_tci: arbitrary mask
1512 vlan_vid: arbitrary mask
1513 vlan_pcp: exact match or wildcard
1514 mpls_label: exact match or wildcard
1515 mpls_tc: exact match or wildcard
1516 mpls_bos: exact match or wildcard
1517 ip_src: arbitrary mask
1518 ip_dst: arbitrary mask
1519 ipv6_src: arbitrary mask
1520 ipv6_dst: arbitrary mask
1521 ipv6_label: arbitrary mask
1522 nw_proto: exact match or wildcard
1523 nw_tos: exact match or wildcard
1524 ip_dscp: exact match or wildcard
1525 nw_ecn: exact match or wildcard
1526 nw_ttl: exact match or wildcard
1527 ip_frag: arbitrary mask
1528 arp_op: exact match or wildcard
1529 arp_spa: arbitrary mask
1530 arp_tpa: arbitrary mask
1531 arp_sha: arbitrary mask
1532 arp_tha: arbitrary mask
1533 tcp_src: arbitrary mask
1534 tcp_dst: arbitrary mask
1535 tcp_flags: arbitrary mask
1536 udp_src: arbitrary mask
1537 udp_dst: arbitrary mask
1538 sctp_src: arbitrary mask
1539 sctp_dst: arbitrary mask
1540 icmp_type: exact match or wildcard
1541 icmp_code: exact match or wildcard
1542 icmpv6_type: exact match or wildcard
1543 icmpv6_code: exact match or wildcard
1544 nd_target: arbitrary mask
1545 nd_sll: arbitrary mask
1546 nd_tll: arbitrary mask"
1550 AT_CHECK([ovs-ofctl -O OpenFlow13 dump-table-features br0 | sed '/^$/d
1551 /^OFPST_TABLE_FEATURES/d'], [0], [expout])
1552 # Change the configuration.
1555 -- --id=@t0 create Flow_Table name=main \
1556 -- --id=@t1 create Flow_Table flow-limit=1024 \
1557 -- set bridge br0 'flow_tables={1=@t1,0=@t0}' \
1558 | ${PERL} $srcdir/uuidfilt.pl],
1562 # Check that the configuration was updated.
1563 mv expout orig-expout
1564 sed 's/classifier/main/
1565 75s/1000000/1024/' < orig-expout > expout
1566 AT_CHECK([ovs-ofctl -O OpenFlow13 dump-table-features br0 | sed '/^$/d
1567 /^OFPST_TABLE_FEATURES/d'], [0], [expout])
1571 AT_SETUP([ofproto - hard limits on flow table size (OpenFlow 1.0)])
1573 # Configure a maximum of 4 flows.
1576 -- --id=@t0 create Flow_Table flow-limit=4 \
1577 -- set bridge br0 flow_tables:0=@t0 \
1578 | ${PERL} $srcdir/uuidfilt.pl],
1582 for in_port in 1 2 3 4; do
1583 ovs-ofctl add-flow br0 in_port=$in_port,actions=drop
1585 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1586 in_port=1 actions=drop
1587 in_port=2 actions=drop
1588 in_port=3 actions=drop
1589 in_port=4 actions=drop
1592 # Adding another flow will be refused.
1593 AT_CHECK([ovs-ofctl add-flow br0 in_port=5,actions=drop], [1], [], [stderr])
1594 AT_CHECK([head -n 1 stderr | ofctl_strip], [0],
1595 [OFPT_ERROR: OFPFMFC_TABLE_FULL
1597 # Also a mod-flow that would add a flow will be refused.
1598 AT_CHECK([ovs-ofctl mod-flows br0 in_port=5,actions=drop], [1], [], [stderr])
1599 AT_CHECK([head -n 1 stderr | ofctl_strip], [0],
1600 [OFPT_ERROR: OFPFMFC_TABLE_FULL
1602 # Replacing or modifying an existing flow is allowed.
1603 AT_CHECK([ovs-ofctl add-flow br0 in_port=4,actions=normal])
1604 AT_CHECK([ovs-ofctl mod-flows br0 in_port=3,actions=output:1])
1605 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1606 in_port=1 actions=drop
1607 in_port=2 actions=drop
1608 in_port=3 actions=output:1
1609 in_port=4 actions=NORMAL
1615 AT_SETUP([ofproto - hard limits on flow table size (OpenFlow 1.2)])
1617 # Configure a maximum of 4 flows.
1620 -- --id=@t0 create Flow_Table flow-limit=4 \
1621 -- set bridge br0 flow_tables:0=@t0 \
1622 | ${PERL} $srcdir/uuidfilt.pl],
1626 for in_port in 1 2 3 4; do
1627 ovs-ofctl -O OpenFlow12 add-flow br0 in_port=$in_port,actions=drop
1629 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1630 in_port=1 actions=drop
1631 in_port=2 actions=drop
1632 in_port=3 actions=drop
1633 in_port=4 actions=drop
1634 OFPST_FLOW reply (OF1.2):
1636 # Adding another flow will be refused.
1637 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 in_port=5,actions=drop], [1], [], [stderr])
1638 AT_CHECK([head -n 1 stderr | ofctl_strip], [0],
1639 [OFPT_ERROR (OF1.2): OFPFMFC_TABLE_FULL
1641 # Replacing or modifying an existing flow is allowed.
1642 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 in_port=4,actions=normal])
1643 AT_CHECK([ovs-ofctl -O OpenFlow12 mod-flows br0 in_port=3,actions=output:1])
1644 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1645 in_port=1 actions=drop
1646 in_port=2 actions=drop
1647 in_port=3 actions=output:1
1648 in_port=4 actions=NORMAL
1649 OFPST_FLOW reply (OF1.2):
1654 AT_SETUP([ofproto - eviction upon table overflow (OpenFlow 1.0)])
1656 # Configure a maximum of 4 flows.
1659 -- --id=@t0 create Flow_Table flow-limit=4 overflow-policy=evict \
1660 -- set bridge br0 flow_tables:0=@t0 \
1661 | ${PERL} $srcdir/uuidfilt.pl],
1665 for in_port in 4 3 2 1; do
1666 ovs-ofctl add-flow br0 idle_timeout=${in_port}0,in_port=$in_port,actions=drop
1668 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1669 idle_timeout=10, in_port=1 actions=drop
1670 idle_timeout=20, in_port=2 actions=drop
1671 idle_timeout=30, in_port=3 actions=drop
1672 idle_timeout=40, in_port=4 actions=drop
1675 # Adding another flow will cause the one that expires soonest to be evicted.
1676 AT_CHECK([ovs-ofctl add-flow br0 in_port=5,actions=drop])
1677 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1678 idle_timeout=20, in_port=2 actions=drop
1679 idle_timeout=30, in_port=3 actions=drop
1680 idle_timeout=40, in_port=4 actions=drop
1681 in_port=5 actions=drop
1684 # A mod-flow that adds a flow also causes eviction, but replacing or
1685 # modifying an existing flow doesn't.
1686 AT_CHECK([ovs-ofctl mod-flows br0 in_port=6,actions=drop])
1687 AT_CHECK([ovs-ofctl add-flow br0 in_port=4,actions=normal])
1688 AT_CHECK([ovs-ofctl mod-flows br0 in_port=3,actions=output:1])
1689 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1690 idle_timeout=30, in_port=3 actions=output:1
1691 in_port=4 actions=NORMAL
1692 in_port=5 actions=drop
1693 in_port=6 actions=drop
1696 # Flows with no timeouts at all cannot be evicted.
1697 AT_CHECK([ovs-ofctl add-flow br0 in_port=7,actions=normal])
1698 AT_CHECK([ovs-ofctl add-flow br0 in_port=8,actions=drop], [1], [], [stderr])
1699 AT_CHECK([head -n 1 stderr | ofctl_strip], [0],
1700 [OFPT_ERROR: OFPFMFC_TABLE_FULL
1702 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1703 in_port=4 actions=NORMAL
1704 in_port=5 actions=drop
1705 in_port=6 actions=drop
1706 in_port=7 actions=NORMAL
1712 AT_SETUP([ofproto - eviction upon table overflow (OpenFlow 1.2)])
1714 # Configure a maximum of 4 flows.
1717 -- --id=@t0 create Flow_Table flow-limit=4 overflow-policy=evict \
1718 -- set bridge br0 flow_tables:0=@t0 \
1719 | ${PERL} $srcdir/uuidfilt.pl],
1723 for in_port in 4 3 2 1; do
1724 ovs-ofctl -O OpenFlow12 add-flow br0 idle_timeout=${in_port}0,in_port=$in_port,actions=drop
1726 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1727 idle_timeout=10, in_port=1 actions=drop
1728 idle_timeout=20, in_port=2 actions=drop
1729 idle_timeout=30, in_port=3 actions=drop
1730 idle_timeout=40, in_port=4 actions=drop
1731 OFPST_FLOW reply (OF1.2):
1733 # Adding another flow will cause the one that expires soonest to be evicted.
1734 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 in_port=5,actions=drop])
1735 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1736 idle_timeout=20, in_port=2 actions=drop
1737 idle_timeout=30, in_port=3 actions=drop
1738 idle_timeout=40, in_port=4 actions=drop
1739 in_port=5 actions=drop
1740 OFPST_FLOW reply (OF1.2):
1742 # In OpenFlow 1.2 a mod-flow does not ever add a flow and thus
1743 # has no effect on eviction
1744 AT_CHECK([ovs-ofctl -O OpenFlow12 mod-flows br0 in_port=6,actions=drop])
1745 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 in_port=4,actions=normal])
1746 AT_CHECK([ovs-ofctl -O OpenFlow12 mod-flows br0 in_port=3,actions=output:1])
1747 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1748 idle_timeout=20, in_port=2 actions=drop
1749 idle_timeout=30, in_port=3 actions=output:1
1750 in_port=4 actions=NORMAL
1751 in_port=5 actions=drop
1752 OFPST_FLOW reply (OF1.2):
1754 # Flows with no timeouts at all cannot be evicted.
1755 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 in_port=6,actions=drop])
1756 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 in_port=7,actions=normal])
1757 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 in_port=8,actions=drop], [1], [], [stderr])
1758 AT_CHECK([head -n 1 stderr | ofctl_strip], [0],
1759 [OFPT_ERROR (OF1.2): OFPFMFC_TABLE_FULL
1761 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1762 in_port=4 actions=NORMAL
1763 in_port=5 actions=drop
1764 in_port=6 actions=drop
1765 in_port=7 actions=NORMAL
1766 OFPST_FLOW reply (OF1.2):
1771 AT_SETUP([ofproto - eviction upon table overflow, with fairness (OpenFlow 1.0)])
1773 # Configure a maximum of 4 flows.
1776 -- --id=@t0 create Flow_Table name=evict flow-limit=4 \
1777 overflow-policy=evict \
1778 groups='"NXM_OF_IN_PORT[[]]"' \
1779 -- set bridge br0 flow_tables:0=@t0 \
1780 | ${PERL} $srcdir/uuidfilt.pl],
1784 ovs-ofctl add-flows br0 - <<EOF
1785 idle_timeout=10 in_port=2 dl_src=00:44:55:66:77:88 actions=drop
1786 idle_timeout=20 in_port=1 dl_src=00:11:22:33:44:55 actions=drop
1787 idle_timeout=30 in_port=1 dl_src=00:22:33:44:55:66 actions=drop
1788 idle_timeout=40 in_port=1 dl_src=00:33:44:55:66:77 actions=drop
1790 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1791 idle_timeout=10, in_port=2,dl_src=00:44:55:66:77:88 actions=drop
1792 idle_timeout=20, in_port=1,dl_src=00:11:22:33:44:55 actions=drop
1793 idle_timeout=30, in_port=1,dl_src=00:22:33:44:55:66 actions=drop
1794 idle_timeout=40, in_port=1,dl_src=00:33:44:55:66:77 actions=drop
1797 # Adding another flow will cause the one that expires soonest within
1798 # the largest group (those with in_port=1) to be evicted. In this
1799 # case this is not the same as the one that expires soonest overall
1800 # (which is what makes the test interesting):
1801 AT_CHECK([ovs-ofctl add-flow br0 in_port=2,dl_src=00:55:66:77:88:99,actions=drop])
1802 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1803 idle_timeout=10, in_port=2,dl_src=00:44:55:66:77:88 actions=drop
1804 idle_timeout=30, in_port=1,dl_src=00:22:33:44:55:66 actions=drop
1805 idle_timeout=40, in_port=1,dl_src=00:33:44:55:66:77 actions=drop
1806 in_port=2,dl_src=00:55:66:77:88:99 actions=drop
1809 # Enlarge the flow limit, change the eviction policy back to strictly
1810 # based on expiration, and and add some flows.
1811 AT_CHECK([ovs-vsctl set Flow_Table evict groups='[[]]' flow-limit=7])
1812 ovs-ofctl add-flows br0 - <<EOF
1813 idle_timeout=50 in_port=2 dl_src=00:66:77:88:99:aa actions=drop
1814 idle_timeout=60 in_port=2 dl_src=00:77:88:99:aa:bb actions=drop
1815 idle_timeout=70 in_port=2 dl_src=00:88:99:aa:bb:cc actions=drop
1817 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1818 idle_timeout=10, in_port=2,dl_src=00:44:55:66:77:88 actions=drop
1819 idle_timeout=30, in_port=1,dl_src=00:22:33:44:55:66 actions=drop
1820 idle_timeout=40, in_port=1,dl_src=00:33:44:55:66:77 actions=drop
1821 idle_timeout=50, in_port=2,dl_src=00:66:77:88:99:aa actions=drop
1822 idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=drop
1823 idle_timeout=70, in_port=2,dl_src=00:88:99:aa:bb:cc actions=drop
1824 in_port=2,dl_src=00:55:66:77:88:99 actions=drop
1827 # Adding another flow will cause the one that expires soonest overall
1829 AT_CHECK([ovs-ofctl add-flow br0 'idle_timeout=80 in_port=2 dl_src=00:99:aa:bb:cc:dd actions=drop'])
1830 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1831 idle_timeout=30, in_port=1,dl_src=00:22:33:44:55:66 actions=drop
1832 idle_timeout=40, in_port=1,dl_src=00:33:44:55:66:77 actions=drop
1833 idle_timeout=50, in_port=2,dl_src=00:66:77:88:99:aa actions=drop
1834 idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=drop
1835 idle_timeout=70, in_port=2,dl_src=00:88:99:aa:bb:cc actions=drop
1836 idle_timeout=80, in_port=2,dl_src=00:99:aa:bb:cc:dd actions=drop
1837 in_port=2,dl_src=00:55:66:77:88:99 actions=drop
1840 # Reducing the flow limit also causes the flows that expire soonest
1841 # overall to be evicted.
1842 AT_CHECK([ovs-vsctl set Flow_Table evict flow-limit=4])
1843 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1844 idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=drop
1845 idle_timeout=70, in_port=2,dl_src=00:88:99:aa:bb:cc actions=drop
1846 idle_timeout=80, in_port=2,dl_src=00:99:aa:bb:cc:dd actions=drop
1847 in_port=2,dl_src=00:55:66:77:88:99 actions=drop
1853 AT_SETUP([ofproto - eviction upon table overflow, with fairness (OpenFlow 1.2)])
1855 # Configure a maximum of 4 flows.
1858 -- --id=@t0 create Flow_Table name=evict flow-limit=4 \
1859 overflow-policy=evict \
1860 groups='"NXM_OF_IN_PORT[[]]"' \
1861 -- set bridge br0 flow_tables:0=@t0 \
1862 | ${PERL} $srcdir/uuidfilt.pl],
1866 ovs-ofctl -O OpenFlow12 add-flows br0 - <<EOF
1867 idle_timeout=10 in_port=2 dl_src=00:44:55:66:77:88 actions=drop
1868 idle_timeout=20 in_port=1 dl_src=00:11:22:33:44:55 actions=drop
1869 idle_timeout=30 in_port=1 dl_src=00:22:33:44:55:66 actions=drop
1870 idle_timeout=40 in_port=1 dl_src=00:33:44:55:66:77 actions=drop
1872 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1873 idle_timeout=10, in_port=2,dl_src=00:44:55:66:77:88 actions=drop
1874 idle_timeout=20, in_port=1,dl_src=00:11:22:33:44:55 actions=drop
1875 idle_timeout=30, in_port=1,dl_src=00:22:33:44:55:66 actions=drop
1876 idle_timeout=40, in_port=1,dl_src=00:33:44:55:66:77 actions=drop
1877 OFPST_FLOW reply (OF1.2):
1879 # Adding another flow will cause the one that expires soonest within
1880 # the largest group (those with in_port=1) to be evicted. In this
1881 # case this is not the same as the one that expires soonest overall
1882 # (which is what makes the test interesting):
1883 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 in_port=2,dl_src=00:55:66:77:88:99,actions=drop])
1884 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1885 idle_timeout=10, in_port=2,dl_src=00:44:55:66:77:88 actions=drop
1886 idle_timeout=30, in_port=1,dl_src=00:22:33:44:55:66 actions=drop
1887 idle_timeout=40, in_port=1,dl_src=00:33:44:55:66:77 actions=drop
1888 in_port=2,dl_src=00:55:66:77:88:99 actions=drop
1889 OFPST_FLOW reply (OF1.2):
1891 # Enlarge the flow limit, change the eviction policy back to strictly
1892 # based on expiration, and and add some flows.
1893 AT_CHECK([ovs-vsctl set Flow_Table evict groups='[[]]' flow-limit=7])
1894 ovs-ofctl -O OpenFlow12 add-flows br0 - <<EOF
1895 idle_timeout=50 in_port=2 dl_src=00:66:77:88:99:aa actions=drop
1896 idle_timeout=60 in_port=2 dl_src=00:77:88:99:aa:bb actions=drop
1897 idle_timeout=70 in_port=2 dl_src=00:88:99:aa:bb:cc actions=drop
1899 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1900 idle_timeout=10, in_port=2,dl_src=00:44:55:66:77:88 actions=drop
1901 idle_timeout=30, in_port=1,dl_src=00:22:33:44:55:66 actions=drop
1902 idle_timeout=40, in_port=1,dl_src=00:33:44:55:66:77 actions=drop
1903 idle_timeout=50, in_port=2,dl_src=00:66:77:88:99:aa actions=drop
1904 idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=drop
1905 idle_timeout=70, in_port=2,dl_src=00:88:99:aa:bb:cc actions=drop
1906 in_port=2,dl_src=00:55:66:77:88:99 actions=drop
1907 OFPST_FLOW reply (OF1.2):
1909 # Adding another flow will cause the one that expires soonest overall
1911 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'])
1912 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1913 idle_timeout=30, in_port=1,dl_src=00:22:33:44:55:66 actions=drop
1914 idle_timeout=40, in_port=1,dl_src=00:33:44:55:66:77 actions=drop
1915 idle_timeout=50, in_port=2,dl_src=00:66:77:88:99:aa actions=drop
1916 idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=drop
1917 idle_timeout=70, in_port=2,dl_src=00:88:99:aa:bb:cc actions=drop
1918 idle_timeout=80, in_port=2,dl_src=00:99:aa:bb:cc:dd actions=drop
1919 in_port=2,dl_src=00:55:66:77:88:99 actions=drop
1920 OFPST_FLOW reply (OF1.2):
1922 # Reducing the flow limit also causes the flows that expire soonest
1923 # overall to be evicted.
1924 AT_CHECK([ovs-vsctl set Flow_Table evict flow-limit=4])
1925 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1926 idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=drop
1927 idle_timeout=70, in_port=2,dl_src=00:88:99:aa:bb:cc actions=drop
1928 idle_timeout=80, in_port=2,dl_src=00:99:aa:bb:cc:dd actions=drop
1929 in_port=2,dl_src=00:55:66:77:88:99 actions=drop
1930 OFPST_FLOW reply (OF1.2):
1935 AT_SETUP([ofproto - eviction upon table overflow, with modified hard timeout])
1937 # Configure a maximum of 4 flows.
1940 -- --id=@t0 create Flow_Table flow-limit=4 overflow-policy=evict \
1941 -- set bridge br0 flow_tables:0=@t0 \
1942 | ${PERL} $srcdir/uuidfilt.pl],
1945 ovs-appctl time/stop
1947 for in_port in 4 3 2 1; do
1948 ovs-ofctl add-flow br0 hard_timeout=$((10 + in_port * 3)),in_port=$in_port,actions=drop
1950 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1951 hard_timeout=13, in_port=1 actions=drop
1952 hard_timeout=16, in_port=2 actions=drop
1953 hard_timeout=19, in_port=3 actions=drop
1954 hard_timeout=22, in_port=4 actions=drop
1957 # Sleep and modify the one that expires soonest
1958 ovs-appctl time/warp 5000
1959 AT_CHECK([ovs-ofctl mod-flows br0 in_port=1,actions=drop])
1960 # At this point the table would looks like:
1961 # in_port seconds to expire
1966 ovs-appctl time/warp 2000
1967 # Adding another flow will cause the one that expires soonest to be evicted.
1968 AT_CHECK([ovs-ofctl add-flow br0 in_port=5,actions=drop])
1969 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1970 hard_timeout=13, in_port=1 actions=drop
1971 hard_timeout=19, in_port=3 actions=drop
1972 hard_timeout=22, in_port=4 actions=drop
1973 in_port=5 actions=drop
1979 AT_SETUP([ofproto - eviction upon table overflow, with modified idle timeout])
1980 OVS_VSWITCHD_START([add-port br0 p1 -- set interface p1 type=dummy ofport_request=1])
1981 # Configure a maximum of 4 flows.
1984 -- --id=@t0 create Flow_Table flow-limit=4 overflow-policy=evict \
1985 -- set bridge br0 flow_tables:0=@t0 \
1986 | ${PERL} $srcdir/uuidfilt.pl],
1990 for in_port in 4 3 2 1; do
1991 ovs-ofctl add-flow br0 idle_timeout=$((10 + in_port * 3)),in_port=$in_port,actions=drop
1993 ovs-appctl time/stop
1994 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1995 idle_timeout=13, in_port=1 actions=drop
1996 idle_timeout=16, in_port=2 actions=drop
1997 idle_timeout=19, in_port=3 actions=drop
1998 idle_timeout=22, in_port=4 actions=drop
2001 # Sleep and receive on the flow that expires soonest
2002 ovs-appctl time/warp 5000
2003 AT_CHECK([ovs-appctl netdev-dummy/receive p1 'in_port(1)'])
2004 # At this point the table would looks like:
2005 # in_port seconds to expire
2010 ovs-appctl time/warp 2000
2011 # Adding another flow will cause the one that expires soonest to be evicted.
2012 AT_CHECK([ovs-ofctl add-flow br0 in_port=5,actions=drop])
2013 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
2014 idle_timeout=19, in_port=3 actions=drop
2015 idle_timeout=22, in_port=4 actions=drop
2016 in_port=5 actions=drop
2017 n_packets=1, n_bytes=60, idle_timeout=13, in_port=1 actions=drop
2023 AT_SETUP([ofproto - asynchronous message control (OpenFlow 1.0)])
2025 AT_CHECK([ovs-ofctl -P openflow10 monitor br0 --detach --no-chdir --pidfile])
2027 printf '\n\n--- check_async %d ---\n\n\n' $1
2030 ovs-appctl -t ovs-ofctl ofctl/barrier
2031 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
2034 # OFPT_PACKET_IN, OFPR_ACTION (controller_id=0)
2035 ovs-ofctl -v packet-out br0 controller controller '0001020304050010203040501234'
2036 if test X"$1" = X"OFPR_ACTION"; then shift;
2037 echo >>expout "OFPT_PACKET_IN: total_len=14 in_port=CONTROLLER (via action) data_len=14 (unbuffered)
2038 in_port=0,vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1234"
2041 # OFPT_PACKET_IN, OFPR_NO_MATCH (controller_id=123)
2042 ovs-ofctl -v packet-out br0 controller 'controller(reason=no_match,id=123)' '0001020304050010203040501234'
2043 if test X"$1" = X"OFPR_NO_MATCH"; then shift;
2044 echo >>expout "OFPT_PACKET_IN: total_len=14 in_port=CONTROLLER (via no_match) data_len=14 (unbuffered)
2045 in_port=0,vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1234"
2048 # OFPT_PACKET_IN, OFPR_INVALID_TTL (controller_id=0)
2049 ovs-ofctl packet-out br0 controller dec_ttl '002583dfb4000026b98cb0f908004500003eb7e200000011339bac11370dac100002d7730035002b8f6d86fb0100000100000000000006626c702d7873066e696369726103636f6d00000f00'
2050 if test X"$1" = X"OFPR_INVALID_TTL"; then shift;
2051 echo >>expout "OFPT_PACKET_IN: total_len=76 in_port=CONTROLLER (via invalid_ttl) data_len=76 (unbuffered)
2052 udp,in_port=0,vlan_tci=0x0000,dl_src=00:26:b9:8c:b0:f9,dl_dst=00:25:83:df:b4:00,nw_src=172.17.55.13,nw_dst=172.16.0.2,nw_tos=0,nw_ecn=0,nw_ttl=0,tp_src=55155,tp_dst=53 udp_csum:8f6d"
2055 # OFPT_PORT_STATUS, OFPPR_ADD
2056 ovs-vsctl add-port br0 test -- set Interface test type=dummy ofport_request=1
2057 if test X"$1" = X"OFPPR_ADD"; then shift;
2058 echo >>expout "OFPT_PORT_STATUS: ADD: 1(test): addr:aa:55:aa:55:00:0x
2061 speed: 0 Mbps now, 0 Mbps max"
2064 # OFPT_PORT_STATUS, OFPPR_DELETE
2065 ovs-vsctl del-port br0 test
2066 if test X"$1" = X"OFPPR_DELETE"; then shift;
2067 echo >>expout "OFPT_PORT_STATUS: DEL: 1(test): addr:aa:55:aa:55:00:0x
2070 speed: 0 Mbps now, 0 Mbps max"
2073 # OFPT_FLOW_REMOVED, OFPRR_DELETE
2074 ovs-ofctl add-flow br0 send_flow_rem,actions=drop
2075 ovs-ofctl --strict del-flows br0 ''
2076 if test X"$1" = X"OFPRR_DELETE"; then shift;
2077 echo >>expout "OFPT_FLOW_REMOVED: reason=delete"
2079 AT_FAIL_IF([test X"$1" != X])
2081 ovs-appctl -t ovs-ofctl ofctl/barrier
2082 echo >>expout "OFPT_BARRIER_REPLY:"
2086 s/ (xid=0x[0-9a-fA-F]*)//
2088 s/00:0.$/00:0x/' < monitor.log]],
2092 # It's a service connection so initially there should be no async messages.
2095 # Set miss_send_len to 128, turning on packet-ins for our service connection.
2096 ovs-appctl -t ovs-ofctl ofctl/send 0109000c0123456700000080
2097 check_async 2 OFPR_ACTION OFPPR_ADD OFPPR_DELETE OFPRR_DELETE
2099 # Set miss_send_len to 128 and enable invalid_ttl.
2100 ovs-appctl -t ovs-ofctl ofctl/send 0109000c0123456700040080
2101 check_async 3 OFPR_ACTION OFPR_INVALID_TTL OFPPR_ADD OFPPR_DELETE OFPRR_DELETE
2103 # Become slave, which should disable everything except port status.
2104 ovs-appctl -t ovs-ofctl ofctl/send 0104001400000002000023200000000a00000002
2105 check_async 4 OFPPR_ADD OFPPR_DELETE
2107 # Use NXT_SET_ASYNC_CONFIG to enable a patchwork of asynchronous messages.
2108 ovs-appctl -t ovs-ofctl ofctl/send 01040028000000020000232000000013000000020000000500000005000000020000000200000005
2109 check_async 5 OFPR_INVALID_TTL OFPPR_DELETE OFPRR_DELETE
2111 # Set controller ID 123.
2112 ovs-appctl -t ovs-ofctl ofctl/send 01040018000000030000232000000014000000000000007b
2113 check_async 6 OFPR_NO_MATCH OFPPR_DELETE OFPRR_DELETE
2115 # Restore controller ID 0.
2116 ovs-appctl -t ovs-ofctl ofctl/send 010400180000000300002320000000140000000000000000
2119 ovs-appctl -t ovs-ofctl ofctl/send 0104001400000002000023200000000a00000001
2120 check_async 7 OFPR_ACTION OFPPR_ADD
2122 ovs-appctl -t ovs-ofctl exit
2126 AT_SETUP([ofproto - asynchronous message control (OpenFlow 1.2)])
2128 AT_CHECK([ovs-ofctl -O OpenFlow12 monitor br0 --detach --no-chdir --pidfile])
2130 printf '\n\n--- check_async %d ---\n\n\n' $1
2134 ovs-appctl -t ovs-ofctl ofctl/barrier
2135 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
2138 # OFPT_PACKET_IN, OFPR_ACTION (controller_id=0)
2139 ovs-ofctl -O OpenFlow12 -v packet-out br0 none controller '0001020304050010203040501234'
2140 if test X"$1" = X"OFPR_ACTION"; then shift;
2141 echo >>expout "OFPT_PACKET_IN (OF1.2): total_len=14 in_port=ANY (via action) data_len=14 (unbuffered)
2142 in_port=0,vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1234"
2145 # OFPT_PACKET_IN, OFPR_NO_MATCH (controller_id=123)
2146 ovs-ofctl -O OpenFlow12 -v packet-out br0 none 'controller(reason=no_match,id=123)' '0001020304050010203040501234'
2147 if test X"$1" = X"OFPR_NO_MATCH"; then shift;
2148 echo >>expout "OFPT_PACKET_IN (OF1.2): total_len=14 in_port=ANY (via no_match) data_len=14 (unbuffered)
2149 in_port=0,vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1234"
2152 # OFPT_PACKET_IN, OFPR_INVALID_TTL (controller_id=0)
2153 ovs-ofctl -O OpenFlow12 packet-out br0 none dec_ttl '002583dfb4000026b98cb0f908004500003eb7e200000011339bac11370dac100002d7730035002b8f6d86fb0100000100000000000006626c702d7873066e696369726103636f6d00000f00'
2154 if test X"$1" = X"OFPR_INVALID_TTL"; then shift;
2155 echo >>expout "OFPT_PACKET_IN (OF1.2): total_len=76 in_port=ANY (via invalid_ttl) data_len=76 (unbuffered)
2156 udp,in_port=0,vlan_tci=0x0000,dl_src=00:26:b9:8c:b0:f9,dl_dst=00:25:83:df:b4:00,nw_src=172.17.55.13,nw_dst=172.16.0.2,nw_tos=0,nw_ecn=0,nw_ttl=0,tp_src=55155,tp_dst=53 udp_csum:8f6d"
2159 # OFPT_PORT_STATUS, OFPPR_ADD
2160 ovs-vsctl add-port br0 test -- set Interface test type=dummy
2161 if test X"$1" = X"OFPPR_ADD"; then shift;
2162 echo >>expout "OFPT_PORT_STATUS (OF1.2): ADD: ${INDEX}(test): addr:aa:55:aa:55:00:0x
2165 speed: 0 Mbps now, 0 Mbps max"
2168 # OFPT_PORT_STATUS, OFPPR_DELETE
2169 ovs-vsctl del-port br0 test
2170 if test X"$1" = X"OFPPR_DELETE"; then shift;
2171 echo >>expout "OFPT_PORT_STATUS (OF1.2): DEL: ${INDEX}(test): addr:aa:55:aa:55:00:0x
2174 speed: 0 Mbps now, 0 Mbps max"
2177 # OFPT_FLOW_REMOVED, OFPRR_DELETE
2178 ovs-ofctl -O OpenFlow12 add-flow br0 send_flow_rem,actions=drop
2179 ovs-ofctl -O OpenFlow12 --strict del-flows br0 ''
2180 if test X"$1" = X"OFPRR_DELETE"; then shift;
2181 echo >>expout "OFPT_FLOW_REMOVED (OF1.2): reason=delete table_id=0"
2183 AT_FAIL_IF([test X"$1" != X])
2185 ovs-appctl -t ovs-ofctl ofctl/barrier
2186 echo >>expout "OFPT_BARRIER_REPLY (OF1.2):"
2190 s/ (xid=0x[0-9a-fA-F]*)//
2192 s/00:0.$/00:0x/' < monitor.log]],
2196 # It's a service connection so initially there should be no async messages.
2199 # Set miss_send_len to 128, turning on packet-ins for our service connection.
2200 ovs-appctl -t ovs-ofctl ofctl/send 0309000c0123456700000080
2201 check_async 2 OFPR_ACTION OFPPR_ADD OFPPR_DELETE OFPRR_DELETE
2203 # Set miss_send_len to 128 and enable invalid_ttl.
2204 ovs-appctl -t ovs-ofctl ofctl/send 0309000c0123456700040080
2205 check_async 3 OFPR_ACTION OFPR_INVALID_TTL OFPPR_ADD OFPPR_DELETE OFPRR_DELETE
2207 # Become slave (OF 1.2), which should disable everything except port status.
2208 ovs-appctl -t ovs-ofctl ofctl/send 031800180000000200000003000000000000000000000001
2209 check_async 4 OFPPR_ADD OFPPR_DELETE
2211 # Use NXT_SET_ASYNC_CONFIG to enable a patchwork of asynchronous messages.
2212 ovs-appctl -t ovs-ofctl ofctl/send 03040028000000020000232000000013000000020000000500000005000000020000000200000005
2213 check_async 5 OFPR_INVALID_TTL OFPPR_DELETE OFPRR_DELETE
2215 # Set controller ID 123.
2216 ovs-appctl -t ovs-ofctl ofctl/send 03040018000000030000232000000014000000000000007b
2217 check_async 6 OFPR_NO_MATCH OFPPR_DELETE OFPRR_DELETE
2219 # Restore controller ID 0.
2220 ovs-appctl -t ovs-ofctl ofctl/send 030400180000000300002320000000140000000000000000
2222 # Become master (OF 1.2).
2223 ovs-appctl -t ovs-ofctl ofctl/send 031800180000000400000002000000000000000000000002
2224 check_async 7 OFPR_ACTION OFPPR_ADD
2226 ovs-appctl -t ovs-ofctl exit
2230 AT_SETUP([ofproto - asynchronous message control (OpenFlow 1.3)])
2232 AT_CHECK([ovs-ofctl -O OpenFlow13 monitor br0 --detach --no-chdir --pidfile])
2234 printf '\n\n--- check_async %d ---\n\n\n' $1
2238 ovs-appctl -t ovs-ofctl ofctl/barrier
2239 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
2242 # OFPT_PACKET_IN, OFPR_ACTION (controller_id=0)
2243 ovs-ofctl -O OpenFlow13 -v packet-out br0 none controller '0001020304050010203040501234'
2244 if test X"$1" = X"OFPR_ACTION"; then shift;
2245 echo >>expout "OFPT_PACKET_IN (OF1.3): total_len=14 in_port=ANY (via action) data_len=14 (unbuffered)
2246 in_port=0,vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1234"
2249 # OFPT_PACKET_IN, OFPR_NO_MATCH (controller_id=123)
2250 ovs-ofctl -O OpenFlow13 -v packet-out br0 none 'controller(reason=no_match,id=123)' '0001020304050010203040501234'
2251 if test X"$1" = X"OFPR_NO_MATCH"; then shift;
2252 echo >>expout "OFPT_PACKET_IN (OF1.3): total_len=14 in_port=ANY (via no_match) data_len=14 (unbuffered)
2253 in_port=0,vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1234"
2256 # OFPT_PACKET_IN, OFPR_INVALID_TTL (controller_id=0)
2257 ovs-ofctl -O OpenFlow13 packet-out br0 none dec_ttl '002583dfb4000026b98cb0f908004500003eb7e200000011339bac11370dac100002d7730035002b8f6d86fb0100000100000000000006626c702d7873066e696369726103636f6d00000f00'
2258 if test X"$1" = X"OFPR_INVALID_TTL"; then shift;
2259 echo >>expout "OFPT_PACKET_IN (OF1.3): total_len=76 in_port=ANY (via invalid_ttl) data_len=76 (unbuffered)
2260 udp,in_port=0,vlan_tci=0x0000,dl_src=00:26:b9:8c:b0:f9,dl_dst=00:25:83:df:b4:00,nw_src=172.17.55.13,nw_dst=172.16.0.2,nw_tos=0,nw_ecn=0,nw_ttl=0,tp_src=55155,tp_dst=53 udp_csum:8f6d"
2263 # OFPT_PORT_STATUS, OFPPR_ADD
2264 ovs-vsctl add-port br0 test -- set Interface test type=dummy
2265 if test X"$1" = X"OFPPR_ADD"; then shift;
2266 echo >>expout "OFPT_PORT_STATUS (OF1.3): ADD: ${INDEX}(test): addr:aa:55:aa:55:00:0x
2269 speed: 0 Mbps now, 0 Mbps max"
2272 # OFPT_PORT_STATUS, OFPPR_DELETE
2273 ovs-vsctl del-port br0 test
2274 if test X"$1" = X"OFPPR_DELETE"; then shift;
2275 echo >>expout "OFPT_PORT_STATUS (OF1.3): DEL: ${INDEX}(test): addr:aa:55:aa:55:00:0x
2278 speed: 0 Mbps now, 0 Mbps max"
2281 # OFPT_FLOW_REMOVED, OFPRR_DELETE
2282 ovs-ofctl -O OpenFlow13 add-flow br0 send_flow_rem,actions=drop
2283 ovs-ofctl -O OpenFlow13 --strict del-flows br0 ''
2284 if test X"$1" = X"OFPRR_DELETE"; then shift;
2285 echo >>expout "OFPT_FLOW_REMOVED (OF1.3): reason=delete table_id=0"
2288 # OFPT_FLOW_REMOVED, OFPRR_GROUP_DELETE
2289 ovs-ofctl -O OpenFlow13 add-group br0 group_id=1234,type=all,bucket=output:10
2290 ovs-ofctl -O OpenFlow13 add-flow br0 send_flow_rem,actions=group:1234
2291 ovs-ofctl -O OpenFlow13 --strict del-groups br0 group_id=1234
2292 if test X"$1" = X"OFPRR_DELETE"; then shift;
2293 echo >>expout "OFPT_FLOW_REMOVED (OF1.3): reason=gropu_delete table_id=0"
2296 AT_FAIL_IF([test X"$1" != X])
2298 ovs-appctl -t ovs-ofctl ofctl/barrier
2299 echo >>expout "OFPT_BARRIER_REPLY (OF1.3):"
2303 s/ (xid=0x[0-9a-fA-F]*)//
2305 s/00:0.$/00:0x/' < monitor.log]],
2309 # It's a service connection so initially there should be no async messages.
2312 # Set miss_send_len to 128, turning on packet-ins for our service connection.
2313 ovs-appctl -t ovs-ofctl ofctl/send 0409000c0123456700000080
2314 check_async 2 OFPR_ACTION OFPPR_ADD OFPPR_DELETE OFPRR_DELETE
2316 # Become slave (OF 1.3), which should disable everything except port status.
2317 ovs-appctl -t ovs-ofctl ofctl/send 041800180000000200000003000000000000000000000001
2318 check_async 3 OFPPR_ADD OFPPR_DELETE
2320 # Use OF 1.3 OFPT_SET_ASYNC to enable a patchwork of asynchronous messages.
2321 ovs-appctl -t ovs-ofctl ofctl/send 041c002000000002000000020000000500000005000000020000000200000005
2322 check_async 4 OFPR_INVALID_TTL OFPPR_DELETE OFPRR_DELETE
2324 # Set controller ID 123.
2325 ovs-appctl -t ovs-ofctl ofctl/send 04040018000000030000232000000014000000000000007b
2326 check_async 5 OFPR_NO_MATCH OFPPR_DELETE OFPRR_DELETE
2328 # Restore controller ID 0.
2329 ovs-appctl -t ovs-ofctl ofctl/send 040400180000000300002320000000140000000000000000
2331 # Become master (OF 1.3).
2332 ovs-appctl -t ovs-ofctl ofctl/send 041800180000000400000002000000000000000000000002
2333 check_async 6 OFPR_ACTION OFPPR_ADD
2335 ovs-appctl -t ovs-ofctl exit
2339 AT_SETUP([ofproto - asynchronous message control (OpenFlow 1.5)])
2341 AT_CHECK([ovs-ofctl -O OpenFlow15 monitor br0 --detach --no-chdir --pidfile])
2343 printf '\n\n--- check_async %d ---\n\n\n' $1
2347 ovs-appctl -t ovs-ofctl ofctl/barrier
2348 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
2351 # Other tests are not working with OF 1.5, and message
2352 # format may change, so leave them out.
2354 # OFPT_PORT_STATUS, OFPPR_ADD
2355 ovs-vsctl add-port br0 test -- set Interface test type=dummy
2356 if test X"$1" = X"OFPPR_ADD"; then shift;
2357 echo >>expout "OFPT_PORT_STATUS (OF1.5): ADD: ${INDEX}(test): addr:aa:55:aa:55:00:0x
2360 speed: 0 Mbps now, 0 Mbps max"
2363 # OFPT_PORT_STATUS, OFPPR_MODIFY
2364 ovs-ofctl -O OpenFlow15 -vwarn mod-port br0 test up
2365 if test X"$1" = X"OFPPR_MODIFY"; then shift;
2366 echo >>expout "OFPT_PORT_STATUS (OF1.5): MOD: ${INDEX}(test): addr:aa:55:aa:55:00:0x
2369 speed: 0 Mbps now, 0 Mbps max
2370 OFPT_PORT_STATUS (OF1.5): MOD: 2(test): addr:aa:55:aa:55:00:0x
2373 speed: 0 Mbps now, 0 Mbps max"
2376 # OFPT_PORT_STATUS, OFPPR_DELETE
2377 ovs-vsctl del-port br0 test
2378 if test X"$1" = X"OFPPR_DELETE"; then shift;
2379 echo >>expout "OFPT_PORT_STATUS (OF1.5): DEL: ${INDEX}(test): addr:aa:55:aa:55:00:0x
2382 speed: 0 Mbps now, 0 Mbps max"
2385 AT_FAIL_IF([test X"$1" != X])
2387 ovs-appctl -t ovs-ofctl ofctl/barrier
2388 echo >>expout "OFPT_BARRIER_REPLY (OF1.5):"
2392 s/ (xid=0x[0-9a-fA-F]*)//
2394 s/00:0.$/00:0x/' < monitor.log]],
2398 # It's a service connection so initially there should be no async messages.
2401 # If we don't set this, async messages are not received.
2402 # Set miss_send_len to 128, turning on packet-ins for our service connection.
2403 ovs-appctl -t ovs-ofctl ofctl/send 0609000c0123456700000080
2404 check_async 2 OFPPR_ADD OFPPR_MODIFY OFPPR_DELETE
2406 # Set-async has changed in OF 1.4 and is not yet implemented.
2408 ovs-appctl -t ovs-ofctl exit
2412 dnl This test checks that the role request/response messaging works
2413 dnl and that generation_id is handled properly.
2414 AT_SETUP([ofproto - controller role (OpenFlow 1.2)])
2416 ON_EXIT([kill `cat c1.pid c2.pid`])
2418 # Start two ovs-ofctl controller processes.
2419 AT_CAPTURE_FILE([monitor1.log])
2420 AT_CAPTURE_FILE([expout1])
2421 AT_CAPTURE_FILE([experr1])
2422 AT_CAPTURE_FILE([monitor2.log])
2423 AT_CAPTURE_FILE([expout2])
2424 AT_CAPTURE_FILE([experr2])
2426 AT_CHECK([ovs-ofctl -O OpenFlow12 monitor br0 --detach --no-chdir --pidfile=`pwd`/c$i.pid --unixctl=`pwd`/c$i])
2427 ovs-appctl -t `pwd`/c$i ofctl/barrier
2428 ovs-appctl -t `pwd`/c$i ofctl/set-output-file monitor$i.log
2432 # find out current role
2433 ovs-appctl -t `pwd`/c$i ofctl/send 031800180000000200000000000000000000000000000000
2434 echo >>experr$i "send: OFPT_ROLE_REQUEST (OF1.2): role=nochange"
2435 echo >>expout$i "OFPT_ROLE_REPLY (OF1.2): role=equal"
2438 # controller 1: Become slave (generation_id is initially undefined, so
2439 # 2^63+2 should not be stale)
2440 ovs-appctl -t `pwd`/c1 ofctl/send 031800180000000300000003000000008000000000000002
2441 echo >>experr1 "send: OFPT_ROLE_REQUEST (OF1.2): role=slave generation_id=9223372036854775810"
2442 echo >>expout1 "OFPT_ROLE_REPLY (OF1.2): role=slave generation_id=9223372036854775810"
2444 # controller 2: Become master.
2445 ovs-appctl -t `pwd`/c2 ofctl/send 031800180000000300000002000000008000000000000003
2446 echo >>experr2 "send: OFPT_ROLE_REQUEST (OF1.2): role=master generation_id=9223372036854775811"
2447 echo >>expout2 "OFPT_ROLE_REPLY (OF1.2): role=master generation_id=9223372036854775811"
2449 # controller 1: Try to become the master using a stale generation ID
2450 ovs-appctl -t `pwd`/c1 ofctl/send 031800180000000400000002000000000000000000000003
2451 echo >>experr1 "send: OFPT_ROLE_REQUEST (OF1.2): role=master generation_id=3"
2452 echo >>expout1 "OFPT_ERROR (OF1.2): OFPRRFC_STALE"
2453 echo >>expout1 "OFPT_ROLE_REQUEST (OF1.2): role=master generation_id=3"
2455 # controller 1: Become master using a valid generation ID
2456 ovs-appctl -t `pwd`/c1 ofctl/send 031800180000000500000002000000000000000000000001
2457 echo >>experr1 "send: OFPT_ROLE_REQUEST (OF1.2): role=master generation_id=1"
2458 echo >>expout1 "OFPT_ROLE_REPLY (OF1.2): role=master generation_id=1"
2461 ovs-appctl -t `pwd`/c$i ofctl/barrier
2462 echo >>expout$i "OFPT_BARRIER_REPLY (OF1.2):"
2468 AT_CHECK([grep -v '^send:' monitor$i.log | STRIP_XIDS], [0], [expout])
2470 AT_CHECK([grep '^send:' monitor$i.log | STRIP_XIDS], [0], [expout])
2475 dnl This test checks that the role request/response messaging works,
2476 dnl that generation_id is handled properly, and that role status update
2477 dnl messages are sent when a controller's role gets changed from master
2479 AT_SETUP([ofproto - controller role (OpenFlow 1.4)])
2481 ON_EXIT([kill `cat c1.pid c2.pid`])
2483 # Start two ovs-ofctl controller processes.
2484 AT_CAPTURE_FILE([monitor1.log])
2485 AT_CAPTURE_FILE([expout1])
2486 AT_CAPTURE_FILE([experr1])
2487 AT_CAPTURE_FILE([monitor2.log])
2488 AT_CAPTURE_FILE([expout2])
2489 AT_CAPTURE_FILE([experr2])
2491 AT_CHECK([ovs-ofctl -O OpenFlow14 monitor br0 --detach --no-chdir --pidfile=`pwd`/c$i.pid --unixctl=`pwd`/c$i])
2492 ovs-appctl -t `pwd`/c$i ofctl/barrier
2493 ovs-appctl -t `pwd`/c$i ofctl/set-output-file monitor$i.log
2497 # find out current role
2498 ovs-appctl -t `pwd`/c$i ofctl/send 051800180000000200000000000000000000000000000000
2499 echo >>experr$i "send: OFPT_ROLE_REQUEST (OF1.4): role=nochange"
2500 echo >>expout$i "OFPT_ROLE_REPLY (OF1.4): role=equal"
2503 # controller 1: Become slave (generation_id is initially undefined, so
2504 # 2^63+2 should not be stale)
2505 ovs-appctl -t `pwd`/c1 ofctl/send 051800180000000300000003000000008000000000000002
2506 echo >>experr1 "send: OFPT_ROLE_REQUEST (OF1.4): role=slave generation_id=9223372036854775810"
2507 echo >>expout1 "OFPT_ROLE_REPLY (OF1.4): role=slave generation_id=9223372036854775810"
2509 # controller 2: Become master.
2510 ovs-appctl -t `pwd`/c2 ofctl/send 051800180000000300000002000000008000000000000003
2511 echo >>experr2 "send: OFPT_ROLE_REQUEST (OF1.4): role=master generation_id=9223372036854775811"
2512 echo >>expout2 "OFPT_ROLE_REPLY (OF1.4): role=master generation_id=9223372036854775811"
2514 # controller 1: Try to become the master using a stale generation ID
2515 ovs-appctl -t `pwd`/c1 ofctl/send 051800180000000400000002000000000000000000000003
2516 echo >>experr1 "send: OFPT_ROLE_REQUEST (OF1.4): role=master generation_id=3"
2517 echo >>expout1 "OFPT_ERROR (OF1.4): OFPRRFC_STALE"
2518 echo >>expout1 "OFPT_ROLE_REQUEST (OF1.4): role=master generation_id=3"
2520 # controller 1: Become master using a valid generation ID
2521 ovs-appctl -t `pwd`/c1 ofctl/send 051800180000000500000002000000000000000000000001
2522 echo >>experr1 "send: OFPT_ROLE_REQUEST (OF1.4): role=master generation_id=1"
2523 echo >>expout1 "OFPT_ROLE_REPLY (OF1.4): role=master generation_id=1"
2524 echo >>expout2 "OFPT_ROLE_STATUS (OF1.4): role=slave generation_id=1 reason=master_request"
2527 ovs-appctl -t `pwd`/c$i ofctl/barrier
2528 echo >>expout$i "OFPT_BARRIER_REPLY (OF1.4):"
2534 AT_CHECK([grep -v '^send:' monitor$i.log | STRIP_XIDS], [0], [expout])
2536 AT_CHECK([grep '^send:' monitor$i.log | STRIP_XIDS], [0], [expout])
2541 dnl This test checks that OFPT_PACKET_OUT accepts both OFPP_NONE (as
2542 dnl specified by OpenFlow 1.0) and OFPP_CONTROLLER (used by some
2543 dnl controllers despite the spec) as meaning a packet that was generated
2544 dnl by the controller.
2545 AT_SETUP([ofproto - packet-out from controller (OpenFlow 1.0)])
2547 ADD_OF_PORTS([br0], [1])
2549 # Start a monitor listening for packet-ins.
2550 AT_CHECK([ovs-ofctl -P openflow10 monitor br0 --detach --no-chdir --pidfile])
2551 ovs-appctl -t ovs-ofctl ofctl/send 0109000c0123456700000080
2552 ovs-appctl -t ovs-ofctl ofctl/barrier
2553 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
2554 AT_CAPTURE_FILE([monitor.log])
2556 # Send some packet-outs with OFPP_NONE and OFPP_CONTROLLER (65533) as in_port.
2557 AT_CHECK([ovs-ofctl packet-out br0 none controller,1 '0001020304050010203040501234'])
2558 AT_CHECK([ovs-ofctl packet-out br0 controller controller,1 '0001020304050010203040505678'])
2560 # Stop the monitor and check its output.
2561 ovs-appctl -t ovs-ofctl ofctl/barrier
2562 ovs-appctl -t ovs-ofctl exit
2564 ovs-ofctl dump-ports br0
2566 AT_CHECK([sed 's/ (xid=0x[[0-9a-fA-F]]*)//' monitor.log], [0], [dnl
2567 OFPT_PACKET_IN: total_len=14 in_port=ANY (via action) data_len=14 (unbuffered)
2568 in_port=0,vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1234
2569 OFPT_PACKET_IN: total_len=14 in_port=CONTROLLER (via action) data_len=14 (unbuffered)
2570 in_port=0,vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x5678
2577 dnl This test checks that OFPT_PACKET_OUT accepts both OFPP_NONE (as
2578 dnl specified by OpenFlow 1.2) and OFPP_CONTROLLER (used by some
2579 dnl controllers despite the spec) as meaning a packet that was generated
2580 dnl by the controller.
2581 AT_SETUP([ofproto - packet-out from controller (OpenFlow 1.2)])
2584 # Start a monitor listening for packet-ins.
2585 AT_CHECK([ovs-ofctl -O OpenFlow12 monitor br0 --detach --no-chdir --pidfile])
2586 ovs-appctl -t ovs-ofctl ofctl/send 0309000c0123456700000080
2587 ovs-appctl -t ovs-ofctl ofctl/barrier
2588 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
2589 AT_CAPTURE_FILE([monitor.log])
2591 # Send some packet-outs with OFPP_NONE and OFPP_CONTROLLER (65533) as in_port.
2592 AT_CHECK([ovs-ofctl -O OpenFlow12 packet-out br0 none controller '0001020304050010203040501234'])
2593 AT_CHECK([ovs-ofctl -O OpenFlow12 packet-out br0 4294967293 controller '0001020304050010203040505678'])
2595 # Stop the monitor and check its output.
2596 ovs-appctl -t ovs-ofctl ofctl/barrier
2597 ovs-appctl -t ovs-ofctl exit
2599 AT_CHECK([sed 's/ (xid=0x[[0-9a-fA-F]]*)//' monitor.log], [0], [dnl
2600 OFPT_PACKET_IN (OF1.2): total_len=14 in_port=ANY (via action) data_len=14 (unbuffered)
2601 in_port=0,vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1234
2602 OFPT_PACKET_IN (OF1.2): total_len=14 in_port=CONTROLLER (via action) data_len=14 (unbuffered)
2603 in_port=0,vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x5678
2604 OFPT_BARRIER_REPLY (OF1.2):
2610 dnl This test checks that OFPT_PACKET_OUT accepts both OFPP_NONE (as
2611 dnl specified by OpenFlow 1.1) and OFPP_CONTROLLER (used by some
2612 dnl controllers despite the spec) as meaning a packet that was generated
2613 dnl by the controller.
2614 AT_SETUP([ofproto - packet-out from controller (OpenFlow 1.1)])
2617 # Start a monitor listening for packet-ins.
2618 AT_CHECK([ovs-ofctl -O OpenFlow11 monitor br0 --detach --no-chdir --pidfile])
2619 ovs-appctl -t ovs-ofctl ofctl/send 0209000c0123456700000080
2620 ovs-appctl -t ovs-ofctl ofctl/barrier
2621 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
2622 AT_CAPTURE_FILE([monitor.log])
2624 # Send some packet-outs with OFPP_NONE and OFPP_CONTROLLER (65533) as in_port.
2625 AT_CHECK([ovs-ofctl -O OpenFlow11 packet-out br0 none controller '0001020304050010203040501234'])
2626 AT_CHECK([ovs-ofctl -O OpenFlow11 packet-out br0 4294967293 controller '0001020304050010203040505678'])
2628 # Stop the monitor and check its output.
2629 ovs-appctl -t ovs-ofctl ofctl/barrier
2630 ovs-appctl -t ovs-ofctl exit
2632 AT_CHECK([sed 's/ (xid=0x[[0-9a-fA-F]]*)//' monitor.log], [0], [dnl
2633 OFPT_PACKET_IN (OF1.1): total_len=14 in_port=ANY (via action) data_len=14 (unbuffered)
2634 in_port=0,vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1234
2635 OFPT_PACKET_IN (OF1.1): total_len=14 in_port=CONTROLLER (via action) data_len=14 (unbuffered)
2636 in_port=0,vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x5678
2637 OFPT_BARRIER_REPLY (OF1.1):
2643 dnl This test checks that metadata is encoded in packet_in structures,
2644 dnl supported by NXAST.
2645 AT_SETUP([ofproto - packet-out with metadata (NXM)])
2648 # Start a monitor listening for packet-ins.
2649 AT_CHECK([ovs-ofctl -P nxm monitor br0 --detach --no-chdir --pidfile])
2650 ovs-appctl -t ovs-ofctl ofctl/send 0109000c0123456700000080
2651 ovs-appctl -t ovs-ofctl ofctl/barrier
2652 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
2653 AT_CAPTURE_FILE([monitor.log])
2655 # Send a packet-out with a load action to set some metadata, and forward to controller
2656 AT_CHECK([ovs-ofctl packet-out br0 controller 'load(0xfafafafa5a5a5a5a->OXM_OF_METADATA[[0..63]]), load(0xaa->NXM_NX_PKT_MARK[[]]), controller' '0001020304050010203040501234'])
2658 # Stop the monitor and check its output.
2659 ovs-appctl -t ovs-ofctl ofctl/barrier
2660 ovs-appctl -t ovs-ofctl exit
2662 AT_CHECK([sed 's/ (xid=0x[[0-9a-fA-F]]*)//' monitor.log], [0], [dnl
2663 NXT_PACKET_IN: total_len=14 in_port=CONTROLLER metadata=0xfafafafa5a5a5a5a pkt_mark=0xaa (via action) data_len=14 (unbuffered)
2664 in_port=0,vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1234
2671 dnl This test checks that metadata is encoded in packet_in structures,
2672 dnl supported by NXAST.
2673 AT_SETUP([ofproto - packet-out with metadata (OpenFlow 1.2)])
2676 # Start a monitor listening for packet-ins.
2677 AT_CHECK([ovs-ofctl -O OpenFlow12 monitor br0 --detach --no-chdir --pidfile])
2678 ovs-appctl -t ovs-ofctl ofctl/send 0309000c0123456700000080
2679 ovs-appctl -t ovs-ofctl ofctl/barrier
2680 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
2681 AT_CAPTURE_FILE([monitor.log])
2683 # Send a packet-out with a set-field action to set some metadata, and forward to controller
2684 AT_CHECK([ovs-ofctl -O OpenFlow12 packet-out br0 none 'set_field:0xfafafafa5a5a5a5a->metadata, controller' '0001020304050010203040501234'])
2686 # Stop the monitor and check its output.
2687 ovs-appctl -t ovs-ofctl ofctl/barrier
2688 ovs-appctl -t ovs-ofctl exit
2690 AT_CHECK([sed 's/ (xid=0x[[0-9a-fA-F]]*)//' monitor.log], [0], [dnl
2691 OFPT_PACKET_IN (OF1.2): total_len=14 in_port=ANY metadata=0xfafafafa5a5a5a5a (via action) data_len=14 (unbuffered)
2692 in_port=0,vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1234
2693 OFPT_BARRIER_REPLY (OF1.2):
2699 dnl This test checks that metadata is encoded in packet_in structures,
2700 dnl supported by NXAST.
2701 AT_SETUP([ofproto - packet-out with metadata and dual set_field (OpenFlow 1.3)])
2704 # Start a monitor listening for packet-ins.
2705 AT_CHECK([ovs-ofctl -O OpenFlow13 monitor br0 --detach --no-chdir --pidfile])
2706 ovs-appctl -t ovs-ofctl ofctl/send 0409000c0123456700000080
2707 ovs-appctl -t ovs-ofctl ofctl/barrier
2708 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
2709 AT_CAPTURE_FILE([monitor.log])
2711 # Send a packet-out with a couple of set-field action to set some metadata, and forward to controller
2712 AT_CHECK([ovs-ofctl -O OpenFlow13 packet-out br0 none 'set_field:0xfafafafa5a5a5a5a->metadata, set_field:0x6b->metadata, controller' '0001020304050010203040501234'])
2714 # Stop the monitor and check its output.
2715 ovs-appctl -t ovs-ofctl ofctl/barrier
2716 ovs-appctl -t ovs-ofctl exit
2718 AT_CHECK([sed 's/ (xid=0x[[0-9a-fA-F]]*)//' monitor.log], [0], [dnl
2719 OFPT_PACKET_IN (OF1.3): total_len=14 in_port=ANY metadata=0x6b (via action) data_len=14 (unbuffered)
2720 in_port=0,vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1234
2721 OFPT_BARRIER_REPLY (OF1.3):
2727 dnl This test checks that tunnel metadata is encoded in packet_in structures.
2728 AT_SETUP([ofproto - packet-out with tunnel metadata (OpenFlow 1.2)])
2731 # Start a monitor listening for packet-ins.
2732 AT_CHECK([ovs-ofctl -O OpenFlow12 monitor br0 --detach --no-chdir --pidfile])
2733 ovs-appctl -t ovs-ofctl ofctl/send 0309000c0123456700000080
2734 ovs-appctl -t ovs-ofctl ofctl/barrier
2735 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
2736 AT_CAPTURE_FILE([monitor.log])
2738 # Send a packet-out with set field actions to set some tunnel metadata, and forward to controller
2739 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'])
2741 # Stop the monitor and check its output.
2742 ovs-appctl -t ovs-ofctl ofctl/barrier
2743 ovs-appctl -t ovs-ofctl exit
2745 AT_CHECK([sed 's/ (xid=0x[[0-9a-fA-F]]*)//' monitor.log], [0], [dnl
2746 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)
2747 in_port=0,vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1234
2748 OFPT_BARRIER_REPLY (OF1.2):
2754 m4_divert_push([PREPARE_TESTS])
2755 # Sorts groups of lines that start with a space, without moving them
2756 # past the nearest line that does not start with a space.
2766 print $_ foreach sort(@buffer);
2771 print $_ foreach sort(@buffer);
2774 m4_divert_pop([PREPARE_TESTS])
2776 AT_SETUP([ofproto - flow monitoring])
2777 AT_KEYWORDS([monitor])
2780 ovs-ofctl add-flow br0 in_port=0,dl_vlan=123,actions=output:1
2782 # Start a monitor watching the flow table and check the initial reply.
2783 ovs-ofctl monitor br0 watch: --detach --no-chdir --pidfile >monitor.log 2>&1
2784 AT_CAPTURE_FILE([monitor.log])
2785 ovs-appctl -t ovs-ofctl ofctl/barrier
2786 AT_CHECK([sed 's/ (xid=0x[[1-9a-fA-F]][[0-9a-fA-F]]*)//' monitor.log], [0],
2787 [NXST_FLOW_MONITOR reply:
2788 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=123 actions=output:1
2792 # Add, delete, and modify some flows and check the updates.
2793 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
2794 ovs-ofctl add-flow br0 in_port=0,dl_vlan=124,actions=output:2
2795 ovs-ofctl add-flow br0 in_port=0,dl_vlan=123,actions=output:5
2796 ovs-ofctl add-flow br0 in_port=0,dl_vlan=123,dl_vlan_pcp=0,actions=output:6
2797 ovs-ofctl add-flow br0 in_port=0,dl_vlan=123,dl_vlan_pcp=1,actions=output:7
2798 ovs-ofctl add-flow br0 in_port=0,dl_vlan=123,actions=output:8
2799 ovs-ofctl add-flow br0 in_port=0,dl_vlan=65535,dl_vlan_pcp=0,actions=output:9
2800 ovs-ofctl add-flow br0 in_port=0,dl_vlan=65535,dl_vlan_pcp=1,actions=output:10
2801 ovs-ofctl add-flow br0 in_port=0,dl_vlan=65535,actions=output:11
2802 ovs-ofctl add-flow br0 in_port=0,dl_vlan=8191,dl_vlan_pcp=0,actions=output:12
2803 ovs-ofctl add-flow br0 in_port=0,dl_vlan=8191,dl_vlan_pcp=1,actions=output:13
2804 ovs-ofctl add-flow br0 in_port=0,dl_vlan=8191,actions=output:14
2805 ovs-ofctl add-flow br0 in_port=0,dl_vlan=0,dl_vlan_pcp=0,actions=output:15
2806 ovs-ofctl add-flow br0 in_port=0,dl_vlan=0,dl_vlan_pcp=1,actions=output:16
2807 ovs-ofctl add-flow br0 in_port=0,dl_vlan=0,actions=output:17
2808 ovs-ofctl add-flow br0 in_port=0,dl_vlan=0,dl_vlan_pcp=0,actions=output:18
2809 ovs-ofctl add-flow br0 in_port=0,dl_vlan=0,dl_vlan_pcp=1,actions=output:19
2810 ovs-ofctl add-flow br0 in_port=0,dl_vlan=0,actions=output:20
2811 ovs-ofctl add-flow br0 in_port=0,dl_vlan_pcp=0,actions=output:21
2812 ovs-ofctl add-flow br0 in_port=0,dl_vlan_pcp=1,actions=output:22
2813 ovs-ofctl add-flow br0 in_port=0,actions=output:23
2814 ovs-ofctl mod-flows br0 dl_vlan=123,actions=output:3
2815 ovs-ofctl mod-flows br0 cookie=5,dl_vlan=123,actions=output:3
2816 ovs-ofctl del-flows br0 dl_vlan=123
2817 ovs-ofctl del-flows br0
2818 ovs-appctl -t ovs-ofctl ofctl/barrier
2819 AT_CHECK([sed 's/ (xid=0x[[1-9a-fA-F]][[0-9a-fA-F]]*)//' monitor.log | multiline_sort], [0],
2820 [NXST_FLOW_MONITOR reply (xid=0x0):
2821 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=124 actions=output:2
2822 NXST_FLOW_MONITOR reply (xid=0x0):
2823 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=123 actions=output:5
2824 NXST_FLOW_MONITOR reply (xid=0x0):
2825 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=123,dl_vlan_pcp=0 actions=output:6
2826 NXST_FLOW_MONITOR reply (xid=0x0):
2827 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=123,dl_vlan_pcp=1 actions=output:7
2828 NXST_FLOW_MONITOR reply (xid=0x0):
2829 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=123 actions=output:8
2830 NXST_FLOW_MONITOR reply (xid=0x0):
2831 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=0,dl_vlan_pcp=0 actions=output:9
2832 NXST_FLOW_MONITOR reply (xid=0x0):
2833 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=0,dl_vlan_pcp=1 actions=output:10
2834 NXST_FLOW_MONITOR reply (xid=0x0):
2835 event=ADDED table=0 cookie=0 in_port=0,vlan_tci=0x0000 actions=output:11
2836 NXST_FLOW_MONITOR reply (xid=0x0):
2837 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=4095,dl_vlan_pcp=0 actions=output:12
2838 NXST_FLOW_MONITOR reply (xid=0x0):
2839 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=4095,dl_vlan_pcp=1 actions=output:13
2840 NXST_FLOW_MONITOR reply (xid=0x0):
2841 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=4095 actions=output:14
2842 NXST_FLOW_MONITOR reply (xid=0x0):
2843 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=0,dl_vlan_pcp=0 actions=output:15
2844 NXST_FLOW_MONITOR reply (xid=0x0):
2845 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=0,dl_vlan_pcp=1 actions=output:16
2846 NXST_FLOW_MONITOR reply (xid=0x0):
2847 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=0 actions=output:17
2848 NXST_FLOW_MONITOR reply (xid=0x0):
2849 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=0,dl_vlan_pcp=0 actions=output:18
2850 NXST_FLOW_MONITOR reply (xid=0x0):
2851 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=0,dl_vlan_pcp=1 actions=output:19
2852 NXST_FLOW_MONITOR reply (xid=0x0):
2853 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=0 actions=output:20
2854 NXST_FLOW_MONITOR reply (xid=0x0):
2855 event=ADDED table=0 cookie=0 in_port=0,dl_vlan_pcp=0 actions=output:21
2856 NXST_FLOW_MONITOR reply (xid=0x0):
2857 event=ADDED table=0 cookie=0 in_port=0,dl_vlan_pcp=1 actions=output:22
2858 NXST_FLOW_MONITOR reply (xid=0x0):
2859 event=ADDED table=0 cookie=0 in_port=0 actions=output:23
2860 NXST_FLOW_MONITOR reply (xid=0x0):
2861 event=MODIFIED table=0 cookie=0 in_port=0,dl_vlan=123 actions=output:3
2862 event=MODIFIED table=0 cookie=0 in_port=0,dl_vlan=123,dl_vlan_pcp=0 actions=output:3
2863 event=MODIFIED table=0 cookie=0 in_port=0,dl_vlan=123,dl_vlan_pcp=1 actions=output:3
2864 NXST_FLOW_MONITOR reply (xid=0x0):
2865 event=MODIFIED table=0 cookie=0x5 in_port=0,dl_vlan=123 actions=output:3
2866 event=MODIFIED table=0 cookie=0x5 in_port=0,dl_vlan=123,dl_vlan_pcp=0 actions=output:3
2867 event=MODIFIED table=0 cookie=0x5 in_port=0,dl_vlan=123,dl_vlan_pcp=1 actions=output:3
2868 NXST_FLOW_MONITOR reply (xid=0x0):
2869 event=DELETED reason=delete table=0 cookie=0x5 in_port=0,dl_vlan=123 actions=output:3
2870 event=DELETED reason=delete table=0 cookie=0x5 in_port=0,dl_vlan=123,dl_vlan_pcp=0 actions=output:3
2871 event=DELETED reason=delete table=0 cookie=0x5 in_port=0,dl_vlan=123,dl_vlan_pcp=1 actions=output:3
2872 NXST_FLOW_MONITOR reply (xid=0x0):
2873 event=DELETED reason=delete table=0 cookie=0 in_port=0 actions=output:23
2874 event=DELETED reason=delete table=0 cookie=0 in_port=0,dl_vlan=0 actions=output:20
2875 event=DELETED reason=delete table=0 cookie=0 in_port=0,dl_vlan=0,dl_vlan_pcp=0 actions=output:18
2876 event=DELETED reason=delete table=0 cookie=0 in_port=0,dl_vlan=0,dl_vlan_pcp=1 actions=output:19
2877 event=DELETED reason=delete table=0 cookie=0 in_port=0,dl_vlan=124 actions=output:2
2878 event=DELETED reason=delete table=0 cookie=0 in_port=0,dl_vlan=4095 actions=output:14
2879 event=DELETED reason=delete table=0 cookie=0 in_port=0,dl_vlan=4095,dl_vlan_pcp=0 actions=output:12
2880 event=DELETED reason=delete table=0 cookie=0 in_port=0,dl_vlan=4095,dl_vlan_pcp=1 actions=output:13
2881 event=DELETED reason=delete table=0 cookie=0 in_port=0,dl_vlan_pcp=0 actions=output:21
2882 event=DELETED reason=delete table=0 cookie=0 in_port=0,dl_vlan_pcp=1 actions=output:22
2883 event=DELETED reason=delete table=0 cookie=0 in_port=0,vlan_tci=0x0000 actions=output:11
2887 # Check that our own changes are reported as full updates.
2888 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
2889 ovs-ofctl add-flow br0 in_port=1,actions=output:2
2890 ovs-ofctl add-flow br0 in_port=2,actions=output:1
2891 ovs-appctl -t ovs-ofctl ofctl/barrier
2892 ovs-appctl -t ovs-ofctl ofctl/send 010e004812345678003fffff00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003000000000000ffffffffffff0000
2893 ovs-appctl -t ovs-ofctl ofctl/barrier
2894 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip], [0], [NXST_FLOW reply:
2896 AT_CHECK([sed 's/ (xid=0x[[1-9a-fA-F]][[0-9a-fA-F]]*)//' monitor.log | multiline_sort], [0],
2897 [NXST_FLOW_MONITOR reply (xid=0x0):
2898 event=ADDED table=0 cookie=0 in_port=1 actions=output:2
2899 NXST_FLOW_MONITOR reply (xid=0x0):
2900 event=ADDED table=0 cookie=0 in_port=2 actions=output:1
2902 send: OFPT_FLOW_MOD: DEL priority=0 actions=drop
2903 NXST_FLOW_MONITOR reply (xid=0x0):
2904 event=DELETED reason=delete table=0 cookie=0 in_port=1 actions=output:2
2905 event=DELETED reason=delete table=0 cookie=0 in_port=2 actions=output:1
2909 ovs-appctl -t ovs-ofctl exit
2913 AT_SETUP([ofproto - flow monitoring with !own])
2914 AT_KEYWORDS([monitor])
2917 ovs-ofctl add-flow br0 in_port=0,dl_vlan=123,actions=output:1
2919 # Start a monitor watching the flow table and check the initial reply.
2920 ovs-ofctl monitor br0 watch:\!own --detach --no-chdir --pidfile >monitor.log 2>&1
2921 AT_CAPTURE_FILE([monitor.log])
2922 ovs-appctl -t ovs-ofctl ofctl/barrier
2923 AT_CHECK([sed 's/ (xid=0x[[1-9a-fA-F]][[0-9a-fA-F]]*)//' monitor.log], [0],
2924 [NXST_FLOW_MONITOR reply:
2925 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=123 actions=output:1
2929 # Check that our own changes are reported as abbreviations.
2930 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
2931 ovs-ofctl add-flow br0 in_port=1,actions=output:2
2932 ovs-ofctl add-flow br0 in_port=2,actions=output:1
2933 ovs-appctl -t ovs-ofctl ofctl/barrier
2934 ovs-appctl -t ovs-ofctl ofctl/send 010e004812345678003fffff00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003000000000000ffffffffffff0000
2935 ovs-appctl -t ovs-ofctl ofctl/barrier
2936 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip], [0], [NXST_FLOW reply:
2938 AT_CHECK([sed 's/ (xid=0x[[1-9a-fA-F]][[0-9a-fA-F]]*)//' monitor.log], [0],
2939 [NXST_FLOW_MONITOR reply (xid=0x0):
2940 event=ADDED table=0 cookie=0 in_port=1 actions=output:2
2941 NXST_FLOW_MONITOR reply (xid=0x0):
2942 event=ADDED table=0 cookie=0 in_port=2 actions=output:1
2944 send: OFPT_FLOW_MOD: DEL priority=0 actions=drop
2945 NXST_FLOW_MONITOR reply (xid=0x0):
2946 event=ABBREV xid=0x12345678
2950 ovs-appctl -t ovs-ofctl exit
2954 AT_SETUP([ofproto - flow monitoring with out_port])
2955 AT_KEYWORDS([monitor])
2958 ovs-ofctl add-flow br0 in_port=0,dl_vlan=121,actions=output:1
2959 ovs-ofctl add-flow br0 in_port=0,dl_vlan=122,actions=output:1
2960 ovs-ofctl add-flow br0 in_port=0,dl_vlan=123,actions=output:2
2962 # Start a monitor watching the flow table and check the initial reply.
2963 ovs-ofctl monitor br0 watch:out_port=2 --detach --no-chdir --pidfile >monitor.log 2>&1
2964 AT_CAPTURE_FILE([monitor.log])
2965 ovs-appctl -t ovs-ofctl ofctl/barrier
2966 AT_CHECK([sed 's/ (xid=0x[[1-9a-fA-F]][[0-9a-fA-F]]*)//' monitor.log], [0],
2967 [NXST_FLOW_MONITOR reply:
2968 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=123 actions=output:2
2972 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
2974 # Add, modify flows and check the updates.
2975 ovs-ofctl mod-flows br0 dl_vlan=121,actions=drop
2976 ovs-ofctl mod-flows br0 dl_vlan=122,actions=output:1,output:2
2977 ovs-appctl -t ovs-ofctl ofctl/barrier
2979 ovs-ofctl mod-flows br0 dl_vlan=123,actions=output:1,output:2
2980 ovs-appctl -t ovs-ofctl ofctl/barrier
2982 ovs-ofctl mod-flows br0 dl_vlan=122,actions=output:1
2983 ovs-appctl -t ovs-ofctl ofctl/barrier
2984 ovs-ofctl mod-flows br0 dl_vlan=123,actions=output:2
2985 ovs-appctl -t ovs-ofctl ofctl/barrier
2987 AT_CHECK([sed 's/ (xid=0x[[1-9a-fA-F]][[0-9a-fA-F]]*)//' monitor.log], [0],
2988 [NXST_FLOW_MONITOR reply (xid=0x0):
2989 event=MODIFIED table=0 cookie=0 in_port=0,dl_vlan=122 actions=output:1,output:2
2991 NXST_FLOW_MONITOR reply (xid=0x0):
2992 event=MODIFIED table=0 cookie=0 in_port=0,dl_vlan=123 actions=output:1,output:2
2994 NXST_FLOW_MONITOR reply (xid=0x0):
2995 event=MODIFIED table=0 cookie=0 in_port=0,dl_vlan=122 actions=output:1
2997 NXST_FLOW_MONITOR reply (xid=0x0):
2998 event=MODIFIED table=0 cookie=0 in_port=0,dl_vlan=123 actions=output:2
3002 ovs-appctl -t ovs-ofctl exit
3006 AT_SETUP([ofproto - flow monitoring pause and resume])
3007 AT_KEYWORDS([monitor])
3009 # The maximum socket receive buffer size is important for this test, which
3010 # tests behavior when the receive buffer overflows.
3011 if test -e /proc/sys/net/core/rmem_max; then
3013 rmem_max=`cat /proc/sys/net/core/rmem_max`
3014 elif rmem_max=`sysctl -n net.inet.tcp.recvbuf_max 2>/dev/null`; then
3017 # Don't know how to get maximum socket receive buffer on this OS
3020 # Calculate the total amount of queuing: rmem_max in the kernel, 128 kB
3021 # in ofproto sending userspace (see ofmonitor_flush() in connmgr.c).
3022 queue_size=`expr $rmem_max + 128 \* 1024`
3023 echo rmem_max=$rmem_max queue_size=$queue_size
3025 # If there's too much queuing skip the test to avoid timing out.
3026 AT_SKIP_IF([test $rmem_max -gt 1048576])
3028 # Each flow update message takes up at least 48 bytes of space in queues
3029 # and in practice more than that.
3030 n_msgs=`expr $queue_size / 48`
3035 # Start a monitor watching the flow table, then make it block.
3036 ON_EXIT([kill `cat ovs-ofctl.pid`])
3037 ovs-ofctl monitor br0 watch: --detach --no-chdir --pidfile >monitor.log 2>&1
3038 AT_CAPTURE_FILE([monitor.log])
3039 ovs-appctl -t ovs-ofctl ofctl/block
3041 # Add $n_msgs flows.
3042 (echo "in_port=2,actions=output:2"
3044 for ($i = 0; $i < '$n_msgs'; $i++) {
3045 print "cookie=1,reg1=$i,actions=drop\n";
3048 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
3049 # Check that multipart flow dumps work properly:
3050 AT_CHECK([ovs-ofctl diff-flows br0 flows.txt])
3051 AT_CHECK([ovs-ofctl add-flow br0 in_port=1,cookie=3,actions=drop])
3052 AT_CHECK([ovs-ofctl mod-flows br0 in_port=2,cookie=2,actions=output:2])
3053 AT_CHECK([ovs-ofctl del-flows br0 cookie=1/-1])
3055 ovs-appctl -t ovs-ofctl ofctl/unblock
3057 # Wait for the connection resumed.
3058 # A barrier doesn't work for this purpose.
3059 # https://www.mail-archive.com/dev@openvswitch.org/msg27013.html
3060 # https://www.mail-archive.com/dev@openvswitch.org/msg27675.html
3061 OVS_WAIT_UNTIL([grep NXT_FLOW_MONITOR_RESUMED monitor.log])
3063 ovs-appctl -t ovs-ofctl exit
3065 # Check that the flow monitor reported the same number of flows
3066 # added and deleted, but fewer than we actually added and deleted.
3067 adds=`grep -c 'ADDED.*reg1=' monitor.log`
3068 deletes=`grep -c 'DELETED.*reg1=' monitor.log`
3069 echo adds=$adds deletes=$deletes
3070 AT_CHECK([test $adds -gt 100 && test $adds -lt $n_msgs])
3071 AT_CHECK([test $adds = $deletes])
3073 # Check that the flow monitor reported everything in the expected order:
3075 # event=ADDED table=0 cookie=0x1 reg1=0x22
3077 # NXT_FLOW_MONITOR_PAUSED:
3079 # event=DELETED reason=delete table=0 cookie=0x1 reg1=0x22
3081 # event=ADDED table=0 cookie=0x3 in_port=1
3082 # event=MODIFIED table=0 cookie=0x2 in_port=2 actions=output:2
3083 # NXT_FLOW_MONITOR_RESUMED:
3085 # except that, between the PAUSED and RESUMED, the order of the ADDED
3086 # and MODIFIED lines lines depends on hash order, that is, it varies
3087 # as we change the hash function or change architecture. Therefore,
3088 # we use a couple of tests below to accept both orders.
3089 AT_CHECK([ofctl_strip < monitor.log | sed -n -e '
3092 /NXT_FLOW_MONITOR_PAUSED:/p
3093 /NXT_FLOW_MONITOR_RESUMED:/p
3094 ' > monitor.log.subset])
3095 AT_CHECK([grep -v MODIFIED monitor.log.subset], [0], [dnl
3096 event=ADDED table=0 cookie=0x1 reg1=0x22
3097 NXT_FLOW_MONITOR_PAUSED:
3098 event=DELETED reason=delete table=0 cookie=0x1 reg1=0x22
3099 event=ADDED table=0 cookie=0x3 in_port=1
3100 NXT_FLOW_MONITOR_RESUMED:
3102 AT_CHECK([grep -v ADDED monitor.log.subset], [0], [dnl
3103 NXT_FLOW_MONITOR_PAUSED:
3104 event=DELETED reason=delete table=0 cookie=0x1 reg1=0x22
3105 event=MODIFIED table=0 cookie=0x2 in_port=2 actions=output:2
3106 NXT_FLOW_MONITOR_RESUMED:
3112 AT_SETUP([ofproto - event filtering (OpenFlow 1.3)])
3113 AT_KEYWORDS([monitor])
3116 # Start a monitor, use the required protocol version
3117 ovs-ofctl -O OpenFlow13 monitor br0 --detach --no-chdir --pidfile >monitor.log 2>&1
3118 AT_CAPTURE_FILE([monitor.log])
3120 # Send an OpenFlow13 message (04), OFPT_GET_ASYNC_REQUEST (1a), length (8), xid (0a)
3121 ovs-appctl -t ovs-ofctl ofctl/send 041a00080000000a
3122 ovs-appctl -t ovs-ofctl ofctl/barrier
3124 # Check default setting
3125 read -r -d '' expected <<'EOF'
3128 AT_CHECK([ofctl_strip < monitor.log], [], [dnl
3129 send: OFPT_GET_ASYNC_REQUEST (OF1.3):
3130 OFPT_GET_ASYNC_REPLY (OF1.3):
3132 PACKET_IN: no_match action
3133 PORT_STATUS: add delete modify
3134 FLOW_REMOVED: idle hard delete
3138 PORT_STATUS: add delete modify
3140 OFPT_BARRIER_REPLY (OF1.3):
3146 AT_SETUP([ofproto - ofport_request])
3148 ADD_OF_PORTS([br0], [1], [2], [3])
3150 set_and_check_specific_ofports () {
3151 ovs-vsctl set Interface p1 ofport_request="$1" -- \
3152 set Interface p2 ofport_request="$2" -- \
3153 set Interface p3 ofport_request="$3"
3154 ofports=`ovs-vsctl get Interface p1 ofport -- \
3155 get Interface p2 ofport -- \
3156 get Interface p3 ofport`
3157 AT_CHECK_UNQUOTED([echo $ofports], [0], [$1 $2 $3
3160 for pre in '1 2 3' '1 3 2' '2 1 3' '2 3 1' '3 1 2' '3 2 1'; do
3161 for post in '1 2 3' '1 3 2' '2 1 3' '2 3 1' '3 1 2' '3 2 1'; do
3162 echo -----------------------------------------------------------
3163 echo "Check changing port numbers from $pre to $post"
3164 set_and_check_specific_ofports $pre
3165 set_and_check_specific_ofports $post
3169 ovs-vsctl del-port p3
3171 set_and_check_poorly_specified_ofports () {
3172 ovs-vsctl set Interface p1 ofport_request="$1" -- \
3173 set Interface p2 ofport_request="$2"
3174 p1=`ovs-vsctl get Interface p1 ofport`
3175 p2=`ovs-vsctl get Interface p2 ofport`
3178 AT_CHECK([test "$p1" != "$p2"])
3179 if test "$1" = "$2" && test "$1" != '[[]]'; then
3180 # One port number must be the requested one.
3181 AT_CHECK([test "$p1" = "$1" || test "$p2" = "$1"])
3182 # The other port number must be different (already tested above).
3184 AT_CHECK([test "$1" = '[[]]' || test "$p1" == "$1"])
3185 AT_CHECK([test "$2" = '[[]]' || test "$p2" == "$2"])
3188 for pre in '1 2' '[[]] 2' '1 [[]]' '[[]] [[]]' '2 1' '[[]] 1' '2 [[]]' \
3190 for post in '1 2' '[[]] 2' '1 [[]]' '[[]] [[]]' '2 1' '[[]] 1' '2 [[]]' \
3192 echo -----------------------------------------------------------
3193 echo "Check changing port numbers from $pre to $post"
3194 set_and_check_poorly_specified_ofports $pre
3195 set_and_check_poorly_specified_ofports $post
3202 AT_SETUP([ofproto - bundles, open (OpenFlow 1.4)])
3203 AT_KEYWORDS([monitor])
3206 # Start a monitor, use the required protocol version
3207 ovs-ofctl -O OpenFlow14 monitor br0 --detach --no-chdir --pidfile >monitor.log 2>&1
3208 AT_CAPTURE_FILE([monitor.log])
3210 # Send an OpenFlow14 message (05), OFPT_BUNDLE_CONTROL (21), length (10), xid (0a)
3211 ovs-appctl -t ovs-ofctl ofctl/send "05 21 00 10 00 00 00 0a 00 00 00 01 00 00 00 01"
3212 ovs-appctl -t ovs-ofctl ofctl/barrier
3213 ovs-appctl -t ovs-ofctl exit
3215 AT_CHECK([ofctl_strip < monitor.log], [], [dnl
3216 send: OFPT_BUNDLE_CONTROL (OF1.4):
3217 bundle_id=0x1 type=OPEN_REQUEST flags=atomic
3218 OFPT_BUNDLE_CONTROL (OF1.4):
3219 bundle_id=0x1 type=OPEN_REPLY flags=0
3220 OFPT_BARRIER_REPLY (OF1.4):
3226 AT_SETUP([ofproto - bundles, double open (OpenFlow 1.4)])
3227 AT_KEYWORDS([monitor])
3230 # Start a monitor, use the required protocol version
3231 ovs-ofctl -O OpenFlow14 monitor br0 --detach --no-chdir --pidfile >monitor.log 2>&1
3232 AT_CAPTURE_FILE([monitor.log])
3234 # Send twice an OpenFlow14 message (05), OFPT_BUNDLE_CONTROL (21), length (10), xid (0a)
3235 ovs-appctl -t ovs-ofctl ofctl/send "05 21 00 10 00 00 00 0a 00 00 00 01 00 00 00 01"
3236 ovs-appctl -t ovs-ofctl ofctl/barrier
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 exit
3241 AT_CHECK([ofctl_strip < monitor.log], [0], [dnl
3242 send: OFPT_BUNDLE_CONTROL (OF1.4):
3243 bundle_id=0x1 type=OPEN_REQUEST flags=atomic
3244 OFPT_BUNDLE_CONTROL (OF1.4):
3245 bundle_id=0x1 type=OPEN_REPLY flags=0
3246 OFPT_BARRIER_REPLY (OF1.4):
3247 send: OFPT_BUNDLE_CONTROL (OF1.4):
3248 bundle_id=0x1 type=OPEN_REQUEST flags=atomic
3249 OFPT_ERROR (OF1.4): OFPBFC_BAD_ID
3250 OFPT_BUNDLE_CONTROL (OF1.4):
3251 bundle_id=0x1 type=OPEN_REQUEST flags=atomic
3252 OFPT_BARRIER_REPLY (OF1.4):
3258 AT_SETUP([ofproto - bundle close without open (OpenFlow 1.4)])
3259 AT_KEYWORDS([monitor])
3262 # Start a monitor, use the required protocol version
3263 ovs-ofctl -O OpenFlow14 monitor br0 --detach --no-chdir --pidfile >monitor.log 2>&1
3264 AT_CAPTURE_FILE([monitor.log])
3266 ovs-appctl -t ovs-ofctl ofctl/send "05 21 00 10 00 00 00 0a 00 00 00 01 00 02 00 01"
3267 ovs-appctl -t ovs-ofctl ofctl/barrier
3268 ovs-appctl -t ovs-ofctl exit
3270 AT_CHECK([ofctl_strip < monitor.log], [0], [dnl
3271 send: OFPT_BUNDLE_CONTROL (OF1.4):
3272 bundle_id=0x1 type=CLOSE_REQUEST flags=atomic
3273 OFPT_ERROR (OF1.4): OFPBFC_BAD_ID
3274 OFPT_BUNDLE_CONTROL (OF1.4):
3275 bundle_id=0x1 type=CLOSE_REQUEST flags=atomic
3276 OFPT_BARRIER_REPLY (OF1.4):
3282 AT_SETUP([ofproto - bundle double close (OpenFlow 1.4)])
3283 AT_KEYWORDS([monitor])
3286 # Start a monitor, use the required protocol version
3287 ovs-ofctl -O OpenFlow14 monitor br0 --detach --no-chdir --pidfile >monitor.log 2>&1
3288 AT_CAPTURE_FILE([monitor.log])
3290 # Open, Close, Close
3291 ovs-appctl -t ovs-ofctl ofctl/send "05 21 00 10 00 00 00 0a 00 00 00 01 00 00 00 01"
3292 ovs-appctl -t ovs-ofctl ofctl/barrier
3293 ovs-appctl -t ovs-ofctl ofctl/send "05 21 00 10 00 00 00 0a 00 00 00 01 00 02 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 exit
3299 AT_CHECK([ofctl_strip < monitor.log], [0], [dnl
3300 send: OFPT_BUNDLE_CONTROL (OF1.4):
3301 bundle_id=0x1 type=OPEN_REQUEST flags=atomic
3302 OFPT_BUNDLE_CONTROL (OF1.4):
3303 bundle_id=0x1 type=OPEN_REPLY flags=0
3304 OFPT_BARRIER_REPLY (OF1.4):
3305 send: OFPT_BUNDLE_CONTROL (OF1.4):
3306 bundle_id=0x1 type=CLOSE_REQUEST flags=atomic
3307 OFPT_BUNDLE_CONTROL (OF1.4):
3308 bundle_id=0x1 type=CLOSE_REPLY flags=0
3309 OFPT_BARRIER_REPLY (OF1.4):
3310 send: OFPT_BUNDLE_CONTROL (OF1.4):
3311 bundle_id=0x1 type=CLOSE_REQUEST flags=atomic
3312 OFPT_ERROR (OF1.4): OFPBFC_BUNDLE_CLOSED
3313 OFPT_BUNDLE_CONTROL (OF1.4):
3314 bundle_id=0x1 type=CLOSE_REQUEST flags=atomic
3315 OFPT_BARRIER_REPLY (OF1.4):
3321 AT_SETUP([ofproto - bundle close, different flags (OpenFlow 1.4)])
3322 AT_KEYWORDS([monitor])
3325 # Start a monitor, use the required protocol version
3326 ovs-ofctl -O OpenFlow14 monitor br0 --detach --no-chdir --pidfile >monitor.log 2>&1
3327 AT_CAPTURE_FILE([monitor.log])
3329 # Open, Close, Close
3330 ovs-appctl -t ovs-ofctl ofctl/send "05 21 00 10 00 00 00 0a 00 00 00 01 00 00 00 01"
3331 ovs-appctl -t ovs-ofctl ofctl/barrier
3332 ovs-appctl -t ovs-ofctl ofctl/send "05 21 00 10 00 00 00 0a 00 00 00 01 00 02 00 02"
3333 ovs-appctl -t ovs-ofctl ofctl/barrier
3334 ovs-appctl -t ovs-ofctl exit
3336 AT_CHECK([ofctl_strip < monitor.log], [0], [dnl
3337 send: OFPT_BUNDLE_CONTROL (OF1.4):
3338 bundle_id=0x1 type=OPEN_REQUEST flags=atomic
3339 OFPT_BUNDLE_CONTROL (OF1.4):
3340 bundle_id=0x1 type=OPEN_REPLY flags=0
3341 OFPT_BARRIER_REPLY (OF1.4):
3342 send: OFPT_BUNDLE_CONTROL (OF1.4):
3343 bundle_id=0x1 type=CLOSE_REQUEST flags=ordered
3344 OFPT_ERROR (OF1.4): OFPBFC_BAD_FLAGS
3345 OFPT_BUNDLE_CONTROL (OF1.4):
3346 bundle_id=0x1 type=CLOSE_REQUEST flags=ordered
3347 OFPT_BARRIER_REPLY (OF1.4):
3353 AT_SETUP([ofproto - bundle commit without open (OpenFlow 1.4)])
3354 AT_KEYWORDS([monitor])
3357 # Start a monitor, use the required protocol version
3358 ovs-ofctl -O OpenFlow14 monitor br0 --detach --no-chdir --pidfile >monitor.log 2>&1
3359 AT_CAPTURE_FILE([monitor.log])
3361 # Open, Close, Close
3362 ovs-appctl -t ovs-ofctl ofctl/send "05 21 00 10 00 00 00 0a 00 00 00 01 00 04 00 01"
3363 ovs-appctl -t ovs-ofctl ofctl/barrier
3364 ovs-appctl -t ovs-ofctl exit
3366 AT_CHECK([ofctl_strip < monitor.log], [0], [dnl
3367 send: OFPT_BUNDLE_CONTROL (OF1.4):
3368 bundle_id=0x1 type=COMMIT_REQUEST flags=atomic
3369 OFPT_ERROR (OF1.4): OFPBFC_BAD_ID
3370 OFPT_BUNDLE_CONTROL (OF1.4):
3371 bundle_id=0x1 type=COMMIT_REQUEST flags=atomic
3372 OFPT_BARRIER_REPLY (OF1.4):
3378 AT_SETUP([ofproto - bundle commit, different flags (OpenFlow 1.4)])
3379 AT_KEYWORDS([monitor])
3382 # Start a monitor, use the required protocol version
3383 ovs-ofctl -O OpenFlow14 monitor br0 --detach --no-chdir --pidfile >monitor.log 2>&1
3384 AT_CAPTURE_FILE([monitor.log])
3386 # Open, Close, Close
3387 ovs-appctl -t ovs-ofctl ofctl/send "05 21 00 10 00 00 00 0a 00 00 00 01 00 00 00 01"
3388 ovs-appctl -t ovs-ofctl ofctl/barrier
3389 ovs-appctl -t ovs-ofctl ofctl/send "05 21 00 10 00 00 00 0a 00 00 00 01 00 04 00 02"
3390 ovs-appctl -t ovs-ofctl ofctl/barrier
3391 ovs-appctl -t ovs-ofctl exit
3393 AT_CHECK([ofctl_strip < monitor.log], [0], [dnl
3394 send: OFPT_BUNDLE_CONTROL (OF1.4):
3395 bundle_id=0x1 type=OPEN_REQUEST flags=atomic
3396 OFPT_BUNDLE_CONTROL (OF1.4):
3397 bundle_id=0x1 type=OPEN_REPLY flags=0
3398 OFPT_BARRIER_REPLY (OF1.4):
3399 send: OFPT_BUNDLE_CONTROL (OF1.4):
3400 bundle_id=0x1 type=COMMIT_REQUEST flags=ordered
3401 OFPT_ERROR (OF1.4): OFPBFC_BAD_FLAGS
3402 OFPT_BUNDLE_CONTROL (OF1.4):
3403 bundle_id=0x1 type=COMMIT_REQUEST flags=ordered
3404 OFPT_BARRIER_REPLY (OF1.4):
3410 AT_SETUP([ofproto - bundle discard without open (OpenFlow 1.4)])
3411 AT_KEYWORDS([monitor])
3414 # Start a monitor, use the required protocol version
3415 ovs-ofctl -O OpenFlow14 monitor br0 --detach --no-chdir --pidfile >monitor.log 2>&1
3416 AT_CAPTURE_FILE([monitor.log])
3418 # Open, Close, Close
3419 ovs-appctl -t ovs-ofctl ofctl/send "05 21 00 10 00 00 00 0a 00 00 00 01 00 06 00 01"
3420 ovs-appctl -t ovs-ofctl ofctl/barrier
3421 ovs-appctl -t ovs-ofctl exit
3423 AT_CHECK([ofctl_strip < monitor.log], [0], [dnl
3424 send: OFPT_BUNDLE_CONTROL (OF1.4):
3425 bundle_id=0x1 type=DISCARD_REQUEST flags=atomic
3426 OFPT_ERROR (OF1.4): OFPBFC_BAD_ID
3427 OFPT_BUNDLE_CONTROL (OF1.4):
3428 bundle_id=0x1 type=DISCARD_REQUEST flags=atomic
3429 OFPT_BARRIER_REPLY (OF1.4):