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