datapath: remove flex_array
[cascardo/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 OVS_VSWITCHD_START
11
12 # Start a monitor running OpenFlow 1.0, then send the switch an OF1.1 features
13 # request
14 AT_CHECK([ovs-ofctl -P standard monitor br0 --detach --no-chdir --pidfile])
15 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
16 AT_CAPTURE_FILE([monitor.log])
17 ovs-appctl -t ovs-ofctl ofctl/send 0205000801234567
18 ovs-appctl -t ovs-ofctl ofctl/barrier
19 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
20
21 AT_CHECK([sed 's/ (xid=0x[[0-9a-fA-F]]*)//
22 /ECHO/d' monitor.log], [0], [dnl
23 send: OFPT_FEATURES_REQUEST (OF1.1):
24 OFPT_ERROR (OF1.1): OFPBRC_BAD_VERSION
25 OFPT_FEATURES_REQUEST (OF1.1):
26 OFPT_BARRIER_REPLY:
27 ])
28
29 OVS_VSWITCHD_STOP(["/received OpenFlow version 0x02 != expected 01/d"])
30 AT_CLEANUP
31
32 AT_SETUP([ofproto - feature request, config request])
33 OVS_VSWITCHD_START
34 AT_CHECK([ovs-ofctl -vwarn show br0], [0], [stdout])
35 AT_CHECK([strip_xids < stdout], [0], [dnl
36 OFPT_FEATURES_REPLY: dpid:fedcba9876543210
37 n_tables:254, n_buffers:256
38 capabilities: FLOW_STATS TABLE_STATS PORT_STATS QUEUE_STATS ARP_MATCH_IP
39 actions: output enqueue set_vlan_vid set_vlan_pcp strip_vlan mod_dl_src mod_dl_dst mod_nw_src mod_nw_dst mod_nw_tos mod_tp_src mod_tp_dst
40  LOCAL(br0): addr:aa:55:aa:55:00:00
41      config:     PORT_DOWN
42      state:      LINK_DOWN
43      speed: 0 Mbps now, 0 Mbps max
44 OFPT_GET_CONFIG_REPLY: frags=normal miss_send_len=0
45 ])
46 OVS_VSWITCHD_STOP
47 AT_CLEANUP
48
49 AT_SETUP([ofproto - set OpenFlow port number])
50 OVS_VSWITCHD_START(
51        [add-port br0 p1 -- set Interface p1 type=dummy --\
52         add-port br0 p2 -- set Interface p2 type=dummy ofport_request=99])
53 AT_CHECK([ovs-ofctl -vwarn show br0], [0], [stdout])
54 AT_CHECK([[sed '
55 s/ (xid=0x[0-9a-fA-F]*)//
56 s/00:0.$/00:0x/' < stdout]],
57       [0], [dnl
58 OFPT_FEATURES_REPLY: dpid:fedcba9876543210
59 n_tables:254, n_buffers:256
60 capabilities: FLOW_STATS TABLE_STATS PORT_STATS QUEUE_STATS ARP_MATCH_IP
61 actions: output enqueue set_vlan_vid set_vlan_pcp strip_vlan mod_dl_src mod_dl_dst mod_nw_src mod_nw_dst mod_nw_tos mod_tp_src mod_tp_dst
62  1(p1): addr:aa:55:aa:55:00:0x
63      config:     PORT_DOWN
64      state:      LINK_DOWN
65      speed: 0 Mbps now, 0 Mbps max
66  99(p2): addr:aa:55:aa:55:00:0x
67      config:     PORT_DOWN
68      state:      LINK_DOWN
69      speed: 0 Mbps now, 0 Mbps max
70  LOCAL(br0): addr:aa:55:aa:55:00:0x
71      config:     PORT_DOWN
72      state:      LINK_DOWN
73      speed: 0 Mbps now, 0 Mbps max
74 OFPT_GET_CONFIG_REPLY: frags=normal miss_send_len=0
75 ])
76
77 OVS_VSWITCHD_STOP
78 AT_CLEANUP
79
80 dnl This is really bare-bones.
81 dnl It at least checks request and reply serialization and deserialization.
82 AT_SETUP([ofproto - port stats - (OpenFlow 1.0)])
83 OVS_VSWITCHD_START
84 AT_CHECK([ovs-ofctl -vwarn dump-ports br0], [0], [stdout])
85 AT_CHECK([strip_xids < stdout], [0], [dnl
86 OFPST_PORT reply: 1 ports
87   port LOCAL: rx pkts=0, bytes=0, drop=?, errs=?, frame=?, over=?, crc=?
88            tx pkts=0, bytes=0, drop=?, errs=?, coll=?
89 ])
90 OVS_VSWITCHD_STOP
91 AT_CLEANUP
92
93 AT_SETUP([ofproto - port stats - (OpenFlow 1.2)])
94 OVS_VSWITCHD_START
95 AT_CHECK([ovs-ofctl -O OpenFlow12 -vwarn dump-ports br0], [0], [stdout])
96 AT_CHECK([strip_xids < stdout], [0], [dnl
97 OFPST_PORT reply (OF1.2): 1 ports
98   port LOCAL: rx pkts=0, bytes=0, drop=?, errs=?, frame=?, over=?, crc=?
99            tx pkts=0, bytes=0, drop=?, errs=?, coll=?
100 ])
101 OVS_VSWITCHD_STOP
102 AT_CLEANUP
103
104 AT_SETUP([ofproto - port stats - (OpenFlow 1.4)])
105 OVS_VSWITCHD_START
106 AT_CHECK([ovs-ofctl -O OpenFlow14 -vwarn dump-ports br0], [0], [stdout])
107 AT_CHECK([strip_xids < stdout | sed 's/duration=[[0-9.]]*s/duration=?s/'],
108   [0], [dnl
109 OFPST_PORT reply (OF1.4): 1 ports
110   port LOCAL: rx pkts=0, bytes=0, drop=?, errs=?, frame=?, over=?, crc=?
111            tx pkts=0, bytes=0, drop=?, errs=?, coll=?
112            duration=?s
113 ])
114 OVS_VSWITCHD_STOP
115 AT_CLEANUP
116
117 dnl This is really bare-bones.
118 dnl It at least checks request and reply serialization and deserialization.
119 AT_SETUP([ofproto - port-desc stats (OpenFlow 1.0)])
120 OVS_VSWITCHD_START
121 AT_CHECK([ovs-ofctl -vwarn dump-ports-desc br0], [0], [stdout])
122 AT_CHECK([strip_xids < stdout], [0], [dnl
123 OFPST_PORT_DESC reply:
124  LOCAL(br0): addr:aa:55:aa:55:00:00
125      config:     PORT_DOWN
126      state:      LINK_DOWN
127      speed: 0 Mbps now, 0 Mbps max
128 ])
129 OVS_VSWITCHD_STOP
130 AT_CLEANUP
131
132 dnl This is really bare-bones.
133 dnl It at least checks request and reply serialization and deserialization.
134 AT_SETUP([ofproto - port-desc stats (OpenFlow 1.2)])
135 OVS_VSWITCHD_START
136 AT_CHECK([ovs-ofctl -O OpenFlow12 -vwarn dump-ports-desc br0], [0], [stdout])
137 AT_CHECK([strip_xids < stdout], [0], [dnl
138 OFPST_PORT_DESC reply (OF1.2):
139  LOCAL(br0): addr:aa:55:aa:55:00:00
140      config:     PORT_DOWN
141      state:      LINK_DOWN
142      speed: 0 Mbps now, 0 Mbps max
143 ])
144 OVS_VSWITCHD_STOP
145 AT_CLEANUP
146
147 AT_SETUP([ofproto - port-desc stats (OpenFlow 1.5)])
148 OVS_VSWITCHD_START
149 add_of_ports br0 1 2 3
150 AT_CHECK([ovs-ofctl -F OXM-OpenFlow15 -O OpenFlow15 -vwarn dump-ports-desc br0], [0], [stdout])
151 AT_CHECK([strip_xids < stdout | sed 's/00:0./00:0x/'], [0], [dnl
152 OFPST_PORT_DESC reply (OF1.5):
153  1(p1): addr:aa:55:aa:55:00:0x
154      config:     PORT_DOWN
155      state:      LINK_DOWN
156      speed: 0 Mbps now, 0 Mbps max
157  2(p2): addr:aa:55:aa:55:00:0x
158      config:     PORT_DOWN
159      state:      LINK_DOWN
160      speed: 0 Mbps now, 0 Mbps max
161  3(p3): addr:aa:55:aa:55:00:0x
162      config:     PORT_DOWN
163      state:      LINK_DOWN
164      speed: 0 Mbps now, 0 Mbps max
165  LOCAL(br0): addr:aa:55:aa:55:00:0x
166      config:     PORT_DOWN
167      state:      LINK_DOWN
168      speed: 0 Mbps now, 0 Mbps max
169 ])
170 AT_CHECK([ovs-ofctl -F OXM-OpenFlow15 -O OpenFlow15 -vwarn dump-ports-desc br0 2], [0], [stdout])
171 AT_CHECK([strip_xids < stdout | sed 's/00:0./00:0x/'], [0], [dnl
172 OFPST_PORT_DESC reply (OF1.5):
173  2(p2): addr:aa:55:aa:55:00:0x
174      config:     PORT_DOWN
175      state:      LINK_DOWN
176      speed: 0 Mbps now, 0 Mbps max
177 ])
178 OVS_VSWITCHD_STOP
179 AT_CLEANUP
180
181 dnl CHECK_QUEUE_STATS(label, option, format)
182 m4_define([CHECK_QUEUE_STATS], [
183 AT_SETUP([ofproto - queue stats - (OpenFlow $1)])
184 OVS_VSWITCHD_START
185
186 AT_CHECK([ovs-ofctl -O $2 queue-stats br0 | strip_xids], [0],
187   [OFPST_QUEUE reply$3: 1 queues
188   port LOCAL queue 0: bytes=?, pkts=?, errors=?, duration=?
189 ])
190
191 AT_CHECK([ovs-ofctl -O $2 queue-stats br0 LOCAL | strip_xids], [0],
192   [OFPST_QUEUE reply$3: 1 queues
193   port LOCAL queue 0: bytes=?, pkts=?, errors=?, duration=?
194 ])
195
196 AT_CHECK([ovs-ofctl -O $2 queue-stats br0 LOCAL 0 | strip_xids], [0],
197   [OFPST_QUEUE reply$3: 1 queues
198   port LOCAL queue 0: bytes=?, pkts=?, errors=?, duration=?
199 ])
200
201 AT_CHECK([ovs-ofctl -O $2 queue-stats br0 ANY 0 | strip_xids], [0],
202   [OFPST_QUEUE reply$3: 1 queues
203   port LOCAL queue 0: bytes=?, pkts=?, errors=?, duration=?
204 ])
205
206 AT_CHECK([ovs-ofctl -O $2 queue-stats br0 LOCAL 5 | strip_xids], [0],
207   [OFPT_ERROR$3: OFPQOFC_BAD_QUEUE
208 OFPST_QUEUE request$3: port=LOCAL queue=5
209 ])
210
211 AT_CHECK([ovs-ofctl -O $2 queue-stats br0 ANY 5 | strip_xids], [0],
212   [OFPT_ERROR$3: OFPQOFC_BAD_QUEUE
213 OFPST_QUEUE request$3: port=ANY queue=5
214 ])
215
216 AT_CHECK([ovs-ofctl -O $2 queue-stats br0 10 | strip_xids], [0],
217   [OFPT_ERROR$3: OFPQOFC_BAD_PORT
218 OFPST_QUEUE request$3: port=10 queue=ALL
219 ])
220 OVS_VSWITCHD_STOP
221 AT_CLEANUP
222 ])
223 CHECK_QUEUE_STATS([1.0], [OpenFlow10], [])
224 CHECK_QUEUE_STATS([1.1], [OpenFlow11], [ (OF1.1)])
225 CHECK_QUEUE_STATS([1.2], [OpenFlow12], [ (OF1.2)])
226 CHECK_QUEUE_STATS([1.3], [OpenFlow13], [ (OF1.3)])
227 CHECK_QUEUE_STATS([1.4], [OpenFlow14], [ (OF1.4)])
228
229 dnl This is really bare-bones.
230 dnl It at least checks request and reply serialization and deserialization.
231 AT_SETUP([ofproto - queue configuration - (OpenFlow 1.0)])
232 OVS_VSWITCHD_START
233 add_of_ports br0 1 2
234 AT_CHECK([ovs-ofctl queue-get-config br0 1], [0], [stdout])
235 AT_CHECK([strip_xids < stdout], [0], [dnl
236 OFPT_QUEUE_GET_CONFIG_REPLY: port=1
237 queue 0:
238 ])
239 AT_CHECK([ovs-ofctl queue-get-config br0], [0], [stdout])
240 AT_CHECK([strip_xids < stdout | sort], [0], [dnl
241 OFPT_QUEUE_GET_CONFIG_REPLY: port=1
242 OFPT_QUEUE_GET_CONFIG_REPLY: port=2
243 queue 0:
244 queue 0:
245 ])
246 AT_CHECK([ovs-ofctl queue-get-config br0 10], [0],
247   [OFPT_ERROR (xid=0x2): OFPQOFC_BAD_PORT
248 OFPT_QUEUE_GET_CONFIG_REQUEST (xid=0x2): port=10
249 ])
250 OVS_VSWITCHD_STOP
251 AT_CLEANUP
252
253 AT_SETUP([ofproto - queue configuration - (OpenFlow 1.1)])
254 OVS_VSWITCHD_START
255 add_of_ports br0 1 2
256 AT_CHECK([ovs-ofctl -O OpenFlow11 queue-get-config br0 1], [0], [stdout])
257 AT_CHECK([strip_xids < stdout], [0], [dnl
258 OFPT_QUEUE_GET_CONFIG_REPLY (OF1.1): port=1
259 queue 0:
260 ])
261 AT_CHECK([ovs-ofctl -O OpenFlow11 queue-get-config br0 10 | strip_xids], [0],
262   [OFPT_ERROR (OF1.1): OFPQOFC_BAD_PORT
263 OFPT_QUEUE_GET_CONFIG_REQUEST (OF1.1): port=10
264 ])
265 OVS_VSWITCHD_STOP
266 AT_CLEANUP
267
268 AT_SETUP([ofproto - queue configuration - (OpenFlow 1.2)])
269 OVS_VSWITCHD_START
270 add_of_ports br0 1 2
271 AT_CHECK([ovs-ofctl -O OpenFlow12 queue-get-config br0 1], [0], [stdout])
272 AT_CHECK([strip_xids < stdout], [0], [dnl
273 OFPT_QUEUE_GET_CONFIG_REPLY (OF1.2): port=1
274 queue 0:
275 ])
276 AT_CHECK([ovs-ofctl -O OpenFlow12 queue-get-config br0 ANY], [0], [stdout])
277 AT_CHECK([strip_xids < stdout], [0], [dnl
278 OFPT_QUEUE_GET_CONFIG_REPLY (OF1.2): port=ANY
279 queue 0:
280 queue 0:
281 queue 0:
282 ])
283 AT_CHECK([ovs-ofctl -O OpenFlow12 queue-get-config br0 10 | strip_xids], [0],
284   [OFPT_ERROR (OF1.2): OFPQOFC_BAD_PORT
285 OFPT_QUEUE_GET_CONFIG_REQUEST (OF1.2): port=10
286 ])
287 OVS_VSWITCHD_STOP
288 AT_CLEANUP
289
290 AT_SETUP([ofproto - queue configuration - (OpenFlow 1.4)])
291 OVS_VSWITCHD_START
292 add_of_ports br0 1 2
293
294 AT_CHECK([ovs-ofctl -O OpenFlow14 queue-get-config br0 any | strip_xids], [0],
295   [OFPST_QUEUE_DESC reply (OF1.4): port=1
296 queue 0:
297 port=2
298 queue 0:
299 port=LOCAL
300 queue 0:
301 ])
302
303 AT_CHECK([ovs-ofctl -O OpenFlow14 queue-get-config br0 1 | strip_xids], [0],
304   [OFPST_QUEUE_DESC reply (OF1.4): port=1
305 queue 0:
306 ])
307
308 AT_CHECK([ovs-ofctl -O OpenFlow14 queue-get-config br0 10 | strip_xids], [0],
309   [OFPT_ERROR (OF1.4): OFPQOFC_BAD_PORT
310 OFPST_QUEUE_DESC request (OF1.4): port=10
311 ])
312
313 AT_CHECK([ovs-ofctl -O OpenFlow14 queue-get-config br0 1 2 | strip_xids], [0],
314   [OFPT_ERROR (OF1.4): OFPQOFC_BAD_QUEUE
315 OFPST_QUEUE_DESC request (OF1.4): port=1 queue=2
316 ])
317 OVS_VSWITCHD_STOP
318 AT_CLEANUP
319
320 dnl This is really bare-bones.
321 dnl It at least checks request and reply serialization and deserialization.
322 dnl Actions definition listed in both supported formats (w/ actions=)
323 AT_SETUP([ofproto - no group support (OpenFlow 1.0)])
324 OVS_VSWITCHD_START
325 AT_DATA([groups.txt], [dnl
326 group_id=1234,type=all,bucket=output:10
327 group_id=1235,type=all,bucket=actions=output:10
328 ])
329 AT_DATA([stderr], [dnl
330 ovs-ofctl: none of the usable flow formats (OXM,OpenFlow11) is among the allowed flow formats (OpenFlow10,NXM)
331 ])
332 AT_CHECK([ovs-ofctl -O OpenFlow10 -vwarn add-groups br0 groups.txt], [1], ,[stderr])
333 AT_CHECK([ovs-ofctl -O OpenFlow10 -vwarn mod-group br0 'group_id=1234,type=all,bucket=output:10'], [1], ,[stderr])
334 AT_CHECK([ovs-ofctl -O OpenFlow10 -vwarn del-groups br0], [1], ,[stderr])
335 AT_CHECK([ovs-ofctl -O OpenFlow10 -vwarn dump-groups br0 ], [1], ,[stderr])
336 OVS_VSWITCHD_STOP
337 AT_CLEANUP
338
339 dnl This is really bare-bones.
340 dnl It at least checks request and reply serialization and deserialization.
341 dnl Actions definition listed in both supported formats (w/ actions=)
342 AT_SETUP([ofproto - del group (OpenFlow 1.1)])
343 OVS_VSWITCHD_START
344 AT_DATA([groups.txt], [dnl
345 group_id=1234,type=all,bucket=output:10
346 group_id=1235,type=all,bucket=actions=output:10
347 ])
348 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn add-groups br0 groups.txt])
349 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn dump-groups br0 ], [0], [stdout])
350 AT_CHECK([strip_xids < stdout], [0], [dnl
351 OFPST_GROUP_DESC reply (OF1.1):
352  group_id=1234,type=all,bucket=actions=output:10
353  group_id=1235,type=all,bucket=actions=output:10
354 ])
355 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn del-groups br0 group_id=1234])
356 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn dump-groups br0], [0], [stdout])
357 AT_CHECK([strip_xids < stdout], [0], [dnl
358 OFPST_GROUP_DESC reply (OF1.1):
359  group_id=1235,type=all,bucket=actions=output:10
360 ])
361 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn del-groups br0 group_id=1234])
362 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn dump-groups br0], [0], [stdout])
363 AT_CHECK([strip_xids < stdout], [0], [dnl
364 OFPST_GROUP_DESC reply (OF1.1):
365  group_id=1235,type=all,bucket=actions=output:10
366 ])
367 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn del-groups br0], [0])
368 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn dump-groups br0], [0], [stdout])
369 AT_CHECK([strip_xids < stdout], [0], [dnl
370 OFPST_GROUP_DESC reply (OF1.1):
371 ])
372
373 # Negative test.
374 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn del-groups br0 group_id=0xfffffff0],
375   [1], [], [ovs-ofctl: invalid group id 4294967280
376 ])
377 OVS_VSWITCHD_STOP
378 AT_CLEANUP
379
380 dnl This is really bare-bones.
381 dnl It at least checks request and reply serialization and deserialization.
382 dnl Actions definition listed in both supported formats (w/ actions=)
383 AT_SETUP([ofproto - add indirect group])
384 OVS_VSWITCHD_START
385 dnl indirect group must have exactly one bucket
386 AT_DATA([stderr], [dnl
387 OFPT_ERROR (OF1.1) (xid=0x2): OFPGMFC_INVALID_GROUP
388 OFPT_GROUP_MOD (OF1.1) (xid=0x2): ***decode error: OFPGMFC_INVALID_GROUP***
389 ])
390 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn add-group br0 'group_id=1234,type=indirect'], [1], , [stderr])
391 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn add-group br0 'group_id=1235,type=indirect,bucket=output:10'])
392 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn add-group br0 'group_id=1236,type=indirect,bucket=output:10,bucket=output:11'], [1], , [stderr])
393 OVS_VSWITCHD_STOP
394 AT_CLEANUP
395
396 AT_SETUP([ofproto - group_mod with mod and add_or_mod command])
397 OVS_VSWITCHD_START
398 dnl Check that mod-group for non-existing group fails without --may-create
399 AT_DATA([stderr], [dnl
400 OFPT_ERROR (OF1.3) (xid=0x2): OFPGMFC_UNKNOWN_GROUP
401 OFPT_GROUP_MOD (OF1.3) (xid=0x2):
402  MOD group_id=1234,type=indirect,bucket=actions=output:2
403 ])
404 AT_CHECK([ovs-ofctl -O OpenFlow13 -vwarn mod-group br0 'group_id=1234,type=indirect,bucket=actions=2'], [1], , [stderr])
405 dnl Check that mod-group for non-existing group succeeds with --may-create
406 AT_CHECK([ovs-ofctl -O OpenFlow13 -vwarn --may-create mod-group br0 'group_id=1234,type=indirect,bucket=actions=2'])
407 AT_CHECK([ovs-ofctl -O OpenFlow13 -vwarn dump-groups br0], [0], [stdout])
408 AT_CHECK([strip_xids < stdout], [0], [dnl
409 OFPST_GROUP_DESC reply (OF1.3):
410  group_id=1234,type=indirect,bucket=actions=output:2
411 ])
412 dnl Check that mod-group for existing group succeeds with --may-create
413 AT_CHECK([ovs-ofctl -O OpenFlow13 -vwarn --may-create mod-group br0 'group_id=1234,type=indirect,bucket=actions=3'])
414 AT_CHECK([ovs-ofctl -O OpenFlow13 -vwarn dump-groups br0], [0], [stdout])
415 AT_CHECK([strip_xids < stdout], [0], [dnl
416 OFPST_GROUP_DESC reply (OF1.3):
417  group_id=1234,type=indirect,bucket=actions=output:3
418 ])
419 OVS_VSWITCHD_STOP
420 AT_CLEANUP
421
422 dnl This is really bare-bones.
423 dnl It at least checks request and reply serialization and deserialization.
424 dnl Actions definition listed in both supported formats (w/ actions=)
425 AT_SETUP([ofproto - del group (OpenFlow 1.5)])
426 OVS_VSWITCHD_START
427 AT_DATA([groups.txt], [dnl
428 group_id=1233,type=select,selection_method=hash,bucket=output:10,bucket=output:11
429 group_id=1234,type=select,selection_method=hash,fields(eth_dst,ip_dst,tcp_dst),bucket=output:10,bucket=output:11
430 group_id=1235,type=all,bucket=actions=output:12,bucket=bucket_id:0,actions=output:10,bucket=bucket_id:1,actions=output:11
431 ])
432 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn add-groups br0 groups.txt])
433 AT_CHECK([ovs-ofctl -F OXM-OpenFlow15 -O OpenFlow15 -vwarn dump-groups br0 1234], [0], [stdout])
434 AT_CHECK([strip_xids < stdout], [0], [dnl
435 OFPST_GROUP_DESC reply (OF1.5):
436  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
437 ])
438 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn del-groups br0 group_id=1234])
439 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn dump-groups br0], [0], [stdout])
440 AT_CHECK([strip_xids < stdout], [0], [dnl
441 OFPST_GROUP_DESC reply (OF1.5):
442  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
443  group_id=1233,type=select,selection_method=hash,bucket=bucket_id:0,actions=output:10,bucket=bucket_id:1,actions=output:11
444 ])
445 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn del-groups br0 group_id=1234])
446 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn dump-groups br0], [0], [stdout])
447 AT_CHECK([strip_xids < stdout], [0], [dnl
448 OFPST_GROUP_DESC reply (OF1.5):
449  group_id=1235,type=all,bucket=bucket_id:2,actions=output:12,bucket=bucket_id:0,actions=output:10,bucket=bucket_id:1,actions=output:11
450  group_id=1233,type=select,selection_method=hash,bucket=bucket_id:0,actions=output:10,bucket=bucket_id:1,actions=output:11
451 ])
452 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn del-groups br0], [0])
453 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn dump-groups br0], [0], [stdout])
454 AT_CHECK([strip_xids < stdout], [0], [dnl
455 OFPST_GROUP_DESC reply (OF1.5):
456 ])
457 OVS_VSWITCHD_STOP
458 AT_CLEANUP
459
460 dnl This is really bare-bones.
461 dnl It at least checks request and reply serialization and deserialization.
462 AT_SETUP([ofproto - del group deletes flows])
463 OVS_VSWITCHD_START
464 AT_DATA([groups.txt], [dnl
465 group_id=1234,type=all,bucket=output:10
466 group_id=1235,type=all,bucket=output:10
467 ])
468 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn add-groups br0 groups.txt])
469 AT_DATA([flows.txt], [dnl
470 tcp actions=group:1234
471 table=2 udp actions=group:1235
472 ])
473 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn add-flows br0 flows.txt])
474 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn dump-flows br0 | ofctl_strip | sort],
475 [0], [dnl
476  table=2, udp actions=group:1235
477  tcp actions=group:1234
478 OFPST_FLOW reply (OF1.1):
479 ])
480 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn del-groups br0 group_id=1234])
481 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn dump-flows br0 | ofctl_strip | sort],
482 [0], [dnl
483  table=2, udp actions=group:1235
484 OFPST_FLOW reply (OF1.1):
485 ])
486 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn del-groups br0 group_id=1234])
487 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn dump-flows br0 | ofctl_strip | sort],
488 [0], [dnl
489  table=2, udp actions=group:1235
490 OFPST_FLOW reply (OF1.1):
491 ])
492 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn del-groups br0])
493 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn dump-flows br0 | ofctl_strip | sort],
494 [0], [dnl
495 OFPST_FLOW reply (OF1.1):
496 ])
497 OVS_VSWITCHD_STOP
498 AT_CLEANUP
499
500 dnl This is really bare-bones.
501 dnl It at least checks request and reply serialization and deserialization.
502 dnl Actions definition listed in both supported formats (w/ actions=)
503 AT_SETUP([ofproto - insert buckets])
504 OVS_VSWITCHD_START
505 # Add group with no buckets.
506 AT_DATA([groups.txt], [dnl
507 group_id=1234,type=all
508 ])
509 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn add-groups br0 groups.txt])
510 AT_CHECK([ovs-ofctl -F OXM-OpenFlow15 -O OpenFlow15 -vwarn dump-groups br0 1234], [0], [stdout])
511 AT_CHECK([strip_xids < stdout], [0], [dnl
512 OFPST_GROUP_DESC reply (OF1.5):
513  group_id=1234,type=all
514 ])
515
516 # Add two buckets, using "last".
517 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])
518 AT_CHECK([ovs-ofctl -F OXM-OpenFlow15 -O OpenFlow15 -vwarn dump-groups br0 1234], [0], [stdout])
519 AT_CHECK([strip_xids < stdout], [0], [dnl
520 OFPST_GROUP_DESC reply (OF1.5):
521  group_id=1234,type=all,bucket=bucket_id:10,actions=output:10,bucket=bucket_id:11,actions=output:11
522 ])
523
524 # Start over again, then add two buckets using "first".
525 AT_CHECK([ovs-ofctl -O OpenFlow15 --strict del-groups br0 group_id=1234])
526 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn add-group br0 group_id=1234,type=all])
527 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])
528 AT_CHECK([ovs-ofctl -F OXM-OpenFlow15 -O OpenFlow15 -vwarn dump-groups br0 1234], [0], [stdout])
529 AT_CHECK([strip_xids < stdout], [0], [dnl
530 OFPST_GROUP_DESC reply (OF1.5):
531  group_id=1234,type=all,bucket=bucket_id:10,actions=output:10,bucket=bucket_id:11,actions=output:11
532 ])
533
534 # Add two more buckets before the existing ones.
535 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])
536 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn dump-groups br0], [0], [stdout])
537 AT_CHECK([strip_xids < stdout], [0], [dnl
538 OFPST_GROUP_DESC reply (OF1.5):
539  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
540 ])
541
542 # Add another bucket at the end.
543 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])
544 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn dump-groups br0], [0], [stdout])
545 AT_CHECK([strip_xids < stdout], [0], [dnl
546 OFPST_GROUP_DESC reply (OF1.5):
547  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
548 ])
549
550 # Verify that duplicate bucket IDs are rejected.
551 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])
552 AT_CHECK([strip_xids < stderr | sed '/truncated/,$d'], [0], [dnl
553 OFPT_ERROR (OF1.5): OFPGMFC_BUCKET_EXISTS
554 OFPT_GROUP_MOD (OF1.5):
555 ])
556
557
558 # Add another bucket just before bucket 15.
559 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn insert-buckets br0 group_id=1234,command_bucket_id=15])
560 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn dump-groups br0], [0], [stdout])
561 AT_CHECK([strip_xids < stdout], [0], [dnl
562 OFPST_GROUP_DESC reply (OF1.5):
563  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
564 ])
565
566 # Add two more buckets just before bucket 11,
567 # getting the command from a file.
568 AT_DATA([buckets.txt], [dnl
569 group_id=1234,command_bucket_id=11,bucket=bucket_id:12,actions=output:12,bucket=bucket_id:13,actions=output:13
570 ])
571 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn insert-buckets br0 - < buckets.txt])
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: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
576 ])
577
578 # Add yet two more buckets.
579 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])
580 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn dump-groups br0], [0], [stdout])
581 AT_CHECK([strip_xids < stdout], [0], [dnl
582 OFPST_GROUP_DESC reply (OF1.5):
583  group_id=1234,type=all,bucket=bucket_id: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
584 ])
585
586 # Negative tests.
587 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], [],
588   [ovs-ofctl: invalid command bucket id 4294967041
589 ])
590 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], [],
591   [ovs-ofctl: insert-bucket needs OpenFlow 1.5 or later ('-O OpenFlow15')
592 ])
593 OVS_VSWITCHD_STOP
594 AT_CLEANUP
595
596 dnl This is really bare-bones.
597 dnl It at least checks request and reply serialization and deserialization.
598 dnl Actions definition listed in both supported formats (w/ actions=)
599 AT_SETUP([ofproto - remove buckets])
600 OVS_VSWITCHD_START
601 AT_DATA([groups.txt], [dnl
602 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
603 ])
604 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn add-groups br0 groups.txt])
605 AT_CHECK([ovs-ofctl -F OXM-OpenFlow15 -O OpenFlow15 -vwarn dump-groups br0 1234], [0], [stdout])
606 AT_CHECK([strip_xids < stdout], [0], [dnl
607 OFPST_GROUP_DESC reply (OF1.5):
608  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
609 ])
610 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn remove-buckets br0 group_id=1234,command_bucket_id=first])
611 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn dump-groups br0], [0], [stdout])
612 AT_CHECK([strip_xids < stdout], [0], [dnl
613 OFPST_GROUP_DESC reply (OF1.5):
614  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
615 ])
616 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn remove-buckets br0 group_id=1234,command_bucket_id=last])
617 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn dump-groups br0], [0], [stdout])
618 AT_CHECK([strip_xids < stdout], [0], [dnl
619 OFPST_GROUP_DESC reply (OF1.5):
620  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
621 ])
622 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn remove-buckets br0 group_id=1234,command_bucket_id=13])
623 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn dump-groups br0], [0], [stdout])
624 AT_CHECK([strip_xids < stdout], [0], [dnl
625 OFPST_GROUP_DESC reply (OF1.5):
626  group_id=1234,type=all,bucket=bucket_id: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
627 ])
628 AT_DATA([buckets.txt], [dnl
629 group_id=1234
630 ])
631 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn remove-buckets br0 - < buckets.txt])
632 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn dump-groups br0], [0], [stdout])
633 AT_CHECK([strip_xids < stdout], [0], [dnl
634 OFPST_GROUP_DESC reply (OF1.5):
635  group_id=1234,type=all
636 ])
637 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn remove-buckets br0 group_id=1234,command_bucket_id=first])
638 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn remove-buckets br0 group_id=1234,command_bucket_id=last])
639 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn remove-buckets br0 group_id=1234,command_bucket_id=all])
640 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn remove-buckets br0 group_id=1234,command_bucket_id=1], [1], [], [stderr])
641 AT_CHECK([ofctl_strip < stderr], [0], [dnl
642 OFPT_ERROR (OF1.5): OFPGMFC_UNKNOWN_BUCKET
643 OFPT_GROUP_MOD (OF1.5):
644  REMOVE_BUCKET command_bucket_id:1,group_id=1234
645 ])
646 # Negative test.
647 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn remove-buckets br0 group_id=1234,command_bucket_id=last], [1], [],
648   [ovs-ofctl: remove-bucket needs OpenFlow 1.5 or later ('-O OpenFlow15')
649 ])
650 OVS_VSWITCHD_STOP
651 AT_CLEANUP
652
653 dnl This is really bare-bones.
654 dnl It at least checks request and reply serialization and deserialization.
655 AT_SETUP([ofproto - flow mod checks group availability])
656 OVS_VSWITCHD_START
657 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn add-group br0 group_id=1234,type=all,bucket=output:10])
658 AT_DATA([flows.txt], [dnl
659 tcp actions=group:1234
660 udp actions=group:1235
661 ])
662 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn add-flow br0 'tcp actions=group:1234'])
663 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn add-flow br0 'tcp actions=group:1235'], [1], [], [stderr])
664
665 # The output should look like this:
666 #
667 # 00000000  02 0e 00 98 00 00 00 02-00 00 00 00 00 00 00 00 |................|
668 # 00000010  00 00 00 00 00 00 00 00-ff 00 00 00 00 00 80 00 |................|
669 # 00000020  ff ff ff ff ff ff ff ff-ff ff ff ff 00 00 00 00 |................|
670 # 00000030  00 00 00 58 00 00 00 00-00 00 03 d7 00 00 00 00 |...X............|
671 #
672 # This 'sed' command captures the error message but drops details.
673 AT_CHECK([sed '/truncated/d
674 /^000000.0/d' stderr | strip_xids], [0],
675   [OFPT_ERROR (OF1.1): OFPBAC_BAD_OUT_GROUP
676 OFPT_FLOW_MOD (OF1.1):
677 ])
678 OVS_VSWITCHD_STOP
679 AT_CLEANUP
680
681 dnl This is really bare-bones.
682 dnl It at least checks request and reply serialization and deserialization.
683 AT_SETUP([ofproto - group description])
684 OVS_VSWITCHD_START
685 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn add-group br0 group_id=1234,type=all,bucket=output:10], [0], [stdout])
686 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn dump-groups br0], [0], [stdout])
687 AT_CHECK([strip_xids < stdout], [0], [dnl
688 OFPST_GROUP_DESC reply (OF1.1):
689  group_id=1234,type=all,bucket=actions=output:10
690 ])
691 OVS_VSWITCHD_STOP
692 AT_CLEANUP
693
694 dnl This is really bare-bones.
695 dnl It at least checks request and reply serialization and deserialization.
696 AT_SETUP([ofproto - group description])
697 OVS_VSWITCHD_START
698 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn add-group br0 group_id=1234,type=all,bucket=output:10])
699 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn dump-groups br0], [0], [stdout])
700 AT_CHECK([strip_xids < stdout], [0], [dnl
701 OFPST_GROUP_DESC reply (OF1.1):
702  group_id=1234,type=all,bucket=actions=output:10
703 ])
704 OVS_VSWITCHD_STOP
705 AT_CLEANUP
706
707 dnl This is really bare-bones.
708 dnl It at least checks request and reply serialization and deserialization.
709 AT_SETUP([ofproto - group features])
710 OVS_VSWITCHD_START
711 AT_CHECK([ovs-ofctl -O OpenFlow12 -vwarn dump-group-features br0], [0], [stdout])
712 AT_CHECK([strip_xids < stdout], [0], [dnl
713 OFPST_GROUP_FEATURES reply (OF1.2):
714  Group table:
715     Types:  0xf
716     Capabilities:  0x7
717     all group:
718        max_groups=0xffffff00
719        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
720     select group:
721        max_groups=0xffffff00
722        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
723     indirect group:
724        max_groups=0xffffff00
725        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
726     fast failover group:
727        max_groups=0xffffff00
728        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
729 ])
730 OVS_VSWITCHD_STOP
731 AT_CLEANUP
732
733 dnl This is really bare-bones.
734 dnl It at least checks request and reply serialization and deserialization.
735 AT_SETUP([ofproto - group stats (OpenFlow 1.1)])
736 OVS_VSWITCHD_START
737 AT_DATA([groups.txt], [dnl
738 group_id=1234,type=all,bucket=output:10
739 group_id=1235,type=all,bucket=output:10
740 ])
741 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn add-groups br0 groups.txt])
742 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn add-flow br0 'tcp actions=group:1234'])
743 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn dump-group-stats br0 group_id=1234], [0], [stdout])
744 AT_CHECK([strip_xids < stdout | sort], [0], [dnl
745  group_id=1234,ref_count=1,packet_count=0,byte_count=0,bucket0:packet_count=0,byte_count=0
746 OFPST_GROUP reply (OF1.1):
747 ])
748 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn dump-group-stats br0], [0], [stdout])
749 AT_CHECK([strip_xids < stdout | sort], [0], [dnl
750  group_id=1234,ref_count=1,packet_count=0,byte_count=0,bucket0:packet_count=0,byte_count=0
751  group_id=1235,ref_count=0,packet_count=0,byte_count=0,bucket0:packet_count=0,byte_count=0
752 OFPST_GROUP reply (OF1.1):
753 ])
754 OVS_VSWITCHD_STOP
755 AT_CLEANUP
756
757 dnl This is really bare-bones.
758 dnl It at least checks request and reply serialization and deserialization.
759 AT_SETUP([ofproto - group stats (OpenFlow 1.3)])
760 OVS_VSWITCHD_START
761 AT_DATA([groups.txt], [dnl
762 group_id=1234,type=all,bucket=output:10
763 group_id=1235,type=all,bucket=output:10
764 ])
765 AT_CHECK([ovs-ofctl -O OpenFlow13 -vwarn add-groups br0 groups.txt])
766 AT_CHECK([ovs-ofctl -O OpenFlow13 -vwarn add-flow br0 'tcp actions=group:1234'])
767 AT_CHECK([ovs-ofctl -O OpenFlow13 -vwarn dump-group-stats br0 group_id=1234], [0], [stdout])
768 AT_CHECK([strip_xids < stdout | sed 's/duration=[[0-9.]]*s/duration=?s/' | sort], [0], [dnl
769  group_id=1234,duration=?s,ref_count=1,packet_count=0,byte_count=0,bucket0:packet_count=0,byte_count=0
770 OFPST_GROUP reply (OF1.3):
771 ])
772 AT_CHECK([ovs-ofctl -O OpenFlow13 -vwarn dump-group-stats br0], [0], [stdout])
773 AT_CHECK([strip_xids < stdout | sed 's/duration=[[0-9.]]*s/duration=?s/' | sort], [0], [dnl
774  group_id=1234,duration=?s,ref_count=1,packet_count=0,byte_count=0,bucket0:packet_count=0,byte_count=0
775  group_id=1235,duration=?s,ref_count=0,packet_count=0,byte_count=0,bucket0:packet_count=0,byte_count=0
776 OFPST_GROUP reply (OF1.3):
777 ])
778 OVS_VSWITCHD_STOP
779 AT_CLEANUP
780
781 dnl This is really bare-bones.
782 dnl It at least checks request and reply serialization and deserialization.
783 AT_SETUP([ofproto - group stats (OpenFlow 1.5)])
784 OVS_VSWITCHD_START
785 AT_DATA([groups.txt], [dnl
786 group_id=1234,type=all,bucket=output:10
787 group_id=1235,type=all,bucket=output:10
788 ])
789 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn add-groups br0 groups.txt])
790 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn add-flow br0 'tcp actions=group:1234'])
791 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn dump-group-stats br0 group_id=1234], [0], [stdout])
792 AT_CHECK([strip_xids < stdout | sed 's/duration=[[0-9.]]*s/duration=?s/' | sort], [0], [dnl
793  group_id=1234,duration=?s,ref_count=1,packet_count=0,byte_count=0,bucket0:packet_count=0,byte_count=0
794 OFPST_GROUP reply (OF1.5):
795 ])
796 AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn dump-group-stats br0], [0], [stdout])
797 AT_CHECK([strip_xids < stdout | sed 's/duration=[[0-9.]]*s/duration=?s/' | sort], [0], [dnl
798  group_id=1234,duration=?s,ref_count=1,packet_count=0,byte_count=0,bucket0:packet_count=0,byte_count=0
799  group_id=1235,duration=?s,ref_count=0,packet_count=0,byte_count=0,bucket0:packet_count=0,byte_count=0
800 OFPST_GROUP reply (OF1.5):
801 ])
802 OVS_VSWITCHD_STOP
803 AT_CLEANUP
804
805 dnl This found a use-after-free error in bridge destruction in the
806 dnl presence of groups.
807 AT_SETUP([ofproto - group add then bridge delete (OpenFlow 1.3)])
808 OVS_VSWITCHD_START
809 AT_DATA([groups.txt], [dnl
810 group_id=1234,type=all,bucket=output:10
811 group_id=1235,type=all,bucket=output:10
812
813 dnl This checks for regression against a parser bug such that
814 dnl "actions=resbmit(,1)" etc. was rejected as a syntax error.
815 group_id=2345,type=select,bucket=weight:10,actions=resubmit(,1),bucket=weight:10,actions=resubmit(,2),bucket=weight:1,actions=resubmit(,3)
816 ])
817 AT_CHECK([ovs-ofctl -O OpenFlow13 -vwarn add-groups br0 groups.txt])
818 AT_CHECK([ovs-vsctl del-br br0])
819 OVS_VSWITCHD_STOP
820 AT_CLEANUP
821
822 AT_SETUP([ofproto - mod-port (OpenFlow 1.0)])
823 OVS_VSWITCHD_START
824 for command_config_state in \
825     'up 0 0' \
826     'noflood NO_FLOOD 0' \
827     'down PORT_DOWN,NO_FLOOD LINK_DOWN' \
828     'flood PORT_DOWN LINK_DOWN' \
829     'no-receive PORT_DOWN,NO_RECV LINK_DOWN' \
830     'no-forward PORT_DOWN,NO_RECV,NO_FWD LINK_DOWN' \
831     'no-packet-in PORT_DOWN,NO_RECV,NO_FWD,NO_PACKET_IN LINK_DOWN' \
832     'forward PORT_DOWN,NO_RECV,NO_PACKET_IN LINK_DOWN' \
833     'packet-in PORT_DOWN,NO_RECV LINK_DOWN' \
834     'up NO_RECV 0' \
835     'receive 0 0'
836 do
837     set $command_config_state
838     command=$[1] config=`echo $[2] | sed 's/,/ /g'` state=$[3]
839     AT_CHECK([ovs-ofctl -vwarn mod-port br0 br0 $command])
840     AT_CHECK([ovs-ofctl -vwarn show br0], [0], [stdout])
841     AT_CHECK_UNQUOTED([strip_xids < stdout], [0], [dnl
842 OFPT_FEATURES_REPLY: dpid:fedcba9876543210
843 n_tables:254, n_buffers:256
844 capabilities: FLOW_STATS TABLE_STATS PORT_STATS QUEUE_STATS ARP_MATCH_IP
845 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
846  LOCAL(br0): addr:aa:55:aa:55:00:00
847      config:     $config
848      state:      $state
849      speed: 0 Mbps now, 0 Mbps max
850 OFPT_GET_CONFIG_REPLY: frags=normal miss_send_len=0
851 ])
852 done
853 OVS_VSWITCHD_STOP
854 AT_CLEANUP
855
856 AT_SETUP([ofproto - mod-port (OpenFlow 1.2)])
857 OVS_VSWITCHD_START
858 for command_config_state in \
859     'up 0 0' \
860     'down PORT_DOWN LINK_DOWN' \
861     'no-receive PORT_DOWN,NO_RECV LINK_DOWN' \
862     'no-forward PORT_DOWN,NO_RECV,NO_FWD LINK_DOWN' \
863     'no-packet-in PORT_DOWN,NO_RECV,NO_FWD,NO_PACKET_IN LINK_DOWN' \
864     'forward PORT_DOWN,NO_RECV,NO_PACKET_IN LINK_DOWN' \
865     'packet-in PORT_DOWN,NO_RECV LINK_DOWN' \
866     'up NO_RECV 0' \
867     'receive 0 0'
868 do
869     set $command_config_state
870     command=$[1] config=`echo $[2] | sed 's/,/ /g'` state=$[3]
871     AT_CHECK([ovs-ofctl -O OpenFlow12 -vwarn mod-port br0 br0 $command])
872     AT_CHECK([ovs-ofctl -O OpenFlow12 -vwarn show br0], [0], [stdout])
873     AT_CHECK_UNQUOTED([strip_xids < stdout], [0], [dnl
874 OFPT_FEATURES_REPLY (OF1.2): dpid:fedcba9876543210
875 n_tables:254, n_buffers:256
876 capabilities: FLOW_STATS TABLE_STATS PORT_STATS GROUP_STATS QUEUE_STATS
877  LOCAL(br0): addr:aa:55:aa:55:00:00
878      config:     $config
879      state:      $state
880      speed: 0 Mbps now, 0 Mbps max
881 OFPT_GET_CONFIG_REPLY (OF1.2): frags=normal miss_send_len=0
882 ])
883 done
884 OVS_VSWITCHD_STOP
885 AT_CLEANUP
886
887 AT_SETUP([ofproto - mod-port (OpenFlow 1.4)])
888 OVS_VSWITCHD_START
889 for command_config_state in \
890     'up 0 0' \
891     'down PORT_DOWN LINK_DOWN' \
892     'no-receive PORT_DOWN,NO_RECV LINK_DOWN' \
893     'no-forward PORT_DOWN,NO_RECV,NO_FWD LINK_DOWN' \
894     'no-packet-in PORT_DOWN,NO_RECV,NO_FWD,NO_PACKET_IN LINK_DOWN' \
895     'forward PORT_DOWN,NO_RECV,NO_PACKET_IN LINK_DOWN' \
896     'packet-in PORT_DOWN,NO_RECV LINK_DOWN' \
897     'up NO_RECV 0' \
898     'receive 0 0'
899 do
900     set $command_config_state
901     command=$[1] config=`echo $[2] | sed 's/,/ /g'` state=$[3]
902     AT_CHECK([ovs-ofctl -O OpenFlow14 -vwarn mod-port br0 br0 $command])
903     AT_CHECK([ovs-ofctl -O OpenFlow14 -vwarn show br0], [0], [stdout])
904     AT_CHECK_UNQUOTED([strip_xids < stdout], [0], [dnl
905 OFPT_FEATURES_REPLY (OF1.4): dpid:fedcba9876543210
906 n_tables:254, n_buffers:256
907 capabilities: FLOW_STATS TABLE_STATS PORT_STATS GROUP_STATS QUEUE_STATS
908 OFPST_PORT_DESC reply (OF1.4):
909  LOCAL(br0): addr:aa:55:aa:55:00:00
910      config:     $config
911      state:      $state
912      speed: 0 Mbps now, 0 Mbps max
913 OFPT_GET_CONFIG_REPLY (OF1.4): frags=normal miss_send_len=0
914 ])
915 done
916 OVS_VSWITCHD_STOP
917 AT_CLEANUP
918
919 AT_SETUP([ofproto - basic flow_mod commands (NXM)])
920 OVS_VSWITCHD_START
921 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip], [0], [NXST_FLOW reply:
922 ])
923 AT_CHECK([echo 'in_port=2,actions=1' | ovs-ofctl add-flows br0 -])
924 AT_CHECK([ovs-ofctl add-flow br0 in_port=1,actions=2])
925 AT_CHECK([ovs-ofctl -F nxm add-flow br0 table=1,in_port=4,actions=3])
926 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
927  in_port=1 actions=output:2
928  in_port=2 actions=output:1
929  table=1, in_port=4 actions=output:3
930 NXST_FLOW reply:
931 ])
932 AT_CHECK([ovs-ofctl dump-aggregate br0 table=0 | strip_xids], [0], [dnl
933 NXST_AGGREGATE reply: packet_count=0 byte_count=0 flow_count=2
934 ])
935 AT_CHECK([ovs-ofctl del-flows br0])
936 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip], [0], [NXST_FLOW reply:
937 ])
938 OVS_VSWITCHD_STOP
939 AT_CLEANUP
940
941 AT_SETUP([ofproto - basic flow_mod commands (OpenFlow 1.0)])
942 OVS_VSWITCHD_START
943 AT_CHECK([ovs-ofctl -F openflow10 dump-flows br0 | ofctl_strip], [0], [OFPST_FLOW reply:
944 ])
945 AT_CHECK([echo 'in_port=2,actions=1' | ovs-ofctl -F openflow10 add-flows br0 -])
946 AT_CHECK([ovs-ofctl -F openflow10 add-flow br0 in_port=1,actions=2])
947 AT_CHECK([ovs-ofctl -F openflow10 add-flow br0 table=1,in_port=4,actions=3])
948 AT_CHECK([ovs-ofctl -F openflow10 dump-flows br0 | ofctl_strip | sort], [0], [dnl
949  in_port=1 actions=output:2
950  in_port=2 actions=output:1
951  table=1, in_port=4 actions=output:3
952 OFPST_FLOW reply:
953 ])
954 AT_CHECK([ovs-ofctl -F openflow10 dump-aggregate br0 table=0 | strip_xids], [0], [dnl
955 OFPST_AGGREGATE reply: packet_count=0 byte_count=0 flow_count=2
956 ])
957 AT_CHECK([ovs-ofctl -F openflow10 del-flows br0])
958 AT_CHECK([ovs-ofctl -F openflow10 dump-flows br0 | ofctl_strip], [0], [OFPST_FLOW reply:
959 ])
960 OVS_VSWITCHD_STOP
961 AT_CLEANUP
962
963 # It's really dumb that check_overlap and reset_counts are considered
964 # part of flow state, but OpenFlow implies that it is, and OFTest and
965 # some users insist on it.
966 AT_SETUP([ofproto - add-flow and flags])
967 OVS_VSWITCHD_START
968 AT_CHECK([ovs-ofctl -F openflow10 add-flow br0 check_overlap,in_port=1,actions=drop])
969 # Prior to OF1.3, flow dumps didn't include a "flags" field.
970 AT_CHECK([ovs-ofctl -F openflow10 dump-flows br0 | ofctl_strip], [0], [dnl
971 OFPST_FLOW reply:
972  in_port=1 actions=drop
973 ])
974 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip], [0], [dnl
975 OFPST_FLOW reply (OF1.1):
976  in_port=1 actions=drop
977 ])
978 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip], [0], [dnl
979 OFPST_FLOW reply (OF1.2):
980  in_port=1 actions=drop
981 ])
982 # OF1.3 makes the flags visible.
983 AT_CHECK([ovs-ofctl -O OpenFlow13 dump-flows br0 | ofctl_strip], [0], [dnl
984 OFPST_FLOW reply (OF1.3):
985  check_overlap reset_counts in_port=1 actions=drop
986 ])
987 AT_CHECK([ovs-ofctl -O OpenFlow14 dump-flows br0 | ofctl_strip], [0], [dnl
988 OFPST_FLOW reply (OF1.4):
989  check_overlap reset_counts in_port=1 actions=drop
990 ])
991 AT_CHECK([ovs-ofctl -O OpenFlow15 dump-flows br0 | ofctl_strip], [0], [dnl
992 OFPST_FLOW reply (OF1.5):
993  check_overlap reset_counts in_port=1 actions=drop
994 ])
995 OVS_VSWITCHD_STOP
996 AT_CLEANUP
997
998 AT_SETUP([ofproto - basic flow_mod commands (OpenFlow 1.1)])
999 OVS_VSWITCHD_START
1000 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip], [0], [OFPST_FLOW reply (OF1.1):
1001 ])
1002 AT_CHECK([echo 'in_port=2,actions=1' | ovs-ofctl -O OpenFlow11 add-flows br0 -])
1003 AT_CHECK([ovs-ofctl -O OpenFlow11 add-flow br0 in_port=1,actions=2])
1004 AT_CHECK([ovs-ofctl -O OpenFlow11 add-flow br0 table=1,in_port=4,actions=3])
1005 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1006  in_port=1 actions=output:2
1007  in_port=2 actions=output:1
1008  table=1, in_port=4 actions=output:3
1009 OFPST_FLOW reply (OF1.1):
1010 ])
1011 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-aggregate br0 table=0 | strip_xids], [0], [dnl
1012 OFPST_AGGREGATE reply (OF1.1): packet_count=0 byte_count=0 flow_count=2
1013 ])
1014 AT_CHECK([ovs-ofctl -O OpenFlow11 del-flows br0])
1015 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip], [0], [OFPST_FLOW reply (OF1.1):
1016  table=1, in_port=4 actions=output:3
1017 ])
1018 OVS_VSWITCHD_STOP
1019 AT_CLEANUP
1020
1021 AT_SETUP([ofproto - flow_mod negative test (OpenFlow 1.1)])
1022 OVS_VSWITCHD_START(
1023   [set bridge br0 protocols=OpenFlow10,OpenFlow11,OpenFlow12,OpenFlow13])
1024 AT_CHECK([ovs-ofctl add-flow -O OpenFlow11 br0 table=1,action=goto_table:2])
1025
1026 # The error message here actually comes from ovs-ofctl, not from ovs-vswitchd,
1027 # but at least it's the same code in ofpacts_check() that issues the error.
1028 AT_CHECK([ovs-ofctl add-flow -O OpenFlow11 br0 table=1,action=goto_table:1],
1029   [1], [],
1030   [ovs-ofctl: actions are invalid with specified match (OFPBIC_BAD_TABLE_ID)
1031 ])
1032 OVS_VSWITCHD_STOP
1033 AT_CLEANUP
1034
1035 AT_SETUP([ofproto - set-field flow_mod commands (NXM)])
1036 OVS_VSWITCHD_START
1037 AT_CHECK([ovs-ofctl add-flow br0 ipv6,table=1,in_port=3,actions=drop])
1038 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])
1039 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])
1040 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1041  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[[]]
1042  table=1, ipv6,in_port=3 actions=load:0xa6badbfffefe59fa->NXM_NX_IPV6_SRC[[0..63]],load:0xfe8001234567890a->NXM_NX_IPV6_SRC[[64..127]]
1043 NXST_FLOW reply:
1044 ])
1045 OVS_VSWITCHD_STOP
1046 AT_CLEANUP
1047
1048 AT_SETUP([ofproto - basic flow_mod commands (OpenFlow 1.2)])
1049 OVS_VSWITCHD_START
1050 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip], [0], [OFPST_FLOW reply (OF1.2):
1051 ])
1052 AT_CHECK([echo 'in_port=2,actions=1' | ovs-ofctl -O OpenFlow12 add-flows br0 -])
1053 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 in_port=1,actions=2])
1054 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 table=1,in_port=4,actions=3])
1055 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1056  in_port=1 actions=output:2
1057  in_port=2 actions=output:1
1058  table=1, in_port=4 actions=output:3
1059 OFPST_FLOW reply (OF1.2):
1060 ])
1061 AT_CHECK([ovs-ofctl -O OpenFlow12 del-flows br0])
1062 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip], [0], [OFPST_FLOW reply (OF1.2):
1063 ])
1064 OVS_VSWITCHD_STOP
1065 AT_CLEANUP
1066
1067 AT_SETUP([ofproto - set-field flow_mod commands (OF1.2)])
1068 OVS_VSWITCHD_START
1069 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 ipv6,table=1,in_port=3,actions=drop])
1070 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])
1071 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])
1072 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1073  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
1074  table=1, ipv6,in_port=3 actions=set_field:fe80:123:4567:890a:a6ba:dbff:fefe:59fa->ipv6_src
1075 OFPST_FLOW reply (OF1.2):
1076 ])
1077 OVS_VSWITCHD_STOP
1078 AT_CLEANUP
1079
1080 AT_SETUP([ofproto - dump flows with cookie])
1081 OVS_VSWITCHD_START
1082 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x1,in_port=1,actions=1])
1083 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x2,in_port=2,actions=1])
1084 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x3,in_port=3,actions=1])
1085 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1086  cookie=0x1, in_port=1 actions=output:1
1087  cookie=0x2, in_port=2 actions=output:1
1088  cookie=0x3, in_port=3 actions=output:1
1089 NXST_FLOW reply:
1090 ])
1091 AT_CHECK([ovs-ofctl dump-aggregate br0 table=0 | strip_xids], [0], [dnl
1092 NXST_AGGREGATE reply: packet_count=0 byte_count=0 flow_count=3
1093 ])
1094 AT_CHECK([ovs-ofctl dump-flows br0 cookie=0x3/-1 | ofctl_strip | sort], [0], [dnl
1095  cookie=0x3, in_port=3 actions=output:1
1096 NXST_FLOW reply:
1097 ])
1098 AT_CHECK([ovs-ofctl dump-aggregate br0 cookie=0x3/-1 | strip_xids], [0], [dnl
1099 NXST_AGGREGATE reply: packet_count=0 byte_count=0 flow_count=1
1100 ])
1101 OVS_VSWITCHD_STOP
1102 AT_CLEANUP
1103
1104 AT_SETUP([ofproto - mod flow with cookie change (OpenFlow 1.0)])
1105 OVS_VSWITCHD_START
1106 AT_CHECK([ovs-ofctl -F openflow10 add-flow br0 cookie=0x1,in_port=1,actions=1])
1107 AT_CHECK([ovs-ofctl -F openflow10 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1108  cookie=0x1, in_port=1 actions=output:1
1109 OFPST_FLOW reply:
1110 ])
1111
1112 AT_CHECK([ovs-ofctl -F openflow10 mod-flows br0 cookie=0x2,in_port=1,actions=1])
1113 AT_CHECK([ovs-ofctl -F openflow10 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1114  cookie=0x2, in_port=1 actions=output:1
1115 OFPST_FLOW reply:
1116 ])
1117 OVS_VSWITCHD_STOP
1118 AT_CLEANUP
1119
1120 AT_SETUP([ofproto - mod flow with cookie change (NXM)])
1121 OVS_VSWITCHD_START
1122 AT_CHECK([ovs-ofctl -F nxm add-flow br0 cookie=0x1,in_port=1,actions=1])
1123 AT_CHECK([ovs-ofctl -F nxm dump-flows br0 | ofctl_strip | sort], [0], [dnl
1124  cookie=0x1, in_port=1 actions=output:1
1125 NXST_FLOW reply:
1126 ])
1127
1128 AT_CHECK([ovs-ofctl -F nxm mod-flows br0 cookie=0x2,in_port=1,actions=1])
1129 AT_CHECK([ovs-ofctl -F nxm dump-flows br0 | ofctl_strip | sort], [0], [dnl
1130  cookie=0x2, in_port=1 actions=output:1
1131 NXST_FLOW reply:
1132 ])
1133 OVS_VSWITCHD_STOP
1134 AT_CLEANUP
1135
1136 AT_SETUP([ofproto - no mod flow with cookie change (OpenFlow 1.1)])
1137 OVS_VSWITCHD_START
1138 AT_CHECK([ovs-ofctl -O OpenFlow11 add-flow br0 cookie=0x1,in_port=1,actions=1])
1139 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1140  cookie=0x1, in_port=1 actions=output:1
1141 OFPST_FLOW reply (OF1.1):
1142 ])
1143 AT_CHECK([ovs-ofctl -O OpenFlow11 mod-flows br0 cookie=0x2,in_port=1,actions=1])
1144 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1145  cookie=0x1, in_port=1 actions=output:1
1146 OFPST_FLOW reply (OF1.1):
1147 ])
1148 OVS_VSWITCHD_STOP
1149 AT_CLEANUP
1150
1151 dnl The OpenFlow 1.2 spec states that the cookie may not be modified
1152 AT_SETUP([ofproto - no mod flow with cookie change (OpenFlow 1.2)])
1153 OVS_VSWITCHD_START
1154 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 cookie=0x1,in_port=1,actions=1])
1155 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1156  cookie=0x1, in_port=1 actions=output:1
1157 OFPST_FLOW reply (OF1.2):
1158 ])
1159
1160 AT_CHECK([ovs-ofctl -O OpenFlow12 mod-flows br0 cookie=0x2,in_port=1,actions=1])
1161 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1162  cookie=0x1, in_port=1 actions=output:1
1163 OFPST_FLOW reply (OF1.2):
1164 ])
1165 OVS_VSWITCHD_STOP
1166 AT_CLEANUP
1167
1168 AT_SETUP([ofproto - mod flows based on cookie mask (OpenFlow 1.0)])
1169 OVS_VSWITCHD_START
1170 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x1,in_port=1,actions=1])
1171 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x1,in_port=2,actions=1])
1172 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x2,in_port=3,actions=1])
1173 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1174  cookie=0x1, in_port=1 actions=output:1
1175  cookie=0x1, in_port=2 actions=output:1
1176  cookie=0x2, in_port=3 actions=output:1
1177 NXST_FLOW reply:
1178 ])
1179
1180 AT_CHECK([ovs-ofctl -F nxm mod-flows br0 cookie=0x1/0xff,actions=4])
1181 AT_CHECK([ovs-ofctl -F nxm dump-flows br0 | ofctl_strip | sort], [0], [dnl
1182  cookie=0x1, in_port=1 actions=output:4
1183  cookie=0x1, in_port=2 actions=output:4
1184  cookie=0x2, in_port=3 actions=output:1
1185 NXST_FLOW reply:
1186 ])
1187 OVS_VSWITCHD_STOP
1188 AT_CLEANUP
1189
1190 AT_SETUP([ofproto - mod flows based on cookie mask (OpenFlow 1.1)])
1191 OVS_VSWITCHD_START
1192 AT_CHECK([ovs-ofctl -O OpenFlow11 add-flow br0 cookie=0x1,in_port=1,actions=1])
1193 AT_CHECK([ovs-ofctl -O OpenFlow11 add-flow br0 cookie=0x1,in_port=2,actions=1])
1194 AT_CHECK([ovs-ofctl -O OpenFlow11 add-flow br0 cookie=0x2,in_port=3,actions=1])
1195 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1196  cookie=0x1, in_port=1 actions=output:1
1197  cookie=0x1, in_port=2 actions=output:1
1198  cookie=0x2, in_port=3 actions=output:1
1199 OFPST_FLOW reply (OF1.1):
1200 ])
1201
1202 AT_CHECK([ovs-ofctl -O OpenFlow11 mod-flows br0 cookie=0x1/0xff,actions=4])
1203 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1204  cookie=0x1, in_port=1 actions=output:4
1205  cookie=0x1, in_port=2 actions=output:4
1206  cookie=0x2, in_port=3 actions=output:1
1207 OFPST_FLOW reply (OF1.1):
1208 ])
1209 OVS_VSWITCHD_STOP
1210 AT_CLEANUP
1211
1212 AT_SETUP([ofproto - mod flows based on cookie mask (OpenFlow 1.2)])
1213 OVS_VSWITCHD_START
1214 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 cookie=0x1,in_port=1,actions=1])
1215 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 cookie=0x1,in_port=2,actions=1])
1216 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 cookie=0x2,in_port=3,actions=1])
1217 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1218  cookie=0x1, in_port=1 actions=output:1
1219  cookie=0x1, in_port=2 actions=output:1
1220  cookie=0x2, in_port=3 actions=output:1
1221 OFPST_FLOW reply (OF1.2):
1222 ])
1223
1224 AT_CHECK([ovs-ofctl -O OpenFlow12 mod-flows br0 cookie=0x1/0xff,actions=4])
1225 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1226  cookie=0x1, in_port=1 actions=output:4
1227  cookie=0x1, in_port=2 actions=output:4
1228  cookie=0x2, in_port=3 actions=output:1
1229 OFPST_FLOW reply (OF1.2):
1230 ])
1231 OVS_VSWITCHD_STOP
1232 AT_CLEANUP
1233
1234 dnl The OpenFlow 1.2 spec states that the cookie may not be modified
1235 AT_SETUP([ofproto - mod flows based on cookie mask with cookie change])
1236 OVS_VSWITCHD_START
1237 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x1,in_port=1,actions=1])
1238 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x1,in_port=2,actions=1])
1239 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x2,in_port=3,actions=1])
1240 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1241  cookie=0x1, in_port=1 actions=output:1
1242  cookie=0x1, in_port=2 actions=output:1
1243  cookie=0x2, in_port=3 actions=output:1
1244 NXST_FLOW reply:
1245 ])
1246
1247 AT_CHECK([ovs-ofctl -F nxm mod-flows br0 cookie=1/-1,cookie=4,actions=4])
1248 AT_CHECK([ovs-ofctl -F nxm dump-flows br0 | ofctl_strip | sort], [0], [dnl
1249  cookie=0x2, in_port=3 actions=output:1
1250  cookie=0x4, in_port=1 actions=output:4
1251  cookie=0x4, in_port=2 actions=output:4
1252 NXST_FLOW reply:
1253 ])
1254 OVS_VSWITCHD_STOP
1255 AT_CLEANUP
1256
1257 AT_SETUP([ofproto - mod flow with cookie miss (mask==0) - NXM])
1258 OVS_VSWITCHD_START
1259 AT_CHECK([ovs-ofctl -F nxm mod-flows br0 in_port=1,actions=1])
1260 AT_CHECK([ovs-ofctl -F nxm dump-flows br0 | ofctl_strip | sort], [0], [dnl
1261  in_port=1 actions=output:1
1262 NXST_FLOW reply:
1263 ])
1264 OVS_VSWITCHD_STOP
1265 AT_CLEANUP
1266
1267 AT_SETUP([ofproto - mod flow with cookie miss (mask==0) - OF1.1])
1268 OVS_VSWITCHD_START
1269 AT_CHECK([ovs-ofctl -O openflow11 mod-flows br0 in_port=1,actions=1])
1270 AT_CHECK([ovs-ofctl -O openflow11 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1271  in_port=1 actions=output:1
1272 OFPST_FLOW reply (OF1.1):
1273 ])
1274 OVS_VSWITCHD_STOP
1275 AT_CLEANUP
1276
1277 AT_SETUP([ofproto - mod flow with cookie miss (mask==0) - OF1.2])
1278 OVS_VSWITCHD_START
1279 AT_CHECK([ovs-ofctl -O openflow12 mod-flows br0 in_port=1,actions=1])
1280 AT_CHECK([ovs-ofctl -O openflow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1281 OFPST_FLOW reply (OF1.2):
1282 ])
1283 OVS_VSWITCHD_STOP
1284 AT_CLEANUP
1285
1286 AT_SETUP([ofproto - mod flow with cookie miss (mask!=0) - NXM])
1287 OVS_VSWITCHD_START
1288 AT_CHECK([ovs-ofctl -F nxm mod-flows br0 cookie=1/1,in_port=1,actions=1])
1289 AT_CHECK([ovs-ofctl -F nxm dump-flows br0 | ofctl_strip | sort], [0], [dnl
1290 NXST_FLOW reply:
1291 ])
1292 OVS_VSWITCHD_STOP
1293 AT_CLEANUP
1294
1295 AT_SETUP([ofproto - mod flow with cookie miss (mask!=0) - OF1.1])
1296 OVS_VSWITCHD_START
1297 AT_CHECK([ovs-ofctl -O openflow11 mod-flows br0 cookie=1/1,in_port=1,actions=1])
1298 AT_CHECK([ovs-ofctl -O openflow11 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1299 OFPST_FLOW reply (OF1.1):
1300 ])
1301 OVS_VSWITCHD_STOP
1302 AT_CLEANUP
1303
1304 AT_SETUP([ofproto - mod flow with cookie miss (mask!=0) - OF1.2])
1305 OVS_VSWITCHD_START
1306 AT_CHECK([ovs-ofctl -O openflow12 mod-flows br0 cookie=1/1,in_port=1,actions=1])
1307 AT_CHECK([ovs-ofctl -O openflow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1308 OFPST_FLOW reply (OF1.2):
1309 ])
1310 OVS_VSWITCHD_STOP
1311 AT_CLEANUP
1312
1313 AT_SETUP([ofproto - del flows with cookies])
1314 OVS_VSWITCHD_START
1315 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x1,in_port=1,actions=1])
1316 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x2,in_port=2,actions=1])
1317 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x3,in_port=3,actions=1])
1318 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1319  cookie=0x1, in_port=1 actions=output:1
1320  cookie=0x2, in_port=2 actions=output:1
1321  cookie=0x3, in_port=3 actions=output:1
1322 NXST_FLOW reply:
1323 ])
1324
1325 AT_CHECK([ovs-ofctl del-flows br0])
1326 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1327 NXST_FLOW reply:
1328 ])
1329 OVS_VSWITCHD_STOP
1330 AT_CLEANUP
1331
1332 AT_SETUP([ofproto - del flows based on cookie])
1333 OVS_VSWITCHD_START
1334 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x1,in_port=1,actions=1])
1335 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x2,in_port=2,actions=1])
1336 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x3,in_port=3,actions=1])
1337 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1338  cookie=0x1, in_port=1 actions=output:1
1339  cookie=0x2, in_port=2 actions=output:1
1340  cookie=0x3, in_port=3 actions=output:1
1341 NXST_FLOW reply:
1342 ])
1343
1344 AT_CHECK([ovs-ofctl del-flows br0 cookie=0x3/-1])
1345 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1346  cookie=0x1, in_port=1 actions=output:1
1347  cookie=0x2, in_port=2 actions=output:1
1348 NXST_FLOW reply:
1349 ])
1350 OVS_VSWITCHD_STOP
1351 AT_CLEANUP
1352
1353 AT_SETUP([ofproto - del flows based on cookie mask])
1354 OVS_VSWITCHD_START
1355 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x1,in_port=1,actions=1])
1356 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x2,in_port=2,actions=1])
1357 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x3,in_port=3,actions=1])
1358 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1359  cookie=0x1, in_port=1 actions=output:1
1360  cookie=0x2, in_port=2 actions=output:1
1361  cookie=0x3, in_port=3 actions=output:1
1362 NXST_FLOW reply:
1363 ])
1364 AT_CHECK([ovs-ofctl del-flows br0 cookie=0x3/0x1])
1365 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1366  cookie=0x2, in_port=2 actions=output:1
1367 NXST_FLOW reply:
1368 ])
1369 OVS_VSWITCHD_STOP
1370 AT_CLEANUP
1371
1372 AT_SETUP([ofproto - del flows based on table id (NXM)])
1373 OVS_VSWITCHD_START
1374 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x1,in_port=1,actions=1])
1375 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x2,in_port=2,table=1,actions=1])
1376 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1377  cookie=0x1, in_port=1 actions=output:1
1378  cookie=0x2, table=1, in_port=2 actions=output:1
1379 NXST_FLOW reply:
1380 ])
1381 AT_CHECK([ovs-ofctl del-flows br0 table=0])
1382 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1383  cookie=0x2, table=1, in_port=2 actions=output:1
1384 NXST_FLOW reply:
1385 ])
1386 AT_CHECK([ovs-ofctl del-flows br0 table=1])
1387 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1388 NXST_FLOW reply:
1389 ])
1390 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x1,in_port=1,actions=1])
1391 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x2,in_port=2,table=1,actions=1])
1392 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1393  cookie=0x1, in_port=1 actions=output:1
1394  cookie=0x2, table=1, in_port=2 actions=output:1
1395 NXST_FLOW reply:
1396 ])
1397 AT_CHECK([ovs-ofctl del-flows br0])
1398 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1399 NXST_FLOW reply:
1400 ])
1401 OVS_VSWITCHD_STOP
1402 AT_CLEANUP
1403
1404 AT_SETUP([ofproto - del flows based on table id (OpenFlow 1.1)])
1405 OVS_VSWITCHD_START
1406 AT_CHECK([ovs-ofctl -O OpenFlow11 add-flow br0 cookie=0x1,in_port=1,actions=1])
1407 AT_CHECK([ovs-ofctl -O OpenFlow11 add-flow br0 cookie=0x2,in_port=2,table=1,actions=1])
1408 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1409  cookie=0x1, in_port=1 actions=output:1
1410  cookie=0x2, table=1, in_port=2 actions=output:1
1411 OFPST_FLOW reply (OF1.1):
1412 ])
1413 AT_CHECK([ovs-ofctl -O OpenFlow11 del-flows br0 table=0])
1414 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1415  cookie=0x2, table=1, in_port=2 actions=output:1
1416 OFPST_FLOW reply (OF1.1):
1417 ])
1418 AT_CHECK([ovs-ofctl -O OpenFlow11 del-flows br0 table=1])
1419 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1420 OFPST_FLOW reply (OF1.1):
1421 ])
1422 AT_CHECK([ovs-ofctl -O OpenFlow11 add-flow br0 cookie=0x1,in_port=1,actions=1])
1423 AT_CHECK([ovs-ofctl -O OpenFlow11 add-flow br0 cookie=0x2,in_port=2,table=1,actions=1])
1424 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1425  cookie=0x1, in_port=1 actions=output:1
1426  cookie=0x2, table=1, in_port=2 actions=output:1
1427 OFPST_FLOW reply (OF1.1):
1428 ])
1429 AT_CHECK([ovs-ofctl -O OpenFlow11 del-flows br0])
1430 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip], [0], [dnl
1431 OFPST_FLOW reply (OF1.1):
1432  cookie=0x2, table=1, in_port=2 actions=output:1
1433 ])
1434 OVS_VSWITCHD_STOP
1435 AT_CLEANUP
1436
1437 AT_SETUP([ofproto - del flows based on table id (OpenFlow 1.2)])
1438 OVS_VSWITCHD_START
1439 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 cookie=0x1,in_port=1,actions=1])
1440 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 cookie=0x2,in_port=2,table=1,actions=1])
1441 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1442  cookie=0x1, in_port=1 actions=output:1
1443  cookie=0x2, table=1, in_port=2 actions=output:1
1444 OFPST_FLOW reply (OF1.2):
1445 ])
1446 AT_CHECK([ovs-ofctl -O OpenFlow12 del-flows br0 table=0])
1447 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1448  cookie=0x2, table=1, in_port=2 actions=output:1
1449 OFPST_FLOW reply (OF1.2):
1450 ])
1451 AT_CHECK([ovs-ofctl -O OpenFlow12 del-flows br0 table=1])
1452 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1453 OFPST_FLOW reply (OF1.2):
1454 ])
1455 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 cookie=0x1,in_port=1,actions=1])
1456 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 cookie=0x2,in_port=2,table=1,actions=1])
1457 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1458  cookie=0x1, in_port=1 actions=output:1
1459  cookie=0x2, table=1, in_port=2 actions=output:1
1460 OFPST_FLOW reply (OF1.2):
1461 ])
1462 AT_CHECK([ovs-ofctl -O OpenFlow12 del-flows br0])
1463 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1464 OFPST_FLOW reply (OF1.2):
1465 ])
1466 OVS_VSWITCHD_STOP
1467 AT_CLEANUP
1468
1469 AT_SETUP([ofproto - flow_mod with out_port matching (OpenFlow 1.0)])
1470 OVS_VSWITCHD_START
1471 AT_DATA([flows.txt], [dnl
1472  in_port=1 actions=output:2
1473  in_port=2 actions=output:1,output:2,output:3
1474  in_port=3 actions=output:3,output:1,output:2
1475  in_port=4 actions=drop
1476  in_port=5 actions=output:3
1477  in_port=6 actions=output:1
1478 ])
1479 AT_CHECK([ovs-ofctl -F openflow10 add-flows br0 flows.txt])
1480 (cat flows.txt; echo 'OFPST_FLOW reply:') > expout
1481 AT_CHECK([ovs-ofctl -F openflow10 dump-flows br0 | ofctl_strip | sort], [0],
1482   [expout])
1483
1484 (grep 'output:2' flows.txt; echo 'OFPST_FLOW reply:') > expout
1485 AT_CHECK([ovs-ofctl -F openflow10 dump-flows br0 out_port=2 | ofctl_strip | sort], [0], [expout])
1486
1487 AT_CHECK([ovs-ofctl -F openflow10 del-flows br0 out_port=2])
1488 (grep -v 'output:2' flows.txt; echo 'OFPST_FLOW reply:') > expout
1489 AT_CHECK([ovs-ofctl -F openflow10 dump-flows br0 | ofctl_strip | sort], [0],
1490   [expout])
1491
1492 AT_CHECK([ovs-ofctl -F openflow10 del-flows br0 out_port=3])
1493 (grep -v 'output:[[23]]' flows.txt; echo 'OFPST_FLOW reply:') > expout
1494 AT_CHECK([ovs-ofctl -F openflow10 dump-flows br0 | ofctl_strip | sort], [0],
1495   [expout])
1496
1497 AT_CHECK([ovs-ofctl -F openflow10 del-flows br0 out_port=1])
1498 (grep -v 'output:[[123]]' flows.txt; echo 'OFPST_FLOW reply:') > expout
1499 AT_CHECK([ovs-ofctl -F openflow10 dump-flows br0 | ofctl_strip | sort], [0],
1500   [expout])
1501
1502 OVS_VSWITCHD_STOP
1503 AT_CLEANUP
1504
1505 AT_SETUP([ofproto - flow_mod with out_port matching (OpenFlow 1.1)])
1506 OVS_VSWITCHD_START
1507 AT_DATA([flows.txt], [dnl
1508  in_port=1 actions=output:2
1509  in_port=2 actions=output:1,write_actions(output:2,output:3)
1510  in_port=3 actions=output:3,output:1,write_actions(output:2)
1511  in_port=4 actions=drop
1512  in_port=5 actions=write_actions(output:3)
1513  in_port=6 actions=output:1
1514 ])
1515 AT_CHECK([ovs-ofctl -O OpenFlow11 add-flows br0 flows.txt])
1516 (cat flows.txt; echo 'OFPST_FLOW reply (OF1.1):') > expout
1517 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0],
1518   [expout])
1519
1520 (grep 'output:2' flows.txt; echo 'OFPST_FLOW reply (OF1.1):') > expout
1521 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 out_port=2 | ofctl_strip | sort], [0], [expout])
1522
1523 AT_CHECK([ovs-ofctl -O OpenFlow11 del-flows br0 out_port=2])
1524 (grep -v 'output:2' flows.txt; echo 'OFPST_FLOW reply (OF1.1):') > expout
1525 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0],
1526   [expout])
1527
1528 AT_CHECK([ovs-ofctl -O OpenFlow11 del-flows br0 out_port=3])
1529 (grep -v 'output:[[23]]' flows.txt; echo 'OFPST_FLOW reply (OF1.1):') > expout
1530 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0],
1531   [expout])
1532
1533 AT_CHECK([ovs-ofctl -O OpenFlow11 del-flows br0 out_port=1])
1534 (grep -v 'output:[[123]]' flows.txt; echo 'OFPST_FLOW reply (OF1.1):') > expout
1535 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0],
1536   [expout])
1537
1538 OVS_VSWITCHD_STOP
1539 AT_CLEANUP
1540
1541 AT_SETUP([ofproto - flow_mod with out_group matching (OpenFlow 1.1)])
1542 OVS_VSWITCHD_START
1543 AT_DATA([groups.txt], [dnl
1544 group_id=1,type=all,bucket=output:10
1545 group_id=2,type=all,bucket=output:10
1546 group_id=3,type=all,bucket=output:10
1547 ])
1548 AT_CHECK([ovs-ofctl -O OpenFlow11 add-groups br0 groups.txt])
1549 AT_DATA([flows.txt], [dnl
1550  in_port=1 actions=group:2,output:5
1551  in_port=2 actions=group:1,write_actions(group:2,group:3,output:6)
1552  in_port=3 actions=group:3,group:1,write_actions(group:2,output:3)
1553  in_port=4 actions=output:4
1554  in_port=5 actions=write_actions(output:4,group:3)
1555  in_port=6 actions=group:1
1556 ])
1557 AT_CHECK([ovs-ofctl -O OpenFlow11 add-flows br0 flows.txt])
1558 (cat flows.txt; echo 'OFPST_FLOW reply (OF1.1):') > expout
1559 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0],
1560   [expout])
1561
1562 (grep 'output:3' flows.txt | grep 'group:2'; echo 'OFPST_FLOW reply (OF1.1):') > expout
1563 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 out_port=3,out_group=2 | ofctl_strip | sort], [0], [expout])
1564
1565 AT_CHECK([ovs-ofctl -O OpenFlow11 del-flows br0 out_group=2])
1566 (grep -v 'group:2' flows.txt; echo 'OFPST_FLOW reply (OF1.1):') > expout
1567 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0],
1568   [expout])
1569
1570 AT_CHECK([ovs-ofctl -O OpenFlow11 del-flows br0 out_group=3])
1571 (grep -v 'group:[[23]]' flows.txt; echo 'OFPST_FLOW reply (OF1.1):') > expout
1572 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0],
1573   [expout])
1574
1575 AT_CHECK([ovs-ofctl -O OpenFlow11 del-flows br0 out_group=1])
1576 (grep -v 'group:[[123]]' flows.txt; echo 'OFPST_FLOW reply (OF1.1):') > expout
1577 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0],
1578   [expout])
1579
1580 OVS_VSWITCHD_STOP
1581 AT_CLEANUP
1582
1583 AT_SETUP([ofproto - flow table configuration (OpenFlow 1.0)])
1584 OVS_VSWITCHD_START
1585 # Check the default configuration.
1586 head_table() {
1587     printf 'OFPST_TABLE reply (xid=0x2):
1588   table 0 ("%s"):
1589     active=0, lookup=0, matched=0
1590     max_entries=1000000
1591     matching:
1592       in_port: exact match or wildcard
1593       eth_src: exact match or wildcard
1594       eth_dst: exact match or wildcard
1595       eth_type: exact match or wildcard
1596       vlan_vid: exact match or wildcard
1597       vlan_pcp: exact match or wildcard
1598       ip_src: exact match or wildcard
1599       ip_dst: exact match or wildcard
1600       nw_proto: exact match or wildcard
1601       nw_tos: exact match or wildcard
1602       tcp_src: exact match or wildcard
1603       tcp_dst: exact match or wildcard
1604
1605 ' $1
1606 }
1607 ditto() {
1608     for i in `seq $1 $2`; do
1609         printf '  table %d ("table%d"): ditto\n' $i $i
1610     done
1611 }
1612 (head_table classifier; ditto 1 253) > expout
1613 AT_CHECK([ovs-ofctl dump-tables br0], [0], [expout])
1614 # Change the configuration.
1615 AT_CHECK(
1616   [ovs-vsctl \
1617      -- --id=@t0 create Flow_Table name=main \
1618      -- --id=@t1 create Flow_Table flow-limit=1024 \
1619      -- set bridge br0 'flow_tables={1=@t1,0=@t0}' \
1620    | ${PERL} $srcdir/uuidfilt.pl],
1621   [0], [<0>
1622 <1>
1623 ])
1624 # Check that the configuration was updated.
1625 (head_table main; echo '  table 1 ("table1"):
1626     active=0, lookup=0, matched=0
1627     max_entries=1024
1628     (same matching)
1629
1630   table 2 ("table2"):
1631     active=0, lookup=0, matched=0
1632     max_entries=1000000
1633     (same matching)
1634 '; ditto 3 253) > expout
1635 AT_CHECK([ovs-ofctl dump-tables br0], [0], [expout])
1636 OVS_VSWITCHD_STOP
1637 AT_CLEANUP
1638
1639 dnl In-band and fail-open add "hidden rules" to table 0.  These rules shouldn't
1640 dnl be visible to OpenFlow.  This test checks that "dump-flows" and
1641 dnl "dump-tables" don't make them visible.
1642 AT_SETUP([ofproto - hidden rules not in table stats])
1643 # Use an IP address for a controller that won't actually exist: we
1644 # want to create in-band rules but we do not want to actually connect
1645 # to a controller (because that could mess about with our test).  The
1646 # Class E range 240.0.0.0 - 255.255.255.255 seems like a good choice.
1647 OVS_VSWITCHD_START([set-controller br0 tcp:240.0.0.1:6653])
1648 for i in 1 2 3 4 5; do ovs-appctl time/warp 1000; done
1649
1650 # Check that no hidden flows are visible in OpenFlow.
1651 AT_CHECK([ovs-ofctl dump-flows br0], [0], [NXST_FLOW reply (xid=0x4):
1652 ])
1653
1654 # Check that some hidden flows related to 240.0.0.1 are actually in table 0.
1655 #
1656 # We discard flows that mention table_id because we only want table 0 flows,
1657 # which in OVS is implied by the absence of a table_id.
1658 AT_CHECK([ovs-appctl bridge/dump-flows br0], [0], [stdout])
1659 AT_CHECK([test `grep '240\.0\.0\.1' stdout | grep -v table_id= | wc -l` -gt 0])
1660
1661 # Check that dump-tables doesn't count the hidden flows.
1662 head_table() {
1663     printf 'OFPST_TABLE reply (xid=0x2):
1664   table 0 ("%s"):
1665     active=0, lookup=0, matched=0
1666     max_entries=1000000
1667     matching:
1668       in_port: exact match or wildcard
1669       eth_src: exact match or wildcard
1670       eth_dst: exact match or wildcard
1671       eth_type: exact match or wildcard
1672       vlan_vid: exact match or wildcard
1673       vlan_pcp: exact match or wildcard
1674       ip_src: exact match or wildcard
1675       ip_dst: exact match or wildcard
1676       nw_proto: exact match or wildcard
1677       nw_tos: exact match or wildcard
1678       tcp_src: exact match or wildcard
1679       tcp_dst: exact match or wildcard
1680
1681 ' $1
1682 }
1683 ditto() {
1684     for i in `seq $1 $2`; do
1685         printf '  table %d ("table%d"): ditto\n' $i $i
1686     done
1687 }
1688 (head_table classifier; ditto 1 253) > expout
1689 AT_CHECK([ovs-ofctl dump-tables br0], [0], [expout])
1690 OVS_VSWITCHD_STOP(["/240\.0\.0\.1/d"])
1691 AT_CLEANUP
1692
1693 AT_SETUP([ofproto - flow table configuration (OpenFlow 1.2)])
1694 OVS_VSWITCHD_START
1695 # Check the default configuration.
1696 head_table() {
1697     printf 'OFPST_TABLE reply (OF1.2) (xid=0x2):
1698   table 0 ("%s"):
1699     active=0, lookup=0, matched=0
1700     metadata: match=0xffffffffffffffff write=0xffffffffffffffff
1701     config=controller
1702     max_entries=1000000
1703     instructions (table miss and others):
1704       instructions: apply_actions,clear_actions,write_actions,write_metadata,goto_table
1705       Write-Actions and Apply-Actions features:
1706         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
1707         supported on Set-Field: metadata in_port_oxm eth_src eth_dst vlan_vid vlan_pcp mpls_label mpls_tc ip_src ip_dst ipv6_src ipv6_dst ipv6_label ip_dscp nw_ecn arp_op arp_spa arp_tpa arp_sha arp_tha tcp_src tcp_dst udp_src udp_dst sctp_src sctp_dst icmp_type icmp_code icmpv6_type icmpv6_code nd_target nd_sll nd_tll
1708     matching:
1709       metadata: exact match or wildcard
1710       in_port_oxm: exact match or wildcard
1711       eth_src: exact match or wildcard
1712       eth_dst: exact match or wildcard
1713       eth_type: exact match or wildcard
1714       vlan_vid: exact match or wildcard
1715       vlan_pcp: exact match or wildcard
1716       mpls_label: exact match or wildcard
1717       mpls_tc: exact match or wildcard
1718       ip_src: exact match or wildcard
1719       ip_dst: exact match or wildcard
1720       ipv6_src: exact match or wildcard
1721       ipv6_dst: exact match or wildcard
1722       ipv6_label: exact match or wildcard
1723       nw_proto: exact match or wildcard
1724       ip_dscp: exact match or wildcard
1725       nw_ecn: exact match or wildcard
1726       arp_op: exact match or wildcard
1727       arp_spa: exact match or wildcard
1728       arp_tpa: exact match or wildcard
1729       arp_sha: exact match or wildcard
1730       arp_tha: exact match or wildcard
1731       tcp_src: exact match or wildcard
1732       tcp_dst: exact match or wildcard
1733       udp_src: exact match or wildcard
1734       udp_dst: exact match or wildcard
1735       sctp_src: exact match or wildcard
1736       sctp_dst: exact match or wildcard
1737       icmp_type: exact match or wildcard
1738       icmp_code: exact match or wildcard
1739       icmpv6_type: exact match or wildcard
1740       icmpv6_code: exact match or wildcard
1741       nd_target: exact match or wildcard
1742       nd_sll: exact match or wildcard
1743       nd_tll: exact match or wildcard
1744
1745 ' $1
1746 }
1747 ditto() {
1748     for i in `seq $1 $2`; do
1749         printf '  table %d ("table%d"): ditto\n' $i $i
1750     done
1751 }
1752 tail_table() {
1753     printf '  table 253 ("table253"):
1754     active=0, lookup=0, matched=0
1755     metadata: match=0xffffffffffffffff write=0xffffffffffffffff
1756     config=controller
1757     max_entries=1000000
1758     instructions (table miss and others):
1759       instructions: apply_actions,clear_actions,write_actions,write_metadata
1760       (same actions)
1761     (same matching)
1762 '
1763 }
1764 (head_table classifier; ditto 1 252; tail_table) > expout
1765 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-tables br0], [0], [expout])
1766 # Change the configuration.
1767 AT_CHECK(
1768   [ovs-vsctl \
1769      -- --id=@t0 create Flow_Table name=main \
1770      -- --id=@t1 create Flow_Table flow-limit=1024 \
1771      -- set bridge br0 'flow_tables={1=@t1,0=@t0}' \
1772    | ${PERL} $srcdir/uuidfilt.pl],
1773   [0], [<0>
1774 <1>
1775 ])
1776 # Check that the configuration was updated.
1777 (head_table main; echo '  table 1 ("table1"):
1778     active=0, lookup=0, matched=0
1779     metadata: match=0xffffffffffffffff write=0xffffffffffffffff
1780     config=controller
1781     max_entries=1024
1782     (same instructions)
1783     (same matching)
1784
1785   table 2 ("table2"):
1786     active=0, lookup=0, matched=0
1787     metadata: match=0xffffffffffffffff write=0xffffffffffffffff
1788     config=controller
1789     max_entries=1000000
1790     (same instructions)
1791     (same matching)
1792 '; ditto 3 252; tail_table) > expout
1793 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-tables br0], [0], [expout])
1794 OVS_VSWITCHD_STOP
1795 AT_CLEANUP
1796
1797 AT_SETUP([ofproto - table features (OpenFlow 1.3)])
1798 OVS_VSWITCHD_START
1799 head_table () {
1800     printf '  table 0 ("%s"):
1801     metadata: match=0xffffffffffffffff write=0xffffffffffffffff
1802     max_entries=1000000
1803     instructions (table miss and others):
1804       next tables: 1-253
1805       instructions: meter,apply_actions,clear_actions,write_actions,write_metadata,goto_table
1806       Write-Actions and Apply-Actions features:
1807         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
1808         supported on Set-Field: tun_id tun_src tun_dst tun_ipv6_src tun_ipv6_dst tun_flags tun_gbp_id tun_gbp_flags tun_metadata0 dnl
1809 tun_metadata1 tun_metadata2 tun_metadata3 tun_metadata4 tun_metadata5 tun_metadata6 tun_metadata7 tun_metadata8 tun_metadata9 tun_metadata10 tun_metadata11 tun_metadata12 tun_metadata13 tun_metadata14 tun_metadata15 tun_metadata16 tun_metadata17 tun_metadata18 tun_metadata19 tun_metadata20 tun_metadata21 tun_metadata22 tun_metadata23 tun_metadata24 tun_metadata25 tun_metadata26 tun_metadata27 tun_metadata28 tun_metadata29 tun_metadata30 tun_metadata31 tun_metadata32 tun_metadata33 tun_metadata34 tun_metadata35 tun_metadata36 tun_metadata37 tun_metadata38 tun_metadata39 tun_metadata40 tun_metadata41 tun_metadata42 tun_metadata43 tun_metadata44 tun_metadata45 tun_metadata46 tun_metadata47 tun_metadata48 tun_metadata49 tun_metadata50 tun_metadata51 tun_metadata52 tun_metadata53 tun_metadata54 tun_metadata55 tun_metadata56 tun_metadata57 tun_metadata58 tun_metadata59 tun_metadata60 tun_metadata61 tun_metadata62 tun_metadata63 dnl
1810 metadata in_port in_port_oxm pkt_mark ct_mark ct_label reg0 reg1 reg2 reg3 reg4 reg5 reg6 reg7 reg8 reg9 reg10 reg11 reg12 reg13 reg14 reg15 xreg0 xreg1 xreg2 xreg3 xreg4 xreg5 xreg6 xreg7 xxreg0 xxreg1 xxreg2 xxreg3 eth_src eth_dst vlan_tci vlan_vid vlan_pcp mpls_label mpls_tc mpls_ttl ip_src ip_dst ipv6_src ipv6_dst ipv6_label nw_tos ip_dscp nw_ecn nw_ttl arp_op arp_spa arp_tpa arp_sha arp_tha tcp_src tcp_dst udp_src udp_dst sctp_src sctp_dst icmp_type icmp_code icmpv6_type icmpv6_code nd_target nd_sll nd_tll
1811     matching:
1812       dp_hash: arbitrary mask
1813       recirc_id: exact match or wildcard
1814       conj_id: exact match or wildcard
1815       tun_id: arbitrary mask
1816       tun_src: arbitrary mask
1817       tun_dst: arbitrary mask
1818       tun_ipv6_src: arbitrary mask
1819       tun_ipv6_dst: arbitrary mask
1820       tun_flags: arbitrary mask
1821       tun_gbp_id: arbitrary mask
1822       tun_gbp_flags: arbitrary mask
1823       tun_metadata0: arbitrary mask
1824       tun_metadata1: arbitrary mask
1825       tun_metadata2: arbitrary mask
1826       tun_metadata3: arbitrary mask
1827       tun_metadata4: arbitrary mask
1828       tun_metadata5: arbitrary mask
1829       tun_metadata6: arbitrary mask
1830       tun_metadata7: arbitrary mask
1831       tun_metadata8: arbitrary mask
1832       tun_metadata9: arbitrary mask
1833       tun_metadata10: arbitrary mask
1834       tun_metadata11: arbitrary mask
1835       tun_metadata12: arbitrary mask
1836       tun_metadata13: arbitrary mask
1837       tun_metadata14: arbitrary mask
1838       tun_metadata15: arbitrary mask
1839       tun_metadata16: arbitrary mask
1840       tun_metadata17: arbitrary mask
1841       tun_metadata18: arbitrary mask
1842       tun_metadata19: arbitrary mask
1843       tun_metadata20: arbitrary mask
1844       tun_metadata21: arbitrary mask
1845       tun_metadata22: arbitrary mask
1846       tun_metadata23: arbitrary mask
1847       tun_metadata24: arbitrary mask
1848       tun_metadata25: arbitrary mask
1849       tun_metadata26: arbitrary mask
1850       tun_metadata27: arbitrary mask
1851       tun_metadata28: arbitrary mask
1852       tun_metadata29: arbitrary mask
1853       tun_metadata30: arbitrary mask
1854       tun_metadata31: arbitrary mask
1855       tun_metadata32: arbitrary mask
1856       tun_metadata33: arbitrary mask
1857       tun_metadata34: arbitrary mask
1858       tun_metadata35: arbitrary mask
1859       tun_metadata36: arbitrary mask
1860       tun_metadata37: arbitrary mask
1861       tun_metadata38: arbitrary mask
1862       tun_metadata39: arbitrary mask
1863       tun_metadata40: arbitrary mask
1864       tun_metadata41: arbitrary mask
1865       tun_metadata42: arbitrary mask
1866       tun_metadata43: arbitrary mask
1867       tun_metadata44: arbitrary mask
1868       tun_metadata45: arbitrary mask
1869       tun_metadata46: arbitrary mask
1870       tun_metadata47: arbitrary mask
1871       tun_metadata48: arbitrary mask
1872       tun_metadata49: arbitrary mask
1873       tun_metadata50: arbitrary mask
1874       tun_metadata51: arbitrary mask
1875       tun_metadata52: arbitrary mask
1876       tun_metadata53: arbitrary mask
1877       tun_metadata54: arbitrary mask
1878       tun_metadata55: arbitrary mask
1879       tun_metadata56: arbitrary mask
1880       tun_metadata57: arbitrary mask
1881       tun_metadata58: arbitrary mask
1882       tun_metadata59: arbitrary mask
1883       tun_metadata60: arbitrary mask
1884       tun_metadata61: arbitrary mask
1885       tun_metadata62: arbitrary mask
1886       tun_metadata63: arbitrary mask
1887       metadata: arbitrary mask
1888       in_port: exact match or wildcard
1889       in_port_oxm: exact match or wildcard
1890       actset_output: exact match or wildcard
1891       pkt_mark: arbitrary mask
1892       ct_state: arbitrary mask
1893       ct_zone: exact match or wildcard
1894       ct_mark: arbitrary mask
1895       ct_label: arbitrary mask
1896       reg0: arbitrary mask
1897       reg1: arbitrary mask
1898       reg2: arbitrary mask
1899       reg3: arbitrary mask
1900       reg4: arbitrary mask
1901       reg5: arbitrary mask
1902       reg6: arbitrary mask
1903       reg7: arbitrary mask
1904       reg8: arbitrary mask
1905       reg9: arbitrary mask
1906       reg10: arbitrary mask
1907       reg11: arbitrary mask
1908       reg12: arbitrary mask
1909       reg13: arbitrary mask
1910       reg14: arbitrary mask
1911       reg15: arbitrary mask
1912       xreg0: arbitrary mask
1913       xreg1: arbitrary mask
1914       xreg2: arbitrary mask
1915       xreg3: arbitrary mask
1916       xreg4: arbitrary mask
1917       xreg5: arbitrary mask
1918       xreg6: arbitrary mask
1919       xreg7: arbitrary mask
1920       xxreg0: arbitrary mask
1921       xxreg1: arbitrary mask
1922       xxreg2: arbitrary mask
1923       xxreg3: arbitrary mask
1924       eth_src: arbitrary mask
1925       eth_dst: arbitrary mask
1926       eth_type: exact match or wildcard
1927       vlan_tci: arbitrary mask
1928       vlan_vid: arbitrary mask
1929       vlan_pcp: exact match or wildcard
1930       mpls_label: exact match or wildcard
1931       mpls_tc: exact match or wildcard
1932       mpls_bos: exact match or wildcard
1933       mpls_ttl: exact match or wildcard
1934       ip_src: arbitrary mask
1935       ip_dst: arbitrary mask
1936       ipv6_src: arbitrary mask
1937       ipv6_dst: arbitrary mask
1938       ipv6_label: arbitrary mask
1939       nw_proto: exact match or wildcard
1940       nw_tos: exact match or wildcard
1941       ip_dscp: exact match or wildcard
1942       nw_ecn: exact match or wildcard
1943       nw_ttl: exact match or wildcard
1944       ip_frag: arbitrary mask
1945       arp_op: exact match or wildcard
1946       arp_spa: arbitrary mask
1947       arp_tpa: arbitrary mask
1948       arp_sha: arbitrary mask
1949       arp_tha: arbitrary mask
1950       tcp_src: arbitrary mask
1951       tcp_dst: arbitrary mask
1952       tcp_flags: arbitrary mask
1953       udp_src: arbitrary mask
1954       udp_dst: arbitrary mask
1955       sctp_src: arbitrary mask
1956       sctp_dst: arbitrary mask
1957       icmp_type: exact match or wildcard
1958       icmp_code: exact match or wildcard
1959       icmpv6_type: exact match or wildcard
1960       icmpv6_code: exact match or wildcard
1961       nd_target: arbitrary mask
1962       nd_sll: arbitrary mask
1963       nd_tll: arbitrary mask
1964
1965 ' $1
1966 }
1967 ditto() {
1968     printf '  table %d ("%s"):
1969     metadata: match=0xffffffffffffffff write=0xffffffffffffffff
1970     max_entries=%d
1971     instructions (table miss and others):
1972       next tables: %d-253
1973       (same instructions)
1974       (same actions)
1975     (same matching)
1976
1977 ' $1 $2 $3 `expr $1 + 1`
1978 }
1979 tail_tables() {
1980 echo '  table 252 ("table252"):
1981     metadata: match=0xffffffffffffffff write=0xffffffffffffffff
1982     max_entries=1000000
1983     instructions (table miss and others):
1984       next tables: 253
1985       (same instructions)
1986       (same actions)
1987     (same matching)
1988
1989   table 253 ("table253"):
1990     metadata: match=0xffffffffffffffff write=0xffffffffffffffff
1991     max_entries=1000000
1992     instructions (table miss and others):
1993       instructions: meter,apply_actions,clear_actions,write_actions,write_metadata
1994       (same actions)
1995     (same matching)
1996 '
1997 }
1998 (head_table classifier
1999  for i in `seq 1 251`; do
2000      ditto $i table$i 1000000
2001  done
2002  tail_tables) > expout
2003 AT_CHECK([ovs-ofctl -O OpenFlow13 dump-table-features br0], [0], [expout])
2004 # Change the configuration.
2005 AT_CHECK(
2006   [ovs-vsctl \
2007      -- --id=@t0 create Flow_Table name=main \
2008      -- --id=@t1 create Flow_Table flow-limit=1024 \
2009      -- set bridge br0 'flow_tables={1=@t1,0=@t0}' \
2010    | ${PERL} $srcdir/uuidfilt.pl],
2011   [0], [<0>
2012 <1>
2013 ])
2014 # Check that the configuration was updated.
2015 (head_table main
2016  ditto 1 table1 1024
2017  for i in `seq 2 251`; do
2018      ditto $i table$i 1000000
2019  done
2020  tail_tables) > expout
2021 AT_CHECK([ovs-ofctl -O OpenFlow13 dump-table-features br0], [0], [expout])
2022 OVS_VSWITCHD_STOP
2023 AT_CLEANUP
2024
2025 AT_SETUP([ofproto - table description (OpenFlow 1.4)])
2026 OVS_VSWITCHD_START
2027 (x=0
2028  while test $x -lt 254; do
2029    y=`expr $x + 1`
2030    echo "  table $x:
2031    eviction=off eviction_flags=OTHER|IMPORTANCE|LIFETIME
2032    vacancy=off"
2033    x=$y
2034  done) > expout
2035 AT_CHECK([ovs-ofctl -O OpenFlow14 dump-table-desc br0 | sed '/^$/d
2036 /^OFPST_TABLE_DESC/d'], [0], [expout])
2037
2038 # Change the configuration.
2039 AT_CHECK([ovs-ofctl -O Openflow14 mod-table br0 0 evict])
2040 # Check that the configuration was updated.
2041 mv expout orig-expout
2042 sed -e '2s/eviction=off/eviction=on/' <orig-expout > expout
2043 AT_CHECK([ovs-ofctl -O OpenFlow14 dump-table-desc br0 | sed '/^$/d
2044 /^OFPST_TABLE_DESC/d'], [0], [expout])
2045
2046 AT_CHECK([ovs-ofctl -O Openflow14 mod-table br0 0 vacancy:20,80])
2047 # Check that the configuration was updated.
2048 mv expout orig-expout
2049 sed -e '3s/vacancy=off/vacancy=on vacancy_down=20% vacancy_up=80% vacancy=100%/' <orig-expout > expout
2050 AT_CHECK([ovs-ofctl -O OpenFlow14 dump-table-desc br0 | sed '/^$/d
2051 /^OFPST_TABLE_DESC/d'], [0], [expout])
2052 OVS_VSWITCHD_STOP
2053 AT_CLEANUP
2054
2055 AT_SETUP([ofproto - hard limits on flow table size (OpenFlow 1.0)])
2056 OVS_VSWITCHD_START
2057 # Configure a maximum of 4 flows.
2058 AT_CHECK(
2059   [ovs-vsctl \
2060      -- --id=@t0 create Flow_Table flow-limit=4 \
2061      -- set bridge br0 flow_tables:0=@t0 \
2062    | ${PERL} $srcdir/uuidfilt.pl],
2063   [0], [<0>
2064 ])
2065 # Add 4 flows.
2066 for in_port in 1 2 3 4; do
2067     ovs-ofctl add-flow br0 in_port=$in_port,actions=drop
2068 done
2069 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
2070  in_port=1 actions=drop
2071  in_port=2 actions=drop
2072  in_port=3 actions=drop
2073  in_port=4 actions=drop
2074 NXST_FLOW reply:
2075 ])
2076 # Adding another flow will be refused.
2077 AT_CHECK([ovs-ofctl add-flow br0 in_port=5,actions=drop], [1], [], [stderr])
2078 AT_CHECK([head -n 1 stderr | ofctl_strip], [0],
2079   [OFPT_ERROR: OFPFMFC_TABLE_FULL
2080 ])
2081 # Also a mod-flow that would add a flow will be refused.
2082 AT_CHECK([ovs-ofctl mod-flows br0 in_port=5,actions=drop], [1], [], [stderr])
2083 AT_CHECK([head -n 1 stderr | ofctl_strip], [0],
2084   [OFPT_ERROR: OFPFMFC_TABLE_FULL
2085 ])
2086 # Replacing or modifying an existing flow is allowed.
2087 AT_CHECK([ovs-ofctl add-flow br0 in_port=4,actions=normal])
2088 AT_CHECK([ovs-ofctl mod-flows br0 in_port=3,actions=output:1])
2089 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
2090  in_port=1 actions=drop
2091  in_port=2 actions=drop
2092  in_port=3 actions=output:1
2093  in_port=4 actions=NORMAL
2094 NXST_FLOW reply:
2095 ])
2096 OVS_VSWITCHD_STOP
2097 AT_CLEANUP
2098
2099 AT_SETUP([ofproto - hard limits on flow table size (OpenFlow 1.2)])
2100 OVS_VSWITCHD_START
2101 # Configure a maximum of 4 flows.
2102 AT_CHECK(
2103   [ovs-vsctl \
2104      -- --id=@t0 create Flow_Table flow-limit=4 \
2105      -- set bridge br0 flow_tables:0=@t0 \
2106    | ${PERL} $srcdir/uuidfilt.pl],
2107   [0], [<0>
2108 ])
2109 # Add 4 flows.
2110 for in_port in 1 2 3 4; do
2111     ovs-ofctl -O OpenFlow12 add-flow br0 in_port=$in_port,actions=drop
2112 done
2113 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
2114  in_port=1 actions=drop
2115  in_port=2 actions=drop
2116  in_port=3 actions=drop
2117  in_port=4 actions=drop
2118 OFPST_FLOW reply (OF1.2):
2119 ])
2120 # Adding another flow will be refused.
2121 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 in_port=5,actions=drop], [1], [], [stderr])
2122 AT_CHECK([head -n 1 stderr | ofctl_strip], [0],
2123   [OFPT_ERROR (OF1.2): OFPFMFC_TABLE_FULL
2124 ])
2125 # Replacing or modifying an existing flow is allowed.
2126 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 in_port=4,actions=normal])
2127 AT_CHECK([ovs-ofctl -O OpenFlow12 mod-flows br0 in_port=3,actions=output:1])
2128 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
2129  in_port=1 actions=drop
2130  in_port=2 actions=drop
2131  in_port=3 actions=output:1
2132  in_port=4 actions=NORMAL
2133 OFPST_FLOW reply (OF1.2):
2134 ])
2135 OVS_VSWITCHD_STOP
2136 AT_CLEANUP
2137
2138 AT_SETUP([ofproto - eviction upon table overflow (OpenFlow 1.0)])
2139 OVS_VSWITCHD_START
2140 # Configure a maximum of 4 flows.
2141 AT_CHECK(
2142   [ovs-vsctl \
2143      -- --id=@t0 create Flow_Table flow-limit=4 overflow-policy=evict \
2144      -- set bridge br0 flow_tables:0=@t0 \
2145    | ${PERL} $srcdir/uuidfilt.pl],
2146   [0], [<0>
2147 ])
2148 # Add 4 flows.
2149 for in_port in 4 3 2 1; do
2150     ovs-ofctl add-flow br0 idle_timeout=${in_port}0,in_port=$in_port,actions=drop
2151 done
2152 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
2153  idle_timeout=10, in_port=1 actions=drop
2154  idle_timeout=20, in_port=2 actions=drop
2155  idle_timeout=30, in_port=3 actions=drop
2156  idle_timeout=40, in_port=4 actions=drop
2157 NXST_FLOW reply:
2158 ])
2159 # Adding another flow will cause the one that expires soonest to be evicted.
2160 AT_CHECK([ovs-ofctl add-flow br0 in_port=5,actions=drop])
2161 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
2162  idle_timeout=20, in_port=2 actions=drop
2163  idle_timeout=30, in_port=3 actions=drop
2164  idle_timeout=40, in_port=4 actions=drop
2165  in_port=5 actions=drop
2166 NXST_FLOW reply:
2167 ])
2168 # A mod-flow that adds a flow also causes eviction, but replacing or
2169 # modifying an existing flow doesn't.
2170 AT_CHECK([ovs-ofctl mod-flows br0 in_port=6,actions=drop])
2171 AT_CHECK([ovs-ofctl add-flow br0 in_port=4,actions=normal])
2172 AT_CHECK([ovs-ofctl mod-flows br0 in_port=3,actions=output:1])
2173 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
2174  idle_timeout=30, in_port=3 actions=output:1
2175  in_port=4 actions=NORMAL
2176  in_port=5 actions=drop
2177  in_port=6 actions=drop
2178 NXST_FLOW reply:
2179 ])
2180 # Flows with no timeouts at all cannot be evicted.
2181 AT_CHECK([ovs-ofctl add-flow br0 in_port=7,actions=normal])
2182 AT_CHECK([ovs-ofctl add-flow br0 in_port=8,actions=drop], [1], [], [stderr])
2183 AT_CHECK([head -n 1 stderr | ofctl_strip], [0],
2184   [OFPT_ERROR: OFPFMFC_TABLE_FULL
2185 ])
2186 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
2187  in_port=4 actions=NORMAL
2188  in_port=5 actions=drop
2189  in_port=6 actions=drop
2190  in_port=7 actions=NORMAL
2191 NXST_FLOW reply:
2192 ])
2193 OVS_VSWITCHD_STOP
2194 AT_CLEANUP
2195
2196 AT_SETUP([ofproto - eviction upon table overflow (OpenFlow 1.2)])
2197 OVS_VSWITCHD_START
2198 # Configure a maximum of 4 flows.
2199 AT_CHECK(
2200   [ovs-vsctl \
2201      -- --id=@t0 create Flow_Table flow-limit=4 overflow-policy=evict \
2202      -- set bridge br0 flow_tables:0=@t0 \
2203    | ${PERL} $srcdir/uuidfilt.pl],
2204   [0], [<0>
2205 ])
2206 # Add 4 flows.
2207 for in_port in 4 3 2 1; do
2208     ovs-ofctl -O OpenFlow12 add-flow br0 idle_timeout=${in_port}0,in_port=$in_port,actions=drop
2209 done
2210 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
2211  idle_timeout=10, in_port=1 actions=drop
2212  idle_timeout=20, in_port=2 actions=drop
2213  idle_timeout=30, in_port=3 actions=drop
2214  idle_timeout=40, in_port=4 actions=drop
2215 OFPST_FLOW reply (OF1.2):
2216 ])
2217 # Adding another flow will cause the one that expires soonest to be evicted.
2218 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 in_port=5,actions=drop])
2219 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
2220  idle_timeout=20, in_port=2 actions=drop
2221  idle_timeout=30, in_port=3 actions=drop
2222  idle_timeout=40, in_port=4 actions=drop
2223  in_port=5 actions=drop
2224 OFPST_FLOW reply (OF1.2):
2225 ])
2226 # In OpenFlow 1.2 a mod-flow does not ever add a flow and thus
2227 # has no effect on eviction
2228 AT_CHECK([ovs-ofctl -O OpenFlow12 mod-flows br0 in_port=6,actions=drop])
2229 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 in_port=4,actions=normal])
2230 AT_CHECK([ovs-ofctl -O OpenFlow12 mod-flows br0 in_port=3,actions=output:1])
2231 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
2232  idle_timeout=20, in_port=2 actions=drop
2233  idle_timeout=30, in_port=3 actions=output:1
2234  in_port=4 actions=NORMAL
2235  in_port=5 actions=drop
2236 OFPST_FLOW reply (OF1.2):
2237 ])
2238 # Flows with no timeouts at all cannot be evicted.
2239 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 in_port=6,actions=drop])
2240 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 in_port=7,actions=normal])
2241 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 in_port=8,actions=drop], [1], [], [stderr])
2242 AT_CHECK([head -n 1 stderr | ofctl_strip], [0],
2243   [OFPT_ERROR (OF1.2): OFPFMFC_TABLE_FULL
2244 ])
2245 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
2246  in_port=4 actions=NORMAL
2247  in_port=5 actions=drop
2248  in_port=6 actions=drop
2249  in_port=7 actions=NORMAL
2250 OFPST_FLOW reply (OF1.2):
2251 ])
2252 OVS_VSWITCHD_STOP
2253 AT_CLEANUP
2254
2255 AT_SETUP([ofproto - eviction using importance upon table overflow (OpenFlow 1.4)])
2256 OVS_VSWITCHD_START
2257 # Configure a maximum of 4 flows.
2258 AT_CHECK(
2259   [ovs-vsctl \
2260      -- --id=@t0 create Flow_Table name=evict flow-limit=4 \
2261      -- set bridge br0 flow_tables:0=@t0 \
2262    | ${PERL} $srcdir/uuidfilt.pl],
2263   [0], [<0>
2264 ])
2265 # Use mod-table to turn on eviction just to demonstrate that it works.
2266 AT_CHECK([ovs-ofctl -O OpenFlow14 mod-table br0 0 evict])
2267 # Add 4 flows.
2268 for in_port in 4 3 2 1; do
2269     ovs-ofctl -O Openflow14 add-flow br0 importance=$((in_port + 30)),priority=$((in_port + 5)),hard_timeout=$((in_port + 500)),actions=drop
2270 done
2271 AT_CHECK([ovs-ofctl -O Openflow14 dump-flows br0 | ofctl_strip | sort], [0], [dnl
2272  hard_timeout=501, importance=31, priority=6 actions=drop
2273  hard_timeout=502, importance=32, priority=7 actions=drop
2274  hard_timeout=503, importance=33, priority=8 actions=drop
2275  hard_timeout=504, importance=34, priority=9 actions=drop
2276 OFPST_FLOW reply (OF1.4):
2277 ])
2278 # Adding another flow will cause the one with lowest importance to be evicted.
2279 AT_CHECK([ovs-ofctl -O Openflow14 add-flow br0 hard_timeout=505,importance=35,priority=10,in_port=2,actions=drop])
2280 AT_CHECK([ovs-ofctl -O Openflow14 dump-flows br0 | ofctl_strip | sort], [0], [dnl
2281  hard_timeout=502, importance=32, priority=7 actions=drop
2282  hard_timeout=503, importance=33, priority=8 actions=drop
2283  hard_timeout=504, importance=34, priority=9 actions=drop
2284  hard_timeout=505, importance=35, priority=10,in_port=2 actions=drop
2285 OFPST_FLOW reply (OF1.4):
2286 ])
2287 # Disable the Eviction configuration.
2288 AT_CHECK([ovs-ofctl -O OpenFlow14 mod-table br0 0 noevict])
2289 # Adding another flow will cause the system to give error for FULL TABLE.
2290 AT_CHECK([ovs-ofctl -O Openflow14 add-flow br0 hard_timeout=506,importance=36,priority=11,actions=drop],[1], [], [stderr])
2291 AT_CHECK([head -n 1 stderr | ofctl_strip], [0],
2292  [OFPT_ERROR (OF1.4): OFPFMFC_TABLE_FULL
2293 ])
2294 #Dump flows. It should show only the old values
2295 AT_CHECK([ovs-ofctl -O Openflow14 dump-flows br0 | ofctl_strip | sort], [0], [dnl
2296  hard_timeout=502, importance=32, priority=7 actions=drop
2297  hard_timeout=503, importance=33, priority=8 actions=drop
2298  hard_timeout=504, importance=34, priority=9 actions=drop
2299  hard_timeout=505, importance=35, priority=10,in_port=2 actions=drop
2300 OFPST_FLOW reply (OF1.4):
2301 ])
2302 # mod-flow that would modify a flow will be done successfully.
2303 AT_CHECK([ovs-ofctl -O Openflow14 mod-flows br0 in_port=2,actions=NORMAL])
2304 AT_CHECK([ovs-ofctl -O Openflow14 dump-flows br0 | ofctl_strip | sort], [0], [dnl
2305  hard_timeout=502, importance=32, priority=7 actions=drop
2306  hard_timeout=503, importance=33, priority=8 actions=drop
2307  hard_timeout=504, importance=34, priority=9 actions=drop
2308  hard_timeout=505, importance=35, priority=10,in_port=2 actions=NORMAL
2309 OFPST_FLOW reply (OF1.4):
2310 ])
2311 # Also a mod-flow that would add a flow will be refused.
2312 AT_CHECK([ovs-ofctl mod-flows br0 in_port=5,actions=drop], [1], [], [stderr])
2313 AT_CHECK([head -n 1 stderr | ofctl_strip], [0],
2314   [OFPT_ERROR: OFPFMFC_TABLE_FULL
2315 ])
2316 OVS_VSWITCHD_STOP
2317 AT_CLEANUP
2318
2319 AT_SETUP([ofproto - eviction upon table overflow, with fairness (OpenFlow 1.0)])
2320 OVS_VSWITCHD_START
2321 # Configure a maximum of 4 flows.
2322 AT_CHECK(
2323   [ovs-vsctl \
2324      -- --id=@t0 create Flow_Table name=evict flow-limit=4 \
2325                                    overflow-policy=evict \
2326                                    groups='"NXM_OF_IN_PORT[[]]"' \
2327      -- set bridge br0 flow_tables:0=@t0 \
2328    | ${PERL} $srcdir/uuidfilt.pl],
2329   [0], [<0>
2330 ])
2331 # Add 4 flows.
2332 ovs-ofctl add-flows br0 - <<EOF
2333 idle_timeout=10 in_port=2 dl_src=00:44:55:66:77:88 actions=drop
2334 idle_timeout=20 in_port=1 dl_src=00:11:22:33:44:55 actions=drop
2335 idle_timeout=30 in_port=1 dl_src=00:22:33:44:55:66 actions=drop
2336 idle_timeout=40 in_port=1 dl_src=00:33:44:55:66:77 actions=drop
2337 EOF
2338 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
2339  idle_timeout=10, in_port=2,dl_src=00:44:55:66:77:88 actions=drop
2340  idle_timeout=20, in_port=1,dl_src=00:11:22:33:44:55 actions=drop
2341  idle_timeout=30, in_port=1,dl_src=00:22:33:44:55:66 actions=drop
2342  idle_timeout=40, in_port=1,dl_src=00:33:44:55:66:77 actions=drop
2343 NXST_FLOW reply:
2344 ])
2345 # Adding another flow will cause the one that expires soonest within
2346 # the largest group (those with in_port=1) to be evicted.  In this
2347 # case this is not the same as the one that expires soonest overall
2348 # (which is what makes the test interesting):
2349 AT_CHECK([ovs-ofctl add-flow br0 in_port=2,dl_src=00:55:66:77:88:99,actions=drop])
2350 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
2351  idle_timeout=10, in_port=2,dl_src=00:44:55:66:77:88 actions=drop
2352  idle_timeout=30, in_port=1,dl_src=00:22:33:44:55:66 actions=drop
2353  idle_timeout=40, in_port=1,dl_src=00:33:44:55:66:77 actions=drop
2354  in_port=2,dl_src=00:55:66:77:88:99 actions=drop
2355 NXST_FLOW reply:
2356 ])
2357 # Enlarge the flow limit, change the eviction policy back to strictly
2358 # based on expiration, and and add some flows.
2359 AT_CHECK([ovs-vsctl set Flow_Table evict groups='[[]]' flow-limit=7])
2360 ovs-ofctl add-flows br0 - <<EOF
2361 idle_timeout=50 in_port=2 dl_src=00:66:77:88:99:aa actions=drop
2362 idle_timeout=60 in_port=2 dl_src=00:77:88:99:aa:bb actions=drop
2363 idle_timeout=70 in_port=2 dl_src=00:88:99:aa:bb:cc actions=drop
2364 EOF
2365 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
2366  idle_timeout=10, in_port=2,dl_src=00:44:55:66:77:88 actions=drop
2367  idle_timeout=30, in_port=1,dl_src=00:22:33:44:55:66 actions=drop
2368  idle_timeout=40, in_port=1,dl_src=00:33:44:55:66:77 actions=drop
2369  idle_timeout=50, in_port=2,dl_src=00:66:77:88:99:aa actions=drop
2370  idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=drop
2371  idle_timeout=70, in_port=2,dl_src=00:88:99:aa:bb:cc actions=drop
2372  in_port=2,dl_src=00:55:66:77:88:99 actions=drop
2373 NXST_FLOW reply:
2374 ])
2375 # Adding another flow will cause the one that expires soonest overall
2376 # to be evicted.
2377 AT_CHECK([ovs-ofctl add-flow br0 'idle_timeout=80 in_port=2 dl_src=00:99:aa:bb:cc:dd actions=drop'])
2378 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
2379  idle_timeout=30, in_port=1,dl_src=00:22:33:44:55:66 actions=drop
2380  idle_timeout=40, in_port=1,dl_src=00:33:44:55:66:77 actions=drop
2381  idle_timeout=50, in_port=2,dl_src=00:66:77:88:99:aa actions=drop
2382  idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=drop
2383  idle_timeout=70, in_port=2,dl_src=00:88:99:aa:bb:cc actions=drop
2384  idle_timeout=80, in_port=2,dl_src=00:99:aa:bb:cc:dd actions=drop
2385  in_port=2,dl_src=00:55:66:77:88:99 actions=drop
2386 NXST_FLOW reply:
2387 ])
2388 # Reducing the flow limit also causes the flows that expire soonest
2389 # overall to be evicted.
2390 AT_CHECK([ovs-vsctl set Flow_Table evict flow-limit=4])
2391 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
2392  idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=drop
2393  idle_timeout=70, in_port=2,dl_src=00:88:99:aa:bb:cc actions=drop
2394  idle_timeout=80, in_port=2,dl_src=00:99:aa:bb:cc:dd actions=drop
2395  in_port=2,dl_src=00:55:66:77:88:99 actions=drop
2396 NXST_FLOW reply:
2397 ])
2398 OVS_VSWITCHD_STOP
2399 AT_CLEANUP
2400
2401 AT_SETUP([ofproto - eviction upon table overflow, with fairness (OpenFlow 1.2)])
2402 OVS_VSWITCHD_START
2403 # Configure a maximum of 4 flows.
2404 AT_CHECK(
2405   [ovs-vsctl \
2406      -- --id=@t0 create Flow_Table name=evict flow-limit=4 \
2407                                    overflow-policy=evict \
2408                                    groups='"NXM_OF_IN_PORT[[]]"' \
2409      -- set bridge br0 flow_tables:0=@t0 \
2410    | ${PERL} $srcdir/uuidfilt.pl],
2411   [0], [<0>
2412 ])
2413 # Add 4 flows.
2414 ovs-ofctl -O OpenFlow12 add-flows br0 - <<EOF
2415 idle_timeout=10 in_port=2 dl_src=00:44:55:66:77:88 actions=drop
2416 idle_timeout=20 in_port=1 dl_src=00:11:22:33:44:55 actions=drop
2417 idle_timeout=30 in_port=1 dl_src=00:22:33:44:55:66 actions=drop
2418 idle_timeout=40 in_port=1 dl_src=00:33:44:55:66:77 actions=drop
2419 EOF
2420 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
2421  idle_timeout=10, in_port=2,dl_src=00:44:55:66:77:88 actions=drop
2422  idle_timeout=20, in_port=1,dl_src=00:11:22:33:44:55 actions=drop
2423  idle_timeout=30, in_port=1,dl_src=00:22:33:44:55:66 actions=drop
2424  idle_timeout=40, in_port=1,dl_src=00:33:44:55:66:77 actions=drop
2425 OFPST_FLOW reply (OF1.2):
2426 ])
2427 # Adding another flow will cause the one that expires soonest within
2428 # the largest group (those with in_port=1) to be evicted.  In this
2429 # case this is not the same as the one that expires soonest overall
2430 # (which is what makes the test interesting):
2431 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 in_port=2,dl_src=00:55:66:77:88:99,actions=drop])
2432 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
2433  idle_timeout=10, in_port=2,dl_src=00:44:55:66:77:88 actions=drop
2434  idle_timeout=30, in_port=1,dl_src=00:22:33:44:55:66 actions=drop
2435  idle_timeout=40, in_port=1,dl_src=00:33:44:55:66:77 actions=drop
2436  in_port=2,dl_src=00:55:66:77:88:99 actions=drop
2437 OFPST_FLOW reply (OF1.2):
2438 ])
2439 # Enlarge the flow limit, change the eviction policy back to strictly
2440 # based on expiration, and and add some flows.
2441 AT_CHECK([ovs-vsctl set Flow_Table evict groups='[[]]' flow-limit=7])
2442 ovs-ofctl -O OpenFlow12 add-flows br0 - <<EOF
2443 idle_timeout=50 in_port=2 dl_src=00:66:77:88:99:aa actions=drop
2444 idle_timeout=60 in_port=2 dl_src=00:77:88:99:aa:bb actions=drop
2445 idle_timeout=70 in_port=2 dl_src=00:88:99:aa:bb:cc actions=drop
2446 EOF
2447 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
2448  idle_timeout=10, in_port=2,dl_src=00:44:55:66:77:88 actions=drop
2449  idle_timeout=30, in_port=1,dl_src=00:22:33:44:55:66 actions=drop
2450  idle_timeout=40, in_port=1,dl_src=00:33:44:55:66:77 actions=drop
2451  idle_timeout=50, in_port=2,dl_src=00:66:77:88:99:aa actions=drop
2452  idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=drop
2453  idle_timeout=70, in_port=2,dl_src=00:88:99:aa:bb:cc actions=drop
2454  in_port=2,dl_src=00:55:66:77:88:99 actions=drop
2455 OFPST_FLOW reply (OF1.2):
2456 ])
2457 # Adding another flow will cause the one that expires soonest overall
2458 # to be evicted.
2459 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'])
2460 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
2461  idle_timeout=30, in_port=1,dl_src=00:22:33:44:55:66 actions=drop
2462  idle_timeout=40, in_port=1,dl_src=00:33:44:55:66:77 actions=drop
2463  idle_timeout=50, in_port=2,dl_src=00:66:77:88:99:aa actions=drop
2464  idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=drop
2465  idle_timeout=70, in_port=2,dl_src=00:88:99:aa:bb:cc actions=drop
2466  idle_timeout=80, in_port=2,dl_src=00:99:aa:bb:cc:dd actions=drop
2467  in_port=2,dl_src=00:55:66:77:88:99 actions=drop
2468 OFPST_FLOW reply (OF1.2):
2469 ])
2470 # Reducing the flow limit also causes the flows that expire soonest
2471 # overall to be evicted.
2472 AT_CHECK([ovs-vsctl set Flow_Table evict flow-limit=4])
2473 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
2474  idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=drop
2475  idle_timeout=70, in_port=2,dl_src=00:88:99:aa:bb:cc actions=drop
2476  idle_timeout=80, in_port=2,dl_src=00:99:aa:bb:cc:dd actions=drop
2477  in_port=2,dl_src=00:55:66:77:88:99 actions=drop
2478 OFPST_FLOW reply (OF1.2):
2479 ])
2480 OVS_VSWITCHD_STOP
2481 AT_CLEANUP
2482
2483 AT_SETUP([ofproto - eviction upon table overflow, with modified hard timeout])
2484 OVS_VSWITCHD_START
2485 # Configure a maximum of 4 flows.
2486 AT_CHECK(
2487   [ovs-vsctl \
2488      -- --id=@t0 create Flow_Table flow-limit=4 overflow-policy=evict \
2489      -- set bridge br0 flow_tables:0=@t0 \
2490    | ${PERL} $srcdir/uuidfilt.pl],
2491   [0], [<0>
2492 ])
2493 ovs-appctl time/stop
2494 # Add 4 flows.
2495 for in_port in 4 3 2 1; do
2496     ovs-ofctl add-flow br0 hard_timeout=$((10 + in_port * 3)),in_port=$in_port,actions=drop
2497 done
2498 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
2499  hard_timeout=13, in_port=1 actions=drop
2500  hard_timeout=16, in_port=2 actions=drop
2501  hard_timeout=19, in_port=3 actions=drop
2502  hard_timeout=22, in_port=4 actions=drop
2503 NXST_FLOW reply:
2504 ])
2505 # Sleep and modify the one that expires soonest
2506 ovs-appctl time/warp 5000
2507 AT_CHECK([ovs-ofctl mod-flows br0 in_port=1,actions=drop])
2508 # At this point the table would looks like:
2509 #  in_port   seconds to expire
2510 #     1            13
2511 #     2            11
2512 #     3            14
2513 #     4            17
2514 ovs-appctl time/warp 2000
2515 # Adding another flow will cause the one that expires soonest to be evicted.
2516 AT_CHECK([ovs-ofctl add-flow br0 in_port=5,actions=drop])
2517 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
2518  hard_timeout=13, in_port=1 actions=drop
2519  hard_timeout=19, in_port=3 actions=drop
2520  hard_timeout=22, in_port=4 actions=drop
2521  in_port=5 actions=drop
2522 NXST_FLOW reply:
2523 ])
2524 OVS_VSWITCHD_STOP
2525 AT_CLEANUP
2526
2527 AT_SETUP([ofproto - eviction upon table overflow, with modified idle timeout])
2528 OVS_VSWITCHD_START([add-port br0 p1 -- set interface p1 type=dummy ofport_request=1])
2529 # Configure a maximum of 4 flows.
2530 AT_CHECK(
2531   [ovs-vsctl \
2532      -- --id=@t0 create Flow_Table flow-limit=4 overflow-policy=evict \
2533      -- set bridge br0 flow_tables:0=@t0 \
2534    | ${PERL} $srcdir/uuidfilt.pl],
2535   [0], [<0>
2536 ])
2537 # Add 4 flows.
2538 for in_port in 4 3 2 1; do
2539     ovs-ofctl add-flow br0 idle_timeout=$((10 + in_port * 3)),in_port=$in_port,actions=drop
2540 done
2541 ovs-appctl time/stop
2542 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
2543  idle_timeout=13, in_port=1 actions=drop
2544  idle_timeout=16, in_port=2 actions=drop
2545  idle_timeout=19, in_port=3 actions=drop
2546  idle_timeout=22, in_port=4 actions=drop
2547 NXST_FLOW reply:
2548 ])
2549 # Sleep and receive on the flow that expires soonest
2550 ovs-appctl time/warp 5000
2551 AT_CHECK([ovs-appctl netdev-dummy/receive p1 'in_port(1)'])
2552 # At this point the table would looks like:
2553 #  in_port   seconds to expire
2554 #     1            13
2555 #     2            11
2556 #     3            14
2557 #     4            17
2558 ovs-appctl time/warp 2000
2559 # Adding another flow will cause the one that expires soonest to be evicted.
2560 AT_CHECK([ovs-ofctl add-flow br0 in_port=5,actions=drop])
2561 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
2562  idle_timeout=19, in_port=3 actions=drop
2563  idle_timeout=22, in_port=4 actions=drop
2564  in_port=5 actions=drop
2565  n_packets=1, n_bytes=60, idle_timeout=13, in_port=1 actions=drop
2566 NXST_FLOW reply:
2567 ])
2568 OVS_VSWITCHD_STOP
2569 AT_CLEANUP
2570
2571 AT_SETUP([ofproto - asynchronous message control (OpenFlow 1.0)])
2572 OVS_VSWITCHD_START
2573 AT_CHECK([ovs-ofctl -P standard monitor br0 --detach --no-chdir --pidfile])
2574 check_async () {
2575     printf '\n\n--- check_async %d ---\n\n\n' $1
2576     shift
2577
2578     ovs-appctl -t ovs-ofctl ofctl/barrier
2579     ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
2580     : > expout
2581
2582     # OFPT_PACKET_IN, OFPR_ACTION (controller_id=0)
2583     ovs-ofctl -v packet-out br0 controller controller '0001020304050010203040501234'
2584     if test X"$1" = X"OFPR_ACTION"; then shift;
2585         echo >>expout "OFPT_PACKET_IN: total_len=14 in_port=CONTROLLER (via action) data_len=14 (unbuffered)
2586 vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1234"
2587     fi
2588
2589     # OFPT_PACKET_IN, OFPR_NO_MATCH (controller_id=123)
2590     ovs-ofctl -v packet-out br0 controller 'controller(reason=no_match,id=123)' '0001020304050010203040501234'
2591     if test X"$1" = X"OFPR_NO_MATCH"; then shift;
2592         echo >>expout "OFPT_PACKET_IN: total_len=14 in_port=CONTROLLER (via no_match) data_len=14 (unbuffered)
2593 vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1234"
2594     fi
2595
2596     # OFPT_PACKET_IN, OFPR_INVALID_TTL (controller_id=0)
2597     ovs-ofctl packet-out br0 controller dec_ttl '002583dfb4000026b98cb0f908004500003eb7e200000011339bac11370dac100002d7730035002b8f6d86fb0100000100000000000006626c702d7873066e696369726103636f6d00000f00'
2598     if test X"$1" = X"OFPR_INVALID_TTL"; then shift;
2599         echo >>expout "OFPT_PACKET_IN: total_len=76 in_port=CONTROLLER (via invalid_ttl) data_len=76 (unbuffered)
2600 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"
2601     fi
2602
2603     # OFPT_PORT_STATUS, OFPPR_ADD
2604     ovs-vsctl add-port br0 test -- set Interface test type=dummy ofport_request=1
2605     if test X"$1" = X"OFPPR_ADD"; then shift;
2606         echo >>expout "OFPT_PORT_STATUS: ADD: 1(test): addr:aa:55:aa:55:00:0x
2607      config:     PORT_DOWN
2608      state:      LINK_DOWN
2609      speed: 0 Mbps now, 0 Mbps max"
2610     fi
2611
2612     # OFPT_PORT_STATUS, OFPPR_DELETE
2613     ovs-vsctl del-port br0 test
2614     if test X"$1" = X"OFPPR_DELETE"; then shift;
2615         echo >>expout "OFPT_PORT_STATUS: DEL: 1(test): addr:aa:55:aa:55:00:0x
2616      config:     PORT_DOWN
2617      state:      LINK_DOWN
2618      speed: 0 Mbps now, 0 Mbps max"
2619     fi
2620
2621     # OFPT_FLOW_REMOVED, OFPRR_DELETE
2622     ovs-ofctl add-flow br0 send_flow_rem,actions=drop
2623     ovs-ofctl --strict del-flows br0 ''
2624     if test X"$1" = X"OFPRR_DELETE"; then shift;
2625         echo >>expout "OFPT_FLOW_REMOVED:  reason=delete"
2626     fi
2627     AT_FAIL_IF([test X"$1" != X])
2628
2629     ovs-appctl -t ovs-ofctl ofctl/barrier
2630     echo >>expout "OFPT_BARRIER_REPLY:"
2631
2632     AT_CHECK(
2633       [[sed '
2634 s/ (xid=0x[0-9a-fA-F]*)//
2635 s/ *duration.*//
2636 s/00:0.$/00:0x/' < monitor.log]],
2637       [0], [expout])
2638 }
2639
2640 # It's a service connection so initially there should be no async messages.
2641 check_async 1
2642
2643 # Set miss_send_len to 128, turning on packet-ins for our service connection.
2644 ovs-appctl -t ovs-ofctl ofctl/send 0109000c0123456700000080
2645 check_async 2 OFPR_ACTION OFPPR_ADD OFPPR_DELETE OFPRR_DELETE
2646
2647 # Set miss_send_len to 128 and enable invalid_ttl.
2648 ovs-appctl -t ovs-ofctl ofctl/send 0109000c0123456700040080
2649 check_async 3 OFPR_ACTION OFPR_INVALID_TTL OFPPR_ADD OFPPR_DELETE OFPRR_DELETE
2650
2651 # Become slave, which should disable everything except port status.
2652 ovs-appctl -t ovs-ofctl ofctl/send 0104001400000002000023200000000a00000002
2653 check_async 4 OFPPR_ADD OFPPR_DELETE
2654
2655 # Use NXT_SET_ASYNC_CONFIG to enable a patchwork of asynchronous messages.
2656 ovs-appctl -t ovs-ofctl ofctl/send 01040028000000020000232000000013000000020000000500000005000000020000000200000005
2657 check_async 5 OFPR_INVALID_TTL OFPPR_DELETE OFPRR_DELETE
2658
2659 # Set controller ID 123.
2660 ovs-appctl -t ovs-ofctl ofctl/send 01040018000000030000232000000014000000000000007b
2661 check_async 6 OFPR_NO_MATCH OFPPR_DELETE OFPRR_DELETE
2662
2663 # Restore controller ID 0.
2664 ovs-appctl -t ovs-ofctl ofctl/send 010400180000000300002320000000140000000000000000
2665
2666 # Become master.
2667 ovs-appctl -t ovs-ofctl ofctl/send 0104001400000002000023200000000a00000001
2668 check_async 7 OFPR_ACTION OFPPR_ADD
2669
2670 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
2671 OVS_VSWITCHD_STOP
2672 AT_CLEANUP
2673
2674 AT_SETUP([ofproto - asynchronous message control (OpenFlow 1.2)])
2675 OVS_VSWITCHD_START
2676 AT_CHECK([ovs-ofctl -O OpenFlow12 -P standard monitor br0 --detach --no-chdir --pidfile])
2677 check_async () {
2678     printf '\n\n--- check_async %d ---\n\n\n' $1
2679     INDEX=$1
2680     shift
2681
2682     ovs-appctl -t ovs-ofctl ofctl/barrier
2683     ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
2684     : > expout
2685
2686     # OFPT_PACKET_IN, OFPR_ACTION (controller_id=0)
2687     ovs-ofctl -O OpenFlow12 -v packet-out br0 none controller '0001020304050010203040501234'
2688     if test X"$1" = X"OFPR_ACTION"; then shift;
2689         echo >>expout "OFPT_PACKET_IN (OF1.2): total_len=14 in_port=ANY (via action) data_len=14 (unbuffered)
2690 vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1234"
2691     fi
2692
2693     # OFPT_PACKET_IN, OFPR_NO_MATCH (controller_id=123)
2694     ovs-ofctl -O OpenFlow12 -v packet-out br0 none 'controller(reason=no_match,id=123)' '0001020304050010203040501234'
2695     if test X"$1" = X"OFPR_NO_MATCH"; then shift;
2696         echo >>expout "OFPT_PACKET_IN (OF1.2): total_len=14 in_port=ANY (via no_match) data_len=14 (unbuffered)
2697 vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1234"
2698     fi
2699
2700     # OFPT_PACKET_IN, OFPR_INVALID_TTL (controller_id=0)
2701     ovs-ofctl -O OpenFlow12 packet-out br0 none dec_ttl '002583dfb4000026b98cb0f908004500003eb7e200000011339bac11370dac100002d7730035002b8f6d86fb0100000100000000000006626c702d7873066e696369726103636f6d00000f00'
2702     if test X"$1" = X"OFPR_INVALID_TTL"; then shift;
2703         echo >>expout "OFPT_PACKET_IN (OF1.2): total_len=76 in_port=ANY (via invalid_ttl) data_len=76 (unbuffered)
2704 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"
2705     fi
2706
2707     # OFPT_PORT_STATUS, OFPPR_ADD
2708     ovs-vsctl add-port br0 test -- set Interface test type=dummy
2709     if test X"$1" = X"OFPPR_ADD"; then shift;
2710         echo >>expout "OFPT_PORT_STATUS (OF1.2): ADD: ${INDEX}(test): addr:aa:55:aa:55:00:0x
2711      config:     PORT_DOWN
2712      state:      LINK_DOWN
2713      speed: 0 Mbps now, 0 Mbps max"
2714     fi
2715
2716     # OFPT_PORT_STATUS, OFPPR_DELETE
2717     ovs-vsctl del-port br0 test
2718     if test X"$1" = X"OFPPR_DELETE"; then shift;
2719         echo >>expout "OFPT_PORT_STATUS (OF1.2): DEL: ${INDEX}(test): addr:aa:55:aa:55:00:0x
2720      config:     PORT_DOWN
2721      state:      LINK_DOWN
2722      speed: 0 Mbps now, 0 Mbps max"
2723     fi
2724
2725     # OFPT_FLOW_REMOVED, OFPRR_DELETE
2726     ovs-ofctl -O OpenFlow12 add-flow br0 send_flow_rem,actions=drop
2727     ovs-ofctl -O OpenFlow12 --strict del-flows br0 ''
2728     if test X"$1" = X"OFPRR_DELETE"; then shift;
2729         echo >>expout "OFPT_FLOW_REMOVED (OF1.2):  reason=delete table_id=0"
2730     fi
2731     AT_FAIL_IF([test X"$1" != X])
2732
2733     sleep 1
2734
2735     AT_CHECK(
2736       [[sed '
2737 s/ (xid=0x[0-9a-fA-F]*)//
2738 s/ *duration.*//
2739 s/00:0.$/00:0x/' < monitor.log]],
2740       [0], [expout])
2741 }
2742
2743 # It's a service connection so initially there should be no async messages.
2744 check_async 1
2745
2746 # Set miss_send_len to 128, turning on packet-ins for our service connection.
2747 ovs-appctl -t ovs-ofctl ofctl/send 0309000c0123456700000080
2748 check_async 2 OFPR_ACTION OFPPR_ADD OFPPR_DELETE OFPRR_DELETE
2749
2750 # Set miss_send_len to 128 and enable invalid_ttl.
2751 ovs-appctl -t ovs-ofctl ofctl/send 0309000c0123456700040080
2752 check_async 3 OFPR_ACTION OFPR_INVALID_TTL OFPPR_ADD OFPPR_DELETE OFPRR_DELETE
2753
2754 # Become slave (OF 1.2), which should disable everything except port status.
2755 ovs-appctl -t ovs-ofctl ofctl/send 031800180000000200000003000000000000000000000001
2756 check_async 4 OFPPR_ADD OFPPR_DELETE
2757
2758 # Use NXT_SET_ASYNC_CONFIG to enable a patchwork of asynchronous messages.
2759 ovs-appctl -t ovs-ofctl ofctl/send 03040028000000020000232000000013000000020000000500000005000000020000000200000005
2760 check_async 5 OFPR_INVALID_TTL OFPPR_DELETE OFPRR_DELETE
2761
2762 # Set controller ID 123.
2763 ovs-appctl -t ovs-ofctl ofctl/send 03040018000000030000232000000014000000000000007b
2764 check_async 6 OFPR_NO_MATCH OFPPR_DELETE OFPRR_DELETE
2765
2766 # Restore controller ID 0.
2767 ovs-appctl -t ovs-ofctl ofctl/send 030400180000000300002320000000140000000000000000
2768
2769 # Become master (OF 1.2).
2770 ovs-appctl -t ovs-ofctl ofctl/send 031800180000000400000002000000000000000000000002
2771 check_async 7 OFPR_ACTION OFPPR_ADD
2772
2773 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
2774 OVS_VSWITCHD_STOP
2775 AT_CLEANUP
2776
2777 AT_SETUP([ofproto - asynchronous message control (OpenFlow 1.3)])
2778 OVS_VSWITCHD_START
2779 AT_CHECK([ovs-ofctl -O OpenFlow13 -P standard monitor br0 --detach --no-chdir --pidfile])
2780 check_async () {
2781     printf '\n\n--- check_async %d ---\n\n\n' $1
2782     INDEX=$1
2783     shift
2784
2785     ovs-appctl -t ovs-ofctl ofctl/barrier
2786     ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
2787     : > expout
2788
2789     # OFPT_PACKET_IN, OFPR_ACTION (controller_id=0)
2790     ovs-ofctl -O OpenFlow13 -v packet-out br0 none controller '0001020304050010203040501234'
2791     if test X"$1" = X"OFPR_ACTION"; then shift;
2792         echo >>expout "OFPT_PACKET_IN (OF1.3): total_len=14 in_port=ANY (via action) data_len=14 (unbuffered)
2793 vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1234"
2794     fi
2795
2796     # OFPT_PACKET_IN, OFPR_NO_MATCH (controller_id=123)
2797     ovs-ofctl -O OpenFlow13 -v packet-out br0 none 'controller(reason=no_match,id=123)' '0001020304050010203040501234'
2798     if test X"$1" = X"OFPR_NO_MATCH"; then shift;
2799         echo >>expout "OFPT_PACKET_IN (OF1.3): total_len=14 in_port=ANY (via no_match) data_len=14 (unbuffered)
2800 vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1234"
2801     fi
2802
2803     # OFPT_PACKET_IN, OFPR_INVALID_TTL (controller_id=0)
2804     ovs-ofctl -O OpenFlow13 packet-out br0 none dec_ttl '002583dfb4000026b98cb0f908004500003eb7e200000011339bac11370dac100002d7730035002b8f6d86fb0100000100000000000006626c702d7873066e696369726103636f6d00000f00'
2805     if test X"$1" = X"OFPR_INVALID_TTL"; then shift;
2806         echo >>expout "OFPT_PACKET_IN (OF1.3): total_len=76 in_port=ANY (via invalid_ttl) data_len=76 (unbuffered)
2807 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"
2808     fi
2809
2810     # OFPT_PORT_STATUS, OFPPR_ADD
2811     ovs-vsctl add-port br0 test -- set Interface test type=dummy
2812     if test X"$1" = X"OFPPR_ADD"; then shift;
2813         echo >>expout "OFPT_PORT_STATUS (OF1.3): ADD: ${INDEX}(test): addr:aa:55:aa:55:00:0x
2814      config:     PORT_DOWN
2815      state:      LINK_DOWN
2816      speed: 0 Mbps now, 0 Mbps max"
2817     fi
2818
2819     # OFPT_PORT_STATUS, OFPPR_DELETE
2820     ovs-vsctl del-port br0 test
2821     if test X"$1" = X"OFPPR_DELETE"; then shift;
2822         echo >>expout "OFPT_PORT_STATUS (OF1.3): DEL: ${INDEX}(test): addr:aa:55:aa:55:00:0x
2823      config:     PORT_DOWN
2824      state:      LINK_DOWN
2825      speed: 0 Mbps now, 0 Mbps max"
2826     fi
2827
2828     # OFPT_FLOW_REMOVED, OFPRR_DELETE
2829     ovs-ofctl -O OpenFlow13 add-flow br0 send_flow_rem,actions=drop
2830     ovs-ofctl -O OpenFlow13 --strict del-flows br0 ''
2831     if test X"$1" = X"OFPRR_DELETE"; then shift;
2832         echo >>expout "OFPT_FLOW_REMOVED (OF1.3):  reason=delete table_id=0"
2833     fi
2834
2835     # OFPT_FLOW_REMOVED, OFPRR_GROUP_DELETE
2836     ovs-ofctl -O OpenFlow13 add-group br0 group_id=1234,type=all,bucket=output:10
2837     ovs-ofctl -O OpenFlow13 add-flow br0 send_flow_rem,actions=group:1234
2838     ovs-ofctl -O OpenFlow13 --strict del-groups br0 group_id=1234
2839     if test X"$1" = X"OFPRR_DELETE"; then shift;
2840         echo >>expout "OFPT_FLOW_REMOVED (OF1.3):  reason=gropu_delete table_id=0"
2841     fi
2842
2843     AT_FAIL_IF([test X"$1" != X])
2844
2845     ovs-appctl -t ovs-ofctl ofctl/barrier
2846     echo >>expout "OFPT_BARRIER_REPLY (OF1.3):"
2847
2848     AT_CHECK(
2849       [[sed '
2850 s/ (xid=0x[0-9a-fA-F]*)//
2851 s/ *duration.*//
2852 s/00:0.$/00:0x/' < monitor.log]],
2853       [0], [expout])
2854 }
2855
2856 # It's a service connection so initially there should be no async messages.
2857 check_async 1
2858
2859 # Set miss_send_len to 128, turning on packet-ins for our service connection.
2860 ovs-appctl -t ovs-ofctl ofctl/send 0409000c0123456700000080
2861 check_async 2 OFPR_ACTION OFPPR_ADD OFPPR_DELETE OFPRR_DELETE
2862
2863 # Become slave (OF 1.3), which should disable everything except port status.
2864 ovs-appctl -t ovs-ofctl ofctl/send 041800180000000200000003000000000000000000000001
2865 check_async 3 OFPPR_ADD OFPPR_DELETE
2866
2867 # Use OF 1.3 OFPT_SET_ASYNC to enable a patchwork of asynchronous messages.
2868 ovs-appctl -t ovs-ofctl ofctl/send 041c002000000002000000020000000500000005000000020000000200000005
2869 check_async 4 OFPR_INVALID_TTL OFPPR_DELETE OFPRR_DELETE
2870
2871 # Set controller ID 123.
2872 ovs-appctl -t ovs-ofctl ofctl/send 04040018000000030000232000000014000000000000007b
2873 check_async 5 OFPR_NO_MATCH OFPPR_DELETE OFPRR_DELETE
2874
2875 # Restore controller ID 0.
2876 ovs-appctl -t ovs-ofctl ofctl/send 040400180000000300002320000000140000000000000000
2877
2878 # Become master (OF 1.3).
2879 ovs-appctl -t ovs-ofctl ofctl/send 041800180000000400000002000000000000000000000002
2880 check_async 6 OFPR_ACTION OFPPR_ADD
2881
2882 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
2883 OVS_VSWITCHD_STOP
2884 AT_CLEANUP
2885
2886 AT_SETUP([ofproto - asynchronous message control (OpenFlow 1.4)])
2887 OVS_VSWITCHD_START
2888 AT_CHECK([ovs-ofctl -O OpenFlow14 -P standard monitor br0 --detach --no-chdir --pidfile])
2889 check_async () {
2890     printf '\n\n--- check_async %d ---\n\n\n' $1
2891     INDEX=$1
2892     shift
2893
2894     ovs-appctl -t ovs-ofctl ofctl/barrier
2895     ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
2896     : > expout
2897
2898     # OFPT_PACKET_IN, OFPR_ACTION (controller_id=0)
2899     ovs-ofctl -O OpenFlow14 -v packet-out br0 none controller '0001020304050010203040501234'
2900     if test X"$1" = X"OFPR_ACTION"; then shift;
2901         echo >>expout "OFPT_PACKET_IN (OF1.4): total_len=14 in_port=ANY (via action) data_len=14 (unbuffered)
2902 vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1234"
2903     fi
2904
2905     # OFPT_PACKET_IN, OFPR_NO_MATCH (controller_id=123)
2906     ovs-ofctl -O OpenFlow14 -v packet-out br0 none 'controller(reason=no_match,id=123)' '0001020304050010203040501234'
2907     if test X"$1" = X"OFPR_NO_MATCH"; then shift;
2908         echo >>expout "OFPT_PACKET_IN (OF1.4): total_len=14 in_port=ANY (via no_match) data_len=14 (unbuffered)
2909 vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1234"
2910     fi
2911
2912     # OFPT_PACKET_IN, OFPR_INVALID_TTL (controller_id=0)
2913     ovs-ofctl -O OpenFlow14 packet-out br0 none dec_ttl '002583dfb4000026b98cb0f908004500003eb7e200000011339bac11370dac100002d7730035002b8f6d86fb0100000100000000000006626c702d7873066e696369726103636f6d00000f00'
2914     if test X"$1" = X"OFPR_INVALID_TTL"; then shift;
2915         echo >>expout "OFPT_PACKET_IN (OF1.4): total_len=76 in_port=ANY (via invalid_ttl) data_len=76 (unbuffered)
2916 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"
2917     fi
2918
2919 # OFPT_PORT_STATUS, OFPPR_ADD
2920     ovs-vsctl add-port br0 test -- set Interface test type=dummy
2921     if test X"$1" = X"OFPPR_ADD"; then shift;
2922         echo >>expout "OFPT_PORT_STATUS (OF1.4): ADD: ${INDEX}(test): addr:aa:55:aa:55:00:0x
2923      config:     PORT_DOWN
2924      state:      LINK_DOWN
2925      speed: 0 Mbps now, 0 Mbps max"
2926     fi
2927
2928     # OFPT_PORT_STATUS, OFPPR_MODIFY
2929     ovs-ofctl -O OpenFlow14 -vwarn mod-port br0 test up
2930     if test X"$1" = X"OFPPR_MODIFY"; then shift;
2931         echo >>expout "OFPT_PORT_STATUS (OF1.4): MOD: ${INDEX}(test): addr:aa:55:aa:55:00:0x
2932      config:     0
2933      state:      LINK_DOWN
2934      speed: 0 Mbps now, 0 Mbps max
2935 OFPT_PORT_STATUS (OF1.4): MOD: ${INDEX}(test): addr:aa:55:aa:55:00:0x
2936      config:     0
2937      state:      0
2938      speed: 0 Mbps now, 0 Mbps max"
2939     fi
2940
2941     # OFPT_PORT_STATUS, OFPPR_DELETE
2942     ovs-vsctl del-port br0 test
2943     if test X"$1" = X"OFPPR_DELETE"; then shift;
2944         echo >>expout "OFPT_PORT_STATUS (OF1.4): DEL: ${INDEX}(test): addr:aa:55:aa:55:00:0x
2945      config:     0
2946      state:      0
2947      speed: 0 Mbps now, 0 Mbps max"
2948     fi
2949
2950     # OFPT_FLOW_REMOVED, OFPRR_DELETE
2951     ovs-ofctl -O OpenFlow14 add-flow br0 send_flow_rem,actions=drop
2952     ovs-ofctl -O OpenFlow14 --strict del-flows br0 ''
2953     if test X"$1" = X"OFPRR_DELETE"; then shift;
2954         echo >>expout "OFPT_FLOW_REMOVED (OF1.4):  reason=delete table_id=0"
2955     fi
2956
2957     # OFPT_FLOW_REMOVED, OFPRR_GROUP_DELETE
2958     ovs-ofctl -O OpenFlow14 add-group br0 group_id=1234,type=all,bucket=output:10
2959     ovs-ofctl -O OpenFlow14 add-flow br0 send_flow_rem,actions=group:1234
2960     ovs-ofctl -O OpenFlow14 --strict del-groups br0 group_id=1234
2961     if test X"$1" = X"OFPRR_GROUP_DELETE"; then shift;
2962         echo >>expout "OFPT_FLOW_REMOVED (OF1.4):  reason=group_delete table_id=0"
2963     fi
2964
2965     # OFPT_TABLE_STATUS, OFPTR_VACANCY_UP
2966     if test X"$1" = X"OFPTR_VACANCY_UP"; then shift;
2967         ovs-vsctl -- --id=@t1 create Flow_Table flow-limit=10 -- set bridge br0 flow_tables:1=@t1
2968
2969         # Turn on vacancy events, then add flows until we're full.
2970         # With initial vacancy of 100% and vacancy_up of 80%, so that
2971         # vacancy >= vacancy_up, this enables VACANY_DOWN events, so
2972         # we get a single such message when vacancy dips below 20%.
2973         ovs-ofctl -O OpenFlow14 mod-table br0 1 vacancy:20,80
2974         ovs-ofctl -O OpenFlow14 add-flow br0 table=1,in_port=1,actions=2
2975         ovs-ofctl -O OpenFlow14 add-flow br0 table=1,in_port=2,actions=2
2976         ovs-ofctl -O OpenFlow14 add-flow br0 table=1,in_port=3,actions=2
2977         ovs-ofctl -O OpenFlow14 add-flow br0 table=1,in_port=4,actions=2
2978         ovs-ofctl -O OpenFlow14 add-flow br0 table=1,in_port=5,actions=2
2979         ovs-ofctl -O OpenFlow14 add-flow br0 table=1,in_port=6,actions=2
2980         ovs-ofctl -O OpenFlow14 add-flow br0 table=1,in_port=7,actions=2
2981         ovs-ofctl -O OpenFlow14 add-flow br0 table=1,in_port=8,actions=2
2982         ovs-ofctl -O OpenFlow14 add-flow br0 table=1,in_port=9,actions=2
2983         ovs-ofctl -O OpenFlow14 add-flow br0 table=1,in_port=10,actions=2
2984         echo >>expout "OFPT_TABLE_STATUS (OF1.4): reason=VACANCY_DOWN
2985 table_desc:-
2986   table 1:
2987    eviction=off eviction_flags=OTHER|IMPORTANCE|LIFETIME
2988    vacancy=on vacancy_down=20% vacancy_up=80% vacancy=10%"
2989         # Then delete flows until we're empty.  Sending the
2990         # VACANCY_DOWN message enabled VACANCY_UP events, so we get a
2991         # single such message when vacancy rises above 80%.
2992         ovs-ofctl -O OpenFlow14 del-flows br0 table=1,in_port=1
2993         ovs-ofctl -O OpenFlow14 del-flows br0 table=1,in_port=2
2994         ovs-ofctl -O OpenFlow14 del-flows br0 table=1,in_port=3
2995         ovs-ofctl -O OpenFlow14 del-flows br0 table=1,in_port=4
2996         ovs-ofctl -O OpenFlow14 del-flows br0 table=1,in_port=5
2997         ovs-ofctl -O OpenFlow14 del-flows br0 table=1,in_port=6
2998         ovs-ofctl -O OpenFlow14 del-flows br0 table=1,in_port=7
2999         ovs-ofctl -O OpenFlow14 del-flows br0 table=1,in_port=8
3000         ovs-ofctl -O OpenFlow14 del-flows br0 table=1,in_port=9
3001         ovs-ofctl -O OpenFlow14 del-flows br0 table=1,in_port=10
3002         echo >>expout "OFPT_TABLE_STATUS (OF1.4): reason=VACANCY_UP
3003 table_desc:-
3004   table 1:
3005    eviction=off eviction_flags=OTHER|IMPORTANCE|LIFETIME
3006    vacancy=on vacancy_down=20% vacancy_up=80% vacancy=90%"
3007
3008         # Now approach vacancy from the other direction.  First
3009         # disable vacancy events.  With initial vacancy of 70%, so
3010         # that vacancy < vacancy_up, this enables VACANCY_UP events.
3011         # That means that filling up the table generates no message,
3012         # but deleting all the flows generates VACANCY_UP at the point
3013         # vacancy rises above 80%.
3014         ovs-ofctl -O OpenFlow14 mod-table br0 1 novacancy
3015         ovs-ofctl -O OpenFlow14 add-flow br0 table=1,in_port=1,actions=2
3016         ovs-ofctl -O OpenFlow14 add-flow br0 table=1,in_port=2,actions=2
3017         ovs-ofctl -O OpenFlow14 add-flow br0 table=1,in_port=3,actions=2
3018         ovs-ofctl -O OpenFlow14 mod-table br0 1 vacancy:20,80
3019         ovs-ofctl -O OpenFlow14 add-flow br0 table=1,in_port=4,actions=2
3020         ovs-ofctl -O OpenFlow14 add-flow br0 table=1,in_port=5,actions=2
3021         ovs-ofctl -O OpenFlow14 add-flow br0 table=1,in_port=6,actions=2
3022         ovs-ofctl -O OpenFlow14 add-flow br0 table=1,in_port=7,actions=2
3023         ovs-ofctl -O OpenFlow14 add-flow br0 table=1,in_port=8,actions=2
3024         ovs-ofctl -O OpenFlow14 add-flow br0 table=1,in_port=9,actions=2
3025         ovs-ofctl -O OpenFlow14 add-flow br0 table=1,in_port=10,actions=2
3026         ovs-ofctl -O OpenFlow14 del-flows br0 table=1,in_port=1
3027         ovs-ofctl -O OpenFlow14 del-flows br0 table=1,in_port=2
3028         ovs-ofctl -O OpenFlow14 del-flows br0 table=1,in_port=3
3029         ovs-ofctl -O OpenFlow14 del-flows br0 table=1,in_port=4
3030         ovs-ofctl -O OpenFlow14 del-flows br0 table=1,in_port=5
3031         ovs-ofctl -O OpenFlow14 del-flows br0 table=1,in_port=6
3032         ovs-ofctl -O OpenFlow14 del-flows br0 table=1,in_port=7
3033         ovs-ofctl -O OpenFlow14 del-flows br0 table=1,in_port=8
3034         ovs-ofctl -O OpenFlow14 del-flows br0 table=1,in_port=9
3035         ovs-ofctl -O OpenFlow14 del-flows br0 table=1,in_port=10
3036         echo >>expout "OFPT_TABLE_STATUS (OF1.4): reason=VACANCY_UP
3037 table_desc:-
3038   table 1:
3039    eviction=off eviction_flags=OTHER|IMPORTANCE|LIFETIME
3040    vacancy=on vacancy_down=20% vacancy_up=80% vacancy=90%"
3041     fi
3042
3043     AT_FAIL_IF([test X"$1" != X])
3044
3045     ovs-appctl -t ovs-ofctl ofctl/barrier
3046     echo >>expout "OFPT_BARRIER_REPLY (OF1.4):"
3047
3048     AT_CHECK(
3049       [[sed '
3050 s/ (xid=0x[0-9a-fA-F]*)//
3051 s/ *duration.*//
3052 s/00:0.$/00:0x/' < monitor.log]],
3053       [0], [expout])
3054 }
3055
3056 # It's a service connection so initially there should be no async messages.
3057 check_async 1
3058
3059 # Set miss_send_len to 128, turning on packet-ins for our service connection.
3060 ovs-appctl -t ovs-ofctl ofctl/send 0509000c0123456700000080
3061 check_async 2 OFPR_ACTION OFPPR_ADD OFPPR_MODIFY OFPPR_DELETE OFPRR_DELETE OFPRR_GROUP_DELETE
3062
3063 # Become slave (OF 1.4), which should disable everything except port status.
3064 ovs-appctl -t ovs-ofctl ofctl/send 051800180000000200000003000000000000000000000001
3065 check_async 3 OFPPR_ADD OFPPR_MODIFY OFPPR_DELETE
3066
3067 # Use OF 1.4 OFPT_SET_ASYNC to enable a patchwork of asynchronous messages.
3068 ovs-appctl -t ovs-ofctl ofctl/send 051c0040000000020000000800000005000100080000000200020008000000020003000800000005000400080000001c00050008000000050008000800000018
3069 check_async 4 OFPR_INVALID_TTL OFPPR_DELETE OFPRR_DELETE OFPRR_GROUP_DELETE OFPTR_VACANCY_UP
3070
3071 # Set controller ID 123.
3072 ovs-appctl -t ovs-ofctl ofctl/send 05040018000000030000232000000014000000000000007b
3073 check_async 5 OFPR_NO_MATCH OFPPR_DELETE OFPRR_DELETE OFPRR_GROUP_DELETE
3074
3075 # Restore controller ID 0.
3076 ovs-appctl -t ovs-ofctl ofctl/send 050400180000000300002320000000140000000000000000
3077
3078 # Become master (OF 1.4).
3079 ovs-appctl -t ovs-ofctl ofctl/send 051800180000000400000002000000000000000000000002
3080 check_async 6 OFPR_ACTION OFPPR_ADD OFPPR_MODIFY OFPRR_DELETE
3081
3082 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
3083 OVS_VSWITCHD_STOP
3084 AT_CLEANUP
3085
3086 AT_SETUP([ofproto - asynchronous message control (OpenFlow 1.5)])
3087 OVS_VSWITCHD_START
3088 AT_CHECK([ovs-ofctl -O OpenFlow15 -P standard monitor br0 --detach --no-chdir --pidfile])
3089 check_async () {
3090     printf '\n\n--- check_async %d ---\n\n\n' $1
3091     INDEX=$1
3092     shift
3093
3094     ovs-appctl -t ovs-ofctl ofctl/barrier
3095     ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
3096     : > expout
3097
3098     # Other tests are not working with OF 1.5, and message
3099     # format may change, so leave them out.
3100
3101     # OFPT_PORT_STATUS, OFPPR_ADD
3102     ovs-vsctl add-port br0 test -- set Interface test type=dummy
3103     if test X"$1" = X"OFPPR_ADD"; then shift;
3104         echo >>expout "OFPT_PORT_STATUS (OF1.5): ADD: ${INDEX}(test): addr:aa:55:aa:55:00:0x
3105      config:     PORT_DOWN
3106      state:      LINK_DOWN
3107      speed: 0 Mbps now, 0 Mbps max"
3108     fi
3109
3110     # OFPT_PORT_STATUS, OFPPR_MODIFY
3111     ovs-ofctl -O OpenFlow15 -vwarn mod-port br0 test up
3112     if test X"$1" = X"OFPPR_MODIFY"; then shift;
3113         echo >>expout "OFPT_PORT_STATUS (OF1.5): MOD: ${INDEX}(test): addr:aa:55:aa:55:00:0x
3114      config:     0
3115      state:      LINK_DOWN
3116      speed: 0 Mbps now, 0 Mbps max
3117 OFPT_PORT_STATUS (OF1.5): MOD: 2(test): addr:aa:55:aa:55:00:0x
3118      config:     0
3119      state:      0
3120      speed: 0 Mbps now, 0 Mbps max"
3121     fi
3122
3123     # OFPT_PORT_STATUS, OFPPR_DELETE
3124     ovs-vsctl del-port br0 test
3125     if test X"$1" = X"OFPPR_DELETE"; then shift;
3126         echo >>expout "OFPT_PORT_STATUS (OF1.5): DEL: ${INDEX}(test): addr:aa:55:aa:55:00:0x
3127      config:     0
3128      state:      0
3129      speed: 0 Mbps now, 0 Mbps max"
3130     fi
3131
3132     AT_FAIL_IF([test X"$1" != X])
3133
3134     ovs-appctl -t ovs-ofctl ofctl/barrier
3135     echo >>expout "OFPT_BARRIER_REPLY (OF1.5):"
3136
3137     AT_CHECK(
3138       [[sed '
3139 s/ (xid=0x[0-9a-fA-F]*)//
3140 s/ *duration.*//
3141 s/00:0.$/00:0x/' < monitor.log]],
3142       [0], [expout])
3143 }
3144
3145 # It's a service connection so initially there should be no async messages.
3146 check_async 1
3147
3148 # If we don't set this, async messages are not received.
3149 # Set miss_send_len to 128, turning on packet-ins for our service connection.
3150 ovs-appctl -t ovs-ofctl ofctl/send 0609000c0123456700000080
3151 check_async 2 OFPPR_ADD OFPPR_MODIFY OFPPR_DELETE
3152
3153 # Set-async has changed in OF 1.4 and is not yet implemented.
3154
3155 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
3156 OVS_VSWITCHD_STOP
3157 AT_CLEANUP
3158
3159 dnl This test checks that the role request/response messaging works
3160 dnl and that generation_id is handled properly.
3161 AT_SETUP([ofproto - controller role (OpenFlow 1.2)])
3162 OVS_VSWITCHD_START
3163 on_exit 'kill `cat c1.pid c2.pid`'
3164
3165 # Start two ovs-ofctl controller processes.
3166 AT_CAPTURE_FILE([monitor1.log])
3167 AT_CAPTURE_FILE([expout1])
3168 AT_CAPTURE_FILE([experr1])
3169 AT_CAPTURE_FILE([monitor2.log])
3170 AT_CAPTURE_FILE([expout2])
3171 AT_CAPTURE_FILE([experr2])
3172 for i in 1 2; do
3173      AT_CHECK([ovs-ofctl -O OpenFlow12 monitor br0 --detach --no-chdir --pidfile=`pwd`/c$i.pid --unixctl=`pwd`/c$i])
3174     ovs-appctl -t `pwd`/c$i ofctl/barrier
3175     ovs-appctl -t `pwd`/c$i ofctl/set-output-file monitor$i.log
3176     : > expout$i
3177     : > experr$i
3178
3179     # find out current role
3180     ovs-appctl -t `pwd`/c$i ofctl/send 031800180000000200000000000000000000000000000000
3181     echo >>experr$i "send: OFPT_ROLE_REQUEST (OF1.2): role=nochange"
3182     echo >>expout$i "OFPT_ROLE_REPLY (OF1.2): role=equal"
3183 done
3184
3185 # controller 1: Become slave (generation_id is initially undefined, so
3186 # 2^63+2 should not be stale)
3187 ovs-appctl -t `pwd`/c1 ofctl/send 031800180000000300000003000000008000000000000002
3188 echo >>experr1 "send: OFPT_ROLE_REQUEST (OF1.2): role=slave generation_id=9223372036854775810"
3189 echo >>expout1 "OFPT_ROLE_REPLY (OF1.2): role=slave generation_id=9223372036854775810"
3190
3191 # controller 2: Become master.
3192 ovs-appctl -t `pwd`/c2 ofctl/send 031800180000000300000002000000008000000000000003
3193 echo >>experr2 "send: OFPT_ROLE_REQUEST (OF1.2): role=master generation_id=9223372036854775811"
3194 echo >>expout2 "OFPT_ROLE_REPLY (OF1.2): role=master generation_id=9223372036854775811"
3195
3196 # controller 1: Try to become the master using a stale generation ID
3197 ovs-appctl -t `pwd`/c1 ofctl/send 031800180000000400000002000000000000000000000003
3198 echo >>experr1 "send: OFPT_ROLE_REQUEST (OF1.2): role=master generation_id=3"
3199 echo >>expout1 "OFPT_ERROR (OF1.2): OFPRRFC_STALE"
3200 echo >>expout1 "OFPT_ROLE_REQUEST (OF1.2): role=master generation_id=3"
3201
3202 # controller 1: Become master using a valid generation ID
3203 ovs-appctl -t `pwd`/c1 ofctl/send 031800180000000500000002000000000000000000000001
3204 echo >>experr1 "send: OFPT_ROLE_REQUEST (OF1.2): role=master generation_id=1"
3205 echo >>expout1 "OFPT_ROLE_REPLY (OF1.2): role=master generation_id=1"
3206
3207 for i in 1 2; do
3208     ovs-appctl -t `pwd`/c$i ofctl/barrier
3209     echo >>expout$i "OFPT_BARRIER_REPLY (OF1.2):"
3210 done
3211
3212 # Check output.
3213 for i in 1 2; do
3214     cp expout$i expout
3215     AT_CHECK([grep -v '^send:' monitor$i.log | strip_xids], [0], [expout])
3216     cp experr$i expout
3217     AT_CHECK([grep '^send:' monitor$i.log | strip_xids], [0], [expout])
3218 done
3219 OVS_VSWITCHD_STOP
3220 AT_CLEANUP
3221
3222 dnl This test checks that the role request/response messaging works,
3223 dnl that generation_id is handled properly, and that role status update
3224 dnl messages are sent when a controller's role gets changed from master
3225 dnl to slave.
3226 AT_SETUP([ofproto - controller role (OpenFlow 1.4)])
3227 OVS_VSWITCHD_START
3228 on_exit 'kill `cat c1.pid c2.pid`'
3229
3230 # Start two ovs-ofctl controller processes.
3231 AT_CAPTURE_FILE([monitor1.log])
3232 AT_CAPTURE_FILE([expout1])
3233 AT_CAPTURE_FILE([experr1])
3234 AT_CAPTURE_FILE([monitor2.log])
3235 AT_CAPTURE_FILE([expout2])
3236 AT_CAPTURE_FILE([experr2])
3237 for i in 1 2; do
3238      AT_CHECK([ovs-ofctl -O OpenFlow14 monitor br0 --detach --no-chdir --pidfile=`pwd`/c$i.pid --unixctl=`pwd`/c$i])
3239     ovs-appctl -t `pwd`/c$i ofctl/barrier
3240     ovs-appctl -t `pwd`/c$i ofctl/set-output-file monitor$i.log
3241     : > expout$i
3242     : > experr$i
3243
3244     # find out current role
3245     ovs-appctl -t `pwd`/c$i ofctl/send 051800180000000200000000000000000000000000000000
3246     echo >>experr$i "send: OFPT_ROLE_REQUEST (OF1.4): role=nochange"
3247     echo >>expout$i "OFPT_ROLE_REPLY (OF1.4): role=equal"
3248 done
3249
3250 # controller 1: Become slave (generation_id is initially undefined, so
3251 # 2^63+2 should not be stale)
3252 ovs-appctl -t `pwd`/c1 ofctl/send 051800180000000300000003000000008000000000000002
3253 echo >>experr1 "send: OFPT_ROLE_REQUEST (OF1.4): role=slave generation_id=9223372036854775810"
3254 echo >>expout1 "OFPT_ROLE_REPLY (OF1.4): role=slave generation_id=9223372036854775810"
3255
3256 # controller 2: Become master.
3257 ovs-appctl -t `pwd`/c2 ofctl/send 051800180000000300000002000000008000000000000003
3258 echo >>experr2 "send: OFPT_ROLE_REQUEST (OF1.4): role=master generation_id=9223372036854775811"
3259 echo >>expout2 "OFPT_ROLE_REPLY (OF1.4): role=master generation_id=9223372036854775811"
3260
3261 # controller 1: Try to become the master using a stale generation ID
3262 ovs-appctl -t `pwd`/c1 ofctl/send 051800180000000400000002000000000000000000000003
3263 echo >>experr1 "send: OFPT_ROLE_REQUEST (OF1.4): role=master generation_id=3"
3264 echo >>expout1 "OFPT_ERROR (OF1.4): OFPRRFC_STALE"
3265 echo >>expout1 "OFPT_ROLE_REQUEST (OF1.4): role=master generation_id=3"
3266
3267 # controller 1: Become master using a valid generation ID
3268 ovs-appctl -t `pwd`/c1 ofctl/send 051800180000000500000002000000000000000000000001
3269 echo >>experr1 "send: OFPT_ROLE_REQUEST (OF1.4): role=master generation_id=1"
3270 echo >>expout1 "OFPT_ROLE_REPLY (OF1.4): role=master generation_id=1"
3271 echo >>expout2 "OFPT_ROLE_STATUS (OF1.4): role=slave generation_id=1 reason=master_request"
3272
3273 for i in 1 2; do
3274     ovs-appctl -t `pwd`/c$i ofctl/barrier
3275     echo >>expout$i "OFPT_BARRIER_REPLY (OF1.4):"
3276 done
3277
3278 # Check output.
3279 for i in 1 2; do
3280     cp expout$i expout
3281     AT_CHECK([grep -v '^send:' monitor$i.log | strip_xids], [0], [expout])
3282     cp experr$i expout
3283     AT_CHECK([grep '^send:' monitor$i.log | strip_xids], [0], [expout])
3284 done
3285 OVS_VSWITCHD_STOP
3286 AT_CLEANUP
3287
3288 dnl This test checks the Group and meter notifications when a group mod
3289 dnl command is sent from one controller and the reply is received by
3290 dnl other controllers.
3291 AT_SETUP([ofproto - requestforward (OpenFlow 1.4)])
3292 OVS_VSWITCHD_START
3293 on_exit 'kill `cat c1.pid c2.pid c3.pid`'
3294
3295 # Start two ovs-ofctl controller processes.
3296 AT_CAPTURE_FILE([monitor1.log])
3297 AT_CAPTURE_FILE([expout1])
3298 AT_CAPTURE_FILE([monitor2.log])
3299 AT_CAPTURE_FILE([expout2])
3300 AT_CAPTURE_FILE([monitor3.log])
3301 AT_CAPTURE_FILE([expout3])
3302
3303 ovs-ofctl -O OpenFlow15 monitor br0 --detach --no-chdir --pidfile=`pwd`/c1.pid --unixctl=`pwd`/c1
3304 ovs-ofctl -O OpenFlow14 monitor br0 --detach --no-chdir --pidfile=`pwd`/c2.pid --unixctl=`pwd`/c2
3305 ovs-ofctl -O OpenFlow14 monitor br0 --detach --no-chdir --pidfile=`pwd`/c3.pid --unixctl=`pwd`/c3
3306
3307 check_async () {
3308     for i in 1 3; do
3309         ovs-appctl -t `pwd`/c$i ofctl/barrier
3310         ovs-appctl -t `pwd`/c$i ofctl/set-output-file monitor$i.log
3311         : > expout$i
3312     done
3313
3314     printf '\n\n--- check_async %d ---\n\n\n' $1
3315     INDEX=$1
3316     shift
3317
3318     # OFPGC_ADD
3319     ovs-appctl -t `pwd`/c2 ofctl/send "050f0020000000020000000000000001 00100000 ffffffffffffffff 00000000"
3320     if test X"$1" = X"OFPGC_ADD"; then shift;
3321         echo >>expout2 "send: OFPT_GROUP_MOD (OF1.4):
3322  ADD group_id=1,type=all,bucket=actions=drop"
3323         echo >>expout1 "OFPT_REQUESTFORWARD (OF1.5): reason=group_mod
3324  ADD group_id=1,type=all,bucket=bucket_id:0,actions=drop"
3325         echo >>expout3 "OFPT_REQUESTFORWARD (OF1.4): reason=group_mod
3326  ADD group_id=1,type=all,bucket=actions=drop"
3327     fi
3328
3329     # OFPGC_MODIFY
3330     ovs-appctl -t `pwd`/c2 ofctl/send "050f0020000000020001010000000001 00100000 ffffffffffffffff 00000000"
3331     if test X"$1" = X"OFPGC_MODIFY"; then shift;
3332         echo >>expout2 "send: OFPT_GROUP_MOD (OF1.4):
3333  MOD group_id=1,type=select,bucket=weight:0,actions=drop"
3334         echo >>expout1 "OFPT_REQUESTFORWARD (OF1.5): reason=group_mod
3335  MOD group_id=1,type=select,bucket=bucket_id:0,weight:0,actions=drop"
3336         echo >>expout3 "OFPT_REQUESTFORWARD (OF1.4): reason=group_mod
3337  MOD group_id=1,type=select,bucket=weight:0,actions=drop"
3338     fi
3339
3340     ovs-appctl -t `pwd`/c1 ofctl/barrier
3341     echo >>expout1 "OFPT_BARRIER_REPLY (OF1.5):"
3342     ovs-appctl -t `pwd`/c2 ofctl/barrier
3343     echo >>expout2 "OFPT_BARRIER_REPLY (OF1.4):"
3344     ovs-appctl -t `pwd`/c3 ofctl/barrier
3345     echo >>expout3 "OFPT_BARRIER_REPLY (OF1.4):"
3346
3347     # Check output.
3348     for i in 1 3; do
3349         cp expout$i expout
3350         AT_CHECK(
3351       [[sed '
3352 s/ (xid=0x[0-9a-fA-F]*)//'< monitor$i.log]],
3353       [0], [expout])
3354     done
3355 }
3356
3357 # controller 1: Become slave
3358 ovs-appctl -t `pwd`/c1 ofctl/send 061800180000000300000003000000008000000000000002
3359
3360 # controller 2: Become master
3361 ovs-appctl -t `pwd`/c2 ofctl/send 051800180000000300000002000000008000000000000003
3362
3363 # controller 1: Become slave
3364 ovs-appctl -t `pwd`/c3 ofctl/send 051800180000000300000003000000008000000000000004
3365
3366 # controller 1: Enabled requestforward using set Asynchronous message
3367 ovs-appctl -t `pwd`/c1 ofctl/send 061c00280000000200000008000000050002000800000002000400080000001a000a000800000003
3368
3369 # controller 2: Enabled requestforward using set Asynchronous message
3370 ovs-appctl -t `pwd`/c2 ofctl/send 051c002800000002000100080000000200030008000000050005000800000005000b000800000003
3371
3372 # controller 1: Enabled requestforward using set Asynchronous message
3373 ovs-appctl -t `pwd`/c3 ofctl/send 051c00280000000200000008000000050002000800000002000400080000001a000a000800000003
3374 check_async 1 OFPGC_ADD OFPGC_MODIFY
3375
3376 OVS_VSWITCHD_STOP
3377 AT_CLEANUP
3378
3379 dnl This test checks that OFPT_PACKET_OUT accepts both OFPP_NONE (as
3380 dnl specified by OpenFlow 1.0) and OFPP_CONTROLLER (used by some
3381 dnl controllers despite the spec) as meaning a packet that was generated
3382 dnl by the controller.
3383 AT_SETUP([ofproto - packet-out from controller (OpenFlow 1.0)])
3384 OVS_VSWITCHD_START
3385 add_of_ports br0 1
3386
3387 # Start a monitor listening for packet-ins.
3388 AT_CHECK([ovs-ofctl -P standard monitor br0 --detach --no-chdir --pidfile])
3389 ovs-appctl -t ovs-ofctl ofctl/send 0109000c0123456700000080
3390 ovs-appctl -t ovs-ofctl ofctl/barrier
3391 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
3392 AT_CAPTURE_FILE([monitor.log])
3393
3394 # Send some packet-outs with OFPP_NONE and OFPP_CONTROLLER (65533) as in_port.
3395 AT_CHECK([ovs-ofctl packet-out br0 none controller,1 '0001020304050010203040501234'])
3396 AT_CHECK([ovs-ofctl packet-out br0 controller controller,1 '0001020304050010203040505678'])
3397
3398 # Stop the monitor and check its output.
3399 ovs-appctl -t ovs-ofctl ofctl/barrier
3400 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
3401
3402 ovs-ofctl dump-ports br0
3403
3404 AT_CHECK([sed 's/ (xid=0x[[0-9a-fA-F]]*)//' monitor.log], [0], [dnl
3405 OFPT_PACKET_IN: total_len=14 in_port=ANY (via action) data_len=14 (unbuffered)
3406 vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1234
3407 OFPT_PACKET_IN: total_len=14 in_port=CONTROLLER (via action) data_len=14 (unbuffered)
3408 vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x5678
3409 OFPT_BARRIER_REPLY:
3410 ])
3411
3412 OVS_VSWITCHD_STOP
3413 AT_CLEANUP
3414
3415 dnl This test checks that OFPT_PACKET_OUT accepts both OFPP_NONE (as
3416 dnl specified by OpenFlow 1.2) and OFPP_CONTROLLER (used by some
3417 dnl controllers despite the spec) as meaning a packet that was generated
3418 dnl by the controller.
3419 AT_SETUP([ofproto - packet-out from controller (OpenFlow 1.2)])
3420 OVS_VSWITCHD_START
3421
3422 # Start a monitor listening for packet-ins.
3423 AT_CHECK([ovs-ofctl -O OpenFlow12 -P standard monitor br0 --detach --no-chdir --pidfile])
3424 ovs-appctl -t ovs-ofctl ofctl/send 0309000c0123456700000080
3425 ovs-appctl -t ovs-ofctl ofctl/barrier
3426 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
3427 AT_CAPTURE_FILE([monitor.log])
3428
3429 # Send some packet-outs with OFPP_NONE and OFPP_CONTROLLER (65533) as in_port.
3430 AT_CHECK([ovs-ofctl -O OpenFlow12 packet-out br0 none controller '0001020304050010203040501234'])
3431 AT_CHECK([ovs-ofctl -O OpenFlow12 packet-out br0 4294967293 controller '0001020304050010203040505678'])
3432
3433 # Stop the monitor and check its output.
3434 ovs-appctl -t ovs-ofctl ofctl/barrier
3435 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
3436
3437 AT_CHECK([sed 's/ (xid=0x[[0-9a-fA-F]]*)//' monitor.log], [0], [dnl
3438 OFPT_PACKET_IN (OF1.2): total_len=14 in_port=ANY (via action) data_len=14 (unbuffered)
3439 vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1234
3440 OFPT_PACKET_IN (OF1.2): total_len=14 in_port=CONTROLLER (via action) data_len=14 (unbuffered)
3441 vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x5678
3442 OFPT_BARRIER_REPLY (OF1.2):
3443 ])
3444
3445 OVS_VSWITCHD_STOP
3446 AT_CLEANUP
3447
3448 dnl This test checks that OFPT_PACKET_OUT accepts both OFPP_NONE (as
3449 dnl specified by OpenFlow 1.1) and OFPP_CONTROLLER (used by some
3450 dnl controllers despite the spec) as meaning a packet that was generated
3451 dnl by the controller.
3452 AT_SETUP([ofproto - packet-out from controller (OpenFlow 1.1)])
3453 OVS_VSWITCHD_START
3454
3455 # Start a monitor listening for packet-ins.
3456 AT_CHECK([ovs-ofctl -O OpenFlow11 -P standard monitor br0 --detach --no-chdir --pidfile])
3457 ovs-appctl -t ovs-ofctl ofctl/send 0209000c0123456700000080
3458 ovs-appctl -t ovs-ofctl ofctl/barrier
3459 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
3460 AT_CAPTURE_FILE([monitor.log])
3461
3462 # Send some packet-outs with OFPP_NONE and OFPP_CONTROLLER (65533) as in_port.
3463 AT_CHECK([ovs-ofctl -O OpenFlow11 packet-out br0 none controller '0001020304050010203040501234'])
3464 AT_CHECK([ovs-ofctl -O OpenFlow11 packet-out br0 4294967293 controller '0001020304050010203040505678'])
3465
3466 # Stop the monitor and check its output.
3467 ovs-appctl -t ovs-ofctl ofctl/barrier
3468 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
3469
3470 AT_CHECK([sed 's/ (xid=0x[[0-9a-fA-F]]*)//' monitor.log], [0], [dnl
3471 OFPT_PACKET_IN (OF1.1): total_len=14 in_port=ANY (via action) data_len=14 (unbuffered)
3472 vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1234
3473 OFPT_PACKET_IN (OF1.1): total_len=14 in_port=CONTROLLER (via action) data_len=14 (unbuffered)
3474 vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x5678
3475 OFPT_BARRIER_REPLY (OF1.1):
3476 ])
3477
3478 OVS_VSWITCHD_STOP
3479 AT_CLEANUP
3480
3481 dnl This test checks that metadata and userdata are encoded in NXT_PACKET_IN2.
3482 AT_SETUP([ofproto - packet-out with metadata and userdata (NXT_PACKET_IN2)])
3483 OVS_VSWITCHD_START
3484
3485 # Start a monitor listening for packet-ins.
3486 AT_CHECK([ovs-ofctl -P nxt_packet_in2 monitor br0 --detach --no-chdir --pidfile])
3487 ovs-appctl -t ovs-ofctl ofctl/send 0109000c0123456700000080
3488 ovs-appctl -t ovs-ofctl ofctl/barrier
3489 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
3490 AT_CAPTURE_FILE([monitor.log])
3491
3492 # Send a packet-out with a load action to set some metadata, and forward to controller
3493 AT_CHECK([ovs-ofctl packet-out br0 controller 'load(0xfafafafa5a5a5a5a->OXM_OF_METADATA[[0..63]]), load(0xaa->NXM_NX_PKT_MARK[[]]), controller(userdata=01.02.03.04.05)' '0001020304050010203040501234'])
3494
3495 # Stop the monitor and check its output.
3496 ovs-appctl -t ovs-ofctl ofctl/barrier
3497 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
3498
3499 AT_CHECK([sed 's/ (xid=0x[[0-9a-fA-F]]*)//' monitor.log], [0], [dnl
3500 NXT_PACKET_IN2: total_len=14 pkt_mark=0xaa,metadata=0xfafafafa5a5a5a5a,in_port=CONTROLLER (via action) data_len=14 (unbuffered)
3501  userdata=01.02.03.04.05
3502 vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1234
3503 OFPT_BARRIER_REPLY:
3504 ])
3505
3506 OVS_VSWITCHD_STOP
3507 AT_CLEANUP
3508
3509 dnl This test checks that metadata is encoded in packet_in structures,
3510 dnl supported by NXAST.
3511 AT_SETUP([ofproto - packet-out with metadata (NXM)])
3512 OVS_VSWITCHD_START
3513
3514 # Start a monitor listening for packet-ins.
3515 AT_CHECK([ovs-ofctl -P nxt_packet_in monitor br0 --detach --no-chdir --pidfile])
3516 ovs-appctl -t ovs-ofctl ofctl/send 0109000c0123456700000080
3517 ovs-appctl -t ovs-ofctl ofctl/barrier
3518 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
3519 AT_CAPTURE_FILE([monitor.log])
3520
3521 # Send a packet-out with a load action to set some metadata, and forward to controller
3522 AT_CHECK([ovs-ofctl packet-out br0 controller 'load(0xfafafafa5a5a5a5a->OXM_OF_METADATA[[0..63]]), load(0xaa->NXM_NX_PKT_MARK[[]]), controller' '0001020304050010203040501234'])
3523
3524 # Stop the monitor and check its output.
3525 ovs-appctl -t ovs-ofctl ofctl/barrier
3526 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
3527
3528 AT_CHECK([sed 's/ (xid=0x[[0-9a-fA-F]]*)//' monitor.log], [0], [dnl
3529 NXT_PACKET_IN: total_len=14 pkt_mark=0xaa,metadata=0xfafafafa5a5a5a5a,in_port=CONTROLLER (via action) data_len=14 (unbuffered)
3530 vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1234
3531 OFPT_BARRIER_REPLY:
3532 ])
3533
3534 OVS_VSWITCHD_STOP
3535 AT_CLEANUP
3536
3537 dnl This test checks that metadata is encoded in packet_in structures,
3538 dnl supported by NXAST.
3539 AT_SETUP([ofproto - packet-out with metadata (OpenFlow 1.2)])
3540 OVS_VSWITCHD_START
3541
3542 # Start a monitor listening for packet-ins.
3543 AT_CHECK([ovs-ofctl -O OpenFlow12 -P standard monitor br0 --detach --no-chdir --pidfile])
3544 ovs-appctl -t ovs-ofctl ofctl/send 0309000c0123456700000080
3545 ovs-appctl -t ovs-ofctl ofctl/barrier
3546 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
3547 AT_CAPTURE_FILE([monitor.log])
3548
3549 # Send a packet-out with a set-field action to set some metadata, and forward to controller
3550 AT_CHECK([ovs-ofctl -O OpenFlow12 packet-out br0 none 'set_field:0xfafafafa5a5a5a5a->metadata, controller' '0001020304050010203040501234'])
3551
3552 # Stop the monitor and check its output.
3553 ovs-appctl -t ovs-ofctl ofctl/barrier
3554 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
3555
3556 AT_CHECK([sed 's/ (xid=0x[[0-9a-fA-F]]*)//' monitor.log], [0], [dnl
3557 OFPT_PACKET_IN (OF1.2): total_len=14 metadata=0xfafafafa5a5a5a5a,in_port=ANY (via action) data_len=14 (unbuffered)
3558 vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1234
3559 OFPT_BARRIER_REPLY (OF1.2):
3560 ])
3561
3562 OVS_VSWITCHD_STOP
3563 AT_CLEANUP
3564
3565 dnl This test checks that metadata is encoded in packet_in structures,
3566 dnl supported by NXAST.
3567 AT_SETUP([ofproto - packet-out with metadata and dual set_field (OpenFlow 1.3)])
3568 OVS_VSWITCHD_START
3569
3570 # Start a monitor listening for packet-ins.
3571 AT_CHECK([ovs-ofctl -O OpenFlow13 -P standard monitor br0 --detach --no-chdir --pidfile])
3572 ovs-appctl -t ovs-ofctl ofctl/send 0409000c0123456700000080
3573 ovs-appctl -t ovs-ofctl ofctl/barrier
3574 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
3575 AT_CAPTURE_FILE([monitor.log])
3576
3577 # Send a packet-out with a couple of set-field action to set some metadata, and forward to controller
3578 AT_CHECK([ovs-ofctl -O OpenFlow13 packet-out br0 none 'set_field:0xfafafafa5a5a5a5a->metadata, set_field:0x6b->metadata, controller' '0001020304050010203040501234'])
3579
3580 # Stop the monitor and check its output.
3581 ovs-appctl -t ovs-ofctl ofctl/barrier
3582 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
3583
3584 AT_CHECK([sed 's/ (xid=0x[[0-9a-fA-F]]*)//' monitor.log], [0], [dnl
3585 OFPT_PACKET_IN (OF1.3): total_len=14 metadata=0x6b,in_port=ANY (via action) data_len=14 (unbuffered)
3586 vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1234
3587 OFPT_BARRIER_REPLY (OF1.3):
3588 ])
3589
3590 OVS_VSWITCHD_STOP
3591 AT_CLEANUP
3592
3593 dnl This test checks that tunnel metadata is encoded in packet_in structures.
3594 AT_SETUP([ofproto - packet-out with tunnel metadata (OpenFlow 1.2)])
3595 OVS_VSWITCHD_START
3596
3597 # Start a monitor listening for packet-ins.
3598 AT_CHECK([ovs-ofctl -O OpenFlow12 -P standard monitor br0 --detach --no-chdir --pidfile])
3599 ovs-appctl -t ovs-ofctl ofctl/send 0309000c0123456700000080
3600 ovs-appctl -t ovs-ofctl ofctl/barrier
3601 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
3602 AT_CAPTURE_FILE([monitor.log])
3603
3604 # Send a packet-out with set field actions to set some tunnel metadata, and forward to controller
3605 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'])
3606
3607 # Stop the monitor and check its output.
3608 ovs-appctl -t ovs-ofctl ofctl/barrier
3609 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
3610
3611 AT_CHECK([sed 's/ (xid=0x[[0-9a-fA-F]]*)//' monitor.log], [0], [dnl
3612 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)
3613 vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1234
3614 OFPT_BARRIER_REPLY (OF1.2):
3615 ])
3616
3617 OVS_VSWITCHD_STOP
3618 AT_CLEANUP
3619
3620 m4_divert_push([PREPARE_TESTS])
3621 # Sorts groups of lines that start with a space, without moving them
3622 # past the nearest line that does not start with a space.
3623 multiline_sort () {
3624     ${PERL} -e '
3625         use warnings;
3626         use strict;
3627         my @buffer = ();
3628         while (<STDIN>) {
3629             if (/^ /) {
3630                 push(@buffer, $_);
3631             } else {
3632                 print $_ foreach sort(@buffer);
3633                 print $_;
3634                 @buffer = ();
3635             }
3636         }
3637         print $_ foreach sort(@buffer);
3638 '
3639 }
3640 m4_divert_pop([PREPARE_TESTS])
3641
3642 AT_SETUP([ofproto - flow monitoring])
3643 AT_KEYWORDS([monitor])
3644 OVS_VSWITCHD_START
3645
3646 ovs-ofctl add-flow br0 in_port=0,dl_vlan=123,actions=output:1
3647
3648 # Start a monitor watching the flow table and check the initial reply.
3649 ovs-ofctl monitor br0 watch: --detach --no-chdir --pidfile >monitor.log 2>&1
3650 AT_CAPTURE_FILE([monitor.log])
3651 ovs-appctl -t ovs-ofctl ofctl/barrier
3652 AT_CHECK([sed 's/ (xid=0x[[1-9a-fA-F]][[0-9a-fA-F]]*)//' monitor.log], [0],
3653   [NXST_FLOW_MONITOR reply:
3654  event=ADDED table=0 cookie=0 in_port=0,dl_vlan=123 actions=output:1
3655 OFPT_BARRIER_REPLY:
3656 ])
3657
3658 # Add, delete, and modify some flows and check the updates.
3659 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
3660 ovs-ofctl add-flow br0 in_port=0,dl_vlan=124,actions=output:2
3661 ovs-ofctl add-flow br0 in_port=0,dl_vlan=123,actions=output:5
3662 ovs-ofctl add-flow br0 in_port=0,dl_vlan=123,dl_vlan_pcp=0,actions=output:6
3663 ovs-ofctl add-flow br0 in_port=0,dl_vlan=123,dl_vlan_pcp=1,actions=output:7
3664 ovs-ofctl add-flow br0 in_port=0,dl_vlan=123,actions=output:8
3665 ovs-ofctl add-flow br0 in_port=0,dl_vlan=65535,dl_vlan_pcp=0,actions=output:9
3666 ovs-ofctl add-flow br0 in_port=0,dl_vlan=65535,dl_vlan_pcp=1,actions=output:10
3667 ovs-ofctl add-flow br0 in_port=0,dl_vlan=65535,actions=output:11
3668 ovs-ofctl add-flow br0 in_port=0,dl_vlan=8191,dl_vlan_pcp=0,actions=output:12
3669 ovs-ofctl add-flow br0 in_port=0,dl_vlan=8191,dl_vlan_pcp=1,actions=output:13
3670 ovs-ofctl add-flow br0 in_port=0,dl_vlan=8191,actions=output:14
3671 ovs-ofctl add-flow br0 in_port=0,dl_vlan=0,dl_vlan_pcp=0,actions=output:15
3672 ovs-ofctl add-flow br0 in_port=0,dl_vlan=0,dl_vlan_pcp=1,actions=output:16
3673 ovs-ofctl add-flow br0 in_port=0,dl_vlan=0,actions=output:17
3674 ovs-ofctl add-flow br0 in_port=0,dl_vlan=0,dl_vlan_pcp=0,actions=output:18
3675 ovs-ofctl add-flow br0 in_port=0,dl_vlan=0,dl_vlan_pcp=1,actions=output:19
3676 ovs-ofctl add-flow br0 in_port=0,dl_vlan=0,actions=output:20
3677 ovs-ofctl add-flow br0 in_port=0,dl_vlan_pcp=0,actions=output:21
3678 ovs-ofctl add-flow br0 in_port=0,dl_vlan_pcp=1,actions=output:22
3679 ovs-ofctl add-flow br0 in_port=0,actions=output:23
3680 ovs-ofctl mod-flows br0 dl_vlan=123,actions=output:3
3681 ovs-ofctl mod-flows br0 cookie=5,dl_vlan=123,actions=output:3
3682 ovs-ofctl del-flows br0 dl_vlan=123
3683 ovs-ofctl del-flows br0
3684 ovs-appctl -t ovs-ofctl ofctl/barrier
3685 AT_CHECK([sed 's/ (xid=0x[[1-9a-fA-F]][[0-9a-fA-F]]*)//' monitor.log | multiline_sort], [0],
3686 [NXST_FLOW_MONITOR reply (xid=0x0):
3687  event=ADDED table=0 cookie=0 in_port=0,dl_vlan=124 actions=output:2
3688 NXST_FLOW_MONITOR reply (xid=0x0):
3689  event=ADDED table=0 cookie=0 in_port=0,dl_vlan=123 actions=output:5
3690 NXST_FLOW_MONITOR reply (xid=0x0):
3691  event=ADDED table=0 cookie=0 in_port=0,dl_vlan=123,dl_vlan_pcp=0 actions=output:6
3692 NXST_FLOW_MONITOR reply (xid=0x0):
3693  event=ADDED table=0 cookie=0 in_port=0,dl_vlan=123,dl_vlan_pcp=1 actions=output:7
3694 NXST_FLOW_MONITOR reply (xid=0x0):
3695  event=ADDED table=0 cookie=0 in_port=0,dl_vlan=123 actions=output:8
3696 NXST_FLOW_MONITOR reply (xid=0x0):
3697  event=ADDED table=0 cookie=0 in_port=0,dl_vlan=0,dl_vlan_pcp=0 actions=output:9
3698 NXST_FLOW_MONITOR reply (xid=0x0):
3699  event=ADDED table=0 cookie=0 in_port=0,dl_vlan=0,dl_vlan_pcp=1 actions=output:10
3700 NXST_FLOW_MONITOR reply (xid=0x0):
3701  event=ADDED table=0 cookie=0 in_port=0,vlan_tci=0x0000 actions=output:11
3702 NXST_FLOW_MONITOR reply (xid=0x0):
3703  event=ADDED table=0 cookie=0 in_port=0,dl_vlan=4095,dl_vlan_pcp=0 actions=output:12
3704 NXST_FLOW_MONITOR reply (xid=0x0):
3705  event=ADDED table=0 cookie=0 in_port=0,dl_vlan=4095,dl_vlan_pcp=1 actions=output:13
3706 NXST_FLOW_MONITOR reply (xid=0x0):
3707  event=ADDED table=0 cookie=0 in_port=0,dl_vlan=4095 actions=output:14
3708 NXST_FLOW_MONITOR reply (xid=0x0):
3709  event=ADDED table=0 cookie=0 in_port=0,dl_vlan=0,dl_vlan_pcp=0 actions=output:15
3710 NXST_FLOW_MONITOR reply (xid=0x0):
3711  event=ADDED table=0 cookie=0 in_port=0,dl_vlan=0,dl_vlan_pcp=1 actions=output:16
3712 NXST_FLOW_MONITOR reply (xid=0x0):
3713  event=ADDED table=0 cookie=0 in_port=0,dl_vlan=0 actions=output:17
3714 NXST_FLOW_MONITOR reply (xid=0x0):
3715  event=ADDED table=0 cookie=0 in_port=0,dl_vlan=0,dl_vlan_pcp=0 actions=output:18
3716 NXST_FLOW_MONITOR reply (xid=0x0):
3717  event=ADDED table=0 cookie=0 in_port=0,dl_vlan=0,dl_vlan_pcp=1 actions=output:19
3718 NXST_FLOW_MONITOR reply (xid=0x0):
3719  event=ADDED table=0 cookie=0 in_port=0,dl_vlan=0 actions=output:20
3720 NXST_FLOW_MONITOR reply (xid=0x0):
3721  event=ADDED table=0 cookie=0 in_port=0,dl_vlan_pcp=0 actions=output:21
3722 NXST_FLOW_MONITOR reply (xid=0x0):
3723  event=ADDED table=0 cookie=0 in_port=0,dl_vlan_pcp=1 actions=output:22
3724 NXST_FLOW_MONITOR reply (xid=0x0):
3725  event=ADDED table=0 cookie=0 in_port=0 actions=output:23
3726 NXST_FLOW_MONITOR reply (xid=0x0):
3727  event=MODIFIED table=0 cookie=0 in_port=0,dl_vlan=123 actions=output:3
3728  event=MODIFIED table=0 cookie=0 in_port=0,dl_vlan=123,dl_vlan_pcp=0 actions=output:3
3729  event=MODIFIED table=0 cookie=0 in_port=0,dl_vlan=123,dl_vlan_pcp=1 actions=output:3
3730 NXST_FLOW_MONITOR reply (xid=0x0):
3731  event=MODIFIED table=0 cookie=0x5 in_port=0,dl_vlan=123 actions=output:3
3732  event=MODIFIED table=0 cookie=0x5 in_port=0,dl_vlan=123,dl_vlan_pcp=0 actions=output:3
3733  event=MODIFIED table=0 cookie=0x5 in_port=0,dl_vlan=123,dl_vlan_pcp=1 actions=output:3
3734 NXST_FLOW_MONITOR reply (xid=0x0):
3735  event=DELETED reason=delete table=0 cookie=0x5 in_port=0,dl_vlan=123 actions=output:3
3736  event=DELETED reason=delete table=0 cookie=0x5 in_port=0,dl_vlan=123,dl_vlan_pcp=0 actions=output:3
3737  event=DELETED reason=delete table=0 cookie=0x5 in_port=0,dl_vlan=123,dl_vlan_pcp=1 actions=output:3
3738 NXST_FLOW_MONITOR reply (xid=0x0):
3739  event=DELETED reason=delete table=0 cookie=0 in_port=0 actions=output:23
3740  event=DELETED reason=delete table=0 cookie=0 in_port=0,dl_vlan=0 actions=output:20
3741  event=DELETED reason=delete table=0 cookie=0 in_port=0,dl_vlan=0,dl_vlan_pcp=0 actions=output:18
3742  event=DELETED reason=delete table=0 cookie=0 in_port=0,dl_vlan=0,dl_vlan_pcp=1 actions=output:19
3743  event=DELETED reason=delete table=0 cookie=0 in_port=0,dl_vlan=124 actions=output:2
3744  event=DELETED reason=delete table=0 cookie=0 in_port=0,dl_vlan=4095 actions=output:14
3745  event=DELETED reason=delete table=0 cookie=0 in_port=0,dl_vlan=4095,dl_vlan_pcp=0 actions=output:12
3746  event=DELETED reason=delete table=0 cookie=0 in_port=0,dl_vlan=4095,dl_vlan_pcp=1 actions=output:13
3747  event=DELETED reason=delete table=0 cookie=0 in_port=0,dl_vlan_pcp=0 actions=output:21
3748  event=DELETED reason=delete table=0 cookie=0 in_port=0,dl_vlan_pcp=1 actions=output:22
3749  event=DELETED reason=delete table=0 cookie=0 in_port=0,vlan_tci=0x0000 actions=output:11
3750 OFPT_BARRIER_REPLY:
3751 ])
3752
3753 # Check that our own changes are reported as full updates.
3754 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
3755 ovs-ofctl add-flow br0 in_port=1,actions=output:2
3756 ovs-ofctl add-flow br0 in_port=2,actions=output:1
3757 ovs-appctl -t ovs-ofctl ofctl/barrier
3758 ovs-appctl -t ovs-ofctl ofctl/send 010e004812345678003fffff00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003000000000000ffffffffffff0000
3759 ovs-appctl -t ovs-ofctl ofctl/barrier
3760 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip], [0], [NXST_FLOW reply:
3761 ])
3762 AT_CHECK([sed 's/ (xid=0x[[1-9a-fA-F]][[0-9a-fA-F]]*)//' monitor.log | multiline_sort], [0],
3763 [NXST_FLOW_MONITOR reply (xid=0x0):
3764  event=ADDED table=0 cookie=0 in_port=1 actions=output:2
3765 NXST_FLOW_MONITOR reply (xid=0x0):
3766  event=ADDED table=0 cookie=0 in_port=2 actions=output:1
3767 OFPT_BARRIER_REPLY:
3768 send: OFPT_FLOW_MOD: DEL priority=0 actions=drop
3769 NXST_FLOW_MONITOR reply (xid=0x0):
3770  event=DELETED reason=delete table=0 cookie=0 in_port=1 actions=output:2
3771  event=DELETED reason=delete table=0 cookie=0 in_port=2 actions=output:1
3772 OFPT_BARRIER_REPLY:
3773 ])
3774
3775 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
3776 OVS_VSWITCHD_STOP
3777 AT_CLEANUP
3778
3779 AT_SETUP([ofproto - flow monitoring with !own])
3780 AT_KEYWORDS([monitor])
3781 OVS_VSWITCHD_START
3782
3783 ovs-ofctl add-flow br0 in_port=0,dl_vlan=123,actions=output:1
3784
3785 # Start a monitor watching the flow table and check the initial reply.
3786 ovs-ofctl monitor br0 watch:\!own --detach --no-chdir --pidfile >monitor.log 2>&1
3787 AT_CAPTURE_FILE([monitor.log])
3788 ovs-appctl -t ovs-ofctl ofctl/barrier
3789 AT_CHECK([sed 's/ (xid=0x[[1-9a-fA-F]][[0-9a-fA-F]]*)//' monitor.log], [0],
3790   [NXST_FLOW_MONITOR reply:
3791  event=ADDED table=0 cookie=0 in_port=0,dl_vlan=123 actions=output:1
3792 OFPT_BARRIER_REPLY:
3793 ])
3794
3795 # Check that our own changes are reported as abbreviations.
3796 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
3797 ovs-ofctl add-flow br0 in_port=1,actions=output:2
3798 ovs-ofctl add-flow br0 in_port=2,actions=output:1
3799 ovs-appctl -t ovs-ofctl ofctl/barrier
3800 ovs-appctl -t ovs-ofctl ofctl/send 010e004812345678003fffff00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003000000000000ffffffffffff0000
3801 ovs-appctl -t ovs-ofctl ofctl/barrier
3802 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip], [0], [NXST_FLOW reply:
3803 ])
3804 AT_CHECK([sed 's/ (xid=0x[[1-9a-fA-F]][[0-9a-fA-F]]*)//' monitor.log], [0],
3805 [NXST_FLOW_MONITOR reply (xid=0x0):
3806  event=ADDED table=0 cookie=0 in_port=1 actions=output:2
3807 NXST_FLOW_MONITOR reply (xid=0x0):
3808  event=ADDED table=0 cookie=0 in_port=2 actions=output:1
3809 OFPT_BARRIER_REPLY:
3810 send: OFPT_FLOW_MOD: DEL priority=0 actions=drop
3811 NXST_FLOW_MONITOR reply (xid=0x0):
3812  event=ABBREV xid=0x12345678
3813 OFPT_BARRIER_REPLY:
3814 ])
3815
3816 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
3817 OVS_VSWITCHD_STOP
3818 AT_CLEANUP
3819
3820 AT_SETUP([ofproto - flow monitoring with out_port])
3821 AT_KEYWORDS([monitor])
3822 OVS_VSWITCHD_START
3823
3824 ovs-ofctl add-flow br0 in_port=0,dl_vlan=121,actions=output:1
3825 ovs-ofctl add-flow br0 in_port=0,dl_vlan=122,actions=output:1
3826 ovs-ofctl add-flow br0 in_port=0,dl_vlan=123,actions=output:2
3827
3828 # Start a monitor watching the flow table and check the initial reply.
3829 ovs-ofctl monitor br0 watch:out_port=2 --detach --no-chdir --pidfile >monitor.log 2>&1
3830 AT_CAPTURE_FILE([monitor.log])
3831 ovs-appctl -t ovs-ofctl ofctl/barrier
3832 AT_CHECK([sed 's/ (xid=0x[[1-9a-fA-F]][[0-9a-fA-F]]*)//' monitor.log], [0],
3833   [NXST_FLOW_MONITOR reply:
3834  event=ADDED table=0 cookie=0 in_port=0,dl_vlan=123 actions=output:2
3835 OFPT_BARRIER_REPLY:
3836 ])
3837
3838 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
3839
3840 # Add, modify flows and check the updates.
3841 ovs-ofctl mod-flows br0 dl_vlan=121,actions=drop
3842 ovs-ofctl mod-flows br0 dl_vlan=122,actions=output:1,output:2
3843 ovs-appctl -t ovs-ofctl ofctl/barrier
3844
3845 ovs-ofctl mod-flows br0 dl_vlan=123,actions=output:1,output:2
3846 ovs-appctl -t ovs-ofctl ofctl/barrier
3847
3848 ovs-ofctl mod-flows br0 dl_vlan=122,actions=output:1
3849 ovs-appctl -t ovs-ofctl ofctl/barrier
3850 ovs-ofctl mod-flows br0 dl_vlan=123,actions=output:2
3851 ovs-appctl -t ovs-ofctl ofctl/barrier
3852
3853 AT_CHECK([sed 's/ (xid=0x[[1-9a-fA-F]][[0-9a-fA-F]]*)//' monitor.log], [0],
3854 [NXST_FLOW_MONITOR reply (xid=0x0):
3855  event=MODIFIED table=0 cookie=0 in_port=0,dl_vlan=122 actions=output:1,output:2
3856 OFPT_BARRIER_REPLY:
3857 NXST_FLOW_MONITOR reply (xid=0x0):
3858  event=MODIFIED table=0 cookie=0 in_port=0,dl_vlan=123 actions=output:1,output:2
3859 OFPT_BARRIER_REPLY:
3860 NXST_FLOW_MONITOR reply (xid=0x0):
3861  event=MODIFIED table=0 cookie=0 in_port=0,dl_vlan=122 actions=output:1
3862 OFPT_BARRIER_REPLY:
3863 NXST_FLOW_MONITOR reply (xid=0x0):
3864  event=MODIFIED table=0 cookie=0 in_port=0,dl_vlan=123 actions=output:2
3865 OFPT_BARRIER_REPLY:
3866 ])
3867
3868 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
3869 OVS_VSWITCHD_STOP
3870 AT_CLEANUP
3871
3872 AT_SETUP([ofproto - flow monitoring pause and resume])
3873 AT_KEYWORDS([monitor])
3874
3875 # The maximum socket receive buffer size is important for this test, which
3876 # tests behavior when the receive buffer overflows.
3877 if test -e /proc/sys/net/core/rmem_max; then
3878     # Linux
3879     rmem_max=`cat /proc/sys/net/core/rmem_max`
3880 elif rmem_max=`sysctl -n net.inet.tcp.recvbuf_max 2>/dev/null`; then
3881     : # FreeBSD, NetBSD
3882 else
3883     # Don't know how to get maximum socket receive buffer on this OS
3884     AT_SKIP_IF([:])
3885 fi
3886 # Calculate the total amount of queuing: rmem_max in the kernel, 128 kB
3887 # in ofproto sending userspace (see ofmonitor_flush() in connmgr.c).
3888 queue_size=`expr $rmem_max + 128 \* 1024`
3889 echo rmem_max=$rmem_max queue_size=$queue_size
3890
3891 # If there's too much queuing skip the test to avoid timing out.
3892 AT_SKIP_IF([test $rmem_max -gt 1048576])
3893
3894 # Each flow update message takes up at least 48 bytes of space in queues
3895 # and in practice more than that.
3896 n_msgs=`expr $queue_size / 48`
3897 echo n_msgs=$n_msgs
3898
3899 OVS_VSWITCHD_START
3900
3901 # Start a monitor watching the flow table, then make it block.
3902 on_exit 'kill `cat ovs-ofctl.pid`'
3903 ovs-ofctl monitor br0 watch: --detach --no-chdir --pidfile >monitor.log 2>&1
3904 AT_CAPTURE_FILE([monitor.log])
3905 ovs-appctl -t ovs-ofctl ofctl/block
3906
3907 # Add $n_msgs flows.
3908 (echo "in_port=2,actions=output:2"
3909 ${PERL} -e '
3910     for ($i = 0; $i < '$n_msgs'; $i++) {
3911         print "cookie=1,reg1=$i,actions=drop\n";
3912     }
3913 ') > flows.txt
3914 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
3915 # Check that multipart flow dumps work properly:
3916 AT_CHECK([ovs-ofctl diff-flows br0 flows.txt])
3917 AT_CHECK([ovs-ofctl add-flow br0 in_port=1,cookie=3,actions=drop])
3918 AT_CHECK([ovs-ofctl mod-flows br0 in_port=2,cookie=2,actions=output:2])
3919 AT_CHECK([ovs-ofctl del-flows br0 cookie=1/-1])
3920
3921 ovs-appctl -t ovs-ofctl ofctl/unblock
3922
3923 # Wait for the connection resumed.
3924 # A barrier doesn't work for this purpose.
3925 #    https://www.mail-archive.com/dev@openvswitch.org/msg27013.html
3926 #    https://www.mail-archive.com/dev@openvswitch.org/msg27675.html
3927 OVS_WAIT_UNTIL([grep NXT_FLOW_MONITOR_RESUMED monitor.log])
3928
3929 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
3930
3931 # Check that the flow monitor reported the same number of flows
3932 # added and deleted, but fewer than we actually added and deleted.
3933 adds=`grep -c 'ADDED.*reg1=' monitor.log`
3934 deletes=`grep -c 'DELETED.*reg1=' monitor.log`
3935 echo adds=$adds deletes=$deletes
3936 AT_CHECK([test $adds -gt 100 && test $adds -lt $n_msgs])
3937 AT_CHECK([test $adds = $deletes])
3938
3939 # Check that the flow monitor reported everything in the expected order:
3940 #
3941 #     event=ADDED table=0 cookie=0x1 reg1=0x22
3942 # ...
3943 #    NXT_FLOW_MONITOR_PAUSED:
3944 # ...
3945 #     event=DELETED reason=delete table=0 cookie=0x1 reg1=0x22
3946 # ...
3947 #     event=ADDED table=0 cookie=0x3 in_port=1
3948 #     event=MODIFIED table=0 cookie=0x2 in_port=2 actions=output:2
3949 #    NXT_FLOW_MONITOR_RESUMED:
3950 #
3951 # except that, between the PAUSED and RESUMED, the order of the ADDED
3952 # and MODIFIED lines lines depends on hash order, that is, it varies
3953 # as we change the hash function or change architecture.  Therefore,
3954 # we use a couple of tests below to accept both orders.
3955 AT_CHECK([ofctl_strip < monitor.log | sed -n -e '
3956 /reg1=0x22$/p
3957 /cookie=0x[[23]]/p
3958 /NXT_FLOW_MONITOR_PAUSED:/p
3959 /NXT_FLOW_MONITOR_RESUMED:/p
3960 ' > monitor.log.subset])
3961 AT_CHECK([grep -v MODIFIED monitor.log.subset], [0], [dnl
3962  event=ADDED table=0 cookie=0x1 reg1=0x22
3963 NXT_FLOW_MONITOR_PAUSED:
3964  event=DELETED reason=delete table=0 cookie=0x1 reg1=0x22
3965  event=ADDED table=0 cookie=0x3 in_port=1
3966 NXT_FLOW_MONITOR_RESUMED:
3967 ])
3968 AT_CHECK([grep -v ADDED monitor.log.subset], [0], [dnl
3969 NXT_FLOW_MONITOR_PAUSED:
3970  event=DELETED reason=delete table=0 cookie=0x1 reg1=0x22
3971  event=MODIFIED table=0 cookie=0x2 in_port=2 actions=output:2
3972 NXT_FLOW_MONITOR_RESUMED:
3973 ])
3974
3975 OVS_VSWITCHD_STOP
3976 AT_CLEANUP
3977
3978 AT_SETUP([ofproto - event filtering (OpenFlow 1.3)])
3979 AT_KEYWORDS([monitor])
3980 OVS_VSWITCHD_START
3981
3982 # Start a monitor, use the required protocol version
3983 ovs-ofctl -O OpenFlow13 monitor br0 --detach --no-chdir --pidfile >monitor.log 2>&1
3984 AT_CAPTURE_FILE([monitor.log])
3985
3986 # Send an OpenFlow13 message (04), OFPT_GET_ASYNC_REQUEST (1a), length (8), xid (0a)
3987 ovs-appctl -t ovs-ofctl ofctl/send 041a00080000000a
3988 ovs-appctl -t ovs-ofctl ofctl/barrier
3989
3990 # Check default setting
3991 read -r -d '' expected <<'EOF'
3992 EOF
3993
3994 AT_CHECK([ofctl_strip < monitor.log], [], [dnl
3995 send: OFPT_GET_ASYNC_REQUEST (OF1.3):
3996 OFPT_GET_ASYNC_REPLY (OF1.3):
3997  master:
3998        PACKET_IN: no_match action
3999      PORT_STATUS: add delete modify
4000     FLOW_REMOVED: idle hard delete
4001      ROLE_STATUS: (off)
4002     TABLE_STATUS: (off)
4003   REQUESTFORWARD: (off)
4004
4005  slave:
4006        PACKET_IN: (off)
4007      PORT_STATUS: add delete modify
4008     FLOW_REMOVED: (off)
4009      ROLE_STATUS: (off)
4010     TABLE_STATUS: (off)
4011   REQUESTFORWARD: (off)
4012 OFPT_BARRIER_REPLY (OF1.3):
4013 ])
4014
4015 OVS_VSWITCHD_STOP
4016 AT_CLEANUP
4017
4018 AT_SETUP([ofproto - ofport_request])
4019 OVS_VSWITCHD_START
4020 add_of_ports br0 1 2 3
4021
4022 set_and_check_specific_ofports () {
4023     ovs-vsctl set Interface p1 ofport_request="$1" -- \
4024               set Interface p2 ofport_request="$2" -- \
4025               set Interface p3 ofport_request="$3"
4026     ofports=`ovs-vsctl get Interface p1 ofport -- \
4027                        get Interface p2 ofport -- \
4028                        get Interface p3 ofport`
4029     AT_CHECK_UNQUOTED([echo $ofports], [0], [$1 $2 $3
4030 ])
4031 }
4032 for pre in      '1 2 3' '1 3 2' '2 1 3' '2 3 1' '3 1 2' '3 2 1'; do
4033     for post in '1 2 3' '1 3 2' '2 1 3' '2 3 1' '3 1 2' '3 2 1'; do
4034         echo -----------------------------------------------------------
4035         echo "Check changing port numbers from $pre to $post"
4036         set_and_check_specific_ofports $pre
4037         set_and_check_specific_ofports $post
4038     done
4039 done
4040
4041 ovs-vsctl del-port p3
4042
4043 set_and_check_poorly_specified_ofports () {
4044     ovs-vsctl set Interface p1 ofport_request="$1" -- \
4045               set Interface p2 ofport_request="$2"
4046     p1=`ovs-vsctl get Interface p1 ofport`
4047     p2=`ovs-vsctl get Interface p2 ofport`
4048     echo $p1 $p2
4049
4050     AT_CHECK([test "$p1" != "$p2"])
4051     if test "$1" = "$2" && test "$1" != '[[]]'; then
4052         # One port number must be the requested one.
4053         AT_CHECK([test "$p1" = "$1" || test "$p2" = "$1"])
4054         # The other port number must be different (already tested above).
4055     else
4056         AT_CHECK([test "$1" = '[[]]' || test "$p1" = "$1"])
4057         AT_CHECK([test "$2" = '[[]]' || test "$p2" = "$2"])
4058     fi
4059 }
4060 for pre in      '1 2' '[[]] 2' '1 [[]]' '[[]] [[]]' '2 1' '[[]] 1' '2 [[]]' \
4061                 '1 1' '2 2'; do
4062     for post in '1 2' '[[]] 2' '1 [[]]' '[[]] [[]]' '2 1' '[[]] 1' '2 [[]]' \
4063                 '1 1' '2 2'; do
4064         echo -----------------------------------------------------------
4065         echo "Check changing port numbers from $pre to $post"
4066         set_and_check_poorly_specified_ofports $pre
4067         set_and_check_poorly_specified_ofports $post
4068     done
4069 done
4070 OVS_VSWITCHD_STOP
4071 AT_CLEANUP
4072
4073
4074 AT_SETUP([ofproto - bundle open (OpenFlow 1.4)])
4075 AT_KEYWORDS([monitor])
4076 OVS_VSWITCHD_START
4077
4078 # Start a monitor, use the required protocol version
4079 ovs-ofctl -O OpenFlow14 monitor br0 --detach --no-chdir --pidfile >monitor.log 2>&1
4080 AT_CAPTURE_FILE([monitor.log])
4081
4082 # Send an OpenFlow14 message (05), OFPT_BUNDLE_CONTROL (21), length (10), xid (0a)
4083 ovs-appctl -t ovs-ofctl ofctl/send "05 21 00 10 00 00 00 0a 00 00 00 01 00 00 00 02"
4084 ovs-appctl -t ovs-ofctl ofctl/barrier
4085 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
4086
4087 AT_CHECK([ofctl_strip < monitor.log], [], [dnl
4088 send: OFPT_BUNDLE_CONTROL (OF1.4):
4089  bundle_id=0x1 type=OPEN_REQUEST flags=ordered
4090 OFPT_BUNDLE_CONTROL (OF1.4):
4091  bundle_id=0x1 type=OPEN_REPLY flags=0
4092 OFPT_BARRIER_REPLY (OF1.4):
4093 ])
4094
4095 OVS_VSWITCHD_STOP
4096 AT_CLEANUP
4097
4098 AT_SETUP([ofproto - bundle double open (OpenFlow 1.4)])
4099 AT_KEYWORDS([monitor])
4100 OVS_VSWITCHD_START
4101
4102 # Start a monitor, use the required protocol version
4103 ovs-ofctl -O OpenFlow14 monitor br0 --detach --no-chdir --pidfile >monitor.log 2>&1
4104 AT_CAPTURE_FILE([monitor.log])
4105
4106 # Send twice an OpenFlow14 message (05), OFPT_BUNDLE_CONTROL (21), length (10), xid (0a)
4107 ovs-appctl -t ovs-ofctl ofctl/send "05 21 00 10 00 00 00 0a 00 00 00 01 00 00 00 02"
4108 ovs-appctl -t ovs-ofctl ofctl/barrier
4109 ovs-appctl -t ovs-ofctl ofctl/send "05 21 00 10 00 00 00 0a 00 00 00 01 00 00 00 02"
4110 ovs-appctl -t ovs-ofctl ofctl/barrier
4111 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
4112
4113 AT_CHECK([ofctl_strip < monitor.log], [0], [dnl
4114 send: OFPT_BUNDLE_CONTROL (OF1.4):
4115  bundle_id=0x1 type=OPEN_REQUEST flags=ordered
4116 OFPT_BUNDLE_CONTROL (OF1.4):
4117  bundle_id=0x1 type=OPEN_REPLY flags=0
4118 OFPT_BARRIER_REPLY (OF1.4):
4119 send: OFPT_BUNDLE_CONTROL (OF1.4):
4120  bundle_id=0x1 type=OPEN_REQUEST flags=ordered
4121 OFPT_ERROR (OF1.4): OFPBFC_BAD_ID
4122 OFPT_BUNDLE_CONTROL (OF1.4):
4123  bundle_id=0x1 type=OPEN_REQUEST flags=ordered
4124 OFPT_BARRIER_REPLY (OF1.4):
4125 ])
4126
4127 OVS_VSWITCHD_STOP
4128 AT_CLEANUP
4129
4130 AT_SETUP([ofproto - bundle close without open (OpenFlow 1.4)])
4131 AT_KEYWORDS([monitor])
4132 OVS_VSWITCHD_START
4133
4134 # Start a monitor, use the required protocol version
4135 ovs-ofctl -O OpenFlow14 monitor br0 --detach --no-chdir --pidfile >monitor.log 2>&1
4136 AT_CAPTURE_FILE([monitor.log])
4137
4138 ovs-appctl -t ovs-ofctl ofctl/send "05 21 00 10 00 00 00 0a 00 00 00 01 00 02 00 02"
4139 ovs-appctl -t ovs-ofctl ofctl/barrier
4140 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
4141
4142 AT_CHECK([ofctl_strip < monitor.log], [0], [dnl
4143 send: OFPT_BUNDLE_CONTROL (OF1.4):
4144  bundle_id=0x1 type=CLOSE_REQUEST flags=ordered
4145 OFPT_ERROR (OF1.4): OFPBFC_BAD_ID
4146 OFPT_BUNDLE_CONTROL (OF1.4):
4147  bundle_id=0x1 type=CLOSE_REQUEST flags=ordered
4148 OFPT_BARRIER_REPLY (OF1.4):
4149 ])
4150
4151 OVS_VSWITCHD_STOP
4152 AT_CLEANUP
4153
4154 AT_SETUP([ofproto - bundle double close (OpenFlow 1.4)])
4155 AT_KEYWORDS([monitor])
4156 OVS_VSWITCHD_START
4157
4158 # Start a monitor, use the required protocol version
4159 ovs-ofctl -O OpenFlow14 monitor br0 --detach --no-chdir --pidfile >monitor.log 2>&1
4160 AT_CAPTURE_FILE([monitor.log])
4161
4162 # Open, Close, Close
4163 ovs-appctl -t ovs-ofctl ofctl/send "05 21 00 10 00 00 00 0a 00 00 00 01 00 00 00 02"
4164 ovs-appctl -t ovs-ofctl ofctl/barrier
4165 ovs-appctl -t ovs-ofctl ofctl/send "05 21 00 10 00 00 00 0a 00 00 00 01 00 02 00 02"
4166 ovs-appctl -t ovs-ofctl ofctl/barrier
4167 ovs-appctl -t ovs-ofctl ofctl/send "05 21 00 10 00 00 00 0a 00 00 00 01 00 02 00 02"
4168 ovs-appctl -t ovs-ofctl ofctl/barrier
4169 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
4170
4171 AT_CHECK([ofctl_strip < monitor.log], [0], [dnl
4172 send: OFPT_BUNDLE_CONTROL (OF1.4):
4173  bundle_id=0x1 type=OPEN_REQUEST flags=ordered
4174 OFPT_BUNDLE_CONTROL (OF1.4):
4175  bundle_id=0x1 type=OPEN_REPLY flags=0
4176 OFPT_BARRIER_REPLY (OF1.4):
4177 send: OFPT_BUNDLE_CONTROL (OF1.4):
4178  bundle_id=0x1 type=CLOSE_REQUEST flags=ordered
4179 OFPT_BUNDLE_CONTROL (OF1.4):
4180  bundle_id=0x1 type=CLOSE_REPLY flags=0
4181 OFPT_BARRIER_REPLY (OF1.4):
4182 send: OFPT_BUNDLE_CONTROL (OF1.4):
4183  bundle_id=0x1 type=CLOSE_REQUEST flags=ordered
4184 OFPT_ERROR (OF1.4): OFPBFC_BUNDLE_CLOSED
4185 OFPT_BUNDLE_CONTROL (OF1.4):
4186  bundle_id=0x1 type=CLOSE_REQUEST flags=ordered
4187 OFPT_BARRIER_REPLY (OF1.4):
4188 ])
4189
4190 OVS_VSWITCHD_STOP
4191 AT_CLEANUP
4192
4193 AT_SETUP([ofproto - bundle close, different flags (OpenFlow 1.4)])
4194 AT_KEYWORDS([monitor])
4195 OVS_VSWITCHD_START
4196
4197 # Start a monitor, use the required protocol version
4198 ovs-ofctl -O OpenFlow14 monitor br0 --detach --no-chdir --pidfile >monitor.log 2>&1
4199 AT_CAPTURE_FILE([monitor.log])
4200
4201 # Open, Close, Close
4202 ovs-appctl -t ovs-ofctl ofctl/send "05 21 00 10 00 00 00 0a 00 00 00 01 00 00 00 02"
4203 ovs-appctl -t ovs-ofctl ofctl/barrier
4204 ovs-appctl -t ovs-ofctl ofctl/send "05 21 00 10 00 00 00 0a 00 00 00 01 00 02 00 01"
4205 ovs-appctl -t ovs-ofctl ofctl/barrier
4206 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
4207
4208 AT_CHECK([ofctl_strip < monitor.log], [0], [dnl
4209 send: OFPT_BUNDLE_CONTROL (OF1.4):
4210  bundle_id=0x1 type=OPEN_REQUEST flags=ordered
4211 OFPT_BUNDLE_CONTROL (OF1.4):
4212  bundle_id=0x1 type=OPEN_REPLY flags=0
4213 OFPT_BARRIER_REPLY (OF1.4):
4214 send: OFPT_BUNDLE_CONTROL (OF1.4):
4215  bundle_id=0x1 type=CLOSE_REQUEST flags=atomic
4216 OFPT_ERROR (OF1.4): OFPBFC_BAD_FLAGS
4217 OFPT_BUNDLE_CONTROL (OF1.4):
4218  bundle_id=0x1 type=CLOSE_REQUEST flags=atomic
4219 OFPT_BARRIER_REPLY (OF1.4):
4220 ])
4221
4222 OVS_VSWITCHD_STOP
4223 AT_CLEANUP
4224
4225 AT_SETUP([ofproto - bundle commit without open (OpenFlow 1.4)])
4226 AT_KEYWORDS([monitor])
4227 OVS_VSWITCHD_START
4228
4229 # Start a monitor, use the required protocol version
4230 ovs-ofctl -O OpenFlow14 monitor br0 --detach --no-chdir --pidfile >monitor.log 2>&1
4231 AT_CAPTURE_FILE([monitor.log])
4232
4233 # Open, Close, Close
4234 ovs-appctl -t ovs-ofctl ofctl/send "05 21 00 10 00 00 00 0a 00 00 00 01 00 04 00 02"
4235 ovs-appctl -t ovs-ofctl ofctl/barrier
4236 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
4237
4238 AT_CHECK([ofctl_strip < monitor.log], [0], [dnl
4239 send: OFPT_BUNDLE_CONTROL (OF1.4):
4240  bundle_id=0x1 type=COMMIT_REQUEST flags=ordered
4241 OFPT_ERROR (OF1.4): OFPBFC_BAD_ID
4242 OFPT_BUNDLE_CONTROL (OF1.4):
4243  bundle_id=0x1 type=COMMIT_REQUEST flags=ordered
4244 OFPT_BARRIER_REPLY (OF1.4):
4245 ])
4246
4247 OVS_VSWITCHD_STOP
4248 AT_CLEANUP
4249
4250 AT_SETUP([ofproto - bundle commit, different flags (OpenFlow 1.4)])
4251 AT_KEYWORDS([monitor])
4252 OVS_VSWITCHD_START
4253
4254 # Start a monitor, use the required protocol version
4255 ovs-ofctl -O OpenFlow14 monitor br0 --detach --no-chdir --pidfile >monitor.log 2>&1
4256 AT_CAPTURE_FILE([monitor.log])
4257
4258 # Open, Close, Close
4259 ovs-appctl -t ovs-ofctl ofctl/send "05 21 00 10 00 00 00 0a 00 00 00 01 00 00 00 02"
4260 ovs-appctl -t ovs-ofctl ofctl/barrier
4261 ovs-appctl -t ovs-ofctl ofctl/send "05 21 00 10 00 00 00 0a 00 00 00 01 00 04 00 01"
4262 ovs-appctl -t ovs-ofctl ofctl/barrier
4263 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
4264
4265 AT_CHECK([ofctl_strip < monitor.log], [0], [dnl
4266 send: OFPT_BUNDLE_CONTROL (OF1.4):
4267  bundle_id=0x1 type=OPEN_REQUEST flags=ordered
4268 OFPT_BUNDLE_CONTROL (OF1.4):
4269  bundle_id=0x1 type=OPEN_REPLY flags=0
4270 OFPT_BARRIER_REPLY (OF1.4):
4271 send: OFPT_BUNDLE_CONTROL (OF1.4):
4272  bundle_id=0x1 type=COMMIT_REQUEST flags=atomic
4273 OFPT_ERROR (OF1.4): OFPBFC_BAD_FLAGS
4274 OFPT_BUNDLE_CONTROL (OF1.4):
4275  bundle_id=0x1 type=COMMIT_REQUEST flags=atomic
4276 OFPT_BARRIER_REPLY (OF1.4):
4277 ])
4278
4279 OVS_VSWITCHD_STOP
4280 AT_CLEANUP
4281
4282 AT_SETUP([ofproto - bundle discard without open (OpenFlow 1.4)])
4283 AT_KEYWORDS([monitor])
4284 OVS_VSWITCHD_START
4285
4286 # Start a monitor, use the required protocol version
4287 ovs-ofctl -O OpenFlow14 monitor br0 --detach --no-chdir --pidfile >monitor.log 2>&1
4288 AT_CAPTURE_FILE([monitor.log])
4289
4290 # Open, Close, Close
4291 ovs-appctl -t ovs-ofctl ofctl/send "05 21 00 10 00 00 00 0a 00 00 00 01 00 06 00 02"
4292 ovs-appctl -t ovs-ofctl ofctl/barrier
4293 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
4294
4295 AT_CHECK([ofctl_strip < monitor.log], [0], [dnl
4296 send: OFPT_BUNDLE_CONTROL (OF1.4):
4297  bundle_id=0x1 type=DISCARD_REQUEST flags=ordered
4298 OFPT_ERROR (OF1.4): OFPBFC_BAD_ID
4299 OFPT_BUNDLE_CONTROL (OF1.4):
4300  bundle_id=0x1 type=DISCARD_REQUEST flags=ordered
4301 OFPT_BARRIER_REPLY (OF1.4):
4302 ])
4303
4304 OVS_VSWITCHD_STOP
4305 AT_CLEANUP
4306
4307
4308 AT_SETUP([ofproto - bundle with multiple flow mods (OpenFlow 1.4)])
4309 AT_KEYWORDS([monitor])
4310 OVS_VSWITCHD_START
4311
4312 AT_CHECK([ovs-appctl vlog/set vconn:dbg])
4313
4314 AT_CHECK([ovs-ofctl del-flows br0])
4315
4316 AT_DATA([flows.txt], [dnl
4317 add idle_timeout=50 in_port=2 dl_src=00:66:77:88:99:aa actions=1
4318 add idle_timeout=60 in_port=2 dl_src=00:77:88:99:aa:bb actions=2
4319 add idle_timeout=70 in_port=2 dl_src=00:88:99:aa:bb:cc actions=3
4320 add idle_timeout=50 in_port=2 dl_src=00:66:77:88:99:aa actions=4
4321 delete
4322 add idle_timeout=50 in_port=2 dl_src=00:66:77:88:99:aa actions=5
4323 add idle_timeout=60 in_port=2 dl_src=00:77:88:99:aa:bb actions=6
4324 add idle_timeout=70 in_port=2 dl_src=00:88:99:aa:bb:cc actions=7
4325 delete in_port=2 dl_src=00:88:99:aa:bb:cc
4326 ])
4327
4328 AT_CHECK([ovs-ofctl --bundle add-flows br0 flows.txt])
4329
4330 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
4331  idle_timeout=50, in_port=2,dl_src=00:66:77:88:99:aa actions=output:5
4332  idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=output:6
4333 NXST_FLOW reply:
4334 ])
4335
4336 AT_DATA([flows.txt], [dnl
4337 modify actions=drop
4338 modify_strict in_port=2 dl_src=00:77:88:99:aa:bb actions=7
4339 ])
4340
4341 AT_CHECK([ovs-ofctl --bundle add-flows br0 flows.txt])
4342
4343 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
4344  idle_timeout=50, in_port=2,dl_src=00:66:77:88:99:aa actions=drop
4345  idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=output:7
4346 NXST_FLOW reply:
4347 ])
4348
4349 # Adding an existing flow acts as a modify, and delete_strict also works.
4350 AT_DATA([flows.txt], [dnl
4351 add idle_timeout=60 in_port=2 dl_src=00:77:88:99:aa:bb actions=8
4352 delete_strict in_port=2 dl_src=00:66:77:88:99:aa
4353 add in_port=2 dl_src=00:66:77:88:99:aa actions=drop
4354 ])
4355
4356 AT_CHECK([ovs-ofctl --bundle add-flows br0 flows.txt])
4357
4358 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
4359  idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=output:8
4360  in_port=2,dl_src=00:66:77:88:99:aa actions=drop
4361 NXST_FLOW reply:
4362 ])
4363
4364 dnl Check logs for OpenFlow trace
4365 # Prevent race.
4366 OVS_WAIT_UNTIL([vconn_sub < ovs-vswitchd.log | test `grep -- "|vconn|DBG|unix: sent (Success): NXST_FLOW reply" | wc -l` -ge 3])
4367 AT_CHECK([print_vconn_debug | vconn_sub | ofctl_strip], [0], [dnl
4368 vconn|DBG|unix: sent (Success): OFPT_HELLO (OF1.6):
4369  version bitmap: 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07
4370 vconn|DBG|unix: received: OFPT_HELLO:
4371  version bitmap: 0x01
4372 vconn|DBG|unix: negotiated OpenFlow version 0x01 (we support version 0x07 and earlier, peer supports version 0x01)
4373 vconn|DBG|unix: received: OFPT_FLOW_MOD: DEL actions=drop
4374 vconn|DBG|unix: received: OFPT_BARRIER_REQUEST:
4375 vconn|DBG|unix: sent (Success): OFPT_BARRIER_REPLY:
4376 vconn|DBG|unix: sent (Success): OFPT_HELLO (OF1.6):
4377  version bitmap: 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07
4378 vconn|DBG|unix: received: OFPT_HELLO (OF1.4):
4379  version bitmap: 0x05
4380 vconn|DBG|unix: negotiated OpenFlow version 0x05 (we support version 0x07 and earlier, peer supports version 0x05)
4381 vconn|DBG|unix: received: OFPT_BUNDLE_CONTROL (OF1.4):
4382  bundle_id=0 type=OPEN_REQUEST flags=atomic ordered
4383 vconn|DBG|unix: sent (Success): OFPT_BUNDLE_CONTROL (OF1.4):
4384  bundle_id=0 type=OPEN_REPLY flags=0
4385 vconn|DBG|unix: received: OFPT_BUNDLE_ADD_MESSAGE (OF1.4):
4386  bundle_id=0 flags=atomic ordered
4387 OFPT_FLOW_MOD (OF1.4): ADD in_port=2,dl_src=00:66:77:88:99:aa idle:50 actions=output:1
4388 vconn|DBG|unix: received: OFPT_BUNDLE_ADD_MESSAGE (OF1.4):
4389  bundle_id=0 flags=atomic ordered
4390 OFPT_FLOW_MOD (OF1.4): ADD in_port=2,dl_src=00:77:88:99:aa:bb idle:60 actions=output:2
4391 vconn|DBG|unix: received: OFPT_BUNDLE_ADD_MESSAGE (OF1.4):
4392  bundle_id=0 flags=atomic ordered
4393 OFPT_FLOW_MOD (OF1.4): ADD in_port=2,dl_src=00:88:99:aa:bb:cc idle:70 actions=output:3
4394 vconn|DBG|unix: received: OFPT_BUNDLE_ADD_MESSAGE (OF1.4):
4395  bundle_id=0 flags=atomic ordered
4396 OFPT_FLOW_MOD (OF1.4): ADD in_port=2,dl_src=00:66:77:88:99:aa idle:50 actions=output:4
4397 vconn|DBG|unix: received: OFPT_BUNDLE_ADD_MESSAGE (OF1.4):
4398  bundle_id=0 flags=atomic ordered
4399 OFPT_FLOW_MOD (OF1.4): DEL table:255 actions=drop
4400 vconn|DBG|unix: received: OFPT_BUNDLE_ADD_MESSAGE (OF1.4):
4401  bundle_id=0 flags=atomic ordered
4402 OFPT_FLOW_MOD (OF1.4): ADD in_port=2,dl_src=00:66:77:88:99:aa idle:50 actions=output:5
4403 vconn|DBG|unix: received: OFPT_BUNDLE_ADD_MESSAGE (OF1.4):
4404  bundle_id=0 flags=atomic ordered
4405 OFPT_FLOW_MOD (OF1.4): ADD in_port=2,dl_src=00:77:88:99:aa:bb idle:60 actions=output:6
4406 vconn|DBG|unix: received: OFPT_BUNDLE_ADD_MESSAGE (OF1.4):
4407  bundle_id=0 flags=atomic ordered
4408 OFPT_FLOW_MOD (OF1.4): ADD in_port=2,dl_src=00:88:99:aa:bb:cc idle:70 actions=output:7
4409 vconn|DBG|unix: received: OFPT_BUNDLE_ADD_MESSAGE (OF1.4):
4410  bundle_id=0 flags=atomic ordered
4411 OFPT_FLOW_MOD (OF1.4): DEL table:255 in_port=2,dl_src=00:88:99:aa:bb:cc actions=drop
4412 vconn|DBG|unix: received: OFPT_BUNDLE_CONTROL (OF1.4):
4413  bundle_id=0 type=COMMIT_REQUEST flags=atomic ordered
4414 vconn|DBG|unix: sent (Success): OFPT_BUNDLE_CONTROL (OF1.4):
4415  bundle_id=0 type=COMMIT_REPLY flags=0
4416 vconn|DBG|unix: sent (Success): OFPT_HELLO (OF1.6):
4417  version bitmap: 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07
4418 vconn|DBG|unix: received: OFPT_HELLO:
4419  version bitmap: 0x01
4420 vconn|DBG|unix: negotiated OpenFlow version 0x01 (we support version 0x07 and earlier, peer supports version 0x01)
4421 vconn|DBG|unix: received: NXT_SET_FLOW_FORMAT: format=nxm
4422 vconn|DBG|unix: received: OFPT_BARRIER_REQUEST:
4423 vconn|DBG|unix: sent (Success): OFPT_BARRIER_REPLY:
4424 vconn|DBG|unix: received: NXST_FLOW request:
4425 vconn|DBG|unix: sent (Success): NXST_FLOW reply:
4426  idle_timeout=50, in_port=2,dl_src=00:66:77:88:99:aa actions=output:5
4427  idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=output:6
4428 vconn|DBG|unix: sent (Success): OFPT_HELLO (OF1.6):
4429  version bitmap: 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07
4430 vconn|DBG|unix: received: OFPT_HELLO (OF1.4):
4431  version bitmap: 0x05
4432 vconn|DBG|unix: negotiated OpenFlow version 0x05 (we support version 0x07 and earlier, peer supports version 0x05)
4433 vconn|DBG|unix: received: OFPT_BUNDLE_CONTROL (OF1.4):
4434  bundle_id=0 type=OPEN_REQUEST flags=atomic ordered
4435 vconn|DBG|unix: sent (Success): OFPT_BUNDLE_CONTROL (OF1.4):
4436  bundle_id=0 type=OPEN_REPLY flags=0
4437 vconn|DBG|unix: received: OFPT_BUNDLE_ADD_MESSAGE (OF1.4):
4438  bundle_id=0 flags=atomic ordered
4439 OFPT_FLOW_MOD (OF1.4): MOD actions=drop
4440 vconn|DBG|unix: received: OFPT_BUNDLE_ADD_MESSAGE (OF1.4):
4441  bundle_id=0 flags=atomic ordered
4442 OFPT_FLOW_MOD (OF1.4): MOD_STRICT in_port=2,dl_src=00:77:88:99:aa:bb actions=output:7
4443 vconn|DBG|unix: received: OFPT_BUNDLE_CONTROL (OF1.4):
4444  bundle_id=0 type=COMMIT_REQUEST flags=atomic ordered
4445 vconn|DBG|unix: sent (Success): OFPT_BUNDLE_CONTROL (OF1.4):
4446  bundle_id=0 type=COMMIT_REPLY flags=0
4447 vconn|DBG|unix: sent (Success): OFPT_HELLO (OF1.6):
4448  version bitmap: 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07
4449 vconn|DBG|unix: received: OFPT_HELLO:
4450  version bitmap: 0x01
4451 vconn|DBG|unix: negotiated OpenFlow version 0x01 (we support version 0x07 and earlier, peer supports version 0x01)
4452 vconn|DBG|unix: received: NXT_SET_FLOW_FORMAT: format=nxm
4453 vconn|DBG|unix: received: OFPT_BARRIER_REQUEST:
4454 vconn|DBG|unix: sent (Success): OFPT_BARRIER_REPLY:
4455 vconn|DBG|unix: received: NXST_FLOW request:
4456 vconn|DBG|unix: sent (Success): NXST_FLOW reply:
4457  idle_timeout=50, in_port=2,dl_src=00:66:77:88:99:aa actions=drop
4458  idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=output:7
4459 vconn|DBG|unix: sent (Success): OFPT_HELLO (OF1.6):
4460  version bitmap: 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07
4461 vconn|DBG|unix: received: OFPT_HELLO (OF1.4):
4462  version bitmap: 0x05
4463 vconn|DBG|unix: negotiated OpenFlow version 0x05 (we support version 0x07 and earlier, peer supports version 0x05)
4464 vconn|DBG|unix: received: OFPT_BUNDLE_CONTROL (OF1.4):
4465  bundle_id=0 type=OPEN_REQUEST flags=atomic ordered
4466 vconn|DBG|unix: sent (Success): OFPT_BUNDLE_CONTROL (OF1.4):
4467  bundle_id=0 type=OPEN_REPLY flags=0
4468 vconn|DBG|unix: received: OFPT_BUNDLE_ADD_MESSAGE (OF1.4):
4469  bundle_id=0 flags=atomic ordered
4470 OFPT_FLOW_MOD (OF1.4): ADD in_port=2,dl_src=00:77:88:99:aa:bb idle:60 actions=output:8
4471 vconn|DBG|unix: received: OFPT_BUNDLE_ADD_MESSAGE (OF1.4):
4472  bundle_id=0 flags=atomic ordered
4473 OFPT_FLOW_MOD (OF1.4): DEL_STRICT table:255 in_port=2,dl_src=00:66:77:88:99:aa actions=drop
4474 vconn|DBG|unix: received: OFPT_BUNDLE_ADD_MESSAGE (OF1.4):
4475  bundle_id=0 flags=atomic ordered
4476 OFPT_FLOW_MOD (OF1.4): ADD in_port=2,dl_src=00:66:77:88:99:aa actions=drop
4477 vconn|DBG|unix: received: OFPT_BUNDLE_CONTROL (OF1.4):
4478  bundle_id=0 type=COMMIT_REQUEST flags=atomic ordered
4479 vconn|DBG|unix: sent (Success): OFPT_BUNDLE_CONTROL (OF1.4):
4480  bundle_id=0 type=COMMIT_REPLY flags=0
4481 vconn|DBG|unix: sent (Success): OFPT_HELLO (OF1.6):
4482  version bitmap: 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07
4483 vconn|DBG|unix: received: OFPT_HELLO:
4484  version bitmap: 0x01
4485 vconn|DBG|unix: negotiated OpenFlow version 0x01 (we support version 0x07 and earlier, peer supports version 0x01)
4486 vconn|DBG|unix: received: NXT_SET_FLOW_FORMAT: format=nxm
4487 vconn|DBG|unix: received: OFPT_BARRIER_REQUEST:
4488 vconn|DBG|unix: sent (Success): OFPT_BARRIER_REPLY:
4489 vconn|DBG|unix: received: NXST_FLOW request: 
4490 vconn|DBG|unix: sent (Success): NXST_FLOW reply:
4491  idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=output:8
4492  in_port=2,dl_src=00:66:77:88:99:aa actions=drop
4493 ])
4494
4495 OVS_VSWITCHD_STOP
4496 AT_CLEANUP
4497
4498
4499 AT_SETUP([ofproto - failing bundle commit (OpenFlow 1.4)])
4500 AT_KEYWORDS([monitor])
4501 OVS_VSWITCHD_START
4502
4503 AT_CHECK([ovs-ofctl del-flows br0])
4504
4505 ovs-ofctl add-flows br0 - <<EOF
4506 idle_timeout=50 in_port=2 dl_src=00:66:77:88:99:aa actions=11
4507 idle_timeout=60 in_port=2 dl_src=00:77:88:99:aa:bb actions=22
4508 idle_timeout=70 in_port=2 dl_src=00:88:99:aa:bb:cc actions=33
4509 EOF
4510 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
4511  idle_timeout=50, in_port=2,dl_src=00:66:77:88:99:aa actions=output:11
4512  idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=output:22
4513  idle_timeout=70, in_port=2,dl_src=00:88:99:aa:bb:cc actions=output:33
4514 NXST_FLOW reply:
4515 ])
4516
4517 # last line uses illegal table number (OVS internal table)
4518 AT_DATA([flows.txt], [dnl
4519 add idle_timeout=50 in_port=2 dl_src=00:66:77:88:99:aa actions=1
4520 add idle_timeout=60 in_port=2 dl_src=00:77:88:99:aa:bb actions=2
4521 add idle_timeout=70 in_port=2 dl_src=00:88:99:aa:bb:cc actions=3
4522 modify idle_timeout=50 in_port=2 dl_src=00:66:77:88:99:aa actions=4
4523 delete
4524 add idle_timeout=50 in_port=2 dl_src=00:66:77:88:99:aa actions=5
4525 add idle_timeout=60 in_port=2 dl_src=00:77:88:99:aa:bb actions=6
4526 add idle_timeout=70 in_port=2 dl_src=00:88:99:aa:bb:cc actions=7
4527 delete in_port=2 dl_src=00:88:99:aa:bb:cc
4528 add table=254 actions=drop
4529 ])
4530
4531 AT_CHECK([ovs-ofctl --bundle add-flows br0 flows.txt 2>&1 | sed '/|WARN|/d
4532 s/unix:.*br0\.mgmt/unix:br0.mgmt/' | sed 's/(.* error)/(error)/'],
4533 [0], [dnl
4534 OFPT_ERROR (OF1.4) (xid=0xb): OFPBRC_EPERM
4535 OFPT_FLOW_MOD (OF1.4) (xid=0xb): ADD table:254 actions=drop
4536 OFPT_ERROR (OF1.4) (xid=0xd): OFPBFC_MSG_FAILED
4537 OFPT_BUNDLE_CONTROL (OF1.4) (xid=0xd):
4538  bundle_id=0 type=COMMIT_REQUEST flags=atomic ordered
4539 ovs-ofctl: talking to unix:br0.mgmt (error)
4540 ])
4541
4542 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
4543  idle_timeout=50, in_port=2,dl_src=00:66:77:88:99:aa actions=output:11
4544  idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=output:22
4545  idle_timeout=70, in_port=2,dl_src=00:88:99:aa:bb:cc actions=output:33
4546 NXST_FLOW reply:
4547 ])
4548
4549 OVS_VSWITCHD_STOP
4550 AT_CLEANUP
4551
4552
4553 AT_SETUP([ofproto - bundle open (OpenFlow 1.3)])
4554 AT_KEYWORDS([monitor])
4555 OVS_VSWITCHD_START
4556
4557 # Start a monitor, use the required protocol version
4558 ovs-ofctl -O OpenFlow13 monitor br0 --detach --no-chdir --pidfile >monitor.log 2>&1
4559 AT_CAPTURE_FILE([monitor.log])
4560
4561 # Send an OpenFlow13 message (04), OFPT_EXPERIMENTER (04), length (0018),
4562 # xid (0000000a), ONF_EXPERIMENTER_ID (4F4E4600),
4563 # ONFT_BUNDLE_CONTROL (2300 = 0x08FC), bundle id (00000001),
4564 # message type (0000), and flags (0002)
4565 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"
4566 ovs-appctl -t ovs-ofctl ofctl/barrier
4567 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
4568
4569 AT_CHECK([ofctl_strip < monitor.log], [], [dnl
4570 send: ONFT_BUNDLE_CONTROL (OF1.3):
4571  bundle_id=0x1 type=OPEN_REQUEST flags=ordered
4572 ONFT_BUNDLE_CONTROL (OF1.3):
4573  bundle_id=0x1 type=OPEN_REPLY flags=0
4574 OFPT_BARRIER_REPLY (OF1.3):
4575 ])
4576
4577 OVS_VSWITCHD_STOP
4578 AT_CLEANUP
4579
4580 AT_SETUP([ofproto - bundle double open (OpenFlow 1.3)])
4581 AT_KEYWORDS([monitor])
4582 OVS_VSWITCHD_START
4583
4584 # Start a monitor, use the required protocol version
4585 ovs-ofctl -O OpenFlow13 monitor br0 --detach --no-chdir --pidfile >monitor.log 2>&1
4586 AT_CAPTURE_FILE([monitor.log])
4587
4588 # Send twice an OpenFlow13 message (04), OFPT_EXPERIMENTER (04), length (0018),
4589 # xid (0000000a), ONF_EXPERIMENTER_ID (4F4E4600),
4590 # ONFT_BUNDLE_CONTROL (2300 = 0x08FC), bundle id (00000001),
4591 # message type (0000), and flags (0002)
4592 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"
4593 ovs-appctl -t ovs-ofctl ofctl/barrier
4594 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"
4595 ovs-appctl -t ovs-ofctl ofctl/barrier
4596 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
4597
4598 AT_CHECK([ofctl_strip < monitor.log], [0], [dnl
4599 send: ONFT_BUNDLE_CONTROL (OF1.3):
4600  bundle_id=0x1 type=OPEN_REQUEST flags=ordered
4601 ONFT_BUNDLE_CONTROL (OF1.3):
4602  bundle_id=0x1 type=OPEN_REPLY flags=0
4603 OFPT_BARRIER_REPLY (OF1.3):
4604 send: ONFT_BUNDLE_CONTROL (OF1.3):
4605  bundle_id=0x1 type=OPEN_REQUEST flags=ordered
4606 OFPT_ERROR (OF1.3): OFPBFC_BAD_ID
4607 ONFT_BUNDLE_CONTROL (OF1.3):
4608  bundle_id=0x1 type=OPEN_REQUEST flags=ordered
4609 OFPT_BARRIER_REPLY (OF1.3):
4610 ])
4611
4612 OVS_VSWITCHD_STOP
4613 AT_CLEANUP
4614
4615 AT_SETUP([ofproto - bundle close without open (OpenFlow 1.3)])
4616 AT_KEYWORDS([monitor])
4617 OVS_VSWITCHD_START
4618
4619 # Start a monitor, use the required protocol version
4620 ovs-ofctl -O OpenFlow13 monitor br0 --detach --no-chdir --pidfile >monitor.log 2>&1
4621 AT_CAPTURE_FILE([monitor.log])
4622
4623 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"
4624 ovs-appctl -t ovs-ofctl ofctl/barrier
4625 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
4626
4627 AT_CHECK([ofctl_strip < monitor.log], [0], [dnl
4628 send: ONFT_BUNDLE_CONTROL (OF1.3):
4629  bundle_id=0x1 type=CLOSE_REQUEST flags=ordered
4630 OFPT_ERROR (OF1.3): OFPBFC_BAD_ID
4631 ONFT_BUNDLE_CONTROL (OF1.3):
4632  bundle_id=0x1 type=CLOSE_REQUEST flags=ordered
4633 OFPT_BARRIER_REPLY (OF1.3):
4634 ])
4635
4636 OVS_VSWITCHD_STOP
4637 AT_CLEANUP
4638
4639 AT_SETUP([ofproto - bundle double close (OpenFlow 1.3)])
4640 AT_KEYWORDS([monitor])
4641 OVS_VSWITCHD_START
4642
4643 # Start a monitor, use the required protocol version
4644 ovs-ofctl -O OpenFlow13 monitor br0 --detach --no-chdir --pidfile >monitor.log 2>&1
4645 AT_CAPTURE_FILE([monitor.log])
4646
4647 # Open, Close, Close
4648 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"
4649 ovs-appctl -t ovs-ofctl ofctl/barrier
4650 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"
4651 ovs-appctl -t ovs-ofctl ofctl/barrier
4652 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"
4653 ovs-appctl -t ovs-ofctl ofctl/barrier
4654 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
4655
4656 AT_CHECK([ofctl_strip < monitor.log], [0], [dnl
4657 send: ONFT_BUNDLE_CONTROL (OF1.3):
4658  bundle_id=0x1 type=OPEN_REQUEST flags=ordered
4659 ONFT_BUNDLE_CONTROL (OF1.3):
4660  bundle_id=0x1 type=OPEN_REPLY flags=0
4661 OFPT_BARRIER_REPLY (OF1.3):
4662 send: ONFT_BUNDLE_CONTROL (OF1.3):
4663  bundle_id=0x1 type=CLOSE_REQUEST flags=ordered
4664 ONFT_BUNDLE_CONTROL (OF1.3):
4665  bundle_id=0x1 type=CLOSE_REPLY flags=0
4666 OFPT_BARRIER_REPLY (OF1.3):
4667 send: ONFT_BUNDLE_CONTROL (OF1.3):
4668  bundle_id=0x1 type=CLOSE_REQUEST flags=ordered
4669 OFPT_ERROR (OF1.3): OFPBFC_BUNDLE_CLOSED
4670 ONFT_BUNDLE_CONTROL (OF1.3):
4671  bundle_id=0x1 type=CLOSE_REQUEST flags=ordered
4672 OFPT_BARRIER_REPLY (OF1.3):
4673 ])
4674
4675 OVS_VSWITCHD_STOP
4676 AT_CLEANUP
4677
4678 AT_SETUP([ofproto - bundle close, different flags (OpenFlow 1.3)])
4679 AT_KEYWORDS([monitor])
4680 OVS_VSWITCHD_START
4681
4682 # Start a monitor, use the required protocol version
4683 ovs-ofctl -O OpenFlow13 monitor br0 --detach --no-chdir --pidfile >monitor.log 2>&1
4684 AT_CAPTURE_FILE([monitor.log])
4685
4686 # Open, Close
4687 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"
4688 ovs-appctl -t ovs-ofctl ofctl/barrier
4689 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"
4690 ovs-appctl -t ovs-ofctl ofctl/barrier
4691 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
4692
4693 AT_CHECK([ofctl_strip < monitor.log], [0], [dnl
4694 send: ONFT_BUNDLE_CONTROL (OF1.3):
4695  bundle_id=0x1 type=OPEN_REQUEST flags=ordered
4696 ONFT_BUNDLE_CONTROL (OF1.3):
4697  bundle_id=0x1 type=OPEN_REPLY flags=0
4698 OFPT_BARRIER_REPLY (OF1.3):
4699 send: ONFT_BUNDLE_CONTROL (OF1.3):
4700  bundle_id=0x1 type=CLOSE_REQUEST flags=atomic
4701 OFPT_ERROR (OF1.3): OFPBFC_BAD_FLAGS
4702 ONFT_BUNDLE_CONTROL (OF1.3):
4703  bundle_id=0x1 type=CLOSE_REQUEST flags=atomic
4704 OFPT_BARRIER_REPLY (OF1.3):
4705 ])
4706
4707 OVS_VSWITCHD_STOP
4708 AT_CLEANUP
4709
4710 AT_SETUP([ofproto - bundle commit without open (OpenFlow 1.3)])
4711 AT_KEYWORDS([monitor])
4712 OVS_VSWITCHD_START
4713
4714 # Start a monitor, use the required protocol version
4715 ovs-ofctl -O OpenFlow13 monitor br0 --detach --no-chdir --pidfile >monitor.log 2>&1
4716 AT_CAPTURE_FILE([monitor.log])
4717
4718 # Commit
4719 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"
4720 ovs-appctl -t ovs-ofctl ofctl/barrier
4721 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
4722
4723 AT_CHECK([ofctl_strip < monitor.log], [0], [dnl
4724 send: ONFT_BUNDLE_CONTROL (OF1.3):
4725  bundle_id=0x1 type=COMMIT_REQUEST flags=ordered
4726 OFPT_ERROR (OF1.3): OFPBFC_BAD_ID
4727 ONFT_BUNDLE_CONTROL (OF1.3):
4728  bundle_id=0x1 type=COMMIT_REQUEST flags=ordered
4729 OFPT_BARRIER_REPLY (OF1.3):
4730 ])
4731
4732 OVS_VSWITCHD_STOP
4733 AT_CLEANUP
4734
4735 AT_SETUP([ofproto - bundle commit, different flags (OpenFlow 1.3)])
4736 AT_KEYWORDS([monitor])
4737 OVS_VSWITCHD_START
4738
4739 # Start a monitor, use the required protocol version
4740 ovs-ofctl -O OpenFlow13 monitor br0 --detach --no-chdir --pidfile >monitor.log 2>&1
4741 AT_CAPTURE_FILE([monitor.log])
4742
4743 # Open, Commit
4744 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"
4745 ovs-appctl -t ovs-ofctl ofctl/barrier
4746 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"
4747 ovs-appctl -t ovs-ofctl ofctl/barrier
4748 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
4749
4750 AT_CHECK([ofctl_strip < monitor.log], [0], [dnl
4751 send: ONFT_BUNDLE_CONTROL (OF1.3):
4752  bundle_id=0x1 type=OPEN_REQUEST flags=ordered
4753 ONFT_BUNDLE_CONTROL (OF1.3):
4754  bundle_id=0x1 type=OPEN_REPLY flags=0
4755 OFPT_BARRIER_REPLY (OF1.3):
4756 send: ONFT_BUNDLE_CONTROL (OF1.3):
4757  bundle_id=0x1 type=COMMIT_REQUEST flags=atomic
4758 OFPT_ERROR (OF1.3): OFPBFC_BAD_FLAGS
4759 ONFT_BUNDLE_CONTROL (OF1.3):
4760  bundle_id=0x1 type=COMMIT_REQUEST flags=atomic
4761 OFPT_BARRIER_REPLY (OF1.3):
4762 ])
4763
4764 OVS_VSWITCHD_STOP
4765 AT_CLEANUP
4766
4767 AT_SETUP([ofproto - bundle discard without open (OpenFlow 1.3)])
4768 AT_KEYWORDS([monitor])
4769 OVS_VSWITCHD_START
4770
4771 # Start a monitor, use the required protocol version
4772 ovs-ofctl -O OpenFlow13 monitor br0 --detach --no-chdir --pidfile >monitor.log 2>&1
4773 AT_CAPTURE_FILE([monitor.log])
4774
4775 # Discard
4776 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"
4777 ovs-appctl -t ovs-ofctl ofctl/barrier
4778 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
4779
4780 AT_CHECK([ofctl_strip < monitor.log], [0], [dnl
4781 send: ONFT_BUNDLE_CONTROL (OF1.3):
4782  bundle_id=0x1 type=DISCARD_REQUEST flags=ordered
4783 OFPT_ERROR (OF1.3): OFPBFC_BAD_ID
4784 ONFT_BUNDLE_CONTROL (OF1.3):
4785  bundle_id=0x1 type=DISCARD_REQUEST flags=ordered
4786 OFPT_BARRIER_REPLY (OF1.3):
4787 ])
4788
4789 OVS_VSWITCHD_STOP
4790 AT_CLEANUP
4791
4792
4793 AT_SETUP([ofproto - bundle with multiple flow mods (OpenFlow 1.3)])
4794 AT_KEYWORDS([monitor])
4795 OVS_VSWITCHD_START
4796
4797 AT_CHECK([ovs-appctl vlog/set vconn:dbg])
4798
4799 AT_CHECK([ovs-ofctl del-flows br0])
4800
4801 AT_DATA([flows.txt], [dnl
4802 add idle_timeout=50 in_port=2 dl_src=00:66:77:88:99:aa actions=1
4803 add idle_timeout=60 in_port=2 dl_src=00:77:88:99:aa:bb actions=2
4804 add idle_timeout=70 in_port=2 dl_src=00:88:99:aa:bb:cc actions=3
4805 add idle_timeout=50 in_port=2 dl_src=00:66:77:88:99:aa actions=4
4806 delete
4807 add idle_timeout=50 in_port=2 dl_src=00:66:77:88:99:aa actions=5
4808 add idle_timeout=60 in_port=2 dl_src=00:77:88:99:aa:bb actions=6
4809 add idle_timeout=70 in_port=2 dl_src=00:88:99:aa:bb:cc actions=7
4810 delete in_port=2 dl_src=00:88:99:aa:bb:cc
4811 ])
4812
4813 AT_CHECK([ovs-ofctl -O OpenFlow13 --bundle add-flows br0 flows.txt])
4814
4815 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
4816  idle_timeout=50, in_port=2,dl_src=00:66:77:88:99:aa actions=output:5
4817  idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=output:6
4818 NXST_FLOW reply:
4819 ])
4820
4821 AT_DATA([flows.txt], [dnl
4822 modify actions=drop
4823 modify_strict in_port=2 dl_src=00:77:88:99:aa:bb actions=7
4824 ])
4825
4826 AT_CHECK([ovs-ofctl -O OpenFlow13 --bundle add-flows br0 flows.txt])
4827
4828 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
4829  idle_timeout=50, in_port=2,dl_src=00:66:77:88:99:aa actions=drop
4830  idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=output:7
4831 NXST_FLOW reply:
4832 ])
4833
4834 # Adding an existing flow acts as a modify, and delete_strict also works.
4835 AT_DATA([flows.txt], [dnl
4836 add idle_timeout=60 in_port=2 dl_src=00:77:88:99:aa:bb actions=8
4837 delete_strict in_port=2 dl_src=00:66:77:88:99:aa
4838 add in_port=2 dl_src=00:66:77:88:99:aa actions=drop
4839 ])
4840
4841 AT_CHECK([ovs-ofctl -O OpenFlow13 --bundle add-flows br0 flows.txt])
4842
4843 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
4844  idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=output:8
4845  in_port=2,dl_src=00:66:77:88:99:aa actions=drop
4846 NXST_FLOW reply:
4847 ])
4848
4849 dnl Check logs for OpenFlow trace
4850 # Prevent race.
4851 OVS_WAIT_UNTIL([vconn_sub < ovs-vswitchd.log | test `grep -- "|vconn|DBG|unix: sent (Success): NXST_FLOW reply" | wc -l` -ge 3])
4852 AT_CHECK([print_vconn_debug | vconn_sub | ofctl_strip], [0], [dnl
4853 vconn|DBG|unix: sent (Success): OFPT_HELLO (OF1.6):
4854  version bitmap: 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07
4855 vconn|DBG|unix: received: OFPT_HELLO:
4856  version bitmap: 0x01
4857 vconn|DBG|unix: negotiated OpenFlow version 0x01 (we support version 0x07 and earlier, peer supports version 0x01)
4858 vconn|DBG|unix: received: OFPT_FLOW_MOD: DEL actions=drop
4859 vconn|DBG|unix: received: OFPT_BARRIER_REQUEST:
4860 vconn|DBG|unix: sent (Success): OFPT_BARRIER_REPLY:
4861 vconn|DBG|unix: sent (Success): OFPT_HELLO (OF1.6):
4862  version bitmap: 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07
4863 vconn|DBG|unix: received: OFPT_HELLO (OF1.3):
4864  version bitmap: 0x04
4865 vconn|DBG|unix: negotiated OpenFlow version 0x04 (we support version 0x07 and earlier, peer supports version 0x04)
4866 vconn|DBG|unix: received: ONFT_BUNDLE_CONTROL (OF1.3):
4867  bundle_id=0 type=OPEN_REQUEST flags=atomic ordered
4868 vconn|DBG|unix: sent (Success): ONFT_BUNDLE_CONTROL (OF1.3):
4869  bundle_id=0 type=OPEN_REPLY flags=0
4870 vconn|DBG|unix: received: ONFT_BUNDLE_ADD_MESSAGE (OF1.3):
4871  bundle_id=0 flags=atomic ordered
4872 OFPT_FLOW_MOD (OF1.3): ADD in_port=2,dl_src=00:66:77:88:99:aa idle:50 actions=output:1
4873 vconn|DBG|unix: received: ONFT_BUNDLE_ADD_MESSAGE (OF1.3):
4874  bundle_id=0 flags=atomic ordered
4875 OFPT_FLOW_MOD (OF1.3): ADD in_port=2,dl_src=00:77:88:99:aa:bb idle:60 actions=output:2
4876 vconn|DBG|unix: received: ONFT_BUNDLE_ADD_MESSAGE (OF1.3):
4877  bundle_id=0 flags=atomic ordered
4878 OFPT_FLOW_MOD (OF1.3): ADD in_port=2,dl_src=00:88:99:aa:bb:cc idle:70 actions=output:3
4879 vconn|DBG|unix: received: ONFT_BUNDLE_ADD_MESSAGE (OF1.3):
4880  bundle_id=0 flags=atomic ordered
4881 OFPT_FLOW_MOD (OF1.3): ADD in_port=2,dl_src=00:66:77:88:99:aa idle:50 actions=output:4
4882 vconn|DBG|unix: received: ONFT_BUNDLE_ADD_MESSAGE (OF1.3):
4883  bundle_id=0 flags=atomic ordered
4884 OFPT_FLOW_MOD (OF1.3): DEL table:255 actions=drop
4885 vconn|DBG|unix: received: ONFT_BUNDLE_ADD_MESSAGE (OF1.3):
4886  bundle_id=0 flags=atomic ordered
4887 OFPT_FLOW_MOD (OF1.3): ADD in_port=2,dl_src=00:66:77:88:99:aa idle:50 actions=output:5
4888 vconn|DBG|unix: received: ONFT_BUNDLE_ADD_MESSAGE (OF1.3):
4889  bundle_id=0 flags=atomic ordered
4890 OFPT_FLOW_MOD (OF1.3): ADD in_port=2,dl_src=00:77:88:99:aa:bb idle:60 actions=output:6
4891 vconn|DBG|unix: received: ONFT_BUNDLE_ADD_MESSAGE (OF1.3):
4892  bundle_id=0 flags=atomic ordered
4893 OFPT_FLOW_MOD (OF1.3): ADD in_port=2,dl_src=00:88:99:aa:bb:cc idle:70 actions=output:7
4894 vconn|DBG|unix: received: ONFT_BUNDLE_ADD_MESSAGE (OF1.3):
4895  bundle_id=0 flags=atomic ordered
4896 OFPT_FLOW_MOD (OF1.3): DEL table:255 in_port=2,dl_src=00:88:99:aa:bb:cc actions=drop
4897 vconn|DBG|unix: received: ONFT_BUNDLE_CONTROL (OF1.3):
4898  bundle_id=0 type=COMMIT_REQUEST flags=atomic ordered
4899 vconn|DBG|unix: sent (Success): ONFT_BUNDLE_CONTROL (OF1.3):
4900  bundle_id=0 type=COMMIT_REPLY flags=0
4901 vconn|DBG|unix: sent (Success): OFPT_HELLO (OF1.6):
4902  version bitmap: 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07
4903 vconn|DBG|unix: received: OFPT_HELLO:
4904  version bitmap: 0x01
4905 vconn|DBG|unix: negotiated OpenFlow version 0x01 (we support version 0x07 and earlier, peer supports version 0x01)
4906 vconn|DBG|unix: received: NXT_SET_FLOW_FORMAT: format=nxm
4907 vconn|DBG|unix: received: OFPT_BARRIER_REQUEST:
4908 vconn|DBG|unix: sent (Success): OFPT_BARRIER_REPLY:
4909 vconn|DBG|unix: received: NXST_FLOW request:
4910 vconn|DBG|unix: sent (Success): NXST_FLOW reply:
4911  idle_timeout=50, in_port=2,dl_src=00:66:77:88:99:aa actions=output:5
4912  idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=output:6
4913 vconn|DBG|unix: sent (Success): OFPT_HELLO (OF1.6):
4914  version bitmap: 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07
4915 vconn|DBG|unix: received: OFPT_HELLO (OF1.3):
4916  version bitmap: 0x04
4917 vconn|DBG|unix: negotiated OpenFlow version 0x04 (we support version 0x07 and earlier, peer supports version 0x04)
4918 vconn|DBG|unix: received: ONFT_BUNDLE_CONTROL (OF1.3):
4919  bundle_id=0 type=OPEN_REQUEST flags=atomic ordered
4920 vconn|DBG|unix: sent (Success): ONFT_BUNDLE_CONTROL (OF1.3):
4921  bundle_id=0 type=OPEN_REPLY flags=0
4922 vconn|DBG|unix: received: ONFT_BUNDLE_ADD_MESSAGE (OF1.3):
4923  bundle_id=0 flags=atomic ordered
4924 OFPT_FLOW_MOD (OF1.3): MOD actions=drop
4925 vconn|DBG|unix: received: ONFT_BUNDLE_ADD_MESSAGE (OF1.3):
4926  bundle_id=0 flags=atomic ordered
4927 OFPT_FLOW_MOD (OF1.3): MOD_STRICT in_port=2,dl_src=00:77:88:99:aa:bb actions=output:7
4928 vconn|DBG|unix: received: ONFT_BUNDLE_CONTROL (OF1.3):
4929  bundle_id=0 type=COMMIT_REQUEST flags=atomic ordered
4930 vconn|DBG|unix: sent (Success): ONFT_BUNDLE_CONTROL (OF1.3):
4931  bundle_id=0 type=COMMIT_REPLY flags=0
4932 vconn|DBG|unix: sent (Success): OFPT_HELLO (OF1.6):
4933  version bitmap: 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07
4934 vconn|DBG|unix: received: OFPT_HELLO:
4935  version bitmap: 0x01
4936 vconn|DBG|unix: negotiated OpenFlow version 0x01 (we support version 0x07 and earlier, peer supports version 0x01)
4937 vconn|DBG|unix: received: NXT_SET_FLOW_FORMAT: format=nxm
4938 vconn|DBG|unix: received: OFPT_BARRIER_REQUEST:
4939 vconn|DBG|unix: sent (Success): OFPT_BARRIER_REPLY:
4940 vconn|DBG|unix: received: NXST_FLOW request:
4941 vconn|DBG|unix: sent (Success): NXST_FLOW reply:
4942  idle_timeout=50, in_port=2,dl_src=00:66:77:88:99:aa actions=drop
4943  idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=output:7
4944 vconn|DBG|unix: sent (Success): OFPT_HELLO (OF1.6):
4945  version bitmap: 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07
4946 vconn|DBG|unix: received: OFPT_HELLO (OF1.3):
4947  version bitmap: 0x04
4948 vconn|DBG|unix: negotiated OpenFlow version 0x04 (we support version 0x07 and earlier, peer supports version 0x04)
4949 vconn|DBG|unix: received: ONFT_BUNDLE_CONTROL (OF1.3):
4950  bundle_id=0 type=OPEN_REQUEST flags=atomic ordered
4951 vconn|DBG|unix: sent (Success): ONFT_BUNDLE_CONTROL (OF1.3):
4952  bundle_id=0 type=OPEN_REPLY flags=0
4953 vconn|DBG|unix: received: ONFT_BUNDLE_ADD_MESSAGE (OF1.3):
4954  bundle_id=0 flags=atomic ordered
4955 OFPT_FLOW_MOD (OF1.3): ADD in_port=2,dl_src=00:77:88:99:aa:bb idle:60 actions=output:8
4956 vconn|DBG|unix: received: ONFT_BUNDLE_ADD_MESSAGE (OF1.3):
4957  bundle_id=0 flags=atomic ordered
4958 OFPT_FLOW_MOD (OF1.3): DEL_STRICT table:255 in_port=2,dl_src=00:66:77:88:99:aa actions=drop
4959 vconn|DBG|unix: received: ONFT_BUNDLE_ADD_MESSAGE (OF1.3):
4960  bundle_id=0 flags=atomic ordered
4961 OFPT_FLOW_MOD (OF1.3): ADD in_port=2,dl_src=00:66:77:88:99:aa actions=drop
4962 vconn|DBG|unix: received: ONFT_BUNDLE_CONTROL (OF1.3):
4963  bundle_id=0 type=COMMIT_REQUEST flags=atomic ordered
4964 vconn|DBG|unix: sent (Success): ONFT_BUNDLE_CONTROL (OF1.3):
4965  bundle_id=0 type=COMMIT_REPLY flags=0
4966 vconn|DBG|unix: sent (Success): OFPT_HELLO (OF1.6):
4967  version bitmap: 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07
4968 vconn|DBG|unix: received: OFPT_HELLO:
4969  version bitmap: 0x01
4970 vconn|DBG|unix: negotiated OpenFlow version 0x01 (we support version 0x07 and earlier, peer supports version 0x01)
4971 vconn|DBG|unix: received: NXT_SET_FLOW_FORMAT: format=nxm
4972 vconn|DBG|unix: received: OFPT_BARRIER_REQUEST:
4973 vconn|DBG|unix: sent (Success): OFPT_BARRIER_REPLY:
4974 vconn|DBG|unix: received: NXST_FLOW request: 
4975 vconn|DBG|unix: sent (Success): NXST_FLOW reply:
4976  idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=output:8
4977  in_port=2,dl_src=00:66:77:88:99:aa actions=drop
4978 ])
4979
4980 OVS_VSWITCHD_STOP
4981 AT_CLEANUP
4982
4983
4984 AT_SETUP([ofproto - failing bundle commit (OpenFlow 1.3)])
4985 AT_KEYWORDS([monitor])
4986 OVS_VSWITCHD_START
4987
4988 AT_CHECK([ovs-ofctl del-flows br0])
4989
4990 ovs-ofctl add-flows br0 - <<EOF
4991 idle_timeout=50 in_port=2 dl_src=00:66:77:88:99:aa actions=11
4992 idle_timeout=60 in_port=2 dl_src=00:77:88:99:aa:bb actions=22
4993 idle_timeout=70 in_port=2 dl_src=00:88:99:aa:bb:cc actions=33
4994 EOF
4995 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
4996  idle_timeout=50, in_port=2,dl_src=00:66:77:88:99:aa actions=output:11
4997  idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=output:22
4998  idle_timeout=70, in_port=2,dl_src=00:88:99:aa:bb:cc actions=output:33
4999 NXST_FLOW reply:
5000 ])
5001
5002 # last line uses illegal table number (OVS internal table)
5003 AT_DATA([flows.txt], [dnl
5004 add idle_timeout=50 in_port=2 dl_src=00:66:77:88:99:aa actions=1
5005 add idle_timeout=60 in_port=2 dl_src=00:77:88:99:aa:bb actions=2
5006 add idle_timeout=70 in_port=2 dl_src=00:88:99:aa:bb:cc actions=3
5007 modify idle_timeout=50 in_port=2 dl_src=00:66:77:88:99:aa actions=4
5008 delete
5009 add idle_timeout=50 in_port=2 dl_src=00:66:77:88:99:aa actions=5
5010 add idle_timeout=60 in_port=2 dl_src=00:77:88:99:aa:bb actions=6
5011 add idle_timeout=70 in_port=2 dl_src=00:88:99:aa:bb:cc actions=7
5012 delete in_port=2 dl_src=00:88:99:aa:bb:cc
5013 add table=254 actions=drop
5014 ])
5015
5016 AT_CHECK([ovs-ofctl -O OpenFlow13 --bundle add-flows br0 flows.txt 2>&1 | sed '/|WARN|/d
5017 s/unix:.*br0\.mgmt/unix:br0.mgmt/' | sed 's/(.* error)/(error)/'],
5018 [0], [dnl
5019 OFPT_ERROR (OF1.3) (xid=0xb): OFPBRC_EPERM
5020 OFPT_FLOW_MOD (OF1.3) (xid=0xb): ADD table:254 actions=drop
5021 OFPT_ERROR (OF1.3) (xid=0xd): OFPBFC_MSG_FAILED
5022 ONFT_BUNDLE_CONTROL (OF1.3) (xid=0xd):
5023  bundle_id=0 type=COMMIT_REQUEST flags=atomic ordered
5024 ovs-ofctl: talking to unix:br0.mgmt (error)
5025 ])
5026
5027 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
5028  idle_timeout=50, in_port=2,dl_src=00:66:77:88:99:aa actions=output:11
5029  idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=output:22
5030  idle_timeout=70, in_port=2,dl_src=00:88:99:aa:bb:cc actions=output:33
5031 NXST_FLOW reply:
5032 ])
5033
5034 OVS_VSWITCHD_STOP
5035 AT_CLEANUP