]>
Commit | Line | Data |
---|---|---|
a2cb9dfd BP |
1 | AT_BANNER([ofproto]) |
2 | ||
a2cb9dfd | 3 | AT_SETUP([ofproto - echo request]) |
023e1e0a | 4 | OVS_VSWITCHD_START |
a2cb9dfd | 5 | AT_CHECK([ovs-ofctl -vANY:ANY:WARN probe br0]) |
023e1e0a | 6 | OVS_VSWITCHD_STOP |
a2cb9dfd BP |
7 | AT_CLEANUP |
8 | ||
9 | AT_SETUP([ofproto - feature request, config request]) | |
023e1e0a | 10 | OVS_VSWITCHD_START |
a2cb9dfd | 11 | AT_CHECK([ovs-ofctl -vANY:ANY:WARN show br0], [0], [stdout]) |
640c7c94 | 12 | AT_CHECK([STRIP_XIDS stdout], [0], [dnl |
d1e2cf21 | 13 | OFPT_FEATURES_REPLY: ver:0x1, dpid:fedcba9876543210 |
0697b5c3 | 14 | n_tables:255, n_buffers:256 |
428d83e6 | 15 | features: capabilities:0xc7, actions:0xfff |
0ab14c8e BP |
16 | LOCAL(br0): addr:aa:55:aa:55:00:00 |
17 | config: PORT_DOWN | |
18 | state: LINK_DOWN | |
3b62feba | 19 | OFPT_GET_CONFIG_REPLY: frags=normal miss_send_len=0 |
a2cb9dfd | 20 | ]) |
023e1e0a | 21 | OVS_VSWITCHD_STOP |
a2cb9dfd BP |
22 | AT_CLEANUP |
23 | ||
eaa6eb2a BP |
24 | dnl This is really bare-bones. |
25 | dnl It at least checks request and reply serialization and deserialization. | |
26 | AT_SETUP([ofproto - port stats]) | |
023e1e0a | 27 | OVS_VSWITCHD_START |
eaa6eb2a BP |
28 | AT_CHECK([ovs-ofctl -vANY:ANY:WARN dump-ports br0], [0], [stdout]) |
29 | AT_CHECK([STRIP_XIDS stdout], [0], [dnl | |
30 | OFPST_PORT reply: 1 ports | |
31 | port 65534: rx pkts=0, bytes=0, drop=0, errs=0, frame=0, over=0, crc=0 | |
32 | tx pkts=0, bytes=0, drop=0, errs=0, coll=0 | |
33 | ]) | |
023e1e0a | 34 | OVS_VSWITCHD_STOP |
eaa6eb2a BP |
35 | AT_CLEANUP |
36 | ||
37 | dnl This is really bare-bones. | |
38 | dnl It at least checks request and reply serialization and deserialization. | |
39 | AT_SETUP([ofproto - queue stats]) | |
023e1e0a | 40 | OVS_VSWITCHD_START |
eaa6eb2a BP |
41 | AT_CHECK([ovs-ofctl -vANY:ANY:WARN queue-stats br0], [0], [stdout]) |
42 | AT_CHECK([STRIP_XIDS stdout], [0], [dnl | |
43 | OFPST_QUEUE reply: 0 queues | |
44 | ]) | |
023e1e0a | 45 | OVS_VSWITCHD_STOP |
eaa6eb2a BP |
46 | AT_CLEANUP |
47 | ||
a2cb9dfd | 48 | AT_SETUP([ofproto - mod-port]) |
023e1e0a | 49 | OVS_VSWITCHD_START |
a2cb9dfd BP |
50 | for command_config_state in \ |
51 | 'up 0 0' \ | |
0ab14c8e BP |
52 | 'noflood NO_FLOOD 0' \ |
53 | 'down PORT_DOWN,NO_FLOOD LINK_DOWN' \ | |
54 | 'flood PORT_DOWN LINK_DOWN' | |
a2cb9dfd BP |
55 | do |
56 | set $command_config_state | |
0ab14c8e | 57 | command=$[1] config=`echo $[2] | sed 's/,/ /g'` state=$[3] |
a2cb9dfd BP |
58 | AT_CHECK([ovs-ofctl -vANY:ANY:WARN mod-port br0 br0 $command]) |
59 | AT_CHECK([ovs-ofctl -vANY:ANY:WARN show br0], [0], [stdout]) | |
640c7c94 | 60 | AT_CHECK_UNQUOTED([STRIP_XIDS stdout], [0], [dnl |
d1e2cf21 | 61 | OFPT_FEATURES_REPLY: ver:0x1, dpid:fedcba9876543210 |
0697b5c3 | 62 | n_tables:255, n_buffers:256 |
428d83e6 | 63 | features: capabilities:0xc7, actions:0xfff |
0ab14c8e BP |
64 | LOCAL(br0): addr:aa:55:aa:55:00:00 |
65 | config: $config | |
66 | state: $state | |
3b62feba | 67 | OFPT_GET_CONFIG_REPLY: frags=normal miss_send_len=0 |
a2cb9dfd BP |
68 | ]) |
69 | done | |
023e1e0a | 70 | OVS_VSWITCHD_STOP |
a2cb9dfd | 71 | AT_CLEANUP |
640c7c94 | 72 | |
c168dcc8 | 73 | AT_SETUP([ofproto - basic flow_mod commands (NXM)]) |
023e1e0a | 74 | OVS_VSWITCHD_START |
640c7c94 BP |
75 | AT_CHECK([ovs-ofctl dump-flows br0 | STRIP_XIDS], [0], [NXST_FLOW reply: |
76 | ]) | |
70315176 | 77 | AT_CHECK([echo 'in_port=1,actions=0' | ovs-ofctl add-flows br0 -]) |
640c7c94 | 78 | AT_CHECK([ovs-ofctl add-flow br0 in_port=0,actions=1]) |
0697b5c3 | 79 | AT_CHECK([ovs-ofctl -F nxm add-flow br0 table=1,in_port=3,actions=2]) |
0721c073 | 80 | AT_CHECK([ovs-ofctl dump-flows br0 | STRIP_XIDS | STRIP_DURATION | sort], [0], [dnl |
e896c2d4 BP |
81 | cookie=0x0, duration=?s, table=0, n_packets=0, n_bytes=0, in_port=0 actions=output:1 |
82 | cookie=0x0, duration=?s, table=0, n_packets=0, n_bytes=0, in_port=1 actions=output:0 | |
0697b5c3 | 83 | cookie=0x0, duration=?s, table=1, n_packets=0, n_bytes=0, in_port=3 actions=output:2 |
0721c073 | 84 | NXST_FLOW reply: |
640c7c94 | 85 | ]) |
0697b5c3 | 86 | AT_CHECK([ovs-ofctl dump-aggregate br0 table=0 | STRIP_XIDS], [0], [dnl |
c168dcc8 BP |
87 | NXST_AGGREGATE reply: packet_count=0 byte_count=0 flow_count=2 |
88 | ]) | |
640c7c94 BP |
89 | AT_CHECK([ovs-ofctl del-flows br0]) |
90 | AT_CHECK([ovs-ofctl dump-flows br0 | STRIP_XIDS], [0], [NXST_FLOW reply: | |
91 | ]) | |
023e1e0a | 92 | OVS_VSWITCHD_STOP |
640c7c94 | 93 | AT_CLEANUP |
c168dcc8 BP |
94 | |
95 | AT_SETUP([ofproto - basic flow_mod commands (OpenFlow 1.0)]) | |
023e1e0a | 96 | OVS_VSWITCHD_START |
c168dcc8 BP |
97 | AT_CHECK([ovs-ofctl -F openflow10 dump-flows br0 | STRIP_XIDS], [0], [OFPST_FLOW reply: |
98 | ]) | |
99 | AT_CHECK([echo 'in_port=1,actions=0' | ovs-ofctl -F openflow10 add-flows br0 -]) | |
100 | AT_CHECK([ovs-ofctl -F openflow10 add-flow br0 in_port=0,actions=1]) | |
0697b5c3 | 101 | AT_CHECK([ovs-ofctl -F openflow10 add-flow br0 table=1,in_port=3,actions=2]) |
c168dcc8 | 102 | AT_CHECK([ovs-ofctl -F openflow10 dump-flows br0 | STRIP_XIDS | STRIP_DURATION | sort], [0], [dnl |
e896c2d4 BP |
103 | cookie=0x0, duration=?s, table=0, n_packets=0, n_bytes=0, in_port=0 actions=output:1 |
104 | cookie=0x0, duration=?s, table=0, n_packets=0, n_bytes=0, in_port=1 actions=output:0 | |
0697b5c3 | 105 | cookie=0x0, duration=?s, table=1, n_packets=0, n_bytes=0, in_port=3 actions=output:2 |
c168dcc8 BP |
106 | OFPST_FLOW reply: |
107 | ]) | |
0697b5c3 | 108 | AT_CHECK([ovs-ofctl -F openflow10 dump-aggregate br0 table=0 | STRIP_XIDS], [0], [dnl |
c168dcc8 BP |
109 | OFPST_AGGREGATE reply: packet_count=0 byte_count=0 flow_count=2 |
110 | ]) | |
111 | AT_CHECK([ovs-ofctl -F openflow10 del-flows br0]) | |
112 | AT_CHECK([ovs-ofctl -F openflow10 dump-flows br0 | STRIP_XIDS], [0], [OFPST_FLOW reply: | |
113 | ]) | |
023e1e0a | 114 | OVS_VSWITCHD_STOP |
c168dcc8 | 115 | AT_CLEANUP |
e729e793 JP |
116 | |
117 | AT_SETUP([ofproto - dump flows with cookie]) | |
118 | OVS_VSWITCHD_START | |
119 | AT_CHECK([ovs-ofctl add-flow br0 cookie=0x1,in_port=1,actions=0]) | |
120 | AT_CHECK([ovs-ofctl add-flow br0 cookie=0x2,in_port=2,actions=0]) | |
121 | AT_CHECK([ovs-ofctl add-flow br0 cookie=0x3,in_port=3,actions=0]) | |
122 | AT_CHECK([ovs-ofctl dump-flows br0 | STRIP_XIDS | STRIP_DURATION | sort], [0], [dnl | |
123 | cookie=0x1, duration=?s, table=0, n_packets=0, n_bytes=0, in_port=1 actions=output:0 | |
124 | cookie=0x2, duration=?s, table=0, n_packets=0, n_bytes=0, in_port=2 actions=output:0 | |
125 | cookie=0x3, duration=?s, table=0, n_packets=0, n_bytes=0, in_port=3 actions=output:0 | |
126 | NXST_FLOW reply: | |
127 | ]) | |
128 | AT_CHECK([ovs-ofctl dump-aggregate br0 table=0 | STRIP_XIDS], [0], [dnl | |
129 | NXST_AGGREGATE reply: packet_count=0 byte_count=0 flow_count=3 | |
130 | ]) | |
131 | AT_CHECK([ovs-ofctl dump-flows br0 cookie=0x3 | STRIP_XIDS | STRIP_DURATION | sort], [0], [dnl | |
132 | cookie=0x3, duration=?s, table=0, n_packets=0, n_bytes=0, in_port=3 actions=output:0 | |
133 | NXST_FLOW reply: | |
134 | ]) | |
135 | AT_CHECK([ovs-ofctl dump-aggregate br0 cookie=0x3 | STRIP_XIDS], [0], [dnl | |
136 | NXST_AGGREGATE reply: packet_count=0 byte_count=0 flow_count=1 | |
137 | ]) | |
138 | OVS_VSWITCHD_STOP | |
139 | AT_CLEANUP | |
140 | ||
141 | AT_SETUP([ofproto - dump flows with cookie mask]) | |
142 | OVS_VSWITCHD_START | |
143 | AT_CHECK([ovs-ofctl add-flow br0 cookie=0x1,in_port=1,actions=0]) | |
144 | AT_CHECK([ovs-ofctl add-flow br0 cookie=0x2,in_port=2,actions=0]) | |
145 | AT_CHECK([ovs-ofctl add-flow br0 cookie=0x3,in_port=3,actions=0]) | |
146 | AT_CHECK([ovs-ofctl dump-flows br0 | STRIP_XIDS | STRIP_DURATION | sort], [0], [dnl | |
147 | cookie=0x1, duration=?s, table=0, n_packets=0, n_bytes=0, in_port=1 actions=output:0 | |
148 | cookie=0x2, duration=?s, table=0, n_packets=0, n_bytes=0, in_port=2 actions=output:0 | |
149 | cookie=0x3, duration=?s, table=0, n_packets=0, n_bytes=0, in_port=3 actions=output:0 | |
150 | NXST_FLOW reply: | |
151 | ]) | |
152 | AT_CHECK([ovs-ofctl dump-aggregate br0 table=0 | STRIP_XIDS], [0], [dnl | |
153 | NXST_AGGREGATE reply: packet_count=0 byte_count=0 flow_count=3 | |
154 | ]) | |
155 | AT_CHECK([ovs-ofctl dump-flows br0 cookie=0x3/0x1 | STRIP_XIDS | STRIP_DURATION | sort], [0], [dnl | |
156 | cookie=0x1, duration=?s, table=0, n_packets=0, n_bytes=0, in_port=1 actions=output:0 | |
157 | cookie=0x3, duration=?s, table=0, n_packets=0, n_bytes=0, in_port=3 actions=output:0 | |
158 | NXST_FLOW reply: | |
159 | ]) | |
160 | AT_CHECK([ovs-ofctl dump-aggregate br0 cookie=0x3/0x1 | STRIP_XIDS], [0], [dnl | |
161 | NXST_AGGREGATE reply: packet_count=0 byte_count=0 flow_count=2 | |
162 | ]) | |
163 | OVS_VSWITCHD_STOP | |
164 | AT_CLEANUP | |
165 | ||
166 | AT_SETUP([ofproto - del flows with cookie]) | |
167 | OVS_VSWITCHD_START | |
168 | AT_CHECK([ovs-ofctl add-flow br0 cookie=0x1,in_port=1,actions=0]) | |
169 | AT_CHECK([ovs-ofctl add-flow br0 cookie=0x2,in_port=2,actions=0]) | |
170 | AT_CHECK([ovs-ofctl add-flow br0 cookie=0x3,in_port=3,actions=0]) | |
171 | AT_CHECK([ovs-ofctl dump-flows br0 | STRIP_XIDS | STRIP_DURATION | sort], [0], [dnl | |
172 | cookie=0x1, duration=?s, table=0, n_packets=0, n_bytes=0, in_port=1 actions=output:0 | |
173 | cookie=0x2, duration=?s, table=0, n_packets=0, n_bytes=0, in_port=2 actions=output:0 | |
174 | cookie=0x3, duration=?s, table=0, n_packets=0, n_bytes=0, in_port=3 actions=output:0 | |
175 | NXST_FLOW reply: | |
176 | ]) | |
177 | AT_CHECK([ovs-ofctl del-flows br0 cookie=0x3]) | |
178 | AT_CHECK([ovs-ofctl dump-flows br0 | STRIP_XIDS | STRIP_DURATION | sort], [0], [dnl | |
179 | cookie=0x1, duration=?s, table=0, n_packets=0, n_bytes=0, in_port=1 actions=output:0 | |
180 | cookie=0x2, duration=?s, table=0, n_packets=0, n_bytes=0, in_port=2 actions=output:0 | |
181 | NXST_FLOW reply: | |
182 | ]) | |
183 | OVS_VSWITCHD_STOP | |
184 | AT_CLEANUP | |
185 | ||
186 | AT_SETUP([ofproto - del flows with cookie mask]) | |
187 | OVS_VSWITCHD_START | |
188 | AT_CHECK([ovs-ofctl add-flow br0 cookie=0x1,in_port=1,actions=0]) | |
189 | AT_CHECK([ovs-ofctl add-flow br0 cookie=0x2,in_port=2,actions=0]) | |
190 | AT_CHECK([ovs-ofctl add-flow br0 cookie=0x3,in_port=3,actions=0]) | |
191 | AT_CHECK([ovs-ofctl dump-flows br0 | STRIP_XIDS | STRIP_DURATION | sort], [0], [dnl | |
192 | cookie=0x1, duration=?s, table=0, n_packets=0, n_bytes=0, in_port=1 actions=output:0 | |
193 | cookie=0x2, duration=?s, table=0, n_packets=0, n_bytes=0, in_port=2 actions=output:0 | |
194 | cookie=0x3, duration=?s, table=0, n_packets=0, n_bytes=0, in_port=3 actions=output:0 | |
195 | NXST_FLOW reply: | |
196 | ]) | |
197 | AT_CHECK([ovs-ofctl del-flows br0 cookie=0x3/0x1]) | |
198 | AT_CHECK([ovs-ofctl dump-flows br0 | STRIP_XIDS | STRIP_DURATION | sort], [0], [dnl | |
199 | cookie=0x2, duration=?s, table=0, n_packets=0, n_bytes=0, in_port=2 actions=output:0 | |
200 | NXST_FLOW reply: | |
201 | ]) | |
202 | OVS_VSWITCHD_STOP | |
203 | AT_CLEANUP | |
254750ce BP |
204 | |
205 | AT_SETUP([ofproto - flow table configuration]) | |
206 | OVS_VSWITCHD_START | |
207 | # Check the default configuration. | |
208 | (echo "OFPST_TABLE reply (xid=0x1): 255 tables | |
209 | 0: classifier: wild=0x3fffff, max=1000000, active=0 | |
210 | lookup=0, matched=0" | |
211 | x=1 | |
212 | while test $x -lt 255; do | |
213 | printf " %d: %-8s: wild=0x3fffff, max=1000000, active=0 | |
214 | lookup=0, matched=0 | |
215 | " $x table$x | |
216 | x=`expr $x + 1` | |
217 | done) > expout | |
218 | AT_CHECK([ovs-ofctl dump-tables br0], [0], [expout]) | |
219 | # Change the configuration. | |
220 | AT_CHECK( | |
221 | [ovs-vsctl \ | |
222 | -- --id=@t0 create Flow_Table name=main \ | |
223 | -- --id=@t1 create Flow_Table flow-limit=1024 \ | |
224 | -- set bridge br0 'flow_tables={1=@t1,0=@t0}' \ | |
225 | | perl $srcdir/uuidfilt.pl], | |
226 | [0], [<0> | |
227 | <1> | |
228 | ]) | |
229 | # Check that the configuration was updated. | |
230 | mv expout orig-expout | |
231 | (echo "OFPST_TABLE reply (xid=0x1): 255 tables | |
232 | 0: main : wild=0x3fffff, max=1000000, active=0 | |
233 | lookup=0, matched=0 | |
234 | 1: table1 : wild=0x3fffff, max= 1024, active=0 | |
235 | lookup=0, matched=0" | |
236 | tail -n +6 orig-expout) > expout | |
237 | AT_CHECK([ovs-ofctl dump-tables br0], [0], [expout]) | |
238 | OVS_VSWITCHD_STOP | |
239 | AT_CLEANUP | |
240 | ||
241 | AT_SETUP([ofproto - hard limits on flow table size]) | |
242 | OVS_VSWITCHD_START | |
243 | # Configure a maximum of 4 flows. | |
244 | AT_CHECK( | |
245 | [ovs-vsctl \ | |
246 | -- --id=@t0 create Flow_Table flow-limit=4 \ | |
247 | -- set bridge br0 flow_tables:0=@t0 \ | |
248 | | perl $srcdir/uuidfilt.pl], | |
249 | [0], [<0> | |
250 | ]) | |
251 | # Add 4 flows. | |
252 | for in_port in 1 2 3 4; do | |
253 | ovs-ofctl add-flow br0 in_port=$in_port,actions=drop | |
254 | done | |
255 | AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl | |
256 | in_port=1 actions=drop | |
257 | in_port=2 actions=drop | |
258 | in_port=3 actions=drop | |
259 | in_port=4 actions=drop | |
260 | NXST_FLOW reply: | |
261 | ]) | |
262 | # Adding another flow will be refused. | |
263 | AT_CHECK([ovs-ofctl add-flow br0 in_port=5,actions=drop], [1], [], [stderr]) | |
264 | AT_CHECK([head -n 1 stderr], [0], | |
265 | [OFPT_ERROR (xid=0x1): OFPFMFC_ALL_TABLES_FULL | |
266 | ]) | |
267 | # Also a mod-flow that would add a flow will be refused. | |
268 | AT_CHECK([ovs-ofctl mod-flows br0 in_port=5,actions=drop], [1], [], [stderr]) | |
269 | AT_CHECK([head -n 1 stderr], [0], | |
270 | [OFPT_ERROR (xid=0x1): OFPFMFC_ALL_TABLES_FULL | |
271 | ]) | |
272 | # Replacing or modifying an existing flow is allowed. | |
273 | AT_CHECK([ovs-ofctl add-flow br0 in_port=4,actions=normal]) | |
274 | AT_CHECK([ovs-ofctl mod-flows br0 in_port=3,actions=output:1]) | |
275 | AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl | |
276 | in_port=1 actions=drop | |
277 | in_port=2 actions=drop | |
278 | in_port=3 actions=output:1 | |
279 | in_port=4 actions=NORMAL | |
280 | NXST_FLOW reply: | |
281 | ]) | |
282 | OVS_VSWITCHD_STOP | |
283 | AT_CLEANUP | |
284 | ||
285 | AT_SETUP([ofproto - eviction upon table overflow]) | |
286 | OVS_VSWITCHD_START | |
287 | # Configure a maximum of 4 flows. | |
288 | AT_CHECK( | |
289 | [ovs-vsctl \ | |
290 | -- --id=@t0 create Flow_Table flow-limit=4 overflow-policy=evict \ | |
291 | -- set bridge br0 flow_tables:0=@t0 \ | |
292 | | perl $srcdir/uuidfilt.pl], | |
293 | [0], [<0> | |
294 | ]) | |
295 | # Add 4 flows. | |
296 | for in_port in 4 3 2 1; do | |
297 | ovs-ofctl add-flow br0 idle_timeout=${in_port}0,in_port=$in_port,actions=drop | |
298 | done | |
299 | AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl | |
300 | idle_timeout=10,in_port=1 actions=drop | |
301 | idle_timeout=20,in_port=2 actions=drop | |
302 | idle_timeout=30,in_port=3 actions=drop | |
303 | idle_timeout=40,in_port=4 actions=drop | |
304 | NXST_FLOW reply: | |
305 | ]) | |
306 | # Adding another flow will cause the one that expires soonest to be evicted. | |
307 | AT_CHECK([ovs-ofctl add-flow br0 in_port=5,actions=drop]) | |
308 | AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl | |
309 | idle_timeout=20,in_port=2 actions=drop | |
310 | idle_timeout=30,in_port=3 actions=drop | |
311 | idle_timeout=40,in_port=4 actions=drop | |
312 | in_port=5 actions=drop | |
313 | NXST_FLOW reply: | |
314 | ]) | |
315 | # A mod-flow that adds a flow also causes eviction, but replacing or | |
316 | # modifying an existing flow doesn't. | |
317 | AT_CHECK([ovs-ofctl mod-flows br0 in_port=6,actions=drop]) | |
318 | AT_CHECK([ovs-ofctl add-flow br0 in_port=4,actions=normal]) | |
319 | AT_CHECK([ovs-ofctl mod-flows br0 in_port=3,actions=output:1]) | |
320 | AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl | |
321 | idle_timeout=30,in_port=3 actions=output:1 | |
322 | in_port=4 actions=NORMAL | |
323 | in_port=5 actions=drop | |
324 | in_port=6 actions=drop | |
325 | NXST_FLOW reply: | |
326 | ]) | |
327 | # Flows with no timeouts at all cannot be evicted. | |
328 | AT_CHECK([ovs-ofctl add-flow br0 in_port=7,actions=normal]) | |
329 | AT_CHECK([ovs-ofctl add-flow br0 in_port=8,actions=drop], [1], [], [stderr]) | |
330 | AT_CHECK([head -n 1 stderr], [0], | |
331 | [OFPT_ERROR (xid=0x1): OFPFMFC_ALL_TABLES_FULL | |
332 | ]) | |
333 | AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl | |
334 | in_port=4 actions=NORMAL | |
335 | in_port=5 actions=drop | |
336 | in_port=6 actions=drop | |
337 | in_port=7 actions=NORMAL | |
338 | NXST_FLOW reply: | |
339 | ]) | |
340 | OVS_VSWITCHD_STOP | |
341 | AT_CLEANUP | |
342 | ||
343 | AT_SETUP([ofproto - eviction upon table overflow, with fairness]) | |
344 | OVS_VSWITCHD_START | |
345 | # Configure a maximum of 4 flows. | |
346 | AT_CHECK( | |
347 | [ovs-vsctl \ | |
348 | -- --id=@t0 create Flow_Table name=evict flow-limit=4 \ | |
349 | overflow-policy=evict \ | |
350 | groups='"NXM_OF_IN_PORT[[]]"' \ | |
351 | -- set bridge br0 flow_tables:0=@t0 \ | |
352 | | perl $srcdir/uuidfilt.pl], | |
353 | [0], [<0> | |
354 | ]) | |
355 | # Add 4 flows. | |
356 | ovs-ofctl add-flows br0 - <<EOF | |
357 | idle_timeout=10 in_port=2 dl_src=00:44:55:66:77:88 actions=drop | |
358 | idle_timeout=20 in_port=1 dl_src=00:11:22:33:44:55 actions=drop | |
359 | idle_timeout=30 in_port=1 dl_src=00:22:33:44:55:66 actions=drop | |
360 | idle_timeout=40 in_port=1 dl_src=00:33:44:55:66:77 actions=drop | |
361 | EOF | |
362 | AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl | |
363 | idle_timeout=10,in_port=2,dl_src=00:44:55:66:77:88 actions=drop | |
364 | idle_timeout=20,in_port=1,dl_src=00:11:22:33:44:55 actions=drop | |
365 | idle_timeout=30,in_port=1,dl_src=00:22:33:44:55:66 actions=drop | |
366 | idle_timeout=40,in_port=1,dl_src=00:33:44:55:66:77 actions=drop | |
367 | NXST_FLOW reply: | |
368 | ]) | |
369 | # Adding another flow will cause the one that expires soonest within | |
370 | # the largest group (those with in_port=1) to be evicted. In this | |
371 | # case this is not the same as the one that expires soonest overall | |
372 | # (which is what makes the test interesting): | |
373 | AT_CHECK([ovs-ofctl add-flow br0 in_port=2,dl_src=00:55:66:77:88:99,actions=drop]) | |
374 | AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl | |
375 | idle_timeout=10,in_port=2,dl_src=00:44:55:66:77:88 actions=drop | |
376 | idle_timeout=30,in_port=1,dl_src=00:22:33:44:55:66 actions=drop | |
377 | idle_timeout=40,in_port=1,dl_src=00:33:44:55:66:77 actions=drop | |
378 | in_port=2,dl_src=00:55:66:77:88:99 actions=drop | |
379 | NXST_FLOW reply: | |
380 | ]) | |
381 | # Enlarge the flow limit, change the eviction policy back to strictly | |
382 | # based on expiration, and and add some flows. | |
383 | AT_CHECK([ovs-vsctl set Flow_Table evict groups='[[]]' flow-limit=7]) | |
384 | ovs-ofctl add-flows br0 - <<EOF | |
385 | idle_timeout=50 in_port=2 dl_src=00:66:77:88:99:aa actions=drop | |
386 | idle_timeout=60 in_port=2 dl_src=00:77:88:99:aa:bb actions=drop | |
387 | idle_timeout=70 in_port=2 dl_src=00:88:99:aa:bb:cc actions=drop | |
388 | EOF | |
389 | AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl | |
390 | idle_timeout=10,in_port=2,dl_src=00:44:55:66:77:88 actions=drop | |
391 | idle_timeout=30,in_port=1,dl_src=00:22:33:44:55:66 actions=drop | |
392 | idle_timeout=40,in_port=1,dl_src=00:33:44:55:66:77 actions=drop | |
393 | idle_timeout=50,in_port=2,dl_src=00:66:77:88:99:aa actions=drop | |
394 | idle_timeout=60,in_port=2,dl_src=00:77:88:99:aa:bb actions=drop | |
395 | idle_timeout=70,in_port=2,dl_src=00:88:99:aa:bb:cc actions=drop | |
396 | in_port=2,dl_src=00:55:66:77:88:99 actions=drop | |
397 | NXST_FLOW reply: | |
398 | ]) | |
399 | # Adding another flow will cause the one that expires soonest overall | |
400 | # to be evicted. | |
401 | AT_CHECK([ovs-ofctl add-flow br0 'idle_timeout=80 in_port=2 dl_src=00:99:aa:bb:cc:dd actions=drop']) | |
402 | AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl | |
403 | idle_timeout=30,in_port=1,dl_src=00:22:33:44:55:66 actions=drop | |
404 | idle_timeout=40,in_port=1,dl_src=00:33:44:55:66:77 actions=drop | |
405 | idle_timeout=50,in_port=2,dl_src=00:66:77:88:99:aa actions=drop | |
406 | idle_timeout=60,in_port=2,dl_src=00:77:88:99:aa:bb actions=drop | |
407 | idle_timeout=70,in_port=2,dl_src=00:88:99:aa:bb:cc actions=drop | |
408 | idle_timeout=80,in_port=2,dl_src=00:99:aa:bb:cc:dd actions=drop | |
409 | in_port=2,dl_src=00:55:66:77:88:99 actions=drop | |
410 | NXST_FLOW reply: | |
411 | ]) | |
412 | # Reducing the flow limit also causes the flows that expire soonest | |
413 | # overall to be evicted. | |
414 | AT_CHECK([ovs-vsctl set Flow_Table evict flow-limit=4]) | |
415 | AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl | |
416 | idle_timeout=60,in_port=2,dl_src=00:77:88:99:aa:bb actions=drop | |
417 | idle_timeout=70,in_port=2,dl_src=00:88:99:aa:bb:cc actions=drop | |
418 | idle_timeout=80,in_port=2,dl_src=00:99:aa:bb:cc:dd actions=drop | |
419 | in_port=2,dl_src=00:55:66:77:88:99 actions=drop | |
420 | NXST_FLOW reply: | |
421 | ]) | |
422 | OVS_VSWITCHD_STOP | |
423 | AT_CLEANUP |