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