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