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