CSIT-811 HC Test: BGP functional tests
[csit.git] / tests / vpp / func / honeycomb / mgmt-cfg-bgp-apihc-func.robot
1 # Copyright (c) 2017 Cisco and/or its affiliates.
2 # Licensed under the Apache License, Version 2.0 (the "License");
3 # you may not use this file except in compliance with the License.
4 # You may obtain a copy of the License at:
5 #
6 #     http://www.apache.org/licenses/LICENSE-2.0
7 #
8 # Unless required by applicable law or agreed to in writing, software
9 # distributed under the License is distributed on an "AS IS" BASIS,
10 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11 # See the License for the specific language governing permissions and
12 # limitations under the License.
13
14 *** Variables ***
15 # Interface to run tests on.
16 | ${interface}= | ${node['interfaces']['port1']['name']}
17 | ${dut1_to_tg_ip}= | 192.168.0.1
18 | ${tg_to_dut1_ip}= | 192.168.0.2
19 | ${dut1_to_dut2_ip}= | 192.168.1.1
20 | ${dut2_to_dut1_ip}= | 192.168.1.2
21 | ${bgp_port}= | ${179}
22 | ${bgp_as_number}= | ${37}
23 | ${prefix}= | ${24}
24
25 *** Settings ***
26 | Library | resources.libraries.python.honeycomb.IPv6Management
27 | Resource | resources/libraries/robot/shared/default.robot
28 | Resource | resources/libraries/robot/honeycomb/honeycomb.robot
29 | Resource | resources/libraries/robot/honeycomb/interfaces.robot
30 | Resource | resources/libraries/robot/honeycomb/bgp.robot
31 | Resource | resources/libraries/robot/honeycomb/routing.robot
32 | Resource | resources/libraries/robot/shared/testing_path.robot
33 | Resource | resources/libraries/robot/honeycomb/ipv6_control.robot
34 | Variables | resources/test_data/honeycomb/bgp.py
35 | ...
36 | Suite Setup | Run Keywords
37 | ... | Enable Honeycomb Feature | ${node} | BGP | AND
38 | ... | Configure BGP Module | ${node} | ${dut1_to_tg_ip}
39 | ... | ${bgp_port} | ${bgp_as_number} | AND
40 | ... | Set Up Honeycomb Functional Test Suite | ${node}
41 | ...
42 | Suite Teardown | Run Keywords
43 | ... | Tear Down Honeycomb Functional Test Suite | ${nodes['DUT1']} | AND
44 | ... | Stop Honeycomb service on DUTs | ${nodes['DUT2']} | AND
45 | ... | Unconfigure IPv4 Management Interfaces | AND
46 | ... | Disable Honeycomb Feature | ${node} | BGP | AND
47 | ... | Disable Honeycomb Feature | ${nodes['DUT2']} | BGP
48 | ...
49 | Force Tags | HC_FUNC
50 | ...
51 | Documentation | *Honeycomb BGP management test suite.*
52
53 *** Test Cases ***
54 | TC01: Honeycomb configures BGP peer - Internal
55 | | [Documentation] | Check if Honeycomb can configure an internal BGP peer.
56 | | ...
57 | | When Honeycomb adds BGP peer
58 | | ... | ${node} | ${address_internal} | ${peer_internal}
59 | | Then BGP peer from Honeycomb should be
60 | | ... | ${node} | ${address_internal} | ${peer_internal}
61
62 | TC02: Honeycomb removes peer configuration
63 | | [Documentation] | Check if Honeycomb can remove a configured BGP peer.
64 | | ...
65 | | Given BGP peer from Honeycomb should be
66 | | ... | ${node} | ${address_internal} | ${peer_internal}
67 | | When Honeycomb removes BGP peer | ${node} | ${address_internal}
68 | | Then No BGP peers should be configured | ${node}
69
70 | TC03: Honeycomb updates existing BGP peer - Internal
71 | | [Documentation] | Check if Honeycomb can update an existing BGP peer.
72 | | ...
73 | | [Teardown] | Honeycomb removes BGP peer | ${node} | ${address_internal}
74 | | ...
75 | | Given No BGP peers should be configured | ${node}
76 | | When Honeycomb adds BGP peer
77 | | ... | ${node} | ${address_internal} | ${peer_internal}
78 | | And Honeycomb adds BGP peer
79 | | ... | ${node} | ${address_internal} | ${peer_internal_update}
80 | | Then BGP peer from Honeycomb should be
81 | | ... | ${node} | ${address_internal} | ${peer_internal_update}
82
83 | TC04: Honeycomb configures BGP peer - Application
84 | | [Documentation] | Check if Honeycomb can configure an application BGP peer.
85 | | ...
86 | | [Teardown] | Honeycomb removes BGP peer | ${node} | ${address_application}
87 | | ...
88 | | Given No BGP peers should be configured | ${node}
89 | | When Honeycomb adds BGP peer
90 | | ... | ${node} | ${address_application} | ${peer_application}
91 | | Then BGP peer from Honeycomb should be
92 | | ... | ${node} | ${address_application} | ${peer_application}
93
94 | TC05: Honeycomb configures a second BGP peer
95 | | [Documentation] | Check if Honeycomb can configure more than one BGP peer.
96 | | ...
97 | | [Teardown] | Run Keywords
98 | | ... | Honeycomb removes BGP peer | ${node} | ${address_internal} | AND
99 | | ... | Honeycomb removes BGP peer | ${node} | ${address_internal2}
100 | | ...
101 | | Given No BGP peers should be configured | ${node}
102 | | When Honeycomb adds BGP peer
103 | | ... | ${node} | ${address_internal} | ${peer_internal}
104 | | And Honeycomb adds BGP peer
105 | | ... | ${node} | ${address_internal2} | ${peer_internal2}
106 | | Then BGP peer from Honeycomb should be
107 | | ... | ${node} | ${address_internal} | ${peer_internal}
108 | | And BGP peer from Honeycomb should be
109 | | ... | ${node} | ${address_internal2} | ${peer_internal2}
110
111 | TC06: Honeycomb configures IPv4 route using BGP
112 | | [Documentation] | Check if Honeycomb can configure a BGP route under a peer.
113 | | ...
114 | | Given Honeycomb adds BGP peer
115 | | ... | ${node} | ${address_internal} | ${peer_internal}
116 | | When Honeycomb configures BGP route
117 | | ... | ${node} | ${address_internal} | ${route_data_ipv4}
118 | | ... | ${route_address_ipv4} | ${route_id_ipv4} | ipv4
119 | | Then BGP Route from Honeycomb should be
120 | | ... | ${node} | ${address_internal} | ${route_data_ipv4}
121 | | ... | ${route_address_ipv4} | ${route_id_ipv4} | ipv4
122
123 | TC07: Honeycomb removes IPv4 route configuration
124 | | [Documentation] | Check if Honeycomb can remove a configured BGP route.
125 | | ...
126 | | Given BGP peer from Honeycomb should be
127 | | ... | ${node} | ${address_internal} | ${peer_internal}
128 | | And BGP Route from Honeycomb should be
129 | | ... | ${node} | ${address_internal} | ${route_data_ipv4}
130 | | ... | ${route_address_ipv4} | ${route_id_ipv4} | ipv4
131 | | When Honeycomb removes BGP route | ${node} | ${address_internal}
132 | | ... | ${route_address_ipv4} | ${route_id_ipv4} | ipv4
133 | | Then No BGP Routes Should be Configured
134 | | ... | ${node} | ${address_internal} | ipv4
135
136 | TC08: Honeycomb updates existing IPv4 route using BGP
137 | | [Documentation] | Check if Honeycomb can update an existing BGP route.
138 | | ...
139 | | [Teardown] | Honeycomb removes BGP route | ${node} | ${address_internal}
140 | | ... | ${route_address_ipv4} | ${route_id_ipv4} | ipv4
141 | | ...
142 | | Given BGP peer from Honeycomb should be
143 | | ... | ${node} | ${address_internal} | ${peer_internal}
144 | | And No BGP Routes Should be Configured
145 | | ... | ${node} | ${address_internal} | ipv4
146 | | When Honeycomb configures BGP route
147 | | ... | ${node} | ${address_internal} | ${route_data_ipv4}
148 | | ... | ${route_address_ipv4} | ${route_id_ipv4} | ipv4
149 | | And Honeycomb configures BGP route
150 | | ... | ${node} | ${address_internal} | ${route_data_ipv4_update}
151 | | ... | ${route_address_ipv4} | ${route_id_ipv4} | ipv4
152 | | Then BGP Route from Honeycomb should be
153 | | ... | ${node} | ${address_internal} | ${route_data_ipv4_update}
154 | | ... | ${route_address_ipv4} | ${route_id_ipv4} | ipv4
155
156 | TC09: Honeycomb configures a second IPv4 route
157 | | [Documentation] | Check if Honeycomb can configure more than one BGP route.
158 | | ...
159 | | [Teardown] | Run Keywords
160 | | ... | Honeycomb removes BGP route | ${node} | ${address_internal}
161 | | ... | ${route_address_ipv4} | ${route_id_ipv4} | ipv4 | AND
162 | | ... | Honeycomb removes BGP route | ${node} | ${address_internal}
163 | | ... | ${route_address_ipv4_2} | ${route_id_ipv4_2} | ipv4 | AND
164 | | ... | Honeycomb removes BGP peer | ${node} | ${address_internal}
165 | | ...
166 | | Given BGP peer from Honeycomb should be
167 | | ... | ${node} | ${address_internal} | ${peer_internal}
168 | | When Honeycomb configures BGP route
169 | | ... | ${node} | ${address_internal} | ${route_data_ipv4}
170 | | ... | ${route_address_ipv4} | ${route_id_ipv4} | ipv4
171 | | And Honeycomb configures BGP route
172 | | ... | ${node} | ${address_internal} | ${route_data_ipv4_2}
173 | | ... | ${route_address_ipv4_2} | ${route_id_ipv4_2} | ipv4
174 | | Then BGP Route from Honeycomb should be
175 | | ... | ${node} | ${address_internal} | ${route_data_ipv4}
176 | | ... | ${route_address_ipv4} | ${route_id_ipv4} | ipv4
177 | | And BGP Route from Honeycomb should be
178 | | ... | ${node} | ${address_internal} | ${route_data_ipv4_2}
179 | | ... | ${route_address_ipv4_2} | ${route_id_ipv4_2} | ipv4
180
181 | TC10: Honeycomb sends BGP OPEN messages to configured peer
182 | | [Documentation]
183 | | ... | [top] TG-DUT1-TG.
184 | | ... | [enc] Eth-IPv4-TCP-BGP.
185 | | ... | [cfg] On DUT1 give Honeycomb control over the data-plane interface
186 | | ... | connected to TG. Configure a BGP peer with the address of TG.
187 | | ... | [ver] Open a TCP listener on TG on the BGP port and listen for BGP
188 | | ... | OPEN message. On receive, verify message fields.
189 | | ...
190 | | [Setup] | Run Keywords
191 | | ... | Configure BGP Module | ${node} | ${dut1_to_dut2_ip}
192 | | ... | ${bgp_port} | ${bgp_as_number} | AND
193 | | ... | Configure IPv4 Management Interface
194 | | [Teardown] | Honeycomb removes BGP peer | ${dut1_node} | ${address_internal}
195 | | When Honeycomb adds BGP peer
196 | | ... | ${dut1_node} | ${address_internal} | ${peer_internal}
197 | | Then Receive BGP OPEN message
198 | | ... | ${tg_node} | ${tg_to_dut1_ip} | ${dut1_to_dut2_ip}
199 | | ... | ${bgp_port} | ${bgp_as_number} | ${holdtime_internal}
200
201 | TC11: Honeycomb shows connected peer in operational data
202 | | [Documentation]
203 | | ... | [top] TG-DUT1-DUT2-TG.
204 | | ... | [enc] Eth-IPv4-TCP-BGP.
205 | | ... | [cfg] On DUT1 and DUT2 give Honeycomb control over the data-plane
206 | | ... | interfaces connecting DUT1 ad DUT2. Configure BGP peers on DUT1
207 | | ... | and DUT2 with each other's IP address.
208 | | ... | [ver] Using Restconf, verify that Honeycomb on each DUT has the
209 | | ... | other DUT's entry in operational data.
210 | | ...
211 | | When Honeycomb adds BGP peer
212 | | ... | ${dut1_node} | ${dut2_to_dut1_ip} | ${dut2_peer}
213 | | And Honeycomb adds BGP peer
214 | | ... | ${dut2_node} | ${dut1_to_dut2_ip} | ${dut1_peer}
215 | | Sleep | 5s | Wait for BGP connection. Retry timer is 5 seconds.
216 | | Then Peer operational data from Honeycomb should be
217 | | ... | ${dut1_node} | ${dut2_to_dut1_ip}
218 | | And Peer operational data from Honeycomb should be
219 | | ... | ${dut2_node} | ${dut1_to_dut2_ip}
220
221 | TC12: Honeycomb sends IPv4 BGP route to connected peer
222 | | [Documentation]
223 | | ... | [top] TG-DUT1-DUT2-TG.
224 | | ... | [enc] Eth-IPv4-TCP-BGP.
225 | | ... | [cfg] On DUT1 and DUT2 give Honeycomb control over the data-plane
226 | | ... | interfaces connecting DUT1 ad DUT2. Configure BGP peers on DUT1
227 | | ... | and DUT2 with each other's IP address. On DUT2 configure a static
228 | | ... | IPv4 route using Honeycomb's BGP module.
229 | | ... | [ver] Verify that the route is present in BGP
230 | | ... | local RIB and VPP's routing table on each DUT.
231 | | ...
232 | | Given Peer operational data from Honeycomb should be
233 | | ... | ${dut1_node} | ${dut2_to_dut1_ip}
234 | | And Peer operational data from Honeycomb should be
235 | | ... | ${dut2_node} | ${dut1_to_dut2_ip}
236 | | When Honeycomb adds BGP peer
237 | | ... | ${dut2_node} | ${address_application} | ${peer_application}
238 | | And Honeycomb configures BGP route
239 | | ... | ${dut2_node} | ${address_application} | ${dut1_route}
240 | | ... | ${dut1_route_address} | ${dut1_route_id} | ipv4
241 | | And Sleep | 5s | Wait for route advertisement. Retry timer is 5 seconds.
242 | | Then Routing data from Honeycomb should contain
243 | | ... | ${dut1_node} | learned-protocol-0 | ipv4 | ${route_operational}
244 | | And Routing data from Honeycomb should contain
245 | | ... | ${dut2_node} | learned-protocol-0 | ipv4 | ${route_operational}
246 | | And BGP Loc-RIB table should include | ${dut1_node} | ${rib_operational}
247 | | And BGP Loc-RIB table should include | ${dut2_node} | ${rib_operational}
248
249 | TC13: Honeycomb sends IPv6 BGP route to connected peer
250 | | [Documentation]
251 | | ... | [top] TG-DUT1-DUT2-TG.
252 | | ... | [enc] Eth-IPv4-TCP-BGP.
253 | | ... | [cfg] On DUT1 and DUT2 give Honeycomb control over the data-plane
254 | | ... | interfaces connecting DUT1 ad DUT2. Configure BGP peers on DUT1
255 | | ... | and DUT2 with each other's IP address. On DUT2 configure a static
256 | | ... | IPv6 route using Honeycomb's BGP module.
257 | | ... | [ver] Verify that the route is present in BGP
258 | | ... | local RIB and VPP's routing table on each DUT.
259 | | ...
260 # HONEYCOMB-403: Missing writers for IPv6 BGP route
261 | | [Tags] | EXPECTED_FAILING
262 | | Given Peer operational data from Honeycomb should be
263 | | ... | ${dut1_node} | ${dut2_to_dut1_ip}
264 | | And Peer operational data from Honeycomb should be
265 | | ... | ${dut2_node} | ${dut1_to_dut2_ip}
266 | | And Honeycomb adds BGP peer
267 | | ... | ${dut2_node} | ${address_application} | ${peer_application}
268 | | And Honeycomb configures BGP route
269 | | ... | ${dut2_node} | ${address_application} | ${dut1_route_ip6}
270 | | ... | ${dut1_route_ip6_address} | ${dut1_route_ip6_id} | ipv6
271 | | And Sleep | 5s | Wait for route advertisement. Retry timer is 5 seconds.
272 | | Then Routing data from Honeycomb should contain
273 | | ... | ${dut1_node} | learned-protocol-0 | ipv6 | ${route_ip6_operational}
274 | | And Routing data from Honeycomb should contain
275 | | ... | ${dut2_node} | learned-protocol-0 | ipv6 | ${route_ip6_operational}
276 | | And BGP Loc-RIB table should include | ${dut1_node} | ${rib_ip6_operational}
277 | | And BGP Loc-RIB table should include | ${dut2_node} | ${rib_ip6_operational}
278
279 #TODO: Add tests once implemented in HC:
280 # IPv6 neighbor, L2VPN, L3VPN, linkstate, route reflector, and more
281
282 *** Keywords ***
283 | Configure IPv4 Management Interface
284 | | [Documentation] | Change one of VPP's data-plane interfaces on DUT into\
285 | | ... | a control-plane interface that Honeycomb can listen on. Setup IP\
286 | | ... | addresses on the link, create suite variables for traffic trests, set
287 | | ... | static ARP entries, then restart VPP and Honeycomb to apply changes.
288 | | ...
289 | | Configure path in 3-node circular topology
290 | | ... | ${nodes['TG']} | ${nodes['DUT1']} | ${nodes['DUT2']} | ${nodes['TG']}
291 | | ${interface}= | Get Interface Name | ${dut1_node} | ${dut1_to_tg}
292 | | Set Suite Variable | ${interface}
293 | | Set Suite Variable | ${tg_node}
294 | | Set Suite Variable | ${dut1_node}
295 | | Set Suite Variable | ${dut2_node}
296 | | Set Suite Variable | ${dut1_to_tg}
297 | | Stop VPP service on DUT | ${dut1_node}
298 | | Stop VPP service on DUT | ${dut2_node}
299 | | Stop Honeycomb Service on DUTs | ${dut1_node}
300 | | Stop Honeycomb Service on DUTs | ${dut2_node}
301 | | Convert data-plane interface to control-plane
302 | | ... | ${dut1_node} | ${dut1_to_tg}
303 | | Convert data-plane interface to control-plane
304 | | ... | ${dut1_node} | ${dut1_to_dut2}
305 | | Convert data-plane interface to control-plane
306 | | ... | ${dut2_node} | ${dut2_to_dut1}
307 | | Sleep | 5sec | Wait until OS reclaims the interfaces.
308 | | ${tg_to_dut1_name}= | Get Interface Name by MAC
309 | | ... | ${tg_node} | ${tg_to_dut1_mac}
310 | | ${dut1_to_tg_name}= | Get Interface Name by MAC
311 | | ... | ${dut1_node} | ${dut1_to_tg_mac}
312 | | ${dut1_to_dut2_name}= | Get Interface Name by MAC
313 | | ... | ${dut1_node} | ${dut1_to_dut2_mac}
314 | | ${dut2_to_dut1_name}= | Get Interface Name by MAC
315 | | ... | ${dut2_node} | ${dut2_to_dut1_mac}
316 | | Set Suite Variable | ${dut1_to_tg_name}
317 | | Set Suite Variable | ${tg_to_dut1_name}
318 | | Set Suite Variable | ${dut1_to_dut2_name}
319 | | Set Suite Variable | ${dut2_to_dut1_name}
320 | | Set management interface address
321 | | ... | ${tg_node} | ${tg_to_dut1_name}
322 | | ... | ${tg_to_dut1_ip} | ${prefix}
323 | | Set management interface address
324 | | ... | ${dut1_node} | ${dut1_to_tg_name}
325 | | ... | ${dut1_to_tg_ip} | ${prefix}
326 | | Set management interface address
327 | | ... | ${dut1_node} | ${dut1_to_dut2_name}
328 | | ... | ${dut1_to_dut2_ip} | ${prefix}
329 | | Set management interface address
330 | | ... | ${dut2_node} | ${dut2_to_dut1_name}
331 | | ... | ${dut2_to_dut1_ip} | ${prefix}
332 | | Set Static ARP | ${tg_node} | ${dut1_to_tg_ip} | ${dut1_to_tg_mac}
333 | | Set Static ARP | ${dut1_node} | ${tg_to_dut1_ip} | ${tg_to_dut1_mac}
334 | | Set Static ARP | ${dut1_node} | ${dut2_to_dut1_ip} | ${dut2_to_dut1_mac}
335 | | Set Static ARP | ${dut2_node} | ${dut1_to_dut2_ip} | ${dut1_to_dut2_mac}
336 | | Enable Honeycomb Feature | ${dut2_node} | BGP
337 | | Configure BGP Module | ${dut1_node} | ${dut1_to_dut2_ip}
338 | | ... | ${bgp_port} | ${bgp_as_number}
339 | | Configure BGP Module | ${dut2_node} | ${dut2_to_dut1_ip}
340 | | ... | ${bgp_port} | ${bgp_as_number}
341 | | Start VPP service on DUT | ${dut1_node}
342 | | Start VPP service on DUT | ${dut2_node}
343 | | Configure Honeycomb service on DUTs | ${dut1_node}
344 | | Set Up Honeycomb Functional Test Suite | ${dut2_node}
345
346 | Unconfigure IPv4 Management Interfaces
347 | | [Documentation] | Remove all IP addresses from the interface.
348 | | ...
349 | | Clear Interface Configuration | ${tg_node} | ${tg_to_dut1_name}
350 | | Clear Interface Configuration | ${dut1_node} | ${dut1_to_tg_name}
351 | | Clear Interface Configuration | ${dut1_node} | ${dut1_to_dut2_name}
352 | | Clear Interface Configuration | ${dut2_node} | ${dut2_to_dut1_name}
353
354 | Set BGP Suite Variables
355 | | Configure path in 3-node circular topology
356 | | ... | ${nodes['TG']} | ${nodes['DUT1']} | ${nodes['DUT2']} | ${nodes['TG']}
357 | | Set Suite Variable | ${interface}
358 | | Set Suite Variable | ${tg_node}
359 | | Set Suite Variable | ${dut1_node}
360 | | Set Suite Variable | ${dut2_node}
361 | | Set Suite Variable | ${dut1_to_tg}
362 | | Set Suite Variable | ${dut1_to_tg_name}
363 | | Set Suite Variable | ${tg_to_dut1_name}
364 | | Set Suite Variable | ${dut1_to_dut2_name}
365 | | Set Suite Variable | ${dut2_to_dut1_name}