]> git.proxmox.com Git - mirror_ovs.git/blob - tests/ofproto.at
tests: Improve logging for async message control test.
[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 exact match or wildcard: in_port eth_{src,dst,type} vlan_{vid,pcp} ip_{src,dst} nw_{proto,tos} tcp_{src,dst}
2209
2210 ' "$1"
2211 }
2212 (head_table; echo ' tables 1...253: ditto') > expout
2213 AT_CHECK([ovs-ofctl dump-tables br0], [0], [expout])
2214 # Change the configuration.
2215 AT_CHECK(
2216 [ovs-vsctl \
2217 -- --id=@t0 create Flow_Table name=main \
2218 -- --id=@t1 create Flow_Table flow-limit=1024 \
2219 -- set bridge br0 'flow_tables={1=@t1,0=@t0}' \
2220 | uuidfilt],
2221 [0], [<0>
2222 <1>
2223 ])
2224 # Check that the configuration was updated.
2225 (head_table ' ("main")'; echo ' table 1:
2226 active=0, lookup=0, matched=0
2227 max_entries=1024
2228 (same matching)
2229
2230 table 2:
2231 active=0, lookup=0, matched=0
2232 max_entries=1000000
2233 (same matching)
2234 '; echo ' tables 3...253: ditto') > expout
2235 AT_CHECK([ovs-ofctl dump-tables br0], [0], [expout])
2236 OVS_VSWITCHD_STOP
2237 AT_CLEANUP
2238
2239 dnl In-band and fail-open add "hidden rules" to table 0. These rules shouldn't
2240 dnl be visible to OpenFlow. This test checks that "dump-flows" and
2241 dnl "dump-tables" don't make them visible.
2242 AT_SETUP([ofproto - hidden rules not in table stats])
2243 # Use an IP address for a controller that won't actually exist: we
2244 # want to create in-band rules but we do not want to actually connect
2245 # to a controller (because that could mess about with our test). The
2246 # Class E range 240.0.0.0 - 255.255.255.255 seems like a good choice.
2247 OVS_VSWITCHD_START([set-controller br0 tcp:240.0.0.1:6653])
2248 for i in 1 2 3 4 5; do ovs-appctl time/warp 1000; done
2249
2250 # Check that no hidden flows are visible in OpenFlow.
2251 AT_CHECK([ovs-ofctl dump-flows br0 | strip_xids], [0], [NXST_FLOW reply:
2252 ])
2253
2254 # Check that some hidden flows related to 240.0.0.1 are actually in table 0.
2255 #
2256 # We discard flows that mention table_id because we only want table 0 flows,
2257 # which in OVS is implied by the absence of a table_id.
2258 AT_CHECK([ovs-appctl bridge/dump-flows br0], [0], [stdout])
2259 AT_CHECK([test `grep '240\.0\.0\.1' stdout | grep -v table_id= | wc -l` -gt 0])
2260
2261 # Check that dump-tables doesn't count the hidden flows.
2262 head_table() {
2263 printf 'OFPST_TABLE reply:
2264 table 0:
2265 active=0, lookup=0, matched=0
2266 max_entries=1000000
2267 matching:
2268 exact match or wildcard: in_port eth_{src,dst,type} vlan_{vid,pcp} ip_{src,dst} nw_{proto,tos} tcp_{src,dst}
2269
2270 '
2271 }
2272 (head_table; echo ' tables 1...253: ditto') > expout
2273 AT_CHECK([ovs-ofctl dump-tables br0 | strip_xids], [0], [expout])
2274 OVS_VSWITCHD_STOP(["/240\.0\.0\.1/d"])
2275 AT_CLEANUP
2276
2277 AT_SETUP([ofproto - flow table configuration (OpenFlow 1.2)])
2278 OVS_VSWITCHD_START
2279 # Check the default configuration.
2280 head_table() {
2281 printf 'OFPST_TABLE reply (OF1.2) (xid=0x2):
2282 table 0%s:
2283 active=0, lookup=0, matched=0
2284 metadata: match=0xffffffffffffffff write=0xffffffffffffffff
2285 config=controller
2286 max_entries=1000000
2287 instructions (table miss and others):
2288 instructions: apply_actions clear_actions write_actions write_metadata goto_table
2289 Write-Actions and Apply-Actions features:
2290 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
2291 supported on Set-Field: metadata in_port_oxm eth_{src,dst} vlan_{vid,pcp} mpls_{label,tc} ip_{src,dst} ipv6_{src,dst,label} ip_dscp nw_ecn arp_{op,spa,tpa,sha,tha} tcp_{src,dst} udp_{src,dst} sctp_{src,dst} icmp_{type,code} icmpv6_{type,code} nd_{target,sll,tll}
2292 matching:
2293 exact match or wildcard: metadata in_port_oxm eth_{src,dst,type} vlan_{vid,pcp} mpls_{label,tc} ip_{src,dst} ipv6_{src,dst,label} nw_proto ip_dscp nw_ecn arp_{op,spa,tpa,sha,tha} tcp_{src,dst} udp_{src,dst} sctp_{src,dst} icmp_{type,code} icmpv6_{type,code} nd_{target,sll,tll}
2294
2295 ' "$1"
2296 }
2297 tail_table() {
2298 printf ' table 253:
2299 active=0, lookup=0, matched=0
2300 metadata: match=0xffffffffffffffff write=0xffffffffffffffff
2301 config=controller
2302 max_entries=1000000
2303 instructions (table miss and others):
2304 instructions: apply_actions clear_actions write_actions write_metadata
2305 (same actions)
2306 (same matching)
2307 '
2308 }
2309 (head_table; printf ' tables 1...252: ditto\n\n'; tail_table) > expout
2310 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-tables br0], [0], [expout])
2311 # Change the configuration.
2312 AT_CHECK(
2313 [ovs-vsctl \
2314 -- --id=@t0 create Flow_Table name=main \
2315 -- --id=@t1 create Flow_Table flow-limit=1024 \
2316 -- set bridge br0 'flow_tables={1=@t1,0=@t0}' \
2317 | uuidfilt],
2318 [0], [<0>
2319 <1>
2320 ])
2321 # Check that the configuration was updated.
2322 (head_table ' ("main")'; echo ' table 1:
2323 active=0, lookup=0, matched=0
2324 metadata: match=0xffffffffffffffff write=0xffffffffffffffff
2325 config=controller
2326 max_entries=1024
2327 (same instructions)
2328 (same matching)
2329
2330 table 2:
2331 active=0, lookup=0, matched=0
2332 metadata: match=0xffffffffffffffff write=0xffffffffffffffff
2333 config=controller
2334 max_entries=1000000
2335 (same instructions)
2336 (same matching)
2337 '; printf ' tables 3...252: ditto\n\n'; tail_table) > expout
2338 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-tables br0], [0], [expout])
2339 OVS_VSWITCHD_STOP
2340 AT_CLEANUP
2341
2342 AT_SETUP([ofproto - table features (OpenFlow 1.3)])
2343 OVS_VSWITCHD_START
2344 head_table () {
2345 printf ' table 0%s:
2346 metadata: match=0xffffffffffffffff write=0xffffffffffffffff
2347 max_entries=1000000
2348 instructions (table miss and others):
2349 next tables: 1-253
2350 instructions: meter apply_actions clear_actions write_actions write_metadata goto_table
2351 Write-Actions and Apply-Actions features:
2352 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
2353 supported on Set-Field: tun_{id,src,dst,ipv6_{src,dst},flags,gbp_{id,flags},erspan_{idx,ver,dir,hwid},metadata0...metadata63} metadata in_{port,port_oxm} pkt_mark ct_{mark,label} reg0...reg15 xreg0...xreg7 xxreg0...xxreg3 eth_{src,dst} vlan_{tci,vid,pcp} mpls_{label,tc,ttl} ip_{src,dst} ipv6_{src,dst,label} nw_tos ip_dscp nw_{ecn,ttl} arp_{op,spa,tpa,sha,tha} tcp_{src,dst} udp_{src,dst} sctp_{src,dst} icmp_{type,code} icmpv6_{type,code} nd_{target,sll,tll,reserved,options_type} nsh_{flags,spi,si,c1...c4,ttl}
2354 matching:
2355 arbitrary mask: dp_hash tun_{id,src,dst,ipv6_{src,dst},flags,gbp_{id,flags},erspan_{idx,ver,dir,hwid},metadata0...metadata63} metadata pkt_mark ct_{state,mark,label,nw_{src,dst},ipv6_{src,dst},tp_{src,dst}} reg0...reg15 xreg0...xreg7 xxreg0...xxreg3 eth_{src,dst} vlan_{tci,vid} ip_{src,dst} ipv6_{src,dst,label} ip_frag arp_{spa,tpa,sha,tha} tcp_{src,dst,flags} udp_{src,dst} sctp_{src,dst} nd_{target,sll,tll} nsh_{flags,c1...c4}
2356 exact match or wildcard: recirc_id packet_type conj_id in_{port,port_oxm} actset_output ct_{zone,nw_proto} eth_type vlan_pcp mpls_{label,tc,bos,ttl} nw_{proto,tos} ip_dscp nw_{ecn,ttl} arp_op icmp_{type,code} icmpv6_{type,code} nd_{reserved,options_type} nsh_{mdtype,np,spi,si,ttl}
2357
2358 ' "$1"
2359 }
2360 tail_tables() {
2361 echo ' table 253:
2362 metadata: match=0xffffffffffffffff write=0xffffffffffffffff
2363 max_entries=1000000
2364 instructions (table miss and others):
2365 instructions: meter apply_actions clear_actions write_actions write_metadata
2366 (same actions)
2367 (same matching)
2368 '
2369 }
2370 (head_table
2371 printf ' tables 1...252: ditto\n\n'
2372 tail_tables) > expout
2373 AT_CHECK([ovs-ofctl -O OpenFlow13 dump-table-features br0], [0], [expout])
2374 # Change the configuration.
2375 AT_CHECK(
2376 [ovs-vsctl \
2377 -- --id=@t0 create Flow_Table name=main \
2378 -- --id=@t1 create Flow_Table flow-limit=1024 \
2379 -- set bridge br0 'flow_tables={1=@t1,0=@t0}' \
2380 | uuidfilt],
2381 [0], [<0>
2382 <1>
2383 ])
2384 # Check that the configuration was updated.
2385 (head_table ' ("main")'
2386 echo ' table 1:
2387 metadata: match=0xffffffffffffffff write=0xffffffffffffffff
2388 max_entries=1024
2389 (same instructions)
2390 (same matching)
2391
2392 table 2:
2393 metadata: match=0xffffffffffffffff write=0xffffffffffffffff
2394 max_entries=1000000
2395 (same instructions)
2396 (same matching)
2397
2398 tables 3...252: ditto
2399 '
2400 tail_tables) > expout
2401 AT_CHECK([ovs-ofctl -O OpenFlow13 dump-table-features br0], [0], [expout])
2402 OVS_VSWITCHD_STOP
2403 AT_CLEANUP
2404
2405 AT_SETUP([ofproto - flow table names])
2406 OVS_VSWITCHD_START
2407 add_of_ports br0 1 2
2408
2409 # Set a table name via OpenFlow 1.3 and one via OpenFlow 1.5.
2410 AT_CHECK([ovs-ofctl -O OpenFlow13 mod-table br0 0 name:xyzzy])
2411 AT_CHECK([ovs-ofctl -O OpenFlow15 mod-table br0 1 name:quux])
2412 AT_CHECK([ovs-ofctl -O OpenFlow15 dump-table-features br0 |grep '^ table'],
2413 [0], [dnl
2414 table 0 ("xyzzy"):
2415 table 1 ("quux"): ditto
2416 tables 2...252: ditto
2417 table 253:
2418 ])
2419
2420 # Set some table names via OVSDB.
2421 AT_CHECK(
2422 [ovs-vsctl \
2423 -- --id=@t0 create Flow_Table name=zero \
2424 -- --id=@t1 create Flow_Table name=one \
2425 -- --id=@t2 create Flow_Table name=two \
2426 -- set bridge br0 'flow_tables={0=@t0,1=@t1,2=@t2}' \
2427 | uuidfilt],
2428 [0], [<0>
2429 <1>
2430 <2>
2431 ])
2432 AT_CHECK([ovs-ofctl -O OpenFlow15 dump-table-features br0 |grep '^ table'],
2433 [0], [dnl
2434 table 0 ("zero"):
2435 table 1 ("one"): ditto
2436 table 2 ("two"): ditto
2437 tables 3...252: ditto
2438 table 253:
2439 ])
2440
2441 # Check that flow table parsing and dumping uses the names.
2442 AT_DATA([flows.txt], [dnl
2443 table=zero in_port=p2 actions=p1,resubmit(,one)
2444 table=one,in_port=p1,ip,actions=ct(table=two)
2445 table=one,in_port=p1,arp,actions=goto_table(two)
2446 ])
2447 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
2448 AT_CHECK([ovs-ofctl --names --no-stats dump-flows br0], [0], [dnl
2449 table=zero, in_port=p2 actions=output:p1,resubmit(,one)
2450 table=one, ip,in_port=p1 actions=ct(table=two)
2451 table=one, arp,in_port=p1 actions=resubmit(,two)
2452 ])
2453 AT_CHECK([ovs-ofctl --no-names --no-stats dump-flows br0], [0], [dnl
2454 in_port=2 actions=output:1,resubmit(,1)
2455 table=1, ip,in_port=1 actions=ct(table=2)
2456 table=1, arp,in_port=1 actions=resubmit(,2)
2457 ])
2458
2459 # Setting the same table names via OpenFlow 1.3 or OpenFlow 1.5 is a no-op.
2460 AT_CHECK([ovs-ofctl -O OpenFlow13 mod-table br0 0 name:zero])
2461 AT_CHECK([ovs-ofctl -O OpenFlow15 mod-table br0 1 name:one])
2462 AT_CHECK([ovs-ofctl -O OpenFlow15 dump-table-features br0 |grep '^ table'],
2463 [0], [dnl
2464 table 0 ("zero"):
2465 table 1 ("one"): ditto
2466 table 2 ("two"): ditto
2467 tables 3...252: ditto
2468 table 253:
2469 ])
2470
2471 # Setting different tables names via OpenFlow 1.3 or OpenFlow 1.5 yield errors.
2472 AT_CHECK([ovs-ofctl -O OpenFlow13 mod-table br0 0 name:xyzzy], 1, [], [stderr])
2473 AT_CHECK([head -1 stderr], [0], [OFPT_ERROR (OF1.3) (xid=0x5): OFPTFFC_EPERM
2474 ])
2475 AT_CHECK([ovs-ofctl -O OpenFlow15 mod-table br0 1 name:quux], 1, [], [stderr])
2476 AT_CHECK([head -1 stderr], [0], [OFPT_ERROR (OF1.5) (xid=0x5): OFPTFFC_EPERM
2477 ])
2478
2479 # But we can still set table names for those not set via OVSDB.
2480 AT_CHECK([ovs-ofctl -O OpenFlow13 mod-table br0 3 name:three])
2481 AT_CHECK([ovs-ofctl -O OpenFlow15 dump-table-features br0 |grep '^ table'],
2482 [0], [dnl
2483 table 0 ("zero"):
2484 table 1 ("one"): ditto
2485 table 2 ("two"): ditto
2486 table 3 ("three"): ditto
2487 tables 4...252: ditto
2488 table 253:
2489 ])
2490
2491 # Unsetting names via OVSDB then setting them via OpenFlow works too.
2492 AT_CHECK([ovs-vsctl remove bridge br0 Flow_Table 2])
2493 AT_CHECK([ovs-ofctl -O OpenFlow15 dump-table-features br0 |grep '^ table'],
2494 [0], [dnl
2495 table 0 ("zero"):
2496 table 1 ("one"): ditto
2497 table 2: ditto
2498 table 3 ("three"): ditto
2499 tables 4...252: ditto
2500 table 253:
2501 ])
2502 AT_CHECK([ovs-ofctl -O OpenFlow13 mod-table br0 2 name:foobar])
2503 AT_CHECK([ovs-ofctl -O OpenFlow15 dump-table-features br0 |grep '^ table'],
2504 [0], [dnl
2505 table 0 ("zero"):
2506 table 1 ("one"): ditto
2507 table 2 ("foobar"): ditto
2508 table 3 ("three"): ditto
2509 tables 4...252: ditto
2510 table 253:
2511 ])
2512
2513 # We can clear names via OpenFlow, at least if they were set that way.
2514 AT_CHECK([ovs-ofctl -O OpenFlow13 mod-table br0 2 name:])
2515 AT_CHECK([ovs-ofctl -O OpenFlow15 dump-table-features br0 |grep '^ table'],
2516 [0], [dnl
2517 table 0 ("zero"):
2518 table 1 ("one"): ditto
2519 table 2: ditto
2520 table 3 ("three"): ditto
2521 tables 4...252: ditto
2522 table 253:
2523 ])
2524
2525 OVS_VSWITCHD_STOP
2526 AT_CLEANUP
2527
2528 AT_SETUP([ofproto - table description (OpenFlow 1.4)])
2529 OVS_VSWITCHD_START
2530 (x=0
2531 while test $x -lt 254; do
2532 y=`expr $x + 1`
2533 echo " table $x:
2534 eviction=off eviction_flags=OTHER|IMPORTANCE|LIFETIME
2535 vacancy=off"
2536 x=$y
2537 done) > expout
2538 AT_CHECK([ovs-ofctl -O OpenFlow14 dump-table-desc br0 | sed '/^$/d
2539 /^OFPST_TABLE_DESC/d'], [0], [expout])
2540
2541 # Change the configuration.
2542 AT_CHECK([ovs-ofctl -O Openflow14 mod-table br0 0 evict])
2543 # Check that the configuration was updated.
2544 mv expout orig-expout
2545 sed -e '2s/eviction=off/eviction=on/' <orig-expout > expout
2546 AT_CHECK([ovs-ofctl -O OpenFlow14 dump-table-desc br0 | sed '/^$/d
2547 /^OFPST_TABLE_DESC/d'], [0], [expout])
2548
2549 AT_CHECK([ovs-ofctl -O Openflow14 mod-table br0 0 vacancy:20,80])
2550 # Check that the configuration was updated.
2551 mv expout orig-expout
2552 sed -e '3s/vacancy=off/vacancy=on vacancy_down=20% vacancy_up=80% vacancy=100%/' <orig-expout > expout
2553 AT_CHECK([ovs-ofctl -O OpenFlow14 dump-table-desc br0 | sed '/^$/d
2554 /^OFPST_TABLE_DESC/d'], [0], [expout])
2555 OVS_VSWITCHD_STOP
2556 AT_CLEANUP
2557
2558 AT_SETUP([ofproto - hard limits on flow table size (OpenFlow 1.0)])
2559 OVS_VSWITCHD_START
2560 # Configure a maximum of 4 flows.
2561 AT_CHECK(
2562 [ovs-vsctl \
2563 -- --id=@t0 create Flow_Table flow-limit=4 \
2564 -- set bridge br0 flow_tables:0=@t0 \
2565 | uuidfilt],
2566 [0], [<0>
2567 ])
2568 # Add 4 flows.
2569 for in_port in 1 2 3 4; do
2570 ovs-ofctl add-flow br0 in_port=$in_port,actions=drop
2571 done
2572 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
2573 in_port=1 actions=drop
2574 in_port=2 actions=drop
2575 in_port=3 actions=drop
2576 in_port=4 actions=drop
2577 NXST_FLOW reply:
2578 ])
2579 # Adding another flow will be refused.
2580 AT_CHECK([ovs-ofctl add-flow br0 in_port=5,actions=drop], [1], [], [stderr])
2581 AT_CHECK([ofctl_strip < stderr], [0],
2582 [OFPT_ERROR: OFPFMFC_TABLE_FULL
2583 OFPT_FLOW_MOD: ADD in_port=5 actions=drop
2584 ])
2585 # Also a mod-flow that would add a flow will be refused.
2586 AT_CHECK([ovs-ofctl mod-flows br0 in_port=5,actions=drop], [1], [], [stderr])
2587 AT_CHECK([ofctl_strip < stderr], [0],
2588 [OFPT_ERROR: OFPFMFC_TABLE_FULL
2589 OFPT_FLOW_MOD: MOD in_port=5 actions=drop
2590 ])
2591 # Replacing or modifying an existing flow is allowed.
2592 AT_CHECK([ovs-ofctl add-flow br0 in_port=4,actions=normal])
2593 AT_CHECK([ovs-ofctl mod-flows br0 in_port=3,actions=output:1])
2594 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
2595 in_port=1 actions=drop
2596 in_port=2 actions=drop
2597 in_port=3 actions=output:1
2598 in_port=4 actions=NORMAL
2599 NXST_FLOW reply:
2600 ])
2601 OVS_VSWITCHD_STOP
2602 AT_CLEANUP
2603
2604 AT_SETUP([ofproto - hard limits on flow table size (OpenFlow 1.2)])
2605 OVS_VSWITCHD_START
2606 # Configure a maximum of 4 flows.
2607 AT_CHECK(
2608 [ovs-vsctl \
2609 -- --id=@t0 create Flow_Table flow-limit=4 \
2610 -- set bridge br0 flow_tables:0=@t0 \
2611 | uuidfilt],
2612 [0], [<0>
2613 ])
2614 # Add 4 flows.
2615 for in_port in 1 2 3 4; do
2616 ovs-ofctl -O OpenFlow12 add-flow br0 in_port=$in_port,actions=drop
2617 done
2618 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
2619 in_port=1 actions=drop
2620 in_port=2 actions=drop
2621 in_port=3 actions=drop
2622 in_port=4 actions=drop
2623 OFPST_FLOW reply (OF1.2):
2624 ])
2625 # Adding another flow will be refused.
2626 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 in_port=5,actions=drop], [1], [], [stderr])
2627 AT_CHECK([ofctl_strip < stderr], [0],
2628 [OFPT_ERROR (OF1.2): OFPFMFC_TABLE_FULL
2629 OFPT_FLOW_MOD (OF1.2): ADD in_port=5 actions=drop
2630 ])
2631 # Replacing or modifying an existing flow is allowed.
2632 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 in_port=4,actions=normal])
2633 AT_CHECK([ovs-ofctl -O OpenFlow12 mod-flows br0 in_port=3,actions=output:1])
2634 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
2635 in_port=1 actions=drop
2636 in_port=2 actions=drop
2637 in_port=3 actions=output:1
2638 in_port=4 actions=NORMAL
2639 OFPST_FLOW reply (OF1.2):
2640 ])
2641 OVS_VSWITCHD_STOP
2642 AT_CLEANUP
2643
2644 AT_SETUP([ofproto - eviction upon table overflow (OpenFlow 1.0)])
2645 OVS_VSWITCHD_START
2646 # Configure a maximum of 4 flows.
2647 AT_CHECK(
2648 [ovs-vsctl \
2649 -- --id=@t0 create Flow_Table flow-limit=4 overflow-policy=evict \
2650 -- set bridge br0 flow_tables:0=@t0 \
2651 | uuidfilt],
2652 [0], [<0>
2653 ])
2654 # Add 4 flows.
2655 for in_port in 4 3 2 1; do
2656 ovs-ofctl add-flow br0 idle_timeout=${in_port}0,in_port=$in_port,actions=drop
2657 done
2658 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
2659 idle_timeout=10, in_port=1 actions=drop
2660 idle_timeout=20, in_port=2 actions=drop
2661 idle_timeout=30, in_port=3 actions=drop
2662 idle_timeout=40, in_port=4 actions=drop
2663 NXST_FLOW reply:
2664 ])
2665 # Adding another flow will cause the one that expires soonest to be evicted.
2666 AT_CHECK([ovs-ofctl add-flow br0 in_port=5,actions=drop])
2667 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
2668 idle_timeout=20, in_port=2 actions=drop
2669 idle_timeout=30, in_port=3 actions=drop
2670 idle_timeout=40, in_port=4 actions=drop
2671 in_port=5 actions=drop
2672 NXST_FLOW reply:
2673 ])
2674 # A mod-flow that adds a flow also causes eviction, but replacing or
2675 # modifying an existing flow doesn't.
2676 AT_CHECK([ovs-ofctl mod-flows br0 in_port=6,actions=drop])
2677 AT_CHECK([ovs-ofctl add-flow br0 in_port=4,actions=normal])
2678 AT_CHECK([ovs-ofctl mod-flows br0 in_port=3,actions=output:1])
2679 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
2680 idle_timeout=30, in_port=3 actions=output:1
2681 in_port=4 actions=NORMAL
2682 in_port=5 actions=drop
2683 in_port=6 actions=drop
2684 NXST_FLOW reply:
2685 ])
2686 # Flows with no timeouts at all cannot be evicted.
2687 AT_CHECK([ovs-ofctl add-flow br0 in_port=7,actions=normal])
2688 AT_CHECK([ovs-ofctl add-flow br0 in_port=8,actions=drop], [1], [], [stderr])
2689 AT_CHECK([ofctl_strip < stderr], [0],
2690 [OFPT_ERROR: OFPFMFC_TABLE_FULL
2691 OFPT_FLOW_MOD: ADD in_port=8 actions=drop
2692 ])
2693 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
2694 in_port=4 actions=NORMAL
2695 in_port=5 actions=drop
2696 in_port=6 actions=drop
2697 in_port=7 actions=NORMAL
2698 NXST_FLOW reply:
2699 ])
2700 OVS_VSWITCHD_STOP
2701 AT_CLEANUP
2702
2703 AT_SETUP([ofproto - eviction upon table overflow (OpenFlow 1.2)])
2704 OVS_VSWITCHD_START
2705 # Configure a maximum of 4 flows.
2706 AT_CHECK(
2707 [ovs-vsctl \
2708 -- --id=@t0 create Flow_Table flow-limit=4 overflow-policy=evict \
2709 -- set bridge br0 flow_tables:0=@t0 \
2710 | uuidfilt],
2711 [0], [<0>
2712 ])
2713 # Add 4 flows.
2714 for in_port in 4 3 2 1; do
2715 ovs-ofctl -O OpenFlow12 add-flow br0 idle_timeout=${in_port}0,in_port=$in_port,actions=drop
2716 done
2717 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
2718 idle_timeout=10, in_port=1 actions=drop
2719 idle_timeout=20, in_port=2 actions=drop
2720 idle_timeout=30, in_port=3 actions=drop
2721 idle_timeout=40, in_port=4 actions=drop
2722 OFPST_FLOW reply (OF1.2):
2723 ])
2724 # Adding another flow will cause the one that expires soonest to be evicted.
2725 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 in_port=5,actions=drop])
2726 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
2727 idle_timeout=20, in_port=2 actions=drop
2728 idle_timeout=30, in_port=3 actions=drop
2729 idle_timeout=40, in_port=4 actions=drop
2730 in_port=5 actions=drop
2731 OFPST_FLOW reply (OF1.2):
2732 ])
2733 # In OpenFlow 1.2 a mod-flow does not ever add a flow and thus
2734 # has no effect on eviction
2735 AT_CHECK([ovs-ofctl -O OpenFlow12 mod-flows br0 in_port=6,actions=drop])
2736 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 in_port=4,actions=normal])
2737 AT_CHECK([ovs-ofctl -O OpenFlow12 mod-flows br0 in_port=3,actions=output:1])
2738 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
2739 idle_timeout=20, in_port=2 actions=drop
2740 idle_timeout=30, in_port=3 actions=output:1
2741 in_port=4 actions=NORMAL
2742 in_port=5 actions=drop
2743 OFPST_FLOW reply (OF1.2):
2744 ])
2745 # Flows with no timeouts at all cannot be evicted.
2746 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 in_port=6,actions=drop])
2747 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 in_port=7,actions=normal])
2748 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 in_port=8,actions=drop], [1], [], [stderr])
2749 AT_CHECK([ofctl_strip < stderr], [0],
2750 [OFPT_ERROR (OF1.2): OFPFMFC_TABLE_FULL
2751 OFPT_FLOW_MOD (OF1.2): ADD in_port=8 actions=drop
2752 ])
2753 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
2754 in_port=4 actions=NORMAL
2755 in_port=5 actions=drop
2756 in_port=6 actions=drop
2757 in_port=7 actions=NORMAL
2758 OFPST_FLOW reply (OF1.2):
2759 ])
2760 OVS_VSWITCHD_STOP
2761 AT_CLEANUP
2762
2763 AT_SETUP([ofproto - eviction using importance upon table overflow (OpenFlow 1.4)])
2764 OVS_VSWITCHD_START
2765 # Configure a maximum of 4 flows.
2766 AT_CHECK(
2767 [ovs-vsctl \
2768 -- --id=@t0 create Flow_Table name=evict flow-limit=4 \
2769 -- set bridge br0 flow_tables:0=@t0 \
2770 | uuidfilt],
2771 [0], [<0>
2772 ])
2773 # Use mod-table to turn on eviction just to demonstrate that it works.
2774 AT_CHECK([ovs-ofctl -O OpenFlow14 mod-table br0 0 evict])
2775 # Add 4 flows.
2776 for in_port in 4 3 2 1; do
2777 ovs-ofctl -O Openflow14 add-flow br0 importance=$((in_port + 30)),priority=$((in_port + 5)),hard_timeout=$((in_port + 500)),actions=drop
2778 done
2779 AT_CHECK([ovs-ofctl -O Openflow14 dump-flows br0 | ofctl_strip | sort], [0], [dnl
2780 hard_timeout=501, importance=31, priority=6 actions=drop
2781 hard_timeout=502, importance=32, priority=7 actions=drop
2782 hard_timeout=503, importance=33, priority=8 actions=drop
2783 hard_timeout=504, importance=34, priority=9 actions=drop
2784 OFPST_FLOW reply (OF1.4):
2785 ])
2786 # Adding another flow will cause the one with lowest importance to be evicted.
2787 AT_CHECK([ovs-ofctl -O Openflow14 add-flow br0 hard_timeout=505,importance=35,priority=10,in_port=2,actions=drop])
2788 AT_CHECK([ovs-ofctl -O Openflow14 dump-flows br0 | ofctl_strip | sort], [0], [dnl
2789 hard_timeout=502, importance=32, priority=7 actions=drop
2790 hard_timeout=503, importance=33, priority=8 actions=drop
2791 hard_timeout=504, importance=34, priority=9 actions=drop
2792 hard_timeout=505, importance=35, priority=10,in_port=2 actions=drop
2793 OFPST_FLOW reply (OF1.4):
2794 ])
2795 # Disable the Eviction configuration.
2796 AT_CHECK([ovs-ofctl -O OpenFlow14 mod-table br0 0 noevict])
2797 # Adding another flow will cause the system to give error for FULL TABLE.
2798 AT_CHECK([ovs-ofctl -O Openflow14 add-flow br0 hard_timeout=506,importance=36,priority=11,actions=drop],[1], [], [stderr])
2799 AT_CHECK([ofctl_strip < stderr], [0],
2800 [OFPT_ERROR (OF1.4): OFPFMFC_TABLE_FULL
2801 OFPT_FLOW_MOD (OF1.4): ADD priority=11 hard:506 importance:36 actions=drop
2802 ])
2803 #Dump flows. It should show only the old values
2804 AT_CHECK([ovs-ofctl -O Openflow14 dump-flows br0 | ofctl_strip | sort], [0], [dnl
2805 hard_timeout=502, importance=32, priority=7 actions=drop
2806 hard_timeout=503, importance=33, priority=8 actions=drop
2807 hard_timeout=504, importance=34, priority=9 actions=drop
2808 hard_timeout=505, importance=35, priority=10,in_port=2 actions=drop
2809 OFPST_FLOW reply (OF1.4):
2810 ])
2811 # mod-flow that would modify a flow will be done successfully.
2812 AT_CHECK([ovs-ofctl -O Openflow14 mod-flows br0 in_port=2,actions=NORMAL])
2813 AT_CHECK([ovs-ofctl -O Openflow14 dump-flows br0 | ofctl_strip | sort], [0], [dnl
2814 hard_timeout=502, importance=32, priority=7 actions=drop
2815 hard_timeout=503, importance=33, priority=8 actions=drop
2816 hard_timeout=504, importance=34, priority=9 actions=drop
2817 hard_timeout=505, importance=35, priority=10,in_port=2 actions=NORMAL
2818 OFPST_FLOW reply (OF1.4):
2819 ])
2820 # Also a mod-flow that would add a flow will be refused.
2821 AT_CHECK([ovs-ofctl mod-flows br0 in_port=5,actions=drop], [1], [], [stderr])
2822 AT_CHECK([ofctl_strip < stderr], [0],
2823 [OFPT_ERROR: OFPFMFC_TABLE_FULL
2824 OFPT_FLOW_MOD: MOD in_port=5 actions=drop
2825 ])
2826 OVS_VSWITCHD_STOP
2827 AT_CLEANUP
2828
2829 AT_SETUP([ofproto - eviction upon table overflow, with fairness (OpenFlow 1.0)])
2830 OVS_VSWITCHD_START
2831 # Configure a maximum of 4 flows.
2832 AT_CHECK(
2833 [ovs-vsctl \
2834 -- --id=@t0 create Flow_Table name=evict flow-limit=4 \
2835 overflow-policy=evict \
2836 groups='"NXM_OF_IN_PORT[[]]"' \
2837 -- set bridge br0 flow_tables:0=@t0 \
2838 | uuidfilt],
2839 [0], [<0>
2840 ])
2841 # Add 4 flows.
2842 ovs-ofctl add-flows br0 - <<EOF
2843 idle_timeout=10 in_port=2 dl_src=00:44:55:66:77:88 actions=drop
2844 idle_timeout=20 in_port=1 dl_src=00:11:22:33:44:55 actions=drop
2845 idle_timeout=30 in_port=1 dl_src=00:22:33:44:55:66 actions=drop
2846 idle_timeout=40 in_port=1 dl_src=00:33:44:55:66:77 actions=drop
2847 EOF
2848 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
2849 idle_timeout=10, in_port=2,dl_src=00:44:55:66:77:88 actions=drop
2850 idle_timeout=20, in_port=1,dl_src=00:11:22:33:44:55 actions=drop
2851 idle_timeout=30, in_port=1,dl_src=00:22:33:44:55:66 actions=drop
2852 idle_timeout=40, in_port=1,dl_src=00:33:44:55:66:77 actions=drop
2853 NXST_FLOW reply:
2854 ])
2855 # Adding another flow will cause the one that expires soonest within
2856 # the largest group (those with in_port=1) to be evicted. In this
2857 # case this is not the same as the one that expires soonest overall
2858 # (which is what makes the test interesting):
2859 AT_CHECK([ovs-ofctl add-flow br0 in_port=2,dl_src=00:55:66:77:88:99,actions=drop])
2860 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
2861 idle_timeout=10, in_port=2,dl_src=00:44:55:66:77:88 actions=drop
2862 idle_timeout=30, in_port=1,dl_src=00:22:33:44:55:66 actions=drop
2863 idle_timeout=40, in_port=1,dl_src=00:33:44:55:66:77 actions=drop
2864 in_port=2,dl_src=00:55:66:77:88:99 actions=drop
2865 NXST_FLOW reply:
2866 ])
2867 # Enlarge the flow limit, change the eviction policy back to strictly
2868 # based on expiration, and and add some flows.
2869 AT_CHECK([ovs-vsctl set Flow_Table evict groups='[[]]' flow-limit=7])
2870 ovs-ofctl add-flows br0 - <<EOF
2871 idle_timeout=50 in_port=2 dl_src=00:66:77:88:99:aa actions=drop
2872 idle_timeout=60 in_port=2 dl_src=00:77:88:99:aa:bb actions=drop
2873 idle_timeout=70 in_port=2 dl_src=00:88:99:aa:bb:cc actions=drop
2874 EOF
2875 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
2876 idle_timeout=10, in_port=2,dl_src=00:44:55:66:77:88 actions=drop
2877 idle_timeout=30, in_port=1,dl_src=00:22:33:44:55:66 actions=drop
2878 idle_timeout=40, in_port=1,dl_src=00:33:44:55:66:77 actions=drop
2879 idle_timeout=50, in_port=2,dl_src=00:66:77:88:99:aa actions=drop
2880 idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=drop
2881 idle_timeout=70, in_port=2,dl_src=00:88:99:aa:bb:cc actions=drop
2882 in_port=2,dl_src=00:55:66:77:88:99 actions=drop
2883 NXST_FLOW reply:
2884 ])
2885 # Adding another flow will cause the one that expires soonest overall
2886 # to be evicted.
2887 AT_CHECK([ovs-ofctl add-flow br0 'idle_timeout=80 in_port=2 dl_src=00:99:aa:bb:cc:dd actions=drop'])
2888 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
2889 idle_timeout=30, in_port=1,dl_src=00:22:33:44:55:66 actions=drop
2890 idle_timeout=40, in_port=1,dl_src=00:33:44:55:66:77 actions=drop
2891 idle_timeout=50, in_port=2,dl_src=00:66:77:88:99:aa actions=drop
2892 idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=drop
2893 idle_timeout=70, in_port=2,dl_src=00:88:99:aa:bb:cc actions=drop
2894 idle_timeout=80, in_port=2,dl_src=00:99:aa:bb:cc:dd actions=drop
2895 in_port=2,dl_src=00:55:66:77:88:99 actions=drop
2896 NXST_FLOW reply:
2897 ])
2898 # Reducing the flow limit also causes the flows that expire soonest
2899 # overall to be evicted.
2900 AT_CHECK([ovs-vsctl set Flow_Table evict flow-limit=4])
2901 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
2902 idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=drop
2903 idle_timeout=70, in_port=2,dl_src=00:88:99:aa:bb:cc actions=drop
2904 idle_timeout=80, in_port=2,dl_src=00:99:aa:bb:cc:dd actions=drop
2905 in_port=2,dl_src=00:55:66:77:88:99 actions=drop
2906 NXST_FLOW reply:
2907 ])
2908 OVS_VSWITCHD_STOP
2909 AT_CLEANUP
2910
2911 AT_SETUP([ofproto - eviction upon table overflow, with fairness (OpenFlow 1.2)])
2912 OVS_VSWITCHD_START
2913 # Configure a maximum of 4 flows.
2914 AT_CHECK(
2915 [ovs-vsctl \
2916 -- --id=@t0 create Flow_Table name=evict flow-limit=4 \
2917 overflow-policy=evict \
2918 groups='"NXM_OF_IN_PORT[[]]"' \
2919 -- set bridge br0 flow_tables:0=@t0 \
2920 | uuidfilt],
2921 [0], [<0>
2922 ])
2923 # Add 4 flows.
2924 ovs-ofctl -O OpenFlow12 add-flows br0 - <<EOF
2925 idle_timeout=10 in_port=2 dl_src=00:44:55:66:77:88 actions=drop
2926 idle_timeout=20 in_port=1 dl_src=00:11:22:33:44:55 actions=drop
2927 idle_timeout=30 in_port=1 dl_src=00:22:33:44:55:66 actions=drop
2928 idle_timeout=40 in_port=1 dl_src=00:33:44:55:66:77 actions=drop
2929 EOF
2930 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
2931 idle_timeout=10, in_port=2,dl_src=00:44:55:66:77:88 actions=drop
2932 idle_timeout=20, in_port=1,dl_src=00:11:22:33:44:55 actions=drop
2933 idle_timeout=30, in_port=1,dl_src=00:22:33:44:55:66 actions=drop
2934 idle_timeout=40, in_port=1,dl_src=00:33:44:55:66:77 actions=drop
2935 OFPST_FLOW reply (OF1.2):
2936 ])
2937 # Adding another flow will cause the one that expires soonest within
2938 # the largest group (those with in_port=1) to be evicted. In this
2939 # case this is not the same as the one that expires soonest overall
2940 # (which is what makes the test interesting):
2941 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 in_port=2,dl_src=00:55:66:77:88:99,actions=drop])
2942 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
2943 idle_timeout=10, in_port=2,dl_src=00:44:55:66:77:88 actions=drop
2944 idle_timeout=30, in_port=1,dl_src=00:22:33:44:55:66 actions=drop
2945 idle_timeout=40, in_port=1,dl_src=00:33:44:55:66:77 actions=drop
2946 in_port=2,dl_src=00:55:66:77:88:99 actions=drop
2947 OFPST_FLOW reply (OF1.2):
2948 ])
2949 # Enlarge the flow limit, change the eviction policy back to strictly
2950 # based on expiration, and and add some flows.
2951 AT_CHECK([ovs-vsctl set Flow_Table evict groups='[[]]' flow-limit=7])
2952 ovs-ofctl -O OpenFlow12 add-flows br0 - <<EOF
2953 idle_timeout=50 in_port=2 dl_src=00:66:77:88:99:aa actions=drop
2954 idle_timeout=60 in_port=2 dl_src=00:77:88:99:aa:bb actions=drop
2955 idle_timeout=70 in_port=2 dl_src=00:88:99:aa:bb:cc actions=drop
2956 EOF
2957 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
2958 idle_timeout=10, in_port=2,dl_src=00:44:55:66:77:88 actions=drop
2959 idle_timeout=30, in_port=1,dl_src=00:22:33:44:55:66 actions=drop
2960 idle_timeout=40, in_port=1,dl_src=00:33:44:55:66:77 actions=drop
2961 idle_timeout=50, in_port=2,dl_src=00:66:77:88:99:aa actions=drop
2962 idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=drop
2963 idle_timeout=70, in_port=2,dl_src=00:88:99:aa:bb:cc actions=drop
2964 in_port=2,dl_src=00:55:66:77:88:99 actions=drop
2965 OFPST_FLOW reply (OF1.2):
2966 ])
2967 # Adding another flow will cause the one that expires soonest overall
2968 # to be evicted.
2969 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'])
2970 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
2971 idle_timeout=30, in_port=1,dl_src=00:22:33:44:55:66 actions=drop
2972 idle_timeout=40, in_port=1,dl_src=00:33:44:55:66:77 actions=drop
2973 idle_timeout=50, in_port=2,dl_src=00:66:77:88:99:aa actions=drop
2974 idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=drop
2975 idle_timeout=70, in_port=2,dl_src=00:88:99:aa:bb:cc actions=drop
2976 idle_timeout=80, in_port=2,dl_src=00:99:aa:bb:cc:dd actions=drop
2977 in_port=2,dl_src=00:55:66:77:88:99 actions=drop
2978 OFPST_FLOW reply (OF1.2):
2979 ])
2980 # Reducing the flow limit also causes the flows that expire soonest
2981 # overall to be evicted.
2982 AT_CHECK([ovs-vsctl set Flow_Table evict flow-limit=4])
2983 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
2984 idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=drop
2985 idle_timeout=70, in_port=2,dl_src=00:88:99:aa:bb:cc actions=drop
2986 idle_timeout=80, in_port=2,dl_src=00:99:aa:bb:cc:dd actions=drop
2987 in_port=2,dl_src=00:55:66:77:88:99 actions=drop
2988 OFPST_FLOW reply (OF1.2):
2989 ])
2990 OVS_VSWITCHD_STOP
2991 AT_CLEANUP
2992
2993 AT_SETUP([ofproto - eviction upon table overflow, with modified hard timeout])
2994 OVS_VSWITCHD_START
2995 # Configure a maximum of 4 flows.
2996 AT_CHECK(
2997 [ovs-vsctl \
2998 -- --id=@t0 create Flow_Table flow-limit=4 overflow-policy=evict \
2999 -- set bridge br0 flow_tables:0=@t0 \
3000 | uuidfilt],
3001 [0], [<0>
3002 ])
3003 ovs-appctl time/stop
3004 # Add 4 flows.
3005 for in_port in 4 3 2 1; do
3006 ovs-ofctl add-flow br0 hard_timeout=$((10 + in_port * 3)),in_port=$in_port,actions=drop
3007 done
3008 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
3009 hard_timeout=13, in_port=1 actions=drop
3010 hard_timeout=16, in_port=2 actions=drop
3011 hard_timeout=19, in_port=3 actions=drop
3012 hard_timeout=22, in_port=4 actions=drop
3013 NXST_FLOW reply:
3014 ])
3015 # Sleep and modify the one that expires soonest
3016 ovs-appctl time/warp 5000
3017 AT_CHECK([ovs-ofctl mod-flows br0 in_port=1,actions=drop])
3018 # At this point the table would looks like:
3019 # in_port seconds to expire
3020 # 1 13
3021 # 2 11
3022 # 3 14
3023 # 4 17
3024 ovs-appctl time/warp 2000
3025 # Adding another flow will cause the one that expires soonest to be evicted.
3026 AT_CHECK([ovs-ofctl add-flow br0 in_port=5,actions=drop])
3027 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
3028 hard_timeout=13, in_port=1 actions=drop
3029 hard_timeout=19, in_port=3 actions=drop
3030 hard_timeout=22, in_port=4 actions=drop
3031 in_port=5 actions=drop
3032 NXST_FLOW reply:
3033 ])
3034 OVS_VSWITCHD_STOP
3035 AT_CLEANUP
3036
3037 AT_SETUP([ofproto - eviction upon table overflow, with modified idle timeout])
3038 OVS_VSWITCHD_START([add-port br0 p1 -- set interface p1 type=dummy ofport_request=1])
3039 # Configure a maximum of 4 flows.
3040 AT_CHECK(
3041 [ovs-vsctl \
3042 -- --id=@t0 create Flow_Table flow-limit=4 overflow-policy=evict \
3043 -- set bridge br0 flow_tables:0=@t0 \
3044 | uuidfilt],
3045 [0], [<0>
3046 ])
3047 # Add 4 flows.
3048 for in_port in 4 3 2 1; do
3049 ovs-ofctl add-flow br0 idle_timeout=$((10 + in_port * 3)),in_port=$in_port,actions=drop
3050 done
3051 ovs-appctl time/stop
3052 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
3053 idle_timeout=13, in_port=1 actions=drop
3054 idle_timeout=16, in_port=2 actions=drop
3055 idle_timeout=19, in_port=3 actions=drop
3056 idle_timeout=22, in_port=4 actions=drop
3057 NXST_FLOW reply:
3058 ])
3059 # Sleep and receive on the flow that expires soonest
3060 ovs-appctl time/warp 5000
3061 AT_CHECK([ovs-appctl netdev-dummy/receive p1 'in_port(1)'])
3062 # At this point the table would looks like:
3063 # in_port seconds to expire
3064 # 1 13
3065 # 2 11
3066 # 3 14
3067 # 4 17
3068 ovs-appctl time/warp 2000
3069 # Adding another flow will cause the one that expires soonest to be evicted.
3070 AT_CHECK([ovs-ofctl add-flow br0 in_port=5,actions=drop])
3071 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
3072 idle_timeout=19, in_port=3 actions=drop
3073 idle_timeout=22, in_port=4 actions=drop
3074 in_port=5 actions=drop
3075 n_packets=1, n_bytes=14, idle_timeout=13, in_port=1 actions=drop
3076 NXST_FLOW reply:
3077 ])
3078 OVS_VSWITCHD_STOP
3079 AT_CLEANUP
3080
3081 AT_SETUP([ofproto - asynchronous message control (OpenFlow 1.0)])
3082 OVS_VSWITCHD_START([set bridge br0 other_config:hwaddr=00:01:02:03:04:05])
3083 AT_CHECK([ovs-ofctl -P standard monitor br0 --detach --no-chdir --pidfile])
3084 check_async () {
3085 printf '\n\n--- check_async %d ---\n\n\n' $1
3086 shift
3087
3088 ovs-appctl -t ovs-ofctl ofctl/barrier
3089 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
3090 : > expout
3091
3092 # OFPT_PACKET_IN, OFPR_ACTION (controller_id=0)
3093 ovs-ofctl -v packet-out br0 controller controller '0001020304050010203040501234'
3094 if test X"$1" = X"OFPR_ACTION"; then shift;
3095 echo >>expout "OFPT_PACKET_IN: total_len=14 in_port=CONTROLLER (via action) data_len=14 (unbuffered)
3096 vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1234"
3097 fi
3098
3099 # OFPT_PACKET_IN, OFPR_NO_MATCH (controller_id=123)
3100 ovs-ofctl -v packet-out br0 controller 'controller(reason=no_match,id=123)' '0001020304050010203040501234'
3101 if test X"$1" = X"OFPR_NO_MATCH"; then shift;
3102 echo >>expout "OFPT_PACKET_IN: total_len=14 in_port=CONTROLLER (via no_match) data_len=14 (unbuffered)
3103 vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1234"
3104 fi
3105
3106 # OFPT_PACKET_IN, OFPR_INVALID_TTL (controller_id=0)
3107 ovs-ofctl packet-out br0 "in_port=controller packet=002583dfb4000026b98cb0f908004500003eb7e200000011339bac11370dac100002d7730035002b8f6d86fb0100000100000000000006626c702d7873066e696369726103636f6d00000f00 actions=dec_ttl"
3108 if test X"$1" = X"OFPR_INVALID_TTL"; then shift;
3109 echo >>expout "OFPT_PACKET_IN: total_len=76 in_port=CONTROLLER (via invalid_ttl) data_len=76 (unbuffered)
3110 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"
3111 fi
3112
3113 # OFPT_PORT_STATUS, OFPPR_ADD
3114 ovs-vsctl add-port br0 test -- set Interface test type=dummy ofport_request=1
3115 if test X"$1" = X"OFPPR_ADD"; then shift;
3116 echo >>expout "OFPT_PORT_STATUS: ADD: 1(test): addr:aa:55:aa:55:00:0x
3117 config: 0
3118 state: 0
3119 speed: 0 Mbps now, 0 Mbps max"
3120 fi
3121
3122 # OFPT_PORT_STATUS, OFPPR_DELETE
3123 ovs-vsctl del-port br0 test
3124 if test X"$1" = X"OFPPR_DELETE"; then shift;
3125 echo >>expout "OFPT_PORT_STATUS: DEL: 1(test): addr:aa:55:aa:55:00:0x
3126 config: 0
3127 state: 0
3128 speed: 0 Mbps now, 0 Mbps max"
3129 fi
3130
3131 # OFPT_FLOW_REMOVED, OFPRR_DELETE
3132 ovs-ofctl add-flow br0 send_flow_rem,actions=drop
3133 ovs-ofctl --strict del-flows br0 ''
3134 if test X"$1" = X"OFPRR_DELETE"; then shift;
3135 echo >>expout "OFPT_FLOW_REMOVED: reason=delete"
3136 fi
3137 AT_FAIL_IF([test X"$1" != X])
3138
3139 OVS_WAIT_UNTIL([test `wc -l < "monitor.log"` -ge `wc -l < "expout"`])
3140
3141 AT_CHECK(
3142 [[sed '
3143 s/ (xid=0x[0-9a-fA-F]*)//
3144 s/ *duration.*//
3145 s/00:0.$/00:0x/' < monitor.log]],
3146 [0], [expout])
3147 }
3148
3149 # It's a service connection so initially there should be no async messages.
3150 check_async 1
3151
3152 # Set miss_send_len to 128, turning on packet-ins for our service connection.
3153 ovs-appctl -t ovs-ofctl ofctl/send 0109000c0123456700000080
3154 check_async 2 OFPR_ACTION OFPPR_ADD OFPPR_DELETE OFPRR_DELETE
3155
3156 # Set miss_send_len to 128 and enable invalid_ttl.
3157 ovs-appctl -t ovs-ofctl ofctl/send 0109000c0123456700040080
3158 check_async 3 OFPR_ACTION OFPR_INVALID_TTL OFPPR_ADD OFPPR_DELETE OFPRR_DELETE
3159
3160 # Become slave, which should disable everything except port status.
3161 ovs-appctl -t ovs-ofctl ofctl/send 0104001400000002000023200000000a00000002
3162 check_async 4 OFPPR_ADD OFPPR_DELETE
3163
3164 # Use NXT_SET_ASYNC_CONFIG to enable a patchwork of asynchronous messages.
3165 ovs-appctl -t ovs-ofctl ofctl/send 01040028000000020000232000000013000000020000000500000005000000020000000200000005
3166 check_async 5 OFPR_INVALID_TTL OFPPR_DELETE OFPRR_DELETE
3167
3168 # Set controller ID 123.
3169 ovs-appctl -t ovs-ofctl ofctl/send 01040018000000030000232000000014000000000000007b
3170 check_async 6 OFPR_NO_MATCH OFPPR_DELETE OFPRR_DELETE
3171
3172 # Restore controller ID 0.
3173 ovs-appctl -t ovs-ofctl ofctl/send 010400180000000300002320000000140000000000000000
3174
3175 # Become master.
3176 ovs-appctl -t ovs-ofctl ofctl/send 0104001400000002000023200000000a00000001
3177 check_async 7 OFPR_ACTION OFPPR_ADD
3178
3179 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
3180 OVS_VSWITCHD_STOP
3181 AT_CLEANUP
3182
3183 AT_SETUP([ofproto - asynchronous message control (OpenFlow 1.2)])
3184 OVS_VSWITCHD_START
3185 AT_CHECK([ovs-ofctl -O OpenFlow12 -P standard monitor br0 --detach --no-chdir --pidfile])
3186 check_async () {
3187 printf '\n\n--- check_async %d ---\n\n\n' $1
3188 INDEX=$1
3189 shift
3190
3191 ovs-appctl -t ovs-ofctl ofctl/barrier
3192 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
3193 : > expout
3194
3195 # OFPT_PACKET_IN, OFPR_ACTION (controller_id=0)
3196 ovs-ofctl -O OpenFlow12 -v packet-out br0 none controller '0001020304050010203040501234'
3197 if test X"$1" = X"OFPR_ACTION"; then shift;
3198 echo >>expout "OFPT_PACKET_IN (OF1.2): total_len=14 in_port=ANY (via action) data_len=14 (unbuffered)
3199 vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1234"
3200 fi
3201
3202 # OFPT_PACKET_IN, OFPR_NO_MATCH (controller_id=123)
3203 ovs-ofctl -O OpenFlow12 -v packet-out br0 none 'controller(reason=no_match,id=123)' '0001020304050010203040501234'
3204 if test X"$1" = X"OFPR_NO_MATCH"; then shift;
3205 echo >>expout "OFPT_PACKET_IN (OF1.2): total_len=14 in_port=ANY (via no_match) data_len=14 (unbuffered)
3206 vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1234"
3207 fi
3208
3209 # OFPT_PACKET_IN, OFPR_INVALID_TTL (controller_id=0)
3210 ovs-ofctl -O OpenFlow12 packet-out br0 none dec_ttl '002583dfb4000026b98cb0f908004500003eb7e200000011339bac11370dac100002d7730035002b8f6d86fb0100000100000000000006626c702d7873066e696369726103636f6d00000f00'
3211 if test X"$1" = X"OFPR_INVALID_TTL"; then shift;
3212 echo >>expout "OFPT_PACKET_IN (OF1.2): total_len=76 in_port=ANY (via invalid_ttl) data_len=76 (unbuffered)
3213 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"
3214 fi
3215
3216 # OFPT_PORT_STATUS, OFPPR_ADD
3217 ovs-vsctl add-port br0 test -- set Interface test type=dummy
3218 if test X"$1" = X"OFPPR_ADD"; then shift;
3219 echo >>expout "OFPT_PORT_STATUS (OF1.2): ADD: ${INDEX}(test): addr:aa:55:aa:55:00:0x
3220 config: 0
3221 state: 0
3222 speed: 0 Mbps now, 0 Mbps max
3223 OFPT_PORT_STATUS (OF1.2): MOD: ${INDEX}(test): addr:aa:55:aa:55:00:0x
3224 config: 0
3225 state: LIVE
3226 speed: 0 Mbps now, 0 Mbps max"
3227 fi
3228
3229 # OFPT_PORT_STATUS, OFPPR_DELETE
3230 ovs-vsctl del-port br0 test
3231 if test X"$1" = X"OFPPR_DELETE"; then shift;
3232 echo >>expout "OFPT_PORT_STATUS (OF1.2): DEL: ${INDEX}(test): addr:aa:55:aa:55:00:0x
3233 config: 0
3234 state: LIVE
3235 speed: 0 Mbps now, 0 Mbps max"
3236 fi
3237
3238 # OFPT_FLOW_REMOVED, OFPRR_DELETE
3239 ovs-ofctl -O OpenFlow12 add-flow br0 send_flow_rem,actions=drop
3240 ovs-ofctl -O OpenFlow12 --strict del-flows br0 ''
3241 if test X"$1" = X"OFPRR_DELETE"; then shift;
3242 echo >>expout "OFPT_FLOW_REMOVED (OF1.2): reason=delete table_id=0"
3243 fi
3244 AT_FAIL_IF([test X"$1" != X])
3245
3246 OVS_WAIT_UNTIL([test `wc -l < "monitor.log"` -ge `wc -l < "expout"`])
3247
3248 AT_CHECK(
3249 [[sed '
3250 s/ (xid=0x[0-9a-fA-F]*)//
3251 s/ *duration.*//
3252 s/00:0.$/00:0x/' < monitor.log]],
3253 [0], [expout])
3254 }
3255
3256 # It's a service connection so initially there should be no async messages.
3257 check_async 1
3258
3259 # Set miss_send_len to 128, turning on packet-ins for our service connection.
3260 ovs-appctl -t ovs-ofctl ofctl/send 0309000c0123456700000080
3261 check_async 2 OFPR_ACTION OFPPR_ADD OFPPR_DELETE OFPRR_DELETE
3262
3263 # Set miss_send_len to 128 and enable invalid_ttl.
3264 ovs-appctl -t ovs-ofctl ofctl/send 0309000c0123456700040080
3265 check_async 3 OFPR_ACTION OFPR_INVALID_TTL OFPPR_ADD OFPPR_DELETE OFPRR_DELETE
3266
3267 # Become slave (OF 1.2), which should disable everything except port status.
3268 ovs-appctl -t ovs-ofctl ofctl/send 031800180000000200000003000000000000000000000001
3269 check_async 4 OFPPR_ADD OFPPR_DELETE
3270
3271 # Use NXT_SET_ASYNC_CONFIG to enable a patchwork of asynchronous messages.
3272 ovs-appctl -t ovs-ofctl ofctl/send 03040028000000020000232000000013000000020000000500000005000000020000000200000005
3273 check_async 5 OFPR_INVALID_TTL OFPPR_DELETE OFPRR_DELETE
3274
3275 # Set controller ID 123.
3276 ovs-appctl -t ovs-ofctl ofctl/send 03040018000000030000232000000014000000000000007b
3277 check_async 6 OFPR_NO_MATCH OFPPR_DELETE OFPRR_DELETE
3278
3279 # Restore controller ID 0.
3280 ovs-appctl -t ovs-ofctl ofctl/send 030400180000000300002320000000140000000000000000
3281
3282 # Become master (OF 1.2).
3283 ovs-appctl -t ovs-ofctl ofctl/send 031800180000000400000002000000000000000000000002
3284 check_async 7 OFPR_ACTION OFPPR_ADD
3285
3286 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
3287 OVS_VSWITCHD_STOP
3288 AT_CLEANUP
3289
3290 AT_SETUP([ofproto - asynchronous message control (OpenFlow 1.3)])
3291 OVS_VSWITCHD_START([dnl
3292 add-port br0 p1 -- set Interface p1 type=dummy ofport_request=10
3293 ])
3294 AT_CHECK([ovs-ofctl -O OpenFlow13 -P standard monitor br0 --detach --no-chdir --pidfile])
3295 check_async () {
3296 printf '\n\n--- check_async %d ---\n\n\n' $1
3297 INDEX=$1
3298 shift
3299
3300 ovs-appctl -t ovs-ofctl ofctl/barrier
3301 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
3302 : > expout
3303
3304 # OFPT_PACKET_IN, OFPR_ACTION (controller_id=0)
3305 # OFPR_ACTION_SET is treated as OFPR_ACTION in OpenFlow 1.3
3306 ovs-ofctl -O OpenFlow13 -v packet-out br0 none controller '0001020304050010203040501234'
3307 ovs-ofctl -O OpenFlow13 add-flow br0 'in_port=10 actions=write_actions(output(CONTROLLER))'
3308 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)'
3309 if test X"$1" = X"OFPR_ACTION"; then shift;
3310 echo >>expout "OFPT_PACKET_IN (OF1.3): total_len=14 in_port=ANY (via action) data_len=14 (unbuffered)
3311 vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1234"
3312 echo >>expout "OFPT_PACKET_IN (OF1.3): cookie=0x0 total_len=14 in_port=10 (via action) data_len=14 (unbuffered)
3313 vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1234"
3314 fi
3315
3316 # OFPT_PACKET_IN, OFPR_NO_MATCH (controller_id=123)
3317 ovs-ofctl -O OpenFlow13 -v packet-out br0 none 'controller(reason=no_match,id=123)' '0001020304050010203040501234'
3318 if test X"$1" = X"OFPR_NO_MATCH"; then shift;
3319 echo >>expout "OFPT_PACKET_IN (OF1.3): total_len=14 in_port=ANY (via no_match) data_len=14 (unbuffered)
3320 vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1234"
3321 fi
3322
3323 # OFPT_PACKET_IN, OFPR_INVALID_TTL (controller_id=0)
3324 ovs-ofctl -O OpenFlow13 packet-out br0 none dec_ttl '002583dfb4000026b98cb0f908004500003eb7e200000011339bac11370dac100002d7730035002b8f6d86fb0100000100000000000006626c702d7873066e696369726103636f6d00000f00'
3325 if test X"$1" = X"OFPR_INVALID_TTL"; then shift;
3326 echo >>expout "OFPT_PACKET_IN (OF1.3): total_len=76 in_port=ANY (via invalid_ttl) data_len=76 (unbuffered)
3327 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"
3328 fi
3329
3330 # OFPT_PORT_STATUS, OFPPR_ADD
3331 ovs-vsctl add-port br0 test -- set Interface test type=dummy
3332 if test X"$1" = X"OFPPR_ADD"; then shift;
3333 echo >>expout "OFPT_PORT_STATUS (OF1.3): ADD: ${INDEX}(test): addr:aa:55:aa:55:00:0x
3334 config: 0
3335 state: 0
3336 speed: 0 Mbps now, 0 Mbps max
3337 OFPT_PORT_STATUS (OF1.3): MOD: ${INDEX}(test): addr:aa:55:aa:55:00:0x
3338 config: 0
3339 state: LIVE
3340 speed: 0 Mbps now, 0 Mbps max"
3341 fi
3342
3343 # OFPT_PORT_STATUS, OFPPR_DELETE
3344 ovs-vsctl del-port br0 test
3345 if test X"$1" = X"OFPPR_DELETE"; then shift;
3346 echo >>expout "OFPT_PORT_STATUS (OF1.3): DEL: ${INDEX}(test): addr:aa:55:aa:55:00:0x
3347 config: 0
3348 state: LIVE
3349 speed: 0 Mbps now, 0 Mbps max"
3350 fi
3351
3352 # OFPT_FLOW_REMOVED, OFPRR_DELETE
3353 ovs-ofctl -O OpenFlow13 add-flow br0 send_flow_rem,actions=drop
3354 ovs-ofctl -O OpenFlow13 --strict del-flows br0 ''
3355 if test X"$1" = X"OFPRR_DELETE"; then shift;
3356 echo >>expout "OFPT_FLOW_REMOVED (OF1.3): reason=delete table_id=0"
3357 fi
3358
3359 # OFPT_FLOW_REMOVED, OFPRR_GROUP_DELETE
3360 ovs-ofctl -O OpenFlow13 add-group br0 group_id=1234,type=all,bucket=output:10
3361 ovs-ofctl -O OpenFlow13 add-flow br0 send_flow_rem,actions=group:1234
3362 ovs-ofctl -O OpenFlow13 --strict del-groups br0 group_id=1234
3363 if test X"$1" = X"OFPRR_GROUP_DELETE"; then shift;
3364 echo >>expout "OFPT_FLOW_REMOVED (OF1.3): reason=group_delete table_id=0"
3365 fi
3366
3367 AT_FAIL_IF([test X"$1" != X])
3368
3369 OVS_WAIT_UNTIL([test `wc -l < "monitor.log"` -ge `wc -l < "expout"`])
3370
3371 AT_CHECK(
3372 [[sed '
3373 s/ (xid=0x[0-9a-fA-F]*)//
3374 s/ *duration.*//
3375 s/00:0.$/00:0x/' < monitor.log]],
3376 [0], [expout])
3377 }
3378
3379 # It's a service connection so initially there should be no async messages.
3380 check_async 1
3381
3382 # Set miss_send_len to 128, turning on packet-ins for our service connection.
3383 ovs-appctl -t ovs-ofctl ofctl/send 0409000c0123456700000080
3384 check_async 2 OFPR_ACTION OFPPR_ADD OFPPR_DELETE OFPRR_DELETE OFPRR_GROUP_DELETE
3385
3386 # Become slave (OF 1.3), which should disable everything except port status.
3387 ovs-appctl -t ovs-ofctl ofctl/send 041800180000000200000003000000000000000000000001
3388 check_async 3 OFPPR_ADD OFPPR_DELETE
3389
3390 # Use OF 1.3 OFPT_SET_ASYNC to enable a patchwork of asynchronous messages.
3391 ovs-appctl -t ovs-ofctl ofctl/send 041c00200000000200000002000000050000000500000002000000020000000d
3392 check_async 4 OFPR_INVALID_TTL OFPPR_DELETE OFPRR_DELETE OFPRR_GROUP_DELETE
3393
3394 # Set controller ID 123.
3395 ovs-appctl -t ovs-ofctl ofctl/send 04040018000000030000232000000014000000000000007b
3396 check_async 5 OFPR_NO_MATCH OFPPR_DELETE OFPRR_DELETE OFPRR_GROUP_DELETE
3397
3398 # Restore controller ID 0.
3399 ovs-appctl -t ovs-ofctl ofctl/send 040400180000000300002320000000140000000000000000
3400
3401 # Become master (OF 1.3).
3402 ovs-appctl -t ovs-ofctl ofctl/send 041800180000000400000002000000000000000000000002
3403 check_async 6 OFPR_ACTION OFPPR_ADD
3404
3405 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
3406 OVS_VSWITCHD_STOP
3407 AT_CLEANUP
3408
3409 AT_SETUP([ofproto - asynchronous message control (OpenFlow 1.4)])
3410 OVS_VSWITCHD_START([dnl
3411 add-port br0 p1 -- set Interface p1 type=dummy ofport_request=10
3412 ])
3413 AT_CHECK([ovs-ofctl -O OpenFlow14 -P standard monitor br0 --detach --no-chdir --pidfile])
3414 check_async () {
3415 printf '\n\n--- check_async %d ---\n\n\n' $1
3416 INDEX=$1
3417 shift
3418
3419 ovs-appctl -t ovs-ofctl ofctl/barrier
3420 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
3421 : > expout
3422
3423 # OFPT_PACKET_IN, OFPR_PACKET_OUT (controller_id=0)
3424 ovs-ofctl -O OpenFlow14 -v packet-out br0 none controller '0001020304050010203040501234'
3425 if test X"$1" = X"OFPR_PACKET_OUT"; then shift;
3426 echo >>expout "OFPT_PACKET_IN (OF1.4): total_len=14 in_port=ANY (via packet_out) data_len=14 (unbuffered)
3427 vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1234"
3428 fi
3429
3430 # OFPT_PACKET_IN, OFPR_ACTION_SET (controller_id=0)
3431 ovs-ofctl -O OpenFlow14 add-flow br0 'in_port=10 actions=write_actions(output(CONTROLLER))'
3432 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)'
3433 if test X"$1" = X"OFPR_ACTION_SET"; then shift;
3434 echo >>expout "OFPT_PACKET_IN (OF1.4): cookie=0x0 total_len=14 in_port=10 (via action_set) data_len=14 (unbuffered)
3435 vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1234"
3436 fi
3437
3438 # OFPT_PACKET_IN, OFPR_NO_MATCH (controller_id=123)
3439 ovs-ofctl -O OpenFlow14 -v packet-out br0 none 'controller(reason=no_match,id=123)' '0001020304050010203040501234'
3440 if test X"$1" = X"OFPR_NO_MATCH"; then shift;
3441 echo >>expout "OFPT_PACKET_IN (OF1.4): total_len=14 in_port=ANY (via no_match) data_len=14 (unbuffered)
3442 vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1234"
3443 fi
3444
3445 # OFPT_PACKET_IN, OFPR_INVALID_TTL (controller_id=0)
3446 ovs-ofctl -O OpenFlow14 packet-out br0 none dec_ttl '002583dfb4000026b98cb0f908004500003eb7e200000011339bac11370dac100002d7730035002b8f6d86fb0100000100000000000006626c702d7873066e696369726103636f6d00000f00'
3447 if test X"$1" = X"OFPR_INVALID_TTL"; then shift;
3448 echo >>expout "OFPT_PACKET_IN (OF1.4): total_len=76 in_port=ANY (via invalid_ttl) data_len=76 (unbuffered)
3449 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"
3450 fi
3451
3452 # OFPT_PORT_STATUS, OFPPR_ADD
3453 ovs-vsctl add-port br0 test -- set Interface test type=dummy
3454 if test X"$1" = X"OFPPR_ADD"; then shift;
3455 echo >>expout "OFPT_PORT_STATUS (OF1.4): ADD: ${INDEX}(test): addr:aa:55:aa:55:00:0x
3456 config: 0
3457 state: 0
3458 speed: 0 Mbps now, 0 Mbps max
3459 OFPT_PORT_STATUS (OF1.4): MOD: ${INDEX}(test): addr:aa:55:aa:55:00:0x
3460 config: 0
3461 state: LIVE
3462 speed: 0 Mbps now, 0 Mbps max"
3463 fi
3464
3465 # OFPT_PORT_STATUS, OFPPR_MODIFY
3466 ovs-ofctl -O OpenFlow14 -vwarn mod-port br0 test down
3467 if test X"$1" = X"OFPPR_MODIFY"; then shift;
3468 echo >>expout "OFPT_PORT_STATUS (OF1.4): MOD: ${INDEX}(test): addr:aa:55:aa:55:00:0x
3469 config: PORT_DOWN
3470 state: 0
3471 speed: 0 Mbps now, 0 Mbps max
3472 OFPT_PORT_STATUS (OF1.4): MOD: ${INDEX}(test): addr:aa:55:aa:55:00:0x
3473 config: PORT_DOWN
3474 state: LINK_DOWN
3475 speed: 0 Mbps now, 0 Mbps max"
3476 fi
3477
3478 # OFPT_PORT_STATUS, OFPPR_DELETE
3479 ovs-vsctl del-port br0 test
3480 if test X"$1" = X"OFPPR_DELETE"; then shift;
3481 echo >>expout "OFPT_PORT_STATUS (OF1.4): DEL: ${INDEX}(test): addr:aa:55:aa:55:00:0x
3482 config: PORT_DOWN
3483 state: LINK_DOWN
3484 speed: 0 Mbps now, 0 Mbps max"
3485 fi
3486
3487 # OFPT_FLOW_REMOVED, OFPRR_DELETE
3488 ovs-ofctl -O OpenFlow14 add-flow br0 send_flow_rem,actions=drop
3489 ovs-ofctl -O OpenFlow14 --strict del-flows br0 ''
3490 if test X"$1" = X"OFPRR_DELETE"; then shift;
3491 echo >>expout "OFPT_FLOW_REMOVED (OF1.4): reason=delete table_id=0"
3492 fi
3493
3494 # OFPT_FLOW_REMOVED, OFPRR_GROUP_DELETE
3495 ovs-ofctl -O OpenFlow14 add-group br0 group_id=1234,type=all,bucket=output:10
3496 ovs-ofctl -O OpenFlow14 add-flow br0 send_flow_rem,actions=group:1234
3497 ovs-ofctl -O OpenFlow14 --strict del-groups br0 group_id=1234
3498 if test X"$1" = X"OFPRR_GROUP_DELETE"; then shift;
3499 echo >>expout "OFPT_FLOW_REMOVED (OF1.4): reason=group_delete table_id=0"
3500 fi
3501
3502 # OFPT_TABLE_STATUS, OFPTR_VACANCY_UP
3503 if test X"$1" = X"OFPTR_VACANCY_UP"; then shift;
3504 ovs-vsctl -- --id=@t1 create Flow_Table flow-limit=10 -- set bridge br0 flow_tables:1=@t1
3505
3506 # Turn on vacancy events, then add flows until we're full.
3507 # With initial vacancy of 100% and vacancy_up of 80%, so that
3508 # vacancy >= vacancy_up, this enables VACANY_DOWN events, so
3509 # we get a single such message when vacancy dips below 20%.
3510 ovs-ofctl -O OpenFlow14 mod-table br0 1 vacancy:20,80
3511 ovs-ofctl -O OpenFlow14 add-flow br0 table=1,in_port=1,actions=2
3512 ovs-ofctl -O OpenFlow14 add-flow br0 table=1,in_port=2,actions=2
3513 ovs-ofctl -O OpenFlow14 add-flow br0 table=1,in_port=3,actions=2
3514 ovs-ofctl -O OpenFlow14 add-flow br0 table=1,in_port=4,actions=2
3515 ovs-ofctl -O OpenFlow14 add-flow br0 table=1,in_port=5,actions=2
3516 ovs-ofctl -O OpenFlow14 add-flow br0 table=1,in_port=6,actions=2
3517 ovs-ofctl -O OpenFlow14 add-flow br0 table=1,in_port=7,actions=2
3518 ovs-ofctl -O OpenFlow14 add-flow br0 table=1,in_port=8,actions=2
3519 ovs-ofctl -O OpenFlow14 add-flow br0 table=1,in_port=9,actions=2
3520 ovs-ofctl -O OpenFlow14 add-flow br0 table=1,in_port=10,actions=2
3521 echo >>expout "OFPT_TABLE_STATUS (OF1.4): reason=VACANCY_DOWN
3522 table_desc:-
3523 table 1:
3524 eviction=off eviction_flags=OTHER|IMPORTANCE|LIFETIME
3525 vacancy=on vacancy_down=20% vacancy_up=80% vacancy=10%"
3526 # Then delete flows until we're empty. Sending the
3527 # VACANCY_DOWN message enabled VACANCY_UP events, so we get a
3528 # single such message when vacancy rises above 80%.
3529 ovs-ofctl -O OpenFlow14 del-flows br0 table=1,in_port=1
3530 ovs-ofctl -O OpenFlow14 del-flows br0 table=1,in_port=2
3531 ovs-ofctl -O OpenFlow14 del-flows br0 table=1,in_port=3
3532 ovs-ofctl -O OpenFlow14 del-flows br0 table=1,in_port=4
3533 ovs-ofctl -O OpenFlow14 del-flows br0 table=1,in_port=5
3534 ovs-ofctl -O OpenFlow14 del-flows br0 table=1,in_port=6
3535 ovs-ofctl -O OpenFlow14 del-flows br0 table=1,in_port=7
3536 ovs-ofctl -O OpenFlow14 del-flows br0 table=1,in_port=8
3537 ovs-ofctl -O OpenFlow14 del-flows br0 table=1,in_port=9
3538 ovs-ofctl -O OpenFlow14 del-flows br0 table=1,in_port=10
3539 echo >>expout "OFPT_TABLE_STATUS (OF1.4): reason=VACANCY_UP
3540 table_desc:-
3541 table 1:
3542 eviction=off eviction_flags=OTHER|IMPORTANCE|LIFETIME
3543 vacancy=on vacancy_down=20% vacancy_up=80% vacancy=90%"
3544
3545 # Now approach vacancy from the other direction. First
3546 # disable vacancy events. With initial vacancy of 70%, so
3547 # that vacancy < vacancy_up, this enables VACANCY_UP events.
3548 # That means that filling up the table generates no message,
3549 # but deleting all the flows generates VACANCY_UP at the point
3550 # vacancy rises above 80%.
3551 ovs-ofctl -O OpenFlow14 mod-table br0 1 novacancy
3552 ovs-ofctl -O OpenFlow14 add-flow br0 table=1,in_port=1,actions=2
3553 ovs-ofctl -O OpenFlow14 add-flow br0 table=1,in_port=2,actions=2
3554 ovs-ofctl -O OpenFlow14 add-flow br0 table=1,in_port=3,actions=2
3555 ovs-ofctl -O OpenFlow14 mod-table br0 1 vacancy:20,80
3556 ovs-ofctl -O OpenFlow14 add-flow br0 table=1,in_port=4,actions=2
3557 ovs-ofctl -O OpenFlow14 add-flow br0 table=1,in_port=5,actions=2
3558 ovs-ofctl -O OpenFlow14 add-flow br0 table=1,in_port=6,actions=2
3559 ovs-ofctl -O OpenFlow14 add-flow br0 table=1,in_port=7,actions=2
3560 ovs-ofctl -O OpenFlow14 add-flow br0 table=1,in_port=8,actions=2
3561 ovs-ofctl -O OpenFlow14 add-flow br0 table=1,in_port=9,actions=2
3562 ovs-ofctl -O OpenFlow14 add-flow br0 table=1,in_port=10,actions=2
3563 ovs-ofctl -O OpenFlow14 del-flows br0 table=1,in_port=1
3564 ovs-ofctl -O OpenFlow14 del-flows br0 table=1,in_port=2
3565 ovs-ofctl -O OpenFlow14 del-flows br0 table=1,in_port=3
3566 ovs-ofctl -O OpenFlow14 del-flows br0 table=1,in_port=4
3567 ovs-ofctl -O OpenFlow14 del-flows br0 table=1,in_port=5
3568 ovs-ofctl -O OpenFlow14 del-flows br0 table=1,in_port=6
3569 ovs-ofctl -O OpenFlow14 del-flows br0 table=1,in_port=7
3570 ovs-ofctl -O OpenFlow14 del-flows br0 table=1,in_port=8
3571 ovs-ofctl -O OpenFlow14 del-flows br0 table=1,in_port=9
3572 ovs-ofctl -O OpenFlow14 del-flows br0 table=1,in_port=10
3573 echo >>expout "OFPT_TABLE_STATUS (OF1.4): reason=VACANCY_UP
3574 table_desc:-
3575 table 1:
3576 eviction=off eviction_flags=OTHER|IMPORTANCE|LIFETIME
3577 vacancy=on vacancy_down=20% vacancy_up=80% vacancy=90%"
3578 fi
3579
3580 AT_FAIL_IF([test X"$1" != X])
3581
3582 normalize_log () {
3583 sed '
3584 s/ (xid=0x[[0-9a-fA-F]]*)//
3585 s/ *duration.*//
3586 s/00:0.$/00:0x/' < monitor.log
3587 }
3588
3589 OVS_WAIT_UNTIL([test `wc -l < "monitor.log"` -ge `wc -l < "expout"`],
3590 [normalize_log | diff -u - expout])
3591
3592 AT_CHECK(
3593 [normalize_log],
3594 [0], [expout])
3595 }
3596
3597 # It's a service connection so initially there should be no async messages.
3598 check_async 1
3599
3600 # Set miss_send_len to 128, turning on packet-ins for our service connection.
3601 ovs-appctl -t ovs-ofctl ofctl/send 0509000c0123456700000080
3602 check_async 2 OFPR_PACKET_OUT OFPR_ACTION_SET OFPPR_ADD OFPPR_MODIFY OFPPR_DELETE OFPRR_DELETE OFPRR_GROUP_DELETE
3603
3604 # Become slave (OF 1.4), which should disable everything except port status.
3605 ovs-appctl -t ovs-ofctl ofctl/send 051800180000000200000003000000000000000000000001
3606 check_async 3 OFPPR_ADD OFPPR_MODIFY OFPPR_DELETE
3607
3608 # Use OF 1.4 OFPT_SET_ASYNC to enable a patchwork of asynchronous messages.
3609 ovs-appctl -t ovs-ofctl ofctl/send 051c0040000000020000000800000005000100080000002000020008000000020003000800000005000400080000001c00050008000000050008000800000018
3610 check_async 4 OFPR_INVALID_TTL OFPPR_DELETE OFPRR_DELETE OFPRR_GROUP_DELETE OFPTR_VACANCY_UP
3611
3612 # Set controller ID 123.
3613 ovs-appctl -t ovs-ofctl ofctl/send 05040018000000030000232000000014000000000000007b
3614 check_async 5 OFPR_NO_MATCH OFPPR_DELETE OFPRR_DELETE OFPRR_GROUP_DELETE
3615
3616 # Restore controller ID 0.
3617 ovs-appctl -t ovs-ofctl ofctl/send 050400180000000300002320000000140000000000000000
3618
3619 # Become master (OF 1.4).
3620 ovs-appctl -t ovs-ofctl ofctl/send 051800180000000400000002000000000000000000000002
3621 check_async 6 OFPR_PACKET_OUT OFPPR_ADD OFPPR_MODIFY OFPRR_DELETE
3622
3623 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
3624 OVS_VSWITCHD_STOP
3625 AT_CLEANUP
3626
3627 AT_SETUP([ofproto - asynchronous message control (OpenFlow 1.5)])
3628 OVS_VSWITCHD_START
3629 AT_CHECK([ovs-ofctl -O OpenFlow15 -P standard monitor br0 --detach --no-chdir --pidfile])
3630 check_async () {
3631 printf '\n\n--- check_async %d ---\n\n\n' $1
3632 INDEX=$1
3633 shift
3634
3635 ovs-appctl -t ovs-ofctl ofctl/barrier
3636 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
3637 : > expout
3638
3639 # Other tests are not working with OF 1.5, and message
3640 # format may change, so leave them out.
3641
3642 # OFPT_PORT_STATUS, OFPPR_ADD
3643 ovs-vsctl add-port br0 test -- set Interface test type=dummy
3644 if test X"$1" = X"OFPPR_ADD"; then shift;
3645 echo >>expout "OFPT_PORT_STATUS (OF1.5): ADD: ${INDEX}(test): addr:aa:55:aa:55:00:0x
3646 config: 0
3647 state: 0
3648 speed: 0 Mbps now, 0 Mbps max
3649 OFPT_PORT_STATUS (OF1.5): MOD: ${INDEX}(test): addr:aa:55:aa:55:00:0x
3650 config: 0
3651 state: LIVE
3652 speed: 0 Mbps now, 0 Mbps max"
3653 fi
3654
3655 # OFPT_PORT_STATUS, OFPPR_MODIFY
3656 ovs-ofctl -O OpenFlow15 -vwarn mod-port br0 test down
3657 if test X"$1" = X"OFPPR_MODIFY"; then shift;
3658 echo >>expout "OFPT_PORT_STATUS (OF1.5): MOD: ${INDEX}(test): addr:aa:55:aa:55:00:0x
3659 config: PORT_DOWN
3660 state: 0
3661 speed: 0 Mbps now, 0 Mbps max
3662 OFPT_PORT_STATUS (OF1.5): MOD: ${INDEX}(test): addr:aa:55:aa:55:00:0x
3663 config: PORT_DOWN
3664 state: LINK_DOWN
3665 speed: 0 Mbps now, 0 Mbps max"
3666 fi
3667
3668 # OFPT_PORT_STATUS, OFPPR_DELETE
3669 ovs-vsctl del-port br0 test
3670 if test X"$1" = X"OFPPR_DELETE"; then shift;
3671 echo >>expout "OFPT_PORT_STATUS (OF1.5): DEL: ${INDEX}(test): addr:aa:55:aa:55:00:0x
3672 config: PORT_DOWN
3673 state: LINK_DOWN
3674 speed: 0 Mbps now, 0 Mbps max"
3675 fi
3676
3677 AT_FAIL_IF([test X"$1" != X])
3678
3679 OVS_WAIT_UNTIL([test `wc -l < "monitor.log"` -ge `wc -l < "expout"`])
3680
3681 AT_CHECK(
3682 [[sed '
3683 s/ (xid=0x[0-9a-fA-F]*)//
3684 s/ *duration.*//
3685 s/00:0.$/00:0x/' < monitor.log]],
3686 [0], [expout])
3687 }
3688
3689 # It's a service connection so initially there should be no async messages.
3690 check_async 1
3691
3692 # If we don't set this, async messages are not received.
3693 # Set miss_send_len to 128, turning on packet-ins for our service connection.
3694 ovs-appctl -t ovs-ofctl ofctl/send 0609000c0123456700000080
3695 check_async 2 OFPPR_ADD OFPPR_MODIFY OFPPR_DELETE
3696
3697 # Set-async has changed in OF 1.4 and is not yet implemented.
3698
3699 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
3700 OVS_VSWITCHD_STOP
3701 AT_CLEANUP
3702
3703 dnl This test checks that the role request/response messaging works
3704 dnl and that generation_id is handled properly.
3705 AT_SETUP([ofproto - controller role (OpenFlow 1.2)])
3706 OVS_VSWITCHD_START
3707 on_exit 'kill `cat c1.pid c2.pid`'
3708
3709 # Start two ovs-ofctl controller processes.
3710 AT_CAPTURE_FILE([monitor1.log])
3711 AT_CAPTURE_FILE([expout1])
3712 AT_CAPTURE_FILE([experr1])
3713 AT_CAPTURE_FILE([monitor2.log])
3714 AT_CAPTURE_FILE([expout2])
3715 AT_CAPTURE_FILE([experr2])
3716 for i in 1 2; do
3717 AT_CHECK([ovs-ofctl -O OpenFlow12 monitor br0 --detach --no-chdir --pidfile=c$i.pid --unixctl=c$i])
3718 ovs-appctl -t `pwd`/c$i ofctl/barrier
3719 ovs-appctl -t `pwd`/c$i ofctl/set-output-file monitor$i.log
3720 : > expout$i
3721 : > experr$i
3722
3723 # find out current role
3724 ovs-appctl -t `pwd`/c$i ofctl/send 031800180000000200000000000000000000000000000000
3725 echo >>experr$i "send: OFPT_ROLE_REQUEST (OF1.2): role=nochange"
3726 echo >>expout$i "OFPT_ROLE_REPLY (OF1.2): role=equal"
3727 done
3728
3729 # controller 1: Become slave (generation_id is initially undefined, so
3730 # 2^63+2 should not be stale)
3731 ovs-appctl -t `pwd`/c1 ofctl/send 031800180000000300000003000000008000000000000002
3732 echo >>experr1 "send: OFPT_ROLE_REQUEST (OF1.2): role=slave generation_id=9223372036854775810"
3733 echo >>expout1 "OFPT_ROLE_REPLY (OF1.2): role=slave generation_id=9223372036854775810"
3734
3735 # controller 2: Become master.
3736 ovs-appctl -t `pwd`/c2 ofctl/send 031800180000000300000002000000008000000000000003
3737 echo >>experr2 "send: OFPT_ROLE_REQUEST (OF1.2): role=master generation_id=9223372036854775811"
3738 echo >>expout2 "OFPT_ROLE_REPLY (OF1.2): role=master generation_id=9223372036854775811"
3739
3740 # controller 1: Try to become the master using a stale generation ID
3741 ovs-appctl -t `pwd`/c1 ofctl/send 031800180000000400000002000000000000000000000003
3742 echo >>experr1 "send: OFPT_ROLE_REQUEST (OF1.2): role=master generation_id=3"
3743 echo >>expout1 "OFPT_ERROR (OF1.2): OFPRRFC_STALE"
3744 echo >>expout1 "OFPT_ROLE_REQUEST (OF1.2): role=master generation_id=3"
3745
3746 # controller 1: Become master using a valid generation ID
3747 ovs-appctl -t `pwd`/c1 ofctl/send 031800180000000500000002000000000000000000000001
3748 echo >>experr1 "send: OFPT_ROLE_REQUEST (OF1.2): role=master generation_id=1"
3749 echo >>expout1 "OFPT_ROLE_REPLY (OF1.2): role=master generation_id=1"
3750
3751 for i in 1 2; do
3752 ovs-appctl -t `pwd`/c$i ofctl/barrier
3753 echo >>expout$i "OFPT_BARRIER_REPLY (OF1.2):"
3754 done
3755
3756 # Check output.
3757 for i in 1 2; do
3758 cp expout$i expout
3759 AT_CHECK([grep -v '^send:' monitor$i.log | strip_xids], [0], [expout])
3760 cp experr$i expout
3761 AT_CHECK([grep '^send:' monitor$i.log | strip_xids], [0], [expout])
3762 done
3763 OVS_VSWITCHD_STOP
3764 AT_CLEANUP
3765
3766 dnl This test checks that the role request/response messaging works,
3767 dnl that generation_id is handled properly, and that role status update
3768 dnl messages are sent when a controller's role gets changed from master
3769 dnl to slave.
3770 AT_SETUP([ofproto - controller role (OpenFlow 1.4)])
3771 OVS_VSWITCHD_START
3772 on_exit 'kill `cat c1.pid c2.pid`'
3773
3774 # Start two ovs-ofctl controller processes.
3775 AT_CAPTURE_FILE([monitor1.log])
3776 AT_CAPTURE_FILE([expout1])
3777 AT_CAPTURE_FILE([experr1])
3778 AT_CAPTURE_FILE([monitor2.log])
3779 AT_CAPTURE_FILE([expout2])
3780 AT_CAPTURE_FILE([experr2])
3781 for i in 1 2; do
3782 AT_CHECK([ovs-ofctl -O OpenFlow14 monitor br0 --detach --no-chdir --pidfile=c$i.pid --unixctl=c$i])
3783 ovs-appctl -t `pwd`/c$i ofctl/barrier
3784 ovs-appctl -t `pwd`/c$i ofctl/set-output-file monitor$i.log
3785 : > expout$i
3786 : > experr$i
3787
3788 # find out current role
3789 ovs-appctl -t `pwd`/c$i ofctl/send 051800180000000200000000000000000000000000000000
3790 echo >>experr$i "send: OFPT_ROLE_REQUEST (OF1.4): role=nochange"
3791 echo >>expout$i "OFPT_ROLE_REPLY (OF1.4): role=equal"
3792 done
3793
3794 # controller 1: Become slave (generation_id is initially undefined, so
3795 # 2^63+2 should not be stale)
3796 ovs-appctl -t `pwd`/c1 ofctl/send 051800180000000300000003000000008000000000000002
3797 echo >>experr1 "send: OFPT_ROLE_REQUEST (OF1.4): role=slave generation_id=9223372036854775810"
3798 echo >>expout1 "OFPT_ROLE_REPLY (OF1.4): role=slave generation_id=9223372036854775810"
3799
3800 # controller 2: Become master.
3801 ovs-appctl -t `pwd`/c2 ofctl/send 051800180000000300000002000000008000000000000003
3802 echo >>experr2 "send: OFPT_ROLE_REQUEST (OF1.4): role=master generation_id=9223372036854775811"
3803 echo >>expout2 "OFPT_ROLE_REPLY (OF1.4): role=master generation_id=9223372036854775811"
3804
3805 # controller 1: Try to become the master using a stale generation ID
3806 ovs-appctl -t `pwd`/c1 ofctl/send 051800180000000400000002000000000000000000000003
3807 echo >>experr1 "send: OFPT_ROLE_REQUEST (OF1.4): role=master generation_id=3"
3808 echo >>expout1 "OFPT_ERROR (OF1.4): OFPRRFC_STALE"
3809 echo >>expout1 "OFPT_ROLE_REQUEST (OF1.4): role=master generation_id=3"
3810
3811 # controller 1: Become master using a valid generation ID
3812 ovs-appctl -t `pwd`/c1 ofctl/send 051800180000000500000002000000000000000000000001
3813 echo >>experr1 "send: OFPT_ROLE_REQUEST (OF1.4): role=master generation_id=1"
3814 echo >>expout1 "OFPT_ROLE_REPLY (OF1.4): role=master generation_id=1"
3815 echo >>expout2 "OFPT_ROLE_STATUS (OF1.4): role=slave generation_id=1 reason=master_request"
3816
3817 for i in 1 2; do
3818 ovs-appctl -t `pwd`/c$i ofctl/barrier
3819 echo >>expout$i "OFPT_BARRIER_REPLY (OF1.4):"
3820 done
3821
3822 # Check output.
3823 for i in 1 2; do
3824 cp expout$i expout
3825 AT_CHECK([grep -v '^send:' monitor$i.log | strip_xids], [0], [expout])
3826 cp experr$i expout
3827 AT_CHECK([grep '^send:' monitor$i.log | strip_xids], [0], [expout])
3828 done
3829 OVS_VSWITCHD_STOP
3830 AT_CLEANUP
3831
3832 dnl This test checks that the role request/response messaging works,
3833 dnl that generation_id is handled properly, and that role status update
3834 dnl messages are sent when a controller's role gets changed from master
3835 dnl to slave.
3836 AT_SETUP([ofproto - controller role (OpenFlow 1.3)])
3837 OVS_VSWITCHD_START
3838 on_exit 'kill `cat c1.pid c2.pid`'
3839
3840 # Start two ovs-ofctl controller processes.
3841 AT_CAPTURE_FILE([monitor1.log])
3842 AT_CAPTURE_FILE([expout1])
3843 AT_CAPTURE_FILE([experr1])
3844 AT_CAPTURE_FILE([monitor2.log])
3845 AT_CAPTURE_FILE([expout2])
3846 AT_CAPTURE_FILE([experr2])
3847 for i in 1 2; do
3848 AT_CHECK([ovs-ofctl -O OpenFlow13 monitor br0 --detach --no-chdir --pidfile=c$i.pid --unixctl=c$i])
3849 ovs-appctl -t `pwd`/c$i ofctl/barrier
3850 ovs-appctl -t `pwd`/c$i ofctl/set-output-file monitor$i.log
3851 : > expout$i
3852 : > experr$i
3853
3854 # find out current role
3855 ovs-appctl -t `pwd`/c$i ofctl/send 041800180000000200000000000000000000000000000000
3856 echo >>experr$i "send: OFPT_ROLE_REQUEST (OF1.3): role=nochange"
3857 echo >>expout$i "OFPT_ROLE_REPLY (OF1.3): role=equal"
3858 done
3859
3860 # controller 1: Become slave (generation_id is initially undefined, so
3861 # 2^63+2 should not be stale)
3862 ovs-appctl -t `pwd`/c1 ofctl/send 041800180000000300000003000000008000000000000002
3863 echo >>experr1 "send: OFPT_ROLE_REQUEST (OF1.3): role=slave generation_id=9223372036854775810"
3864 echo >>expout1 "OFPT_ROLE_REPLY (OF1.3): role=slave generation_id=9223372036854775810"
3865
3866 # controller 2: Become master.
3867 ovs-appctl -t `pwd`/c2 ofctl/send 041800180000000300000002000000008000000000000003
3868 echo >>experr2 "send: OFPT_ROLE_REQUEST (OF1.3): role=master generation_id=9223372036854775811"
3869 echo >>expout2 "OFPT_ROLE_REPLY (OF1.3): role=master generation_id=9223372036854775811"
3870
3871 # controller 1: Try to become the master using a stale generation ID
3872 ovs-appctl -t `pwd`/c1 ofctl/send 041800180000000400000002000000000000000000000003
3873 echo >>experr1 "send: OFPT_ROLE_REQUEST (OF1.3): role=master generation_id=3"
3874 echo >>expout1 "OFPT_ERROR (OF1.3): OFPRRFC_STALE"
3875 echo >>expout1 "OFPT_ROLE_REQUEST (OF1.3): role=master generation_id=3"
3876
3877 # controller 1: Become master using a valid generation ID
3878 ovs-appctl -t `pwd`/c1 ofctl/send 041800180000000500000002000000000000000000000001
3879 echo >>experr1 "send: OFPT_ROLE_REQUEST (OF1.3): role=master generation_id=1"
3880 echo >>expout1 "OFPT_ROLE_REPLY (OF1.3): role=master generation_id=1"
3881 echo >>expout2 "ONFT_ROLE_STATUS (OF1.3): role=slave generation_id=1 reason=master_request"
3882
3883 for i in 1 2; do
3884 ovs-appctl -t `pwd`/c$i ofctl/barrier
3885 echo >>expout$i "OFPT_BARRIER_REPLY (OF1.3):"
3886 done
3887
3888 # Check output.
3889 for i in 1 2; do
3890 cp expout$i expout
3891 AT_CHECK([grep -v '^send:' monitor$i.log | strip_xids], [0], [expout])
3892 cp experr$i expout
3893 AT_CHECK([grep '^send:' monitor$i.log | strip_xids], [0], [expout])
3894 done
3895 OVS_VSWITCHD_STOP
3896 AT_CLEANUP
3897
3898 dnl This test checks the Group and meter notifications when a group mod
3899 dnl command is sent from one controller and the reply is received by
3900 dnl other controllers.
3901 AT_SETUP([ofproto - requestforward (OpenFlow 1.4)])
3902 OVS_VSWITCHD_START
3903 on_exit 'kill `cat c1.pid c2.pid c3.pid`'
3904
3905 # Start two ovs-ofctl controller processes.
3906 AT_CAPTURE_FILE([monitor1.log])
3907 AT_CAPTURE_FILE([expout1])
3908 AT_CAPTURE_FILE([monitor2.log])
3909 AT_CAPTURE_FILE([expout2])
3910 AT_CAPTURE_FILE([monitor3.log])
3911 AT_CAPTURE_FILE([expout3])
3912
3913 ovs-ofctl -O OpenFlow15 monitor br0 --detach --no-chdir --pidfile=c1.pid --unixctl=c1
3914 ovs-ofctl -O OpenFlow14 monitor br0 --detach --no-chdir --pidfile=c2.pid --unixctl=c2
3915 ovs-ofctl -O OpenFlow14 monitor br0 --detach --no-chdir --pidfile=c3.pid --unixctl=c3
3916
3917 check_async () {
3918 for i in 1 3; do
3919 ovs-appctl -t `pwd`/c$i ofctl/barrier
3920 ovs-appctl -t `pwd`/c$i ofctl/set-output-file monitor$i.log
3921 : > expout$i
3922 done
3923
3924 printf '\n\n--- check_async %d ---\n\n\n' $1
3925 INDEX=$1
3926 shift
3927
3928 # OFPGC_ADD
3929 ovs-appctl -t `pwd`/c2 ofctl/send "050f0020000000020000000000000001 00100000 ffffffffffffffff 00000000"
3930 if test X"$1" = X"OFPGC_ADD"; then shift;
3931 echo >>expout2 "send: OFPT_GROUP_MOD (OF1.4):
3932 ADD group_id=1,type=all,bucket=actions=drop"
3933 echo >>expout1 "OFPT_REQUESTFORWARD (OF1.5): reason=group_mod
3934 ADD group_id=1,type=all,bucket=bucket_id:0,actions=drop"
3935 echo >>expout3 "OFPT_REQUESTFORWARD (OF1.4): reason=group_mod
3936 ADD group_id=1,type=all,bucket=actions=drop"
3937 fi
3938
3939 # OFPGC_MODIFY
3940 ovs-appctl -t `pwd`/c2 ofctl/send "050f0020000000020001010000000001 00100000 ffffffffffffffff 00000000"
3941 if test X"$1" = X"OFPGC_MODIFY"; then shift;
3942 echo >>expout2 "send: OFPT_GROUP_MOD (OF1.4):
3943 MOD group_id=1,type=select,bucket=weight:0,actions=drop"
3944 echo >>expout1 "OFPT_REQUESTFORWARD (OF1.5): reason=group_mod
3945 MOD group_id=1,type=select,bucket=bucket_id:0,weight:0,actions=drop"
3946 echo >>expout3 "OFPT_REQUESTFORWARD (OF1.4): reason=group_mod
3947 MOD group_id=1,type=select,bucket=weight:0,actions=drop"
3948 fi
3949
3950 ovs-appctl -t `pwd`/c1 ofctl/barrier
3951 echo >>expout1 "OFPT_BARRIER_REPLY (OF1.5):"
3952 ovs-appctl -t `pwd`/c2 ofctl/barrier
3953 echo >>expout2 "OFPT_BARRIER_REPLY (OF1.4):"
3954 ovs-appctl -t `pwd`/c3 ofctl/barrier
3955 echo >>expout3 "OFPT_BARRIER_REPLY (OF1.4):"
3956
3957 # Check output.
3958 for i in 1 3; do
3959 cp expout$i expout
3960 AT_CHECK(
3961 [[sed '
3962 s/ (xid=0x[0-9a-fA-F]*)//'< monitor$i.log]],
3963 [0], [expout])
3964 done
3965 }
3966
3967 # controller 1: Become slave
3968 ovs-appctl -t `pwd`/c1 ofctl/send 061800180000000300000003000000008000000000000002
3969
3970 # controller 2: Become master
3971 ovs-appctl -t `pwd`/c2 ofctl/send 051800180000000300000002000000008000000000000003
3972
3973 # controller 1: Become slave
3974 ovs-appctl -t `pwd`/c3 ofctl/send 051800180000000300000003000000008000000000000004
3975
3976 # controller 1: Enabled requestforward using set Asynchronous message
3977 ovs-appctl -t `pwd`/c1 ofctl/send 061c00280000000200000008000000050002000800000002000400080000001a000a000800000003
3978
3979 # controller 2: Enabled requestforward using set Asynchronous message
3980 ovs-appctl -t `pwd`/c2 ofctl/send 051c002800000002000100080000000200030008000000050005000800000005000b000800000003
3981
3982 # controller 1: Enabled requestforward using set Asynchronous message
3983 ovs-appctl -t `pwd`/c3 ofctl/send 051c00280000000200000008000000050002000800000002000400080000001a000a000800000003
3984 check_async 1 OFPGC_ADD OFPGC_MODIFY
3985
3986 OVS_VSWITCHD_STOP
3987 AT_CLEANUP
3988
3989 dnl This test checks the backwards compatibility of the NXT_REQUESTFORWARD
3990 dnl message type to OpenFlow 1.0, also relying on the Nicira Extensions:
3991 dnl NXT_GROUP_MOD, NXT_ROLE_REQUEST, and OFPRAW_NXT_SET_ASYNC_CONFIG2,
3992 dnl while also testing the functionality of the previous test.
3993 AT_SETUP([ofproto - NXT requestforward (OpenFlow 1.0)])
3994 OVS_VSWITCHD_START
3995 on_exit 'kill `cat c1.pid c2.pid c3.pid`'
3996
3997 # Start two ovs-ofctl controller processes.
3998 AT_CAPTURE_FILE([monitor1.log])
3999 AT_CAPTURE_FILE([expout1])
4000 AT_CAPTURE_FILE([monitor2.log])
4001 AT_CAPTURE_FILE([expout2])
4002 AT_CAPTURE_FILE([monitor3.log])
4003 AT_CAPTURE_FILE([expout3])
4004
4005 ovs-ofctl -O OpenFlow10 monitor br0 --detach --no-chdir --pidfile=c1.pid --unixctl=c1
4006 ovs-ofctl -O OpenFlow10 monitor br0 --detach --no-chdir --pidfile=c2.pid --unixctl=c2
4007 ovs-ofctl -O OpenFlow10 monitor br0 --detach --no-chdir --pidfile=c3.pid --unixctl=c3
4008
4009 check_async () {
4010 for i in 1 3; do
4011 ovs-appctl -t `pwd`/c$i ofctl/barrier
4012 ovs-appctl -t `pwd`/c$i ofctl/set-output-file monitor$i.log
4013 : > expout$i
4014 done
4015
4016 printf '\n\n--- check_async %d ---\n\n\n' $1
4017 INDEX=$1
4018 shift
4019
4020 # OFPGC_ADD
4021 # NXT_GROUP_MOD (xid=0x2):
4022 # 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
4023 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"
4024 if test X"$1" = X"OFPGC_ADD"; then shift;
4025 echo >>expout2 "send: NXT_GROUP_MOD:
4026 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"
4027 echo >>expout1 "NXT_REQUESTFORWARD: reason=group_mod
4028 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"
4029 echo >>expout3 "NXT_REQUESTFORWARD: reason=group_mod
4030 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"
4031 fi
4032
4033 # OFPGC_MODIFY
4034 # NXT_GROUP_MOD (xid=0x2):
4035 # 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
4036 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"
4037 if test X"$1" = X"OFPGC_MODIFY"; then shift;
4038 echo >>expout2 "send: NXT_GROUP_MOD:
4039 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"
4040 echo >>expout1 "NXT_REQUESTFORWARD: reason=group_mod
4041 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"
4042 echo >>expout3 "NXT_REQUESTFORWARD: reason=group_mod
4043 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"
4044 fi
4045
4046 ovs-appctl -t `pwd`/c1 ofctl/barrier
4047 echo >>expout1 "OFPT_BARRIER_REPLY:"
4048 ovs-appctl -t `pwd`/c2 ofctl/barrier
4049 echo >>expout2 "OFPT_BARRIER_REPLY:"
4050 ovs-appctl -t `pwd`/c3 ofctl/barrier
4051 echo >>expout3 "OFPT_BARRIER_REPLY:"
4052
4053 # Check output.
4054 for i in 1 3; do
4055 cp expout$i expout
4056 AT_CHECK(
4057 [[sed '
4058 s/ (xid=0x[0-9a-fA-F]*)//'< monitor$i.log]],
4059 [0], [expout])
4060 done
4061 }
4062
4063 # controller 1: Become slave
4064 # NXT_ROLE_REQUEST (xid=0x3): role=slave
4065 ovs-appctl -t `pwd`/c1 ofctl/send 0104001400000003000023200000000a00000002
4066
4067 # controller 2: Become master
4068 # NXT_ROLE_REQUEST (xid=0x3): role=master
4069 ovs-appctl -t `pwd`/c2 ofctl/send 0104001400000003000023200000000a00000001
4070
4071 # controller 1: Become slave
4072 # NXT_ROLE_REQUEST (xid=0x3): role=slave
4073 ovs-appctl -t `pwd`/c3 ofctl/send 0104001400000003000023200000000a00000002
4074
4075 # controller 1: Enabled requestforward using OFPRAW_NXT_SET_ASYNC_CONFIG2
4076 ovs-appctl -t `pwd`/c1 ofctl/send 0104003000000002000023200000001b00000008000000050002000800000002000400080000001a000a000800000003
4077
4078 # controller 2: Enabled requestforward using OFPRAW_NXT_SET_ASYNC_CONFIG2
4079 ovs-appctl -t `pwd`/c2 ofctl/send 0104003000000002000023200000001b000100080000000200030008000000050005000800000005000b000800000003
4080
4081 # controller 1: Enabled requestforward using OFPRAW_NXT_SET_ASYNC_CONFIG2
4082 ovs-appctl -t `pwd`/c3 ofctl/send 0104003000000002000023200000001b00000008000000050002000800000002000400080000001a000a000800000003
4083 check_async 1 OFPGC_ADD OFPGC_MODIFY
4084
4085 OVS_VSWITCHD_STOP
4086 AT_CLEANUP
4087
4088 dnl This test checks the Group and meter notifications when a group mod
4089 dnl command is sent from one controller and the reply is received by
4090 dnl other controllers, using the ONF Extension for OF 1.3.
4091 AT_SETUP([ofproto - ONF requestforward (OpenFlow 1.3)])
4092 OVS_VSWITCHD_START
4093 on_exit 'kill `cat c1.pid c2.pid c3.pid`'
4094
4095 # Start two ovs-ofctl controller processes.
4096 AT_CAPTURE_FILE([monitor1.log])
4097 AT_CAPTURE_FILE([expout1])
4098 AT_CAPTURE_FILE([monitor2.log])
4099 AT_CAPTURE_FILE([expout2])
4100 AT_CAPTURE_FILE([monitor3.log])
4101 AT_CAPTURE_FILE([expout3])
4102
4103 ovs-ofctl -O OpenFlow13 monitor br0 --detach --no-chdir --pidfile=c1.pid --unixctl=c1
4104 ovs-ofctl -O OpenFlow13 monitor br0 --detach --no-chdir --pidfile=c2.pid --unixctl=c2
4105 ovs-ofctl -O OpenFlow13 monitor br0 --detach --no-chdir --pidfile=c3.pid --unixctl=c3
4106
4107 check_async () {
4108 for i in 1 3; do
4109 ovs-appctl -t `pwd`/c$i ofctl/barrier
4110 ovs-appctl -t `pwd`/c$i ofctl/set-output-file monitor$i.log
4111 : > expout$i
4112 done
4113
4114 printf '\n\n--- check_async %d ---\n\n\n' $1
4115 INDEX=$1
4116 shift
4117
4118 # OFPGC_ADD
4119 # OFPT_GROUP_MOD (OF1.3) (xid=0x2):
4120 # ADD group_id=1,type=all,bucket=actions=drop
4121 ovs-appctl -t `pwd`/c2 ofctl/send "040f0020000000020000000000000001 00100000 ffffffffffffffff 00000000"
4122 if test X"$1" = X"OFPGC_ADD"; then shift;
4123 echo >>expout2 "send: OFPT_GROUP_MOD (OF1.3):
4124 ADD group_id=1,type=all,bucket=actions=drop"
4125 echo >>expout1 "ONFT_REQUESTFORWARD (OF1.3): reason=group_mod
4126 ADD group_id=1,type=all,bucket=actions=drop"
4127 echo >>expout3 "ONFT_REQUESTFORWARD (OF1.3): reason=group_mod
4128 ADD group_id=1,type=all,bucket=actions=drop"
4129 fi
4130
4131 # OFPGC_MODIFY
4132 # OFPT_GROUP_MOD (OF1.3) (xid=0x2):
4133 # MOD group_id=1,type=select,bucket=weight:0,actions=drop
4134 ovs-appctl -t `pwd`/c2 ofctl/send "040f0020000000020001010000000001 00100000 ffffffffffffffff 00000000"
4135 if test X"$1" = X"OFPGC_MODIFY"; then shift;
4136 echo >>expout2 "send: OFPT_GROUP_MOD (OF1.3):
4137 MOD group_id=1,type=select,bucket=weight:0,actions=drop"
4138 echo >>expout1 "ONFT_REQUESTFORWARD (OF1.3): reason=group_mod
4139 MOD group_id=1,type=select,bucket=weight:0,actions=drop"
4140 echo >>expout3 "ONFT_REQUESTFORWARD (OF1.3): reason=group_mod
4141 MOD group_id=1,type=select,bucket=weight:0,actions=drop"
4142 fi
4143
4144 ovs-appctl -t `pwd`/c1 ofctl/barrier
4145 echo >>expout1 "OFPT_BARRIER_REPLY (OF1.3):"
4146 ovs-appctl -t `pwd`/c2 ofctl/barrier
4147 echo >>expout2 "OFPT_BARRIER_REPLY (OF1.3):"
4148 ovs-appctl -t `pwd`/c3 ofctl/barrier
4149 echo >>expout3 "OFPT_BARRIER_REPLY (OF1.3):"
4150
4151 # Check output.
4152 for i in 1 3; do
4153 cp expout$i expout
4154 AT_CHECK(
4155 [[sed '
4156 s/ (xid=0x[0-9a-fA-F]*)//'< monitor$i.log]],
4157 [0], [expout])
4158 done
4159 }
4160
4161 # controller 1: Become slave
4162 # OFPT_ROLE_REQUEST (OF1.3) (xid=0x3): role=slave
4163 ovs-appctl -t `pwd`/c1 ofctl/send 041800180000000300000003000000008000000000000002
4164
4165 # controller 2: Become master
4166 # OFPT_ROLE_REQUEST (OF1.3) (xid=0x3): role=master
4167 ovs-appctl -t `pwd`/c2 ofctl/send 041800180000000300000002000000008000000000000003
4168
4169 # controller 1: Become slave
4170 # OFPT_ROLE_REQUEST (OF1.3) (xid=0x3): role=slave
4171 ovs-appctl -t `pwd`/c3 ofctl/send 041800180000000300000003000000008000000000000004
4172
4173 # controller 1: Enabled requestforward using OFPRAW_NXT_SET_ASYNC_CONFIG2 (necessary for OF1.3)
4174 ovs-appctl -t `pwd`/c1 ofctl/send 0404003000000002000023200000001b00000008000000050002000800000002000400080000001a000a000800000003
4175
4176 # controller 2: Enabled requestforward using OFPRAW_NXT_SET_ASYNC_CONFIG2 (necessary for OF1.3)
4177 ovs-appctl -t `pwd`/c2 ofctl/send 0404003000000002000023200000001b000100080000000200030008000000050005000800000005000b000800000003
4178
4179 # controller 1: Enabled requestforward using OFPRAW_NXT_SET_ASYNC_CONFIG2 (necessary for OF1.3)
4180 ovs-appctl -t `pwd`/c3 ofctl/send 0404003000000002000023200000001b00000008000000050002000800000002000400080000001a000a000800000003
4181 check_async 1 OFPGC_ADD OFPGC_MODIFY
4182
4183 OVS_VSWITCHD_STOP
4184 AT_CLEANUP
4185
4186
4187
4188 dnl This test checks that OFPT_PACKET_OUT accepts both OFPP_NONE (as
4189 dnl specified by OpenFlow 1.0) and OFPP_CONTROLLER (used by some
4190 dnl controllers despite the spec) as meaning a packet that was generated
4191 dnl by the controller.
4192 AT_SETUP([ofproto - packet-out from controller (OpenFlow 1.0)])
4193 OVS_VSWITCHD_START
4194 add_of_ports br0 1
4195
4196 # Start a monitor listening for packet-ins.
4197 AT_CHECK([ovs-ofctl -P standard monitor br0 --detach --no-chdir --pidfile])
4198 ovs-appctl -t ovs-ofctl ofctl/send 0109000c0123456700000080
4199 ovs-appctl -t ovs-ofctl ofctl/barrier
4200 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
4201 AT_CAPTURE_FILE([monitor.log])
4202
4203 # Send some packet-outs with OFPP_NONE and OFPP_CONTROLLER (65533) as in_port.
4204 AT_CHECK([ovs-ofctl packet-out br0 "in_port=none packet=0001020304050010203040501234 actions=controller,1"])
4205 AT_CHECK([ovs-ofctl packet-out br0 "in_port=controller packet=0001020304050010203040505678 actions=controller,1"])
4206
4207 # Stop the monitor and check its output.
4208 ovs-appctl -t ovs-ofctl ofctl/barrier
4209 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
4210
4211 ovs-ofctl dump-ports br0
4212
4213 AT_CHECK([sed 's/ (xid=0x[[0-9a-fA-F]]*)//' monitor.log], [0], [dnl
4214 OFPT_PACKET_IN: total_len=14 in_port=ANY (via action) data_len=14 (unbuffered)
4215 vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1234
4216 OFPT_PACKET_IN: total_len=14 in_port=CONTROLLER (via action) data_len=14 (unbuffered)
4217 vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x5678
4218 OFPT_BARRIER_REPLY:
4219 ])
4220
4221 OVS_VSWITCHD_STOP
4222 AT_CLEANUP
4223
4224 dnl This test checks that OFPT_PACKET_OUT accepts both OFPP_NONE (as
4225 dnl specified by OpenFlow 1.2) and OFPP_CONTROLLER (used by some
4226 dnl controllers despite the spec) as meaning a packet that was generated
4227 dnl by the controller.
4228 AT_SETUP([ofproto - packet-out from controller (OpenFlow 1.2)])
4229 OVS_VSWITCHD_START
4230
4231 # Start a monitor listening for packet-ins.
4232 AT_CHECK([ovs-ofctl -O OpenFlow12 -P standard monitor br0 --detach --no-chdir --pidfile])
4233 ovs-appctl -t ovs-ofctl ofctl/send 0309000c0123456700000080
4234 ovs-appctl -t ovs-ofctl ofctl/barrier
4235 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
4236 AT_CAPTURE_FILE([monitor.log])
4237
4238 # Send some packet-outs with OFPP_NONE and OFPP_CONTROLLER (65533) as in_port.
4239 AT_CHECK([ovs-ofctl -O OpenFlow12 packet-out br0 none controller '0001020304050010203040501234'])
4240 AT_CHECK([ovs-ofctl -O OpenFlow12 packet-out br0 4294967293 controller '0001020304050010203040505678'])
4241
4242 # Stop the monitor and check its output.
4243 ovs-appctl -t ovs-ofctl ofctl/barrier
4244 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
4245
4246 AT_CHECK([sed 's/ (xid=0x[[0-9a-fA-F]]*)//' monitor.log], [0], [dnl
4247 OFPT_PACKET_IN (OF1.2): total_len=14 in_port=ANY (via action) data_len=14 (unbuffered)
4248 vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1234
4249 OFPT_PACKET_IN (OF1.2): total_len=14 in_port=CONTROLLER (via action) data_len=14 (unbuffered)
4250 vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x5678
4251 OFPT_BARRIER_REPLY (OF1.2):
4252 ])
4253
4254 OVS_VSWITCHD_STOP
4255 AT_CLEANUP
4256
4257 dnl This test checks that OFPT_PACKET_OUT accepts both OFPP_NONE (as
4258 dnl specified by OpenFlow 1.1) and OFPP_CONTROLLER (used by some
4259 dnl controllers despite the spec) as meaning a packet that was generated
4260 dnl by the controller.
4261 AT_SETUP([ofproto - packet-out from controller (OpenFlow 1.1)])
4262 OVS_VSWITCHD_START
4263
4264 # Start a monitor listening for packet-ins.
4265 AT_CHECK([ovs-ofctl -O OpenFlow11 -P standard monitor br0 --detach --no-chdir --pidfile])
4266 ovs-appctl -t ovs-ofctl ofctl/send 0209000c0123456700000080
4267 ovs-appctl -t ovs-ofctl ofctl/barrier
4268 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
4269 AT_CAPTURE_FILE([monitor.log])
4270
4271 # Send some packet-outs with OFPP_NONE and OFPP_CONTROLLER as in_port.
4272 AT_CHECK([ovs-appctl -t ovs-ofctl ofctl/packet-out "in_port=none, packet=0001020304050010203040501234 actions=controller"])
4273 AT_CHECK([ovs-appctl -t ovs-ofctl ofctl/packet-out "in_port=controller packet=0001020304050010203040505678 actions=controller"])
4274
4275 # Stop the monitor and check its output.
4276 ovs-appctl -t ovs-ofctl ofctl/barrier
4277 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
4278
4279 AT_CHECK([sed 's/ (xid=0x[[0-9a-fA-F]]*)//
4280 /PACKET_OUT/d' monitor.log], [0], [dnl
4281 OFPT_PACKET_IN (OF1.1): total_len=14 in_port=ANY (via action) data_len=14 (unbuffered)
4282 vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1234
4283 OFPT_PACKET_IN (OF1.1): total_len=14 in_port=CONTROLLER (via action) data_len=14 (unbuffered)
4284 vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x5678
4285 OFPT_BARRIER_REPLY (OF1.1):
4286 ])
4287
4288 OVS_VSWITCHD_STOP
4289 AT_CLEANUP
4290
4291 AT_SETUP([ofproto - packet-out from controller (OpenFlow 1.5)])
4292 OVS_VSWITCHD_START
4293
4294 # Start a monitor listening for packet-ins.
4295 AT_CHECK([ovs-ofctl -O OpenFlow15 -P standard monitor br0 --detach --no-chdir --pidfile])
4296 ovs-appctl -t ovs-ofctl ofctl/send 0609000c0123456700000080
4297 ovs-appctl -t ovs-ofctl ofctl/barrier
4298 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
4299 AT_CAPTURE_FILE([monitor.log])
4300
4301 # Send some packet-outs with OFPP_NONE and OFPP_CONTROLLER (65533) as in_port.
4302 AT_CHECK([ovs-ofctl -O OpenFlow15 packet-out br0 "in_port=none tun_id=0x11 metadata=0x22 packet=0001020304050010203040501234 actions=controller"])
4303 AT_CHECK([ovs-ofctl -O OpenFlow15 packet-out br0 "in_port=controller tun_id=0x11 metadata=0x33 packet=0001020304050010203040505678 actions=controller"])
4304
4305 # Stop the monitor and check its output.
4306 ovs-appctl -t ovs-ofctl ofctl/barrier
4307 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
4308
4309 AT_CHECK([sed 's/ (xid=0x[[0-9a-fA-F]]*)//' monitor.log], [0], [dnl
4310 OFPT_PACKET_IN (OF1.5): total_len=14 tun_id=0x11,metadata=0x22,in_port=ANY (via packet_out) data_len=14 (unbuffered)
4311 vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1234
4312 OFPT_PACKET_IN (OF1.5): total_len=14 tun_id=0x11,metadata=0x33,in_port=CONTROLLER (via packet_out) data_len=14 (unbuffered)
4313 vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x5678
4314 OFPT_BARRIER_REPLY (OF1.5):
4315 ])
4316
4317 OVS_VSWITCHD_STOP
4318 AT_CLEANUP
4319
4320 dnl This test checks that metadata and userdata are encoded in NXT_PACKET_IN2.
4321 AT_SETUP([ofproto - packet-out with metadata and userdata (NXT_PACKET_IN2)])
4322 OVS_VSWITCHD_START
4323
4324 # Start a monitor listening for packet-ins.
4325 AT_CHECK([ovs-ofctl -P nxt_packet_in2 monitor br0 --detach --no-chdir --pidfile])
4326 ovs-appctl -t ovs-ofctl ofctl/send 0109000c0123456700000080
4327 ovs-appctl -t ovs-ofctl ofctl/barrier
4328 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
4329 AT_CAPTURE_FILE([monitor.log])
4330
4331 # Send a packet-out with a load action to set some metadata, and forward to controller
4332 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)"])
4333
4334 # Stop the monitor and check its output.
4335 ovs-appctl -t ovs-ofctl ofctl/barrier
4336 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
4337
4338 AT_CHECK([sed 's/ (xid=0x[[0-9a-fA-F]]*)//' monitor.log], [0], [dnl
4339 NXT_PACKET_IN2: total_len=14 pkt_mark=0xaa,metadata=0xfafafafa5a5a5a5a,in_port=CONTROLLER (via action) data_len=14 (unbuffered)
4340 userdata=01.02.03.04.05
4341 vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1234
4342 OFPT_BARRIER_REPLY:
4343 ])
4344
4345 OVS_VSWITCHD_STOP
4346 AT_CLEANUP
4347
4348 dnl This test checks that 1.5 packet_out is properly encoded/decoded.
4349 AT_SETUP([ofproto - packet-out with set_field metadata (OpenFlow 1.5)])
4350 OVS_VSWITCHD_START
4351
4352 # Start a monitor listening for packet-ins.
4353 AT_CHECK([ovs-ofctl -P standard -O OpenFlow13 monitor br0 --detach --no-chdir --pidfile])
4354 ovs-appctl -t ovs-ofctl ofctl/send 0409000c0123456700000080
4355 ovs-appctl -t ovs-ofctl ofctl/barrier
4356 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
4357 AT_CAPTURE_FILE([monitor.log])
4358
4359 # Send a packet-out with a couple of set-field action to set some metadata, and forward to controller
4360 AT_CHECK([ovs-ofctl -O OpenFlow15 packet-out br0 CONTROLLER 'set_field:0xfafafafa5a5a5a5a->metadata, controller' '0001020304050010203040501234'])
4361
4362 # Stop the monitor and check its output.
4363 ovs-appctl -t ovs-ofctl ofctl/barrier
4364 ovs-appctl -t ovs-ofctl exit
4365
4366 AT_CHECK([sed 's/ (xid=0x[[0-9a-fA-F]]*)//' monitor.log], [0], [dnl
4367 OFPT_PACKET_IN (OF1.3): total_len=14 metadata=0xfafafafa5a5a5a5a,in_port=CONTROLLER (via action) data_len=14 (unbuffered)
4368 vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1234
4369 OFPT_BARRIER_REPLY (OF1.3):
4370 ])
4371
4372 OVS_VSWITCHD_STOP
4373 AT_CLEANUP
4374
4375 dnl This test checks that packet_type PT_ETH is properly encoded/decoded in 1.5 packet_out.
4376 AT_SETUP([ofproto - packet-out with set_field metadata with packet_type PT_ETH (OpenFlow 1.5)])
4377 OVS_VSWITCHD_START
4378
4379 # Start a monitor listening for packet-ins.
4380 AT_CHECK([ovs-ofctl -P standard -O OpenFlow13 monitor br0 --detach --no-chdir --pidfile])
4381 ovs-appctl -t ovs-ofctl ofctl/send 0409000c0123456700000080
4382 ovs-appctl -t ovs-ofctl ofctl/barrier
4383 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
4384 AT_CAPTURE_FILE([monitor.log])
4385
4386 # Send a packet-out with a couple of set-field action to set some metadata, and forward to controller
4387 AT_CHECK([ovs-ofctl -O OpenFlow15 packet-out br0 "in_port=controller packet=0001020304050010203040501234 packet_type(0,0x0) actions=set_field:0xfafafafa5a5a5a5a->metadata,controller"])
4388
4389 # Stop the monitor and check its output.
4390 ovs-appctl -t ovs-ofctl ofctl/barrier
4391 ovs-appctl -t ovs-ofctl exit
4392
4393 AT_CHECK([sed 's/ (xid=0x[[0-9a-fA-F]]*)//' monitor.log], [0], [dnl
4394 OFPT_PACKET_IN (OF1.3): total_len=14 metadata=0xfafafafa5a5a5a5a,in_port=CONTROLLER (via action) data_len=14 (unbuffered)
4395 vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1234
4396 OFPT_BARRIER_REPLY (OF1.3):
4397 ])
4398
4399 OVS_VSWITCHD_STOP
4400 AT_CLEANUP
4401
4402 dnl This test checks that packet_type PT_IPV4 is properly encoded/decoded in 1.5 packet_out.
4403 AT_SETUP([ofproto - packet-out with set_field metadata with packet_type PT_IPV4 on PTAP bridge (OpenFlow 1.5)])
4404 OVS_VSWITCHD_START
4405
4406 # Start a monitor listening for packet-ins.
4407 AT_CHECK([ovs-ofctl -P standard -O OpenFlow13 monitor br0 --detach --no-chdir --pidfile])
4408 ovs-appctl -t ovs-ofctl ofctl/send 0409000c0123456700000080
4409 ovs-appctl -t ovs-ofctl ofctl/barrier
4410 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
4411 AT_CAPTURE_FILE([monitor.log])
4412
4413 # Send a packet-out with a couple of set-field action to set some metadata, and forward to controller
4414 AT_CHECK([ovs-ofctl -O OpenFlow15 packet-out br0 "in_port=controller packet=4500002012344000ff1155670a0000140a00001e006400c8000cea78ffffffff packet_type(1,0x800) actions=set_field:0xfafafafa5a5a5a5a->metadata,controller"])
4415
4416 # Stop the monitor and check its output.
4417 ovs-appctl -t ovs-ofctl ofctl/barrier
4418 ovs-appctl -t ovs-ofctl exit
4419
4420 AT_CHECK([sed 's/ (xid=0x[[0-9a-fA-F]]*)//' monitor.log], [0], [dnl
4421 OFPT_PACKET_IN (OF1.3): total_len=32 packet_type=(1,0x800),metadata=0xfafafafa5a5a5a5a,in_port=CONTROLLER (via action) data_len=32 (unbuffered)
4422 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
4423 OFPT_BARRIER_REPLY (OF1.3):
4424 ])
4425
4426 OVS_VSWITCHD_STOP
4427 AT_CLEANUP
4428
4429 dnl This test checks that metadata is encoded in packet_in structures,
4430 dnl supported by NXAST.
4431 AT_SETUP([ofproto - packet-out with metadata (NXM)])
4432 OVS_VSWITCHD_START
4433
4434 # Start a monitor listening for packet-ins.
4435 AT_CHECK([ovs-ofctl -P nxt_packet_in monitor br0 --detach --no-chdir --pidfile])
4436 ovs-appctl -t ovs-ofctl ofctl/send 0109000c0123456700000080
4437 ovs-appctl -t ovs-ofctl ofctl/barrier
4438 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
4439 AT_CAPTURE_FILE([monitor.log])
4440
4441 # Send a packet-out with a load action to set some metadata, and forward to controller
4442 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"])
4443
4444 # Stop the monitor and check its output.
4445 ovs-appctl -t ovs-ofctl ofctl/barrier
4446 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
4447
4448 AT_CHECK([sed 's/ (xid=0x[[0-9a-fA-F]]*)//' monitor.log], [0], [dnl
4449 NXT_PACKET_IN: total_len=14 pkt_mark=0xaa,metadata=0xfafafafa5a5a5a5a,in_port=CONTROLLER (via action) data_len=14 (unbuffered)
4450 vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1234
4451 OFPT_BARRIER_REPLY:
4452 ])
4453
4454 OVS_VSWITCHD_STOP
4455 AT_CLEANUP
4456
4457 dnl This test checks that metadata is encoded in packet_in structures,
4458 dnl supported by NXAST.
4459 AT_SETUP([ofproto - packet-out with metadata (OpenFlow 1.2)])
4460 OVS_VSWITCHD_START
4461
4462 # Start a monitor listening for packet-ins.
4463 AT_CHECK([ovs-ofctl -O OpenFlow12 -P standard monitor br0 --detach --no-chdir --pidfile])
4464 ovs-appctl -t ovs-ofctl ofctl/send 0309000c0123456700000080
4465 ovs-appctl -t ovs-ofctl ofctl/barrier
4466 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
4467 AT_CAPTURE_FILE([monitor.log])
4468
4469 # Send a packet-out with a set-field action to set some metadata, and forward to controller
4470 AT_CHECK([ovs-ofctl -O OpenFlow12 packet-out br0 none 'set_field:0xfafafafa5a5a5a5a->metadata, controller' '0001020304050010203040501234'])
4471
4472 # Stop the monitor and check its output.
4473 ovs-appctl -t ovs-ofctl ofctl/barrier
4474 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
4475
4476 AT_CHECK([sed 's/ (xid=0x[[0-9a-fA-F]]*)//' monitor.log], [0], [dnl
4477 OFPT_PACKET_IN (OF1.2): total_len=14 metadata=0xfafafafa5a5a5a5a,in_port=ANY (via action) data_len=14 (unbuffered)
4478 vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1234
4479 OFPT_BARRIER_REPLY (OF1.2):
4480 ])
4481
4482 OVS_VSWITCHD_STOP
4483 AT_CLEANUP
4484
4485 dnl This test checks that metadata is encoded in packet_in structures,
4486 dnl supported by NXAST.
4487 AT_SETUP([ofproto - packet-out with metadata and dual set_field (OpenFlow 1.3)])
4488 OVS_VSWITCHD_START
4489
4490 # Start a monitor listening for packet-ins.
4491 AT_CHECK([ovs-ofctl -O OpenFlow13 -P standard monitor br0 --detach --no-chdir --pidfile])
4492 ovs-appctl -t ovs-ofctl ofctl/send 0409000c0123456700000080
4493 ovs-appctl -t ovs-ofctl ofctl/barrier
4494 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
4495 AT_CAPTURE_FILE([monitor.log])
4496
4497 # Send a packet-out with a couple of set-field action to set some metadata, and forward to controller
4498 AT_CHECK([ovs-ofctl -O OpenFlow13 packet-out br0 none 'set_field:0xfafafafa5a5a5a5a->metadata, set_field:0x6b->metadata, controller' '0001020304050010203040501234'])
4499
4500 # Stop the monitor and check its output.
4501 ovs-appctl -t ovs-ofctl ofctl/barrier
4502 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
4503
4504 AT_CHECK([sed 's/ (xid=0x[[0-9a-fA-F]]*)//' monitor.log], [0], [dnl
4505 OFPT_PACKET_IN (OF1.3): total_len=14 metadata=0x6b,in_port=ANY (via action) data_len=14 (unbuffered)
4506 vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1234
4507 OFPT_BARRIER_REPLY (OF1.3):
4508 ])
4509
4510 OVS_VSWITCHD_STOP
4511 AT_CLEANUP
4512
4513 dnl This test checks that tunnel metadata is encoded in packet_in structures.
4514 AT_SETUP([ofproto - packet-out with tunnel metadata (OpenFlow 1.2)])
4515 OVS_VSWITCHD_START
4516
4517 # Start a monitor listening for packet-ins.
4518 AT_CHECK([ovs-ofctl -O OpenFlow12 -P standard monitor br0 --detach --no-chdir --pidfile])
4519 ovs-appctl -t ovs-ofctl ofctl/send 0309000c0123456700000080
4520 ovs-appctl -t ovs-ofctl ofctl/barrier
4521 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
4522 AT_CAPTURE_FILE([monitor.log])
4523
4524 # Send a packet-out with set field actions to set some tunnel metadata, and forward to controller
4525 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'])
4526
4527 # Stop the monitor and check its output.
4528 ovs-appctl -t ovs-ofctl ofctl/barrier
4529 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
4530
4531 AT_CHECK([sed 's/ (xid=0x[[0-9a-fA-F]]*)//' monitor.log], [0], [dnl
4532 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)
4533 vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1234
4534 OFPT_BARRIER_REPLY (OF1.2):
4535 ])
4536
4537 OVS_VSWITCHD_STOP
4538 AT_CLEANUP
4539
4540 m4_divert_push([PREPARE_TESTS])
4541 # Sorts groups of lines that start with a space, without moving them
4542 # past the nearest line that does not start with a space.
4543 [
4544 multiline_sort () {
4545 $PYTHON3 -c '
4546 import sys
4547
4548 buffer = []
4549 while True:
4550 line = sys.stdin.readline()
4551 if not line:
4552 break
4553 if line.startswith(" "):
4554 buffer.append(line)
4555 else:
4556 sys.stdout.write("".join(sorted(buffer)))
4557 sys.stdout.write(line)
4558 buffer = []
4559 sys.stdout.write("".join(sorted(buffer)))
4560 '
4561 }
4562 ]
4563 m4_divert_pop([PREPARE_TESTS])
4564
4565 AT_SETUP([ofproto - flow monitoring])
4566 AT_KEYWORDS([monitor])
4567 OVS_VSWITCHD_START
4568
4569 ovs-ofctl add-flow br0 in_port=0,dl_vlan=123,actions=output:1
4570
4571 # Start a monitor watching the flow table and check the initial reply.
4572 ovs-ofctl monitor br0 watch: --detach --no-chdir --pidfile >monitor.log 2>&1
4573 AT_CAPTURE_FILE([monitor.log])
4574 ovs-appctl -t ovs-ofctl ofctl/barrier
4575 AT_CHECK([sed 's/ (xid=0x[[1-9a-fA-F]][[0-9a-fA-F]]*)//' monitor.log], [0],
4576 [NXST_FLOW_MONITOR reply:
4577 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=123 actions=output:1
4578 OFPT_BARRIER_REPLY:
4579 ])
4580
4581 # Add, delete, and modify some flows and check the updates.
4582 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
4583 ovs-ofctl add-flow br0 in_port=0,dl_vlan=124,actions=output:2
4584 ovs-ofctl add-flow br0 in_port=0,dl_vlan=123,actions=output:5
4585 ovs-ofctl add-flow br0 in_port=0,dl_vlan=123,dl_vlan_pcp=0,actions=output:6
4586 ovs-ofctl add-flow br0 in_port=0,dl_vlan=123,dl_vlan_pcp=1,actions=output:7
4587 ovs-ofctl add-flow br0 in_port=0,dl_vlan=123,actions=output:8
4588 ovs-ofctl add-flow br0 in_port=0,dl_vlan=65535,dl_vlan_pcp=0,actions=output:9
4589 ovs-ofctl add-flow br0 in_port=0,dl_vlan=65535,dl_vlan_pcp=1,actions=output:10
4590 ovs-ofctl add-flow br0 in_port=0,dl_vlan=65535,actions=output:11
4591 ovs-ofctl add-flow br0 in_port=0,dl_vlan=8191,dl_vlan_pcp=0,actions=output:12
4592 ovs-ofctl add-flow br0 in_port=0,dl_vlan=8191,dl_vlan_pcp=1,actions=output:13
4593 ovs-ofctl add-flow br0 in_port=0,dl_vlan=8191,actions=output:14
4594 ovs-ofctl add-flow br0 in_port=0,dl_vlan=0,dl_vlan_pcp=0,actions=output:15
4595 ovs-ofctl add-flow br0 in_port=0,dl_vlan=0,dl_vlan_pcp=1,actions=output:16
4596 ovs-ofctl add-flow br0 in_port=0,dl_vlan=0,actions=output:17
4597 ovs-ofctl add-flow br0 in_port=0,dl_vlan=0,dl_vlan_pcp=0,actions=output:18
4598 ovs-ofctl add-flow br0 in_port=0,dl_vlan=0,dl_vlan_pcp=1,actions=output:19
4599 ovs-ofctl add-flow br0 in_port=0,dl_vlan=0,actions=output:20
4600 ovs-ofctl add-flow br0 in_port=0,dl_vlan_pcp=0,actions=output:21
4601 ovs-ofctl add-flow br0 in_port=0,dl_vlan_pcp=1,actions=output:22
4602 ovs-ofctl add-flow br0 in_port=0,actions=output:23
4603 ovs-ofctl mod-flows br0 dl_vlan=123,actions=output:3
4604 ovs-ofctl mod-flows br0 cookie=5,dl_vlan=123,actions=output:3
4605 ovs-ofctl del-flows br0 dl_vlan=123
4606 ovs-ofctl del-flows br0
4607 ovs-appctl -t ovs-ofctl ofctl/barrier
4608 AT_CHECK([sed 's/ (xid=0x[[1-9a-fA-F]][[0-9a-fA-F]]*)//' monitor.log | multiline_sort], [0],
4609 [NXST_FLOW_MONITOR reply (xid=0x0):
4610 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=124 actions=output:2
4611 NXST_FLOW_MONITOR reply (xid=0x0):
4612 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=123 actions=output:5
4613 NXST_FLOW_MONITOR reply (xid=0x0):
4614 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=123,dl_vlan_pcp=0 actions=output:6
4615 NXST_FLOW_MONITOR reply (xid=0x0):
4616 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=123,dl_vlan_pcp=1 actions=output:7
4617 NXST_FLOW_MONITOR reply (xid=0x0):
4618 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=123 actions=output:8
4619 NXST_FLOW_MONITOR reply (xid=0x0):
4620 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=0,dl_vlan_pcp=0 actions=output:9
4621 NXST_FLOW_MONITOR reply (xid=0x0):
4622 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=0,dl_vlan_pcp=1 actions=output:10
4623 NXST_FLOW_MONITOR reply (xid=0x0):
4624 event=ADDED table=0 cookie=0 in_port=0,vlan_tci=0x0000 actions=output:11
4625 NXST_FLOW_MONITOR reply (xid=0x0):
4626 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=4095,dl_vlan_pcp=0 actions=output:12
4627 NXST_FLOW_MONITOR reply (xid=0x0):
4628 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=4095,dl_vlan_pcp=1 actions=output:13
4629 NXST_FLOW_MONITOR reply (xid=0x0):
4630 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=4095 actions=output:14
4631 NXST_FLOW_MONITOR reply (xid=0x0):
4632 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=0,dl_vlan_pcp=0 actions=output:15
4633 NXST_FLOW_MONITOR reply (xid=0x0):
4634 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=0,dl_vlan_pcp=1 actions=output:16
4635 NXST_FLOW_MONITOR reply (xid=0x0):
4636 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=0 actions=output:17
4637 NXST_FLOW_MONITOR reply (xid=0x0):
4638 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=0,dl_vlan_pcp=0 actions=output:18
4639 NXST_FLOW_MONITOR reply (xid=0x0):
4640 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=0,dl_vlan_pcp=1 actions=output:19
4641 NXST_FLOW_MONITOR reply (xid=0x0):
4642 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=0 actions=output:20
4643 NXST_FLOW_MONITOR reply (xid=0x0):
4644 event=ADDED table=0 cookie=0 in_port=0,dl_vlan_pcp=0 actions=output:21
4645 NXST_FLOW_MONITOR reply (xid=0x0):
4646 event=ADDED table=0 cookie=0 in_port=0,dl_vlan_pcp=1 actions=output:22
4647 NXST_FLOW_MONITOR reply (xid=0x0):
4648 event=ADDED table=0 cookie=0 in_port=0 actions=output:23
4649 NXST_FLOW_MONITOR reply (xid=0x0):
4650 event=MODIFIED table=0 cookie=0 in_port=0,dl_vlan=123 actions=output:3
4651 event=MODIFIED table=0 cookie=0 in_port=0,dl_vlan=123,dl_vlan_pcp=0 actions=output:3
4652 event=MODIFIED table=0 cookie=0 in_port=0,dl_vlan=123,dl_vlan_pcp=1 actions=output:3
4653 NXST_FLOW_MONITOR reply (xid=0x0):
4654 event=MODIFIED table=0 cookie=0x5 in_port=0,dl_vlan=123 actions=output:3
4655 event=MODIFIED table=0 cookie=0x5 in_port=0,dl_vlan=123,dl_vlan_pcp=0 actions=output:3
4656 event=MODIFIED table=0 cookie=0x5 in_port=0,dl_vlan=123,dl_vlan_pcp=1 actions=output:3
4657 NXST_FLOW_MONITOR reply (xid=0x0):
4658 event=DELETED reason=delete table=0 cookie=0x5 in_port=0,dl_vlan=123 actions=output:3
4659 event=DELETED reason=delete table=0 cookie=0x5 in_port=0,dl_vlan=123,dl_vlan_pcp=0 actions=output:3
4660 event=DELETED reason=delete table=0 cookie=0x5 in_port=0,dl_vlan=123,dl_vlan_pcp=1 actions=output:3
4661 NXST_FLOW_MONITOR reply (xid=0x0):
4662 event=DELETED reason=delete table=0 cookie=0 in_port=0 actions=output:23
4663 event=DELETED reason=delete table=0 cookie=0 in_port=0,dl_vlan=0 actions=output:20
4664 event=DELETED reason=delete table=0 cookie=0 in_port=0,dl_vlan=0,dl_vlan_pcp=0 actions=output:18
4665 event=DELETED reason=delete table=0 cookie=0 in_port=0,dl_vlan=0,dl_vlan_pcp=1 actions=output:19
4666 event=DELETED reason=delete table=0 cookie=0 in_port=0,dl_vlan=124 actions=output:2
4667 event=DELETED reason=delete table=0 cookie=0 in_port=0,dl_vlan=4095 actions=output:14
4668 event=DELETED reason=delete table=0 cookie=0 in_port=0,dl_vlan=4095,dl_vlan_pcp=0 actions=output:12
4669 event=DELETED reason=delete table=0 cookie=0 in_port=0,dl_vlan=4095,dl_vlan_pcp=1 actions=output:13
4670 event=DELETED reason=delete table=0 cookie=0 in_port=0,dl_vlan_pcp=0 actions=output:21
4671 event=DELETED reason=delete table=0 cookie=0 in_port=0,dl_vlan_pcp=1 actions=output:22
4672 event=DELETED reason=delete table=0 cookie=0 in_port=0,vlan_tci=0x0000 actions=output:11
4673 OFPT_BARRIER_REPLY:
4674 ])
4675
4676 # Check that our own changes are reported as full updates.
4677 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
4678 ovs-ofctl add-flow br0 in_port=1,actions=output:2
4679 ovs-ofctl add-flow br0 in_port=2,actions=output:1
4680 ovs-appctl -t ovs-ofctl ofctl/barrier
4681 ovs-appctl -t ovs-ofctl ofctl/send 010e004812345678003fffff00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003000000000000ffffffffffff0000
4682 ovs-appctl -t ovs-ofctl ofctl/barrier
4683 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip], [0], [NXST_FLOW reply:
4684 ])
4685 AT_CHECK([sed 's/ (xid=0x[[1-9a-fA-F]][[0-9a-fA-F]]*)//' monitor.log | multiline_sort], [0],
4686 [NXST_FLOW_MONITOR reply (xid=0x0):
4687 event=ADDED table=0 cookie=0 in_port=1 actions=output:2
4688 NXST_FLOW_MONITOR reply (xid=0x0):
4689 event=ADDED table=0 cookie=0 in_port=2 actions=output:1
4690 OFPT_BARRIER_REPLY:
4691 send: OFPT_FLOW_MOD: DEL priority=0 actions=drop
4692 NXST_FLOW_MONITOR reply (xid=0x0):
4693 event=DELETED reason=delete table=0 cookie=0 in_port=1 actions=output:2
4694 event=DELETED reason=delete table=0 cookie=0 in_port=2 actions=output:1
4695 OFPT_BARRIER_REPLY:
4696 ])
4697
4698 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
4699 OVS_VSWITCHD_STOP
4700 AT_CLEANUP
4701
4702 AT_SETUP([ofproto - flow monitoring with !own])
4703 AT_KEYWORDS([monitor])
4704 OVS_VSWITCHD_START
4705
4706 ovs-ofctl add-flow br0 in_port=0,dl_vlan=123,actions=output:1
4707
4708 # Start a monitor watching the flow table and check the initial reply.
4709 ovs-ofctl monitor br0 watch:\!own --detach --no-chdir --pidfile >monitor.log 2>&1
4710 AT_CAPTURE_FILE([monitor.log])
4711 ovs-appctl -t ovs-ofctl ofctl/barrier
4712 AT_CHECK([sed 's/ (xid=0x[[1-9a-fA-F]][[0-9a-fA-F]]*)//' monitor.log], [0],
4713 [NXST_FLOW_MONITOR reply:
4714 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=123 actions=output:1
4715 OFPT_BARRIER_REPLY:
4716 ])
4717
4718 # Check that our own changes are reported as abbreviations.
4719 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
4720 ovs-ofctl add-flow br0 in_port=1,actions=output:2
4721 ovs-ofctl add-flow br0 in_port=2,actions=output:1
4722 ovs-appctl -t ovs-ofctl ofctl/barrier
4723 ovs-appctl -t ovs-ofctl ofctl/send 010e004812345678003fffff00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003000000000000ffffffffffff0000
4724 ovs-appctl -t ovs-ofctl ofctl/barrier
4725 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip], [0], [NXST_FLOW reply:
4726 ])
4727 AT_CHECK([sed 's/ (xid=0x[[1-9a-fA-F]][[0-9a-fA-F]]*)//' monitor.log], [0],
4728 [NXST_FLOW_MONITOR reply (xid=0x0):
4729 event=ADDED table=0 cookie=0 in_port=1 actions=output:2
4730 NXST_FLOW_MONITOR reply (xid=0x0):
4731 event=ADDED table=0 cookie=0 in_port=2 actions=output:1
4732 OFPT_BARRIER_REPLY:
4733 send: OFPT_FLOW_MOD: DEL priority=0 actions=drop
4734 NXST_FLOW_MONITOR reply (xid=0x0):
4735 event=ABBREV xid=0x12345678
4736 OFPT_BARRIER_REPLY:
4737 ])
4738
4739 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
4740 OVS_VSWITCHD_STOP
4741 AT_CLEANUP
4742
4743 AT_SETUP([ofproto - flow monitoring with out_port])
4744 AT_KEYWORDS([monitor])
4745 OVS_VSWITCHD_START
4746
4747 ovs-ofctl add-flow br0 in_port=0,dl_vlan=121,actions=output:1
4748 ovs-ofctl add-flow br0 in_port=0,dl_vlan=122,actions=output:1
4749 ovs-ofctl add-flow br0 in_port=0,dl_vlan=123,actions=output:2
4750
4751 # Start a monitor watching the flow table and check the initial reply.
4752 ovs-ofctl monitor br0 watch:out_port=2 --detach --no-chdir --pidfile >monitor.log 2>&1
4753 AT_CAPTURE_FILE([monitor.log])
4754 ovs-appctl -t ovs-ofctl ofctl/barrier
4755 AT_CHECK([sed 's/ (xid=0x[[1-9a-fA-F]][[0-9a-fA-F]]*)//' monitor.log], [0],
4756 [NXST_FLOW_MONITOR reply:
4757 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=123 actions=output:2
4758 OFPT_BARRIER_REPLY:
4759 ])
4760
4761 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
4762
4763 # Add, modify flows and check the updates.
4764 ovs-ofctl mod-flows br0 dl_vlan=121,actions=drop
4765 ovs-ofctl mod-flows br0 dl_vlan=122,actions=output:1,output:2
4766 ovs-appctl -t ovs-ofctl ofctl/barrier
4767
4768 ovs-ofctl mod-flows br0 dl_vlan=123,actions=output:1,output:2
4769 ovs-appctl -t ovs-ofctl ofctl/barrier
4770
4771 ovs-ofctl mod-flows br0 dl_vlan=122,actions=output:1
4772 ovs-appctl -t ovs-ofctl ofctl/barrier
4773 ovs-ofctl mod-flows br0 dl_vlan=123,actions=output:2
4774 ovs-appctl -t ovs-ofctl ofctl/barrier
4775
4776 AT_CHECK([sed 's/ (xid=0x[[1-9a-fA-F]][[0-9a-fA-F]]*)//' monitor.log], [0],
4777 [NXST_FLOW_MONITOR reply (xid=0x0):
4778 event=MODIFIED table=0 cookie=0 in_port=0,dl_vlan=122 actions=output:1,output:2
4779 OFPT_BARRIER_REPLY:
4780 NXST_FLOW_MONITOR reply (xid=0x0):
4781 event=MODIFIED table=0 cookie=0 in_port=0,dl_vlan=123 actions=output:1,output:2
4782 OFPT_BARRIER_REPLY:
4783 NXST_FLOW_MONITOR reply (xid=0x0):
4784 event=MODIFIED table=0 cookie=0 in_port=0,dl_vlan=122 actions=output:1
4785 OFPT_BARRIER_REPLY:
4786 NXST_FLOW_MONITOR reply (xid=0x0):
4787 event=MODIFIED table=0 cookie=0 in_port=0,dl_vlan=123 actions=output:2
4788 OFPT_BARRIER_REPLY:
4789 ])
4790
4791 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
4792 OVS_VSWITCHD_STOP
4793 AT_CLEANUP
4794
4795 AT_SETUP([ofproto - flow monitoring pause and resume])
4796 AT_KEYWORDS([monitor])
4797
4798 # The maximum socket receive buffer size is important for this test, which
4799 # tests behavior when the receive buffer overflows.
4800 if test -e /proc/sys/net/core/rmem_max; then
4801 # Linux
4802 rmem_max=`cat /proc/sys/net/core/rmem_max`
4803 elif rmem_max=`sysctl -n net.inet.tcp.recvbuf_max 2>/dev/null`; then
4804 : # FreeBSD, NetBSD
4805 else
4806 # Don't know how to get maximum socket receive buffer on this OS
4807 AT_SKIP_IF([:])
4808 fi
4809 # Calculate the total amount of queuing: rmem_max in the kernel, 128 kB
4810 # in ofproto sending userspace (see ofmonitor_flush() in connmgr.c).
4811 queue_size=`expr $rmem_max + 128 \* 1024`
4812 echo rmem_max=$rmem_max queue_size=$queue_size
4813
4814 # If there's too much queuing skip the test to avoid timing out.
4815 AT_SKIP_IF([test $rmem_max -gt 1048576])
4816
4817 # Each flow update message takes up at least 48 bytes of space in queues
4818 # and in practice more than that.
4819 n_msgs=`expr $queue_size / 48`
4820 echo n_msgs=$n_msgs
4821
4822 OVS_VSWITCHD_START
4823
4824 # Start a monitor watching the flow table, then make it block.
4825 on_exit 'kill `cat ovs-ofctl.pid`'
4826 ovs-ofctl monitor br0 watch: --detach --no-chdir --pidfile >monitor.log 2>&1
4827 AT_CAPTURE_FILE([monitor.log])
4828 ovs-appctl -t ovs-ofctl ofctl/block
4829
4830 # Add $n_msgs flows.
4831 (echo "in_port=2,actions=output:2"
4832 $PYTHON3 -c '
4833 for i in range('$n_msgs'):
4834 print("cookie=1,reg1=%d,actions=drop" % i)
4835 ') > flows.txt
4836 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
4837 # Check that multipart flow dumps work properly:
4838 AT_CHECK([ovs-ofctl diff-flows br0 flows.txt])
4839 AT_CHECK([ovs-ofctl add-flow br0 in_port=1,cookie=3,actions=drop])
4840 AT_CHECK([ovs-ofctl mod-flows br0 in_port=2,cookie=2,actions=output:2])
4841 AT_CHECK([ovs-ofctl del-flows br0 cookie=1/-1])
4842
4843 ovs-appctl -t ovs-ofctl ofctl/unblock
4844
4845 # Wait for the connection resumed.
4846 # A barrier doesn't work for this purpose.
4847 # https://www.mail-archive.com/dev@openvswitch.org/msg27013.html
4848 # https://www.mail-archive.com/dev@openvswitch.org/msg27675.html
4849 OVS_WAIT_UNTIL([grep NXT_FLOW_MONITOR_RESUMED monitor.log])
4850
4851 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
4852
4853 # Check that the flow monitor reported the same number of flows
4854 # added and deleted, but fewer than we actually added and deleted.
4855 adds=`grep -c 'ADDED.*reg1=' monitor.log`
4856 deletes=`grep -c 'DELETED.*reg1=' monitor.log`
4857 echo adds=$adds deletes=$deletes
4858 AT_CHECK([test $adds -gt 100 && test $adds -lt $n_msgs])
4859 AT_CHECK([test $adds = $deletes])
4860
4861 # Check that the flow monitor reported everything in the expected order:
4862 #
4863 # event=ADDED table=0 cookie=0x1 reg1=0x22
4864 # ...
4865 # NXT_FLOW_MONITOR_PAUSED:
4866 # ...
4867 # event=DELETED reason=delete table=0 cookie=0x1 reg1=0x22
4868 # ...
4869 # event=ADDED table=0 cookie=0x3 in_port=1
4870 # event=MODIFIED table=0 cookie=0x2 in_port=2 actions=output:2
4871 # NXT_FLOW_MONITOR_RESUMED:
4872 #
4873 # except that, between the PAUSED and RESUMED, the order of the ADDED
4874 # and MODIFIED lines lines depends on hash order, that is, it varies
4875 # as we change the hash function or change architecture. Therefore,
4876 # we use a couple of tests below to accept both orders.
4877 AT_CHECK([ofctl_strip < monitor.log | sed -n -e '
4878 /reg1=0x22$/p
4879 /cookie=0x[[23]]/p
4880 /NXT_FLOW_MONITOR_PAUSED:/p
4881 /NXT_FLOW_MONITOR_RESUMED:/p
4882 ' > monitor.log.subset])
4883 AT_CHECK([grep -v MODIFIED monitor.log.subset], [0], [dnl
4884 event=ADDED table=0 cookie=0x1 reg1=0x22
4885 NXT_FLOW_MONITOR_PAUSED:
4886 event=DELETED reason=delete table=0 cookie=0x1 reg1=0x22
4887 event=ADDED table=0 cookie=0x3 in_port=1
4888 NXT_FLOW_MONITOR_RESUMED:
4889 ])
4890 AT_CHECK([grep -v ADDED monitor.log.subset], [0], [dnl
4891 NXT_FLOW_MONITOR_PAUSED:
4892 event=DELETED reason=delete table=0 cookie=0x1 reg1=0x22
4893 event=MODIFIED table=0 cookie=0x2 in_port=2 actions=output:2
4894 NXT_FLOW_MONITOR_RESUMED:
4895 ])
4896
4897 OVS_VSWITCHD_STOP
4898 AT_CLEANUP
4899
4900 AT_SETUP([ofproto - flow monitoring usable protocols])
4901 AT_KEYWORDS([monitor])
4902
4903 OVS_VSWITCHD_START
4904
4905 on_exit 'kill `cat ovs-ofctl.pid`'
4906 ovs-ofctl -OOpenFlow14 monitor br0 watch:udp,udp_dst=8 --detach --no-chdir --pidfile >monitor.log 2>&1
4907 AT_CAPTURE_FILE([monitor.log])
4908
4909 # ovs-ofctl should exit because monitor is not supported in OpenFlow 1.4
4910 OVS_WAIT_UNTIL([grep "ovs-ofctl: none of the usable flow formats (OpenFlow10,NXM) is among the allowed flow formats (OXM-OpenFlow14)" monitor.log])
4911
4912 # check that only NXM flag is returned as usable protocols for sctp_dst
4913 # and ovs-ofctl should exit since monitor is not supported in OpenFlow 1.4
4914 ovs-ofctl -OOpenFlow14 monitor br0 watch:sctp,sctp_dst=9 --detach --no-chdir --pidfile >monitor.log 2>&1
4915 OVS_WAIT_UNTIL([grep "ovs-ofctl: none of the usable flow formats (NXM) is among the allowed flow formats (OXM-OpenFlow14)" monitor.log])
4916
4917 OVS_VSWITCHD_STOP
4918 AT_CLEANUP
4919
4920
4921 AT_SETUP([ofproto - event filtering (OpenFlow 1.3)])
4922 AT_KEYWORDS([monitor])
4923 OVS_VSWITCHD_START
4924
4925 # Start a monitor, use the required protocol version
4926 ovs-ofctl -O OpenFlow13 monitor br0 --detach --no-chdir --pidfile >monitor.log 2>&1
4927 AT_CAPTURE_FILE([monitor.log])
4928
4929 # Send an OpenFlow13 message (04), OFPT_GET_ASYNC_REQUEST (1a), length (8), xid (0a)
4930 ovs-appctl -t ovs-ofctl ofctl/send 041a00080000000a
4931 ovs-appctl -t ovs-ofctl ofctl/barrier
4932
4933 # Check default setting
4934 read -r -d '' expected <<'EOF'
4935 EOF
4936
4937 AT_CHECK([ofctl_strip < monitor.log], [], [dnl
4938 send: OFPT_GET_ASYNC_REQUEST (OF1.3):
4939 OFPT_GET_ASYNC_REPLY (OF1.3):
4940 master:
4941 PACKET_IN: no_match action
4942 PORT_STATUS: add delete modify
4943 FLOW_REMOVED: idle hard delete group_delete
4944 ROLE_STATUS: (off)
4945 TABLE_STATUS: (off)
4946 REQUESTFORWARD: (off)
4947
4948 slave:
4949 PACKET_IN: (off)
4950 PORT_STATUS: add delete modify
4951 FLOW_REMOVED: (off)
4952 ROLE_STATUS: (off)
4953 TABLE_STATUS: (off)
4954 REQUESTFORWARD: (off)
4955 OFPT_BARRIER_REPLY (OF1.3):
4956 ])
4957
4958 OVS_VSWITCHD_STOP
4959 AT_CLEANUP
4960
4961 AT_SETUP([ofproto - ofport_request])
4962 OVS_VSWITCHD_START
4963 add_of_ports br0 1 2 3
4964
4965 set_and_check_specific_ofports () {
4966 ovs-vsctl set Interface p1 ofport_request="$1" -- \
4967 set Interface p2 ofport_request="$2" -- \
4968 set Interface p3 ofport_request="$3"
4969 ofports=`ovs-vsctl get Interface p1 ofport -- \
4970 get Interface p2 ofport -- \
4971 get Interface p3 ofport`
4972 AT_CHECK_UNQUOTED([echo $ofports], [0], [$1 $2 $3
4973 ])
4974 }
4975 for pre in '1 2 3' '1 3 2' '2 1 3' '2 3 1' '3 1 2' '3 2 1'; do
4976 for post in '1 2 3' '1 3 2' '2 1 3' '2 3 1' '3 1 2' '3 2 1'; do
4977 echo -----------------------------------------------------------
4978 echo "Check changing port numbers from $pre to $post"
4979 set_and_check_specific_ofports $pre
4980 set_and_check_specific_ofports $post
4981 done
4982 done
4983
4984 ovs-vsctl del-port p3
4985
4986 set_and_check_poorly_specified_ofports () {
4987 ovs-vsctl set Interface p1 ofport_request="$1" -- \
4988 set Interface p2 ofport_request="$2"
4989 p1=`ovs-vsctl get Interface p1 ofport`
4990 p2=`ovs-vsctl get Interface p2 ofport`
4991 echo $p1 $p2
4992
4993 AT_CHECK([test "$p1" != "$p2"])
4994 if test "$1" = "$2" && test "$1" != '[[]]'; then
4995 # One port number must be the requested one.
4996 AT_CHECK([test "$p1" = "$1" || test "$p2" = "$1"])
4997 # The other port number must be different (already tested above).
4998 else
4999 AT_CHECK([test "$1" = '[[]]' || test "$p1" = "$1"])
5000 AT_CHECK([test "$2" = '[[]]' || test "$p2" = "$2"])
5001 fi
5002 }
5003 for pre in '1 2' '[[]] 2' '1 [[]]' '[[]] [[]]' '2 1' '[[]] 1' '2 [[]]' \
5004 '1 1' '2 2'; do
5005 for post in '1 2' '[[]] 2' '1 [[]]' '[[]] [[]]' '2 1' '[[]] 1' '2 [[]]' \
5006 '1 1' '2 2'; do
5007 echo -----------------------------------------------------------
5008 echo "Check changing port numbers from $pre to $post"
5009 set_and_check_poorly_specified_ofports $pre
5010 set_and_check_poorly_specified_ofports $post
5011 done
5012 done
5013 OVS_VSWITCHD_STOP
5014 AT_CLEANUP
5015
5016
5017 AT_SETUP([ofproto - bundle open (OpenFlow 1.4)])
5018 AT_KEYWORDS([monitor])
5019 OVS_VSWITCHD_START
5020
5021 # Start a monitor, use the required protocol version
5022 ovs-ofctl -O OpenFlow14 monitor br0 --detach --no-chdir --pidfile >monitor.log 2>&1
5023 AT_CAPTURE_FILE([monitor.log])
5024
5025 # Send an OpenFlow14 message (05), OFPT_BUNDLE_CONTROL (21), length (10), xid (0a)
5026 ovs-appctl -t ovs-ofctl ofctl/send "05 21 00 10 00 00 00 0a 00 00 00 01 00 00 00 02"
5027 ovs-appctl -t ovs-ofctl ofctl/barrier
5028 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
5029
5030 AT_CHECK([ofctl_strip < monitor.log], [], [dnl
5031 send: OFPT_BUNDLE_CONTROL (OF1.4):
5032 bundle_id=0x1 type=OPEN_REQUEST flags=ordered
5033 OFPT_BUNDLE_CONTROL (OF1.4):
5034 bundle_id=0x1 type=OPEN_REPLY flags=0
5035 OFPT_BARRIER_REPLY (OF1.4):
5036 ])
5037
5038 OVS_VSWITCHD_STOP
5039 AT_CLEANUP
5040
5041 AT_SETUP([ofproto - bundle double open (OpenFlow 1.4)])
5042 AT_KEYWORDS([monitor])
5043 OVS_VSWITCHD_START
5044
5045 # Start a monitor, use the required protocol version
5046 ovs-ofctl -O OpenFlow14 monitor br0 --detach --no-chdir --pidfile >monitor.log 2>&1
5047 AT_CAPTURE_FILE([monitor.log])
5048
5049 # Send twice an OpenFlow14 message (05), OFPT_BUNDLE_CONTROL (21), length (10), xid (0a)
5050 ovs-appctl -t ovs-ofctl ofctl/send "05 21 00 10 00 00 00 0a 00 00 00 01 00 00 00 02"
5051 ovs-appctl -t ovs-ofctl ofctl/barrier
5052 ovs-appctl -t ovs-ofctl ofctl/send "05 21 00 10 00 00 00 0a 00 00 00 01 00 00 00 02"
5053 ovs-appctl -t ovs-ofctl ofctl/barrier
5054 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
5055
5056 AT_CHECK([ofctl_strip < monitor.log], [0], [dnl
5057 send: OFPT_BUNDLE_CONTROL (OF1.4):
5058 bundle_id=0x1 type=OPEN_REQUEST flags=ordered
5059 OFPT_BUNDLE_CONTROL (OF1.4):
5060 bundle_id=0x1 type=OPEN_REPLY flags=0
5061 OFPT_BARRIER_REPLY (OF1.4):
5062 send: OFPT_BUNDLE_CONTROL (OF1.4):
5063 bundle_id=0x1 type=OPEN_REQUEST flags=ordered
5064 OFPT_ERROR (OF1.4): OFPBFC_BAD_ID
5065 OFPT_BUNDLE_CONTROL (OF1.4):
5066 bundle_id=0x1 type=OPEN_REQUEST flags=ordered
5067 OFPT_BARRIER_REPLY (OF1.4):
5068 ])
5069
5070 OVS_VSWITCHD_STOP
5071 AT_CLEANUP
5072
5073 AT_SETUP([ofproto - bundle close without open (OpenFlow 1.4)])
5074 AT_KEYWORDS([monitor])
5075 OVS_VSWITCHD_START
5076
5077 # Start a monitor, use the required protocol version
5078 ovs-ofctl -O OpenFlow14 monitor br0 --detach --no-chdir --pidfile >monitor.log 2>&1
5079 AT_CAPTURE_FILE([monitor.log])
5080
5081 ovs-appctl -t ovs-ofctl ofctl/send "05 21 00 10 00 00 00 0a 00 00 00 01 00 02 00 02"
5082 ovs-appctl -t ovs-ofctl ofctl/barrier
5083 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
5084
5085 AT_CHECK([ofctl_strip < monitor.log], [0], [dnl
5086 send: OFPT_BUNDLE_CONTROL (OF1.4):
5087 bundle_id=0x1 type=CLOSE_REQUEST flags=ordered
5088 OFPT_ERROR (OF1.4): OFPBFC_BAD_ID
5089 OFPT_BUNDLE_CONTROL (OF1.4):
5090 bundle_id=0x1 type=CLOSE_REQUEST flags=ordered
5091 OFPT_BARRIER_REPLY (OF1.4):
5092 ])
5093
5094 OVS_VSWITCHD_STOP
5095 AT_CLEANUP
5096
5097 AT_SETUP([ofproto - bundle double close (OpenFlow 1.4)])
5098 AT_KEYWORDS([monitor])
5099 OVS_VSWITCHD_START
5100
5101 # Start a monitor, use the required protocol version
5102 ovs-ofctl -O OpenFlow14 monitor br0 --detach --no-chdir --pidfile >monitor.log 2>&1
5103 AT_CAPTURE_FILE([monitor.log])
5104
5105 # Open, Close, Close
5106 ovs-appctl -t ovs-ofctl ofctl/send "05 21 00 10 00 00 00 0a 00 00 00 01 00 00 00 02"
5107 ovs-appctl -t ovs-ofctl ofctl/barrier
5108 ovs-appctl -t ovs-ofctl ofctl/send "05 21 00 10 00 00 00 0a 00 00 00 01 00 02 00 02"
5109 ovs-appctl -t ovs-ofctl ofctl/barrier
5110 ovs-appctl -t ovs-ofctl ofctl/send "05 21 00 10 00 00 00 0a 00 00 00 01 00 02 00 02"
5111 ovs-appctl -t ovs-ofctl ofctl/barrier
5112 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
5113
5114 AT_CHECK([ofctl_strip < monitor.log], [0], [dnl
5115 send: OFPT_BUNDLE_CONTROL (OF1.4):
5116 bundle_id=0x1 type=OPEN_REQUEST flags=ordered
5117 OFPT_BUNDLE_CONTROL (OF1.4):
5118 bundle_id=0x1 type=OPEN_REPLY flags=0
5119 OFPT_BARRIER_REPLY (OF1.4):
5120 send: OFPT_BUNDLE_CONTROL (OF1.4):
5121 bundle_id=0x1 type=CLOSE_REQUEST flags=ordered
5122 OFPT_BUNDLE_CONTROL (OF1.4):
5123 bundle_id=0x1 type=CLOSE_REPLY flags=0
5124 OFPT_BARRIER_REPLY (OF1.4):
5125 send: OFPT_BUNDLE_CONTROL (OF1.4):
5126 bundle_id=0x1 type=CLOSE_REQUEST flags=ordered
5127 OFPT_ERROR (OF1.4): OFPBFC_BUNDLE_CLOSED
5128 OFPT_BUNDLE_CONTROL (OF1.4):
5129 bundle_id=0x1 type=CLOSE_REQUEST flags=ordered
5130 OFPT_BARRIER_REPLY (OF1.4):
5131 ])
5132
5133 OVS_VSWITCHD_STOP
5134 AT_CLEANUP
5135
5136 AT_SETUP([ofproto - bundle close, different flags (OpenFlow 1.4)])
5137 AT_KEYWORDS([monitor])
5138 OVS_VSWITCHD_START
5139
5140 # Start a monitor, use the required protocol version
5141 ovs-ofctl -O OpenFlow14 monitor br0 --detach --no-chdir --pidfile >monitor.log 2>&1
5142 AT_CAPTURE_FILE([monitor.log])
5143
5144 # Open, Close
5145 ovs-appctl -t ovs-ofctl ofctl/send "05 21 00 10 00 00 00 0a 00 00 00 01 00 00 00 02"
5146 ovs-appctl -t ovs-ofctl ofctl/barrier
5147 ovs-appctl -t ovs-ofctl ofctl/send "05 21 00 10 00 00 00 0a 00 00 00 01 00 02 00 01"
5148 ovs-appctl -t ovs-ofctl ofctl/barrier
5149 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
5150
5151 AT_CHECK([ofctl_strip < monitor.log], [0], [dnl
5152 send: OFPT_BUNDLE_CONTROL (OF1.4):
5153 bundle_id=0x1 type=OPEN_REQUEST flags=ordered
5154 OFPT_BUNDLE_CONTROL (OF1.4):
5155 bundle_id=0x1 type=OPEN_REPLY flags=0
5156 OFPT_BARRIER_REPLY (OF1.4):
5157 send: OFPT_BUNDLE_CONTROL (OF1.4):
5158 bundle_id=0x1 type=CLOSE_REQUEST flags=atomic
5159 OFPT_ERROR (OF1.4): OFPBFC_BAD_FLAGS
5160 OFPT_BUNDLE_CONTROL (OF1.4):
5161 bundle_id=0x1 type=CLOSE_REQUEST flags=atomic
5162 OFPT_BARRIER_REPLY (OF1.4):
5163 ])
5164
5165 OVS_VSWITCHD_STOP
5166 AT_CLEANUP
5167
5168 AT_SETUP([ofproto - bundle commit without open (OpenFlow 1.4)])
5169 AT_KEYWORDS([monitor])
5170 OVS_VSWITCHD_START
5171
5172 # Start a monitor, use the required protocol version
5173 ovs-ofctl -O OpenFlow14 monitor br0 --detach --no-chdir --pidfile >monitor.log 2>&1
5174 AT_CAPTURE_FILE([monitor.log])
5175
5176 # Commit
5177 ovs-appctl -t ovs-ofctl ofctl/send "05 21 00 10 00 00 00 0a 00 00 00 01 00 04 00 02"
5178 ovs-appctl -t ovs-ofctl ofctl/barrier
5179 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
5180
5181 AT_CHECK([ofctl_strip < monitor.log], [0], [dnl
5182 send: OFPT_BUNDLE_CONTROL (OF1.4):
5183 bundle_id=0x1 type=COMMIT_REQUEST flags=ordered
5184 OFPT_ERROR (OF1.4): OFPBFC_BAD_ID
5185 OFPT_BUNDLE_CONTROL (OF1.4):
5186 bundle_id=0x1 type=COMMIT_REQUEST flags=ordered
5187 OFPT_BARRIER_REPLY (OF1.4):
5188 ])
5189
5190 OVS_VSWITCHD_STOP
5191 AT_CLEANUP
5192
5193 AT_SETUP([ofproto - bundle commit, different flags (OpenFlow 1.4)])
5194 AT_KEYWORDS([monitor])
5195 OVS_VSWITCHD_START
5196
5197 # Start a monitor, use the required protocol version
5198 ovs-ofctl -O OpenFlow14 monitor br0 --detach --no-chdir --pidfile >monitor.log 2>&1
5199 AT_CAPTURE_FILE([monitor.log])
5200
5201 # Open, Commit
5202 ovs-appctl -t ovs-ofctl ofctl/send "05 21 00 10 00 00 00 0a 00 00 00 01 00 00 00 02"
5203 ovs-appctl -t ovs-ofctl ofctl/barrier
5204 ovs-appctl -t ovs-ofctl ofctl/send "05 21 00 10 00 00 00 0a 00 00 00 01 00 04 00 01"
5205 ovs-appctl -t ovs-ofctl ofctl/barrier
5206 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
5207
5208 AT_CHECK([ofctl_strip < monitor.log], [0], [dnl
5209 send: OFPT_BUNDLE_CONTROL (OF1.4):
5210 bundle_id=0x1 type=OPEN_REQUEST flags=ordered
5211 OFPT_BUNDLE_CONTROL (OF1.4):
5212 bundle_id=0x1 type=OPEN_REPLY flags=0
5213 OFPT_BARRIER_REPLY (OF1.4):
5214 send: OFPT_BUNDLE_CONTROL (OF1.4):
5215 bundle_id=0x1 type=COMMIT_REQUEST flags=atomic
5216 OFPT_ERROR (OF1.4): OFPBFC_BAD_FLAGS
5217 OFPT_BUNDLE_CONTROL (OF1.4):
5218 bundle_id=0x1 type=COMMIT_REQUEST flags=atomic
5219 OFPT_BARRIER_REPLY (OF1.4):
5220 ])
5221
5222 OVS_VSWITCHD_STOP
5223 AT_CLEANUP
5224
5225 AT_SETUP([ofproto - bundle discard without open (OpenFlow 1.4)])
5226 AT_KEYWORDS([monitor])
5227 OVS_VSWITCHD_START
5228
5229 # Start a monitor, use the required protocol version
5230 ovs-ofctl -O OpenFlow14 monitor br0 --detach --no-chdir --pidfile >monitor.log 2>&1
5231 AT_CAPTURE_FILE([monitor.log])
5232
5233 # Discard
5234 ovs-appctl -t ovs-ofctl ofctl/send "05 21 00 10 00 00 00 0a 00 00 00 01 00 06 00 02"
5235 ovs-appctl -t ovs-ofctl ofctl/barrier
5236 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
5237
5238 AT_CHECK([ofctl_strip < monitor.log], [0], [dnl
5239 send: OFPT_BUNDLE_CONTROL (OF1.4):
5240 bundle_id=0x1 type=DISCARD_REQUEST flags=ordered
5241 OFPT_ERROR (OF1.4): OFPBFC_BAD_ID
5242 OFPT_BUNDLE_CONTROL (OF1.4):
5243 bundle_id=0x1 type=DISCARD_REQUEST flags=ordered
5244 OFPT_BARRIER_REPLY (OF1.4):
5245 ])
5246
5247 OVS_VSWITCHD_STOP
5248 AT_CLEANUP
5249
5250
5251 AT_SETUP([ofproto - bundle with multiple flow mods (OpenFlow 1.4)])
5252 OVS_VSWITCHD_START
5253
5254 AT_CHECK([ovs-appctl vlog/set vconn:dbg])
5255
5256 AT_CHECK([ovs-ofctl --no-names del-flows br0])
5257
5258 AT_DATA([flows.txt], [dnl
5259 add idle_timeout=50 in_port=2 dl_src=00:66:77:88:99:aa actions=1
5260 add idle_timeout=60 in_port=2 dl_src=00:77:88:99:aa:bb actions=2
5261 add idle_timeout=70 in_port=2 dl_src=00:88:99:aa:bb:cc actions=3
5262 add idle_timeout=50 in_port=2 dl_src=00:66:77:88:99:aa actions=4
5263 delete
5264 add idle_timeout=50 in_port=2 dl_src=00:66:77:88:99:aa actions=5
5265 add idle_timeout=60 in_port=2 dl_src=00:77:88:99:aa:bb actions=6
5266 add idle_timeout=70 in_port=2 dl_src=00:88:99:aa:bb:cc actions=7
5267 delete in_port=2 dl_src=00:88:99:aa:bb:cc
5268 ])
5269
5270 AT_CHECK([ovs-ofctl --no-names --bundle add-flows br0 flows.txt])
5271
5272 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
5273 idle_timeout=50, in_port=2,dl_src=00:66:77:88:99:aa actions=output:5
5274 idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=output:6
5275 NXST_FLOW reply:
5276 ])
5277
5278 AT_DATA([flows.txt], [dnl
5279 modify actions=drop
5280 modify_strict in_port=2 dl_src=00:77:88:99:aa:bb actions=7
5281 ])
5282
5283 AT_CHECK([ovs-ofctl --no-names --bundle add-flows br0 flows.txt])
5284
5285 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
5286 idle_timeout=50, in_port=2,dl_src=00:66:77:88:99:aa actions=drop
5287 idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=output:7
5288 NXST_FLOW reply:
5289 ])
5290
5291 # Adding an existing flow acts as a modify, and delete_strict also works.
5292 AT_DATA([flows.txt], [dnl
5293 add idle_timeout=60 in_port=2 dl_src=00:77:88:99:aa:bb actions=8
5294 delete_strict in_port=2 dl_src=00:66:77:88:99:aa
5295 add in_port=2 dl_src=00:66:77:88:99:aa actions=drop
5296 ])
5297
5298 AT_CHECK([ovs-ofctl --no-names --bundle add-flows br0 flows.txt])
5299
5300 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
5301 idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=output:8
5302 in_port=2,dl_src=00:66:77:88:99:aa actions=drop
5303 NXST_FLOW reply:
5304 ])
5305
5306 dnl Check logs for OpenFlow trace
5307 # Prevent race.
5308 OVS_WAIT_UNTIL([vconn_sub < ovs-vswitchd.log | test `grep -- "|vconn|DBG|unix: sent (Success): NXST_FLOW reply" | wc -l` -ge 3])
5309 AT_CHECK([print_vconn_debug | vconn_sub | ofctl_strip], [0], [dnl
5310 vconn|DBG|unix: sent (Success): OFPT_HELLO (OF1.5):
5311 version bitmap: 0x01, 0x02, 0x03, 0x04, 0x05, 0x06
5312 vconn|DBG|unix: received: OFPT_HELLO:
5313 version bitmap: 0x01
5314 vconn|DBG|unix: negotiated OpenFlow version 0x01 (we support version 0x06 and earlier, peer supports version 0x01)
5315 vconn|DBG|unix: received: OFPT_FLOW_MOD: DEL actions=drop
5316 vconn|DBG|unix: received: OFPT_BARRIER_REQUEST:
5317 vconn|DBG|unix: sent (Success): OFPT_BARRIER_REPLY:
5318 vconn|DBG|unix: sent (Success): OFPT_HELLO (OF1.5):
5319 version bitmap: 0x01, 0x02, 0x03, 0x04, 0x05, 0x06
5320 vconn|DBG|unix: received: OFPT_HELLO (OF1.4):
5321 version bitmap: 0x05
5322 vconn|DBG|unix: negotiated OpenFlow version 0x05 (we support version 0x06 and earlier, peer supports version 0x05)
5323 vconn|DBG|unix: received: OFPT_BUNDLE_CONTROL (OF1.4):
5324 bundle_id=0 type=OPEN_REQUEST flags=atomic ordered
5325 vconn|DBG|unix: sent (Success): OFPT_BUNDLE_CONTROL (OF1.4):
5326 bundle_id=0 type=OPEN_REPLY flags=0
5327 vconn|DBG|unix: received: OFPT_BUNDLE_ADD_MESSAGE (OF1.4):
5328 bundle_id=0 flags=atomic ordered
5329 OFPT_FLOW_MOD (OF1.4): ADD in_port=2,dl_src=00:66:77:88:99:aa idle:50 actions=output:1
5330 vconn|DBG|unix: received: OFPT_BUNDLE_ADD_MESSAGE (OF1.4):
5331 bundle_id=0 flags=atomic ordered
5332 OFPT_FLOW_MOD (OF1.4): ADD in_port=2,dl_src=00:77:88:99:aa:bb idle:60 actions=output:2
5333 vconn|DBG|unix: received: OFPT_BUNDLE_ADD_MESSAGE (OF1.4):
5334 bundle_id=0 flags=atomic ordered
5335 OFPT_FLOW_MOD (OF1.4): ADD in_port=2,dl_src=00:88:99:aa:bb:cc idle:70 actions=output:3
5336 vconn|DBG|unix: received: OFPT_BUNDLE_ADD_MESSAGE (OF1.4):
5337 bundle_id=0 flags=atomic ordered
5338 OFPT_FLOW_MOD (OF1.4): ADD in_port=2,dl_src=00:66:77:88:99:aa idle:50 actions=output:4
5339 vconn|DBG|unix: received: OFPT_BUNDLE_ADD_MESSAGE (OF1.4):
5340 bundle_id=0 flags=atomic ordered
5341 OFPT_FLOW_MOD (OF1.4): DEL table:255 actions=drop
5342 vconn|DBG|unix: received: OFPT_BUNDLE_ADD_MESSAGE (OF1.4):
5343 bundle_id=0 flags=atomic ordered
5344 OFPT_FLOW_MOD (OF1.4): ADD in_port=2,dl_src=00:66:77:88:99:aa idle:50 actions=output:5
5345 vconn|DBG|unix: received: OFPT_BUNDLE_ADD_MESSAGE (OF1.4):
5346 bundle_id=0 flags=atomic ordered
5347 OFPT_FLOW_MOD (OF1.4): ADD in_port=2,dl_src=00:77:88:99:aa:bb idle:60 actions=output:6
5348 vconn|DBG|unix: received: OFPT_BUNDLE_ADD_MESSAGE (OF1.4):
5349 bundle_id=0 flags=atomic ordered
5350 OFPT_FLOW_MOD (OF1.4): ADD in_port=2,dl_src=00:88:99:aa:bb:cc idle:70 actions=output:7
5351 vconn|DBG|unix: received: OFPT_BUNDLE_ADD_MESSAGE (OF1.4):
5352 bundle_id=0 flags=atomic ordered
5353 OFPT_FLOW_MOD (OF1.4): DEL table:255 in_port=2,dl_src=00:88:99:aa:bb:cc actions=drop
5354 vconn|DBG|unix: received: OFPT_BARRIER_REQUEST (OF1.4):
5355 vconn|DBG|unix: sent (Success): OFPT_BARRIER_REPLY (OF1.4):
5356 vconn|DBG|unix: received: OFPT_BUNDLE_CONTROL (OF1.4):
5357 bundle_id=0 type=COMMIT_REQUEST flags=atomic ordered
5358 vconn|DBG|unix: sent (Success): OFPT_BUNDLE_CONTROL (OF1.4):
5359 bundle_id=0 type=COMMIT_REPLY flags=0
5360 vconn|DBG|unix: sent (Success): OFPT_HELLO (OF1.5):
5361 version bitmap: 0x01, 0x02, 0x03, 0x04, 0x05, 0x06
5362 vconn|DBG|unix: received: OFPT_HELLO:
5363 version bitmap: 0x01
5364 vconn|DBG|unix: negotiated OpenFlow version 0x01 (we support version 0x06 and earlier, peer supports version 0x01)
5365 vconn|DBG|unix: received: NXT_SET_FLOW_FORMAT: format=nxm
5366 vconn|DBG|unix: received: OFPT_BARRIER_REQUEST:
5367 vconn|DBG|unix: sent (Success): OFPT_BARRIER_REPLY:
5368 vconn|DBG|unix: received: NXST_FLOW request:
5369 vconn|DBG|unix: sent (Success): NXST_FLOW reply:
5370 idle_timeout=50, in_port=2,dl_src=00:66:77:88:99:aa actions=output:5
5371 idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=output:6
5372 vconn|DBG|unix: sent (Success): OFPT_HELLO (OF1.5):
5373 version bitmap: 0x01, 0x02, 0x03, 0x04, 0x05, 0x06
5374 vconn|DBG|unix: received: OFPT_HELLO (OF1.4):
5375 version bitmap: 0x05
5376 vconn|DBG|unix: negotiated OpenFlow version 0x05 (we support version 0x06 and earlier, peer supports version 0x05)
5377 vconn|DBG|unix: received: OFPT_BUNDLE_CONTROL (OF1.4):
5378 bundle_id=0 type=OPEN_REQUEST flags=atomic ordered
5379 vconn|DBG|unix: sent (Success): OFPT_BUNDLE_CONTROL (OF1.4):
5380 bundle_id=0 type=OPEN_REPLY flags=0
5381 vconn|DBG|unix: received: OFPT_BUNDLE_ADD_MESSAGE (OF1.4):
5382 bundle_id=0 flags=atomic ordered
5383 OFPT_FLOW_MOD (OF1.4): MOD actions=drop
5384 vconn|DBG|unix: received: OFPT_BUNDLE_ADD_MESSAGE (OF1.4):
5385 bundle_id=0 flags=atomic ordered
5386 OFPT_FLOW_MOD (OF1.4): MOD_STRICT in_port=2,dl_src=00:77:88:99:aa:bb actions=output:7
5387 vconn|DBG|unix: received: OFPT_BARRIER_REQUEST (OF1.4):
5388 vconn|DBG|unix: sent (Success): OFPT_BARRIER_REPLY (OF1.4):
5389 vconn|DBG|unix: received: OFPT_BUNDLE_CONTROL (OF1.4):
5390 bundle_id=0 type=COMMIT_REQUEST flags=atomic ordered
5391 vconn|DBG|unix: sent (Success): OFPT_BUNDLE_CONTROL (OF1.4):
5392 bundle_id=0 type=COMMIT_REPLY flags=0
5393 vconn|DBG|unix: sent (Success): OFPT_HELLO (OF1.5):
5394 version bitmap: 0x01, 0x02, 0x03, 0x04, 0x05, 0x06
5395 vconn|DBG|unix: received: OFPT_HELLO:
5396 version bitmap: 0x01
5397 vconn|DBG|unix: negotiated OpenFlow version 0x01 (we support version 0x06 and earlier, peer supports version 0x01)
5398 vconn|DBG|unix: received: NXT_SET_FLOW_FORMAT: format=nxm
5399 vconn|DBG|unix: received: OFPT_BARRIER_REQUEST:
5400 vconn|DBG|unix: sent (Success): OFPT_BARRIER_REPLY:
5401 vconn|DBG|unix: received: NXST_FLOW request:
5402 vconn|DBG|unix: sent (Success): NXST_FLOW reply:
5403 idle_timeout=50, in_port=2,dl_src=00:66:77:88:99:aa actions=drop
5404 idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=output:7
5405 vconn|DBG|unix: sent (Success): OFPT_HELLO (OF1.5):
5406 version bitmap: 0x01, 0x02, 0x03, 0x04, 0x05, 0x06
5407 vconn|DBG|unix: received: OFPT_HELLO (OF1.4):
5408 version bitmap: 0x05
5409 vconn|DBG|unix: negotiated OpenFlow version 0x05 (we support version 0x06 and earlier, peer supports version 0x05)
5410 vconn|DBG|unix: received: OFPT_BUNDLE_CONTROL (OF1.4):
5411 bundle_id=0 type=OPEN_REQUEST flags=atomic ordered
5412 vconn|DBG|unix: sent (Success): OFPT_BUNDLE_CONTROL (OF1.4):
5413 bundle_id=0 type=OPEN_REPLY flags=0
5414 vconn|DBG|unix: received: OFPT_BUNDLE_ADD_MESSAGE (OF1.4):
5415 bundle_id=0 flags=atomic ordered
5416 OFPT_FLOW_MOD (OF1.4): ADD in_port=2,dl_src=00:77:88:99:aa:bb idle:60 actions=output:8
5417 vconn|DBG|unix: received: OFPT_BUNDLE_ADD_MESSAGE (OF1.4):
5418 bundle_id=0 flags=atomic ordered
5419 OFPT_FLOW_MOD (OF1.4): DEL_STRICT table:255 in_port=2,dl_src=00:66:77:88:99:aa actions=drop
5420 vconn|DBG|unix: received: OFPT_BUNDLE_ADD_MESSAGE (OF1.4):
5421 bundle_id=0 flags=atomic ordered
5422 OFPT_FLOW_MOD (OF1.4): ADD in_port=2,dl_src=00:66:77:88:99:aa actions=drop
5423 vconn|DBG|unix: received: OFPT_BARRIER_REQUEST (OF1.4):
5424 vconn|DBG|unix: sent (Success): OFPT_BARRIER_REPLY (OF1.4):
5425 vconn|DBG|unix: received: OFPT_BUNDLE_CONTROL (OF1.4):
5426 bundle_id=0 type=COMMIT_REQUEST flags=atomic ordered
5427 vconn|DBG|unix: sent (Success): OFPT_BUNDLE_CONTROL (OF1.4):
5428 bundle_id=0 type=COMMIT_REPLY flags=0
5429 vconn|DBG|unix: sent (Success): OFPT_HELLO (OF1.5):
5430 version bitmap: 0x01, 0x02, 0x03, 0x04, 0x05, 0x06
5431 vconn|DBG|unix: received: OFPT_HELLO:
5432 version bitmap: 0x01
5433 vconn|DBG|unix: negotiated OpenFlow version 0x01 (we support version 0x06 and earlier, peer supports version 0x01)
5434 vconn|DBG|unix: received: NXT_SET_FLOW_FORMAT: format=nxm
5435 vconn|DBG|unix: received: OFPT_BARRIER_REQUEST:
5436 vconn|DBG|unix: sent (Success): OFPT_BARRIER_REPLY:
5437 vconn|DBG|unix: received: NXST_FLOW request:
5438 vconn|DBG|unix: sent (Success): NXST_FLOW reply:
5439 idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=output:8
5440 in_port=2,dl_src=00:66:77:88:99:aa actions=drop
5441 ])
5442
5443 AT_CHECK([grep " flow_mods in the last " ovs-vswitchd.log | sed -e 's/^.*connmgr|INFO|//' | vconn_sub], [0], [dnl
5444 br0<->unix: 1 flow_mods in the last 0 s (1 deletes)
5445 br0<->unix: 9 flow_mods in the last 0 s (7 adds, 2 deletes)
5446 br0<->unix: 2 flow_mods in the last 0 s (2 modifications)
5447 br0<->unix: 3 flow_mods in the last 0 s (2 adds, 1 deletes)
5448 ])
5449
5450 OVS_VSWITCHD_STOP
5451 AT_CLEANUP
5452
5453
5454 AT_SETUP([ofproto - failing bundle commit (OpenFlow 1.4)])
5455 OVS_VSWITCHD_START
5456
5457 AT_CHECK([ovs-ofctl del-flows br0])
5458
5459 ovs-ofctl add-flows br0 - <<EOF
5460 idle_timeout=50 in_port=2 dl_src=00:66:77:88:99:aa actions=11
5461 idle_timeout=60 in_port=2 dl_src=00:77:88:99:aa:bb actions=22
5462 idle_timeout=70 in_port=2 dl_src=00:88:99:aa:bb:cc actions=33
5463 EOF
5464 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
5465 idle_timeout=50, in_port=2,dl_src=00:66:77:88:99:aa actions=output:11
5466 idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=output:22
5467 idle_timeout=70, in_port=2,dl_src=00:88:99:aa:bb:cc actions=output:33
5468 NXST_FLOW reply:
5469 ])
5470
5471 # last line uses illegal table number (OVS internal table)
5472 AT_DATA([flows.txt], [dnl
5473 add idle_timeout=50 in_port=2 dl_src=00:66:77:88:99:aa actions=1
5474 add idle_timeout=60 in_port=2 dl_src=00:77:88:99:aa:bb actions=2
5475 add idle_timeout=70 in_port=2 dl_src=00:88:99:aa:bb:cc actions=3
5476 modify idle_timeout=50 in_port=2 dl_src=00:66:77:88:99:aa actions=4
5477 delete
5478 add idle_timeout=50 in_port=2 dl_src=00:66:77:88:99:aa actions=5
5479 add idle_timeout=60 in_port=2 dl_src=00:77:88:99:aa:bb actions=6
5480 add idle_timeout=70 in_port=2 dl_src=00:88:99:aa:bb:cc actions=7
5481 delete in_port=2 dl_src=00:88:99:aa:bb:cc
5482 add table=254 actions=drop
5483 ])
5484
5485 AT_CHECK([ovs-ofctl --bundle add-flows br0 flows.txt 2>&1 | sed '/talking to/,$d' | strip_xids],
5486 [0], [dnl
5487 Error OFPBRC_EPERM for: OFPT_FLOW_MOD (OF1.4): ADD table:254 actions=drop
5488 ])
5489
5490 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
5491 idle_timeout=50, in_port=2,dl_src=00:66:77:88:99:aa actions=output:11
5492 idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=output:22
5493 idle_timeout=70, in_port=2,dl_src=00:88:99:aa:bb:cc actions=output:33
5494 NXST_FLOW reply:
5495 ])
5496
5497 OVS_VSWITCHD_STOP
5498 AT_CLEANUP
5499
5500
5501 AT_SETUP([ofproto - bundle timeout (OpenFlow 1.4)])
5502 AT_KEYWORDS([monitor])
5503 OVS_VSWITCHD_START
5504
5505 # Start a monitor, use the required protocol version
5506 ovs-ofctl -O OpenFlow14 monitor br0 --detach --no-chdir --pidfile >monitor.log 2>&1
5507 AT_CAPTURE_FILE([monitor.log])
5508
5509 ovs-appctl time/stop
5510
5511 # Send an OpenFlow14 message (05), OFPT_BUNDLE_CONTROL (21), length (10), xid (01)
5512 ovs-appctl -t ovs-ofctl ofctl/send "05 21 00 10 00 00 00 01 00 00 00 01 00 00 00 03"
5513 ovs-appctl time/warp 8000
5514 # Send a bundle flow mod, it should keep the bundle alive.
5515 ovs-appctl -t ovs-ofctl ofctl/send "05 22 00 a0 00 00 00 02 00 00 00 01 00 00 00 03 \
5516 05 0e 00 90 00 00 00 02 00 00 00 00 00 00 00 00 \
5517 00 00 00 00 00 00 00 00 01 00 00 00 00 00 ff ff \
5518 ff ff ff ff ff ff ff ff ff ff ff ff 00 00 00 00 \
5519 00 01 00 42 80 00 00 04 00 00 00 01 80 00 08 06 \
5520 50 54 00 00 00 06 80 00 06 06 50 54 00 00 00 05 \
5521 80 00 0a 02 08 06 80 00 0c 02 00 00 80 00 2a 02 \
5522 00 02 80 00 2c 04 c0 a8 00 02 80 00 2e 04 c0 a8 \
5523 00 01 00 00 00 00 00 00 00 04 00 18 00 00 00 00 \
5524 00 00 00 10 00 00 00 03 00 00 00 00 00 00 00 00 \
5525 "
5526 ovs-appctl time/warp 8000
5527 # Send a bundle close, it should keep the bundle alive.
5528 ovs-appctl -t ovs-ofctl ofctl/send "05 21 00 10 00 00 00 03 00 00 00 01 00 02 00 03"
5529 ovs-appctl time/warp 11000
5530 # Make sure that timeouts are processed after the expiry
5531 ovs-appctl time/warp 1000
5532 # Send a Commit, but too late.
5533 ovs-appctl -t ovs-ofctl ofctl/send "05 21 00 10 00 00 00 04 00 00 00 01 00 04 00 03"
5534 ovs-appctl -t ovs-ofctl ofctl/barrier
5535 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
5536
5537 AT_CHECK([ofctl_strip < monitor.log], [], [dnl
5538 send: OFPT_BUNDLE_CONTROL (OF1.4):
5539 bundle_id=0x1 type=OPEN_REQUEST flags=atomic ordered
5540 OFPT_BUNDLE_CONTROL (OF1.4):
5541 bundle_id=0x1 type=OPEN_REPLY flags=0
5542 send: OFPT_BUNDLE_ADD_MESSAGE (OF1.4):
5543 bundle_id=0x1 flags=atomic ordered
5544 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
5545 send: OFPT_BUNDLE_CONTROL (OF1.4):
5546 bundle_id=0x1 type=CLOSE_REQUEST flags=atomic ordered
5547 OFPT_BUNDLE_CONTROL (OF1.4):
5548 bundle_id=0x1 type=CLOSE_REPLY flags=0
5549 OFPT_ERROR (OF1.4): OFPBFC_TIMEOUT
5550 OFPT_BUNDLE_CONTROL (OF1.4):
5551 bundle_id=0x1 type=OPEN_REQUEST flags=atomic ordered
5552 send: OFPT_BUNDLE_CONTROL (OF1.4):
5553 bundle_id=0x1 type=COMMIT_REQUEST flags=atomic ordered
5554 OFPT_ERROR (OF1.4): OFPBFC_BAD_ID
5555 OFPT_BUNDLE_CONTROL (OF1.4):
5556 bundle_id=0x1 type=COMMIT_REQUEST flags=atomic ordered
5557 OFPT_BARRIER_REPLY (OF1.4):
5558 ])
5559
5560 OVS_VSWITCHD_STOP
5561 AT_CLEANUP
5562
5563 AT_SETUP([ofproto - bundle custom timeout (OpenFlow 1.4)])
5564 AT_KEYWORDS([monitor])
5565 OVS_VSWITCHD_START
5566
5567 AT_CHECK([ovs-vsctl set Open_vSwitch . other_config:bundle-idle-timeout=4])
5568
5569 # Start a monitor, use the required protocol version
5570 ovs-ofctl -O OpenFlow14 monitor br0 --detach --no-chdir --pidfile >monitor.log 2>&1
5571 AT_CAPTURE_FILE([monitor.log])
5572
5573 ovs-appctl time/stop
5574
5575 # Send an OpenFlow14 message (05), OFPT_BUNDLE_CONTROL (21), length (10), xid (01)
5576 ovs-appctl -t ovs-ofctl ofctl/send "05 21 00 10 00 00 00 01 00 00 00 01 00 00 00 03"
5577 ovs-appctl time/warp 2000
5578 # Send a bundle flow mod, it should keep the bundle alive.
5579 ovs-appctl -t ovs-ofctl ofctl/send "05 22 00 a0 00 00 00 02 00 00 00 01 00 00 00 03 \
5580 05 0e 00 90 00 00 00 02 00 00 00 00 00 00 00 00 \
5581 00 00 00 00 00 00 00 00 01 00 00 00 00 00 ff ff \
5582 ff ff ff ff ff ff ff ff ff ff ff ff 00 00 00 00 \
5583 00 01 00 42 80 00 00 04 00 00 00 01 80 00 08 06 \
5584 50 54 00 00 00 06 80 00 06 06 50 54 00 00 00 05 \
5585 80 00 0a 02 08 06 80 00 0c 02 00 00 80 00 2a 02 \
5586 00 02 80 00 2c 04 c0 a8 00 02 80 00 2e 04 c0 a8 \
5587 00 01 00 00 00 00 00 00 00 04 00 18 00 00 00 00 \
5588 00 00 00 10 00 00 00 03 00 00 00 00 00 00 00 00 \
5589 "
5590 ovs-appctl time/warp 2000
5591 # Send a bundle close, it should keep the bundle alive.
5592 ovs-appctl -t ovs-ofctl ofctl/send "05 21 00 10 00 00 00 03 00 00 00 01 00 02 00 03"
5593 ovs-appctl time/warp 4000
5594 # Make sure that timeouts are processed after the expiry, but still before the
5595 # current timeout of 4s.
5596 ovs-appctl time/warp 1000
5597 # Send a Commit, but too late.
5598 ovs-appctl -t ovs-ofctl ofctl/send "05 21 00 10 00 00 00 04 00 00 00 01 00 04 00 03"
5599 ovs-appctl -t ovs-ofctl ofctl/barrier
5600 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
5601
5602 AT_CHECK([ofctl_strip < monitor.log], [], [dnl
5603 send: OFPT_BUNDLE_CONTROL (OF1.4):
5604 bundle_id=0x1 type=OPEN_REQUEST flags=atomic ordered
5605 OFPT_BUNDLE_CONTROL (OF1.4):
5606 bundle_id=0x1 type=OPEN_REPLY flags=0
5607 send: OFPT_BUNDLE_ADD_MESSAGE (OF1.4):
5608 bundle_id=0x1 flags=atomic ordered
5609 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
5610 send: OFPT_BUNDLE_CONTROL (OF1.4):
5611 bundle_id=0x1 type=CLOSE_REQUEST flags=atomic ordered
5612 OFPT_BUNDLE_CONTROL (OF1.4):
5613 bundle_id=0x1 type=CLOSE_REPLY flags=0
5614 OFPT_ERROR (OF1.4): OFPBFC_TIMEOUT
5615 OFPT_BUNDLE_CONTROL (OF1.4):
5616 bundle_id=0x1 type=OPEN_REQUEST flags=atomic ordered
5617 send: OFPT_BUNDLE_CONTROL (OF1.4):
5618 bundle_id=0x1 type=COMMIT_REQUEST flags=atomic ordered
5619 OFPT_ERROR (OF1.4): OFPBFC_BAD_ID
5620 OFPT_BUNDLE_CONTROL (OF1.4):
5621 bundle_id=0x1 type=COMMIT_REQUEST flags=atomic ordered
5622 OFPT_BARRIER_REPLY (OF1.4):
5623 ])
5624
5625 OVS_VSWITCHD_STOP
5626 AT_CLEANUP
5627
5628 AT_SETUP([ofproto - bundle reset timeout to default (OpenFlow 1.4)])
5629 AT_KEYWORDS([monitor])
5630 OVS_VSWITCHD_START
5631
5632 AT_CHECK([ovs-vsctl set Open_vSwitch . other_config:bundle-idle-timeout=15])
5633 AT_CHECK([ovs-vsctl remove Open_vSwitch . other_config bundle-idle-timeout])
5634
5635 # Start a monitor, use the required protocol version
5636 ovs-ofctl -O OpenFlow14 monitor br0 --detach --no-chdir --pidfile >monitor.log 2>&1
5637 AT_CAPTURE_FILE([monitor.log])
5638
5639 ovs-appctl time/stop
5640
5641 # Send an OpenFlow14 message (05), OFPT_BUNDLE_CONTROL (21), length (10), xid (01)
5642 ovs-appctl -t ovs-ofctl ofctl/send "05 21 00 10 00 00 00 01 00 00 00 01 00 00 00 03"
5643 ovs-appctl time/warp 8000
5644 # Send a bundle flow mod, it should keep the bundle alive.
5645 ovs-appctl -t ovs-ofctl ofctl/send "05 22 00 a0 00 00 00 02 00 00 00 01 00 00 00 03 \
5646 05 0e 00 90 00 00 00 02 00 00 00 00 00 00 00 00 \
5647 00 00 00 00 00 00 00 00 01 00 00 00 00 00 ff ff \
5648 ff ff ff ff ff ff ff ff ff ff ff ff 00 00 00 00 \
5649 00 01 00 42 80 00 00 04 00 00 00 01 80 00 08 06 \
5650 50 54 00 00 00 06 80 00 06 06 50 54 00 00 00 05 \
5651 80 00 0a 02 08 06 80 00 0c 02 00 00 80 00 2a 02 \
5652 00 02 80 00 2c 04 c0 a8 00 02 80 00 2e 04 c0 a8 \
5653 00 01 00 00 00 00 00 00 00 04 00 18 00 00 00 00 \
5654 00 00 00 10 00 00 00 03 00 00 00 00 00 00 00 00 \
5655 "
5656 ovs-appctl time/warp 8000
5657 # Send a bundle close, it should keep the bundle alive.
5658 ovs-appctl -t ovs-ofctl ofctl/send "05 21 00 10 00 00 00 03 00 00 00 01 00 02 00 03"
5659 ovs-appctl time/warp 11000
5660 # Make sure that timeouts are processed after the expiry
5661 ovs-appctl time/warp 1000
5662 # Send a Commit, but too late.
5663 ovs-appctl -t ovs-ofctl ofctl/send "05 21 00 10 00 00 00 04 00 00 00 01 00 04 00 03"
5664 ovs-appctl -t ovs-ofctl ofctl/barrier
5665 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
5666
5667 AT_CHECK([ofctl_strip < monitor.log], [], [dnl
5668 send: OFPT_BUNDLE_CONTROL (OF1.4):
5669 bundle_id=0x1 type=OPEN_REQUEST flags=atomic ordered
5670 OFPT_BUNDLE_CONTROL (OF1.4):
5671 bundle_id=0x1 type=OPEN_REPLY flags=0
5672 send: OFPT_BUNDLE_ADD_MESSAGE (OF1.4):
5673 bundle_id=0x1 flags=atomic ordered
5674 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
5675 send: OFPT_BUNDLE_CONTROL (OF1.4):
5676 bundle_id=0x1 type=CLOSE_REQUEST flags=atomic ordered
5677 OFPT_BUNDLE_CONTROL (OF1.4):
5678 bundle_id=0x1 type=CLOSE_REPLY flags=0
5679 OFPT_ERROR (OF1.4): OFPBFC_TIMEOUT
5680 OFPT_BUNDLE_CONTROL (OF1.4):
5681 bundle_id=0x1 type=OPEN_REQUEST flags=atomic ordered
5682 send: OFPT_BUNDLE_CONTROL (OF1.4):
5683 bundle_id=0x1 type=COMMIT_REQUEST flags=atomic ordered
5684 OFPT_ERROR (OF1.4): OFPBFC_BAD_ID
5685 OFPT_BUNDLE_CONTROL (OF1.4):
5686 bundle_id=0x1 type=COMMIT_REQUEST flags=atomic ordered
5687 OFPT_BARRIER_REPLY (OF1.4):
5688 ])
5689
5690 OVS_VSWITCHD_STOP
5691 AT_CLEANUP
5692
5693 AT_SETUP([ofproto - bundle open (OpenFlow 1.3)])
5694 AT_KEYWORDS([monitor])
5695 OVS_VSWITCHD_START
5696
5697 # Start a monitor, use the required protocol version
5698 ovs-ofctl -O OpenFlow13 monitor br0 --detach --no-chdir --pidfile >monitor.log 2>&1
5699 AT_CAPTURE_FILE([monitor.log])
5700
5701 # Send an OpenFlow13 message (04), OFPT_EXPERIMENTER (04), length (0018),
5702 # xid (0000000a), ONF_EXPERIMENTER_ID (4F4E4600),
5703 # ONFT_BUNDLE_CONTROL (2300 = 0x08FC), bundle id (00000001),
5704 # message type (0000), and flags (0002)
5705 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"
5706 ovs-appctl -t ovs-ofctl ofctl/barrier
5707 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
5708
5709 AT_CHECK([ofctl_strip < monitor.log], [], [dnl
5710 send: ONFT_BUNDLE_CONTROL (OF1.3):
5711 bundle_id=0x1 type=OPEN_REQUEST flags=ordered
5712 ONFT_BUNDLE_CONTROL (OF1.3):
5713 bundle_id=0x1 type=OPEN_REPLY flags=0
5714 OFPT_BARRIER_REPLY (OF1.3):
5715 ])
5716
5717 OVS_VSWITCHD_STOP
5718 AT_CLEANUP
5719
5720 AT_SETUP([ofproto - bundle double open (OpenFlow 1.3)])
5721 AT_KEYWORDS([monitor])
5722 OVS_VSWITCHD_START
5723
5724 # Start a monitor, use the required protocol version
5725 ovs-ofctl -O OpenFlow13 monitor br0 --detach --no-chdir --pidfile >monitor.log 2>&1
5726 AT_CAPTURE_FILE([monitor.log])
5727
5728 # Send twice an OpenFlow13 message (04), OFPT_EXPERIMENTER (04), length (0018),
5729 # xid (0000000a), ONF_EXPERIMENTER_ID (4F4E4600),
5730 # ONFT_BUNDLE_CONTROL (2300 = 0x08FC), bundle id (00000001),
5731 # message type (0000), and flags (0002)
5732 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"
5733 ovs-appctl -t ovs-ofctl ofctl/barrier
5734 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"
5735 ovs-appctl -t ovs-ofctl ofctl/barrier
5736 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
5737
5738 AT_CHECK([ofctl_strip < monitor.log], [0], [dnl
5739 send: ONFT_BUNDLE_CONTROL (OF1.3):
5740 bundle_id=0x1 type=OPEN_REQUEST flags=ordered
5741 ONFT_BUNDLE_CONTROL (OF1.3):
5742 bundle_id=0x1 type=OPEN_REPLY flags=0
5743 OFPT_BARRIER_REPLY (OF1.3):
5744 send: ONFT_BUNDLE_CONTROL (OF1.3):
5745 bundle_id=0x1 type=OPEN_REQUEST flags=ordered
5746 OFPT_ERROR (OF1.3): OFPBFC_BAD_ID
5747 ONFT_BUNDLE_CONTROL (OF1.3):
5748 bundle_id=0x1 type=OPEN_REQUEST flags=ordered
5749 OFPT_BARRIER_REPLY (OF1.3):
5750 ])
5751
5752 OVS_VSWITCHD_STOP
5753 AT_CLEANUP
5754
5755 AT_SETUP([ofproto - bundle close without open (OpenFlow 1.3)])
5756 AT_KEYWORDS([monitor])
5757 OVS_VSWITCHD_START
5758
5759 # Start a monitor, use the required protocol version
5760 ovs-ofctl -O OpenFlow13 monitor br0 --detach --no-chdir --pidfile >monitor.log 2>&1
5761 AT_CAPTURE_FILE([monitor.log])
5762
5763 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"
5764 ovs-appctl -t ovs-ofctl ofctl/barrier
5765 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
5766
5767 AT_CHECK([ofctl_strip < monitor.log], [0], [dnl
5768 send: ONFT_BUNDLE_CONTROL (OF1.3):
5769 bundle_id=0x1 type=CLOSE_REQUEST flags=ordered
5770 OFPT_ERROR (OF1.3): OFPBFC_BAD_ID
5771 ONFT_BUNDLE_CONTROL (OF1.3):
5772 bundle_id=0x1 type=CLOSE_REQUEST flags=ordered
5773 OFPT_BARRIER_REPLY (OF1.3):
5774 ])
5775
5776 OVS_VSWITCHD_STOP
5777 AT_CLEANUP
5778
5779 AT_SETUP([ofproto - bundle double close (OpenFlow 1.3)])
5780 AT_KEYWORDS([monitor])
5781 OVS_VSWITCHD_START
5782
5783 # Start a monitor, use the required protocol version
5784 ovs-ofctl -O OpenFlow13 monitor br0 --detach --no-chdir --pidfile >monitor.log 2>&1
5785 AT_CAPTURE_FILE([monitor.log])
5786
5787 # Open, Close, Close
5788 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"
5789 ovs-appctl -t ovs-ofctl ofctl/barrier
5790 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"
5791 ovs-appctl -t ovs-ofctl ofctl/barrier
5792 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"
5793 ovs-appctl -t ovs-ofctl ofctl/barrier
5794 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
5795
5796 AT_CHECK([ofctl_strip < monitor.log], [0], [dnl
5797 send: ONFT_BUNDLE_CONTROL (OF1.3):
5798 bundle_id=0x1 type=OPEN_REQUEST flags=ordered
5799 ONFT_BUNDLE_CONTROL (OF1.3):
5800 bundle_id=0x1 type=OPEN_REPLY flags=0
5801 OFPT_BARRIER_REPLY (OF1.3):
5802 send: ONFT_BUNDLE_CONTROL (OF1.3):
5803 bundle_id=0x1 type=CLOSE_REQUEST flags=ordered
5804 ONFT_BUNDLE_CONTROL (OF1.3):
5805 bundle_id=0x1 type=CLOSE_REPLY flags=0
5806 OFPT_BARRIER_REPLY (OF1.3):
5807 send: ONFT_BUNDLE_CONTROL (OF1.3):
5808 bundle_id=0x1 type=CLOSE_REQUEST flags=ordered
5809 OFPT_ERROR (OF1.3): OFPBFC_BUNDLE_CLOSED
5810 ONFT_BUNDLE_CONTROL (OF1.3):
5811 bundle_id=0x1 type=CLOSE_REQUEST flags=ordered
5812 OFPT_BARRIER_REPLY (OF1.3):
5813 ])
5814
5815 OVS_VSWITCHD_STOP
5816 AT_CLEANUP
5817
5818 AT_SETUP([ofproto - bundle close, different flags (OpenFlow 1.3)])
5819 AT_KEYWORDS([monitor])
5820 OVS_VSWITCHD_START
5821
5822 # Start a monitor, use the required protocol version
5823 ovs-ofctl -O OpenFlow13 monitor br0 --detach --no-chdir --pidfile >monitor.log 2>&1
5824 AT_CAPTURE_FILE([monitor.log])
5825
5826 # Open, Close
5827 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"
5828 ovs-appctl -t ovs-ofctl ofctl/barrier
5829 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"
5830 ovs-appctl -t ovs-ofctl ofctl/barrier
5831 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
5832
5833 AT_CHECK([ofctl_strip < monitor.log], [0], [dnl
5834 send: ONFT_BUNDLE_CONTROL (OF1.3):
5835 bundle_id=0x1 type=OPEN_REQUEST flags=ordered
5836 ONFT_BUNDLE_CONTROL (OF1.3):
5837 bundle_id=0x1 type=OPEN_REPLY flags=0
5838 OFPT_BARRIER_REPLY (OF1.3):
5839 send: ONFT_BUNDLE_CONTROL (OF1.3):
5840 bundle_id=0x1 type=CLOSE_REQUEST flags=atomic
5841 OFPT_ERROR (OF1.3): OFPBFC_BAD_FLAGS
5842 ONFT_BUNDLE_CONTROL (OF1.3):
5843 bundle_id=0x1 type=CLOSE_REQUEST flags=atomic
5844 OFPT_BARRIER_REPLY (OF1.3):
5845 ])
5846
5847 OVS_VSWITCHD_STOP
5848 AT_CLEANUP
5849
5850 AT_SETUP([ofproto - bundle commit without open (OpenFlow 1.3)])
5851 AT_KEYWORDS([monitor])
5852 OVS_VSWITCHD_START
5853
5854 # Start a monitor, use the required protocol version
5855 ovs-ofctl -O OpenFlow13 monitor br0 --detach --no-chdir --pidfile >monitor.log 2>&1
5856 AT_CAPTURE_FILE([monitor.log])
5857
5858 # Commit
5859 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"
5860 ovs-appctl -t ovs-ofctl ofctl/barrier
5861 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
5862
5863 AT_CHECK([ofctl_strip < monitor.log], [0], [dnl
5864 send: ONFT_BUNDLE_CONTROL (OF1.3):
5865 bundle_id=0x1 type=COMMIT_REQUEST flags=ordered
5866 OFPT_ERROR (OF1.3): OFPBFC_BAD_ID
5867 ONFT_BUNDLE_CONTROL (OF1.3):
5868 bundle_id=0x1 type=COMMIT_REQUEST flags=ordered
5869 OFPT_BARRIER_REPLY (OF1.3):
5870 ])
5871
5872 OVS_VSWITCHD_STOP
5873 AT_CLEANUP
5874
5875 AT_SETUP([ofproto - bundle commit, different flags (OpenFlow 1.3)])
5876 AT_KEYWORDS([monitor])
5877 OVS_VSWITCHD_START
5878
5879 # Start a monitor, use the required protocol version
5880 ovs-ofctl -O OpenFlow13 monitor br0 --detach --no-chdir --pidfile >monitor.log 2>&1
5881 AT_CAPTURE_FILE([monitor.log])
5882
5883 # Open, Commit
5884 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"
5885 ovs-appctl -t ovs-ofctl ofctl/barrier
5886 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"
5887 ovs-appctl -t ovs-ofctl ofctl/barrier
5888 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
5889
5890 AT_CHECK([ofctl_strip < monitor.log], [0], [dnl
5891 send: ONFT_BUNDLE_CONTROL (OF1.3):
5892 bundle_id=0x1 type=OPEN_REQUEST flags=ordered
5893 ONFT_BUNDLE_CONTROL (OF1.3):
5894 bundle_id=0x1 type=OPEN_REPLY flags=0
5895 OFPT_BARRIER_REPLY (OF1.3):
5896 send: ONFT_BUNDLE_CONTROL (OF1.3):
5897 bundle_id=0x1 type=COMMIT_REQUEST flags=atomic
5898 OFPT_ERROR (OF1.3): OFPBFC_BAD_FLAGS
5899 ONFT_BUNDLE_CONTROL (OF1.3):
5900 bundle_id=0x1 type=COMMIT_REQUEST flags=atomic
5901 OFPT_BARRIER_REPLY (OF1.3):
5902 ])
5903
5904 OVS_VSWITCHD_STOP
5905 AT_CLEANUP
5906
5907 AT_SETUP([ofproto - bundle discard without open (OpenFlow 1.3)])
5908 AT_KEYWORDS([monitor])
5909 OVS_VSWITCHD_START
5910
5911 # Start a monitor, use the required protocol version
5912 ovs-ofctl -O OpenFlow13 monitor br0 --detach --no-chdir --pidfile >monitor.log 2>&1
5913 AT_CAPTURE_FILE([monitor.log])
5914
5915 # Discard
5916 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"
5917 ovs-appctl -t ovs-ofctl ofctl/barrier
5918 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
5919
5920 AT_CHECK([ofctl_strip < monitor.log], [0], [dnl
5921 send: ONFT_BUNDLE_CONTROL (OF1.3):
5922 bundle_id=0x1 type=DISCARD_REQUEST flags=ordered
5923 OFPT_ERROR (OF1.3): OFPBFC_BAD_ID
5924 ONFT_BUNDLE_CONTROL (OF1.3):
5925 bundle_id=0x1 type=DISCARD_REQUEST flags=ordered
5926 OFPT_BARRIER_REPLY (OF1.3):
5927 ])
5928
5929 OVS_VSWITCHD_STOP
5930 AT_CLEANUP
5931
5932
5933 AT_SETUP([ofproto - bundle with multiple flow mods (OpenFlow 1.3)])
5934 OVS_VSWITCHD_START
5935
5936 AT_CHECK([ovs-appctl vlog/set vconn:dbg])
5937
5938 AT_CHECK([ovs-ofctl --no-names del-flows br0])
5939
5940 AT_DATA([flows.txt], [dnl
5941 add idle_timeout=50 in_port=2 dl_src=00:66:77:88:99:aa actions=1
5942 add idle_timeout=60 in_port=2 dl_src=00:77:88:99:aa:bb actions=2
5943 add idle_timeout=70 in_port=2 dl_src=00:88:99:aa:bb:cc actions=3
5944 add idle_timeout=50 in_port=2 dl_src=00:66:77:88:99:aa actions=4
5945 delete
5946 add idle_timeout=50 in_port=2 dl_src=00:66:77:88:99:aa actions=5
5947 add idle_timeout=60 in_port=2 dl_src=00:77:88:99:aa:bb actions=6
5948 add idle_timeout=70 in_port=2 dl_src=00:88:99:aa:bb:cc actions=7
5949 delete in_port=2 dl_src=00:88:99:aa:bb:cc
5950 ])
5951
5952 AT_CHECK([ovs-ofctl -O OpenFlow13 --no-names --bundle add-flows br0 flows.txt])
5953
5954 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
5955 idle_timeout=50, in_port=2,dl_src=00:66:77:88:99:aa actions=output:5
5956 idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=output:6
5957 NXST_FLOW reply:
5958 ])
5959
5960 AT_DATA([flows.txt], [dnl
5961 modify actions=drop
5962 modify_strict in_port=2 dl_src=00:77:88:99:aa:bb actions=7
5963 ])
5964
5965 AT_CHECK([ovs-ofctl -O OpenFlow13 --no-names --bundle add-flows br0 flows.txt])
5966
5967 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
5968 idle_timeout=50, in_port=2,dl_src=00:66:77:88:99:aa actions=drop
5969 idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=output:7
5970 NXST_FLOW reply:
5971 ])
5972
5973 # Adding an existing flow acts as a modify, and delete_strict also works.
5974 AT_DATA([flows.txt], [dnl
5975 add idle_timeout=60 in_port=2 dl_src=00:77:88:99:aa:bb actions=8
5976 delete_strict in_port=2 dl_src=00:66:77:88:99:aa
5977 add in_port=2 dl_src=00:66:77:88:99:aa actions=drop
5978 ])
5979
5980 AT_CHECK([ovs-ofctl -O OpenFlow13 --bundle --no-names add-flows br0 flows.txt])
5981
5982 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
5983 idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=output:8
5984 in_port=2,dl_src=00:66:77:88:99:aa actions=drop
5985 NXST_FLOW reply:
5986 ])
5987
5988 dnl Check logs for OpenFlow trace
5989 # Prevent race.
5990 OVS_WAIT_UNTIL([vconn_sub < ovs-vswitchd.log | test `grep -- "|vconn|DBG|unix: sent (Success): NXST_FLOW reply" | wc -l` -ge 3])
5991 AT_CHECK([print_vconn_debug | vconn_sub | ofctl_strip], [0], [dnl
5992 vconn|DBG|unix: sent (Success): OFPT_HELLO (OF1.5):
5993 version bitmap: 0x01, 0x02, 0x03, 0x04, 0x05, 0x06
5994 vconn|DBG|unix: received: OFPT_HELLO:
5995 version bitmap: 0x01
5996 vconn|DBG|unix: negotiated OpenFlow version 0x01 (we support version 0x06 and earlier, peer supports version 0x01)
5997 vconn|DBG|unix: received: OFPT_FLOW_MOD: DEL actions=drop
5998 vconn|DBG|unix: received: OFPT_BARRIER_REQUEST:
5999 vconn|DBG|unix: sent (Success): OFPT_BARRIER_REPLY:
6000 vconn|DBG|unix: sent (Success): OFPT_HELLO (OF1.5):
6001 version bitmap: 0x01, 0x02, 0x03, 0x04, 0x05, 0x06
6002 vconn|DBG|unix: received: OFPT_HELLO (OF1.3):
6003 version bitmap: 0x04
6004 vconn|DBG|unix: negotiated OpenFlow version 0x04 (we support version 0x06 and earlier, peer supports version 0x04)
6005 vconn|DBG|unix: received: ONFT_BUNDLE_CONTROL (OF1.3):
6006 bundle_id=0 type=OPEN_REQUEST flags=atomic ordered
6007 vconn|DBG|unix: sent (Success): ONFT_BUNDLE_CONTROL (OF1.3):
6008 bundle_id=0 type=OPEN_REPLY flags=0
6009 vconn|DBG|unix: received: ONFT_BUNDLE_ADD_MESSAGE (OF1.3):
6010 bundle_id=0 flags=atomic ordered
6011 OFPT_FLOW_MOD (OF1.3): ADD in_port=2,dl_src=00:66:77:88:99:aa idle:50 actions=output:1
6012 vconn|DBG|unix: received: ONFT_BUNDLE_ADD_MESSAGE (OF1.3):
6013 bundle_id=0 flags=atomic ordered
6014 OFPT_FLOW_MOD (OF1.3): ADD in_port=2,dl_src=00:77:88:99:aa:bb idle:60 actions=output:2
6015 vconn|DBG|unix: received: ONFT_BUNDLE_ADD_MESSAGE (OF1.3):
6016 bundle_id=0 flags=atomic ordered
6017 OFPT_FLOW_MOD (OF1.3): ADD in_port=2,dl_src=00:88:99:aa:bb:cc idle:70 actions=output:3
6018 vconn|DBG|unix: received: ONFT_BUNDLE_ADD_MESSAGE (OF1.3):
6019 bundle_id=0 flags=atomic ordered
6020 OFPT_FLOW_MOD (OF1.3): ADD in_port=2,dl_src=00:66:77:88:99:aa idle:50 actions=output:4
6021 vconn|DBG|unix: received: ONFT_BUNDLE_ADD_MESSAGE (OF1.3):
6022 bundle_id=0 flags=atomic ordered
6023 OFPT_FLOW_MOD (OF1.3): DEL table:255 actions=drop
6024 vconn|DBG|unix: received: ONFT_BUNDLE_ADD_MESSAGE (OF1.3):
6025 bundle_id=0 flags=atomic ordered
6026 OFPT_FLOW_MOD (OF1.3): ADD in_port=2,dl_src=00:66:77:88:99:aa idle:50 actions=output:5
6027 vconn|DBG|unix: received: ONFT_BUNDLE_ADD_MESSAGE (OF1.3):
6028 bundle_id=0 flags=atomic ordered
6029 OFPT_FLOW_MOD (OF1.3): ADD in_port=2,dl_src=00:77:88:99:aa:bb idle:60 actions=output:6
6030 vconn|DBG|unix: received: ONFT_BUNDLE_ADD_MESSAGE (OF1.3):
6031 bundle_id=0 flags=atomic ordered
6032 OFPT_FLOW_MOD (OF1.3): ADD in_port=2,dl_src=00:88:99:aa:bb:cc idle:70 actions=output:7
6033 vconn|DBG|unix: received: ONFT_BUNDLE_ADD_MESSAGE (OF1.3):
6034 bundle_id=0 flags=atomic ordered
6035 OFPT_FLOW_MOD (OF1.3): DEL table:255 in_port=2,dl_src=00:88:99:aa:bb:cc actions=drop
6036 vconn|DBG|unix: received: OFPT_BARRIER_REQUEST (OF1.3):
6037 vconn|DBG|unix: sent (Success): OFPT_BARRIER_REPLY (OF1.3):
6038 vconn|DBG|unix: received: ONFT_BUNDLE_CONTROL (OF1.3):
6039 bundle_id=0 type=COMMIT_REQUEST flags=atomic ordered
6040 vconn|DBG|unix: sent (Success): ONFT_BUNDLE_CONTROL (OF1.3):
6041 bundle_id=0 type=COMMIT_REPLY flags=0
6042 vconn|DBG|unix: sent (Success): OFPT_HELLO (OF1.5):
6043 version bitmap: 0x01, 0x02, 0x03, 0x04, 0x05, 0x06
6044 vconn|DBG|unix: received: OFPT_HELLO:
6045 version bitmap: 0x01
6046 vconn|DBG|unix: negotiated OpenFlow version 0x01 (we support version 0x06 and earlier, peer supports version 0x01)
6047 vconn|DBG|unix: received: NXT_SET_FLOW_FORMAT: format=nxm
6048 vconn|DBG|unix: received: OFPT_BARRIER_REQUEST:
6049 vconn|DBG|unix: sent (Success): OFPT_BARRIER_REPLY:
6050 vconn|DBG|unix: received: NXST_FLOW request:
6051 vconn|DBG|unix: sent (Success): NXST_FLOW reply:
6052 idle_timeout=50, in_port=2,dl_src=00:66:77:88:99:aa actions=output:5
6053 idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=output:6
6054 vconn|DBG|unix: sent (Success): OFPT_HELLO (OF1.5):
6055 version bitmap: 0x01, 0x02, 0x03, 0x04, 0x05, 0x06
6056 vconn|DBG|unix: received: OFPT_HELLO (OF1.3):
6057 version bitmap: 0x04
6058 vconn|DBG|unix: negotiated OpenFlow version 0x04 (we support version 0x06 and earlier, peer supports version 0x04)
6059 vconn|DBG|unix: received: ONFT_BUNDLE_CONTROL (OF1.3):
6060 bundle_id=0 type=OPEN_REQUEST flags=atomic ordered
6061 vconn|DBG|unix: sent (Success): ONFT_BUNDLE_CONTROL (OF1.3):
6062 bundle_id=0 type=OPEN_REPLY flags=0
6063 vconn|DBG|unix: received: ONFT_BUNDLE_ADD_MESSAGE (OF1.3):
6064 bundle_id=0 flags=atomic ordered
6065 OFPT_FLOW_MOD (OF1.3): MOD actions=drop
6066 vconn|DBG|unix: received: ONFT_BUNDLE_ADD_MESSAGE (OF1.3):
6067 bundle_id=0 flags=atomic ordered
6068 OFPT_FLOW_MOD (OF1.3): MOD_STRICT in_port=2,dl_src=00:77:88:99:aa:bb actions=output:7
6069 vconn|DBG|unix: received: OFPT_BARRIER_REQUEST (OF1.3):
6070 vconn|DBG|unix: sent (Success): OFPT_BARRIER_REPLY (OF1.3):
6071 vconn|DBG|unix: received: ONFT_BUNDLE_CONTROL (OF1.3):
6072 bundle_id=0 type=COMMIT_REQUEST flags=atomic ordered
6073 vconn|DBG|unix: sent (Success): ONFT_BUNDLE_CONTROL (OF1.3):
6074 bundle_id=0 type=COMMIT_REPLY flags=0
6075 vconn|DBG|unix: sent (Success): OFPT_HELLO (OF1.5):
6076 version bitmap: 0x01, 0x02, 0x03, 0x04, 0x05, 0x06
6077 vconn|DBG|unix: received: OFPT_HELLO:
6078 version bitmap: 0x01
6079 vconn|DBG|unix: negotiated OpenFlow version 0x01 (we support version 0x06 and earlier, peer supports version 0x01)
6080 vconn|DBG|unix: received: NXT_SET_FLOW_FORMAT: format=nxm
6081 vconn|DBG|unix: received: OFPT_BARRIER_REQUEST:
6082 vconn|DBG|unix: sent (Success): OFPT_BARRIER_REPLY:
6083 vconn|DBG|unix: received: NXST_FLOW request:
6084 vconn|DBG|unix: sent (Success): NXST_FLOW reply:
6085 idle_timeout=50, in_port=2,dl_src=00:66:77:88:99:aa actions=drop
6086 idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=output:7
6087 vconn|DBG|unix: sent (Success): OFPT_HELLO (OF1.5):
6088 version bitmap: 0x01, 0x02, 0x03, 0x04, 0x05, 0x06
6089 vconn|DBG|unix: received: OFPT_HELLO (OF1.3):
6090 version bitmap: 0x04
6091 vconn|DBG|unix: negotiated OpenFlow version 0x04 (we support version 0x06 and earlier, peer supports version 0x04)
6092 vconn|DBG|unix: received: ONFT_BUNDLE_CONTROL (OF1.3):
6093 bundle_id=0 type=OPEN_REQUEST flags=atomic ordered
6094 vconn|DBG|unix: sent (Success): ONFT_BUNDLE_CONTROL (OF1.3):
6095 bundle_id=0 type=OPEN_REPLY flags=0
6096 vconn|DBG|unix: received: ONFT_BUNDLE_ADD_MESSAGE (OF1.3):
6097 bundle_id=0 flags=atomic ordered
6098 OFPT_FLOW_MOD (OF1.3): ADD in_port=2,dl_src=00:77:88:99:aa:bb idle:60 actions=output:8
6099 vconn|DBG|unix: received: ONFT_BUNDLE_ADD_MESSAGE (OF1.3):
6100 bundle_id=0 flags=atomic ordered
6101 OFPT_FLOW_MOD (OF1.3): DEL_STRICT table:255 in_port=2,dl_src=00:66:77:88:99:aa actions=drop
6102 vconn|DBG|unix: received: ONFT_BUNDLE_ADD_MESSAGE (OF1.3):
6103 bundle_id=0 flags=atomic ordered
6104 OFPT_FLOW_MOD (OF1.3): ADD in_port=2,dl_src=00:66:77:88:99:aa actions=drop
6105 vconn|DBG|unix: received: OFPT_BARRIER_REQUEST (OF1.3):
6106 vconn|DBG|unix: sent (Success): OFPT_BARRIER_REPLY (OF1.3):
6107 vconn|DBG|unix: received: ONFT_BUNDLE_CONTROL (OF1.3):
6108 bundle_id=0 type=COMMIT_REQUEST flags=atomic ordered
6109 vconn|DBG|unix: sent (Success): ONFT_BUNDLE_CONTROL (OF1.3):
6110 bundle_id=0 type=COMMIT_REPLY flags=0
6111 vconn|DBG|unix: sent (Success): OFPT_HELLO (OF1.5):
6112 version bitmap: 0x01, 0x02, 0x03, 0x04, 0x05, 0x06
6113 vconn|DBG|unix: received: OFPT_HELLO:
6114 version bitmap: 0x01
6115 vconn|DBG|unix: negotiated OpenFlow version 0x01 (we support version 0x06 and earlier, peer supports version 0x01)
6116 vconn|DBG|unix: received: NXT_SET_FLOW_FORMAT: format=nxm
6117 vconn|DBG|unix: received: OFPT_BARRIER_REQUEST:
6118 vconn|DBG|unix: sent (Success): OFPT_BARRIER_REPLY:
6119 vconn|DBG|unix: received: NXST_FLOW request:
6120 vconn|DBG|unix: sent (Success): NXST_FLOW reply:
6121 idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=output:8
6122 in_port=2,dl_src=00:66:77:88:99:aa actions=drop
6123 ])
6124
6125 OVS_VSWITCHD_STOP
6126 AT_CLEANUP
6127
6128
6129 AT_SETUP([ofproto - failing bundle add message (OpenFlow 1.3)])
6130 OVS_VSWITCHD_START
6131
6132 AT_CHECK([ovs-ofctl del-flows br0])
6133
6134 ovs-ofctl add-flows br0 - <<EOF
6135 idle_timeout=50 in_port=2 dl_src=00:66:77:88:99:aa actions=11
6136 idle_timeout=60 in_port=2 dl_src=00:77:88:99:aa:bb actions=22
6137 idle_timeout=70 in_port=2 dl_src=00:88:99:aa:bb:cc actions=33
6138 EOF
6139 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
6140 idle_timeout=50, in_port=2,dl_src=00:66:77:88:99:aa actions=output:11
6141 idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=output:22
6142 idle_timeout=70, in_port=2,dl_src=00:88:99:aa:bb:cc actions=output:33
6143 NXST_FLOW reply:
6144 ])
6145
6146 # last line uses illegal table number (OVS internal table)
6147 AT_DATA([flows.txt], [dnl
6148 add idle_timeout=50 in_port=2 dl_src=00:66:77:88:99:aa actions=1
6149 add idle_timeout=60 in_port=2 dl_src=00:77:88:99:aa:bb actions=2
6150 add idle_timeout=70 in_port=2 dl_src=00:88:99:aa:bb:cc actions=3
6151 modify idle_timeout=50 in_port=2 dl_src=00:66:77:88:99:aa actions=4
6152 delete
6153 add idle_timeout=50 in_port=2 dl_src=00:66:77:88:99:aa actions=5
6154 add idle_timeout=60 in_port=2 dl_src=00:77:88:99:aa:bb actions=6
6155 add idle_timeout=70 in_port=2 dl_src=00:88:99:aa:bb:cc actions=7
6156 delete in_port=2 dl_src=00:88:99:aa:bb:cc
6157 add table=254 actions=drop
6158 ])
6159
6160 AT_CHECK([ovs-ofctl -O OpenFlow13 --bundle add-flows br0 flows.txt 2>&1 | sed '/talking to/,$d' | strip_xids],
6161 [0], [dnl
6162 Error OFPBRC_EPERM for: OFPT_FLOW_MOD (OF1.3): ADD table:254 actions=drop
6163 ])
6164
6165 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
6166 idle_timeout=50, in_port=2,dl_src=00:66:77:88:99:aa actions=output:11
6167 idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=output:22
6168 idle_timeout=70, in_port=2,dl_src=00:88:99:aa:bb:cc actions=output:33
6169 NXST_FLOW reply:
6170 ])
6171
6172 OVS_VSWITCHD_STOP
6173 AT_CLEANUP
6174
6175
6176 AT_SETUP([ofproto - failing bundle commit (OpenFlow 1.3)])
6177 OVS_VSWITCHD_START
6178
6179 AT_CHECK([ovs-ofctl del-flows br0])
6180
6181 # Invalid group numbers are detected at commit time
6182 AT_DATA([flows.txt], [dnl
6183 add idle_timeout=50 in_port=2 dl_src=00:66:77:88:99:aa actions=group:1
6184 add idle_timeout=60 in_port=2 dl_src=00:77:88:99:aa:bb actions=group:2
6185 add idle_timeout=70 in_port=2 dl_src=00:88:99:aa:bb:cc actions=group:3
6186 ])
6187
6188 AT_CHECK([ovs-ofctl -O OpenFlow13 --bundle add-flows br0 flows.txt 2>&1 | sed '/talking to/,$d' | strip_xids],
6189 [0], [dnl
6190 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
6191 Error OFPBFC_MSG_FAILED for: ONFT_BUNDLE_CONTROL (OF1.3):
6192 bundle_id=0 type=COMMIT_REQUEST flags=atomic ordered
6193 ])
6194
6195 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
6196 NXST_FLOW reply:
6197 ])
6198
6199 OVS_VSWITCHD_STOP
6200 AT_CLEANUP
6201
6202 AT_SETUP([ofproto - monitor flows with tun_md])
6203 OVS_VSWITCHD_START
6204
6205 AT_CHECK([ovs-ofctl add-tlv-map br0 "{class=0xffff,type=0,len=4}->tun_metadata0"])
6206 AT_CHECK([ovs-ofctl add-flow br0 tun_metadata0=0x1,actions=drop])
6207
6208 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip], [0], [dnl
6209 NXST_FLOW reply:
6210 tun_metadata0=0x1 actions=drop
6211 ])
6212
6213 AT_CAPTURE_FILE([ofctl_monitor.log])
6214 dnl Usually ovs-ofctl monitor outputs on stderr, but the first message here
6215 dnl is put on stdout, because it is handled by ofctl in dump_transaction()
6216 dnl and not in monitor_vconn().
6217 AT_CHECK([ovs-ofctl monitor br0 65534 watch: --detach --no-chdir --pidfile >ofctl_monitor.log 2>&1])
6218
6219 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 2])
6220
6221 AT_CHECK([cat ofctl_monitor.log | ofctl_strip], [0], [dnl
6222 NXST_FLOW_MONITOR reply:
6223 event=ADDED table=0 cookie=0 tun_metadata0=0x1
6224 ])
6225
6226 AT_CHECK([ovs-ofctl del-flows br0])
6227
6228 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 4])
6229
6230 AT_CHECK([cat ofctl_monitor.log | ofctl_strip], [0], [dnl
6231 NXST_FLOW_MONITOR reply:
6232 event=ADDED table=0 cookie=0 tun_metadata0=0x1
6233 NXST_FLOW_MONITOR reply:
6234 event=DELETED reason=delete table=0 cookie=0 tun_metadata0=0x1
6235 ])
6236
6237 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
6238
6239 dnl Check that vswitchd hasn't crashed
6240 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip], [0], [dnl
6241 NXST_FLOW reply:
6242 ])
6243
6244 OVS_VSWITCHD_STOP
6245 AT_CLEANUP
6246
6247 AT_SETUP([ofproto - flow mod with tunnel metadata])
6248 AT_KEYWORDS([ofp-actions])
6249 OVS_VSWITCHD_START
6250
6251 AT_CHECK([ovs-ofctl add-tlv-map br0 "{class=0xffff,type=0,len=4}->tun_metadata0"])
6252 AT_CHECK([ovs-ofctl add-flow br0 "in_port=1 actions=move:tun_metadata0[[0..31]]->NXM_NX_REG0[[]]"])
6253
6254 dnl Check the length of tun_metadata0 in the replied OXM header.
6255 dnl Ignore the first 0x50 bytes of hex dump from the reply msg since the NXM
6256 dnl header that describes the tunnel metadata starts at offset 0x50.
6257 AT_CHECK([ovs-ofctl dump-flows br0 -mmmm], [0], [stdout])
6258 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
6259 NXST_FLOW reply:
6260 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[[]]
6261 00000050 ff ff 00 18 00 00 23 20-00 06 00 20 00 00 00 00 |......# ... ....|
6262 00000060 00 01 50 04 00 01 00 04- |..P..... |
6263 ])
6264
6265 dnl Check actions that may use tun_metadata
6266 AT_CHECK([ovs-ofctl add-flow br0 "in_port=2 actions=move:tun_metadata1[[0..31]]->NXM_NX_REG0[[]]"], [1], [], [stderr])
6267 AT_CHECK([strip_xids < stderr | sed '/FLOW_MOD/,$d'], [0], [dnl
6268 OFPT_ERROR: NXFMFC_INVALID_TLV_FIELD
6269 ])
6270
6271 AT_CHECK([ovs-ofctl add-flow br0 "in_port=2 actions=move:tun_metadata0[[32..63]]->NXM_NX_REG0[[]]"], [1], [], [stderr])
6272 AT_CHECK([strip_xids < stderr | sed '/FLOW_MOD/,$d'], [0], [dnl
6273 OFPT_ERROR: OFPBAC_BAD_SET_LEN
6274 ])
6275
6276 AT_CHECK([ovs-ofctl add-flow br0 "in_port=2 actions=push:tun_metadata1[[0..31]]"], [1], [], [stderr])
6277 AT_CHECK([strip_xids < stderr | sed '/FLOW_MOD/,$d'], [0], [dnl
6278 OFPT_ERROR: NXFMFC_INVALID_TLV_FIELD
6279 ])
6280
6281 AT_CHECK([ovs-ofctl add-flow br0 "in_port=2 actions=pop:tun_metadata0[[32..63]]"], [1], [], [stderr])
6282 AT_CHECK([strip_xids < stderr | sed '/FLOW_MOD/,$d'], [0], [dnl
6283 OFPT_ERROR: OFPBAC_BAD_SET_LEN
6284 ])
6285
6286 AT_CHECK([ovs-ofctl add-flow br0 "in_port=3, actions=load:0x11223344->tun_metadata1"], [1], [], [stderr])
6287 AT_CHECK([strip_xids < stderr | sed '/FLOW_MOD/,$d'], [0], [dnl
6288 OFPT_ERROR: NXFMFC_INVALID_TLV_FIELD
6289 ])
6290
6291 AT_CHECK([ovs-ofctl add-flow br0 "in_port=2 actions=output:tun_metadata1[[0..31]]"], [1], [], [stderr])
6292 AT_CHECK([strip_xids < stderr | sed '/FLOW_MOD/,$d'], [0], [dnl
6293 OFPT_ERROR: NXFMFC_INVALID_TLV_FIELD
6294 ])
6295
6296 AT_CHECK([ovs-ofctl add-flow br0 "in_port=2 actions=output:tun_metadata0[[32..63]]"], [1], [], [stderr])
6297 AT_CHECK([strip_xids < stderr | sed '/FLOW_MOD/,$d'], [0], [dnl
6298 OFPT_ERROR: OFPBAC_BAD_SET_LEN
6299 ])
6300
6301 AT_CHECK([ovs-ofctl add-flow br0 "in_port=2 actions=multipath(eth_src,50,modulo_n,1,0,tun_metadata1[[0..31]])"], [1], [], [stderr])
6302 AT_CHECK([strip_xids < stderr | sed '/FLOW_MOD/,$d'], [0], [dnl
6303 OFPT_ERROR: NXFMFC_INVALID_TLV_FIELD
6304 ])
6305
6306 AT_CHECK([ovs-ofctl add-flow br0 "in_port=2 actions=multipath(eth_src,50,modulo_n,1,0,tun_metadata0[[32..63]])"], [1], [], [stderr])
6307 AT_CHECK([strip_xids < stderr | sed '/FLOW_MOD/,$d'], [0], [dnl
6308 OFPT_ERROR: OFPBAC_BAD_SET_LEN
6309 ])
6310
6311 AT_CHECK([ovs-ofctl add-flow br0 "in_port=2 actions=bundle_load(eth_src,50,hrw,ofport,tun_metadata1[[0..31]], slaves:4,8)"], [1], [], [stderr])
6312 AT_CHECK([strip_xids < stderr | sed '/FLOW_MOD/,$d'], [0], [dnl
6313 OFPT_ERROR: NXFMFC_INVALID_TLV_FIELD
6314 ])
6315
6316 AT_CHECK([ovs-ofctl add-flow br0 "in_port=2 actions=bundle_load(eth_src,50,hrw,ofport,tun_metadata0[[32..63]], slaves:4,8)"], [1], [], [stderr])
6317 AT_CHECK([strip_xids < stderr | sed '/FLOW_MOD/,$d'], [0], [dnl
6318 OFPT_ERROR: OFPBAC_BAD_SET_LEN
6319 ])
6320
6321 AT_CHECK([ovs-ofctl add-flow br0 "in_port=2 actions=learn(tun_metadata1[[0..31]]=reg0[[0..31]])"], [1], [], [stderr])
6322 AT_CHECK([strip_xids < stderr | sed '/FLOW_MOD/,$d'], [0], [dnl
6323 OFPT_ERROR: NXFMFC_INVALID_TLV_FIELD
6324 ])
6325
6326 AT_CHECK([ovs-ofctl add-flow br0 "in_port=2 actions=learn(tun_metadata0[[32..63]]=reg0[[0..31]])"], [1], [], [stderr])
6327 AT_CHECK([strip_xids < stderr | sed '/FLOW_MOD/,$d'], [0], [dnl
6328 OFPT_ERROR: OFPBAC_BAD_SET_LEN
6329 ])
6330
6331 AT_CHECK([ovs-ofctl add-flow br0 "in_port=2 actions=clone(move:tun_metadata1[[0..31]]->reg0[[0..31]])"], [1], [], [stderr])
6332 AT_CHECK([strip_xids < stderr | sed '/FLOW_MOD/,$d'], [0], [dnl
6333 OFPT_ERROR: NXFMFC_INVALID_TLV_FIELD
6334 ])
6335
6336 AT_CHECK([ovs-ofctl add-flow br0 "in_port=2 actions=clone(move:tun_metadata0[[32..63]]->reg0[[0..31]])"], [1], [], [stderr])
6337 AT_CHECK([strip_xids < stderr | sed '/FLOW_MOD/,$d'], [0], [dnl
6338 OFPT_ERROR: OFPBAC_BAD_SET_LEN
6339 ])
6340
6341 AT_CHECK([ovs-ofctl add-flow br0 "ip actions=ct(commit,zone=tun_metadata1[[0..15]],exec(set_field:0x01->ct_mark))"], [1], [], [stderr])
6342 AT_CHECK([strip_xids < stderr | sed '/FLOW_MOD/,$d'], [0], [dnl
6343 OFPT_ERROR: NXFMFC_INVALID_TLV_FIELD
6344 ])
6345
6346 AT_CHECK([ovs-ofctl add-flow br0 "ip actions=ct(commit,zone=tun_metadata0[[32..47]],exec(set_field:0x01->ct_mark))"], [1], [], [stderr])
6347 AT_CHECK([strip_xids < stderr | sed '/FLOW_MOD/,$d'], [0], [dnl
6348 OFPT_ERROR: OFPBAC_BAD_SET_LEN
6349 ])
6350
6351 AT_CHECK([ovs-ofctl add-flow br0 "ip actions=ct(commit,zone=1,exec(move:tun_metadata1[[0..31]]->ct_mark))"], [1], [], [stderr])
6352 AT_CHECK([strip_xids < stderr | sed '/FLOW_MOD/,$d'], [0], [dnl
6353 OFPT_ERROR: NXFMFC_INVALID_TLV_FIELD
6354 ])
6355
6356 AT_CHECK([ovs-ofctl add-flow br0 "ip actions=ct(commit,zone=1,exec(move:tun_metadata0[[32..63]]->ct_mark))"], [1], [], [stderr])
6357 AT_CHECK([strip_xids < stderr | sed '/FLOW_MOD/,$d'], [0], [dnl
6358 OFPT_ERROR: OFPBAC_BAD_SET_LEN
6359 ])
6360
6361 dnl Check match field with tun_metadata
6362 AT_CHECK([ovs-ofctl add-flow br0 "tun_metadata0=0x11223344 actions=output:2"], [0], [], [stderr])
6363 AT_CHECK([ovs-ofctl add-flow br0 "tun_metadata1=0x11223344 actions=output:2"], [1], [], [stderr])
6364 AT_CHECK([strip_xids < stderr | sed '/FLOW_MOD/,$d'], [0], [dnl
6365 OFPT_ERROR: NXFMFC_INVALID_TLV_FIELD
6366 ])
6367
6368 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip], [0], [dnl)
6369 NXST_FLOW reply:
6370 in_port=1 actions=move:NXM_NX_TUN_METADATA0[[0..31]]->NXM_NX_REG0[[]]
6371 tun_metadata0=0x11223344 actions=output:2
6372 ])
6373
6374 OVS_VSWITCHD_STOP(["/NXFMFC_INVALID_TLV_FIELD/d
6375 /tun_metadata0/d
6376 /OFPBAC_BAD_SET_LEN/d"])
6377 AT_CLEANUP
6378
6379 AT_SETUP([ofproto - flush flows, groups, and meters for controller change])
6380 AT_KEYWORDS([flow flows group group meter])
6381 OVS_VSWITCHD_START
6382
6383 add_flow_group_and_meter () {
6384 AT_CHECK([ovs-ofctl add-flow br0 in_port=1,actions=2])
6385 AT_CHECK([ovs-ofctl -O OpenFlow11 add-group br0 group_id=1234,type=all,bucket=output:10
6386 AT_CHECK([ovs-ofctl -O OpenFlow13 add-meter br0 'meter=1 pktps burst stats bands=type=drop rate=1 burst_size=1'])
6387 ])
6388 }
6389
6390 verify_added () {
6391 AT_CHECK([ovs-ofctl --no-stats dump-flows br0], [0], [dnl
6392 in_port=1 actions=output:2
6393 ])
6394 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-groups br0], [0], [dnl
6395 OFPST_GROUP_DESC reply (OF1.1) (xid=0x2):
6396 group_id=1234,type=all,bucket=actions=output:10
6397 ])
6398 AT_CHECK([ovs-ofctl -O OpenFlow13 dump-meters br0], [0], [dnl
6399 OFPST_METER_CONFIG reply (OF1.3) (xid=0x2):
6400 meter=1 pktps burst stats bands=
6401 type=drop rate=1 burst_size=1
6402 ])
6403 }
6404
6405 verify_deleted () {
6406 AT_CHECK([ovs-ofctl --no-stats dump-flows br0])
6407 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-groups br0], [0], [dnl
6408 OFPST_GROUP_DESC reply (OF1.1) (xid=0x2):
6409 ])
6410 AT_CHECK([ovs-ofctl -O OpenFlow13 dump-meters br0], [0], [dnl
6411 OFPST_METER_CONFIG reply (OF1.3) (xid=0x2):
6412 ])
6413 }
6414
6415 # Add flow, group, meter and check that they're there, without a controller.
6416 add_flow_group_and_meter
6417 verify_added
6418
6419 # Set up a controller and verify that the flow and group were deleted,
6420 # then add them back.
6421 AT_CHECK([ovs-vsctl set-controller br0 'tcp:<invalid>:6653'])
6422 verify_deleted
6423 add_flow_group_and_meter
6424 verify_added
6425
6426 # Change the controller and verify that the flow and group are still there.
6427 AT_CHECK([ovs-vsctl set-controller br0 'tcp:<invalid2>:6653'])
6428 verify_added
6429
6430 # Clear the controller and verify that the flow and group were deleted.
6431 AT_CHECK([ovs-vsctl del-controller br0])
6432 verify_deleted
6433
6434 OVS_VSWITCHD_STOP(["/<invalid/d"])
6435 AT_CLEANUP