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