9358a6af08515dbf8b6e4396cc2d8f8b2d84b786
[sliver-openvswitch.git] / tests / ofproto.at
1 AT_BANNER([ofproto])
2
3 AT_SETUP([ofproto - echo request])
4 OVS_VSWITCHD_START
5 AT_CHECK([ovs-ofctl -vANY:ANY:WARN probe br0])
6 OVS_VSWITCHD_STOP
7 AT_CLEANUP
8
9 AT_SETUP([ofproto - feature request, config request])
10 OVS_VSWITCHD_START
11 AT_CHECK([ovs-ofctl -vANY:ANY:WARN show br0], [0], [stdout])
12 AT_CHECK([STRIP_XIDS stdout], [0], [dnl
13 OFPT_FEATURES_REPLY: ver:0x1, dpid:fedcba9876543210
14 n_tables:255, n_buffers:256
15 features: capabilities:0xc7, actions:0xfff
16  LOCAL(br0): addr:aa:55:aa:55:00:00
17      config:     PORT_DOWN
18      state:      LINK_DOWN
19 OFPT_GET_CONFIG_REPLY: frags=normal miss_send_len=0
20 ])
21 OVS_VSWITCHD_STOP
22 AT_CLEANUP
23
24 dnl This is really bare-bones.
25 dnl It at least checks request and reply serialization and deserialization.
26 AT_SETUP([ofproto - port stats])
27 OVS_VSWITCHD_START
28 AT_CHECK([ovs-ofctl -vANY:ANY:WARN dump-ports br0], [0], [stdout])
29 AT_CHECK([STRIP_XIDS stdout], [0], [dnl
30 OFPST_PORT reply: 1 ports
31   port 65534: rx pkts=0, bytes=0, drop=0, errs=0, frame=0, over=0, crc=0
32            tx pkts=0, bytes=0, drop=0, errs=0, coll=0
33 ])
34 OVS_VSWITCHD_STOP
35 AT_CLEANUP
36
37 dnl This is really bare-bones.
38 dnl It at least checks request and reply serialization and deserialization.
39 AT_SETUP([ofproto - queue stats])
40 OVS_VSWITCHD_START
41 AT_CHECK([ovs-ofctl -vANY:ANY:WARN queue-stats br0], [0], [stdout])
42 AT_CHECK([STRIP_XIDS stdout], [0], [dnl
43 OFPST_QUEUE reply: 0 queues
44 ])
45 OVS_VSWITCHD_STOP
46 AT_CLEANUP
47
48 AT_SETUP([ofproto - mod-port])
49 OVS_VSWITCHD_START
50 for command_config_state in \
51     'up 0 0' \
52     'noflood NO_FLOOD 0' \
53     'down PORT_DOWN,NO_FLOOD LINK_DOWN' \
54     'flood PORT_DOWN LINK_DOWN'
55 do
56     set $command_config_state
57     command=$[1] config=`echo $[2] | sed 's/,/ /g'` state=$[3]
58     AT_CHECK([ovs-ofctl -vANY:ANY:WARN mod-port br0 br0 $command])
59     AT_CHECK([ovs-ofctl -vANY:ANY:WARN show br0], [0], [stdout])
60     AT_CHECK_UNQUOTED([STRIP_XIDS stdout], [0], [dnl
61 OFPT_FEATURES_REPLY: ver:0x1, dpid:fedcba9876543210
62 n_tables:255, n_buffers:256
63 features: capabilities:0xc7, actions:0xfff
64  LOCAL(br0): addr:aa:55:aa:55:00:00
65      config:     $config
66      state:      $state
67 OFPT_GET_CONFIG_REPLY: frags=normal miss_send_len=0
68 ])
69 done
70 OVS_VSWITCHD_STOP
71 AT_CLEANUP
72
73 AT_SETUP([ofproto - basic flow_mod commands (NXM)])
74 OVS_VSWITCHD_START
75 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip], [0], [NXST_FLOW reply:
76 ])
77 AT_CHECK([echo 'in_port=1,actions=0' | ovs-ofctl add-flows br0 -])
78 AT_CHECK([ovs-ofctl add-flow br0 in_port=0,actions=1])
79 AT_CHECK([ovs-ofctl -F nxm add-flow br0 table=1,in_port=3,actions=2])
80 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
81  in_port=0 actions=output:1
82  in_port=1 actions=output:0
83  table=1, in_port=3 actions=output:2
84 NXST_FLOW reply:
85 ])
86 AT_CHECK([ovs-ofctl dump-aggregate br0 table=0 | STRIP_XIDS], [0], [dnl
87 NXST_AGGREGATE reply: packet_count=0 byte_count=0 flow_count=2
88 ])
89 AT_CHECK([ovs-ofctl del-flows br0])
90 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip], [0], [NXST_FLOW reply:
91 ])
92 OVS_VSWITCHD_STOP
93 AT_CLEANUP
94
95 AT_SETUP([ofproto - basic flow_mod commands (OpenFlow 1.0)])
96 OVS_VSWITCHD_START
97 AT_CHECK([ovs-ofctl -F openflow10 dump-flows br0 | ofctl_strip], [0], [OFPST_FLOW reply:
98 ])
99 AT_CHECK([echo 'in_port=1,actions=0' | ovs-ofctl -F openflow10 add-flows br0 -])
100 AT_CHECK([ovs-ofctl -F openflow10 add-flow br0 in_port=0,actions=1])
101 AT_CHECK([ovs-ofctl -F openflow10 add-flow br0 table=1,in_port=3,actions=2])
102 AT_CHECK([ovs-ofctl -F openflow10 dump-flows br0 | ofctl_strip | sort], [0], [dnl
103  in_port=0 actions=output:1
104  in_port=1 actions=output:0
105  table=1, in_port=3 actions=output:2
106 OFPST_FLOW reply:
107 ])
108 AT_CHECK([ovs-ofctl -F openflow10 dump-aggregate br0 table=0 | STRIP_XIDS], [0], [dnl
109 OFPST_AGGREGATE reply: packet_count=0 byte_count=0 flow_count=2
110 ])
111 AT_CHECK([ovs-ofctl -F openflow10 del-flows br0])
112 AT_CHECK([ovs-ofctl -F openflow10 dump-flows br0 | ofctl_strip], [0], [OFPST_FLOW reply:
113 ])
114 OVS_VSWITCHD_STOP
115 AT_CLEANUP
116
117 AT_SETUP([ofproto - dump flows with cookie])
118 OVS_VSWITCHD_START
119 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x1,in_port=1,actions=0])
120 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x2,in_port=2,actions=0])
121 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x3,in_port=3,actions=0])
122 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
123  cookie=0x1, in_port=1 actions=output:0
124  cookie=0x2, in_port=2 actions=output:0
125  cookie=0x3, in_port=3 actions=output:0
126 NXST_FLOW reply:
127 ])
128 AT_CHECK([ovs-ofctl dump-aggregate br0 table=0 | STRIP_XIDS], [0], [dnl
129 NXST_AGGREGATE reply: packet_count=0 byte_count=0 flow_count=3
130 ])
131 AT_CHECK([ovs-ofctl dump-flows br0 cookie=0x3 | ofctl_strip | sort], [0], [dnl
132  cookie=0x3, in_port=3 actions=output:0
133 NXST_FLOW reply:
134 ])
135 AT_CHECK([ovs-ofctl dump-aggregate br0 cookie=0x3 | STRIP_XIDS], [0], [dnl
136 NXST_AGGREGATE reply: packet_count=0 byte_count=0 flow_count=1
137 ])
138 OVS_VSWITCHD_STOP
139 AT_CLEANUP
140
141 AT_SETUP([ofproto - dump flows with cookie mask])
142 OVS_VSWITCHD_START
143 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x1,in_port=1,actions=0])
144 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x2,in_port=2,actions=0])
145 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x3,in_port=3,actions=0])
146 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
147  cookie=0x1, in_port=1 actions=output:0
148  cookie=0x2, in_port=2 actions=output:0
149  cookie=0x3, in_port=3 actions=output:0
150 NXST_FLOW reply:
151 ])
152 AT_CHECK([ovs-ofctl dump-aggregate br0 table=0 | STRIP_XIDS], [0], [dnl
153 NXST_AGGREGATE reply: packet_count=0 byte_count=0 flow_count=3
154 ])
155 AT_CHECK([ovs-ofctl dump-flows br0 cookie=0x3/0x1 | ofctl_strip | sort], [0], [dnl
156  cookie=0x1, in_port=1 actions=output:0
157  cookie=0x3, in_port=3 actions=output:0
158 NXST_FLOW reply:
159 ])
160 AT_CHECK([ovs-ofctl dump-aggregate br0 cookie=0x3/0x1 | STRIP_XIDS], [0], [dnl
161 NXST_AGGREGATE reply: packet_count=0 byte_count=0 flow_count=2
162 ])
163 OVS_VSWITCHD_STOP
164 AT_CLEANUP
165
166 AT_SETUP([ofproto - del flows with cookie])
167 OVS_VSWITCHD_START
168 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x1,in_port=1,actions=0])
169 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x2,in_port=2,actions=0])
170 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x3,in_port=3,actions=0])
171 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
172  cookie=0x1, in_port=1 actions=output:0
173  cookie=0x2, in_port=2 actions=output:0
174  cookie=0x3, in_port=3 actions=output:0
175 NXST_FLOW reply:
176 ])
177
178 AT_CHECK([ovs-ofctl del-flows br0 cookie=0x3])
179 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
180  cookie=0x1, in_port=1 actions=output:0
181  cookie=0x2, in_port=2 actions=output:0
182 NXST_FLOW reply:
183 ])
184 OVS_VSWITCHD_STOP
185 AT_CLEANUP
186
187 AT_SETUP([ofproto - del flows with cookie mask])
188 OVS_VSWITCHD_START
189 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x1,in_port=1,actions=0])
190 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x2,in_port=2,actions=0])
191 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x3,in_port=3,actions=0])
192 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
193  cookie=0x1, in_port=1 actions=output:0
194  cookie=0x2, in_port=2 actions=output:0
195  cookie=0x3, in_port=3 actions=output:0
196 NXST_FLOW reply:
197 ])
198 AT_CHECK([ovs-ofctl del-flows br0 cookie=0x3/0x1])
199 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
200  cookie=0x2, in_port=2 actions=output:0
201 NXST_FLOW reply:
202 ])
203 OVS_VSWITCHD_STOP
204 AT_CLEANUP
205
206 AT_SETUP([ofproto - flow table configuration])
207 OVS_VSWITCHD_START
208 # Check the default configuration.
209 (echo "OFPST_TABLE reply (xid=0x1): 255 tables
210   0: classifier: wild=0x3fffff, max=1000000, active=0
211                lookup=0, matched=0"
212  x=1
213  while test $x -lt 255; do
214    printf "  %d: %-8s: wild=0x3fffff, max=1000000, active=0
215                lookup=0, matched=0
216 " $x table$x
217    x=`expr $x + 1`
218  done) > expout
219 AT_CHECK([ovs-ofctl dump-tables br0], [0], [expout])
220 # Change the configuration.
221 AT_CHECK(
222   [ovs-vsctl \
223      -- --id=@t0 create Flow_Table name=main \
224      -- --id=@t1 create Flow_Table flow-limit=1024 \
225      -- set bridge br0 'flow_tables={1=@t1,0=@t0}' \
226    | perl $srcdir/uuidfilt.pl],
227   [0], [<0>
228 <1>
229 ])
230 # Check that the configuration was updated.
231 mv expout orig-expout
232 (echo "OFPST_TABLE reply (xid=0x1): 255 tables
233   0: main    : wild=0x3fffff, max=1000000, active=0
234                lookup=0, matched=0
235   1: table1  : wild=0x3fffff, max=  1024, active=0
236                lookup=0, matched=0"
237  tail -n +6 orig-expout) > expout
238 AT_CHECK([ovs-ofctl dump-tables br0], [0], [expout])
239 OVS_VSWITCHD_STOP
240 AT_CLEANUP
241
242 AT_SETUP([ofproto - hard limits on flow table size])
243 OVS_VSWITCHD_START
244 # Configure a maximum of 4 flows.
245 AT_CHECK(
246   [ovs-vsctl \
247      -- --id=@t0 create Flow_Table flow-limit=4 \
248      -- set bridge br0 flow_tables:0=@t0 \
249    | perl $srcdir/uuidfilt.pl],
250   [0], [<0>
251 ])
252 # Add 4 flows.
253 for in_port in 1 2 3 4; do
254     ovs-ofctl add-flow br0 in_port=$in_port,actions=drop
255 done
256 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
257  in_port=1 actions=drop
258  in_port=2 actions=drop
259  in_port=3 actions=drop
260  in_port=4 actions=drop
261 NXST_FLOW reply:
262 ])
263 # Adding another flow will be refused.
264 AT_CHECK([ovs-ofctl add-flow br0 in_port=5,actions=drop], [1], [], [stderr])
265 AT_CHECK([head -n 1 stderr], [0],
266   [OFPT_ERROR (xid=0x1): OFPFMFC_ALL_TABLES_FULL
267 ])
268 # Also a mod-flow that would add a flow will be refused.
269 AT_CHECK([ovs-ofctl mod-flows br0 in_port=5,actions=drop], [1], [], [stderr])
270 AT_CHECK([head -n 1 stderr], [0],
271   [OFPT_ERROR (xid=0x1): OFPFMFC_ALL_TABLES_FULL
272 ])
273 # Replacing or modifying an existing flow is allowed.
274 AT_CHECK([ovs-ofctl add-flow br0 in_port=4,actions=normal])
275 AT_CHECK([ovs-ofctl mod-flows br0 in_port=3,actions=output:1])
276 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
277  in_port=1 actions=drop
278  in_port=2 actions=drop
279  in_port=3 actions=output:1
280  in_port=4 actions=NORMAL
281 NXST_FLOW reply:
282 ])
283 OVS_VSWITCHD_STOP
284 AT_CLEANUP
285
286 AT_SETUP([ofproto - eviction upon table overflow])
287 OVS_VSWITCHD_START
288 # Configure a maximum of 4 flows.
289 AT_CHECK(
290   [ovs-vsctl \
291      -- --id=@t0 create Flow_Table flow-limit=4 overflow-policy=evict \
292      -- set bridge br0 flow_tables:0=@t0 \
293    | perl $srcdir/uuidfilt.pl],
294   [0], [<0>
295 ])
296 # Add 4 flows.
297 for in_port in 4 3 2 1; do
298     ovs-ofctl add-flow br0 idle_timeout=${in_port}0,in_port=$in_port,actions=drop
299 done
300 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
301  idle_timeout=10,in_port=1 actions=drop
302  idle_timeout=20,in_port=2 actions=drop
303  idle_timeout=30,in_port=3 actions=drop
304  idle_timeout=40,in_port=4 actions=drop
305 NXST_FLOW reply:
306 ])
307 # Adding another flow will cause the one that expires soonest to be evicted.
308 AT_CHECK([ovs-ofctl add-flow br0 in_port=5,actions=drop])
309 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
310  idle_timeout=20,in_port=2 actions=drop
311  idle_timeout=30,in_port=3 actions=drop
312  idle_timeout=40,in_port=4 actions=drop
313  in_port=5 actions=drop
314 NXST_FLOW reply:
315 ])
316 # A mod-flow that adds a flow also causes eviction, but replacing or
317 # modifying an existing flow doesn't.
318 AT_CHECK([ovs-ofctl mod-flows br0 in_port=6,actions=drop])
319 AT_CHECK([ovs-ofctl add-flow br0 in_port=4,actions=normal])
320 AT_CHECK([ovs-ofctl mod-flows br0 in_port=3,actions=output:1])
321 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
322  idle_timeout=30,in_port=3 actions=output:1
323  in_port=4 actions=NORMAL
324  in_port=5 actions=drop
325  in_port=6 actions=drop
326 NXST_FLOW reply:
327 ])
328 # Flows with no timeouts at all cannot be evicted.
329 AT_CHECK([ovs-ofctl add-flow br0 in_port=7,actions=normal])
330 AT_CHECK([ovs-ofctl add-flow br0 in_port=8,actions=drop], [1], [], [stderr])
331 AT_CHECK([head -n 1 stderr], [0],
332   [OFPT_ERROR (xid=0x1): OFPFMFC_ALL_TABLES_FULL
333 ])
334 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
335  in_port=4 actions=NORMAL
336  in_port=5 actions=drop
337  in_port=6 actions=drop
338  in_port=7 actions=NORMAL
339 NXST_FLOW reply:
340 ])
341 OVS_VSWITCHD_STOP
342 AT_CLEANUP
343
344 AT_SETUP([ofproto - eviction upon table overflow, with fairness])
345 OVS_VSWITCHD_START
346 # Configure a maximum of 4 flows.
347 AT_CHECK(
348   [ovs-vsctl \
349      -- --id=@t0 create Flow_Table name=evict flow-limit=4 \
350                                    overflow-policy=evict \
351                                    groups='"NXM_OF_IN_PORT[[]]"' \
352      -- set bridge br0 flow_tables:0=@t0 \
353    | perl $srcdir/uuidfilt.pl],
354   [0], [<0>
355 ])
356 # Add 4 flows.
357 ovs-ofctl add-flows br0 - <<EOF
358 idle_timeout=10 in_port=2 dl_src=00:44:55:66:77:88 actions=drop
359 idle_timeout=20 in_port=1 dl_src=00:11:22:33:44:55 actions=drop
360 idle_timeout=30 in_port=1 dl_src=00:22:33:44:55:66 actions=drop
361 idle_timeout=40 in_port=1 dl_src=00:33:44:55:66:77 actions=drop
362 EOF
363 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
364  idle_timeout=10,in_port=2,dl_src=00:44:55:66:77:88 actions=drop
365  idle_timeout=20,in_port=1,dl_src=00:11:22:33:44:55 actions=drop
366  idle_timeout=30,in_port=1,dl_src=00:22:33:44:55:66 actions=drop
367  idle_timeout=40,in_port=1,dl_src=00:33:44:55:66:77 actions=drop
368 NXST_FLOW reply:
369 ])
370 # Adding another flow will cause the one that expires soonest within
371 # the largest group (those with in_port=1) to be evicted.  In this
372 # case this is not the same as the one that expires soonest overall
373 # (which is what makes the test interesting):
374 AT_CHECK([ovs-ofctl add-flow br0 in_port=2,dl_src=00:55:66:77:88:99,actions=drop])
375 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
376  idle_timeout=10,in_port=2,dl_src=00:44:55:66:77:88 actions=drop
377  idle_timeout=30,in_port=1,dl_src=00:22:33:44:55:66 actions=drop
378  idle_timeout=40,in_port=1,dl_src=00:33:44:55:66:77 actions=drop
379  in_port=2,dl_src=00:55:66:77:88:99 actions=drop
380 NXST_FLOW reply:
381 ])
382 # Enlarge the flow limit, change the eviction policy back to strictly
383 # based on expiration, and and add some flows.
384 AT_CHECK([ovs-vsctl set Flow_Table evict groups='[[]]' flow-limit=7])
385 ovs-ofctl add-flows br0 - <<EOF
386 idle_timeout=50 in_port=2 dl_src=00:66:77:88:99:aa actions=drop
387 idle_timeout=60 in_port=2 dl_src=00:77:88:99:aa:bb actions=drop
388 idle_timeout=70 in_port=2 dl_src=00:88:99:aa:bb:cc actions=drop
389 EOF
390 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
391  idle_timeout=10,in_port=2,dl_src=00:44:55:66:77:88 actions=drop
392  idle_timeout=30,in_port=1,dl_src=00:22:33:44:55:66 actions=drop
393  idle_timeout=40,in_port=1,dl_src=00:33:44:55:66:77 actions=drop
394  idle_timeout=50,in_port=2,dl_src=00:66:77:88:99:aa actions=drop
395  idle_timeout=60,in_port=2,dl_src=00:77:88:99:aa:bb actions=drop
396  idle_timeout=70,in_port=2,dl_src=00:88:99:aa:bb:cc actions=drop
397  in_port=2,dl_src=00:55:66:77:88:99 actions=drop
398 NXST_FLOW reply:
399 ])
400 # Adding another flow will cause the one that expires soonest overall
401 # to be evicted.
402 AT_CHECK([ovs-ofctl add-flow br0 'idle_timeout=80 in_port=2 dl_src=00:99:aa:bb:cc:dd actions=drop'])
403 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
404  idle_timeout=30,in_port=1,dl_src=00:22:33:44:55:66 actions=drop
405  idle_timeout=40,in_port=1,dl_src=00:33:44:55:66:77 actions=drop
406  idle_timeout=50,in_port=2,dl_src=00:66:77:88:99:aa actions=drop
407  idle_timeout=60,in_port=2,dl_src=00:77:88:99:aa:bb actions=drop
408  idle_timeout=70,in_port=2,dl_src=00:88:99:aa:bb:cc actions=drop
409  idle_timeout=80,in_port=2,dl_src=00:99:aa:bb:cc:dd actions=drop
410  in_port=2,dl_src=00:55:66:77:88:99 actions=drop
411 NXST_FLOW reply:
412 ])
413 # Reducing the flow limit also causes the flows that expire soonest
414 # overall to be evicted.
415 AT_CHECK([ovs-vsctl set Flow_Table evict flow-limit=4])
416 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
417  idle_timeout=60,in_port=2,dl_src=00:77:88:99:aa:bb actions=drop
418  idle_timeout=70,in_port=2,dl_src=00:88:99:aa:bb:cc actions=drop
419  idle_timeout=80,in_port=2,dl_src=00:99:aa:bb:cc:dd actions=drop
420  in_port=2,dl_src=00:55:66:77:88:99 actions=drop
421 NXST_FLOW reply:
422 ])
423 OVS_VSWITCHD_STOP
424 AT_CLEANUP
425
426 AT_SETUP([ofproto - asynchronous message control])
427 OVS_VSWITCHD_START
428 AT_CHECK([ovs-ofctl -P openflow10 monitor br0 --detach --no-chdir --pidfile])
429 check_async () {
430     printf '\n\n--- check_async %d ---\n\n\n' $1
431     shift
432
433     ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
434     : > expout
435
436     # OFPT_PACKET_IN, OFPR_ACTION
437     ovs-ofctl -v packet-out br0 none controller '0001020304050010203040501234'
438     if test X"$1" = X"OFPR_ACTION"; then shift;
439         echo >>expout "OFPT_PACKET_IN: total_len=14 in_port=NONE (via action) data_len=14 (unbuffered)
440 priority:0,tunnel:0,in_port:0000,tci(0) mac(00:10:20:30:40:50->00:01:02:03:04:05) type:1234 proto:0 tos:0 ttl:0 ip(0.0.0.0->0.0.0.0)"
441     fi
442
443     # OFPT_PACKET_IN, OFPR_INVALID_TTL
444     ovs-ofctl packet-out br0 none dec_ttl '002583dfb4000026b98cb0f908004500003fb7e200000011339bac11370dac100002d7730035002b8f6d86fb0100000100000000000006626c702d7873066e696369726103636f6d00000f00'
445     if test X"$1" = X"OFPR_INVALID_TTL"; then shift;
446         echo >>expout "OFPT_PACKET_IN: total_len=76 in_port=NONE (via invalid_ttl) data_len=76 (unbuffered)
447 priority:0,tunnel:0,in_port:0000,tci(0) mac(00:26:b9:8c:b0:f9->00:25:83:df:b4:00) type:0800 proto:17 tos:0 ttl:0 ip(172.17.55.13->172.16.0.2) port(55155->53) udp_csum:8f6d"
448     fi
449
450     # OFPT_PORT_STATUS, OFPPR_ADD
451     ovs-vsctl add-port br0 test -- set Interface test type=dummy
452     if test X"$1" = X"OFPPR_ADD"; then shift;
453         echo >>expout "OFPT_PORT_STATUS: ADD: 1(test): addr:aa:55:aa:55:00:0x
454      config:     PORT_DOWN
455      state:      LINK_DOWN"
456     fi
457
458     # OFPT_PORT_STATUS, OFPPR_DELETE
459     ovs-vsctl del-port br0 test
460     if test X"$1" = X"OFPPR_DELETE"; then shift;
461         echo >>expout "OFPT_PORT_STATUS: DEL: 1(test): addr:aa:55:aa:55:00:0x
462      config:     PORT_DOWN
463      state:      LINK_DOWN"
464     fi
465
466     # OFPT_FLOW_REMOVED, OFPRR_DELETE
467     ovs-ofctl add-flow br0 send_flow_rem,actions=drop
468     ovs-ofctl --strict del-flows br0 ''
469     if test X"$1" = X"OFPRR_DELETE"; then shift;
470         echo >>expout "OFPT_FLOW_REMOVED:  reason=delete"
471     fi
472     AT_FAIL_IF([test X"$1" != X])
473
474     ovs-appctl -t ovs-ofctl ofctl/barrier
475     echo >>expout "send: OFPT_BARRIER_REQUEST:
476 OFPT_BARRIER_REPLY:"
477
478     AT_CHECK(
479       [[sed '
480 s/ (xid=0x[0-9a-fA-F]*)//
481 s/ *duration.*//
482 s/00:0.$/00:0x/' < monitor.log]],
483       [0], [expout])
484 }
485
486 # It's a service connection so initially there should be no async messages.
487 check_async 1
488
489 # Set miss_send_len to 128, turning on packet-outs for our service connection.
490 ovs-appctl -t ovs-ofctl ofctl/send 0109000c0123456700000080
491 check_async 2 OFPR_ACTION OFPPR_ADD OFPPR_DELETE OFPRR_DELETE
492
493 # Set miss_send_len to 128 and enable invalid_ttl.
494 ovs-appctl -t ovs-ofctl ofctl/send 0109000c0123456700040080
495 check_async 3 OFPR_ACTION OFPR_INVALID_TTL OFPPR_ADD OFPPR_DELETE OFPRR_DELETE
496
497 # Become slave, which should disable everything except port status.
498 ovs-appctl -t ovs-ofctl ofctl/send 0104001400000002000023200000000a00000002
499 check_async 4 OFPPR_ADD OFPPR_DELETE
500
501 # Use NXT_SET_ASYNC_CONFIG to enable a patchwork of asynchronous messages.
502 ovs-appctl -t ovs-ofctl ofctl/send 01040028000000020000232000000013000000020000000500000005000000020000000200000005
503 check_async 5 OFPR_INVALID_TTL OFPPR_DELETE OFPRR_DELETE
504
505 # Become master.
506 ovs-appctl -t ovs-ofctl ofctl/send 0104001400000002000023200000000a00000001
507 check_async 6 OFPR_ACTION OFPPR_ADD
508
509 ovs-appctl -t ovs-ofctl exit
510 AT_CLEANUP