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