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