ofp-util: Enforce OpenFlow 1.1+ table_id requirements in flow_mod messages.
[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 -vwarn 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 -vwarn show br0], [0], [stdout])
12 AT_CHECK([STRIP_XIDS stdout], [0], [dnl
13 OFPT_FEATURES_REPLY: dpid:fedcba9876543210
14 n_tables:254, n_buffers:256
15 capabilities: FLOW_STATS TABLE_STATS PORT_STATS QUEUE_STATS ARP_MATCH_IP
16 actions: OUTPUT SET_VLAN_VID SET_VLAN_PCP STRIP_VLAN SET_DL_SRC SET_DL_DST SET_NW_SRC SET_NW_DST SET_NW_TOS SET_TP_SRC SET_TP_DST ENQUEUE
17  LOCAL(br0): addr:aa:55:aa:55:00:00
18      config:     0
19      state:      0
20      speed: 0 Mbps now, 0 Mbps max
21 OFPT_GET_CONFIG_REPLY: frags=normal miss_send_len=0
22 ])
23 OVS_VSWITCHD_STOP
24 AT_CLEANUP
25
26 AT_SETUP([ofproto - set OpenFlow port number])
27 OVS_VSWITCHD_START(
28        [add-port br0 p1 -- set Interface p1 type=dummy --\
29         add-port br0 p2 -- set Interface p2 type=dummy ofport_request=99])
30 AT_CHECK([ovs-ofctl -vwarn show br0], [0], [stdout])
31 AT_CHECK([[sed '
32 s/ (xid=0x[0-9a-fA-F]*)//
33 s/00:0.$/00:0x/' < stdout]],
34       [0], [dnl
35 OFPT_FEATURES_REPLY: dpid:fedcba9876543210
36 n_tables:254, n_buffers:256
37 capabilities: FLOW_STATS TABLE_STATS PORT_STATS QUEUE_STATS ARP_MATCH_IP
38 actions: OUTPUT SET_VLAN_VID SET_VLAN_PCP STRIP_VLAN SET_DL_SRC SET_DL_DST SET_NW_SRC SET_NW_DST SET_NW_TOS SET_TP_SRC SET_TP_DST ENQUEUE
39  1(p1): addr:aa:55:aa:55:00:0x
40      config:     PORT_DOWN
41      state:      LINK_DOWN
42      speed: 0 Mbps now, 0 Mbps max
43  99(p2): addr:aa:55:aa:55:00:0x
44      config:     PORT_DOWN
45      state:      LINK_DOWN
46      speed: 0 Mbps now, 0 Mbps max
47  LOCAL(br0): addr:aa:55:aa:55:00:0x
48      config:     0
49      state:      0
50      speed: 0 Mbps now, 0 Mbps max
51 OFPT_GET_CONFIG_REPLY: frags=normal miss_send_len=0
52 ])
53
54 OVS_VSWITCHD_STOP
55 AT_CLEANUP
56
57 dnl This is really bare-bones.
58 dnl It at least checks request and reply serialization and deserialization.
59 AT_SETUP([ofproto - port stats - (OpenFlow 1.0)])
60 OVS_VSWITCHD_START
61 AT_CHECK([ovs-ofctl -vwarn dump-ports br0], [0], [stdout])
62 AT_CHECK([STRIP_XIDS stdout], [0], [dnl
63 OFPST_PORT reply: 1 ports
64   port LOCAL: rx pkts=0, bytes=0, drop=0, errs=0, frame=0, over=0, crc=0
65            tx pkts=0, bytes=0, drop=0, errs=0, coll=0
66 ])
67 OVS_VSWITCHD_STOP
68 AT_CLEANUP
69
70 AT_SETUP([ofproto - port stats - (OpenFlow 1.2)])
71 OVS_VSWITCHD_START
72 AT_CHECK([ovs-ofctl -O OpenFlow12 -vwarn dump-ports br0], [0], [stdout])
73 AT_CHECK([STRIP_XIDS stdout], [0], [dnl
74 OFPST_PORT reply (OF1.2): 1 ports
75   port LOCAL: rx pkts=0, bytes=0, drop=0, errs=0, frame=0, over=0, crc=0
76            tx pkts=0, bytes=0, drop=0, errs=0, coll=0
77 ])
78 OVS_VSWITCHD_STOP
79 AT_CLEANUP
80
81 dnl This is really bare-bones.
82 dnl It at least checks request and reply serialization and deserialization.
83 AT_SETUP([ofproto - port-desc stats (OpenFlow 1.0)])
84 OVS_VSWITCHD_START
85 AT_CHECK([ovs-ofctl -vwarn dump-ports-desc br0], [0], [stdout])
86 AT_CHECK([STRIP_XIDS stdout], [0], [dnl
87 OFPST_PORT_DESC reply:
88  LOCAL(br0): addr:aa:55:aa:55:00:00
89      config:     0
90      state:      0
91      speed: 0 Mbps now, 0 Mbps max
92 ])
93 OVS_VSWITCHD_STOP
94 AT_CLEANUP
95
96 dnl This is really bare-bones.
97 dnl It at least checks request and reply serialization and deserialization.
98 AT_SETUP([ofproto - port-desc stats (OpenFlow 1.2)])
99 OVS_VSWITCHD_START
100 AT_CHECK([ovs-ofctl -O OpenFlow12 -vwarn dump-ports-desc br0], [0], [stdout])
101 AT_CHECK([STRIP_XIDS stdout], [0], [dnl
102 OFPST_PORT_DESC reply (OF1.2):
103  LOCAL(br0): addr:aa:55:aa:55:00:00
104      config:     0
105      state:      0
106      speed: 0 Mbps now, 0 Mbps max
107 ])
108 OVS_VSWITCHD_STOP
109 AT_CLEANUP
110
111 dnl This is really bare-bones.
112 dnl It at least checks request and reply serialization and deserialization.
113 AT_SETUP([ofproto - queue stats - (OpenFlow 1.0)])
114 OVS_VSWITCHD_START
115 AT_CHECK([ovs-ofctl -vwarn queue-stats br0], [0], [stdout])
116 AT_CHECK([STRIP_XIDS stdout], [0], [dnl
117 OFPST_QUEUE reply: 0 queues
118 ])
119 AT_CHECK([ovs-ofctl -vwarn queue-stats br0 ANY 5], [0],
120   [OFPT_ERROR (xid=0x2): OFPQOFC_BAD_QUEUE
121 OFPST_QUEUE request (xid=0x2):port=ANY queue=5
122 ])
123 AT_CHECK([ovs-ofctl -vwarn queue-stats br0 10], [0],
124   [OFPT_ERROR (xid=0x2): OFPQOFC_BAD_PORT
125 OFPST_QUEUE request (xid=0x2):port=10 queue=ALL
126 ])
127 OVS_VSWITCHD_STOP
128 AT_CLEANUP
129
130 AT_SETUP([ofproto - queue stats - (OpenFlow 1.2)])
131 OVS_VSWITCHD_START
132 AT_CHECK([ovs-ofctl -O OpenFlow12 -vwarn queue-stats br0], [0], [stdout])
133 AT_CHECK([STRIP_XIDS stdout], [0], [dnl
134 OFPST_QUEUE reply (OF1.2): 0 queues
135 ])
136 AT_CHECK([ovs-ofctl -O OpenFlow12 -vwarn queue-stats br0 ALL 5], [0],
137   [OFPT_ERROR (OF1.2) (xid=0x2): OFPQOFC_BAD_QUEUE
138 OFPST_QUEUE request (OF1.2) (xid=0x2):port=ANY queue=5
139 ])
140 AT_CHECK([ovs-ofctl -O OpenFlow12 -vwarn queue-stats br0 10], [0],
141   [OFPT_ERROR (OF1.2) (xid=0x2): OFPQOFC_BAD_PORT
142 OFPST_QUEUE request (OF1.2) (xid=0x2):port=10 queue=ALL
143 ])
144 OVS_VSWITCHD_STOP
145 AT_CLEANUP
146
147 dnl This is really bare-bones.
148 dnl It at least checks request and reply serialization and deserialization.
149 AT_SETUP([ofproto - queue configuration - (OpenFlow 1.0)])
150 OVS_VSWITCHD_START
151 ADD_OF_PORTS([br0], [1], [2])
152 AT_CHECK([ovs-ofctl queue-get-config br0 1], [0], [stdout])
153 AT_CHECK([STRIP_XIDS stdout], [0], [dnl
154 OFPT_QUEUE_GET_CONFIG_REPLY: port=1
155 ])
156 AT_CHECK([ovs-ofctl queue-get-config br0 10], [0],
157   [OFPT_ERROR (xid=0x2): OFPQOFC_BAD_PORT
158 OFPT_QUEUE_GET_CONFIG_REQUEST (xid=0x2): port=10
159 ])
160 OVS_VSWITCHD_STOP
161 AT_CLEANUP
162
163 AT_SETUP([ofproto - queue configuration - (OpenFlow 1.2)])
164 OVS_VSWITCHD_START
165 ADD_OF_PORTS([br0], [1], [2])
166 AT_CHECK([ovs-ofctl -O OpenFlow12 queue-get-config br0 1], [0], [stdout])
167 AT_CHECK([STRIP_XIDS stdout], [0], [dnl
168 OFPT_QUEUE_GET_CONFIG_REPLY (OF1.2): port=1
169 ])
170 AT_CHECK([ovs-ofctl -O OpenFlow12 queue-get-config br0 10], [0],
171   [OFPT_ERROR (OF1.2) (xid=0x2): OFPQOFC_BAD_PORT
172 OFPT_QUEUE_GET_CONFIG_REQUEST (OF1.2) (xid=0x2): port=10
173 ])
174 OVS_VSWITCHD_STOP
175 AT_CLEANUP
176
177 dnl This is really bare-bones.
178 dnl It at least checks request and reply serialization and deserialization.
179 AT_SETUP([ofproto - group features])
180 OVS_VSWITCHD_START
181 AT_CHECK([ovs-ofctl -O OpenFlow12 -vwarn dump-group-features br0], [0], [stdout])
182 AT_CHECK([STRIP_XIDS stdout], [0], [dnl
183 OFPST_GROUP_FEATURES reply (OF1.2):
184  Group table:
185     Types:  0x0
186     Capabilities:  0x0
187 ])
188 OVS_VSWITCHD_STOP
189 AT_CLEANUP
190
191 AT_SETUP([ofproto - mod-port (OpenFlow 1.0)])
192 OVS_VSWITCHD_START
193 for command_config_state in \
194     'up 0 0' \
195     'noflood NO_FLOOD 0' \
196     'down PORT_DOWN,NO_FLOOD LINK_DOWN' \
197     'flood PORT_DOWN LINK_DOWN' \
198     'no-receive PORT_DOWN,NO_RECV LINK_DOWN' \
199     'no-forward PORT_DOWN,NO_RECV,NO_FWD LINK_DOWN' \
200     'no-packet-in PORT_DOWN,NO_RECV,NO_FWD,NO_PACKET_IN LINK_DOWN' \
201     'forward PORT_DOWN,NO_RECV,NO_PACKET_IN LINK_DOWN' \
202     'packet-in PORT_DOWN,NO_RECV LINK_DOWN' \
203     'up NO_RECV 0' \
204     'receive 0 0'
205 do
206     set $command_config_state
207     command=$[1] config=`echo $[2] | sed 's/,/ /g'` state=$[3]
208     AT_CHECK([ovs-ofctl -vwarn mod-port br0 br0 $command])
209     AT_CHECK([ovs-ofctl -vwarn show br0], [0], [stdout])
210     AT_CHECK_UNQUOTED([STRIP_XIDS stdout], [0], [dnl
211 OFPT_FEATURES_REPLY: dpid:fedcba9876543210
212 n_tables:254, n_buffers:256
213 capabilities: FLOW_STATS TABLE_STATS PORT_STATS QUEUE_STATS ARP_MATCH_IP
214 actions: OUTPUT SET_VLAN_VID SET_VLAN_PCP STRIP_VLAN SET_DL_SRC SET_DL_DST SET_NW_SRC SET_NW_DST SET_NW_TOS SET_TP_SRC SET_TP_DST ENQUEUE
215  LOCAL(br0): addr:aa:55:aa:55:00:00
216      config:     $config
217      state:      $state
218      speed: 0 Mbps now, 0 Mbps max
219 OFPT_GET_CONFIG_REPLY: frags=normal miss_send_len=0
220 ])
221 done
222 OVS_VSWITCHD_STOP
223 AT_CLEANUP
224
225 AT_SETUP([ofproto - mod-port (OpenFlow 1.2)])
226 OVS_VSWITCHD_START
227 for command_config_state in \
228     'up 0 0' \
229     'down PORT_DOWN LINK_DOWN' \
230     'no-receive PORT_DOWN,NO_RECV LINK_DOWN' \
231     'no-forward PORT_DOWN,NO_RECV,NO_FWD LINK_DOWN' \
232     'no-packet-in PORT_DOWN,NO_RECV,NO_FWD,NO_PACKET_IN LINK_DOWN' \
233     'forward PORT_DOWN,NO_RECV,NO_PACKET_IN LINK_DOWN' \
234     'packet-in PORT_DOWN,NO_RECV LINK_DOWN' \
235     'up NO_RECV 0' \
236     'receive 0 0'
237 do
238     set $command_config_state
239     command=$[1] config=`echo $[2] | sed 's/,/ /g'` state=$[3]
240     AT_CHECK([ovs-ofctl -O OpenFlow12 -vwarn mod-port br0 br0 $command])
241     AT_CHECK([ovs-ofctl -O OpenFlow12 -vwarn show br0], [0], [stdout])
242     AT_CHECK_UNQUOTED([STRIP_XIDS stdout], [0], [dnl
243 OFPT_FEATURES_REPLY (OF1.2): dpid:fedcba9876543210
244 n_tables:254, n_buffers:256
245 capabilities: FLOW_STATS TABLE_STATS PORT_STATS QUEUE_STATS
246  LOCAL(br0): addr:aa:55:aa:55:00:00
247      config:     $config
248      state:      $state
249      speed: 0 Mbps now, 0 Mbps max
250 OFPT_GET_CONFIG_REPLY (OF1.2): frags=normal miss_send_len=0
251 ])
252 done
253 OVS_VSWITCHD_STOP
254 AT_CLEANUP
255
256 AT_SETUP([ofproto - basic flow_mod commands (NXM)])
257 OVS_VSWITCHD_START
258 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip], [0], [NXST_FLOW reply:
259 ])
260 AT_CHECK([echo 'in_port=2,actions=1' | ovs-ofctl add-flows br0 -])
261 AT_CHECK([ovs-ofctl add-flow br0 in_port=1,actions=2])
262 AT_CHECK([ovs-ofctl -F nxm add-flow br0 table=1,in_port=4,actions=3])
263 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
264  in_port=1 actions=output:2
265  in_port=2 actions=output:1
266  table=1, in_port=4 actions=output:3
267 NXST_FLOW reply:
268 ])
269 AT_CHECK([ovs-ofctl dump-aggregate br0 table=0 | STRIP_XIDS], [0], [dnl
270 NXST_AGGREGATE reply: packet_count=0 byte_count=0 flow_count=2
271 ])
272 AT_CHECK([ovs-ofctl del-flows br0])
273 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip], [0], [NXST_FLOW reply:
274 ])
275 OVS_VSWITCHD_STOP
276 AT_CLEANUP
277
278 AT_SETUP([ofproto - basic flow_mod commands (OpenFlow 1.0)])
279 OVS_VSWITCHD_START
280 AT_CHECK([ovs-ofctl -F openflow10 dump-flows br0 | ofctl_strip], [0], [OFPST_FLOW reply:
281 ])
282 AT_CHECK([echo 'in_port=2,actions=1' | ovs-ofctl -F openflow10 add-flows br0 -])
283 AT_CHECK([ovs-ofctl -F openflow10 add-flow br0 in_port=1,actions=2])
284 AT_CHECK([ovs-ofctl -F openflow10 add-flow br0 table=1,in_port=4,actions=3])
285 AT_CHECK([ovs-ofctl -F openflow10 dump-flows br0 | ofctl_strip | sort], [0], [dnl
286  in_port=1 actions=output:2
287  in_port=2 actions=output:1
288  table=1, in_port=4 actions=output:3
289 OFPST_FLOW reply:
290 ])
291 AT_CHECK([ovs-ofctl -F openflow10 dump-aggregate br0 table=0 | STRIP_XIDS], [0], [dnl
292 OFPST_AGGREGATE reply: packet_count=0 byte_count=0 flow_count=2
293 ])
294 AT_CHECK([ovs-ofctl -F openflow10 del-flows br0])
295 AT_CHECK([ovs-ofctl -F openflow10 dump-flows br0 | ofctl_strip], [0], [OFPST_FLOW reply:
296 ])
297 OVS_VSWITCHD_STOP
298 AT_CLEANUP
299
300 AT_SETUP([ofproto - basic flow_mod commands (OpenFlow 1.1)])
301 OVS_VSWITCHD_START
302 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip], [0], [OFPST_FLOW reply (OF1.1):
303 ])
304 AT_CHECK([echo 'in_port=2,actions=1' | ovs-ofctl -O OpenFlow11 add-flows br0 -])
305 AT_CHECK([ovs-ofctl -O OpenFlow11 add-flow br0 in_port=1,actions=2])
306 AT_CHECK([ovs-ofctl -O OpenFlow11 add-flow br0 table=1,in_port=4,actions=3])
307 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0], [dnl
308  in_port=1 actions=output:2
309  in_port=2 actions=output:1
310  table=1, in_port=4 actions=output:3
311 OFPST_FLOW reply (OF1.1):
312 ])
313 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-aggregate br0 table=0 | STRIP_XIDS], [0], [dnl
314 OFPST_AGGREGATE reply (OF1.1): packet_count=0 byte_count=0 flow_count=2
315 ])
316 AT_CHECK([ovs-ofctl -O OpenFlow11 del-flows br0])
317 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip], [0], [OFPST_FLOW reply (OF1.1):
318  table=1, in_port=4 actions=output:3
319 ])
320 OVS_VSWITCHD_STOP
321 AT_CLEANUP
322
323 AT_SETUP([ofproto - flow_mod negative test (OpenFlow 1.1)])
324 OVS_VSWITCHD_START(
325   [set bridge br0 protocols=OpenFlow10,OpenFlow11,OpenFlow12,OpenFlow13])
326 AT_CHECK([ovs-ofctl add-flow -O OpenFlow11 br0 table=1,action=goto_table:2])
327
328 # The error message here actually comes from ovs-ofctl, not from ovs-vswitchd,
329 # but at least it's the same code in ofpacts_check() that issues the error.
330 AT_CHECK([ovs-ofctl add-flow -O OpenFlow11 br0 table=1,action=goto_table:1],
331   [1], [],
332   [ovs-ofctl: actions are invalid with specified match (OFPBRC_BAD_TABLE_ID)
333 ])
334 OVS_VSWITCHD_STOP
335 AT_CLEANUP
336
337 AT_SETUP([ofproto - set-field flow_mod commands (NXM)])
338 OVS_VSWITCHD_START
339 AT_CHECK([ovs-ofctl add-flow br0 ipv6,table=1,in_port=3,actions=drop])
340 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])
341 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
342  table=1, ipv6,in_port=3 actions=load:0xa6badbfffefe59fa->NXM_NX_IPV6_SRC[[0..63]],load:0xfe8001234567890a->NXM_NX_IPV6_SRC[[64..127]]
343 NXST_FLOW reply:
344 ])
345 OVS_VSWITCHD_STOP
346 AT_CLEANUP
347
348 AT_SETUP([ofproto - basic flow_mod commands (OpenFlow 1.2)])
349 OVS_VSWITCHD_START
350 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip], [0], [OFPST_FLOW reply (OF1.2):
351 ])
352 AT_CHECK([echo 'in_port=2,actions=1' | ovs-ofctl -O OpenFlow12 add-flows br0 -])
353 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 in_port=1,actions=2])
354 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 table=1,in_port=4,actions=3])
355 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
356  in_port=1 actions=output:2
357  in_port=2 actions=output:1
358  table=1, in_port=4 actions=output:3
359 OFPST_FLOW reply (OF1.2):
360 ])
361 AT_CHECK([ovs-ofctl -O OpenFlow12 del-flows br0])
362 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip], [0], [OFPST_FLOW reply (OF1.2):
363 ])
364 OVS_VSWITCHD_STOP
365 AT_CLEANUP
366
367 AT_SETUP([ofproto - dump flows with cookie])
368 OVS_VSWITCHD_START
369 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x1,in_port=1,actions=1])
370 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x2,in_port=2,actions=1])
371 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x3,in_port=3,actions=1])
372 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
373  cookie=0x1, in_port=1 actions=output:1
374  cookie=0x2, in_port=2 actions=output:1
375  cookie=0x3, in_port=3 actions=output:1
376 NXST_FLOW reply:
377 ])
378 AT_CHECK([ovs-ofctl dump-aggregate br0 table=0 | STRIP_XIDS], [0], [dnl
379 NXST_AGGREGATE reply: packet_count=0 byte_count=0 flow_count=3
380 ])
381 AT_CHECK([ovs-ofctl dump-flows br0 cookie=0x3/-1 | ofctl_strip | sort], [0], [dnl
382  cookie=0x3, in_port=3 actions=output:1
383 NXST_FLOW reply:
384 ])
385 AT_CHECK([ovs-ofctl dump-aggregate br0 cookie=0x3/-1 | STRIP_XIDS], [0], [dnl
386 NXST_AGGREGATE reply: packet_count=0 byte_count=0 flow_count=1
387 ])
388 OVS_VSWITCHD_STOP
389 AT_CLEANUP
390
391 AT_SETUP([ofproto - mod flow with cookie change (OpenFlow 1.0)])
392 OVS_VSWITCHD_START
393 AT_CHECK([ovs-ofctl -F openflow10 add-flow br0 cookie=0x1,in_port=1,actions=1])
394 AT_CHECK([ovs-ofctl -F openflow10 dump-flows br0 | ofctl_strip | sort], [0], [dnl
395  cookie=0x1, in_port=1 actions=output:1
396 OFPST_FLOW reply:
397 ])
398
399 AT_CHECK([ovs-ofctl -F openflow10 mod-flows br0 cookie=0x2,in_port=1,actions=1])
400 AT_CHECK([ovs-ofctl -F openflow10 dump-flows br0 | ofctl_strip | sort], [0], [dnl
401  cookie=0x2, in_port=1 actions=output:1
402 OFPST_FLOW reply:
403 ])
404 OVS_VSWITCHD_STOP
405 AT_CLEANUP
406
407 AT_SETUP([ofproto - mod flow with cookie change (NXM)])
408 OVS_VSWITCHD_START
409 AT_CHECK([ovs-ofctl -F nxm add-flow br0 cookie=0x1,in_port=1,actions=1])
410 AT_CHECK([ovs-ofctl -F nxm dump-flows br0 | ofctl_strip | sort], [0], [dnl
411  cookie=0x1, in_port=1 actions=output:1
412 NXST_FLOW reply:
413 ])
414
415 AT_CHECK([ovs-ofctl -F nxm mod-flows br0 cookie=0x2,in_port=1,actions=1])
416 AT_CHECK([ovs-ofctl -F nxm dump-flows br0 | ofctl_strip | sort], [0], [dnl
417  cookie=0x2, in_port=1 actions=output:1
418 NXST_FLOW reply:
419 ])
420 OVS_VSWITCHD_STOP
421 AT_CLEANUP
422
423 AT_SETUP([ofproto - no mod flow with cookie change (OpenFlow 1.1)])
424 OVS_VSWITCHD_START
425 AT_CHECK([ovs-ofctl -O OpenFlow11 add-flow br0 cookie=0x1,in_port=1,actions=1])
426 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0], [dnl
427  cookie=0x1, in_port=1 actions=output:1
428 OFPST_FLOW reply (OF1.1):
429 ])
430 AT_CHECK([ovs-ofctl -O OpenFlow11 mod-flows br0 cookie=0x2,in_port=1,actions=1])
431 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0], [dnl
432  cookie=0x1, in_port=1 actions=output:1
433 OFPST_FLOW reply (OF1.1):
434 ])
435 OVS_VSWITCHD_STOP
436 AT_CLEANUP
437
438 dnl The OpenFlow 1.2 spec states that the cookie may not be modified
439 AT_SETUP([ofproto - no mod flow with cookie change (OpenFlow 1.2)])
440 OVS_VSWITCHD_START
441 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 cookie=0x1,in_port=1,actions=1])
442 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
443  cookie=0x1, in_port=1 actions=output:1
444 OFPST_FLOW reply (OF1.2):
445 ])
446
447 AT_CHECK([ovs-ofctl -O OpenFlow12 mod-flows br0 cookie=0x2,in_port=1,actions=1])
448 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
449  cookie=0x1, in_port=1 actions=output:1
450 OFPST_FLOW reply (OF1.2):
451 ])
452 OVS_VSWITCHD_STOP
453 AT_CLEANUP
454
455 AT_SETUP([ofproto - mod flows based on cookie mask (OpenFlow 1.0)])
456 OVS_VSWITCHD_START
457 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x1,in_port=1,actions=1])
458 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x1,in_port=2,actions=1])
459 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x2,in_port=3,actions=1])
460 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
461  cookie=0x1, in_port=1 actions=output:1
462  cookie=0x1, in_port=2 actions=output:1
463  cookie=0x2, in_port=3 actions=output:1
464 NXST_FLOW reply:
465 ])
466
467 AT_CHECK([ovs-ofctl -F nxm mod-flows br0 cookie=0x1/0xff,actions=4])
468 AT_CHECK([ovs-ofctl -F nxm dump-flows br0 | ofctl_strip | sort], [0], [dnl
469  cookie=0x1, in_port=1 actions=output:4
470  cookie=0x1, in_port=2 actions=output:4
471  cookie=0x2, in_port=3 actions=output:1
472 NXST_FLOW reply:
473 ])
474 OVS_VSWITCHD_STOP
475 AT_CLEANUP
476
477 AT_SETUP([ofproto - mod flows based on cookie mask (OpenFlow 1.1)])
478 OVS_VSWITCHD_START
479 AT_CHECK([ovs-ofctl -O OpenFlow11 add-flow br0 cookie=0x1,in_port=1,actions=1])
480 AT_CHECK([ovs-ofctl -O OpenFlow11 add-flow br0 cookie=0x1,in_port=2,actions=1])
481 AT_CHECK([ovs-ofctl -O OpenFlow11 add-flow br0 cookie=0x2,in_port=3,actions=1])
482 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0], [dnl
483  cookie=0x1, in_port=1 actions=output:1
484  cookie=0x1, in_port=2 actions=output:1
485  cookie=0x2, in_port=3 actions=output:1
486 OFPST_FLOW reply (OF1.1):
487 ])
488
489 AT_CHECK([ovs-ofctl -O OpenFlow11 mod-flows br0 cookie=0x1/0xff,actions=4])
490 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0], [dnl
491  cookie=0x1, in_port=1 actions=output:4
492  cookie=0x1, in_port=2 actions=output:4
493  cookie=0x2, in_port=3 actions=output:1
494 OFPST_FLOW reply (OF1.1):
495 ])
496 OVS_VSWITCHD_STOP
497 AT_CLEANUP
498
499 AT_SETUP([ofproto - mod flows based on cookie mask (OpenFlow 1.2)])
500 OVS_VSWITCHD_START
501 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 cookie=0x1,in_port=1,actions=1])
502 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 cookie=0x1,in_port=2,actions=1])
503 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 cookie=0x2,in_port=3,actions=1])
504 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
505  cookie=0x1, in_port=1 actions=output:1
506  cookie=0x1, in_port=2 actions=output:1
507  cookie=0x2, in_port=3 actions=output:1
508 OFPST_FLOW reply (OF1.2):
509 ])
510
511 AT_CHECK([ovs-ofctl -O OpenFlow12 mod-flows br0 cookie=0x1/0xff,actions=4])
512 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
513  cookie=0x1, in_port=1 actions=output:4
514  cookie=0x1, in_port=2 actions=output:4
515  cookie=0x2, in_port=3 actions=output:1
516 OFPST_FLOW reply (OF1.2):
517 ])
518 OVS_VSWITCHD_STOP
519 AT_CLEANUP
520
521 dnl The OpenFlow 1.2 spec states that the cookie may not be modified
522 AT_SETUP([ofproto - mod flows based on cookie mask with cookie change])
523 OVS_VSWITCHD_START
524 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x1,in_port=1,actions=1])
525 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x1,in_port=2,actions=1])
526 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x2,in_port=3,actions=1])
527 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
528  cookie=0x1, in_port=1 actions=output:1
529  cookie=0x1, in_port=2 actions=output:1
530  cookie=0x2, in_port=3 actions=output:1
531 NXST_FLOW reply:
532 ])
533
534 AT_CHECK([ovs-ofctl -F nxm mod-flows br0 cookie=1/-1,cookie=4,actions=4])
535 AT_CHECK([ovs-ofctl -F nxm dump-flows br0 | ofctl_strip | sort], [0], [dnl
536  cookie=0x2, in_port=3 actions=output:1
537  cookie=0x4, in_port=1 actions=output:4
538  cookie=0x4, in_port=2 actions=output:4
539 NXST_FLOW reply:
540 ])
541 OVS_VSWITCHD_STOP
542 AT_CLEANUP
543
544 AT_SETUP([ofproto - mod flow with cookie miss (mask==0) - NXM])
545 OVS_VSWITCHD_START
546 AT_CHECK([ovs-ofctl -F nxm mod-flows br0 in_port=1,actions=1])
547 AT_CHECK([ovs-ofctl -F nxm dump-flows br0 | ofctl_strip | sort], [0], [dnl
548  in_port=1 actions=output:1
549 NXST_FLOW reply:
550 ])
551 OVS_VSWITCHD_STOP
552 AT_CLEANUP
553
554 AT_SETUP([ofproto - mod flow with cookie miss (mask==0) - OF1.1])
555 OVS_VSWITCHD_START
556 AT_CHECK([ovs-ofctl -O openflow11 mod-flows br0 in_port=1,actions=1])
557 AT_CHECK([ovs-ofctl -O openflow11 dump-flows br0 | ofctl_strip | sort], [0], [dnl
558  in_port=1 actions=output:1
559 OFPST_FLOW reply (OF1.1):
560 ])
561 OVS_VSWITCHD_STOP
562 AT_CLEANUP
563
564 AT_SETUP([ofproto - mod flow with cookie miss (mask==0) - OF1.2])
565 OVS_VSWITCHD_START
566 AT_CHECK([ovs-ofctl -O openflow12 mod-flows br0 in_port=1,actions=1])
567 AT_CHECK([ovs-ofctl -O openflow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
568 OFPST_FLOW reply (OF1.2):
569 ])
570 OVS_VSWITCHD_STOP
571 AT_CLEANUP
572
573 AT_SETUP([ofproto - mod flow with cookie miss (mask!=0) - NXM])
574 OVS_VSWITCHD_START
575 AT_CHECK([ovs-ofctl -F nxm mod-flows br0 cookie=1/1,in_port=1,actions=1])
576 AT_CHECK([ovs-ofctl -F nxm dump-flows br0 | ofctl_strip | sort], [0], [dnl
577 NXST_FLOW reply:
578 ])
579 OVS_VSWITCHD_STOP
580 AT_CLEANUP
581
582 AT_SETUP([ofproto - mod flow with cookie miss (mask!=0) - OF1.1])
583 OVS_VSWITCHD_START
584 AT_CHECK([ovs-ofctl -O openflow11 mod-flows br0 cookie=1/1,in_port=1,actions=1])
585 AT_CHECK([ovs-ofctl -O openflow11 dump-flows br0 | ofctl_strip | sort], [0], [dnl
586 OFPST_FLOW reply (OF1.1):
587 ])
588 OVS_VSWITCHD_STOP
589 AT_CLEANUP
590
591 AT_SETUP([ofproto - mod flow with cookie miss (mask!=0) - OF1.2])
592 OVS_VSWITCHD_START
593 AT_CHECK([ovs-ofctl -O openflow12 mod-flows br0 cookie=1/1,in_port=1,actions=1])
594 AT_CHECK([ovs-ofctl -O openflow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
595 OFPST_FLOW reply (OF1.2):
596 ])
597 OVS_VSWITCHD_STOP
598 AT_CLEANUP
599
600 AT_SETUP([ofproto - del flows with cookies])
601 OVS_VSWITCHD_START
602 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x1,in_port=1,actions=1])
603 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x2,in_port=2,actions=1])
604 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x3,in_port=3,actions=1])
605 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
606  cookie=0x1, in_port=1 actions=output:1
607  cookie=0x2, in_port=2 actions=output:1
608  cookie=0x3, in_port=3 actions=output:1
609 NXST_FLOW reply:
610 ])
611
612 AT_CHECK([ovs-ofctl del-flows br0])
613 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
614 NXST_FLOW reply:
615 ])
616 OVS_VSWITCHD_STOP
617 AT_CLEANUP
618
619 AT_SETUP([ofproto - del flows based on cookie])
620 OVS_VSWITCHD_START
621 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x1,in_port=1,actions=1])
622 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x2,in_port=2,actions=1])
623 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x3,in_port=3,actions=1])
624 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
625  cookie=0x1, in_port=1 actions=output:1
626  cookie=0x2, in_port=2 actions=output:1
627  cookie=0x3, in_port=3 actions=output:1
628 NXST_FLOW reply:
629 ])
630
631 AT_CHECK([ovs-ofctl del-flows br0 cookie=0x3/-1])
632 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
633  cookie=0x1, in_port=1 actions=output:1
634  cookie=0x2, in_port=2 actions=output:1
635 NXST_FLOW reply:
636 ])
637 OVS_VSWITCHD_STOP
638 AT_CLEANUP
639
640 AT_SETUP([ofproto - del flows based on cookie mask])
641 OVS_VSWITCHD_START
642 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x1,in_port=1,actions=1])
643 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x2,in_port=2,actions=1])
644 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x3,in_port=3,actions=1])
645 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
646  cookie=0x1, in_port=1 actions=output:1
647  cookie=0x2, in_port=2 actions=output:1
648  cookie=0x3, in_port=3 actions=output:1
649 NXST_FLOW reply:
650 ])
651 AT_CHECK([ovs-ofctl del-flows br0 cookie=0x3/0x1])
652 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
653  cookie=0x2, in_port=2 actions=output:1
654 NXST_FLOW reply:
655 ])
656 OVS_VSWITCHD_STOP
657 AT_CLEANUP
658
659 AT_SETUP([ofproto - del flows based on table id (NXM)])
660 OVS_VSWITCHD_START
661 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x1,in_port=1,actions=1])
662 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x2,in_port=2,table=1,actions=1])
663 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
664  cookie=0x1, in_port=1 actions=output:1
665  cookie=0x2, table=1, in_port=2 actions=output:1
666 NXST_FLOW reply:
667 ])
668 AT_CHECK([ovs-ofctl del-flows br0 table=0])
669 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
670  cookie=0x2, table=1, in_port=2 actions=output:1
671 NXST_FLOW reply:
672 ])
673 AT_CHECK([ovs-ofctl del-flows br0 table=1])
674 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
675 NXST_FLOW reply:
676 ])
677 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x1,in_port=1,actions=1])
678 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x2,in_port=2,table=1,actions=1])
679 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
680  cookie=0x1, in_port=1 actions=output:1
681  cookie=0x2, table=1, in_port=2 actions=output:1
682 NXST_FLOW reply:
683 ])
684 AT_CHECK([ovs-ofctl del-flows br0])
685 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
686 NXST_FLOW reply:
687 ])
688 OVS_VSWITCHD_STOP
689 AT_CLEANUP
690
691 AT_SETUP([ofproto - del flows based on table id (OpenFlow 1.1)])
692 OVS_VSWITCHD_START
693 AT_CHECK([ovs-ofctl -O OpenFlow11 add-flow br0 cookie=0x1,in_port=1,actions=1])
694 AT_CHECK([ovs-ofctl -O OpenFlow11 add-flow br0 cookie=0x2,in_port=2,table=1,actions=1])
695 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0], [dnl
696  cookie=0x1, in_port=1 actions=output:1
697  cookie=0x2, table=1, in_port=2 actions=output:1
698 OFPST_FLOW reply (OF1.1):
699 ])
700 AT_CHECK([ovs-ofctl -O OpenFlow11 del-flows br0 table=0])
701 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0], [dnl
702  cookie=0x2, table=1, in_port=2 actions=output:1
703 OFPST_FLOW reply (OF1.1):
704 ])
705 AT_CHECK([ovs-ofctl -O OpenFlow11 del-flows br0 table=1])
706 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0], [dnl
707 OFPST_FLOW reply (OF1.1):
708 ])
709 AT_CHECK([ovs-ofctl -O OpenFlow11 add-flow br0 cookie=0x1,in_port=1,actions=1])
710 AT_CHECK([ovs-ofctl -O OpenFlow11 add-flow br0 cookie=0x2,in_port=2,table=1,actions=1])
711 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0], [dnl
712  cookie=0x1, in_port=1 actions=output:1
713  cookie=0x2, table=1, in_port=2 actions=output:1
714 OFPST_FLOW reply (OF1.1):
715 ])
716 AT_CHECK([ovs-ofctl -O OpenFlow11 del-flows br0])
717 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip], [0], [dnl
718 OFPST_FLOW reply (OF1.1):
719  cookie=0x2, table=1, in_port=2 actions=output:1
720 ])
721 OVS_VSWITCHD_STOP
722 AT_CLEANUP
723
724 AT_SETUP([ofproto - del flows based on table id (OpenFlow 1.2)])
725 OVS_VSWITCHD_START
726 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 cookie=0x1,in_port=1,actions=1])
727 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 cookie=0x2,in_port=2,table=1,actions=1])
728 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
729  cookie=0x1, in_port=1 actions=output:1
730  cookie=0x2, table=1, in_port=2 actions=output:1
731 OFPST_FLOW reply (OF1.2):
732 ])
733 AT_CHECK([ovs-ofctl -O OpenFlow12 del-flows br0 table=0])
734 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
735  cookie=0x2, table=1, in_port=2 actions=output:1
736 OFPST_FLOW reply (OF1.2):
737 ])
738 AT_CHECK([ovs-ofctl -O OpenFlow12 del-flows br0 table=1])
739 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
740 OFPST_FLOW reply (OF1.2):
741 ])
742 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 cookie=0x1,in_port=1,actions=1])
743 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 cookie=0x2,in_port=2,table=1,actions=1])
744 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
745  cookie=0x1, in_port=1 actions=output:1
746  cookie=0x2, table=1, in_port=2 actions=output:1
747 OFPST_FLOW reply (OF1.2):
748 ])
749 AT_CHECK([ovs-ofctl -O OpenFlow12 del-flows br0])
750 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
751 OFPST_FLOW reply (OF1.2):
752 ])
753 OVS_VSWITCHD_STOP
754 AT_CLEANUP
755
756 AT_SETUP([ofproto - flow table configuration (OpenFlow 1.0)])
757 OVS_VSWITCHD_START
758 # Check the default configuration.
759 (echo "OFPST_TABLE reply (xid=0x2): 254 tables
760   0: classifier: wild=0x3fffff, max=1000000, active=0
761                lookup=0, matched=0"
762  x=1
763  while test $x -lt 254; do
764    printf "  %d: %-8s: wild=0x3fffff, max=1000000, active=0
765                lookup=0, matched=0
766 " $x table$x
767    x=`expr $x + 1`
768  done) > expout
769 AT_CHECK([ovs-ofctl dump-tables br0], [0], [expout])
770 # Change the configuration.
771 AT_CHECK(
772   [ovs-vsctl \
773      -- --id=@t0 create Flow_Table name=main \
774      -- --id=@t1 create Flow_Table flow-limit=1024 \
775      -- set bridge br0 'flow_tables={1=@t1,0=@t0}' \
776    | ${PERL} $srcdir/uuidfilt.pl],
777   [0], [<0>
778 <1>
779 ])
780 # Check that the configuration was updated.
781 mv expout orig-expout
782 (echo "OFPST_TABLE reply (xid=0x2): 254 tables
783   0: main    : wild=0x3fffff, max=1000000, active=0
784                lookup=0, matched=0
785   1: table1  : wild=0x3fffff, max=  1024, active=0
786                lookup=0, matched=0"
787  tail -n +6 orig-expout) > expout
788 AT_CHECK([ovs-ofctl dump-tables br0], [0], [expout])
789 OVS_VSWITCHD_STOP
790 AT_CLEANUP
791
792 AT_SETUP([ofproto - flow table configuration (OpenFlow 1.2)])
793 OVS_VSWITCHD_START
794 # Check the default configuration.
795 (mid="wild=0xfffffffff, max=1000000,"
796  tail="
797                lookup=0, matched=0
798                match=0xfffffffff, instructions=0x00000007, config=0x00000003
799                write_actions=0x00000000, apply_actions=0x00000000
800                write_setfields=0x0000000fffffffff
801                apply_setfields=0x0000000fffffffff
802                metadata_match=0xffffffffffffffff
803                metadata_write=0xffffffffffffffff"
804  echo "OFPST_TABLE reply (OF1.2) (xid=0x2): 254 tables
805   0: classifier: $mid active=0$tail"
806  x=1
807  while test $x -lt 254; do
808    printf "  %d: %-8s: $mid active=0$tail
809 " $x table$x
810    x=`expr $x + 1`
811  done) > expout
812 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-tables br0], [0], [expout])
813 # Change the configuration.
814 AT_CHECK(
815   [ovs-vsctl \
816      -- --id=@t0 create Flow_Table name=main \
817      -- --id=@t1 create Flow_Table flow-limit=1024 \
818      -- set bridge br0 'flow_tables={1=@t1,0=@t0}' \
819    | ${PERL} $srcdir/uuidfilt.pl],
820   [0], [<0>
821 <1>
822 ])
823 # Check that the configuration was updated.
824 mv expout orig-expout
825 (echo "OFPST_TABLE reply (OF1.2) (xid=0x2): 254 tables
826   0: main    : wild=0xfffffffff, max=1000000, active=0"
827  tail -n +3 orig-expout | head -7
828  echo "  1: table1  : wild=0xfffffffff, max=  1024, active=0"
829  tail -n +11 orig-expout) > expout
830 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-tables br0], [0], [expout])
831 OVS_VSWITCHD_STOP
832 AT_CLEANUP
833
834 AT_SETUP([ofproto - hard limits on flow table size (OpenFLow 1.0)])
835 OVS_VSWITCHD_START
836 # Configure a maximum of 4 flows.
837 AT_CHECK(
838   [ovs-vsctl \
839      -- --id=@t0 create Flow_Table flow-limit=4 \
840      -- set bridge br0 flow_tables:0=@t0 \
841    | ${PERL} $srcdir/uuidfilt.pl],
842   [0], [<0>
843 ])
844 # Add 4 flows.
845 for in_port in 1 2 3 4; do
846     ovs-ofctl add-flow br0 in_port=$in_port,actions=drop
847 done
848 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
849  in_port=1 actions=drop
850  in_port=2 actions=drop
851  in_port=3 actions=drop
852  in_port=4 actions=drop
853 NXST_FLOW reply:
854 ])
855 # Adding another flow will be refused.
856 AT_CHECK([ovs-ofctl add-flow br0 in_port=5,actions=drop], [1], [], [stderr])
857 AT_CHECK([head -n 1 stderr | ofctl_strip], [0],
858   [OFPT_ERROR: OFPFMFC_TABLE_FULL
859 ])
860 # Also a mod-flow that would add a flow will be refused.
861 AT_CHECK([ovs-ofctl mod-flows br0 in_port=5,actions=drop], [1], [], [stderr])
862 AT_CHECK([head -n 1 stderr | ofctl_strip], [0],
863   [OFPT_ERROR: OFPFMFC_TABLE_FULL
864 ])
865 # Replacing or modifying an existing flow is allowed.
866 AT_CHECK([ovs-ofctl add-flow br0 in_port=4,actions=normal])
867 AT_CHECK([ovs-ofctl mod-flows br0 in_port=3,actions=output:1])
868 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
869  in_port=1 actions=drop
870  in_port=2 actions=drop
871  in_port=3 actions=output:1
872  in_port=4 actions=NORMAL
873 NXST_FLOW reply:
874 ])
875 OVS_VSWITCHD_STOP
876 AT_CLEANUP
877
878 AT_SETUP([ofproto - hard limits on flow table size (OpenFLow 1.2)])
879 OVS_VSWITCHD_START
880 # Configure a maximum of 4 flows.
881 AT_CHECK(
882   [ovs-vsctl \
883      -- --id=@t0 create Flow_Table flow-limit=4 \
884      -- set bridge br0 flow_tables:0=@t0 \
885    | ${PERL} $srcdir/uuidfilt.pl],
886   [0], [<0>
887 ])
888 # Add 4 flows.
889 for in_port in 1 2 3 4; do
890     ovs-ofctl -O OpenFlow12 add-flow br0 in_port=$in_port,actions=drop
891 done
892 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
893  in_port=1 actions=drop
894  in_port=2 actions=drop
895  in_port=3 actions=drop
896  in_port=4 actions=drop
897 OFPST_FLOW reply (OF1.2):
898 ])
899 # Adding another flow will be refused.
900 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 in_port=5,actions=drop], [1], [], [stderr])
901 AT_CHECK([head -n 1 stderr | ofctl_strip], [0],
902   [OFPT_ERROR (OF1.2): OFPFMFC_TABLE_FULL
903 ])
904 # Replacing or modifying an existing flow is allowed.
905 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 in_port=4,actions=normal])
906 AT_CHECK([ovs-ofctl -O OpenFlow12 mod-flows br0 in_port=3,actions=output:1])
907 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
908  in_port=1 actions=drop
909  in_port=2 actions=drop
910  in_port=3 actions=output:1
911  in_port=4 actions=NORMAL
912 OFPST_FLOW reply (OF1.2):
913 ])
914 OVS_VSWITCHD_STOP
915 AT_CLEANUP
916
917 AT_SETUP([ofproto - eviction upon table overflow (OpenFlow 1.0)])
918 OVS_VSWITCHD_START
919 # Configure a maximum of 4 flows.
920 AT_CHECK(
921   [ovs-vsctl \
922      -- --id=@t0 create Flow_Table flow-limit=4 overflow-policy=evict \
923      -- set bridge br0 flow_tables:0=@t0 \
924    | ${PERL} $srcdir/uuidfilt.pl],
925   [0], [<0>
926 ])
927 # Add 4 flows.
928 for in_port in 4 3 2 1; do
929     ovs-ofctl add-flow br0 idle_timeout=${in_port}0,in_port=$in_port,actions=drop
930 done
931 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
932  idle_timeout=10, in_port=1 actions=drop
933  idle_timeout=20, in_port=2 actions=drop
934  idle_timeout=30, in_port=3 actions=drop
935  idle_timeout=40, in_port=4 actions=drop
936 NXST_FLOW reply:
937 ])
938 # Adding another flow will cause the one that expires soonest to be evicted.
939 AT_CHECK([ovs-ofctl add-flow br0 in_port=5,actions=drop])
940 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
941  idle_timeout=20, in_port=2 actions=drop
942  idle_timeout=30, in_port=3 actions=drop
943  idle_timeout=40, in_port=4 actions=drop
944  in_port=5 actions=drop
945 NXST_FLOW reply:
946 ])
947 # A mod-flow that adds a flow also causes eviction, but replacing or
948 # modifying an existing flow doesn't.
949 AT_CHECK([ovs-ofctl mod-flows br0 in_port=6,actions=drop])
950 AT_CHECK([ovs-ofctl add-flow br0 in_port=4,actions=normal])
951 AT_CHECK([ovs-ofctl mod-flows br0 in_port=3,actions=output:1])
952 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
953  idle_timeout=30, in_port=3 actions=output:1
954  in_port=4 actions=NORMAL
955  in_port=5 actions=drop
956  in_port=6 actions=drop
957 NXST_FLOW reply:
958 ])
959 # Flows with no timeouts at all cannot be evicted.
960 AT_CHECK([ovs-ofctl add-flow br0 in_port=7,actions=normal])
961 AT_CHECK([ovs-ofctl add-flow br0 in_port=8,actions=drop], [1], [], [stderr])
962 AT_CHECK([head -n 1 stderr | ofctl_strip], [0],
963   [OFPT_ERROR: OFPFMFC_TABLE_FULL
964 ])
965 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
966  in_port=4 actions=NORMAL
967  in_port=5 actions=drop
968  in_port=6 actions=drop
969  in_port=7 actions=NORMAL
970 NXST_FLOW reply:
971 ])
972 OVS_VSWITCHD_STOP
973 AT_CLEANUP
974
975 AT_SETUP([ofproto - eviction upon table overflow (OpenFlow 1.2)])
976 OVS_VSWITCHD_START
977 # Configure a maximum of 4 flows.
978 AT_CHECK(
979   [ovs-vsctl \
980      -- --id=@t0 create Flow_Table flow-limit=4 overflow-policy=evict \
981      -- set bridge br0 flow_tables:0=@t0 \
982    | ${PERL} $srcdir/uuidfilt.pl],
983   [0], [<0>
984 ])
985 # Add 4 flows.
986 for in_port in 4 3 2 1; do
987     ovs-ofctl -O OpenFlow12 add-flow br0 idle_timeout=${in_port}0,in_port=$in_port,actions=drop
988 done
989 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
990  idle_timeout=10, in_port=1 actions=drop
991  idle_timeout=20, in_port=2 actions=drop
992  idle_timeout=30, in_port=3 actions=drop
993  idle_timeout=40, in_port=4 actions=drop
994 OFPST_FLOW reply (OF1.2):
995 ])
996 # Adding another flow will cause the one that expires soonest to be evicted.
997 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 in_port=5,actions=drop])
998 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
999  idle_timeout=20, in_port=2 actions=drop
1000  idle_timeout=30, in_port=3 actions=drop
1001  idle_timeout=40, in_port=4 actions=drop
1002  in_port=5 actions=drop
1003 OFPST_FLOW reply (OF1.2):
1004 ])
1005 # In Open Flow 1.2 a mod-flow does not ever add a flow and thus
1006 # has no effect on eviction
1007 AT_CHECK([ovs-ofctl -O OpenFlow12 mod-flows br0 in_port=6,actions=drop])
1008 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 in_port=4,actions=normal])
1009 AT_CHECK([ovs-ofctl -O OpenFlow12 mod-flows br0 in_port=3,actions=output:1])
1010 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1011  idle_timeout=20, in_port=2 actions=drop
1012  idle_timeout=30, in_port=3 actions=output:1
1013  in_port=4 actions=NORMAL
1014  in_port=5 actions=drop
1015 OFPST_FLOW reply (OF1.2):
1016 ])
1017 # Flows with no timeouts at all cannot be evicted.
1018 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 in_port=6,actions=drop])
1019 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 in_port=7,actions=normal])
1020 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 in_port=8,actions=drop], [1], [], [stderr])
1021 AT_CHECK([head -n 1 stderr | ofctl_strip], [0],
1022   [OFPT_ERROR (OF1.2): OFPFMFC_TABLE_FULL
1023 ])
1024 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1025  in_port=4 actions=NORMAL
1026  in_port=5 actions=drop
1027  in_port=6 actions=drop
1028  in_port=7 actions=NORMAL
1029 OFPST_FLOW reply (OF1.2):
1030 ])
1031 OVS_VSWITCHD_STOP
1032 AT_CLEANUP
1033
1034 AT_SETUP([ofproto - eviction upon table overflow, with fairness (OpenFlow 1.0)])
1035 OVS_VSWITCHD_START
1036 # Configure a maximum of 4 flows.
1037 AT_CHECK(
1038   [ovs-vsctl \
1039      -- --id=@t0 create Flow_Table name=evict flow-limit=4 \
1040                                    overflow-policy=evict \
1041                                    groups='"NXM_OF_IN_PORT[[]]"' \
1042      -- set bridge br0 flow_tables:0=@t0 \
1043    | ${PERL} $srcdir/uuidfilt.pl],
1044   [0], [<0>
1045 ])
1046 # Add 4 flows.
1047 ovs-ofctl add-flows br0 - <<EOF
1048 idle_timeout=10 in_port=2 dl_src=00:44:55:66:77:88 actions=drop
1049 idle_timeout=20 in_port=1 dl_src=00:11:22:33:44:55 actions=drop
1050 idle_timeout=30 in_port=1 dl_src=00:22:33:44:55:66 actions=drop
1051 idle_timeout=40 in_port=1 dl_src=00:33:44:55:66:77 actions=drop
1052 EOF
1053 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1054  idle_timeout=10, in_port=2,dl_src=00:44:55:66:77:88 actions=drop
1055  idle_timeout=20, in_port=1,dl_src=00:11:22:33:44:55 actions=drop
1056  idle_timeout=30, in_port=1,dl_src=00:22:33:44:55:66 actions=drop
1057  idle_timeout=40, in_port=1,dl_src=00:33:44:55:66:77 actions=drop
1058 NXST_FLOW reply:
1059 ])
1060 # Adding another flow will cause the one that expires soonest within
1061 # the largest group (those with in_port=1) to be evicted.  In this
1062 # case this is not the same as the one that expires soonest overall
1063 # (which is what makes the test interesting):
1064 AT_CHECK([ovs-ofctl add-flow br0 in_port=2,dl_src=00:55:66:77:88:99,actions=drop])
1065 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1066  idle_timeout=10, in_port=2,dl_src=00:44:55:66:77:88 actions=drop
1067  idle_timeout=30, in_port=1,dl_src=00:22:33:44:55:66 actions=drop
1068  idle_timeout=40, in_port=1,dl_src=00:33:44:55:66:77 actions=drop
1069  in_port=2,dl_src=00:55:66:77:88:99 actions=drop
1070 NXST_FLOW reply:
1071 ])
1072 # Enlarge the flow limit, change the eviction policy back to strictly
1073 # based on expiration, and and add some flows.
1074 AT_CHECK([ovs-vsctl set Flow_Table evict groups='[[]]' flow-limit=7])
1075 ovs-ofctl add-flows br0 - <<EOF
1076 idle_timeout=50 in_port=2 dl_src=00:66:77:88:99:aa actions=drop
1077 idle_timeout=60 in_port=2 dl_src=00:77:88:99:aa:bb actions=drop
1078 idle_timeout=70 in_port=2 dl_src=00:88:99:aa:bb:cc actions=drop
1079 EOF
1080 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1081  idle_timeout=10, in_port=2,dl_src=00:44:55:66:77:88 actions=drop
1082  idle_timeout=30, in_port=1,dl_src=00:22:33:44:55:66 actions=drop
1083  idle_timeout=40, in_port=1,dl_src=00:33:44:55:66:77 actions=drop
1084  idle_timeout=50, in_port=2,dl_src=00:66:77:88:99:aa actions=drop
1085  idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=drop
1086  idle_timeout=70, in_port=2,dl_src=00:88:99:aa:bb:cc actions=drop
1087  in_port=2,dl_src=00:55:66:77:88:99 actions=drop
1088 NXST_FLOW reply:
1089 ])
1090 # Adding another flow will cause the one that expires soonest overall
1091 # to be evicted.
1092 AT_CHECK([ovs-ofctl add-flow br0 'idle_timeout=80 in_port=2 dl_src=00:99:aa:bb:cc:dd actions=drop'])
1093 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1094  idle_timeout=30, in_port=1,dl_src=00:22:33:44:55:66 actions=drop
1095  idle_timeout=40, in_port=1,dl_src=00:33:44:55:66:77 actions=drop
1096  idle_timeout=50, in_port=2,dl_src=00:66:77:88:99:aa actions=drop
1097  idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=drop
1098  idle_timeout=70, in_port=2,dl_src=00:88:99:aa:bb:cc actions=drop
1099  idle_timeout=80, in_port=2,dl_src=00:99:aa:bb:cc:dd actions=drop
1100  in_port=2,dl_src=00:55:66:77:88:99 actions=drop
1101 NXST_FLOW reply:
1102 ])
1103 # Reducing the flow limit also causes the flows that expire soonest
1104 # overall to be evicted.
1105 AT_CHECK([ovs-vsctl set Flow_Table evict flow-limit=4])
1106 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1107  idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=drop
1108  idle_timeout=70, in_port=2,dl_src=00:88:99:aa:bb:cc actions=drop
1109  idle_timeout=80, in_port=2,dl_src=00:99:aa:bb:cc:dd actions=drop
1110  in_port=2,dl_src=00:55:66:77:88:99 actions=drop
1111 NXST_FLOW reply:
1112 ])
1113 OVS_VSWITCHD_STOP
1114 AT_CLEANUP
1115
1116 AT_SETUP([ofproto - eviction upon table overflow, with fairness (OpenFlow 1.2)])
1117 OVS_VSWITCHD_START
1118 # Configure a maximum of 4 flows.
1119 AT_CHECK(
1120   [ovs-vsctl \
1121      -- --id=@t0 create Flow_Table name=evict flow-limit=4 \
1122                                    overflow-policy=evict \
1123                                    groups='"NXM_OF_IN_PORT[[]]"' \
1124      -- set bridge br0 flow_tables:0=@t0 \
1125    | ${PERL} $srcdir/uuidfilt.pl],
1126   [0], [<0>
1127 ])
1128 # Add 4 flows.
1129 ovs-ofctl -O OpenFlow12 add-flows br0 - <<EOF
1130 idle_timeout=10 in_port=2 dl_src=00:44:55:66:77:88 actions=drop
1131 idle_timeout=20 in_port=1 dl_src=00:11:22:33:44:55 actions=drop
1132 idle_timeout=30 in_port=1 dl_src=00:22:33:44:55:66 actions=drop
1133 idle_timeout=40 in_port=1 dl_src=00:33:44:55:66:77 actions=drop
1134 EOF
1135 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1136  idle_timeout=10, in_port=2,dl_src=00:44:55:66:77:88 actions=drop
1137  idle_timeout=20, in_port=1,dl_src=00:11:22:33:44:55 actions=drop
1138  idle_timeout=30, in_port=1,dl_src=00:22:33:44:55:66 actions=drop
1139  idle_timeout=40, in_port=1,dl_src=00:33:44:55:66:77 actions=drop
1140 OFPST_FLOW reply (OF1.2):
1141 ])
1142 # Adding another flow will cause the one that expires soonest within
1143 # the largest group (those with in_port=1) to be evicted.  In this
1144 # case this is not the same as the one that expires soonest overall
1145 # (which is what makes the test interesting):
1146 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 in_port=2,dl_src=00:55:66:77:88:99,actions=drop])
1147 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1148  idle_timeout=10, in_port=2,dl_src=00:44:55:66:77:88 actions=drop
1149  idle_timeout=30, in_port=1,dl_src=00:22:33:44:55:66 actions=drop
1150  idle_timeout=40, in_port=1,dl_src=00:33:44:55:66:77 actions=drop
1151  in_port=2,dl_src=00:55:66:77:88:99 actions=drop
1152 OFPST_FLOW reply (OF1.2):
1153 ])
1154 # Enlarge the flow limit, change the eviction policy back to strictly
1155 # based on expiration, and and add some flows.
1156 AT_CHECK([ovs-vsctl set Flow_Table evict groups='[[]]' flow-limit=7])
1157 ovs-ofctl -O OpenFlow12 add-flows br0 - <<EOF
1158 idle_timeout=50 in_port=2 dl_src=00:66:77:88:99:aa actions=drop
1159 idle_timeout=60 in_port=2 dl_src=00:77:88:99:aa:bb actions=drop
1160 idle_timeout=70 in_port=2 dl_src=00:88:99:aa:bb:cc actions=drop
1161 EOF
1162 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1163  idle_timeout=10, in_port=2,dl_src=00:44:55:66:77:88 actions=drop
1164  idle_timeout=30, in_port=1,dl_src=00:22:33:44:55:66 actions=drop
1165  idle_timeout=40, in_port=1,dl_src=00:33:44:55:66:77 actions=drop
1166  idle_timeout=50, in_port=2,dl_src=00:66:77:88:99:aa actions=drop
1167  idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=drop
1168  idle_timeout=70, in_port=2,dl_src=00:88:99:aa:bb:cc actions=drop
1169  in_port=2,dl_src=00:55:66:77:88:99 actions=drop
1170 OFPST_FLOW reply (OF1.2):
1171 ])
1172 # Adding another flow will cause the one that expires soonest overall
1173 # to be evicted.
1174 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'])
1175 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1176  idle_timeout=30, in_port=1,dl_src=00:22:33:44:55:66 actions=drop
1177  idle_timeout=40, in_port=1,dl_src=00:33:44:55:66:77 actions=drop
1178  idle_timeout=50, in_port=2,dl_src=00:66:77:88:99:aa actions=drop
1179  idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=drop
1180  idle_timeout=70, in_port=2,dl_src=00:88:99:aa:bb:cc actions=drop
1181  idle_timeout=80, in_port=2,dl_src=00:99:aa:bb:cc:dd actions=drop
1182  in_port=2,dl_src=00:55:66:77:88:99 actions=drop
1183 OFPST_FLOW reply (OF1.2):
1184 ])
1185 # Reducing the flow limit also causes the flows that expire soonest
1186 # overall to be evicted.
1187 AT_CHECK([ovs-vsctl set Flow_Table evict flow-limit=4])
1188 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1189  idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=drop
1190  idle_timeout=70, in_port=2,dl_src=00:88:99:aa:bb:cc actions=drop
1191  idle_timeout=80, in_port=2,dl_src=00:99:aa:bb:cc:dd actions=drop
1192  in_port=2,dl_src=00:55:66:77:88:99 actions=drop
1193 OFPST_FLOW reply (OF1.2):
1194 ])
1195 OVS_VSWITCHD_STOP
1196 AT_CLEANUP
1197
1198 AT_SETUP([ofproto - asynchronous message control (OpenFlow 1.0)])
1199 OVS_VSWITCHD_START
1200 AT_CHECK([ovs-ofctl -P openflow10 monitor br0 --detach --no-chdir --pidfile])
1201 check_async () {
1202     printf '\n\n--- check_async %d ---\n\n\n' $1
1203     shift
1204
1205     ovs-appctl -t ovs-ofctl ofctl/barrier
1206     ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
1207     : > expout
1208
1209     # OFPT_PACKET_IN, OFPR_ACTION (controller_id=0)
1210     ovs-ofctl -v packet-out br0 controller controller '0001020304050010203040501234'
1211     if test X"$1" = X"OFPR_ACTION"; then shift;
1212         echo >>expout "OFPT_PACKET_IN: total_len=14 in_port=CONTROLLER (via action) data_len=14 (unbuffered)
1213 metadata=0,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"
1214     fi
1215
1216     # OFPT_PACKET_IN, OFPR_NO_MATCH (controller_id=123)
1217     ovs-ofctl -v packet-out br0 controller 'controller(reason=no_match,id=123)' '0001020304050010203040501234'
1218     if test X"$1" = X"OFPR_NO_MATCH"; then shift;
1219         echo >>expout "OFPT_PACKET_IN: total_len=14 in_port=CONTROLLER (via no_match) data_len=14 (unbuffered)
1220 metadata=0,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"
1221     fi
1222
1223     # OFPT_PACKET_IN, OFPR_INVALID_TTL (controller_id=0)
1224     ovs-ofctl packet-out br0 controller dec_ttl '002583dfb4000026b98cb0f908004500003fb7e200000011339bac11370dac100002d7730035002b8f6d86fb0100000100000000000006626c702d7873066e696369726103636f6d00000f00'
1225     if test X"$1" = X"OFPR_INVALID_TTL"; then shift;
1226         echo >>expout "OFPT_PACKET_IN: total_len=76 in_port=CONTROLLER (via invalid_ttl) data_len=76 (unbuffered)
1227 udp,metadata=0,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"
1228     fi
1229
1230     # OFPT_PORT_STATUS, OFPPR_ADD
1231     ovs-vsctl add-port br0 test -- set Interface test type=dummy ofport_request=1
1232     if test X"$1" = X"OFPPR_ADD"; then shift;
1233         echo >>expout "OFPT_PORT_STATUS: ADD: 1(test): addr:aa:55:aa:55:00:0x
1234      config:     PORT_DOWN
1235      state:      LINK_DOWN
1236      speed: 0 Mbps now, 0 Mbps max"
1237     fi
1238
1239     # OFPT_PORT_STATUS, OFPPR_DELETE
1240     ovs-vsctl del-port br0 test
1241     if test X"$1" = X"OFPPR_DELETE"; then shift;
1242         echo >>expout "OFPT_PORT_STATUS: DEL: 1(test): addr:aa:55:aa:55:00:0x
1243      config:     PORT_DOWN
1244      state:      LINK_DOWN
1245      speed: 0 Mbps now, 0 Mbps max"
1246     fi
1247
1248     # OFPT_FLOW_REMOVED, OFPRR_DELETE
1249     ovs-ofctl add-flow br0 send_flow_rem,actions=drop
1250     ovs-ofctl --strict del-flows br0 ''
1251     if test X"$1" = X"OFPRR_DELETE"; then shift;
1252         echo >>expout "OFPT_FLOW_REMOVED:  reason=delete"
1253     fi
1254     AT_FAIL_IF([test X"$1" != X])
1255
1256     ovs-appctl -t ovs-ofctl ofctl/barrier
1257     echo >>expout "OFPT_BARRIER_REPLY:"
1258
1259     AT_CHECK(
1260       [[sed '
1261 s/ (xid=0x[0-9a-fA-F]*)//
1262 s/ *duration.*//
1263 s/00:0.$/00:0x/' < monitor.log]],
1264       [0], [expout])
1265 }
1266
1267 # It's a service connection so initially there should be no async messages.
1268 check_async 1
1269
1270 # Set miss_send_len to 128, turning on packet-ins for our service connection.
1271 ovs-appctl -t ovs-ofctl ofctl/send 0109000c0123456700000080
1272 check_async 2 OFPR_ACTION OFPPR_ADD OFPPR_DELETE OFPRR_DELETE
1273
1274 # Set miss_send_len to 128 and enable invalid_ttl.
1275 ovs-appctl -t ovs-ofctl ofctl/send 0109000c0123456700040080
1276 check_async 3 OFPR_ACTION OFPR_INVALID_TTL OFPPR_ADD OFPPR_DELETE OFPRR_DELETE
1277
1278 # Become slave, which should disable everything except port status.
1279 ovs-appctl -t ovs-ofctl ofctl/send 0104001400000002000023200000000a00000002
1280 check_async 4 OFPPR_ADD OFPPR_DELETE
1281
1282 # Use NXT_SET_ASYNC_CONFIG to enable a patchwork of asynchronous messages.
1283 ovs-appctl -t ovs-ofctl ofctl/send 01040028000000020000232000000013000000020000000500000005000000020000000200000005
1284 check_async 5 OFPR_INVALID_TTL OFPPR_DELETE OFPRR_DELETE
1285
1286 # Set controller ID 123.
1287 ovs-appctl -t ovs-ofctl ofctl/send 01040018000000030000232000000014000000000000007b
1288 check_async 6 OFPR_NO_MATCH OFPPR_DELETE OFPRR_DELETE
1289
1290 # Restore controller ID 0.
1291 ovs-appctl -t ovs-ofctl ofctl/send 010400180000000300002320000000140000000000000000
1292
1293 # Become master.
1294 ovs-appctl -t ovs-ofctl ofctl/send 0104001400000002000023200000000a00000001
1295 check_async 7 OFPR_ACTION OFPPR_ADD
1296
1297 ovs-appctl -t ovs-ofctl exit
1298 OVS_VSWITCHD_STOP
1299 AT_CLEANUP
1300
1301 AT_SETUP([ofproto - asynchronous message control (OpenFlow 1.2)])
1302 OVS_VSWITCHD_START
1303 AT_CHECK([ovs-ofctl -O OpenFlow12 monitor br0 --detach --no-chdir --pidfile])
1304 check_async () {
1305     printf '\n\n--- check_async %d ---\n\n\n' $1
1306     INDEX=$1
1307     shift
1308
1309     ovs-appctl -t ovs-ofctl ofctl/barrier
1310     ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
1311     : > expout
1312
1313     # OFPT_PACKET_IN, OFPR_ACTION (controller_id=0)
1314     ovs-ofctl -O OpenFlow12 -v packet-out br0 none controller '0001020304050010203040501234'
1315     if test X"$1" = X"OFPR_ACTION"; then shift;
1316         echo >>expout "OFPT_PACKET_IN (OF1.2): total_len=14 in_port=ANY (via action) data_len=14 (unbuffered)
1317 metadata=0,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"
1318     fi
1319
1320     # OFPT_PACKET_IN, OFPR_NO_MATCH (controller_id=123)
1321     ovs-ofctl -O OpenFlow12 -v packet-out br0 none 'controller(reason=no_match,id=123)' '0001020304050010203040501234'
1322     if test X"$1" = X"OFPR_NO_MATCH"; then shift;
1323         echo >>expout "OFPT_PACKET_IN (OF1.2): total_len=14 in_port=ANY (via no_match) data_len=14 (unbuffered)
1324 metadata=0,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"
1325     fi
1326
1327     # OFPT_PACKET_IN, OFPR_INVALID_TTL (controller_id=0)
1328     ovs-ofctl -O OpenFlow12 packet-out br0 none dec_ttl '002583dfb4000026b98cb0f908004500003fb7e200000011339bac11370dac100002d7730035002b8f6d86fb0100000100000000000006626c702d7873066e696369726103636f6d00000f00'
1329     if test X"$1" = X"OFPR_INVALID_TTL"; then shift;
1330         echo >>expout "OFPT_PACKET_IN (OF1.2): total_len=76 in_port=ANY (via invalid_ttl) data_len=76 (unbuffered)
1331 udp,metadata=0,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"
1332     fi
1333
1334     # OFPT_PORT_STATUS, OFPPR_ADD
1335     ovs-vsctl add-port br0 test -- set Interface test type=dummy
1336     if test X"$1" = X"OFPPR_ADD"; then shift;
1337         echo >>expout "OFPT_PORT_STATUS (OF1.2): ADD: ${INDEX}(test): addr:aa:55:aa:55:00:0x
1338      config:     PORT_DOWN
1339      state:      LINK_DOWN
1340      speed: 0 Mbps now, 0 Mbps max"
1341     fi
1342
1343     # OFPT_PORT_STATUS, OFPPR_DELETE
1344     ovs-vsctl del-port br0 test
1345     if test X"$1" = X"OFPPR_DELETE"; then shift;
1346         echo >>expout "OFPT_PORT_STATUS (OF1.2): DEL: ${INDEX}(test): addr:aa:55:aa:55:00:0x
1347      config:     PORT_DOWN
1348      state:      LINK_DOWN
1349      speed: 0 Mbps now, 0 Mbps max"
1350     fi
1351
1352     # OFPT_FLOW_REMOVED, OFPRR_DELETE
1353     ovs-ofctl -O OpenFlow12 add-flow br0 send_flow_rem,actions=drop
1354     ovs-ofctl -O OpenFlow12 --strict del-flows br0 ''
1355     if test X"$1" = X"OFPRR_DELETE"; then shift;
1356         echo >>expout "OFPT_FLOW_REMOVED (OF1.2):  reason=delete table_id=0"
1357     fi
1358     AT_FAIL_IF([test X"$1" != X])
1359
1360     ovs-appctl -t ovs-ofctl ofctl/barrier
1361     echo >>expout "OFPT_BARRIER_REPLY (OF1.2):"
1362
1363     AT_CHECK(
1364       [[sed '
1365 s/ (xid=0x[0-9a-fA-F]*)//
1366 s/ *duration.*//
1367 s/00:0.$/00:0x/' < monitor.log]],
1368       [0], [expout])
1369 }
1370
1371 # It's a service connection so initially there should be no async messages.
1372 check_async 1
1373
1374 # Set miss_send_len to 128, turning on packet-ins for our service connection.
1375 ovs-appctl -t ovs-ofctl ofctl/send 0309000c0123456700000080
1376 check_async 2 OFPR_ACTION OFPPR_ADD OFPPR_DELETE OFPRR_DELETE
1377
1378 # Set miss_send_len to 128 and enable invalid_ttl.
1379 ovs-appctl -t ovs-ofctl ofctl/send 0309000c0123456700040080
1380 check_async 3 OFPR_ACTION OFPR_INVALID_TTL OFPPR_ADD OFPPR_DELETE OFPRR_DELETE
1381
1382 # Become slave (OF 1.2), which should disable everything except port status.
1383 ovs-appctl -t ovs-ofctl ofctl/send 031800180000000200000003000000000000000000000001
1384 check_async 4 OFPPR_ADD OFPPR_DELETE
1385
1386 # Use NXT_SET_ASYNC_CONFIG to enable a patchwork of asynchronous messages.
1387 ovs-appctl -t ovs-ofctl ofctl/send 03040028000000020000232000000013000000020000000500000005000000020000000200000005
1388 check_async 5 OFPR_INVALID_TTL OFPPR_DELETE OFPRR_DELETE
1389
1390 # Set controller ID 123.
1391 ovs-appctl -t ovs-ofctl ofctl/send 03040018000000030000232000000014000000000000007b
1392 check_async 6 OFPR_NO_MATCH OFPPR_DELETE OFPRR_DELETE
1393
1394 # Restore controller ID 0.
1395 ovs-appctl -t ovs-ofctl ofctl/send 030400180000000300002320000000140000000000000000
1396
1397 # Become master (OF 1.2).
1398 ovs-appctl -t ovs-ofctl ofctl/send 031800180000000400000002000000000000000000000002
1399 check_async 7 OFPR_ACTION OFPPR_ADD
1400
1401 ovs-appctl -t ovs-ofctl exit
1402 OVS_VSWITCHD_STOP
1403 AT_CLEANUP
1404
1405 AT_SETUP([ofproto - asynchronous message control (OpenFlow 1.3)])
1406 OVS_VSWITCHD_START
1407 AT_CHECK([ovs-ofctl -O OpenFlow13 monitor br0 --detach --no-chdir --pidfile])
1408 check_async () {
1409     printf '\n\n--- check_async %d ---\n\n\n' $1
1410     INDEX=$1
1411     shift
1412
1413     ovs-appctl -t ovs-ofctl ofctl/barrier
1414     ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
1415     : > expout
1416
1417     # OFPT_PACKET_IN, OFPR_ACTION (controller_id=0)
1418     ovs-ofctl -O OpenFlow13 -v packet-out br0 none controller '0001020304050010203040501234'
1419     if test X"$1" = X"OFPR_ACTION"; then shift;
1420         echo >>expout "OFPT_PACKET_IN (OF1.3): total_len=14 in_port=ANY (via action) data_len=14 (unbuffered)
1421 metadata=0,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"
1422     fi
1423
1424     # OFPT_PACKET_IN, OFPR_NO_MATCH (controller_id=123)
1425     ovs-ofctl -O OpenFlow13 -v packet-out br0 none 'controller(reason=no_match,id=123)' '0001020304050010203040501234'
1426     if test X"$1" = X"OFPR_NO_MATCH"; then shift;
1427         echo >>expout "OFPT_PACKET_IN (OF1.3): total_len=14 in_port=ANY (via no_match) data_len=14 (unbuffered)
1428 metadata=0,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"
1429     fi
1430
1431     # OFPT_PACKET_IN, OFPR_INVALID_TTL (controller_id=0)
1432     ovs-ofctl -O OpenFlow13 packet-out br0 none dec_ttl '002583dfb4000026b98cb0f908004500003fb7e200000011339bac11370dac100002d7730035002b8f6d86fb0100000100000000000006626c702d7873066e696369726103636f6d00000f00'
1433     if test X"$1" = X"OFPR_INVALID_TTL"; then shift;
1434         echo >>expout "OFPT_PACKET_IN (OF1.3): total_len=76 in_port=ANY (via invalid_ttl) data_len=76 (unbuffered)
1435 udp,metadata=0,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"
1436     fi
1437
1438     # OFPT_PORT_STATUS, OFPPR_ADD
1439     ovs-vsctl add-port br0 test -- set Interface test type=dummy
1440     if test X"$1" = X"OFPPR_ADD"; then shift;
1441         echo >>expout "OFPT_PORT_STATUS (OF1.3): ADD: ${INDEX}(test): addr:aa:55:aa:55:00:0x
1442      config:     PORT_DOWN
1443      state:      LINK_DOWN
1444      speed: 0 Mbps now, 0 Mbps max"
1445     fi
1446
1447     # OFPT_PORT_STATUS, OFPPR_DELETE
1448     ovs-vsctl del-port br0 test
1449     if test X"$1" = X"OFPPR_DELETE"; then shift;
1450         echo >>expout "OFPT_PORT_STATUS (OF1.3): DEL: ${INDEX}(test): addr:aa:55:aa:55:00:0x
1451      config:     PORT_DOWN
1452      state:      LINK_DOWN
1453      speed: 0 Mbps now, 0 Mbps max"
1454     fi
1455
1456     # OFPT_FLOW_REMOVED, OFPRR_DELETE
1457     ovs-ofctl -O OpenFlow13 add-flow br0 send_flow_rem,actions=drop
1458     ovs-ofctl -O OpenFlow13 --strict del-flows br0 ''
1459     if test X"$1" = X"OFPRR_DELETE"; then shift;
1460         echo >>expout "OFPT_FLOW_REMOVED (OF1.3):  reason=delete table_id=0"
1461     fi
1462     AT_FAIL_IF([test X"$1" != X])
1463
1464     ovs-appctl -t ovs-ofctl ofctl/barrier
1465     echo >>expout "OFPT_BARRIER_REPLY (OF1.3):"
1466
1467     AT_CHECK(
1468       [[sed '
1469 s/ (xid=0x[0-9a-fA-F]*)//
1470 s/ *duration.*//
1471 s/00:0.$/00:0x/' < monitor.log]],
1472       [0], [expout])
1473 }
1474
1475 # It's a service connection so initially there should be no async messages.
1476 check_async 1
1477
1478 # Set miss_send_len to 128, turning on packet-ins for our service connection.
1479 ovs-appctl -t ovs-ofctl ofctl/send 0409000c0123456700000080
1480 check_async 2 OFPR_ACTION OFPPR_ADD OFPPR_DELETE OFPRR_DELETE
1481
1482 # Become slave (OF 1.3), which should disable everything except port status.
1483 ovs-appctl -t ovs-ofctl ofctl/send 041800180000000200000003000000000000000000000001
1484 check_async 3 OFPPR_ADD OFPPR_DELETE
1485
1486 # Use OF 1.3 OFPT_SET_ASYNC to enable a patchwork of asynchronous messages.
1487 ovs-appctl -t ovs-ofctl ofctl/send 041c002000000002000000020000000500000005000000020000000200000005
1488 check_async 4 OFPR_INVALID_TTL OFPPR_DELETE OFPRR_DELETE
1489
1490 # Set controller ID 123.
1491 ovs-appctl -t ovs-ofctl ofctl/send 04040018000000030000232000000014000000000000007b
1492 check_async 5 OFPR_NO_MATCH OFPPR_DELETE OFPRR_DELETE
1493
1494 # Restore controller ID 0.
1495 ovs-appctl -t ovs-ofctl ofctl/send 040400180000000300002320000000140000000000000000
1496
1497 # Become master (OF 1.3).
1498 ovs-appctl -t ovs-ofctl ofctl/send 041800180000000400000002000000000000000000000002
1499 check_async 6 OFPR_ACTION OFPPR_ADD
1500
1501 ovs-appctl -t ovs-ofctl exit
1502 OVS_VSWITCHD_STOP
1503 AT_CLEANUP
1504
1505 dnl This test checks that the role request/response messaging works
1506 dnl and that generation_id is handled properly.
1507 AT_SETUP([ofproto - controller role (OpenFlow 1.2)])
1508 OVS_VSWITCHD_START
1509 AT_CHECK([ovs-ofctl -O OpenFlow12 monitor br0 --detach --no-chdir --pidfile])
1510
1511 ovs-appctl -t ovs-ofctl ofctl/barrier
1512 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
1513 : > expout
1514
1515 # find out current role
1516 ovs-appctl -t ovs-ofctl ofctl/send 031800180000000200000000000000000000000000000000
1517 echo >>expout "send: OFPT_ROLE_REQUEST (OF1.2) (xid=0x2): role=nochange"
1518 echo >>expout "OFPT_ROLE_REPLY (OF1.2) (xid=0x2): role=equal"
1519
1520 # Become slave (generation_id is initially undefined, so 2^63+2 should not be stale)
1521 ovs-appctl -t ovs-ofctl ofctl/send 031800180000000300000003000000008000000000000002
1522 echo >>expout "send: OFPT_ROLE_REQUEST (OF1.2) (xid=0x3): role=slave generation_id=9223372036854775810"
1523 echo >>expout "OFPT_ROLE_REPLY (OF1.2) (xid=0x3): role=slave generation_id=9223372036854775810"
1524
1525 # Try to become the master using a stale generation ID
1526 ovs-appctl -t ovs-ofctl ofctl/send 031800180000000400000002000000000000000000000002
1527 echo >>expout "send: OFPT_ROLE_REQUEST (OF1.2) (xid=0x4): role=master generation_id=2"
1528 echo >>expout "OFPT_ERROR (OF1.2) (xid=0x4): OFPRRFC_STALE"
1529 echo >>expout "OFPT_ROLE_REQUEST (OF1.2) (xid=0x4): role=master generation_id=2"
1530
1531 # Become master using a valid generation ID
1532 ovs-appctl -t ovs-ofctl ofctl/send 031800180000000500000002000000000000000000000001
1533 echo >>expout "send: OFPT_ROLE_REQUEST (OF1.2) (xid=0x5): role=master generation_id=1"
1534 echo >>expout "OFPT_ROLE_REPLY (OF1.2) (xid=0x5): role=master generation_id=1"
1535 ovs-appctl -t ovs-ofctl ofctl/barrier
1536 echo >>expout "OFPT_BARRIER_REPLY (OF1.2) (xid=0x3):"
1537
1538 AT_CHECK([cat monitor.log], [0], [expout])
1539
1540 ovs-appctl -t ovs-ofctl exit
1541 OVS_VSWITCHD_STOP
1542 AT_CLEANUP
1543
1544 dnl This test checks that OFPT_PACKET_OUT accepts both OFPP_NONE (as
1545 dnl specified by OpenFlow 1.0) and OFPP_CONTROLLER (used by some
1546 dnl controllers despite the spec) as meaning a packet that was generated
1547 dnl by the controller.
1548 AT_SETUP([ofproto - packet-out from controller (OpenFlow 1.0)])
1549 OVS_VSWITCHD_START
1550 ADD_OF_PORTS([br0], [1])
1551
1552 # Start a monitor listening for packet-ins.
1553 AT_CHECK([ovs-ofctl -P openflow10 monitor br0 --detach --no-chdir --pidfile])
1554 ovs-appctl -t ovs-ofctl ofctl/send 0109000c0123456700000080
1555 ovs-appctl -t ovs-ofctl ofctl/barrier
1556 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
1557 AT_CAPTURE_FILE([monitor.log])
1558
1559 # Send some packet-outs with OFPP_NONE and OFPP_CONTROLLER (65533) as in_port.
1560 AT_CHECK([ovs-ofctl packet-out br0 none controller,1 '0001020304050010203040501234'])
1561 AT_CHECK([ovs-ofctl packet-out br0 controller controller,1 '0001020304050010203040505678'])
1562
1563 # Stop the monitor and check its output.
1564 ovs-appctl -t ovs-ofctl ofctl/barrier
1565 ovs-appctl -t ovs-ofctl exit
1566
1567 ovs-ofctl dump-ports br0
1568
1569 AT_CHECK([sed 's/ (xid=0x[[0-9a-fA-F]]*)//' monitor.log], [0], [dnl
1570 OFPT_PACKET_IN: total_len=14 in_port=ANY (via action) data_len=14 (unbuffered)
1571 metadata=0,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
1572 OFPT_PACKET_IN: total_len=14 in_port=CONTROLLER (via action) data_len=14 (unbuffered)
1573 metadata=0,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
1574 OFPT_BARRIER_REPLY:
1575 ])
1576
1577 OVS_VSWITCHD_STOP
1578 AT_CLEANUP
1579
1580 dnl This test checks that OFPT_PACKET_OUT accepts both OFPP_NONE (as
1581 dnl specified by OpenFlow 1.2) and OFPP_CONTROLLER (used by some
1582 dnl controllers despite the spec) as meaning a packet that was generated
1583 dnl by the controller.
1584 AT_SETUP([ofproto - packet-out from controller (OpenFlow 1.2)])
1585 OVS_VSWITCHD_START
1586
1587 # Start a monitor listening for packet-ins.
1588 AT_CHECK([ovs-ofctl -O OpenFlow12 monitor br0 --detach --no-chdir --pidfile])
1589 ovs-appctl -t ovs-ofctl ofctl/send 0309000c0123456700000080
1590 ovs-appctl -t ovs-ofctl ofctl/barrier
1591 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
1592 AT_CAPTURE_FILE([monitor.log])
1593
1594 # Send some packet-outs with OFPP_NONE and OFPP_CONTROLLER (65533) as in_port.
1595 AT_CHECK([ovs-ofctl -O OpenFlow12 packet-out br0 none controller '0001020304050010203040501234'])
1596 AT_CHECK([ovs-ofctl -O OpenFlow12 packet-out br0 4294967293 controller '0001020304050010203040505678'])
1597
1598 # Stop the monitor and check its output.
1599 ovs-appctl -t ovs-ofctl ofctl/barrier
1600 ovs-appctl -t ovs-ofctl exit
1601
1602 AT_CHECK([sed 's/ (xid=0x[[0-9a-fA-F]]*)//' monitor.log], [0], [dnl
1603 OFPT_PACKET_IN (OF1.2): total_len=14 in_port=ANY (via action) data_len=14 (unbuffered)
1604 metadata=0,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
1605 OFPT_PACKET_IN (OF1.2): total_len=14 in_port=CONTROLLER (via action) data_len=14 (unbuffered)
1606 metadata=0,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
1607 OFPT_BARRIER_REPLY (OF1.2):
1608 ])
1609
1610 OVS_VSWITCHD_STOP
1611 AT_CLEANUP
1612
1613 dnl This test checks that metadata is encoded in packet_in structures,
1614 dnl supported by NXAST.
1615 AT_SETUP([ofproto - packet-out with metadata (NXM)])
1616 OVS_VSWITCHD_START
1617
1618 # Start a monitor listening for packet-ins.
1619 AT_CHECK([ovs-ofctl -P nxm monitor br0 --detach --no-chdir --pidfile])
1620 ovs-appctl -t ovs-ofctl ofctl/send 0109000c0123456700000080
1621 ovs-appctl -t ovs-ofctl ofctl/barrier
1622 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
1623 AT_CAPTURE_FILE([monitor.log])
1624
1625 # Send a packet-out with a load action to set some metadata, and forward to controller
1626 AT_CHECK([ovs-ofctl packet-out br0 controller 'load(0xfafafafa5a5a5a5a->OXM_OF_METADATA[[0..63]]), load(0xaa->NXM_NX_PKT_MARK[[]]), controller' '0001020304050010203040501234'])
1627
1628 # Stop the monitor and check its output.
1629 ovs-appctl -t ovs-ofctl ofctl/barrier
1630 ovs-appctl -t ovs-ofctl exit
1631
1632 AT_CHECK([sed 's/ (xid=0x[[0-9a-fA-F]]*)//' monitor.log], [0], [dnl
1633 NXT_PACKET_IN: total_len=14 in_port=CONTROLLER metadata=0xfafafafa5a5a5a5a pkt_mark=0xaa (via action) data_len=14 (unbuffered)
1634 metadata=0,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
1635 OFPT_BARRIER_REPLY:
1636 ])
1637
1638 OVS_VSWITCHD_STOP
1639 AT_CLEANUP
1640
1641 dnl This test checks that metadata is encoded in packet_in structures,
1642 dnl supported by NXAST.
1643 AT_SETUP([ofproto - packet-out with metadata (OpenFlow 1.2)])
1644 OVS_VSWITCHD_START
1645
1646 # Start a monitor listening for packet-ins.
1647 AT_CHECK([ovs-ofctl -O OpenFlow12 monitor br0 --detach --no-chdir --pidfile])
1648 ovs-appctl -t ovs-ofctl ofctl/send 0309000c0123456700000080
1649 ovs-appctl -t ovs-ofctl ofctl/barrier
1650 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
1651 AT_CAPTURE_FILE([monitor.log])
1652
1653 # Send a packet-out with a load action to set some metadata, and forward to controller
1654 AT_CHECK([ovs-ofctl -O OpenFlow12 packet-out br0 none 'load(0xfafafafa5a5a5a5a->OXM_OF_METADATA[[0..63]]), controller' '0001020304050010203040501234'])
1655
1656 # Stop the monitor and check its output.
1657 ovs-appctl -t ovs-ofctl ofctl/barrier
1658 ovs-appctl -t ovs-ofctl exit
1659
1660 AT_CHECK([sed 's/ (xid=0x[[0-9a-fA-F]]*)//' monitor.log], [0], [dnl
1661 OFPT_PACKET_IN (OF1.2): total_len=14 in_port=ANY metadata=0xfafafafa5a5a5a5a (via action) data_len=14 (unbuffered)
1662 metadata=0,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
1663 OFPT_BARRIER_REPLY (OF1.2):
1664 ])
1665
1666 OVS_VSWITCHD_STOP
1667 AT_CLEANUP
1668
1669 dnl This test checks that tunnel metadata is encoded in packet_in structures.
1670 AT_SETUP([ofproto - packet-out with tunnel metadata (OpenFlow 1.2)])
1671 OVS_VSWITCHD_START
1672
1673 # Start a monitor listening for packet-ins.
1674 AT_CHECK([ovs-ofctl -O OpenFlow12 monitor br0 --detach --no-chdir --pidfile])
1675 ovs-appctl -t ovs-ofctl ofctl/send 0309000c0123456700000080
1676 ovs-appctl -t ovs-ofctl ofctl/barrier
1677 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
1678 AT_CAPTURE_FILE([monitor.log])
1679
1680 # Send a packet-out with set field actions to set some tunnel metadata, and forward to controller
1681 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'])
1682
1683 # Stop the monitor and check its output.
1684 ovs-appctl -t ovs-ofctl ofctl/barrier
1685 ovs-appctl -t ovs-ofctl exit
1686
1687 AT_CHECK([sed 's/ (xid=0x[[0-9a-fA-F]]*)//' monitor.log], [0], [dnl
1688 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)
1689 metadata=0,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
1690 OFPT_BARRIER_REPLY (OF1.2):
1691 ])
1692
1693 OVS_VSWITCHD_STOP
1694 AT_CLEANUP
1695
1696 AT_SETUP([ofproto - flow monitoring])
1697 AT_KEYWORDS([monitor])
1698 OVS_VSWITCHD_START
1699
1700 ovs-ofctl add-flow br0 in_port=0,dl_vlan=123,actions=output:1
1701
1702 # Start a monitor watching the flow table and check the initial reply.
1703 ovs-ofctl monitor br0 watch: --detach --no-chdir --pidfile >monitor.log 2>&1
1704 AT_CAPTURE_FILE([monitor.log])
1705 ovs-appctl -t ovs-ofctl ofctl/barrier
1706 AT_CHECK([sed 's/ (xid=0x[[1-9a-fA-F]][[0-9a-fA-F]]*)//' monitor.log], [0],
1707   [NXST_FLOW_MONITOR reply:
1708  event=ADDED table=0 cookie=0 in_port=0,dl_vlan=123 actions=output:1
1709 OFPT_BARRIER_REPLY:
1710 ])
1711
1712 # Add, delete, and modify some flows and check the updates.
1713 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
1714 ovs-ofctl add-flow br0 in_port=0,dl_vlan=124,actions=output:2
1715 ovs-ofctl add-flow br0 in_port=0,dl_vlan=123,actions=output:5
1716 ovs-ofctl add-flow br0 in_port=0,dl_vlan=123,dl_vlan_pcp=0,actions=output:6
1717 ovs-ofctl add-flow br0 in_port=0,dl_vlan=123,dl_vlan_pcp=1,actions=output:7
1718 ovs-ofctl add-flow br0 in_port=0,dl_vlan=123,actions=output:8
1719 ovs-ofctl add-flow br0 in_port=0,dl_vlan=65535,dl_vlan_pcp=0,actions=output:9
1720 ovs-ofctl add-flow br0 in_port=0,dl_vlan=65535,dl_vlan_pcp=1,actions=output:10
1721 ovs-ofctl add-flow br0 in_port=0,dl_vlan=65535,actions=output:11
1722 ovs-ofctl add-flow br0 in_port=0,dl_vlan=8191,dl_vlan_pcp=0,actions=output:12
1723 ovs-ofctl add-flow br0 in_port=0,dl_vlan=8191,dl_vlan_pcp=1,actions=output:13
1724 ovs-ofctl add-flow br0 in_port=0,dl_vlan=8191,actions=output:14
1725 ovs-ofctl add-flow br0 in_port=0,dl_vlan=0,dl_vlan_pcp=0,actions=output:15
1726 ovs-ofctl add-flow br0 in_port=0,dl_vlan=0,dl_vlan_pcp=1,actions=output:16
1727 ovs-ofctl add-flow br0 in_port=0,dl_vlan=0,actions=output:17
1728 ovs-ofctl add-flow br0 in_port=0,dl_vlan=0,dl_vlan_pcp=0,actions=output:18
1729 ovs-ofctl add-flow br0 in_port=0,dl_vlan=0,dl_vlan_pcp=1,actions=output:19
1730 ovs-ofctl add-flow br0 in_port=0,dl_vlan=0,actions=output:20
1731 ovs-ofctl add-flow br0 in_port=0,dl_vlan_pcp=0,actions=output:21
1732 ovs-ofctl add-flow br0 in_port=0,dl_vlan_pcp=1,actions=output:22
1733 ovs-ofctl add-flow br0 in_port=0,actions=output:23
1734 ovs-ofctl mod-flows br0 cookie=5,dl_vlan=123,actions=output:3
1735 ovs-ofctl del-flows br0 dl_vlan=123
1736 ovs-ofctl del-flows br0
1737 ovs-appctl -t ovs-ofctl ofctl/barrier
1738 sort='
1739     # Sorts groups of lines that start with a space, without moving them
1740     # past the nearest line that does not start with a space.
1741     use warnings;
1742     use strict;
1743     my @buffer = ();
1744     while (<STDIN>) {
1745         if (/^ /) {
1746             push(@buffer, $_);
1747         } else {
1748             print $_ foreach sort(@buffer);
1749             print $_;
1750             @buffer = ();
1751         }
1752     }
1753     print $_ foreach sort(@buffer);
1754 '
1755 AT_CHECK([sed 's/ (xid=0x[[1-9a-fA-F]][[0-9a-fA-F]]*)//' monitor.log | ${PERL} -e "$sort"], [0],
1756 [NXST_FLOW_MONITOR reply (xid=0x0):
1757  event=ADDED table=0 cookie=0 in_port=0,dl_vlan=124 actions=output:2
1758 NXST_FLOW_MONITOR reply (xid=0x0):
1759  event=ADDED table=0 cookie=0 in_port=0,dl_vlan=123 actions=output:5
1760 NXST_FLOW_MONITOR reply (xid=0x0):
1761  event=ADDED table=0 cookie=0 in_port=0,dl_vlan=123,dl_vlan_pcp=0 actions=output:6
1762 NXST_FLOW_MONITOR reply (xid=0x0):
1763  event=ADDED table=0 cookie=0 in_port=0,dl_vlan=123,dl_vlan_pcp=1 actions=output:7
1764 NXST_FLOW_MONITOR reply (xid=0x0):
1765  event=ADDED table=0 cookie=0 in_port=0,dl_vlan=123 actions=output:8
1766 NXST_FLOW_MONITOR reply (xid=0x0):
1767  event=ADDED table=0 cookie=0 in_port=0,dl_vlan=0,dl_vlan_pcp=0 actions=output:9
1768 NXST_FLOW_MONITOR reply (xid=0x0):
1769  event=ADDED table=0 cookie=0 in_port=0,dl_vlan=0,dl_vlan_pcp=1 actions=output:10
1770 NXST_FLOW_MONITOR reply (xid=0x0):
1771  event=ADDED table=0 cookie=0 in_port=0,vlan_tci=0x0000 actions=output:11
1772 NXST_FLOW_MONITOR reply (xid=0x0):
1773  event=ADDED table=0 cookie=0 in_port=0,dl_vlan=4095,dl_vlan_pcp=0 actions=output:12
1774 NXST_FLOW_MONITOR reply (xid=0x0):
1775  event=ADDED table=0 cookie=0 in_port=0,dl_vlan=4095,dl_vlan_pcp=1 actions=output:13
1776 NXST_FLOW_MONITOR reply (xid=0x0):
1777  event=ADDED table=0 cookie=0 in_port=0,dl_vlan=4095 actions=output:14
1778 NXST_FLOW_MONITOR reply (xid=0x0):
1779  event=ADDED table=0 cookie=0 in_port=0,dl_vlan=0,dl_vlan_pcp=0 actions=output:15
1780 NXST_FLOW_MONITOR reply (xid=0x0):
1781  event=ADDED table=0 cookie=0 in_port=0,dl_vlan=0,dl_vlan_pcp=1 actions=output:16
1782 NXST_FLOW_MONITOR reply (xid=0x0):
1783  event=ADDED table=0 cookie=0 in_port=0,dl_vlan=0 actions=output:17
1784 NXST_FLOW_MONITOR reply (xid=0x0):
1785  event=ADDED table=0 cookie=0 in_port=0,dl_vlan=0,dl_vlan_pcp=0 actions=output:18
1786 NXST_FLOW_MONITOR reply (xid=0x0):
1787  event=ADDED table=0 cookie=0 in_port=0,dl_vlan=0,dl_vlan_pcp=1 actions=output:19
1788 NXST_FLOW_MONITOR reply (xid=0x0):
1789  event=ADDED table=0 cookie=0 in_port=0,dl_vlan=0 actions=output:20
1790 NXST_FLOW_MONITOR reply (xid=0x0):
1791  event=ADDED table=0 cookie=0 in_port=0,dl_vlan_pcp=0 actions=output:21
1792 NXST_FLOW_MONITOR reply (xid=0x0):
1793  event=ADDED table=0 cookie=0 in_port=0,dl_vlan_pcp=1 actions=output:22
1794 NXST_FLOW_MONITOR reply (xid=0x0):
1795  event=ADDED table=0 cookie=0 in_port=0 actions=output:23
1796 NXST_FLOW_MONITOR reply (xid=0x0):
1797  event=MODIFIED table=0 cookie=0x5 in_port=0,dl_vlan=123 actions=output:3
1798  event=MODIFIED table=0 cookie=0x5 in_port=0,dl_vlan=123,dl_vlan_pcp=0 actions=output:3
1799  event=MODIFIED table=0 cookie=0x5 in_port=0,dl_vlan=123,dl_vlan_pcp=1 actions=output:3
1800 NXST_FLOW_MONITOR reply (xid=0x0):
1801  event=DELETED reason=delete table=0 cookie=0x5 in_port=0,dl_vlan=123 actions=output:3
1802  event=DELETED reason=delete table=0 cookie=0x5 in_port=0,dl_vlan=123,dl_vlan_pcp=0 actions=output:3
1803  event=DELETED reason=delete table=0 cookie=0x5 in_port=0,dl_vlan=123,dl_vlan_pcp=1 actions=output:3
1804 NXST_FLOW_MONITOR reply (xid=0x0):
1805  event=DELETED reason=delete table=0 cookie=0 in_port=0 actions=output:23
1806  event=DELETED reason=delete table=0 cookie=0 in_port=0,dl_vlan=0 actions=output:20
1807  event=DELETED reason=delete table=0 cookie=0 in_port=0,dl_vlan=0,dl_vlan_pcp=0 actions=output:18
1808  event=DELETED reason=delete table=0 cookie=0 in_port=0,dl_vlan=0,dl_vlan_pcp=1 actions=output:19
1809  event=DELETED reason=delete table=0 cookie=0 in_port=0,dl_vlan=124 actions=output:2
1810  event=DELETED reason=delete table=0 cookie=0 in_port=0,dl_vlan=4095 actions=output:14
1811  event=DELETED reason=delete table=0 cookie=0 in_port=0,dl_vlan=4095,dl_vlan_pcp=0 actions=output:12
1812  event=DELETED reason=delete table=0 cookie=0 in_port=0,dl_vlan=4095,dl_vlan_pcp=1 actions=output:13
1813  event=DELETED reason=delete table=0 cookie=0 in_port=0,dl_vlan_pcp=0 actions=output:21
1814  event=DELETED reason=delete table=0 cookie=0 in_port=0,dl_vlan_pcp=1 actions=output:22
1815  event=DELETED reason=delete table=0 cookie=0 in_port=0,vlan_tci=0x0000 actions=output:11
1816 OFPT_BARRIER_REPLY:
1817 ])
1818
1819 # Check that our own changes are reported as abbreviations.
1820 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
1821 ovs-ofctl add-flow br0 in_port=1,actions=output:2
1822 ovs-ofctl add-flow br0 in_port=2,actions=output:1
1823 ovs-appctl -t ovs-ofctl ofctl/barrier
1824 ovs-appctl -t ovs-ofctl ofctl/send 010e004812345678003fffff00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003000000000000ffffffffffff0000
1825 ovs-appctl -t ovs-ofctl ofctl/barrier
1826 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip], [0], [NXST_FLOW reply:
1827 ])
1828 AT_CHECK([sed 's/ (xid=0x[[1-9a-fA-F]][[0-9a-fA-F]]*)//' monitor.log], [0],
1829 [NXST_FLOW_MONITOR reply (xid=0x0):
1830  event=ADDED table=0 cookie=0 in_port=1 actions=output:2
1831 NXST_FLOW_MONITOR reply (xid=0x0):
1832  event=ADDED table=0 cookie=0 in_port=2 actions=output:1
1833 OFPT_BARRIER_REPLY:
1834 send: OFPT_FLOW_MOD: DEL priority=0 actions=drop
1835 NXST_FLOW_MONITOR reply (xid=0x0):
1836  event=ABBREV xid=0x12345678
1837 OFPT_BARRIER_REPLY:
1838 ])
1839
1840 ovs-appctl -t ovs-ofctl exit
1841 OVS_VSWITCHD_STOP
1842 AT_CLEANUP
1843
1844 AT_SETUP([ofproto - flow monitoring pause and resume])
1845 AT_KEYWORDS([monitor])
1846
1847 # The maximum socket receive buffer size is important for this test, which
1848 # tests behavior when the receive buffer overflows.
1849 if test -e /proc/sys/net/core/rmem_max; then
1850     # Linux
1851     rmem_max=`cat /proc/sys/net/core/rmem_max`
1852 elif rmem_max=`sysctl -n net.inet.tcp.recvbuf_max 2>/dev/null`; then
1853     : # FreeBSD, NetBSD
1854 else
1855     # Don't know how to get maximum socket receive buffer on this OS
1856     AT_SKIP_IF([:])
1857 fi
1858 # Calculate the total amount of queuing: rmem_max in the kernel, 128 kB
1859 # in ofproto sending userspace (see ofmonitor_flush() in connmgr.c).
1860 queue_size=`expr $rmem_max + 128 \* 1024`
1861 echo rmem_max=$rmem_max queue_size=$queue_size
1862
1863 # Each flow update message takes up at least 48 bytes of space in queues
1864 # and in practice more than that.
1865 n_msgs=`expr $queue_size / 48`
1866 echo n_msgs=$n_msgs
1867
1868 OVS_VSWITCHD_START
1869
1870 # Start a monitor watching the flow table, then make it block.
1871 ON_EXIT([kill `cat ovs-ofctl.pid`])
1872 ovs-ofctl monitor br0 watch: --detach --no-chdir --pidfile >monitor.log 2>&1
1873 AT_CAPTURE_FILE([monitor.log])
1874 ovs-appctl -t ovs-ofctl ofctl/block
1875
1876 # Add $n_msgs flows.
1877 (echo "in_port=2,actions=output:2"
1878 ${PERL} -e '
1879     for ($i = 0; $i < '$n_msgs'; $i++) {
1880         print "cookie=1,reg1=$i,actions=drop\n";
1881     }
1882 ') > flows.txt
1883 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
1884 # Check that multipart flow dumps work properly:
1885 AT_CHECK([ovs-ofctl diff-flows br0 flows.txt])
1886 AT_CHECK([ovs-ofctl add-flow br0 in_port=1,cookie=3,actions=drop])
1887 AT_CHECK([ovs-ofctl mod-flows br0 in_port=2,cookie=2,actions=output:2])
1888 AT_CHECK([ovs-ofctl del-flows br0 cookie=1/-1])
1889
1890 ovs-appctl -t ovs-ofctl ofctl/unblock
1891 ovs-appctl -t ovs-ofctl ofctl/barrier
1892
1893 ovs-appctl -t ovs-ofctl exit
1894
1895 # Check that the flow monitor reported the same number of flows
1896 # added and deleted, but fewer than we actually added and deleted.
1897 adds=`grep -c 'ADDED.*reg1=' monitor.log`
1898 deletes=`grep -c 'DELETED.*reg1=' monitor.log`
1899 echo adds=$adds deletes=$deletes
1900 AT_CHECK([test $adds -gt 100 && test $adds -lt $n_msgs])
1901 AT_CHECK([test $adds = $deletes])
1902
1903 # Check that the flow monitor reported everything in the expected order:
1904 #
1905 #     event=ADDED table=0 cookie=0x1 reg1=0x22
1906 # ...
1907 #    NXT_FLOW_MONITOR_PAUSED:
1908 # ...
1909 #     event=DELETED reason=delete table=0 cookie=0x1 reg1=0x22
1910 # ...
1911 #     event=ADDED table=0 cookie=0x3 in_port=1
1912 #     event=MODIFIED table=0 cookie=0x2 in_port=2 actions=output:2
1913 #    NXT_FLOW_MONITOR_RESUMED:
1914 #
1915 # except that, between the PAUSED and RESUMED, the order of the ADDED
1916 # and MODIFIED lines lines depends on hash order, that is, it varies
1917 # as we change the hash function or change architecture.  Therefore,
1918 # we use a couple of tests below to accept both orders.
1919 AT_CHECK([ofctl_strip < monitor.log | sed -n -e '
1920 /reg1=0x22$/p
1921 /cookie=0x[[23]]/p
1922 /NXT_FLOW_MONITOR_PAUSED:/p
1923 /NXT_FLOW_MONITOR_RESUMED:/p
1924 ' > monitor.log.subset])
1925 AT_CHECK([grep -v MODIFIED monitor.log.subset], [0], [dnl
1926  event=ADDED table=0 cookie=0x1 reg1=0x22
1927 NXT_FLOW_MONITOR_PAUSED:
1928  event=DELETED reason=delete table=0 cookie=0x1 reg1=0x22
1929  event=ADDED table=0 cookie=0x3 in_port=1
1930 NXT_FLOW_MONITOR_RESUMED:
1931 ])
1932 AT_CHECK([grep -v ADDED monitor.log.subset], [0], [dnl
1933 NXT_FLOW_MONITOR_PAUSED:
1934  event=DELETED reason=delete table=0 cookie=0x1 reg1=0x22
1935  event=MODIFIED table=0 cookie=0x2 in_port=2 actions=output:2
1936 NXT_FLOW_MONITOR_RESUMED:
1937 ])
1938
1939 OVS_VSWITCHD_STOP
1940 AT_CLEANUP
1941
1942 AT_SETUP([ofproto - event filtering (OpenFlow 1.3)])
1943 AT_KEYWORDS([monitor])
1944 OVS_VSWITCHD_START
1945
1946 # Start a monitor, use the required protocol version
1947 ovs-ofctl -O OpenFlow13 monitor br0 --detach --no-chdir --pidfile >monitor.log 2>&1
1948 AT_CAPTURE_FILE([monitor.log])
1949
1950 # Send an OpenFlow13 message (04), OFPT_GET_ASYNC_REQUEST (1a), length (8), xid (0a)
1951 ovs-appctl -t ovs-ofctl ofctl/send 041a00080000000a
1952 ovs-appctl -t ovs-ofctl ofctl/barrier
1953
1954 # Check default setting
1955 read -r -d '' expected <<'EOF'
1956 EOF
1957
1958 AT_CHECK([ofctl_strip < monitor.log], [], [dnl
1959 send: OFPT_GET_ASYNC_REQUEST (OF1.3):
1960 OFPT_GET_ASYNC_REPLY (OF1.3):
1961  master:
1962        PACKET_IN: no_match action
1963      PORT_STATUS: add delete modify
1964     FLOW_REMOVED: idle hard delete
1965
1966  slave:
1967        PACKET_IN: (off)
1968      PORT_STATUS: add delete modify
1969     FLOW_REMOVED: (off)
1970 OFPT_BARRIER_REPLY (OF1.3):
1971 ])
1972
1973 OVS_VSWITCHD_STOP
1974 AT_CLEANUP