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