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