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