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