]> git.proxmox.com Git - mirror_ovs.git/blob - tests/ofproto.at
treewide: Convert leading tabs to spaces.
[mirror_ovs.git] / tests / ofproto.at
1 AT_BANNER([ofproto])
2
3 AT_SETUP([ofproto - echo request])
4 OVS_VSWITCHD_START
5 AT_CHECK([ovs-ofctl -vwarn probe br0])
6 OVS_VSWITCHD_STOP
7 AT_CLEANUP
8
9 AT_SETUP([ofproto - handling messages with bad version])
10 AT_KEYWORDS([monitor])
11 OVS_VSWITCHD_START
12
13 # Start a monitor running OpenFlow 1.0, then send the switch an OF1.1 features
14 # request
15 AT_CHECK([ovs-ofctl -P standard monitor br0 --detach --no-chdir --pidfile])
16 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
17 AT_CAPTURE_FILE([monitor.log])
18 ovs-appctl -t ovs-ofctl ofctl/send 0205000801234567
19 ovs-appctl -t ovs-ofctl ofctl/barrier
20 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
21
22 AT_CHECK([sed 's/ (xid=0x[[0-9a-fA-F]]*)//
23 /ECHO/d' monitor.log], [0], [dnl
24 send: OFPT_FEATURES_REQUEST (OF1.1):
25 OFPT_ERROR (OF1.1): OFPBRC_BAD_VERSION
26 OFPT_FEATURES_REQUEST (OF1.1):
27 OFPT_BARRIER_REPLY:
28 ])
29
30 OVS_VSWITCHD_STOP(["/received OpenFlow version 0x02 != expected 01/d"])
31 AT_CLEANUP
32
33 AT_SETUP([ofproto - feature request, config request])
34 OVS_VSWITCHD_START
35 AT_CHECK([ovs-ofctl -vwarn show br0], [0], [stdout])
36 AT_CHECK([strip_xids < stdout], [0], [dnl
37 OFPT_FEATURES_REPLY: dpid:fedcba9876543210
38 n_tables:254, n_buffers:0
39 capabilities: FLOW_STATS TABLE_STATS PORT_STATS QUEUE_STATS ARP_MATCH_IP
40 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
41 LOCAL(br0): addr:aa:55:aa:55:00:00
42 config: PORT_DOWN
43 state: LINK_DOWN
44 speed: 0 Mbps now, 0 Mbps max
45 OFPT_GET_CONFIG_REPLY: frags=normal miss_send_len=0
46 ])
47 OVS_VSWITCHD_STOP
48 AT_CLEANUP
49
50 AT_SETUP([ofproto - set OpenFlow port number])
51 OVS_VSWITCHD_START(
52 [add-port br0 p1 -- set Interface p1 type=dummy --\
53 add-port br0 p2 -- set Interface p2 type=dummy ofport_request=99])
54 AT_CHECK([ovs-ofctl -vwarn show br0], [0], [stdout])
55 AT_CHECK([[sed '
56 s/ (xid=0x[0-9a-fA-F]*)//
57 s/00:0.$/00:0x/' < stdout]],
58 [0], [dnl
59 OFPT_FEATURES_REPLY: dpid:fedcba9876543210
60 n_tables:254, n_buffers:0
61 capabilities: FLOW_STATS TABLE_STATS PORT_STATS QUEUE_STATS ARP_MATCH_IP
62 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
63 1(p1): addr:aa:55:aa:55:00:0x
64 config: PORT_DOWN
65 state: LINK_DOWN
66 speed: 0 Mbps now, 0 Mbps max
67 99(p2): addr:aa:55:aa:55:00:0x
68 config: PORT_DOWN
69 state: LINK_DOWN
70 speed: 0 Mbps now, 0 Mbps max
71 LOCAL(br0): addr:aa:55:aa:55:00:0x
72 config: PORT_DOWN
73 state: LINK_DOWN
74 speed: 0 Mbps now, 0 Mbps max
75 OFPT_GET_CONFIG_REPLY: frags=normal miss_send_len=0
76 ])
77
78 OVS_VSWITCHD_STOP
79 AT_CLEANUP
80
81 dnl This is really bare-bones.
82 dnl It at least checks request and reply serialization and deserialization.
83 AT_SETUP([ofproto - port stats - (OpenFlow 1.0)])
84 OVS_VSWITCHD_START
85 AT_CHECK([ovs-ofctl -vwarn dump-ports br0], [0], [stdout])
86 AT_CHECK([strip_xids < stdout], [0], [dnl
87 OFPST_PORT reply: 1 ports
88 port LOCAL: rx pkts=0, bytes=0, drop=?, errs=?, frame=?, over=?, crc=?
89 tx pkts=0, bytes=0, drop=?, errs=?, coll=?
90 ])
91 OVS_VSWITCHD_STOP
92 AT_CLEANUP
93
94 AT_SETUP([ofproto - port stats - (OpenFlow 1.2)])
95 OVS_VSWITCHD_START
96 AT_CHECK([ovs-ofctl -O OpenFlow12 -vwarn dump-ports br0], [0], [stdout])
97 AT_CHECK([strip_xids < stdout], [0], [dnl
98 OFPST_PORT reply (OF1.2): 1 ports
99 port LOCAL: rx pkts=0, bytes=0, drop=?, errs=?, frame=?, over=?, crc=?
100 tx pkts=0, bytes=0, drop=?, errs=?, coll=?
101 ])
102 OVS_VSWITCHD_STOP
103 AT_CLEANUP
104
105 AT_SETUP([ofproto - port stats - (OpenFlow 1.4)])
106 OVS_VSWITCHD_START
107 AT_CHECK([ovs-ofctl -O OpenFlow14 -vwarn dump-ports br0], [0], [stdout])
108 AT_CHECK([strip_xids < stdout | sed 's/duration=[[0-9.]]*s/duration=?s/'],
109 [0], [dnl
110 OFPST_PORT reply (OF1.4): 1 ports
111 port LOCAL: rx pkts=0, bytes=0, drop=?, errs=?, frame=?, over=?, crc=?
112 tx pkts=0, bytes=0, drop=?, errs=?, coll=?
113 duration=?s
114 CUSTOM Statistics
115 rx_custom_packets_1=0, rx_custom_packets_2=0,
116 ])
117 OVS_VSWITCHD_STOP
118 AT_CLEANUP
119
120 dnl This is really bare-bones.
121 dnl It at least checks request and reply serialization and deserialization.
122 AT_SETUP([ofproto - port-desc stats (OpenFlow 1.0)])
123 OVS_VSWITCHD_START
124 AT_CHECK([ovs-ofctl -vwarn dump-ports-desc br0], [0], [stdout])
125 AT_CHECK([strip_xids < stdout], [0], [dnl
126 OFPST_PORT_DESC reply:
127 LOCAL(br0): addr:aa:55:aa:55:00:00
128 config: PORT_DOWN
129 state: LINK_DOWN
130 speed: 0 Mbps now, 0 Mbps max
131 ])
132 OVS_VSWITCHD_STOP
133 AT_CLEANUP
134
135 dnl This is really bare-bones.
136 dnl It at least checks request and reply serialization and deserialization.
137 AT_SETUP([ofproto - port-desc stats (OpenFlow 1.2)])
138 OVS_VSWITCHD_START
139 AT_CHECK([ovs-ofctl -O OpenFlow12 -vwarn dump-ports-desc br0], [0], [stdout])
140 AT_CHECK([strip_xids < stdout], [0], [dnl
141 OFPST_PORT_DESC reply (OF1.2):
142 LOCAL(br0): addr:aa:55:aa:55:00:00
143 config: PORT_DOWN
144 state: LINK_DOWN
145 speed: 0 Mbps now, 0 Mbps max
146 ])
147 OVS_VSWITCHD_STOP
148 AT_CLEANUP
149
150 AT_SETUP([ofproto - port-desc stats (OpenFlow 1.5)])
151 OVS_VSWITCHD_START
152 add_of_ports br0 1 2 3
153 AT_CHECK([ovs-ofctl -F OXM-OpenFlow15 -O OpenFlow15 -vwarn dump-ports-desc br0], [0], [stdout])
154 AT_CHECK([strip_xids < stdout | sed 's/00:0./00:0x/'], [0], [dnl
155 OFPST_PORT_DESC reply (OF1.5):
156 1(p1): addr:aa:55:aa:55:00:0x
157 config: PORT_DOWN
158 state: LINK_DOWN
159 speed: 0 Mbps now, 0 Mbps max
160 2(p2): addr:aa:55:aa:55:00:0x
161 config: PORT_DOWN
162 state: LINK_DOWN
163 speed: 0 Mbps now, 0 Mbps max
164 3(p3): addr:aa:55:aa:55:00:0x
165 config: PORT_DOWN
166 state: LINK_DOWN
167 speed: 0 Mbps now, 0 Mbps max
168 LOCAL(br0): addr:aa:55:aa:55:00:0x
169 config: PORT_DOWN
170 state: LINK_DOWN
171 speed: 0 Mbps now, 0 Mbps max
172 ])
173 AT_CHECK([ovs-ofctl -F OXM-OpenFlow15 -O OpenFlow15 -vwarn dump-ports-desc br0 2], [0], [stdout])
174 AT_CHECK([strip_xids < stdout | sed 's/00:0./00:0x/'], [0], [dnl
175 OFPST_PORT_DESC reply (OF1.5):
176 2(p2): addr:aa:55:aa:55:00:0x
177 config: PORT_DOWN
178 state: LINK_DOWN
179 speed: 0 Mbps now, 0 Mbps max
180 ])
181 OVS_VSWITCHD_STOP
182 AT_CLEANUP
183
184 AT_SETUP([ofproto - port-desc stats (OpenFlow 1.6)])
185 OVS_VSWITCHD_START
186 add_of_ports br0 1 2 3
187 AT_CHECK([ovs-ofctl -F OXM-OpenFlow16 -O OpenFlow16 -vwarn dump-ports-desc br0], [0], [stdout])
188 AT_CHECK([strip_xids < stdout | sed 's/00:0./00:0x/'], [0], [dnl
189 OFPST_PORT_DESC reply (OF1.6):
190 1(p1): addr:aa:55:aa:55:00:0x
191 config: PORT_DOWN
192 state: LINK_DOWN
193 speed: 0 Mbps now, 0 Mbps max
194 2(p2): addr:aa:55:aa:55:00:0x
195 config: PORT_DOWN
196 state: LINK_DOWN
197 speed: 0 Mbps now, 0 Mbps max
198 3(p3): addr:aa:55:aa:55:00:0x
199 config: PORT_DOWN
200 state: LINK_DOWN
201 speed: 0 Mbps now, 0 Mbps max
202 LOCAL(br0): addr:aa:55:aa:55:00:0x
203 config: PORT_DOWN
204 state: LINK_DOWN
205 speed: 0 Mbps now, 0 Mbps max
206 ])
207 AT_CHECK([ovs-ofctl -F OXM-OpenFlow16 -O OpenFlow16 -vwarn dump-ports-desc br0 2], [0], [stdout])
208 AT_CHECK([strip_xids < stdout | sed 's/00:0./00:0x/'], [0], [dnl
209 OFPST_PORT_DESC reply (OF1.6):
210 2(p2): addr:aa:55:aa:55:00:0x
211 config: PORT_DOWN
212 state: LINK_DOWN
213 speed: 0 Mbps now, 0 Mbps max
214 ])
215 OVS_VSWITCHD_STOP
216 AT_CLEANUP
217
218 dnl CHECK_QUEUE_STATS(label, option, format)
219 m4_define([CHECK_QUEUE_STATS], [
220 AT_SETUP([ofproto - queue stats - (OpenFlow $1)])
221 OVS_VSWITCHD_START
222
223 AT_CHECK([ovs-ofctl -O $2 queue-stats br0 | strip_xids], [0],
224 [OFPST_QUEUE reply$3: 1 queues
225 port LOCAL queue 0: bytes=?, pkts=?, errors=?, duration=?
226 ])
227
228 AT_CHECK([ovs-ofctl -O $2 queue-stats br0 LOCAL | strip_xids], [0],
229 [OFPST_QUEUE reply$3: 1 queues
230 port LOCAL queue 0: bytes=?, pkts=?, errors=?, duration=?
231 ])
232
233 AT_CHECK([ovs-ofctl -O $2 queue-stats br0 LOCAL 0 | strip_xids], [0],
234 [OFPST_QUEUE reply$3: 1 queues
235 port LOCAL queue 0: bytes=?, pkts=?, errors=?, duration=?
236 ])
237
238 AT_CHECK([ovs-ofctl -O $2 queue-stats br0 ANY 0 | strip_xids], [0],
239 [OFPST_QUEUE reply$3: 1 queues
240 port LOCAL queue 0: bytes=?, pkts=?, errors=?, duration=?
241 ])
242
243 AT_CHECK([ovs-ofctl -O $2 queue-stats br0 LOCAL 5 | strip_xids], [0],
244 [OFPT_ERROR$3: OFPQOFC_BAD_QUEUE
245 OFPST_QUEUE request$3: port=LOCAL queue=5
246 ])
247
248 AT_CHECK([ovs-ofctl -O $2 queue-stats br0 ANY 5 | strip_xids], [0],
249 [OFPT_ERROR$3: OFPQOFC_BAD_QUEUE
250 OFPST_QUEUE request$3: port=ANY queue=5
251 ])
252
253 AT_CHECK([ovs-ofctl -O $2 queue-stats br0 10 | strip_xids], [0],
254 [OFPT_ERROR$3: OFPQOFC_BAD_PORT
255 OFPST_QUEUE request$3: port=10 queue=ALL
256 ])
257 OVS_VSWITCHD_STOP
258 AT_CLEANUP
259 ])
260 CHECK_QUEUE_STATS([1.0], [OpenFlow10], [])
261 CHECK_QUEUE_STATS([1.1], [OpenFlow11], [ (OF1.1)])
262 CHECK_QUEUE_STATS([1.2], [OpenFlow12], [ (OF1.2)])
263 CHECK_QUEUE_STATS([1.3], [OpenFlow13], [ (OF1.3)])
264 CHECK_QUEUE_STATS([1.4], [OpenFlow14], [ (OF1.4)])
265
266 dnl This is really bare-bones.
267 dnl It at least checks request and reply serialization and deserialization.
268 AT_SETUP([ofproto - queue configuration - (OpenFlow 1.0)])
269 OVS_VSWITCHD_START
270 add_of_ports br0 1 2
271 AT_CHECK([ovs-ofctl queue-get-config br0 1], [0], [stdout])
272 AT_CHECK([strip_xids < stdout], [0], [dnl
273 OFPT_QUEUE_GET_CONFIG_REPLY: port=1
274 queue 0:
275 ])
276 AT_CHECK([ovs-ofctl queue-get-config br0], [0], [stdout])
277 AT_CHECK([strip_xids < stdout | sort], [0], [dnl
278 OFPT_QUEUE_GET_CONFIG_REPLY: port=1
279 OFPT_QUEUE_GET_CONFIG_REPLY: port=2
280 queue 0:
281 queue 0:
282 ])
283 AT_CHECK([ovs-ofctl queue-get-config br0 10], [0],
284 [OFPT_ERROR (xid=0x2): OFPQOFC_BAD_PORT
285 OFPT_QUEUE_GET_CONFIG_REQUEST (xid=0x2): port=10
286 ])
287 OVS_VSWITCHD_STOP
288 AT_CLEANUP
289
290 AT_SETUP([ofproto - queue configuration - (OpenFlow 1.1)])
291 OVS_VSWITCHD_START
292 add_of_ports br0 1 2
293 AT_CHECK([ovs-ofctl -O OpenFlow11 queue-get-config br0 1], [0], [stdout])
294 AT_CHECK([strip_xids < stdout], [0], [dnl
295 OFPT_QUEUE_GET_CONFIG_REPLY (OF1.1): port=1
296 queue 0:
297 ])
298 AT_CHECK([ovs-ofctl -O OpenFlow11 queue-get-config br0 10 | strip_xids], [0],
299 [OFPT_ERROR (OF1.1): OFPQOFC_BAD_PORT
300 OFPT_QUEUE_GET_CONFIG_REQUEST (OF1.1): port=10
301 ])
302 OVS_VSWITCHD_STOP
303 AT_CLEANUP
304
305 AT_SETUP([ofproto - queue configuration - (OpenFlow 1.2)])
306 OVS_VSWITCHD_START
307 add_of_ports br0 1 2
308 AT_CHECK([ovs-ofctl -O OpenFlow12 queue-get-config br0 1], [0], [stdout])
309 AT_CHECK([strip_xids < stdout], [0], [dnl
310 OFPT_QUEUE_GET_CONFIG_REPLY (OF1.2): port=1
311 queue 0:
312 ])
313 AT_CHECK([ovs-ofctl -O OpenFlow12 queue-get-config br0 ANY], [0], [stdout])
314 AT_CHECK([strip_xids < stdout], [0], [dnl
315 OFPT_QUEUE_GET_CONFIG_REPLY (OF1.2): port=ANY
316 queue 0:
317 queue 0:
318 queue 0:
319 ])
320 AT_CHECK([ovs-ofctl -O OpenFlow12 queue-get-config br0 10 | strip_xids], [0],
321 [OFPT_ERROR (OF1.2): OFPQOFC_BAD_PORT
322 OFPT_QUEUE_GET_CONFIG_REQUEST (OF1.2): port=10
323 ])
324 OVS_VSWITCHD_STOP
325 AT_CLEANUP
326
327 AT_SETUP([ofproto - queue configuration - (OpenFlow 1.4)])
328 OVS_VSWITCHD_START
329 add_of_ports br0 1 2
330
331 AT_CHECK([ovs-ofctl -O OpenFlow14 queue-get-config br0 any | strip_xids], [0],
332 [OFPST_QUEUE_DESC reply (OF1.4): port=1
333 queue 0:
334 port=2
335 queue 0:
336 port=LOCAL
337 queue 0:
338 ])
339
340 AT_CHECK([ovs-ofctl -O OpenFlow14 queue-get-config br0 1 | strip_xids], [0],
341 [OFPST_QUEUE_DESC reply (OF1.4): port=1
342 queue 0:
343 ])
344
345 AT_CHECK([ovs-ofctl -O OpenFlow14 queue-get-config br0 10 | strip_xids], [0],
346 [OFPT_ERROR (OF1.4): OFPQOFC_BAD_PORT
347 OFPST_QUEUE_DESC request (OF1.4): port=10
348 ])
349
350 AT_CHECK([ovs-ofctl -O OpenFlow14 queue-get-config br0 1 2 | strip_xids], [0],
351 [OFPT_ERROR (OF1.4): OFPQOFC_BAD_QUEUE
352 OFPST_QUEUE_DESC request (OF1.4): port=1 queue=2
353 ])
354 OVS_VSWITCHD_STOP
355 AT_CLEANUP
356
357 dnl This is really bare-bones.
358 dnl It at least checks request and reply serialization and deserialization.
359 dnl Actions definition listed in both supported formats (w/ actions=)
360 AT_SETUP([ofproto - del group (OpenFlow 1.0 extension)])
361 OVS_VSWITCHD_START
362 AT_DATA([groups.txt], [dnl
363 group_id=1233,type=select,selection_method=hash,bucket=output:10,bucket=output:11
364 group_id=1234,type=select,selection_method=hash,fields(eth_dst,ip_dst,tcp_dst),bucket=output:10,bucket=output:11
365 group_id=1235,type=all,bucket=actions=output:12,bucket=bucket_id:0,actions=output:10,bucket=bucket_id:1,actions=output:11
366 group_id=1236,type=select,selection_method=dp_hash,bucket=output:10,bucket=output:11
367 ])
368 AT_CHECK([ovs-ofctl -O OpenFlow10 -vwarn add-groups br0 groups.txt])
369 AT_CHECK([ovs-ofctl -O OpenFlow10 -vwarn dump-groups br0 1234], [0], [stdout])
370 AT_CHECK([strip_xids < stdout], [0], [dnl
371 NXST_GROUP_DESC reply:
372 group_id=1234,type=select,selection_method=hash,fields(eth_dst,ip_dst,tcp_dst),bucket=bucket_id:0,actions=output:10,bucket=bucket_id:1,actions=output:11
373 ])
374 AT_CHECK([ovs-ofctl -O OpenFlow10 -vwarn del-groups br0 group_id=1234])
375 AT_CHECK([ovs-ofctl -O OpenFlow10 -vwarn dump-groups br0], [0], [stdout])
376 AT_CHECK([strip_xids < stdout | sort], [0], [dnl
377 group_id=1233,type=select,selection_method=hash,bucket=bucket_id:0,actions=output:10,bucket=bucket_id:1,actions=output:11
378 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
379 group_id=1236,type=select,selection_method=dp_hash,bucket=bucket_id:0,actions=output:10,bucket=bucket_id:1,actions=output:11
380 NXST_GROUP_DESC reply:
381 ])
382 AT_CHECK([ovs-ofctl -O OpenFlow10 -vwarn del-groups br0 group_id=1234])
383 AT_CHECK([ovs-ofctl -O OpenFlow10 -vwarn dump-groups br0], [0], [stdout])
384 AT_CHECK([strip_xids < stdout | sort], [0], [dnl
385 group_id=1233,type=select,selection_method=hash,bucket=bucket_id:0,actions=output:10,bucket=bucket_id:1,actions=output:11
386 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
387 group_id=1236,type=select,selection_method=dp_hash,bucket=bucket_id:0,actions=output:10,bucket=bucket_id:1,actions=output:11
388 NXST_GROUP_DESC reply:
389 ])
390 AT_CHECK([ovs-ofctl -O OpenFlow10 -vwarn del-groups br0], [0])
391 AT_CHECK([ovs-ofctl -O OpenFlow10 -vwarn dump-groups br0], [0], [stdout])
392 AT_CHECK([strip_xids < stdout], [0], [dnl
393 NXST_GROUP_DESC reply:
394 ])
395 OVS_VSWITCHD_STOP
396 AT_CLEANUP
397
398 dnl This is really bare-bones.
399 dnl It at least checks request and reply serialization and deserialization.
400 dnl Actions definition listed in both supported formats (w/ actions=)
401 AT_SETUP([ofproto - del group (OpenFlow 1.1)])
402 OVS_VSWITCHD_START
403 AT_DATA([groups.txt], [dnl
404 group_id=1234,type=all,bucket=output:10
405 group_id=1235,type=all,bucket=actions=output:10
406 ])
407 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn add-groups br0 groups.txt])
408 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn dump-groups br0 ], [0], [stdout])
409 AT_CHECK([strip_xids < stdout | sort], [0], [dnl
410 group_id=1234,type=all,bucket=actions=output:10
411 group_id=1235,type=all,bucket=actions=output:10
412 OFPST_GROUP_DESC reply (OF1.1):
413 ])
414 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn del-groups br0 group_id=1234])
415 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn dump-groups br0], [0], [stdout])
416 AT_CHECK([strip_xids < stdout], [0], [dnl
417 OFPST_GROUP_DESC reply (OF1.1):
418 group_id=1235,type=all,bucket=actions=output:10
419 ])
420 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn del-groups br0 group_id=1234])
421 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn dump-groups br0], [0], [stdout])
422 AT_CHECK([strip_xids < stdout], [0], [dnl
423 OFPST_GROUP_DESC reply (OF1.1):
424 group_id=1235,type=all,bucket=actions=output:10
425 ])
426 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn del-groups br0], [0])
427 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn dump-groups br0], [0], [stdout])
428 AT_CHECK([strip_xids < stdout], [0], [dnl
429 OFPST_GROUP_DESC reply (OF1.1):
430 ])
431
432 # Negative test.
433 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn del-groups br0 group_id=0xfffffff0],
434 [1], [], [ovs-ofctl: invalid group id 4294967280
435 ])
436 OVS_VSWITCHD_STOP
437 AT_CLEANUP
438
439 dnl This is really bare-bones.
440 dnl It at least checks request and reply serialization and deserialization.
441 dnl Actions definition listed in both supported formats (w/ actions=)
442 AT_SETUP([ofproto - add indirect group])
443 OVS_VSWITCHD_START
444 dnl indirect group must have exactly one bucket
445 AT_DATA([stderr], [dnl
446 OFPT_ERROR (OF1.1) (xid=0x2): OFPGMFC_INVALID_GROUP
447 OFPT_GROUP_MOD (OF1.1) (xid=0x2): ***decode error: OFPGMFC_INVALID_GROUP***
448 ])
449 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn add-group br0 'group_id=1234,type=indirect'], [1], , [stderr])
450 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn add-group br0 'group_id=1235,type=indirect,bucket=output:10'])
451 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn add-group br0 'group_id=1236,type=indirect,bucket=output:10,bucket=output:11'], [1], , [stderr])
452 OVS_VSWITCHD_STOP
453 AT_CLEANUP
454
455 AT_SETUP([ofproto - group mod with mod and add_or_mod command])
456 OVS_VSWITCHD_START
457 dnl Check that mod-group for non-existing group fails without --may-create
458 AT_DATA([stderr], [dnl
459 OFPT_ERROR (OF1.3) (xid=0x2): OFPGMFC_UNKNOWN_GROUP
460 OFPT_GROUP_MOD (OF1.3) (xid=0x2):
461 MOD group_id=1234,type=indirect,bucket=actions=output:2
462 ])
463 AT_CHECK([ovs-ofctl -O OpenFlow13 -vwarn mod-group br0 'group_id=1234,type=indirect,bucket=actions=2'], [1], , [stderr])
464 dnl Check that mod-group for non-existing group succeeds with --may-create
465 AT_CHECK([ovs-ofctl -O OpenFlow13 -vwarn --may-create mod-group br0 'group_id=1234,type=indirect,bucket=actions=2'])
466 AT_CHECK([ovs-ofctl -O OpenFlow13 -vwarn dump-groups br0], [0], [stdout])
467 AT_CHECK([strip_xids < stdout], [0], [dnl
468 OFPST_GROUP_DESC reply (OF1.3):
469 group_id=1234,type=indirect,bucket=actions=output:2
470 ])
471 dnl Check that mod-group for existing group succeeds with --may-create
472 AT_CHECK([ovs-ofctl -O OpenFlow13 -vwarn --may-create mod-group br0 'group_id=1234,type=indirect,bucket=actions=3'])
473 AT_CHECK([ovs-ofctl -O OpenFlow13 -vwarn dump-groups br0], [0], [stdout])
474 AT_CHECK([strip_xids < stdout], [0], [dnl
475 OFPST_GROUP_DESC reply (OF1.3):
476 group_id=1234,type=indirect,bucket=actions=output:3
477 ])
478 OVS_VSWITCHD_STOP
479 AT_CLEANUP
480
481 dnl This is really bare-bones.
482 dnl It at least checks request and reply serialization and deserialization.
483 dnl Actions definition listed in both supported formats (w/ actions=)
484 AT_SETUP([ofproto - del group (OpenFlow 1.5)])
485 OVS_VSWITCHD_START
486 AT_DATA([groups.txt], [dnl
487 group_id=1233,type=select,selection_method=hash,bucket=output:10,bucket=output:11
488 group_id=1234,type=select,selection_method=hash,fields(eth_dst,ip_dst,tcp_dst),bucket=output:10,bucket=output:11
489 group_id=1235,type=all,bucket=actions=output:12,bucket=bucket_id:0,actions=output:10,bucket=bucket_id:1,actions=output:11
490 group_id=1236,type=select,selection_method=dp_hash,bucket=output:10,bucket=output:11
491 ])
492 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn add-groups br0 groups.txt])
493 AT_CHECK([ovs-ofctl -F OXM-OpenFlow15 -O OpenFlow15 -vwarn dump-groups br0 1234], [0], [stdout])
494 AT_CHECK([strip_xids < stdout], [0], [dnl
495 OFPST_GROUP_DESC reply (OF1.5):
496 group_id=1234,type=select,selection_method=hash,fields(eth_dst,ip_dst,tcp_dst),bucket=bucket_id:0,actions=output:10,bucket=bucket_id:1,actions=output:11
497 ])
498 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn del-groups br0 group_id=1234])
499 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn dump-groups br0], [0], [stdout])
500 AT_CHECK([strip_xids < stdout | sort], [0], [dnl
501 group_id=1233,type=select,selection_method=hash,bucket=bucket_id:0,actions=output:10,bucket=bucket_id:1,actions=output:11
502 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
503 group_id=1236,type=select,selection_method=dp_hash,bucket=bucket_id:0,actions=output:10,bucket=bucket_id:1,actions=output:11
504 OFPST_GROUP_DESC reply (OF1.5):
505 ])
506 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn del-groups br0 group_id=1234])
507 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn dump-groups br0], [0], [stdout])
508 AT_CHECK([strip_xids < stdout | sort], [0], [dnl
509 group_id=1233,type=select,selection_method=hash,bucket=bucket_id:0,actions=output:10,bucket=bucket_id:1,actions=output:11
510 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
511 group_id=1236,type=select,selection_method=dp_hash,bucket=bucket_id:0,actions=output:10,bucket=bucket_id:1,actions=output:11
512 OFPST_GROUP_DESC reply (OF1.5):
513 ])
514 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn del-groups br0], [0])
515 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn dump-groups br0], [0], [stdout])
516 AT_CHECK([strip_xids < stdout], [0], [dnl
517 OFPST_GROUP_DESC reply (OF1.5):
518 ])
519 OVS_VSWITCHD_STOP
520 AT_CLEANUP
521
522 dnl This is really bare-bones.
523 dnl It at least checks request and reply serialization and deserialization.
524 AT_SETUP([ofproto - del group deletes flows])
525 OVS_VSWITCHD_START
526 AT_DATA([groups.txt], [dnl
527 group_id=1234,type=all,bucket=output:10
528 group_id=1235,type=all,bucket=output:10
529 ])
530 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn add-groups br0 groups.txt])
531 AT_DATA([flows.txt], [dnl
532 tcp actions=group:1234
533 table=2 udp actions=group:1235
534 ])
535 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn add-flows br0 flows.txt])
536 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn dump-flows br0 | ofctl_strip | sort],
537 [0], [dnl
538 table=2, udp actions=group:1235
539 tcp actions=group:1234
540 OFPST_FLOW reply (OF1.1):
541 ])
542 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn del-groups br0 group_id=1234])
543 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn dump-flows br0 | ofctl_strip | sort],
544 [0], [dnl
545 table=2, udp actions=group:1235
546 OFPST_FLOW reply (OF1.1):
547 ])
548 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn del-groups br0 group_id=1234])
549 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn dump-flows br0 | ofctl_strip | sort],
550 [0], [dnl
551 table=2, udp actions=group:1235
552 OFPST_FLOW reply (OF1.1):
553 ])
554 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn del-groups br0])
555 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn dump-flows br0 | ofctl_strip | sort],
556 [0], [dnl
557 OFPST_FLOW reply (OF1.1):
558 ])
559 OVS_VSWITCHD_STOP
560 AT_CLEANUP
561
562 dnl This is really bare-bones.
563 dnl It at least checks request and reply serialization and deserialization.
564 dnl Actions definition listed in both supported formats (w/ actions=)
565 AT_SETUP([ofproto - insert group buckets])
566 OVS_VSWITCHD_START
567 # Add group with no buckets.
568 AT_DATA([groups.txt], [dnl
569 group_id=1234,type=all
570 ])
571 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn add-groups br0 groups.txt])
572 AT_CHECK([ovs-ofctl -F OXM-OpenFlow15 -O OpenFlow15 -vwarn dump-groups br0 1234], [0], [stdout])
573 AT_CHECK([strip_xids < stdout], [0], [dnl
574 OFPST_GROUP_DESC reply (OF1.5):
575 group_id=1234,type=all
576 ])
577
578 # Add two buckets, using "last".
579 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn insert-buckets br0 group_id=1234,command_bucket_id=last,bucket=bucket_id:10,actions=output:10,bucket=bucket_id:11,actions=output:11])
580 AT_CHECK([ovs-ofctl -F OXM-OpenFlow15 -O OpenFlow15 -vwarn dump-groups br0 1234], [0], [stdout])
581 AT_CHECK([strip_xids < stdout], [0], [dnl
582 OFPST_GROUP_DESC reply (OF1.5):
583 group_id=1234,type=all,bucket=bucket_id:10,actions=output:10,bucket=bucket_id:11,actions=output:11
584 ])
585
586 # Start over again, then add two buckets using "first".
587 AT_CHECK([ovs-ofctl -O OpenFlow15 --strict del-groups br0 group_id=1234])
588 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn add-group br0 group_id=1234,type=all])
589 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn insert-buckets br0 group_id=1234,command_bucket_id=first,bucket=bucket_id:10,actions=output:10,bucket=bucket_id:11,actions=output:11])
590 AT_CHECK([ovs-ofctl -F OXM-OpenFlow15 -O OpenFlow15 -vwarn dump-groups br0 1234], [0], [stdout])
591 AT_CHECK([strip_xids < stdout], [0], [dnl
592 OFPST_GROUP_DESC reply (OF1.5):
593 group_id=1234,type=all,bucket=bucket_id:10,actions=output:10,bucket=bucket_id:11,actions=output:11
594 ])
595
596 # Add two more buckets before the existing ones.
597 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])
598 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn dump-groups br0], [0], [stdout])
599 AT_CHECK([strip_xids < stdout], [0], [dnl
600 OFPST_GROUP_DESC reply (OF1.5):
601 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
602 ])
603
604 # Add another bucket at the end.
605 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])
606 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn dump-groups br0], [0], [stdout])
607 AT_CHECK([strip_xids < stdout], [0], [dnl
608 OFPST_GROUP_DESC reply (OF1.5):
609 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
610 ])
611
612 # Verify that duplicate bucket IDs are rejected.
613 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn insert-buckets br0 group_id=1234,command_bucket_id=last,bucket=bucket_id:14,actions=output:14,bucket=bucket_id:15,actions=output:15], [1], [], [stderr])
614 AT_CHECK([strip_xids < stderr | sed '/truncated/,$d'], [0], [dnl
615 OFPT_ERROR (OF1.5): OFPGMFC_BUCKET_EXISTS
616 OFPT_GROUP_MOD (OF1.5):
617 INSERT_BUCKET command_bucket_id:last,group_id=1234,bucket=bucket_id:14,actions=output:14,bucket=bucket_id:15,actions=output:15
618 ])
619
620
621 # Add another bucket just before bucket 15.
622 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn insert-buckets br0 group_id=1234,command_bucket_id=15])
623 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn dump-groups br0], [0], [stdout])
624 AT_CHECK([strip_xids < stdout], [0], [dnl
625 OFPST_GROUP_DESC reply (OF1.5):
626 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
627 ])
628
629 # Add two more buckets just before bucket 11,
630 # getting the command from a file.
631 AT_DATA([buckets.txt], [dnl
632 group_id=1234,command_bucket_id=11,bucket=bucket_id:12,actions=output:12,bucket=bucket_id:13,actions=output:13
633 ])
634 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn insert-buckets br0 - < buckets.txt])
635 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn dump-groups br0], [0], [stdout])
636 AT_CHECK([strip_xids < stdout], [0], [dnl
637 OFPST_GROUP_DESC reply (OF1.5):
638 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
639 ])
640
641 # Add yet two more buckets.
642 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])
643 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn dump-groups br0], [0], [stdout])
644 AT_CHECK([strip_xids < stdout], [0], [dnl
645 OFPST_GROUP_DESC reply (OF1.5):
646 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
647 ])
648
649 # Delete groups.
650 AT_CHECK([ovs-ofctl -O OpenFlow15 del-groups br0])
651
652 # Add "fast_failover" group, then insert a bucket into it and make
653 # sure that the type of the group doesn't change. (There was a bug
654 # that caused this to happen.)
655 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn add-group br0 group_id=1234,type=ff])
656 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn dump-groups br0], [0], [stdout])
657 AT_CHECK([strip_xids < stdout], [0], [dnl
658 OFPST_GROUP_DESC reply (OF1.5):
659 group_id=1234,type=ff
660 ])
661 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn insert-buckets br0 group_id=1234,command_bucket_id=first,bucket=bucket_id:20,actions=output:20,bucket=bucket_id:21,actions=output:21])
662 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn dump-groups br0], [0], [stdout])
663 AT_CHECK([strip_xids < stdout], [0], [dnl
664 OFPST_GROUP_DESC reply (OF1.5):
665 group_id=1234,type=ff,bucket=bucket_id:20,actions=output:20,bucket=bucket_id:21,actions=output:21
666 ])
667
668 # Negative tests.
669 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn insert-buckets br0 group_id=1234,command_bucket_id=123,type=indirect,bucket=bucket_id:0,actions=output:0,bucket=bucket_id:1,actions=output:1], [1], [],
670 [ovs-ofctl: type is not needed
671 ])
672 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn insert-buckets br0 group_id=1234,command_bucket_id=123,selection_method=dp_hash,type=indirect,bucket=bucket_id:0,actions=output:0,bucket=bucket_id:1,actions=output:1], [1], [],
673 [ovs-ofctl: selection method is not needed
674 ])
675 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], [],
676 [ovs-ofctl: invalid command bucket id 4294967041
677 ])
678 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn insert-buckets br0 group_id=1234,command_bucket_id=first,bucket=bucket_id:0,actions=output:0,bucket=bucket_id:1,actions=output:1], [1], [],
679 [ovs-ofctl: insert-bucket needs OpenFlow 1.5 or later ('-O OpenFlow15')
680 ])
681 OVS_VSWITCHD_STOP
682 AT_CLEANUP
683
684 dnl This is really bare-bones.
685 dnl It at least checks request and reply serialization and deserialization.
686 dnl Actions definition listed in both supported formats (w/ actions=)
687 AT_SETUP([ofproto - remove group buckets])
688 OVS_VSWITCHD_START
689 AT_DATA([groups.txt], [dnl
690 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
691 ])
692 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn add-groups br0 groups.txt])
693 AT_CHECK([ovs-ofctl -F OXM-OpenFlow15 -O OpenFlow15 -vwarn dump-groups br0 1234], [0], [stdout])
694 AT_CHECK([strip_xids < stdout], [0], [dnl
695 OFPST_GROUP_DESC reply (OF1.5):
696 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
697 ])
698 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn remove-buckets br0 group_id=1234,command_bucket_id=first])
699 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn dump-groups br0], [0], [stdout])
700 AT_CHECK([strip_xids < stdout], [0], [dnl
701 OFPST_GROUP_DESC reply (OF1.5):
702 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
703 ])
704 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn remove-buckets br0 group_id=1234,command_bucket_id=last])
705 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn dump-groups br0], [0], [stdout])
706 AT_CHECK([strip_xids < stdout], [0], [dnl
707 OFPST_GROUP_DESC reply (OF1.5):
708 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
709 ])
710 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn remove-buckets br0 group_id=1234,command_bucket_id=13])
711 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn dump-groups br0], [0], [stdout])
712 AT_CHECK([strip_xids < stdout], [0], [dnl
713 OFPST_GROUP_DESC reply (OF1.5):
714 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
715 ])
716 AT_DATA([buckets.txt], [dnl
717 group_id=1234
718 ])
719 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn remove-buckets br0 - < buckets.txt])
720 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn dump-groups br0], [0], [stdout])
721 AT_CHECK([strip_xids < stdout], [0], [dnl
722 OFPST_GROUP_DESC reply (OF1.5):
723 group_id=1234,type=all
724 ])
725 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn remove-buckets br0 group_id=1234,command_bucket_id=first])
726 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn remove-buckets br0 group_id=1234,command_bucket_id=last])
727 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn remove-buckets br0 group_id=1234,command_bucket_id=all])
728 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn remove-buckets br0 group_id=1234,command_bucket_id=1], [1], [], [stderr])
729 AT_CHECK([ofctl_strip < stderr], [0], [dnl
730 OFPT_ERROR (OF1.5): OFPGMFC_UNKNOWN_BUCKET
731 OFPT_GROUP_MOD (OF1.5):
732 REMOVE_BUCKET command_bucket_id:1,group_id=1234
733 ])
734 # Negative test.
735 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn remove-buckets br0 group_id=1234,command_bucket_id=last], [1], [],
736 [ovs-ofctl: none of the usable flow formats (OpenFlow10,NXM,OXM-OpenFlow15,OXM-OpenFlow16) is among the allowed flow formats (OpenFlow11)
737 ])
738 OVS_VSWITCHD_STOP
739 AT_CLEANUP
740
741 AT_SETUP([ofproto - bundle del group (OpenFlow 1.3)])
742 OVS_VSWITCHD_START
743 AT_DATA([groups.txt], [dnl
744 group_id=1234,type=all,bucket=output:10
745 group_id=1235,type=all,bucket=actions=output:10
746 ])
747 AT_CHECK([ovs-ofctl --bundle -O OpenFlow13 -vwarn add-groups br0 groups.txt])
748 AT_CHECK([ovs-ofctl -O OpenFlow13 -vwarn dump-groups br0 ], [0], [stdout])
749 AT_CHECK([strip_xids < stdout | sort], [0], [dnl
750 group_id=1234,type=all,bucket=actions=output:10
751 group_id=1235,type=all,bucket=actions=output:10
752 OFPST_GROUP_DESC reply (OF1.3):
753 ])
754 AT_CHECK([ovs-ofctl --bundle -O OpenFlow13 -vwarn del-groups br0 group_id=1234])
755 AT_CHECK([ovs-ofctl -O OpenFlow13 -vwarn dump-groups br0], [0], [stdout])
756 AT_CHECK([strip_xids < stdout], [0], [dnl
757 OFPST_GROUP_DESC reply (OF1.3):
758 group_id=1235,type=all,bucket=actions=output:10
759 ])
760 AT_CHECK([ovs-ofctl --bundle -O OpenFlow13 -vwarn del-groups br0 group_id=1234])
761 AT_CHECK([ovs-ofctl -O OpenFlow13 -vwarn dump-groups br0], [0], [stdout])
762 AT_CHECK([strip_xids < stdout], [0], [dnl
763 OFPST_GROUP_DESC reply (OF1.3):
764 group_id=1235,type=all,bucket=actions=output:10
765 ])
766 AT_CHECK([ovs-ofctl --bundle -O OpenFlow13 -vwarn del-groups br0], [0])
767 AT_CHECK([ovs-ofctl -O OpenFlow13 -vwarn dump-groups br0], [0], [stdout])
768 AT_CHECK([strip_xids < stdout], [0], [dnl
769 OFPST_GROUP_DESC reply (OF1.3):
770 ])
771
772 # Negative test.
773 AT_CHECK([ovs-ofctl --bundle -O OpenFlow13 -vwarn del-groups br0 group_id=0xfffffff0],
774 [1], [], [ovs-ofctl: invalid group id 4294967280
775 ])
776 OVS_VSWITCHD_STOP
777 AT_CLEANUP
778
779 AT_SETUP([ofproto - bundle add indirect group])
780 OVS_VSWITCHD_START
781 dnl indirect group must have exactly one bucket
782 AT_DATA([stderr], [dnl
783 OFPT_ERROR (OF1.4) (xid=0x2): OFPGMFC_INVALID_GROUP
784 OFPT_BUNDLE_ADD_MESSAGE (OF1.4) (xid=0x2):
785 bundle_id=0 flags=atomic ordered
786 OFPT_GROUP_MOD (OF1.4) (xid=0x2): ***decode error: OFPGMFC_INVALID_GROUP***
787 ])
788 AT_CHECK([ovs-ofctl --bundle -vwarn add-group br0 'group_id=1234,type=indirect'], [1], , [stderr])
789 AT_CHECK([ovs-ofctl --bundle -vwarn add-group br0 'group_id=1235,type=indirect,bucket=output:10'])
790 AT_CHECK([ovs-ofctl --bundle -vwarn add-group br0 'group_id=1236,type=indirect,bucket=output:10,bucket=output:11'], [1], , [stderr])
791 OVS_VSWITCHD_STOP
792 AT_CLEANUP
793
794 AT_SETUP([ofproto - bundle group mod with mod and add_or_mod command])
795 OVS_VSWITCHD_START
796 dnl Check that mod-group for non-existing group fails without --may-create
797 AT_DATA([stderr], [dnl
798 OFPT_ERROR (OF1.4) (xid=0x2): OFPGMFC_UNKNOWN_GROUP
799 OFPT_GROUP_MOD (OF1.4) (xid=0x2):
800 MOD group_id=1234,type=indirect,bucket=actions=output:2
801 ])
802 AT_CHECK([ovs-ofctl --bundle -vwarn mod-group br0 'group_id=1234,type=indirect,bucket=actions=2'], [1], , [stderr])
803 dnl Check that mod-group for non-existing group succeeds with --may-create
804 AT_CHECK([ovs-ofctl --bundle -vwarn --may-create mod-group br0 'group_id=1234,type=indirect,bucket=actions=2'])
805 AT_CHECK([ovs-ofctl -O OpenFlow14 -vwarn dump-groups br0], [0], [stdout])
806 AT_CHECK([strip_xids < stdout], [0], [dnl
807 OFPST_GROUP_DESC reply (OF1.4):
808 group_id=1234,type=indirect,bucket=actions=output:2
809 ])
810 dnl Check that mod-group for existing group succeeds with --may-create
811 AT_CHECK([ovs-ofctl --bundle -vwarn --may-create mod-group br0 'group_id=1234,type=indirect,bucket=actions=3'])
812 AT_CHECK([ovs-ofctl -O OpenFlow14 -vwarn dump-groups br0], [0], [stdout])
813 AT_CHECK([strip_xids < stdout], [0], [dnl
814 OFPST_GROUP_DESC reply (OF1.4):
815 group_id=1234,type=indirect,bucket=actions=output:3
816 ])
817 OVS_VSWITCHD_STOP
818 AT_CLEANUP
819
820 AT_SETUP([ofproto - bundle del group (OpenFlow 1.5)])
821 OVS_VSWITCHD_START
822 AT_DATA([groups.txt], [dnl
823 group_id=1233,type=select,selection_method=hash,bucket=output:10,bucket=output:11
824 group_id=1234,type=select,selection_method=hash,fields(eth_dst,ip_dst,tcp_dst),bucket=output:10,bucket=output:11
825 group_id=1235,type=all,bucket=actions=output:12,bucket=bucket_id:0,actions=output:10,bucket=bucket_id:1,actions=output:11
826 ])
827 AT_CHECK([ovs-ofctl --bundle -O OpenFlow15 -vwarn add-groups br0 groups.txt])
828 AT_CHECK([ovs-ofctl -F OXM-OpenFlow15 -O OpenFlow15 -vwarn dump-groups br0 1234], [0], [stdout])
829 AT_CHECK([strip_xids < stdout], [0], [dnl
830 OFPST_GROUP_DESC reply (OF1.5):
831 group_id=1234,type=select,selection_method=hash,fields(eth_dst,ip_dst,tcp_dst),bucket=bucket_id:0,actions=output:10,bucket=bucket_id:1,actions=output:11
832 ])
833 AT_CHECK([ovs-ofctl --bundle -O OpenFlow15 -vwarn del-groups br0 group_id=1234])
834 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn dump-groups br0], [0], [stdout])
835 AT_CHECK([strip_xids < stdout | sort], [0], [dnl
836 group_id=1233,type=select,selection_method=hash,bucket=bucket_id:0,actions=output:10,bucket=bucket_id:1,actions=output:11
837 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
838 OFPST_GROUP_DESC reply (OF1.5):
839 ])
840 AT_CHECK([ovs-ofctl --bundle -O OpenFlow15 -vwarn del-groups br0 group_id=1234])
841 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn dump-groups br0], [0], [stdout])
842 AT_CHECK([strip_xids < stdout | sort], [0], [dnl
843 group_id=1233,type=select,selection_method=hash,bucket=bucket_id:0,actions=output:10,bucket=bucket_id:1,actions=output:11
844 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
845 OFPST_GROUP_DESC reply (OF1.5):
846 ])
847 AT_CHECK([ovs-ofctl --bundle -O OpenFlow15 -vwarn del-groups br0], [0])
848 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn dump-groups br0], [0], [stdout])
849 AT_CHECK([strip_xids < stdout], [0], [dnl
850 OFPST_GROUP_DESC reply (OF1.5):
851 ])
852 OVS_VSWITCHD_STOP
853 AT_CLEANUP
854
855 AT_SETUP([ofproto - bundle del group deletes flows])
856 OVS_VSWITCHD_START
857 AT_DATA([groups.txt], [dnl
858 group_id=1234,type=all,bucket=output:10
859 group_id=1235,type=all,bucket=output:10
860 ])
861 AT_CHECK([ovs-ofctl --bundle -vwarn add-groups br0 groups.txt])
862 AT_DATA([flows.txt], [dnl
863 tcp actions=group:1234
864 table=2 udp actions=group:1235
865 ])
866 AT_CHECK([ovs-ofctl --bundle -vwarn add-flows br0 flows.txt])
867 AT_CHECK([ovs-ofctl -O OpenFlow14 -vwarn dump-flows br0 | ofctl_strip | sort],
868 [0], [dnl
869 table=2, udp actions=group:1235
870 tcp actions=group:1234
871 OFPST_FLOW reply (OF1.4):
872 ])
873 AT_CHECK([ovs-ofctl --bundle -vwarn del-groups br0 group_id=1234])
874 AT_CHECK([ovs-ofctl -O OpenFlow14 -vwarn dump-flows br0 | ofctl_strip | sort],
875 [0], [dnl
876 table=2, udp actions=group:1235
877 OFPST_FLOW reply (OF1.4):
878 ])
879 AT_CHECK([ovs-ofctl --bundle -vwarn del-groups br0 group_id=1234])
880 AT_CHECK([ovs-ofctl -O OpenFlow14 -vwarn dump-flows br0 | ofctl_strip | sort],
881 [0], [dnl
882 table=2, udp actions=group:1235
883 OFPST_FLOW reply (OF1.4):
884 ])
885 AT_CHECK([ovs-ofctl --bundle -vwarn del-groups br0])
886 AT_CHECK([ovs-ofctl -O OpenFlow14 -vwarn dump-flows br0 | ofctl_strip | sort],
887 [0], [dnl
888 OFPST_FLOW reply (OF1.4):
889 ])
890 OVS_VSWITCHD_STOP
891 AT_CLEANUP
892
893 dnl This is really bare-bones.
894 dnl It at least checks request and reply serialization and deserialization.
895 dnl Actions definition listed in both supported formats (w/ actions=)
896 AT_SETUP([ofproto - bundle insert group buckets])
897 OVS_VSWITCHD_START
898 # Add group with no buckets.
899 AT_DATA([groups.txt], [dnl
900 group_id=1234,type=all
901 ])
902 AT_CHECK([ovs-ofctl --bundle -O OpenFlow15 -vwarn add-groups br0 groups.txt])
903 AT_CHECK([ovs-ofctl -F OXM-OpenFlow15 -O OpenFlow15 -vwarn dump-groups br0 1234], [0], [stdout])
904 AT_CHECK([strip_xids < stdout], [0], [dnl
905 OFPST_GROUP_DESC reply (OF1.5):
906 group_id=1234,type=all
907 ])
908
909 # Add two buckets, using "last".
910 AT_CHECK([ovs-ofctl --bundle -O OpenFlow15 -vwarn insert-buckets br0 group_id=1234,command_bucket_id=last,bucket=bucket_id:10,actions=output:10,bucket=bucket_id:11,actions=output:11])
911 AT_CHECK([ovs-ofctl -F OXM-OpenFlow15 -O OpenFlow15 -vwarn dump-groups br0 1234], [0], [stdout])
912 AT_CHECK([strip_xids < stdout], [0], [dnl
913 OFPST_GROUP_DESC reply (OF1.5):
914 group_id=1234,type=all,bucket=bucket_id:10,actions=output:10,bucket=bucket_id:11,actions=output:11
915 ])
916
917 # Start over again, then add two buckets using "first".
918 AT_DATA([groups.txt], [dnl
919 delete group_id=1234
920 add group_id=1234,type=all
921 insert_bucket group_id=1234,command_bucket_id=first,bucket=bucket_id:10,actions=output:10,bucket=bucket_id:11,actions=output:11
922 ])
923 AT_CHECK([ovs-ofctl --bundle -O OpenFlow15 -vwarn add-groups br0 groups.txt])
924 AT_CHECK([ovs-ofctl -F OXM-OpenFlow15 -O OpenFlow15 -vwarn dump-groups br0 1234], [0], [stdout])
925 AT_CHECK([strip_xids < stdout], [0], [dnl
926 OFPST_GROUP_DESC reply (OF1.5):
927 group_id=1234,type=all,bucket=bucket_id:10,actions=output:10,bucket=bucket_id:11,actions=output:11
928 ])
929
930 # Add two more buckets before the existing ones.
931 AT_CHECK([ovs-ofctl --bundle -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])
932 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn dump-groups br0], [0], [stdout])
933 AT_CHECK([strip_xids < stdout], [0], [dnl
934 OFPST_GROUP_DESC reply (OF1.5):
935 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
936 ])
937
938 # Add another bucket at the end.
939 AT_CHECK([ovs-ofctl --bundle -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])
940 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn dump-groups br0], [0], [stdout])
941 AT_CHECK([strip_xids < stdout], [0], [dnl
942 OFPST_GROUP_DESC reply (OF1.5):
943 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
944 ])
945
946 # Verify that duplicate bucket IDs are rejected.
947 AT_CHECK([ovs-ofctl --bundle -O OpenFlow15 -vwarn insert-buckets br0 group_id=1234,command_bucket_id=last,bucket=bucket_id:14,actions=output:14,bucket=bucket_id:15,actions=output:15], [1], [], [stderr])
948 AT_CHECK([strip_xids < stderr | sed '/talking to/,$d'], [0], [dnl
949 Error OFPGMFC_BUCKET_EXISTS for: OFPT_GROUP_MOD (OF1.5):
950 INSERT_BUCKET command_bucket_id:last,group_id=1234,bucket=bucket_id:14,actions=output:14,bucket=bucket_id:15,actions=output:15
951 Error OFPBFC_MSG_FAILED for: OFPT_BUNDLE_CONTROL (OF1.5):
952 bundle_id=0 type=COMMIT_REQUEST flags=atomic ordered
953 ])
954
955 # Add another bucket just before bucket 15.
956 AT_CHECK([ovs-ofctl --bundle -O OpenFlow15 -vwarn insert-buckets br0 group_id=1234,command_bucket_id=15])
957 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn dump-groups br0], [0], [stdout])
958 AT_CHECK([strip_xids < stdout], [0], [dnl
959 OFPST_GROUP_DESC reply (OF1.5):
960 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
961 ])
962
963 # Add two more buckets just before bucket 11,
964 # getting the command from a file.
965 AT_DATA([buckets.txt], [dnl
966 group_id=1234,command_bucket_id=11,bucket=bucket_id:12,actions=output:12,bucket=bucket_id:13,actions=output:13
967 ])
968 AT_CHECK([ovs-ofctl --bundle -O OpenFlow15 -vwarn insert-buckets br0 - < buckets.txt])
969 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn dump-groups br0], [0], [stdout])
970 AT_CHECK([strip_xids < stdout], [0], [dnl
971 OFPST_GROUP_DESC reply (OF1.5):
972 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
973 ])
974
975 # Add yet two more buckets.
976 AT_CHECK([ovs-ofctl --bundle -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])
977 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn dump-groups br0], [0], [stdout])
978 AT_CHECK([strip_xids < stdout], [0], [dnl
979 OFPST_GROUP_DESC reply (OF1.5):
980 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
981 ])
982
983 # Negative tests.
984 AT_CHECK([ovs-ofctl --bundle -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], [],
985 [ovs-ofctl: invalid command bucket id 4294967041
986 ])
987 AT_CHECK([ovs-ofctl --bundle -vwarn insert-buckets br0 group_id=1234,command_bucket_id=first,bucket=bucket_id:0,actions=output:0,bucket=bucket_id:1,actions=output:1], [1], [],
988 [ovs-ofctl: insert-bucket needs OpenFlow 1.5 or later ('-O OpenFlow15')
989 ])
990 OVS_VSWITCHD_STOP
991 AT_CLEANUP
992
993 AT_SETUP([ofproto - bundle remove group buckets])
994 OVS_VSWITCHD_START
995 AT_DATA([groups.txt], [dnl
996 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
997 ])
998 AT_CHECK([ovs-ofctl --bundle -O OpenFlow15 -vwarn add-groups br0 groups.txt])
999 AT_CHECK([ovs-ofctl -F OXM-OpenFlow15 -O OpenFlow15 -vwarn dump-groups br0 1234], [0], [stdout])
1000 AT_CHECK([strip_xids < stdout], [0], [dnl
1001 OFPST_GROUP_DESC reply (OF1.5):
1002 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
1003 ])
1004 AT_CHECK([ovs-ofctl --bundle -O OpenFlow15 -vwarn remove-buckets br0 group_id=1234,command_bucket_id=first])
1005 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn dump-groups br0], [0], [stdout])
1006 AT_CHECK([strip_xids < stdout], [0], [dnl
1007 OFPST_GROUP_DESC reply (OF1.5):
1008 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
1009 ])
1010 AT_CHECK([ovs-ofctl --bundle -O OpenFlow15 -vwarn remove-buckets br0 group_id=1234,command_bucket_id=last])
1011 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn dump-groups br0], [0], [stdout])
1012 AT_CHECK([strip_xids < stdout], [0], [dnl
1013 OFPST_GROUP_DESC reply (OF1.5):
1014 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
1015 ])
1016 AT_CHECK([ovs-ofctl --bundle -O OpenFlow15 -vwarn remove-buckets br0 group_id=1234,command_bucket_id=13])
1017 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn dump-groups br0], [0], [stdout])
1018 AT_CHECK([strip_xids < stdout], [0], [dnl
1019 OFPST_GROUP_DESC reply (OF1.5):
1020 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
1021 ])
1022 AT_DATA([buckets.txt], [dnl
1023 group_id=1234
1024 ])
1025 AT_CHECK([ovs-ofctl --bundle -O OpenFlow15 -vwarn remove-buckets br0 - < buckets.txt])
1026 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn dump-groups br0], [0], [stdout])
1027 AT_CHECK([strip_xids < stdout], [0], [dnl
1028 OFPST_GROUP_DESC reply (OF1.5):
1029 group_id=1234,type=all
1030 ])
1031 AT_CHECK([ovs-ofctl --bundle -O OpenFlow15 -vwarn remove-buckets br0 group_id=1234,command_bucket_id=first])
1032 AT_CHECK([ovs-ofctl --bundle -O OpenFlow15 -vwarn remove-buckets br0 group_id=1234,command_bucket_id=last])
1033 AT_CHECK([ovs-ofctl --bundle -O OpenFlow15 -vwarn remove-buckets br0 group_id=1234,command_bucket_id=all])
1034 AT_CHECK([ovs-ofctl --bundle -O OpenFlow15 -vwarn remove-buckets br0 group_id=1234,command_bucket_id=1], [1], [], [stderr])
1035 AT_CHECK([ofctl_strip < stderr | sed '/talking to/,$d'], [0], [dnl
1036 Error OFPGMFC_UNKNOWN_BUCKET for: OFPT_GROUP_MOD (OF1.5):
1037 REMOVE_BUCKET command_bucket_id:1,group_id=1234
1038 Error OFPBFC_MSG_FAILED for: OFPT_BUNDLE_CONTROL (OF1.5):
1039 bundle_id=0 type=COMMIT_REQUEST flags=atomic ordered
1040 ])
1041 # Negative test.
1042 AT_CHECK([ovs-ofctl --bundle -O OpenFlow11 -vwarn remove-buckets br0 group_id=1234,command_bucket_id=last], [1], [],
1043 [ovs-ofctl: none of the usable flow formats (OXM-OpenFlow15,OXM-OpenFlow16) is among the allowed flow formats (OXM-OpenFlow14)
1044 ])
1045 OVS_VSWITCHD_STOP
1046 AT_CLEANUP
1047
1048 dnl This is really bare-bones.
1049 dnl It at least checks request and reply serialization and deserialization.
1050 AT_SETUP([ofproto - flow mod checks group availability])
1051 OVS_VSWITCHD_START
1052 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn add-group br0 group_id=1234,type=all,bucket=output:10])
1053 AT_DATA([flows.txt], [dnl
1054 tcp actions=group:1234
1055 udp actions=group:1235
1056 ])
1057 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn add-flow br0 'tcp actions=group:1234'])
1058 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn add-flow br0 'tcp actions=group:1235'], [1], [], [stderr])
1059
1060 AT_CHECK([strip_xids < stderr], [0],
1061 [OFPT_ERROR (OF1.1): OFPBAC_BAD_OUT_GROUP
1062 OFPT_FLOW_MOD (OF1.1): ADD tcp actions=group:1235
1063 ])
1064 OVS_VSWITCHD_STOP
1065 AT_CLEANUP
1066
1067 AT_SETUP([ofproto - bundle flow mod checks group availability])
1068 OVS_VSWITCHD_START
1069 AT_DATA([bundle.txt], [dnl
1070 group add group_id=1234,type=all,bucket=output:10
1071 flow add tcp actions=group:1234
1072 flow add udp actions=group:1235
1073 ])
1074 AT_CHECK([ovs-ofctl -vwarn bundle br0 bundle.txt], [1], [], [stderr])
1075
1076 AT_CHECK([ofctl_strip < stderr | sed '/talking to/,$d'], [0],
1077 [dnl
1078 Error OFPBAC_BAD_OUT_GROUP for: OFPT_FLOW_MOD (OF1.4): ADD udp actions=group:1235
1079 Error OFPBFC_MSG_FAILED for: OFPT_BUNDLE_CONTROL (OF1.4):
1080 bundle_id=0 type=COMMIT_REQUEST flags=atomic ordered
1081 ])
1082 OVS_VSWITCHD_STOP
1083 AT_CLEANUP
1084
1085 dnl This is really bare-bones.
1086 dnl It at least checks request and reply serialization and deserialization.
1087 AT_SETUP([ofproto - group description])
1088 OVS_VSWITCHD_START
1089 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn add-group br0 group_id=1234,type=all,bucket=output:10], [0], [stdout])
1090 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn dump-groups br0], [0], [stdout])
1091 AT_CHECK([strip_xids < stdout], [0], [dnl
1092 OFPST_GROUP_DESC reply (OF1.1):
1093 group_id=1234,type=all,bucket=actions=output:10
1094 ])
1095 OVS_VSWITCHD_STOP
1096 AT_CLEANUP
1097
1098 dnl This is really bare-bones.
1099 dnl It at least checks request and reply serialization and deserialization.
1100 AT_SETUP([ofproto - group features (OpenFlow 1.0 extension)])
1101 OVS_VSWITCHD_START
1102 AT_CHECK([ovs-ofctl -O OpenFlow10 -vwarn dump-group-features br0], [0], [stdout])
1103 AT_CHECK([strip_xids < stdout], [0], [dnl
1104 NXST_GROUP_FEATURES reply:
1105 Group table:
1106 Types: 0xf
1107 Capabilities: 0x7
1108 all group:
1109 max_groups=0xffffff00
1110 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
1111 select group:
1112 max_groups=0xffffff00
1113 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
1114 indirect group:
1115 max_groups=0xffffff00
1116 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
1117 fast failover group:
1118 max_groups=0xffffff00
1119 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
1120 ])
1121 OVS_VSWITCHD_STOP
1122 AT_CLEANUP
1123
1124 dnl This is really bare-bones.
1125 dnl It at least checks request and reply serialization and deserialization.
1126 AT_SETUP([ofproto - group features (OpenFlow 1.2)])
1127 OVS_VSWITCHD_START
1128 AT_CHECK([ovs-ofctl -O OpenFlow12 -vwarn dump-group-features br0], [0], [stdout])
1129 AT_CHECK([strip_xids < stdout], [0], [dnl
1130 OFPST_GROUP_FEATURES reply (OF1.2):
1131 Group table:
1132 Types: 0xf
1133 Capabilities: 0x7
1134 all group:
1135 max_groups=0xffffff00
1136 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
1137 select group:
1138 max_groups=0xffffff00
1139 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
1140 indirect group:
1141 max_groups=0xffffff00
1142 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
1143 fast failover group:
1144 max_groups=0xffffff00
1145 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
1146 ])
1147 OVS_VSWITCHD_STOP
1148 AT_CLEANUP
1149
1150 dnl This is really bare-bones.
1151 dnl It at least checks request and reply serialization and deserialization.
1152 AT_SETUP([ofproto - group stats (OpenFlow 1.0 extension)])
1153 OVS_VSWITCHD_START
1154 AT_DATA([groups.txt], [dnl
1155 group_id=1234,type=all,bucket=output:10
1156 group_id=1235,type=all,bucket=output:10
1157 ])
1158 AT_CHECK([ovs-ofctl -O OpenFlow10 -vwarn add-groups br0 groups.txt])
1159 AT_CHECK([ovs-ofctl -O OpenFlow10 -vwarn add-flow br0 'tcp actions=group:1234'])
1160 AT_CHECK([ovs-ofctl -O OpenFlow10 -vwarn dump-group-stats br0 group_id=1234], [0], [stdout])
1161 AT_CHECK([strip_xids < stdout | sed 's/duration=[[0-9.]]*s/duration=?s/' | sort], [0], [dnl
1162 group_id=1234,duration=?s,ref_count=1,packet_count=0,byte_count=0,bucket0:packet_count=0,byte_count=0
1163 NXST_GROUP reply:
1164 ])
1165 AT_CHECK([ovs-ofctl -O OpenFlow10 -vwarn dump-group-stats br0], [0], [stdout])
1166 AT_CHECK([strip_xids < stdout | sed 's/duration=[[0-9.]]*s/duration=?s/' | sort], [0], [dnl
1167 group_id=1234,duration=?s,ref_count=1,packet_count=0,byte_count=0,bucket0:packet_count=0,byte_count=0
1168 group_id=1235,duration=?s,ref_count=0,packet_count=0,byte_count=0,bucket0:packet_count=0,byte_count=0
1169 NXST_GROUP reply:
1170 ])
1171 OVS_VSWITCHD_STOP
1172 AT_CLEANUP
1173
1174 dnl This is really bare-bones.
1175 dnl It at least checks request and reply serialization and deserialization.
1176 AT_SETUP([ofproto - group stats (OpenFlow 1.1)])
1177 OVS_VSWITCHD_START
1178 AT_DATA([groups.txt], [dnl
1179 group_id=1234,type=all,bucket=output:10
1180 group_id=1235,type=all,bucket=output:10
1181 ])
1182 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn add-groups br0 groups.txt])
1183 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn add-flow br0 'tcp actions=group:1234'])
1184 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn dump-group-stats br0 group_id=1234], [0], [stdout])
1185 AT_CHECK([strip_xids < stdout | sort], [0], [dnl
1186 group_id=1234,ref_count=1,packet_count=0,byte_count=0,bucket0:packet_count=0,byte_count=0
1187 OFPST_GROUP reply (OF1.1):
1188 ])
1189 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn dump-group-stats br0], [0], [stdout])
1190 AT_CHECK([strip_xids < stdout | sort], [0], [dnl
1191 group_id=1234,ref_count=1,packet_count=0,byte_count=0,bucket0:packet_count=0,byte_count=0
1192 group_id=1235,ref_count=0,packet_count=0,byte_count=0,bucket0:packet_count=0,byte_count=0
1193 OFPST_GROUP reply (OF1.1):
1194 ])
1195 OVS_VSWITCHD_STOP
1196 AT_CLEANUP
1197
1198 dnl This is really bare-bones.
1199 dnl It at least checks request and reply serialization and deserialization.
1200 AT_SETUP([ofproto - group stats (OpenFlow 1.3)])
1201 OVS_VSWITCHD_START
1202 AT_DATA([groups.txt], [dnl
1203 group_id=1234,type=all,bucket=output:10
1204 group_id=1235,type=all,bucket=output:10
1205 ])
1206 AT_CHECK([ovs-ofctl -O OpenFlow13 -vwarn add-groups br0 groups.txt])
1207 AT_CHECK([ovs-ofctl -O OpenFlow13 -vwarn add-flow br0 'tcp actions=group:1234'])
1208 AT_CHECK([ovs-ofctl -O OpenFlow13 -vwarn dump-group-stats br0 group_id=1234], [0], [stdout])
1209 AT_CHECK([strip_xids < stdout | sed 's/duration=[[0-9.]]*s/duration=?s/' | sort], [0], [dnl
1210 group_id=1234,duration=?s,ref_count=1,packet_count=0,byte_count=0,bucket0:packet_count=0,byte_count=0
1211 OFPST_GROUP reply (OF1.3):
1212 ])
1213 AT_CHECK([ovs-ofctl -O OpenFlow13 -vwarn dump-group-stats br0], [0], [stdout])
1214 AT_CHECK([strip_xids < stdout | sed 's/duration=[[0-9.]]*s/duration=?s/' | sort], [0], [dnl
1215 group_id=1234,duration=?s,ref_count=1,packet_count=0,byte_count=0,bucket0:packet_count=0,byte_count=0
1216 group_id=1235,duration=?s,ref_count=0,packet_count=0,byte_count=0,bucket0:packet_count=0,byte_count=0
1217 OFPST_GROUP reply (OF1.3):
1218 ])
1219 OVS_VSWITCHD_STOP
1220 AT_CLEANUP
1221
1222 dnl This is really bare-bones.
1223 dnl It at least checks request and reply serialization and deserialization.
1224 AT_SETUP([ofproto - group stats (OpenFlow 1.5)])
1225 OVS_VSWITCHD_START
1226 AT_DATA([groups.txt], [dnl
1227 group_id=1234,type=all,bucket=output:10
1228 group_id=1235,type=all,bucket=output:10
1229 ])
1230 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn add-groups br0 groups.txt])
1231 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn add-flow br0 'tcp actions=group:1234'])
1232 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn dump-group-stats br0 group_id=1234], [0], [stdout])
1233 AT_CHECK([strip_xids < stdout | sed 's/duration=[[0-9.]]*s/duration=?s/' | sort], [0], [dnl
1234 group_id=1234,duration=?s,ref_count=1,packet_count=0,byte_count=0,bucket0:packet_count=0,byte_count=0
1235 OFPST_GROUP reply (OF1.5):
1236 ])
1237 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn dump-group-stats br0], [0], [stdout])
1238 AT_CHECK([strip_xids < stdout | sed 's/duration=[[0-9.]]*s/duration=?s/' | sort], [0], [dnl
1239 group_id=1234,duration=?s,ref_count=1,packet_count=0,byte_count=0,bucket0:packet_count=0,byte_count=0
1240 group_id=1235,duration=?s,ref_count=0,packet_count=0,byte_count=0,bucket0:packet_count=0,byte_count=0
1241 OFPST_GROUP reply (OF1.5):
1242 ])
1243 OVS_VSWITCHD_STOP
1244 AT_CLEANUP
1245
1246 dnl This found a use-after-free error in bridge destruction in the
1247 dnl presence of groups.
1248 AT_SETUP([ofproto - group add then bridge delete (OpenFlow 1.3)])
1249 OVS_VSWITCHD_START
1250 AT_DATA([groups.txt], [dnl
1251 group_id=1234,type=all,bucket=output:10
1252 group_id=1235,type=all,bucket=output:10
1253
1254 dnl This checks for regression against a parser bug such that
1255 dnl "actions=resbmit(,1)" etc. was rejected as a syntax error.
1256 group_id=2345,type=select,bucket=weight:10,actions=resubmit(,1),bucket=weight:10,actions=resubmit(,2),bucket=weight:1,actions=resubmit(,3)
1257 ])
1258 AT_CHECK([ovs-ofctl -O OpenFlow13 -vwarn add-groups br0 groups.txt])
1259 AT_CHECK([ovs-vsctl del-br br0])
1260 OVS_VSWITCHD_STOP
1261 AT_CLEANUP
1262
1263 AT_SETUP([ofproto - mod-port (OpenFlow 1.0)])
1264 OVS_VSWITCHD_START
1265 for command_config_state in \
1266 'up 0 0' \
1267 'noflood NO_FLOOD 0' \
1268 'down PORT_DOWN,NO_FLOOD LINK_DOWN' \
1269 'flood PORT_DOWN LINK_DOWN' \
1270 'no-receive PORT_DOWN,NO_RECV LINK_DOWN' \
1271 'no-forward PORT_DOWN,NO_RECV,NO_FWD LINK_DOWN' \
1272 'no-packet-in PORT_DOWN,NO_RECV,NO_FWD,NO_PACKET_IN LINK_DOWN' \
1273 'forward PORT_DOWN,NO_RECV,NO_PACKET_IN LINK_DOWN' \
1274 'packet-in PORT_DOWN,NO_RECV LINK_DOWN' \
1275 'up NO_RECV 0' \
1276 'receive 0 0'
1277 do
1278 set $command_config_state
1279 command=$[1] config=`echo $[2] | sed 's/,/ /g'` state=$[3]
1280 AT_CHECK([ovs-ofctl -vwarn mod-port br0 br0 $command])
1281 AT_CHECK([ovs-ofctl -vwarn show br0], [0], [stdout])
1282 AT_CHECK_UNQUOTED([strip_xids < stdout], [0], [dnl
1283 OFPT_FEATURES_REPLY: dpid:fedcba9876543210
1284 n_tables:254, n_buffers:0
1285 capabilities: FLOW_STATS TABLE_STATS PORT_STATS QUEUE_STATS ARP_MATCH_IP
1286 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
1287 LOCAL(br0): addr:aa:55:aa:55:00:00
1288 config: $config
1289 state: $state
1290 speed: 0 Mbps now, 0 Mbps max
1291 OFPT_GET_CONFIG_REPLY: frags=normal miss_send_len=0
1292 ])
1293 done
1294 OVS_VSWITCHD_STOP
1295 AT_CLEANUP
1296
1297 AT_SETUP([ofproto - mod-port (OpenFlow 1.2)])
1298 OVS_VSWITCHD_START
1299 for command_config_state in \
1300 'up 0 LIVE' \
1301 'down PORT_DOWN LINK_DOWN' \
1302 'no-receive PORT_DOWN,NO_RECV LINK_DOWN' \
1303 'no-forward PORT_DOWN,NO_RECV,NO_FWD LINK_DOWN' \
1304 'no-packet-in PORT_DOWN,NO_RECV,NO_FWD,NO_PACKET_IN LINK_DOWN' \
1305 'forward PORT_DOWN,NO_RECV,NO_PACKET_IN LINK_DOWN' \
1306 'packet-in PORT_DOWN,NO_RECV LINK_DOWN' \
1307 'up NO_RECV LIVE' \
1308 'receive 0 LIVE'
1309 do
1310 set $command_config_state
1311 command=$[1] config=`echo $[2] | sed 's/,/ /g'` state=$[3]
1312 AT_CHECK([ovs-ofctl -O OpenFlow12 -vwarn mod-port br0 br0 $command])
1313 AT_CHECK([ovs-ofctl -O OpenFlow12 -vwarn show br0], [0], [stdout])
1314 AT_CHECK_UNQUOTED([strip_xids < stdout], [0], [dnl
1315 OFPT_FEATURES_REPLY (OF1.2): dpid:fedcba9876543210
1316 n_tables:254, n_buffers:0
1317 capabilities: FLOW_STATS TABLE_STATS PORT_STATS GROUP_STATS QUEUE_STATS
1318 LOCAL(br0): addr:aa:55:aa:55:00:00
1319 config: $config
1320 state: $state
1321 speed: 0 Mbps now, 0 Mbps max
1322 OFPT_GET_CONFIG_REPLY (OF1.2): frags=normal miss_send_len=0
1323 ])
1324 done
1325 OVS_VSWITCHD_STOP
1326 AT_CLEANUP
1327
1328 AT_SETUP([ofproto - mod-port (OpenFlow 1.4)])
1329 OVS_VSWITCHD_START
1330 for command_config_state in \
1331 'up 0 LIVE' \
1332 'down PORT_DOWN LINK_DOWN' \
1333 'no-receive PORT_DOWN,NO_RECV LINK_DOWN' \
1334 'no-forward PORT_DOWN,NO_RECV,NO_FWD LINK_DOWN' \
1335 'no-packet-in PORT_DOWN,NO_RECV,NO_FWD,NO_PACKET_IN LINK_DOWN' \
1336 'forward PORT_DOWN,NO_RECV,NO_PACKET_IN LINK_DOWN' \
1337 'packet-in PORT_DOWN,NO_RECV LINK_DOWN' \
1338 'up NO_RECV LIVE' \
1339 'receive 0 LIVE'
1340 do
1341 set $command_config_state
1342 command=$[1] config=`echo $[2] | sed 's/,/ /g'` state=$[3]
1343 AT_CHECK([ovs-ofctl -O OpenFlow14 -vwarn mod-port br0 br0 $command])
1344 AT_CHECK([ovs-ofctl -O OpenFlow14 -vwarn show br0], [0], [stdout])
1345 AT_CHECK_UNQUOTED([strip_xids < stdout], [0], [dnl
1346 OFPT_FEATURES_REPLY (OF1.4): dpid:fedcba9876543210
1347 n_tables:254, n_buffers:0
1348 capabilities: FLOW_STATS TABLE_STATS PORT_STATS GROUP_STATS QUEUE_STATS BUNDLES
1349 OFPST_PORT_DESC reply (OF1.4):
1350 LOCAL(br0): addr:aa:55:aa:55:00:00
1351 config: $config
1352 state: $state
1353 speed: 0 Mbps now, 0 Mbps max
1354 OFPT_GET_CONFIG_REPLY (OF1.4): frags=normal miss_send_len=0
1355 ])
1356 done
1357 OVS_VSWITCHD_STOP
1358 AT_CLEANUP
1359
1360 AT_SETUP([ofproto - mod-port (OpenFlow 1.6)])
1361 OVS_VSWITCHD_START
1362 for command_config_state in \
1363 'up 0 LIVE' \
1364 'down PORT_DOWN LINK_DOWN' \
1365 'no-receive PORT_DOWN,NO_RECV LINK_DOWN' \
1366 'no-forward PORT_DOWN,NO_RECV,NO_FWD LINK_DOWN' \
1367 'no-packet-in PORT_DOWN,NO_RECV,NO_FWD,NO_PACKET_IN LINK_DOWN' \
1368 'forward PORT_DOWN,NO_RECV,NO_PACKET_IN LINK_DOWN' \
1369 'packet-in PORT_DOWN,NO_RECV LINK_DOWN' \
1370 'up NO_RECV LIVE' \
1371 'receive 0 LIVE'
1372 do
1373 set $command_config_state
1374 command=$[1] config=`echo $[2] | sed 's/,/ /g'` state=$[3]
1375 AT_CHECK([ovs-ofctl -O OpenFlow16 -vwarn mod-port br0 br0 $command])
1376 AT_CHECK([ovs-ofctl -O OpenFlow16 -vwarn show br0], [0], [stdout])
1377 AT_CHECK_UNQUOTED([strip_xids < stdout], [0], [dnl
1378 OFPT_FEATURES_REPLY (OF1.6): dpid:fedcba9876543210
1379 n_tables:254, n_buffers:0
1380 capabilities: FLOW_STATS TABLE_STATS PORT_STATS GROUP_STATS QUEUE_STATS BUNDLES
1381 OFPST_PORT_DESC reply (OF1.6):
1382 LOCAL(br0): addr:aa:55:aa:55:00:00
1383 config: $config
1384 state: $state
1385 speed: 0 Mbps now, 0 Mbps max
1386 OFPT_GET_CONFIG_REPLY (OF1.6): frags=normal miss_send_len=0
1387 ])
1388 done
1389 OVS_VSWITCHD_STOP
1390 AT_CLEANUP
1391
1392 AT_SETUP([ofproto - basic flow_mod commands (NXM)])
1393 OVS_VSWITCHD_START
1394 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip], [0], [NXST_FLOW reply:
1395 ])
1396 AT_CHECK([echo 'in_port=2,actions=1' | ovs-ofctl add-flows br0 -])
1397 AT_CHECK([ovs-ofctl add-flow br0 in_port=1,actions=2])
1398 AT_CHECK([ovs-ofctl -F nxm add-flow br0 table=1,in_port=4,actions=3])
1399 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1400 in_port=1 actions=output:2
1401 in_port=2 actions=output:1
1402 table=1, in_port=4 actions=output:3
1403 NXST_FLOW reply:
1404 ])
1405 AT_CHECK([ovs-ofctl dump-aggregate br0 table=0 | strip_xids], [0], [dnl
1406 NXST_AGGREGATE reply: packet_count=0 byte_count=0 flow_count=2
1407 ])
1408 AT_CHECK([ovs-ofctl del-flows br0])
1409 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip], [0], [NXST_FLOW reply:
1410 ])
1411 OVS_VSWITCHD_STOP
1412 AT_CLEANUP
1413
1414 AT_SETUP([ofproto - basic flow_mod commands (OpenFlow 1.0)])
1415 OVS_VSWITCHD_START
1416 AT_CHECK([ovs-ofctl -F openflow10 dump-flows br0 | ofctl_strip], [0], [OFPST_FLOW reply:
1417 ])
1418 AT_CHECK([echo 'in_port=2,actions=1' | ovs-ofctl -F openflow10 add-flows br0 -])
1419 AT_CHECK([ovs-ofctl -F openflow10 add-flow br0 in_port=1,actions=2])
1420 AT_CHECK([ovs-ofctl -F openflow10 add-flow br0 table=1,in_port=4,actions=3])
1421 AT_CHECK([ovs-ofctl -F openflow10 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1422 in_port=1 actions=output:2
1423 in_port=2 actions=output:1
1424 table=1, in_port=4 actions=output:3
1425 OFPST_FLOW reply:
1426 ])
1427 AT_CHECK([ovs-ofctl -F openflow10 dump-aggregate br0 table=0 | strip_xids], [0], [dnl
1428 OFPST_AGGREGATE reply: packet_count=0 byte_count=0 flow_count=2
1429 ])
1430 AT_CHECK([ovs-ofctl -F openflow10 del-flows br0])
1431 AT_CHECK([ovs-ofctl -F openflow10 dump-flows br0 | ofctl_strip], [0], [OFPST_FLOW reply:
1432 ])
1433 OVS_VSWITCHD_STOP
1434 AT_CLEANUP
1435
1436 # It's really dumb that check_overlap and reset_counts are considered
1437 # part of flow state, but OpenFlow implies that it is, and OFTest and
1438 # some users insist on it.
1439 AT_SETUP([ofproto - add-flow and flags])
1440 OVS_VSWITCHD_START
1441 AT_CHECK([ovs-ofctl -F openflow10 add-flow br0 check_overlap,in_port=1,actions=drop])
1442 # Prior to OF1.3, flow dumps didn't include a "flags" field.
1443 AT_CHECK([ovs-ofctl -F openflow10 dump-flows br0 | ofctl_strip], [0], [dnl
1444 OFPST_FLOW reply:
1445 in_port=1 actions=drop
1446 ])
1447 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip], [0], [dnl
1448 OFPST_FLOW reply (OF1.1):
1449 in_port=1 actions=drop
1450 ])
1451 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip], [0], [dnl
1452 OFPST_FLOW reply (OF1.2):
1453 in_port=1 actions=drop
1454 ])
1455 # OF1.3 makes the flags visible.
1456 AT_CHECK([ovs-ofctl -O OpenFlow13 dump-flows br0 | ofctl_strip], [0], [dnl
1457 OFPST_FLOW reply (OF1.3):
1458 check_overlap reset_counts in_port=1 actions=drop
1459 ])
1460 AT_CHECK([ovs-ofctl -O OpenFlow14 dump-flows br0 | ofctl_strip], [0], [dnl
1461 OFPST_FLOW reply (OF1.4):
1462 check_overlap reset_counts in_port=1 actions=drop
1463 ])
1464 # OF1.5 makes the flags invisible.
1465 AT_CHECK([ovs-ofctl -O OpenFlow15 dump-flows br0 | ofctl_strip], [0], [dnl
1466 OFPST_FLOW reply (OF1.5):
1467 check_overlap reset_counts in_port=1 actions=drop
1468 ])
1469 OVS_VSWITCHD_STOP
1470 AT_CLEANUP
1471
1472 AT_SETUP([ofproto - basic flow_mod commands (OpenFlow 1.1)])
1473 OVS_VSWITCHD_START
1474 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip], [0], [OFPST_FLOW reply (OF1.1):
1475 ])
1476 AT_CHECK([echo 'in_port=2,actions=1' | ovs-ofctl -O OpenFlow11 add-flows br0 -])
1477 AT_CHECK([ovs-ofctl -O OpenFlow11 add-flow br0 in_port=1,actions=2])
1478 AT_CHECK([ovs-ofctl -O OpenFlow11 add-flow br0 table=1,in_port=4,actions=3])
1479 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1480 in_port=1 actions=output:2
1481 in_port=2 actions=output:1
1482 table=1, in_port=4 actions=output:3
1483 OFPST_FLOW reply (OF1.1):
1484 ])
1485 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-aggregate br0 table=0 | strip_xids], [0], [dnl
1486 OFPST_AGGREGATE reply (OF1.1): packet_count=0 byte_count=0 flow_count=2
1487 ])
1488 AT_CHECK([ovs-ofctl -O OpenFlow11 del-flows br0])
1489 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip], [0], [OFPST_FLOW reply (OF1.1):
1490 table=1, in_port=4 actions=output:3
1491 ])
1492 OVS_VSWITCHD_STOP
1493 AT_CLEANUP
1494
1495 AT_SETUP([ofproto - flow_mod negative test (OpenFlow 1.1)])
1496 OVS_VSWITCHD_START(
1497 [set bridge br0 protocols=OpenFlow10,OpenFlow11,OpenFlow12,OpenFlow13])
1498 AT_CHECK([ovs-ofctl add-flow -O OpenFlow11 br0 table=1,action=goto_table:2])
1499
1500 # The error message here actually comes from ovs-ofctl, not from ovs-vswitchd,
1501 # but at least it's the same code in ofpacts_check() that issues the error.
1502 AT_CHECK([ovs-ofctl add-flow -O OpenFlow11 br0 table=1,action=goto_table:1],
1503 [1], [],
1504 [ovs-ofctl: actions are invalid with specified match (OFPBIC_BAD_TABLE_ID)
1505 ])
1506 OVS_VSWITCHD_STOP
1507 AT_CLEANUP
1508
1509 AT_SETUP([ofproto - set-field flow_mod commands (NXM)])
1510 OVS_VSWITCHD_START
1511 AT_CHECK([ovs-ofctl add-flow br0 ipv6,table=1,in_port=3,actions=drop])
1512 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])
1513 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])
1514 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1515 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[[]]
1516 table=1, ipv6,in_port=3 actions=load:0xa6badbfffefe59fa->NXM_NX_IPV6_SRC[[0..63]],load:0xfe8001234567890a->NXM_NX_IPV6_SRC[[64..127]]
1517 NXST_FLOW reply:
1518 ])
1519 OVS_VSWITCHD_STOP
1520 AT_CLEANUP
1521
1522 AT_SETUP([ofproto - basic flow_mod commands (OpenFlow 1.2)])
1523 OVS_VSWITCHD_START
1524 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip], [0], [OFPST_FLOW reply (OF1.2):
1525 ])
1526 AT_CHECK([echo 'in_port=2,actions=1' | ovs-ofctl -O OpenFlow12 add-flows br0 -])
1527 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 in_port=1,actions=2])
1528 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 table=1,in_port=4,actions=3])
1529 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1530 in_port=1 actions=output:2
1531 in_port=2 actions=output:1
1532 table=1, in_port=4 actions=output:3
1533 OFPST_FLOW reply (OF1.2):
1534 ])
1535 AT_CHECK([ovs-ofctl -O OpenFlow12 del-flows br0])
1536 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip], [0], [OFPST_FLOW reply (OF1.2):
1537 ])
1538 OVS_VSWITCHD_STOP
1539 AT_CLEANUP
1540
1541 AT_SETUP([ofproto - set-field flow_mod commands (OF1.2)])
1542 OVS_VSWITCHD_START
1543 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 ipv6,table=1,in_port=3,actions=drop])
1544 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])
1545 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])
1546 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1547 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
1548 table=1, ipv6,in_port=3 actions=set_field:fe80:123:4567:890a:a6ba:dbff:fefe:59fa->ipv6_src
1549 OFPST_FLOW reply (OF1.2):
1550 ])
1551 OVS_VSWITCHD_STOP
1552 AT_CLEANUP
1553
1554 AT_SETUP([ofproto - dump flows with cookie])
1555 OVS_VSWITCHD_START
1556 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x1,in_port=1,actions=1])
1557 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x2,in_port=2,actions=1])
1558 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x3,in_port=3,actions=1])
1559 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1560 cookie=0x1, in_port=1 actions=output:1
1561 cookie=0x2, in_port=2 actions=output:1
1562 cookie=0x3, in_port=3 actions=output:1
1563 NXST_FLOW reply:
1564 ])
1565 AT_CHECK([ovs-ofctl dump-aggregate br0 table=0 | strip_xids], [0], [dnl
1566 NXST_AGGREGATE reply: packet_count=0 byte_count=0 flow_count=3
1567 ])
1568 AT_CHECK([ovs-ofctl dump-flows br0 cookie=0x3/-1 | ofctl_strip | sort], [0], [dnl
1569 cookie=0x3, in_port=3 actions=output:1
1570 NXST_FLOW reply:
1571 ])
1572 AT_CHECK([ovs-ofctl dump-aggregate br0 cookie=0x3/-1 | strip_xids], [0], [dnl
1573 NXST_AGGREGATE reply: packet_count=0 byte_count=0 flow_count=1
1574 ])
1575 OVS_VSWITCHD_STOP
1576 AT_CLEANUP
1577
1578 AT_SETUP([ofproto - mod flow with cookie change (OpenFlow 1.0)])
1579 OVS_VSWITCHD_START
1580 AT_CHECK([ovs-ofctl -F openflow10 add-flow br0 cookie=0x1,in_port=1,actions=1])
1581 AT_CHECK([ovs-ofctl -F openflow10 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1582 cookie=0x1, in_port=1 actions=output:1
1583 OFPST_FLOW reply:
1584 ])
1585
1586 AT_CHECK([ovs-ofctl -F openflow10 mod-flows br0 cookie=0x2,in_port=1,actions=1])
1587 AT_CHECK([ovs-ofctl -F openflow10 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1588 cookie=0x2, in_port=1 actions=output:1
1589 OFPST_FLOW reply:
1590 ])
1591 OVS_VSWITCHD_STOP
1592 AT_CLEANUP
1593
1594 AT_SETUP([ofproto - mod flow with cookie change (NXM)])
1595 OVS_VSWITCHD_START
1596 AT_CHECK([ovs-ofctl -F nxm add-flow br0 cookie=0x1,in_port=1,actions=1])
1597 AT_CHECK([ovs-ofctl -F nxm dump-flows br0 | ofctl_strip | sort], [0], [dnl
1598 cookie=0x1, in_port=1 actions=output:1
1599 NXST_FLOW reply:
1600 ])
1601
1602 AT_CHECK([ovs-ofctl -F nxm mod-flows br0 cookie=0x2,in_port=1,actions=1])
1603 AT_CHECK([ovs-ofctl -F nxm dump-flows br0 | ofctl_strip | sort], [0], [dnl
1604 cookie=0x2, in_port=1 actions=output:1
1605 NXST_FLOW reply:
1606 ])
1607 OVS_VSWITCHD_STOP
1608 AT_CLEANUP
1609
1610 AT_SETUP([ofproto - no mod flow with cookie change (OpenFlow 1.1)])
1611 OVS_VSWITCHD_START
1612 AT_CHECK([ovs-ofctl -O OpenFlow11 add-flow br0 cookie=0x1,in_port=1,actions=1])
1613 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1614 cookie=0x1, in_port=1 actions=output:1
1615 OFPST_FLOW reply (OF1.1):
1616 ])
1617 AT_CHECK([ovs-ofctl -O OpenFlow11 mod-flows br0 cookie=0x2,in_port=1,actions=1])
1618 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1619 cookie=0x1, in_port=1 actions=output:1
1620 OFPST_FLOW reply (OF1.1):
1621 ])
1622 OVS_VSWITCHD_STOP
1623 AT_CLEANUP
1624
1625 dnl The OpenFlow 1.2 spec states that the cookie may not be modified
1626 AT_SETUP([ofproto - no mod flow with cookie change (OpenFlow 1.2)])
1627 OVS_VSWITCHD_START
1628 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 cookie=0x1,in_port=1,actions=1])
1629 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1630 cookie=0x1, in_port=1 actions=output:1
1631 OFPST_FLOW reply (OF1.2):
1632 ])
1633
1634 AT_CHECK([ovs-ofctl -O OpenFlow12 mod-flows br0 cookie=0x2,in_port=1,actions=1])
1635 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1636 cookie=0x1, in_port=1 actions=output:1
1637 OFPST_FLOW reply (OF1.2):
1638 ])
1639 OVS_VSWITCHD_STOP
1640 AT_CLEANUP
1641
1642 AT_SETUP([ofproto - mod flows based on cookie mask (OpenFlow 1.0)])
1643 OVS_VSWITCHD_START
1644 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x1,in_port=1,actions=1])
1645 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x1,in_port=2,actions=1])
1646 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x2,in_port=3,actions=1])
1647 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1648 cookie=0x1, in_port=1 actions=output:1
1649 cookie=0x1, in_port=2 actions=output:1
1650 cookie=0x2, in_port=3 actions=output:1
1651 NXST_FLOW reply:
1652 ])
1653
1654 AT_CHECK([ovs-ofctl -F nxm mod-flows br0 cookie=0x1/0xff,actions=4])
1655 AT_CHECK([ovs-ofctl -F nxm dump-flows br0 | ofctl_strip | sort], [0], [dnl
1656 cookie=0x1, in_port=1 actions=output:4
1657 cookie=0x1, in_port=2 actions=output:4
1658 cookie=0x2, in_port=3 actions=output:1
1659 NXST_FLOW reply:
1660 ])
1661 OVS_VSWITCHD_STOP
1662 AT_CLEANUP
1663
1664 AT_SETUP([ofproto - mod flows based on cookie mask (OpenFlow 1.1)])
1665 OVS_VSWITCHD_START
1666 AT_CHECK([ovs-ofctl -O OpenFlow11 add-flow br0 cookie=0x1,in_port=1,actions=1])
1667 AT_CHECK([ovs-ofctl -O OpenFlow11 add-flow br0 cookie=0x1,in_port=2,actions=1])
1668 AT_CHECK([ovs-ofctl -O OpenFlow11 add-flow br0 cookie=0x2,in_port=3,actions=1])
1669 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1670 cookie=0x1, in_port=1 actions=output:1
1671 cookie=0x1, in_port=2 actions=output:1
1672 cookie=0x2, in_port=3 actions=output:1
1673 OFPST_FLOW reply (OF1.1):
1674 ])
1675
1676 AT_CHECK([ovs-ofctl -O OpenFlow11 mod-flows br0 cookie=0x1/0xff,actions=4])
1677 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1678 cookie=0x1, in_port=1 actions=output:4
1679 cookie=0x1, in_port=2 actions=output:4
1680 cookie=0x2, in_port=3 actions=output:1
1681 OFPST_FLOW reply (OF1.1):
1682 ])
1683 OVS_VSWITCHD_STOP
1684 AT_CLEANUP
1685
1686 AT_SETUP([ofproto - mod flows based on cookie mask (OpenFlow 1.2)])
1687 OVS_VSWITCHD_START
1688 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 cookie=0x1,in_port=1,actions=1])
1689 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 cookie=0x1,in_port=2,actions=1])
1690 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 cookie=0x2,in_port=3,actions=1])
1691 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1692 cookie=0x1, in_port=1 actions=output:1
1693 cookie=0x1, in_port=2 actions=output:1
1694 cookie=0x2, in_port=3 actions=output:1
1695 OFPST_FLOW reply (OF1.2):
1696 ])
1697
1698 AT_CHECK([ovs-ofctl -O OpenFlow12 mod-flows br0 cookie=0x1/0xff,actions=4])
1699 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1700 cookie=0x1, in_port=1 actions=output:4
1701 cookie=0x1, in_port=2 actions=output:4
1702 cookie=0x2, in_port=3 actions=output:1
1703 OFPST_FLOW reply (OF1.2):
1704 ])
1705 OVS_VSWITCHD_STOP
1706 AT_CLEANUP
1707
1708 dnl The OpenFlow 1.2 spec states that the cookie may not be modified
1709 AT_SETUP([ofproto - mod flows based on cookie mask with cookie change])
1710 OVS_VSWITCHD_START
1711 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x1,in_port=1,actions=1])
1712 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x1,in_port=2,actions=1])
1713 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x2,in_port=3,actions=1])
1714 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1715 cookie=0x1, in_port=1 actions=output:1
1716 cookie=0x1, in_port=2 actions=output:1
1717 cookie=0x2, in_port=3 actions=output:1
1718 NXST_FLOW reply:
1719 ])
1720
1721 AT_CHECK([ovs-ofctl -F nxm mod-flows br0 cookie=1/-1,cookie=4,actions=4])
1722 AT_CHECK([ovs-ofctl -F nxm dump-flows br0 | ofctl_strip | sort], [0], [dnl
1723 cookie=0x2, in_port=3 actions=output:1
1724 cookie=0x4, in_port=1 actions=output:4
1725 cookie=0x4, in_port=2 actions=output:4
1726 NXST_FLOW reply:
1727 ])
1728 OVS_VSWITCHD_STOP
1729 AT_CLEANUP
1730
1731 AT_SETUP([ofproto - mod flow with cookie miss (mask==0) - NXM])
1732 OVS_VSWITCHD_START
1733 AT_CHECK([ovs-ofctl -F nxm mod-flows br0 in_port=1,actions=1])
1734 AT_CHECK([ovs-ofctl -F nxm dump-flows br0 | ofctl_strip | sort], [0], [dnl
1735 in_port=1 actions=output:1
1736 NXST_FLOW reply:
1737 ])
1738 OVS_VSWITCHD_STOP
1739 AT_CLEANUP
1740
1741 AT_SETUP([ofproto - mod flow with cookie miss (mask==0) - OF1.1])
1742 OVS_VSWITCHD_START
1743 AT_CHECK([ovs-ofctl -O openflow11 mod-flows br0 in_port=1,actions=1])
1744 AT_CHECK([ovs-ofctl -O openflow11 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1745 in_port=1 actions=output:1
1746 OFPST_FLOW reply (OF1.1):
1747 ])
1748 OVS_VSWITCHD_STOP
1749 AT_CLEANUP
1750
1751 AT_SETUP([ofproto - mod flow with cookie miss (mask==0) - OF1.2])
1752 OVS_VSWITCHD_START
1753 AT_CHECK([ovs-ofctl -O openflow12 mod-flows br0 in_port=1,actions=1])
1754 AT_CHECK([ovs-ofctl -O openflow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1755 OFPST_FLOW reply (OF1.2):
1756 ])
1757 OVS_VSWITCHD_STOP
1758 AT_CLEANUP
1759
1760 AT_SETUP([ofproto - mod flow with cookie miss (mask!=0) - NXM])
1761 OVS_VSWITCHD_START
1762 AT_CHECK([ovs-ofctl -F nxm mod-flows br0 cookie=1/1,in_port=1,actions=1])
1763 AT_CHECK([ovs-ofctl -F nxm dump-flows br0 | ofctl_strip | sort], [0], [dnl
1764 NXST_FLOW reply:
1765 ])
1766 OVS_VSWITCHD_STOP
1767 AT_CLEANUP
1768
1769 AT_SETUP([ofproto - mod flow with cookie miss (mask!=0) - OF1.1])
1770 OVS_VSWITCHD_START
1771 AT_CHECK([ovs-ofctl -O openflow11 mod-flows br0 cookie=1/1,in_port=1,actions=1])
1772 AT_CHECK([ovs-ofctl -O openflow11 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1773 OFPST_FLOW reply (OF1.1):
1774 ])
1775 OVS_VSWITCHD_STOP
1776 AT_CLEANUP
1777
1778 AT_SETUP([ofproto - mod flow with cookie miss (mask!=0) - OF1.2])
1779 OVS_VSWITCHD_START
1780 AT_CHECK([ovs-ofctl -O openflow12 mod-flows br0 cookie=1/1,in_port=1,actions=1])
1781 AT_CHECK([ovs-ofctl -O openflow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1782 OFPST_FLOW reply (OF1.2):
1783 ])
1784 OVS_VSWITCHD_STOP
1785 AT_CLEANUP
1786
1787 AT_SETUP([ofproto - del flows with cookies])
1788 OVS_VSWITCHD_START
1789 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x1,in_port=1,actions=1])
1790 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x2,in_port=2,actions=1])
1791 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x3,in_port=3,actions=1])
1792 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1793 cookie=0x1, in_port=1 actions=output:1
1794 cookie=0x2, in_port=2 actions=output:1
1795 cookie=0x3, in_port=3 actions=output:1
1796 NXST_FLOW reply:
1797 ])
1798
1799 AT_CHECK([ovs-ofctl del-flows br0])
1800 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1801 NXST_FLOW reply:
1802 ])
1803 OVS_VSWITCHD_STOP
1804 AT_CLEANUP
1805
1806 AT_SETUP([ofproto - del flows based on cookie])
1807 OVS_VSWITCHD_START
1808 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x1,in_port=1,actions=1])
1809 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x2,in_port=2,actions=1])
1810 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x3,in_port=3,actions=1])
1811 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1812 cookie=0x1, in_port=1 actions=output:1
1813 cookie=0x2, in_port=2 actions=output:1
1814 cookie=0x3, in_port=3 actions=output:1
1815 NXST_FLOW reply:
1816 ])
1817
1818 AT_CHECK([ovs-ofctl del-flows br0 cookie=0x3/-1])
1819 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1820 cookie=0x1, in_port=1 actions=output:1
1821 cookie=0x2, in_port=2 actions=output:1
1822 NXST_FLOW reply:
1823 ])
1824 OVS_VSWITCHD_STOP
1825 AT_CLEANUP
1826
1827 AT_SETUP([ofproto - del flows based on cookie mask])
1828 OVS_VSWITCHD_START
1829 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x1,in_port=1,actions=1])
1830 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x2,in_port=2,actions=1])
1831 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x3,in_port=3,actions=1])
1832 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1833 cookie=0x1, in_port=1 actions=output:1
1834 cookie=0x2, in_port=2 actions=output:1
1835 cookie=0x3, in_port=3 actions=output:1
1836 NXST_FLOW reply:
1837 ])
1838 AT_CHECK([ovs-ofctl del-flows br0 cookie=0x3/0x1])
1839 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1840 cookie=0x2, in_port=2 actions=output:1
1841 NXST_FLOW reply:
1842 ])
1843 OVS_VSWITCHD_STOP
1844 AT_CLEANUP
1845
1846 AT_SETUP([ofproto - del flows based on table id (NXM)])
1847 OVS_VSWITCHD_START
1848 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x1,in_port=1,actions=1])
1849 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x2,in_port=2,table=1,actions=1])
1850 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1851 cookie=0x1, in_port=1 actions=output:1
1852 cookie=0x2, table=1, in_port=2 actions=output:1
1853 NXST_FLOW reply:
1854 ])
1855 AT_CHECK([ovs-ofctl del-flows br0 table=0])
1856 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1857 cookie=0x2, table=1, in_port=2 actions=output:1
1858 NXST_FLOW reply:
1859 ])
1860 AT_CHECK([ovs-ofctl del-flows br0 table=1])
1861 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1862 NXST_FLOW reply:
1863 ])
1864 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x1,in_port=1,actions=1])
1865 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x2,in_port=2,table=1,actions=1])
1866 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1867 cookie=0x1, in_port=1 actions=output:1
1868 cookie=0x2, table=1, in_port=2 actions=output:1
1869 NXST_FLOW reply:
1870 ])
1871 AT_CHECK([ovs-ofctl del-flows br0])
1872 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1873 NXST_FLOW reply:
1874 ])
1875 OVS_VSWITCHD_STOP
1876 AT_CLEANUP
1877
1878 AT_SETUP([ofproto - del flows based on table id (OpenFlow 1.1)])
1879 OVS_VSWITCHD_START
1880 AT_CHECK([ovs-ofctl -O OpenFlow11 add-flow br0 cookie=0x1,in_port=1,actions=1])
1881 AT_CHECK([ovs-ofctl -O OpenFlow11 add-flow br0 cookie=0x2,in_port=2,table=1,actions=1])
1882 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1883 cookie=0x1, in_port=1 actions=output:1
1884 cookie=0x2, table=1, in_port=2 actions=output:1
1885 OFPST_FLOW reply (OF1.1):
1886 ])
1887 AT_CHECK([ovs-ofctl -O OpenFlow11 del-flows br0 table=0])
1888 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1889 cookie=0x2, table=1, in_port=2 actions=output:1
1890 OFPST_FLOW reply (OF1.1):
1891 ])
1892 AT_CHECK([ovs-ofctl -O OpenFlow11 del-flows br0 table=1])
1893 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1894 OFPST_FLOW reply (OF1.1):
1895 ])
1896 AT_CHECK([ovs-ofctl -O OpenFlow11 add-flow br0 cookie=0x1,in_port=1,actions=1])
1897 AT_CHECK([ovs-ofctl -O OpenFlow11 add-flow br0 cookie=0x2,in_port=2,table=1,actions=1])
1898 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1899 cookie=0x1, in_port=1 actions=output:1
1900 cookie=0x2, table=1, in_port=2 actions=output:1
1901 OFPST_FLOW reply (OF1.1):
1902 ])
1903 AT_CHECK([ovs-ofctl -O OpenFlow11 del-flows br0])
1904 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip], [0], [dnl
1905 OFPST_FLOW reply (OF1.1):
1906 cookie=0x2, table=1, in_port=2 actions=output:1
1907 ])
1908 OVS_VSWITCHD_STOP
1909 AT_CLEANUP
1910
1911 AT_SETUP([ofproto - del flows based on table id (OpenFlow 1.2)])
1912 OVS_VSWITCHD_START
1913 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 cookie=0x1,in_port=1,actions=1])
1914 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 cookie=0x2,in_port=2,table=1,actions=1])
1915 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1916 cookie=0x1, in_port=1 actions=output:1
1917 cookie=0x2, table=1, in_port=2 actions=output:1
1918 OFPST_FLOW reply (OF1.2):
1919 ])
1920 AT_CHECK([ovs-ofctl -O OpenFlow12 del-flows br0 table=0])
1921 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1922 cookie=0x2, table=1, in_port=2 actions=output:1
1923 OFPST_FLOW reply (OF1.2):
1924 ])
1925 AT_CHECK([ovs-ofctl -O OpenFlow12 del-flows br0 table=1])
1926 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1927 OFPST_FLOW reply (OF1.2):
1928 ])
1929 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 cookie=0x1,in_port=1,actions=1])
1930 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 cookie=0x2,in_port=2,table=1,actions=1])
1931 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1932 cookie=0x1, in_port=1 actions=output:1
1933 cookie=0x2, table=1, in_port=2 actions=output:1
1934 OFPST_FLOW reply (OF1.2):
1935 ])
1936 AT_CHECK([ovs-ofctl -O OpenFlow12 del-flows br0])
1937 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1938 OFPST_FLOW reply (OF1.2):
1939 ])
1940 OVS_VSWITCHD_STOP
1941 AT_CLEANUP
1942
1943 AT_SETUP([ofproto - flow_mod with out_port matching (OpenFlow 1.0)])
1944 OVS_VSWITCHD_START
1945 AT_DATA([flows.txt], [dnl
1946 in_port=1 actions=output:2
1947 in_port=2 actions=output:1,output:2,output:3
1948 in_port=3 actions=output:3,output:1,output:2
1949 in_port=4 actions=drop
1950 in_port=5 actions=output:3
1951 in_port=6 actions=output:1
1952 ])
1953 AT_CHECK([ovs-ofctl -F openflow10 add-flows br0 flows.txt])
1954 (cat flows.txt; echo 'OFPST_FLOW reply:') > expout
1955 AT_CHECK([ovs-ofctl -F openflow10 dump-flows br0 | ofctl_strip | sort], [0],
1956 [expout])
1957
1958 (grep 'output:2' flows.txt; echo 'OFPST_FLOW reply:') > expout
1959 AT_CHECK([ovs-ofctl -F openflow10 dump-flows br0 out_port=2 | ofctl_strip | sort], [0], [expout])
1960
1961 AT_CHECK([ovs-ofctl -F openflow10 del-flows br0 out_port=2])
1962 (grep -v 'output:2' flows.txt; echo 'OFPST_FLOW reply:') > expout
1963 AT_CHECK([ovs-ofctl -F openflow10 dump-flows br0 | ofctl_strip | sort], [0],
1964 [expout])
1965
1966 AT_CHECK([ovs-ofctl -F openflow10 del-flows br0 out_port=3])
1967 (grep -v 'output:[[23]]' flows.txt; echo 'OFPST_FLOW reply:') > expout
1968 AT_CHECK([ovs-ofctl -F openflow10 dump-flows br0 | ofctl_strip | sort], [0],
1969 [expout])
1970
1971 AT_CHECK([ovs-ofctl -F openflow10 del-flows br0 out_port=1])
1972 (grep -v 'output:[[123]]' flows.txt; echo 'OFPST_FLOW reply:') > expout
1973 AT_CHECK([ovs-ofctl -F openflow10 dump-flows br0 | ofctl_strip | sort], [0],
1974 [expout])
1975
1976 OVS_VSWITCHD_STOP
1977 AT_CLEANUP
1978
1979 AT_SETUP([ofproto - flow_mod with out_port matching (OpenFlow 1.1)])
1980 OVS_VSWITCHD_START
1981 AT_DATA([flows.txt], [dnl
1982 in_port=1 actions=output:2
1983 in_port=2 actions=output:1,write_actions(output:2,output:3)
1984 in_port=3 actions=output:3,output:1,write_actions(output:2)
1985 in_port=4 actions=drop
1986 in_port=5 actions=write_actions(output:3)
1987 in_port=6 actions=output:1
1988 ])
1989 AT_CHECK([ovs-ofctl -O OpenFlow11 add-flows br0 flows.txt])
1990 (cat flows.txt; echo 'OFPST_FLOW reply (OF1.1):') > expout
1991 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0],
1992 [expout])
1993
1994 (grep 'output:2' flows.txt; echo 'OFPST_FLOW reply (OF1.1):') > expout
1995 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 out_port=2 | ofctl_strip | sort], [0], [expout])
1996
1997 AT_CHECK([ovs-ofctl -O OpenFlow11 del-flows br0 out_port=2])
1998 (grep -v 'output:2' flows.txt; echo 'OFPST_FLOW reply (OF1.1):') > expout
1999 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0],
2000 [expout])
2001
2002 AT_CHECK([ovs-ofctl -O OpenFlow11 del-flows br0 out_port=3])
2003 (grep -v 'output:[[23]]' flows.txt; echo 'OFPST_FLOW reply (OF1.1):') > expout
2004 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0],
2005 [expout])
2006
2007 AT_CHECK([ovs-ofctl -O OpenFlow11 del-flows br0 out_port=1])
2008 (grep -v 'output:[[123]]' flows.txt; echo 'OFPST_FLOW reply (OF1.1):') > expout
2009 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0],
2010 [expout])
2011
2012 OVS_VSWITCHD_STOP
2013 AT_CLEANUP
2014
2015 AT_SETUP([ofproto - flow_mod with out_group matching (OpenFlow 1.1)])
2016 OVS_VSWITCHD_START
2017 AT_DATA([groups.txt], [dnl
2018 group_id=1,type=all,bucket=output:10
2019 group_id=2,type=all,bucket=output:10
2020 group_id=3,type=all,bucket=output:10
2021 ])
2022 AT_CHECK([ovs-ofctl -O OpenFlow11 add-groups br0 groups.txt])
2023 AT_DATA([flows.txt], [dnl
2024 in_port=1 actions=group:2,output:5
2025 in_port=2 actions=group:1,write_actions(group:2,group:3,output:6)
2026 in_port=3 actions=group:3,group:1,write_actions(group:2,output:3)
2027 in_port=4 actions=output:4
2028 in_port=5 actions=write_actions(output:4,group:3)
2029 in_port=6 actions=group:1
2030 ])
2031 AT_CHECK([ovs-ofctl -O OpenFlow11 add-flows br0 flows.txt])
2032 (cat flows.txt; echo 'OFPST_FLOW reply (OF1.1):') > expout
2033 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0],
2034 [expout])
2035
2036 (grep 'output:3' flows.txt | grep 'group:2'; echo 'OFPST_FLOW reply (OF1.1):') > expout
2037 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 out_port=3,out_group=2 | ofctl_strip | sort], [0], [expout])
2038
2039 AT_CHECK([ovs-ofctl -O OpenFlow11 del-flows br0 out_group=2])
2040 (grep -v 'group:2' flows.txt; echo 'OFPST_FLOW reply (OF1.1):') > expout
2041 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0],
2042 [expout])
2043
2044 AT_CHECK([ovs-ofctl -O OpenFlow11 del-flows br0 out_group=3])
2045 (grep -v 'group:[[23]]' flows.txt; echo 'OFPST_FLOW reply (OF1.1):') > expout
2046 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0],
2047 [expout])
2048
2049 AT_CHECK([ovs-ofctl -O OpenFlow11 del-flows br0 out_group=1])
2050 (grep -v 'group:[[123]]' flows.txt; echo 'OFPST_FLOW reply (OF1.1):') > expout
2051 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0],
2052 [expout])
2053
2054 OVS_VSWITCHD_STOP
2055 AT_CLEANUP
2056
2057 AT_SETUP([ofproto - bundle flow_mod with out group matching (OpenFlow 1.4)])
2058 OVS_VSWITCHD_START
2059 AT_DATA([bundle.txt], [dnl
2060 group group_id=1,type=all,bucket=output:10
2061 group group_id=2,type=all,bucket=output:10
2062 group group_id=3,type=all,bucket=output:10
2063 flow in_port=1 actions=group:2,output:5
2064 flow in_port=2 actions=group:1,write_actions(group:2,group:3,output:6)
2065 flow in_port=3 actions=group:3,group:1,write_actions(group:2,output:3)
2066 flow in_port=4 actions=output:4
2067 flow in_port=5 actions=write_actions(output:4,group:3)
2068 flow in_port=6 actions=group:1
2069 ])
2070 AT_CHECK([ovs-ofctl bundle br0 bundle.txt])
2071
2072 # for checking
2073 AT_DATA([flows.txt], [dnl
2074 in_port=1 actions=group:2,output:5
2075 in_port=2 actions=group:1,write_actions(group:2,group:3,output:6)
2076 in_port=3 actions=group:3,group:1,write_actions(group:2,output:3)
2077 in_port=4 actions=output:4
2078 in_port=5 actions=write_actions(output:4,group:3)
2079 in_port=6 actions=group:1
2080 ])
2081
2082 (cat flows.txt; echo 'OFPST_FLOW reply (OF1.4):') > expout
2083 AT_CHECK([ovs-ofctl -O OpenFlow14 dump-flows br0 | ofctl_strip | sort], [0],
2084 [expout])
2085
2086 (grep 'output:3' flows.txt | grep 'group:2'; echo 'OFPST_FLOW reply (OF1.4):') > expout
2087 AT_CHECK([ovs-ofctl -O OpenFlow14 dump-flows br0 out_port=3,out_group=2 | ofctl_strip | sort], [0], [expout])
2088
2089 AT_CHECK([ovs-ofctl -O OpenFlow14 del-flows br0 out_group=2])
2090 (grep -v 'group:2' flows.txt; echo 'OFPST_FLOW reply (OF1.4):') > expout
2091 AT_CHECK([ovs-ofctl -O OpenFlow14 dump-flows br0 | ofctl_strip | sort], [0],
2092 [expout])
2093
2094 AT_CHECK([ovs-ofctl -O OpenFlow14 del-flows br0 out_group=3])
2095 (grep -v 'group:[[23]]' flows.txt; echo 'OFPST_FLOW reply (OF1.4):') > expout
2096 AT_CHECK([ovs-ofctl -O OpenFlow14 dump-flows br0 | ofctl_strip | sort], [0],
2097 [expout])
2098
2099 AT_CHECK([ovs-ofctl -O OpenFlow14 del-flows br0 out_group=1])
2100 (grep -v 'group:[[123]]' flows.txt; echo 'OFPST_FLOW reply (OF1.4):') > expout
2101 AT_CHECK([ovs-ofctl -O OpenFlow14 dump-flows br0 | ofctl_strip | sort], [0],
2102 [expout])
2103
2104 OVS_VSWITCHD_STOP
2105 AT_CLEANUP
2106
2107 AT_SETUP([ofproto - bundle packet-out (OpenFlow 1.4)])
2108 OVS_VSWITCHD_START
2109
2110 ovs-ofctl del-flows br0
2111 ovs-ofctl add-flow br0 priority=0,actions=drop
2112
2113 # Start a monitor listening for packet-ins.
2114 AT_CHECK([ovs-ofctl -P standard monitor br0 --detach --no-chdir --pidfile])
2115 ovs-appctl -t ovs-ofctl ofctl/send 0109000c0123456700000080
2116 ovs-appctl -t ovs-ofctl ofctl/barrier
2117 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
2118 AT_CAPTURE_FILE([monitor.log])
2119
2120 # This bundle adds a group, a flow using that group and then a
2121 # packet-out that needs them both. Finally the bundle deletes all
2122 # groups, which also deletes the flow, leaving only the drop flow in
2123 # the table. If this works properly, the packet-out should get
2124 # translated and processed before the flow disappears. Also, if the
2125 # bundle were to fail, the packet-in should not get executed.
2126 AT_DATA([bundle.txt], [dnl
2127 group group_id=1,type=all,bucket=output:controller
2128 flow in_port=6 actions=group:1
2129 packet-out in_port=6, packet=0001020304050010203040501234 actions=table
2130 group delete
2131 ])
2132 AT_CHECK([ovs-ofctl bundle br0 bundle.txt])
2133
2134 # Verify that only the drop flow remains.
2135 AT_CHECK([ovs-ofctl -O OpenFlow14 dump-flows br0 | ofctl_strip | sort], [0],
2136 [ reset_counts priority=0 actions=drop
2137 OFPST_FLOW reply (OF1.4):
2138 ])
2139
2140 # Verify that the packet-in was received via controller action.
2141 AT_CHECK([sed 's/ (xid=0x[[1-9a-fA-F]][[0-9a-fA-F]]*)//' monitor.log], [0],
2142 [OFPT_PACKET_IN (xid=0x0): total_len=14 in_port=6 (via action) data_len=14 (unbuffered)
2143 vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1234
2144 ])
2145
2146 OVS_VSWITCHD_STOP
2147 AT_CLEANUP
2148
2149 AT_SETUP([ofproto - bundle packet-out, failing bundle commit (OpenFlow 1.4)])
2150 OVS_VSWITCHD_START
2151
2152 ovs-ofctl del-flows br0
2153 ovs-ofctl add-flow br0 priority=0,actions=drop
2154
2155 # Start a monitor listening for packet-ins.
2156 AT_CHECK([ovs-ofctl -P standard monitor br0 --detach --no-chdir --pidfile])
2157 ovs-appctl -t ovs-ofctl ofctl/send 0109000c0123456700000080
2158 ovs-appctl -t ovs-ofctl ofctl/barrier
2159 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
2160 AT_CAPTURE_FILE([monitor.log])
2161
2162 # This bundle adds a flow using that group and then a packet-out that
2163 # needs them both. Finally the bundle adds another flow that referes
2164 # to a non-existing group, causing the bundle to fail, and the
2165 # packet-in should not get executed.
2166 AT_DATA([bundle.txt], [dnl
2167 group group_id=1,type=all,bucket=output:controller
2168 flow in_port=6 actions=group:1
2169 packet-out in_port=6, packet=0001020304050010203040501234 actions=table
2170 flow in_port=7 actions=group:2
2171 ])
2172 AT_CHECK([ovs-ofctl bundle br0 bundle.txt 2>&1 | sed '/talking to/,$d' | strip_xids], [], [dnl
2173 Error OFPBAC_BAD_OUT_GROUP for: OFPT_FLOW_MOD (OF1.4): ADD in_port=7 actions=group:2
2174 Error OFPBFC_MSG_FAILED for: OFPT_BUNDLE_CONTROL (OF1.4):
2175 bundle_id=0 type=COMMIT_REQUEST flags=atomic ordered
2176 ])
2177
2178 # Verify that only the drop flow remains.
2179 AT_CHECK([ovs-ofctl -O OpenFlow14 dump-flows br0 | ofctl_strip | sort], [0],
2180 [ reset_counts priority=0 actions=drop
2181 OFPST_FLOW reply (OF1.4):
2182 ])
2183
2184 # Verify that the packet-in was NOT received via controller action.
2185 AT_CHECK([strip_xids < monitor.log], [0], [])
2186
2187 OVS_VSWITCHD_STOP
2188 AT_CLEANUP
2189
2190 AT_SETUP([ofproto - bundle packet-out makes bundle commit to fail(OpenFlow 1.4)])
2191 OVS_VSWITCHD_START
2192
2193 ovs-ofctl del-flows br0
2194 ovs-ofctl add-flow br0 priority=0,actions=drop
2195
2196 # Start a monitor listening for packet-ins.
2197 AT_CHECK([ovs-ofctl -P standard monitor br0 --detach --no-chdir --pidfile])
2198 ovs-appctl -t ovs-ofctl ofctl/send 0109000c0123456700000080
2199 ovs-appctl -t ovs-ofctl ofctl/barrier
2200 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
2201 AT_CAPTURE_FILE([monitor.log])
2202
2203 # This bundle adds a flow using that group and then a packet-out that
2204 # needs them both. Finally the bundle adds another flow that referes
2205 # to a non-existing group, causing the bundle to fail, and the
2206 # packet-in should not get executed.
2207 AT_DATA([bundle.txt], [dnl
2208 group group_id=1,type=all,bucket=output:controller
2209 flow in_port=6 actions=group:1
2210 packet-out in_port=6, packet=0001020304050010203040501234 actions=table
2211 packet-out in_port=6, packet=0001020304050010203040501234 actions=group:2
2212 ])
2213 AT_CHECK([ovs-ofctl bundle br0 bundle.txt 2>&1 | sed '/talking to/,$d' | strip_xids], [], [dnl
2214 Error OFPBAC_BAD_OUT_GROUP for: OFPT_PACKET_OUT (OF1.4): in_port=6 actions=group:2 data_len=14
2215 vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1234
2216 Error OFPBFC_MSG_FAILED for: OFPT_BUNDLE_CONTROL (OF1.4):
2217 bundle_id=0 type=COMMIT_REQUEST flags=atomic ordered
2218 ])
2219
2220 # Verify that only the drop flow remains.
2221 AT_CHECK([ovs-ofctl -O OpenFlow14 dump-flows br0 | ofctl_strip | sort], [0],
2222 [ reset_counts priority=0 actions=drop
2223 OFPST_FLOW reply (OF1.4):
2224 ])
2225
2226 # Verify that the packet-in was NOT received via controller action.
2227 AT_CHECK([strip_xids < monitor.log], [0], [])
2228
2229 OVS_VSWITCHD_STOP
2230 AT_CLEANUP
2231
2232 AT_SETUP([ofproto - flow table configuration (OpenFlow 1.0)])
2233 OVS_VSWITCHD_START
2234 # Check the default configuration.
2235 head_table() {
2236 printf 'OFPST_TABLE reply (xid=0x2):
2237 table 0%s:
2238 active=0, lookup=0, matched=0
2239 max_entries=1000000
2240 matching:
2241 in_port: exact match or wildcard
2242 eth_src: exact match or wildcard
2243 eth_dst: exact match or wildcard
2244 eth_type: exact match or wildcard
2245 vlan_vid: exact match or wildcard
2246 vlan_pcp: exact match or wildcard
2247 ip_src: exact match or wildcard
2248 ip_dst: exact match or wildcard
2249 nw_proto: exact match or wildcard
2250 nw_tos: exact match or wildcard
2251 tcp_src: exact match or wildcard
2252 tcp_dst: exact match or wildcard
2253
2254 ' "$1"
2255 }
2256 ditto() {
2257 for i in `seq $1 $2`; do
2258 printf ' table %d: ditto\n' $i
2259 done
2260 }
2261 (head_table; ditto 1 253) > expout
2262 AT_CHECK([ovs-ofctl dump-tables br0], [0], [expout])
2263 # Change the configuration.
2264 AT_CHECK(
2265 [ovs-vsctl \
2266 -- --id=@t0 create Flow_Table name=main \
2267 -- --id=@t1 create Flow_Table flow-limit=1024 \
2268 -- set bridge br0 'flow_tables={1=@t1,0=@t0}' \
2269 | uuidfilt],
2270 [0], [<0>
2271 <1>
2272 ])
2273 # Check that the configuration was updated.
2274 (head_table ' ("main")'; echo ' table 1:
2275 active=0, lookup=0, matched=0
2276 max_entries=1024
2277 (same matching)
2278
2279 table 2:
2280 active=0, lookup=0, matched=0
2281 max_entries=1000000
2282 (same matching)
2283 '; ditto 3 253) > expout
2284 AT_CHECK([ovs-ofctl dump-tables br0], [0], [expout])
2285 OVS_VSWITCHD_STOP
2286 AT_CLEANUP
2287
2288 dnl In-band and fail-open add "hidden rules" to table 0. These rules shouldn't
2289 dnl be visible to OpenFlow. This test checks that "dump-flows" and
2290 dnl "dump-tables" don't make them visible.
2291 AT_SETUP([ofproto - hidden rules not in table stats])
2292 # Use an IP address for a controller that won't actually exist: we
2293 # want to create in-band rules but we do not want to actually connect
2294 # to a controller (because that could mess about with our test). The
2295 # Class E range 240.0.0.0 - 255.255.255.255 seems like a good choice.
2296 OVS_VSWITCHD_START([set-controller br0 tcp:240.0.0.1:6653])
2297 for i in 1 2 3 4 5; do ovs-appctl time/warp 1000; done
2298
2299 # Check that no hidden flows are visible in OpenFlow.
2300 AT_CHECK([ovs-ofctl dump-flows br0 | strip_xids], [0], [NXST_FLOW reply:
2301 ])
2302
2303 # Check that some hidden flows related to 240.0.0.1 are actually in table 0.
2304 #
2305 # We discard flows that mention table_id because we only want table 0 flows,
2306 # which in OVS is implied by the absence of a table_id.
2307 AT_CHECK([ovs-appctl bridge/dump-flows br0], [0], [stdout])
2308 AT_CHECK([test `grep '240\.0\.0\.1' stdout | grep -v table_id= | wc -l` -gt 0])
2309
2310 # Check that dump-tables doesn't count the hidden flows.
2311 head_table() {
2312 printf 'OFPST_TABLE reply:
2313 table 0:
2314 active=0, lookup=0, matched=0
2315 max_entries=1000000
2316 matching:
2317 in_port: exact match or wildcard
2318 eth_src: exact match or wildcard
2319 eth_dst: exact match or wildcard
2320 eth_type: exact match or wildcard
2321 vlan_vid: exact match or wildcard
2322 vlan_pcp: exact match or wildcard
2323 ip_src: exact match or wildcard
2324 ip_dst: exact match or wildcard
2325 nw_proto: exact match or wildcard
2326 nw_tos: exact match or wildcard
2327 tcp_src: exact match or wildcard
2328 tcp_dst: exact match or wildcard
2329
2330 '
2331 }
2332 ditto() {
2333 for i in `seq $1 $2`; do
2334 printf ' table %d: ditto\n' $i
2335 done
2336 }
2337 (head_table; ditto 1 253) > expout
2338 AT_CHECK([ovs-ofctl dump-tables br0 | strip_xids], [0], [expout])
2339 OVS_VSWITCHD_STOP(["/240\.0\.0\.1/d"])
2340 AT_CLEANUP
2341
2342 AT_SETUP([ofproto - flow table configuration (OpenFlow 1.2)])
2343 OVS_VSWITCHD_START
2344 # Check the default configuration.
2345 head_table() {
2346 printf 'OFPST_TABLE reply (OF1.2) (xid=0x2):
2347 table 0%s:
2348 active=0, lookup=0, matched=0
2349 metadata: match=0xffffffffffffffff write=0xffffffffffffffff
2350 config=controller
2351 max_entries=1000000
2352 instructions (table miss and others):
2353 instructions: apply_actions,clear_actions,write_actions,write_metadata,goto_table
2354 Write-Actions and Apply-Actions features:
2355 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
2356 supported on Set-Field: metadata in_port_oxm eth_src eth_dst vlan_vid vlan_pcp mpls_label mpls_tc ip_src ip_dst ipv6_src ipv6_dst ipv6_label ip_dscp nw_ecn arp_op arp_spa arp_tpa arp_sha arp_tha tcp_src tcp_dst udp_src udp_dst sctp_src sctp_dst icmp_type icmp_code icmpv6_type icmpv6_code nd_target nd_sll nd_tll
2357 matching:
2358 metadata: exact match or wildcard
2359 in_port_oxm: exact match or wildcard
2360 eth_src: exact match or wildcard
2361 eth_dst: exact match or wildcard
2362 eth_type: exact match or wildcard
2363 vlan_vid: exact match or wildcard
2364 vlan_pcp: exact match or wildcard
2365 mpls_label: exact match or wildcard
2366 mpls_tc: exact match or wildcard
2367 ip_src: exact match or wildcard
2368 ip_dst: exact match or wildcard
2369 ipv6_src: exact match or wildcard
2370 ipv6_dst: exact match or wildcard
2371 ipv6_label: exact match or wildcard
2372 nw_proto: exact match or wildcard
2373 ip_dscp: exact match or wildcard
2374 nw_ecn: exact match or wildcard
2375 arp_op: exact match or wildcard
2376 arp_spa: exact match or wildcard
2377 arp_tpa: exact match or wildcard
2378 arp_sha: exact match or wildcard
2379 arp_tha: exact match or wildcard
2380 tcp_src: exact match or wildcard
2381 tcp_dst: exact match or wildcard
2382 udp_src: exact match or wildcard
2383 udp_dst: exact match or wildcard
2384 sctp_src: exact match or wildcard
2385 sctp_dst: exact match or wildcard
2386 icmp_type: exact match or wildcard
2387 icmp_code: exact match or wildcard
2388 icmpv6_type: exact match or wildcard
2389 icmpv6_code: exact match or wildcard
2390 nd_target: exact match or wildcard
2391 nd_sll: exact match or wildcard
2392 nd_tll: exact match or wildcard
2393
2394 ' "$1"
2395 }
2396 ditto() {
2397 for i in `seq $1 $2`; do
2398 printf ' table %d: ditto\n' $i
2399 done
2400 }
2401 tail_table() {
2402 printf ' table 253:
2403 active=0, lookup=0, matched=0
2404 metadata: match=0xffffffffffffffff write=0xffffffffffffffff
2405 config=controller
2406 max_entries=1000000
2407 instructions (table miss and others):
2408 instructions: apply_actions,clear_actions,write_actions,write_metadata
2409 (same actions)
2410 (same matching)
2411 '
2412 }
2413 (head_table; ditto 1 252; tail_table) > expout
2414 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-tables br0], [0], [expout])
2415 # Change the configuration.
2416 AT_CHECK(
2417 [ovs-vsctl \
2418 -- --id=@t0 create Flow_Table name=main \
2419 -- --id=@t1 create Flow_Table flow-limit=1024 \
2420 -- set bridge br0 'flow_tables={1=@t1,0=@t0}' \
2421 | uuidfilt],
2422 [0], [<0>
2423 <1>
2424 ])
2425 # Check that the configuration was updated.
2426 (head_table ' ("main")'; echo ' table 1:
2427 active=0, lookup=0, matched=0
2428 metadata: match=0xffffffffffffffff write=0xffffffffffffffff
2429 config=controller
2430 max_entries=1024
2431 (same instructions)
2432 (same matching)
2433
2434 table 2:
2435 active=0, lookup=0, matched=0
2436 metadata: match=0xffffffffffffffff write=0xffffffffffffffff
2437 config=controller
2438 max_entries=1000000
2439 (same instructions)
2440 (same matching)
2441 '; ditto 3 252; tail_table) > expout
2442 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-tables br0], [0], [expout])
2443 OVS_VSWITCHD_STOP
2444 AT_CLEANUP
2445
2446 AT_SETUP([ofproto - table features (OpenFlow 1.3)])
2447 OVS_VSWITCHD_START
2448 head_table () {
2449 printf ' table 0%s:
2450 metadata: match=0xffffffffffffffff write=0xffffffffffffffff
2451 max_entries=1000000
2452 instructions (table miss and others):
2453 next tables: 1-253
2454 instructions: meter,apply_actions,clear_actions,write_actions,write_metadata,goto_table
2455 Write-Actions and Apply-Actions features:
2456 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
2457 supported on Set-Field: tun_id tun_src tun_dst tun_ipv6_src tun_ipv6_dst tun_flags tun_gbp_id tun_gbp_flags tun_erspan_idx tun_erspan_ver tun_erspan_dir tun_erspan_hwid tun_metadata0 dnl
2458 tun_metadata1 tun_metadata2 tun_metadata3 tun_metadata4 tun_metadata5 tun_metadata6 tun_metadata7 tun_metadata8 tun_metadata9 tun_metadata10 tun_metadata11 tun_metadata12 tun_metadata13 tun_metadata14 tun_metadata15 tun_metadata16 tun_metadata17 tun_metadata18 tun_metadata19 tun_metadata20 tun_metadata21 tun_metadata22 tun_metadata23 tun_metadata24 tun_metadata25 tun_metadata26 tun_metadata27 tun_metadata28 tun_metadata29 tun_metadata30 tun_metadata31 tun_metadata32 tun_metadata33 tun_metadata34 tun_metadata35 tun_metadata36 tun_metadata37 tun_metadata38 tun_metadata39 tun_metadata40 tun_metadata41 tun_metadata42 tun_metadata43 tun_metadata44 tun_metadata45 tun_metadata46 tun_metadata47 tun_metadata48 tun_metadata49 tun_metadata50 tun_metadata51 tun_metadata52 tun_metadata53 tun_metadata54 tun_metadata55 tun_metadata56 tun_metadata57 tun_metadata58 tun_metadata59 tun_metadata60 tun_metadata61 tun_metadata62 tun_metadata63 dnl
2459 metadata in_port in_port_oxm pkt_mark ct_mark ct_label reg0 reg1 reg2 reg3 reg4 reg5 reg6 reg7 reg8 reg9 reg10 reg11 reg12 reg13 reg14 reg15 xreg0 xreg1 xreg2 xreg3 xreg4 xreg5 xreg6 xreg7 xxreg0 xxreg1 xxreg2 xxreg3 eth_src eth_dst vlan_tci vlan_vid vlan_pcp mpls_label mpls_tc mpls_ttl ip_src ip_dst ipv6_src ipv6_dst ipv6_label nw_tos ip_dscp nw_ecn nw_ttl arp_op arp_spa arp_tpa arp_sha arp_tha tcp_src tcp_dst udp_src udp_dst sctp_src sctp_dst icmp_type icmp_code icmpv6_type icmpv6_code nd_target nd_sll nd_tll nsh_flags nsh_spi nsh_si nsh_c1 nsh_c2 nsh_c3 nsh_c4 nsh_ttl
2460 matching:
2461 dp_hash: arbitrary mask
2462 recirc_id: exact match or wildcard
2463 packet_type: exact match or wildcard
2464 conj_id: exact match or wildcard
2465 tun_id: arbitrary mask
2466 tun_src: arbitrary mask
2467 tun_dst: arbitrary mask
2468 tun_ipv6_src: arbitrary mask
2469 tun_ipv6_dst: arbitrary mask
2470 tun_flags: arbitrary mask
2471 tun_gbp_id: arbitrary mask
2472 tun_gbp_flags: arbitrary mask
2473 tun_erspan_idx: arbitrary mask
2474 tun_erspan_ver: arbitrary mask
2475 tun_erspan_dir: arbitrary mask
2476 tun_erspan_hwid: arbitrary mask
2477 tun_metadata0: arbitrary mask
2478 tun_metadata1: arbitrary mask
2479 tun_metadata2: arbitrary mask
2480 tun_metadata3: arbitrary mask
2481 tun_metadata4: arbitrary mask
2482 tun_metadata5: arbitrary mask
2483 tun_metadata6: arbitrary mask
2484 tun_metadata7: arbitrary mask
2485 tun_metadata8: arbitrary mask
2486 tun_metadata9: arbitrary mask
2487 tun_metadata10: arbitrary mask
2488 tun_metadata11: arbitrary mask
2489 tun_metadata12: arbitrary mask
2490 tun_metadata13: arbitrary mask
2491 tun_metadata14: arbitrary mask
2492 tun_metadata15: arbitrary mask
2493 tun_metadata16: arbitrary mask
2494 tun_metadata17: arbitrary mask
2495 tun_metadata18: arbitrary mask
2496 tun_metadata19: arbitrary mask
2497 tun_metadata20: arbitrary mask
2498 tun_metadata21: arbitrary mask
2499 tun_metadata22: arbitrary mask
2500 tun_metadata23: arbitrary mask
2501 tun_metadata24: arbitrary mask
2502 tun_metadata25: arbitrary mask
2503 tun_metadata26: arbitrary mask
2504 tun_metadata27: arbitrary mask
2505 tun_metadata28: arbitrary mask
2506 tun_metadata29: arbitrary mask
2507 tun_metadata30: arbitrary mask
2508 tun_metadata31: arbitrary mask
2509 tun_metadata32: arbitrary mask
2510 tun_metadata33: arbitrary mask
2511 tun_metadata34: arbitrary mask
2512 tun_metadata35: arbitrary mask
2513 tun_metadata36: arbitrary mask
2514 tun_metadata37: arbitrary mask
2515 tun_metadata38: arbitrary mask
2516 tun_metadata39: arbitrary mask
2517 tun_metadata40: arbitrary mask
2518 tun_metadata41: arbitrary mask
2519 tun_metadata42: arbitrary mask
2520 tun_metadata43: arbitrary mask
2521 tun_metadata44: arbitrary mask
2522 tun_metadata45: arbitrary mask
2523 tun_metadata46: arbitrary mask
2524 tun_metadata47: arbitrary mask
2525 tun_metadata48: arbitrary mask
2526 tun_metadata49: arbitrary mask
2527 tun_metadata50: arbitrary mask
2528 tun_metadata51: arbitrary mask
2529 tun_metadata52: arbitrary mask
2530 tun_metadata53: arbitrary mask
2531 tun_metadata54: arbitrary mask
2532 tun_metadata55: arbitrary mask
2533 tun_metadata56: arbitrary mask
2534 tun_metadata57: arbitrary mask
2535 tun_metadata58: arbitrary mask
2536 tun_metadata59: arbitrary mask
2537 tun_metadata60: arbitrary mask
2538 tun_metadata61: arbitrary mask
2539 tun_metadata62: arbitrary mask
2540 tun_metadata63: arbitrary mask
2541 metadata: arbitrary mask
2542 in_port: exact match or wildcard
2543 in_port_oxm: exact match or wildcard
2544 actset_output: exact match or wildcard
2545 pkt_mark: arbitrary mask
2546 ct_state: arbitrary mask
2547 ct_zone: exact match or wildcard
2548 ct_mark: arbitrary mask
2549 ct_label: arbitrary mask
2550 ct_nw_proto: exact match or wildcard
2551 ct_nw_src: arbitrary mask
2552 ct_nw_dst: arbitrary mask
2553 ct_ipv6_src: arbitrary mask
2554 ct_ipv6_dst: arbitrary mask
2555 ct_tp_src: arbitrary mask
2556 ct_tp_dst: arbitrary mask
2557 reg0: arbitrary mask
2558 reg1: arbitrary mask
2559 reg2: arbitrary mask
2560 reg3: arbitrary mask
2561 reg4: arbitrary mask
2562 reg5: arbitrary mask
2563 reg6: arbitrary mask
2564 reg7: arbitrary mask
2565 reg8: arbitrary mask
2566 reg9: arbitrary mask
2567 reg10: arbitrary mask
2568 reg11: arbitrary mask
2569 reg12: arbitrary mask
2570 reg13: arbitrary mask
2571 reg14: arbitrary mask
2572 reg15: arbitrary mask
2573 xreg0: arbitrary mask
2574 xreg1: arbitrary mask
2575 xreg2: arbitrary mask
2576 xreg3: arbitrary mask
2577 xreg4: arbitrary mask
2578 xreg5: arbitrary mask
2579 xreg6: arbitrary mask
2580 xreg7: arbitrary mask
2581 xxreg0: arbitrary mask
2582 xxreg1: arbitrary mask
2583 xxreg2: arbitrary mask
2584 xxreg3: arbitrary mask
2585 eth_src: arbitrary mask
2586 eth_dst: arbitrary mask
2587 eth_type: exact match or wildcard
2588 vlan_tci: arbitrary mask
2589 vlan_vid: arbitrary mask
2590 vlan_pcp: exact match or wildcard
2591 mpls_label: exact match or wildcard
2592 mpls_tc: exact match or wildcard
2593 mpls_bos: exact match or wildcard
2594 mpls_ttl: exact match or wildcard
2595 ip_src: arbitrary mask
2596 ip_dst: arbitrary mask
2597 ipv6_src: arbitrary mask
2598 ipv6_dst: arbitrary mask
2599 ipv6_label: arbitrary mask
2600 nw_proto: exact match or wildcard
2601 nw_tos: exact match or wildcard
2602 ip_dscp: exact match or wildcard
2603 nw_ecn: exact match or wildcard
2604 nw_ttl: exact match or wildcard
2605 ip_frag: arbitrary mask
2606 arp_op: exact match or wildcard
2607 arp_spa: arbitrary mask
2608 arp_tpa: arbitrary mask
2609 arp_sha: arbitrary mask
2610 arp_tha: arbitrary mask
2611 tcp_src: arbitrary mask
2612 tcp_dst: arbitrary mask
2613 tcp_flags: arbitrary mask
2614 udp_src: arbitrary mask
2615 udp_dst: arbitrary mask
2616 sctp_src: arbitrary mask
2617 sctp_dst: arbitrary mask
2618 icmp_type: exact match or wildcard
2619 icmp_code: exact match or wildcard
2620 icmpv6_type: exact match or wildcard
2621 icmpv6_code: exact match or wildcard
2622 nd_target: arbitrary mask
2623 nd_sll: arbitrary mask
2624 nd_tll: arbitrary mask
2625 nsh_flags: arbitrary mask
2626 nsh_mdtype: exact match or wildcard
2627 nsh_np: exact match or wildcard
2628 nsh_spi: exact match or wildcard
2629 nsh_si: exact match or wildcard
2630 nsh_c1: arbitrary mask
2631 nsh_c2: arbitrary mask
2632 nsh_c3: arbitrary mask
2633 nsh_c4: arbitrary mask
2634 nsh_ttl: exact match or wildcard
2635
2636 ' "$1"
2637 }
2638 ditto() {
2639 printf ' table %d:
2640 metadata: match=0xffffffffffffffff write=0xffffffffffffffff
2641 max_entries=%d
2642 instructions (table miss and others):
2643 next tables: %d-253
2644 (same instructions)
2645 (same actions)
2646 (same matching)
2647
2648 ' $1 $2 `expr $1 + 1`
2649 }
2650 tail_tables() {
2651 echo ' table 252:
2652 metadata: match=0xffffffffffffffff write=0xffffffffffffffff
2653 max_entries=1000000
2654 instructions (table miss and others):
2655 next tables: 253
2656 (same instructions)
2657 (same actions)
2658 (same matching)
2659
2660 table 253:
2661 metadata: match=0xffffffffffffffff write=0xffffffffffffffff
2662 max_entries=1000000
2663 instructions (table miss and others):
2664 instructions: meter,apply_actions,clear_actions,write_actions,write_metadata
2665 (same actions)
2666 (same matching)
2667 '
2668 }
2669 (head_table
2670 for i in `seq 1 251`; do
2671 ditto $i 1000000
2672 done
2673 tail_tables) > expout
2674 AT_CHECK([ovs-ofctl -O OpenFlow13 dump-table-features br0], [0], [expout])
2675 # Change the configuration.
2676 AT_CHECK(
2677 [ovs-vsctl \
2678 -- --id=@t0 create Flow_Table name=main \
2679 -- --id=@t1 create Flow_Table flow-limit=1024 \
2680 -- set bridge br0 'flow_tables={1=@t1,0=@t0}' \
2681 | uuidfilt],
2682 [0], [<0>
2683 <1>
2684 ])
2685 # Check that the configuration was updated.
2686 (head_table ' ("main")'
2687 ditto 1 1024
2688 for i in `seq 2 251`; do
2689 ditto $i 1000000
2690 done
2691 tail_tables) > expout
2692 AT_CHECK([ovs-ofctl -O OpenFlow13 dump-table-features br0], [0], [expout])
2693 OVS_VSWITCHD_STOP
2694 AT_CLEANUP
2695
2696 AT_SETUP([ofproto - flow table names])
2697 OVS_VSWITCHD_START
2698 add_of_ports br0 1 2
2699 AT_CHECK(
2700 [ovs-vsctl \
2701 -- --id=@t0 create Flow_Table name=zero \
2702 -- --id=@t1 create Flow_Table name=one \
2703 -- --id=@t2 create Flow_Table name=two \
2704 -- set bridge br0 'flow_tables={0=@t0,1=@t1,2=@t2}' \
2705 | uuidfilt],
2706 [0], [<0>
2707 <1>
2708 <2>
2709 ])
2710 AT_DATA([flows.txt], [dnl
2711 table=zero in_port=p2 actions=p1,resubmit(,one)
2712 table=one,in_port=p1,ip,actions=ct(table=two)
2713 table=one,in_port=p1,arp,actions=goto_table(two)
2714 ])
2715 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
2716 AT_CHECK([ovs-ofctl --names --no-stats dump-flows br0], [0], [dnl
2717 table=zero, in_port=p2 actions=output:p1,resubmit(,one)
2718 table=one, ip,in_port=p1 actions=ct(table=two)
2719 table=one, arp,in_port=p1 actions=resubmit(,two)
2720 ])
2721 AT_CHECK([ovs-ofctl --no-names --no-stats dump-flows br0], [0], [dnl
2722 in_port=2 actions=output:1,resubmit(,1)
2723 table=1, ip,in_port=1 actions=ct(table=2)
2724 table=1, arp,in_port=1 actions=resubmit(,2)
2725 ])
2726 OVS_VSWITCHD_STOP
2727 AT_CLEANUP
2728
2729 AT_SETUP([ofproto - table description (OpenFlow 1.4)])
2730 OVS_VSWITCHD_START
2731 (x=0
2732 while test $x -lt 254; do
2733 y=`expr $x + 1`
2734 echo " table $x:
2735 eviction=off eviction_flags=OTHER|IMPORTANCE|LIFETIME
2736 vacancy=off"
2737 x=$y
2738 done) > expout
2739 AT_CHECK([ovs-ofctl -O OpenFlow14 dump-table-desc br0 | sed '/^$/d
2740 /^OFPST_TABLE_DESC/d'], [0], [expout])
2741
2742 # Change the configuration.
2743 AT_CHECK([ovs-ofctl -O Openflow14 mod-table br0 0 evict])
2744 # Check that the configuration was updated.
2745 mv expout orig-expout
2746 sed -e '2s/eviction=off/eviction=on/' <orig-expout > expout
2747 AT_CHECK([ovs-ofctl -O OpenFlow14 dump-table-desc br0 | sed '/^$/d
2748 /^OFPST_TABLE_DESC/d'], [0], [expout])
2749
2750 AT_CHECK([ovs-ofctl -O Openflow14 mod-table br0 0 vacancy:20,80])
2751 # Check that the configuration was updated.
2752 mv expout orig-expout
2753 sed -e '3s/vacancy=off/vacancy=on vacancy_down=20% vacancy_up=80% vacancy=100%/' <orig-expout > expout
2754 AT_CHECK([ovs-ofctl -O OpenFlow14 dump-table-desc br0 | sed '/^$/d
2755 /^OFPST_TABLE_DESC/d'], [0], [expout])
2756 OVS_VSWITCHD_STOP
2757 AT_CLEANUP
2758
2759 AT_SETUP([ofproto - hard limits on flow table size (OpenFlow 1.0)])
2760 OVS_VSWITCHD_START
2761 # Configure a maximum of 4 flows.
2762 AT_CHECK(
2763 [ovs-vsctl \
2764 -- --id=@t0 create Flow_Table flow-limit=4 \
2765 -- set bridge br0 flow_tables:0=@t0 \
2766 | uuidfilt],
2767 [0], [<0>
2768 ])
2769 # Add 4 flows.
2770 for in_port in 1 2 3 4; do
2771 ovs-ofctl add-flow br0 in_port=$in_port,actions=drop
2772 done
2773 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
2774 in_port=1 actions=drop
2775 in_port=2 actions=drop
2776 in_port=3 actions=drop
2777 in_port=4 actions=drop
2778 NXST_FLOW reply:
2779 ])
2780 # Adding another flow will be refused.
2781 AT_CHECK([ovs-ofctl add-flow br0 in_port=5,actions=drop], [1], [], [stderr])
2782 AT_CHECK([ofctl_strip < stderr], [0],
2783 [OFPT_ERROR: OFPFMFC_TABLE_FULL
2784 OFPT_FLOW_MOD: ADD in_port=5 actions=drop
2785 ])
2786 # Also a mod-flow that would add a flow will be refused.
2787 AT_CHECK([ovs-ofctl mod-flows br0 in_port=5,actions=drop], [1], [], [stderr])
2788 AT_CHECK([ofctl_strip < stderr], [0],
2789 [OFPT_ERROR: OFPFMFC_TABLE_FULL
2790 OFPT_FLOW_MOD: MOD in_port=5 actions=drop
2791 ])
2792 # Replacing or modifying an existing flow is allowed.
2793 AT_CHECK([ovs-ofctl add-flow br0 in_port=4,actions=normal])
2794 AT_CHECK([ovs-ofctl mod-flows br0 in_port=3,actions=output:1])
2795 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
2796 in_port=1 actions=drop
2797 in_port=2 actions=drop
2798 in_port=3 actions=output:1
2799 in_port=4 actions=NORMAL
2800 NXST_FLOW reply:
2801 ])
2802 OVS_VSWITCHD_STOP
2803 AT_CLEANUP
2804
2805 AT_SETUP([ofproto - hard limits on flow table size (OpenFlow 1.2)])
2806 OVS_VSWITCHD_START
2807 # Configure a maximum of 4 flows.
2808 AT_CHECK(
2809 [ovs-vsctl \
2810 -- --id=@t0 create Flow_Table flow-limit=4 \
2811 -- set bridge br0 flow_tables:0=@t0 \
2812 | uuidfilt],
2813 [0], [<0>
2814 ])
2815 # Add 4 flows.
2816 for in_port in 1 2 3 4; do
2817 ovs-ofctl -O OpenFlow12 add-flow br0 in_port=$in_port,actions=drop
2818 done
2819 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
2820 in_port=1 actions=drop
2821 in_port=2 actions=drop
2822 in_port=3 actions=drop
2823 in_port=4 actions=drop
2824 OFPST_FLOW reply (OF1.2):
2825 ])
2826 # Adding another flow will be refused.
2827 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 in_port=5,actions=drop], [1], [], [stderr])
2828 AT_CHECK([ofctl_strip < stderr], [0],
2829 [OFPT_ERROR (OF1.2): OFPFMFC_TABLE_FULL
2830 OFPT_FLOW_MOD (OF1.2): ADD in_port=5 actions=drop
2831 ])
2832 # Replacing or modifying an existing flow is allowed.
2833 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 in_port=4,actions=normal])
2834 AT_CHECK([ovs-ofctl -O OpenFlow12 mod-flows br0 in_port=3,actions=output:1])
2835 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
2836 in_port=1 actions=drop
2837 in_port=2 actions=drop
2838 in_port=3 actions=output:1
2839 in_port=4 actions=NORMAL
2840 OFPST_FLOW reply (OF1.2):
2841 ])
2842 OVS_VSWITCHD_STOP
2843 AT_CLEANUP
2844
2845 AT_SETUP([ofproto - eviction upon table overflow (OpenFlow 1.0)])
2846 OVS_VSWITCHD_START
2847 # Configure a maximum of 4 flows.
2848 AT_CHECK(
2849 [ovs-vsctl \
2850 -- --id=@t0 create Flow_Table flow-limit=4 overflow-policy=evict \
2851 -- set bridge br0 flow_tables:0=@t0 \
2852 | uuidfilt],
2853 [0], [<0>
2854 ])
2855 # Add 4 flows.
2856 for in_port in 4 3 2 1; do
2857 ovs-ofctl add-flow br0 idle_timeout=${in_port}0,in_port=$in_port,actions=drop
2858 done
2859 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
2860 idle_timeout=10, in_port=1 actions=drop
2861 idle_timeout=20, in_port=2 actions=drop
2862 idle_timeout=30, in_port=3 actions=drop
2863 idle_timeout=40, in_port=4 actions=drop
2864 NXST_FLOW reply:
2865 ])
2866 # Adding another flow will cause the one that expires soonest to be evicted.
2867 AT_CHECK([ovs-ofctl add-flow br0 in_port=5,actions=drop])
2868 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
2869 idle_timeout=20, in_port=2 actions=drop
2870 idle_timeout=30, in_port=3 actions=drop
2871 idle_timeout=40, in_port=4 actions=drop
2872 in_port=5 actions=drop
2873 NXST_FLOW reply:
2874 ])
2875 # A mod-flow that adds a flow also causes eviction, but replacing or
2876 # modifying an existing flow doesn't.
2877 AT_CHECK([ovs-ofctl mod-flows br0 in_port=6,actions=drop])
2878 AT_CHECK([ovs-ofctl add-flow br0 in_port=4,actions=normal])
2879 AT_CHECK([ovs-ofctl mod-flows br0 in_port=3,actions=output:1])
2880 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
2881 idle_timeout=30, in_port=3 actions=output:1
2882 in_port=4 actions=NORMAL
2883 in_port=5 actions=drop
2884 in_port=6 actions=drop
2885 NXST_FLOW reply:
2886 ])
2887 # Flows with no timeouts at all cannot be evicted.
2888 AT_CHECK([ovs-ofctl add-flow br0 in_port=7,actions=normal])
2889 AT_CHECK([ovs-ofctl add-flow br0 in_port=8,actions=drop], [1], [], [stderr])
2890 AT_CHECK([ofctl_strip < stderr], [0],
2891 [OFPT_ERROR: OFPFMFC_TABLE_FULL
2892 OFPT_FLOW_MOD: ADD in_port=8 actions=drop
2893 ])
2894 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
2895 in_port=4 actions=NORMAL
2896 in_port=5 actions=drop
2897 in_port=6 actions=drop
2898 in_port=7 actions=NORMAL
2899 NXST_FLOW reply:
2900 ])
2901 OVS_VSWITCHD_STOP
2902 AT_CLEANUP
2903
2904 AT_SETUP([ofproto - eviction upon table overflow (OpenFlow 1.2)])
2905 OVS_VSWITCHD_START
2906 # Configure a maximum of 4 flows.
2907 AT_CHECK(
2908 [ovs-vsctl \
2909 -- --id=@t0 create Flow_Table flow-limit=4 overflow-policy=evict \
2910 -- set bridge br0 flow_tables:0=@t0 \
2911 | uuidfilt],
2912 [0], [<0>
2913 ])
2914 # Add 4 flows.
2915 for in_port in 4 3 2 1; do
2916 ovs-ofctl -O OpenFlow12 add-flow br0 idle_timeout=${in_port}0,in_port=$in_port,actions=drop
2917 done
2918 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
2919 idle_timeout=10, in_port=1 actions=drop
2920 idle_timeout=20, in_port=2 actions=drop
2921 idle_timeout=30, in_port=3 actions=drop
2922 idle_timeout=40, in_port=4 actions=drop
2923 OFPST_FLOW reply (OF1.2):
2924 ])
2925 # Adding another flow will cause the one that expires soonest to be evicted.
2926 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 in_port=5,actions=drop])
2927 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
2928 idle_timeout=20, in_port=2 actions=drop
2929 idle_timeout=30, in_port=3 actions=drop
2930 idle_timeout=40, in_port=4 actions=drop
2931 in_port=5 actions=drop
2932 OFPST_FLOW reply (OF1.2):
2933 ])
2934 # In OpenFlow 1.2 a mod-flow does not ever add a flow and thus
2935 # has no effect on eviction
2936 AT_CHECK([ovs-ofctl -O OpenFlow12 mod-flows br0 in_port=6,actions=drop])
2937 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 in_port=4,actions=normal])
2938 AT_CHECK([ovs-ofctl -O OpenFlow12 mod-flows br0 in_port=3,actions=output:1])
2939 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
2940 idle_timeout=20, in_port=2 actions=drop
2941 idle_timeout=30, in_port=3 actions=output:1
2942 in_port=4 actions=NORMAL
2943 in_port=5 actions=drop
2944 OFPST_FLOW reply (OF1.2):
2945 ])
2946 # Flows with no timeouts at all cannot be evicted.
2947 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 in_port=6,actions=drop])
2948 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 in_port=7,actions=normal])
2949 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 in_port=8,actions=drop], [1], [], [stderr])
2950 AT_CHECK([ofctl_strip < stderr], [0],
2951 [OFPT_ERROR (OF1.2): OFPFMFC_TABLE_FULL
2952 OFPT_FLOW_MOD (OF1.2): ADD in_port=8 actions=drop
2953 ])
2954 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
2955 in_port=4 actions=NORMAL
2956 in_port=5 actions=drop
2957 in_port=6 actions=drop
2958 in_port=7 actions=NORMAL
2959 OFPST_FLOW reply (OF1.2):
2960 ])
2961 OVS_VSWITCHD_STOP
2962 AT_CLEANUP
2963
2964 AT_SETUP([ofproto - eviction using importance upon table overflow (OpenFlow 1.4)])
2965 OVS_VSWITCHD_START
2966 # Configure a maximum of 4 flows.
2967 AT_CHECK(
2968 [ovs-vsctl \
2969 -- --id=@t0 create Flow_Table name=evict flow-limit=4 \
2970 -- set bridge br0 flow_tables:0=@t0 \
2971 | uuidfilt],
2972 [0], [<0>
2973 ])
2974 # Use mod-table to turn on eviction just to demonstrate that it works.
2975 AT_CHECK([ovs-ofctl -O OpenFlow14 mod-table br0 0 evict])
2976 # Add 4 flows.
2977 for in_port in 4 3 2 1; do
2978 ovs-ofctl -O Openflow14 add-flow br0 importance=$((in_port + 30)),priority=$((in_port + 5)),hard_timeout=$((in_port + 500)),actions=drop
2979 done
2980 AT_CHECK([ovs-ofctl -O Openflow14 dump-flows br0 | ofctl_strip | sort], [0], [dnl
2981 hard_timeout=501, importance=31, priority=6 actions=drop
2982 hard_timeout=502, importance=32, priority=7 actions=drop
2983 hard_timeout=503, importance=33, priority=8 actions=drop
2984 hard_timeout=504, importance=34, priority=9 actions=drop
2985 OFPST_FLOW reply (OF1.4):
2986 ])
2987 # Adding another flow will cause the one with lowest importance to be evicted.
2988 AT_CHECK([ovs-ofctl -O Openflow14 add-flow br0 hard_timeout=505,importance=35,priority=10,in_port=2,actions=drop])
2989 AT_CHECK([ovs-ofctl -O Openflow14 dump-flows br0 | ofctl_strip | sort], [0], [dnl
2990 hard_timeout=502, importance=32, priority=7 actions=drop
2991 hard_timeout=503, importance=33, priority=8 actions=drop
2992 hard_timeout=504, importance=34, priority=9 actions=drop
2993 hard_timeout=505, importance=35, priority=10,in_port=2 actions=drop
2994 OFPST_FLOW reply (OF1.4):
2995 ])
2996 # Disable the Eviction configuration.
2997 AT_CHECK([ovs-ofctl -O OpenFlow14 mod-table br0 0 noevict])
2998 # Adding another flow will cause the system to give error for FULL TABLE.
2999 AT_CHECK([ovs-ofctl -O Openflow14 add-flow br0 hard_timeout=506,importance=36,priority=11,actions=drop],[1], [], [stderr])
3000 AT_CHECK([ofctl_strip < stderr], [0],
3001 [OFPT_ERROR (OF1.4): OFPFMFC_TABLE_FULL
3002 OFPT_FLOW_MOD (OF1.4): ADD priority=11 hard:506 importance:36 actions=drop
3003 ])
3004 #Dump flows. It should show only the old values
3005 AT_CHECK([ovs-ofctl -O Openflow14 dump-flows br0 | ofctl_strip | sort], [0], [dnl
3006 hard_timeout=502, importance=32, priority=7 actions=drop
3007 hard_timeout=503, importance=33, priority=8 actions=drop
3008 hard_timeout=504, importance=34, priority=9 actions=drop
3009 hard_timeout=505, importance=35, priority=10,in_port=2 actions=drop
3010 OFPST_FLOW reply (OF1.4):
3011 ])
3012 # mod-flow that would modify a flow will be done successfully.
3013 AT_CHECK([ovs-ofctl -O Openflow14 mod-flows br0 in_port=2,actions=NORMAL])
3014 AT_CHECK([ovs-ofctl -O Openflow14 dump-flows br0 | ofctl_strip | sort], [0], [dnl
3015 hard_timeout=502, importance=32, priority=7 actions=drop
3016 hard_timeout=503, importance=33, priority=8 actions=drop
3017 hard_timeout=504, importance=34, priority=9 actions=drop
3018 hard_timeout=505, importance=35, priority=10,in_port=2 actions=NORMAL
3019 OFPST_FLOW reply (OF1.4):
3020 ])
3021 # Also a mod-flow that would add a flow will be refused.
3022 AT_CHECK([ovs-ofctl mod-flows br0 in_port=5,actions=drop], [1], [], [stderr])
3023 AT_CHECK([ofctl_strip < stderr], [0],
3024 [OFPT_ERROR: OFPFMFC_TABLE_FULL
3025 OFPT_FLOW_MOD: MOD in_port=5 actions=drop
3026 ])
3027 OVS_VSWITCHD_STOP
3028 AT_CLEANUP
3029
3030 AT_SETUP([ofproto - eviction upon table overflow, with fairness (OpenFlow 1.0)])
3031 OVS_VSWITCHD_START
3032 # Configure a maximum of 4 flows.
3033 AT_CHECK(
3034 [ovs-vsctl \
3035 -- --id=@t0 create Flow_Table name=evict flow-limit=4 \
3036 overflow-policy=evict \
3037 groups='"NXM_OF_IN_PORT[[]]"' \
3038 -- set bridge br0 flow_tables:0=@t0 \
3039 | uuidfilt],
3040 [0], [<0>
3041 ])
3042 # Add 4 flows.
3043 ovs-ofctl add-flows br0 - <<EOF
3044 idle_timeout=10 in_port=2 dl_src=00:44:55:66:77:88 actions=drop
3045 idle_timeout=20 in_port=1 dl_src=00:11:22:33:44:55 actions=drop
3046 idle_timeout=30 in_port=1 dl_src=00:22:33:44:55:66 actions=drop
3047 idle_timeout=40 in_port=1 dl_src=00:33:44:55:66:77 actions=drop
3048 EOF
3049 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
3050 idle_timeout=10, in_port=2,dl_src=00:44:55:66:77:88 actions=drop
3051 idle_timeout=20, in_port=1,dl_src=00:11:22:33:44:55 actions=drop
3052 idle_timeout=30, in_port=1,dl_src=00:22:33:44:55:66 actions=drop
3053 idle_timeout=40, in_port=1,dl_src=00:33:44:55:66:77 actions=drop
3054 NXST_FLOW reply:
3055 ])
3056 # Adding another flow will cause the one that expires soonest within
3057 # the largest group (those with in_port=1) to be evicted. In this
3058 # case this is not the same as the one that expires soonest overall
3059 # (which is what makes the test interesting):
3060 AT_CHECK([ovs-ofctl add-flow br0 in_port=2,dl_src=00:55:66:77:88:99,actions=drop])
3061 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
3062 idle_timeout=10, in_port=2,dl_src=00:44:55:66:77:88 actions=drop
3063 idle_timeout=30, in_port=1,dl_src=00:22:33:44:55:66 actions=drop
3064 idle_timeout=40, in_port=1,dl_src=00:33:44:55:66:77 actions=drop
3065 in_port=2,dl_src=00:55:66:77:88:99 actions=drop
3066 NXST_FLOW reply:
3067 ])
3068 # Enlarge the flow limit, change the eviction policy back to strictly
3069 # based on expiration, and and add some flows.
3070 AT_CHECK([ovs-vsctl set Flow_Table evict groups='[[]]' flow-limit=7])
3071 ovs-ofctl add-flows br0 - <<EOF
3072 idle_timeout=50 in_port=2 dl_src=00:66:77:88:99:aa actions=drop
3073 idle_timeout=60 in_port=2 dl_src=00:77:88:99:aa:bb actions=drop
3074 idle_timeout=70 in_port=2 dl_src=00:88:99:aa:bb:cc actions=drop
3075 EOF
3076 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
3077 idle_timeout=10, in_port=2,dl_src=00:44:55:66:77:88 actions=drop
3078 idle_timeout=30, in_port=1,dl_src=00:22:33:44:55:66 actions=drop
3079 idle_timeout=40, in_port=1,dl_src=00:33:44:55:66:77 actions=drop
3080 idle_timeout=50, in_port=2,dl_src=00:66:77:88:99:aa actions=drop
3081 idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=drop
3082 idle_timeout=70, in_port=2,dl_src=00:88:99:aa:bb:cc actions=drop
3083 in_port=2,dl_src=00:55:66:77:88:99 actions=drop
3084 NXST_FLOW reply:
3085 ])
3086 # Adding another flow will cause the one that expires soonest overall
3087 # to be evicted.
3088 AT_CHECK([ovs-ofctl add-flow br0 'idle_timeout=80 in_port=2 dl_src=00:99:aa:bb:cc:dd actions=drop'])
3089 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
3090 idle_timeout=30, in_port=1,dl_src=00:22:33:44:55:66 actions=drop
3091 idle_timeout=40, in_port=1,dl_src=00:33:44:55:66:77 actions=drop
3092 idle_timeout=50, in_port=2,dl_src=00:66:77:88:99:aa actions=drop
3093 idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=drop
3094 idle_timeout=70, in_port=2,dl_src=00:88:99:aa:bb:cc actions=drop
3095 idle_timeout=80, in_port=2,dl_src=00:99:aa:bb:cc:dd actions=drop
3096 in_port=2,dl_src=00:55:66:77:88:99 actions=drop
3097 NXST_FLOW reply:
3098 ])
3099 # Reducing the flow limit also causes the flows that expire soonest
3100 # overall to be evicted.
3101 AT_CHECK([ovs-vsctl set Flow_Table evict flow-limit=4])
3102 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
3103 idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=drop
3104 idle_timeout=70, in_port=2,dl_src=00:88:99:aa:bb:cc actions=drop
3105 idle_timeout=80, in_port=2,dl_src=00:99:aa:bb:cc:dd actions=drop
3106 in_port=2,dl_src=00:55:66:77:88:99 actions=drop
3107 NXST_FLOW reply:
3108 ])
3109 OVS_VSWITCHD_STOP
3110 AT_CLEANUP
3111
3112 AT_SETUP([ofproto - eviction upon table overflow, with fairness (OpenFlow 1.2)])
3113 OVS_VSWITCHD_START
3114 # Configure a maximum of 4 flows.
3115 AT_CHECK(
3116 [ovs-vsctl \
3117 -- --id=@t0 create Flow_Table name=evict flow-limit=4 \
3118 overflow-policy=evict \
3119 groups='"NXM_OF_IN_PORT[[]]"' \
3120 -- set bridge br0 flow_tables:0=@t0 \
3121 | uuidfilt],
3122 [0], [<0>
3123 ])
3124 # Add 4 flows.
3125 ovs-ofctl -O OpenFlow12 add-flows br0 - <<EOF
3126 idle_timeout=10 in_port=2 dl_src=00:44:55:66:77:88 actions=drop
3127 idle_timeout=20 in_port=1 dl_src=00:11:22:33:44:55 actions=drop
3128 idle_timeout=30 in_port=1 dl_src=00:22:33:44:55:66 actions=drop
3129 idle_timeout=40 in_port=1 dl_src=00:33:44:55:66:77 actions=drop
3130 EOF
3131 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
3132 idle_timeout=10, in_port=2,dl_src=00:44:55:66:77:88 actions=drop
3133 idle_timeout=20, in_port=1,dl_src=00:11:22:33:44:55 actions=drop
3134 idle_timeout=30, in_port=1,dl_src=00:22:33:44:55:66 actions=drop
3135 idle_timeout=40, in_port=1,dl_src=00:33:44:55:66:77 actions=drop
3136 OFPST_FLOW reply (OF1.2):
3137 ])
3138 # Adding another flow will cause the one that expires soonest within
3139 # the largest group (those with in_port=1) to be evicted. In this
3140 # case this is not the same as the one that expires soonest overall
3141 # (which is what makes the test interesting):
3142 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 in_port=2,dl_src=00:55:66:77:88:99,actions=drop])
3143 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
3144 idle_timeout=10, in_port=2,dl_src=00:44:55:66:77:88 actions=drop
3145 idle_timeout=30, in_port=1,dl_src=00:22:33:44:55:66 actions=drop
3146 idle_timeout=40, in_port=1,dl_src=00:33:44:55:66:77 actions=drop
3147 in_port=2,dl_src=00:55:66:77:88:99 actions=drop
3148 OFPST_FLOW reply (OF1.2):
3149 ])
3150 # Enlarge the flow limit, change the eviction policy back to strictly
3151 # based on expiration, and and add some flows.
3152 AT_CHECK([ovs-vsctl set Flow_Table evict groups='[[]]' flow-limit=7])
3153 ovs-ofctl -O OpenFlow12 add-flows br0 - <<EOF
3154 idle_timeout=50 in_port=2 dl_src=00:66:77:88:99:aa actions=drop
3155 idle_timeout=60 in_port=2 dl_src=00:77:88:99:aa:bb actions=drop
3156 idle_timeout=70 in_port=2 dl_src=00:88:99:aa:bb:cc actions=drop
3157 EOF
3158 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
3159 idle_timeout=10, in_port=2,dl_src=00:44:55:66:77:88 actions=drop
3160 idle_timeout=30, in_port=1,dl_src=00:22:33:44:55:66 actions=drop
3161 idle_timeout=40, in_port=1,dl_src=00:33:44:55:66:77 actions=drop
3162 idle_timeout=50, in_port=2,dl_src=00:66:77:88:99:aa actions=drop
3163 idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=drop
3164 idle_timeout=70, in_port=2,dl_src=00:88:99:aa:bb:cc actions=drop
3165 in_port=2,dl_src=00:55:66:77:88:99 actions=drop
3166 OFPST_FLOW reply (OF1.2):
3167 ])
3168 # Adding another flow will cause the one that expires soonest overall
3169 # to be evicted.
3170 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'])
3171 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
3172 idle_timeout=30, in_port=1,dl_src=00:22:33:44:55:66 actions=drop
3173 idle_timeout=40, in_port=1,dl_src=00:33:44:55:66:77 actions=drop
3174 idle_timeout=50, in_port=2,dl_src=00:66:77:88:99:aa actions=drop
3175 idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=drop
3176 idle_timeout=70, in_port=2,dl_src=00:88:99:aa:bb:cc actions=drop
3177 idle_timeout=80, in_port=2,dl_src=00:99:aa:bb:cc:dd actions=drop
3178 in_port=2,dl_src=00:55:66:77:88:99 actions=drop
3179 OFPST_FLOW reply (OF1.2):
3180 ])
3181 # Reducing the flow limit also causes the flows that expire soonest
3182 # overall to be evicted.
3183 AT_CHECK([ovs-vsctl set Flow_Table evict flow-limit=4])
3184 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
3185 idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=drop
3186 idle_timeout=70, in_port=2,dl_src=00:88:99:aa:bb:cc actions=drop
3187 idle_timeout=80, in_port=2,dl_src=00:99:aa:bb:cc:dd actions=drop
3188 in_port=2,dl_src=00:55:66:77:88:99 actions=drop
3189 OFPST_FLOW reply (OF1.2):
3190 ])
3191 OVS_VSWITCHD_STOP
3192 AT_CLEANUP
3193
3194 AT_SETUP([ofproto - eviction upon table overflow, with modified hard timeout])
3195 OVS_VSWITCHD_START
3196 # Configure a maximum of 4 flows.
3197 AT_CHECK(
3198 [ovs-vsctl \
3199 -- --id=@t0 create Flow_Table flow-limit=4 overflow-policy=evict \
3200 -- set bridge br0 flow_tables:0=@t0 \
3201 | uuidfilt],
3202 [0], [<0>
3203 ])
3204 ovs-appctl time/stop
3205 # Add 4 flows.
3206 for in_port in 4 3 2 1; do
3207 ovs-ofctl add-flow br0 hard_timeout=$((10 + in_port * 3)),in_port=$in_port,actions=drop
3208 done
3209 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
3210 hard_timeout=13, in_port=1 actions=drop
3211 hard_timeout=16, in_port=2 actions=drop
3212 hard_timeout=19, in_port=3 actions=drop
3213 hard_timeout=22, in_port=4 actions=drop
3214 NXST_FLOW reply:
3215 ])
3216 # Sleep and modify the one that expires soonest
3217 ovs-appctl time/warp 5000
3218 AT_CHECK([ovs-ofctl mod-flows br0 in_port=1,actions=drop])
3219 # At this point the table would looks like:
3220 # in_port seconds to expire
3221 # 1 13
3222 # 2 11
3223 # 3 14
3224 # 4 17
3225 ovs-appctl time/warp 2000
3226 # Adding another flow will cause the one that expires soonest to be evicted.
3227 AT_CHECK([ovs-ofctl add-flow br0 in_port=5,actions=drop])
3228 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
3229 hard_timeout=13, in_port=1 actions=drop
3230 hard_timeout=19, in_port=3 actions=drop
3231 hard_timeout=22, in_port=4 actions=drop
3232 in_port=5 actions=drop
3233 NXST_FLOW reply:
3234 ])
3235 OVS_VSWITCHD_STOP
3236 AT_CLEANUP
3237
3238 AT_SETUP([ofproto - eviction upon table overflow, with modified idle timeout])
3239 OVS_VSWITCHD_START([add-port br0 p1 -- set interface p1 type=dummy ofport_request=1])
3240 # Configure a maximum of 4 flows.
3241 AT_CHECK(
3242 [ovs-vsctl \
3243 -- --id=@t0 create Flow_Table flow-limit=4 overflow-policy=evict \
3244 -- set bridge br0 flow_tables:0=@t0 \
3245 | uuidfilt],
3246 [0], [<0>
3247 ])
3248 # Add 4 flows.
3249 for in_port in 4 3 2 1; do
3250 ovs-ofctl add-flow br0 idle_timeout=$((10 + in_port * 3)),in_port=$in_port,actions=drop
3251 done
3252 ovs-appctl time/stop
3253 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
3254 idle_timeout=13, in_port=1 actions=drop
3255 idle_timeout=16, in_port=2 actions=drop
3256 idle_timeout=19, in_port=3 actions=drop
3257 idle_timeout=22, in_port=4 actions=drop
3258 NXST_FLOW reply:
3259 ])
3260 # Sleep and receive on the flow that expires soonest
3261 ovs-appctl time/warp 5000
3262 AT_CHECK([ovs-appctl netdev-dummy/receive p1 'in_port(1)'])
3263 # At this point the table would looks like:
3264 # in_port seconds to expire
3265 # 1 13
3266 # 2 11
3267 # 3 14
3268 # 4 17
3269 ovs-appctl time/warp 2000
3270 # Adding another flow will cause the one that expires soonest to be evicted.
3271 AT_CHECK([ovs-ofctl add-flow br0 in_port=5,actions=drop])
3272 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
3273 idle_timeout=19, in_port=3 actions=drop
3274 idle_timeout=22, in_port=4 actions=drop
3275 in_port=5 actions=drop
3276 n_packets=1, n_bytes=14, idle_timeout=13, in_port=1 actions=drop
3277 NXST_FLOW reply:
3278 ])
3279 OVS_VSWITCHD_STOP
3280 AT_CLEANUP
3281
3282 AT_SETUP([ofproto - asynchronous message control (OpenFlow 1.0)])
3283 OVS_VSWITCHD_START
3284 AT_CHECK([ovs-ofctl -P standard monitor br0 --detach --no-chdir --pidfile])
3285 check_async () {
3286 printf '\n\n--- check_async %d ---\n\n\n' $1
3287 shift
3288
3289 ovs-appctl -t ovs-ofctl ofctl/barrier
3290 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
3291 : > expout
3292
3293 # OFPT_PACKET_IN, OFPR_ACTION (controller_id=0)
3294 ovs-ofctl -v packet-out br0 controller controller '0001020304050010203040501234'
3295 if test X"$1" = X"OFPR_ACTION"; then shift;
3296 echo >>expout "OFPT_PACKET_IN: total_len=14 in_port=CONTROLLER (via action) data_len=14 (unbuffered)
3297 vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1234"
3298 fi
3299
3300 # OFPT_PACKET_IN, OFPR_NO_MATCH (controller_id=123)
3301 ovs-ofctl -v packet-out br0 controller 'controller(reason=no_match,id=123)' '0001020304050010203040501234'
3302 if test X"$1" = X"OFPR_NO_MATCH"; then shift;
3303 echo >>expout "OFPT_PACKET_IN: total_len=14 in_port=CONTROLLER (via no_match) data_len=14 (unbuffered)
3304 vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1234"
3305 fi
3306
3307 # OFPT_PACKET_IN, OFPR_INVALID_TTL (controller_id=0)
3308 ovs-ofctl packet-out br0 "in_port=controller packet=002583dfb4000026b98cb0f908004500003eb7e200000011339bac11370dac100002d7730035002b8f6d86fb0100000100000000000006626c702d7873066e696369726103636f6d00000f00 actions=dec_ttl"
3309 if test X"$1" = X"OFPR_INVALID_TTL"; then shift;
3310 echo >>expout "OFPT_PACKET_IN: total_len=76 in_port=CONTROLLER (via invalid_ttl) data_len=76 (unbuffered)
3311 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"
3312 fi
3313
3314 # OFPT_PORT_STATUS, OFPPR_ADD
3315 ovs-vsctl add-port br0 test -- set Interface test type=dummy ofport_request=1
3316 if test X"$1" = X"OFPPR_ADD"; then shift;
3317 echo >>expout "OFPT_PORT_STATUS: ADD: 1(test): addr:aa:55:aa:55:00:0x
3318 config: PORT_DOWN
3319 state: LINK_DOWN
3320 speed: 0 Mbps now, 0 Mbps max"
3321 fi
3322
3323 # OFPT_PORT_STATUS, OFPPR_DELETE
3324 ovs-vsctl del-port br0 test
3325 if test X"$1" = X"OFPPR_DELETE"; then shift;
3326 echo >>expout "OFPT_PORT_STATUS: DEL: 1(test): addr:aa:55:aa:55:00:0x
3327 config: PORT_DOWN
3328 state: LINK_DOWN
3329 speed: 0 Mbps now, 0 Mbps max"
3330 fi
3331
3332 # OFPT_FLOW_REMOVED, OFPRR_DELETE
3333 ovs-ofctl add-flow br0 send_flow_rem,actions=drop
3334 ovs-ofctl --strict del-flows br0 ''
3335 if test X"$1" = X"OFPRR_DELETE"; then shift;
3336 echo >>expout "OFPT_FLOW_REMOVED: reason=delete"
3337 fi
3338 AT_FAIL_IF([test X"$1" != X])
3339
3340 OVS_WAIT_UNTIL([test `wc -l < "monitor.log"` -ge `wc -l < "expout"`])
3341
3342 AT_CHECK(
3343 [[sed '
3344 s/ (xid=0x[0-9a-fA-F]*)//
3345 s/ *duration.*//
3346 s/00:0.$/00:0x/' < monitor.log]],
3347 [0], [expout])
3348 }
3349
3350 # It's a service connection so initially there should be no async messages.
3351 check_async 1
3352
3353 # Set miss_send_len to 128, turning on packet-ins for our service connection.
3354 ovs-appctl -t ovs-ofctl ofctl/send 0109000c0123456700000080
3355 check_async 2 OFPR_ACTION OFPPR_ADD OFPPR_DELETE OFPRR_DELETE
3356
3357 # Set miss_send_len to 128 and enable invalid_ttl.
3358 ovs-appctl -t ovs-ofctl ofctl/send 0109000c0123456700040080
3359 check_async 3 OFPR_ACTION OFPR_INVALID_TTL OFPPR_ADD OFPPR_DELETE OFPRR_DELETE
3360
3361 # Become slave, which should disable everything except port status.
3362 ovs-appctl -t ovs-ofctl ofctl/send 0104001400000002000023200000000a00000002
3363 check_async 4 OFPPR_ADD OFPPR_DELETE
3364
3365 # Use NXT_SET_ASYNC_CONFIG to enable a patchwork of asynchronous messages.
3366 ovs-appctl -t ovs-ofctl ofctl/send 01040028000000020000232000000013000000020000000500000005000000020000000200000005
3367 check_async 5 OFPR_INVALID_TTL OFPPR_DELETE OFPRR_DELETE
3368
3369 # Set controller ID 123.
3370 ovs-appctl -t ovs-ofctl ofctl/send 01040018000000030000232000000014000000000000007b
3371 check_async 6 OFPR_NO_MATCH OFPPR_DELETE OFPRR_DELETE
3372
3373 # Restore controller ID 0.
3374 ovs-appctl -t ovs-ofctl ofctl/send 010400180000000300002320000000140000000000000000
3375
3376 # Become master.
3377 ovs-appctl -t ovs-ofctl ofctl/send 0104001400000002000023200000000a00000001
3378 check_async 7 OFPR_ACTION OFPPR_ADD
3379
3380 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
3381 OVS_VSWITCHD_STOP
3382 AT_CLEANUP
3383
3384 AT_SETUP([ofproto - asynchronous message control (OpenFlow 1.2)])
3385 OVS_VSWITCHD_START
3386 AT_CHECK([ovs-ofctl -O OpenFlow12 -P standard monitor br0 --detach --no-chdir --pidfile])
3387 check_async () {
3388 printf '\n\n--- check_async %d ---\n\n\n' $1
3389 INDEX=$1
3390 shift
3391
3392 ovs-appctl -t ovs-ofctl ofctl/barrier
3393 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
3394 : > expout
3395
3396 # OFPT_PACKET_IN, OFPR_ACTION (controller_id=0)
3397 ovs-ofctl -O OpenFlow12 -v packet-out br0 none controller '0001020304050010203040501234'
3398 if test X"$1" = X"OFPR_ACTION"; then shift;
3399 echo >>expout "OFPT_PACKET_IN (OF1.2): total_len=14 in_port=ANY (via action) data_len=14 (unbuffered)
3400 vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1234"
3401 fi
3402
3403 # OFPT_PACKET_IN, OFPR_NO_MATCH (controller_id=123)
3404 ovs-ofctl -O OpenFlow12 -v packet-out br0 none 'controller(reason=no_match,id=123)' '0001020304050010203040501234'
3405 if test X"$1" = X"OFPR_NO_MATCH"; then shift;
3406 echo >>expout "OFPT_PACKET_IN (OF1.2): total_len=14 in_port=ANY (via no_match) data_len=14 (unbuffered)
3407 vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1234"
3408 fi
3409
3410 # OFPT_PACKET_IN, OFPR_INVALID_TTL (controller_id=0)
3411 ovs-ofctl -O OpenFlow12 packet-out br0 none dec_ttl '002583dfb4000026b98cb0f908004500003eb7e200000011339bac11370dac100002d7730035002b8f6d86fb0100000100000000000006626c702d7873066e696369726103636f6d00000f00'
3412 if test X"$1" = X"OFPR_INVALID_TTL"; then shift;
3413 echo >>expout "OFPT_PACKET_IN (OF1.2): total_len=76 in_port=ANY (via invalid_ttl) data_len=76 (unbuffered)
3414 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"
3415 fi
3416
3417 # OFPT_PORT_STATUS, OFPPR_ADD
3418 ovs-vsctl add-port br0 test -- set Interface test type=dummy
3419 if test X"$1" = X"OFPPR_ADD"; then shift;
3420 echo >>expout "OFPT_PORT_STATUS (OF1.2): ADD: ${INDEX}(test): addr:aa:55:aa:55:00:0x
3421 config: PORT_DOWN
3422 state: LINK_DOWN
3423 speed: 0 Mbps now, 0 Mbps max"
3424 fi
3425
3426 # OFPT_PORT_STATUS, OFPPR_DELETE
3427 ovs-vsctl del-port br0 test
3428 if test X"$1" = X"OFPPR_DELETE"; then shift;
3429 echo >>expout "OFPT_PORT_STATUS (OF1.2): DEL: ${INDEX}(test): addr:aa:55:aa:55:00:0x
3430 config: PORT_DOWN
3431 state: LINK_DOWN
3432 speed: 0 Mbps now, 0 Mbps max"
3433 fi
3434
3435 # OFPT_FLOW_REMOVED, OFPRR_DELETE
3436 ovs-ofctl -O OpenFlow12 add-flow br0 send_flow_rem,actions=drop
3437 ovs-ofctl -O OpenFlow12 --strict del-flows br0 ''
3438 if test X"$1" = X"OFPRR_DELETE"; then shift;
3439 echo >>expout "OFPT_FLOW_REMOVED (OF1.2): reason=delete table_id=0"
3440 fi
3441 AT_FAIL_IF([test X"$1" != X])
3442
3443 OVS_WAIT_UNTIL([test `wc -l < "monitor.log"` -ge `wc -l < "expout"`])
3444
3445 AT_CHECK(
3446 [[sed '
3447 s/ (xid=0x[0-9a-fA-F]*)//
3448 s/ *duration.*//
3449 s/00:0.$/00:0x/' < monitor.log]],
3450 [0], [expout])
3451 }
3452
3453 # It's a service connection so initially there should be no async messages.
3454 check_async 1
3455
3456 # Set miss_send_len to 128, turning on packet-ins for our service connection.
3457 ovs-appctl -t ovs-ofctl ofctl/send 0309000c0123456700000080
3458 check_async 2 OFPR_ACTION OFPPR_ADD OFPPR_DELETE OFPRR_DELETE
3459
3460 # Set miss_send_len to 128 and enable invalid_ttl.
3461 ovs-appctl -t ovs-ofctl ofctl/send 0309000c0123456700040080
3462 check_async 3 OFPR_ACTION OFPR_INVALID_TTL OFPPR_ADD OFPPR_DELETE OFPRR_DELETE
3463
3464 # Become slave (OF 1.2), which should disable everything except port status.
3465 ovs-appctl -t ovs-ofctl ofctl/send 031800180000000200000003000000000000000000000001
3466 check_async 4 OFPPR_ADD OFPPR_DELETE
3467
3468 # Use NXT_SET_ASYNC_CONFIG to enable a patchwork of asynchronous messages.
3469 ovs-appctl -t ovs-ofctl ofctl/send 03040028000000020000232000000013000000020000000500000005000000020000000200000005
3470 check_async 5 OFPR_INVALID_TTL OFPPR_DELETE OFPRR_DELETE
3471
3472 # Set controller ID 123.
3473 ovs-appctl -t ovs-ofctl ofctl/send 03040018000000030000232000000014000000000000007b
3474 check_async 6 OFPR_NO_MATCH OFPPR_DELETE OFPRR_DELETE
3475
3476 # Restore controller ID 0.
3477 ovs-appctl -t ovs-ofctl ofctl/send 030400180000000300002320000000140000000000000000
3478
3479 # Become master (OF 1.2).
3480 ovs-appctl -t ovs-ofctl ofctl/send 031800180000000400000002000000000000000000000002
3481 check_async 7 OFPR_ACTION OFPPR_ADD
3482
3483 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
3484 OVS_VSWITCHD_STOP
3485 AT_CLEANUP
3486
3487 AT_SETUP([ofproto - asynchronous message control (OpenFlow 1.3)])
3488 OVS_VSWITCHD_START([dnl
3489 add-port br0 p1 -- set Interface p1 type=dummy ofport_request=10
3490 ])
3491 AT_CHECK([ovs-ofctl -O OpenFlow13 -P standard monitor br0 --detach --no-chdir --pidfile])
3492 check_async () {
3493 printf '\n\n--- check_async %d ---\n\n\n' $1
3494 INDEX=$1
3495 shift
3496
3497 ovs-appctl -t ovs-ofctl ofctl/barrier
3498 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
3499 : > expout
3500
3501 # OFPT_PACKET_IN, OFPR_ACTION (controller_id=0)
3502 # OFPR_ACTION_SET is treated as OFPR_ACTION in OpenFlow 1.3
3503 ovs-ofctl -O OpenFlow13 -v packet-out br0 none controller '0001020304050010203040501234'
3504 ovs-ofctl -O OpenFlow13 add-flow br0 'in_port=10 actions=write_actions(output(CONTROLLER))'
3505 ovs-appctl netdev-dummy/receive p1 'in_port(10),eth(src=00:10:20:30:40:50,dst=00:01:02:03:04:05),eth_type(0x1234)'
3506 if test X"$1" = X"OFPR_ACTION"; then shift;
3507 echo >>expout "OFPT_PACKET_IN (OF1.3): total_len=14 in_port=ANY (via action) data_len=14 (unbuffered)
3508 vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1234"
3509 echo >>expout "OFPT_PACKET_IN (OF1.3): cookie=0x0 total_len=14 in_port=10 (via action) data_len=14 (unbuffered)
3510 vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1234"
3511 fi
3512
3513 # OFPT_PACKET_IN, OFPR_NO_MATCH (controller_id=123)
3514 ovs-ofctl -O OpenFlow13 -v packet-out br0 none 'controller(reason=no_match,id=123)' '0001020304050010203040501234'
3515 if test X"$1" = X"OFPR_NO_MATCH"; then shift;
3516 echo >>expout "OFPT_PACKET_IN (OF1.3): total_len=14 in_port=ANY (via no_match) data_len=14 (unbuffered)
3517 vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1234"
3518 fi
3519
3520 # OFPT_PACKET_IN, OFPR_INVALID_TTL (controller_id=0)
3521 ovs-ofctl -O OpenFlow13 packet-out br0 none dec_ttl '002583dfb4000026b98cb0f908004500003eb7e200000011339bac11370dac100002d7730035002b8f6d86fb0100000100000000000006626c702d7873066e696369726103636f6d00000f00'
3522 if test X"$1" = X"OFPR_INVALID_TTL"; then shift;
3523 echo >>expout "OFPT_PACKET_IN (OF1.3): total_len=76 in_port=ANY (via invalid_ttl) data_len=76 (unbuffered)
3524 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"
3525 fi
3526
3527 # OFPT_PORT_STATUS, OFPPR_ADD
3528 ovs-vsctl add-port br0 test -- set Interface test type=dummy
3529 if test X"$1" = X"OFPPR_ADD"; then shift;
3530 echo >>expout "OFPT_PORT_STATUS (OF1.3): ADD: ${INDEX}(test): addr:aa:55:aa:55:00:0x
3531 config: PORT_DOWN
3532 state: LINK_DOWN
3533 speed: 0 Mbps now, 0 Mbps max"
3534 fi
3535
3536 # OFPT_PORT_STATUS, OFPPR_DELETE
3537 ovs-vsctl del-port br0 test
3538 if test X"$1" = X"OFPPR_DELETE"; then shift;
3539 echo >>expout "OFPT_PORT_STATUS (OF1.3): DEL: ${INDEX}(test): addr:aa:55:aa:55:00:0x
3540 config: PORT_DOWN
3541 state: LINK_DOWN
3542 speed: 0 Mbps now, 0 Mbps max"
3543 fi
3544
3545 # OFPT_FLOW_REMOVED, OFPRR_DELETE
3546 ovs-ofctl -O OpenFlow13 add-flow br0 send_flow_rem,actions=drop
3547 ovs-ofctl -O OpenFlow13 --strict del-flows br0 ''
3548 if test X"$1" = X"OFPRR_DELETE"; then shift;
3549 echo >>expout "OFPT_FLOW_REMOVED (OF1.3): reason=delete table_id=0"
3550 fi
3551
3552 # OFPT_FLOW_REMOVED, OFPRR_GROUP_DELETE
3553 ovs-ofctl -O OpenFlow13 add-group br0 group_id=1234,type=all,bucket=output:10
3554 ovs-ofctl -O OpenFlow13 add-flow br0 send_flow_rem,actions=group:1234
3555 ovs-ofctl -O OpenFlow13 --strict del-groups br0 group_id=1234
3556 if test X"$1" = X"OFPRR_GROUP_DELETE"; then shift;
3557 echo >>expout "OFPT_FLOW_REMOVED (OF1.3): reason=group_delete table_id=0"
3558 fi
3559
3560 AT_FAIL_IF([test X"$1" != X])
3561
3562 OVS_WAIT_UNTIL([test `wc -l < "monitor.log"` -ge `wc -l < "expout"`])
3563
3564 AT_CHECK(
3565 [[sed '
3566 s/ (xid=0x[0-9a-fA-F]*)//
3567 s/ *duration.*//
3568 s/00:0.$/00:0x/' < monitor.log]],
3569 [0], [expout])
3570 }
3571
3572 # It's a service connection so initially there should be no async messages.
3573 check_async 1
3574
3575 # Set miss_send_len to 128, turning on packet-ins for our service connection.
3576 ovs-appctl -t ovs-ofctl ofctl/send 0409000c0123456700000080
3577 check_async 2 OFPR_ACTION OFPPR_ADD OFPPR_DELETE OFPRR_DELETE OFPRR_GROUP_DELETE
3578
3579 # Become slave (OF 1.3), which should disable everything except port status.
3580 ovs-appctl -t ovs-ofctl ofctl/send 041800180000000200000003000000000000000000000001
3581 check_async 3 OFPPR_ADD OFPPR_DELETE
3582
3583 # Use OF 1.3 OFPT_SET_ASYNC to enable a patchwork of asynchronous messages.
3584 ovs-appctl -t ovs-ofctl ofctl/send 041c00200000000200000002000000050000000500000002000000020000000d
3585 check_async 4 OFPR_INVALID_TTL OFPPR_DELETE OFPRR_DELETE OFPRR_GROUP_DELETE
3586
3587 # Set controller ID 123.
3588 ovs-appctl -t ovs-ofctl ofctl/send 04040018000000030000232000000014000000000000007b
3589 check_async 5 OFPR_NO_MATCH OFPPR_DELETE OFPRR_DELETE OFPRR_GROUP_DELETE
3590
3591 # Restore controller ID 0.
3592 ovs-appctl -t ovs-ofctl ofctl/send 040400180000000300002320000000140000000000000000
3593
3594 # Become master (OF 1.3).
3595 ovs-appctl -t ovs-ofctl ofctl/send 041800180000000400000002000000000000000000000002
3596 check_async 6 OFPR_ACTION OFPPR_ADD
3597
3598 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
3599 OVS_VSWITCHD_STOP
3600 AT_CLEANUP
3601
3602 AT_SETUP([ofproto - asynchronous message control (OpenFlow 1.4)])
3603 OVS_VSWITCHD_START([dnl
3604 add-port br0 p1 -- set Interface p1 type=dummy ofport_request=10
3605 ])
3606 AT_CHECK([ovs-ofctl -O OpenFlow14 -P standard monitor br0 --detach --no-chdir --pidfile])
3607 check_async () {
3608 printf '\n\n--- check_async %d ---\n\n\n' $1
3609 INDEX=$1
3610 shift
3611
3612 ovs-appctl -t ovs-ofctl ofctl/barrier
3613 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
3614 : > expout
3615
3616 # OFPT_PACKET_IN, OFPR_PACKET_OUT (controller_id=0)
3617 ovs-ofctl -O OpenFlow14 -v packet-out br0 none controller '0001020304050010203040501234'
3618 if test X"$1" = X"OFPR_PACKET_OUT"; then shift;
3619 echo >>expout "OFPT_PACKET_IN (OF1.4): total_len=14 in_port=ANY (via packet_out) data_len=14 (unbuffered)
3620 vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1234"
3621 fi
3622
3623 # OFPT_PACKET_IN, OFPR_ACTION_SET (controller_id=0)
3624 ovs-ofctl -O OpenFlow14 add-flow br0 'in_port=10 actions=write_actions(output(CONTROLLER))'
3625 ovs-appctl netdev-dummy/receive p1 'in_port(10),eth(src=00:10:20:30:40:50,dst=00:01:02:03:04:05),eth_type(0x1234)'
3626 if test X"$1" = X"OFPR_ACTION_SET"; then shift;
3627 echo >>expout "OFPT_PACKET_IN (OF1.4): cookie=0x0 total_len=14 in_port=10 (via action_set) data_len=14 (unbuffered)
3628 vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1234"
3629 fi
3630
3631 # OFPT_PACKET_IN, OFPR_NO_MATCH (controller_id=123)
3632 ovs-ofctl -O OpenFlow14 -v packet-out br0 none 'controller(reason=no_match,id=123)' '0001020304050010203040501234'
3633 if test X"$1" = X"OFPR_NO_MATCH"; then shift;
3634 echo >>expout "OFPT_PACKET_IN (OF1.4): total_len=14 in_port=ANY (via no_match) data_len=14 (unbuffered)
3635 vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1234"
3636 fi
3637
3638 # OFPT_PACKET_IN, OFPR_INVALID_TTL (controller_id=0)
3639 ovs-ofctl -O OpenFlow14 packet-out br0 none dec_ttl '002583dfb4000026b98cb0f908004500003eb7e200000011339bac11370dac100002d7730035002b8f6d86fb0100000100000000000006626c702d7873066e696369726103636f6d00000f00'
3640 if test X"$1" = X"OFPR_INVALID_TTL"; then shift;
3641 echo >>expout "OFPT_PACKET_IN (OF1.4): total_len=76 in_port=ANY (via invalid_ttl) data_len=76 (unbuffered)
3642 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"
3643 fi
3644
3645 # OFPT_PORT_STATUS, OFPPR_ADD
3646 ovs-vsctl add-port br0 test -- set Interface test type=dummy
3647 if test X"$1" = X"OFPPR_ADD"; then shift;
3648 echo >>expout "OFPT_PORT_STATUS (OF1.4): ADD: ${INDEX}(test): addr:aa:55:aa:55:00:0x
3649 config: PORT_DOWN
3650 state: LINK_DOWN
3651 speed: 0 Mbps now, 0 Mbps max"
3652 fi
3653
3654 # OFPT_PORT_STATUS, OFPPR_MODIFY
3655 ovs-ofctl -O OpenFlow14 -vwarn mod-port br0 test up
3656 if test X"$1" = X"OFPPR_MODIFY"; then shift;
3657 echo >>expout "OFPT_PORT_STATUS (OF1.4): MOD: ${INDEX}(test): addr:aa:55:aa:55:00:0x
3658 config: 0
3659 state: LINK_DOWN
3660 speed: 0 Mbps now, 0 Mbps max
3661 OFPT_PORT_STATUS (OF1.4): MOD: ${INDEX}(test): addr:aa:55:aa:55:00:0x
3662 config: 0
3663 state: LIVE
3664 speed: 0 Mbps now, 0 Mbps max"
3665 fi
3666
3667 # OFPT_PORT_STATUS, OFPPR_DELETE
3668 ovs-vsctl del-port br0 test
3669 if test X"$1" = X"OFPPR_DELETE"; then shift;
3670 echo >>expout "OFPT_PORT_STATUS (OF1.4): DEL: ${INDEX}(test): addr:aa:55:aa:55:00:0x
3671 config: 0
3672 state: LIVE
3673 speed: 0 Mbps now, 0 Mbps max"
3674 fi
3675
3676 # OFPT_FLOW_REMOVED, OFPRR_DELETE
3677 ovs-ofctl -O OpenFlow14 add-flow br0 send_flow_rem,actions=drop
3678 ovs-ofctl -O OpenFlow14 --strict del-flows br0 ''
3679 if test X"$1" = X"OFPRR_DELETE"; then shift;
3680 echo >>expout "OFPT_FLOW_REMOVED (OF1.4): reason=delete table_id=0"
3681 fi
3682
3683 # OFPT_FLOW_REMOVED, OFPRR_GROUP_DELETE
3684 ovs-ofctl -O OpenFlow14 add-group br0 group_id=1234,type=all,bucket=output:10
3685 ovs-ofctl -O OpenFlow14 add-flow br0 send_flow_rem,actions=group:1234
3686 ovs-ofctl -O OpenFlow14 --strict del-groups br0 group_id=1234
3687 if test X"$1" = X"OFPRR_GROUP_DELETE"; then shift;
3688 echo >>expout "OFPT_FLOW_REMOVED (OF1.4): reason=group_delete table_id=0"
3689 fi
3690
3691 # OFPT_TABLE_STATUS, OFPTR_VACANCY_UP
3692 if test X"$1" = X"OFPTR_VACANCY_UP"; then shift;
3693 ovs-vsctl -- --id=@t1 create Flow_Table flow-limit=10 -- set bridge br0 flow_tables:1=@t1
3694
3695 # Turn on vacancy events, then add flows until we're full.
3696 # With initial vacancy of 100% and vacancy_up of 80%, so that
3697 # vacancy >= vacancy_up, this enables VACANY_DOWN events, so
3698 # we get a single such message when vacancy dips below 20%.
3699 ovs-ofctl -O OpenFlow14 mod-table br0 1 vacancy:20,80
3700 ovs-ofctl -O OpenFlow14 add-flow br0 table=1,in_port=1,actions=2
3701 ovs-ofctl -O OpenFlow14 add-flow br0 table=1,in_port=2,actions=2
3702 ovs-ofctl -O OpenFlow14 add-flow br0 table=1,in_port=3,actions=2
3703 ovs-ofctl -O OpenFlow14 add-flow br0 table=1,in_port=4,actions=2
3704 ovs-ofctl -O OpenFlow14 add-flow br0 table=1,in_port=5,actions=2
3705 ovs-ofctl -O OpenFlow14 add-flow br0 table=1,in_port=6,actions=2
3706 ovs-ofctl -O OpenFlow14 add-flow br0 table=1,in_port=7,actions=2
3707 ovs-ofctl -O OpenFlow14 add-flow br0 table=1,in_port=8,actions=2
3708 ovs-ofctl -O OpenFlow14 add-flow br0 table=1,in_port=9,actions=2
3709 ovs-ofctl -O OpenFlow14 add-flow br0 table=1,in_port=10,actions=2
3710 echo >>expout "OFPT_TABLE_STATUS (OF1.4): reason=VACANCY_DOWN
3711 table_desc:-
3712 table 1:
3713 eviction=off eviction_flags=OTHER|IMPORTANCE|LIFETIME
3714 vacancy=on vacancy_down=20% vacancy_up=80% vacancy=10%"
3715 # Then delete flows until we're empty. Sending the
3716 # VACANCY_DOWN message enabled VACANCY_UP events, so we get a
3717 # single such message when vacancy rises above 80%.
3718 ovs-ofctl -O OpenFlow14 del-flows br0 table=1,in_port=1
3719 ovs-ofctl -O OpenFlow14 del-flows br0 table=1,in_port=2
3720 ovs-ofctl -O OpenFlow14 del-flows br0 table=1,in_port=3
3721 ovs-ofctl -O OpenFlow14 del-flows br0 table=1,in_port=4
3722 ovs-ofctl -O OpenFlow14 del-flows br0 table=1,in_port=5
3723 ovs-ofctl -O OpenFlow14 del-flows br0 table=1,in_port=6
3724 ovs-ofctl -O OpenFlow14 del-flows br0 table=1,in_port=7
3725 ovs-ofctl -O OpenFlow14 del-flows br0 table=1,in_port=8
3726 ovs-ofctl -O OpenFlow14 del-flows br0 table=1,in_port=9
3727 ovs-ofctl -O OpenFlow14 del-flows br0 table=1,in_port=10
3728 echo >>expout "OFPT_TABLE_STATUS (OF1.4): reason=VACANCY_UP
3729 table_desc:-
3730 table 1:
3731 eviction=off eviction_flags=OTHER|IMPORTANCE|LIFETIME
3732 vacancy=on vacancy_down=20% vacancy_up=80% vacancy=90%"
3733
3734 # Now approach vacancy from the other direction. First
3735 # disable vacancy events. With initial vacancy of 70%, so
3736 # that vacancy < vacancy_up, this enables VACANCY_UP events.
3737 # That means that filling up the table generates no message,
3738 # but deleting all the flows generates VACANCY_UP at the point
3739 # vacancy rises above 80%.
3740 ovs-ofctl -O OpenFlow14 mod-table br0 1 novacancy
3741 ovs-ofctl -O OpenFlow14 add-flow br0 table=1,in_port=1,actions=2
3742 ovs-ofctl -O OpenFlow14 add-flow br0 table=1,in_port=2,actions=2
3743 ovs-ofctl -O OpenFlow14 add-flow br0 table=1,in_port=3,actions=2
3744 ovs-ofctl -O OpenFlow14 mod-table br0 1 vacancy:20,80
3745 ovs-ofctl -O OpenFlow14 add-flow br0 table=1,in_port=4,actions=2
3746 ovs-ofctl -O OpenFlow14 add-flow br0 table=1,in_port=5,actions=2
3747 ovs-ofctl -O OpenFlow14 add-flow br0 table=1,in_port=6,actions=2
3748 ovs-ofctl -O OpenFlow14 add-flow br0 table=1,in_port=7,actions=2
3749 ovs-ofctl -O OpenFlow14 add-flow br0 table=1,in_port=8,actions=2
3750 ovs-ofctl -O OpenFlow14 add-flow br0 table=1,in_port=9,actions=2
3751 ovs-ofctl -O OpenFlow14 add-flow br0 table=1,in_port=10,actions=2
3752 ovs-ofctl -O OpenFlow14 del-flows br0 table=1,in_port=1
3753 ovs-ofctl -O OpenFlow14 del-flows br0 table=1,in_port=2
3754 ovs-ofctl -O OpenFlow14 del-flows br0 table=1,in_port=3
3755 ovs-ofctl -O OpenFlow14 del-flows br0 table=1,in_port=4
3756 ovs-ofctl -O OpenFlow14 del-flows br0 table=1,in_port=5
3757 ovs-ofctl -O OpenFlow14 del-flows br0 table=1,in_port=6
3758 ovs-ofctl -O OpenFlow14 del-flows br0 table=1,in_port=7
3759 ovs-ofctl -O OpenFlow14 del-flows br0 table=1,in_port=8
3760 ovs-ofctl -O OpenFlow14 del-flows br0 table=1,in_port=9
3761 ovs-ofctl -O OpenFlow14 del-flows br0 table=1,in_port=10
3762 echo >>expout "OFPT_TABLE_STATUS (OF1.4): reason=VACANCY_UP
3763 table_desc:-
3764 table 1:
3765 eviction=off eviction_flags=OTHER|IMPORTANCE|LIFETIME
3766 vacancy=on vacancy_down=20% vacancy_up=80% vacancy=90%"
3767 fi
3768
3769 AT_FAIL_IF([test X"$1" != X])
3770
3771 OVS_WAIT_UNTIL([test `wc -l < "monitor.log"` -ge `wc -l < "expout"`])
3772
3773 AT_CHECK(
3774 [[sed '
3775 s/ (xid=0x[0-9a-fA-F]*)//
3776 s/ *duration.*//
3777 s/00:0.$/00:0x/' < monitor.log]],
3778 [0], [expout])
3779 }
3780
3781 # It's a service connection so initially there should be no async messages.
3782 check_async 1
3783
3784 # Set miss_send_len to 128, turning on packet-ins for our service connection.
3785 ovs-appctl -t ovs-ofctl ofctl/send 0509000c0123456700000080
3786 check_async 2 OFPR_PACKET_OUT OFPR_ACTION_SET OFPPR_ADD OFPPR_MODIFY OFPPR_DELETE OFPRR_DELETE OFPRR_GROUP_DELETE
3787
3788 # Become slave (OF 1.4), which should disable everything except port status.
3789 ovs-appctl -t ovs-ofctl ofctl/send 051800180000000200000003000000000000000000000001
3790 check_async 3 OFPPR_ADD OFPPR_MODIFY OFPPR_DELETE
3791
3792 # Use OF 1.4 OFPT_SET_ASYNC to enable a patchwork of asynchronous messages.
3793 ovs-appctl -t ovs-ofctl ofctl/send 051c0040000000020000000800000005000100080000002000020008000000020003000800000005000400080000001c00050008000000050008000800000018
3794 check_async 4 OFPR_INVALID_TTL OFPPR_DELETE OFPRR_DELETE OFPRR_GROUP_DELETE OFPTR_VACANCY_UP
3795
3796 # Set controller ID 123.
3797 ovs-appctl -t ovs-ofctl ofctl/send 05040018000000030000232000000014000000000000007b
3798 check_async 5 OFPR_NO_MATCH OFPPR_DELETE OFPRR_DELETE OFPRR_GROUP_DELETE
3799
3800 # Restore controller ID 0.
3801 ovs-appctl -t ovs-ofctl ofctl/send 050400180000000300002320000000140000000000000000
3802
3803 # Become master (OF 1.4).
3804 ovs-appctl -t ovs-ofctl ofctl/send 051800180000000400000002000000000000000000000002
3805 check_async 6 OFPR_PACKET_OUT OFPPR_ADD OFPPR_MODIFY OFPRR_DELETE
3806
3807 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
3808 OVS_VSWITCHD_STOP
3809 AT_CLEANUP
3810
3811 AT_SETUP([ofproto - asynchronous message control (OpenFlow 1.5)])
3812 OVS_VSWITCHD_START
3813 AT_CHECK([ovs-ofctl -O OpenFlow15 -P standard monitor br0 --detach --no-chdir --pidfile])
3814 check_async () {
3815 printf '\n\n--- check_async %d ---\n\n\n' $1
3816 INDEX=$1
3817 shift
3818
3819 ovs-appctl -t ovs-ofctl ofctl/barrier
3820 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
3821 : > expout
3822
3823 # Other tests are not working with OF 1.5, and message
3824 # format may change, so leave them out.
3825
3826 # OFPT_PORT_STATUS, OFPPR_ADD
3827 ovs-vsctl add-port br0 test -- set Interface test type=dummy
3828 if test X"$1" = X"OFPPR_ADD"; then shift;
3829 echo >>expout "OFPT_PORT_STATUS (OF1.5): ADD: ${INDEX}(test): addr:aa:55:aa:55:00:0x
3830 config: PORT_DOWN
3831 state: LINK_DOWN
3832 speed: 0 Mbps now, 0 Mbps max"
3833 fi
3834
3835 # OFPT_PORT_STATUS, OFPPR_MODIFY
3836 ovs-ofctl -O OpenFlow15 -vwarn mod-port br0 test up
3837 if test X"$1" = X"OFPPR_MODIFY"; then shift;
3838 echo >>expout "OFPT_PORT_STATUS (OF1.5): MOD: ${INDEX}(test): addr:aa:55:aa:55:00:0x
3839 config: 0
3840 state: LINK_DOWN
3841 speed: 0 Mbps now, 0 Mbps max
3842 OFPT_PORT_STATUS (OF1.5): MOD: 2(test): addr:aa:55:aa:55:00:0x
3843 config: 0
3844 state: LIVE
3845 speed: 0 Mbps now, 0 Mbps max"
3846 fi
3847
3848 # OFPT_PORT_STATUS, OFPPR_DELETE
3849 ovs-vsctl del-port br0 test
3850 if test X"$1" = X"OFPPR_DELETE"; then shift;
3851 echo >>expout "OFPT_PORT_STATUS (OF1.5): DEL: ${INDEX}(test): addr:aa:55:aa:55:00:0x
3852 config: 0
3853 state: LIVE
3854 speed: 0 Mbps now, 0 Mbps max"
3855 fi
3856
3857 AT_FAIL_IF([test X"$1" != X])
3858
3859 OVS_WAIT_UNTIL([test `wc -l < "monitor.log"` -ge `wc -l < "expout"`])
3860
3861 AT_CHECK(
3862 [[sed '
3863 s/ (xid=0x[0-9a-fA-F]*)//
3864 s/ *duration.*//
3865 s/00:0.$/00:0x/' < monitor.log]],
3866 [0], [expout])
3867 }
3868
3869 # It's a service connection so initially there should be no async messages.
3870 check_async 1
3871
3872 # If we don't set this, async messages are not received.
3873 # Set miss_send_len to 128, turning on packet-ins for our service connection.
3874 ovs-appctl -t ovs-ofctl ofctl/send 0609000c0123456700000080
3875 check_async 2 OFPPR_ADD OFPPR_MODIFY OFPPR_DELETE
3876
3877 # Set-async has changed in OF 1.4 and is not yet implemented.
3878
3879 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
3880 OVS_VSWITCHD_STOP
3881 AT_CLEANUP
3882
3883 dnl This test checks that the role request/response messaging works
3884 dnl and that generation_id is handled properly.
3885 AT_SETUP([ofproto - controller role (OpenFlow 1.2)])
3886 OVS_VSWITCHD_START
3887 on_exit 'kill `cat c1.pid c2.pid`'
3888
3889 # Start two ovs-ofctl controller processes.
3890 AT_CAPTURE_FILE([monitor1.log])
3891 AT_CAPTURE_FILE([expout1])
3892 AT_CAPTURE_FILE([experr1])
3893 AT_CAPTURE_FILE([monitor2.log])
3894 AT_CAPTURE_FILE([expout2])
3895 AT_CAPTURE_FILE([experr2])
3896 for i in 1 2; do
3897 AT_CHECK([ovs-ofctl -O OpenFlow12 monitor br0 --detach --no-chdir --pidfile=c$i.pid --unixctl=c$i])
3898 ovs-appctl -t `pwd`/c$i ofctl/barrier
3899 ovs-appctl -t `pwd`/c$i ofctl/set-output-file monitor$i.log
3900 : > expout$i
3901 : > experr$i
3902
3903 # find out current role
3904 ovs-appctl -t `pwd`/c$i ofctl/send 031800180000000200000000000000000000000000000000
3905 echo >>experr$i "send: OFPT_ROLE_REQUEST (OF1.2): role=nochange"
3906 echo >>expout$i "OFPT_ROLE_REPLY (OF1.2): role=equal"
3907 done
3908
3909 # controller 1: Become slave (generation_id is initially undefined, so
3910 # 2^63+2 should not be stale)
3911 ovs-appctl -t `pwd`/c1 ofctl/send 031800180000000300000003000000008000000000000002
3912 echo >>experr1 "send: OFPT_ROLE_REQUEST (OF1.2): role=slave generation_id=9223372036854775810"
3913 echo >>expout1 "OFPT_ROLE_REPLY (OF1.2): role=slave generation_id=9223372036854775810"
3914
3915 # controller 2: Become master.
3916 ovs-appctl -t `pwd`/c2 ofctl/send 031800180000000300000002000000008000000000000003
3917 echo >>experr2 "send: OFPT_ROLE_REQUEST (OF1.2): role=master generation_id=9223372036854775811"
3918 echo >>expout2 "OFPT_ROLE_REPLY (OF1.2): role=master generation_id=9223372036854775811"
3919
3920 # controller 1: Try to become the master using a stale generation ID
3921 ovs-appctl -t `pwd`/c1 ofctl/send 031800180000000400000002000000000000000000000003
3922 echo >>experr1 "send: OFPT_ROLE_REQUEST (OF1.2): role=master generation_id=3"
3923 echo >>expout1 "OFPT_ERROR (OF1.2): OFPRRFC_STALE"
3924 echo >>expout1 "OFPT_ROLE_REQUEST (OF1.2): role=master generation_id=3"
3925
3926 # controller 1: Become master using a valid generation ID
3927 ovs-appctl -t `pwd`/c1 ofctl/send 031800180000000500000002000000000000000000000001
3928 echo >>experr1 "send: OFPT_ROLE_REQUEST (OF1.2): role=master generation_id=1"
3929 echo >>expout1 "OFPT_ROLE_REPLY (OF1.2): role=master generation_id=1"
3930
3931 for i in 1 2; do
3932 ovs-appctl -t `pwd`/c$i ofctl/barrier
3933 echo >>expout$i "OFPT_BARRIER_REPLY (OF1.2):"
3934 done
3935
3936 # Check output.
3937 for i in 1 2; do
3938 cp expout$i expout
3939 AT_CHECK([grep -v '^send:' monitor$i.log | strip_xids], [0], [expout])
3940 cp experr$i expout
3941 AT_CHECK([grep '^send:' monitor$i.log | strip_xids], [0], [expout])
3942 done
3943 OVS_VSWITCHD_STOP
3944 AT_CLEANUP
3945
3946 dnl This test checks that the role request/response messaging works,
3947 dnl that generation_id is handled properly, and that role status update
3948 dnl messages are sent when a controller's role gets changed from master
3949 dnl to slave.
3950 AT_SETUP([ofproto - controller role (OpenFlow 1.4)])
3951 OVS_VSWITCHD_START
3952 on_exit 'kill `cat c1.pid c2.pid`'
3953
3954 # Start two ovs-ofctl controller processes.
3955 AT_CAPTURE_FILE([monitor1.log])
3956 AT_CAPTURE_FILE([expout1])
3957 AT_CAPTURE_FILE([experr1])
3958 AT_CAPTURE_FILE([monitor2.log])
3959 AT_CAPTURE_FILE([expout2])
3960 AT_CAPTURE_FILE([experr2])
3961 for i in 1 2; do
3962 AT_CHECK([ovs-ofctl -O OpenFlow14 monitor br0 --detach --no-chdir --pidfile=c$i.pid --unixctl=c$i])
3963 ovs-appctl -t `pwd`/c$i ofctl/barrier
3964 ovs-appctl -t `pwd`/c$i ofctl/set-output-file monitor$i.log
3965 : > expout$i
3966 : > experr$i
3967
3968 # find out current role
3969 ovs-appctl -t `pwd`/c$i ofctl/send 051800180000000200000000000000000000000000000000
3970 echo >>experr$i "send: OFPT_ROLE_REQUEST (OF1.4): role=nochange"
3971 echo >>expout$i "OFPT_ROLE_REPLY (OF1.4): role=equal"
3972 done
3973
3974 # controller 1: Become slave (generation_id is initially undefined, so
3975 # 2^63+2 should not be stale)
3976 ovs-appctl -t `pwd`/c1 ofctl/send 051800180000000300000003000000008000000000000002
3977 echo >>experr1 "send: OFPT_ROLE_REQUEST (OF1.4): role=slave generation_id=9223372036854775810"
3978 echo >>expout1 "OFPT_ROLE_REPLY (OF1.4): role=slave generation_id=9223372036854775810"
3979
3980 # controller 2: Become master.
3981 ovs-appctl -t `pwd`/c2 ofctl/send 051800180000000300000002000000008000000000000003
3982 echo >>experr2 "send: OFPT_ROLE_REQUEST (OF1.4): role=master generation_id=9223372036854775811"
3983 echo >>expout2 "OFPT_ROLE_REPLY (OF1.4): role=master generation_id=9223372036854775811"
3984
3985 # controller 1: Try to become the master using a stale generation ID
3986 ovs-appctl -t `pwd`/c1 ofctl/send 051800180000000400000002000000000000000000000003
3987 echo >>experr1 "send: OFPT_ROLE_REQUEST (OF1.4): role=master generation_id=3"
3988 echo >>expout1 "OFPT_ERROR (OF1.4): OFPRRFC_STALE"
3989 echo >>expout1 "OFPT_ROLE_REQUEST (OF1.4): role=master generation_id=3"
3990
3991 # controller 1: Become master using a valid generation ID
3992 ovs-appctl -t `pwd`/c1 ofctl/send 051800180000000500000002000000000000000000000001
3993 echo >>experr1 "send: OFPT_ROLE_REQUEST (OF1.4): role=master generation_id=1"
3994 echo >>expout1 "OFPT_ROLE_REPLY (OF1.4): role=master generation_id=1"
3995 echo >>expout2 "OFPT_ROLE_STATUS (OF1.4): role=slave generation_id=1 reason=master_request"
3996
3997 for i in 1 2; do
3998 ovs-appctl -t `pwd`/c$i ofctl/barrier
3999 echo >>expout$i "OFPT_BARRIER_REPLY (OF1.4):"
4000 done
4001
4002 # Check output.
4003 for i in 1 2; do
4004 cp expout$i expout
4005 AT_CHECK([grep -v '^send:' monitor$i.log | strip_xids], [0], [expout])
4006 cp experr$i expout
4007 AT_CHECK([grep '^send:' monitor$i.log | strip_xids], [0], [expout])
4008 done
4009 OVS_VSWITCHD_STOP
4010 AT_CLEANUP
4011
4012 dnl This test checks that the role request/response messaging works,
4013 dnl that generation_id is handled properly, and that role status update
4014 dnl messages are sent when a controller's role gets changed from master
4015 dnl to slave.
4016 AT_SETUP([ofproto - controller role (OpenFlow 1.3)])
4017 OVS_VSWITCHD_START
4018 on_exit 'kill `cat c1.pid c2.pid`'
4019
4020 # Start two ovs-ofctl controller processes.
4021 AT_CAPTURE_FILE([monitor1.log])
4022 AT_CAPTURE_FILE([expout1])
4023 AT_CAPTURE_FILE([experr1])
4024 AT_CAPTURE_FILE([monitor2.log])
4025 AT_CAPTURE_FILE([expout2])
4026 AT_CAPTURE_FILE([experr2])
4027 for i in 1 2; do
4028 AT_CHECK([ovs-ofctl -O OpenFlow13 monitor br0 --detach --no-chdir --pidfile=c$i.pid --unixctl=c$i])
4029 ovs-appctl -t `pwd`/c$i ofctl/barrier
4030 ovs-appctl -t `pwd`/c$i ofctl/set-output-file monitor$i.log
4031 : > expout$i
4032 : > experr$i
4033
4034 # find out current role
4035 ovs-appctl -t `pwd`/c$i ofctl/send 041800180000000200000000000000000000000000000000
4036 echo >>experr$i "send: OFPT_ROLE_REQUEST (OF1.3): role=nochange"
4037 echo >>expout$i "OFPT_ROLE_REPLY (OF1.3): role=equal"
4038 done
4039
4040 # controller 1: Become slave (generation_id is initially undefined, so
4041 # 2^63+2 should not be stale)
4042 ovs-appctl -t `pwd`/c1 ofctl/send 041800180000000300000003000000008000000000000002
4043 echo >>experr1 "send: OFPT_ROLE_REQUEST (OF1.3): role=slave generation_id=9223372036854775810"
4044 echo >>expout1 "OFPT_ROLE_REPLY (OF1.3): role=slave generation_id=9223372036854775810"
4045
4046 # controller 2: Become master.
4047 ovs-appctl -t `pwd`/c2 ofctl/send 041800180000000300000002000000008000000000000003
4048 echo >>experr2 "send: OFPT_ROLE_REQUEST (OF1.3): role=master generation_id=9223372036854775811"
4049 echo >>expout2 "OFPT_ROLE_REPLY (OF1.3): role=master generation_id=9223372036854775811"
4050
4051 # controller 1: Try to become the master using a stale generation ID
4052 ovs-appctl -t `pwd`/c1 ofctl/send 041800180000000400000002000000000000000000000003
4053 echo >>experr1 "send: OFPT_ROLE_REQUEST (OF1.3): role=master generation_id=3"
4054 echo >>expout1 "OFPT_ERROR (OF1.3): OFPRRFC_STALE"
4055 echo >>expout1 "OFPT_ROLE_REQUEST (OF1.3): role=master generation_id=3"
4056
4057 # controller 1: Become master using a valid generation ID
4058 ovs-appctl -t `pwd`/c1 ofctl/send 041800180000000500000002000000000000000000000001
4059 echo >>experr1 "send: OFPT_ROLE_REQUEST (OF1.3): role=master generation_id=1"
4060 echo >>expout1 "OFPT_ROLE_REPLY (OF1.3): role=master generation_id=1"
4061 echo >>expout2 "ONFT_ROLE_STATUS (OF1.3): role=slave generation_id=1 reason=master_request"
4062
4063 for i in 1 2; do
4064 ovs-appctl -t `pwd`/c$i ofctl/barrier
4065 echo >>expout$i "OFPT_BARRIER_REPLY (OF1.3):"
4066 done
4067
4068 # Check output.
4069 for i in 1 2; do
4070 cp expout$i expout
4071 AT_CHECK([grep -v '^send:' monitor$i.log | strip_xids], [0], [expout])
4072 cp experr$i expout
4073 AT_CHECK([grep '^send:' monitor$i.log | strip_xids], [0], [expout])
4074 done
4075 OVS_VSWITCHD_STOP
4076 AT_CLEANUP
4077
4078 dnl This test checks the Group and meter notifications when a group mod
4079 dnl command is sent from one controller and the reply is received by
4080 dnl other controllers.
4081 AT_SETUP([ofproto - requestforward (OpenFlow 1.4)])
4082 OVS_VSWITCHD_START
4083 on_exit 'kill `cat c1.pid c2.pid c3.pid`'
4084
4085 # Start two ovs-ofctl controller processes.
4086 AT_CAPTURE_FILE([monitor1.log])
4087 AT_CAPTURE_FILE([expout1])
4088 AT_CAPTURE_FILE([monitor2.log])
4089 AT_CAPTURE_FILE([expout2])
4090 AT_CAPTURE_FILE([monitor3.log])
4091 AT_CAPTURE_FILE([expout3])
4092
4093 ovs-ofctl -O OpenFlow15 monitor br0 --detach --no-chdir --pidfile=c1.pid --unixctl=c1
4094 ovs-ofctl -O OpenFlow14 monitor br0 --detach --no-chdir --pidfile=c2.pid --unixctl=c2
4095 ovs-ofctl -O OpenFlow14 monitor br0 --detach --no-chdir --pidfile=c3.pid --unixctl=c3
4096
4097 check_async () {
4098 for i in 1 3; do
4099 ovs-appctl -t `pwd`/c$i ofctl/barrier
4100 ovs-appctl -t `pwd`/c$i ofctl/set-output-file monitor$i.log
4101 : > expout$i
4102 done
4103
4104 printf '\n\n--- check_async %d ---\n\n\n' $1
4105 INDEX=$1
4106 shift
4107
4108 # OFPGC_ADD
4109 ovs-appctl -t `pwd`/c2 ofctl/send "050f0020000000020000000000000001 00100000 ffffffffffffffff 00000000"
4110 if test X"$1" = X"OFPGC_ADD"; then shift;
4111 echo >>expout2 "send: OFPT_GROUP_MOD (OF1.4):
4112 ADD group_id=1,type=all,bucket=actions=drop"
4113 echo >>expout1 "OFPT_REQUESTFORWARD (OF1.5): reason=group_mod
4114 ADD group_id=1,type=all,bucket=bucket_id:0,actions=drop"
4115 echo >>expout3 "OFPT_REQUESTFORWARD (OF1.4): reason=group_mod
4116 ADD group_id=1,type=all,bucket=actions=drop"
4117 fi
4118
4119 # OFPGC_MODIFY
4120 ovs-appctl -t `pwd`/c2 ofctl/send "050f0020000000020001010000000001 00100000 ffffffffffffffff 00000000"
4121 if test X"$1" = X"OFPGC_MODIFY"; then shift;
4122 echo >>expout2 "send: OFPT_GROUP_MOD (OF1.4):
4123 MOD group_id=1,type=select,bucket=weight:0,actions=drop"
4124 echo >>expout1 "OFPT_REQUESTFORWARD (OF1.5): reason=group_mod
4125 MOD group_id=1,type=select,bucket=bucket_id:0,weight:0,actions=drop"
4126 echo >>expout3 "OFPT_REQUESTFORWARD (OF1.4): reason=group_mod
4127 MOD group_id=1,type=select,bucket=weight:0,actions=drop"
4128 fi
4129
4130 ovs-appctl -t `pwd`/c1 ofctl/barrier
4131 echo >>expout1 "OFPT_BARRIER_REPLY (OF1.5):"
4132 ovs-appctl -t `pwd`/c2 ofctl/barrier
4133 echo >>expout2 "OFPT_BARRIER_REPLY (OF1.4):"
4134 ovs-appctl -t `pwd`/c3 ofctl/barrier
4135 echo >>expout3 "OFPT_BARRIER_REPLY (OF1.4):"
4136
4137 # Check output.
4138 for i in 1 3; do
4139 cp expout$i expout
4140 AT_CHECK(
4141 [[sed '
4142 s/ (xid=0x[0-9a-fA-F]*)//'< monitor$i.log]],
4143 [0], [expout])
4144 done
4145 }
4146
4147 # controller 1: Become slave
4148 ovs-appctl -t `pwd`/c1 ofctl/send 061800180000000300000003000000008000000000000002
4149
4150 # controller 2: Become master
4151 ovs-appctl -t `pwd`/c2 ofctl/send 051800180000000300000002000000008000000000000003
4152
4153 # controller 1: Become slave
4154 ovs-appctl -t `pwd`/c3 ofctl/send 051800180000000300000003000000008000000000000004
4155
4156 # controller 1: Enabled requestforward using set Asynchronous message
4157 ovs-appctl -t `pwd`/c1 ofctl/send 061c00280000000200000008000000050002000800000002000400080000001a000a000800000003
4158
4159 # controller 2: Enabled requestforward using set Asynchronous message
4160 ovs-appctl -t `pwd`/c2 ofctl/send 051c002800000002000100080000000200030008000000050005000800000005000b000800000003
4161
4162 # controller 1: Enabled requestforward using set Asynchronous message
4163 ovs-appctl -t `pwd`/c3 ofctl/send 051c00280000000200000008000000050002000800000002000400080000001a000a000800000003
4164 check_async 1 OFPGC_ADD OFPGC_MODIFY
4165
4166 OVS_VSWITCHD_STOP
4167 AT_CLEANUP
4168
4169 dnl This test checks that OFPT_PACKET_OUT accepts both OFPP_NONE (as
4170 dnl specified by OpenFlow 1.0) and OFPP_CONTROLLER (used by some
4171 dnl controllers despite the spec) as meaning a packet that was generated
4172 dnl by the controller.
4173 AT_SETUP([ofproto - packet-out from controller (OpenFlow 1.0)])
4174 OVS_VSWITCHD_START
4175 add_of_ports br0 1
4176
4177 # Start a monitor listening for packet-ins.
4178 AT_CHECK([ovs-ofctl -P standard monitor br0 --detach --no-chdir --pidfile])
4179 ovs-appctl -t ovs-ofctl ofctl/send 0109000c0123456700000080
4180 ovs-appctl -t ovs-ofctl ofctl/barrier
4181 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
4182 AT_CAPTURE_FILE([monitor.log])
4183
4184 # Send some packet-outs with OFPP_NONE and OFPP_CONTROLLER (65533) as in_port.
4185 AT_CHECK([ovs-ofctl packet-out br0 "in_port=none packet=0001020304050010203040501234 actions=controller,1"])
4186 AT_CHECK([ovs-ofctl packet-out br0 "in_port=controller packet=0001020304050010203040505678 actions=controller,1"])
4187
4188 # Stop the monitor and check its output.
4189 ovs-appctl -t ovs-ofctl ofctl/barrier
4190 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
4191
4192 ovs-ofctl dump-ports br0
4193
4194 AT_CHECK([sed 's/ (xid=0x[[0-9a-fA-F]]*)//' monitor.log], [0], [dnl
4195 OFPT_PACKET_IN: total_len=14 in_port=ANY (via action) data_len=14 (unbuffered)
4196 vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1234
4197 OFPT_PACKET_IN: total_len=14 in_port=CONTROLLER (via action) data_len=14 (unbuffered)
4198 vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x5678
4199 OFPT_BARRIER_REPLY:
4200 ])
4201
4202 OVS_VSWITCHD_STOP
4203 AT_CLEANUP
4204
4205 dnl This test checks that OFPT_PACKET_OUT accepts both OFPP_NONE (as
4206 dnl specified by OpenFlow 1.2) and OFPP_CONTROLLER (used by some
4207 dnl controllers despite the spec) as meaning a packet that was generated
4208 dnl by the controller.
4209 AT_SETUP([ofproto - packet-out from controller (OpenFlow 1.2)])
4210 OVS_VSWITCHD_START
4211
4212 # Start a monitor listening for packet-ins.
4213 AT_CHECK([ovs-ofctl -O OpenFlow12 -P standard monitor br0 --detach --no-chdir --pidfile])
4214 ovs-appctl -t ovs-ofctl ofctl/send 0309000c0123456700000080
4215 ovs-appctl -t ovs-ofctl ofctl/barrier
4216 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
4217 AT_CAPTURE_FILE([monitor.log])
4218
4219 # Send some packet-outs with OFPP_NONE and OFPP_CONTROLLER (65533) as in_port.
4220 AT_CHECK([ovs-ofctl -O OpenFlow12 packet-out br0 none controller '0001020304050010203040501234'])
4221 AT_CHECK([ovs-ofctl -O OpenFlow12 packet-out br0 4294967293 controller '0001020304050010203040505678'])
4222
4223 # Stop the monitor and check its output.
4224 ovs-appctl -t ovs-ofctl ofctl/barrier
4225 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
4226
4227 AT_CHECK([sed 's/ (xid=0x[[0-9a-fA-F]]*)//' monitor.log], [0], [dnl
4228 OFPT_PACKET_IN (OF1.2): total_len=14 in_port=ANY (via action) data_len=14 (unbuffered)
4229 vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1234
4230 OFPT_PACKET_IN (OF1.2): total_len=14 in_port=CONTROLLER (via action) data_len=14 (unbuffered)
4231 vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x5678
4232 OFPT_BARRIER_REPLY (OF1.2):
4233 ])
4234
4235 OVS_VSWITCHD_STOP
4236 AT_CLEANUP
4237
4238 dnl This test checks that OFPT_PACKET_OUT accepts both OFPP_NONE (as
4239 dnl specified by OpenFlow 1.1) and OFPP_CONTROLLER (used by some
4240 dnl controllers despite the spec) as meaning a packet that was generated
4241 dnl by the controller.
4242 AT_SETUP([ofproto - packet-out from controller (OpenFlow 1.1)])
4243 OVS_VSWITCHD_START
4244
4245 # Start a monitor listening for packet-ins.
4246 AT_CHECK([ovs-ofctl -O OpenFlow11 -P standard monitor br0 --detach --no-chdir --pidfile])
4247 ovs-appctl -t ovs-ofctl ofctl/send 0209000c0123456700000080
4248 ovs-appctl -t ovs-ofctl ofctl/barrier
4249 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
4250 AT_CAPTURE_FILE([monitor.log])
4251
4252 # Send some packet-outs with OFPP_NONE and OFPP_CONTROLLER as in_port.
4253 AT_CHECK([ovs-appctl -t ovs-ofctl ofctl/packet-out "in_port=none, packet=0001020304050010203040501234 actions=controller"])
4254 AT_CHECK([ovs-appctl -t ovs-ofctl ofctl/packet-out "in_port=controller packet=0001020304050010203040505678 actions=controller"])
4255
4256 # Stop the monitor and check its output.
4257 ovs-appctl -t ovs-ofctl ofctl/barrier
4258 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
4259
4260 AT_CHECK([sed 's/ (xid=0x[[0-9a-fA-F]]*)//
4261 /PACKET_OUT/d' monitor.log], [0], [dnl
4262 OFPT_PACKET_IN (OF1.1): total_len=14 in_port=ANY (via action) data_len=14 (unbuffered)
4263 vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1234
4264 OFPT_PACKET_IN (OF1.1): total_len=14 in_port=CONTROLLER (via action) data_len=14 (unbuffered)
4265 vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x5678
4266 OFPT_BARRIER_REPLY (OF1.1):
4267 ])
4268
4269 OVS_VSWITCHD_STOP
4270 AT_CLEANUP
4271
4272 AT_SETUP([ofproto - packet-out from controller (OpenFlow 1.5)])
4273 OVS_VSWITCHD_START
4274
4275 # Start a monitor listening for packet-ins.
4276 AT_CHECK([ovs-ofctl -O OpenFlow15 -P standard monitor br0 --detach --no-chdir --pidfile])
4277 ovs-appctl -t ovs-ofctl ofctl/send 0609000c0123456700000080
4278 ovs-appctl -t ovs-ofctl ofctl/barrier
4279 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
4280 AT_CAPTURE_FILE([monitor.log])
4281
4282 # Send some packet-outs with OFPP_NONE and OFPP_CONTROLLER (65533) as in_port.
4283 AT_CHECK([ovs-ofctl -O OpenFlow15 packet-out br0 "in_port=none tun_id=0x11 metadata=0x22 packet=0001020304050010203040501234 actions=controller"])
4284 AT_CHECK([ovs-ofctl -O OpenFlow15 packet-out br0 "in_port=controller tun_id=0x11 metadata=0x33 packet=0001020304050010203040505678 actions=controller"])
4285
4286 # Stop the monitor and check its output.
4287 ovs-appctl -t ovs-ofctl ofctl/barrier
4288 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
4289
4290 AT_CHECK([sed 's/ (xid=0x[[0-9a-fA-F]]*)//' monitor.log], [0], [dnl
4291 OFPT_PACKET_IN (OF1.5): total_len=14 tun_id=0x11,metadata=0x22,in_port=ANY (via packet_out) data_len=14 (unbuffered)
4292 vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1234
4293 OFPT_PACKET_IN (OF1.5): total_len=14 tun_id=0x11,metadata=0x33,in_port=CONTROLLER (via packet_out) data_len=14 (unbuffered)
4294 vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x5678
4295 OFPT_BARRIER_REPLY (OF1.5):
4296 ])
4297
4298 OVS_VSWITCHD_STOP
4299 AT_CLEANUP
4300
4301 dnl This test checks that metadata and userdata are encoded in NXT_PACKET_IN2.
4302 AT_SETUP([ofproto - packet-out with metadata and userdata (NXT_PACKET_IN2)])
4303 OVS_VSWITCHD_START
4304
4305 # Start a monitor listening for packet-ins.
4306 AT_CHECK([ovs-ofctl -P nxt_packet_in2 monitor br0 --detach --no-chdir --pidfile])
4307 ovs-appctl -t ovs-ofctl ofctl/send 0109000c0123456700000080
4308 ovs-appctl -t ovs-ofctl ofctl/barrier
4309 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
4310 AT_CAPTURE_FILE([monitor.log])
4311
4312 # Send a packet-out with a load action to set some metadata, and forward to controller
4313 AT_CHECK([ovs-ofctl packet-out br0 "in_port=controller packet=0001020304050010203040501234 actions=load(0xfafafafa5a5a5a5a->OXM_OF_METADATA[[0..63]]),load(0xaa->NXM_NX_PKT_MARK[[]]),controller(userdata=01.02.03.04.05)"])
4314
4315 # Stop the monitor and check its output.
4316 ovs-appctl -t ovs-ofctl ofctl/barrier
4317 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
4318
4319 AT_CHECK([sed 's/ (xid=0x[[0-9a-fA-F]]*)//' monitor.log], [0], [dnl
4320 NXT_PACKET_IN2: total_len=14 pkt_mark=0xaa,metadata=0xfafafafa5a5a5a5a,in_port=CONTROLLER (via action) data_len=14 (unbuffered)
4321 userdata=01.02.03.04.05
4322 vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1234
4323 OFPT_BARRIER_REPLY:
4324 ])
4325
4326 OVS_VSWITCHD_STOP
4327 AT_CLEANUP
4328
4329 dnl This test checks that 1.5 packet_out is properly encoded/decoded.
4330 AT_SETUP([ofproto - packet-out with set_field metadata (OpenFlow 1.5)])
4331 OVS_VSWITCHD_START
4332
4333 # Start a monitor listening for packet-ins.
4334 AT_CHECK([ovs-ofctl -P standard -O OpenFlow13 monitor br0 --detach --no-chdir --pidfile])
4335 ovs-appctl -t ovs-ofctl ofctl/send 0409000c0123456700000080
4336 ovs-appctl -t ovs-ofctl ofctl/barrier
4337 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
4338 AT_CAPTURE_FILE([monitor.log])
4339
4340 # Send a packet-out with a couple of set-field action to set some metadata, and forward to controller
4341 AT_CHECK([ovs-ofctl -O OpenFlow15 packet-out br0 CONTROLLER 'set_field:0xfafafafa5a5a5a5a->metadata, controller' '0001020304050010203040501234'])
4342
4343 # Stop the monitor and check its output.
4344 ovs-appctl -t ovs-ofctl ofctl/barrier
4345 ovs-appctl -t ovs-ofctl exit
4346
4347 AT_CHECK([sed 's/ (xid=0x[[0-9a-fA-F]]*)//' monitor.log], [0], [dnl
4348 OFPT_PACKET_IN (OF1.3): total_len=14 metadata=0xfafafafa5a5a5a5a,in_port=CONTROLLER (via action) data_len=14 (unbuffered)
4349 vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1234
4350 OFPT_BARRIER_REPLY (OF1.3):
4351 ])
4352
4353 OVS_VSWITCHD_STOP
4354 AT_CLEANUP
4355
4356 dnl This test checks that packet_type PT_ETH is properly encoded/decoded in 1.5 packet_out.
4357 AT_SETUP([ofproto - packet-out with set_field metadata with packet_type PT_ETH (OpenFlow 1.5)])
4358 OVS_VSWITCHD_START
4359
4360 # Start a monitor listening for packet-ins.
4361 AT_CHECK([ovs-ofctl -P standard -O OpenFlow13 monitor br0 --detach --no-chdir --pidfile])
4362 ovs-appctl -t ovs-ofctl ofctl/send 0409000c0123456700000080
4363 ovs-appctl -t ovs-ofctl ofctl/barrier
4364 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
4365 AT_CAPTURE_FILE([monitor.log])
4366
4367 # Send a packet-out with a couple of set-field action to set some metadata, and forward to controller
4368 AT_CHECK([ovs-ofctl -O OpenFlow15 packet-out br0 "in_port=controller packet=0001020304050010203040501234 packet_type(0,0x0) actions=set_field:0xfafafafa5a5a5a5a->metadata,controller"])
4369
4370 # Stop the monitor and check its output.
4371 ovs-appctl -t ovs-ofctl ofctl/barrier
4372 ovs-appctl -t ovs-ofctl exit
4373
4374 AT_CHECK([sed 's/ (xid=0x[[0-9a-fA-F]]*)//' monitor.log], [0], [dnl
4375 OFPT_PACKET_IN (OF1.3): total_len=14 metadata=0xfafafafa5a5a5a5a,in_port=CONTROLLER (via action) data_len=14 (unbuffered)
4376 vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1234
4377 OFPT_BARRIER_REPLY (OF1.3):
4378 ])
4379
4380 OVS_VSWITCHD_STOP
4381 AT_CLEANUP
4382
4383 dnl This test checks that packet_type PT_IPV4 is properly encoded/decoded in 1.5 packet_out.
4384 AT_SETUP([ofproto - packet-out with set_field metadata with packet_type PT_IPV4 on PTAP bridge (OpenFlow 1.5)])
4385 OVS_VSWITCHD_START
4386
4387 # Start a monitor listening for packet-ins.
4388 AT_CHECK([ovs-ofctl -P standard -O OpenFlow13 monitor br0 --detach --no-chdir --pidfile])
4389 ovs-appctl -t ovs-ofctl ofctl/send 0409000c0123456700000080
4390 ovs-appctl -t ovs-ofctl ofctl/barrier
4391 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
4392 AT_CAPTURE_FILE([monitor.log])
4393
4394 # Send a packet-out with a couple of set-field action to set some metadata, and forward to controller
4395 AT_CHECK([ovs-ofctl -O OpenFlow15 packet-out br0 "in_port=controller packet=4500002012344000ff1155670a0000140a00001e006400c8000cea78ffffffff packet_type(1,0x800) actions=set_field:0xfafafafa5a5a5a5a->metadata,controller"])
4396
4397 # Stop the monitor and check its output.
4398 ovs-appctl -t ovs-ofctl ofctl/barrier
4399 ovs-appctl -t ovs-ofctl exit
4400
4401 AT_CHECK([sed 's/ (xid=0x[[0-9a-fA-F]]*)//' monitor.log], [0], [dnl
4402 OFPT_PACKET_IN (OF1.3): total_len=32 packet_type=(1,0x800),metadata=0xfafafafa5a5a5a5a,in_port=CONTROLLER (via action) data_len=32 (unbuffered)
4403 packet_type=(1,0x800),nw_src=10.0.0.20,nw_dst=10.0.0.30,nw_proto=17,nw_tos=0,nw_ecn=0,nw_ttl=255,tp_src=100,tp_dst=200 udp_csum:ea78
4404 OFPT_BARRIER_REPLY (OF1.3):
4405 ])
4406
4407 OVS_VSWITCHD_STOP
4408 AT_CLEANUP
4409
4410 dnl This test checks that metadata is encoded in packet_in structures,
4411 dnl supported by NXAST.
4412 AT_SETUP([ofproto - packet-out with metadata (NXM)])
4413 OVS_VSWITCHD_START
4414
4415 # Start a monitor listening for packet-ins.
4416 AT_CHECK([ovs-ofctl -P nxt_packet_in monitor br0 --detach --no-chdir --pidfile])
4417 ovs-appctl -t ovs-ofctl ofctl/send 0109000c0123456700000080
4418 ovs-appctl -t ovs-ofctl ofctl/barrier
4419 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
4420 AT_CAPTURE_FILE([monitor.log])
4421
4422 # Send a packet-out with a load action to set some metadata, and forward to controller
4423 AT_CHECK([ovs-ofctl packet-out br0 "in_port=controller packet=0001020304050010203040501234 actions=load(0xfafafafa5a5a5a5a->OXM_OF_METADATA[[0..63]]),load(0xaa->NXM_NX_PKT_MARK[[]]),controller"])
4424
4425 # Stop the monitor and check its output.
4426 ovs-appctl -t ovs-ofctl ofctl/barrier
4427 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
4428
4429 AT_CHECK([sed 's/ (xid=0x[[0-9a-fA-F]]*)//' monitor.log], [0], [dnl
4430 NXT_PACKET_IN: total_len=14 pkt_mark=0xaa,metadata=0xfafafafa5a5a5a5a,in_port=CONTROLLER (via action) data_len=14 (unbuffered)
4431 vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1234
4432 OFPT_BARRIER_REPLY:
4433 ])
4434
4435 OVS_VSWITCHD_STOP
4436 AT_CLEANUP
4437
4438 dnl This test checks that metadata is encoded in packet_in structures,
4439 dnl supported by NXAST.
4440 AT_SETUP([ofproto - packet-out with metadata (OpenFlow 1.2)])
4441 OVS_VSWITCHD_START
4442
4443 # Start a monitor listening for packet-ins.
4444 AT_CHECK([ovs-ofctl -O OpenFlow12 -P standard monitor br0 --detach --no-chdir --pidfile])
4445 ovs-appctl -t ovs-ofctl ofctl/send 0309000c0123456700000080
4446 ovs-appctl -t ovs-ofctl ofctl/barrier
4447 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
4448 AT_CAPTURE_FILE([monitor.log])
4449
4450 # Send a packet-out with a set-field action to set some metadata, and forward to controller
4451 AT_CHECK([ovs-ofctl -O OpenFlow12 packet-out br0 none 'set_field:0xfafafafa5a5a5a5a->metadata, controller' '0001020304050010203040501234'])
4452
4453 # Stop the monitor and check its output.
4454 ovs-appctl -t ovs-ofctl ofctl/barrier
4455 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
4456
4457 AT_CHECK([sed 's/ (xid=0x[[0-9a-fA-F]]*)//' monitor.log], [0], [dnl
4458 OFPT_PACKET_IN (OF1.2): total_len=14 metadata=0xfafafafa5a5a5a5a,in_port=ANY (via action) data_len=14 (unbuffered)
4459 vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1234
4460 OFPT_BARRIER_REPLY (OF1.2):
4461 ])
4462
4463 OVS_VSWITCHD_STOP
4464 AT_CLEANUP
4465
4466 dnl This test checks that metadata is encoded in packet_in structures,
4467 dnl supported by NXAST.
4468 AT_SETUP([ofproto - packet-out with metadata and dual set_field (OpenFlow 1.3)])
4469 OVS_VSWITCHD_START
4470
4471 # Start a monitor listening for packet-ins.
4472 AT_CHECK([ovs-ofctl -O OpenFlow13 -P standard monitor br0 --detach --no-chdir --pidfile])
4473 ovs-appctl -t ovs-ofctl ofctl/send 0409000c0123456700000080
4474 ovs-appctl -t ovs-ofctl ofctl/barrier
4475 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
4476 AT_CAPTURE_FILE([monitor.log])
4477
4478 # Send a packet-out with a couple of set-field action to set some metadata, and forward to controller
4479 AT_CHECK([ovs-ofctl -O OpenFlow13 packet-out br0 none 'set_field:0xfafafafa5a5a5a5a->metadata, set_field:0x6b->metadata, controller' '0001020304050010203040501234'])
4480
4481 # Stop the monitor and check its output.
4482 ovs-appctl -t ovs-ofctl ofctl/barrier
4483 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
4484
4485 AT_CHECK([sed 's/ (xid=0x[[0-9a-fA-F]]*)//' monitor.log], [0], [dnl
4486 OFPT_PACKET_IN (OF1.3): total_len=14 metadata=0x6b,in_port=ANY (via action) data_len=14 (unbuffered)
4487 vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1234
4488 OFPT_BARRIER_REPLY (OF1.3):
4489 ])
4490
4491 OVS_VSWITCHD_STOP
4492 AT_CLEANUP
4493
4494 dnl This test checks that tunnel metadata is encoded in packet_in structures.
4495 AT_SETUP([ofproto - packet-out with tunnel metadata (OpenFlow 1.2)])
4496 OVS_VSWITCHD_START
4497
4498 # Start a monitor listening for packet-ins.
4499 AT_CHECK([ovs-ofctl -O OpenFlow12 -P standard monitor br0 --detach --no-chdir --pidfile])
4500 ovs-appctl -t ovs-ofctl ofctl/send 0309000c0123456700000080
4501 ovs-appctl -t ovs-ofctl ofctl/barrier
4502 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
4503 AT_CAPTURE_FILE([monitor.log])
4504
4505 # Send a packet-out with set field actions to set some tunnel metadata, and forward to controller
4506 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'])
4507
4508 # Stop the monitor and check its output.
4509 ovs-appctl -t ovs-ofctl ofctl/barrier
4510 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
4511
4512 AT_CHECK([sed 's/ (xid=0x[[0-9a-fA-F]]*)//' monitor.log], [0], [dnl
4513 OFPT_PACKET_IN (OF1.2): total_len=14 tun_id=0x1020304,tun_src=127.0.0.1,tun_dst=192.168.0.1,in_port=ANY (via action) data_len=14 (unbuffered)
4514 vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1234
4515 OFPT_BARRIER_REPLY (OF1.2):
4516 ])
4517
4518 OVS_VSWITCHD_STOP
4519 AT_CLEANUP
4520
4521 m4_divert_push([PREPARE_TESTS])
4522 # Sorts groups of lines that start with a space, without moving them
4523 # past the nearest line that does not start with a space.
4524 [
4525 multiline_sort () {
4526 $PYTHON -c '
4527 import sys
4528
4529 buffer = []
4530 while True:
4531 line = sys.stdin.readline()
4532 if not line:
4533 break
4534 if line.startswith(" "):
4535 buffer.append(line)
4536 else:
4537 sys.stdout.write("".join(sorted(buffer)))
4538 sys.stdout.write(line)
4539 buffer = []
4540 sys.stdout.write("".join(sorted(buffer)))
4541 '
4542 }
4543 ]
4544 m4_divert_pop([PREPARE_TESTS])
4545
4546 AT_SETUP([ofproto - flow monitoring])
4547 AT_KEYWORDS([monitor])
4548 OVS_VSWITCHD_START
4549
4550 ovs-ofctl add-flow br0 in_port=0,dl_vlan=123,actions=output:1
4551
4552 # Start a monitor watching the flow table and check the initial reply.
4553 ovs-ofctl monitor br0 watch: --detach --no-chdir --pidfile >monitor.log 2>&1
4554 AT_CAPTURE_FILE([monitor.log])
4555 ovs-appctl -t ovs-ofctl ofctl/barrier
4556 AT_CHECK([sed 's/ (xid=0x[[1-9a-fA-F]][[0-9a-fA-F]]*)//' monitor.log], [0],
4557 [NXST_FLOW_MONITOR reply:
4558 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=123 actions=output:1
4559 OFPT_BARRIER_REPLY:
4560 ])
4561
4562 # Add, delete, and modify some flows and check the updates.
4563 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
4564 ovs-ofctl add-flow br0 in_port=0,dl_vlan=124,actions=output:2
4565 ovs-ofctl add-flow br0 in_port=0,dl_vlan=123,actions=output:5
4566 ovs-ofctl add-flow br0 in_port=0,dl_vlan=123,dl_vlan_pcp=0,actions=output:6
4567 ovs-ofctl add-flow br0 in_port=0,dl_vlan=123,dl_vlan_pcp=1,actions=output:7
4568 ovs-ofctl add-flow br0 in_port=0,dl_vlan=123,actions=output:8
4569 ovs-ofctl add-flow br0 in_port=0,dl_vlan=65535,dl_vlan_pcp=0,actions=output:9
4570 ovs-ofctl add-flow br0 in_port=0,dl_vlan=65535,dl_vlan_pcp=1,actions=output:10
4571 ovs-ofctl add-flow br0 in_port=0,dl_vlan=65535,actions=output:11
4572 ovs-ofctl add-flow br0 in_port=0,dl_vlan=8191,dl_vlan_pcp=0,actions=output:12
4573 ovs-ofctl add-flow br0 in_port=0,dl_vlan=8191,dl_vlan_pcp=1,actions=output:13
4574 ovs-ofctl add-flow br0 in_port=0,dl_vlan=8191,actions=output:14
4575 ovs-ofctl add-flow br0 in_port=0,dl_vlan=0,dl_vlan_pcp=0,actions=output:15
4576 ovs-ofctl add-flow br0 in_port=0,dl_vlan=0,dl_vlan_pcp=1,actions=output:16
4577 ovs-ofctl add-flow br0 in_port=0,dl_vlan=0,actions=output:17
4578 ovs-ofctl add-flow br0 in_port=0,dl_vlan=0,dl_vlan_pcp=0,actions=output:18
4579 ovs-ofctl add-flow br0 in_port=0,dl_vlan=0,dl_vlan_pcp=1,actions=output:19
4580 ovs-ofctl add-flow br0 in_port=0,dl_vlan=0,actions=output:20
4581 ovs-ofctl add-flow br0 in_port=0,dl_vlan_pcp=0,actions=output:21
4582 ovs-ofctl add-flow br0 in_port=0,dl_vlan_pcp=1,actions=output:22
4583 ovs-ofctl add-flow br0 in_port=0,actions=output:23
4584 ovs-ofctl mod-flows br0 dl_vlan=123,actions=output:3
4585 ovs-ofctl mod-flows br0 cookie=5,dl_vlan=123,actions=output:3
4586 ovs-ofctl del-flows br0 dl_vlan=123
4587 ovs-ofctl del-flows br0
4588 ovs-appctl -t ovs-ofctl ofctl/barrier
4589 AT_CHECK([sed 's/ (xid=0x[[1-9a-fA-F]][[0-9a-fA-F]]*)//' monitor.log | multiline_sort], [0],
4590 [NXST_FLOW_MONITOR reply (xid=0x0):
4591 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=124 actions=output:2
4592 NXST_FLOW_MONITOR reply (xid=0x0):
4593 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=123 actions=output:5
4594 NXST_FLOW_MONITOR reply (xid=0x0):
4595 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=123,dl_vlan_pcp=0 actions=output:6
4596 NXST_FLOW_MONITOR reply (xid=0x0):
4597 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=123,dl_vlan_pcp=1 actions=output:7
4598 NXST_FLOW_MONITOR reply (xid=0x0):
4599 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=123 actions=output:8
4600 NXST_FLOW_MONITOR reply (xid=0x0):
4601 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=0,dl_vlan_pcp=0 actions=output:9
4602 NXST_FLOW_MONITOR reply (xid=0x0):
4603 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=0,dl_vlan_pcp=1 actions=output:10
4604 NXST_FLOW_MONITOR reply (xid=0x0):
4605 event=ADDED table=0 cookie=0 in_port=0,vlan_tci=0x0000 actions=output:11
4606 NXST_FLOW_MONITOR reply (xid=0x0):
4607 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=4095,dl_vlan_pcp=0 actions=output:12
4608 NXST_FLOW_MONITOR reply (xid=0x0):
4609 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=4095,dl_vlan_pcp=1 actions=output:13
4610 NXST_FLOW_MONITOR reply (xid=0x0):
4611 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=4095 actions=output:14
4612 NXST_FLOW_MONITOR reply (xid=0x0):
4613 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=0,dl_vlan_pcp=0 actions=output:15
4614 NXST_FLOW_MONITOR reply (xid=0x0):
4615 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=0,dl_vlan_pcp=1 actions=output:16
4616 NXST_FLOW_MONITOR reply (xid=0x0):
4617 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=0 actions=output:17
4618 NXST_FLOW_MONITOR reply (xid=0x0):
4619 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=0,dl_vlan_pcp=0 actions=output:18
4620 NXST_FLOW_MONITOR reply (xid=0x0):
4621 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=0,dl_vlan_pcp=1 actions=output:19
4622 NXST_FLOW_MONITOR reply (xid=0x0):
4623 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=0 actions=output:20
4624 NXST_FLOW_MONITOR reply (xid=0x0):
4625 event=ADDED table=0 cookie=0 in_port=0,dl_vlan_pcp=0 actions=output:21
4626 NXST_FLOW_MONITOR reply (xid=0x0):
4627 event=ADDED table=0 cookie=0 in_port=0,dl_vlan_pcp=1 actions=output:22
4628 NXST_FLOW_MONITOR reply (xid=0x0):
4629 event=ADDED table=0 cookie=0 in_port=0 actions=output:23
4630 NXST_FLOW_MONITOR reply (xid=0x0):
4631 event=MODIFIED table=0 cookie=0 in_port=0,dl_vlan=123 actions=output:3
4632 event=MODIFIED table=0 cookie=0 in_port=0,dl_vlan=123,dl_vlan_pcp=0 actions=output:3
4633 event=MODIFIED table=0 cookie=0 in_port=0,dl_vlan=123,dl_vlan_pcp=1 actions=output:3
4634 NXST_FLOW_MONITOR reply (xid=0x0):
4635 event=MODIFIED table=0 cookie=0x5 in_port=0,dl_vlan=123 actions=output:3
4636 event=MODIFIED table=0 cookie=0x5 in_port=0,dl_vlan=123,dl_vlan_pcp=0 actions=output:3
4637 event=MODIFIED table=0 cookie=0x5 in_port=0,dl_vlan=123,dl_vlan_pcp=1 actions=output:3
4638 NXST_FLOW_MONITOR reply (xid=0x0):
4639 event=DELETED reason=delete table=0 cookie=0x5 in_port=0,dl_vlan=123 actions=output:3
4640 event=DELETED reason=delete table=0 cookie=0x5 in_port=0,dl_vlan=123,dl_vlan_pcp=0 actions=output:3
4641 event=DELETED reason=delete table=0 cookie=0x5 in_port=0,dl_vlan=123,dl_vlan_pcp=1 actions=output:3
4642 NXST_FLOW_MONITOR reply (xid=0x0):
4643 event=DELETED reason=delete table=0 cookie=0 in_port=0 actions=output:23
4644 event=DELETED reason=delete table=0 cookie=0 in_port=0,dl_vlan=0 actions=output:20
4645 event=DELETED reason=delete table=0 cookie=0 in_port=0,dl_vlan=0,dl_vlan_pcp=0 actions=output:18
4646 event=DELETED reason=delete table=0 cookie=0 in_port=0,dl_vlan=0,dl_vlan_pcp=1 actions=output:19
4647 event=DELETED reason=delete table=0 cookie=0 in_port=0,dl_vlan=124 actions=output:2
4648 event=DELETED reason=delete table=0 cookie=0 in_port=0,dl_vlan=4095 actions=output:14
4649 event=DELETED reason=delete table=0 cookie=0 in_port=0,dl_vlan=4095,dl_vlan_pcp=0 actions=output:12
4650 event=DELETED reason=delete table=0 cookie=0 in_port=0,dl_vlan=4095,dl_vlan_pcp=1 actions=output:13
4651 event=DELETED reason=delete table=0 cookie=0 in_port=0,dl_vlan_pcp=0 actions=output:21
4652 event=DELETED reason=delete table=0 cookie=0 in_port=0,dl_vlan_pcp=1 actions=output:22
4653 event=DELETED reason=delete table=0 cookie=0 in_port=0,vlan_tci=0x0000 actions=output:11
4654 OFPT_BARRIER_REPLY:
4655 ])
4656
4657 # Check that our own changes are reported as full updates.
4658 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
4659 ovs-ofctl add-flow br0 in_port=1,actions=output:2
4660 ovs-ofctl add-flow br0 in_port=2,actions=output:1
4661 ovs-appctl -t ovs-ofctl ofctl/barrier
4662 ovs-appctl -t ovs-ofctl ofctl/send 010e004812345678003fffff00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003000000000000ffffffffffff0000
4663 ovs-appctl -t ovs-ofctl ofctl/barrier
4664 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip], [0], [NXST_FLOW reply:
4665 ])
4666 AT_CHECK([sed 's/ (xid=0x[[1-9a-fA-F]][[0-9a-fA-F]]*)//' monitor.log | multiline_sort], [0],
4667 [NXST_FLOW_MONITOR reply (xid=0x0):
4668 event=ADDED table=0 cookie=0 in_port=1 actions=output:2
4669 NXST_FLOW_MONITOR reply (xid=0x0):
4670 event=ADDED table=0 cookie=0 in_port=2 actions=output:1
4671 OFPT_BARRIER_REPLY:
4672 send: OFPT_FLOW_MOD: DEL priority=0 actions=drop
4673 NXST_FLOW_MONITOR reply (xid=0x0):
4674 event=DELETED reason=delete table=0 cookie=0 in_port=1 actions=output:2
4675 event=DELETED reason=delete table=0 cookie=0 in_port=2 actions=output:1
4676 OFPT_BARRIER_REPLY:
4677 ])
4678
4679 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
4680 OVS_VSWITCHD_STOP
4681 AT_CLEANUP
4682
4683 AT_SETUP([ofproto - flow monitoring with !own])
4684 AT_KEYWORDS([monitor])
4685 OVS_VSWITCHD_START
4686
4687 ovs-ofctl add-flow br0 in_port=0,dl_vlan=123,actions=output:1
4688
4689 # Start a monitor watching the flow table and check the initial reply.
4690 ovs-ofctl monitor br0 watch:\!own --detach --no-chdir --pidfile >monitor.log 2>&1
4691 AT_CAPTURE_FILE([monitor.log])
4692 ovs-appctl -t ovs-ofctl ofctl/barrier
4693 AT_CHECK([sed 's/ (xid=0x[[1-9a-fA-F]][[0-9a-fA-F]]*)//' monitor.log], [0],
4694 [NXST_FLOW_MONITOR reply:
4695 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=123 actions=output:1
4696 OFPT_BARRIER_REPLY:
4697 ])
4698
4699 # Check that our own changes are reported as abbreviations.
4700 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
4701 ovs-ofctl add-flow br0 in_port=1,actions=output:2
4702 ovs-ofctl add-flow br0 in_port=2,actions=output:1
4703 ovs-appctl -t ovs-ofctl ofctl/barrier
4704 ovs-appctl -t ovs-ofctl ofctl/send 010e004812345678003fffff00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003000000000000ffffffffffff0000
4705 ovs-appctl -t ovs-ofctl ofctl/barrier
4706 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip], [0], [NXST_FLOW reply:
4707 ])
4708 AT_CHECK([sed 's/ (xid=0x[[1-9a-fA-F]][[0-9a-fA-F]]*)//' monitor.log], [0],
4709 [NXST_FLOW_MONITOR reply (xid=0x0):
4710 event=ADDED table=0 cookie=0 in_port=1 actions=output:2
4711 NXST_FLOW_MONITOR reply (xid=0x0):
4712 event=ADDED table=0 cookie=0 in_port=2 actions=output:1
4713 OFPT_BARRIER_REPLY:
4714 send: OFPT_FLOW_MOD: DEL priority=0 actions=drop
4715 NXST_FLOW_MONITOR reply (xid=0x0):
4716 event=ABBREV xid=0x12345678
4717 OFPT_BARRIER_REPLY:
4718 ])
4719
4720 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
4721 OVS_VSWITCHD_STOP
4722 AT_CLEANUP
4723
4724 AT_SETUP([ofproto - flow monitoring with out_port])
4725 AT_KEYWORDS([monitor])
4726 OVS_VSWITCHD_START
4727
4728 ovs-ofctl add-flow br0 in_port=0,dl_vlan=121,actions=output:1
4729 ovs-ofctl add-flow br0 in_port=0,dl_vlan=122,actions=output:1
4730 ovs-ofctl add-flow br0 in_port=0,dl_vlan=123,actions=output:2
4731
4732 # Start a monitor watching the flow table and check the initial reply.
4733 ovs-ofctl monitor br0 watch:out_port=2 --detach --no-chdir --pidfile >monitor.log 2>&1
4734 AT_CAPTURE_FILE([monitor.log])
4735 ovs-appctl -t ovs-ofctl ofctl/barrier
4736 AT_CHECK([sed 's/ (xid=0x[[1-9a-fA-F]][[0-9a-fA-F]]*)//' monitor.log], [0],
4737 [NXST_FLOW_MONITOR reply:
4738 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=123 actions=output:2
4739 OFPT_BARRIER_REPLY:
4740 ])
4741
4742 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
4743
4744 # Add, modify flows and check the updates.
4745 ovs-ofctl mod-flows br0 dl_vlan=121,actions=drop
4746 ovs-ofctl mod-flows br0 dl_vlan=122,actions=output:1,output:2
4747 ovs-appctl -t ovs-ofctl ofctl/barrier
4748
4749 ovs-ofctl mod-flows br0 dl_vlan=123,actions=output:1,output:2
4750 ovs-appctl -t ovs-ofctl ofctl/barrier
4751
4752 ovs-ofctl mod-flows br0 dl_vlan=122,actions=output:1
4753 ovs-appctl -t ovs-ofctl ofctl/barrier
4754 ovs-ofctl mod-flows br0 dl_vlan=123,actions=output:2
4755 ovs-appctl -t ovs-ofctl ofctl/barrier
4756
4757 AT_CHECK([sed 's/ (xid=0x[[1-9a-fA-F]][[0-9a-fA-F]]*)//' monitor.log], [0],
4758 [NXST_FLOW_MONITOR reply (xid=0x0):
4759 event=MODIFIED table=0 cookie=0 in_port=0,dl_vlan=122 actions=output:1,output:2
4760 OFPT_BARRIER_REPLY:
4761 NXST_FLOW_MONITOR reply (xid=0x0):
4762 event=MODIFIED table=0 cookie=0 in_port=0,dl_vlan=123 actions=output:1,output:2
4763 OFPT_BARRIER_REPLY:
4764 NXST_FLOW_MONITOR reply (xid=0x0):
4765 event=MODIFIED table=0 cookie=0 in_port=0,dl_vlan=122 actions=output:1
4766 OFPT_BARRIER_REPLY:
4767 NXST_FLOW_MONITOR reply (xid=0x0):
4768 event=MODIFIED table=0 cookie=0 in_port=0,dl_vlan=123 actions=output:2
4769 OFPT_BARRIER_REPLY:
4770 ])
4771
4772 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
4773 OVS_VSWITCHD_STOP
4774 AT_CLEANUP
4775
4776 AT_SETUP([ofproto - flow monitoring pause and resume])
4777 AT_KEYWORDS([monitor])
4778
4779 # The maximum socket receive buffer size is important for this test, which
4780 # tests behavior when the receive buffer overflows.
4781 if test -e /proc/sys/net/core/rmem_max; then
4782 # Linux
4783 rmem_max=`cat /proc/sys/net/core/rmem_max`
4784 elif rmem_max=`sysctl -n net.inet.tcp.recvbuf_max 2>/dev/null`; then
4785 : # FreeBSD, NetBSD
4786 else
4787 # Don't know how to get maximum socket receive buffer on this OS
4788 AT_SKIP_IF([:])
4789 fi
4790 # Calculate the total amount of queuing: rmem_max in the kernel, 128 kB
4791 # in ofproto sending userspace (see ofmonitor_flush() in connmgr.c).
4792 queue_size=`expr $rmem_max + 128 \* 1024`
4793 echo rmem_max=$rmem_max queue_size=$queue_size
4794
4795 # If there's too much queuing skip the test to avoid timing out.
4796 AT_SKIP_IF([test $rmem_max -gt 1048576])
4797
4798 # Each flow update message takes up at least 48 bytes of space in queues
4799 # and in practice more than that.
4800 n_msgs=`expr $queue_size / 48`
4801 echo n_msgs=$n_msgs
4802
4803 OVS_VSWITCHD_START
4804
4805 # Start a monitor watching the flow table, then make it block.
4806 on_exit 'kill `cat ovs-ofctl.pid`'
4807 ovs-ofctl monitor br0 watch: --detach --no-chdir --pidfile >monitor.log 2>&1
4808 AT_CAPTURE_FILE([monitor.log])
4809 ovs-appctl -t ovs-ofctl ofctl/block
4810
4811 # Add $n_msgs flows.
4812 (echo "in_port=2,actions=output:2"
4813 $PYTHON -c '
4814 for i in range('$n_msgs'):
4815 print("cookie=1,reg1=%d,actions=drop" % i)
4816 ') > flows.txt
4817 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
4818 # Check that multipart flow dumps work properly:
4819 AT_CHECK([ovs-ofctl diff-flows br0 flows.txt])
4820 AT_CHECK([ovs-ofctl add-flow br0 in_port=1,cookie=3,actions=drop])
4821 AT_CHECK([ovs-ofctl mod-flows br0 in_port=2,cookie=2,actions=output:2])
4822 AT_CHECK([ovs-ofctl del-flows br0 cookie=1/-1])
4823
4824 ovs-appctl -t ovs-ofctl ofctl/unblock
4825
4826 # Wait for the connection resumed.
4827 # A barrier doesn't work for this purpose.
4828 # https://www.mail-archive.com/dev@openvswitch.org/msg27013.html
4829 # https://www.mail-archive.com/dev@openvswitch.org/msg27675.html
4830 OVS_WAIT_UNTIL([grep NXT_FLOW_MONITOR_RESUMED monitor.log])
4831
4832 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
4833
4834 # Check that the flow monitor reported the same number of flows
4835 # added and deleted, but fewer than we actually added and deleted.
4836 adds=`grep -c 'ADDED.*reg1=' monitor.log`
4837 deletes=`grep -c 'DELETED.*reg1=' monitor.log`
4838 echo adds=$adds deletes=$deletes
4839 AT_CHECK([test $adds -gt 100 && test $adds -lt $n_msgs])
4840 AT_CHECK([test $adds = $deletes])
4841
4842 # Check that the flow monitor reported everything in the expected order:
4843 #
4844 # event=ADDED table=0 cookie=0x1 reg1=0x22
4845 # ...
4846 # NXT_FLOW_MONITOR_PAUSED:
4847 # ...
4848 # event=DELETED reason=delete table=0 cookie=0x1 reg1=0x22
4849 # ...
4850 # event=ADDED table=0 cookie=0x3 in_port=1
4851 # event=MODIFIED table=0 cookie=0x2 in_port=2 actions=output:2
4852 # NXT_FLOW_MONITOR_RESUMED:
4853 #
4854 # except that, between the PAUSED and RESUMED, the order of the ADDED
4855 # and MODIFIED lines lines depends on hash order, that is, it varies
4856 # as we change the hash function or change architecture. Therefore,
4857 # we use a couple of tests below to accept both orders.
4858 AT_CHECK([ofctl_strip < monitor.log | sed -n -e '
4859 /reg1=0x22$/p
4860 /cookie=0x[[23]]/p
4861 /NXT_FLOW_MONITOR_PAUSED:/p
4862 /NXT_FLOW_MONITOR_RESUMED:/p
4863 ' > monitor.log.subset])
4864 AT_CHECK([grep -v MODIFIED monitor.log.subset], [0], [dnl
4865 event=ADDED table=0 cookie=0x1 reg1=0x22
4866 NXT_FLOW_MONITOR_PAUSED:
4867 event=DELETED reason=delete table=0 cookie=0x1 reg1=0x22
4868 event=ADDED table=0 cookie=0x3 in_port=1
4869 NXT_FLOW_MONITOR_RESUMED:
4870 ])
4871 AT_CHECK([grep -v ADDED monitor.log.subset], [0], [dnl
4872 NXT_FLOW_MONITOR_PAUSED:
4873 event=DELETED reason=delete table=0 cookie=0x1 reg1=0x22
4874 event=MODIFIED table=0 cookie=0x2 in_port=2 actions=output:2
4875 NXT_FLOW_MONITOR_RESUMED:
4876 ])
4877
4878 OVS_VSWITCHD_STOP
4879 AT_CLEANUP
4880
4881 AT_SETUP([ofproto - event filtering (OpenFlow 1.3)])
4882 AT_KEYWORDS([monitor])
4883 OVS_VSWITCHD_START
4884
4885 # Start a monitor, use the required protocol version
4886 ovs-ofctl -O OpenFlow13 monitor br0 --detach --no-chdir --pidfile >monitor.log 2>&1
4887 AT_CAPTURE_FILE([monitor.log])
4888
4889 # Send an OpenFlow13 message (04), OFPT_GET_ASYNC_REQUEST (1a), length (8), xid (0a)
4890 ovs-appctl -t ovs-ofctl ofctl/send 041a00080000000a
4891 ovs-appctl -t ovs-ofctl ofctl/barrier
4892
4893 # Check default setting
4894 read -r -d '' expected <<'EOF'
4895 EOF
4896
4897 AT_CHECK([ofctl_strip < monitor.log], [], [dnl
4898 send: OFPT_GET_ASYNC_REQUEST (OF1.3):
4899 OFPT_GET_ASYNC_REPLY (OF1.3):
4900 master:
4901 PACKET_IN: no_match action
4902 PORT_STATUS: add delete modify
4903 FLOW_REMOVED: idle hard delete group_delete
4904 ROLE_STATUS: (off)
4905 TABLE_STATUS: (off)
4906 REQUESTFORWARD: (off)
4907
4908 slave:
4909 PACKET_IN: (off)
4910 PORT_STATUS: add delete modify
4911 FLOW_REMOVED: (off)
4912 ROLE_STATUS: (off)
4913 TABLE_STATUS: (off)
4914 REQUESTFORWARD: (off)
4915 OFPT_BARRIER_REPLY (OF1.3):
4916 ])
4917
4918 OVS_VSWITCHD_STOP
4919 AT_CLEANUP
4920
4921 AT_SETUP([ofproto - ofport_request])
4922 OVS_VSWITCHD_START
4923 add_of_ports br0 1 2 3
4924
4925 set_and_check_specific_ofports () {
4926 ovs-vsctl set Interface p1 ofport_request="$1" -- \
4927 set Interface p2 ofport_request="$2" -- \
4928 set Interface p3 ofport_request="$3"
4929 ofports=`ovs-vsctl get Interface p1 ofport -- \
4930 get Interface p2 ofport -- \
4931 get Interface p3 ofport`
4932 AT_CHECK_UNQUOTED([echo $ofports], [0], [$1 $2 $3
4933 ])
4934 }
4935 for pre in '1 2 3' '1 3 2' '2 1 3' '2 3 1' '3 1 2' '3 2 1'; do
4936 for post in '1 2 3' '1 3 2' '2 1 3' '2 3 1' '3 1 2' '3 2 1'; do
4937 echo -----------------------------------------------------------
4938 echo "Check changing port numbers from $pre to $post"
4939 set_and_check_specific_ofports $pre
4940 set_and_check_specific_ofports $post
4941 done
4942 done
4943
4944 ovs-vsctl del-port p3
4945
4946 set_and_check_poorly_specified_ofports () {
4947 ovs-vsctl set Interface p1 ofport_request="$1" -- \
4948 set Interface p2 ofport_request="$2"
4949 p1=`ovs-vsctl get Interface p1 ofport`
4950 p2=`ovs-vsctl get Interface p2 ofport`
4951 echo $p1 $p2
4952
4953 AT_CHECK([test "$p1" != "$p2"])
4954 if test "$1" = "$2" && test "$1" != '[[]]'; then
4955 # One port number must be the requested one.
4956 AT_CHECK([test "$p1" = "$1" || test "$p2" = "$1"])
4957 # The other port number must be different (already tested above).
4958 else
4959 AT_CHECK([test "$1" = '[[]]' || test "$p1" = "$1"])
4960 AT_CHECK([test "$2" = '[[]]' || test "$p2" = "$2"])
4961 fi
4962 }
4963 for pre in '1 2' '[[]] 2' '1 [[]]' '[[]] [[]]' '2 1' '[[]] 1' '2 [[]]' \
4964 '1 1' '2 2'; do
4965 for post in '1 2' '[[]] 2' '1 [[]]' '[[]] [[]]' '2 1' '[[]] 1' '2 [[]]' \
4966 '1 1' '2 2'; do
4967 echo -----------------------------------------------------------
4968 echo "Check changing port numbers from $pre to $post"
4969 set_and_check_poorly_specified_ofports $pre
4970 set_and_check_poorly_specified_ofports $post
4971 done
4972 done
4973 OVS_VSWITCHD_STOP
4974 AT_CLEANUP
4975
4976
4977 AT_SETUP([ofproto - bundle open (OpenFlow 1.4)])
4978 AT_KEYWORDS([monitor])
4979 OVS_VSWITCHD_START
4980
4981 # Start a monitor, use the required protocol version
4982 ovs-ofctl -O OpenFlow14 monitor br0 --detach --no-chdir --pidfile >monitor.log 2>&1
4983 AT_CAPTURE_FILE([monitor.log])
4984
4985 # Send an OpenFlow14 message (05), OFPT_BUNDLE_CONTROL (21), length (10), xid (0a)
4986 ovs-appctl -t ovs-ofctl ofctl/send "05 21 00 10 00 00 00 0a 00 00 00 01 00 00 00 02"
4987 ovs-appctl -t ovs-ofctl ofctl/barrier
4988 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
4989
4990 AT_CHECK([ofctl_strip < monitor.log], [], [dnl
4991 send: OFPT_BUNDLE_CONTROL (OF1.4):
4992 bundle_id=0x1 type=OPEN_REQUEST flags=ordered
4993 OFPT_BUNDLE_CONTROL (OF1.4):
4994 bundle_id=0x1 type=OPEN_REPLY flags=0
4995 OFPT_BARRIER_REPLY (OF1.4):
4996 ])
4997
4998 OVS_VSWITCHD_STOP
4999 AT_CLEANUP
5000
5001 AT_SETUP([ofproto - bundle double open (OpenFlow 1.4)])
5002 AT_KEYWORDS([monitor])
5003 OVS_VSWITCHD_START
5004
5005 # Start a monitor, use the required protocol version
5006 ovs-ofctl -O OpenFlow14 monitor br0 --detach --no-chdir --pidfile >monitor.log 2>&1
5007 AT_CAPTURE_FILE([monitor.log])
5008
5009 # Send twice an OpenFlow14 message (05), OFPT_BUNDLE_CONTROL (21), length (10), xid (0a)
5010 ovs-appctl -t ovs-ofctl ofctl/send "05 21 00 10 00 00 00 0a 00 00 00 01 00 00 00 02"
5011 ovs-appctl -t ovs-ofctl ofctl/barrier
5012 ovs-appctl -t ovs-ofctl ofctl/send "05 21 00 10 00 00 00 0a 00 00 00 01 00 00 00 02"
5013 ovs-appctl -t ovs-ofctl ofctl/barrier
5014 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
5015
5016 AT_CHECK([ofctl_strip < monitor.log], [0], [dnl
5017 send: OFPT_BUNDLE_CONTROL (OF1.4):
5018 bundle_id=0x1 type=OPEN_REQUEST flags=ordered
5019 OFPT_BUNDLE_CONTROL (OF1.4):
5020 bundle_id=0x1 type=OPEN_REPLY flags=0
5021 OFPT_BARRIER_REPLY (OF1.4):
5022 send: OFPT_BUNDLE_CONTROL (OF1.4):
5023 bundle_id=0x1 type=OPEN_REQUEST flags=ordered
5024 OFPT_ERROR (OF1.4): OFPBFC_BAD_ID
5025 OFPT_BUNDLE_CONTROL (OF1.4):
5026 bundle_id=0x1 type=OPEN_REQUEST flags=ordered
5027 OFPT_BARRIER_REPLY (OF1.4):
5028 ])
5029
5030 OVS_VSWITCHD_STOP
5031 AT_CLEANUP
5032
5033 AT_SETUP([ofproto - bundle close without open (OpenFlow 1.4)])
5034 AT_KEYWORDS([monitor])
5035 OVS_VSWITCHD_START
5036
5037 # Start a monitor, use the required protocol version
5038 ovs-ofctl -O OpenFlow14 monitor br0 --detach --no-chdir --pidfile >monitor.log 2>&1
5039 AT_CAPTURE_FILE([monitor.log])
5040
5041 ovs-appctl -t ovs-ofctl ofctl/send "05 21 00 10 00 00 00 0a 00 00 00 01 00 02 00 02"
5042 ovs-appctl -t ovs-ofctl ofctl/barrier
5043 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
5044
5045 AT_CHECK([ofctl_strip < monitor.log], [0], [dnl
5046 send: OFPT_BUNDLE_CONTROL (OF1.4):
5047 bundle_id=0x1 type=CLOSE_REQUEST flags=ordered
5048 OFPT_ERROR (OF1.4): OFPBFC_BAD_ID
5049 OFPT_BUNDLE_CONTROL (OF1.4):
5050 bundle_id=0x1 type=CLOSE_REQUEST flags=ordered
5051 OFPT_BARRIER_REPLY (OF1.4):
5052 ])
5053
5054 OVS_VSWITCHD_STOP
5055 AT_CLEANUP
5056
5057 AT_SETUP([ofproto - bundle double close (OpenFlow 1.4)])
5058 AT_KEYWORDS([monitor])
5059 OVS_VSWITCHD_START
5060
5061 # Start a monitor, use the required protocol version
5062 ovs-ofctl -O OpenFlow14 monitor br0 --detach --no-chdir --pidfile >monitor.log 2>&1
5063 AT_CAPTURE_FILE([monitor.log])
5064
5065 # Open, Close, Close
5066 ovs-appctl -t ovs-ofctl ofctl/send "05 21 00 10 00 00 00 0a 00 00 00 01 00 00 00 02"
5067 ovs-appctl -t ovs-ofctl ofctl/barrier
5068 ovs-appctl -t ovs-ofctl ofctl/send "05 21 00 10 00 00 00 0a 00 00 00 01 00 02 00 02"
5069 ovs-appctl -t ovs-ofctl ofctl/barrier
5070 ovs-appctl -t ovs-ofctl ofctl/send "05 21 00 10 00 00 00 0a 00 00 00 01 00 02 00 02"
5071 ovs-appctl -t ovs-ofctl ofctl/barrier
5072 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
5073
5074 AT_CHECK([ofctl_strip < monitor.log], [0], [dnl
5075 send: OFPT_BUNDLE_CONTROL (OF1.4):
5076 bundle_id=0x1 type=OPEN_REQUEST flags=ordered
5077 OFPT_BUNDLE_CONTROL (OF1.4):
5078 bundle_id=0x1 type=OPEN_REPLY flags=0
5079 OFPT_BARRIER_REPLY (OF1.4):
5080 send: OFPT_BUNDLE_CONTROL (OF1.4):
5081 bundle_id=0x1 type=CLOSE_REQUEST flags=ordered
5082 OFPT_BUNDLE_CONTROL (OF1.4):
5083 bundle_id=0x1 type=CLOSE_REPLY flags=0
5084 OFPT_BARRIER_REPLY (OF1.4):
5085 send: OFPT_BUNDLE_CONTROL (OF1.4):
5086 bundle_id=0x1 type=CLOSE_REQUEST flags=ordered
5087 OFPT_ERROR (OF1.4): OFPBFC_BUNDLE_CLOSED
5088 OFPT_BUNDLE_CONTROL (OF1.4):
5089 bundle_id=0x1 type=CLOSE_REQUEST flags=ordered
5090 OFPT_BARRIER_REPLY (OF1.4):
5091 ])
5092
5093 OVS_VSWITCHD_STOP
5094 AT_CLEANUP
5095
5096 AT_SETUP([ofproto - bundle close, different flags (OpenFlow 1.4)])
5097 AT_KEYWORDS([monitor])
5098 OVS_VSWITCHD_START
5099
5100 # Start a monitor, use the required protocol version
5101 ovs-ofctl -O OpenFlow14 monitor br0 --detach --no-chdir --pidfile >monitor.log 2>&1
5102 AT_CAPTURE_FILE([monitor.log])
5103
5104 # Open, Close
5105 ovs-appctl -t ovs-ofctl ofctl/send "05 21 00 10 00 00 00 0a 00 00 00 01 00 00 00 02"
5106 ovs-appctl -t ovs-ofctl ofctl/barrier
5107 ovs-appctl -t ovs-ofctl ofctl/send "05 21 00 10 00 00 00 0a 00 00 00 01 00 02 00 01"
5108 ovs-appctl -t ovs-ofctl ofctl/barrier
5109 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
5110
5111 AT_CHECK([ofctl_strip < monitor.log], [0], [dnl
5112 send: OFPT_BUNDLE_CONTROL (OF1.4):
5113 bundle_id=0x1 type=OPEN_REQUEST flags=ordered
5114 OFPT_BUNDLE_CONTROL (OF1.4):
5115 bundle_id=0x1 type=OPEN_REPLY flags=0
5116 OFPT_BARRIER_REPLY (OF1.4):
5117 send: OFPT_BUNDLE_CONTROL (OF1.4):
5118 bundle_id=0x1 type=CLOSE_REQUEST flags=atomic
5119 OFPT_ERROR (OF1.4): OFPBFC_BAD_FLAGS
5120 OFPT_BUNDLE_CONTROL (OF1.4):
5121 bundle_id=0x1 type=CLOSE_REQUEST flags=atomic
5122 OFPT_BARRIER_REPLY (OF1.4):
5123 ])
5124
5125 OVS_VSWITCHD_STOP
5126 AT_CLEANUP
5127
5128 AT_SETUP([ofproto - bundle commit without open (OpenFlow 1.4)])
5129 AT_KEYWORDS([monitor])
5130 OVS_VSWITCHD_START
5131
5132 # Start a monitor, use the required protocol version
5133 ovs-ofctl -O OpenFlow14 monitor br0 --detach --no-chdir --pidfile >monitor.log 2>&1
5134 AT_CAPTURE_FILE([monitor.log])
5135
5136 # Commit
5137 ovs-appctl -t ovs-ofctl ofctl/send "05 21 00 10 00 00 00 0a 00 00 00 01 00 04 00 02"
5138 ovs-appctl -t ovs-ofctl ofctl/barrier
5139 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
5140
5141 AT_CHECK([ofctl_strip < monitor.log], [0], [dnl
5142 send: OFPT_BUNDLE_CONTROL (OF1.4):
5143 bundle_id=0x1 type=COMMIT_REQUEST flags=ordered
5144 OFPT_ERROR (OF1.4): OFPBFC_BAD_ID
5145 OFPT_BUNDLE_CONTROL (OF1.4):
5146 bundle_id=0x1 type=COMMIT_REQUEST flags=ordered
5147 OFPT_BARRIER_REPLY (OF1.4):
5148 ])
5149
5150 OVS_VSWITCHD_STOP
5151 AT_CLEANUP
5152
5153 AT_SETUP([ofproto - bundle commit, different flags (OpenFlow 1.4)])
5154 AT_KEYWORDS([monitor])
5155 OVS_VSWITCHD_START
5156
5157 # Start a monitor, use the required protocol version
5158 ovs-ofctl -O OpenFlow14 monitor br0 --detach --no-chdir --pidfile >monitor.log 2>&1
5159 AT_CAPTURE_FILE([monitor.log])
5160
5161 # Open, Commit
5162 ovs-appctl -t ovs-ofctl ofctl/send "05 21 00 10 00 00 00 0a 00 00 00 01 00 00 00 02"
5163 ovs-appctl -t ovs-ofctl ofctl/barrier
5164 ovs-appctl -t ovs-ofctl ofctl/send "05 21 00 10 00 00 00 0a 00 00 00 01 00 04 00 01"
5165 ovs-appctl -t ovs-ofctl ofctl/barrier
5166 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
5167
5168 AT_CHECK([ofctl_strip < monitor.log], [0], [dnl
5169 send: OFPT_BUNDLE_CONTROL (OF1.4):
5170 bundle_id=0x1 type=OPEN_REQUEST flags=ordered
5171 OFPT_BUNDLE_CONTROL (OF1.4):
5172 bundle_id=0x1 type=OPEN_REPLY flags=0
5173 OFPT_BARRIER_REPLY (OF1.4):
5174 send: OFPT_BUNDLE_CONTROL (OF1.4):
5175 bundle_id=0x1 type=COMMIT_REQUEST flags=atomic
5176 OFPT_ERROR (OF1.4): OFPBFC_BAD_FLAGS
5177 OFPT_BUNDLE_CONTROL (OF1.4):
5178 bundle_id=0x1 type=COMMIT_REQUEST flags=atomic
5179 OFPT_BARRIER_REPLY (OF1.4):
5180 ])
5181
5182 OVS_VSWITCHD_STOP
5183 AT_CLEANUP
5184
5185 AT_SETUP([ofproto - bundle discard without open (OpenFlow 1.4)])
5186 AT_KEYWORDS([monitor])
5187 OVS_VSWITCHD_START
5188
5189 # Start a monitor, use the required protocol version
5190 ovs-ofctl -O OpenFlow14 monitor br0 --detach --no-chdir --pidfile >monitor.log 2>&1
5191 AT_CAPTURE_FILE([monitor.log])
5192
5193 # Discard
5194 ovs-appctl -t ovs-ofctl ofctl/send "05 21 00 10 00 00 00 0a 00 00 00 01 00 06 00 02"
5195 ovs-appctl -t ovs-ofctl ofctl/barrier
5196 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
5197
5198 AT_CHECK([ofctl_strip < monitor.log], [0], [dnl
5199 send: OFPT_BUNDLE_CONTROL (OF1.4):
5200 bundle_id=0x1 type=DISCARD_REQUEST flags=ordered
5201 OFPT_ERROR (OF1.4): OFPBFC_BAD_ID
5202 OFPT_BUNDLE_CONTROL (OF1.4):
5203 bundle_id=0x1 type=DISCARD_REQUEST flags=ordered
5204 OFPT_BARRIER_REPLY (OF1.4):
5205 ])
5206
5207 OVS_VSWITCHD_STOP
5208 AT_CLEANUP
5209
5210
5211 AT_SETUP([ofproto - bundle with multiple flow mods (OpenFlow 1.4)])
5212 OVS_VSWITCHD_START
5213
5214 AT_CHECK([ovs-appctl vlog/set vconn:dbg])
5215
5216 AT_CHECK([ovs-ofctl --no-names del-flows br0])
5217
5218 AT_DATA([flows.txt], [dnl
5219 add idle_timeout=50 in_port=2 dl_src=00:66:77:88:99:aa actions=1
5220 add idle_timeout=60 in_port=2 dl_src=00:77:88:99:aa:bb actions=2
5221 add idle_timeout=70 in_port=2 dl_src=00:88:99:aa:bb:cc actions=3
5222 add idle_timeout=50 in_port=2 dl_src=00:66:77:88:99:aa actions=4
5223 delete
5224 add idle_timeout=50 in_port=2 dl_src=00:66:77:88:99:aa actions=5
5225 add idle_timeout=60 in_port=2 dl_src=00:77:88:99:aa:bb actions=6
5226 add idle_timeout=70 in_port=2 dl_src=00:88:99:aa:bb:cc actions=7
5227 delete in_port=2 dl_src=00:88:99:aa:bb:cc
5228 ])
5229
5230 AT_CHECK([ovs-ofctl --no-names --bundle add-flows br0 flows.txt])
5231
5232 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
5233 idle_timeout=50, in_port=2,dl_src=00:66:77:88:99:aa actions=output:5
5234 idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=output:6
5235 NXST_FLOW reply:
5236 ])
5237
5238 AT_DATA([flows.txt], [dnl
5239 modify actions=drop
5240 modify_strict in_port=2 dl_src=00:77:88:99:aa:bb actions=7
5241 ])
5242
5243 AT_CHECK([ovs-ofctl --no-names --bundle add-flows br0 flows.txt])
5244
5245 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
5246 idle_timeout=50, in_port=2,dl_src=00:66:77:88:99:aa actions=drop
5247 idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=output:7
5248 NXST_FLOW reply:
5249 ])
5250
5251 # Adding an existing flow acts as a modify, and delete_strict also works.
5252 AT_DATA([flows.txt], [dnl
5253 add idle_timeout=60 in_port=2 dl_src=00:77:88:99:aa:bb actions=8
5254 delete_strict in_port=2 dl_src=00:66:77:88:99:aa
5255 add in_port=2 dl_src=00:66:77:88:99:aa actions=drop
5256 ])
5257
5258 AT_CHECK([ovs-ofctl --no-names --bundle add-flows br0 flows.txt])
5259
5260 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
5261 idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=output:8
5262 in_port=2,dl_src=00:66:77:88:99:aa actions=drop
5263 NXST_FLOW reply:
5264 ])
5265
5266 dnl Check logs for OpenFlow trace
5267 # Prevent race.
5268 OVS_WAIT_UNTIL([vconn_sub < ovs-vswitchd.log | test `grep -- "|vconn|DBG|unix: sent (Success): NXST_FLOW reply" | wc -l` -ge 3])
5269 AT_CHECK([print_vconn_debug | vconn_sub | ofctl_strip], [0], [dnl
5270 vconn|DBG|unix: sent (Success): OFPT_HELLO (OF1.6):
5271 version bitmap: 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07
5272 vconn|DBG|unix: received: OFPT_HELLO:
5273 version bitmap: 0x01
5274 vconn|DBG|unix: negotiated OpenFlow version 0x01 (we support version 0x07 and earlier, peer supports version 0x01)
5275 vconn|DBG|unix: received: OFPT_FLOW_MOD: DEL actions=drop
5276 vconn|DBG|unix: received: OFPT_BARRIER_REQUEST:
5277 vconn|DBG|unix: sent (Success): OFPT_BARRIER_REPLY:
5278 vconn|DBG|unix: sent (Success): OFPT_HELLO (OF1.6):
5279 version bitmap: 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07
5280 vconn|DBG|unix: received: OFPT_HELLO (OF1.4):
5281 version bitmap: 0x05
5282 vconn|DBG|unix: negotiated OpenFlow version 0x05 (we support version 0x07 and earlier, peer supports version 0x05)
5283 vconn|DBG|unix: received: OFPT_BUNDLE_CONTROL (OF1.4):
5284 bundle_id=0 type=OPEN_REQUEST flags=atomic ordered
5285 vconn|DBG|unix: sent (Success): OFPT_BUNDLE_CONTROL (OF1.4):
5286 bundle_id=0 type=OPEN_REPLY flags=0
5287 vconn|DBG|unix: received: OFPT_BUNDLE_ADD_MESSAGE (OF1.4):
5288 bundle_id=0 flags=atomic ordered
5289 OFPT_FLOW_MOD (OF1.4): ADD in_port=2,dl_src=00:66:77:88:99:aa idle:50 actions=output:1
5290 vconn|DBG|unix: received: OFPT_BUNDLE_ADD_MESSAGE (OF1.4):
5291 bundle_id=0 flags=atomic ordered
5292 OFPT_FLOW_MOD (OF1.4): ADD in_port=2,dl_src=00:77:88:99:aa:bb idle:60 actions=output:2
5293 vconn|DBG|unix: received: OFPT_BUNDLE_ADD_MESSAGE (OF1.4):
5294 bundle_id=0 flags=atomic ordered
5295 OFPT_FLOW_MOD (OF1.4): ADD in_port=2,dl_src=00:88:99:aa:bb:cc idle:70 actions=output:3
5296 vconn|DBG|unix: received: OFPT_BUNDLE_ADD_MESSAGE (OF1.4):
5297 bundle_id=0 flags=atomic ordered
5298 OFPT_FLOW_MOD (OF1.4): ADD in_port=2,dl_src=00:66:77:88:99:aa idle:50 actions=output:4
5299 vconn|DBG|unix: received: OFPT_BUNDLE_ADD_MESSAGE (OF1.4):
5300 bundle_id=0 flags=atomic ordered
5301 OFPT_FLOW_MOD (OF1.4): DEL table:255 actions=drop
5302 vconn|DBG|unix: received: OFPT_BUNDLE_ADD_MESSAGE (OF1.4):
5303 bundle_id=0 flags=atomic ordered
5304 OFPT_FLOW_MOD (OF1.4): ADD in_port=2,dl_src=00:66:77:88:99:aa idle:50 actions=output:5
5305 vconn|DBG|unix: received: OFPT_BUNDLE_ADD_MESSAGE (OF1.4):
5306 bundle_id=0 flags=atomic ordered
5307 OFPT_FLOW_MOD (OF1.4): ADD in_port=2,dl_src=00:77:88:99:aa:bb idle:60 actions=output:6
5308 vconn|DBG|unix: received: OFPT_BUNDLE_ADD_MESSAGE (OF1.4):
5309 bundle_id=0 flags=atomic ordered
5310 OFPT_FLOW_MOD (OF1.4): ADD in_port=2,dl_src=00:88:99:aa:bb:cc idle:70 actions=output:7
5311 vconn|DBG|unix: received: OFPT_BUNDLE_ADD_MESSAGE (OF1.4):
5312 bundle_id=0 flags=atomic ordered
5313 OFPT_FLOW_MOD (OF1.4): DEL table:255 in_port=2,dl_src=00:88:99:aa:bb:cc actions=drop
5314 vconn|DBG|unix: received: OFPT_BARRIER_REQUEST (OF1.4):
5315 vconn|DBG|unix: sent (Success): OFPT_BARRIER_REPLY (OF1.4):
5316 vconn|DBG|unix: received: OFPT_BUNDLE_CONTROL (OF1.4):
5317 bundle_id=0 type=COMMIT_REQUEST flags=atomic ordered
5318 vconn|DBG|unix: sent (Success): OFPT_BUNDLE_CONTROL (OF1.4):
5319 bundle_id=0 type=COMMIT_REPLY flags=0
5320 vconn|DBG|unix: sent (Success): OFPT_HELLO (OF1.6):
5321 version bitmap: 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07
5322 vconn|DBG|unix: received: OFPT_HELLO:
5323 version bitmap: 0x01
5324 vconn|DBG|unix: negotiated OpenFlow version 0x01 (we support version 0x07 and earlier, peer supports version 0x01)
5325 vconn|DBG|unix: received: NXT_SET_FLOW_FORMAT: format=nxm
5326 vconn|DBG|unix: received: OFPT_BARRIER_REQUEST:
5327 vconn|DBG|unix: sent (Success): OFPT_BARRIER_REPLY:
5328 vconn|DBG|unix: received: NXST_FLOW request:
5329 vconn|DBG|unix: sent (Success): NXST_FLOW reply:
5330 idle_timeout=50, in_port=2,dl_src=00:66:77:88:99:aa actions=output:5
5331 idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=output:6
5332 vconn|DBG|unix: sent (Success): OFPT_HELLO (OF1.6):
5333 version bitmap: 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07
5334 vconn|DBG|unix: received: OFPT_HELLO (OF1.4):
5335 version bitmap: 0x05
5336 vconn|DBG|unix: negotiated OpenFlow version 0x05 (we support version 0x07 and earlier, peer supports version 0x05)
5337 vconn|DBG|unix: received: OFPT_BUNDLE_CONTROL (OF1.4):
5338 bundle_id=0 type=OPEN_REQUEST flags=atomic ordered
5339 vconn|DBG|unix: sent (Success): OFPT_BUNDLE_CONTROL (OF1.4):
5340 bundle_id=0 type=OPEN_REPLY flags=0
5341 vconn|DBG|unix: received: OFPT_BUNDLE_ADD_MESSAGE (OF1.4):
5342 bundle_id=0 flags=atomic ordered
5343 OFPT_FLOW_MOD (OF1.4): MOD actions=drop
5344 vconn|DBG|unix: received: OFPT_BUNDLE_ADD_MESSAGE (OF1.4):
5345 bundle_id=0 flags=atomic ordered
5346 OFPT_FLOW_MOD (OF1.4): MOD_STRICT in_port=2,dl_src=00:77:88:99:aa:bb actions=output:7
5347 vconn|DBG|unix: received: OFPT_BARRIER_REQUEST (OF1.4):
5348 vconn|DBG|unix: sent (Success): OFPT_BARRIER_REPLY (OF1.4):
5349 vconn|DBG|unix: received: OFPT_BUNDLE_CONTROL (OF1.4):
5350 bundle_id=0 type=COMMIT_REQUEST flags=atomic ordered
5351 vconn|DBG|unix: sent (Success): OFPT_BUNDLE_CONTROL (OF1.4):
5352 bundle_id=0 type=COMMIT_REPLY flags=0
5353 vconn|DBG|unix: sent (Success): OFPT_HELLO (OF1.6):
5354 version bitmap: 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07
5355 vconn|DBG|unix: received: OFPT_HELLO:
5356 version bitmap: 0x01
5357 vconn|DBG|unix: negotiated OpenFlow version 0x01 (we support version 0x07 and earlier, peer supports version 0x01)
5358 vconn|DBG|unix: received: NXT_SET_FLOW_FORMAT: format=nxm
5359 vconn|DBG|unix: received: OFPT_BARRIER_REQUEST:
5360 vconn|DBG|unix: sent (Success): OFPT_BARRIER_REPLY:
5361 vconn|DBG|unix: received: NXST_FLOW request:
5362 vconn|DBG|unix: sent (Success): NXST_FLOW reply:
5363 idle_timeout=50, in_port=2,dl_src=00:66:77:88:99:aa actions=drop
5364 idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=output:7
5365 vconn|DBG|unix: sent (Success): OFPT_HELLO (OF1.6):
5366 version bitmap: 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07
5367 vconn|DBG|unix: received: OFPT_HELLO (OF1.4):
5368 version bitmap: 0x05
5369 vconn|DBG|unix: negotiated OpenFlow version 0x05 (we support version 0x07 and earlier, peer supports version 0x05)
5370 vconn|DBG|unix: received: OFPT_BUNDLE_CONTROL (OF1.4):
5371 bundle_id=0 type=OPEN_REQUEST flags=atomic ordered
5372 vconn|DBG|unix: sent (Success): OFPT_BUNDLE_CONTROL (OF1.4):
5373 bundle_id=0 type=OPEN_REPLY flags=0
5374 vconn|DBG|unix: received: OFPT_BUNDLE_ADD_MESSAGE (OF1.4):
5375 bundle_id=0 flags=atomic ordered
5376 OFPT_FLOW_MOD (OF1.4): ADD in_port=2,dl_src=00:77:88:99:aa:bb idle:60 actions=output:8
5377 vconn|DBG|unix: received: OFPT_BUNDLE_ADD_MESSAGE (OF1.4):
5378 bundle_id=0 flags=atomic ordered
5379 OFPT_FLOW_MOD (OF1.4): DEL_STRICT table:255 in_port=2,dl_src=00:66:77:88:99:aa actions=drop
5380 vconn|DBG|unix: received: OFPT_BUNDLE_ADD_MESSAGE (OF1.4):
5381 bundle_id=0 flags=atomic ordered
5382 OFPT_FLOW_MOD (OF1.4): ADD in_port=2,dl_src=00:66:77:88:99:aa actions=drop
5383 vconn|DBG|unix: received: OFPT_BARRIER_REQUEST (OF1.4):
5384 vconn|DBG|unix: sent (Success): OFPT_BARRIER_REPLY (OF1.4):
5385 vconn|DBG|unix: received: OFPT_BUNDLE_CONTROL (OF1.4):
5386 bundle_id=0 type=COMMIT_REQUEST flags=atomic ordered
5387 vconn|DBG|unix: sent (Success): OFPT_BUNDLE_CONTROL (OF1.4):
5388 bundle_id=0 type=COMMIT_REPLY flags=0
5389 vconn|DBG|unix: sent (Success): OFPT_HELLO (OF1.6):
5390 version bitmap: 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07
5391 vconn|DBG|unix: received: OFPT_HELLO:
5392 version bitmap: 0x01
5393 vconn|DBG|unix: negotiated OpenFlow version 0x01 (we support version 0x07 and earlier, peer supports version 0x01)
5394 vconn|DBG|unix: received: NXT_SET_FLOW_FORMAT: format=nxm
5395 vconn|DBG|unix: received: OFPT_BARRIER_REQUEST:
5396 vconn|DBG|unix: sent (Success): OFPT_BARRIER_REPLY:
5397 vconn|DBG|unix: received: NXST_FLOW request:
5398 vconn|DBG|unix: sent (Success): NXST_FLOW reply:
5399 idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=output:8
5400 in_port=2,dl_src=00:66:77:88:99:aa actions=drop
5401 ])
5402
5403 AT_CHECK([grep " flow_mods in the last " ovs-vswitchd.log | sed -e 's/^.*connmgr|INFO|//' | vconn_sub], [0], [dnl
5404 br0<->unix: 1 flow_mods in the last 0 s (1 deletes)
5405 br0<->unix: 9 flow_mods in the last 0 s (7 adds, 2 deletes)
5406 br0<->unix: 2 flow_mods in the last 0 s (2 modifications)
5407 br0<->unix: 3 flow_mods in the last 0 s (2 adds, 1 deletes)
5408 ])
5409
5410 OVS_VSWITCHD_STOP
5411 AT_CLEANUP
5412
5413
5414 AT_SETUP([ofproto - failing bundle commit (OpenFlow 1.4)])
5415 OVS_VSWITCHD_START
5416
5417 AT_CHECK([ovs-ofctl del-flows br0])
5418
5419 ovs-ofctl add-flows br0 - <<EOF
5420 idle_timeout=50 in_port=2 dl_src=00:66:77:88:99:aa actions=11
5421 idle_timeout=60 in_port=2 dl_src=00:77:88:99:aa:bb actions=22
5422 idle_timeout=70 in_port=2 dl_src=00:88:99:aa:bb:cc actions=33
5423 EOF
5424 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
5425 idle_timeout=50, in_port=2,dl_src=00:66:77:88:99:aa actions=output:11
5426 idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=output:22
5427 idle_timeout=70, in_port=2,dl_src=00:88:99:aa:bb:cc actions=output:33
5428 NXST_FLOW reply:
5429 ])
5430
5431 # last line uses illegal table number (OVS internal table)
5432 AT_DATA([flows.txt], [dnl
5433 add idle_timeout=50 in_port=2 dl_src=00:66:77:88:99:aa actions=1
5434 add idle_timeout=60 in_port=2 dl_src=00:77:88:99:aa:bb actions=2
5435 add idle_timeout=70 in_port=2 dl_src=00:88:99:aa:bb:cc actions=3
5436 modify idle_timeout=50 in_port=2 dl_src=00:66:77:88:99:aa actions=4
5437 delete
5438 add idle_timeout=50 in_port=2 dl_src=00:66:77:88:99:aa actions=5
5439 add idle_timeout=60 in_port=2 dl_src=00:77:88:99:aa:bb actions=6
5440 add idle_timeout=70 in_port=2 dl_src=00:88:99:aa:bb:cc actions=7
5441 delete in_port=2 dl_src=00:88:99:aa:bb:cc
5442 add table=254 actions=drop
5443 ])
5444
5445 AT_CHECK([ovs-ofctl --bundle add-flows br0 flows.txt 2>&1 | sed '/talking to/,$d' | strip_xids],
5446 [0], [dnl
5447 Error OFPBRC_EPERM for: OFPT_FLOW_MOD (OF1.4): ADD table:254 actions=drop
5448 ])
5449
5450 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
5451 idle_timeout=50, in_port=2,dl_src=00:66:77:88:99:aa actions=output:11
5452 idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=output:22
5453 idle_timeout=70, in_port=2,dl_src=00:88:99:aa:bb:cc actions=output:33
5454 NXST_FLOW reply:
5455 ])
5456
5457 OVS_VSWITCHD_STOP
5458 AT_CLEANUP
5459
5460
5461 AT_SETUP([ofproto - bundle timeout (OpenFlow 1.4)])
5462 AT_KEYWORDS([monitor])
5463 OVS_VSWITCHD_START
5464
5465 # Start a monitor, use the required protocol version
5466 ovs-ofctl -O OpenFlow14 monitor br0 --detach --no-chdir --pidfile >monitor.log 2>&1
5467 AT_CAPTURE_FILE([monitor.log])
5468
5469 ovs-appctl time/stop
5470
5471 # Send an OpenFlow14 message (05), OFPT_BUNDLE_CONTROL (21), length (10), xid (01)
5472 ovs-appctl -t ovs-ofctl ofctl/send "05 21 00 10 00 00 00 01 00 00 00 01 00 00 00 03"
5473 ovs-appctl time/warp 8000
5474 # Send a bundle flow mod, it should keep the bundle alive.
5475 ovs-appctl -t ovs-ofctl ofctl/send "05 22 00 a0 00 00 00 02 00 00 00 01 00 00 00 03 \
5476 05 0e 00 90 00 00 00 02 00 00 00 00 00 00 00 00 \
5477 00 00 00 00 00 00 00 00 01 00 00 00 00 00 ff ff \
5478 ff ff ff ff ff ff ff ff ff ff ff ff 00 00 00 00 \
5479 00 01 00 42 80 00 00 04 00 00 00 01 80 00 08 06 \
5480 50 54 00 00 00 06 80 00 06 06 50 54 00 00 00 05 \
5481 80 00 0a 02 08 06 80 00 0c 02 00 00 80 00 2a 02 \
5482 00 02 80 00 2c 04 c0 a8 00 02 80 00 2e 04 c0 a8 \
5483 00 01 00 00 00 00 00 00 00 04 00 18 00 00 00 00 \
5484 00 00 00 10 00 00 00 03 00 00 00 00 00 00 00 00 \
5485 "
5486 ovs-appctl time/warp 8000
5487 # Send a bundle close, it should keep the bundle alive.
5488 ovs-appctl -t ovs-ofctl ofctl/send "05 21 00 10 00 00 00 03 00 00 00 01 00 02 00 03"
5489 ovs-appctl time/warp 11000
5490 # Make sure that timeouts are processed after the expiry
5491 ovs-appctl time/warp 1000
5492 # Send a Commit, but too late.
5493 ovs-appctl -t ovs-ofctl ofctl/send "05 21 00 10 00 00 00 04 00 00 00 01 00 04 00 03"
5494 ovs-appctl -t ovs-ofctl ofctl/barrier
5495 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
5496
5497 AT_CHECK([ofctl_strip < monitor.log], [], [dnl
5498 send: OFPT_BUNDLE_CONTROL (OF1.4):
5499 bundle_id=0x1 type=OPEN_REQUEST flags=atomic ordered
5500 OFPT_BUNDLE_CONTROL (OF1.4):
5501 bundle_id=0x1 type=OPEN_REPLY flags=0
5502 send: OFPT_BUNDLE_ADD_MESSAGE (OF1.4):
5503 bundle_id=0x1 flags=atomic ordered
5504 OFPT_FLOW_MOD (OF1.4): ADD table:1 priority=65535,arp,in_port=1,vlan_tci=0x0000/0x1fff,dl_src=50:54:00:00:00:06,dl_dst=50:54:00:00:00:05,arp_spa=192.168.0.2,arp_tpa=192.168.0.1,arp_op=2 actions=output:3
5505 send: OFPT_BUNDLE_CONTROL (OF1.4):
5506 bundle_id=0x1 type=CLOSE_REQUEST flags=atomic ordered
5507 OFPT_BUNDLE_CONTROL (OF1.4):
5508 bundle_id=0x1 type=CLOSE_REPLY flags=0
5509 OFPT_ERROR (OF1.4): OFPBFC_TIMEOUT
5510 OFPT_BUNDLE_CONTROL (OF1.4):
5511 bundle_id=0x1 type=OPEN_REQUEST flags=atomic ordered
5512 send: OFPT_BUNDLE_CONTROL (OF1.4):
5513 bundle_id=0x1 type=COMMIT_REQUEST flags=atomic ordered
5514 OFPT_ERROR (OF1.4): OFPBFC_BAD_ID
5515 OFPT_BUNDLE_CONTROL (OF1.4):
5516 bundle_id=0x1 type=COMMIT_REQUEST flags=atomic ordered
5517 OFPT_BARRIER_REPLY (OF1.4):
5518 ])
5519
5520 OVS_VSWITCHD_STOP
5521 AT_CLEANUP
5522
5523 AT_SETUP([ofproto - bundle custom timeout (OpenFlow 1.4)])
5524 AT_KEYWORDS([monitor])
5525 OVS_VSWITCHD_START
5526
5527 AT_CHECK([ovs-vsctl set Open_vSwitch . other_config:bundle-idle-timeout=4])
5528
5529 # Start a monitor, use the required protocol version
5530 ovs-ofctl -O OpenFlow14 monitor br0 --detach --no-chdir --pidfile >monitor.log 2>&1
5531 AT_CAPTURE_FILE([monitor.log])
5532
5533 ovs-appctl time/stop
5534
5535 # Send an OpenFlow14 message (05), OFPT_BUNDLE_CONTROL (21), length (10), xid (01)
5536 ovs-appctl -t ovs-ofctl ofctl/send "05 21 00 10 00 00 00 01 00 00 00 01 00 00 00 03"
5537 ovs-appctl time/warp 2000
5538 # Send a bundle flow mod, it should keep the bundle alive.
5539 ovs-appctl -t ovs-ofctl ofctl/send "05 22 00 a0 00 00 00 02 00 00 00 01 00 00 00 03 \
5540 05 0e 00 90 00 00 00 02 00 00 00 00 00 00 00 00 \
5541 00 00 00 00 00 00 00 00 01 00 00 00 00 00 ff ff \
5542 ff ff ff ff ff ff ff ff ff ff ff ff 00 00 00 00 \
5543 00 01 00 42 80 00 00 04 00 00 00 01 80 00 08 06 \
5544 50 54 00 00 00 06 80 00 06 06 50 54 00 00 00 05 \
5545 80 00 0a 02 08 06 80 00 0c 02 00 00 80 00 2a 02 \
5546 00 02 80 00 2c 04 c0 a8 00 02 80 00 2e 04 c0 a8 \
5547 00 01 00 00 00 00 00 00 00 04 00 18 00 00 00 00 \
5548 00 00 00 10 00 00 00 03 00 00 00 00 00 00 00 00 \
5549 "
5550 ovs-appctl time/warp 2000
5551 # Send a bundle close, it should keep the bundle alive.
5552 ovs-appctl -t ovs-ofctl ofctl/send "05 21 00 10 00 00 00 03 00 00 00 01 00 02 00 03"
5553 ovs-appctl time/warp 4000
5554 # Make sure that timeouts are processed after the expiry, but still before the
5555 # current timeout of 4s.
5556 ovs-appctl time/warp 1000
5557 # Send a Commit, but too late.
5558 ovs-appctl -t ovs-ofctl ofctl/send "05 21 00 10 00 00 00 04 00 00 00 01 00 04 00 03"
5559 ovs-appctl -t ovs-ofctl ofctl/barrier
5560 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
5561
5562 AT_CHECK([ofctl_strip < monitor.log], [], [dnl
5563 send: OFPT_BUNDLE_CONTROL (OF1.4):
5564 bundle_id=0x1 type=OPEN_REQUEST flags=atomic ordered
5565 OFPT_BUNDLE_CONTROL (OF1.4):
5566 bundle_id=0x1 type=OPEN_REPLY flags=0
5567 send: OFPT_BUNDLE_ADD_MESSAGE (OF1.4):
5568 bundle_id=0x1 flags=atomic ordered
5569 OFPT_FLOW_MOD (OF1.4): ADD table:1 priority=65535,arp,in_port=1,vlan_tci=0x0000/0x1fff,dl_src=50:54:00:00:00:06,dl_dst=50:54:00:00:00:05,arp_spa=192.168.0.2,arp_tpa=192.168.0.1,arp_op=2 actions=output:3
5570 send: OFPT_BUNDLE_CONTROL (OF1.4):
5571 bundle_id=0x1 type=CLOSE_REQUEST flags=atomic ordered
5572 OFPT_BUNDLE_CONTROL (OF1.4):
5573 bundle_id=0x1 type=CLOSE_REPLY flags=0
5574 OFPT_ERROR (OF1.4): OFPBFC_TIMEOUT
5575 OFPT_BUNDLE_CONTROL (OF1.4):
5576 bundle_id=0x1 type=OPEN_REQUEST flags=atomic ordered
5577 send: OFPT_BUNDLE_CONTROL (OF1.4):
5578 bundle_id=0x1 type=COMMIT_REQUEST flags=atomic ordered
5579 OFPT_ERROR (OF1.4): OFPBFC_BAD_ID
5580 OFPT_BUNDLE_CONTROL (OF1.4):
5581 bundle_id=0x1 type=COMMIT_REQUEST flags=atomic ordered
5582 OFPT_BARRIER_REPLY (OF1.4):
5583 ])
5584
5585 OVS_VSWITCHD_STOP
5586 AT_CLEANUP
5587
5588 AT_SETUP([ofproto - bundle reset timeout to default (OpenFlow 1.4)])
5589 AT_KEYWORDS([monitor])
5590 OVS_VSWITCHD_START
5591
5592 AT_CHECK([ovs-vsctl set Open_vSwitch . other_config:bundle-idle-timeout=15])
5593 AT_CHECK([ovs-vsctl remove Open_vSwitch . other_config bundle-idle-timeout])
5594
5595 # Start a monitor, use the required protocol version
5596 ovs-ofctl -O OpenFlow14 monitor br0 --detach --no-chdir --pidfile >monitor.log 2>&1
5597 AT_CAPTURE_FILE([monitor.log])
5598
5599 ovs-appctl time/stop
5600
5601 # Send an OpenFlow14 message (05), OFPT_BUNDLE_CONTROL (21), length (10), xid (01)
5602 ovs-appctl -t ovs-ofctl ofctl/send "05 21 00 10 00 00 00 01 00 00 00 01 00 00 00 03"
5603 ovs-appctl time/warp 8000
5604 # Send a bundle flow mod, it should keep the bundle alive.
5605 ovs-appctl -t ovs-ofctl ofctl/send "05 22 00 a0 00 00 00 02 00 00 00 01 00 00 00 03 \
5606 05 0e 00 90 00 00 00 02 00 00 00 00 00 00 00 00 \
5607 00 00 00 00 00 00 00 00 01 00 00 00 00 00 ff ff \
5608 ff ff ff ff ff ff ff ff ff ff ff ff 00 00 00 00 \
5609 00 01 00 42 80 00 00 04 00 00 00 01 80 00 08 06 \
5610 50 54 00 00 00 06 80 00 06 06 50 54 00 00 00 05 \
5611 80 00 0a 02 08 06 80 00 0c 02 00 00 80 00 2a 02 \
5612 00 02 80 00 2c 04 c0 a8 00 02 80 00 2e 04 c0 a8 \
5613 00 01 00 00 00 00 00 00 00 04 00 18 00 00 00 00 \
5614 00 00 00 10 00 00 00 03 00 00 00 00 00 00 00 00 \
5615 "
5616 ovs-appctl time/warp 8000
5617 # Send a bundle close, it should keep the bundle alive.
5618 ovs-appctl -t ovs-ofctl ofctl/send "05 21 00 10 00 00 00 03 00 00 00 01 00 02 00 03"
5619 ovs-appctl time/warp 11000
5620 # Make sure that timeouts are processed after the expiry
5621 ovs-appctl time/warp 1000
5622 # Send a Commit, but too late.
5623 ovs-appctl -t ovs-ofctl ofctl/send "05 21 00 10 00 00 00 04 00 00 00 01 00 04 00 03"
5624 ovs-appctl -t ovs-ofctl ofctl/barrier
5625 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
5626
5627 AT_CHECK([ofctl_strip < monitor.log], [], [dnl
5628 send: OFPT_BUNDLE_CONTROL (OF1.4):
5629 bundle_id=0x1 type=OPEN_REQUEST flags=atomic ordered
5630 OFPT_BUNDLE_CONTROL (OF1.4):
5631 bundle_id=0x1 type=OPEN_REPLY flags=0
5632 send: OFPT_BUNDLE_ADD_MESSAGE (OF1.4):
5633 bundle_id=0x1 flags=atomic ordered
5634 OFPT_FLOW_MOD (OF1.4): ADD table:1 priority=65535,arp,in_port=1,vlan_tci=0x0000/0x1fff,dl_src=50:54:00:00:00:06,dl_dst=50:54:00:00:00:05,arp_spa=192.168.0.2,arp_tpa=192.168.0.1,arp_op=2 actions=output:3
5635 send: OFPT_BUNDLE_CONTROL (OF1.4):
5636 bundle_id=0x1 type=CLOSE_REQUEST flags=atomic ordered
5637 OFPT_BUNDLE_CONTROL (OF1.4):
5638 bundle_id=0x1 type=CLOSE_REPLY flags=0
5639 OFPT_ERROR (OF1.4): OFPBFC_TIMEOUT
5640 OFPT_BUNDLE_CONTROL (OF1.4):
5641 bundle_id=0x1 type=OPEN_REQUEST flags=atomic ordered
5642 send: OFPT_BUNDLE_CONTROL (OF1.4):
5643 bundle_id=0x1 type=COMMIT_REQUEST flags=atomic ordered
5644 OFPT_ERROR (OF1.4): OFPBFC_BAD_ID
5645 OFPT_BUNDLE_CONTROL (OF1.4):
5646 bundle_id=0x1 type=COMMIT_REQUEST flags=atomic ordered
5647 OFPT_BARRIER_REPLY (OF1.4):
5648 ])
5649
5650 OVS_VSWITCHD_STOP
5651 AT_CLEANUP
5652
5653 AT_SETUP([ofproto - bundle open (OpenFlow 1.3)])
5654 AT_KEYWORDS([monitor])
5655 OVS_VSWITCHD_START
5656
5657 # Start a monitor, use the required protocol version
5658 ovs-ofctl -O OpenFlow13 monitor br0 --detach --no-chdir --pidfile >monitor.log 2>&1
5659 AT_CAPTURE_FILE([monitor.log])
5660
5661 # Send an OpenFlow13 message (04), OFPT_EXPERIMENTER (04), length (0018),
5662 # xid (0000000a), ONF_EXPERIMENTER_ID (4F4E4600),
5663 # ONFT_BUNDLE_CONTROL (2300 = 0x08FC), bundle id (00000001),
5664 # message type (0000), and flags (0002)
5665 ovs-appctl -t ovs-ofctl ofctl/send "04 04 00 18 00 00 00 0a 4F 4E 46 00 00 00 08 FC 00 00 00 01 00 00 00 02"
5666 ovs-appctl -t ovs-ofctl ofctl/barrier
5667 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
5668
5669 AT_CHECK([ofctl_strip < monitor.log], [], [dnl
5670 send: ONFT_BUNDLE_CONTROL (OF1.3):
5671 bundle_id=0x1 type=OPEN_REQUEST flags=ordered
5672 ONFT_BUNDLE_CONTROL (OF1.3):
5673 bundle_id=0x1 type=OPEN_REPLY flags=0
5674 OFPT_BARRIER_REPLY (OF1.3):
5675 ])
5676
5677 OVS_VSWITCHD_STOP
5678 AT_CLEANUP
5679
5680 AT_SETUP([ofproto - bundle double open (OpenFlow 1.3)])
5681 AT_KEYWORDS([monitor])
5682 OVS_VSWITCHD_START
5683
5684 # Start a monitor, use the required protocol version
5685 ovs-ofctl -O OpenFlow13 monitor br0 --detach --no-chdir --pidfile >monitor.log 2>&1
5686 AT_CAPTURE_FILE([monitor.log])
5687
5688 # Send twice an OpenFlow13 message (04), OFPT_EXPERIMENTER (04), length (0018),
5689 # xid (0000000a), ONF_EXPERIMENTER_ID (4F4E4600),
5690 # ONFT_BUNDLE_CONTROL (2300 = 0x08FC), bundle id (00000001),
5691 # message type (0000), and flags (0002)
5692 ovs-appctl -t ovs-ofctl ofctl/send "04 04 00 18 00 00 00 0a 4F 4E 46 00 00 00 08 FC 00 00 00 01 00 00 00 02"
5693 ovs-appctl -t ovs-ofctl ofctl/barrier
5694 ovs-appctl -t ovs-ofctl ofctl/send "04 04 00 18 00 00 00 0a 4F 4E 46 00 00 00 08 FC 00 00 00 01 00 00 00 02"
5695 ovs-appctl -t ovs-ofctl ofctl/barrier
5696 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
5697
5698 AT_CHECK([ofctl_strip < monitor.log], [0], [dnl
5699 send: ONFT_BUNDLE_CONTROL (OF1.3):
5700 bundle_id=0x1 type=OPEN_REQUEST flags=ordered
5701 ONFT_BUNDLE_CONTROL (OF1.3):
5702 bundle_id=0x1 type=OPEN_REPLY flags=0
5703 OFPT_BARRIER_REPLY (OF1.3):
5704 send: ONFT_BUNDLE_CONTROL (OF1.3):
5705 bundle_id=0x1 type=OPEN_REQUEST flags=ordered
5706 OFPT_ERROR (OF1.3): OFPBFC_BAD_ID
5707 ONFT_BUNDLE_CONTROL (OF1.3):
5708 bundle_id=0x1 type=OPEN_REQUEST flags=ordered
5709 OFPT_BARRIER_REPLY (OF1.3):
5710 ])
5711
5712 OVS_VSWITCHD_STOP
5713 AT_CLEANUP
5714
5715 AT_SETUP([ofproto - bundle close without open (OpenFlow 1.3)])
5716 AT_KEYWORDS([monitor])
5717 OVS_VSWITCHD_START
5718
5719 # Start a monitor, use the required protocol version
5720 ovs-ofctl -O OpenFlow13 monitor br0 --detach --no-chdir --pidfile >monitor.log 2>&1
5721 AT_CAPTURE_FILE([monitor.log])
5722
5723 ovs-appctl -t ovs-ofctl ofctl/send "04 04 00 18 00 00 00 0a 4F 4E 46 00 00 00 08 FC 00 00 00 01 00 02 00 02"
5724 ovs-appctl -t ovs-ofctl ofctl/barrier
5725 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
5726
5727 AT_CHECK([ofctl_strip < monitor.log], [0], [dnl
5728 send: ONFT_BUNDLE_CONTROL (OF1.3):
5729 bundle_id=0x1 type=CLOSE_REQUEST flags=ordered
5730 OFPT_ERROR (OF1.3): OFPBFC_BAD_ID
5731 ONFT_BUNDLE_CONTROL (OF1.3):
5732 bundle_id=0x1 type=CLOSE_REQUEST flags=ordered
5733 OFPT_BARRIER_REPLY (OF1.3):
5734 ])
5735
5736 OVS_VSWITCHD_STOP
5737 AT_CLEANUP
5738
5739 AT_SETUP([ofproto - bundle double close (OpenFlow 1.3)])
5740 AT_KEYWORDS([monitor])
5741 OVS_VSWITCHD_START
5742
5743 # Start a monitor, use the required protocol version
5744 ovs-ofctl -O OpenFlow13 monitor br0 --detach --no-chdir --pidfile >monitor.log 2>&1
5745 AT_CAPTURE_FILE([monitor.log])
5746
5747 # Open, Close, Close
5748 ovs-appctl -t ovs-ofctl ofctl/send "04 04 00 18 00 00 00 0a 4F 4E 46 00 00 00 08 FC 00 00 00 01 00 00 00 02"
5749 ovs-appctl -t ovs-ofctl ofctl/barrier
5750 ovs-appctl -t ovs-ofctl ofctl/send "04 04 00 18 00 00 00 0a 4F 4E 46 00 00 00 08 FC 00 00 00 01 00 02 00 02"
5751 ovs-appctl -t ovs-ofctl ofctl/barrier
5752 ovs-appctl -t ovs-ofctl ofctl/send "04 04 00 18 00 00 00 0a 4F 4E 46 00 00 00 08 FC 00 00 00 01 00 02 00 02"
5753 ovs-appctl -t ovs-ofctl ofctl/barrier
5754 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
5755
5756 AT_CHECK([ofctl_strip < monitor.log], [0], [dnl
5757 send: ONFT_BUNDLE_CONTROL (OF1.3):
5758 bundle_id=0x1 type=OPEN_REQUEST flags=ordered
5759 ONFT_BUNDLE_CONTROL (OF1.3):
5760 bundle_id=0x1 type=OPEN_REPLY flags=0
5761 OFPT_BARRIER_REPLY (OF1.3):
5762 send: ONFT_BUNDLE_CONTROL (OF1.3):
5763 bundle_id=0x1 type=CLOSE_REQUEST flags=ordered
5764 ONFT_BUNDLE_CONTROL (OF1.3):
5765 bundle_id=0x1 type=CLOSE_REPLY flags=0
5766 OFPT_BARRIER_REPLY (OF1.3):
5767 send: ONFT_BUNDLE_CONTROL (OF1.3):
5768 bundle_id=0x1 type=CLOSE_REQUEST flags=ordered
5769 OFPT_ERROR (OF1.3): OFPBFC_BUNDLE_CLOSED
5770 ONFT_BUNDLE_CONTROL (OF1.3):
5771 bundle_id=0x1 type=CLOSE_REQUEST flags=ordered
5772 OFPT_BARRIER_REPLY (OF1.3):
5773 ])
5774
5775 OVS_VSWITCHD_STOP
5776 AT_CLEANUP
5777
5778 AT_SETUP([ofproto - bundle close, different flags (OpenFlow 1.3)])
5779 AT_KEYWORDS([monitor])
5780 OVS_VSWITCHD_START
5781
5782 # Start a monitor, use the required protocol version
5783 ovs-ofctl -O OpenFlow13 monitor br0 --detach --no-chdir --pidfile >monitor.log 2>&1
5784 AT_CAPTURE_FILE([monitor.log])
5785
5786 # Open, Close
5787 ovs-appctl -t ovs-ofctl ofctl/send "04 04 00 18 00 00 00 0a 4F 4E 46 00 00 00 08 FC 00 00 00 01 00 00 00 02"
5788 ovs-appctl -t ovs-ofctl ofctl/barrier
5789 ovs-appctl -t ovs-ofctl ofctl/send "04 04 00 18 00 00 00 0a 4F 4E 46 00 00 00 08 FC 00 00 00 01 00 02 00 01"
5790 ovs-appctl -t ovs-ofctl ofctl/barrier
5791 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
5792
5793 AT_CHECK([ofctl_strip < monitor.log], [0], [dnl
5794 send: ONFT_BUNDLE_CONTROL (OF1.3):
5795 bundle_id=0x1 type=OPEN_REQUEST flags=ordered
5796 ONFT_BUNDLE_CONTROL (OF1.3):
5797 bundle_id=0x1 type=OPEN_REPLY flags=0
5798 OFPT_BARRIER_REPLY (OF1.3):
5799 send: ONFT_BUNDLE_CONTROL (OF1.3):
5800 bundle_id=0x1 type=CLOSE_REQUEST flags=atomic
5801 OFPT_ERROR (OF1.3): OFPBFC_BAD_FLAGS
5802 ONFT_BUNDLE_CONTROL (OF1.3):
5803 bundle_id=0x1 type=CLOSE_REQUEST flags=atomic
5804 OFPT_BARRIER_REPLY (OF1.3):
5805 ])
5806
5807 OVS_VSWITCHD_STOP
5808 AT_CLEANUP
5809
5810 AT_SETUP([ofproto - bundle commit without open (OpenFlow 1.3)])
5811 AT_KEYWORDS([monitor])
5812 OVS_VSWITCHD_START
5813
5814 # Start a monitor, use the required protocol version
5815 ovs-ofctl -O OpenFlow13 monitor br0 --detach --no-chdir --pidfile >monitor.log 2>&1
5816 AT_CAPTURE_FILE([monitor.log])
5817
5818 # Commit
5819 ovs-appctl -t ovs-ofctl ofctl/send "04 04 00 18 00 00 00 0a 4F 4E 46 00 00 00 08 FC 00 00 00 01 00 04 00 02"
5820 ovs-appctl -t ovs-ofctl ofctl/barrier
5821 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
5822
5823 AT_CHECK([ofctl_strip < monitor.log], [0], [dnl
5824 send: ONFT_BUNDLE_CONTROL (OF1.3):
5825 bundle_id=0x1 type=COMMIT_REQUEST flags=ordered
5826 OFPT_ERROR (OF1.3): OFPBFC_BAD_ID
5827 ONFT_BUNDLE_CONTROL (OF1.3):
5828 bundle_id=0x1 type=COMMIT_REQUEST flags=ordered
5829 OFPT_BARRIER_REPLY (OF1.3):
5830 ])
5831
5832 OVS_VSWITCHD_STOP
5833 AT_CLEANUP
5834
5835 AT_SETUP([ofproto - bundle commit, different flags (OpenFlow 1.3)])
5836 AT_KEYWORDS([monitor])
5837 OVS_VSWITCHD_START
5838
5839 # Start a monitor, use the required protocol version
5840 ovs-ofctl -O OpenFlow13 monitor br0 --detach --no-chdir --pidfile >monitor.log 2>&1
5841 AT_CAPTURE_FILE([monitor.log])
5842
5843 # Open, Commit
5844 ovs-appctl -t ovs-ofctl ofctl/send "04 04 00 18 00 00 00 0a 4F 4E 46 00 00 00 08 FC 00 00 00 01 00 00 00 02"
5845 ovs-appctl -t ovs-ofctl ofctl/barrier
5846 ovs-appctl -t ovs-ofctl ofctl/send "04 04 00 18 00 00 00 0a 4F 4E 46 00 00 00 08 FC 00 00 00 01 00 04 00 01"
5847 ovs-appctl -t ovs-ofctl ofctl/barrier
5848 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
5849
5850 AT_CHECK([ofctl_strip < monitor.log], [0], [dnl
5851 send: ONFT_BUNDLE_CONTROL (OF1.3):
5852 bundle_id=0x1 type=OPEN_REQUEST flags=ordered
5853 ONFT_BUNDLE_CONTROL (OF1.3):
5854 bundle_id=0x1 type=OPEN_REPLY flags=0
5855 OFPT_BARRIER_REPLY (OF1.3):
5856 send: ONFT_BUNDLE_CONTROL (OF1.3):
5857 bundle_id=0x1 type=COMMIT_REQUEST flags=atomic
5858 OFPT_ERROR (OF1.3): OFPBFC_BAD_FLAGS
5859 ONFT_BUNDLE_CONTROL (OF1.3):
5860 bundle_id=0x1 type=COMMIT_REQUEST flags=atomic
5861 OFPT_BARRIER_REPLY (OF1.3):
5862 ])
5863
5864 OVS_VSWITCHD_STOP
5865 AT_CLEANUP
5866
5867 AT_SETUP([ofproto - bundle discard without open (OpenFlow 1.3)])
5868 AT_KEYWORDS([monitor])
5869 OVS_VSWITCHD_START
5870
5871 # Start a monitor, use the required protocol version
5872 ovs-ofctl -O OpenFlow13 monitor br0 --detach --no-chdir --pidfile >monitor.log 2>&1
5873 AT_CAPTURE_FILE([monitor.log])
5874
5875 # Discard
5876 ovs-appctl -t ovs-ofctl ofctl/send "04 04 00 18 00 00 00 0a 4F 4E 46 00 00 00 08 FC 00 00 00 01 00 06 00 02"
5877 ovs-appctl -t ovs-ofctl ofctl/barrier
5878 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
5879
5880 AT_CHECK([ofctl_strip < monitor.log], [0], [dnl
5881 send: ONFT_BUNDLE_CONTROL (OF1.3):
5882 bundle_id=0x1 type=DISCARD_REQUEST flags=ordered
5883 OFPT_ERROR (OF1.3): OFPBFC_BAD_ID
5884 ONFT_BUNDLE_CONTROL (OF1.3):
5885 bundle_id=0x1 type=DISCARD_REQUEST flags=ordered
5886 OFPT_BARRIER_REPLY (OF1.3):
5887 ])
5888
5889 OVS_VSWITCHD_STOP
5890 AT_CLEANUP
5891
5892
5893 AT_SETUP([ofproto - bundle with multiple flow mods (OpenFlow 1.3)])
5894 OVS_VSWITCHD_START
5895
5896 AT_CHECK([ovs-appctl vlog/set vconn:dbg])
5897
5898 AT_CHECK([ovs-ofctl --no-names del-flows br0])
5899
5900 AT_DATA([flows.txt], [dnl
5901 add idle_timeout=50 in_port=2 dl_src=00:66:77:88:99:aa actions=1
5902 add idle_timeout=60 in_port=2 dl_src=00:77:88:99:aa:bb actions=2
5903 add idle_timeout=70 in_port=2 dl_src=00:88:99:aa:bb:cc actions=3
5904 add idle_timeout=50 in_port=2 dl_src=00:66:77:88:99:aa actions=4
5905 delete
5906 add idle_timeout=50 in_port=2 dl_src=00:66:77:88:99:aa actions=5
5907 add idle_timeout=60 in_port=2 dl_src=00:77:88:99:aa:bb actions=6
5908 add idle_timeout=70 in_port=2 dl_src=00:88:99:aa:bb:cc actions=7
5909 delete in_port=2 dl_src=00:88:99:aa:bb:cc
5910 ])
5911
5912 AT_CHECK([ovs-ofctl -O OpenFlow13 --no-names --bundle add-flows br0 flows.txt])
5913
5914 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
5915 idle_timeout=50, in_port=2,dl_src=00:66:77:88:99:aa actions=output:5
5916 idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=output:6
5917 NXST_FLOW reply:
5918 ])
5919
5920 AT_DATA([flows.txt], [dnl
5921 modify actions=drop
5922 modify_strict in_port=2 dl_src=00:77:88:99:aa:bb actions=7
5923 ])
5924
5925 AT_CHECK([ovs-ofctl -O OpenFlow13 --no-names --bundle add-flows br0 flows.txt])
5926
5927 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
5928 idle_timeout=50, in_port=2,dl_src=00:66:77:88:99:aa actions=drop
5929 idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=output:7
5930 NXST_FLOW reply:
5931 ])
5932
5933 # Adding an existing flow acts as a modify, and delete_strict also works.
5934 AT_DATA([flows.txt], [dnl
5935 add idle_timeout=60 in_port=2 dl_src=00:77:88:99:aa:bb actions=8
5936 delete_strict in_port=2 dl_src=00:66:77:88:99:aa
5937 add in_port=2 dl_src=00:66:77:88:99:aa actions=drop
5938 ])
5939
5940 AT_CHECK([ovs-ofctl -O OpenFlow13 --bundle --no-names add-flows br0 flows.txt])
5941
5942 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
5943 idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=output:8
5944 in_port=2,dl_src=00:66:77:88:99:aa actions=drop
5945 NXST_FLOW reply:
5946 ])
5947
5948 dnl Check logs for OpenFlow trace
5949 # Prevent race.
5950 OVS_WAIT_UNTIL([vconn_sub < ovs-vswitchd.log | test `grep -- "|vconn|DBG|unix: sent (Success): NXST_FLOW reply" | wc -l` -ge 3])
5951 AT_CHECK([print_vconn_debug | vconn_sub | ofctl_strip], [0], [dnl
5952 vconn|DBG|unix: sent (Success): OFPT_HELLO (OF1.6):
5953 version bitmap: 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07
5954 vconn|DBG|unix: received: OFPT_HELLO:
5955 version bitmap: 0x01
5956 vconn|DBG|unix: negotiated OpenFlow version 0x01 (we support version 0x07 and earlier, peer supports version 0x01)
5957 vconn|DBG|unix: received: OFPT_FLOW_MOD: DEL actions=drop
5958 vconn|DBG|unix: received: OFPT_BARRIER_REQUEST:
5959 vconn|DBG|unix: sent (Success): OFPT_BARRIER_REPLY:
5960 vconn|DBG|unix: sent (Success): OFPT_HELLO (OF1.6):
5961 version bitmap: 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07
5962 vconn|DBG|unix: received: OFPT_HELLO (OF1.3):
5963 version bitmap: 0x04
5964 vconn|DBG|unix: negotiated OpenFlow version 0x04 (we support version 0x07 and earlier, peer supports version 0x04)
5965 vconn|DBG|unix: received: ONFT_BUNDLE_CONTROL (OF1.3):
5966 bundle_id=0 type=OPEN_REQUEST flags=atomic ordered
5967 vconn|DBG|unix: sent (Success): ONFT_BUNDLE_CONTROL (OF1.3):
5968 bundle_id=0 type=OPEN_REPLY flags=0
5969 vconn|DBG|unix: received: ONFT_BUNDLE_ADD_MESSAGE (OF1.3):
5970 bundle_id=0 flags=atomic ordered
5971 OFPT_FLOW_MOD (OF1.3): ADD in_port=2,dl_src=00:66:77:88:99:aa idle:50 actions=output:1
5972 vconn|DBG|unix: received: ONFT_BUNDLE_ADD_MESSAGE (OF1.3):
5973 bundle_id=0 flags=atomic ordered
5974 OFPT_FLOW_MOD (OF1.3): ADD in_port=2,dl_src=00:77:88:99:aa:bb idle:60 actions=output:2
5975 vconn|DBG|unix: received: ONFT_BUNDLE_ADD_MESSAGE (OF1.3):
5976 bundle_id=0 flags=atomic ordered
5977 OFPT_FLOW_MOD (OF1.3): ADD in_port=2,dl_src=00:88:99:aa:bb:cc idle:70 actions=output:3
5978 vconn|DBG|unix: received: ONFT_BUNDLE_ADD_MESSAGE (OF1.3):
5979 bundle_id=0 flags=atomic ordered
5980 OFPT_FLOW_MOD (OF1.3): ADD in_port=2,dl_src=00:66:77:88:99:aa idle:50 actions=output:4
5981 vconn|DBG|unix: received: ONFT_BUNDLE_ADD_MESSAGE (OF1.3):
5982 bundle_id=0 flags=atomic ordered
5983 OFPT_FLOW_MOD (OF1.3): DEL table:255 actions=drop
5984 vconn|DBG|unix: received: ONFT_BUNDLE_ADD_MESSAGE (OF1.3):
5985 bundle_id=0 flags=atomic ordered
5986 OFPT_FLOW_MOD (OF1.3): ADD in_port=2,dl_src=00:66:77:88:99:aa idle:50 actions=output:5
5987 vconn|DBG|unix: received: ONFT_BUNDLE_ADD_MESSAGE (OF1.3):
5988 bundle_id=0 flags=atomic ordered
5989 OFPT_FLOW_MOD (OF1.3): ADD in_port=2,dl_src=00:77:88:99:aa:bb idle:60 actions=output:6
5990 vconn|DBG|unix: received: ONFT_BUNDLE_ADD_MESSAGE (OF1.3):
5991 bundle_id=0 flags=atomic ordered
5992 OFPT_FLOW_MOD (OF1.3): ADD in_port=2,dl_src=00:88:99:aa:bb:cc idle:70 actions=output:7
5993 vconn|DBG|unix: received: ONFT_BUNDLE_ADD_MESSAGE (OF1.3):
5994 bundle_id=0 flags=atomic ordered
5995 OFPT_FLOW_MOD (OF1.3): DEL table:255 in_port=2,dl_src=00:88:99:aa:bb:cc actions=drop
5996 vconn|DBG|unix: received: OFPT_BARRIER_REQUEST (OF1.3):
5997 vconn|DBG|unix: sent (Success): OFPT_BARRIER_REPLY (OF1.3):
5998 vconn|DBG|unix: received: ONFT_BUNDLE_CONTROL (OF1.3):
5999 bundle_id=0 type=COMMIT_REQUEST flags=atomic ordered
6000 vconn|DBG|unix: sent (Success): ONFT_BUNDLE_CONTROL (OF1.3):
6001 bundle_id=0 type=COMMIT_REPLY flags=0
6002 vconn|DBG|unix: sent (Success): OFPT_HELLO (OF1.6):
6003 version bitmap: 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07
6004 vconn|DBG|unix: received: OFPT_HELLO:
6005 version bitmap: 0x01
6006 vconn|DBG|unix: negotiated OpenFlow version 0x01 (we support version 0x07 and earlier, peer supports version 0x01)
6007 vconn|DBG|unix: received: NXT_SET_FLOW_FORMAT: format=nxm
6008 vconn|DBG|unix: received: OFPT_BARRIER_REQUEST:
6009 vconn|DBG|unix: sent (Success): OFPT_BARRIER_REPLY:
6010 vconn|DBG|unix: received: NXST_FLOW request:
6011 vconn|DBG|unix: sent (Success): NXST_FLOW reply:
6012 idle_timeout=50, in_port=2,dl_src=00:66:77:88:99:aa actions=output:5
6013 idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=output:6
6014 vconn|DBG|unix: sent (Success): OFPT_HELLO (OF1.6):
6015 version bitmap: 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07
6016 vconn|DBG|unix: received: OFPT_HELLO (OF1.3):
6017 version bitmap: 0x04
6018 vconn|DBG|unix: negotiated OpenFlow version 0x04 (we support version 0x07 and earlier, peer supports version 0x04)
6019 vconn|DBG|unix: received: ONFT_BUNDLE_CONTROL (OF1.3):
6020 bundle_id=0 type=OPEN_REQUEST flags=atomic ordered
6021 vconn|DBG|unix: sent (Success): ONFT_BUNDLE_CONTROL (OF1.3):
6022 bundle_id=0 type=OPEN_REPLY flags=0
6023 vconn|DBG|unix: received: ONFT_BUNDLE_ADD_MESSAGE (OF1.3):
6024 bundle_id=0 flags=atomic ordered
6025 OFPT_FLOW_MOD (OF1.3): MOD actions=drop
6026 vconn|DBG|unix: received: ONFT_BUNDLE_ADD_MESSAGE (OF1.3):
6027 bundle_id=0 flags=atomic ordered
6028 OFPT_FLOW_MOD (OF1.3): MOD_STRICT in_port=2,dl_src=00:77:88:99:aa:bb actions=output:7
6029 vconn|DBG|unix: received: OFPT_BARRIER_REQUEST (OF1.3):
6030 vconn|DBG|unix: sent (Success): OFPT_BARRIER_REPLY (OF1.3):
6031 vconn|DBG|unix: received: ONFT_BUNDLE_CONTROL (OF1.3):
6032 bundle_id=0 type=COMMIT_REQUEST flags=atomic ordered
6033 vconn|DBG|unix: sent (Success): ONFT_BUNDLE_CONTROL (OF1.3):
6034 bundle_id=0 type=COMMIT_REPLY flags=0
6035 vconn|DBG|unix: sent (Success): OFPT_HELLO (OF1.6):
6036 version bitmap: 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07
6037 vconn|DBG|unix: received: OFPT_HELLO:
6038 version bitmap: 0x01
6039 vconn|DBG|unix: negotiated OpenFlow version 0x01 (we support version 0x07 and earlier, peer supports version 0x01)
6040 vconn|DBG|unix: received: NXT_SET_FLOW_FORMAT: format=nxm
6041 vconn|DBG|unix: received: OFPT_BARRIER_REQUEST:
6042 vconn|DBG|unix: sent (Success): OFPT_BARRIER_REPLY:
6043 vconn|DBG|unix: received: NXST_FLOW request:
6044 vconn|DBG|unix: sent (Success): NXST_FLOW reply:
6045 idle_timeout=50, in_port=2,dl_src=00:66:77:88:99:aa actions=drop
6046 idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=output:7
6047 vconn|DBG|unix: sent (Success): OFPT_HELLO (OF1.6):
6048 version bitmap: 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07
6049 vconn|DBG|unix: received: OFPT_HELLO (OF1.3):
6050 version bitmap: 0x04
6051 vconn|DBG|unix: negotiated OpenFlow version 0x04 (we support version 0x07 and earlier, peer supports version 0x04)
6052 vconn|DBG|unix: received: ONFT_BUNDLE_CONTROL (OF1.3):
6053 bundle_id=0 type=OPEN_REQUEST flags=atomic ordered
6054 vconn|DBG|unix: sent (Success): ONFT_BUNDLE_CONTROL (OF1.3):
6055 bundle_id=0 type=OPEN_REPLY flags=0
6056 vconn|DBG|unix: received: ONFT_BUNDLE_ADD_MESSAGE (OF1.3):
6057 bundle_id=0 flags=atomic ordered
6058 OFPT_FLOW_MOD (OF1.3): ADD in_port=2,dl_src=00:77:88:99:aa:bb idle:60 actions=output:8
6059 vconn|DBG|unix: received: ONFT_BUNDLE_ADD_MESSAGE (OF1.3):
6060 bundle_id=0 flags=atomic ordered
6061 OFPT_FLOW_MOD (OF1.3): DEL_STRICT table:255 in_port=2,dl_src=00:66:77:88:99:aa actions=drop
6062 vconn|DBG|unix: received: ONFT_BUNDLE_ADD_MESSAGE (OF1.3):
6063 bundle_id=0 flags=atomic ordered
6064 OFPT_FLOW_MOD (OF1.3): ADD in_port=2,dl_src=00:66:77:88:99:aa actions=drop
6065 vconn|DBG|unix: received: OFPT_BARRIER_REQUEST (OF1.3):
6066 vconn|DBG|unix: sent (Success): OFPT_BARRIER_REPLY (OF1.3):
6067 vconn|DBG|unix: received: ONFT_BUNDLE_CONTROL (OF1.3):
6068 bundle_id=0 type=COMMIT_REQUEST flags=atomic ordered
6069 vconn|DBG|unix: sent (Success): ONFT_BUNDLE_CONTROL (OF1.3):
6070 bundle_id=0 type=COMMIT_REPLY flags=0
6071 vconn|DBG|unix: sent (Success): OFPT_HELLO (OF1.6):
6072 version bitmap: 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07
6073 vconn|DBG|unix: received: OFPT_HELLO:
6074 version bitmap: 0x01
6075 vconn|DBG|unix: negotiated OpenFlow version 0x01 (we support version 0x07 and earlier, peer supports version 0x01)
6076 vconn|DBG|unix: received: NXT_SET_FLOW_FORMAT: format=nxm
6077 vconn|DBG|unix: received: OFPT_BARRIER_REQUEST:
6078 vconn|DBG|unix: sent (Success): OFPT_BARRIER_REPLY:
6079 vconn|DBG|unix: received: NXST_FLOW request:
6080 vconn|DBG|unix: sent (Success): NXST_FLOW reply:
6081 idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=output:8
6082 in_port=2,dl_src=00:66:77:88:99:aa actions=drop
6083 ])
6084
6085 OVS_VSWITCHD_STOP
6086 AT_CLEANUP
6087
6088
6089 AT_SETUP([ofproto - failing bundle add message (OpenFlow 1.3)])
6090 OVS_VSWITCHD_START
6091
6092 AT_CHECK([ovs-ofctl del-flows br0])
6093
6094 ovs-ofctl add-flows br0 - <<EOF
6095 idle_timeout=50 in_port=2 dl_src=00:66:77:88:99:aa actions=11
6096 idle_timeout=60 in_port=2 dl_src=00:77:88:99:aa:bb actions=22
6097 idle_timeout=70 in_port=2 dl_src=00:88:99:aa:bb:cc actions=33
6098 EOF
6099 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
6100 idle_timeout=50, in_port=2,dl_src=00:66:77:88:99:aa actions=output:11
6101 idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=output:22
6102 idle_timeout=70, in_port=2,dl_src=00:88:99:aa:bb:cc actions=output:33
6103 NXST_FLOW reply:
6104 ])
6105
6106 # last line uses illegal table number (OVS internal table)
6107 AT_DATA([flows.txt], [dnl
6108 add idle_timeout=50 in_port=2 dl_src=00:66:77:88:99:aa actions=1
6109 add idle_timeout=60 in_port=2 dl_src=00:77:88:99:aa:bb actions=2
6110 add idle_timeout=70 in_port=2 dl_src=00:88:99:aa:bb:cc actions=3
6111 modify idle_timeout=50 in_port=2 dl_src=00:66:77:88:99:aa actions=4
6112 delete
6113 add idle_timeout=50 in_port=2 dl_src=00:66:77:88:99:aa actions=5
6114 add idle_timeout=60 in_port=2 dl_src=00:77:88:99:aa:bb actions=6
6115 add idle_timeout=70 in_port=2 dl_src=00:88:99:aa:bb:cc actions=7
6116 delete in_port=2 dl_src=00:88:99:aa:bb:cc
6117 add table=254 actions=drop
6118 ])
6119
6120 AT_CHECK([ovs-ofctl -O OpenFlow13 --bundle add-flows br0 flows.txt 2>&1 | sed '/talking to/,$d' | strip_xids],
6121 [0], [dnl
6122 Error OFPBRC_EPERM for: OFPT_FLOW_MOD (OF1.3): ADD table:254 actions=drop
6123 ])
6124
6125 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
6126 idle_timeout=50, in_port=2,dl_src=00:66:77:88:99:aa actions=output:11
6127 idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=output:22
6128 idle_timeout=70, in_port=2,dl_src=00:88:99:aa:bb:cc actions=output:33
6129 NXST_FLOW reply:
6130 ])
6131
6132 OVS_VSWITCHD_STOP
6133 AT_CLEANUP
6134
6135
6136 AT_SETUP([ofproto - failing bundle commit (OpenFlow 1.3)])
6137 OVS_VSWITCHD_START
6138
6139 AT_CHECK([ovs-ofctl del-flows br0])
6140
6141 # Invalid group numbers are detected at commit time
6142 AT_DATA([flows.txt], [dnl
6143 add idle_timeout=50 in_port=2 dl_src=00:66:77:88:99:aa actions=group:1
6144 add idle_timeout=60 in_port=2 dl_src=00:77:88:99:aa:bb actions=group:2
6145 add idle_timeout=70 in_port=2 dl_src=00:88:99:aa:bb:cc actions=group:3
6146 ])
6147
6148 AT_CHECK([ovs-ofctl -O OpenFlow13 --bundle add-flows br0 flows.txt 2>&1 | sed '/talking to/,$d' | strip_xids],
6149 [0], [dnl
6150 Error OFPBAC_BAD_OUT_GROUP for: OFPT_FLOW_MOD (OF1.3): ADD in_port=2,dl_src=00:66:77:88:99:aa idle:50 actions=group:1
6151 Error OFPBFC_MSG_FAILED for: ONFT_BUNDLE_CONTROL (OF1.3):
6152 bundle_id=0 type=COMMIT_REQUEST flags=atomic ordered
6153 ])
6154
6155 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
6156 NXST_FLOW reply:
6157 ])
6158
6159 OVS_VSWITCHD_STOP
6160 AT_CLEANUP
6161
6162 AT_SETUP([ofproto - monitor flows with tun_md])
6163 OVS_VSWITCHD_START
6164
6165 AT_CHECK([ovs-ofctl add-tlv-map br0 "{class=0xffff,type=0,len=4}->tun_metadata0"])
6166 AT_CHECK([ovs-ofctl add-flow br0 tun_metadata0=0x1,actions=drop])
6167
6168 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip], [0], [dnl
6169 NXST_FLOW reply:
6170 tun_metadata0=0x1 actions=drop
6171 ])
6172
6173 AT_CAPTURE_FILE([ofctl_monitor.log])
6174 dnl Usually ovs-ofctl monitor outputs on stderr, but the first message here
6175 dnl is put on stdout, because it is handled by ofctl in dump_transaction()
6176 dnl and not in monitor_vconn().
6177 AT_CHECK([ovs-ofctl monitor br0 65534 watch: --detach --no-chdir --pidfile >ofctl_monitor.log 2>&1])
6178
6179 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 2])
6180
6181 AT_CHECK([cat ofctl_monitor.log | ofctl_strip], [0], [dnl
6182 NXST_FLOW_MONITOR reply:
6183 event=ADDED table=0 cookie=0 tun_metadata0=0x1
6184 ])
6185
6186 AT_CHECK([ovs-ofctl del-flows br0])
6187
6188 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 4])
6189
6190 AT_CHECK([cat ofctl_monitor.log | ofctl_strip], [0], [dnl
6191 NXST_FLOW_MONITOR reply:
6192 event=ADDED table=0 cookie=0 tun_metadata0=0x1
6193 NXST_FLOW_MONITOR reply:
6194 event=DELETED reason=delete table=0 cookie=0 tun_metadata0=0x1
6195 ])
6196
6197 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
6198
6199 dnl Check that vswitchd hasn't crashed
6200 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip], [0], [dnl
6201 NXST_FLOW reply:
6202 ])
6203
6204 OVS_VSWITCHD_STOP
6205 AT_CLEANUP
6206
6207 AT_SETUP([ofproto - flow mod with tunnel metadata])
6208 AT_KEYWORDS([ofp-actions])
6209 OVS_VSWITCHD_START
6210
6211 AT_CHECK([ovs-ofctl add-tlv-map br0 "{class=0xffff,type=0,len=4}->tun_metadata0"])
6212 AT_CHECK([ovs-ofctl add-flow br0 "in_port=1 actions=move:tun_metadata0[[0..31]]->NXM_NX_REG0[[]]"])
6213
6214 dnl Check the length of tun_metadata0 in the replied OXM header.
6215 dnl Ignore the first 0x50 bytes of hex dump from the reply msg since the NXM
6216 dnl header that describes the tunnel metadata starts at offset 0x50.
6217 AT_CHECK([ovs-ofctl dump-flows br0 -mmmm], [0], [stdout])
6218 AT_CHECK([sed -e 's/duration=[[0-9.]]*s/duration=?s/' -e 's/idle_age=[[0-9]]*/idle_age=?/' -e '/^000000[[0-4]]0 / d' stdout | strip_xids], [0], [dnl
6219 NXST_FLOW reply:
6220 cookie=0x0, duration=?s, table=0, n_packets=0, n_bytes=0, idle_age=?, in_port=1 actions=move:NXM_NX_TUN_METADATA0[[0..31]]->NXM_NX_REG0[[]]
6221 00000050 ff ff 00 18 00 00 23 20-00 06 00 20 00 00 00 00 |......# ... ....|
6222 00000060 00 01 50 04 00 01 00 04- |..P..... |
6223 ])
6224
6225 dnl Check actions that may use tun_metadata
6226 AT_CHECK([ovs-ofctl add-flow br0 "in_port=2 actions=move:tun_metadata1[[0..31]]->NXM_NX_REG0[[]]"], [1], [], [stderr])
6227 AT_CHECK([strip_xids < stderr | sed '/FLOW_MOD/,$d'], [0], [dnl
6228 OFPT_ERROR: NXFMFC_INVALID_TLV_FIELD
6229 ])
6230
6231 AT_CHECK([ovs-ofctl add-flow br0 "in_port=2 actions=move:tun_metadata0[[32..63]]->NXM_NX_REG0[[]]"], [1], [], [stderr])
6232 AT_CHECK([strip_xids < stderr | sed '/FLOW_MOD/,$d'], [0], [dnl
6233 OFPT_ERROR: OFPBAC_BAD_SET_LEN
6234 ])
6235
6236 AT_CHECK([ovs-ofctl add-flow br0 "in_port=2 actions=push:tun_metadata1[[0..31]]"], [1], [], [stderr])
6237 AT_CHECK([strip_xids < stderr | sed '/FLOW_MOD/,$d'], [0], [dnl
6238 OFPT_ERROR: NXFMFC_INVALID_TLV_FIELD
6239 ])
6240
6241 AT_CHECK([ovs-ofctl add-flow br0 "in_port=2 actions=pop:tun_metadata0[[32..63]]"], [1], [], [stderr])
6242 AT_CHECK([strip_xids < stderr | sed '/FLOW_MOD/,$d'], [0], [dnl
6243 OFPT_ERROR: OFPBAC_BAD_SET_LEN
6244 ])
6245
6246 AT_CHECK([ovs-ofctl add-flow br0 "in_port=3, actions=load:0x11223344->tun_metadata1"], [1], [], [stderr])
6247 AT_CHECK([strip_xids < stderr | sed '/FLOW_MOD/,$d'], [0], [dnl
6248 OFPT_ERROR: NXFMFC_INVALID_TLV_FIELD
6249 ])
6250
6251 AT_CHECK([ovs-ofctl add-flow br0 "in_port=2 actions=output:tun_metadata1[[0..31]]"], [1], [], [stderr])
6252 AT_CHECK([strip_xids < stderr | sed '/FLOW_MOD/,$d'], [0], [dnl
6253 OFPT_ERROR: NXFMFC_INVALID_TLV_FIELD
6254 ])
6255
6256 AT_CHECK([ovs-ofctl add-flow br0 "in_port=2 actions=output:tun_metadata0[[32..63]]"], [1], [], [stderr])
6257 AT_CHECK([strip_xids < stderr | sed '/FLOW_MOD/,$d'], [0], [dnl
6258 OFPT_ERROR: OFPBAC_BAD_SET_LEN
6259 ])
6260
6261 AT_CHECK([ovs-ofctl add-flow br0 "in_port=2 actions=multipath(eth_src,50,modulo_n,1,0,tun_metadata1[[0..31]])"], [1], [], [stderr])
6262 AT_CHECK([strip_xids < stderr | sed '/FLOW_MOD/,$d'], [0], [dnl
6263 OFPT_ERROR: NXFMFC_INVALID_TLV_FIELD
6264 ])
6265
6266 AT_CHECK([ovs-ofctl add-flow br0 "in_port=2 actions=multipath(eth_src,50,modulo_n,1,0,tun_metadata0[[32..63]])"], [1], [], [stderr])
6267 AT_CHECK([strip_xids < stderr | sed '/FLOW_MOD/,$d'], [0], [dnl
6268 OFPT_ERROR: OFPBAC_BAD_SET_LEN
6269 ])
6270
6271 AT_CHECK([ovs-ofctl add-flow br0 "in_port=2 actions=bundle_load(eth_src,50,hrw,ofport,tun_metadata1[[0..31]], slaves:4,8)"], [1], [], [stderr])
6272 AT_CHECK([strip_xids < stderr | sed '/FLOW_MOD/,$d'], [0], [dnl
6273 OFPT_ERROR: NXFMFC_INVALID_TLV_FIELD
6274 ])
6275
6276 AT_CHECK([ovs-ofctl add-flow br0 "in_port=2 actions=bundle_load(eth_src,50,hrw,ofport,tun_metadata0[[32..63]], slaves:4,8)"], [1], [], [stderr])
6277 AT_CHECK([strip_xids < stderr | sed '/FLOW_MOD/,$d'], [0], [dnl
6278 OFPT_ERROR: OFPBAC_BAD_SET_LEN
6279 ])
6280
6281 AT_CHECK([ovs-ofctl add-flow br0 "in_port=2 actions=learn(tun_metadata1[[0..31]]=reg0[[0..31]])"], [1], [], [stderr])
6282 AT_CHECK([strip_xids < stderr | sed '/FLOW_MOD/,$d'], [0], [dnl
6283 OFPT_ERROR: NXFMFC_INVALID_TLV_FIELD
6284 ])
6285
6286 AT_CHECK([ovs-ofctl add-flow br0 "in_port=2 actions=learn(tun_metadata0[[32..63]]=reg0[[0..31]])"], [1], [], [stderr])
6287 AT_CHECK([strip_xids < stderr | sed '/FLOW_MOD/,$d'], [0], [dnl
6288 OFPT_ERROR: OFPBAC_BAD_SET_LEN
6289 ])
6290
6291 AT_CHECK([ovs-ofctl add-flow br0 "in_port=2 actions=clone(move:tun_metadata1[[0..31]]->reg0[[0..31]])"], [1], [], [stderr])
6292 AT_CHECK([strip_xids < stderr | sed '/FLOW_MOD/,$d'], [0], [dnl
6293 OFPT_ERROR: NXFMFC_INVALID_TLV_FIELD
6294 ])
6295
6296 AT_CHECK([ovs-ofctl add-flow br0 "in_port=2 actions=clone(move:tun_metadata0[[32..63]]->reg0[[0..31]])"], [1], [], [stderr])
6297 AT_CHECK([strip_xids < stderr | sed '/FLOW_MOD/,$d'], [0], [dnl
6298 OFPT_ERROR: OFPBAC_BAD_SET_LEN
6299 ])
6300
6301 AT_CHECK([ovs-ofctl add-flow br0 "ip actions=ct(commit,zone=tun_metadata1[[0..15]],exec(set_field:0x01->ct_mark))"], [1], [], [stderr])
6302 AT_CHECK([strip_xids < stderr | sed '/FLOW_MOD/,$d'], [0], [dnl
6303 OFPT_ERROR: NXFMFC_INVALID_TLV_FIELD
6304 ])
6305
6306 AT_CHECK([ovs-ofctl add-flow br0 "ip actions=ct(commit,zone=tun_metadata0[[32..47]],exec(set_field:0x01->ct_mark))"], [1], [], [stderr])
6307 AT_CHECK([strip_xids < stderr | sed '/FLOW_MOD/,$d'], [0], [dnl
6308 OFPT_ERROR: OFPBAC_BAD_SET_LEN
6309 ])
6310
6311 AT_CHECK([ovs-ofctl add-flow br0 "ip actions=ct(commit,zone=1,exec(move:tun_metadata1[[0..31]]->ct_mark))"], [1], [], [stderr])
6312 AT_CHECK([strip_xids < stderr | sed '/FLOW_MOD/,$d'], [0], [dnl
6313 OFPT_ERROR: NXFMFC_INVALID_TLV_FIELD
6314 ])
6315
6316 AT_CHECK([ovs-ofctl add-flow br0 "ip actions=ct(commit,zone=1,exec(move:tun_metadata0[[32..63]]->ct_mark))"], [1], [], [stderr])
6317 AT_CHECK([strip_xids < stderr | sed '/FLOW_MOD/,$d'], [0], [dnl
6318 OFPT_ERROR: OFPBAC_BAD_SET_LEN
6319 ])
6320
6321 dnl Check match field with tun_metadata
6322 AT_CHECK([ovs-ofctl add-flow br0 "tun_metadata0=0x11223344 actions=output:2"], [0], [], [stderr])
6323 AT_CHECK([ovs-ofctl add-flow br0 "tun_metadata1=0x11223344 actions=output:2"], [1], [], [stderr])
6324 AT_CHECK([strip_xids < stderr | sed '/FLOW_MOD/,$d'], [0], [dnl
6325 OFPT_ERROR: NXFMFC_INVALID_TLV_FIELD
6326 ])
6327
6328 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip], [0], [dnl)
6329 NXST_FLOW reply:
6330 in_port=1 actions=move:NXM_NX_TUN_METADATA0[[0..31]]->NXM_NX_REG0[[]]
6331 tun_metadata0=0x11223344 actions=output:2
6332 ])
6333
6334 OVS_VSWITCHD_STOP(["/NXFMFC_INVALID_TLV_FIELD/d
6335 /tun_metadata0/d
6336 /OFPBAC_BAD_SET_LEN/d"])
6337 AT_CLEANUP
6338
6339 AT_SETUP([ofproto - flush flows, groups, and meters for controller change])
6340 AT_KEYWORDS([flow flows group group meter])
6341 OVS_VSWITCHD_START
6342
6343 add_flow_group_and_meter () {
6344 AT_CHECK([ovs-ofctl add-flow br0 in_port=1,actions=2])
6345 AT_CHECK([ovs-ofctl -O OpenFlow11 add-group br0 group_id=1234,type=all,bucket=output:10
6346 AT_CHECK([ovs-ofctl -O OpenFlow13 add-meter br0 'meter=1 pktps burst stats bands=type=drop rate=1 burst_size=1'])
6347 ])
6348 }
6349
6350 verify_added () {
6351 AT_CHECK([ovs-ofctl --no-stats dump-flows br0], [0], [dnl
6352 in_port=1 actions=output:2
6353 ])
6354 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-groups br0], [0], [dnl
6355 OFPST_GROUP_DESC reply (OF1.1) (xid=0x2):
6356 group_id=1234,type=all,bucket=actions=output:10
6357 ])
6358 AT_CHECK([ovs-ofctl -O OpenFlow13 dump-meters br0], [0], [dnl
6359 OFPST_METER_CONFIG reply (OF1.3) (xid=0x2):
6360 meter=1 pktps burst stats bands=
6361 type=drop rate=1 burst_size=1
6362 ])
6363 }
6364
6365 verify_deleted () {
6366 AT_CHECK([ovs-ofctl --no-stats dump-flows br0])
6367 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-groups br0], [0], [dnl
6368 OFPST_GROUP_DESC reply (OF1.1) (xid=0x2):
6369 ])
6370 AT_CHECK([ovs-ofctl -O OpenFlow13 dump-meters br0], [0], [dnl
6371 OFPST_METER_CONFIG reply (OF1.3) (xid=0x2):
6372 ])
6373 }
6374
6375 # Add flow, group, meter and check that they're there, without a controller.
6376 add_flow_group_and_meter
6377 verify_added
6378
6379 # Set up a controller and verify that the flow and group were deleted,
6380 # then add them back.
6381 AT_CHECK([ovs-vsctl set-controller br0 'tcp:<invalid>:6653'])
6382 verify_deleted
6383 add_flow_group_and_meter
6384 verify_added
6385
6386 # Change the controller and verify that the flow and group are still there.
6387 AT_CHECK([ovs-vsctl set-controller br0 'tcp:<invalid2>:6653'])
6388 verify_added
6389
6390 # Clear the controller and verify that the flow and group were deleted.
6391 AT_CHECK([ovs-vsctl del-controller br0])
6392 verify_deleted
6393
6394 OVS_VSWITCHD_STOP(["/<invalid/d"])
6395 AT_CLEANUP