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