]> git.proxmox.com Git - mirror_ovs.git/blame - tests/ofproto.at
ofproto: Test that group commands fail for OpenFlow 1.0
[mirror_ovs.git] / tests / ofproto.at
CommitLineData
a2cb9dfd
BP
1AT_BANNER([ofproto])
2
a2cb9dfd 3AT_SETUP([ofproto - echo request])
023e1e0a 4OVS_VSWITCHD_START
ea523221 5AT_CHECK([ovs-ofctl -vwarn probe br0])
023e1e0a 6OVS_VSWITCHD_STOP
a2cb9dfd
BP
7AT_CLEANUP
8
2b4cca6f
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])
316OVS_VSWITCHD_STOP
317AT_CLEANUP
318
e1799eb7
SH
319dnl This is really bare-bones.
320dnl It at least checks request and reply serialization and deserialization.
321dnl Actions definition listed in both supported formats (w/ actions=)
322AT_SETUP([ofproto - add indirect group])
323OVS_VSWITCHD_START
324dnl indirect group must have exactly one bucket
325AT_DATA([stderr], [dnl
326OFPT_ERROR (OF1.1) (xid=0x2): OFPGMFC_INVALID_GROUP
327OFPT_GROUP_MOD (OF1.1) (xid=0x2): ***decode error: OFPGMFC_INVALID_GROUP***
328])
329AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn add-group br0 'group_id=1234,type=indirect'], [1], , [stderr])
330AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn add-group br0 'group_id=1235,type=indirect,bucket=output:10'])
331AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn add-group br0 'group_id=1236,type=indirect,bucket=output:10,bucket=output:11'], [1], , [stderr])
332OVS_VSWITCHD_STOP
333AT_CLEANUP
334
afc63bb4
SH
335dnl This is really bare-bones.
336dnl It at least checks request and reply serialization and deserialization.
337dnl Actions definition listed in both supported formats (w/ actions=)
338AT_SETUP([ofproto - del group (OpenFlow 1.5)])
339OVS_VSWITCHD_START
340AT_DATA([groups.txt], [dnl
341group_id=1234,type=all,bucket=output:10,bucket=output:11
342group_id=1235,type=all,bucket=actions=output:12,bucket=bucket_id:0,actions=output:10,bucket=bucket_id:1,actions=output:11
343])
344AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn add-groups br0 groups.txt])
345AT_CHECK([ovs-ofctl -F OXM-OpenFlow15 -O OpenFlow15 -vwarn dump-groups br0 1234], [0], [stdout])
346AT_CHECK([STRIP_XIDS stdout], [0], [dnl
347OFPST_GROUP_DESC reply (OF1.5):
348 group_id=1234,type=all,bucket=bucket_id:0,actions=output:10,bucket=bucket_id:1,actions=output:11
349])
350AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn del-groups br0 group_id=1234])
351AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn dump-groups br0], [0], [stdout])
352AT_CHECK([STRIP_XIDS stdout], [0], [dnl
353OFPST_GROUP_DESC reply (OF1.5):
354 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
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
361])
362AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn del-groups br0], [0])
363AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn dump-groups br0], [0], [stdout])
364AT_CHECK([STRIP_XIDS stdout], [0], [dnl
365OFPST_GROUP_DESC reply (OF1.5):
366])
367OVS_VSWITCHD_STOP
368AT_CLEANUP
369
433702fc
SH
370dnl This is really bare-bones.
371dnl It at least checks request and reply serialization and deserialization.
372AT_SETUP([ofproto - del group deletes flows])
373OVS_VSWITCHD_START
374AT_DATA([groups.txt], [dnl
375group_id=1234,type=all,bucket=output:10
376group_id=1235,type=all,bucket=output:10
377])
378AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn add-groups br0 groups.txt])
379AT_DATA([flows.txt], [dnl
380tcp actions=group:1234
381udp actions=group:1235
382])
383AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn add-flows br0 flows.txt])
384AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn dump-flows br0 | ofctl_strip | sort],
385[0], [dnl
386 tcp actions=group:1234
387 udp actions=group:1235
388OFPST_FLOW reply (OF1.1):
389])
390AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn del-groups br0 group_id=1234])
391AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn dump-flows br0 | ofctl_strip | sort],
392[0], [dnl
393 udp actions=group:1235
394OFPST_FLOW reply (OF1.1):
395])
396AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn del-groups br0 group_id=1234])
397AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn dump-flows br0 | ofctl_strip | sort],
398[0], [dnl
399 udp actions=group:1235
400OFPST_FLOW reply (OF1.1):
401])
402AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn del-groups br0])
403AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn dump-flows br0 | ofctl_strip | sort],
404[0], [dnl
405OFPST_FLOW reply (OF1.1):
406])
407OVS_VSWITCHD_STOP
408AT_CLEANUP
409
0860fea7
SH
410dnl This is really bare-bones.
411dnl It at least checks request and reply serialization and deserialization.
412AT_SETUP([ofproto - flow mod checks group availability])
413OVS_VSWITCHD_START
414AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn add-group br0 group_id=1234,type=all,bucket=output:10])
415AT_DATA([flows.txt], [dnl
416tcp actions=group:1234
417udp actions=group:1235
418])
419AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn add-flow br0 'tcp actions=group:1234'])
420AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn add-flow br0 'tcp actions=group:1235'], [1], [], [stderr])
421
422# The output should look like this:
423#
424# 00000000 02 0e 00 98 00 00 00 02-00 00 00 00 00 00 00 00 |................|
425# 00000010 00 00 00 00 00 00 00 00-ff 00 00 00 00 00 80 00 |................|
426# 00000020 ff ff ff ff ff ff ff ff-ff ff ff ff 00 00 00 00 |................|
427# 00000030 00 00 00 58 00 00 00 00-00 00 03 d7 00 00 00 00 |...X............|
428#
429# This 'sed' command captures the error message but drops details.
430AT_CHECK([sed '/truncated/d
431/^000000.0/d' stderr | STRIP_XIDS], [0],
432 [OFPT_ERROR (OF1.1): OFPBAC_BAD_OUT_GROUP
433OFPT_FLOW_MOD (OF1.1):
434])
435OVS_VSWITCHD_STOP
436AT_CLEANUP
437
433702fc
SH
438dnl This is really bare-bones.
439dnl It at least checks request and reply serialization and deserialization.
440AT_SETUP([ofproto - group description])
441OVS_VSWITCHD_START
442AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn add-group br0 group_id=1234,type=all,bucket=output:10], [0], [stdout])
443AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn dump-groups br0], [0], [stdout])
444AT_CHECK([STRIP_XIDS stdout], [0], [dnl
445OFPST_GROUP_DESC reply (OF1.1):
446 group_id=1234,type=all,bucket=actions=output:10
447])
448OVS_VSWITCHD_STOP
449AT_CLEANUP
450
2134b5ec
SH
451dnl This is really bare-bones.
452dnl It at least checks request and reply serialization and deserialization.
453AT_SETUP([ofproto - group description])
454OVS_VSWITCHD_START
455AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn add-group br0 group_id=1234,type=all,bucket=output:10])
456AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn dump-groups br0], [0], [stdout])
457AT_CHECK([STRIP_XIDS stdout], [0], [dnl
458OFPST_GROUP_DESC reply (OF1.1):
459 group_id=1234,type=all,bucket=actions=output:10
460])
461OVS_VSWITCHD_STOP
462AT_CLEANUP
463
d45418dd
SH
464dnl This is really bare-bones.
465dnl It at least checks request and reply serialization and deserialization.
466AT_SETUP([ofproto - group features])
467OVS_VSWITCHD_START
468AT_CHECK([ovs-ofctl -O OpenFlow12 -vwarn dump-group-features br0], [0], [stdout])
469AT_CHECK([STRIP_XIDS stdout], [0], [dnl
470OFPST_GROUP_FEATURES reply (OF1.2):
471 Group table:
0ae01c64 472 Types: 0xf
7cb279c2 473 Capabilities: 0x7
0ae01c64
SS
474 all group:
475 max_groups=0xffffff00
476 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
477 select group:
478 max_groups=0xffffff00
479 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
480 indirect group:
481 max_groups=0xffffff00
482 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
483 fast failover group:
484 max_groups=0xffffff00
485 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
486])
487OVS_VSWITCHD_STOP
488AT_CLEANUP
489
2134b5ec
SH
490dnl This is really bare-bones.
491dnl It at least checks request and reply serialization and deserialization.
5335a6f3 492AT_SETUP([ofproto - group stats (OpenFlow 1.1)])
2134b5ec
SH
493OVS_VSWITCHD_START
494AT_DATA([groups.txt], [dnl
495group_id=1234,type=all,bucket=output:10
496group_id=1235,type=all,bucket=output:10
497])
498AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn add-groups br0 groups.txt])
499AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn add-flow br0 'tcp actions=group:1234'])
500AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn dump-group-stats br0 group_id=1234], [0], [stdout])
501AT_CHECK([STRIP_XIDS stdout | sort], [0], [dnl
502 group_id=1234,ref_count=1,packet_count=0,byte_count=0,bucket0:packet_count=0,byte_count=0
503OFPST_GROUP reply (OF1.1):
504])
505AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn dump-group-stats br0], [0], [stdout])
506AT_CHECK([STRIP_XIDS stdout | sort], [0], [dnl
507 group_id=1234,ref_count=1,packet_count=0,byte_count=0,bucket0:packet_count=0,byte_count=0
508 group_id=1235,ref_count=0,packet_count=0,byte_count=0,bucket0:packet_count=0,byte_count=0
509OFPST_GROUP reply (OF1.1):
510])
511OVS_VSWITCHD_STOP
512AT_CLEANUP
513
5335a6f3
SH
514dnl This is really bare-bones.
515dnl It at least checks request and reply serialization and deserialization.
516AT_SETUP([ofproto - group stats (OpenFlow 1.3)])
517OVS_VSWITCHD_START
518AT_DATA([groups.txt], [dnl
519group_id=1234,type=all,bucket=output:10
520group_id=1235,type=all,bucket=output:10
521])
522AT_CHECK([ovs-ofctl -O OpenFlow13 -vwarn add-groups br0 groups.txt])
523AT_CHECK([ovs-ofctl -O OpenFlow13 -vwarn add-flow br0 'tcp actions=group:1234'])
524AT_CHECK([ovs-ofctl -O OpenFlow13 -vwarn dump-group-stats br0 group_id=1234], [0], [stdout])
525AT_CHECK([STRIP_XIDS stdout | sed 's/duration=[[0-9.]]*s/duration=?s/' | sort], [0], [dnl
526 group_id=1234,duration=?s,ref_count=1,packet_count=0,byte_count=0,bucket0:packet_count=0,byte_count=0
527OFPST_GROUP reply (OF1.3):
528])
529AT_CHECK([ovs-ofctl -O OpenFlow13 -vwarn dump-group-stats br0], [0], [stdout])
530AT_CHECK([STRIP_XIDS stdout | sed 's/duration=[[0-9.]]*s/duration=?s/' | sort], [0], [dnl
531 group_id=1234,duration=?s,ref_count=1,packet_count=0,byte_count=0,bucket0:packet_count=0,byte_count=0
532 group_id=1235,duration=?s,ref_count=0,packet_count=0,byte_count=0,bucket0:packet_count=0,byte_count=0
533OFPST_GROUP reply (OF1.3):
534])
535OVS_VSWITCHD_STOP
536AT_CLEANUP
537
afc63bb4
SH
538dnl This is really bare-bones.
539dnl It at least checks request and reply serialization and deserialization.
540AT_SETUP([ofproto - group stats (OpenFlow 1.5)])
541OVS_VSWITCHD_START
542AT_DATA([groups.txt], [dnl
543group_id=1234,type=all,bucket=output:10
544group_id=1235,type=all,bucket=output:10
545])
546AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn add-groups br0 groups.txt])
547AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn add-flow br0 'tcp actions=group:1234'])
548AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn dump-group-stats br0 group_id=1234], [0], [stdout])
549AT_CHECK([STRIP_XIDS stdout | sed 's/duration=[[0-9.]]*s/duration=?s/' | sort], [0], [dnl
550 group_id=1234,duration=?s,ref_count=1,packet_count=0,byte_count=0,bucket0:packet_count=0,byte_count=0
551OFPST_GROUP reply (OF1.5):
552])
553AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn dump-group-stats br0], [0], [stdout])
554AT_CHECK([STRIP_XIDS stdout | sed 's/duration=[[0-9.]]*s/duration=?s/' | sort], [0], [dnl
555 group_id=1234,duration=?s,ref_count=1,packet_count=0,byte_count=0,bucket0:packet_count=0,byte_count=0
556 group_id=1235,duration=?s,ref_count=0,packet_count=0,byte_count=0,bucket0:packet_count=0,byte_count=0
557OFPST_GROUP reply (OF1.5):
558])
559OVS_VSWITCHD_STOP
560AT_CLEANUP
561
9dcd1c00 562AT_SETUP([ofproto - mod-port (OpenFlow 1.0)])
023e1e0a 563OVS_VSWITCHD_START
a2cb9dfd
BP
564for command_config_state in \
565 'up 0 0' \
0ab14c8e
BP
566 'noflood NO_FLOOD 0' \
567 'down PORT_DOWN,NO_FLOOD LINK_DOWN' \
28124950
BP
568 'flood PORT_DOWN LINK_DOWN' \
569 'no-receive PORT_DOWN,NO_RECV LINK_DOWN' \
570 'no-forward PORT_DOWN,NO_RECV,NO_FWD LINK_DOWN' \
571 'no-packet-in PORT_DOWN,NO_RECV,NO_FWD,NO_PACKET_IN LINK_DOWN' \
572 'forward PORT_DOWN,NO_RECV,NO_PACKET_IN LINK_DOWN' \
573 'packet-in PORT_DOWN,NO_RECV LINK_DOWN' \
574 'up NO_RECV 0' \
575 'receive 0 0'
a2cb9dfd
BP
576do
577 set $command_config_state
0ab14c8e 578 command=$[1] config=`echo $[2] | sed 's/,/ /g'` state=$[3]
ea523221
BP
579 AT_CHECK([ovs-ofctl -vwarn mod-port br0 br0 $command])
580 AT_CHECK([ovs-ofctl -vwarn show br0], [0], [stdout])
640c7c94 581 AT_CHECK_UNQUOTED([STRIP_XIDS stdout], [0], [dnl
9e1fd49b 582OFPT_FEATURES_REPLY: dpid:fedcba9876543210
c2f0373a 583n_tables:254, n_buffers:256
9e1fd49b 584capabilities: FLOW_STATS TABLE_STATS PORT_STATS QUEUE_STATS ARP_MATCH_IP
08d1e234 585actions: 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
586 LOCAL(br0): addr:aa:55:aa:55:00:00
587 config: $config
588 state: $state
d02a5f8e 589 speed: 0 Mbps now, 0 Mbps max
3b62feba 590OFPT_GET_CONFIG_REPLY: frags=normal miss_send_len=0
a2cb9dfd
BP
591])
592done
023e1e0a 593OVS_VSWITCHD_STOP
a2cb9dfd 594AT_CLEANUP
640c7c94 595
9dcd1c00
SH
596AT_SETUP([ofproto - mod-port (OpenFlow 1.2)])
597OVS_VSWITCHD_START
598for command_config_state in \
599 'up 0 0' \
600 'down PORT_DOWN LINK_DOWN' \
601 'no-receive PORT_DOWN,NO_RECV LINK_DOWN' \
602 'no-forward PORT_DOWN,NO_RECV,NO_FWD LINK_DOWN' \
603 'no-packet-in PORT_DOWN,NO_RECV,NO_FWD,NO_PACKET_IN LINK_DOWN' \
604 'forward PORT_DOWN,NO_RECV,NO_PACKET_IN LINK_DOWN' \
605 'packet-in PORT_DOWN,NO_RECV LINK_DOWN' \
606 'up NO_RECV 0' \
607 'receive 0 0'
608do
609 set $command_config_state
610 command=$[1] config=`echo $[2] | sed 's/,/ /g'` state=$[3]
611 AT_CHECK([ovs-ofctl -O OpenFlow12 -vwarn mod-port br0 br0 $command])
612 AT_CHECK([ovs-ofctl -O OpenFlow12 -vwarn show br0], [0], [stdout])
613 AT_CHECK_UNQUOTED([STRIP_XIDS stdout], [0], [dnl
614OFPT_FEATURES_REPLY (OF1.2): dpid:fedcba9876543210
615n_tables:254, n_buffers:256
4efe455d 616capabilities: FLOW_STATS TABLE_STATS PORT_STATS GROUP_STATS QUEUE_STATS
9dcd1c00
SH
617 LOCAL(br0): addr:aa:55:aa:55:00:00
618 config: $config
619 state: $state
620 speed: 0 Mbps now, 0 Mbps max
621OFPT_GET_CONFIG_REPLY (OF1.2): frags=normal miss_send_len=0
622])
623done
624OVS_VSWITCHD_STOP
625AT_CLEANUP
626
18cc69d9
BP
627AT_SETUP([ofproto - mod-port (OpenFlow 1.4)])
628OVS_VSWITCHD_START
629for command_config_state in \
630 'up 0 0' \
631 'down PORT_DOWN LINK_DOWN' \
632 'no-receive PORT_DOWN,NO_RECV LINK_DOWN' \
633 'no-forward PORT_DOWN,NO_RECV,NO_FWD LINK_DOWN' \
634 'no-packet-in PORT_DOWN,NO_RECV,NO_FWD,NO_PACKET_IN LINK_DOWN' \
635 'forward PORT_DOWN,NO_RECV,NO_PACKET_IN LINK_DOWN' \
636 'packet-in PORT_DOWN,NO_RECV LINK_DOWN' \
637 'up NO_RECV 0' \
638 'receive 0 0'
639do
640 set $command_config_state
641 command=$[1] config=`echo $[2] | sed 's/,/ /g'` state=$[3]
642 AT_CHECK([ovs-ofctl -O OpenFlow14 -vwarn mod-port br0 br0 $command])
643 AT_CHECK([ovs-ofctl -O OpenFlow14 -vwarn show br0], [0], [stdout])
644 AT_CHECK_UNQUOTED([STRIP_XIDS stdout], [0], [dnl
645OFPT_FEATURES_REPLY (OF1.4): dpid:fedcba9876543210
646n_tables:254, n_buffers:256
4efe455d 647capabilities: FLOW_STATS TABLE_STATS PORT_STATS GROUP_STATS QUEUE_STATS
18cc69d9
BP
648OFPST_PORT_DESC reply (OF1.4):
649 LOCAL(br0): addr:aa:55:aa:55:00:00
650 config: $config
651 state: $state
652 speed: 0 Mbps now, 0 Mbps max
653OFPT_GET_CONFIG_REPLY (OF1.4): frags=normal miss_send_len=0
654])
655done
656OVS_VSWITCHD_STOP
657AT_CLEANUP
658
c168dcc8 659AT_SETUP([ofproto - basic flow_mod commands (NXM)])
023e1e0a 660OVS_VSWITCHD_START
ef0ce8ae 661AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip], [0], [NXST_FLOW reply:
640c7c94 662])
c6100d92
BP
663AT_CHECK([echo 'in_port=2,actions=1' | ovs-ofctl add-flows br0 -])
664AT_CHECK([ovs-ofctl add-flow br0 in_port=1,actions=2])
665AT_CHECK([ovs-ofctl -F nxm add-flow br0 table=1,in_port=4,actions=3])
ef0ce8ae 666AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
c6100d92
BP
667 in_port=1 actions=output:2
668 in_port=2 actions=output:1
669 table=1, in_port=4 actions=output:3
0721c073 670NXST_FLOW reply:
640c7c94 671])
0697b5c3 672AT_CHECK([ovs-ofctl dump-aggregate br0 table=0 | STRIP_XIDS], [0], [dnl
c168dcc8
BP
673NXST_AGGREGATE reply: packet_count=0 byte_count=0 flow_count=2
674])
640c7c94 675AT_CHECK([ovs-ofctl del-flows br0])
ef0ce8ae 676AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip], [0], [NXST_FLOW reply:
640c7c94 677])
023e1e0a 678OVS_VSWITCHD_STOP
640c7c94 679AT_CLEANUP
c168dcc8
BP
680
681AT_SETUP([ofproto - basic flow_mod commands (OpenFlow 1.0)])
023e1e0a 682OVS_VSWITCHD_START
ef0ce8ae 683AT_CHECK([ovs-ofctl -F openflow10 dump-flows br0 | ofctl_strip], [0], [OFPST_FLOW reply:
c168dcc8 684])
c6100d92
BP
685AT_CHECK([echo 'in_port=2,actions=1' | ovs-ofctl -F openflow10 add-flows br0 -])
686AT_CHECK([ovs-ofctl -F openflow10 add-flow br0 in_port=1,actions=2])
687AT_CHECK([ovs-ofctl -F openflow10 add-flow br0 table=1,in_port=4,actions=3])
ef0ce8ae 688AT_CHECK([ovs-ofctl -F openflow10 dump-flows br0 | ofctl_strip | sort], [0], [dnl
c6100d92
BP
689 in_port=1 actions=output:2
690 in_port=2 actions=output:1
691 table=1, in_port=4 actions=output:3
c168dcc8
BP
692OFPST_FLOW reply:
693])
0697b5c3 694AT_CHECK([ovs-ofctl -F openflow10 dump-aggregate br0 table=0 | STRIP_XIDS], [0], [dnl
c168dcc8
BP
695OFPST_AGGREGATE reply: packet_count=0 byte_count=0 flow_count=2
696])
697AT_CHECK([ovs-ofctl -F openflow10 del-flows br0])
ef0ce8ae 698AT_CHECK([ovs-ofctl -F openflow10 dump-flows br0 | ofctl_strip], [0], [OFPST_FLOW reply:
c168dcc8 699])
023e1e0a 700OVS_VSWITCHD_STOP
c168dcc8 701AT_CLEANUP
e729e793 702
75fa58f8
BP
703AT_SETUP([ofproto - basic flow_mod commands (OpenFlow 1.1)])
704OVS_VSWITCHD_START
705AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip], [0], [OFPST_FLOW reply (OF1.1):
706])
707AT_CHECK([echo 'in_port=2,actions=1' | ovs-ofctl -O OpenFlow11 add-flows br0 -])
708AT_CHECK([ovs-ofctl -O OpenFlow11 add-flow br0 in_port=1,actions=2])
709AT_CHECK([ovs-ofctl -O OpenFlow11 add-flow br0 table=1,in_port=4,actions=3])
710AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0], [dnl
711 in_port=1 actions=output:2
712 in_port=2 actions=output:1
713 table=1, in_port=4 actions=output:3
714OFPST_FLOW reply (OF1.1):
715])
716AT_CHECK([ovs-ofctl -O OpenFlow11 dump-aggregate br0 table=0 | STRIP_XIDS], [0], [dnl
717OFPST_AGGREGATE reply (OF1.1): packet_count=0 byte_count=0 flow_count=2
718])
719AT_CHECK([ovs-ofctl -O OpenFlow11 del-flows br0])
720AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip], [0], [OFPST_FLOW reply (OF1.1):
0e197060 721 table=1, in_port=4 actions=output:3
75fa58f8
BP
722])
723OVS_VSWITCHD_STOP
724AT_CLEANUP
725
862d8eed
BP
726AT_SETUP([ofproto - flow_mod negative test (OpenFlow 1.1)])
727OVS_VSWITCHD_START(
728 [set bridge br0 protocols=OpenFlow10,OpenFlow11,OpenFlow12,OpenFlow13])
729AT_CHECK([ovs-ofctl add-flow -O OpenFlow11 br0 table=1,action=goto_table:2])
862d8eed 730
0e197060
BP
731# The error message here actually comes from ovs-ofctl, not from ovs-vswitchd,
732# but at least it's the same code in ofpacts_check() that issues the error.
733AT_CHECK([ovs-ofctl add-flow -O OpenFlow11 br0 table=1,action=goto_table:1],
734 [1], [],
8c87971e 735 [ovs-ofctl: actions are invalid with specified match (OFPBIC_BAD_TABLE_ID)
862d8eed
BP
736])
737OVS_VSWITCHD_STOP
738AT_CLEANUP
739
f5c45121
SH
740AT_SETUP([ofproto - set-field flow_mod commands (NXM)])
741OVS_VSWITCHD_START
742AT_CHECK([ovs-ofctl add-flow br0 ipv6,table=1,in_port=3,actions=drop])
743AT_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])
744AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
745 table=1, ipv6,in_port=3 actions=load:0xa6badbfffefe59fa->NXM_NX_IPV6_SRC[[0..63]],load:0xfe8001234567890a->NXM_NX_IPV6_SRC[[64..127]]
746NXST_FLOW reply:
747])
748OVS_VSWITCHD_STOP
749AT_CLEANUP
750
9dcd1c00 751AT_SETUP([ofproto - basic flow_mod commands (OpenFlow 1.2)])
e729e793 752OVS_VSWITCHD_START
9dcd1c00 753AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip], [0], [OFPST_FLOW reply (OF1.2):
e729e793 754])
9dcd1c00
SH
755AT_CHECK([echo 'in_port=2,actions=1' | ovs-ofctl -O OpenFlow12 add-flows br0 -])
756AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 in_port=1,actions=2])
757AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 table=1,in_port=4,actions=3])
758AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
759 in_port=1 actions=output:2
760 in_port=2 actions=output:1
761 table=1, in_port=4 actions=output:3
762OFPST_FLOW reply (OF1.2):
e729e793 763])
9dcd1c00
SH
764AT_CHECK([ovs-ofctl -O OpenFlow12 del-flows br0])
765AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip], [0], [OFPST_FLOW reply (OF1.2):
e729e793
JP
766])
767OVS_VSWITCHD_STOP
768AT_CLEANUP
769
9dcd1c00 770AT_SETUP([ofproto - dump flows with cookie])
e729e793 771OVS_VSWITCHD_START
c6100d92
BP
772AT_CHECK([ovs-ofctl add-flow br0 cookie=0x1,in_port=1,actions=1])
773AT_CHECK([ovs-ofctl add-flow br0 cookie=0x2,in_port=2,actions=1])
774AT_CHECK([ovs-ofctl add-flow br0 cookie=0x3,in_port=3,actions=1])
ef0ce8ae 775AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
c6100d92
BP
776 cookie=0x1, in_port=1 actions=output:1
777 cookie=0x2, in_port=2 actions=output:1
778 cookie=0x3, in_port=3 actions=output:1
e729e793
JP
779NXST_FLOW reply:
780])
781AT_CHECK([ovs-ofctl dump-aggregate br0 table=0 | STRIP_XIDS], [0], [dnl
782NXST_AGGREGATE reply: packet_count=0 byte_count=0 flow_count=3
783])
9dcd1c00 784AT_CHECK([ovs-ofctl dump-flows br0 cookie=0x3/-1 | ofctl_strip | sort], [0], [dnl
c6100d92 785 cookie=0x3, in_port=3 actions=output:1
e729e793
JP
786NXST_FLOW reply:
787])
9dcd1c00
SH
788AT_CHECK([ovs-ofctl dump-aggregate br0 cookie=0x3/-1 | STRIP_XIDS], [0], [dnl
789NXST_AGGREGATE reply: packet_count=0 byte_count=0 flow_count=1
e729e793
JP
790])
791OVS_VSWITCHD_STOP
792AT_CLEANUP
793
623e1caf
JP
794AT_SETUP([ofproto - mod flow with cookie change (OpenFlow 1.0)])
795OVS_VSWITCHD_START
c6100d92 796AT_CHECK([ovs-ofctl -F openflow10 add-flow br0 cookie=0x1,in_port=1,actions=1])
623e1caf 797AT_CHECK([ovs-ofctl -F openflow10 dump-flows br0 | ofctl_strip | sort], [0], [dnl
c6100d92 798 cookie=0x1, in_port=1 actions=output:1
623e1caf
JP
799OFPST_FLOW reply:
800])
801
c6100d92 802AT_CHECK([ovs-ofctl -F openflow10 mod-flows br0 cookie=0x2,in_port=1,actions=1])
623e1caf 803AT_CHECK([ovs-ofctl -F openflow10 dump-flows br0 | ofctl_strip | sort], [0], [dnl
c6100d92 804 cookie=0x2, in_port=1 actions=output:1
623e1caf
JP
805OFPST_FLOW reply:
806])
807OVS_VSWITCHD_STOP
808AT_CLEANUP
809
810AT_SETUP([ofproto - mod flow with cookie change (NXM)])
811OVS_VSWITCHD_START
c6100d92 812AT_CHECK([ovs-ofctl -F nxm add-flow br0 cookie=0x1,in_port=1,actions=1])
623e1caf 813AT_CHECK([ovs-ofctl -F nxm dump-flows br0 | ofctl_strip | sort], [0], [dnl
c6100d92 814 cookie=0x1, in_port=1 actions=output:1
623e1caf
JP
815NXST_FLOW reply:
816])
817
c6100d92 818AT_CHECK([ovs-ofctl -F nxm mod-flows br0 cookie=0x2,in_port=1,actions=1])
623e1caf 819AT_CHECK([ovs-ofctl -F nxm dump-flows br0 | ofctl_strip | sort], [0], [dnl
c6100d92 820 cookie=0x2, in_port=1 actions=output:1
623e1caf
JP
821NXST_FLOW reply:
822])
823OVS_VSWITCHD_STOP
824AT_CLEANUP
825
75fa58f8
BP
826AT_SETUP([ofproto - no mod flow with cookie change (OpenFlow 1.1)])
827OVS_VSWITCHD_START
828AT_CHECK([ovs-ofctl -O OpenFlow11 add-flow br0 cookie=0x1,in_port=1,actions=1])
829AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0], [dnl
830 cookie=0x1, in_port=1 actions=output:1
831OFPST_FLOW reply (OF1.1):
832])
833AT_CHECK([ovs-ofctl -O OpenFlow11 mod-flows br0 cookie=0x2,in_port=1,actions=1])
834AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0], [dnl
835 cookie=0x1, in_port=1 actions=output:1
836OFPST_FLOW reply (OF1.1):
837])
838OVS_VSWITCHD_STOP
839AT_CLEANUP
840
9dcd1c00 841dnl The OpenFlow 1.2 spec states that the cookie may not be modified
2df3b874 842AT_SETUP([ofproto - no mod flow with cookie change (OpenFlow 1.2)])
9dcd1c00
SH
843OVS_VSWITCHD_START
844AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 cookie=0x1,in_port=1,actions=1])
845AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
846 cookie=0x1, in_port=1 actions=output:1
847OFPST_FLOW reply (OF1.2):
848])
849
850AT_CHECK([ovs-ofctl -O OpenFlow12 mod-flows br0 cookie=0x2,in_port=1,actions=1])
851AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
852 cookie=0x1, in_port=1 actions=output:1
853OFPST_FLOW reply (OF1.2):
854])
855OVS_VSWITCHD_STOP
856AT_CLEANUP
857
858AT_SETUP([ofproto - mod flows based on cookie mask (OpenFlow 1.0)])
623e1caf 859OVS_VSWITCHD_START
c6100d92
BP
860AT_CHECK([ovs-ofctl add-flow br0 cookie=0x1,in_port=1,actions=1])
861AT_CHECK([ovs-ofctl add-flow br0 cookie=0x1,in_port=2,actions=1])
862AT_CHECK([ovs-ofctl add-flow br0 cookie=0x2,in_port=3,actions=1])
623e1caf 863AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
c6100d92
BP
864 cookie=0x1, in_port=1 actions=output:1
865 cookie=0x1, in_port=2 actions=output:1
866 cookie=0x2, in_port=3 actions=output:1
623e1caf
JP
867NXST_FLOW reply:
868])
869
870AT_CHECK([ovs-ofctl -F nxm mod-flows br0 cookie=0x1/0xff,actions=4])
871AT_CHECK([ovs-ofctl -F nxm dump-flows br0 | ofctl_strip | sort], [0], [dnl
872 cookie=0x1, in_port=1 actions=output:4
873 cookie=0x1, in_port=2 actions=output:4
c6100d92 874 cookie=0x2, in_port=3 actions=output:1
623e1caf
JP
875NXST_FLOW reply:
876])
877OVS_VSWITCHD_STOP
878AT_CLEANUP
879
75fa58f8
BP
880AT_SETUP([ofproto - mod flows based on cookie mask (OpenFlow 1.1)])
881OVS_VSWITCHD_START
882AT_CHECK([ovs-ofctl -O OpenFlow11 add-flow br0 cookie=0x1,in_port=1,actions=1])
883AT_CHECK([ovs-ofctl -O OpenFlow11 add-flow br0 cookie=0x1,in_port=2,actions=1])
884AT_CHECK([ovs-ofctl -O OpenFlow11 add-flow br0 cookie=0x2,in_port=3,actions=1])
885AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0], [dnl
886 cookie=0x1, in_port=1 actions=output:1
887 cookie=0x1, in_port=2 actions=output:1
888 cookie=0x2, in_port=3 actions=output:1
889OFPST_FLOW reply (OF1.1):
890])
891
892AT_CHECK([ovs-ofctl -O OpenFlow11 mod-flows br0 cookie=0x1/0xff,actions=4])
893AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0], [dnl
894 cookie=0x1, in_port=1 actions=output:4
895 cookie=0x1, in_port=2 actions=output:4
896 cookie=0x2, in_port=3 actions=output:1
897OFPST_FLOW reply (OF1.1):
898])
899OVS_VSWITCHD_STOP
900AT_CLEANUP
901
9dcd1c00
SH
902AT_SETUP([ofproto - mod flows based on cookie mask (OpenFlow 1.2)])
903OVS_VSWITCHD_START
904AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 cookie=0x1,in_port=1,actions=1])
905AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 cookie=0x1,in_port=2,actions=1])
906AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 cookie=0x2,in_port=3,actions=1])
907AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
908 cookie=0x1, in_port=1 actions=output:1
909 cookie=0x1, in_port=2 actions=output:1
910 cookie=0x2, in_port=3 actions=output:1
911OFPST_FLOW reply (OF1.2):
912])
913
914AT_CHECK([ovs-ofctl -O OpenFlow12 mod-flows br0 cookie=0x1/0xff,actions=4])
915AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
916 cookie=0x1, in_port=1 actions=output:4
917 cookie=0x1, in_port=2 actions=output:4
918 cookie=0x2, in_port=3 actions=output:1
919OFPST_FLOW reply (OF1.2):
920])
921OVS_VSWITCHD_STOP
922AT_CLEANUP
923
924dnl The OpenFlow 1.2 spec states that the cookie may not be modified
623e1caf
JP
925AT_SETUP([ofproto - mod flows based on cookie mask with cookie change])
926OVS_VSWITCHD_START
c6100d92
BP
927AT_CHECK([ovs-ofctl add-flow br0 cookie=0x1,in_port=1,actions=1])
928AT_CHECK([ovs-ofctl add-flow br0 cookie=0x1,in_port=2,actions=1])
929AT_CHECK([ovs-ofctl add-flow br0 cookie=0x2,in_port=3,actions=1])
623e1caf 930AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
c6100d92
BP
931 cookie=0x1, in_port=1 actions=output:1
932 cookie=0x1, in_port=2 actions=output:1
933 cookie=0x2, in_port=3 actions=output:1
623e1caf
JP
934NXST_FLOW reply:
935])
936
937AT_CHECK([ovs-ofctl -F nxm mod-flows br0 cookie=1/-1,cookie=4,actions=4])
938AT_CHECK([ovs-ofctl -F nxm dump-flows br0 | ofctl_strip | sort], [0], [dnl
c6100d92 939 cookie=0x2, in_port=3 actions=output:1
623e1caf
JP
940 cookie=0x4, in_port=1 actions=output:4
941 cookie=0x4, in_port=2 actions=output:4
942NXST_FLOW reply:
943])
944OVS_VSWITCHD_STOP
945AT_CLEANUP
946
490020fe 947AT_SETUP([ofproto - mod flow with cookie miss (mask==0) - NXM])
623e1caf 948OVS_VSWITCHD_START
c6100d92 949AT_CHECK([ovs-ofctl -F nxm mod-flows br0 in_port=1,actions=1])
623e1caf 950AT_CHECK([ovs-ofctl -F nxm dump-flows br0 | ofctl_strip | sort], [0], [dnl
c6100d92 951 in_port=1 actions=output:1
623e1caf
JP
952NXST_FLOW reply:
953])
954OVS_VSWITCHD_STOP
955AT_CLEANUP
956
75fa58f8
BP
957AT_SETUP([ofproto - mod flow with cookie miss (mask==0) - OF1.1])
958OVS_VSWITCHD_START
959AT_CHECK([ovs-ofctl -O openflow11 mod-flows br0 in_port=1,actions=1])
960AT_CHECK([ovs-ofctl -O openflow11 dump-flows br0 | ofctl_strip | sort], [0], [dnl
961 in_port=1 actions=output:1
962OFPST_FLOW reply (OF1.1):
963])
964OVS_VSWITCHD_STOP
965AT_CLEANUP
966
490020fe
BP
967AT_SETUP([ofproto - mod flow with cookie miss (mask==0) - OF1.2])
968OVS_VSWITCHD_START
969AT_CHECK([ovs-ofctl -O openflow12 mod-flows br0 in_port=1,actions=1])
970AT_CHECK([ovs-ofctl -O openflow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
971OFPST_FLOW reply (OF1.2):
972])
973OVS_VSWITCHD_STOP
974AT_CLEANUP
975
976AT_SETUP([ofproto - mod flow with cookie miss (mask!=0) - NXM])
623e1caf 977OVS_VSWITCHD_START
c6100d92 978AT_CHECK([ovs-ofctl -F nxm mod-flows br0 cookie=1/1,in_port=1,actions=1])
623e1caf
JP
979AT_CHECK([ovs-ofctl -F nxm dump-flows br0 | ofctl_strip | sort], [0], [dnl
980NXST_FLOW reply:
981])
982OVS_VSWITCHD_STOP
983AT_CLEANUP
984
75fa58f8
BP
985AT_SETUP([ofproto - mod flow with cookie miss (mask!=0) - OF1.1])
986OVS_VSWITCHD_START
987AT_CHECK([ovs-ofctl -O openflow11 mod-flows br0 cookie=1/1,in_port=1,actions=1])
988AT_CHECK([ovs-ofctl -O openflow11 dump-flows br0 | ofctl_strip | sort], [0], [dnl
989OFPST_FLOW reply (OF1.1):
990])
991OVS_VSWITCHD_STOP
992AT_CLEANUP
993
490020fe
BP
994AT_SETUP([ofproto - mod flow with cookie miss (mask!=0) - OF1.2])
995OVS_VSWITCHD_START
996AT_CHECK([ovs-ofctl -O openflow12 mod-flows br0 cookie=1/1,in_port=1,actions=1])
997AT_CHECK([ovs-ofctl -O openflow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
998OFPST_FLOW reply (OF1.2):
999])
1000OVS_VSWITCHD_STOP
1001AT_CLEANUP
1002
623e1caf
JP
1003AT_SETUP([ofproto - del flows with cookies])
1004OVS_VSWITCHD_START
c6100d92
BP
1005AT_CHECK([ovs-ofctl add-flow br0 cookie=0x1,in_port=1,actions=1])
1006AT_CHECK([ovs-ofctl add-flow br0 cookie=0x2,in_port=2,actions=1])
1007AT_CHECK([ovs-ofctl add-flow br0 cookie=0x3,in_port=3,actions=1])
623e1caf 1008AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
c6100d92
BP
1009 cookie=0x1, in_port=1 actions=output:1
1010 cookie=0x2, in_port=2 actions=output:1
1011 cookie=0x3, in_port=3 actions=output:1
623e1caf
JP
1012NXST_FLOW reply:
1013])
1014
1015AT_CHECK([ovs-ofctl del-flows br0])
1016AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1017NXST_FLOW reply:
1018])
1019OVS_VSWITCHD_STOP
1020AT_CLEANUP
1021
1022AT_SETUP([ofproto - del flows based on cookie])
e729e793 1023OVS_VSWITCHD_START
c6100d92
BP
1024AT_CHECK([ovs-ofctl add-flow br0 cookie=0x1,in_port=1,actions=1])
1025AT_CHECK([ovs-ofctl add-flow br0 cookie=0x2,in_port=2,actions=1])
1026AT_CHECK([ovs-ofctl add-flow br0 cookie=0x3,in_port=3,actions=1])
ef0ce8ae 1027AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
c6100d92
BP
1028 cookie=0x1, in_port=1 actions=output:1
1029 cookie=0x2, in_port=2 actions=output:1
1030 cookie=0x3, in_port=3 actions=output:1
e729e793
JP
1031NXST_FLOW reply:
1032])
80d5aefd 1033
623e1caf 1034AT_CHECK([ovs-ofctl del-flows br0 cookie=0x3/-1])
ef0ce8ae 1035AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
c6100d92
BP
1036 cookie=0x1, in_port=1 actions=output:1
1037 cookie=0x2, in_port=2 actions=output:1
e729e793
JP
1038NXST_FLOW reply:
1039])
1040OVS_VSWITCHD_STOP
1041AT_CLEANUP
1042
623e1caf 1043AT_SETUP([ofproto - del flows based on cookie mask])
e729e793 1044OVS_VSWITCHD_START
c6100d92
BP
1045AT_CHECK([ovs-ofctl add-flow br0 cookie=0x1,in_port=1,actions=1])
1046AT_CHECK([ovs-ofctl add-flow br0 cookie=0x2,in_port=2,actions=1])
1047AT_CHECK([ovs-ofctl add-flow br0 cookie=0x3,in_port=3,actions=1])
ef0ce8ae 1048AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
c6100d92
BP
1049 cookie=0x1, in_port=1 actions=output:1
1050 cookie=0x2, in_port=2 actions=output:1
1051 cookie=0x3, in_port=3 actions=output:1
e729e793
JP
1052NXST_FLOW reply:
1053])
1054AT_CHECK([ovs-ofctl del-flows br0 cookie=0x3/0x1])
ef0ce8ae 1055AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
c6100d92 1056 cookie=0x2, in_port=2 actions=output:1
e729e793
JP
1057NXST_FLOW reply:
1058])
1059OVS_VSWITCHD_STOP
1060AT_CLEANUP
254750ce 1061
9dcd1c00 1062AT_SETUP([ofproto - del flows based on table id (NXM)])
c90cfeaf
SH
1063OVS_VSWITCHD_START
1064AT_CHECK([ovs-ofctl add-flow br0 cookie=0x1,in_port=1,actions=1])
1065AT_CHECK([ovs-ofctl add-flow br0 cookie=0x2,in_port=2,table=1,actions=1])
1066AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1067 cookie=0x1, in_port=1 actions=output:1
1068 cookie=0x2, table=1, in_port=2 actions=output:1
1069NXST_FLOW reply:
1070])
1071AT_CHECK([ovs-ofctl del-flows br0 table=0])
1072AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1073 cookie=0x2, table=1, in_port=2 actions=output:1
1074NXST_FLOW reply:
1075])
1076AT_CHECK([ovs-ofctl del-flows br0 table=1])
1077AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1078NXST_FLOW reply:
1079])
1080AT_CHECK([ovs-ofctl add-flow br0 cookie=0x1,in_port=1,actions=1])
1081AT_CHECK([ovs-ofctl add-flow br0 cookie=0x2,in_port=2,table=1,actions=1])
1082AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1083 cookie=0x1, in_port=1 actions=output:1
1084 cookie=0x2, table=1, in_port=2 actions=output:1
1085NXST_FLOW reply:
1086])
1087AT_CHECK([ovs-ofctl del-flows br0])
1088AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1089NXST_FLOW reply:
1090])
1091OVS_VSWITCHD_STOP
1092AT_CLEANUP
1093
75fa58f8
BP
1094AT_SETUP([ofproto - del flows based on table id (OpenFlow 1.1)])
1095OVS_VSWITCHD_START
1096AT_CHECK([ovs-ofctl -O OpenFlow11 add-flow br0 cookie=0x1,in_port=1,actions=1])
1097AT_CHECK([ovs-ofctl -O OpenFlow11 add-flow br0 cookie=0x2,in_port=2,table=1,actions=1])
1098AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1099 cookie=0x1, in_port=1 actions=output:1
1100 cookie=0x2, table=1, in_port=2 actions=output:1
1101OFPST_FLOW reply (OF1.1):
1102])
1103AT_CHECK([ovs-ofctl -O OpenFlow11 del-flows br0 table=0])
1104AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1105 cookie=0x2, table=1, in_port=2 actions=output:1
1106OFPST_FLOW reply (OF1.1):
1107])
1108AT_CHECK([ovs-ofctl -O OpenFlow11 del-flows br0 table=1])
1109AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1110OFPST_FLOW reply (OF1.1):
1111])
1112AT_CHECK([ovs-ofctl -O OpenFlow11 add-flow br0 cookie=0x1,in_port=1,actions=1])
1113AT_CHECK([ovs-ofctl -O OpenFlow11 add-flow br0 cookie=0x2,in_port=2,table=1,actions=1])
1114AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1115 cookie=0x1, in_port=1 actions=output:1
1116 cookie=0x2, table=1, in_port=2 actions=output:1
1117OFPST_FLOW reply (OF1.1):
1118])
1119AT_CHECK([ovs-ofctl -O OpenFlow11 del-flows br0])
0e197060 1120AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip], [0], [dnl
75fa58f8 1121OFPST_FLOW reply (OF1.1):
0e197060 1122 cookie=0x2, table=1, in_port=2 actions=output:1
75fa58f8
BP
1123])
1124OVS_VSWITCHD_STOP
1125AT_CLEANUP
1126
9dcd1c00
SH
1127AT_SETUP([ofproto - del flows based on table id (OpenFlow 1.2)])
1128OVS_VSWITCHD_START
1129AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 cookie=0x1,in_port=1,actions=1])
1130AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 cookie=0x2,in_port=2,table=1,actions=1])
1131AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1132 cookie=0x1, in_port=1 actions=output:1
1133 cookie=0x2, table=1, in_port=2 actions=output:1
1134OFPST_FLOW reply (OF1.2):
1135])
1136AT_CHECK([ovs-ofctl -O OpenFlow12 del-flows br0 table=0])
1137AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1138 cookie=0x2, table=1, in_port=2 actions=output:1
1139OFPST_FLOW reply (OF1.2):
1140])
1141AT_CHECK([ovs-ofctl -O OpenFlow12 del-flows br0 table=1])
1142AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1143OFPST_FLOW reply (OF1.2):
1144])
1145AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 cookie=0x1,in_port=1,actions=1])
1146AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 cookie=0x2,in_port=2,table=1,actions=1])
1147AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1148 cookie=0x1, in_port=1 actions=output:1
1149 cookie=0x2, table=1, in_port=2 actions=output:1
1150OFPST_FLOW reply (OF1.2):
1151])
1152AT_CHECK([ovs-ofctl -O OpenFlow12 del-flows br0])
1153AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1154OFPST_FLOW reply (OF1.2):
1155])
1156OVS_VSWITCHD_STOP
1157AT_CLEANUP
1158
1159AT_SETUP([ofproto - flow table configuration (OpenFlow 1.0)])
254750ce
BP
1160OVS_VSWITCHD_START
1161# Check the default configuration.
3c1bb396
BP
1162(printf "OFPST_TABLE reply (xid=0x2):"
1163 x=0
1164 name=classifier
c57b2226 1165 while test $x -lt 254; do
3c1bb396
BP
1166 printf "
1167 table %d (\"%s\"):
1168 active=0, lookup=0, matched=0
1169 max_entries=1000000
1170 matching:
1171 in_port: exact match or wildcard
1172 eth_src: exact match or wildcard
1173 eth_dst: exact match or wildcard
1174 eth_type: exact match or wildcard
1175 vlan_vid: exact match or wildcard
1176 vlan_pcp: exact match or wildcard
1177 ip_src: exact match or wildcard
1178 ip_dst: exact match or wildcard
1179 nw_proto: exact match or wildcard
1180 nw_tos: exact match or wildcard
1181 tcp_src: exact match or wildcard
1182 tcp_dst: exact match or wildcard
1183" $x $name
254750ce 1184 x=`expr $x + 1`
3c1bb396 1185 name=table$x
c2f0373a 1186 done) > expout
254750ce
BP
1187AT_CHECK([ovs-ofctl dump-tables br0], [0], [expout])
1188# Change the configuration.
1189AT_CHECK(
1190 [ovs-vsctl \
1191 -- --id=@t0 create Flow_Table name=main \
1192 -- --id=@t1 create Flow_Table flow-limit=1024 \
1193 -- set bridge br0 'flow_tables={1=@t1,0=@t0}' \
5c6d0628 1194 | ${PERL} $srcdir/uuidfilt.pl],
254750ce
BP
1195 [0], [<0>
1196<1>
1197])
1198# Check that the configuration was updated.
1199mv expout orig-expout
3c1bb396
BP
1200sed -e 's/classifier/main/
120121s/1000000/1024/' orig-expout > expout
254750ce
BP
1202AT_CHECK([ovs-ofctl dump-tables br0], [0], [expout])
1203OVS_VSWITCHD_STOP
1204AT_CLEANUP
1205
9dcd1c00
SH
1206AT_SETUP([ofproto - flow table configuration (OpenFlow 1.2)])
1207OVS_VSWITCHD_START
1208# Check the default configuration.
3c1bb396
BP
1209(printf "OFPST_TABLE reply (OF1.2) (xid=0x2):"
1210 x=0
1211 name=classifier
9dcd1c00 1212 while test $x -lt 254; do
3c1bb396
BP
1213 echo "
1214 table $x (\"$name\"):
1215 active=0, lookup=0, matched=0
1216 metadata: match=0xffffffffffffffff write=0xffffffffffffffff
1217 config=controller
1218 max_entries=1000000
1219 instructions (table miss and others):
1220 instructions: apply_actions,clear_actions,write_actions,write_metadata,goto_table
1221 Write-Actions and Apply-Actions features:
1222 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
1223 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 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
1224 matching:
1225 metadata: exact match or wildcard
1226 in_port_oxm: exact match or wildcard
1227 eth_src: exact match or wildcard
1228 eth_dst: exact match or wildcard
1229 eth_type: exact match or wildcard
1230 vlan_vid: exact match or wildcard
1231 vlan_pcp: exact match or wildcard
1232 mpls_label: exact match or wildcard
1233 mpls_tc: exact match or wildcard
1234 ip_src: exact match or wildcard
1235 ip_dst: exact match or wildcard
1236 ipv6_src: exact match or wildcard
1237 ipv6_dst: exact match or wildcard
1238 ipv6_label: exact match or wildcard
1239 nw_proto: exact match or wildcard
1240 ip_dscp: exact match or wildcard
1241 nw_ecn: exact match or wildcard
1242 arp_op: exact match or wildcard
1243 arp_spa: exact match or wildcard
1244 arp_tpa: exact match or wildcard
1245 arp_sha: exact match or wildcard
1246 arp_tha: exact match or wildcard
1247 tcp_src: exact match or wildcard
1248 tcp_dst: exact match or wildcard
1249 udp_src: exact match or wildcard
1250 udp_dst: exact match or wildcard
1251 sctp_src: exact match or wildcard
1252 sctp_dst: exact match or wildcard
1253 icmp_type: exact match or wildcard
1254 icmp_code: exact match or wildcard
1255 icmpv6_type: exact match or wildcard
1256 icmpv6_code: exact match or wildcard
1257 nd_target: exact match or wildcard
1258 nd_sll: exact match or wildcard
1259 nd_tll: exact match or wildcard"
9dcd1c00 1260 x=`expr $x + 1`
3c1bb396 1261 name=table$x
9dcd1c00
SH
1262 done) > expout
1263AT_CHECK([ovs-ofctl -O OpenFlow12 dump-tables br0], [0], [expout])
1264# Change the configuration.
1265AT_CHECK(
1266 [ovs-vsctl \
1267 -- --id=@t0 create Flow_Table name=main \
1268 -- --id=@t1 create Flow_Table flow-limit=1024 \
1269 -- set bridge br0 'flow_tables={1=@t1,0=@t0}' \
5c6d0628 1270 | ${PERL} $srcdir/uuidfilt.pl],
9dcd1c00
SH
1271 [0], [<0>
1272<1>
1273])
1274# Check that the configuration was updated.
1275mv expout orig-expout
3c1bb396
BP
1276sed 's/classifier/main/
127753s/1000000/1024/' < orig-expout > expout
9dcd1c00
SH
1278AT_CHECK([ovs-ofctl -O OpenFlow12 dump-tables br0], [0], [expout])
1279OVS_VSWITCHD_STOP
1280AT_CLEANUP
1281
3c4e10fb
BP
1282AT_SETUP([ofproto - table features (OpenFlow 1.3)])
1283OVS_VSWITCHD_START
1284(x=0
1285 name=classifier
1286 while test $x -lt 254; do
1287 y=`expr $x + 1`
1288 if test $x = 253; then
1289 next=254
1290 else
1291 next=$y-254
1292 fi
1293 echo " table $x (\"$name\"):
1294 metadata: match=0xffffffffffffffff write=0xffffffffffffffff
1295 max_entries=1000000
1296 instructions (table miss and others):
1297 next tables: $next
1298 instructions: meter,apply_actions,clear_actions,write_actions,write_metadata,goto_table
1299 Write-Actions and Apply-Actions features:
1300 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
1301 supported on Set-Field: tun_id tun_src tun_dst metadata in_port in_port_oxm pkt_mark 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 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
1302 matching:
1303 dp_hash: arbitrary mask
1304 recirc_id: exact match or wildcard
1305 tun_id: arbitrary mask
1306 tun_src: arbitrary mask
1307 tun_dst: arbitrary mask
1308 metadata: arbitrary mask
1309 in_port: exact match or wildcard
1310 in_port_oxm: exact match or wildcard
c61f3870 1311 actset_output: exact match or wildcard
3c4e10fb
BP
1312 pkt_mark: arbitrary mask
1313 reg0: arbitrary mask
1314 reg1: arbitrary mask
1315 reg2: arbitrary mask
1316 reg3: arbitrary mask
1317 reg4: arbitrary mask
1318 reg5: arbitrary mask
1319 reg6: arbitrary mask
1320 reg7: arbitrary mask
1321 xreg0: arbitrary mask
1322 xreg1: arbitrary mask
1323 xreg2: arbitrary mask
1324 xreg3: arbitrary mask
1325 eth_src: arbitrary mask
1326 eth_dst: arbitrary mask
1327 eth_type: exact match or wildcard
1328 vlan_tci: arbitrary mask
1329 vlan_vid: arbitrary mask
1330 vlan_pcp: exact match or wildcard
1331 mpls_label: exact match or wildcard
1332 mpls_tc: exact match or wildcard
1333 mpls_bos: exact match or wildcard
1334 ip_src: arbitrary mask
1335 ip_dst: arbitrary mask
1336 ipv6_src: arbitrary mask
1337 ipv6_dst: arbitrary mask
1338 ipv6_label: arbitrary mask
1339 nw_proto: exact match or wildcard
1340 nw_tos: exact match or wildcard
1341 ip_dscp: exact match or wildcard
1342 nw_ecn: exact match or wildcard
1343 nw_ttl: exact match or wildcard
1344 ip_frag: arbitrary mask
1345 arp_op: exact match or wildcard
1346 arp_spa: arbitrary mask
1347 arp_tpa: arbitrary mask
1348 arp_sha: arbitrary mask
1349 arp_tha: arbitrary mask
1350 tcp_src: arbitrary mask
1351 tcp_dst: arbitrary mask
1352 tcp_flags: arbitrary mask
1353 udp_src: arbitrary mask
1354 udp_dst: arbitrary mask
1355 sctp_src: arbitrary mask
1356 sctp_dst: arbitrary mask
1357 icmp_type: exact match or wildcard
1358 icmp_code: exact match or wildcard
1359 icmpv6_type: exact match or wildcard
1360 icmpv6_code: exact match or wildcard
1361 nd_target: arbitrary mask
1362 nd_sll: arbitrary mask
1363 nd_tll: arbitrary mask"
1364 x=$y
1365 name=table$x
1366 done) > expout
1367AT_CHECK([ovs-ofctl -O OpenFlow13 dump-table-features br0 | sed '/^$/d
1368/^OFPST_TABLE_FEATURES/d'], [0], [expout])
1369# Change the configuration.
1370AT_CHECK(
1371 [ovs-vsctl \
1372 -- --id=@t0 create Flow_Table name=main \
1373 -- --id=@t1 create Flow_Table flow-limit=1024 \
1374 -- set bridge br0 'flow_tables={1=@t1,0=@t0}' \
1375 | ${PERL} $srcdir/uuidfilt.pl],
1376 [0], [<0>
1377<1>
1378])
1379# Check that the configuration was updated.
1380mv expout orig-expout
1381sed 's/classifier/main/
c61f3870 138274s/1000000/1024/' < orig-expout > expout
3c4e10fb
BP
1383AT_CHECK([ovs-ofctl -O OpenFlow13 dump-table-features br0 | sed '/^$/d
1384/^OFPST_TABLE_FEATURES/d'], [0], [expout])
1385OVS_VSWITCHD_STOP
1386AT_CLEANUP
1387
06f64d03 1388AT_SETUP([ofproto - hard limits on flow table size (OpenFlow 1.0)])
254750ce
BP
1389OVS_VSWITCHD_START
1390# Configure a maximum of 4 flows.
1391AT_CHECK(
1392 [ovs-vsctl \
1393 -- --id=@t0 create Flow_Table flow-limit=4 \
1394 -- set bridge br0 flow_tables:0=@t0 \
5c6d0628 1395 | ${PERL} $srcdir/uuidfilt.pl],
254750ce
BP
1396 [0], [<0>
1397])
1398# Add 4 flows.
1399for in_port in 1 2 3 4; do
1400 ovs-ofctl add-flow br0 in_port=$in_port,actions=drop
1401done
1402AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1403 in_port=1 actions=drop
1404 in_port=2 actions=drop
1405 in_port=3 actions=drop
1406 in_port=4 actions=drop
1407NXST_FLOW reply:
1408])
1409# Adding another flow will be refused.
1410AT_CHECK([ovs-ofctl add-flow br0 in_port=5,actions=drop], [1], [], [stderr])
27527aa0 1411AT_CHECK([head -n 1 stderr | ofctl_strip], [0],
be2b69d1 1412 [OFPT_ERROR: OFPFMFC_TABLE_FULL
254750ce
BP
1413])
1414# Also a mod-flow that would add a flow will be refused.
1415AT_CHECK([ovs-ofctl mod-flows br0 in_port=5,actions=drop], [1], [], [stderr])
27527aa0 1416AT_CHECK([head -n 1 stderr | ofctl_strip], [0],
be2b69d1 1417 [OFPT_ERROR: OFPFMFC_TABLE_FULL
254750ce
BP
1418])
1419# Replacing or modifying an existing flow is allowed.
1420AT_CHECK([ovs-ofctl add-flow br0 in_port=4,actions=normal])
1421AT_CHECK([ovs-ofctl mod-flows br0 in_port=3,actions=output:1])
1422AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1423 in_port=1 actions=drop
1424 in_port=2 actions=drop
1425 in_port=3 actions=output:1
1426 in_port=4 actions=NORMAL
1427NXST_FLOW reply:
1428])
1429OVS_VSWITCHD_STOP
1430AT_CLEANUP
1431
06f64d03 1432AT_SETUP([ofproto - hard limits on flow table size (OpenFlow 1.2)])
9dcd1c00
SH
1433OVS_VSWITCHD_START
1434# Configure a maximum of 4 flows.
1435AT_CHECK(
1436 [ovs-vsctl \
1437 -- --id=@t0 create Flow_Table flow-limit=4 \
1438 -- set bridge br0 flow_tables:0=@t0 \
5c6d0628 1439 | ${PERL} $srcdir/uuidfilt.pl],
9dcd1c00
SH
1440 [0], [<0>
1441])
1442# Add 4 flows.
1443for in_port in 1 2 3 4; do
1444 ovs-ofctl -O OpenFlow12 add-flow br0 in_port=$in_port,actions=drop
1445done
1446AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1447 in_port=1 actions=drop
1448 in_port=2 actions=drop
1449 in_port=3 actions=drop
1450 in_port=4 actions=drop
1451OFPST_FLOW reply (OF1.2):
1452])
1453# Adding another flow will be refused.
1454AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 in_port=5,actions=drop], [1], [], [stderr])
1455AT_CHECK([head -n 1 stderr | ofctl_strip], [0],
1456 [OFPT_ERROR (OF1.2): OFPFMFC_TABLE_FULL
1457])
1458# Replacing or modifying an existing flow is allowed.
1459AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 in_port=4,actions=normal])
1460AT_CHECK([ovs-ofctl -O OpenFlow12 mod-flows br0 in_port=3,actions=output:1])
1461AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1462 in_port=1 actions=drop
1463 in_port=2 actions=drop
1464 in_port=3 actions=output:1
1465 in_port=4 actions=NORMAL
1466OFPST_FLOW reply (OF1.2):
1467])
1468OVS_VSWITCHD_STOP
1469AT_CLEANUP
1470
1471AT_SETUP([ofproto - eviction upon table overflow (OpenFlow 1.0)])
254750ce
BP
1472OVS_VSWITCHD_START
1473# Configure a maximum of 4 flows.
1474AT_CHECK(
1475 [ovs-vsctl \
1476 -- --id=@t0 create Flow_Table flow-limit=4 overflow-policy=evict \
1477 -- set bridge br0 flow_tables:0=@t0 \
5c6d0628 1478 | ${PERL} $srcdir/uuidfilt.pl],
254750ce
BP
1479 [0], [<0>
1480])
1481# Add 4 flows.
1482for in_port in 4 3 2 1; do
1483 ovs-ofctl add-flow br0 idle_timeout=${in_port}0,in_port=$in_port,actions=drop
1484done
1485AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
b9718b7b
BP
1486 idle_timeout=10, in_port=1 actions=drop
1487 idle_timeout=20, in_port=2 actions=drop
1488 idle_timeout=30, in_port=3 actions=drop
1489 idle_timeout=40, in_port=4 actions=drop
254750ce
BP
1490NXST_FLOW reply:
1491])
1492# Adding another flow will cause the one that expires soonest to be evicted.
1493AT_CHECK([ovs-ofctl add-flow br0 in_port=5,actions=drop])
1494AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
b9718b7b
BP
1495 idle_timeout=20, in_port=2 actions=drop
1496 idle_timeout=30, in_port=3 actions=drop
1497 idle_timeout=40, in_port=4 actions=drop
254750ce
BP
1498 in_port=5 actions=drop
1499NXST_FLOW reply:
1500])
1501# A mod-flow that adds a flow also causes eviction, but replacing or
1502# modifying an existing flow doesn't.
1503AT_CHECK([ovs-ofctl mod-flows br0 in_port=6,actions=drop])
1504AT_CHECK([ovs-ofctl add-flow br0 in_port=4,actions=normal])
1505AT_CHECK([ovs-ofctl mod-flows br0 in_port=3,actions=output:1])
1506AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
b9718b7b 1507 idle_timeout=30, in_port=3 actions=output:1
254750ce
BP
1508 in_port=4 actions=NORMAL
1509 in_port=5 actions=drop
1510 in_port=6 actions=drop
1511NXST_FLOW reply:
1512])
1513# Flows with no timeouts at all cannot be evicted.
1514AT_CHECK([ovs-ofctl add-flow br0 in_port=7,actions=normal])
1515AT_CHECK([ovs-ofctl add-flow br0 in_port=8,actions=drop], [1], [], [stderr])
27527aa0 1516AT_CHECK([head -n 1 stderr | ofctl_strip], [0],
be2b69d1 1517 [OFPT_ERROR: OFPFMFC_TABLE_FULL
254750ce
BP
1518])
1519AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1520 in_port=4 actions=NORMAL
1521 in_port=5 actions=drop
1522 in_port=6 actions=drop
1523 in_port=7 actions=NORMAL
1524NXST_FLOW reply:
1525])
1526OVS_VSWITCHD_STOP
1527AT_CLEANUP
1528
9dcd1c00
SH
1529AT_SETUP([ofproto - eviction upon table overflow (OpenFlow 1.2)])
1530OVS_VSWITCHD_START
1531# Configure a maximum of 4 flows.
1532AT_CHECK(
1533 [ovs-vsctl \
1534 -- --id=@t0 create Flow_Table flow-limit=4 overflow-policy=evict \
1535 -- set bridge br0 flow_tables:0=@t0 \
5c6d0628 1536 | ${PERL} $srcdir/uuidfilt.pl],
9dcd1c00
SH
1537 [0], [<0>
1538])
1539# Add 4 flows.
1540for in_port in 4 3 2 1; do
1541 ovs-ofctl -O OpenFlow12 add-flow br0 idle_timeout=${in_port}0,in_port=$in_port,actions=drop
1542done
1543AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1544 idle_timeout=10, in_port=1 actions=drop
1545 idle_timeout=20, in_port=2 actions=drop
1546 idle_timeout=30, in_port=3 actions=drop
1547 idle_timeout=40, in_port=4 actions=drop
1548OFPST_FLOW reply (OF1.2):
1549])
1550# Adding another flow will cause the one that expires soonest to be evicted.
1551AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 in_port=5,actions=drop])
1552AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1553 idle_timeout=20, in_port=2 actions=drop
1554 idle_timeout=30, in_port=3 actions=drop
1555 idle_timeout=40, in_port=4 actions=drop
1556 in_port=5 actions=drop
1557OFPST_FLOW reply (OF1.2):
1558])
1559# In Open Flow 1.2 a mod-flow does not ever add a flow and thus
1560# has no effect on eviction
1561AT_CHECK([ovs-ofctl -O OpenFlow12 mod-flows br0 in_port=6,actions=drop])
1562AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 in_port=4,actions=normal])
1563AT_CHECK([ovs-ofctl -O OpenFlow12 mod-flows br0 in_port=3,actions=output:1])
1564AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1565 idle_timeout=20, in_port=2 actions=drop
1566 idle_timeout=30, in_port=3 actions=output:1
1567 in_port=4 actions=NORMAL
1568 in_port=5 actions=drop
1569OFPST_FLOW reply (OF1.2):
1570])
1571# Flows with no timeouts at all cannot be evicted.
1572AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 in_port=6,actions=drop])
1573AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 in_port=7,actions=normal])
1574AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 in_port=8,actions=drop], [1], [], [stderr])
1575AT_CHECK([head -n 1 stderr | ofctl_strip], [0],
1576 [OFPT_ERROR (OF1.2): OFPFMFC_TABLE_FULL
1577])
1578AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1579 in_port=4 actions=NORMAL
1580 in_port=5 actions=drop
1581 in_port=6 actions=drop
1582 in_port=7 actions=NORMAL
1583OFPST_FLOW reply (OF1.2):
1584])
1585OVS_VSWITCHD_STOP
1586AT_CLEANUP
1587
1588AT_SETUP([ofproto - eviction upon table overflow, with fairness (OpenFlow 1.0)])
254750ce
BP
1589OVS_VSWITCHD_START
1590# Configure a maximum of 4 flows.
1591AT_CHECK(
1592 [ovs-vsctl \
1593 -- --id=@t0 create Flow_Table name=evict flow-limit=4 \
1594 overflow-policy=evict \
1595 groups='"NXM_OF_IN_PORT[[]]"' \
1596 -- set bridge br0 flow_tables:0=@t0 \
5c6d0628 1597 | ${PERL} $srcdir/uuidfilt.pl],
254750ce
BP
1598 [0], [<0>
1599])
1600# Add 4 flows.
1601ovs-ofctl add-flows br0 - <<EOF
1602idle_timeout=10 in_port=2 dl_src=00:44:55:66:77:88 actions=drop
1603idle_timeout=20 in_port=1 dl_src=00:11:22:33:44:55 actions=drop
1604idle_timeout=30 in_port=1 dl_src=00:22:33:44:55:66 actions=drop
1605idle_timeout=40 in_port=1 dl_src=00:33:44:55:66:77 actions=drop
1606EOF
1607AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
b9718b7b
BP
1608 idle_timeout=10, in_port=2,dl_src=00:44:55:66:77:88 actions=drop
1609 idle_timeout=20, in_port=1,dl_src=00:11:22:33:44:55 actions=drop
1610 idle_timeout=30, in_port=1,dl_src=00:22:33:44:55:66 actions=drop
1611 idle_timeout=40, in_port=1,dl_src=00:33:44:55:66:77 actions=drop
254750ce
BP
1612NXST_FLOW reply:
1613])
1614# Adding another flow will cause the one that expires soonest within
1615# the largest group (those with in_port=1) to be evicted. In this
1616# case this is not the same as the one that expires soonest overall
1617# (which is what makes the test interesting):
1618AT_CHECK([ovs-ofctl add-flow br0 in_port=2,dl_src=00:55:66:77:88:99,actions=drop])
1619AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
b9718b7b
BP
1620 idle_timeout=10, in_port=2,dl_src=00:44:55:66:77:88 actions=drop
1621 idle_timeout=30, in_port=1,dl_src=00:22:33:44:55:66 actions=drop
1622 idle_timeout=40, in_port=1,dl_src=00:33:44:55:66:77 actions=drop
254750ce
BP
1623 in_port=2,dl_src=00:55:66:77:88:99 actions=drop
1624NXST_FLOW reply:
1625])
1626# Enlarge the flow limit, change the eviction policy back to strictly
1627# based on expiration, and and add some flows.
1628AT_CHECK([ovs-vsctl set Flow_Table evict groups='[[]]' flow-limit=7])
1629ovs-ofctl add-flows br0 - <<EOF
1630idle_timeout=50 in_port=2 dl_src=00:66:77:88:99:aa actions=drop
1631idle_timeout=60 in_port=2 dl_src=00:77:88:99:aa:bb actions=drop
1632idle_timeout=70 in_port=2 dl_src=00:88:99:aa:bb:cc actions=drop
1633EOF
1634AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
b9718b7b
BP
1635 idle_timeout=10, in_port=2,dl_src=00:44:55:66:77:88 actions=drop
1636 idle_timeout=30, in_port=1,dl_src=00:22:33:44:55:66 actions=drop
1637 idle_timeout=40, in_port=1,dl_src=00:33:44:55:66:77 actions=drop
1638 idle_timeout=50, in_port=2,dl_src=00:66:77:88:99:aa actions=drop
1639 idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=drop
1640 idle_timeout=70, in_port=2,dl_src=00:88:99:aa:bb:cc actions=drop
254750ce
BP
1641 in_port=2,dl_src=00:55:66:77:88:99 actions=drop
1642NXST_FLOW reply:
1643])
1644# Adding another flow will cause the one that expires soonest overall
1645# to be evicted.
1646AT_CHECK([ovs-ofctl add-flow br0 'idle_timeout=80 in_port=2 dl_src=00:99:aa:bb:cc:dd actions=drop'])
1647AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
b9718b7b
BP
1648 idle_timeout=30, in_port=1,dl_src=00:22:33:44:55:66 actions=drop
1649 idle_timeout=40, in_port=1,dl_src=00:33:44:55:66:77 actions=drop
1650 idle_timeout=50, in_port=2,dl_src=00:66:77:88:99:aa actions=drop
1651 idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=drop
1652 idle_timeout=70, in_port=2,dl_src=00:88:99:aa:bb:cc actions=drop
1653 idle_timeout=80, in_port=2,dl_src=00:99:aa:bb:cc:dd actions=drop
254750ce
BP
1654 in_port=2,dl_src=00:55:66:77:88:99 actions=drop
1655NXST_FLOW reply:
1656])
1657# Reducing the flow limit also causes the flows that expire soonest
1658# overall to be evicted.
1659AT_CHECK([ovs-vsctl set Flow_Table evict flow-limit=4])
1660AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
b9718b7b
BP
1661 idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=drop
1662 idle_timeout=70, in_port=2,dl_src=00:88:99:aa:bb:cc actions=drop
1663 idle_timeout=80, in_port=2,dl_src=00:99:aa:bb:cc:dd actions=drop
254750ce
BP
1664 in_port=2,dl_src=00:55:66:77:88:99 actions=drop
1665NXST_FLOW reply:
1666])
1667OVS_VSWITCHD_STOP
1668AT_CLEANUP
80d5aefd 1669
9dcd1c00
SH
1670AT_SETUP([ofproto - eviction upon table overflow, with fairness (OpenFlow 1.2)])
1671OVS_VSWITCHD_START
1672# Configure a maximum of 4 flows.
1673AT_CHECK(
1674 [ovs-vsctl \
1675 -- --id=@t0 create Flow_Table name=evict flow-limit=4 \
1676 overflow-policy=evict \
1677 groups='"NXM_OF_IN_PORT[[]]"' \
1678 -- set bridge br0 flow_tables:0=@t0 \
5c6d0628 1679 | ${PERL} $srcdir/uuidfilt.pl],
9dcd1c00
SH
1680 [0], [<0>
1681])
1682# Add 4 flows.
1683ovs-ofctl -O OpenFlow12 add-flows br0 - <<EOF
1684idle_timeout=10 in_port=2 dl_src=00:44:55:66:77:88 actions=drop
1685idle_timeout=20 in_port=1 dl_src=00:11:22:33:44:55 actions=drop
1686idle_timeout=30 in_port=1 dl_src=00:22:33:44:55:66 actions=drop
1687idle_timeout=40 in_port=1 dl_src=00:33:44:55:66:77 actions=drop
1688EOF
1689AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1690 idle_timeout=10, in_port=2,dl_src=00:44:55:66:77:88 actions=drop
1691 idle_timeout=20, in_port=1,dl_src=00:11:22:33:44:55 actions=drop
1692 idle_timeout=30, in_port=1,dl_src=00:22:33:44:55:66 actions=drop
1693 idle_timeout=40, in_port=1,dl_src=00:33:44:55:66:77 actions=drop
1694OFPST_FLOW reply (OF1.2):
1695])
1696# Adding another flow will cause the one that expires soonest within
1697# the largest group (those with in_port=1) to be evicted. In this
1698# case this is not the same as the one that expires soonest overall
1699# (which is what makes the test interesting):
1700AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 in_port=2,dl_src=00:55:66:77:88:99,actions=drop])
1701AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1702 idle_timeout=10, in_port=2,dl_src=00:44:55:66:77:88 actions=drop
1703 idle_timeout=30, in_port=1,dl_src=00:22:33:44:55:66 actions=drop
1704 idle_timeout=40, in_port=1,dl_src=00:33:44:55:66:77 actions=drop
1705 in_port=2,dl_src=00:55:66:77:88:99 actions=drop
1706OFPST_FLOW reply (OF1.2):
1707])
1708# Enlarge the flow limit, change the eviction policy back to strictly
1709# based on expiration, and and add some flows.
1710AT_CHECK([ovs-vsctl set Flow_Table evict groups='[[]]' flow-limit=7])
1711ovs-ofctl -O OpenFlow12 add-flows br0 - <<EOF
1712idle_timeout=50 in_port=2 dl_src=00:66:77:88:99:aa actions=drop
1713idle_timeout=60 in_port=2 dl_src=00:77:88:99:aa:bb actions=drop
1714idle_timeout=70 in_port=2 dl_src=00:88:99:aa:bb:cc actions=drop
1715EOF
1716AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1717 idle_timeout=10, in_port=2,dl_src=00:44:55:66:77:88 actions=drop
1718 idle_timeout=30, in_port=1,dl_src=00:22:33:44:55:66 actions=drop
1719 idle_timeout=40, in_port=1,dl_src=00:33:44:55:66:77 actions=drop
1720 idle_timeout=50, in_port=2,dl_src=00:66:77:88:99:aa actions=drop
1721 idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=drop
1722 idle_timeout=70, in_port=2,dl_src=00:88:99:aa:bb:cc actions=drop
1723 in_port=2,dl_src=00:55:66:77:88:99 actions=drop
1724OFPST_FLOW reply (OF1.2):
1725])
1726# Adding another flow will cause the one that expires soonest overall
1727# to be evicted.
1728AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 'idle_timeout=80 in_port=2 dl_src=00:99:aa:bb:cc:dd actions=drop'])
1729AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1730 idle_timeout=30, in_port=1,dl_src=00:22:33:44:55:66 actions=drop
1731 idle_timeout=40, in_port=1,dl_src=00:33:44:55:66:77 actions=drop
1732 idle_timeout=50, in_port=2,dl_src=00:66:77:88:99:aa actions=drop
1733 idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=drop
1734 idle_timeout=70, in_port=2,dl_src=00:88:99:aa:bb:cc actions=drop
1735 idle_timeout=80, in_port=2,dl_src=00:99:aa:bb:cc:dd actions=drop
1736 in_port=2,dl_src=00:55:66:77:88:99 actions=drop
1737OFPST_FLOW reply (OF1.2):
1738])
1739# Reducing the flow limit also causes the flows that expire soonest
1740# overall to be evicted.
1741AT_CHECK([ovs-vsctl set Flow_Table evict flow-limit=4])
1742AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1743 idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=drop
1744 idle_timeout=70, in_port=2,dl_src=00:88:99:aa:bb:cc actions=drop
1745 idle_timeout=80, in_port=2,dl_src=00:99:aa:bb:cc:dd actions=drop
1746 in_port=2,dl_src=00:55:66:77:88:99 actions=drop
1747OFPST_FLOW reply (OF1.2):
1748])
1749OVS_VSWITCHD_STOP
1750AT_CLEANUP
1751
6d56c1f1
K
1752AT_SETUP([ofproto - eviction upon table overflow, with modified hard timeout])
1753OVS_VSWITCHD_START
1754# Configure a maximum of 4 flows.
1755AT_CHECK(
1756 [ovs-vsctl \
1757 -- --id=@t0 create Flow_Table flow-limit=4 overflow-policy=evict \
1758 -- set bridge br0 flow_tables:0=@t0 \
1759 | ${PERL} $srcdir/uuidfilt.pl],
1760 [0], [<0>
1761])
337a3866 1762ovs-appctl time/stop
6d56c1f1
K
1763# Add 4 flows.
1764for in_port in 4 3 2 1; do
337a3866 1765 ovs-ofctl add-flow br0 hard_timeout=$((10 + in_port * 3)),in_port=$in_port,actions=drop
6d56c1f1
K
1766done
1767AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
337a3866
YT
1768 hard_timeout=13, in_port=1 actions=drop
1769 hard_timeout=16, in_port=2 actions=drop
1770 hard_timeout=19, in_port=3 actions=drop
1771 hard_timeout=22, in_port=4 actions=drop
6d56c1f1
K
1772NXST_FLOW reply:
1773])
1774# Sleep and modify the one that expires soonest
337a3866 1775ovs-appctl time/warp 5000
6d56c1f1 1776AT_CHECK([ovs-ofctl mod-flows br0 in_port=1,actions=drop])
337a3866
YT
1777# At this point the table would looks like:
1778# in_port seconds to expire
1779# 1 13
1780# 2 11
1781# 3 14
1782# 4 17
1783ovs-appctl time/warp 2000
6d56c1f1
K
1784# Adding another flow will cause the one that expires soonest to be evicted.
1785AT_CHECK([ovs-ofctl add-flow br0 in_port=5,actions=drop])
1786AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
337a3866
YT
1787 hard_timeout=13, in_port=1 actions=drop
1788 hard_timeout=19, in_port=3 actions=drop
1789 hard_timeout=22, in_port=4 actions=drop
6d56c1f1
K
1790 in_port=5 actions=drop
1791NXST_FLOW reply:
1792])
1793OVS_VSWITCHD_STOP
1794AT_CLEANUP
1795
1796AT_SETUP([ofproto - eviction upon table overflow, with modified idle timeout])
1797OVS_VSWITCHD_START([add-port br0 p1 -- set interface p1 type=dummy ofport_request=1])
1798# Configure a maximum of 4 flows.
1799AT_CHECK(
1800 [ovs-vsctl \
1801 -- --id=@t0 create Flow_Table flow-limit=4 overflow-policy=evict \
1802 -- set bridge br0 flow_tables:0=@t0 \
1803 | ${PERL} $srcdir/uuidfilt.pl],
1804 [0], [<0>
1805])
1806# Add 4 flows.
1807for in_port in 4 3 2 1; do
337a3866 1808 ovs-ofctl add-flow br0 idle_timeout=$((10 + in_port * 3)),in_port=$in_port,actions=drop
6d56c1f1 1809done
337a3866 1810ovs-appctl time/stop
6d56c1f1 1811AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
337a3866
YT
1812 idle_timeout=13, in_port=1 actions=drop
1813 idle_timeout=16, in_port=2 actions=drop
1814 idle_timeout=19, in_port=3 actions=drop
1815 idle_timeout=22, in_port=4 actions=drop
6d56c1f1
K
1816NXST_FLOW reply:
1817])
1818# Sleep and receive on the flow that expires soonest
337a3866 1819ovs-appctl time/warp 5000
6d56c1f1 1820AT_CHECK([ovs-appctl netdev-dummy/receive p1 'in_port(1)'])
337a3866
YT
1821# At this point the table would looks like:
1822# in_port seconds to expire
1823# 1 13
1824# 2 11
1825# 3 14
1826# 4 17
1827ovs-appctl time/warp 2000
6d56c1f1
K
1828# Adding another flow will cause the one that expires soonest to be evicted.
1829AT_CHECK([ovs-ofctl add-flow br0 in_port=5,actions=drop])
1830AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
337a3866
YT
1831 idle_timeout=19, in_port=3 actions=drop
1832 idle_timeout=22, in_port=4 actions=drop
6d56c1f1 1833 in_port=5 actions=drop
337a3866 1834 n_packets=1, n_bytes=60, idle_timeout=13, in_port=1 actions=drop
6d56c1f1
K
1835NXST_FLOW reply:
1836])
1837OVS_VSWITCHD_STOP
1838AT_CLEANUP
1839
9dcd1c00 1840AT_SETUP([ofproto - asynchronous message control (OpenFlow 1.0)])
80d5aefd
BP
1841OVS_VSWITCHD_START
1842AT_CHECK([ovs-ofctl -P openflow10 monitor br0 --detach --no-chdir --pidfile])
1843check_async () {
1844 printf '\n\n--- check_async %d ---\n\n\n' $1
1845 shift
1846
6fc67c4f 1847 ovs-appctl -t ovs-ofctl ofctl/barrier
80d5aefd
BP
1848 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
1849 : > expout
1850
a7349929 1851 # OFPT_PACKET_IN, OFPR_ACTION (controller_id=0)
7f05e7ab 1852 ovs-ofctl -v packet-out br0 controller controller '0001020304050010203040501234'
80d5aefd 1853 if test X"$1" = X"OFPR_ACTION"; then shift;
7f05e7ab 1854 echo >>expout "OFPT_PACKET_IN: total_len=14 in_port=CONTROLLER (via action) data_len=14 (unbuffered)
78c9486d 1855in_port=0,vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1234"
80d5aefd
BP
1856 fi
1857
a7349929 1858 # OFPT_PACKET_IN, OFPR_NO_MATCH (controller_id=123)
7f05e7ab 1859 ovs-ofctl -v packet-out br0 controller 'controller(reason=no_match,id=123)' '0001020304050010203040501234'
a7349929 1860 if test X"$1" = X"OFPR_NO_MATCH"; then shift;
7f05e7ab 1861 echo >>expout "OFPT_PACKET_IN: total_len=14 in_port=CONTROLLER (via no_match) data_len=14 (unbuffered)
78c9486d 1862in_port=0,vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1234"
a7349929
BP
1863 fi
1864
1865 # OFPT_PACKET_IN, OFPR_INVALID_TTL (controller_id=0)
fa8d9001 1866 ovs-ofctl packet-out br0 controller dec_ttl '002583dfb4000026b98cb0f908004500003eb7e200000011339bac11370dac100002d7730035002b8f6d86fb0100000100000000000006626c702d7873066e696369726103636f6d00000f00'
80d5aefd 1867 if test X"$1" = X"OFPR_INVALID_TTL"; then shift;
7f05e7ab 1868 echo >>expout "OFPT_PACKET_IN: total_len=76 in_port=CONTROLLER (via invalid_ttl) data_len=76 (unbuffered)
78c9486d 1869udp,in_port=0,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
1870 fi
1871
1872 # OFPT_PORT_STATUS, OFPPR_ADD
e1b1d06a 1873 ovs-vsctl add-port br0 test -- set Interface test type=dummy ofport_request=1
80d5aefd
BP
1874 if test X"$1" = X"OFPPR_ADD"; then shift;
1875 echo >>expout "OFPT_PORT_STATUS: ADD: 1(test): addr:aa:55:aa:55:00:0x
1876 config: PORT_DOWN
9e1fd49b 1877 state: LINK_DOWN
d02a5f8e 1878 speed: 0 Mbps now, 0 Mbps max"
80d5aefd
BP
1879 fi
1880
1881 # OFPT_PORT_STATUS, OFPPR_DELETE
1882 ovs-vsctl del-port br0 test
1883 if test X"$1" = X"OFPPR_DELETE"; then shift;
1884 echo >>expout "OFPT_PORT_STATUS: DEL: 1(test): addr:aa:55:aa:55:00:0x
1885 config: PORT_DOWN
9e1fd49b 1886 state: LINK_DOWN
d02a5f8e 1887 speed: 0 Mbps now, 0 Mbps max"
80d5aefd
BP
1888 fi
1889
1890 # OFPT_FLOW_REMOVED, OFPRR_DELETE
1891 ovs-ofctl add-flow br0 send_flow_rem,actions=drop
1892 ovs-ofctl --strict del-flows br0 ''
1893 if test X"$1" = X"OFPRR_DELETE"; then shift;
1894 echo >>expout "OFPT_FLOW_REMOVED: reason=delete"
1895 fi
1896 AT_FAIL_IF([test X"$1" != X])
1897
1898 ovs-appctl -t ovs-ofctl ofctl/barrier
fd0aa9ea 1899 echo >>expout "OFPT_BARRIER_REPLY:"
80d5aefd
BP
1900
1901 AT_CHECK(
1902 [[sed '
1903s/ (xid=0x[0-9a-fA-F]*)//
1904s/ *duration.*//
1905s/00:0.$/00:0x/' < monitor.log]],
1906 [0], [expout])
1907}
1908
1909# It's a service connection so initially there should be no async messages.
1910check_async 1
1911
99811d07 1912# Set miss_send_len to 128, turning on packet-ins for our service connection.
80d5aefd
BP
1913ovs-appctl -t ovs-ofctl ofctl/send 0109000c0123456700000080
1914check_async 2 OFPR_ACTION OFPPR_ADD OFPPR_DELETE OFPRR_DELETE
1915
1916# Set miss_send_len to 128 and enable invalid_ttl.
1917ovs-appctl -t ovs-ofctl ofctl/send 0109000c0123456700040080
1918check_async 3 OFPR_ACTION OFPR_INVALID_TTL OFPPR_ADD OFPPR_DELETE OFPRR_DELETE
1919
1920# Become slave, which should disable everything except port status.
1921ovs-appctl -t ovs-ofctl ofctl/send 0104001400000002000023200000000a00000002
1922check_async 4 OFPPR_ADD OFPPR_DELETE
1923
1924# Use NXT_SET_ASYNC_CONFIG to enable a patchwork of asynchronous messages.
1925ovs-appctl -t ovs-ofctl ofctl/send 01040028000000020000232000000013000000020000000500000005000000020000000200000005
1926check_async 5 OFPR_INVALID_TTL OFPPR_DELETE OFPRR_DELETE
1927
a7349929
BP
1928# Set controller ID 123.
1929ovs-appctl -t ovs-ofctl ofctl/send 01040018000000030000232000000014000000000000007b
1930check_async 6 OFPR_NO_MATCH OFPPR_DELETE OFPRR_DELETE
1931
1932# Restore controller ID 0.
1933ovs-appctl -t ovs-ofctl ofctl/send 010400180000000300002320000000140000000000000000
1934
80d5aefd
BP
1935# Become master.
1936ovs-appctl -t ovs-ofctl ofctl/send 0104001400000002000023200000000a00000001
a7349929 1937check_async 7 OFPR_ACTION OFPPR_ADD
80d5aefd
BP
1938
1939ovs-appctl -t ovs-ofctl exit
94c33672 1940OVS_VSWITCHD_STOP
80d5aefd 1941AT_CLEANUP
751c7785 1942
9dcd1c00
SH
1943AT_SETUP([ofproto - asynchronous message control (OpenFlow 1.2)])
1944OVS_VSWITCHD_START
1945AT_CHECK([ovs-ofctl -O OpenFlow12 monitor br0 --detach --no-chdir --pidfile])
1946check_async () {
1947 printf '\n\n--- check_async %d ---\n\n\n' $1
1948 INDEX=$1
1949 shift
1950
1951 ovs-appctl -t ovs-ofctl ofctl/barrier
1952 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
1953 : > expout
1954
1955 # OFPT_PACKET_IN, OFPR_ACTION (controller_id=0)
1956 ovs-ofctl -O OpenFlow12 -v packet-out br0 none controller '0001020304050010203040501234'
1957 if test X"$1" = X"OFPR_ACTION"; then shift;
1958 echo >>expout "OFPT_PACKET_IN (OF1.2): total_len=14 in_port=ANY (via action) data_len=14 (unbuffered)
78c9486d 1959in_port=0,vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1234"
9dcd1c00
SH
1960 fi
1961
1962 # OFPT_PACKET_IN, OFPR_NO_MATCH (controller_id=123)
1963 ovs-ofctl -O OpenFlow12 -v packet-out br0 none 'controller(reason=no_match,id=123)' '0001020304050010203040501234'
1964 if test X"$1" = X"OFPR_NO_MATCH"; then shift;
1965 echo >>expout "OFPT_PACKET_IN (OF1.2): total_len=14 in_port=ANY (via no_match) data_len=14 (unbuffered)
78c9486d 1966in_port=0,vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1234"
9dcd1c00
SH
1967 fi
1968
1969 # OFPT_PACKET_IN, OFPR_INVALID_TTL (controller_id=0)
fa8d9001 1970 ovs-ofctl -O OpenFlow12 packet-out br0 none dec_ttl '002583dfb4000026b98cb0f908004500003eb7e200000011339bac11370dac100002d7730035002b8f6d86fb0100000100000000000006626c702d7873066e696369726103636f6d00000f00'
9dcd1c00
SH
1971 if test X"$1" = X"OFPR_INVALID_TTL"; then shift;
1972 echo >>expout "OFPT_PACKET_IN (OF1.2): total_len=76 in_port=ANY (via invalid_ttl) data_len=76 (unbuffered)
78c9486d 1973udp,in_port=0,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
1974 fi
1975
1976 # OFPT_PORT_STATUS, OFPPR_ADD
1977 ovs-vsctl add-port br0 test -- set Interface test type=dummy
1978 if test X"$1" = X"OFPPR_ADD"; then shift;
1979 echo >>expout "OFPT_PORT_STATUS (OF1.2): ADD: ${INDEX}(test): addr:aa:55:aa:55:00:0x
1980 config: PORT_DOWN
1981 state: LINK_DOWN
1982 speed: 0 Mbps now, 0 Mbps max"
1983 fi
1984
1985 # OFPT_PORT_STATUS, OFPPR_DELETE
1986 ovs-vsctl del-port br0 test
1987 if test X"$1" = X"OFPPR_DELETE"; then shift;
1988 echo >>expout "OFPT_PORT_STATUS (OF1.2): DEL: ${INDEX}(test): addr:aa:55:aa:55:00:0x
1989 config: PORT_DOWN
1990 state: LINK_DOWN
1991 speed: 0 Mbps now, 0 Mbps max"
1992 fi
1993
1994 # OFPT_FLOW_REMOVED, OFPRR_DELETE
1995 ovs-ofctl -O OpenFlow12 add-flow br0 send_flow_rem,actions=drop
1996 ovs-ofctl -O OpenFlow12 --strict del-flows br0 ''
1997 if test X"$1" = X"OFPRR_DELETE"; then shift;
1998 echo >>expout "OFPT_FLOW_REMOVED (OF1.2): reason=delete table_id=0"
1999 fi
2000 AT_FAIL_IF([test X"$1" != X])
2001
2002 ovs-appctl -t ovs-ofctl ofctl/barrier
2003 echo >>expout "OFPT_BARRIER_REPLY (OF1.2):"
2004
2005 AT_CHECK(
2006 [[sed '
2007s/ (xid=0x[0-9a-fA-F]*)//
2008s/ *duration.*//
2009s/00:0.$/00:0x/' < monitor.log]],
2010 [0], [expout])
2011}
2012
2013# It's a service connection so initially there should be no async messages.
2014check_async 1
2015
2016# Set miss_send_len to 128, turning on packet-ins for our service connection.
2017ovs-appctl -t ovs-ofctl ofctl/send 0309000c0123456700000080
2018check_async 2 OFPR_ACTION OFPPR_ADD OFPPR_DELETE OFPRR_DELETE
2019
2020# Set miss_send_len to 128 and enable invalid_ttl.
2021ovs-appctl -t ovs-ofctl ofctl/send 0309000c0123456700040080
2022check_async 3 OFPR_ACTION OFPR_INVALID_TTL OFPPR_ADD OFPPR_DELETE OFPRR_DELETE
2023
6ea4776b
JR
2024# Become slave (OF 1.2), which should disable everything except port status.
2025ovs-appctl -t ovs-ofctl ofctl/send 031800180000000200000003000000000000000000000001
9dcd1c00
SH
2026check_async 4 OFPPR_ADD OFPPR_DELETE
2027
2028# Use NXT_SET_ASYNC_CONFIG to enable a patchwork of asynchronous messages.
2029ovs-appctl -t ovs-ofctl ofctl/send 03040028000000020000232000000013000000020000000500000005000000020000000200000005
2030check_async 5 OFPR_INVALID_TTL OFPPR_DELETE OFPRR_DELETE
2031
2032# Set controller ID 123.
2033ovs-appctl -t ovs-ofctl ofctl/send 03040018000000030000232000000014000000000000007b
2034check_async 6 OFPR_NO_MATCH OFPPR_DELETE OFPRR_DELETE
2035
2036# Restore controller ID 0.
2037ovs-appctl -t ovs-ofctl ofctl/send 030400180000000300002320000000140000000000000000
2038
6ea4776b
JR
2039# Become master (OF 1.2).
2040ovs-appctl -t ovs-ofctl ofctl/send 031800180000000400000002000000000000000000000002
9dcd1c00
SH
2041check_async 7 OFPR_ACTION OFPPR_ADD
2042
2043ovs-appctl -t ovs-ofctl exit
2044OVS_VSWITCHD_STOP
2045AT_CLEANUP
2046
b21eb1da
JR
2047AT_SETUP([ofproto - asynchronous message control (OpenFlow 1.3)])
2048OVS_VSWITCHD_START
2049AT_CHECK([ovs-ofctl -O OpenFlow13 monitor br0 --detach --no-chdir --pidfile])
2050check_async () {
2051 printf '\n\n--- check_async %d ---\n\n\n' $1
2052 INDEX=$1
2053 shift
2054
2055 ovs-appctl -t ovs-ofctl ofctl/barrier
2056 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
2057 : > expout
2058
2059 # OFPT_PACKET_IN, OFPR_ACTION (controller_id=0)
2060 ovs-ofctl -O OpenFlow13 -v packet-out br0 none controller '0001020304050010203040501234'
2061 if test X"$1" = X"OFPR_ACTION"; then shift;
2062 echo >>expout "OFPT_PACKET_IN (OF1.3): total_len=14 in_port=ANY (via action) data_len=14 (unbuffered)
78c9486d 2063in_port=0,vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1234"
b21eb1da
JR
2064 fi
2065
2066 # OFPT_PACKET_IN, OFPR_NO_MATCH (controller_id=123)
2067 ovs-ofctl -O OpenFlow13 -v packet-out br0 none 'controller(reason=no_match,id=123)' '0001020304050010203040501234'
2068 if test X"$1" = X"OFPR_NO_MATCH"; then shift;
2069 echo >>expout "OFPT_PACKET_IN (OF1.3): total_len=14 in_port=ANY (via no_match) data_len=14 (unbuffered)
78c9486d 2070in_port=0,vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1234"
b21eb1da
JR
2071 fi
2072
2073 # OFPT_PACKET_IN, OFPR_INVALID_TTL (controller_id=0)
fa8d9001 2074 ovs-ofctl -O OpenFlow13 packet-out br0 none dec_ttl '002583dfb4000026b98cb0f908004500003eb7e200000011339bac11370dac100002d7730035002b8f6d86fb0100000100000000000006626c702d7873066e696369726103636f6d00000f00'
b21eb1da
JR
2075 if test X"$1" = X"OFPR_INVALID_TTL"; then shift;
2076 echo >>expout "OFPT_PACKET_IN (OF1.3): total_len=76 in_port=ANY (via invalid_ttl) data_len=76 (unbuffered)
78c9486d 2077udp,in_port=0,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
2078 fi
2079
2080 # OFPT_PORT_STATUS, OFPPR_ADD
2081 ovs-vsctl add-port br0 test -- set Interface test type=dummy
2082 if test X"$1" = X"OFPPR_ADD"; then shift;
2083 echo >>expout "OFPT_PORT_STATUS (OF1.3): ADD: ${INDEX}(test): addr:aa:55:aa:55:00:0x
2084 config: PORT_DOWN
2085 state: LINK_DOWN
2086 speed: 0 Mbps now, 0 Mbps max"
2087 fi
2088
2089 # OFPT_PORT_STATUS, OFPPR_DELETE
2090 ovs-vsctl del-port br0 test
2091 if test X"$1" = X"OFPPR_DELETE"; then shift;
2092 echo >>expout "OFPT_PORT_STATUS (OF1.3): DEL: ${INDEX}(test): addr:aa:55:aa:55:00:0x
2093 config: PORT_DOWN
2094 state: LINK_DOWN
2095 speed: 0 Mbps now, 0 Mbps max"
2096 fi
2097
2098 # OFPT_FLOW_REMOVED, OFPRR_DELETE
2099 ovs-ofctl -O OpenFlow13 add-flow br0 send_flow_rem,actions=drop
2100 ovs-ofctl -O OpenFlow13 --strict del-flows br0 ''
2101 if test X"$1" = X"OFPRR_DELETE"; then shift;
2102 echo >>expout "OFPT_FLOW_REMOVED (OF1.3): reason=delete table_id=0"
2103 fi
cc40d06b
SH
2104
2105 # OFPT_FLOW_REMOVED, OFPRR_GROUP_DELETE
2106 ovs-ofctl -O OpenFlow13 add-group br0 group_id=1234,type=all,bucket=output:10
2107 ovs-ofctl -O OpenFlow13 add-flow br0 send_flow_rem,actions=group:1234
2108 ovs-ofctl -O OpenFlow13 --strict del-groups br0 group_id=1234
2109 if test X"$1" = X"OFPRR_DELETE"; then shift;
2110 echo >>expout "OFPT_FLOW_REMOVED (OF1.3): reason=gropu_delete table_id=0"
2111 fi
2112
b21eb1da
JR
2113 AT_FAIL_IF([test X"$1" != X])
2114
2115 ovs-appctl -t ovs-ofctl ofctl/barrier
2116 echo >>expout "OFPT_BARRIER_REPLY (OF1.3):"
2117
2118 AT_CHECK(
2119 [[sed '
2120s/ (xid=0x[0-9a-fA-F]*)//
2121s/ *duration.*//
2122s/00:0.$/00:0x/' < monitor.log]],
2123 [0], [expout])
2124}
2125
2126# It's a service connection so initially there should be no async messages.
2127check_async 1
2128
2129# Set miss_send_len to 128, turning on packet-ins for our service connection.
2130ovs-appctl -t ovs-ofctl ofctl/send 0409000c0123456700000080
2131check_async 2 OFPR_ACTION OFPPR_ADD OFPPR_DELETE OFPRR_DELETE
2132
2133# Become slave (OF 1.3), which should disable everything except port status.
2134ovs-appctl -t ovs-ofctl ofctl/send 041800180000000200000003000000000000000000000001
2135check_async 3 OFPPR_ADD OFPPR_DELETE
2136
2137# Use OF 1.3 OFPT_SET_ASYNC to enable a patchwork of asynchronous messages.
2138ovs-appctl -t ovs-ofctl ofctl/send 041c002000000002000000020000000500000005000000020000000200000005
2139check_async 4 OFPR_INVALID_TTL OFPPR_DELETE OFPRR_DELETE
2140
2141# Set controller ID 123.
2142ovs-appctl -t ovs-ofctl ofctl/send 04040018000000030000232000000014000000000000007b
2143check_async 5 OFPR_NO_MATCH OFPPR_DELETE OFPRR_DELETE
2144
2145# Restore controller ID 0.
2146ovs-appctl -t ovs-ofctl ofctl/send 040400180000000300002320000000140000000000000000
2147
2148# Become master (OF 1.3).
2149ovs-appctl -t ovs-ofctl ofctl/send 041800180000000400000002000000000000000000000002
2150check_async 6 OFPR_ACTION OFPPR_ADD
2151
2152ovs-appctl -t ovs-ofctl exit
2153OVS_VSWITCHD_STOP
2154AT_CLEANUP
2155
ebeae5db
JT
2156AT_SETUP([ofproto - asynchronous message control (OpenFlow 1.5)])
2157OVS_VSWITCHD_START
2158AT_CHECK([ovs-ofctl -O OpenFlow15 monitor br0 --detach --no-chdir --pidfile])
2159check_async () {
2160 printf '\n\n--- check_async %d ---\n\n\n' $1
2161 INDEX=$1
2162 shift
2163
2164 ovs-appctl -t ovs-ofctl ofctl/barrier
2165 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
2166 : > expout
2167
2168 # Other tests are not working with OF 1.5, and message
2169 # format may change, so leave them out.
2170
2171 # OFPT_PORT_STATUS, OFPPR_ADD
2172 ovs-vsctl add-port br0 test -- set Interface test type=dummy
2173 if test X"$1" = X"OFPPR_ADD"; then shift;
2174 echo >>expout "OFPT_PORT_STATUS (OF1.5): ADD: ${INDEX}(test): addr:aa:55:aa:55:00:0x
2175 config: PORT_DOWN
2176 state: LINK_DOWN
2177 speed: 0 Mbps now, 0 Mbps max"
2178 fi
2179
2180 # OFPT_PORT_STATUS, OFPPR_MODIFY
2181 ovs-ofctl -O OpenFlow15 -vwarn mod-port br0 test up
2182 if test X"$1" = X"OFPPR_MODIFY"; then shift;
2183 echo >>expout "OFPT_PORT_STATUS (OF1.5): MOD: ${INDEX}(test): addr:aa:55:aa:55:00:0x
2184 config: 0
2185 state: LINK_DOWN
2186 speed: 0 Mbps now, 0 Mbps max
2187OFPT_PORT_STATUS (OF1.5): MOD: 2(test): addr:aa:55:aa:55:00:0x
2188 config: 0
2189 state: 0
2190 speed: 0 Mbps now, 0 Mbps max"
2191 fi
2192
2193 # OFPT_PORT_STATUS, OFPPR_DELETE
2194 ovs-vsctl del-port br0 test
2195 if test X"$1" = X"OFPPR_DELETE"; then shift;
2196 echo >>expout "OFPT_PORT_STATUS (OF1.5): DEL: ${INDEX}(test): addr:aa:55:aa:55:00:0x
2197 config: 0
2198 state: 0
2199 speed: 0 Mbps now, 0 Mbps max"
2200 fi
2201
2202 AT_FAIL_IF([test X"$1" != X])
2203
2204 ovs-appctl -t ovs-ofctl ofctl/barrier
2205 echo >>expout "OFPT_BARRIER_REPLY (OF1.5):"
2206
2207 AT_CHECK(
2208 [[sed '
2209s/ (xid=0x[0-9a-fA-F]*)//
2210s/ *duration.*//
2211s/00:0.$/00:0x/' < monitor.log]],
2212 [0], [expout])
2213}
2214
2215# It's a service connection so initially there should be no async messages.
2216check_async 1
2217
2218# If we don't set this, async messages are not received.
2219# Set miss_send_len to 128, turning on packet-ins for our service connection.
2220ovs-appctl -t ovs-ofctl ofctl/send 0609000c0123456700000080
2221check_async 2 OFPPR_ADD OFPPR_MODIFY OFPPR_DELETE
2222
2223# Set-async has changed in OF 1.4 and is not yet implemented.
2224
2225ovs-appctl -t ovs-ofctl exit
2226OVS_VSWITCHD_STOP
2227AT_CLEANUP
2228
6ea4776b
JR
2229dnl This test checks that the role request/response messaging works
2230dnl and that generation_id is handled properly.
2231AT_SETUP([ofproto - controller role (OpenFlow 1.2)])
2232OVS_VSWITCHD_START
6751a4b4
BP
2233ON_EXIT([kill `cat c1.pid c2.pid`])
2234
2235# Start two ovs-ofctl controller processes.
2236AT_CAPTURE_FILE([monitor1.log])
2237AT_CAPTURE_FILE([expout1])
2238AT_CAPTURE_FILE([experr1])
2239AT_CAPTURE_FILE([monitor2.log])
2240AT_CAPTURE_FILE([expout2])
2241AT_CAPTURE_FILE([experr2])
2242for i in 1 2; do
2243 AT_CHECK([ovs-ofctl -O OpenFlow12 monitor br0 --detach --no-chdir --pidfile=`pwd`/c$i.pid --unixctl=`pwd`/c$i])
2244 ovs-appctl -t `pwd`/c$i ofctl/barrier
2245 ovs-appctl -t `pwd`/c$i ofctl/set-output-file monitor$i.log
2246 : > expout$i
2247 : > experr$i
2248
2249 # find out current role
2250 ovs-appctl -t `pwd`/c$i ofctl/send 031800180000000200000000000000000000000000000000
2251 echo >>experr$i "send: OFPT_ROLE_REQUEST (OF1.2): role=nochange"
2252 echo >>expout$i "OFPT_ROLE_REPLY (OF1.2): role=equal"
2253done
6ea4776b 2254
6751a4b4
BP
2255# controller 1: Become slave (generation_id is initially undefined, so
2256# 2^63+2 should not be stale)
2257ovs-appctl -t `pwd`/c1 ofctl/send 031800180000000300000003000000008000000000000002
2258echo >>experr1 "send: OFPT_ROLE_REQUEST (OF1.2): role=slave generation_id=9223372036854775810"
2259echo >>expout1 "OFPT_ROLE_REPLY (OF1.2): role=slave generation_id=9223372036854775810"
2260
2261# controller 2: Become master.
2262ovs-appctl -t `pwd`/c2 ofctl/send 031800180000000300000002000000008000000000000003
2263echo >>experr2 "send: OFPT_ROLE_REQUEST (OF1.2): role=master generation_id=9223372036854775811"
2264echo >>expout2 "OFPT_ROLE_REPLY (OF1.2): role=master generation_id=9223372036854775811"
2265
2266# controller 1: Try to become the master using a stale generation ID
2267ovs-appctl -t `pwd`/c1 ofctl/send 031800180000000400000002000000000000000000000003
2268echo >>experr1 "send: OFPT_ROLE_REQUEST (OF1.2): role=master generation_id=3"
2269echo >>expout1 "OFPT_ERROR (OF1.2): OFPRRFC_STALE"
2270echo >>expout1 "OFPT_ROLE_REQUEST (OF1.2): role=master generation_id=3"
2271
2272# controller 1: Become master using a valid generation ID
2273ovs-appctl -t `pwd`/c1 ofctl/send 031800180000000500000002000000000000000000000001
2274echo >>experr1 "send: OFPT_ROLE_REQUEST (OF1.2): role=master generation_id=1"
2275echo >>expout1 "OFPT_ROLE_REPLY (OF1.2): role=master generation_id=1"
2276
2277for i in 1 2; do
2278 ovs-appctl -t `pwd`/c$i ofctl/barrier
2279 echo >>expout$i "OFPT_BARRIER_REPLY (OF1.2):"
2280done
6ea4776b 2281
6751a4b4
BP
2282# Check output.
2283for i in 1 2; do
2284 cp expout$i expout
2285 AT_CHECK([grep -v '^send:' monitor$i.log | STRIP_XIDS], [0], [expout])
2286 cp experr$i expout
2287 AT_CHECK([grep '^send:' monitor$i.log | STRIP_XIDS], [0], [expout])
2288done
2289OVS_VSWITCHD_STOP
2290AT_CLEANUP
6ea4776b 2291
6751a4b4
BP
2292dnl This test checks that the role request/response messaging works,
2293dnl that generation_id is handled properly, and that role status update
2294dnl messages are sent when a controller's role gets changed from master
2295dnl to slave.
2296AT_SETUP([ofproto - controller role (OpenFlow 1.4)])
2297OVS_VSWITCHD_START
2298ON_EXIT([kill `cat c1.pid c2.pid`])
2299
2300# Start two ovs-ofctl controller processes.
2301AT_CAPTURE_FILE([monitor1.log])
2302AT_CAPTURE_FILE([expout1])
2303AT_CAPTURE_FILE([experr1])
2304AT_CAPTURE_FILE([monitor2.log])
2305AT_CAPTURE_FILE([expout2])
2306AT_CAPTURE_FILE([experr2])
2307for i in 1 2; do
2308 AT_CHECK([ovs-ofctl -O OpenFlow14 monitor br0 --detach --no-chdir --pidfile=`pwd`/c$i.pid --unixctl=`pwd`/c$i])
2309 ovs-appctl -t `pwd`/c$i ofctl/barrier
2310 ovs-appctl -t `pwd`/c$i ofctl/set-output-file monitor$i.log
2311 : > expout$i
2312 : > experr$i
2313
2314 # find out current role
2315 ovs-appctl -t `pwd`/c$i ofctl/send 051800180000000200000000000000000000000000000000
2316 echo >>experr$i "send: OFPT_ROLE_REQUEST (OF1.4): role=nochange"
2317 echo >>expout$i "OFPT_ROLE_REPLY (OF1.4): role=equal"
2318done
6ea4776b 2319
6751a4b4
BP
2320# controller 1: Become slave (generation_id is initially undefined, so
2321# 2^63+2 should not be stale)
2322ovs-appctl -t `pwd`/c1 ofctl/send 051800180000000300000003000000008000000000000002
2323echo >>experr1 "send: OFPT_ROLE_REQUEST (OF1.4): role=slave generation_id=9223372036854775810"
2324echo >>expout1 "OFPT_ROLE_REPLY (OF1.4): role=slave generation_id=9223372036854775810"
2325
2326# controller 2: Become master.
2327ovs-appctl -t `pwd`/c2 ofctl/send 051800180000000300000002000000008000000000000003
2328echo >>experr2 "send: OFPT_ROLE_REQUEST (OF1.4): role=master generation_id=9223372036854775811"
2329echo >>expout2 "OFPT_ROLE_REPLY (OF1.4): role=master generation_id=9223372036854775811"
2330
2331# controller 1: Try to become the master using a stale generation ID
2332ovs-appctl -t `pwd`/c1 ofctl/send 051800180000000400000002000000000000000000000003
2333echo >>experr1 "send: OFPT_ROLE_REQUEST (OF1.4): role=master generation_id=3"
2334echo >>expout1 "OFPT_ERROR (OF1.4): OFPRRFC_STALE"
2335echo >>expout1 "OFPT_ROLE_REQUEST (OF1.4): role=master generation_id=3"
2336
2337# controller 1: Become master using a valid generation ID
2338ovs-appctl -t `pwd`/c1 ofctl/send 051800180000000500000002000000000000000000000001
2339echo >>experr1 "send: OFPT_ROLE_REQUEST (OF1.4): role=master generation_id=1"
2340echo >>expout1 "OFPT_ROLE_REPLY (OF1.4): role=master generation_id=1"
2341echo >>expout2 "OFPT_ROLE_STATUS (OF1.4): role=slave generation_id=1 reason=master_request"
2342
2343for i in 1 2; do
2344 ovs-appctl -t `pwd`/c$i ofctl/barrier
2345 echo >>expout$i "OFPT_BARRIER_REPLY (OF1.4):"
2346done
6ea4776b 2347
6751a4b4
BP
2348# Check output.
2349for i in 1 2; do
2350 cp expout$i expout
2351 AT_CHECK([grep -v '^send:' monitor$i.log | STRIP_XIDS], [0], [expout])
2352 cp experr$i expout
2353 AT_CHECK([grep '^send:' monitor$i.log | STRIP_XIDS], [0], [expout])
2354done
6ea4776b
JR
2355OVS_VSWITCHD_STOP
2356AT_CLEANUP
2357
751c7785
BP
2358dnl This test checks that OFPT_PACKET_OUT accepts both OFPP_NONE (as
2359dnl specified by OpenFlow 1.0) and OFPP_CONTROLLER (used by some
2360dnl controllers despite the spec) as meaning a packet that was generated
2361dnl by the controller.
9dcd1c00 2362AT_SETUP([ofproto - packet-out from controller (OpenFlow 1.0)])
751c7785 2363OVS_VSWITCHD_START
586ddea5 2364ADD_OF_PORTS([br0], [1])
751c7785
BP
2365
2366# Start a monitor listening for packet-ins.
2367AT_CHECK([ovs-ofctl -P openflow10 monitor br0 --detach --no-chdir --pidfile])
2368ovs-appctl -t ovs-ofctl ofctl/send 0109000c0123456700000080
2369ovs-appctl -t ovs-ofctl ofctl/barrier
2370ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
2371AT_CAPTURE_FILE([monitor.log])
2372
2373# Send some packet-outs with OFPP_NONE and OFPP_CONTROLLER (65533) as in_port.
586ddea5
BP
2374AT_CHECK([ovs-ofctl packet-out br0 none controller,1 '0001020304050010203040501234'])
2375AT_CHECK([ovs-ofctl packet-out br0 controller controller,1 '0001020304050010203040505678'])
751c7785
BP
2376
2377# Stop the monitor and check its output.
2378ovs-appctl -t ovs-ofctl ofctl/barrier
2379ovs-appctl -t ovs-ofctl exit
2380
586ddea5
BP
2381ovs-ofctl dump-ports br0
2382
751c7785 2383AT_CHECK([sed 's/ (xid=0x[[0-9a-fA-F]]*)//' monitor.log], [0], [dnl
7f05e7ab 2384OFPT_PACKET_IN: total_len=14 in_port=ANY (via action) data_len=14 (unbuffered)
78c9486d 2385in_port=0,vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1234
751c7785 2386OFPT_PACKET_IN: total_len=14 in_port=CONTROLLER (via action) data_len=14 (unbuffered)
78c9486d 2387in_port=0,vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x5678
969fc56c
JS
2388OFPT_BARRIER_REPLY:
2389])
2390
2391OVS_VSWITCHD_STOP
2392AT_CLEANUP
2393
9dcd1c00
SH
2394dnl This test checks that OFPT_PACKET_OUT accepts both OFPP_NONE (as
2395dnl specified by OpenFlow 1.2) and OFPP_CONTROLLER (used by some
2396dnl controllers despite the spec) as meaning a packet that was generated
2397dnl by the controller.
2398AT_SETUP([ofproto - packet-out from controller (OpenFlow 1.2)])
2399OVS_VSWITCHD_START
2400
2401# Start a monitor listening for packet-ins.
2402AT_CHECK([ovs-ofctl -O OpenFlow12 monitor br0 --detach --no-chdir --pidfile])
2403ovs-appctl -t ovs-ofctl ofctl/send 0309000c0123456700000080
2404ovs-appctl -t ovs-ofctl ofctl/barrier
2405ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
2406AT_CAPTURE_FILE([monitor.log])
2407
2408# Send some packet-outs with OFPP_NONE and OFPP_CONTROLLER (65533) as in_port.
2409AT_CHECK([ovs-ofctl -O OpenFlow12 packet-out br0 none controller '0001020304050010203040501234'])
2410AT_CHECK([ovs-ofctl -O OpenFlow12 packet-out br0 4294967293 controller '0001020304050010203040505678'])
2411
2412# Stop the monitor and check its output.
2413ovs-appctl -t ovs-ofctl ofctl/barrier
2414ovs-appctl -t ovs-ofctl exit
2415
2416AT_CHECK([sed 's/ (xid=0x[[0-9a-fA-F]]*)//' monitor.log], [0], [dnl
2417OFPT_PACKET_IN (OF1.2): total_len=14 in_port=ANY (via action) data_len=14 (unbuffered)
78c9486d 2418in_port=0,vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1234
9dcd1c00 2419OFPT_PACKET_IN (OF1.2): total_len=14 in_port=CONTROLLER (via action) data_len=14 (unbuffered)
78c9486d 2420in_port=0,vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x5678
9dcd1c00
SH
2421OFPT_BARRIER_REPLY (OF1.2):
2422])
2423
2424OVS_VSWITCHD_STOP
2425AT_CLEANUP
2426
4d197ebb
BP
2427dnl This test checks that OFPT_PACKET_OUT accepts both OFPP_NONE (as
2428dnl specified by OpenFlow 1.1) and OFPP_CONTROLLER (used by some
2429dnl controllers despite the spec) as meaning a packet that was generated
2430dnl by the controller.
2431AT_SETUP([ofproto - packet-out from controller (OpenFlow 1.1)])
2432OVS_VSWITCHD_START
2433
2434# Start a monitor listening for packet-ins.
2435AT_CHECK([ovs-ofctl -O OpenFlow11 monitor br0 --detach --no-chdir --pidfile])
2436ovs-appctl -t ovs-ofctl ofctl/send 0209000c0123456700000080
2437ovs-appctl -t ovs-ofctl ofctl/barrier
2438ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
2439AT_CAPTURE_FILE([monitor.log])
2440
2441# Send some packet-outs with OFPP_NONE and OFPP_CONTROLLER (65533) as in_port.
2442AT_CHECK([ovs-ofctl -O OpenFlow11 packet-out br0 none controller '0001020304050010203040501234'])
2443AT_CHECK([ovs-ofctl -O OpenFlow11 packet-out br0 4294967293 controller '0001020304050010203040505678'])
2444
2445# Stop the monitor and check its output.
2446ovs-appctl -t ovs-ofctl ofctl/barrier
2447ovs-appctl -t ovs-ofctl exit
2448
2449AT_CHECK([sed 's/ (xid=0x[[0-9a-fA-F]]*)//' monitor.log], [0], [dnl
2450OFPT_PACKET_IN (OF1.1): total_len=14 in_port=ANY (via action) data_len=14 (unbuffered)
78c9486d 2451in_port=0,vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1234
4d197ebb 2452OFPT_PACKET_IN (OF1.1): total_len=14 in_port=CONTROLLER (via action) data_len=14 (unbuffered)
78c9486d 2453in_port=0,vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x5678
4d197ebb
BP
2454OFPT_BARRIER_REPLY (OF1.1):
2455])
2456
2457OVS_VSWITCHD_STOP
2458AT_CLEANUP
2459
969fc56c
JS
2460dnl This test checks that metadata is encoded in packet_in structures,
2461dnl supported by NXAST.
2462AT_SETUP([ofproto - packet-out with metadata (NXM)])
2463OVS_VSWITCHD_START
2464
2465# Start a monitor listening for packet-ins.
2466AT_CHECK([ovs-ofctl -P nxm monitor br0 --detach --no-chdir --pidfile])
2467ovs-appctl -t ovs-ofctl ofctl/send 0109000c0123456700000080
2468ovs-appctl -t ovs-ofctl ofctl/barrier
2469ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
2470AT_CAPTURE_FILE([monitor.log])
2471
2472# Send a packet-out with a load action to set some metadata, and forward to controller
ac923e91 2473AT_CHECK([ovs-ofctl packet-out br0 controller 'load(0xfafafafa5a5a5a5a->OXM_OF_METADATA[[0..63]]), load(0xaa->NXM_NX_PKT_MARK[[]]), controller' '0001020304050010203040501234'])
969fc56c
JS
2474
2475# Stop the monitor and check its output.
2476ovs-appctl -t ovs-ofctl ofctl/barrier
2477ovs-appctl -t ovs-ofctl exit
2478
2479AT_CHECK([sed 's/ (xid=0x[[0-9a-fA-F]]*)//' monitor.log], [0], [dnl
ac923e91 2480NXT_PACKET_IN: total_len=14 in_port=CONTROLLER metadata=0xfafafafa5a5a5a5a pkt_mark=0xaa (via action) data_len=14 (unbuffered)
78c9486d 2481in_port=0,vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1234
751c7785
BP
2482OFPT_BARRIER_REPLY:
2483])
2484
2485OVS_VSWITCHD_STOP
2486AT_CLEANUP
2b07c8b1 2487
9dcd1c00
SH
2488dnl This test checks that metadata is encoded in packet_in structures,
2489dnl supported by NXAST.
2490AT_SETUP([ofproto - packet-out with metadata (OpenFlow 1.2)])
2491OVS_VSWITCHD_START
2492
2493# Start a monitor listening for packet-ins.
2494AT_CHECK([ovs-ofctl -O OpenFlow12 monitor br0 --detach --no-chdir --pidfile])
2495ovs-appctl -t ovs-ofctl ofctl/send 0309000c0123456700000080
2496ovs-appctl -t ovs-ofctl ofctl/barrier
2497ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
2498AT_CAPTURE_FILE([monitor.log])
2499
277876e9
JT
2500# Send a packet-out with a set-field action to set some metadata, and forward to controller
2501AT_CHECK([ovs-ofctl -O OpenFlow12 packet-out br0 none 'set_field:0xfafafafa5a5a5a5a->metadata, controller' '0001020304050010203040501234'])
9dcd1c00
SH
2502
2503# Stop the monitor and check its output.
2504ovs-appctl -t ovs-ofctl ofctl/barrier
2505ovs-appctl -t ovs-ofctl exit
2506
2507AT_CHECK([sed 's/ (xid=0x[[0-9a-fA-F]]*)//' monitor.log], [0], [dnl
2508OFPT_PACKET_IN (OF1.2): total_len=14 in_port=ANY metadata=0xfafafafa5a5a5a5a (via action) data_len=14 (unbuffered)
78c9486d 2509in_port=0,vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1234
0ad90c84
JR
2510OFPT_BARRIER_REPLY (OF1.2):
2511])
2512
2513OVS_VSWITCHD_STOP
2514AT_CLEANUP
2515
743c159b
JT
2516dnl This test checks that metadata is encoded in packet_in structures,
2517dnl supported by NXAST.
2518AT_SETUP([ofproto - packet-out with metadata and dual set_field (OpenFlow 1.3)])
2519OVS_VSWITCHD_START
2520
2521# Start a monitor listening for packet-ins.
2522AT_CHECK([ovs-ofctl -O OpenFlow13 monitor br0 --detach --no-chdir --pidfile])
2523ovs-appctl -t ovs-ofctl ofctl/send 0409000c0123456700000080
2524ovs-appctl -t ovs-ofctl ofctl/barrier
2525ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
2526AT_CAPTURE_FILE([monitor.log])
2527
2528# Send a packet-out with a couple of set-field action to set some metadata, and forward to controller
2529AT_CHECK([ovs-ofctl -O OpenFlow13 packet-out br0 none 'set_field:0xfafafafa5a5a5a5a->metadata, set_field:0x6b->metadata, controller' '0001020304050010203040501234'])
2530
2531# Stop the monitor and check its output.
2532ovs-appctl -t ovs-ofctl ofctl/barrier
2533ovs-appctl -t ovs-ofctl exit
2534
2535AT_CHECK([sed 's/ (xid=0x[[0-9a-fA-F]]*)//' monitor.log], [0], [dnl
2536OFPT_PACKET_IN (OF1.3): total_len=14 in_port=ANY metadata=0x6b (via action) data_len=14 (unbuffered)
2537in_port=0,vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1234
2538OFPT_BARRIER_REPLY (OF1.3):
2539])
2540
2541OVS_VSWITCHD_STOP
2542AT_CLEANUP
2543
0ad90c84
JR
2544dnl This test checks that tunnel metadata is encoded in packet_in structures.
2545AT_SETUP([ofproto - packet-out with tunnel metadata (OpenFlow 1.2)])
2546OVS_VSWITCHD_START
2547
2548# Start a monitor listening for packet-ins.
2549AT_CHECK([ovs-ofctl -O OpenFlow12 monitor br0 --detach --no-chdir --pidfile])
2550ovs-appctl -t ovs-ofctl ofctl/send 0309000c0123456700000080
2551ovs-appctl -t ovs-ofctl ofctl/barrier
2552ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
2553AT_CAPTURE_FILE([monitor.log])
2554
2555# Send a packet-out with set field actions to set some tunnel metadata, and forward to controller
2556AT_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'])
2557
2558# Stop the monitor and check its output.
2559ovs-appctl -t ovs-ofctl ofctl/barrier
2560ovs-appctl -t ovs-ofctl exit
2561
2562AT_CHECK([sed 's/ (xid=0x[[0-9a-fA-F]]*)//' monitor.log], [0], [dnl
2563OFPT_PACKET_IN (OF1.2): total_len=14 in_port=ANY tun_id=0x1020304 tun_src=127.0.0.1 tun_dst=192.168.0.1 (via action) data_len=14 (unbuffered)
78c9486d 2564in_port=0,vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1234
9dcd1c00
SH
2565OFPT_BARRIER_REPLY (OF1.2):
2566])
2567
2568OVS_VSWITCHD_STOP
2569AT_CLEANUP
2570
1637ebb2
SH
2571m4_divert_push([PREPARE_TESTS])
2572# Sorts groups of lines that start with a space, without moving them
2573# past the nearest line that does not start with a space.
2574multiline_sort () {
2575 ${PERL} -e '
2576 use warnings;
2577 use strict;
2578 my @buffer = ();
2579 while (<STDIN>) {
2580 if (/^ /) {
2581 push(@buffer, $_);
2582 } else {
2583 print $_ foreach sort(@buffer);
2584 print $_;
2585 @buffer = ();
2586 }
2587 }
2588 print $_ foreach sort(@buffer);
2589'
2590}
2591m4_divert_pop([PREPARE_TESTS])
2592
2b07c8b1
BP
2593AT_SETUP([ofproto - flow monitoring])
2594AT_KEYWORDS([monitor])
2595OVS_VSWITCHD_START
2596
2597ovs-ofctl add-flow br0 in_port=0,dl_vlan=123,actions=output:1
2598
2599# Start a monitor watching the flow table and check the initial reply.
2600ovs-ofctl monitor br0 watch: --detach --no-chdir --pidfile >monitor.log 2>&1
2601AT_CAPTURE_FILE([monitor.log])
2602ovs-appctl -t ovs-ofctl ofctl/barrier
2603AT_CHECK([sed 's/ (xid=0x[[1-9a-fA-F]][[0-9a-fA-F]]*)//' monitor.log], [0],
2604 [NXST_FLOW_MONITOR reply:
2605 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=123 actions=output:1
2606OFPT_BARRIER_REPLY:
2607])
2608
2609# Add, delete, and modify some flows and check the updates.
2610ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
2611ovs-ofctl add-flow br0 in_port=0,dl_vlan=124,actions=output:2
2612ovs-ofctl add-flow br0 in_port=0,dl_vlan=123,actions=output:5
95a1c4ca
SH
2613ovs-ofctl add-flow br0 in_port=0,dl_vlan=123,dl_vlan_pcp=0,actions=output:6
2614ovs-ofctl add-flow br0 in_port=0,dl_vlan=123,dl_vlan_pcp=1,actions=output:7
2615ovs-ofctl add-flow br0 in_port=0,dl_vlan=123,actions=output:8
2616ovs-ofctl add-flow br0 in_port=0,dl_vlan=65535,dl_vlan_pcp=0,actions=output:9
2617ovs-ofctl add-flow br0 in_port=0,dl_vlan=65535,dl_vlan_pcp=1,actions=output:10
2618ovs-ofctl add-flow br0 in_port=0,dl_vlan=65535,actions=output:11
2619ovs-ofctl add-flow br0 in_port=0,dl_vlan=8191,dl_vlan_pcp=0,actions=output:12
2620ovs-ofctl add-flow br0 in_port=0,dl_vlan=8191,dl_vlan_pcp=1,actions=output:13
2621ovs-ofctl add-flow br0 in_port=0,dl_vlan=8191,actions=output:14
2622ovs-ofctl add-flow br0 in_port=0,dl_vlan=0,dl_vlan_pcp=0,actions=output:15
2623ovs-ofctl add-flow br0 in_port=0,dl_vlan=0,dl_vlan_pcp=1,actions=output:16
2624ovs-ofctl add-flow br0 in_port=0,dl_vlan=0,actions=output:17
2625ovs-ofctl add-flow br0 in_port=0,dl_vlan=0,dl_vlan_pcp=0,actions=output:18
2626ovs-ofctl add-flow br0 in_port=0,dl_vlan=0,dl_vlan_pcp=1,actions=output:19
2627ovs-ofctl add-flow br0 in_port=0,dl_vlan=0,actions=output:20
2628ovs-ofctl add-flow br0 in_port=0,dl_vlan_pcp=0,actions=output:21
2629ovs-ofctl add-flow br0 in_port=0,dl_vlan_pcp=1,actions=output:22
2630ovs-ofctl add-flow br0 in_port=0,actions=output:23
ee088a75 2631ovs-ofctl mod-flows br0 dl_vlan=123,actions=output:3
2b07c8b1
BP
2632ovs-ofctl mod-flows br0 cookie=5,dl_vlan=123,actions=output:3
2633ovs-ofctl del-flows br0 dl_vlan=123
2634ovs-ofctl del-flows br0
2635ovs-appctl -t ovs-ofctl ofctl/barrier
1637ebb2 2636AT_CHECK([sed 's/ (xid=0x[[1-9a-fA-F]][[0-9a-fA-F]]*)//' monitor.log | multiline_sort], [0],
2b07c8b1
BP
2637[NXST_FLOW_MONITOR reply (xid=0x0):
2638 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=124 actions=output:2
2639NXST_FLOW_MONITOR reply (xid=0x0):
2640 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=123 actions=output:5
95a1c4ca
SH
2641NXST_FLOW_MONITOR reply (xid=0x0):
2642 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=123,dl_vlan_pcp=0 actions=output:6
2643NXST_FLOW_MONITOR reply (xid=0x0):
2644 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=123,dl_vlan_pcp=1 actions=output:7
2645NXST_FLOW_MONITOR reply (xid=0x0):
2646 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=123 actions=output:8
2647NXST_FLOW_MONITOR reply (xid=0x0):
2648 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=0,dl_vlan_pcp=0 actions=output:9
2649NXST_FLOW_MONITOR reply (xid=0x0):
2650 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=0,dl_vlan_pcp=1 actions=output:10
2651NXST_FLOW_MONITOR reply (xid=0x0):
2652 event=ADDED table=0 cookie=0 in_port=0,vlan_tci=0x0000 actions=output:11
2653NXST_FLOW_MONITOR reply (xid=0x0):
2654 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=4095,dl_vlan_pcp=0 actions=output:12
2655NXST_FLOW_MONITOR reply (xid=0x0):
2656 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=4095,dl_vlan_pcp=1 actions=output:13
2657NXST_FLOW_MONITOR reply (xid=0x0):
2658 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=4095 actions=output:14
2659NXST_FLOW_MONITOR reply (xid=0x0):
2660 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=0,dl_vlan_pcp=0 actions=output:15
2661NXST_FLOW_MONITOR reply (xid=0x0):
2662 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=0,dl_vlan_pcp=1 actions=output:16
2663NXST_FLOW_MONITOR reply (xid=0x0):
2664 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=0 actions=output:17
2665NXST_FLOW_MONITOR reply (xid=0x0):
2666 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=0,dl_vlan_pcp=0 actions=output:18
2667NXST_FLOW_MONITOR reply (xid=0x0):
2668 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=0,dl_vlan_pcp=1 actions=output:19
2669NXST_FLOW_MONITOR reply (xid=0x0):
2670 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=0 actions=output:20
2671NXST_FLOW_MONITOR reply (xid=0x0):
2672 event=ADDED table=0 cookie=0 in_port=0,dl_vlan_pcp=0 actions=output:21
2673NXST_FLOW_MONITOR reply (xid=0x0):
2674 event=ADDED table=0 cookie=0 in_port=0,dl_vlan_pcp=1 actions=output:22
2675NXST_FLOW_MONITOR reply (xid=0x0):
2676 event=ADDED table=0 cookie=0 in_port=0 actions=output:23
ee088a75
SH
2677NXST_FLOW_MONITOR reply (xid=0x0):
2678 event=MODIFIED table=0 cookie=0 in_port=0,dl_vlan=123 actions=output:3
2679 event=MODIFIED table=0 cookie=0 in_port=0,dl_vlan=123,dl_vlan_pcp=0 actions=output:3
2680 event=MODIFIED table=0 cookie=0 in_port=0,dl_vlan=123,dl_vlan_pcp=1 actions=output:3
2b07c8b1
BP
2681NXST_FLOW_MONITOR reply (xid=0x0):
2682 event=MODIFIED table=0 cookie=0x5 in_port=0,dl_vlan=123 actions=output:3
95a1c4ca
SH
2683 event=MODIFIED table=0 cookie=0x5 in_port=0,dl_vlan=123,dl_vlan_pcp=0 actions=output:3
2684 event=MODIFIED table=0 cookie=0x5 in_port=0,dl_vlan=123,dl_vlan_pcp=1 actions=output:3
2b07c8b1
BP
2685NXST_FLOW_MONITOR reply (xid=0x0):
2686 event=DELETED reason=delete table=0 cookie=0x5 in_port=0,dl_vlan=123 actions=output:3
95a1c4ca
SH
2687 event=DELETED reason=delete table=0 cookie=0x5 in_port=0,dl_vlan=123,dl_vlan_pcp=0 actions=output:3
2688 event=DELETED reason=delete table=0 cookie=0x5 in_port=0,dl_vlan=123,dl_vlan_pcp=1 actions=output:3
2b07c8b1 2689NXST_FLOW_MONITOR reply (xid=0x0):
32cd83a2 2690 event=DELETED reason=delete table=0 cookie=0 in_port=0 actions=output:23
95a1c4ca 2691 event=DELETED reason=delete table=0 cookie=0 in_port=0,dl_vlan=0 actions=output:20
32cd83a2
BP
2692 event=DELETED reason=delete table=0 cookie=0 in_port=0,dl_vlan=0,dl_vlan_pcp=0 actions=output:18
2693 event=DELETED reason=delete table=0 cookie=0 in_port=0,dl_vlan=0,dl_vlan_pcp=1 actions=output:19
2b07c8b1 2694 event=DELETED reason=delete table=0 cookie=0 in_port=0,dl_vlan=124 actions=output:2
95a1c4ca 2695 event=DELETED reason=delete table=0 cookie=0 in_port=0,dl_vlan=4095 actions=output:14
32cd83a2 2696 event=DELETED reason=delete table=0 cookie=0 in_port=0,dl_vlan=4095,dl_vlan_pcp=0 actions=output:12
95a1c4ca 2697 event=DELETED reason=delete table=0 cookie=0 in_port=0,dl_vlan=4095,dl_vlan_pcp=1 actions=output:13
32cd83a2
BP
2698 event=DELETED reason=delete table=0 cookie=0 in_port=0,dl_vlan_pcp=0 actions=output:21
2699 event=DELETED reason=delete table=0 cookie=0 in_port=0,dl_vlan_pcp=1 actions=output:22
95a1c4ca 2700 event=DELETED reason=delete table=0 cookie=0 in_port=0,vlan_tci=0x0000 actions=output:11
2b07c8b1
BP
2701OFPT_BARRIER_REPLY:
2702])
2703
200d6ac4
SH
2704# Check that our own changes are reported as full updates.
2705ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
2706ovs-ofctl add-flow br0 in_port=1,actions=output:2
2707ovs-ofctl add-flow br0 in_port=2,actions=output:1
2708ovs-appctl -t ovs-ofctl ofctl/barrier
2709ovs-appctl -t ovs-ofctl ofctl/send 010e004812345678003fffff00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003000000000000ffffffffffff0000
2710ovs-appctl -t ovs-ofctl ofctl/barrier
2711AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip], [0], [NXST_FLOW reply:
2712])
2713AT_CHECK([sed 's/ (xid=0x[[1-9a-fA-F]][[0-9a-fA-F]]*)//' monitor.log | multiline_sort], [0],
2714[NXST_FLOW_MONITOR reply (xid=0x0):
2715 event=ADDED table=0 cookie=0 in_port=1 actions=output:2
2716NXST_FLOW_MONITOR reply (xid=0x0):
2717 event=ADDED table=0 cookie=0 in_port=2 actions=output:1
2718OFPT_BARRIER_REPLY:
2719send: OFPT_FLOW_MOD: DEL priority=0 actions=drop
2720NXST_FLOW_MONITOR reply (xid=0x0):
2721 event=DELETED reason=delete table=0 cookie=0 in_port=1 actions=output:2
2722 event=DELETED reason=delete table=0 cookie=0 in_port=2 actions=output:1
2723OFPT_BARRIER_REPLY:
2724])
2725
2726ovs-appctl -t ovs-ofctl exit
2727OVS_VSWITCHD_STOP
2728AT_CLEANUP
2729
2730AT_SETUP([ofproto - flow monitoring with !own])
2731AT_KEYWORDS([monitor])
2732OVS_VSWITCHD_START
2733
2734ovs-ofctl add-flow br0 in_port=0,dl_vlan=123,actions=output:1
2735
2736# Start a monitor watching the flow table and check the initial reply.
2737ovs-ofctl monitor br0 watch:\!own --detach --no-chdir --pidfile >monitor.log 2>&1
2738AT_CAPTURE_FILE([monitor.log])
2739ovs-appctl -t ovs-ofctl ofctl/barrier
2740AT_CHECK([sed 's/ (xid=0x[[1-9a-fA-F]][[0-9a-fA-F]]*)//' monitor.log], [0],
2741 [NXST_FLOW_MONITOR reply:
2742 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=123 actions=output:1
2743OFPT_BARRIER_REPLY:
2744])
2745
2b07c8b1
BP
2746# Check that our own changes are reported as abbreviations.
2747ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
2748ovs-ofctl add-flow br0 in_port=1,actions=output:2
2749ovs-ofctl add-flow br0 in_port=2,actions=output:1
90d721f0 2750ovs-appctl -t ovs-ofctl ofctl/barrier
2b07c8b1
BP
2751ovs-appctl -t ovs-ofctl ofctl/send 010e004812345678003fffff00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003000000000000ffffffffffff0000
2752ovs-appctl -t ovs-ofctl ofctl/barrier
2753AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip], [0], [NXST_FLOW reply:
2754])
2755AT_CHECK([sed 's/ (xid=0x[[1-9a-fA-F]][[0-9a-fA-F]]*)//' monitor.log], [0],
2756[NXST_FLOW_MONITOR reply (xid=0x0):
2757 event=ADDED table=0 cookie=0 in_port=1 actions=output:2
2758NXST_FLOW_MONITOR reply (xid=0x0):
2759 event=ADDED table=0 cookie=0 in_port=2 actions=output:1
90d721f0 2760OFPT_BARRIER_REPLY:
2b07c8b1
BP
2761send: OFPT_FLOW_MOD: DEL priority=0 actions=drop
2762NXST_FLOW_MONITOR reply (xid=0x0):
2763 event=ABBREV xid=0x12345678
cdbdeeda
SH
2764OFPT_BARRIER_REPLY:
2765])
2766
2767ovs-appctl -t ovs-ofctl exit
2768OVS_VSWITCHD_STOP
2769AT_CLEANUP
2770
2771AT_SETUP([ofproto - flow monitoring with out_port])
2772AT_KEYWORDS([monitor])
2773OVS_VSWITCHD_START
2774
2775ovs-ofctl add-flow br0 in_port=0,dl_vlan=121,actions=output:1
2776ovs-ofctl add-flow br0 in_port=0,dl_vlan=122,actions=output:1
2777ovs-ofctl add-flow br0 in_port=0,dl_vlan=123,actions=output:2
2778
2779# Start a monitor watching the flow table and check the initial reply.
2780ovs-ofctl monitor br0 watch:out_port=2 --detach --no-chdir --pidfile >monitor.log 2>&1
2781AT_CAPTURE_FILE([monitor.log])
2782ovs-appctl -t ovs-ofctl ofctl/barrier
2783AT_CHECK([sed 's/ (xid=0x[[1-9a-fA-F]][[0-9a-fA-F]]*)//' monitor.log], [0],
2784 [NXST_FLOW_MONITOR reply:
2785 event=ADDED table=0 cookie=0 in_port=0,dl_vlan=123 actions=output:2
2786OFPT_BARRIER_REPLY:
2787])
2788
2789ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
2790
2791# Add, modify flows and check the updates.
2792ovs-ofctl mod-flows br0 dl_vlan=121,actions=drop
2793ovs-ofctl mod-flows br0 dl_vlan=122,actions=output:1,output:2
2794ovs-appctl -t ovs-ofctl ofctl/barrier
2795
2796ovs-ofctl mod-flows br0 dl_vlan=123,actions=output:1,output:2
2797ovs-appctl -t ovs-ofctl ofctl/barrier
2798
2799ovs-ofctl mod-flows br0 dl_vlan=122,actions=output:1
2800ovs-appctl -t ovs-ofctl ofctl/barrier
2801ovs-ofctl mod-flows br0 dl_vlan=123,actions=output:2
2802ovs-appctl -t ovs-ofctl ofctl/barrier
2803
2804AT_CHECK([sed 's/ (xid=0x[[1-9a-fA-F]][[0-9a-fA-F]]*)//' monitor.log], [0],
2805[NXST_FLOW_MONITOR reply (xid=0x0):
2806 event=MODIFIED table=0 cookie=0 in_port=0,dl_vlan=122 actions=output:1,output:2
2807OFPT_BARRIER_REPLY:
2808NXST_FLOW_MONITOR reply (xid=0x0):
2809 event=MODIFIED table=0 cookie=0 in_port=0,dl_vlan=123 actions=output:1,output:2
2810OFPT_BARRIER_REPLY:
2811NXST_FLOW_MONITOR reply (xid=0x0):
2812 event=MODIFIED table=0 cookie=0 in_port=0,dl_vlan=122 actions=output:1
2813OFPT_BARRIER_REPLY:
2814NXST_FLOW_MONITOR reply (xid=0x0):
2815 event=MODIFIED table=0 cookie=0 in_port=0,dl_vlan=123 actions=output:2
2b07c8b1
BP
2816OFPT_BARRIER_REPLY:
2817])
2818
2819ovs-appctl -t ovs-ofctl exit
2820OVS_VSWITCHD_STOP
2821AT_CLEANUP
2822
2823AT_SETUP([ofproto - flow monitoring pause and resume])
2824AT_KEYWORDS([monitor])
2825
46a80050
EM
2826# The maximum socket receive buffer size is important for this test, which
2827# tests behavior when the receive buffer overflows.
2828if test -e /proc/sys/net/core/rmem_max; then
2829 # Linux
2830 rmem_max=`cat /proc/sys/net/core/rmem_max`
2831elif rmem_max=`sysctl -n net.inet.tcp.recvbuf_max 2>/dev/null`; then
f3326eeb 2832 : # FreeBSD, NetBSD
46a80050
EM
2833else
2834 # Don't know how to get maximum socket receive buffer on this OS
2835 AT_SKIP_IF([:])
2836fi
2b07c8b1
BP
2837# Calculate the total amount of queuing: rmem_max in the kernel, 128 kB
2838# in ofproto sending userspace (see ofmonitor_flush() in connmgr.c).
2b07c8b1
BP
2839queue_size=`expr $rmem_max + 128 \* 1024`
2840echo rmem_max=$rmem_max queue_size=$queue_size
2841
21aa35c3
BP
2842# If there's too much queuing skip the test to avoid timing out.
2843AT_SKIP_IF([test $rmem_max -gt 1048576])
2844
2b07c8b1
BP
2845# Each flow update message takes up at least 48 bytes of space in queues
2846# and in practice more than that.
2847n_msgs=`expr $queue_size / 48`
2848echo n_msgs=$n_msgs
2849
2850OVS_VSWITCHD_START
2851
2852# Start a monitor watching the flow table, then make it block.
0b7140bb 2853ON_EXIT([kill `cat ovs-ofctl.pid`])
2b07c8b1
BP
2854ovs-ofctl monitor br0 watch: --detach --no-chdir --pidfile >monitor.log 2>&1
2855AT_CAPTURE_FILE([monitor.log])
2856ovs-appctl -t ovs-ofctl ofctl/block
2857
2858# Add $n_msgs flows.
2859(echo "in_port=2,actions=output:2"
5c6d0628 2860${PERL} -e '
2b07c8b1
BP
2861 for ($i = 0; $i < '$n_msgs'; $i++) {
2862 print "cookie=1,reg1=$i,actions=drop\n";
2863 }
2864') > flows.txt
2865AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
79b8c36c
BP
2866# Check that multipart flow dumps work properly:
2867AT_CHECK([ovs-ofctl diff-flows br0 flows.txt])
2b07c8b1
BP
2868AT_CHECK([ovs-ofctl add-flow br0 in_port=1,cookie=3,actions=drop])
2869AT_CHECK([ovs-ofctl mod-flows br0 in_port=2,cookie=2,actions=output:2])
2870AT_CHECK([ovs-ofctl del-flows br0 cookie=1/-1])
2871
2872ovs-appctl -t ovs-ofctl ofctl/unblock
c4821629
YT
2873
2874# Wait for the connection resumed.
2875# A barrier doesn't work for this purpose.
2876# https://www.mail-archive.com/dev@openvswitch.org/msg27013.html
2877# https://www.mail-archive.com/dev@openvswitch.org/msg27675.html
2878OVS_WAIT_UNTIL([grep NXT_FLOW_MONITOR_RESUMED monitor.log])
2b07c8b1
BP
2879
2880ovs-appctl -t ovs-ofctl exit
2881
2882# Check that the flow monitor reported the same number of flows
2883# added and deleted, but fewer than we actually added and deleted.
2884adds=`grep -c 'ADDED.*reg1=' monitor.log`
2885deletes=`grep -c 'DELETED.*reg1=' monitor.log`
2886echo adds=$adds deletes=$deletes
2887AT_CHECK([test $adds -gt 100 && test $adds -lt $n_msgs])
2888AT_CHECK([test $adds = $deletes])
2889
d0ab8a1a
BP
2890# Check that the flow monitor reported everything in the expected order:
2891#
2892# event=ADDED table=0 cookie=0x1 reg1=0x22
2893# ...
2894# NXT_FLOW_MONITOR_PAUSED:
2895# ...
2896# event=DELETED reason=delete table=0 cookie=0x1 reg1=0x22
2897# ...
2898# event=ADDED table=0 cookie=0x3 in_port=1
2899# event=MODIFIED table=0 cookie=0x2 in_port=2 actions=output:2
2900# NXT_FLOW_MONITOR_RESUMED:
2901#
2902# except that, between the PAUSED and RESUMED, the order of the ADDED
2903# and MODIFIED lines lines depends on hash order, that is, it varies
2904# as we change the hash function or change architecture. Therefore,
2905# we use a couple of tests below to accept both orders.
2b07c8b1 2906AT_CHECK([ofctl_strip < monitor.log | sed -n -e '
46a80050 2907/reg1=0x22$/p
2b07c8b1
BP
2908/cookie=0x[[23]]/p
2909/NXT_FLOW_MONITOR_PAUSED:/p
2910/NXT_FLOW_MONITOR_RESUMED:/p
d0ab8a1a
BP
2911' > monitor.log.subset])
2912AT_CHECK([grep -v MODIFIED monitor.log.subset], [0], [dnl
2913 event=ADDED table=0 cookie=0x1 reg1=0x22
2b07c8b1
BP
2914NXT_FLOW_MONITOR_PAUSED:
2915 event=DELETED reason=delete table=0 cookie=0x1 reg1=0x22
2916 event=ADDED table=0 cookie=0x3 in_port=1
d0ab8a1a
BP
2917NXT_FLOW_MONITOR_RESUMED:
2918])
2919AT_CHECK([grep -v ADDED monitor.log.subset], [0], [dnl
2920NXT_FLOW_MONITOR_PAUSED:
2921 event=DELETED reason=delete table=0 cookie=0x1 reg1=0x22
2b07c8b1
BP
2922 event=MODIFIED table=0 cookie=0x2 in_port=2 actions=output:2
2923NXT_FLOW_MONITOR_RESUMED:
2924])
2925
2926OVS_VSWITCHD_STOP
2927AT_CLEANUP
45156451
AC
2928
2929AT_SETUP([ofproto - event filtering (OpenFlow 1.3)])
2930AT_KEYWORDS([monitor])
2931OVS_VSWITCHD_START
2932
2933# Start a monitor, use the required protocol version
2934ovs-ofctl -O OpenFlow13 monitor br0 --detach --no-chdir --pidfile >monitor.log 2>&1
2935AT_CAPTURE_FILE([monitor.log])
2936
2937# Send an OpenFlow13 message (04), OFPT_GET_ASYNC_REQUEST (1a), length (8), xid (0a)
2938ovs-appctl -t ovs-ofctl ofctl/send 041a00080000000a
2939ovs-appctl -t ovs-ofctl ofctl/barrier
2940
2941# Check default setting
2942read -r -d '' expected <<'EOF'
2943EOF
2944
2945AT_CHECK([ofctl_strip < monitor.log], [], [dnl
2946send: OFPT_GET_ASYNC_REQUEST (OF1.3):
2947OFPT_GET_ASYNC_REPLY (OF1.3):
2948 master:
2949 PACKET_IN: no_match action
2950 PORT_STATUS: add delete modify
2951 FLOW_REMOVED: idle hard delete
2952
2953 slave:
2954 PACKET_IN: (off)
2955 PORT_STATUS: add delete modify
2956 FLOW_REMOVED: (off)
2957OFPT_BARRIER_REPLY (OF1.3):
2958])
2959
2960OVS_VSWITCHD_STOP
2961AT_CLEANUP
4abb8608
BP
2962
2963AT_SETUP([ofproto - ofport_request])
2964OVS_VSWITCHD_START
2965ADD_OF_PORTS([br0], [1], [2], [3])
2966
2967set_and_check_specific_ofports () {
2968 ovs-vsctl set Interface p1 ofport_request="$1" -- \
2969 set Interface p2 ofport_request="$2" -- \
2970 set Interface p3 ofport_request="$3"
2971 ofports=`ovs-vsctl get Interface p1 ofport -- \
2972 get Interface p2 ofport -- \
2973 get Interface p3 ofport`
2974 AT_CHECK_UNQUOTED([echo $ofports], [0], [$1 $2 $3
2975])
2976}
2977for pre in '1 2 3' '1 3 2' '2 1 3' '2 3 1' '3 1 2' '3 2 1'; do
2978 for post in '1 2 3' '1 3 2' '2 1 3' '2 3 1' '3 1 2' '3 2 1'; do
2979 echo -----------------------------------------------------------
2980 echo "Check changing port numbers from $pre to $post"
d08d51b9
JS
2981 set_and_check_specific_ofports $pre
2982 set_and_check_specific_ofports $post
4abb8608
BP
2983 done
2984done
2985
2986ovs-vsctl del-port p3
2987
2988set_and_check_poorly_specified_ofports () {
2989 ovs-vsctl set Interface p1 ofport_request="$1" -- \
2990 set Interface p2 ofport_request="$2"
2991 p1=`ovs-vsctl get Interface p1 ofport`
2992 p2=`ovs-vsctl get Interface p2 ofport`
2993 echo $p1 $p2
2994
2995 AT_CHECK([test "$p1" != "$p2"])
2996 if test "$1" = "$2" && test "$1" != '[[]]'; then
2997 # One port number must be the requested one.
2998 AT_CHECK([test "$p1" = "$1" || test "$p2" = "$1"])
2999 # The other port number must be different (already tested above).
3000 else
3001 AT_CHECK([test "$1" = '[[]]' || test "$p1" == "$1"])
3002 AT_CHECK([test "$2" = '[[]]' || test "$p2" == "$2"])
3003 fi
3004}
3005for pre in '1 2' '[[]] 2' '1 [[]]' '[[]] [[]]' '2 1' '[[]] 1' '2 [[]]' \
3006 '1 1' '2 2'; do
3007 for post in '1 2' '[[]] 2' '1 [[]]' '[[]] [[]]' '2 1' '[[]] 1' '2 [[]]' \
3008 '1 1' '2 2'; do
3009 echo -----------------------------------------------------------
3010 echo "Check changing port numbers from $pre to $post"
3011 set_and_check_poorly_specified_ofports $pre
3012 set_and_check_poorly_specified_ofports $post
3013 done
3014done
3015OVS_VSWITCHD_STOP
3016AT_CLEANUP
777af88d
AC
3017
3018
3019AT_SETUP([ofproto - bundles, open (OpenFlow 1.4)])
3020AT_KEYWORDS([monitor])
3021OVS_VSWITCHD_START
3022
3023# Start a monitor, use the required protocol version
3024ovs-ofctl -O OpenFlow14 monitor br0 --detach --no-chdir --pidfile >monitor.log 2>&1
3025AT_CAPTURE_FILE([monitor.log])
3026
3027# Send an OpenFlow14 message (05), OFPT_BUNDLE_CONTROL (21), length (10), xid (0a)
3028ovs-appctl -t ovs-ofctl ofctl/send "05 21 00 10 00 00 00 0a 00 00 00 01 00 00 00 01"
3029ovs-appctl -t ovs-ofctl ofctl/barrier
3030ovs-appctl -t ovs-ofctl exit
3031
3032AT_CHECK([ofctl_strip < monitor.log], [], [dnl
3033send: OFPT_BUNDLE_CONTROL (OF1.4):
3034 bundle_id=0x1 type=OPEN_REQUEST flags=atomic
3035OFPT_BUNDLE_CONTROL (OF1.4):
3036 bundle_id=0x1 type=OPEN_REPLY flags=0
3037OFPT_BARRIER_REPLY (OF1.4):
3038])
3039
3040OVS_VSWITCHD_STOP
3041AT_CLEANUP
3042
3043AT_SETUP([ofproto - bundles, double open (OpenFlow 1.4)])
3044AT_KEYWORDS([monitor])
3045OVS_VSWITCHD_START
3046
3047# Start a monitor, use the required protocol version
3048ovs-ofctl -O OpenFlow14 monitor br0 --detach --no-chdir --pidfile >monitor.log 2>&1
3049AT_CAPTURE_FILE([monitor.log])
3050
3051# Send twice an OpenFlow14 message (05), OFPT_BUNDLE_CONTROL (21), length (10), xid (0a)
3052ovs-appctl -t ovs-ofctl ofctl/send "05 21 00 10 00 00 00 0a 00 00 00 01 00 00 00 01"
3053ovs-appctl -t ovs-ofctl ofctl/barrier
3054ovs-appctl -t ovs-ofctl ofctl/send "05 21 00 10 00 00 00 0a 00 00 00 01 00 00 00 01"
3055ovs-appctl -t ovs-ofctl ofctl/barrier
3056ovs-appctl -t ovs-ofctl exit
3057
3058AT_CHECK([ofctl_strip < monitor.log], [0], [dnl
3059send: OFPT_BUNDLE_CONTROL (OF1.4):
3060 bundle_id=0x1 type=OPEN_REQUEST flags=atomic
3061OFPT_BUNDLE_CONTROL (OF1.4):
3062 bundle_id=0x1 type=OPEN_REPLY flags=0
3063OFPT_BARRIER_REPLY (OF1.4):
3064send: OFPT_BUNDLE_CONTROL (OF1.4):
3065 bundle_id=0x1 type=OPEN_REQUEST flags=atomic
3066OFPT_ERROR (OF1.4): OFPBFC_BAD_ID
3067OFPT_BUNDLE_CONTROL (OF1.4):
3068 bundle_id=0x1 type=OPEN_REQUEST flags=atomic
3069OFPT_BARRIER_REPLY (OF1.4):
3070])
3071
3072OVS_VSWITCHD_STOP
3073AT_CLEANUP
3074
3075AT_SETUP([ofproto - bundle close without open (OpenFlow 1.4)])
3076AT_KEYWORDS([monitor])
3077OVS_VSWITCHD_START
3078
3079# Start a monitor, use the required protocol version
3080ovs-ofctl -O OpenFlow14 monitor br0 --detach --no-chdir --pidfile >monitor.log 2>&1
3081AT_CAPTURE_FILE([monitor.log])
3082
3083ovs-appctl -t ovs-ofctl ofctl/send "05 21 00 10 00 00 00 0a 00 00 00 01 00 02 00 01"
3084ovs-appctl -t ovs-ofctl ofctl/barrier
3085ovs-appctl -t ovs-ofctl exit
3086
3087AT_CHECK([ofctl_strip < monitor.log], [0], [dnl
3088send: OFPT_BUNDLE_CONTROL (OF1.4):
3089 bundle_id=0x1 type=CLOSE_REQUEST flags=atomic
3090OFPT_ERROR (OF1.4): OFPBFC_BAD_ID
3091OFPT_BUNDLE_CONTROL (OF1.4):
3092 bundle_id=0x1 type=CLOSE_REQUEST flags=atomic
3093OFPT_BARRIER_REPLY (OF1.4):
3094])
3095
3096OVS_VSWITCHD_STOP
3097AT_CLEANUP
3098
3099AT_SETUP([ofproto - bundle double close (OpenFlow 1.4)])
3100AT_KEYWORDS([monitor])
3101OVS_VSWITCHD_START
3102
3103# Start a monitor, use the required protocol version
3104ovs-ofctl -O OpenFlow14 monitor br0 --detach --no-chdir --pidfile >monitor.log 2>&1
3105AT_CAPTURE_FILE([monitor.log])
3106
3107# Open, Close, Close
3108ovs-appctl -t ovs-ofctl ofctl/send "05 21 00 10 00 00 00 0a 00 00 00 01 00 00 00 01"
3109ovs-appctl -t ovs-ofctl ofctl/barrier
3110ovs-appctl -t ovs-ofctl ofctl/send "05 21 00 10 00 00 00 0a 00 00 00 01 00 02 00 01"
3111ovs-appctl -t ovs-ofctl ofctl/barrier
3112ovs-appctl -t ovs-ofctl ofctl/send "05 21 00 10 00 00 00 0a 00 00 00 01 00 02 00 01"
3113ovs-appctl -t ovs-ofctl ofctl/barrier
3114ovs-appctl -t ovs-ofctl exit
3115
3116AT_CHECK([ofctl_strip < monitor.log], [0], [dnl
3117send: OFPT_BUNDLE_CONTROL (OF1.4):
3118 bundle_id=0x1 type=OPEN_REQUEST flags=atomic
3119OFPT_BUNDLE_CONTROL (OF1.4):
3120 bundle_id=0x1 type=OPEN_REPLY flags=0
3121OFPT_BARRIER_REPLY (OF1.4):
3122send: OFPT_BUNDLE_CONTROL (OF1.4):
3123 bundle_id=0x1 type=CLOSE_REQUEST flags=atomic
3124OFPT_BUNDLE_CONTROL (OF1.4):
3125 bundle_id=0x1 type=CLOSE_REPLY flags=0
3126OFPT_BARRIER_REPLY (OF1.4):
3127send: OFPT_BUNDLE_CONTROL (OF1.4):
3128 bundle_id=0x1 type=CLOSE_REQUEST flags=atomic
3129OFPT_ERROR (OF1.4): OFPBFC_BUNDLE_CLOSED
3130OFPT_BUNDLE_CONTROL (OF1.4):
3131 bundle_id=0x1 type=CLOSE_REQUEST flags=atomic
3132OFPT_BARRIER_REPLY (OF1.4):
3133])
3134
3135OVS_VSWITCHD_STOP
3136AT_CLEANUP
3137
3138AT_SETUP([ofproto - bundle close, different flags (OpenFlow 1.4)])
3139AT_KEYWORDS([monitor])
3140OVS_VSWITCHD_START
3141
3142# Start a monitor, use the required protocol version
3143ovs-ofctl -O OpenFlow14 monitor br0 --detach --no-chdir --pidfile >monitor.log 2>&1
3144AT_CAPTURE_FILE([monitor.log])
3145
3146# Open, Close, Close
3147ovs-appctl -t ovs-ofctl ofctl/send "05 21 00 10 00 00 00 0a 00 00 00 01 00 00 00 01"
3148ovs-appctl -t ovs-ofctl ofctl/barrier
3149ovs-appctl -t ovs-ofctl ofctl/send "05 21 00 10 00 00 00 0a 00 00 00 01 00 02 00 02"
3150ovs-appctl -t ovs-ofctl ofctl/barrier
3151ovs-appctl -t ovs-ofctl exit
3152
3153AT_CHECK([ofctl_strip < monitor.log], [0], [dnl
3154send: OFPT_BUNDLE_CONTROL (OF1.4):
3155 bundle_id=0x1 type=OPEN_REQUEST flags=atomic
3156OFPT_BUNDLE_CONTROL (OF1.4):
3157 bundle_id=0x1 type=OPEN_REPLY flags=0
3158OFPT_BARRIER_REPLY (OF1.4):
3159send: OFPT_BUNDLE_CONTROL (OF1.4):
3160 bundle_id=0x1 type=CLOSE_REQUEST flags=ordered
3161OFPT_ERROR (OF1.4): OFPBFC_BAD_FLAGS
3162OFPT_BUNDLE_CONTROL (OF1.4):
3163 bundle_id=0x1 type=CLOSE_REQUEST flags=ordered
3164OFPT_BARRIER_REPLY (OF1.4):
3165])
3166
3167OVS_VSWITCHD_STOP
3168AT_CLEANUP
3169
3170AT_SETUP([ofproto - bundle commit without open (OpenFlow 1.4)])
3171AT_KEYWORDS([monitor])
3172OVS_VSWITCHD_START
3173
3174# Start a monitor, use the required protocol version
3175ovs-ofctl -O OpenFlow14 monitor br0 --detach --no-chdir --pidfile >monitor.log 2>&1
3176AT_CAPTURE_FILE([monitor.log])
3177
3178# Open, Close, Close
3179ovs-appctl -t ovs-ofctl ofctl/send "05 21 00 10 00 00 00 0a 00 00 00 01 00 04 00 01"
3180ovs-appctl -t ovs-ofctl ofctl/barrier
3181ovs-appctl -t ovs-ofctl exit
3182
3183AT_CHECK([ofctl_strip < monitor.log], [0], [dnl
3184send: OFPT_BUNDLE_CONTROL (OF1.4):
3185 bundle_id=0x1 type=COMMIT_REQUEST flags=atomic
3186OFPT_ERROR (OF1.4): OFPBFC_BAD_ID
3187OFPT_BUNDLE_CONTROL (OF1.4):
3188 bundle_id=0x1 type=COMMIT_REQUEST flags=atomic
3189OFPT_BARRIER_REPLY (OF1.4):
3190])
3191
3192OVS_VSWITCHD_STOP
3193AT_CLEANUP
3194
3195AT_SETUP([ofproto - bundle commit, different flags (OpenFlow 1.4)])
3196AT_KEYWORDS([monitor])
3197OVS_VSWITCHD_START
3198
3199# Start a monitor, use the required protocol version
3200ovs-ofctl -O OpenFlow14 monitor br0 --detach --no-chdir --pidfile >monitor.log 2>&1
3201AT_CAPTURE_FILE([monitor.log])
3202
3203# Open, Close, Close
3204ovs-appctl -t ovs-ofctl ofctl/send "05 21 00 10 00 00 00 0a 00 00 00 01 00 00 00 01"
3205ovs-appctl -t ovs-ofctl ofctl/barrier
3206ovs-appctl -t ovs-ofctl ofctl/send "05 21 00 10 00 00 00 0a 00 00 00 01 00 04 00 02"
3207ovs-appctl -t ovs-ofctl ofctl/barrier
3208ovs-appctl -t ovs-ofctl exit
3209
3210AT_CHECK([ofctl_strip < monitor.log], [0], [dnl
3211send: OFPT_BUNDLE_CONTROL (OF1.4):
3212 bundle_id=0x1 type=OPEN_REQUEST flags=atomic
3213OFPT_BUNDLE_CONTROL (OF1.4):
3214 bundle_id=0x1 type=OPEN_REPLY flags=0
3215OFPT_BARRIER_REPLY (OF1.4):
3216send: OFPT_BUNDLE_CONTROL (OF1.4):
3217 bundle_id=0x1 type=COMMIT_REQUEST flags=ordered
3218OFPT_ERROR (OF1.4): OFPBFC_BAD_FLAGS
3219OFPT_BUNDLE_CONTROL (OF1.4):
3220 bundle_id=0x1 type=COMMIT_REQUEST flags=ordered
3221OFPT_BARRIER_REPLY (OF1.4):
3222])
3223
3224OVS_VSWITCHD_STOP
3225AT_CLEANUP
3226
3227AT_SETUP([ofproto - bundle discard without open (OpenFlow 1.4)])
3228AT_KEYWORDS([monitor])
3229OVS_VSWITCHD_START
3230
3231# Start a monitor, use the required protocol version
3232ovs-ofctl -O OpenFlow14 monitor br0 --detach --no-chdir --pidfile >monitor.log 2>&1
3233AT_CAPTURE_FILE([monitor.log])
3234
3235# Open, Close, Close
3236ovs-appctl -t ovs-ofctl ofctl/send "05 21 00 10 00 00 00 0a 00 00 00 01 00 06 00 01"
3237ovs-appctl -t ovs-ofctl ofctl/barrier
3238ovs-appctl -t ovs-ofctl exit
3239
3240AT_CHECK([ofctl_strip < monitor.log], [0], [dnl
3241send: OFPT_BUNDLE_CONTROL (OF1.4):
3242 bundle_id=0x1 type=DISCARD_REQUEST flags=atomic
3243OFPT_ERROR (OF1.4): OFPBFC_BAD_ID
3244OFPT_BUNDLE_CONTROL (OF1.4):
3245 bundle_id=0x1 type=DISCARD_REQUEST flags=atomic
3246OFPT_BARRIER_REPLY (OF1.4):
3247])
3248
3249OVS_VSWITCHD_STOP
3250AT_CLEANUP