]>
Commit | Line | Data |
---|---|---|
a2cb9dfd BP |
1 | AT_BANNER([ofproto]) |
2 | ||
a2cb9dfd | 3 | AT_SETUP([ofproto - echo request]) |
023e1e0a | 4 | OVS_VSWITCHD_START |
ea523221 | 5 | AT_CHECK([ovs-ofctl -vwarn 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 |
ea523221 | 11 | AT_CHECK([ovs-ofctl -vwarn show br0], [0], [stdout]) |
640c7c94 | 12 | AT_CHECK([STRIP_XIDS stdout], [0], [dnl |
9e1fd49b | 13 | OFPT_FEATURES_REPLY: dpid:fedcba9876543210 |
c2f0373a | 14 | n_tables:254, n_buffers:256 |
9e1fd49b BP |
15 | capabilities: FLOW_STATS TABLE_STATS PORT_STATS QUEUE_STATS ARP_MATCH_IP |
16 | actions: OUTPUT SET_VLAN_VID SET_VLAN_PCP STRIP_VLAN SET_DL_SRC SET_DL_DST SET_NW_SRC SET_NW_DST SET_NW_TOS SET_TP_SRC SET_TP_DST ENQUEUE | |
0ab14c8e | 17 | LOCAL(br0): addr:aa:55:aa:55:00:00 |
bef071a5 JP |
18 | config: 0 |
19 | state: 0 | |
d02a5f8e | 20 | speed: 0 Mbps now, 0 Mbps max |
3b62feba | 21 | OFPT_GET_CONFIG_REPLY: frags=normal miss_send_len=0 |
a2cb9dfd | 22 | ]) |
023e1e0a | 23 | OVS_VSWITCHD_STOP |
81816a5f JP |
24 | AT_CLEANUP |
25 | ||
26 | AT_SETUP([ofproto - set OpenFlow port number]) | |
27 | OVS_VSWITCHD_START( | |
28 | [add-port br0 p1 -- set Interface p1 type=dummy --\ | |
29 | add-port br0 p2 -- set Interface p2 type=dummy ofport_request=99]) | |
30 | AT_CHECK([ovs-ofctl -vwarn show br0], [0], [stdout]) | |
e44768b7 JP |
31 | AT_CHECK([[sed ' |
32 | s/ (xid=0x[0-9a-fA-F]*)// | |
33 | s/00:0.$/00:0x/' < stdout]], | |
34 | [0], [dnl | |
81816a5f | 35 | OFPT_FEATURES_REPLY: dpid:fedcba9876543210 |
c2f0373a | 36 | n_tables:254, n_buffers:256 |
81816a5f JP |
37 | capabilities: FLOW_STATS TABLE_STATS PORT_STATS QUEUE_STATS ARP_MATCH_IP |
38 | actions: OUTPUT SET_VLAN_VID SET_VLAN_PCP STRIP_VLAN SET_DL_SRC SET_DL_DST SET_NW_SRC SET_NW_DST SET_NW_TOS SET_TP_SRC SET_TP_DST ENQUEUE | |
e44768b7 | 39 | 1(p1): addr:aa:55:aa:55:00:0x |
81816a5f JP |
40 | config: PORT_DOWN |
41 | state: LINK_DOWN | |
d02a5f8e | 42 | speed: 0 Mbps now, 0 Mbps max |
e44768b7 | 43 | 99(p2): addr:aa:55:aa:55:00:0x |
81816a5f JP |
44 | config: PORT_DOWN |
45 | state: LINK_DOWN | |
d02a5f8e | 46 | speed: 0 Mbps now, 0 Mbps max |
e44768b7 | 47 | LOCAL(br0): addr:aa:55:aa:55:00:0x |
bef071a5 JP |
48 | config: 0 |
49 | state: 0 | |
d02a5f8e | 50 | speed: 0 Mbps now, 0 Mbps max |
81816a5f JP |
51 | OFPT_GET_CONFIG_REPLY: frags=normal miss_send_len=0 |
52 | ]) | |
e44768b7 | 53 | |
81816a5f | 54 | OVS_VSWITCHD_STOP |
a2cb9dfd BP |
55 | AT_CLEANUP |
56 | ||
eaa6eb2a BP |
57 | dnl This is really bare-bones. |
58 | dnl It at least checks request and reply serialization and deserialization. | |
9dcd1c00 | 59 | AT_SETUP([ofproto - port stats - (OpenFlow 1.0)]) |
023e1e0a | 60 | OVS_VSWITCHD_START |
ea523221 | 61 | AT_CHECK([ovs-ofctl -vwarn dump-ports br0], [0], [stdout]) |
eaa6eb2a BP |
62 | AT_CHECK([STRIP_XIDS stdout], [0], [dnl |
63 | OFPST_PORT reply: 1 ports | |
e1db42d6 | 64 | port LOCAL: rx pkts=0, bytes=0, drop=0, errs=0, frame=0, over=0, crc=0 |
eaa6eb2a BP |
65 | tx pkts=0, bytes=0, drop=0, errs=0, coll=0 |
66 | ]) | |
023e1e0a | 67 | OVS_VSWITCHD_STOP |
eaa6eb2a BP |
68 | AT_CLEANUP |
69 | ||
9dcd1c00 SH |
70 | AT_SETUP([ofproto - port stats - (OpenFlow 1.2)]) |
71 | OVS_VSWITCHD_START | |
72 | AT_CHECK([ovs-ofctl -O OpenFlow12 -vwarn dump-ports br0], [0], [stdout]) | |
73 | AT_CHECK([STRIP_XIDS stdout], [0], [dnl | |
74 | OFPST_PORT reply (OF1.2): 1 ports | |
e1db42d6 | 75 | port LOCAL: rx pkts=0, bytes=0, drop=0, errs=0, frame=0, over=0, crc=0 |
9dcd1c00 SH |
76 | tx pkts=0, bytes=0, drop=0, errs=0, coll=0 |
77 | ]) | |
78 | OVS_VSWITCHD_STOP | |
79 | AT_CLEANUP | |
80 | ||
2be393ed JP |
81 | dnl This is really bare-bones. |
82 | dnl It at least checks request and reply serialization and deserialization. | |
9dcd1c00 | 83 | AT_SETUP([ofproto - port-desc stats (OpenFlow 1.0)]) |
2be393ed JP |
84 | OVS_VSWITCHD_START |
85 | AT_CHECK([ovs-ofctl -vwarn dump-ports-desc br0], [0], [stdout]) | |
86 | AT_CHECK([STRIP_XIDS stdout], [0], [dnl | |
87 | OFPST_PORT_DESC reply: | |
88 | LOCAL(br0): addr:aa:55:aa:55:00:00 | |
bef071a5 JP |
89 | config: 0 |
90 | state: 0 | |
d02a5f8e | 91 | speed: 0 Mbps now, 0 Mbps max |
2be393ed JP |
92 | ]) |
93 | OVS_VSWITCHD_STOP | |
94 | AT_CLEANUP | |
95 | ||
eaa6eb2a BP |
96 | dnl This is really bare-bones. |
97 | dnl It at least checks request and reply serialization and deserialization. | |
9dcd1c00 SH |
98 | AT_SETUP([ofproto - port-desc stats (OpenFlow 1.2)]) |
99 | OVS_VSWITCHD_START | |
100 | AT_CHECK([ovs-ofctl -O OpenFlow12 -vwarn dump-ports-desc br0], [0], [stdout]) | |
101 | AT_CHECK([STRIP_XIDS stdout], [0], [dnl | |
102 | OFPST_PORT_DESC reply (OF1.2): | |
103 | LOCAL(br0): addr:aa:55:aa:55:00:00 | |
104 | config: 0 | |
105 | state: 0 | |
106 | speed: 0 Mbps now, 0 Mbps max | |
107 | ]) | |
108 | OVS_VSWITCHD_STOP | |
109 | AT_CLEANUP | |
110 | ||
111 | dnl This is really bare-bones. | |
112 | dnl It at least checks request and reply serialization and deserialization. | |
113 | AT_SETUP([ofproto - queue stats - (OpenFlow 1.0)]) | |
023e1e0a | 114 | OVS_VSWITCHD_START |
ea523221 | 115 | AT_CHECK([ovs-ofctl -vwarn queue-stats br0], [0], [stdout]) |
eaa6eb2a BP |
116 | AT_CHECK([STRIP_XIDS stdout], [0], [dnl |
117 | OFPST_QUEUE reply: 0 queues | |
118 | ]) | |
7f05e7ab | 119 | AT_CHECK([ovs-ofctl -vwarn queue-stats br0 ANY 5], [0], |
53514387 | 120 | [OFPT_ERROR (xid=0x2): OFPQOFC_BAD_QUEUE |
7f05e7ab | 121 | OFPST_QUEUE request (xid=0x2):port=ANY queue=5 |
0414d158 BP |
122 | ]) |
123 | AT_CHECK([ovs-ofctl -vwarn queue-stats br0 10], [0], | |
53514387 SH |
124 | [OFPT_ERROR (xid=0x2): OFPQOFC_BAD_PORT |
125 | OFPST_QUEUE request (xid=0x2):port=10 queue=ALL | |
0414d158 | 126 | ]) |
023e1e0a | 127 | OVS_VSWITCHD_STOP |
eaa6eb2a BP |
128 | AT_CLEANUP |
129 | ||
9dcd1c00 SH |
130 | AT_SETUP([ofproto - queue stats - (OpenFlow 1.2)]) |
131 | OVS_VSWITCHD_START | |
132 | AT_CHECK([ovs-ofctl -O OpenFlow12 -vwarn queue-stats br0], [0], [stdout]) | |
133 | AT_CHECK([STRIP_XIDS stdout], [0], [dnl | |
134 | OFPST_QUEUE reply (OF1.2): 0 queues | |
135 | ]) | |
136 | AT_CHECK([ovs-ofctl -O OpenFlow12 -vwarn queue-stats br0 ALL 5], [0], | |
137 | [OFPT_ERROR (OF1.2) (xid=0x2): OFPQOFC_BAD_QUEUE | |
138 | OFPST_QUEUE request (OF1.2) (xid=0x2):port=ANY queue=5 | |
139 | ]) | |
140 | AT_CHECK([ovs-ofctl -O OpenFlow12 -vwarn queue-stats br0 10], [0], | |
141 | [OFPT_ERROR (OF1.2) (xid=0x2): OFPQOFC_BAD_PORT | |
142 | OFPST_QUEUE request (OF1.2) (xid=0x2):port=10 queue=ALL | |
143 | ]) | |
144 | OVS_VSWITCHD_STOP | |
145 | AT_CLEANUP | |
146 | ||
e8f9a7bb VG |
147 | dnl This is really bare-bones. |
148 | dnl It at least checks request and reply serialization and deserialization. | |
149 | AT_SETUP([ofproto - queue configuration - (OpenFlow 1.0)]) | |
150 | OVS_VSWITCHD_START | |
151 | ADD_OF_PORTS([br0], [1], [2]) | |
152 | AT_CHECK([ovs-ofctl queue-get-config br0 1], [0], [stdout]) | |
153 | AT_CHECK([STRIP_XIDS stdout], [0], [dnl | |
154 | OFPT_QUEUE_GET_CONFIG_REPLY: port=1 | |
155 | ]) | |
156 | AT_CHECK([ovs-ofctl queue-get-config br0 10], [0], | |
157 | [OFPT_ERROR (xid=0x2): OFPQOFC_BAD_PORT | |
158 | OFPT_QUEUE_GET_CONFIG_REQUEST (xid=0x2): port=10 | |
159 | ]) | |
160 | OVS_VSWITCHD_STOP | |
161 | AT_CLEANUP | |
162 | ||
163 | AT_SETUP([ofproto - queue configuration - (OpenFlow 1.2)]) | |
164 | OVS_VSWITCHD_START | |
165 | ADD_OF_PORTS([br0], [1], [2]) | |
166 | AT_CHECK([ovs-ofctl -O OpenFlow12 queue-get-config br0 1], [0], [stdout]) | |
167 | AT_CHECK([STRIP_XIDS stdout], [0], [dnl | |
168 | OFPT_QUEUE_GET_CONFIG_REPLY (OF1.2): port=1 | |
169 | ]) | |
170 | AT_CHECK([ovs-ofctl -O OpenFlow12 queue-get-config br0 10], [0], | |
171 | [OFPT_ERROR (OF1.2) (xid=0x2): OFPQOFC_BAD_PORT | |
172 | OFPT_QUEUE_GET_CONFIG_REQUEST (OF1.2) (xid=0x2): port=10 | |
173 | ]) | |
174 | OVS_VSWITCHD_STOP | |
175 | AT_CLEANUP | |
176 | ||
433702fc SH |
177 | dnl This is really bare-bones. |
178 | dnl It at least checks request and reply serialization and deserialization. | |
179 | AT_SETUP([ofproto - del group]) | |
180 | OVS_VSWITCHD_START | |
181 | AT_DATA([groups.txt], [dnl | |
182 | group_id=1234,type=all,bucket=output:10 | |
183 | group_id=1235,type=all,bucket=output:10 | |
184 | ]) | |
185 | AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn add-groups br0 groups.txt]) | |
186 | AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn del-groups br0 group_id=1234]) | |
187 | AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn dump-groups br0], [0], [stdout]) | |
188 | AT_CHECK([STRIP_XIDS stdout], [0], [dnl | |
189 | OFPST_GROUP_DESC reply (OF1.1): | |
190 | group_id=1235,type=all,bucket=actions=output:10 | |
191 | ]) | |
192 | AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn del-groups br0 group_id=1234]) | |
193 | AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn dump-groups br0], [0], [stdout]) | |
194 | AT_CHECK([STRIP_XIDS stdout], [0], [dnl | |
195 | OFPST_GROUP_DESC reply (OF1.1): | |
196 | group_id=1235,type=all,bucket=actions=output:10 | |
197 | ]) | |
198 | AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn del-groups br0], [0]) | |
199 | AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn dump-groups br0], [0], [stdout]) | |
200 | AT_CHECK([STRIP_XIDS stdout], [0], [dnl | |
201 | OFPST_GROUP_DESC reply (OF1.1): | |
202 | ]) | |
203 | OVS_VSWITCHD_STOP | |
204 | AT_CLEANUP | |
205 | ||
206 | dnl This is really bare-bones. | |
207 | dnl It at least checks request and reply serialization and deserialization. | |
208 | AT_SETUP([ofproto - del group deletes flows]) | |
209 | OVS_VSWITCHD_START | |
210 | AT_DATA([groups.txt], [dnl | |
211 | group_id=1234,type=all,bucket=output:10 | |
212 | group_id=1235,type=all,bucket=output:10 | |
213 | ]) | |
214 | AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn add-groups br0 groups.txt]) | |
215 | AT_DATA([flows.txt], [dnl | |
216 | tcp actions=group:1234 | |
217 | udp actions=group:1235 | |
218 | ]) | |
219 | AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn add-flows br0 flows.txt]) | |
220 | AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn dump-flows br0 | ofctl_strip | sort], | |
221 | [0], [dnl | |
222 | tcp actions=group:1234 | |
223 | udp actions=group:1235 | |
224 | OFPST_FLOW reply (OF1.1): | |
225 | ]) | |
226 | AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn del-groups br0 group_id=1234]) | |
227 | AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn dump-flows br0 | ofctl_strip | sort], | |
228 | [0], [dnl | |
229 | udp actions=group:1235 | |
230 | OFPST_FLOW reply (OF1.1): | |
231 | ]) | |
232 | AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn del-groups br0 group_id=1234]) | |
233 | AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn dump-flows br0 | ofctl_strip | sort], | |
234 | [0], [dnl | |
235 | udp actions=group:1235 | |
236 | OFPST_FLOW reply (OF1.1): | |
237 | ]) | |
238 | AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn del-groups br0]) | |
239 | AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn dump-flows br0 | ofctl_strip | sort], | |
240 | [0], [dnl | |
241 | OFPST_FLOW reply (OF1.1): | |
242 | ]) | |
243 | OVS_VSWITCHD_STOP | |
244 | AT_CLEANUP | |
245 | ||
0860fea7 SH |
246 | dnl This is really bare-bones. |
247 | dnl It at least checks request and reply serialization and deserialization. | |
248 | AT_SETUP([ofproto - flow mod checks group availability]) | |
249 | OVS_VSWITCHD_START | |
250 | AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn add-group br0 group_id=1234,type=all,bucket=output:10]) | |
251 | AT_DATA([flows.txt], [dnl | |
252 | tcp actions=group:1234 | |
253 | udp actions=group:1235 | |
254 | ]) | |
255 | AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn add-flow br0 'tcp actions=group:1234']) | |
256 | AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn add-flow br0 'tcp actions=group:1235'], [1], [], [stderr]) | |
257 | ||
258 | # The output should look like this: | |
259 | # | |
260 | # 00000000 02 0e 00 98 00 00 00 02-00 00 00 00 00 00 00 00 |................| | |
261 | # 00000010 00 00 00 00 00 00 00 00-ff 00 00 00 00 00 80 00 |................| | |
262 | # 00000020 ff ff ff ff ff ff ff ff-ff ff ff ff 00 00 00 00 |................| | |
263 | # 00000030 00 00 00 58 00 00 00 00-00 00 03 d7 00 00 00 00 |...X............| | |
264 | # | |
265 | # This 'sed' command captures the error message but drops details. | |
266 | AT_CHECK([sed '/truncated/d | |
267 | /^000000.0/d' stderr | STRIP_XIDS], [0], | |
268 | [OFPT_ERROR (OF1.1): OFPBAC_BAD_OUT_GROUP | |
269 | OFPT_FLOW_MOD (OF1.1): | |
270 | ]) | |
271 | OVS_VSWITCHD_STOP | |
272 | AT_CLEANUP | |
273 | ||
433702fc SH |
274 | dnl This is really bare-bones. |
275 | dnl It at least checks request and reply serialization and deserialization. | |
276 | AT_SETUP([ofproto - group description]) | |
277 | OVS_VSWITCHD_START | |
278 | AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn add-group br0 group_id=1234,type=all,bucket=output:10], [0], [stdout]) | |
279 | AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn dump-groups br0], [0], [stdout]) | |
280 | AT_CHECK([STRIP_XIDS stdout], [0], [dnl | |
281 | OFPST_GROUP_DESC reply (OF1.1): | |
282 | group_id=1234,type=all,bucket=actions=output:10 | |
283 | ]) | |
284 | OVS_VSWITCHD_STOP | |
285 | AT_CLEANUP | |
286 | ||
2134b5ec SH |
287 | dnl This is really bare-bones. |
288 | dnl It at least checks request and reply serialization and deserialization. | |
289 | AT_SETUP([ofproto - group description]) | |
290 | OVS_VSWITCHD_START | |
291 | AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn add-group br0 group_id=1234,type=all,bucket=output:10]) | |
292 | AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn dump-groups br0], [0], [stdout]) | |
293 | AT_CHECK([STRIP_XIDS stdout], [0], [dnl | |
294 | OFPST_GROUP_DESC reply (OF1.1): | |
295 | group_id=1234,type=all,bucket=actions=output:10 | |
296 | ]) | |
297 | OVS_VSWITCHD_STOP | |
298 | AT_CLEANUP | |
299 | ||
d45418dd SH |
300 | dnl This is really bare-bones. |
301 | dnl It at least checks request and reply serialization and deserialization. | |
302 | AT_SETUP([ofproto - group features]) | |
303 | OVS_VSWITCHD_START | |
304 | AT_CHECK([ovs-ofctl -O OpenFlow12 -vwarn dump-group-features br0], [0], [stdout]) | |
305 | AT_CHECK([STRIP_XIDS stdout], [0], [dnl | |
306 | OFPST_GROUP_FEATURES reply (OF1.2): | |
307 | Group table: | |
308 | Types: 0x0 | |
7cb279c2 | 309 | Capabilities: 0x7 |
d45418dd SH |
310 | ]) |
311 | OVS_VSWITCHD_STOP | |
312 | AT_CLEANUP | |
313 | ||
2134b5ec SH |
314 | dnl This is really bare-bones. |
315 | dnl It at least checks request and reply serialization and deserialization. | |
316 | AT_SETUP([ofproto - group stats]) | |
317 | OVS_VSWITCHD_START | |
318 | AT_DATA([groups.txt], [dnl | |
319 | group_id=1234,type=all,bucket=output:10 | |
320 | group_id=1235,type=all,bucket=output:10 | |
321 | ]) | |
322 | AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn add-groups br0 groups.txt]) | |
323 | AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn add-flow br0 'tcp actions=group:1234']) | |
324 | AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn dump-group-stats br0 group_id=1234], [0], [stdout]) | |
325 | AT_CHECK([STRIP_XIDS stdout | sort], [0], [dnl | |
326 | group_id=1234,ref_count=1,packet_count=0,byte_count=0,bucket0:packet_count=0,byte_count=0 | |
327 | OFPST_GROUP reply (OF1.1): | |
328 | ]) | |
329 | AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn dump-group-stats br0], [0], [stdout]) | |
330 | AT_CHECK([STRIP_XIDS stdout | sort], [0], [dnl | |
331 | group_id=1234,ref_count=1,packet_count=0,byte_count=0,bucket0:packet_count=0,byte_count=0 | |
332 | group_id=1235,ref_count=0,packet_count=0,byte_count=0,bucket0:packet_count=0,byte_count=0 | |
333 | OFPST_GROUP reply (OF1.1): | |
334 | ]) | |
335 | OVS_VSWITCHD_STOP | |
336 | AT_CLEANUP | |
337 | ||
9dcd1c00 | 338 | AT_SETUP([ofproto - mod-port (OpenFlow 1.0)]) |
023e1e0a | 339 | OVS_VSWITCHD_START |
a2cb9dfd BP |
340 | for command_config_state in \ |
341 | 'up 0 0' \ | |
0ab14c8e BP |
342 | 'noflood NO_FLOOD 0' \ |
343 | 'down PORT_DOWN,NO_FLOOD LINK_DOWN' \ | |
28124950 BP |
344 | 'flood PORT_DOWN LINK_DOWN' \ |
345 | 'no-receive PORT_DOWN,NO_RECV LINK_DOWN' \ | |
346 | 'no-forward PORT_DOWN,NO_RECV,NO_FWD LINK_DOWN' \ | |
347 | 'no-packet-in PORT_DOWN,NO_RECV,NO_FWD,NO_PACKET_IN LINK_DOWN' \ | |
348 | 'forward PORT_DOWN,NO_RECV,NO_PACKET_IN LINK_DOWN' \ | |
349 | 'packet-in PORT_DOWN,NO_RECV LINK_DOWN' \ | |
350 | 'up NO_RECV 0' \ | |
351 | 'receive 0 0' | |
a2cb9dfd BP |
352 | do |
353 | set $command_config_state | |
0ab14c8e | 354 | command=$[1] config=`echo $[2] | sed 's/,/ /g'` state=$[3] |
ea523221 BP |
355 | AT_CHECK([ovs-ofctl -vwarn mod-port br0 br0 $command]) |
356 | AT_CHECK([ovs-ofctl -vwarn show br0], [0], [stdout]) | |
640c7c94 | 357 | AT_CHECK_UNQUOTED([STRIP_XIDS stdout], [0], [dnl |
9e1fd49b | 358 | OFPT_FEATURES_REPLY: dpid:fedcba9876543210 |
c2f0373a | 359 | n_tables:254, n_buffers:256 |
9e1fd49b BP |
360 | capabilities: FLOW_STATS TABLE_STATS PORT_STATS QUEUE_STATS ARP_MATCH_IP |
361 | actions: OUTPUT SET_VLAN_VID SET_VLAN_PCP STRIP_VLAN SET_DL_SRC SET_DL_DST SET_NW_SRC SET_NW_DST SET_NW_TOS SET_TP_SRC SET_TP_DST ENQUEUE | |
0ab14c8e BP |
362 | LOCAL(br0): addr:aa:55:aa:55:00:00 |
363 | config: $config | |
364 | state: $state | |
d02a5f8e | 365 | speed: 0 Mbps now, 0 Mbps max |
3b62feba | 366 | OFPT_GET_CONFIG_REPLY: frags=normal miss_send_len=0 |
a2cb9dfd BP |
367 | ]) |
368 | done | |
023e1e0a | 369 | OVS_VSWITCHD_STOP |
a2cb9dfd | 370 | AT_CLEANUP |
640c7c94 | 371 | |
9dcd1c00 SH |
372 | AT_SETUP([ofproto - mod-port (OpenFlow 1.2)]) |
373 | OVS_VSWITCHD_START | |
374 | for command_config_state in \ | |
375 | 'up 0 0' \ | |
376 | 'down PORT_DOWN LINK_DOWN' \ | |
377 | 'no-receive PORT_DOWN,NO_RECV LINK_DOWN' \ | |
378 | 'no-forward PORT_DOWN,NO_RECV,NO_FWD LINK_DOWN' \ | |
379 | 'no-packet-in PORT_DOWN,NO_RECV,NO_FWD,NO_PACKET_IN LINK_DOWN' \ | |
380 | 'forward PORT_DOWN,NO_RECV,NO_PACKET_IN LINK_DOWN' \ | |
381 | 'packet-in PORT_DOWN,NO_RECV LINK_DOWN' \ | |
382 | 'up NO_RECV 0' \ | |
383 | 'receive 0 0' | |
384 | do | |
385 | set $command_config_state | |
386 | command=$[1] config=`echo $[2] | sed 's/,/ /g'` state=$[3] | |
387 | AT_CHECK([ovs-ofctl -O OpenFlow12 -vwarn mod-port br0 br0 $command]) | |
388 | AT_CHECK([ovs-ofctl -O OpenFlow12 -vwarn show br0], [0], [stdout]) | |
389 | AT_CHECK_UNQUOTED([STRIP_XIDS stdout], [0], [dnl | |
390 | OFPT_FEATURES_REPLY (OF1.2): dpid:fedcba9876543210 | |
391 | n_tables:254, n_buffers:256 | |
392 | capabilities: FLOW_STATS TABLE_STATS PORT_STATS QUEUE_STATS | |
393 | LOCAL(br0): addr:aa:55:aa:55:00:00 | |
394 | config: $config | |
395 | state: $state | |
396 | speed: 0 Mbps now, 0 Mbps max | |
397 | OFPT_GET_CONFIG_REPLY (OF1.2): frags=normal miss_send_len=0 | |
398 | ]) | |
399 | done | |
400 | OVS_VSWITCHD_STOP | |
401 | AT_CLEANUP | |
402 | ||
c168dcc8 | 403 | AT_SETUP([ofproto - basic flow_mod commands (NXM)]) |
023e1e0a | 404 | OVS_VSWITCHD_START |
ef0ce8ae | 405 | AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip], [0], [NXST_FLOW reply: |
640c7c94 | 406 | ]) |
c6100d92 BP |
407 | AT_CHECK([echo 'in_port=2,actions=1' | ovs-ofctl add-flows br0 -]) |
408 | AT_CHECK([ovs-ofctl add-flow br0 in_port=1,actions=2]) | |
409 | AT_CHECK([ovs-ofctl -F nxm add-flow br0 table=1,in_port=4,actions=3]) | |
ef0ce8ae | 410 | AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl |
c6100d92 BP |
411 | in_port=1 actions=output:2 |
412 | in_port=2 actions=output:1 | |
413 | table=1, in_port=4 actions=output:3 | |
0721c073 | 414 | NXST_FLOW reply: |
640c7c94 | 415 | ]) |
0697b5c3 | 416 | AT_CHECK([ovs-ofctl dump-aggregate br0 table=0 | STRIP_XIDS], [0], [dnl |
c168dcc8 BP |
417 | NXST_AGGREGATE reply: packet_count=0 byte_count=0 flow_count=2 |
418 | ]) | |
640c7c94 | 419 | AT_CHECK([ovs-ofctl del-flows br0]) |
ef0ce8ae | 420 | AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip], [0], [NXST_FLOW reply: |
640c7c94 | 421 | ]) |
023e1e0a | 422 | OVS_VSWITCHD_STOP |
640c7c94 | 423 | AT_CLEANUP |
c168dcc8 BP |
424 | |
425 | AT_SETUP([ofproto - basic flow_mod commands (OpenFlow 1.0)]) | |
023e1e0a | 426 | OVS_VSWITCHD_START |
ef0ce8ae | 427 | AT_CHECK([ovs-ofctl -F openflow10 dump-flows br0 | ofctl_strip], [0], [OFPST_FLOW reply: |
c168dcc8 | 428 | ]) |
c6100d92 BP |
429 | AT_CHECK([echo 'in_port=2,actions=1' | ovs-ofctl -F openflow10 add-flows br0 -]) |
430 | AT_CHECK([ovs-ofctl -F openflow10 add-flow br0 in_port=1,actions=2]) | |
431 | AT_CHECK([ovs-ofctl -F openflow10 add-flow br0 table=1,in_port=4,actions=3]) | |
ef0ce8ae | 432 | AT_CHECK([ovs-ofctl -F openflow10 dump-flows br0 | ofctl_strip | sort], [0], [dnl |
c6100d92 BP |
433 | in_port=1 actions=output:2 |
434 | in_port=2 actions=output:1 | |
435 | table=1, in_port=4 actions=output:3 | |
c168dcc8 BP |
436 | OFPST_FLOW reply: |
437 | ]) | |
0697b5c3 | 438 | AT_CHECK([ovs-ofctl -F openflow10 dump-aggregate br0 table=0 | STRIP_XIDS], [0], [dnl |
c168dcc8 BP |
439 | OFPST_AGGREGATE reply: packet_count=0 byte_count=0 flow_count=2 |
440 | ]) | |
441 | AT_CHECK([ovs-ofctl -F openflow10 del-flows br0]) | |
ef0ce8ae | 442 | AT_CHECK([ovs-ofctl -F openflow10 dump-flows br0 | ofctl_strip], [0], [OFPST_FLOW reply: |
c168dcc8 | 443 | ]) |
023e1e0a | 444 | OVS_VSWITCHD_STOP |
c168dcc8 | 445 | AT_CLEANUP |
e729e793 | 446 | |
75fa58f8 BP |
447 | AT_SETUP([ofproto - basic flow_mod commands (OpenFlow 1.1)]) |
448 | OVS_VSWITCHD_START | |
449 | AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip], [0], [OFPST_FLOW reply (OF1.1): | |
450 | ]) | |
451 | AT_CHECK([echo 'in_port=2,actions=1' | ovs-ofctl -O OpenFlow11 add-flows br0 -]) | |
452 | AT_CHECK([ovs-ofctl -O OpenFlow11 add-flow br0 in_port=1,actions=2]) | |
453 | AT_CHECK([ovs-ofctl -O OpenFlow11 add-flow br0 table=1,in_port=4,actions=3]) | |
454 | AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0], [dnl | |
455 | in_port=1 actions=output:2 | |
456 | in_port=2 actions=output:1 | |
457 | table=1, in_port=4 actions=output:3 | |
458 | OFPST_FLOW reply (OF1.1): | |
459 | ]) | |
460 | AT_CHECK([ovs-ofctl -O OpenFlow11 dump-aggregate br0 table=0 | STRIP_XIDS], [0], [dnl | |
461 | OFPST_AGGREGATE reply (OF1.1): packet_count=0 byte_count=0 flow_count=2 | |
462 | ]) | |
463 | AT_CHECK([ovs-ofctl -O OpenFlow11 del-flows br0]) | |
464 | AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip], [0], [OFPST_FLOW reply (OF1.1): | |
0e197060 | 465 | table=1, in_port=4 actions=output:3 |
75fa58f8 BP |
466 | ]) |
467 | OVS_VSWITCHD_STOP | |
468 | AT_CLEANUP | |
469 | ||
862d8eed BP |
470 | AT_SETUP([ofproto - flow_mod negative test (OpenFlow 1.1)]) |
471 | OVS_VSWITCHD_START( | |
472 | [set bridge br0 protocols=OpenFlow10,OpenFlow11,OpenFlow12,OpenFlow13]) | |
473 | AT_CHECK([ovs-ofctl add-flow -O OpenFlow11 br0 table=1,action=goto_table:2]) | |
862d8eed | 474 | |
0e197060 BP |
475 | # The error message here actually comes from ovs-ofctl, not from ovs-vswitchd, |
476 | # but at least it's the same code in ofpacts_check() that issues the error. | |
477 | AT_CHECK([ovs-ofctl add-flow -O OpenFlow11 br0 table=1,action=goto_table:1], | |
478 | [1], [], | |
479 | [ovs-ofctl: actions are invalid with specified match (OFPBRC_BAD_TABLE_ID) | |
862d8eed BP |
480 | ]) |
481 | OVS_VSWITCHD_STOP | |
482 | AT_CLEANUP | |
483 | ||
f5c45121 SH |
484 | AT_SETUP([ofproto - set-field flow_mod commands (NXM)]) |
485 | OVS_VSWITCHD_START | |
486 | AT_CHECK([ovs-ofctl add-flow br0 ipv6,table=1,in_port=3,actions=drop]) | |
487 | AT_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]) | |
488 | AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl | |
489 | table=1, ipv6,in_port=3 actions=load:0xa6badbfffefe59fa->NXM_NX_IPV6_SRC[[0..63]],load:0xfe8001234567890a->NXM_NX_IPV6_SRC[[64..127]] | |
490 | NXST_FLOW reply: | |
491 | ]) | |
492 | OVS_VSWITCHD_STOP | |
493 | AT_CLEANUP | |
494 | ||
9dcd1c00 | 495 | AT_SETUP([ofproto - basic flow_mod commands (OpenFlow 1.2)]) |
e729e793 | 496 | OVS_VSWITCHD_START |
9dcd1c00 | 497 | AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip], [0], [OFPST_FLOW reply (OF1.2): |
e729e793 | 498 | ]) |
9dcd1c00 SH |
499 | AT_CHECK([echo 'in_port=2,actions=1' | ovs-ofctl -O OpenFlow12 add-flows br0 -]) |
500 | AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 in_port=1,actions=2]) | |
501 | AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 table=1,in_port=4,actions=3]) | |
502 | AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl | |
503 | in_port=1 actions=output:2 | |
504 | in_port=2 actions=output:1 | |
505 | table=1, in_port=4 actions=output:3 | |
506 | OFPST_FLOW reply (OF1.2): | |
e729e793 | 507 | ]) |
9dcd1c00 SH |
508 | AT_CHECK([ovs-ofctl -O OpenFlow12 del-flows br0]) |
509 | AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip], [0], [OFPST_FLOW reply (OF1.2): | |
e729e793 JP |
510 | ]) |
511 | OVS_VSWITCHD_STOP | |
512 | AT_CLEANUP | |
513 | ||
9dcd1c00 | 514 | AT_SETUP([ofproto - dump flows with cookie]) |
e729e793 | 515 | OVS_VSWITCHD_START |
c6100d92 BP |
516 | AT_CHECK([ovs-ofctl add-flow br0 cookie=0x1,in_port=1,actions=1]) |
517 | AT_CHECK([ovs-ofctl add-flow br0 cookie=0x2,in_port=2,actions=1]) | |
518 | AT_CHECK([ovs-ofctl add-flow br0 cookie=0x3,in_port=3,actions=1]) | |
ef0ce8ae | 519 | AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl |
c6100d92 BP |
520 | cookie=0x1, in_port=1 actions=output:1 |
521 | cookie=0x2, in_port=2 actions=output:1 | |
522 | cookie=0x3, in_port=3 actions=output:1 | |
e729e793 JP |
523 | NXST_FLOW reply: |
524 | ]) | |
525 | AT_CHECK([ovs-ofctl dump-aggregate br0 table=0 | STRIP_XIDS], [0], [dnl | |
526 | NXST_AGGREGATE reply: packet_count=0 byte_count=0 flow_count=3 | |
527 | ]) | |
9dcd1c00 | 528 | AT_CHECK([ovs-ofctl dump-flows br0 cookie=0x3/-1 | ofctl_strip | sort], [0], [dnl |
c6100d92 | 529 | cookie=0x3, in_port=3 actions=output:1 |
e729e793 JP |
530 | NXST_FLOW reply: |
531 | ]) | |
9dcd1c00 SH |
532 | AT_CHECK([ovs-ofctl dump-aggregate br0 cookie=0x3/-1 | STRIP_XIDS], [0], [dnl |
533 | NXST_AGGREGATE reply: packet_count=0 byte_count=0 flow_count=1 | |
e729e793 JP |
534 | ]) |
535 | OVS_VSWITCHD_STOP | |
536 | AT_CLEANUP | |
537 | ||
623e1caf JP |
538 | AT_SETUP([ofproto - mod flow with cookie change (OpenFlow 1.0)]) |
539 | OVS_VSWITCHD_START | |
c6100d92 | 540 | AT_CHECK([ovs-ofctl -F openflow10 add-flow br0 cookie=0x1,in_port=1,actions=1]) |
623e1caf | 541 | AT_CHECK([ovs-ofctl -F openflow10 dump-flows br0 | ofctl_strip | sort], [0], [dnl |
c6100d92 | 542 | cookie=0x1, in_port=1 actions=output:1 |
623e1caf JP |
543 | OFPST_FLOW reply: |
544 | ]) | |
545 | ||
c6100d92 | 546 | AT_CHECK([ovs-ofctl -F openflow10 mod-flows br0 cookie=0x2,in_port=1,actions=1]) |
623e1caf | 547 | AT_CHECK([ovs-ofctl -F openflow10 dump-flows br0 | ofctl_strip | sort], [0], [dnl |
c6100d92 | 548 | cookie=0x2, in_port=1 actions=output:1 |
623e1caf JP |
549 | OFPST_FLOW reply: |
550 | ]) | |
551 | OVS_VSWITCHD_STOP | |
552 | AT_CLEANUP | |
553 | ||
554 | AT_SETUP([ofproto - mod flow with cookie change (NXM)]) | |
555 | OVS_VSWITCHD_START | |
c6100d92 | 556 | AT_CHECK([ovs-ofctl -F nxm add-flow br0 cookie=0x1,in_port=1,actions=1]) |
623e1caf | 557 | AT_CHECK([ovs-ofctl -F nxm dump-flows br0 | ofctl_strip | sort], [0], [dnl |
c6100d92 | 558 | cookie=0x1, in_port=1 actions=output:1 |
623e1caf JP |
559 | NXST_FLOW reply: |
560 | ]) | |
561 | ||
c6100d92 | 562 | AT_CHECK([ovs-ofctl -F nxm mod-flows br0 cookie=0x2,in_port=1,actions=1]) |
623e1caf | 563 | AT_CHECK([ovs-ofctl -F nxm dump-flows br0 | ofctl_strip | sort], [0], [dnl |
c6100d92 | 564 | cookie=0x2, in_port=1 actions=output:1 |
623e1caf JP |
565 | NXST_FLOW reply: |
566 | ]) | |
567 | OVS_VSWITCHD_STOP | |
568 | AT_CLEANUP | |
569 | ||
75fa58f8 BP |
570 | AT_SETUP([ofproto - no mod flow with cookie change (OpenFlow 1.1)]) |
571 | OVS_VSWITCHD_START | |
572 | AT_CHECK([ovs-ofctl -O OpenFlow11 add-flow br0 cookie=0x1,in_port=1,actions=1]) | |
573 | AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0], [dnl | |
574 | cookie=0x1, in_port=1 actions=output:1 | |
575 | OFPST_FLOW reply (OF1.1): | |
576 | ]) | |
577 | AT_CHECK([ovs-ofctl -O OpenFlow11 mod-flows br0 cookie=0x2,in_port=1,actions=1]) | |
578 | AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0], [dnl | |
579 | cookie=0x1, in_port=1 actions=output:1 | |
580 | OFPST_FLOW reply (OF1.1): | |
581 | ]) | |
582 | OVS_VSWITCHD_STOP | |
583 | AT_CLEANUP | |
584 | ||
9dcd1c00 | 585 | dnl The OpenFlow 1.2 spec states that the cookie may not be modified |
2df3b874 | 586 | AT_SETUP([ofproto - no mod flow with cookie change (OpenFlow 1.2)]) |
9dcd1c00 SH |
587 | OVS_VSWITCHD_START |
588 | AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 cookie=0x1,in_port=1,actions=1]) | |
589 | AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl | |
590 | cookie=0x1, in_port=1 actions=output:1 | |
591 | OFPST_FLOW reply (OF1.2): | |
592 | ]) | |
593 | ||
594 | AT_CHECK([ovs-ofctl -O OpenFlow12 mod-flows br0 cookie=0x2,in_port=1,actions=1]) | |
595 | AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl | |
596 | cookie=0x1, in_port=1 actions=output:1 | |
597 | OFPST_FLOW reply (OF1.2): | |
598 | ]) | |
599 | OVS_VSWITCHD_STOP | |
600 | AT_CLEANUP | |
601 | ||
602 | AT_SETUP([ofproto - mod flows based on cookie mask (OpenFlow 1.0)]) | |
623e1caf | 603 | OVS_VSWITCHD_START |
c6100d92 BP |
604 | AT_CHECK([ovs-ofctl add-flow br0 cookie=0x1,in_port=1,actions=1]) |
605 | AT_CHECK([ovs-ofctl add-flow br0 cookie=0x1,in_port=2,actions=1]) | |
606 | AT_CHECK([ovs-ofctl add-flow br0 cookie=0x2,in_port=3,actions=1]) | |
623e1caf | 607 | AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl |
c6100d92 BP |
608 | cookie=0x1, in_port=1 actions=output:1 |
609 | cookie=0x1, in_port=2 actions=output:1 | |
610 | cookie=0x2, in_port=3 actions=output:1 | |
623e1caf JP |
611 | NXST_FLOW reply: |
612 | ]) | |
613 | ||
614 | AT_CHECK([ovs-ofctl -F nxm mod-flows br0 cookie=0x1/0xff,actions=4]) | |
615 | AT_CHECK([ovs-ofctl -F nxm dump-flows br0 | ofctl_strip | sort], [0], [dnl | |
616 | cookie=0x1, in_port=1 actions=output:4 | |
617 | cookie=0x1, in_port=2 actions=output:4 | |
c6100d92 | 618 | cookie=0x2, in_port=3 actions=output:1 |
623e1caf JP |
619 | NXST_FLOW reply: |
620 | ]) | |
621 | OVS_VSWITCHD_STOP | |
622 | AT_CLEANUP | |
623 | ||
75fa58f8 BP |
624 | AT_SETUP([ofproto - mod flows based on cookie mask (OpenFlow 1.1)]) |
625 | OVS_VSWITCHD_START | |
626 | AT_CHECK([ovs-ofctl -O OpenFlow11 add-flow br0 cookie=0x1,in_port=1,actions=1]) | |
627 | AT_CHECK([ovs-ofctl -O OpenFlow11 add-flow br0 cookie=0x1,in_port=2,actions=1]) | |
628 | AT_CHECK([ovs-ofctl -O OpenFlow11 add-flow br0 cookie=0x2,in_port=3,actions=1]) | |
629 | AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0], [dnl | |
630 | cookie=0x1, in_port=1 actions=output:1 | |
631 | cookie=0x1, in_port=2 actions=output:1 | |
632 | cookie=0x2, in_port=3 actions=output:1 | |
633 | OFPST_FLOW reply (OF1.1): | |
634 | ]) | |
635 | ||
636 | AT_CHECK([ovs-ofctl -O OpenFlow11 mod-flows br0 cookie=0x1/0xff,actions=4]) | |
637 | AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0], [dnl | |
638 | cookie=0x1, in_port=1 actions=output:4 | |
639 | cookie=0x1, in_port=2 actions=output:4 | |
640 | cookie=0x2, in_port=3 actions=output:1 | |
641 | OFPST_FLOW reply (OF1.1): | |
642 | ]) | |
643 | OVS_VSWITCHD_STOP | |
644 | AT_CLEANUP | |
645 | ||
9dcd1c00 SH |
646 | AT_SETUP([ofproto - mod flows based on cookie mask (OpenFlow 1.2)]) |
647 | OVS_VSWITCHD_START | |
648 | AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 cookie=0x1,in_port=1,actions=1]) | |
649 | AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 cookie=0x1,in_port=2,actions=1]) | |
650 | AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 cookie=0x2,in_port=3,actions=1]) | |
651 | AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl | |
652 | cookie=0x1, in_port=1 actions=output:1 | |
653 | cookie=0x1, in_port=2 actions=output:1 | |
654 | cookie=0x2, in_port=3 actions=output:1 | |
655 | OFPST_FLOW reply (OF1.2): | |
656 | ]) | |
657 | ||
658 | AT_CHECK([ovs-ofctl -O OpenFlow12 mod-flows br0 cookie=0x1/0xff,actions=4]) | |
659 | AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl | |
660 | cookie=0x1, in_port=1 actions=output:4 | |
661 | cookie=0x1, in_port=2 actions=output:4 | |
662 | cookie=0x2, in_port=3 actions=output:1 | |
663 | OFPST_FLOW reply (OF1.2): | |
664 | ]) | |
665 | OVS_VSWITCHD_STOP | |
666 | AT_CLEANUP | |
667 | ||
668 | dnl The OpenFlow 1.2 spec states that the cookie may not be modified | |
623e1caf JP |
669 | AT_SETUP([ofproto - mod flows based on cookie mask with cookie change]) |
670 | OVS_VSWITCHD_START | |
c6100d92 BP |
671 | AT_CHECK([ovs-ofctl add-flow br0 cookie=0x1,in_port=1,actions=1]) |
672 | AT_CHECK([ovs-ofctl add-flow br0 cookie=0x1,in_port=2,actions=1]) | |
673 | AT_CHECK([ovs-ofctl add-flow br0 cookie=0x2,in_port=3,actions=1]) | |
623e1caf | 674 | AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl |
c6100d92 BP |
675 | cookie=0x1, in_port=1 actions=output:1 |
676 | cookie=0x1, in_port=2 actions=output:1 | |
677 | cookie=0x2, in_port=3 actions=output:1 | |
623e1caf JP |
678 | NXST_FLOW reply: |
679 | ]) | |
680 | ||
681 | AT_CHECK([ovs-ofctl -F nxm mod-flows br0 cookie=1/-1,cookie=4,actions=4]) | |
682 | AT_CHECK([ovs-ofctl -F nxm dump-flows br0 | ofctl_strip | sort], [0], [dnl | |
c6100d92 | 683 | cookie=0x2, in_port=3 actions=output:1 |
623e1caf JP |
684 | cookie=0x4, in_port=1 actions=output:4 |
685 | cookie=0x4, in_port=2 actions=output:4 | |
686 | NXST_FLOW reply: | |
687 | ]) | |
688 | OVS_VSWITCHD_STOP | |
689 | AT_CLEANUP | |
690 | ||
490020fe | 691 | AT_SETUP([ofproto - mod flow with cookie miss (mask==0) - NXM]) |
623e1caf | 692 | OVS_VSWITCHD_START |
c6100d92 | 693 | AT_CHECK([ovs-ofctl -F nxm mod-flows br0 in_port=1,actions=1]) |
623e1caf | 694 | AT_CHECK([ovs-ofctl -F nxm dump-flows br0 | ofctl_strip | sort], [0], [dnl |
c6100d92 | 695 | in_port=1 actions=output:1 |
623e1caf JP |
696 | NXST_FLOW reply: |
697 | ]) | |
698 | OVS_VSWITCHD_STOP | |
699 | AT_CLEANUP | |
700 | ||
75fa58f8 BP |
701 | AT_SETUP([ofproto - mod flow with cookie miss (mask==0) - OF1.1]) |
702 | OVS_VSWITCHD_START | |
703 | AT_CHECK([ovs-ofctl -O openflow11 mod-flows br0 in_port=1,actions=1]) | |
704 | AT_CHECK([ovs-ofctl -O openflow11 dump-flows br0 | ofctl_strip | sort], [0], [dnl | |
705 | in_port=1 actions=output:1 | |
706 | OFPST_FLOW reply (OF1.1): | |
707 | ]) | |
708 | OVS_VSWITCHD_STOP | |
709 | AT_CLEANUP | |
710 | ||
490020fe BP |
711 | AT_SETUP([ofproto - mod flow with cookie miss (mask==0) - OF1.2]) |
712 | OVS_VSWITCHD_START | |
713 | AT_CHECK([ovs-ofctl -O openflow12 mod-flows br0 in_port=1,actions=1]) | |
714 | AT_CHECK([ovs-ofctl -O openflow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl | |
715 | OFPST_FLOW reply (OF1.2): | |
716 | ]) | |
717 | OVS_VSWITCHD_STOP | |
718 | AT_CLEANUP | |
719 | ||
720 | AT_SETUP([ofproto - mod flow with cookie miss (mask!=0) - NXM]) | |
623e1caf | 721 | OVS_VSWITCHD_START |
c6100d92 | 722 | AT_CHECK([ovs-ofctl -F nxm mod-flows br0 cookie=1/1,in_port=1,actions=1]) |
623e1caf JP |
723 | AT_CHECK([ovs-ofctl -F nxm dump-flows br0 | ofctl_strip | sort], [0], [dnl |
724 | NXST_FLOW reply: | |
725 | ]) | |
726 | OVS_VSWITCHD_STOP | |
727 | AT_CLEANUP | |
728 | ||
75fa58f8 BP |
729 | AT_SETUP([ofproto - mod flow with cookie miss (mask!=0) - OF1.1]) |
730 | OVS_VSWITCHD_START | |
731 | AT_CHECK([ovs-ofctl -O openflow11 mod-flows br0 cookie=1/1,in_port=1,actions=1]) | |
732 | AT_CHECK([ovs-ofctl -O openflow11 dump-flows br0 | ofctl_strip | sort], [0], [dnl | |
733 | OFPST_FLOW reply (OF1.1): | |
734 | ]) | |
735 | OVS_VSWITCHD_STOP | |
736 | AT_CLEANUP | |
737 | ||
490020fe BP |
738 | AT_SETUP([ofproto - mod flow with cookie miss (mask!=0) - OF1.2]) |
739 | OVS_VSWITCHD_START | |
740 | AT_CHECK([ovs-ofctl -O openflow12 mod-flows br0 cookie=1/1,in_port=1,actions=1]) | |
741 | AT_CHECK([ovs-ofctl -O openflow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl | |
742 | OFPST_FLOW reply (OF1.2): | |
743 | ]) | |
744 | OVS_VSWITCHD_STOP | |
745 | AT_CLEANUP | |
746 | ||
623e1caf JP |
747 | AT_SETUP([ofproto - del flows with cookies]) |
748 | OVS_VSWITCHD_START | |
c6100d92 BP |
749 | AT_CHECK([ovs-ofctl add-flow br0 cookie=0x1,in_port=1,actions=1]) |
750 | AT_CHECK([ovs-ofctl add-flow br0 cookie=0x2,in_port=2,actions=1]) | |
751 | AT_CHECK([ovs-ofctl add-flow br0 cookie=0x3,in_port=3,actions=1]) | |
623e1caf | 752 | AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl |
c6100d92 BP |
753 | cookie=0x1, in_port=1 actions=output:1 |
754 | cookie=0x2, in_port=2 actions=output:1 | |
755 | cookie=0x3, in_port=3 actions=output:1 | |
623e1caf JP |
756 | NXST_FLOW reply: |
757 | ]) | |
758 | ||
759 | AT_CHECK([ovs-ofctl del-flows br0]) | |
760 | AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl | |
761 | NXST_FLOW reply: | |
762 | ]) | |
763 | OVS_VSWITCHD_STOP | |
764 | AT_CLEANUP | |
765 | ||
766 | AT_SETUP([ofproto - del flows based on cookie]) | |
e729e793 | 767 | OVS_VSWITCHD_START |
c6100d92 BP |
768 | AT_CHECK([ovs-ofctl add-flow br0 cookie=0x1,in_port=1,actions=1]) |
769 | AT_CHECK([ovs-ofctl add-flow br0 cookie=0x2,in_port=2,actions=1]) | |
770 | AT_CHECK([ovs-ofctl add-flow br0 cookie=0x3,in_port=3,actions=1]) | |
ef0ce8ae | 771 | AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl |
c6100d92 BP |
772 | cookie=0x1, in_port=1 actions=output:1 |
773 | cookie=0x2, in_port=2 actions=output:1 | |
774 | cookie=0x3, in_port=3 actions=output:1 | |
e729e793 JP |
775 | NXST_FLOW reply: |
776 | ]) | |
80d5aefd | 777 | |
623e1caf | 778 | AT_CHECK([ovs-ofctl del-flows br0 cookie=0x3/-1]) |
ef0ce8ae | 779 | AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl |
c6100d92 BP |
780 | cookie=0x1, in_port=1 actions=output:1 |
781 | cookie=0x2, in_port=2 actions=output:1 | |
e729e793 JP |
782 | NXST_FLOW reply: |
783 | ]) | |
784 | OVS_VSWITCHD_STOP | |
785 | AT_CLEANUP | |
786 | ||
623e1caf | 787 | AT_SETUP([ofproto - del flows based on cookie mask]) |
e729e793 | 788 | OVS_VSWITCHD_START |
c6100d92 BP |
789 | AT_CHECK([ovs-ofctl add-flow br0 cookie=0x1,in_port=1,actions=1]) |
790 | AT_CHECK([ovs-ofctl add-flow br0 cookie=0x2,in_port=2,actions=1]) | |
791 | AT_CHECK([ovs-ofctl add-flow br0 cookie=0x3,in_port=3,actions=1]) | |
ef0ce8ae | 792 | AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl |
c6100d92 BP |
793 | cookie=0x1, in_port=1 actions=output:1 |
794 | cookie=0x2, in_port=2 actions=output:1 | |
795 | cookie=0x3, in_port=3 actions=output:1 | |
e729e793 JP |
796 | NXST_FLOW reply: |
797 | ]) | |
798 | AT_CHECK([ovs-ofctl del-flows br0 cookie=0x3/0x1]) | |
ef0ce8ae | 799 | AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl |
c6100d92 | 800 | cookie=0x2, in_port=2 actions=output:1 |
e729e793 JP |
801 | NXST_FLOW reply: |
802 | ]) | |
803 | OVS_VSWITCHD_STOP | |
804 | AT_CLEANUP | |
254750ce | 805 | |
9dcd1c00 | 806 | AT_SETUP([ofproto - del flows based on table id (NXM)]) |
c90cfeaf SH |
807 | OVS_VSWITCHD_START |
808 | AT_CHECK([ovs-ofctl add-flow br0 cookie=0x1,in_port=1,actions=1]) | |
809 | AT_CHECK([ovs-ofctl add-flow br0 cookie=0x2,in_port=2,table=1,actions=1]) | |
810 | AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl | |
811 | cookie=0x1, in_port=1 actions=output:1 | |
812 | cookie=0x2, table=1, in_port=2 actions=output:1 | |
813 | NXST_FLOW reply: | |
814 | ]) | |
815 | AT_CHECK([ovs-ofctl del-flows br0 table=0]) | |
816 | AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl | |
817 | cookie=0x2, table=1, in_port=2 actions=output:1 | |
818 | NXST_FLOW reply: | |
819 | ]) | |
820 | AT_CHECK([ovs-ofctl del-flows br0 table=1]) | |
821 | AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl | |
822 | NXST_FLOW reply: | |
823 | ]) | |
824 | AT_CHECK([ovs-ofctl add-flow br0 cookie=0x1,in_port=1,actions=1]) | |
825 | AT_CHECK([ovs-ofctl add-flow br0 cookie=0x2,in_port=2,table=1,actions=1]) | |
826 | AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl | |
827 | cookie=0x1, in_port=1 actions=output:1 | |
828 | cookie=0x2, table=1, in_port=2 actions=output:1 | |
829 | NXST_FLOW reply: | |
830 | ]) | |
831 | AT_CHECK([ovs-ofctl del-flows br0]) | |
832 | AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl | |
833 | NXST_FLOW reply: | |
834 | ]) | |
835 | OVS_VSWITCHD_STOP | |
836 | AT_CLEANUP | |
837 | ||
75fa58f8 BP |
838 | AT_SETUP([ofproto - del flows based on table id (OpenFlow 1.1)]) |
839 | OVS_VSWITCHD_START | |
840 | AT_CHECK([ovs-ofctl -O OpenFlow11 add-flow br0 cookie=0x1,in_port=1,actions=1]) | |
841 | AT_CHECK([ovs-ofctl -O OpenFlow11 add-flow br0 cookie=0x2,in_port=2,table=1,actions=1]) | |
842 | AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0], [dnl | |
843 | cookie=0x1, in_port=1 actions=output:1 | |
844 | cookie=0x2, table=1, in_port=2 actions=output:1 | |
845 | OFPST_FLOW reply (OF1.1): | |
846 | ]) | |
847 | AT_CHECK([ovs-ofctl -O OpenFlow11 del-flows br0 table=0]) | |
848 | AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0], [dnl | |
849 | cookie=0x2, table=1, in_port=2 actions=output:1 | |
850 | OFPST_FLOW reply (OF1.1): | |
851 | ]) | |
852 | AT_CHECK([ovs-ofctl -O OpenFlow11 del-flows br0 table=1]) | |
853 | AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0], [dnl | |
854 | OFPST_FLOW reply (OF1.1): | |
855 | ]) | |
856 | AT_CHECK([ovs-ofctl -O OpenFlow11 add-flow br0 cookie=0x1,in_port=1,actions=1]) | |
857 | AT_CHECK([ovs-ofctl -O OpenFlow11 add-flow br0 cookie=0x2,in_port=2,table=1,actions=1]) | |
858 | AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0], [dnl | |
859 | cookie=0x1, in_port=1 actions=output:1 | |
860 | cookie=0x2, table=1, in_port=2 actions=output:1 | |
861 | OFPST_FLOW reply (OF1.1): | |
862 | ]) | |
863 | AT_CHECK([ovs-ofctl -O OpenFlow11 del-flows br0]) | |
0e197060 | 864 | AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip], [0], [dnl |
75fa58f8 | 865 | OFPST_FLOW reply (OF1.1): |
0e197060 | 866 | cookie=0x2, table=1, in_port=2 actions=output:1 |
75fa58f8 BP |
867 | ]) |
868 | OVS_VSWITCHD_STOP | |
869 | AT_CLEANUP | |
870 | ||
9dcd1c00 SH |
871 | AT_SETUP([ofproto - del flows based on table id (OpenFlow 1.2)]) |
872 | OVS_VSWITCHD_START | |
873 | AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 cookie=0x1,in_port=1,actions=1]) | |
874 | AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 cookie=0x2,in_port=2,table=1,actions=1]) | |
875 | AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl | |
876 | cookie=0x1, in_port=1 actions=output:1 | |
877 | cookie=0x2, table=1, in_port=2 actions=output:1 | |
878 | OFPST_FLOW reply (OF1.2): | |
879 | ]) | |
880 | AT_CHECK([ovs-ofctl -O OpenFlow12 del-flows br0 table=0]) | |
881 | AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl | |
882 | cookie=0x2, table=1, in_port=2 actions=output:1 | |
883 | OFPST_FLOW reply (OF1.2): | |
884 | ]) | |
885 | AT_CHECK([ovs-ofctl -O OpenFlow12 del-flows br0 table=1]) | |
886 | AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl | |
887 | OFPST_FLOW reply (OF1.2): | |
888 | ]) | |
889 | AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 cookie=0x1,in_port=1,actions=1]) | |
890 | AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 cookie=0x2,in_port=2,table=1,actions=1]) | |
891 | AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl | |
892 | cookie=0x1, in_port=1 actions=output:1 | |
893 | cookie=0x2, table=1, in_port=2 actions=output:1 | |
894 | OFPST_FLOW reply (OF1.2): | |
895 | ]) | |
896 | AT_CHECK([ovs-ofctl -O OpenFlow12 del-flows br0]) | |
897 | AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl | |
898 | OFPST_FLOW reply (OF1.2): | |
899 | ]) | |
900 | OVS_VSWITCHD_STOP | |
901 | AT_CLEANUP | |
902 | ||
903 | AT_SETUP([ofproto - flow table configuration (OpenFlow 1.0)]) | |
254750ce BP |
904 | OVS_VSWITCHD_START |
905 | # Check the default configuration. | |
c2f0373a | 906 | (echo "OFPST_TABLE reply (xid=0x2): 254 tables |
254750ce BP |
907 | 0: classifier: wild=0x3fffff, max=1000000, active=0 |
908 | lookup=0, matched=0" | |
909 | x=1 | |
c57b2226 | 910 | while test $x -lt 254; do |
254750ce BP |
911 | printf " %d: %-8s: wild=0x3fffff, max=1000000, active=0 |
912 | lookup=0, matched=0 | |
913 | " $x table$x | |
914 | x=`expr $x + 1` | |
c2f0373a | 915 | done) > expout |
254750ce BP |
916 | AT_CHECK([ovs-ofctl dump-tables br0], [0], [expout]) |
917 | # Change the configuration. | |
918 | AT_CHECK( | |
919 | [ovs-vsctl \ | |
920 | -- --id=@t0 create Flow_Table name=main \ | |
921 | -- --id=@t1 create Flow_Table flow-limit=1024 \ | |
922 | -- set bridge br0 'flow_tables={1=@t1,0=@t0}' \ | |
5c6d0628 | 923 | | ${PERL} $srcdir/uuidfilt.pl], |
254750ce BP |
924 | [0], [<0> |
925 | <1> | |
926 | ]) | |
927 | # Check that the configuration was updated. | |
928 | mv expout orig-expout | |
c2f0373a | 929 | (echo "OFPST_TABLE reply (xid=0x2): 254 tables |
254750ce BP |
930 | 0: main : wild=0x3fffff, max=1000000, active=0 |
931 | lookup=0, matched=0 | |
932 | 1: table1 : wild=0x3fffff, max= 1024, active=0 | |
933 | lookup=0, matched=0" | |
934 | tail -n +6 orig-expout) > expout | |
935 | AT_CHECK([ovs-ofctl dump-tables br0], [0], [expout]) | |
936 | OVS_VSWITCHD_STOP | |
937 | AT_CLEANUP | |
938 | ||
9dcd1c00 SH |
939 | AT_SETUP([ofproto - flow table configuration (OpenFlow 1.2)]) |
940 | OVS_VSWITCHD_START | |
941 | # Check the default configuration. | |
6240624b | 942 | (mid="wild=0xfffffffff, max=1000000," |
9dcd1c00 SH |
943 | tail=" |
944 | lookup=0, matched=0 | |
6240624b | 945 | match=0xfffffffff, instructions=0x00000007, config=0x00000003 |
9dcd1c00 | 946 | write_actions=0x00000000, apply_actions=0x00000000 |
6240624b BP |
947 | write_setfields=0x0000000fffffffff |
948 | apply_setfields=0x0000000fffffffff | |
9dcd1c00 SH |
949 | metadata_match=0xffffffffffffffff |
950 | metadata_write=0xffffffffffffffff" | |
951 | echo "OFPST_TABLE reply (OF1.2) (xid=0x2): 254 tables | |
952 | 0: classifier: $mid active=0$tail" | |
953 | x=1 | |
954 | while test $x -lt 254; do | |
955 | printf " %d: %-8s: $mid active=0$tail | |
956 | " $x table$x | |
957 | x=`expr $x + 1` | |
958 | done) > expout | |
959 | AT_CHECK([ovs-ofctl -O OpenFlow12 dump-tables br0], [0], [expout]) | |
960 | # Change the configuration. | |
961 | AT_CHECK( | |
962 | [ovs-vsctl \ | |
963 | -- --id=@t0 create Flow_Table name=main \ | |
964 | -- --id=@t1 create Flow_Table flow-limit=1024 \ | |
965 | -- set bridge br0 'flow_tables={1=@t1,0=@t0}' \ | |
5c6d0628 | 966 | | ${PERL} $srcdir/uuidfilt.pl], |
9dcd1c00 SH |
967 | [0], [<0> |
968 | <1> | |
969 | ]) | |
970 | # Check that the configuration was updated. | |
971 | mv expout orig-expout | |
972 | (echo "OFPST_TABLE reply (OF1.2) (xid=0x2): 254 tables | |
6240624b | 973 | 0: main : wild=0xfffffffff, max=1000000, active=0" |
9dcd1c00 | 974 | tail -n +3 orig-expout | head -7 |
6240624b | 975 | echo " 1: table1 : wild=0xfffffffff, max= 1024, active=0" |
9dcd1c00 SH |
976 | tail -n +11 orig-expout) > expout |
977 | AT_CHECK([ovs-ofctl -O OpenFlow12 dump-tables br0], [0], [expout]) | |
978 | OVS_VSWITCHD_STOP | |
979 | AT_CLEANUP | |
980 | ||
981 | AT_SETUP([ofproto - hard limits on flow table size (OpenFLow 1.0)]) | |
254750ce BP |
982 | OVS_VSWITCHD_START |
983 | # Configure a maximum of 4 flows. | |
984 | AT_CHECK( | |
985 | [ovs-vsctl \ | |
986 | -- --id=@t0 create Flow_Table flow-limit=4 \ | |
987 | -- set bridge br0 flow_tables:0=@t0 \ | |
5c6d0628 | 988 | | ${PERL} $srcdir/uuidfilt.pl], |
254750ce BP |
989 | [0], [<0> |
990 | ]) | |
991 | # Add 4 flows. | |
992 | for in_port in 1 2 3 4; do | |
993 | ovs-ofctl add-flow br0 in_port=$in_port,actions=drop | |
994 | done | |
995 | AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl | |
996 | in_port=1 actions=drop | |
997 | in_port=2 actions=drop | |
998 | in_port=3 actions=drop | |
999 | in_port=4 actions=drop | |
1000 | NXST_FLOW reply: | |
1001 | ]) | |
1002 | # Adding another flow will be refused. | |
1003 | AT_CHECK([ovs-ofctl add-flow br0 in_port=5,actions=drop], [1], [], [stderr]) | |
27527aa0 | 1004 | AT_CHECK([head -n 1 stderr | ofctl_strip], [0], |
be2b69d1 | 1005 | [OFPT_ERROR: OFPFMFC_TABLE_FULL |
254750ce BP |
1006 | ]) |
1007 | # Also a mod-flow that would add a flow will be refused. | |
1008 | AT_CHECK([ovs-ofctl mod-flows br0 in_port=5,actions=drop], [1], [], [stderr]) | |
27527aa0 | 1009 | AT_CHECK([head -n 1 stderr | ofctl_strip], [0], |
be2b69d1 | 1010 | [OFPT_ERROR: OFPFMFC_TABLE_FULL |
254750ce BP |
1011 | ]) |
1012 | # Replacing or modifying an existing flow is allowed. | |
1013 | AT_CHECK([ovs-ofctl add-flow br0 in_port=4,actions=normal]) | |
1014 | AT_CHECK([ovs-ofctl mod-flows br0 in_port=3,actions=output:1]) | |
1015 | AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl | |
1016 | in_port=1 actions=drop | |
1017 | in_port=2 actions=drop | |
1018 | in_port=3 actions=output:1 | |
1019 | in_port=4 actions=NORMAL | |
1020 | NXST_FLOW reply: | |
1021 | ]) | |
1022 | OVS_VSWITCHD_STOP | |
1023 | AT_CLEANUP | |
1024 | ||
9dcd1c00 SH |
1025 | AT_SETUP([ofproto - hard limits on flow table size (OpenFLow 1.2)]) |
1026 | OVS_VSWITCHD_START | |
1027 | # Configure a maximum of 4 flows. | |
1028 | AT_CHECK( | |
1029 | [ovs-vsctl \ | |
1030 | -- --id=@t0 create Flow_Table flow-limit=4 \ | |
1031 | -- set bridge br0 flow_tables:0=@t0 \ | |
5c6d0628 | 1032 | | ${PERL} $srcdir/uuidfilt.pl], |
9dcd1c00 SH |
1033 | [0], [<0> |
1034 | ]) | |
1035 | # Add 4 flows. | |
1036 | for in_port in 1 2 3 4; do | |
1037 | ovs-ofctl -O OpenFlow12 add-flow br0 in_port=$in_port,actions=drop | |
1038 | done | |
1039 | AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl | |
1040 | in_port=1 actions=drop | |
1041 | in_port=2 actions=drop | |
1042 | in_port=3 actions=drop | |
1043 | in_port=4 actions=drop | |
1044 | OFPST_FLOW reply (OF1.2): | |
1045 | ]) | |
1046 | # Adding another flow will be refused. | |
1047 | AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 in_port=5,actions=drop], [1], [], [stderr]) | |
1048 | AT_CHECK([head -n 1 stderr | ofctl_strip], [0], | |
1049 | [OFPT_ERROR (OF1.2): OFPFMFC_TABLE_FULL | |
1050 | ]) | |
1051 | # Replacing or modifying an existing flow is allowed. | |
1052 | AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 in_port=4,actions=normal]) | |
1053 | AT_CHECK([ovs-ofctl -O OpenFlow12 mod-flows br0 in_port=3,actions=output:1]) | |
1054 | AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl | |
1055 | in_port=1 actions=drop | |
1056 | in_port=2 actions=drop | |
1057 | in_port=3 actions=output:1 | |
1058 | in_port=4 actions=NORMAL | |
1059 | OFPST_FLOW reply (OF1.2): | |
1060 | ]) | |
1061 | OVS_VSWITCHD_STOP | |
1062 | AT_CLEANUP | |
1063 | ||
1064 | AT_SETUP([ofproto - eviction upon table overflow (OpenFlow 1.0)]) | |
254750ce BP |
1065 | OVS_VSWITCHD_START |
1066 | # Configure a maximum of 4 flows. | |
1067 | AT_CHECK( | |
1068 | [ovs-vsctl \ | |
1069 | -- --id=@t0 create Flow_Table flow-limit=4 overflow-policy=evict \ | |
1070 | -- set bridge br0 flow_tables:0=@t0 \ | |
5c6d0628 | 1071 | | ${PERL} $srcdir/uuidfilt.pl], |
254750ce BP |
1072 | [0], [<0> |
1073 | ]) | |
1074 | # Add 4 flows. | |
1075 | for in_port in 4 3 2 1; do | |
1076 | ovs-ofctl add-flow br0 idle_timeout=${in_port}0,in_port=$in_port,actions=drop | |
1077 | done | |
1078 | AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl | |
b9718b7b BP |
1079 | idle_timeout=10, in_port=1 actions=drop |
1080 | idle_timeout=20, in_port=2 actions=drop | |
1081 | idle_timeout=30, in_port=3 actions=drop | |
1082 | idle_timeout=40, in_port=4 actions=drop | |
254750ce BP |
1083 | NXST_FLOW reply: |
1084 | ]) | |
1085 | # Adding another flow will cause the one that expires soonest to be evicted. | |
1086 | AT_CHECK([ovs-ofctl add-flow br0 in_port=5,actions=drop]) | |
1087 | AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl | |
b9718b7b BP |
1088 | idle_timeout=20, in_port=2 actions=drop |
1089 | idle_timeout=30, in_port=3 actions=drop | |
1090 | idle_timeout=40, in_port=4 actions=drop | |
254750ce BP |
1091 | in_port=5 actions=drop |
1092 | NXST_FLOW reply: | |
1093 | ]) | |
1094 | # A mod-flow that adds a flow also causes eviction, but replacing or | |
1095 | # modifying an existing flow doesn't. | |
1096 | AT_CHECK([ovs-ofctl mod-flows br0 in_port=6,actions=drop]) | |
1097 | AT_CHECK([ovs-ofctl add-flow br0 in_port=4,actions=normal]) | |
1098 | AT_CHECK([ovs-ofctl mod-flows br0 in_port=3,actions=output:1]) | |
1099 | AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl | |
b9718b7b | 1100 | idle_timeout=30, in_port=3 actions=output:1 |
254750ce BP |
1101 | in_port=4 actions=NORMAL |
1102 | in_port=5 actions=drop | |
1103 | in_port=6 actions=drop | |
1104 | NXST_FLOW reply: | |
1105 | ]) | |
1106 | # Flows with no timeouts at all cannot be evicted. | |
1107 | AT_CHECK([ovs-ofctl add-flow br0 in_port=7,actions=normal]) | |
1108 | AT_CHECK([ovs-ofctl add-flow br0 in_port=8,actions=drop], [1], [], [stderr]) | |
27527aa0 | 1109 | AT_CHECK([head -n 1 stderr | ofctl_strip], [0], |
be2b69d1 | 1110 | [OFPT_ERROR: OFPFMFC_TABLE_FULL |
254750ce BP |
1111 | ]) |
1112 | AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl | |
1113 | in_port=4 actions=NORMAL | |
1114 | in_port=5 actions=drop | |
1115 | in_port=6 actions=drop | |
1116 | in_port=7 actions=NORMAL | |
1117 | NXST_FLOW reply: | |
1118 | ]) | |
1119 | OVS_VSWITCHD_STOP | |
1120 | AT_CLEANUP | |
1121 | ||
9dcd1c00 SH |
1122 | AT_SETUP([ofproto - eviction upon table overflow (OpenFlow 1.2)]) |
1123 | OVS_VSWITCHD_START | |
1124 | # Configure a maximum of 4 flows. | |
1125 | AT_CHECK( | |
1126 | [ovs-vsctl \ | |
1127 | -- --id=@t0 create Flow_Table flow-limit=4 overflow-policy=evict \ | |
1128 | -- set bridge br0 flow_tables:0=@t0 \ | |
5c6d0628 | 1129 | | ${PERL} $srcdir/uuidfilt.pl], |
9dcd1c00 SH |
1130 | [0], [<0> |
1131 | ]) | |
1132 | # Add 4 flows. | |
1133 | for in_port in 4 3 2 1; do | |
1134 | ovs-ofctl -O OpenFlow12 add-flow br0 idle_timeout=${in_port}0,in_port=$in_port,actions=drop | |
1135 | done | |
1136 | AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl | |
1137 | idle_timeout=10, in_port=1 actions=drop | |
1138 | idle_timeout=20, in_port=2 actions=drop | |
1139 | idle_timeout=30, in_port=3 actions=drop | |
1140 | idle_timeout=40, in_port=4 actions=drop | |
1141 | OFPST_FLOW reply (OF1.2): | |
1142 | ]) | |
1143 | # Adding another flow will cause the one that expires soonest to be evicted. | |
1144 | AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 in_port=5,actions=drop]) | |
1145 | AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl | |
1146 | idle_timeout=20, in_port=2 actions=drop | |
1147 | idle_timeout=30, in_port=3 actions=drop | |
1148 | idle_timeout=40, in_port=4 actions=drop | |
1149 | in_port=5 actions=drop | |
1150 | OFPST_FLOW reply (OF1.2): | |
1151 | ]) | |
1152 | # In Open Flow 1.2 a mod-flow does not ever add a flow and thus | |
1153 | # has no effect on eviction | |
1154 | AT_CHECK([ovs-ofctl -O OpenFlow12 mod-flows br0 in_port=6,actions=drop]) | |
1155 | AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 in_port=4,actions=normal]) | |
1156 | AT_CHECK([ovs-ofctl -O OpenFlow12 mod-flows br0 in_port=3,actions=output:1]) | |
1157 | AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl | |
1158 | idle_timeout=20, in_port=2 actions=drop | |
1159 | idle_timeout=30, in_port=3 actions=output:1 | |
1160 | in_port=4 actions=NORMAL | |
1161 | in_port=5 actions=drop | |
1162 | OFPST_FLOW reply (OF1.2): | |
1163 | ]) | |
1164 | # Flows with no timeouts at all cannot be evicted. | |
1165 | AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 in_port=6,actions=drop]) | |
1166 | AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 in_port=7,actions=normal]) | |
1167 | AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 in_port=8,actions=drop], [1], [], [stderr]) | |
1168 | AT_CHECK([head -n 1 stderr | ofctl_strip], [0], | |
1169 | [OFPT_ERROR (OF1.2): OFPFMFC_TABLE_FULL | |
1170 | ]) | |
1171 | AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl | |
1172 | in_port=4 actions=NORMAL | |
1173 | in_port=5 actions=drop | |
1174 | in_port=6 actions=drop | |
1175 | in_port=7 actions=NORMAL | |
1176 | OFPST_FLOW reply (OF1.2): | |
1177 | ]) | |
1178 | OVS_VSWITCHD_STOP | |
1179 | AT_CLEANUP | |
1180 | ||
1181 | AT_SETUP([ofproto - eviction upon table overflow, with fairness (OpenFlow 1.0)]) | |
254750ce BP |
1182 | OVS_VSWITCHD_START |
1183 | # Configure a maximum of 4 flows. | |
1184 | AT_CHECK( | |
1185 | [ovs-vsctl \ | |
1186 | -- --id=@t0 create Flow_Table name=evict flow-limit=4 \ | |
1187 | overflow-policy=evict \ | |
1188 | groups='"NXM_OF_IN_PORT[[]]"' \ | |
1189 | -- set bridge br0 flow_tables:0=@t0 \ | |
5c6d0628 | 1190 | | ${PERL} $srcdir/uuidfilt.pl], |
254750ce BP |
1191 | [0], [<0> |
1192 | ]) | |
1193 | # Add 4 flows. | |
1194 | ovs-ofctl add-flows br0 - <<EOF | |
1195 | idle_timeout=10 in_port=2 dl_src=00:44:55:66:77:88 actions=drop | |
1196 | idle_timeout=20 in_port=1 dl_src=00:11:22:33:44:55 actions=drop | |
1197 | idle_timeout=30 in_port=1 dl_src=00:22:33:44:55:66 actions=drop | |
1198 | idle_timeout=40 in_port=1 dl_src=00:33:44:55:66:77 actions=drop | |
1199 | EOF | |
1200 | AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl | |
b9718b7b BP |
1201 | idle_timeout=10, in_port=2,dl_src=00:44:55:66:77:88 actions=drop |
1202 | idle_timeout=20, in_port=1,dl_src=00:11:22:33:44:55 actions=drop | |
1203 | idle_timeout=30, in_port=1,dl_src=00:22:33:44:55:66 actions=drop | |
1204 | idle_timeout=40, in_port=1,dl_src=00:33:44:55:66:77 actions=drop | |
254750ce BP |
1205 | NXST_FLOW reply: |
1206 | ]) | |
1207 | # Adding another flow will cause the one that expires soonest within | |
1208 | # the largest group (those with in_port=1) to be evicted. In this | |
1209 | # case this is not the same as the one that expires soonest overall | |
1210 | # (which is what makes the test interesting): | |
1211 | AT_CHECK([ovs-ofctl add-flow br0 in_port=2,dl_src=00:55:66:77:88:99,actions=drop]) | |
1212 | AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl | |
b9718b7b BP |
1213 | idle_timeout=10, in_port=2,dl_src=00:44:55:66:77:88 actions=drop |
1214 | idle_timeout=30, in_port=1,dl_src=00:22:33:44:55:66 actions=drop | |
1215 | idle_timeout=40, in_port=1,dl_src=00:33:44:55:66:77 actions=drop | |
254750ce BP |
1216 | in_port=2,dl_src=00:55:66:77:88:99 actions=drop |
1217 | NXST_FLOW reply: | |
1218 | ]) | |
1219 | # Enlarge the flow limit, change the eviction policy back to strictly | |
1220 | # based on expiration, and and add some flows. | |
1221 | AT_CHECK([ovs-vsctl set Flow_Table evict groups='[[]]' flow-limit=7]) | |
1222 | ovs-ofctl add-flows br0 - <<EOF | |
1223 | idle_timeout=50 in_port=2 dl_src=00:66:77:88:99:aa actions=drop | |
1224 | idle_timeout=60 in_port=2 dl_src=00:77:88:99:aa:bb actions=drop | |
1225 | idle_timeout=70 in_port=2 dl_src=00:88:99:aa:bb:cc actions=drop | |
1226 | EOF | |
1227 | AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl | |
b9718b7b BP |
1228 | idle_timeout=10, in_port=2,dl_src=00:44:55:66:77:88 actions=drop |
1229 | idle_timeout=30, in_port=1,dl_src=00:22:33:44:55:66 actions=drop | |
1230 | idle_timeout=40, in_port=1,dl_src=00:33:44:55:66:77 actions=drop | |
1231 | idle_timeout=50, in_port=2,dl_src=00:66:77:88:99:aa actions=drop | |
1232 | idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=drop | |
1233 | idle_timeout=70, in_port=2,dl_src=00:88:99:aa:bb:cc actions=drop | |
254750ce BP |
1234 | in_port=2,dl_src=00:55:66:77:88:99 actions=drop |
1235 | NXST_FLOW reply: | |
1236 | ]) | |
1237 | # Adding another flow will cause the one that expires soonest overall | |
1238 | # to be evicted. | |
1239 | AT_CHECK([ovs-ofctl add-flow br0 'idle_timeout=80 in_port=2 dl_src=00:99:aa:bb:cc:dd actions=drop']) | |
1240 | AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl | |
b9718b7b BP |
1241 | idle_timeout=30, in_port=1,dl_src=00:22:33:44:55:66 actions=drop |
1242 | idle_timeout=40, in_port=1,dl_src=00:33:44:55:66:77 actions=drop | |
1243 | idle_timeout=50, in_port=2,dl_src=00:66:77:88:99:aa actions=drop | |
1244 | idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=drop | |
1245 | idle_timeout=70, in_port=2,dl_src=00:88:99:aa:bb:cc actions=drop | |
1246 | idle_timeout=80, in_port=2,dl_src=00:99:aa:bb:cc:dd actions=drop | |
254750ce BP |
1247 | in_port=2,dl_src=00:55:66:77:88:99 actions=drop |
1248 | NXST_FLOW reply: | |
1249 | ]) | |
1250 | # Reducing the flow limit also causes the flows that expire soonest | |
1251 | # overall to be evicted. | |
1252 | AT_CHECK([ovs-vsctl set Flow_Table evict flow-limit=4]) | |
1253 | AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl | |
b9718b7b BP |
1254 | idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=drop |
1255 | idle_timeout=70, in_port=2,dl_src=00:88:99:aa:bb:cc actions=drop | |
1256 | idle_timeout=80, in_port=2,dl_src=00:99:aa:bb:cc:dd actions=drop | |
254750ce BP |
1257 | in_port=2,dl_src=00:55:66:77:88:99 actions=drop |
1258 | NXST_FLOW reply: | |
1259 | ]) | |
1260 | OVS_VSWITCHD_STOP | |
1261 | AT_CLEANUP | |
80d5aefd | 1262 | |
9dcd1c00 SH |
1263 | AT_SETUP([ofproto - eviction upon table overflow, with fairness (OpenFlow 1.2)]) |
1264 | OVS_VSWITCHD_START | |
1265 | # Configure a maximum of 4 flows. | |
1266 | AT_CHECK( | |
1267 | [ovs-vsctl \ | |
1268 | -- --id=@t0 create Flow_Table name=evict flow-limit=4 \ | |
1269 | overflow-policy=evict \ | |
1270 | groups='"NXM_OF_IN_PORT[[]]"' \ | |
1271 | -- set bridge br0 flow_tables:0=@t0 \ | |
5c6d0628 | 1272 | | ${PERL} $srcdir/uuidfilt.pl], |
9dcd1c00 SH |
1273 | [0], [<0> |
1274 | ]) | |
1275 | # Add 4 flows. | |
1276 | ovs-ofctl -O OpenFlow12 add-flows br0 - <<EOF | |
1277 | idle_timeout=10 in_port=2 dl_src=00:44:55:66:77:88 actions=drop | |
1278 | idle_timeout=20 in_port=1 dl_src=00:11:22:33:44:55 actions=drop | |
1279 | idle_timeout=30 in_port=1 dl_src=00:22:33:44:55:66 actions=drop | |
1280 | idle_timeout=40 in_port=1 dl_src=00:33:44:55:66:77 actions=drop | |
1281 | EOF | |
1282 | AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl | |
1283 | idle_timeout=10, in_port=2,dl_src=00:44:55:66:77:88 actions=drop | |
1284 | idle_timeout=20, in_port=1,dl_src=00:11:22:33:44:55 actions=drop | |
1285 | idle_timeout=30, in_port=1,dl_src=00:22:33:44:55:66 actions=drop | |
1286 | idle_timeout=40, in_port=1,dl_src=00:33:44:55:66:77 actions=drop | |
1287 | OFPST_FLOW reply (OF1.2): | |
1288 | ]) | |
1289 | # Adding another flow will cause the one that expires soonest within | |
1290 | # the largest group (those with in_port=1) to be evicted. In this | |
1291 | # case this is not the same as the one that expires soonest overall | |
1292 | # (which is what makes the test interesting): | |
1293 | AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 in_port=2,dl_src=00:55:66:77:88:99,actions=drop]) | |
1294 | AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl | |
1295 | idle_timeout=10, in_port=2,dl_src=00:44:55:66:77:88 actions=drop | |
1296 | idle_timeout=30, in_port=1,dl_src=00:22:33:44:55:66 actions=drop | |
1297 | idle_timeout=40, in_port=1,dl_src=00:33:44:55:66:77 actions=drop | |
1298 | in_port=2,dl_src=00:55:66:77:88:99 actions=drop | |
1299 | OFPST_FLOW reply (OF1.2): | |
1300 | ]) | |
1301 | # Enlarge the flow limit, change the eviction policy back to strictly | |
1302 | # based on expiration, and and add some flows. | |
1303 | AT_CHECK([ovs-vsctl set Flow_Table evict groups='[[]]' flow-limit=7]) | |
1304 | ovs-ofctl -O OpenFlow12 add-flows br0 - <<EOF | |
1305 | idle_timeout=50 in_port=2 dl_src=00:66:77:88:99:aa actions=drop | |
1306 | idle_timeout=60 in_port=2 dl_src=00:77:88:99:aa:bb actions=drop | |
1307 | idle_timeout=70 in_port=2 dl_src=00:88:99:aa:bb:cc actions=drop | |
1308 | EOF | |
1309 | AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl | |
1310 | idle_timeout=10, in_port=2,dl_src=00:44:55:66:77:88 actions=drop | |
1311 | idle_timeout=30, in_port=1,dl_src=00:22:33:44:55:66 actions=drop | |
1312 | idle_timeout=40, in_port=1,dl_src=00:33:44:55:66:77 actions=drop | |
1313 | idle_timeout=50, in_port=2,dl_src=00:66:77:88:99:aa actions=drop | |
1314 | idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=drop | |
1315 | idle_timeout=70, in_port=2,dl_src=00:88:99:aa:bb:cc actions=drop | |
1316 | in_port=2,dl_src=00:55:66:77:88:99 actions=drop | |
1317 | OFPST_FLOW reply (OF1.2): | |
1318 | ]) | |
1319 | # Adding another flow will cause the one that expires soonest overall | |
1320 | # to be evicted. | |
1321 | AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 'idle_timeout=80 in_port=2 dl_src=00:99:aa:bb:cc:dd actions=drop']) | |
1322 | AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl | |
1323 | idle_timeout=30, in_port=1,dl_src=00:22:33:44:55:66 actions=drop | |
1324 | idle_timeout=40, in_port=1,dl_src=00:33:44:55:66:77 actions=drop | |
1325 | idle_timeout=50, in_port=2,dl_src=00:66:77:88:99:aa actions=drop | |
1326 | idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=drop | |
1327 | idle_timeout=70, in_port=2,dl_src=00:88:99:aa:bb:cc actions=drop | |
1328 | idle_timeout=80, in_port=2,dl_src=00:99:aa:bb:cc:dd actions=drop | |
1329 | in_port=2,dl_src=00:55:66:77:88:99 actions=drop | |
1330 | OFPST_FLOW reply (OF1.2): | |
1331 | ]) | |
1332 | # Reducing the flow limit also causes the flows that expire soonest | |
1333 | # overall to be evicted. | |
1334 | AT_CHECK([ovs-vsctl set Flow_Table evict flow-limit=4]) | |
1335 | AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl | |
1336 | idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=drop | |
1337 | idle_timeout=70, in_port=2,dl_src=00:88:99:aa:bb:cc actions=drop | |
1338 | idle_timeout=80, in_port=2,dl_src=00:99:aa:bb:cc:dd actions=drop | |
1339 | in_port=2,dl_src=00:55:66:77:88:99 actions=drop | |
1340 | OFPST_FLOW reply (OF1.2): | |
1341 | ]) | |
1342 | OVS_VSWITCHD_STOP | |
1343 | AT_CLEANUP | |
1344 | ||
1345 | AT_SETUP([ofproto - asynchronous message control (OpenFlow 1.0)]) | |
80d5aefd BP |
1346 | OVS_VSWITCHD_START |
1347 | AT_CHECK([ovs-ofctl -P openflow10 monitor br0 --detach --no-chdir --pidfile]) | |
1348 | check_async () { | |
1349 | printf '\n\n--- check_async %d ---\n\n\n' $1 | |
1350 | shift | |
1351 | ||
6fc67c4f | 1352 | ovs-appctl -t ovs-ofctl ofctl/barrier |
80d5aefd BP |
1353 | ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log |
1354 | : > expout | |
1355 | ||
a7349929 | 1356 | # OFPT_PACKET_IN, OFPR_ACTION (controller_id=0) |
7f05e7ab | 1357 | ovs-ofctl -v packet-out br0 controller controller '0001020304050010203040501234' |
80d5aefd | 1358 | if test X"$1" = X"OFPR_ACTION"; then shift; |
7f05e7ab | 1359 | echo >>expout "OFPT_PACKET_IN: total_len=14 in_port=CONTROLLER (via action) data_len=14 (unbuffered) |
3f78c3cc | 1360 | metadata=0,in_port=0,vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1234" |
80d5aefd BP |
1361 | fi |
1362 | ||
a7349929 | 1363 | # OFPT_PACKET_IN, OFPR_NO_MATCH (controller_id=123) |
7f05e7ab | 1364 | ovs-ofctl -v packet-out br0 controller 'controller(reason=no_match,id=123)' '0001020304050010203040501234' |
a7349929 | 1365 | if test X"$1" = X"OFPR_NO_MATCH"; then shift; |
7f05e7ab | 1366 | echo >>expout "OFPT_PACKET_IN: total_len=14 in_port=CONTROLLER (via no_match) data_len=14 (unbuffered) |
3f78c3cc | 1367 | metadata=0,in_port=0,vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1234" |
a7349929 BP |
1368 | fi |
1369 | ||
1370 | # OFPT_PACKET_IN, OFPR_INVALID_TTL (controller_id=0) | |
7f05e7ab | 1371 | ovs-ofctl packet-out br0 controller dec_ttl '002583dfb4000026b98cb0f908004500003fb7e200000011339bac11370dac100002d7730035002b8f6d86fb0100000100000000000006626c702d7873066e696369726103636f6d00000f00' |
80d5aefd | 1372 | if test X"$1" = X"OFPR_INVALID_TTL"; then shift; |
7f05e7ab | 1373 | echo >>expout "OFPT_PACKET_IN: total_len=76 in_port=CONTROLLER (via invalid_ttl) data_len=76 (unbuffered) |
3f78c3cc | 1374 | udp,metadata=0,in_port=0,vlan_tci=0x0000,dl_src=00:26:b9:8c:b0:f9,dl_dst=00:25:83:df:b4:00,nw_src=172.17.55.13,nw_dst=172.16.0.2,nw_tos=0,nw_ecn=0,nw_ttl=0,tp_src=55155,tp_dst=53 udp_csum:8f6d" |
80d5aefd BP |
1375 | fi |
1376 | ||
1377 | # OFPT_PORT_STATUS, OFPPR_ADD | |
e1b1d06a | 1378 | ovs-vsctl add-port br0 test -- set Interface test type=dummy ofport_request=1 |
80d5aefd BP |
1379 | if test X"$1" = X"OFPPR_ADD"; then shift; |
1380 | echo >>expout "OFPT_PORT_STATUS: ADD: 1(test): addr:aa:55:aa:55:00:0x | |
1381 | config: PORT_DOWN | |
9e1fd49b | 1382 | state: LINK_DOWN |
d02a5f8e | 1383 | speed: 0 Mbps now, 0 Mbps max" |
80d5aefd BP |
1384 | fi |
1385 | ||
1386 | # OFPT_PORT_STATUS, OFPPR_DELETE | |
1387 | ovs-vsctl del-port br0 test | |
1388 | if test X"$1" = X"OFPPR_DELETE"; then shift; | |
1389 | echo >>expout "OFPT_PORT_STATUS: DEL: 1(test): addr:aa:55:aa:55:00:0x | |
1390 | config: PORT_DOWN | |
9e1fd49b | 1391 | state: LINK_DOWN |
d02a5f8e | 1392 | speed: 0 Mbps now, 0 Mbps max" |
80d5aefd BP |
1393 | fi |
1394 | ||
1395 | # OFPT_FLOW_REMOVED, OFPRR_DELETE | |
1396 | ovs-ofctl add-flow br0 send_flow_rem,actions=drop | |
1397 | ovs-ofctl --strict del-flows br0 '' | |
1398 | if test X"$1" = X"OFPRR_DELETE"; then shift; | |
1399 | echo >>expout "OFPT_FLOW_REMOVED: reason=delete" | |
1400 | fi | |
1401 | AT_FAIL_IF([test X"$1" != X]) | |
1402 | ||
1403 | ovs-appctl -t ovs-ofctl ofctl/barrier | |
fd0aa9ea | 1404 | echo >>expout "OFPT_BARRIER_REPLY:" |
80d5aefd BP |
1405 | |
1406 | AT_CHECK( | |
1407 | [[sed ' | |
1408 | s/ (xid=0x[0-9a-fA-F]*)// | |
1409 | s/ *duration.*// | |
1410 | s/00:0.$/00:0x/' < monitor.log]], | |
1411 | [0], [expout]) | |
1412 | } | |
1413 | ||
1414 | # It's a service connection so initially there should be no async messages. | |
1415 | check_async 1 | |
1416 | ||
99811d07 | 1417 | # Set miss_send_len to 128, turning on packet-ins for our service connection. |
80d5aefd BP |
1418 | ovs-appctl -t ovs-ofctl ofctl/send 0109000c0123456700000080 |
1419 | check_async 2 OFPR_ACTION OFPPR_ADD OFPPR_DELETE OFPRR_DELETE | |
1420 | ||
1421 | # Set miss_send_len to 128 and enable invalid_ttl. | |
1422 | ovs-appctl -t ovs-ofctl ofctl/send 0109000c0123456700040080 | |
1423 | check_async 3 OFPR_ACTION OFPR_INVALID_TTL OFPPR_ADD OFPPR_DELETE OFPRR_DELETE | |
1424 | ||
1425 | # Become slave, which should disable everything except port status. | |
1426 | ovs-appctl -t ovs-ofctl ofctl/send 0104001400000002000023200000000a00000002 | |
1427 | check_async 4 OFPPR_ADD OFPPR_DELETE | |
1428 | ||
1429 | # Use NXT_SET_ASYNC_CONFIG to enable a patchwork of asynchronous messages. | |
1430 | ovs-appctl -t ovs-ofctl ofctl/send 01040028000000020000232000000013000000020000000500000005000000020000000200000005 | |
1431 | check_async 5 OFPR_INVALID_TTL OFPPR_DELETE OFPRR_DELETE | |
1432 | ||
a7349929 BP |
1433 | # Set controller ID 123. |
1434 | ovs-appctl -t ovs-ofctl ofctl/send 01040018000000030000232000000014000000000000007b | |
1435 | check_async 6 OFPR_NO_MATCH OFPPR_DELETE OFPRR_DELETE | |
1436 | ||
1437 | # Restore controller ID 0. | |
1438 | ovs-appctl -t ovs-ofctl ofctl/send 010400180000000300002320000000140000000000000000 | |
1439 | ||
80d5aefd BP |
1440 | # Become master. |
1441 | ovs-appctl -t ovs-ofctl ofctl/send 0104001400000002000023200000000a00000001 | |
a7349929 | 1442 | check_async 7 OFPR_ACTION OFPPR_ADD |
80d5aefd BP |
1443 | |
1444 | ovs-appctl -t ovs-ofctl exit | |
94c33672 | 1445 | OVS_VSWITCHD_STOP |
80d5aefd | 1446 | AT_CLEANUP |
751c7785 | 1447 | |
9dcd1c00 SH |
1448 | AT_SETUP([ofproto - asynchronous message control (OpenFlow 1.2)]) |
1449 | OVS_VSWITCHD_START | |
1450 | AT_CHECK([ovs-ofctl -O OpenFlow12 monitor br0 --detach --no-chdir --pidfile]) | |
1451 | check_async () { | |
1452 | printf '\n\n--- check_async %d ---\n\n\n' $1 | |
1453 | INDEX=$1 | |
1454 | shift | |
1455 | ||
1456 | ovs-appctl -t ovs-ofctl ofctl/barrier | |
1457 | ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log | |
1458 | : > expout | |
1459 | ||
1460 | # OFPT_PACKET_IN, OFPR_ACTION (controller_id=0) | |
1461 | ovs-ofctl -O OpenFlow12 -v packet-out br0 none controller '0001020304050010203040501234' | |
1462 | if test X"$1" = X"OFPR_ACTION"; then shift; | |
1463 | echo >>expout "OFPT_PACKET_IN (OF1.2): total_len=14 in_port=ANY (via action) data_len=14 (unbuffered) | |
1464 | metadata=0,in_port=0,vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1234" | |
1465 | fi | |
1466 | ||
1467 | # OFPT_PACKET_IN, OFPR_NO_MATCH (controller_id=123) | |
1468 | ovs-ofctl -O OpenFlow12 -v packet-out br0 none 'controller(reason=no_match,id=123)' '0001020304050010203040501234' | |
1469 | if test X"$1" = X"OFPR_NO_MATCH"; then shift; | |
1470 | echo >>expout "OFPT_PACKET_IN (OF1.2): total_len=14 in_port=ANY (via no_match) data_len=14 (unbuffered) | |
1471 | metadata=0,in_port=0,vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1234" | |
1472 | fi | |
1473 | ||
1474 | # OFPT_PACKET_IN, OFPR_INVALID_TTL (controller_id=0) | |
1475 | ovs-ofctl -O OpenFlow12 packet-out br0 none dec_ttl '002583dfb4000026b98cb0f908004500003fb7e200000011339bac11370dac100002d7730035002b8f6d86fb0100000100000000000006626c702d7873066e696369726103636f6d00000f00' | |
1476 | if test X"$1" = X"OFPR_INVALID_TTL"; then shift; | |
1477 | echo >>expout "OFPT_PACKET_IN (OF1.2): total_len=76 in_port=ANY (via invalid_ttl) data_len=76 (unbuffered) | |
1478 | udp,metadata=0,in_port=0,vlan_tci=0x0000,dl_src=00:26:b9:8c:b0:f9,dl_dst=00:25:83:df:b4:00,nw_src=172.17.55.13,nw_dst=172.16.0.2,nw_tos=0,nw_ecn=0,nw_ttl=0,tp_src=55155,tp_dst=53 udp_csum:8f6d" | |
1479 | fi | |
1480 | ||
1481 | # OFPT_PORT_STATUS, OFPPR_ADD | |
1482 | ovs-vsctl add-port br0 test -- set Interface test type=dummy | |
1483 | if test X"$1" = X"OFPPR_ADD"; then shift; | |
1484 | echo >>expout "OFPT_PORT_STATUS (OF1.2): ADD: ${INDEX}(test): addr:aa:55:aa:55:00:0x | |
1485 | config: PORT_DOWN | |
1486 | state: LINK_DOWN | |
1487 | speed: 0 Mbps now, 0 Mbps max" | |
1488 | fi | |
1489 | ||
1490 | # OFPT_PORT_STATUS, OFPPR_DELETE | |
1491 | ovs-vsctl del-port br0 test | |
1492 | if test X"$1" = X"OFPPR_DELETE"; then shift; | |
1493 | echo >>expout "OFPT_PORT_STATUS (OF1.2): DEL: ${INDEX}(test): addr:aa:55:aa:55:00:0x | |
1494 | config: PORT_DOWN | |
1495 | state: LINK_DOWN | |
1496 | speed: 0 Mbps now, 0 Mbps max" | |
1497 | fi | |
1498 | ||
1499 | # OFPT_FLOW_REMOVED, OFPRR_DELETE | |
1500 | ovs-ofctl -O OpenFlow12 add-flow br0 send_flow_rem,actions=drop | |
1501 | ovs-ofctl -O OpenFlow12 --strict del-flows br0 '' | |
1502 | if test X"$1" = X"OFPRR_DELETE"; then shift; | |
1503 | echo >>expout "OFPT_FLOW_REMOVED (OF1.2): reason=delete table_id=0" | |
1504 | fi | |
1505 | AT_FAIL_IF([test X"$1" != X]) | |
1506 | ||
1507 | ovs-appctl -t ovs-ofctl ofctl/barrier | |
1508 | echo >>expout "OFPT_BARRIER_REPLY (OF1.2):" | |
1509 | ||
1510 | AT_CHECK( | |
1511 | [[sed ' | |
1512 | s/ (xid=0x[0-9a-fA-F]*)// | |
1513 | s/ *duration.*// | |
1514 | s/00:0.$/00:0x/' < monitor.log]], | |
1515 | [0], [expout]) | |
1516 | } | |
1517 | ||
1518 | # It's a service connection so initially there should be no async messages. | |
1519 | check_async 1 | |
1520 | ||
1521 | # Set miss_send_len to 128, turning on packet-ins for our service connection. | |
1522 | ovs-appctl -t ovs-ofctl ofctl/send 0309000c0123456700000080 | |
1523 | check_async 2 OFPR_ACTION OFPPR_ADD OFPPR_DELETE OFPRR_DELETE | |
1524 | ||
1525 | # Set miss_send_len to 128 and enable invalid_ttl. | |
1526 | ovs-appctl -t ovs-ofctl ofctl/send 0309000c0123456700040080 | |
1527 | check_async 3 OFPR_ACTION OFPR_INVALID_TTL OFPPR_ADD OFPPR_DELETE OFPRR_DELETE | |
1528 | ||
6ea4776b JR |
1529 | # Become slave (OF 1.2), which should disable everything except port status. |
1530 | ovs-appctl -t ovs-ofctl ofctl/send 031800180000000200000003000000000000000000000001 | |
9dcd1c00 SH |
1531 | check_async 4 OFPPR_ADD OFPPR_DELETE |
1532 | ||
1533 | # Use NXT_SET_ASYNC_CONFIG to enable a patchwork of asynchronous messages. | |
1534 | ovs-appctl -t ovs-ofctl ofctl/send 03040028000000020000232000000013000000020000000500000005000000020000000200000005 | |
1535 | check_async 5 OFPR_INVALID_TTL OFPPR_DELETE OFPRR_DELETE | |
1536 | ||
1537 | # Set controller ID 123. | |
1538 | ovs-appctl -t ovs-ofctl ofctl/send 03040018000000030000232000000014000000000000007b | |
1539 | check_async 6 OFPR_NO_MATCH OFPPR_DELETE OFPRR_DELETE | |
1540 | ||
1541 | # Restore controller ID 0. | |
1542 | ovs-appctl -t ovs-ofctl ofctl/send 030400180000000300002320000000140000000000000000 | |
1543 | ||
6ea4776b JR |
1544 | # Become master (OF 1.2). |
1545 | ovs-appctl -t ovs-ofctl ofctl/send 031800180000000400000002000000000000000000000002 | |
9dcd1c00 SH |
1546 | check_async 7 OFPR_ACTION OFPPR_ADD |
1547 | ||
1548 | ovs-appctl -t ovs-ofctl exit | |
1549 | OVS_VSWITCHD_STOP | |
1550 | AT_CLEANUP | |
1551 | ||
b21eb1da JR |
1552 | AT_SETUP([ofproto - asynchronous message control (OpenFlow 1.3)]) |
1553 | OVS_VSWITCHD_START | |
1554 | AT_CHECK([ovs-ofctl -O OpenFlow13 monitor br0 --detach --no-chdir --pidfile]) | |
1555 | check_async () { | |
1556 | printf '\n\n--- check_async %d ---\n\n\n' $1 | |
1557 | INDEX=$1 | |
1558 | shift | |
1559 | ||
1560 | ovs-appctl -t ovs-ofctl ofctl/barrier | |
1561 | ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log | |
1562 | : > expout | |
1563 | ||
1564 | # OFPT_PACKET_IN, OFPR_ACTION (controller_id=0) | |
1565 | ovs-ofctl -O OpenFlow13 -v packet-out br0 none controller '0001020304050010203040501234' | |
1566 | if test X"$1" = X"OFPR_ACTION"; then shift; | |
1567 | echo >>expout "OFPT_PACKET_IN (OF1.3): total_len=14 in_port=ANY (via action) data_len=14 (unbuffered) | |
1568 | metadata=0,in_port=0,vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1234" | |
1569 | fi | |
1570 | ||
1571 | # OFPT_PACKET_IN, OFPR_NO_MATCH (controller_id=123) | |
1572 | ovs-ofctl -O OpenFlow13 -v packet-out br0 none 'controller(reason=no_match,id=123)' '0001020304050010203040501234' | |
1573 | if test X"$1" = X"OFPR_NO_MATCH"; then shift; | |
1574 | echo >>expout "OFPT_PACKET_IN (OF1.3): total_len=14 in_port=ANY (via no_match) data_len=14 (unbuffered) | |
1575 | metadata=0,in_port=0,vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1234" | |
1576 | fi | |
1577 | ||
1578 | # OFPT_PACKET_IN, OFPR_INVALID_TTL (controller_id=0) | |
1579 | ovs-ofctl -O OpenFlow13 packet-out br0 none dec_ttl '002583dfb4000026b98cb0f908004500003fb7e200000011339bac11370dac100002d7730035002b8f6d86fb0100000100000000000006626c702d7873066e696369726103636f6d00000f00' | |
1580 | if test X"$1" = X"OFPR_INVALID_TTL"; then shift; | |
1581 | echo >>expout "OFPT_PACKET_IN (OF1.3): total_len=76 in_port=ANY (via invalid_ttl) data_len=76 (unbuffered) | |
1582 | udp,metadata=0,in_port=0,vlan_tci=0x0000,dl_src=00:26:b9:8c:b0:f9,dl_dst=00:25:83:df:b4:00,nw_src=172.17.55.13,nw_dst=172.16.0.2,nw_tos=0,nw_ecn=0,nw_ttl=0,tp_src=55155,tp_dst=53 udp_csum:8f6d" | |
1583 | fi | |
1584 | ||
1585 | # OFPT_PORT_STATUS, OFPPR_ADD | |
1586 | ovs-vsctl add-port br0 test -- set Interface test type=dummy | |
1587 | if test X"$1" = X"OFPPR_ADD"; then shift; | |
1588 | echo >>expout "OFPT_PORT_STATUS (OF1.3): ADD: ${INDEX}(test): addr:aa:55:aa:55:00:0x | |
1589 | config: PORT_DOWN | |
1590 | state: LINK_DOWN | |
1591 | speed: 0 Mbps now, 0 Mbps max" | |
1592 | fi | |
1593 | ||
1594 | # OFPT_PORT_STATUS, OFPPR_DELETE | |
1595 | ovs-vsctl del-port br0 test | |
1596 | if test X"$1" = X"OFPPR_DELETE"; then shift; | |
1597 | echo >>expout "OFPT_PORT_STATUS (OF1.3): DEL: ${INDEX}(test): addr:aa:55:aa:55:00:0x | |
1598 | config: PORT_DOWN | |
1599 | state: LINK_DOWN | |
1600 | speed: 0 Mbps now, 0 Mbps max" | |
1601 | fi | |
1602 | ||
1603 | # OFPT_FLOW_REMOVED, OFPRR_DELETE | |
1604 | ovs-ofctl -O OpenFlow13 add-flow br0 send_flow_rem,actions=drop | |
1605 | ovs-ofctl -O OpenFlow13 --strict del-flows br0 '' | |
1606 | if test X"$1" = X"OFPRR_DELETE"; then shift; | |
1607 | echo >>expout "OFPT_FLOW_REMOVED (OF1.3): reason=delete table_id=0" | |
1608 | fi | |
1609 | AT_FAIL_IF([test X"$1" != X]) | |
1610 | ||
1611 | ovs-appctl -t ovs-ofctl ofctl/barrier | |
1612 | echo >>expout "OFPT_BARRIER_REPLY (OF1.3):" | |
1613 | ||
1614 | AT_CHECK( | |
1615 | [[sed ' | |
1616 | s/ (xid=0x[0-9a-fA-F]*)// | |
1617 | s/ *duration.*// | |
1618 | s/00:0.$/00:0x/' < monitor.log]], | |
1619 | [0], [expout]) | |
1620 | } | |
1621 | ||
1622 | # It's a service connection so initially there should be no async messages. | |
1623 | check_async 1 | |
1624 | ||
1625 | # Set miss_send_len to 128, turning on packet-ins for our service connection. | |
1626 | ovs-appctl -t ovs-ofctl ofctl/send 0409000c0123456700000080 | |
1627 | check_async 2 OFPR_ACTION OFPPR_ADD OFPPR_DELETE OFPRR_DELETE | |
1628 | ||
1629 | # Become slave (OF 1.3), which should disable everything except port status. | |
1630 | ovs-appctl -t ovs-ofctl ofctl/send 041800180000000200000003000000000000000000000001 | |
1631 | check_async 3 OFPPR_ADD OFPPR_DELETE | |
1632 | ||
1633 | # Use OF 1.3 OFPT_SET_ASYNC to enable a patchwork of asynchronous messages. | |
1634 | ovs-appctl -t ovs-ofctl ofctl/send 041c002000000002000000020000000500000005000000020000000200000005 | |
1635 | check_async 4 OFPR_INVALID_TTL OFPPR_DELETE OFPRR_DELETE | |
1636 | ||
1637 | # Set controller ID 123. | |
1638 | ovs-appctl -t ovs-ofctl ofctl/send 04040018000000030000232000000014000000000000007b | |
1639 | check_async 5 OFPR_NO_MATCH OFPPR_DELETE OFPRR_DELETE | |
1640 | ||
1641 | # Restore controller ID 0. | |
1642 | ovs-appctl -t ovs-ofctl ofctl/send 040400180000000300002320000000140000000000000000 | |
1643 | ||
1644 | # Become master (OF 1.3). | |
1645 | ovs-appctl -t ovs-ofctl ofctl/send 041800180000000400000002000000000000000000000002 | |
1646 | check_async 6 OFPR_ACTION OFPPR_ADD | |
1647 | ||
1648 | ovs-appctl -t ovs-ofctl exit | |
1649 | OVS_VSWITCHD_STOP | |
1650 | AT_CLEANUP | |
1651 | ||
6ea4776b JR |
1652 | dnl This test checks that the role request/response messaging works |
1653 | dnl and that generation_id is handled properly. | |
1654 | AT_SETUP([ofproto - controller role (OpenFlow 1.2)]) | |
1655 | OVS_VSWITCHD_START | |
1656 | AT_CHECK([ovs-ofctl -O OpenFlow12 monitor br0 --detach --no-chdir --pidfile]) | |
1657 | ||
1658 | ovs-appctl -t ovs-ofctl ofctl/barrier | |
1659 | ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log | |
1660 | : > expout | |
1661 | ||
1662 | # find out current role | |
1663 | ovs-appctl -t ovs-ofctl ofctl/send 031800180000000200000000000000000000000000000000 | |
1664 | echo >>expout "send: OFPT_ROLE_REQUEST (OF1.2) (xid=0x2): role=nochange" | |
1665 | echo >>expout "OFPT_ROLE_REPLY (OF1.2) (xid=0x2): role=equal" | |
1666 | ||
1667 | # Become slave (generation_id is initially undefined, so 2^63+2 should not be stale) | |
1668 | ovs-appctl -t ovs-ofctl ofctl/send 031800180000000300000003000000008000000000000002 | |
1669 | echo >>expout "send: OFPT_ROLE_REQUEST (OF1.2) (xid=0x3): role=slave generation_id=9223372036854775810" | |
147cc9d3 | 1670 | echo >>expout "OFPT_ROLE_REPLY (OF1.2) (xid=0x3): role=slave generation_id=9223372036854775810" |
6ea4776b JR |
1671 | |
1672 | # Try to become the master using a stale generation ID | |
1673 | ovs-appctl -t ovs-ofctl ofctl/send 031800180000000400000002000000000000000000000002 | |
1674 | echo >>expout "send: OFPT_ROLE_REQUEST (OF1.2) (xid=0x4): role=master generation_id=2" | |
1675 | echo >>expout "OFPT_ERROR (OF1.2) (xid=0x4): OFPRRFC_STALE" | |
1676 | echo >>expout "OFPT_ROLE_REQUEST (OF1.2) (xid=0x4): role=master generation_id=2" | |
1677 | ||
1678 | # Become master using a valid generation ID | |
1679 | ovs-appctl -t ovs-ofctl ofctl/send 031800180000000500000002000000000000000000000001 | |
1680 | echo >>expout "send: OFPT_ROLE_REQUEST (OF1.2) (xid=0x5): role=master generation_id=1" | |
147cc9d3 | 1681 | echo >>expout "OFPT_ROLE_REPLY (OF1.2) (xid=0x5): role=master generation_id=1" |
6ea4776b JR |
1682 | ovs-appctl -t ovs-ofctl ofctl/barrier |
1683 | echo >>expout "OFPT_BARRIER_REPLY (OF1.2) (xid=0x3):" | |
1684 | ||
1685 | AT_CHECK([cat monitor.log], [0], [expout]) | |
1686 | ||
1687 | ovs-appctl -t ovs-ofctl exit | |
1688 | OVS_VSWITCHD_STOP | |
1689 | AT_CLEANUP | |
1690 | ||
751c7785 BP |
1691 | dnl This test checks that OFPT_PACKET_OUT accepts both OFPP_NONE (as |
1692 | dnl specified by OpenFlow 1.0) and OFPP_CONTROLLER (used by some | |
1693 | dnl controllers despite the spec) as meaning a packet that was generated | |
1694 | dnl by the controller. | |
9dcd1c00 | 1695 | AT_SETUP([ofproto - packet-out from controller (OpenFlow 1.0)]) |
751c7785 | 1696 | OVS_VSWITCHD_START |
586ddea5 | 1697 | ADD_OF_PORTS([br0], [1]) |
751c7785 BP |
1698 | |
1699 | # Start a monitor listening for packet-ins. | |
1700 | AT_CHECK([ovs-ofctl -P openflow10 monitor br0 --detach --no-chdir --pidfile]) | |
1701 | ovs-appctl -t ovs-ofctl ofctl/send 0109000c0123456700000080 | |
1702 | ovs-appctl -t ovs-ofctl ofctl/barrier | |
1703 | ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log | |
1704 | AT_CAPTURE_FILE([monitor.log]) | |
1705 | ||
1706 | # Send some packet-outs with OFPP_NONE and OFPP_CONTROLLER (65533) as in_port. | |
586ddea5 BP |
1707 | AT_CHECK([ovs-ofctl packet-out br0 none controller,1 '0001020304050010203040501234']) |
1708 | AT_CHECK([ovs-ofctl packet-out br0 controller controller,1 '0001020304050010203040505678']) | |
751c7785 BP |
1709 | |
1710 | # Stop the monitor and check its output. | |
1711 | ovs-appctl -t ovs-ofctl ofctl/barrier | |
1712 | ovs-appctl -t ovs-ofctl exit | |
1713 | ||
586ddea5 BP |
1714 | ovs-ofctl dump-ports br0 |
1715 | ||
751c7785 | 1716 | AT_CHECK([sed 's/ (xid=0x[[0-9a-fA-F]]*)//' monitor.log], [0], [dnl |
7f05e7ab | 1717 | OFPT_PACKET_IN: total_len=14 in_port=ANY (via action) data_len=14 (unbuffered) |
3f78c3cc | 1718 | metadata=0,in_port=0,vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1234 |
751c7785 | 1719 | OFPT_PACKET_IN: total_len=14 in_port=CONTROLLER (via action) data_len=14 (unbuffered) |
3f78c3cc | 1720 | metadata=0,in_port=0,vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x5678 |
969fc56c JS |
1721 | OFPT_BARRIER_REPLY: |
1722 | ]) | |
1723 | ||
1724 | OVS_VSWITCHD_STOP | |
1725 | AT_CLEANUP | |
1726 | ||
9dcd1c00 SH |
1727 | dnl This test checks that OFPT_PACKET_OUT accepts both OFPP_NONE (as |
1728 | dnl specified by OpenFlow 1.2) and OFPP_CONTROLLER (used by some | |
1729 | dnl controllers despite the spec) as meaning a packet that was generated | |
1730 | dnl by the controller. | |
1731 | AT_SETUP([ofproto - packet-out from controller (OpenFlow 1.2)]) | |
1732 | OVS_VSWITCHD_START | |
1733 | ||
1734 | # Start a monitor listening for packet-ins. | |
1735 | AT_CHECK([ovs-ofctl -O OpenFlow12 monitor br0 --detach --no-chdir --pidfile]) | |
1736 | ovs-appctl -t ovs-ofctl ofctl/send 0309000c0123456700000080 | |
1737 | ovs-appctl -t ovs-ofctl ofctl/barrier | |
1738 | ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log | |
1739 | AT_CAPTURE_FILE([monitor.log]) | |
1740 | ||
1741 | # Send some packet-outs with OFPP_NONE and OFPP_CONTROLLER (65533) as in_port. | |
1742 | AT_CHECK([ovs-ofctl -O OpenFlow12 packet-out br0 none controller '0001020304050010203040501234']) | |
1743 | AT_CHECK([ovs-ofctl -O OpenFlow12 packet-out br0 4294967293 controller '0001020304050010203040505678']) | |
1744 | ||
1745 | # Stop the monitor and check its output. | |
1746 | ovs-appctl -t ovs-ofctl ofctl/barrier | |
1747 | ovs-appctl -t ovs-ofctl exit | |
1748 | ||
1749 | AT_CHECK([sed 's/ (xid=0x[[0-9a-fA-F]]*)//' monitor.log], [0], [dnl | |
1750 | OFPT_PACKET_IN (OF1.2): total_len=14 in_port=ANY (via action) data_len=14 (unbuffered) | |
1751 | metadata=0,in_port=0,vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1234 | |
1752 | OFPT_PACKET_IN (OF1.2): total_len=14 in_port=CONTROLLER (via action) data_len=14 (unbuffered) | |
1753 | metadata=0,in_port=0,vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x5678 | |
1754 | OFPT_BARRIER_REPLY (OF1.2): | |
1755 | ]) | |
1756 | ||
1757 | OVS_VSWITCHD_STOP | |
1758 | AT_CLEANUP | |
1759 | ||
4d197ebb BP |
1760 | dnl This test checks that OFPT_PACKET_OUT accepts both OFPP_NONE (as |
1761 | dnl specified by OpenFlow 1.1) and OFPP_CONTROLLER (used by some | |
1762 | dnl controllers despite the spec) as meaning a packet that was generated | |
1763 | dnl by the controller. | |
1764 | AT_SETUP([ofproto - packet-out from controller (OpenFlow 1.1)]) | |
1765 | OVS_VSWITCHD_START | |
1766 | ||
1767 | # Start a monitor listening for packet-ins. | |
1768 | AT_CHECK([ovs-ofctl -O OpenFlow11 monitor br0 --detach --no-chdir --pidfile]) | |
1769 | ovs-appctl -t ovs-ofctl ofctl/send 0209000c0123456700000080 | |
1770 | ovs-appctl -t ovs-ofctl ofctl/barrier | |
1771 | ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log | |
1772 | AT_CAPTURE_FILE([monitor.log]) | |
1773 | ||
1774 | # Send some packet-outs with OFPP_NONE and OFPP_CONTROLLER (65533) as in_port. | |
1775 | AT_CHECK([ovs-ofctl -O OpenFlow11 packet-out br0 none controller '0001020304050010203040501234']) | |
1776 | AT_CHECK([ovs-ofctl -O OpenFlow11 packet-out br0 4294967293 controller '0001020304050010203040505678']) | |
1777 | ||
1778 | # Stop the monitor and check its output. | |
1779 | ovs-appctl -t ovs-ofctl ofctl/barrier | |
1780 | ovs-appctl -t ovs-ofctl exit | |
1781 | ||
1782 | AT_CHECK([sed 's/ (xid=0x[[0-9a-fA-F]]*)//' monitor.log], [0], [dnl | |
1783 | OFPT_PACKET_IN (OF1.1): total_len=14 in_port=ANY (via action) data_len=14 (unbuffered) | |
1784 | metadata=0,in_port=0,vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1234 | |
1785 | OFPT_PACKET_IN (OF1.1): total_len=14 in_port=CONTROLLER (via action) data_len=14 (unbuffered) | |
1786 | metadata=0,in_port=0,vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x5678 | |
1787 | OFPT_BARRIER_REPLY (OF1.1): | |
1788 | ]) | |
1789 | ||
1790 | OVS_VSWITCHD_STOP | |
1791 | AT_CLEANUP | |
1792 | ||
969fc56c JS |
1793 | dnl This test checks that metadata is encoded in packet_in structures, |
1794 | dnl supported by NXAST. | |
1795 | AT_SETUP([ofproto - packet-out with metadata (NXM)]) | |
1796 | OVS_VSWITCHD_START | |
1797 | ||
1798 | # Start a monitor listening for packet-ins. | |
1799 | AT_CHECK([ovs-ofctl -P nxm monitor br0 --detach --no-chdir --pidfile]) | |
1800 | ovs-appctl -t ovs-ofctl ofctl/send 0109000c0123456700000080 | |
1801 | ovs-appctl -t ovs-ofctl ofctl/barrier | |
1802 | ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log | |
1803 | AT_CAPTURE_FILE([monitor.log]) | |
1804 | ||
1805 | # Send a packet-out with a load action to set some metadata, and forward to controller | |
ac923e91 | 1806 | AT_CHECK([ovs-ofctl packet-out br0 controller 'load(0xfafafafa5a5a5a5a->OXM_OF_METADATA[[0..63]]), load(0xaa->NXM_NX_PKT_MARK[[]]), controller' '0001020304050010203040501234']) |
969fc56c JS |
1807 | |
1808 | # Stop the monitor and check its output. | |
1809 | ovs-appctl -t ovs-ofctl ofctl/barrier | |
1810 | ovs-appctl -t ovs-ofctl exit | |
1811 | ||
1812 | AT_CHECK([sed 's/ (xid=0x[[0-9a-fA-F]]*)//' monitor.log], [0], [dnl | |
ac923e91 | 1813 | NXT_PACKET_IN: total_len=14 in_port=CONTROLLER metadata=0xfafafafa5a5a5a5a pkt_mark=0xaa (via action) data_len=14 (unbuffered) |
3f78c3cc | 1814 | metadata=0,in_port=0,vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1234 |
751c7785 BP |
1815 | OFPT_BARRIER_REPLY: |
1816 | ]) | |
1817 | ||
1818 | OVS_VSWITCHD_STOP | |
1819 | AT_CLEANUP | |
2b07c8b1 | 1820 | |
9dcd1c00 SH |
1821 | dnl This test checks that metadata is encoded in packet_in structures, |
1822 | dnl supported by NXAST. | |
1823 | AT_SETUP([ofproto - packet-out with metadata (OpenFlow 1.2)]) | |
1824 | OVS_VSWITCHD_START | |
1825 | ||
1826 | # Start a monitor listening for packet-ins. | |
1827 | AT_CHECK([ovs-ofctl -O OpenFlow12 monitor br0 --detach --no-chdir --pidfile]) | |
1828 | ovs-appctl -t ovs-ofctl ofctl/send 0309000c0123456700000080 | |
1829 | ovs-appctl -t ovs-ofctl ofctl/barrier | |
1830 | ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log | |
1831 | AT_CAPTURE_FILE([monitor.log]) | |
1832 | ||
1833 | # Send a packet-out with a load action to set some metadata, and forward to controller | |
1834 | AT_CHECK([ovs-ofctl -O OpenFlow12 packet-out br0 none 'load(0xfafafafa5a5a5a5a->OXM_OF_METADATA[[0..63]]), controller' '0001020304050010203040501234']) | |
1835 | ||
1836 | # Stop the monitor and check its output. | |
1837 | ovs-appctl -t ovs-ofctl ofctl/barrier | |
1838 | ovs-appctl -t ovs-ofctl exit | |
1839 | ||
1840 | AT_CHECK([sed 's/ (xid=0x[[0-9a-fA-F]]*)//' monitor.log], [0], [dnl | |
1841 | OFPT_PACKET_IN (OF1.2): total_len=14 in_port=ANY metadata=0xfafafafa5a5a5a5a (via action) data_len=14 (unbuffered) | |
0ad90c84 JR |
1842 | metadata=0,in_port=0,vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1234 |
1843 | OFPT_BARRIER_REPLY (OF1.2): | |
1844 | ]) | |
1845 | ||
1846 | OVS_VSWITCHD_STOP | |
1847 | AT_CLEANUP | |
1848 | ||
1849 | dnl This test checks that tunnel metadata is encoded in packet_in structures. | |
1850 | AT_SETUP([ofproto - packet-out with tunnel metadata (OpenFlow 1.2)]) | |
1851 | OVS_VSWITCHD_START | |
1852 | ||
1853 | # Start a monitor listening for packet-ins. | |
1854 | AT_CHECK([ovs-ofctl -O OpenFlow12 monitor br0 --detach --no-chdir --pidfile]) | |
1855 | ovs-appctl -t ovs-ofctl ofctl/send 0309000c0123456700000080 | |
1856 | ovs-appctl -t ovs-ofctl ofctl/barrier | |
1857 | ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log | |
1858 | AT_CAPTURE_FILE([monitor.log]) | |
1859 | ||
1860 | # Send a packet-out with set field actions to set some tunnel metadata, and forward to controller | |
1861 | AT_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']) | |
1862 | ||
1863 | # Stop the monitor and check its output. | |
1864 | ovs-appctl -t ovs-ofctl ofctl/barrier | |
1865 | ovs-appctl -t ovs-ofctl exit | |
1866 | ||
1867 | AT_CHECK([sed 's/ (xid=0x[[0-9a-fA-F]]*)//' monitor.log], [0], [dnl | |
1868 | OFPT_PACKET_IN (OF1.2): total_len=14 in_port=ANY tun_id=0x1020304 tun_src=127.0.0.1 tun_dst=192.168.0.1 (via action) data_len=14 (unbuffered) | |
9dcd1c00 SH |
1869 | metadata=0,in_port=0,vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1234 |
1870 | OFPT_BARRIER_REPLY (OF1.2): | |
1871 | ]) | |
1872 | ||
1873 | OVS_VSWITCHD_STOP | |
1874 | AT_CLEANUP | |
1875 | ||
2b07c8b1 BP |
1876 | AT_SETUP([ofproto - flow monitoring]) |
1877 | AT_KEYWORDS([monitor]) | |
1878 | OVS_VSWITCHD_START | |
1879 | ||
1880 | ovs-ofctl add-flow br0 in_port=0,dl_vlan=123,actions=output:1 | |
1881 | ||
1882 | # Start a monitor watching the flow table and check the initial reply. | |
1883 | ovs-ofctl monitor br0 watch: --detach --no-chdir --pidfile >monitor.log 2>&1 | |
1884 | AT_CAPTURE_FILE([monitor.log]) | |
1885 | ovs-appctl -t ovs-ofctl ofctl/barrier | |
1886 | AT_CHECK([sed 's/ (xid=0x[[1-9a-fA-F]][[0-9a-fA-F]]*)//' monitor.log], [0], | |
1887 | [NXST_FLOW_MONITOR reply: | |
1888 | event=ADDED table=0 cookie=0 in_port=0,dl_vlan=123 actions=output:1 | |
1889 | OFPT_BARRIER_REPLY: | |
1890 | ]) | |
1891 | ||
1892 | # Add, delete, and modify some flows and check the updates. | |
1893 | ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log | |
1894 | ovs-ofctl add-flow br0 in_port=0,dl_vlan=124,actions=output:2 | |
1895 | ovs-ofctl add-flow br0 in_port=0,dl_vlan=123,actions=output:5 | |
95a1c4ca SH |
1896 | ovs-ofctl add-flow br0 in_port=0,dl_vlan=123,dl_vlan_pcp=0,actions=output:6 |
1897 | ovs-ofctl add-flow br0 in_port=0,dl_vlan=123,dl_vlan_pcp=1,actions=output:7 | |
1898 | ovs-ofctl add-flow br0 in_port=0,dl_vlan=123,actions=output:8 | |
1899 | ovs-ofctl add-flow br0 in_port=0,dl_vlan=65535,dl_vlan_pcp=0,actions=output:9 | |
1900 | ovs-ofctl add-flow br0 in_port=0,dl_vlan=65535,dl_vlan_pcp=1,actions=output:10 | |
1901 | ovs-ofctl add-flow br0 in_port=0,dl_vlan=65535,actions=output:11 | |
1902 | ovs-ofctl add-flow br0 in_port=0,dl_vlan=8191,dl_vlan_pcp=0,actions=output:12 | |
1903 | ovs-ofctl add-flow br0 in_port=0,dl_vlan=8191,dl_vlan_pcp=1,actions=output:13 | |
1904 | ovs-ofctl add-flow br0 in_port=0,dl_vlan=8191,actions=output:14 | |
1905 | ovs-ofctl add-flow br0 in_port=0,dl_vlan=0,dl_vlan_pcp=0,actions=output:15 | |
1906 | ovs-ofctl add-flow br0 in_port=0,dl_vlan=0,dl_vlan_pcp=1,actions=output:16 | |
1907 | ovs-ofctl add-flow br0 in_port=0,dl_vlan=0,actions=output:17 | |
1908 | ovs-ofctl add-flow br0 in_port=0,dl_vlan=0,dl_vlan_pcp=0,actions=output:18 | |
1909 | ovs-ofctl add-flow br0 in_port=0,dl_vlan=0,dl_vlan_pcp=1,actions=output:19 | |
1910 | ovs-ofctl add-flow br0 in_port=0,dl_vlan=0,actions=output:20 | |
1911 | ovs-ofctl add-flow br0 in_port=0,dl_vlan_pcp=0,actions=output:21 | |
1912 | ovs-ofctl add-flow br0 in_port=0,dl_vlan_pcp=1,actions=output:22 | |
1913 | ovs-ofctl add-flow br0 in_port=0,actions=output:23 | |
2b07c8b1 BP |
1914 | ovs-ofctl mod-flows br0 cookie=5,dl_vlan=123,actions=output:3 |
1915 | ovs-ofctl del-flows br0 dl_vlan=123 | |
1916 | ovs-ofctl del-flows br0 | |
1917 | ovs-appctl -t ovs-ofctl ofctl/barrier | |
32cd83a2 BP |
1918 | sort=' |
1919 | # Sorts groups of lines that start with a space, without moving them | |
1920 | # past the nearest line that does not start with a space. | |
1921 | use warnings; | |
1922 | use strict; | |
1923 | my @buffer = (); | |
1924 | while (<STDIN>) { | |
1925 | if (/^ /) { | |
1926 | push(@buffer, $_); | |
1927 | } else { | |
1928 | print $_ foreach sort(@buffer); | |
1929 | print $_; | |
1930 | @buffer = (); | |
1931 | } | |
1932 | } | |
1933 | print $_ foreach sort(@buffer); | |
1934 | ' | |
5c6d0628 | 1935 | AT_CHECK([sed 's/ (xid=0x[[1-9a-fA-F]][[0-9a-fA-F]]*)//' monitor.log | ${PERL} -e "$sort"], [0], |
2b07c8b1 BP |
1936 | [NXST_FLOW_MONITOR reply (xid=0x0): |
1937 | event=ADDED table=0 cookie=0 in_port=0,dl_vlan=124 actions=output:2 | |
1938 | NXST_FLOW_MONITOR reply (xid=0x0): | |
1939 | event=ADDED table=0 cookie=0 in_port=0,dl_vlan=123 actions=output:5 | |
95a1c4ca SH |
1940 | NXST_FLOW_MONITOR reply (xid=0x0): |
1941 | event=ADDED table=0 cookie=0 in_port=0,dl_vlan=123,dl_vlan_pcp=0 actions=output:6 | |
1942 | NXST_FLOW_MONITOR reply (xid=0x0): | |
1943 | event=ADDED table=0 cookie=0 in_port=0,dl_vlan=123,dl_vlan_pcp=1 actions=output:7 | |
1944 | NXST_FLOW_MONITOR reply (xid=0x0): | |
1945 | event=ADDED table=0 cookie=0 in_port=0,dl_vlan=123 actions=output:8 | |
1946 | NXST_FLOW_MONITOR reply (xid=0x0): | |
1947 | event=ADDED table=0 cookie=0 in_port=0,dl_vlan=0,dl_vlan_pcp=0 actions=output:9 | |
1948 | NXST_FLOW_MONITOR reply (xid=0x0): | |
1949 | event=ADDED table=0 cookie=0 in_port=0,dl_vlan=0,dl_vlan_pcp=1 actions=output:10 | |
1950 | NXST_FLOW_MONITOR reply (xid=0x0): | |
1951 | event=ADDED table=0 cookie=0 in_port=0,vlan_tci=0x0000 actions=output:11 | |
1952 | NXST_FLOW_MONITOR reply (xid=0x0): | |
1953 | event=ADDED table=0 cookie=0 in_port=0,dl_vlan=4095,dl_vlan_pcp=0 actions=output:12 | |
1954 | NXST_FLOW_MONITOR reply (xid=0x0): | |
1955 | event=ADDED table=0 cookie=0 in_port=0,dl_vlan=4095,dl_vlan_pcp=1 actions=output:13 | |
1956 | NXST_FLOW_MONITOR reply (xid=0x0): | |
1957 | event=ADDED table=0 cookie=0 in_port=0,dl_vlan=4095 actions=output:14 | |
1958 | NXST_FLOW_MONITOR reply (xid=0x0): | |
1959 | event=ADDED table=0 cookie=0 in_port=0,dl_vlan=0,dl_vlan_pcp=0 actions=output:15 | |
1960 | NXST_FLOW_MONITOR reply (xid=0x0): | |
1961 | event=ADDED table=0 cookie=0 in_port=0,dl_vlan=0,dl_vlan_pcp=1 actions=output:16 | |
1962 | NXST_FLOW_MONITOR reply (xid=0x0): | |
1963 | event=ADDED table=0 cookie=0 in_port=0,dl_vlan=0 actions=output:17 | |
1964 | NXST_FLOW_MONITOR reply (xid=0x0): | |
1965 | event=ADDED table=0 cookie=0 in_port=0,dl_vlan=0,dl_vlan_pcp=0 actions=output:18 | |
1966 | NXST_FLOW_MONITOR reply (xid=0x0): | |
1967 | event=ADDED table=0 cookie=0 in_port=0,dl_vlan=0,dl_vlan_pcp=1 actions=output:19 | |
1968 | NXST_FLOW_MONITOR reply (xid=0x0): | |
1969 | event=ADDED table=0 cookie=0 in_port=0,dl_vlan=0 actions=output:20 | |
1970 | NXST_FLOW_MONITOR reply (xid=0x0): | |
1971 | event=ADDED table=0 cookie=0 in_port=0,dl_vlan_pcp=0 actions=output:21 | |
1972 | NXST_FLOW_MONITOR reply (xid=0x0): | |
1973 | event=ADDED table=0 cookie=0 in_port=0,dl_vlan_pcp=1 actions=output:22 | |
1974 | NXST_FLOW_MONITOR reply (xid=0x0): | |
1975 | event=ADDED table=0 cookie=0 in_port=0 actions=output:23 | |
2b07c8b1 BP |
1976 | NXST_FLOW_MONITOR reply (xid=0x0): |
1977 | event=MODIFIED table=0 cookie=0x5 in_port=0,dl_vlan=123 actions=output:3 | |
95a1c4ca SH |
1978 | event=MODIFIED table=0 cookie=0x5 in_port=0,dl_vlan=123,dl_vlan_pcp=0 actions=output:3 |
1979 | event=MODIFIED table=0 cookie=0x5 in_port=0,dl_vlan=123,dl_vlan_pcp=1 actions=output:3 | |
2b07c8b1 BP |
1980 | NXST_FLOW_MONITOR reply (xid=0x0): |
1981 | event=DELETED reason=delete table=0 cookie=0x5 in_port=0,dl_vlan=123 actions=output:3 | |
95a1c4ca SH |
1982 | event=DELETED reason=delete table=0 cookie=0x5 in_port=0,dl_vlan=123,dl_vlan_pcp=0 actions=output:3 |
1983 | event=DELETED reason=delete table=0 cookie=0x5 in_port=0,dl_vlan=123,dl_vlan_pcp=1 actions=output:3 | |
2b07c8b1 | 1984 | NXST_FLOW_MONITOR reply (xid=0x0): |
32cd83a2 | 1985 | event=DELETED reason=delete table=0 cookie=0 in_port=0 actions=output:23 |
95a1c4ca | 1986 | event=DELETED reason=delete table=0 cookie=0 in_port=0,dl_vlan=0 actions=output:20 |
32cd83a2 BP |
1987 | event=DELETED reason=delete table=0 cookie=0 in_port=0,dl_vlan=0,dl_vlan_pcp=0 actions=output:18 |
1988 | event=DELETED reason=delete table=0 cookie=0 in_port=0,dl_vlan=0,dl_vlan_pcp=1 actions=output:19 | |
2b07c8b1 | 1989 | event=DELETED reason=delete table=0 cookie=0 in_port=0,dl_vlan=124 actions=output:2 |
95a1c4ca | 1990 | event=DELETED reason=delete table=0 cookie=0 in_port=0,dl_vlan=4095 actions=output:14 |
32cd83a2 | 1991 | event=DELETED reason=delete table=0 cookie=0 in_port=0,dl_vlan=4095,dl_vlan_pcp=0 actions=output:12 |
95a1c4ca | 1992 | event=DELETED reason=delete table=0 cookie=0 in_port=0,dl_vlan=4095,dl_vlan_pcp=1 actions=output:13 |
32cd83a2 BP |
1993 | event=DELETED reason=delete table=0 cookie=0 in_port=0,dl_vlan_pcp=0 actions=output:21 |
1994 | event=DELETED reason=delete table=0 cookie=0 in_port=0,dl_vlan_pcp=1 actions=output:22 | |
95a1c4ca | 1995 | event=DELETED reason=delete table=0 cookie=0 in_port=0,vlan_tci=0x0000 actions=output:11 |
2b07c8b1 BP |
1996 | OFPT_BARRIER_REPLY: |
1997 | ]) | |
1998 | ||
1999 | # Check that our own changes are reported as abbreviations. | |
2000 | ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log | |
2001 | ovs-ofctl add-flow br0 in_port=1,actions=output:2 | |
2002 | ovs-ofctl add-flow br0 in_port=2,actions=output:1 | |
90d721f0 | 2003 | ovs-appctl -t ovs-ofctl ofctl/barrier |
2b07c8b1 BP |
2004 | ovs-appctl -t ovs-ofctl ofctl/send 010e004812345678003fffff00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003000000000000ffffffffffff0000 |
2005 | ovs-appctl -t ovs-ofctl ofctl/barrier | |
2006 | AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip], [0], [NXST_FLOW reply: | |
2007 | ]) | |
2008 | AT_CHECK([sed 's/ (xid=0x[[1-9a-fA-F]][[0-9a-fA-F]]*)//' monitor.log], [0], | |
2009 | [NXST_FLOW_MONITOR reply (xid=0x0): | |
2010 | event=ADDED table=0 cookie=0 in_port=1 actions=output:2 | |
2011 | NXST_FLOW_MONITOR reply (xid=0x0): | |
2012 | event=ADDED table=0 cookie=0 in_port=2 actions=output:1 | |
90d721f0 | 2013 | OFPT_BARRIER_REPLY: |
2b07c8b1 BP |
2014 | send: OFPT_FLOW_MOD: DEL priority=0 actions=drop |
2015 | NXST_FLOW_MONITOR reply (xid=0x0): | |
2016 | event=ABBREV xid=0x12345678 | |
2017 | OFPT_BARRIER_REPLY: | |
2018 | ]) | |
2019 | ||
2020 | ovs-appctl -t ovs-ofctl exit | |
2021 | OVS_VSWITCHD_STOP | |
2022 | AT_CLEANUP | |
2023 | ||
2024 | AT_SETUP([ofproto - flow monitoring pause and resume]) | |
2025 | AT_KEYWORDS([monitor]) | |
2026 | ||
46a80050 EM |
2027 | # The maximum socket receive buffer size is important for this test, which |
2028 | # tests behavior when the receive buffer overflows. | |
2029 | if test -e /proc/sys/net/core/rmem_max; then | |
2030 | # Linux | |
2031 | rmem_max=`cat /proc/sys/net/core/rmem_max` | |
2032 | elif rmem_max=`sysctl -n net.inet.tcp.recvbuf_max 2>/dev/null`; then | |
f3326eeb | 2033 | : # FreeBSD, NetBSD |
46a80050 EM |
2034 | else |
2035 | # Don't know how to get maximum socket receive buffer on this OS | |
2036 | AT_SKIP_IF([:]) | |
2037 | fi | |
2b07c8b1 BP |
2038 | # Calculate the total amount of queuing: rmem_max in the kernel, 128 kB |
2039 | # in ofproto sending userspace (see ofmonitor_flush() in connmgr.c). | |
2b07c8b1 BP |
2040 | queue_size=`expr $rmem_max + 128 \* 1024` |
2041 | echo rmem_max=$rmem_max queue_size=$queue_size | |
2042 | ||
2043 | # Each flow update message takes up at least 48 bytes of space in queues | |
2044 | # and in practice more than that. | |
2045 | n_msgs=`expr $queue_size / 48` | |
2046 | echo n_msgs=$n_msgs | |
2047 | ||
2048 | OVS_VSWITCHD_START | |
2049 | ||
2050 | # Start a monitor watching the flow table, then make it block. | |
0b7140bb | 2051 | ON_EXIT([kill `cat ovs-ofctl.pid`]) |
2b07c8b1 BP |
2052 | ovs-ofctl monitor br0 watch: --detach --no-chdir --pidfile >monitor.log 2>&1 |
2053 | AT_CAPTURE_FILE([monitor.log]) | |
2054 | ovs-appctl -t ovs-ofctl ofctl/block | |
2055 | ||
2056 | # Add $n_msgs flows. | |
2057 | (echo "in_port=2,actions=output:2" | |
5c6d0628 | 2058 | ${PERL} -e ' |
2b07c8b1 BP |
2059 | for ($i = 0; $i < '$n_msgs'; $i++) { |
2060 | print "cookie=1,reg1=$i,actions=drop\n"; | |
2061 | } | |
2062 | ') > flows.txt | |
2063 | AT_CHECK([ovs-ofctl add-flows br0 flows.txt]) | |
79b8c36c BP |
2064 | # Check that multipart flow dumps work properly: |
2065 | AT_CHECK([ovs-ofctl diff-flows br0 flows.txt]) | |
2b07c8b1 BP |
2066 | AT_CHECK([ovs-ofctl add-flow br0 in_port=1,cookie=3,actions=drop]) |
2067 | AT_CHECK([ovs-ofctl mod-flows br0 in_port=2,cookie=2,actions=output:2]) | |
2068 | AT_CHECK([ovs-ofctl del-flows br0 cookie=1/-1]) | |
2069 | ||
2070 | ovs-appctl -t ovs-ofctl ofctl/unblock | |
2071 | ovs-appctl -t ovs-ofctl ofctl/barrier | |
2072 | ||
2073 | ovs-appctl -t ovs-ofctl exit | |
2074 | ||
2075 | # Check that the flow monitor reported the same number of flows | |
2076 | # added and deleted, but fewer than we actually added and deleted. | |
2077 | adds=`grep -c 'ADDED.*reg1=' monitor.log` | |
2078 | deletes=`grep -c 'DELETED.*reg1=' monitor.log` | |
2079 | echo adds=$adds deletes=$deletes | |
2080 | AT_CHECK([test $adds -gt 100 && test $adds -lt $n_msgs]) | |
2081 | AT_CHECK([test $adds = $deletes]) | |
2082 | ||
d0ab8a1a BP |
2083 | # Check that the flow monitor reported everything in the expected order: |
2084 | # | |
2085 | # event=ADDED table=0 cookie=0x1 reg1=0x22 | |
2086 | # ... | |
2087 | # NXT_FLOW_MONITOR_PAUSED: | |
2088 | # ... | |
2089 | # event=DELETED reason=delete table=0 cookie=0x1 reg1=0x22 | |
2090 | # ... | |
2091 | # event=ADDED table=0 cookie=0x3 in_port=1 | |
2092 | # event=MODIFIED table=0 cookie=0x2 in_port=2 actions=output:2 | |
2093 | # NXT_FLOW_MONITOR_RESUMED: | |
2094 | # | |
2095 | # except that, between the PAUSED and RESUMED, the order of the ADDED | |
2096 | # and MODIFIED lines lines depends on hash order, that is, it varies | |
2097 | # as we change the hash function or change architecture. Therefore, | |
2098 | # we use a couple of tests below to accept both orders. | |
2b07c8b1 | 2099 | AT_CHECK([ofctl_strip < monitor.log | sed -n -e ' |
46a80050 | 2100 | /reg1=0x22$/p |
2b07c8b1 BP |
2101 | /cookie=0x[[23]]/p |
2102 | /NXT_FLOW_MONITOR_PAUSED:/p | |
2103 | /NXT_FLOW_MONITOR_RESUMED:/p | |
d0ab8a1a BP |
2104 | ' > monitor.log.subset]) |
2105 | AT_CHECK([grep -v MODIFIED monitor.log.subset], [0], [dnl | |
2106 | event=ADDED table=0 cookie=0x1 reg1=0x22 | |
2b07c8b1 BP |
2107 | NXT_FLOW_MONITOR_PAUSED: |
2108 | event=DELETED reason=delete table=0 cookie=0x1 reg1=0x22 | |
2109 | event=ADDED table=0 cookie=0x3 in_port=1 | |
d0ab8a1a BP |
2110 | NXT_FLOW_MONITOR_RESUMED: |
2111 | ]) | |
2112 | AT_CHECK([grep -v ADDED monitor.log.subset], [0], [dnl | |
2113 | NXT_FLOW_MONITOR_PAUSED: | |
2114 | event=DELETED reason=delete table=0 cookie=0x1 reg1=0x22 | |
2b07c8b1 BP |
2115 | event=MODIFIED table=0 cookie=0x2 in_port=2 actions=output:2 |
2116 | NXT_FLOW_MONITOR_RESUMED: | |
2117 | ]) | |
2118 | ||
2119 | OVS_VSWITCHD_STOP | |
2120 | AT_CLEANUP | |
45156451 AC |
2121 | |
2122 | AT_SETUP([ofproto - event filtering (OpenFlow 1.3)]) | |
2123 | AT_KEYWORDS([monitor]) | |
2124 | OVS_VSWITCHD_START | |
2125 | ||
2126 | # Start a monitor, use the required protocol version | |
2127 | ovs-ofctl -O OpenFlow13 monitor br0 --detach --no-chdir --pidfile >monitor.log 2>&1 | |
2128 | AT_CAPTURE_FILE([monitor.log]) | |
2129 | ||
2130 | # Send an OpenFlow13 message (04), OFPT_GET_ASYNC_REQUEST (1a), length (8), xid (0a) | |
2131 | ovs-appctl -t ovs-ofctl ofctl/send 041a00080000000a | |
2132 | ovs-appctl -t ovs-ofctl ofctl/barrier | |
2133 | ||
2134 | # Check default setting | |
2135 | read -r -d '' expected <<'EOF' | |
2136 | EOF | |
2137 | ||
2138 | AT_CHECK([ofctl_strip < monitor.log], [], [dnl | |
2139 | send: OFPT_GET_ASYNC_REQUEST (OF1.3): | |
2140 | OFPT_GET_ASYNC_REPLY (OF1.3): | |
2141 | master: | |
2142 | PACKET_IN: no_match action | |
2143 | PORT_STATUS: add delete modify | |
2144 | FLOW_REMOVED: idle hard delete | |
2145 | ||
2146 | slave: | |
2147 | PACKET_IN: (off) | |
2148 | PORT_STATUS: add delete modify | |
2149 | FLOW_REMOVED: (off) | |
2150 | OFPT_BARRIER_REPLY (OF1.3): | |
2151 | ]) | |
2152 | ||
2153 | OVS_VSWITCHD_STOP | |
2154 | AT_CLEANUP |