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