]> git.proxmox.com Git - ovs.git/blame - tests/ofproto.at
Add MAINTAINERS file.
[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
14AT_CHECK([ovs-ofctl -P openflow10 monitor br0 --detach --no-chdir --pidfile])
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
19ovs-appctl -t ovs-ofctl exit
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])
640c7c94 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])
eaa6eb2a
BP
85AT_CHECK([STRIP_XIDS stdout], [0], [dnl
86OFPST_PORT reply: 1 ports
e1db42d6 87 port LOCAL: rx pkts=0, bytes=0, drop=0, errs=0, frame=0, over=0, crc=0
eaa6eb2a
BP
88 tx pkts=0, bytes=0, drop=0, errs=0, coll=0
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])
96AT_CHECK([STRIP_XIDS stdout], [0], [dnl
97OFPST_PORT reply (OF1.2): 1 ports
e1db42d6 98 port LOCAL: rx pkts=0, bytes=0, drop=0, errs=0, frame=0, over=0, crc=0
9dcd1c00
SH
99 tx pkts=0, bytes=0, drop=0, errs=0, coll=0
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])
107AT_CHECK([STRIP_XIDS stdout | sed 's/duration=[[0-9.]]*s/duration=?s/'],
108 [0], [dnl
109OFPST_PORT reply (OF1.4): 1 ports
110 port LOCAL: rx pkts=0, bytes=0, drop=0, errs=0, frame=0, over=0, crc=0
111 tx pkts=0, bytes=0, drop=0, errs=0, coll=0
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])
122AT_CHECK([STRIP_XIDS stdout], [0], [dnl
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])
137AT_CHECK([STRIP_XIDS stdout], [0], [dnl
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
149ADD_OF_PORTS([br0], 1, 2, 3)
150AT_CHECK([ovs-ofctl -F OXM-OpenFlow15 -O OpenFlow15 -vwarn dump-ports-desc br0], [0], [stdout])
151AT_CHECK([STRIP_XIDS stdout | sed 's/00:0./00:0x/'], [0], [dnl
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])
171AT_CHECK([STRIP_XIDS stdout | sed 's/00:0./00:0x/'], [0], [dnl
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
BP
185
186AT_CHECK([ovs-ofctl -O $2 queue-stats br0 | STRIP_XIDS], [0],
187 [OFPST_QUEUE reply$3: 1 queues
188 port LOCAL queue 0: bytes=?, pkts=?, errors=?, duration=?
0414d158 189])
eaa6eb2a 190
f72dff1a
BP
191AT_CHECK([ovs-ofctl -O $2 queue-stats br0 LOCAL | STRIP_XIDS], [0],
192 [OFPST_QUEUE reply$3: 1 queues
193 port LOCAL queue 0: bytes=?, pkts=?, errors=?, duration=?
9dcd1c00 194])
f72dff1a
BP
195
196AT_CHECK([ovs-ofctl -O $2 queue-stats br0 LOCAL 0 | STRIP_XIDS], [0],
197 [OFPST_QUEUE reply$3: 1 queues
198 port LOCAL queue 0: bytes=?, pkts=?, errors=?, duration=?
9dcd1c00 199])
f72dff1a
BP
200
201AT_CHECK([ovs-ofctl -O $2 queue-stats br0 ANY 0 | STRIP_XIDS], [0],
202 [OFPST_QUEUE reply$3: 1 queues
203 port LOCAL queue 0: bytes=?, pkts=?, errors=?, duration=?
9dcd1c00 204])
9dcd1c00 205
f72dff1a
BP
206AT_CHECK([ovs-ofctl -O $2 queue-stats br0 LOCAL 5 | STRIP_XIDS], [0],
207 [OFPT_ERROR$3: OFPQOFC_BAD_QUEUE
208OFPST_QUEUE request$3: port=LOCAL queue=5
1bb2cdbe 209])
f72dff1a
BP
210
211AT_CHECK([ovs-ofctl -O $2 queue-stats br0 ANY 5 | STRIP_XIDS], [0],
212 [OFPT_ERROR$3: OFPQOFC_BAD_QUEUE
213OFPST_QUEUE request$3: port=ANY queue=5
1bb2cdbe 214])
f72dff1a
BP
215
216AT_CHECK([ovs-ofctl -O $2 queue-stats br0 10 | STRIP_XIDS], [0],
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
233ADD_OF_PORTS([br0], [1], [2])
234AT_CHECK([ovs-ofctl queue-get-config br0 1], [0], [stdout])
235AT_CHECK([STRIP_XIDS stdout], [0], [dnl
236OFPT_QUEUE_GET_CONFIG_REPLY: port=1
f72dff1a 237queue 0:
e8f9a7bb 238])
56085be5
BP
239AT_CHECK([ovs-ofctl queue-get-config br0], [0], [stdout])
240AT_CHECK([STRIP_XIDS stdout | sort], [0], [dnl
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
255ADD_OF_PORTS([br0], [1], [2])
e016fb63 256AT_CHECK([ovs-ofctl -O OpenFlow11 queue-get-config br0 1], [0], [stdout])
d2e5fa1f 257AT_CHECK([STRIP_XIDS stdout], [0], [dnl
e016fb63 258OFPT_QUEUE_GET_CONFIG_REPLY (OF1.1): port=1
f72dff1a 259queue 0:
d2e5fa1f 260])
e016fb63
BP
261AT_CHECK([ovs-ofctl -O OpenFlow11 queue-get-config br0 10 | STRIP_XIDS], [0],
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
270ADD_OF_PORTS([br0], [1], [2])
271AT_CHECK([ovs-ofctl -O OpenFlow12 queue-get-config br0 1], [0], [stdout])
272AT_CHECK([STRIP_XIDS stdout], [0], [dnl
273OFPT_QUEUE_GET_CONFIG_REPLY (OF1.2): port=1
f72dff1a 274queue 0:
e8f9a7bb 275])
56085be5
BP
276AT_CHECK([ovs-ofctl -O OpenFlow12 queue-get-config br0 ANY], [0], [stdout])
277AT_CHECK([STRIP_XIDS stdout], [0], [dnl
278OFPT_QUEUE_GET_CONFIG_REPLY (OF1.2): port=ANY
f72dff1a
BP
279queue 0:
280queue 0:
281queue 0:
56085be5 282])
e016fb63
BP
283AT_CHECK([ovs-ofctl -O OpenFlow12 queue-get-config br0 10 | STRIP_XIDS], [0],
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
292ADD_OF_PORTS([br0], [1], [2])
293
294AT_CHECK([ovs-ofctl -O OpenFlow14 queue-get-config br0 any | STRIP_XIDS], [0],
295 [OFPST_QUEUE_DESC reply (OF1.4): port=1
296queue 0:
297port=LOCAL
298queue 0:
299port=2
300queue 0:
301])
302
303AT_CHECK([ovs-ofctl -O OpenFlow14 queue-get-config br0 1 | STRIP_XIDS], [0],
304 [OFPST_QUEUE_DESC reply (OF1.4): port=1
305queue 0:
306])
307
308AT_CHECK([ovs-ofctl -O OpenFlow14 queue-get-config br0 10 | STRIP_XIDS], [0],
309 [OFPT_ERROR (OF1.4): OFPQOFC_BAD_PORT
310OFPST_QUEUE_DESC request (OF1.4): port=10
311])
312
313AT_CHECK([ovs-ofctl -O OpenFlow14 queue-get-config br0 1 2 | STRIP_XIDS], [0],
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])
19187a71 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])
357AT_CHECK([STRIP_XIDS stdout], [0], [dnl
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])
363AT_CHECK([STRIP_XIDS stdout], [0], [dnl
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])
369AT_CHECK([STRIP_XIDS stdout], [0], [dnl
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])
408AT_CHECK([STRIP_XIDS stdout], [0], [dnl
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])
414AT_CHECK([STRIP_XIDS stdout], [0], [dnl
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])
421AT_CHECK([STRIP_XIDS stdout], [0], [dnl
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])
428AT_CHECK([STRIP_XIDS stdout], [0], [dnl
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])
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])
493AT_CHECK([STRIP_XIDS stdout], [0], [dnl
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])
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])
511AT_CHECK([STRIP_XIDS stdout], [0], [dnl
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])
519AT_CHECK([STRIP_XIDS stdout], [0], [dnl
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])
526AT_CHECK([STRIP_XIDS stderr | sed '/truncated/,$d'], [0], [dnl
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])
535AT_CHECK([STRIP_XIDS stdout], [0], [dnl
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])
547AT_CHECK([STRIP_XIDS stdout], [0], [dnl
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])
555AT_CHECK([STRIP_XIDS stdout], [0], [dnl
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])
580AT_CHECK([STRIP_XIDS stdout], [0], [dnl
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])
586AT_CHECK([STRIP_XIDS stdout], [0], [dnl
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])
592AT_CHECK([STRIP_XIDS stdout], [0], [dnl
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])
598AT_CHECK([STRIP_XIDS stdout], [0], [dnl
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])
607AT_CHECK([STRIP_XIDS stdout], [0], [dnl
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])
615AT_CHECK([cat stderr | ofctl_strip], [0], [dnl
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
648/^000000.0/d' stderr | STRIP_XIDS], [0],
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])
661AT_CHECK([STRIP_XIDS stdout], [0], [dnl
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])
674AT_CHECK([STRIP_XIDS stdout], [0], [dnl
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])
686AT_CHECK([STRIP_XIDS stdout], [0], [dnl
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])
718AT_CHECK([STRIP_XIDS stdout | sort], [0], [dnl
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])
723AT_CHECK([STRIP_XIDS stdout | sort], [0], [dnl
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])
742AT_CHECK([STRIP_XIDS stdout | sed 's/duration=[[0-9.]]*s/duration=?s/' | sort], [0], [dnl
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])
747AT_CHECK([STRIP_XIDS stdout | sed 's/duration=[[0-9.]]*s/duration=?s/' | sort], [0], [dnl
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])
766AT_CHECK([STRIP_XIDS stdout | sed 's/duration=[[0-9.]]*s/duration=?s/' | sort], [0], [dnl
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])
771AT_CHECK([STRIP_XIDS stdout | sed 's/duration=[[0-9.]]*s/duration=?s/' | sort], [0], [dnl
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
786])
787AT_CHECK([ovs-ofctl -O OpenFlow13 -vwarn add-groups br0 groups.txt])
788AT_CHECK([ovs-vsctl del-br br0])
789OVS_VSWITCHD_STOP
790AT_CLEANUP
791
9dcd1c00 792AT_SETUP([ofproto - mod-port (OpenFlow 1.0)])
023e1e0a 793OVS_VSWITCHD_START
a2cb9dfd
BP
794for command_config_state in \
795 'up 0 0' \
0ab14c8e
BP
796 'noflood NO_FLOOD 0' \
797 'down PORT_DOWN,NO_FLOOD LINK_DOWN' \
28124950
BP
798 'flood PORT_DOWN LINK_DOWN' \
799 'no-receive PORT_DOWN,NO_RECV LINK_DOWN' \
800 'no-forward PORT_DOWN,NO_RECV,NO_FWD LINK_DOWN' \
801 'no-packet-in PORT_DOWN,NO_RECV,NO_FWD,NO_PACKET_IN LINK_DOWN' \
802 'forward PORT_DOWN,NO_RECV,NO_PACKET_IN LINK_DOWN' \
803 'packet-in PORT_DOWN,NO_RECV LINK_DOWN' \
804 'up NO_RECV 0' \
805 'receive 0 0'
a2cb9dfd
BP
806do
807 set $command_config_state
0ab14c8e 808 command=$[1] config=`echo $[2] | sed 's/,/ /g'` state=$[3]
ea523221
BP
809 AT_CHECK([ovs-ofctl -vwarn mod-port br0 br0 $command])
810 AT_CHECK([ovs-ofctl -vwarn show br0], [0], [stdout])
640c7c94 811 AT_CHECK_UNQUOTED([STRIP_XIDS stdout], [0], [dnl
9e1fd49b 812OFPT_FEATURES_REPLY: dpid:fedcba9876543210
c2f0373a 813n_tables:254, n_buffers:256
9e1fd49b 814capabilities: FLOW_STATS TABLE_STATS PORT_STATS QUEUE_STATS ARP_MATCH_IP
08d1e234 815actions: 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
816 LOCAL(br0): addr:aa:55:aa:55:00:00
817 config: $config
818 state: $state
d02a5f8e 819 speed: 0 Mbps now, 0 Mbps max
3b62feba 820OFPT_GET_CONFIG_REPLY: frags=normal miss_send_len=0
a2cb9dfd
BP
821])
822done
023e1e0a 823OVS_VSWITCHD_STOP
a2cb9dfd 824AT_CLEANUP
640c7c94 825
9dcd1c00
SH
826AT_SETUP([ofproto - mod-port (OpenFlow 1.2)])
827OVS_VSWITCHD_START
828for command_config_state in \
829 'up 0 0' \
830 'down PORT_DOWN LINK_DOWN' \
831 'no-receive PORT_DOWN,NO_RECV LINK_DOWN' \
832 'no-forward PORT_DOWN,NO_RECV,NO_FWD LINK_DOWN' \
833 'no-packet-in PORT_DOWN,NO_RECV,NO_FWD,NO_PACKET_IN LINK_DOWN' \
834 'forward PORT_DOWN,NO_RECV,NO_PACKET_IN LINK_DOWN' \
835 'packet-in PORT_DOWN,NO_RECV LINK_DOWN' \
836 'up NO_RECV 0' \
837 'receive 0 0'
838do
839 set $command_config_state
840 command=$[1] config=`echo $[2] | sed 's/,/ /g'` state=$[3]
841 AT_CHECK([ovs-ofctl -O OpenFlow12 -vwarn mod-port br0 br0 $command])
842 AT_CHECK([ovs-ofctl -O OpenFlow12 -vwarn show br0], [0], [stdout])
843 AT_CHECK_UNQUOTED([STRIP_XIDS stdout], [0], [dnl
844OFPT_FEATURES_REPLY (OF1.2): dpid:fedcba9876543210
845n_tables:254, n_buffers:256
4efe455d 846capabilities: FLOW_STATS TABLE_STATS PORT_STATS GROUP_STATS QUEUE_STATS
9dcd1c00
SH
847 LOCAL(br0): addr:aa:55:aa:55:00:00
848 config: $config
849 state: $state
850 speed: 0 Mbps now, 0 Mbps max
851OFPT_GET_CONFIG_REPLY (OF1.2): frags=normal miss_send_len=0
852])
853done
854OVS_VSWITCHD_STOP
855AT_CLEANUP
856
18cc69d9
BP
857AT_SETUP([ofproto - mod-port (OpenFlow 1.4)])
858OVS_VSWITCHD_START
859for command_config_state in \
860 'up 0 0' \
861 'down PORT_DOWN LINK_DOWN' \
862 'no-receive PORT_DOWN,NO_RECV LINK_DOWN' \
863 'no-forward PORT_DOWN,NO_RECV,NO_FWD LINK_DOWN' \
864 'no-packet-in PORT_DOWN,NO_RECV,NO_FWD,NO_PACKET_IN LINK_DOWN' \
865 'forward PORT_DOWN,NO_RECV,NO_PACKET_IN LINK_DOWN' \
866 'packet-in PORT_DOWN,NO_RECV LINK_DOWN' \
867 'up NO_RECV 0' \
868 'receive 0 0'
869do
870 set $command_config_state
871 command=$[1] config=`echo $[2] | sed 's/,/ /g'` state=$[3]
872 AT_CHECK([ovs-ofctl -O OpenFlow14 -vwarn mod-port br0 br0 $command])
873 AT_CHECK([ovs-ofctl -O OpenFlow14 -vwarn show br0], [0], [stdout])
874 AT_CHECK_UNQUOTED([STRIP_XIDS stdout], [0], [dnl
875OFPT_FEATURES_REPLY (OF1.4): dpid:fedcba9876543210
876n_tables:254, n_buffers:256
4efe455d 877capabilities: FLOW_STATS TABLE_STATS PORT_STATS GROUP_STATS QUEUE_STATS
18cc69d9
BP
878OFPST_PORT_DESC reply (OF1.4):
879 LOCAL(br0): addr:aa:55:aa:55:00:00
880 config: $config
881 state: $state
882 speed: 0 Mbps now, 0 Mbps max
883OFPT_GET_CONFIG_REPLY (OF1.4): frags=normal miss_send_len=0
884])
885done
886OVS_VSWITCHD_STOP
887AT_CLEANUP
888
c168dcc8 889AT_SETUP([ofproto - basic flow_mod commands (NXM)])
023e1e0a 890OVS_VSWITCHD_START
ef0ce8ae 891AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip], [0], [NXST_FLOW reply:
640c7c94 892])
c6100d92
BP
893AT_CHECK([echo 'in_port=2,actions=1' | ovs-ofctl add-flows br0 -])
894AT_CHECK([ovs-ofctl add-flow br0 in_port=1,actions=2])
895AT_CHECK([ovs-ofctl -F nxm add-flow br0 table=1,in_port=4,actions=3])
ef0ce8ae 896AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
c6100d92
BP
897 in_port=1 actions=output:2
898 in_port=2 actions=output:1
899 table=1, in_port=4 actions=output:3
0721c073 900NXST_FLOW reply:
640c7c94 901])
0697b5c3 902AT_CHECK([ovs-ofctl dump-aggregate br0 table=0 | STRIP_XIDS], [0], [dnl
c168dcc8
BP
903NXST_AGGREGATE reply: packet_count=0 byte_count=0 flow_count=2
904])
640c7c94 905AT_CHECK([ovs-ofctl del-flows br0])
ef0ce8ae 906AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip], [0], [NXST_FLOW reply:
640c7c94 907])
023e1e0a 908OVS_VSWITCHD_STOP
640c7c94 909AT_CLEANUP
c168dcc8
BP
910
911AT_SETUP([ofproto - basic flow_mod commands (OpenFlow 1.0)])
023e1e0a 912OVS_VSWITCHD_START
ef0ce8ae 913AT_CHECK([ovs-ofctl -F openflow10 dump-flows br0 | ofctl_strip], [0], [OFPST_FLOW reply:
c168dcc8 914])
c6100d92
BP
915AT_CHECK([echo 'in_port=2,actions=1' | ovs-ofctl -F openflow10 add-flows br0 -])
916AT_CHECK([ovs-ofctl -F openflow10 add-flow br0 in_port=1,actions=2])
917AT_CHECK([ovs-ofctl -F openflow10 add-flow br0 table=1,in_port=4,actions=3])
ef0ce8ae 918AT_CHECK([ovs-ofctl -F openflow10 dump-flows br0 | ofctl_strip | sort], [0], [dnl
c6100d92
BP
919 in_port=1 actions=output:2
920 in_port=2 actions=output:1
921 table=1, in_port=4 actions=output:3
c168dcc8
BP
922OFPST_FLOW reply:
923])
0697b5c3 924AT_CHECK([ovs-ofctl -F openflow10 dump-aggregate br0 table=0 | STRIP_XIDS], [0], [dnl
c168dcc8
BP
925OFPST_AGGREGATE reply: packet_count=0 byte_count=0 flow_count=2
926])
927AT_CHECK([ovs-ofctl -F openflow10 del-flows br0])
ef0ce8ae 928AT_CHECK([ovs-ofctl -F openflow10 dump-flows br0 | ofctl_strip], [0], [OFPST_FLOW reply:
c168dcc8 929])
023e1e0a 930OVS_VSWITCHD_STOP
c168dcc8 931AT_CLEANUP
e729e793 932
13327b8e
BP
933# It's really dumb that check_overlap and reset_counts are considered
934# part of flow state, but OpenFlow implies that it is, and OFTest and
935# some users insist on it.
936AT_SETUP([ofproto - add-flow and flags])
937OVS_VSWITCHD_START
938AT_CHECK([ovs-ofctl -F openflow10 add-flow br0 check_overlap,in_port=1,actions=drop])
939# Prior to OF1.3, flow dumps didn't include a "flags" field.
940AT_CHECK([ovs-ofctl -F openflow10 dump-flows br0 | ofctl_strip], [0], [dnl
941OFPST_FLOW reply:
942 in_port=1 actions=drop
943])
944AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip], [0], [dnl
945OFPST_FLOW reply (OF1.1):
946 in_port=1 actions=drop
947])
948AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip], [0], [dnl
949OFPST_FLOW reply (OF1.2):
950 in_port=1 actions=drop
951])
952# OF1.3 makes the flags visible.
953AT_CHECK([ovs-ofctl -O OpenFlow13 dump-flows br0 | ofctl_strip], [0], [dnl
954OFPST_FLOW reply (OF1.3):
955 check_overlap reset_counts in_port=1 actions=drop
956])
957AT_CHECK([ovs-ofctl -O OpenFlow14 dump-flows br0 | ofctl_strip], [0], [dnl
958OFPST_FLOW reply (OF1.4):
959 check_overlap reset_counts in_port=1 actions=drop
960])
961AT_CHECK([ovs-ofctl -O OpenFlow15 dump-flows br0 | ofctl_strip], [0], [dnl
962OFPST_FLOW reply (OF1.5):
963 check_overlap reset_counts in_port=1 actions=drop
964])
965OVS_VSWITCHD_STOP
966AT_CLEANUP
967
75fa58f8
BP
968AT_SETUP([ofproto - basic flow_mod commands (OpenFlow 1.1)])
969OVS_VSWITCHD_START
970AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip], [0], [OFPST_FLOW reply (OF1.1):
971])
972AT_CHECK([echo 'in_port=2,actions=1' | ovs-ofctl -O OpenFlow11 add-flows br0 -])
973AT_CHECK([ovs-ofctl -O OpenFlow11 add-flow br0 in_port=1,actions=2])
974AT_CHECK([ovs-ofctl -O OpenFlow11 add-flow br0 table=1,in_port=4,actions=3])
975AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0], [dnl
976 in_port=1 actions=output:2
977 in_port=2 actions=output:1
978 table=1, in_port=4 actions=output:3
979OFPST_FLOW reply (OF1.1):
980])
981AT_CHECK([ovs-ofctl -O OpenFlow11 dump-aggregate br0 table=0 | STRIP_XIDS], [0], [dnl
982OFPST_AGGREGATE reply (OF1.1): packet_count=0 byte_count=0 flow_count=2
983])
984AT_CHECK([ovs-ofctl -O OpenFlow11 del-flows br0])
985AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip], [0], [OFPST_FLOW reply (OF1.1):
0e197060 986 table=1, in_port=4 actions=output:3
75fa58f8
BP
987])
988OVS_VSWITCHD_STOP
989AT_CLEANUP
990
862d8eed
BP
991AT_SETUP([ofproto - flow_mod negative test (OpenFlow 1.1)])
992OVS_VSWITCHD_START(
993 [set bridge br0 protocols=OpenFlow10,OpenFlow11,OpenFlow12,OpenFlow13])
994AT_CHECK([ovs-ofctl add-flow -O OpenFlow11 br0 table=1,action=goto_table:2])
862d8eed 995
0e197060
BP
996# The error message here actually comes from ovs-ofctl, not from ovs-vswitchd,
997# but at least it's the same code in ofpacts_check() that issues the error.
998AT_CHECK([ovs-ofctl add-flow -O OpenFlow11 br0 table=1,action=goto_table:1],
999 [1], [],
8c87971e 1000 [ovs-ofctl: actions are invalid with specified match (OFPBIC_BAD_TABLE_ID)
862d8eed
BP
1001])
1002OVS_VSWITCHD_STOP
1003AT_CLEANUP
1004
f5c45121
SH
1005AT_SETUP([ofproto - set-field flow_mod commands (NXM)])
1006OVS_VSWITCHD_START
1007AT_CHECK([ovs-ofctl add-flow br0 ipv6,table=1,in_port=3,actions=drop])
1008AT_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 1009AT_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 1010AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
e60e935b 1011 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
1012 table=1, ipv6,in_port=3 actions=load:0xa6badbfffefe59fa->NXM_NX_IPV6_SRC[[0..63]],load:0xfe8001234567890a->NXM_NX_IPV6_SRC[[64..127]]
1013NXST_FLOW reply:
1014])
1015OVS_VSWITCHD_STOP
1016AT_CLEANUP
1017
9dcd1c00 1018AT_SETUP([ofproto - basic flow_mod commands (OpenFlow 1.2)])
e729e793 1019OVS_VSWITCHD_START
9dcd1c00 1020AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip], [0], [OFPST_FLOW reply (OF1.2):
e729e793 1021])
9dcd1c00
SH
1022AT_CHECK([echo 'in_port=2,actions=1' | ovs-ofctl -O OpenFlow12 add-flows br0 -])
1023AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 in_port=1,actions=2])
1024AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 table=1,in_port=4,actions=3])
1025AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1026 in_port=1 actions=output:2
1027 in_port=2 actions=output:1
1028 table=1, in_port=4 actions=output:3
1029OFPST_FLOW reply (OF1.2):
e729e793 1030])
9dcd1c00
SH
1031AT_CHECK([ovs-ofctl -O OpenFlow12 del-flows br0])
1032AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip], [0], [OFPST_FLOW reply (OF1.2):
e729e793
JP
1033])
1034OVS_VSWITCHD_STOP
1035AT_CLEANUP
1036
e60e935b
SRCSA
1037AT_SETUP([ofproto - set-field flow_mod commands (OF1.2)])
1038OVS_VSWITCHD_START
1039AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 ipv6,table=1,in_port=3,actions=drop])
1040AT_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])
1041AT_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])
1042AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1043 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
1044 table=1, ipv6,in_port=3 actions=set_field:fe80:123:4567:890a:a6ba:dbff:fefe:59fa->ipv6_src
1045OFPST_FLOW reply (OF1.2):
1046])
1047OVS_VSWITCHD_STOP
1048AT_CLEANUP
1049
9dcd1c00 1050AT_SETUP([ofproto - dump flows with cookie])
e729e793 1051OVS_VSWITCHD_START
c6100d92
BP
1052AT_CHECK([ovs-ofctl add-flow br0 cookie=0x1,in_port=1,actions=1])
1053AT_CHECK([ovs-ofctl add-flow br0 cookie=0x2,in_port=2,actions=1])
1054AT_CHECK([ovs-ofctl add-flow br0 cookie=0x3,in_port=3,actions=1])
ef0ce8ae 1055AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
c6100d92
BP
1056 cookie=0x1, in_port=1 actions=output:1
1057 cookie=0x2, in_port=2 actions=output:1
1058 cookie=0x3, in_port=3 actions=output:1
e729e793
JP
1059NXST_FLOW reply:
1060])
1061AT_CHECK([ovs-ofctl dump-aggregate br0 table=0 | STRIP_XIDS], [0], [dnl
1062NXST_AGGREGATE reply: packet_count=0 byte_count=0 flow_count=3
1063])
9dcd1c00 1064AT_CHECK([ovs-ofctl dump-flows br0 cookie=0x3/-1 | ofctl_strip | sort], [0], [dnl
c6100d92 1065 cookie=0x3, in_port=3 actions=output:1
e729e793
JP
1066NXST_FLOW reply:
1067])
9dcd1c00
SH
1068AT_CHECK([ovs-ofctl dump-aggregate br0 cookie=0x3/-1 | STRIP_XIDS], [0], [dnl
1069NXST_AGGREGATE reply: packet_count=0 byte_count=0 flow_count=1
e729e793
JP
1070])
1071OVS_VSWITCHD_STOP
1072AT_CLEANUP
1073
623e1caf
JP
1074AT_SETUP([ofproto - mod flow with cookie change (OpenFlow 1.0)])
1075OVS_VSWITCHD_START
c6100d92 1076AT_CHECK([ovs-ofctl -F openflow10 add-flow br0 cookie=0x1,in_port=1,actions=1])
623e1caf 1077AT_CHECK([ovs-ofctl -F openflow10 dump-flows br0 | ofctl_strip | sort], [0], [dnl
c6100d92 1078 cookie=0x1, in_port=1 actions=output:1
623e1caf
JP
1079OFPST_FLOW reply:
1080])
1081
c6100d92 1082AT_CHECK([ovs-ofctl -F openflow10 mod-flows br0 cookie=0x2,in_port=1,actions=1])
623e1caf 1083AT_CHECK([ovs-ofctl -F openflow10 dump-flows br0 | ofctl_strip | sort], [0], [dnl
c6100d92 1084 cookie=0x2, in_port=1 actions=output:1
623e1caf
JP
1085OFPST_FLOW reply:
1086])
1087OVS_VSWITCHD_STOP
1088AT_CLEANUP
1089
1090AT_SETUP([ofproto - mod flow with cookie change (NXM)])
1091OVS_VSWITCHD_START
c6100d92 1092AT_CHECK([ovs-ofctl -F nxm add-flow br0 cookie=0x1,in_port=1,actions=1])
623e1caf 1093AT_CHECK([ovs-ofctl -F nxm dump-flows br0 | ofctl_strip | sort], [0], [dnl
c6100d92 1094 cookie=0x1, in_port=1 actions=output:1
623e1caf
JP
1095NXST_FLOW reply:
1096])
1097
c6100d92 1098AT_CHECK([ovs-ofctl -F nxm mod-flows br0 cookie=0x2,in_port=1,actions=1])
623e1caf 1099AT_CHECK([ovs-ofctl -F nxm dump-flows br0 | ofctl_strip | sort], [0], [dnl
c6100d92 1100 cookie=0x2, in_port=1 actions=output:1
623e1caf
JP
1101NXST_FLOW reply:
1102])
1103OVS_VSWITCHD_STOP
1104AT_CLEANUP
1105
75fa58f8
BP
1106AT_SETUP([ofproto - no mod flow with cookie change (OpenFlow 1.1)])
1107OVS_VSWITCHD_START
1108AT_CHECK([ovs-ofctl -O OpenFlow11 add-flow br0 cookie=0x1,in_port=1,actions=1])
1109AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1110 cookie=0x1, in_port=1 actions=output:1
1111OFPST_FLOW reply (OF1.1):
1112])
1113AT_CHECK([ovs-ofctl -O OpenFlow11 mod-flows br0 cookie=0x2,in_port=1,actions=1])
1114AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1115 cookie=0x1, in_port=1 actions=output:1
1116OFPST_FLOW reply (OF1.1):
1117])
1118OVS_VSWITCHD_STOP
1119AT_CLEANUP
1120
9dcd1c00 1121dnl The OpenFlow 1.2 spec states that the cookie may not be modified
2df3b874 1122AT_SETUP([ofproto - no mod flow with cookie change (OpenFlow 1.2)])
9dcd1c00
SH
1123OVS_VSWITCHD_START
1124AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 cookie=0x1,in_port=1,actions=1])
1125AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1126 cookie=0x1, in_port=1 actions=output:1
1127OFPST_FLOW reply (OF1.2):
1128])
1129
1130AT_CHECK([ovs-ofctl -O OpenFlow12 mod-flows br0 cookie=0x2,in_port=1,actions=1])
1131AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1132 cookie=0x1, in_port=1 actions=output:1
1133OFPST_FLOW reply (OF1.2):
1134])
1135OVS_VSWITCHD_STOP
1136AT_CLEANUP
1137
1138AT_SETUP([ofproto - mod flows based on cookie mask (OpenFlow 1.0)])
623e1caf 1139OVS_VSWITCHD_START
c6100d92
BP
1140AT_CHECK([ovs-ofctl add-flow br0 cookie=0x1,in_port=1,actions=1])
1141AT_CHECK([ovs-ofctl add-flow br0 cookie=0x1,in_port=2,actions=1])
1142AT_CHECK([ovs-ofctl add-flow br0 cookie=0x2,in_port=3,actions=1])
623e1caf 1143AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
c6100d92
BP
1144 cookie=0x1, in_port=1 actions=output:1
1145 cookie=0x1, in_port=2 actions=output:1
1146 cookie=0x2, in_port=3 actions=output:1
623e1caf
JP
1147NXST_FLOW reply:
1148])
1149
1150AT_CHECK([ovs-ofctl -F nxm mod-flows br0 cookie=0x1/0xff,actions=4])
1151AT_CHECK([ovs-ofctl -F nxm dump-flows br0 | ofctl_strip | sort], [0], [dnl
1152 cookie=0x1, in_port=1 actions=output:4
1153 cookie=0x1, in_port=2 actions=output:4
c6100d92 1154 cookie=0x2, in_port=3 actions=output:1
623e1caf
JP
1155NXST_FLOW reply:
1156])
1157OVS_VSWITCHD_STOP
1158AT_CLEANUP
1159
75fa58f8
BP
1160AT_SETUP([ofproto - mod flows based on cookie mask (OpenFlow 1.1)])
1161OVS_VSWITCHD_START
1162AT_CHECK([ovs-ofctl -O OpenFlow11 add-flow br0 cookie=0x1,in_port=1,actions=1])
1163AT_CHECK([ovs-ofctl -O OpenFlow11 add-flow br0 cookie=0x1,in_port=2,actions=1])
1164AT_CHECK([ovs-ofctl -O OpenFlow11 add-flow br0 cookie=0x2,in_port=3,actions=1])
1165AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1166 cookie=0x1, in_port=1 actions=output:1
1167 cookie=0x1, in_port=2 actions=output:1
1168 cookie=0x2, in_port=3 actions=output:1
1169OFPST_FLOW reply (OF1.1):
1170])
1171
1172AT_CHECK([ovs-ofctl -O OpenFlow11 mod-flows br0 cookie=0x1/0xff,actions=4])
1173AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1174 cookie=0x1, in_port=1 actions=output:4
1175 cookie=0x1, in_port=2 actions=output:4
1176 cookie=0x2, in_port=3 actions=output:1
1177OFPST_FLOW reply (OF1.1):
1178])
1179OVS_VSWITCHD_STOP
1180AT_CLEANUP
1181
9dcd1c00
SH
1182AT_SETUP([ofproto - mod flows based on cookie mask (OpenFlow 1.2)])
1183OVS_VSWITCHD_START
1184AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 cookie=0x1,in_port=1,actions=1])
1185AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 cookie=0x1,in_port=2,actions=1])
1186AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 cookie=0x2,in_port=3,actions=1])
1187AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1188 cookie=0x1, in_port=1 actions=output:1
1189 cookie=0x1, in_port=2 actions=output:1
1190 cookie=0x2, in_port=3 actions=output:1
1191OFPST_FLOW reply (OF1.2):
1192])
1193
1194AT_CHECK([ovs-ofctl -O OpenFlow12 mod-flows br0 cookie=0x1/0xff,actions=4])
1195AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1196 cookie=0x1, in_port=1 actions=output:4
1197 cookie=0x1, in_port=2 actions=output:4
1198 cookie=0x2, in_port=3 actions=output:1
1199OFPST_FLOW reply (OF1.2):
1200])
1201OVS_VSWITCHD_STOP
1202AT_CLEANUP
1203
1204dnl The OpenFlow 1.2 spec states that the cookie may not be modified
623e1caf
JP
1205AT_SETUP([ofproto - mod flows based on cookie mask with cookie change])
1206OVS_VSWITCHD_START
c6100d92
BP
1207AT_CHECK([ovs-ofctl add-flow br0 cookie=0x1,in_port=1,actions=1])
1208AT_CHECK([ovs-ofctl add-flow br0 cookie=0x1,in_port=2,actions=1])
1209AT_CHECK([ovs-ofctl add-flow br0 cookie=0x2,in_port=3,actions=1])
623e1caf 1210AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
c6100d92
BP
1211 cookie=0x1, in_port=1 actions=output:1
1212 cookie=0x1, in_port=2 actions=output:1
1213 cookie=0x2, in_port=3 actions=output:1
623e1caf
JP
1214NXST_FLOW reply:
1215])
1216
1217AT_CHECK([ovs-ofctl -F nxm mod-flows br0 cookie=1/-1,cookie=4,actions=4])
1218AT_CHECK([ovs-ofctl -F nxm dump-flows br0 | ofctl_strip | sort], [0], [dnl
c6100d92 1219 cookie=0x2, in_port=3 actions=output:1
623e1caf
JP
1220 cookie=0x4, in_port=1 actions=output:4
1221 cookie=0x4, in_port=2 actions=output:4
1222NXST_FLOW reply:
1223])
1224OVS_VSWITCHD_STOP
1225AT_CLEANUP
1226
490020fe 1227AT_SETUP([ofproto - mod flow with cookie miss (mask==0) - NXM])
623e1caf 1228OVS_VSWITCHD_START
c6100d92 1229AT_CHECK([ovs-ofctl -F nxm mod-flows br0 in_port=1,actions=1])
623e1caf 1230AT_CHECK([ovs-ofctl -F nxm dump-flows br0 | ofctl_strip | sort], [0], [dnl
c6100d92 1231 in_port=1 actions=output:1
623e1caf
JP
1232NXST_FLOW reply:
1233])
1234OVS_VSWITCHD_STOP
1235AT_CLEANUP
1236
75fa58f8
BP
1237AT_SETUP([ofproto - mod flow with cookie miss (mask==0) - OF1.1])
1238OVS_VSWITCHD_START
1239AT_CHECK([ovs-ofctl -O openflow11 mod-flows br0 in_port=1,actions=1])
1240AT_CHECK([ovs-ofctl -O openflow11 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1241 in_port=1 actions=output:1
1242OFPST_FLOW reply (OF1.1):
1243])
1244OVS_VSWITCHD_STOP
1245AT_CLEANUP
1246
490020fe
BP
1247AT_SETUP([ofproto - mod flow with cookie miss (mask==0) - OF1.2])
1248OVS_VSWITCHD_START
1249AT_CHECK([ovs-ofctl -O openflow12 mod-flows br0 in_port=1,actions=1])
1250AT_CHECK([ovs-ofctl -O openflow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1251OFPST_FLOW reply (OF1.2):
1252])
1253OVS_VSWITCHD_STOP
1254AT_CLEANUP
1255
1256AT_SETUP([ofproto - mod flow with cookie miss (mask!=0) - NXM])
623e1caf 1257OVS_VSWITCHD_START
c6100d92 1258AT_CHECK([ovs-ofctl -F nxm mod-flows br0 cookie=1/1,in_port=1,actions=1])
623e1caf
JP
1259AT_CHECK([ovs-ofctl -F nxm dump-flows br0 | ofctl_strip | sort], [0], [dnl
1260NXST_FLOW reply:
1261])
1262OVS_VSWITCHD_STOP
1263AT_CLEANUP
1264
75fa58f8
BP
1265AT_SETUP([ofproto - mod flow with cookie miss (mask!=0) - OF1.1])
1266OVS_VSWITCHD_START
1267AT_CHECK([ovs-ofctl -O openflow11 mod-flows br0 cookie=1/1,in_port=1,actions=1])
1268AT_CHECK([ovs-ofctl -O openflow11 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1269OFPST_FLOW reply (OF1.1):
1270])
1271OVS_VSWITCHD_STOP
1272AT_CLEANUP
1273
490020fe
BP
1274AT_SETUP([ofproto - mod flow with cookie miss (mask!=0) - OF1.2])
1275OVS_VSWITCHD_START
1276AT_CHECK([ovs-ofctl -O openflow12 mod-flows br0 cookie=1/1,in_port=1,actions=1])
1277AT_CHECK([ovs-ofctl -O openflow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1278OFPST_FLOW reply (OF1.2):
1279])
1280OVS_VSWITCHD_STOP
1281AT_CLEANUP
1282
623e1caf
JP
1283AT_SETUP([ofproto - del flows with cookies])
1284OVS_VSWITCHD_START
c6100d92
BP
1285AT_CHECK([ovs-ofctl add-flow br0 cookie=0x1,in_port=1,actions=1])
1286AT_CHECK([ovs-ofctl add-flow br0 cookie=0x2,in_port=2,actions=1])
1287AT_CHECK([ovs-ofctl add-flow br0 cookie=0x3,in_port=3,actions=1])
623e1caf 1288AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
c6100d92
BP
1289 cookie=0x1, in_port=1 actions=output:1
1290 cookie=0x2, in_port=2 actions=output:1
1291 cookie=0x3, in_port=3 actions=output:1
623e1caf
JP
1292NXST_FLOW reply:
1293])
1294
1295AT_CHECK([ovs-ofctl del-flows br0])
1296AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1297NXST_FLOW reply:
1298])
1299OVS_VSWITCHD_STOP
1300AT_CLEANUP
1301
1302AT_SETUP([ofproto - del flows based on cookie])
e729e793 1303OVS_VSWITCHD_START
c6100d92
BP
1304AT_CHECK([ovs-ofctl add-flow br0 cookie=0x1,in_port=1,actions=1])
1305AT_CHECK([ovs-ofctl add-flow br0 cookie=0x2,in_port=2,actions=1])
1306AT_CHECK([ovs-ofctl add-flow br0 cookie=0x3,in_port=3,actions=1])
ef0ce8ae 1307AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
c6100d92
BP
1308 cookie=0x1, in_port=1 actions=output:1
1309 cookie=0x2, in_port=2 actions=output:1
1310 cookie=0x3, in_port=3 actions=output:1
e729e793
JP
1311NXST_FLOW reply:
1312])
80d5aefd 1313
623e1caf 1314AT_CHECK([ovs-ofctl del-flows br0 cookie=0x3/-1])
ef0ce8ae 1315AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
c6100d92
BP
1316 cookie=0x1, in_port=1 actions=output:1
1317 cookie=0x2, in_port=2 actions=output:1
e729e793
JP
1318NXST_FLOW reply:
1319])
1320OVS_VSWITCHD_STOP
1321AT_CLEANUP
1322
623e1caf 1323AT_SETUP([ofproto - del flows based on cookie mask])
e729e793 1324OVS_VSWITCHD_START
c6100d92
BP
1325AT_CHECK([ovs-ofctl add-flow br0 cookie=0x1,in_port=1,actions=1])
1326AT_CHECK([ovs-ofctl add-flow br0 cookie=0x2,in_port=2,actions=1])
1327AT_CHECK([ovs-ofctl add-flow br0 cookie=0x3,in_port=3,actions=1])
ef0ce8ae 1328AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
c6100d92
BP
1329 cookie=0x1, in_port=1 actions=output:1
1330 cookie=0x2, in_port=2 actions=output:1
1331 cookie=0x3, in_port=3 actions=output:1
e729e793
JP
1332NXST_FLOW reply:
1333])
1334AT_CHECK([ovs-ofctl del-flows br0 cookie=0x3/0x1])
ef0ce8ae 1335AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
c6100d92 1336 cookie=0x2, in_port=2 actions=output:1
e729e793
JP
1337NXST_FLOW reply:
1338])
1339OVS_VSWITCHD_STOP
1340AT_CLEANUP
254750ce 1341
9dcd1c00 1342AT_SETUP([ofproto - del flows based on table id (NXM)])
c90cfeaf
SH
1343OVS_VSWITCHD_START
1344AT_CHECK([ovs-ofctl add-flow br0 cookie=0x1,in_port=1,actions=1])
1345AT_CHECK([ovs-ofctl add-flow br0 cookie=0x2,in_port=2,table=1,actions=1])
1346AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1347 cookie=0x1, in_port=1 actions=output:1
1348 cookie=0x2, table=1, in_port=2 actions=output:1
1349NXST_FLOW reply:
1350])
1351AT_CHECK([ovs-ofctl del-flows br0 table=0])
1352AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1353 cookie=0x2, table=1, in_port=2 actions=output:1
1354NXST_FLOW reply:
1355])
1356AT_CHECK([ovs-ofctl del-flows br0 table=1])
1357AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1358NXST_FLOW reply:
1359])
1360AT_CHECK([ovs-ofctl add-flow br0 cookie=0x1,in_port=1,actions=1])
1361AT_CHECK([ovs-ofctl add-flow br0 cookie=0x2,in_port=2,table=1,actions=1])
1362AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1363 cookie=0x1, in_port=1 actions=output:1
1364 cookie=0x2, table=1, in_port=2 actions=output:1
1365NXST_FLOW reply:
1366])
1367AT_CHECK([ovs-ofctl del-flows br0])
1368AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1369NXST_FLOW reply:
1370])
1371OVS_VSWITCHD_STOP
1372AT_CLEANUP
1373
75fa58f8
BP
1374AT_SETUP([ofproto - del flows based on table id (OpenFlow 1.1)])
1375OVS_VSWITCHD_START
1376AT_CHECK([ovs-ofctl -O OpenFlow11 add-flow br0 cookie=0x1,in_port=1,actions=1])
1377AT_CHECK([ovs-ofctl -O OpenFlow11 add-flow br0 cookie=0x2,in_port=2,table=1,actions=1])
1378AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1379 cookie=0x1, in_port=1 actions=output:1
1380 cookie=0x2, table=1, in_port=2 actions=output:1
1381OFPST_FLOW reply (OF1.1):
1382])
1383AT_CHECK([ovs-ofctl -O OpenFlow11 del-flows br0 table=0])
1384AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1385 cookie=0x2, table=1, in_port=2 actions=output:1
1386OFPST_FLOW reply (OF1.1):
1387])
1388AT_CHECK([ovs-ofctl -O OpenFlow11 del-flows br0 table=1])
1389AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1390OFPST_FLOW reply (OF1.1):
1391])
1392AT_CHECK([ovs-ofctl -O OpenFlow11 add-flow br0 cookie=0x1,in_port=1,actions=1])
1393AT_CHECK([ovs-ofctl -O OpenFlow11 add-flow br0 cookie=0x2,in_port=2,table=1,actions=1])
1394AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1395 cookie=0x1, in_port=1 actions=output:1
1396 cookie=0x2, table=1, in_port=2 actions=output:1
1397OFPST_FLOW reply (OF1.1):
1398])
1399AT_CHECK([ovs-ofctl -O OpenFlow11 del-flows br0])
0e197060 1400AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip], [0], [dnl
75fa58f8 1401OFPST_FLOW reply (OF1.1):
0e197060 1402 cookie=0x2, table=1, in_port=2 actions=output:1
75fa58f8
BP
1403])
1404OVS_VSWITCHD_STOP
1405AT_CLEANUP
1406
9dcd1c00
SH
1407AT_SETUP([ofproto - del flows based on table id (OpenFlow 1.2)])
1408OVS_VSWITCHD_START
1409AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 cookie=0x1,in_port=1,actions=1])
1410AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 cookie=0x2,in_port=2,table=1,actions=1])
1411AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1412 cookie=0x1, in_port=1 actions=output:1
1413 cookie=0x2, table=1, in_port=2 actions=output:1
1414OFPST_FLOW reply (OF1.2):
1415])
1416AT_CHECK([ovs-ofctl -O OpenFlow12 del-flows br0 table=0])
1417AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1418 cookie=0x2, table=1, in_port=2 actions=output:1
1419OFPST_FLOW reply (OF1.2):
1420])
1421AT_CHECK([ovs-ofctl -O OpenFlow12 del-flows br0 table=1])
1422AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1423OFPST_FLOW reply (OF1.2):
1424])
1425AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 cookie=0x1,in_port=1,actions=1])
1426AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 cookie=0x2,in_port=2,table=1,actions=1])
1427AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1428 cookie=0x1, in_port=1 actions=output:1
1429 cookie=0x2, table=1, in_port=2 actions=output:1
1430OFPST_FLOW reply (OF1.2):
1431])
1432AT_CHECK([ovs-ofctl -O OpenFlow12 del-flows br0])
1433AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1434OFPST_FLOW reply (OF1.2):
1435])
1436OVS_VSWITCHD_STOP
1437AT_CLEANUP
1438
71300040
BP
1439AT_SETUP([ofproto - flow_mod with out_port matching (OpenFlow 1.0)])
1440OVS_VSWITCHD_START
1441AT_DATA([flows.txt], [dnl
1442 in_port=1 actions=output:2
1443 in_port=2 actions=output:1,output:2,output:3
1444 in_port=3 actions=output:3,output:1,output:2
1445 in_port=4 actions=drop
1446 in_port=5 actions=output:3
1447 in_port=6 actions=output:1
1448])
1449AT_CHECK([ovs-ofctl -F openflow10 add-flows br0 flows.txt])
1450(cat flows.txt; echo 'OFPST_FLOW reply:') > expout
1451AT_CHECK([ovs-ofctl -F openflow10 dump-flows br0 | ofctl_strip | sort], [0],
1452 [expout])
1453
1454(grep 'output:2' flows.txt; echo 'OFPST_FLOW reply:') > expout
1455AT_CHECK([ovs-ofctl -F openflow10 dump-flows br0 out_port=2 | ofctl_strip | sort], [0], [expout])
1456
1457AT_CHECK([ovs-ofctl -F openflow10 del-flows br0 out_port=2])
1458(grep -v 'output:2' flows.txt; echo 'OFPST_FLOW reply:') > expout
1459AT_CHECK([ovs-ofctl -F openflow10 dump-flows br0 | ofctl_strip | sort], [0],
1460 [expout])
1461
1462AT_CHECK([ovs-ofctl -F openflow10 del-flows br0 out_port=3])
1463(grep -v 'output:[[23]]' flows.txt; echo 'OFPST_FLOW reply:') > expout
1464AT_CHECK([ovs-ofctl -F openflow10 dump-flows br0 | ofctl_strip | sort], [0],
1465 [expout])
1466
1467AT_CHECK([ovs-ofctl -F openflow10 del-flows br0 out_port=1])
1468(grep -v 'output:[[123]]' flows.txt; echo 'OFPST_FLOW reply:') > expout
1469AT_CHECK([ovs-ofctl -F openflow10 dump-flows br0 | ofctl_strip | sort], [0],
1470 [expout])
1471
1472OVS_VSWITCHD_STOP
1473AT_CLEANUP
1474
1475AT_SETUP([ofproto - flow_mod with out_port matching (OpenFlow 1.1)])
1476OVS_VSWITCHD_START
1477AT_DATA([flows.txt], [dnl
1478 in_port=1 actions=output:2
1479 in_port=2 actions=output:1,write_actions(output:2,output:3)
1480 in_port=3 actions=output:3,output:1,write_actions(output:2)
1481 in_port=4 actions=drop
1482 in_port=5 actions=write_actions(output:3)
1483 in_port=6 actions=output:1
1484])
1485AT_CHECK([ovs-ofctl -O OpenFlow11 add-flows br0 flows.txt])
1486(cat flows.txt; echo 'OFPST_FLOW reply (OF1.1):') > expout
1487AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0],
1488 [expout])
1489
1490(grep 'output:2' flows.txt; echo 'OFPST_FLOW reply (OF1.1):') > expout
1491AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 out_port=2 | ofctl_strip | sort], [0], [expout])
1492
1493AT_CHECK([ovs-ofctl -O OpenFlow11 del-flows br0 out_port=2])
1494(grep -v 'output:2' flows.txt; echo 'OFPST_FLOW reply (OF1.1):') > expout
1495AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0],
1496 [expout])
1497
1498AT_CHECK([ovs-ofctl -O OpenFlow11 del-flows br0 out_port=3])
1499(grep -v 'output:[[23]]' flows.txt; echo 'OFPST_FLOW reply (OF1.1):') > expout
1500AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0],
1501 [expout])
1502
1503AT_CHECK([ovs-ofctl -O OpenFlow11 del-flows br0 out_port=1])
1504(grep -v 'output:[[123]]' flows.txt; echo 'OFPST_FLOW reply (OF1.1):') > expout
1505AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0],
1506 [expout])
1507
1508OVS_VSWITCHD_STOP
1509AT_CLEANUP
1510
1511AT_SETUP([ofproto - flow_mod with out_group matching (OpenFlow 1.1)])
1512OVS_VSWITCHD_START
1513AT_DATA([groups.txt], [dnl
1514group_id=1,type=all,bucket=output:10
1515group_id=2,type=all,bucket=output:10
1516group_id=3,type=all,bucket=output:10
1517])
1518AT_CHECK([ovs-ofctl -O OpenFlow11 add-groups br0 groups.txt])
1519AT_DATA([flows.txt], [dnl
1520 in_port=1 actions=group:2,output:5
1521 in_port=2 actions=group:1,write_actions(group:2,group:3,output:6)
1522 in_port=3 actions=group:3,group:1,write_actions(group:2,output:3)
1523 in_port=4 actions=output:4
1524 in_port=5 actions=write_actions(output:4,group:3)
1525 in_port=6 actions=group:1
1526])
1527AT_CHECK([ovs-ofctl -O OpenFlow11 add-flows br0 flows.txt])
1528(cat flows.txt; echo 'OFPST_FLOW reply (OF1.1):') > expout
1529AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0],
1530 [expout])
1531
1532(grep 'output:3' flows.txt | grep 'group:2'; echo 'OFPST_FLOW reply (OF1.1):') > expout
1533AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 out_port=3,out_group=2 | ofctl_strip | sort], [0], [expout])
1534
1535AT_CHECK([ovs-ofctl -O OpenFlow11 del-flows br0 out_group=2])
1536(grep -v 'group:2' flows.txt; echo 'OFPST_FLOW reply (OF1.1):') > expout
1537AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0],
1538 [expout])
1539
1540AT_CHECK([ovs-ofctl -O OpenFlow11 del-flows br0 out_group=3])
1541(grep -v 'group:[[23]]' flows.txt; echo 'OFPST_FLOW reply (OF1.1):') > expout
1542AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0],
1543 [expout])
1544
1545AT_CHECK([ovs-ofctl -O OpenFlow11 del-flows br0 out_group=1])
1546(grep -v 'group:[[123]]' flows.txt; echo 'OFPST_FLOW reply (OF1.1):') > expout
1547AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0],
1548 [expout])
1549
1550OVS_VSWITCHD_STOP
1551AT_CLEANUP
1552
9dcd1c00 1553AT_SETUP([ofproto - flow table configuration (OpenFlow 1.0)])
254750ce
BP
1554OVS_VSWITCHD_START
1555# Check the default configuration.
8811fc0a
BP
1556head_table() {
1557 printf 'OFPST_TABLE reply (xid=0x2):
1558 table 0 ("%s"):
3c1bb396
BP
1559 active=0, lookup=0, matched=0
1560 max_entries=1000000
1561 matching:
1562 in_port: exact match or wildcard
1563 eth_src: exact match or wildcard
1564 eth_dst: exact match or wildcard
1565 eth_type: exact match or wildcard
1566 vlan_vid: exact match or wildcard
1567 vlan_pcp: exact match or wildcard
1568 ip_src: exact match or wildcard
1569 ip_dst: exact match or wildcard
1570 nw_proto: exact match or wildcard
1571 nw_tos: exact match or wildcard
1572 tcp_src: exact match or wildcard
1573 tcp_dst: exact match or wildcard
8811fc0a
BP
1574
1575' $1
1576}
1577ditto() {
1578 for i in `seq $1 $2`; do
1579 printf ' table %d ("table%d"): ditto\n' $i $i
1580 done
1581}
1582(head_table classifier; ditto 1 253) > expout
254750ce
BP
1583AT_CHECK([ovs-ofctl dump-tables br0], [0], [expout])
1584# Change the configuration.
1585AT_CHECK(
1586 [ovs-vsctl \
1587 -- --id=@t0 create Flow_Table name=main \
1588 -- --id=@t1 create Flow_Table flow-limit=1024 \
1589 -- set bridge br0 'flow_tables={1=@t1,0=@t0}' \
5c6d0628 1590 | ${PERL} $srcdir/uuidfilt.pl],
254750ce
BP
1591 [0], [<0>
1592<1>
1593])
1594# Check that the configuration was updated.
8811fc0a
BP
1595(head_table main; echo ' table 1 ("table1"):
1596 active=0, lookup=0, matched=0
1597 max_entries=1024
1598 (same matching)
1599
1600 table 2 ("table2"):
1601 active=0, lookup=0, matched=0
1602 max_entries=1000000
1603 (same matching)
1604'; ditto 3 253) > expout
254750ce
BP
1605AT_CHECK([ovs-ofctl dump-tables br0], [0], [expout])
1606OVS_VSWITCHD_STOP
1607AT_CLEANUP
1608
3fbbcba7
BP
1609dnl In-band and fail-open add "hidden rules" to table 0. These rules shouldn't
1610dnl be visible to OpenFlow. This test checks that "dump-flows" and
1611dnl "dump-tables" don't make them visible.
1612AT_SETUP([ofproto - hidden rules not in table stats])
1613# Use an IP address for a controller that won't actually exist: we
1614# want to create in-band rules but we do not want to actually connect
1615# to a controller (because that could mess about with our test). The
1616# Class E range 240.0.0.0 - 255.255.255.255 seems like a good choice.
1617OVS_VSWITCHD_START([set-controller br0 tcp:240.0.0.1:6653])
1618for i in 1 2 3 4 5; do ovs-appctl time/warp 1000; done
1619
1620# Check that no hidden flows are visible in OpenFlow.
1621AT_CHECK([ovs-ofctl dump-flows br0], [0], [NXST_FLOW reply (xid=0x4):
1622])
1623
1624# Check that some hidden flows related to 240.0.0.1 are actually in table 0.
1625#
1626# We discard flows that mention table_id because we only want table 0 flows,
1627# which in OVS is implied by the absence of a table_id.
1628AT_CHECK([ovs-appctl bridge/dump-flows br0], [0], [stdout])
1629AT_CHECK([test `grep '240\.0\.0\.1' stdout | grep -v table_id= | wc -l` -gt 0])
1630
1631# Check that dump-tables doesn't count the hidden flows.
8811fc0a
BP
1632head_table() {
1633 printf 'OFPST_TABLE reply (xid=0x2):
1634 table 0 ("%s"):
3fbbcba7
BP
1635 active=0, lookup=0, matched=0
1636 max_entries=1000000
1637 matching:
1638 in_port: exact match or wildcard
1639 eth_src: exact match or wildcard
1640 eth_dst: exact match or wildcard
1641 eth_type: exact match or wildcard
1642 vlan_vid: exact match or wildcard
1643 vlan_pcp: exact match or wildcard
1644 ip_src: exact match or wildcard
1645 ip_dst: exact match or wildcard
1646 nw_proto: exact match or wildcard
1647 nw_tos: exact match or wildcard
1648 tcp_src: exact match or wildcard
1649 tcp_dst: exact match or wildcard
8811fc0a
BP
1650
1651' $1
1652}
1653ditto() {
1654 for i in `seq $1 $2`; do
1655 printf ' table %d ("table%d"): ditto\n' $i $i
1656 done
1657}
1658(head_table classifier; ditto 1 253) > expout
3fbbcba7 1659AT_CHECK([ovs-ofctl dump-tables br0], [0], [expout])
74f5c9db 1660OVS_VSWITCHD_STOP(["/240\.0\.0\.1/d"])
3fbbcba7
BP
1661AT_CLEANUP
1662
9dcd1c00
SH
1663AT_SETUP([ofproto - flow table configuration (OpenFlow 1.2)])
1664OVS_VSWITCHD_START
1665# Check the default configuration.
8811fc0a
BP
1666head_table() {
1667 printf 'OFPST_TABLE reply (OF1.2) (xid=0x2):
1668 table 0 ("%s"):
3c1bb396
BP
1669 active=0, lookup=0, matched=0
1670 metadata: match=0xffffffffffffffff write=0xffffffffffffffff
1671 config=controller
1672 max_entries=1000000
1673 instructions (table miss and others):
8811fc0a 1674 instructions: apply_actions,clear_actions,write_actions,write_metadata,goto_table
3c1bb396
BP
1675 Write-Actions and Apply-Actions features:
1676 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 1677 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
1678 matching:
1679 metadata: exact match or wildcard
1680 in_port_oxm: exact match or wildcard
1681 eth_src: exact match or wildcard
1682 eth_dst: exact match or wildcard
1683 eth_type: exact match or wildcard
1684 vlan_vid: exact match or wildcard
1685 vlan_pcp: exact match or wildcard
1686 mpls_label: exact match or wildcard
1687 mpls_tc: exact match or wildcard
1688 ip_src: exact match or wildcard
1689 ip_dst: exact match or wildcard
1690 ipv6_src: exact match or wildcard
1691 ipv6_dst: exact match or wildcard
1692 ipv6_label: exact match or wildcard
1693 nw_proto: exact match or wildcard
1694 ip_dscp: exact match or wildcard
1695 nw_ecn: exact match or wildcard
1696 arp_op: exact match or wildcard
1697 arp_spa: exact match or wildcard
1698 arp_tpa: exact match or wildcard
1699 arp_sha: exact match or wildcard
1700 arp_tha: exact match or wildcard
1701 tcp_src: exact match or wildcard
1702 tcp_dst: exact match or wildcard
1703 udp_src: exact match or wildcard
1704 udp_dst: exact match or wildcard
1705 sctp_src: exact match or wildcard
1706 sctp_dst: exact match or wildcard
1707 icmp_type: exact match or wildcard
1708 icmp_code: exact match or wildcard
1709 icmpv6_type: exact match or wildcard
1710 icmpv6_code: exact match or wildcard
1711 nd_target: exact match or wildcard
1712 nd_sll: exact match or wildcard
8811fc0a
BP
1713 nd_tll: exact match or wildcard
1714
1715' $1
1716}
1717ditto() {
1718 for i in `seq $1 $2`; do
1719 printf ' table %d ("table%d"): ditto\n' $i $i
1720 done
1721}
1722tail_table() {
1723 printf ' table 253 ("table253"):
1724 active=0, lookup=0, matched=0
1725 metadata: match=0xffffffffffffffff write=0xffffffffffffffff
1726 config=controller
1727 max_entries=1000000
1728 instructions (table miss and others):
1729 instructions: apply_actions,clear_actions,write_actions,write_metadata
1730 (same actions)
1731 (same matching)
1732'
1733}
1734(head_table classifier; ditto 1 252; tail_table) > expout
9dcd1c00
SH
1735AT_CHECK([ovs-ofctl -O OpenFlow12 dump-tables br0], [0], [expout])
1736# Change the configuration.
1737AT_CHECK(
1738 [ovs-vsctl \
1739 -- --id=@t0 create Flow_Table name=main \
1740 -- --id=@t1 create Flow_Table flow-limit=1024 \
1741 -- set bridge br0 'flow_tables={1=@t1,0=@t0}' \
5c6d0628 1742 | ${PERL} $srcdir/uuidfilt.pl],
9dcd1c00
SH
1743 [0], [<0>
1744<1>
1745])
1746# Check that the configuration was updated.
8811fc0a
BP
1747(head_table main; echo ' table 1 ("table1"):
1748 active=0, lookup=0, matched=0
1749 metadata: match=0xffffffffffffffff write=0xffffffffffffffff
1750 config=controller
1751 max_entries=1024
1752 (same instructions)
1753 (same matching)
1754
1755 table 2 ("table2"):
1756 active=0, lookup=0, matched=0
1757 metadata: match=0xffffffffffffffff write=0xffffffffffffffff
1758 config=controller
1759 max_entries=1000000
1760 (same instructions)
1761 (same matching)
1762'; ditto 3 252; tail_table) > expout
9dcd1c00
SH
1763AT_CHECK([ovs-ofctl -O OpenFlow12 dump-tables br0], [0], [expout])
1764OVS_VSWITCHD_STOP
1765AT_CLEANUP
1766
3c4e10fb
BP
1767AT_SETUP([ofproto - table features (OpenFlow 1.3)])
1768OVS_VSWITCHD_START
8811fc0a
BP
1769head_table () {
1770 printf ' table 0 ("%s"):
3c4e10fb
BP
1771 metadata: match=0xffffffffffffffff write=0xffffffffffffffff
1772 max_entries=1000000
8811fc0a
BP
1773 instructions (table miss and others):
1774 next tables: 1-253
1775 instructions: meter,apply_actions,clear_actions,write_actions,write_metadata,goto_table
3c4e10fb
BP
1776 Write-Actions and Apply-Actions features:
1777 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 1778 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 1779tun_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
f6ecf944 1780metadata 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 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
1781 matching:
1782 dp_hash: arbitrary mask
1783 recirc_id: exact match or wildcard
18080541 1784 conj_id: exact match or wildcard
3c4e10fb
BP
1785 tun_id: arbitrary mask
1786 tun_src: arbitrary mask
1787 tun_dst: arbitrary mask
7dad8e9a
TLSC
1788 tun_ipv6_src: arbitrary mask
1789 tun_ipv6_dst: arbitrary mask
b666962b 1790 tun_flags: arbitrary mask
ac6073e3
MC
1791 tun_gbp_id: arbitrary mask
1792 tun_gbp_flags: arbitrary mask
9558d2a5
JG
1793 tun_metadata0: arbitrary mask
1794 tun_metadata1: arbitrary mask
1795 tun_metadata2: arbitrary mask
1796 tun_metadata3: arbitrary mask
1797 tun_metadata4: arbitrary mask
1798 tun_metadata5: arbitrary mask
1799 tun_metadata6: arbitrary mask
1800 tun_metadata7: arbitrary mask
1801 tun_metadata8: arbitrary mask
1802 tun_metadata9: arbitrary mask
1803 tun_metadata10: arbitrary mask
1804 tun_metadata11: arbitrary mask
1805 tun_metadata12: arbitrary mask
1806 tun_metadata13: arbitrary mask
1807 tun_metadata14: arbitrary mask
1808 tun_metadata15: arbitrary mask
1809 tun_metadata16: arbitrary mask
1810 tun_metadata17: arbitrary mask
1811 tun_metadata18: arbitrary mask
1812 tun_metadata19: arbitrary mask
1813 tun_metadata20: arbitrary mask
1814 tun_metadata21: arbitrary mask
1815 tun_metadata22: arbitrary mask
1816 tun_metadata23: arbitrary mask
1817 tun_metadata24: arbitrary mask
1818 tun_metadata25: arbitrary mask
1819 tun_metadata26: arbitrary mask
1820 tun_metadata27: arbitrary mask
1821 tun_metadata28: arbitrary mask
1822 tun_metadata29: arbitrary mask
1823 tun_metadata30: arbitrary mask
1824 tun_metadata31: arbitrary mask
1825 tun_metadata32: arbitrary mask
1826 tun_metadata33: arbitrary mask
1827 tun_metadata34: arbitrary mask
1828 tun_metadata35: arbitrary mask
1829 tun_metadata36: arbitrary mask
1830 tun_metadata37: arbitrary mask
1831 tun_metadata38: arbitrary mask
1832 tun_metadata39: arbitrary mask
1833 tun_metadata40: arbitrary mask
1834 tun_metadata41: arbitrary mask
1835 tun_metadata42: arbitrary mask
1836 tun_metadata43: arbitrary mask
1837 tun_metadata44: arbitrary mask
1838 tun_metadata45: arbitrary mask
1839 tun_metadata46: arbitrary mask
1840 tun_metadata47: arbitrary mask
1841 tun_metadata48: arbitrary mask
1842 tun_metadata49: arbitrary mask
1843 tun_metadata50: arbitrary mask
1844 tun_metadata51: arbitrary mask
1845 tun_metadata52: arbitrary mask
1846 tun_metadata53: arbitrary mask
1847 tun_metadata54: arbitrary mask
1848 tun_metadata55: arbitrary mask
1849 tun_metadata56: arbitrary mask
1850 tun_metadata57: arbitrary mask
1851 tun_metadata58: arbitrary mask
1852 tun_metadata59: arbitrary mask
1853 tun_metadata60: arbitrary mask
1854 tun_metadata61: arbitrary mask
1855 tun_metadata62: arbitrary mask
1856 tun_metadata63: arbitrary mask
3c4e10fb
BP
1857 metadata: arbitrary mask
1858 in_port: exact match or wildcard
1859 in_port_oxm: exact match or wildcard
c61f3870 1860 actset_output: exact match or wildcard
3c4e10fb 1861 pkt_mark: arbitrary mask
07659514
JS
1862 ct_state: arbitrary mask
1863 ct_zone: exact match or wildcard
8e53fe8c 1864 ct_mark: arbitrary mask
9daf2348 1865 ct_label: arbitrary mask
3c4e10fb
BP
1866 reg0: arbitrary mask
1867 reg1: arbitrary mask
1868 reg2: arbitrary mask
1869 reg3: arbitrary mask
1870 reg4: arbitrary mask
1871 reg5: arbitrary mask
1872 reg6: arbitrary mask
1873 reg7: arbitrary mask
1874 xreg0: arbitrary mask
1875 xreg1: arbitrary mask
1876 xreg2: arbitrary mask
1877 xreg3: arbitrary mask
1878 eth_src: arbitrary mask
1879 eth_dst: arbitrary mask
1880 eth_type: exact match or wildcard
1881 vlan_tci: arbitrary mask
1882 vlan_vid: arbitrary mask
1883 vlan_pcp: exact match or wildcard
1884 mpls_label: exact match or wildcard
1885 mpls_tc: exact match or wildcard
1886 mpls_bos: exact match or wildcard
1887 ip_src: arbitrary mask
1888 ip_dst: arbitrary mask
1889 ipv6_src: arbitrary mask
1890 ipv6_dst: arbitrary mask
1891 ipv6_label: arbitrary mask
1892 nw_proto: exact match or wildcard
1893 nw_tos: exact match or wildcard
1894 ip_dscp: exact match or wildcard
1895 nw_ecn: exact match or wildcard
1896 nw_ttl: exact match or wildcard
1897 ip_frag: arbitrary mask
1898 arp_op: exact match or wildcard
1899 arp_spa: arbitrary mask
1900 arp_tpa: arbitrary mask
1901 arp_sha: arbitrary mask
1902 arp_tha: arbitrary mask
1903 tcp_src: arbitrary mask
1904 tcp_dst: arbitrary mask
1905 tcp_flags: arbitrary mask
1906 udp_src: arbitrary mask
1907 udp_dst: arbitrary mask
1908 sctp_src: arbitrary mask
1909 sctp_dst: arbitrary mask
1910 icmp_type: exact match or wildcard
1911 icmp_code: exact match or wildcard
1912 icmpv6_type: exact match or wildcard
1913 icmpv6_code: exact match or wildcard
1914 nd_target: arbitrary mask
1915 nd_sll: arbitrary mask
8811fc0a
BP
1916 nd_tll: arbitrary mask
1917
1918' $1
1919}
1920ditto() {
1921 printf ' table %d ("%s"):
1922 metadata: match=0xffffffffffffffff write=0xffffffffffffffff
1923 max_entries=%d
1924 instructions (table miss and others):
1925 next tables: %d-253
1926 (same instructions)
1927 (same actions)
1928 (same matching)
1929
1930' $1 $2 $3 `expr $1 + 1`
1931}
1932tail_tables() {
1933echo ' table 252 ("table252"):
1934 metadata: match=0xffffffffffffffff write=0xffffffffffffffff
1935 max_entries=1000000
1936 instructions (table miss and others):
1937 next tables: 253
1938 (same instructions)
1939 (same actions)
1940 (same matching)
1941
1942 table 253 ("table253"):
1943 metadata: match=0xffffffffffffffff write=0xffffffffffffffff
1944 max_entries=1000000
1945 instructions (table miss and others):
1946 instructions: meter,apply_actions,clear_actions,write_actions,write_metadata
1947 (same actions)
1948 (same matching)
1949'
1950}
1951(head_table classifier
1952 for i in `seq 1 251`; do
1953 ditto $i table$i 1000000
1954 done
1955 tail_tables) > expout
1956AT_CHECK([ovs-ofctl -O OpenFlow13 dump-table-features br0], [0], [expout])
3c4e10fb
BP
1957# Change the configuration.
1958AT_CHECK(
1959 [ovs-vsctl \
1960 -- --id=@t0 create Flow_Table name=main \
1961 -- --id=@t1 create Flow_Table flow-limit=1024 \
1962 -- set bridge br0 'flow_tables={1=@t1,0=@t0}' \
1963 | ${PERL} $srcdir/uuidfilt.pl],
1964 [0], [<0>
1965<1>
1966])
1967# Check that the configuration was updated.
8811fc0a
BP
1968(head_table main
1969 ditto 1 table1 1024
1970 for i in `seq 2 251`; do
1971 ditto $i table$i 1000000
1972 done
1973 tail_tables) > expout
1974AT_CHECK([ovs-ofctl -O OpenFlow13 dump-table-features br0], [0], [expout])
3c4e10fb
BP
1975OVS_VSWITCHD_STOP
1976AT_CLEANUP
1977
03c72922
BP
1978AT_SETUP([ofproto - table description (OpenFlow 1.4)])
1979OVS_VSWITCHD_START
1980(x=0
1981 while test $x -lt 254; do
1982 y=`expr $x + 1`
1983 echo " table $x:
bab86012
SJ
1984 eviction=off eviction_flags=OTHER|IMPORTANCE|LIFETIME
1985 vacancy=off"
03c72922
BP
1986 x=$y
1987 done) > expout
1988AT_CHECK([ovs-ofctl -O OpenFlow14 dump-table-desc br0 | sed '/^$/d
1989/^OFPST_TABLE_DESC/d'], [0], [expout])
1990
1991# Change the configuration.
1992AT_CHECK([ovs-ofctl -O Openflow14 mod-table br0 0 evict])
1993# Check that the configuration was updated.
1994mv expout orig-expout
1995sed -e '2s/eviction=off/eviction=on/' <orig-expout > expout
1996AT_CHECK([ovs-ofctl -O OpenFlow14 dump-table-desc br0 | sed '/^$/d
1997/^OFPST_TABLE_DESC/d'], [0], [expout])
de7d3c07
SJ
1998
1999AT_CHECK([ovs-ofctl -O Openflow14 mod-table br0 0 vacancy:20,80])
2000# Check that the configuration was updated.
2001mv expout orig-expout
2002sed -e '3s/vacancy=off/vacancy=on vacancy_down=20% vacancy_up=80% vacancy=0%/' <orig-expout > expout
2003AT_CHECK([ovs-ofctl -O OpenFlow14 dump-table-desc br0 | sed '/^$/d
2004/^OFPST_TABLE_DESC/d'], [0], [expout])
03c72922
BP
2005OVS_VSWITCHD_STOP
2006AT_CLEANUP
2007
06f64d03 2008AT_SETUP([ofproto - hard limits on flow table size (OpenFlow 1.0)])
254750ce
BP
2009OVS_VSWITCHD_START
2010# Configure a maximum of 4 flows.
2011AT_CHECK(
2012 [ovs-vsctl \
2013 -- --id=@t0 create Flow_Table flow-limit=4 \
2014 -- set bridge br0 flow_tables:0=@t0 \
5c6d0628 2015 | ${PERL} $srcdir/uuidfilt.pl],
254750ce
BP
2016 [0], [<0>
2017])
2018# Add 4 flows.
2019for in_port in 1 2 3 4; do
2020 ovs-ofctl add-flow br0 in_port=$in_port,actions=drop
2021done
2022AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
2023 in_port=1 actions=drop
2024 in_port=2 actions=drop
2025 in_port=3 actions=drop
2026 in_port=4 actions=drop
2027NXST_FLOW reply:
2028])
2029# Adding another flow will be refused.
2030AT_CHECK([ovs-ofctl add-flow br0 in_port=5,actions=drop], [1], [], [stderr])
27527aa0 2031AT_CHECK([head -n 1 stderr | ofctl_strip], [0],
be2b69d1 2032 [OFPT_ERROR: OFPFMFC_TABLE_FULL
254750ce
BP
2033])
2034# Also a mod-flow that would add a flow will be refused.
2035AT_CHECK([ovs-ofctl mod-flows 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# Replacing or modifying an existing flow is allowed.
2040AT_CHECK([ovs-ofctl add-flow br0 in_port=4,actions=normal])
2041AT_CHECK([ovs-ofctl mod-flows br0 in_port=3,actions=output:1])
2042AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
2043 in_port=1 actions=drop
2044 in_port=2 actions=drop
2045 in_port=3 actions=output:1
2046 in_port=4 actions=NORMAL
2047NXST_FLOW reply:
2048])
2049OVS_VSWITCHD_STOP
2050AT_CLEANUP
2051
06f64d03 2052AT_SETUP([ofproto - hard limits on flow table size (OpenFlow 1.2)])
9dcd1c00
SH
2053OVS_VSWITCHD_START
2054# Configure a maximum of 4 flows.
2055AT_CHECK(
2056 [ovs-vsctl \
2057 -- --id=@t0 create Flow_Table flow-limit=4 \
2058 -- set bridge br0 flow_tables:0=@t0 \
5c6d0628 2059 | ${PERL} $srcdir/uuidfilt.pl],
9dcd1c00
SH
2060 [0], [<0>
2061])
2062# Add 4 flows.
2063for in_port in 1 2 3 4; do
2064 ovs-ofctl -O OpenFlow12 add-flow br0 in_port=$in_port,actions=drop
2065done
2066AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
2067 in_port=1 actions=drop
2068 in_port=2 actions=drop
2069 in_port=3 actions=drop
2070 in_port=4 actions=drop
2071OFPST_FLOW reply (OF1.2):
2072])
2073# Adding another flow will be refused.
2074AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 in_port=5,actions=drop], [1], [], [stderr])
2075AT_CHECK([head -n 1 stderr | ofctl_strip], [0],
2076 [OFPT_ERROR (OF1.2): OFPFMFC_TABLE_FULL
2077])
2078# Replacing or modifying an existing flow is allowed.
2079AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 in_port=4,actions=normal])
2080AT_CHECK([ovs-ofctl -O OpenFlow12 mod-flows br0 in_port=3,actions=output:1])
2081AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
2082 in_port=1 actions=drop
2083 in_port=2 actions=drop
2084 in_port=3 actions=output:1
2085 in_port=4 actions=NORMAL
2086OFPST_FLOW reply (OF1.2):
2087])
2088OVS_VSWITCHD_STOP
2089AT_CLEANUP
2090
2091AT_SETUP([ofproto - eviction upon table overflow (OpenFlow 1.0)])
254750ce
BP
2092OVS_VSWITCHD_START
2093# Configure a maximum of 4 flows.
2094AT_CHECK(
2095 [ovs-vsctl \
2096 -- --id=@t0 create Flow_Table flow-limit=4 overflow-policy=evict \
2097 -- set bridge br0 flow_tables:0=@t0 \
5c6d0628 2098 | ${PERL} $srcdir/uuidfilt.pl],
254750ce
BP
2099 [0], [<0>
2100])
2101# Add 4 flows.
2102for in_port in 4 3 2 1; do
2103 ovs-ofctl add-flow br0 idle_timeout=${in_port}0,in_port=$in_port,actions=drop
2104done
2105AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
b9718b7b
BP
2106 idle_timeout=10, in_port=1 actions=drop
2107 idle_timeout=20, in_port=2 actions=drop
2108 idle_timeout=30, in_port=3 actions=drop
2109 idle_timeout=40, in_port=4 actions=drop
254750ce
BP
2110NXST_FLOW reply:
2111])
2112# Adding another flow will cause the one that expires soonest to be evicted.
2113AT_CHECK([ovs-ofctl add-flow br0 in_port=5,actions=drop])
2114AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
b9718b7b
BP
2115 idle_timeout=20, in_port=2 actions=drop
2116 idle_timeout=30, in_port=3 actions=drop
2117 idle_timeout=40, in_port=4 actions=drop
254750ce
BP
2118 in_port=5 actions=drop
2119NXST_FLOW reply:
2120])
2121# A mod-flow that adds a flow also causes eviction, but replacing or
2122# modifying an existing flow doesn't.
2123AT_CHECK([ovs-ofctl mod-flows br0 in_port=6,actions=drop])
2124AT_CHECK([ovs-ofctl add-flow br0 in_port=4,actions=normal])
2125AT_CHECK([ovs-ofctl mod-flows br0 in_port=3,actions=output:1])
2126AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
b9718b7b 2127 idle_timeout=30, in_port=3 actions=output:1
254750ce
BP
2128 in_port=4 actions=NORMAL
2129 in_port=5 actions=drop
2130 in_port=6 actions=drop
2131NXST_FLOW reply:
2132])
2133# Flows with no timeouts at all cannot be evicted.
2134AT_CHECK([ovs-ofctl add-flow br0 in_port=7,actions=normal])
2135AT_CHECK([ovs-ofctl add-flow br0 in_port=8,actions=drop], [1], [], [stderr])
27527aa0 2136AT_CHECK([head -n 1 stderr | ofctl_strip], [0],
be2b69d1 2137 [OFPT_ERROR: OFPFMFC_TABLE_FULL
254750ce
BP
2138])
2139AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
2140 in_port=4 actions=NORMAL
2141 in_port=5 actions=drop
2142 in_port=6 actions=drop
2143 in_port=7 actions=NORMAL
2144NXST_FLOW reply:
2145])
2146OVS_VSWITCHD_STOP
2147AT_CLEANUP
2148
9dcd1c00
SH
2149AT_SETUP([ofproto - eviction upon table overflow (OpenFlow 1.2)])
2150OVS_VSWITCHD_START
2151# Configure a maximum of 4 flows.
2152AT_CHECK(
2153 [ovs-vsctl \
2154 -- --id=@t0 create Flow_Table flow-limit=4 overflow-policy=evict \
2155 -- set bridge br0 flow_tables:0=@t0 \
5c6d0628 2156 | ${PERL} $srcdir/uuidfilt.pl],
9dcd1c00
SH
2157 [0], [<0>
2158])
2159# Add 4 flows.
2160for in_port in 4 3 2 1; do
2161 ovs-ofctl -O OpenFlow12 add-flow br0 idle_timeout=${in_port}0,in_port=$in_port,actions=drop
2162done
2163AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
2164 idle_timeout=10, in_port=1 actions=drop
2165 idle_timeout=20, in_port=2 actions=drop
2166 idle_timeout=30, in_port=3 actions=drop
2167 idle_timeout=40, in_port=4 actions=drop
2168OFPST_FLOW reply (OF1.2):
2169])
2170# Adding another flow will cause the one that expires soonest to be evicted.
2171AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 in_port=5,actions=drop])
2172AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
2173 idle_timeout=20, in_port=2 actions=drop
2174 idle_timeout=30, in_port=3 actions=drop
2175 idle_timeout=40, in_port=4 actions=drop
2176 in_port=5 actions=drop
2177OFPST_FLOW reply (OF1.2):
2178])
0746a84f 2179# In OpenFlow 1.2 a mod-flow does not ever add a flow and thus
9dcd1c00
SH
2180# has no effect on eviction
2181AT_CHECK([ovs-ofctl -O OpenFlow12 mod-flows br0 in_port=6,actions=drop])
2182AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 in_port=4,actions=normal])
2183AT_CHECK([ovs-ofctl -O OpenFlow12 mod-flows br0 in_port=3,actions=output:1])
2184AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
2185 idle_timeout=20, in_port=2 actions=drop
2186 idle_timeout=30, in_port=3 actions=output:1
2187 in_port=4 actions=NORMAL
2188 in_port=5 actions=drop
2189OFPST_FLOW reply (OF1.2):
2190])
2191# Flows with no timeouts at all cannot be evicted.
2192AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 in_port=6,actions=drop])
2193AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 in_port=7,actions=normal])
2194AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 in_port=8,actions=drop], [1], [], [stderr])
2195AT_CHECK([head -n 1 stderr | ofctl_strip], [0],
2196 [OFPT_ERROR (OF1.2): OFPFMFC_TABLE_FULL
2197])
2198AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
2199 in_port=4 actions=NORMAL
2200 in_port=5 actions=drop
2201 in_port=6 actions=drop
2202 in_port=7 actions=NORMAL
2203OFPST_FLOW reply (OF1.2):
2204])
2205OVS_VSWITCHD_STOP
2206AT_CLEANUP
2207
f70b94de
BP
2208AT_SETUP([ofproto - eviction using importance upon table overflow (OpenFlow 1.4)])
2209OVS_VSWITCHD_START
2210# Configure a maximum of 4 flows.
2211AT_CHECK(
2212 [ovs-vsctl \
82c22d34 2213 -- --id=@t0 create Flow_Table name=evict flow-limit=4 \
f70b94de
BP
2214 -- set bridge br0 flow_tables:0=@t0 \
2215 | ${PERL} $srcdir/uuidfilt.pl],
2216 [0], [<0>
2217])
82c22d34
BP
2218# Use mod-table to turn on eviction just to demonstrate that it works.
2219AT_CHECK([ovs-ofctl -O OpenFlow14 mod-table br0 0 evict])
f70b94de
BP
2220# Add 4 flows.
2221for in_port in 4 3 2 1; do
2222 ovs-ofctl -O Openflow14 add-flow br0 importance=$((in_port + 30)),priority=$((in_port + 5)),hard_timeout=$((in_port + 500)),actions=drop
2223done
2224AT_CHECK([ovs-ofctl -O Openflow14 dump-flows br0 | ofctl_strip | sort], [0], [dnl
2225 hard_timeout=501, importance=31, priority=6 actions=drop
2226 hard_timeout=502, importance=32, priority=7 actions=drop
2227 hard_timeout=503, importance=33, priority=8 actions=drop
2228 hard_timeout=504, importance=34, priority=9 actions=drop
2229OFPST_FLOW reply (OF1.4):
2230])
2231# Adding another flow will cause the one with lowest importance to be evicted.
2232AT_CHECK([ovs-ofctl -O Openflow14 add-flow br0 hard_timeout=505,importance=35,priority=10,in_port=2,actions=drop])
2233AT_CHECK([ovs-ofctl -O Openflow14 dump-flows br0 | ofctl_strip | sort], [0], [dnl
2234 hard_timeout=502, importance=32, priority=7 actions=drop
2235 hard_timeout=503, importance=33, priority=8 actions=drop
2236 hard_timeout=504, importance=34, priority=9 actions=drop
2237 hard_timeout=505, importance=35, priority=10,in_port=2 actions=drop
2238OFPST_FLOW reply (OF1.4):
2239])
2240# Disable the Eviction configuration.
82c22d34 2241AT_CHECK([ovs-ofctl -O OpenFlow14 mod-table br0 0 noevict])
f70b94de
BP
2242# Adding another flow will cause the system to give error for FULL TABLE.
2243AT_CHECK([ovs-ofctl -O Openflow14 add-flow br0 hard_timeout=506,importance=36,priority=11,actions=drop],[1], [], [stderr])
2244AT_CHECK([head -n 1 stderr | ofctl_strip], [0],
2245 [OFPT_ERROR (OF1.4): OFPFMFC_TABLE_FULL
2246])
2247#Dump flows. It should show only the old values
2248AT_CHECK([ovs-ofctl -O Openflow14 dump-flows br0 | ofctl_strip | sort], [0], [dnl
2249 hard_timeout=502, importance=32, priority=7 actions=drop
2250 hard_timeout=503, importance=33, priority=8 actions=drop
2251 hard_timeout=504, importance=34, priority=9 actions=drop
2252 hard_timeout=505, importance=35, priority=10,in_port=2 actions=drop
2253OFPST_FLOW reply (OF1.4):
2254])
2255# mod-flow that would modify a flow will be done successfully.
2256AT_CHECK([ovs-ofctl -O Openflow14 mod-flows br0 in_port=2,actions=NORMAL])
2257AT_CHECK([ovs-ofctl -O Openflow14 dump-flows br0 | ofctl_strip | sort], [0], [dnl
2258 hard_timeout=502, importance=32, priority=7 actions=drop
2259 hard_timeout=503, importance=33, priority=8 actions=drop
2260 hard_timeout=504, importance=34, priority=9 actions=drop
2261 hard_timeout=505, importance=35, priority=10,in_port=2 actions=NORMAL
2262OFPST_FLOW reply (OF1.4):
2263])
2264# Also a mod-flow that would add a flow will be refused.
2265AT_CHECK([ovs-ofctl mod-flows br0 in_port=5,actions=drop], [1], [], [stderr])
2266AT_CHECK([head -n 1 stderr | ofctl_strip], [0],
2267 [OFPT_ERROR: OFPFMFC_TABLE_FULL
2268])
2269OVS_VSWITCHD_STOP
2270AT_CLEANUP
2271
9dcd1c00 2272AT_SETUP([ofproto - eviction upon table overflow, with fairness (OpenFlow 1.0)])
254750ce
BP
2273OVS_VSWITCHD_START
2274# Configure a maximum of 4 flows.
2275AT_CHECK(
2276 [ovs-vsctl \
2277 -- --id=@t0 create Flow_Table name=evict flow-limit=4 \
2278 overflow-policy=evict \
2279 groups='"NXM_OF_IN_PORT[[]]"' \
2280 -- set bridge br0 flow_tables:0=@t0 \
5c6d0628 2281 | ${PERL} $srcdir/uuidfilt.pl],
254750ce
BP
2282 [0], [<0>
2283])
2284# Add 4 flows.
2285ovs-ofctl add-flows br0 - <<EOF
2286idle_timeout=10 in_port=2 dl_src=00:44:55:66:77:88 actions=drop
2287idle_timeout=20 in_port=1 dl_src=00:11:22:33:44:55 actions=drop
2288idle_timeout=30 in_port=1 dl_src=00:22:33:44:55:66 actions=drop
2289idle_timeout=40 in_port=1 dl_src=00:33:44:55:66:77 actions=drop
2290EOF
2291AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
b9718b7b
BP
2292 idle_timeout=10, in_port=2,dl_src=00:44:55:66:77:88 actions=drop
2293 idle_timeout=20, in_port=1,dl_src=00:11:22:33:44:55 actions=drop
2294 idle_timeout=30, in_port=1,dl_src=00:22:33:44:55:66 actions=drop
2295 idle_timeout=40, in_port=1,dl_src=00:33:44:55:66:77 actions=drop
254750ce
BP
2296NXST_FLOW reply:
2297])
2298# Adding another flow will cause the one that expires soonest within
2299# the largest group (those with in_port=1) to be evicted. In this
2300# case this is not the same as the one that expires soonest overall
2301# (which is what makes the test interesting):
2302AT_CHECK([ovs-ofctl add-flow br0 in_port=2,dl_src=00:55:66:77:88:99,actions=drop])
2303AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
b9718b7b
BP
2304 idle_timeout=10, in_port=2,dl_src=00:44:55:66:77:88 actions=drop
2305 idle_timeout=30, in_port=1,dl_src=00:22:33:44:55:66 actions=drop
2306 idle_timeout=40, in_port=1,dl_src=00:33:44:55:66:77 actions=drop
254750ce
BP
2307 in_port=2,dl_src=00:55:66:77:88:99 actions=drop
2308NXST_FLOW reply:
2309])
2310# Enlarge the flow limit, change the eviction policy back to strictly
2311# based on expiration, and and add some flows.
2312AT_CHECK([ovs-vsctl set Flow_Table evict groups='[[]]' flow-limit=7])
2313ovs-ofctl add-flows br0 - <<EOF
2314idle_timeout=50 in_port=2 dl_src=00:66:77:88:99:aa actions=drop
2315idle_timeout=60 in_port=2 dl_src=00:77:88:99:aa:bb actions=drop
2316idle_timeout=70 in_port=2 dl_src=00:88:99:aa:bb:cc actions=drop
2317EOF
2318AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
b9718b7b
BP
2319 idle_timeout=10, in_port=2,dl_src=00:44:55:66:77:88 actions=drop
2320 idle_timeout=30, in_port=1,dl_src=00:22:33:44:55:66 actions=drop
2321 idle_timeout=40, in_port=1,dl_src=00:33:44:55:66:77 actions=drop
2322 idle_timeout=50, in_port=2,dl_src=00:66:77:88:99:aa actions=drop
2323 idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=drop
2324 idle_timeout=70, in_port=2,dl_src=00:88:99:aa:bb:cc actions=drop
254750ce
BP
2325 in_port=2,dl_src=00:55:66:77:88:99 actions=drop
2326NXST_FLOW reply:
2327])
2328# Adding another flow will cause the one that expires soonest overall
2329# to be evicted.
2330AT_CHECK([ovs-ofctl add-flow br0 'idle_timeout=80 in_port=2 dl_src=00:99:aa:bb:cc:dd actions=drop'])
2331AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
b9718b7b
BP
2332 idle_timeout=30, in_port=1,dl_src=00:22:33:44:55:66 actions=drop
2333 idle_timeout=40, in_port=1,dl_src=00:33:44:55:66:77 actions=drop
2334 idle_timeout=50, in_port=2,dl_src=00:66:77:88:99:aa actions=drop
2335 idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=drop
2336 idle_timeout=70, in_port=2,dl_src=00:88:99:aa:bb:cc actions=drop
2337 idle_timeout=80, in_port=2,dl_src=00:99:aa:bb:cc:dd actions=drop
254750ce
BP
2338 in_port=2,dl_src=00:55:66:77:88:99 actions=drop
2339NXST_FLOW reply:
2340])
2341# Reducing the flow limit also causes the flows that expire soonest
2342# overall to be evicted.
2343AT_CHECK([ovs-vsctl set Flow_Table evict flow-limit=4])
2344AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
b9718b7b
BP
2345 idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=drop
2346 idle_timeout=70, in_port=2,dl_src=00:88:99:aa:bb:cc actions=drop
2347 idle_timeout=80, in_port=2,dl_src=00:99:aa:bb:cc:dd actions=drop
254750ce
BP
2348 in_port=2,dl_src=00:55:66:77:88:99 actions=drop
2349NXST_FLOW reply:
2350])
2351OVS_VSWITCHD_STOP
2352AT_CLEANUP
80d5aefd 2353
9dcd1c00
SH
2354AT_SETUP([ofproto - eviction upon table overflow, with fairness (OpenFlow 1.2)])
2355OVS_VSWITCHD_START
2356# Configure a maximum of 4 flows.
2357AT_CHECK(
2358 [ovs-vsctl \
2359 -- --id=@t0 create Flow_Table name=evict flow-limit=4 \
2360 overflow-policy=evict \
2361 groups='"NXM_OF_IN_PORT[[]]"' \
2362 -- set bridge br0 flow_tables:0=@t0 \
5c6d0628 2363 | ${PERL} $srcdir/uuidfilt.pl],
9dcd1c00
SH
2364 [0], [<0>
2365])
2366# Add 4 flows.
2367ovs-ofctl -O OpenFlow12 add-flows br0 - <<EOF
2368idle_timeout=10 in_port=2 dl_src=00:44:55:66:77:88 actions=drop
2369idle_timeout=20 in_port=1 dl_src=00:11:22:33:44:55 actions=drop
2370idle_timeout=30 in_port=1 dl_src=00:22:33:44:55:66 actions=drop
2371idle_timeout=40 in_port=1 dl_src=00:33:44:55:66:77 actions=drop
2372EOF
2373AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
2374 idle_timeout=10, in_port=2,dl_src=00:44:55:66:77:88 actions=drop
2375 idle_timeout=20, in_port=1,dl_src=00:11:22:33:44:55 actions=drop
2376 idle_timeout=30, in_port=1,dl_src=00:22:33:44:55:66 actions=drop
2377 idle_timeout=40, in_port=1,dl_src=00:33:44:55:66:77 actions=drop
2378OFPST_FLOW reply (OF1.2):
2379])
2380# Adding another flow will cause the one that expires soonest within
2381# the largest group (those with in_port=1) to be evicted. In this
2382# case this is not the same as the one that expires soonest overall
2383# (which is what makes the test interesting):
2384AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 in_port=2,dl_src=00:55:66:77:88:99,actions=drop])
2385AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
2386 idle_timeout=10, in_port=2,dl_src=00:44:55:66:77:88 actions=drop
2387 idle_timeout=30, in_port=1,dl_src=00:22:33:44:55:66 actions=drop
2388 idle_timeout=40, in_port=1,dl_src=00:33:44:55:66:77 actions=drop
2389 in_port=2,dl_src=00:55:66:77:88:99 actions=drop
2390OFPST_FLOW reply (OF1.2):
2391])
2392# Enlarge the flow limit, change the eviction policy back to strictly
2393# based on expiration, and and add some flows.
2394AT_CHECK([ovs-vsctl set Flow_Table evict groups='[[]]' flow-limit=7])
2395ovs-ofctl -O OpenFlow12 add-flows br0 - <<EOF
2396idle_timeout=50 in_port=2 dl_src=00:66:77:88:99:aa actions=drop
2397idle_timeout=60 in_port=2 dl_src=00:77:88:99:aa:bb actions=drop
2398idle_timeout=70 in_port=2 dl_src=00:88:99:aa:bb:cc actions=drop
2399EOF
2400AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
2401 idle_timeout=10, in_port=2,dl_src=00:44:55:66:77:88 actions=drop
2402 idle_timeout=30, in_port=1,dl_src=00:22:33:44:55:66 actions=drop
2403 idle_timeout=40, in_port=1,dl_src=00:33:44:55:66:77 actions=drop
2404 idle_timeout=50, in_port=2,dl_src=00:66:77:88:99:aa actions=drop
2405 idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=drop
2406 idle_timeout=70, in_port=2,dl_src=00:88:99:aa:bb:cc actions=drop
2407 in_port=2,dl_src=00:55:66:77:88:99 actions=drop
2408OFPST_FLOW reply (OF1.2):
2409])
2410# Adding another flow will cause the one that expires soonest overall
2411# to be evicted.
2412AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 'idle_timeout=80 in_port=2 dl_src=00:99:aa:bb:cc:dd actions=drop'])
2413AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
2414 idle_timeout=30, in_port=1,dl_src=00:22:33:44:55:66 actions=drop
2415 idle_timeout=40, in_port=1,dl_src=00:33:44:55:66:77 actions=drop
2416 idle_timeout=50, in_port=2,dl_src=00:66:77:88:99:aa actions=drop
2417 idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=drop
2418 idle_timeout=70, in_port=2,dl_src=00:88:99:aa:bb:cc actions=drop
2419 idle_timeout=80, in_port=2,dl_src=00:99:aa:bb:cc:dd actions=drop
2420 in_port=2,dl_src=00:55:66:77:88:99 actions=drop
2421OFPST_FLOW reply (OF1.2):
2422])
2423# Reducing the flow limit also causes the flows that expire soonest
2424# overall to be evicted.
2425AT_CHECK([ovs-vsctl set Flow_Table evict flow-limit=4])
2426AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
2427 idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=drop
2428 idle_timeout=70, in_port=2,dl_src=00:88:99:aa:bb:cc actions=drop
2429 idle_timeout=80, in_port=2,dl_src=00:99:aa:bb:cc:dd actions=drop
2430 in_port=2,dl_src=00:55:66:77:88:99 actions=drop
2431OFPST_FLOW reply (OF1.2):
2432])
2433OVS_VSWITCHD_STOP
2434AT_CLEANUP
2435
6d56c1f1
K
2436AT_SETUP([ofproto - eviction upon table overflow, with modified hard timeout])
2437OVS_VSWITCHD_START
2438# Configure a maximum of 4 flows.
2439AT_CHECK(
2440 [ovs-vsctl \
2441 -- --id=@t0 create Flow_Table flow-limit=4 overflow-policy=evict \
2442 -- set bridge br0 flow_tables:0=@t0 \
2443 | ${PERL} $srcdir/uuidfilt.pl],
2444 [0], [<0>
2445])
337a3866 2446ovs-appctl time/stop
6d56c1f1
K
2447# Add 4 flows.
2448for in_port in 4 3 2 1; do
337a3866 2449 ovs-ofctl add-flow br0 hard_timeout=$((10 + in_port * 3)),in_port=$in_port,actions=drop
6d56c1f1
K
2450done
2451AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
337a3866
YT
2452 hard_timeout=13, in_port=1 actions=drop
2453 hard_timeout=16, in_port=2 actions=drop
2454 hard_timeout=19, in_port=3 actions=drop
2455 hard_timeout=22, in_port=4 actions=drop
6d56c1f1
K
2456NXST_FLOW reply:
2457])
2458# Sleep and modify the one that expires soonest
337a3866 2459ovs-appctl time/warp 5000
6d56c1f1 2460AT_CHECK([ovs-ofctl mod-flows br0 in_port=1,actions=drop])
337a3866
YT
2461# At this point the table would looks like:
2462# in_port seconds to expire
2463# 1 13
2464# 2 11
2465# 3 14
2466# 4 17
2467ovs-appctl time/warp 2000
6d56c1f1
K
2468# Adding another flow will cause the one that expires soonest to be evicted.
2469AT_CHECK([ovs-ofctl add-flow br0 in_port=5,actions=drop])
2470AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
337a3866
YT
2471 hard_timeout=13, in_port=1 actions=drop
2472 hard_timeout=19, in_port=3 actions=drop
2473 hard_timeout=22, in_port=4 actions=drop
6d56c1f1
K
2474 in_port=5 actions=drop
2475NXST_FLOW reply:
2476])
2477OVS_VSWITCHD_STOP
2478AT_CLEANUP
2479
2480AT_SETUP([ofproto - eviction upon table overflow, with modified idle timeout])
2481OVS_VSWITCHD_START([add-port br0 p1 -- set interface p1 type=dummy ofport_request=1])
2482# Configure a maximum of 4 flows.
2483AT_CHECK(
2484 [ovs-vsctl \
2485 -- --id=@t0 create Flow_Table flow-limit=4 overflow-policy=evict \
2486 -- set bridge br0 flow_tables:0=@t0 \
2487 | ${PERL} $srcdir/uuidfilt.pl],
2488 [0], [<0>
2489])
2490# Add 4 flows.
2491for in_port in 4 3 2 1; do
337a3866 2492 ovs-ofctl add-flow br0 idle_timeout=$((10 + in_port * 3)),in_port=$in_port,actions=drop
6d56c1f1 2493done
337a3866 2494ovs-appctl time/stop
6d56c1f1 2495AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
337a3866
YT
2496 idle_timeout=13, in_port=1 actions=drop
2497 idle_timeout=16, in_port=2 actions=drop
2498 idle_timeout=19, in_port=3 actions=drop
2499 idle_timeout=22, in_port=4 actions=drop
6d56c1f1
K
2500NXST_FLOW reply:
2501])
2502# Sleep and receive on the flow that expires soonest
337a3866 2503ovs-appctl time/warp 5000
6d56c1f1 2504AT_CHECK([ovs-appctl netdev-dummy/receive p1 'in_port(1)'])
337a3866
YT
2505# At this point the table would looks like:
2506# in_port seconds to expire
2507# 1 13
2508# 2 11
2509# 3 14
2510# 4 17
2511ovs-appctl time/warp 2000
6d56c1f1
K
2512# Adding another flow will cause the one that expires soonest to be evicted.
2513AT_CHECK([ovs-ofctl add-flow br0 in_port=5,actions=drop])
2514AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
337a3866
YT
2515 idle_timeout=19, in_port=3 actions=drop
2516 idle_timeout=22, in_port=4 actions=drop
6d56c1f1 2517 in_port=5 actions=drop
337a3866 2518 n_packets=1, n_bytes=60, idle_timeout=13, in_port=1 actions=drop
6d56c1f1
K
2519NXST_FLOW reply:
2520])
2521OVS_VSWITCHD_STOP
2522AT_CLEANUP
2523
9dcd1c00 2524AT_SETUP([ofproto - asynchronous message control (OpenFlow 1.0)])
80d5aefd
BP
2525OVS_VSWITCHD_START
2526AT_CHECK([ovs-ofctl -P openflow10 monitor br0 --detach --no-chdir --pidfile])
2527check_async () {
2528 printf '\n\n--- check_async %d ---\n\n\n' $1
2529 shift
2530
6fc67c4f 2531 ovs-appctl -t ovs-ofctl ofctl/barrier
80d5aefd
BP
2532 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
2533 : > expout
2534
a7349929 2535 # OFPT_PACKET_IN, OFPR_ACTION (controller_id=0)
7f05e7ab 2536 ovs-ofctl -v packet-out br0 controller controller '0001020304050010203040501234'
80d5aefd 2537 if test X"$1" = X"OFPR_ACTION"; then shift;
7f05e7ab 2538 echo >>expout "OFPT_PACKET_IN: total_len=14 in_port=CONTROLLER (via action) data_len=14 (unbuffered)
e6d9ab56 2539vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1234"
80d5aefd
BP
2540 fi
2541
a7349929 2542 # OFPT_PACKET_IN, OFPR_NO_MATCH (controller_id=123)
7f05e7ab 2543 ovs-ofctl -v packet-out br0 controller 'controller(reason=no_match,id=123)' '0001020304050010203040501234'
a7349929 2544 if test X"$1" = X"OFPR_NO_MATCH"; then shift;
7f05e7ab 2545 echo >>expout "OFPT_PACKET_IN: total_len=14 in_port=CONTROLLER (via no_match) data_len=14 (unbuffered)
e6d9ab56 2546vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1234"
a7349929
BP
2547 fi
2548
2549 # OFPT_PACKET_IN, OFPR_INVALID_TTL (controller_id=0)
fa8d9001 2550 ovs-ofctl packet-out br0 controller dec_ttl '002583dfb4000026b98cb0f908004500003eb7e200000011339bac11370dac100002d7730035002b8f6d86fb0100000100000000000006626c702d7873066e696369726103636f6d00000f00'
80d5aefd 2551 if test X"$1" = X"OFPR_INVALID_TTL"; then shift;
7f05e7ab 2552 echo >>expout "OFPT_PACKET_IN: total_len=76 in_port=CONTROLLER (via invalid_ttl) data_len=76 (unbuffered)
e6d9ab56 2553udp,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
2554 fi
2555
2556 # OFPT_PORT_STATUS, OFPPR_ADD
e1b1d06a 2557 ovs-vsctl add-port br0 test -- set Interface test type=dummy ofport_request=1
80d5aefd
BP
2558 if test X"$1" = X"OFPPR_ADD"; then shift;
2559 echo >>expout "OFPT_PORT_STATUS: ADD: 1(test): addr:aa:55:aa:55:00:0x
2560 config: PORT_DOWN
9e1fd49b 2561 state: LINK_DOWN
d02a5f8e 2562 speed: 0 Mbps now, 0 Mbps max"
80d5aefd
BP
2563 fi
2564
2565 # OFPT_PORT_STATUS, OFPPR_DELETE
2566 ovs-vsctl del-port br0 test
2567 if test X"$1" = X"OFPPR_DELETE"; then shift;
2568 echo >>expout "OFPT_PORT_STATUS: DEL: 1(test): addr:aa:55:aa:55:00:0x
2569 config: PORT_DOWN
9e1fd49b 2570 state: LINK_DOWN
d02a5f8e 2571 speed: 0 Mbps now, 0 Mbps max"
80d5aefd
BP
2572 fi
2573
2574 # OFPT_FLOW_REMOVED, OFPRR_DELETE
2575 ovs-ofctl add-flow br0 send_flow_rem,actions=drop
2576 ovs-ofctl --strict del-flows br0 ''
2577 if test X"$1" = X"OFPRR_DELETE"; then shift;
2578 echo >>expout "OFPT_FLOW_REMOVED: reason=delete"
2579 fi
2580 AT_FAIL_IF([test X"$1" != X])
2581
2582 ovs-appctl -t ovs-ofctl ofctl/barrier
fd0aa9ea 2583 echo >>expout "OFPT_BARRIER_REPLY:"
80d5aefd
BP
2584
2585 AT_CHECK(
2586 [[sed '
2587s/ (xid=0x[0-9a-fA-F]*)//
2588s/ *duration.*//
2589s/00:0.$/00:0x/' < monitor.log]],
2590 [0], [expout])
2591}
2592
2593# It's a service connection so initially there should be no async messages.
2594check_async 1
2595
99811d07 2596# Set miss_send_len to 128, turning on packet-ins for our service connection.
80d5aefd
BP
2597ovs-appctl -t ovs-ofctl ofctl/send 0109000c0123456700000080
2598check_async 2 OFPR_ACTION OFPPR_ADD OFPPR_DELETE OFPRR_DELETE
2599
2600# Set miss_send_len to 128 and enable invalid_ttl.
2601ovs-appctl -t ovs-ofctl ofctl/send 0109000c0123456700040080
2602check_async 3 OFPR_ACTION OFPR_INVALID_TTL OFPPR_ADD OFPPR_DELETE OFPRR_DELETE
2603
2604# Become slave, which should disable everything except port status.
2605ovs-appctl -t ovs-ofctl ofctl/send 0104001400000002000023200000000a00000002
2606check_async 4 OFPPR_ADD OFPPR_DELETE
2607
2608# Use NXT_SET_ASYNC_CONFIG to enable a patchwork of asynchronous messages.
2609ovs-appctl -t ovs-ofctl ofctl/send 01040028000000020000232000000013000000020000000500000005000000020000000200000005
2610check_async 5 OFPR_INVALID_TTL OFPPR_DELETE OFPRR_DELETE
2611
a7349929
BP
2612# Set controller ID 123.
2613ovs-appctl -t ovs-ofctl ofctl/send 01040018000000030000232000000014000000000000007b
2614check_async 6 OFPR_NO_MATCH OFPPR_DELETE OFPRR_DELETE
2615
2616# Restore controller ID 0.
2617ovs-appctl -t ovs-ofctl ofctl/send 010400180000000300002320000000140000000000000000
2618
80d5aefd
BP
2619# Become master.
2620ovs-appctl -t ovs-ofctl ofctl/send 0104001400000002000023200000000a00000001
a7349929 2621check_async 7 OFPR_ACTION OFPPR_ADD
80d5aefd
BP
2622
2623ovs-appctl -t ovs-ofctl exit
94c33672 2624OVS_VSWITCHD_STOP
80d5aefd 2625AT_CLEANUP
751c7785 2626
9dcd1c00
SH
2627AT_SETUP([ofproto - asynchronous message control (OpenFlow 1.2)])
2628OVS_VSWITCHD_START
2629AT_CHECK([ovs-ofctl -O OpenFlow12 monitor br0 --detach --no-chdir --pidfile])
2630check_async () {
2631 printf '\n\n--- check_async %d ---\n\n\n' $1
2632 INDEX=$1
2633 shift
2634
2635 ovs-appctl -t ovs-ofctl ofctl/barrier
2636 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
2637 : > expout
2638
2639 # OFPT_PACKET_IN, OFPR_ACTION (controller_id=0)
2640 ovs-ofctl -O OpenFlow12 -v packet-out br0 none controller '0001020304050010203040501234'
2641 if test X"$1" = X"OFPR_ACTION"; then shift;
2642 echo >>expout "OFPT_PACKET_IN (OF1.2): total_len=14 in_port=ANY (via action) data_len=14 (unbuffered)
e6d9ab56 2643vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1234"
9dcd1c00
SH
2644 fi
2645
2646 # OFPT_PACKET_IN, OFPR_NO_MATCH (controller_id=123)
2647 ovs-ofctl -O OpenFlow12 -v packet-out br0 none 'controller(reason=no_match,id=123)' '0001020304050010203040501234'
2648 if test X"$1" = X"OFPR_NO_MATCH"; then shift;
2649 echo >>expout "OFPT_PACKET_IN (OF1.2): total_len=14 in_port=ANY (via no_match) data_len=14 (unbuffered)
e6d9ab56 2650vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1234"
9dcd1c00
SH
2651 fi
2652
2653 # OFPT_PACKET_IN, OFPR_INVALID_TTL (controller_id=0)
fa8d9001 2654 ovs-ofctl -O OpenFlow12 packet-out br0 none dec_ttl '002583dfb4000026b98cb0f908004500003eb7e200000011339bac11370dac100002d7730035002b8f6d86fb0100000100000000000006626c702d7873066e696369726103636f6d00000f00'
9dcd1c00
SH
2655 if test X"$1" = X"OFPR_INVALID_TTL"; then shift;
2656 echo >>expout "OFPT_PACKET_IN (OF1.2): total_len=76 in_port=ANY (via invalid_ttl) data_len=76 (unbuffered)
e6d9ab56 2657udp,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
2658 fi
2659
2660 # OFPT_PORT_STATUS, OFPPR_ADD
2661 ovs-vsctl add-port br0 test -- set Interface test type=dummy
2662 if test X"$1" = X"OFPPR_ADD"; then shift;
2663 echo >>expout "OFPT_PORT_STATUS (OF1.2): ADD: ${INDEX}(test): addr:aa:55:aa:55:00:0x
2664 config: PORT_DOWN
2665 state: LINK_DOWN
2666 speed: 0 Mbps now, 0 Mbps max"
2667 fi
2668
2669 # OFPT_PORT_STATUS, OFPPR_DELETE
2670 ovs-vsctl del-port br0 test
2671 if test X"$1" = X"OFPPR_DELETE"; then shift;
2672 echo >>expout "OFPT_PORT_STATUS (OF1.2): DEL: ${INDEX}(test): addr:aa:55:aa:55:00:0x
2673 config: PORT_DOWN
2674 state: LINK_DOWN
2675 speed: 0 Mbps now, 0 Mbps max"
2676 fi
2677
2678 # OFPT_FLOW_REMOVED, OFPRR_DELETE
2679 ovs-ofctl -O OpenFlow12 add-flow br0 send_flow_rem,actions=drop
2680 ovs-ofctl -O OpenFlow12 --strict del-flows br0 ''
2681 if test X"$1" = X"OFPRR_DELETE"; then shift;
2682 echo >>expout "OFPT_FLOW_REMOVED (OF1.2): reason=delete table_id=0"
2683 fi
2684 AT_FAIL_IF([test X"$1" != X])
2685
a6d1a299 2686 sleep 1
9dcd1c00
SH
2687
2688 AT_CHECK(
2689 [[sed '
2690s/ (xid=0x[0-9a-fA-F]*)//
2691s/ *duration.*//
2692s/00:0.$/00:0x/' < monitor.log]],
2693 [0], [expout])
2694}
2695
2696# It's a service connection so initially there should be no async messages.
2697check_async 1
2698
2699# Set miss_send_len to 128, turning on packet-ins for our service connection.
2700ovs-appctl -t ovs-ofctl ofctl/send 0309000c0123456700000080
2701check_async 2 OFPR_ACTION OFPPR_ADD OFPPR_DELETE OFPRR_DELETE
2702
2703# Set miss_send_len to 128 and enable invalid_ttl.
2704ovs-appctl -t ovs-ofctl ofctl/send 0309000c0123456700040080
2705check_async 3 OFPR_ACTION OFPR_INVALID_TTL OFPPR_ADD OFPPR_DELETE OFPRR_DELETE
2706
6ea4776b
JR
2707# Become slave (OF 1.2), which should disable everything except port status.
2708ovs-appctl -t ovs-ofctl ofctl/send 031800180000000200000003000000000000000000000001
9dcd1c00
SH
2709check_async 4 OFPPR_ADD OFPPR_DELETE
2710
2711# Use NXT_SET_ASYNC_CONFIG to enable a patchwork of asynchronous messages.
2712ovs-appctl -t ovs-ofctl ofctl/send 03040028000000020000232000000013000000020000000500000005000000020000000200000005
2713check_async 5 OFPR_INVALID_TTL OFPPR_DELETE OFPRR_DELETE
2714
2715# Set controller ID 123.
2716ovs-appctl -t ovs-ofctl ofctl/send 03040018000000030000232000000014000000000000007b
2717check_async 6 OFPR_NO_MATCH OFPPR_DELETE OFPRR_DELETE
2718
2719# Restore controller ID 0.
2720ovs-appctl -t ovs-ofctl ofctl/send 030400180000000300002320000000140000000000000000
2721
6ea4776b
JR
2722# Become master (OF 1.2).
2723ovs-appctl -t ovs-ofctl ofctl/send 031800180000000400000002000000000000000000000002
9dcd1c00
SH
2724check_async 7 OFPR_ACTION OFPPR_ADD
2725
2726ovs-appctl -t ovs-ofctl exit
2727OVS_VSWITCHD_STOP
2728AT_CLEANUP
2729
b21eb1da
JR
2730AT_SETUP([ofproto - asynchronous message control (OpenFlow 1.3)])
2731OVS_VSWITCHD_START
2732AT_CHECK([ovs-ofctl -O OpenFlow13 monitor br0 --detach --no-chdir --pidfile])
2733check_async () {
2734 printf '\n\n--- check_async %d ---\n\n\n' $1
2735 INDEX=$1
2736 shift
2737
2738 ovs-appctl -t ovs-ofctl ofctl/barrier
2739 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
2740 : > expout
2741
2742 # OFPT_PACKET_IN, OFPR_ACTION (controller_id=0)
2743 ovs-ofctl -O OpenFlow13 -v packet-out br0 none controller '0001020304050010203040501234'
2744 if test X"$1" = X"OFPR_ACTION"; then shift;
2745 echo >>expout "OFPT_PACKET_IN (OF1.3): total_len=14 in_port=ANY (via action) data_len=14 (unbuffered)
e6d9ab56 2746vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1234"
b21eb1da
JR
2747 fi
2748
2749 # OFPT_PACKET_IN, OFPR_NO_MATCH (controller_id=123)
2750 ovs-ofctl -O OpenFlow13 -v packet-out br0 none 'controller(reason=no_match,id=123)' '0001020304050010203040501234'
2751 if test X"$1" = X"OFPR_NO_MATCH"; then shift;
2752 echo >>expout "OFPT_PACKET_IN (OF1.3): total_len=14 in_port=ANY (via no_match) data_len=14 (unbuffered)
e6d9ab56 2753vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1234"
b21eb1da
JR
2754 fi
2755
2756 # OFPT_PACKET_IN, OFPR_INVALID_TTL (controller_id=0)
fa8d9001 2757 ovs-ofctl -O OpenFlow13 packet-out br0 none dec_ttl '002583dfb4000026b98cb0f908004500003eb7e200000011339bac11370dac100002d7730035002b8f6d86fb0100000100000000000006626c702d7873066e696369726103636f6d00000f00'
b21eb1da
JR
2758 if test X"$1" = X"OFPR_INVALID_TTL"; then shift;
2759 echo >>expout "OFPT_PACKET_IN (OF1.3): total_len=76 in_port=ANY (via invalid_ttl) data_len=76 (unbuffered)
e6d9ab56 2760udp,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
2761 fi
2762
2763 # OFPT_PORT_STATUS, OFPPR_ADD
2764 ovs-vsctl add-port br0 test -- set Interface test type=dummy
2765 if test X"$1" = X"OFPPR_ADD"; then shift;
2766 echo >>expout "OFPT_PORT_STATUS (OF1.3): ADD: ${INDEX}(test): addr:aa:55:aa:55:00:0x
2767 config: PORT_DOWN
2768 state: LINK_DOWN
2769 speed: 0 Mbps now, 0 Mbps max"
2770 fi
2771
2772 # OFPT_PORT_STATUS, OFPPR_DELETE
2773 ovs-vsctl del-port br0 test
2774 if test X"$1" = X"OFPPR_DELETE"; then shift;
2775 echo >>expout "OFPT_PORT_STATUS (OF1.3): DEL: ${INDEX}(test): addr:aa:55:aa:55:00:0x
2776 config: PORT_DOWN
2777 state: LINK_DOWN
2778 speed: 0 Mbps now, 0 Mbps max"
2779 fi
2780
2781 # OFPT_FLOW_REMOVED, OFPRR_DELETE
2782 ovs-ofctl -O OpenFlow13 add-flow br0 send_flow_rem,actions=drop
2783 ovs-ofctl -O OpenFlow13 --strict del-flows br0 ''
2784 if test X"$1" = X"OFPRR_DELETE"; then shift;
2785 echo >>expout "OFPT_FLOW_REMOVED (OF1.3): reason=delete table_id=0"
2786 fi
cc40d06b
SH
2787
2788 # OFPT_FLOW_REMOVED, OFPRR_GROUP_DELETE
2789 ovs-ofctl -O OpenFlow13 add-group br0 group_id=1234,type=all,bucket=output:10
2790 ovs-ofctl -O OpenFlow13 add-flow br0 send_flow_rem,actions=group:1234
2791 ovs-ofctl -O OpenFlow13 --strict del-groups br0 group_id=1234
2792 if test X"$1" = X"OFPRR_DELETE"; then shift;
2793 echo >>expout "OFPT_FLOW_REMOVED (OF1.3): reason=gropu_delete table_id=0"
2794 fi
2795
b21eb1da
JR
2796 AT_FAIL_IF([test X"$1" != X])
2797
2798 ovs-appctl -t ovs-ofctl ofctl/barrier
2799 echo >>expout "OFPT_BARRIER_REPLY (OF1.3):"
2800
2801 AT_CHECK(
2802 [[sed '
2803s/ (xid=0x[0-9a-fA-F]*)//
2804s/ *duration.*//
2805s/00:0.$/00:0x/' < monitor.log]],
2806 [0], [expout])
2807}
2808
2809# It's a service connection so initially there should be no async messages.
2810check_async 1
2811
2812# Set miss_send_len to 128, turning on packet-ins for our service connection.
2813ovs-appctl -t ovs-ofctl ofctl/send 0409000c0123456700000080
2814check_async 2 OFPR_ACTION OFPPR_ADD OFPPR_DELETE OFPRR_DELETE
2815
2816# Become slave (OF 1.3), which should disable everything except port status.
2817ovs-appctl -t ovs-ofctl ofctl/send 041800180000000200000003000000000000000000000001
2818check_async 3 OFPPR_ADD OFPPR_DELETE
2819
2820# Use OF 1.3 OFPT_SET_ASYNC to enable a patchwork of asynchronous messages.
2821ovs-appctl -t ovs-ofctl ofctl/send 041c002000000002000000020000000500000005000000020000000200000005
2822check_async 4 OFPR_INVALID_TTL OFPPR_DELETE OFPRR_DELETE
2823
2824# Set controller ID 123.
2825ovs-appctl -t ovs-ofctl ofctl/send 04040018000000030000232000000014000000000000007b
2826check_async 5 OFPR_NO_MATCH OFPPR_DELETE OFPRR_DELETE
2827
2828# Restore controller ID 0.
2829ovs-appctl -t ovs-ofctl ofctl/send 040400180000000300002320000000140000000000000000
2830
2831# Become master (OF 1.3).
2832ovs-appctl -t ovs-ofctl ofctl/send 041800180000000400000002000000000000000000000002
2833check_async 6 OFPR_ACTION OFPPR_ADD
2834
2835ovs-appctl -t ovs-ofctl exit
2836OVS_VSWITCHD_STOP
2837AT_CLEANUP
2838
98090482
NR
2839AT_SETUP([ofproto - asynchronous message control (OpenFlow 1.4)])
2840OVS_VSWITCHD_START
2841AT_CHECK([ovs-ofctl -O OpenFlow14 monitor br0 --detach --no-chdir --pidfile])
2842check_async () {
2843 printf '\n\n--- check_async %d ---\n\n\n' $1
2844 INDEX=$1
2845 shift
2846
2847 ovs-appctl -t ovs-ofctl ofctl/barrier
2848 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
2849 : > expout
2850
2851 # OFPT_PACKET_IN, OFPR_ACTION (controller_id=0)
2852 ovs-ofctl -O OpenFlow14 -v packet-out br0 none controller '0001020304050010203040501234'
2853 if test X"$1" = X"OFPR_ACTION"; then shift;
2854 echo >>expout "OFPT_PACKET_IN (OF1.4): total_len=14 in_port=ANY (via action) data_len=14 (unbuffered)
2855vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1234"
2856 fi
2857
2858 # OFPT_PACKET_IN, OFPR_NO_MATCH (controller_id=123)
2859 ovs-ofctl -O OpenFlow14 -v packet-out br0 none 'controller(reason=no_match,id=123)' '0001020304050010203040501234'
2860 if test X"$1" = X"OFPR_NO_MATCH"; then shift;
2861 echo >>expout "OFPT_PACKET_IN (OF1.4): total_len=14 in_port=ANY (via no_match) data_len=14 (unbuffered)
2862vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1234"
2863 fi
2864
2865 # OFPT_PACKET_IN, OFPR_INVALID_TTL (controller_id=0)
2866 ovs-ofctl -O OpenFlow14 packet-out br0 none dec_ttl '002583dfb4000026b98cb0f908004500003eb7e200000011339bac11370dac100002d7730035002b8f6d86fb0100000100000000000006626c702d7873066e696369726103636f6d00000f00'
2867 if test X"$1" = X"OFPR_INVALID_TTL"; then shift;
2868 echo >>expout "OFPT_PACKET_IN (OF1.4): total_len=76 in_port=ANY (via invalid_ttl) data_len=76 (unbuffered)
2869udp,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"
2870 fi
2871
2872# OFPT_PORT_STATUS, OFPPR_ADD
2873 ovs-vsctl add-port br0 test -- set Interface test type=dummy
2874 if test X"$1" = X"OFPPR_ADD"; then shift;
2875 echo >>expout "OFPT_PORT_STATUS (OF1.4): ADD: ${INDEX}(test): addr:aa:55:aa:55:00:0x
2876 config: PORT_DOWN
2877 state: LINK_DOWN
2878 speed: 0 Mbps now, 0 Mbps max"
2879 fi
2880
2881 # OFPT_PORT_STATUS, OFPPR_MODIFY
2882 ovs-ofctl -O OpenFlow14 -vwarn mod-port br0 test up
2883 if test X"$1" = X"OFPPR_MODIFY"; then shift;
2884 echo >>expout "OFPT_PORT_STATUS (OF1.4): MOD: ${INDEX}(test): addr:aa:55:aa:55:00:0x
2885 config: 0
2886 state: LINK_DOWN
2887 speed: 0 Mbps now, 0 Mbps max
2888OFPT_PORT_STATUS (OF1.4): MOD: ${INDEX}(test): addr:aa:55:aa:55:00:0x
2889 config: 0
2890 state: 0
2891 speed: 0 Mbps now, 0 Mbps max"
2892 fi
2893
2894 # OFPT_PORT_STATUS, OFPPR_DELETE
2895 ovs-vsctl del-port br0 test
2896 if test X"$1" = X"OFPPR_DELETE"; then shift;
2897 echo >>expout "OFPT_PORT_STATUS (OF1.4): DEL: ${INDEX}(test): addr:aa:55:aa:55:00:0x
2898 config: 0
2899 state: 0
2900 speed: 0 Mbps now, 0 Mbps max"
2901 fi
2902
2903 # OFPT_FLOW_REMOVED, OFPRR_DELETE
2904 ovs-ofctl -O OpenFlow14 add-flow br0 send_flow_rem,actions=drop
2905 ovs-ofctl -O OpenFlow14 --strict del-flows br0 ''
2906 if test X"$1" = X"OFPRR_DELETE"; then shift;
2907 echo >>expout "OFPT_FLOW_REMOVED (OF1.4): reason=delete table_id=0"
2908 fi
2909
2910 # OFPT_FLOW_REMOVED, OFPRR_GROUP_DELETE
2911 ovs-ofctl -O OpenFlow14 add-group br0 group_id=1234,type=all,bucket=output:10
2912 ovs-ofctl -O OpenFlow14 add-flow br0 send_flow_rem,actions=group:1234
2913 ovs-ofctl -O OpenFlow14 --strict del-groups br0 group_id=1234
2914 if test X"$1" = X"OFPRR_GROUP_DELETE"; then shift;
2915 echo >>expout "OFPT_FLOW_REMOVED (OF1.4): reason=group_delete table_id=0"
2916 fi
2917
2918 AT_FAIL_IF([test X"$1" != X])
2919
2920 ovs-appctl -t ovs-ofctl ofctl/barrier
2921 echo >>expout "OFPT_BARRIER_REPLY (OF1.4):"
2922
2923 AT_CHECK(
2924 [[sed '
2925s/ (xid=0x[0-9a-fA-F]*)//
2926s/ *duration.*//
2927s/00:0.$/00:0x/' < monitor.log]],
2928 [0], [expout])
2929}
2930
2931# It's a service connection so initially there should be no async messages.
2932check_async 1
2933
2934# Set miss_send_len to 128, turning on packet-ins for our service connection.
2935ovs-appctl -t ovs-ofctl ofctl/send 0509000c0123456700000080
2936check_async 2 OFPR_ACTION OFPPR_ADD OFPPR_MODIFY OFPPR_DELETE OFPRR_DELETE OFPRR_GROUP_DELETE
2937
2938# Become slave (OF 1.4), which should disable everything except port status.
2939ovs-appctl -t ovs-ofctl ofctl/send 051800180000000200000003000000000000000000000001
2940check_async 3 OFPPR_ADD OFPPR_MODIFY OFPPR_DELETE
2941
2942# Use OF 1.4 OFPT_SET_ASYNC to enable a patchwork of asynchronous messages.
2943ovs-appctl -t ovs-ofctl ofctl/send 051c0038000000020000000800000005000100080000000200020008000000020003000800000005000400080000001c0005000800000005
2944check_async 4 OFPR_INVALID_TTL OFPPR_DELETE OFPRR_DELETE OFPRR_GROUP_DELETE
2945
2946# Set controller ID 123.
2947ovs-appctl -t ovs-ofctl ofctl/send 05040018000000030000232000000014000000000000007b
2948check_async 5 OFPR_NO_MATCH OFPPR_DELETE OFPRR_DELETE OFPRR_GROUP_DELETE
2949
2950# Restore controller ID 0.
2951ovs-appctl -t ovs-ofctl ofctl/send 050400180000000300002320000000140000000000000000
2952
2953# Become master (OF 1.4).
2954ovs-appctl -t ovs-ofctl ofctl/send 051800180000000400000002000000000000000000000002
2955check_async 6 OFPR_ACTION OFPPR_ADD OFPPR_MODIFY OFPRR_DELETE
2956
2957ovs-appctl -t ovs-ofctl exit
2958OVS_VSWITCHD_STOP
2959AT_CLEANUP
2960
ebeae5db
JT
2961AT_SETUP([ofproto - asynchronous message control (OpenFlow 1.5)])
2962OVS_VSWITCHD_START
2963AT_CHECK([ovs-ofctl -O OpenFlow15 monitor br0 --detach --no-chdir --pidfile])
2964check_async () {
2965 printf '\n\n--- check_async %d ---\n\n\n' $1
2966 INDEX=$1
2967 shift
2968
2969 ovs-appctl -t ovs-ofctl ofctl/barrier
2970 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
2971 : > expout
2972
2973 # Other tests are not working with OF 1.5, and message
2974 # format may change, so leave them out.
2975
2976 # OFPT_PORT_STATUS, OFPPR_ADD
2977 ovs-vsctl add-port br0 test -- set Interface test type=dummy
2978 if test X"$1" = X"OFPPR_ADD"; then shift;
2979 echo >>expout "OFPT_PORT_STATUS (OF1.5): ADD: ${INDEX}(test): addr:aa:55:aa:55:00:0x
2980 config: PORT_DOWN
2981 state: LINK_DOWN
2982 speed: 0 Mbps now, 0 Mbps max"
2983 fi
2984
2985 # OFPT_PORT_STATUS, OFPPR_MODIFY
2986 ovs-ofctl -O OpenFlow15 -vwarn mod-port br0 test up
2987 if test X"$1" = X"OFPPR_MODIFY"; then shift;
2988 echo >>expout "OFPT_PORT_STATUS (OF1.5): MOD: ${INDEX}(test): addr:aa:55:aa:55:00:0x
2989 config: 0
2990 state: LINK_DOWN
2991 speed: 0 Mbps now, 0 Mbps max
2992OFPT_PORT_STATUS (OF1.5): MOD: 2(test): addr:aa:55:aa:55:00:0x
2993 config: 0
2994 state: 0
2995 speed: 0 Mbps now, 0 Mbps max"
2996 fi
2997
2998 # OFPT_PORT_STATUS, OFPPR_DELETE
2999 ovs-vsctl del-port br0 test
3000 if test X"$1" = X"OFPPR_DELETE"; then shift;
3001 echo >>expout "OFPT_PORT_STATUS (OF1.5): DEL: ${INDEX}(test): addr:aa:55:aa:55:00:0x
3002 config: 0
3003 state: 0
3004 speed: 0 Mbps now, 0 Mbps max"
3005 fi
3006
3007 AT_FAIL_IF([test X"$1" != X])
3008
3009 ovs-appctl -t ovs-ofctl ofctl/barrier
3010 echo >>expout "OFPT_BARRIER_REPLY (OF1.5):"
3011
3012 AT_CHECK(
3013 [[sed '
3014s/ (xid=0x[0-9a-fA-F]*)//
3015s/ *duration.*//
3016s/00:0.$/00:0x/' < monitor.log]],
3017 [0], [expout])
3018}
3019
3020# It's a service connection so initially there should be no async messages.
3021check_async 1
3022
3023# If we don't set this, async messages are not received.
3024# Set miss_send_len to 128, turning on packet-ins for our service connection.
3025ovs-appctl -t ovs-ofctl ofctl/send 0609000c0123456700000080
3026check_async 2 OFPPR_ADD OFPPR_MODIFY OFPPR_DELETE
3027
3028# Set-async has changed in OF 1.4 and is not yet implemented.
3029
3030ovs-appctl -t ovs-ofctl exit
3031OVS_VSWITCHD_STOP
3032AT_CLEANUP
3033
6ea4776b
JR
3034dnl This test checks that the role request/response messaging works
3035dnl and that generation_id is handled properly.
3036AT_SETUP([ofproto - controller role (OpenFlow 1.2)])
3037OVS_VSWITCHD_START
53eb8cb8 3038on_exit 'kill `cat c1.pid c2.pid`'
6751a4b4
BP
3039
3040# Start two ovs-ofctl controller processes.
3041AT_CAPTURE_FILE([monitor1.log])
3042AT_CAPTURE_FILE([expout1])
3043AT_CAPTURE_FILE([experr1])
3044AT_CAPTURE_FILE([monitor2.log])
3045AT_CAPTURE_FILE([expout2])
3046AT_CAPTURE_FILE([experr2])
3047for i in 1 2; do
3048 AT_CHECK([ovs-ofctl -O OpenFlow12 monitor br0 --detach --no-chdir --pidfile=`pwd`/c$i.pid --unixctl=`pwd`/c$i])
3049 ovs-appctl -t `pwd`/c$i ofctl/barrier
3050 ovs-appctl -t `pwd`/c$i ofctl/set-output-file monitor$i.log
3051 : > expout$i
3052 : > experr$i
3053
3054 # find out current role
3055 ovs-appctl -t `pwd`/c$i ofctl/send 031800180000000200000000000000000000000000000000
3056 echo >>experr$i "send: OFPT_ROLE_REQUEST (OF1.2): role=nochange"
3057 echo >>expout$i "OFPT_ROLE_REPLY (OF1.2): role=equal"
3058done
6ea4776b 3059
6751a4b4
BP
3060# controller 1: Become slave (generation_id is initially undefined, so
3061# 2^63+2 should not be stale)
3062ovs-appctl -t `pwd`/c1 ofctl/send 031800180000000300000003000000008000000000000002
3063echo >>experr1 "send: OFPT_ROLE_REQUEST (OF1.2): role=slave generation_id=9223372036854775810"
3064echo >>expout1 "OFPT_ROLE_REPLY (OF1.2): role=slave generation_id=9223372036854775810"
3065
3066# controller 2: Become master.
3067ovs-appctl -t `pwd`/c2 ofctl/send 031800180000000300000002000000008000000000000003
3068echo >>experr2 "send: OFPT_ROLE_REQUEST (OF1.2): role=master generation_id=9223372036854775811"
3069echo >>expout2 "OFPT_ROLE_REPLY (OF1.2): role=master generation_id=9223372036854775811"
3070
3071# controller 1: Try to become the master using a stale generation ID
3072ovs-appctl -t `pwd`/c1 ofctl/send 031800180000000400000002000000000000000000000003
3073echo >>experr1 "send: OFPT_ROLE_REQUEST (OF1.2): role=master generation_id=3"
3074echo >>expout1 "OFPT_ERROR (OF1.2): OFPRRFC_STALE"
3075echo >>expout1 "OFPT_ROLE_REQUEST (OF1.2): role=master generation_id=3"
3076
3077# controller 1: Become master using a valid generation ID
3078ovs-appctl -t `pwd`/c1 ofctl/send 031800180000000500000002000000000000000000000001
3079echo >>experr1 "send: OFPT_ROLE_REQUEST (OF1.2): role=master generation_id=1"
3080echo >>expout1 "OFPT_ROLE_REPLY (OF1.2): role=master generation_id=1"
3081
3082for i in 1 2; do
3083 ovs-appctl -t `pwd`/c$i ofctl/barrier
3084 echo >>expout$i "OFPT_BARRIER_REPLY (OF1.2):"
3085done
6ea4776b 3086
6751a4b4
BP
3087# Check output.
3088for i in 1 2; do
3089 cp expout$i expout
3090 AT_CHECK([grep -v '^send:' monitor$i.log | STRIP_XIDS], [0], [expout])
3091 cp experr$i expout
3092 AT_CHECK([grep '^send:' monitor$i.log | STRIP_XIDS], [0], [expout])
3093done
3094OVS_VSWITCHD_STOP
3095AT_CLEANUP
6ea4776b 3096
6751a4b4
BP
3097dnl This test checks that the role request/response messaging works,
3098dnl that generation_id is handled properly, and that role status update
3099dnl messages are sent when a controller's role gets changed from master
3100dnl to slave.
3101AT_SETUP([ofproto - controller role (OpenFlow 1.4)])
3102OVS_VSWITCHD_START
53eb8cb8 3103on_exit 'kill `cat c1.pid c2.pid`'
6751a4b4
BP
3104
3105# Start two ovs-ofctl controller processes.
3106AT_CAPTURE_FILE([monitor1.log])
3107AT_CAPTURE_FILE([expout1])
3108AT_CAPTURE_FILE([experr1])
3109AT_CAPTURE_FILE([monitor2.log])
3110AT_CAPTURE_FILE([expout2])
3111AT_CAPTURE_FILE([experr2])
3112for i in 1 2; do
3113 AT_CHECK([ovs-ofctl -O OpenFlow14 monitor br0 --detach --no-chdir --pidfile=`pwd`/c$i.pid --unixctl=`pwd`/c$i])
3114 ovs-appctl -t `pwd`/c$i ofctl/barrier
3115 ovs-appctl -t `pwd`/c$i ofctl/set-output-file monitor$i.log
3116 : > expout$i
3117 : > experr$i
3118
3119 # find out current role
3120 ovs-appctl -t `pwd`/c$i ofctl/send 051800180000000200000000000000000000000000000000
3121 echo >>experr$i "send: OFPT_ROLE_REQUEST (OF1.4): role=nochange"
3122 echo >>expout$i "OFPT_ROLE_REPLY (OF1.4): role=equal"
3123done
6ea4776b 3124
6751a4b4
BP
3125# controller 1: Become slave (generation_id is initially undefined, so
3126# 2^63+2 should not be stale)
3127ovs-appctl -t `pwd`/c1 ofctl/send 051800180000000300000003000000008000000000000002
3128echo >>experr1 "send: OFPT_ROLE_REQUEST (OF1.4): role=slave generation_id=9223372036854775810"
3129echo >>expout1 "OFPT_ROLE_REPLY (OF1.4): role=slave generation_id=9223372036854775810"
3130
3131# controller 2: Become master.
3132ovs-appctl -t `pwd`/c2 ofctl/send 051800180000000300000002000000008000000000000003
3133echo >>experr2 "send: OFPT_ROLE_REQUEST (OF1.4): role=master generation_id=9223372036854775811"
3134echo >>expout2 "OFPT_ROLE_REPLY (OF1.4): role=master generation_id=9223372036854775811"
3135
3136# controller 1: Try to become the master using a stale generation ID
3137ovs-appctl -t `pwd`/c1 ofctl/send 051800180000000400000002000000000000000000000003
3138echo >>experr1 "send: OFPT_ROLE_REQUEST (OF1.4): role=master generation_id=3"
3139echo >>expout1 "OFPT_ERROR (OF1.4): OFPRRFC_STALE"
3140echo >>expout1 "OFPT_ROLE_REQUEST (OF1.4): role=master generation_id=3"
3141
3142# controller 1: Become master using a valid generation ID
3143ovs-appctl -t `pwd`/c1 ofctl/send 051800180000000500000002000000000000000000000001
3144echo >>experr1 "send: OFPT_ROLE_REQUEST (OF1.4): role=master generation_id=1"
3145echo >>expout1 "OFPT_ROLE_REPLY (OF1.4): role=master generation_id=1"
3146echo >>expout2 "OFPT_ROLE_STATUS (OF1.4): role=slave generation_id=1 reason=master_request"
3147
3148for i in 1 2; do
3149 ovs-appctl -t `pwd`/c$i ofctl/barrier
3150 echo >>expout$i "OFPT_BARRIER_REPLY (OF1.4):"
3151done
6ea4776b 3152
6751a4b4
BP
3153# Check output.
3154for i in 1 2; do
3155 cp expout$i expout
3156 AT_CHECK([grep -v '^send:' monitor$i.log | STRIP_XIDS], [0], [expout])
3157 cp experr$i expout
3158 AT_CHECK([grep '^send:' monitor$i.log | STRIP_XIDS], [0], [expout])
3159done
6ea4776b
JR
3160OVS_VSWITCHD_STOP
3161AT_CLEANUP
3162
3c35db62
NR
3163dnl This test checks the Group and meter notifications when a group mod
3164dnl command is sent from one controller and the reply is received by
3165dnl other controllers.
3166AT_SETUP([ofproto - requestforward (OpenFlow 1.4)])
3167OVS_VSWITCHD_START
3168on_exit 'kill `cat c1.pid c2.pid c3.pid`'
3169
3170# Start two ovs-ofctl controller processes.
3171AT_CAPTURE_FILE([monitor1.log])
3172AT_CAPTURE_FILE([expout1])
3173AT_CAPTURE_FILE([monitor2.log])
3174AT_CAPTURE_FILE([expout2])
3175AT_CAPTURE_FILE([monitor3.log])
3176AT_CAPTURE_FILE([expout3])
3177
3178ovs-ofctl -O OpenFlow15 monitor br0 --detach --no-chdir --pidfile=`pwd`/c1.pid --unixctl=`pwd`/c1
3179ovs-ofctl -O OpenFlow14 monitor br0 --detach --no-chdir --pidfile=`pwd`/c2.pid --unixctl=`pwd`/c2
3180ovs-ofctl -O OpenFlow14 monitor br0 --detach --no-chdir --pidfile=`pwd`/c3.pid --unixctl=`pwd`/c3
3181
3182check_async () {
3183 for i in 1 3; do
3184 ovs-appctl -t `pwd`/c$i ofctl/barrier
3185 ovs-appctl -t `pwd`/c$i ofctl/set-output-file monitor$i.log
3186 : > expout$i
3187 done
3188
3189 printf '\n\n--- check_async %d ---\n\n\n' $1
3190 INDEX=$1
3191 shift
3192
3193 # OFPGC_ADD
63eded98 3194 ovs-appctl -t `pwd`/c2 ofctl/send "050f0020000000020000000000000001 00100000 ffffffffffffffff 00000000"
3c35db62
NR
3195 if test X"$1" = X"OFPGC_ADD"; then shift;
3196 echo >>expout2 "send: OFPT_GROUP_MOD (OF1.4):
63eded98 3197 ADD group_id=1,type=all,bucket=actions=drop"
3c35db62 3198 echo >>expout1 "OFPT_REQUESTFORWARD (OF1.5): reason=group_mod
63eded98 3199 ADD group_id=1,type=all,bucket=bucket_id:0,actions=drop"
3c35db62 3200 echo >>expout3 "OFPT_REQUESTFORWARD (OF1.4): reason=group_mod
63eded98 3201 ADD group_id=1,type=all,bucket=actions=drop"
3c35db62
NR
3202 fi
3203
3204 # OFPGC_MODIFY
63eded98 3205 ovs-appctl -t `pwd`/c2 ofctl/send "050f0020000000020001010000000001 00100000 ffffffffffffffff 00000000"
3c35db62
NR
3206 if test X"$1" = X"OFPGC_MODIFY"; then shift;
3207 echo >>expout2 "send: OFPT_GROUP_MOD (OF1.4):
63eded98 3208 MOD group_id=1,type=select,bucket=weight:0,actions=drop"
3c35db62 3209 echo >>expout1 "OFPT_REQUESTFORWARD (OF1.5): reason=group_mod
63eded98 3210 MOD group_id=1,type=select,bucket=bucket_id:0,weight:0,actions=drop"
3c35db62 3211 echo >>expout3 "OFPT_REQUESTFORWARD (OF1.4): reason=group_mod
63eded98 3212 MOD group_id=1,type=select,bucket=weight:0,actions=drop"
3c35db62
NR
3213 fi
3214
3215 ovs-appctl -t `pwd`/c1 ofctl/barrier
3216 echo >>expout1 "OFPT_BARRIER_REPLY (OF1.5):"
3217 ovs-appctl -t `pwd`/c2 ofctl/barrier
3218 echo >>expout2 "OFPT_BARRIER_REPLY (OF1.4):"
3219 ovs-appctl -t `pwd`/c3 ofctl/barrier
3220 echo >>expout3 "OFPT_BARRIER_REPLY (OF1.4):"
3221
3222 # Check output.
3223 for i in 1 3; do
3224 cp expout$i expout
3225 AT_CHECK(
3226 [[sed '
3227s/ (xid=0x[0-9a-fA-F]*)//'< monitor$i.log]],
3228 [0], [expout])
3229 done
3230}
3231
3232# controller 1: Become slave
3233ovs-appctl -t `pwd`/c1 ofctl/send 061800180000000300000003000000008000000000000002
3234
3235# controller 2: Become master
3236ovs-appctl -t `pwd`/c2 ofctl/send 051800180000000300000002000000008000000000000003
3237
3238# controller 1: Become slave
3239ovs-appctl -t `pwd`/c3 ofctl/send 051800180000000300000003000000008000000000000004
3240
3241# controller 1: Enabled requestforward using set Asynchronous message
3242ovs-appctl -t `pwd`/c1 ofctl/send 061c00280000000200000008000000050002000800000002000400080000001a000a000800000003
3243
3244# controller 2: Enabled requestforward using set Asynchronous message
3245ovs-appctl -t `pwd`/c2 ofctl/send 051c002800000002000100080000000200030008000000050005000800000005000b000800000003
3246
3247# controller 1: Enabled requestforward using set Asynchronous message
3248ovs-appctl -t `pwd`/c3 ofctl/send 051c00280000000200000008000000050002000800000002000400080000001a000a000800000003
3249check_async 1 OFPGC_ADD OFPGC_MODIFY
3250
3251OVS_VSWITCHD_STOP
3252AT_CLEANUP
3253
751c7785
BP
3254dnl This test checks that OFPT_PACKET_OUT accepts both OFPP_NONE (as
3255dnl specified by OpenFlow 1.0) and OFPP_CONTROLLER (used by some
3256dnl controllers despite the spec) as meaning a packet that was generated
3257dnl by the controller.
9dcd1c00 3258AT_SETUP([ofproto - packet-out from controller (OpenFlow 1.0)])
751c7785 3259OVS_VSWITCHD_START
586ddea5 3260ADD_OF_PORTS([br0], [1])
751c7785
BP
3261
3262# Start a monitor listening for packet-ins.
3263AT_CHECK([ovs-ofctl -P openflow10 monitor br0 --detach --no-chdir --pidfile])
3264ovs-appctl -t ovs-ofctl ofctl/send 0109000c0123456700000080
3265ovs-appctl -t ovs-ofctl ofctl/barrier
3266ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
3267AT_CAPTURE_FILE([monitor.log])
3268
3269# Send some packet-outs with OFPP_NONE and OFPP_CONTROLLER (65533) as in_port.
586ddea5
BP
3270AT_CHECK([ovs-ofctl packet-out br0 none controller,1 '0001020304050010203040501234'])
3271AT_CHECK([ovs-ofctl packet-out br0 controller controller,1 '0001020304050010203040505678'])
751c7785
BP
3272
3273# Stop the monitor and check its output.
3274ovs-appctl -t ovs-ofctl ofctl/barrier
3275ovs-appctl -t ovs-ofctl exit
3276
586ddea5
BP
3277ovs-ofctl dump-ports br0
3278
751c7785 3279AT_CHECK([sed 's/ (xid=0x[[0-9a-fA-F]]*)//' monitor.log], [0], [dnl
7f05e7ab 3280OFPT_PACKET_IN: total_len=14 in_port=ANY (via action) data_len=14 (unbuffered)
e6d9ab56 3281vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1234
751c7785 3282OFPT_PACKET_IN: total_len=14 in_port=CONTROLLER (via action) data_len=14 (unbuffered)
e6d9ab56 3283vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x5678
969fc56c
JS
3284OFPT_BARRIER_REPLY:
3285])
3286
3287OVS_VSWITCHD_STOP
3288AT_CLEANUP
3289
9dcd1c00
SH
3290dnl This test checks that OFPT_PACKET_OUT accepts both OFPP_NONE (as
3291dnl specified by OpenFlow 1.2) and OFPP_CONTROLLER (used by some
3292dnl controllers despite the spec) as meaning a packet that was generated
3293dnl by the controller.
3294AT_SETUP([ofproto - packet-out from controller (OpenFlow 1.2)])
3295OVS_VSWITCHD_START
3296
3297# Start a monitor listening for packet-ins.
3298AT_CHECK([ovs-ofctl -O OpenFlow12 monitor br0 --detach --no-chdir --pidfile])
3299ovs-appctl -t ovs-ofctl ofctl/send 0309000c0123456700000080
3300ovs-appctl -t ovs-ofctl ofctl/barrier
3301ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
3302AT_CAPTURE_FILE([monitor.log])
3303
3304# Send some packet-outs with OFPP_NONE and OFPP_CONTROLLER (65533) as in_port.
3305AT_CHECK([ovs-ofctl -O OpenFlow12 packet-out br0 none controller '0001020304050010203040501234'])
3306AT_CHECK([ovs-ofctl -O OpenFlow12 packet-out br0 4294967293 controller '0001020304050010203040505678'])
3307
3308# Stop the monitor and check its output.
3309ovs-appctl -t ovs-ofctl ofctl/barrier
3310ovs-appctl -t ovs-ofctl exit
3311
3312AT_CHECK([sed 's/ (xid=0x[[0-9a-fA-F]]*)//' monitor.log], [0], [dnl
3313OFPT_PACKET_IN (OF1.2): total_len=14 in_port=ANY (via action) data_len=14 (unbuffered)
e6d9ab56 3314vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1234
9dcd1c00 3315OFPT_PACKET_IN (OF1.2): total_len=14 in_port=CONTROLLER (via action) data_len=14 (unbuffered)
e6d9ab56 3316vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x5678
9dcd1c00
SH
3317OFPT_BARRIER_REPLY (OF1.2):
3318])
3319
3320OVS_VSWITCHD_STOP
3321AT_CLEANUP
3322
4d197ebb
BP
3323dnl This test checks that OFPT_PACKET_OUT accepts both OFPP_NONE (as
3324dnl specified by OpenFlow 1.1) and OFPP_CONTROLLER (used by some
3325dnl controllers despite the spec) as meaning a packet that was generated
3326dnl by the controller.
3327AT_SETUP([ofproto - packet-out from controller (OpenFlow 1.1)])
3328OVS_VSWITCHD_START
3329
3330# Start a monitor listening for packet-ins.
3331AT_CHECK([ovs-ofctl -O OpenFlow11 monitor br0 --detach --no-chdir --pidfile])
3332ovs-appctl -t ovs-ofctl ofctl/send 0209000c0123456700000080
3333ovs-appctl -t ovs-ofctl ofctl/barrier
3334ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
3335AT_CAPTURE_FILE([monitor.log])
3336
3337# Send some packet-outs with OFPP_NONE and OFPP_CONTROLLER (65533) as in_port.
3338AT_CHECK([ovs-ofctl -O OpenFlow11 packet-out br0 none controller '0001020304050010203040501234'])
3339AT_CHECK([ovs-ofctl -O OpenFlow11 packet-out br0 4294967293 controller '0001020304050010203040505678'])
3340
3341# Stop the monitor and check its output.
3342ovs-appctl -t ovs-ofctl ofctl/barrier
3343ovs-appctl -t ovs-ofctl exit
3344
3345AT_CHECK([sed 's/ (xid=0x[[0-9a-fA-F]]*)//' monitor.log], [0], [dnl
3346OFPT_PACKET_IN (OF1.1): total_len=14 in_port=ANY (via action) data_len=14 (unbuffered)
e6d9ab56 3347vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1234
4d197ebb 3348OFPT_PACKET_IN (OF1.1): total_len=14 in_port=CONTROLLER (via action) data_len=14 (unbuffered)
e6d9ab56 3349vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x5678
4d197ebb
BP
3350OFPT_BARRIER_REPLY (OF1.1):
3351])
3352
3353OVS_VSWITCHD_STOP
3354AT_CLEANUP
3355
969fc56c
JS
3356dnl This test checks that metadata is encoded in packet_in structures,
3357dnl supported by NXAST.
3358AT_SETUP([ofproto - packet-out with metadata (NXM)])
3359OVS_VSWITCHD_START
3360
3361# Start a monitor listening for packet-ins.
3362AT_CHECK([ovs-ofctl -P nxm monitor br0 --detach --no-chdir --pidfile])
3363ovs-appctl -t ovs-ofctl ofctl/send 0109000c0123456700000080
3364ovs-appctl -t ovs-ofctl ofctl/barrier
3365ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
3366AT_CAPTURE_FILE([monitor.log])
3367
3368# Send a packet-out with a load action to set some metadata, and forward to controller
ac923e91 3369AT_CHECK([ovs-ofctl packet-out br0 controller 'load(0xfafafafa5a5a5a5a->OXM_OF_METADATA[[0..63]]), load(0xaa->NXM_NX_PKT_MARK[[]]), controller' '0001020304050010203040501234'])
969fc56c
JS
3370
3371# Stop the monitor and check its output.
3372ovs-appctl -t ovs-ofctl ofctl/barrier
3373ovs-appctl -t ovs-ofctl exit
3374
3375AT_CHECK([sed 's/ (xid=0x[[0-9a-fA-F]]*)//' monitor.log], [0], [dnl
50dcbd8e 3376NXT_PACKET_IN: total_len=14 pkt_mark=0xaa,metadata=0xfafafafa5a5a5a5a,in_port=CONTROLLER (via action) data_len=14 (unbuffered)
e6d9ab56 3377vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1234
751c7785
BP
3378OFPT_BARRIER_REPLY:
3379])
3380
3381OVS_VSWITCHD_STOP
3382AT_CLEANUP
2b07c8b1 3383
9dcd1c00
SH
3384dnl This test checks that metadata is encoded in packet_in structures,
3385dnl supported by NXAST.
3386AT_SETUP([ofproto - packet-out with metadata (OpenFlow 1.2)])
3387OVS_VSWITCHD_START
3388
3389# Start a monitor listening for packet-ins.
3390AT_CHECK([ovs-ofctl -O OpenFlow12 monitor br0 --detach --no-chdir --pidfile])
3391ovs-appctl -t ovs-ofctl ofctl/send 0309000c0123456700000080
3392ovs-appctl -t ovs-ofctl ofctl/barrier
3393ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
3394AT_CAPTURE_FILE([monitor.log])
3395
277876e9
JT
3396# Send a packet-out with a set-field action to set some metadata, and forward to controller
3397AT_CHECK([ovs-ofctl -O OpenFlow12 packet-out br0 none 'set_field:0xfafafafa5a5a5a5a->metadata, controller' '0001020304050010203040501234'])
9dcd1c00
SH
3398
3399# Stop the monitor and check its output.
3400ovs-appctl -t ovs-ofctl ofctl/barrier
3401ovs-appctl -t ovs-ofctl exit
3402
3403AT_CHECK([sed 's/ (xid=0x[[0-9a-fA-F]]*)//' monitor.log], [0], [dnl
50dcbd8e 3404OFPT_PACKET_IN (OF1.2): total_len=14 metadata=0xfafafafa5a5a5a5a,in_port=ANY (via action) data_len=14 (unbuffered)
e6d9ab56 3405vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1234
0ad90c84
JR
3406OFPT_BARRIER_REPLY (OF1.2):
3407])
3408
3409OVS_VSWITCHD_STOP
3410AT_CLEANUP
3411
743c159b
JT
3412dnl This test checks that metadata is encoded in packet_in structures,
3413dnl supported by NXAST.
3414AT_SETUP([ofproto - packet-out with metadata and dual set_field (OpenFlow 1.3)])
3415OVS_VSWITCHD_START
3416
3417# Start a monitor listening for packet-ins.
3418AT_CHECK([ovs-ofctl -O OpenFlow13 monitor br0 --detach --no-chdir --pidfile])
3419ovs-appctl -t ovs-ofctl ofctl/send 0409000c0123456700000080
3420ovs-appctl -t ovs-ofctl ofctl/barrier
3421ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
3422AT_CAPTURE_FILE([monitor.log])
3423
3424# Send a packet-out with a couple of set-field action to set some metadata, and forward to controller
3425AT_CHECK([ovs-ofctl -O OpenFlow13 packet-out br0 none 'set_field:0xfafafafa5a5a5a5a->metadata, set_field:0x6b->metadata, controller' '0001020304050010203040501234'])
3426
3427# Stop the monitor and check its output.
3428ovs-appctl -t ovs-ofctl ofctl/barrier
3429ovs-appctl -t ovs-ofctl exit
3430
3431AT_CHECK([sed 's/ (xid=0x[[0-9a-fA-F]]*)//' monitor.log], [0], [dnl
50dcbd8e 3432OFPT_PACKET_IN (OF1.3): total_len=14 metadata=0x6b,in_port=ANY (via action) data_len=14 (unbuffered)
e6d9ab56 3433vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1234
743c159b
JT
3434OFPT_BARRIER_REPLY (OF1.3):
3435])
3436
3437OVS_VSWITCHD_STOP
3438AT_CLEANUP
3439
0ad90c84
JR
3440dnl This test checks that tunnel metadata is encoded in packet_in structures.
3441AT_SETUP([ofproto - packet-out with tunnel metadata (OpenFlow 1.2)])
3442OVS_VSWITCHD_START
3443
3444# Start a monitor listening for packet-ins.
3445AT_CHECK([ovs-ofctl -O OpenFlow12 monitor br0 --detach --no-chdir --pidfile])
3446ovs-appctl -t ovs-ofctl ofctl/send 0309000c0123456700000080
3447ovs-appctl -t ovs-ofctl ofctl/barrier
3448ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
3449AT_CAPTURE_FILE([monitor.log])
3450
3451# Send a packet-out with set field actions to set some tunnel metadata, and forward to controller
3452AT_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'])
3453
3454# Stop the monitor and check its output.
3455ovs-appctl -t ovs-ofctl ofctl/barrier
3456ovs-appctl -t ovs-ofctl exit
3457
3458AT_CHECK([sed 's/ (xid=0x[[0-9a-fA-F]]*)//' monitor.log], [0], [dnl
50dcbd8e 3459OFPT_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 3460vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1234
9dcd1c00
SH
3461OFPT_BARRIER_REPLY (OF1.2):
3462])
3463
3464OVS_VSWITCHD_STOP
3465AT_CLEANUP
3466
1637ebb2
SH
3467m4_divert_push([PREPARE_TESTS])
3468# Sorts groups of lines that start with a space, without moving them
3469# past the nearest line that does not start with a space.
3470multiline_sort () {
3471 ${PERL} -e '
3472 use warnings;
3473 use strict;
3474 my @buffer = ();
3475 while (<STDIN>) {
3476 if (/^ /) {
3477 push(@buffer, $_);
3478 } else {
3479 print $_ foreach sort(@buffer);
3480 print $_;
3481 @buffer = ();
3482 }
3483 }
3484 print $_ foreach sort(@buffer);
3485'
3486}
3487m4_divert_pop([PREPARE_TESTS])
3488
2b07c8b1
BP
3489AT_SETUP([ofproto - flow monitoring])
3490AT_KEYWORDS([monitor])
3491OVS_VSWITCHD_START
3492
3493ovs-ofctl add-flow br0 in_port=0,dl_vlan=123,actions=output:1
3494
3495# Start a monitor watching the flow table and check the initial reply.
3496ovs-ofctl monitor br0 watch: --detach --no-chdir --pidfile >monitor.log 2>&1
3497AT_CAPTURE_FILE([monitor.log])
3498ovs-appctl -t ovs-ofctl ofctl/barrier
3499AT_CHECK([sed 's/ (xid=0x[[1-9a-fA-F]][[0-9a-fA-F]]*)//' monitor.log], [0],
3500 [NXST_FLOW_MONITOR reply:
3501 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=123 actions=output:1
3502OFPT_BARRIER_REPLY:
3503])
3504
3505# Add, delete, and modify some flows and check the updates.
3506ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
3507ovs-ofctl add-flow br0 in_port=0,dl_vlan=124,actions=output:2
3508ovs-ofctl add-flow br0 in_port=0,dl_vlan=123,actions=output:5
95a1c4ca
SH
3509ovs-ofctl add-flow br0 in_port=0,dl_vlan=123,dl_vlan_pcp=0,actions=output:6
3510ovs-ofctl add-flow br0 in_port=0,dl_vlan=123,dl_vlan_pcp=1,actions=output:7
3511ovs-ofctl add-flow br0 in_port=0,dl_vlan=123,actions=output:8
3512ovs-ofctl add-flow br0 in_port=0,dl_vlan=65535,dl_vlan_pcp=0,actions=output:9
3513ovs-ofctl add-flow br0 in_port=0,dl_vlan=65535,dl_vlan_pcp=1,actions=output:10
3514ovs-ofctl add-flow br0 in_port=0,dl_vlan=65535,actions=output:11
3515ovs-ofctl add-flow br0 in_port=0,dl_vlan=8191,dl_vlan_pcp=0,actions=output:12
3516ovs-ofctl add-flow br0 in_port=0,dl_vlan=8191,dl_vlan_pcp=1,actions=output:13
3517ovs-ofctl add-flow br0 in_port=0,dl_vlan=8191,actions=output:14
3518ovs-ofctl add-flow br0 in_port=0,dl_vlan=0,dl_vlan_pcp=0,actions=output:15
3519ovs-ofctl add-flow br0 in_port=0,dl_vlan=0,dl_vlan_pcp=1,actions=output:16
3520ovs-ofctl add-flow br0 in_port=0,dl_vlan=0,actions=output:17
3521ovs-ofctl add-flow br0 in_port=0,dl_vlan=0,dl_vlan_pcp=0,actions=output:18
3522ovs-ofctl add-flow br0 in_port=0,dl_vlan=0,dl_vlan_pcp=1,actions=output:19
3523ovs-ofctl add-flow br0 in_port=0,dl_vlan=0,actions=output:20
3524ovs-ofctl add-flow br0 in_port=0,dl_vlan_pcp=0,actions=output:21
3525ovs-ofctl add-flow br0 in_port=0,dl_vlan_pcp=1,actions=output:22
3526ovs-ofctl add-flow br0 in_port=0,actions=output:23
ee088a75 3527ovs-ofctl mod-flows br0 dl_vlan=123,actions=output:3
2b07c8b1
BP
3528ovs-ofctl mod-flows br0 cookie=5,dl_vlan=123,actions=output:3
3529ovs-ofctl del-flows br0 dl_vlan=123
3530ovs-ofctl del-flows br0
3531ovs-appctl -t ovs-ofctl ofctl/barrier
1637ebb2 3532AT_CHECK([sed 's/ (xid=0x[[1-9a-fA-F]][[0-9a-fA-F]]*)//' monitor.log | multiline_sort], [0],
2b07c8b1
BP
3533[NXST_FLOW_MONITOR reply (xid=0x0):
3534 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=124 actions=output:2
3535NXST_FLOW_MONITOR reply (xid=0x0):
3536 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=123 actions=output:5
95a1c4ca
SH
3537NXST_FLOW_MONITOR reply (xid=0x0):
3538 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=123,dl_vlan_pcp=0 actions=output:6
3539NXST_FLOW_MONITOR reply (xid=0x0):
3540 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=123,dl_vlan_pcp=1 actions=output:7
3541NXST_FLOW_MONITOR reply (xid=0x0):
3542 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=123 actions=output:8
3543NXST_FLOW_MONITOR reply (xid=0x0):
3544 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=0,dl_vlan_pcp=0 actions=output:9
3545NXST_FLOW_MONITOR reply (xid=0x0):
3546 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=0,dl_vlan_pcp=1 actions=output:10
3547NXST_FLOW_MONITOR reply (xid=0x0):
3548 event=ADDED table=0 cookie=0 in_port=0,vlan_tci=0x0000 actions=output:11
3549NXST_FLOW_MONITOR reply (xid=0x0):
3550 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=4095,dl_vlan_pcp=0 actions=output:12
3551NXST_FLOW_MONITOR reply (xid=0x0):
3552 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=4095,dl_vlan_pcp=1 actions=output:13
3553NXST_FLOW_MONITOR reply (xid=0x0):
3554 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=4095 actions=output:14
3555NXST_FLOW_MONITOR reply (xid=0x0):
3556 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=0,dl_vlan_pcp=0 actions=output:15
3557NXST_FLOW_MONITOR reply (xid=0x0):
3558 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=0,dl_vlan_pcp=1 actions=output:16
3559NXST_FLOW_MONITOR reply (xid=0x0):
3560 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=0 actions=output:17
3561NXST_FLOW_MONITOR reply (xid=0x0):
3562 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=0,dl_vlan_pcp=0 actions=output:18
3563NXST_FLOW_MONITOR reply (xid=0x0):
3564 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=0,dl_vlan_pcp=1 actions=output:19
3565NXST_FLOW_MONITOR reply (xid=0x0):
3566 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=0 actions=output:20
3567NXST_FLOW_MONITOR reply (xid=0x0):
3568 event=ADDED table=0 cookie=0 in_port=0,dl_vlan_pcp=0 actions=output:21
3569NXST_FLOW_MONITOR reply (xid=0x0):
3570 event=ADDED table=0 cookie=0 in_port=0,dl_vlan_pcp=1 actions=output:22
3571NXST_FLOW_MONITOR reply (xid=0x0):
3572 event=ADDED table=0 cookie=0 in_port=0 actions=output:23
ee088a75
SH
3573NXST_FLOW_MONITOR reply (xid=0x0):
3574 event=MODIFIED table=0 cookie=0 in_port=0,dl_vlan=123 actions=output:3
3575 event=MODIFIED table=0 cookie=0 in_port=0,dl_vlan=123,dl_vlan_pcp=0 actions=output:3
3576 event=MODIFIED table=0 cookie=0 in_port=0,dl_vlan=123,dl_vlan_pcp=1 actions=output:3
2b07c8b1
BP
3577NXST_FLOW_MONITOR reply (xid=0x0):
3578 event=MODIFIED table=0 cookie=0x5 in_port=0,dl_vlan=123 actions=output:3
95a1c4ca
SH
3579 event=MODIFIED table=0 cookie=0x5 in_port=0,dl_vlan=123,dl_vlan_pcp=0 actions=output:3
3580 event=MODIFIED table=0 cookie=0x5 in_port=0,dl_vlan=123,dl_vlan_pcp=1 actions=output:3
2b07c8b1
BP
3581NXST_FLOW_MONITOR reply (xid=0x0):
3582 event=DELETED reason=delete table=0 cookie=0x5 in_port=0,dl_vlan=123 actions=output:3
95a1c4ca
SH
3583 event=DELETED reason=delete table=0 cookie=0x5 in_port=0,dl_vlan=123,dl_vlan_pcp=0 actions=output:3
3584 event=DELETED reason=delete table=0 cookie=0x5 in_port=0,dl_vlan=123,dl_vlan_pcp=1 actions=output:3
2b07c8b1 3585NXST_FLOW_MONITOR reply (xid=0x0):
32cd83a2 3586 event=DELETED reason=delete table=0 cookie=0 in_port=0 actions=output:23
95a1c4ca 3587 event=DELETED reason=delete table=0 cookie=0 in_port=0,dl_vlan=0 actions=output:20
32cd83a2
BP
3588 event=DELETED reason=delete table=0 cookie=0 in_port=0,dl_vlan=0,dl_vlan_pcp=0 actions=output:18
3589 event=DELETED reason=delete table=0 cookie=0 in_port=0,dl_vlan=0,dl_vlan_pcp=1 actions=output:19
2b07c8b1 3590 event=DELETED reason=delete table=0 cookie=0 in_port=0,dl_vlan=124 actions=output:2
95a1c4ca 3591 event=DELETED reason=delete table=0 cookie=0 in_port=0,dl_vlan=4095 actions=output:14
32cd83a2 3592 event=DELETED reason=delete table=0 cookie=0 in_port=0,dl_vlan=4095,dl_vlan_pcp=0 actions=output:12
95a1c4ca 3593 event=DELETED reason=delete table=0 cookie=0 in_port=0,dl_vlan=4095,dl_vlan_pcp=1 actions=output:13
32cd83a2
BP
3594 event=DELETED reason=delete table=0 cookie=0 in_port=0,dl_vlan_pcp=0 actions=output:21
3595 event=DELETED reason=delete table=0 cookie=0 in_port=0,dl_vlan_pcp=1 actions=output:22
95a1c4ca 3596 event=DELETED reason=delete table=0 cookie=0 in_port=0,vlan_tci=0x0000 actions=output:11
2b07c8b1
BP
3597OFPT_BARRIER_REPLY:
3598])
3599
200d6ac4
SH
3600# Check that our own changes are reported as full updates.
3601ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
3602ovs-ofctl add-flow br0 in_port=1,actions=output:2
3603ovs-ofctl add-flow br0 in_port=2,actions=output:1
3604ovs-appctl -t ovs-ofctl ofctl/barrier
3605ovs-appctl -t ovs-ofctl ofctl/send 010e004812345678003fffff00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003000000000000ffffffffffff0000
3606ovs-appctl -t ovs-ofctl ofctl/barrier
3607AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip], [0], [NXST_FLOW reply:
3608])
3609AT_CHECK([sed 's/ (xid=0x[[1-9a-fA-F]][[0-9a-fA-F]]*)//' monitor.log | multiline_sort], [0],
3610[NXST_FLOW_MONITOR reply (xid=0x0):
3611 event=ADDED table=0 cookie=0 in_port=1 actions=output:2
3612NXST_FLOW_MONITOR reply (xid=0x0):
3613 event=ADDED table=0 cookie=0 in_port=2 actions=output:1
3614OFPT_BARRIER_REPLY:
3615send: OFPT_FLOW_MOD: DEL priority=0 actions=drop
3616NXST_FLOW_MONITOR reply (xid=0x0):
3617 event=DELETED reason=delete table=0 cookie=0 in_port=1 actions=output:2
3618 event=DELETED reason=delete table=0 cookie=0 in_port=2 actions=output:1
3619OFPT_BARRIER_REPLY:
3620])
3621
3622ovs-appctl -t ovs-ofctl exit
3623OVS_VSWITCHD_STOP
3624AT_CLEANUP
3625
3626AT_SETUP([ofproto - flow monitoring with !own])
3627AT_KEYWORDS([monitor])
3628OVS_VSWITCHD_START
3629
3630ovs-ofctl add-flow br0 in_port=0,dl_vlan=123,actions=output:1
3631
3632# Start a monitor watching the flow table and check the initial reply.
3633ovs-ofctl monitor br0 watch:\!own --detach --no-chdir --pidfile >monitor.log 2>&1
3634AT_CAPTURE_FILE([monitor.log])
3635ovs-appctl -t ovs-ofctl ofctl/barrier
3636AT_CHECK([sed 's/ (xid=0x[[1-9a-fA-F]][[0-9a-fA-F]]*)//' monitor.log], [0],
3637 [NXST_FLOW_MONITOR reply:
3638 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=123 actions=output:1
3639OFPT_BARRIER_REPLY:
3640])
3641
2b07c8b1
BP
3642# Check that our own changes are reported as abbreviations.
3643ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
3644ovs-ofctl add-flow br0 in_port=1,actions=output:2
3645ovs-ofctl add-flow br0 in_port=2,actions=output:1
90d721f0 3646ovs-appctl -t ovs-ofctl ofctl/barrier
2b07c8b1
BP
3647ovs-appctl -t ovs-ofctl ofctl/send 010e004812345678003fffff00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003000000000000ffffffffffff0000
3648ovs-appctl -t ovs-ofctl ofctl/barrier
3649AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip], [0], [NXST_FLOW reply:
3650])
3651AT_CHECK([sed 's/ (xid=0x[[1-9a-fA-F]][[0-9a-fA-F]]*)//' monitor.log], [0],
3652[NXST_FLOW_MONITOR reply (xid=0x0):
3653 event=ADDED table=0 cookie=0 in_port=1 actions=output:2
3654NXST_FLOW_MONITOR reply (xid=0x0):
3655 event=ADDED table=0 cookie=0 in_port=2 actions=output:1
90d721f0 3656OFPT_BARRIER_REPLY:
2b07c8b1
BP
3657send: OFPT_FLOW_MOD: DEL priority=0 actions=drop
3658NXST_FLOW_MONITOR reply (xid=0x0):
3659 event=ABBREV xid=0x12345678
cdbdeeda
SH
3660OFPT_BARRIER_REPLY:
3661])
3662
3663ovs-appctl -t ovs-ofctl exit
3664OVS_VSWITCHD_STOP
3665AT_CLEANUP
3666
3667AT_SETUP([ofproto - flow monitoring with out_port])
3668AT_KEYWORDS([monitor])
3669OVS_VSWITCHD_START
3670
3671ovs-ofctl add-flow br0 in_port=0,dl_vlan=121,actions=output:1
3672ovs-ofctl add-flow br0 in_port=0,dl_vlan=122,actions=output:1
3673ovs-ofctl add-flow br0 in_port=0,dl_vlan=123,actions=output:2
3674
3675# Start a monitor watching the flow table and check the initial reply.
3676ovs-ofctl monitor br0 watch:out_port=2 --detach --no-chdir --pidfile >monitor.log 2>&1
3677AT_CAPTURE_FILE([monitor.log])
3678ovs-appctl -t ovs-ofctl ofctl/barrier
3679AT_CHECK([sed 's/ (xid=0x[[1-9a-fA-F]][[0-9a-fA-F]]*)//' monitor.log], [0],
3680 [NXST_FLOW_MONITOR reply:
3681 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=123 actions=output:2
3682OFPT_BARRIER_REPLY:
3683])
3684
3685ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
3686
3687# Add, modify flows and check the updates.
3688ovs-ofctl mod-flows br0 dl_vlan=121,actions=drop
3689ovs-ofctl mod-flows br0 dl_vlan=122,actions=output:1,output:2
3690ovs-appctl -t ovs-ofctl ofctl/barrier
3691
3692ovs-ofctl mod-flows br0 dl_vlan=123,actions=output:1,output:2
3693ovs-appctl -t ovs-ofctl ofctl/barrier
3694
3695ovs-ofctl mod-flows br0 dl_vlan=122,actions=output:1
3696ovs-appctl -t ovs-ofctl ofctl/barrier
3697ovs-ofctl mod-flows br0 dl_vlan=123,actions=output:2
3698ovs-appctl -t ovs-ofctl ofctl/barrier
3699
3700AT_CHECK([sed 's/ (xid=0x[[1-9a-fA-F]][[0-9a-fA-F]]*)//' monitor.log], [0],
3701[NXST_FLOW_MONITOR reply (xid=0x0):
3702 event=MODIFIED table=0 cookie=0 in_port=0,dl_vlan=122 actions=output:1,output:2
3703OFPT_BARRIER_REPLY:
3704NXST_FLOW_MONITOR reply (xid=0x0):
3705 event=MODIFIED table=0 cookie=0 in_port=0,dl_vlan=123 actions=output:1,output:2
3706OFPT_BARRIER_REPLY:
3707NXST_FLOW_MONITOR reply (xid=0x0):
3708 event=MODIFIED table=0 cookie=0 in_port=0,dl_vlan=122 actions=output:1
3709OFPT_BARRIER_REPLY:
3710NXST_FLOW_MONITOR reply (xid=0x0):
3711 event=MODIFIED table=0 cookie=0 in_port=0,dl_vlan=123 actions=output:2
2b07c8b1
BP
3712OFPT_BARRIER_REPLY:
3713])
3714
3715ovs-appctl -t ovs-ofctl exit
3716OVS_VSWITCHD_STOP
3717AT_CLEANUP
3718
3719AT_SETUP([ofproto - flow monitoring pause and resume])
3720AT_KEYWORDS([monitor])
3721
46a80050
EM
3722# The maximum socket receive buffer size is important for this test, which
3723# tests behavior when the receive buffer overflows.
3724if test -e /proc/sys/net/core/rmem_max; then
3725 # Linux
3726 rmem_max=`cat /proc/sys/net/core/rmem_max`
3727elif rmem_max=`sysctl -n net.inet.tcp.recvbuf_max 2>/dev/null`; then
f3326eeb 3728 : # FreeBSD, NetBSD
46a80050
EM
3729else
3730 # Don't know how to get maximum socket receive buffer on this OS
3731 AT_SKIP_IF([:])
3732fi
2b07c8b1
BP
3733# Calculate the total amount of queuing: rmem_max in the kernel, 128 kB
3734# in ofproto sending userspace (see ofmonitor_flush() in connmgr.c).
2b07c8b1
BP
3735queue_size=`expr $rmem_max + 128 \* 1024`
3736echo rmem_max=$rmem_max queue_size=$queue_size
3737
21aa35c3
BP
3738# If there's too much queuing skip the test to avoid timing out.
3739AT_SKIP_IF([test $rmem_max -gt 1048576])
3740
2b07c8b1
BP
3741# Each flow update message takes up at least 48 bytes of space in queues
3742# and in practice more than that.
3743n_msgs=`expr $queue_size / 48`
3744echo n_msgs=$n_msgs
3745
3746OVS_VSWITCHD_START
3747
3748# Start a monitor watching the flow table, then make it block.
53eb8cb8 3749on_exit 'kill `cat ovs-ofctl.pid`'
2b07c8b1
BP
3750ovs-ofctl monitor br0 watch: --detach --no-chdir --pidfile >monitor.log 2>&1
3751AT_CAPTURE_FILE([monitor.log])
3752ovs-appctl -t ovs-ofctl ofctl/block
3753
3754# Add $n_msgs flows.
3755(echo "in_port=2,actions=output:2"
5c6d0628 3756${PERL} -e '
2b07c8b1
BP
3757 for ($i = 0; $i < '$n_msgs'; $i++) {
3758 print "cookie=1,reg1=$i,actions=drop\n";
3759 }
3760') > flows.txt
3761AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
79b8c36c
BP
3762# Check that multipart flow dumps work properly:
3763AT_CHECK([ovs-ofctl diff-flows br0 flows.txt])
2b07c8b1
BP
3764AT_CHECK([ovs-ofctl add-flow br0 in_port=1,cookie=3,actions=drop])
3765AT_CHECK([ovs-ofctl mod-flows br0 in_port=2,cookie=2,actions=output:2])
3766AT_CHECK([ovs-ofctl del-flows br0 cookie=1/-1])
3767
3768ovs-appctl -t ovs-ofctl ofctl/unblock
c4821629
YT
3769
3770# Wait for the connection resumed.
3771# A barrier doesn't work for this purpose.
3772# https://www.mail-archive.com/dev@openvswitch.org/msg27013.html
3773# https://www.mail-archive.com/dev@openvswitch.org/msg27675.html
3774OVS_WAIT_UNTIL([grep NXT_FLOW_MONITOR_RESUMED monitor.log])
2b07c8b1
BP
3775
3776ovs-appctl -t ovs-ofctl exit
3777
3778# Check that the flow monitor reported the same number of flows
3779# added and deleted, but fewer than we actually added and deleted.
3780adds=`grep -c 'ADDED.*reg1=' monitor.log`
3781deletes=`grep -c 'DELETED.*reg1=' monitor.log`
3782echo adds=$adds deletes=$deletes
3783AT_CHECK([test $adds -gt 100 && test $adds -lt $n_msgs])
3784AT_CHECK([test $adds = $deletes])
3785
d0ab8a1a
BP
3786# Check that the flow monitor reported everything in the expected order:
3787#
3788# event=ADDED table=0 cookie=0x1 reg1=0x22
3789# ...
3790# NXT_FLOW_MONITOR_PAUSED:
3791# ...
3792# event=DELETED reason=delete table=0 cookie=0x1 reg1=0x22
3793# ...
3794# event=ADDED table=0 cookie=0x3 in_port=1
3795# event=MODIFIED table=0 cookie=0x2 in_port=2 actions=output:2
3796# NXT_FLOW_MONITOR_RESUMED:
3797#
3798# except that, between the PAUSED and RESUMED, the order of the ADDED
3799# and MODIFIED lines lines depends on hash order, that is, it varies
3800# as we change the hash function or change architecture. Therefore,
3801# we use a couple of tests below to accept both orders.
2b07c8b1 3802AT_CHECK([ofctl_strip < monitor.log | sed -n -e '
46a80050 3803/reg1=0x22$/p
2b07c8b1
BP
3804/cookie=0x[[23]]/p
3805/NXT_FLOW_MONITOR_PAUSED:/p
3806/NXT_FLOW_MONITOR_RESUMED:/p
d0ab8a1a
BP
3807' > monitor.log.subset])
3808AT_CHECK([grep -v MODIFIED monitor.log.subset], [0], [dnl
3809 event=ADDED table=0 cookie=0x1 reg1=0x22
2b07c8b1
BP
3810NXT_FLOW_MONITOR_PAUSED:
3811 event=DELETED reason=delete table=0 cookie=0x1 reg1=0x22
3812 event=ADDED table=0 cookie=0x3 in_port=1
d0ab8a1a
BP
3813NXT_FLOW_MONITOR_RESUMED:
3814])
3815AT_CHECK([grep -v ADDED monitor.log.subset], [0], [dnl
3816NXT_FLOW_MONITOR_PAUSED:
3817 event=DELETED reason=delete table=0 cookie=0x1 reg1=0x22
2b07c8b1
BP
3818 event=MODIFIED table=0 cookie=0x2 in_port=2 actions=output:2
3819NXT_FLOW_MONITOR_RESUMED:
3820])
3821
3822OVS_VSWITCHD_STOP
3823AT_CLEANUP
45156451
AC
3824
3825AT_SETUP([ofproto - event filtering (OpenFlow 1.3)])
3826AT_KEYWORDS([monitor])
3827OVS_VSWITCHD_START
3828
3829# Start a monitor, use the required protocol version
3830ovs-ofctl -O OpenFlow13 monitor br0 --detach --no-chdir --pidfile >monitor.log 2>&1
3831AT_CAPTURE_FILE([monitor.log])
3832
3833# Send an OpenFlow13 message (04), OFPT_GET_ASYNC_REQUEST (1a), length (8), xid (0a)
3834ovs-appctl -t ovs-ofctl ofctl/send 041a00080000000a
3835ovs-appctl -t ovs-ofctl ofctl/barrier
3836
3837# Check default setting
3838read -r -d '' expected <<'EOF'
3839EOF
3840
3841AT_CHECK([ofctl_strip < monitor.log], [], [dnl
3842send: OFPT_GET_ASYNC_REQUEST (OF1.3):
3843OFPT_GET_ASYNC_REPLY (OF1.3):
3844 master:
3845 PACKET_IN: no_match action
3846 PORT_STATUS: add delete modify
3847 FLOW_REMOVED: idle hard delete
904e5202
BP
3848 ROLE_STATUS: (off)
3849 TABLE_STATUS: (off)
3850 REQUESTFORWARD: (off)
45156451
AC
3851
3852 slave:
3853 PACKET_IN: (off)
3854 PORT_STATUS: add delete modify
3855 FLOW_REMOVED: (off)
904e5202
BP
3856 ROLE_STATUS: (off)
3857 TABLE_STATUS: (off)
3858 REQUESTFORWARD: (off)
45156451
AC
3859OFPT_BARRIER_REPLY (OF1.3):
3860])
3861
3862OVS_VSWITCHD_STOP
3863AT_CLEANUP
4abb8608
BP
3864
3865AT_SETUP([ofproto - ofport_request])
3866OVS_VSWITCHD_START
3867ADD_OF_PORTS([br0], [1], [2], [3])
3868
3869set_and_check_specific_ofports () {
3870 ovs-vsctl set Interface p1 ofport_request="$1" -- \
3871 set Interface p2 ofport_request="$2" -- \
3872 set Interface p3 ofport_request="$3"
3873 ofports=`ovs-vsctl get Interface p1 ofport -- \
3874 get Interface p2 ofport -- \
3875 get Interface p3 ofport`
3876 AT_CHECK_UNQUOTED([echo $ofports], [0], [$1 $2 $3
3877])
3878}
3879for pre in '1 2 3' '1 3 2' '2 1 3' '2 3 1' '3 1 2' '3 2 1'; do
3880 for post in '1 2 3' '1 3 2' '2 1 3' '2 3 1' '3 1 2' '3 2 1'; do
3881 echo -----------------------------------------------------------
3882 echo "Check changing port numbers from $pre to $post"
d08d51b9
JS
3883 set_and_check_specific_ofports $pre
3884 set_and_check_specific_ofports $post
4abb8608
BP
3885 done
3886done
3887
3888ovs-vsctl del-port p3
3889
3890set_and_check_poorly_specified_ofports () {
3891 ovs-vsctl set Interface p1 ofport_request="$1" -- \
3892 set Interface p2 ofport_request="$2"
3893 p1=`ovs-vsctl get Interface p1 ofport`
3894 p2=`ovs-vsctl get Interface p2 ofport`
3895 echo $p1 $p2
3896
3897 AT_CHECK([test "$p1" != "$p2"])
3898 if test "$1" = "$2" && test "$1" != '[[]]'; then
3899 # One port number must be the requested one.
3900 AT_CHECK([test "$p1" = "$1" || test "$p2" = "$1"])
3901 # The other port number must be different (already tested above).
3902 else
641c6188
YT
3903 AT_CHECK([test "$1" = '[[]]' || test "$p1" = "$1"])
3904 AT_CHECK([test "$2" = '[[]]' || test "$p2" = "$2"])
4abb8608
BP
3905 fi
3906}
3907for pre in '1 2' '[[]] 2' '1 [[]]' '[[]] [[]]' '2 1' '[[]] 1' '2 [[]]' \
3908 '1 1' '2 2'; do
3909 for post in '1 2' '[[]] 2' '1 [[]]' '[[]] [[]]' '2 1' '[[]] 1' '2 [[]]' \
3910 '1 1' '2 2'; do
3911 echo -----------------------------------------------------------
3912 echo "Check changing port numbers from $pre to $post"
3913 set_and_check_poorly_specified_ofports $pre
3914 set_and_check_poorly_specified_ofports $post
3915 done
3916done
3917OVS_VSWITCHD_STOP
3918AT_CLEANUP
777af88d
AC
3919
3920
3921AT_SETUP([ofproto - bundles, open (OpenFlow 1.4)])
3922AT_KEYWORDS([monitor])
3923OVS_VSWITCHD_START
3924
3925# Start a monitor, use the required protocol version
3926ovs-ofctl -O OpenFlow14 monitor br0 --detach --no-chdir --pidfile >monitor.log 2>&1
3927AT_CAPTURE_FILE([monitor.log])
3928
3929# Send an OpenFlow14 message (05), OFPT_BUNDLE_CONTROL (21), length (10), xid (0a)
1f42be1c 3930ovs-appctl -t ovs-ofctl ofctl/send "05 21 00 10 00 00 00 0a 00 00 00 01 00 00 00 02"
777af88d
AC
3931ovs-appctl -t ovs-ofctl ofctl/barrier
3932ovs-appctl -t ovs-ofctl exit
3933
3934AT_CHECK([ofctl_strip < monitor.log], [], [dnl
3935send: OFPT_BUNDLE_CONTROL (OF1.4):
1f42be1c 3936 bundle_id=0x1 type=OPEN_REQUEST flags=ordered
777af88d
AC
3937OFPT_BUNDLE_CONTROL (OF1.4):
3938 bundle_id=0x1 type=OPEN_REPLY flags=0
3939OFPT_BARRIER_REPLY (OF1.4):
3940])
3941
3942OVS_VSWITCHD_STOP
3943AT_CLEANUP
3944
3945AT_SETUP([ofproto - bundles, double open (OpenFlow 1.4)])
3946AT_KEYWORDS([monitor])
3947OVS_VSWITCHD_START
3948
3949# Start a monitor, use the required protocol version
3950ovs-ofctl -O OpenFlow14 monitor br0 --detach --no-chdir --pidfile >monitor.log 2>&1
3951AT_CAPTURE_FILE([monitor.log])
3952
3953# Send twice an OpenFlow14 message (05), OFPT_BUNDLE_CONTROL (21), length (10), xid (0a)
1f42be1c 3954ovs-appctl -t ovs-ofctl ofctl/send "05 21 00 10 00 00 00 0a 00 00 00 01 00 00 00 02"
777af88d 3955ovs-appctl -t ovs-ofctl ofctl/barrier
1f42be1c 3956ovs-appctl -t ovs-ofctl ofctl/send "05 21 00 10 00 00 00 0a 00 00 00 01 00 00 00 02"
777af88d
AC
3957ovs-appctl -t ovs-ofctl ofctl/barrier
3958ovs-appctl -t ovs-ofctl exit
3959
3960AT_CHECK([ofctl_strip < monitor.log], [0], [dnl
3961send: OFPT_BUNDLE_CONTROL (OF1.4):
1f42be1c 3962 bundle_id=0x1 type=OPEN_REQUEST flags=ordered
777af88d
AC
3963OFPT_BUNDLE_CONTROL (OF1.4):
3964 bundle_id=0x1 type=OPEN_REPLY flags=0
3965OFPT_BARRIER_REPLY (OF1.4):
3966send: OFPT_BUNDLE_CONTROL (OF1.4):
1f42be1c 3967 bundle_id=0x1 type=OPEN_REQUEST flags=ordered
777af88d
AC
3968OFPT_ERROR (OF1.4): OFPBFC_BAD_ID
3969OFPT_BUNDLE_CONTROL (OF1.4):
1f42be1c 3970 bundle_id=0x1 type=OPEN_REQUEST flags=ordered
777af88d
AC
3971OFPT_BARRIER_REPLY (OF1.4):
3972])
3973
3974OVS_VSWITCHD_STOP
3975AT_CLEANUP
3976
3977AT_SETUP([ofproto - bundle close without open (OpenFlow 1.4)])
3978AT_KEYWORDS([monitor])
3979OVS_VSWITCHD_START
3980
3981# Start a monitor, use the required protocol version
3982ovs-ofctl -O OpenFlow14 monitor br0 --detach --no-chdir --pidfile >monitor.log 2>&1
3983AT_CAPTURE_FILE([monitor.log])
3984
1f42be1c 3985ovs-appctl -t ovs-ofctl ofctl/send "05 21 00 10 00 00 00 0a 00 00 00 01 00 02 00 02"
777af88d
AC
3986ovs-appctl -t ovs-ofctl ofctl/barrier
3987ovs-appctl -t ovs-ofctl exit
3988
3989AT_CHECK([ofctl_strip < monitor.log], [0], [dnl
3990send: OFPT_BUNDLE_CONTROL (OF1.4):
1f42be1c 3991 bundle_id=0x1 type=CLOSE_REQUEST flags=ordered
777af88d
AC
3992OFPT_ERROR (OF1.4): OFPBFC_BAD_ID
3993OFPT_BUNDLE_CONTROL (OF1.4):
1f42be1c 3994 bundle_id=0x1 type=CLOSE_REQUEST flags=ordered
777af88d
AC
3995OFPT_BARRIER_REPLY (OF1.4):
3996])
3997
3998OVS_VSWITCHD_STOP
3999AT_CLEANUP
4000
4001AT_SETUP([ofproto - bundle double close (OpenFlow 1.4)])
4002AT_KEYWORDS([monitor])
4003OVS_VSWITCHD_START
4004
4005# Start a monitor, use the required protocol version
4006ovs-ofctl -O OpenFlow14 monitor br0 --detach --no-chdir --pidfile >monitor.log 2>&1
4007AT_CAPTURE_FILE([monitor.log])
4008
4009# Open, Close, Close
1f42be1c 4010ovs-appctl -t ovs-ofctl ofctl/send "05 21 00 10 00 00 00 0a 00 00 00 01 00 00 00 02"
777af88d 4011ovs-appctl -t ovs-ofctl ofctl/barrier
1f42be1c 4012ovs-appctl -t ovs-ofctl ofctl/send "05 21 00 10 00 00 00 0a 00 00 00 01 00 02 00 02"
777af88d 4013ovs-appctl -t ovs-ofctl ofctl/barrier
1f42be1c 4014ovs-appctl -t ovs-ofctl ofctl/send "05 21 00 10 00 00 00 0a 00 00 00 01 00 02 00 02"
777af88d
AC
4015ovs-appctl -t ovs-ofctl ofctl/barrier
4016ovs-appctl -t ovs-ofctl exit
4017
4018AT_CHECK([ofctl_strip < monitor.log], [0], [dnl
4019send: OFPT_BUNDLE_CONTROL (OF1.4):
1f42be1c 4020 bundle_id=0x1 type=OPEN_REQUEST flags=ordered
777af88d
AC
4021OFPT_BUNDLE_CONTROL (OF1.4):
4022 bundle_id=0x1 type=OPEN_REPLY flags=0
4023OFPT_BARRIER_REPLY (OF1.4):
4024send: OFPT_BUNDLE_CONTROL (OF1.4):
1f42be1c 4025 bundle_id=0x1 type=CLOSE_REQUEST flags=ordered
777af88d
AC
4026OFPT_BUNDLE_CONTROL (OF1.4):
4027 bundle_id=0x1 type=CLOSE_REPLY flags=0
4028OFPT_BARRIER_REPLY (OF1.4):
4029send: OFPT_BUNDLE_CONTROL (OF1.4):
1f42be1c 4030 bundle_id=0x1 type=CLOSE_REQUEST flags=ordered
777af88d
AC
4031OFPT_ERROR (OF1.4): OFPBFC_BUNDLE_CLOSED
4032OFPT_BUNDLE_CONTROL (OF1.4):
1f42be1c 4033 bundle_id=0x1 type=CLOSE_REQUEST flags=ordered
777af88d
AC
4034OFPT_BARRIER_REPLY (OF1.4):
4035])
4036
4037OVS_VSWITCHD_STOP
4038AT_CLEANUP
4039
4040AT_SETUP([ofproto - bundle close, different flags (OpenFlow 1.4)])
4041AT_KEYWORDS([monitor])
4042OVS_VSWITCHD_START
4043
4044# Start a monitor, use the required protocol version
4045ovs-ofctl -O OpenFlow14 monitor br0 --detach --no-chdir --pidfile >monitor.log 2>&1
4046AT_CAPTURE_FILE([monitor.log])
4047
4048# Open, Close, Close
1f42be1c 4049ovs-appctl -t ovs-ofctl ofctl/send "05 21 00 10 00 00 00 0a 00 00 00 01 00 00 00 02"
777af88d 4050ovs-appctl -t ovs-ofctl ofctl/barrier
1f42be1c 4051ovs-appctl -t ovs-ofctl ofctl/send "05 21 00 10 00 00 00 0a 00 00 00 01 00 02 00 01"
777af88d
AC
4052ovs-appctl -t ovs-ofctl ofctl/barrier
4053ovs-appctl -t ovs-ofctl exit
4054
4055AT_CHECK([ofctl_strip < monitor.log], [0], [dnl
4056send: OFPT_BUNDLE_CONTROL (OF1.4):
1f42be1c 4057 bundle_id=0x1 type=OPEN_REQUEST flags=ordered
777af88d
AC
4058OFPT_BUNDLE_CONTROL (OF1.4):
4059 bundle_id=0x1 type=OPEN_REPLY flags=0
4060OFPT_BARRIER_REPLY (OF1.4):
4061send: OFPT_BUNDLE_CONTROL (OF1.4):
1f42be1c 4062 bundle_id=0x1 type=CLOSE_REQUEST flags=atomic
777af88d
AC
4063OFPT_ERROR (OF1.4): OFPBFC_BAD_FLAGS
4064OFPT_BUNDLE_CONTROL (OF1.4):
1f42be1c 4065 bundle_id=0x1 type=CLOSE_REQUEST flags=atomic
777af88d
AC
4066OFPT_BARRIER_REPLY (OF1.4):
4067])
4068
4069OVS_VSWITCHD_STOP
4070AT_CLEANUP
4071
4072AT_SETUP([ofproto - bundle commit without open (OpenFlow 1.4)])
4073AT_KEYWORDS([monitor])
4074OVS_VSWITCHD_START
4075
4076# Start a monitor, use the required protocol version
4077ovs-ofctl -O OpenFlow14 monitor br0 --detach --no-chdir --pidfile >monitor.log 2>&1
4078AT_CAPTURE_FILE([monitor.log])
4079
4080# Open, Close, Close
1f42be1c 4081ovs-appctl -t ovs-ofctl ofctl/send "05 21 00 10 00 00 00 0a 00 00 00 01 00 04 00 02"
777af88d
AC
4082ovs-appctl -t ovs-ofctl ofctl/barrier
4083ovs-appctl -t ovs-ofctl exit
4084
4085AT_CHECK([ofctl_strip < monitor.log], [0], [dnl
4086send: OFPT_BUNDLE_CONTROL (OF1.4):
1f42be1c 4087 bundle_id=0x1 type=COMMIT_REQUEST flags=ordered
777af88d
AC
4088OFPT_ERROR (OF1.4): OFPBFC_BAD_ID
4089OFPT_BUNDLE_CONTROL (OF1.4):
1f42be1c 4090 bundle_id=0x1 type=COMMIT_REQUEST flags=ordered
777af88d
AC
4091OFPT_BARRIER_REPLY (OF1.4):
4092])
4093
4094OVS_VSWITCHD_STOP
4095AT_CLEANUP
4096
4097AT_SETUP([ofproto - bundle commit, different flags (OpenFlow 1.4)])
4098AT_KEYWORDS([monitor])
4099OVS_VSWITCHD_START
4100
4101# Start a monitor, use the required protocol version
4102ovs-ofctl -O OpenFlow14 monitor br0 --detach --no-chdir --pidfile >monitor.log 2>&1
4103AT_CAPTURE_FILE([monitor.log])
4104
4105# Open, Close, Close
1f42be1c 4106ovs-appctl -t ovs-ofctl ofctl/send "05 21 00 10 00 00 00 0a 00 00 00 01 00 00 00 02"
777af88d 4107ovs-appctl -t ovs-ofctl ofctl/barrier
1f42be1c 4108ovs-appctl -t ovs-ofctl ofctl/send "05 21 00 10 00 00 00 0a 00 00 00 01 00 04 00 01"
777af88d
AC
4109ovs-appctl -t ovs-ofctl ofctl/barrier
4110ovs-appctl -t ovs-ofctl exit
4111
4112AT_CHECK([ofctl_strip < monitor.log], [0], [dnl
4113send: OFPT_BUNDLE_CONTROL (OF1.4):
1f42be1c 4114 bundle_id=0x1 type=OPEN_REQUEST flags=ordered
777af88d
AC
4115OFPT_BUNDLE_CONTROL (OF1.4):
4116 bundle_id=0x1 type=OPEN_REPLY flags=0
4117OFPT_BARRIER_REPLY (OF1.4):
4118send: OFPT_BUNDLE_CONTROL (OF1.4):
1f42be1c 4119 bundle_id=0x1 type=COMMIT_REQUEST flags=atomic
777af88d
AC
4120OFPT_ERROR (OF1.4): OFPBFC_BAD_FLAGS
4121OFPT_BUNDLE_CONTROL (OF1.4):
1f42be1c 4122 bundle_id=0x1 type=COMMIT_REQUEST flags=atomic
777af88d
AC
4123OFPT_BARRIER_REPLY (OF1.4):
4124])
4125
4126OVS_VSWITCHD_STOP
4127AT_CLEANUP
4128
4129AT_SETUP([ofproto - bundle discard without open (OpenFlow 1.4)])
4130AT_KEYWORDS([monitor])
4131OVS_VSWITCHD_START
4132
4133# Start a monitor, use the required protocol version
4134ovs-ofctl -O OpenFlow14 monitor br0 --detach --no-chdir --pidfile >monitor.log 2>&1
4135AT_CAPTURE_FILE([monitor.log])
4136
4137# Open, Close, Close
1f42be1c 4138ovs-appctl -t ovs-ofctl ofctl/send "05 21 00 10 00 00 00 0a 00 00 00 01 00 06 00 02"
777af88d
AC
4139ovs-appctl -t ovs-ofctl ofctl/barrier
4140ovs-appctl -t ovs-ofctl exit
4141
4142AT_CHECK([ofctl_strip < monitor.log], [0], [dnl
4143send: OFPT_BUNDLE_CONTROL (OF1.4):
1f42be1c 4144 bundle_id=0x1 type=DISCARD_REQUEST flags=ordered
777af88d
AC
4145OFPT_ERROR (OF1.4): OFPBFC_BAD_ID
4146OFPT_BUNDLE_CONTROL (OF1.4):
1f42be1c 4147 bundle_id=0x1 type=DISCARD_REQUEST flags=ordered
777af88d
AC
4148OFPT_BARRIER_REPLY (OF1.4):
4149])
4150
4151OVS_VSWITCHD_STOP
4152AT_CLEANUP
db5076ee
JR
4153
4154
4155AT_SETUP([ofproto - bundle with multiple flow mods (OpenFlow 1.4)])
4156AT_KEYWORDS([monitor])
4157OVS_VSWITCHD_START
4158
4159AT_CHECK([ovs-appctl vlog/set vconn:dbg])
4160
4161AT_CHECK([ovs-ofctl del-flows br0])
4162
4163AT_DATA([flows.txt], [dnl
4164add idle_timeout=50 in_port=2 dl_src=00:66:77:88:99:aa actions=1
4165add idle_timeout=60 in_port=2 dl_src=00:77:88:99:aa:bb actions=2
4166add idle_timeout=70 in_port=2 dl_src=00:88:99:aa:bb:cc actions=3
4167add idle_timeout=50 in_port=2 dl_src=00:66:77:88:99:aa actions=4
4168delete
4169add idle_timeout=50 in_port=2 dl_src=00:66:77:88:99:aa actions=5
4170add idle_timeout=60 in_port=2 dl_src=00:77:88:99:aa:bb actions=6
4171add idle_timeout=70 in_port=2 dl_src=00:88:99:aa:bb:cc actions=7
4172delete in_port=2 dl_src=00:88:99:aa:bb:cc
4173])
4174
4175AT_CHECK([ovs-ofctl --bundle add-flows br0 flows.txt])
4176
4177AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
4178 idle_timeout=50, in_port=2,dl_src=00:66:77:88:99:aa actions=output:5
4179 idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=output:6
4180NXST_FLOW reply:
4181])
4182
4183AT_DATA([flows.txt], [dnl
4184modify actions=drop
4185modify_strict in_port=2 dl_src=00:77:88:99:aa:bb actions=7
4186])
4187
4188AT_CHECK([ovs-ofctl --bundle add-flows br0 flows.txt])
4189
4190AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
4191 idle_timeout=50, in_port=2,dl_src=00:66:77:88:99:aa actions=drop
4192 idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=output:7
4193NXST_FLOW reply:
4194])
4195
4196# Adding an existing flow acts as a modify, and delete_strict also works.
4197AT_DATA([flows.txt], [dnl
4198add idle_timeout=60 in_port=2 dl_src=00:77:88:99:aa:bb actions=8
4199delete_strict in_port=2 dl_src=00:66:77:88:99:aa
4200add in_port=2 dl_src=00:66:77:88:99:aa actions=drop
4201])
4202
4203AT_CHECK([ovs-ofctl --bundle add-flows br0 flows.txt])
4204
4205AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
4206 idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=output:8
4207 in_port=2,dl_src=00:66:77:88:99:aa actions=drop
4208NXST_FLOW reply:
4209])
4210
4211dnl Check logs for OpenFlow trace
4212# Prevent race.
12e2ba2e
YT
4213OVS_WAIT_UNTIL([cat ovs-vswitchd.log | vconn_sub | test `grep -- "|vconn|DBG|unix: sent (Success): NXST_FLOW reply" | wc -l` -ge 3])
4214AT_CHECK([print_vconn_debug | vconn_sub | ofctl_strip], [0], [dnl
db5076ee
JR
4215vconn|DBG|unix: sent (Success): OFPT_HELLO (OF1.5):
4216 version bitmap: 0x01, 0x02, 0x03, 0x04, 0x05, 0x06
4217vconn|DBG|unix: received: OFPT_HELLO:
4218 version bitmap: 0x01
4219vconn|DBG|unix: negotiated OpenFlow version 0x01 (we support version 0x06 and earlier, peer supports version 0x01)
4220vconn|DBG|unix: received: OFPT_FLOW_MOD: DEL actions=drop
4221vconn|DBG|unix: received: OFPT_BARRIER_REQUEST:
4222vconn|DBG|unix: sent (Success): OFPT_BARRIER_REPLY:
4223vconn|DBG|unix: sent (Success): OFPT_HELLO (OF1.5):
4224 version bitmap: 0x01, 0x02, 0x03, 0x04, 0x05, 0x06
4225vconn|DBG|unix: received: OFPT_HELLO (OF1.4):
5f8c05ad
JR
4226 version bitmap: 0x05
4227vconn|DBG|unix: negotiated OpenFlow version 0x05 (we support version 0x06 and earlier, peer supports version 0x05)
db5076ee 4228vconn|DBG|unix: received: OFPT_BUNDLE_CONTROL (OF1.4):
39c94593 4229 bundle_id=0 type=OPEN_REQUEST flags=atomic ordered
db5076ee
JR
4230vconn|DBG|unix: sent (Success): OFPT_BUNDLE_CONTROL (OF1.4):
4231 bundle_id=0 type=OPEN_REPLY flags=0
4232vconn|DBG|unix: received: OFPT_BUNDLE_ADD_MESSAGE (OF1.4):
39c94593 4233 bundle_id=0 flags=atomic ordered
db5076ee
JR
4234OFPT_FLOW_MOD (OF1.4): ADD in_port=2,dl_src=00:66:77:88:99:aa idle:50 actions=output:1
4235vconn|DBG|unix: received: OFPT_BUNDLE_ADD_MESSAGE (OF1.4):
39c94593 4236 bundle_id=0 flags=atomic ordered
db5076ee
JR
4237OFPT_FLOW_MOD (OF1.4): ADD in_port=2,dl_src=00:77:88:99:aa:bb idle:60 actions=output:2
4238vconn|DBG|unix: received: OFPT_BUNDLE_ADD_MESSAGE (OF1.4):
39c94593 4239 bundle_id=0 flags=atomic ordered
db5076ee
JR
4240OFPT_FLOW_MOD (OF1.4): ADD in_port=2,dl_src=00:88:99:aa:bb:cc idle:70 actions=output:3
4241vconn|DBG|unix: received: OFPT_BUNDLE_ADD_MESSAGE (OF1.4):
39c94593 4242 bundle_id=0 flags=atomic ordered
db5076ee
JR
4243OFPT_FLOW_MOD (OF1.4): ADD in_port=2,dl_src=00:66:77:88:99:aa idle:50 actions=output:4
4244vconn|DBG|unix: received: OFPT_BUNDLE_ADD_MESSAGE (OF1.4):
39c94593 4245 bundle_id=0 flags=atomic ordered
db5076ee
JR
4246OFPT_FLOW_MOD (OF1.4): DEL table:255 actions=drop
4247vconn|DBG|unix: received: OFPT_BUNDLE_ADD_MESSAGE (OF1.4):
39c94593 4248 bundle_id=0 flags=atomic ordered
db5076ee
JR
4249OFPT_FLOW_MOD (OF1.4): ADD in_port=2,dl_src=00:66:77:88:99:aa idle:50 actions=output:5
4250vconn|DBG|unix: received: OFPT_BUNDLE_ADD_MESSAGE (OF1.4):
39c94593 4251 bundle_id=0 flags=atomic ordered
db5076ee
JR
4252OFPT_FLOW_MOD (OF1.4): ADD in_port=2,dl_src=00:77:88:99:aa:bb idle:60 actions=output:6
4253vconn|DBG|unix: received: OFPT_BUNDLE_ADD_MESSAGE (OF1.4):
39c94593 4254 bundle_id=0 flags=atomic ordered
db5076ee
JR
4255OFPT_FLOW_MOD (OF1.4): ADD in_port=2,dl_src=00:88:99:aa:bb:cc idle:70 actions=output:7
4256vconn|DBG|unix: received: OFPT_BUNDLE_ADD_MESSAGE (OF1.4):
39c94593 4257 bundle_id=0 flags=atomic ordered
db5076ee
JR
4258OFPT_FLOW_MOD (OF1.4): DEL table:255 in_port=2,dl_src=00:88:99:aa:bb:cc actions=drop
4259vconn|DBG|unix: received: OFPT_BUNDLE_CONTROL (OF1.4):
39c94593 4260 bundle_id=0 type=COMMIT_REQUEST flags=atomic ordered
db5076ee
JR
4261vconn|DBG|unix: sent (Success): OFPT_BUNDLE_CONTROL (OF1.4):
4262 bundle_id=0 type=COMMIT_REPLY flags=0
4263vconn|DBG|unix: sent (Success): OFPT_HELLO (OF1.5):
4264 version bitmap: 0x01, 0x02, 0x03, 0x04, 0x05, 0x06
4265vconn|DBG|unix: received: OFPT_HELLO:
4266 version bitmap: 0x01
4267vconn|DBG|unix: negotiated OpenFlow version 0x01 (we support version 0x06 and earlier, peer supports version 0x01)
4268vconn|DBG|unix: received: NXT_SET_FLOW_FORMAT: format=nxm
4269vconn|DBG|unix: received: OFPT_BARRIER_REQUEST:
4270vconn|DBG|unix: sent (Success): OFPT_BARRIER_REPLY:
4271vconn|DBG|unix: received: NXST_FLOW request:
4272vconn|DBG|unix: sent (Success): NXST_FLOW reply:
4273 idle_timeout=50, in_port=2,dl_src=00:66:77:88:99:aa actions=output:5
4274 idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=output:6
4275vconn|DBG|unix: sent (Success): OFPT_HELLO (OF1.5):
4276 version bitmap: 0x01, 0x02, 0x03, 0x04, 0x05, 0x06
4277vconn|DBG|unix: received: OFPT_HELLO (OF1.4):
5f8c05ad
JR
4278 version bitmap: 0x05
4279vconn|DBG|unix: negotiated OpenFlow version 0x05 (we support version 0x06 and earlier, peer supports version 0x05)
db5076ee 4280vconn|DBG|unix: received: OFPT_BUNDLE_CONTROL (OF1.4):
39c94593 4281 bundle_id=0 type=OPEN_REQUEST flags=atomic ordered
db5076ee
JR
4282vconn|DBG|unix: sent (Success): OFPT_BUNDLE_CONTROL (OF1.4):
4283 bundle_id=0 type=OPEN_REPLY flags=0
4284vconn|DBG|unix: received: OFPT_BUNDLE_ADD_MESSAGE (OF1.4):
39c94593 4285 bundle_id=0 flags=atomic ordered
db5076ee
JR
4286OFPT_FLOW_MOD (OF1.4): MOD actions=drop
4287vconn|DBG|unix: received: OFPT_BUNDLE_ADD_MESSAGE (OF1.4):
39c94593 4288 bundle_id=0 flags=atomic ordered
db5076ee
JR
4289OFPT_FLOW_MOD (OF1.4): MOD_STRICT in_port=2,dl_src=00:77:88:99:aa:bb actions=output:7
4290vconn|DBG|unix: received: OFPT_BUNDLE_CONTROL (OF1.4):
39c94593 4291 bundle_id=0 type=COMMIT_REQUEST flags=atomic ordered
db5076ee
JR
4292vconn|DBG|unix: sent (Success): OFPT_BUNDLE_CONTROL (OF1.4):
4293 bundle_id=0 type=COMMIT_REPLY flags=0
4294vconn|DBG|unix: sent (Success): OFPT_HELLO (OF1.5):
4295 version bitmap: 0x01, 0x02, 0x03, 0x04, 0x05, 0x06
4296vconn|DBG|unix: received: OFPT_HELLO:
4297 version bitmap: 0x01
4298vconn|DBG|unix: negotiated OpenFlow version 0x01 (we support version 0x06 and earlier, peer supports version 0x01)
4299vconn|DBG|unix: received: NXT_SET_FLOW_FORMAT: format=nxm
4300vconn|DBG|unix: received: OFPT_BARRIER_REQUEST:
4301vconn|DBG|unix: sent (Success): OFPT_BARRIER_REPLY:
4302vconn|DBG|unix: received: NXST_FLOW request:
4303vconn|DBG|unix: sent (Success): NXST_FLOW reply:
4304 idle_timeout=50, in_port=2,dl_src=00:66:77:88:99:aa actions=drop
4305 idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=output:7
4306vconn|DBG|unix: sent (Success): OFPT_HELLO (OF1.5):
4307 version bitmap: 0x01, 0x02, 0x03, 0x04, 0x05, 0x06
4308vconn|DBG|unix: received: OFPT_HELLO (OF1.4):
5f8c05ad
JR
4309 version bitmap: 0x05
4310vconn|DBG|unix: negotiated OpenFlow version 0x05 (we support version 0x06 and earlier, peer supports version 0x05)
db5076ee 4311vconn|DBG|unix: received: OFPT_BUNDLE_CONTROL (OF1.4):
39c94593 4312 bundle_id=0 type=OPEN_REQUEST flags=atomic ordered
db5076ee
JR
4313vconn|DBG|unix: sent (Success): OFPT_BUNDLE_CONTROL (OF1.4):
4314 bundle_id=0 type=OPEN_REPLY flags=0
4315vconn|DBG|unix: received: OFPT_BUNDLE_ADD_MESSAGE (OF1.4):
39c94593 4316 bundle_id=0 flags=atomic ordered
db5076ee
JR
4317OFPT_FLOW_MOD (OF1.4): ADD in_port=2,dl_src=00:77:88:99:aa:bb idle:60 actions=output:8
4318vconn|DBG|unix: received: OFPT_BUNDLE_ADD_MESSAGE (OF1.4):
39c94593 4319 bundle_id=0 flags=atomic ordered
db5076ee
JR
4320OFPT_FLOW_MOD (OF1.4): DEL_STRICT table:255 in_port=2,dl_src=00:66:77:88:99:aa actions=drop
4321vconn|DBG|unix: received: OFPT_BUNDLE_ADD_MESSAGE (OF1.4):
39c94593 4322 bundle_id=0 flags=atomic ordered
db5076ee
JR
4323OFPT_FLOW_MOD (OF1.4): ADD in_port=2,dl_src=00:66:77:88:99:aa actions=drop
4324vconn|DBG|unix: received: OFPT_BUNDLE_CONTROL (OF1.4):
39c94593 4325 bundle_id=0 type=COMMIT_REQUEST flags=atomic ordered
db5076ee
JR
4326vconn|DBG|unix: sent (Success): OFPT_BUNDLE_CONTROL (OF1.4):
4327 bundle_id=0 type=COMMIT_REPLY flags=0
4328vconn|DBG|unix: sent (Success): OFPT_HELLO (OF1.5):
4329 version bitmap: 0x01, 0x02, 0x03, 0x04, 0x05, 0x06
4330vconn|DBG|unix: received: OFPT_HELLO:
4331 version bitmap: 0x01
4332vconn|DBG|unix: negotiated OpenFlow version 0x01 (we support version 0x06 and earlier, peer supports version 0x01)
4333vconn|DBG|unix: received: NXT_SET_FLOW_FORMAT: format=nxm
4334vconn|DBG|unix: received: OFPT_BARRIER_REQUEST:
4335vconn|DBG|unix: sent (Success): OFPT_BARRIER_REPLY:
4336vconn|DBG|unix: received: NXST_FLOW request:
4337vconn|DBG|unix: sent (Success): NXST_FLOW reply:
4338 idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=output:8
4339 in_port=2,dl_src=00:66:77:88:99:aa actions=drop
4340])
4341
4342OVS_VSWITCHD_STOP
4343AT_CLEANUP
4344
4345
4346AT_SETUP([ofproto - failing bundle commit (OpenFlow 1.4)])
4347AT_KEYWORDS([monitor])
4348OVS_VSWITCHD_START
4349
4350AT_CHECK([ovs-ofctl del-flows br0])
4351
4352ovs-ofctl add-flows br0 - <<EOF
4353idle_timeout=50 in_port=2 dl_src=00:66:77:88:99:aa actions=11
4354idle_timeout=60 in_port=2 dl_src=00:77:88:99:aa:bb actions=22
4355idle_timeout=70 in_port=2 dl_src=00:88:99:aa:bb:cc actions=33
4356EOF
4357AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
4358 idle_timeout=50, in_port=2,dl_src=00:66:77:88:99:aa actions=output:11
4359 idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=output:22
4360 idle_timeout=70, in_port=2,dl_src=00:88:99:aa:bb:cc actions=output:33
4361NXST_FLOW reply:
4362])
4363
4364# last line uses illegal table number (OVS internal table)
4365AT_DATA([flows.txt], [dnl
4366add idle_timeout=50 in_port=2 dl_src=00:66:77:88:99:aa actions=1
4367add idle_timeout=60 in_port=2 dl_src=00:77:88:99:aa:bb actions=2
4368add idle_timeout=70 in_port=2 dl_src=00:88:99:aa:bb:cc actions=3
4369modify idle_timeout=50 in_port=2 dl_src=00:66:77:88:99:aa actions=4
4370delete
4371add idle_timeout=50 in_port=2 dl_src=00:66:77:88:99:aa actions=5
4372add idle_timeout=60 in_port=2 dl_src=00:77:88:99:aa:bb actions=6
4373add idle_timeout=70 in_port=2 dl_src=00:88:99:aa:bb:cc actions=7
4374delete in_port=2 dl_src=00:88:99:aa:bb:cc
4375add table=254 actions=drop
4376])
4377
4378AT_CHECK([ovs-ofctl --bundle add-flows br0 flows.txt 2>&1 | sed '/|WARN|/d
b0065993
GS
4379s/unix:.*br0\.mgmt/unix:br0.mgmt/' | sed 's/(.* error)/(error)/'],
4380[0], [dnl
db5076ee
JR
4381OFPT_ERROR (OF1.4) (xid=0xb): OFPBRC_EPERM
4382OFPT_FLOW_MOD (OF1.4) (xid=0xb): ADD table:254 actions=drop
4383OFPT_ERROR (OF1.4) (xid=0xd): OFPBFC_MSG_FAILED
4384OFPT_BUNDLE_CONTROL (OF1.4) (xid=0xd):
39c94593 4385 bundle_id=0 type=COMMIT_REQUEST flags=atomic ordered
b0065993 4386ovs-ofctl: talking to unix:br0.mgmt (error)
db5076ee
JR
4387])
4388
4389AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
4390 idle_timeout=50, in_port=2,dl_src=00:66:77:88:99:aa actions=output:11
4391 idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=output:22
4392 idle_timeout=70, in_port=2,dl_src=00:88:99:aa:bb:cc actions=output:33
4393NXST_FLOW reply:
4394])
4395
4396OVS_VSWITCHD_STOP
4397AT_CLEANUP