]>
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 | ||
147 | AT_SETUP([ofproto - mod-port (OpenFlow 1.0)]) | |
023e1e0a | 148 | OVS_VSWITCHD_START |
a2cb9dfd BP |
149 | for command_config_state in \ |
150 | 'up 0 0' \ | |
0ab14c8e BP |
151 | 'noflood NO_FLOOD 0' \ |
152 | 'down PORT_DOWN,NO_FLOOD LINK_DOWN' \ | |
28124950 BP |
153 | 'flood PORT_DOWN LINK_DOWN' \ |
154 | 'no-receive PORT_DOWN,NO_RECV LINK_DOWN' \ | |
155 | 'no-forward PORT_DOWN,NO_RECV,NO_FWD LINK_DOWN' \ | |
156 | 'no-packet-in PORT_DOWN,NO_RECV,NO_FWD,NO_PACKET_IN LINK_DOWN' \ | |
157 | 'forward PORT_DOWN,NO_RECV,NO_PACKET_IN LINK_DOWN' \ | |
158 | 'packet-in PORT_DOWN,NO_RECV LINK_DOWN' \ | |
159 | 'up NO_RECV 0' \ | |
160 | 'receive 0 0' | |
a2cb9dfd BP |
161 | do |
162 | set $command_config_state | |
0ab14c8e | 163 | command=$[1] config=`echo $[2] | sed 's/,/ /g'` state=$[3] |
ea523221 BP |
164 | AT_CHECK([ovs-ofctl -vwarn mod-port br0 br0 $command]) |
165 | AT_CHECK([ovs-ofctl -vwarn show br0], [0], [stdout]) | |
640c7c94 | 166 | AT_CHECK_UNQUOTED([STRIP_XIDS stdout], [0], [dnl |
9e1fd49b | 167 | OFPT_FEATURES_REPLY: dpid:fedcba9876543210 |
c2f0373a | 168 | n_tables:254, n_buffers:256 |
9e1fd49b BP |
169 | capabilities: FLOW_STATS TABLE_STATS PORT_STATS QUEUE_STATS ARP_MATCH_IP |
170 | 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 |
171 | LOCAL(br0): addr:aa:55:aa:55:00:00 |
172 | config: $config | |
173 | state: $state | |
d02a5f8e | 174 | speed: 0 Mbps now, 0 Mbps max |
3b62feba | 175 | OFPT_GET_CONFIG_REPLY: frags=normal miss_send_len=0 |
a2cb9dfd BP |
176 | ]) |
177 | done | |
023e1e0a | 178 | OVS_VSWITCHD_STOP |
a2cb9dfd | 179 | AT_CLEANUP |
640c7c94 | 180 | |
9dcd1c00 SH |
181 | AT_SETUP([ofproto - mod-port (OpenFlow 1.2)]) |
182 | OVS_VSWITCHD_START | |
183 | for command_config_state in \ | |
184 | 'up 0 0' \ | |
185 | 'down PORT_DOWN LINK_DOWN' \ | |
186 | 'no-receive PORT_DOWN,NO_RECV LINK_DOWN' \ | |
187 | 'no-forward PORT_DOWN,NO_RECV,NO_FWD LINK_DOWN' \ | |
188 | 'no-packet-in PORT_DOWN,NO_RECV,NO_FWD,NO_PACKET_IN LINK_DOWN' \ | |
189 | 'forward PORT_DOWN,NO_RECV,NO_PACKET_IN LINK_DOWN' \ | |
190 | 'packet-in PORT_DOWN,NO_RECV LINK_DOWN' \ | |
191 | 'up NO_RECV 0' \ | |
192 | 'receive 0 0' | |
193 | do | |
194 | set $command_config_state | |
195 | command=$[1] config=`echo $[2] | sed 's/,/ /g'` state=$[3] | |
196 | AT_CHECK([ovs-ofctl -O OpenFlow12 -vwarn mod-port br0 br0 $command]) | |
197 | AT_CHECK([ovs-ofctl -O OpenFlow12 -vwarn show br0], [0], [stdout]) | |
198 | AT_CHECK_UNQUOTED([STRIP_XIDS stdout], [0], [dnl | |
199 | OFPT_FEATURES_REPLY (OF1.2): dpid:fedcba9876543210 | |
200 | n_tables:254, n_buffers:256 | |
201 | capabilities: FLOW_STATS TABLE_STATS PORT_STATS QUEUE_STATS | |
202 | LOCAL(br0): addr:aa:55:aa:55:00:00 | |
203 | config: $config | |
204 | state: $state | |
205 | speed: 0 Mbps now, 0 Mbps max | |
206 | OFPT_GET_CONFIG_REPLY (OF1.2): frags=normal miss_send_len=0 | |
207 | ]) | |
208 | done | |
209 | OVS_VSWITCHD_STOP | |
210 | AT_CLEANUP | |
211 | ||
c168dcc8 | 212 | AT_SETUP([ofproto - basic flow_mod commands (NXM)]) |
023e1e0a | 213 | OVS_VSWITCHD_START |
ef0ce8ae | 214 | AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip], [0], [NXST_FLOW reply: |
640c7c94 | 215 | ]) |
c6100d92 BP |
216 | AT_CHECK([echo 'in_port=2,actions=1' | ovs-ofctl add-flows br0 -]) |
217 | AT_CHECK([ovs-ofctl add-flow br0 in_port=1,actions=2]) | |
218 | AT_CHECK([ovs-ofctl -F nxm add-flow br0 table=1,in_port=4,actions=3]) | |
ef0ce8ae | 219 | AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl |
c6100d92 BP |
220 | in_port=1 actions=output:2 |
221 | in_port=2 actions=output:1 | |
222 | table=1, in_port=4 actions=output:3 | |
0721c073 | 223 | NXST_FLOW reply: |
640c7c94 | 224 | ]) |
0697b5c3 | 225 | AT_CHECK([ovs-ofctl dump-aggregate br0 table=0 | STRIP_XIDS], [0], [dnl |
c168dcc8 BP |
226 | NXST_AGGREGATE reply: packet_count=0 byte_count=0 flow_count=2 |
227 | ]) | |
640c7c94 | 228 | AT_CHECK([ovs-ofctl del-flows br0]) |
ef0ce8ae | 229 | AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip], [0], [NXST_FLOW reply: |
640c7c94 | 230 | ]) |
023e1e0a | 231 | OVS_VSWITCHD_STOP |
640c7c94 | 232 | AT_CLEANUP |
c168dcc8 BP |
233 | |
234 | AT_SETUP([ofproto - basic flow_mod commands (OpenFlow 1.0)]) | |
023e1e0a | 235 | OVS_VSWITCHD_START |
ef0ce8ae | 236 | AT_CHECK([ovs-ofctl -F openflow10 dump-flows br0 | ofctl_strip], [0], [OFPST_FLOW reply: |
c168dcc8 | 237 | ]) |
c6100d92 BP |
238 | AT_CHECK([echo 'in_port=2,actions=1' | ovs-ofctl -F openflow10 add-flows br0 -]) |
239 | AT_CHECK([ovs-ofctl -F openflow10 add-flow br0 in_port=1,actions=2]) | |
240 | AT_CHECK([ovs-ofctl -F openflow10 add-flow br0 table=1,in_port=4,actions=3]) | |
ef0ce8ae | 241 | AT_CHECK([ovs-ofctl -F openflow10 dump-flows br0 | ofctl_strip | sort], [0], [dnl |
c6100d92 BP |
242 | in_port=1 actions=output:2 |
243 | in_port=2 actions=output:1 | |
244 | table=1, in_port=4 actions=output:3 | |
c168dcc8 BP |
245 | OFPST_FLOW reply: |
246 | ]) | |
0697b5c3 | 247 | AT_CHECK([ovs-ofctl -F openflow10 dump-aggregate br0 table=0 | STRIP_XIDS], [0], [dnl |
c168dcc8 BP |
248 | OFPST_AGGREGATE reply: packet_count=0 byte_count=0 flow_count=2 |
249 | ]) | |
250 | AT_CHECK([ovs-ofctl -F openflow10 del-flows br0]) | |
ef0ce8ae | 251 | AT_CHECK([ovs-ofctl -F openflow10 dump-flows br0 | ofctl_strip], [0], [OFPST_FLOW reply: |
c168dcc8 | 252 | ]) |
023e1e0a | 253 | OVS_VSWITCHD_STOP |
c168dcc8 | 254 | AT_CLEANUP |
e729e793 | 255 | |
f5c45121 SH |
256 | AT_SETUP([ofproto - set-field flow_mod commands (NXM)]) |
257 | OVS_VSWITCHD_START | |
258 | AT_CHECK([ovs-ofctl add-flow br0 ipv6,table=1,in_port=3,actions=drop]) | |
259 | 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]) | |
260 | AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl | |
261 | table=1, ipv6,in_port=3 actions=load:0xa6badbfffefe59fa->NXM_NX_IPV6_SRC[[0..63]],load:0xfe8001234567890a->NXM_NX_IPV6_SRC[[64..127]] | |
262 | NXST_FLOW reply: | |
263 | ]) | |
264 | OVS_VSWITCHD_STOP | |
265 | AT_CLEANUP | |
266 | ||
9dcd1c00 | 267 | AT_SETUP([ofproto - basic flow_mod commands (OpenFlow 1.2)]) |
e729e793 | 268 | OVS_VSWITCHD_START |
9dcd1c00 | 269 | AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip], [0], [OFPST_FLOW reply (OF1.2): |
e729e793 | 270 | ]) |
9dcd1c00 SH |
271 | AT_CHECK([echo 'in_port=2,actions=1' | ovs-ofctl -O OpenFlow12 add-flows br0 -]) |
272 | AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 in_port=1,actions=2]) | |
273 | AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 table=1,in_port=4,actions=3]) | |
274 | AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl | |
275 | in_port=1 actions=output:2 | |
276 | in_port=2 actions=output:1 | |
277 | table=1, in_port=4 actions=output:3 | |
278 | OFPST_FLOW reply (OF1.2): | |
e729e793 | 279 | ]) |
9dcd1c00 SH |
280 | AT_CHECK([ovs-ofctl -O OpenFlow12 del-flows br0]) |
281 | AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip], [0], [OFPST_FLOW reply (OF1.2): | |
e729e793 JP |
282 | ]) |
283 | OVS_VSWITCHD_STOP | |
284 | AT_CLEANUP | |
285 | ||
9dcd1c00 | 286 | AT_SETUP([ofproto - dump flows with cookie]) |
e729e793 | 287 | OVS_VSWITCHD_START |
c6100d92 BP |
288 | AT_CHECK([ovs-ofctl add-flow br0 cookie=0x1,in_port=1,actions=1]) |
289 | AT_CHECK([ovs-ofctl add-flow br0 cookie=0x2,in_port=2,actions=1]) | |
290 | AT_CHECK([ovs-ofctl add-flow br0 cookie=0x3,in_port=3,actions=1]) | |
ef0ce8ae | 291 | AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl |
c6100d92 BP |
292 | cookie=0x1, in_port=1 actions=output:1 |
293 | cookie=0x2, in_port=2 actions=output:1 | |
294 | cookie=0x3, in_port=3 actions=output:1 | |
e729e793 JP |
295 | NXST_FLOW reply: |
296 | ]) | |
297 | AT_CHECK([ovs-ofctl dump-aggregate br0 table=0 | STRIP_XIDS], [0], [dnl | |
298 | NXST_AGGREGATE reply: packet_count=0 byte_count=0 flow_count=3 | |
299 | ]) | |
9dcd1c00 | 300 | AT_CHECK([ovs-ofctl dump-flows br0 cookie=0x3/-1 | ofctl_strip | sort], [0], [dnl |
c6100d92 | 301 | cookie=0x3, in_port=3 actions=output:1 |
e729e793 JP |
302 | NXST_FLOW reply: |
303 | ]) | |
9dcd1c00 SH |
304 | AT_CHECK([ovs-ofctl dump-aggregate br0 cookie=0x3/-1 | STRIP_XIDS], [0], [dnl |
305 | NXST_AGGREGATE reply: packet_count=0 byte_count=0 flow_count=1 | |
e729e793 JP |
306 | ]) |
307 | OVS_VSWITCHD_STOP | |
308 | AT_CLEANUP | |
309 | ||
623e1caf JP |
310 | AT_SETUP([ofproto - mod flow with cookie change (OpenFlow 1.0)]) |
311 | OVS_VSWITCHD_START | |
c6100d92 | 312 | AT_CHECK([ovs-ofctl -F openflow10 add-flow br0 cookie=0x1,in_port=1,actions=1]) |
623e1caf | 313 | AT_CHECK([ovs-ofctl -F openflow10 dump-flows br0 | ofctl_strip | sort], [0], [dnl |
c6100d92 | 314 | cookie=0x1, in_port=1 actions=output:1 |
623e1caf JP |
315 | OFPST_FLOW reply: |
316 | ]) | |
317 | ||
c6100d92 | 318 | AT_CHECK([ovs-ofctl -F openflow10 mod-flows br0 cookie=0x2,in_port=1,actions=1]) |
623e1caf | 319 | AT_CHECK([ovs-ofctl -F openflow10 dump-flows br0 | ofctl_strip | sort], [0], [dnl |
c6100d92 | 320 | cookie=0x2, in_port=1 actions=output:1 |
623e1caf JP |
321 | OFPST_FLOW reply: |
322 | ]) | |
323 | OVS_VSWITCHD_STOP | |
324 | AT_CLEANUP | |
325 | ||
326 | AT_SETUP([ofproto - mod flow with cookie change (NXM)]) | |
327 | OVS_VSWITCHD_START | |
c6100d92 | 328 | AT_CHECK([ovs-ofctl -F nxm add-flow br0 cookie=0x1,in_port=1,actions=1]) |
623e1caf | 329 | AT_CHECK([ovs-ofctl -F nxm dump-flows br0 | ofctl_strip | sort], [0], [dnl |
c6100d92 | 330 | cookie=0x1, in_port=1 actions=output:1 |
623e1caf JP |
331 | NXST_FLOW reply: |
332 | ]) | |
333 | ||
c6100d92 | 334 | AT_CHECK([ovs-ofctl -F nxm mod-flows br0 cookie=0x2,in_port=1,actions=1]) |
623e1caf | 335 | AT_CHECK([ovs-ofctl -F nxm dump-flows br0 | ofctl_strip | sort], [0], [dnl |
c6100d92 | 336 | cookie=0x2, in_port=1 actions=output:1 |
623e1caf JP |
337 | NXST_FLOW reply: |
338 | ]) | |
339 | OVS_VSWITCHD_STOP | |
340 | AT_CLEANUP | |
341 | ||
9dcd1c00 SH |
342 | dnl The OpenFlow 1.2 spec states that the cookie may not be modified |
343 | AT_SETUP([ofproto - no mod flow with cookie change (OpenFlow1.2)]) | |
344 | OVS_VSWITCHD_START | |
345 | AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 cookie=0x1,in_port=1,actions=1]) | |
346 | AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl | |
347 | cookie=0x1, in_port=1 actions=output:1 | |
348 | OFPST_FLOW reply (OF1.2): | |
349 | ]) | |
350 | ||
351 | AT_CHECK([ovs-ofctl -O OpenFlow12 mod-flows br0 cookie=0x2,in_port=1,actions=1]) | |
352 | AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl | |
353 | cookie=0x1, in_port=1 actions=output:1 | |
354 | OFPST_FLOW reply (OF1.2): | |
355 | ]) | |
356 | OVS_VSWITCHD_STOP | |
357 | AT_CLEANUP | |
358 | ||
359 | AT_SETUP([ofproto - mod flows based on cookie mask (OpenFlow 1.0)]) | |
623e1caf | 360 | OVS_VSWITCHD_START |
c6100d92 BP |
361 | AT_CHECK([ovs-ofctl add-flow br0 cookie=0x1,in_port=1,actions=1]) |
362 | AT_CHECK([ovs-ofctl add-flow br0 cookie=0x1,in_port=2,actions=1]) | |
363 | AT_CHECK([ovs-ofctl add-flow br0 cookie=0x2,in_port=3,actions=1]) | |
623e1caf | 364 | AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl |
c6100d92 BP |
365 | cookie=0x1, in_port=1 actions=output:1 |
366 | cookie=0x1, in_port=2 actions=output:1 | |
367 | cookie=0x2, in_port=3 actions=output:1 | |
623e1caf JP |
368 | NXST_FLOW reply: |
369 | ]) | |
370 | ||
371 | AT_CHECK([ovs-ofctl -F nxm mod-flows br0 cookie=0x1/0xff,actions=4]) | |
372 | AT_CHECK([ovs-ofctl -F nxm dump-flows br0 | ofctl_strip | sort], [0], [dnl | |
373 | cookie=0x1, in_port=1 actions=output:4 | |
374 | cookie=0x1, in_port=2 actions=output:4 | |
c6100d92 | 375 | cookie=0x2, in_port=3 actions=output:1 |
623e1caf JP |
376 | NXST_FLOW reply: |
377 | ]) | |
378 | OVS_VSWITCHD_STOP | |
379 | AT_CLEANUP | |
380 | ||
9dcd1c00 SH |
381 | AT_SETUP([ofproto - mod flows based on cookie mask (OpenFlow 1.2)]) |
382 | OVS_VSWITCHD_START | |
383 | AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 cookie=0x1,in_port=1,actions=1]) | |
384 | AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 cookie=0x1,in_port=2,actions=1]) | |
385 | AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 cookie=0x2,in_port=3,actions=1]) | |
386 | AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl | |
387 | cookie=0x1, in_port=1 actions=output:1 | |
388 | cookie=0x1, in_port=2 actions=output:1 | |
389 | cookie=0x2, in_port=3 actions=output:1 | |
390 | OFPST_FLOW reply (OF1.2): | |
391 | ]) | |
392 | ||
393 | AT_CHECK([ovs-ofctl -O OpenFlow12 mod-flows br0 cookie=0x1/0xff,actions=4]) | |
394 | AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl | |
395 | cookie=0x1, in_port=1 actions=output:4 | |
396 | cookie=0x1, in_port=2 actions=output:4 | |
397 | cookie=0x2, in_port=3 actions=output:1 | |
398 | OFPST_FLOW reply (OF1.2): | |
399 | ]) | |
400 | OVS_VSWITCHD_STOP | |
401 | AT_CLEANUP | |
402 | ||
403 | dnl The OpenFlow 1.2 spec states that the cookie may not be modified | |
623e1caf JP |
404 | AT_SETUP([ofproto - mod flows based on cookie mask with cookie change]) |
405 | OVS_VSWITCHD_START | |
c6100d92 BP |
406 | AT_CHECK([ovs-ofctl add-flow br0 cookie=0x1,in_port=1,actions=1]) |
407 | AT_CHECK([ovs-ofctl add-flow br0 cookie=0x1,in_port=2,actions=1]) | |
408 | AT_CHECK([ovs-ofctl add-flow br0 cookie=0x2,in_port=3,actions=1]) | |
623e1caf | 409 | AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl |
c6100d92 BP |
410 | cookie=0x1, in_port=1 actions=output:1 |
411 | cookie=0x1, in_port=2 actions=output:1 | |
412 | cookie=0x2, in_port=3 actions=output:1 | |
623e1caf JP |
413 | NXST_FLOW reply: |
414 | ]) | |
415 | ||
416 | AT_CHECK([ovs-ofctl -F nxm mod-flows br0 cookie=1/-1,cookie=4,actions=4]) | |
417 | AT_CHECK([ovs-ofctl -F nxm dump-flows br0 | ofctl_strip | sort], [0], [dnl | |
c6100d92 | 418 | cookie=0x2, in_port=3 actions=output:1 |
623e1caf JP |
419 | cookie=0x4, in_port=1 actions=output:4 |
420 | cookie=0x4, in_port=2 actions=output:4 | |
421 | NXST_FLOW reply: | |
422 | ]) | |
423 | OVS_VSWITCHD_STOP | |
424 | AT_CLEANUP | |
425 | ||
426 | AT_SETUP([ofproto - mod flow with cookie miss (mask==0)]) | |
427 | OVS_VSWITCHD_START | |
c6100d92 | 428 | AT_CHECK([ovs-ofctl -F nxm mod-flows br0 in_port=1,actions=1]) |
623e1caf | 429 | AT_CHECK([ovs-ofctl -F nxm dump-flows br0 | ofctl_strip | sort], [0], [dnl |
c6100d92 | 430 | in_port=1 actions=output:1 |
623e1caf JP |
431 | NXST_FLOW reply: |
432 | ]) | |
433 | OVS_VSWITCHD_STOP | |
434 | AT_CLEANUP | |
435 | ||
436 | AT_SETUP([ofproto - mod flow with cookie miss (mask!=0)]) | |
437 | OVS_VSWITCHD_START | |
c6100d92 | 438 | AT_CHECK([ovs-ofctl -F nxm mod-flows br0 cookie=1/1,in_port=1,actions=1]) |
623e1caf JP |
439 | AT_CHECK([ovs-ofctl -F nxm dump-flows br0 | ofctl_strip | sort], [0], [dnl |
440 | NXST_FLOW reply: | |
441 | ]) | |
442 | OVS_VSWITCHD_STOP | |
443 | AT_CLEANUP | |
444 | ||
445 | AT_SETUP([ofproto - del flows with cookies]) | |
446 | OVS_VSWITCHD_START | |
c6100d92 BP |
447 | AT_CHECK([ovs-ofctl add-flow br0 cookie=0x1,in_port=1,actions=1]) |
448 | AT_CHECK([ovs-ofctl add-flow br0 cookie=0x2,in_port=2,actions=1]) | |
449 | AT_CHECK([ovs-ofctl add-flow br0 cookie=0x3,in_port=3,actions=1]) | |
623e1caf | 450 | AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl |
c6100d92 BP |
451 | cookie=0x1, in_port=1 actions=output:1 |
452 | cookie=0x2, in_port=2 actions=output:1 | |
453 | cookie=0x3, in_port=3 actions=output:1 | |
623e1caf JP |
454 | NXST_FLOW reply: |
455 | ]) | |
456 | ||
457 | AT_CHECK([ovs-ofctl del-flows br0]) | |
458 | AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl | |
459 | NXST_FLOW reply: | |
460 | ]) | |
461 | OVS_VSWITCHD_STOP | |
462 | AT_CLEANUP | |
463 | ||
464 | AT_SETUP([ofproto - del flows based on cookie]) | |
e729e793 | 465 | OVS_VSWITCHD_START |
c6100d92 BP |
466 | AT_CHECK([ovs-ofctl add-flow br0 cookie=0x1,in_port=1,actions=1]) |
467 | AT_CHECK([ovs-ofctl add-flow br0 cookie=0x2,in_port=2,actions=1]) | |
468 | AT_CHECK([ovs-ofctl add-flow br0 cookie=0x3,in_port=3,actions=1]) | |
ef0ce8ae | 469 | AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl |
c6100d92 BP |
470 | cookie=0x1, in_port=1 actions=output:1 |
471 | cookie=0x2, in_port=2 actions=output:1 | |
472 | cookie=0x3, in_port=3 actions=output:1 | |
e729e793 JP |
473 | NXST_FLOW reply: |
474 | ]) | |
80d5aefd | 475 | |
623e1caf | 476 | AT_CHECK([ovs-ofctl del-flows br0 cookie=0x3/-1]) |
ef0ce8ae | 477 | AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl |
c6100d92 BP |
478 | cookie=0x1, in_port=1 actions=output:1 |
479 | cookie=0x2, in_port=2 actions=output:1 | |
e729e793 JP |
480 | NXST_FLOW reply: |
481 | ]) | |
482 | OVS_VSWITCHD_STOP | |
483 | AT_CLEANUP | |
484 | ||
623e1caf | 485 | AT_SETUP([ofproto - del flows based on cookie mask]) |
e729e793 | 486 | OVS_VSWITCHD_START |
c6100d92 BP |
487 | AT_CHECK([ovs-ofctl add-flow br0 cookie=0x1,in_port=1,actions=1]) |
488 | AT_CHECK([ovs-ofctl add-flow br0 cookie=0x2,in_port=2,actions=1]) | |
489 | AT_CHECK([ovs-ofctl add-flow br0 cookie=0x3,in_port=3,actions=1]) | |
ef0ce8ae | 490 | AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl |
c6100d92 BP |
491 | cookie=0x1, in_port=1 actions=output:1 |
492 | cookie=0x2, in_port=2 actions=output:1 | |
493 | cookie=0x3, in_port=3 actions=output:1 | |
e729e793 JP |
494 | NXST_FLOW reply: |
495 | ]) | |
496 | AT_CHECK([ovs-ofctl del-flows br0 cookie=0x3/0x1]) | |
ef0ce8ae | 497 | AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl |
c6100d92 | 498 | cookie=0x2, in_port=2 actions=output:1 |
e729e793 JP |
499 | NXST_FLOW reply: |
500 | ]) | |
501 | OVS_VSWITCHD_STOP | |
502 | AT_CLEANUP | |
254750ce | 503 | |
9dcd1c00 | 504 | AT_SETUP([ofproto - del flows based on table id (NXM)]) |
c90cfeaf SH |
505 | OVS_VSWITCHD_START |
506 | AT_CHECK([ovs-ofctl add-flow br0 cookie=0x1,in_port=1,actions=1]) | |
507 | AT_CHECK([ovs-ofctl add-flow br0 cookie=0x2,in_port=2,table=1,actions=1]) | |
508 | AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl | |
509 | cookie=0x1, in_port=1 actions=output:1 | |
510 | cookie=0x2, table=1, in_port=2 actions=output:1 | |
511 | NXST_FLOW reply: | |
512 | ]) | |
513 | AT_CHECK([ovs-ofctl del-flows br0 table=0]) | |
514 | AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl | |
515 | cookie=0x2, table=1, in_port=2 actions=output:1 | |
516 | NXST_FLOW reply: | |
517 | ]) | |
518 | AT_CHECK([ovs-ofctl del-flows br0 table=1]) | |
519 | AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl | |
520 | NXST_FLOW reply: | |
521 | ]) | |
522 | AT_CHECK([ovs-ofctl add-flow br0 cookie=0x1,in_port=1,actions=1]) | |
523 | AT_CHECK([ovs-ofctl add-flow br0 cookie=0x2,in_port=2,table=1,actions=1]) | |
524 | AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl | |
525 | cookie=0x1, in_port=1 actions=output:1 | |
526 | cookie=0x2, table=1, in_port=2 actions=output:1 | |
527 | NXST_FLOW reply: | |
528 | ]) | |
529 | AT_CHECK([ovs-ofctl del-flows br0]) | |
530 | AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl | |
531 | NXST_FLOW reply: | |
532 | ]) | |
533 | OVS_VSWITCHD_STOP | |
534 | AT_CLEANUP | |
535 | ||
9dcd1c00 SH |
536 | AT_SETUP([ofproto - del flows based on table id (OpenFlow 1.2)]) |
537 | OVS_VSWITCHD_START | |
538 | AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 cookie=0x1,in_port=1,actions=1]) | |
539 | AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 cookie=0x2,in_port=2,table=1,actions=1]) | |
540 | AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl | |
541 | cookie=0x1, in_port=1 actions=output:1 | |
542 | cookie=0x2, table=1, in_port=2 actions=output:1 | |
543 | OFPST_FLOW reply (OF1.2): | |
544 | ]) | |
545 | AT_CHECK([ovs-ofctl -O OpenFlow12 del-flows br0 table=0]) | |
546 | AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl | |
547 | cookie=0x2, table=1, in_port=2 actions=output:1 | |
548 | OFPST_FLOW reply (OF1.2): | |
549 | ]) | |
550 | AT_CHECK([ovs-ofctl -O OpenFlow12 del-flows br0 table=1]) | |
551 | AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl | |
552 | OFPST_FLOW reply (OF1.2): | |
553 | ]) | |
554 | AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 cookie=0x1,in_port=1,actions=1]) | |
555 | AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 cookie=0x2,in_port=2,table=1,actions=1]) | |
556 | AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl | |
557 | cookie=0x1, in_port=1 actions=output:1 | |
558 | cookie=0x2, table=1, in_port=2 actions=output:1 | |
559 | OFPST_FLOW reply (OF1.2): | |
560 | ]) | |
561 | AT_CHECK([ovs-ofctl -O OpenFlow12 del-flows br0]) | |
562 | AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl | |
563 | OFPST_FLOW reply (OF1.2): | |
564 | ]) | |
565 | OVS_VSWITCHD_STOP | |
566 | AT_CLEANUP | |
567 | ||
568 | AT_SETUP([ofproto - flow table configuration (OpenFlow 1.0)]) | |
254750ce BP |
569 | OVS_VSWITCHD_START |
570 | # Check the default configuration. | |
c2f0373a | 571 | (echo "OFPST_TABLE reply (xid=0x2): 254 tables |
254750ce BP |
572 | 0: classifier: wild=0x3fffff, max=1000000, active=0 |
573 | lookup=0, matched=0" | |
574 | x=1 | |
c57b2226 | 575 | while test $x -lt 254; do |
254750ce BP |
576 | printf " %d: %-8s: wild=0x3fffff, max=1000000, active=0 |
577 | lookup=0, matched=0 | |
578 | " $x table$x | |
579 | x=`expr $x + 1` | |
c2f0373a | 580 | done) > expout |
254750ce BP |
581 | AT_CHECK([ovs-ofctl dump-tables br0], [0], [expout]) |
582 | # Change the configuration. | |
583 | AT_CHECK( | |
584 | [ovs-vsctl \ | |
585 | -- --id=@t0 create Flow_Table name=main \ | |
586 | -- --id=@t1 create Flow_Table flow-limit=1024 \ | |
587 | -- set bridge br0 'flow_tables={1=@t1,0=@t0}' \ | |
588 | | perl $srcdir/uuidfilt.pl], | |
589 | [0], [<0> | |
590 | <1> | |
591 | ]) | |
592 | # Check that the configuration was updated. | |
593 | mv expout orig-expout | |
c2f0373a | 594 | (echo "OFPST_TABLE reply (xid=0x2): 254 tables |
254750ce BP |
595 | 0: main : wild=0x3fffff, max=1000000, active=0 |
596 | lookup=0, matched=0 | |
597 | 1: table1 : wild=0x3fffff, max= 1024, active=0 | |
598 | lookup=0, matched=0" | |
599 | tail -n +6 orig-expout) > expout | |
600 | AT_CHECK([ovs-ofctl dump-tables br0], [0], [expout]) | |
601 | OVS_VSWITCHD_STOP | |
602 | AT_CLEANUP | |
603 | ||
9dcd1c00 SH |
604 | AT_SETUP([ofproto - flow table configuration (OpenFlow 1.2)]) |
605 | OVS_VSWITCHD_START | |
606 | # Check the default configuration. | |
607 | (mid="wild=0xffffffffff, max=1000000," | |
608 | tail=" | |
609 | lookup=0, matched=0 | |
610 | match=0xffffffffff, instructions=0x00000007, config=0x00000003 | |
611 | write_actions=0x00000000, apply_actions=0x00000000 | |
612 | write_setfields=0x000000ffffffffff | |
613 | apply_setfields=0x000000ffffffffff | |
614 | metadata_match=0xffffffffffffffff | |
615 | metadata_write=0xffffffffffffffff" | |
616 | echo "OFPST_TABLE reply (OF1.2) (xid=0x2): 254 tables | |
617 | 0: classifier: $mid active=0$tail" | |
618 | x=1 | |
619 | while test $x -lt 254; do | |
620 | printf " %d: %-8s: $mid active=0$tail | |
621 | " $x table$x | |
622 | x=`expr $x + 1` | |
623 | done) > expout | |
624 | AT_CHECK([ovs-ofctl -O OpenFlow12 dump-tables br0], [0], [expout]) | |
625 | # Change the configuration. | |
626 | AT_CHECK( | |
627 | [ovs-vsctl \ | |
628 | -- --id=@t0 create Flow_Table name=main \ | |
629 | -- --id=@t1 create Flow_Table flow-limit=1024 \ | |
630 | -- set bridge br0 'flow_tables={1=@t1,0=@t0}' \ | |
631 | | perl $srcdir/uuidfilt.pl], | |
632 | [0], [<0> | |
633 | <1> | |
634 | ]) | |
635 | # Check that the configuration was updated. | |
636 | mv expout orig-expout | |
637 | (echo "OFPST_TABLE reply (OF1.2) (xid=0x2): 254 tables | |
638 | 0: main : wild=0xffffffffff, max=1000000, active=0" | |
639 | tail -n +3 orig-expout | head -7 | |
640 | echo " 1: table1 : wild=0xffffffffff, max= 1024, active=0" | |
641 | tail -n +11 orig-expout) > expout | |
642 | AT_CHECK([ovs-ofctl -O OpenFlow12 dump-tables br0], [0], [expout]) | |
643 | OVS_VSWITCHD_STOP | |
644 | AT_CLEANUP | |
645 | ||
646 | AT_SETUP([ofproto - hard limits on flow table size (OpenFLow 1.0)]) | |
254750ce BP |
647 | OVS_VSWITCHD_START |
648 | # Configure a maximum of 4 flows. | |
649 | AT_CHECK( | |
650 | [ovs-vsctl \ | |
651 | -- --id=@t0 create Flow_Table flow-limit=4 \ | |
652 | -- set bridge br0 flow_tables:0=@t0 \ | |
653 | | perl $srcdir/uuidfilt.pl], | |
654 | [0], [<0> | |
655 | ]) | |
656 | # Add 4 flows. | |
657 | for in_port in 1 2 3 4; do | |
658 | ovs-ofctl add-flow br0 in_port=$in_port,actions=drop | |
659 | done | |
660 | AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl | |
661 | in_port=1 actions=drop | |
662 | in_port=2 actions=drop | |
663 | in_port=3 actions=drop | |
664 | in_port=4 actions=drop | |
665 | NXST_FLOW reply: | |
666 | ]) | |
667 | # Adding another flow will be refused. | |
668 | AT_CHECK([ovs-ofctl add-flow br0 in_port=5,actions=drop], [1], [], [stderr]) | |
27527aa0 | 669 | AT_CHECK([head -n 1 stderr | ofctl_strip], [0], |
be2b69d1 | 670 | [OFPT_ERROR: OFPFMFC_TABLE_FULL |
254750ce BP |
671 | ]) |
672 | # Also a mod-flow that would add a flow will be refused. | |
673 | AT_CHECK([ovs-ofctl mod-flows br0 in_port=5,actions=drop], [1], [], [stderr]) | |
27527aa0 | 674 | AT_CHECK([head -n 1 stderr | ofctl_strip], [0], |
be2b69d1 | 675 | [OFPT_ERROR: OFPFMFC_TABLE_FULL |
254750ce BP |
676 | ]) |
677 | # Replacing or modifying an existing flow is allowed. | |
678 | AT_CHECK([ovs-ofctl add-flow br0 in_port=4,actions=normal]) | |
679 | AT_CHECK([ovs-ofctl mod-flows br0 in_port=3,actions=output:1]) | |
680 | AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl | |
681 | in_port=1 actions=drop | |
682 | in_port=2 actions=drop | |
683 | in_port=3 actions=output:1 | |
684 | in_port=4 actions=NORMAL | |
685 | NXST_FLOW reply: | |
686 | ]) | |
687 | OVS_VSWITCHD_STOP | |
688 | AT_CLEANUP | |
689 | ||
9dcd1c00 SH |
690 | AT_SETUP([ofproto - hard limits on flow table size (OpenFLow 1.2)]) |
691 | OVS_VSWITCHD_START | |
692 | # Configure a maximum of 4 flows. | |
693 | AT_CHECK( | |
694 | [ovs-vsctl \ | |
695 | -- --id=@t0 create Flow_Table flow-limit=4 \ | |
696 | -- set bridge br0 flow_tables:0=@t0 \ | |
697 | | perl $srcdir/uuidfilt.pl], | |
698 | [0], [<0> | |
699 | ]) | |
700 | # Add 4 flows. | |
701 | for in_port in 1 2 3 4; do | |
702 | ovs-ofctl -O OpenFlow12 add-flow br0 in_port=$in_port,actions=drop | |
703 | done | |
704 | AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl | |
705 | in_port=1 actions=drop | |
706 | in_port=2 actions=drop | |
707 | in_port=3 actions=drop | |
708 | in_port=4 actions=drop | |
709 | OFPST_FLOW reply (OF1.2): | |
710 | ]) | |
711 | # Adding another flow will be refused. | |
712 | AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 in_port=5,actions=drop], [1], [], [stderr]) | |
713 | AT_CHECK([head -n 1 stderr | ofctl_strip], [0], | |
714 | [OFPT_ERROR (OF1.2): OFPFMFC_TABLE_FULL | |
715 | ]) | |
716 | # Replacing or modifying an existing flow is allowed. | |
717 | AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 in_port=4,actions=normal]) | |
718 | AT_CHECK([ovs-ofctl -O OpenFlow12 mod-flows br0 in_port=3,actions=output:1]) | |
719 | AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl | |
720 | in_port=1 actions=drop | |
721 | in_port=2 actions=drop | |
722 | in_port=3 actions=output:1 | |
723 | in_port=4 actions=NORMAL | |
724 | OFPST_FLOW reply (OF1.2): | |
725 | ]) | |
726 | OVS_VSWITCHD_STOP | |
727 | AT_CLEANUP | |
728 | ||
729 | AT_SETUP([ofproto - eviction upon table overflow (OpenFlow 1.0)]) | |
254750ce BP |
730 | OVS_VSWITCHD_START |
731 | # Configure a maximum of 4 flows. | |
732 | AT_CHECK( | |
733 | [ovs-vsctl \ | |
734 | -- --id=@t0 create Flow_Table flow-limit=4 overflow-policy=evict \ | |
735 | -- set bridge br0 flow_tables:0=@t0 \ | |
736 | | perl $srcdir/uuidfilt.pl], | |
737 | [0], [<0> | |
738 | ]) | |
739 | # Add 4 flows. | |
740 | for in_port in 4 3 2 1; do | |
741 | ovs-ofctl add-flow br0 idle_timeout=${in_port}0,in_port=$in_port,actions=drop | |
742 | done | |
743 | AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl | |
b9718b7b BP |
744 | idle_timeout=10, in_port=1 actions=drop |
745 | idle_timeout=20, in_port=2 actions=drop | |
746 | idle_timeout=30, in_port=3 actions=drop | |
747 | idle_timeout=40, in_port=4 actions=drop | |
254750ce BP |
748 | NXST_FLOW reply: |
749 | ]) | |
750 | # Adding another flow will cause the one that expires soonest to be evicted. | |
751 | AT_CHECK([ovs-ofctl add-flow br0 in_port=5,actions=drop]) | |
752 | AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl | |
b9718b7b BP |
753 | idle_timeout=20, in_port=2 actions=drop |
754 | idle_timeout=30, in_port=3 actions=drop | |
755 | idle_timeout=40, in_port=4 actions=drop | |
254750ce BP |
756 | in_port=5 actions=drop |
757 | NXST_FLOW reply: | |
758 | ]) | |
759 | # A mod-flow that adds a flow also causes eviction, but replacing or | |
760 | # modifying an existing flow doesn't. | |
761 | AT_CHECK([ovs-ofctl mod-flows br0 in_port=6,actions=drop]) | |
762 | AT_CHECK([ovs-ofctl add-flow br0 in_port=4,actions=normal]) | |
763 | AT_CHECK([ovs-ofctl mod-flows br0 in_port=3,actions=output:1]) | |
764 | AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl | |
b9718b7b | 765 | idle_timeout=30, in_port=3 actions=output:1 |
254750ce BP |
766 | in_port=4 actions=NORMAL |
767 | in_port=5 actions=drop | |
768 | in_port=6 actions=drop | |
769 | NXST_FLOW reply: | |
770 | ]) | |
771 | # Flows with no timeouts at all cannot be evicted. | |
772 | AT_CHECK([ovs-ofctl add-flow br0 in_port=7,actions=normal]) | |
773 | AT_CHECK([ovs-ofctl add-flow br0 in_port=8,actions=drop], [1], [], [stderr]) | |
27527aa0 | 774 | AT_CHECK([head -n 1 stderr | ofctl_strip], [0], |
be2b69d1 | 775 | [OFPT_ERROR: OFPFMFC_TABLE_FULL |
254750ce BP |
776 | ]) |
777 | AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl | |
778 | in_port=4 actions=NORMAL | |
779 | in_port=5 actions=drop | |
780 | in_port=6 actions=drop | |
781 | in_port=7 actions=NORMAL | |
782 | NXST_FLOW reply: | |
783 | ]) | |
784 | OVS_VSWITCHD_STOP | |
785 | AT_CLEANUP | |
786 | ||
9dcd1c00 SH |
787 | AT_SETUP([ofproto - eviction upon table overflow (OpenFlow 1.2)]) |
788 | OVS_VSWITCHD_START | |
789 | # Configure a maximum of 4 flows. | |
790 | AT_CHECK( | |
791 | [ovs-vsctl \ | |
792 | -- --id=@t0 create Flow_Table flow-limit=4 overflow-policy=evict \ | |
793 | -- set bridge br0 flow_tables:0=@t0 \ | |
794 | | perl $srcdir/uuidfilt.pl], | |
795 | [0], [<0> | |
796 | ]) | |
797 | # Add 4 flows. | |
798 | for in_port in 4 3 2 1; do | |
799 | ovs-ofctl -O OpenFlow12 add-flow br0 idle_timeout=${in_port}0,in_port=$in_port,actions=drop | |
800 | done | |
801 | AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl | |
802 | idle_timeout=10, in_port=1 actions=drop | |
803 | idle_timeout=20, in_port=2 actions=drop | |
804 | idle_timeout=30, in_port=3 actions=drop | |
805 | idle_timeout=40, in_port=4 actions=drop | |
806 | OFPST_FLOW reply (OF1.2): | |
807 | ]) | |
808 | # Adding another flow will cause the one that expires soonest to be evicted. | |
809 | AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 in_port=5,actions=drop]) | |
810 | AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl | |
811 | idle_timeout=20, in_port=2 actions=drop | |
812 | idle_timeout=30, in_port=3 actions=drop | |
813 | idle_timeout=40, in_port=4 actions=drop | |
814 | in_port=5 actions=drop | |
815 | OFPST_FLOW reply (OF1.2): | |
816 | ]) | |
817 | # In Open Flow 1.2 a mod-flow does not ever add a flow and thus | |
818 | # has no effect on eviction | |
819 | AT_CHECK([ovs-ofctl -O OpenFlow12 mod-flows br0 in_port=6,actions=drop]) | |
820 | AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 in_port=4,actions=normal]) | |
821 | AT_CHECK([ovs-ofctl -O OpenFlow12 mod-flows br0 in_port=3,actions=output:1]) | |
822 | AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl | |
823 | idle_timeout=20, in_port=2 actions=drop | |
824 | idle_timeout=30, in_port=3 actions=output:1 | |
825 | in_port=4 actions=NORMAL | |
826 | in_port=5 actions=drop | |
827 | OFPST_FLOW reply (OF1.2): | |
828 | ]) | |
829 | # Flows with no timeouts at all cannot be evicted. | |
830 | AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 in_port=6,actions=drop]) | |
831 | AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 in_port=7,actions=normal]) | |
832 | AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 in_port=8,actions=drop], [1], [], [stderr]) | |
833 | AT_CHECK([head -n 1 stderr | ofctl_strip], [0], | |
834 | [OFPT_ERROR (OF1.2): OFPFMFC_TABLE_FULL | |
835 | ]) | |
836 | AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl | |
837 | in_port=4 actions=NORMAL | |
838 | in_port=5 actions=drop | |
839 | in_port=6 actions=drop | |
840 | in_port=7 actions=NORMAL | |
841 | OFPST_FLOW reply (OF1.2): | |
842 | ]) | |
843 | OVS_VSWITCHD_STOP | |
844 | AT_CLEANUP | |
845 | ||
846 | AT_SETUP([ofproto - eviction upon table overflow, with fairness (OpenFlow 1.0)]) | |
254750ce BP |
847 | OVS_VSWITCHD_START |
848 | # Configure a maximum of 4 flows. | |
849 | AT_CHECK( | |
850 | [ovs-vsctl \ | |
851 | -- --id=@t0 create Flow_Table name=evict flow-limit=4 \ | |
852 | overflow-policy=evict \ | |
853 | groups='"NXM_OF_IN_PORT[[]]"' \ | |
854 | -- set bridge br0 flow_tables:0=@t0 \ | |
855 | | perl $srcdir/uuidfilt.pl], | |
856 | [0], [<0> | |
857 | ]) | |
858 | # Add 4 flows. | |
859 | ovs-ofctl add-flows br0 - <<EOF | |
860 | idle_timeout=10 in_port=2 dl_src=00:44:55:66:77:88 actions=drop | |
861 | idle_timeout=20 in_port=1 dl_src=00:11:22:33:44:55 actions=drop | |
862 | idle_timeout=30 in_port=1 dl_src=00:22:33:44:55:66 actions=drop | |
863 | idle_timeout=40 in_port=1 dl_src=00:33:44:55:66:77 actions=drop | |
864 | EOF | |
865 | AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl | |
b9718b7b BP |
866 | idle_timeout=10, in_port=2,dl_src=00:44:55:66:77:88 actions=drop |
867 | idle_timeout=20, in_port=1,dl_src=00:11:22:33:44:55 actions=drop | |
868 | idle_timeout=30, in_port=1,dl_src=00:22:33:44:55:66 actions=drop | |
869 | idle_timeout=40, in_port=1,dl_src=00:33:44:55:66:77 actions=drop | |
254750ce BP |
870 | NXST_FLOW reply: |
871 | ]) | |
872 | # Adding another flow will cause the one that expires soonest within | |
873 | # the largest group (those with in_port=1) to be evicted. In this | |
874 | # case this is not the same as the one that expires soonest overall | |
875 | # (which is what makes the test interesting): | |
876 | AT_CHECK([ovs-ofctl add-flow br0 in_port=2,dl_src=00:55:66:77:88:99,actions=drop]) | |
877 | AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl | |
b9718b7b BP |
878 | idle_timeout=10, in_port=2,dl_src=00:44:55:66:77:88 actions=drop |
879 | idle_timeout=30, in_port=1,dl_src=00:22:33:44:55:66 actions=drop | |
880 | idle_timeout=40, in_port=1,dl_src=00:33:44:55:66:77 actions=drop | |
254750ce BP |
881 | in_port=2,dl_src=00:55:66:77:88:99 actions=drop |
882 | NXST_FLOW reply: | |
883 | ]) | |
884 | # Enlarge the flow limit, change the eviction policy back to strictly | |
885 | # based on expiration, and and add some flows. | |
886 | AT_CHECK([ovs-vsctl set Flow_Table evict groups='[[]]' flow-limit=7]) | |
887 | ovs-ofctl add-flows br0 - <<EOF | |
888 | idle_timeout=50 in_port=2 dl_src=00:66:77:88:99:aa actions=drop | |
889 | idle_timeout=60 in_port=2 dl_src=00:77:88:99:aa:bb actions=drop | |
890 | idle_timeout=70 in_port=2 dl_src=00:88:99:aa:bb:cc actions=drop | |
891 | EOF | |
892 | AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl | |
b9718b7b BP |
893 | idle_timeout=10, in_port=2,dl_src=00:44:55:66:77:88 actions=drop |
894 | idle_timeout=30, in_port=1,dl_src=00:22:33:44:55:66 actions=drop | |
895 | idle_timeout=40, in_port=1,dl_src=00:33:44:55:66:77 actions=drop | |
896 | idle_timeout=50, in_port=2,dl_src=00:66:77:88:99:aa actions=drop | |
897 | idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=drop | |
898 | idle_timeout=70, in_port=2,dl_src=00:88:99:aa:bb:cc actions=drop | |
254750ce BP |
899 | in_port=2,dl_src=00:55:66:77:88:99 actions=drop |
900 | NXST_FLOW reply: | |
901 | ]) | |
902 | # Adding another flow will cause the one that expires soonest overall | |
903 | # to be evicted. | |
904 | AT_CHECK([ovs-ofctl add-flow br0 'idle_timeout=80 in_port=2 dl_src=00:99:aa:bb:cc:dd actions=drop']) | |
905 | AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl | |
b9718b7b BP |
906 | idle_timeout=30, in_port=1,dl_src=00:22:33:44:55:66 actions=drop |
907 | idle_timeout=40, in_port=1,dl_src=00:33:44:55:66:77 actions=drop | |
908 | idle_timeout=50, in_port=2,dl_src=00:66:77:88:99:aa actions=drop | |
909 | idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=drop | |
910 | idle_timeout=70, in_port=2,dl_src=00:88:99:aa:bb:cc actions=drop | |
911 | idle_timeout=80, in_port=2,dl_src=00:99:aa:bb:cc:dd actions=drop | |
254750ce BP |
912 | in_port=2,dl_src=00:55:66:77:88:99 actions=drop |
913 | NXST_FLOW reply: | |
914 | ]) | |
915 | # Reducing the flow limit also causes the flows that expire soonest | |
916 | # overall to be evicted. | |
917 | AT_CHECK([ovs-vsctl set Flow_Table evict flow-limit=4]) | |
918 | AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl | |
b9718b7b BP |
919 | idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=drop |
920 | idle_timeout=70, in_port=2,dl_src=00:88:99:aa:bb:cc actions=drop | |
921 | idle_timeout=80, in_port=2,dl_src=00:99:aa:bb:cc:dd actions=drop | |
254750ce BP |
922 | in_port=2,dl_src=00:55:66:77:88:99 actions=drop |
923 | NXST_FLOW reply: | |
924 | ]) | |
925 | OVS_VSWITCHD_STOP | |
926 | AT_CLEANUP | |
80d5aefd | 927 | |
9dcd1c00 SH |
928 | AT_SETUP([ofproto - eviction upon table overflow, with fairness (OpenFlow 1.2)]) |
929 | OVS_VSWITCHD_START | |
930 | # Configure a maximum of 4 flows. | |
931 | AT_CHECK( | |
932 | [ovs-vsctl \ | |
933 | -- --id=@t0 create Flow_Table name=evict flow-limit=4 \ | |
934 | overflow-policy=evict \ | |
935 | groups='"NXM_OF_IN_PORT[[]]"' \ | |
936 | -- set bridge br0 flow_tables:0=@t0 \ | |
937 | | perl $srcdir/uuidfilt.pl], | |
938 | [0], [<0> | |
939 | ]) | |
940 | # Add 4 flows. | |
941 | ovs-ofctl -O OpenFlow12 add-flows br0 - <<EOF | |
942 | idle_timeout=10 in_port=2 dl_src=00:44:55:66:77:88 actions=drop | |
943 | idle_timeout=20 in_port=1 dl_src=00:11:22:33:44:55 actions=drop | |
944 | idle_timeout=30 in_port=1 dl_src=00:22:33:44:55:66 actions=drop | |
945 | idle_timeout=40 in_port=1 dl_src=00:33:44:55:66:77 actions=drop | |
946 | EOF | |
947 | AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl | |
948 | idle_timeout=10, in_port=2,dl_src=00:44:55:66:77:88 actions=drop | |
949 | idle_timeout=20, in_port=1,dl_src=00:11:22:33:44:55 actions=drop | |
950 | idle_timeout=30, in_port=1,dl_src=00:22:33:44:55:66 actions=drop | |
951 | idle_timeout=40, in_port=1,dl_src=00:33:44:55:66:77 actions=drop | |
952 | OFPST_FLOW reply (OF1.2): | |
953 | ]) | |
954 | # Adding another flow will cause the one that expires soonest within | |
955 | # the largest group (those with in_port=1) to be evicted. In this | |
956 | # case this is not the same as the one that expires soonest overall | |
957 | # (which is what makes the test interesting): | |
958 | AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 in_port=2,dl_src=00:55:66:77:88:99,actions=drop]) | |
959 | AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl | |
960 | idle_timeout=10, in_port=2,dl_src=00:44:55:66:77:88 actions=drop | |
961 | idle_timeout=30, in_port=1,dl_src=00:22:33:44:55:66 actions=drop | |
962 | idle_timeout=40, in_port=1,dl_src=00:33:44:55:66:77 actions=drop | |
963 | in_port=2,dl_src=00:55:66:77:88:99 actions=drop | |
964 | OFPST_FLOW reply (OF1.2): | |
965 | ]) | |
966 | # Enlarge the flow limit, change the eviction policy back to strictly | |
967 | # based on expiration, and and add some flows. | |
968 | AT_CHECK([ovs-vsctl set Flow_Table evict groups='[[]]' flow-limit=7]) | |
969 | ovs-ofctl -O OpenFlow12 add-flows br0 - <<EOF | |
970 | idle_timeout=50 in_port=2 dl_src=00:66:77:88:99:aa actions=drop | |
971 | idle_timeout=60 in_port=2 dl_src=00:77:88:99:aa:bb actions=drop | |
972 | idle_timeout=70 in_port=2 dl_src=00:88:99:aa:bb:cc actions=drop | |
973 | EOF | |
974 | AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl | |
975 | idle_timeout=10, in_port=2,dl_src=00:44:55:66:77:88 actions=drop | |
976 | idle_timeout=30, in_port=1,dl_src=00:22:33:44:55:66 actions=drop | |
977 | idle_timeout=40, in_port=1,dl_src=00:33:44:55:66:77 actions=drop | |
978 | idle_timeout=50, in_port=2,dl_src=00:66:77:88:99:aa actions=drop | |
979 | idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=drop | |
980 | idle_timeout=70, in_port=2,dl_src=00:88:99:aa:bb:cc actions=drop | |
981 | in_port=2,dl_src=00:55:66:77:88:99 actions=drop | |
982 | OFPST_FLOW reply (OF1.2): | |
983 | ]) | |
984 | # Adding another flow will cause the one that expires soonest overall | |
985 | # to be evicted. | |
986 | 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']) | |
987 | AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl | |
988 | idle_timeout=30, in_port=1,dl_src=00:22:33:44:55:66 actions=drop | |
989 | idle_timeout=40, in_port=1,dl_src=00:33:44:55:66:77 actions=drop | |
990 | idle_timeout=50, in_port=2,dl_src=00:66:77:88:99:aa actions=drop | |
991 | idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=drop | |
992 | idle_timeout=70, in_port=2,dl_src=00:88:99:aa:bb:cc actions=drop | |
993 | idle_timeout=80, in_port=2,dl_src=00:99:aa:bb:cc:dd actions=drop | |
994 | in_port=2,dl_src=00:55:66:77:88:99 actions=drop | |
995 | OFPST_FLOW reply (OF1.2): | |
996 | ]) | |
997 | # Reducing the flow limit also causes the flows that expire soonest | |
998 | # overall to be evicted. | |
999 | AT_CHECK([ovs-vsctl set Flow_Table evict flow-limit=4]) | |
1000 | AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl | |
1001 | idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=drop | |
1002 | idle_timeout=70, in_port=2,dl_src=00:88:99:aa:bb:cc actions=drop | |
1003 | idle_timeout=80, in_port=2,dl_src=00:99:aa:bb:cc:dd actions=drop | |
1004 | in_port=2,dl_src=00:55:66:77:88:99 actions=drop | |
1005 | OFPST_FLOW reply (OF1.2): | |
1006 | ]) | |
1007 | OVS_VSWITCHD_STOP | |
1008 | AT_CLEANUP | |
1009 | ||
1010 | AT_SETUP([ofproto - asynchronous message control (OpenFlow 1.0)]) | |
80d5aefd BP |
1011 | OVS_VSWITCHD_START |
1012 | AT_CHECK([ovs-ofctl -P openflow10 monitor br0 --detach --no-chdir --pidfile]) | |
1013 | check_async () { | |
1014 | printf '\n\n--- check_async %d ---\n\n\n' $1 | |
1015 | shift | |
1016 | ||
6fc67c4f | 1017 | ovs-appctl -t ovs-ofctl ofctl/barrier |
80d5aefd BP |
1018 | ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log |
1019 | : > expout | |
1020 | ||
a7349929 | 1021 | # OFPT_PACKET_IN, OFPR_ACTION (controller_id=0) |
7f05e7ab | 1022 | ovs-ofctl -v packet-out br0 controller controller '0001020304050010203040501234' |
80d5aefd | 1023 | if test X"$1" = X"OFPR_ACTION"; then shift; |
7f05e7ab | 1024 | echo >>expout "OFPT_PACKET_IN: total_len=14 in_port=CONTROLLER (via action) data_len=14 (unbuffered) |
3f78c3cc | 1025 | 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 |
1026 | fi |
1027 | ||
a7349929 | 1028 | # OFPT_PACKET_IN, OFPR_NO_MATCH (controller_id=123) |
7f05e7ab | 1029 | ovs-ofctl -v packet-out br0 controller 'controller(reason=no_match,id=123)' '0001020304050010203040501234' |
a7349929 | 1030 | if test X"$1" = X"OFPR_NO_MATCH"; then shift; |
7f05e7ab | 1031 | echo >>expout "OFPT_PACKET_IN: total_len=14 in_port=CONTROLLER (via no_match) data_len=14 (unbuffered) |
3f78c3cc | 1032 | 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 |
1033 | fi |
1034 | ||
1035 | # OFPT_PACKET_IN, OFPR_INVALID_TTL (controller_id=0) | |
7f05e7ab | 1036 | ovs-ofctl packet-out br0 controller dec_ttl '002583dfb4000026b98cb0f908004500003fb7e200000011339bac11370dac100002d7730035002b8f6d86fb0100000100000000000006626c702d7873066e696369726103636f6d00000f00' |
80d5aefd | 1037 | if test X"$1" = X"OFPR_INVALID_TTL"; then shift; |
7f05e7ab | 1038 | echo >>expout "OFPT_PACKET_IN: total_len=76 in_port=CONTROLLER (via invalid_ttl) data_len=76 (unbuffered) |
3f78c3cc | 1039 | 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 |
1040 | fi |
1041 | ||
1042 | # OFPT_PORT_STATUS, OFPPR_ADD | |
e1b1d06a | 1043 | ovs-vsctl add-port br0 test -- set Interface test type=dummy ofport_request=1 |
80d5aefd BP |
1044 | if test X"$1" = X"OFPPR_ADD"; then shift; |
1045 | echo >>expout "OFPT_PORT_STATUS: ADD: 1(test): addr:aa:55:aa:55:00:0x | |
1046 | config: PORT_DOWN | |
9e1fd49b | 1047 | state: LINK_DOWN |
d02a5f8e | 1048 | speed: 0 Mbps now, 0 Mbps max" |
80d5aefd BP |
1049 | fi |
1050 | ||
1051 | # OFPT_PORT_STATUS, OFPPR_DELETE | |
1052 | ovs-vsctl del-port br0 test | |
1053 | if test X"$1" = X"OFPPR_DELETE"; then shift; | |
1054 | echo >>expout "OFPT_PORT_STATUS: DEL: 1(test): addr:aa:55:aa:55:00:0x | |
1055 | config: PORT_DOWN | |
9e1fd49b | 1056 | state: LINK_DOWN |
d02a5f8e | 1057 | speed: 0 Mbps now, 0 Mbps max" |
80d5aefd BP |
1058 | fi |
1059 | ||
1060 | # OFPT_FLOW_REMOVED, OFPRR_DELETE | |
1061 | ovs-ofctl add-flow br0 send_flow_rem,actions=drop | |
1062 | ovs-ofctl --strict del-flows br0 '' | |
1063 | if test X"$1" = X"OFPRR_DELETE"; then shift; | |
1064 | echo >>expout "OFPT_FLOW_REMOVED: reason=delete" | |
1065 | fi | |
1066 | AT_FAIL_IF([test X"$1" != X]) | |
1067 | ||
1068 | ovs-appctl -t ovs-ofctl ofctl/barrier | |
fd0aa9ea | 1069 | echo >>expout "OFPT_BARRIER_REPLY:" |
80d5aefd BP |
1070 | |
1071 | AT_CHECK( | |
1072 | [[sed ' | |
1073 | s/ (xid=0x[0-9a-fA-F]*)// | |
1074 | s/ *duration.*// | |
1075 | s/00:0.$/00:0x/' < monitor.log]], | |
1076 | [0], [expout]) | |
1077 | } | |
1078 | ||
1079 | # It's a service connection so initially there should be no async messages. | |
1080 | check_async 1 | |
1081 | ||
99811d07 | 1082 | # Set miss_send_len to 128, turning on packet-ins for our service connection. |
80d5aefd BP |
1083 | ovs-appctl -t ovs-ofctl ofctl/send 0109000c0123456700000080 |
1084 | check_async 2 OFPR_ACTION OFPPR_ADD OFPPR_DELETE OFPRR_DELETE | |
1085 | ||
1086 | # Set miss_send_len to 128 and enable invalid_ttl. | |
1087 | ovs-appctl -t ovs-ofctl ofctl/send 0109000c0123456700040080 | |
1088 | check_async 3 OFPR_ACTION OFPR_INVALID_TTL OFPPR_ADD OFPPR_DELETE OFPRR_DELETE | |
1089 | ||
1090 | # Become slave, which should disable everything except port status. | |
1091 | ovs-appctl -t ovs-ofctl ofctl/send 0104001400000002000023200000000a00000002 | |
1092 | check_async 4 OFPPR_ADD OFPPR_DELETE | |
1093 | ||
1094 | # Use NXT_SET_ASYNC_CONFIG to enable a patchwork of asynchronous messages. | |
1095 | ovs-appctl -t ovs-ofctl ofctl/send 01040028000000020000232000000013000000020000000500000005000000020000000200000005 | |
1096 | check_async 5 OFPR_INVALID_TTL OFPPR_DELETE OFPRR_DELETE | |
1097 | ||
a7349929 BP |
1098 | # Set controller ID 123. |
1099 | ovs-appctl -t ovs-ofctl ofctl/send 01040018000000030000232000000014000000000000007b | |
1100 | check_async 6 OFPR_NO_MATCH OFPPR_DELETE OFPRR_DELETE | |
1101 | ||
1102 | # Restore controller ID 0. | |
1103 | ovs-appctl -t ovs-ofctl ofctl/send 010400180000000300002320000000140000000000000000 | |
1104 | ||
80d5aefd BP |
1105 | # Become master. |
1106 | ovs-appctl -t ovs-ofctl ofctl/send 0104001400000002000023200000000a00000001 | |
a7349929 | 1107 | check_async 7 OFPR_ACTION OFPPR_ADD |
80d5aefd BP |
1108 | |
1109 | ovs-appctl -t ovs-ofctl exit | |
94c33672 | 1110 | OVS_VSWITCHD_STOP |
80d5aefd | 1111 | AT_CLEANUP |
751c7785 | 1112 | |
9dcd1c00 SH |
1113 | AT_SETUP([ofproto - asynchronous message control (OpenFlow 1.2)]) |
1114 | OVS_VSWITCHD_START | |
1115 | AT_CHECK([ovs-ofctl -O OpenFlow12 monitor br0 --detach --no-chdir --pidfile]) | |
1116 | check_async () { | |
1117 | printf '\n\n--- check_async %d ---\n\n\n' $1 | |
1118 | INDEX=$1 | |
1119 | shift | |
1120 | ||
1121 | ovs-appctl -t ovs-ofctl ofctl/barrier | |
1122 | ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log | |
1123 | : > expout | |
1124 | ||
1125 | # OFPT_PACKET_IN, OFPR_ACTION (controller_id=0) | |
1126 | ovs-ofctl -O OpenFlow12 -v packet-out br0 none controller '0001020304050010203040501234' | |
1127 | if test X"$1" = X"OFPR_ACTION"; then shift; | |
1128 | echo >>expout "OFPT_PACKET_IN (OF1.2): total_len=14 in_port=ANY (via action) data_len=14 (unbuffered) | |
1129 | 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" | |
1130 | fi | |
1131 | ||
1132 | # OFPT_PACKET_IN, OFPR_NO_MATCH (controller_id=123) | |
1133 | ovs-ofctl -O OpenFlow12 -v packet-out br0 none 'controller(reason=no_match,id=123)' '0001020304050010203040501234' | |
1134 | if test X"$1" = X"OFPR_NO_MATCH"; then shift; | |
1135 | echo >>expout "OFPT_PACKET_IN (OF1.2): total_len=14 in_port=ANY (via no_match) data_len=14 (unbuffered) | |
1136 | 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" | |
1137 | fi | |
1138 | ||
1139 | # OFPT_PACKET_IN, OFPR_INVALID_TTL (controller_id=0) | |
1140 | ovs-ofctl -O OpenFlow12 packet-out br0 none dec_ttl '002583dfb4000026b98cb0f908004500003fb7e200000011339bac11370dac100002d7730035002b8f6d86fb0100000100000000000006626c702d7873066e696369726103636f6d00000f00' | |
1141 | if test X"$1" = X"OFPR_INVALID_TTL"; then shift; | |
1142 | echo >>expout "OFPT_PACKET_IN (OF1.2): total_len=76 in_port=ANY (via invalid_ttl) data_len=76 (unbuffered) | |
1143 | 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" | |
1144 | fi | |
1145 | ||
1146 | # OFPT_PORT_STATUS, OFPPR_ADD | |
1147 | ovs-vsctl add-port br0 test -- set Interface test type=dummy | |
1148 | if test X"$1" = X"OFPPR_ADD"; then shift; | |
1149 | echo >>expout "OFPT_PORT_STATUS (OF1.2): ADD: ${INDEX}(test): addr:aa:55:aa:55:00:0x | |
1150 | config: PORT_DOWN | |
1151 | state: LINK_DOWN | |
1152 | speed: 0 Mbps now, 0 Mbps max" | |
1153 | fi | |
1154 | ||
1155 | # OFPT_PORT_STATUS, OFPPR_DELETE | |
1156 | ovs-vsctl del-port br0 test | |
1157 | if test X"$1" = X"OFPPR_DELETE"; then shift; | |
1158 | echo >>expout "OFPT_PORT_STATUS (OF1.2): DEL: ${INDEX}(test): addr:aa:55:aa:55:00:0x | |
1159 | config: PORT_DOWN | |
1160 | state: LINK_DOWN | |
1161 | speed: 0 Mbps now, 0 Mbps max" | |
1162 | fi | |
1163 | ||
1164 | # OFPT_FLOW_REMOVED, OFPRR_DELETE | |
1165 | ovs-ofctl -O OpenFlow12 add-flow br0 send_flow_rem,actions=drop | |
1166 | ovs-ofctl -O OpenFlow12 --strict del-flows br0 '' | |
1167 | if test X"$1" = X"OFPRR_DELETE"; then shift; | |
1168 | echo >>expout "OFPT_FLOW_REMOVED (OF1.2): reason=delete table_id=0" | |
1169 | fi | |
1170 | AT_FAIL_IF([test X"$1" != X]) | |
1171 | ||
1172 | ovs-appctl -t ovs-ofctl ofctl/barrier | |
1173 | echo >>expout "OFPT_BARRIER_REPLY (OF1.2):" | |
1174 | ||
1175 | AT_CHECK( | |
1176 | [[sed ' | |
1177 | s/ (xid=0x[0-9a-fA-F]*)// | |
1178 | s/ *duration.*// | |
1179 | s/00:0.$/00:0x/' < monitor.log]], | |
1180 | [0], [expout]) | |
1181 | } | |
1182 | ||
1183 | # It's a service connection so initially there should be no async messages. | |
1184 | check_async 1 | |
1185 | ||
1186 | # Set miss_send_len to 128, turning on packet-ins for our service connection. | |
1187 | ovs-appctl -t ovs-ofctl ofctl/send 0309000c0123456700000080 | |
1188 | check_async 2 OFPR_ACTION OFPPR_ADD OFPPR_DELETE OFPRR_DELETE | |
1189 | ||
1190 | # Set miss_send_len to 128 and enable invalid_ttl. | |
1191 | ovs-appctl -t ovs-ofctl ofctl/send 0309000c0123456700040080 | |
1192 | check_async 3 OFPR_ACTION OFPR_INVALID_TTL OFPPR_ADD OFPPR_DELETE OFPRR_DELETE | |
1193 | ||
6ea4776b JR |
1194 | # Become slave (OF 1.2), which should disable everything except port status. |
1195 | ovs-appctl -t ovs-ofctl ofctl/send 031800180000000200000003000000000000000000000001 | |
9dcd1c00 SH |
1196 | check_async 4 OFPPR_ADD OFPPR_DELETE |
1197 | ||
1198 | # Use NXT_SET_ASYNC_CONFIG to enable a patchwork of asynchronous messages. | |
1199 | ovs-appctl -t ovs-ofctl ofctl/send 03040028000000020000232000000013000000020000000500000005000000020000000200000005 | |
1200 | check_async 5 OFPR_INVALID_TTL OFPPR_DELETE OFPRR_DELETE | |
1201 | ||
1202 | # Set controller ID 123. | |
1203 | ovs-appctl -t ovs-ofctl ofctl/send 03040018000000030000232000000014000000000000007b | |
1204 | check_async 6 OFPR_NO_MATCH OFPPR_DELETE OFPRR_DELETE | |
1205 | ||
1206 | # Restore controller ID 0. | |
1207 | ovs-appctl -t ovs-ofctl ofctl/send 030400180000000300002320000000140000000000000000 | |
1208 | ||
6ea4776b JR |
1209 | # Become master (OF 1.2). |
1210 | ovs-appctl -t ovs-ofctl ofctl/send 031800180000000400000002000000000000000000000002 | |
9dcd1c00 SH |
1211 | check_async 7 OFPR_ACTION OFPPR_ADD |
1212 | ||
1213 | ovs-appctl -t ovs-ofctl exit | |
1214 | OVS_VSWITCHD_STOP | |
1215 | AT_CLEANUP | |
1216 | ||
b21eb1da JR |
1217 | AT_SETUP([ofproto - asynchronous message control (OpenFlow 1.3)]) |
1218 | OVS_VSWITCHD_START | |
1219 | AT_CHECK([ovs-ofctl -O OpenFlow13 monitor br0 --detach --no-chdir --pidfile]) | |
1220 | check_async () { | |
1221 | printf '\n\n--- check_async %d ---\n\n\n' $1 | |
1222 | INDEX=$1 | |
1223 | shift | |
1224 | ||
1225 | ovs-appctl -t ovs-ofctl ofctl/barrier | |
1226 | ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log | |
1227 | : > expout | |
1228 | ||
1229 | # OFPT_PACKET_IN, OFPR_ACTION (controller_id=0) | |
1230 | ovs-ofctl -O OpenFlow13 -v packet-out br0 none controller '0001020304050010203040501234' | |
1231 | if test X"$1" = X"OFPR_ACTION"; then shift; | |
1232 | echo >>expout "OFPT_PACKET_IN (OF1.3): total_len=14 in_port=ANY (via action) data_len=14 (unbuffered) | |
1233 | 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" | |
1234 | fi | |
1235 | ||
1236 | # OFPT_PACKET_IN, OFPR_NO_MATCH (controller_id=123) | |
1237 | ovs-ofctl -O OpenFlow13 -v packet-out br0 none 'controller(reason=no_match,id=123)' '0001020304050010203040501234' | |
1238 | if test X"$1" = X"OFPR_NO_MATCH"; then shift; | |
1239 | echo >>expout "OFPT_PACKET_IN (OF1.3): total_len=14 in_port=ANY (via no_match) data_len=14 (unbuffered) | |
1240 | 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" | |
1241 | fi | |
1242 | ||
1243 | # OFPT_PACKET_IN, OFPR_INVALID_TTL (controller_id=0) | |
1244 | ovs-ofctl -O OpenFlow13 packet-out br0 none dec_ttl '002583dfb4000026b98cb0f908004500003fb7e200000011339bac11370dac100002d7730035002b8f6d86fb0100000100000000000006626c702d7873066e696369726103636f6d00000f00' | |
1245 | if test X"$1" = X"OFPR_INVALID_TTL"; then shift; | |
1246 | echo >>expout "OFPT_PACKET_IN (OF1.3): total_len=76 in_port=ANY (via invalid_ttl) data_len=76 (unbuffered) | |
1247 | 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" | |
1248 | fi | |
1249 | ||
1250 | # OFPT_PORT_STATUS, OFPPR_ADD | |
1251 | ovs-vsctl add-port br0 test -- set Interface test type=dummy | |
1252 | if test X"$1" = X"OFPPR_ADD"; then shift; | |
1253 | echo >>expout "OFPT_PORT_STATUS (OF1.3): ADD: ${INDEX}(test): addr:aa:55:aa:55:00:0x | |
1254 | config: PORT_DOWN | |
1255 | state: LINK_DOWN | |
1256 | speed: 0 Mbps now, 0 Mbps max" | |
1257 | fi | |
1258 | ||
1259 | # OFPT_PORT_STATUS, OFPPR_DELETE | |
1260 | ovs-vsctl del-port br0 test | |
1261 | if test X"$1" = X"OFPPR_DELETE"; then shift; | |
1262 | echo >>expout "OFPT_PORT_STATUS (OF1.3): DEL: ${INDEX}(test): addr:aa:55:aa:55:00:0x | |
1263 | config: PORT_DOWN | |
1264 | state: LINK_DOWN | |
1265 | speed: 0 Mbps now, 0 Mbps max" | |
1266 | fi | |
1267 | ||
1268 | # OFPT_FLOW_REMOVED, OFPRR_DELETE | |
1269 | ovs-ofctl -O OpenFlow13 add-flow br0 send_flow_rem,actions=drop | |
1270 | ovs-ofctl -O OpenFlow13 --strict del-flows br0 '' | |
1271 | if test X"$1" = X"OFPRR_DELETE"; then shift; | |
1272 | echo >>expout "OFPT_FLOW_REMOVED (OF1.3): reason=delete table_id=0" | |
1273 | fi | |
1274 | AT_FAIL_IF([test X"$1" != X]) | |
1275 | ||
1276 | ovs-appctl -t ovs-ofctl ofctl/barrier | |
1277 | echo >>expout "OFPT_BARRIER_REPLY (OF1.3):" | |
1278 | ||
1279 | AT_CHECK( | |
1280 | [[sed ' | |
1281 | s/ (xid=0x[0-9a-fA-F]*)// | |
1282 | s/ *duration.*// | |
1283 | s/00:0.$/00:0x/' < monitor.log]], | |
1284 | [0], [expout]) | |
1285 | } | |
1286 | ||
1287 | # It's a service connection so initially there should be no async messages. | |
1288 | check_async 1 | |
1289 | ||
1290 | # Set miss_send_len to 128, turning on packet-ins for our service connection. | |
1291 | ovs-appctl -t ovs-ofctl ofctl/send 0409000c0123456700000080 | |
1292 | check_async 2 OFPR_ACTION OFPPR_ADD OFPPR_DELETE OFPRR_DELETE | |
1293 | ||
1294 | # Become slave (OF 1.3), which should disable everything except port status. | |
1295 | ovs-appctl -t ovs-ofctl ofctl/send 041800180000000200000003000000000000000000000001 | |
1296 | check_async 3 OFPPR_ADD OFPPR_DELETE | |
1297 | ||
1298 | # Use OF 1.3 OFPT_SET_ASYNC to enable a patchwork of asynchronous messages. | |
1299 | ovs-appctl -t ovs-ofctl ofctl/send 041c002000000002000000020000000500000005000000020000000200000005 | |
1300 | check_async 4 OFPR_INVALID_TTL OFPPR_DELETE OFPRR_DELETE | |
1301 | ||
1302 | # Set controller ID 123. | |
1303 | ovs-appctl -t ovs-ofctl ofctl/send 04040018000000030000232000000014000000000000007b | |
1304 | check_async 5 OFPR_NO_MATCH OFPPR_DELETE OFPRR_DELETE | |
1305 | ||
1306 | # Restore controller ID 0. | |
1307 | ovs-appctl -t ovs-ofctl ofctl/send 040400180000000300002320000000140000000000000000 | |
1308 | ||
1309 | # Become master (OF 1.3). | |
1310 | ovs-appctl -t ovs-ofctl ofctl/send 041800180000000400000002000000000000000000000002 | |
1311 | check_async 6 OFPR_ACTION OFPPR_ADD | |
1312 | ||
1313 | ovs-appctl -t ovs-ofctl exit | |
1314 | OVS_VSWITCHD_STOP | |
1315 | AT_CLEANUP | |
1316 | ||
6ea4776b JR |
1317 | dnl This test checks that the role request/response messaging works |
1318 | dnl and that generation_id is handled properly. | |
1319 | AT_SETUP([ofproto - controller role (OpenFlow 1.2)]) | |
1320 | OVS_VSWITCHD_START | |
1321 | AT_CHECK([ovs-ofctl -O OpenFlow12 monitor br0 --detach --no-chdir --pidfile]) | |
1322 | ||
1323 | ovs-appctl -t ovs-ofctl ofctl/barrier | |
1324 | ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log | |
1325 | : > expout | |
1326 | ||
1327 | # find out current role | |
1328 | ovs-appctl -t ovs-ofctl ofctl/send 031800180000000200000000000000000000000000000000 | |
1329 | echo >>expout "send: OFPT_ROLE_REQUEST (OF1.2) (xid=0x2): role=nochange" | |
1330 | echo >>expout "OFPT_ROLE_REPLY (OF1.2) (xid=0x2): role=equal" | |
1331 | ||
1332 | # Become slave (generation_id is initially undefined, so 2^63+2 should not be stale) | |
1333 | ovs-appctl -t ovs-ofctl ofctl/send 031800180000000300000003000000008000000000000002 | |
1334 | echo >>expout "send: OFPT_ROLE_REQUEST (OF1.2) (xid=0x3): role=slave generation_id=9223372036854775810" | |
1335 | echo >>expout "OFPT_ROLE_REPLY (OF1.2) (xid=0x3): role=slave" | |
1336 | ||
1337 | # Try to become the master using a stale generation ID | |
1338 | ovs-appctl -t ovs-ofctl ofctl/send 031800180000000400000002000000000000000000000002 | |
1339 | echo >>expout "send: OFPT_ROLE_REQUEST (OF1.2) (xid=0x4): role=master generation_id=2" | |
1340 | echo >>expout "OFPT_ERROR (OF1.2) (xid=0x4): OFPRRFC_STALE" | |
1341 | echo >>expout "OFPT_ROLE_REQUEST (OF1.2) (xid=0x4): role=master generation_id=2" | |
1342 | ||
1343 | # Become master using a valid generation ID | |
1344 | ovs-appctl -t ovs-ofctl ofctl/send 031800180000000500000002000000000000000000000001 | |
1345 | echo >>expout "send: OFPT_ROLE_REQUEST (OF1.2) (xid=0x5): role=master generation_id=1" | |
1346 | echo >>expout "OFPT_ROLE_REPLY (OF1.2) (xid=0x5): role=master" | |
1347 | ovs-appctl -t ovs-ofctl ofctl/barrier | |
1348 | echo >>expout "OFPT_BARRIER_REPLY (OF1.2) (xid=0x3):" | |
1349 | ||
1350 | AT_CHECK([cat monitor.log], [0], [expout]) | |
1351 | ||
1352 | ovs-appctl -t ovs-ofctl exit | |
1353 | OVS_VSWITCHD_STOP | |
1354 | AT_CLEANUP | |
1355 | ||
751c7785 BP |
1356 | dnl This test checks that OFPT_PACKET_OUT accepts both OFPP_NONE (as |
1357 | dnl specified by OpenFlow 1.0) and OFPP_CONTROLLER (used by some | |
1358 | dnl controllers despite the spec) as meaning a packet that was generated | |
1359 | dnl by the controller. | |
9dcd1c00 | 1360 | AT_SETUP([ofproto - packet-out from controller (OpenFlow 1.0)]) |
751c7785 BP |
1361 | OVS_VSWITCHD_START |
1362 | ||
1363 | # Start a monitor listening for packet-ins. | |
1364 | AT_CHECK([ovs-ofctl -P openflow10 monitor br0 --detach --no-chdir --pidfile]) | |
1365 | ovs-appctl -t ovs-ofctl ofctl/send 0109000c0123456700000080 | |
1366 | ovs-appctl -t ovs-ofctl ofctl/barrier | |
1367 | ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log | |
1368 | AT_CAPTURE_FILE([monitor.log]) | |
1369 | ||
1370 | # Send some packet-outs with OFPP_NONE and OFPP_CONTROLLER (65533) as in_port. | |
1371 | AT_CHECK([ovs-ofctl packet-out br0 none controller '0001020304050010203040501234']) | |
c6100d92 | 1372 | AT_CHECK([ovs-ofctl packet-out br0 controller controller '0001020304050010203040505678']) |
751c7785 BP |
1373 | |
1374 | # Stop the monitor and check its output. | |
1375 | ovs-appctl -t ovs-ofctl ofctl/barrier | |
1376 | ovs-appctl -t ovs-ofctl exit | |
1377 | ||
1378 | AT_CHECK([sed 's/ (xid=0x[[0-9a-fA-F]]*)//' monitor.log], [0], [dnl | |
7f05e7ab | 1379 | OFPT_PACKET_IN: total_len=14 in_port=ANY (via action) data_len=14 (unbuffered) |
3f78c3cc | 1380 | 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 | 1381 | OFPT_PACKET_IN: total_len=14 in_port=CONTROLLER (via action) data_len=14 (unbuffered) |
3f78c3cc | 1382 | 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 |
1383 | OFPT_BARRIER_REPLY: |
1384 | ]) | |
1385 | ||
1386 | OVS_VSWITCHD_STOP | |
1387 | AT_CLEANUP | |
1388 | ||
9dcd1c00 SH |
1389 | dnl This test checks that OFPT_PACKET_OUT accepts both OFPP_NONE (as |
1390 | dnl specified by OpenFlow 1.2) and OFPP_CONTROLLER (used by some | |
1391 | dnl controllers despite the spec) as meaning a packet that was generated | |
1392 | dnl by the controller. | |
1393 | AT_SETUP([ofproto - packet-out from controller (OpenFlow 1.2)]) | |
1394 | OVS_VSWITCHD_START | |
1395 | ||
1396 | # Start a monitor listening for packet-ins. | |
1397 | AT_CHECK([ovs-ofctl -O OpenFlow12 monitor br0 --detach --no-chdir --pidfile]) | |
1398 | ovs-appctl -t ovs-ofctl ofctl/send 0309000c0123456700000080 | |
1399 | ovs-appctl -t ovs-ofctl ofctl/barrier | |
1400 | ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log | |
1401 | AT_CAPTURE_FILE([monitor.log]) | |
1402 | ||
1403 | # Send some packet-outs with OFPP_NONE and OFPP_CONTROLLER (65533) as in_port. | |
1404 | AT_CHECK([ovs-ofctl -O OpenFlow12 packet-out br0 none controller '0001020304050010203040501234']) | |
1405 | AT_CHECK([ovs-ofctl -O OpenFlow12 packet-out br0 4294967293 controller '0001020304050010203040505678']) | |
1406 | ||
1407 | # Stop the monitor and check its output. | |
1408 | ovs-appctl -t ovs-ofctl ofctl/barrier | |
1409 | ovs-appctl -t ovs-ofctl exit | |
1410 | ||
1411 | AT_CHECK([sed 's/ (xid=0x[[0-9a-fA-F]]*)//' monitor.log], [0], [dnl | |
1412 | OFPT_PACKET_IN (OF1.2): total_len=14 in_port=ANY (via action) data_len=14 (unbuffered) | |
1413 | 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 | |
1414 | OFPT_PACKET_IN (OF1.2): total_len=14 in_port=CONTROLLER (via action) data_len=14 (unbuffered) | |
1415 | 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 | |
1416 | OFPT_BARRIER_REPLY (OF1.2): | |
1417 | ]) | |
1418 | ||
1419 | OVS_VSWITCHD_STOP | |
1420 | AT_CLEANUP | |
1421 | ||
969fc56c JS |
1422 | dnl This test checks that metadata is encoded in packet_in structures, |
1423 | dnl supported by NXAST. | |
1424 | AT_SETUP([ofproto - packet-out with metadata (NXM)]) | |
1425 | OVS_VSWITCHD_START | |
1426 | ||
1427 | # Start a monitor listening for packet-ins. | |
1428 | AT_CHECK([ovs-ofctl -P nxm monitor br0 --detach --no-chdir --pidfile]) | |
1429 | ovs-appctl -t ovs-ofctl ofctl/send 0109000c0123456700000080 | |
1430 | ovs-appctl -t ovs-ofctl ofctl/barrier | |
1431 | ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log | |
1432 | AT_CAPTURE_FILE([monitor.log]) | |
1433 | ||
1434 | # Send a packet-out with a load action to set some metadata, and forward to controller | |
7f05e7ab | 1435 | AT_CHECK([ovs-ofctl packet-out br0 controller 'load(0xfafafafa5a5a5a5a->OXM_OF_METADATA[[0..63]]), controller' '0001020304050010203040501234']) |
969fc56c JS |
1436 | |
1437 | # Stop the monitor and check its output. | |
1438 | ovs-appctl -t ovs-ofctl ofctl/barrier | |
1439 | ovs-appctl -t ovs-ofctl exit | |
1440 | ||
1441 | AT_CHECK([sed 's/ (xid=0x[[0-9a-fA-F]]*)//' monitor.log], [0], [dnl | |
7f05e7ab | 1442 | NXT_PACKET_IN: total_len=14 in_port=CONTROLLER metadata=0xfafafafa5a5a5a5a (via action) data_len=14 (unbuffered) |
3f78c3cc | 1443 | 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 |
1444 | OFPT_BARRIER_REPLY: |
1445 | ]) | |
1446 | ||
1447 | OVS_VSWITCHD_STOP | |
1448 | AT_CLEANUP | |
2b07c8b1 | 1449 | |
9dcd1c00 SH |
1450 | dnl This test checks that metadata is encoded in packet_in structures, |
1451 | dnl supported by NXAST. | |
1452 | AT_SETUP([ofproto - packet-out with metadata (OpenFlow 1.2)]) | |
1453 | OVS_VSWITCHD_START | |
1454 | ||
1455 | # Start a monitor listening for packet-ins. | |
1456 | AT_CHECK([ovs-ofctl -O OpenFlow12 monitor br0 --detach --no-chdir --pidfile]) | |
1457 | ovs-appctl -t ovs-ofctl ofctl/send 0309000c0123456700000080 | |
1458 | ovs-appctl -t ovs-ofctl ofctl/barrier | |
1459 | ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log | |
1460 | AT_CAPTURE_FILE([monitor.log]) | |
1461 | ||
1462 | # Send a packet-out with a load action to set some metadata, and forward to controller | |
1463 | AT_CHECK([ovs-ofctl -O OpenFlow12 packet-out br0 none 'load(0xfafafafa5a5a5a5a->OXM_OF_METADATA[[0..63]]), controller' '0001020304050010203040501234']) | |
1464 | ||
1465 | # Stop the monitor and check its output. | |
1466 | ovs-appctl -t ovs-ofctl ofctl/barrier | |
1467 | ovs-appctl -t ovs-ofctl exit | |
1468 | ||
1469 | AT_CHECK([sed 's/ (xid=0x[[0-9a-fA-F]]*)//' monitor.log], [0], [dnl | |
1470 | OFPT_PACKET_IN (OF1.2): total_len=14 in_port=ANY metadata=0xfafafafa5a5a5a5a (via action) 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 | OFPT_BARRIER_REPLY (OF1.2): | |
1473 | ]) | |
1474 | ||
1475 | OVS_VSWITCHD_STOP | |
1476 | AT_CLEANUP | |
1477 | ||
2b07c8b1 BP |
1478 | AT_SETUP([ofproto - flow monitoring]) |
1479 | AT_KEYWORDS([monitor]) | |
1480 | OVS_VSWITCHD_START | |
1481 | ||
1482 | ovs-ofctl add-flow br0 in_port=0,dl_vlan=123,actions=output:1 | |
1483 | ||
1484 | # Start a monitor watching the flow table and check the initial reply. | |
1485 | ovs-ofctl monitor br0 watch: --detach --no-chdir --pidfile >monitor.log 2>&1 | |
1486 | AT_CAPTURE_FILE([monitor.log]) | |
1487 | ovs-appctl -t ovs-ofctl ofctl/barrier | |
1488 | AT_CHECK([sed 's/ (xid=0x[[1-9a-fA-F]][[0-9a-fA-F]]*)//' monitor.log], [0], | |
1489 | [NXST_FLOW_MONITOR reply: | |
1490 | event=ADDED table=0 cookie=0 in_port=0,dl_vlan=123 actions=output:1 | |
1491 | OFPT_BARRIER_REPLY: | |
1492 | ]) | |
1493 | ||
1494 | # Add, delete, and modify some flows and check the updates. | |
1495 | ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log | |
1496 | ovs-ofctl add-flow br0 in_port=0,dl_vlan=124,actions=output:2 | |
1497 | ovs-ofctl add-flow br0 in_port=0,dl_vlan=123,actions=output:5 | |
95a1c4ca SH |
1498 | ovs-ofctl add-flow br0 in_port=0,dl_vlan=123,dl_vlan_pcp=0,actions=output:6 |
1499 | ovs-ofctl add-flow br0 in_port=0,dl_vlan=123,dl_vlan_pcp=1,actions=output:7 | |
1500 | ovs-ofctl add-flow br0 in_port=0,dl_vlan=123,actions=output:8 | |
1501 | ovs-ofctl add-flow br0 in_port=0,dl_vlan=65535,dl_vlan_pcp=0,actions=output:9 | |
1502 | ovs-ofctl add-flow br0 in_port=0,dl_vlan=65535,dl_vlan_pcp=1,actions=output:10 | |
1503 | ovs-ofctl add-flow br0 in_port=0,dl_vlan=65535,actions=output:11 | |
1504 | ovs-ofctl add-flow br0 in_port=0,dl_vlan=8191,dl_vlan_pcp=0,actions=output:12 | |
1505 | ovs-ofctl add-flow br0 in_port=0,dl_vlan=8191,dl_vlan_pcp=1,actions=output:13 | |
1506 | ovs-ofctl add-flow br0 in_port=0,dl_vlan=8191,actions=output:14 | |
1507 | ovs-ofctl add-flow br0 in_port=0,dl_vlan=0,dl_vlan_pcp=0,actions=output:15 | |
1508 | ovs-ofctl add-flow br0 in_port=0,dl_vlan=0,dl_vlan_pcp=1,actions=output:16 | |
1509 | ovs-ofctl add-flow br0 in_port=0,dl_vlan=0,actions=output:17 | |
1510 | ovs-ofctl add-flow br0 in_port=0,dl_vlan=0,dl_vlan_pcp=0,actions=output:18 | |
1511 | ovs-ofctl add-flow br0 in_port=0,dl_vlan=0,dl_vlan_pcp=1,actions=output:19 | |
1512 | ovs-ofctl add-flow br0 in_port=0,dl_vlan=0,actions=output:20 | |
1513 | ovs-ofctl add-flow br0 in_port=0,dl_vlan_pcp=0,actions=output:21 | |
1514 | ovs-ofctl add-flow br0 in_port=0,dl_vlan_pcp=1,actions=output:22 | |
1515 | ovs-ofctl add-flow br0 in_port=0,actions=output:23 | |
2b07c8b1 BP |
1516 | ovs-ofctl mod-flows br0 cookie=5,dl_vlan=123,actions=output:3 |
1517 | ovs-ofctl del-flows br0 dl_vlan=123 | |
1518 | ovs-ofctl del-flows br0 | |
1519 | ovs-appctl -t ovs-ofctl ofctl/barrier | |
32cd83a2 BP |
1520 | sort=' |
1521 | # Sorts groups of lines that start with a space, without moving them | |
1522 | # past the nearest line that does not start with a space. | |
1523 | use warnings; | |
1524 | use strict; | |
1525 | my @buffer = (); | |
1526 | while (<STDIN>) { | |
1527 | if (/^ /) { | |
1528 | push(@buffer, $_); | |
1529 | } else { | |
1530 | print $_ foreach sort(@buffer); | |
1531 | print $_; | |
1532 | @buffer = (); | |
1533 | } | |
1534 | } | |
1535 | print $_ foreach sort(@buffer); | |
1536 | ' | |
1537 | AT_CHECK([sed 's/ (xid=0x[[1-9a-fA-F]][[0-9a-fA-F]]*)//' monitor.log | perl -e "$sort"], [0], | |
2b07c8b1 BP |
1538 | [NXST_FLOW_MONITOR reply (xid=0x0): |
1539 | event=ADDED table=0 cookie=0 in_port=0,dl_vlan=124 actions=output:2 | |
1540 | NXST_FLOW_MONITOR reply (xid=0x0): | |
1541 | event=ADDED table=0 cookie=0 in_port=0,dl_vlan=123 actions=output:5 | |
95a1c4ca SH |
1542 | NXST_FLOW_MONITOR reply (xid=0x0): |
1543 | event=ADDED table=0 cookie=0 in_port=0,dl_vlan=123,dl_vlan_pcp=0 actions=output:6 | |
1544 | NXST_FLOW_MONITOR reply (xid=0x0): | |
1545 | event=ADDED table=0 cookie=0 in_port=0,dl_vlan=123,dl_vlan_pcp=1 actions=output:7 | |
1546 | NXST_FLOW_MONITOR reply (xid=0x0): | |
1547 | event=ADDED table=0 cookie=0 in_port=0,dl_vlan=123 actions=output:8 | |
1548 | NXST_FLOW_MONITOR reply (xid=0x0): | |
1549 | event=ADDED table=0 cookie=0 in_port=0,dl_vlan=0,dl_vlan_pcp=0 actions=output:9 | |
1550 | NXST_FLOW_MONITOR reply (xid=0x0): | |
1551 | event=ADDED table=0 cookie=0 in_port=0,dl_vlan=0,dl_vlan_pcp=1 actions=output:10 | |
1552 | NXST_FLOW_MONITOR reply (xid=0x0): | |
1553 | event=ADDED table=0 cookie=0 in_port=0,vlan_tci=0x0000 actions=output:11 | |
1554 | NXST_FLOW_MONITOR reply (xid=0x0): | |
1555 | event=ADDED table=0 cookie=0 in_port=0,dl_vlan=4095,dl_vlan_pcp=0 actions=output:12 | |
1556 | NXST_FLOW_MONITOR reply (xid=0x0): | |
1557 | event=ADDED table=0 cookie=0 in_port=0,dl_vlan=4095,dl_vlan_pcp=1 actions=output:13 | |
1558 | NXST_FLOW_MONITOR reply (xid=0x0): | |
1559 | event=ADDED table=0 cookie=0 in_port=0,dl_vlan=4095 actions=output:14 | |
1560 | NXST_FLOW_MONITOR reply (xid=0x0): | |
1561 | event=ADDED table=0 cookie=0 in_port=0,dl_vlan=0,dl_vlan_pcp=0 actions=output:15 | |
1562 | NXST_FLOW_MONITOR reply (xid=0x0): | |
1563 | event=ADDED table=0 cookie=0 in_port=0,dl_vlan=0,dl_vlan_pcp=1 actions=output:16 | |
1564 | NXST_FLOW_MONITOR reply (xid=0x0): | |
1565 | event=ADDED table=0 cookie=0 in_port=0,dl_vlan=0 actions=output:17 | |
1566 | NXST_FLOW_MONITOR reply (xid=0x0): | |
1567 | event=ADDED table=0 cookie=0 in_port=0,dl_vlan=0,dl_vlan_pcp=0 actions=output:18 | |
1568 | NXST_FLOW_MONITOR reply (xid=0x0): | |
1569 | event=ADDED table=0 cookie=0 in_port=0,dl_vlan=0,dl_vlan_pcp=1 actions=output:19 | |
1570 | NXST_FLOW_MONITOR reply (xid=0x0): | |
1571 | event=ADDED table=0 cookie=0 in_port=0,dl_vlan=0 actions=output:20 | |
1572 | NXST_FLOW_MONITOR reply (xid=0x0): | |
1573 | event=ADDED table=0 cookie=0 in_port=0,dl_vlan_pcp=0 actions=output:21 | |
1574 | NXST_FLOW_MONITOR reply (xid=0x0): | |
1575 | event=ADDED table=0 cookie=0 in_port=0,dl_vlan_pcp=1 actions=output:22 | |
1576 | NXST_FLOW_MONITOR reply (xid=0x0): | |
1577 | event=ADDED table=0 cookie=0 in_port=0 actions=output:23 | |
2b07c8b1 BP |
1578 | NXST_FLOW_MONITOR reply (xid=0x0): |
1579 | event=MODIFIED table=0 cookie=0x5 in_port=0,dl_vlan=123 actions=output:3 | |
95a1c4ca SH |
1580 | event=MODIFIED table=0 cookie=0x5 in_port=0,dl_vlan=123,dl_vlan_pcp=0 actions=output:3 |
1581 | event=MODIFIED table=0 cookie=0x5 in_port=0,dl_vlan=123,dl_vlan_pcp=1 actions=output:3 | |
2b07c8b1 BP |
1582 | NXST_FLOW_MONITOR reply (xid=0x0): |
1583 | event=DELETED reason=delete table=0 cookie=0x5 in_port=0,dl_vlan=123 actions=output:3 | |
95a1c4ca SH |
1584 | event=DELETED reason=delete table=0 cookie=0x5 in_port=0,dl_vlan=123,dl_vlan_pcp=0 actions=output:3 |
1585 | event=DELETED reason=delete table=0 cookie=0x5 in_port=0,dl_vlan=123,dl_vlan_pcp=1 actions=output:3 | |
2b07c8b1 | 1586 | NXST_FLOW_MONITOR reply (xid=0x0): |
32cd83a2 | 1587 | event=DELETED reason=delete table=0 cookie=0 in_port=0 actions=output:23 |
95a1c4ca | 1588 | event=DELETED reason=delete table=0 cookie=0 in_port=0,dl_vlan=0 actions=output:20 |
32cd83a2 BP |
1589 | event=DELETED reason=delete table=0 cookie=0 in_port=0,dl_vlan=0,dl_vlan_pcp=0 actions=output:18 |
1590 | event=DELETED reason=delete table=0 cookie=0 in_port=0,dl_vlan=0,dl_vlan_pcp=1 actions=output:19 | |
2b07c8b1 | 1591 | event=DELETED reason=delete table=0 cookie=0 in_port=0,dl_vlan=124 actions=output:2 |
95a1c4ca | 1592 | event=DELETED reason=delete table=0 cookie=0 in_port=0,dl_vlan=4095 actions=output:14 |
32cd83a2 | 1593 | event=DELETED reason=delete table=0 cookie=0 in_port=0,dl_vlan=4095,dl_vlan_pcp=0 actions=output:12 |
95a1c4ca | 1594 | event=DELETED reason=delete table=0 cookie=0 in_port=0,dl_vlan=4095,dl_vlan_pcp=1 actions=output:13 |
32cd83a2 BP |
1595 | event=DELETED reason=delete table=0 cookie=0 in_port=0,dl_vlan_pcp=0 actions=output:21 |
1596 | event=DELETED reason=delete table=0 cookie=0 in_port=0,dl_vlan_pcp=1 actions=output:22 | |
95a1c4ca | 1597 | event=DELETED reason=delete table=0 cookie=0 in_port=0,vlan_tci=0x0000 actions=output:11 |
2b07c8b1 BP |
1598 | OFPT_BARRIER_REPLY: |
1599 | ]) | |
1600 | ||
1601 | # Check that our own changes are reported as abbreviations. | |
1602 | ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log | |
1603 | ovs-ofctl add-flow br0 in_port=1,actions=output:2 | |
1604 | ovs-ofctl add-flow br0 in_port=2,actions=output:1 | |
90d721f0 | 1605 | ovs-appctl -t ovs-ofctl ofctl/barrier |
2b07c8b1 BP |
1606 | ovs-appctl -t ovs-ofctl ofctl/send 010e004812345678003fffff00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003000000000000ffffffffffff0000 |
1607 | ovs-appctl -t ovs-ofctl ofctl/barrier | |
1608 | AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip], [0], [NXST_FLOW reply: | |
1609 | ]) | |
1610 | AT_CHECK([sed 's/ (xid=0x[[1-9a-fA-F]][[0-9a-fA-F]]*)//' monitor.log], [0], | |
1611 | [NXST_FLOW_MONITOR reply (xid=0x0): | |
1612 | event=ADDED table=0 cookie=0 in_port=1 actions=output:2 | |
1613 | NXST_FLOW_MONITOR reply (xid=0x0): | |
1614 | event=ADDED table=0 cookie=0 in_port=2 actions=output:1 | |
90d721f0 | 1615 | OFPT_BARRIER_REPLY: |
2b07c8b1 BP |
1616 | send: OFPT_FLOW_MOD: DEL priority=0 actions=drop |
1617 | NXST_FLOW_MONITOR reply (xid=0x0): | |
1618 | event=ABBREV xid=0x12345678 | |
1619 | OFPT_BARRIER_REPLY: | |
1620 | ]) | |
1621 | ||
1622 | ovs-appctl -t ovs-ofctl exit | |
1623 | OVS_VSWITCHD_STOP | |
1624 | AT_CLEANUP | |
1625 | ||
1626 | AT_SETUP([ofproto - flow monitoring pause and resume]) | |
1627 | AT_KEYWORDS([monitor]) | |
1628 | ||
46a80050 EM |
1629 | # The maximum socket receive buffer size is important for this test, which |
1630 | # tests behavior when the receive buffer overflows. | |
1631 | if test -e /proc/sys/net/core/rmem_max; then | |
1632 | # Linux | |
1633 | rmem_max=`cat /proc/sys/net/core/rmem_max` | |
1634 | elif rmem_max=`sysctl -n net.inet.tcp.recvbuf_max 2>/dev/null`; then | |
1635 | : # FreeBSD | |
1636 | else | |
1637 | # Don't know how to get maximum socket receive buffer on this OS | |
1638 | AT_SKIP_IF([:]) | |
1639 | fi | |
2b07c8b1 BP |
1640 | # Calculate the total amount of queuing: rmem_max in the kernel, 128 kB |
1641 | # in ofproto sending userspace (see ofmonitor_flush() in connmgr.c). | |
2b07c8b1 BP |
1642 | queue_size=`expr $rmem_max + 128 \* 1024` |
1643 | echo rmem_max=$rmem_max queue_size=$queue_size | |
1644 | ||
1645 | # Each flow update message takes up at least 48 bytes of space in queues | |
1646 | # and in practice more than that. | |
1647 | n_msgs=`expr $queue_size / 48` | |
1648 | echo n_msgs=$n_msgs | |
1649 | ||
1650 | OVS_VSWITCHD_START | |
1651 | ||
1652 | # Start a monitor watching the flow table, then make it block. | |
0b7140bb | 1653 | ON_EXIT([kill `cat ovs-ofctl.pid`]) |
2b07c8b1 BP |
1654 | ovs-ofctl monitor br0 watch: --detach --no-chdir --pidfile >monitor.log 2>&1 |
1655 | AT_CAPTURE_FILE([monitor.log]) | |
1656 | ovs-appctl -t ovs-ofctl ofctl/block | |
1657 | ||
1658 | # Add $n_msgs flows. | |
1659 | (echo "in_port=2,actions=output:2" | |
1660 | perl -e ' | |
1661 | for ($i = 0; $i < '$n_msgs'; $i++) { | |
1662 | print "cookie=1,reg1=$i,actions=drop\n"; | |
1663 | } | |
1664 | ') > flows.txt | |
1665 | AT_CHECK([ovs-ofctl add-flows br0 flows.txt]) | |
79b8c36c BP |
1666 | # Check that multipart flow dumps work properly: |
1667 | AT_CHECK([ovs-ofctl diff-flows br0 flows.txt]) | |
2b07c8b1 BP |
1668 | AT_CHECK([ovs-ofctl add-flow br0 in_port=1,cookie=3,actions=drop]) |
1669 | AT_CHECK([ovs-ofctl mod-flows br0 in_port=2,cookie=2,actions=output:2]) | |
1670 | AT_CHECK([ovs-ofctl del-flows br0 cookie=1/-1]) | |
1671 | ||
1672 | ovs-appctl -t ovs-ofctl ofctl/unblock | |
1673 | ovs-appctl -t ovs-ofctl ofctl/barrier | |
1674 | ||
1675 | ovs-appctl -t ovs-ofctl exit | |
1676 | ||
1677 | # Check that the flow monitor reported the same number of flows | |
1678 | # added and deleted, but fewer than we actually added and deleted. | |
1679 | adds=`grep -c 'ADDED.*reg1=' monitor.log` | |
1680 | deletes=`grep -c 'DELETED.*reg1=' monitor.log` | |
1681 | echo adds=$adds deletes=$deletes | |
1682 | AT_CHECK([test $adds -gt 100 && test $adds -lt $n_msgs]) | |
1683 | AT_CHECK([test $adds = $deletes]) | |
1684 | ||
d0ab8a1a BP |
1685 | # Check that the flow monitor reported everything in the expected order: |
1686 | # | |
1687 | # event=ADDED table=0 cookie=0x1 reg1=0x22 | |
1688 | # ... | |
1689 | # NXT_FLOW_MONITOR_PAUSED: | |
1690 | # ... | |
1691 | # event=DELETED reason=delete table=0 cookie=0x1 reg1=0x22 | |
1692 | # ... | |
1693 | # event=ADDED table=0 cookie=0x3 in_port=1 | |
1694 | # event=MODIFIED table=0 cookie=0x2 in_port=2 actions=output:2 | |
1695 | # NXT_FLOW_MONITOR_RESUMED: | |
1696 | # | |
1697 | # except that, between the PAUSED and RESUMED, the order of the ADDED | |
1698 | # and MODIFIED lines lines depends on hash order, that is, it varies | |
1699 | # as we change the hash function or change architecture. Therefore, | |
1700 | # we use a couple of tests below to accept both orders. | |
2b07c8b1 | 1701 | AT_CHECK([ofctl_strip < monitor.log | sed -n -e ' |
46a80050 | 1702 | /reg1=0x22$/p |
2b07c8b1 BP |
1703 | /cookie=0x[[23]]/p |
1704 | /NXT_FLOW_MONITOR_PAUSED:/p | |
1705 | /NXT_FLOW_MONITOR_RESUMED:/p | |
d0ab8a1a BP |
1706 | ' > monitor.log.subset]) |
1707 | AT_CHECK([grep -v MODIFIED monitor.log.subset], [0], [dnl | |
1708 | event=ADDED table=0 cookie=0x1 reg1=0x22 | |
2b07c8b1 BP |
1709 | NXT_FLOW_MONITOR_PAUSED: |
1710 | event=DELETED reason=delete table=0 cookie=0x1 reg1=0x22 | |
1711 | event=ADDED table=0 cookie=0x3 in_port=1 | |
d0ab8a1a BP |
1712 | NXT_FLOW_MONITOR_RESUMED: |
1713 | ]) | |
1714 | AT_CHECK([grep -v ADDED monitor.log.subset], [0], [dnl | |
1715 | NXT_FLOW_MONITOR_PAUSED: | |
1716 | event=DELETED reason=delete table=0 cookie=0x1 reg1=0x22 | |
2b07c8b1 BP |
1717 | event=MODIFIED table=0 cookie=0x2 in_port=2 actions=output:2 |
1718 | NXT_FLOW_MONITOR_RESUMED: | |
1719 | ]) | |
1720 | ||
1721 | OVS_VSWITCHD_STOP | |
1722 | AT_CLEANUP |