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