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