]> git.proxmox.com Git - mirror_ovs.git/blame - tests/ofproto.at
Implement OF1.3 extension for OF1.4 role status feature.
[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 9AT_SETUP([ofproto - handling messages with bad version])
68030e16 10AT_KEYWORDS([monitor])
2b4cca6f
BP
11OVS_VSWITCHD_START
12
13# Start a monitor running OpenFlow 1.0, then send the switch an OF1.1 features
14# request
6409e008 15AT_CHECK([ovs-ofctl -P standard monitor br0 --detach --no-chdir --pidfile])
2b4cca6f
BP
16ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
17AT_CAPTURE_FILE([monitor.log])
18ovs-appctl -t ovs-ofctl ofctl/send 0205000801234567
19ovs-appctl -t ovs-ofctl ofctl/barrier
d9c8c57c 20OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
2b4cca6f
BP
21
22AT_CHECK([sed 's/ (xid=0x[[0-9a-fA-F]]*)//
23/ECHO/d' monitor.log], [0], [dnl
24send: OFPT_FEATURES_REQUEST (OF1.1):
25OFPT_ERROR (OF1.1): OFPBRC_BAD_VERSION
26OFPT_FEATURES_REQUEST (OF1.1):
27OFPT_BARRIER_REPLY:
28])
29
30OVS_VSWITCHD_STOP(["/received OpenFlow version 0x02 != expected 01/d"])
31AT_CLEANUP
32
a2cb9dfd 33AT_SETUP([ofproto - feature request, config request])
023e1e0a 34OVS_VSWITCHD_START
ea523221 35AT_CHECK([ovs-ofctl -vwarn show br0], [0], [stdout])
8a32aaa5 36AT_CHECK([strip_xids < stdout], [0], [dnl
9e1fd49b 37OFPT_FEATURES_REPLY: dpid:fedcba9876543210
c184807c 38n_tables:254, n_buffers:0
9e1fd49b 39capabilities: FLOW_STATS TABLE_STATS PORT_STATS QUEUE_STATS ARP_MATCH_IP
08d1e234 40actions: output enqueue set_vlan_vid set_vlan_pcp strip_vlan mod_dl_src mod_dl_dst mod_nw_src mod_nw_dst mod_nw_tos mod_tp_src mod_tp_dst
0ab14c8e 41 LOCAL(br0): addr:aa:55:aa:55:00:00
1839c356
FL
42 config: PORT_DOWN
43 state: LINK_DOWN
d02a5f8e 44 speed: 0 Mbps now, 0 Mbps max
3b62feba 45OFPT_GET_CONFIG_REPLY: frags=normal miss_send_len=0
a2cb9dfd 46])
023e1e0a 47OVS_VSWITCHD_STOP
81816a5f
JP
48AT_CLEANUP
49
50AT_SETUP([ofproto - set OpenFlow port number])
51OVS_VSWITCHD_START(
52 [add-port br0 p1 -- set Interface p1 type=dummy --\
53 add-port br0 p2 -- set Interface p2 type=dummy ofport_request=99])
54AT_CHECK([ovs-ofctl -vwarn show br0], [0], [stdout])
e44768b7
JP
55AT_CHECK([[sed '
56s/ (xid=0x[0-9a-fA-F]*)//
57s/00:0.$/00:0x/' < stdout]],
58 [0], [dnl
81816a5f 59OFPT_FEATURES_REPLY: dpid:fedcba9876543210
c184807c 60n_tables:254, n_buffers:0
81816a5f 61capabilities: FLOW_STATS TABLE_STATS PORT_STATS QUEUE_STATS ARP_MATCH_IP
08d1e234 62actions: output enqueue set_vlan_vid set_vlan_pcp strip_vlan mod_dl_src mod_dl_dst mod_nw_src mod_nw_dst mod_nw_tos mod_tp_src mod_tp_dst
e44768b7 63 1(p1): addr:aa:55:aa:55:00:0x
81816a5f
JP
64 config: PORT_DOWN
65 state: LINK_DOWN
d02a5f8e 66 speed: 0 Mbps now, 0 Mbps max
e44768b7 67 99(p2): addr:aa:55:aa:55:00:0x
81816a5f
JP
68 config: PORT_DOWN
69 state: LINK_DOWN
d02a5f8e 70 speed: 0 Mbps now, 0 Mbps max
e44768b7 71 LOCAL(br0): addr:aa:55:aa:55:00:0x
1839c356
FL
72 config: PORT_DOWN
73 state: LINK_DOWN
d02a5f8e 74 speed: 0 Mbps now, 0 Mbps max
81816a5f
JP
75OFPT_GET_CONFIG_REPLY: frags=normal miss_send_len=0
76])
e44768b7 77
81816a5f 78OVS_VSWITCHD_STOP
a2cb9dfd
BP
79AT_CLEANUP
80
eaa6eb2a
BP
81dnl This is really bare-bones.
82dnl It at least checks request and reply serialization and deserialization.
9dcd1c00 83AT_SETUP([ofproto - port stats - (OpenFlow 1.0)])
023e1e0a 84OVS_VSWITCHD_START
ea523221 85AT_CHECK([ovs-ofctl -vwarn dump-ports br0], [0], [stdout])
8a32aaa5 86AT_CHECK([strip_xids < stdout], [0], [dnl
eaa6eb2a 87OFPST_PORT reply: 1 ports
d6e3feb5 88 port LOCAL: rx pkts=0, bytes=0, drop=?, errs=?, frame=?, over=?, crc=?
89 tx pkts=0, bytes=0, drop=?, errs=?, coll=?
eaa6eb2a 90])
023e1e0a 91OVS_VSWITCHD_STOP
eaa6eb2a
BP
92AT_CLEANUP
93
9dcd1c00
SH
94AT_SETUP([ofproto - port stats - (OpenFlow 1.2)])
95OVS_VSWITCHD_START
96AT_CHECK([ovs-ofctl -O OpenFlow12 -vwarn dump-ports br0], [0], [stdout])
8a32aaa5 97AT_CHECK([strip_xids < stdout], [0], [dnl
9dcd1c00 98OFPST_PORT reply (OF1.2): 1 ports
d6e3feb5 99 port LOCAL: rx pkts=0, bytes=0, drop=?, errs=?, frame=?, over=?, crc=?
100 tx pkts=0, bytes=0, drop=?, errs=?, coll=?
9dcd1c00
SH
101])
102OVS_VSWITCHD_STOP
103AT_CLEANUP
104
5469537b
BP
105AT_SETUP([ofproto - port stats - (OpenFlow 1.4)])
106OVS_VSWITCHD_START
107AT_CHECK([ovs-ofctl -O OpenFlow14 -vwarn dump-ports br0], [0], [stdout])
8a32aaa5 108AT_CHECK([strip_xids < stdout | sed 's/duration=[[0-9.]]*s/duration=?s/'],
5469537b
BP
109 [0], [dnl
110OFPST_PORT reply (OF1.4): 1 ports
d6e3feb5 111 port LOCAL: rx pkts=0, bytes=0, drop=?, errs=?, frame=?, over=?, crc=?
112 tx pkts=0, bytes=0, drop=?, errs=?, coll=?
5469537b 113 duration=?s
971f4b39
MW
114 CUSTOM Statistics
115 rx_custom_packets_1=0, rx_custom_packets_2=0,
5469537b
BP
116])
117OVS_VSWITCHD_STOP
118AT_CLEANUP
119
2be393ed
JP
120dnl This is really bare-bones.
121dnl It at least checks request and reply serialization and deserialization.
9dcd1c00 122AT_SETUP([ofproto - port-desc stats (OpenFlow 1.0)])
2be393ed
JP
123OVS_VSWITCHD_START
124AT_CHECK([ovs-ofctl -vwarn dump-ports-desc br0], [0], [stdout])
8a32aaa5 125AT_CHECK([strip_xids < stdout], [0], [dnl
2be393ed
JP
126OFPST_PORT_DESC reply:
127 LOCAL(br0): addr:aa:55:aa:55:00:00
1839c356
FL
128 config: PORT_DOWN
129 state: LINK_DOWN
d02a5f8e 130 speed: 0 Mbps now, 0 Mbps max
2be393ed
JP
131])
132OVS_VSWITCHD_STOP
133AT_CLEANUP
134
eaa6eb2a
BP
135dnl This is really bare-bones.
136dnl It at least checks request and reply serialization and deserialization.
9dcd1c00
SH
137AT_SETUP([ofproto - port-desc stats (OpenFlow 1.2)])
138OVS_VSWITCHD_START
139AT_CHECK([ovs-ofctl -O OpenFlow12 -vwarn dump-ports-desc br0], [0], [stdout])
8a32aaa5 140AT_CHECK([strip_xids < stdout], [0], [dnl
9dcd1c00
SH
141OFPST_PORT_DESC reply (OF1.2):
142 LOCAL(br0): addr:aa:55:aa:55:00:00
1839c356
FL
143 config: PORT_DOWN
144 state: LINK_DOWN
9dcd1c00
SH
145 speed: 0 Mbps now, 0 Mbps max
146])
147OVS_VSWITCHD_STOP
148AT_CLEANUP
149
70ae4f93
BP
150AT_SETUP([ofproto - port-desc stats (OpenFlow 1.5)])
151OVS_VSWITCHD_START
ca5792f0 152add_of_ports br0 1 2 3
70ae4f93 153AT_CHECK([ovs-ofctl -F OXM-OpenFlow15 -O OpenFlow15 -vwarn dump-ports-desc br0], [0], [stdout])
8a32aaa5 154AT_CHECK([strip_xids < stdout | sed 's/00:0./00:0x/'], [0], [dnl
70ae4f93
BP
155OFPST_PORT_DESC reply (OF1.5):
156 1(p1): addr:aa:55:aa:55:00:0x
157 config: PORT_DOWN
158 state: LINK_DOWN
159 speed: 0 Mbps now, 0 Mbps max
160 2(p2): addr:aa:55:aa:55:00:0x
161 config: PORT_DOWN
162 state: LINK_DOWN
163 speed: 0 Mbps now, 0 Mbps max
164 3(p3): addr:aa:55:aa:55:00:0x
165 config: PORT_DOWN
166 state: LINK_DOWN
167 speed: 0 Mbps now, 0 Mbps max
168 LOCAL(br0): addr:aa:55:aa:55:00:0x
169 config: PORT_DOWN
170 state: LINK_DOWN
171 speed: 0 Mbps now, 0 Mbps max
172])
173AT_CHECK([ovs-ofctl -F OXM-OpenFlow15 -O OpenFlow15 -vwarn dump-ports-desc br0 2], [0], [stdout])
8a32aaa5 174AT_CHECK([strip_xids < stdout | sed 's/00:0./00:0x/'], [0], [dnl
70ae4f93
BP
175OFPST_PORT_DESC reply (OF1.5):
176 2(p2): addr:aa:55:aa:55:00:0x
177 config: PORT_DOWN
178 state: LINK_DOWN
179 speed: 0 Mbps now, 0 Mbps max
180])
181OVS_VSWITCHD_STOP
182AT_CLEANUP
183
2f2b904f
BP
184AT_SETUP([ofproto - port-desc stats (OpenFlow 1.6)])
185OVS_VSWITCHD_START
186add_of_ports br0 1 2 3
187AT_CHECK([ovs-ofctl -F OXM-OpenFlow16 -O OpenFlow16 -vwarn dump-ports-desc br0], [0], [stdout])
188AT_CHECK([strip_xids < stdout | sed 's/00:0./00:0x/'], [0], [dnl
189OFPST_PORT_DESC reply (OF1.6):
190 1(p1): addr:aa:55:aa:55:00:0x
191 config: PORT_DOWN
192 state: LINK_DOWN
193 speed: 0 Mbps now, 0 Mbps max
194 2(p2): addr:aa:55:aa:55:00:0x
195 config: PORT_DOWN
196 state: LINK_DOWN
197 speed: 0 Mbps now, 0 Mbps max
198 3(p3): addr:aa:55:aa:55:00:0x
199 config: PORT_DOWN
200 state: LINK_DOWN
201 speed: 0 Mbps now, 0 Mbps max
202 LOCAL(br0): addr:aa:55:aa:55:00:0x
203 config: PORT_DOWN
204 state: LINK_DOWN
205 speed: 0 Mbps now, 0 Mbps max
206])
207AT_CHECK([ovs-ofctl -F OXM-OpenFlow16 -O OpenFlow16 -vwarn dump-ports-desc br0 2], [0], [stdout])
208AT_CHECK([strip_xids < stdout | sed 's/00:0./00:0x/'], [0], [dnl
209OFPST_PORT_DESC reply (OF1.6):
210 2(p2): addr:aa:55:aa:55:00:0x
211 config: PORT_DOWN
212 state: LINK_DOWN
213 speed: 0 Mbps now, 0 Mbps max
214])
215OVS_VSWITCHD_STOP
216AT_CLEANUP
217
f72dff1a
BP
218dnl CHECK_QUEUE_STATS(label, option, format)
219m4_define([CHECK_QUEUE_STATS], [
220AT_SETUP([ofproto - queue stats - (OpenFlow $1)])
023e1e0a 221OVS_VSWITCHD_START
f72dff1a 222
8a32aaa5 223AT_CHECK([ovs-ofctl -O $2 queue-stats br0 | strip_xids], [0],
f72dff1a
BP
224 [OFPST_QUEUE reply$3: 1 queues
225 port LOCAL queue 0: bytes=?, pkts=?, errors=?, duration=?
0414d158 226])
eaa6eb2a 227
8a32aaa5 228AT_CHECK([ovs-ofctl -O $2 queue-stats br0 LOCAL | strip_xids], [0],
f72dff1a
BP
229 [OFPST_QUEUE reply$3: 1 queues
230 port LOCAL queue 0: bytes=?, pkts=?, errors=?, duration=?
9dcd1c00 231])
f72dff1a 232
8a32aaa5 233AT_CHECK([ovs-ofctl -O $2 queue-stats br0 LOCAL 0 | strip_xids], [0],
f72dff1a
BP
234 [OFPST_QUEUE reply$3: 1 queues
235 port LOCAL queue 0: bytes=?, pkts=?, errors=?, duration=?
9dcd1c00 236])
f72dff1a 237
8a32aaa5 238AT_CHECK([ovs-ofctl -O $2 queue-stats br0 ANY 0 | strip_xids], [0],
f72dff1a
BP
239 [OFPST_QUEUE reply$3: 1 queues
240 port LOCAL queue 0: bytes=?, pkts=?, errors=?, duration=?
9dcd1c00 241])
9dcd1c00 242
8a32aaa5 243AT_CHECK([ovs-ofctl -O $2 queue-stats br0 LOCAL 5 | strip_xids], [0],
f72dff1a
BP
244 [OFPT_ERROR$3: OFPQOFC_BAD_QUEUE
245OFPST_QUEUE request$3: port=LOCAL queue=5
1bb2cdbe 246])
f72dff1a 247
8a32aaa5 248AT_CHECK([ovs-ofctl -O $2 queue-stats br0 ANY 5 | strip_xids], [0],
f72dff1a
BP
249 [OFPT_ERROR$3: OFPQOFC_BAD_QUEUE
250OFPST_QUEUE request$3: port=ANY queue=5
1bb2cdbe 251])
f72dff1a 252
8a32aaa5 253AT_CHECK([ovs-ofctl -O $2 queue-stats br0 10 | strip_xids], [0],
f72dff1a
BP
254 [OFPT_ERROR$3: OFPQOFC_BAD_PORT
255OFPST_QUEUE request$3: port=10 queue=ALL
1bb2cdbe
BP
256])
257OVS_VSWITCHD_STOP
258AT_CLEANUP
f72dff1a
BP
259])
260CHECK_QUEUE_STATS([1.0], [OpenFlow10], [])
261CHECK_QUEUE_STATS([1.1], [OpenFlow11], [ (OF1.1)])
262CHECK_QUEUE_STATS([1.2], [OpenFlow12], [ (OF1.2)])
263CHECK_QUEUE_STATS([1.3], [OpenFlow13], [ (OF1.3)])
264CHECK_QUEUE_STATS([1.4], [OpenFlow14], [ (OF1.4)])
1bb2cdbe 265
e8f9a7bb
VG
266dnl This is really bare-bones.
267dnl It at least checks request and reply serialization and deserialization.
268AT_SETUP([ofproto - queue configuration - (OpenFlow 1.0)])
269OVS_VSWITCHD_START
ca5792f0 270add_of_ports br0 1 2
e8f9a7bb 271AT_CHECK([ovs-ofctl queue-get-config br0 1], [0], [stdout])
8a32aaa5 272AT_CHECK([strip_xids < stdout], [0], [dnl
e8f9a7bb 273OFPT_QUEUE_GET_CONFIG_REPLY: port=1
f72dff1a 274queue 0:
e8f9a7bb 275])
56085be5 276AT_CHECK([ovs-ofctl queue-get-config br0], [0], [stdout])
8a32aaa5 277AT_CHECK([strip_xids < stdout | sort], [0], [dnl
56085be5
BP
278OFPT_QUEUE_GET_CONFIG_REPLY: port=1
279OFPT_QUEUE_GET_CONFIG_REPLY: port=2
f72dff1a
BP
280queue 0:
281queue 0:
56085be5 282])
e8f9a7bb
VG
283AT_CHECK([ovs-ofctl queue-get-config br0 10], [0],
284 [OFPT_ERROR (xid=0x2): OFPQOFC_BAD_PORT
285OFPT_QUEUE_GET_CONFIG_REQUEST (xid=0x2): port=10
286])
287OVS_VSWITCHD_STOP
288AT_CLEANUP
289
d2e5fa1f
BP
290AT_SETUP([ofproto - queue configuration - (OpenFlow 1.1)])
291OVS_VSWITCHD_START
ca5792f0 292add_of_ports br0 1 2
e016fb63 293AT_CHECK([ovs-ofctl -O OpenFlow11 queue-get-config br0 1], [0], [stdout])
8a32aaa5 294AT_CHECK([strip_xids < stdout], [0], [dnl
e016fb63 295OFPT_QUEUE_GET_CONFIG_REPLY (OF1.1): port=1
f72dff1a 296queue 0:
d2e5fa1f 297])
8a32aaa5 298AT_CHECK([ovs-ofctl -O OpenFlow11 queue-get-config br0 10 | strip_xids], [0],
e016fb63
BP
299 [OFPT_ERROR (OF1.1): OFPQOFC_BAD_PORT
300OFPT_QUEUE_GET_CONFIG_REQUEST (OF1.1): port=10
d2e5fa1f
BP
301])
302OVS_VSWITCHD_STOP
303AT_CLEANUP
304
e8f9a7bb
VG
305AT_SETUP([ofproto - queue configuration - (OpenFlow 1.2)])
306OVS_VSWITCHD_START
ca5792f0 307add_of_ports br0 1 2
e8f9a7bb 308AT_CHECK([ovs-ofctl -O OpenFlow12 queue-get-config br0 1], [0], [stdout])
8a32aaa5 309AT_CHECK([strip_xids < stdout], [0], [dnl
e8f9a7bb 310OFPT_QUEUE_GET_CONFIG_REPLY (OF1.2): port=1
f72dff1a 311queue 0:
e8f9a7bb 312])
56085be5 313AT_CHECK([ovs-ofctl -O OpenFlow12 queue-get-config br0 ANY], [0], [stdout])
8a32aaa5 314AT_CHECK([strip_xids < stdout], [0], [dnl
56085be5 315OFPT_QUEUE_GET_CONFIG_REPLY (OF1.2): port=ANY
f72dff1a
BP
316queue 0:
317queue 0:
318queue 0:
56085be5 319])
8a32aaa5 320AT_CHECK([ovs-ofctl -O OpenFlow12 queue-get-config br0 10 | strip_xids], [0],
e016fb63
BP
321 [OFPT_ERROR (OF1.2): OFPQOFC_BAD_PORT
322OFPT_QUEUE_GET_CONFIG_REQUEST (OF1.2): port=10
323])
324OVS_VSWITCHD_STOP
325AT_CLEANUP
326
327AT_SETUP([ofproto - queue configuration - (OpenFlow 1.4)])
328OVS_VSWITCHD_START
ca5792f0 329add_of_ports br0 1 2
e016fb63 330
8a32aaa5 331AT_CHECK([ovs-ofctl -O OpenFlow14 queue-get-config br0 any | strip_xids], [0],
e016fb63
BP
332 [OFPST_QUEUE_DESC reply (OF1.4): port=1
333queue 0:
e016fb63
BP
334port=2
335queue 0:
a28239c0
BP
336port=LOCAL
337queue 0:
e016fb63
BP
338])
339
8a32aaa5 340AT_CHECK([ovs-ofctl -O OpenFlow14 queue-get-config br0 1 | strip_xids], [0],
e016fb63
BP
341 [OFPST_QUEUE_DESC reply (OF1.4): port=1
342queue 0:
343])
344
8a32aaa5 345AT_CHECK([ovs-ofctl -O OpenFlow14 queue-get-config br0 10 | strip_xids], [0],
e016fb63
BP
346 [OFPT_ERROR (OF1.4): OFPQOFC_BAD_PORT
347OFPST_QUEUE_DESC request (OF1.4): port=10
348])
349
8a32aaa5 350AT_CHECK([ovs-ofctl -O OpenFlow14 queue-get-config br0 1 2 | strip_xids], [0],
e016fb63
BP
351 [OFPT_ERROR (OF1.4): OFPQOFC_BAD_QUEUE
352OFPST_QUEUE_DESC request (OF1.4): port=1 queue=2
e8f9a7bb
VG
353])
354OVS_VSWITCHD_STOP
355AT_CLEANUP
356
05f589da
SH
357dnl This is really bare-bones.
358dnl It at least checks request and reply serialization and deserialization.
359dnl Actions definition listed in both supported formats (w/ actions=)
360AT_SETUP([ofproto - no group support (OpenFlow 1.0)])
361OVS_VSWITCHD_START
362AT_DATA([groups.txt], [dnl
363group_id=1234,type=all,bucket=output:10
364group_id=1235,type=all,bucket=actions=output:10
365])
366AT_DATA([stderr], [dnl
367ovs-ofctl: none of the usable flow formats (OXM,OpenFlow11) is among the allowed flow formats (OpenFlow10,NXM)
368])
369AT_CHECK([ovs-ofctl -O OpenFlow10 -vwarn add-groups br0 groups.txt], [1], ,[stderr])
370AT_CHECK([ovs-ofctl -O OpenFlow10 -vwarn mod-group br0 'group_id=1234,type=all,bucket=output:10'], [1], ,[stderr])
371AT_CHECK([ovs-ofctl -O OpenFlow10 -vwarn del-groups br0], [1], ,[stderr])
372AT_CHECK([ovs-ofctl -O OpenFlow10 -vwarn dump-groups br0 ], [1], ,[stderr])
373OVS_VSWITCHD_STOP
374AT_CLEANUP
375
433702fc
SH
376dnl This is really bare-bones.
377dnl It at least checks request and reply serialization and deserialization.
f1457c26 378dnl Actions definition listed in both supported formats (w/ actions=)
afc63bb4 379AT_SETUP([ofproto - del group (OpenFlow 1.1)])
433702fc
SH
380OVS_VSWITCHD_START
381AT_DATA([groups.txt], [dnl
382group_id=1234,type=all,bucket=output:10
f1457c26 383group_id=1235,type=all,bucket=actions=output:10
433702fc
SH
384])
385AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn add-groups br0 groups.txt])
afc63bb4 386AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn dump-groups br0 ], [0], [stdout])
db88b35c 387AT_CHECK([strip_xids < stdout | sort], [0], [dnl
afc63bb4
SH
388 group_id=1234,type=all,bucket=actions=output:10
389 group_id=1235,type=all,bucket=actions=output:10
db88b35c 390OFPST_GROUP_DESC reply (OF1.1):
19187a71 391])
433702fc
SH
392AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn del-groups br0 group_id=1234])
393AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn dump-groups br0], [0], [stdout])
8a32aaa5 394AT_CHECK([strip_xids < stdout], [0], [dnl
433702fc
SH
395OFPST_GROUP_DESC reply (OF1.1):
396 group_id=1235,type=all,bucket=actions=output:10
397])
398AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn del-groups br0 group_id=1234])
399AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn dump-groups br0], [0], [stdout])
8a32aaa5 400AT_CHECK([strip_xids < stdout], [0], [dnl
433702fc
SH
401OFPST_GROUP_DESC reply (OF1.1):
402 group_id=1235,type=all,bucket=actions=output:10
403])
404AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn del-groups br0], [0])
405AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn dump-groups br0], [0], [stdout])
8a32aaa5 406AT_CHECK([strip_xids < stdout], [0], [dnl
433702fc
SH
407OFPST_GROUP_DESC reply (OF1.1):
408])
aa6fb077
BP
409
410# Negative test.
411AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn del-groups br0 group_id=0xfffffff0],
412 [1], [], [ovs-ofctl: invalid group id 4294967280
413])
433702fc
SH
414OVS_VSWITCHD_STOP
415AT_CLEANUP
416
e1799eb7
SH
417dnl This is really bare-bones.
418dnl It at least checks request and reply serialization and deserialization.
419dnl Actions definition listed in both supported formats (w/ actions=)
420AT_SETUP([ofproto - add indirect group])
421OVS_VSWITCHD_START
422dnl indirect group must have exactly one bucket
423AT_DATA([stderr], [dnl
424OFPT_ERROR (OF1.1) (xid=0x2): OFPGMFC_INVALID_GROUP
425OFPT_GROUP_MOD (OF1.1) (xid=0x2): ***decode error: OFPGMFC_INVALID_GROUP***
426])
427AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn add-group br0 'group_id=1234,type=indirect'], [1], , [stderr])
428AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn add-group br0 'group_id=1235,type=indirect,bucket=output:10'])
429AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn add-group br0 'group_id=1236,type=indirect,bucket=output:10,bucket=output:11'], [1], , [stderr])
430OVS_VSWITCHD_STOP
431AT_CLEANUP
432
25070e04 433AT_SETUP([ofproto - group mod with mod and add_or_mod command])
88b87a36
JS
434OVS_VSWITCHD_START
435dnl Check that mod-group for non-existing group fails without --may-create
436AT_DATA([stderr], [dnl
437OFPT_ERROR (OF1.3) (xid=0x2): OFPGMFC_UNKNOWN_GROUP
438OFPT_GROUP_MOD (OF1.3) (xid=0x2):
439 MOD group_id=1234,type=indirect,bucket=actions=output:2
440])
441AT_CHECK([ovs-ofctl -O OpenFlow13 -vwarn mod-group br0 'group_id=1234,type=indirect,bucket=actions=2'], [1], , [stderr])
442dnl Check that mod-group for non-existing group succeeds with --may-create
443AT_CHECK([ovs-ofctl -O OpenFlow13 -vwarn --may-create mod-group br0 'group_id=1234,type=indirect,bucket=actions=2'])
444AT_CHECK([ovs-ofctl -O OpenFlow13 -vwarn dump-groups br0], [0], [stdout])
445AT_CHECK([strip_xids < stdout], [0], [dnl
446OFPST_GROUP_DESC reply (OF1.3):
447 group_id=1234,type=indirect,bucket=actions=output:2
448])
449dnl Check that mod-group for existing group succeeds with --may-create
450AT_CHECK([ovs-ofctl -O OpenFlow13 -vwarn --may-create mod-group br0 'group_id=1234,type=indirect,bucket=actions=3'])
451AT_CHECK([ovs-ofctl -O OpenFlow13 -vwarn dump-groups br0], [0], [stdout])
452AT_CHECK([strip_xids < stdout], [0], [dnl
453OFPST_GROUP_DESC reply (OF1.3):
454 group_id=1234,type=indirect,bucket=actions=output:3
455])
456OVS_VSWITCHD_STOP
457AT_CLEANUP
458
afc63bb4
SH
459dnl This is really bare-bones.
460dnl It at least checks request and reply serialization and deserialization.
461dnl Actions definition listed in both supported formats (w/ actions=)
462AT_SETUP([ofproto - del group (OpenFlow 1.5)])
463OVS_VSWITCHD_START
464AT_DATA([groups.txt], [dnl
3986cae6 465group_id=1233,type=select,selection_method=hash,bucket=output:10,bucket=output:11
68dfc25b 466group_id=1234,type=select,selection_method=hash,fields(eth_dst,ip_dst,tcp_dst),bucket=output:10,bucket=output:11
afc63bb4 467group_id=1235,type=all,bucket=actions=output:12,bucket=bucket_id:0,actions=output:10,bucket=bucket_id:1,actions=output:11
53cc166a 468group_id=1236,type=select,selection_method=dp_hash,bucket=output:10,bucket=output:11
afc63bb4
SH
469])
470AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn add-groups br0 groups.txt])
471AT_CHECK([ovs-ofctl -F OXM-OpenFlow15 -O OpenFlow15 -vwarn dump-groups br0 1234], [0], [stdout])
8a32aaa5 472AT_CHECK([strip_xids < stdout], [0], [dnl
afc63bb4 473OFPST_GROUP_DESC reply (OF1.5):
68dfc25b 474 group_id=1234,type=select,selection_method=hash,fields(eth_dst,ip_dst,tcp_dst),bucket=bucket_id:0,actions=output:10,bucket=bucket_id:1,actions=output:11
afc63bb4
SH
475])
476AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn del-groups br0 group_id=1234])
477AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn dump-groups br0], [0], [stdout])
db88b35c 478AT_CHECK([strip_xids < stdout | sort], [0], [dnl
3986cae6 479 group_id=1233,type=select,selection_method=hash,bucket=bucket_id:0,actions=output:10,bucket=bucket_id:1,actions=output:11
db88b35c 480 group_id=1235,type=all,bucket=bucket_id:2,actions=output:12,bucket=bucket_id:0,actions=output:10,bucket=bucket_id:1,actions=output:11
53cc166a 481 group_id=1236,type=select,selection_method=dp_hash,bucket=bucket_id:0,actions=output:10,bucket=bucket_id:1,actions=output:11
db88b35c 482OFPST_GROUP_DESC reply (OF1.5):
afc63bb4
SH
483])
484AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn del-groups br0 group_id=1234])
485AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn dump-groups br0], [0], [stdout])
db88b35c 486AT_CHECK([strip_xids < stdout | sort], [0], [dnl
3986cae6 487 group_id=1233,type=select,selection_method=hash,bucket=bucket_id:0,actions=output:10,bucket=bucket_id:1,actions=output:11
db88b35c 488 group_id=1235,type=all,bucket=bucket_id:2,actions=output:12,bucket=bucket_id:0,actions=output:10,bucket=bucket_id:1,actions=output:11
53cc166a 489 group_id=1236,type=select,selection_method=dp_hash,bucket=bucket_id:0,actions=output:10,bucket=bucket_id:1,actions=output:11
db88b35c 490OFPST_GROUP_DESC reply (OF1.5):
afc63bb4
SH
491])
492AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn del-groups br0], [0])
493AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn dump-groups br0], [0], [stdout])
8a32aaa5 494AT_CHECK([strip_xids < stdout], [0], [dnl
afc63bb4
SH
495OFPST_GROUP_DESC reply (OF1.5):
496])
497OVS_VSWITCHD_STOP
498AT_CLEANUP
499
433702fc
SH
500dnl This is really bare-bones.
501dnl It at least checks request and reply serialization and deserialization.
502AT_SETUP([ofproto - del group deletes flows])
503OVS_VSWITCHD_START
504AT_DATA([groups.txt], [dnl
505group_id=1234,type=all,bucket=output:10
506group_id=1235,type=all,bucket=output:10
507])
508AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn add-groups br0 groups.txt])
509AT_DATA([flows.txt], [dnl
510tcp actions=group:1234
8b792aef 511table=2 udp actions=group:1235
433702fc
SH
512])
513AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn add-flows br0 flows.txt])
514AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn dump-flows br0 | ofctl_strip | sort],
515[0], [dnl
8b792aef 516 table=2, udp actions=group:1235
433702fc 517 tcp actions=group:1234
433702fc
SH
518OFPST_FLOW reply (OF1.1):
519])
520AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn del-groups br0 group_id=1234])
521AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn dump-flows br0 | ofctl_strip | sort],
522[0], [dnl
8b792aef 523 table=2, udp actions=group:1235
433702fc
SH
524OFPST_FLOW reply (OF1.1):
525])
526AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn del-groups br0 group_id=1234])
527AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn dump-flows br0 | ofctl_strip | sort],
528[0], [dnl
8b792aef 529 table=2, udp actions=group:1235
433702fc
SH
530OFPST_FLOW reply (OF1.1):
531])
532AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn del-groups br0])
533AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn dump-flows br0 | ofctl_strip | sort],
534[0], [dnl
535OFPST_FLOW reply (OF1.1):
536])
537OVS_VSWITCHD_STOP
538AT_CLEANUP
539
bdbb8426
SH
540dnl This is really bare-bones.
541dnl It at least checks request and reply serialization and deserialization.
542dnl Actions definition listed in both supported formats (w/ actions=)
25070e04 543AT_SETUP([ofproto - insert group buckets])
bdbb8426 544OVS_VSWITCHD_START
8e19e655 545# Add group with no buckets.
bdbb8426 546AT_DATA([groups.txt], [dnl
8e19e655 547group_id=1234,type=all
bdbb8426
SH
548])
549AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn add-groups br0 groups.txt])
550AT_CHECK([ovs-ofctl -F OXM-OpenFlow15 -O OpenFlow15 -vwarn dump-groups br0 1234], [0], [stdout])
8a32aaa5 551AT_CHECK([strip_xids < stdout], [0], [dnl
8e19e655
BP
552OFPST_GROUP_DESC reply (OF1.5):
553 group_id=1234,type=all
554])
555
556# Add two buckets, using "last".
557AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn insert-buckets br0 group_id=1234,command_bucket_id=last,bucket=bucket_id:10,actions=output:10,bucket=bucket_id:11,actions=output:11])
558AT_CHECK([ovs-ofctl -F OXM-OpenFlow15 -O OpenFlow15 -vwarn dump-groups br0 1234], [0], [stdout])
8a32aaa5 559AT_CHECK([strip_xids < stdout], [0], [dnl
8e19e655
BP
560OFPST_GROUP_DESC reply (OF1.5):
561 group_id=1234,type=all,bucket=bucket_id:10,actions=output:10,bucket=bucket_id:11,actions=output:11
562])
563
564# Start over again, then add two buckets using "first".
565AT_CHECK([ovs-ofctl -O OpenFlow15 --strict del-groups br0 group_id=1234])
566AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn add-group br0 group_id=1234,type=all])
567AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn insert-buckets br0 group_id=1234,command_bucket_id=first,bucket=bucket_id:10,actions=output:10,bucket=bucket_id:11,actions=output:11])
568AT_CHECK([ovs-ofctl -F OXM-OpenFlow15 -O OpenFlow15 -vwarn dump-groups br0 1234], [0], [stdout])
8a32aaa5 569AT_CHECK([strip_xids < stdout], [0], [dnl
bdbb8426
SH
570OFPST_GROUP_DESC reply (OF1.5):
571 group_id=1234,type=all,bucket=bucket_id:10,actions=output:10,bucket=bucket_id:11,actions=output:11
572])
8e19e655
BP
573
574# Add two more buckets before the existing ones.
bdbb8426
SH
575AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn insert-buckets br0 group_id=1234,command_bucket_id=first,bucket=bucket_id:0,actions=output:0,bucket=bucket_id:1,actions=output:1])
576AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn dump-groups br0], [0], [stdout])
8a32aaa5 577AT_CHECK([strip_xids < stdout], [0], [dnl
bdbb8426
SH
578OFPST_GROUP_DESC reply (OF1.5):
579 group_id=1234,type=all,bucket=bucket_id:0,actions=output:0,bucket=bucket_id:1,actions=output:1,bucket=bucket_id:10,actions=output:10,bucket=bucket_id:11,actions=output:11
580])
8e19e655
BP
581
582# Add another bucket at the end.
bdbb8426
SH
583AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn insert-buckets br0 group_id=1234,command_bucket_id=last,bucket=bucket_id:14,actions=output:14,bucket=bucket_id:15,actions=output:15])
584AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn dump-groups br0], [0], [stdout])
8a32aaa5 585AT_CHECK([strip_xids < stdout], [0], [dnl
bdbb8426
SH
586OFPST_GROUP_DESC reply (OF1.5):
587 group_id=1234,type=all,bucket=bucket_id:0,actions=output:0,bucket=bucket_id:1,actions=output:1,bucket=bucket_id:10,actions=output:10,bucket=bucket_id:11,actions=output:11,bucket=bucket_id:14,actions=output:14,bucket=bucket_id:15,actions=output:15
588])
23a31238
BP
589
590# Verify that duplicate bucket IDs are rejected.
591AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn insert-buckets br0 group_id=1234,command_bucket_id=last,bucket=bucket_id:14,actions=output:14,bucket=bucket_id:15,actions=output:15], [1], [], [stderr])
8a32aaa5 592AT_CHECK([strip_xids < stderr | sed '/truncated/,$d'], [0], [dnl
23a31238
BP
593OFPT_ERROR (OF1.5): OFPGMFC_BUCKET_EXISTS
594OFPT_GROUP_MOD (OF1.5):
52c57cbb 595 INSERT_BUCKET command_bucket_id:last,group_id=1234,bucket=bucket_id:14,actions=output:14,bucket=bucket_id:15,actions=output:15
23a31238
BP
596])
597
8e19e655
BP
598
599# Add another bucket just before bucket 15.
bdbb8426
SH
600AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn insert-buckets br0 group_id=1234,command_bucket_id=15])
601AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn dump-groups br0], [0], [stdout])
8a32aaa5 602AT_CHECK([strip_xids < stdout], [0], [dnl
bdbb8426
SH
603OFPST_GROUP_DESC reply (OF1.5):
604 group_id=1234,type=all,bucket=bucket_id:0,actions=output:0,bucket=bucket_id:1,actions=output:1,bucket=bucket_id:10,actions=output:10,bucket=bucket_id:11,actions=output:11,bucket=bucket_id:14,actions=output:14,bucket=bucket_id:15,actions=output:15
605])
8e19e655
BP
606
607# Add two more buckets just before bucket 11,
608# getting the command from a file.
bdbb8426
SH
609AT_DATA([buckets.txt], [dnl
610group_id=1234,command_bucket_id=11,bucket=bucket_id:12,actions=output:12,bucket=bucket_id:13,actions=output:13
611])
612AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn insert-buckets br0 - < buckets.txt])
613AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn dump-groups br0], [0], [stdout])
8a32aaa5 614AT_CHECK([strip_xids < stdout], [0], [dnl
bdbb8426
SH
615OFPST_GROUP_DESC reply (OF1.5):
616 group_id=1234,type=all,bucket=bucket_id:0,actions=output:0,bucket=bucket_id:1,actions=output:1,bucket=bucket_id:10,actions=output:10,bucket=bucket_id:11,actions=output:11,bucket=bucket_id:12,actions=output:12,bucket=bucket_id:13,actions=output:13,bucket=bucket_id:14,actions=output:14,bucket=bucket_id:15,actions=output:15
617])
8e19e655
BP
618
619# Add yet two more buckets.
bdbb8426
SH
620AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn insert-buckets br0 group_id=1234,command_bucket_id=15,bucket=bucket_id:20,actions=output:20,bucket=bucket_id:21,actions=output:21])
621AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn dump-groups br0], [0], [stdout])
8a32aaa5 622AT_CHECK([strip_xids < stdout], [0], [dnl
bdbb8426
SH
623OFPST_GROUP_DESC reply (OF1.5):
624 group_id=1234,type=all,bucket=bucket_id:0,actions=output:0,bucket=bucket_id:1,actions=output:1,bucket=bucket_id:10,actions=output:10,bucket=bucket_id:11,actions=output:11,bucket=bucket_id:12,actions=output:12,bucket=bucket_id:13,actions=output:13,bucket=bucket_id:14,actions=output:14,bucket=bucket_id:15,actions=output:15,bucket=bucket_id:20,actions=output:20,bucket=bucket_id:21,actions=output:21
625])
908995c5 626
836476ce
BP
627# Delete groups.
628AT_CHECK([ovs-ofctl -O OpenFlow15 del-groups br0])
629
630# Add "fast_failover" group, then insert a bucket into it and make
631# sure that the type of the group doesn't change. (There was a bug
632# that caused this to happen.)
633AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn add-group br0 group_id=1234,type=ff])
634AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn dump-groups br0], [0], [stdout])
635AT_CHECK([strip_xids < stdout], [0], [dnl
636OFPST_GROUP_DESC reply (OF1.5):
637 group_id=1234,type=ff
638])
639AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn insert-buckets br0 group_id=1234,command_bucket_id=first,bucket=bucket_id:20,actions=output:20,bucket=bucket_id:21,actions=output:21])
640AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn dump-groups br0], [0], [stdout])
641AT_CHECK([strip_xids < stdout], [0], [dnl
642OFPST_GROUP_DESC reply (OF1.5):
643 group_id=1234,type=ff,bucket=bucket_id:20,actions=output:20,bucket=bucket_id:21,actions=output:21
644])
645
9dd30b05 646# Negative tests.
836476ce
BP
647AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn insert-buckets br0 group_id=1234,command_bucket_id=123,type=indirect,bucket=bucket_id:0,actions=output:0,bucket=bucket_id:1,actions=output:1], [1], [],
648 [ovs-ofctl: type is not needed
649])
650AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn insert-buckets br0 group_id=1234,command_bucket_id=123,selection_method=dp_hash,type=indirect,bucket=bucket_id:0,actions=output:0,bucket=bucket_id:1,actions=output:1], [1], [],
651 [ovs-ofctl: selection method is not needed
652])
908995c5
BP
653AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn insert-buckets br0 group_id=1234,command_bucket_id=0xffffff01,bucket=bucket_id:0,actions=output:0,bucket=bucket_id:1,actions=output:1], [1], [],
654 [ovs-ofctl: invalid command bucket id 4294967041
655])
9dd30b05
BP
656AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn insert-buckets br0 group_id=1234,command_bucket_id=first,bucket=bucket_id:0,actions=output:0,bucket=bucket_id:1,actions=output:1], [1], [],
657 [ovs-ofctl: insert-bucket needs OpenFlow 1.5 or later ('-O OpenFlow15')
658])
bdbb8426
SH
659OVS_VSWITCHD_STOP
660AT_CLEANUP
661
662dnl This is really bare-bones.
663dnl It at least checks request and reply serialization and deserialization.
664dnl Actions definition listed in both supported formats (w/ actions=)
25070e04 665AT_SETUP([ofproto - remove group buckets])
bdbb8426
SH
666OVS_VSWITCHD_START
667AT_DATA([groups.txt], [dnl
668group_id=1234,type=all,bucket=bucket_id:10,actions=output:10,bucket=bucket_id:11,actions=output:11,bucket=bucket_id:12,actions=output:12,bucket=bucket_id:13,actions=output:13,bucket=bucket_id:14,actions=output:14,bucket=bucket_id:15,actions=output:15,bucket=bucket_id:16,actions=output:16
669])
670AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn add-groups br0 groups.txt])
671AT_CHECK([ovs-ofctl -F OXM-OpenFlow15 -O OpenFlow15 -vwarn dump-groups br0 1234], [0], [stdout])
8a32aaa5 672AT_CHECK([strip_xids < stdout], [0], [dnl
bdbb8426
SH
673OFPST_GROUP_DESC reply (OF1.5):
674 group_id=1234,type=all,bucket=bucket_id:10,actions=output:10,bucket=bucket_id:11,actions=output:11,bucket=bucket_id:12,actions=output:12,bucket=bucket_id:13,actions=output:13,bucket=bucket_id:14,actions=output:14,bucket=bucket_id:15,actions=output:15,bucket=bucket_id:16,actions=output:16
675])
676AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn remove-buckets br0 group_id=1234,command_bucket_id=first])
677AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn dump-groups br0], [0], [stdout])
8a32aaa5 678AT_CHECK([strip_xids < stdout], [0], [dnl
bdbb8426
SH
679OFPST_GROUP_DESC reply (OF1.5):
680 group_id=1234,type=all,bucket=bucket_id:11,actions=output:11,bucket=bucket_id:12,actions=output:12,bucket=bucket_id:13,actions=output:13,bucket=bucket_id:14,actions=output:14,bucket=bucket_id:15,actions=output:15,bucket=bucket_id:16,actions=output:16
681])
682AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn remove-buckets br0 group_id=1234,command_bucket_id=last])
683AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn dump-groups br0], [0], [stdout])
8a32aaa5 684AT_CHECK([strip_xids < stdout], [0], [dnl
bdbb8426
SH
685OFPST_GROUP_DESC reply (OF1.5):
686 group_id=1234,type=all,bucket=bucket_id:11,actions=output:11,bucket=bucket_id:12,actions=output:12,bucket=bucket_id:13,actions=output:13,bucket=bucket_id:14,actions=output:14,bucket=bucket_id:15,actions=output:15
687])
688AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn remove-buckets br0 group_id=1234,command_bucket_id=13])
689AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn dump-groups br0], [0], [stdout])
8a32aaa5 690AT_CHECK([strip_xids < stdout], [0], [dnl
bdbb8426
SH
691OFPST_GROUP_DESC reply (OF1.5):
692 group_id=1234,type=all,bucket=bucket_id:11,actions=output:11,bucket=bucket_id:12,actions=output:12,bucket=bucket_id:14,actions=output:14,bucket=bucket_id:15,actions=output:15
693])
694AT_DATA([buckets.txt], [dnl
695group_id=1234
696])
697AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn remove-buckets br0 - < buckets.txt])
698AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn dump-groups br0], [0], [stdout])
8a32aaa5 699AT_CHECK([strip_xids < stdout], [0], [dnl
bdbb8426
SH
700OFPST_GROUP_DESC reply (OF1.5):
701 group_id=1234,type=all
702])
703AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn remove-buckets br0 group_id=1234,command_bucket_id=first])
704AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn remove-buckets br0 group_id=1234,command_bucket_id=last])
705AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn remove-buckets br0 group_id=1234,command_bucket_id=all])
706AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn remove-buckets br0 group_id=1234,command_bucket_id=1], [1], [], [stderr])
38b0b29f 707AT_CHECK([ofctl_strip < stderr], [0], [dnl
bdbb8426
SH
708OFPT_ERROR (OF1.5): OFPGMFC_UNKNOWN_BUCKET
709OFPT_GROUP_MOD (OF1.5):
710 REMOVE_BUCKET command_bucket_id:1,group_id=1234
711])
9dd30b05
BP
712# Negative test.
713AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn remove-buckets br0 group_id=1234,command_bucket_id=last], [1], [],
714 [ovs-ofctl: remove-bucket needs OpenFlow 1.5 or later ('-O OpenFlow15')
715])
bdbb8426
SH
716OVS_VSWITCHD_STOP
717AT_CLEANUP
718
25070e04
JR
719AT_SETUP([ofproto - bundle del group (OpenFlow 1.3)])
720OVS_VSWITCHD_START
721AT_DATA([groups.txt], [dnl
722group_id=1234,type=all,bucket=output:10
723group_id=1235,type=all,bucket=actions=output:10
724])
725AT_CHECK([ovs-ofctl --bundle -O OpenFlow13 -vwarn add-groups br0 groups.txt])
726AT_CHECK([ovs-ofctl -O OpenFlow13 -vwarn dump-groups br0 ], [0], [stdout])
727AT_CHECK([strip_xids < stdout | sort], [0], [dnl
728 group_id=1234,type=all,bucket=actions=output:10
729 group_id=1235,type=all,bucket=actions=output:10
730OFPST_GROUP_DESC reply (OF1.3):
731])
732AT_CHECK([ovs-ofctl --bundle -O OpenFlow13 -vwarn del-groups br0 group_id=1234])
733AT_CHECK([ovs-ofctl -O OpenFlow13 -vwarn dump-groups br0], [0], [stdout])
734AT_CHECK([strip_xids < stdout], [0], [dnl
735OFPST_GROUP_DESC reply (OF1.3):
736 group_id=1235,type=all,bucket=actions=output:10
737])
738AT_CHECK([ovs-ofctl --bundle -O OpenFlow13 -vwarn del-groups br0 group_id=1234])
739AT_CHECK([ovs-ofctl -O OpenFlow13 -vwarn dump-groups br0], [0], [stdout])
740AT_CHECK([strip_xids < stdout], [0], [dnl
741OFPST_GROUP_DESC reply (OF1.3):
742 group_id=1235,type=all,bucket=actions=output:10
743])
744AT_CHECK([ovs-ofctl --bundle -O OpenFlow13 -vwarn del-groups br0], [0])
745AT_CHECK([ovs-ofctl -O OpenFlow13 -vwarn dump-groups br0], [0], [stdout])
746AT_CHECK([strip_xids < stdout], [0], [dnl
747OFPST_GROUP_DESC reply (OF1.3):
748])
749
750# Negative test.
751AT_CHECK([ovs-ofctl --bundle -O OpenFlow13 -vwarn del-groups br0 group_id=0xfffffff0],
752 [1], [], [ovs-ofctl: invalid group id 4294967280
753])
754OVS_VSWITCHD_STOP
755AT_CLEANUP
756
757AT_SETUP([ofproto - bundle add indirect group])
758OVS_VSWITCHD_START
759dnl indirect group must have exactly one bucket
760AT_DATA([stderr], [dnl
761OFPT_ERROR (OF1.4) (xid=0x2): OFPGMFC_INVALID_GROUP
762OFPT_BUNDLE_ADD_MESSAGE (OF1.4) (xid=0x2):
763 bundle_id=0 flags=atomic ordered
764OFPT_GROUP_MOD (OF1.4) (xid=0x2): ***decode error: OFPGMFC_INVALID_GROUP***
765])
766AT_CHECK([ovs-ofctl --bundle -vwarn add-group br0 'group_id=1234,type=indirect'], [1], , [stderr])
767AT_CHECK([ovs-ofctl --bundle -vwarn add-group br0 'group_id=1235,type=indirect,bucket=output:10'])
768AT_CHECK([ovs-ofctl --bundle -vwarn add-group br0 'group_id=1236,type=indirect,bucket=output:10,bucket=output:11'], [1], , [stderr])
769OVS_VSWITCHD_STOP
770AT_CLEANUP
771
772AT_SETUP([ofproto - bundle group mod with mod and add_or_mod command])
773OVS_VSWITCHD_START
774dnl Check that mod-group for non-existing group fails without --may-create
775AT_DATA([stderr], [dnl
776OFPT_ERROR (OF1.4) (xid=0x2): OFPGMFC_UNKNOWN_GROUP
777OFPT_GROUP_MOD (OF1.4) (xid=0x2):
778 MOD group_id=1234,type=indirect,bucket=actions=output:2
779])
780AT_CHECK([ovs-ofctl --bundle -vwarn mod-group br0 'group_id=1234,type=indirect,bucket=actions=2'], [1], , [stderr])
781dnl Check that mod-group for non-existing group succeeds with --may-create
782AT_CHECK([ovs-ofctl --bundle -vwarn --may-create mod-group br0 'group_id=1234,type=indirect,bucket=actions=2'])
783AT_CHECK([ovs-ofctl -O OpenFlow14 -vwarn dump-groups br0], [0], [stdout])
784AT_CHECK([strip_xids < stdout], [0], [dnl
785OFPST_GROUP_DESC reply (OF1.4):
786 group_id=1234,type=indirect,bucket=actions=output:2
787])
788dnl Check that mod-group for existing group succeeds with --may-create
789AT_CHECK([ovs-ofctl --bundle -vwarn --may-create mod-group br0 'group_id=1234,type=indirect,bucket=actions=3'])
790AT_CHECK([ovs-ofctl -O OpenFlow14 -vwarn dump-groups br0], [0], [stdout])
791AT_CHECK([strip_xids < stdout], [0], [dnl
792OFPST_GROUP_DESC reply (OF1.4):
793 group_id=1234,type=indirect,bucket=actions=output:3
794])
795OVS_VSWITCHD_STOP
796AT_CLEANUP
797
798AT_SETUP([ofproto - bundle del group (OpenFlow 1.5)])
799OVS_VSWITCHD_START
800AT_DATA([groups.txt], [dnl
801group_id=1233,type=select,selection_method=hash,bucket=output:10,bucket=output:11
802group_id=1234,type=select,selection_method=hash,fields(eth_dst,ip_dst,tcp_dst),bucket=output:10,bucket=output:11
803group_id=1235,type=all,bucket=actions=output:12,bucket=bucket_id:0,actions=output:10,bucket=bucket_id:1,actions=output:11
804])
805AT_CHECK([ovs-ofctl --bundle -O OpenFlow15 -vwarn add-groups br0 groups.txt])
806AT_CHECK([ovs-ofctl -F OXM-OpenFlow15 -O OpenFlow15 -vwarn dump-groups br0 1234], [0], [stdout])
807AT_CHECK([strip_xids < stdout], [0], [dnl
808OFPST_GROUP_DESC reply (OF1.5):
809 group_id=1234,type=select,selection_method=hash,fields(eth_dst,ip_dst,tcp_dst),bucket=bucket_id:0,actions=output:10,bucket=bucket_id:1,actions=output:11
810])
811AT_CHECK([ovs-ofctl --bundle -O OpenFlow15 -vwarn del-groups br0 group_id=1234])
812AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn dump-groups br0], [0], [stdout])
813AT_CHECK([strip_xids < stdout | sort], [0], [dnl
814 group_id=1233,type=select,selection_method=hash,bucket=bucket_id:0,actions=output:10,bucket=bucket_id:1,actions=output:11
815 group_id=1235,type=all,bucket=bucket_id:2,actions=output:12,bucket=bucket_id:0,actions=output:10,bucket=bucket_id:1,actions=output:11
816OFPST_GROUP_DESC reply (OF1.5):
817])
818AT_CHECK([ovs-ofctl --bundle -O OpenFlow15 -vwarn del-groups br0 group_id=1234])
819AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn dump-groups br0], [0], [stdout])
820AT_CHECK([strip_xids < stdout | sort], [0], [dnl
821 group_id=1233,type=select,selection_method=hash,bucket=bucket_id:0,actions=output:10,bucket=bucket_id:1,actions=output:11
822 group_id=1235,type=all,bucket=bucket_id:2,actions=output:12,bucket=bucket_id:0,actions=output:10,bucket=bucket_id:1,actions=output:11
823OFPST_GROUP_DESC reply (OF1.5):
824])
825AT_CHECK([ovs-ofctl --bundle -O OpenFlow15 -vwarn del-groups br0], [0])
826AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn dump-groups br0], [0], [stdout])
827AT_CHECK([strip_xids < stdout], [0], [dnl
828OFPST_GROUP_DESC reply (OF1.5):
829])
830OVS_VSWITCHD_STOP
831AT_CLEANUP
832
833AT_SETUP([ofproto - bundle del group deletes flows])
834OVS_VSWITCHD_START
835AT_DATA([groups.txt], [dnl
836group_id=1234,type=all,bucket=output:10
837group_id=1235,type=all,bucket=output:10
838])
839AT_CHECK([ovs-ofctl --bundle -vwarn add-groups br0 groups.txt])
840AT_DATA([flows.txt], [dnl
841tcp actions=group:1234
842table=2 udp actions=group:1235
843])
844AT_CHECK([ovs-ofctl --bundle -vwarn add-flows br0 flows.txt])
845AT_CHECK([ovs-ofctl -O OpenFlow14 -vwarn dump-flows br0 | ofctl_strip | sort],
846[0], [dnl
847 table=2, udp actions=group:1235
848 tcp actions=group:1234
849OFPST_FLOW reply (OF1.4):
850])
851AT_CHECK([ovs-ofctl --bundle -vwarn del-groups br0 group_id=1234])
852AT_CHECK([ovs-ofctl -O OpenFlow14 -vwarn dump-flows br0 | ofctl_strip | sort],
853[0], [dnl
854 table=2, udp actions=group:1235
855OFPST_FLOW reply (OF1.4):
856])
857AT_CHECK([ovs-ofctl --bundle -vwarn del-groups br0 group_id=1234])
858AT_CHECK([ovs-ofctl -O OpenFlow14 -vwarn dump-flows br0 | ofctl_strip | sort],
859[0], [dnl
860 table=2, udp actions=group:1235
861OFPST_FLOW reply (OF1.4):
862])
863AT_CHECK([ovs-ofctl --bundle -vwarn del-groups br0])
864AT_CHECK([ovs-ofctl -O OpenFlow14 -vwarn dump-flows br0 | ofctl_strip | sort],
865[0], [dnl
866OFPST_FLOW reply (OF1.4):
867])
868OVS_VSWITCHD_STOP
869AT_CLEANUP
870
871dnl This is really bare-bones.
872dnl It at least checks request and reply serialization and deserialization.
873dnl Actions definition listed in both supported formats (w/ actions=)
874AT_SETUP([ofproto - bundle insert group buckets])
875OVS_VSWITCHD_START
876# Add group with no buckets.
877AT_DATA([groups.txt], [dnl
878group_id=1234,type=all
879])
880AT_CHECK([ovs-ofctl --bundle -O OpenFlow15 -vwarn add-groups br0 groups.txt])
881AT_CHECK([ovs-ofctl -F OXM-OpenFlow15 -O OpenFlow15 -vwarn dump-groups br0 1234], [0], [stdout])
882AT_CHECK([strip_xids < stdout], [0], [dnl
883OFPST_GROUP_DESC reply (OF1.5):
884 group_id=1234,type=all
885])
886
887# Add two buckets, using "last".
888AT_CHECK([ovs-ofctl --bundle -O OpenFlow15 -vwarn insert-buckets br0 group_id=1234,command_bucket_id=last,bucket=bucket_id:10,actions=output:10,bucket=bucket_id:11,actions=output:11])
889AT_CHECK([ovs-ofctl -F OXM-OpenFlow15 -O OpenFlow15 -vwarn dump-groups br0 1234], [0], [stdout])
890AT_CHECK([strip_xids < stdout], [0], [dnl
891OFPST_GROUP_DESC reply (OF1.5):
892 group_id=1234,type=all,bucket=bucket_id:10,actions=output:10,bucket=bucket_id:11,actions=output:11
893])
894
895# Start over again, then add two buckets using "first".
896AT_DATA([groups.txt], [dnl
897delete group_id=1234
898add group_id=1234,type=all
899insert_bucket group_id=1234,command_bucket_id=first,bucket=bucket_id:10,actions=output:10,bucket=bucket_id:11,actions=output:11
900])
901AT_CHECK([ovs-ofctl --bundle -O OpenFlow15 -vwarn add-groups br0 groups.txt])
902AT_CHECK([ovs-ofctl -F OXM-OpenFlow15 -O OpenFlow15 -vwarn dump-groups br0 1234], [0], [stdout])
903AT_CHECK([strip_xids < stdout], [0], [dnl
904OFPST_GROUP_DESC reply (OF1.5):
905 group_id=1234,type=all,bucket=bucket_id:10,actions=output:10,bucket=bucket_id:11,actions=output:11
906])
907
908# Add two more buckets before the existing ones.
909AT_CHECK([ovs-ofctl --bundle -O OpenFlow15 -vwarn insert-buckets br0 group_id=1234,command_bucket_id=first,bucket=bucket_id:0,actions=output:0,bucket=bucket_id:1,actions=output:1])
910AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn dump-groups br0], [0], [stdout])
911AT_CHECK([strip_xids < stdout], [0], [dnl
912OFPST_GROUP_DESC reply (OF1.5):
913 group_id=1234,type=all,bucket=bucket_id:0,actions=output:0,bucket=bucket_id:1,actions=output:1,bucket=bucket_id:10,actions=output:10,bucket=bucket_id:11,actions=output:11
914])
915
916# Add another bucket at the end.
917AT_CHECK([ovs-ofctl --bundle -O OpenFlow15 -vwarn insert-buckets br0 group_id=1234,command_bucket_id=last,bucket=bucket_id:14,actions=output:14,bucket=bucket_id:15,actions=output:15])
918AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn dump-groups br0], [0], [stdout])
919AT_CHECK([strip_xids < stdout], [0], [dnl
920OFPST_GROUP_DESC reply (OF1.5):
921 group_id=1234,type=all,bucket=bucket_id:0,actions=output:0,bucket=bucket_id:1,actions=output:1,bucket=bucket_id:10,actions=output:10,bucket=bucket_id:11,actions=output:11,bucket=bucket_id:14,actions=output:14,bucket=bucket_id:15,actions=output:15
922])
923
924# Verify that duplicate bucket IDs are rejected.
925AT_CHECK([ovs-ofctl --bundle -O OpenFlow15 -vwarn insert-buckets br0 group_id=1234,command_bucket_id=last,bucket=bucket_id:14,actions=output:14,bucket=bucket_id:15,actions=output:15], [1], [], [stderr])
926AT_CHECK([strip_xids < stderr | sed '/talking to/,$d'], [0], [dnl
927Error OFPGMFC_BUCKET_EXISTS for: OFPT_GROUP_MOD (OF1.5):
928 INSERT_BUCKET command_bucket_id:last,group_id=1234,bucket=bucket_id:14,actions=output:14,bucket=bucket_id:15,actions=output:15
929Error OFPBFC_MSG_FAILED for: OFPT_BUNDLE_CONTROL (OF1.5):
930 bundle_id=0 type=COMMIT_REQUEST flags=atomic ordered
931])
932
933# Add another bucket just before bucket 15.
934AT_CHECK([ovs-ofctl --bundle -O OpenFlow15 -vwarn insert-buckets br0 group_id=1234,command_bucket_id=15])
935AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn dump-groups br0], [0], [stdout])
936AT_CHECK([strip_xids < stdout], [0], [dnl
937OFPST_GROUP_DESC reply (OF1.5):
938 group_id=1234,type=all,bucket=bucket_id:0,actions=output:0,bucket=bucket_id:1,actions=output:1,bucket=bucket_id:10,actions=output:10,bucket=bucket_id:11,actions=output:11,bucket=bucket_id:14,actions=output:14,bucket=bucket_id:15,actions=output:15
939])
940
941# Add two more buckets just before bucket 11,
942# getting the command from a file.
943AT_DATA([buckets.txt], [dnl
944group_id=1234,command_bucket_id=11,bucket=bucket_id:12,actions=output:12,bucket=bucket_id:13,actions=output:13
945])
946AT_CHECK([ovs-ofctl --bundle -O OpenFlow15 -vwarn insert-buckets br0 - < buckets.txt])
947AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn dump-groups br0], [0], [stdout])
948AT_CHECK([strip_xids < stdout], [0], [dnl
949OFPST_GROUP_DESC reply (OF1.5):
950 group_id=1234,type=all,bucket=bucket_id:0,actions=output:0,bucket=bucket_id:1,actions=output:1,bucket=bucket_id:10,actions=output:10,bucket=bucket_id:11,actions=output:11,bucket=bucket_id:12,actions=output:12,bucket=bucket_id:13,actions=output:13,bucket=bucket_id:14,actions=output:14,bucket=bucket_id:15,actions=output:15
951])
952
953# Add yet two more buckets.
954AT_CHECK([ovs-ofctl --bundle -O OpenFlow15 -vwarn insert-buckets br0 group_id=1234,command_bucket_id=15,bucket=bucket_id:20,actions=output:20,bucket=bucket_id:21,actions=output:21])
955AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn dump-groups br0], [0], [stdout])
956AT_CHECK([strip_xids < stdout], [0], [dnl
957OFPST_GROUP_DESC reply (OF1.5):
958 group_id=1234,type=all,bucket=bucket_id:0,actions=output:0,bucket=bucket_id:1,actions=output:1,bucket=bucket_id:10,actions=output:10,bucket=bucket_id:11,actions=output:11,bucket=bucket_id:12,actions=output:12,bucket=bucket_id:13,actions=output:13,bucket=bucket_id:14,actions=output:14,bucket=bucket_id:15,actions=output:15,bucket=bucket_id:20,actions=output:20,bucket=bucket_id:21,actions=output:21
959])
960
961# Negative tests.
962AT_CHECK([ovs-ofctl --bundle -O OpenFlow15 -vwarn insert-buckets br0 group_id=1234,command_bucket_id=0xffffff01,bucket=bucket_id:0,actions=output:0,bucket=bucket_id:1,actions=output:1], [1], [],
963 [ovs-ofctl: invalid command bucket id 4294967041
964])
965AT_CHECK([ovs-ofctl --bundle -vwarn insert-buckets br0 group_id=1234,command_bucket_id=first,bucket=bucket_id:0,actions=output:0,bucket=bucket_id:1,actions=output:1], [1], [],
966 [ovs-ofctl: insert-bucket needs OpenFlow 1.5 or later ('-O OpenFlow15')
967])
968OVS_VSWITCHD_STOP
969AT_CLEANUP
970
971AT_SETUP([ofproto - bundle remove group buckets])
972OVS_VSWITCHD_START
973AT_DATA([groups.txt], [dnl
974group_id=1234,type=all,bucket=bucket_id:10,actions=output:10,bucket=bucket_id:11,actions=output:11,bucket=bucket_id:12,actions=output:12,bucket=bucket_id:13,actions=output:13,bucket=bucket_id:14,actions=output:14,bucket=bucket_id:15,actions=output:15,bucket=bucket_id:16,actions=output:16
975])
976AT_CHECK([ovs-ofctl --bundle -O OpenFlow15 -vwarn add-groups br0 groups.txt])
977AT_CHECK([ovs-ofctl -F OXM-OpenFlow15 -O OpenFlow15 -vwarn dump-groups br0 1234], [0], [stdout])
978AT_CHECK([strip_xids < stdout], [0], [dnl
979OFPST_GROUP_DESC reply (OF1.5):
980 group_id=1234,type=all,bucket=bucket_id:10,actions=output:10,bucket=bucket_id:11,actions=output:11,bucket=bucket_id:12,actions=output:12,bucket=bucket_id:13,actions=output:13,bucket=bucket_id:14,actions=output:14,bucket=bucket_id:15,actions=output:15,bucket=bucket_id:16,actions=output:16
981])
982AT_CHECK([ovs-ofctl --bundle -O OpenFlow15 -vwarn remove-buckets br0 group_id=1234,command_bucket_id=first])
983AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn dump-groups br0], [0], [stdout])
984AT_CHECK([strip_xids < stdout], [0], [dnl
985OFPST_GROUP_DESC reply (OF1.5):
986 group_id=1234,type=all,bucket=bucket_id:11,actions=output:11,bucket=bucket_id:12,actions=output:12,bucket=bucket_id:13,actions=output:13,bucket=bucket_id:14,actions=output:14,bucket=bucket_id:15,actions=output:15,bucket=bucket_id:16,actions=output:16
987])
988AT_CHECK([ovs-ofctl --bundle -O OpenFlow15 -vwarn remove-buckets br0 group_id=1234,command_bucket_id=last])
989AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn dump-groups br0], [0], [stdout])
990AT_CHECK([strip_xids < stdout], [0], [dnl
991OFPST_GROUP_DESC reply (OF1.5):
992 group_id=1234,type=all,bucket=bucket_id:11,actions=output:11,bucket=bucket_id:12,actions=output:12,bucket=bucket_id:13,actions=output:13,bucket=bucket_id:14,actions=output:14,bucket=bucket_id:15,actions=output:15
993])
994AT_CHECK([ovs-ofctl --bundle -O OpenFlow15 -vwarn remove-buckets br0 group_id=1234,command_bucket_id=13])
995AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn dump-groups br0], [0], [stdout])
996AT_CHECK([strip_xids < stdout], [0], [dnl
997OFPST_GROUP_DESC reply (OF1.5):
998 group_id=1234,type=all,bucket=bucket_id:11,actions=output:11,bucket=bucket_id:12,actions=output:12,bucket=bucket_id:14,actions=output:14,bucket=bucket_id:15,actions=output:15
999])
1000AT_DATA([buckets.txt], [dnl
1001group_id=1234
1002])
1003AT_CHECK([ovs-ofctl --bundle -O OpenFlow15 -vwarn remove-buckets br0 - < buckets.txt])
1004AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn dump-groups br0], [0], [stdout])
1005AT_CHECK([strip_xids < stdout], [0], [dnl
1006OFPST_GROUP_DESC reply (OF1.5):
1007 group_id=1234,type=all
1008])
1009AT_CHECK([ovs-ofctl --bundle -O OpenFlow15 -vwarn remove-buckets br0 group_id=1234,command_bucket_id=first])
1010AT_CHECK([ovs-ofctl --bundle -O OpenFlow15 -vwarn remove-buckets br0 group_id=1234,command_bucket_id=last])
1011AT_CHECK([ovs-ofctl --bundle -O OpenFlow15 -vwarn remove-buckets br0 group_id=1234,command_bucket_id=all])
1012AT_CHECK([ovs-ofctl --bundle -O OpenFlow15 -vwarn remove-buckets br0 group_id=1234,command_bucket_id=1], [1], [], [stderr])
1013AT_CHECK([ofctl_strip < stderr | sed '/talking to/,$d'], [0], [dnl
1014Error OFPGMFC_UNKNOWN_BUCKET for: OFPT_GROUP_MOD (OF1.5):
1015 REMOVE_BUCKET command_bucket_id:1,group_id=1234
1016Error OFPBFC_MSG_FAILED for: OFPT_BUNDLE_CONTROL (OF1.5):
1017 bundle_id=0 type=COMMIT_REQUEST flags=atomic ordered
1018])
1019# Negative test.
1020AT_CHECK([ovs-ofctl --bundle -O OpenFlow11 -vwarn remove-buckets br0 group_id=1234,command_bucket_id=last], [1], [],
1021 [ovs-ofctl: remove-bucket needs OpenFlow 1.5 or later ('-O OpenFlow15')
1022])
1023OVS_VSWITCHD_STOP
1024AT_CLEANUP
1025
0860fea7
SH
1026dnl This is really bare-bones.
1027dnl It at least checks request and reply serialization and deserialization.
1028AT_SETUP([ofproto - flow mod checks group availability])
1029OVS_VSWITCHD_START
1030AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn add-group br0 group_id=1234,type=all,bucket=output:10])
1031AT_DATA([flows.txt], [dnl
1032tcp actions=group:1234
1033udp actions=group:1235
1034])
1035AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn add-flow br0 'tcp actions=group:1234'])
1036AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn add-flow br0 'tcp actions=group:1235'], [1], [], [stderr])
1037
52c57cbb 1038AT_CHECK([strip_xids < stderr], [0],
0860fea7 1039 [OFPT_ERROR (OF1.1): OFPBAC_BAD_OUT_GROUP
52c57cbb 1040OFPT_FLOW_MOD (OF1.1): ADD tcp actions=group:1235
0860fea7
SH
1041])
1042OVS_VSWITCHD_STOP
1043AT_CLEANUP
1044
25070e04
JR
1045AT_SETUP([ofproto - bundle flow mod checks group availability])
1046OVS_VSWITCHD_START
1047AT_DATA([bundle.txt], [dnl
1048group add group_id=1234,type=all,bucket=output:10
1049flow add tcp actions=group:1234
1050flow add udp actions=group:1235
1051])
1052AT_CHECK([ovs-ofctl -vwarn bundle br0 bundle.txt], [1], [], [stderr])
1053
52c57cbb 1054AT_CHECK([ofctl_strip < stderr | sed '/talking to/,$d'], [0],
25070e04
JR
1055 [dnl
1056Error OFPBAC_BAD_OUT_GROUP for: OFPT_FLOW_MOD (OF1.4): ADD udp actions=group:1235
1057Error OFPBFC_MSG_FAILED for: OFPT_BUNDLE_CONTROL (OF1.4):
1058 bundle_id=0 type=COMMIT_REQUEST flags=atomic ordered
1059])
1060OVS_VSWITCHD_STOP
1061AT_CLEANUP
1062
433702fc
SH
1063dnl This is really bare-bones.
1064dnl It at least checks request and reply serialization and deserialization.
1065AT_SETUP([ofproto - group description])
1066OVS_VSWITCHD_START
1067AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn add-group br0 group_id=1234,type=all,bucket=output:10], [0], [stdout])
1068AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn dump-groups br0], [0], [stdout])
8a32aaa5 1069AT_CHECK([strip_xids < stdout], [0], [dnl
433702fc
SH
1070OFPST_GROUP_DESC reply (OF1.1):
1071 group_id=1234,type=all,bucket=actions=output:10
1072])
1073OVS_VSWITCHD_STOP
1074AT_CLEANUP
1075
2134b5ec
SH
1076dnl This is really bare-bones.
1077dnl It at least checks request and reply serialization and deserialization.
1078AT_SETUP([ofproto - group description])
1079OVS_VSWITCHD_START
1080AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn add-group br0 group_id=1234,type=all,bucket=output:10])
1081AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn dump-groups br0], [0], [stdout])
8a32aaa5 1082AT_CHECK([strip_xids < stdout], [0], [dnl
2134b5ec
SH
1083OFPST_GROUP_DESC reply (OF1.1):
1084 group_id=1234,type=all,bucket=actions=output:10
1085])
1086OVS_VSWITCHD_STOP
1087AT_CLEANUP
1088
d45418dd
SH
1089dnl This is really bare-bones.
1090dnl It at least checks request and reply serialization and deserialization.
1091AT_SETUP([ofproto - group features])
1092OVS_VSWITCHD_START
1093AT_CHECK([ovs-ofctl -O OpenFlow12 -vwarn dump-group-features br0], [0], [stdout])
8a32aaa5 1094AT_CHECK([strip_xids < stdout], [0], [dnl
d45418dd
SH
1095OFPST_GROUP_FEATURES reply (OF1.2):
1096 Group table:
0ae01c64 1097 Types: 0xf
7cb279c2 1098 Capabilities: 0x7
0ae01c64
SS
1099 all group:
1100 max_groups=0xffffff00
1101 actions: output group set_field strip_vlan push_vlan mod_nw_ttl dec_ttl set_mpls_ttl dec_mpls_ttl push_mpls pop_mpls set_queue
1102 select group:
1103 max_groups=0xffffff00
1104 actions: output group set_field strip_vlan push_vlan mod_nw_ttl dec_ttl set_mpls_ttl dec_mpls_ttl push_mpls pop_mpls set_queue
1105 indirect group:
1106 max_groups=0xffffff00
1107 actions: output group set_field strip_vlan push_vlan mod_nw_ttl dec_ttl set_mpls_ttl dec_mpls_ttl push_mpls pop_mpls set_queue
1108 fast failover group:
1109 max_groups=0xffffff00
1110 actions: output group set_field strip_vlan push_vlan mod_nw_ttl dec_ttl set_mpls_ttl dec_mpls_ttl push_mpls pop_mpls set_queue
d45418dd
SH
1111])
1112OVS_VSWITCHD_STOP
1113AT_CLEANUP
1114
2134b5ec
SH
1115dnl This is really bare-bones.
1116dnl It at least checks request and reply serialization and deserialization.
5335a6f3 1117AT_SETUP([ofproto - group stats (OpenFlow 1.1)])
2134b5ec
SH
1118OVS_VSWITCHD_START
1119AT_DATA([groups.txt], [dnl
1120group_id=1234,type=all,bucket=output:10
1121group_id=1235,type=all,bucket=output:10
1122])
1123AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn add-groups br0 groups.txt])
1124AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn add-flow br0 'tcp actions=group:1234'])
1125AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn dump-group-stats br0 group_id=1234], [0], [stdout])
8a32aaa5 1126AT_CHECK([strip_xids < stdout | sort], [0], [dnl
2134b5ec
SH
1127 group_id=1234,ref_count=1,packet_count=0,byte_count=0,bucket0:packet_count=0,byte_count=0
1128OFPST_GROUP reply (OF1.1):
1129])
1130AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn dump-group-stats br0], [0], [stdout])
8a32aaa5 1131AT_CHECK([strip_xids < stdout | sort], [0], [dnl
2134b5ec
SH
1132 group_id=1234,ref_count=1,packet_count=0,byte_count=0,bucket0:packet_count=0,byte_count=0
1133 group_id=1235,ref_count=0,packet_count=0,byte_count=0,bucket0:packet_count=0,byte_count=0
1134OFPST_GROUP reply (OF1.1):
1135])
1136OVS_VSWITCHD_STOP
1137AT_CLEANUP
1138
5335a6f3
SH
1139dnl This is really bare-bones.
1140dnl It at least checks request and reply serialization and deserialization.
1141AT_SETUP([ofproto - group stats (OpenFlow 1.3)])
1142OVS_VSWITCHD_START
1143AT_DATA([groups.txt], [dnl
1144group_id=1234,type=all,bucket=output:10
1145group_id=1235,type=all,bucket=output:10
1146])
1147AT_CHECK([ovs-ofctl -O OpenFlow13 -vwarn add-groups br0 groups.txt])
1148AT_CHECK([ovs-ofctl -O OpenFlow13 -vwarn add-flow br0 'tcp actions=group:1234'])
1149AT_CHECK([ovs-ofctl -O OpenFlow13 -vwarn dump-group-stats br0 group_id=1234], [0], [stdout])
8a32aaa5 1150AT_CHECK([strip_xids < stdout | sed 's/duration=[[0-9.]]*s/duration=?s/' | sort], [0], [dnl
5335a6f3
SH
1151 group_id=1234,duration=?s,ref_count=1,packet_count=0,byte_count=0,bucket0:packet_count=0,byte_count=0
1152OFPST_GROUP reply (OF1.3):
1153])
1154AT_CHECK([ovs-ofctl -O OpenFlow13 -vwarn dump-group-stats br0], [0], [stdout])
8a32aaa5 1155AT_CHECK([strip_xids < stdout | sed 's/duration=[[0-9.]]*s/duration=?s/' | sort], [0], [dnl
5335a6f3
SH
1156 group_id=1234,duration=?s,ref_count=1,packet_count=0,byte_count=0,bucket0:packet_count=0,byte_count=0
1157 group_id=1235,duration=?s,ref_count=0,packet_count=0,byte_count=0,bucket0:packet_count=0,byte_count=0
1158OFPST_GROUP reply (OF1.3):
1159])
1160OVS_VSWITCHD_STOP
1161AT_CLEANUP
1162
afc63bb4
SH
1163dnl This is really bare-bones.
1164dnl It at least checks request and reply serialization and deserialization.
1165AT_SETUP([ofproto - group stats (OpenFlow 1.5)])
1166OVS_VSWITCHD_START
1167AT_DATA([groups.txt], [dnl
1168group_id=1234,type=all,bucket=output:10
1169group_id=1235,type=all,bucket=output:10
1170])
1171AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn add-groups br0 groups.txt])
1172AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn add-flow br0 'tcp actions=group:1234'])
1173AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn dump-group-stats br0 group_id=1234], [0], [stdout])
8a32aaa5 1174AT_CHECK([strip_xids < stdout | sed 's/duration=[[0-9.]]*s/duration=?s/' | sort], [0], [dnl
afc63bb4
SH
1175 group_id=1234,duration=?s,ref_count=1,packet_count=0,byte_count=0,bucket0:packet_count=0,byte_count=0
1176OFPST_GROUP reply (OF1.5):
1177])
1178AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn dump-group-stats br0], [0], [stdout])
8a32aaa5 1179AT_CHECK([strip_xids < stdout | sed 's/duration=[[0-9.]]*s/duration=?s/' | sort], [0], [dnl
afc63bb4
SH
1180 group_id=1234,duration=?s,ref_count=1,packet_count=0,byte_count=0,bucket0:packet_count=0,byte_count=0
1181 group_id=1235,duration=?s,ref_count=0,packet_count=0,byte_count=0,bucket0:packet_count=0,byte_count=0
1182OFPST_GROUP reply (OF1.5):
1183])
1184OVS_VSWITCHD_STOP
1185AT_CLEANUP
1186
daab0ae6
BP
1187dnl This found a use-after-free error in bridge destruction in the
1188dnl presence of groups.
1189AT_SETUP([ofproto - group add then bridge delete (OpenFlow 1.3)])
1190OVS_VSWITCHD_START
1191AT_DATA([groups.txt], [dnl
1192group_id=1234,type=all,bucket=output:10
1193group_id=1235,type=all,bucket=output:10
4a48cdfb
BP
1194
1195dnl This checks for regression against a parser bug such that
1196dnl "actions=resbmit(,1)" etc. was rejected as a syntax error.
1197group_id=2345,type=select,bucket=weight:10,actions=resubmit(,1),bucket=weight:10,actions=resubmit(,2),bucket=weight:1,actions=resubmit(,3)
daab0ae6
BP
1198])
1199AT_CHECK([ovs-ofctl -O OpenFlow13 -vwarn add-groups br0 groups.txt])
1200AT_CHECK([ovs-vsctl del-br br0])
1201OVS_VSWITCHD_STOP
1202AT_CLEANUP
1203
9dcd1c00 1204AT_SETUP([ofproto - mod-port (OpenFlow 1.0)])
023e1e0a 1205OVS_VSWITCHD_START
a2cb9dfd
BP
1206for command_config_state in \
1207 'up 0 0' \
0ab14c8e
BP
1208 'noflood NO_FLOOD 0' \
1209 'down PORT_DOWN,NO_FLOOD LINK_DOWN' \
28124950
BP
1210 'flood PORT_DOWN LINK_DOWN' \
1211 'no-receive PORT_DOWN,NO_RECV LINK_DOWN' \
1212 'no-forward PORT_DOWN,NO_RECV,NO_FWD LINK_DOWN' \
1213 'no-packet-in PORT_DOWN,NO_RECV,NO_FWD,NO_PACKET_IN LINK_DOWN' \
1214 'forward PORT_DOWN,NO_RECV,NO_PACKET_IN LINK_DOWN' \
1215 'packet-in PORT_DOWN,NO_RECV LINK_DOWN' \
1216 'up NO_RECV 0' \
1217 'receive 0 0'
a2cb9dfd
BP
1218do
1219 set $command_config_state
0ab14c8e 1220 command=$[1] config=`echo $[2] | sed 's/,/ /g'` state=$[3]
ea523221
BP
1221 AT_CHECK([ovs-ofctl -vwarn mod-port br0 br0 $command])
1222 AT_CHECK([ovs-ofctl -vwarn show br0], [0], [stdout])
8a32aaa5 1223 AT_CHECK_UNQUOTED([strip_xids < stdout], [0], [dnl
9e1fd49b 1224OFPT_FEATURES_REPLY: dpid:fedcba9876543210
c184807c 1225n_tables:254, n_buffers:0
9e1fd49b 1226capabilities: FLOW_STATS TABLE_STATS PORT_STATS QUEUE_STATS ARP_MATCH_IP
08d1e234 1227actions: output enqueue set_vlan_vid set_vlan_pcp strip_vlan mod_dl_src mod_dl_dst mod_nw_src mod_nw_dst mod_nw_tos mod_tp_src mod_tp_dst
0ab14c8e
BP
1228 LOCAL(br0): addr:aa:55:aa:55:00:00
1229 config: $config
1230 state: $state
d02a5f8e 1231 speed: 0 Mbps now, 0 Mbps max
3b62feba 1232OFPT_GET_CONFIG_REPLY: frags=normal miss_send_len=0
a2cb9dfd
BP
1233])
1234done
023e1e0a 1235OVS_VSWITCHD_STOP
a2cb9dfd 1236AT_CLEANUP
640c7c94 1237
9dcd1c00
SH
1238AT_SETUP([ofproto - mod-port (OpenFlow 1.2)])
1239OVS_VSWITCHD_START
1240for command_config_state in \
f73b83fd 1241 'up 0 LIVE' \
9dcd1c00
SH
1242 'down PORT_DOWN LINK_DOWN' \
1243 'no-receive PORT_DOWN,NO_RECV LINK_DOWN' \
1244 'no-forward PORT_DOWN,NO_RECV,NO_FWD LINK_DOWN' \
1245 'no-packet-in PORT_DOWN,NO_RECV,NO_FWD,NO_PACKET_IN LINK_DOWN' \
1246 'forward PORT_DOWN,NO_RECV,NO_PACKET_IN LINK_DOWN' \
1247 'packet-in PORT_DOWN,NO_RECV LINK_DOWN' \
f73b83fd
LS
1248 'up NO_RECV LIVE' \
1249 'receive 0 LIVE'
9dcd1c00
SH
1250do
1251 set $command_config_state
1252 command=$[1] config=`echo $[2] | sed 's/,/ /g'` state=$[3]
1253 AT_CHECK([ovs-ofctl -O OpenFlow12 -vwarn mod-port br0 br0 $command])
1254 AT_CHECK([ovs-ofctl -O OpenFlow12 -vwarn show br0], [0], [stdout])
8a32aaa5 1255 AT_CHECK_UNQUOTED([strip_xids < stdout], [0], [dnl
9dcd1c00 1256OFPT_FEATURES_REPLY (OF1.2): dpid:fedcba9876543210
c184807c 1257n_tables:254, n_buffers:0
4efe455d 1258capabilities: FLOW_STATS TABLE_STATS PORT_STATS GROUP_STATS QUEUE_STATS
9dcd1c00
SH
1259 LOCAL(br0): addr:aa:55:aa:55:00:00
1260 config: $config
1261 state: $state
1262 speed: 0 Mbps now, 0 Mbps max
1263OFPT_GET_CONFIG_REPLY (OF1.2): frags=normal miss_send_len=0
1264])
1265done
1266OVS_VSWITCHD_STOP
1267AT_CLEANUP
1268
18cc69d9
BP
1269AT_SETUP([ofproto - mod-port (OpenFlow 1.4)])
1270OVS_VSWITCHD_START
1271for command_config_state in \
f73b83fd 1272 'up 0 LIVE' \
18cc69d9
BP
1273 'down PORT_DOWN LINK_DOWN' \
1274 'no-receive PORT_DOWN,NO_RECV LINK_DOWN' \
1275 'no-forward PORT_DOWN,NO_RECV,NO_FWD LINK_DOWN' \
1276 'no-packet-in PORT_DOWN,NO_RECV,NO_FWD,NO_PACKET_IN LINK_DOWN' \
1277 'forward PORT_DOWN,NO_RECV,NO_PACKET_IN LINK_DOWN' \
1278 'packet-in PORT_DOWN,NO_RECV LINK_DOWN' \
f73b83fd
LS
1279 'up NO_RECV LIVE' \
1280 'receive 0 LIVE'
18cc69d9
BP
1281do
1282 set $command_config_state
1283 command=$[1] config=`echo $[2] | sed 's/,/ /g'` state=$[3]
1284 AT_CHECK([ovs-ofctl -O OpenFlow14 -vwarn mod-port br0 br0 $command])
1285 AT_CHECK([ovs-ofctl -O OpenFlow14 -vwarn show br0], [0], [stdout])
8a32aaa5 1286 AT_CHECK_UNQUOTED([strip_xids < stdout], [0], [dnl
18cc69d9 1287OFPT_FEATURES_REPLY (OF1.4): dpid:fedcba9876543210
c184807c 1288n_tables:254, n_buffers:0
50b73fe1 1289capabilities: FLOW_STATS TABLE_STATS PORT_STATS GROUP_STATS QUEUE_STATS BUNDLES
18cc69d9
BP
1290OFPST_PORT_DESC reply (OF1.4):
1291 LOCAL(br0): addr:aa:55:aa:55:00:00
1292 config: $config
1293 state: $state
1294 speed: 0 Mbps now, 0 Mbps max
1295OFPT_GET_CONFIG_REPLY (OF1.4): frags=normal miss_send_len=0
1296])
1297done
1298OVS_VSWITCHD_STOP
1299AT_CLEANUP
1300
2f2b904f
BP
1301AT_SETUP([ofproto - mod-port (OpenFlow 1.6)])
1302OVS_VSWITCHD_START
1303for command_config_state in \
f73b83fd 1304 'up 0 LIVE' \
2f2b904f
BP
1305 'down PORT_DOWN LINK_DOWN' \
1306 'no-receive PORT_DOWN,NO_RECV LINK_DOWN' \
1307 'no-forward PORT_DOWN,NO_RECV,NO_FWD LINK_DOWN' \
1308 'no-packet-in PORT_DOWN,NO_RECV,NO_FWD,NO_PACKET_IN LINK_DOWN' \
1309 'forward PORT_DOWN,NO_RECV,NO_PACKET_IN LINK_DOWN' \
1310 'packet-in PORT_DOWN,NO_RECV LINK_DOWN' \
f73b83fd
LS
1311 'up NO_RECV LIVE' \
1312 'receive 0 LIVE'
2f2b904f
BP
1313do
1314 set $command_config_state
1315 command=$[1] config=`echo $[2] | sed 's/,/ /g'` state=$[3]
1316 AT_CHECK([ovs-ofctl -O OpenFlow16 -vwarn mod-port br0 br0 $command])
1317 AT_CHECK([ovs-ofctl -O OpenFlow16 -vwarn show br0], [0], [stdout])
1318 AT_CHECK_UNQUOTED([strip_xids < stdout], [0], [dnl
1319OFPT_FEATURES_REPLY (OF1.6): dpid:fedcba9876543210
1320n_tables:254, n_buffers:0
1321capabilities: FLOW_STATS TABLE_STATS PORT_STATS GROUP_STATS QUEUE_STATS BUNDLES
1322OFPST_PORT_DESC reply (OF1.6):
1323 LOCAL(br0): addr:aa:55:aa:55:00:00
1324 config: $config
1325 state: $state
1326 speed: 0 Mbps now, 0 Mbps max
1327OFPT_GET_CONFIG_REPLY (OF1.6): frags=normal miss_send_len=0
1328])
1329done
1330OVS_VSWITCHD_STOP
1331AT_CLEANUP
1332
c168dcc8 1333AT_SETUP([ofproto - basic flow_mod commands (NXM)])
023e1e0a 1334OVS_VSWITCHD_START
ef0ce8ae 1335AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip], [0], [NXST_FLOW reply:
640c7c94 1336])
c6100d92
BP
1337AT_CHECK([echo 'in_port=2,actions=1' | ovs-ofctl add-flows br0 -])
1338AT_CHECK([ovs-ofctl add-flow br0 in_port=1,actions=2])
1339AT_CHECK([ovs-ofctl -F nxm add-flow br0 table=1,in_port=4,actions=3])
ef0ce8ae 1340AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
c6100d92
BP
1341 in_port=1 actions=output:2
1342 in_port=2 actions=output:1
1343 table=1, in_port=4 actions=output:3
0721c073 1344NXST_FLOW reply:
640c7c94 1345])
8a32aaa5 1346AT_CHECK([ovs-ofctl dump-aggregate br0 table=0 | strip_xids], [0], [dnl
c168dcc8
BP
1347NXST_AGGREGATE reply: packet_count=0 byte_count=0 flow_count=2
1348])
640c7c94 1349AT_CHECK([ovs-ofctl del-flows br0])
ef0ce8ae 1350AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip], [0], [NXST_FLOW reply:
640c7c94 1351])
023e1e0a 1352OVS_VSWITCHD_STOP
640c7c94 1353AT_CLEANUP
c168dcc8
BP
1354
1355AT_SETUP([ofproto - basic flow_mod commands (OpenFlow 1.0)])
023e1e0a 1356OVS_VSWITCHD_START
ef0ce8ae 1357AT_CHECK([ovs-ofctl -F openflow10 dump-flows br0 | ofctl_strip], [0], [OFPST_FLOW reply:
c168dcc8 1358])
c6100d92
BP
1359AT_CHECK([echo 'in_port=2,actions=1' | ovs-ofctl -F openflow10 add-flows br0 -])
1360AT_CHECK([ovs-ofctl -F openflow10 add-flow br0 in_port=1,actions=2])
1361AT_CHECK([ovs-ofctl -F openflow10 add-flow br0 table=1,in_port=4,actions=3])
ef0ce8ae 1362AT_CHECK([ovs-ofctl -F openflow10 dump-flows br0 | ofctl_strip | sort], [0], [dnl
c6100d92
BP
1363 in_port=1 actions=output:2
1364 in_port=2 actions=output:1
1365 table=1, in_port=4 actions=output:3
c168dcc8
BP
1366OFPST_FLOW reply:
1367])
8a32aaa5 1368AT_CHECK([ovs-ofctl -F openflow10 dump-aggregate br0 table=0 | strip_xids], [0], [dnl
c168dcc8
BP
1369OFPST_AGGREGATE reply: packet_count=0 byte_count=0 flow_count=2
1370])
1371AT_CHECK([ovs-ofctl -F openflow10 del-flows br0])
ef0ce8ae 1372AT_CHECK([ovs-ofctl -F openflow10 dump-flows br0 | ofctl_strip], [0], [OFPST_FLOW reply:
c168dcc8 1373])
023e1e0a 1374OVS_VSWITCHD_STOP
c168dcc8 1375AT_CLEANUP
e729e793 1376
13327b8e
BP
1377# It's really dumb that check_overlap and reset_counts are considered
1378# part of flow state, but OpenFlow implies that it is, and OFTest and
1379# some users insist on it.
1380AT_SETUP([ofproto - add-flow and flags])
1381OVS_VSWITCHD_START
1382AT_CHECK([ovs-ofctl -F openflow10 add-flow br0 check_overlap,in_port=1,actions=drop])
1383# Prior to OF1.3, flow dumps didn't include a "flags" field.
1384AT_CHECK([ovs-ofctl -F openflow10 dump-flows br0 | ofctl_strip], [0], [dnl
1385OFPST_FLOW reply:
1386 in_port=1 actions=drop
1387])
1388AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip], [0], [dnl
1389OFPST_FLOW reply (OF1.1):
1390 in_port=1 actions=drop
1391])
1392AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip], [0], [dnl
1393OFPST_FLOW reply (OF1.2):
1394 in_port=1 actions=drop
1395])
1396# OF1.3 makes the flags visible.
1397AT_CHECK([ovs-ofctl -O OpenFlow13 dump-flows br0 | ofctl_strip], [0], [dnl
1398OFPST_FLOW reply (OF1.3):
1399 check_overlap reset_counts in_port=1 actions=drop
1400])
1401AT_CHECK([ovs-ofctl -O OpenFlow14 dump-flows br0 | ofctl_strip], [0], [dnl
1402OFPST_FLOW reply (OF1.4):
1403 check_overlap reset_counts in_port=1 actions=drop
1404])
1405AT_CHECK([ovs-ofctl -O OpenFlow15 dump-flows br0 | ofctl_strip], [0], [dnl
1406OFPST_FLOW reply (OF1.5):
1407 check_overlap reset_counts in_port=1 actions=drop
1408])
1409OVS_VSWITCHD_STOP
1410AT_CLEANUP
1411
75fa58f8
BP
1412AT_SETUP([ofproto - basic flow_mod commands (OpenFlow 1.1)])
1413OVS_VSWITCHD_START
1414AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip], [0], [OFPST_FLOW reply (OF1.1):
1415])
1416AT_CHECK([echo 'in_port=2,actions=1' | ovs-ofctl -O OpenFlow11 add-flows br0 -])
1417AT_CHECK([ovs-ofctl -O OpenFlow11 add-flow br0 in_port=1,actions=2])
1418AT_CHECK([ovs-ofctl -O OpenFlow11 add-flow br0 table=1,in_port=4,actions=3])
1419AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1420 in_port=1 actions=output:2
1421 in_port=2 actions=output:1
1422 table=1, in_port=4 actions=output:3
1423OFPST_FLOW reply (OF1.1):
1424])
8a32aaa5 1425AT_CHECK([ovs-ofctl -O OpenFlow11 dump-aggregate br0 table=0 | strip_xids], [0], [dnl
75fa58f8
BP
1426OFPST_AGGREGATE reply (OF1.1): packet_count=0 byte_count=0 flow_count=2
1427])
1428AT_CHECK([ovs-ofctl -O OpenFlow11 del-flows br0])
1429AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip], [0], [OFPST_FLOW reply (OF1.1):
0e197060 1430 table=1, in_port=4 actions=output:3
75fa58f8
BP
1431])
1432OVS_VSWITCHD_STOP
1433AT_CLEANUP
1434
862d8eed
BP
1435AT_SETUP([ofproto - flow_mod negative test (OpenFlow 1.1)])
1436OVS_VSWITCHD_START(
1437 [set bridge br0 protocols=OpenFlow10,OpenFlow11,OpenFlow12,OpenFlow13])
1438AT_CHECK([ovs-ofctl add-flow -O OpenFlow11 br0 table=1,action=goto_table:2])
862d8eed 1439
0e197060
BP
1440# The error message here actually comes from ovs-ofctl, not from ovs-vswitchd,
1441# but at least it's the same code in ofpacts_check() that issues the error.
1442AT_CHECK([ovs-ofctl add-flow -O OpenFlow11 br0 table=1,action=goto_table:1],
1443 [1], [],
8c87971e 1444 [ovs-ofctl: actions are invalid with specified match (OFPBIC_BAD_TABLE_ID)
862d8eed
BP
1445])
1446OVS_VSWITCHD_STOP
1447AT_CLEANUP
1448
f5c45121
SH
1449AT_SETUP([ofproto - set-field flow_mod commands (NXM)])
1450OVS_VSWITCHD_START
1451AT_CHECK([ovs-ofctl add-flow br0 ipv6,table=1,in_port=3,actions=drop])
1452AT_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])
e60e935b 1453AT_CHECK([ovs-ofctl add-flow br0 icmp6,icmp_type=136,table=1,in_port=3,actions=set_field:fe80:8675:3097:890a:a6ba:dbff:f00d:59fa-\>nd_target,set_field:cc:dd:ee:ff:00:11-\>nd_tll])
f5c45121 1454AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
e60e935b 1455 table=1, icmp6,in_port=3,icmp_type=136 actions=load:0xa6badbfff00d59fa->NXM_NX_ND_TARGET[[0..63]],load:0xfe8086753097890a->NXM_NX_ND_TARGET[[64..127]],load:0xccddeeff0011->NXM_NX_ND_TLL[[]]
f5c45121
SH
1456 table=1, ipv6,in_port=3 actions=load:0xa6badbfffefe59fa->NXM_NX_IPV6_SRC[[0..63]],load:0xfe8001234567890a->NXM_NX_IPV6_SRC[[64..127]]
1457NXST_FLOW reply:
1458])
1459OVS_VSWITCHD_STOP
1460AT_CLEANUP
1461
9dcd1c00 1462AT_SETUP([ofproto - basic flow_mod commands (OpenFlow 1.2)])
e729e793 1463OVS_VSWITCHD_START
9dcd1c00 1464AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip], [0], [OFPST_FLOW reply (OF1.2):
e729e793 1465])
9dcd1c00
SH
1466AT_CHECK([echo 'in_port=2,actions=1' | ovs-ofctl -O OpenFlow12 add-flows br0 -])
1467AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 in_port=1,actions=2])
1468AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 table=1,in_port=4,actions=3])
1469AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1470 in_port=1 actions=output:2
1471 in_port=2 actions=output:1
1472 table=1, in_port=4 actions=output:3
1473OFPST_FLOW reply (OF1.2):
e729e793 1474])
9dcd1c00
SH
1475AT_CHECK([ovs-ofctl -O OpenFlow12 del-flows br0])
1476AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip], [0], [OFPST_FLOW reply (OF1.2):
e729e793
JP
1477])
1478OVS_VSWITCHD_STOP
1479AT_CLEANUP
1480
e60e935b
SRCSA
1481AT_SETUP([ofproto - set-field flow_mod commands (OF1.2)])
1482OVS_VSWITCHD_START
1483AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 ipv6,table=1,in_port=3,actions=drop])
1484AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 ipv6,table=1,in_port=3,actions=set_field:fe80:0123:4567:890a:a6ba:dbff:fefe:59fa-\>ipv6_src])
1485AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 icmp6,icmp_type=136,table=1,in_port=3,actions=set_field:fe80:8675:3097:890a:a6ba:dbff:f00d:59fa-\>nd_target,set_field:cc:dd:ee:ff:00:11-\>nd_tll])
1486AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1487 table=1, icmp6,in_port=3,icmp_type=136 actions=set_field:fe80:8675:3097:890a:a6ba:dbff:f00d:59fa->nd_target,set_field:cc:dd:ee:ff:00:11->nd_tll
1488 table=1, ipv6,in_port=3 actions=set_field:fe80:123:4567:890a:a6ba:dbff:fefe:59fa->ipv6_src
1489OFPST_FLOW reply (OF1.2):
1490])
1491OVS_VSWITCHD_STOP
1492AT_CLEANUP
1493
9dcd1c00 1494AT_SETUP([ofproto - dump flows with cookie])
e729e793 1495OVS_VSWITCHD_START
c6100d92
BP
1496AT_CHECK([ovs-ofctl add-flow br0 cookie=0x1,in_port=1,actions=1])
1497AT_CHECK([ovs-ofctl add-flow br0 cookie=0x2,in_port=2,actions=1])
1498AT_CHECK([ovs-ofctl add-flow br0 cookie=0x3,in_port=3,actions=1])
ef0ce8ae 1499AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
c6100d92
BP
1500 cookie=0x1, in_port=1 actions=output:1
1501 cookie=0x2, in_port=2 actions=output:1
1502 cookie=0x3, in_port=3 actions=output:1
e729e793
JP
1503NXST_FLOW reply:
1504])
8a32aaa5 1505AT_CHECK([ovs-ofctl dump-aggregate br0 table=0 | strip_xids], [0], [dnl
e729e793
JP
1506NXST_AGGREGATE reply: packet_count=0 byte_count=0 flow_count=3
1507])
9dcd1c00 1508AT_CHECK([ovs-ofctl dump-flows br0 cookie=0x3/-1 | ofctl_strip | sort], [0], [dnl
c6100d92 1509 cookie=0x3, in_port=3 actions=output:1
e729e793
JP
1510NXST_FLOW reply:
1511])
8a32aaa5 1512AT_CHECK([ovs-ofctl dump-aggregate br0 cookie=0x3/-1 | strip_xids], [0], [dnl
9dcd1c00 1513NXST_AGGREGATE reply: packet_count=0 byte_count=0 flow_count=1
e729e793
JP
1514])
1515OVS_VSWITCHD_STOP
1516AT_CLEANUP
1517
623e1caf
JP
1518AT_SETUP([ofproto - mod flow with cookie change (OpenFlow 1.0)])
1519OVS_VSWITCHD_START
c6100d92 1520AT_CHECK([ovs-ofctl -F openflow10 add-flow br0 cookie=0x1,in_port=1,actions=1])
623e1caf 1521AT_CHECK([ovs-ofctl -F openflow10 dump-flows br0 | ofctl_strip | sort], [0], [dnl
c6100d92 1522 cookie=0x1, in_port=1 actions=output:1
623e1caf
JP
1523OFPST_FLOW reply:
1524])
1525
c6100d92 1526AT_CHECK([ovs-ofctl -F openflow10 mod-flows br0 cookie=0x2,in_port=1,actions=1])
623e1caf 1527AT_CHECK([ovs-ofctl -F openflow10 dump-flows br0 | ofctl_strip | sort], [0], [dnl
c6100d92 1528 cookie=0x2, in_port=1 actions=output:1
623e1caf
JP
1529OFPST_FLOW reply:
1530])
1531OVS_VSWITCHD_STOP
1532AT_CLEANUP
1533
1534AT_SETUP([ofproto - mod flow with cookie change (NXM)])
1535OVS_VSWITCHD_START
c6100d92 1536AT_CHECK([ovs-ofctl -F nxm add-flow br0 cookie=0x1,in_port=1,actions=1])
623e1caf 1537AT_CHECK([ovs-ofctl -F nxm dump-flows br0 | ofctl_strip | sort], [0], [dnl
c6100d92 1538 cookie=0x1, in_port=1 actions=output:1
623e1caf
JP
1539NXST_FLOW reply:
1540])
1541
c6100d92 1542AT_CHECK([ovs-ofctl -F nxm mod-flows br0 cookie=0x2,in_port=1,actions=1])
623e1caf 1543AT_CHECK([ovs-ofctl -F nxm dump-flows br0 | ofctl_strip | sort], [0], [dnl
c6100d92 1544 cookie=0x2, in_port=1 actions=output:1
623e1caf
JP
1545NXST_FLOW reply:
1546])
1547OVS_VSWITCHD_STOP
1548AT_CLEANUP
1549
75fa58f8
BP
1550AT_SETUP([ofproto - no mod flow with cookie change (OpenFlow 1.1)])
1551OVS_VSWITCHD_START
1552AT_CHECK([ovs-ofctl -O OpenFlow11 add-flow br0 cookie=0x1,in_port=1,actions=1])
1553AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1554 cookie=0x1, in_port=1 actions=output:1
1555OFPST_FLOW reply (OF1.1):
1556])
1557AT_CHECK([ovs-ofctl -O OpenFlow11 mod-flows br0 cookie=0x2,in_port=1,actions=1])
1558AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1559 cookie=0x1, in_port=1 actions=output:1
1560OFPST_FLOW reply (OF1.1):
1561])
1562OVS_VSWITCHD_STOP
1563AT_CLEANUP
1564
9dcd1c00 1565dnl The OpenFlow 1.2 spec states that the cookie may not be modified
2df3b874 1566AT_SETUP([ofproto - no mod flow with cookie change (OpenFlow 1.2)])
9dcd1c00
SH
1567OVS_VSWITCHD_START
1568AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 cookie=0x1,in_port=1,actions=1])
1569AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1570 cookie=0x1, in_port=1 actions=output:1
1571OFPST_FLOW reply (OF1.2):
1572])
1573
1574AT_CHECK([ovs-ofctl -O OpenFlow12 mod-flows br0 cookie=0x2,in_port=1,actions=1])
1575AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1576 cookie=0x1, in_port=1 actions=output:1
1577OFPST_FLOW reply (OF1.2):
1578])
1579OVS_VSWITCHD_STOP
1580AT_CLEANUP
1581
1582AT_SETUP([ofproto - mod flows based on cookie mask (OpenFlow 1.0)])
623e1caf 1583OVS_VSWITCHD_START
c6100d92
BP
1584AT_CHECK([ovs-ofctl add-flow br0 cookie=0x1,in_port=1,actions=1])
1585AT_CHECK([ovs-ofctl add-flow br0 cookie=0x1,in_port=2,actions=1])
1586AT_CHECK([ovs-ofctl add-flow br0 cookie=0x2,in_port=3,actions=1])
623e1caf 1587AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
c6100d92
BP
1588 cookie=0x1, in_port=1 actions=output:1
1589 cookie=0x1, in_port=2 actions=output:1
1590 cookie=0x2, in_port=3 actions=output:1
623e1caf
JP
1591NXST_FLOW reply:
1592])
1593
1594AT_CHECK([ovs-ofctl -F nxm mod-flows br0 cookie=0x1/0xff,actions=4])
1595AT_CHECK([ovs-ofctl -F nxm dump-flows br0 | ofctl_strip | sort], [0], [dnl
1596 cookie=0x1, in_port=1 actions=output:4
1597 cookie=0x1, in_port=2 actions=output:4
c6100d92 1598 cookie=0x2, in_port=3 actions=output:1
623e1caf
JP
1599NXST_FLOW reply:
1600])
1601OVS_VSWITCHD_STOP
1602AT_CLEANUP
1603
75fa58f8
BP
1604AT_SETUP([ofproto - mod flows based on cookie mask (OpenFlow 1.1)])
1605OVS_VSWITCHD_START
1606AT_CHECK([ovs-ofctl -O OpenFlow11 add-flow br0 cookie=0x1,in_port=1,actions=1])
1607AT_CHECK([ovs-ofctl -O OpenFlow11 add-flow br0 cookie=0x1,in_port=2,actions=1])
1608AT_CHECK([ovs-ofctl -O OpenFlow11 add-flow br0 cookie=0x2,in_port=3,actions=1])
1609AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1610 cookie=0x1, in_port=1 actions=output:1
1611 cookie=0x1, in_port=2 actions=output:1
1612 cookie=0x2, in_port=3 actions=output:1
1613OFPST_FLOW reply (OF1.1):
1614])
1615
1616AT_CHECK([ovs-ofctl -O OpenFlow11 mod-flows br0 cookie=0x1/0xff,actions=4])
1617AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1618 cookie=0x1, in_port=1 actions=output:4
1619 cookie=0x1, in_port=2 actions=output:4
1620 cookie=0x2, in_port=3 actions=output:1
1621OFPST_FLOW reply (OF1.1):
1622])
1623OVS_VSWITCHD_STOP
1624AT_CLEANUP
1625
9dcd1c00
SH
1626AT_SETUP([ofproto - mod flows based on cookie mask (OpenFlow 1.2)])
1627OVS_VSWITCHD_START
1628AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 cookie=0x1,in_port=1,actions=1])
1629AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 cookie=0x1,in_port=2,actions=1])
1630AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 cookie=0x2,in_port=3,actions=1])
1631AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1632 cookie=0x1, in_port=1 actions=output:1
1633 cookie=0x1, in_port=2 actions=output:1
1634 cookie=0x2, in_port=3 actions=output:1
1635OFPST_FLOW reply (OF1.2):
1636])
1637
1638AT_CHECK([ovs-ofctl -O OpenFlow12 mod-flows br0 cookie=0x1/0xff,actions=4])
1639AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1640 cookie=0x1, in_port=1 actions=output:4
1641 cookie=0x1, in_port=2 actions=output:4
1642 cookie=0x2, in_port=3 actions=output:1
1643OFPST_FLOW reply (OF1.2):
1644])
1645OVS_VSWITCHD_STOP
1646AT_CLEANUP
1647
1648dnl The OpenFlow 1.2 spec states that the cookie may not be modified
623e1caf
JP
1649AT_SETUP([ofproto - mod flows based on cookie mask with cookie change])
1650OVS_VSWITCHD_START
c6100d92
BP
1651AT_CHECK([ovs-ofctl add-flow br0 cookie=0x1,in_port=1,actions=1])
1652AT_CHECK([ovs-ofctl add-flow br0 cookie=0x1,in_port=2,actions=1])
1653AT_CHECK([ovs-ofctl add-flow br0 cookie=0x2,in_port=3,actions=1])
623e1caf 1654AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
c6100d92
BP
1655 cookie=0x1, in_port=1 actions=output:1
1656 cookie=0x1, in_port=2 actions=output:1
1657 cookie=0x2, in_port=3 actions=output:1
623e1caf
JP
1658NXST_FLOW reply:
1659])
1660
1661AT_CHECK([ovs-ofctl -F nxm mod-flows br0 cookie=1/-1,cookie=4,actions=4])
1662AT_CHECK([ovs-ofctl -F nxm dump-flows br0 | ofctl_strip | sort], [0], [dnl
c6100d92 1663 cookie=0x2, in_port=3 actions=output:1
623e1caf
JP
1664 cookie=0x4, in_port=1 actions=output:4
1665 cookie=0x4, in_port=2 actions=output:4
1666NXST_FLOW reply:
1667])
1668OVS_VSWITCHD_STOP
1669AT_CLEANUP
1670
490020fe 1671AT_SETUP([ofproto - mod flow with cookie miss (mask==0) - NXM])
623e1caf 1672OVS_VSWITCHD_START
c6100d92 1673AT_CHECK([ovs-ofctl -F nxm mod-flows br0 in_port=1,actions=1])
623e1caf 1674AT_CHECK([ovs-ofctl -F nxm dump-flows br0 | ofctl_strip | sort], [0], [dnl
c6100d92 1675 in_port=1 actions=output:1
623e1caf
JP
1676NXST_FLOW reply:
1677])
1678OVS_VSWITCHD_STOP
1679AT_CLEANUP
1680
75fa58f8
BP
1681AT_SETUP([ofproto - mod flow with cookie miss (mask==0) - OF1.1])
1682OVS_VSWITCHD_START
1683AT_CHECK([ovs-ofctl -O openflow11 mod-flows br0 in_port=1,actions=1])
1684AT_CHECK([ovs-ofctl -O openflow11 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1685 in_port=1 actions=output:1
1686OFPST_FLOW reply (OF1.1):
1687])
1688OVS_VSWITCHD_STOP
1689AT_CLEANUP
1690
490020fe
BP
1691AT_SETUP([ofproto - mod flow with cookie miss (mask==0) - OF1.2])
1692OVS_VSWITCHD_START
1693AT_CHECK([ovs-ofctl -O openflow12 mod-flows br0 in_port=1,actions=1])
1694AT_CHECK([ovs-ofctl -O openflow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1695OFPST_FLOW reply (OF1.2):
1696])
1697OVS_VSWITCHD_STOP
1698AT_CLEANUP
1699
1700AT_SETUP([ofproto - mod flow with cookie miss (mask!=0) - NXM])
623e1caf 1701OVS_VSWITCHD_START
c6100d92 1702AT_CHECK([ovs-ofctl -F nxm mod-flows br0 cookie=1/1,in_port=1,actions=1])
623e1caf
JP
1703AT_CHECK([ovs-ofctl -F nxm dump-flows br0 | ofctl_strip | sort], [0], [dnl
1704NXST_FLOW reply:
1705])
1706OVS_VSWITCHD_STOP
1707AT_CLEANUP
1708
75fa58f8
BP
1709AT_SETUP([ofproto - mod flow with cookie miss (mask!=0) - OF1.1])
1710OVS_VSWITCHD_START
1711AT_CHECK([ovs-ofctl -O openflow11 mod-flows br0 cookie=1/1,in_port=1,actions=1])
1712AT_CHECK([ovs-ofctl -O openflow11 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1713OFPST_FLOW reply (OF1.1):
1714])
1715OVS_VSWITCHD_STOP
1716AT_CLEANUP
1717
490020fe
BP
1718AT_SETUP([ofproto - mod flow with cookie miss (mask!=0) - OF1.2])
1719OVS_VSWITCHD_START
1720AT_CHECK([ovs-ofctl -O openflow12 mod-flows br0 cookie=1/1,in_port=1,actions=1])
1721AT_CHECK([ovs-ofctl -O openflow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1722OFPST_FLOW reply (OF1.2):
1723])
1724OVS_VSWITCHD_STOP
1725AT_CLEANUP
1726
623e1caf
JP
1727AT_SETUP([ofproto - del flows with cookies])
1728OVS_VSWITCHD_START
c6100d92
BP
1729AT_CHECK([ovs-ofctl add-flow br0 cookie=0x1,in_port=1,actions=1])
1730AT_CHECK([ovs-ofctl add-flow br0 cookie=0x2,in_port=2,actions=1])
1731AT_CHECK([ovs-ofctl add-flow br0 cookie=0x3,in_port=3,actions=1])
623e1caf 1732AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
c6100d92
BP
1733 cookie=0x1, in_port=1 actions=output:1
1734 cookie=0x2, in_port=2 actions=output:1
1735 cookie=0x3, in_port=3 actions=output:1
623e1caf
JP
1736NXST_FLOW reply:
1737])
1738
1739AT_CHECK([ovs-ofctl del-flows br0])
1740AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1741NXST_FLOW reply:
1742])
1743OVS_VSWITCHD_STOP
1744AT_CLEANUP
1745
1746AT_SETUP([ofproto - del flows based on cookie])
e729e793 1747OVS_VSWITCHD_START
c6100d92
BP
1748AT_CHECK([ovs-ofctl add-flow br0 cookie=0x1,in_port=1,actions=1])
1749AT_CHECK([ovs-ofctl add-flow br0 cookie=0x2,in_port=2,actions=1])
1750AT_CHECK([ovs-ofctl add-flow br0 cookie=0x3,in_port=3,actions=1])
ef0ce8ae 1751AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
c6100d92
BP
1752 cookie=0x1, in_port=1 actions=output:1
1753 cookie=0x2, in_port=2 actions=output:1
1754 cookie=0x3, in_port=3 actions=output:1
e729e793
JP
1755NXST_FLOW reply:
1756])
80d5aefd 1757
623e1caf 1758AT_CHECK([ovs-ofctl del-flows br0 cookie=0x3/-1])
ef0ce8ae 1759AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
c6100d92
BP
1760 cookie=0x1, in_port=1 actions=output:1
1761 cookie=0x2, in_port=2 actions=output:1
e729e793
JP
1762NXST_FLOW reply:
1763])
1764OVS_VSWITCHD_STOP
1765AT_CLEANUP
1766
623e1caf 1767AT_SETUP([ofproto - del flows based on cookie mask])
e729e793 1768OVS_VSWITCHD_START
c6100d92
BP
1769AT_CHECK([ovs-ofctl add-flow br0 cookie=0x1,in_port=1,actions=1])
1770AT_CHECK([ovs-ofctl add-flow br0 cookie=0x2,in_port=2,actions=1])
1771AT_CHECK([ovs-ofctl add-flow br0 cookie=0x3,in_port=3,actions=1])
ef0ce8ae 1772AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
c6100d92
BP
1773 cookie=0x1, in_port=1 actions=output:1
1774 cookie=0x2, in_port=2 actions=output:1
1775 cookie=0x3, in_port=3 actions=output:1
e729e793
JP
1776NXST_FLOW reply:
1777])
1778AT_CHECK([ovs-ofctl del-flows br0 cookie=0x3/0x1])
ef0ce8ae 1779AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
c6100d92 1780 cookie=0x2, in_port=2 actions=output:1
e729e793
JP
1781NXST_FLOW reply:
1782])
1783OVS_VSWITCHD_STOP
1784AT_CLEANUP
254750ce 1785
9dcd1c00 1786AT_SETUP([ofproto - del flows based on table id (NXM)])
c90cfeaf
SH
1787OVS_VSWITCHD_START
1788AT_CHECK([ovs-ofctl add-flow br0 cookie=0x1,in_port=1,actions=1])
1789AT_CHECK([ovs-ofctl add-flow br0 cookie=0x2,in_port=2,table=1,actions=1])
1790AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1791 cookie=0x1, in_port=1 actions=output:1
1792 cookie=0x2, table=1, in_port=2 actions=output:1
1793NXST_FLOW reply:
1794])
1795AT_CHECK([ovs-ofctl del-flows br0 table=0])
1796AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1797 cookie=0x2, table=1, in_port=2 actions=output:1
1798NXST_FLOW reply:
1799])
1800AT_CHECK([ovs-ofctl del-flows br0 table=1])
1801AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1802NXST_FLOW reply:
1803])
1804AT_CHECK([ovs-ofctl add-flow br0 cookie=0x1,in_port=1,actions=1])
1805AT_CHECK([ovs-ofctl add-flow br0 cookie=0x2,in_port=2,table=1,actions=1])
1806AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1807 cookie=0x1, in_port=1 actions=output:1
1808 cookie=0x2, table=1, in_port=2 actions=output:1
1809NXST_FLOW reply:
1810])
1811AT_CHECK([ovs-ofctl del-flows br0])
1812AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1813NXST_FLOW reply:
1814])
1815OVS_VSWITCHD_STOP
1816AT_CLEANUP
1817
75fa58f8
BP
1818AT_SETUP([ofproto - del flows based on table id (OpenFlow 1.1)])
1819OVS_VSWITCHD_START
1820AT_CHECK([ovs-ofctl -O OpenFlow11 add-flow br0 cookie=0x1,in_port=1,actions=1])
1821AT_CHECK([ovs-ofctl -O OpenFlow11 add-flow br0 cookie=0x2,in_port=2,table=1,actions=1])
1822AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1823 cookie=0x1, in_port=1 actions=output:1
1824 cookie=0x2, table=1, in_port=2 actions=output:1
1825OFPST_FLOW reply (OF1.1):
1826])
1827AT_CHECK([ovs-ofctl -O OpenFlow11 del-flows br0 table=0])
1828AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1829 cookie=0x2, table=1, in_port=2 actions=output:1
1830OFPST_FLOW reply (OF1.1):
1831])
1832AT_CHECK([ovs-ofctl -O OpenFlow11 del-flows br0 table=1])
1833AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1834OFPST_FLOW reply (OF1.1):
1835])
1836AT_CHECK([ovs-ofctl -O OpenFlow11 add-flow br0 cookie=0x1,in_port=1,actions=1])
1837AT_CHECK([ovs-ofctl -O OpenFlow11 add-flow br0 cookie=0x2,in_port=2,table=1,actions=1])
1838AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1839 cookie=0x1, in_port=1 actions=output:1
1840 cookie=0x2, table=1, in_port=2 actions=output:1
1841OFPST_FLOW reply (OF1.1):
1842])
1843AT_CHECK([ovs-ofctl -O OpenFlow11 del-flows br0])
0e197060 1844AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip], [0], [dnl
75fa58f8 1845OFPST_FLOW reply (OF1.1):
0e197060 1846 cookie=0x2, table=1, in_port=2 actions=output:1
75fa58f8
BP
1847])
1848OVS_VSWITCHD_STOP
1849AT_CLEANUP
1850
9dcd1c00
SH
1851AT_SETUP([ofproto - del flows based on table id (OpenFlow 1.2)])
1852OVS_VSWITCHD_START
1853AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 cookie=0x1,in_port=1,actions=1])
1854AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 cookie=0x2,in_port=2,table=1,actions=1])
1855AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1856 cookie=0x1, in_port=1 actions=output:1
1857 cookie=0x2, table=1, in_port=2 actions=output:1
1858OFPST_FLOW reply (OF1.2):
1859])
1860AT_CHECK([ovs-ofctl -O OpenFlow12 del-flows br0 table=0])
1861AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1862 cookie=0x2, table=1, in_port=2 actions=output:1
1863OFPST_FLOW reply (OF1.2):
1864])
1865AT_CHECK([ovs-ofctl -O OpenFlow12 del-flows br0 table=1])
1866AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1867OFPST_FLOW reply (OF1.2):
1868])
1869AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 cookie=0x1,in_port=1,actions=1])
1870AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 cookie=0x2,in_port=2,table=1,actions=1])
1871AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1872 cookie=0x1, in_port=1 actions=output:1
1873 cookie=0x2, table=1, in_port=2 actions=output:1
1874OFPST_FLOW reply (OF1.2):
1875])
1876AT_CHECK([ovs-ofctl -O OpenFlow12 del-flows br0])
1877AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1878OFPST_FLOW reply (OF1.2):
1879])
1880OVS_VSWITCHD_STOP
1881AT_CLEANUP
1882
71300040
BP
1883AT_SETUP([ofproto - flow_mod with out_port matching (OpenFlow 1.0)])
1884OVS_VSWITCHD_START
1885AT_DATA([flows.txt], [dnl
1886 in_port=1 actions=output:2
1887 in_port=2 actions=output:1,output:2,output:3
1888 in_port=3 actions=output:3,output:1,output:2
1889 in_port=4 actions=drop
1890 in_port=5 actions=output:3
1891 in_port=6 actions=output:1
1892])
1893AT_CHECK([ovs-ofctl -F openflow10 add-flows br0 flows.txt])
1894(cat flows.txt; echo 'OFPST_FLOW reply:') > expout
1895AT_CHECK([ovs-ofctl -F openflow10 dump-flows br0 | ofctl_strip | sort], [0],
1896 [expout])
1897
1898(grep 'output:2' flows.txt; echo 'OFPST_FLOW reply:') > expout
1899AT_CHECK([ovs-ofctl -F openflow10 dump-flows br0 out_port=2 | ofctl_strip | sort], [0], [expout])
1900
1901AT_CHECK([ovs-ofctl -F openflow10 del-flows br0 out_port=2])
1902(grep -v 'output:2' flows.txt; echo 'OFPST_FLOW reply:') > expout
1903AT_CHECK([ovs-ofctl -F openflow10 dump-flows br0 | ofctl_strip | sort], [0],
1904 [expout])
1905
1906AT_CHECK([ovs-ofctl -F openflow10 del-flows br0 out_port=3])
1907(grep -v 'output:[[23]]' flows.txt; echo 'OFPST_FLOW reply:') > expout
1908AT_CHECK([ovs-ofctl -F openflow10 dump-flows br0 | ofctl_strip | sort], [0],
1909 [expout])
1910
1911AT_CHECK([ovs-ofctl -F openflow10 del-flows br0 out_port=1])
1912(grep -v 'output:[[123]]' flows.txt; echo 'OFPST_FLOW reply:') > expout
1913AT_CHECK([ovs-ofctl -F openflow10 dump-flows br0 | ofctl_strip | sort], [0],
1914 [expout])
1915
1916OVS_VSWITCHD_STOP
1917AT_CLEANUP
1918
1919AT_SETUP([ofproto - flow_mod with out_port matching (OpenFlow 1.1)])
1920OVS_VSWITCHD_START
1921AT_DATA([flows.txt], [dnl
1922 in_port=1 actions=output:2
1923 in_port=2 actions=output:1,write_actions(output:2,output:3)
1924 in_port=3 actions=output:3,output:1,write_actions(output:2)
1925 in_port=4 actions=drop
1926 in_port=5 actions=write_actions(output:3)
1927 in_port=6 actions=output:1
1928])
1929AT_CHECK([ovs-ofctl -O OpenFlow11 add-flows br0 flows.txt])
1930(cat flows.txt; echo 'OFPST_FLOW reply (OF1.1):') > expout
1931AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0],
1932 [expout])
1933
1934(grep 'output:2' flows.txt; echo 'OFPST_FLOW reply (OF1.1):') > expout
1935AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 out_port=2 | ofctl_strip | sort], [0], [expout])
1936
1937AT_CHECK([ovs-ofctl -O OpenFlow11 del-flows br0 out_port=2])
1938(grep -v 'output:2' flows.txt; echo 'OFPST_FLOW reply (OF1.1):') > expout
1939AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0],
1940 [expout])
1941
1942AT_CHECK([ovs-ofctl -O OpenFlow11 del-flows br0 out_port=3])
1943(grep -v 'output:[[23]]' flows.txt; echo 'OFPST_FLOW reply (OF1.1):') > expout
1944AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0],
1945 [expout])
1946
1947AT_CHECK([ovs-ofctl -O OpenFlow11 del-flows br0 out_port=1])
1948(grep -v 'output:[[123]]' flows.txt; echo 'OFPST_FLOW reply (OF1.1):') > expout
1949AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0],
1950 [expout])
1951
1952OVS_VSWITCHD_STOP
1953AT_CLEANUP
1954
1955AT_SETUP([ofproto - flow_mod with out_group matching (OpenFlow 1.1)])
1956OVS_VSWITCHD_START
1957AT_DATA([groups.txt], [dnl
1958group_id=1,type=all,bucket=output:10
1959group_id=2,type=all,bucket=output:10
1960group_id=3,type=all,bucket=output:10
1961])
1962AT_CHECK([ovs-ofctl -O OpenFlow11 add-groups br0 groups.txt])
1963AT_DATA([flows.txt], [dnl
1964 in_port=1 actions=group:2,output:5
1965 in_port=2 actions=group:1,write_actions(group:2,group:3,output:6)
1966 in_port=3 actions=group:3,group:1,write_actions(group:2,output:3)
1967 in_port=4 actions=output:4
1968 in_port=5 actions=write_actions(output:4,group:3)
1969 in_port=6 actions=group:1
1970])
1971AT_CHECK([ovs-ofctl -O OpenFlow11 add-flows br0 flows.txt])
1972(cat flows.txt; echo 'OFPST_FLOW reply (OF1.1):') > expout
1973AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0],
1974 [expout])
1975
1976(grep 'output:3' flows.txt | grep 'group:2'; echo 'OFPST_FLOW reply (OF1.1):') > expout
1977AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 out_port=3,out_group=2 | ofctl_strip | sort], [0], [expout])
1978
1979AT_CHECK([ovs-ofctl -O OpenFlow11 del-flows br0 out_group=2])
1980(grep -v 'group:2' flows.txt; echo 'OFPST_FLOW reply (OF1.1):') > expout
1981AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0],
1982 [expout])
1983
1984AT_CHECK([ovs-ofctl -O OpenFlow11 del-flows br0 out_group=3])
1985(grep -v 'group:[[23]]' flows.txt; echo 'OFPST_FLOW reply (OF1.1):') > expout
1986AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0],
1987 [expout])
1988
1989AT_CHECK([ovs-ofctl -O OpenFlow11 del-flows br0 out_group=1])
1990(grep -v 'group:[[123]]' flows.txt; echo 'OFPST_FLOW reply (OF1.1):') > expout
1991AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0],
1992 [expout])
1993
1994OVS_VSWITCHD_STOP
1995AT_CLEANUP
1996
25070e04
JR
1997AT_SETUP([ofproto - bundle flow_mod with out group matching (OpenFlow 1.4)])
1998OVS_VSWITCHD_START
1999AT_DATA([bundle.txt], [dnl
2000group group_id=1,type=all,bucket=output:10
2001group group_id=2,type=all,bucket=output:10
2002group group_id=3,type=all,bucket=output:10
2003flow in_port=1 actions=group:2,output:5
2004flow in_port=2 actions=group:1,write_actions(group:2,group:3,output:6)
2005flow in_port=3 actions=group:3,group:1,write_actions(group:2,output:3)
2006flow in_port=4 actions=output:4
2007flow in_port=5 actions=write_actions(output:4,group:3)
2008flow in_port=6 actions=group:1
2009])
2010AT_CHECK([ovs-ofctl bundle br0 bundle.txt])
2011
2012# for checking
2013AT_DATA([flows.txt], [dnl
2014 in_port=1 actions=group:2,output:5
2015 in_port=2 actions=group:1,write_actions(group:2,group:3,output:6)
2016 in_port=3 actions=group:3,group:1,write_actions(group:2,output:3)
2017 in_port=4 actions=output:4
2018 in_port=5 actions=write_actions(output:4,group:3)
2019 in_port=6 actions=group:1
2020])
2021
2022(cat flows.txt; echo 'OFPST_FLOW reply (OF1.4):') > expout
2023AT_CHECK([ovs-ofctl -O OpenFlow14 dump-flows br0 | ofctl_strip | sort], [0],
2024 [expout])
2025
2026(grep 'output:3' flows.txt | grep 'group:2'; echo 'OFPST_FLOW reply (OF1.4):') > expout
2027AT_CHECK([ovs-ofctl -O OpenFlow14 dump-flows br0 out_port=3,out_group=2 | ofctl_strip | sort], [0], [expout])
2028
2029AT_CHECK([ovs-ofctl -O OpenFlow14 del-flows br0 out_group=2])
2030(grep -v 'group:2' flows.txt; echo 'OFPST_FLOW reply (OF1.4):') > expout
2031AT_CHECK([ovs-ofctl -O OpenFlow14 dump-flows br0 | ofctl_strip | sort], [0],
2032 [expout])
2033
2034AT_CHECK([ovs-ofctl -O OpenFlow14 del-flows br0 out_group=3])
2035(grep -v 'group:[[23]]' flows.txt; echo 'OFPST_FLOW reply (OF1.4):') > expout
2036AT_CHECK([ovs-ofctl -O OpenFlow14 dump-flows br0 | ofctl_strip | sort], [0],
2037 [expout])
2038
2039AT_CHECK([ovs-ofctl -O OpenFlow14 del-flows br0 out_group=1])
2040(grep -v 'group:[[123]]' flows.txt; echo 'OFPST_FLOW reply (OF1.4):') > expout
2041AT_CHECK([ovs-ofctl -O OpenFlow14 dump-flows br0 | ofctl_strip | sort], [0],
2042 [expout])
2043
2044OVS_VSWITCHD_STOP
2045AT_CLEANUP
2046
6dd3c787
JR
2047AT_SETUP([ofproto - bundle packet-out (OpenFlow 1.4)])
2048OVS_VSWITCHD_START
2049
2050ovs-ofctl del-flows br0
2051ovs-ofctl add-flow br0 priority=0,actions=drop
2052
2053# Start a monitor listening for packet-ins.
2054AT_CHECK([ovs-ofctl -P standard monitor br0 --detach --no-chdir --pidfile])
2055ovs-appctl -t ovs-ofctl ofctl/send 0109000c0123456700000080
2056ovs-appctl -t ovs-ofctl ofctl/barrier
2057ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
2058AT_CAPTURE_FILE([monitor.log])
2059
2060# This bundle adds a group, a flow using that group and then a
2061# packet-out that needs them both. Finally the bundle deletes all
2062# groups, which also deletes the flow, leaving only the drop flow in
2063# the table. If this works properly, the packet-out should get
2064# translated and processed before the flow disappears. Also, if the
2065# bundle were to fail, the packet-in should not get executed.
2066AT_DATA([bundle.txt], [dnl
2067group group_id=1,type=all,bucket=output:controller
2068flow in_port=6 actions=group:1
2069packet-out in_port=6, packet=0001020304050010203040501234 actions=table
2070group delete
2071])
2072AT_CHECK([ovs-ofctl bundle br0 bundle.txt])
2073
2074# Verify that only the drop flow remains.
2075AT_CHECK([ovs-ofctl -O OpenFlow14 dump-flows br0 | ofctl_strip | sort], [0],
2076 [ reset_counts priority=0 actions=drop
2077OFPST_FLOW reply (OF1.4):
2078])
2079
2080# Verify that the packet-in was received via controller action.
2081AT_CHECK([sed 's/ (xid=0x[[1-9a-fA-F]][[0-9a-fA-F]]*)//' monitor.log], [0],
2082 [OFPT_PACKET_IN (xid=0x0): total_len=14 in_port=6 (via action) data_len=14 (unbuffered)
2083vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1234
2084])
2085
2086OVS_VSWITCHD_STOP
2087AT_CLEANUP
2088
2089AT_SETUP([ofproto - bundle packet-out, failing bundle commit (OpenFlow 1.4)])
2090OVS_VSWITCHD_START
2091
2092ovs-ofctl del-flows br0
2093ovs-ofctl add-flow br0 priority=0,actions=drop
2094
2095# Start a monitor listening for packet-ins.
2096AT_CHECK([ovs-ofctl -P standard monitor br0 --detach --no-chdir --pidfile])
2097ovs-appctl -t ovs-ofctl ofctl/send 0109000c0123456700000080
2098ovs-appctl -t ovs-ofctl ofctl/barrier
2099ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
2100AT_CAPTURE_FILE([monitor.log])
2101
2102# This bundle adds a flow using that group and then a packet-out that
2103# needs them both. Finally the bundle adds another flow that referes
2104# to a non-existing group, causing the bundle to fail, and the
2105# packet-in should not get executed.
2106AT_DATA([bundle.txt], [dnl
2107group group_id=1,type=all,bucket=output:controller
2108flow in_port=6 actions=group:1
2109packet-out in_port=6, packet=0001020304050010203040501234 actions=table
2110flow in_port=7 actions=group:2
2111])
50f96b10
BP
2112AT_CHECK([ovs-ofctl bundle br0 bundle.txt 2>&1 | sed '/talking to/,$d' | strip_xids], [], [dnl
2113Error OFPBAC_BAD_OUT_GROUP for: OFPT_FLOW_MOD (OF1.4): ADD in_port=7 actions=group:2
2114Error OFPBFC_MSG_FAILED for: OFPT_BUNDLE_CONTROL (OF1.4):
6dd3c787
JR
2115 bundle_id=0 type=COMMIT_REQUEST flags=atomic ordered
2116])
2117
2118# Verify that only the drop flow remains.
2119AT_CHECK([ovs-ofctl -O OpenFlow14 dump-flows br0 | ofctl_strip | sort], [0],
2120 [ reset_counts priority=0 actions=drop
2121OFPST_FLOW reply (OF1.4):
2122])
2123
2124# Verify that the packet-in was NOT received via controller action.
50f96b10 2125AT_CHECK([strip_xids < monitor.log], [0], [])
6dd3c787
JR
2126
2127OVS_VSWITCHD_STOP
2128AT_CLEANUP
2129
2130AT_SETUP([ofproto - bundle packet-out makes bundle commit to fail(OpenFlow 1.4)])
2131OVS_VSWITCHD_START
2132
2133ovs-ofctl del-flows br0
2134ovs-ofctl add-flow br0 priority=0,actions=drop
2135
2136# Start a monitor listening for packet-ins.
2137AT_CHECK([ovs-ofctl -P standard monitor br0 --detach --no-chdir --pidfile])
2138ovs-appctl -t ovs-ofctl ofctl/send 0109000c0123456700000080
2139ovs-appctl -t ovs-ofctl ofctl/barrier
2140ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
2141AT_CAPTURE_FILE([monitor.log])
2142
2143# This bundle adds a flow using that group and then a packet-out that
2144# needs them both. Finally the bundle adds another flow that referes
2145# to a non-existing group, causing the bundle to fail, and the
2146# packet-in should not get executed.
2147AT_DATA([bundle.txt], [dnl
2148group group_id=1,type=all,bucket=output:controller
2149flow in_port=6 actions=group:1
2150packet-out in_port=6, packet=0001020304050010203040501234 actions=table
2151packet-out in_port=6, packet=0001020304050010203040501234 actions=group:2
2152])
50f96b10
BP
2153AT_CHECK([ovs-ofctl bundle br0 bundle.txt 2>&1 | sed '/talking to/,$d' | strip_xids], [], [dnl
2154Error OFPBAC_BAD_OUT_GROUP for: OFPT_PACKET_OUT (OF1.4): in_port=6 actions=group:2 data_len=14
6dd3c787 2155vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1234
50f96b10 2156Error OFPBFC_MSG_FAILED for: OFPT_BUNDLE_CONTROL (OF1.4):
6dd3c787
JR
2157 bundle_id=0 type=COMMIT_REQUEST flags=atomic ordered
2158])
2159
2160# Verify that only the drop flow remains.
2161AT_CHECK([ovs-ofctl -O OpenFlow14 dump-flows br0 | ofctl_strip | sort], [0],
2162 [ reset_counts priority=0 actions=drop
2163OFPST_FLOW reply (OF1.4):
2164])
2165
2166# Verify that the packet-in was NOT received via controller action.
50f96b10 2167AT_CHECK([strip_xids < monitor.log], [0], [])
6dd3c787
JR
2168
2169OVS_VSWITCHD_STOP
2170AT_CLEANUP
2171
9dcd1c00 2172AT_SETUP([ofproto - flow table configuration (OpenFlow 1.0)])
254750ce
BP
2173OVS_VSWITCHD_START
2174# Check the default configuration.
8811fc0a
BP
2175head_table() {
2176 printf 'OFPST_TABLE reply (xid=0x2):
4bc938cc 2177 table 0%s:
3c1bb396
BP
2178 active=0, lookup=0, matched=0
2179 max_entries=1000000
2180 matching:
2181 in_port: exact match or wildcard
2182 eth_src: exact match or wildcard
2183 eth_dst: exact match or wildcard
2184 eth_type: exact match or wildcard
2185 vlan_vid: exact match or wildcard
2186 vlan_pcp: exact match or wildcard
2187 ip_src: exact match or wildcard
2188 ip_dst: exact match or wildcard
2189 nw_proto: exact match or wildcard
2190 nw_tos: exact match or wildcard
2191 tcp_src: exact match or wildcard
2192 tcp_dst: exact match or wildcard
8811fc0a 2193
4bc938cc 2194' "$1"
8811fc0a
BP
2195}
2196ditto() {
2197 for i in `seq $1 $2`; do
4bc938cc 2198 printf ' table %d: ditto\n' $i
8811fc0a
BP
2199 done
2200}
4bc938cc 2201(head_table; ditto 1 253) > expout
254750ce
BP
2202AT_CHECK([ovs-ofctl dump-tables br0], [0], [expout])
2203# Change the configuration.
2204AT_CHECK(
2205 [ovs-vsctl \
2206 -- --id=@t0 create Flow_Table name=main \
2207 -- --id=@t1 create Flow_Table flow-limit=1024 \
2208 -- set bridge br0 'flow_tables={1=@t1,0=@t0}' \
c724bd67 2209 | uuidfilt],
254750ce
BP
2210 [0], [<0>
2211<1>
2212])
2213# Check that the configuration was updated.
4bc938cc 2214(head_table ' ("main")'; echo ' table 1:
8811fc0a
BP
2215 active=0, lookup=0, matched=0
2216 max_entries=1024
2217 (same matching)
2218
4bc938cc 2219 table 2:
8811fc0a
BP
2220 active=0, lookup=0, matched=0
2221 max_entries=1000000
2222 (same matching)
2223'; ditto 3 253) > expout
254750ce
BP
2224AT_CHECK([ovs-ofctl dump-tables br0], [0], [expout])
2225OVS_VSWITCHD_STOP
2226AT_CLEANUP
2227
3fbbcba7
BP
2228dnl In-band and fail-open add "hidden rules" to table 0. These rules shouldn't
2229dnl be visible to OpenFlow. This test checks that "dump-flows" and
2230dnl "dump-tables" don't make them visible.
2231AT_SETUP([ofproto - hidden rules not in table stats])
2232# Use an IP address for a controller that won't actually exist: we
2233# want to create in-band rules but we do not want to actually connect
2234# to a controller (because that could mess about with our test). The
2235# Class E range 240.0.0.0 - 255.255.255.255 seems like a good choice.
2236OVS_VSWITCHD_START([set-controller br0 tcp:240.0.0.1:6653])
2237for i in 1 2 3 4 5; do ovs-appctl time/warp 1000; done
2238
2239# Check that no hidden flows are visible in OpenFlow.
50f96b10 2240AT_CHECK([ovs-ofctl dump-flows br0 | strip_xids], [0], [NXST_FLOW reply:
3fbbcba7
BP
2241])
2242
2243# Check that some hidden flows related to 240.0.0.1 are actually in table 0.
2244#
2245# We discard flows that mention table_id because we only want table 0 flows,
2246# which in OVS is implied by the absence of a table_id.
2247AT_CHECK([ovs-appctl bridge/dump-flows br0], [0], [stdout])
2248AT_CHECK([test `grep '240\.0\.0\.1' stdout | grep -v table_id= | wc -l` -gt 0])
2249
2250# Check that dump-tables doesn't count the hidden flows.
8811fc0a 2251head_table() {
50f96b10 2252 printf 'OFPST_TABLE reply:
4bc938cc 2253 table 0:
3fbbcba7
BP
2254 active=0, lookup=0, matched=0
2255 max_entries=1000000
2256 matching:
2257 in_port: exact match or wildcard
2258 eth_src: exact match or wildcard
2259 eth_dst: exact match or wildcard
2260 eth_type: exact match or wildcard
2261 vlan_vid: exact match or wildcard
2262 vlan_pcp: exact match or wildcard
2263 ip_src: exact match or wildcard
2264 ip_dst: exact match or wildcard
2265 nw_proto: exact match or wildcard
2266 nw_tos: exact match or wildcard
2267 tcp_src: exact match or wildcard
2268 tcp_dst: exact match or wildcard
8811fc0a 2269
4bc938cc 2270'
8811fc0a
BP
2271}
2272ditto() {
2273 for i in `seq $1 $2`; do
4bc938cc 2274 printf ' table %d: ditto\n' $i
8811fc0a
BP
2275 done
2276}
4bc938cc 2277(head_table; ditto 1 253) > expout
50f96b10 2278AT_CHECK([ovs-ofctl dump-tables br0 | strip_xids], [0], [expout])
74f5c9db 2279OVS_VSWITCHD_STOP(["/240\.0\.0\.1/d"])
3fbbcba7
BP
2280AT_CLEANUP
2281
9dcd1c00
SH
2282AT_SETUP([ofproto - flow table configuration (OpenFlow 1.2)])
2283OVS_VSWITCHD_START
2284# Check the default configuration.
8811fc0a
BP
2285head_table() {
2286 printf 'OFPST_TABLE reply (OF1.2) (xid=0x2):
4bc938cc 2287 table 0%s:
3c1bb396
BP
2288 active=0, lookup=0, matched=0
2289 metadata: match=0xffffffffffffffff write=0xffffffffffffffff
2290 config=controller
2291 max_entries=1000000
2292 instructions (table miss and others):
8811fc0a 2293 instructions: apply_actions,clear_actions,write_actions,write_metadata,goto_table
3c1bb396
BP
2294 Write-Actions and Apply-Actions features:
2295 actions: output group set_field strip_vlan push_vlan mod_nw_ttl dec_ttl set_mpls_ttl dec_mpls_ttl push_mpls pop_mpls set_queue
f6ecf944 2296 supported on Set-Field: metadata in_port_oxm eth_src eth_dst vlan_vid vlan_pcp mpls_label mpls_tc ip_src ip_dst ipv6_src ipv6_dst ipv6_label ip_dscp nw_ecn arp_op arp_spa arp_tpa arp_sha arp_tha tcp_src tcp_dst udp_src udp_dst sctp_src sctp_dst icmp_type icmp_code icmpv6_type icmpv6_code nd_target nd_sll nd_tll
3c1bb396
BP
2297 matching:
2298 metadata: exact match or wildcard
2299 in_port_oxm: exact match or wildcard
2300 eth_src: exact match or wildcard
2301 eth_dst: exact match or wildcard
2302 eth_type: exact match or wildcard
2303 vlan_vid: exact match or wildcard
2304 vlan_pcp: exact match or wildcard
2305 mpls_label: exact match or wildcard
2306 mpls_tc: exact match or wildcard
2307 ip_src: exact match or wildcard
2308 ip_dst: exact match or wildcard
2309 ipv6_src: exact match or wildcard
2310 ipv6_dst: exact match or wildcard
2311 ipv6_label: exact match or wildcard
2312 nw_proto: exact match or wildcard
2313 ip_dscp: exact match or wildcard
2314 nw_ecn: exact match or wildcard
2315 arp_op: exact match or wildcard
2316 arp_spa: exact match or wildcard
2317 arp_tpa: exact match or wildcard
2318 arp_sha: exact match or wildcard
2319 arp_tha: exact match or wildcard
2320 tcp_src: exact match or wildcard
2321 tcp_dst: exact match or wildcard
2322 udp_src: exact match or wildcard
2323 udp_dst: exact match or wildcard
2324 sctp_src: exact match or wildcard
2325 sctp_dst: exact match or wildcard
2326 icmp_type: exact match or wildcard
2327 icmp_code: exact match or wildcard
2328 icmpv6_type: exact match or wildcard
2329 icmpv6_code: exact match or wildcard
2330 nd_target: exact match or wildcard
2331 nd_sll: exact match or wildcard
8811fc0a
BP
2332 nd_tll: exact match or wildcard
2333
4bc938cc 2334' "$1"
8811fc0a
BP
2335}
2336ditto() {
2337 for i in `seq $1 $2`; do
4bc938cc 2338 printf ' table %d: ditto\n' $i
8811fc0a
BP
2339 done
2340}
2341tail_table() {
4bc938cc 2342 printf ' table 253:
8811fc0a
BP
2343 active=0, lookup=0, matched=0
2344 metadata: match=0xffffffffffffffff write=0xffffffffffffffff
2345 config=controller
2346 max_entries=1000000
2347 instructions (table miss and others):
2348 instructions: apply_actions,clear_actions,write_actions,write_metadata
2349 (same actions)
2350 (same matching)
2351'
2352}
4bc938cc 2353(head_table; ditto 1 252; tail_table) > expout
9dcd1c00
SH
2354AT_CHECK([ovs-ofctl -O OpenFlow12 dump-tables br0], [0], [expout])
2355# Change the configuration.
2356AT_CHECK(
2357 [ovs-vsctl \
2358 -- --id=@t0 create Flow_Table name=main \
2359 -- --id=@t1 create Flow_Table flow-limit=1024 \
2360 -- set bridge br0 'flow_tables={1=@t1,0=@t0}' \
c724bd67 2361 | uuidfilt],
9dcd1c00
SH
2362 [0], [<0>
2363<1>
2364])
2365# Check that the configuration was updated.
4bc938cc 2366(head_table ' ("main")'; echo ' table 1:
8811fc0a
BP
2367 active=0, lookup=0, matched=0
2368 metadata: match=0xffffffffffffffff write=0xffffffffffffffff
2369 config=controller
2370 max_entries=1024
2371 (same instructions)
2372 (same matching)
2373
4bc938cc 2374 table 2:
8811fc0a
BP
2375 active=0, lookup=0, matched=0
2376 metadata: match=0xffffffffffffffff write=0xffffffffffffffff
2377 config=controller
2378 max_entries=1000000
2379 (same instructions)
2380 (same matching)
2381'; ditto 3 252; tail_table) > expout
9dcd1c00
SH
2382AT_CHECK([ovs-ofctl -O OpenFlow12 dump-tables br0], [0], [expout])
2383OVS_VSWITCHD_STOP
2384AT_CLEANUP
2385
3c4e10fb
BP
2386AT_SETUP([ofproto - table features (OpenFlow 1.3)])
2387OVS_VSWITCHD_START
8811fc0a 2388head_table () {
4bc938cc 2389 printf ' table 0%s:
3c4e10fb
BP
2390 metadata: match=0xffffffffffffffff write=0xffffffffffffffff
2391 max_entries=1000000
8811fc0a
BP
2392 instructions (table miss and others):
2393 next tables: 1-253
2394 instructions: meter,apply_actions,clear_actions,write_actions,write_metadata,goto_table
3c4e10fb
BP
2395 Write-Actions and Apply-Actions features:
2396 actions: output group set_field strip_vlan push_vlan mod_nw_ttl dec_ttl set_mpls_ttl dec_mpls_ttl push_mpls pop_mpls set_queue
7dad8e9a 2397 supported on Set-Field: tun_id tun_src tun_dst tun_ipv6_src tun_ipv6_dst tun_flags tun_gbp_id tun_gbp_flags tun_metadata0 dnl
a07eb11f 2398tun_metadata1 tun_metadata2 tun_metadata3 tun_metadata4 tun_metadata5 tun_metadata6 tun_metadata7 tun_metadata8 tun_metadata9 tun_metadata10 tun_metadata11 tun_metadata12 tun_metadata13 tun_metadata14 tun_metadata15 tun_metadata16 tun_metadata17 tun_metadata18 tun_metadata19 tun_metadata20 tun_metadata21 tun_metadata22 tun_metadata23 tun_metadata24 tun_metadata25 tun_metadata26 tun_metadata27 tun_metadata28 tun_metadata29 tun_metadata30 tun_metadata31 tun_metadata32 tun_metadata33 tun_metadata34 tun_metadata35 tun_metadata36 tun_metadata37 tun_metadata38 tun_metadata39 tun_metadata40 tun_metadata41 tun_metadata42 tun_metadata43 tun_metadata44 tun_metadata45 tun_metadata46 tun_metadata47 tun_metadata48 tun_metadata49 tun_metadata50 tun_metadata51 tun_metadata52 tun_metadata53 tun_metadata54 tun_metadata55 tun_metadata56 tun_metadata57 tun_metadata58 tun_metadata59 tun_metadata60 tun_metadata61 tun_metadata62 tun_metadata63 dnl
17553f27 2399metadata in_port in_port_oxm pkt_mark ct_mark ct_label reg0 reg1 reg2 reg3 reg4 reg5 reg6 reg7 reg8 reg9 reg10 reg11 reg12 reg13 reg14 reg15 xreg0 xreg1 xreg2 xreg3 xreg4 xreg5 xreg6 xreg7 xxreg0 xxreg1 xxreg2 xxreg3 eth_src eth_dst vlan_tci vlan_vid vlan_pcp mpls_label mpls_tc mpls_ttl ip_src ip_dst ipv6_src ipv6_dst ipv6_label nw_tos ip_dscp nw_ecn nw_ttl arp_op arp_spa arp_tpa arp_sha arp_tha tcp_src tcp_dst udp_src udp_dst sctp_src sctp_dst icmp_type icmp_code icmpv6_type icmpv6_code nd_target nd_sll nd_tll nsh_flags nsh_spi nsh_si nsh_c1 nsh_c2 nsh_c3 nsh_c4 nsh_ttl
3c4e10fb
BP
2400 matching:
2401 dp_hash: arbitrary mask
2402 recirc_id: exact match or wildcard
3d4b2e6e 2403 packet_type: exact match or wildcard
18080541 2404 conj_id: exact match or wildcard
3c4e10fb
BP
2405 tun_id: arbitrary mask
2406 tun_src: arbitrary mask
2407 tun_dst: arbitrary mask
7dad8e9a
TLSC
2408 tun_ipv6_src: arbitrary mask
2409 tun_ipv6_dst: arbitrary mask
b666962b 2410 tun_flags: arbitrary mask
ac6073e3
MC
2411 tun_gbp_id: arbitrary mask
2412 tun_gbp_flags: arbitrary mask
9558d2a5
JG
2413 tun_metadata0: arbitrary mask
2414 tun_metadata1: arbitrary mask
2415 tun_metadata2: arbitrary mask
2416 tun_metadata3: arbitrary mask
2417 tun_metadata4: arbitrary mask
2418 tun_metadata5: arbitrary mask
2419 tun_metadata6: arbitrary mask
2420 tun_metadata7: arbitrary mask
2421 tun_metadata8: arbitrary mask
2422 tun_metadata9: arbitrary mask
2423 tun_metadata10: arbitrary mask
2424 tun_metadata11: arbitrary mask
2425 tun_metadata12: arbitrary mask
2426 tun_metadata13: arbitrary mask
2427 tun_metadata14: arbitrary mask
2428 tun_metadata15: arbitrary mask
2429 tun_metadata16: arbitrary mask
2430 tun_metadata17: arbitrary mask
2431 tun_metadata18: arbitrary mask
2432 tun_metadata19: arbitrary mask
2433 tun_metadata20: arbitrary mask
2434 tun_metadata21: arbitrary mask
2435 tun_metadata22: arbitrary mask
2436 tun_metadata23: arbitrary mask
2437 tun_metadata24: arbitrary mask
2438 tun_metadata25: arbitrary mask
2439 tun_metadata26: arbitrary mask
2440 tun_metadata27: arbitrary mask
2441 tun_metadata28: arbitrary mask
2442 tun_metadata29: arbitrary mask
2443 tun_metadata30: arbitrary mask
2444 tun_metadata31: arbitrary mask
2445 tun_metadata32: arbitrary mask
2446 tun_metadata33: arbitrary mask
2447 tun_metadata34: arbitrary mask
2448 tun_metadata35: arbitrary mask
2449 tun_metadata36: arbitrary mask
2450 tun_metadata37: arbitrary mask
2451 tun_metadata38: arbitrary mask
2452 tun_metadata39: arbitrary mask
2453 tun_metadata40: arbitrary mask
2454 tun_metadata41: arbitrary mask
2455 tun_metadata42: arbitrary mask
2456 tun_metadata43: arbitrary mask
2457 tun_metadata44: arbitrary mask
2458 tun_metadata45: arbitrary mask
2459 tun_metadata46: arbitrary mask
2460 tun_metadata47: arbitrary mask
2461 tun_metadata48: arbitrary mask
2462 tun_metadata49: arbitrary mask
2463 tun_metadata50: arbitrary mask
2464 tun_metadata51: arbitrary mask
2465 tun_metadata52: arbitrary mask
2466 tun_metadata53: arbitrary mask
2467 tun_metadata54: arbitrary mask
2468 tun_metadata55: arbitrary mask
2469 tun_metadata56: arbitrary mask
2470 tun_metadata57: arbitrary mask
2471 tun_metadata58: arbitrary mask
2472 tun_metadata59: arbitrary mask
2473 tun_metadata60: arbitrary mask
2474 tun_metadata61: arbitrary mask
2475 tun_metadata62: arbitrary mask
2476 tun_metadata63: arbitrary mask
3c4e10fb
BP
2477 metadata: arbitrary mask
2478 in_port: exact match or wildcard
2479 in_port_oxm: exact match or wildcard
c61f3870 2480 actset_output: exact match or wildcard
3c4e10fb 2481 pkt_mark: arbitrary mask
07659514
JS
2482 ct_state: arbitrary mask
2483 ct_zone: exact match or wildcard
8e53fe8c 2484 ct_mark: arbitrary mask
9daf2348 2485 ct_label: arbitrary mask
daf4d3c1
JR
2486 ct_nw_proto: exact match or wildcard
2487 ct_nw_src: arbitrary mask
2488 ct_nw_dst: arbitrary mask
2489 ct_ipv6_src: arbitrary mask
2490 ct_ipv6_dst: arbitrary mask
2491 ct_tp_src: arbitrary mask
2492 ct_tp_dst: arbitrary mask
3c4e10fb
BP
2493 reg0: arbitrary mask
2494 reg1: arbitrary mask
2495 reg2: arbitrary mask
2496 reg3: arbitrary mask
2497 reg4: arbitrary mask
2498 reg5: arbitrary mask
2499 reg6: arbitrary mask
2500 reg7: arbitrary mask
847b8b02
JP
2501 reg8: arbitrary mask
2502 reg9: arbitrary mask
2503 reg10: arbitrary mask
2504 reg11: arbitrary mask
2505 reg12: arbitrary mask
2506 reg13: arbitrary mask
2507 reg14: arbitrary mask
2508 reg15: arbitrary mask
3c4e10fb
BP
2509 xreg0: arbitrary mask
2510 xreg1: arbitrary mask
2511 xreg2: arbitrary mask
2512 xreg3: arbitrary mask
847b8b02
JP
2513 xreg4: arbitrary mask
2514 xreg5: arbitrary mask
2515 xreg6: arbitrary mask
2516 xreg7: arbitrary mask
b23ada8e
JP
2517 xxreg0: arbitrary mask
2518 xxreg1: arbitrary mask
2519 xxreg2: arbitrary mask
2520 xxreg3: arbitrary mask
3c4e10fb
BP
2521 eth_src: arbitrary mask
2522 eth_dst: arbitrary mask
2523 eth_type: exact match or wildcard
2524 vlan_tci: arbitrary mask
2525 vlan_vid: arbitrary mask
2526 vlan_pcp: exact match or wildcard
2527 mpls_label: exact match or wildcard
2528 mpls_tc: exact match or wildcard
2529 mpls_bos: exact match or wildcard
bef3f465 2530 mpls_ttl: exact match or wildcard
3c4e10fb
BP
2531 ip_src: arbitrary mask
2532 ip_dst: arbitrary mask
2533 ipv6_src: arbitrary mask
2534 ipv6_dst: arbitrary mask
2535 ipv6_label: arbitrary mask
2536 nw_proto: exact match or wildcard
2537 nw_tos: exact match or wildcard
2538 ip_dscp: exact match or wildcard
2539 nw_ecn: exact match or wildcard
2540 nw_ttl: exact match or wildcard
2541 ip_frag: arbitrary mask
2542 arp_op: exact match or wildcard
2543 arp_spa: arbitrary mask
2544 arp_tpa: arbitrary mask
2545 arp_sha: arbitrary mask
2546 arp_tha: arbitrary mask
2547 tcp_src: arbitrary mask
2548 tcp_dst: arbitrary mask
2549 tcp_flags: arbitrary mask
2550 udp_src: arbitrary mask
2551 udp_dst: arbitrary mask
2552 sctp_src: arbitrary mask
2553 sctp_dst: arbitrary mask
2554 icmp_type: exact match or wildcard
2555 icmp_code: exact match or wildcard
2556 icmpv6_type: exact match or wildcard
2557 icmpv6_code: exact match or wildcard
2558 nd_target: arbitrary mask
2559 nd_sll: arbitrary mask
8811fc0a 2560 nd_tll: arbitrary mask
3d2fbd70
JS
2561 nsh_flags: arbitrary mask
2562 nsh_mdtype: exact match or wildcard
2563 nsh_np: exact match or wildcard
2564 nsh_spi: exact match or wildcard
2565 nsh_si: exact match or wildcard
2566 nsh_c1: arbitrary mask
2567 nsh_c2: arbitrary mask
2568 nsh_c3: arbitrary mask
2569 nsh_c4: arbitrary mask
17553f27 2570 nsh_ttl: exact match or wildcard
8811fc0a 2571
4bc938cc 2572' "$1"
8811fc0a
BP
2573}
2574ditto() {
4bc938cc 2575 printf ' table %d:
8811fc0a
BP
2576 metadata: match=0xffffffffffffffff write=0xffffffffffffffff
2577 max_entries=%d
2578 instructions (table miss and others):
2579 next tables: %d-253
2580 (same instructions)
2581 (same actions)
2582 (same matching)
2583
4bc938cc 2584' $1 $2 `expr $1 + 1`
8811fc0a
BP
2585}
2586tail_tables() {
4bc938cc 2587echo ' table 252:
8811fc0a
BP
2588 metadata: match=0xffffffffffffffff write=0xffffffffffffffff
2589 max_entries=1000000
2590 instructions (table miss and others):
2591 next tables: 253
2592 (same instructions)
2593 (same actions)
2594 (same matching)
2595
4bc938cc 2596 table 253:
8811fc0a
BP
2597 metadata: match=0xffffffffffffffff write=0xffffffffffffffff
2598 max_entries=1000000
2599 instructions (table miss and others):
2600 instructions: meter,apply_actions,clear_actions,write_actions,write_metadata
2601 (same actions)
2602 (same matching)
2603'
2604}
4bc938cc 2605(head_table
8811fc0a 2606 for i in `seq 1 251`; do
4bc938cc 2607 ditto $i 1000000
8811fc0a
BP
2608 done
2609 tail_tables) > expout
2610AT_CHECK([ovs-ofctl -O OpenFlow13 dump-table-features br0], [0], [expout])
3c4e10fb
BP
2611# Change the configuration.
2612AT_CHECK(
2613 [ovs-vsctl \
2614 -- --id=@t0 create Flow_Table name=main \
2615 -- --id=@t1 create Flow_Table flow-limit=1024 \
2616 -- set bridge br0 'flow_tables={1=@t1,0=@t0}' \
c724bd67 2617 | uuidfilt],
3c4e10fb
BP
2618 [0], [<0>
2619<1>
2620])
2621# Check that the configuration was updated.
4bc938cc
BP
2622(head_table ' ("main")'
2623 ditto 1 1024
8811fc0a 2624 for i in `seq 2 251`; do
4bc938cc 2625 ditto $i 1000000
8811fc0a
BP
2626 done
2627 tail_tables) > expout
2628AT_CHECK([ovs-ofctl -O OpenFlow13 dump-table-features br0], [0], [expout])
3c4e10fb
BP
2629OVS_VSWITCHD_STOP
2630AT_CLEANUP
2631
4bc938cc
BP
2632AT_SETUP([ofproto - flow table names])
2633OVS_VSWITCHD_START
2634add_of_ports br0 1 2
2635AT_CHECK(
2636 [ovs-vsctl \
2637 -- --id=@t0 create Flow_Table name=zero \
2638 -- --id=@t1 create Flow_Table name=one \
2639 -- --id=@t2 create Flow_Table name=two \
2640 -- set bridge br0 'flow_tables={0=@t0,1=@t1,2=@t2}' \
2641 | uuidfilt],
2642 [0], [<0>
2643<1>
2644<2>
2645])
2646AT_DATA([flows.txt], [dnl
2647table=zero in_port=p2 actions=p1,resubmit(,one)
2648table=one,in_port=p1,ip,actions=ct(table=two)
2649table=one,in_port=p1,arp,actions=goto_table(two)
2650])
2651AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
2652AT_CHECK([ovs-ofctl --names --no-stats dump-flows br0], [0], [dnl
2653 table=zero, in_port=p2 actions=output:p1,resubmit(,one)
2654 table=one, ip,in_port=p1 actions=ct(table=two)
2655 table=one, arp,in_port=p1 actions=resubmit(,two)
2656])
2657AT_CHECK([ovs-ofctl --no-names --no-stats dump-flows br0], [0], [dnl
2658 in_port=2 actions=output:1,resubmit(,1)
2659 table=1, ip,in_port=1 actions=ct(table=2)
2660 table=1, arp,in_port=1 actions=resubmit(,2)
2661])
2662OVS_VSWITCHD_STOP
2663AT_CLEANUP
2664
03c72922
BP
2665AT_SETUP([ofproto - table description (OpenFlow 1.4)])
2666OVS_VSWITCHD_START
2667(x=0
2668 while test $x -lt 254; do
2669 y=`expr $x + 1`
2670 echo " table $x:
bab86012
SJ
2671 eviction=off eviction_flags=OTHER|IMPORTANCE|LIFETIME
2672 vacancy=off"
03c72922
BP
2673 x=$y
2674 done) > expout
2675AT_CHECK([ovs-ofctl -O OpenFlow14 dump-table-desc br0 | sed '/^$/d
2676/^OFPST_TABLE_DESC/d'], [0], [expout])
2677
2678# Change the configuration.
2679AT_CHECK([ovs-ofctl -O Openflow14 mod-table br0 0 evict])
2680# Check that the configuration was updated.
2681mv expout orig-expout
2682sed -e '2s/eviction=off/eviction=on/' <orig-expout > expout
2683AT_CHECK([ovs-ofctl -O OpenFlow14 dump-table-desc br0 | sed '/^$/d
2684/^OFPST_TABLE_DESC/d'], [0], [expout])
de7d3c07
SJ
2685
2686AT_CHECK([ovs-ofctl -O Openflow14 mod-table br0 0 vacancy:20,80])
2687# Check that the configuration was updated.
2688mv expout orig-expout
6c6eedc5 2689sed -e '3s/vacancy=off/vacancy=on vacancy_down=20% vacancy_up=80% vacancy=100%/' <orig-expout > expout
de7d3c07
SJ
2690AT_CHECK([ovs-ofctl -O OpenFlow14 dump-table-desc br0 | sed '/^$/d
2691/^OFPST_TABLE_DESC/d'], [0], [expout])
03c72922
BP
2692OVS_VSWITCHD_STOP
2693AT_CLEANUP
2694
06f64d03 2695AT_SETUP([ofproto - hard limits on flow table size (OpenFlow 1.0)])
254750ce
BP
2696OVS_VSWITCHD_START
2697# Configure a maximum of 4 flows.
2698AT_CHECK(
2699 [ovs-vsctl \
2700 -- --id=@t0 create Flow_Table flow-limit=4 \
2701 -- set bridge br0 flow_tables:0=@t0 \
c724bd67 2702 | uuidfilt],
254750ce
BP
2703 [0], [<0>
2704])
2705# Add 4 flows.
2706for in_port in 1 2 3 4; do
2707 ovs-ofctl add-flow br0 in_port=$in_port,actions=drop
2708done
2709AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
2710 in_port=1 actions=drop
2711 in_port=2 actions=drop
2712 in_port=3 actions=drop
2713 in_port=4 actions=drop
2714NXST_FLOW reply:
2715])
2716# Adding another flow will be refused.
2717AT_CHECK([ovs-ofctl add-flow br0 in_port=5,actions=drop], [1], [], [stderr])
52c57cbb 2718AT_CHECK([ofctl_strip < stderr], [0],
be2b69d1 2719 [OFPT_ERROR: OFPFMFC_TABLE_FULL
52c57cbb 2720OFPT_FLOW_MOD: ADD in_port=5 actions=drop
254750ce
BP
2721])
2722# Also a mod-flow that would add a flow will be refused.
2723AT_CHECK([ovs-ofctl mod-flows br0 in_port=5,actions=drop], [1], [], [stderr])
52c57cbb 2724AT_CHECK([ofctl_strip < stderr], [0],
be2b69d1 2725 [OFPT_ERROR: OFPFMFC_TABLE_FULL
52c57cbb 2726OFPT_FLOW_MOD: MOD in_port=5 actions=drop
254750ce
BP
2727])
2728# Replacing or modifying an existing flow is allowed.
2729AT_CHECK([ovs-ofctl add-flow br0 in_port=4,actions=normal])
2730AT_CHECK([ovs-ofctl mod-flows br0 in_port=3,actions=output:1])
2731AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
2732 in_port=1 actions=drop
2733 in_port=2 actions=drop
2734 in_port=3 actions=output:1
2735 in_port=4 actions=NORMAL
2736NXST_FLOW reply:
2737])
2738OVS_VSWITCHD_STOP
2739AT_CLEANUP
2740
06f64d03 2741AT_SETUP([ofproto - hard limits on flow table size (OpenFlow 1.2)])
9dcd1c00
SH
2742OVS_VSWITCHD_START
2743# Configure a maximum of 4 flows.
2744AT_CHECK(
2745 [ovs-vsctl \
2746 -- --id=@t0 create Flow_Table flow-limit=4 \
2747 -- set bridge br0 flow_tables:0=@t0 \
c724bd67 2748 | uuidfilt],
9dcd1c00
SH
2749 [0], [<0>
2750])
2751# Add 4 flows.
2752for in_port in 1 2 3 4; do
2753 ovs-ofctl -O OpenFlow12 add-flow br0 in_port=$in_port,actions=drop
2754done
2755AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
2756 in_port=1 actions=drop
2757 in_port=2 actions=drop
2758 in_port=3 actions=drop
2759 in_port=4 actions=drop
2760OFPST_FLOW reply (OF1.2):
2761])
2762# Adding another flow will be refused.
2763AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 in_port=5,actions=drop], [1], [], [stderr])
52c57cbb 2764AT_CHECK([ofctl_strip < stderr], [0],
9dcd1c00 2765 [OFPT_ERROR (OF1.2): OFPFMFC_TABLE_FULL
52c57cbb 2766OFPT_FLOW_MOD (OF1.2): ADD in_port=5 actions=drop
9dcd1c00
SH
2767])
2768# Replacing or modifying an existing flow is allowed.
2769AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 in_port=4,actions=normal])
2770AT_CHECK([ovs-ofctl -O OpenFlow12 mod-flows br0 in_port=3,actions=output:1])
2771AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
2772 in_port=1 actions=drop
2773 in_port=2 actions=drop
2774 in_port=3 actions=output:1
2775 in_port=4 actions=NORMAL
2776OFPST_FLOW reply (OF1.2):
2777])
2778OVS_VSWITCHD_STOP
2779AT_CLEANUP
2780
2781AT_SETUP([ofproto - eviction upon table overflow (OpenFlow 1.0)])
254750ce
BP
2782OVS_VSWITCHD_START
2783# Configure a maximum of 4 flows.
2784AT_CHECK(
2785 [ovs-vsctl \
2786 -- --id=@t0 create Flow_Table flow-limit=4 overflow-policy=evict \
2787 -- set bridge br0 flow_tables:0=@t0 \
c724bd67 2788 | uuidfilt],
254750ce
BP
2789 [0], [<0>
2790])
2791# Add 4 flows.
2792for in_port in 4 3 2 1; do
2793 ovs-ofctl add-flow br0 idle_timeout=${in_port}0,in_port=$in_port,actions=drop
2794done
2795AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
b9718b7b
BP
2796 idle_timeout=10, in_port=1 actions=drop
2797 idle_timeout=20, in_port=2 actions=drop
2798 idle_timeout=30, in_port=3 actions=drop
2799 idle_timeout=40, in_port=4 actions=drop
254750ce
BP
2800NXST_FLOW reply:
2801])
2802# Adding another flow will cause the one that expires soonest to be evicted.
2803AT_CHECK([ovs-ofctl add-flow br0 in_port=5,actions=drop])
2804AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
b9718b7b
BP
2805 idle_timeout=20, in_port=2 actions=drop
2806 idle_timeout=30, in_port=3 actions=drop
2807 idle_timeout=40, in_port=4 actions=drop
254750ce
BP
2808 in_port=5 actions=drop
2809NXST_FLOW reply:
2810])
2811# A mod-flow that adds a flow also causes eviction, but replacing or
2812# modifying an existing flow doesn't.
2813AT_CHECK([ovs-ofctl mod-flows br0 in_port=6,actions=drop])
2814AT_CHECK([ovs-ofctl add-flow br0 in_port=4,actions=normal])
2815AT_CHECK([ovs-ofctl mod-flows br0 in_port=3,actions=output:1])
2816AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
b9718b7b 2817 idle_timeout=30, in_port=3 actions=output:1
254750ce
BP
2818 in_port=4 actions=NORMAL
2819 in_port=5 actions=drop
2820 in_port=6 actions=drop
2821NXST_FLOW reply:
2822])
2823# Flows with no timeouts at all cannot be evicted.
2824AT_CHECK([ovs-ofctl add-flow br0 in_port=7,actions=normal])
2825AT_CHECK([ovs-ofctl add-flow br0 in_port=8,actions=drop], [1], [], [stderr])
52c57cbb 2826AT_CHECK([ofctl_strip < stderr], [0],
be2b69d1 2827 [OFPT_ERROR: OFPFMFC_TABLE_FULL
52c57cbb 2828OFPT_FLOW_MOD: ADD in_port=8 actions=drop
254750ce
BP
2829])
2830AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
2831 in_port=4 actions=NORMAL
2832 in_port=5 actions=drop
2833 in_port=6 actions=drop
2834 in_port=7 actions=NORMAL
2835NXST_FLOW reply:
2836])
2837OVS_VSWITCHD_STOP
2838AT_CLEANUP
2839
9dcd1c00
SH
2840AT_SETUP([ofproto - eviction upon table overflow (OpenFlow 1.2)])
2841OVS_VSWITCHD_START
2842# Configure a maximum of 4 flows.
2843AT_CHECK(
2844 [ovs-vsctl \
2845 -- --id=@t0 create Flow_Table flow-limit=4 overflow-policy=evict \
2846 -- set bridge br0 flow_tables:0=@t0 \
c724bd67 2847 | uuidfilt],
9dcd1c00
SH
2848 [0], [<0>
2849])
2850# Add 4 flows.
2851for in_port in 4 3 2 1; do
2852 ovs-ofctl -O OpenFlow12 add-flow br0 idle_timeout=${in_port}0,in_port=$in_port,actions=drop
2853done
2854AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
2855 idle_timeout=10, in_port=1 actions=drop
2856 idle_timeout=20, in_port=2 actions=drop
2857 idle_timeout=30, in_port=3 actions=drop
2858 idle_timeout=40, in_port=4 actions=drop
2859OFPST_FLOW reply (OF1.2):
2860])
2861# Adding another flow will cause the one that expires soonest to be evicted.
2862AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 in_port=5,actions=drop])
2863AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
2864 idle_timeout=20, in_port=2 actions=drop
2865 idle_timeout=30, in_port=3 actions=drop
2866 idle_timeout=40, in_port=4 actions=drop
2867 in_port=5 actions=drop
2868OFPST_FLOW reply (OF1.2):
2869])
0746a84f 2870# In OpenFlow 1.2 a mod-flow does not ever add a flow and thus
9dcd1c00
SH
2871# has no effect on eviction
2872AT_CHECK([ovs-ofctl -O OpenFlow12 mod-flows br0 in_port=6,actions=drop])
2873AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 in_port=4,actions=normal])
2874AT_CHECK([ovs-ofctl -O OpenFlow12 mod-flows br0 in_port=3,actions=output:1])
2875AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
2876 idle_timeout=20, in_port=2 actions=drop
2877 idle_timeout=30, in_port=3 actions=output:1
2878 in_port=4 actions=NORMAL
2879 in_port=5 actions=drop
2880OFPST_FLOW reply (OF1.2):
2881])
2882# Flows with no timeouts at all cannot be evicted.
2883AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 in_port=6,actions=drop])
2884AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 in_port=7,actions=normal])
2885AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 in_port=8,actions=drop], [1], [], [stderr])
52c57cbb 2886AT_CHECK([ofctl_strip < stderr], [0],
9dcd1c00 2887 [OFPT_ERROR (OF1.2): OFPFMFC_TABLE_FULL
52c57cbb 2888OFPT_FLOW_MOD (OF1.2): ADD in_port=8 actions=drop
9dcd1c00
SH
2889])
2890AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
2891 in_port=4 actions=NORMAL
2892 in_port=5 actions=drop
2893 in_port=6 actions=drop
2894 in_port=7 actions=NORMAL
2895OFPST_FLOW reply (OF1.2):
2896])
2897OVS_VSWITCHD_STOP
2898AT_CLEANUP
2899
f70b94de
BP
2900AT_SETUP([ofproto - eviction using importance upon table overflow (OpenFlow 1.4)])
2901OVS_VSWITCHD_START
2902# Configure a maximum of 4 flows.
2903AT_CHECK(
2904 [ovs-vsctl \
82c22d34 2905 -- --id=@t0 create Flow_Table name=evict flow-limit=4 \
f70b94de 2906 -- set bridge br0 flow_tables:0=@t0 \
c724bd67 2907 | uuidfilt],
f70b94de
BP
2908 [0], [<0>
2909])
82c22d34
BP
2910# Use mod-table to turn on eviction just to demonstrate that it works.
2911AT_CHECK([ovs-ofctl -O OpenFlow14 mod-table br0 0 evict])
f70b94de
BP
2912# Add 4 flows.
2913for in_port in 4 3 2 1; do
2914 ovs-ofctl -O Openflow14 add-flow br0 importance=$((in_port + 30)),priority=$((in_port + 5)),hard_timeout=$((in_port + 500)),actions=drop
2915done
2916AT_CHECK([ovs-ofctl -O Openflow14 dump-flows br0 | ofctl_strip | sort], [0], [dnl
2917 hard_timeout=501, importance=31, priority=6 actions=drop
2918 hard_timeout=502, importance=32, priority=7 actions=drop
2919 hard_timeout=503, importance=33, priority=8 actions=drop
2920 hard_timeout=504, importance=34, priority=9 actions=drop
2921OFPST_FLOW reply (OF1.4):
2922])
2923# Adding another flow will cause the one with lowest importance to be evicted.
2924AT_CHECK([ovs-ofctl -O Openflow14 add-flow br0 hard_timeout=505,importance=35,priority=10,in_port=2,actions=drop])
2925AT_CHECK([ovs-ofctl -O Openflow14 dump-flows br0 | ofctl_strip | sort], [0], [dnl
2926 hard_timeout=502, importance=32, priority=7 actions=drop
2927 hard_timeout=503, importance=33, priority=8 actions=drop
2928 hard_timeout=504, importance=34, priority=9 actions=drop
2929 hard_timeout=505, importance=35, priority=10,in_port=2 actions=drop
2930OFPST_FLOW reply (OF1.4):
2931])
2932# Disable the Eviction configuration.
82c22d34 2933AT_CHECK([ovs-ofctl -O OpenFlow14 mod-table br0 0 noevict])
f70b94de
BP
2934# Adding another flow will cause the system to give error for FULL TABLE.
2935AT_CHECK([ovs-ofctl -O Openflow14 add-flow br0 hard_timeout=506,importance=36,priority=11,actions=drop],[1], [], [stderr])
52c57cbb 2936AT_CHECK([ofctl_strip < stderr], [0],
f70b94de 2937 [OFPT_ERROR (OF1.4): OFPFMFC_TABLE_FULL
52c57cbb 2938OFPT_FLOW_MOD (OF1.4): ADD priority=11 hard:506 importance:36 actions=drop
f70b94de
BP
2939])
2940#Dump flows. It should show only the old values
2941AT_CHECK([ovs-ofctl -O Openflow14 dump-flows br0 | ofctl_strip | sort], [0], [dnl
2942 hard_timeout=502, importance=32, priority=7 actions=drop
2943 hard_timeout=503, importance=33, priority=8 actions=drop
2944 hard_timeout=504, importance=34, priority=9 actions=drop
2945 hard_timeout=505, importance=35, priority=10,in_port=2 actions=drop
2946OFPST_FLOW reply (OF1.4):
2947])
2948# mod-flow that would modify a flow will be done successfully.
2949AT_CHECK([ovs-ofctl -O Openflow14 mod-flows br0 in_port=2,actions=NORMAL])
2950AT_CHECK([ovs-ofctl -O Openflow14 dump-flows br0 | ofctl_strip | sort], [0], [dnl
2951 hard_timeout=502, importance=32, priority=7 actions=drop
2952 hard_timeout=503, importance=33, priority=8 actions=drop
2953 hard_timeout=504, importance=34, priority=9 actions=drop
2954 hard_timeout=505, importance=35, priority=10,in_port=2 actions=NORMAL
2955OFPST_FLOW reply (OF1.4):
2956])
2957# Also a mod-flow that would add a flow will be refused.
2958AT_CHECK([ovs-ofctl mod-flows br0 in_port=5,actions=drop], [1], [], [stderr])
52c57cbb 2959AT_CHECK([ofctl_strip < stderr], [0],
f70b94de 2960 [OFPT_ERROR: OFPFMFC_TABLE_FULL
52c57cbb 2961OFPT_FLOW_MOD: MOD in_port=5 actions=drop
f70b94de
BP
2962])
2963OVS_VSWITCHD_STOP
2964AT_CLEANUP
2965
9dcd1c00 2966AT_SETUP([ofproto - eviction upon table overflow, with fairness (OpenFlow 1.0)])
254750ce
BP
2967OVS_VSWITCHD_START
2968# Configure a maximum of 4 flows.
2969AT_CHECK(
2970 [ovs-vsctl \
2971 -- --id=@t0 create Flow_Table name=evict flow-limit=4 \
2972 overflow-policy=evict \
2973 groups='"NXM_OF_IN_PORT[[]]"' \
2974 -- set bridge br0 flow_tables:0=@t0 \
c724bd67 2975 | uuidfilt],
254750ce
BP
2976 [0], [<0>
2977])
2978# Add 4 flows.
2979ovs-ofctl add-flows br0 - <<EOF
2980idle_timeout=10 in_port=2 dl_src=00:44:55:66:77:88 actions=drop
2981idle_timeout=20 in_port=1 dl_src=00:11:22:33:44:55 actions=drop
2982idle_timeout=30 in_port=1 dl_src=00:22:33:44:55:66 actions=drop
2983idle_timeout=40 in_port=1 dl_src=00:33:44:55:66:77 actions=drop
2984EOF
2985AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
b9718b7b
BP
2986 idle_timeout=10, in_port=2,dl_src=00:44:55:66:77:88 actions=drop
2987 idle_timeout=20, in_port=1,dl_src=00:11:22:33:44:55 actions=drop
2988 idle_timeout=30, in_port=1,dl_src=00:22:33:44:55:66 actions=drop
2989 idle_timeout=40, in_port=1,dl_src=00:33:44:55:66:77 actions=drop
254750ce
BP
2990NXST_FLOW reply:
2991])
2992# Adding another flow will cause the one that expires soonest within
2993# the largest group (those with in_port=1) to be evicted. In this
2994# case this is not the same as the one that expires soonest overall
2995# (which is what makes the test interesting):
2996AT_CHECK([ovs-ofctl add-flow br0 in_port=2,dl_src=00:55:66:77:88:99,actions=drop])
2997AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
b9718b7b
BP
2998 idle_timeout=10, in_port=2,dl_src=00:44:55:66:77:88 actions=drop
2999 idle_timeout=30, in_port=1,dl_src=00:22:33:44:55:66 actions=drop
3000 idle_timeout=40, in_port=1,dl_src=00:33:44:55:66:77 actions=drop
254750ce
BP
3001 in_port=2,dl_src=00:55:66:77:88:99 actions=drop
3002NXST_FLOW reply:
3003])
3004# Enlarge the flow limit, change the eviction policy back to strictly
3005# based on expiration, and and add some flows.
3006AT_CHECK([ovs-vsctl set Flow_Table evict groups='[[]]' flow-limit=7])
3007ovs-ofctl add-flows br0 - <<EOF
3008idle_timeout=50 in_port=2 dl_src=00:66:77:88:99:aa actions=drop
3009idle_timeout=60 in_port=2 dl_src=00:77:88:99:aa:bb actions=drop
3010idle_timeout=70 in_port=2 dl_src=00:88:99:aa:bb:cc actions=drop
3011EOF
3012AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
b9718b7b
BP
3013 idle_timeout=10, in_port=2,dl_src=00:44:55:66:77:88 actions=drop
3014 idle_timeout=30, in_port=1,dl_src=00:22:33:44:55:66 actions=drop
3015 idle_timeout=40, in_port=1,dl_src=00:33:44:55:66:77 actions=drop
3016 idle_timeout=50, in_port=2,dl_src=00:66:77:88:99:aa actions=drop
3017 idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=drop
3018 idle_timeout=70, in_port=2,dl_src=00:88:99:aa:bb:cc actions=drop
254750ce
BP
3019 in_port=2,dl_src=00:55:66:77:88:99 actions=drop
3020NXST_FLOW reply:
3021])
3022# Adding another flow will cause the one that expires soonest overall
3023# to be evicted.
3024AT_CHECK([ovs-ofctl add-flow br0 'idle_timeout=80 in_port=2 dl_src=00:99:aa:bb:cc:dd actions=drop'])
3025AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
b9718b7b
BP
3026 idle_timeout=30, in_port=1,dl_src=00:22:33:44:55:66 actions=drop
3027 idle_timeout=40, in_port=1,dl_src=00:33:44:55:66:77 actions=drop
3028 idle_timeout=50, in_port=2,dl_src=00:66:77:88:99:aa actions=drop
3029 idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=drop
3030 idle_timeout=70, in_port=2,dl_src=00:88:99:aa:bb:cc actions=drop
3031 idle_timeout=80, in_port=2,dl_src=00:99:aa:bb:cc:dd actions=drop
254750ce
BP
3032 in_port=2,dl_src=00:55:66:77:88:99 actions=drop
3033NXST_FLOW reply:
3034])
3035# Reducing the flow limit also causes the flows that expire soonest
3036# overall to be evicted.
3037AT_CHECK([ovs-vsctl set Flow_Table evict flow-limit=4])
3038AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
b9718b7b
BP
3039 idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=drop
3040 idle_timeout=70, in_port=2,dl_src=00:88:99:aa:bb:cc actions=drop
3041 idle_timeout=80, in_port=2,dl_src=00:99:aa:bb:cc:dd actions=drop
254750ce
BP
3042 in_port=2,dl_src=00:55:66:77:88:99 actions=drop
3043NXST_FLOW reply:
3044])
3045OVS_VSWITCHD_STOP
3046AT_CLEANUP
80d5aefd 3047
9dcd1c00
SH
3048AT_SETUP([ofproto - eviction upon table overflow, with fairness (OpenFlow 1.2)])
3049OVS_VSWITCHD_START
3050# Configure a maximum of 4 flows.
3051AT_CHECK(
3052 [ovs-vsctl \
3053 -- --id=@t0 create Flow_Table name=evict flow-limit=4 \
3054 overflow-policy=evict \
3055 groups='"NXM_OF_IN_PORT[[]]"' \
3056 -- set bridge br0 flow_tables:0=@t0 \
c724bd67 3057 | uuidfilt],
9dcd1c00
SH
3058 [0], [<0>
3059])
3060# Add 4 flows.
3061ovs-ofctl -O OpenFlow12 add-flows br0 - <<EOF
3062idle_timeout=10 in_port=2 dl_src=00:44:55:66:77:88 actions=drop
3063idle_timeout=20 in_port=1 dl_src=00:11:22:33:44:55 actions=drop
3064idle_timeout=30 in_port=1 dl_src=00:22:33:44:55:66 actions=drop
3065idle_timeout=40 in_port=1 dl_src=00:33:44:55:66:77 actions=drop
3066EOF
3067AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
3068 idle_timeout=10, in_port=2,dl_src=00:44:55:66:77:88 actions=drop
3069 idle_timeout=20, in_port=1,dl_src=00:11:22:33:44:55 actions=drop
3070 idle_timeout=30, in_port=1,dl_src=00:22:33:44:55:66 actions=drop
3071 idle_timeout=40, in_port=1,dl_src=00:33:44:55:66:77 actions=drop
3072OFPST_FLOW reply (OF1.2):
3073])
3074# Adding another flow will cause the one that expires soonest within
3075# the largest group (those with in_port=1) to be evicted. In this
3076# case this is not the same as the one that expires soonest overall
3077# (which is what makes the test interesting):
3078AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 in_port=2,dl_src=00:55:66:77:88:99,actions=drop])
3079AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
3080 idle_timeout=10, in_port=2,dl_src=00:44:55:66:77:88 actions=drop
3081 idle_timeout=30, in_port=1,dl_src=00:22:33:44:55:66 actions=drop
3082 idle_timeout=40, in_port=1,dl_src=00:33:44:55:66:77 actions=drop
3083 in_port=2,dl_src=00:55:66:77:88:99 actions=drop
3084OFPST_FLOW reply (OF1.2):
3085])
3086# Enlarge the flow limit, change the eviction policy back to strictly
3087# based on expiration, and and add some flows.
3088AT_CHECK([ovs-vsctl set Flow_Table evict groups='[[]]' flow-limit=7])
3089ovs-ofctl -O OpenFlow12 add-flows br0 - <<EOF
3090idle_timeout=50 in_port=2 dl_src=00:66:77:88:99:aa actions=drop
3091idle_timeout=60 in_port=2 dl_src=00:77:88:99:aa:bb actions=drop
3092idle_timeout=70 in_port=2 dl_src=00:88:99:aa:bb:cc actions=drop
3093EOF
3094AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
3095 idle_timeout=10, in_port=2,dl_src=00:44:55:66:77:88 actions=drop
3096 idle_timeout=30, in_port=1,dl_src=00:22:33:44:55:66 actions=drop
3097 idle_timeout=40, in_port=1,dl_src=00:33:44:55:66:77 actions=drop
3098 idle_timeout=50, in_port=2,dl_src=00:66:77:88:99:aa actions=drop
3099 idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=drop
3100 idle_timeout=70, in_port=2,dl_src=00:88:99:aa:bb:cc actions=drop
3101 in_port=2,dl_src=00:55:66:77:88:99 actions=drop
3102OFPST_FLOW reply (OF1.2):
3103])
3104# Adding another flow will cause the one that expires soonest overall
3105# to be evicted.
3106AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 'idle_timeout=80 in_port=2 dl_src=00:99:aa:bb:cc:dd actions=drop'])
3107AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
3108 idle_timeout=30, in_port=1,dl_src=00:22:33:44:55:66 actions=drop
3109 idle_timeout=40, in_port=1,dl_src=00:33:44:55:66:77 actions=drop
3110 idle_timeout=50, in_port=2,dl_src=00:66:77:88:99:aa actions=drop
3111 idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=drop
3112 idle_timeout=70, in_port=2,dl_src=00:88:99:aa:bb:cc actions=drop
3113 idle_timeout=80, in_port=2,dl_src=00:99:aa:bb:cc:dd actions=drop
3114 in_port=2,dl_src=00:55:66:77:88:99 actions=drop
3115OFPST_FLOW reply (OF1.2):
3116])
3117# Reducing the flow limit also causes the flows that expire soonest
3118# overall to be evicted.
3119AT_CHECK([ovs-vsctl set Flow_Table evict flow-limit=4])
3120AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
3121 idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=drop
3122 idle_timeout=70, in_port=2,dl_src=00:88:99:aa:bb:cc actions=drop
3123 idle_timeout=80, in_port=2,dl_src=00:99:aa:bb:cc:dd actions=drop
3124 in_port=2,dl_src=00:55:66:77:88:99 actions=drop
3125OFPST_FLOW reply (OF1.2):
3126])
3127OVS_VSWITCHD_STOP
3128AT_CLEANUP
3129
6d56c1f1
K
3130AT_SETUP([ofproto - eviction upon table overflow, with modified hard timeout])
3131OVS_VSWITCHD_START
3132# Configure a maximum of 4 flows.
3133AT_CHECK(
3134 [ovs-vsctl \
3135 -- --id=@t0 create Flow_Table flow-limit=4 overflow-policy=evict \
3136 -- set bridge br0 flow_tables:0=@t0 \
c724bd67 3137 | uuidfilt],
6d56c1f1
K
3138 [0], [<0>
3139])
337a3866 3140ovs-appctl time/stop
6d56c1f1
K
3141# Add 4 flows.
3142for in_port in 4 3 2 1; do
337a3866 3143 ovs-ofctl add-flow br0 hard_timeout=$((10 + in_port * 3)),in_port=$in_port,actions=drop
6d56c1f1
K
3144done
3145AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
337a3866
YT
3146 hard_timeout=13, in_port=1 actions=drop
3147 hard_timeout=16, in_port=2 actions=drop
3148 hard_timeout=19, in_port=3 actions=drop
3149 hard_timeout=22, in_port=4 actions=drop
6d56c1f1
K
3150NXST_FLOW reply:
3151])
3152# Sleep and modify the one that expires soonest
337a3866 3153ovs-appctl time/warp 5000
6d56c1f1 3154AT_CHECK([ovs-ofctl mod-flows br0 in_port=1,actions=drop])
337a3866
YT
3155# At this point the table would looks like:
3156# in_port seconds to expire
3157# 1 13
3158# 2 11
3159# 3 14
3160# 4 17
3161ovs-appctl time/warp 2000
6d56c1f1
K
3162# Adding another flow will cause the one that expires soonest to be evicted.
3163AT_CHECK([ovs-ofctl add-flow br0 in_port=5,actions=drop])
3164AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
337a3866
YT
3165 hard_timeout=13, in_port=1 actions=drop
3166 hard_timeout=19, in_port=3 actions=drop
3167 hard_timeout=22, in_port=4 actions=drop
6d56c1f1
K
3168 in_port=5 actions=drop
3169NXST_FLOW reply:
3170])
3171OVS_VSWITCHD_STOP
3172AT_CLEANUP
3173
3174AT_SETUP([ofproto - eviction upon table overflow, with modified idle timeout])
3175OVS_VSWITCHD_START([add-port br0 p1 -- set interface p1 type=dummy ofport_request=1])
3176# Configure a maximum of 4 flows.
3177AT_CHECK(
3178 [ovs-vsctl \
3179 -- --id=@t0 create Flow_Table flow-limit=4 overflow-policy=evict \
3180 -- set bridge br0 flow_tables:0=@t0 \
c724bd67 3181 | uuidfilt],
6d56c1f1
K
3182 [0], [<0>
3183])
3184# Add 4 flows.
3185for in_port in 4 3 2 1; do
337a3866 3186 ovs-ofctl add-flow br0 idle_timeout=$((10 + in_port * 3)),in_port=$in_port,actions=drop
6d56c1f1 3187done
337a3866 3188ovs-appctl time/stop
6d56c1f1 3189AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
337a3866
YT
3190 idle_timeout=13, in_port=1 actions=drop
3191 idle_timeout=16, in_port=2 actions=drop
3192 idle_timeout=19, in_port=3 actions=drop
3193 idle_timeout=22, in_port=4 actions=drop
6d56c1f1
K
3194NXST_FLOW reply:
3195])
3196# Sleep and receive on the flow that expires soonest
337a3866 3197ovs-appctl time/warp 5000
6d56c1f1 3198AT_CHECK([ovs-appctl netdev-dummy/receive p1 'in_port(1)'])
337a3866
YT
3199# At this point the table would looks like:
3200# in_port seconds to expire
3201# 1 13
3202# 2 11
3203# 3 14
3204# 4 17
3205ovs-appctl time/warp 2000
6d56c1f1
K
3206# Adding another flow will cause the one that expires soonest to be evicted.
3207AT_CHECK([ovs-ofctl add-flow br0 in_port=5,actions=drop])
3208AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
337a3866
YT
3209 idle_timeout=19, in_port=3 actions=drop
3210 idle_timeout=22, in_port=4 actions=drop
6d56c1f1 3211 in_port=5 actions=drop
efe179e0 3212 n_packets=1, n_bytes=14, idle_timeout=13, in_port=1 actions=drop
6d56c1f1
K
3213NXST_FLOW reply:
3214])
3215OVS_VSWITCHD_STOP
3216AT_CLEANUP
3217
9dcd1c00 3218AT_SETUP([ofproto - asynchronous message control (OpenFlow 1.0)])
80d5aefd 3219OVS_VSWITCHD_START
6409e008 3220AT_CHECK([ovs-ofctl -P standard monitor br0 --detach --no-chdir --pidfile])
80d5aefd
BP
3221check_async () {
3222 printf '\n\n--- check_async %d ---\n\n\n' $1
3223 shift
3224
6fc67c4f 3225 ovs-appctl -t ovs-ofctl ofctl/barrier
80d5aefd
BP
3226 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
3227 : > expout
3228
a7349929 3229 # OFPT_PACKET_IN, OFPR_ACTION (controller_id=0)
7f05e7ab 3230 ovs-ofctl -v packet-out br0 controller controller '0001020304050010203040501234'
80d5aefd 3231 if test X"$1" = X"OFPR_ACTION"; then shift;
7f05e7ab 3232 echo >>expout "OFPT_PACKET_IN: total_len=14 in_port=CONTROLLER (via action) data_len=14 (unbuffered)
e6d9ab56 3233vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1234"
80d5aefd
BP
3234 fi
3235
a7349929 3236 # OFPT_PACKET_IN, OFPR_NO_MATCH (controller_id=123)
7f05e7ab 3237 ovs-ofctl -v packet-out br0 controller 'controller(reason=no_match,id=123)' '0001020304050010203040501234'
a7349929 3238 if test X"$1" = X"OFPR_NO_MATCH"; then shift;
7f05e7ab 3239 echo >>expout "OFPT_PACKET_IN: total_len=14 in_port=CONTROLLER (via no_match) data_len=14 (unbuffered)
e6d9ab56 3240vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1234"
a7349929
BP
3241 fi
3242
3243 # OFPT_PACKET_IN, OFPR_INVALID_TTL (controller_id=0)
6dd3c787 3244 ovs-ofctl packet-out br0 "in_port=controller packet=002583dfb4000026b98cb0f908004500003eb7e200000011339bac11370dac100002d7730035002b8f6d86fb0100000100000000000006626c702d7873066e696369726103636f6d00000f00 actions=dec_ttl"
80d5aefd 3245 if test X"$1" = X"OFPR_INVALID_TTL"; then shift;
7f05e7ab 3246 echo >>expout "OFPT_PACKET_IN: total_len=76 in_port=CONTROLLER (via invalid_ttl) data_len=76 (unbuffered)
e6d9ab56 3247udp,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
3248 fi
3249
3250 # OFPT_PORT_STATUS, OFPPR_ADD
e1b1d06a 3251 ovs-vsctl add-port br0 test -- set Interface test type=dummy ofport_request=1
80d5aefd
BP
3252 if test X"$1" = X"OFPPR_ADD"; then shift;
3253 echo >>expout "OFPT_PORT_STATUS: ADD: 1(test): addr:aa:55:aa:55:00:0x
3254 config: PORT_DOWN
9e1fd49b 3255 state: LINK_DOWN
d02a5f8e 3256 speed: 0 Mbps now, 0 Mbps max"
80d5aefd
BP
3257 fi
3258
3259 # OFPT_PORT_STATUS, OFPPR_DELETE
3260 ovs-vsctl del-port br0 test
3261 if test X"$1" = X"OFPPR_DELETE"; then shift;
3262 echo >>expout "OFPT_PORT_STATUS: DEL: 1(test): addr:aa:55:aa:55:00:0x
3263 config: PORT_DOWN
9e1fd49b 3264 state: LINK_DOWN
d02a5f8e 3265 speed: 0 Mbps now, 0 Mbps max"
80d5aefd
BP
3266 fi
3267
3268 # OFPT_FLOW_REMOVED, OFPRR_DELETE
3269 ovs-ofctl add-flow br0 send_flow_rem,actions=drop
3270 ovs-ofctl --strict del-flows br0 ''
3271 if test X"$1" = X"OFPRR_DELETE"; then shift;
3272 echo >>expout "OFPT_FLOW_REMOVED: reason=delete"
3273 fi
3274 AT_FAIL_IF([test X"$1" != X])
3275
93358108 3276 OVS_WAIT_UNTIL([test `wc -l < "monitor.log"` -ge `wc -l < "expout"`])
80d5aefd
BP
3277
3278 AT_CHECK(
3279 [[sed '
3280s/ (xid=0x[0-9a-fA-F]*)//
3281s/ *duration.*//
3282s/00:0.$/00:0x/' < monitor.log]],
3283 [0], [expout])
3284}
3285
3286# It's a service connection so initially there should be no async messages.
3287check_async 1
3288
99811d07 3289# Set miss_send_len to 128, turning on packet-ins for our service connection.
80d5aefd
BP
3290ovs-appctl -t ovs-ofctl ofctl/send 0109000c0123456700000080
3291check_async 2 OFPR_ACTION OFPPR_ADD OFPPR_DELETE OFPRR_DELETE
3292
3293# Set miss_send_len to 128 and enable invalid_ttl.
3294ovs-appctl -t ovs-ofctl ofctl/send 0109000c0123456700040080
3295check_async 3 OFPR_ACTION OFPR_INVALID_TTL OFPPR_ADD OFPPR_DELETE OFPRR_DELETE
3296
3297# Become slave, which should disable everything except port status.
3298ovs-appctl -t ovs-ofctl ofctl/send 0104001400000002000023200000000a00000002
3299check_async 4 OFPPR_ADD OFPPR_DELETE
3300
3301# Use NXT_SET_ASYNC_CONFIG to enable a patchwork of asynchronous messages.
3302ovs-appctl -t ovs-ofctl ofctl/send 01040028000000020000232000000013000000020000000500000005000000020000000200000005
3303check_async 5 OFPR_INVALID_TTL OFPPR_DELETE OFPRR_DELETE
3304
a7349929
BP
3305# Set controller ID 123.
3306ovs-appctl -t ovs-ofctl ofctl/send 01040018000000030000232000000014000000000000007b
3307check_async 6 OFPR_NO_MATCH OFPPR_DELETE OFPRR_DELETE
3308
3309# Restore controller ID 0.
3310ovs-appctl -t ovs-ofctl ofctl/send 010400180000000300002320000000140000000000000000
3311
80d5aefd
BP
3312# Become master.
3313ovs-appctl -t ovs-ofctl ofctl/send 0104001400000002000023200000000a00000001
a7349929 3314check_async 7 OFPR_ACTION OFPPR_ADD
80d5aefd 3315
d9c8c57c 3316OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
94c33672 3317OVS_VSWITCHD_STOP
80d5aefd 3318AT_CLEANUP
751c7785 3319
9dcd1c00
SH
3320AT_SETUP([ofproto - asynchronous message control (OpenFlow 1.2)])
3321OVS_VSWITCHD_START
6409e008 3322AT_CHECK([ovs-ofctl -O OpenFlow12 -P standard monitor br0 --detach --no-chdir --pidfile])
9dcd1c00
SH
3323check_async () {
3324 printf '\n\n--- check_async %d ---\n\n\n' $1
3325 INDEX=$1
3326 shift
3327
3328 ovs-appctl -t ovs-ofctl ofctl/barrier
3329 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
3330 : > expout
3331
3332 # OFPT_PACKET_IN, OFPR_ACTION (controller_id=0)
3333 ovs-ofctl -O OpenFlow12 -v packet-out br0 none controller '0001020304050010203040501234'
3334 if test X"$1" = X"OFPR_ACTION"; then shift;
3335 echo >>expout "OFPT_PACKET_IN (OF1.2): total_len=14 in_port=ANY (via action) data_len=14 (unbuffered)
e6d9ab56 3336vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1234"
9dcd1c00
SH
3337 fi
3338
3339 # OFPT_PACKET_IN, OFPR_NO_MATCH (controller_id=123)
3340 ovs-ofctl -O OpenFlow12 -v packet-out br0 none 'controller(reason=no_match,id=123)' '0001020304050010203040501234'
3341 if test X"$1" = X"OFPR_NO_MATCH"; then shift;
3342 echo >>expout "OFPT_PACKET_IN (OF1.2): total_len=14 in_port=ANY (via no_match) data_len=14 (unbuffered)
e6d9ab56 3343vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1234"
9dcd1c00
SH
3344 fi
3345
3346 # OFPT_PACKET_IN, OFPR_INVALID_TTL (controller_id=0)
fa8d9001 3347 ovs-ofctl -O OpenFlow12 packet-out br0 none dec_ttl '002583dfb4000026b98cb0f908004500003eb7e200000011339bac11370dac100002d7730035002b8f6d86fb0100000100000000000006626c702d7873066e696369726103636f6d00000f00'
9dcd1c00
SH
3348 if test X"$1" = X"OFPR_INVALID_TTL"; then shift;
3349 echo >>expout "OFPT_PACKET_IN (OF1.2): total_len=76 in_port=ANY (via invalid_ttl) data_len=76 (unbuffered)
e6d9ab56 3350udp,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"
9dcd1c00
SH
3351 fi
3352
3353 # OFPT_PORT_STATUS, OFPPR_ADD
3354 ovs-vsctl add-port br0 test -- set Interface test type=dummy
3355 if test X"$1" = X"OFPPR_ADD"; then shift;
3356 echo >>expout "OFPT_PORT_STATUS (OF1.2): ADD: ${INDEX}(test): addr:aa:55:aa:55:00:0x
3357 config: PORT_DOWN
3358 state: LINK_DOWN
3359 speed: 0 Mbps now, 0 Mbps max"
3360 fi
3361
3362 # OFPT_PORT_STATUS, OFPPR_DELETE
3363 ovs-vsctl del-port br0 test
3364 if test X"$1" = X"OFPPR_DELETE"; then shift;
3365 echo >>expout "OFPT_PORT_STATUS (OF1.2): DEL: ${INDEX}(test): addr:aa:55:aa:55:00:0x
3366 config: PORT_DOWN
3367 state: LINK_DOWN
3368 speed: 0 Mbps now, 0 Mbps max"
3369 fi
3370
3371 # OFPT_FLOW_REMOVED, OFPRR_DELETE
3372 ovs-ofctl -O OpenFlow12 add-flow br0 send_flow_rem,actions=drop
3373 ovs-ofctl -O OpenFlow12 --strict del-flows br0 ''
3374 if test X"$1" = X"OFPRR_DELETE"; then shift;
3375 echo >>expout "OFPT_FLOW_REMOVED (OF1.2): reason=delete table_id=0"
3376 fi
3377 AT_FAIL_IF([test X"$1" != X])
3378
93358108 3379 OVS_WAIT_UNTIL([test `wc -l < "monitor.log"` -ge `wc -l < "expout"`])
9dcd1c00
SH
3380
3381 AT_CHECK(
3382 [[sed '
3383s/ (xid=0x[0-9a-fA-F]*)//
3384s/ *duration.*//
3385s/00:0.$/00:0x/' < monitor.log]],
3386 [0], [expout])
3387}
3388
3389# It's a service connection so initially there should be no async messages.
3390check_async 1
3391
3392# Set miss_send_len to 128, turning on packet-ins for our service connection.
3393ovs-appctl -t ovs-ofctl ofctl/send 0309000c0123456700000080
3394check_async 2 OFPR_ACTION OFPPR_ADD OFPPR_DELETE OFPRR_DELETE
3395
3396# Set miss_send_len to 128 and enable invalid_ttl.
3397ovs-appctl -t ovs-ofctl ofctl/send 0309000c0123456700040080
3398check_async 3 OFPR_ACTION OFPR_INVALID_TTL OFPPR_ADD OFPPR_DELETE OFPRR_DELETE
3399
6ea4776b
JR
3400# Become slave (OF 1.2), which should disable everything except port status.
3401ovs-appctl -t ovs-ofctl ofctl/send 031800180000000200000003000000000000000000000001
9dcd1c00
SH
3402check_async 4 OFPPR_ADD OFPPR_DELETE
3403
3404# Use NXT_SET_ASYNC_CONFIG to enable a patchwork of asynchronous messages.
3405ovs-appctl -t ovs-ofctl ofctl/send 03040028000000020000232000000013000000020000000500000005000000020000000200000005
3406check_async 5 OFPR_INVALID_TTL OFPPR_DELETE OFPRR_DELETE
3407
3408# Set controller ID 123.
3409ovs-appctl -t ovs-ofctl ofctl/send 03040018000000030000232000000014000000000000007b
3410check_async 6 OFPR_NO_MATCH OFPPR_DELETE OFPRR_DELETE
3411
3412# Restore controller ID 0.
3413ovs-appctl -t ovs-ofctl ofctl/send 030400180000000300002320000000140000000000000000
3414
6ea4776b
JR
3415# Become master (OF 1.2).
3416ovs-appctl -t ovs-ofctl ofctl/send 031800180000000400000002000000000000000000000002
9dcd1c00
SH
3417check_async 7 OFPR_ACTION OFPPR_ADD
3418
d9c8c57c 3419OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
9dcd1c00
SH
3420OVS_VSWITCHD_STOP
3421AT_CLEANUP
3422
b21eb1da 3423AT_SETUP([ofproto - asynchronous message control (OpenFlow 1.3)])
e19a6769
YHW
3424OVS_VSWITCHD_START([dnl
3425 add-port br0 p1 -- set Interface p1 type=dummy ofport_request=10
3426])
6409e008 3427AT_CHECK([ovs-ofctl -O OpenFlow13 -P standard monitor br0 --detach --no-chdir --pidfile])
b21eb1da
JR
3428check_async () {
3429 printf '\n\n--- check_async %d ---\n\n\n' $1
3430 INDEX=$1
3431 shift
3432
3433 ovs-appctl -t ovs-ofctl ofctl/barrier
3434 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
3435 : > expout
3436
3437 # OFPT_PACKET_IN, OFPR_ACTION (controller_id=0)
e19a6769 3438 # OFPR_ACTION_SET is treated as OFPR_ACTION in OpenFlow 1.3
b21eb1da 3439 ovs-ofctl -O OpenFlow13 -v packet-out br0 none controller '0001020304050010203040501234'
e19a6769
YHW
3440 ovs-ofctl -O OpenFlow13 add-flow br0 'in_port=10 actions=write_actions(output(CONTROLLER))'
3441 ovs-appctl netdev-dummy/receive p1 'in_port(10),eth(src=00:10:20:30:40:50,dst=00:01:02:03:04:05),eth_type(0x1234)'
b21eb1da
JR
3442 if test X"$1" = X"OFPR_ACTION"; then shift;
3443 echo >>expout "OFPT_PACKET_IN (OF1.3): total_len=14 in_port=ANY (via action) data_len=14 (unbuffered)
e19a6769
YHW
3444vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1234"
3445 echo >>expout "OFPT_PACKET_IN (OF1.3): cookie=0x0 total_len=14 in_port=10 (via action) data_len=14 (unbuffered)
e6d9ab56 3446vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1234"
b21eb1da
JR
3447 fi
3448
3449 # OFPT_PACKET_IN, OFPR_NO_MATCH (controller_id=123)
3450 ovs-ofctl -O OpenFlow13 -v packet-out br0 none 'controller(reason=no_match,id=123)' '0001020304050010203040501234'
3451 if test X"$1" = X"OFPR_NO_MATCH"; then shift;
3452 echo >>expout "OFPT_PACKET_IN (OF1.3): total_len=14 in_port=ANY (via no_match) data_len=14 (unbuffered)
e6d9ab56 3453vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1234"
b21eb1da
JR
3454 fi
3455
3456 # OFPT_PACKET_IN, OFPR_INVALID_TTL (controller_id=0)
fa8d9001 3457 ovs-ofctl -O OpenFlow13 packet-out br0 none dec_ttl '002583dfb4000026b98cb0f908004500003eb7e200000011339bac11370dac100002d7730035002b8f6d86fb0100000100000000000006626c702d7873066e696369726103636f6d00000f00'
b21eb1da
JR
3458 if test X"$1" = X"OFPR_INVALID_TTL"; then shift;
3459 echo >>expout "OFPT_PACKET_IN (OF1.3): total_len=76 in_port=ANY (via invalid_ttl) data_len=76 (unbuffered)
e6d9ab56 3460udp,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"
b21eb1da
JR
3461 fi
3462
3463 # OFPT_PORT_STATUS, OFPPR_ADD
3464 ovs-vsctl add-port br0 test -- set Interface test type=dummy
3465 if test X"$1" = X"OFPPR_ADD"; then shift;
3466 echo >>expout "OFPT_PORT_STATUS (OF1.3): ADD: ${INDEX}(test): addr:aa:55:aa:55:00:0x
3467 config: PORT_DOWN
3468 state: LINK_DOWN
3469 speed: 0 Mbps now, 0 Mbps max"
3470 fi
3471
3472 # OFPT_PORT_STATUS, OFPPR_DELETE
3473 ovs-vsctl del-port br0 test
3474 if test X"$1" = X"OFPPR_DELETE"; then shift;
3475 echo >>expout "OFPT_PORT_STATUS (OF1.3): DEL: ${INDEX}(test): addr:aa:55:aa:55:00:0x
3476 config: PORT_DOWN
3477 state: LINK_DOWN
3478 speed: 0 Mbps now, 0 Mbps max"
3479 fi
3480
3481 # OFPT_FLOW_REMOVED, OFPRR_DELETE
3482 ovs-ofctl -O OpenFlow13 add-flow br0 send_flow_rem,actions=drop
3483 ovs-ofctl -O OpenFlow13 --strict del-flows br0 ''
3484 if test X"$1" = X"OFPRR_DELETE"; then shift;
3485 echo >>expout "OFPT_FLOW_REMOVED (OF1.3): reason=delete table_id=0"
3486 fi
cc40d06b
SH
3487
3488 # OFPT_FLOW_REMOVED, OFPRR_GROUP_DELETE
3489 ovs-ofctl -O OpenFlow13 add-group br0 group_id=1234,type=all,bucket=output:10
3490 ovs-ofctl -O OpenFlow13 add-flow br0 send_flow_rem,actions=group:1234
3491 ovs-ofctl -O OpenFlow13 --strict del-groups br0 group_id=1234
75754d04
JP
3492 if test X"$1" = X"OFPRR_GROUP_DELETE"; then shift;
3493 echo >>expout "OFPT_FLOW_REMOVED (OF1.3): reason=group_delete table_id=0"
cc40d06b
SH
3494 fi
3495
b21eb1da
JR
3496 AT_FAIL_IF([test X"$1" != X])
3497
93358108 3498 OVS_WAIT_UNTIL([test `wc -l < "monitor.log"` -ge `wc -l < "expout"`])
b21eb1da
JR
3499
3500 AT_CHECK(
3501 [[sed '
3502s/ (xid=0x[0-9a-fA-F]*)//
3503s/ *duration.*//
3504s/00:0.$/00:0x/' < monitor.log]],
3505 [0], [expout])
3506}
3507
3508# It's a service connection so initially there should be no async messages.
3509check_async 1
3510
3511# Set miss_send_len to 128, turning on packet-ins for our service connection.
3512ovs-appctl -t ovs-ofctl ofctl/send 0409000c0123456700000080
75754d04 3513check_async 2 OFPR_ACTION OFPPR_ADD OFPPR_DELETE OFPRR_DELETE OFPRR_GROUP_DELETE
b21eb1da
JR
3514
3515# Become slave (OF 1.3), which should disable everything except port status.
3516ovs-appctl -t ovs-ofctl ofctl/send 041800180000000200000003000000000000000000000001
3517check_async 3 OFPPR_ADD OFPPR_DELETE
3518
3519# Use OF 1.3 OFPT_SET_ASYNC to enable a patchwork of asynchronous messages.
75754d04
JP
3520ovs-appctl -t ovs-ofctl ofctl/send 041c00200000000200000002000000050000000500000002000000020000000d
3521check_async 4 OFPR_INVALID_TTL OFPPR_DELETE OFPRR_DELETE OFPRR_GROUP_DELETE
b21eb1da
JR
3522
3523# Set controller ID 123.
3524ovs-appctl -t ovs-ofctl ofctl/send 04040018000000030000232000000014000000000000007b
75754d04 3525check_async 5 OFPR_NO_MATCH OFPPR_DELETE OFPRR_DELETE OFPRR_GROUP_DELETE
b21eb1da
JR
3526
3527# Restore controller ID 0.
3528ovs-appctl -t ovs-ofctl ofctl/send 040400180000000300002320000000140000000000000000
3529
3530# Become master (OF 1.3).
3531ovs-appctl -t ovs-ofctl ofctl/send 041800180000000400000002000000000000000000000002
3532check_async 6 OFPR_ACTION OFPPR_ADD
3533
d9c8c57c 3534OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
b21eb1da
JR
3535OVS_VSWITCHD_STOP
3536AT_CLEANUP
3537
98090482 3538AT_SETUP([ofproto - asynchronous message control (OpenFlow 1.4)])
e19a6769
YHW
3539OVS_VSWITCHD_START([dnl
3540 add-port br0 p1 -- set Interface p1 type=dummy ofport_request=10
3541])
6409e008 3542AT_CHECK([ovs-ofctl -O OpenFlow14 -P standard monitor br0 --detach --no-chdir --pidfile])
98090482
NR
3543check_async () {
3544 printf '\n\n--- check_async %d ---\n\n\n' $1
3545 INDEX=$1
3546 shift
3547
3548 ovs-appctl -t ovs-ofctl ofctl/barrier
3549 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
3550 : > expout
3551
331c07ac 3552 # OFPT_PACKET_IN, OFPR_PACKET_OUT (controller_id=0)
98090482 3553 ovs-ofctl -O OpenFlow14 -v packet-out br0 none controller '0001020304050010203040501234'
331c07ac
YHW
3554 if test X"$1" = X"OFPR_PACKET_OUT"; then shift;
3555 echo >>expout "OFPT_PACKET_IN (OF1.4): total_len=14 in_port=ANY (via packet_out) data_len=14 (unbuffered)
98090482
NR
3556vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1234"
3557 fi
3558
e19a6769
YHW
3559 # OFPT_PACKET_IN, OFPR_ACTION_SET (controller_id=0)
3560 ovs-ofctl -O OpenFlow14 add-flow br0 'in_port=10 actions=write_actions(output(CONTROLLER))'
3561 ovs-appctl netdev-dummy/receive p1 'in_port(10),eth(src=00:10:20:30:40:50,dst=00:01:02:03:04:05),eth_type(0x1234)'
3562 if test X"$1" = X"OFPR_ACTION_SET"; then shift;
3563 echo >>expout "OFPT_PACKET_IN (OF1.4): cookie=0x0 total_len=14 in_port=10 (via action_set) data_len=14 (unbuffered)
3564vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1234"
3565 fi
3566
98090482
NR
3567 # OFPT_PACKET_IN, OFPR_NO_MATCH (controller_id=123)
3568 ovs-ofctl -O OpenFlow14 -v packet-out br0 none 'controller(reason=no_match,id=123)' '0001020304050010203040501234'
3569 if test X"$1" = X"OFPR_NO_MATCH"; then shift;
3570 echo >>expout "OFPT_PACKET_IN (OF1.4): total_len=14 in_port=ANY (via no_match) data_len=14 (unbuffered)
3571vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1234"
3572 fi
3573
3574 # OFPT_PACKET_IN, OFPR_INVALID_TTL (controller_id=0)
3575 ovs-ofctl -O OpenFlow14 packet-out br0 none dec_ttl '002583dfb4000026b98cb0f908004500003eb7e200000011339bac11370dac100002d7730035002b8f6d86fb0100000100000000000006626c702d7873066e696369726103636f6d00000f00'
3576 if test X"$1" = X"OFPR_INVALID_TTL"; then shift;
3577 echo >>expout "OFPT_PACKET_IN (OF1.4): total_len=76 in_port=ANY (via invalid_ttl) data_len=76 (unbuffered)
3578udp,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"
3579 fi
3580
3581# OFPT_PORT_STATUS, OFPPR_ADD
3582 ovs-vsctl add-port br0 test -- set Interface test type=dummy
3583 if test X"$1" = X"OFPPR_ADD"; then shift;
3584 echo >>expout "OFPT_PORT_STATUS (OF1.4): ADD: ${INDEX}(test): addr:aa:55:aa:55:00:0x
3585 config: PORT_DOWN
3586 state: LINK_DOWN
3587 speed: 0 Mbps now, 0 Mbps max"
3588 fi
3589
3590 # OFPT_PORT_STATUS, OFPPR_MODIFY
3591 ovs-ofctl -O OpenFlow14 -vwarn mod-port br0 test up
3592 if test X"$1" = X"OFPPR_MODIFY"; then shift;
3593 echo >>expout "OFPT_PORT_STATUS (OF1.4): MOD: ${INDEX}(test): addr:aa:55:aa:55:00:0x
3594 config: 0
3595 state: LINK_DOWN
3596 speed: 0 Mbps now, 0 Mbps max
3597OFPT_PORT_STATUS (OF1.4): MOD: ${INDEX}(test): addr:aa:55:aa:55:00:0x
3598 config: 0
f73b83fd 3599 state: LIVE
98090482
NR
3600 speed: 0 Mbps now, 0 Mbps max"
3601 fi
3602
3603 # OFPT_PORT_STATUS, OFPPR_DELETE
3604 ovs-vsctl del-port br0 test
3605 if test X"$1" = X"OFPPR_DELETE"; then shift;
3606 echo >>expout "OFPT_PORT_STATUS (OF1.4): DEL: ${INDEX}(test): addr:aa:55:aa:55:00:0x
3607 config: 0
f73b83fd 3608 state: LIVE
98090482
NR
3609 speed: 0 Mbps now, 0 Mbps max"
3610 fi
3611
3612 # OFPT_FLOW_REMOVED, OFPRR_DELETE
3613 ovs-ofctl -O OpenFlow14 add-flow br0 send_flow_rem,actions=drop
3614 ovs-ofctl -O OpenFlow14 --strict del-flows br0 ''
3615 if test X"$1" = X"OFPRR_DELETE"; then shift;
3616 echo >>expout "OFPT_FLOW_REMOVED (OF1.4): reason=delete table_id=0"
3617 fi
3618
6c6eedc5 3619 # OFPT_FLOW_REMOVED, OFPRR_GROUP_DELETE
98090482
NR
3620 ovs-ofctl -O OpenFlow14 add-group br0 group_id=1234,type=all,bucket=output:10
3621 ovs-ofctl -O OpenFlow14 add-flow br0 send_flow_rem,actions=group:1234
3622 ovs-ofctl -O OpenFlow14 --strict del-groups br0 group_id=1234
3623 if test X"$1" = X"OFPRR_GROUP_DELETE"; then shift;
3624 echo >>expout "OFPT_FLOW_REMOVED (OF1.4): reason=group_delete table_id=0"
3625 fi
3626
6c6eedc5
SJ
3627 # OFPT_TABLE_STATUS, OFPTR_VACANCY_UP
3628 if test X"$1" = X"OFPTR_VACANCY_UP"; then shift;
3629 ovs-vsctl -- --id=@t1 create Flow_Table flow-limit=10 -- set bridge br0 flow_tables:1=@t1
3630
3631 # Turn on vacancy events, then add flows until we're full.
3632 # With initial vacancy of 100% and vacancy_up of 80%, so that
3633 # vacancy >= vacancy_up, this enables VACANY_DOWN events, so
3634 # we get a single such message when vacancy dips below 20%.
3635 ovs-ofctl -O OpenFlow14 mod-table br0 1 vacancy:20,80
3636 ovs-ofctl -O OpenFlow14 add-flow br0 table=1,in_port=1,actions=2
3637 ovs-ofctl -O OpenFlow14 add-flow br0 table=1,in_port=2,actions=2
3638 ovs-ofctl -O OpenFlow14 add-flow br0 table=1,in_port=3,actions=2
3639 ovs-ofctl -O OpenFlow14 add-flow br0 table=1,in_port=4,actions=2
3640 ovs-ofctl -O OpenFlow14 add-flow br0 table=1,in_port=5,actions=2
3641 ovs-ofctl -O OpenFlow14 add-flow br0 table=1,in_port=6,actions=2
3642 ovs-ofctl -O OpenFlow14 add-flow br0 table=1,in_port=7,actions=2
3643 ovs-ofctl -O OpenFlow14 add-flow br0 table=1,in_port=8,actions=2
3644 ovs-ofctl -O OpenFlow14 add-flow br0 table=1,in_port=9,actions=2
3645 ovs-ofctl -O OpenFlow14 add-flow br0 table=1,in_port=10,actions=2
3646 echo >>expout "OFPT_TABLE_STATUS (OF1.4): reason=VACANCY_DOWN
3647table_desc:-
3648 table 1:
3649 eviction=off eviction_flags=OTHER|IMPORTANCE|LIFETIME
3650 vacancy=on vacancy_down=20% vacancy_up=80% vacancy=10%"
3651 # Then delete flows until we're empty. Sending the
3652 # VACANCY_DOWN message enabled VACANCY_UP events, so we get a
3653 # single such message when vacancy rises above 80%.
3654 ovs-ofctl -O OpenFlow14 del-flows br0 table=1,in_port=1
3655 ovs-ofctl -O OpenFlow14 del-flows br0 table=1,in_port=2
3656 ovs-ofctl -O OpenFlow14 del-flows br0 table=1,in_port=3
3657 ovs-ofctl -O OpenFlow14 del-flows br0 table=1,in_port=4
3658 ovs-ofctl -O OpenFlow14 del-flows br0 table=1,in_port=5
3659 ovs-ofctl -O OpenFlow14 del-flows br0 table=1,in_port=6
3660 ovs-ofctl -O OpenFlow14 del-flows br0 table=1,in_port=7
3661 ovs-ofctl -O OpenFlow14 del-flows br0 table=1,in_port=8
3662 ovs-ofctl -O OpenFlow14 del-flows br0 table=1,in_port=9
3663 ovs-ofctl -O OpenFlow14 del-flows br0 table=1,in_port=10
3664 echo >>expout "OFPT_TABLE_STATUS (OF1.4): reason=VACANCY_UP
3665table_desc:-
3666 table 1:
3667 eviction=off eviction_flags=OTHER|IMPORTANCE|LIFETIME
3668 vacancy=on vacancy_down=20% vacancy_up=80% vacancy=90%"
3669
3670 # Now approach vacancy from the other direction. First
3671 # disable vacancy events. With initial vacancy of 70%, so
3672 # that vacancy < vacancy_up, this enables VACANCY_UP events.
3673 # That means that filling up the table generates no message,
3674 # but deleting all the flows generates VACANCY_UP at the point
3675 # vacancy rises above 80%.
3676 ovs-ofctl -O OpenFlow14 mod-table br0 1 novacancy
3677 ovs-ofctl -O OpenFlow14 add-flow br0 table=1,in_port=1,actions=2
3678 ovs-ofctl -O OpenFlow14 add-flow br0 table=1,in_port=2,actions=2
3679 ovs-ofctl -O OpenFlow14 add-flow br0 table=1,in_port=3,actions=2
3680 ovs-ofctl -O OpenFlow14 mod-table br0 1 vacancy:20,80
3681 ovs-ofctl -O OpenFlow14 add-flow br0 table=1,in_port=4,actions=2
3682 ovs-ofctl -O OpenFlow14 add-flow br0 table=1,in_port=5,actions=2
3683 ovs-ofctl -O OpenFlow14 add-flow br0 table=1,in_port=6,actions=2
3684 ovs-ofctl -O OpenFlow14 add-flow br0 table=1,in_port=7,actions=2
3685 ovs-ofctl -O OpenFlow14 add-flow br0 table=1,in_port=8,actions=2
3686 ovs-ofctl -O OpenFlow14 add-flow br0 table=1,in_port=9,actions=2
3687 ovs-ofctl -O OpenFlow14 add-flow br0 table=1,in_port=10,actions=2
3688 ovs-ofctl -O OpenFlow14 del-flows br0 table=1,in_port=1
3689 ovs-ofctl -O OpenFlow14 del-flows br0 table=1,in_port=2
3690 ovs-ofctl -O OpenFlow14 del-flows br0 table=1,in_port=3
3691 ovs-ofctl -O OpenFlow14 del-flows br0 table=1,in_port=4
3692 ovs-ofctl -O OpenFlow14 del-flows br0 table=1,in_port=5
3693 ovs-ofctl -O OpenFlow14 del-flows br0 table=1,in_port=6
3694 ovs-ofctl -O OpenFlow14 del-flows br0 table=1,in_port=7
3695 ovs-ofctl -O OpenFlow14 del-flows br0 table=1,in_port=8
3696 ovs-ofctl -O OpenFlow14 del-flows br0 table=1,in_port=9
3697 ovs-ofctl -O OpenFlow14 del-flows br0 table=1,in_port=10
3698 echo >>expout "OFPT_TABLE_STATUS (OF1.4): reason=VACANCY_UP
3699table_desc:-
3700 table 1:
3701 eviction=off eviction_flags=OTHER|IMPORTANCE|LIFETIME
3702 vacancy=on vacancy_down=20% vacancy_up=80% vacancy=90%"
3703 fi
3704
98090482
NR
3705 AT_FAIL_IF([test X"$1" != X])
3706
93358108 3707 OVS_WAIT_UNTIL([test `wc -l < "monitor.log"` -ge `wc -l < "expout"`])
98090482
NR
3708
3709 AT_CHECK(
3710 [[sed '
3711s/ (xid=0x[0-9a-fA-F]*)//
3712s/ *duration.*//
3713s/00:0.$/00:0x/' < monitor.log]],
3714 [0], [expout])
3715}
3716
3717# It's a service connection so initially there should be no async messages.
3718check_async 1
3719
3720# Set miss_send_len to 128, turning on packet-ins for our service connection.
3721ovs-appctl -t ovs-ofctl ofctl/send 0509000c0123456700000080
331c07ac 3722check_async 2 OFPR_PACKET_OUT OFPR_ACTION_SET OFPPR_ADD OFPPR_MODIFY OFPPR_DELETE OFPRR_DELETE OFPRR_GROUP_DELETE
98090482
NR
3723
3724# Become slave (OF 1.4), which should disable everything except port status.
3725ovs-appctl -t ovs-ofctl ofctl/send 051800180000000200000003000000000000000000000001
3726check_async 3 OFPPR_ADD OFPPR_MODIFY OFPPR_DELETE
3727
3728# Use OF 1.4 OFPT_SET_ASYNC to enable a patchwork of asynchronous messages.
331c07ac 3729ovs-appctl -t ovs-ofctl ofctl/send 051c0040000000020000000800000005000100080000002000020008000000020003000800000005000400080000001c00050008000000050008000800000018
6c6eedc5 3730check_async 4 OFPR_INVALID_TTL OFPPR_DELETE OFPRR_DELETE OFPRR_GROUP_DELETE OFPTR_VACANCY_UP
98090482
NR
3731
3732# Set controller ID 123.
3733ovs-appctl -t ovs-ofctl ofctl/send 05040018000000030000232000000014000000000000007b
3734check_async 5 OFPR_NO_MATCH OFPPR_DELETE OFPRR_DELETE OFPRR_GROUP_DELETE
3735
3736# Restore controller ID 0.
3737ovs-appctl -t ovs-ofctl ofctl/send 050400180000000300002320000000140000000000000000
3738
3739# Become master (OF 1.4).
3740ovs-appctl -t ovs-ofctl ofctl/send 051800180000000400000002000000000000000000000002
331c07ac 3741check_async 6 OFPR_PACKET_OUT OFPPR_ADD OFPPR_MODIFY OFPRR_DELETE
98090482 3742
d9c8c57c 3743OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
98090482
NR
3744OVS_VSWITCHD_STOP
3745AT_CLEANUP
3746
ebeae5db
JT
3747AT_SETUP([ofproto - asynchronous message control (OpenFlow 1.5)])
3748OVS_VSWITCHD_START
6409e008 3749AT_CHECK([ovs-ofctl -O OpenFlow15 -P standard monitor br0 --detach --no-chdir --pidfile])
ebeae5db
JT
3750check_async () {
3751 printf '\n\n--- check_async %d ---\n\n\n' $1
3752 INDEX=$1
3753 shift
3754
3755 ovs-appctl -t ovs-ofctl ofctl/barrier
3756 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
3757 : > expout
3758
3759 # Other tests are not working with OF 1.5, and message
3760 # format may change, so leave them out.
3761
3762 # OFPT_PORT_STATUS, OFPPR_ADD
3763 ovs-vsctl add-port br0 test -- set Interface test type=dummy
3764 if test X"$1" = X"OFPPR_ADD"; then shift;
3765 echo >>expout "OFPT_PORT_STATUS (OF1.5): ADD: ${INDEX}(test): addr:aa:55:aa:55:00:0x
3766 config: PORT_DOWN
3767 state: LINK_DOWN
3768 speed: 0 Mbps now, 0 Mbps max"
3769 fi
3770
3771 # OFPT_PORT_STATUS, OFPPR_MODIFY
3772 ovs-ofctl -O OpenFlow15 -vwarn mod-port br0 test up
3773 if test X"$1" = X"OFPPR_MODIFY"; then shift;
3774 echo >>expout "OFPT_PORT_STATUS (OF1.5): MOD: ${INDEX}(test): addr:aa:55:aa:55:00:0x
3775 config: 0
3776 state: LINK_DOWN
3777 speed: 0 Mbps now, 0 Mbps max
3778OFPT_PORT_STATUS (OF1.5): MOD: 2(test): addr:aa:55:aa:55:00:0x
3779 config: 0
f73b83fd 3780 state: LIVE
ebeae5db
JT
3781 speed: 0 Mbps now, 0 Mbps max"
3782 fi
3783
3784 # OFPT_PORT_STATUS, OFPPR_DELETE
3785 ovs-vsctl del-port br0 test
3786 if test X"$1" = X"OFPPR_DELETE"; then shift;
3787 echo >>expout "OFPT_PORT_STATUS (OF1.5): DEL: ${INDEX}(test): addr:aa:55:aa:55:00:0x
3788 config: 0
f73b83fd 3789 state: LIVE
ebeae5db
JT
3790 speed: 0 Mbps now, 0 Mbps max"
3791 fi
3792
3793 AT_FAIL_IF([test X"$1" != X])
3794
93358108 3795 OVS_WAIT_UNTIL([test `wc -l < "monitor.log"` -ge `wc -l < "expout"`])
ebeae5db
JT
3796
3797 AT_CHECK(
3798 [[sed '
3799s/ (xid=0x[0-9a-fA-F]*)//
3800s/ *duration.*//
3801s/00:0.$/00:0x/' < monitor.log]],
3802 [0], [expout])
3803}
3804
3805# It's a service connection so initially there should be no async messages.
3806check_async 1
3807
3808# If we don't set this, async messages are not received.
3809# Set miss_send_len to 128, turning on packet-ins for our service connection.
3810ovs-appctl -t ovs-ofctl ofctl/send 0609000c0123456700000080
3811check_async 2 OFPPR_ADD OFPPR_MODIFY OFPPR_DELETE
3812
3813# Set-async has changed in OF 1.4 and is not yet implemented.
3814
d9c8c57c 3815OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
ebeae5db
JT
3816OVS_VSWITCHD_STOP
3817AT_CLEANUP
3818
6ea4776b
JR
3819dnl This test checks that the role request/response messaging works
3820dnl and that generation_id is handled properly.
3821AT_SETUP([ofproto - controller role (OpenFlow 1.2)])
3822OVS_VSWITCHD_START
53eb8cb8 3823on_exit 'kill `cat c1.pid c2.pid`'
6751a4b4
BP
3824
3825# Start two ovs-ofctl controller processes.
3826AT_CAPTURE_FILE([monitor1.log])
3827AT_CAPTURE_FILE([expout1])
3828AT_CAPTURE_FILE([experr1])
3829AT_CAPTURE_FILE([monitor2.log])
3830AT_CAPTURE_FILE([expout2])
3831AT_CAPTURE_FILE([experr2])
3832for i in 1 2; do
56120500 3833 AT_CHECK([ovs-ofctl -O OpenFlow12 monitor br0 --detach --no-chdir --pidfile=c$i.pid --unixctl=c$i])
6751a4b4
BP
3834 ovs-appctl -t `pwd`/c$i ofctl/barrier
3835 ovs-appctl -t `pwd`/c$i ofctl/set-output-file monitor$i.log
3836 : > expout$i
3837 : > experr$i
3838
3839 # find out current role
3840 ovs-appctl -t `pwd`/c$i ofctl/send 031800180000000200000000000000000000000000000000
3841 echo >>experr$i "send: OFPT_ROLE_REQUEST (OF1.2): role=nochange"
3842 echo >>expout$i "OFPT_ROLE_REPLY (OF1.2): role=equal"
3843done
6ea4776b 3844
6751a4b4
BP
3845# controller 1: Become slave (generation_id is initially undefined, so
3846# 2^63+2 should not be stale)
3847ovs-appctl -t `pwd`/c1 ofctl/send 031800180000000300000003000000008000000000000002
3848echo >>experr1 "send: OFPT_ROLE_REQUEST (OF1.2): role=slave generation_id=9223372036854775810"
3849echo >>expout1 "OFPT_ROLE_REPLY (OF1.2): role=slave generation_id=9223372036854775810"
3850
3851# controller 2: Become master.
3852ovs-appctl -t `pwd`/c2 ofctl/send 031800180000000300000002000000008000000000000003
3853echo >>experr2 "send: OFPT_ROLE_REQUEST (OF1.2): role=master generation_id=9223372036854775811"
3854echo >>expout2 "OFPT_ROLE_REPLY (OF1.2): role=master generation_id=9223372036854775811"
3855
3856# controller 1: Try to become the master using a stale generation ID
3857ovs-appctl -t `pwd`/c1 ofctl/send 031800180000000400000002000000000000000000000003
3858echo >>experr1 "send: OFPT_ROLE_REQUEST (OF1.2): role=master generation_id=3"
3859echo >>expout1 "OFPT_ERROR (OF1.2): OFPRRFC_STALE"
3860echo >>expout1 "OFPT_ROLE_REQUEST (OF1.2): role=master generation_id=3"
3861
3862# controller 1: Become master using a valid generation ID
3863ovs-appctl -t `pwd`/c1 ofctl/send 031800180000000500000002000000000000000000000001
3864echo >>experr1 "send: OFPT_ROLE_REQUEST (OF1.2): role=master generation_id=1"
3865echo >>expout1 "OFPT_ROLE_REPLY (OF1.2): role=master generation_id=1"
3866
3867for i in 1 2; do
3868 ovs-appctl -t `pwd`/c$i ofctl/barrier
3869 echo >>expout$i "OFPT_BARRIER_REPLY (OF1.2):"
3870done
6ea4776b 3871
6751a4b4
BP
3872# Check output.
3873for i in 1 2; do
3874 cp expout$i expout
8a32aaa5 3875 AT_CHECK([grep -v '^send:' monitor$i.log | strip_xids], [0], [expout])
6751a4b4 3876 cp experr$i expout
8a32aaa5 3877 AT_CHECK([grep '^send:' monitor$i.log | strip_xids], [0], [expout])
6751a4b4
BP
3878done
3879OVS_VSWITCHD_STOP
3880AT_CLEANUP
6ea4776b 3881
6751a4b4
BP
3882dnl This test checks that the role request/response messaging works,
3883dnl that generation_id is handled properly, and that role status update
3884dnl messages are sent when a controller's role gets changed from master
3885dnl to slave.
3886AT_SETUP([ofproto - controller role (OpenFlow 1.4)])
3887OVS_VSWITCHD_START
53eb8cb8 3888on_exit 'kill `cat c1.pid c2.pid`'
6751a4b4
BP
3889
3890# Start two ovs-ofctl controller processes.
3891AT_CAPTURE_FILE([monitor1.log])
3892AT_CAPTURE_FILE([expout1])
3893AT_CAPTURE_FILE([experr1])
3894AT_CAPTURE_FILE([monitor2.log])
3895AT_CAPTURE_FILE([expout2])
3896AT_CAPTURE_FILE([experr2])
3897for i in 1 2; do
56120500 3898 AT_CHECK([ovs-ofctl -O OpenFlow14 monitor br0 --detach --no-chdir --pidfile=c$i.pid --unixctl=c$i])
6751a4b4
BP
3899 ovs-appctl -t `pwd`/c$i ofctl/barrier
3900 ovs-appctl -t `pwd`/c$i ofctl/set-output-file monitor$i.log
3901 : > expout$i
3902 : > experr$i
3903
3904 # find out current role
3905 ovs-appctl -t `pwd`/c$i ofctl/send 051800180000000200000000000000000000000000000000
3906 echo >>experr$i "send: OFPT_ROLE_REQUEST (OF1.4): role=nochange"
3907 echo >>expout$i "OFPT_ROLE_REPLY (OF1.4): role=equal"
3908done
6ea4776b 3909
6751a4b4
BP
3910# controller 1: Become slave (generation_id is initially undefined, so
3911# 2^63+2 should not be stale)
3912ovs-appctl -t `pwd`/c1 ofctl/send 051800180000000300000003000000008000000000000002
3913echo >>experr1 "send: OFPT_ROLE_REQUEST (OF1.4): role=slave generation_id=9223372036854775810"
3914echo >>expout1 "OFPT_ROLE_REPLY (OF1.4): role=slave generation_id=9223372036854775810"
3915
3916# controller 2: Become master.
3917ovs-appctl -t `pwd`/c2 ofctl/send 051800180000000300000002000000008000000000000003
3918echo >>experr2 "send: OFPT_ROLE_REQUEST (OF1.4): role=master generation_id=9223372036854775811"
3919echo >>expout2 "OFPT_ROLE_REPLY (OF1.4): role=master generation_id=9223372036854775811"
3920
3921# controller 1: Try to become the master using a stale generation ID
3922ovs-appctl -t `pwd`/c1 ofctl/send 051800180000000400000002000000000000000000000003
3923echo >>experr1 "send: OFPT_ROLE_REQUEST (OF1.4): role=master generation_id=3"
3924echo >>expout1 "OFPT_ERROR (OF1.4): OFPRRFC_STALE"
3925echo >>expout1 "OFPT_ROLE_REQUEST (OF1.4): role=master generation_id=3"
3926
3927# controller 1: Become master using a valid generation ID
3928ovs-appctl -t `pwd`/c1 ofctl/send 051800180000000500000002000000000000000000000001
3929echo >>experr1 "send: OFPT_ROLE_REQUEST (OF1.4): role=master generation_id=1"
3930echo >>expout1 "OFPT_ROLE_REPLY (OF1.4): role=master generation_id=1"
3931echo >>expout2 "OFPT_ROLE_STATUS (OF1.4): role=slave generation_id=1 reason=master_request"
3932
3933for i in 1 2; do
3934 ovs-appctl -t `pwd`/c$i ofctl/barrier
3935 echo >>expout$i "OFPT_BARRIER_REPLY (OF1.4):"
3936done
6ea4776b 3937
6751a4b4
BP
3938# Check output.
3939for i in 1 2; do
3940 cp expout$i expout
8a32aaa5 3941 AT_CHECK([grep -v '^send:' monitor$i.log | strip_xids], [0], [expout])
6751a4b4 3942 cp experr$i expout
8a32aaa5 3943 AT_CHECK([grep '^send:' monitor$i.log | strip_xids], [0], [expout])
6751a4b4 3944done
6ea4776b
JR
3945OVS_VSWITCHD_STOP
3946AT_CLEANUP
3947
b0e07d50
BP
3948dnl This test checks that the role request/response messaging works,
3949dnl that generation_id is handled properly, and that role status update
3950dnl messages are sent when a controller's role gets changed from master
3951dnl to slave.
3952AT_SETUP([ofproto - controller role (OpenFlow 1.3)])
3953OVS_VSWITCHD_START
3954on_exit 'kill `cat c1.pid c2.pid`'
3955
3956# Start two ovs-ofctl controller processes.
3957AT_CAPTURE_FILE([monitor1.log])
3958AT_CAPTURE_FILE([expout1])
3959AT_CAPTURE_FILE([experr1])
3960AT_CAPTURE_FILE([monitor2.log])
3961AT_CAPTURE_FILE([expout2])
3962AT_CAPTURE_FILE([experr2])
3963for i in 1 2; do
3964 AT_CHECK([ovs-ofctl -O OpenFlow13 monitor br0 --detach --no-chdir --pidfile=c$i.pid --unixctl=c$i])
3965 ovs-appctl -t `pwd`/c$i ofctl/barrier
3966 ovs-appctl -t `pwd`/c$i ofctl/set-output-file monitor$i.log
3967 : > expout$i
3968 : > experr$i
3969
3970 # find out current role
3971 ovs-appctl -t `pwd`/c$i ofctl/send 041800180000000200000000000000000000000000000000
3972 echo >>experr$i "send: OFPT_ROLE_REQUEST (OF1.3): role=nochange"
3973 echo >>expout$i "OFPT_ROLE_REPLY (OF1.3): role=equal"
3974done
3975
3976# controller 1: Become slave (generation_id is initially undefined, so
3977# 2^63+2 should not be stale)
3978ovs-appctl -t `pwd`/c1 ofctl/send 041800180000000300000003000000008000000000000002
3979echo >>experr1 "send: OFPT_ROLE_REQUEST (OF1.3): role=slave generation_id=9223372036854775810"
3980echo >>expout1 "OFPT_ROLE_REPLY (OF1.3): role=slave generation_id=9223372036854775810"
3981
3982# controller 2: Become master.
3983ovs-appctl -t `pwd`/c2 ofctl/send 041800180000000300000002000000008000000000000003
3984echo >>experr2 "send: OFPT_ROLE_REQUEST (OF1.3): role=master generation_id=9223372036854775811"
3985echo >>expout2 "OFPT_ROLE_REPLY (OF1.3): role=master generation_id=9223372036854775811"
3986
3987# controller 1: Try to become the master using a stale generation ID
3988ovs-appctl -t `pwd`/c1 ofctl/send 041800180000000400000002000000000000000000000003
3989echo >>experr1 "send: OFPT_ROLE_REQUEST (OF1.3): role=master generation_id=3"
3990echo >>expout1 "OFPT_ERROR (OF1.3): OFPRRFC_STALE"
3991echo >>expout1 "OFPT_ROLE_REQUEST (OF1.3): role=master generation_id=3"
3992
3993# controller 1: Become master using a valid generation ID
3994ovs-appctl -t `pwd`/c1 ofctl/send 041800180000000500000002000000000000000000000001
3995echo >>experr1 "send: OFPT_ROLE_REQUEST (OF1.3): role=master generation_id=1"
3996echo >>expout1 "OFPT_ROLE_REPLY (OF1.3): role=master generation_id=1"
3997echo >>expout2 "ONFT_ROLE_STATUS (OF1.3): role=slave generation_id=1 reason=master_request"
3998
3999for i in 1 2; do
4000 ovs-appctl -t `pwd`/c$i ofctl/barrier
4001 echo >>expout$i "OFPT_BARRIER_REPLY (OF1.3):"
4002done
4003
4004# Check output.
4005for i in 1 2; do
4006 cp expout$i expout
4007 AT_CHECK([grep -v '^send:' monitor$i.log | strip_xids], [0], [expout])
4008 cp experr$i expout
4009 AT_CHECK([grep '^send:' monitor$i.log | strip_xids], [0], [expout])
4010done
4011OVS_VSWITCHD_STOP
4012AT_CLEANUP
4013
3c35db62
NR
4014dnl This test checks the Group and meter notifications when a group mod
4015dnl command is sent from one controller and the reply is received by
4016dnl other controllers.
4017AT_SETUP([ofproto - requestforward (OpenFlow 1.4)])
4018OVS_VSWITCHD_START
4019on_exit 'kill `cat c1.pid c2.pid c3.pid`'
4020
4021# Start two ovs-ofctl controller processes.
4022AT_CAPTURE_FILE([monitor1.log])
4023AT_CAPTURE_FILE([expout1])
4024AT_CAPTURE_FILE([monitor2.log])
4025AT_CAPTURE_FILE([expout2])
4026AT_CAPTURE_FILE([monitor3.log])
4027AT_CAPTURE_FILE([expout3])
4028
56120500
BP
4029ovs-ofctl -O OpenFlow15 monitor br0 --detach --no-chdir --pidfile=c1.pid --unixctl=c1
4030ovs-ofctl -O OpenFlow14 monitor br0 --detach --no-chdir --pidfile=c2.pid --unixctl=c2
4031ovs-ofctl -O OpenFlow14 monitor br0 --detach --no-chdir --pidfile=c3.pid --unixctl=c3
3c35db62
NR
4032
4033check_async () {
4034 for i in 1 3; do
4035 ovs-appctl -t `pwd`/c$i ofctl/barrier
4036 ovs-appctl -t `pwd`/c$i ofctl/set-output-file monitor$i.log
4037 : > expout$i
4038 done
4039
4040 printf '\n\n--- check_async %d ---\n\n\n' $1
4041 INDEX=$1
4042 shift
4043
4044 # OFPGC_ADD
63eded98 4045 ovs-appctl -t `pwd`/c2 ofctl/send "050f0020000000020000000000000001 00100000 ffffffffffffffff 00000000"
3c35db62
NR
4046 if test X"$1" = X"OFPGC_ADD"; then shift;
4047 echo >>expout2 "send: OFPT_GROUP_MOD (OF1.4):
63eded98 4048 ADD group_id=1,type=all,bucket=actions=drop"
3c35db62 4049 echo >>expout1 "OFPT_REQUESTFORWARD (OF1.5): reason=group_mod
63eded98 4050 ADD group_id=1,type=all,bucket=bucket_id:0,actions=drop"
3c35db62 4051 echo >>expout3 "OFPT_REQUESTFORWARD (OF1.4): reason=group_mod
63eded98 4052 ADD group_id=1,type=all,bucket=actions=drop"
3c35db62
NR
4053 fi
4054
4055 # OFPGC_MODIFY
63eded98 4056 ovs-appctl -t `pwd`/c2 ofctl/send "050f0020000000020001010000000001 00100000 ffffffffffffffff 00000000"
3c35db62
NR
4057 if test X"$1" = X"OFPGC_MODIFY"; then shift;
4058 echo >>expout2 "send: OFPT_GROUP_MOD (OF1.4):
63eded98 4059 MOD group_id=1,type=select,bucket=weight:0,actions=drop"
3c35db62 4060 echo >>expout1 "OFPT_REQUESTFORWARD (OF1.5): reason=group_mod
63eded98 4061 MOD group_id=1,type=select,bucket=bucket_id:0,weight:0,actions=drop"
3c35db62 4062 echo >>expout3 "OFPT_REQUESTFORWARD (OF1.4): reason=group_mod
63eded98 4063 MOD group_id=1,type=select,bucket=weight:0,actions=drop"
3c35db62
NR
4064 fi
4065
4066 ovs-appctl -t `pwd`/c1 ofctl/barrier
4067 echo >>expout1 "OFPT_BARRIER_REPLY (OF1.5):"
4068 ovs-appctl -t `pwd`/c2 ofctl/barrier
4069 echo >>expout2 "OFPT_BARRIER_REPLY (OF1.4):"
4070 ovs-appctl -t `pwd`/c3 ofctl/barrier
4071 echo >>expout3 "OFPT_BARRIER_REPLY (OF1.4):"
4072
4073 # Check output.
4074 for i in 1 3; do
4075 cp expout$i expout
4076 AT_CHECK(
4077 [[sed '
4078s/ (xid=0x[0-9a-fA-F]*)//'< monitor$i.log]],
4079 [0], [expout])
4080 done
4081}
4082
4083# controller 1: Become slave
4084ovs-appctl -t `pwd`/c1 ofctl/send 061800180000000300000003000000008000000000000002
4085
4086# controller 2: Become master
4087ovs-appctl -t `pwd`/c2 ofctl/send 051800180000000300000002000000008000000000000003
4088
4089# controller 1: Become slave
4090ovs-appctl -t `pwd`/c3 ofctl/send 051800180000000300000003000000008000000000000004
4091
4092# controller 1: Enabled requestforward using set Asynchronous message
4093ovs-appctl -t `pwd`/c1 ofctl/send 061c00280000000200000008000000050002000800000002000400080000001a000a000800000003
4094
4095# controller 2: Enabled requestforward using set Asynchronous message
4096ovs-appctl -t `pwd`/c2 ofctl/send 051c002800000002000100080000000200030008000000050005000800000005000b000800000003
4097
4098# controller 1: Enabled requestforward using set Asynchronous message
4099ovs-appctl -t `pwd`/c3 ofctl/send 051c00280000000200000008000000050002000800000002000400080000001a000a000800000003
4100check_async 1 OFPGC_ADD OFPGC_MODIFY
4101
4102OVS_VSWITCHD_STOP
4103AT_CLEANUP
4104
751c7785
BP
4105dnl This test checks that OFPT_PACKET_OUT accepts both OFPP_NONE (as
4106dnl specified by OpenFlow 1.0) and OFPP_CONTROLLER (used by some
4107dnl controllers despite the spec) as meaning a packet that was generated
4108dnl by the controller.
9dcd1c00 4109AT_SETUP([ofproto - packet-out from controller (OpenFlow 1.0)])
751c7785 4110OVS_VSWITCHD_START
ca5792f0 4111add_of_ports br0 1
751c7785
BP
4112
4113# Start a monitor listening for packet-ins.
6409e008 4114AT_CHECK([ovs-ofctl -P standard monitor br0 --detach --no-chdir --pidfile])
751c7785
BP
4115ovs-appctl -t ovs-ofctl ofctl/send 0109000c0123456700000080
4116ovs-appctl -t ovs-ofctl ofctl/barrier
4117ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
4118AT_CAPTURE_FILE([monitor.log])
4119
4120# Send some packet-outs with OFPP_NONE and OFPP_CONTROLLER (65533) as in_port.
6dd3c787
JR
4121AT_CHECK([ovs-ofctl packet-out br0 "in_port=none packet=0001020304050010203040501234 actions=controller,1"])
4122AT_CHECK([ovs-ofctl packet-out br0 "in_port=controller packet=0001020304050010203040505678 actions=controller,1"])
751c7785
BP
4123
4124# Stop the monitor and check its output.
4125ovs-appctl -t ovs-ofctl ofctl/barrier
d9c8c57c 4126OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
751c7785 4127
586ddea5
BP
4128ovs-ofctl dump-ports br0
4129
751c7785 4130AT_CHECK([sed 's/ (xid=0x[[0-9a-fA-F]]*)//' monitor.log], [0], [dnl
7f05e7ab 4131OFPT_PACKET_IN: total_len=14 in_port=ANY (via action) data_len=14 (unbuffered)
e6d9ab56 4132vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1234
751c7785 4133OFPT_PACKET_IN: total_len=14 in_port=CONTROLLER (via action) data_len=14 (unbuffered)
e6d9ab56 4134vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x5678
969fc56c
JS
4135OFPT_BARRIER_REPLY:
4136])
4137
4138OVS_VSWITCHD_STOP
4139AT_CLEANUP
4140
9dcd1c00
SH
4141dnl This test checks that OFPT_PACKET_OUT accepts both OFPP_NONE (as
4142dnl specified by OpenFlow 1.2) and OFPP_CONTROLLER (used by some
4143dnl controllers despite the spec) as meaning a packet that was generated
4144dnl by the controller.
4145AT_SETUP([ofproto - packet-out from controller (OpenFlow 1.2)])
4146OVS_VSWITCHD_START
4147
4148# Start a monitor listening for packet-ins.
6409e008 4149AT_CHECK([ovs-ofctl -O OpenFlow12 -P standard monitor br0 --detach --no-chdir --pidfile])
9dcd1c00
SH
4150ovs-appctl -t ovs-ofctl ofctl/send 0309000c0123456700000080
4151ovs-appctl -t ovs-ofctl ofctl/barrier
4152ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
4153AT_CAPTURE_FILE([monitor.log])
4154
4155# Send some packet-outs with OFPP_NONE and OFPP_CONTROLLER (65533) as in_port.
4156AT_CHECK([ovs-ofctl -O OpenFlow12 packet-out br0 none controller '0001020304050010203040501234'])
4157AT_CHECK([ovs-ofctl -O OpenFlow12 packet-out br0 4294967293 controller '0001020304050010203040505678'])
4158
4159# Stop the monitor and check its output.
4160ovs-appctl -t ovs-ofctl ofctl/barrier
d9c8c57c 4161OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
9dcd1c00
SH
4162
4163AT_CHECK([sed 's/ (xid=0x[[0-9a-fA-F]]*)//' monitor.log], [0], [dnl
4164OFPT_PACKET_IN (OF1.2): total_len=14 in_port=ANY (via action) data_len=14 (unbuffered)
e6d9ab56 4165vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1234
9dcd1c00 4166OFPT_PACKET_IN (OF1.2): total_len=14 in_port=CONTROLLER (via action) data_len=14 (unbuffered)
e6d9ab56 4167vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x5678
9dcd1c00
SH
4168OFPT_BARRIER_REPLY (OF1.2):
4169])
4170
4171OVS_VSWITCHD_STOP
4172AT_CLEANUP
4173
4d197ebb
BP
4174dnl This test checks that OFPT_PACKET_OUT accepts both OFPP_NONE (as
4175dnl specified by OpenFlow 1.1) and OFPP_CONTROLLER (used by some
4176dnl controllers despite the spec) as meaning a packet that was generated
4177dnl by the controller.
4178AT_SETUP([ofproto - packet-out from controller (OpenFlow 1.1)])
4179OVS_VSWITCHD_START
4180
4181# Start a monitor listening for packet-ins.
6409e008 4182AT_CHECK([ovs-ofctl -O OpenFlow11 -P standard monitor br0 --detach --no-chdir --pidfile])
4d197ebb
BP
4183ovs-appctl -t ovs-ofctl ofctl/send 0209000c0123456700000080
4184ovs-appctl -t ovs-ofctl ofctl/barrier
4185ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
4186AT_CAPTURE_FILE([monitor.log])
4187
6dd3c787
JR
4188# Send some packet-outs with OFPP_NONE and OFPP_CONTROLLER as in_port.
4189AT_CHECK([ovs-appctl -t ovs-ofctl ofctl/packet-out "in_port=none, packet=0001020304050010203040501234 actions=controller"])
4190AT_CHECK([ovs-appctl -t ovs-ofctl ofctl/packet-out "in_port=controller packet=0001020304050010203040505678 actions=controller"])
4d197ebb
BP
4191
4192# Stop the monitor and check its output.
4193ovs-appctl -t ovs-ofctl ofctl/barrier
d9c8c57c 4194OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
4d197ebb 4195
6dd3c787
JR
4196AT_CHECK([sed 's/ (xid=0x[[0-9a-fA-F]]*)//
4197/PACKET_OUT/d' monitor.log], [0], [dnl
4d197ebb 4198OFPT_PACKET_IN (OF1.1): total_len=14 in_port=ANY (via action) data_len=14 (unbuffered)
e6d9ab56 4199vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1234
4d197ebb 4200OFPT_PACKET_IN (OF1.1): total_len=14 in_port=CONTROLLER (via action) data_len=14 (unbuffered)
e6d9ab56 4201vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x5678
4d197ebb
BP
4202OFPT_BARRIER_REPLY (OF1.1):
4203])
4204
4205OVS_VSWITCHD_STOP
4206AT_CLEANUP
4207
880b1458
YHW
4208AT_SETUP([ofproto - packet-out from controller (OpenFlow 1.5)])
4209OVS_VSWITCHD_START
4210
4211# Start a monitor listening for packet-ins.
4212AT_CHECK([ovs-ofctl -O OpenFlow15 -P standard monitor br0 --detach --no-chdir --pidfile])
4213ovs-appctl -t ovs-ofctl ofctl/send 0609000c0123456700000080
4214ovs-appctl -t ovs-ofctl ofctl/barrier
4215ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
4216AT_CAPTURE_FILE([monitor.log])
4217
4218# Send some packet-outs with OFPP_NONE and OFPP_CONTROLLER (65533) as in_port.
4219AT_CHECK([ovs-ofctl -O OpenFlow15 packet-out br0 "in_port=none tun_id=0x11 metadata=0x22 packet=0001020304050010203040501234 actions=controller"])
4220AT_CHECK([ovs-ofctl -O OpenFlow15 packet-out br0 "in_port=controller tun_id=0x11 metadata=0x33 packet=0001020304050010203040505678 actions=controller"])
4221
4222# Stop the monitor and check its output.
4223ovs-appctl -t ovs-ofctl ofctl/barrier
4224OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
4225
4226AT_CHECK([sed 's/ (xid=0x[[0-9a-fA-F]]*)//' monitor.log], [0], [dnl
4227OFPT_PACKET_IN (OF1.5): total_len=14 tun_id=0x11,metadata=0x22,in_port=ANY (via packet_out) data_len=14 (unbuffered)
4228vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1234
4229OFPT_PACKET_IN (OF1.5): total_len=14 tun_id=0x11,metadata=0x33,in_port=CONTROLLER (via packet_out) data_len=14 (unbuffered)
4230vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x5678
4231OFPT_BARRIER_REPLY (OF1.5):
4232])
4233
4234OVS_VSWITCHD_STOP
4235AT_CLEANUP
4236
bdcad671
BP
4237dnl This test checks that metadata and userdata are encoded in NXT_PACKET_IN2.
4238AT_SETUP([ofproto - packet-out with metadata and userdata (NXT_PACKET_IN2)])
6409e008
BP
4239OVS_VSWITCHD_START
4240
4241# Start a monitor listening for packet-ins.
4242AT_CHECK([ovs-ofctl -P nxt_packet_in2 monitor br0 --detach --no-chdir --pidfile])
4243ovs-appctl -t ovs-ofctl ofctl/send 0109000c0123456700000080
4244ovs-appctl -t ovs-ofctl ofctl/barrier
4245ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
4246AT_CAPTURE_FILE([monitor.log])
4247
4248# Send a packet-out with a load action to set some metadata, and forward to controller
6dd3c787 4249AT_CHECK([ovs-ofctl packet-out br0 "in_port=controller packet=0001020304050010203040501234 actions=load(0xfafafafa5a5a5a5a->OXM_OF_METADATA[[0..63]]),load(0xaa->NXM_NX_PKT_MARK[[]]),controller(userdata=01.02.03.04.05)"])
6409e008
BP
4250
4251# Stop the monitor and check its output.
4252ovs-appctl -t ovs-ofctl ofctl/barrier
d9c8c57c 4253OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
6409e008
BP
4254
4255AT_CHECK([sed 's/ (xid=0x[[0-9a-fA-F]]*)//' monitor.log], [0], [dnl
4256NXT_PACKET_IN2: total_len=14 pkt_mark=0xaa,metadata=0xfafafafa5a5a5a5a,in_port=CONTROLLER (via action) data_len=14 (unbuffered)
bdcad671 4257 userdata=01.02.03.04.05
6409e008
BP
4258vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1234
4259OFPT_BARRIER_REPLY:
4260])
4261
4262OVS_VSWITCHD_STOP
4263AT_CLEANUP
4264
cb1145d1
ZB
4265dnl This test checks that 1.5 packet_out is properly encoded/decoded.
4266AT_SETUP([ofproto - packet-out with set_field metadata (OpenFlow 1.5)])
4267OVS_VSWITCHD_START
4268
4269# Start a monitor listening for packet-ins.
4270AT_CHECK([ovs-ofctl -P standard -O OpenFlow13 monitor br0 --detach --no-chdir --pidfile])
4271ovs-appctl -t ovs-ofctl ofctl/send 0409000c0123456700000080
4272ovs-appctl -t ovs-ofctl ofctl/barrier
4273ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
4274AT_CAPTURE_FILE([monitor.log])
4275
4276# Send a packet-out with a couple of set-field action to set some metadata, and forward to controller
4277AT_CHECK([ovs-ofctl -O OpenFlow15 packet-out br0 CONTROLLER 'set_field:0xfafafafa5a5a5a5a->metadata, controller' '0001020304050010203040501234'])
4278
4279# Stop the monitor and check its output.
4280ovs-appctl -t ovs-ofctl ofctl/barrier
4281ovs-appctl -t ovs-ofctl exit
4282
4283AT_CHECK([sed 's/ (xid=0x[[0-9a-fA-F]]*)//' monitor.log], [0], [dnl
4284OFPT_PACKET_IN (OF1.3): total_len=14 metadata=0xfafafafa5a5a5a5a,in_port=CONTROLLER (via action) data_len=14 (unbuffered)
4285vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1234
4286OFPT_BARRIER_REPLY (OF1.3):
4287])
4288
4289OVS_VSWITCHD_STOP
4290AT_CLEANUP
4291
4292dnl This test checks that packet_type PT_ETH is properly encoded/decoded in 1.5 packet_out.
4293AT_SETUP([ofproto - packet-out with set_field metadata with packet_type PT_ETH (OpenFlow 1.5)])
4294OVS_VSWITCHD_START
4295
4296# Start a monitor listening for packet-ins.
4297AT_CHECK([ovs-ofctl -P standard -O OpenFlow13 monitor br0 --detach --no-chdir --pidfile])
4298ovs-appctl -t ovs-ofctl ofctl/send 0409000c0123456700000080
4299ovs-appctl -t ovs-ofctl ofctl/barrier
4300ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
4301AT_CAPTURE_FILE([monitor.log])
4302
4303# Send a packet-out with a couple of set-field action to set some metadata, and forward to controller
4304AT_CHECK([ovs-ofctl -O OpenFlow15 packet-out br0 "in_port=controller packet=0001020304050010203040501234 packet_type(0,0x0) actions=set_field:0xfafafafa5a5a5a5a->metadata,controller"])
4305
4306# Stop the monitor and check its output.
4307ovs-appctl -t ovs-ofctl ofctl/barrier
4308ovs-appctl -t ovs-ofctl exit
4309
4310AT_CHECK([sed 's/ (xid=0x[[0-9a-fA-F]]*)//' monitor.log], [0], [dnl
4311OFPT_PACKET_IN (OF1.3): total_len=14 metadata=0xfafafafa5a5a5a5a,in_port=CONTROLLER (via action) data_len=14 (unbuffered)
4312vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1234
4313OFPT_BARRIER_REPLY (OF1.3):
4314])
4315
4316OVS_VSWITCHD_STOP
4317AT_CLEANUP
4318
4319dnl This test checks that packet_type PT_IPV4 is properly encoded/decoded in 1.5 packet_out.
4320AT_SETUP([ofproto - packet-out with set_field metadata with packet_type PT_IPV4 on PTAP bridge (OpenFlow 1.5)])
4321OVS_VSWITCHD_START
4322
4323# Start a monitor listening for packet-ins.
4324AT_CHECK([ovs-ofctl -P standard -O OpenFlow13 monitor br0 --detach --no-chdir --pidfile])
4325ovs-appctl -t ovs-ofctl ofctl/send 0409000c0123456700000080
4326ovs-appctl -t ovs-ofctl ofctl/barrier
4327ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
4328AT_CAPTURE_FILE([monitor.log])
4329
4330# Send a packet-out with a couple of set-field action to set some metadata, and forward to controller
4331AT_CHECK([ovs-ofctl -O OpenFlow15 packet-out br0 "in_port=controller packet=4500002012344000ff1155670a0000140a00001e006400c8000cea78ffffffff packet_type(1,0x800) actions=set_field:0xfafafafa5a5a5a5a->metadata,controller"])
4332
4333# Stop the monitor and check its output.
4334ovs-appctl -t ovs-ofctl ofctl/barrier
4335ovs-appctl -t ovs-ofctl exit
4336
4337AT_CHECK([sed 's/ (xid=0x[[0-9a-fA-F]]*)//' monitor.log], [0], [dnl
4338OFPT_PACKET_IN (OF1.3): total_len=32 packet_type=(1,0x800),metadata=0xfafafafa5a5a5a5a,in_port=CONTROLLER (via action) data_len=32 (unbuffered)
4339packet_type=(1,0x800),nw_src=10.0.0.20,nw_dst=10.0.0.30,nw_proto=17,nw_tos=0,nw_ecn=0,nw_ttl=255,tp_src=100,tp_dst=200 udp_csum:ea78
4340OFPT_BARRIER_REPLY (OF1.3):
4341])
4342
4343OVS_VSWITCHD_STOP
4344AT_CLEANUP
4345
969fc56c
JS
4346dnl This test checks that metadata is encoded in packet_in structures,
4347dnl supported by NXAST.
4348AT_SETUP([ofproto - packet-out with metadata (NXM)])
4349OVS_VSWITCHD_START
4350
4351# Start a monitor listening for packet-ins.
6409e008 4352AT_CHECK([ovs-ofctl -P nxt_packet_in monitor br0 --detach --no-chdir --pidfile])
969fc56c
JS
4353ovs-appctl -t ovs-ofctl ofctl/send 0109000c0123456700000080
4354ovs-appctl -t ovs-ofctl ofctl/barrier
4355ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
4356AT_CAPTURE_FILE([monitor.log])
4357
4358# Send a packet-out with a load action to set some metadata, and forward to controller
6dd3c787 4359AT_CHECK([ovs-ofctl packet-out br0 "in_port=controller packet=0001020304050010203040501234 actions=load(0xfafafafa5a5a5a5a->OXM_OF_METADATA[[0..63]]),load(0xaa->NXM_NX_PKT_MARK[[]]),controller"])
969fc56c
JS
4360
4361# Stop the monitor and check its output.
4362ovs-appctl -t ovs-ofctl ofctl/barrier
d9c8c57c 4363OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
969fc56c
JS
4364
4365AT_CHECK([sed 's/ (xid=0x[[0-9a-fA-F]]*)//' monitor.log], [0], [dnl
50dcbd8e 4366NXT_PACKET_IN: total_len=14 pkt_mark=0xaa,metadata=0xfafafafa5a5a5a5a,in_port=CONTROLLER (via action) data_len=14 (unbuffered)
e6d9ab56 4367vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1234
751c7785
BP
4368OFPT_BARRIER_REPLY:
4369])
4370
4371OVS_VSWITCHD_STOP
4372AT_CLEANUP
2b07c8b1 4373
9dcd1c00
SH
4374dnl This test checks that metadata is encoded in packet_in structures,
4375dnl supported by NXAST.
4376AT_SETUP([ofproto - packet-out with metadata (OpenFlow 1.2)])
4377OVS_VSWITCHD_START
4378
4379# Start a monitor listening for packet-ins.
6409e008 4380AT_CHECK([ovs-ofctl -O OpenFlow12 -P standard monitor br0 --detach --no-chdir --pidfile])
9dcd1c00
SH
4381ovs-appctl -t ovs-ofctl ofctl/send 0309000c0123456700000080
4382ovs-appctl -t ovs-ofctl ofctl/barrier
4383ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
4384AT_CAPTURE_FILE([monitor.log])
4385
277876e9
JT
4386# Send a packet-out with a set-field action to set some metadata, and forward to controller
4387AT_CHECK([ovs-ofctl -O OpenFlow12 packet-out br0 none 'set_field:0xfafafafa5a5a5a5a->metadata, controller' '0001020304050010203040501234'])
9dcd1c00
SH
4388
4389# Stop the monitor and check its output.
4390ovs-appctl -t ovs-ofctl ofctl/barrier
d9c8c57c 4391OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
9dcd1c00
SH
4392
4393AT_CHECK([sed 's/ (xid=0x[[0-9a-fA-F]]*)//' monitor.log], [0], [dnl
50dcbd8e 4394OFPT_PACKET_IN (OF1.2): total_len=14 metadata=0xfafafafa5a5a5a5a,in_port=ANY (via action) data_len=14 (unbuffered)
e6d9ab56 4395vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1234
0ad90c84
JR
4396OFPT_BARRIER_REPLY (OF1.2):
4397])
4398
4399OVS_VSWITCHD_STOP
4400AT_CLEANUP
4401
743c159b
JT
4402dnl This test checks that metadata is encoded in packet_in structures,
4403dnl supported by NXAST.
4404AT_SETUP([ofproto - packet-out with metadata and dual set_field (OpenFlow 1.3)])
4405OVS_VSWITCHD_START
4406
4407# Start a monitor listening for packet-ins.
6409e008 4408AT_CHECK([ovs-ofctl -O OpenFlow13 -P standard monitor br0 --detach --no-chdir --pidfile])
743c159b
JT
4409ovs-appctl -t ovs-ofctl ofctl/send 0409000c0123456700000080
4410ovs-appctl -t ovs-ofctl ofctl/barrier
4411ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
4412AT_CAPTURE_FILE([monitor.log])
4413
4414# Send a packet-out with a couple of set-field action to set some metadata, and forward to controller
4415AT_CHECK([ovs-ofctl -O OpenFlow13 packet-out br0 none 'set_field:0xfafafafa5a5a5a5a->metadata, set_field:0x6b->metadata, controller' '0001020304050010203040501234'])
4416
4417# Stop the monitor and check its output.
4418ovs-appctl -t ovs-ofctl ofctl/barrier
d9c8c57c 4419OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
743c159b
JT
4420
4421AT_CHECK([sed 's/ (xid=0x[[0-9a-fA-F]]*)//' monitor.log], [0], [dnl
50dcbd8e 4422OFPT_PACKET_IN (OF1.3): total_len=14 metadata=0x6b,in_port=ANY (via action) data_len=14 (unbuffered)
e6d9ab56 4423vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1234
743c159b
JT
4424OFPT_BARRIER_REPLY (OF1.3):
4425])
4426
4427OVS_VSWITCHD_STOP
4428AT_CLEANUP
4429
0ad90c84
JR
4430dnl This test checks that tunnel metadata is encoded in packet_in structures.
4431AT_SETUP([ofproto - packet-out with tunnel metadata (OpenFlow 1.2)])
4432OVS_VSWITCHD_START
4433
4434# Start a monitor listening for packet-ins.
6409e008 4435AT_CHECK([ovs-ofctl -O OpenFlow12 -P standard monitor br0 --detach --no-chdir --pidfile])
0ad90c84
JR
4436ovs-appctl -t ovs-ofctl ofctl/send 0309000c0123456700000080
4437ovs-appctl -t ovs-ofctl ofctl/barrier
4438ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
4439AT_CAPTURE_FILE([monitor.log])
4440
4441# Send a packet-out with set field actions to set some tunnel metadata, and forward to controller
4442AT_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'])
4443
4444# Stop the monitor and check its output.
4445ovs-appctl -t ovs-ofctl ofctl/barrier
d9c8c57c 4446OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
0ad90c84
JR
4447
4448AT_CHECK([sed 's/ (xid=0x[[0-9a-fA-F]]*)//' monitor.log], [0], [dnl
50dcbd8e 4449OFPT_PACKET_IN (OF1.2): total_len=14 tun_id=0x1020304,tun_src=127.0.0.1,tun_dst=192.168.0.1,in_port=ANY (via action) data_len=14 (unbuffered)
e6d9ab56 4450vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1234
9dcd1c00
SH
4451OFPT_BARRIER_REPLY (OF1.2):
4452])
4453
4454OVS_VSWITCHD_STOP
4455AT_CLEANUP
4456
1637ebb2
SH
4457m4_divert_push([PREPARE_TESTS])
4458# Sorts groups of lines that start with a space, without moving them
4459# past the nearest line that does not start with a space.
719dcfd4 4460[
1637ebb2 4461multiline_sort () {
719dcfd4
BP
4462 $PYTHON -c '
4463import sys
4464
4465buffer = []
4466while True:
4467 line = sys.stdin.readline()
4468 if not line:
4469 break
4470 if line.startswith(" "):
4471 buffer.append(line)
4472 else:
4473 sys.stdout.write("".join(sorted(buffer)))
4474 sys.stdout.write(line)
4475 buffer = []
4476sys.stdout.write("".join(sorted(buffer)))
1637ebb2
SH
4477'
4478}
719dcfd4 4479]
1637ebb2
SH
4480m4_divert_pop([PREPARE_TESTS])
4481
2b07c8b1
BP
4482AT_SETUP([ofproto - flow monitoring])
4483AT_KEYWORDS([monitor])
4484OVS_VSWITCHD_START
4485
4486ovs-ofctl add-flow br0 in_port=0,dl_vlan=123,actions=output:1
4487
4488# Start a monitor watching the flow table and check the initial reply.
4489ovs-ofctl monitor br0 watch: --detach --no-chdir --pidfile >monitor.log 2>&1
4490AT_CAPTURE_FILE([monitor.log])
4491ovs-appctl -t ovs-ofctl ofctl/barrier
4492AT_CHECK([sed 's/ (xid=0x[[1-9a-fA-F]][[0-9a-fA-F]]*)//' monitor.log], [0],
4493 [NXST_FLOW_MONITOR reply:
4494 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=123 actions=output:1
4495OFPT_BARRIER_REPLY:
4496])
4497
4498# Add, delete, and modify some flows and check the updates.
4499ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
4500ovs-ofctl add-flow br0 in_port=0,dl_vlan=124,actions=output:2
4501ovs-ofctl add-flow br0 in_port=0,dl_vlan=123,actions=output:5
95a1c4ca
SH
4502ovs-ofctl add-flow br0 in_port=0,dl_vlan=123,dl_vlan_pcp=0,actions=output:6
4503ovs-ofctl add-flow br0 in_port=0,dl_vlan=123,dl_vlan_pcp=1,actions=output:7
4504ovs-ofctl add-flow br0 in_port=0,dl_vlan=123,actions=output:8
4505ovs-ofctl add-flow br0 in_port=0,dl_vlan=65535,dl_vlan_pcp=0,actions=output:9
4506ovs-ofctl add-flow br0 in_port=0,dl_vlan=65535,dl_vlan_pcp=1,actions=output:10
4507ovs-ofctl add-flow br0 in_port=0,dl_vlan=65535,actions=output:11
4508ovs-ofctl add-flow br0 in_port=0,dl_vlan=8191,dl_vlan_pcp=0,actions=output:12
4509ovs-ofctl add-flow br0 in_port=0,dl_vlan=8191,dl_vlan_pcp=1,actions=output:13
4510ovs-ofctl add-flow br0 in_port=0,dl_vlan=8191,actions=output:14
4511ovs-ofctl add-flow br0 in_port=0,dl_vlan=0,dl_vlan_pcp=0,actions=output:15
4512ovs-ofctl add-flow br0 in_port=0,dl_vlan=0,dl_vlan_pcp=1,actions=output:16
4513ovs-ofctl add-flow br0 in_port=0,dl_vlan=0,actions=output:17
4514ovs-ofctl add-flow br0 in_port=0,dl_vlan=0,dl_vlan_pcp=0,actions=output:18
4515ovs-ofctl add-flow br0 in_port=0,dl_vlan=0,dl_vlan_pcp=1,actions=output:19
4516ovs-ofctl add-flow br0 in_port=0,dl_vlan=0,actions=output:20
4517ovs-ofctl add-flow br0 in_port=0,dl_vlan_pcp=0,actions=output:21
4518ovs-ofctl add-flow br0 in_port=0,dl_vlan_pcp=1,actions=output:22
4519ovs-ofctl add-flow br0 in_port=0,actions=output:23
ee088a75 4520ovs-ofctl mod-flows br0 dl_vlan=123,actions=output:3
2b07c8b1
BP
4521ovs-ofctl mod-flows br0 cookie=5,dl_vlan=123,actions=output:3
4522ovs-ofctl del-flows br0 dl_vlan=123
4523ovs-ofctl del-flows br0
4524ovs-appctl -t ovs-ofctl ofctl/barrier
1637ebb2 4525AT_CHECK([sed 's/ (xid=0x[[1-9a-fA-F]][[0-9a-fA-F]]*)//' monitor.log | multiline_sort], [0],
2b07c8b1
BP
4526[NXST_FLOW_MONITOR reply (xid=0x0):
4527 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=124 actions=output:2
4528NXST_FLOW_MONITOR reply (xid=0x0):
4529 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=123 actions=output:5
95a1c4ca
SH
4530NXST_FLOW_MONITOR reply (xid=0x0):
4531 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=123,dl_vlan_pcp=0 actions=output:6
4532NXST_FLOW_MONITOR reply (xid=0x0):
4533 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=123,dl_vlan_pcp=1 actions=output:7
4534NXST_FLOW_MONITOR reply (xid=0x0):
4535 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=123 actions=output:8
4536NXST_FLOW_MONITOR reply (xid=0x0):
4537 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=0,dl_vlan_pcp=0 actions=output:9
4538NXST_FLOW_MONITOR reply (xid=0x0):
4539 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=0,dl_vlan_pcp=1 actions=output:10
4540NXST_FLOW_MONITOR reply (xid=0x0):
4541 event=ADDED table=0 cookie=0 in_port=0,vlan_tci=0x0000 actions=output:11
4542NXST_FLOW_MONITOR reply (xid=0x0):
4543 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=4095,dl_vlan_pcp=0 actions=output:12
4544NXST_FLOW_MONITOR reply (xid=0x0):
4545 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=4095,dl_vlan_pcp=1 actions=output:13
4546NXST_FLOW_MONITOR reply (xid=0x0):
4547 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=4095 actions=output:14
4548NXST_FLOW_MONITOR reply (xid=0x0):
4549 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=0,dl_vlan_pcp=0 actions=output:15
4550NXST_FLOW_MONITOR reply (xid=0x0):
4551 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=0,dl_vlan_pcp=1 actions=output:16
4552NXST_FLOW_MONITOR reply (xid=0x0):
4553 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=0 actions=output:17
4554NXST_FLOW_MONITOR reply (xid=0x0):
4555 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=0,dl_vlan_pcp=0 actions=output:18
4556NXST_FLOW_MONITOR reply (xid=0x0):
4557 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=0,dl_vlan_pcp=1 actions=output:19
4558NXST_FLOW_MONITOR reply (xid=0x0):
4559 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=0 actions=output:20
4560NXST_FLOW_MONITOR reply (xid=0x0):
4561 event=ADDED table=0 cookie=0 in_port=0,dl_vlan_pcp=0 actions=output:21
4562NXST_FLOW_MONITOR reply (xid=0x0):
4563 event=ADDED table=0 cookie=0 in_port=0,dl_vlan_pcp=1 actions=output:22
4564NXST_FLOW_MONITOR reply (xid=0x0):
4565 event=ADDED table=0 cookie=0 in_port=0 actions=output:23
ee088a75
SH
4566NXST_FLOW_MONITOR reply (xid=0x0):
4567 event=MODIFIED table=0 cookie=0 in_port=0,dl_vlan=123 actions=output:3
4568 event=MODIFIED table=0 cookie=0 in_port=0,dl_vlan=123,dl_vlan_pcp=0 actions=output:3
4569 event=MODIFIED table=0 cookie=0 in_port=0,dl_vlan=123,dl_vlan_pcp=1 actions=output:3
2b07c8b1
BP
4570NXST_FLOW_MONITOR reply (xid=0x0):
4571 event=MODIFIED table=0 cookie=0x5 in_port=0,dl_vlan=123 actions=output:3
95a1c4ca
SH
4572 event=MODIFIED table=0 cookie=0x5 in_port=0,dl_vlan=123,dl_vlan_pcp=0 actions=output:3
4573 event=MODIFIED table=0 cookie=0x5 in_port=0,dl_vlan=123,dl_vlan_pcp=1 actions=output:3
2b07c8b1
BP
4574NXST_FLOW_MONITOR reply (xid=0x0):
4575 event=DELETED reason=delete table=0 cookie=0x5 in_port=0,dl_vlan=123 actions=output:3
95a1c4ca
SH
4576 event=DELETED reason=delete table=0 cookie=0x5 in_port=0,dl_vlan=123,dl_vlan_pcp=0 actions=output:3
4577 event=DELETED reason=delete table=0 cookie=0x5 in_port=0,dl_vlan=123,dl_vlan_pcp=1 actions=output:3
2b07c8b1 4578NXST_FLOW_MONITOR reply (xid=0x0):
32cd83a2 4579 event=DELETED reason=delete table=0 cookie=0 in_port=0 actions=output:23
95a1c4ca 4580 event=DELETED reason=delete table=0 cookie=0 in_port=0,dl_vlan=0 actions=output:20
32cd83a2
BP
4581 event=DELETED reason=delete table=0 cookie=0 in_port=0,dl_vlan=0,dl_vlan_pcp=0 actions=output:18
4582 event=DELETED reason=delete table=0 cookie=0 in_port=0,dl_vlan=0,dl_vlan_pcp=1 actions=output:19
2b07c8b1 4583 event=DELETED reason=delete table=0 cookie=0 in_port=0,dl_vlan=124 actions=output:2
95a1c4ca 4584 event=DELETED reason=delete table=0 cookie=0 in_port=0,dl_vlan=4095 actions=output:14
32cd83a2 4585 event=DELETED reason=delete table=0 cookie=0 in_port=0,dl_vlan=4095,dl_vlan_pcp=0 actions=output:12
95a1c4ca 4586 event=DELETED reason=delete table=0 cookie=0 in_port=0,dl_vlan=4095,dl_vlan_pcp=1 actions=output:13
32cd83a2
BP
4587 event=DELETED reason=delete table=0 cookie=0 in_port=0,dl_vlan_pcp=0 actions=output:21
4588 event=DELETED reason=delete table=0 cookie=0 in_port=0,dl_vlan_pcp=1 actions=output:22
95a1c4ca 4589 event=DELETED reason=delete table=0 cookie=0 in_port=0,vlan_tci=0x0000 actions=output:11
2b07c8b1
BP
4590OFPT_BARRIER_REPLY:
4591])
4592
200d6ac4
SH
4593# Check that our own changes are reported as full updates.
4594ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
4595ovs-ofctl add-flow br0 in_port=1,actions=output:2
4596ovs-ofctl add-flow br0 in_port=2,actions=output:1
4597ovs-appctl -t ovs-ofctl ofctl/barrier
4598ovs-appctl -t ovs-ofctl ofctl/send 010e004812345678003fffff00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003000000000000ffffffffffff0000
4599ovs-appctl -t ovs-ofctl ofctl/barrier
4600AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip], [0], [NXST_FLOW reply:
4601])
4602AT_CHECK([sed 's/ (xid=0x[[1-9a-fA-F]][[0-9a-fA-F]]*)//' monitor.log | multiline_sort], [0],
4603[NXST_FLOW_MONITOR reply (xid=0x0):
4604 event=ADDED table=0 cookie=0 in_port=1 actions=output:2
4605NXST_FLOW_MONITOR reply (xid=0x0):
4606 event=ADDED table=0 cookie=0 in_port=2 actions=output:1
4607OFPT_BARRIER_REPLY:
4608send: OFPT_FLOW_MOD: DEL priority=0 actions=drop
4609NXST_FLOW_MONITOR reply (xid=0x0):
4610 event=DELETED reason=delete table=0 cookie=0 in_port=1 actions=output:2
4611 event=DELETED reason=delete table=0 cookie=0 in_port=2 actions=output:1
4612OFPT_BARRIER_REPLY:
4613])
4614
d9c8c57c 4615OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
200d6ac4
SH
4616OVS_VSWITCHD_STOP
4617AT_CLEANUP
4618
4619AT_SETUP([ofproto - flow monitoring with !own])
4620AT_KEYWORDS([monitor])
4621OVS_VSWITCHD_START
4622
4623ovs-ofctl add-flow br0 in_port=0,dl_vlan=123,actions=output:1
4624
4625# Start a monitor watching the flow table and check the initial reply.
4626ovs-ofctl monitor br0 watch:\!own --detach --no-chdir --pidfile >monitor.log 2>&1
4627AT_CAPTURE_FILE([monitor.log])
4628ovs-appctl -t ovs-ofctl ofctl/barrier
4629AT_CHECK([sed 's/ (xid=0x[[1-9a-fA-F]][[0-9a-fA-F]]*)//' monitor.log], [0],
4630 [NXST_FLOW_MONITOR reply:
4631 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=123 actions=output:1
4632OFPT_BARRIER_REPLY:
4633])
4634
2b07c8b1
BP
4635# Check that our own changes are reported as abbreviations.
4636ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
4637ovs-ofctl add-flow br0 in_port=1,actions=output:2
4638ovs-ofctl add-flow br0 in_port=2,actions=output:1
90d721f0 4639ovs-appctl -t ovs-ofctl ofctl/barrier
2b07c8b1
BP
4640ovs-appctl -t ovs-ofctl ofctl/send 010e004812345678003fffff00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003000000000000ffffffffffff0000
4641ovs-appctl -t ovs-ofctl ofctl/barrier
4642AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip], [0], [NXST_FLOW reply:
4643])
4644AT_CHECK([sed 's/ (xid=0x[[1-9a-fA-F]][[0-9a-fA-F]]*)//' monitor.log], [0],
4645[NXST_FLOW_MONITOR reply (xid=0x0):
4646 event=ADDED table=0 cookie=0 in_port=1 actions=output:2
4647NXST_FLOW_MONITOR reply (xid=0x0):
4648 event=ADDED table=0 cookie=0 in_port=2 actions=output:1
90d721f0 4649OFPT_BARRIER_REPLY:
2b07c8b1
BP
4650send: OFPT_FLOW_MOD: DEL priority=0 actions=drop
4651NXST_FLOW_MONITOR reply (xid=0x0):
4652 event=ABBREV xid=0x12345678
cdbdeeda
SH
4653OFPT_BARRIER_REPLY:
4654])
4655
d9c8c57c 4656OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
cdbdeeda
SH
4657OVS_VSWITCHD_STOP
4658AT_CLEANUP
4659
4660AT_SETUP([ofproto - flow monitoring with out_port])
4661AT_KEYWORDS([monitor])
4662OVS_VSWITCHD_START
4663
4664ovs-ofctl add-flow br0 in_port=0,dl_vlan=121,actions=output:1
4665ovs-ofctl add-flow br0 in_port=0,dl_vlan=122,actions=output:1
4666ovs-ofctl add-flow br0 in_port=0,dl_vlan=123,actions=output:2
4667
4668# Start a monitor watching the flow table and check the initial reply.
4669ovs-ofctl monitor br0 watch:out_port=2 --detach --no-chdir --pidfile >monitor.log 2>&1
4670AT_CAPTURE_FILE([monitor.log])
4671ovs-appctl -t ovs-ofctl ofctl/barrier
4672AT_CHECK([sed 's/ (xid=0x[[1-9a-fA-F]][[0-9a-fA-F]]*)//' monitor.log], [0],
4673 [NXST_FLOW_MONITOR reply:
4674 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=123 actions=output:2
4675OFPT_BARRIER_REPLY:
4676])
4677
4678ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
4679
4680# Add, modify flows and check the updates.
4681ovs-ofctl mod-flows br0 dl_vlan=121,actions=drop
4682ovs-ofctl mod-flows br0 dl_vlan=122,actions=output:1,output:2
4683ovs-appctl -t ovs-ofctl ofctl/barrier
4684
4685ovs-ofctl mod-flows br0 dl_vlan=123,actions=output:1,output:2
4686ovs-appctl -t ovs-ofctl ofctl/barrier
4687
4688ovs-ofctl mod-flows br0 dl_vlan=122,actions=output:1
4689ovs-appctl -t ovs-ofctl ofctl/barrier
4690ovs-ofctl mod-flows br0 dl_vlan=123,actions=output:2
4691ovs-appctl -t ovs-ofctl ofctl/barrier
4692
4693AT_CHECK([sed 's/ (xid=0x[[1-9a-fA-F]][[0-9a-fA-F]]*)//' monitor.log], [0],
4694[NXST_FLOW_MONITOR reply (xid=0x0):
4695 event=MODIFIED table=0 cookie=0 in_port=0,dl_vlan=122 actions=output:1,output:2
4696OFPT_BARRIER_REPLY:
4697NXST_FLOW_MONITOR reply (xid=0x0):
4698 event=MODIFIED table=0 cookie=0 in_port=0,dl_vlan=123 actions=output:1,output:2
4699OFPT_BARRIER_REPLY:
4700NXST_FLOW_MONITOR reply (xid=0x0):
4701 event=MODIFIED table=0 cookie=0 in_port=0,dl_vlan=122 actions=output:1
4702OFPT_BARRIER_REPLY:
4703NXST_FLOW_MONITOR reply (xid=0x0):
4704 event=MODIFIED table=0 cookie=0 in_port=0,dl_vlan=123 actions=output:2
2b07c8b1
BP
4705OFPT_BARRIER_REPLY:
4706])
4707
d9c8c57c 4708OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
2b07c8b1
BP
4709OVS_VSWITCHD_STOP
4710AT_CLEANUP
4711
4712AT_SETUP([ofproto - flow monitoring pause and resume])
4713AT_KEYWORDS([monitor])
4714
46a80050
EM
4715# The maximum socket receive buffer size is important for this test, which
4716# tests behavior when the receive buffer overflows.
4717if test -e /proc/sys/net/core/rmem_max; then
4718 # Linux
4719 rmem_max=`cat /proc/sys/net/core/rmem_max`
4720elif rmem_max=`sysctl -n net.inet.tcp.recvbuf_max 2>/dev/null`; then
f3326eeb 4721 : # FreeBSD, NetBSD
46a80050
EM
4722else
4723 # Don't know how to get maximum socket receive buffer on this OS
4724 AT_SKIP_IF([:])
4725fi
2b07c8b1
BP
4726# Calculate the total amount of queuing: rmem_max in the kernel, 128 kB
4727# in ofproto sending userspace (see ofmonitor_flush() in connmgr.c).
2b07c8b1
BP
4728queue_size=`expr $rmem_max + 128 \* 1024`
4729echo rmem_max=$rmem_max queue_size=$queue_size
4730
21aa35c3
BP
4731# If there's too much queuing skip the test to avoid timing out.
4732AT_SKIP_IF([test $rmem_max -gt 1048576])
4733
2b07c8b1
BP
4734# Each flow update message takes up at least 48 bytes of space in queues
4735# and in practice more than that.
4736n_msgs=`expr $queue_size / 48`
4737echo n_msgs=$n_msgs
4738
4739OVS_VSWITCHD_START
4740
4741# Start a monitor watching the flow table, then make it block.
53eb8cb8 4742on_exit 'kill `cat ovs-ofctl.pid`'
2b07c8b1
BP
4743ovs-ofctl monitor br0 watch: --detach --no-chdir --pidfile >monitor.log 2>&1
4744AT_CAPTURE_FILE([monitor.log])
4745ovs-appctl -t ovs-ofctl ofctl/block
4746
4747# Add $n_msgs flows.
4748(echo "in_port=2,actions=output:2"
719dcfd4
BP
4749$PYTHON -c '
4750for i in range('$n_msgs'):
4751 print("cookie=1,reg1=%d,actions=drop" % i)
2b07c8b1
BP
4752') > flows.txt
4753AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
79b8c36c
BP
4754# Check that multipart flow dumps work properly:
4755AT_CHECK([ovs-ofctl diff-flows br0 flows.txt])
2b07c8b1
BP
4756AT_CHECK([ovs-ofctl add-flow br0 in_port=1,cookie=3,actions=drop])
4757AT_CHECK([ovs-ofctl mod-flows br0 in_port=2,cookie=2,actions=output:2])
4758AT_CHECK([ovs-ofctl del-flows br0 cookie=1/-1])
4759
4760ovs-appctl -t ovs-ofctl ofctl/unblock
c4821629
YT
4761
4762# Wait for the connection resumed.
4763# A barrier doesn't work for this purpose.
4764# https://www.mail-archive.com/dev@openvswitch.org/msg27013.html
4765# https://www.mail-archive.com/dev@openvswitch.org/msg27675.html
4766OVS_WAIT_UNTIL([grep NXT_FLOW_MONITOR_RESUMED monitor.log])
2b07c8b1 4767
d9c8c57c 4768OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
2b07c8b1
BP
4769
4770# Check that the flow monitor reported the same number of flows
4771# added and deleted, but fewer than we actually added and deleted.
4772adds=`grep -c 'ADDED.*reg1=' monitor.log`
4773deletes=`grep -c 'DELETED.*reg1=' monitor.log`
4774echo adds=$adds deletes=$deletes
4775AT_CHECK([test $adds -gt 100 && test $adds -lt $n_msgs])
4776AT_CHECK([test $adds = $deletes])
4777
d0ab8a1a
BP
4778# Check that the flow monitor reported everything in the expected order:
4779#
4780# event=ADDED table=0 cookie=0x1 reg1=0x22
4781# ...
4782# NXT_FLOW_MONITOR_PAUSED:
4783# ...
4784# event=DELETED reason=delete table=0 cookie=0x1 reg1=0x22
4785# ...
4786# event=ADDED table=0 cookie=0x3 in_port=1
4787# event=MODIFIED table=0 cookie=0x2 in_port=2 actions=output:2
4788# NXT_FLOW_MONITOR_RESUMED:
4789#
4790# except that, between the PAUSED and RESUMED, the order of the ADDED
4791# and MODIFIED lines lines depends on hash order, that is, it varies
4792# as we change the hash function or change architecture. Therefore,
4793# we use a couple of tests below to accept both orders.
2b07c8b1 4794AT_CHECK([ofctl_strip < monitor.log | sed -n -e '
46a80050 4795/reg1=0x22$/p
2b07c8b1
BP
4796/cookie=0x[[23]]/p
4797/NXT_FLOW_MONITOR_PAUSED:/p
4798/NXT_FLOW_MONITOR_RESUMED:/p
d0ab8a1a
BP
4799' > monitor.log.subset])
4800AT_CHECK([grep -v MODIFIED monitor.log.subset], [0], [dnl
4801 event=ADDED table=0 cookie=0x1 reg1=0x22
2b07c8b1
BP
4802NXT_FLOW_MONITOR_PAUSED:
4803 event=DELETED reason=delete table=0 cookie=0x1 reg1=0x22
4804 event=ADDED table=0 cookie=0x3 in_port=1
d0ab8a1a
BP
4805NXT_FLOW_MONITOR_RESUMED:
4806])
4807AT_CHECK([grep -v ADDED monitor.log.subset], [0], [dnl
4808NXT_FLOW_MONITOR_PAUSED:
4809 event=DELETED reason=delete table=0 cookie=0x1 reg1=0x22
2b07c8b1
BP
4810 event=MODIFIED table=0 cookie=0x2 in_port=2 actions=output:2
4811NXT_FLOW_MONITOR_RESUMED:
4812])
4813
4814OVS_VSWITCHD_STOP
4815AT_CLEANUP
45156451
AC
4816
4817AT_SETUP([ofproto - event filtering (OpenFlow 1.3)])
4818AT_KEYWORDS([monitor])
4819OVS_VSWITCHD_START
4820
4821# Start a monitor, use the required protocol version
4822ovs-ofctl -O OpenFlow13 monitor br0 --detach --no-chdir --pidfile >monitor.log 2>&1
4823AT_CAPTURE_FILE([monitor.log])
4824
4825# Send an OpenFlow13 message (04), OFPT_GET_ASYNC_REQUEST (1a), length (8), xid (0a)
4826ovs-appctl -t ovs-ofctl ofctl/send 041a00080000000a
4827ovs-appctl -t ovs-ofctl ofctl/barrier
4828
4829# Check default setting
4830read -r -d '' expected <<'EOF'
4831EOF
4832
4833AT_CHECK([ofctl_strip < monitor.log], [], [dnl
4834send: OFPT_GET_ASYNC_REQUEST (OF1.3):
4835OFPT_GET_ASYNC_REPLY (OF1.3):
4836 master:
4837 PACKET_IN: no_match action
4838 PORT_STATUS: add delete modify
75754d04 4839 FLOW_REMOVED: idle hard delete group_delete
904e5202
BP
4840 ROLE_STATUS: (off)
4841 TABLE_STATUS: (off)
4842 REQUESTFORWARD: (off)
45156451
AC
4843
4844 slave:
4845 PACKET_IN: (off)
4846 PORT_STATUS: add delete modify
4847 FLOW_REMOVED: (off)
904e5202
BP
4848 ROLE_STATUS: (off)
4849 TABLE_STATUS: (off)
4850 REQUESTFORWARD: (off)
45156451
AC
4851OFPT_BARRIER_REPLY (OF1.3):
4852])
4853
4854OVS_VSWITCHD_STOP
4855AT_CLEANUP
4abb8608
BP
4856
4857AT_SETUP([ofproto - ofport_request])
4858OVS_VSWITCHD_START
ca5792f0 4859add_of_ports br0 1 2 3
4abb8608
BP
4860
4861set_and_check_specific_ofports () {
4862 ovs-vsctl set Interface p1 ofport_request="$1" -- \
4863 set Interface p2 ofport_request="$2" -- \
4864 set Interface p3 ofport_request="$3"
4865 ofports=`ovs-vsctl get Interface p1 ofport -- \
4866 get Interface p2 ofport -- \
4867 get Interface p3 ofport`
4868 AT_CHECK_UNQUOTED([echo $ofports], [0], [$1 $2 $3
4869])
4870}
4871for pre in '1 2 3' '1 3 2' '2 1 3' '2 3 1' '3 1 2' '3 2 1'; do
4872 for post in '1 2 3' '1 3 2' '2 1 3' '2 3 1' '3 1 2' '3 2 1'; do
4873 echo -----------------------------------------------------------
4874 echo "Check changing port numbers from $pre to $post"
d08d51b9
JS
4875 set_and_check_specific_ofports $pre
4876 set_and_check_specific_ofports $post
4abb8608
BP
4877 done
4878done
4879
4880ovs-vsctl del-port p3
4881
4882set_and_check_poorly_specified_ofports () {
4883 ovs-vsctl set Interface p1 ofport_request="$1" -- \
4884 set Interface p2 ofport_request="$2"
4885 p1=`ovs-vsctl get Interface p1 ofport`
4886 p2=`ovs-vsctl get Interface p2 ofport`
4887 echo $p1 $p2
4888
4889 AT_CHECK([test "$p1" != "$p2"])
4890 if test "$1" = "$2" && test "$1" != '[[]]'; then
4891 # One port number must be the requested one.
4892 AT_CHECK([test "$p1" = "$1" || test "$p2" = "$1"])
4893 # The other port number must be different (already tested above).
4894 else
641c6188
YT
4895 AT_CHECK([test "$1" = '[[]]' || test "$p1" = "$1"])
4896 AT_CHECK([test "$2" = '[[]]' || test "$p2" = "$2"])
4abb8608
BP
4897 fi
4898}
4899for pre in '1 2' '[[]] 2' '1 [[]]' '[[]] [[]]' '2 1' '[[]] 1' '2 [[]]' \
4900 '1 1' '2 2'; do
4901 for post in '1 2' '[[]] 2' '1 [[]]' '[[]] [[]]' '2 1' '[[]] 1' '2 [[]]' \
4902 '1 1' '2 2'; do
4903 echo -----------------------------------------------------------
4904 echo "Check changing port numbers from $pre to $post"
4905 set_and_check_poorly_specified_ofports $pre
4906 set_and_check_poorly_specified_ofports $post
4907 done
4908done
4909OVS_VSWITCHD_STOP
4910AT_CLEANUP
777af88d
AC
4911
4912
06d4d4b6 4913AT_SETUP([ofproto - bundle open (OpenFlow 1.4)])
777af88d
AC
4914AT_KEYWORDS([monitor])
4915OVS_VSWITCHD_START
4916
4917# Start a monitor, use the required protocol version
4918ovs-ofctl -O OpenFlow14 monitor br0 --detach --no-chdir --pidfile >monitor.log 2>&1
4919AT_CAPTURE_FILE([monitor.log])
4920
4921# Send an OpenFlow14 message (05), OFPT_BUNDLE_CONTROL (21), length (10), xid (0a)
1f42be1c 4922ovs-appctl -t ovs-ofctl ofctl/send "05 21 00 10 00 00 00 0a 00 00 00 01 00 00 00 02"
777af88d 4923ovs-appctl -t ovs-ofctl ofctl/barrier
d9c8c57c 4924OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
777af88d
AC
4925
4926AT_CHECK([ofctl_strip < monitor.log], [], [dnl
4927send: OFPT_BUNDLE_CONTROL (OF1.4):
1f42be1c 4928 bundle_id=0x1 type=OPEN_REQUEST flags=ordered
777af88d
AC
4929OFPT_BUNDLE_CONTROL (OF1.4):
4930 bundle_id=0x1 type=OPEN_REPLY flags=0
4931OFPT_BARRIER_REPLY (OF1.4):
4932])
4933
4934OVS_VSWITCHD_STOP
4935AT_CLEANUP
4936
06d4d4b6 4937AT_SETUP([ofproto - bundle double open (OpenFlow 1.4)])
777af88d
AC
4938AT_KEYWORDS([monitor])
4939OVS_VSWITCHD_START
4940
4941# Start a monitor, use the required protocol version
4942ovs-ofctl -O OpenFlow14 monitor br0 --detach --no-chdir --pidfile >monitor.log 2>&1
4943AT_CAPTURE_FILE([monitor.log])
4944
4945# Send twice an OpenFlow14 message (05), OFPT_BUNDLE_CONTROL (21), length (10), xid (0a)
1f42be1c 4946ovs-appctl -t ovs-ofctl ofctl/send "05 21 00 10 00 00 00 0a 00 00 00 01 00 00 00 02"
777af88d 4947ovs-appctl -t ovs-ofctl ofctl/barrier
1f42be1c 4948ovs-appctl -t ovs-ofctl ofctl/send "05 21 00 10 00 00 00 0a 00 00 00 01 00 00 00 02"
777af88d 4949ovs-appctl -t ovs-ofctl ofctl/barrier
d9c8c57c 4950OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
777af88d
AC
4951
4952AT_CHECK([ofctl_strip < monitor.log], [0], [dnl
4953send: OFPT_BUNDLE_CONTROL (OF1.4):
1f42be1c 4954 bundle_id=0x1 type=OPEN_REQUEST flags=ordered
777af88d
AC
4955OFPT_BUNDLE_CONTROL (OF1.4):
4956 bundle_id=0x1 type=OPEN_REPLY flags=0
4957OFPT_BARRIER_REPLY (OF1.4):
4958send: OFPT_BUNDLE_CONTROL (OF1.4):
1f42be1c 4959 bundle_id=0x1 type=OPEN_REQUEST flags=ordered
777af88d
AC
4960OFPT_ERROR (OF1.4): OFPBFC_BAD_ID
4961OFPT_BUNDLE_CONTROL (OF1.4):
1f42be1c 4962 bundle_id=0x1 type=OPEN_REQUEST flags=ordered
777af88d
AC
4963OFPT_BARRIER_REPLY (OF1.4):
4964])
4965
4966OVS_VSWITCHD_STOP
4967AT_CLEANUP
4968
4969AT_SETUP([ofproto - bundle close without open (OpenFlow 1.4)])
4970AT_KEYWORDS([monitor])
4971OVS_VSWITCHD_START
4972
4973# Start a monitor, use the required protocol version
4974ovs-ofctl -O OpenFlow14 monitor br0 --detach --no-chdir --pidfile >monitor.log 2>&1
4975AT_CAPTURE_FILE([monitor.log])
4976
1f42be1c 4977ovs-appctl -t ovs-ofctl ofctl/send "05 21 00 10 00 00 00 0a 00 00 00 01 00 02 00 02"
777af88d 4978ovs-appctl -t ovs-ofctl ofctl/barrier
d9c8c57c 4979OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
777af88d
AC
4980
4981AT_CHECK([ofctl_strip < monitor.log], [0], [dnl
4982send: OFPT_BUNDLE_CONTROL (OF1.4):
1f42be1c 4983 bundle_id=0x1 type=CLOSE_REQUEST flags=ordered
777af88d
AC
4984OFPT_ERROR (OF1.4): OFPBFC_BAD_ID
4985OFPT_BUNDLE_CONTROL (OF1.4):
1f42be1c 4986 bundle_id=0x1 type=CLOSE_REQUEST flags=ordered
777af88d
AC
4987OFPT_BARRIER_REPLY (OF1.4):
4988])
4989
4990OVS_VSWITCHD_STOP
4991AT_CLEANUP
4992
4993AT_SETUP([ofproto - bundle double close (OpenFlow 1.4)])
4994AT_KEYWORDS([monitor])
4995OVS_VSWITCHD_START
4996
4997# Start a monitor, use the required protocol version
4998ovs-ofctl -O OpenFlow14 monitor br0 --detach --no-chdir --pidfile >monitor.log 2>&1
4999AT_CAPTURE_FILE([monitor.log])
5000
5001# Open, Close, Close
1f42be1c 5002ovs-appctl -t ovs-ofctl ofctl/send "05 21 00 10 00 00 00 0a 00 00 00 01 00 00 00 02"
777af88d 5003ovs-appctl -t ovs-ofctl ofctl/barrier
1f42be1c 5004ovs-appctl -t ovs-ofctl ofctl/send "05 21 00 10 00 00 00 0a 00 00 00 01 00 02 00 02"
777af88d 5005ovs-appctl -t ovs-ofctl ofctl/barrier
1f42be1c 5006ovs-appctl -t ovs-ofctl ofctl/send "05 21 00 10 00 00 00 0a 00 00 00 01 00 02 00 02"
777af88d 5007ovs-appctl -t ovs-ofctl ofctl/barrier
d9c8c57c 5008OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
777af88d
AC
5009
5010AT_CHECK([ofctl_strip < monitor.log], [0], [dnl
5011send: OFPT_BUNDLE_CONTROL (OF1.4):
1f42be1c 5012 bundle_id=0x1 type=OPEN_REQUEST flags=ordered
777af88d
AC
5013OFPT_BUNDLE_CONTROL (OF1.4):
5014 bundle_id=0x1 type=OPEN_REPLY flags=0
5015OFPT_BARRIER_REPLY (OF1.4):
5016send: OFPT_BUNDLE_CONTROL (OF1.4):
1f42be1c 5017 bundle_id=0x1 type=CLOSE_REQUEST flags=ordered
777af88d
AC
5018OFPT_BUNDLE_CONTROL (OF1.4):
5019 bundle_id=0x1 type=CLOSE_REPLY flags=0
5020OFPT_BARRIER_REPLY (OF1.4):
5021send: OFPT_BUNDLE_CONTROL (OF1.4):
1f42be1c 5022 bundle_id=0x1 type=CLOSE_REQUEST flags=ordered
777af88d
AC
5023OFPT_ERROR (OF1.4): OFPBFC_BUNDLE_CLOSED
5024OFPT_BUNDLE_CONTROL (OF1.4):
1f42be1c 5025 bundle_id=0x1 type=CLOSE_REQUEST flags=ordered
777af88d
AC
5026OFPT_BARRIER_REPLY (OF1.4):
5027])
5028
5029OVS_VSWITCHD_STOP
5030AT_CLEANUP
5031
5032AT_SETUP([ofproto - bundle close, different flags (OpenFlow 1.4)])
5033AT_KEYWORDS([monitor])
5034OVS_VSWITCHD_START
5035
5036# Start a monitor, use the required protocol version
5037ovs-ofctl -O OpenFlow14 monitor br0 --detach --no-chdir --pidfile >monitor.log 2>&1
5038AT_CAPTURE_FILE([monitor.log])
5039
68030e16 5040# Open, Close
1f42be1c 5041ovs-appctl -t ovs-ofctl ofctl/send "05 21 00 10 00 00 00 0a 00 00 00 01 00 00 00 02"
777af88d 5042ovs-appctl -t ovs-ofctl ofctl/barrier
1f42be1c 5043ovs-appctl -t ovs-ofctl ofctl/send "05 21 00 10 00 00 00 0a 00 00 00 01 00 02 00 01"
777af88d 5044ovs-appctl -t ovs-ofctl ofctl/barrier
d9c8c57c 5045OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
777af88d
AC
5046
5047AT_CHECK([ofctl_strip < monitor.log], [0], [dnl
5048send: OFPT_BUNDLE_CONTROL (OF1.4):
1f42be1c 5049 bundle_id=0x1 type=OPEN_REQUEST flags=ordered
777af88d
AC
5050OFPT_BUNDLE_CONTROL (OF1.4):
5051 bundle_id=0x1 type=OPEN_REPLY flags=0
5052OFPT_BARRIER_REPLY (OF1.4):
5053send: OFPT_BUNDLE_CONTROL (OF1.4):
1f42be1c 5054 bundle_id=0x1 type=CLOSE_REQUEST flags=atomic
777af88d
AC
5055OFPT_ERROR (OF1.4): OFPBFC_BAD_FLAGS
5056OFPT_BUNDLE_CONTROL (OF1.4):
1f42be1c 5057 bundle_id=0x1 type=CLOSE_REQUEST flags=atomic
777af88d
AC
5058OFPT_BARRIER_REPLY (OF1.4):
5059])
5060
5061OVS_VSWITCHD_STOP
5062AT_CLEANUP
5063
5064AT_SETUP([ofproto - bundle commit without open (OpenFlow 1.4)])
5065AT_KEYWORDS([monitor])
5066OVS_VSWITCHD_START
5067
5068# Start a monitor, use the required protocol version
5069ovs-ofctl -O OpenFlow14 monitor br0 --detach --no-chdir --pidfile >monitor.log 2>&1
5070AT_CAPTURE_FILE([monitor.log])
5071
68030e16 5072# Commit
1f42be1c 5073ovs-appctl -t ovs-ofctl ofctl/send "05 21 00 10 00 00 00 0a 00 00 00 01 00 04 00 02"
777af88d 5074ovs-appctl -t ovs-ofctl ofctl/barrier
d9c8c57c 5075OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
777af88d
AC
5076
5077AT_CHECK([ofctl_strip < monitor.log], [0], [dnl
5078send: OFPT_BUNDLE_CONTROL (OF1.4):
1f42be1c 5079 bundle_id=0x1 type=COMMIT_REQUEST flags=ordered
777af88d
AC
5080OFPT_ERROR (OF1.4): OFPBFC_BAD_ID
5081OFPT_BUNDLE_CONTROL (OF1.4):
1f42be1c 5082 bundle_id=0x1 type=COMMIT_REQUEST flags=ordered
777af88d
AC
5083OFPT_BARRIER_REPLY (OF1.4):
5084])
5085
5086OVS_VSWITCHD_STOP
5087AT_CLEANUP
5088
5089AT_SETUP([ofproto - bundle commit, different flags (OpenFlow 1.4)])
5090AT_KEYWORDS([monitor])
5091OVS_VSWITCHD_START
5092
5093# Start a monitor, use the required protocol version
5094ovs-ofctl -O OpenFlow14 monitor br0 --detach --no-chdir --pidfile >monitor.log 2>&1
5095AT_CAPTURE_FILE([monitor.log])
5096
68030e16 5097# Open, Commit
1f42be1c 5098ovs-appctl -t ovs-ofctl ofctl/send "05 21 00 10 00 00 00 0a 00 00 00 01 00 00 00 02"
777af88d 5099ovs-appctl -t ovs-ofctl ofctl/barrier
1f42be1c 5100ovs-appctl -t ovs-ofctl ofctl/send "05 21 00 10 00 00 00 0a 00 00 00 01 00 04 00 01"
777af88d 5101ovs-appctl -t ovs-ofctl ofctl/barrier
d9c8c57c 5102OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
777af88d
AC
5103
5104AT_CHECK([ofctl_strip < monitor.log], [0], [dnl
5105send: OFPT_BUNDLE_CONTROL (OF1.4):
1f42be1c 5106 bundle_id=0x1 type=OPEN_REQUEST flags=ordered
777af88d
AC
5107OFPT_BUNDLE_CONTROL (OF1.4):
5108 bundle_id=0x1 type=OPEN_REPLY flags=0
5109OFPT_BARRIER_REPLY (OF1.4):
5110send: OFPT_BUNDLE_CONTROL (OF1.4):
1f42be1c 5111 bundle_id=0x1 type=COMMIT_REQUEST flags=atomic
777af88d
AC
5112OFPT_ERROR (OF1.4): OFPBFC_BAD_FLAGS
5113OFPT_BUNDLE_CONTROL (OF1.4):
1f42be1c 5114 bundle_id=0x1 type=COMMIT_REQUEST flags=atomic
777af88d
AC
5115OFPT_BARRIER_REPLY (OF1.4):
5116])
5117
5118OVS_VSWITCHD_STOP
5119AT_CLEANUP
5120
5121AT_SETUP([ofproto - bundle discard without open (OpenFlow 1.4)])
5122AT_KEYWORDS([monitor])
5123OVS_VSWITCHD_START
5124
5125# Start a monitor, use the required protocol version
5126ovs-ofctl -O OpenFlow14 monitor br0 --detach --no-chdir --pidfile >monitor.log 2>&1
5127AT_CAPTURE_FILE([monitor.log])
5128
68030e16 5129# Discard
1f42be1c 5130ovs-appctl -t ovs-ofctl ofctl/send "05 21 00 10 00 00 00 0a 00 00 00 01 00 06 00 02"
777af88d 5131ovs-appctl -t ovs-ofctl ofctl/barrier
d9c8c57c 5132OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
777af88d
AC
5133
5134AT_CHECK([ofctl_strip < monitor.log], [0], [dnl
5135send: OFPT_BUNDLE_CONTROL (OF1.4):
1f42be1c 5136 bundle_id=0x1 type=DISCARD_REQUEST flags=ordered
777af88d
AC
5137OFPT_ERROR (OF1.4): OFPBFC_BAD_ID
5138OFPT_BUNDLE_CONTROL (OF1.4):
1f42be1c 5139 bundle_id=0x1 type=DISCARD_REQUEST flags=ordered
777af88d
AC
5140OFPT_BARRIER_REPLY (OF1.4):
5141])
5142
5143OVS_VSWITCHD_STOP
5144AT_CLEANUP
db5076ee
JR
5145
5146
5147AT_SETUP([ofproto - bundle with multiple flow mods (OpenFlow 1.4)])
db5076ee
JR
5148OVS_VSWITCHD_START
5149
5150AT_CHECK([ovs-appctl vlog/set vconn:dbg])
5151
50f96b10 5152AT_CHECK([ovs-ofctl --no-names del-flows br0])
db5076ee
JR
5153
5154AT_DATA([flows.txt], [dnl
5155add idle_timeout=50 in_port=2 dl_src=00:66:77:88:99:aa actions=1
5156add idle_timeout=60 in_port=2 dl_src=00:77:88:99:aa:bb actions=2
5157add idle_timeout=70 in_port=2 dl_src=00:88:99:aa:bb:cc actions=3
5158add idle_timeout=50 in_port=2 dl_src=00:66:77:88:99:aa actions=4
5159delete
5160add idle_timeout=50 in_port=2 dl_src=00:66:77:88:99:aa actions=5
5161add idle_timeout=60 in_port=2 dl_src=00:77:88:99:aa:bb actions=6
5162add idle_timeout=70 in_port=2 dl_src=00:88:99:aa:bb:cc actions=7
5163delete in_port=2 dl_src=00:88:99:aa:bb:cc
5164])
5165
50f96b10 5166AT_CHECK([ovs-ofctl --no-names --bundle add-flows br0 flows.txt])
db5076ee
JR
5167
5168AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
5169 idle_timeout=50, in_port=2,dl_src=00:66:77:88:99:aa actions=output:5
5170 idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=output:6
5171NXST_FLOW reply:
5172])
5173
5174AT_DATA([flows.txt], [dnl
5175modify actions=drop
5176modify_strict in_port=2 dl_src=00:77:88:99:aa:bb actions=7
5177])
5178
50f96b10 5179AT_CHECK([ovs-ofctl --no-names --bundle add-flows br0 flows.txt])
db5076ee
JR
5180
5181AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
5182 idle_timeout=50, in_port=2,dl_src=00:66:77:88:99:aa actions=drop
5183 idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=output:7
5184NXST_FLOW reply:
5185])
5186
5187# Adding an existing flow acts as a modify, and delete_strict also works.
5188AT_DATA([flows.txt], [dnl
5189add idle_timeout=60 in_port=2 dl_src=00:77:88:99:aa:bb actions=8
5190delete_strict in_port=2 dl_src=00:66:77:88:99:aa
5191add in_port=2 dl_src=00:66:77:88:99:aa actions=drop
5192])
5193
50f96b10 5194AT_CHECK([ovs-ofctl --no-names --bundle add-flows br0 flows.txt])
db5076ee
JR
5195
5196AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
5197 idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=output:8
5198 in_port=2,dl_src=00:66:77:88:99:aa actions=drop
5199NXST_FLOW reply:
5200])
5201
5202dnl Check logs for OpenFlow trace
5203# Prevent race.
38b0b29f 5204OVS_WAIT_UNTIL([vconn_sub < ovs-vswitchd.log | test `grep -- "|vconn|DBG|unix: sent (Success): NXST_FLOW reply" | wc -l` -ge 3])
12e2ba2e 5205AT_CHECK([print_vconn_debug | vconn_sub | ofctl_strip], [0], [dnl
b79d45a1
BP
5206vconn|DBG|unix: sent (Success): OFPT_HELLO (OF1.6):
5207 version bitmap: 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07
db5076ee
JR
5208vconn|DBG|unix: received: OFPT_HELLO:
5209 version bitmap: 0x01
b79d45a1 5210vconn|DBG|unix: negotiated OpenFlow version 0x01 (we support version 0x07 and earlier, peer supports version 0x01)
db5076ee
JR
5211vconn|DBG|unix: received: OFPT_FLOW_MOD: DEL actions=drop
5212vconn|DBG|unix: received: OFPT_BARRIER_REQUEST:
5213vconn|DBG|unix: sent (Success): OFPT_BARRIER_REPLY:
b79d45a1
BP
5214vconn|DBG|unix: sent (Success): OFPT_HELLO (OF1.6):
5215 version bitmap: 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07
db5076ee 5216vconn|DBG|unix: received: OFPT_HELLO (OF1.4):
5f8c05ad 5217 version bitmap: 0x05
b79d45a1 5218vconn|DBG|unix: negotiated OpenFlow version 0x05 (we support version 0x07 and earlier, peer supports version 0x05)
db5076ee 5219vconn|DBG|unix: received: OFPT_BUNDLE_CONTROL (OF1.4):
39c94593 5220 bundle_id=0 type=OPEN_REQUEST flags=atomic ordered
db5076ee
JR
5221vconn|DBG|unix: sent (Success): OFPT_BUNDLE_CONTROL (OF1.4):
5222 bundle_id=0 type=OPEN_REPLY flags=0
5223vconn|DBG|unix: received: OFPT_BUNDLE_ADD_MESSAGE (OF1.4):
39c94593 5224 bundle_id=0 flags=atomic ordered
db5076ee
JR
5225OFPT_FLOW_MOD (OF1.4): ADD in_port=2,dl_src=00:66:77:88:99:aa idle:50 actions=output:1
5226vconn|DBG|unix: received: OFPT_BUNDLE_ADD_MESSAGE (OF1.4):
39c94593 5227 bundle_id=0 flags=atomic ordered
db5076ee
JR
5228OFPT_FLOW_MOD (OF1.4): ADD in_port=2,dl_src=00:77:88:99:aa:bb idle:60 actions=output:2
5229vconn|DBG|unix: received: OFPT_BUNDLE_ADD_MESSAGE (OF1.4):
39c94593 5230 bundle_id=0 flags=atomic ordered
db5076ee
JR
5231OFPT_FLOW_MOD (OF1.4): ADD in_port=2,dl_src=00:88:99:aa:bb:cc idle:70 actions=output:3
5232vconn|DBG|unix: received: OFPT_BUNDLE_ADD_MESSAGE (OF1.4):
39c94593 5233 bundle_id=0 flags=atomic ordered
db5076ee
JR
5234OFPT_FLOW_MOD (OF1.4): ADD in_port=2,dl_src=00:66:77:88:99:aa idle:50 actions=output:4
5235vconn|DBG|unix: received: OFPT_BUNDLE_ADD_MESSAGE (OF1.4):
39c94593 5236 bundle_id=0 flags=atomic ordered
db5076ee
JR
5237OFPT_FLOW_MOD (OF1.4): DEL table:255 actions=drop
5238vconn|DBG|unix: received: OFPT_BUNDLE_ADD_MESSAGE (OF1.4):
39c94593 5239 bundle_id=0 flags=atomic ordered
db5076ee
JR
5240OFPT_FLOW_MOD (OF1.4): ADD in_port=2,dl_src=00:66:77:88:99:aa idle:50 actions=output:5
5241vconn|DBG|unix: received: OFPT_BUNDLE_ADD_MESSAGE (OF1.4):
39c94593 5242 bundle_id=0 flags=atomic ordered
db5076ee
JR
5243OFPT_FLOW_MOD (OF1.4): ADD in_port=2,dl_src=00:77:88:99:aa:bb idle:60 actions=output:6
5244vconn|DBG|unix: received: OFPT_BUNDLE_ADD_MESSAGE (OF1.4):
39c94593 5245 bundle_id=0 flags=atomic ordered
db5076ee
JR
5246OFPT_FLOW_MOD (OF1.4): ADD in_port=2,dl_src=00:88:99:aa:bb:cc idle:70 actions=output:7
5247vconn|DBG|unix: received: OFPT_BUNDLE_ADD_MESSAGE (OF1.4):
39c94593 5248 bundle_id=0 flags=atomic ordered
db5076ee 5249OFPT_FLOW_MOD (OF1.4): DEL table:255 in_port=2,dl_src=00:88:99:aa:bb:cc actions=drop
506c1ddb
JR
5250vconn|DBG|unix: received: OFPT_BARRIER_REQUEST (OF1.4):
5251vconn|DBG|unix: sent (Success): OFPT_BARRIER_REPLY (OF1.4):
db5076ee 5252vconn|DBG|unix: received: OFPT_BUNDLE_CONTROL (OF1.4):
39c94593 5253 bundle_id=0 type=COMMIT_REQUEST flags=atomic ordered
db5076ee
JR
5254vconn|DBG|unix: sent (Success): OFPT_BUNDLE_CONTROL (OF1.4):
5255 bundle_id=0 type=COMMIT_REPLY flags=0
b79d45a1
BP
5256vconn|DBG|unix: sent (Success): OFPT_HELLO (OF1.6):
5257 version bitmap: 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07
db5076ee
JR
5258vconn|DBG|unix: received: OFPT_HELLO:
5259 version bitmap: 0x01
b79d45a1 5260vconn|DBG|unix: negotiated OpenFlow version 0x01 (we support version 0x07 and earlier, peer supports version 0x01)
db5076ee
JR
5261vconn|DBG|unix: received: NXT_SET_FLOW_FORMAT: format=nxm
5262vconn|DBG|unix: received: OFPT_BARRIER_REQUEST:
5263vconn|DBG|unix: sent (Success): OFPT_BARRIER_REPLY:
5264vconn|DBG|unix: received: NXST_FLOW request:
5265vconn|DBG|unix: sent (Success): NXST_FLOW reply:
5266 idle_timeout=50, in_port=2,dl_src=00:66:77:88:99:aa actions=output:5
5267 idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=output:6
b79d45a1
BP
5268vconn|DBG|unix: sent (Success): OFPT_HELLO (OF1.6):
5269 version bitmap: 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07
db5076ee 5270vconn|DBG|unix: received: OFPT_HELLO (OF1.4):
5f8c05ad 5271 version bitmap: 0x05
b79d45a1 5272vconn|DBG|unix: negotiated OpenFlow version 0x05 (we support version 0x07 and earlier, peer supports version 0x05)
db5076ee 5273vconn|DBG|unix: received: OFPT_BUNDLE_CONTROL (OF1.4):
39c94593 5274 bundle_id=0 type=OPEN_REQUEST flags=atomic ordered
db5076ee
JR
5275vconn|DBG|unix: sent (Success): OFPT_BUNDLE_CONTROL (OF1.4):
5276 bundle_id=0 type=OPEN_REPLY flags=0
5277vconn|DBG|unix: received: OFPT_BUNDLE_ADD_MESSAGE (OF1.4):
39c94593 5278 bundle_id=0 flags=atomic ordered
db5076ee
JR
5279OFPT_FLOW_MOD (OF1.4): MOD actions=drop
5280vconn|DBG|unix: received: OFPT_BUNDLE_ADD_MESSAGE (OF1.4):
39c94593 5281 bundle_id=0 flags=atomic ordered
db5076ee 5282OFPT_FLOW_MOD (OF1.4): MOD_STRICT in_port=2,dl_src=00:77:88:99:aa:bb actions=output:7
506c1ddb
JR
5283vconn|DBG|unix: received: OFPT_BARRIER_REQUEST (OF1.4):
5284vconn|DBG|unix: sent (Success): OFPT_BARRIER_REPLY (OF1.4):
db5076ee 5285vconn|DBG|unix: received: OFPT_BUNDLE_CONTROL (OF1.4):
39c94593 5286 bundle_id=0 type=COMMIT_REQUEST flags=atomic ordered
db5076ee
JR
5287vconn|DBG|unix: sent (Success): OFPT_BUNDLE_CONTROL (OF1.4):
5288 bundle_id=0 type=COMMIT_REPLY flags=0
b79d45a1
BP
5289vconn|DBG|unix: sent (Success): OFPT_HELLO (OF1.6):
5290 version bitmap: 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07
db5076ee
JR
5291vconn|DBG|unix: received: OFPT_HELLO:
5292 version bitmap: 0x01
b79d45a1 5293vconn|DBG|unix: negotiated OpenFlow version 0x01 (we support version 0x07 and earlier, peer supports version 0x01)
db5076ee
JR
5294vconn|DBG|unix: received: NXT_SET_FLOW_FORMAT: format=nxm
5295vconn|DBG|unix: received: OFPT_BARRIER_REQUEST:
5296vconn|DBG|unix: sent (Success): OFPT_BARRIER_REPLY:
5297vconn|DBG|unix: received: NXST_FLOW request:
5298vconn|DBG|unix: sent (Success): NXST_FLOW reply:
5299 idle_timeout=50, in_port=2,dl_src=00:66:77:88:99:aa actions=drop
5300 idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=output:7
b79d45a1
BP
5301vconn|DBG|unix: sent (Success): OFPT_HELLO (OF1.6):
5302 version bitmap: 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07
db5076ee 5303vconn|DBG|unix: received: OFPT_HELLO (OF1.4):
5f8c05ad 5304 version bitmap: 0x05
b79d45a1 5305vconn|DBG|unix: negotiated OpenFlow version 0x05 (we support version 0x07 and earlier, peer supports version 0x05)
db5076ee 5306vconn|DBG|unix: received: OFPT_BUNDLE_CONTROL (OF1.4):
39c94593 5307 bundle_id=0 type=OPEN_REQUEST flags=atomic ordered
db5076ee
JR
5308vconn|DBG|unix: sent (Success): OFPT_BUNDLE_CONTROL (OF1.4):
5309 bundle_id=0 type=OPEN_REPLY flags=0
5310vconn|DBG|unix: received: OFPT_BUNDLE_ADD_MESSAGE (OF1.4):
39c94593 5311 bundle_id=0 flags=atomic ordered
db5076ee
JR
5312OFPT_FLOW_MOD (OF1.4): ADD in_port=2,dl_src=00:77:88:99:aa:bb idle:60 actions=output:8
5313vconn|DBG|unix: received: OFPT_BUNDLE_ADD_MESSAGE (OF1.4):
39c94593 5314 bundle_id=0 flags=atomic ordered
db5076ee
JR
5315OFPT_FLOW_MOD (OF1.4): DEL_STRICT table:255 in_port=2,dl_src=00:66:77:88:99:aa actions=drop
5316vconn|DBG|unix: received: OFPT_BUNDLE_ADD_MESSAGE (OF1.4):
39c94593 5317 bundle_id=0 flags=atomic ordered
db5076ee 5318OFPT_FLOW_MOD (OF1.4): ADD in_port=2,dl_src=00:66:77:88:99:aa actions=drop
506c1ddb
JR
5319vconn|DBG|unix: received: OFPT_BARRIER_REQUEST (OF1.4):
5320vconn|DBG|unix: sent (Success): OFPT_BARRIER_REPLY (OF1.4):
db5076ee 5321vconn|DBG|unix: received: OFPT_BUNDLE_CONTROL (OF1.4):
39c94593 5322 bundle_id=0 type=COMMIT_REQUEST flags=atomic ordered
db5076ee
JR
5323vconn|DBG|unix: sent (Success): OFPT_BUNDLE_CONTROL (OF1.4):
5324 bundle_id=0 type=COMMIT_REPLY flags=0
b79d45a1
BP
5325vconn|DBG|unix: sent (Success): OFPT_HELLO (OF1.6):
5326 version bitmap: 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07
db5076ee
JR
5327vconn|DBG|unix: received: OFPT_HELLO:
5328 version bitmap: 0x01
b79d45a1 5329vconn|DBG|unix: negotiated OpenFlow version 0x01 (we support version 0x07 and earlier, peer supports version 0x01)
db5076ee
JR
5330vconn|DBG|unix: received: NXT_SET_FLOW_FORMAT: format=nxm
5331vconn|DBG|unix: received: OFPT_BARRIER_REQUEST:
5332vconn|DBG|unix: sent (Success): OFPT_BARRIER_REPLY:
5333vconn|DBG|unix: received: NXST_FLOW request:
5334vconn|DBG|unix: sent (Success): NXST_FLOW reply:
5335 idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=output:8
5336 in_port=2,dl_src=00:66:77:88:99:aa actions=drop
5337])
5338
14347f3e 5339AT_CHECK([grep " flow_mods in the last " ovs-vswitchd.log | sed -e 's/^.*connmgr|INFO|//' | vconn_sub], [0], [dnl
0c78eebe
JR
5340br0<->unix: 1 flow_mods in the last 0 s (1 deletes)
5341br0<->unix: 9 flow_mods in the last 0 s (7 adds, 2 deletes)
5342br0<->unix: 2 flow_mods in the last 0 s (2 modifications)
5343br0<->unix: 3 flow_mods in the last 0 s (2 adds, 1 deletes)
5344])
5345
db5076ee
JR
5346OVS_VSWITCHD_STOP
5347AT_CLEANUP
5348
5349
5350AT_SETUP([ofproto - failing bundle commit (OpenFlow 1.4)])
db5076ee
JR
5351OVS_VSWITCHD_START
5352
5353AT_CHECK([ovs-ofctl del-flows br0])
5354
5355ovs-ofctl add-flows br0 - <<EOF
5356idle_timeout=50 in_port=2 dl_src=00:66:77:88:99:aa actions=11
5357idle_timeout=60 in_port=2 dl_src=00:77:88:99:aa:bb actions=22
5358idle_timeout=70 in_port=2 dl_src=00:88:99:aa:bb:cc actions=33
5359EOF
5360AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
5361 idle_timeout=50, in_port=2,dl_src=00:66:77:88:99:aa actions=output:11
5362 idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=output:22
5363 idle_timeout=70, in_port=2,dl_src=00:88:99:aa:bb:cc actions=output:33
5364NXST_FLOW reply:
5365])
5366
5367# last line uses illegal table number (OVS internal table)
5368AT_DATA([flows.txt], [dnl
5369add idle_timeout=50 in_port=2 dl_src=00:66:77:88:99:aa actions=1
5370add idle_timeout=60 in_port=2 dl_src=00:77:88:99:aa:bb actions=2
5371add idle_timeout=70 in_port=2 dl_src=00:88:99:aa:bb:cc actions=3
5372modify idle_timeout=50 in_port=2 dl_src=00:66:77:88:99:aa actions=4
5373delete
5374add idle_timeout=50 in_port=2 dl_src=00:66:77:88:99:aa actions=5
5375add idle_timeout=60 in_port=2 dl_src=00:77:88:99:aa:bb actions=6
5376add idle_timeout=70 in_port=2 dl_src=00:88:99:aa:bb:cc actions=7
5377delete in_port=2 dl_src=00:88:99:aa:bb:cc
5378add table=254 actions=drop
5379])
5380
50f96b10 5381AT_CHECK([ovs-ofctl --bundle add-flows br0 flows.txt 2>&1 | sed '/talking to/,$d' | strip_xids],
b0065993 5382[0], [dnl
50f96b10 5383Error OFPBRC_EPERM for: OFPT_FLOW_MOD (OF1.4): ADD table:254 actions=drop
db5076ee
JR
5384])
5385
5386AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
5387 idle_timeout=50, in_port=2,dl_src=00:66:77:88:99:aa actions=output:11
5388 idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=output:22
5389 idle_timeout=70, in_port=2,dl_src=00:88:99:aa:bb:cc actions=output:33
5390NXST_FLOW reply:
5391])
5392
5393OVS_VSWITCHD_STOP
5394AT_CLEANUP
51bb26fa
JR
5395
5396
5397AT_SETUP([ofproto - bundle timeout (OpenFlow 1.4)])
5398AT_KEYWORDS([monitor])
5399OVS_VSWITCHD_START
5400
5401# Start a monitor, use the required protocol version
5402ovs-ofctl -O OpenFlow14 monitor br0 --detach --no-chdir --pidfile >monitor.log 2>&1
5403AT_CAPTURE_FILE([monitor.log])
5404
5405ovs-appctl time/stop
5406
5407# Send an OpenFlow14 message (05), OFPT_BUNDLE_CONTROL (21), length (10), xid (01)
5408ovs-appctl -t ovs-ofctl ofctl/send "05 21 00 10 00 00 00 01 00 00 00 01 00 00 00 03"
5409ovs-appctl time/warp 8000
5410# Send a bundle flow mod, it should keep the bundle alive.
5411ovs-appctl -t ovs-ofctl ofctl/send "05 22 00 a0 00 00 00 02 00 00 00 01 00 00 00 03 \
541205 0e 00 90 00 00 00 02 00 00 00 00 00 00 00 00 \
541300 00 00 00 00 00 00 00 01 00 00 00 00 00 ff ff \
5414ff ff ff ff ff ff ff ff ff ff ff ff 00 00 00 00 \
541500 01 00 42 80 00 00 04 00 00 00 01 80 00 08 06 \
541650 54 00 00 00 06 80 00 06 06 50 54 00 00 00 05 \
541780 00 0a 02 08 06 80 00 0c 02 00 00 80 00 2a 02 \
541800 02 80 00 2c 04 c0 a8 00 02 80 00 2e 04 c0 a8 \
541900 01 00 00 00 00 00 00 00 04 00 18 00 00 00 00 \
542000 00 00 10 00 00 00 03 00 00 00 00 00 00 00 00 \
5421"
5422ovs-appctl time/warp 8000
5423# Send a bundle close, it should keep the bundle alive.
5424ovs-appctl -t ovs-ofctl ofctl/send "05 21 00 10 00 00 00 03 00 00 00 01 00 02 00 03"
5425ovs-appctl time/warp 11000
5426# Make sure that timeouts are processed after the expiry
5427ovs-appctl time/warp 1000
5428# Send a Commit, but too late.
5429ovs-appctl -t ovs-ofctl ofctl/send "05 21 00 10 00 00 00 04 00 00 00 01 00 04 00 03"
5430ovs-appctl -t ovs-ofctl ofctl/barrier
5431OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
5432
5433AT_CHECK([ofctl_strip < monitor.log], [], [dnl
5434send: OFPT_BUNDLE_CONTROL (OF1.4):
5435 bundle_id=0x1 type=OPEN_REQUEST flags=atomic ordered
5436OFPT_BUNDLE_CONTROL (OF1.4):
5437 bundle_id=0x1 type=OPEN_REPLY flags=0
5438send: OFPT_BUNDLE_ADD_MESSAGE (OF1.4):
5439 bundle_id=0x1 flags=atomic ordered
5440OFPT_FLOW_MOD (OF1.4): ADD table:1 priority=65535,arp,in_port=1,vlan_tci=0x0000/0x1fff,dl_src=50:54:00:00:00:06,dl_dst=50:54:00:00:00:05,arp_spa=192.168.0.2,arp_tpa=192.168.0.1,arp_op=2 actions=output:3
5441send: OFPT_BUNDLE_CONTROL (OF1.4):
5442 bundle_id=0x1 type=CLOSE_REQUEST flags=atomic ordered
5443OFPT_BUNDLE_CONTROL (OF1.4):
5444 bundle_id=0x1 type=CLOSE_REPLY flags=0
5445OFPT_ERROR (OF1.4): OFPBFC_TIMEOUT
5446OFPT_BUNDLE_CONTROL (OF1.4):
5447 bundle_id=0x1 type=OPEN_REQUEST flags=atomic ordered
5448send: OFPT_BUNDLE_CONTROL (OF1.4):
5449 bundle_id=0x1 type=COMMIT_REQUEST flags=atomic ordered
5450OFPT_ERROR (OF1.4): OFPBFC_BAD_ID
5451OFPT_BUNDLE_CONTROL (OF1.4):
5452 bundle_id=0x1 type=COMMIT_REQUEST flags=atomic ordered
5453OFPT_BARRIER_REPLY (OF1.4):
5454])
5455
5456OVS_VSWITCHD_STOP
5457AT_CLEANUP
06d4d4b6
JR
5458
5459
5460AT_SETUP([ofproto - bundle open (OpenFlow 1.3)])
5461AT_KEYWORDS([monitor])
5462OVS_VSWITCHD_START
5463
5464# Start a monitor, use the required protocol version
5465ovs-ofctl -O OpenFlow13 monitor br0 --detach --no-chdir --pidfile >monitor.log 2>&1
5466AT_CAPTURE_FILE([monitor.log])
5467
5468# Send an OpenFlow13 message (04), OFPT_EXPERIMENTER (04), length (0018),
5469# xid (0000000a), ONF_EXPERIMENTER_ID (4F4E4600),
5470# ONFT_BUNDLE_CONTROL (2300 = 0x08FC), bundle id (00000001),
5471# message type (0000), and flags (0002)
5472ovs-appctl -t ovs-ofctl ofctl/send "04 04 00 18 00 00 00 0a 4F 4E 46 00 00 00 08 FC 00 00 00 01 00 00 00 02"
5473ovs-appctl -t ovs-ofctl ofctl/barrier
d9c8c57c 5474OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
06d4d4b6
JR
5475
5476AT_CHECK([ofctl_strip < monitor.log], [], [dnl
5477send: ONFT_BUNDLE_CONTROL (OF1.3):
5478 bundle_id=0x1 type=OPEN_REQUEST flags=ordered
5479ONFT_BUNDLE_CONTROL (OF1.3):
5480 bundle_id=0x1 type=OPEN_REPLY flags=0
5481OFPT_BARRIER_REPLY (OF1.3):
5482])
5483
5484OVS_VSWITCHD_STOP
5485AT_CLEANUP
5486
5487AT_SETUP([ofproto - bundle double open (OpenFlow 1.3)])
5488AT_KEYWORDS([monitor])
5489OVS_VSWITCHD_START
5490
5491# Start a monitor, use the required protocol version
5492ovs-ofctl -O OpenFlow13 monitor br0 --detach --no-chdir --pidfile >monitor.log 2>&1
5493AT_CAPTURE_FILE([monitor.log])
5494
5495# Send twice an OpenFlow13 message (04), OFPT_EXPERIMENTER (04), length (0018),
5496# xid (0000000a), ONF_EXPERIMENTER_ID (4F4E4600),
5497# ONFT_BUNDLE_CONTROL (2300 = 0x08FC), bundle id (00000001),
5498# message type (0000), and flags (0002)
5499ovs-appctl -t ovs-ofctl ofctl/send "04 04 00 18 00 00 00 0a 4F 4E 46 00 00 00 08 FC 00 00 00 01 00 00 00 02"
5500ovs-appctl -t ovs-ofctl ofctl/barrier
5501ovs-appctl -t ovs-ofctl ofctl/send "04 04 00 18 00 00 00 0a 4F 4E 46 00 00 00 08 FC 00 00 00 01 00 00 00 02"
5502ovs-appctl -t ovs-ofctl ofctl/barrier
d9c8c57c 5503OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
06d4d4b6
JR
5504
5505AT_CHECK([ofctl_strip < monitor.log], [0], [dnl
5506send: ONFT_BUNDLE_CONTROL (OF1.3):
5507 bundle_id=0x1 type=OPEN_REQUEST flags=ordered
5508ONFT_BUNDLE_CONTROL (OF1.3):
5509 bundle_id=0x1 type=OPEN_REPLY flags=0
5510OFPT_BARRIER_REPLY (OF1.3):
5511send: ONFT_BUNDLE_CONTROL (OF1.3):
5512 bundle_id=0x1 type=OPEN_REQUEST flags=ordered
5513OFPT_ERROR (OF1.3): OFPBFC_BAD_ID
5514ONFT_BUNDLE_CONTROL (OF1.3):
5515 bundle_id=0x1 type=OPEN_REQUEST flags=ordered
5516OFPT_BARRIER_REPLY (OF1.3):
5517])
5518
5519OVS_VSWITCHD_STOP
5520AT_CLEANUP
5521
5522AT_SETUP([ofproto - bundle close without open (OpenFlow 1.3)])
5523AT_KEYWORDS([monitor])
5524OVS_VSWITCHD_START
5525
5526# Start a monitor, use the required protocol version
5527ovs-ofctl -O OpenFlow13 monitor br0 --detach --no-chdir --pidfile >monitor.log 2>&1
5528AT_CAPTURE_FILE([monitor.log])
5529
5530ovs-appctl -t ovs-ofctl ofctl/send "04 04 00 18 00 00 00 0a 4F 4E 46 00 00 00 08 FC 00 00 00 01 00 02 00 02"
5531ovs-appctl -t ovs-ofctl ofctl/barrier
d9c8c57c 5532OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
06d4d4b6
JR
5533
5534AT_CHECK([ofctl_strip < monitor.log], [0], [dnl
5535send: ONFT_BUNDLE_CONTROL (OF1.3):
5536 bundle_id=0x1 type=CLOSE_REQUEST flags=ordered
5537OFPT_ERROR (OF1.3): OFPBFC_BAD_ID
5538ONFT_BUNDLE_CONTROL (OF1.3):
5539 bundle_id=0x1 type=CLOSE_REQUEST flags=ordered
5540OFPT_BARRIER_REPLY (OF1.3):
5541])
5542
5543OVS_VSWITCHD_STOP
5544AT_CLEANUP
5545
5546AT_SETUP([ofproto - bundle double close (OpenFlow 1.3)])
5547AT_KEYWORDS([monitor])
5548OVS_VSWITCHD_START
5549
5550# Start a monitor, use the required protocol version
5551ovs-ofctl -O OpenFlow13 monitor br0 --detach --no-chdir --pidfile >monitor.log 2>&1
5552AT_CAPTURE_FILE([monitor.log])
5553
5554# Open, Close, Close
5555ovs-appctl -t ovs-ofctl ofctl/send "04 04 00 18 00 00 00 0a 4F 4E 46 00 00 00 08 FC 00 00 00 01 00 00 00 02"
5556ovs-appctl -t ovs-ofctl ofctl/barrier
5557ovs-appctl -t ovs-ofctl ofctl/send "04 04 00 18 00 00 00 0a 4F 4E 46 00 00 00 08 FC 00 00 00 01 00 02 00 02"
5558ovs-appctl -t ovs-ofctl ofctl/barrier
5559ovs-appctl -t ovs-ofctl ofctl/send "04 04 00 18 00 00 00 0a 4F 4E 46 00 00 00 08 FC 00 00 00 01 00 02 00 02"
5560ovs-appctl -t ovs-ofctl ofctl/barrier
d9c8c57c 5561OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
06d4d4b6
JR
5562
5563AT_CHECK([ofctl_strip < monitor.log], [0], [dnl
5564send: ONFT_BUNDLE_CONTROL (OF1.3):
5565 bundle_id=0x1 type=OPEN_REQUEST flags=ordered
5566ONFT_BUNDLE_CONTROL (OF1.3):
5567 bundle_id=0x1 type=OPEN_REPLY flags=0
5568OFPT_BARRIER_REPLY (OF1.3):
5569send: ONFT_BUNDLE_CONTROL (OF1.3):
5570 bundle_id=0x1 type=CLOSE_REQUEST flags=ordered
5571ONFT_BUNDLE_CONTROL (OF1.3):
5572 bundle_id=0x1 type=CLOSE_REPLY flags=0
5573OFPT_BARRIER_REPLY (OF1.3):
5574send: ONFT_BUNDLE_CONTROL (OF1.3):
5575 bundle_id=0x1 type=CLOSE_REQUEST flags=ordered
5576OFPT_ERROR (OF1.3): OFPBFC_BUNDLE_CLOSED
5577ONFT_BUNDLE_CONTROL (OF1.3):
5578 bundle_id=0x1 type=CLOSE_REQUEST flags=ordered
5579OFPT_BARRIER_REPLY (OF1.3):
5580])
5581
5582OVS_VSWITCHD_STOP
5583AT_CLEANUP
5584
5585AT_SETUP([ofproto - bundle close, different flags (OpenFlow 1.3)])
5586AT_KEYWORDS([monitor])
5587OVS_VSWITCHD_START
5588
5589# Start a monitor, use the required protocol version
5590ovs-ofctl -O OpenFlow13 monitor br0 --detach --no-chdir --pidfile >monitor.log 2>&1
5591AT_CAPTURE_FILE([monitor.log])
5592
5593# Open, Close
5594ovs-appctl -t ovs-ofctl ofctl/send "04 04 00 18 00 00 00 0a 4F 4E 46 00 00 00 08 FC 00 00 00 01 00 00 00 02"
5595ovs-appctl -t ovs-ofctl ofctl/barrier
5596ovs-appctl -t ovs-ofctl ofctl/send "04 04 00 18 00 00 00 0a 4F 4E 46 00 00 00 08 FC 00 00 00 01 00 02 00 01"
5597ovs-appctl -t ovs-ofctl ofctl/barrier
d9c8c57c 5598OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
06d4d4b6
JR
5599
5600AT_CHECK([ofctl_strip < monitor.log], [0], [dnl
5601send: ONFT_BUNDLE_CONTROL (OF1.3):
5602 bundle_id=0x1 type=OPEN_REQUEST flags=ordered
5603ONFT_BUNDLE_CONTROL (OF1.3):
5604 bundle_id=0x1 type=OPEN_REPLY flags=0
5605OFPT_BARRIER_REPLY (OF1.3):
5606send: ONFT_BUNDLE_CONTROL (OF1.3):
5607 bundle_id=0x1 type=CLOSE_REQUEST flags=atomic
5608OFPT_ERROR (OF1.3): OFPBFC_BAD_FLAGS
5609ONFT_BUNDLE_CONTROL (OF1.3):
5610 bundle_id=0x1 type=CLOSE_REQUEST flags=atomic
5611OFPT_BARRIER_REPLY (OF1.3):
5612])
5613
5614OVS_VSWITCHD_STOP
5615AT_CLEANUP
5616
5617AT_SETUP([ofproto - bundle commit without open (OpenFlow 1.3)])
5618AT_KEYWORDS([monitor])
5619OVS_VSWITCHD_START
5620
5621# Start a monitor, use the required protocol version
5622ovs-ofctl -O OpenFlow13 monitor br0 --detach --no-chdir --pidfile >monitor.log 2>&1
5623AT_CAPTURE_FILE([monitor.log])
5624
5625# Commit
5626ovs-appctl -t ovs-ofctl ofctl/send "04 04 00 18 00 00 00 0a 4F 4E 46 00 00 00 08 FC 00 00 00 01 00 04 00 02"
5627ovs-appctl -t ovs-ofctl ofctl/barrier
d9c8c57c 5628OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
06d4d4b6
JR
5629
5630AT_CHECK([ofctl_strip < monitor.log], [0], [dnl
5631send: ONFT_BUNDLE_CONTROL (OF1.3):
5632 bundle_id=0x1 type=COMMIT_REQUEST flags=ordered
5633OFPT_ERROR (OF1.3): OFPBFC_BAD_ID
5634ONFT_BUNDLE_CONTROL (OF1.3):
5635 bundle_id=0x1 type=COMMIT_REQUEST flags=ordered
5636OFPT_BARRIER_REPLY (OF1.3):
5637])
5638
5639OVS_VSWITCHD_STOP
5640AT_CLEANUP
5641
5642AT_SETUP([ofproto - bundle commit, different flags (OpenFlow 1.3)])
5643AT_KEYWORDS([monitor])
5644OVS_VSWITCHD_START
5645
5646# Start a monitor, use the required protocol version
5647ovs-ofctl -O OpenFlow13 monitor br0 --detach --no-chdir --pidfile >monitor.log 2>&1
5648AT_CAPTURE_FILE([monitor.log])
5649
5650# Open, Commit
5651ovs-appctl -t ovs-ofctl ofctl/send "04 04 00 18 00 00 00 0a 4F 4E 46 00 00 00 08 FC 00 00 00 01 00 00 00 02"
5652ovs-appctl -t ovs-ofctl ofctl/barrier
5653ovs-appctl -t ovs-ofctl ofctl/send "04 04 00 18 00 00 00 0a 4F 4E 46 00 00 00 08 FC 00 00 00 01 00 04 00 01"
5654ovs-appctl -t ovs-ofctl ofctl/barrier
d9c8c57c 5655OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
06d4d4b6
JR
5656
5657AT_CHECK([ofctl_strip < monitor.log], [0], [dnl
5658send: ONFT_BUNDLE_CONTROL (OF1.3):
5659 bundle_id=0x1 type=OPEN_REQUEST flags=ordered
5660ONFT_BUNDLE_CONTROL (OF1.3):
5661 bundle_id=0x1 type=OPEN_REPLY flags=0
5662OFPT_BARRIER_REPLY (OF1.3):
5663send: ONFT_BUNDLE_CONTROL (OF1.3):
5664 bundle_id=0x1 type=COMMIT_REQUEST flags=atomic
5665OFPT_ERROR (OF1.3): OFPBFC_BAD_FLAGS
5666ONFT_BUNDLE_CONTROL (OF1.3):
5667 bundle_id=0x1 type=COMMIT_REQUEST flags=atomic
5668OFPT_BARRIER_REPLY (OF1.3):
5669])
5670
5671OVS_VSWITCHD_STOP
5672AT_CLEANUP
5673
5674AT_SETUP([ofproto - bundle discard without open (OpenFlow 1.3)])
5675AT_KEYWORDS([monitor])
5676OVS_VSWITCHD_START
5677
5678# Start a monitor, use the required protocol version
5679ovs-ofctl -O OpenFlow13 monitor br0 --detach --no-chdir --pidfile >monitor.log 2>&1
5680AT_CAPTURE_FILE([monitor.log])
5681
5682# Discard
5683ovs-appctl -t ovs-ofctl ofctl/send "04 04 00 18 00 00 00 0a 4F 4E 46 00 00 00 08 FC 00 00 00 01 00 06 00 02"
5684ovs-appctl -t ovs-ofctl ofctl/barrier
d9c8c57c 5685OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
06d4d4b6
JR
5686
5687AT_CHECK([ofctl_strip < monitor.log], [0], [dnl
5688send: ONFT_BUNDLE_CONTROL (OF1.3):
5689 bundle_id=0x1 type=DISCARD_REQUEST flags=ordered
5690OFPT_ERROR (OF1.3): OFPBFC_BAD_ID
5691ONFT_BUNDLE_CONTROL (OF1.3):
5692 bundle_id=0x1 type=DISCARD_REQUEST flags=ordered
5693OFPT_BARRIER_REPLY (OF1.3):
5694])
5695
5696OVS_VSWITCHD_STOP
5697AT_CLEANUP
5698
5699
5700AT_SETUP([ofproto - bundle with multiple flow mods (OpenFlow 1.3)])
06d4d4b6
JR
5701OVS_VSWITCHD_START
5702
5703AT_CHECK([ovs-appctl vlog/set vconn:dbg])
5704
50f96b10 5705AT_CHECK([ovs-ofctl --no-names del-flows br0])
06d4d4b6
JR
5706
5707AT_DATA([flows.txt], [dnl
5708add idle_timeout=50 in_port=2 dl_src=00:66:77:88:99:aa actions=1
5709add idle_timeout=60 in_port=2 dl_src=00:77:88:99:aa:bb actions=2
5710add idle_timeout=70 in_port=2 dl_src=00:88:99:aa:bb:cc actions=3
5711add idle_timeout=50 in_port=2 dl_src=00:66:77:88:99:aa actions=4
5712delete
5713add idle_timeout=50 in_port=2 dl_src=00:66:77:88:99:aa actions=5
5714add idle_timeout=60 in_port=2 dl_src=00:77:88:99:aa:bb actions=6
5715add idle_timeout=70 in_port=2 dl_src=00:88:99:aa:bb:cc actions=7
5716delete in_port=2 dl_src=00:88:99:aa:bb:cc
5717])
5718
50f96b10 5719AT_CHECK([ovs-ofctl -O OpenFlow13 --no-names --bundle add-flows br0 flows.txt])
06d4d4b6
JR
5720
5721AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
5722 idle_timeout=50, in_port=2,dl_src=00:66:77:88:99:aa actions=output:5
5723 idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=output:6
5724NXST_FLOW reply:
5725])
5726
5727AT_DATA([flows.txt], [dnl
5728modify actions=drop
5729modify_strict in_port=2 dl_src=00:77:88:99:aa:bb actions=7
5730])
5731
50f96b10 5732AT_CHECK([ovs-ofctl -O OpenFlow13 --no-names --bundle add-flows br0 flows.txt])
06d4d4b6
JR
5733
5734AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
5735 idle_timeout=50, in_port=2,dl_src=00:66:77:88:99:aa actions=drop
5736 idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=output:7
5737NXST_FLOW reply:
5738])
5739
5740# Adding an existing flow acts as a modify, and delete_strict also works.
5741AT_DATA([flows.txt], [dnl
5742add idle_timeout=60 in_port=2 dl_src=00:77:88:99:aa:bb actions=8
5743delete_strict in_port=2 dl_src=00:66:77:88:99:aa
5744add in_port=2 dl_src=00:66:77:88:99:aa actions=drop
5745])
5746
50f96b10 5747AT_CHECK([ovs-ofctl -O OpenFlow13 --bundle --no-names add-flows br0 flows.txt])
06d4d4b6
JR
5748
5749AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
5750 idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=output:8
5751 in_port=2,dl_src=00:66:77:88:99:aa actions=drop
5752NXST_FLOW reply:
5753])
5754
5755dnl Check logs for OpenFlow trace
5756# Prevent race.
5757OVS_WAIT_UNTIL([vconn_sub < ovs-vswitchd.log | test `grep -- "|vconn|DBG|unix: sent (Success): NXST_FLOW reply" | wc -l` -ge 3])
5758AT_CHECK([print_vconn_debug | vconn_sub | ofctl_strip], [0], [dnl
b79d45a1
BP
5759vconn|DBG|unix: sent (Success): OFPT_HELLO (OF1.6):
5760 version bitmap: 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07
06d4d4b6
JR
5761vconn|DBG|unix: received: OFPT_HELLO:
5762 version bitmap: 0x01
b79d45a1 5763vconn|DBG|unix: negotiated OpenFlow version 0x01 (we support version 0x07 and earlier, peer supports version 0x01)
06d4d4b6
JR
5764vconn|DBG|unix: received: OFPT_FLOW_MOD: DEL actions=drop
5765vconn|DBG|unix: received: OFPT_BARRIER_REQUEST:
5766vconn|DBG|unix: sent (Success): OFPT_BARRIER_REPLY:
b79d45a1
BP
5767vconn|DBG|unix: sent (Success): OFPT_HELLO (OF1.6):
5768 version bitmap: 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07
06d4d4b6
JR
5769vconn|DBG|unix: received: OFPT_HELLO (OF1.3):
5770 version bitmap: 0x04
b79d45a1 5771vconn|DBG|unix: negotiated OpenFlow version 0x04 (we support version 0x07 and earlier, peer supports version 0x04)
06d4d4b6
JR
5772vconn|DBG|unix: received: ONFT_BUNDLE_CONTROL (OF1.3):
5773 bundle_id=0 type=OPEN_REQUEST flags=atomic ordered
5774vconn|DBG|unix: sent (Success): ONFT_BUNDLE_CONTROL (OF1.3):
5775 bundle_id=0 type=OPEN_REPLY flags=0
5776vconn|DBG|unix: received: ONFT_BUNDLE_ADD_MESSAGE (OF1.3):
5777 bundle_id=0 flags=atomic ordered
5778OFPT_FLOW_MOD (OF1.3): ADD in_port=2,dl_src=00:66:77:88:99:aa idle:50 actions=output:1
5779vconn|DBG|unix: received: ONFT_BUNDLE_ADD_MESSAGE (OF1.3):
5780 bundle_id=0 flags=atomic ordered
5781OFPT_FLOW_MOD (OF1.3): ADD in_port=2,dl_src=00:77:88:99:aa:bb idle:60 actions=output:2
5782vconn|DBG|unix: received: ONFT_BUNDLE_ADD_MESSAGE (OF1.3):
5783 bundle_id=0 flags=atomic ordered
5784OFPT_FLOW_MOD (OF1.3): ADD in_port=2,dl_src=00:88:99:aa:bb:cc idle:70 actions=output:3
5785vconn|DBG|unix: received: ONFT_BUNDLE_ADD_MESSAGE (OF1.3):
5786 bundle_id=0 flags=atomic ordered
5787OFPT_FLOW_MOD (OF1.3): ADD in_port=2,dl_src=00:66:77:88:99:aa idle:50 actions=output:4
5788vconn|DBG|unix: received: ONFT_BUNDLE_ADD_MESSAGE (OF1.3):
5789 bundle_id=0 flags=atomic ordered
5790OFPT_FLOW_MOD (OF1.3): DEL table:255 actions=drop
5791vconn|DBG|unix: received: ONFT_BUNDLE_ADD_MESSAGE (OF1.3):
5792 bundle_id=0 flags=atomic ordered
5793OFPT_FLOW_MOD (OF1.3): ADD in_port=2,dl_src=00:66:77:88:99:aa idle:50 actions=output:5
5794vconn|DBG|unix: received: ONFT_BUNDLE_ADD_MESSAGE (OF1.3):
5795 bundle_id=0 flags=atomic ordered
5796OFPT_FLOW_MOD (OF1.3): ADD in_port=2,dl_src=00:77:88:99:aa:bb idle:60 actions=output:6
5797vconn|DBG|unix: received: ONFT_BUNDLE_ADD_MESSAGE (OF1.3):
5798 bundle_id=0 flags=atomic ordered
5799OFPT_FLOW_MOD (OF1.3): ADD in_port=2,dl_src=00:88:99:aa:bb:cc idle:70 actions=output:7
5800vconn|DBG|unix: received: ONFT_BUNDLE_ADD_MESSAGE (OF1.3):
5801 bundle_id=0 flags=atomic ordered
5802OFPT_FLOW_MOD (OF1.3): DEL table:255 in_port=2,dl_src=00:88:99:aa:bb:cc actions=drop
506c1ddb
JR
5803vconn|DBG|unix: received: OFPT_BARRIER_REQUEST (OF1.3):
5804vconn|DBG|unix: sent (Success): OFPT_BARRIER_REPLY (OF1.3):
06d4d4b6
JR
5805vconn|DBG|unix: received: ONFT_BUNDLE_CONTROL (OF1.3):
5806 bundle_id=0 type=COMMIT_REQUEST flags=atomic ordered
5807vconn|DBG|unix: sent (Success): ONFT_BUNDLE_CONTROL (OF1.3):
5808 bundle_id=0 type=COMMIT_REPLY flags=0
b79d45a1
BP
5809vconn|DBG|unix: sent (Success): OFPT_HELLO (OF1.6):
5810 version bitmap: 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07
06d4d4b6
JR
5811vconn|DBG|unix: received: OFPT_HELLO:
5812 version bitmap: 0x01
b79d45a1 5813vconn|DBG|unix: negotiated OpenFlow version 0x01 (we support version 0x07 and earlier, peer supports version 0x01)
06d4d4b6
JR
5814vconn|DBG|unix: received: NXT_SET_FLOW_FORMAT: format=nxm
5815vconn|DBG|unix: received: OFPT_BARRIER_REQUEST:
5816vconn|DBG|unix: sent (Success): OFPT_BARRIER_REPLY:
5817vconn|DBG|unix: received: NXST_FLOW request:
5818vconn|DBG|unix: sent (Success): NXST_FLOW reply:
5819 idle_timeout=50, in_port=2,dl_src=00:66:77:88:99:aa actions=output:5
5820 idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=output:6
b79d45a1
BP
5821vconn|DBG|unix: sent (Success): OFPT_HELLO (OF1.6):
5822 version bitmap: 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07
06d4d4b6
JR
5823vconn|DBG|unix: received: OFPT_HELLO (OF1.3):
5824 version bitmap: 0x04
b79d45a1 5825vconn|DBG|unix: negotiated OpenFlow version 0x04 (we support version 0x07 and earlier, peer supports version 0x04)
06d4d4b6
JR
5826vconn|DBG|unix: received: ONFT_BUNDLE_CONTROL (OF1.3):
5827 bundle_id=0 type=OPEN_REQUEST flags=atomic ordered
5828vconn|DBG|unix: sent (Success): ONFT_BUNDLE_CONTROL (OF1.3):
5829 bundle_id=0 type=OPEN_REPLY flags=0
5830vconn|DBG|unix: received: ONFT_BUNDLE_ADD_MESSAGE (OF1.3):
5831 bundle_id=0 flags=atomic ordered
5832OFPT_FLOW_MOD (OF1.3): MOD actions=drop
5833vconn|DBG|unix: received: ONFT_BUNDLE_ADD_MESSAGE (OF1.3):
5834 bundle_id=0 flags=atomic ordered
5835OFPT_FLOW_MOD (OF1.3): MOD_STRICT in_port=2,dl_src=00:77:88:99:aa:bb actions=output:7
506c1ddb
JR
5836vconn|DBG|unix: received: OFPT_BARRIER_REQUEST (OF1.3):
5837vconn|DBG|unix: sent (Success): OFPT_BARRIER_REPLY (OF1.3):
06d4d4b6
JR
5838vconn|DBG|unix: received: ONFT_BUNDLE_CONTROL (OF1.3):
5839 bundle_id=0 type=COMMIT_REQUEST flags=atomic ordered
5840vconn|DBG|unix: sent (Success): ONFT_BUNDLE_CONTROL (OF1.3):
5841 bundle_id=0 type=COMMIT_REPLY flags=0
b79d45a1
BP
5842vconn|DBG|unix: sent (Success): OFPT_HELLO (OF1.6):
5843 version bitmap: 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07
06d4d4b6
JR
5844vconn|DBG|unix: received: OFPT_HELLO:
5845 version bitmap: 0x01
b79d45a1 5846vconn|DBG|unix: negotiated OpenFlow version 0x01 (we support version 0x07 and earlier, peer supports version 0x01)
06d4d4b6
JR
5847vconn|DBG|unix: received: NXT_SET_FLOW_FORMAT: format=nxm
5848vconn|DBG|unix: received: OFPT_BARRIER_REQUEST:
5849vconn|DBG|unix: sent (Success): OFPT_BARRIER_REPLY:
5850vconn|DBG|unix: received: NXST_FLOW request:
5851vconn|DBG|unix: sent (Success): NXST_FLOW reply:
5852 idle_timeout=50, in_port=2,dl_src=00:66:77:88:99:aa actions=drop
5853 idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=output:7
b79d45a1
BP
5854vconn|DBG|unix: sent (Success): OFPT_HELLO (OF1.6):
5855 version bitmap: 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07
06d4d4b6
JR
5856vconn|DBG|unix: received: OFPT_HELLO (OF1.3):
5857 version bitmap: 0x04
b79d45a1 5858vconn|DBG|unix: negotiated OpenFlow version 0x04 (we support version 0x07 and earlier, peer supports version 0x04)
06d4d4b6
JR
5859vconn|DBG|unix: received: ONFT_BUNDLE_CONTROL (OF1.3):
5860 bundle_id=0 type=OPEN_REQUEST flags=atomic ordered
5861vconn|DBG|unix: sent (Success): ONFT_BUNDLE_CONTROL (OF1.3):
5862 bundle_id=0 type=OPEN_REPLY flags=0
5863vconn|DBG|unix: received: ONFT_BUNDLE_ADD_MESSAGE (OF1.3):
5864 bundle_id=0 flags=atomic ordered
5865OFPT_FLOW_MOD (OF1.3): ADD in_port=2,dl_src=00:77:88:99:aa:bb idle:60 actions=output:8
5866vconn|DBG|unix: received: ONFT_BUNDLE_ADD_MESSAGE (OF1.3):
5867 bundle_id=0 flags=atomic ordered
5868OFPT_FLOW_MOD (OF1.3): DEL_STRICT table:255 in_port=2,dl_src=00:66:77:88:99:aa actions=drop
5869vconn|DBG|unix: received: ONFT_BUNDLE_ADD_MESSAGE (OF1.3):
5870 bundle_id=0 flags=atomic ordered
5871OFPT_FLOW_MOD (OF1.3): ADD in_port=2,dl_src=00:66:77:88:99:aa actions=drop
506c1ddb
JR
5872vconn|DBG|unix: received: OFPT_BARRIER_REQUEST (OF1.3):
5873vconn|DBG|unix: sent (Success): OFPT_BARRIER_REPLY (OF1.3):
06d4d4b6
JR
5874vconn|DBG|unix: received: ONFT_BUNDLE_CONTROL (OF1.3):
5875 bundle_id=0 type=COMMIT_REQUEST flags=atomic ordered
5876vconn|DBG|unix: sent (Success): ONFT_BUNDLE_CONTROL (OF1.3):
5877 bundle_id=0 type=COMMIT_REPLY flags=0
b79d45a1
BP
5878vconn|DBG|unix: sent (Success): OFPT_HELLO (OF1.6):
5879 version bitmap: 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07
06d4d4b6
JR
5880vconn|DBG|unix: received: OFPT_HELLO:
5881 version bitmap: 0x01
b79d45a1 5882vconn|DBG|unix: negotiated OpenFlow version 0x01 (we support version 0x07 and earlier, peer supports version 0x01)
06d4d4b6
JR
5883vconn|DBG|unix: received: NXT_SET_FLOW_FORMAT: format=nxm
5884vconn|DBG|unix: received: OFPT_BARRIER_REQUEST:
5885vconn|DBG|unix: sent (Success): OFPT_BARRIER_REPLY:
5886vconn|DBG|unix: received: NXST_FLOW request:
5887vconn|DBG|unix: sent (Success): NXST_FLOW reply:
5888 idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=output:8
5889 in_port=2,dl_src=00:66:77:88:99:aa actions=drop
5890])
5891
5892OVS_VSWITCHD_STOP
5893AT_CLEANUP
5894
5895
506c1ddb 5896AT_SETUP([ofproto - failing bundle add message (OpenFlow 1.3)])
06d4d4b6
JR
5897OVS_VSWITCHD_START
5898
5899AT_CHECK([ovs-ofctl del-flows br0])
5900
5901ovs-ofctl add-flows br0 - <<EOF
5902idle_timeout=50 in_port=2 dl_src=00:66:77:88:99:aa actions=11
5903idle_timeout=60 in_port=2 dl_src=00:77:88:99:aa:bb actions=22
5904idle_timeout=70 in_port=2 dl_src=00:88:99:aa:bb:cc actions=33
5905EOF
5906AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
5907 idle_timeout=50, in_port=2,dl_src=00:66:77:88:99:aa actions=output:11
5908 idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=output:22
5909 idle_timeout=70, in_port=2,dl_src=00:88:99:aa:bb:cc actions=output:33
5910NXST_FLOW reply:
5911])
5912
5913# last line uses illegal table number (OVS internal table)
5914AT_DATA([flows.txt], [dnl
5915add idle_timeout=50 in_port=2 dl_src=00:66:77:88:99:aa actions=1
5916add idle_timeout=60 in_port=2 dl_src=00:77:88:99:aa:bb actions=2
5917add idle_timeout=70 in_port=2 dl_src=00:88:99:aa:bb:cc actions=3
5918modify idle_timeout=50 in_port=2 dl_src=00:66:77:88:99:aa actions=4
5919delete
5920add idle_timeout=50 in_port=2 dl_src=00:66:77:88:99:aa actions=5
5921add idle_timeout=60 in_port=2 dl_src=00:77:88:99:aa:bb actions=6
5922add idle_timeout=70 in_port=2 dl_src=00:88:99:aa:bb:cc actions=7
5923delete in_port=2 dl_src=00:88:99:aa:bb:cc
5924add table=254 actions=drop
5925])
5926
50f96b10 5927AT_CHECK([ovs-ofctl -O OpenFlow13 --bundle add-flows br0 flows.txt 2>&1 | sed '/talking to/,$d' | strip_xids],
06d4d4b6 5928[0], [dnl
50f96b10 5929Error OFPBRC_EPERM for: OFPT_FLOW_MOD (OF1.3): ADD table:254 actions=drop
06d4d4b6
JR
5930])
5931
5932AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
5933 idle_timeout=50, in_port=2,dl_src=00:66:77:88:99:aa actions=output:11
5934 idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=output:22
5935 idle_timeout=70, in_port=2,dl_src=00:88:99:aa:bb:cc actions=output:33
5936NXST_FLOW reply:
5937])
5938
5939OVS_VSWITCHD_STOP
5940AT_CLEANUP
25070e04
JR
5941
5942
5943AT_SETUP([ofproto - failing bundle commit (OpenFlow 1.3)])
25070e04
JR
5944OVS_VSWITCHD_START
5945
5946AT_CHECK([ovs-ofctl del-flows br0])
5947
5948# Invalid group numbers are detected at commit time
5949AT_DATA([flows.txt], [dnl
5950add idle_timeout=50 in_port=2 dl_src=00:66:77:88:99:aa actions=group:1
5951add idle_timeout=60 in_port=2 dl_src=00:77:88:99:aa:bb actions=group:2
5952add idle_timeout=70 in_port=2 dl_src=00:88:99:aa:bb:cc actions=group:3
5953])
5954
50f96b10 5955AT_CHECK([ovs-ofctl -O OpenFlow13 --bundle add-flows br0 flows.txt 2>&1 | sed '/talking to/,$d' | strip_xids],
25070e04 5956[0], [dnl
50f96b10
BP
5957Error OFPBAC_BAD_OUT_GROUP for: OFPT_FLOW_MOD (OF1.3): ADD in_port=2,dl_src=00:66:77:88:99:aa idle:50 actions=group:1
5958Error OFPBFC_MSG_FAILED for: ONFT_BUNDLE_CONTROL (OF1.3):
25070e04
JR
5959 bundle_id=0 type=COMMIT_REQUEST flags=atomic ordered
5960])
5961
5962AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
5963NXST_FLOW reply:
5964])
5965
5966OVS_VSWITCHD_STOP
5967AT_CLEANUP
140f36ba
DDP
5968
5969AT_SETUP([ofproto - monitor flows with tun_md])
5970OVS_VSWITCHD_START
5971
5972AT_CHECK([ovs-ofctl add-tlv-map br0 "{class=0xffff,type=0,len=4}->tun_metadata0"])
5973AT_CHECK([ovs-ofctl add-flow br0 tun_metadata0=0x1,actions=drop])
5974
5975AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip], [0], [dnl
5976NXST_FLOW reply:
5977 tun_metadata0=0x1 actions=drop
5978])
5979
5980AT_CAPTURE_FILE([ofctl_monitor.log])
5981dnl Usually ovs-ofctl monitor outputs on stderr, but the first message here
5982dnl is put on stdout, because it is handled by ofctl in dump_transaction()
5983dnl and not in monitor_vconn().
5984AT_CHECK([ovs-ofctl monitor br0 65534 watch: --detach --no-chdir --pidfile >ofctl_monitor.log 2>&1])
5985
5986OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 2])
5987
5988AT_CHECK([cat ofctl_monitor.log | ofctl_strip], [0], [dnl
5989NXST_FLOW_MONITOR reply:
5990 event=ADDED table=0 cookie=0 tun_metadata0=0x1
5991])
5992
5993AT_CHECK([ovs-ofctl del-flows br0])
5994
5995OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 4])
5996
5997AT_CHECK([cat ofctl_monitor.log | ofctl_strip], [0], [dnl
5998NXST_FLOW_MONITOR reply:
5999 event=ADDED table=0 cookie=0 tun_metadata0=0x1
6000NXST_FLOW_MONITOR reply:
6001 event=DELETED reason=delete table=0 cookie=0 tun_metadata0=0x1
6002])
6003
6004OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
6005
6006dnl Check that vswitchd hasn't crashed
6007AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip], [0], [dnl
6008NXST_FLOW reply:
6009])
6010
6011OVS_VSWITCHD_STOP
6012AT_CLEANUP
04f48a68
YHW
6013
6014AT_SETUP([ofproto - flow mod with tunnel metadata])
6015AT_KEYWORDS([ofp-actions])
6016OVS_VSWITCHD_START
6017
6018AT_CHECK([ovs-ofctl add-tlv-map br0 "{class=0xffff,type=0,len=4}->tun_metadata0"])
6019AT_CHECK([ovs-ofctl add-flow br0 "in_port=1 actions=move:tun_metadata0[[0..31]]->NXM_NX_REG0[[]]"])
6020
6021dnl Check the length of tun_metadata0 in the replied OXM header.
6022dnl Ignore the first 0x50 bytes of hex dump from the reply msg since the NXM
6023dnl header that describes the tunnel metadata starts at offset 0x50.
6024AT_CHECK([ovs-ofctl dump-flows br0 -mmmm], [0], [stdout])
50f96b10
BP
6025AT_CHECK([sed -e 's/duration=[[0-9.]]*s/duration=?s/' -e 's/idle_age=[[0-9]]*/idle_age=?/' -e '/^000000[[0-4]]0 / d' stdout | strip_xids], [0], [dnl
6026NXST_FLOW reply:
04f48a68
YHW
6027 cookie=0x0, duration=?s, table=0, n_packets=0, n_bytes=0, idle_age=?, in_port=1 actions=move:NXM_NX_TUN_METADATA0[[0..31]]->NXM_NX_REG0[[]]
602800000050 ff ff 00 18 00 00 23 20-00 06 00 20 00 00 00 00 |......# ... ....|
602900000060 00 01 50 04 00 01 00 04- |..P..... |
6030])
6031
6032dnl Check actions that may use tun_metadata
6033AT_CHECK([ovs-ofctl add-flow br0 "in_port=2 actions=move:tun_metadata1[[0..31]]->NXM_NX_REG0[[]]"], [1], [], [stderr])
6034AT_CHECK([strip_xids < stderr | sed '/FLOW_MOD/,$d'], [0], [dnl
6035OFPT_ERROR: NXFMFC_INVALID_TLV_FIELD
6036])
6037
6038AT_CHECK([ovs-ofctl add-flow br0 "in_port=2 actions=move:tun_metadata0[[32..63]]->NXM_NX_REG0[[]]"], [1], [], [stderr])
6039AT_CHECK([strip_xids < stderr | sed '/FLOW_MOD/,$d'], [0], [dnl
6040OFPT_ERROR: OFPBAC_BAD_SET_LEN
6041])
6042
6043AT_CHECK([ovs-ofctl add-flow br0 "in_port=2 actions=push:tun_metadata1[[0..31]]"], [1], [], [stderr])
6044AT_CHECK([strip_xids < stderr | sed '/FLOW_MOD/,$d'], [0], [dnl
6045OFPT_ERROR: NXFMFC_INVALID_TLV_FIELD
6046])
6047
6048AT_CHECK([ovs-ofctl add-flow br0 "in_port=2 actions=pop:tun_metadata0[[32..63]]"], [1], [], [stderr])
6049AT_CHECK([strip_xids < stderr | sed '/FLOW_MOD/,$d'], [0], [dnl
6050OFPT_ERROR: OFPBAC_BAD_SET_LEN
6051])
6052
6053AT_CHECK([ovs-ofctl add-flow br0 "in_port=3, actions=load:0x11223344->tun_metadata1"], [1], [], [stderr])
6054AT_CHECK([strip_xids < stderr | sed '/FLOW_MOD/,$d'], [0], [dnl
6055OFPT_ERROR: NXFMFC_INVALID_TLV_FIELD
6056])
6057
6058AT_CHECK([ovs-ofctl add-flow br0 "in_port=2 actions=output:tun_metadata1[[0..31]]"], [1], [], [stderr])
6059AT_CHECK([strip_xids < stderr | sed '/FLOW_MOD/,$d'], [0], [dnl
6060OFPT_ERROR: NXFMFC_INVALID_TLV_FIELD
6061])
6062
6063AT_CHECK([ovs-ofctl add-flow br0 "in_port=2 actions=output:tun_metadata0[[32..63]]"], [1], [], [stderr])
6064AT_CHECK([strip_xids < stderr | sed '/FLOW_MOD/,$d'], [0], [dnl
6065OFPT_ERROR: OFPBAC_BAD_SET_LEN
6066])
6067
6068AT_CHECK([ovs-ofctl add-flow br0 "in_port=2 actions=multipath(eth_src,50,modulo_n,1,0,tun_metadata1[[0..31]])"], [1], [], [stderr])
6069AT_CHECK([strip_xids < stderr | sed '/FLOW_MOD/,$d'], [0], [dnl
6070OFPT_ERROR: NXFMFC_INVALID_TLV_FIELD
6071])
6072
6073AT_CHECK([ovs-ofctl add-flow br0 "in_port=2 actions=multipath(eth_src,50,modulo_n,1,0,tun_metadata0[[32..63]])"], [1], [], [stderr])
6074AT_CHECK([strip_xids < stderr | sed '/FLOW_MOD/,$d'], [0], [dnl
6075OFPT_ERROR: OFPBAC_BAD_SET_LEN
6076])
6077
6078AT_CHECK([ovs-ofctl add-flow br0 "in_port=2 actions=bundle_load(eth_src,50,hrw,ofport,tun_metadata1[[0..31]], slaves:4,8)"], [1], [], [stderr])
6079AT_CHECK([strip_xids < stderr | sed '/FLOW_MOD/,$d'], [0], [dnl
6080OFPT_ERROR: NXFMFC_INVALID_TLV_FIELD
6081])
6082
6083AT_CHECK([ovs-ofctl add-flow br0 "in_port=2 actions=bundle_load(eth_src,50,hrw,ofport,tun_metadata0[[32..63]], slaves:4,8)"], [1], [], [stderr])
6084AT_CHECK([strip_xids < stderr | sed '/FLOW_MOD/,$d'], [0], [dnl
6085OFPT_ERROR: OFPBAC_BAD_SET_LEN
6086])
6087
6088AT_CHECK([ovs-ofctl add-flow br0 "in_port=2 actions=learn(tun_metadata1[[0..31]]=reg0[[0..31]])"], [1], [], [stderr])
6089AT_CHECK([strip_xids < stderr | sed '/FLOW_MOD/,$d'], [0], [dnl
6090OFPT_ERROR: NXFMFC_INVALID_TLV_FIELD
6091])
6092
6093AT_CHECK([ovs-ofctl add-flow br0 "in_port=2 actions=learn(tun_metadata0[[32..63]]=reg0[[0..31]])"], [1], [], [stderr])
6094AT_CHECK([strip_xids < stderr | sed '/FLOW_MOD/,$d'], [0], [dnl
6095OFPT_ERROR: OFPBAC_BAD_SET_LEN
6096])
6097
6098AT_CHECK([ovs-ofctl add-flow br0 "in_port=2 actions=clone(move:tun_metadata1[[0..31]]->reg0[[0..31]])"], [1], [], [stderr])
6099AT_CHECK([strip_xids < stderr | sed '/FLOW_MOD/,$d'], [0], [dnl
6100OFPT_ERROR: NXFMFC_INVALID_TLV_FIELD
6101])
6102
6103AT_CHECK([ovs-ofctl add-flow br0 "in_port=2 actions=clone(move:tun_metadata0[[32..63]]->reg0[[0..31]])"], [1], [], [stderr])
6104AT_CHECK([strip_xids < stderr | sed '/FLOW_MOD/,$d'], [0], [dnl
6105OFPT_ERROR: OFPBAC_BAD_SET_LEN
6106])
6107
6108AT_CHECK([ovs-ofctl add-flow br0 "ip actions=ct(commit,zone=tun_metadata1[[0..15]],exec(set_field:0x01->ct_mark))"], [1], [], [stderr])
6109AT_CHECK([strip_xids < stderr | sed '/FLOW_MOD/,$d'], [0], [dnl
6110OFPT_ERROR: NXFMFC_INVALID_TLV_FIELD
6111])
6112
6113AT_CHECK([ovs-ofctl add-flow br0 "ip actions=ct(commit,zone=tun_metadata0[[32..47]],exec(set_field:0x01->ct_mark))"], [1], [], [stderr])
6114AT_CHECK([strip_xids < stderr | sed '/FLOW_MOD/,$d'], [0], [dnl
6115OFPT_ERROR: OFPBAC_BAD_SET_LEN
6116])
6117
6118AT_CHECK([ovs-ofctl add-flow br0 "ip actions=ct(commit,zone=1,exec(move:tun_metadata1[[0..31]]->ct_mark))"], [1], [], [stderr])
6119AT_CHECK([strip_xids < stderr | sed '/FLOW_MOD/,$d'], [0], [dnl
6120OFPT_ERROR: NXFMFC_INVALID_TLV_FIELD
6121])
6122
6123AT_CHECK([ovs-ofctl add-flow br0 "ip actions=ct(commit,zone=1,exec(move:tun_metadata0[[32..63]]->ct_mark))"], [1], [], [stderr])
6124AT_CHECK([strip_xids < stderr | sed '/FLOW_MOD/,$d'], [0], [dnl
6125OFPT_ERROR: OFPBAC_BAD_SET_LEN
6126])
6127
3cddeff0
YHW
6128dnl Check match field with tun_metadata
6129AT_CHECK([ovs-ofctl add-flow br0 "tun_metadata0=0x11223344 actions=output:2"], [0], [], [stderr])
6130AT_CHECK([ovs-ofctl add-flow br0 "tun_metadata1=0x11223344 actions=output:2"], [1], [], [stderr])
6131AT_CHECK([strip_xids < stderr | sed '/FLOW_MOD/,$d'], [0], [dnl
6132OFPT_ERROR: NXFMFC_INVALID_TLV_FIELD
6133])
6134
6135AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip], [0], [dnl)
6136NXST_FLOW reply:
6137 in_port=1 actions=move:NXM_NX_TUN_METADATA0[[0..31]]->NXM_NX_REG0[[]]
6138 tun_metadata0=0x11223344 actions=output:2
04f48a68
YHW
6139])
6140
6141OVS_VSWITCHD_STOP(["/NXFMFC_INVALID_TLV_FIELD/d
6142/tun_metadata0/d
6143/OFPBAC_BAD_SET_LEN/d"])
6144AT_CLEANUP
d3b84833
BP
6145
6146AT_SETUP([ofproto - flush flows, groups, and meters for controller change])
6147AT_KEYWORDS([flow flows group group meter])
6148OVS_VSWITCHD_START
6149
6150add_flow_group_and_meter () {
6151 AT_CHECK([ovs-ofctl add-flow br0 in_port=1,actions=2])
6152 AT_CHECK([ovs-ofctl -O OpenFlow11 add-group br0 group_id=1234,type=all,bucket=output:10
6153 AT_CHECK([ovs-ofctl -O OpenFlow13 add-meter br0 'meter=1 pktps burst stats bands=type=drop rate=1 burst_size=1'])
6154])
6155}
6156
6157verify_added () {
6158 AT_CHECK([ovs-ofctl --no-stats dump-flows br0], [0], [dnl
6159 in_port=1 actions=output:2
6160])
6161 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-groups br0], [0], [dnl
6162OFPST_GROUP_DESC reply (OF1.1) (xid=0x2):
6163 group_id=1234,type=all,bucket=actions=output:10
6164])
6165 AT_CHECK([ovs-ofctl -O OpenFlow13 dump-meters br0], [0], [dnl
6166OFPST_METER_CONFIG reply (OF1.3) (xid=0x2):
6167meter=1 pktps burst stats bands=
6168type=drop rate=1 burst_size=1
6169])
6170}
6171
6172verify_deleted () {
6173 AT_CHECK([ovs-ofctl --no-stats dump-flows br0])
6174 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-groups br0], [0], [dnl
6175OFPST_GROUP_DESC reply (OF1.1) (xid=0x2):
6176])
6177 AT_CHECK([ovs-ofctl -O OpenFlow13 dump-meters br0], [0], [dnl
6178OFPST_METER_CONFIG reply (OF1.3) (xid=0x2):
6179])
6180}
6181
6182# Add flow, group, meter and check that they're there, without a controller.
6183add_flow_group_and_meter
6184verify_added
6185
6186# Set up a controller and verify that the flow and group were deleted,
6187# then add them back.
6188AT_CHECK([ovs-vsctl set-controller br0 'tcp:<invalid>:6653'])
6189verify_deleted
6190add_flow_group_and_meter
6191verify_added
6192
6193# Change the controller and verify that the flow and group are still there.
6194AT_CHECK([ovs-vsctl set-controller br0 'tcp:<invalid2>:6653'])
6195verify_added
6196
6197# Clear the controller and verify that the flow and group were deleted.
6198AT_CHECK([ovs-vsctl del-controller br0])
6199verify_deleted
6200
6201OVS_VSWITCHD_STOP(["/<invalid/d"])
6202AT_CLEANUP