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