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