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