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