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