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