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