3 AT_SETUP([ofproto - echo request])
5 AT_CHECK([ovs-ofctl -vwarn probe br0])
9 AT_SETUP([ofproto - handling messages with bad version])
12 # Start a monitor running OpenFlow 1.0, then send the switch an OF1.1 features
14 AT_CHECK([ovs-ofctl -P openflow10 monitor br0 --detach --no-chdir --pidfile])
15 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
16 AT_CAPTURE_FILE([monitor.log])
17 ovs-appctl -t ovs-ofctl ofctl/send 0205000801234567
18 ovs-appctl -t ovs-ofctl ofctl/barrier
19 ovs-appctl -t ovs-ofctl exit
21 AT_CHECK([sed 's/ (xid=0x[[0-9a-fA-F]]*)//
22 /ECHO/d' monitor.log], [0], [dnl
23 send: OFPT_FEATURES_REQUEST (OF1.1):
24 OFPT_ERROR (OF1.1): OFPBRC_BAD_VERSION
25 OFPT_FEATURES_REQUEST (OF1.1):
29 OVS_VSWITCHD_STOP(["/received OpenFlow version 0x02 != expected 01/d"])
32 AT_SETUP([ofproto - feature request, config request])
34 AT_CHECK([ovs-ofctl -vwarn show br0], [0], [stdout])
35 AT_CHECK([STRIP_XIDS stdout], [0], [dnl
36 OFPT_FEATURES_REPLY: dpid:fedcba9876543210
37 n_tables:254, n_buffers:256
38 capabilities: FLOW_STATS TABLE_STATS PORT_STATS QUEUE_STATS ARP_MATCH_IP
39 actions: output enqueue set_vlan_vid set_vlan_pcp strip_vlan mod_dl_src mod_dl_dst mod_nw_src mod_nw_dst mod_nw_tos mod_tp_src mod_tp_dst
40 LOCAL(br0): addr:aa:55:aa:55:00:00
43 speed: 0 Mbps now, 0 Mbps max
44 OFPT_GET_CONFIG_REPLY: frags=normal miss_send_len=0
49 AT_SETUP([ofproto - set OpenFlow port number])
51 [add-port br0 p1 -- set Interface p1 type=dummy --\
52 add-port br0 p2 -- set Interface p2 type=dummy ofport_request=99])
53 AT_CHECK([ovs-ofctl -vwarn show br0], [0], [stdout])
55 s/ (xid=0x[0-9a-fA-F]*)//
56 s/00:0.$/00:0x/' < stdout]],
58 OFPT_FEATURES_REPLY: dpid:fedcba9876543210
59 n_tables:254, n_buffers:256
60 capabilities: FLOW_STATS TABLE_STATS PORT_STATS QUEUE_STATS ARP_MATCH_IP
61 actions: output enqueue set_vlan_vid set_vlan_pcp strip_vlan mod_dl_src mod_dl_dst mod_nw_src mod_nw_dst mod_nw_tos mod_tp_src mod_tp_dst
62 1(p1): addr:aa:55:aa:55:00:0x
65 speed: 0 Mbps now, 0 Mbps max
66 99(p2): addr:aa:55:aa:55:00:0x
69 speed: 0 Mbps now, 0 Mbps max
70 LOCAL(br0): addr:aa:55:aa:55:00:0x
73 speed: 0 Mbps now, 0 Mbps max
74 OFPT_GET_CONFIG_REPLY: frags=normal miss_send_len=0
80 dnl This is really bare-bones.
81 dnl It at least checks request and reply serialization and deserialization.
82 AT_SETUP([ofproto - port stats - (OpenFlow 1.0)])
84 AT_CHECK([ovs-ofctl -vwarn dump-ports br0], [0], [stdout])
85 AT_CHECK([STRIP_XIDS stdout], [0], [dnl
86 OFPST_PORT reply: 1 ports
87 port LOCAL: rx pkts=0, bytes=0, drop=0, errs=0, frame=0, over=0, crc=0
88 tx pkts=0, bytes=0, drop=0, errs=0, coll=0
93 AT_SETUP([ofproto - port stats - (OpenFlow 1.2)])
95 AT_CHECK([ovs-ofctl -O OpenFlow12 -vwarn dump-ports br0], [0], [stdout])
96 AT_CHECK([STRIP_XIDS stdout], [0], [dnl
97 OFPST_PORT reply (OF1.2): 1 ports
98 port LOCAL: rx pkts=0, bytes=0, drop=0, errs=0, frame=0, over=0, crc=0
99 tx pkts=0, bytes=0, drop=0, errs=0, coll=0
104 AT_SETUP([ofproto - port stats - (OpenFlow 1.4)])
106 AT_CHECK([ovs-ofctl -O OpenFlow14 -vwarn dump-ports br0], [0], [stdout])
107 AT_CHECK([STRIP_XIDS stdout | sed 's/duration=[[0-9.]]*s/duration=?s/'],
109 OFPST_PORT reply (OF1.4): 1 ports
110 port LOCAL: rx pkts=0, bytes=0, drop=0, errs=0, frame=0, over=0, crc=0
111 tx pkts=0, bytes=0, drop=0, errs=0, coll=0
117 dnl This is really bare-bones.
118 dnl It at least checks request and reply serialization and deserialization.
119 AT_SETUP([ofproto - port-desc stats (OpenFlow 1.0)])
121 AT_CHECK([ovs-ofctl -vwarn dump-ports-desc br0], [0], [stdout])
122 AT_CHECK([STRIP_XIDS stdout], [0], [dnl
123 OFPST_PORT_DESC reply:
124 LOCAL(br0): addr:aa:55:aa:55:00:00
127 speed: 0 Mbps now, 0 Mbps max
132 dnl This is really bare-bones.
133 dnl It at least checks request and reply serialization and deserialization.
134 AT_SETUP([ofproto - port-desc stats (OpenFlow 1.2)])
136 AT_CHECK([ovs-ofctl -O OpenFlow12 -vwarn dump-ports-desc br0], [0], [stdout])
137 AT_CHECK([STRIP_XIDS stdout], [0], [dnl
138 OFPST_PORT_DESC reply (OF1.2):
139 LOCAL(br0): addr:aa:55:aa:55:00:00
142 speed: 0 Mbps now, 0 Mbps max
147 AT_SETUP([ofproto - port-desc stats (OpenFlow 1.5)])
149 ADD_OF_PORTS([br0], 1, 2, 3)
150 AT_CHECK([ovs-ofctl -F OXM-OpenFlow15 -O OpenFlow15 -vwarn dump-ports-desc br0], [0], [stdout])
151 AT_CHECK([STRIP_XIDS stdout | sed 's/00:0./00:0x/'], [0], [dnl
152 OFPST_PORT_DESC reply (OF1.5):
153 1(p1): addr:aa:55:aa:55:00:0x
156 speed: 0 Mbps now, 0 Mbps max
157 2(p2): addr:aa:55:aa:55:00:0x
160 speed: 0 Mbps now, 0 Mbps max
161 3(p3): addr:aa:55:aa:55:00:0x
164 speed: 0 Mbps now, 0 Mbps max
165 LOCAL(br0): addr:aa:55:aa:55:00:0x
168 speed: 0 Mbps now, 0 Mbps max
170 AT_CHECK([ovs-ofctl -F OXM-OpenFlow15 -O OpenFlow15 -vwarn dump-ports-desc br0 2], [0], [stdout])
171 AT_CHECK([STRIP_XIDS stdout | sed 's/00:0./00:0x/'], [0], [dnl
172 OFPST_PORT_DESC reply (OF1.5):
173 2(p2): addr:aa:55:aa:55:00:0x
176 speed: 0 Mbps now, 0 Mbps max
181 dnl This is really bare-bones.
182 dnl It at least checks request and reply serialization and deserialization.
183 AT_SETUP([ofproto - queue stats - (OpenFlow 1.0)])
185 AT_CHECK([ovs-ofctl -vwarn queue-stats br0], [0], [stdout])
186 AT_CHECK([STRIP_XIDS stdout], [0], [dnl
187 OFPST_QUEUE reply: 0 queues
189 AT_CHECK([ovs-ofctl -vwarn queue-stats br0 ANY 5], [0],
190 [OFPT_ERROR (xid=0x2): OFPQOFC_BAD_QUEUE
191 OFPST_QUEUE request (xid=0x2):port=ANY queue=5
193 AT_CHECK([ovs-ofctl -vwarn queue-stats br0 10], [0],
194 [OFPT_ERROR (xid=0x2): OFPQOFC_BAD_PORT
195 OFPST_QUEUE request (xid=0x2):port=10 queue=ALL
200 AT_SETUP([ofproto - queue stats - (OpenFlow 1.2)])
202 AT_CHECK([ovs-ofctl -O OpenFlow12 -vwarn queue-stats br0], [0], [stdout])
203 AT_CHECK([STRIP_XIDS stdout], [0], [dnl
204 OFPST_QUEUE reply (OF1.2): 0 queues
206 AT_CHECK([ovs-ofctl -O OpenFlow12 -vwarn queue-stats br0 ALL 5], [0],
207 [OFPT_ERROR (OF1.2) (xid=0x2): OFPQOFC_BAD_QUEUE
208 OFPST_QUEUE request (OF1.2) (xid=0x2):port=ANY queue=5
210 AT_CHECK([ovs-ofctl -O OpenFlow12 -vwarn queue-stats br0 10], [0],
211 [OFPT_ERROR (OF1.2) (xid=0x2): OFPQOFC_BAD_PORT
212 OFPST_QUEUE request (OF1.2) (xid=0x2):port=10 queue=ALL
217 AT_SETUP([ofproto - queue stats - (OpenFlow 1.4)])
219 AT_CHECK([ovs-ofctl -O OpenFlow14 -vwarn queue-stats br0], [0], [stdout])
220 AT_CHECK([STRIP_XIDS stdout], [0], [dnl
221 OFPST_QUEUE reply (OF1.4): 0 queues
223 AT_CHECK([ovs-ofctl -O OpenFlow14 -vwarn queue-stats br0 ALL 5], [0],
224 [OFPT_ERROR (OF1.4) (xid=0x2): OFPQOFC_BAD_QUEUE
225 OFPST_QUEUE request (OF1.4) (xid=0x2):port=ANY queue=5
227 AT_CHECK([ovs-ofctl -O OpenFlow14 -vwarn queue-stats br0 10], [0],
228 [OFPT_ERROR (OF1.4) (xid=0x2): OFPQOFC_BAD_PORT
229 OFPST_QUEUE request (OF1.4) (xid=0x2):port=10 queue=ALL
234 dnl This is really bare-bones.
235 dnl It at least checks request and reply serialization and deserialization.
236 AT_SETUP([ofproto - queue configuration - (OpenFlow 1.0)])
238 ADD_OF_PORTS([br0], [1], [2])
239 AT_CHECK([ovs-ofctl queue-get-config br0 1], [0], [stdout])
240 AT_CHECK([STRIP_XIDS stdout], [0], [dnl
241 OFPT_QUEUE_GET_CONFIG_REPLY: port=1
243 AT_CHECK([ovs-ofctl queue-get-config br0 10], [0],
244 [OFPT_ERROR (xid=0x2): OFPQOFC_BAD_PORT
245 OFPT_QUEUE_GET_CONFIG_REQUEST (xid=0x2): port=10
250 AT_SETUP([ofproto - queue configuration - (OpenFlow 1.2)])
252 ADD_OF_PORTS([br0], [1], [2])
253 AT_CHECK([ovs-ofctl -O OpenFlow12 queue-get-config br0 1], [0], [stdout])
254 AT_CHECK([STRIP_XIDS stdout], [0], [dnl
255 OFPT_QUEUE_GET_CONFIG_REPLY (OF1.2): port=1
257 AT_CHECK([ovs-ofctl -O OpenFlow12 queue-get-config br0 10], [0],
258 [OFPT_ERROR (OF1.2) (xid=0x2): OFPQOFC_BAD_PORT
259 OFPT_QUEUE_GET_CONFIG_REQUEST (OF1.2) (xid=0x2): port=10
264 dnl This is really bare-bones.
265 dnl It at least checks request and reply serialization and deserialization.
266 dnl Actions definition listed in both supported formats (w/ actions=)
267 AT_SETUP([ofproto - no group support (OpenFlow 1.0)])
269 AT_DATA([groups.txt], [dnl
270 group_id=1234,type=all,bucket=output:10
271 group_id=1235,type=all,bucket=actions=output:10
273 AT_DATA([stderr], [dnl
274 ovs-ofctl: none of the usable flow formats (OXM,OpenFlow11) is among the allowed flow formats (OpenFlow10,NXM)
276 AT_CHECK([ovs-ofctl -O OpenFlow10 -vwarn add-groups br0 groups.txt], [1], ,[stderr])
277 AT_CHECK([ovs-ofctl -O OpenFlow10 -vwarn mod-group br0 'group_id=1234,type=all,bucket=output:10'], [1], ,[stderr])
278 AT_CHECK([ovs-ofctl -O OpenFlow10 -vwarn del-groups br0], [1], ,[stderr])
279 AT_CHECK([ovs-ofctl -O OpenFlow10 -vwarn dump-groups br0 ], [1], ,[stderr])
283 dnl This is really bare-bones.
284 dnl It at least checks request and reply serialization and deserialization.
285 dnl Actions definition listed in both supported formats (w/ actions=)
286 AT_SETUP([ofproto - del group (OpenFlow 1.1)])
288 AT_DATA([groups.txt], [dnl
289 group_id=1234,type=all,bucket=output:10
290 group_id=1235,type=all,bucket=actions=output:10
292 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn add-groups br0 groups.txt])
293 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn dump-groups br0 ], [0], [stdout])
294 AT_CHECK([STRIP_XIDS stdout], [0], [dnl
295 OFPST_GROUP_DESC reply (OF1.1):
296 group_id=1234,type=all,bucket=actions=output:10
297 group_id=1235,type=all,bucket=actions=output:10
299 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn del-groups br0 group_id=1234])
300 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn dump-groups br0], [0], [stdout])
301 AT_CHECK([STRIP_XIDS stdout], [0], [dnl
302 OFPST_GROUP_DESC reply (OF1.1):
303 group_id=1235,type=all,bucket=actions=output:10
305 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn del-groups br0 group_id=1234])
306 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn dump-groups br0], [0], [stdout])
307 AT_CHECK([STRIP_XIDS stdout], [0], [dnl
308 OFPST_GROUP_DESC reply (OF1.1):
309 group_id=1235,type=all,bucket=actions=output:10
311 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn del-groups br0], [0])
312 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn dump-groups br0], [0], [stdout])
313 AT_CHECK([STRIP_XIDS stdout], [0], [dnl
314 OFPST_GROUP_DESC reply (OF1.1):
319 dnl This is really bare-bones.
320 dnl It at least checks request and reply serialization and deserialization.
321 dnl Actions definition listed in both supported formats (w/ actions=)
322 AT_SETUP([ofproto - add indirect group])
324 dnl indirect group must have exactly one bucket
325 AT_DATA([stderr], [dnl
326 OFPT_ERROR (OF1.1) (xid=0x2): OFPGMFC_INVALID_GROUP
327 OFPT_GROUP_MOD (OF1.1) (xid=0x2): ***decode error: OFPGMFC_INVALID_GROUP***
329 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn add-group br0 'group_id=1234,type=indirect'], [1], , [stderr])
330 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn add-group br0 'group_id=1235,type=indirect,bucket=output:10'])
331 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn add-group br0 'group_id=1236,type=indirect,bucket=output:10,bucket=output:11'], [1], , [stderr])
335 dnl This is really bare-bones.
336 dnl It at least checks request and reply serialization and deserialization.
337 dnl Actions definition listed in both supported formats (w/ actions=)
338 AT_SETUP([ofproto - del group (OpenFlow 1.5)])
340 AT_DATA([groups.txt], [dnl
341 group_id=1234,type=select,selection_method=hash,bucket=output:10,bucket=output:11
342 group_id=1235,type=all,bucket=actions=output:12,bucket=bucket_id:0,actions=output:10,bucket=bucket_id:1,actions=output:11
344 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn add-groups br0 groups.txt])
345 AT_CHECK([ovs-ofctl -F OXM-OpenFlow15 -O OpenFlow15 -vwarn dump-groups br0 1234], [0], [stdout])
346 AT_CHECK([STRIP_XIDS stdout], [0], [dnl
347 OFPST_GROUP_DESC reply (OF1.5):
348 group_id=1234,type=select,selection_method=hash,bucket=bucket_id:0,actions=output:10,bucket=bucket_id:1,actions=output:11
350 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn del-groups br0 group_id=1234])
351 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn dump-groups br0], [0], [stdout])
352 AT_CHECK([STRIP_XIDS stdout], [0], [dnl
353 OFPST_GROUP_DESC reply (OF1.5):
354 group_id=1235,type=all,bucket=bucket_id:2,actions=output:12,bucket=bucket_id:0,actions=output:10,bucket=bucket_id:1,actions=output:11
356 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn del-groups br0 group_id=1234])
357 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn dump-groups br0], [0], [stdout])
358 AT_CHECK([STRIP_XIDS stdout], [0], [dnl
359 OFPST_GROUP_DESC reply (OF1.5):
360 group_id=1235,type=all,bucket=bucket_id:2,actions=output:12,bucket=bucket_id:0,actions=output:10,bucket=bucket_id:1,actions=output:11
362 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn del-groups br0], [0])
363 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn dump-groups br0], [0], [stdout])
364 AT_CHECK([STRIP_XIDS stdout], [0], [dnl
365 OFPST_GROUP_DESC reply (OF1.5):
370 dnl This is really bare-bones.
371 dnl It at least checks request and reply serialization and deserialization.
372 AT_SETUP([ofproto - del group deletes flows])
374 AT_DATA([groups.txt], [dnl
375 group_id=1234,type=all,bucket=output:10
376 group_id=1235,type=all,bucket=output:10
378 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn add-groups br0 groups.txt])
379 AT_DATA([flows.txt], [dnl
380 tcp actions=group:1234
381 udp actions=group:1235
383 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn add-flows br0 flows.txt])
384 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn dump-flows br0 | ofctl_strip | sort],
386 tcp actions=group:1234
387 udp actions=group:1235
388 OFPST_FLOW reply (OF1.1):
390 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn del-groups br0 group_id=1234])
391 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn dump-flows br0 | ofctl_strip | sort],
393 udp actions=group:1235
394 OFPST_FLOW reply (OF1.1):
396 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn del-groups br0 group_id=1234])
397 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn dump-flows br0 | ofctl_strip | sort],
399 udp actions=group:1235
400 OFPST_FLOW reply (OF1.1):
402 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn del-groups br0])
403 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn dump-flows br0 | ofctl_strip | sort],
405 OFPST_FLOW reply (OF1.1):
410 dnl This is really bare-bones.
411 dnl It at least checks request and reply serialization and deserialization.
412 dnl Actions definition listed in both supported formats (w/ actions=)
413 AT_SETUP([ofproto - insert buckets])
415 AT_DATA([groups.txt], [dnl
416 group_id=1234,type=all,bucket=bucket_id:10,actions=output:10,bucket=bucket_id:11,actions=output:11
418 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn add-groups br0 groups.txt])
419 AT_CHECK([ovs-ofctl -F OXM-OpenFlow15 -O OpenFlow15 -vwarn dump-groups br0 1234], [0], [stdout])
420 AT_CHECK([STRIP_XIDS stdout], [0], [dnl
421 OFPST_GROUP_DESC reply (OF1.5):
422 group_id=1234,type=all,bucket=bucket_id:10,actions=output:10,bucket=bucket_id:11,actions=output:11
424 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn insert-buckets br0 group_id=1234,command_bucket_id=first,bucket=bucket_id:0,actions=output:0,bucket=bucket_id:1,actions=output:1])
425 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn dump-groups br0], [0], [stdout])
426 AT_CHECK([STRIP_XIDS stdout], [0], [dnl
427 OFPST_GROUP_DESC reply (OF1.5):
428 group_id=1234,type=all,bucket=bucket_id:0,actions=output:0,bucket=bucket_id:1,actions=output:1,bucket=bucket_id:10,actions=output:10,bucket=bucket_id:11,actions=output:11
430 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn insert-buckets br0 group_id=1234,command_bucket_id=last,bucket=bucket_id:14,actions=output:14,bucket=bucket_id:15,actions=output:15])
431 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn dump-groups br0], [0], [stdout])
432 AT_CHECK([STRIP_XIDS stdout], [0], [dnl
433 OFPST_GROUP_DESC reply (OF1.5):
434 group_id=1234,type=all,bucket=bucket_id:0,actions=output:0,bucket=bucket_id:1,actions=output:1,bucket=bucket_id:10,actions=output:10,bucket=bucket_id:11,actions=output:11,bucket=bucket_id:14,actions=output:14,bucket=bucket_id:15,actions=output:15
436 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn insert-buckets br0 group_id=1234,command_bucket_id=15])
437 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn dump-groups br0], [0], [stdout])
438 AT_CHECK([STRIP_XIDS stdout], [0], [dnl
439 OFPST_GROUP_DESC reply (OF1.5):
440 group_id=1234,type=all,bucket=bucket_id:0,actions=output:0,bucket=bucket_id:1,actions=output:1,bucket=bucket_id:10,actions=output:10,bucket=bucket_id:11,actions=output:11,bucket=bucket_id:14,actions=output:14,bucket=bucket_id:15,actions=output:15
442 AT_DATA([buckets.txt], [dnl
443 group_id=1234,command_bucket_id=11,bucket=bucket_id:12,actions=output:12,bucket=bucket_id:13,actions=output:13
445 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn insert-buckets br0 - < buckets.txt])
446 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn dump-groups br0], [0], [stdout])
447 AT_CHECK([STRIP_XIDS stdout], [0], [dnl
448 OFPST_GROUP_DESC reply (OF1.5):
449 group_id=1234,type=all,bucket=bucket_id:0,actions=output:0,bucket=bucket_id:1,actions=output:1,bucket=bucket_id:10,actions=output:10,bucket=bucket_id:11,actions=output:11,bucket=bucket_id:12,actions=output:12,bucket=bucket_id:13,actions=output:13,bucket=bucket_id:14,actions=output:14,bucket=bucket_id:15,actions=output:15
451 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn insert-buckets br0 group_id=1234,command_bucket_id=15,bucket=bucket_id:20,actions=output:20,bucket=bucket_id:21,actions=output:21])
452 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn dump-groups br0], [0], [stdout])
453 AT_CHECK([STRIP_XIDS stdout], [0], [dnl
454 OFPST_GROUP_DESC reply (OF1.5):
455 group_id=1234,type=all,bucket=bucket_id:0,actions=output:0,bucket=bucket_id:1,actions=output:1,bucket=bucket_id:10,actions=output:10,bucket=bucket_id:11,actions=output:11,bucket=bucket_id:12,actions=output:12,bucket=bucket_id:13,actions=output:13,bucket=bucket_id:14,actions=output:14,bucket=bucket_id:15,actions=output:15,bucket=bucket_id:20,actions=output:20,bucket=bucket_id:21,actions=output:21
459 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn insert-buckets br0 group_id=1234,command_bucket_id=0xffffff01,bucket=bucket_id:0,actions=output:0,bucket=bucket_id:1,actions=output:1], [1], [],
460 [ovs-ofctl: invalid command bucket id 4294967041
465 dnl This is really bare-bones.
466 dnl It at least checks request and reply serialization and deserialization.
467 dnl Actions definition listed in both supported formats (w/ actions=)
468 AT_SETUP([ofproto - remove buckets])
470 AT_DATA([groups.txt], [dnl
471 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
473 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn add-groups br0 groups.txt])
474 AT_CHECK([ovs-ofctl -F OXM-OpenFlow15 -O OpenFlow15 -vwarn dump-groups br0 1234], [0], [stdout])
475 AT_CHECK([STRIP_XIDS stdout], [0], [dnl
476 OFPST_GROUP_DESC reply (OF1.5):
477 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
479 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn remove-buckets br0 group_id=1234,command_bucket_id=first])
480 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn dump-groups br0], [0], [stdout])
481 AT_CHECK([STRIP_XIDS stdout], [0], [dnl
482 OFPST_GROUP_DESC reply (OF1.5):
483 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
485 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn remove-buckets br0 group_id=1234,command_bucket_id=last])
486 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn dump-groups br0], [0], [stdout])
487 AT_CHECK([STRIP_XIDS stdout], [0], [dnl
488 OFPST_GROUP_DESC reply (OF1.5):
489 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
491 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn remove-buckets br0 group_id=1234,command_bucket_id=13])
492 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn dump-groups br0], [0], [stdout])
493 AT_CHECK([STRIP_XIDS stdout], [0], [dnl
494 OFPST_GROUP_DESC reply (OF1.5):
495 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
497 AT_DATA([buckets.txt], [dnl
500 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn remove-buckets br0 - < buckets.txt])
501 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn dump-groups br0], [0], [stdout])
502 AT_CHECK([STRIP_XIDS stdout], [0], [dnl
503 OFPST_GROUP_DESC reply (OF1.5):
504 group_id=1234,type=all
506 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn remove-buckets br0 group_id=1234,command_bucket_id=first])
507 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn remove-buckets br0 group_id=1234,command_bucket_id=last])
508 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn remove-buckets br0 group_id=1234,command_bucket_id=all])
509 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn remove-buckets br0 group_id=1234,command_bucket_id=1], [1], [], [stderr])
510 AT_CHECK([cat stderr | ofctl_strip], [0], [dnl
511 OFPT_ERROR (OF1.5): OFPGMFC_UNKNOWN_BUCKET
512 OFPT_GROUP_MOD (OF1.5):
513 REMOVE_BUCKET command_bucket_id:1,group_id=1234
518 dnl This is really bare-bones.
519 dnl It at least checks request and reply serialization and deserialization.
520 AT_SETUP([ofproto - flow mod checks group availability])
522 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn add-group br0 group_id=1234,type=all,bucket=output:10])
523 AT_DATA([flows.txt], [dnl
524 tcp actions=group:1234
525 udp actions=group:1235
527 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn add-flow br0 'tcp actions=group:1234'])
528 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn add-flow br0 'tcp actions=group:1235'], [1], [], [stderr])
530 # The output should look like this:
532 # 00000000 02 0e 00 98 00 00 00 02-00 00 00 00 00 00 00 00 |................|
533 # 00000010 00 00 00 00 00 00 00 00-ff 00 00 00 00 00 80 00 |................|
534 # 00000020 ff ff ff ff ff ff ff ff-ff ff ff ff 00 00 00 00 |................|
535 # 00000030 00 00 00 58 00 00 00 00-00 00 03 d7 00 00 00 00 |...X............|
537 # This 'sed' command captures the error message but drops details.
538 AT_CHECK([sed '/truncated/d
539 /^000000.0/d' stderr | STRIP_XIDS], [0],
540 [OFPT_ERROR (OF1.1): OFPBAC_BAD_OUT_GROUP
541 OFPT_FLOW_MOD (OF1.1):
546 dnl This is really bare-bones.
547 dnl It at least checks request and reply serialization and deserialization.
548 AT_SETUP([ofproto - group description])
550 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn add-group br0 group_id=1234,type=all,bucket=output:10], [0], [stdout])
551 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn dump-groups br0], [0], [stdout])
552 AT_CHECK([STRIP_XIDS stdout], [0], [dnl
553 OFPST_GROUP_DESC reply (OF1.1):
554 group_id=1234,type=all,bucket=actions=output:10
559 dnl This is really bare-bones.
560 dnl It at least checks request and reply serialization and deserialization.
561 AT_SETUP([ofproto - group description])
563 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn add-group br0 group_id=1234,type=all,bucket=output:10])
564 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn dump-groups br0], [0], [stdout])
565 AT_CHECK([STRIP_XIDS stdout], [0], [dnl
566 OFPST_GROUP_DESC reply (OF1.1):
567 group_id=1234,type=all,bucket=actions=output:10
572 dnl This is really bare-bones.
573 dnl It at least checks request and reply serialization and deserialization.
574 AT_SETUP([ofproto - group features])
576 AT_CHECK([ovs-ofctl -O OpenFlow12 -vwarn dump-group-features br0], [0], [stdout])
577 AT_CHECK([STRIP_XIDS stdout], [0], [dnl
578 OFPST_GROUP_FEATURES reply (OF1.2):
583 max_groups=0xffffff00
584 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
586 max_groups=0xffffff00
587 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
589 max_groups=0xffffff00
590 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
592 max_groups=0xffffff00
593 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
598 dnl This is really bare-bones.
599 dnl It at least checks request and reply serialization and deserialization.
600 AT_SETUP([ofproto - group stats (OpenFlow 1.1)])
602 AT_DATA([groups.txt], [dnl
603 group_id=1234,type=all,bucket=output:10
604 group_id=1235,type=all,bucket=output:10
606 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn add-groups br0 groups.txt])
607 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn add-flow br0 'tcp actions=group:1234'])
608 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn dump-group-stats br0 group_id=1234], [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 OFPST_GROUP reply (OF1.1):
613 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn dump-group-stats br0], [0], [stdout])
614 AT_CHECK([STRIP_XIDS stdout | sort], [0], [dnl
615 group_id=1234,ref_count=1,packet_count=0,byte_count=0,bucket0:packet_count=0,byte_count=0
616 group_id=1235,ref_count=0,packet_count=0,byte_count=0,bucket0:packet_count=0,byte_count=0
617 OFPST_GROUP reply (OF1.1):
622 dnl This is really bare-bones.
623 dnl It at least checks request and reply serialization and deserialization.
624 AT_SETUP([ofproto - group stats (OpenFlow 1.3)])
626 AT_DATA([groups.txt], [dnl
627 group_id=1234,type=all,bucket=output:10
628 group_id=1235,type=all,bucket=output:10
630 AT_CHECK([ovs-ofctl -O OpenFlow13 -vwarn add-groups br0 groups.txt])
631 AT_CHECK([ovs-ofctl -O OpenFlow13 -vwarn add-flow br0 'tcp actions=group:1234'])
632 AT_CHECK([ovs-ofctl -O OpenFlow13 -vwarn dump-group-stats br0 group_id=1234], [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 OFPST_GROUP reply (OF1.3):
637 AT_CHECK([ovs-ofctl -O OpenFlow13 -vwarn dump-group-stats br0], [0], [stdout])
638 AT_CHECK([STRIP_XIDS stdout | sed 's/duration=[[0-9.]]*s/duration=?s/' | sort], [0], [dnl
639 group_id=1234,duration=?s,ref_count=1,packet_count=0,byte_count=0,bucket0:packet_count=0,byte_count=0
640 group_id=1235,duration=?s,ref_count=0,packet_count=0,byte_count=0,bucket0:packet_count=0,byte_count=0
641 OFPST_GROUP reply (OF1.3):
646 dnl This is really bare-bones.
647 dnl It at least checks request and reply serialization and deserialization.
648 AT_SETUP([ofproto - group stats (OpenFlow 1.5)])
650 AT_DATA([groups.txt], [dnl
651 group_id=1234,type=all,bucket=output:10
652 group_id=1235,type=all,bucket=output:10
654 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn add-groups br0 groups.txt])
655 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn add-flow br0 'tcp actions=group:1234'])
656 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn dump-group-stats br0 group_id=1234], [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 OFPST_GROUP reply (OF1.5):
661 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn dump-group-stats br0], [0], [stdout])
662 AT_CHECK([STRIP_XIDS stdout | sed 's/duration=[[0-9.]]*s/duration=?s/' | sort], [0], [dnl
663 group_id=1234,duration=?s,ref_count=1,packet_count=0,byte_count=0,bucket0:packet_count=0,byte_count=0
664 group_id=1235,duration=?s,ref_count=0,packet_count=0,byte_count=0,bucket0:packet_count=0,byte_count=0
665 OFPST_GROUP reply (OF1.5):
670 AT_SETUP([ofproto - mod-port (OpenFlow 1.0)])
672 for command_config_state in \
674 'noflood NO_FLOOD 0' \
675 'down PORT_DOWN,NO_FLOOD LINK_DOWN' \
676 'flood PORT_DOWN LINK_DOWN' \
677 'no-receive PORT_DOWN,NO_RECV LINK_DOWN' \
678 'no-forward PORT_DOWN,NO_RECV,NO_FWD LINK_DOWN' \
679 'no-packet-in PORT_DOWN,NO_RECV,NO_FWD,NO_PACKET_IN LINK_DOWN' \
680 'forward PORT_DOWN,NO_RECV,NO_PACKET_IN LINK_DOWN' \
681 'packet-in PORT_DOWN,NO_RECV LINK_DOWN' \
685 set $command_config_state
686 command=$[1] config=`echo $[2] | sed 's/,/ /g'` state=$[3]
687 AT_CHECK([ovs-ofctl -vwarn mod-port br0 br0 $command])
688 AT_CHECK([ovs-ofctl -vwarn show br0], [0], [stdout])
689 AT_CHECK_UNQUOTED([STRIP_XIDS stdout], [0], [dnl
690 OFPT_FEATURES_REPLY: dpid:fedcba9876543210
691 n_tables:254, n_buffers:256
692 capabilities: FLOW_STATS TABLE_STATS PORT_STATS QUEUE_STATS ARP_MATCH_IP
693 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
694 LOCAL(br0): addr:aa:55:aa:55:00:00
697 speed: 0 Mbps now, 0 Mbps max
698 OFPT_GET_CONFIG_REPLY: frags=normal miss_send_len=0
704 AT_SETUP([ofproto - mod-port (OpenFlow 1.2)])
706 for command_config_state in \
708 'down PORT_DOWN LINK_DOWN' \
709 'no-receive PORT_DOWN,NO_RECV LINK_DOWN' \
710 'no-forward PORT_DOWN,NO_RECV,NO_FWD LINK_DOWN' \
711 'no-packet-in PORT_DOWN,NO_RECV,NO_FWD,NO_PACKET_IN LINK_DOWN' \
712 'forward PORT_DOWN,NO_RECV,NO_PACKET_IN LINK_DOWN' \
713 'packet-in PORT_DOWN,NO_RECV LINK_DOWN' \
717 set $command_config_state
718 command=$[1] config=`echo $[2] | sed 's/,/ /g'` state=$[3]
719 AT_CHECK([ovs-ofctl -O OpenFlow12 -vwarn mod-port br0 br0 $command])
720 AT_CHECK([ovs-ofctl -O OpenFlow12 -vwarn show br0], [0], [stdout])
721 AT_CHECK_UNQUOTED([STRIP_XIDS stdout], [0], [dnl
722 OFPT_FEATURES_REPLY (OF1.2): dpid:fedcba9876543210
723 n_tables:254, n_buffers:256
724 capabilities: FLOW_STATS TABLE_STATS PORT_STATS GROUP_STATS QUEUE_STATS
725 LOCAL(br0): addr:aa:55:aa:55:00:00
728 speed: 0 Mbps now, 0 Mbps max
729 OFPT_GET_CONFIG_REPLY (OF1.2): frags=normal miss_send_len=0
735 AT_SETUP([ofproto - mod-port (OpenFlow 1.4)])
737 for command_config_state in \
739 'down PORT_DOWN LINK_DOWN' \
740 'no-receive PORT_DOWN,NO_RECV LINK_DOWN' \
741 'no-forward PORT_DOWN,NO_RECV,NO_FWD LINK_DOWN' \
742 'no-packet-in PORT_DOWN,NO_RECV,NO_FWD,NO_PACKET_IN LINK_DOWN' \
743 'forward PORT_DOWN,NO_RECV,NO_PACKET_IN LINK_DOWN' \
744 'packet-in PORT_DOWN,NO_RECV LINK_DOWN' \
748 set $command_config_state
749 command=$[1] config=`echo $[2] | sed 's/,/ /g'` state=$[3]
750 AT_CHECK([ovs-ofctl -O OpenFlow14 -vwarn mod-port br0 br0 $command])
751 AT_CHECK([ovs-ofctl -O OpenFlow14 -vwarn show br0], [0], [stdout])
752 AT_CHECK_UNQUOTED([STRIP_XIDS stdout], [0], [dnl
753 OFPT_FEATURES_REPLY (OF1.4): dpid:fedcba9876543210
754 n_tables:254, n_buffers:256
755 capabilities: FLOW_STATS TABLE_STATS PORT_STATS GROUP_STATS QUEUE_STATS
756 OFPST_PORT_DESC reply (OF1.4):
757 LOCAL(br0): addr:aa:55:aa:55:00:00
760 speed: 0 Mbps now, 0 Mbps max
761 OFPT_GET_CONFIG_REPLY (OF1.4): frags=normal miss_send_len=0
767 AT_SETUP([ofproto - basic flow_mod commands (NXM)])
769 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip], [0], [NXST_FLOW reply:
771 AT_CHECK([echo 'in_port=2,actions=1' | ovs-ofctl add-flows br0 -])
772 AT_CHECK([ovs-ofctl add-flow br0 in_port=1,actions=2])
773 AT_CHECK([ovs-ofctl -F nxm add-flow br0 table=1,in_port=4,actions=3])
774 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
775 in_port=1 actions=output:2
776 in_port=2 actions=output:1
777 table=1, in_port=4 actions=output:3
780 AT_CHECK([ovs-ofctl dump-aggregate br0 table=0 | STRIP_XIDS], [0], [dnl
781 NXST_AGGREGATE reply: packet_count=0 byte_count=0 flow_count=2
783 AT_CHECK([ovs-ofctl del-flows br0])
784 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip], [0], [NXST_FLOW reply:
789 AT_SETUP([ofproto - basic flow_mod commands (OpenFlow 1.0)])
791 AT_CHECK([ovs-ofctl -F openflow10 dump-flows br0 | ofctl_strip], [0], [OFPST_FLOW reply:
793 AT_CHECK([echo 'in_port=2,actions=1' | ovs-ofctl -F openflow10 add-flows br0 -])
794 AT_CHECK([ovs-ofctl -F openflow10 add-flow br0 in_port=1,actions=2])
795 AT_CHECK([ovs-ofctl -F openflow10 add-flow br0 table=1,in_port=4,actions=3])
796 AT_CHECK([ovs-ofctl -F openflow10 dump-flows br0 | ofctl_strip | sort], [0], [dnl
797 in_port=1 actions=output:2
798 in_port=2 actions=output:1
799 table=1, in_port=4 actions=output:3
802 AT_CHECK([ovs-ofctl -F openflow10 dump-aggregate br0 table=0 | STRIP_XIDS], [0], [dnl
803 OFPST_AGGREGATE reply: packet_count=0 byte_count=0 flow_count=2
805 AT_CHECK([ovs-ofctl -F openflow10 del-flows br0])
806 AT_CHECK([ovs-ofctl -F openflow10 dump-flows br0 | ofctl_strip], [0], [OFPST_FLOW reply:
811 AT_SETUP([ofproto - basic flow_mod commands (OpenFlow 1.1)])
813 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip], [0], [OFPST_FLOW reply (OF1.1):
815 AT_CHECK([echo 'in_port=2,actions=1' | ovs-ofctl -O OpenFlow11 add-flows br0 -])
816 AT_CHECK([ovs-ofctl -O OpenFlow11 add-flow br0 in_port=1,actions=2])
817 AT_CHECK([ovs-ofctl -O OpenFlow11 add-flow br0 table=1,in_port=4,actions=3])
818 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0], [dnl
819 in_port=1 actions=output:2
820 in_port=2 actions=output:1
821 table=1, in_port=4 actions=output:3
822 OFPST_FLOW reply (OF1.1):
824 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-aggregate br0 table=0 | STRIP_XIDS], [0], [dnl
825 OFPST_AGGREGATE reply (OF1.1): packet_count=0 byte_count=0 flow_count=2
827 AT_CHECK([ovs-ofctl -O OpenFlow11 del-flows br0])
828 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip], [0], [OFPST_FLOW reply (OF1.1):
829 table=1, in_port=4 actions=output:3
834 AT_SETUP([ofproto - flow_mod negative test (OpenFlow 1.1)])
836 [set bridge br0 protocols=OpenFlow10,OpenFlow11,OpenFlow12,OpenFlow13])
837 AT_CHECK([ovs-ofctl add-flow -O OpenFlow11 br0 table=1,action=goto_table:2])
839 # The error message here actually comes from ovs-ofctl, not from ovs-vswitchd,
840 # but at least it's the same code in ofpacts_check() that issues the error.
841 AT_CHECK([ovs-ofctl add-flow -O OpenFlow11 br0 table=1,action=goto_table:1],
843 [ovs-ofctl: actions are invalid with specified match (OFPBIC_BAD_TABLE_ID)
848 AT_SETUP([ofproto - set-field flow_mod commands (NXM)])
850 AT_CHECK([ovs-ofctl add-flow br0 ipv6,table=1,in_port=3,actions=drop])
851 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])
852 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])
853 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
854 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[[]]
855 table=1, ipv6,in_port=3 actions=load:0xa6badbfffefe59fa->NXM_NX_IPV6_SRC[[0..63]],load:0xfe8001234567890a->NXM_NX_IPV6_SRC[[64..127]]
861 AT_SETUP([ofproto - basic flow_mod commands (OpenFlow 1.2)])
863 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip], [0], [OFPST_FLOW reply (OF1.2):
865 AT_CHECK([echo 'in_port=2,actions=1' | ovs-ofctl -O OpenFlow12 add-flows br0 -])
866 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 in_port=1,actions=2])
867 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 table=1,in_port=4,actions=3])
868 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
869 in_port=1 actions=output:2
870 in_port=2 actions=output:1
871 table=1, in_port=4 actions=output:3
872 OFPST_FLOW reply (OF1.2):
874 AT_CHECK([ovs-ofctl -O OpenFlow12 del-flows br0])
875 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip], [0], [OFPST_FLOW reply (OF1.2):
880 AT_SETUP([ofproto - set-field flow_mod commands (OF1.2)])
882 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 ipv6,table=1,in_port=3,actions=drop])
883 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])
884 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])
885 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
886 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
887 table=1, ipv6,in_port=3 actions=set_field:fe80:123:4567:890a:a6ba:dbff:fefe:59fa->ipv6_src
888 OFPST_FLOW reply (OF1.2):
893 AT_SETUP([ofproto - dump flows with cookie])
895 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x1,in_port=1,actions=1])
896 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x2,in_port=2,actions=1])
897 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x3,in_port=3,actions=1])
898 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
899 cookie=0x1, in_port=1 actions=output:1
900 cookie=0x2, in_port=2 actions=output:1
901 cookie=0x3, in_port=3 actions=output:1
904 AT_CHECK([ovs-ofctl dump-aggregate br0 table=0 | STRIP_XIDS], [0], [dnl
905 NXST_AGGREGATE reply: packet_count=0 byte_count=0 flow_count=3
907 AT_CHECK([ovs-ofctl dump-flows br0 cookie=0x3/-1 | ofctl_strip | sort], [0], [dnl
908 cookie=0x3, in_port=3 actions=output:1
911 AT_CHECK([ovs-ofctl dump-aggregate br0 cookie=0x3/-1 | STRIP_XIDS], [0], [dnl
912 NXST_AGGREGATE reply: packet_count=0 byte_count=0 flow_count=1
917 AT_SETUP([ofproto - mod flow with cookie change (OpenFlow 1.0)])
919 AT_CHECK([ovs-ofctl -F openflow10 add-flow br0 cookie=0x1,in_port=1,actions=1])
920 AT_CHECK([ovs-ofctl -F openflow10 dump-flows br0 | ofctl_strip | sort], [0], [dnl
921 cookie=0x1, in_port=1 actions=output:1
925 AT_CHECK([ovs-ofctl -F openflow10 mod-flows br0 cookie=0x2,in_port=1,actions=1])
926 AT_CHECK([ovs-ofctl -F openflow10 dump-flows br0 | ofctl_strip | sort], [0], [dnl
927 cookie=0x2, in_port=1 actions=output:1
933 AT_SETUP([ofproto - mod flow with cookie change (NXM)])
935 AT_CHECK([ovs-ofctl -F nxm add-flow br0 cookie=0x1,in_port=1,actions=1])
936 AT_CHECK([ovs-ofctl -F nxm dump-flows br0 | ofctl_strip | sort], [0], [dnl
937 cookie=0x1, in_port=1 actions=output:1
941 AT_CHECK([ovs-ofctl -F nxm mod-flows br0 cookie=0x2,in_port=1,actions=1])
942 AT_CHECK([ovs-ofctl -F nxm dump-flows br0 | ofctl_strip | sort], [0], [dnl
943 cookie=0x2, in_port=1 actions=output:1
949 AT_SETUP([ofproto - no mod flow with cookie change (OpenFlow 1.1)])
951 AT_CHECK([ovs-ofctl -O OpenFlow11 add-flow br0 cookie=0x1,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):
956 AT_CHECK([ovs-ofctl -O OpenFlow11 mod-flows br0 cookie=0x2,in_port=1,actions=1])
957 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0], [dnl
958 cookie=0x1, in_port=1 actions=output:1
959 OFPST_FLOW reply (OF1.1):
964 dnl The OpenFlow 1.2 spec states that the cookie may not be modified
965 AT_SETUP([ofproto - no mod flow with cookie change (OpenFlow 1.2)])
967 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 cookie=0x1,in_port=1,actions=1])
968 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
969 cookie=0x1, in_port=1 actions=output:1
970 OFPST_FLOW reply (OF1.2):
973 AT_CHECK([ovs-ofctl -O OpenFlow12 mod-flows br0 cookie=0x2,in_port=1,actions=1])
974 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
975 cookie=0x1, in_port=1 actions=output:1
976 OFPST_FLOW reply (OF1.2):
981 AT_SETUP([ofproto - mod flows based on cookie mask (OpenFlow 1.0)])
983 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x1,in_port=1,actions=1])
984 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x1,in_port=2,actions=1])
985 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x2,in_port=3,actions=1])
986 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
987 cookie=0x1, in_port=1 actions=output:1
988 cookie=0x1, in_port=2 actions=output:1
989 cookie=0x2, in_port=3 actions=output:1
993 AT_CHECK([ovs-ofctl -F nxm mod-flows br0 cookie=0x1/0xff,actions=4])
994 AT_CHECK([ovs-ofctl -F nxm dump-flows br0 | ofctl_strip | sort], [0], [dnl
995 cookie=0x1, in_port=1 actions=output:4
996 cookie=0x1, in_port=2 actions=output:4
997 cookie=0x2, in_port=3 actions=output:1
1003 AT_SETUP([ofproto - mod flows based on cookie mask (OpenFlow 1.1)])
1005 AT_CHECK([ovs-ofctl -O OpenFlow11 add-flow br0 cookie=0x1,in_port=1,actions=1])
1006 AT_CHECK([ovs-ofctl -O OpenFlow11 add-flow br0 cookie=0x1,in_port=2,actions=1])
1007 AT_CHECK([ovs-ofctl -O OpenFlow11 add-flow br0 cookie=0x2,in_port=3,actions=1])
1008 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1009 cookie=0x1, in_port=1 actions=output:1
1010 cookie=0x1, in_port=2 actions=output:1
1011 cookie=0x2, in_port=3 actions=output:1
1012 OFPST_FLOW reply (OF1.1):
1015 AT_CHECK([ovs-ofctl -O OpenFlow11 mod-flows br0 cookie=0x1/0xff,actions=4])
1016 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1017 cookie=0x1, in_port=1 actions=output:4
1018 cookie=0x1, in_port=2 actions=output:4
1019 cookie=0x2, in_port=3 actions=output:1
1020 OFPST_FLOW reply (OF1.1):
1025 AT_SETUP([ofproto - mod flows based on cookie mask (OpenFlow 1.2)])
1027 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 cookie=0x1,in_port=1,actions=1])
1028 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 cookie=0x1,in_port=2,actions=1])
1029 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 cookie=0x2,in_port=3,actions=1])
1030 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1031 cookie=0x1, in_port=1 actions=output:1
1032 cookie=0x1, in_port=2 actions=output:1
1033 cookie=0x2, in_port=3 actions=output:1
1034 OFPST_FLOW reply (OF1.2):
1037 AT_CHECK([ovs-ofctl -O OpenFlow12 mod-flows br0 cookie=0x1/0xff,actions=4])
1038 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1039 cookie=0x1, in_port=1 actions=output:4
1040 cookie=0x1, in_port=2 actions=output:4
1041 cookie=0x2, in_port=3 actions=output:1
1042 OFPST_FLOW reply (OF1.2):
1047 dnl The OpenFlow 1.2 spec states that the cookie may not be modified
1048 AT_SETUP([ofproto - mod flows based on cookie mask with cookie change])
1050 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x1,in_port=1,actions=1])
1051 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x1,in_port=2,actions=1])
1052 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x2,in_port=3,actions=1])
1053 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1054 cookie=0x1, in_port=1 actions=output:1
1055 cookie=0x1, in_port=2 actions=output:1
1056 cookie=0x2, in_port=3 actions=output:1
1060 AT_CHECK([ovs-ofctl -F nxm mod-flows br0 cookie=1/-1,cookie=4,actions=4])
1061 AT_CHECK([ovs-ofctl -F nxm dump-flows br0 | ofctl_strip | sort], [0], [dnl
1062 cookie=0x2, in_port=3 actions=output:1
1063 cookie=0x4, in_port=1 actions=output:4
1064 cookie=0x4, in_port=2 actions=output:4
1070 AT_SETUP([ofproto - mod flow with cookie miss (mask==0) - NXM])
1072 AT_CHECK([ovs-ofctl -F nxm mod-flows br0 in_port=1,actions=1])
1073 AT_CHECK([ovs-ofctl -F nxm dump-flows br0 | ofctl_strip | sort], [0], [dnl
1074 in_port=1 actions=output:1
1080 AT_SETUP([ofproto - mod flow with cookie miss (mask==0) - OF1.1])
1082 AT_CHECK([ovs-ofctl -O openflow11 mod-flows br0 in_port=1,actions=1])
1083 AT_CHECK([ovs-ofctl -O openflow11 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1084 in_port=1 actions=output:1
1085 OFPST_FLOW reply (OF1.1):
1090 AT_SETUP([ofproto - mod flow with cookie miss (mask==0) - OF1.2])
1092 AT_CHECK([ovs-ofctl -O openflow12 mod-flows br0 in_port=1,actions=1])
1093 AT_CHECK([ovs-ofctl -O openflow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1094 OFPST_FLOW reply (OF1.2):
1099 AT_SETUP([ofproto - mod flow with cookie miss (mask!=0) - NXM])
1101 AT_CHECK([ovs-ofctl -F nxm mod-flows br0 cookie=1/1,in_port=1,actions=1])
1102 AT_CHECK([ovs-ofctl -F nxm dump-flows br0 | ofctl_strip | sort], [0], [dnl
1108 AT_SETUP([ofproto - mod flow with cookie miss (mask!=0) - OF1.1])
1110 AT_CHECK([ovs-ofctl -O openflow11 mod-flows br0 cookie=1/1,in_port=1,actions=1])
1111 AT_CHECK([ovs-ofctl -O openflow11 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1112 OFPST_FLOW reply (OF1.1):
1117 AT_SETUP([ofproto - mod flow with cookie miss (mask!=0) - OF1.2])
1119 AT_CHECK([ovs-ofctl -O openflow12 mod-flows br0 cookie=1/1,in_port=1,actions=1])
1120 AT_CHECK([ovs-ofctl -O openflow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1121 OFPST_FLOW reply (OF1.2):
1126 AT_SETUP([ofproto - del flows with cookies])
1128 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x1,in_port=1,actions=1])
1129 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x2,in_port=2,actions=1])
1130 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x3,in_port=3,actions=1])
1131 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1132 cookie=0x1, in_port=1 actions=output:1
1133 cookie=0x2, in_port=2 actions=output:1
1134 cookie=0x3, in_port=3 actions=output:1
1138 AT_CHECK([ovs-ofctl del-flows br0])
1139 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1145 AT_SETUP([ofproto - del flows based on cookie])
1147 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x1,in_port=1,actions=1])
1148 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x2,in_port=2,actions=1])
1149 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x3,in_port=3,actions=1])
1150 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1151 cookie=0x1, in_port=1 actions=output:1
1152 cookie=0x2, in_port=2 actions=output:1
1153 cookie=0x3, in_port=3 actions=output:1
1157 AT_CHECK([ovs-ofctl del-flows br0 cookie=0x3/-1])
1158 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1159 cookie=0x1, in_port=1 actions=output:1
1160 cookie=0x2, in_port=2 actions=output:1
1166 AT_SETUP([ofproto - del flows based on cookie mask])
1168 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x1,in_port=1,actions=1])
1169 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x2,in_port=2,actions=1])
1170 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x3,in_port=3,actions=1])
1171 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1172 cookie=0x1, in_port=1 actions=output:1
1173 cookie=0x2, in_port=2 actions=output:1
1174 cookie=0x3, in_port=3 actions=output:1
1177 AT_CHECK([ovs-ofctl del-flows br0 cookie=0x3/0x1])
1178 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1179 cookie=0x2, in_port=2 actions=output:1
1185 AT_SETUP([ofproto - del flows based on table id (NXM)])
1187 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x1,in_port=1,actions=1])
1188 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x2,in_port=2,table=1,actions=1])
1189 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1190 cookie=0x1, in_port=1 actions=output:1
1191 cookie=0x2, table=1, in_port=2 actions=output:1
1194 AT_CHECK([ovs-ofctl del-flows br0 table=0])
1195 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1196 cookie=0x2, table=1, in_port=2 actions=output:1
1199 AT_CHECK([ovs-ofctl del-flows br0 table=1])
1200 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1203 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x1,in_port=1,actions=1])
1204 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x2,in_port=2,table=1,actions=1])
1205 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1206 cookie=0x1, in_port=1 actions=output:1
1207 cookie=0x2, table=1, in_port=2 actions=output:1
1210 AT_CHECK([ovs-ofctl del-flows br0])
1211 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1217 AT_SETUP([ofproto - del flows based on table id (OpenFlow 1.1)])
1219 AT_CHECK([ovs-ofctl -O OpenFlow11 add-flow br0 cookie=0x1,in_port=1,actions=1])
1220 AT_CHECK([ovs-ofctl -O OpenFlow11 add-flow br0 cookie=0x2,in_port=2,table=1,actions=1])
1221 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1222 cookie=0x1, in_port=1 actions=output:1
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=0])
1227 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1228 cookie=0x2, table=1, in_port=2 actions=output:1
1229 OFPST_FLOW reply (OF1.1):
1231 AT_CHECK([ovs-ofctl -O OpenFlow11 del-flows br0 table=1])
1232 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1233 OFPST_FLOW reply (OF1.1):
1235 AT_CHECK([ovs-ofctl -O OpenFlow11 add-flow br0 cookie=0x1,in_port=1,actions=1])
1236 AT_CHECK([ovs-ofctl -O OpenFlow11 add-flow br0 cookie=0x2,in_port=2,table=1,actions=1])
1237 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1238 cookie=0x1, in_port=1 actions=output:1
1239 cookie=0x2, table=1, in_port=2 actions=output:1
1240 OFPST_FLOW reply (OF1.1):
1242 AT_CHECK([ovs-ofctl -O OpenFlow11 del-flows br0])
1243 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip], [0], [dnl
1244 OFPST_FLOW reply (OF1.1):
1245 cookie=0x2, table=1, in_port=2 actions=output:1
1250 AT_SETUP([ofproto - del flows based on table id (OpenFlow 1.2)])
1252 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 cookie=0x1,in_port=1,actions=1])
1253 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 cookie=0x2,in_port=2,table=1,actions=1])
1254 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1255 cookie=0x1, in_port=1 actions=output:1
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=0])
1260 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1261 cookie=0x2, table=1, in_port=2 actions=output:1
1262 OFPST_FLOW reply (OF1.2):
1264 AT_CHECK([ovs-ofctl -O OpenFlow12 del-flows br0 table=1])
1265 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1266 OFPST_FLOW reply (OF1.2):
1268 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 cookie=0x1,in_port=1,actions=1])
1269 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 cookie=0x2,in_port=2,table=1,actions=1])
1270 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1271 cookie=0x1, in_port=1 actions=output:1
1272 cookie=0x2, table=1, in_port=2 actions=output:1
1273 OFPST_FLOW reply (OF1.2):
1275 AT_CHECK([ovs-ofctl -O OpenFlow12 del-flows br0])
1276 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1277 OFPST_FLOW reply (OF1.2):
1282 AT_SETUP([ofproto - flow table configuration (OpenFlow 1.0)])
1284 # Check the default configuration.
1285 (printf "OFPST_TABLE reply (xid=0x2):"
1288 while test $x -lt 254; do
1291 active=0, lookup=0, matched=0
1294 in_port: exact match or wildcard
1295 eth_src: exact match or wildcard
1296 eth_dst: exact match or wildcard
1297 eth_type: exact match or wildcard
1298 vlan_vid: exact match or wildcard
1299 vlan_pcp: exact match or wildcard
1300 ip_src: exact match or wildcard
1301 ip_dst: exact match or wildcard
1302 nw_proto: exact match or wildcard
1303 nw_tos: exact match or wildcard
1304 tcp_src: exact match or wildcard
1305 tcp_dst: exact match or wildcard
1310 AT_CHECK([ovs-ofctl dump-tables br0], [0], [expout])
1311 # Change the configuration.
1314 -- --id=@t0 create Flow_Table name=main \
1315 -- --id=@t1 create Flow_Table flow-limit=1024 \
1316 -- set bridge br0 'flow_tables={1=@t1,0=@t0}' \
1317 | ${PERL} $srcdir/uuidfilt.pl],
1321 # Check that the configuration was updated.
1322 mv expout orig-expout
1323 sed -e 's/classifier/main/
1324 21s/1000000/1024/' orig-expout > expout
1325 AT_CHECK([ovs-ofctl dump-tables br0], [0], [expout])
1329 dnl In-band and fail-open add "hidden rules" to table 0. These rules shouldn't
1330 dnl be visible to OpenFlow. This test checks that "dump-flows" and
1331 dnl "dump-tables" don't make them visible.
1332 AT_SETUP([ofproto - hidden rules not in table stats])
1333 # Use an IP address for a controller that won't actually exist: we
1334 # want to create in-band rules but we do not want to actually connect
1335 # to a controller (because that could mess about with our test). The
1336 # Class E range 240.0.0.0 - 255.255.255.255 seems like a good choice.
1337 OVS_VSWITCHD_START([set-controller br0 tcp:240.0.0.1:6653])
1338 for i in 1 2 3 4 5; do ovs-appctl time/warp 1000; done
1340 # Check that no hidden flows are visible in OpenFlow.
1341 AT_CHECK([ovs-ofctl dump-flows br0], [0], [NXST_FLOW reply (xid=0x4):
1344 # Check that some hidden flows related to 240.0.0.1 are actually in table 0.
1346 # We discard flows that mention table_id because we only want table 0 flows,
1347 # which in OVS is implied by the absence of a table_id.
1348 AT_CHECK([ovs-appctl bridge/dump-flows br0], [0], [stdout])
1349 AT_CHECK([test `grep '240\.0\.0\.1' stdout | grep -v table_id= | wc -l` -gt 0])
1351 # Check that dump-tables doesn't count the hidden flows.
1352 (printf "OFPST_TABLE reply (xid=0x2):"
1355 while test $x -lt 254; do
1358 active=0, lookup=0, matched=0
1361 in_port: exact match or wildcard
1362 eth_src: exact match or wildcard
1363 eth_dst: exact match or wildcard
1364 eth_type: exact match or wildcard
1365 vlan_vid: exact match or wildcard
1366 vlan_pcp: exact match or wildcard
1367 ip_src: exact match or wildcard
1368 ip_dst: exact match or wildcard
1369 nw_proto: exact match or wildcard
1370 nw_tos: exact match or wildcard
1371 tcp_src: exact match or wildcard
1372 tcp_dst: exact match or wildcard
1377 AT_CHECK([ovs-ofctl dump-tables br0], [0], [expout])
1378 OVS_VSWITCHD_STOP(["/cannot find route for controller/d"])
1381 AT_SETUP([ofproto - flow table configuration (OpenFlow 1.2)])
1383 # Check the default configuration.
1384 (printf "OFPST_TABLE reply (OF1.2) (xid=0x2):"
1387 while test $x -lt 254; do
1388 if test $x = 253; then
1394 table $x (\"$name\"):
1395 active=0, lookup=0, matched=0
1396 metadata: match=0xffffffffffffffff write=0xffffffffffffffff
1399 instructions (table miss and others):
1400 instructions: apply_actions,clear_actions,write_actions,write_metadata$goto
1401 Write-Actions and Apply-Actions features:
1402 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
1403 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
1405 metadata: exact match or wildcard
1406 in_port_oxm: exact match or wildcard
1407 eth_src: exact match or wildcard
1408 eth_dst: exact match or wildcard
1409 eth_type: exact match or wildcard
1410 vlan_vid: exact match or wildcard
1411 vlan_pcp: exact match or wildcard
1412 mpls_label: exact match or wildcard
1413 mpls_tc: exact match or wildcard
1414 ip_src: exact match or wildcard
1415 ip_dst: exact match or wildcard
1416 ipv6_src: exact match or wildcard
1417 ipv6_dst: exact match or wildcard
1418 ipv6_label: exact match or wildcard
1419 nw_proto: exact match or wildcard
1420 ip_dscp: exact match or wildcard
1421 nw_ecn: exact match or wildcard
1422 arp_op: exact match or wildcard
1423 arp_spa: exact match or wildcard
1424 arp_tpa: exact match or wildcard
1425 arp_sha: exact match or wildcard
1426 arp_tha: exact match or wildcard
1427 tcp_src: exact match or wildcard
1428 tcp_dst: exact match or wildcard
1429 udp_src: exact match or wildcard
1430 udp_dst: exact match or wildcard
1431 sctp_src: exact match or wildcard
1432 sctp_dst: exact match or wildcard
1433 icmp_type: exact match or wildcard
1434 icmp_code: exact match or wildcard
1435 icmpv6_type: exact match or wildcard
1436 icmpv6_code: exact match or wildcard
1437 nd_target: exact match or wildcard
1438 nd_sll: exact match or wildcard
1439 nd_tll: exact match or wildcard"
1443 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-tables br0], [0], [expout])
1444 # Change the configuration.
1447 -- --id=@t0 create Flow_Table name=main \
1448 -- --id=@t1 create Flow_Table flow-limit=1024 \
1449 -- set bridge br0 'flow_tables={1=@t1,0=@t0}' \
1450 | ${PERL} $srcdir/uuidfilt.pl],
1454 # Check that the configuration was updated.
1455 mv expout orig-expout
1456 sed 's/classifier/main/
1457 53s/1000000/1024/' < orig-expout > expout
1458 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-tables br0], [0], [expout])
1462 AT_SETUP([ofproto - table features (OpenFlow 1.3)])
1466 while test $x -lt 254; do
1468 if test $x = 253; then
1473 if test $x = 252; then
1478 next tables: $y-253"
1481 echo " table $x (\"$name\"):
1482 metadata: match=0xffffffffffffffff write=0xffffffffffffffff
1484 instructions (table miss and others):$next
1485 instructions: meter,apply_actions,clear_actions,write_actions,write_metadata$goto
1486 Write-Actions and Apply-Actions features:
1487 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
1488 supported on Set-Field: tun_id tun_src tun_dst tun_gbp_id tun_gbp_flags metadata in_port in_port_oxm pkt_mark reg0 reg1 reg2 reg3 reg4 reg5 reg6 reg7 xreg0 xreg1 xreg2 xreg3 eth_src eth_dst vlan_tci vlan_vid vlan_pcp mpls_label mpls_tc ip_src ip_dst ipv6_src ipv6_dst ipv6_label nw_tos ip_dscp nw_ecn nw_ttl arp_op arp_spa arp_tpa arp_sha arp_tha tcp_src tcp_dst udp_src udp_dst sctp_src sctp_dst nd_target nd_sll nd_tll
1490 dp_hash: arbitrary mask
1491 recirc_id: exact match or wildcard
1492 conj_id: exact match or wildcard
1493 tun_id: arbitrary mask
1494 tun_src: arbitrary mask
1495 tun_dst: arbitrary mask
1496 tun_gbp_id: arbitrary mask
1497 tun_gbp_flags: arbitrary mask
1498 metadata: arbitrary mask
1499 in_port: exact match or wildcard
1500 in_port_oxm: exact match or wildcard
1501 actset_output: exact match or wildcard
1502 pkt_mark: arbitrary mask
1503 reg0: arbitrary mask
1504 reg1: arbitrary mask
1505 reg2: arbitrary mask
1506 reg3: arbitrary mask
1507 reg4: arbitrary mask
1508 reg5: arbitrary mask
1509 reg6: arbitrary mask
1510 reg7: arbitrary mask
1511 xreg0: arbitrary mask
1512 xreg1: arbitrary mask
1513 xreg2: arbitrary mask
1514 xreg3: arbitrary mask
1515 eth_src: arbitrary mask
1516 eth_dst: arbitrary mask
1517 eth_type: exact match or wildcard
1518 vlan_tci: arbitrary mask
1519 vlan_vid: arbitrary mask
1520 vlan_pcp: exact match or wildcard
1521 mpls_label: exact match or wildcard
1522 mpls_tc: exact match or wildcard
1523 mpls_bos: exact match or wildcard
1524 ip_src: arbitrary mask
1525 ip_dst: arbitrary mask
1526 ipv6_src: arbitrary mask
1527 ipv6_dst: arbitrary mask
1528 ipv6_label: arbitrary mask
1529 nw_proto: exact match or wildcard
1530 nw_tos: exact match or wildcard
1531 ip_dscp: exact match or wildcard
1532 nw_ecn: exact match or wildcard
1533 nw_ttl: exact match or wildcard
1534 ip_frag: arbitrary mask
1535 arp_op: exact match or wildcard
1536 arp_spa: arbitrary mask
1537 arp_tpa: arbitrary mask
1538 arp_sha: arbitrary mask
1539 arp_tha: arbitrary mask
1540 tcp_src: arbitrary mask
1541 tcp_dst: arbitrary mask
1542 tcp_flags: arbitrary mask
1543 udp_src: arbitrary mask
1544 udp_dst: arbitrary mask
1545 sctp_src: arbitrary mask
1546 sctp_dst: arbitrary mask
1547 icmp_type: exact match or wildcard
1548 icmp_code: exact match or wildcard
1549 icmpv6_type: exact match or wildcard
1550 icmpv6_code: exact match or wildcard
1551 nd_target: arbitrary mask
1552 nd_sll: arbitrary mask
1553 nd_tll: arbitrary mask"
1557 AT_CHECK([ovs-ofctl -O OpenFlow13 dump-table-features br0 | sed '/^$/d
1558 /^OFPST_TABLE_FEATURES/d'], [0], [expout])
1559 # Change the configuration.
1562 -- --id=@t0 create Flow_Table name=main \
1563 -- --id=@t1 create Flow_Table flow-limit=1024 \
1564 -- set bridge br0 'flow_tables={1=@t1,0=@t0}' \
1565 | ${PERL} $srcdir/uuidfilt.pl],
1569 # Check that the configuration was updated.
1570 mv expout orig-expout
1571 sed 's/classifier/main/
1572 77s/1000000/1024/' < orig-expout > expout
1573 AT_CHECK([ovs-ofctl -O OpenFlow13 dump-table-features br0 | sed '/^$/d
1574 /^OFPST_TABLE_FEATURES/d'], [0], [expout])
1578 AT_SETUP([ofproto - hard limits on flow table size (OpenFlow 1.0)])
1580 # Configure a maximum of 4 flows.
1583 -- --id=@t0 create Flow_Table flow-limit=4 \
1584 -- set bridge br0 flow_tables:0=@t0 \
1585 | ${PERL} $srcdir/uuidfilt.pl],
1589 for in_port in 1 2 3 4; do
1590 ovs-ofctl add-flow br0 in_port=$in_port,actions=drop
1592 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1593 in_port=1 actions=drop
1594 in_port=2 actions=drop
1595 in_port=3 actions=drop
1596 in_port=4 actions=drop
1599 # Adding another flow will be refused.
1600 AT_CHECK([ovs-ofctl add-flow br0 in_port=5,actions=drop], [1], [], [stderr])
1601 AT_CHECK([head -n 1 stderr | ofctl_strip], [0],
1602 [OFPT_ERROR: OFPFMFC_TABLE_FULL
1604 # Also a mod-flow that would add a flow will be refused.
1605 AT_CHECK([ovs-ofctl mod-flows br0 in_port=5,actions=drop], [1], [], [stderr])
1606 AT_CHECK([head -n 1 stderr | ofctl_strip], [0],
1607 [OFPT_ERROR: OFPFMFC_TABLE_FULL
1609 # Replacing or modifying an existing flow is allowed.
1610 AT_CHECK([ovs-ofctl add-flow br0 in_port=4,actions=normal])
1611 AT_CHECK([ovs-ofctl mod-flows br0 in_port=3,actions=output:1])
1612 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1613 in_port=1 actions=drop
1614 in_port=2 actions=drop
1615 in_port=3 actions=output:1
1616 in_port=4 actions=NORMAL
1622 AT_SETUP([ofproto - hard limits on flow table size (OpenFlow 1.2)])
1624 # Configure a maximum of 4 flows.
1627 -- --id=@t0 create Flow_Table flow-limit=4 \
1628 -- set bridge br0 flow_tables:0=@t0 \
1629 | ${PERL} $srcdir/uuidfilt.pl],
1633 for in_port in 1 2 3 4; do
1634 ovs-ofctl -O OpenFlow12 add-flow br0 in_port=$in_port,actions=drop
1636 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1637 in_port=1 actions=drop
1638 in_port=2 actions=drop
1639 in_port=3 actions=drop
1640 in_port=4 actions=drop
1641 OFPST_FLOW reply (OF1.2):
1643 # Adding another flow will be refused.
1644 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 in_port=5,actions=drop], [1], [], [stderr])
1645 AT_CHECK([head -n 1 stderr | ofctl_strip], [0],
1646 [OFPT_ERROR (OF1.2): OFPFMFC_TABLE_FULL
1648 # Replacing or modifying an existing flow is allowed.
1649 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 in_port=4,actions=normal])
1650 AT_CHECK([ovs-ofctl -O OpenFlow12 mod-flows br0 in_port=3,actions=output:1])
1651 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1652 in_port=1 actions=drop
1653 in_port=2 actions=drop
1654 in_port=3 actions=output:1
1655 in_port=4 actions=NORMAL
1656 OFPST_FLOW reply (OF1.2):
1661 AT_SETUP([ofproto - eviction upon table overflow (OpenFlow 1.0)])
1663 # Configure a maximum of 4 flows.
1666 -- --id=@t0 create Flow_Table flow-limit=4 overflow-policy=evict \
1667 -- set bridge br0 flow_tables:0=@t0 \
1668 | ${PERL} $srcdir/uuidfilt.pl],
1672 for in_port in 4 3 2 1; do
1673 ovs-ofctl add-flow br0 idle_timeout=${in_port}0,in_port=$in_port,actions=drop
1675 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1676 idle_timeout=10, in_port=1 actions=drop
1677 idle_timeout=20, in_port=2 actions=drop
1678 idle_timeout=30, in_port=3 actions=drop
1679 idle_timeout=40, in_port=4 actions=drop
1682 # Adding another flow will cause the one that expires soonest to be evicted.
1683 AT_CHECK([ovs-ofctl add-flow br0 in_port=5,actions=drop])
1684 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1685 idle_timeout=20, in_port=2 actions=drop
1686 idle_timeout=30, in_port=3 actions=drop
1687 idle_timeout=40, in_port=4 actions=drop
1688 in_port=5 actions=drop
1691 # A mod-flow that adds a flow also causes eviction, but replacing or
1692 # modifying an existing flow doesn't.
1693 AT_CHECK([ovs-ofctl mod-flows br0 in_port=6,actions=drop])
1694 AT_CHECK([ovs-ofctl add-flow br0 in_port=4,actions=normal])
1695 AT_CHECK([ovs-ofctl mod-flows br0 in_port=3,actions=output:1])
1696 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1697 idle_timeout=30, in_port=3 actions=output:1
1698 in_port=4 actions=NORMAL
1699 in_port=5 actions=drop
1700 in_port=6 actions=drop
1703 # Flows with no timeouts at all cannot be evicted.
1704 AT_CHECK([ovs-ofctl add-flow br0 in_port=7,actions=normal])
1705 AT_CHECK([ovs-ofctl add-flow br0 in_port=8,actions=drop], [1], [], [stderr])
1706 AT_CHECK([head -n 1 stderr | ofctl_strip], [0],
1707 [OFPT_ERROR: OFPFMFC_TABLE_FULL
1709 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1710 in_port=4 actions=NORMAL
1711 in_port=5 actions=drop
1712 in_port=6 actions=drop
1713 in_port=7 actions=NORMAL
1719 AT_SETUP([ofproto - eviction upon table overflow (OpenFlow 1.2)])
1721 # Configure a maximum of 4 flows.
1724 -- --id=@t0 create Flow_Table flow-limit=4 overflow-policy=evict \
1725 -- set bridge br0 flow_tables:0=@t0 \
1726 | ${PERL} $srcdir/uuidfilt.pl],
1730 for in_port in 4 3 2 1; do
1731 ovs-ofctl -O OpenFlow12 add-flow br0 idle_timeout=${in_port}0,in_port=$in_port,actions=drop
1733 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1734 idle_timeout=10, in_port=1 actions=drop
1735 idle_timeout=20, in_port=2 actions=drop
1736 idle_timeout=30, in_port=3 actions=drop
1737 idle_timeout=40, in_port=4 actions=drop
1738 OFPST_FLOW reply (OF1.2):
1740 # Adding another flow will cause the one that expires soonest to be evicted.
1741 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 in_port=5,actions=drop])
1742 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1743 idle_timeout=20, in_port=2 actions=drop
1744 idle_timeout=30, in_port=3 actions=drop
1745 idle_timeout=40, in_port=4 actions=drop
1746 in_port=5 actions=drop
1747 OFPST_FLOW reply (OF1.2):
1749 # In OpenFlow 1.2 a mod-flow does not ever add a flow and thus
1750 # has no effect on eviction
1751 AT_CHECK([ovs-ofctl -O OpenFlow12 mod-flows br0 in_port=6,actions=drop])
1752 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 in_port=4,actions=normal])
1753 AT_CHECK([ovs-ofctl -O OpenFlow12 mod-flows br0 in_port=3,actions=output:1])
1754 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1755 idle_timeout=20, in_port=2 actions=drop
1756 idle_timeout=30, in_port=3 actions=output:1
1757 in_port=4 actions=NORMAL
1758 in_port=5 actions=drop
1759 OFPST_FLOW reply (OF1.2):
1761 # Flows with no timeouts at all cannot be evicted.
1762 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 in_port=6,actions=drop])
1763 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 in_port=7,actions=normal])
1764 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 in_port=8,actions=drop], [1], [], [stderr])
1765 AT_CHECK([head -n 1 stderr | ofctl_strip], [0],
1766 [OFPT_ERROR (OF1.2): OFPFMFC_TABLE_FULL
1768 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1769 in_port=4 actions=NORMAL
1770 in_port=5 actions=drop
1771 in_port=6 actions=drop
1772 in_port=7 actions=NORMAL
1773 OFPST_FLOW reply (OF1.2):
1778 AT_SETUP([ofproto - eviction upon table overflow, with fairness (OpenFlow 1.0)])
1780 # Configure a maximum of 4 flows.
1783 -- --id=@t0 create Flow_Table name=evict flow-limit=4 \
1784 overflow-policy=evict \
1785 groups='"NXM_OF_IN_PORT[[]]"' \
1786 -- set bridge br0 flow_tables:0=@t0 \
1787 | ${PERL} $srcdir/uuidfilt.pl],
1791 ovs-ofctl add-flows br0 - <<EOF
1792 idle_timeout=10 in_port=2 dl_src=00:44:55:66:77:88 actions=drop
1793 idle_timeout=20 in_port=1 dl_src=00:11:22:33:44:55 actions=drop
1794 idle_timeout=30 in_port=1 dl_src=00:22:33:44:55:66 actions=drop
1795 idle_timeout=40 in_port=1 dl_src=00:33:44:55:66:77 actions=drop
1797 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1798 idle_timeout=10, in_port=2,dl_src=00:44:55:66:77:88 actions=drop
1799 idle_timeout=20, in_port=1,dl_src=00:11:22:33:44:55 actions=drop
1800 idle_timeout=30, in_port=1,dl_src=00:22:33:44:55:66 actions=drop
1801 idle_timeout=40, in_port=1,dl_src=00:33:44:55:66:77 actions=drop
1804 # Adding another flow will cause the one that expires soonest within
1805 # the largest group (those with in_port=1) to be evicted. In this
1806 # case this is not the same as the one that expires soonest overall
1807 # (which is what makes the test interesting):
1808 AT_CHECK([ovs-ofctl add-flow br0 in_port=2,dl_src=00:55:66:77:88:99,actions=drop])
1809 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1810 idle_timeout=10, in_port=2,dl_src=00:44:55:66:77:88 actions=drop
1811 idle_timeout=30, in_port=1,dl_src=00:22:33:44:55:66 actions=drop
1812 idle_timeout=40, in_port=1,dl_src=00:33:44:55:66:77 actions=drop
1813 in_port=2,dl_src=00:55:66:77:88:99 actions=drop
1816 # Enlarge the flow limit, change the eviction policy back to strictly
1817 # based on expiration, and and add some flows.
1818 AT_CHECK([ovs-vsctl set Flow_Table evict groups='[[]]' flow-limit=7])
1819 ovs-ofctl add-flows br0 - <<EOF
1820 idle_timeout=50 in_port=2 dl_src=00:66:77:88:99:aa actions=drop
1821 idle_timeout=60 in_port=2 dl_src=00:77:88:99:aa:bb actions=drop
1822 idle_timeout=70 in_port=2 dl_src=00:88:99:aa:bb:cc actions=drop
1824 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1825 idle_timeout=10, in_port=2,dl_src=00:44:55:66:77:88 actions=drop
1826 idle_timeout=30, in_port=1,dl_src=00:22:33:44:55:66 actions=drop
1827 idle_timeout=40, in_port=1,dl_src=00:33:44:55:66:77 actions=drop
1828 idle_timeout=50, in_port=2,dl_src=00:66:77:88:99:aa actions=drop
1829 idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=drop
1830 idle_timeout=70, in_port=2,dl_src=00:88:99:aa:bb:cc actions=drop
1831 in_port=2,dl_src=00:55:66:77:88:99 actions=drop
1834 # Adding another flow will cause the one that expires soonest overall
1836 AT_CHECK([ovs-ofctl add-flow br0 'idle_timeout=80 in_port=2 dl_src=00:99:aa:bb:cc:dd actions=drop'])
1837 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1838 idle_timeout=30, in_port=1,dl_src=00:22:33:44:55:66 actions=drop
1839 idle_timeout=40, in_port=1,dl_src=00:33:44:55:66:77 actions=drop
1840 idle_timeout=50, in_port=2,dl_src=00:66:77:88:99:aa actions=drop
1841 idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=drop
1842 idle_timeout=70, in_port=2,dl_src=00:88:99:aa:bb:cc actions=drop
1843 idle_timeout=80, in_port=2,dl_src=00:99:aa:bb:cc:dd actions=drop
1844 in_port=2,dl_src=00:55:66:77:88:99 actions=drop
1847 # Reducing the flow limit also causes the flows that expire soonest
1848 # overall to be evicted.
1849 AT_CHECK([ovs-vsctl set Flow_Table evict flow-limit=4])
1850 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1851 idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=drop
1852 idle_timeout=70, in_port=2,dl_src=00:88:99:aa:bb:cc actions=drop
1853 idle_timeout=80, in_port=2,dl_src=00:99:aa:bb:cc:dd actions=drop
1854 in_port=2,dl_src=00:55:66:77:88:99 actions=drop
1860 AT_SETUP([ofproto - eviction upon table overflow, with fairness (OpenFlow 1.2)])
1862 # Configure a maximum of 4 flows.
1865 -- --id=@t0 create Flow_Table name=evict flow-limit=4 \
1866 overflow-policy=evict \
1867 groups='"NXM_OF_IN_PORT[[]]"' \
1868 -- set bridge br0 flow_tables:0=@t0 \
1869 | ${PERL} $srcdir/uuidfilt.pl],
1873 ovs-ofctl -O OpenFlow12 add-flows br0 - <<EOF
1874 idle_timeout=10 in_port=2 dl_src=00:44:55:66:77:88 actions=drop
1875 idle_timeout=20 in_port=1 dl_src=00:11:22:33:44:55 actions=drop
1876 idle_timeout=30 in_port=1 dl_src=00:22:33:44:55:66 actions=drop
1877 idle_timeout=40 in_port=1 dl_src=00:33:44:55:66:77 actions=drop
1879 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1880 idle_timeout=10, in_port=2,dl_src=00:44:55:66:77:88 actions=drop
1881 idle_timeout=20, in_port=1,dl_src=00:11:22:33:44:55 actions=drop
1882 idle_timeout=30, in_port=1,dl_src=00:22:33:44:55:66 actions=drop
1883 idle_timeout=40, in_port=1,dl_src=00:33:44:55:66:77 actions=drop
1884 OFPST_FLOW reply (OF1.2):
1886 # Adding another flow will cause the one that expires soonest within
1887 # the largest group (those with in_port=1) to be evicted. In this
1888 # case this is not the same as the one that expires soonest overall
1889 # (which is what makes the test interesting):
1890 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 in_port=2,dl_src=00:55:66:77:88:99,actions=drop])
1891 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1892 idle_timeout=10, in_port=2,dl_src=00:44:55:66:77:88 actions=drop
1893 idle_timeout=30, in_port=1,dl_src=00:22:33:44:55:66 actions=drop
1894 idle_timeout=40, in_port=1,dl_src=00:33:44:55:66:77 actions=drop
1895 in_port=2,dl_src=00:55:66:77:88:99 actions=drop
1896 OFPST_FLOW reply (OF1.2):
1898 # Enlarge the flow limit, change the eviction policy back to strictly
1899 # based on expiration, and and add some flows.
1900 AT_CHECK([ovs-vsctl set Flow_Table evict groups='[[]]' flow-limit=7])
1901 ovs-ofctl -O OpenFlow12 add-flows br0 - <<EOF
1902 idle_timeout=50 in_port=2 dl_src=00:66:77:88:99:aa actions=drop
1903 idle_timeout=60 in_port=2 dl_src=00:77:88:99:aa:bb actions=drop
1904 idle_timeout=70 in_port=2 dl_src=00:88:99:aa:bb:cc actions=drop
1906 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1907 idle_timeout=10, in_port=2,dl_src=00:44:55:66:77:88 actions=drop
1908 idle_timeout=30, in_port=1,dl_src=00:22:33:44:55:66 actions=drop
1909 idle_timeout=40, in_port=1,dl_src=00:33:44:55:66:77 actions=drop
1910 idle_timeout=50, in_port=2,dl_src=00:66:77:88:99:aa actions=drop
1911 idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=drop
1912 idle_timeout=70, in_port=2,dl_src=00:88:99:aa:bb:cc actions=drop
1913 in_port=2,dl_src=00:55:66:77:88:99 actions=drop
1914 OFPST_FLOW reply (OF1.2):
1916 # Adding another flow will cause the one that expires soonest overall
1918 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'])
1919 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1920 idle_timeout=30, in_port=1,dl_src=00:22:33:44:55:66 actions=drop
1921 idle_timeout=40, in_port=1,dl_src=00:33:44:55:66:77 actions=drop
1922 idle_timeout=50, in_port=2,dl_src=00:66:77:88:99:aa actions=drop
1923 idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=drop
1924 idle_timeout=70, in_port=2,dl_src=00:88:99:aa:bb:cc actions=drop
1925 idle_timeout=80, in_port=2,dl_src=00:99:aa:bb:cc:dd actions=drop
1926 in_port=2,dl_src=00:55:66:77:88:99 actions=drop
1927 OFPST_FLOW reply (OF1.2):
1929 # Reducing the flow limit also causes the flows that expire soonest
1930 # overall to be evicted.
1931 AT_CHECK([ovs-vsctl set Flow_Table evict flow-limit=4])
1932 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1933 idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=drop
1934 idle_timeout=70, in_port=2,dl_src=00:88:99:aa:bb:cc actions=drop
1935 idle_timeout=80, in_port=2,dl_src=00:99:aa:bb:cc:dd actions=drop
1936 in_port=2,dl_src=00:55:66:77:88:99 actions=drop
1937 OFPST_FLOW reply (OF1.2):
1942 AT_SETUP([ofproto - eviction upon table overflow, with modified hard timeout])
1944 # Configure a maximum of 4 flows.
1947 -- --id=@t0 create Flow_Table flow-limit=4 overflow-policy=evict \
1948 -- set bridge br0 flow_tables:0=@t0 \
1949 | ${PERL} $srcdir/uuidfilt.pl],
1952 ovs-appctl time/stop
1954 for in_port in 4 3 2 1; do
1955 ovs-ofctl add-flow br0 hard_timeout=$((10 + in_port * 3)),in_port=$in_port,actions=drop
1957 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1958 hard_timeout=13, in_port=1 actions=drop
1959 hard_timeout=16, in_port=2 actions=drop
1960 hard_timeout=19, in_port=3 actions=drop
1961 hard_timeout=22, in_port=4 actions=drop
1964 # Sleep and modify the one that expires soonest
1965 ovs-appctl time/warp 5000
1966 AT_CHECK([ovs-ofctl mod-flows br0 in_port=1,actions=drop])
1967 # At this point the table would looks like:
1968 # in_port seconds to expire
1973 ovs-appctl time/warp 2000
1974 # Adding another flow will cause the one that expires soonest to be evicted.
1975 AT_CHECK([ovs-ofctl add-flow br0 in_port=5,actions=drop])
1976 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1977 hard_timeout=13, in_port=1 actions=drop
1978 hard_timeout=19, in_port=3 actions=drop
1979 hard_timeout=22, in_port=4 actions=drop
1980 in_port=5 actions=drop
1986 AT_SETUP([ofproto - eviction upon table overflow, with modified idle timeout])
1987 OVS_VSWITCHD_START([add-port br0 p1 -- set interface p1 type=dummy ofport_request=1])
1988 # Configure a maximum of 4 flows.
1991 -- --id=@t0 create Flow_Table flow-limit=4 overflow-policy=evict \
1992 -- set bridge br0 flow_tables:0=@t0 \
1993 | ${PERL} $srcdir/uuidfilt.pl],
1997 for in_port in 4 3 2 1; do
1998 ovs-ofctl add-flow br0 idle_timeout=$((10 + in_port * 3)),in_port=$in_port,actions=drop
2000 ovs-appctl time/stop
2001 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
2002 idle_timeout=13, in_port=1 actions=drop
2003 idle_timeout=16, in_port=2 actions=drop
2004 idle_timeout=19, in_port=3 actions=drop
2005 idle_timeout=22, in_port=4 actions=drop
2008 # Sleep and receive on the flow that expires soonest
2009 ovs-appctl time/warp 5000
2010 AT_CHECK([ovs-appctl netdev-dummy/receive p1 'in_port(1)'])
2011 # At this point the table would looks like:
2012 # in_port seconds to expire
2017 ovs-appctl time/warp 2000
2018 # Adding another flow will cause the one that expires soonest to be evicted.
2019 AT_CHECK([ovs-ofctl add-flow br0 in_port=5,actions=drop])
2020 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
2021 idle_timeout=19, in_port=3 actions=drop
2022 idle_timeout=22, in_port=4 actions=drop
2023 in_port=5 actions=drop
2024 n_packets=1, n_bytes=60, idle_timeout=13, in_port=1 actions=drop
2030 AT_SETUP([ofproto - asynchronous message control (OpenFlow 1.0)])
2032 AT_CHECK([ovs-ofctl -P openflow10 monitor br0 --detach --no-chdir --pidfile])
2034 printf '\n\n--- check_async %d ---\n\n\n' $1
2037 ovs-appctl -t ovs-ofctl ofctl/barrier
2038 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
2041 # OFPT_PACKET_IN, OFPR_ACTION (controller_id=0)
2042 ovs-ofctl -v packet-out br0 controller controller '0001020304050010203040501234'
2043 if test X"$1" = X"OFPR_ACTION"; then shift;
2044 echo >>expout "OFPT_PACKET_IN: total_len=14 in_port=CONTROLLER (via action) data_len=14 (unbuffered)
2045 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_NO_MATCH (controller_id=123)
2049 ovs-ofctl -v packet-out br0 controller 'controller(reason=no_match,id=123)' '0001020304050010203040501234'
2050 if test X"$1" = X"OFPR_NO_MATCH"; then shift;
2051 echo >>expout "OFPT_PACKET_IN: total_len=14 in_port=CONTROLLER (via no_match) data_len=14 (unbuffered)
2052 vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1234"
2055 # OFPT_PACKET_IN, OFPR_INVALID_TTL (controller_id=0)
2056 ovs-ofctl packet-out br0 controller dec_ttl '002583dfb4000026b98cb0f908004500003eb7e200000011339bac11370dac100002d7730035002b8f6d86fb0100000100000000000006626c702d7873066e696369726103636f6d00000f00'
2057 if test X"$1" = X"OFPR_INVALID_TTL"; then shift;
2058 echo >>expout "OFPT_PACKET_IN: total_len=76 in_port=CONTROLLER (via invalid_ttl) data_len=76 (unbuffered)
2059 udp,vlan_tci=0x0000,dl_src=00:26:b9:8c:b0:f9,dl_dst=00:25:83:df:b4:00,nw_src=172.17.55.13,nw_dst=172.16.0.2,nw_tos=0,nw_ecn=0,nw_ttl=0,tp_src=55155,tp_dst=53 udp_csum:8f6d"
2062 # OFPT_PORT_STATUS, OFPPR_ADD
2063 ovs-vsctl add-port br0 test -- set Interface test type=dummy ofport_request=1
2064 if test X"$1" = X"OFPPR_ADD"; then shift;
2065 echo >>expout "OFPT_PORT_STATUS: ADD: 1(test): addr:aa:55:aa:55:00:0x
2068 speed: 0 Mbps now, 0 Mbps max"
2071 # OFPT_PORT_STATUS, OFPPR_DELETE
2072 ovs-vsctl del-port br0 test
2073 if test X"$1" = X"OFPPR_DELETE"; then shift;
2074 echo >>expout "OFPT_PORT_STATUS: DEL: 1(test): addr:aa:55:aa:55:00:0x
2077 speed: 0 Mbps now, 0 Mbps max"
2080 # OFPT_FLOW_REMOVED, OFPRR_DELETE
2081 ovs-ofctl add-flow br0 send_flow_rem,actions=drop
2082 ovs-ofctl --strict del-flows br0 ''
2083 if test X"$1" = X"OFPRR_DELETE"; then shift;
2084 echo >>expout "OFPT_FLOW_REMOVED: reason=delete"
2086 AT_FAIL_IF([test X"$1" != X])
2088 ovs-appctl -t ovs-ofctl ofctl/barrier
2089 echo >>expout "OFPT_BARRIER_REPLY:"
2093 s/ (xid=0x[0-9a-fA-F]*)//
2095 s/00:0.$/00:0x/' < monitor.log]],
2099 # It's a service connection so initially there should be no async messages.
2102 # Set miss_send_len to 128, turning on packet-ins for our service connection.
2103 ovs-appctl -t ovs-ofctl ofctl/send 0109000c0123456700000080
2104 check_async 2 OFPR_ACTION OFPPR_ADD OFPPR_DELETE OFPRR_DELETE
2106 # Set miss_send_len to 128 and enable invalid_ttl.
2107 ovs-appctl -t ovs-ofctl ofctl/send 0109000c0123456700040080
2108 check_async 3 OFPR_ACTION OFPR_INVALID_TTL OFPPR_ADD OFPPR_DELETE OFPRR_DELETE
2110 # Become slave, which should disable everything except port status.
2111 ovs-appctl -t ovs-ofctl ofctl/send 0104001400000002000023200000000a00000002
2112 check_async 4 OFPPR_ADD OFPPR_DELETE
2114 # Use NXT_SET_ASYNC_CONFIG to enable a patchwork of asynchronous messages.
2115 ovs-appctl -t ovs-ofctl ofctl/send 01040028000000020000232000000013000000020000000500000005000000020000000200000005
2116 check_async 5 OFPR_INVALID_TTL OFPPR_DELETE OFPRR_DELETE
2118 # Set controller ID 123.
2119 ovs-appctl -t ovs-ofctl ofctl/send 01040018000000030000232000000014000000000000007b
2120 check_async 6 OFPR_NO_MATCH OFPPR_DELETE OFPRR_DELETE
2122 # Restore controller ID 0.
2123 ovs-appctl -t ovs-ofctl ofctl/send 010400180000000300002320000000140000000000000000
2126 ovs-appctl -t ovs-ofctl ofctl/send 0104001400000002000023200000000a00000001
2127 check_async 7 OFPR_ACTION OFPPR_ADD
2129 ovs-appctl -t ovs-ofctl exit
2133 AT_SETUP([ofproto - asynchronous message control (OpenFlow 1.2)])
2135 AT_CHECK([ovs-ofctl -O OpenFlow12 monitor br0 --detach --no-chdir --pidfile])
2137 printf '\n\n--- check_async %d ---\n\n\n' $1
2141 ovs-appctl -t ovs-ofctl ofctl/barrier
2142 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
2145 # OFPT_PACKET_IN, OFPR_ACTION (controller_id=0)
2146 ovs-ofctl -O OpenFlow12 -v packet-out br0 none controller '0001020304050010203040501234'
2147 if test X"$1" = X"OFPR_ACTION"; then shift;
2148 echo >>expout "OFPT_PACKET_IN (OF1.2): total_len=14 in_port=ANY (via action) data_len=14 (unbuffered)
2149 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_NO_MATCH (controller_id=123)
2153 ovs-ofctl -O OpenFlow12 -v packet-out br0 none 'controller(reason=no_match,id=123)' '0001020304050010203040501234'
2154 if test X"$1" = X"OFPR_NO_MATCH"; then shift;
2155 echo >>expout "OFPT_PACKET_IN (OF1.2): total_len=14 in_port=ANY (via no_match) data_len=14 (unbuffered)
2156 vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1234"
2159 # OFPT_PACKET_IN, OFPR_INVALID_TTL (controller_id=0)
2160 ovs-ofctl -O OpenFlow12 packet-out br0 none dec_ttl '002583dfb4000026b98cb0f908004500003eb7e200000011339bac11370dac100002d7730035002b8f6d86fb0100000100000000000006626c702d7873066e696369726103636f6d00000f00'
2161 if test X"$1" = X"OFPR_INVALID_TTL"; then shift;
2162 echo >>expout "OFPT_PACKET_IN (OF1.2): total_len=76 in_port=ANY (via invalid_ttl) data_len=76 (unbuffered)
2163 udp,vlan_tci=0x0000,dl_src=00:26:b9:8c:b0:f9,dl_dst=00:25:83:df:b4:00,nw_src=172.17.55.13,nw_dst=172.16.0.2,nw_tos=0,nw_ecn=0,nw_ttl=0,tp_src=55155,tp_dst=53 udp_csum:8f6d"
2166 # OFPT_PORT_STATUS, OFPPR_ADD
2167 ovs-vsctl add-port br0 test -- set Interface test type=dummy
2168 if test X"$1" = X"OFPPR_ADD"; then shift;
2169 echo >>expout "OFPT_PORT_STATUS (OF1.2): ADD: ${INDEX}(test): addr:aa:55:aa:55:00:0x
2172 speed: 0 Mbps now, 0 Mbps max"
2175 # OFPT_PORT_STATUS, OFPPR_DELETE
2176 ovs-vsctl del-port br0 test
2177 if test X"$1" = X"OFPPR_DELETE"; then shift;
2178 echo >>expout "OFPT_PORT_STATUS (OF1.2): DEL: ${INDEX}(test): addr:aa:55:aa:55:00:0x
2181 speed: 0 Mbps now, 0 Mbps max"
2184 # OFPT_FLOW_REMOVED, OFPRR_DELETE
2185 ovs-ofctl -O OpenFlow12 add-flow br0 send_flow_rem,actions=drop
2186 ovs-ofctl -O OpenFlow12 --strict del-flows br0 ''
2187 if test X"$1" = X"OFPRR_DELETE"; then shift;
2188 echo >>expout "OFPT_FLOW_REMOVED (OF1.2): reason=delete table_id=0"
2190 AT_FAIL_IF([test X"$1" != X])
2192 ovs-appctl -t ovs-ofctl ofctl/barrier
2193 echo >>expout "OFPT_BARRIER_REPLY (OF1.2):"
2197 s/ (xid=0x[0-9a-fA-F]*)//
2199 s/00:0.$/00:0x/' < monitor.log]],
2203 # It's a service connection so initially there should be no async messages.
2206 # Set miss_send_len to 128, turning on packet-ins for our service connection.
2207 ovs-appctl -t ovs-ofctl ofctl/send 0309000c0123456700000080
2208 check_async 2 OFPR_ACTION OFPPR_ADD OFPPR_DELETE OFPRR_DELETE
2210 # Set miss_send_len to 128 and enable invalid_ttl.
2211 ovs-appctl -t ovs-ofctl ofctl/send 0309000c0123456700040080
2212 check_async 3 OFPR_ACTION OFPR_INVALID_TTL OFPPR_ADD OFPPR_DELETE OFPRR_DELETE
2214 # Become slave (OF 1.2), which should disable everything except port status.
2215 ovs-appctl -t ovs-ofctl ofctl/send 031800180000000200000003000000000000000000000001
2216 check_async 4 OFPPR_ADD OFPPR_DELETE
2218 # Use NXT_SET_ASYNC_CONFIG to enable a patchwork of asynchronous messages.
2219 ovs-appctl -t ovs-ofctl ofctl/send 03040028000000020000232000000013000000020000000500000005000000020000000200000005
2220 check_async 5 OFPR_INVALID_TTL OFPPR_DELETE OFPRR_DELETE
2222 # Set controller ID 123.
2223 ovs-appctl -t ovs-ofctl ofctl/send 03040018000000030000232000000014000000000000007b
2224 check_async 6 OFPR_NO_MATCH OFPPR_DELETE OFPRR_DELETE
2226 # Restore controller ID 0.
2227 ovs-appctl -t ovs-ofctl ofctl/send 030400180000000300002320000000140000000000000000
2229 # Become master (OF 1.2).
2230 ovs-appctl -t ovs-ofctl ofctl/send 031800180000000400000002000000000000000000000002
2231 check_async 7 OFPR_ACTION OFPPR_ADD
2233 ovs-appctl -t ovs-ofctl exit
2237 AT_SETUP([ofproto - asynchronous message control (OpenFlow 1.3)])
2239 AT_CHECK([ovs-ofctl -O OpenFlow13 monitor br0 --detach --no-chdir --pidfile])
2241 printf '\n\n--- check_async %d ---\n\n\n' $1
2245 ovs-appctl -t ovs-ofctl ofctl/barrier
2246 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
2249 # OFPT_PACKET_IN, OFPR_ACTION (controller_id=0)
2250 ovs-ofctl -O OpenFlow13 -v packet-out br0 none controller '0001020304050010203040501234'
2251 if test X"$1" = X"OFPR_ACTION"; then shift;
2252 echo >>expout "OFPT_PACKET_IN (OF1.3): total_len=14 in_port=ANY (via action) data_len=14 (unbuffered)
2253 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_NO_MATCH (controller_id=123)
2257 ovs-ofctl -O OpenFlow13 -v packet-out br0 none 'controller(reason=no_match,id=123)' '0001020304050010203040501234'
2258 if test X"$1" = X"OFPR_NO_MATCH"; then shift;
2259 echo >>expout "OFPT_PACKET_IN (OF1.3): total_len=14 in_port=ANY (via no_match) data_len=14 (unbuffered)
2260 vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1234"
2263 # OFPT_PACKET_IN, OFPR_INVALID_TTL (controller_id=0)
2264 ovs-ofctl -O OpenFlow13 packet-out br0 none dec_ttl '002583dfb4000026b98cb0f908004500003eb7e200000011339bac11370dac100002d7730035002b8f6d86fb0100000100000000000006626c702d7873066e696369726103636f6d00000f00'
2265 if test X"$1" = X"OFPR_INVALID_TTL"; then shift;
2266 echo >>expout "OFPT_PACKET_IN (OF1.3): total_len=76 in_port=ANY (via invalid_ttl) data_len=76 (unbuffered)
2267 udp,vlan_tci=0x0000,dl_src=00:26:b9:8c:b0:f9,dl_dst=00:25:83:df:b4:00,nw_src=172.17.55.13,nw_dst=172.16.0.2,nw_tos=0,nw_ecn=0,nw_ttl=0,tp_src=55155,tp_dst=53 udp_csum:8f6d"
2270 # OFPT_PORT_STATUS, OFPPR_ADD
2271 ovs-vsctl add-port br0 test -- set Interface test type=dummy
2272 if test X"$1" = X"OFPPR_ADD"; then shift;
2273 echo >>expout "OFPT_PORT_STATUS (OF1.3): ADD: ${INDEX}(test): addr:aa:55:aa:55:00:0x
2276 speed: 0 Mbps now, 0 Mbps max"
2279 # OFPT_PORT_STATUS, OFPPR_DELETE
2280 ovs-vsctl del-port br0 test
2281 if test X"$1" = X"OFPPR_DELETE"; then shift;
2282 echo >>expout "OFPT_PORT_STATUS (OF1.3): DEL: ${INDEX}(test): addr:aa:55:aa:55:00:0x
2285 speed: 0 Mbps now, 0 Mbps max"
2288 # OFPT_FLOW_REMOVED, OFPRR_DELETE
2289 ovs-ofctl -O OpenFlow13 add-flow br0 send_flow_rem,actions=drop
2290 ovs-ofctl -O OpenFlow13 --strict del-flows br0 ''
2291 if test X"$1" = X"OFPRR_DELETE"; then shift;
2292 echo >>expout "OFPT_FLOW_REMOVED (OF1.3): reason=delete table_id=0"
2295 # OFPT_FLOW_REMOVED, OFPRR_GROUP_DELETE
2296 ovs-ofctl -O OpenFlow13 add-group br0 group_id=1234,type=all,bucket=output:10
2297 ovs-ofctl -O OpenFlow13 add-flow br0 send_flow_rem,actions=group:1234
2298 ovs-ofctl -O OpenFlow13 --strict del-groups br0 group_id=1234
2299 if test X"$1" = X"OFPRR_DELETE"; then shift;
2300 echo >>expout "OFPT_FLOW_REMOVED (OF1.3): reason=gropu_delete table_id=0"
2303 AT_FAIL_IF([test X"$1" != X])
2305 ovs-appctl -t ovs-ofctl ofctl/barrier
2306 echo >>expout "OFPT_BARRIER_REPLY (OF1.3):"
2310 s/ (xid=0x[0-9a-fA-F]*)//
2312 s/00:0.$/00:0x/' < monitor.log]],
2316 # It's a service connection so initially there should be no async messages.
2319 # Set miss_send_len to 128, turning on packet-ins for our service connection.
2320 ovs-appctl -t ovs-ofctl ofctl/send 0409000c0123456700000080
2321 check_async 2 OFPR_ACTION OFPPR_ADD OFPPR_DELETE OFPRR_DELETE
2323 # Become slave (OF 1.3), which should disable everything except port status.
2324 ovs-appctl -t ovs-ofctl ofctl/send 041800180000000200000003000000000000000000000001
2325 check_async 3 OFPPR_ADD OFPPR_DELETE
2327 # Use OF 1.3 OFPT_SET_ASYNC to enable a patchwork of asynchronous messages.
2328 ovs-appctl -t ovs-ofctl ofctl/send 041c002000000002000000020000000500000005000000020000000200000005
2329 check_async 4 OFPR_INVALID_TTL OFPPR_DELETE OFPRR_DELETE
2331 # Set controller ID 123.
2332 ovs-appctl -t ovs-ofctl ofctl/send 04040018000000030000232000000014000000000000007b
2333 check_async 5 OFPR_NO_MATCH OFPPR_DELETE OFPRR_DELETE
2335 # Restore controller ID 0.
2336 ovs-appctl -t ovs-ofctl ofctl/send 040400180000000300002320000000140000000000000000
2338 # Become master (OF 1.3).
2339 ovs-appctl -t ovs-ofctl ofctl/send 041800180000000400000002000000000000000000000002
2340 check_async 6 OFPR_ACTION OFPPR_ADD
2342 ovs-appctl -t ovs-ofctl exit
2346 AT_SETUP([ofproto - asynchronous message control (OpenFlow 1.5)])
2348 AT_CHECK([ovs-ofctl -O OpenFlow15 monitor br0 --detach --no-chdir --pidfile])
2350 printf '\n\n--- check_async %d ---\n\n\n' $1
2354 ovs-appctl -t ovs-ofctl ofctl/barrier
2355 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
2358 # Other tests are not working with OF 1.5, and message
2359 # format may change, so leave them out.
2361 # OFPT_PORT_STATUS, OFPPR_ADD
2362 ovs-vsctl add-port br0 test -- set Interface test type=dummy
2363 if test X"$1" = X"OFPPR_ADD"; then shift;
2364 echo >>expout "OFPT_PORT_STATUS (OF1.5): ADD: ${INDEX}(test): addr:aa:55:aa:55:00:0x
2367 speed: 0 Mbps now, 0 Mbps max"
2370 # OFPT_PORT_STATUS, OFPPR_MODIFY
2371 ovs-ofctl -O OpenFlow15 -vwarn mod-port br0 test up
2372 if test X"$1" = X"OFPPR_MODIFY"; then shift;
2373 echo >>expout "OFPT_PORT_STATUS (OF1.5): MOD: ${INDEX}(test): addr:aa:55:aa:55:00:0x
2376 speed: 0 Mbps now, 0 Mbps max
2377 OFPT_PORT_STATUS (OF1.5): MOD: 2(test): addr:aa:55:aa:55:00:0x
2380 speed: 0 Mbps now, 0 Mbps max"
2383 # OFPT_PORT_STATUS, OFPPR_DELETE
2384 ovs-vsctl del-port br0 test
2385 if test X"$1" = X"OFPPR_DELETE"; then shift;
2386 echo >>expout "OFPT_PORT_STATUS (OF1.5): DEL: ${INDEX}(test): addr:aa:55:aa:55:00:0x
2389 speed: 0 Mbps now, 0 Mbps max"
2392 AT_FAIL_IF([test X"$1" != X])
2394 ovs-appctl -t ovs-ofctl ofctl/barrier
2395 echo >>expout "OFPT_BARRIER_REPLY (OF1.5):"
2399 s/ (xid=0x[0-9a-fA-F]*)//
2401 s/00:0.$/00:0x/' < monitor.log]],
2405 # It's a service connection so initially there should be no async messages.
2408 # If we don't set this, async messages are not received.
2409 # Set miss_send_len to 128, turning on packet-ins for our service connection.
2410 ovs-appctl -t ovs-ofctl ofctl/send 0609000c0123456700000080
2411 check_async 2 OFPPR_ADD OFPPR_MODIFY OFPPR_DELETE
2413 # Set-async has changed in OF 1.4 and is not yet implemented.
2415 ovs-appctl -t ovs-ofctl exit
2419 dnl This test checks that the role request/response messaging works
2420 dnl and that generation_id is handled properly.
2421 AT_SETUP([ofproto - controller role (OpenFlow 1.2)])
2423 ON_EXIT([kill `cat c1.pid c2.pid`])
2425 # Start two ovs-ofctl controller processes.
2426 AT_CAPTURE_FILE([monitor1.log])
2427 AT_CAPTURE_FILE([expout1])
2428 AT_CAPTURE_FILE([experr1])
2429 AT_CAPTURE_FILE([monitor2.log])
2430 AT_CAPTURE_FILE([expout2])
2431 AT_CAPTURE_FILE([experr2])
2433 AT_CHECK([ovs-ofctl -O OpenFlow12 monitor br0 --detach --no-chdir --pidfile=`pwd`/c$i.pid --unixctl=`pwd`/c$i])
2434 ovs-appctl -t `pwd`/c$i ofctl/barrier
2435 ovs-appctl -t `pwd`/c$i ofctl/set-output-file monitor$i.log
2439 # find out current role
2440 ovs-appctl -t `pwd`/c$i ofctl/send 031800180000000200000000000000000000000000000000
2441 echo >>experr$i "send: OFPT_ROLE_REQUEST (OF1.2): role=nochange"
2442 echo >>expout$i "OFPT_ROLE_REPLY (OF1.2): role=equal"
2445 # controller 1: Become slave (generation_id is initially undefined, so
2446 # 2^63+2 should not be stale)
2447 ovs-appctl -t `pwd`/c1 ofctl/send 031800180000000300000003000000008000000000000002
2448 echo >>experr1 "send: OFPT_ROLE_REQUEST (OF1.2): role=slave generation_id=9223372036854775810"
2449 echo >>expout1 "OFPT_ROLE_REPLY (OF1.2): role=slave generation_id=9223372036854775810"
2451 # controller 2: Become master.
2452 ovs-appctl -t `pwd`/c2 ofctl/send 031800180000000300000002000000008000000000000003
2453 echo >>experr2 "send: OFPT_ROLE_REQUEST (OF1.2): role=master generation_id=9223372036854775811"
2454 echo >>expout2 "OFPT_ROLE_REPLY (OF1.2): role=master generation_id=9223372036854775811"
2456 # controller 1: Try to become the master using a stale generation ID
2457 ovs-appctl -t `pwd`/c1 ofctl/send 031800180000000400000002000000000000000000000003
2458 echo >>experr1 "send: OFPT_ROLE_REQUEST (OF1.2): role=master generation_id=3"
2459 echo >>expout1 "OFPT_ERROR (OF1.2): OFPRRFC_STALE"
2460 echo >>expout1 "OFPT_ROLE_REQUEST (OF1.2): role=master generation_id=3"
2462 # controller 1: Become master using a valid generation ID
2463 ovs-appctl -t `pwd`/c1 ofctl/send 031800180000000500000002000000000000000000000001
2464 echo >>experr1 "send: OFPT_ROLE_REQUEST (OF1.2): role=master generation_id=1"
2465 echo >>expout1 "OFPT_ROLE_REPLY (OF1.2): role=master generation_id=1"
2468 ovs-appctl -t `pwd`/c$i ofctl/barrier
2469 echo >>expout$i "OFPT_BARRIER_REPLY (OF1.2):"
2475 AT_CHECK([grep -v '^send:' monitor$i.log | STRIP_XIDS], [0], [expout])
2477 AT_CHECK([grep '^send:' monitor$i.log | STRIP_XIDS], [0], [expout])
2482 dnl This test checks that the role request/response messaging works,
2483 dnl that generation_id is handled properly, and that role status update
2484 dnl messages are sent when a controller's role gets changed from master
2486 AT_SETUP([ofproto - controller role (OpenFlow 1.4)])
2488 ON_EXIT([kill `cat c1.pid c2.pid`])
2490 # Start two ovs-ofctl controller processes.
2491 AT_CAPTURE_FILE([monitor1.log])
2492 AT_CAPTURE_FILE([expout1])
2493 AT_CAPTURE_FILE([experr1])
2494 AT_CAPTURE_FILE([monitor2.log])
2495 AT_CAPTURE_FILE([expout2])
2496 AT_CAPTURE_FILE([experr2])
2498 AT_CHECK([ovs-ofctl -O OpenFlow14 monitor br0 --detach --no-chdir --pidfile=`pwd`/c$i.pid --unixctl=`pwd`/c$i])
2499 ovs-appctl -t `pwd`/c$i ofctl/barrier
2500 ovs-appctl -t `pwd`/c$i ofctl/set-output-file monitor$i.log
2504 # find out current role
2505 ovs-appctl -t `pwd`/c$i ofctl/send 051800180000000200000000000000000000000000000000
2506 echo >>experr$i "send: OFPT_ROLE_REQUEST (OF1.4): role=nochange"
2507 echo >>expout$i "OFPT_ROLE_REPLY (OF1.4): role=equal"
2510 # controller 1: Become slave (generation_id is initially undefined, so
2511 # 2^63+2 should not be stale)
2512 ovs-appctl -t `pwd`/c1 ofctl/send 051800180000000300000003000000008000000000000002
2513 echo >>experr1 "send: OFPT_ROLE_REQUEST (OF1.4): role=slave generation_id=9223372036854775810"
2514 echo >>expout1 "OFPT_ROLE_REPLY (OF1.4): role=slave generation_id=9223372036854775810"
2516 # controller 2: Become master.
2517 ovs-appctl -t `pwd`/c2 ofctl/send 051800180000000300000002000000008000000000000003
2518 echo >>experr2 "send: OFPT_ROLE_REQUEST (OF1.4): role=master generation_id=9223372036854775811"
2519 echo >>expout2 "OFPT_ROLE_REPLY (OF1.4): role=master generation_id=9223372036854775811"
2521 # controller 1: Try to become the master using a stale generation ID
2522 ovs-appctl -t `pwd`/c1 ofctl/send 051800180000000400000002000000000000000000000003
2523 echo >>experr1 "send: OFPT_ROLE_REQUEST (OF1.4): role=master generation_id=3"
2524 echo >>expout1 "OFPT_ERROR (OF1.4): OFPRRFC_STALE"
2525 echo >>expout1 "OFPT_ROLE_REQUEST (OF1.4): role=master generation_id=3"
2527 # controller 1: Become master using a valid generation ID
2528 ovs-appctl -t `pwd`/c1 ofctl/send 051800180000000500000002000000000000000000000001
2529 echo >>experr1 "send: OFPT_ROLE_REQUEST (OF1.4): role=master generation_id=1"
2530 echo >>expout1 "OFPT_ROLE_REPLY (OF1.4): role=master generation_id=1"
2531 echo >>expout2 "OFPT_ROLE_STATUS (OF1.4): role=slave generation_id=1 reason=master_request"
2534 ovs-appctl -t `pwd`/c$i ofctl/barrier
2535 echo >>expout$i "OFPT_BARRIER_REPLY (OF1.4):"
2541 AT_CHECK([grep -v '^send:' monitor$i.log | STRIP_XIDS], [0], [expout])
2543 AT_CHECK([grep '^send:' monitor$i.log | STRIP_XIDS], [0], [expout])
2548 dnl This test checks that OFPT_PACKET_OUT accepts both OFPP_NONE (as
2549 dnl specified by OpenFlow 1.0) and OFPP_CONTROLLER (used by some
2550 dnl controllers despite the spec) as meaning a packet that was generated
2551 dnl by the controller.
2552 AT_SETUP([ofproto - packet-out from controller (OpenFlow 1.0)])
2554 ADD_OF_PORTS([br0], [1])
2556 # Start a monitor listening for packet-ins.
2557 AT_CHECK([ovs-ofctl -P openflow10 monitor br0 --detach --no-chdir --pidfile])
2558 ovs-appctl -t ovs-ofctl ofctl/send 0109000c0123456700000080
2559 ovs-appctl -t ovs-ofctl ofctl/barrier
2560 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
2561 AT_CAPTURE_FILE([monitor.log])
2563 # Send some packet-outs with OFPP_NONE and OFPP_CONTROLLER (65533) as in_port.
2564 AT_CHECK([ovs-ofctl packet-out br0 none controller,1 '0001020304050010203040501234'])
2565 AT_CHECK([ovs-ofctl packet-out br0 controller controller,1 '0001020304050010203040505678'])
2567 # Stop the monitor and check its output.
2568 ovs-appctl -t ovs-ofctl ofctl/barrier
2569 ovs-appctl -t ovs-ofctl exit
2571 ovs-ofctl dump-ports br0
2573 AT_CHECK([sed 's/ (xid=0x[[0-9a-fA-F]]*)//' monitor.log], [0], [dnl
2574 OFPT_PACKET_IN: total_len=14 in_port=ANY (via action) data_len=14 (unbuffered)
2575 vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1234
2576 OFPT_PACKET_IN: total_len=14 in_port=CONTROLLER (via action) data_len=14 (unbuffered)
2577 vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x5678
2584 dnl This test checks that OFPT_PACKET_OUT accepts both OFPP_NONE (as
2585 dnl specified by OpenFlow 1.2) and OFPP_CONTROLLER (used by some
2586 dnl controllers despite the spec) as meaning a packet that was generated
2587 dnl by the controller.
2588 AT_SETUP([ofproto - packet-out from controller (OpenFlow 1.2)])
2591 # Start a monitor listening for packet-ins.
2592 AT_CHECK([ovs-ofctl -O OpenFlow12 monitor br0 --detach --no-chdir --pidfile])
2593 ovs-appctl -t ovs-ofctl ofctl/send 0309000c0123456700000080
2594 ovs-appctl -t ovs-ofctl ofctl/barrier
2595 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
2596 AT_CAPTURE_FILE([monitor.log])
2598 # Send some packet-outs with OFPP_NONE and OFPP_CONTROLLER (65533) as in_port.
2599 AT_CHECK([ovs-ofctl -O OpenFlow12 packet-out br0 none controller '0001020304050010203040501234'])
2600 AT_CHECK([ovs-ofctl -O OpenFlow12 packet-out br0 4294967293 controller '0001020304050010203040505678'])
2602 # Stop the monitor and check its output.
2603 ovs-appctl -t ovs-ofctl ofctl/barrier
2604 ovs-appctl -t ovs-ofctl exit
2606 AT_CHECK([sed 's/ (xid=0x[[0-9a-fA-F]]*)//' monitor.log], [0], [dnl
2607 OFPT_PACKET_IN (OF1.2): total_len=14 in_port=ANY (via action) data_len=14 (unbuffered)
2608 vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1234
2609 OFPT_PACKET_IN (OF1.2): total_len=14 in_port=CONTROLLER (via action) data_len=14 (unbuffered)
2610 vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x5678
2611 OFPT_BARRIER_REPLY (OF1.2):
2617 dnl This test checks that OFPT_PACKET_OUT accepts both OFPP_NONE (as
2618 dnl specified by OpenFlow 1.1) and OFPP_CONTROLLER (used by some
2619 dnl controllers despite the spec) as meaning a packet that was generated
2620 dnl by the controller.
2621 AT_SETUP([ofproto - packet-out from controller (OpenFlow 1.1)])
2624 # Start a monitor listening for packet-ins.
2625 AT_CHECK([ovs-ofctl -O OpenFlow11 monitor br0 --detach --no-chdir --pidfile])
2626 ovs-appctl -t ovs-ofctl ofctl/send 0209000c0123456700000080
2627 ovs-appctl -t ovs-ofctl ofctl/barrier
2628 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
2629 AT_CAPTURE_FILE([monitor.log])
2631 # Send some packet-outs with OFPP_NONE and OFPP_CONTROLLER (65533) as in_port.
2632 AT_CHECK([ovs-ofctl -O OpenFlow11 packet-out br0 none controller '0001020304050010203040501234'])
2633 AT_CHECK([ovs-ofctl -O OpenFlow11 packet-out br0 4294967293 controller '0001020304050010203040505678'])
2635 # Stop the monitor and check its output.
2636 ovs-appctl -t ovs-ofctl ofctl/barrier
2637 ovs-appctl -t ovs-ofctl exit
2639 AT_CHECK([sed 's/ (xid=0x[[0-9a-fA-F]]*)//' monitor.log], [0], [dnl
2640 OFPT_PACKET_IN (OF1.1): total_len=14 in_port=ANY (via action) data_len=14 (unbuffered)
2641 vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1234
2642 OFPT_PACKET_IN (OF1.1): total_len=14 in_port=CONTROLLER (via action) data_len=14 (unbuffered)
2643 vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x5678
2644 OFPT_BARRIER_REPLY (OF1.1):
2650 dnl This test checks that metadata is encoded in packet_in structures,
2651 dnl supported by NXAST.
2652 AT_SETUP([ofproto - packet-out with metadata (NXM)])
2655 # Start a monitor listening for packet-ins.
2656 AT_CHECK([ovs-ofctl -P nxm monitor br0 --detach --no-chdir --pidfile])
2657 ovs-appctl -t ovs-ofctl ofctl/send 0109000c0123456700000080
2658 ovs-appctl -t ovs-ofctl ofctl/barrier
2659 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
2660 AT_CAPTURE_FILE([monitor.log])
2662 # Send a packet-out with a load action to set some metadata, and forward to controller
2663 AT_CHECK([ovs-ofctl packet-out br0 controller 'load(0xfafafafa5a5a5a5a->OXM_OF_METADATA[[0..63]]), load(0xaa->NXM_NX_PKT_MARK[[]]), controller' '0001020304050010203040501234'])
2665 # Stop the monitor and check its output.
2666 ovs-appctl -t ovs-ofctl ofctl/barrier
2667 ovs-appctl -t ovs-ofctl exit
2669 AT_CHECK([sed 's/ (xid=0x[[0-9a-fA-F]]*)//' monitor.log], [0], [dnl
2670 NXT_PACKET_IN: total_len=14 in_port=CONTROLLER metadata=0xfafafafa5a5a5a5a pkt_mark=0xaa (via action) data_len=14 (unbuffered)
2671 vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1234
2678 dnl This test checks that metadata is encoded in packet_in structures,
2679 dnl supported by NXAST.
2680 AT_SETUP([ofproto - packet-out with metadata (OpenFlow 1.2)])
2683 # Start a monitor listening for packet-ins.
2684 AT_CHECK([ovs-ofctl -O OpenFlow12 monitor br0 --detach --no-chdir --pidfile])
2685 ovs-appctl -t ovs-ofctl ofctl/send 0309000c0123456700000080
2686 ovs-appctl -t ovs-ofctl ofctl/barrier
2687 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
2688 AT_CAPTURE_FILE([monitor.log])
2690 # Send a packet-out with a set-field action to set some metadata, and forward to controller
2691 AT_CHECK([ovs-ofctl -O OpenFlow12 packet-out br0 none 'set_field:0xfafafafa5a5a5a5a->metadata, controller' '0001020304050010203040501234'])
2693 # Stop the monitor and check its output.
2694 ovs-appctl -t ovs-ofctl ofctl/barrier
2695 ovs-appctl -t ovs-ofctl exit
2697 AT_CHECK([sed 's/ (xid=0x[[0-9a-fA-F]]*)//' monitor.log], [0], [dnl
2698 OFPT_PACKET_IN (OF1.2): total_len=14 in_port=ANY metadata=0xfafafafa5a5a5a5a (via action) data_len=14 (unbuffered)
2699 vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1234
2700 OFPT_BARRIER_REPLY (OF1.2):
2706 dnl This test checks that metadata is encoded in packet_in structures,
2707 dnl supported by NXAST.
2708 AT_SETUP([ofproto - packet-out with metadata and dual set_field (OpenFlow 1.3)])
2711 # Start a monitor listening for packet-ins.
2712 AT_CHECK([ovs-ofctl -O OpenFlow13 monitor br0 --detach --no-chdir --pidfile])
2713 ovs-appctl -t ovs-ofctl ofctl/send 0409000c0123456700000080
2714 ovs-appctl -t ovs-ofctl ofctl/barrier
2715 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
2716 AT_CAPTURE_FILE([monitor.log])
2718 # Send a packet-out with a couple of set-field action to set some metadata, and forward to controller
2719 AT_CHECK([ovs-ofctl -O OpenFlow13 packet-out br0 none 'set_field:0xfafafafa5a5a5a5a->metadata, set_field:0x6b->metadata, controller' '0001020304050010203040501234'])
2721 # Stop the monitor and check its output.
2722 ovs-appctl -t ovs-ofctl ofctl/barrier
2723 ovs-appctl -t ovs-ofctl exit
2725 AT_CHECK([sed 's/ (xid=0x[[0-9a-fA-F]]*)//' monitor.log], [0], [dnl
2726 OFPT_PACKET_IN (OF1.3): total_len=14 in_port=ANY metadata=0x6b (via action) data_len=14 (unbuffered)
2727 vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1234
2728 OFPT_BARRIER_REPLY (OF1.3):
2734 dnl This test checks that tunnel metadata is encoded in packet_in structures.
2735 AT_SETUP([ofproto - packet-out with tunnel metadata (OpenFlow 1.2)])
2738 # Start a monitor listening for packet-ins.
2739 AT_CHECK([ovs-ofctl -O OpenFlow12 monitor br0 --detach --no-chdir --pidfile])
2740 ovs-appctl -t ovs-ofctl ofctl/send 0309000c0123456700000080
2741 ovs-appctl -t ovs-ofctl ofctl/barrier
2742 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
2743 AT_CAPTURE_FILE([monitor.log])
2745 # Send a packet-out with set field actions to set some tunnel metadata, and forward to controller
2746 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'])
2748 # Stop the monitor and check its output.
2749 ovs-appctl -t ovs-ofctl ofctl/barrier
2750 ovs-appctl -t ovs-ofctl exit
2752 AT_CHECK([sed 's/ (xid=0x[[0-9a-fA-F]]*)//' monitor.log], [0], [dnl
2753 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)
2754 vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1234
2755 OFPT_BARRIER_REPLY (OF1.2):
2761 m4_divert_push([PREPARE_TESTS])
2762 # Sorts groups of lines that start with a space, without moving them
2763 # past the nearest line that does not start with a space.
2773 print $_ foreach sort(@buffer);
2778 print $_ foreach sort(@buffer);
2781 m4_divert_pop([PREPARE_TESTS])
2783 AT_SETUP([ofproto - flow monitoring])
2784 AT_KEYWORDS([monitor])
2787 ovs-ofctl add-flow br0 in_port=0,dl_vlan=123,actions=output:1
2789 # Start a monitor watching the flow table and check the initial reply.
2790 ovs-ofctl monitor br0 watch: --detach --no-chdir --pidfile >monitor.log 2>&1
2791 AT_CAPTURE_FILE([monitor.log])
2792 ovs-appctl -t ovs-ofctl ofctl/barrier
2793 AT_CHECK([sed 's/ (xid=0x[[1-9a-fA-F]][[0-9a-fA-F]]*)//' monitor.log], [0],
2794 [NXST_FLOW_MONITOR reply:
2795 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=123 actions=output:1
2799 # Add, delete, and modify some flows and check the updates.
2800 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
2801 ovs-ofctl add-flow br0 in_port=0,dl_vlan=124,actions=output:2
2802 ovs-ofctl add-flow br0 in_port=0,dl_vlan=123,actions=output:5
2803 ovs-ofctl add-flow br0 in_port=0,dl_vlan=123,dl_vlan_pcp=0,actions=output:6
2804 ovs-ofctl add-flow br0 in_port=0,dl_vlan=123,dl_vlan_pcp=1,actions=output:7
2805 ovs-ofctl add-flow br0 in_port=0,dl_vlan=123,actions=output:8
2806 ovs-ofctl add-flow br0 in_port=0,dl_vlan=65535,dl_vlan_pcp=0,actions=output:9
2807 ovs-ofctl add-flow br0 in_port=0,dl_vlan=65535,dl_vlan_pcp=1,actions=output:10
2808 ovs-ofctl add-flow br0 in_port=0,dl_vlan=65535,actions=output:11
2809 ovs-ofctl add-flow br0 in_port=0,dl_vlan=8191,dl_vlan_pcp=0,actions=output:12
2810 ovs-ofctl add-flow br0 in_port=0,dl_vlan=8191,dl_vlan_pcp=1,actions=output:13
2811 ovs-ofctl add-flow br0 in_port=0,dl_vlan=8191,actions=output:14
2812 ovs-ofctl add-flow br0 in_port=0,dl_vlan=0,dl_vlan_pcp=0,actions=output:15
2813 ovs-ofctl add-flow br0 in_port=0,dl_vlan=0,dl_vlan_pcp=1,actions=output:16
2814 ovs-ofctl add-flow br0 in_port=0,dl_vlan=0,actions=output:17
2815 ovs-ofctl add-flow br0 in_port=0,dl_vlan=0,dl_vlan_pcp=0,actions=output:18
2816 ovs-ofctl add-flow br0 in_port=0,dl_vlan=0,dl_vlan_pcp=1,actions=output:19
2817 ovs-ofctl add-flow br0 in_port=0,dl_vlan=0,actions=output:20
2818 ovs-ofctl add-flow br0 in_port=0,dl_vlan_pcp=0,actions=output:21
2819 ovs-ofctl add-flow br0 in_port=0,dl_vlan_pcp=1,actions=output:22
2820 ovs-ofctl add-flow br0 in_port=0,actions=output:23
2821 ovs-ofctl mod-flows br0 dl_vlan=123,actions=output:3
2822 ovs-ofctl mod-flows br0 cookie=5,dl_vlan=123,actions=output:3
2823 ovs-ofctl del-flows br0 dl_vlan=123
2824 ovs-ofctl del-flows br0
2825 ovs-appctl -t ovs-ofctl ofctl/barrier
2826 AT_CHECK([sed 's/ (xid=0x[[1-9a-fA-F]][[0-9a-fA-F]]*)//' monitor.log | multiline_sort], [0],
2827 [NXST_FLOW_MONITOR reply (xid=0x0):
2828 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=124 actions=output:2
2829 NXST_FLOW_MONITOR reply (xid=0x0):
2830 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=123 actions=output:5
2831 NXST_FLOW_MONITOR reply (xid=0x0):
2832 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=123,dl_vlan_pcp=0 actions=output:6
2833 NXST_FLOW_MONITOR reply (xid=0x0):
2834 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=123,dl_vlan_pcp=1 actions=output:7
2835 NXST_FLOW_MONITOR reply (xid=0x0):
2836 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=123 actions=output:8
2837 NXST_FLOW_MONITOR reply (xid=0x0):
2838 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=0,dl_vlan_pcp=0 actions=output:9
2839 NXST_FLOW_MONITOR reply (xid=0x0):
2840 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=0,dl_vlan_pcp=1 actions=output:10
2841 NXST_FLOW_MONITOR reply (xid=0x0):
2842 event=ADDED table=0 cookie=0 in_port=0,vlan_tci=0x0000 actions=output:11
2843 NXST_FLOW_MONITOR reply (xid=0x0):
2844 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=4095,dl_vlan_pcp=0 actions=output:12
2845 NXST_FLOW_MONITOR reply (xid=0x0):
2846 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=4095,dl_vlan_pcp=1 actions=output:13
2847 NXST_FLOW_MONITOR reply (xid=0x0):
2848 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=4095 actions=output:14
2849 NXST_FLOW_MONITOR reply (xid=0x0):
2850 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=0,dl_vlan_pcp=0 actions=output:15
2851 NXST_FLOW_MONITOR reply (xid=0x0):
2852 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=0,dl_vlan_pcp=1 actions=output:16
2853 NXST_FLOW_MONITOR reply (xid=0x0):
2854 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=0 actions=output:17
2855 NXST_FLOW_MONITOR reply (xid=0x0):
2856 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=0,dl_vlan_pcp=0 actions=output:18
2857 NXST_FLOW_MONITOR reply (xid=0x0):
2858 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=0,dl_vlan_pcp=1 actions=output:19
2859 NXST_FLOW_MONITOR reply (xid=0x0):
2860 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=0 actions=output:20
2861 NXST_FLOW_MONITOR reply (xid=0x0):
2862 event=ADDED table=0 cookie=0 in_port=0,dl_vlan_pcp=0 actions=output:21
2863 NXST_FLOW_MONITOR reply (xid=0x0):
2864 event=ADDED table=0 cookie=0 in_port=0,dl_vlan_pcp=1 actions=output:22
2865 NXST_FLOW_MONITOR reply (xid=0x0):
2866 event=ADDED table=0 cookie=0 in_port=0 actions=output:23
2867 NXST_FLOW_MONITOR reply (xid=0x0):
2868 event=MODIFIED table=0 cookie=0 in_port=0,dl_vlan=123 actions=output:3
2869 event=MODIFIED table=0 cookie=0 in_port=0,dl_vlan=123,dl_vlan_pcp=0 actions=output:3
2870 event=MODIFIED table=0 cookie=0 in_port=0,dl_vlan=123,dl_vlan_pcp=1 actions=output:3
2871 NXST_FLOW_MONITOR reply (xid=0x0):
2872 event=MODIFIED table=0 cookie=0x5 in_port=0,dl_vlan=123 actions=output:3
2873 event=MODIFIED table=0 cookie=0x5 in_port=0,dl_vlan=123,dl_vlan_pcp=0 actions=output:3
2874 event=MODIFIED table=0 cookie=0x5 in_port=0,dl_vlan=123,dl_vlan_pcp=1 actions=output:3
2875 NXST_FLOW_MONITOR reply (xid=0x0):
2876 event=DELETED reason=delete table=0 cookie=0x5 in_port=0,dl_vlan=123 actions=output:3
2877 event=DELETED reason=delete table=0 cookie=0x5 in_port=0,dl_vlan=123,dl_vlan_pcp=0 actions=output:3
2878 event=DELETED reason=delete table=0 cookie=0x5 in_port=0,dl_vlan=123,dl_vlan_pcp=1 actions=output:3
2879 NXST_FLOW_MONITOR reply (xid=0x0):
2880 event=DELETED reason=delete table=0 cookie=0 in_port=0 actions=output:23
2881 event=DELETED reason=delete table=0 cookie=0 in_port=0,dl_vlan=0 actions=output:20
2882 event=DELETED reason=delete table=0 cookie=0 in_port=0,dl_vlan=0,dl_vlan_pcp=0 actions=output:18
2883 event=DELETED reason=delete table=0 cookie=0 in_port=0,dl_vlan=0,dl_vlan_pcp=1 actions=output:19
2884 event=DELETED reason=delete table=0 cookie=0 in_port=0,dl_vlan=124 actions=output:2
2885 event=DELETED reason=delete table=0 cookie=0 in_port=0,dl_vlan=4095 actions=output:14
2886 event=DELETED reason=delete table=0 cookie=0 in_port=0,dl_vlan=4095,dl_vlan_pcp=0 actions=output:12
2887 event=DELETED reason=delete table=0 cookie=0 in_port=0,dl_vlan=4095,dl_vlan_pcp=1 actions=output:13
2888 event=DELETED reason=delete table=0 cookie=0 in_port=0,dl_vlan_pcp=0 actions=output:21
2889 event=DELETED reason=delete table=0 cookie=0 in_port=0,dl_vlan_pcp=1 actions=output:22
2890 event=DELETED reason=delete table=0 cookie=0 in_port=0,vlan_tci=0x0000 actions=output:11
2894 # Check that our own changes are reported as full updates.
2895 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
2896 ovs-ofctl add-flow br0 in_port=1,actions=output:2
2897 ovs-ofctl add-flow br0 in_port=2,actions=output:1
2898 ovs-appctl -t ovs-ofctl ofctl/barrier
2899 ovs-appctl -t ovs-ofctl ofctl/send 010e004812345678003fffff00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003000000000000ffffffffffff0000
2900 ovs-appctl -t ovs-ofctl ofctl/barrier
2901 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip], [0], [NXST_FLOW reply:
2903 AT_CHECK([sed 's/ (xid=0x[[1-9a-fA-F]][[0-9a-fA-F]]*)//' monitor.log | multiline_sort], [0],
2904 [NXST_FLOW_MONITOR reply (xid=0x0):
2905 event=ADDED table=0 cookie=0 in_port=1 actions=output:2
2906 NXST_FLOW_MONITOR reply (xid=0x0):
2907 event=ADDED table=0 cookie=0 in_port=2 actions=output:1
2909 send: OFPT_FLOW_MOD: DEL priority=0 actions=drop
2910 NXST_FLOW_MONITOR reply (xid=0x0):
2911 event=DELETED reason=delete table=0 cookie=0 in_port=1 actions=output:2
2912 event=DELETED reason=delete table=0 cookie=0 in_port=2 actions=output:1
2916 ovs-appctl -t ovs-ofctl exit
2920 AT_SETUP([ofproto - flow monitoring with !own])
2921 AT_KEYWORDS([monitor])
2924 ovs-ofctl add-flow br0 in_port=0,dl_vlan=123,actions=output:1
2926 # Start a monitor watching the flow table and check the initial reply.
2927 ovs-ofctl monitor br0 watch:\!own --detach --no-chdir --pidfile >monitor.log 2>&1
2928 AT_CAPTURE_FILE([monitor.log])
2929 ovs-appctl -t ovs-ofctl ofctl/barrier
2930 AT_CHECK([sed 's/ (xid=0x[[1-9a-fA-F]][[0-9a-fA-F]]*)//' monitor.log], [0],
2931 [NXST_FLOW_MONITOR reply:
2932 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=123 actions=output:1
2936 # Check that our own changes are reported as abbreviations.
2937 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
2938 ovs-ofctl add-flow br0 in_port=1,actions=output:2
2939 ovs-ofctl add-flow br0 in_port=2,actions=output:1
2940 ovs-appctl -t ovs-ofctl ofctl/barrier
2941 ovs-appctl -t ovs-ofctl ofctl/send 010e004812345678003fffff00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003000000000000ffffffffffff0000
2942 ovs-appctl -t ovs-ofctl ofctl/barrier
2943 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip], [0], [NXST_FLOW reply:
2945 AT_CHECK([sed 's/ (xid=0x[[1-9a-fA-F]][[0-9a-fA-F]]*)//' monitor.log], [0],
2946 [NXST_FLOW_MONITOR reply (xid=0x0):
2947 event=ADDED table=0 cookie=0 in_port=1 actions=output:2
2948 NXST_FLOW_MONITOR reply (xid=0x0):
2949 event=ADDED table=0 cookie=0 in_port=2 actions=output:1
2951 send: OFPT_FLOW_MOD: DEL priority=0 actions=drop
2952 NXST_FLOW_MONITOR reply (xid=0x0):
2953 event=ABBREV xid=0x12345678
2957 ovs-appctl -t ovs-ofctl exit
2961 AT_SETUP([ofproto - flow monitoring with out_port])
2962 AT_KEYWORDS([monitor])
2965 ovs-ofctl add-flow br0 in_port=0,dl_vlan=121,actions=output:1
2966 ovs-ofctl add-flow br0 in_port=0,dl_vlan=122,actions=output:1
2967 ovs-ofctl add-flow br0 in_port=0,dl_vlan=123,actions=output:2
2969 # Start a monitor watching the flow table and check the initial reply.
2970 ovs-ofctl monitor br0 watch:out_port=2 --detach --no-chdir --pidfile >monitor.log 2>&1
2971 AT_CAPTURE_FILE([monitor.log])
2972 ovs-appctl -t ovs-ofctl ofctl/barrier
2973 AT_CHECK([sed 's/ (xid=0x[[1-9a-fA-F]][[0-9a-fA-F]]*)//' monitor.log], [0],
2974 [NXST_FLOW_MONITOR reply:
2975 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=123 actions=output:2
2979 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
2981 # Add, modify flows and check the updates.
2982 ovs-ofctl mod-flows br0 dl_vlan=121,actions=drop
2983 ovs-ofctl mod-flows br0 dl_vlan=122,actions=output:1,output:2
2984 ovs-appctl -t ovs-ofctl ofctl/barrier
2986 ovs-ofctl mod-flows br0 dl_vlan=123,actions=output:1,output:2
2987 ovs-appctl -t ovs-ofctl ofctl/barrier
2989 ovs-ofctl mod-flows br0 dl_vlan=122,actions=output:1
2990 ovs-appctl -t ovs-ofctl ofctl/barrier
2991 ovs-ofctl mod-flows br0 dl_vlan=123,actions=output:2
2992 ovs-appctl -t ovs-ofctl ofctl/barrier
2994 AT_CHECK([sed 's/ (xid=0x[[1-9a-fA-F]][[0-9a-fA-F]]*)//' monitor.log], [0],
2995 [NXST_FLOW_MONITOR reply (xid=0x0):
2996 event=MODIFIED table=0 cookie=0 in_port=0,dl_vlan=122 actions=output:1,output:2
2998 NXST_FLOW_MONITOR reply (xid=0x0):
2999 event=MODIFIED table=0 cookie=0 in_port=0,dl_vlan=123 actions=output:1,output:2
3001 NXST_FLOW_MONITOR reply (xid=0x0):
3002 event=MODIFIED table=0 cookie=0 in_port=0,dl_vlan=122 actions=output:1
3004 NXST_FLOW_MONITOR reply (xid=0x0):
3005 event=MODIFIED table=0 cookie=0 in_port=0,dl_vlan=123 actions=output:2
3009 ovs-appctl -t ovs-ofctl exit
3013 AT_SETUP([ofproto - flow monitoring pause and resume])
3014 AT_KEYWORDS([monitor])
3016 # The maximum socket receive buffer size is important for this test, which
3017 # tests behavior when the receive buffer overflows.
3018 if test -e /proc/sys/net/core/rmem_max; then
3020 rmem_max=`cat /proc/sys/net/core/rmem_max`
3021 elif rmem_max=`sysctl -n net.inet.tcp.recvbuf_max 2>/dev/null`; then
3024 # Don't know how to get maximum socket receive buffer on this OS
3027 # Calculate the total amount of queuing: rmem_max in the kernel, 128 kB
3028 # in ofproto sending userspace (see ofmonitor_flush() in connmgr.c).
3029 queue_size=`expr $rmem_max + 128 \* 1024`
3030 echo rmem_max=$rmem_max queue_size=$queue_size
3032 # If there's too much queuing skip the test to avoid timing out.
3033 AT_SKIP_IF([test $rmem_max -gt 1048576])
3035 # Each flow update message takes up at least 48 bytes of space in queues
3036 # and in practice more than that.
3037 n_msgs=`expr $queue_size / 48`
3042 # Start a monitor watching the flow table, then make it block.
3043 ON_EXIT([kill `cat ovs-ofctl.pid`])
3044 ovs-ofctl monitor br0 watch: --detach --no-chdir --pidfile >monitor.log 2>&1
3045 AT_CAPTURE_FILE([monitor.log])
3046 ovs-appctl -t ovs-ofctl ofctl/block
3048 # Add $n_msgs flows.
3049 (echo "in_port=2,actions=output:2"
3051 for ($i = 0; $i < '$n_msgs'; $i++) {
3052 print "cookie=1,reg1=$i,actions=drop\n";
3055 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
3056 # Check that multipart flow dumps work properly:
3057 AT_CHECK([ovs-ofctl diff-flows br0 flows.txt])
3058 AT_CHECK([ovs-ofctl add-flow br0 in_port=1,cookie=3,actions=drop])
3059 AT_CHECK([ovs-ofctl mod-flows br0 in_port=2,cookie=2,actions=output:2])
3060 AT_CHECK([ovs-ofctl del-flows br0 cookie=1/-1])
3062 ovs-appctl -t ovs-ofctl ofctl/unblock
3064 # Wait for the connection resumed.
3065 # A barrier doesn't work for this purpose.
3066 # https://www.mail-archive.com/dev@openvswitch.org/msg27013.html
3067 # https://www.mail-archive.com/dev@openvswitch.org/msg27675.html
3068 OVS_WAIT_UNTIL([grep NXT_FLOW_MONITOR_RESUMED monitor.log])
3070 ovs-appctl -t ovs-ofctl exit
3072 # Check that the flow monitor reported the same number of flows
3073 # added and deleted, but fewer than we actually added and deleted.
3074 adds=`grep -c 'ADDED.*reg1=' monitor.log`
3075 deletes=`grep -c 'DELETED.*reg1=' monitor.log`
3076 echo adds=$adds deletes=$deletes
3077 AT_CHECK([test $adds -gt 100 && test $adds -lt $n_msgs])
3078 AT_CHECK([test $adds = $deletes])
3080 # Check that the flow monitor reported everything in the expected order:
3082 # event=ADDED table=0 cookie=0x1 reg1=0x22
3084 # NXT_FLOW_MONITOR_PAUSED:
3086 # event=DELETED reason=delete table=0 cookie=0x1 reg1=0x22
3088 # event=ADDED table=0 cookie=0x3 in_port=1
3089 # event=MODIFIED table=0 cookie=0x2 in_port=2 actions=output:2
3090 # NXT_FLOW_MONITOR_RESUMED:
3092 # except that, between the PAUSED and RESUMED, the order of the ADDED
3093 # and MODIFIED lines lines depends on hash order, that is, it varies
3094 # as we change the hash function or change architecture. Therefore,
3095 # we use a couple of tests below to accept both orders.
3096 AT_CHECK([ofctl_strip < monitor.log | sed -n -e '
3099 /NXT_FLOW_MONITOR_PAUSED:/p
3100 /NXT_FLOW_MONITOR_RESUMED:/p
3101 ' > monitor.log.subset])
3102 AT_CHECK([grep -v MODIFIED monitor.log.subset], [0], [dnl
3103 event=ADDED table=0 cookie=0x1 reg1=0x22
3104 NXT_FLOW_MONITOR_PAUSED:
3105 event=DELETED reason=delete table=0 cookie=0x1 reg1=0x22
3106 event=ADDED table=0 cookie=0x3 in_port=1
3107 NXT_FLOW_MONITOR_RESUMED:
3109 AT_CHECK([grep -v ADDED monitor.log.subset], [0], [dnl
3110 NXT_FLOW_MONITOR_PAUSED:
3111 event=DELETED reason=delete table=0 cookie=0x1 reg1=0x22
3112 event=MODIFIED table=0 cookie=0x2 in_port=2 actions=output:2
3113 NXT_FLOW_MONITOR_RESUMED:
3119 AT_SETUP([ofproto - event filtering (OpenFlow 1.3)])
3120 AT_KEYWORDS([monitor])
3123 # Start a monitor, use the required protocol version
3124 ovs-ofctl -O OpenFlow13 monitor br0 --detach --no-chdir --pidfile >monitor.log 2>&1
3125 AT_CAPTURE_FILE([monitor.log])
3127 # Send an OpenFlow13 message (04), OFPT_GET_ASYNC_REQUEST (1a), length (8), xid (0a)
3128 ovs-appctl -t ovs-ofctl ofctl/send 041a00080000000a
3129 ovs-appctl -t ovs-ofctl ofctl/barrier
3131 # Check default setting
3132 read -r -d '' expected <<'EOF'
3135 AT_CHECK([ofctl_strip < monitor.log], [], [dnl
3136 send: OFPT_GET_ASYNC_REQUEST (OF1.3):
3137 OFPT_GET_ASYNC_REPLY (OF1.3):
3139 PACKET_IN: no_match action
3140 PORT_STATUS: add delete modify
3141 FLOW_REMOVED: idle hard delete
3145 PORT_STATUS: add delete modify
3147 OFPT_BARRIER_REPLY (OF1.3):
3153 AT_SETUP([ofproto - ofport_request])
3155 ADD_OF_PORTS([br0], [1], [2], [3])
3157 set_and_check_specific_ofports () {
3158 ovs-vsctl set Interface p1 ofport_request="$1" -- \
3159 set Interface p2 ofport_request="$2" -- \
3160 set Interface p3 ofport_request="$3"
3161 ofports=`ovs-vsctl get Interface p1 ofport -- \
3162 get Interface p2 ofport -- \
3163 get Interface p3 ofport`
3164 AT_CHECK_UNQUOTED([echo $ofports], [0], [$1 $2 $3
3167 for pre in '1 2 3' '1 3 2' '2 1 3' '2 3 1' '3 1 2' '3 2 1'; do
3168 for post in '1 2 3' '1 3 2' '2 1 3' '2 3 1' '3 1 2' '3 2 1'; do
3169 echo -----------------------------------------------------------
3170 echo "Check changing port numbers from $pre to $post"
3171 set_and_check_specific_ofports $pre
3172 set_and_check_specific_ofports $post
3176 ovs-vsctl del-port p3
3178 set_and_check_poorly_specified_ofports () {
3179 ovs-vsctl set Interface p1 ofport_request="$1" -- \
3180 set Interface p2 ofport_request="$2"
3181 p1=`ovs-vsctl get Interface p1 ofport`
3182 p2=`ovs-vsctl get Interface p2 ofport`
3185 AT_CHECK([test "$p1" != "$p2"])
3186 if test "$1" = "$2" && test "$1" != '[[]]'; then
3187 # One port number must be the requested one.
3188 AT_CHECK([test "$p1" = "$1" || test "$p2" = "$1"])
3189 # The other port number must be different (already tested above).
3191 AT_CHECK([test "$1" = '[[]]' || test "$p1" == "$1"])
3192 AT_CHECK([test "$2" = '[[]]' || test "$p2" == "$2"])
3195 for pre in '1 2' '[[]] 2' '1 [[]]' '[[]] [[]]' '2 1' '[[]] 1' '2 [[]]' \
3197 for post in '1 2' '[[]] 2' '1 [[]]' '[[]] [[]]' '2 1' '[[]] 1' '2 [[]]' \
3199 echo -----------------------------------------------------------
3200 echo "Check changing port numbers from $pre to $post"
3201 set_and_check_poorly_specified_ofports $pre
3202 set_and_check_poorly_specified_ofports $post
3209 AT_SETUP([ofproto - bundles, open (OpenFlow 1.4)])
3210 AT_KEYWORDS([monitor])
3213 # Start a monitor, use the required protocol version
3214 ovs-ofctl -O OpenFlow14 monitor br0 --detach --no-chdir --pidfile >monitor.log 2>&1
3215 AT_CAPTURE_FILE([monitor.log])
3217 # Send an OpenFlow14 message (05), OFPT_BUNDLE_CONTROL (21), length (10), xid (0a)
3218 ovs-appctl -t ovs-ofctl ofctl/send "05 21 00 10 00 00 00 0a 00 00 00 01 00 00 00 01"
3219 ovs-appctl -t ovs-ofctl ofctl/barrier
3220 ovs-appctl -t ovs-ofctl exit
3222 AT_CHECK([ofctl_strip < monitor.log], [], [dnl
3223 send: OFPT_BUNDLE_CONTROL (OF1.4):
3224 bundle_id=0x1 type=OPEN_REQUEST flags=atomic
3225 OFPT_BUNDLE_CONTROL (OF1.4):
3226 bundle_id=0x1 type=OPEN_REPLY flags=0
3227 OFPT_BARRIER_REPLY (OF1.4):
3233 AT_SETUP([ofproto - bundles, double open (OpenFlow 1.4)])
3234 AT_KEYWORDS([monitor])
3237 # Start a monitor, use the required protocol version
3238 ovs-ofctl -O OpenFlow14 monitor br0 --detach --no-chdir --pidfile >monitor.log 2>&1
3239 AT_CAPTURE_FILE([monitor.log])
3241 # Send twice an OpenFlow14 message (05), OFPT_BUNDLE_CONTROL (21), length (10), xid (0a)
3242 ovs-appctl -t ovs-ofctl ofctl/send "05 21 00 10 00 00 00 0a 00 00 00 01 00 00 00 01"
3243 ovs-appctl -t ovs-ofctl ofctl/barrier
3244 ovs-appctl -t ovs-ofctl ofctl/send "05 21 00 10 00 00 00 0a 00 00 00 01 00 00 00 01"
3245 ovs-appctl -t ovs-ofctl ofctl/barrier
3246 ovs-appctl -t ovs-ofctl exit
3248 AT_CHECK([ofctl_strip < monitor.log], [0], [dnl
3249 send: OFPT_BUNDLE_CONTROL (OF1.4):
3250 bundle_id=0x1 type=OPEN_REQUEST flags=atomic
3251 OFPT_BUNDLE_CONTROL (OF1.4):
3252 bundle_id=0x1 type=OPEN_REPLY flags=0
3253 OFPT_BARRIER_REPLY (OF1.4):
3254 send: OFPT_BUNDLE_CONTROL (OF1.4):
3255 bundle_id=0x1 type=OPEN_REQUEST flags=atomic
3256 OFPT_ERROR (OF1.4): OFPBFC_BAD_ID
3257 OFPT_BUNDLE_CONTROL (OF1.4):
3258 bundle_id=0x1 type=OPEN_REQUEST flags=atomic
3259 OFPT_BARRIER_REPLY (OF1.4):
3265 AT_SETUP([ofproto - bundle close without open (OpenFlow 1.4)])
3266 AT_KEYWORDS([monitor])
3269 # Start a monitor, use the required protocol version
3270 ovs-ofctl -O OpenFlow14 monitor br0 --detach --no-chdir --pidfile >monitor.log 2>&1
3271 AT_CAPTURE_FILE([monitor.log])
3273 ovs-appctl -t ovs-ofctl ofctl/send "05 21 00 10 00 00 00 0a 00 00 00 01 00 02 00 01"
3274 ovs-appctl -t ovs-ofctl ofctl/barrier
3275 ovs-appctl -t ovs-ofctl exit
3277 AT_CHECK([ofctl_strip < monitor.log], [0], [dnl
3278 send: OFPT_BUNDLE_CONTROL (OF1.4):
3279 bundle_id=0x1 type=CLOSE_REQUEST flags=atomic
3280 OFPT_ERROR (OF1.4): OFPBFC_BAD_ID
3281 OFPT_BUNDLE_CONTROL (OF1.4):
3282 bundle_id=0x1 type=CLOSE_REQUEST flags=atomic
3283 OFPT_BARRIER_REPLY (OF1.4):
3289 AT_SETUP([ofproto - bundle double close (OpenFlow 1.4)])
3290 AT_KEYWORDS([monitor])
3293 # Start a monitor, use the required protocol version
3294 ovs-ofctl -O OpenFlow14 monitor br0 --detach --no-chdir --pidfile >monitor.log 2>&1
3295 AT_CAPTURE_FILE([monitor.log])
3297 # Open, Close, Close
3298 ovs-appctl -t ovs-ofctl ofctl/send "05 21 00 10 00 00 00 0a 00 00 00 01 00 00 00 01"
3299 ovs-appctl -t ovs-ofctl ofctl/barrier
3300 ovs-appctl -t ovs-ofctl ofctl/send "05 21 00 10 00 00 00 0a 00 00 00 01 00 02 00 01"
3301 ovs-appctl -t ovs-ofctl ofctl/barrier
3302 ovs-appctl -t ovs-ofctl ofctl/send "05 21 00 10 00 00 00 0a 00 00 00 01 00 02 00 01"
3303 ovs-appctl -t ovs-ofctl ofctl/barrier
3304 ovs-appctl -t ovs-ofctl exit
3306 AT_CHECK([ofctl_strip < monitor.log], [0], [dnl
3307 send: OFPT_BUNDLE_CONTROL (OF1.4):
3308 bundle_id=0x1 type=OPEN_REQUEST flags=atomic
3309 OFPT_BUNDLE_CONTROL (OF1.4):
3310 bundle_id=0x1 type=OPEN_REPLY flags=0
3311 OFPT_BARRIER_REPLY (OF1.4):
3312 send: OFPT_BUNDLE_CONTROL (OF1.4):
3313 bundle_id=0x1 type=CLOSE_REQUEST flags=atomic
3314 OFPT_BUNDLE_CONTROL (OF1.4):
3315 bundle_id=0x1 type=CLOSE_REPLY flags=0
3316 OFPT_BARRIER_REPLY (OF1.4):
3317 send: OFPT_BUNDLE_CONTROL (OF1.4):
3318 bundle_id=0x1 type=CLOSE_REQUEST flags=atomic
3319 OFPT_ERROR (OF1.4): OFPBFC_BUNDLE_CLOSED
3320 OFPT_BUNDLE_CONTROL (OF1.4):
3321 bundle_id=0x1 type=CLOSE_REQUEST flags=atomic
3322 OFPT_BARRIER_REPLY (OF1.4):
3328 AT_SETUP([ofproto - bundle close, different flags (OpenFlow 1.4)])
3329 AT_KEYWORDS([monitor])
3332 # Start a monitor, use the required protocol version
3333 ovs-ofctl -O OpenFlow14 monitor br0 --detach --no-chdir --pidfile >monitor.log 2>&1
3334 AT_CAPTURE_FILE([monitor.log])
3336 # Open, Close, Close
3337 ovs-appctl -t ovs-ofctl ofctl/send "05 21 00 10 00 00 00 0a 00 00 00 01 00 00 00 01"
3338 ovs-appctl -t ovs-ofctl ofctl/barrier
3339 ovs-appctl -t ovs-ofctl ofctl/send "05 21 00 10 00 00 00 0a 00 00 00 01 00 02 00 02"
3340 ovs-appctl -t ovs-ofctl ofctl/barrier
3341 ovs-appctl -t ovs-ofctl exit
3343 AT_CHECK([ofctl_strip < monitor.log], [0], [dnl
3344 send: OFPT_BUNDLE_CONTROL (OF1.4):
3345 bundle_id=0x1 type=OPEN_REQUEST flags=atomic
3346 OFPT_BUNDLE_CONTROL (OF1.4):
3347 bundle_id=0x1 type=OPEN_REPLY flags=0
3348 OFPT_BARRIER_REPLY (OF1.4):
3349 send: OFPT_BUNDLE_CONTROL (OF1.4):
3350 bundle_id=0x1 type=CLOSE_REQUEST flags=ordered
3351 OFPT_ERROR (OF1.4): OFPBFC_BAD_FLAGS
3352 OFPT_BUNDLE_CONTROL (OF1.4):
3353 bundle_id=0x1 type=CLOSE_REQUEST flags=ordered
3354 OFPT_BARRIER_REPLY (OF1.4):
3360 AT_SETUP([ofproto - bundle commit without open (OpenFlow 1.4)])
3361 AT_KEYWORDS([monitor])
3364 # Start a monitor, use the required protocol version
3365 ovs-ofctl -O OpenFlow14 monitor br0 --detach --no-chdir --pidfile >monitor.log 2>&1
3366 AT_CAPTURE_FILE([monitor.log])
3368 # Open, Close, Close
3369 ovs-appctl -t ovs-ofctl ofctl/send "05 21 00 10 00 00 00 0a 00 00 00 01 00 04 00 01"
3370 ovs-appctl -t ovs-ofctl ofctl/barrier
3371 ovs-appctl -t ovs-ofctl exit
3373 AT_CHECK([ofctl_strip < monitor.log], [0], [dnl
3374 send: OFPT_BUNDLE_CONTROL (OF1.4):
3375 bundle_id=0x1 type=COMMIT_REQUEST flags=atomic
3376 OFPT_ERROR (OF1.4): OFPBFC_BAD_ID
3377 OFPT_BUNDLE_CONTROL (OF1.4):
3378 bundle_id=0x1 type=COMMIT_REQUEST flags=atomic
3379 OFPT_BARRIER_REPLY (OF1.4):
3385 AT_SETUP([ofproto - bundle commit, different flags (OpenFlow 1.4)])
3386 AT_KEYWORDS([monitor])
3389 # Start a monitor, use the required protocol version
3390 ovs-ofctl -O OpenFlow14 monitor br0 --detach --no-chdir --pidfile >monitor.log 2>&1
3391 AT_CAPTURE_FILE([monitor.log])
3393 # Open, Close, Close
3394 ovs-appctl -t ovs-ofctl ofctl/send "05 21 00 10 00 00 00 0a 00 00 00 01 00 00 00 01"
3395 ovs-appctl -t ovs-ofctl ofctl/barrier
3396 ovs-appctl -t ovs-ofctl ofctl/send "05 21 00 10 00 00 00 0a 00 00 00 01 00 04 00 02"
3397 ovs-appctl -t ovs-ofctl ofctl/barrier
3398 ovs-appctl -t ovs-ofctl exit
3400 AT_CHECK([ofctl_strip < monitor.log], [0], [dnl
3401 send: OFPT_BUNDLE_CONTROL (OF1.4):
3402 bundle_id=0x1 type=OPEN_REQUEST flags=atomic
3403 OFPT_BUNDLE_CONTROL (OF1.4):
3404 bundle_id=0x1 type=OPEN_REPLY flags=0
3405 OFPT_BARRIER_REPLY (OF1.4):
3406 send: OFPT_BUNDLE_CONTROL (OF1.4):
3407 bundle_id=0x1 type=COMMIT_REQUEST flags=ordered
3408 OFPT_ERROR (OF1.4): OFPBFC_BAD_FLAGS
3409 OFPT_BUNDLE_CONTROL (OF1.4):
3410 bundle_id=0x1 type=COMMIT_REQUEST flags=ordered
3411 OFPT_BARRIER_REPLY (OF1.4):
3417 AT_SETUP([ofproto - bundle discard without open (OpenFlow 1.4)])
3418 AT_KEYWORDS([monitor])
3421 # Start a monitor, use the required protocol version
3422 ovs-ofctl -O OpenFlow14 monitor br0 --detach --no-chdir --pidfile >monitor.log 2>&1
3423 AT_CAPTURE_FILE([monitor.log])
3425 # Open, Close, Close
3426 ovs-appctl -t ovs-ofctl ofctl/send "05 21 00 10 00 00 00 0a 00 00 00 01 00 06 00 01"
3427 ovs-appctl -t ovs-ofctl ofctl/barrier
3428 ovs-appctl -t ovs-ofctl exit
3430 AT_CHECK([ofctl_strip < monitor.log], [0], [dnl
3431 send: OFPT_BUNDLE_CONTROL (OF1.4):
3432 bundle_id=0x1 type=DISCARD_REQUEST flags=atomic
3433 OFPT_ERROR (OF1.4): OFPBFC_BAD_ID
3434 OFPT_BUNDLE_CONTROL (OF1.4):
3435 bundle_id=0x1 type=DISCARD_REQUEST flags=atomic
3436 OFPT_BARRIER_REPLY (OF1.4):