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