]> git.proxmox.com Git - mirror_ovs.git/blame - tests/ofproto.at
ofproto-dpif: Expose datapath capability to ovsdb.
[mirror_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:
2208 in_port: exact match or wildcard
2209 eth_src: exact match or wildcard
2210 eth_dst: exact match or wildcard
2211 eth_type: exact match or wildcard
2212 vlan_vid: exact match or wildcard
2213 vlan_pcp: exact match or wildcard
2214 ip_src: exact match or wildcard
2215 ip_dst: exact match or wildcard
2216 nw_proto: exact match or wildcard
2217 nw_tos: exact match or wildcard
2218 tcp_src: exact match or wildcard
2219 tcp_dst: exact match or wildcard
8811fc0a 2220
4bc938cc 2221' "$1"
8811fc0a 2222}
9d36d7d7 2223(head_table; echo ' tables 1...253: ditto') > expout
254750ce
BP
2224AT_CHECK([ovs-ofctl dump-tables br0], [0], [expout])
2225# Change the configuration.
2226AT_CHECK(
2227 [ovs-vsctl \
2228 -- --id=@t0 create Flow_Table name=main \
2229 -- --id=@t1 create Flow_Table flow-limit=1024 \
2230 -- set bridge br0 'flow_tables={1=@t1,0=@t0}' \
c724bd67 2231 | uuidfilt],
254750ce
BP
2232 [0], [<0>
2233<1>
2234])
2235# Check that the configuration was updated.
4bc938cc 2236(head_table ' ("main")'; echo ' table 1:
8811fc0a
BP
2237 active=0, lookup=0, matched=0
2238 max_entries=1024
2239 (same matching)
2240
4bc938cc 2241 table 2:
8811fc0a
BP
2242 active=0, lookup=0, matched=0
2243 max_entries=1000000
2244 (same matching)
9d36d7d7 2245'; echo ' tables 3...253: ditto') > expout
254750ce
BP
2246AT_CHECK([ovs-ofctl dump-tables br0], [0], [expout])
2247OVS_VSWITCHD_STOP
2248AT_CLEANUP
2249
3fbbcba7
BP
2250dnl In-band and fail-open add "hidden rules" to table 0. These rules shouldn't
2251dnl be visible to OpenFlow. This test checks that "dump-flows" and
2252dnl "dump-tables" don't make them visible.
2253AT_SETUP([ofproto - hidden rules not in table stats])
2254# Use an IP address for a controller that won't actually exist: we
2255# want to create in-band rules but we do not want to actually connect
2256# to a controller (because that could mess about with our test). The
2257# Class E range 240.0.0.0 - 255.255.255.255 seems like a good choice.
2258OVS_VSWITCHD_START([set-controller br0 tcp:240.0.0.1:6653])
2259for i in 1 2 3 4 5; do ovs-appctl time/warp 1000; done
2260
2261# Check that no hidden flows are visible in OpenFlow.
50f96b10 2262AT_CHECK([ovs-ofctl dump-flows br0 | strip_xids], [0], [NXST_FLOW reply:
3fbbcba7
BP
2263])
2264
2265# Check that some hidden flows related to 240.0.0.1 are actually in table 0.
2266#
2267# We discard flows that mention table_id because we only want table 0 flows,
2268# which in OVS is implied by the absence of a table_id.
2269AT_CHECK([ovs-appctl bridge/dump-flows br0], [0], [stdout])
2270AT_CHECK([test `grep '240\.0\.0\.1' stdout | grep -v table_id= | wc -l` -gt 0])
2271
2272# Check that dump-tables doesn't count the hidden flows.
8811fc0a 2273head_table() {
50f96b10 2274 printf 'OFPST_TABLE reply:
4bc938cc 2275 table 0:
3fbbcba7
BP
2276 active=0, lookup=0, matched=0
2277 max_entries=1000000
2278 matching:
2279 in_port: exact match or wildcard
2280 eth_src: exact match or wildcard
2281 eth_dst: exact match or wildcard
2282 eth_type: exact match or wildcard
2283 vlan_vid: exact match or wildcard
2284 vlan_pcp: exact match or wildcard
2285 ip_src: exact match or wildcard
2286 ip_dst: exact match or wildcard
2287 nw_proto: exact match or wildcard
2288 nw_tos: exact match or wildcard
2289 tcp_src: exact match or wildcard
2290 tcp_dst: exact match or wildcard
8811fc0a 2291
4bc938cc 2292'
8811fc0a 2293}
9d36d7d7 2294(head_table; echo ' tables 1...253: ditto') > expout
50f96b10 2295AT_CHECK([ovs-ofctl dump-tables br0 | strip_xids], [0], [expout])
74f5c9db 2296OVS_VSWITCHD_STOP(["/240\.0\.0\.1/d"])
3fbbcba7
BP
2297AT_CLEANUP
2298
9dcd1c00
SH
2299AT_SETUP([ofproto - flow table configuration (OpenFlow 1.2)])
2300OVS_VSWITCHD_START
2301# Check the default configuration.
8811fc0a
BP
2302head_table() {
2303 printf 'OFPST_TABLE reply (OF1.2) (xid=0x2):
4bc938cc 2304 table 0%s:
3c1bb396
BP
2305 active=0, lookup=0, matched=0
2306 metadata: match=0xffffffffffffffff write=0xffffffffffffffff
2307 config=controller
2308 max_entries=1000000
2309 instructions (table miss and others):
8811fc0a 2310 instructions: apply_actions,clear_actions,write_actions,write_metadata,goto_table
3c1bb396
BP
2311 Write-Actions and Apply-Actions features:
2312 actions: output group set_field strip_vlan push_vlan mod_nw_ttl dec_ttl set_mpls_ttl dec_mpls_ttl push_mpls pop_mpls set_queue
f6ecf944 2313 supported on Set-Field: metadata in_port_oxm eth_src eth_dst vlan_vid vlan_pcp mpls_label mpls_tc ip_src ip_dst ipv6_src ipv6_dst ipv6_label ip_dscp nw_ecn arp_op arp_spa arp_tpa arp_sha arp_tha tcp_src tcp_dst udp_src udp_dst sctp_src sctp_dst icmp_type icmp_code icmpv6_type icmpv6_code nd_target nd_sll nd_tll
3c1bb396
BP
2314 matching:
2315 metadata: exact match or wildcard
2316 in_port_oxm: exact match or wildcard
2317 eth_src: exact match or wildcard
2318 eth_dst: exact match or wildcard
2319 eth_type: exact match or wildcard
2320 vlan_vid: exact match or wildcard
2321 vlan_pcp: exact match or wildcard
2322 mpls_label: exact match or wildcard
2323 mpls_tc: exact match or wildcard
2324 ip_src: exact match or wildcard
2325 ip_dst: exact match or wildcard
2326 ipv6_src: exact match or wildcard
2327 ipv6_dst: exact match or wildcard
2328 ipv6_label: exact match or wildcard
2329 nw_proto: exact match or wildcard
2330 ip_dscp: exact match or wildcard
2331 nw_ecn: exact match or wildcard
2332 arp_op: exact match or wildcard
2333 arp_spa: exact match or wildcard
2334 arp_tpa: exact match or wildcard
2335 arp_sha: exact match or wildcard
2336 arp_tha: exact match or wildcard
2337 tcp_src: exact match or wildcard
2338 tcp_dst: exact match or wildcard
2339 udp_src: exact match or wildcard
2340 udp_dst: exact match or wildcard
2341 sctp_src: exact match or wildcard
2342 sctp_dst: exact match or wildcard
2343 icmp_type: exact match or wildcard
2344 icmp_code: exact match or wildcard
2345 icmpv6_type: exact match or wildcard
2346 icmpv6_code: exact match or wildcard
2347 nd_target: exact match or wildcard
2348 nd_sll: exact match or wildcard
8811fc0a
BP
2349 nd_tll: exact match or wildcard
2350
4bc938cc 2351' "$1"
8811fc0a 2352}
8811fc0a 2353tail_table() {
4bc938cc 2354 printf ' table 253:
8811fc0a
BP
2355 active=0, lookup=0, matched=0
2356 metadata: match=0xffffffffffffffff write=0xffffffffffffffff
2357 config=controller
2358 max_entries=1000000
2359 instructions (table miss and others):
2360 instructions: apply_actions,clear_actions,write_actions,write_metadata
2361 (same actions)
2362 (same matching)
2363'
2364}
9d36d7d7 2365(head_table; printf ' tables 1...252: ditto\n\n'; tail_table) > expout
9dcd1c00
SH
2366AT_CHECK([ovs-ofctl -O OpenFlow12 dump-tables br0], [0], [expout])
2367# Change the configuration.
2368AT_CHECK(
2369 [ovs-vsctl \
2370 -- --id=@t0 create Flow_Table name=main \
2371 -- --id=@t1 create Flow_Table flow-limit=1024 \
2372 -- set bridge br0 'flow_tables={1=@t1,0=@t0}' \
c724bd67 2373 | uuidfilt],
9dcd1c00
SH
2374 [0], [<0>
2375<1>
2376])
2377# Check that the configuration was updated.
4bc938cc 2378(head_table ' ("main")'; echo ' table 1:
8811fc0a
BP
2379 active=0, lookup=0, matched=0
2380 metadata: match=0xffffffffffffffff write=0xffffffffffffffff
2381 config=controller
2382 max_entries=1024
2383 (same instructions)
2384 (same matching)
2385
4bc938cc 2386 table 2:
8811fc0a
BP
2387 active=0, lookup=0, matched=0
2388 metadata: match=0xffffffffffffffff write=0xffffffffffffffff
2389 config=controller
2390 max_entries=1000000
2391 (same instructions)
2392 (same matching)
9d36d7d7 2393'; printf ' tables 3...252: ditto\n\n'; tail_table) > expout
9dcd1c00
SH
2394AT_CHECK([ovs-ofctl -O OpenFlow12 dump-tables br0], [0], [expout])
2395OVS_VSWITCHD_STOP
2396AT_CLEANUP
2397
3c4e10fb
BP
2398AT_SETUP([ofproto - table features (OpenFlow 1.3)])
2399OVS_VSWITCHD_START
8811fc0a 2400head_table () {
4bc938cc 2401 printf ' table 0%s:
3c4e10fb
BP
2402 metadata: match=0xffffffffffffffff write=0xffffffffffffffff
2403 max_entries=1000000
8811fc0a
BP
2404 instructions (table miss and others):
2405 next tables: 1-253
2406 instructions: meter,apply_actions,clear_actions,write_actions,write_metadata,goto_table
3c4e10fb
BP
2407 Write-Actions and Apply-Actions features:
2408 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
7dc18ae9 2409 supported on Set-Field: tun_id tun_src tun_dst tun_ipv6_src tun_ipv6_dst tun_flags tun_gbp_id tun_gbp_flags tun_erspan_idx tun_erspan_ver tun_erspan_dir tun_erspan_hwid tun_metadata0 dnl
a07eb11f 2410tun_metadata1 tun_metadata2 tun_metadata3 tun_metadata4 tun_metadata5 tun_metadata6 tun_metadata7 tun_metadata8 tun_metadata9 tun_metadata10 tun_metadata11 tun_metadata12 tun_metadata13 tun_metadata14 tun_metadata15 tun_metadata16 tun_metadata17 tun_metadata18 tun_metadata19 tun_metadata20 tun_metadata21 tun_metadata22 tun_metadata23 tun_metadata24 tun_metadata25 tun_metadata26 tun_metadata27 tun_metadata28 tun_metadata29 tun_metadata30 tun_metadata31 tun_metadata32 tun_metadata33 tun_metadata34 tun_metadata35 tun_metadata36 tun_metadata37 tun_metadata38 tun_metadata39 tun_metadata40 tun_metadata41 tun_metadata42 tun_metadata43 tun_metadata44 tun_metadata45 tun_metadata46 tun_metadata47 tun_metadata48 tun_metadata49 tun_metadata50 tun_metadata51 tun_metadata52 tun_metadata53 tun_metadata54 tun_metadata55 tun_metadata56 tun_metadata57 tun_metadata58 tun_metadata59 tun_metadata60 tun_metadata61 tun_metadata62 tun_metadata63 dnl
9b2b8497 2411metadata in_port in_port_oxm pkt_mark ct_mark ct_label reg0 reg1 reg2 reg3 reg4 reg5 reg6 reg7 reg8 reg9 reg10 reg11 reg12 reg13 reg14 reg15 xreg0 xreg1 xreg2 xreg3 xreg4 xreg5 xreg6 xreg7 xxreg0 xxreg1 xxreg2 xxreg3 eth_src eth_dst vlan_tci vlan_vid vlan_pcp mpls_label mpls_tc mpls_ttl ip_src ip_dst ipv6_src ipv6_dst ipv6_label nw_tos ip_dscp nw_ecn nw_ttl arp_op arp_spa arp_tpa arp_sha arp_tha tcp_src tcp_dst udp_src udp_dst sctp_src sctp_dst icmp_type icmp_code icmpv6_type icmpv6_code nd_target nd_sll nd_tll nd_reserved nd_options_type nsh_flags nsh_spi nsh_si nsh_c1 nsh_c2 nsh_c3 nsh_c4 nsh_ttl
3c4e10fb
BP
2412 matching:
2413 dp_hash: arbitrary mask
2414 recirc_id: exact match or wildcard
3d4b2e6e 2415 packet_type: exact match or wildcard
18080541 2416 conj_id: exact match or wildcard
3c4e10fb
BP
2417 tun_id: arbitrary mask
2418 tun_src: arbitrary mask
2419 tun_dst: arbitrary mask
7dad8e9a
TLSC
2420 tun_ipv6_src: arbitrary mask
2421 tun_ipv6_dst: arbitrary mask
b666962b 2422 tun_flags: arbitrary mask
ac6073e3
MC
2423 tun_gbp_id: arbitrary mask
2424 tun_gbp_flags: arbitrary mask
7dc18ae9
WT
2425 tun_erspan_idx: arbitrary mask
2426 tun_erspan_ver: arbitrary mask
2427 tun_erspan_dir: arbitrary mask
2428 tun_erspan_hwid: arbitrary mask
9558d2a5
JG
2429 tun_metadata0: arbitrary mask
2430 tun_metadata1: arbitrary mask
2431 tun_metadata2: arbitrary mask
2432 tun_metadata3: arbitrary mask
2433 tun_metadata4: arbitrary mask
2434 tun_metadata5: arbitrary mask
2435 tun_metadata6: arbitrary mask
2436 tun_metadata7: arbitrary mask
2437 tun_metadata8: arbitrary mask
2438 tun_metadata9: arbitrary mask
2439 tun_metadata10: arbitrary mask
2440 tun_metadata11: arbitrary mask
2441 tun_metadata12: arbitrary mask
2442 tun_metadata13: arbitrary mask
2443 tun_metadata14: arbitrary mask
2444 tun_metadata15: arbitrary mask
2445 tun_metadata16: arbitrary mask
2446 tun_metadata17: arbitrary mask
2447 tun_metadata18: arbitrary mask
2448 tun_metadata19: arbitrary mask
2449 tun_metadata20: arbitrary mask
2450 tun_metadata21: arbitrary mask
2451 tun_metadata22: arbitrary mask
2452 tun_metadata23: arbitrary mask
2453 tun_metadata24: arbitrary mask
2454 tun_metadata25: arbitrary mask
2455 tun_metadata26: arbitrary mask
2456 tun_metadata27: arbitrary mask
2457 tun_metadata28: arbitrary mask
2458 tun_metadata29: arbitrary mask
2459 tun_metadata30: arbitrary mask
2460 tun_metadata31: arbitrary mask
2461 tun_metadata32: arbitrary mask
2462 tun_metadata33: arbitrary mask
2463 tun_metadata34: arbitrary mask
2464 tun_metadata35: arbitrary mask
2465 tun_metadata36: arbitrary mask
2466 tun_metadata37: arbitrary mask
2467 tun_metadata38: arbitrary mask
2468 tun_metadata39: arbitrary mask
2469 tun_metadata40: arbitrary mask
2470 tun_metadata41: arbitrary mask
2471 tun_metadata42: arbitrary mask
2472 tun_metadata43: arbitrary mask
2473 tun_metadata44: arbitrary mask
2474 tun_metadata45: arbitrary mask
2475 tun_metadata46: arbitrary mask
2476 tun_metadata47: arbitrary mask
2477 tun_metadata48: arbitrary mask
2478 tun_metadata49: arbitrary mask
2479 tun_metadata50: arbitrary mask
2480 tun_metadata51: arbitrary mask
2481 tun_metadata52: arbitrary mask
2482 tun_metadata53: arbitrary mask
2483 tun_metadata54: arbitrary mask
2484 tun_metadata55: arbitrary mask
2485 tun_metadata56: arbitrary mask
2486 tun_metadata57: arbitrary mask
2487 tun_metadata58: arbitrary mask
2488 tun_metadata59: arbitrary mask
2489 tun_metadata60: arbitrary mask
2490 tun_metadata61: arbitrary mask
2491 tun_metadata62: arbitrary mask
2492 tun_metadata63: arbitrary mask
3c4e10fb
BP
2493 metadata: arbitrary mask
2494 in_port: exact match or wildcard
2495 in_port_oxm: exact match or wildcard
c61f3870 2496 actset_output: exact match or wildcard
3c4e10fb 2497 pkt_mark: arbitrary mask
07659514
JS
2498 ct_state: arbitrary mask
2499 ct_zone: exact match or wildcard
8e53fe8c 2500 ct_mark: arbitrary mask
9daf2348 2501 ct_label: arbitrary mask
daf4d3c1
JR
2502 ct_nw_proto: exact match or wildcard
2503 ct_nw_src: arbitrary mask
2504 ct_nw_dst: arbitrary mask
2505 ct_ipv6_src: arbitrary mask
2506 ct_ipv6_dst: arbitrary mask
2507 ct_tp_src: arbitrary mask
2508 ct_tp_dst: arbitrary mask
3c4e10fb
BP
2509 reg0: arbitrary mask
2510 reg1: arbitrary mask
2511 reg2: arbitrary mask
2512 reg3: arbitrary mask
2513 reg4: arbitrary mask
2514 reg5: arbitrary mask
2515 reg6: arbitrary mask
2516 reg7: arbitrary mask
847b8b02
JP
2517 reg8: arbitrary mask
2518 reg9: arbitrary mask
2519 reg10: arbitrary mask
2520 reg11: arbitrary mask
2521 reg12: arbitrary mask
2522 reg13: arbitrary mask
2523 reg14: arbitrary mask
2524 reg15: arbitrary mask
3c4e10fb
BP
2525 xreg0: arbitrary mask
2526 xreg1: arbitrary mask
2527 xreg2: arbitrary mask
2528 xreg3: arbitrary mask
847b8b02
JP
2529 xreg4: arbitrary mask
2530 xreg5: arbitrary mask
2531 xreg6: arbitrary mask
2532 xreg7: arbitrary mask
b23ada8e
JP
2533 xxreg0: arbitrary mask
2534 xxreg1: arbitrary mask
2535 xxreg2: arbitrary mask
2536 xxreg3: arbitrary mask
3c4e10fb
BP
2537 eth_src: arbitrary mask
2538 eth_dst: arbitrary mask
2539 eth_type: exact match or wildcard
2540 vlan_tci: arbitrary mask
2541 vlan_vid: arbitrary mask
2542 vlan_pcp: exact match or wildcard
2543 mpls_label: exact match or wildcard
2544 mpls_tc: exact match or wildcard
2545 mpls_bos: exact match or wildcard
bef3f465 2546 mpls_ttl: exact match or wildcard
3c4e10fb
BP
2547 ip_src: arbitrary mask
2548 ip_dst: arbitrary mask
2549 ipv6_src: arbitrary mask
2550 ipv6_dst: arbitrary mask
2551 ipv6_label: arbitrary mask
2552 nw_proto: exact match or wildcard
2553 nw_tos: exact match or wildcard
2554 ip_dscp: exact match or wildcard
2555 nw_ecn: exact match or wildcard
2556 nw_ttl: exact match or wildcard
2557 ip_frag: arbitrary mask
2558 arp_op: exact match or wildcard
2559 arp_spa: arbitrary mask
2560 arp_tpa: arbitrary mask
2561 arp_sha: arbitrary mask
2562 arp_tha: arbitrary mask
2563 tcp_src: arbitrary mask
2564 tcp_dst: arbitrary mask
2565 tcp_flags: arbitrary mask
2566 udp_src: arbitrary mask
2567 udp_dst: arbitrary mask
2568 sctp_src: arbitrary mask
2569 sctp_dst: arbitrary mask
2570 icmp_type: exact match or wildcard
2571 icmp_code: exact match or wildcard
2572 icmpv6_type: exact match or wildcard
2573 icmpv6_code: exact match or wildcard
2574 nd_target: arbitrary mask
2575 nd_sll: arbitrary mask
8811fc0a 2576 nd_tll: arbitrary mask
9b2b8497
VDA
2577 nd_reserved: exact match or wildcard
2578 nd_options_type: exact match or wildcard
3d2fbd70
JS
2579 nsh_flags: arbitrary mask
2580 nsh_mdtype: exact match or wildcard
2581 nsh_np: exact match or wildcard
2582 nsh_spi: exact match or wildcard
2583 nsh_si: exact match or wildcard
2584 nsh_c1: arbitrary mask
2585 nsh_c2: arbitrary mask
2586 nsh_c3: arbitrary mask
2587 nsh_c4: arbitrary mask
17553f27 2588 nsh_ttl: exact match or wildcard
8811fc0a 2589
4bc938cc 2590' "$1"
8811fc0a 2591}
8811fc0a 2592tail_tables() {
dccab9b1 2593echo ' table 253:
8811fc0a
BP
2594 metadata: match=0xffffffffffffffff write=0xffffffffffffffff
2595 max_entries=1000000
2596 instructions (table miss and others):
2597 instructions: meter,apply_actions,clear_actions,write_actions,write_metadata
2598 (same actions)
2599 (same matching)
2600'
2601}
4bc938cc 2602(head_table
dccab9b1 2603 printf ' tables 1...252: ditto\n\n'
8811fc0a
BP
2604 tail_tables) > expout
2605AT_CHECK([ovs-ofctl -O OpenFlow13 dump-table-features br0], [0], [expout])
3c4e10fb
BP
2606# Change the configuration.
2607AT_CHECK(
2608 [ovs-vsctl \
2609 -- --id=@t0 create Flow_Table name=main \
2610 -- --id=@t1 create Flow_Table flow-limit=1024 \
2611 -- set bridge br0 'flow_tables={1=@t1,0=@t0}' \
c724bd67 2612 | uuidfilt],
3c4e10fb
BP
2613 [0], [<0>
2614<1>
2615])
2616# Check that the configuration was updated.
4bc938cc 2617(head_table ' ("main")'
dccab9b1
BP
2618 echo ' table 1:
2619 metadata: match=0xffffffffffffffff write=0xffffffffffffffff
2620 max_entries=1024
2621 (same instructions)
2622 (same matching)
2623
2624 table 2:
2625 metadata: match=0xffffffffffffffff write=0xffffffffffffffff
2626 max_entries=1000000
2627 (same instructions)
2628 (same matching)
2629
2630 tables 3...252: ditto
2631'
8811fc0a
BP
2632 tail_tables) > expout
2633AT_CHECK([ovs-ofctl -O OpenFlow13 dump-table-features br0], [0], [expout])
3c4e10fb
BP
2634OVS_VSWITCHD_STOP
2635AT_CLEANUP
2636
4bc938cc
BP
2637AT_SETUP([ofproto - flow table names])
2638OVS_VSWITCHD_START
2639add_of_ports br0 1 2
4e413ac8
BP
2640
2641# Set a table name via OpenFlow 1.3 and one via OpenFlow 1.5.
2642AT_CHECK([ovs-ofctl -O OpenFlow13 mod-table br0 0 name:xyzzy])
2643AT_CHECK([ovs-ofctl -O OpenFlow15 mod-table br0 1 name:quux])
2644AT_CHECK([ovs-ofctl -O OpenFlow15 dump-table-features br0 |grep '^ table'],
2645 [0], [dnl
2646 table 0 ("xyzzy"):
2647 table 1 ("quux"): ditto
2648 tables 2...252: ditto
2649 table 253:
2650])
2651
2652# Set some table names via OVSDB.
4bc938cc
BP
2653AT_CHECK(
2654 [ovs-vsctl \
2655 -- --id=@t0 create Flow_Table name=zero \
2656 -- --id=@t1 create Flow_Table name=one \
2657 -- --id=@t2 create Flow_Table name=two \
2658 -- set bridge br0 'flow_tables={0=@t0,1=@t1,2=@t2}' \
2659 | uuidfilt],
2660 [0], [<0>
2661<1>
2662<2>
2663])
4e413ac8
BP
2664AT_CHECK([ovs-ofctl -O OpenFlow15 dump-table-features br0 |grep '^ table'],
2665 [0], [dnl
2666 table 0 ("zero"):
2667 table 1 ("one"): ditto
2668 table 2 ("two"): ditto
2669 tables 3...252: ditto
2670 table 253:
2671])
2672
2673# Check that flow table parsing and dumping uses the names.
4bc938cc
BP
2674AT_DATA([flows.txt], [dnl
2675table=zero in_port=p2 actions=p1,resubmit(,one)
2676table=one,in_port=p1,ip,actions=ct(table=two)
2677table=one,in_port=p1,arp,actions=goto_table(two)
2678])
2679AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
2680AT_CHECK([ovs-ofctl --names --no-stats dump-flows br0], [0], [dnl
2681 table=zero, in_port=p2 actions=output:p1,resubmit(,one)
2682 table=one, ip,in_port=p1 actions=ct(table=two)
2683 table=one, arp,in_port=p1 actions=resubmit(,two)
2684])
2685AT_CHECK([ovs-ofctl --no-names --no-stats dump-flows br0], [0], [dnl
2686 in_port=2 actions=output:1,resubmit(,1)
2687 table=1, ip,in_port=1 actions=ct(table=2)
2688 table=1, arp,in_port=1 actions=resubmit(,2)
2689])
4e413ac8
BP
2690
2691# Setting the same table names via OpenFlow 1.3 or OpenFlow 1.5 is a no-op.
2692AT_CHECK([ovs-ofctl -O OpenFlow13 mod-table br0 0 name:zero])
2693AT_CHECK([ovs-ofctl -O OpenFlow15 mod-table br0 1 name:one])
2694AT_CHECK([ovs-ofctl -O OpenFlow15 dump-table-features br0 |grep '^ table'],
2695 [0], [dnl
2696 table 0 ("zero"):
2697 table 1 ("one"): ditto
2698 table 2 ("two"): ditto
2699 tables 3...252: ditto
2700 table 253:
2701])
2702
2703# Setting different tables names via OpenFlow 1.3 or OpenFlow 1.5 yield errors.
2704AT_CHECK([ovs-ofctl -O OpenFlow13 mod-table br0 0 name:xyzzy], 1, [], [stderr])
2705AT_CHECK([head -1 stderr], [0], [OFPT_ERROR (OF1.3) (xid=0x5): OFPTFFC_EPERM
2706])
2707AT_CHECK([ovs-ofctl -O OpenFlow15 mod-table br0 1 name:quux], 1, [], [stderr])
2708AT_CHECK([head -1 stderr], [0], [OFPT_ERROR (OF1.5) (xid=0x5): OFPTFFC_EPERM
2709])
2710
2711# But we can still set table names for those not set via OVSDB.
2712AT_CHECK([ovs-ofctl -O OpenFlow13 mod-table br0 3 name:three])
2713AT_CHECK([ovs-ofctl -O OpenFlow15 dump-table-features br0 |grep '^ table'],
2714 [0], [dnl
2715 table 0 ("zero"):
2716 table 1 ("one"): ditto
2717 table 2 ("two"): ditto
2718 table 3 ("three"): ditto
2719 tables 4...252: ditto
2720 table 253:
2721])
2722
2723# Unsetting names via OVSDB then setting them via OpenFlow works too.
2724AT_CHECK([ovs-vsctl remove bridge br0 Flow_Table 2])
2725AT_CHECK([ovs-ofctl -O OpenFlow15 dump-table-features br0 |grep '^ table'],
2726 [0], [dnl
2727 table 0 ("zero"):
2728 table 1 ("one"): ditto
2729 table 2: ditto
2730 table 3 ("three"): ditto
2731 tables 4...252: ditto
2732 table 253:
2733])
2734AT_CHECK([ovs-ofctl -O OpenFlow13 mod-table br0 2 name:foobar])
2735AT_CHECK([ovs-ofctl -O OpenFlow15 dump-table-features br0 |grep '^ table'],
2736 [0], [dnl
2737 table 0 ("zero"):
2738 table 1 ("one"): ditto
2739 table 2 ("foobar"): ditto
2740 table 3 ("three"): ditto
2741 tables 4...252: ditto
2742 table 253:
2743])
2744
2745# We can clear names via OpenFlow, at least if they were set that way.
2746AT_CHECK([ovs-ofctl -O OpenFlow13 mod-table br0 2 name:])
2747AT_CHECK([ovs-ofctl -O OpenFlow15 dump-table-features br0 |grep '^ table'],
2748 [0], [dnl
2749 table 0 ("zero"):
2750 table 1 ("one"): ditto
2751 table 2: ditto
2752 table 3 ("three"): ditto
2753 tables 4...252: ditto
2754 table 253:
2755])
2756
4bc938cc
BP
2757OVS_VSWITCHD_STOP
2758AT_CLEANUP
2759
03c72922
BP
2760AT_SETUP([ofproto - table description (OpenFlow 1.4)])
2761OVS_VSWITCHD_START
2762(x=0
2763 while test $x -lt 254; do
2764 y=`expr $x + 1`
2765 echo " table $x:
bab86012
SJ
2766 eviction=off eviction_flags=OTHER|IMPORTANCE|LIFETIME
2767 vacancy=off"
03c72922
BP
2768 x=$y
2769 done) > expout
2770AT_CHECK([ovs-ofctl -O OpenFlow14 dump-table-desc br0 | sed '/^$/d
2771/^OFPST_TABLE_DESC/d'], [0], [expout])
2772
2773# Change the configuration.
2774AT_CHECK([ovs-ofctl -O Openflow14 mod-table br0 0 evict])
2775# Check that the configuration was updated.
2776mv expout orig-expout
2777sed -e '2s/eviction=off/eviction=on/' <orig-expout > expout
2778AT_CHECK([ovs-ofctl -O OpenFlow14 dump-table-desc br0 | sed '/^$/d
2779/^OFPST_TABLE_DESC/d'], [0], [expout])
de7d3c07
SJ
2780
2781AT_CHECK([ovs-ofctl -O Openflow14 mod-table br0 0 vacancy:20,80])
2782# Check that the configuration was updated.
2783mv expout orig-expout
6c6eedc5 2784sed -e '3s/vacancy=off/vacancy=on vacancy_down=20% vacancy_up=80% vacancy=100%/' <orig-expout > expout
de7d3c07
SJ
2785AT_CHECK([ovs-ofctl -O OpenFlow14 dump-table-desc br0 | sed '/^$/d
2786/^OFPST_TABLE_DESC/d'], [0], [expout])
03c72922
BP
2787OVS_VSWITCHD_STOP
2788AT_CLEANUP
2789
06f64d03 2790AT_SETUP([ofproto - hard limits on flow table size (OpenFlow 1.0)])
254750ce
BP
2791OVS_VSWITCHD_START
2792# Configure a maximum of 4 flows.
2793AT_CHECK(
2794 [ovs-vsctl \
2795 -- --id=@t0 create Flow_Table flow-limit=4 \
2796 -- set bridge br0 flow_tables:0=@t0 \
c724bd67 2797 | uuidfilt],
254750ce
BP
2798 [0], [<0>
2799])
2800# Add 4 flows.
2801for in_port in 1 2 3 4; do
2802 ovs-ofctl add-flow br0 in_port=$in_port,actions=drop
2803done
2804AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
2805 in_port=1 actions=drop
2806 in_port=2 actions=drop
2807 in_port=3 actions=drop
2808 in_port=4 actions=drop
2809NXST_FLOW reply:
2810])
2811# Adding another flow will be refused.
2812AT_CHECK([ovs-ofctl add-flow br0 in_port=5,actions=drop], [1], [], [stderr])
52c57cbb 2813AT_CHECK([ofctl_strip < stderr], [0],
be2b69d1 2814 [OFPT_ERROR: OFPFMFC_TABLE_FULL
52c57cbb 2815OFPT_FLOW_MOD: ADD in_port=5 actions=drop
254750ce
BP
2816])
2817# Also a mod-flow that would add a flow will be refused.
2818AT_CHECK([ovs-ofctl mod-flows br0 in_port=5,actions=drop], [1], [], [stderr])
52c57cbb 2819AT_CHECK([ofctl_strip < stderr], [0],
be2b69d1 2820 [OFPT_ERROR: OFPFMFC_TABLE_FULL
52c57cbb 2821OFPT_FLOW_MOD: MOD in_port=5 actions=drop
254750ce
BP
2822])
2823# Replacing or modifying an existing flow is allowed.
2824AT_CHECK([ovs-ofctl add-flow br0 in_port=4,actions=normal])
2825AT_CHECK([ovs-ofctl mod-flows br0 in_port=3,actions=output:1])
2826AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
2827 in_port=1 actions=drop
2828 in_port=2 actions=drop
2829 in_port=3 actions=output:1
2830 in_port=4 actions=NORMAL
2831NXST_FLOW reply:
2832])
2833OVS_VSWITCHD_STOP
2834AT_CLEANUP
2835
06f64d03 2836AT_SETUP([ofproto - hard limits on flow table size (OpenFlow 1.2)])
9dcd1c00
SH
2837OVS_VSWITCHD_START
2838# Configure a maximum of 4 flows.
2839AT_CHECK(
2840 [ovs-vsctl \
2841 -- --id=@t0 create Flow_Table flow-limit=4 \
2842 -- set bridge br0 flow_tables:0=@t0 \
c724bd67 2843 | uuidfilt],
9dcd1c00
SH
2844 [0], [<0>
2845])
2846# Add 4 flows.
2847for in_port in 1 2 3 4; do
2848 ovs-ofctl -O OpenFlow12 add-flow br0 in_port=$in_port,actions=drop
2849done
2850AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
2851 in_port=1 actions=drop
2852 in_port=2 actions=drop
2853 in_port=3 actions=drop
2854 in_port=4 actions=drop
2855OFPST_FLOW reply (OF1.2):
2856])
2857# Adding another flow will be refused.
2858AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 in_port=5,actions=drop], [1], [], [stderr])
52c57cbb 2859AT_CHECK([ofctl_strip < stderr], [0],
9dcd1c00 2860 [OFPT_ERROR (OF1.2): OFPFMFC_TABLE_FULL
52c57cbb 2861OFPT_FLOW_MOD (OF1.2): ADD in_port=5 actions=drop
9dcd1c00
SH
2862])
2863# Replacing or modifying an existing flow is allowed.
2864AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 in_port=4,actions=normal])
2865AT_CHECK([ovs-ofctl -O OpenFlow12 mod-flows br0 in_port=3,actions=output:1])
2866AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
2867 in_port=1 actions=drop
2868 in_port=2 actions=drop
2869 in_port=3 actions=output:1
2870 in_port=4 actions=NORMAL
2871OFPST_FLOW reply (OF1.2):
2872])
2873OVS_VSWITCHD_STOP
2874AT_CLEANUP
2875
2876AT_SETUP([ofproto - eviction upon table overflow (OpenFlow 1.0)])
254750ce
BP
2877OVS_VSWITCHD_START
2878# Configure a maximum of 4 flows.
2879AT_CHECK(
2880 [ovs-vsctl \
2881 -- --id=@t0 create Flow_Table flow-limit=4 overflow-policy=evict \
2882 -- set bridge br0 flow_tables:0=@t0 \
c724bd67 2883 | uuidfilt],
254750ce
BP
2884 [0], [<0>
2885])
2886# Add 4 flows.
2887for in_port in 4 3 2 1; do
2888 ovs-ofctl add-flow br0 idle_timeout=${in_port}0,in_port=$in_port,actions=drop
2889done
2890AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
b9718b7b
BP
2891 idle_timeout=10, in_port=1 actions=drop
2892 idle_timeout=20, in_port=2 actions=drop
2893 idle_timeout=30, in_port=3 actions=drop
2894 idle_timeout=40, in_port=4 actions=drop
254750ce
BP
2895NXST_FLOW reply:
2896])
2897# Adding another flow will cause the one that expires soonest to be evicted.
2898AT_CHECK([ovs-ofctl add-flow br0 in_port=5,actions=drop])
2899AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
b9718b7b
BP
2900 idle_timeout=20, in_port=2 actions=drop
2901 idle_timeout=30, in_port=3 actions=drop
2902 idle_timeout=40, in_port=4 actions=drop
254750ce
BP
2903 in_port=5 actions=drop
2904NXST_FLOW reply:
2905])
2906# A mod-flow that adds a flow also causes eviction, but replacing or
2907# modifying an existing flow doesn't.
2908AT_CHECK([ovs-ofctl mod-flows br0 in_port=6,actions=drop])
2909AT_CHECK([ovs-ofctl add-flow br0 in_port=4,actions=normal])
2910AT_CHECK([ovs-ofctl mod-flows br0 in_port=3,actions=output:1])
2911AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
b9718b7b 2912 idle_timeout=30, in_port=3 actions=output:1
254750ce
BP
2913 in_port=4 actions=NORMAL
2914 in_port=5 actions=drop
2915 in_port=6 actions=drop
2916NXST_FLOW reply:
2917])
2918# Flows with no timeouts at all cannot be evicted.
2919AT_CHECK([ovs-ofctl add-flow br0 in_port=7,actions=normal])
2920AT_CHECK([ovs-ofctl add-flow br0 in_port=8,actions=drop], [1], [], [stderr])
52c57cbb 2921AT_CHECK([ofctl_strip < stderr], [0],
be2b69d1 2922 [OFPT_ERROR: OFPFMFC_TABLE_FULL
52c57cbb 2923OFPT_FLOW_MOD: ADD in_port=8 actions=drop
254750ce
BP
2924])
2925AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
2926 in_port=4 actions=NORMAL
2927 in_port=5 actions=drop
2928 in_port=6 actions=drop
2929 in_port=7 actions=NORMAL
2930NXST_FLOW reply:
2931])
2932OVS_VSWITCHD_STOP
2933AT_CLEANUP
2934
9dcd1c00
SH
2935AT_SETUP([ofproto - eviction upon table overflow (OpenFlow 1.2)])
2936OVS_VSWITCHD_START
2937# Configure a maximum of 4 flows.
2938AT_CHECK(
2939 [ovs-vsctl \
2940 -- --id=@t0 create Flow_Table flow-limit=4 overflow-policy=evict \
2941 -- set bridge br0 flow_tables:0=@t0 \
c724bd67 2942 | uuidfilt],
9dcd1c00
SH
2943 [0], [<0>
2944])
2945# Add 4 flows.
2946for in_port in 4 3 2 1; do
2947 ovs-ofctl -O OpenFlow12 add-flow br0 idle_timeout=${in_port}0,in_port=$in_port,actions=drop
2948done
2949AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
2950 idle_timeout=10, in_port=1 actions=drop
2951 idle_timeout=20, in_port=2 actions=drop
2952 idle_timeout=30, in_port=3 actions=drop
2953 idle_timeout=40, in_port=4 actions=drop
2954OFPST_FLOW reply (OF1.2):
2955])
2956# Adding another flow will cause the one that expires soonest to be evicted.
2957AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 in_port=5,actions=drop])
2958AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
2959 idle_timeout=20, in_port=2 actions=drop
2960 idle_timeout=30, in_port=3 actions=drop
2961 idle_timeout=40, in_port=4 actions=drop
2962 in_port=5 actions=drop
2963OFPST_FLOW reply (OF1.2):
2964])
0746a84f 2965# In OpenFlow 1.2 a mod-flow does not ever add a flow and thus
9dcd1c00
SH
2966# has no effect on eviction
2967AT_CHECK([ovs-ofctl -O OpenFlow12 mod-flows br0 in_port=6,actions=drop])
2968AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 in_port=4,actions=normal])
2969AT_CHECK([ovs-ofctl -O OpenFlow12 mod-flows br0 in_port=3,actions=output:1])
2970AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
2971 idle_timeout=20, in_port=2 actions=drop
2972 idle_timeout=30, in_port=3 actions=output:1
2973 in_port=4 actions=NORMAL
2974 in_port=5 actions=drop
2975OFPST_FLOW reply (OF1.2):
2976])
2977# Flows with no timeouts at all cannot be evicted.
2978AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 in_port=6,actions=drop])
2979AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 in_port=7,actions=normal])
2980AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 in_port=8,actions=drop], [1], [], [stderr])
52c57cbb 2981AT_CHECK([ofctl_strip < stderr], [0],
9dcd1c00 2982 [OFPT_ERROR (OF1.2): OFPFMFC_TABLE_FULL
52c57cbb 2983OFPT_FLOW_MOD (OF1.2): ADD in_port=8 actions=drop
9dcd1c00
SH
2984])
2985AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
2986 in_port=4 actions=NORMAL
2987 in_port=5 actions=drop
2988 in_port=6 actions=drop
2989 in_port=7 actions=NORMAL
2990OFPST_FLOW reply (OF1.2):
2991])
2992OVS_VSWITCHD_STOP
2993AT_CLEANUP
2994
f70b94de
BP
2995AT_SETUP([ofproto - eviction using importance upon table overflow (OpenFlow 1.4)])
2996OVS_VSWITCHD_START
2997# Configure a maximum of 4 flows.
2998AT_CHECK(
2999 [ovs-vsctl \
82c22d34 3000 -- --id=@t0 create Flow_Table name=evict flow-limit=4 \
f70b94de 3001 -- set bridge br0 flow_tables:0=@t0 \
c724bd67 3002 | uuidfilt],
f70b94de
BP
3003 [0], [<0>
3004])
82c22d34
BP
3005# Use mod-table to turn on eviction just to demonstrate that it works.
3006AT_CHECK([ovs-ofctl -O OpenFlow14 mod-table br0 0 evict])
f70b94de
BP
3007# Add 4 flows.
3008for in_port in 4 3 2 1; do
3009 ovs-ofctl -O Openflow14 add-flow br0 importance=$((in_port + 30)),priority=$((in_port + 5)),hard_timeout=$((in_port + 500)),actions=drop
3010done
3011AT_CHECK([ovs-ofctl -O Openflow14 dump-flows br0 | ofctl_strip | sort], [0], [dnl
3012 hard_timeout=501, importance=31, priority=6 actions=drop
3013 hard_timeout=502, importance=32, priority=7 actions=drop
3014 hard_timeout=503, importance=33, priority=8 actions=drop
3015 hard_timeout=504, importance=34, priority=9 actions=drop
3016OFPST_FLOW reply (OF1.4):
3017])
3018# Adding another flow will cause the one with lowest importance to be evicted.
3019AT_CHECK([ovs-ofctl -O Openflow14 add-flow br0 hard_timeout=505,importance=35,priority=10,in_port=2,actions=drop])
3020AT_CHECK([ovs-ofctl -O Openflow14 dump-flows br0 | ofctl_strip | sort], [0], [dnl
3021 hard_timeout=502, importance=32, priority=7 actions=drop
3022 hard_timeout=503, importance=33, priority=8 actions=drop
3023 hard_timeout=504, importance=34, priority=9 actions=drop
3024 hard_timeout=505, importance=35, priority=10,in_port=2 actions=drop
3025OFPST_FLOW reply (OF1.4):
3026])
3027# Disable the Eviction configuration.
82c22d34 3028AT_CHECK([ovs-ofctl -O OpenFlow14 mod-table br0 0 noevict])
f70b94de
BP
3029# Adding another flow will cause the system to give error for FULL TABLE.
3030AT_CHECK([ovs-ofctl -O Openflow14 add-flow br0 hard_timeout=506,importance=36,priority=11,actions=drop],[1], [], [stderr])
52c57cbb 3031AT_CHECK([ofctl_strip < stderr], [0],
f70b94de 3032 [OFPT_ERROR (OF1.4): OFPFMFC_TABLE_FULL
52c57cbb 3033OFPT_FLOW_MOD (OF1.4): ADD priority=11 hard:506 importance:36 actions=drop
f70b94de
BP
3034])
3035#Dump flows. It should show only the old values
3036AT_CHECK([ovs-ofctl -O Openflow14 dump-flows br0 | ofctl_strip | sort], [0], [dnl
3037 hard_timeout=502, importance=32, priority=7 actions=drop
3038 hard_timeout=503, importance=33, priority=8 actions=drop
3039 hard_timeout=504, importance=34, priority=9 actions=drop
3040 hard_timeout=505, importance=35, priority=10,in_port=2 actions=drop
3041OFPST_FLOW reply (OF1.4):
3042])
3043# mod-flow that would modify a flow will be done successfully.
3044AT_CHECK([ovs-ofctl -O Openflow14 mod-flows br0 in_port=2,actions=NORMAL])
3045AT_CHECK([ovs-ofctl -O Openflow14 dump-flows br0 | ofctl_strip | sort], [0], [dnl
3046 hard_timeout=502, importance=32, priority=7 actions=drop
3047 hard_timeout=503, importance=33, priority=8 actions=drop
3048 hard_timeout=504, importance=34, priority=9 actions=drop
3049 hard_timeout=505, importance=35, priority=10,in_port=2 actions=NORMAL
3050OFPST_FLOW reply (OF1.4):
3051])
3052# Also a mod-flow that would add a flow will be refused.
3053AT_CHECK([ovs-ofctl mod-flows br0 in_port=5,actions=drop], [1], [], [stderr])
52c57cbb 3054AT_CHECK([ofctl_strip < stderr], [0],
f70b94de 3055 [OFPT_ERROR: OFPFMFC_TABLE_FULL
52c57cbb 3056OFPT_FLOW_MOD: MOD in_port=5 actions=drop
f70b94de
BP
3057])
3058OVS_VSWITCHD_STOP
3059AT_CLEANUP
3060
9dcd1c00 3061AT_SETUP([ofproto - eviction upon table overflow, with fairness (OpenFlow 1.0)])
254750ce
BP
3062OVS_VSWITCHD_START
3063# Configure a maximum of 4 flows.
3064AT_CHECK(
3065 [ovs-vsctl \
3066 -- --id=@t0 create Flow_Table name=evict flow-limit=4 \
3067 overflow-policy=evict \
3068 groups='"NXM_OF_IN_PORT[[]]"' \
3069 -- set bridge br0 flow_tables:0=@t0 \
c724bd67 3070 | uuidfilt],
254750ce
BP
3071 [0], [<0>
3072])
3073# Add 4 flows.
3074ovs-ofctl add-flows br0 - <<EOF
3075idle_timeout=10 in_port=2 dl_src=00:44:55:66:77:88 actions=drop
3076idle_timeout=20 in_port=1 dl_src=00:11:22:33:44:55 actions=drop
3077idle_timeout=30 in_port=1 dl_src=00:22:33:44:55:66 actions=drop
3078idle_timeout=40 in_port=1 dl_src=00:33:44:55:66:77 actions=drop
3079EOF
3080AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
b9718b7b
BP
3081 idle_timeout=10, in_port=2,dl_src=00:44:55:66:77:88 actions=drop
3082 idle_timeout=20, in_port=1,dl_src=00:11:22:33:44:55 actions=drop
3083 idle_timeout=30, in_port=1,dl_src=00:22:33:44:55:66 actions=drop
3084 idle_timeout=40, in_port=1,dl_src=00:33:44:55:66:77 actions=drop
254750ce
BP
3085NXST_FLOW reply:
3086])
3087# Adding another flow will cause the one that expires soonest within
3088# the largest group (those with in_port=1) to be evicted. In this
3089# case this is not the same as the one that expires soonest overall
3090# (which is what makes the test interesting):
3091AT_CHECK([ovs-ofctl add-flow br0 in_port=2,dl_src=00:55:66:77:88:99,actions=drop])
3092AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
b9718b7b
BP
3093 idle_timeout=10, in_port=2,dl_src=00:44:55:66:77:88 actions=drop
3094 idle_timeout=30, in_port=1,dl_src=00:22:33:44:55:66 actions=drop
3095 idle_timeout=40, in_port=1,dl_src=00:33:44:55:66:77 actions=drop
254750ce
BP
3096 in_port=2,dl_src=00:55:66:77:88:99 actions=drop
3097NXST_FLOW reply:
3098])
3099# Enlarge the flow limit, change the eviction policy back to strictly
3100# based on expiration, and and add some flows.
3101AT_CHECK([ovs-vsctl set Flow_Table evict groups='[[]]' flow-limit=7])
3102ovs-ofctl add-flows br0 - <<EOF
3103idle_timeout=50 in_port=2 dl_src=00:66:77:88:99:aa actions=drop
3104idle_timeout=60 in_port=2 dl_src=00:77:88:99:aa:bb actions=drop
3105idle_timeout=70 in_port=2 dl_src=00:88:99:aa:bb:cc actions=drop
3106EOF
3107AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
b9718b7b
BP
3108 idle_timeout=10, in_port=2,dl_src=00:44:55:66:77:88 actions=drop
3109 idle_timeout=30, in_port=1,dl_src=00:22:33:44:55:66 actions=drop
3110 idle_timeout=40, in_port=1,dl_src=00:33:44:55:66:77 actions=drop
3111 idle_timeout=50, in_port=2,dl_src=00:66:77:88:99:aa actions=drop
3112 idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=drop
3113 idle_timeout=70, in_port=2,dl_src=00:88:99:aa:bb:cc actions=drop
254750ce
BP
3114 in_port=2,dl_src=00:55:66:77:88:99 actions=drop
3115NXST_FLOW reply:
3116])
3117# Adding another flow will cause the one that expires soonest overall
3118# to be evicted.
3119AT_CHECK([ovs-ofctl add-flow br0 'idle_timeout=80 in_port=2 dl_src=00:99:aa:bb:cc:dd actions=drop'])
3120AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
b9718b7b
BP
3121 idle_timeout=30, in_port=1,dl_src=00:22:33:44:55:66 actions=drop
3122 idle_timeout=40, in_port=1,dl_src=00:33:44:55:66:77 actions=drop
3123 idle_timeout=50, in_port=2,dl_src=00:66:77:88:99:aa actions=drop
3124 idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=drop
3125 idle_timeout=70, in_port=2,dl_src=00:88:99:aa:bb:cc actions=drop
3126 idle_timeout=80, in_port=2,dl_src=00:99:aa:bb:cc:dd actions=drop
254750ce
BP
3127 in_port=2,dl_src=00:55:66:77:88:99 actions=drop
3128NXST_FLOW reply:
3129])
3130# Reducing the flow limit also causes the flows that expire soonest
3131# overall to be evicted.
3132AT_CHECK([ovs-vsctl set Flow_Table evict flow-limit=4])
3133AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
b9718b7b
BP
3134 idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=drop
3135 idle_timeout=70, in_port=2,dl_src=00:88:99:aa:bb:cc actions=drop
3136 idle_timeout=80, in_port=2,dl_src=00:99:aa:bb:cc:dd actions=drop
254750ce
BP
3137 in_port=2,dl_src=00:55:66:77:88:99 actions=drop
3138NXST_FLOW reply:
3139])
3140OVS_VSWITCHD_STOP
3141AT_CLEANUP
80d5aefd 3142
9dcd1c00
SH
3143AT_SETUP([ofproto - eviction upon table overflow, with fairness (OpenFlow 1.2)])
3144OVS_VSWITCHD_START
3145# Configure a maximum of 4 flows.
3146AT_CHECK(
3147 [ovs-vsctl \
3148 -- --id=@t0 create Flow_Table name=evict flow-limit=4 \
3149 overflow-policy=evict \
3150 groups='"NXM_OF_IN_PORT[[]]"' \
3151 -- set bridge br0 flow_tables:0=@t0 \
c724bd67 3152 | uuidfilt],
9dcd1c00
SH
3153 [0], [<0>
3154])
3155# Add 4 flows.
3156ovs-ofctl -O OpenFlow12 add-flows br0 - <<EOF
3157idle_timeout=10 in_port=2 dl_src=00:44:55:66:77:88 actions=drop
3158idle_timeout=20 in_port=1 dl_src=00:11:22:33:44:55 actions=drop
3159idle_timeout=30 in_port=1 dl_src=00:22:33:44:55:66 actions=drop
3160idle_timeout=40 in_port=1 dl_src=00:33:44:55:66:77 actions=drop
3161EOF
3162AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
3163 idle_timeout=10, in_port=2,dl_src=00:44:55:66:77:88 actions=drop
3164 idle_timeout=20, in_port=1,dl_src=00:11:22:33:44:55 actions=drop
3165 idle_timeout=30, in_port=1,dl_src=00:22:33:44:55:66 actions=drop
3166 idle_timeout=40, in_port=1,dl_src=00:33:44:55:66:77 actions=drop
3167OFPST_FLOW reply (OF1.2):
3168])
3169# Adding another flow will cause the one that expires soonest within
3170# the largest group (those with in_port=1) to be evicted. In this
3171# case this is not the same as the one that expires soonest overall
3172# (which is what makes the test interesting):
3173AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 in_port=2,dl_src=00:55:66:77:88:99,actions=drop])
3174AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
3175 idle_timeout=10, in_port=2,dl_src=00:44:55:66:77:88 actions=drop
3176 idle_timeout=30, in_port=1,dl_src=00:22:33:44:55:66 actions=drop
3177 idle_timeout=40, in_port=1,dl_src=00:33:44:55:66:77 actions=drop
3178 in_port=2,dl_src=00:55:66:77:88:99 actions=drop
3179OFPST_FLOW reply (OF1.2):
3180])
3181# Enlarge the flow limit, change the eviction policy back to strictly
3182# based on expiration, and and add some flows.
3183AT_CHECK([ovs-vsctl set Flow_Table evict groups='[[]]' flow-limit=7])
3184ovs-ofctl -O OpenFlow12 add-flows br0 - <<EOF
3185idle_timeout=50 in_port=2 dl_src=00:66:77:88:99:aa actions=drop
3186idle_timeout=60 in_port=2 dl_src=00:77:88:99:aa:bb actions=drop
3187idle_timeout=70 in_port=2 dl_src=00:88:99:aa:bb:cc actions=drop
3188EOF
3189AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
3190 idle_timeout=10, in_port=2,dl_src=00:44:55:66:77:88 actions=drop
3191 idle_timeout=30, in_port=1,dl_src=00:22:33:44:55:66 actions=drop
3192 idle_timeout=40, in_port=1,dl_src=00:33:44:55:66:77 actions=drop
3193 idle_timeout=50, in_port=2,dl_src=00:66:77:88:99:aa actions=drop
3194 idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=drop
3195 idle_timeout=70, in_port=2,dl_src=00:88:99:aa:bb:cc actions=drop
3196 in_port=2,dl_src=00:55:66:77:88:99 actions=drop
3197OFPST_FLOW reply (OF1.2):
3198])
3199# Adding another flow will cause the one that expires soonest overall
3200# to be evicted.
3201AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 'idle_timeout=80 in_port=2 dl_src=00:99:aa:bb:cc:dd actions=drop'])
3202AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
3203 idle_timeout=30, in_port=1,dl_src=00:22:33:44:55:66 actions=drop
3204 idle_timeout=40, in_port=1,dl_src=00:33:44:55:66:77 actions=drop
3205 idle_timeout=50, in_port=2,dl_src=00:66:77:88:99:aa actions=drop
3206 idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=drop
3207 idle_timeout=70, in_port=2,dl_src=00:88:99:aa:bb:cc actions=drop
3208 idle_timeout=80, in_port=2,dl_src=00:99:aa:bb:cc:dd actions=drop
3209 in_port=2,dl_src=00:55:66:77:88:99 actions=drop
3210OFPST_FLOW reply (OF1.2):
3211])
3212# Reducing the flow limit also causes the flows that expire soonest
3213# overall to be evicted.
3214AT_CHECK([ovs-vsctl set Flow_Table evict flow-limit=4])
3215AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
3216 idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=drop
3217 idle_timeout=70, in_port=2,dl_src=00:88:99:aa:bb:cc actions=drop
3218 idle_timeout=80, in_port=2,dl_src=00:99:aa:bb:cc:dd actions=drop
3219 in_port=2,dl_src=00:55:66:77:88:99 actions=drop
3220OFPST_FLOW reply (OF1.2):
3221])
3222OVS_VSWITCHD_STOP
3223AT_CLEANUP
3224
6d56c1f1
K
3225AT_SETUP([ofproto - eviction upon table overflow, with modified hard timeout])
3226OVS_VSWITCHD_START
3227# Configure a maximum of 4 flows.
3228AT_CHECK(
3229 [ovs-vsctl \
3230 -- --id=@t0 create Flow_Table flow-limit=4 overflow-policy=evict \
3231 -- set bridge br0 flow_tables:0=@t0 \
c724bd67 3232 | uuidfilt],
6d56c1f1
K
3233 [0], [<0>
3234])
337a3866 3235ovs-appctl time/stop
6d56c1f1
K
3236# Add 4 flows.
3237for in_port in 4 3 2 1; do
337a3866 3238 ovs-ofctl add-flow br0 hard_timeout=$((10 + in_port * 3)),in_port=$in_port,actions=drop
6d56c1f1
K
3239done
3240AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
337a3866
YT
3241 hard_timeout=13, in_port=1 actions=drop
3242 hard_timeout=16, in_port=2 actions=drop
3243 hard_timeout=19, in_port=3 actions=drop
3244 hard_timeout=22, in_port=4 actions=drop
6d56c1f1
K
3245NXST_FLOW reply:
3246])
3247# Sleep and modify the one that expires soonest
337a3866 3248ovs-appctl time/warp 5000
6d56c1f1 3249AT_CHECK([ovs-ofctl mod-flows br0 in_port=1,actions=drop])
337a3866
YT
3250# At this point the table would looks like:
3251# in_port seconds to expire
3252# 1 13
3253# 2 11
3254# 3 14
3255# 4 17
3256ovs-appctl time/warp 2000
6d56c1f1
K
3257# Adding another flow will cause the one that expires soonest to be evicted.
3258AT_CHECK([ovs-ofctl add-flow br0 in_port=5,actions=drop])
3259AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
337a3866
YT
3260 hard_timeout=13, in_port=1 actions=drop
3261 hard_timeout=19, in_port=3 actions=drop
3262 hard_timeout=22, in_port=4 actions=drop
6d56c1f1
K
3263 in_port=5 actions=drop
3264NXST_FLOW reply:
3265])
3266OVS_VSWITCHD_STOP
3267AT_CLEANUP
3268
3269AT_SETUP([ofproto - eviction upon table overflow, with modified idle timeout])
3270OVS_VSWITCHD_START([add-port br0 p1 -- set interface p1 type=dummy ofport_request=1])
3271# Configure a maximum of 4 flows.
3272AT_CHECK(
3273 [ovs-vsctl \
3274 -- --id=@t0 create Flow_Table flow-limit=4 overflow-policy=evict \
3275 -- set bridge br0 flow_tables:0=@t0 \
c724bd67 3276 | uuidfilt],
6d56c1f1
K
3277 [0], [<0>
3278])
3279# Add 4 flows.
3280for in_port in 4 3 2 1; do
337a3866 3281 ovs-ofctl add-flow br0 idle_timeout=$((10 + in_port * 3)),in_port=$in_port,actions=drop
6d56c1f1 3282done
337a3866 3283ovs-appctl time/stop
6d56c1f1 3284AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
337a3866
YT
3285 idle_timeout=13, in_port=1 actions=drop
3286 idle_timeout=16, in_port=2 actions=drop
3287 idle_timeout=19, in_port=3 actions=drop
3288 idle_timeout=22, in_port=4 actions=drop
6d56c1f1
K
3289NXST_FLOW reply:
3290])
3291# Sleep and receive on the flow that expires soonest
337a3866 3292ovs-appctl time/warp 5000
6d56c1f1 3293AT_CHECK([ovs-appctl netdev-dummy/receive p1 'in_port(1)'])
337a3866
YT
3294# At this point the table would looks like:
3295# in_port seconds to expire
3296# 1 13
3297# 2 11
3298# 3 14
3299# 4 17
3300ovs-appctl time/warp 2000
6d56c1f1
K
3301# Adding another flow will cause the one that expires soonest to be evicted.
3302AT_CHECK([ovs-ofctl add-flow br0 in_port=5,actions=drop])
3303AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
337a3866
YT
3304 idle_timeout=19, in_port=3 actions=drop
3305 idle_timeout=22, in_port=4 actions=drop
6d56c1f1 3306 in_port=5 actions=drop
efe179e0 3307 n_packets=1, n_bytes=14, idle_timeout=13, in_port=1 actions=drop
6d56c1f1
K
3308NXST_FLOW reply:
3309])
3310OVS_VSWITCHD_STOP
3311AT_CLEANUP
3312
9dcd1c00 3313AT_SETUP([ofproto - asynchronous message control (OpenFlow 1.0)])
c9c8c8a1 3314OVS_VSWITCHD_START([set bridge br0 other_config:hwaddr=00:01:02:03:04:05])
6409e008 3315AT_CHECK([ovs-ofctl -P standard monitor br0 --detach --no-chdir --pidfile])
80d5aefd
BP
3316check_async () {
3317 printf '\n\n--- check_async %d ---\n\n\n' $1
3318 shift
3319
6fc67c4f 3320 ovs-appctl -t ovs-ofctl ofctl/barrier
80d5aefd
BP
3321 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
3322 : > expout
3323
a7349929 3324 # OFPT_PACKET_IN, OFPR_ACTION (controller_id=0)
7f05e7ab 3325 ovs-ofctl -v packet-out br0 controller controller '0001020304050010203040501234'
80d5aefd 3326 if test X"$1" = X"OFPR_ACTION"; then shift;
7f05e7ab 3327 echo >>expout "OFPT_PACKET_IN: total_len=14 in_port=CONTROLLER (via action) data_len=14 (unbuffered)
e6d9ab56 3328vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1234"
80d5aefd
BP
3329 fi
3330
a7349929 3331 # OFPT_PACKET_IN, OFPR_NO_MATCH (controller_id=123)
7f05e7ab 3332 ovs-ofctl -v packet-out br0 controller 'controller(reason=no_match,id=123)' '0001020304050010203040501234'
a7349929 3333 if test X"$1" = X"OFPR_NO_MATCH"; then shift;
7f05e7ab 3334 echo >>expout "OFPT_PACKET_IN: total_len=14 in_port=CONTROLLER (via no_match) data_len=14 (unbuffered)
e6d9ab56 3335vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1234"
a7349929
BP
3336 fi
3337
3338 # OFPT_PACKET_IN, OFPR_INVALID_TTL (controller_id=0)
6dd3c787 3339 ovs-ofctl packet-out br0 "in_port=controller packet=002583dfb4000026b98cb0f908004500003eb7e200000011339bac11370dac100002d7730035002b8f6d86fb0100000100000000000006626c702d7873066e696369726103636f6d00000f00 actions=dec_ttl"
80d5aefd 3340 if test X"$1" = X"OFPR_INVALID_TTL"; then shift;
7f05e7ab 3341 echo >>expout "OFPT_PACKET_IN: total_len=76 in_port=CONTROLLER (via invalid_ttl) data_len=76 (unbuffered)
e6d9ab56 3342udp,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
3343 fi
3344
3345 # OFPT_PORT_STATUS, OFPPR_ADD
e1b1d06a 3346 ovs-vsctl add-port br0 test -- set Interface test type=dummy ofport_request=1
80d5aefd
BP
3347 if test X"$1" = X"OFPPR_ADD"; then shift;
3348 echo >>expout "OFPT_PORT_STATUS: ADD: 1(test): addr:aa:55:aa:55:00:0x
c9c8c8a1
BP
3349 config: 0
3350 state: 0
d02a5f8e 3351 speed: 0 Mbps now, 0 Mbps max"
80d5aefd
BP
3352 fi
3353
3354 # OFPT_PORT_STATUS, OFPPR_DELETE
3355 ovs-vsctl del-port br0 test
3356 if test X"$1" = X"OFPPR_DELETE"; then shift;
3357 echo >>expout "OFPT_PORT_STATUS: DEL: 1(test): addr:aa:55:aa:55:00:0x
c9c8c8a1
BP
3358 config: 0
3359 state: 0
d02a5f8e 3360 speed: 0 Mbps now, 0 Mbps max"
80d5aefd
BP
3361 fi
3362
3363 # OFPT_FLOW_REMOVED, OFPRR_DELETE
3364 ovs-ofctl add-flow br0 send_flow_rem,actions=drop
3365 ovs-ofctl --strict del-flows br0 ''
3366 if test X"$1" = X"OFPRR_DELETE"; then shift;
3367 echo >>expout "OFPT_FLOW_REMOVED: reason=delete"
3368 fi
3369 AT_FAIL_IF([test X"$1" != X])
3370
93358108 3371 OVS_WAIT_UNTIL([test `wc -l < "monitor.log"` -ge `wc -l < "expout"`])
80d5aefd
BP
3372
3373 AT_CHECK(
3374 [[sed '
3375s/ (xid=0x[0-9a-fA-F]*)//
3376s/ *duration.*//
3377s/00:0.$/00:0x/' < monitor.log]],
3378 [0], [expout])
3379}
3380
3381# It's a service connection so initially there should be no async messages.
3382check_async 1
3383
99811d07 3384# Set miss_send_len to 128, turning on packet-ins for our service connection.
80d5aefd
BP
3385ovs-appctl -t ovs-ofctl ofctl/send 0109000c0123456700000080
3386check_async 2 OFPR_ACTION OFPPR_ADD OFPPR_DELETE OFPRR_DELETE
3387
3388# Set miss_send_len to 128 and enable invalid_ttl.
3389ovs-appctl -t ovs-ofctl ofctl/send 0109000c0123456700040080
3390check_async 3 OFPR_ACTION OFPR_INVALID_TTL OFPPR_ADD OFPPR_DELETE OFPRR_DELETE
3391
3392# Become slave, which should disable everything except port status.
3393ovs-appctl -t ovs-ofctl ofctl/send 0104001400000002000023200000000a00000002
3394check_async 4 OFPPR_ADD OFPPR_DELETE
3395
3396# Use NXT_SET_ASYNC_CONFIG to enable a patchwork of asynchronous messages.
3397ovs-appctl -t ovs-ofctl ofctl/send 01040028000000020000232000000013000000020000000500000005000000020000000200000005
3398check_async 5 OFPR_INVALID_TTL OFPPR_DELETE OFPRR_DELETE
3399
a7349929
BP
3400# Set controller ID 123.
3401ovs-appctl -t ovs-ofctl ofctl/send 01040018000000030000232000000014000000000000007b
3402check_async 6 OFPR_NO_MATCH OFPPR_DELETE OFPRR_DELETE
3403
3404# Restore controller ID 0.
3405ovs-appctl -t ovs-ofctl ofctl/send 010400180000000300002320000000140000000000000000
3406
80d5aefd
BP
3407# Become master.
3408ovs-appctl -t ovs-ofctl ofctl/send 0104001400000002000023200000000a00000001
a7349929 3409check_async 7 OFPR_ACTION OFPPR_ADD
80d5aefd 3410
d9c8c57c 3411OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
94c33672 3412OVS_VSWITCHD_STOP
80d5aefd 3413AT_CLEANUP
751c7785 3414
9dcd1c00
SH
3415AT_SETUP([ofproto - asynchronous message control (OpenFlow 1.2)])
3416OVS_VSWITCHD_START
6409e008 3417AT_CHECK([ovs-ofctl -O OpenFlow12 -P standard monitor br0 --detach --no-chdir --pidfile])
9dcd1c00
SH
3418check_async () {
3419 printf '\n\n--- check_async %d ---\n\n\n' $1
3420 INDEX=$1
3421 shift
3422
3423 ovs-appctl -t ovs-ofctl ofctl/barrier
3424 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
3425 : > expout
3426
3427 # OFPT_PACKET_IN, OFPR_ACTION (controller_id=0)
3428 ovs-ofctl -O OpenFlow12 -v packet-out br0 none controller '0001020304050010203040501234'
3429 if test X"$1" = X"OFPR_ACTION"; then shift;
3430 echo >>expout "OFPT_PACKET_IN (OF1.2): total_len=14 in_port=ANY (via action) data_len=14 (unbuffered)
e6d9ab56 3431vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1234"
9dcd1c00
SH
3432 fi
3433
3434 # OFPT_PACKET_IN, OFPR_NO_MATCH (controller_id=123)
3435 ovs-ofctl -O OpenFlow12 -v packet-out br0 none 'controller(reason=no_match,id=123)' '0001020304050010203040501234'
3436 if test X"$1" = X"OFPR_NO_MATCH"; then shift;
3437 echo >>expout "OFPT_PACKET_IN (OF1.2): total_len=14 in_port=ANY (via no_match) data_len=14 (unbuffered)
e6d9ab56 3438vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1234"
9dcd1c00
SH
3439 fi
3440
3441 # OFPT_PACKET_IN, OFPR_INVALID_TTL (controller_id=0)
fa8d9001 3442 ovs-ofctl -O OpenFlow12 packet-out br0 none dec_ttl '002583dfb4000026b98cb0f908004500003eb7e200000011339bac11370dac100002d7730035002b8f6d86fb0100000100000000000006626c702d7873066e696369726103636f6d00000f00'
9dcd1c00
SH
3443 if test X"$1" = X"OFPR_INVALID_TTL"; then shift;
3444 echo >>expout "OFPT_PACKET_IN (OF1.2): total_len=76 in_port=ANY (via invalid_ttl) data_len=76 (unbuffered)
e6d9ab56 3445udp,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
3446 fi
3447
3448 # OFPT_PORT_STATUS, OFPPR_ADD
3449 ovs-vsctl add-port br0 test -- set Interface test type=dummy
3450 if test X"$1" = X"OFPPR_ADD"; then shift;
3451 echo >>expout "OFPT_PORT_STATUS (OF1.2): ADD: ${INDEX}(test): addr:aa:55:aa:55:00:0x
c9c8c8a1
BP
3452 config: 0
3453 state: 0
3454 speed: 0 Mbps now, 0 Mbps max
3455OFPT_PORT_STATUS (OF1.2): MOD: ${INDEX}(test): addr:aa:55:aa:55:00:0x
3456 config: 0
3457 state: LIVE
9dcd1c00
SH
3458 speed: 0 Mbps now, 0 Mbps max"
3459 fi
3460
3461 # OFPT_PORT_STATUS, OFPPR_DELETE
3462 ovs-vsctl del-port br0 test
3463 if test X"$1" = X"OFPPR_DELETE"; then shift;
3464 echo >>expout "OFPT_PORT_STATUS (OF1.2): DEL: ${INDEX}(test): addr:aa:55:aa:55:00:0x
c9c8c8a1
BP
3465 config: 0
3466 state: LIVE
9dcd1c00
SH
3467 speed: 0 Mbps now, 0 Mbps max"
3468 fi
3469
3470 # OFPT_FLOW_REMOVED, OFPRR_DELETE
3471 ovs-ofctl -O OpenFlow12 add-flow br0 send_flow_rem,actions=drop
3472 ovs-ofctl -O OpenFlow12 --strict del-flows br0 ''
3473 if test X"$1" = X"OFPRR_DELETE"; then shift;
3474 echo >>expout "OFPT_FLOW_REMOVED (OF1.2): reason=delete table_id=0"
3475 fi
3476 AT_FAIL_IF([test X"$1" != X])
3477
93358108 3478 OVS_WAIT_UNTIL([test `wc -l < "monitor.log"` -ge `wc -l < "expout"`])
9dcd1c00
SH
3479
3480 AT_CHECK(
3481 [[sed '
3482s/ (xid=0x[0-9a-fA-F]*)//
3483s/ *duration.*//
3484s/00:0.$/00:0x/' < monitor.log]],
3485 [0], [expout])
3486}
3487
3488# It's a service connection so initially there should be no async messages.
3489check_async 1
3490
3491# Set miss_send_len to 128, turning on packet-ins for our service connection.
3492ovs-appctl -t ovs-ofctl ofctl/send 0309000c0123456700000080
3493check_async 2 OFPR_ACTION OFPPR_ADD OFPPR_DELETE OFPRR_DELETE
3494
3495# Set miss_send_len to 128 and enable invalid_ttl.
3496ovs-appctl -t ovs-ofctl ofctl/send 0309000c0123456700040080
3497check_async 3 OFPR_ACTION OFPR_INVALID_TTL OFPPR_ADD OFPPR_DELETE OFPRR_DELETE
3498
6ea4776b
JR
3499# Become slave (OF 1.2), which should disable everything except port status.
3500ovs-appctl -t ovs-ofctl ofctl/send 031800180000000200000003000000000000000000000001
9dcd1c00
SH
3501check_async 4 OFPPR_ADD OFPPR_DELETE
3502
3503# Use NXT_SET_ASYNC_CONFIG to enable a patchwork of asynchronous messages.
3504ovs-appctl -t ovs-ofctl ofctl/send 03040028000000020000232000000013000000020000000500000005000000020000000200000005
3505check_async 5 OFPR_INVALID_TTL OFPPR_DELETE OFPRR_DELETE
3506
3507# Set controller ID 123.
3508ovs-appctl -t ovs-ofctl ofctl/send 03040018000000030000232000000014000000000000007b
3509check_async 6 OFPR_NO_MATCH OFPPR_DELETE OFPRR_DELETE
3510
3511# Restore controller ID 0.
3512ovs-appctl -t ovs-ofctl ofctl/send 030400180000000300002320000000140000000000000000
3513
6ea4776b
JR
3514# Become master (OF 1.2).
3515ovs-appctl -t ovs-ofctl ofctl/send 031800180000000400000002000000000000000000000002
9dcd1c00
SH
3516check_async 7 OFPR_ACTION OFPPR_ADD
3517
d9c8c57c 3518OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
9dcd1c00
SH
3519OVS_VSWITCHD_STOP
3520AT_CLEANUP
3521
b21eb1da 3522AT_SETUP([ofproto - asynchronous message control (OpenFlow 1.3)])
e19a6769
YHW
3523OVS_VSWITCHD_START([dnl
3524 add-port br0 p1 -- set Interface p1 type=dummy ofport_request=10
3525])
6409e008 3526AT_CHECK([ovs-ofctl -O OpenFlow13 -P standard monitor br0 --detach --no-chdir --pidfile])
b21eb1da
JR
3527check_async () {
3528 printf '\n\n--- check_async %d ---\n\n\n' $1
3529 INDEX=$1
3530 shift
3531
3532 ovs-appctl -t ovs-ofctl ofctl/barrier
3533 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
3534 : > expout
3535
3536 # OFPT_PACKET_IN, OFPR_ACTION (controller_id=0)
e19a6769 3537 # OFPR_ACTION_SET is treated as OFPR_ACTION in OpenFlow 1.3
b21eb1da 3538 ovs-ofctl -O OpenFlow13 -v packet-out br0 none controller '0001020304050010203040501234'
e19a6769
YHW
3539 ovs-ofctl -O OpenFlow13 add-flow br0 'in_port=10 actions=write_actions(output(CONTROLLER))'
3540 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
3541 if test X"$1" = X"OFPR_ACTION"; then shift;
3542 echo >>expout "OFPT_PACKET_IN (OF1.3): total_len=14 in_port=ANY (via action) data_len=14 (unbuffered)
e19a6769
YHW
3543vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1234"
3544 echo >>expout "OFPT_PACKET_IN (OF1.3): cookie=0x0 total_len=14 in_port=10 (via action) data_len=14 (unbuffered)
e6d9ab56 3545vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1234"
b21eb1da
JR
3546 fi
3547
3548 # OFPT_PACKET_IN, OFPR_NO_MATCH (controller_id=123)
3549 ovs-ofctl -O OpenFlow13 -v packet-out br0 none 'controller(reason=no_match,id=123)' '0001020304050010203040501234'
3550 if test X"$1" = X"OFPR_NO_MATCH"; then shift;
3551 echo >>expout "OFPT_PACKET_IN (OF1.3): total_len=14 in_port=ANY (via no_match) data_len=14 (unbuffered)
e6d9ab56 3552vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1234"
b21eb1da
JR
3553 fi
3554
3555 # OFPT_PACKET_IN, OFPR_INVALID_TTL (controller_id=0)
fa8d9001 3556 ovs-ofctl -O OpenFlow13 packet-out br0 none dec_ttl '002583dfb4000026b98cb0f908004500003eb7e200000011339bac11370dac100002d7730035002b8f6d86fb0100000100000000000006626c702d7873066e696369726103636f6d00000f00'
b21eb1da
JR
3557 if test X"$1" = X"OFPR_INVALID_TTL"; then shift;
3558 echo >>expout "OFPT_PACKET_IN (OF1.3): total_len=76 in_port=ANY (via invalid_ttl) data_len=76 (unbuffered)
e6d9ab56 3559udp,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
3560 fi
3561
3562 # OFPT_PORT_STATUS, OFPPR_ADD
3563 ovs-vsctl add-port br0 test -- set Interface test type=dummy
3564 if test X"$1" = X"OFPPR_ADD"; then shift;
3565 echo >>expout "OFPT_PORT_STATUS (OF1.3): ADD: ${INDEX}(test): addr:aa:55:aa:55:00:0x
c9c8c8a1
BP
3566 config: 0
3567 state: 0
3568 speed: 0 Mbps now, 0 Mbps max
3569OFPT_PORT_STATUS (OF1.3): MOD: ${INDEX}(test): addr:aa:55:aa:55:00:0x
3570 config: 0
3571 state: LIVE
b21eb1da
JR
3572 speed: 0 Mbps now, 0 Mbps max"
3573 fi
3574
3575 # OFPT_PORT_STATUS, OFPPR_DELETE
3576 ovs-vsctl del-port br0 test
3577 if test X"$1" = X"OFPPR_DELETE"; then shift;
3578 echo >>expout "OFPT_PORT_STATUS (OF1.3): DEL: ${INDEX}(test): addr:aa:55:aa:55:00:0x
c9c8c8a1
BP
3579 config: 0
3580 state: LIVE
b21eb1da
JR
3581 speed: 0 Mbps now, 0 Mbps max"
3582 fi
3583
3584 # OFPT_FLOW_REMOVED, OFPRR_DELETE
3585 ovs-ofctl -O OpenFlow13 add-flow br0 send_flow_rem,actions=drop
3586 ovs-ofctl -O OpenFlow13 --strict del-flows br0 ''
3587 if test X"$1" = X"OFPRR_DELETE"; then shift;
3588 echo >>expout "OFPT_FLOW_REMOVED (OF1.3): reason=delete table_id=0"
3589 fi
cc40d06b
SH
3590
3591 # OFPT_FLOW_REMOVED, OFPRR_GROUP_DELETE
3592 ovs-ofctl -O OpenFlow13 add-group br0 group_id=1234,type=all,bucket=output:10
3593 ovs-ofctl -O OpenFlow13 add-flow br0 send_flow_rem,actions=group:1234
3594 ovs-ofctl -O OpenFlow13 --strict del-groups br0 group_id=1234
75754d04
JP
3595 if test X"$1" = X"OFPRR_GROUP_DELETE"; then shift;
3596 echo >>expout "OFPT_FLOW_REMOVED (OF1.3): reason=group_delete table_id=0"
cc40d06b
SH
3597 fi
3598
b21eb1da
JR
3599 AT_FAIL_IF([test X"$1" != X])
3600
93358108 3601 OVS_WAIT_UNTIL([test `wc -l < "monitor.log"` -ge `wc -l < "expout"`])
b21eb1da
JR
3602
3603 AT_CHECK(
3604 [[sed '
3605s/ (xid=0x[0-9a-fA-F]*)//
3606s/ *duration.*//
3607s/00:0.$/00:0x/' < monitor.log]],
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.
3615ovs-appctl -t ovs-ofctl ofctl/send 0409000c0123456700000080
75754d04 3616check_async 2 OFPR_ACTION OFPPR_ADD OFPPR_DELETE OFPRR_DELETE OFPRR_GROUP_DELETE
b21eb1da
JR
3617
3618# Become slave (OF 1.3), which should disable everything except port status.
3619ovs-appctl -t ovs-ofctl ofctl/send 041800180000000200000003000000000000000000000001
3620check_async 3 OFPPR_ADD OFPPR_DELETE
3621
3622# Use OF 1.3 OFPT_SET_ASYNC to enable a patchwork of asynchronous messages.
75754d04
JP
3623ovs-appctl -t ovs-ofctl ofctl/send 041c00200000000200000002000000050000000500000002000000020000000d
3624check_async 4 OFPR_INVALID_TTL OFPPR_DELETE OFPRR_DELETE OFPRR_GROUP_DELETE
b21eb1da
JR
3625
3626# Set controller ID 123.
3627ovs-appctl -t ovs-ofctl ofctl/send 04040018000000030000232000000014000000000000007b
75754d04 3628check_async 5 OFPR_NO_MATCH OFPPR_DELETE OFPRR_DELETE OFPRR_GROUP_DELETE
b21eb1da
JR
3629
3630# Restore controller ID 0.
3631ovs-appctl -t ovs-ofctl ofctl/send 040400180000000300002320000000140000000000000000
3632
3633# Become master (OF 1.3).
3634ovs-appctl -t ovs-ofctl ofctl/send 041800180000000400000002000000000000000000000002
3635check_async 6 OFPR_ACTION OFPPR_ADD
3636
d9c8c57c 3637OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
b21eb1da
JR
3638OVS_VSWITCHD_STOP
3639AT_CLEANUP
3640
98090482 3641AT_SETUP([ofproto - asynchronous message control (OpenFlow 1.4)])
e19a6769
YHW
3642OVS_VSWITCHD_START([dnl
3643 add-port br0 p1 -- set Interface p1 type=dummy ofport_request=10
3644])
6409e008 3645AT_CHECK([ovs-ofctl -O OpenFlow14 -P standard monitor br0 --detach --no-chdir --pidfile])
98090482
NR
3646check_async () {
3647 printf '\n\n--- check_async %d ---\n\n\n' $1
3648 INDEX=$1
3649 shift
3650
3651 ovs-appctl -t ovs-ofctl ofctl/barrier
3652 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
3653 : > expout
3654
331c07ac 3655 # OFPT_PACKET_IN, OFPR_PACKET_OUT (controller_id=0)
98090482 3656 ovs-ofctl -O OpenFlow14 -v packet-out br0 none controller '0001020304050010203040501234'
331c07ac
YHW
3657 if test X"$1" = X"OFPR_PACKET_OUT"; then shift;
3658 echo >>expout "OFPT_PACKET_IN (OF1.4): total_len=14 in_port=ANY (via packet_out) data_len=14 (unbuffered)
98090482
NR
3659vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1234"
3660 fi
3661
e19a6769
YHW
3662 # OFPT_PACKET_IN, OFPR_ACTION_SET (controller_id=0)
3663 ovs-ofctl -O OpenFlow14 add-flow br0 'in_port=10 actions=write_actions(output(CONTROLLER))'
3664 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)'
3665 if test X"$1" = X"OFPR_ACTION_SET"; then shift;
3666 echo >>expout "OFPT_PACKET_IN (OF1.4): cookie=0x0 total_len=14 in_port=10 (via action_set) data_len=14 (unbuffered)
3667vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1234"
3668 fi
3669
98090482
NR
3670 # OFPT_PACKET_IN, OFPR_NO_MATCH (controller_id=123)
3671 ovs-ofctl -O OpenFlow14 -v packet-out br0 none 'controller(reason=no_match,id=123)' '0001020304050010203040501234'
3672 if test X"$1" = X"OFPR_NO_MATCH"; then shift;
3673 echo >>expout "OFPT_PACKET_IN (OF1.4): total_len=14 in_port=ANY (via no_match) data_len=14 (unbuffered)
3674vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1234"
3675 fi
3676
3677 # OFPT_PACKET_IN, OFPR_INVALID_TTL (controller_id=0)
3678 ovs-ofctl -O OpenFlow14 packet-out br0 none dec_ttl '002583dfb4000026b98cb0f908004500003eb7e200000011339bac11370dac100002d7730035002b8f6d86fb0100000100000000000006626c702d7873066e696369726103636f6d00000f00'
3679 if test X"$1" = X"OFPR_INVALID_TTL"; then shift;
3680 echo >>expout "OFPT_PACKET_IN (OF1.4): total_len=76 in_port=ANY (via invalid_ttl) data_len=76 (unbuffered)
3681udp,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"
3682 fi
3683
3684# OFPT_PORT_STATUS, OFPPR_ADD
3685 ovs-vsctl add-port br0 test -- set Interface test type=dummy
3686 if test X"$1" = X"OFPPR_ADD"; then shift;
3687 echo >>expout "OFPT_PORT_STATUS (OF1.4): ADD: ${INDEX}(test): addr:aa:55:aa:55:00:0x
c9c8c8a1
BP
3688 config: 0
3689 state: 0
3690 speed: 0 Mbps now, 0 Mbps max
3691OFPT_PORT_STATUS (OF1.4): MOD: ${INDEX}(test): addr:aa:55:aa:55:00:0x
3692 config: 0
3693 state: LIVE
98090482
NR
3694 speed: 0 Mbps now, 0 Mbps max"
3695 fi
3696
3697 # OFPT_PORT_STATUS, OFPPR_MODIFY
c9c8c8a1 3698 ovs-ofctl -O OpenFlow14 -vwarn mod-port br0 test down
98090482
NR
3699 if test X"$1" = X"OFPPR_MODIFY"; then shift;
3700 echo >>expout "OFPT_PORT_STATUS (OF1.4): MOD: ${INDEX}(test): addr:aa:55:aa:55:00:0x
c9c8c8a1
BP
3701 config: PORT_DOWN
3702 state: 0
98090482
NR
3703 speed: 0 Mbps now, 0 Mbps max
3704OFPT_PORT_STATUS (OF1.4): MOD: ${INDEX}(test): addr:aa:55:aa:55:00:0x
c9c8c8a1
BP
3705 config: PORT_DOWN
3706 state: LINK_DOWN
98090482
NR
3707 speed: 0 Mbps now, 0 Mbps max"
3708 fi
3709
3710 # OFPT_PORT_STATUS, OFPPR_DELETE
3711 ovs-vsctl del-port br0 test
3712 if test X"$1" = X"OFPPR_DELETE"; then shift;
3713 echo >>expout "OFPT_PORT_STATUS (OF1.4): DEL: ${INDEX}(test): addr:aa:55:aa:55:00:0x
c9c8c8a1
BP
3714 config: PORT_DOWN
3715 state: LINK_DOWN
98090482
NR
3716 speed: 0 Mbps now, 0 Mbps max"
3717 fi
3718
3719 # OFPT_FLOW_REMOVED, OFPRR_DELETE
3720 ovs-ofctl -O OpenFlow14 add-flow br0 send_flow_rem,actions=drop
3721 ovs-ofctl -O OpenFlow14 --strict del-flows br0 ''
3722 if test X"$1" = X"OFPRR_DELETE"; then shift;
3723 echo >>expout "OFPT_FLOW_REMOVED (OF1.4): reason=delete table_id=0"
3724 fi
3725
6c6eedc5 3726 # OFPT_FLOW_REMOVED, OFPRR_GROUP_DELETE
98090482
NR
3727 ovs-ofctl -O OpenFlow14 add-group br0 group_id=1234,type=all,bucket=output:10
3728 ovs-ofctl -O OpenFlow14 add-flow br0 send_flow_rem,actions=group:1234
3729 ovs-ofctl -O OpenFlow14 --strict del-groups br0 group_id=1234
3730 if test X"$1" = X"OFPRR_GROUP_DELETE"; then shift;
3731 echo >>expout "OFPT_FLOW_REMOVED (OF1.4): reason=group_delete table_id=0"
3732 fi
3733
6c6eedc5
SJ
3734 # OFPT_TABLE_STATUS, OFPTR_VACANCY_UP
3735 if test X"$1" = X"OFPTR_VACANCY_UP"; then shift;
3736 ovs-vsctl -- --id=@t1 create Flow_Table flow-limit=10 -- set bridge br0 flow_tables:1=@t1
3737
5a0e4aec
BP
3738 # Turn on vacancy events, then add flows until we're full.
3739 # With initial vacancy of 100% and vacancy_up of 80%, so that
3740 # vacancy >= vacancy_up, this enables VACANY_DOWN events, so
3741 # we get a single such message when vacancy dips below 20%.
6c6eedc5
SJ
3742 ovs-ofctl -O OpenFlow14 mod-table br0 1 vacancy:20,80
3743 ovs-ofctl -O OpenFlow14 add-flow br0 table=1,in_port=1,actions=2
3744 ovs-ofctl -O OpenFlow14 add-flow br0 table=1,in_port=2,actions=2
3745 ovs-ofctl -O OpenFlow14 add-flow br0 table=1,in_port=3,actions=2
3746 ovs-ofctl -O OpenFlow14 add-flow br0 table=1,in_port=4,actions=2
3747 ovs-ofctl -O OpenFlow14 add-flow br0 table=1,in_port=5,actions=2
3748 ovs-ofctl -O OpenFlow14 add-flow br0 table=1,in_port=6,actions=2
3749 ovs-ofctl -O OpenFlow14 add-flow br0 table=1,in_port=7,actions=2
3750 ovs-ofctl -O OpenFlow14 add-flow br0 table=1,in_port=8,actions=2
3751 ovs-ofctl -O OpenFlow14 add-flow br0 table=1,in_port=9,actions=2
3752 ovs-ofctl -O OpenFlow14 add-flow br0 table=1,in_port=10,actions=2
3753 echo >>expout "OFPT_TABLE_STATUS (OF1.4): reason=VACANCY_DOWN
3754table_desc:-
3755 table 1:
3756 eviction=off eviction_flags=OTHER|IMPORTANCE|LIFETIME
3757 vacancy=on vacancy_down=20% vacancy_up=80% vacancy=10%"
3758 # Then delete flows until we're empty. Sending the
5a0e4aec
BP
3759 # VACANCY_DOWN message enabled VACANCY_UP events, so we get a
3760 # single such message when vacancy rises above 80%.
6c6eedc5
SJ
3761 ovs-ofctl -O OpenFlow14 del-flows br0 table=1,in_port=1
3762 ovs-ofctl -O OpenFlow14 del-flows br0 table=1,in_port=2
3763 ovs-ofctl -O OpenFlow14 del-flows br0 table=1,in_port=3
3764 ovs-ofctl -O OpenFlow14 del-flows br0 table=1,in_port=4
3765 ovs-ofctl -O OpenFlow14 del-flows br0 table=1,in_port=5
3766 ovs-ofctl -O OpenFlow14 del-flows br0 table=1,in_port=6
3767 ovs-ofctl -O OpenFlow14 del-flows br0 table=1,in_port=7
3768 ovs-ofctl -O OpenFlow14 del-flows br0 table=1,in_port=8
3769 ovs-ofctl -O OpenFlow14 del-flows br0 table=1,in_port=9
3770 ovs-ofctl -O OpenFlow14 del-flows br0 table=1,in_port=10
3771 echo >>expout "OFPT_TABLE_STATUS (OF1.4): reason=VACANCY_UP
3772table_desc:-
3773 table 1:
3774 eviction=off eviction_flags=OTHER|IMPORTANCE|LIFETIME
3775 vacancy=on vacancy_down=20% vacancy_up=80% vacancy=90%"
3776
3777 # Now approach vacancy from the other direction. First
5a0e4aec
BP
3778 # disable vacancy events. With initial vacancy of 70%, so
3779 # that vacancy < vacancy_up, this enables VACANCY_UP events.
3780 # That means that filling up the table generates no message,
3781 # but deleting all the flows generates VACANCY_UP at the point
3782 # vacancy rises above 80%.
6c6eedc5
SJ
3783 ovs-ofctl -O OpenFlow14 mod-table br0 1 novacancy
3784 ovs-ofctl -O OpenFlow14 add-flow br0 table=1,in_port=1,actions=2
3785 ovs-ofctl -O OpenFlow14 add-flow br0 table=1,in_port=2,actions=2
3786 ovs-ofctl -O OpenFlow14 add-flow br0 table=1,in_port=3,actions=2
3787 ovs-ofctl -O OpenFlow14 mod-table br0 1 vacancy:20,80
3788 ovs-ofctl -O OpenFlow14 add-flow br0 table=1,in_port=4,actions=2
3789 ovs-ofctl -O OpenFlow14 add-flow br0 table=1,in_port=5,actions=2
3790 ovs-ofctl -O OpenFlow14 add-flow br0 table=1,in_port=6,actions=2
3791 ovs-ofctl -O OpenFlow14 add-flow br0 table=1,in_port=7,actions=2
3792 ovs-ofctl -O OpenFlow14 add-flow br0 table=1,in_port=8,actions=2
3793 ovs-ofctl -O OpenFlow14 add-flow br0 table=1,in_port=9,actions=2
3794 ovs-ofctl -O OpenFlow14 add-flow br0 table=1,in_port=10,actions=2
3795 ovs-ofctl -O OpenFlow14 del-flows br0 table=1,in_port=1
3796 ovs-ofctl -O OpenFlow14 del-flows br0 table=1,in_port=2
3797 ovs-ofctl -O OpenFlow14 del-flows br0 table=1,in_port=3
3798 ovs-ofctl -O OpenFlow14 del-flows br0 table=1,in_port=4
3799 ovs-ofctl -O OpenFlow14 del-flows br0 table=1,in_port=5
3800 ovs-ofctl -O OpenFlow14 del-flows br0 table=1,in_port=6
3801 ovs-ofctl -O OpenFlow14 del-flows br0 table=1,in_port=7
3802 ovs-ofctl -O OpenFlow14 del-flows br0 table=1,in_port=8
3803 ovs-ofctl -O OpenFlow14 del-flows br0 table=1,in_port=9
3804 ovs-ofctl -O OpenFlow14 del-flows br0 table=1,in_port=10
3805 echo >>expout "OFPT_TABLE_STATUS (OF1.4): reason=VACANCY_UP
3806table_desc:-
3807 table 1:
3808 eviction=off eviction_flags=OTHER|IMPORTANCE|LIFETIME
3809 vacancy=on vacancy_down=20% vacancy_up=80% vacancy=90%"
3810 fi
3811
98090482
NR
3812 AT_FAIL_IF([test X"$1" != X])
3813
93358108 3814 OVS_WAIT_UNTIL([test `wc -l < "monitor.log"` -ge `wc -l < "expout"`])
98090482
NR
3815
3816 AT_CHECK(
3817 [[sed '
3818s/ (xid=0x[0-9a-fA-F]*)//
3819s/ *duration.*//
3820s/00:0.$/00:0x/' < monitor.log]],
3821 [0], [expout])
3822}
3823
3824# It's a service connection so initially there should be no async messages.
3825check_async 1
3826
3827# Set miss_send_len to 128, turning on packet-ins for our service connection.
3828ovs-appctl -t ovs-ofctl ofctl/send 0509000c0123456700000080
331c07ac 3829check_async 2 OFPR_PACKET_OUT OFPR_ACTION_SET OFPPR_ADD OFPPR_MODIFY OFPPR_DELETE OFPRR_DELETE OFPRR_GROUP_DELETE
98090482
NR
3830
3831# Become slave (OF 1.4), which should disable everything except port status.
3832ovs-appctl -t ovs-ofctl ofctl/send 051800180000000200000003000000000000000000000001
3833check_async 3 OFPPR_ADD OFPPR_MODIFY OFPPR_DELETE
3834
3835# Use OF 1.4 OFPT_SET_ASYNC to enable a patchwork of asynchronous messages.
331c07ac 3836ovs-appctl -t ovs-ofctl ofctl/send 051c0040000000020000000800000005000100080000002000020008000000020003000800000005000400080000001c00050008000000050008000800000018
6c6eedc5 3837check_async 4 OFPR_INVALID_TTL OFPPR_DELETE OFPRR_DELETE OFPRR_GROUP_DELETE OFPTR_VACANCY_UP
98090482
NR
3838
3839# Set controller ID 123.
3840ovs-appctl -t ovs-ofctl ofctl/send 05040018000000030000232000000014000000000000007b
3841check_async 5 OFPR_NO_MATCH OFPPR_DELETE OFPRR_DELETE OFPRR_GROUP_DELETE
3842
3843# Restore controller ID 0.
3844ovs-appctl -t ovs-ofctl ofctl/send 050400180000000300002320000000140000000000000000
3845
3846# Become master (OF 1.4).
3847ovs-appctl -t ovs-ofctl ofctl/send 051800180000000400000002000000000000000000000002
331c07ac 3848check_async 6 OFPR_PACKET_OUT OFPPR_ADD OFPPR_MODIFY OFPRR_DELETE
98090482 3849
d9c8c57c 3850OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
98090482
NR
3851OVS_VSWITCHD_STOP
3852AT_CLEANUP
3853
ebeae5db
JT
3854AT_SETUP([ofproto - asynchronous message control (OpenFlow 1.5)])
3855OVS_VSWITCHD_START
6409e008 3856AT_CHECK([ovs-ofctl -O OpenFlow15 -P standard monitor br0 --detach --no-chdir --pidfile])
ebeae5db
JT
3857check_async () {
3858 printf '\n\n--- check_async %d ---\n\n\n' $1
3859 INDEX=$1
3860 shift
3861
3862 ovs-appctl -t ovs-ofctl ofctl/barrier
3863 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
3864 : > expout
3865
3866 # Other tests are not working with OF 1.5, and message
3867 # format may change, so leave them out.
3868
3869 # OFPT_PORT_STATUS, OFPPR_ADD
3870 ovs-vsctl add-port br0 test -- set Interface test type=dummy
3871 if test X"$1" = X"OFPPR_ADD"; then shift;
3872 echo >>expout "OFPT_PORT_STATUS (OF1.5): ADD: ${INDEX}(test): addr:aa:55:aa:55:00:0x
c9c8c8a1
BP
3873 config: 0
3874 state: 0
3875 speed: 0 Mbps now, 0 Mbps max
3876OFPT_PORT_STATUS (OF1.5): MOD: ${INDEX}(test): addr:aa:55:aa:55:00:0x
3877 config: 0
3878 state: LIVE
ebeae5db
JT
3879 speed: 0 Mbps now, 0 Mbps max"
3880 fi
3881
3882 # OFPT_PORT_STATUS, OFPPR_MODIFY
c9c8c8a1 3883 ovs-ofctl -O OpenFlow15 -vwarn mod-port br0 test down
ebeae5db
JT
3884 if test X"$1" = X"OFPPR_MODIFY"; then shift;
3885 echo >>expout "OFPT_PORT_STATUS (OF1.5): MOD: ${INDEX}(test): addr:aa:55:aa:55:00:0x
c9c8c8a1
BP
3886 config: PORT_DOWN
3887 state: 0
ebeae5db 3888 speed: 0 Mbps now, 0 Mbps max
c9c8c8a1
BP
3889OFPT_PORT_STATUS (OF1.5): MOD: ${INDEX}(test): addr:aa:55:aa:55:00:0x
3890 config: PORT_DOWN
3891 state: LINK_DOWN
ebeae5db
JT
3892 speed: 0 Mbps now, 0 Mbps max"
3893 fi
3894
3895 # OFPT_PORT_STATUS, OFPPR_DELETE
3896 ovs-vsctl del-port br0 test
3897 if test X"$1" = X"OFPPR_DELETE"; then shift;
3898 echo >>expout "OFPT_PORT_STATUS (OF1.5): DEL: ${INDEX}(test): addr:aa:55:aa:55:00:0x
c9c8c8a1
BP
3899 config: PORT_DOWN
3900 state: LINK_DOWN
ebeae5db
JT
3901 speed: 0 Mbps now, 0 Mbps max"
3902 fi
3903
3904 AT_FAIL_IF([test X"$1" != X])
3905
93358108 3906 OVS_WAIT_UNTIL([test `wc -l < "monitor.log"` -ge `wc -l < "expout"`])
ebeae5db
JT
3907
3908 AT_CHECK(
3909 [[sed '
3910s/ (xid=0x[0-9a-fA-F]*)//
3911s/ *duration.*//
3912s/00:0.$/00:0x/' < monitor.log]],
3913 [0], [expout])
3914}
3915
3916# It's a service connection so initially there should be no async messages.
3917check_async 1
3918
3919# If we don't set this, async messages are not received.
3920# Set miss_send_len to 128, turning on packet-ins for our service connection.
3921ovs-appctl -t ovs-ofctl ofctl/send 0609000c0123456700000080
3922check_async 2 OFPPR_ADD OFPPR_MODIFY OFPPR_DELETE
3923
3924# Set-async has changed in OF 1.4 and is not yet implemented.
3925
d9c8c57c 3926OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
ebeae5db
JT
3927OVS_VSWITCHD_STOP
3928AT_CLEANUP
3929
6ea4776b
JR
3930dnl This test checks that the role request/response messaging works
3931dnl and that generation_id is handled properly.
3932AT_SETUP([ofproto - controller role (OpenFlow 1.2)])
3933OVS_VSWITCHD_START
53eb8cb8 3934on_exit 'kill `cat c1.pid c2.pid`'
6751a4b4
BP
3935
3936# Start two ovs-ofctl controller processes.
3937AT_CAPTURE_FILE([monitor1.log])
3938AT_CAPTURE_FILE([expout1])
3939AT_CAPTURE_FILE([experr1])
3940AT_CAPTURE_FILE([monitor2.log])
3941AT_CAPTURE_FILE([expout2])
3942AT_CAPTURE_FILE([experr2])
3943for i in 1 2; do
56120500 3944 AT_CHECK([ovs-ofctl -O OpenFlow12 monitor br0 --detach --no-chdir --pidfile=c$i.pid --unixctl=c$i])
6751a4b4
BP
3945 ovs-appctl -t `pwd`/c$i ofctl/barrier
3946 ovs-appctl -t `pwd`/c$i ofctl/set-output-file monitor$i.log
3947 : > expout$i
3948 : > experr$i
3949
3950 # find out current role
3951 ovs-appctl -t `pwd`/c$i ofctl/send 031800180000000200000000000000000000000000000000
3952 echo >>experr$i "send: OFPT_ROLE_REQUEST (OF1.2): role=nochange"
3953 echo >>expout$i "OFPT_ROLE_REPLY (OF1.2): role=equal"
3954done
6ea4776b 3955
6751a4b4
BP
3956# controller 1: Become slave (generation_id is initially undefined, so
3957# 2^63+2 should not be stale)
3958ovs-appctl -t `pwd`/c1 ofctl/send 031800180000000300000003000000008000000000000002
3959echo >>experr1 "send: OFPT_ROLE_REQUEST (OF1.2): role=slave generation_id=9223372036854775810"
3960echo >>expout1 "OFPT_ROLE_REPLY (OF1.2): role=slave generation_id=9223372036854775810"
3961
3962# controller 2: Become master.
3963ovs-appctl -t `pwd`/c2 ofctl/send 031800180000000300000002000000008000000000000003
3964echo >>experr2 "send: OFPT_ROLE_REQUEST (OF1.2): role=master generation_id=9223372036854775811"
3965echo >>expout2 "OFPT_ROLE_REPLY (OF1.2): role=master generation_id=9223372036854775811"
3966
3967# controller 1: Try to become the master using a stale generation ID
3968ovs-appctl -t `pwd`/c1 ofctl/send 031800180000000400000002000000000000000000000003
3969echo >>experr1 "send: OFPT_ROLE_REQUEST (OF1.2): role=master generation_id=3"
3970echo >>expout1 "OFPT_ERROR (OF1.2): OFPRRFC_STALE"
3971echo >>expout1 "OFPT_ROLE_REQUEST (OF1.2): role=master generation_id=3"
3972
3973# controller 1: Become master using a valid generation ID
3974ovs-appctl -t `pwd`/c1 ofctl/send 031800180000000500000002000000000000000000000001
3975echo >>experr1 "send: OFPT_ROLE_REQUEST (OF1.2): role=master generation_id=1"
3976echo >>expout1 "OFPT_ROLE_REPLY (OF1.2): role=master generation_id=1"
3977
3978for i in 1 2; do
3979 ovs-appctl -t `pwd`/c$i ofctl/barrier
3980 echo >>expout$i "OFPT_BARRIER_REPLY (OF1.2):"
3981done
6ea4776b 3982
6751a4b4
BP
3983# Check output.
3984for i in 1 2; do
3985 cp expout$i expout
8a32aaa5 3986 AT_CHECK([grep -v '^send:' monitor$i.log | strip_xids], [0], [expout])
6751a4b4 3987 cp experr$i expout
8a32aaa5 3988 AT_CHECK([grep '^send:' monitor$i.log | strip_xids], [0], [expout])
6751a4b4
BP
3989done
3990OVS_VSWITCHD_STOP
3991AT_CLEANUP
6ea4776b 3992
6751a4b4
BP
3993dnl This test checks that the role request/response messaging works,
3994dnl that generation_id is handled properly, and that role status update
3995dnl messages are sent when a controller's role gets changed from master
3996dnl to slave.
3997AT_SETUP([ofproto - controller role (OpenFlow 1.4)])
3998OVS_VSWITCHD_START
53eb8cb8 3999on_exit 'kill `cat c1.pid c2.pid`'
6751a4b4
BP
4000
4001# Start two ovs-ofctl controller processes.
4002AT_CAPTURE_FILE([monitor1.log])
4003AT_CAPTURE_FILE([expout1])
4004AT_CAPTURE_FILE([experr1])
4005AT_CAPTURE_FILE([monitor2.log])
4006AT_CAPTURE_FILE([expout2])
4007AT_CAPTURE_FILE([experr2])
4008for i in 1 2; do
56120500 4009 AT_CHECK([ovs-ofctl -O OpenFlow14 monitor br0 --detach --no-chdir --pidfile=c$i.pid --unixctl=c$i])
6751a4b4
BP
4010 ovs-appctl -t `pwd`/c$i ofctl/barrier
4011 ovs-appctl -t `pwd`/c$i ofctl/set-output-file monitor$i.log
4012 : > expout$i
4013 : > experr$i
4014
4015 # find out current role
4016 ovs-appctl -t `pwd`/c$i ofctl/send 051800180000000200000000000000000000000000000000
4017 echo >>experr$i "send: OFPT_ROLE_REQUEST (OF1.4): role=nochange"
4018 echo >>expout$i "OFPT_ROLE_REPLY (OF1.4): role=equal"
4019done
6ea4776b 4020
6751a4b4
BP
4021# controller 1: Become slave (generation_id is initially undefined, so
4022# 2^63+2 should not be stale)
4023ovs-appctl -t `pwd`/c1 ofctl/send 051800180000000300000003000000008000000000000002
4024echo >>experr1 "send: OFPT_ROLE_REQUEST (OF1.4): role=slave generation_id=9223372036854775810"
4025echo >>expout1 "OFPT_ROLE_REPLY (OF1.4): role=slave generation_id=9223372036854775810"
4026
4027# controller 2: Become master.
4028ovs-appctl -t `pwd`/c2 ofctl/send 051800180000000300000002000000008000000000000003
4029echo >>experr2 "send: OFPT_ROLE_REQUEST (OF1.4): role=master generation_id=9223372036854775811"
4030echo >>expout2 "OFPT_ROLE_REPLY (OF1.4): role=master generation_id=9223372036854775811"
4031
4032# controller 1: Try to become the master using a stale generation ID
4033ovs-appctl -t `pwd`/c1 ofctl/send 051800180000000400000002000000000000000000000003
4034echo >>experr1 "send: OFPT_ROLE_REQUEST (OF1.4): role=master generation_id=3"
4035echo >>expout1 "OFPT_ERROR (OF1.4): OFPRRFC_STALE"
4036echo >>expout1 "OFPT_ROLE_REQUEST (OF1.4): role=master generation_id=3"
4037
4038# controller 1: Become master using a valid generation ID
4039ovs-appctl -t `pwd`/c1 ofctl/send 051800180000000500000002000000000000000000000001
4040echo >>experr1 "send: OFPT_ROLE_REQUEST (OF1.4): role=master generation_id=1"
4041echo >>expout1 "OFPT_ROLE_REPLY (OF1.4): role=master generation_id=1"
4042echo >>expout2 "OFPT_ROLE_STATUS (OF1.4): role=slave generation_id=1 reason=master_request"
4043
4044for i in 1 2; do
4045 ovs-appctl -t `pwd`/c$i ofctl/barrier
4046 echo >>expout$i "OFPT_BARRIER_REPLY (OF1.4):"
4047done
6ea4776b 4048
6751a4b4
BP
4049# Check output.
4050for i in 1 2; do
4051 cp expout$i expout
8a32aaa5 4052 AT_CHECK([grep -v '^send:' monitor$i.log | strip_xids], [0], [expout])
6751a4b4 4053 cp experr$i expout
8a32aaa5 4054 AT_CHECK([grep '^send:' monitor$i.log | strip_xids], [0], [expout])
6751a4b4 4055done
6ea4776b
JR
4056OVS_VSWITCHD_STOP
4057AT_CLEANUP
4058
b0e07d50
BP
4059dnl This test checks that the role request/response messaging works,
4060dnl that generation_id is handled properly, and that role status update
4061dnl messages are sent when a controller's role gets changed from master
4062dnl to slave.
4063AT_SETUP([ofproto - controller role (OpenFlow 1.3)])
4064OVS_VSWITCHD_START
4065on_exit 'kill `cat c1.pid c2.pid`'
4066
4067# Start two ovs-ofctl controller processes.
4068AT_CAPTURE_FILE([monitor1.log])
4069AT_CAPTURE_FILE([expout1])
4070AT_CAPTURE_FILE([experr1])
4071AT_CAPTURE_FILE([monitor2.log])
4072AT_CAPTURE_FILE([expout2])
4073AT_CAPTURE_FILE([experr2])
4074for i in 1 2; do
4075 AT_CHECK([ovs-ofctl -O OpenFlow13 monitor br0 --detach --no-chdir --pidfile=c$i.pid --unixctl=c$i])
4076 ovs-appctl -t `pwd`/c$i ofctl/barrier
4077 ovs-appctl -t `pwd`/c$i ofctl/set-output-file monitor$i.log
4078 : > expout$i
4079 : > experr$i
4080
4081 # find out current role
4082 ovs-appctl -t `pwd`/c$i ofctl/send 041800180000000200000000000000000000000000000000
4083 echo >>experr$i "send: OFPT_ROLE_REQUEST (OF1.3): role=nochange"
4084 echo >>expout$i "OFPT_ROLE_REPLY (OF1.3): role=equal"
4085done
4086
4087# controller 1: Become slave (generation_id is initially undefined, so
4088# 2^63+2 should not be stale)
4089ovs-appctl -t `pwd`/c1 ofctl/send 041800180000000300000003000000008000000000000002
4090echo >>experr1 "send: OFPT_ROLE_REQUEST (OF1.3): role=slave generation_id=9223372036854775810"
4091echo >>expout1 "OFPT_ROLE_REPLY (OF1.3): role=slave generation_id=9223372036854775810"
4092
4093# controller 2: Become master.
4094ovs-appctl -t `pwd`/c2 ofctl/send 041800180000000300000002000000008000000000000003
4095echo >>experr2 "send: OFPT_ROLE_REQUEST (OF1.3): role=master generation_id=9223372036854775811"
4096echo >>expout2 "OFPT_ROLE_REPLY (OF1.3): role=master generation_id=9223372036854775811"
4097
4098# controller 1: Try to become the master using a stale generation ID
4099ovs-appctl -t `pwd`/c1 ofctl/send 041800180000000400000002000000000000000000000003
4100echo >>experr1 "send: OFPT_ROLE_REQUEST (OF1.3): role=master generation_id=3"
4101echo >>expout1 "OFPT_ERROR (OF1.3): OFPRRFC_STALE"
4102echo >>expout1 "OFPT_ROLE_REQUEST (OF1.3): role=master generation_id=3"
4103
4104# controller 1: Become master using a valid generation ID
4105ovs-appctl -t `pwd`/c1 ofctl/send 041800180000000500000002000000000000000000000001
4106echo >>experr1 "send: OFPT_ROLE_REQUEST (OF1.3): role=master generation_id=1"
4107echo >>expout1 "OFPT_ROLE_REPLY (OF1.3): role=master generation_id=1"
4108echo >>expout2 "ONFT_ROLE_STATUS (OF1.3): role=slave generation_id=1 reason=master_request"
4109
4110for i in 1 2; do
4111 ovs-appctl -t `pwd`/c$i ofctl/barrier
4112 echo >>expout$i "OFPT_BARRIER_REPLY (OF1.3):"
4113done
4114
4115# Check output.
4116for i in 1 2; do
4117 cp expout$i expout
4118 AT_CHECK([grep -v '^send:' monitor$i.log | strip_xids], [0], [expout])
4119 cp experr$i expout
4120 AT_CHECK([grep '^send:' monitor$i.log | strip_xids], [0], [expout])
4121done
4122OVS_VSWITCHD_STOP
4123AT_CLEANUP
4124
3c35db62
NR
4125dnl This test checks the Group and meter notifications when a group mod
4126dnl command is sent from one controller and the reply is received by
4127dnl other controllers.
4128AT_SETUP([ofproto - requestforward (OpenFlow 1.4)])
4129OVS_VSWITCHD_START
4130on_exit 'kill `cat c1.pid c2.pid c3.pid`'
4131
4132# Start two ovs-ofctl controller processes.
4133AT_CAPTURE_FILE([monitor1.log])
4134AT_CAPTURE_FILE([expout1])
4135AT_CAPTURE_FILE([monitor2.log])
4136AT_CAPTURE_FILE([expout2])
4137AT_CAPTURE_FILE([monitor3.log])
4138AT_CAPTURE_FILE([expout3])
4139
56120500
BP
4140ovs-ofctl -O OpenFlow15 monitor br0 --detach --no-chdir --pidfile=c1.pid --unixctl=c1
4141ovs-ofctl -O OpenFlow14 monitor br0 --detach --no-chdir --pidfile=c2.pid --unixctl=c2
4142ovs-ofctl -O OpenFlow14 monitor br0 --detach --no-chdir --pidfile=c3.pid --unixctl=c3
3c35db62
NR
4143
4144check_async () {
4145 for i in 1 3; do
4146 ovs-appctl -t `pwd`/c$i ofctl/barrier
4147 ovs-appctl -t `pwd`/c$i ofctl/set-output-file monitor$i.log
4148 : > expout$i
4149 done
4150
4151 printf '\n\n--- check_async %d ---\n\n\n' $1
4152 INDEX=$1
4153 shift
4154
4155 # OFPGC_ADD
63eded98 4156 ovs-appctl -t `pwd`/c2 ofctl/send "050f0020000000020000000000000001 00100000 ffffffffffffffff 00000000"
3c35db62
NR
4157 if test X"$1" = X"OFPGC_ADD"; then shift;
4158 echo >>expout2 "send: OFPT_GROUP_MOD (OF1.4):
63eded98 4159 ADD group_id=1,type=all,bucket=actions=drop"
3c35db62 4160 echo >>expout1 "OFPT_REQUESTFORWARD (OF1.5): reason=group_mod
63eded98 4161 ADD group_id=1,type=all,bucket=bucket_id:0,actions=drop"
3c35db62 4162 echo >>expout3 "OFPT_REQUESTFORWARD (OF1.4): reason=group_mod
63eded98 4163 ADD group_id=1,type=all,bucket=actions=drop"
3c35db62
NR
4164 fi
4165
4166 # OFPGC_MODIFY
63eded98 4167 ovs-appctl -t `pwd`/c2 ofctl/send "050f0020000000020001010000000001 00100000 ffffffffffffffff 00000000"
3c35db62
NR
4168 if test X"$1" = X"OFPGC_MODIFY"; then shift;
4169 echo >>expout2 "send: OFPT_GROUP_MOD (OF1.4):
63eded98 4170 MOD group_id=1,type=select,bucket=weight:0,actions=drop"
3c35db62 4171 echo >>expout1 "OFPT_REQUESTFORWARD (OF1.5): reason=group_mod
63eded98 4172 MOD group_id=1,type=select,bucket=bucket_id:0,weight:0,actions=drop"
3c35db62 4173 echo >>expout3 "OFPT_REQUESTFORWARD (OF1.4): reason=group_mod
63eded98 4174 MOD group_id=1,type=select,bucket=weight:0,actions=drop"
3c35db62
NR
4175 fi
4176
4177 ovs-appctl -t `pwd`/c1 ofctl/barrier
4178 echo >>expout1 "OFPT_BARRIER_REPLY (OF1.5):"
4179 ovs-appctl -t `pwd`/c2 ofctl/barrier
4180 echo >>expout2 "OFPT_BARRIER_REPLY (OF1.4):"
4181 ovs-appctl -t `pwd`/c3 ofctl/barrier
4182 echo >>expout3 "OFPT_BARRIER_REPLY (OF1.4):"
4183
4184 # Check output.
4185 for i in 1 3; do
4186 cp expout$i expout
4187 AT_CHECK(
4188 [[sed '
4189s/ (xid=0x[0-9a-fA-F]*)//'< monitor$i.log]],
4190 [0], [expout])
4191 done
4192}
4193
4194# controller 1: Become slave
4195ovs-appctl -t `pwd`/c1 ofctl/send 061800180000000300000003000000008000000000000002
4196
4197# controller 2: Become master
4198ovs-appctl -t `pwd`/c2 ofctl/send 051800180000000300000002000000008000000000000003
4199
4200# controller 1: Become slave
4201ovs-appctl -t `pwd`/c3 ofctl/send 051800180000000300000003000000008000000000000004
4202
4203# controller 1: Enabled requestforward using set Asynchronous message
4204ovs-appctl -t `pwd`/c1 ofctl/send 061c00280000000200000008000000050002000800000002000400080000001a000a000800000003
4205
4206# controller 2: Enabled requestforward using set Asynchronous message
4207ovs-appctl -t `pwd`/c2 ofctl/send 051c002800000002000100080000000200030008000000050005000800000005000b000800000003
4208
4209# controller 1: Enabled requestforward using set Asynchronous message
4210ovs-appctl -t `pwd`/c3 ofctl/send 051c00280000000200000008000000050002000800000002000400080000001a000a000800000003
4211check_async 1 OFPGC_ADD OFPGC_MODIFY
4212
4213OVS_VSWITCHD_STOP
4214AT_CLEANUP
4215
98a9272b
ZW
4216dnl This test checks the backwards compatibility of the NXT_REQUESTFORWARD
4217dnl message type to OpenFlow 1.0, also relying on the Nicira Extensions:
4218dnl NXT_GROUP_MOD, NXT_ROLE_REQUEST, and OFPRAW_NXT_SET_ASYNC_CONFIG2,
4219dnl while also testing the functionality of the previous test.
4220AT_SETUP([ofproto - NXT requestforward (OpenFlow 1.0)])
4221OVS_VSWITCHD_START
4222on_exit 'kill `cat c1.pid c2.pid c3.pid`'
4223
4224# Start two ovs-ofctl controller processes.
4225AT_CAPTURE_FILE([monitor1.log])
4226AT_CAPTURE_FILE([expout1])
4227AT_CAPTURE_FILE([monitor2.log])
4228AT_CAPTURE_FILE([expout2])
4229AT_CAPTURE_FILE([monitor3.log])
4230AT_CAPTURE_FILE([expout3])
4231
4232ovs-ofctl -O OpenFlow10 monitor br0 --detach --no-chdir --pidfile=c1.pid --unixctl=c1
4233ovs-ofctl -O OpenFlow10 monitor br0 --detach --no-chdir --pidfile=c2.pid --unixctl=c2
4234ovs-ofctl -O OpenFlow10 monitor br0 --detach --no-chdir --pidfile=c3.pid --unixctl=c3
4235
4236check_async () {
4237 for i in 1 3; do
4238 ovs-appctl -t `pwd`/c$i ofctl/barrier
4239 ovs-appctl -t `pwd`/c$i ofctl/set-output-file monitor$i.log
4240 : > expout$i
4241 done
4242
4243 printf '\n\n--- check_async %d ---\n\n\n' $1
4244 INDEX=$1
4245 shift
4246
4247 # OFPGC_ADD
4248 # NXT_GROUP_MOD (xid=0x2):
4249 # 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
4250 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"
4251 if test X"$1" = X"OFPGC_ADD"; then shift;
4252 echo >>expout2 "send: NXT_GROUP_MOD:
4253 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"
4254 echo >>expout1 "NXT_REQUESTFORWARD: reason=group_mod
4255 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"
4256 echo >>expout3 "NXT_REQUESTFORWARD: reason=group_mod
4257 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"
4258 fi
4259
4260 # OFPGC_MODIFY
4261 # NXT_GROUP_MOD (xid=0x2):
4262 # 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
4263 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"
4264 if test X"$1" = X"OFPGC_MODIFY"; then shift;
4265 echo >>expout2 "send: NXT_GROUP_MOD:
4266 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"
4267 echo >>expout1 "NXT_REQUESTFORWARD: reason=group_mod
4268 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"
4269 echo >>expout3 "NXT_REQUESTFORWARD: reason=group_mod
4270 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"
4271 fi
4272
4273 ovs-appctl -t `pwd`/c1 ofctl/barrier
4274 echo >>expout1 "OFPT_BARRIER_REPLY:"
4275 ovs-appctl -t `pwd`/c2 ofctl/barrier
4276 echo >>expout2 "OFPT_BARRIER_REPLY:"
4277 ovs-appctl -t `pwd`/c3 ofctl/barrier
4278 echo >>expout3 "OFPT_BARRIER_REPLY:"
4279
4280 # Check output.
4281 for i in 1 3; do
4282 cp expout$i expout
4283 AT_CHECK(
4284 [[sed '
4285s/ (xid=0x[0-9a-fA-F]*)//'< monitor$i.log]],
4286 [0], [expout])
4287 done
4288}
4289
4290# controller 1: Become slave
4291# NXT_ROLE_REQUEST (xid=0x3): role=slave
4292ovs-appctl -t `pwd`/c1 ofctl/send 0104001400000003000023200000000a00000002
4293
4294# controller 2: Become master
4295# NXT_ROLE_REQUEST (xid=0x3): role=master
4296ovs-appctl -t `pwd`/c2 ofctl/send 0104001400000003000023200000000a00000001
4297
4298# controller 1: Become slave
4299# NXT_ROLE_REQUEST (xid=0x3): role=slave
4300ovs-appctl -t `pwd`/c3 ofctl/send 0104001400000003000023200000000a00000002
4301
4302# controller 1: Enabled requestforward using OFPRAW_NXT_SET_ASYNC_CONFIG2
4303ovs-appctl -t `pwd`/c1 ofctl/send 0104003000000002000023200000001b00000008000000050002000800000002000400080000001a000a000800000003
4304
4305# controller 2: Enabled requestforward using OFPRAW_NXT_SET_ASYNC_CONFIG2
4306ovs-appctl -t `pwd`/c2 ofctl/send 0104003000000002000023200000001b000100080000000200030008000000050005000800000005000b000800000003
4307
4308# controller 1: Enabled requestforward using OFPRAW_NXT_SET_ASYNC_CONFIG2
4309ovs-appctl -t `pwd`/c3 ofctl/send 0104003000000002000023200000001b00000008000000050002000800000002000400080000001a000a000800000003
4310check_async 1 OFPGC_ADD OFPGC_MODIFY
4311
4312OVS_VSWITCHD_STOP
4313AT_CLEANUP
4314
4315dnl This test checks the Group and meter notifications when a group mod
4316dnl command is sent from one controller and the reply is received by
4317dnl other controllers, using the ONF Extension for OF 1.3.
4318AT_SETUP([ofproto - ONF requestforward (OpenFlow 1.3)])
4319OVS_VSWITCHD_START
4320on_exit 'kill `cat c1.pid c2.pid c3.pid`'
4321
4322# Start two ovs-ofctl controller processes.
4323AT_CAPTURE_FILE([monitor1.log])
4324AT_CAPTURE_FILE([expout1])
4325AT_CAPTURE_FILE([monitor2.log])
4326AT_CAPTURE_FILE([expout2])
4327AT_CAPTURE_FILE([monitor3.log])
4328AT_CAPTURE_FILE([expout3])
4329
4330ovs-ofctl -O OpenFlow13 monitor br0 --detach --no-chdir --pidfile=c1.pid --unixctl=c1
4331ovs-ofctl -O OpenFlow13 monitor br0 --detach --no-chdir --pidfile=c2.pid --unixctl=c2
4332ovs-ofctl -O OpenFlow13 monitor br0 --detach --no-chdir --pidfile=c3.pid --unixctl=c3
4333
4334check_async () {
4335 for i in 1 3; do
4336 ovs-appctl -t `pwd`/c$i ofctl/barrier
4337 ovs-appctl -t `pwd`/c$i ofctl/set-output-file monitor$i.log
4338 : > expout$i
4339 done
4340
4341 printf '\n\n--- check_async %d ---\n\n\n' $1
4342 INDEX=$1
4343 shift
4344
4345 # OFPGC_ADD
4346 # OFPT_GROUP_MOD (OF1.3) (xid=0x2):
4347 # ADD group_id=1,type=all,bucket=actions=drop
4348 ovs-appctl -t `pwd`/c2 ofctl/send "040f0020000000020000000000000001 00100000 ffffffffffffffff 00000000"
4349 if test X"$1" = X"OFPGC_ADD"; then shift;
4350 echo >>expout2 "send: OFPT_GROUP_MOD (OF1.3):
4351 ADD group_id=1,type=all,bucket=actions=drop"
4352 echo >>expout1 "ONFT_REQUESTFORWARD (OF1.3): reason=group_mod
4353 ADD group_id=1,type=all,bucket=actions=drop"
4354 echo >>expout3 "ONFT_REQUESTFORWARD (OF1.3): reason=group_mod
4355 ADD group_id=1,type=all,bucket=actions=drop"
4356 fi
4357
4358 # OFPGC_MODIFY
4359 # OFPT_GROUP_MOD (OF1.3) (xid=0x2):
4360 # MOD group_id=1,type=select,bucket=weight:0,actions=drop
4361 ovs-appctl -t `pwd`/c2 ofctl/send "040f0020000000020001010000000001 00100000 ffffffffffffffff 00000000"
4362 if test X"$1" = X"OFPGC_MODIFY"; then shift;
4363 echo >>expout2 "send: OFPT_GROUP_MOD (OF1.3):
4364 MOD group_id=1,type=select,bucket=weight:0,actions=drop"
4365 echo >>expout1 "ONFT_REQUESTFORWARD (OF1.3): reason=group_mod
4366 MOD group_id=1,type=select,bucket=weight:0,actions=drop"
4367 echo >>expout3 "ONFT_REQUESTFORWARD (OF1.3): reason=group_mod
4368 MOD group_id=1,type=select,bucket=weight:0,actions=drop"
4369 fi
4370
4371 ovs-appctl -t `pwd`/c1 ofctl/barrier
4372 echo >>expout1 "OFPT_BARRIER_REPLY (OF1.3):"
4373 ovs-appctl -t `pwd`/c2 ofctl/barrier
4374 echo >>expout2 "OFPT_BARRIER_REPLY (OF1.3):"
4375 ovs-appctl -t `pwd`/c3 ofctl/barrier
4376 echo >>expout3 "OFPT_BARRIER_REPLY (OF1.3):"
4377
4378 # Check output.
4379 for i in 1 3; do
4380 cp expout$i expout
4381 AT_CHECK(
4382 [[sed '
4383s/ (xid=0x[0-9a-fA-F]*)//'< monitor$i.log]],
4384 [0], [expout])
4385 done
4386}
4387
4388# controller 1: Become slave
4389# OFPT_ROLE_REQUEST (OF1.3) (xid=0x3): role=slave
4390ovs-appctl -t `pwd`/c1 ofctl/send 041800180000000300000003000000008000000000000002
4391
4392# controller 2: Become master
4393# OFPT_ROLE_REQUEST (OF1.3) (xid=0x3): role=master
4394ovs-appctl -t `pwd`/c2 ofctl/send 041800180000000300000002000000008000000000000003
4395
4396# controller 1: Become slave
4397# OFPT_ROLE_REQUEST (OF1.3) (xid=0x3): role=slave
4398ovs-appctl -t `pwd`/c3 ofctl/send 041800180000000300000003000000008000000000000004
4399
4400# controller 1: Enabled requestforward using OFPRAW_NXT_SET_ASYNC_CONFIG2 (necessary for OF1.3)
4401ovs-appctl -t `pwd`/c1 ofctl/send 0404003000000002000023200000001b00000008000000050002000800000002000400080000001a000a000800000003
4402
4403# controller 2: Enabled requestforward using OFPRAW_NXT_SET_ASYNC_CONFIG2 (necessary for OF1.3)
4404ovs-appctl -t `pwd`/c2 ofctl/send 0404003000000002000023200000001b000100080000000200030008000000050005000800000005000b000800000003
4405
4406# controller 1: Enabled requestforward using OFPRAW_NXT_SET_ASYNC_CONFIG2 (necessary for OF1.3)
4407ovs-appctl -t `pwd`/c3 ofctl/send 0404003000000002000023200000001b00000008000000050002000800000002000400080000001a000a000800000003
4408check_async 1 OFPGC_ADD OFPGC_MODIFY
4409
4410OVS_VSWITCHD_STOP
4411AT_CLEANUP
4412
4413
4414
751c7785
BP
4415dnl This test checks that OFPT_PACKET_OUT accepts both OFPP_NONE (as
4416dnl specified by OpenFlow 1.0) and OFPP_CONTROLLER (used by some
4417dnl controllers despite the spec) as meaning a packet that was generated
4418dnl by the controller.
9dcd1c00 4419AT_SETUP([ofproto - packet-out from controller (OpenFlow 1.0)])
751c7785 4420OVS_VSWITCHD_START
ca5792f0 4421add_of_ports br0 1
751c7785
BP
4422
4423# Start a monitor listening for packet-ins.
6409e008 4424AT_CHECK([ovs-ofctl -P standard monitor br0 --detach --no-chdir --pidfile])
751c7785
BP
4425ovs-appctl -t ovs-ofctl ofctl/send 0109000c0123456700000080
4426ovs-appctl -t ovs-ofctl ofctl/barrier
4427ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
4428AT_CAPTURE_FILE([monitor.log])
4429
4430# Send some packet-outs with OFPP_NONE and OFPP_CONTROLLER (65533) as in_port.
6dd3c787
JR
4431AT_CHECK([ovs-ofctl packet-out br0 "in_port=none packet=0001020304050010203040501234 actions=controller,1"])
4432AT_CHECK([ovs-ofctl packet-out br0 "in_port=controller packet=0001020304050010203040505678 actions=controller,1"])
751c7785
BP
4433
4434# Stop the monitor and check its output.
4435ovs-appctl -t ovs-ofctl ofctl/barrier
d9c8c57c 4436OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
751c7785 4437
586ddea5
BP
4438ovs-ofctl dump-ports br0
4439
751c7785 4440AT_CHECK([sed 's/ (xid=0x[[0-9a-fA-F]]*)//' monitor.log], [0], [dnl
7f05e7ab 4441OFPT_PACKET_IN: total_len=14 in_port=ANY (via action) data_len=14 (unbuffered)
e6d9ab56 4442vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1234
751c7785 4443OFPT_PACKET_IN: total_len=14 in_port=CONTROLLER (via action) data_len=14 (unbuffered)
e6d9ab56 4444vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x5678
969fc56c
JS
4445OFPT_BARRIER_REPLY:
4446])
4447
4448OVS_VSWITCHD_STOP
4449AT_CLEANUP
4450
9dcd1c00
SH
4451dnl This test checks that OFPT_PACKET_OUT accepts both OFPP_NONE (as
4452dnl specified by OpenFlow 1.2) and OFPP_CONTROLLER (used by some
4453dnl controllers despite the spec) as meaning a packet that was generated
4454dnl by the controller.
4455AT_SETUP([ofproto - packet-out from controller (OpenFlow 1.2)])
4456OVS_VSWITCHD_START
4457
4458# Start a monitor listening for packet-ins.
6409e008 4459AT_CHECK([ovs-ofctl -O OpenFlow12 -P standard monitor br0 --detach --no-chdir --pidfile])
9dcd1c00
SH
4460ovs-appctl -t ovs-ofctl ofctl/send 0309000c0123456700000080
4461ovs-appctl -t ovs-ofctl ofctl/barrier
4462ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
4463AT_CAPTURE_FILE([monitor.log])
4464
4465# Send some packet-outs with OFPP_NONE and OFPP_CONTROLLER (65533) as in_port.
4466AT_CHECK([ovs-ofctl -O OpenFlow12 packet-out br0 none controller '0001020304050010203040501234'])
4467AT_CHECK([ovs-ofctl -O OpenFlow12 packet-out br0 4294967293 controller '0001020304050010203040505678'])
4468
4469# Stop the monitor and check its output.
4470ovs-appctl -t ovs-ofctl ofctl/barrier
d9c8c57c 4471OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
9dcd1c00
SH
4472
4473AT_CHECK([sed 's/ (xid=0x[[0-9a-fA-F]]*)//' monitor.log], [0], [dnl
4474OFPT_PACKET_IN (OF1.2): total_len=14 in_port=ANY (via action) data_len=14 (unbuffered)
e6d9ab56 4475vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1234
9dcd1c00 4476OFPT_PACKET_IN (OF1.2): total_len=14 in_port=CONTROLLER (via action) data_len=14 (unbuffered)
e6d9ab56 4477vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x5678
9dcd1c00
SH
4478OFPT_BARRIER_REPLY (OF1.2):
4479])
4480
4481OVS_VSWITCHD_STOP
4482AT_CLEANUP
4483
4d197ebb
BP
4484dnl This test checks that OFPT_PACKET_OUT accepts both OFPP_NONE (as
4485dnl specified by OpenFlow 1.1) and OFPP_CONTROLLER (used by some
4486dnl controllers despite the spec) as meaning a packet that was generated
4487dnl by the controller.
4488AT_SETUP([ofproto - packet-out from controller (OpenFlow 1.1)])
4489OVS_VSWITCHD_START
4490
4491# Start a monitor listening for packet-ins.
6409e008 4492AT_CHECK([ovs-ofctl -O OpenFlow11 -P standard monitor br0 --detach --no-chdir --pidfile])
4d197ebb
BP
4493ovs-appctl -t ovs-ofctl ofctl/send 0209000c0123456700000080
4494ovs-appctl -t ovs-ofctl ofctl/barrier
4495ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
4496AT_CAPTURE_FILE([monitor.log])
4497
6dd3c787
JR
4498# Send some packet-outs with OFPP_NONE and OFPP_CONTROLLER as in_port.
4499AT_CHECK([ovs-appctl -t ovs-ofctl ofctl/packet-out "in_port=none, packet=0001020304050010203040501234 actions=controller"])
4500AT_CHECK([ovs-appctl -t ovs-ofctl ofctl/packet-out "in_port=controller packet=0001020304050010203040505678 actions=controller"])
4d197ebb
BP
4501
4502# Stop the monitor and check its output.
4503ovs-appctl -t ovs-ofctl ofctl/barrier
d9c8c57c 4504OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
4d197ebb 4505
6dd3c787
JR
4506AT_CHECK([sed 's/ (xid=0x[[0-9a-fA-F]]*)//
4507/PACKET_OUT/d' monitor.log], [0], [dnl
4d197ebb 4508OFPT_PACKET_IN (OF1.1): total_len=14 in_port=ANY (via action) data_len=14 (unbuffered)
e6d9ab56 4509vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1234
4d197ebb 4510OFPT_PACKET_IN (OF1.1): total_len=14 in_port=CONTROLLER (via action) data_len=14 (unbuffered)
e6d9ab56 4511vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x5678
4d197ebb
BP
4512OFPT_BARRIER_REPLY (OF1.1):
4513])
4514
4515OVS_VSWITCHD_STOP
4516AT_CLEANUP
4517
880b1458
YHW
4518AT_SETUP([ofproto - packet-out from controller (OpenFlow 1.5)])
4519OVS_VSWITCHD_START
4520
4521# Start a monitor listening for packet-ins.
4522AT_CHECK([ovs-ofctl -O OpenFlow15 -P standard monitor br0 --detach --no-chdir --pidfile])
4523ovs-appctl -t ovs-ofctl ofctl/send 0609000c0123456700000080
4524ovs-appctl -t ovs-ofctl ofctl/barrier
4525ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
4526AT_CAPTURE_FILE([monitor.log])
4527
4528# Send some packet-outs with OFPP_NONE and OFPP_CONTROLLER (65533) as in_port.
4529AT_CHECK([ovs-ofctl -O OpenFlow15 packet-out br0 "in_port=none tun_id=0x11 metadata=0x22 packet=0001020304050010203040501234 actions=controller"])
4530AT_CHECK([ovs-ofctl -O OpenFlow15 packet-out br0 "in_port=controller tun_id=0x11 metadata=0x33 packet=0001020304050010203040505678 actions=controller"])
4531
4532# Stop the monitor and check its output.
4533ovs-appctl -t ovs-ofctl ofctl/barrier
4534OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
4535
4536AT_CHECK([sed 's/ (xid=0x[[0-9a-fA-F]]*)//' monitor.log], [0], [dnl
4537OFPT_PACKET_IN (OF1.5): total_len=14 tun_id=0x11,metadata=0x22,in_port=ANY (via packet_out) data_len=14 (unbuffered)
4538vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1234
4539OFPT_PACKET_IN (OF1.5): total_len=14 tun_id=0x11,metadata=0x33,in_port=CONTROLLER (via packet_out) data_len=14 (unbuffered)
4540vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x5678
4541OFPT_BARRIER_REPLY (OF1.5):
4542])
4543
4544OVS_VSWITCHD_STOP
4545AT_CLEANUP
4546
bdcad671
BP
4547dnl This test checks that metadata and userdata are encoded in NXT_PACKET_IN2.
4548AT_SETUP([ofproto - packet-out with metadata and userdata (NXT_PACKET_IN2)])
6409e008
BP
4549OVS_VSWITCHD_START
4550
4551# Start a monitor listening for packet-ins.
4552AT_CHECK([ovs-ofctl -P nxt_packet_in2 monitor br0 --detach --no-chdir --pidfile])
4553ovs-appctl -t ovs-ofctl ofctl/send 0109000c0123456700000080
4554ovs-appctl -t ovs-ofctl ofctl/barrier
4555ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
4556AT_CAPTURE_FILE([monitor.log])
4557
4558# Send a packet-out with a load action to set some metadata, and forward to controller
6dd3c787 4559AT_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
4560
4561# Stop the monitor and check its output.
4562ovs-appctl -t ovs-ofctl ofctl/barrier
d9c8c57c 4563OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
6409e008
BP
4564
4565AT_CHECK([sed 's/ (xid=0x[[0-9a-fA-F]]*)//' monitor.log], [0], [dnl
4566NXT_PACKET_IN2: total_len=14 pkt_mark=0xaa,metadata=0xfafafafa5a5a5a5a,in_port=CONTROLLER (via action) data_len=14 (unbuffered)
bdcad671 4567 userdata=01.02.03.04.05
6409e008
BP
4568vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1234
4569OFPT_BARRIER_REPLY:
4570])
4571
4572OVS_VSWITCHD_STOP
4573AT_CLEANUP
4574
cb1145d1
ZB
4575dnl This test checks that 1.5 packet_out is properly encoded/decoded.
4576AT_SETUP([ofproto - packet-out with set_field metadata (OpenFlow 1.5)])
4577OVS_VSWITCHD_START
4578
4579# Start a monitor listening for packet-ins.
4580AT_CHECK([ovs-ofctl -P standard -O OpenFlow13 monitor br0 --detach --no-chdir --pidfile])
4581ovs-appctl -t ovs-ofctl ofctl/send 0409000c0123456700000080
4582ovs-appctl -t ovs-ofctl ofctl/barrier
4583ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
4584AT_CAPTURE_FILE([monitor.log])
4585
4586# Send a packet-out with a couple of set-field action to set some metadata, and forward to controller
4587AT_CHECK([ovs-ofctl -O OpenFlow15 packet-out br0 CONTROLLER 'set_field:0xfafafafa5a5a5a5a->metadata, controller' '0001020304050010203040501234'])
4588
4589# Stop the monitor and check its output.
4590ovs-appctl -t ovs-ofctl ofctl/barrier
4591ovs-appctl -t ovs-ofctl exit
4592
4593AT_CHECK([sed 's/ (xid=0x[[0-9a-fA-F]]*)//' monitor.log], [0], [dnl
4594OFPT_PACKET_IN (OF1.3): total_len=14 metadata=0xfafafafa5a5a5a5a,in_port=CONTROLLER (via action) data_len=14 (unbuffered)
4595vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1234
4596OFPT_BARRIER_REPLY (OF1.3):
4597])
4598
4599OVS_VSWITCHD_STOP
4600AT_CLEANUP
4601
4602dnl This test checks that packet_type PT_ETH is properly encoded/decoded in 1.5 packet_out.
4603AT_SETUP([ofproto - packet-out with set_field metadata with packet_type PT_ETH (OpenFlow 1.5)])
4604OVS_VSWITCHD_START
4605
4606# Start a monitor listening for packet-ins.
4607AT_CHECK([ovs-ofctl -P standard -O OpenFlow13 monitor br0 --detach --no-chdir --pidfile])
4608ovs-appctl -t ovs-ofctl ofctl/send 0409000c0123456700000080
4609ovs-appctl -t ovs-ofctl ofctl/barrier
4610ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
4611AT_CAPTURE_FILE([monitor.log])
4612
4613# Send a packet-out with a couple of set-field action to set some metadata, and forward to controller
4614AT_CHECK([ovs-ofctl -O OpenFlow15 packet-out br0 "in_port=controller packet=0001020304050010203040501234 packet_type(0,0x0) actions=set_field:0xfafafafa5a5a5a5a->metadata,controller"])
4615
4616# Stop the monitor and check its output.
4617ovs-appctl -t ovs-ofctl ofctl/barrier
4618ovs-appctl -t ovs-ofctl exit
4619
4620AT_CHECK([sed 's/ (xid=0x[[0-9a-fA-F]]*)//' monitor.log], [0], [dnl
4621OFPT_PACKET_IN (OF1.3): total_len=14 metadata=0xfafafafa5a5a5a5a,in_port=CONTROLLER (via action) data_len=14 (unbuffered)
4622vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1234
4623OFPT_BARRIER_REPLY (OF1.3):
4624])
4625
4626OVS_VSWITCHD_STOP
4627AT_CLEANUP
4628
4629dnl This test checks that packet_type PT_IPV4 is properly encoded/decoded in 1.5 packet_out.
4630AT_SETUP([ofproto - packet-out with set_field metadata with packet_type PT_IPV4 on PTAP bridge (OpenFlow 1.5)])
4631OVS_VSWITCHD_START
4632
4633# Start a monitor listening for packet-ins.
4634AT_CHECK([ovs-ofctl -P standard -O OpenFlow13 monitor br0 --detach --no-chdir --pidfile])
4635ovs-appctl -t ovs-ofctl ofctl/send 0409000c0123456700000080
4636ovs-appctl -t ovs-ofctl ofctl/barrier
4637ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
4638AT_CAPTURE_FILE([monitor.log])
4639
4640# Send a packet-out with a couple of set-field action to set some metadata, and forward to controller
4641AT_CHECK([ovs-ofctl -O OpenFlow15 packet-out br0 "in_port=controller packet=4500002012344000ff1155670a0000140a00001e006400c8000cea78ffffffff packet_type(1,0x800) actions=set_field:0xfafafafa5a5a5a5a->metadata,controller"])
4642
4643# Stop the monitor and check its output.
4644ovs-appctl -t ovs-ofctl ofctl/barrier
4645ovs-appctl -t ovs-ofctl exit
4646
4647AT_CHECK([sed 's/ (xid=0x[[0-9a-fA-F]]*)//' monitor.log], [0], [dnl
4648OFPT_PACKET_IN (OF1.3): total_len=32 packet_type=(1,0x800),metadata=0xfafafafa5a5a5a5a,in_port=CONTROLLER (via action) data_len=32 (unbuffered)
4649packet_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
4650OFPT_BARRIER_REPLY (OF1.3):
4651])
4652
4653OVS_VSWITCHD_STOP
4654AT_CLEANUP
4655
969fc56c
JS
4656dnl This test checks that metadata is encoded in packet_in structures,
4657dnl supported by NXAST.
4658AT_SETUP([ofproto - packet-out with metadata (NXM)])
4659OVS_VSWITCHD_START
4660
4661# Start a monitor listening for packet-ins.
6409e008 4662AT_CHECK([ovs-ofctl -P nxt_packet_in monitor br0 --detach --no-chdir --pidfile])
969fc56c
JS
4663ovs-appctl -t ovs-ofctl ofctl/send 0109000c0123456700000080
4664ovs-appctl -t ovs-ofctl ofctl/barrier
4665ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
4666AT_CAPTURE_FILE([monitor.log])
4667
4668# Send a packet-out with a load action to set some metadata, and forward to controller
6dd3c787 4669AT_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
4670
4671# Stop the monitor and check its output.
4672ovs-appctl -t ovs-ofctl ofctl/barrier
d9c8c57c 4673OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
969fc56c
JS
4674
4675AT_CHECK([sed 's/ (xid=0x[[0-9a-fA-F]]*)//' monitor.log], [0], [dnl
50dcbd8e 4676NXT_PACKET_IN: total_len=14 pkt_mark=0xaa,metadata=0xfafafafa5a5a5a5a,in_port=CONTROLLER (via action) data_len=14 (unbuffered)
e6d9ab56 4677vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1234
751c7785
BP
4678OFPT_BARRIER_REPLY:
4679])
4680
4681OVS_VSWITCHD_STOP
4682AT_CLEANUP
2b07c8b1 4683
9dcd1c00
SH
4684dnl This test checks that metadata is encoded in packet_in structures,
4685dnl supported by NXAST.
4686AT_SETUP([ofproto - packet-out with metadata (OpenFlow 1.2)])
4687OVS_VSWITCHD_START
4688
4689# Start a monitor listening for packet-ins.
6409e008 4690AT_CHECK([ovs-ofctl -O OpenFlow12 -P standard monitor br0 --detach --no-chdir --pidfile])
9dcd1c00
SH
4691ovs-appctl -t ovs-ofctl ofctl/send 0309000c0123456700000080
4692ovs-appctl -t ovs-ofctl ofctl/barrier
4693ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
4694AT_CAPTURE_FILE([monitor.log])
4695
277876e9
JT
4696# Send a packet-out with a set-field action to set some metadata, and forward to controller
4697AT_CHECK([ovs-ofctl -O OpenFlow12 packet-out br0 none 'set_field:0xfafafafa5a5a5a5a->metadata, controller' '0001020304050010203040501234'])
9dcd1c00
SH
4698
4699# Stop the monitor and check its output.
4700ovs-appctl -t ovs-ofctl ofctl/barrier
d9c8c57c 4701OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
9dcd1c00
SH
4702
4703AT_CHECK([sed 's/ (xid=0x[[0-9a-fA-F]]*)//' monitor.log], [0], [dnl
50dcbd8e 4704OFPT_PACKET_IN (OF1.2): total_len=14 metadata=0xfafafafa5a5a5a5a,in_port=ANY (via action) data_len=14 (unbuffered)
e6d9ab56 4705vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1234
0ad90c84
JR
4706OFPT_BARRIER_REPLY (OF1.2):
4707])
4708
4709OVS_VSWITCHD_STOP
4710AT_CLEANUP
4711
743c159b
JT
4712dnl This test checks that metadata is encoded in packet_in structures,
4713dnl supported by NXAST.
4714AT_SETUP([ofproto - packet-out with metadata and dual set_field (OpenFlow 1.3)])
4715OVS_VSWITCHD_START
4716
4717# Start a monitor listening for packet-ins.
6409e008 4718AT_CHECK([ovs-ofctl -O OpenFlow13 -P standard monitor br0 --detach --no-chdir --pidfile])
743c159b
JT
4719ovs-appctl -t ovs-ofctl ofctl/send 0409000c0123456700000080
4720ovs-appctl -t ovs-ofctl ofctl/barrier
4721ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
4722AT_CAPTURE_FILE([monitor.log])
4723
4724# Send a packet-out with a couple of set-field action to set some metadata, and forward to controller
4725AT_CHECK([ovs-ofctl -O OpenFlow13 packet-out br0 none 'set_field:0xfafafafa5a5a5a5a->metadata, set_field:0x6b->metadata, controller' '0001020304050010203040501234'])
4726
4727# Stop the monitor and check its output.
4728ovs-appctl -t ovs-ofctl ofctl/barrier
d9c8c57c 4729OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
743c159b
JT
4730
4731AT_CHECK([sed 's/ (xid=0x[[0-9a-fA-F]]*)//' monitor.log], [0], [dnl
50dcbd8e 4732OFPT_PACKET_IN (OF1.3): total_len=14 metadata=0x6b,in_port=ANY (via action) data_len=14 (unbuffered)
e6d9ab56 4733vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1234
743c159b
JT
4734OFPT_BARRIER_REPLY (OF1.3):
4735])
4736
4737OVS_VSWITCHD_STOP
4738AT_CLEANUP
4739
0ad90c84
JR
4740dnl This test checks that tunnel metadata is encoded in packet_in structures.
4741AT_SETUP([ofproto - packet-out with tunnel metadata (OpenFlow 1.2)])
4742OVS_VSWITCHD_START
4743
4744# Start a monitor listening for packet-ins.
6409e008 4745AT_CHECK([ovs-ofctl -O OpenFlow12 -P standard monitor br0 --detach --no-chdir --pidfile])
0ad90c84
JR
4746ovs-appctl -t ovs-ofctl ofctl/send 0309000c0123456700000080
4747ovs-appctl -t ovs-ofctl ofctl/barrier
4748ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
4749AT_CAPTURE_FILE([monitor.log])
4750
4751# Send a packet-out with set field actions to set some tunnel metadata, and forward to controller
4752AT_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'])
4753
4754# Stop the monitor and check its output.
4755ovs-appctl -t ovs-ofctl ofctl/barrier
d9c8c57c 4756OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
0ad90c84
JR
4757
4758AT_CHECK([sed 's/ (xid=0x[[0-9a-fA-F]]*)//' monitor.log], [0], [dnl
50dcbd8e 4759OFPT_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 4760vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1234
9dcd1c00
SH
4761OFPT_BARRIER_REPLY (OF1.2):
4762])
4763
4764OVS_VSWITCHD_STOP
4765AT_CLEANUP
4766
1637ebb2
SH
4767m4_divert_push([PREPARE_TESTS])
4768# Sorts groups of lines that start with a space, without moving them
4769# past the nearest line that does not start with a space.
719dcfd4 4770[
1637ebb2 4771multiline_sort () {
1ca0323e 4772 $PYTHON3 -c '
719dcfd4
BP
4773import sys
4774
4775buffer = []
4776while True:
4777 line = sys.stdin.readline()
4778 if not line:
4779 break
4780 if line.startswith(" "):
4781 buffer.append(line)
4782 else:
4783 sys.stdout.write("".join(sorted(buffer)))
4784 sys.stdout.write(line)
4785 buffer = []
4786sys.stdout.write("".join(sorted(buffer)))
1637ebb2
SH
4787'
4788}
719dcfd4 4789]
1637ebb2
SH
4790m4_divert_pop([PREPARE_TESTS])
4791
2b07c8b1
BP
4792AT_SETUP([ofproto - flow monitoring])
4793AT_KEYWORDS([monitor])
4794OVS_VSWITCHD_START
4795
4796ovs-ofctl add-flow br0 in_port=0,dl_vlan=123,actions=output:1
4797
4798# Start a monitor watching the flow table and check the initial reply.
4799ovs-ofctl monitor br0 watch: --detach --no-chdir --pidfile >monitor.log 2>&1
4800AT_CAPTURE_FILE([monitor.log])
4801ovs-appctl -t ovs-ofctl ofctl/barrier
4802AT_CHECK([sed 's/ (xid=0x[[1-9a-fA-F]][[0-9a-fA-F]]*)//' monitor.log], [0],
4803 [NXST_FLOW_MONITOR reply:
4804 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=123 actions=output:1
4805OFPT_BARRIER_REPLY:
4806])
4807
4808# Add, delete, and modify some flows and check the updates.
4809ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
4810ovs-ofctl add-flow br0 in_port=0,dl_vlan=124,actions=output:2
4811ovs-ofctl add-flow br0 in_port=0,dl_vlan=123,actions=output:5
95a1c4ca
SH
4812ovs-ofctl add-flow br0 in_port=0,dl_vlan=123,dl_vlan_pcp=0,actions=output:6
4813ovs-ofctl add-flow br0 in_port=0,dl_vlan=123,dl_vlan_pcp=1,actions=output:7
4814ovs-ofctl add-flow br0 in_port=0,dl_vlan=123,actions=output:8
4815ovs-ofctl add-flow br0 in_port=0,dl_vlan=65535,dl_vlan_pcp=0,actions=output:9
4816ovs-ofctl add-flow br0 in_port=0,dl_vlan=65535,dl_vlan_pcp=1,actions=output:10
4817ovs-ofctl add-flow br0 in_port=0,dl_vlan=65535,actions=output:11
4818ovs-ofctl add-flow br0 in_port=0,dl_vlan=8191,dl_vlan_pcp=0,actions=output:12
4819ovs-ofctl add-flow br0 in_port=0,dl_vlan=8191,dl_vlan_pcp=1,actions=output:13
4820ovs-ofctl add-flow br0 in_port=0,dl_vlan=8191,actions=output:14
4821ovs-ofctl add-flow br0 in_port=0,dl_vlan=0,dl_vlan_pcp=0,actions=output:15
4822ovs-ofctl add-flow br0 in_port=0,dl_vlan=0,dl_vlan_pcp=1,actions=output:16
4823ovs-ofctl add-flow br0 in_port=0,dl_vlan=0,actions=output:17
4824ovs-ofctl add-flow br0 in_port=0,dl_vlan=0,dl_vlan_pcp=0,actions=output:18
4825ovs-ofctl add-flow br0 in_port=0,dl_vlan=0,dl_vlan_pcp=1,actions=output:19
4826ovs-ofctl add-flow br0 in_port=0,dl_vlan=0,actions=output:20
4827ovs-ofctl add-flow br0 in_port=0,dl_vlan_pcp=0,actions=output:21
4828ovs-ofctl add-flow br0 in_port=0,dl_vlan_pcp=1,actions=output:22
4829ovs-ofctl add-flow br0 in_port=0,actions=output:23
ee088a75 4830ovs-ofctl mod-flows br0 dl_vlan=123,actions=output:3
2b07c8b1
BP
4831ovs-ofctl mod-flows br0 cookie=5,dl_vlan=123,actions=output:3
4832ovs-ofctl del-flows br0 dl_vlan=123
4833ovs-ofctl del-flows br0
4834ovs-appctl -t ovs-ofctl ofctl/barrier
1637ebb2 4835AT_CHECK([sed 's/ (xid=0x[[1-9a-fA-F]][[0-9a-fA-F]]*)//' monitor.log | multiline_sort], [0],
2b07c8b1
BP
4836[NXST_FLOW_MONITOR reply (xid=0x0):
4837 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=124 actions=output:2
4838NXST_FLOW_MONITOR reply (xid=0x0):
4839 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=123 actions=output:5
95a1c4ca
SH
4840NXST_FLOW_MONITOR reply (xid=0x0):
4841 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=123,dl_vlan_pcp=0 actions=output:6
4842NXST_FLOW_MONITOR reply (xid=0x0):
4843 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=123,dl_vlan_pcp=1 actions=output:7
4844NXST_FLOW_MONITOR reply (xid=0x0):
4845 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=123 actions=output:8
4846NXST_FLOW_MONITOR reply (xid=0x0):
4847 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=0,dl_vlan_pcp=0 actions=output:9
4848NXST_FLOW_MONITOR reply (xid=0x0):
4849 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=0,dl_vlan_pcp=1 actions=output:10
4850NXST_FLOW_MONITOR reply (xid=0x0):
4851 event=ADDED table=0 cookie=0 in_port=0,vlan_tci=0x0000 actions=output:11
4852NXST_FLOW_MONITOR reply (xid=0x0):
4853 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=4095,dl_vlan_pcp=0 actions=output:12
4854NXST_FLOW_MONITOR reply (xid=0x0):
4855 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=4095,dl_vlan_pcp=1 actions=output:13
4856NXST_FLOW_MONITOR reply (xid=0x0):
4857 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=4095 actions=output:14
4858NXST_FLOW_MONITOR reply (xid=0x0):
4859 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=0,dl_vlan_pcp=0 actions=output:15
4860NXST_FLOW_MONITOR reply (xid=0x0):
4861 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=0,dl_vlan_pcp=1 actions=output:16
4862NXST_FLOW_MONITOR reply (xid=0x0):
4863 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=0 actions=output:17
4864NXST_FLOW_MONITOR reply (xid=0x0):
4865 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=0,dl_vlan_pcp=0 actions=output:18
4866NXST_FLOW_MONITOR reply (xid=0x0):
4867 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=0,dl_vlan_pcp=1 actions=output:19
4868NXST_FLOW_MONITOR reply (xid=0x0):
4869 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=0 actions=output:20
4870NXST_FLOW_MONITOR reply (xid=0x0):
4871 event=ADDED table=0 cookie=0 in_port=0,dl_vlan_pcp=0 actions=output:21
4872NXST_FLOW_MONITOR reply (xid=0x0):
4873 event=ADDED table=0 cookie=0 in_port=0,dl_vlan_pcp=1 actions=output:22
4874NXST_FLOW_MONITOR reply (xid=0x0):
4875 event=ADDED table=0 cookie=0 in_port=0 actions=output:23
ee088a75
SH
4876NXST_FLOW_MONITOR reply (xid=0x0):
4877 event=MODIFIED table=0 cookie=0 in_port=0,dl_vlan=123 actions=output:3
4878 event=MODIFIED table=0 cookie=0 in_port=0,dl_vlan=123,dl_vlan_pcp=0 actions=output:3
4879 event=MODIFIED table=0 cookie=0 in_port=0,dl_vlan=123,dl_vlan_pcp=1 actions=output:3
2b07c8b1
BP
4880NXST_FLOW_MONITOR reply (xid=0x0):
4881 event=MODIFIED table=0 cookie=0x5 in_port=0,dl_vlan=123 actions=output:3
95a1c4ca
SH
4882 event=MODIFIED table=0 cookie=0x5 in_port=0,dl_vlan=123,dl_vlan_pcp=0 actions=output:3
4883 event=MODIFIED table=0 cookie=0x5 in_port=0,dl_vlan=123,dl_vlan_pcp=1 actions=output:3
2b07c8b1
BP
4884NXST_FLOW_MONITOR reply (xid=0x0):
4885 event=DELETED reason=delete table=0 cookie=0x5 in_port=0,dl_vlan=123 actions=output:3
95a1c4ca
SH
4886 event=DELETED reason=delete table=0 cookie=0x5 in_port=0,dl_vlan=123,dl_vlan_pcp=0 actions=output:3
4887 event=DELETED reason=delete table=0 cookie=0x5 in_port=0,dl_vlan=123,dl_vlan_pcp=1 actions=output:3
2b07c8b1 4888NXST_FLOW_MONITOR reply (xid=0x0):
32cd83a2 4889 event=DELETED reason=delete table=0 cookie=0 in_port=0 actions=output:23
95a1c4ca 4890 event=DELETED reason=delete table=0 cookie=0 in_port=0,dl_vlan=0 actions=output:20
32cd83a2
BP
4891 event=DELETED reason=delete table=0 cookie=0 in_port=0,dl_vlan=0,dl_vlan_pcp=0 actions=output:18
4892 event=DELETED reason=delete table=0 cookie=0 in_port=0,dl_vlan=0,dl_vlan_pcp=1 actions=output:19
2b07c8b1 4893 event=DELETED reason=delete table=0 cookie=0 in_port=0,dl_vlan=124 actions=output:2
95a1c4ca 4894 event=DELETED reason=delete table=0 cookie=0 in_port=0,dl_vlan=4095 actions=output:14
32cd83a2 4895 event=DELETED reason=delete table=0 cookie=0 in_port=0,dl_vlan=4095,dl_vlan_pcp=0 actions=output:12
95a1c4ca 4896 event=DELETED reason=delete table=0 cookie=0 in_port=0,dl_vlan=4095,dl_vlan_pcp=1 actions=output:13
32cd83a2
BP
4897 event=DELETED reason=delete table=0 cookie=0 in_port=0,dl_vlan_pcp=0 actions=output:21
4898 event=DELETED reason=delete table=0 cookie=0 in_port=0,dl_vlan_pcp=1 actions=output:22
95a1c4ca 4899 event=DELETED reason=delete table=0 cookie=0 in_port=0,vlan_tci=0x0000 actions=output:11
2b07c8b1
BP
4900OFPT_BARRIER_REPLY:
4901])
4902
200d6ac4
SH
4903# Check that our own changes are reported as full updates.
4904ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
4905ovs-ofctl add-flow br0 in_port=1,actions=output:2
4906ovs-ofctl add-flow br0 in_port=2,actions=output:1
4907ovs-appctl -t ovs-ofctl ofctl/barrier
4908ovs-appctl -t ovs-ofctl ofctl/send 010e004812345678003fffff00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003000000000000ffffffffffff0000
4909ovs-appctl -t ovs-ofctl ofctl/barrier
4910AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip], [0], [NXST_FLOW reply:
4911])
4912AT_CHECK([sed 's/ (xid=0x[[1-9a-fA-F]][[0-9a-fA-F]]*)//' monitor.log | multiline_sort], [0],
4913[NXST_FLOW_MONITOR reply (xid=0x0):
4914 event=ADDED table=0 cookie=0 in_port=1 actions=output:2
4915NXST_FLOW_MONITOR reply (xid=0x0):
4916 event=ADDED table=0 cookie=0 in_port=2 actions=output:1
4917OFPT_BARRIER_REPLY:
4918send: OFPT_FLOW_MOD: DEL priority=0 actions=drop
4919NXST_FLOW_MONITOR reply (xid=0x0):
4920 event=DELETED reason=delete table=0 cookie=0 in_port=1 actions=output:2
4921 event=DELETED reason=delete table=0 cookie=0 in_port=2 actions=output:1
4922OFPT_BARRIER_REPLY:
4923])
4924
d9c8c57c 4925OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
200d6ac4
SH
4926OVS_VSWITCHD_STOP
4927AT_CLEANUP
4928
4929AT_SETUP([ofproto - flow monitoring with !own])
4930AT_KEYWORDS([monitor])
4931OVS_VSWITCHD_START
4932
4933ovs-ofctl add-flow br0 in_port=0,dl_vlan=123,actions=output:1
4934
4935# Start a monitor watching the flow table and check the initial reply.
4936ovs-ofctl monitor br0 watch:\!own --detach --no-chdir --pidfile >monitor.log 2>&1
4937AT_CAPTURE_FILE([monitor.log])
4938ovs-appctl -t ovs-ofctl ofctl/barrier
4939AT_CHECK([sed 's/ (xid=0x[[1-9a-fA-F]][[0-9a-fA-F]]*)//' monitor.log], [0],
4940 [NXST_FLOW_MONITOR reply:
4941 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=123 actions=output:1
4942OFPT_BARRIER_REPLY:
4943])
4944
2b07c8b1
BP
4945# Check that our own changes are reported as abbreviations.
4946ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
4947ovs-ofctl add-flow br0 in_port=1,actions=output:2
4948ovs-ofctl add-flow br0 in_port=2,actions=output:1
90d721f0 4949ovs-appctl -t ovs-ofctl ofctl/barrier
2b07c8b1
BP
4950ovs-appctl -t ovs-ofctl ofctl/send 010e004812345678003fffff00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003000000000000ffffffffffff0000
4951ovs-appctl -t ovs-ofctl ofctl/barrier
4952AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip], [0], [NXST_FLOW reply:
4953])
4954AT_CHECK([sed 's/ (xid=0x[[1-9a-fA-F]][[0-9a-fA-F]]*)//' monitor.log], [0],
4955[NXST_FLOW_MONITOR reply (xid=0x0):
4956 event=ADDED table=0 cookie=0 in_port=1 actions=output:2
4957NXST_FLOW_MONITOR reply (xid=0x0):
4958 event=ADDED table=0 cookie=0 in_port=2 actions=output:1
90d721f0 4959OFPT_BARRIER_REPLY:
2b07c8b1
BP
4960send: OFPT_FLOW_MOD: DEL priority=0 actions=drop
4961NXST_FLOW_MONITOR reply (xid=0x0):
4962 event=ABBREV xid=0x12345678
cdbdeeda
SH
4963OFPT_BARRIER_REPLY:
4964])
4965
d9c8c57c 4966OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
cdbdeeda
SH
4967OVS_VSWITCHD_STOP
4968AT_CLEANUP
4969
4970AT_SETUP([ofproto - flow monitoring with out_port])
4971AT_KEYWORDS([monitor])
4972OVS_VSWITCHD_START
4973
4974ovs-ofctl add-flow br0 in_port=0,dl_vlan=121,actions=output:1
4975ovs-ofctl add-flow br0 in_port=0,dl_vlan=122,actions=output:1
4976ovs-ofctl add-flow br0 in_port=0,dl_vlan=123,actions=output:2
4977
4978# Start a monitor watching the flow table and check the initial reply.
4979ovs-ofctl monitor br0 watch:out_port=2 --detach --no-chdir --pidfile >monitor.log 2>&1
4980AT_CAPTURE_FILE([monitor.log])
4981ovs-appctl -t ovs-ofctl ofctl/barrier
4982AT_CHECK([sed 's/ (xid=0x[[1-9a-fA-F]][[0-9a-fA-F]]*)//' monitor.log], [0],
4983 [NXST_FLOW_MONITOR reply:
4984 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=123 actions=output:2
4985OFPT_BARRIER_REPLY:
4986])
4987
4988ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
4989
4990# Add, modify flows and check the updates.
4991ovs-ofctl mod-flows br0 dl_vlan=121,actions=drop
4992ovs-ofctl mod-flows br0 dl_vlan=122,actions=output:1,output:2
4993ovs-appctl -t ovs-ofctl ofctl/barrier
4994
4995ovs-ofctl mod-flows br0 dl_vlan=123,actions=output:1,output:2
4996ovs-appctl -t ovs-ofctl ofctl/barrier
4997
4998ovs-ofctl mod-flows br0 dl_vlan=122,actions=output:1
4999ovs-appctl -t ovs-ofctl ofctl/barrier
5000ovs-ofctl mod-flows br0 dl_vlan=123,actions=output:2
5001ovs-appctl -t ovs-ofctl ofctl/barrier
5002
5003AT_CHECK([sed 's/ (xid=0x[[1-9a-fA-F]][[0-9a-fA-F]]*)//' monitor.log], [0],
5004[NXST_FLOW_MONITOR reply (xid=0x0):
5005 event=MODIFIED table=0 cookie=0 in_port=0,dl_vlan=122 actions=output:1,output:2
5006OFPT_BARRIER_REPLY:
5007NXST_FLOW_MONITOR reply (xid=0x0):
5008 event=MODIFIED table=0 cookie=0 in_port=0,dl_vlan=123 actions=output:1,output:2
5009OFPT_BARRIER_REPLY:
5010NXST_FLOW_MONITOR reply (xid=0x0):
5011 event=MODIFIED table=0 cookie=0 in_port=0,dl_vlan=122 actions=output:1
5012OFPT_BARRIER_REPLY:
5013NXST_FLOW_MONITOR reply (xid=0x0):
5014 event=MODIFIED table=0 cookie=0 in_port=0,dl_vlan=123 actions=output:2
2b07c8b1
BP
5015OFPT_BARRIER_REPLY:
5016])
5017
d9c8c57c 5018OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
2b07c8b1
BP
5019OVS_VSWITCHD_STOP
5020AT_CLEANUP
5021
5022AT_SETUP([ofproto - flow monitoring pause and resume])
5023AT_KEYWORDS([monitor])
5024
46a80050
EM
5025# The maximum socket receive buffer size is important for this test, which
5026# tests behavior when the receive buffer overflows.
5027if test -e /proc/sys/net/core/rmem_max; then
5028 # Linux
5029 rmem_max=`cat /proc/sys/net/core/rmem_max`
5030elif rmem_max=`sysctl -n net.inet.tcp.recvbuf_max 2>/dev/null`; then
f3326eeb 5031 : # FreeBSD, NetBSD
46a80050
EM
5032else
5033 # Don't know how to get maximum socket receive buffer on this OS
5034 AT_SKIP_IF([:])
5035fi
2b07c8b1
BP
5036# Calculate the total amount of queuing: rmem_max in the kernel, 128 kB
5037# in ofproto sending userspace (see ofmonitor_flush() in connmgr.c).
2b07c8b1
BP
5038queue_size=`expr $rmem_max + 128 \* 1024`
5039echo rmem_max=$rmem_max queue_size=$queue_size
5040
21aa35c3
BP
5041# If there's too much queuing skip the test to avoid timing out.
5042AT_SKIP_IF([test $rmem_max -gt 1048576])
5043
2b07c8b1
BP
5044# Each flow update message takes up at least 48 bytes of space in queues
5045# and in practice more than that.
5046n_msgs=`expr $queue_size / 48`
5047echo n_msgs=$n_msgs
5048
5049OVS_VSWITCHD_START
5050
5051# Start a monitor watching the flow table, then make it block.
53eb8cb8 5052on_exit 'kill `cat ovs-ofctl.pid`'
2b07c8b1
BP
5053ovs-ofctl monitor br0 watch: --detach --no-chdir --pidfile >monitor.log 2>&1
5054AT_CAPTURE_FILE([monitor.log])
5055ovs-appctl -t ovs-ofctl ofctl/block
5056
5057# Add $n_msgs flows.
5058(echo "in_port=2,actions=output:2"
1ca0323e 5059$PYTHON3 -c '
719dcfd4
BP
5060for i in range('$n_msgs'):
5061 print("cookie=1,reg1=%d,actions=drop" % i)
2b07c8b1
BP
5062') > flows.txt
5063AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
79b8c36c
BP
5064# Check that multipart flow dumps work properly:
5065AT_CHECK([ovs-ofctl diff-flows br0 flows.txt])
2b07c8b1
BP
5066AT_CHECK([ovs-ofctl add-flow br0 in_port=1,cookie=3,actions=drop])
5067AT_CHECK([ovs-ofctl mod-flows br0 in_port=2,cookie=2,actions=output:2])
5068AT_CHECK([ovs-ofctl del-flows br0 cookie=1/-1])
5069
5070ovs-appctl -t ovs-ofctl ofctl/unblock
c4821629
YT
5071
5072# Wait for the connection resumed.
5073# A barrier doesn't work for this purpose.
5074# https://www.mail-archive.com/dev@openvswitch.org/msg27013.html
5075# https://www.mail-archive.com/dev@openvswitch.org/msg27675.html
5076OVS_WAIT_UNTIL([grep NXT_FLOW_MONITOR_RESUMED monitor.log])
2b07c8b1 5077
d9c8c57c 5078OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
2b07c8b1
BP
5079
5080# Check that the flow monitor reported the same number of flows
5081# added and deleted, but fewer than we actually added and deleted.
5082adds=`grep -c 'ADDED.*reg1=' monitor.log`
5083deletes=`grep -c 'DELETED.*reg1=' monitor.log`
5084echo adds=$adds deletes=$deletes
5085AT_CHECK([test $adds -gt 100 && test $adds -lt $n_msgs])
5086AT_CHECK([test $adds = $deletes])
5087
d0ab8a1a
BP
5088# Check that the flow monitor reported everything in the expected order:
5089#
5090# event=ADDED table=0 cookie=0x1 reg1=0x22
5091# ...
5092# NXT_FLOW_MONITOR_PAUSED:
5093# ...
5094# event=DELETED reason=delete table=0 cookie=0x1 reg1=0x22
5095# ...
5096# event=ADDED table=0 cookie=0x3 in_port=1
5097# event=MODIFIED table=0 cookie=0x2 in_port=2 actions=output:2
5098# NXT_FLOW_MONITOR_RESUMED:
5099#
5100# except that, between the PAUSED and RESUMED, the order of the ADDED
5101# and MODIFIED lines lines depends on hash order, that is, it varies
5102# as we change the hash function or change architecture. Therefore,
5103# we use a couple of tests below to accept both orders.
2b07c8b1 5104AT_CHECK([ofctl_strip < monitor.log | sed -n -e '
46a80050 5105/reg1=0x22$/p
2b07c8b1
BP
5106/cookie=0x[[23]]/p
5107/NXT_FLOW_MONITOR_PAUSED:/p
5108/NXT_FLOW_MONITOR_RESUMED:/p
d0ab8a1a
BP
5109' > monitor.log.subset])
5110AT_CHECK([grep -v MODIFIED monitor.log.subset], [0], [dnl
5111 event=ADDED table=0 cookie=0x1 reg1=0x22
2b07c8b1
BP
5112NXT_FLOW_MONITOR_PAUSED:
5113 event=DELETED reason=delete table=0 cookie=0x1 reg1=0x22
5114 event=ADDED table=0 cookie=0x3 in_port=1
d0ab8a1a
BP
5115NXT_FLOW_MONITOR_RESUMED:
5116])
5117AT_CHECK([grep -v ADDED monitor.log.subset], [0], [dnl
5118NXT_FLOW_MONITOR_PAUSED:
5119 event=DELETED reason=delete table=0 cookie=0x1 reg1=0x22
2b07c8b1
BP
5120 event=MODIFIED table=0 cookie=0x2 in_port=2 actions=output:2
5121NXT_FLOW_MONITOR_RESUMED:
5122])
5123
5124OVS_VSWITCHD_STOP
5125AT_CLEANUP
45156451 5126
3e613cd8
AV
5127AT_SETUP([ofproto - flow monitoring usable protocols])
5128AT_KEYWORDS([monitor])
5129
5130OVS_VSWITCHD_START
5131
5132on_exit 'kill `cat ovs-ofctl.pid`'
5133ovs-ofctl -OOpenFlow14 monitor br0 watch:udp,udp_dst=8 --detach --no-chdir --pidfile >monitor.log 2>&1
5134AT_CAPTURE_FILE([monitor.log])
5135
5136# ovs-ofctl should exit because monitor is not supported in OpenFlow 1.4
5137OVS_WAIT_UNTIL([grep "ovs-ofctl: none of the usable flow formats (OpenFlow10,NXM) is among the allowed flow formats (OXM-OpenFlow14)" monitor.log])
5138
5139# check that only NXM flag is returned as usable protocols for sctp_dst
5140# and ovs-ofctl should exit since monitor is not supported in OpenFlow 1.4
5141ovs-ofctl -OOpenFlow14 monitor br0 watch:sctp,sctp_dst=9 --detach --no-chdir --pidfile >monitor.log 2>&1
5142OVS_WAIT_UNTIL([grep "ovs-ofctl: none of the usable flow formats (NXM) is among the allowed flow formats (OXM-OpenFlow14)" monitor.log])
5143
5144OVS_VSWITCHD_STOP
5145AT_CLEANUP
5146
5147
45156451
AC
5148AT_SETUP([ofproto - event filtering (OpenFlow 1.3)])
5149AT_KEYWORDS([monitor])
5150OVS_VSWITCHD_START
5151
5152# Start a monitor, use the required protocol version
5153ovs-ofctl -O OpenFlow13 monitor br0 --detach --no-chdir --pidfile >monitor.log 2>&1
5154AT_CAPTURE_FILE([monitor.log])
5155
5156# Send an OpenFlow13 message (04), OFPT_GET_ASYNC_REQUEST (1a), length (8), xid (0a)
5157ovs-appctl -t ovs-ofctl ofctl/send 041a00080000000a
5158ovs-appctl -t ovs-ofctl ofctl/barrier
5159
5160# Check default setting
5161read -r -d '' expected <<'EOF'
5162EOF
5163
5164AT_CHECK([ofctl_strip < monitor.log], [], [dnl
5165send: OFPT_GET_ASYNC_REQUEST (OF1.3):
5166OFPT_GET_ASYNC_REPLY (OF1.3):
5167 master:
5168 PACKET_IN: no_match action
5169 PORT_STATUS: add delete modify
75754d04 5170 FLOW_REMOVED: idle hard delete group_delete
904e5202
BP
5171 ROLE_STATUS: (off)
5172 TABLE_STATUS: (off)
5173 REQUESTFORWARD: (off)
45156451
AC
5174
5175 slave:
5176 PACKET_IN: (off)
5177 PORT_STATUS: add delete modify
5178 FLOW_REMOVED: (off)
904e5202
BP
5179 ROLE_STATUS: (off)
5180 TABLE_STATUS: (off)
5181 REQUESTFORWARD: (off)
45156451
AC
5182OFPT_BARRIER_REPLY (OF1.3):
5183])
5184
5185OVS_VSWITCHD_STOP
5186AT_CLEANUP
4abb8608
BP
5187
5188AT_SETUP([ofproto - ofport_request])
5189OVS_VSWITCHD_START
ca5792f0 5190add_of_ports br0 1 2 3
4abb8608
BP
5191
5192set_and_check_specific_ofports () {
5193 ovs-vsctl set Interface p1 ofport_request="$1" -- \
5a0e4aec
BP
5194 set Interface p2 ofport_request="$2" -- \
5195 set Interface p3 ofport_request="$3"
4abb8608 5196 ofports=`ovs-vsctl get Interface p1 ofport -- \
5a0e4aec
BP
5197 get Interface p2 ofport -- \
5198 get Interface p3 ofport`
4abb8608
BP
5199 AT_CHECK_UNQUOTED([echo $ofports], [0], [$1 $2 $3
5200])
5201}
5202for pre in '1 2 3' '1 3 2' '2 1 3' '2 3 1' '3 1 2' '3 2 1'; do
5203 for post in '1 2 3' '1 3 2' '2 1 3' '2 3 1' '3 1 2' '3 2 1'; do
5204 echo -----------------------------------------------------------
5205 echo "Check changing port numbers from $pre to $post"
5a0e4aec
BP
5206 set_and_check_specific_ofports $pre
5207 set_and_check_specific_ofports $post
4abb8608
BP
5208 done
5209done
5210
5211ovs-vsctl del-port p3
5212
5213set_and_check_poorly_specified_ofports () {
5214 ovs-vsctl set Interface p1 ofport_request="$1" -- \
5a0e4aec 5215 set Interface p2 ofport_request="$2"
4abb8608
BP
5216 p1=`ovs-vsctl get Interface p1 ofport`
5217 p2=`ovs-vsctl get Interface p2 ofport`
5218 echo $p1 $p2
5219
5220 AT_CHECK([test "$p1" != "$p2"])
5221 if test "$1" = "$2" && test "$1" != '[[]]'; then
5222 # One port number must be the requested one.
5a0e4aec
BP
5223 AT_CHECK([test "$p1" = "$1" || test "$p2" = "$1"])
5224 # The other port number must be different (already tested above).
4abb8608 5225 else
641c6188
YT
5226 AT_CHECK([test "$1" = '[[]]' || test "$p1" = "$1"])
5227 AT_CHECK([test "$2" = '[[]]' || test "$p2" = "$2"])
4abb8608
BP
5228 fi
5229}
5230for pre in '1 2' '[[]] 2' '1 [[]]' '[[]] [[]]' '2 1' '[[]] 1' '2 [[]]' \
5231 '1 1' '2 2'; do
5232 for post in '1 2' '[[]] 2' '1 [[]]' '[[]] [[]]' '2 1' '[[]] 1' '2 [[]]' \
5233 '1 1' '2 2'; do
5234 echo -----------------------------------------------------------
5235 echo "Check changing port numbers from $pre to $post"
5236 set_and_check_poorly_specified_ofports $pre
5237 set_and_check_poorly_specified_ofports $post
5238 done
5239done
5240OVS_VSWITCHD_STOP
5241AT_CLEANUP
777af88d
AC
5242
5243
06d4d4b6 5244AT_SETUP([ofproto - bundle open (OpenFlow 1.4)])
777af88d
AC
5245AT_KEYWORDS([monitor])
5246OVS_VSWITCHD_START
5247
5248# Start a monitor, use the required protocol version
5249ovs-ofctl -O OpenFlow14 monitor br0 --detach --no-chdir --pidfile >monitor.log 2>&1
5250AT_CAPTURE_FILE([monitor.log])
5251
5252# Send an OpenFlow14 message (05), OFPT_BUNDLE_CONTROL (21), length (10), xid (0a)
1f42be1c 5253ovs-appctl -t ovs-ofctl ofctl/send "05 21 00 10 00 00 00 0a 00 00 00 01 00 00 00 02"
777af88d 5254ovs-appctl -t ovs-ofctl ofctl/barrier
d9c8c57c 5255OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
777af88d
AC
5256
5257AT_CHECK([ofctl_strip < monitor.log], [], [dnl
5258send: OFPT_BUNDLE_CONTROL (OF1.4):
1f42be1c 5259 bundle_id=0x1 type=OPEN_REQUEST flags=ordered
777af88d
AC
5260OFPT_BUNDLE_CONTROL (OF1.4):
5261 bundle_id=0x1 type=OPEN_REPLY flags=0
5262OFPT_BARRIER_REPLY (OF1.4):
5263])
5264
5265OVS_VSWITCHD_STOP
5266AT_CLEANUP
5267
06d4d4b6 5268AT_SETUP([ofproto - bundle double open (OpenFlow 1.4)])
777af88d
AC
5269AT_KEYWORDS([monitor])
5270OVS_VSWITCHD_START
5271
5272# Start a monitor, use the required protocol version
5273ovs-ofctl -O OpenFlow14 monitor br0 --detach --no-chdir --pidfile >monitor.log 2>&1
5274AT_CAPTURE_FILE([monitor.log])
5275
5276# Send twice an OpenFlow14 message (05), OFPT_BUNDLE_CONTROL (21), length (10), xid (0a)
1f42be1c 5277ovs-appctl -t ovs-ofctl ofctl/send "05 21 00 10 00 00 00 0a 00 00 00 01 00 00 00 02"
777af88d 5278ovs-appctl -t ovs-ofctl ofctl/barrier
1f42be1c 5279ovs-appctl -t ovs-ofctl ofctl/send "05 21 00 10 00 00 00 0a 00 00 00 01 00 00 00 02"
777af88d 5280ovs-appctl -t ovs-ofctl ofctl/barrier
d9c8c57c 5281OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
777af88d
AC
5282
5283AT_CHECK([ofctl_strip < monitor.log], [0], [dnl
5284send: OFPT_BUNDLE_CONTROL (OF1.4):
1f42be1c 5285 bundle_id=0x1 type=OPEN_REQUEST flags=ordered
777af88d
AC
5286OFPT_BUNDLE_CONTROL (OF1.4):
5287 bundle_id=0x1 type=OPEN_REPLY flags=0
5288OFPT_BARRIER_REPLY (OF1.4):
5289send: OFPT_BUNDLE_CONTROL (OF1.4):
1f42be1c 5290 bundle_id=0x1 type=OPEN_REQUEST flags=ordered
777af88d
AC
5291OFPT_ERROR (OF1.4): OFPBFC_BAD_ID
5292OFPT_BUNDLE_CONTROL (OF1.4):
1f42be1c 5293 bundle_id=0x1 type=OPEN_REQUEST flags=ordered
777af88d
AC
5294OFPT_BARRIER_REPLY (OF1.4):
5295])
5296
5297OVS_VSWITCHD_STOP
5298AT_CLEANUP
5299
5300AT_SETUP([ofproto - bundle close without open (OpenFlow 1.4)])
5301AT_KEYWORDS([monitor])
5302OVS_VSWITCHD_START
5303
5304# Start a monitor, use the required protocol version
5305ovs-ofctl -O OpenFlow14 monitor br0 --detach --no-chdir --pidfile >monitor.log 2>&1
5306AT_CAPTURE_FILE([monitor.log])
5307
1f42be1c 5308ovs-appctl -t ovs-ofctl ofctl/send "05 21 00 10 00 00 00 0a 00 00 00 01 00 02 00 02"
777af88d 5309ovs-appctl -t ovs-ofctl ofctl/barrier
d9c8c57c 5310OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
777af88d
AC
5311
5312AT_CHECK([ofctl_strip < monitor.log], [0], [dnl
5313send: OFPT_BUNDLE_CONTROL (OF1.4):
1f42be1c 5314 bundle_id=0x1 type=CLOSE_REQUEST flags=ordered
777af88d
AC
5315OFPT_ERROR (OF1.4): OFPBFC_BAD_ID
5316OFPT_BUNDLE_CONTROL (OF1.4):
1f42be1c 5317 bundle_id=0x1 type=CLOSE_REQUEST flags=ordered
777af88d
AC
5318OFPT_BARRIER_REPLY (OF1.4):
5319])
5320
5321OVS_VSWITCHD_STOP
5322AT_CLEANUP
5323
5324AT_SETUP([ofproto - bundle double close (OpenFlow 1.4)])
5325AT_KEYWORDS([monitor])
5326OVS_VSWITCHD_START
5327
5328# Start a monitor, use the required protocol version
5329ovs-ofctl -O OpenFlow14 monitor br0 --detach --no-chdir --pidfile >monitor.log 2>&1
5330AT_CAPTURE_FILE([monitor.log])
5331
5332# Open, Close, Close
1f42be1c 5333ovs-appctl -t ovs-ofctl ofctl/send "05 21 00 10 00 00 00 0a 00 00 00 01 00 00 00 02"
777af88d 5334ovs-appctl -t ovs-ofctl ofctl/barrier
1f42be1c 5335ovs-appctl -t ovs-ofctl ofctl/send "05 21 00 10 00 00 00 0a 00 00 00 01 00 02 00 02"
777af88d 5336ovs-appctl -t ovs-ofctl ofctl/barrier
1f42be1c 5337ovs-appctl -t ovs-ofctl ofctl/send "05 21 00 10 00 00 00 0a 00 00 00 01 00 02 00 02"
777af88d 5338ovs-appctl -t ovs-ofctl ofctl/barrier
d9c8c57c 5339OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
777af88d
AC
5340
5341AT_CHECK([ofctl_strip < monitor.log], [0], [dnl
5342send: OFPT_BUNDLE_CONTROL (OF1.4):
1f42be1c 5343 bundle_id=0x1 type=OPEN_REQUEST flags=ordered
777af88d
AC
5344OFPT_BUNDLE_CONTROL (OF1.4):
5345 bundle_id=0x1 type=OPEN_REPLY flags=0
5346OFPT_BARRIER_REPLY (OF1.4):
5347send: OFPT_BUNDLE_CONTROL (OF1.4):
1f42be1c 5348 bundle_id=0x1 type=CLOSE_REQUEST flags=ordered
777af88d
AC
5349OFPT_BUNDLE_CONTROL (OF1.4):
5350 bundle_id=0x1 type=CLOSE_REPLY flags=0
5351OFPT_BARRIER_REPLY (OF1.4):
5352send: OFPT_BUNDLE_CONTROL (OF1.4):
1f42be1c 5353 bundle_id=0x1 type=CLOSE_REQUEST flags=ordered
777af88d
AC
5354OFPT_ERROR (OF1.4): OFPBFC_BUNDLE_CLOSED
5355OFPT_BUNDLE_CONTROL (OF1.4):
1f42be1c 5356 bundle_id=0x1 type=CLOSE_REQUEST flags=ordered
777af88d
AC
5357OFPT_BARRIER_REPLY (OF1.4):
5358])
5359
5360OVS_VSWITCHD_STOP
5361AT_CLEANUP
5362
5363AT_SETUP([ofproto - bundle close, different flags (OpenFlow 1.4)])
5364AT_KEYWORDS([monitor])
5365OVS_VSWITCHD_START
5366
5367# Start a monitor, use the required protocol version
5368ovs-ofctl -O OpenFlow14 monitor br0 --detach --no-chdir --pidfile >monitor.log 2>&1
5369AT_CAPTURE_FILE([monitor.log])
5370
68030e16 5371# Open, Close
1f42be1c 5372ovs-appctl -t ovs-ofctl ofctl/send "05 21 00 10 00 00 00 0a 00 00 00 01 00 00 00 02"
777af88d 5373ovs-appctl -t ovs-ofctl ofctl/barrier
1f42be1c 5374ovs-appctl -t ovs-ofctl ofctl/send "05 21 00 10 00 00 00 0a 00 00 00 01 00 02 00 01"
777af88d 5375ovs-appctl -t ovs-ofctl ofctl/barrier
d9c8c57c 5376OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
777af88d
AC
5377
5378AT_CHECK([ofctl_strip < monitor.log], [0], [dnl
5379send: OFPT_BUNDLE_CONTROL (OF1.4):
1f42be1c 5380 bundle_id=0x1 type=OPEN_REQUEST flags=ordered
777af88d
AC
5381OFPT_BUNDLE_CONTROL (OF1.4):
5382 bundle_id=0x1 type=OPEN_REPLY flags=0
5383OFPT_BARRIER_REPLY (OF1.4):
5384send: OFPT_BUNDLE_CONTROL (OF1.4):
1f42be1c 5385 bundle_id=0x1 type=CLOSE_REQUEST flags=atomic
777af88d
AC
5386OFPT_ERROR (OF1.4): OFPBFC_BAD_FLAGS
5387OFPT_BUNDLE_CONTROL (OF1.4):
1f42be1c 5388 bundle_id=0x1 type=CLOSE_REQUEST flags=atomic
777af88d
AC
5389OFPT_BARRIER_REPLY (OF1.4):
5390])
5391
5392OVS_VSWITCHD_STOP
5393AT_CLEANUP
5394
5395AT_SETUP([ofproto - bundle commit without open (OpenFlow 1.4)])
5396AT_KEYWORDS([monitor])
5397OVS_VSWITCHD_START
5398
5399# Start a monitor, use the required protocol version
5400ovs-ofctl -O OpenFlow14 monitor br0 --detach --no-chdir --pidfile >monitor.log 2>&1
5401AT_CAPTURE_FILE([monitor.log])
5402
68030e16 5403# Commit
1f42be1c 5404ovs-appctl -t ovs-ofctl ofctl/send "05 21 00 10 00 00 00 0a 00 00 00 01 00 04 00 02"
777af88d 5405ovs-appctl -t ovs-ofctl ofctl/barrier
d9c8c57c 5406OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
777af88d
AC
5407
5408AT_CHECK([ofctl_strip < monitor.log], [0], [dnl
5409send: OFPT_BUNDLE_CONTROL (OF1.4):
1f42be1c 5410 bundle_id=0x1 type=COMMIT_REQUEST flags=ordered
777af88d
AC
5411OFPT_ERROR (OF1.4): OFPBFC_BAD_ID
5412OFPT_BUNDLE_CONTROL (OF1.4):
1f42be1c 5413 bundle_id=0x1 type=COMMIT_REQUEST flags=ordered
777af88d
AC
5414OFPT_BARRIER_REPLY (OF1.4):
5415])
5416
5417OVS_VSWITCHD_STOP
5418AT_CLEANUP
5419
5420AT_SETUP([ofproto - bundle commit, different flags (OpenFlow 1.4)])
5421AT_KEYWORDS([monitor])
5422OVS_VSWITCHD_START
5423
5424# Start a monitor, use the required protocol version
5425ovs-ofctl -O OpenFlow14 monitor br0 --detach --no-chdir --pidfile >monitor.log 2>&1
5426AT_CAPTURE_FILE([monitor.log])
5427
68030e16 5428# Open, Commit
1f42be1c 5429ovs-appctl -t ovs-ofctl ofctl/send "05 21 00 10 00 00 00 0a 00 00 00 01 00 00 00 02"
777af88d 5430ovs-appctl -t ovs-ofctl ofctl/barrier
1f42be1c 5431ovs-appctl -t ovs-ofctl ofctl/send "05 21 00 10 00 00 00 0a 00 00 00 01 00 04 00 01"
777af88d 5432ovs-appctl -t ovs-ofctl ofctl/barrier
d9c8c57c 5433OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
777af88d
AC
5434
5435AT_CHECK([ofctl_strip < monitor.log], [0], [dnl
5436send: OFPT_BUNDLE_CONTROL (OF1.4):
1f42be1c 5437 bundle_id=0x1 type=OPEN_REQUEST flags=ordered
777af88d
AC
5438OFPT_BUNDLE_CONTROL (OF1.4):
5439 bundle_id=0x1 type=OPEN_REPLY flags=0
5440OFPT_BARRIER_REPLY (OF1.4):
5441send: OFPT_BUNDLE_CONTROL (OF1.4):
1f42be1c 5442 bundle_id=0x1 type=COMMIT_REQUEST flags=atomic
777af88d
AC
5443OFPT_ERROR (OF1.4): OFPBFC_BAD_FLAGS
5444OFPT_BUNDLE_CONTROL (OF1.4):
1f42be1c 5445 bundle_id=0x1 type=COMMIT_REQUEST flags=atomic
777af88d
AC
5446OFPT_BARRIER_REPLY (OF1.4):
5447])
5448
5449OVS_VSWITCHD_STOP
5450AT_CLEANUP
5451
5452AT_SETUP([ofproto - bundle discard without open (OpenFlow 1.4)])
5453AT_KEYWORDS([monitor])
5454OVS_VSWITCHD_START
5455
5456# Start a monitor, use the required protocol version
5457ovs-ofctl -O OpenFlow14 monitor br0 --detach --no-chdir --pidfile >monitor.log 2>&1
5458AT_CAPTURE_FILE([monitor.log])
5459
68030e16 5460# Discard
1f42be1c 5461ovs-appctl -t ovs-ofctl ofctl/send "05 21 00 10 00 00 00 0a 00 00 00 01 00 06 00 02"
777af88d 5462ovs-appctl -t ovs-ofctl ofctl/barrier
d9c8c57c 5463OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
777af88d
AC
5464
5465AT_CHECK([ofctl_strip < monitor.log], [0], [dnl
5466send: OFPT_BUNDLE_CONTROL (OF1.4):
1f42be1c 5467 bundle_id=0x1 type=DISCARD_REQUEST flags=ordered
777af88d
AC
5468OFPT_ERROR (OF1.4): OFPBFC_BAD_ID
5469OFPT_BUNDLE_CONTROL (OF1.4):
1f42be1c 5470 bundle_id=0x1 type=DISCARD_REQUEST flags=ordered
777af88d
AC
5471OFPT_BARRIER_REPLY (OF1.4):
5472])
5473
5474OVS_VSWITCHD_STOP
5475AT_CLEANUP
db5076ee
JR
5476
5477
5478AT_SETUP([ofproto - bundle with multiple flow mods (OpenFlow 1.4)])
db5076ee
JR
5479OVS_VSWITCHD_START
5480
5481AT_CHECK([ovs-appctl vlog/set vconn:dbg])
5482
50f96b10 5483AT_CHECK([ovs-ofctl --no-names del-flows br0])
db5076ee
JR
5484
5485AT_DATA([flows.txt], [dnl
5486add idle_timeout=50 in_port=2 dl_src=00:66:77:88:99:aa actions=1
5487add idle_timeout=60 in_port=2 dl_src=00:77:88:99:aa:bb actions=2
5488add idle_timeout=70 in_port=2 dl_src=00:88:99:aa:bb:cc actions=3
5489add idle_timeout=50 in_port=2 dl_src=00:66:77:88:99:aa actions=4
5490delete
5491add idle_timeout=50 in_port=2 dl_src=00:66:77:88:99:aa actions=5
5492add idle_timeout=60 in_port=2 dl_src=00:77:88:99:aa:bb actions=6
5493add idle_timeout=70 in_port=2 dl_src=00:88:99:aa:bb:cc actions=7
5494delete in_port=2 dl_src=00:88:99:aa:bb:cc
5495])
5496
50f96b10 5497AT_CHECK([ovs-ofctl --no-names --bundle add-flows br0 flows.txt])
db5076ee
JR
5498
5499AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
5500 idle_timeout=50, in_port=2,dl_src=00:66:77:88:99:aa actions=output:5
5501 idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=output:6
5502NXST_FLOW reply:
5503])
5504
5505AT_DATA([flows.txt], [dnl
5506modify actions=drop
5507modify_strict in_port=2 dl_src=00:77:88:99:aa:bb actions=7
5508])
5509
50f96b10 5510AT_CHECK([ovs-ofctl --no-names --bundle add-flows br0 flows.txt])
db5076ee
JR
5511
5512AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
5513 idle_timeout=50, in_port=2,dl_src=00:66:77:88:99:aa actions=drop
5514 idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=output:7
5515NXST_FLOW reply:
5516])
5517
5518# Adding an existing flow acts as a modify, and delete_strict also works.
5519AT_DATA([flows.txt], [dnl
5520add idle_timeout=60 in_port=2 dl_src=00:77:88:99:aa:bb actions=8
5521delete_strict in_port=2 dl_src=00:66:77:88:99:aa
5522add in_port=2 dl_src=00:66:77:88:99:aa actions=drop
5523])
5524
50f96b10 5525AT_CHECK([ovs-ofctl --no-names --bundle add-flows br0 flows.txt])
db5076ee
JR
5526
5527AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
5528 idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=output:8
5529 in_port=2,dl_src=00:66:77:88:99:aa actions=drop
5530NXST_FLOW reply:
5531])
5532
5533dnl Check logs for OpenFlow trace
5534# Prevent race.
38b0b29f 5535OVS_WAIT_UNTIL([vconn_sub < ovs-vswitchd.log | test `grep -- "|vconn|DBG|unix: sent (Success): NXST_FLOW reply" | wc -l` -ge 3])
12e2ba2e 5536AT_CHECK([print_vconn_debug | vconn_sub | ofctl_strip], [0], [dnl
29718ad4
BP
5537vconn|DBG|unix: sent (Success): OFPT_HELLO (OF1.5):
5538 version bitmap: 0x01, 0x02, 0x03, 0x04, 0x05, 0x06
db5076ee
JR
5539vconn|DBG|unix: received: OFPT_HELLO:
5540 version bitmap: 0x01
29718ad4 5541vconn|DBG|unix: negotiated OpenFlow version 0x01 (we support version 0x06 and earlier, peer supports version 0x01)
db5076ee
JR
5542vconn|DBG|unix: received: OFPT_FLOW_MOD: DEL actions=drop
5543vconn|DBG|unix: received: OFPT_BARRIER_REQUEST:
5544vconn|DBG|unix: sent (Success): OFPT_BARRIER_REPLY:
29718ad4
BP
5545vconn|DBG|unix: sent (Success): OFPT_HELLO (OF1.5):
5546 version bitmap: 0x01, 0x02, 0x03, 0x04, 0x05, 0x06
db5076ee 5547vconn|DBG|unix: received: OFPT_HELLO (OF1.4):
5f8c05ad 5548 version bitmap: 0x05
29718ad4 5549vconn|DBG|unix: negotiated OpenFlow version 0x05 (we support version 0x06 and earlier, peer supports version 0x05)
db5076ee 5550vconn|DBG|unix: received: OFPT_BUNDLE_CONTROL (OF1.4):
39c94593 5551 bundle_id=0 type=OPEN_REQUEST flags=atomic ordered
db5076ee
JR
5552vconn|DBG|unix: sent (Success): OFPT_BUNDLE_CONTROL (OF1.4):
5553 bundle_id=0 type=OPEN_REPLY flags=0
5554vconn|DBG|unix: received: OFPT_BUNDLE_ADD_MESSAGE (OF1.4):
39c94593 5555 bundle_id=0 flags=atomic ordered
db5076ee
JR
5556OFPT_FLOW_MOD (OF1.4): ADD in_port=2,dl_src=00:66:77:88:99:aa idle:50 actions=output:1
5557vconn|DBG|unix: received: OFPT_BUNDLE_ADD_MESSAGE (OF1.4):
39c94593 5558 bundle_id=0 flags=atomic ordered
db5076ee
JR
5559OFPT_FLOW_MOD (OF1.4): ADD in_port=2,dl_src=00:77:88:99:aa:bb idle:60 actions=output:2
5560vconn|DBG|unix: received: OFPT_BUNDLE_ADD_MESSAGE (OF1.4):
39c94593 5561 bundle_id=0 flags=atomic ordered
db5076ee
JR
5562OFPT_FLOW_MOD (OF1.4): ADD in_port=2,dl_src=00:88:99:aa:bb:cc idle:70 actions=output:3
5563vconn|DBG|unix: received: OFPT_BUNDLE_ADD_MESSAGE (OF1.4):
39c94593 5564 bundle_id=0 flags=atomic ordered
db5076ee
JR
5565OFPT_FLOW_MOD (OF1.4): ADD in_port=2,dl_src=00:66:77:88:99:aa idle:50 actions=output:4
5566vconn|DBG|unix: received: OFPT_BUNDLE_ADD_MESSAGE (OF1.4):
39c94593 5567 bundle_id=0 flags=atomic ordered
db5076ee
JR
5568OFPT_FLOW_MOD (OF1.4): DEL table:255 actions=drop
5569vconn|DBG|unix: received: OFPT_BUNDLE_ADD_MESSAGE (OF1.4):
39c94593 5570 bundle_id=0 flags=atomic ordered
db5076ee
JR
5571OFPT_FLOW_MOD (OF1.4): ADD in_port=2,dl_src=00:66:77:88:99:aa idle:50 actions=output:5
5572vconn|DBG|unix: received: OFPT_BUNDLE_ADD_MESSAGE (OF1.4):
39c94593 5573 bundle_id=0 flags=atomic ordered
db5076ee
JR
5574OFPT_FLOW_MOD (OF1.4): ADD in_port=2,dl_src=00:77:88:99:aa:bb idle:60 actions=output:6
5575vconn|DBG|unix: received: OFPT_BUNDLE_ADD_MESSAGE (OF1.4):
39c94593 5576 bundle_id=0 flags=atomic ordered
db5076ee
JR
5577OFPT_FLOW_MOD (OF1.4): ADD in_port=2,dl_src=00:88:99:aa:bb:cc idle:70 actions=output:7
5578vconn|DBG|unix: received: OFPT_BUNDLE_ADD_MESSAGE (OF1.4):
39c94593 5579 bundle_id=0 flags=atomic ordered
db5076ee 5580OFPT_FLOW_MOD (OF1.4): DEL table:255 in_port=2,dl_src=00:88:99:aa:bb:cc actions=drop
506c1ddb
JR
5581vconn|DBG|unix: received: OFPT_BARRIER_REQUEST (OF1.4):
5582vconn|DBG|unix: sent (Success): OFPT_BARRIER_REPLY (OF1.4):
db5076ee 5583vconn|DBG|unix: received: OFPT_BUNDLE_CONTROL (OF1.4):
39c94593 5584 bundle_id=0 type=COMMIT_REQUEST flags=atomic ordered
db5076ee
JR
5585vconn|DBG|unix: sent (Success): OFPT_BUNDLE_CONTROL (OF1.4):
5586 bundle_id=0 type=COMMIT_REPLY flags=0
29718ad4
BP
5587vconn|DBG|unix: sent (Success): OFPT_HELLO (OF1.5):
5588 version bitmap: 0x01, 0x02, 0x03, 0x04, 0x05, 0x06
db5076ee
JR
5589vconn|DBG|unix: received: OFPT_HELLO:
5590 version bitmap: 0x01
29718ad4 5591vconn|DBG|unix: negotiated OpenFlow version 0x01 (we support version 0x06 and earlier, peer supports version 0x01)
db5076ee
JR
5592vconn|DBG|unix: received: NXT_SET_FLOW_FORMAT: format=nxm
5593vconn|DBG|unix: received: OFPT_BARRIER_REQUEST:
5594vconn|DBG|unix: sent (Success): OFPT_BARRIER_REPLY:
5595vconn|DBG|unix: received: NXST_FLOW request:
5596vconn|DBG|unix: sent (Success): NXST_FLOW reply:
5597 idle_timeout=50, in_port=2,dl_src=00:66:77:88:99:aa actions=output:5
5598 idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=output:6
29718ad4
BP
5599vconn|DBG|unix: sent (Success): OFPT_HELLO (OF1.5):
5600 version bitmap: 0x01, 0x02, 0x03, 0x04, 0x05, 0x06
db5076ee 5601vconn|DBG|unix: received: OFPT_HELLO (OF1.4):
5f8c05ad 5602 version bitmap: 0x05
29718ad4 5603vconn|DBG|unix: negotiated OpenFlow version 0x05 (we support version 0x06 and earlier, peer supports version 0x05)
db5076ee 5604vconn|DBG|unix: received: OFPT_BUNDLE_CONTROL (OF1.4):
39c94593 5605 bundle_id=0 type=OPEN_REQUEST flags=atomic ordered
db5076ee
JR
5606vconn|DBG|unix: sent (Success): OFPT_BUNDLE_CONTROL (OF1.4):
5607 bundle_id=0 type=OPEN_REPLY flags=0
5608vconn|DBG|unix: received: OFPT_BUNDLE_ADD_MESSAGE (OF1.4):
39c94593 5609 bundle_id=0 flags=atomic ordered
db5076ee
JR
5610OFPT_FLOW_MOD (OF1.4): MOD actions=drop
5611vconn|DBG|unix: received: OFPT_BUNDLE_ADD_MESSAGE (OF1.4):
39c94593 5612 bundle_id=0 flags=atomic ordered
db5076ee 5613OFPT_FLOW_MOD (OF1.4): MOD_STRICT in_port=2,dl_src=00:77:88:99:aa:bb actions=output:7
506c1ddb
JR
5614vconn|DBG|unix: received: OFPT_BARRIER_REQUEST (OF1.4):
5615vconn|DBG|unix: sent (Success): OFPT_BARRIER_REPLY (OF1.4):
db5076ee 5616vconn|DBG|unix: received: OFPT_BUNDLE_CONTROL (OF1.4):
39c94593 5617 bundle_id=0 type=COMMIT_REQUEST flags=atomic ordered
db5076ee
JR
5618vconn|DBG|unix: sent (Success): OFPT_BUNDLE_CONTROL (OF1.4):
5619 bundle_id=0 type=COMMIT_REPLY flags=0
29718ad4
BP
5620vconn|DBG|unix: sent (Success): OFPT_HELLO (OF1.5):
5621 version bitmap: 0x01, 0x02, 0x03, 0x04, 0x05, 0x06
db5076ee
JR
5622vconn|DBG|unix: received: OFPT_HELLO:
5623 version bitmap: 0x01
29718ad4 5624vconn|DBG|unix: negotiated OpenFlow version 0x01 (we support version 0x06 and earlier, peer supports version 0x01)
db5076ee
JR
5625vconn|DBG|unix: received: NXT_SET_FLOW_FORMAT: format=nxm
5626vconn|DBG|unix: received: OFPT_BARRIER_REQUEST:
5627vconn|DBG|unix: sent (Success): OFPT_BARRIER_REPLY:
5628vconn|DBG|unix: received: NXST_FLOW request:
5629vconn|DBG|unix: sent (Success): NXST_FLOW reply:
5630 idle_timeout=50, in_port=2,dl_src=00:66:77:88:99:aa actions=drop
5631 idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=output:7
29718ad4
BP
5632vconn|DBG|unix: sent (Success): OFPT_HELLO (OF1.5):
5633 version bitmap: 0x01, 0x02, 0x03, 0x04, 0x05, 0x06
db5076ee 5634vconn|DBG|unix: received: OFPT_HELLO (OF1.4):
5f8c05ad 5635 version bitmap: 0x05
29718ad4 5636vconn|DBG|unix: negotiated OpenFlow version 0x05 (we support version 0x06 and earlier, peer supports version 0x05)
db5076ee 5637vconn|DBG|unix: received: OFPT_BUNDLE_CONTROL (OF1.4):
39c94593 5638 bundle_id=0 type=OPEN_REQUEST flags=atomic ordered
db5076ee
JR
5639vconn|DBG|unix: sent (Success): OFPT_BUNDLE_CONTROL (OF1.4):
5640 bundle_id=0 type=OPEN_REPLY flags=0
5641vconn|DBG|unix: received: OFPT_BUNDLE_ADD_MESSAGE (OF1.4):
39c94593 5642 bundle_id=0 flags=atomic ordered
db5076ee
JR
5643OFPT_FLOW_MOD (OF1.4): ADD in_port=2,dl_src=00:77:88:99:aa:bb idle:60 actions=output:8
5644vconn|DBG|unix: received: OFPT_BUNDLE_ADD_MESSAGE (OF1.4):
39c94593 5645 bundle_id=0 flags=atomic ordered
db5076ee
JR
5646OFPT_FLOW_MOD (OF1.4): DEL_STRICT table:255 in_port=2,dl_src=00:66:77:88:99:aa actions=drop
5647vconn|DBG|unix: received: OFPT_BUNDLE_ADD_MESSAGE (OF1.4):
39c94593 5648 bundle_id=0 flags=atomic ordered
db5076ee 5649OFPT_FLOW_MOD (OF1.4): ADD in_port=2,dl_src=00:66:77:88:99:aa actions=drop
506c1ddb
JR
5650vconn|DBG|unix: received: OFPT_BARRIER_REQUEST (OF1.4):
5651vconn|DBG|unix: sent (Success): OFPT_BARRIER_REPLY (OF1.4):
db5076ee 5652vconn|DBG|unix: received: OFPT_BUNDLE_CONTROL (OF1.4):
39c94593 5653 bundle_id=0 type=COMMIT_REQUEST flags=atomic ordered
db5076ee
JR
5654vconn|DBG|unix: sent (Success): OFPT_BUNDLE_CONTROL (OF1.4):
5655 bundle_id=0 type=COMMIT_REPLY flags=0
29718ad4
BP
5656vconn|DBG|unix: sent (Success): OFPT_HELLO (OF1.5):
5657 version bitmap: 0x01, 0x02, 0x03, 0x04, 0x05, 0x06
db5076ee
JR
5658vconn|DBG|unix: received: OFPT_HELLO:
5659 version bitmap: 0x01
29718ad4 5660vconn|DBG|unix: negotiated OpenFlow version 0x01 (we support version 0x06 and earlier, peer supports version 0x01)
db5076ee
JR
5661vconn|DBG|unix: received: NXT_SET_FLOW_FORMAT: format=nxm
5662vconn|DBG|unix: received: OFPT_BARRIER_REQUEST:
5663vconn|DBG|unix: sent (Success): OFPT_BARRIER_REPLY:
5664vconn|DBG|unix: received: NXST_FLOW request:
5665vconn|DBG|unix: sent (Success): NXST_FLOW reply:
5666 idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=output:8
5667 in_port=2,dl_src=00:66:77:88:99:aa actions=drop
5668])
5669
14347f3e 5670AT_CHECK([grep " flow_mods in the last " ovs-vswitchd.log | sed -e 's/^.*connmgr|INFO|//' | vconn_sub], [0], [dnl
0c78eebe
JR
5671br0<->unix: 1 flow_mods in the last 0 s (1 deletes)
5672br0<->unix: 9 flow_mods in the last 0 s (7 adds, 2 deletes)
5673br0<->unix: 2 flow_mods in the last 0 s (2 modifications)
5674br0<->unix: 3 flow_mods in the last 0 s (2 adds, 1 deletes)
5675])
5676
db5076ee
JR
5677OVS_VSWITCHD_STOP
5678AT_CLEANUP
5679
5680
5681AT_SETUP([ofproto - failing bundle commit (OpenFlow 1.4)])
db5076ee
JR
5682OVS_VSWITCHD_START
5683
5684AT_CHECK([ovs-ofctl del-flows br0])
5685
5686ovs-ofctl add-flows br0 - <<EOF
5687idle_timeout=50 in_port=2 dl_src=00:66:77:88:99:aa actions=11
5688idle_timeout=60 in_port=2 dl_src=00:77:88:99:aa:bb actions=22
5689idle_timeout=70 in_port=2 dl_src=00:88:99:aa:bb:cc actions=33
5690EOF
5691AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
5692 idle_timeout=50, in_port=2,dl_src=00:66:77:88:99:aa actions=output:11
5693 idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=output:22
5694 idle_timeout=70, in_port=2,dl_src=00:88:99:aa:bb:cc actions=output:33
5695NXST_FLOW reply:
5696])
5697
5698# last line uses illegal table number (OVS internal table)
5699AT_DATA([flows.txt], [dnl
5700add idle_timeout=50 in_port=2 dl_src=00:66:77:88:99:aa actions=1
5701add idle_timeout=60 in_port=2 dl_src=00:77:88:99:aa:bb actions=2
5702add idle_timeout=70 in_port=2 dl_src=00:88:99:aa:bb:cc actions=3
5703modify idle_timeout=50 in_port=2 dl_src=00:66:77:88:99:aa actions=4
5704delete
5705add idle_timeout=50 in_port=2 dl_src=00:66:77:88:99:aa actions=5
5706add idle_timeout=60 in_port=2 dl_src=00:77:88:99:aa:bb actions=6
5707add idle_timeout=70 in_port=2 dl_src=00:88:99:aa:bb:cc actions=7
5708delete in_port=2 dl_src=00:88:99:aa:bb:cc
5709add table=254 actions=drop
5710])
5711
50f96b10 5712AT_CHECK([ovs-ofctl --bundle add-flows br0 flows.txt 2>&1 | sed '/talking to/,$d' | strip_xids],
b0065993 5713[0], [dnl
50f96b10 5714Error OFPBRC_EPERM for: OFPT_FLOW_MOD (OF1.4): ADD table:254 actions=drop
db5076ee
JR
5715])
5716
5717AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
5718 idle_timeout=50, in_port=2,dl_src=00:66:77:88:99:aa actions=output:11
5719 idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=output:22
5720 idle_timeout=70, in_port=2,dl_src=00:88:99:aa:bb:cc actions=output:33
5721NXST_FLOW reply:
5722])
5723
5724OVS_VSWITCHD_STOP
5725AT_CLEANUP
51bb26fa
JR
5726
5727
5728AT_SETUP([ofproto - bundle timeout (OpenFlow 1.4)])
5729AT_KEYWORDS([monitor])
5730OVS_VSWITCHD_START
5731
5732# Start a monitor, use the required protocol version
5733ovs-ofctl -O OpenFlow14 monitor br0 --detach --no-chdir --pidfile >monitor.log 2>&1
5734AT_CAPTURE_FILE([monitor.log])
5735
5736ovs-appctl time/stop
5737
5738# Send an OpenFlow14 message (05), OFPT_BUNDLE_CONTROL (21), length (10), xid (01)
5739ovs-appctl -t ovs-ofctl ofctl/send "05 21 00 10 00 00 00 01 00 00 00 01 00 00 00 03"
5740ovs-appctl time/warp 8000
5741# Send a bundle flow mod, it should keep the bundle alive.
5742ovs-appctl -t ovs-ofctl ofctl/send "05 22 00 a0 00 00 00 02 00 00 00 01 00 00 00 03 \
574305 0e 00 90 00 00 00 02 00 00 00 00 00 00 00 00 \
574400 00 00 00 00 00 00 00 01 00 00 00 00 00 ff ff \
5745ff ff ff ff ff ff ff ff ff ff ff ff 00 00 00 00 \
574600 01 00 42 80 00 00 04 00 00 00 01 80 00 08 06 \
574750 54 00 00 00 06 80 00 06 06 50 54 00 00 00 05 \
574880 00 0a 02 08 06 80 00 0c 02 00 00 80 00 2a 02 \
574900 02 80 00 2c 04 c0 a8 00 02 80 00 2e 04 c0 a8 \
575000 01 00 00 00 00 00 00 00 04 00 18 00 00 00 00 \
575100 00 00 10 00 00 00 03 00 00 00 00 00 00 00 00 \
5752"
5753ovs-appctl time/warp 8000
5754# Send a bundle close, it should keep the bundle alive.
5755ovs-appctl -t ovs-ofctl ofctl/send "05 21 00 10 00 00 00 03 00 00 00 01 00 02 00 03"
5756ovs-appctl time/warp 11000
5757# Make sure that timeouts are processed after the expiry
5758ovs-appctl time/warp 1000
5759# Send a Commit, but too late.
5760ovs-appctl -t ovs-ofctl ofctl/send "05 21 00 10 00 00 00 04 00 00 00 01 00 04 00 03"
5761ovs-appctl -t ovs-ofctl ofctl/barrier
5762OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
5763
5764AT_CHECK([ofctl_strip < monitor.log], [], [dnl
5765send: OFPT_BUNDLE_CONTROL (OF1.4):
5766 bundle_id=0x1 type=OPEN_REQUEST flags=atomic ordered
5767OFPT_BUNDLE_CONTROL (OF1.4):
5768 bundle_id=0x1 type=OPEN_REPLY flags=0
5769send: OFPT_BUNDLE_ADD_MESSAGE (OF1.4):
5770 bundle_id=0x1 flags=atomic ordered
5771OFPT_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
5772send: OFPT_BUNDLE_CONTROL (OF1.4):
5773 bundle_id=0x1 type=CLOSE_REQUEST flags=atomic ordered
5774OFPT_BUNDLE_CONTROL (OF1.4):
5775 bundle_id=0x1 type=CLOSE_REPLY flags=0
5776OFPT_ERROR (OF1.4): OFPBFC_TIMEOUT
5777OFPT_BUNDLE_CONTROL (OF1.4):
5778 bundle_id=0x1 type=OPEN_REQUEST flags=atomic ordered
5779send: OFPT_BUNDLE_CONTROL (OF1.4):
5780 bundle_id=0x1 type=COMMIT_REQUEST flags=atomic ordered
5781OFPT_ERROR (OF1.4): OFPBFC_BAD_ID
5782OFPT_BUNDLE_CONTROL (OF1.4):
5783 bundle_id=0x1 type=COMMIT_REQUEST flags=atomic ordered
5784OFPT_BARRIER_REPLY (OF1.4):
5785])
5786
5787OVS_VSWITCHD_STOP
5788AT_CLEANUP
06d4d4b6 5789
7fdd2082
FL
5790AT_SETUP([ofproto - bundle custom timeout (OpenFlow 1.4)])
5791AT_KEYWORDS([monitor])
5792OVS_VSWITCHD_START
5793
5794AT_CHECK([ovs-vsctl set Open_vSwitch . other_config:bundle-idle-timeout=4])
5795
5796# Start a monitor, use the required protocol version
5797ovs-ofctl -O OpenFlow14 monitor br0 --detach --no-chdir --pidfile >monitor.log 2>&1
5798AT_CAPTURE_FILE([monitor.log])
5799
5800ovs-appctl time/stop
5801
5802# Send an OpenFlow14 message (05), OFPT_BUNDLE_CONTROL (21), length (10), xid (01)
5803ovs-appctl -t ovs-ofctl ofctl/send "05 21 00 10 00 00 00 01 00 00 00 01 00 00 00 03"
5804ovs-appctl time/warp 2000
5805# Send a bundle flow mod, it should keep the bundle alive.
5806ovs-appctl -t ovs-ofctl ofctl/send "05 22 00 a0 00 00 00 02 00 00 00 01 00 00 00 03 \
580705 0e 00 90 00 00 00 02 00 00 00 00 00 00 00 00 \
580800 00 00 00 00 00 00 00 01 00 00 00 00 00 ff ff \
5809ff ff ff ff ff ff ff ff ff ff ff ff 00 00 00 00 \
581000 01 00 42 80 00 00 04 00 00 00 01 80 00 08 06 \
581150 54 00 00 00 06 80 00 06 06 50 54 00 00 00 05 \
581280 00 0a 02 08 06 80 00 0c 02 00 00 80 00 2a 02 \
581300 02 80 00 2c 04 c0 a8 00 02 80 00 2e 04 c0 a8 \
581400 01 00 00 00 00 00 00 00 04 00 18 00 00 00 00 \
581500 00 00 10 00 00 00 03 00 00 00 00 00 00 00 00 \
5816"
5817ovs-appctl time/warp 2000
5818# Send a bundle close, it should keep the bundle alive.
5819ovs-appctl -t ovs-ofctl ofctl/send "05 21 00 10 00 00 00 03 00 00 00 01 00 02 00 03"
5820ovs-appctl time/warp 4000
5821# Make sure that timeouts are processed after the expiry, but still before the
5822# current timeout of 4s.
5823ovs-appctl time/warp 1000
5824# Send a Commit, but too late.
5825ovs-appctl -t ovs-ofctl ofctl/send "05 21 00 10 00 00 00 04 00 00 00 01 00 04 00 03"
5826ovs-appctl -t ovs-ofctl ofctl/barrier
5827OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
5828
5829AT_CHECK([ofctl_strip < monitor.log], [], [dnl
5830send: OFPT_BUNDLE_CONTROL (OF1.4):
5831 bundle_id=0x1 type=OPEN_REQUEST flags=atomic ordered
5832OFPT_BUNDLE_CONTROL (OF1.4):
5833 bundle_id=0x1 type=OPEN_REPLY flags=0
5834send: OFPT_BUNDLE_ADD_MESSAGE (OF1.4):
5835 bundle_id=0x1 flags=atomic ordered
5836OFPT_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
5837send: OFPT_BUNDLE_CONTROL (OF1.4):
5838 bundle_id=0x1 type=CLOSE_REQUEST flags=atomic ordered
5839OFPT_BUNDLE_CONTROL (OF1.4):
5840 bundle_id=0x1 type=CLOSE_REPLY flags=0
5841OFPT_ERROR (OF1.4): OFPBFC_TIMEOUT
5842OFPT_BUNDLE_CONTROL (OF1.4):
5843 bundle_id=0x1 type=OPEN_REQUEST flags=atomic ordered
5844send: OFPT_BUNDLE_CONTROL (OF1.4):
5845 bundle_id=0x1 type=COMMIT_REQUEST flags=atomic ordered
5846OFPT_ERROR (OF1.4): OFPBFC_BAD_ID
5847OFPT_BUNDLE_CONTROL (OF1.4):
5848 bundle_id=0x1 type=COMMIT_REQUEST flags=atomic ordered
5849OFPT_BARRIER_REPLY (OF1.4):
5850])
5851
5852OVS_VSWITCHD_STOP
5853AT_CLEANUP
5854
5855AT_SETUP([ofproto - bundle reset timeout to default (OpenFlow 1.4)])
5856AT_KEYWORDS([monitor])
5857OVS_VSWITCHD_START
5858
5859AT_CHECK([ovs-vsctl set Open_vSwitch . other_config:bundle-idle-timeout=15])
5860AT_CHECK([ovs-vsctl remove Open_vSwitch . other_config bundle-idle-timeout])
5861
5862# Start a monitor, use the required protocol version
5863ovs-ofctl -O OpenFlow14 monitor br0 --detach --no-chdir --pidfile >monitor.log 2>&1
5864AT_CAPTURE_FILE([monitor.log])
5865
5866ovs-appctl time/stop
5867
5868# Send an OpenFlow14 message (05), OFPT_BUNDLE_CONTROL (21), length (10), xid (01)
5869ovs-appctl -t ovs-ofctl ofctl/send "05 21 00 10 00 00 00 01 00 00 00 01 00 00 00 03"
5870ovs-appctl time/warp 8000
5871# Send a bundle flow mod, it should keep the bundle alive.
5872ovs-appctl -t ovs-ofctl ofctl/send "05 22 00 a0 00 00 00 02 00 00 00 01 00 00 00 03 \
587305 0e 00 90 00 00 00 02 00 00 00 00 00 00 00 00 \
587400 00 00 00 00 00 00 00 01 00 00 00 00 00 ff ff \
5875ff ff ff ff ff ff ff ff ff ff ff ff 00 00 00 00 \
587600 01 00 42 80 00 00 04 00 00 00 01 80 00 08 06 \
587750 54 00 00 00 06 80 00 06 06 50 54 00 00 00 05 \
587880 00 0a 02 08 06 80 00 0c 02 00 00 80 00 2a 02 \
587900 02 80 00 2c 04 c0 a8 00 02 80 00 2e 04 c0 a8 \
588000 01 00 00 00 00 00 00 00 04 00 18 00 00 00 00 \
588100 00 00 10 00 00 00 03 00 00 00 00 00 00 00 00 \
5882"
5883ovs-appctl time/warp 8000
5884# Send a bundle close, it should keep the bundle alive.
5885ovs-appctl -t ovs-ofctl ofctl/send "05 21 00 10 00 00 00 03 00 00 00 01 00 02 00 03"
5886ovs-appctl time/warp 11000
5887# Make sure that timeouts are processed after the expiry
5888ovs-appctl time/warp 1000
5889# Send a Commit, but too late.
5890ovs-appctl -t ovs-ofctl ofctl/send "05 21 00 10 00 00 00 04 00 00 00 01 00 04 00 03"
5891ovs-appctl -t ovs-ofctl ofctl/barrier
5892OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
5893
5894AT_CHECK([ofctl_strip < monitor.log], [], [dnl
5895send: OFPT_BUNDLE_CONTROL (OF1.4):
5896 bundle_id=0x1 type=OPEN_REQUEST flags=atomic ordered
5897OFPT_BUNDLE_CONTROL (OF1.4):
5898 bundle_id=0x1 type=OPEN_REPLY flags=0
5899send: OFPT_BUNDLE_ADD_MESSAGE (OF1.4):
5900 bundle_id=0x1 flags=atomic ordered
5901OFPT_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
5902send: OFPT_BUNDLE_CONTROL (OF1.4):
5903 bundle_id=0x1 type=CLOSE_REQUEST flags=atomic ordered
5904OFPT_BUNDLE_CONTROL (OF1.4):
5905 bundle_id=0x1 type=CLOSE_REPLY flags=0
5906OFPT_ERROR (OF1.4): OFPBFC_TIMEOUT
5907OFPT_BUNDLE_CONTROL (OF1.4):
5908 bundle_id=0x1 type=OPEN_REQUEST flags=atomic ordered
5909send: OFPT_BUNDLE_CONTROL (OF1.4):
5910 bundle_id=0x1 type=COMMIT_REQUEST flags=atomic ordered
5911OFPT_ERROR (OF1.4): OFPBFC_BAD_ID
5912OFPT_BUNDLE_CONTROL (OF1.4):
5913 bundle_id=0x1 type=COMMIT_REQUEST flags=atomic ordered
5914OFPT_BARRIER_REPLY (OF1.4):
5915])
5916
5917OVS_VSWITCHD_STOP
5918AT_CLEANUP
06d4d4b6
JR
5919
5920AT_SETUP([ofproto - bundle open (OpenFlow 1.3)])
5921AT_KEYWORDS([monitor])
5922OVS_VSWITCHD_START
5923
5924# Start a monitor, use the required protocol version
5925ovs-ofctl -O OpenFlow13 monitor br0 --detach --no-chdir --pidfile >monitor.log 2>&1
5926AT_CAPTURE_FILE([monitor.log])
5927
5928# Send an OpenFlow13 message (04), OFPT_EXPERIMENTER (04), length (0018),
5929# xid (0000000a), ONF_EXPERIMENTER_ID (4F4E4600),
5930# ONFT_BUNDLE_CONTROL (2300 = 0x08FC), bundle id (00000001),
5931# message type (0000), and flags (0002)
5932ovs-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"
5933ovs-appctl -t ovs-ofctl ofctl/barrier
d9c8c57c 5934OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
06d4d4b6
JR
5935
5936AT_CHECK([ofctl_strip < monitor.log], [], [dnl
5937send: ONFT_BUNDLE_CONTROL (OF1.3):
5938 bundle_id=0x1 type=OPEN_REQUEST flags=ordered
5939ONFT_BUNDLE_CONTROL (OF1.3):
5940 bundle_id=0x1 type=OPEN_REPLY flags=0
5941OFPT_BARRIER_REPLY (OF1.3):
5942])
5943
5944OVS_VSWITCHD_STOP
5945AT_CLEANUP
5946
5947AT_SETUP([ofproto - bundle double open (OpenFlow 1.3)])
5948AT_KEYWORDS([monitor])
5949OVS_VSWITCHD_START
5950
5951# Start a monitor, use the required protocol version
5952ovs-ofctl -O OpenFlow13 monitor br0 --detach --no-chdir --pidfile >monitor.log 2>&1
5953AT_CAPTURE_FILE([monitor.log])
5954
5955# Send twice an OpenFlow13 message (04), OFPT_EXPERIMENTER (04), length (0018),
5956# xid (0000000a), ONF_EXPERIMENTER_ID (4F4E4600),
5957# ONFT_BUNDLE_CONTROL (2300 = 0x08FC), bundle id (00000001),
5958# message type (0000), and flags (0002)
5959ovs-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"
5960ovs-appctl -t ovs-ofctl ofctl/barrier
5961ovs-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"
5962ovs-appctl -t ovs-ofctl ofctl/barrier
d9c8c57c 5963OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
06d4d4b6
JR
5964
5965AT_CHECK([ofctl_strip < monitor.log], [0], [dnl
5966send: ONFT_BUNDLE_CONTROL (OF1.3):
5967 bundle_id=0x1 type=OPEN_REQUEST flags=ordered
5968ONFT_BUNDLE_CONTROL (OF1.3):
5969 bundle_id=0x1 type=OPEN_REPLY flags=0
5970OFPT_BARRIER_REPLY (OF1.3):
5971send: ONFT_BUNDLE_CONTROL (OF1.3):
5972 bundle_id=0x1 type=OPEN_REQUEST flags=ordered
5973OFPT_ERROR (OF1.3): OFPBFC_BAD_ID
5974ONFT_BUNDLE_CONTROL (OF1.3):
5975 bundle_id=0x1 type=OPEN_REQUEST flags=ordered
5976OFPT_BARRIER_REPLY (OF1.3):
5977])
5978
5979OVS_VSWITCHD_STOP
5980AT_CLEANUP
5981
5982AT_SETUP([ofproto - bundle close without open (OpenFlow 1.3)])
5983AT_KEYWORDS([monitor])
5984OVS_VSWITCHD_START
5985
5986# Start a monitor, use the required protocol version
5987ovs-ofctl -O OpenFlow13 monitor br0 --detach --no-chdir --pidfile >monitor.log 2>&1
5988AT_CAPTURE_FILE([monitor.log])
5989
5990ovs-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"
5991ovs-appctl -t ovs-ofctl ofctl/barrier
d9c8c57c 5992OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
06d4d4b6
JR
5993
5994AT_CHECK([ofctl_strip < monitor.log], [0], [dnl
5995send: ONFT_BUNDLE_CONTROL (OF1.3):
5996 bundle_id=0x1 type=CLOSE_REQUEST flags=ordered
5997OFPT_ERROR (OF1.3): OFPBFC_BAD_ID
5998ONFT_BUNDLE_CONTROL (OF1.3):
5999 bundle_id=0x1 type=CLOSE_REQUEST flags=ordered
6000OFPT_BARRIER_REPLY (OF1.3):
6001])
6002
6003OVS_VSWITCHD_STOP
6004AT_CLEANUP
6005
6006AT_SETUP([ofproto - bundle double close (OpenFlow 1.3)])
6007AT_KEYWORDS([monitor])
6008OVS_VSWITCHD_START
6009
6010# Start a monitor, use the required protocol version
6011ovs-ofctl -O OpenFlow13 monitor br0 --detach --no-chdir --pidfile >monitor.log 2>&1
6012AT_CAPTURE_FILE([monitor.log])
6013
6014# Open, Close, Close
6015ovs-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"
6016ovs-appctl -t ovs-ofctl ofctl/barrier
6017ovs-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"
6018ovs-appctl -t ovs-ofctl ofctl/barrier
6019ovs-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"
6020ovs-appctl -t ovs-ofctl ofctl/barrier
d9c8c57c 6021OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
06d4d4b6
JR
6022
6023AT_CHECK([ofctl_strip < monitor.log], [0], [dnl
6024send: ONFT_BUNDLE_CONTROL (OF1.3):
6025 bundle_id=0x1 type=OPEN_REQUEST flags=ordered
6026ONFT_BUNDLE_CONTROL (OF1.3):
6027 bundle_id=0x1 type=OPEN_REPLY flags=0
6028OFPT_BARRIER_REPLY (OF1.3):
6029send: ONFT_BUNDLE_CONTROL (OF1.3):
6030 bundle_id=0x1 type=CLOSE_REQUEST flags=ordered
6031ONFT_BUNDLE_CONTROL (OF1.3):
6032 bundle_id=0x1 type=CLOSE_REPLY flags=0
6033OFPT_BARRIER_REPLY (OF1.3):
6034send: ONFT_BUNDLE_CONTROL (OF1.3):
6035 bundle_id=0x1 type=CLOSE_REQUEST flags=ordered
6036OFPT_ERROR (OF1.3): OFPBFC_BUNDLE_CLOSED
6037ONFT_BUNDLE_CONTROL (OF1.3):
6038 bundle_id=0x1 type=CLOSE_REQUEST flags=ordered
6039OFPT_BARRIER_REPLY (OF1.3):
6040])
6041
6042OVS_VSWITCHD_STOP
6043AT_CLEANUP
6044
6045AT_SETUP([ofproto - bundle close, different flags (OpenFlow 1.3)])
6046AT_KEYWORDS([monitor])
6047OVS_VSWITCHD_START
6048
6049# Start a monitor, use the required protocol version
6050ovs-ofctl -O OpenFlow13 monitor br0 --detach --no-chdir --pidfile >monitor.log 2>&1
6051AT_CAPTURE_FILE([monitor.log])
6052
6053# Open, Close
6054ovs-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"
6055ovs-appctl -t ovs-ofctl ofctl/barrier
6056ovs-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"
6057ovs-appctl -t ovs-ofctl ofctl/barrier
d9c8c57c 6058OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
06d4d4b6
JR
6059
6060AT_CHECK([ofctl_strip < monitor.log], [0], [dnl
6061send: ONFT_BUNDLE_CONTROL (OF1.3):
6062 bundle_id=0x1 type=OPEN_REQUEST flags=ordered
6063ONFT_BUNDLE_CONTROL (OF1.3):
6064 bundle_id=0x1 type=OPEN_REPLY flags=0
6065OFPT_BARRIER_REPLY (OF1.3):
6066send: ONFT_BUNDLE_CONTROL (OF1.3):
6067 bundle_id=0x1 type=CLOSE_REQUEST flags=atomic
6068OFPT_ERROR (OF1.3): OFPBFC_BAD_FLAGS
6069ONFT_BUNDLE_CONTROL (OF1.3):
6070 bundle_id=0x1 type=CLOSE_REQUEST flags=atomic
6071OFPT_BARRIER_REPLY (OF1.3):
6072])
6073
6074OVS_VSWITCHD_STOP
6075AT_CLEANUP
6076
6077AT_SETUP([ofproto - bundle commit without open (OpenFlow 1.3)])
6078AT_KEYWORDS([monitor])
6079OVS_VSWITCHD_START
6080
6081# Start a monitor, use the required protocol version
6082ovs-ofctl -O OpenFlow13 monitor br0 --detach --no-chdir --pidfile >monitor.log 2>&1
6083AT_CAPTURE_FILE([monitor.log])
6084
6085# Commit
6086ovs-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"
6087ovs-appctl -t ovs-ofctl ofctl/barrier
d9c8c57c 6088OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
06d4d4b6
JR
6089
6090AT_CHECK([ofctl_strip < monitor.log], [0], [dnl
6091send: ONFT_BUNDLE_CONTROL (OF1.3):
6092 bundle_id=0x1 type=COMMIT_REQUEST flags=ordered
6093OFPT_ERROR (OF1.3): OFPBFC_BAD_ID
6094ONFT_BUNDLE_CONTROL (OF1.3):
6095 bundle_id=0x1 type=COMMIT_REQUEST flags=ordered
6096OFPT_BARRIER_REPLY (OF1.3):
6097])
6098
6099OVS_VSWITCHD_STOP
6100AT_CLEANUP
6101
6102AT_SETUP([ofproto - bundle commit, different flags (OpenFlow 1.3)])
6103AT_KEYWORDS([monitor])
6104OVS_VSWITCHD_START
6105
6106# Start a monitor, use the required protocol version
6107ovs-ofctl -O OpenFlow13 monitor br0 --detach --no-chdir --pidfile >monitor.log 2>&1
6108AT_CAPTURE_FILE([monitor.log])
6109
6110# Open, Commit
6111ovs-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"
6112ovs-appctl -t ovs-ofctl ofctl/barrier
6113ovs-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"
6114ovs-appctl -t ovs-ofctl ofctl/barrier
d9c8c57c 6115OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
06d4d4b6
JR
6116
6117AT_CHECK([ofctl_strip < monitor.log], [0], [dnl
6118send: ONFT_BUNDLE_CONTROL (OF1.3):
6119 bundle_id=0x1 type=OPEN_REQUEST flags=ordered
6120ONFT_BUNDLE_CONTROL (OF1.3):
6121 bundle_id=0x1 type=OPEN_REPLY flags=0
6122OFPT_BARRIER_REPLY (OF1.3):
6123send: ONFT_BUNDLE_CONTROL (OF1.3):
6124 bundle_id=0x1 type=COMMIT_REQUEST flags=atomic
6125OFPT_ERROR (OF1.3): OFPBFC_BAD_FLAGS
6126ONFT_BUNDLE_CONTROL (OF1.3):
6127 bundle_id=0x1 type=COMMIT_REQUEST flags=atomic
6128OFPT_BARRIER_REPLY (OF1.3):
6129])
6130
6131OVS_VSWITCHD_STOP
6132AT_CLEANUP
6133
6134AT_SETUP([ofproto - bundle discard without open (OpenFlow 1.3)])
6135AT_KEYWORDS([monitor])
6136OVS_VSWITCHD_START
6137
6138# Start a monitor, use the required protocol version
6139ovs-ofctl -O OpenFlow13 monitor br0 --detach --no-chdir --pidfile >monitor.log 2>&1
6140AT_CAPTURE_FILE([monitor.log])
6141
6142# Discard
6143ovs-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"
6144ovs-appctl -t ovs-ofctl ofctl/barrier
d9c8c57c 6145OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
06d4d4b6
JR
6146
6147AT_CHECK([ofctl_strip < monitor.log], [0], [dnl
6148send: ONFT_BUNDLE_CONTROL (OF1.3):
6149 bundle_id=0x1 type=DISCARD_REQUEST flags=ordered
6150OFPT_ERROR (OF1.3): OFPBFC_BAD_ID
6151ONFT_BUNDLE_CONTROL (OF1.3):
6152 bundle_id=0x1 type=DISCARD_REQUEST flags=ordered
6153OFPT_BARRIER_REPLY (OF1.3):
6154])
6155
6156OVS_VSWITCHD_STOP
6157AT_CLEANUP
6158
6159
6160AT_SETUP([ofproto - bundle with multiple flow mods (OpenFlow 1.3)])
06d4d4b6
JR
6161OVS_VSWITCHD_START
6162
6163AT_CHECK([ovs-appctl vlog/set vconn:dbg])
6164
50f96b10 6165AT_CHECK([ovs-ofctl --no-names del-flows br0])
06d4d4b6
JR
6166
6167AT_DATA([flows.txt], [dnl
6168add idle_timeout=50 in_port=2 dl_src=00:66:77:88:99:aa actions=1
6169add idle_timeout=60 in_port=2 dl_src=00:77:88:99:aa:bb actions=2
6170add idle_timeout=70 in_port=2 dl_src=00:88:99:aa:bb:cc actions=3
6171add idle_timeout=50 in_port=2 dl_src=00:66:77:88:99:aa actions=4
6172delete
6173add idle_timeout=50 in_port=2 dl_src=00:66:77:88:99:aa actions=5
6174add idle_timeout=60 in_port=2 dl_src=00:77:88:99:aa:bb actions=6
6175add idle_timeout=70 in_port=2 dl_src=00:88:99:aa:bb:cc actions=7
6176delete in_port=2 dl_src=00:88:99:aa:bb:cc
6177])
6178
50f96b10 6179AT_CHECK([ovs-ofctl -O OpenFlow13 --no-names --bundle add-flows br0 flows.txt])
06d4d4b6
JR
6180
6181AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
6182 idle_timeout=50, in_port=2,dl_src=00:66:77:88:99:aa actions=output:5
6183 idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=output:6
6184NXST_FLOW reply:
6185])
6186
6187AT_DATA([flows.txt], [dnl
6188modify actions=drop
6189modify_strict in_port=2 dl_src=00:77:88:99:aa:bb actions=7
6190])
6191
50f96b10 6192AT_CHECK([ovs-ofctl -O OpenFlow13 --no-names --bundle add-flows br0 flows.txt])
06d4d4b6
JR
6193
6194AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
6195 idle_timeout=50, in_port=2,dl_src=00:66:77:88:99:aa actions=drop
6196 idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=output:7
6197NXST_FLOW reply:
6198])
6199
6200# Adding an existing flow acts as a modify, and delete_strict also works.
6201AT_DATA([flows.txt], [dnl
6202add idle_timeout=60 in_port=2 dl_src=00:77:88:99:aa:bb actions=8
6203delete_strict in_port=2 dl_src=00:66:77:88:99:aa
6204add in_port=2 dl_src=00:66:77:88:99:aa actions=drop
6205])
6206
50f96b10 6207AT_CHECK([ovs-ofctl -O OpenFlow13 --bundle --no-names add-flows br0 flows.txt])
06d4d4b6
JR
6208
6209AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
6210 idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=output:8
6211 in_port=2,dl_src=00:66:77:88:99:aa actions=drop
6212NXST_FLOW reply:
6213])
6214
6215dnl Check logs for OpenFlow trace
6216# Prevent race.
6217OVS_WAIT_UNTIL([vconn_sub < ovs-vswitchd.log | test `grep -- "|vconn|DBG|unix: sent (Success): NXST_FLOW reply" | wc -l` -ge 3])
6218AT_CHECK([print_vconn_debug | vconn_sub | ofctl_strip], [0], [dnl
29718ad4
BP
6219vconn|DBG|unix: sent (Success): OFPT_HELLO (OF1.5):
6220 version bitmap: 0x01, 0x02, 0x03, 0x04, 0x05, 0x06
06d4d4b6
JR
6221vconn|DBG|unix: received: OFPT_HELLO:
6222 version bitmap: 0x01
29718ad4 6223vconn|DBG|unix: negotiated OpenFlow version 0x01 (we support version 0x06 and earlier, peer supports version 0x01)
06d4d4b6
JR
6224vconn|DBG|unix: received: OFPT_FLOW_MOD: DEL actions=drop
6225vconn|DBG|unix: received: OFPT_BARRIER_REQUEST:
6226vconn|DBG|unix: sent (Success): OFPT_BARRIER_REPLY:
29718ad4
BP
6227vconn|DBG|unix: sent (Success): OFPT_HELLO (OF1.5):
6228 version bitmap: 0x01, 0x02, 0x03, 0x04, 0x05, 0x06
06d4d4b6
JR
6229vconn|DBG|unix: received: OFPT_HELLO (OF1.3):
6230 version bitmap: 0x04
29718ad4 6231vconn|DBG|unix: negotiated OpenFlow version 0x04 (we support version 0x06 and earlier, peer supports version 0x04)
06d4d4b6
JR
6232vconn|DBG|unix: received: ONFT_BUNDLE_CONTROL (OF1.3):
6233 bundle_id=0 type=OPEN_REQUEST flags=atomic ordered
6234vconn|DBG|unix: sent (Success): ONFT_BUNDLE_CONTROL (OF1.3):
6235 bundle_id=0 type=OPEN_REPLY flags=0
6236vconn|DBG|unix: received: ONFT_BUNDLE_ADD_MESSAGE (OF1.3):
6237 bundle_id=0 flags=atomic ordered
6238OFPT_FLOW_MOD (OF1.3): ADD in_port=2,dl_src=00:66:77:88:99:aa idle:50 actions=output:1
6239vconn|DBG|unix: received: ONFT_BUNDLE_ADD_MESSAGE (OF1.3):
6240 bundle_id=0 flags=atomic ordered
6241OFPT_FLOW_MOD (OF1.3): ADD in_port=2,dl_src=00:77:88:99:aa:bb idle:60 actions=output:2
6242vconn|DBG|unix: received: ONFT_BUNDLE_ADD_MESSAGE (OF1.3):
6243 bundle_id=0 flags=atomic ordered
6244OFPT_FLOW_MOD (OF1.3): ADD in_port=2,dl_src=00:88:99:aa:bb:cc idle:70 actions=output:3
6245vconn|DBG|unix: received: ONFT_BUNDLE_ADD_MESSAGE (OF1.3):
6246 bundle_id=0 flags=atomic ordered
6247OFPT_FLOW_MOD (OF1.3): ADD in_port=2,dl_src=00:66:77:88:99:aa idle:50 actions=output:4
6248vconn|DBG|unix: received: ONFT_BUNDLE_ADD_MESSAGE (OF1.3):
6249 bundle_id=0 flags=atomic ordered
6250OFPT_FLOW_MOD (OF1.3): DEL table:255 actions=drop
6251vconn|DBG|unix: received: ONFT_BUNDLE_ADD_MESSAGE (OF1.3):
6252 bundle_id=0 flags=atomic ordered
6253OFPT_FLOW_MOD (OF1.3): ADD in_port=2,dl_src=00:66:77:88:99:aa idle:50 actions=output:5
6254vconn|DBG|unix: received: ONFT_BUNDLE_ADD_MESSAGE (OF1.3):
6255 bundle_id=0 flags=atomic ordered
6256OFPT_FLOW_MOD (OF1.3): ADD in_port=2,dl_src=00:77:88:99:aa:bb idle:60 actions=output:6
6257vconn|DBG|unix: received: ONFT_BUNDLE_ADD_MESSAGE (OF1.3):
6258 bundle_id=0 flags=atomic ordered
6259OFPT_FLOW_MOD (OF1.3): ADD in_port=2,dl_src=00:88:99:aa:bb:cc idle:70 actions=output:7
6260vconn|DBG|unix: received: ONFT_BUNDLE_ADD_MESSAGE (OF1.3):
6261 bundle_id=0 flags=atomic ordered
6262OFPT_FLOW_MOD (OF1.3): DEL table:255 in_port=2,dl_src=00:88:99:aa:bb:cc actions=drop
506c1ddb
JR
6263vconn|DBG|unix: received: OFPT_BARRIER_REQUEST (OF1.3):
6264vconn|DBG|unix: sent (Success): OFPT_BARRIER_REPLY (OF1.3):
06d4d4b6
JR
6265vconn|DBG|unix: received: ONFT_BUNDLE_CONTROL (OF1.3):
6266 bundle_id=0 type=COMMIT_REQUEST flags=atomic ordered
6267vconn|DBG|unix: sent (Success): ONFT_BUNDLE_CONTROL (OF1.3):
6268 bundle_id=0 type=COMMIT_REPLY flags=0
29718ad4
BP
6269vconn|DBG|unix: sent (Success): OFPT_HELLO (OF1.5):
6270 version bitmap: 0x01, 0x02, 0x03, 0x04, 0x05, 0x06
06d4d4b6
JR
6271vconn|DBG|unix: received: OFPT_HELLO:
6272 version bitmap: 0x01
29718ad4 6273vconn|DBG|unix: negotiated OpenFlow version 0x01 (we support version 0x06 and earlier, peer supports version 0x01)
06d4d4b6
JR
6274vconn|DBG|unix: received: NXT_SET_FLOW_FORMAT: format=nxm
6275vconn|DBG|unix: received: OFPT_BARRIER_REQUEST:
6276vconn|DBG|unix: sent (Success): OFPT_BARRIER_REPLY:
6277vconn|DBG|unix: received: NXST_FLOW request:
6278vconn|DBG|unix: sent (Success): NXST_FLOW reply:
6279 idle_timeout=50, in_port=2,dl_src=00:66:77:88:99:aa actions=output:5
6280 idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=output:6
29718ad4
BP
6281vconn|DBG|unix: sent (Success): OFPT_HELLO (OF1.5):
6282 version bitmap: 0x01, 0x02, 0x03, 0x04, 0x05, 0x06
06d4d4b6
JR
6283vconn|DBG|unix: received: OFPT_HELLO (OF1.3):
6284 version bitmap: 0x04
29718ad4 6285vconn|DBG|unix: negotiated OpenFlow version 0x04 (we support version 0x06 and earlier, peer supports version 0x04)
06d4d4b6
JR
6286vconn|DBG|unix: received: ONFT_BUNDLE_CONTROL (OF1.3):
6287 bundle_id=0 type=OPEN_REQUEST flags=atomic ordered
6288vconn|DBG|unix: sent (Success): ONFT_BUNDLE_CONTROL (OF1.3):
6289 bundle_id=0 type=OPEN_REPLY flags=0
6290vconn|DBG|unix: received: ONFT_BUNDLE_ADD_MESSAGE (OF1.3):
6291 bundle_id=0 flags=atomic ordered
6292OFPT_FLOW_MOD (OF1.3): MOD actions=drop
6293vconn|DBG|unix: received: ONFT_BUNDLE_ADD_MESSAGE (OF1.3):
6294 bundle_id=0 flags=atomic ordered
6295OFPT_FLOW_MOD (OF1.3): MOD_STRICT in_port=2,dl_src=00:77:88:99:aa:bb actions=output:7
506c1ddb
JR
6296vconn|DBG|unix: received: OFPT_BARRIER_REQUEST (OF1.3):
6297vconn|DBG|unix: sent (Success): OFPT_BARRIER_REPLY (OF1.3):
06d4d4b6
JR
6298vconn|DBG|unix: received: ONFT_BUNDLE_CONTROL (OF1.3):
6299 bundle_id=0 type=COMMIT_REQUEST flags=atomic ordered
6300vconn|DBG|unix: sent (Success): ONFT_BUNDLE_CONTROL (OF1.3):
6301 bundle_id=0 type=COMMIT_REPLY flags=0
29718ad4
BP
6302vconn|DBG|unix: sent (Success): OFPT_HELLO (OF1.5):
6303 version bitmap: 0x01, 0x02, 0x03, 0x04, 0x05, 0x06
06d4d4b6
JR
6304vconn|DBG|unix: received: OFPT_HELLO:
6305 version bitmap: 0x01
29718ad4 6306vconn|DBG|unix: negotiated OpenFlow version 0x01 (we support version 0x06 and earlier, peer supports version 0x01)
06d4d4b6
JR
6307vconn|DBG|unix: received: NXT_SET_FLOW_FORMAT: format=nxm
6308vconn|DBG|unix: received: OFPT_BARRIER_REQUEST:
6309vconn|DBG|unix: sent (Success): OFPT_BARRIER_REPLY:
6310vconn|DBG|unix: received: NXST_FLOW request:
6311vconn|DBG|unix: sent (Success): NXST_FLOW reply:
6312 idle_timeout=50, in_port=2,dl_src=00:66:77:88:99:aa actions=drop
6313 idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=output:7
29718ad4
BP
6314vconn|DBG|unix: sent (Success): OFPT_HELLO (OF1.5):
6315 version bitmap: 0x01, 0x02, 0x03, 0x04, 0x05, 0x06
06d4d4b6
JR
6316vconn|DBG|unix: received: OFPT_HELLO (OF1.3):
6317 version bitmap: 0x04
29718ad4 6318vconn|DBG|unix: negotiated OpenFlow version 0x04 (we support version 0x06 and earlier, peer supports version 0x04)
06d4d4b6
JR
6319vconn|DBG|unix: received: ONFT_BUNDLE_CONTROL (OF1.3):
6320 bundle_id=0 type=OPEN_REQUEST flags=atomic ordered
6321vconn|DBG|unix: sent (Success): ONFT_BUNDLE_CONTROL (OF1.3):
6322 bundle_id=0 type=OPEN_REPLY flags=0
6323vconn|DBG|unix: received: ONFT_BUNDLE_ADD_MESSAGE (OF1.3):
6324 bundle_id=0 flags=atomic ordered
6325OFPT_FLOW_MOD (OF1.3): ADD in_port=2,dl_src=00:77:88:99:aa:bb idle:60 actions=output:8
6326vconn|DBG|unix: received: ONFT_BUNDLE_ADD_MESSAGE (OF1.3):
6327 bundle_id=0 flags=atomic ordered
6328OFPT_FLOW_MOD (OF1.3): DEL_STRICT table:255 in_port=2,dl_src=00:66:77:88:99:aa actions=drop
6329vconn|DBG|unix: received: ONFT_BUNDLE_ADD_MESSAGE (OF1.3):
6330 bundle_id=0 flags=atomic ordered
6331OFPT_FLOW_MOD (OF1.3): ADD in_port=2,dl_src=00:66:77:88:99:aa actions=drop
506c1ddb
JR
6332vconn|DBG|unix: received: OFPT_BARRIER_REQUEST (OF1.3):
6333vconn|DBG|unix: sent (Success): OFPT_BARRIER_REPLY (OF1.3):
06d4d4b6
JR
6334vconn|DBG|unix: received: ONFT_BUNDLE_CONTROL (OF1.3):
6335 bundle_id=0 type=COMMIT_REQUEST flags=atomic ordered
6336vconn|DBG|unix: sent (Success): ONFT_BUNDLE_CONTROL (OF1.3):
6337 bundle_id=0 type=COMMIT_REPLY flags=0
29718ad4
BP
6338vconn|DBG|unix: sent (Success): OFPT_HELLO (OF1.5):
6339 version bitmap: 0x01, 0x02, 0x03, 0x04, 0x05, 0x06
06d4d4b6
JR
6340vconn|DBG|unix: received: OFPT_HELLO:
6341 version bitmap: 0x01
29718ad4 6342vconn|DBG|unix: negotiated OpenFlow version 0x01 (we support version 0x06 and earlier, peer supports version 0x01)
06d4d4b6
JR
6343vconn|DBG|unix: received: NXT_SET_FLOW_FORMAT: format=nxm
6344vconn|DBG|unix: received: OFPT_BARRIER_REQUEST:
6345vconn|DBG|unix: sent (Success): OFPT_BARRIER_REPLY:
6346vconn|DBG|unix: received: NXST_FLOW request:
6347vconn|DBG|unix: sent (Success): NXST_FLOW reply:
6348 idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=output:8
6349 in_port=2,dl_src=00:66:77:88:99:aa actions=drop
6350])
6351
6352OVS_VSWITCHD_STOP
6353AT_CLEANUP
6354
6355
506c1ddb 6356AT_SETUP([ofproto - failing bundle add message (OpenFlow 1.3)])
06d4d4b6
JR
6357OVS_VSWITCHD_START
6358
6359AT_CHECK([ovs-ofctl del-flows br0])
6360
6361ovs-ofctl add-flows br0 - <<EOF
6362idle_timeout=50 in_port=2 dl_src=00:66:77:88:99:aa actions=11
6363idle_timeout=60 in_port=2 dl_src=00:77:88:99:aa:bb actions=22
6364idle_timeout=70 in_port=2 dl_src=00:88:99:aa:bb:cc actions=33
6365EOF
6366AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
6367 idle_timeout=50, in_port=2,dl_src=00:66:77:88:99:aa actions=output:11
6368 idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=output:22
6369 idle_timeout=70, in_port=2,dl_src=00:88:99:aa:bb:cc actions=output:33
6370NXST_FLOW reply:
6371])
6372
6373# last line uses illegal table number (OVS internal table)
6374AT_DATA([flows.txt], [dnl
6375add idle_timeout=50 in_port=2 dl_src=00:66:77:88:99:aa actions=1
6376add idle_timeout=60 in_port=2 dl_src=00:77:88:99:aa:bb actions=2
6377add idle_timeout=70 in_port=2 dl_src=00:88:99:aa:bb:cc actions=3
6378modify idle_timeout=50 in_port=2 dl_src=00:66:77:88:99:aa actions=4
6379delete
6380add idle_timeout=50 in_port=2 dl_src=00:66:77:88:99:aa actions=5
6381add idle_timeout=60 in_port=2 dl_src=00:77:88:99:aa:bb actions=6
6382add idle_timeout=70 in_port=2 dl_src=00:88:99:aa:bb:cc actions=7
6383delete in_port=2 dl_src=00:88:99:aa:bb:cc
6384add table=254 actions=drop
6385])
6386
50f96b10 6387AT_CHECK([ovs-ofctl -O OpenFlow13 --bundle add-flows br0 flows.txt 2>&1 | sed '/talking to/,$d' | strip_xids],
06d4d4b6 6388[0], [dnl
50f96b10 6389Error OFPBRC_EPERM for: OFPT_FLOW_MOD (OF1.3): ADD table:254 actions=drop
06d4d4b6
JR
6390])
6391
6392AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
6393 idle_timeout=50, in_port=2,dl_src=00:66:77:88:99:aa actions=output:11
6394 idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=output:22
6395 idle_timeout=70, in_port=2,dl_src=00:88:99:aa:bb:cc actions=output:33
6396NXST_FLOW reply:
6397])
6398
6399OVS_VSWITCHD_STOP
6400AT_CLEANUP
25070e04
JR
6401
6402
6403AT_SETUP([ofproto - failing bundle commit (OpenFlow 1.3)])
25070e04
JR
6404OVS_VSWITCHD_START
6405
6406AT_CHECK([ovs-ofctl del-flows br0])
6407
6408# Invalid group numbers are detected at commit time
6409AT_DATA([flows.txt], [dnl
6410add idle_timeout=50 in_port=2 dl_src=00:66:77:88:99:aa actions=group:1
6411add idle_timeout=60 in_port=2 dl_src=00:77:88:99:aa:bb actions=group:2
6412add idle_timeout=70 in_port=2 dl_src=00:88:99:aa:bb:cc actions=group:3
6413])
6414
50f96b10 6415AT_CHECK([ovs-ofctl -O OpenFlow13 --bundle add-flows br0 flows.txt 2>&1 | sed '/talking to/,$d' | strip_xids],
25070e04 6416[0], [dnl
50f96b10
BP
6417Error 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
6418Error OFPBFC_MSG_FAILED for: ONFT_BUNDLE_CONTROL (OF1.3):
25070e04
JR
6419 bundle_id=0 type=COMMIT_REQUEST flags=atomic ordered
6420])
6421
6422AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
6423NXST_FLOW reply:
6424])
6425
6426OVS_VSWITCHD_STOP
6427AT_CLEANUP
140f36ba
DDP
6428
6429AT_SETUP([ofproto - monitor flows with tun_md])
6430OVS_VSWITCHD_START
6431
6432AT_CHECK([ovs-ofctl add-tlv-map br0 "{class=0xffff,type=0,len=4}->tun_metadata0"])
6433AT_CHECK([ovs-ofctl add-flow br0 tun_metadata0=0x1,actions=drop])
6434
6435AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip], [0], [dnl
6436NXST_FLOW reply:
6437 tun_metadata0=0x1 actions=drop
6438])
6439
6440AT_CAPTURE_FILE([ofctl_monitor.log])
6441dnl Usually ovs-ofctl monitor outputs on stderr, but the first message here
6442dnl is put on stdout, because it is handled by ofctl in dump_transaction()
6443dnl and not in monitor_vconn().
6444AT_CHECK([ovs-ofctl monitor br0 65534 watch: --detach --no-chdir --pidfile >ofctl_monitor.log 2>&1])
6445
6446OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 2])
6447
6448AT_CHECK([cat ofctl_monitor.log | ofctl_strip], [0], [dnl
6449NXST_FLOW_MONITOR reply:
6450 event=ADDED table=0 cookie=0 tun_metadata0=0x1
6451])
6452
6453AT_CHECK([ovs-ofctl del-flows br0])
6454
6455OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 4])
6456
6457AT_CHECK([cat ofctl_monitor.log | ofctl_strip], [0], [dnl
6458NXST_FLOW_MONITOR reply:
6459 event=ADDED table=0 cookie=0 tun_metadata0=0x1
6460NXST_FLOW_MONITOR reply:
6461 event=DELETED reason=delete table=0 cookie=0 tun_metadata0=0x1
6462])
6463
6464OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
6465
6466dnl Check that vswitchd hasn't crashed
6467AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip], [0], [dnl
6468NXST_FLOW reply:
6469])
6470
6471OVS_VSWITCHD_STOP
6472AT_CLEANUP
04f48a68
YHW
6473
6474AT_SETUP([ofproto - flow mod with tunnel metadata])
6475AT_KEYWORDS([ofp-actions])
6476OVS_VSWITCHD_START
6477
6478AT_CHECK([ovs-ofctl add-tlv-map br0 "{class=0xffff,type=0,len=4}->tun_metadata0"])
6479AT_CHECK([ovs-ofctl add-flow br0 "in_port=1 actions=move:tun_metadata0[[0..31]]->NXM_NX_REG0[[]]"])
6480
6481dnl Check the length of tun_metadata0 in the replied OXM header.
6482dnl Ignore the first 0x50 bytes of hex dump from the reply msg since the NXM
6483dnl header that describes the tunnel metadata starts at offset 0x50.
6484AT_CHECK([ovs-ofctl dump-flows br0 -mmmm], [0], [stdout])
50f96b10
BP
6485AT_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
6486NXST_FLOW reply:
04f48a68
YHW
6487 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[[]]
648800000050 ff ff 00 18 00 00 23 20-00 06 00 20 00 00 00 00 |......# ... ....|
648900000060 00 01 50 04 00 01 00 04- |..P..... |
6490])
6491
6492dnl Check actions that may use tun_metadata
6493AT_CHECK([ovs-ofctl add-flow br0 "in_port=2 actions=move:tun_metadata1[[0..31]]->NXM_NX_REG0[[]]"], [1], [], [stderr])
6494AT_CHECK([strip_xids < stderr | sed '/FLOW_MOD/,$d'], [0], [dnl
6495OFPT_ERROR: NXFMFC_INVALID_TLV_FIELD
6496])
6497
6498AT_CHECK([ovs-ofctl add-flow br0 "in_port=2 actions=move:tun_metadata0[[32..63]]->NXM_NX_REG0[[]]"], [1], [], [stderr])
6499AT_CHECK([strip_xids < stderr | sed '/FLOW_MOD/,$d'], [0], [dnl
6500OFPT_ERROR: OFPBAC_BAD_SET_LEN
6501])
6502
6503AT_CHECK([ovs-ofctl add-flow br0 "in_port=2 actions=push:tun_metadata1[[0..31]]"], [1], [], [stderr])
6504AT_CHECK([strip_xids < stderr | sed '/FLOW_MOD/,$d'], [0], [dnl
6505OFPT_ERROR: NXFMFC_INVALID_TLV_FIELD
6506])
6507
6508AT_CHECK([ovs-ofctl add-flow br0 "in_port=2 actions=pop:tun_metadata0[[32..63]]"], [1], [], [stderr])
6509AT_CHECK([strip_xids < stderr | sed '/FLOW_MOD/,$d'], [0], [dnl
6510OFPT_ERROR: OFPBAC_BAD_SET_LEN
6511])
6512
6513AT_CHECK([ovs-ofctl add-flow br0 "in_port=3, actions=load:0x11223344->tun_metadata1"], [1], [], [stderr])
6514AT_CHECK([strip_xids < stderr | sed '/FLOW_MOD/,$d'], [0], [dnl
6515OFPT_ERROR: NXFMFC_INVALID_TLV_FIELD
6516])
6517
6518AT_CHECK([ovs-ofctl add-flow br0 "in_port=2 actions=output:tun_metadata1[[0..31]]"], [1], [], [stderr])
6519AT_CHECK([strip_xids < stderr | sed '/FLOW_MOD/,$d'], [0], [dnl
6520OFPT_ERROR: NXFMFC_INVALID_TLV_FIELD
6521])
6522
6523AT_CHECK([ovs-ofctl add-flow br0 "in_port=2 actions=output:tun_metadata0[[32..63]]"], [1], [], [stderr])
6524AT_CHECK([strip_xids < stderr | sed '/FLOW_MOD/,$d'], [0], [dnl
6525OFPT_ERROR: OFPBAC_BAD_SET_LEN
6526])
6527
6528AT_CHECK([ovs-ofctl add-flow br0 "in_port=2 actions=multipath(eth_src,50,modulo_n,1,0,tun_metadata1[[0..31]])"], [1], [], [stderr])
6529AT_CHECK([strip_xids < stderr | sed '/FLOW_MOD/,$d'], [0], [dnl
6530OFPT_ERROR: NXFMFC_INVALID_TLV_FIELD
6531])
6532
6533AT_CHECK([ovs-ofctl add-flow br0 "in_port=2 actions=multipath(eth_src,50,modulo_n,1,0,tun_metadata0[[32..63]])"], [1], [], [stderr])
6534AT_CHECK([strip_xids < stderr | sed '/FLOW_MOD/,$d'], [0], [dnl
6535OFPT_ERROR: OFPBAC_BAD_SET_LEN
6536])
6537
6538AT_CHECK([ovs-ofctl add-flow br0 "in_port=2 actions=bundle_load(eth_src,50,hrw,ofport,tun_metadata1[[0..31]], slaves:4,8)"], [1], [], [stderr])
6539AT_CHECK([strip_xids < stderr | sed '/FLOW_MOD/,$d'], [0], [dnl
6540OFPT_ERROR: NXFMFC_INVALID_TLV_FIELD
6541])
6542
6543AT_CHECK([ovs-ofctl add-flow br0 "in_port=2 actions=bundle_load(eth_src,50,hrw,ofport,tun_metadata0[[32..63]], slaves:4,8)"], [1], [], [stderr])
6544AT_CHECK([strip_xids < stderr | sed '/FLOW_MOD/,$d'], [0], [dnl
6545OFPT_ERROR: OFPBAC_BAD_SET_LEN
6546])
6547
6548AT_CHECK([ovs-ofctl add-flow br0 "in_port=2 actions=learn(tun_metadata1[[0..31]]=reg0[[0..31]])"], [1], [], [stderr])
6549AT_CHECK([strip_xids < stderr | sed '/FLOW_MOD/,$d'], [0], [dnl
6550OFPT_ERROR: NXFMFC_INVALID_TLV_FIELD
6551])
6552
6553AT_CHECK([ovs-ofctl add-flow br0 "in_port=2 actions=learn(tun_metadata0[[32..63]]=reg0[[0..31]])"], [1], [], [stderr])
6554AT_CHECK([strip_xids < stderr | sed '/FLOW_MOD/,$d'], [0], [dnl
6555OFPT_ERROR: OFPBAC_BAD_SET_LEN
6556])
6557
6558AT_CHECK([ovs-ofctl add-flow br0 "in_port=2 actions=clone(move:tun_metadata1[[0..31]]->reg0[[0..31]])"], [1], [], [stderr])
6559AT_CHECK([strip_xids < stderr | sed '/FLOW_MOD/,$d'], [0], [dnl
6560OFPT_ERROR: NXFMFC_INVALID_TLV_FIELD
6561])
6562
6563AT_CHECK([ovs-ofctl add-flow br0 "in_port=2 actions=clone(move:tun_metadata0[[32..63]]->reg0[[0..31]])"], [1], [], [stderr])
6564AT_CHECK([strip_xids < stderr | sed '/FLOW_MOD/,$d'], [0], [dnl
6565OFPT_ERROR: OFPBAC_BAD_SET_LEN
6566])
6567
6568AT_CHECK([ovs-ofctl add-flow br0 "ip actions=ct(commit,zone=tun_metadata1[[0..15]],exec(set_field:0x01->ct_mark))"], [1], [], [stderr])
6569AT_CHECK([strip_xids < stderr | sed '/FLOW_MOD/,$d'], [0], [dnl
6570OFPT_ERROR: NXFMFC_INVALID_TLV_FIELD
6571])
6572
6573AT_CHECK([ovs-ofctl add-flow br0 "ip actions=ct(commit,zone=tun_metadata0[[32..47]],exec(set_field:0x01->ct_mark))"], [1], [], [stderr])
6574AT_CHECK([strip_xids < stderr | sed '/FLOW_MOD/,$d'], [0], [dnl
6575OFPT_ERROR: OFPBAC_BAD_SET_LEN
6576])
6577
6578AT_CHECK([ovs-ofctl add-flow br0 "ip actions=ct(commit,zone=1,exec(move:tun_metadata1[[0..31]]->ct_mark))"], [1], [], [stderr])
6579AT_CHECK([strip_xids < stderr | sed '/FLOW_MOD/,$d'], [0], [dnl
6580OFPT_ERROR: NXFMFC_INVALID_TLV_FIELD
6581])
6582
6583AT_CHECK([ovs-ofctl add-flow br0 "ip actions=ct(commit,zone=1,exec(move:tun_metadata0[[32..63]]->ct_mark))"], [1], [], [stderr])
6584AT_CHECK([strip_xids < stderr | sed '/FLOW_MOD/,$d'], [0], [dnl
6585OFPT_ERROR: OFPBAC_BAD_SET_LEN
6586])
6587
3cddeff0
YHW
6588dnl Check match field with tun_metadata
6589AT_CHECK([ovs-ofctl add-flow br0 "tun_metadata0=0x11223344 actions=output:2"], [0], [], [stderr])
6590AT_CHECK([ovs-ofctl add-flow br0 "tun_metadata1=0x11223344 actions=output:2"], [1], [], [stderr])
6591AT_CHECK([strip_xids < stderr | sed '/FLOW_MOD/,$d'], [0], [dnl
6592OFPT_ERROR: NXFMFC_INVALID_TLV_FIELD
6593])
6594
6595AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip], [0], [dnl)
6596NXST_FLOW reply:
6597 in_port=1 actions=move:NXM_NX_TUN_METADATA0[[0..31]]->NXM_NX_REG0[[]]
6598 tun_metadata0=0x11223344 actions=output:2
04f48a68
YHW
6599])
6600
6601OVS_VSWITCHD_STOP(["/NXFMFC_INVALID_TLV_FIELD/d
6602/tun_metadata0/d
6603/OFPBAC_BAD_SET_LEN/d"])
6604AT_CLEANUP
d3b84833
BP
6605
6606AT_SETUP([ofproto - flush flows, groups, and meters for controller change])
6607AT_KEYWORDS([flow flows group group meter])
6608OVS_VSWITCHD_START
6609
6610add_flow_group_and_meter () {
6611 AT_CHECK([ovs-ofctl add-flow br0 in_port=1,actions=2])
6612 AT_CHECK([ovs-ofctl -O OpenFlow11 add-group br0 group_id=1234,type=all,bucket=output:10
6613 AT_CHECK([ovs-ofctl -O OpenFlow13 add-meter br0 'meter=1 pktps burst stats bands=type=drop rate=1 burst_size=1'])
6614])
6615}
6616
6617verify_added () {
6618 AT_CHECK([ovs-ofctl --no-stats dump-flows br0], [0], [dnl
6619 in_port=1 actions=output:2
6620])
6621 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-groups br0], [0], [dnl
6622OFPST_GROUP_DESC reply (OF1.1) (xid=0x2):
6623 group_id=1234,type=all,bucket=actions=output:10
6624])
6625 AT_CHECK([ovs-ofctl -O OpenFlow13 dump-meters br0], [0], [dnl
6626OFPST_METER_CONFIG reply (OF1.3) (xid=0x2):
6627meter=1 pktps burst stats bands=
6628type=drop rate=1 burst_size=1
6629])
6630}
6631
6632verify_deleted () {
6633 AT_CHECK([ovs-ofctl --no-stats dump-flows br0])
6634 AT_CHECK([ovs-ofctl -O OpenFlow11 dump-groups br0], [0], [dnl
6635OFPST_GROUP_DESC reply (OF1.1) (xid=0x2):
6636])
6637 AT_CHECK([ovs-ofctl -O OpenFlow13 dump-meters br0], [0], [dnl
6638OFPST_METER_CONFIG reply (OF1.3) (xid=0x2):
6639])
6640}
6641
6642# Add flow, group, meter and check that they're there, without a controller.
6643add_flow_group_and_meter
6644verify_added
6645
6646# Set up a controller and verify that the flow and group were deleted,
6647# then add them back.
6648AT_CHECK([ovs-vsctl set-controller br0 'tcp:<invalid>:6653'])
6649verify_deleted
6650add_flow_group_and_meter
6651verify_added
6652
6653# Change the controller and verify that the flow and group are still there.
6654AT_CHECK([ovs-vsctl set-controller br0 'tcp:<invalid2>:6653'])
6655verify_added
6656
6657# Clear the controller and verify that the flow and group were deleted.
6658AT_CHECK([ovs-vsctl del-controller br0])
6659verify_deleted
6660
6661OVS_VSWITCHD_STOP(["/<invalid/d"])
6662AT_CLEANUP