]> git.proxmox.com Git - mirror_ovs.git/blame - tests/ofproto.at
tests: Flunk OVN tests if populating ARP tables failed.
[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):
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
BP
2193
2194' $1
2195}
2196ditto() {
2197 for i in `seq $1 $2`; do
2198 printf ' table %d ("table%d"): ditto\n' $i $i
2199 done
2200}
2201(head_table classifier; 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.
8811fc0a
BP
2214(head_table main; echo ' table 1 ("table1"):
2215 active=0, lookup=0, matched=0
2216 max_entries=1024
2217 (same matching)
2218
2219 table 2 ("table2"):
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:
8811fc0a 2253 table 0 ("%s"):
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
BP
2269
2270' $1
2271}
2272ditto() {
2273 for i in `seq $1 $2`; do
2274 printf ' table %d ("table%d"): ditto\n' $i $i
2275 done
2276}
2277(head_table classifier; 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):
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
2334' $1
2335}
2336ditto() {
2337 for i in `seq $1 $2`; do
2338 printf ' table %d ("table%d"): ditto\n' $i $i
2339 done
2340}
2341tail_table() {
2342 printf ' table 253 ("table253"):
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}
2353(head_table classifier; 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.
8811fc0a
BP
2366(head_table main; echo ' table 1 ("table1"):
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
2374 table 2 ("table2"):
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
BP
2388head_table () {
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
3d2fbd70 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
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
8811fc0a
BP
2570
2571' $1
2572}
2573ditto() {
2574 printf ' table %d ("%s"):
2575 metadata: match=0xffffffffffffffff write=0xffffffffffffffff
2576 max_entries=%d
2577 instructions (table miss and others):
2578 next tables: %d-253
2579 (same instructions)
2580 (same actions)
2581 (same matching)
2582
2583' $1 $2 $3 `expr $1 + 1`
2584}
2585tail_tables() {
2586echo ' table 252 ("table252"):
2587 metadata: match=0xffffffffffffffff write=0xffffffffffffffff
2588 max_entries=1000000
2589 instructions (table miss and others):
2590 next tables: 253
2591 (same instructions)
2592 (same actions)
2593 (same matching)
2594
2595 table 253 ("table253"):
2596 metadata: match=0xffffffffffffffff write=0xffffffffffffffff
2597 max_entries=1000000
2598 instructions (table miss and others):
2599 instructions: meter,apply_actions,clear_actions,write_actions,write_metadata
2600 (same actions)
2601 (same matching)
2602'
2603}
2604(head_table classifier
2605 for i in `seq 1 251`; do
2606 ditto $i table$i 1000000
2607 done
2608 tail_tables) > expout
2609AT_CHECK([ovs-ofctl -O OpenFlow13 dump-table-features br0], [0], [expout])
3c4e10fb
BP
2610# Change the configuration.
2611AT_CHECK(
2612 [ovs-vsctl \
2613 -- --id=@t0 create Flow_Table name=main \
2614 -- --id=@t1 create Flow_Table flow-limit=1024 \
2615 -- set bridge br0 'flow_tables={1=@t1,0=@t0}' \
c724bd67 2616 | uuidfilt],
3c4e10fb
BP
2617 [0], [<0>
2618<1>
2619])
2620# Check that the configuration was updated.
8811fc0a
BP
2621(head_table main
2622 ditto 1 table1 1024
2623 for i in `seq 2 251`; do
2624 ditto $i table$i 1000000
2625 done
2626 tail_tables) > expout
2627AT_CHECK([ovs-ofctl -O OpenFlow13 dump-table-features br0], [0], [expout])
3c4e10fb
BP
2628OVS_VSWITCHD_STOP
2629AT_CLEANUP
2630
03c72922
BP
2631AT_SETUP([ofproto - table description (OpenFlow 1.4)])
2632OVS_VSWITCHD_START
2633(x=0
2634 while test $x -lt 254; do
2635 y=`expr $x + 1`
2636 echo " table $x:
bab86012
SJ
2637 eviction=off eviction_flags=OTHER|IMPORTANCE|LIFETIME
2638 vacancy=off"
03c72922
BP
2639 x=$y
2640 done) > expout
2641AT_CHECK([ovs-ofctl -O OpenFlow14 dump-table-desc br0 | sed '/^$/d
2642/^OFPST_TABLE_DESC/d'], [0], [expout])
2643
2644# Change the configuration.
2645AT_CHECK([ovs-ofctl -O Openflow14 mod-table br0 0 evict])
2646# Check that the configuration was updated.
2647mv expout orig-expout
2648sed -e '2s/eviction=off/eviction=on/' <orig-expout > expout
2649AT_CHECK([ovs-ofctl -O OpenFlow14 dump-table-desc br0 | sed '/^$/d
2650/^OFPST_TABLE_DESC/d'], [0], [expout])
de7d3c07
SJ
2651
2652AT_CHECK([ovs-ofctl -O Openflow14 mod-table br0 0 vacancy:20,80])
2653# Check that the configuration was updated.
2654mv expout orig-expout
6c6eedc5 2655sed -e '3s/vacancy=off/vacancy=on vacancy_down=20% vacancy_up=80% vacancy=100%/' <orig-expout > expout
de7d3c07
SJ
2656AT_CHECK([ovs-ofctl -O OpenFlow14 dump-table-desc br0 | sed '/^$/d
2657/^OFPST_TABLE_DESC/d'], [0], [expout])
03c72922
BP
2658OVS_VSWITCHD_STOP
2659AT_CLEANUP
2660
06f64d03 2661AT_SETUP([ofproto - hard limits on flow table size (OpenFlow 1.0)])
254750ce
BP
2662OVS_VSWITCHD_START
2663# Configure a maximum of 4 flows.
2664AT_CHECK(
2665 [ovs-vsctl \
2666 -- --id=@t0 create Flow_Table flow-limit=4 \
2667 -- set bridge br0 flow_tables:0=@t0 \
c724bd67 2668 | uuidfilt],
254750ce
BP
2669 [0], [<0>
2670])
2671# Add 4 flows.
2672for in_port in 1 2 3 4; do
2673 ovs-ofctl add-flow br0 in_port=$in_port,actions=drop
2674done
2675AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
2676 in_port=1 actions=drop
2677 in_port=2 actions=drop
2678 in_port=3 actions=drop
2679 in_port=4 actions=drop
2680NXST_FLOW reply:
2681])
2682# Adding another flow will be refused.
2683AT_CHECK([ovs-ofctl add-flow br0 in_port=5,actions=drop], [1], [], [stderr])
52c57cbb 2684AT_CHECK([ofctl_strip < stderr], [0],
be2b69d1 2685 [OFPT_ERROR: OFPFMFC_TABLE_FULL
52c57cbb 2686OFPT_FLOW_MOD: ADD in_port=5 actions=drop
254750ce
BP
2687])
2688# Also a mod-flow that would add a flow will be refused.
2689AT_CHECK([ovs-ofctl mod-flows br0 in_port=5,actions=drop], [1], [], [stderr])
52c57cbb 2690AT_CHECK([ofctl_strip < stderr], [0],
be2b69d1 2691 [OFPT_ERROR: OFPFMFC_TABLE_FULL
52c57cbb 2692OFPT_FLOW_MOD: MOD in_port=5 actions=drop
254750ce
BP
2693])
2694# Replacing or modifying an existing flow is allowed.
2695AT_CHECK([ovs-ofctl add-flow br0 in_port=4,actions=normal])
2696AT_CHECK([ovs-ofctl mod-flows br0 in_port=3,actions=output:1])
2697AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
2698 in_port=1 actions=drop
2699 in_port=2 actions=drop
2700 in_port=3 actions=output:1
2701 in_port=4 actions=NORMAL
2702NXST_FLOW reply:
2703])
2704OVS_VSWITCHD_STOP
2705AT_CLEANUP
2706
06f64d03 2707AT_SETUP([ofproto - hard limits on flow table size (OpenFlow 1.2)])
9dcd1c00
SH
2708OVS_VSWITCHD_START
2709# Configure a maximum of 4 flows.
2710AT_CHECK(
2711 [ovs-vsctl \
2712 -- --id=@t0 create Flow_Table flow-limit=4 \
2713 -- set bridge br0 flow_tables:0=@t0 \
c724bd67 2714 | uuidfilt],
9dcd1c00
SH
2715 [0], [<0>
2716])
2717# Add 4 flows.
2718for in_port in 1 2 3 4; do
2719 ovs-ofctl -O OpenFlow12 add-flow br0 in_port=$in_port,actions=drop
2720done
2721AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
2722 in_port=1 actions=drop
2723 in_port=2 actions=drop
2724 in_port=3 actions=drop
2725 in_port=4 actions=drop
2726OFPST_FLOW reply (OF1.2):
2727])
2728# Adding another flow will be refused.
2729AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 in_port=5,actions=drop], [1], [], [stderr])
52c57cbb 2730AT_CHECK([ofctl_strip < stderr], [0],
9dcd1c00 2731 [OFPT_ERROR (OF1.2): OFPFMFC_TABLE_FULL
52c57cbb 2732OFPT_FLOW_MOD (OF1.2): ADD in_port=5 actions=drop
9dcd1c00
SH
2733])
2734# Replacing or modifying an existing flow is allowed.
2735AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 in_port=4,actions=normal])
2736AT_CHECK([ovs-ofctl -O OpenFlow12 mod-flows br0 in_port=3,actions=output:1])
2737AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
2738 in_port=1 actions=drop
2739 in_port=2 actions=drop
2740 in_port=3 actions=output:1
2741 in_port=4 actions=NORMAL
2742OFPST_FLOW reply (OF1.2):
2743])
2744OVS_VSWITCHD_STOP
2745AT_CLEANUP
2746
2747AT_SETUP([ofproto - eviction upon table overflow (OpenFlow 1.0)])
254750ce
BP
2748OVS_VSWITCHD_START
2749# Configure a maximum of 4 flows.
2750AT_CHECK(
2751 [ovs-vsctl \
2752 -- --id=@t0 create Flow_Table flow-limit=4 overflow-policy=evict \
2753 -- set bridge br0 flow_tables:0=@t0 \
c724bd67 2754 | uuidfilt],
254750ce
BP
2755 [0], [<0>
2756])
2757# Add 4 flows.
2758for in_port in 4 3 2 1; do
2759 ovs-ofctl add-flow br0 idle_timeout=${in_port}0,in_port=$in_port,actions=drop
2760done
2761AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
b9718b7b
BP
2762 idle_timeout=10, in_port=1 actions=drop
2763 idle_timeout=20, in_port=2 actions=drop
2764 idle_timeout=30, in_port=3 actions=drop
2765 idle_timeout=40, in_port=4 actions=drop
254750ce
BP
2766NXST_FLOW reply:
2767])
2768# Adding another flow will cause the one that expires soonest to be evicted.
2769AT_CHECK([ovs-ofctl add-flow br0 in_port=5,actions=drop])
2770AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
b9718b7b
BP
2771 idle_timeout=20, in_port=2 actions=drop
2772 idle_timeout=30, in_port=3 actions=drop
2773 idle_timeout=40, in_port=4 actions=drop
254750ce
BP
2774 in_port=5 actions=drop
2775NXST_FLOW reply:
2776])
2777# A mod-flow that adds a flow also causes eviction, but replacing or
2778# modifying an existing flow doesn't.
2779AT_CHECK([ovs-ofctl mod-flows br0 in_port=6,actions=drop])
2780AT_CHECK([ovs-ofctl add-flow br0 in_port=4,actions=normal])
2781AT_CHECK([ovs-ofctl mod-flows br0 in_port=3,actions=output:1])
2782AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
b9718b7b 2783 idle_timeout=30, in_port=3 actions=output:1
254750ce
BP
2784 in_port=4 actions=NORMAL
2785 in_port=5 actions=drop
2786 in_port=6 actions=drop
2787NXST_FLOW reply:
2788])
2789# Flows with no timeouts at all cannot be evicted.
2790AT_CHECK([ovs-ofctl add-flow br0 in_port=7,actions=normal])
2791AT_CHECK([ovs-ofctl add-flow br0 in_port=8,actions=drop], [1], [], [stderr])
52c57cbb 2792AT_CHECK([ofctl_strip < stderr], [0],
be2b69d1 2793 [OFPT_ERROR: OFPFMFC_TABLE_FULL
52c57cbb 2794OFPT_FLOW_MOD: ADD in_port=8 actions=drop
254750ce
BP
2795])
2796AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
2797 in_port=4 actions=NORMAL
2798 in_port=5 actions=drop
2799 in_port=6 actions=drop
2800 in_port=7 actions=NORMAL
2801NXST_FLOW reply:
2802])
2803OVS_VSWITCHD_STOP
2804AT_CLEANUP
2805
9dcd1c00
SH
2806AT_SETUP([ofproto - eviction upon table overflow (OpenFlow 1.2)])
2807OVS_VSWITCHD_START
2808# Configure a maximum of 4 flows.
2809AT_CHECK(
2810 [ovs-vsctl \
2811 -- --id=@t0 create Flow_Table flow-limit=4 overflow-policy=evict \
2812 -- set bridge br0 flow_tables:0=@t0 \
c724bd67 2813 | uuidfilt],
9dcd1c00
SH
2814 [0], [<0>
2815])
2816# Add 4 flows.
2817for in_port in 4 3 2 1; do
2818 ovs-ofctl -O OpenFlow12 add-flow br0 idle_timeout=${in_port}0,in_port=$in_port,actions=drop
2819done
2820AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
2821 idle_timeout=10, in_port=1 actions=drop
2822 idle_timeout=20, in_port=2 actions=drop
2823 idle_timeout=30, in_port=3 actions=drop
2824 idle_timeout=40, in_port=4 actions=drop
2825OFPST_FLOW reply (OF1.2):
2826])
2827# Adding another flow will cause the one that expires soonest to be evicted.
2828AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 in_port=5,actions=drop])
2829AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
2830 idle_timeout=20, in_port=2 actions=drop
2831 idle_timeout=30, in_port=3 actions=drop
2832 idle_timeout=40, in_port=4 actions=drop
2833 in_port=5 actions=drop
2834OFPST_FLOW reply (OF1.2):
2835])
0746a84f 2836# In OpenFlow 1.2 a mod-flow does not ever add a flow and thus
9dcd1c00
SH
2837# has no effect on eviction
2838AT_CHECK([ovs-ofctl -O OpenFlow12 mod-flows br0 in_port=6,actions=drop])
2839AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 in_port=4,actions=normal])
2840AT_CHECK([ovs-ofctl -O OpenFlow12 mod-flows br0 in_port=3,actions=output:1])
2841AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
2842 idle_timeout=20, in_port=2 actions=drop
2843 idle_timeout=30, in_port=3 actions=output:1
2844 in_port=4 actions=NORMAL
2845 in_port=5 actions=drop
2846OFPST_FLOW reply (OF1.2):
2847])
2848# Flows with no timeouts at all cannot be evicted.
2849AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 in_port=6,actions=drop])
2850AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 in_port=7,actions=normal])
2851AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 in_port=8,actions=drop], [1], [], [stderr])
52c57cbb 2852AT_CHECK([ofctl_strip < stderr], [0],
9dcd1c00 2853 [OFPT_ERROR (OF1.2): OFPFMFC_TABLE_FULL
52c57cbb 2854OFPT_FLOW_MOD (OF1.2): ADD in_port=8 actions=drop
9dcd1c00
SH
2855])
2856AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
2857 in_port=4 actions=NORMAL
2858 in_port=5 actions=drop
2859 in_port=6 actions=drop
2860 in_port=7 actions=NORMAL
2861OFPST_FLOW reply (OF1.2):
2862])
2863OVS_VSWITCHD_STOP
2864AT_CLEANUP
2865
f70b94de
BP
2866AT_SETUP([ofproto - eviction using importance upon table overflow (OpenFlow 1.4)])
2867OVS_VSWITCHD_START
2868# Configure a maximum of 4 flows.
2869AT_CHECK(
2870 [ovs-vsctl \
82c22d34 2871 -- --id=@t0 create Flow_Table name=evict flow-limit=4 \
f70b94de 2872 -- set bridge br0 flow_tables:0=@t0 \
c724bd67 2873 | uuidfilt],
f70b94de
BP
2874 [0], [<0>
2875])
82c22d34
BP
2876# Use mod-table to turn on eviction just to demonstrate that it works.
2877AT_CHECK([ovs-ofctl -O OpenFlow14 mod-table br0 0 evict])
f70b94de
BP
2878# Add 4 flows.
2879for in_port in 4 3 2 1; do
2880 ovs-ofctl -O Openflow14 add-flow br0 importance=$((in_port + 30)),priority=$((in_port + 5)),hard_timeout=$((in_port + 500)),actions=drop
2881done
2882AT_CHECK([ovs-ofctl -O Openflow14 dump-flows br0 | ofctl_strip | sort], [0], [dnl
2883 hard_timeout=501, importance=31, priority=6 actions=drop
2884 hard_timeout=502, importance=32, priority=7 actions=drop
2885 hard_timeout=503, importance=33, priority=8 actions=drop
2886 hard_timeout=504, importance=34, priority=9 actions=drop
2887OFPST_FLOW reply (OF1.4):
2888])
2889# Adding another flow will cause the one with lowest importance to be evicted.
2890AT_CHECK([ovs-ofctl -O Openflow14 add-flow br0 hard_timeout=505,importance=35,priority=10,in_port=2,actions=drop])
2891AT_CHECK([ovs-ofctl -O Openflow14 dump-flows br0 | ofctl_strip | sort], [0], [dnl
2892 hard_timeout=502, importance=32, priority=7 actions=drop
2893 hard_timeout=503, importance=33, priority=8 actions=drop
2894 hard_timeout=504, importance=34, priority=9 actions=drop
2895 hard_timeout=505, importance=35, priority=10,in_port=2 actions=drop
2896OFPST_FLOW reply (OF1.4):
2897])
2898# Disable the Eviction configuration.
82c22d34 2899AT_CHECK([ovs-ofctl -O OpenFlow14 mod-table br0 0 noevict])
f70b94de
BP
2900# Adding another flow will cause the system to give error for FULL TABLE.
2901AT_CHECK([ovs-ofctl -O Openflow14 add-flow br0 hard_timeout=506,importance=36,priority=11,actions=drop],[1], [], [stderr])
52c57cbb 2902AT_CHECK([ofctl_strip < stderr], [0],
f70b94de 2903 [OFPT_ERROR (OF1.4): OFPFMFC_TABLE_FULL
52c57cbb 2904OFPT_FLOW_MOD (OF1.4): ADD priority=11 hard:506 importance:36 actions=drop
f70b94de
BP
2905])
2906#Dump flows. It should show only the old values
2907AT_CHECK([ovs-ofctl -O Openflow14 dump-flows br0 | ofctl_strip | sort], [0], [dnl
2908 hard_timeout=502, importance=32, priority=7 actions=drop
2909 hard_timeout=503, importance=33, priority=8 actions=drop
2910 hard_timeout=504, importance=34, priority=9 actions=drop
2911 hard_timeout=505, importance=35, priority=10,in_port=2 actions=drop
2912OFPST_FLOW reply (OF1.4):
2913])
2914# mod-flow that would modify a flow will be done successfully.
2915AT_CHECK([ovs-ofctl -O Openflow14 mod-flows br0 in_port=2,actions=NORMAL])
2916AT_CHECK([ovs-ofctl -O Openflow14 dump-flows br0 | ofctl_strip | sort], [0], [dnl
2917 hard_timeout=502, importance=32, priority=7 actions=drop
2918 hard_timeout=503, importance=33, priority=8 actions=drop
2919 hard_timeout=504, importance=34, priority=9 actions=drop
2920 hard_timeout=505, importance=35, priority=10,in_port=2 actions=NORMAL
2921OFPST_FLOW reply (OF1.4):
2922])
2923# Also a mod-flow that would add a flow will be refused.
2924AT_CHECK([ovs-ofctl mod-flows br0 in_port=5,actions=drop], [1], [], [stderr])
52c57cbb 2925AT_CHECK([ofctl_strip < stderr], [0],
f70b94de 2926 [OFPT_ERROR: OFPFMFC_TABLE_FULL
52c57cbb 2927OFPT_FLOW_MOD: MOD in_port=5 actions=drop
f70b94de
BP
2928])
2929OVS_VSWITCHD_STOP
2930AT_CLEANUP
2931
9dcd1c00 2932AT_SETUP([ofproto - eviction upon table overflow, with fairness (OpenFlow 1.0)])
254750ce
BP
2933OVS_VSWITCHD_START
2934# Configure a maximum of 4 flows.
2935AT_CHECK(
2936 [ovs-vsctl \
2937 -- --id=@t0 create Flow_Table name=evict flow-limit=4 \
2938 overflow-policy=evict \
2939 groups='"NXM_OF_IN_PORT[[]]"' \
2940 -- set bridge br0 flow_tables:0=@t0 \
c724bd67 2941 | uuidfilt],
254750ce
BP
2942 [0], [<0>
2943])
2944# Add 4 flows.
2945ovs-ofctl add-flows br0 - <<EOF
2946idle_timeout=10 in_port=2 dl_src=00:44:55:66:77:88 actions=drop
2947idle_timeout=20 in_port=1 dl_src=00:11:22:33:44:55 actions=drop
2948idle_timeout=30 in_port=1 dl_src=00:22:33:44:55:66 actions=drop
2949idle_timeout=40 in_port=1 dl_src=00:33:44:55:66:77 actions=drop
2950EOF
2951AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
b9718b7b
BP
2952 idle_timeout=10, in_port=2,dl_src=00:44:55:66:77:88 actions=drop
2953 idle_timeout=20, in_port=1,dl_src=00:11:22:33:44:55 actions=drop
2954 idle_timeout=30, in_port=1,dl_src=00:22:33:44:55:66 actions=drop
2955 idle_timeout=40, in_port=1,dl_src=00:33:44:55:66:77 actions=drop
254750ce
BP
2956NXST_FLOW reply:
2957])
2958# Adding another flow will cause the one that expires soonest within
2959# the largest group (those with in_port=1) to be evicted. In this
2960# case this is not the same as the one that expires soonest overall
2961# (which is what makes the test interesting):
2962AT_CHECK([ovs-ofctl add-flow br0 in_port=2,dl_src=00:55:66:77:88:99,actions=drop])
2963AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
b9718b7b
BP
2964 idle_timeout=10, in_port=2,dl_src=00:44:55:66:77:88 actions=drop
2965 idle_timeout=30, in_port=1,dl_src=00:22:33:44:55:66 actions=drop
2966 idle_timeout=40, in_port=1,dl_src=00:33:44:55:66:77 actions=drop
254750ce
BP
2967 in_port=2,dl_src=00:55:66:77:88:99 actions=drop
2968NXST_FLOW reply:
2969])
2970# Enlarge the flow limit, change the eviction policy back to strictly
2971# based on expiration, and and add some flows.
2972AT_CHECK([ovs-vsctl set Flow_Table evict groups='[[]]' flow-limit=7])
2973ovs-ofctl add-flows br0 - <<EOF
2974idle_timeout=50 in_port=2 dl_src=00:66:77:88:99:aa actions=drop
2975idle_timeout=60 in_port=2 dl_src=00:77:88:99:aa:bb actions=drop
2976idle_timeout=70 in_port=2 dl_src=00:88:99:aa:bb:cc actions=drop
2977EOF
2978AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
b9718b7b
BP
2979 idle_timeout=10, in_port=2,dl_src=00:44:55:66:77:88 actions=drop
2980 idle_timeout=30, in_port=1,dl_src=00:22:33:44:55:66 actions=drop
2981 idle_timeout=40, in_port=1,dl_src=00:33:44:55:66:77 actions=drop
2982 idle_timeout=50, in_port=2,dl_src=00:66:77:88:99:aa actions=drop
2983 idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=drop
2984 idle_timeout=70, in_port=2,dl_src=00:88:99:aa:bb:cc actions=drop
254750ce
BP
2985 in_port=2,dl_src=00:55:66:77:88:99 actions=drop
2986NXST_FLOW reply:
2987])
2988# Adding another flow will cause the one that expires soonest overall
2989# to be evicted.
2990AT_CHECK([ovs-ofctl add-flow br0 'idle_timeout=80 in_port=2 dl_src=00:99:aa:bb:cc:dd actions=drop'])
2991AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
b9718b7b
BP
2992 idle_timeout=30, in_port=1,dl_src=00:22:33:44:55:66 actions=drop
2993 idle_timeout=40, in_port=1,dl_src=00:33:44:55:66:77 actions=drop
2994 idle_timeout=50, in_port=2,dl_src=00:66:77:88:99:aa actions=drop
2995 idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=drop
2996 idle_timeout=70, in_port=2,dl_src=00:88:99:aa:bb:cc actions=drop
2997 idle_timeout=80, in_port=2,dl_src=00:99:aa:bb:cc:dd actions=drop
254750ce
BP
2998 in_port=2,dl_src=00:55:66:77:88:99 actions=drop
2999NXST_FLOW reply:
3000])
3001# Reducing the flow limit also causes the flows that expire soonest
3002# overall to be evicted.
3003AT_CHECK([ovs-vsctl set Flow_Table evict flow-limit=4])
3004AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
b9718b7b
BP
3005 idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=drop
3006 idle_timeout=70, in_port=2,dl_src=00:88:99:aa:bb:cc actions=drop
3007 idle_timeout=80, in_port=2,dl_src=00:99:aa:bb:cc:dd actions=drop
254750ce
BP
3008 in_port=2,dl_src=00:55:66:77:88:99 actions=drop
3009NXST_FLOW reply:
3010])
3011OVS_VSWITCHD_STOP
3012AT_CLEANUP
80d5aefd 3013
9dcd1c00
SH
3014AT_SETUP([ofproto - eviction upon table overflow, with fairness (OpenFlow 1.2)])
3015OVS_VSWITCHD_START
3016# Configure a maximum of 4 flows.
3017AT_CHECK(
3018 [ovs-vsctl \
3019 -- --id=@t0 create Flow_Table name=evict flow-limit=4 \
3020 overflow-policy=evict \
3021 groups='"NXM_OF_IN_PORT[[]]"' \
3022 -- set bridge br0 flow_tables:0=@t0 \
c724bd67 3023 | uuidfilt],
9dcd1c00
SH
3024 [0], [<0>
3025])
3026# Add 4 flows.
3027ovs-ofctl -O OpenFlow12 add-flows br0 - <<EOF
3028idle_timeout=10 in_port=2 dl_src=00:44:55:66:77:88 actions=drop
3029idle_timeout=20 in_port=1 dl_src=00:11:22:33:44:55 actions=drop
3030idle_timeout=30 in_port=1 dl_src=00:22:33:44:55:66 actions=drop
3031idle_timeout=40 in_port=1 dl_src=00:33:44:55:66:77 actions=drop
3032EOF
3033AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
3034 idle_timeout=10, in_port=2,dl_src=00:44:55:66:77:88 actions=drop
3035 idle_timeout=20, in_port=1,dl_src=00:11:22:33:44:55 actions=drop
3036 idle_timeout=30, in_port=1,dl_src=00:22:33:44:55:66 actions=drop
3037 idle_timeout=40, in_port=1,dl_src=00:33:44:55:66:77 actions=drop
3038OFPST_FLOW reply (OF1.2):
3039])
3040# Adding another flow will cause the one that expires soonest within
3041# the largest group (those with in_port=1) to be evicted. In this
3042# case this is not the same as the one that expires soonest overall
3043# (which is what makes the test interesting):
3044AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 in_port=2,dl_src=00:55:66:77:88:99,actions=drop])
3045AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
3046 idle_timeout=10, in_port=2,dl_src=00:44:55:66:77:88 actions=drop
3047 idle_timeout=30, in_port=1,dl_src=00:22:33:44:55:66 actions=drop
3048 idle_timeout=40, in_port=1,dl_src=00:33:44:55:66:77 actions=drop
3049 in_port=2,dl_src=00:55:66:77:88:99 actions=drop
3050OFPST_FLOW reply (OF1.2):
3051])
3052# Enlarge the flow limit, change the eviction policy back to strictly
3053# based on expiration, and and add some flows.
3054AT_CHECK([ovs-vsctl set Flow_Table evict groups='[[]]' flow-limit=7])
3055ovs-ofctl -O OpenFlow12 add-flows br0 - <<EOF
3056idle_timeout=50 in_port=2 dl_src=00:66:77:88:99:aa actions=drop
3057idle_timeout=60 in_port=2 dl_src=00:77:88:99:aa:bb actions=drop
3058idle_timeout=70 in_port=2 dl_src=00:88:99:aa:bb:cc actions=drop
3059EOF
3060AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
3061 idle_timeout=10, in_port=2,dl_src=00:44:55:66:77:88 actions=drop
3062 idle_timeout=30, in_port=1,dl_src=00:22:33:44:55:66 actions=drop
3063 idle_timeout=40, in_port=1,dl_src=00:33:44:55:66:77 actions=drop
3064 idle_timeout=50, in_port=2,dl_src=00:66:77:88:99:aa actions=drop
3065 idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=drop
3066 idle_timeout=70, in_port=2,dl_src=00:88:99:aa:bb:cc actions=drop
3067 in_port=2,dl_src=00:55:66:77:88:99 actions=drop
3068OFPST_FLOW reply (OF1.2):
3069])
3070# Adding another flow will cause the one that expires soonest overall
3071# to be evicted.
3072AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 'idle_timeout=80 in_port=2 dl_src=00:99:aa:bb:cc:dd actions=drop'])
3073AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
3074 idle_timeout=30, in_port=1,dl_src=00:22:33:44:55:66 actions=drop
3075 idle_timeout=40, in_port=1,dl_src=00:33:44:55:66:77 actions=drop
3076 idle_timeout=50, in_port=2,dl_src=00:66:77:88:99:aa actions=drop
3077 idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=drop
3078 idle_timeout=70, in_port=2,dl_src=00:88:99:aa:bb:cc actions=drop
3079 idle_timeout=80, in_port=2,dl_src=00:99:aa:bb:cc:dd actions=drop
3080 in_port=2,dl_src=00:55:66:77:88:99 actions=drop
3081OFPST_FLOW reply (OF1.2):
3082])
3083# Reducing the flow limit also causes the flows that expire soonest
3084# overall to be evicted.
3085AT_CHECK([ovs-vsctl set Flow_Table evict flow-limit=4])
3086AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
3087 idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=drop
3088 idle_timeout=70, in_port=2,dl_src=00:88:99:aa:bb:cc actions=drop
3089 idle_timeout=80, in_port=2,dl_src=00:99:aa:bb:cc:dd actions=drop
3090 in_port=2,dl_src=00:55:66:77:88:99 actions=drop
3091OFPST_FLOW reply (OF1.2):
3092])
3093OVS_VSWITCHD_STOP
3094AT_CLEANUP
3095
6d56c1f1
K
3096AT_SETUP([ofproto - eviction upon table overflow, with modified hard timeout])
3097OVS_VSWITCHD_START
3098# Configure a maximum of 4 flows.
3099AT_CHECK(
3100 [ovs-vsctl \
3101 -- --id=@t0 create Flow_Table flow-limit=4 overflow-policy=evict \
3102 -- set bridge br0 flow_tables:0=@t0 \
c724bd67 3103 | uuidfilt],
6d56c1f1
K
3104 [0], [<0>
3105])
337a3866 3106ovs-appctl time/stop
6d56c1f1
K
3107# Add 4 flows.
3108for in_port in 4 3 2 1; do
337a3866 3109 ovs-ofctl add-flow br0 hard_timeout=$((10 + in_port * 3)),in_port=$in_port,actions=drop
6d56c1f1
K
3110done
3111AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
337a3866
YT
3112 hard_timeout=13, in_port=1 actions=drop
3113 hard_timeout=16, in_port=2 actions=drop
3114 hard_timeout=19, in_port=3 actions=drop
3115 hard_timeout=22, in_port=4 actions=drop
6d56c1f1
K
3116NXST_FLOW reply:
3117])
3118# Sleep and modify the one that expires soonest
337a3866 3119ovs-appctl time/warp 5000
6d56c1f1 3120AT_CHECK([ovs-ofctl mod-flows br0 in_port=1,actions=drop])
337a3866
YT
3121# At this point the table would looks like:
3122# in_port seconds to expire
3123# 1 13
3124# 2 11
3125# 3 14
3126# 4 17
3127ovs-appctl time/warp 2000
6d56c1f1
K
3128# Adding another flow will cause the one that expires soonest to be evicted.
3129AT_CHECK([ovs-ofctl add-flow br0 in_port=5,actions=drop])
3130AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
337a3866
YT
3131 hard_timeout=13, in_port=1 actions=drop
3132 hard_timeout=19, in_port=3 actions=drop
3133 hard_timeout=22, in_port=4 actions=drop
6d56c1f1
K
3134 in_port=5 actions=drop
3135NXST_FLOW reply:
3136])
3137OVS_VSWITCHD_STOP
3138AT_CLEANUP
3139
3140AT_SETUP([ofproto - eviction upon table overflow, with modified idle timeout])
3141OVS_VSWITCHD_START([add-port br0 p1 -- set interface p1 type=dummy ofport_request=1])
3142# Configure a maximum of 4 flows.
3143AT_CHECK(
3144 [ovs-vsctl \
3145 -- --id=@t0 create Flow_Table flow-limit=4 overflow-policy=evict \
3146 -- set bridge br0 flow_tables:0=@t0 \
c724bd67 3147 | uuidfilt],
6d56c1f1
K
3148 [0], [<0>
3149])
3150# Add 4 flows.
3151for in_port in 4 3 2 1; do
337a3866 3152 ovs-ofctl add-flow br0 idle_timeout=$((10 + in_port * 3)),in_port=$in_port,actions=drop
6d56c1f1 3153done
337a3866 3154ovs-appctl time/stop
6d56c1f1 3155AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
337a3866
YT
3156 idle_timeout=13, in_port=1 actions=drop
3157 idle_timeout=16, in_port=2 actions=drop
3158 idle_timeout=19, in_port=3 actions=drop
3159 idle_timeout=22, in_port=4 actions=drop
6d56c1f1
K
3160NXST_FLOW reply:
3161])
3162# Sleep and receive on the flow that expires soonest
337a3866 3163ovs-appctl time/warp 5000
6d56c1f1 3164AT_CHECK([ovs-appctl netdev-dummy/receive p1 'in_port(1)'])
337a3866
YT
3165# At this point the table would looks like:
3166# in_port seconds to expire
3167# 1 13
3168# 2 11
3169# 3 14
3170# 4 17
3171ovs-appctl time/warp 2000
6d56c1f1
K
3172# Adding another flow will cause the one that expires soonest to be evicted.
3173AT_CHECK([ovs-ofctl add-flow br0 in_port=5,actions=drop])
3174AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
337a3866
YT
3175 idle_timeout=19, in_port=3 actions=drop
3176 idle_timeout=22, in_port=4 actions=drop
6d56c1f1 3177 in_port=5 actions=drop
efe179e0 3178 n_packets=1, n_bytes=14, idle_timeout=13, in_port=1 actions=drop
6d56c1f1
K
3179NXST_FLOW reply:
3180])
3181OVS_VSWITCHD_STOP
3182AT_CLEANUP
3183
9dcd1c00 3184AT_SETUP([ofproto - asynchronous message control (OpenFlow 1.0)])
80d5aefd 3185OVS_VSWITCHD_START
6409e008 3186AT_CHECK([ovs-ofctl -P standard monitor br0 --detach --no-chdir --pidfile])
80d5aefd
BP
3187check_async () {
3188 printf '\n\n--- check_async %d ---\n\n\n' $1
3189 shift
3190
6fc67c4f 3191 ovs-appctl -t ovs-ofctl ofctl/barrier
80d5aefd
BP
3192 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
3193 : > expout
3194
a7349929 3195 # OFPT_PACKET_IN, OFPR_ACTION (controller_id=0)
7f05e7ab 3196 ovs-ofctl -v packet-out br0 controller controller '0001020304050010203040501234'
80d5aefd 3197 if test X"$1" = X"OFPR_ACTION"; then shift;
7f05e7ab 3198 echo >>expout "OFPT_PACKET_IN: total_len=14 in_port=CONTROLLER (via action) data_len=14 (unbuffered)
e6d9ab56 3199vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1234"
80d5aefd
BP
3200 fi
3201
a7349929 3202 # OFPT_PACKET_IN, OFPR_NO_MATCH (controller_id=123)
7f05e7ab 3203 ovs-ofctl -v packet-out br0 controller 'controller(reason=no_match,id=123)' '0001020304050010203040501234'
a7349929 3204 if test X"$1" = X"OFPR_NO_MATCH"; then shift;
7f05e7ab 3205 echo >>expout "OFPT_PACKET_IN: total_len=14 in_port=CONTROLLER (via no_match) data_len=14 (unbuffered)
e6d9ab56 3206vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1234"
a7349929
BP
3207 fi
3208
3209 # OFPT_PACKET_IN, OFPR_INVALID_TTL (controller_id=0)
6dd3c787 3210 ovs-ofctl packet-out br0 "in_port=controller packet=002583dfb4000026b98cb0f908004500003eb7e200000011339bac11370dac100002d7730035002b8f6d86fb0100000100000000000006626c702d7873066e696369726103636f6d00000f00 actions=dec_ttl"
80d5aefd 3211 if test X"$1" = X"OFPR_INVALID_TTL"; then shift;
7f05e7ab 3212 echo >>expout "OFPT_PACKET_IN: total_len=76 in_port=CONTROLLER (via invalid_ttl) data_len=76 (unbuffered)
e6d9ab56 3213udp,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
3214 fi
3215
3216 # OFPT_PORT_STATUS, OFPPR_ADD
e1b1d06a 3217 ovs-vsctl add-port br0 test -- set Interface test type=dummy ofport_request=1
80d5aefd
BP
3218 if test X"$1" = X"OFPPR_ADD"; then shift;
3219 echo >>expout "OFPT_PORT_STATUS: ADD: 1(test): addr:aa:55:aa:55:00:0x
3220 config: PORT_DOWN
9e1fd49b 3221 state: LINK_DOWN
d02a5f8e 3222 speed: 0 Mbps now, 0 Mbps max"
80d5aefd
BP
3223 fi
3224
3225 # OFPT_PORT_STATUS, OFPPR_DELETE
3226 ovs-vsctl del-port br0 test
3227 if test X"$1" = X"OFPPR_DELETE"; then shift;
3228 echo >>expout "OFPT_PORT_STATUS: DEL: 1(test): addr:aa:55:aa:55:00:0x
3229 config: PORT_DOWN
9e1fd49b 3230 state: LINK_DOWN
d02a5f8e 3231 speed: 0 Mbps now, 0 Mbps max"
80d5aefd
BP
3232 fi
3233
3234 # OFPT_FLOW_REMOVED, OFPRR_DELETE
3235 ovs-ofctl add-flow br0 send_flow_rem,actions=drop
3236 ovs-ofctl --strict del-flows br0 ''
3237 if test X"$1" = X"OFPRR_DELETE"; then shift;
3238 echo >>expout "OFPT_FLOW_REMOVED: reason=delete"
3239 fi
3240 AT_FAIL_IF([test X"$1" != X])
3241
93358108 3242 OVS_WAIT_UNTIL([test `wc -l < "monitor.log"` -ge `wc -l < "expout"`])
80d5aefd
BP
3243
3244 AT_CHECK(
3245 [[sed '
3246s/ (xid=0x[0-9a-fA-F]*)//
3247s/ *duration.*//
3248s/00:0.$/00:0x/' < monitor.log]],
3249 [0], [expout])
3250}
3251
3252# It's a service connection so initially there should be no async messages.
3253check_async 1
3254
99811d07 3255# Set miss_send_len to 128, turning on packet-ins for our service connection.
80d5aefd
BP
3256ovs-appctl -t ovs-ofctl ofctl/send 0109000c0123456700000080
3257check_async 2 OFPR_ACTION OFPPR_ADD OFPPR_DELETE OFPRR_DELETE
3258
3259# Set miss_send_len to 128 and enable invalid_ttl.
3260ovs-appctl -t ovs-ofctl ofctl/send 0109000c0123456700040080
3261check_async 3 OFPR_ACTION OFPR_INVALID_TTL OFPPR_ADD OFPPR_DELETE OFPRR_DELETE
3262
3263# Become slave, which should disable everything except port status.
3264ovs-appctl -t ovs-ofctl ofctl/send 0104001400000002000023200000000a00000002
3265check_async 4 OFPPR_ADD OFPPR_DELETE
3266
3267# Use NXT_SET_ASYNC_CONFIG to enable a patchwork of asynchronous messages.
3268ovs-appctl -t ovs-ofctl ofctl/send 01040028000000020000232000000013000000020000000500000005000000020000000200000005
3269check_async 5 OFPR_INVALID_TTL OFPPR_DELETE OFPRR_DELETE
3270
a7349929
BP
3271# Set controller ID 123.
3272ovs-appctl -t ovs-ofctl ofctl/send 01040018000000030000232000000014000000000000007b
3273check_async 6 OFPR_NO_MATCH OFPPR_DELETE OFPRR_DELETE
3274
3275# Restore controller ID 0.
3276ovs-appctl -t ovs-ofctl ofctl/send 010400180000000300002320000000140000000000000000
3277
80d5aefd
BP
3278# Become master.
3279ovs-appctl -t ovs-ofctl ofctl/send 0104001400000002000023200000000a00000001
a7349929 3280check_async 7 OFPR_ACTION OFPPR_ADD
80d5aefd 3281
d9c8c57c 3282OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
94c33672 3283OVS_VSWITCHD_STOP
80d5aefd 3284AT_CLEANUP
751c7785 3285
9dcd1c00
SH
3286AT_SETUP([ofproto - asynchronous message control (OpenFlow 1.2)])
3287OVS_VSWITCHD_START
6409e008 3288AT_CHECK([ovs-ofctl -O OpenFlow12 -P standard monitor br0 --detach --no-chdir --pidfile])
9dcd1c00
SH
3289check_async () {
3290 printf '\n\n--- check_async %d ---\n\n\n' $1
3291 INDEX=$1
3292 shift
3293
3294 ovs-appctl -t ovs-ofctl ofctl/barrier
3295 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
3296 : > expout
3297
3298 # OFPT_PACKET_IN, OFPR_ACTION (controller_id=0)
3299 ovs-ofctl -O OpenFlow12 -v packet-out br0 none controller '0001020304050010203040501234'
3300 if test X"$1" = X"OFPR_ACTION"; then shift;
3301 echo >>expout "OFPT_PACKET_IN (OF1.2): total_len=14 in_port=ANY (via action) data_len=14 (unbuffered)
e6d9ab56 3302vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1234"
9dcd1c00
SH
3303 fi
3304
3305 # OFPT_PACKET_IN, OFPR_NO_MATCH (controller_id=123)
3306 ovs-ofctl -O OpenFlow12 -v packet-out br0 none 'controller(reason=no_match,id=123)' '0001020304050010203040501234'
3307 if test X"$1" = X"OFPR_NO_MATCH"; then shift;
3308 echo >>expout "OFPT_PACKET_IN (OF1.2): total_len=14 in_port=ANY (via no_match) data_len=14 (unbuffered)
e6d9ab56 3309vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1234"
9dcd1c00
SH
3310 fi
3311
3312 # OFPT_PACKET_IN, OFPR_INVALID_TTL (controller_id=0)
fa8d9001 3313 ovs-ofctl -O OpenFlow12 packet-out br0 none dec_ttl '002583dfb4000026b98cb0f908004500003eb7e200000011339bac11370dac100002d7730035002b8f6d86fb0100000100000000000006626c702d7873066e696369726103636f6d00000f00'
9dcd1c00
SH
3314 if test X"$1" = X"OFPR_INVALID_TTL"; then shift;
3315 echo >>expout "OFPT_PACKET_IN (OF1.2): total_len=76 in_port=ANY (via invalid_ttl) data_len=76 (unbuffered)
e6d9ab56 3316udp,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
3317 fi
3318
3319 # OFPT_PORT_STATUS, OFPPR_ADD
3320 ovs-vsctl add-port br0 test -- set Interface test type=dummy
3321 if test X"$1" = X"OFPPR_ADD"; then shift;
3322 echo >>expout "OFPT_PORT_STATUS (OF1.2): ADD: ${INDEX}(test): addr:aa:55:aa:55:00:0x
3323 config: PORT_DOWN
3324 state: LINK_DOWN
3325 speed: 0 Mbps now, 0 Mbps max"
3326 fi
3327
3328 # OFPT_PORT_STATUS, OFPPR_DELETE
3329 ovs-vsctl del-port br0 test
3330 if test X"$1" = X"OFPPR_DELETE"; then shift;
3331 echo >>expout "OFPT_PORT_STATUS (OF1.2): DEL: ${INDEX}(test): addr:aa:55:aa:55:00:0x
3332 config: PORT_DOWN
3333 state: LINK_DOWN
3334 speed: 0 Mbps now, 0 Mbps max"
3335 fi
3336
3337 # OFPT_FLOW_REMOVED, OFPRR_DELETE
3338 ovs-ofctl -O OpenFlow12 add-flow br0 send_flow_rem,actions=drop
3339 ovs-ofctl -O OpenFlow12 --strict del-flows br0 ''
3340 if test X"$1" = X"OFPRR_DELETE"; then shift;
3341 echo >>expout "OFPT_FLOW_REMOVED (OF1.2): reason=delete table_id=0"
3342 fi
3343 AT_FAIL_IF([test X"$1" != X])
3344
93358108 3345 OVS_WAIT_UNTIL([test `wc -l < "monitor.log"` -ge `wc -l < "expout"`])
9dcd1c00
SH
3346
3347 AT_CHECK(
3348 [[sed '
3349s/ (xid=0x[0-9a-fA-F]*)//
3350s/ *duration.*//
3351s/00:0.$/00:0x/' < monitor.log]],
3352 [0], [expout])
3353}
3354
3355# It's a service connection so initially there should be no async messages.
3356check_async 1
3357
3358# Set miss_send_len to 128, turning on packet-ins for our service connection.
3359ovs-appctl -t ovs-ofctl ofctl/send 0309000c0123456700000080
3360check_async 2 OFPR_ACTION OFPPR_ADD OFPPR_DELETE OFPRR_DELETE
3361
3362# Set miss_send_len to 128 and enable invalid_ttl.
3363ovs-appctl -t ovs-ofctl ofctl/send 0309000c0123456700040080
3364check_async 3 OFPR_ACTION OFPR_INVALID_TTL OFPPR_ADD OFPPR_DELETE OFPRR_DELETE
3365
6ea4776b
JR
3366# Become slave (OF 1.2), which should disable everything except port status.
3367ovs-appctl -t ovs-ofctl ofctl/send 031800180000000200000003000000000000000000000001
9dcd1c00
SH
3368check_async 4 OFPPR_ADD OFPPR_DELETE
3369
3370# Use NXT_SET_ASYNC_CONFIG to enable a patchwork of asynchronous messages.
3371ovs-appctl -t ovs-ofctl ofctl/send 03040028000000020000232000000013000000020000000500000005000000020000000200000005
3372check_async 5 OFPR_INVALID_TTL OFPPR_DELETE OFPRR_DELETE
3373
3374# Set controller ID 123.
3375ovs-appctl -t ovs-ofctl ofctl/send 03040018000000030000232000000014000000000000007b
3376check_async 6 OFPR_NO_MATCH OFPPR_DELETE OFPRR_DELETE
3377
3378# Restore controller ID 0.
3379ovs-appctl -t ovs-ofctl ofctl/send 030400180000000300002320000000140000000000000000
3380
6ea4776b
JR
3381# Become master (OF 1.2).
3382ovs-appctl -t ovs-ofctl ofctl/send 031800180000000400000002000000000000000000000002
9dcd1c00
SH
3383check_async 7 OFPR_ACTION OFPPR_ADD
3384
d9c8c57c 3385OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
9dcd1c00
SH
3386OVS_VSWITCHD_STOP
3387AT_CLEANUP
3388
b21eb1da 3389AT_SETUP([ofproto - asynchronous message control (OpenFlow 1.3)])
e19a6769
YHW
3390OVS_VSWITCHD_START([dnl
3391 add-port br0 p1 -- set Interface p1 type=dummy ofport_request=10
3392])
6409e008 3393AT_CHECK([ovs-ofctl -O OpenFlow13 -P standard monitor br0 --detach --no-chdir --pidfile])
b21eb1da
JR
3394check_async () {
3395 printf '\n\n--- check_async %d ---\n\n\n' $1
3396 INDEX=$1
3397 shift
3398
3399 ovs-appctl -t ovs-ofctl ofctl/barrier
3400 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
3401 : > expout
3402
3403 # OFPT_PACKET_IN, OFPR_ACTION (controller_id=0)
e19a6769 3404 # OFPR_ACTION_SET is treated as OFPR_ACTION in OpenFlow 1.3
b21eb1da 3405 ovs-ofctl -O OpenFlow13 -v packet-out br0 none controller '0001020304050010203040501234'
e19a6769
YHW
3406 ovs-ofctl -O OpenFlow13 add-flow br0 'in_port=10 actions=write_actions(output(CONTROLLER))'
3407 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
3408 if test X"$1" = X"OFPR_ACTION"; then shift;
3409 echo >>expout "OFPT_PACKET_IN (OF1.3): total_len=14 in_port=ANY (via action) data_len=14 (unbuffered)
e19a6769
YHW
3410vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1234"
3411 echo >>expout "OFPT_PACKET_IN (OF1.3): cookie=0x0 total_len=14 in_port=10 (via action) data_len=14 (unbuffered)
e6d9ab56 3412vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1234"
b21eb1da
JR
3413 fi
3414
3415 # OFPT_PACKET_IN, OFPR_NO_MATCH (controller_id=123)
3416 ovs-ofctl -O OpenFlow13 -v packet-out br0 none 'controller(reason=no_match,id=123)' '0001020304050010203040501234'
3417 if test X"$1" = X"OFPR_NO_MATCH"; then shift;
3418 echo >>expout "OFPT_PACKET_IN (OF1.3): total_len=14 in_port=ANY (via no_match) data_len=14 (unbuffered)
e6d9ab56 3419vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1234"
b21eb1da
JR
3420 fi
3421
3422 # OFPT_PACKET_IN, OFPR_INVALID_TTL (controller_id=0)
fa8d9001 3423 ovs-ofctl -O OpenFlow13 packet-out br0 none dec_ttl '002583dfb4000026b98cb0f908004500003eb7e200000011339bac11370dac100002d7730035002b8f6d86fb0100000100000000000006626c702d7873066e696369726103636f6d00000f00'
b21eb1da
JR
3424 if test X"$1" = X"OFPR_INVALID_TTL"; then shift;
3425 echo >>expout "OFPT_PACKET_IN (OF1.3): total_len=76 in_port=ANY (via invalid_ttl) data_len=76 (unbuffered)
e6d9ab56 3426udp,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
3427 fi
3428
3429 # OFPT_PORT_STATUS, OFPPR_ADD
3430 ovs-vsctl add-port br0 test -- set Interface test type=dummy
3431 if test X"$1" = X"OFPPR_ADD"; then shift;
3432 echo >>expout "OFPT_PORT_STATUS (OF1.3): ADD: ${INDEX}(test): addr:aa:55:aa:55:00:0x
3433 config: PORT_DOWN
3434 state: LINK_DOWN
3435 speed: 0 Mbps now, 0 Mbps max"
3436 fi
3437
3438 # OFPT_PORT_STATUS, OFPPR_DELETE
3439 ovs-vsctl del-port br0 test
3440 if test X"$1" = X"OFPPR_DELETE"; then shift;
3441 echo >>expout "OFPT_PORT_STATUS (OF1.3): DEL: ${INDEX}(test): addr:aa:55:aa:55:00:0x
3442 config: PORT_DOWN
3443 state: LINK_DOWN
3444 speed: 0 Mbps now, 0 Mbps max"
3445 fi
3446
3447 # OFPT_FLOW_REMOVED, OFPRR_DELETE
3448 ovs-ofctl -O OpenFlow13 add-flow br0 send_flow_rem,actions=drop
3449 ovs-ofctl -O OpenFlow13 --strict del-flows br0 ''
3450 if test X"$1" = X"OFPRR_DELETE"; then shift;
3451 echo >>expout "OFPT_FLOW_REMOVED (OF1.3): reason=delete table_id=0"
3452 fi
cc40d06b
SH
3453
3454 # OFPT_FLOW_REMOVED, OFPRR_GROUP_DELETE
3455 ovs-ofctl -O OpenFlow13 add-group br0 group_id=1234,type=all,bucket=output:10
3456 ovs-ofctl -O OpenFlow13 add-flow br0 send_flow_rem,actions=group:1234
3457 ovs-ofctl -O OpenFlow13 --strict del-groups br0 group_id=1234
75754d04
JP
3458 if test X"$1" = X"OFPRR_GROUP_DELETE"; then shift;
3459 echo >>expout "OFPT_FLOW_REMOVED (OF1.3): reason=group_delete table_id=0"
cc40d06b
SH
3460 fi
3461
b21eb1da
JR
3462 AT_FAIL_IF([test X"$1" != X])
3463
93358108 3464 OVS_WAIT_UNTIL([test `wc -l < "monitor.log"` -ge `wc -l < "expout"`])
b21eb1da
JR
3465
3466 AT_CHECK(
3467 [[sed '
3468s/ (xid=0x[0-9a-fA-F]*)//
3469s/ *duration.*//
3470s/00:0.$/00:0x/' < monitor.log]],
3471 [0], [expout])
3472}
3473
3474# It's a service connection so initially there should be no async messages.
3475check_async 1
3476
3477# Set miss_send_len to 128, turning on packet-ins for our service connection.
3478ovs-appctl -t ovs-ofctl ofctl/send 0409000c0123456700000080
75754d04 3479check_async 2 OFPR_ACTION OFPPR_ADD OFPPR_DELETE OFPRR_DELETE OFPRR_GROUP_DELETE
b21eb1da
JR
3480
3481# Become slave (OF 1.3), which should disable everything except port status.
3482ovs-appctl -t ovs-ofctl ofctl/send 041800180000000200000003000000000000000000000001
3483check_async 3 OFPPR_ADD OFPPR_DELETE
3484
3485# Use OF 1.3 OFPT_SET_ASYNC to enable a patchwork of asynchronous messages.
75754d04
JP
3486ovs-appctl -t ovs-ofctl ofctl/send 041c00200000000200000002000000050000000500000002000000020000000d
3487check_async 4 OFPR_INVALID_TTL OFPPR_DELETE OFPRR_DELETE OFPRR_GROUP_DELETE
b21eb1da
JR
3488
3489# Set controller ID 123.
3490ovs-appctl -t ovs-ofctl ofctl/send 04040018000000030000232000000014000000000000007b
75754d04 3491check_async 5 OFPR_NO_MATCH OFPPR_DELETE OFPRR_DELETE OFPRR_GROUP_DELETE
b21eb1da
JR
3492
3493# Restore controller ID 0.
3494ovs-appctl -t ovs-ofctl ofctl/send 040400180000000300002320000000140000000000000000
3495
3496# Become master (OF 1.3).
3497ovs-appctl -t ovs-ofctl ofctl/send 041800180000000400000002000000000000000000000002
3498check_async 6 OFPR_ACTION OFPPR_ADD
3499
d9c8c57c 3500OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
b21eb1da
JR
3501OVS_VSWITCHD_STOP
3502AT_CLEANUP
3503
98090482 3504AT_SETUP([ofproto - asynchronous message control (OpenFlow 1.4)])
e19a6769
YHW
3505OVS_VSWITCHD_START([dnl
3506 add-port br0 p1 -- set Interface p1 type=dummy ofport_request=10
3507])
6409e008 3508AT_CHECK([ovs-ofctl -O OpenFlow14 -P standard monitor br0 --detach --no-chdir --pidfile])
98090482
NR
3509check_async () {
3510 printf '\n\n--- check_async %d ---\n\n\n' $1
3511 INDEX=$1
3512 shift
3513
3514 ovs-appctl -t ovs-ofctl ofctl/barrier
3515 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
3516 : > expout
3517
331c07ac 3518 # OFPT_PACKET_IN, OFPR_PACKET_OUT (controller_id=0)
98090482 3519 ovs-ofctl -O OpenFlow14 -v packet-out br0 none controller '0001020304050010203040501234'
331c07ac
YHW
3520 if test X"$1" = X"OFPR_PACKET_OUT"; then shift;
3521 echo >>expout "OFPT_PACKET_IN (OF1.4): total_len=14 in_port=ANY (via packet_out) data_len=14 (unbuffered)
98090482
NR
3522vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1234"
3523 fi
3524
e19a6769
YHW
3525 # OFPT_PACKET_IN, OFPR_ACTION_SET (controller_id=0)
3526 ovs-ofctl -O OpenFlow14 add-flow br0 'in_port=10 actions=write_actions(output(CONTROLLER))'
3527 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)'
3528 if test X"$1" = X"OFPR_ACTION_SET"; then shift;
3529 echo >>expout "OFPT_PACKET_IN (OF1.4): cookie=0x0 total_len=14 in_port=10 (via action_set) data_len=14 (unbuffered)
3530vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1234"
3531 fi
3532
98090482
NR
3533 # OFPT_PACKET_IN, OFPR_NO_MATCH (controller_id=123)
3534 ovs-ofctl -O OpenFlow14 -v packet-out br0 none 'controller(reason=no_match,id=123)' '0001020304050010203040501234'
3535 if test X"$1" = X"OFPR_NO_MATCH"; then shift;
3536 echo >>expout "OFPT_PACKET_IN (OF1.4): total_len=14 in_port=ANY (via no_match) data_len=14 (unbuffered)
3537vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1234"
3538 fi
3539
3540 # OFPT_PACKET_IN, OFPR_INVALID_TTL (controller_id=0)
3541 ovs-ofctl -O OpenFlow14 packet-out br0 none dec_ttl '002583dfb4000026b98cb0f908004500003eb7e200000011339bac11370dac100002d7730035002b8f6d86fb0100000100000000000006626c702d7873066e696369726103636f6d00000f00'
3542 if test X"$1" = X"OFPR_INVALID_TTL"; then shift;
3543 echo >>expout "OFPT_PACKET_IN (OF1.4): total_len=76 in_port=ANY (via invalid_ttl) data_len=76 (unbuffered)
3544udp,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"
3545 fi
3546
3547# OFPT_PORT_STATUS, OFPPR_ADD
3548 ovs-vsctl add-port br0 test -- set Interface test type=dummy
3549 if test X"$1" = X"OFPPR_ADD"; then shift;
3550 echo >>expout "OFPT_PORT_STATUS (OF1.4): ADD: ${INDEX}(test): addr:aa:55:aa:55:00:0x
3551 config: PORT_DOWN
3552 state: LINK_DOWN
3553 speed: 0 Mbps now, 0 Mbps max"
3554 fi
3555
3556 # OFPT_PORT_STATUS, OFPPR_MODIFY
3557 ovs-ofctl -O OpenFlow14 -vwarn mod-port br0 test up
3558 if test X"$1" = X"OFPPR_MODIFY"; then shift;
3559 echo >>expout "OFPT_PORT_STATUS (OF1.4): MOD: ${INDEX}(test): addr:aa:55:aa:55:00:0x
3560 config: 0
3561 state: LINK_DOWN
3562 speed: 0 Mbps now, 0 Mbps max
3563OFPT_PORT_STATUS (OF1.4): MOD: ${INDEX}(test): addr:aa:55:aa:55:00:0x
3564 config: 0
f73b83fd 3565 state: LIVE
98090482
NR
3566 speed: 0 Mbps now, 0 Mbps max"
3567 fi
3568
3569 # OFPT_PORT_STATUS, OFPPR_DELETE
3570 ovs-vsctl del-port br0 test
3571 if test X"$1" = X"OFPPR_DELETE"; then shift;
3572 echo >>expout "OFPT_PORT_STATUS (OF1.4): DEL: ${INDEX}(test): addr:aa:55:aa:55:00:0x
3573 config: 0
f73b83fd 3574 state: LIVE
98090482
NR
3575 speed: 0 Mbps now, 0 Mbps max"
3576 fi
3577
3578 # OFPT_FLOW_REMOVED, OFPRR_DELETE
3579 ovs-ofctl -O OpenFlow14 add-flow br0 send_flow_rem,actions=drop
3580 ovs-ofctl -O OpenFlow14 --strict del-flows br0 ''
3581 if test X"$1" = X"OFPRR_DELETE"; then shift;
3582 echo >>expout "OFPT_FLOW_REMOVED (OF1.4): reason=delete table_id=0"
3583 fi
3584
6c6eedc5 3585 # OFPT_FLOW_REMOVED, OFPRR_GROUP_DELETE
98090482
NR
3586 ovs-ofctl -O OpenFlow14 add-group br0 group_id=1234,type=all,bucket=output:10
3587 ovs-ofctl -O OpenFlow14 add-flow br0 send_flow_rem,actions=group:1234
3588 ovs-ofctl -O OpenFlow14 --strict del-groups br0 group_id=1234
3589 if test X"$1" = X"OFPRR_GROUP_DELETE"; then shift;
3590 echo >>expout "OFPT_FLOW_REMOVED (OF1.4): reason=group_delete table_id=0"
3591 fi
3592
6c6eedc5
SJ
3593 # OFPT_TABLE_STATUS, OFPTR_VACANCY_UP
3594 if test X"$1" = X"OFPTR_VACANCY_UP"; then shift;
3595 ovs-vsctl -- --id=@t1 create Flow_Table flow-limit=10 -- set bridge br0 flow_tables:1=@t1
3596
3597 # Turn on vacancy events, then add flows until we're full.
3598 # With initial vacancy of 100% and vacancy_up of 80%, so that
3599 # vacancy >= vacancy_up, this enables VACANY_DOWN events, so
3600 # we get a single such message when vacancy dips below 20%.
3601 ovs-ofctl -O OpenFlow14 mod-table br0 1 vacancy:20,80
3602 ovs-ofctl -O OpenFlow14 add-flow br0 table=1,in_port=1,actions=2
3603 ovs-ofctl -O OpenFlow14 add-flow br0 table=1,in_port=2,actions=2
3604 ovs-ofctl -O OpenFlow14 add-flow br0 table=1,in_port=3,actions=2
3605 ovs-ofctl -O OpenFlow14 add-flow br0 table=1,in_port=4,actions=2
3606 ovs-ofctl -O OpenFlow14 add-flow br0 table=1,in_port=5,actions=2
3607 ovs-ofctl -O OpenFlow14 add-flow br0 table=1,in_port=6,actions=2
3608 ovs-ofctl -O OpenFlow14 add-flow br0 table=1,in_port=7,actions=2
3609 ovs-ofctl -O OpenFlow14 add-flow br0 table=1,in_port=8,actions=2
3610 ovs-ofctl -O OpenFlow14 add-flow br0 table=1,in_port=9,actions=2
3611 ovs-ofctl -O OpenFlow14 add-flow br0 table=1,in_port=10,actions=2
3612 echo >>expout "OFPT_TABLE_STATUS (OF1.4): reason=VACANCY_DOWN
3613table_desc:-
3614 table 1:
3615 eviction=off eviction_flags=OTHER|IMPORTANCE|LIFETIME
3616 vacancy=on vacancy_down=20% vacancy_up=80% vacancy=10%"
3617 # Then delete flows until we're empty. Sending the
3618 # VACANCY_DOWN message enabled VACANCY_UP events, so we get a
3619 # single such message when vacancy rises above 80%.
3620 ovs-ofctl -O OpenFlow14 del-flows br0 table=1,in_port=1
3621 ovs-ofctl -O OpenFlow14 del-flows br0 table=1,in_port=2
3622 ovs-ofctl -O OpenFlow14 del-flows br0 table=1,in_port=3
3623 ovs-ofctl -O OpenFlow14 del-flows br0 table=1,in_port=4
3624 ovs-ofctl -O OpenFlow14 del-flows br0 table=1,in_port=5
3625 ovs-ofctl -O OpenFlow14 del-flows br0 table=1,in_port=6
3626 ovs-ofctl -O OpenFlow14 del-flows br0 table=1,in_port=7
3627 ovs-ofctl -O OpenFlow14 del-flows br0 table=1,in_port=8
3628 ovs-ofctl -O OpenFlow14 del-flows br0 table=1,in_port=9
3629 ovs-ofctl -O OpenFlow14 del-flows br0 table=1,in_port=10
3630 echo >>expout "OFPT_TABLE_STATUS (OF1.4): reason=VACANCY_UP
3631table_desc:-
3632 table 1:
3633 eviction=off eviction_flags=OTHER|IMPORTANCE|LIFETIME
3634 vacancy=on vacancy_down=20% vacancy_up=80% vacancy=90%"
3635
3636 # Now approach vacancy from the other direction. First
3637 # disable vacancy events. With initial vacancy of 70%, so
3638 # that vacancy < vacancy_up, this enables VACANCY_UP events.
3639 # That means that filling up the table generates no message,
3640 # but deleting all the flows generates VACANCY_UP at the point
3641 # vacancy rises above 80%.
3642 ovs-ofctl -O OpenFlow14 mod-table br0 1 novacancy
3643 ovs-ofctl -O OpenFlow14 add-flow br0 table=1,in_port=1,actions=2
3644 ovs-ofctl -O OpenFlow14 add-flow br0 table=1,in_port=2,actions=2
3645 ovs-ofctl -O OpenFlow14 add-flow br0 table=1,in_port=3,actions=2
3646 ovs-ofctl -O OpenFlow14 mod-table br0 1 vacancy:20,80
3647 ovs-ofctl -O OpenFlow14 add-flow br0 table=1,in_port=4,actions=2
3648 ovs-ofctl -O OpenFlow14 add-flow br0 table=1,in_port=5,actions=2
3649 ovs-ofctl -O OpenFlow14 add-flow br0 table=1,in_port=6,actions=2
3650 ovs-ofctl -O OpenFlow14 add-flow br0 table=1,in_port=7,actions=2
3651 ovs-ofctl -O OpenFlow14 add-flow br0 table=1,in_port=8,actions=2
3652 ovs-ofctl -O OpenFlow14 add-flow br0 table=1,in_port=9,actions=2
3653 ovs-ofctl -O OpenFlow14 add-flow br0 table=1,in_port=10,actions=2
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 fi
3670
98090482
NR
3671 AT_FAIL_IF([test X"$1" != X])
3672
93358108 3673 OVS_WAIT_UNTIL([test `wc -l < "monitor.log"` -ge `wc -l < "expout"`])
98090482
NR
3674
3675 AT_CHECK(
3676 [[sed '
3677s/ (xid=0x[0-9a-fA-F]*)//
3678s/ *duration.*//
3679s/00:0.$/00:0x/' < monitor.log]],
3680 [0], [expout])
3681}
3682
3683# It's a service connection so initially there should be no async messages.
3684check_async 1
3685
3686# Set miss_send_len to 128, turning on packet-ins for our service connection.
3687ovs-appctl -t ovs-ofctl ofctl/send 0509000c0123456700000080
331c07ac 3688check_async 2 OFPR_PACKET_OUT OFPR_ACTION_SET OFPPR_ADD OFPPR_MODIFY OFPPR_DELETE OFPRR_DELETE OFPRR_GROUP_DELETE
98090482
NR
3689
3690# Become slave (OF 1.4), which should disable everything except port status.
3691ovs-appctl -t ovs-ofctl ofctl/send 051800180000000200000003000000000000000000000001
3692check_async 3 OFPPR_ADD OFPPR_MODIFY OFPPR_DELETE
3693
3694# Use OF 1.4 OFPT_SET_ASYNC to enable a patchwork of asynchronous messages.
331c07ac 3695ovs-appctl -t ovs-ofctl ofctl/send 051c0040000000020000000800000005000100080000002000020008000000020003000800000005000400080000001c00050008000000050008000800000018
6c6eedc5 3696check_async 4 OFPR_INVALID_TTL OFPPR_DELETE OFPRR_DELETE OFPRR_GROUP_DELETE OFPTR_VACANCY_UP
98090482
NR
3697
3698# Set controller ID 123.
3699ovs-appctl -t ovs-ofctl ofctl/send 05040018000000030000232000000014000000000000007b
3700check_async 5 OFPR_NO_MATCH OFPPR_DELETE OFPRR_DELETE OFPRR_GROUP_DELETE
3701
3702# Restore controller ID 0.
3703ovs-appctl -t ovs-ofctl ofctl/send 050400180000000300002320000000140000000000000000
3704
3705# Become master (OF 1.4).
3706ovs-appctl -t ovs-ofctl ofctl/send 051800180000000400000002000000000000000000000002
331c07ac 3707check_async 6 OFPR_PACKET_OUT OFPPR_ADD OFPPR_MODIFY OFPRR_DELETE
98090482 3708
d9c8c57c 3709OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
98090482
NR
3710OVS_VSWITCHD_STOP
3711AT_CLEANUP
3712
ebeae5db
JT
3713AT_SETUP([ofproto - asynchronous message control (OpenFlow 1.5)])
3714OVS_VSWITCHD_START
6409e008 3715AT_CHECK([ovs-ofctl -O OpenFlow15 -P standard monitor br0 --detach --no-chdir --pidfile])
ebeae5db
JT
3716check_async () {
3717 printf '\n\n--- check_async %d ---\n\n\n' $1
3718 INDEX=$1
3719 shift
3720
3721 ovs-appctl -t ovs-ofctl ofctl/barrier
3722 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
3723 : > expout
3724
3725 # Other tests are not working with OF 1.5, and message
3726 # format may change, so leave them out.
3727
3728 # OFPT_PORT_STATUS, OFPPR_ADD
3729 ovs-vsctl add-port br0 test -- set Interface test type=dummy
3730 if test X"$1" = X"OFPPR_ADD"; then shift;
3731 echo >>expout "OFPT_PORT_STATUS (OF1.5): ADD: ${INDEX}(test): addr:aa:55:aa:55:00:0x
3732 config: PORT_DOWN
3733 state: LINK_DOWN
3734 speed: 0 Mbps now, 0 Mbps max"
3735 fi
3736
3737 # OFPT_PORT_STATUS, OFPPR_MODIFY
3738 ovs-ofctl -O OpenFlow15 -vwarn mod-port br0 test up
3739 if test X"$1" = X"OFPPR_MODIFY"; then shift;
3740 echo >>expout "OFPT_PORT_STATUS (OF1.5): MOD: ${INDEX}(test): addr:aa:55:aa:55:00:0x
3741 config: 0
3742 state: LINK_DOWN
3743 speed: 0 Mbps now, 0 Mbps max
3744OFPT_PORT_STATUS (OF1.5): MOD: 2(test): addr:aa:55:aa:55:00:0x
3745 config: 0
f73b83fd 3746 state: LIVE
ebeae5db
JT
3747 speed: 0 Mbps now, 0 Mbps max"
3748 fi
3749
3750 # OFPT_PORT_STATUS, OFPPR_DELETE
3751 ovs-vsctl del-port br0 test
3752 if test X"$1" = X"OFPPR_DELETE"; then shift;
3753 echo >>expout "OFPT_PORT_STATUS (OF1.5): DEL: ${INDEX}(test): addr:aa:55:aa:55:00:0x
3754 config: 0
f73b83fd 3755 state: LIVE
ebeae5db
JT
3756 speed: 0 Mbps now, 0 Mbps max"
3757 fi
3758
3759 AT_FAIL_IF([test X"$1" != X])
3760
93358108 3761 OVS_WAIT_UNTIL([test `wc -l < "monitor.log"` -ge `wc -l < "expout"`])
ebeae5db
JT
3762
3763 AT_CHECK(
3764 [[sed '
3765s/ (xid=0x[0-9a-fA-F]*)//
3766s/ *duration.*//
3767s/00:0.$/00:0x/' < monitor.log]],
3768 [0], [expout])
3769}
3770
3771# It's a service connection so initially there should be no async messages.
3772check_async 1
3773
3774# If we don't set this, async messages are not received.
3775# Set miss_send_len to 128, turning on packet-ins for our service connection.
3776ovs-appctl -t ovs-ofctl ofctl/send 0609000c0123456700000080
3777check_async 2 OFPPR_ADD OFPPR_MODIFY OFPPR_DELETE
3778
3779# Set-async has changed in OF 1.4 and is not yet implemented.
3780
d9c8c57c 3781OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
ebeae5db
JT
3782OVS_VSWITCHD_STOP
3783AT_CLEANUP
3784
6ea4776b
JR
3785dnl This test checks that the role request/response messaging works
3786dnl and that generation_id is handled properly.
3787AT_SETUP([ofproto - controller role (OpenFlow 1.2)])
3788OVS_VSWITCHD_START
53eb8cb8 3789on_exit 'kill `cat c1.pid c2.pid`'
6751a4b4
BP
3790
3791# Start two ovs-ofctl controller processes.
3792AT_CAPTURE_FILE([monitor1.log])
3793AT_CAPTURE_FILE([expout1])
3794AT_CAPTURE_FILE([experr1])
3795AT_CAPTURE_FILE([monitor2.log])
3796AT_CAPTURE_FILE([expout2])
3797AT_CAPTURE_FILE([experr2])
3798for i in 1 2; do
56120500 3799 AT_CHECK([ovs-ofctl -O OpenFlow12 monitor br0 --detach --no-chdir --pidfile=c$i.pid --unixctl=c$i])
6751a4b4
BP
3800 ovs-appctl -t `pwd`/c$i ofctl/barrier
3801 ovs-appctl -t `pwd`/c$i ofctl/set-output-file monitor$i.log
3802 : > expout$i
3803 : > experr$i
3804
3805 # find out current role
3806 ovs-appctl -t `pwd`/c$i ofctl/send 031800180000000200000000000000000000000000000000
3807 echo >>experr$i "send: OFPT_ROLE_REQUEST (OF1.2): role=nochange"
3808 echo >>expout$i "OFPT_ROLE_REPLY (OF1.2): role=equal"
3809done
6ea4776b 3810
6751a4b4
BP
3811# controller 1: Become slave (generation_id is initially undefined, so
3812# 2^63+2 should not be stale)
3813ovs-appctl -t `pwd`/c1 ofctl/send 031800180000000300000003000000008000000000000002
3814echo >>experr1 "send: OFPT_ROLE_REQUEST (OF1.2): role=slave generation_id=9223372036854775810"
3815echo >>expout1 "OFPT_ROLE_REPLY (OF1.2): role=slave generation_id=9223372036854775810"
3816
3817# controller 2: Become master.
3818ovs-appctl -t `pwd`/c2 ofctl/send 031800180000000300000002000000008000000000000003
3819echo >>experr2 "send: OFPT_ROLE_REQUEST (OF1.2): role=master generation_id=9223372036854775811"
3820echo >>expout2 "OFPT_ROLE_REPLY (OF1.2): role=master generation_id=9223372036854775811"
3821
3822# controller 1: Try to become the master using a stale generation ID
3823ovs-appctl -t `pwd`/c1 ofctl/send 031800180000000400000002000000000000000000000003
3824echo >>experr1 "send: OFPT_ROLE_REQUEST (OF1.2): role=master generation_id=3"
3825echo >>expout1 "OFPT_ERROR (OF1.2): OFPRRFC_STALE"
3826echo >>expout1 "OFPT_ROLE_REQUEST (OF1.2): role=master generation_id=3"
3827
3828# controller 1: Become master using a valid generation ID
3829ovs-appctl -t `pwd`/c1 ofctl/send 031800180000000500000002000000000000000000000001
3830echo >>experr1 "send: OFPT_ROLE_REQUEST (OF1.2): role=master generation_id=1"
3831echo >>expout1 "OFPT_ROLE_REPLY (OF1.2): role=master generation_id=1"
3832
3833for i in 1 2; do
3834 ovs-appctl -t `pwd`/c$i ofctl/barrier
3835 echo >>expout$i "OFPT_BARRIER_REPLY (OF1.2):"
3836done
6ea4776b 3837
6751a4b4
BP
3838# Check output.
3839for i in 1 2; do
3840 cp expout$i expout
8a32aaa5 3841 AT_CHECK([grep -v '^send:' monitor$i.log | strip_xids], [0], [expout])
6751a4b4 3842 cp experr$i expout
8a32aaa5 3843 AT_CHECK([grep '^send:' monitor$i.log | strip_xids], [0], [expout])
6751a4b4
BP
3844done
3845OVS_VSWITCHD_STOP
3846AT_CLEANUP
6ea4776b 3847
6751a4b4
BP
3848dnl This test checks that the role request/response messaging works,
3849dnl that generation_id is handled properly, and that role status update
3850dnl messages are sent when a controller's role gets changed from master
3851dnl to slave.
3852AT_SETUP([ofproto - controller role (OpenFlow 1.4)])
3853OVS_VSWITCHD_START
53eb8cb8 3854on_exit 'kill `cat c1.pid c2.pid`'
6751a4b4
BP
3855
3856# Start two ovs-ofctl controller processes.
3857AT_CAPTURE_FILE([monitor1.log])
3858AT_CAPTURE_FILE([expout1])
3859AT_CAPTURE_FILE([experr1])
3860AT_CAPTURE_FILE([monitor2.log])
3861AT_CAPTURE_FILE([expout2])
3862AT_CAPTURE_FILE([experr2])
3863for i in 1 2; do
56120500 3864 AT_CHECK([ovs-ofctl -O OpenFlow14 monitor br0 --detach --no-chdir --pidfile=c$i.pid --unixctl=c$i])
6751a4b4
BP
3865 ovs-appctl -t `pwd`/c$i ofctl/barrier
3866 ovs-appctl -t `pwd`/c$i ofctl/set-output-file monitor$i.log
3867 : > expout$i
3868 : > experr$i
3869
3870 # find out current role
3871 ovs-appctl -t `pwd`/c$i ofctl/send 051800180000000200000000000000000000000000000000
3872 echo >>experr$i "send: OFPT_ROLE_REQUEST (OF1.4): role=nochange"
3873 echo >>expout$i "OFPT_ROLE_REPLY (OF1.4): role=equal"
3874done
6ea4776b 3875
6751a4b4
BP
3876# controller 1: Become slave (generation_id is initially undefined, so
3877# 2^63+2 should not be stale)
3878ovs-appctl -t `pwd`/c1 ofctl/send 051800180000000300000003000000008000000000000002
3879echo >>experr1 "send: OFPT_ROLE_REQUEST (OF1.4): role=slave generation_id=9223372036854775810"
3880echo >>expout1 "OFPT_ROLE_REPLY (OF1.4): role=slave generation_id=9223372036854775810"
3881
3882# controller 2: Become master.
3883ovs-appctl -t `pwd`/c2 ofctl/send 051800180000000300000002000000008000000000000003
3884echo >>experr2 "send: OFPT_ROLE_REQUEST (OF1.4): role=master generation_id=9223372036854775811"
3885echo >>expout2 "OFPT_ROLE_REPLY (OF1.4): role=master generation_id=9223372036854775811"
3886
3887# controller 1: Try to become the master using a stale generation ID
3888ovs-appctl -t `pwd`/c1 ofctl/send 051800180000000400000002000000000000000000000003
3889echo >>experr1 "send: OFPT_ROLE_REQUEST (OF1.4): role=master generation_id=3"
3890echo >>expout1 "OFPT_ERROR (OF1.4): OFPRRFC_STALE"
3891echo >>expout1 "OFPT_ROLE_REQUEST (OF1.4): role=master generation_id=3"
3892
3893# controller 1: Become master using a valid generation ID
3894ovs-appctl -t `pwd`/c1 ofctl/send 051800180000000500000002000000000000000000000001
3895echo >>experr1 "send: OFPT_ROLE_REQUEST (OF1.4): role=master generation_id=1"
3896echo >>expout1 "OFPT_ROLE_REPLY (OF1.4): role=master generation_id=1"
3897echo >>expout2 "OFPT_ROLE_STATUS (OF1.4): role=slave generation_id=1 reason=master_request"
3898
3899for i in 1 2; do
3900 ovs-appctl -t `pwd`/c$i ofctl/barrier
3901 echo >>expout$i "OFPT_BARRIER_REPLY (OF1.4):"
3902done
6ea4776b 3903
6751a4b4
BP
3904# Check output.
3905for i in 1 2; do
3906 cp expout$i expout
8a32aaa5 3907 AT_CHECK([grep -v '^send:' monitor$i.log | strip_xids], [0], [expout])
6751a4b4 3908 cp experr$i expout
8a32aaa5 3909 AT_CHECK([grep '^send:' monitor$i.log | strip_xids], [0], [expout])
6751a4b4 3910done
6ea4776b
JR
3911OVS_VSWITCHD_STOP
3912AT_CLEANUP
3913
3c35db62
NR
3914dnl This test checks the Group and meter notifications when a group mod
3915dnl command is sent from one controller and the reply is received by
3916dnl other controllers.
3917AT_SETUP([ofproto - requestforward (OpenFlow 1.4)])
3918OVS_VSWITCHD_START
3919on_exit 'kill `cat c1.pid c2.pid c3.pid`'
3920
3921# Start two ovs-ofctl controller processes.
3922AT_CAPTURE_FILE([monitor1.log])
3923AT_CAPTURE_FILE([expout1])
3924AT_CAPTURE_FILE([monitor2.log])
3925AT_CAPTURE_FILE([expout2])
3926AT_CAPTURE_FILE([monitor3.log])
3927AT_CAPTURE_FILE([expout3])
3928
56120500
BP
3929ovs-ofctl -O OpenFlow15 monitor br0 --detach --no-chdir --pidfile=c1.pid --unixctl=c1
3930ovs-ofctl -O OpenFlow14 monitor br0 --detach --no-chdir --pidfile=c2.pid --unixctl=c2
3931ovs-ofctl -O OpenFlow14 monitor br0 --detach --no-chdir --pidfile=c3.pid --unixctl=c3
3c35db62
NR
3932
3933check_async () {
3934 for i in 1 3; do
3935 ovs-appctl -t `pwd`/c$i ofctl/barrier
3936 ovs-appctl -t `pwd`/c$i ofctl/set-output-file monitor$i.log
3937 : > expout$i
3938 done
3939
3940 printf '\n\n--- check_async %d ---\n\n\n' $1
3941 INDEX=$1
3942 shift
3943
3944 # OFPGC_ADD
63eded98 3945 ovs-appctl -t `pwd`/c2 ofctl/send "050f0020000000020000000000000001 00100000 ffffffffffffffff 00000000"
3c35db62
NR
3946 if test X"$1" = X"OFPGC_ADD"; then shift;
3947 echo >>expout2 "send: OFPT_GROUP_MOD (OF1.4):
63eded98 3948 ADD group_id=1,type=all,bucket=actions=drop"
3c35db62 3949 echo >>expout1 "OFPT_REQUESTFORWARD (OF1.5): reason=group_mod
63eded98 3950 ADD group_id=1,type=all,bucket=bucket_id:0,actions=drop"
3c35db62 3951 echo >>expout3 "OFPT_REQUESTFORWARD (OF1.4): reason=group_mod
63eded98 3952 ADD group_id=1,type=all,bucket=actions=drop"
3c35db62
NR
3953 fi
3954
3955 # OFPGC_MODIFY
63eded98 3956 ovs-appctl -t `pwd`/c2 ofctl/send "050f0020000000020001010000000001 00100000 ffffffffffffffff 00000000"
3c35db62
NR
3957 if test X"$1" = X"OFPGC_MODIFY"; then shift;
3958 echo >>expout2 "send: OFPT_GROUP_MOD (OF1.4):
63eded98 3959 MOD group_id=1,type=select,bucket=weight:0,actions=drop"
3c35db62 3960 echo >>expout1 "OFPT_REQUESTFORWARD (OF1.5): reason=group_mod
63eded98 3961 MOD group_id=1,type=select,bucket=bucket_id:0,weight:0,actions=drop"
3c35db62 3962 echo >>expout3 "OFPT_REQUESTFORWARD (OF1.4): reason=group_mod
63eded98 3963 MOD group_id=1,type=select,bucket=weight:0,actions=drop"
3c35db62
NR
3964 fi
3965
3966 ovs-appctl -t `pwd`/c1 ofctl/barrier
3967 echo >>expout1 "OFPT_BARRIER_REPLY (OF1.5):"
3968 ovs-appctl -t `pwd`/c2 ofctl/barrier
3969 echo >>expout2 "OFPT_BARRIER_REPLY (OF1.4):"
3970 ovs-appctl -t `pwd`/c3 ofctl/barrier
3971 echo >>expout3 "OFPT_BARRIER_REPLY (OF1.4):"
3972
3973 # Check output.
3974 for i in 1 3; do
3975 cp expout$i expout
3976 AT_CHECK(
3977 [[sed '
3978s/ (xid=0x[0-9a-fA-F]*)//'< monitor$i.log]],
3979 [0], [expout])
3980 done
3981}
3982
3983# controller 1: Become slave
3984ovs-appctl -t `pwd`/c1 ofctl/send 061800180000000300000003000000008000000000000002
3985
3986# controller 2: Become master
3987ovs-appctl -t `pwd`/c2 ofctl/send 051800180000000300000002000000008000000000000003
3988
3989# controller 1: Become slave
3990ovs-appctl -t `pwd`/c3 ofctl/send 051800180000000300000003000000008000000000000004
3991
3992# controller 1: Enabled requestforward using set Asynchronous message
3993ovs-appctl -t `pwd`/c1 ofctl/send 061c00280000000200000008000000050002000800000002000400080000001a000a000800000003
3994
3995# controller 2: Enabled requestforward using set Asynchronous message
3996ovs-appctl -t `pwd`/c2 ofctl/send 051c002800000002000100080000000200030008000000050005000800000005000b000800000003
3997
3998# controller 1: Enabled requestforward using set Asynchronous message
3999ovs-appctl -t `pwd`/c3 ofctl/send 051c00280000000200000008000000050002000800000002000400080000001a000a000800000003
4000check_async 1 OFPGC_ADD OFPGC_MODIFY
4001
4002OVS_VSWITCHD_STOP
4003AT_CLEANUP
4004
751c7785
BP
4005dnl This test checks that OFPT_PACKET_OUT accepts both OFPP_NONE (as
4006dnl specified by OpenFlow 1.0) and OFPP_CONTROLLER (used by some
4007dnl controllers despite the spec) as meaning a packet that was generated
4008dnl by the controller.
9dcd1c00 4009AT_SETUP([ofproto - packet-out from controller (OpenFlow 1.0)])
751c7785 4010OVS_VSWITCHD_START
ca5792f0 4011add_of_ports br0 1
751c7785
BP
4012
4013# Start a monitor listening for packet-ins.
6409e008 4014AT_CHECK([ovs-ofctl -P standard monitor br0 --detach --no-chdir --pidfile])
751c7785
BP
4015ovs-appctl -t ovs-ofctl ofctl/send 0109000c0123456700000080
4016ovs-appctl -t ovs-ofctl ofctl/barrier
4017ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
4018AT_CAPTURE_FILE([monitor.log])
4019
4020# Send some packet-outs with OFPP_NONE and OFPP_CONTROLLER (65533) as in_port.
6dd3c787
JR
4021AT_CHECK([ovs-ofctl packet-out br0 "in_port=none packet=0001020304050010203040501234 actions=controller,1"])
4022AT_CHECK([ovs-ofctl packet-out br0 "in_port=controller packet=0001020304050010203040505678 actions=controller,1"])
751c7785
BP
4023
4024# Stop the monitor and check its output.
4025ovs-appctl -t ovs-ofctl ofctl/barrier
d9c8c57c 4026OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
751c7785 4027
586ddea5
BP
4028ovs-ofctl dump-ports br0
4029
751c7785 4030AT_CHECK([sed 's/ (xid=0x[[0-9a-fA-F]]*)//' monitor.log], [0], [dnl
7f05e7ab 4031OFPT_PACKET_IN: total_len=14 in_port=ANY (via action) data_len=14 (unbuffered)
e6d9ab56 4032vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1234
751c7785 4033OFPT_PACKET_IN: total_len=14 in_port=CONTROLLER (via action) data_len=14 (unbuffered)
e6d9ab56 4034vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x5678
969fc56c
JS
4035OFPT_BARRIER_REPLY:
4036])
4037
4038OVS_VSWITCHD_STOP
4039AT_CLEANUP
4040
9dcd1c00
SH
4041dnl This test checks that OFPT_PACKET_OUT accepts both OFPP_NONE (as
4042dnl specified by OpenFlow 1.2) and OFPP_CONTROLLER (used by some
4043dnl controllers despite the spec) as meaning a packet that was generated
4044dnl by the controller.
4045AT_SETUP([ofproto - packet-out from controller (OpenFlow 1.2)])
4046OVS_VSWITCHD_START
4047
4048# Start a monitor listening for packet-ins.
6409e008 4049AT_CHECK([ovs-ofctl -O OpenFlow12 -P standard monitor br0 --detach --no-chdir --pidfile])
9dcd1c00
SH
4050ovs-appctl -t ovs-ofctl ofctl/send 0309000c0123456700000080
4051ovs-appctl -t ovs-ofctl ofctl/barrier
4052ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
4053AT_CAPTURE_FILE([monitor.log])
4054
4055# Send some packet-outs with OFPP_NONE and OFPP_CONTROLLER (65533) as in_port.
4056AT_CHECK([ovs-ofctl -O OpenFlow12 packet-out br0 none controller '0001020304050010203040501234'])
4057AT_CHECK([ovs-ofctl -O OpenFlow12 packet-out br0 4294967293 controller '0001020304050010203040505678'])
4058
4059# Stop the monitor and check its output.
4060ovs-appctl -t ovs-ofctl ofctl/barrier
d9c8c57c 4061OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
9dcd1c00
SH
4062
4063AT_CHECK([sed 's/ (xid=0x[[0-9a-fA-F]]*)//' monitor.log], [0], [dnl
4064OFPT_PACKET_IN (OF1.2): total_len=14 in_port=ANY (via action) data_len=14 (unbuffered)
e6d9ab56 4065vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1234
9dcd1c00 4066OFPT_PACKET_IN (OF1.2): total_len=14 in_port=CONTROLLER (via action) data_len=14 (unbuffered)
e6d9ab56 4067vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x5678
9dcd1c00
SH
4068OFPT_BARRIER_REPLY (OF1.2):
4069])
4070
4071OVS_VSWITCHD_STOP
4072AT_CLEANUP
4073
4d197ebb
BP
4074dnl This test checks that OFPT_PACKET_OUT accepts both OFPP_NONE (as
4075dnl specified by OpenFlow 1.1) and OFPP_CONTROLLER (used by some
4076dnl controllers despite the spec) as meaning a packet that was generated
4077dnl by the controller.
4078AT_SETUP([ofproto - packet-out from controller (OpenFlow 1.1)])
4079OVS_VSWITCHD_START
4080
4081# Start a monitor listening for packet-ins.
6409e008 4082AT_CHECK([ovs-ofctl -O OpenFlow11 -P standard monitor br0 --detach --no-chdir --pidfile])
4d197ebb
BP
4083ovs-appctl -t ovs-ofctl ofctl/send 0209000c0123456700000080
4084ovs-appctl -t ovs-ofctl ofctl/barrier
4085ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
4086AT_CAPTURE_FILE([monitor.log])
4087
6dd3c787
JR
4088# Send some packet-outs with OFPP_NONE and OFPP_CONTROLLER as in_port.
4089AT_CHECK([ovs-appctl -t ovs-ofctl ofctl/packet-out "in_port=none, packet=0001020304050010203040501234 actions=controller"])
4090AT_CHECK([ovs-appctl -t ovs-ofctl ofctl/packet-out "in_port=controller packet=0001020304050010203040505678 actions=controller"])
4d197ebb
BP
4091
4092# Stop the monitor and check its output.
4093ovs-appctl -t ovs-ofctl ofctl/barrier
d9c8c57c 4094OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
4d197ebb 4095
6dd3c787
JR
4096AT_CHECK([sed 's/ (xid=0x[[0-9a-fA-F]]*)//
4097/PACKET_OUT/d' monitor.log], [0], [dnl
4d197ebb 4098OFPT_PACKET_IN (OF1.1): total_len=14 in_port=ANY (via action) data_len=14 (unbuffered)
e6d9ab56 4099vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1234
4d197ebb 4100OFPT_PACKET_IN (OF1.1): total_len=14 in_port=CONTROLLER (via action) data_len=14 (unbuffered)
e6d9ab56 4101vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x5678
4d197ebb
BP
4102OFPT_BARRIER_REPLY (OF1.1):
4103])
4104
4105OVS_VSWITCHD_STOP
4106AT_CLEANUP
4107
880b1458
YHW
4108AT_SETUP([ofproto - packet-out from controller (OpenFlow 1.5)])
4109OVS_VSWITCHD_START
4110
4111# Start a monitor listening for packet-ins.
4112AT_CHECK([ovs-ofctl -O OpenFlow15 -P standard monitor br0 --detach --no-chdir --pidfile])
4113ovs-appctl -t ovs-ofctl ofctl/send 0609000c0123456700000080
4114ovs-appctl -t ovs-ofctl ofctl/barrier
4115ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
4116AT_CAPTURE_FILE([monitor.log])
4117
4118# Send some packet-outs with OFPP_NONE and OFPP_CONTROLLER (65533) as in_port.
4119AT_CHECK([ovs-ofctl -O OpenFlow15 packet-out br0 "in_port=none tun_id=0x11 metadata=0x22 packet=0001020304050010203040501234 actions=controller"])
4120AT_CHECK([ovs-ofctl -O OpenFlow15 packet-out br0 "in_port=controller tun_id=0x11 metadata=0x33 packet=0001020304050010203040505678 actions=controller"])
4121
4122# Stop the monitor and check its output.
4123ovs-appctl -t ovs-ofctl ofctl/barrier
4124OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
4125
4126AT_CHECK([sed 's/ (xid=0x[[0-9a-fA-F]]*)//' monitor.log], [0], [dnl
4127OFPT_PACKET_IN (OF1.5): total_len=14 tun_id=0x11,metadata=0x22,in_port=ANY (via packet_out) data_len=14 (unbuffered)
4128vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1234
4129OFPT_PACKET_IN (OF1.5): total_len=14 tun_id=0x11,metadata=0x33,in_port=CONTROLLER (via packet_out) data_len=14 (unbuffered)
4130vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x5678
4131OFPT_BARRIER_REPLY (OF1.5):
4132])
4133
4134OVS_VSWITCHD_STOP
4135AT_CLEANUP
4136
bdcad671
BP
4137dnl This test checks that metadata and userdata are encoded in NXT_PACKET_IN2.
4138AT_SETUP([ofproto - packet-out with metadata and userdata (NXT_PACKET_IN2)])
6409e008
BP
4139OVS_VSWITCHD_START
4140
4141# Start a monitor listening for packet-ins.
4142AT_CHECK([ovs-ofctl -P nxt_packet_in2 monitor br0 --detach --no-chdir --pidfile])
4143ovs-appctl -t ovs-ofctl ofctl/send 0109000c0123456700000080
4144ovs-appctl -t ovs-ofctl ofctl/barrier
4145ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
4146AT_CAPTURE_FILE([monitor.log])
4147
4148# Send a packet-out with a load action to set some metadata, and forward to controller
6dd3c787 4149AT_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
4150
4151# Stop the monitor and check its output.
4152ovs-appctl -t ovs-ofctl ofctl/barrier
d9c8c57c 4153OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
6409e008
BP
4154
4155AT_CHECK([sed 's/ (xid=0x[[0-9a-fA-F]]*)//' monitor.log], [0], [dnl
4156NXT_PACKET_IN2: total_len=14 pkt_mark=0xaa,metadata=0xfafafafa5a5a5a5a,in_port=CONTROLLER (via action) data_len=14 (unbuffered)
bdcad671 4157 userdata=01.02.03.04.05
6409e008
BP
4158vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1234
4159OFPT_BARRIER_REPLY:
4160])
4161
4162OVS_VSWITCHD_STOP
4163AT_CLEANUP
4164
cb1145d1
ZB
4165dnl This test checks that 1.5 packet_out is properly encoded/decoded.
4166AT_SETUP([ofproto - packet-out with set_field metadata (OpenFlow 1.5)])
4167OVS_VSWITCHD_START
4168
4169# Start a monitor listening for packet-ins.
4170AT_CHECK([ovs-ofctl -P standard -O OpenFlow13 monitor br0 --detach --no-chdir --pidfile])
4171ovs-appctl -t ovs-ofctl ofctl/send 0409000c0123456700000080
4172ovs-appctl -t ovs-ofctl ofctl/barrier
4173ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
4174AT_CAPTURE_FILE([monitor.log])
4175
4176# Send a packet-out with a couple of set-field action to set some metadata, and forward to controller
4177AT_CHECK([ovs-ofctl -O OpenFlow15 packet-out br0 CONTROLLER 'set_field:0xfafafafa5a5a5a5a->metadata, controller' '0001020304050010203040501234'])
4178
4179# Stop the monitor and check its output.
4180ovs-appctl -t ovs-ofctl ofctl/barrier
4181ovs-appctl -t ovs-ofctl exit
4182
4183AT_CHECK([sed 's/ (xid=0x[[0-9a-fA-F]]*)//' monitor.log], [0], [dnl
4184OFPT_PACKET_IN (OF1.3): total_len=14 metadata=0xfafafafa5a5a5a5a,in_port=CONTROLLER (via action) data_len=14 (unbuffered)
4185vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1234
4186OFPT_BARRIER_REPLY (OF1.3):
4187])
4188
4189OVS_VSWITCHD_STOP
4190AT_CLEANUP
4191
4192dnl This test checks that packet_type PT_ETH is properly encoded/decoded in 1.5 packet_out.
4193AT_SETUP([ofproto - packet-out with set_field metadata with packet_type PT_ETH (OpenFlow 1.5)])
4194OVS_VSWITCHD_START
4195
4196# Start a monitor listening for packet-ins.
4197AT_CHECK([ovs-ofctl -P standard -O OpenFlow13 monitor br0 --detach --no-chdir --pidfile])
4198ovs-appctl -t ovs-ofctl ofctl/send 0409000c0123456700000080
4199ovs-appctl -t ovs-ofctl ofctl/barrier
4200ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
4201AT_CAPTURE_FILE([monitor.log])
4202
4203# Send a packet-out with a couple of set-field action to set some metadata, and forward to controller
4204AT_CHECK([ovs-ofctl -O OpenFlow15 packet-out br0 "in_port=controller packet=0001020304050010203040501234 packet_type(0,0x0) actions=set_field:0xfafafafa5a5a5a5a->metadata,controller"])
4205
4206# Stop the monitor and check its output.
4207ovs-appctl -t ovs-ofctl ofctl/barrier
4208ovs-appctl -t ovs-ofctl exit
4209
4210AT_CHECK([sed 's/ (xid=0x[[0-9a-fA-F]]*)//' monitor.log], [0], [dnl
4211OFPT_PACKET_IN (OF1.3): total_len=14 metadata=0xfafafafa5a5a5a5a,in_port=CONTROLLER (via action) data_len=14 (unbuffered)
4212vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1234
4213OFPT_BARRIER_REPLY (OF1.3):
4214])
4215
4216OVS_VSWITCHD_STOP
4217AT_CLEANUP
4218
4219dnl This test checks that packet_type PT_IPV4 is properly encoded/decoded in 1.5 packet_out.
4220AT_SETUP([ofproto - packet-out with set_field metadata with packet_type PT_IPV4 on PTAP bridge (OpenFlow 1.5)])
4221OVS_VSWITCHD_START
4222
4223# Start a monitor listening for packet-ins.
4224AT_CHECK([ovs-ofctl -P standard -O OpenFlow13 monitor br0 --detach --no-chdir --pidfile])
4225ovs-appctl -t ovs-ofctl ofctl/send 0409000c0123456700000080
4226ovs-appctl -t ovs-ofctl ofctl/barrier
4227ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
4228AT_CAPTURE_FILE([monitor.log])
4229
4230# Send a packet-out with a couple of set-field action to set some metadata, and forward to controller
4231AT_CHECK([ovs-ofctl -O OpenFlow15 packet-out br0 "in_port=controller packet=4500002012344000ff1155670a0000140a00001e006400c8000cea78ffffffff packet_type(1,0x800) actions=set_field:0xfafafafa5a5a5a5a->metadata,controller"])
4232
4233# Stop the monitor and check its output.
4234ovs-appctl -t ovs-ofctl ofctl/barrier
4235ovs-appctl -t ovs-ofctl exit
4236
4237AT_CHECK([sed 's/ (xid=0x[[0-9a-fA-F]]*)//' monitor.log], [0], [dnl
4238OFPT_PACKET_IN (OF1.3): total_len=32 packet_type=(1,0x800),metadata=0xfafafafa5a5a5a5a,in_port=CONTROLLER (via action) data_len=32 (unbuffered)
4239packet_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
4240OFPT_BARRIER_REPLY (OF1.3):
4241])
4242
4243OVS_VSWITCHD_STOP
4244AT_CLEANUP
4245
969fc56c
JS
4246dnl This test checks that metadata is encoded in packet_in structures,
4247dnl supported by NXAST.
4248AT_SETUP([ofproto - packet-out with metadata (NXM)])
4249OVS_VSWITCHD_START
4250
4251# Start a monitor listening for packet-ins.
6409e008 4252AT_CHECK([ovs-ofctl -P nxt_packet_in monitor br0 --detach --no-chdir --pidfile])
969fc56c
JS
4253ovs-appctl -t ovs-ofctl ofctl/send 0109000c0123456700000080
4254ovs-appctl -t ovs-ofctl ofctl/barrier
4255ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
4256AT_CAPTURE_FILE([monitor.log])
4257
4258# Send a packet-out with a load action to set some metadata, and forward to controller
6dd3c787 4259AT_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
4260
4261# Stop the monitor and check its output.
4262ovs-appctl -t ovs-ofctl ofctl/barrier
d9c8c57c 4263OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
969fc56c
JS
4264
4265AT_CHECK([sed 's/ (xid=0x[[0-9a-fA-F]]*)//' monitor.log], [0], [dnl
50dcbd8e 4266NXT_PACKET_IN: total_len=14 pkt_mark=0xaa,metadata=0xfafafafa5a5a5a5a,in_port=CONTROLLER (via action) data_len=14 (unbuffered)
e6d9ab56 4267vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1234
751c7785
BP
4268OFPT_BARRIER_REPLY:
4269])
4270
4271OVS_VSWITCHD_STOP
4272AT_CLEANUP
2b07c8b1 4273
9dcd1c00
SH
4274dnl This test checks that metadata is encoded in packet_in structures,
4275dnl supported by NXAST.
4276AT_SETUP([ofproto - packet-out with metadata (OpenFlow 1.2)])
4277OVS_VSWITCHD_START
4278
4279# Start a monitor listening for packet-ins.
6409e008 4280AT_CHECK([ovs-ofctl -O OpenFlow12 -P standard monitor br0 --detach --no-chdir --pidfile])
9dcd1c00
SH
4281ovs-appctl -t ovs-ofctl ofctl/send 0309000c0123456700000080
4282ovs-appctl -t ovs-ofctl ofctl/barrier
4283ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
4284AT_CAPTURE_FILE([monitor.log])
4285
277876e9
JT
4286# Send a packet-out with a set-field action to set some metadata, and forward to controller
4287AT_CHECK([ovs-ofctl -O OpenFlow12 packet-out br0 none 'set_field:0xfafafafa5a5a5a5a->metadata, controller' '0001020304050010203040501234'])
9dcd1c00
SH
4288
4289# Stop the monitor and check its output.
4290ovs-appctl -t ovs-ofctl ofctl/barrier
d9c8c57c 4291OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
9dcd1c00
SH
4292
4293AT_CHECK([sed 's/ (xid=0x[[0-9a-fA-F]]*)//' monitor.log], [0], [dnl
50dcbd8e 4294OFPT_PACKET_IN (OF1.2): total_len=14 metadata=0xfafafafa5a5a5a5a,in_port=ANY (via action) data_len=14 (unbuffered)
e6d9ab56 4295vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1234
0ad90c84
JR
4296OFPT_BARRIER_REPLY (OF1.2):
4297])
4298
4299OVS_VSWITCHD_STOP
4300AT_CLEANUP
4301
743c159b
JT
4302dnl This test checks that metadata is encoded in packet_in structures,
4303dnl supported by NXAST.
4304AT_SETUP([ofproto - packet-out with metadata and dual set_field (OpenFlow 1.3)])
4305OVS_VSWITCHD_START
4306
4307# Start a monitor listening for packet-ins.
6409e008 4308AT_CHECK([ovs-ofctl -O OpenFlow13 -P standard monitor br0 --detach --no-chdir --pidfile])
743c159b
JT
4309ovs-appctl -t ovs-ofctl ofctl/send 0409000c0123456700000080
4310ovs-appctl -t ovs-ofctl ofctl/barrier
4311ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
4312AT_CAPTURE_FILE([monitor.log])
4313
4314# Send a packet-out with a couple of set-field action to set some metadata, and forward to controller
4315AT_CHECK([ovs-ofctl -O OpenFlow13 packet-out br0 none 'set_field:0xfafafafa5a5a5a5a->metadata, set_field:0x6b->metadata, controller' '0001020304050010203040501234'])
4316
4317# Stop the monitor and check its output.
4318ovs-appctl -t ovs-ofctl ofctl/barrier
d9c8c57c 4319OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
743c159b
JT
4320
4321AT_CHECK([sed 's/ (xid=0x[[0-9a-fA-F]]*)//' monitor.log], [0], [dnl
50dcbd8e 4322OFPT_PACKET_IN (OF1.3): total_len=14 metadata=0x6b,in_port=ANY (via action) data_len=14 (unbuffered)
e6d9ab56 4323vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1234
743c159b
JT
4324OFPT_BARRIER_REPLY (OF1.3):
4325])
4326
4327OVS_VSWITCHD_STOP
4328AT_CLEANUP
4329
0ad90c84
JR
4330dnl This test checks that tunnel metadata is encoded in packet_in structures.
4331AT_SETUP([ofproto - packet-out with tunnel metadata (OpenFlow 1.2)])
4332OVS_VSWITCHD_START
4333
4334# Start a monitor listening for packet-ins.
6409e008 4335AT_CHECK([ovs-ofctl -O OpenFlow12 -P standard monitor br0 --detach --no-chdir --pidfile])
0ad90c84
JR
4336ovs-appctl -t ovs-ofctl ofctl/send 0309000c0123456700000080
4337ovs-appctl -t ovs-ofctl ofctl/barrier
4338ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
4339AT_CAPTURE_FILE([monitor.log])
4340
4341# Send a packet-out with set field actions to set some tunnel metadata, and forward to controller
4342AT_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'])
4343
4344# Stop the monitor and check its output.
4345ovs-appctl -t ovs-ofctl ofctl/barrier
d9c8c57c 4346OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
0ad90c84
JR
4347
4348AT_CHECK([sed 's/ (xid=0x[[0-9a-fA-F]]*)//' monitor.log], [0], [dnl
50dcbd8e 4349OFPT_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 4350vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1234
9dcd1c00
SH
4351OFPT_BARRIER_REPLY (OF1.2):
4352])
4353
4354OVS_VSWITCHD_STOP
4355AT_CLEANUP
4356
1637ebb2
SH
4357m4_divert_push([PREPARE_TESTS])
4358# Sorts groups of lines that start with a space, without moving them
4359# past the nearest line that does not start with a space.
719dcfd4 4360[
1637ebb2 4361multiline_sort () {
719dcfd4
BP
4362 $PYTHON -c '
4363import sys
4364
4365buffer = []
4366while True:
4367 line = sys.stdin.readline()
4368 if not line:
4369 break
4370 if line.startswith(" "):
4371 buffer.append(line)
4372 else:
4373 sys.stdout.write("".join(sorted(buffer)))
4374 sys.stdout.write(line)
4375 buffer = []
4376sys.stdout.write("".join(sorted(buffer)))
1637ebb2
SH
4377'
4378}
719dcfd4 4379]
1637ebb2
SH
4380m4_divert_pop([PREPARE_TESTS])
4381
2b07c8b1
BP
4382AT_SETUP([ofproto - flow monitoring])
4383AT_KEYWORDS([monitor])
4384OVS_VSWITCHD_START
4385
4386ovs-ofctl add-flow br0 in_port=0,dl_vlan=123,actions=output:1
4387
4388# Start a monitor watching the flow table and check the initial reply.
4389ovs-ofctl monitor br0 watch: --detach --no-chdir --pidfile >monitor.log 2>&1
4390AT_CAPTURE_FILE([monitor.log])
4391ovs-appctl -t ovs-ofctl ofctl/barrier
4392AT_CHECK([sed 's/ (xid=0x[[1-9a-fA-F]][[0-9a-fA-F]]*)//' monitor.log], [0],
4393 [NXST_FLOW_MONITOR reply:
4394 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=123 actions=output:1
4395OFPT_BARRIER_REPLY:
4396])
4397
4398# Add, delete, and modify some flows and check the updates.
4399ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
4400ovs-ofctl add-flow br0 in_port=0,dl_vlan=124,actions=output:2
4401ovs-ofctl add-flow br0 in_port=0,dl_vlan=123,actions=output:5
95a1c4ca
SH
4402ovs-ofctl add-flow br0 in_port=0,dl_vlan=123,dl_vlan_pcp=0,actions=output:6
4403ovs-ofctl add-flow br0 in_port=0,dl_vlan=123,dl_vlan_pcp=1,actions=output:7
4404ovs-ofctl add-flow br0 in_port=0,dl_vlan=123,actions=output:8
4405ovs-ofctl add-flow br0 in_port=0,dl_vlan=65535,dl_vlan_pcp=0,actions=output:9
4406ovs-ofctl add-flow br0 in_port=0,dl_vlan=65535,dl_vlan_pcp=1,actions=output:10
4407ovs-ofctl add-flow br0 in_port=0,dl_vlan=65535,actions=output:11
4408ovs-ofctl add-flow br0 in_port=0,dl_vlan=8191,dl_vlan_pcp=0,actions=output:12
4409ovs-ofctl add-flow br0 in_port=0,dl_vlan=8191,dl_vlan_pcp=1,actions=output:13
4410ovs-ofctl add-flow br0 in_port=0,dl_vlan=8191,actions=output:14
4411ovs-ofctl add-flow br0 in_port=0,dl_vlan=0,dl_vlan_pcp=0,actions=output:15
4412ovs-ofctl add-flow br0 in_port=0,dl_vlan=0,dl_vlan_pcp=1,actions=output:16
4413ovs-ofctl add-flow br0 in_port=0,dl_vlan=0,actions=output:17
4414ovs-ofctl add-flow br0 in_port=0,dl_vlan=0,dl_vlan_pcp=0,actions=output:18
4415ovs-ofctl add-flow br0 in_port=0,dl_vlan=0,dl_vlan_pcp=1,actions=output:19
4416ovs-ofctl add-flow br0 in_port=0,dl_vlan=0,actions=output:20
4417ovs-ofctl add-flow br0 in_port=0,dl_vlan_pcp=0,actions=output:21
4418ovs-ofctl add-flow br0 in_port=0,dl_vlan_pcp=1,actions=output:22
4419ovs-ofctl add-flow br0 in_port=0,actions=output:23
ee088a75 4420ovs-ofctl mod-flows br0 dl_vlan=123,actions=output:3
2b07c8b1
BP
4421ovs-ofctl mod-flows br0 cookie=5,dl_vlan=123,actions=output:3
4422ovs-ofctl del-flows br0 dl_vlan=123
4423ovs-ofctl del-flows br0
4424ovs-appctl -t ovs-ofctl ofctl/barrier
1637ebb2 4425AT_CHECK([sed 's/ (xid=0x[[1-9a-fA-F]][[0-9a-fA-F]]*)//' monitor.log | multiline_sort], [0],
2b07c8b1
BP
4426[NXST_FLOW_MONITOR reply (xid=0x0):
4427 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=124 actions=output:2
4428NXST_FLOW_MONITOR reply (xid=0x0):
4429 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=123 actions=output:5
95a1c4ca
SH
4430NXST_FLOW_MONITOR reply (xid=0x0):
4431 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=123,dl_vlan_pcp=0 actions=output:6
4432NXST_FLOW_MONITOR reply (xid=0x0):
4433 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=123,dl_vlan_pcp=1 actions=output:7
4434NXST_FLOW_MONITOR reply (xid=0x0):
4435 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=123 actions=output:8
4436NXST_FLOW_MONITOR reply (xid=0x0):
4437 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=0,dl_vlan_pcp=0 actions=output:9
4438NXST_FLOW_MONITOR reply (xid=0x0):
4439 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=0,dl_vlan_pcp=1 actions=output:10
4440NXST_FLOW_MONITOR reply (xid=0x0):
4441 event=ADDED table=0 cookie=0 in_port=0,vlan_tci=0x0000 actions=output:11
4442NXST_FLOW_MONITOR reply (xid=0x0):
4443 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=4095,dl_vlan_pcp=0 actions=output:12
4444NXST_FLOW_MONITOR reply (xid=0x0):
4445 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=4095,dl_vlan_pcp=1 actions=output:13
4446NXST_FLOW_MONITOR reply (xid=0x0):
4447 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=4095 actions=output:14
4448NXST_FLOW_MONITOR reply (xid=0x0):
4449 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=0,dl_vlan_pcp=0 actions=output:15
4450NXST_FLOW_MONITOR reply (xid=0x0):
4451 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=0,dl_vlan_pcp=1 actions=output:16
4452NXST_FLOW_MONITOR reply (xid=0x0):
4453 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=0 actions=output:17
4454NXST_FLOW_MONITOR reply (xid=0x0):
4455 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=0,dl_vlan_pcp=0 actions=output:18
4456NXST_FLOW_MONITOR reply (xid=0x0):
4457 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=0,dl_vlan_pcp=1 actions=output:19
4458NXST_FLOW_MONITOR reply (xid=0x0):
4459 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=0 actions=output:20
4460NXST_FLOW_MONITOR reply (xid=0x0):
4461 event=ADDED table=0 cookie=0 in_port=0,dl_vlan_pcp=0 actions=output:21
4462NXST_FLOW_MONITOR reply (xid=0x0):
4463 event=ADDED table=0 cookie=0 in_port=0,dl_vlan_pcp=1 actions=output:22
4464NXST_FLOW_MONITOR reply (xid=0x0):
4465 event=ADDED table=0 cookie=0 in_port=0 actions=output:23
ee088a75
SH
4466NXST_FLOW_MONITOR reply (xid=0x0):
4467 event=MODIFIED table=0 cookie=0 in_port=0,dl_vlan=123 actions=output:3
4468 event=MODIFIED table=0 cookie=0 in_port=0,dl_vlan=123,dl_vlan_pcp=0 actions=output:3
4469 event=MODIFIED table=0 cookie=0 in_port=0,dl_vlan=123,dl_vlan_pcp=1 actions=output:3
2b07c8b1
BP
4470NXST_FLOW_MONITOR reply (xid=0x0):
4471 event=MODIFIED table=0 cookie=0x5 in_port=0,dl_vlan=123 actions=output:3
95a1c4ca
SH
4472 event=MODIFIED table=0 cookie=0x5 in_port=0,dl_vlan=123,dl_vlan_pcp=0 actions=output:3
4473 event=MODIFIED table=0 cookie=0x5 in_port=0,dl_vlan=123,dl_vlan_pcp=1 actions=output:3
2b07c8b1
BP
4474NXST_FLOW_MONITOR reply (xid=0x0):
4475 event=DELETED reason=delete table=0 cookie=0x5 in_port=0,dl_vlan=123 actions=output:3
95a1c4ca
SH
4476 event=DELETED reason=delete table=0 cookie=0x5 in_port=0,dl_vlan=123,dl_vlan_pcp=0 actions=output:3
4477 event=DELETED reason=delete table=0 cookie=0x5 in_port=0,dl_vlan=123,dl_vlan_pcp=1 actions=output:3
2b07c8b1 4478NXST_FLOW_MONITOR reply (xid=0x0):
32cd83a2 4479 event=DELETED reason=delete table=0 cookie=0 in_port=0 actions=output:23
95a1c4ca 4480 event=DELETED reason=delete table=0 cookie=0 in_port=0,dl_vlan=0 actions=output:20
32cd83a2
BP
4481 event=DELETED reason=delete table=0 cookie=0 in_port=0,dl_vlan=0,dl_vlan_pcp=0 actions=output:18
4482 event=DELETED reason=delete table=0 cookie=0 in_port=0,dl_vlan=0,dl_vlan_pcp=1 actions=output:19
2b07c8b1 4483 event=DELETED reason=delete table=0 cookie=0 in_port=0,dl_vlan=124 actions=output:2
95a1c4ca 4484 event=DELETED reason=delete table=0 cookie=0 in_port=0,dl_vlan=4095 actions=output:14
32cd83a2 4485 event=DELETED reason=delete table=0 cookie=0 in_port=0,dl_vlan=4095,dl_vlan_pcp=0 actions=output:12
95a1c4ca 4486 event=DELETED reason=delete table=0 cookie=0 in_port=0,dl_vlan=4095,dl_vlan_pcp=1 actions=output:13
32cd83a2
BP
4487 event=DELETED reason=delete table=0 cookie=0 in_port=0,dl_vlan_pcp=0 actions=output:21
4488 event=DELETED reason=delete table=0 cookie=0 in_port=0,dl_vlan_pcp=1 actions=output:22
95a1c4ca 4489 event=DELETED reason=delete table=0 cookie=0 in_port=0,vlan_tci=0x0000 actions=output:11
2b07c8b1
BP
4490OFPT_BARRIER_REPLY:
4491])
4492
200d6ac4
SH
4493# Check that our own changes are reported as full updates.
4494ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
4495ovs-ofctl add-flow br0 in_port=1,actions=output:2
4496ovs-ofctl add-flow br0 in_port=2,actions=output:1
4497ovs-appctl -t ovs-ofctl ofctl/barrier
4498ovs-appctl -t ovs-ofctl ofctl/send 010e004812345678003fffff00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003000000000000ffffffffffff0000
4499ovs-appctl -t ovs-ofctl ofctl/barrier
4500AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip], [0], [NXST_FLOW reply:
4501])
4502AT_CHECK([sed 's/ (xid=0x[[1-9a-fA-F]][[0-9a-fA-F]]*)//' monitor.log | multiline_sort], [0],
4503[NXST_FLOW_MONITOR reply (xid=0x0):
4504 event=ADDED table=0 cookie=0 in_port=1 actions=output:2
4505NXST_FLOW_MONITOR reply (xid=0x0):
4506 event=ADDED table=0 cookie=0 in_port=2 actions=output:1
4507OFPT_BARRIER_REPLY:
4508send: OFPT_FLOW_MOD: DEL priority=0 actions=drop
4509NXST_FLOW_MONITOR reply (xid=0x0):
4510 event=DELETED reason=delete table=0 cookie=0 in_port=1 actions=output:2
4511 event=DELETED reason=delete table=0 cookie=0 in_port=2 actions=output:1
4512OFPT_BARRIER_REPLY:
4513])
4514
d9c8c57c 4515OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
200d6ac4
SH
4516OVS_VSWITCHD_STOP
4517AT_CLEANUP
4518
4519AT_SETUP([ofproto - flow monitoring with !own])
4520AT_KEYWORDS([monitor])
4521OVS_VSWITCHD_START
4522
4523ovs-ofctl add-flow br0 in_port=0,dl_vlan=123,actions=output:1
4524
4525# Start a monitor watching the flow table and check the initial reply.
4526ovs-ofctl monitor br0 watch:\!own --detach --no-chdir --pidfile >monitor.log 2>&1
4527AT_CAPTURE_FILE([monitor.log])
4528ovs-appctl -t ovs-ofctl ofctl/barrier
4529AT_CHECK([sed 's/ (xid=0x[[1-9a-fA-F]][[0-9a-fA-F]]*)//' monitor.log], [0],
4530 [NXST_FLOW_MONITOR reply:
4531 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=123 actions=output:1
4532OFPT_BARRIER_REPLY:
4533])
4534
2b07c8b1
BP
4535# Check that our own changes are reported as abbreviations.
4536ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
4537ovs-ofctl add-flow br0 in_port=1,actions=output:2
4538ovs-ofctl add-flow br0 in_port=2,actions=output:1
90d721f0 4539ovs-appctl -t ovs-ofctl ofctl/barrier
2b07c8b1
BP
4540ovs-appctl -t ovs-ofctl ofctl/send 010e004812345678003fffff00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003000000000000ffffffffffff0000
4541ovs-appctl -t ovs-ofctl ofctl/barrier
4542AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip], [0], [NXST_FLOW reply:
4543])
4544AT_CHECK([sed 's/ (xid=0x[[1-9a-fA-F]][[0-9a-fA-F]]*)//' monitor.log], [0],
4545[NXST_FLOW_MONITOR reply (xid=0x0):
4546 event=ADDED table=0 cookie=0 in_port=1 actions=output:2
4547NXST_FLOW_MONITOR reply (xid=0x0):
4548 event=ADDED table=0 cookie=0 in_port=2 actions=output:1
90d721f0 4549OFPT_BARRIER_REPLY:
2b07c8b1
BP
4550send: OFPT_FLOW_MOD: DEL priority=0 actions=drop
4551NXST_FLOW_MONITOR reply (xid=0x0):
4552 event=ABBREV xid=0x12345678
cdbdeeda
SH
4553OFPT_BARRIER_REPLY:
4554])
4555
d9c8c57c 4556OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
cdbdeeda
SH
4557OVS_VSWITCHD_STOP
4558AT_CLEANUP
4559
4560AT_SETUP([ofproto - flow monitoring with out_port])
4561AT_KEYWORDS([monitor])
4562OVS_VSWITCHD_START
4563
4564ovs-ofctl add-flow br0 in_port=0,dl_vlan=121,actions=output:1
4565ovs-ofctl add-flow br0 in_port=0,dl_vlan=122,actions=output:1
4566ovs-ofctl add-flow br0 in_port=0,dl_vlan=123,actions=output:2
4567
4568# Start a monitor watching the flow table and check the initial reply.
4569ovs-ofctl monitor br0 watch:out_port=2 --detach --no-chdir --pidfile >monitor.log 2>&1
4570AT_CAPTURE_FILE([monitor.log])
4571ovs-appctl -t ovs-ofctl ofctl/barrier
4572AT_CHECK([sed 's/ (xid=0x[[1-9a-fA-F]][[0-9a-fA-F]]*)//' monitor.log], [0],
4573 [NXST_FLOW_MONITOR reply:
4574 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=123 actions=output:2
4575OFPT_BARRIER_REPLY:
4576])
4577
4578ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
4579
4580# Add, modify flows and check the updates.
4581ovs-ofctl mod-flows br0 dl_vlan=121,actions=drop
4582ovs-ofctl mod-flows br0 dl_vlan=122,actions=output:1,output:2
4583ovs-appctl -t ovs-ofctl ofctl/barrier
4584
4585ovs-ofctl mod-flows br0 dl_vlan=123,actions=output:1,output:2
4586ovs-appctl -t ovs-ofctl ofctl/barrier
4587
4588ovs-ofctl mod-flows br0 dl_vlan=122,actions=output:1
4589ovs-appctl -t ovs-ofctl ofctl/barrier
4590ovs-ofctl mod-flows br0 dl_vlan=123,actions=output:2
4591ovs-appctl -t ovs-ofctl ofctl/barrier
4592
4593AT_CHECK([sed 's/ (xid=0x[[1-9a-fA-F]][[0-9a-fA-F]]*)//' monitor.log], [0],
4594[NXST_FLOW_MONITOR reply (xid=0x0):
4595 event=MODIFIED table=0 cookie=0 in_port=0,dl_vlan=122 actions=output:1,output:2
4596OFPT_BARRIER_REPLY:
4597NXST_FLOW_MONITOR reply (xid=0x0):
4598 event=MODIFIED table=0 cookie=0 in_port=0,dl_vlan=123 actions=output:1,output:2
4599OFPT_BARRIER_REPLY:
4600NXST_FLOW_MONITOR reply (xid=0x0):
4601 event=MODIFIED table=0 cookie=0 in_port=0,dl_vlan=122 actions=output:1
4602OFPT_BARRIER_REPLY:
4603NXST_FLOW_MONITOR reply (xid=0x0):
4604 event=MODIFIED table=0 cookie=0 in_port=0,dl_vlan=123 actions=output:2
2b07c8b1
BP
4605OFPT_BARRIER_REPLY:
4606])
4607
d9c8c57c 4608OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
2b07c8b1
BP
4609OVS_VSWITCHD_STOP
4610AT_CLEANUP
4611
4612AT_SETUP([ofproto - flow monitoring pause and resume])
4613AT_KEYWORDS([monitor])
4614
46a80050
EM
4615# The maximum socket receive buffer size is important for this test, which
4616# tests behavior when the receive buffer overflows.
4617if test -e /proc/sys/net/core/rmem_max; then
4618 # Linux
4619 rmem_max=`cat /proc/sys/net/core/rmem_max`
4620elif rmem_max=`sysctl -n net.inet.tcp.recvbuf_max 2>/dev/null`; then
f3326eeb 4621 : # FreeBSD, NetBSD
46a80050
EM
4622else
4623 # Don't know how to get maximum socket receive buffer on this OS
4624 AT_SKIP_IF([:])
4625fi
2b07c8b1
BP
4626# Calculate the total amount of queuing: rmem_max in the kernel, 128 kB
4627# in ofproto sending userspace (see ofmonitor_flush() in connmgr.c).
2b07c8b1
BP
4628queue_size=`expr $rmem_max + 128 \* 1024`
4629echo rmem_max=$rmem_max queue_size=$queue_size
4630
21aa35c3
BP
4631# If there's too much queuing skip the test to avoid timing out.
4632AT_SKIP_IF([test $rmem_max -gt 1048576])
4633
2b07c8b1
BP
4634# Each flow update message takes up at least 48 bytes of space in queues
4635# and in practice more than that.
4636n_msgs=`expr $queue_size / 48`
4637echo n_msgs=$n_msgs
4638
4639OVS_VSWITCHD_START
4640
4641# Start a monitor watching the flow table, then make it block.
53eb8cb8 4642on_exit 'kill `cat ovs-ofctl.pid`'
2b07c8b1
BP
4643ovs-ofctl monitor br0 watch: --detach --no-chdir --pidfile >monitor.log 2>&1
4644AT_CAPTURE_FILE([monitor.log])
4645ovs-appctl -t ovs-ofctl ofctl/block
4646
4647# Add $n_msgs flows.
4648(echo "in_port=2,actions=output:2"
719dcfd4
BP
4649$PYTHON -c '
4650for i in range('$n_msgs'):
4651 print("cookie=1,reg1=%d,actions=drop" % i)
2b07c8b1
BP
4652') > flows.txt
4653AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
79b8c36c
BP
4654# Check that multipart flow dumps work properly:
4655AT_CHECK([ovs-ofctl diff-flows br0 flows.txt])
2b07c8b1
BP
4656AT_CHECK([ovs-ofctl add-flow br0 in_port=1,cookie=3,actions=drop])
4657AT_CHECK([ovs-ofctl mod-flows br0 in_port=2,cookie=2,actions=output:2])
4658AT_CHECK([ovs-ofctl del-flows br0 cookie=1/-1])
4659
4660ovs-appctl -t ovs-ofctl ofctl/unblock
c4821629
YT
4661
4662# Wait for the connection resumed.
4663# A barrier doesn't work for this purpose.
4664# https://www.mail-archive.com/dev@openvswitch.org/msg27013.html
4665# https://www.mail-archive.com/dev@openvswitch.org/msg27675.html
4666OVS_WAIT_UNTIL([grep NXT_FLOW_MONITOR_RESUMED monitor.log])
2b07c8b1 4667
d9c8c57c 4668OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
2b07c8b1
BP
4669
4670# Check that the flow monitor reported the same number of flows
4671# added and deleted, but fewer than we actually added and deleted.
4672adds=`grep -c 'ADDED.*reg1=' monitor.log`
4673deletes=`grep -c 'DELETED.*reg1=' monitor.log`
4674echo adds=$adds deletes=$deletes
4675AT_CHECK([test $adds -gt 100 && test $adds -lt $n_msgs])
4676AT_CHECK([test $adds = $deletes])
4677
d0ab8a1a
BP
4678# Check that the flow monitor reported everything in the expected order:
4679#
4680# event=ADDED table=0 cookie=0x1 reg1=0x22
4681# ...
4682# NXT_FLOW_MONITOR_PAUSED:
4683# ...
4684# event=DELETED reason=delete table=0 cookie=0x1 reg1=0x22
4685# ...
4686# event=ADDED table=0 cookie=0x3 in_port=1
4687# event=MODIFIED table=0 cookie=0x2 in_port=2 actions=output:2
4688# NXT_FLOW_MONITOR_RESUMED:
4689#
4690# except that, between the PAUSED and RESUMED, the order of the ADDED
4691# and MODIFIED lines lines depends on hash order, that is, it varies
4692# as we change the hash function or change architecture. Therefore,
4693# we use a couple of tests below to accept both orders.
2b07c8b1 4694AT_CHECK([ofctl_strip < monitor.log | sed -n -e '
46a80050 4695/reg1=0x22$/p
2b07c8b1
BP
4696/cookie=0x[[23]]/p
4697/NXT_FLOW_MONITOR_PAUSED:/p
4698/NXT_FLOW_MONITOR_RESUMED:/p
d0ab8a1a
BP
4699' > monitor.log.subset])
4700AT_CHECK([grep -v MODIFIED monitor.log.subset], [0], [dnl
4701 event=ADDED table=0 cookie=0x1 reg1=0x22
2b07c8b1
BP
4702NXT_FLOW_MONITOR_PAUSED:
4703 event=DELETED reason=delete table=0 cookie=0x1 reg1=0x22
4704 event=ADDED table=0 cookie=0x3 in_port=1
d0ab8a1a
BP
4705NXT_FLOW_MONITOR_RESUMED:
4706])
4707AT_CHECK([grep -v ADDED monitor.log.subset], [0], [dnl
4708NXT_FLOW_MONITOR_PAUSED:
4709 event=DELETED reason=delete table=0 cookie=0x1 reg1=0x22
2b07c8b1
BP
4710 event=MODIFIED table=0 cookie=0x2 in_port=2 actions=output:2
4711NXT_FLOW_MONITOR_RESUMED:
4712])
4713
4714OVS_VSWITCHD_STOP
4715AT_CLEANUP
45156451
AC
4716
4717AT_SETUP([ofproto - event filtering (OpenFlow 1.3)])
4718AT_KEYWORDS([monitor])
4719OVS_VSWITCHD_START
4720
4721# Start a monitor, use the required protocol version
4722ovs-ofctl -O OpenFlow13 monitor br0 --detach --no-chdir --pidfile >monitor.log 2>&1
4723AT_CAPTURE_FILE([monitor.log])
4724
4725# Send an OpenFlow13 message (04), OFPT_GET_ASYNC_REQUEST (1a), length (8), xid (0a)
4726ovs-appctl -t ovs-ofctl ofctl/send 041a00080000000a
4727ovs-appctl -t ovs-ofctl ofctl/barrier
4728
4729# Check default setting
4730read -r -d '' expected <<'EOF'
4731EOF
4732
4733AT_CHECK([ofctl_strip < monitor.log], [], [dnl
4734send: OFPT_GET_ASYNC_REQUEST (OF1.3):
4735OFPT_GET_ASYNC_REPLY (OF1.3):
4736 master:
4737 PACKET_IN: no_match action
4738 PORT_STATUS: add delete modify
75754d04 4739 FLOW_REMOVED: idle hard delete group_delete
904e5202
BP
4740 ROLE_STATUS: (off)
4741 TABLE_STATUS: (off)
4742 REQUESTFORWARD: (off)
45156451
AC
4743
4744 slave:
4745 PACKET_IN: (off)
4746 PORT_STATUS: add delete modify
4747 FLOW_REMOVED: (off)
904e5202
BP
4748 ROLE_STATUS: (off)
4749 TABLE_STATUS: (off)
4750 REQUESTFORWARD: (off)
45156451
AC
4751OFPT_BARRIER_REPLY (OF1.3):
4752])
4753
4754OVS_VSWITCHD_STOP
4755AT_CLEANUP
4abb8608
BP
4756
4757AT_SETUP([ofproto - ofport_request])
4758OVS_VSWITCHD_START
ca5792f0 4759add_of_ports br0 1 2 3
4abb8608
BP
4760
4761set_and_check_specific_ofports () {
4762 ovs-vsctl set Interface p1 ofport_request="$1" -- \
4763 set Interface p2 ofport_request="$2" -- \
4764 set Interface p3 ofport_request="$3"
4765 ofports=`ovs-vsctl get Interface p1 ofport -- \
4766 get Interface p2 ofport -- \
4767 get Interface p3 ofport`
4768 AT_CHECK_UNQUOTED([echo $ofports], [0], [$1 $2 $3
4769])
4770}
4771for pre in '1 2 3' '1 3 2' '2 1 3' '2 3 1' '3 1 2' '3 2 1'; do
4772 for post in '1 2 3' '1 3 2' '2 1 3' '2 3 1' '3 1 2' '3 2 1'; do
4773 echo -----------------------------------------------------------
4774 echo "Check changing port numbers from $pre to $post"
d08d51b9
JS
4775 set_and_check_specific_ofports $pre
4776 set_and_check_specific_ofports $post
4abb8608
BP
4777 done
4778done
4779
4780ovs-vsctl del-port p3
4781
4782set_and_check_poorly_specified_ofports () {
4783 ovs-vsctl set Interface p1 ofport_request="$1" -- \
4784 set Interface p2 ofport_request="$2"
4785 p1=`ovs-vsctl get Interface p1 ofport`
4786 p2=`ovs-vsctl get Interface p2 ofport`
4787 echo $p1 $p2
4788
4789 AT_CHECK([test "$p1" != "$p2"])
4790 if test "$1" = "$2" && test "$1" != '[[]]'; then
4791 # One port number must be the requested one.
4792 AT_CHECK([test "$p1" = "$1" || test "$p2" = "$1"])
4793 # The other port number must be different (already tested above).
4794 else
641c6188
YT
4795 AT_CHECK([test "$1" = '[[]]' || test "$p1" = "$1"])
4796 AT_CHECK([test "$2" = '[[]]' || test "$p2" = "$2"])
4abb8608
BP
4797 fi
4798}
4799for pre in '1 2' '[[]] 2' '1 [[]]' '[[]] [[]]' '2 1' '[[]] 1' '2 [[]]' \
4800 '1 1' '2 2'; do
4801 for post in '1 2' '[[]] 2' '1 [[]]' '[[]] [[]]' '2 1' '[[]] 1' '2 [[]]' \
4802 '1 1' '2 2'; do
4803 echo -----------------------------------------------------------
4804 echo "Check changing port numbers from $pre to $post"
4805 set_and_check_poorly_specified_ofports $pre
4806 set_and_check_poorly_specified_ofports $post
4807 done
4808done
4809OVS_VSWITCHD_STOP
4810AT_CLEANUP
777af88d
AC
4811
4812
06d4d4b6 4813AT_SETUP([ofproto - bundle open (OpenFlow 1.4)])
777af88d
AC
4814AT_KEYWORDS([monitor])
4815OVS_VSWITCHD_START
4816
4817# Start a monitor, use the required protocol version
4818ovs-ofctl -O OpenFlow14 monitor br0 --detach --no-chdir --pidfile >monitor.log 2>&1
4819AT_CAPTURE_FILE([monitor.log])
4820
4821# Send an OpenFlow14 message (05), OFPT_BUNDLE_CONTROL (21), length (10), xid (0a)
1f42be1c 4822ovs-appctl -t ovs-ofctl ofctl/send "05 21 00 10 00 00 00 0a 00 00 00 01 00 00 00 02"
777af88d 4823ovs-appctl -t ovs-ofctl ofctl/barrier
d9c8c57c 4824OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
777af88d
AC
4825
4826AT_CHECK([ofctl_strip < monitor.log], [], [dnl
4827send: OFPT_BUNDLE_CONTROL (OF1.4):
1f42be1c 4828 bundle_id=0x1 type=OPEN_REQUEST flags=ordered
777af88d
AC
4829OFPT_BUNDLE_CONTROL (OF1.4):
4830 bundle_id=0x1 type=OPEN_REPLY flags=0
4831OFPT_BARRIER_REPLY (OF1.4):
4832])
4833
4834OVS_VSWITCHD_STOP
4835AT_CLEANUP
4836
06d4d4b6 4837AT_SETUP([ofproto - bundle double open (OpenFlow 1.4)])
777af88d
AC
4838AT_KEYWORDS([monitor])
4839OVS_VSWITCHD_START
4840
4841# Start a monitor, use the required protocol version
4842ovs-ofctl -O OpenFlow14 monitor br0 --detach --no-chdir --pidfile >monitor.log 2>&1
4843AT_CAPTURE_FILE([monitor.log])
4844
4845# Send twice an OpenFlow14 message (05), OFPT_BUNDLE_CONTROL (21), length (10), xid (0a)
1f42be1c 4846ovs-appctl -t ovs-ofctl ofctl/send "05 21 00 10 00 00 00 0a 00 00 00 01 00 00 00 02"
777af88d 4847ovs-appctl -t ovs-ofctl ofctl/barrier
1f42be1c 4848ovs-appctl -t ovs-ofctl ofctl/send "05 21 00 10 00 00 00 0a 00 00 00 01 00 00 00 02"
777af88d 4849ovs-appctl -t ovs-ofctl ofctl/barrier
d9c8c57c 4850OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
777af88d
AC
4851
4852AT_CHECK([ofctl_strip < monitor.log], [0], [dnl
4853send: OFPT_BUNDLE_CONTROL (OF1.4):
1f42be1c 4854 bundle_id=0x1 type=OPEN_REQUEST flags=ordered
777af88d
AC
4855OFPT_BUNDLE_CONTROL (OF1.4):
4856 bundle_id=0x1 type=OPEN_REPLY flags=0
4857OFPT_BARRIER_REPLY (OF1.4):
4858send: OFPT_BUNDLE_CONTROL (OF1.4):
1f42be1c 4859 bundle_id=0x1 type=OPEN_REQUEST flags=ordered
777af88d
AC
4860OFPT_ERROR (OF1.4): OFPBFC_BAD_ID
4861OFPT_BUNDLE_CONTROL (OF1.4):
1f42be1c 4862 bundle_id=0x1 type=OPEN_REQUEST flags=ordered
777af88d
AC
4863OFPT_BARRIER_REPLY (OF1.4):
4864])
4865
4866OVS_VSWITCHD_STOP
4867AT_CLEANUP
4868
4869AT_SETUP([ofproto - bundle close without open (OpenFlow 1.4)])
4870AT_KEYWORDS([monitor])
4871OVS_VSWITCHD_START
4872
4873# Start a monitor, use the required protocol version
4874ovs-ofctl -O OpenFlow14 monitor br0 --detach --no-chdir --pidfile >monitor.log 2>&1
4875AT_CAPTURE_FILE([monitor.log])
4876
1f42be1c 4877ovs-appctl -t ovs-ofctl ofctl/send "05 21 00 10 00 00 00 0a 00 00 00 01 00 02 00 02"
777af88d 4878ovs-appctl -t ovs-ofctl ofctl/barrier
d9c8c57c 4879OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
777af88d
AC
4880
4881AT_CHECK([ofctl_strip < monitor.log], [0], [dnl
4882send: OFPT_BUNDLE_CONTROL (OF1.4):
1f42be1c 4883 bundle_id=0x1 type=CLOSE_REQUEST flags=ordered
777af88d
AC
4884OFPT_ERROR (OF1.4): OFPBFC_BAD_ID
4885OFPT_BUNDLE_CONTROL (OF1.4):
1f42be1c 4886 bundle_id=0x1 type=CLOSE_REQUEST flags=ordered
777af88d
AC
4887OFPT_BARRIER_REPLY (OF1.4):
4888])
4889
4890OVS_VSWITCHD_STOP
4891AT_CLEANUP
4892
4893AT_SETUP([ofproto - bundle double close (OpenFlow 1.4)])
4894AT_KEYWORDS([monitor])
4895OVS_VSWITCHD_START
4896
4897# Start a monitor, use the required protocol version
4898ovs-ofctl -O OpenFlow14 monitor br0 --detach --no-chdir --pidfile >monitor.log 2>&1
4899AT_CAPTURE_FILE([monitor.log])
4900
4901# Open, Close, Close
1f42be1c 4902ovs-appctl -t ovs-ofctl ofctl/send "05 21 00 10 00 00 00 0a 00 00 00 01 00 00 00 02"
777af88d 4903ovs-appctl -t ovs-ofctl ofctl/barrier
1f42be1c 4904ovs-appctl -t ovs-ofctl ofctl/send "05 21 00 10 00 00 00 0a 00 00 00 01 00 02 00 02"
777af88d 4905ovs-appctl -t ovs-ofctl ofctl/barrier
1f42be1c 4906ovs-appctl -t ovs-ofctl ofctl/send "05 21 00 10 00 00 00 0a 00 00 00 01 00 02 00 02"
777af88d 4907ovs-appctl -t ovs-ofctl ofctl/barrier
d9c8c57c 4908OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
777af88d
AC
4909
4910AT_CHECK([ofctl_strip < monitor.log], [0], [dnl
4911send: OFPT_BUNDLE_CONTROL (OF1.4):
1f42be1c 4912 bundle_id=0x1 type=OPEN_REQUEST flags=ordered
777af88d
AC
4913OFPT_BUNDLE_CONTROL (OF1.4):
4914 bundle_id=0x1 type=OPEN_REPLY flags=0
4915OFPT_BARRIER_REPLY (OF1.4):
4916send: OFPT_BUNDLE_CONTROL (OF1.4):
1f42be1c 4917 bundle_id=0x1 type=CLOSE_REQUEST flags=ordered
777af88d
AC
4918OFPT_BUNDLE_CONTROL (OF1.4):
4919 bundle_id=0x1 type=CLOSE_REPLY flags=0
4920OFPT_BARRIER_REPLY (OF1.4):
4921send: OFPT_BUNDLE_CONTROL (OF1.4):
1f42be1c 4922 bundle_id=0x1 type=CLOSE_REQUEST flags=ordered
777af88d
AC
4923OFPT_ERROR (OF1.4): OFPBFC_BUNDLE_CLOSED
4924OFPT_BUNDLE_CONTROL (OF1.4):
1f42be1c 4925 bundle_id=0x1 type=CLOSE_REQUEST flags=ordered
777af88d
AC
4926OFPT_BARRIER_REPLY (OF1.4):
4927])
4928
4929OVS_VSWITCHD_STOP
4930AT_CLEANUP
4931
4932AT_SETUP([ofproto - bundle close, different flags (OpenFlow 1.4)])
4933AT_KEYWORDS([monitor])
4934OVS_VSWITCHD_START
4935
4936# Start a monitor, use the required protocol version
4937ovs-ofctl -O OpenFlow14 monitor br0 --detach --no-chdir --pidfile >monitor.log 2>&1
4938AT_CAPTURE_FILE([monitor.log])
4939
68030e16 4940# Open, Close
1f42be1c 4941ovs-appctl -t ovs-ofctl ofctl/send "05 21 00 10 00 00 00 0a 00 00 00 01 00 00 00 02"
777af88d 4942ovs-appctl -t ovs-ofctl ofctl/barrier
1f42be1c 4943ovs-appctl -t ovs-ofctl ofctl/send "05 21 00 10 00 00 00 0a 00 00 00 01 00 02 00 01"
777af88d 4944ovs-appctl -t ovs-ofctl ofctl/barrier
d9c8c57c 4945OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
777af88d
AC
4946
4947AT_CHECK([ofctl_strip < monitor.log], [0], [dnl
4948send: OFPT_BUNDLE_CONTROL (OF1.4):
1f42be1c 4949 bundle_id=0x1 type=OPEN_REQUEST flags=ordered
777af88d
AC
4950OFPT_BUNDLE_CONTROL (OF1.4):
4951 bundle_id=0x1 type=OPEN_REPLY flags=0
4952OFPT_BARRIER_REPLY (OF1.4):
4953send: OFPT_BUNDLE_CONTROL (OF1.4):
1f42be1c 4954 bundle_id=0x1 type=CLOSE_REQUEST flags=atomic
777af88d
AC
4955OFPT_ERROR (OF1.4): OFPBFC_BAD_FLAGS
4956OFPT_BUNDLE_CONTROL (OF1.4):
1f42be1c 4957 bundle_id=0x1 type=CLOSE_REQUEST flags=atomic
777af88d
AC
4958OFPT_BARRIER_REPLY (OF1.4):
4959])
4960
4961OVS_VSWITCHD_STOP
4962AT_CLEANUP
4963
4964AT_SETUP([ofproto - bundle commit without open (OpenFlow 1.4)])
4965AT_KEYWORDS([monitor])
4966OVS_VSWITCHD_START
4967
4968# Start a monitor, use the required protocol version
4969ovs-ofctl -O OpenFlow14 monitor br0 --detach --no-chdir --pidfile >monitor.log 2>&1
4970AT_CAPTURE_FILE([monitor.log])
4971
68030e16 4972# Commit
1f42be1c 4973ovs-appctl -t ovs-ofctl ofctl/send "05 21 00 10 00 00 00 0a 00 00 00 01 00 04 00 02"
777af88d 4974ovs-appctl -t ovs-ofctl ofctl/barrier
d9c8c57c 4975OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
777af88d
AC
4976
4977AT_CHECK([ofctl_strip < monitor.log], [0], [dnl
4978send: OFPT_BUNDLE_CONTROL (OF1.4):
1f42be1c 4979 bundle_id=0x1 type=COMMIT_REQUEST flags=ordered
777af88d
AC
4980OFPT_ERROR (OF1.4): OFPBFC_BAD_ID
4981OFPT_BUNDLE_CONTROL (OF1.4):
1f42be1c 4982 bundle_id=0x1 type=COMMIT_REQUEST flags=ordered
777af88d
AC
4983OFPT_BARRIER_REPLY (OF1.4):
4984])
4985
4986OVS_VSWITCHD_STOP
4987AT_CLEANUP
4988
4989AT_SETUP([ofproto - bundle commit, different flags (OpenFlow 1.4)])
4990AT_KEYWORDS([monitor])
4991OVS_VSWITCHD_START
4992
4993# Start a monitor, use the required protocol version
4994ovs-ofctl -O OpenFlow14 monitor br0 --detach --no-chdir --pidfile >monitor.log 2>&1
4995AT_CAPTURE_FILE([monitor.log])
4996
68030e16 4997# Open, Commit
1f42be1c 4998ovs-appctl -t ovs-ofctl ofctl/send "05 21 00 10 00 00 00 0a 00 00 00 01 00 00 00 02"
777af88d 4999ovs-appctl -t ovs-ofctl ofctl/barrier
1f42be1c 5000ovs-appctl -t ovs-ofctl ofctl/send "05 21 00 10 00 00 00 0a 00 00 00 01 00 04 00 01"
777af88d 5001ovs-appctl -t ovs-ofctl ofctl/barrier
d9c8c57c 5002OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
777af88d
AC
5003
5004AT_CHECK([ofctl_strip < monitor.log], [0], [dnl
5005send: OFPT_BUNDLE_CONTROL (OF1.4):
1f42be1c 5006 bundle_id=0x1 type=OPEN_REQUEST flags=ordered
777af88d
AC
5007OFPT_BUNDLE_CONTROL (OF1.4):
5008 bundle_id=0x1 type=OPEN_REPLY flags=0
5009OFPT_BARRIER_REPLY (OF1.4):
5010send: OFPT_BUNDLE_CONTROL (OF1.4):
1f42be1c 5011 bundle_id=0x1 type=COMMIT_REQUEST flags=atomic
777af88d
AC
5012OFPT_ERROR (OF1.4): OFPBFC_BAD_FLAGS
5013OFPT_BUNDLE_CONTROL (OF1.4):
1f42be1c 5014 bundle_id=0x1 type=COMMIT_REQUEST flags=atomic
777af88d
AC
5015OFPT_BARRIER_REPLY (OF1.4):
5016])
5017
5018OVS_VSWITCHD_STOP
5019AT_CLEANUP
5020
5021AT_SETUP([ofproto - bundle discard without open (OpenFlow 1.4)])
5022AT_KEYWORDS([monitor])
5023OVS_VSWITCHD_START
5024
5025# Start a monitor, use the required protocol version
5026ovs-ofctl -O OpenFlow14 monitor br0 --detach --no-chdir --pidfile >monitor.log 2>&1
5027AT_CAPTURE_FILE([monitor.log])
5028
68030e16 5029# Discard
1f42be1c 5030ovs-appctl -t ovs-ofctl ofctl/send "05 21 00 10 00 00 00 0a 00 00 00 01 00 06 00 02"
777af88d 5031ovs-appctl -t ovs-ofctl ofctl/barrier
d9c8c57c 5032OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
777af88d
AC
5033
5034AT_CHECK([ofctl_strip < monitor.log], [0], [dnl
5035send: OFPT_BUNDLE_CONTROL (OF1.4):
1f42be1c 5036 bundle_id=0x1 type=DISCARD_REQUEST flags=ordered
777af88d
AC
5037OFPT_ERROR (OF1.4): OFPBFC_BAD_ID
5038OFPT_BUNDLE_CONTROL (OF1.4):
1f42be1c 5039 bundle_id=0x1 type=DISCARD_REQUEST flags=ordered
777af88d
AC
5040OFPT_BARRIER_REPLY (OF1.4):
5041])
5042
5043OVS_VSWITCHD_STOP
5044AT_CLEANUP
db5076ee
JR
5045
5046
5047AT_SETUP([ofproto - bundle with multiple flow mods (OpenFlow 1.4)])
db5076ee
JR
5048OVS_VSWITCHD_START
5049
5050AT_CHECK([ovs-appctl vlog/set vconn:dbg])
5051
50f96b10 5052AT_CHECK([ovs-ofctl --no-names del-flows br0])
db5076ee
JR
5053
5054AT_DATA([flows.txt], [dnl
5055add idle_timeout=50 in_port=2 dl_src=00:66:77:88:99:aa actions=1
5056add idle_timeout=60 in_port=2 dl_src=00:77:88:99:aa:bb actions=2
5057add idle_timeout=70 in_port=2 dl_src=00:88:99:aa:bb:cc actions=3
5058add idle_timeout=50 in_port=2 dl_src=00:66:77:88:99:aa actions=4
5059delete
5060add idle_timeout=50 in_port=2 dl_src=00:66:77:88:99:aa actions=5
5061add idle_timeout=60 in_port=2 dl_src=00:77:88:99:aa:bb actions=6
5062add idle_timeout=70 in_port=2 dl_src=00:88:99:aa:bb:cc actions=7
5063delete in_port=2 dl_src=00:88:99:aa:bb:cc
5064])
5065
50f96b10 5066AT_CHECK([ovs-ofctl --no-names --bundle add-flows br0 flows.txt])
db5076ee
JR
5067
5068AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
5069 idle_timeout=50, in_port=2,dl_src=00:66:77:88:99:aa actions=output:5
5070 idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=output:6
5071NXST_FLOW reply:
5072])
5073
5074AT_DATA([flows.txt], [dnl
5075modify actions=drop
5076modify_strict in_port=2 dl_src=00:77:88:99:aa:bb actions=7
5077])
5078
50f96b10 5079AT_CHECK([ovs-ofctl --no-names --bundle add-flows br0 flows.txt])
db5076ee
JR
5080
5081AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
5082 idle_timeout=50, in_port=2,dl_src=00:66:77:88:99:aa actions=drop
5083 idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=output:7
5084NXST_FLOW reply:
5085])
5086
5087# Adding an existing flow acts as a modify, and delete_strict also works.
5088AT_DATA([flows.txt], [dnl
5089add idle_timeout=60 in_port=2 dl_src=00:77:88:99:aa:bb actions=8
5090delete_strict in_port=2 dl_src=00:66:77:88:99:aa
5091add in_port=2 dl_src=00:66:77:88:99:aa actions=drop
5092])
5093
50f96b10 5094AT_CHECK([ovs-ofctl --no-names --bundle add-flows br0 flows.txt])
db5076ee
JR
5095
5096AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
5097 idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=output:8
5098 in_port=2,dl_src=00:66:77:88:99:aa actions=drop
5099NXST_FLOW reply:
5100])
5101
5102dnl Check logs for OpenFlow trace
5103# Prevent race.
38b0b29f 5104OVS_WAIT_UNTIL([vconn_sub < ovs-vswitchd.log | test `grep -- "|vconn|DBG|unix: sent (Success): NXST_FLOW reply" | wc -l` -ge 3])
12e2ba2e 5105AT_CHECK([print_vconn_debug | vconn_sub | ofctl_strip], [0], [dnl
b79d45a1
BP
5106vconn|DBG|unix: sent (Success): OFPT_HELLO (OF1.6):
5107 version bitmap: 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07
db5076ee
JR
5108vconn|DBG|unix: received: OFPT_HELLO:
5109 version bitmap: 0x01
b79d45a1 5110vconn|DBG|unix: negotiated OpenFlow version 0x01 (we support version 0x07 and earlier, peer supports version 0x01)
db5076ee
JR
5111vconn|DBG|unix: received: OFPT_FLOW_MOD: DEL actions=drop
5112vconn|DBG|unix: received: OFPT_BARRIER_REQUEST:
5113vconn|DBG|unix: sent (Success): OFPT_BARRIER_REPLY:
b79d45a1
BP
5114vconn|DBG|unix: sent (Success): OFPT_HELLO (OF1.6):
5115 version bitmap: 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07
db5076ee 5116vconn|DBG|unix: received: OFPT_HELLO (OF1.4):
5f8c05ad 5117 version bitmap: 0x05
b79d45a1 5118vconn|DBG|unix: negotiated OpenFlow version 0x05 (we support version 0x07 and earlier, peer supports version 0x05)
db5076ee 5119vconn|DBG|unix: received: OFPT_BUNDLE_CONTROL (OF1.4):
39c94593 5120 bundle_id=0 type=OPEN_REQUEST flags=atomic ordered
db5076ee
JR
5121vconn|DBG|unix: sent (Success): OFPT_BUNDLE_CONTROL (OF1.4):
5122 bundle_id=0 type=OPEN_REPLY flags=0
5123vconn|DBG|unix: received: OFPT_BUNDLE_ADD_MESSAGE (OF1.4):
39c94593 5124 bundle_id=0 flags=atomic ordered
db5076ee
JR
5125OFPT_FLOW_MOD (OF1.4): ADD in_port=2,dl_src=00:66:77:88:99:aa idle:50 actions=output:1
5126vconn|DBG|unix: received: OFPT_BUNDLE_ADD_MESSAGE (OF1.4):
39c94593 5127 bundle_id=0 flags=atomic ordered
db5076ee
JR
5128OFPT_FLOW_MOD (OF1.4): ADD in_port=2,dl_src=00:77:88:99:aa:bb idle:60 actions=output:2
5129vconn|DBG|unix: received: OFPT_BUNDLE_ADD_MESSAGE (OF1.4):
39c94593 5130 bundle_id=0 flags=atomic ordered
db5076ee
JR
5131OFPT_FLOW_MOD (OF1.4): ADD in_port=2,dl_src=00:88:99:aa:bb:cc idle:70 actions=output:3
5132vconn|DBG|unix: received: OFPT_BUNDLE_ADD_MESSAGE (OF1.4):
39c94593 5133 bundle_id=0 flags=atomic ordered
db5076ee
JR
5134OFPT_FLOW_MOD (OF1.4): ADD in_port=2,dl_src=00:66:77:88:99:aa idle:50 actions=output:4
5135vconn|DBG|unix: received: OFPT_BUNDLE_ADD_MESSAGE (OF1.4):
39c94593 5136 bundle_id=0 flags=atomic ordered
db5076ee
JR
5137OFPT_FLOW_MOD (OF1.4): DEL table:255 actions=drop
5138vconn|DBG|unix: received: OFPT_BUNDLE_ADD_MESSAGE (OF1.4):
39c94593 5139 bundle_id=0 flags=atomic ordered
db5076ee
JR
5140OFPT_FLOW_MOD (OF1.4): ADD in_port=2,dl_src=00:66:77:88:99:aa idle:50 actions=output:5
5141vconn|DBG|unix: received: OFPT_BUNDLE_ADD_MESSAGE (OF1.4):
39c94593 5142 bundle_id=0 flags=atomic ordered
db5076ee
JR
5143OFPT_FLOW_MOD (OF1.4): ADD in_port=2,dl_src=00:77:88:99:aa:bb idle:60 actions=output:6
5144vconn|DBG|unix: received: OFPT_BUNDLE_ADD_MESSAGE (OF1.4):
39c94593 5145 bundle_id=0 flags=atomic ordered
db5076ee
JR
5146OFPT_FLOW_MOD (OF1.4): ADD in_port=2,dl_src=00:88:99:aa:bb:cc idle:70 actions=output:7
5147vconn|DBG|unix: received: OFPT_BUNDLE_ADD_MESSAGE (OF1.4):
39c94593 5148 bundle_id=0 flags=atomic ordered
db5076ee 5149OFPT_FLOW_MOD (OF1.4): DEL table:255 in_port=2,dl_src=00:88:99:aa:bb:cc actions=drop
506c1ddb
JR
5150vconn|DBG|unix: received: OFPT_BARRIER_REQUEST (OF1.4):
5151vconn|DBG|unix: sent (Success): OFPT_BARRIER_REPLY (OF1.4):
db5076ee 5152vconn|DBG|unix: received: OFPT_BUNDLE_CONTROL (OF1.4):
39c94593 5153 bundle_id=0 type=COMMIT_REQUEST flags=atomic ordered
db5076ee
JR
5154vconn|DBG|unix: sent (Success): OFPT_BUNDLE_CONTROL (OF1.4):
5155 bundle_id=0 type=COMMIT_REPLY flags=0
b79d45a1
BP
5156vconn|DBG|unix: sent (Success): OFPT_HELLO (OF1.6):
5157 version bitmap: 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07
db5076ee
JR
5158vconn|DBG|unix: received: OFPT_HELLO:
5159 version bitmap: 0x01
b79d45a1 5160vconn|DBG|unix: negotiated OpenFlow version 0x01 (we support version 0x07 and earlier, peer supports version 0x01)
db5076ee
JR
5161vconn|DBG|unix: received: NXT_SET_FLOW_FORMAT: format=nxm
5162vconn|DBG|unix: received: OFPT_BARRIER_REQUEST:
5163vconn|DBG|unix: sent (Success): OFPT_BARRIER_REPLY:
5164vconn|DBG|unix: received: NXST_FLOW request:
5165vconn|DBG|unix: sent (Success): NXST_FLOW reply:
5166 idle_timeout=50, in_port=2,dl_src=00:66:77:88:99:aa actions=output:5
5167 idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=output:6
b79d45a1
BP
5168vconn|DBG|unix: sent (Success): OFPT_HELLO (OF1.6):
5169 version bitmap: 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07
db5076ee 5170vconn|DBG|unix: received: OFPT_HELLO (OF1.4):
5f8c05ad 5171 version bitmap: 0x05
b79d45a1 5172vconn|DBG|unix: negotiated OpenFlow version 0x05 (we support version 0x07 and earlier, peer supports version 0x05)
db5076ee 5173vconn|DBG|unix: received: OFPT_BUNDLE_CONTROL (OF1.4):
39c94593 5174 bundle_id=0 type=OPEN_REQUEST flags=atomic ordered
db5076ee
JR
5175vconn|DBG|unix: sent (Success): OFPT_BUNDLE_CONTROL (OF1.4):
5176 bundle_id=0 type=OPEN_REPLY flags=0
5177vconn|DBG|unix: received: OFPT_BUNDLE_ADD_MESSAGE (OF1.4):
39c94593 5178 bundle_id=0 flags=atomic ordered
db5076ee
JR
5179OFPT_FLOW_MOD (OF1.4): MOD actions=drop
5180vconn|DBG|unix: received: OFPT_BUNDLE_ADD_MESSAGE (OF1.4):
39c94593 5181 bundle_id=0 flags=atomic ordered
db5076ee 5182OFPT_FLOW_MOD (OF1.4): MOD_STRICT in_port=2,dl_src=00:77:88:99:aa:bb actions=output:7
506c1ddb
JR
5183vconn|DBG|unix: received: OFPT_BARRIER_REQUEST (OF1.4):
5184vconn|DBG|unix: sent (Success): OFPT_BARRIER_REPLY (OF1.4):
db5076ee 5185vconn|DBG|unix: received: OFPT_BUNDLE_CONTROL (OF1.4):
39c94593 5186 bundle_id=0 type=COMMIT_REQUEST flags=atomic ordered
db5076ee
JR
5187vconn|DBG|unix: sent (Success): OFPT_BUNDLE_CONTROL (OF1.4):
5188 bundle_id=0 type=COMMIT_REPLY flags=0
b79d45a1
BP
5189vconn|DBG|unix: sent (Success): OFPT_HELLO (OF1.6):
5190 version bitmap: 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07
db5076ee
JR
5191vconn|DBG|unix: received: OFPT_HELLO:
5192 version bitmap: 0x01
b79d45a1 5193vconn|DBG|unix: negotiated OpenFlow version 0x01 (we support version 0x07 and earlier, peer supports version 0x01)
db5076ee
JR
5194vconn|DBG|unix: received: NXT_SET_FLOW_FORMAT: format=nxm
5195vconn|DBG|unix: received: OFPT_BARRIER_REQUEST:
5196vconn|DBG|unix: sent (Success): OFPT_BARRIER_REPLY:
5197vconn|DBG|unix: received: NXST_FLOW request:
5198vconn|DBG|unix: sent (Success): NXST_FLOW reply:
5199 idle_timeout=50, in_port=2,dl_src=00:66:77:88:99:aa actions=drop
5200 idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=output:7
b79d45a1
BP
5201vconn|DBG|unix: sent (Success): OFPT_HELLO (OF1.6):
5202 version bitmap: 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07
db5076ee 5203vconn|DBG|unix: received: OFPT_HELLO (OF1.4):
5f8c05ad 5204 version bitmap: 0x05
b79d45a1 5205vconn|DBG|unix: negotiated OpenFlow version 0x05 (we support version 0x07 and earlier, peer supports version 0x05)
db5076ee 5206vconn|DBG|unix: received: OFPT_BUNDLE_CONTROL (OF1.4):
39c94593 5207 bundle_id=0 type=OPEN_REQUEST flags=atomic ordered
db5076ee
JR
5208vconn|DBG|unix: sent (Success): OFPT_BUNDLE_CONTROL (OF1.4):
5209 bundle_id=0 type=OPEN_REPLY flags=0
5210vconn|DBG|unix: received: OFPT_BUNDLE_ADD_MESSAGE (OF1.4):
39c94593 5211 bundle_id=0 flags=atomic ordered
db5076ee
JR
5212OFPT_FLOW_MOD (OF1.4): ADD in_port=2,dl_src=00:77:88:99:aa:bb idle:60 actions=output:8
5213vconn|DBG|unix: received: OFPT_BUNDLE_ADD_MESSAGE (OF1.4):
39c94593 5214 bundle_id=0 flags=atomic ordered
db5076ee
JR
5215OFPT_FLOW_MOD (OF1.4): DEL_STRICT table:255 in_port=2,dl_src=00:66:77:88:99:aa actions=drop
5216vconn|DBG|unix: received: OFPT_BUNDLE_ADD_MESSAGE (OF1.4):
39c94593 5217 bundle_id=0 flags=atomic ordered
db5076ee 5218OFPT_FLOW_MOD (OF1.4): ADD in_port=2,dl_src=00:66:77:88:99:aa actions=drop
506c1ddb
JR
5219vconn|DBG|unix: received: OFPT_BARRIER_REQUEST (OF1.4):
5220vconn|DBG|unix: sent (Success): OFPT_BARRIER_REPLY (OF1.4):
db5076ee 5221vconn|DBG|unix: received: OFPT_BUNDLE_CONTROL (OF1.4):
39c94593 5222 bundle_id=0 type=COMMIT_REQUEST flags=atomic ordered
db5076ee
JR
5223vconn|DBG|unix: sent (Success): OFPT_BUNDLE_CONTROL (OF1.4):
5224 bundle_id=0 type=COMMIT_REPLY flags=0
b79d45a1
BP
5225vconn|DBG|unix: sent (Success): OFPT_HELLO (OF1.6):
5226 version bitmap: 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07
db5076ee
JR
5227vconn|DBG|unix: received: OFPT_HELLO:
5228 version bitmap: 0x01
b79d45a1 5229vconn|DBG|unix: negotiated OpenFlow version 0x01 (we support version 0x07 and earlier, peer supports version 0x01)
db5076ee
JR
5230vconn|DBG|unix: received: NXT_SET_FLOW_FORMAT: format=nxm
5231vconn|DBG|unix: received: OFPT_BARRIER_REQUEST:
5232vconn|DBG|unix: sent (Success): OFPT_BARRIER_REPLY:
5233vconn|DBG|unix: received: NXST_FLOW request:
5234vconn|DBG|unix: sent (Success): NXST_FLOW reply:
5235 idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=output:8
5236 in_port=2,dl_src=00:66:77:88:99:aa actions=drop
5237])
5238
14347f3e 5239AT_CHECK([grep " flow_mods in the last " ovs-vswitchd.log | sed -e 's/^.*connmgr|INFO|//' | vconn_sub], [0], [dnl
0c78eebe
JR
5240br0<->unix: 1 flow_mods in the last 0 s (1 deletes)
5241br0<->unix: 9 flow_mods in the last 0 s (7 adds, 2 deletes)
5242br0<->unix: 2 flow_mods in the last 0 s (2 modifications)
5243br0<->unix: 3 flow_mods in the last 0 s (2 adds, 1 deletes)
5244])
5245
db5076ee
JR
5246OVS_VSWITCHD_STOP
5247AT_CLEANUP
5248
5249
5250AT_SETUP([ofproto - failing bundle commit (OpenFlow 1.4)])
db5076ee
JR
5251OVS_VSWITCHD_START
5252
5253AT_CHECK([ovs-ofctl del-flows br0])
5254
5255ovs-ofctl add-flows br0 - <<EOF
5256idle_timeout=50 in_port=2 dl_src=00:66:77:88:99:aa actions=11
5257idle_timeout=60 in_port=2 dl_src=00:77:88:99:aa:bb actions=22
5258idle_timeout=70 in_port=2 dl_src=00:88:99:aa:bb:cc actions=33
5259EOF
5260AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
5261 idle_timeout=50, in_port=2,dl_src=00:66:77:88:99:aa actions=output:11
5262 idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=output:22
5263 idle_timeout=70, in_port=2,dl_src=00:88:99:aa:bb:cc actions=output:33
5264NXST_FLOW reply:
5265])
5266
5267# last line uses illegal table number (OVS internal table)
5268AT_DATA([flows.txt], [dnl
5269add idle_timeout=50 in_port=2 dl_src=00:66:77:88:99:aa actions=1
5270add idle_timeout=60 in_port=2 dl_src=00:77:88:99:aa:bb actions=2
5271add idle_timeout=70 in_port=2 dl_src=00:88:99:aa:bb:cc actions=3
5272modify idle_timeout=50 in_port=2 dl_src=00:66:77:88:99:aa actions=4
5273delete
5274add idle_timeout=50 in_port=2 dl_src=00:66:77:88:99:aa actions=5
5275add idle_timeout=60 in_port=2 dl_src=00:77:88:99:aa:bb actions=6
5276add idle_timeout=70 in_port=2 dl_src=00:88:99:aa:bb:cc actions=7
5277delete in_port=2 dl_src=00:88:99:aa:bb:cc
5278add table=254 actions=drop
5279])
5280
50f96b10 5281AT_CHECK([ovs-ofctl --bundle add-flows br0 flows.txt 2>&1 | sed '/talking to/,$d' | strip_xids],
b0065993 5282[0], [dnl
50f96b10 5283Error OFPBRC_EPERM for: OFPT_FLOW_MOD (OF1.4): ADD table:254 actions=drop
db5076ee
JR
5284])
5285
5286AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
5287 idle_timeout=50, in_port=2,dl_src=00:66:77:88:99:aa actions=output:11
5288 idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=output:22
5289 idle_timeout=70, in_port=2,dl_src=00:88:99:aa:bb:cc actions=output:33
5290NXST_FLOW reply:
5291])
5292
5293OVS_VSWITCHD_STOP
5294AT_CLEANUP
51bb26fa
JR
5295
5296
5297AT_SETUP([ofproto - bundle timeout (OpenFlow 1.4)])
5298AT_KEYWORDS([monitor])
5299OVS_VSWITCHD_START
5300
5301# Start a monitor, use the required protocol version
5302ovs-ofctl -O OpenFlow14 monitor br0 --detach --no-chdir --pidfile >monitor.log 2>&1
5303AT_CAPTURE_FILE([monitor.log])
5304
5305ovs-appctl time/stop
5306
5307# Send an OpenFlow14 message (05), OFPT_BUNDLE_CONTROL (21), length (10), xid (01)
5308ovs-appctl -t ovs-ofctl ofctl/send "05 21 00 10 00 00 00 01 00 00 00 01 00 00 00 03"
5309ovs-appctl time/warp 8000
5310# Send a bundle flow mod, it should keep the bundle alive.
5311ovs-appctl -t ovs-ofctl ofctl/send "05 22 00 a0 00 00 00 02 00 00 00 01 00 00 00 03 \
531205 0e 00 90 00 00 00 02 00 00 00 00 00 00 00 00 \
531300 00 00 00 00 00 00 00 01 00 00 00 00 00 ff ff \
5314ff ff ff ff ff ff ff ff ff ff ff ff 00 00 00 00 \
531500 01 00 42 80 00 00 04 00 00 00 01 80 00 08 06 \
531650 54 00 00 00 06 80 00 06 06 50 54 00 00 00 05 \
531780 00 0a 02 08 06 80 00 0c 02 00 00 80 00 2a 02 \
531800 02 80 00 2c 04 c0 a8 00 02 80 00 2e 04 c0 a8 \
531900 01 00 00 00 00 00 00 00 04 00 18 00 00 00 00 \
532000 00 00 10 00 00 00 03 00 00 00 00 00 00 00 00 \
5321"
5322ovs-appctl time/warp 8000
5323# Send a bundle close, it should keep the bundle alive.
5324ovs-appctl -t ovs-ofctl ofctl/send "05 21 00 10 00 00 00 03 00 00 00 01 00 02 00 03"
5325ovs-appctl time/warp 11000
5326# Make sure that timeouts are processed after the expiry
5327ovs-appctl time/warp 1000
5328# Send a Commit, but too late.
5329ovs-appctl -t ovs-ofctl ofctl/send "05 21 00 10 00 00 00 04 00 00 00 01 00 04 00 03"
5330ovs-appctl -t ovs-ofctl ofctl/barrier
5331OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
5332
5333AT_CHECK([ofctl_strip < monitor.log], [], [dnl
5334send: OFPT_BUNDLE_CONTROL (OF1.4):
5335 bundle_id=0x1 type=OPEN_REQUEST flags=atomic ordered
5336OFPT_BUNDLE_CONTROL (OF1.4):
5337 bundle_id=0x1 type=OPEN_REPLY flags=0
5338send: OFPT_BUNDLE_ADD_MESSAGE (OF1.4):
5339 bundle_id=0x1 flags=atomic ordered
5340OFPT_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
5341send: OFPT_BUNDLE_CONTROL (OF1.4):
5342 bundle_id=0x1 type=CLOSE_REQUEST flags=atomic ordered
5343OFPT_BUNDLE_CONTROL (OF1.4):
5344 bundle_id=0x1 type=CLOSE_REPLY flags=0
5345OFPT_ERROR (OF1.4): OFPBFC_TIMEOUT
5346OFPT_BUNDLE_CONTROL (OF1.4):
5347 bundle_id=0x1 type=OPEN_REQUEST flags=atomic ordered
5348send: OFPT_BUNDLE_CONTROL (OF1.4):
5349 bundle_id=0x1 type=COMMIT_REQUEST flags=atomic ordered
5350OFPT_ERROR (OF1.4): OFPBFC_BAD_ID
5351OFPT_BUNDLE_CONTROL (OF1.4):
5352 bundle_id=0x1 type=COMMIT_REQUEST flags=atomic ordered
5353OFPT_BARRIER_REPLY (OF1.4):
5354])
5355
5356OVS_VSWITCHD_STOP
5357AT_CLEANUP
06d4d4b6
JR
5358
5359
5360AT_SETUP([ofproto - bundle open (OpenFlow 1.3)])
5361AT_KEYWORDS([monitor])
5362OVS_VSWITCHD_START
5363
5364# Start a monitor, use the required protocol version
5365ovs-ofctl -O OpenFlow13 monitor br0 --detach --no-chdir --pidfile >monitor.log 2>&1
5366AT_CAPTURE_FILE([monitor.log])
5367
5368# Send an OpenFlow13 message (04), OFPT_EXPERIMENTER (04), length (0018),
5369# xid (0000000a), ONF_EXPERIMENTER_ID (4F4E4600),
5370# ONFT_BUNDLE_CONTROL (2300 = 0x08FC), bundle id (00000001),
5371# message type (0000), and flags (0002)
5372ovs-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"
5373ovs-appctl -t ovs-ofctl ofctl/barrier
d9c8c57c 5374OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
06d4d4b6
JR
5375
5376AT_CHECK([ofctl_strip < monitor.log], [], [dnl
5377send: ONFT_BUNDLE_CONTROL (OF1.3):
5378 bundle_id=0x1 type=OPEN_REQUEST flags=ordered
5379ONFT_BUNDLE_CONTROL (OF1.3):
5380 bundle_id=0x1 type=OPEN_REPLY flags=0
5381OFPT_BARRIER_REPLY (OF1.3):
5382])
5383
5384OVS_VSWITCHD_STOP
5385AT_CLEANUP
5386
5387AT_SETUP([ofproto - bundle double open (OpenFlow 1.3)])
5388AT_KEYWORDS([monitor])
5389OVS_VSWITCHD_START
5390
5391# Start a monitor, use the required protocol version
5392ovs-ofctl -O OpenFlow13 monitor br0 --detach --no-chdir --pidfile >monitor.log 2>&1
5393AT_CAPTURE_FILE([monitor.log])
5394
5395# Send twice an OpenFlow13 message (04), OFPT_EXPERIMENTER (04), length (0018),
5396# xid (0000000a), ONF_EXPERIMENTER_ID (4F4E4600),
5397# ONFT_BUNDLE_CONTROL (2300 = 0x08FC), bundle id (00000001),
5398# message type (0000), and flags (0002)
5399ovs-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"
5400ovs-appctl -t ovs-ofctl ofctl/barrier
5401ovs-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"
5402ovs-appctl -t ovs-ofctl ofctl/barrier
d9c8c57c 5403OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
06d4d4b6
JR
5404
5405AT_CHECK([ofctl_strip < monitor.log], [0], [dnl
5406send: ONFT_BUNDLE_CONTROL (OF1.3):
5407 bundle_id=0x1 type=OPEN_REQUEST flags=ordered
5408ONFT_BUNDLE_CONTROL (OF1.3):
5409 bundle_id=0x1 type=OPEN_REPLY flags=0
5410OFPT_BARRIER_REPLY (OF1.3):
5411send: ONFT_BUNDLE_CONTROL (OF1.3):
5412 bundle_id=0x1 type=OPEN_REQUEST flags=ordered
5413OFPT_ERROR (OF1.3): OFPBFC_BAD_ID
5414ONFT_BUNDLE_CONTROL (OF1.3):
5415 bundle_id=0x1 type=OPEN_REQUEST flags=ordered
5416OFPT_BARRIER_REPLY (OF1.3):
5417])
5418
5419OVS_VSWITCHD_STOP
5420AT_CLEANUP
5421
5422AT_SETUP([ofproto - bundle close without open (OpenFlow 1.3)])
5423AT_KEYWORDS([monitor])
5424OVS_VSWITCHD_START
5425
5426# Start a monitor, use the required protocol version
5427ovs-ofctl -O OpenFlow13 monitor br0 --detach --no-chdir --pidfile >monitor.log 2>&1
5428AT_CAPTURE_FILE([monitor.log])
5429
5430ovs-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"
5431ovs-appctl -t ovs-ofctl ofctl/barrier
d9c8c57c 5432OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
06d4d4b6
JR
5433
5434AT_CHECK([ofctl_strip < monitor.log], [0], [dnl
5435send: ONFT_BUNDLE_CONTROL (OF1.3):
5436 bundle_id=0x1 type=CLOSE_REQUEST flags=ordered
5437OFPT_ERROR (OF1.3): OFPBFC_BAD_ID
5438ONFT_BUNDLE_CONTROL (OF1.3):
5439 bundle_id=0x1 type=CLOSE_REQUEST flags=ordered
5440OFPT_BARRIER_REPLY (OF1.3):
5441])
5442
5443OVS_VSWITCHD_STOP
5444AT_CLEANUP
5445
5446AT_SETUP([ofproto - bundle double close (OpenFlow 1.3)])
5447AT_KEYWORDS([monitor])
5448OVS_VSWITCHD_START
5449
5450# Start a monitor, use the required protocol version
5451ovs-ofctl -O OpenFlow13 monitor br0 --detach --no-chdir --pidfile >monitor.log 2>&1
5452AT_CAPTURE_FILE([monitor.log])
5453
5454# Open, Close, Close
5455ovs-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"
5456ovs-appctl -t ovs-ofctl ofctl/barrier
5457ovs-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"
5458ovs-appctl -t ovs-ofctl ofctl/barrier
5459ovs-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"
5460ovs-appctl -t ovs-ofctl ofctl/barrier
d9c8c57c 5461OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
06d4d4b6
JR
5462
5463AT_CHECK([ofctl_strip < monitor.log], [0], [dnl
5464send: ONFT_BUNDLE_CONTROL (OF1.3):
5465 bundle_id=0x1 type=OPEN_REQUEST flags=ordered
5466ONFT_BUNDLE_CONTROL (OF1.3):
5467 bundle_id=0x1 type=OPEN_REPLY flags=0
5468OFPT_BARRIER_REPLY (OF1.3):
5469send: ONFT_BUNDLE_CONTROL (OF1.3):
5470 bundle_id=0x1 type=CLOSE_REQUEST flags=ordered
5471ONFT_BUNDLE_CONTROL (OF1.3):
5472 bundle_id=0x1 type=CLOSE_REPLY flags=0
5473OFPT_BARRIER_REPLY (OF1.3):
5474send: ONFT_BUNDLE_CONTROL (OF1.3):
5475 bundle_id=0x1 type=CLOSE_REQUEST flags=ordered
5476OFPT_ERROR (OF1.3): OFPBFC_BUNDLE_CLOSED
5477ONFT_BUNDLE_CONTROL (OF1.3):
5478 bundle_id=0x1 type=CLOSE_REQUEST flags=ordered
5479OFPT_BARRIER_REPLY (OF1.3):
5480])
5481
5482OVS_VSWITCHD_STOP
5483AT_CLEANUP
5484
5485AT_SETUP([ofproto - bundle close, different flags (OpenFlow 1.3)])
5486AT_KEYWORDS([monitor])
5487OVS_VSWITCHD_START
5488
5489# Start a monitor, use the required protocol version
5490ovs-ofctl -O OpenFlow13 monitor br0 --detach --no-chdir --pidfile >monitor.log 2>&1
5491AT_CAPTURE_FILE([monitor.log])
5492
5493# Open, Close
5494ovs-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"
5495ovs-appctl -t ovs-ofctl ofctl/barrier
5496ovs-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"
5497ovs-appctl -t ovs-ofctl ofctl/barrier
d9c8c57c 5498OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
06d4d4b6
JR
5499
5500AT_CHECK([ofctl_strip < monitor.log], [0], [dnl
5501send: ONFT_BUNDLE_CONTROL (OF1.3):
5502 bundle_id=0x1 type=OPEN_REQUEST flags=ordered
5503ONFT_BUNDLE_CONTROL (OF1.3):
5504 bundle_id=0x1 type=OPEN_REPLY flags=0
5505OFPT_BARRIER_REPLY (OF1.3):
5506send: ONFT_BUNDLE_CONTROL (OF1.3):
5507 bundle_id=0x1 type=CLOSE_REQUEST flags=atomic
5508OFPT_ERROR (OF1.3): OFPBFC_BAD_FLAGS
5509ONFT_BUNDLE_CONTROL (OF1.3):
5510 bundle_id=0x1 type=CLOSE_REQUEST flags=atomic
5511OFPT_BARRIER_REPLY (OF1.3):
5512])
5513
5514OVS_VSWITCHD_STOP
5515AT_CLEANUP
5516
5517AT_SETUP([ofproto - bundle commit without open (OpenFlow 1.3)])
5518AT_KEYWORDS([monitor])
5519OVS_VSWITCHD_START
5520
5521# Start a monitor, use the required protocol version
5522ovs-ofctl -O OpenFlow13 monitor br0 --detach --no-chdir --pidfile >monitor.log 2>&1
5523AT_CAPTURE_FILE([monitor.log])
5524
5525# Commit
5526ovs-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"
5527ovs-appctl -t ovs-ofctl ofctl/barrier
d9c8c57c 5528OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
06d4d4b6
JR
5529
5530AT_CHECK([ofctl_strip < monitor.log], [0], [dnl
5531send: ONFT_BUNDLE_CONTROL (OF1.3):
5532 bundle_id=0x1 type=COMMIT_REQUEST flags=ordered
5533OFPT_ERROR (OF1.3): OFPBFC_BAD_ID
5534ONFT_BUNDLE_CONTROL (OF1.3):
5535 bundle_id=0x1 type=COMMIT_REQUEST flags=ordered
5536OFPT_BARRIER_REPLY (OF1.3):
5537])
5538
5539OVS_VSWITCHD_STOP
5540AT_CLEANUP
5541
5542AT_SETUP([ofproto - bundle commit, different flags (OpenFlow 1.3)])
5543AT_KEYWORDS([monitor])
5544OVS_VSWITCHD_START
5545
5546# Start a monitor, use the required protocol version
5547ovs-ofctl -O OpenFlow13 monitor br0 --detach --no-chdir --pidfile >monitor.log 2>&1
5548AT_CAPTURE_FILE([monitor.log])
5549
5550# Open, Commit
5551ovs-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"
5552ovs-appctl -t ovs-ofctl ofctl/barrier
5553ovs-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"
5554ovs-appctl -t ovs-ofctl ofctl/barrier
d9c8c57c 5555OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
06d4d4b6
JR
5556
5557AT_CHECK([ofctl_strip < monitor.log], [0], [dnl
5558send: ONFT_BUNDLE_CONTROL (OF1.3):
5559 bundle_id=0x1 type=OPEN_REQUEST flags=ordered
5560ONFT_BUNDLE_CONTROL (OF1.3):
5561 bundle_id=0x1 type=OPEN_REPLY flags=0
5562OFPT_BARRIER_REPLY (OF1.3):
5563send: ONFT_BUNDLE_CONTROL (OF1.3):
5564 bundle_id=0x1 type=COMMIT_REQUEST flags=atomic
5565OFPT_ERROR (OF1.3): OFPBFC_BAD_FLAGS
5566ONFT_BUNDLE_CONTROL (OF1.3):
5567 bundle_id=0x1 type=COMMIT_REQUEST flags=atomic
5568OFPT_BARRIER_REPLY (OF1.3):
5569])
5570
5571OVS_VSWITCHD_STOP
5572AT_CLEANUP
5573
5574AT_SETUP([ofproto - bundle discard without open (OpenFlow 1.3)])
5575AT_KEYWORDS([monitor])
5576OVS_VSWITCHD_START
5577
5578# Start a monitor, use the required protocol version
5579ovs-ofctl -O OpenFlow13 monitor br0 --detach --no-chdir --pidfile >monitor.log 2>&1
5580AT_CAPTURE_FILE([monitor.log])
5581
5582# Discard
5583ovs-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"
5584ovs-appctl -t ovs-ofctl ofctl/barrier
d9c8c57c 5585OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
06d4d4b6
JR
5586
5587AT_CHECK([ofctl_strip < monitor.log], [0], [dnl
5588send: ONFT_BUNDLE_CONTROL (OF1.3):
5589 bundle_id=0x1 type=DISCARD_REQUEST flags=ordered
5590OFPT_ERROR (OF1.3): OFPBFC_BAD_ID
5591ONFT_BUNDLE_CONTROL (OF1.3):
5592 bundle_id=0x1 type=DISCARD_REQUEST flags=ordered
5593OFPT_BARRIER_REPLY (OF1.3):
5594])
5595
5596OVS_VSWITCHD_STOP
5597AT_CLEANUP
5598
5599
5600AT_SETUP([ofproto - bundle with multiple flow mods (OpenFlow 1.3)])
06d4d4b6
JR
5601OVS_VSWITCHD_START
5602
5603AT_CHECK([ovs-appctl vlog/set vconn:dbg])
5604
50f96b10 5605AT_CHECK([ovs-ofctl --no-names del-flows br0])
06d4d4b6
JR
5606
5607AT_DATA([flows.txt], [dnl
5608add idle_timeout=50 in_port=2 dl_src=00:66:77:88:99:aa actions=1
5609add idle_timeout=60 in_port=2 dl_src=00:77:88:99:aa:bb actions=2
5610add idle_timeout=70 in_port=2 dl_src=00:88:99:aa:bb:cc actions=3
5611add idle_timeout=50 in_port=2 dl_src=00:66:77:88:99:aa actions=4
5612delete
5613add idle_timeout=50 in_port=2 dl_src=00:66:77:88:99:aa actions=5
5614add idle_timeout=60 in_port=2 dl_src=00:77:88:99:aa:bb actions=6
5615add idle_timeout=70 in_port=2 dl_src=00:88:99:aa:bb:cc actions=7
5616delete in_port=2 dl_src=00:88:99:aa:bb:cc
5617])
5618
50f96b10 5619AT_CHECK([ovs-ofctl -O OpenFlow13 --no-names --bundle add-flows br0 flows.txt])
06d4d4b6
JR
5620
5621AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
5622 idle_timeout=50, in_port=2,dl_src=00:66:77:88:99:aa actions=output:5
5623 idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=output:6
5624NXST_FLOW reply:
5625])
5626
5627AT_DATA([flows.txt], [dnl
5628modify actions=drop
5629modify_strict in_port=2 dl_src=00:77:88:99:aa:bb actions=7
5630])
5631
50f96b10 5632AT_CHECK([ovs-ofctl -O OpenFlow13 --no-names --bundle add-flows br0 flows.txt])
06d4d4b6
JR
5633
5634AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
5635 idle_timeout=50, in_port=2,dl_src=00:66:77:88:99:aa actions=drop
5636 idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=output:7
5637NXST_FLOW reply:
5638])
5639
5640# Adding an existing flow acts as a modify, and delete_strict also works.
5641AT_DATA([flows.txt], [dnl
5642add idle_timeout=60 in_port=2 dl_src=00:77:88:99:aa:bb actions=8
5643delete_strict in_port=2 dl_src=00:66:77:88:99:aa
5644add in_port=2 dl_src=00:66:77:88:99:aa actions=drop
5645])
5646
50f96b10 5647AT_CHECK([ovs-ofctl -O OpenFlow13 --bundle --no-names add-flows br0 flows.txt])
06d4d4b6
JR
5648
5649AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
5650 idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=output:8
5651 in_port=2,dl_src=00:66:77:88:99:aa actions=drop
5652NXST_FLOW reply:
5653])
5654
5655dnl Check logs for OpenFlow trace
5656# Prevent race.
5657OVS_WAIT_UNTIL([vconn_sub < ovs-vswitchd.log | test `grep -- "|vconn|DBG|unix: sent (Success): NXST_FLOW reply" | wc -l` -ge 3])
5658AT_CHECK([print_vconn_debug | vconn_sub | ofctl_strip], [0], [dnl
b79d45a1
BP
5659vconn|DBG|unix: sent (Success): OFPT_HELLO (OF1.6):
5660 version bitmap: 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07
06d4d4b6
JR
5661vconn|DBG|unix: received: OFPT_HELLO:
5662 version bitmap: 0x01
b79d45a1 5663vconn|DBG|unix: negotiated OpenFlow version 0x01 (we support version 0x07 and earlier, peer supports version 0x01)
06d4d4b6
JR
5664vconn|DBG|unix: received: OFPT_FLOW_MOD: DEL actions=drop
5665vconn|DBG|unix: received: OFPT_BARRIER_REQUEST:
5666vconn|DBG|unix: sent (Success): OFPT_BARRIER_REPLY:
b79d45a1
BP
5667vconn|DBG|unix: sent (Success): OFPT_HELLO (OF1.6):
5668 version bitmap: 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07
06d4d4b6
JR
5669vconn|DBG|unix: received: OFPT_HELLO (OF1.3):
5670 version bitmap: 0x04
b79d45a1 5671vconn|DBG|unix: negotiated OpenFlow version 0x04 (we support version 0x07 and earlier, peer supports version 0x04)
06d4d4b6
JR
5672vconn|DBG|unix: received: ONFT_BUNDLE_CONTROL (OF1.3):
5673 bundle_id=0 type=OPEN_REQUEST flags=atomic ordered
5674vconn|DBG|unix: sent (Success): ONFT_BUNDLE_CONTROL (OF1.3):
5675 bundle_id=0 type=OPEN_REPLY flags=0
5676vconn|DBG|unix: received: ONFT_BUNDLE_ADD_MESSAGE (OF1.3):
5677 bundle_id=0 flags=atomic ordered
5678OFPT_FLOW_MOD (OF1.3): ADD in_port=2,dl_src=00:66:77:88:99:aa idle:50 actions=output:1
5679vconn|DBG|unix: received: ONFT_BUNDLE_ADD_MESSAGE (OF1.3):
5680 bundle_id=0 flags=atomic ordered
5681OFPT_FLOW_MOD (OF1.3): ADD in_port=2,dl_src=00:77:88:99:aa:bb idle:60 actions=output:2
5682vconn|DBG|unix: received: ONFT_BUNDLE_ADD_MESSAGE (OF1.3):
5683 bundle_id=0 flags=atomic ordered
5684OFPT_FLOW_MOD (OF1.3): ADD in_port=2,dl_src=00:88:99:aa:bb:cc idle:70 actions=output:3
5685vconn|DBG|unix: received: ONFT_BUNDLE_ADD_MESSAGE (OF1.3):
5686 bundle_id=0 flags=atomic ordered
5687OFPT_FLOW_MOD (OF1.3): ADD in_port=2,dl_src=00:66:77:88:99:aa idle:50 actions=output:4
5688vconn|DBG|unix: received: ONFT_BUNDLE_ADD_MESSAGE (OF1.3):
5689 bundle_id=0 flags=atomic ordered
5690OFPT_FLOW_MOD (OF1.3): DEL table:255 actions=drop
5691vconn|DBG|unix: received: ONFT_BUNDLE_ADD_MESSAGE (OF1.3):
5692 bundle_id=0 flags=atomic ordered
5693OFPT_FLOW_MOD (OF1.3): ADD in_port=2,dl_src=00:66:77:88:99:aa idle:50 actions=output:5
5694vconn|DBG|unix: received: ONFT_BUNDLE_ADD_MESSAGE (OF1.3):
5695 bundle_id=0 flags=atomic ordered
5696OFPT_FLOW_MOD (OF1.3): ADD in_port=2,dl_src=00:77:88:99:aa:bb idle:60 actions=output:6
5697vconn|DBG|unix: received: ONFT_BUNDLE_ADD_MESSAGE (OF1.3):
5698 bundle_id=0 flags=atomic ordered
5699OFPT_FLOW_MOD (OF1.3): ADD in_port=2,dl_src=00:88:99:aa:bb:cc idle:70 actions=output:7
5700vconn|DBG|unix: received: ONFT_BUNDLE_ADD_MESSAGE (OF1.3):
5701 bundle_id=0 flags=atomic ordered
5702OFPT_FLOW_MOD (OF1.3): DEL table:255 in_port=2,dl_src=00:88:99:aa:bb:cc actions=drop
506c1ddb
JR
5703vconn|DBG|unix: received: OFPT_BARRIER_REQUEST (OF1.3):
5704vconn|DBG|unix: sent (Success): OFPT_BARRIER_REPLY (OF1.3):
06d4d4b6
JR
5705vconn|DBG|unix: received: ONFT_BUNDLE_CONTROL (OF1.3):
5706 bundle_id=0 type=COMMIT_REQUEST flags=atomic ordered
5707vconn|DBG|unix: sent (Success): ONFT_BUNDLE_CONTROL (OF1.3):
5708 bundle_id=0 type=COMMIT_REPLY flags=0
b79d45a1
BP
5709vconn|DBG|unix: sent (Success): OFPT_HELLO (OF1.6):
5710 version bitmap: 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07
06d4d4b6
JR
5711vconn|DBG|unix: received: OFPT_HELLO:
5712 version bitmap: 0x01
b79d45a1 5713vconn|DBG|unix: negotiated OpenFlow version 0x01 (we support version 0x07 and earlier, peer supports version 0x01)
06d4d4b6
JR
5714vconn|DBG|unix: received: NXT_SET_FLOW_FORMAT: format=nxm
5715vconn|DBG|unix: received: OFPT_BARRIER_REQUEST:
5716vconn|DBG|unix: sent (Success): OFPT_BARRIER_REPLY:
5717vconn|DBG|unix: received: NXST_FLOW request:
5718vconn|DBG|unix: sent (Success): NXST_FLOW reply:
5719 idle_timeout=50, in_port=2,dl_src=00:66:77:88:99:aa actions=output:5
5720 idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=output:6
b79d45a1
BP
5721vconn|DBG|unix: sent (Success): OFPT_HELLO (OF1.6):
5722 version bitmap: 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07
06d4d4b6
JR
5723vconn|DBG|unix: received: OFPT_HELLO (OF1.3):
5724 version bitmap: 0x04
b79d45a1 5725vconn|DBG|unix: negotiated OpenFlow version 0x04 (we support version 0x07 and earlier, peer supports version 0x04)
06d4d4b6
JR
5726vconn|DBG|unix: received: ONFT_BUNDLE_CONTROL (OF1.3):
5727 bundle_id=0 type=OPEN_REQUEST flags=atomic ordered
5728vconn|DBG|unix: sent (Success): ONFT_BUNDLE_CONTROL (OF1.3):
5729 bundle_id=0 type=OPEN_REPLY flags=0
5730vconn|DBG|unix: received: ONFT_BUNDLE_ADD_MESSAGE (OF1.3):
5731 bundle_id=0 flags=atomic ordered
5732OFPT_FLOW_MOD (OF1.3): MOD actions=drop
5733vconn|DBG|unix: received: ONFT_BUNDLE_ADD_MESSAGE (OF1.3):
5734 bundle_id=0 flags=atomic ordered
5735OFPT_FLOW_MOD (OF1.3): MOD_STRICT in_port=2,dl_src=00:77:88:99:aa:bb actions=output:7
506c1ddb
JR
5736vconn|DBG|unix: received: OFPT_BARRIER_REQUEST (OF1.3):
5737vconn|DBG|unix: sent (Success): OFPT_BARRIER_REPLY (OF1.3):
06d4d4b6
JR
5738vconn|DBG|unix: received: ONFT_BUNDLE_CONTROL (OF1.3):
5739 bundle_id=0 type=COMMIT_REQUEST flags=atomic ordered
5740vconn|DBG|unix: sent (Success): ONFT_BUNDLE_CONTROL (OF1.3):
5741 bundle_id=0 type=COMMIT_REPLY flags=0
b79d45a1
BP
5742vconn|DBG|unix: sent (Success): OFPT_HELLO (OF1.6):
5743 version bitmap: 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07
06d4d4b6
JR
5744vconn|DBG|unix: received: OFPT_HELLO:
5745 version bitmap: 0x01
b79d45a1 5746vconn|DBG|unix: negotiated OpenFlow version 0x01 (we support version 0x07 and earlier, peer supports version 0x01)
06d4d4b6
JR
5747vconn|DBG|unix: received: NXT_SET_FLOW_FORMAT: format=nxm
5748vconn|DBG|unix: received: OFPT_BARRIER_REQUEST:
5749vconn|DBG|unix: sent (Success): OFPT_BARRIER_REPLY:
5750vconn|DBG|unix: received: NXST_FLOW request:
5751vconn|DBG|unix: sent (Success): NXST_FLOW reply:
5752 idle_timeout=50, in_port=2,dl_src=00:66:77:88:99:aa actions=drop
5753 idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=output:7
b79d45a1
BP
5754vconn|DBG|unix: sent (Success): OFPT_HELLO (OF1.6):
5755 version bitmap: 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07
06d4d4b6
JR
5756vconn|DBG|unix: received: OFPT_HELLO (OF1.3):
5757 version bitmap: 0x04
b79d45a1 5758vconn|DBG|unix: negotiated OpenFlow version 0x04 (we support version 0x07 and earlier, peer supports version 0x04)
06d4d4b6
JR
5759vconn|DBG|unix: received: ONFT_BUNDLE_CONTROL (OF1.3):
5760 bundle_id=0 type=OPEN_REQUEST flags=atomic ordered
5761vconn|DBG|unix: sent (Success): ONFT_BUNDLE_CONTROL (OF1.3):
5762 bundle_id=0 type=OPEN_REPLY flags=0
5763vconn|DBG|unix: received: ONFT_BUNDLE_ADD_MESSAGE (OF1.3):
5764 bundle_id=0 flags=atomic ordered
5765OFPT_FLOW_MOD (OF1.3): ADD in_port=2,dl_src=00:77:88:99:aa:bb idle:60 actions=output:8
5766vconn|DBG|unix: received: ONFT_BUNDLE_ADD_MESSAGE (OF1.3):
5767 bundle_id=0 flags=atomic ordered
5768OFPT_FLOW_MOD (OF1.3): DEL_STRICT table:255 in_port=2,dl_src=00:66:77:88:99:aa actions=drop
5769vconn|DBG|unix: received: ONFT_BUNDLE_ADD_MESSAGE (OF1.3):
5770 bundle_id=0 flags=atomic ordered
5771OFPT_FLOW_MOD (OF1.3): ADD in_port=2,dl_src=00:66:77:88:99:aa actions=drop
506c1ddb
JR
5772vconn|DBG|unix: received: OFPT_BARRIER_REQUEST (OF1.3):
5773vconn|DBG|unix: sent (Success): OFPT_BARRIER_REPLY (OF1.3):
06d4d4b6
JR
5774vconn|DBG|unix: received: ONFT_BUNDLE_CONTROL (OF1.3):
5775 bundle_id=0 type=COMMIT_REQUEST flags=atomic ordered
5776vconn|DBG|unix: sent (Success): ONFT_BUNDLE_CONTROL (OF1.3):
5777 bundle_id=0 type=COMMIT_REPLY flags=0
b79d45a1
BP
5778vconn|DBG|unix: sent (Success): OFPT_HELLO (OF1.6):
5779 version bitmap: 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07
06d4d4b6
JR
5780vconn|DBG|unix: received: OFPT_HELLO:
5781 version bitmap: 0x01
b79d45a1 5782vconn|DBG|unix: negotiated OpenFlow version 0x01 (we support version 0x07 and earlier, peer supports version 0x01)
06d4d4b6
JR
5783vconn|DBG|unix: received: NXT_SET_FLOW_FORMAT: format=nxm
5784vconn|DBG|unix: received: OFPT_BARRIER_REQUEST:
5785vconn|DBG|unix: sent (Success): OFPT_BARRIER_REPLY:
5786vconn|DBG|unix: received: NXST_FLOW request:
5787vconn|DBG|unix: sent (Success): NXST_FLOW reply:
5788 idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=output:8
5789 in_port=2,dl_src=00:66:77:88:99:aa actions=drop
5790])
5791
5792OVS_VSWITCHD_STOP
5793AT_CLEANUP
5794
5795
506c1ddb 5796AT_SETUP([ofproto - failing bundle add message (OpenFlow 1.3)])
06d4d4b6
JR
5797OVS_VSWITCHD_START
5798
5799AT_CHECK([ovs-ofctl del-flows br0])
5800
5801ovs-ofctl add-flows br0 - <<EOF
5802idle_timeout=50 in_port=2 dl_src=00:66:77:88:99:aa actions=11
5803idle_timeout=60 in_port=2 dl_src=00:77:88:99:aa:bb actions=22
5804idle_timeout=70 in_port=2 dl_src=00:88:99:aa:bb:cc actions=33
5805EOF
5806AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
5807 idle_timeout=50, in_port=2,dl_src=00:66:77:88:99:aa actions=output:11
5808 idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=output:22
5809 idle_timeout=70, in_port=2,dl_src=00:88:99:aa:bb:cc actions=output:33
5810NXST_FLOW reply:
5811])
5812
5813# last line uses illegal table number (OVS internal table)
5814AT_DATA([flows.txt], [dnl
5815add idle_timeout=50 in_port=2 dl_src=00:66:77:88:99:aa actions=1
5816add idle_timeout=60 in_port=2 dl_src=00:77:88:99:aa:bb actions=2
5817add idle_timeout=70 in_port=2 dl_src=00:88:99:aa:bb:cc actions=3
5818modify idle_timeout=50 in_port=2 dl_src=00:66:77:88:99:aa actions=4
5819delete
5820add idle_timeout=50 in_port=2 dl_src=00:66:77:88:99:aa actions=5
5821add idle_timeout=60 in_port=2 dl_src=00:77:88:99:aa:bb actions=6
5822add idle_timeout=70 in_port=2 dl_src=00:88:99:aa:bb:cc actions=7
5823delete in_port=2 dl_src=00:88:99:aa:bb:cc
5824add table=254 actions=drop
5825])
5826
50f96b10 5827AT_CHECK([ovs-ofctl -O OpenFlow13 --bundle add-flows br0 flows.txt 2>&1 | sed '/talking to/,$d' | strip_xids],
06d4d4b6 5828[0], [dnl
50f96b10 5829Error OFPBRC_EPERM for: OFPT_FLOW_MOD (OF1.3): ADD table:254 actions=drop
06d4d4b6
JR
5830])
5831
5832AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
5833 idle_timeout=50, in_port=2,dl_src=00:66:77:88:99:aa actions=output:11
5834 idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=output:22
5835 idle_timeout=70, in_port=2,dl_src=00:88:99:aa:bb:cc actions=output:33
5836NXST_FLOW reply:
5837])
5838
5839OVS_VSWITCHD_STOP
5840AT_CLEANUP
25070e04
JR
5841
5842
5843AT_SETUP([ofproto - failing bundle commit (OpenFlow 1.3)])
25070e04
JR
5844OVS_VSWITCHD_START
5845
5846AT_CHECK([ovs-ofctl del-flows br0])
5847
5848# Invalid group numbers are detected at commit time
5849AT_DATA([flows.txt], [dnl
5850add idle_timeout=50 in_port=2 dl_src=00:66:77:88:99:aa actions=group:1
5851add idle_timeout=60 in_port=2 dl_src=00:77:88:99:aa:bb actions=group:2
5852add idle_timeout=70 in_port=2 dl_src=00:88:99:aa:bb:cc actions=group:3
5853])
5854
50f96b10 5855AT_CHECK([ovs-ofctl -O OpenFlow13 --bundle add-flows br0 flows.txt 2>&1 | sed '/talking to/,$d' | strip_xids],
25070e04 5856[0], [dnl
50f96b10
BP
5857Error 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
5858Error OFPBFC_MSG_FAILED for: ONFT_BUNDLE_CONTROL (OF1.3):
25070e04
JR
5859 bundle_id=0 type=COMMIT_REQUEST flags=atomic ordered
5860])
5861
5862AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
5863NXST_FLOW reply:
5864])
5865
5866OVS_VSWITCHD_STOP
5867AT_CLEANUP
140f36ba
DDP
5868
5869AT_SETUP([ofproto - monitor flows with tun_md])
5870OVS_VSWITCHD_START
5871
5872AT_CHECK([ovs-ofctl add-tlv-map br0 "{class=0xffff,type=0,len=4}->tun_metadata0"])
5873AT_CHECK([ovs-ofctl add-flow br0 tun_metadata0=0x1,actions=drop])
5874
5875AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip], [0], [dnl
5876NXST_FLOW reply:
5877 tun_metadata0=0x1 actions=drop
5878])
5879
5880AT_CAPTURE_FILE([ofctl_monitor.log])
5881dnl Usually ovs-ofctl monitor outputs on stderr, but the first message here
5882dnl is put on stdout, because it is handled by ofctl in dump_transaction()
5883dnl and not in monitor_vconn().
5884AT_CHECK([ovs-ofctl monitor br0 65534 watch: --detach --no-chdir --pidfile >ofctl_monitor.log 2>&1])
5885
5886OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 2])
5887
5888AT_CHECK([cat ofctl_monitor.log | ofctl_strip], [0], [dnl
5889NXST_FLOW_MONITOR reply:
5890 event=ADDED table=0 cookie=0 tun_metadata0=0x1
5891])
5892
5893AT_CHECK([ovs-ofctl del-flows br0])
5894
5895OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 4])
5896
5897AT_CHECK([cat ofctl_monitor.log | ofctl_strip], [0], [dnl
5898NXST_FLOW_MONITOR reply:
5899 event=ADDED table=0 cookie=0 tun_metadata0=0x1
5900NXST_FLOW_MONITOR reply:
5901 event=DELETED reason=delete table=0 cookie=0 tun_metadata0=0x1
5902])
5903
5904OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
5905
5906dnl Check that vswitchd hasn't crashed
5907AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip], [0], [dnl
5908NXST_FLOW reply:
5909])
5910
5911OVS_VSWITCHD_STOP
5912AT_CLEANUP
04f48a68
YHW
5913
5914AT_SETUP([ofproto - flow mod with tunnel metadata])
5915AT_KEYWORDS([ofp-actions])
5916OVS_VSWITCHD_START
5917
5918AT_CHECK([ovs-ofctl add-tlv-map br0 "{class=0xffff,type=0,len=4}->tun_metadata0"])
5919AT_CHECK([ovs-ofctl add-flow br0 "in_port=1 actions=move:tun_metadata0[[0..31]]->NXM_NX_REG0[[]]"])
5920
5921dnl Check the length of tun_metadata0 in the replied OXM header.
5922dnl Ignore the first 0x50 bytes of hex dump from the reply msg since the NXM
5923dnl header that describes the tunnel metadata starts at offset 0x50.
5924AT_CHECK([ovs-ofctl dump-flows br0 -mmmm], [0], [stdout])
50f96b10
BP
5925AT_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
5926NXST_FLOW reply:
04f48a68
YHW
5927 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[[]]
592800000050 ff ff 00 18 00 00 23 20-00 06 00 20 00 00 00 00 |......# ... ....|
592900000060 00 01 50 04 00 01 00 04- |..P..... |
5930])
5931
5932dnl Check actions that may use tun_metadata
5933AT_CHECK([ovs-ofctl add-flow br0 "in_port=2 actions=move:tun_metadata1[[0..31]]->NXM_NX_REG0[[]]"], [1], [], [stderr])
5934AT_CHECK([strip_xids < stderr | sed '/FLOW_MOD/,$d'], [0], [dnl
5935OFPT_ERROR: NXFMFC_INVALID_TLV_FIELD
5936])
5937
5938AT_CHECK([ovs-ofctl add-flow br0 "in_port=2 actions=move:tun_metadata0[[32..63]]->NXM_NX_REG0[[]]"], [1], [], [stderr])
5939AT_CHECK([strip_xids < stderr | sed '/FLOW_MOD/,$d'], [0], [dnl
5940OFPT_ERROR: OFPBAC_BAD_SET_LEN
5941])
5942
5943AT_CHECK([ovs-ofctl add-flow br0 "in_port=2 actions=push:tun_metadata1[[0..31]]"], [1], [], [stderr])
5944AT_CHECK([strip_xids < stderr | sed '/FLOW_MOD/,$d'], [0], [dnl
5945OFPT_ERROR: NXFMFC_INVALID_TLV_FIELD
5946])
5947
5948AT_CHECK([ovs-ofctl add-flow br0 "in_port=2 actions=pop:tun_metadata0[[32..63]]"], [1], [], [stderr])
5949AT_CHECK([strip_xids < stderr | sed '/FLOW_MOD/,$d'], [0], [dnl
5950OFPT_ERROR: OFPBAC_BAD_SET_LEN
5951])
5952
5953AT_CHECK([ovs-ofctl add-flow br0 "in_port=3, actions=load:0x11223344->tun_metadata1"], [1], [], [stderr])
5954AT_CHECK([strip_xids < stderr | sed '/FLOW_MOD/,$d'], [0], [dnl
5955OFPT_ERROR: NXFMFC_INVALID_TLV_FIELD
5956])
5957
5958AT_CHECK([ovs-ofctl add-flow br0 "in_port=2 actions=output:tun_metadata1[[0..31]]"], [1], [], [stderr])
5959AT_CHECK([strip_xids < stderr | sed '/FLOW_MOD/,$d'], [0], [dnl
5960OFPT_ERROR: NXFMFC_INVALID_TLV_FIELD
5961])
5962
5963AT_CHECK([ovs-ofctl add-flow br0 "in_port=2 actions=output:tun_metadata0[[32..63]]"], [1], [], [stderr])
5964AT_CHECK([strip_xids < stderr | sed '/FLOW_MOD/,$d'], [0], [dnl
5965OFPT_ERROR: OFPBAC_BAD_SET_LEN
5966])
5967
5968AT_CHECK([ovs-ofctl add-flow br0 "in_port=2 actions=multipath(eth_src,50,modulo_n,1,0,tun_metadata1[[0..31]])"], [1], [], [stderr])
5969AT_CHECK([strip_xids < stderr | sed '/FLOW_MOD/,$d'], [0], [dnl
5970OFPT_ERROR: NXFMFC_INVALID_TLV_FIELD
5971])
5972
5973AT_CHECK([ovs-ofctl add-flow br0 "in_port=2 actions=multipath(eth_src,50,modulo_n,1,0,tun_metadata0[[32..63]])"], [1], [], [stderr])
5974AT_CHECK([strip_xids < stderr | sed '/FLOW_MOD/,$d'], [0], [dnl
5975OFPT_ERROR: OFPBAC_BAD_SET_LEN
5976])
5977
5978AT_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])
5979AT_CHECK([strip_xids < stderr | sed '/FLOW_MOD/,$d'], [0], [dnl
5980OFPT_ERROR: NXFMFC_INVALID_TLV_FIELD
5981])
5982
5983AT_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])
5984AT_CHECK([strip_xids < stderr | sed '/FLOW_MOD/,$d'], [0], [dnl
5985OFPT_ERROR: OFPBAC_BAD_SET_LEN
5986])
5987
5988AT_CHECK([ovs-ofctl add-flow br0 "in_port=2 actions=learn(tun_metadata1[[0..31]]=reg0[[0..31]])"], [1], [], [stderr])
5989AT_CHECK([strip_xids < stderr | sed '/FLOW_MOD/,$d'], [0], [dnl
5990OFPT_ERROR: NXFMFC_INVALID_TLV_FIELD
5991])
5992
5993AT_CHECK([ovs-ofctl add-flow br0 "in_port=2 actions=learn(tun_metadata0[[32..63]]=reg0[[0..31]])"], [1], [], [stderr])
5994AT_CHECK([strip_xids < stderr | sed '/FLOW_MOD/,$d'], [0], [dnl
5995OFPT_ERROR: OFPBAC_BAD_SET_LEN
5996])
5997
5998AT_CHECK([ovs-ofctl add-flow br0 "in_port=2 actions=clone(move:tun_metadata1[[0..31]]->reg0[[0..31]])"], [1], [], [stderr])
5999AT_CHECK([strip_xids < stderr | sed '/FLOW_MOD/,$d'], [0], [dnl
6000OFPT_ERROR: NXFMFC_INVALID_TLV_FIELD
6001])
6002
6003AT_CHECK([ovs-ofctl add-flow br0 "in_port=2 actions=clone(move:tun_metadata0[[32..63]]->reg0[[0..31]])"], [1], [], [stderr])
6004AT_CHECK([strip_xids < stderr | sed '/FLOW_MOD/,$d'], [0], [dnl
6005OFPT_ERROR: OFPBAC_BAD_SET_LEN
6006])
6007
6008AT_CHECK([ovs-ofctl add-flow br0 "ip actions=ct(commit,zone=tun_metadata1[[0..15]],exec(set_field:0x01->ct_mark))"], [1], [], [stderr])
6009AT_CHECK([strip_xids < stderr | sed '/FLOW_MOD/,$d'], [0], [dnl
6010OFPT_ERROR: NXFMFC_INVALID_TLV_FIELD
6011])
6012
6013AT_CHECK([ovs-ofctl add-flow br0 "ip actions=ct(commit,zone=tun_metadata0[[32..47]],exec(set_field:0x01->ct_mark))"], [1], [], [stderr])
6014AT_CHECK([strip_xids < stderr | sed '/FLOW_MOD/,$d'], [0], [dnl
6015OFPT_ERROR: OFPBAC_BAD_SET_LEN
6016])
6017
6018AT_CHECK([ovs-ofctl add-flow br0 "ip actions=ct(commit,zone=1,exec(move:tun_metadata1[[0..31]]->ct_mark))"], [1], [], [stderr])
6019AT_CHECK([strip_xids < stderr | sed '/FLOW_MOD/,$d'], [0], [dnl
6020OFPT_ERROR: NXFMFC_INVALID_TLV_FIELD
6021])
6022
6023AT_CHECK([ovs-ofctl add-flow br0 "ip actions=ct(commit,zone=1,exec(move:tun_metadata0[[32..63]]->ct_mark))"], [1], [], [stderr])
6024AT_CHECK([strip_xids < stderr | sed '/FLOW_MOD/,$d'], [0], [dnl
6025OFPT_ERROR: OFPBAC_BAD_SET_LEN
6026])
6027
3cddeff0
YHW
6028dnl Check match field with tun_metadata
6029AT_CHECK([ovs-ofctl add-flow br0 "tun_metadata0=0x11223344 actions=output:2"], [0], [], [stderr])
6030AT_CHECK([ovs-ofctl add-flow br0 "tun_metadata1=0x11223344 actions=output:2"], [1], [], [stderr])
6031AT_CHECK([strip_xids < stderr | sed '/FLOW_MOD/,$d'], [0], [dnl
6032OFPT_ERROR: NXFMFC_INVALID_TLV_FIELD
6033])
6034
6035AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip], [0], [dnl)
6036NXST_FLOW reply:
6037 in_port=1 actions=move:NXM_NX_TUN_METADATA0[[0..31]]->NXM_NX_REG0[[]]
6038 tun_metadata0=0x11223344 actions=output:2
04f48a68
YHW
6039])
6040
6041OVS_VSWITCHD_STOP(["/NXFMFC_INVALID_TLV_FIELD/d
6042/tun_metadata0/d
6043/OFPBAC_BAD_SET_LEN/d"])
6044AT_CLEANUP
d3b84833
BP
6045
6046AT_SETUP([ofproto - flush flows, groups, and meters for controller change])
6047AT_KEYWORDS([flow flows group group meter])
6048OVS_VSWITCHD_START
6049
6050add_flow_group_and_meter () {
6051 AT_CHECK([ovs-ofctl add-flow br0 in_port=1,actions=2])
6052 AT_CHECK([ovs-ofctl -O OpenFlow11 add-group br0 group_id=1234,type=all,bucket=output:10
6053 AT_CHECK([ovs-ofctl -O OpenFlow13 add-meter br0 'meter=1 pktps burst stats bands=type=drop rate=1 burst_size=1'])
6054])
6055}
6056
6057verify_added () {
6058 AT_CHECK([ovs-ofctl --no-stats dump-flows br0], [0], [dnl
6059 in_port=1 actions=output:2
6060])
6061 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-groups br0], [0], [dnl
6062OFPST_GROUP_DESC reply (OF1.1) (xid=0x2):
6063 group_id=1234,type=all,bucket=actions=output:10
6064])
6065 AT_CHECK([ovs-ofctl -O OpenFlow13 dump-meters br0], [0], [dnl
6066OFPST_METER_CONFIG reply (OF1.3) (xid=0x2):
6067meter=1 pktps burst stats bands=
6068type=drop rate=1 burst_size=1
6069])
6070}
6071
6072verify_deleted () {
6073 AT_CHECK([ovs-ofctl --no-stats dump-flows br0])
6074 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-groups br0], [0], [dnl
6075OFPST_GROUP_DESC reply (OF1.1) (xid=0x2):
6076])
6077 AT_CHECK([ovs-ofctl -O OpenFlow13 dump-meters br0], [0], [dnl
6078OFPST_METER_CONFIG reply (OF1.3) (xid=0x2):
6079])
6080}
6081
6082# Add flow, group, meter and check that they're there, without a controller.
6083add_flow_group_and_meter
6084verify_added
6085
6086# Set up a controller and verify that the flow and group were deleted,
6087# then add them back.
6088AT_CHECK([ovs-vsctl set-controller br0 'tcp:<invalid>:6653'])
6089verify_deleted
6090add_flow_group_and_meter
6091verify_added
6092
6093# Change the controller and verify that the flow and group are still there.
6094AT_CHECK([ovs-vsctl set-controller br0 'tcp:<invalid2>:6653'])
6095verify_added
6096
6097# Clear the controller and verify that the flow and group were deleted.
6098AT_CHECK([ovs-vsctl del-controller br0])
6099verify_deleted
6100
6101OVS_VSWITCHD_STOP(["/<invalid/d"])
6102AT_CLEANUP