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