]>
Commit | Line | Data |
---|---|---|
a3276d2c | 1 | #!/usr/bin/python |
2 | ||
3 | # | |
4 | # Copyright (c) 2020 by VMware, Inc. ("VMware") | |
5 | # Used Copyright (c) 2018 by Network Device Education Foundation, Inc. | |
6 | # ("NetDEF") in this file. | |
7 | # | |
8 | # Permission to use, copy, modify, and/or distribute this software | |
9 | # for any purpose with or without fee is hereby granted, provided | |
10 | # that the above copyright notice and this permission notice appear | |
11 | # in all copies. | |
12 | # | |
13 | # THE SOFTWARE IS PROVIDED "AS IS" AND VMWARE DISCLAIMS ALL WARRANTIES | |
14 | # WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | |
15 | # MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL VMWARE BE LIABLE FOR | |
16 | # ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY | |
17 | # DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, | |
18 | # WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS | |
19 | # ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE | |
20 | # OF THIS SOFTWARE. | |
21 | # | |
22 | ||
23 | ||
24 | """OSPF Basic Functionality Automation.""" | |
25 | import os | |
26 | import sys | |
27 | import time | |
28 | import pytest | |
a3276d2c | 29 | |
30 | # Save the Current Working Directory to find configuration files. | |
31 | CWD = os.path.dirname(os.path.realpath(__file__)) | |
32 | sys.path.append(os.path.join(CWD, "../")) | |
33 | sys.path.append(os.path.join(CWD, "../lib/")) | |
34 | ||
35 | # pylint: disable=C0413 | |
36 | # Import topogen and topotest helpers | |
a3276d2c | 37 | from lib.topogen import Topogen, get_topogen |
38 | ||
39 | # Import topoJson from lib, to create topology and initial configuration | |
40 | from lib.common_config import ( | |
41 | start_topology, | |
42 | write_test_header, | |
43 | write_test_footer, | |
44 | reset_config_on_routers, | |
45 | step, | |
a3276d2c | 46 | topo_daemons, |
47 | verify_rib, | |
5980ad0a DS |
48 | stop_router, |
49 | start_router, | |
a3276d2c | 50 | create_static_routes, |
51 | start_router_daemons, | |
5980ad0a | 52 | kill_router_daemons, |
a3276d2c | 53 | ) |
54 | ||
5980ad0a | 55 | from lib.ospf import verify_ospf_neighbor, verify_ospf_rib, create_router_ospf |
a3276d2c | 56 | |
57 | from lib.topolog import logger | |
4953ca97 | 58 | from lib.topojson import build_config_from_json |
a3276d2c | 59 | |
efb62eed | 60 | pytestmark = [pytest.mark.ospfd, pytest.mark.staticd] |
a3276d2c | 61 | |
62 | # Global variables | |
63 | topo = None | |
64 | ||
65 | NETWORK = { | |
5980ad0a DS |
66 | "ipv4": [ |
67 | "11.0.20.1/32", | |
68 | "11.0.20.2/32", | |
69 | "11.0.20.3/32", | |
70 | "11.0.20.4/32", | |
71 | "11.0.20.5/32", | |
72 | ] | |
a3276d2c | 73 | } |
74 | """ | |
75 | Topology: | |
76 | Please view in a fixed-width font such as Courier. | |
77 | +---+ A1 +---+ | |
78 | +R1 +------------+R2 | | |
79 | +-+-+- +--++ | |
80 | | -- -- | | |
81 | | -- A0 -- | | |
82 | A0| ---- | | |
83 | | ---- | A2 | |
84 | | -- -- | | |
85 | | -- -- | | |
86 | +-+-+- +-+-+ | |
87 | +R0 +-------------+R3 | | |
88 | +---+ A3 +---+ | |
89 | ||
90 | TESTCASES = | |
91 | 1. Verify ospf functionality after restart ospfd. | |
92 | 2. Verify ospf functionality after restart FRR service. | |
93 | 3. Verify ospf functionality when staticd is restarted. | |
94 | """ | |
95 | ||
a3276d2c | 96 | |
97 | def setup_module(mod): | |
98 | """ | |
99 | Sets up the pytest environment | |
100 | ||
101 | * `mod`: module name | |
102 | """ | |
a3276d2c | 103 | testsuite_run_time = time.asctime(time.localtime(time.time())) |
104 | logger.info("Testsuite start time: {}".format(testsuite_run_time)) | |
105 | logger.info("=" * 40) | |
106 | ||
107 | logger.info("Running setup_module to create topology") | |
108 | ||
109 | # This function initiates the topology build with Topogen... | |
e82b531d CH |
110 | json_file = "{}/ospf_chaos.json".format(CWD) |
111 | tgen = Topogen(json_file, mod.__name__) | |
112 | global topo | |
113 | topo = tgen.json_topo | |
a3276d2c | 114 | # ... and here it calls Mininet initialization functions. |
115 | ||
116 | # get list of daemons needs to be started for this suite. | |
117 | daemons = topo_daemons(tgen, topo) | |
118 | ||
119 | # Starting topology, create tmp files which are loaded to routers | |
120 | # to start deamons and then start routers | |
121 | start_topology(tgen, daemons) | |
122 | ||
123 | # Creating configuration from JSON | |
124 | build_config_from_json(tgen, topo) | |
125 | ||
126 | # Don't run this test if we have any failure. | |
127 | if tgen.routers_have_failure(): | |
128 | pytest.skip(tgen.errors) | |
129 | ||
130 | ospf_covergence = verify_ospf_neighbor(tgen, topo) | |
131 | assert ospf_covergence is True, "setup_module :Failed \n Error:" " {}".format( | |
132 | ospf_covergence | |
133 | ) | |
134 | ||
135 | logger.info("Running setup_module() done") | |
136 | ||
137 | ||
138 | def teardown_module(mod): | |
139 | """ | |
140 | Teardown the pytest environment. | |
141 | ||
142 | * `mod`: module name | |
143 | """ | |
144 | ||
145 | logger.info("Running teardown_module to delete topology") | |
146 | ||
147 | tgen = get_topogen() | |
148 | ||
149 | # Stop toplogy and Remove tmp files | |
150 | tgen.stop_topology() | |
151 | ||
152 | logger.info( | |
153 | "Testsuite end time: {}".format(time.asctime(time.localtime(time.time()))) | |
154 | ) | |
155 | logger.info("=" * 40) | |
156 | ||
157 | ||
158 | # ################################## | |
159 | # Test cases start here. | |
160 | # ################################## | |
161 | def test_ospf_chaos_tc31_p1(request): | |
162 | """Verify ospf functionality after restart ospfd.""" | |
163 | tc_name = request.node.name | |
164 | write_test_header(tc_name) | |
165 | tgen = get_topogen() | |
166 | global topo | |
167 | step("Bring up the base config as per the topology") | |
168 | reset_config_on_routers(tgen) | |
169 | ||
170 | step( | |
171 | "Create static routes(10.0.20.1/32) in R1 and redistribute " | |
5980ad0a DS |
172 | "to OSPF using route map." |
173 | ) | |
a3276d2c | 174 | |
175 | # Create Static routes | |
176 | input_dict = { | |
177 | "r0": { | |
178 | "static_routes": [ | |
179 | { | |
5980ad0a | 180 | "network": NETWORK["ipv4"][0], |
a3276d2c | 181 | "no_of_ip": 5, |
5980ad0a | 182 | "next_hop": "Null0", |
a3276d2c | 183 | } |
184 | ] | |
185 | } | |
186 | } | |
187 | result = create_static_routes(tgen, input_dict) | |
5980ad0a | 188 | assert result is True, "Testcase {} : Failed \n Error: {}".format(tc_name, result) |
a3276d2c | 189 | |
5980ad0a | 190 | ospf_red_r0 = {"r0": {"ospf": {"redistribute": [{"redist_type": "static"}]}}} |
a3276d2c | 191 | result = create_router_ospf(tgen, topo, ospf_red_r0) |
5980ad0a | 192 | assert result is True, "Testcase {} : Failed \n Error: {}".format(tc_name, result) |
a3276d2c | 193 | |
194 | step("Verify OSPF neighbors after base config is done.") | |
195 | # Api call verify whether OSPF is converged | |
196 | ospf_covergence = verify_ospf_neighbor(tgen, topo) | |
5980ad0a DS |
197 | assert ospf_covergence is True, "setup_module :Failed \n Error:" " {}".format( |
198 | ospf_covergence | |
199 | ) | |
a3276d2c | 200 | |
201 | step("Verify that route is advertised to R1.") | |
5980ad0a DS |
202 | dut = "r1" |
203 | protocol = "ospf" | |
204 | nh = topo["routers"]["r0"]["links"]["r1"]["ipv4"].split("/")[0] | |
a3276d2c | 205 | result = verify_ospf_rib(tgen, dut, input_dict, next_hop=nh) |
5980ad0a | 206 | assert result is True, "Testcase {} : Failed \n Error: {}".format(tc_name, result) |
a3276d2c | 207 | |
5980ad0a DS |
208 | result = verify_rib(tgen, "ipv4", dut, input_dict, protocol=protocol, next_hop=nh) |
209 | assert result is True, "Testcase {} : Failed \n Error: {}".format(tc_name, result) | |
a3276d2c | 210 | |
211 | step("Kill OSPFd daemon on R0.") | |
212 | kill_router_daemons(tgen, "r0", ["ospfd"]) | |
213 | ||
214 | step("Verify OSPF neighbors are down after killing ospfd in R0") | |
5980ad0a | 215 | dut = "r0" |
a3276d2c | 216 | # Api call verify whether OSPF is converged |
5980ad0a DS |
217 | ospf_covergence = verify_ospf_neighbor(tgen, topo, dut=dut, expected=False) |
218 | assert ospf_covergence is not True, "setup_module :Failed \n Error:" " {}".format( | |
219 | ospf_covergence | |
220 | ) | |
a3276d2c | 221 | |
222 | step("Verify that route advertised to R1 are deleted from RIB and FIB.") | |
5980ad0a DS |
223 | dut = "r1" |
224 | protocol = "ospf" | |
a3276d2c | 225 | result = verify_ospf_rib(tgen, dut, input_dict, expected=False) |
0b25370e DS |
226 | assert ( |
227 | result is not True | |
228 | ), "Testcase {} : Failed \n " "r1: OSPF routes are present \n Error: {}".format( | |
5980ad0a | 229 | tc_name, result |
0b25370e | 230 | ) |
a3276d2c | 231 | |
0b25370e DS |
232 | result = verify_rib( |
233 | tgen, "ipv4", dut, input_dict, protocol=protocol, expected=False | |
234 | ) | |
235 | assert ( | |
236 | result is not True | |
237 | ), "Testcase {} : Failed \n " "r1: routes are still present \n Error: {}".format( | |
5980ad0a | 238 | tc_name, result |
0b25370e | 239 | ) |
a3276d2c | 240 | |
241 | step("Bring up OSPFd daemon on R0.") | |
242 | start_router_daemons(tgen, "r0", ["ospfd"]) | |
243 | ||
244 | step("Verify OSPF neighbors are up after bringing back ospfd in R0") | |
245 | # Api call verify whether OSPF is converged | |
246 | ospf_covergence = verify_ospf_neighbor(tgen, topo) | |
5980ad0a DS |
247 | assert ospf_covergence is True, "setup_module :Failed \n Error:" " {}".format( |
248 | ospf_covergence | |
249 | ) | |
a3276d2c | 250 | |
251 | step( | |
252 | "All the neighbours are up and routes are installed before the" | |
5980ad0a DS |
253 | " restart. Verify OSPF route table and ip route table." |
254 | ) | |
255 | dut = "r1" | |
256 | protocol = "ospf" | |
a3276d2c | 257 | result = verify_ospf_rib(tgen, dut, input_dict, next_hop=nh) |
5980ad0a | 258 | assert result is True, "Testcase {} : Failed \n Error: {}".format(tc_name, result) |
a3276d2c | 259 | |
5980ad0a DS |
260 | result = verify_rib(tgen, "ipv4", dut, input_dict, protocol=protocol, next_hop=nh) |
261 | assert result is True, "Testcase {} : Failed \n Error: {}".format(tc_name, result) | |
a3276d2c | 262 | |
263 | step("Kill OSPFd daemon on R1.") | |
264 | kill_router_daemons(tgen, "r1", ["ospfd"]) | |
265 | ||
266 | step("Verify OSPF neighbors are down after killing ospfd in R1") | |
5980ad0a | 267 | dut = "r1" |
a3276d2c | 268 | # Api call verify whether OSPF is converged |
5980ad0a DS |
269 | ospf_covergence = verify_ospf_neighbor(tgen, topo, dut=dut, expected=False) |
270 | assert ospf_covergence is not True, "setup_module :Failed \n Error:" " {}".format( | |
271 | ospf_covergence | |
272 | ) | |
a3276d2c | 273 | |
274 | step("Bring up OSPFd daemon on R1.") | |
275 | start_router_daemons(tgen, "r1", ["ospfd"]) | |
276 | ||
277 | step("Verify OSPF neighbors are up after bringing back ospfd in R1") | |
278 | # Api call verify whether OSPF is converged | |
279 | ospf_covergence = verify_ospf_neighbor(tgen, topo) | |
5980ad0a DS |
280 | assert ospf_covergence is True, "setup_module :Failed \n Error:" " {}".format( |
281 | ospf_covergence | |
282 | ) | |
a3276d2c | 283 | |
284 | step( | |
285 | "All the neighbours are up and routes are installed before the" | |
5980ad0a DS |
286 | " restart. Verify OSPF route table and ip route table." |
287 | ) | |
a3276d2c | 288 | |
5980ad0a DS |
289 | dut = "r1" |
290 | protocol = "ospf" | |
a3276d2c | 291 | result = verify_ospf_rib(tgen, dut, input_dict, next_hop=nh) |
5980ad0a | 292 | assert result is True, "Testcase {} : Failed \n Error: {}".format(tc_name, result) |
a3276d2c | 293 | |
5980ad0a DS |
294 | result = verify_rib(tgen, "ipv4", dut, input_dict, protocol=protocol, next_hop=nh) |
295 | assert result is True, "Testcase {} : Failed \n Error: {}".format(tc_name, result) | |
a3276d2c | 296 | |
297 | write_test_footer(tc_name) | |
298 | ||
299 | ||
300 | def test_ospf_chaos_tc32_p1(request): | |
a53c08bc | 301 | """Verify ospf functionality after restart FRR service.""" |
a3276d2c | 302 | tc_name = request.node.name |
303 | write_test_header(tc_name) | |
304 | tgen = get_topogen() | |
305 | global topo | |
306 | step("Bring up the base config as per the topology") | |
307 | reset_config_on_routers(tgen) | |
308 | ||
309 | step( | |
310 | "Create static routes(10.0.20.1/32) in R1 and redistribute " | |
5980ad0a DS |
311 | "to OSPF using route map." |
312 | ) | |
a3276d2c | 313 | |
314 | # Create Static routes | |
315 | input_dict = { | |
316 | "r0": { | |
317 | "static_routes": [ | |
318 | { | |
5980ad0a | 319 | "network": NETWORK["ipv4"][0], |
a3276d2c | 320 | "no_of_ip": 5, |
5980ad0a | 321 | "next_hop": "Null0", |
a3276d2c | 322 | } |
323 | ] | |
324 | } | |
325 | } | |
326 | result = create_static_routes(tgen, input_dict) | |
5980ad0a | 327 | assert result is True, "Testcase {} : Failed \n Error: {}".format(tc_name, result) |
a3276d2c | 328 | |
5980ad0a | 329 | ospf_red_r0 = {"r0": {"ospf": {"redistribute": [{"redist_type": "static"}]}}} |
a3276d2c | 330 | result = create_router_ospf(tgen, topo, ospf_red_r0) |
5980ad0a | 331 | assert result is True, "Testcase {} : Failed \n Error: {}".format(tc_name, result) |
a3276d2c | 332 | |
333 | step("Verify OSPF neighbors after base config is done.") | |
334 | # Api call verify whether OSPF is converged | |
335 | ospf_covergence = verify_ospf_neighbor(tgen, topo) | |
5980ad0a DS |
336 | assert ospf_covergence is True, "setup_module :Failed \n Error:" " {}".format( |
337 | ospf_covergence | |
338 | ) | |
a3276d2c | 339 | |
340 | step("Verify that route is advertised to R1.") | |
5980ad0a DS |
341 | dut = "r1" |
342 | protocol = "ospf" | |
a3276d2c | 343 | |
5980ad0a | 344 | nh = topo["routers"]["r0"]["links"]["r1"]["ipv4"].split("/")[0] |
a3276d2c | 345 | result = verify_ospf_rib(tgen, dut, input_dict, next_hop=nh) |
5980ad0a | 346 | assert result is True, "Testcase {} : Failed \n Error: {}".format(tc_name, result) |
a3276d2c | 347 | |
5980ad0a DS |
348 | result = verify_rib(tgen, "ipv4", dut, input_dict, protocol=protocol, next_hop=nh) |
349 | assert result is True, "Testcase {} : Failed \n Error: {}".format(tc_name, result) | |
a3276d2c | 350 | |
351 | step("Restart frr on R0") | |
5980ad0a DS |
352 | stop_router(tgen, "r0") |
353 | start_router(tgen, "r0") | |
a3276d2c | 354 | |
355 | step("Verify OSPF neighbors are up after restarting R0") | |
356 | # Api call verify whether OSPF is converged | |
357 | ospf_covergence = verify_ospf_neighbor(tgen, topo) | |
5980ad0a DS |
358 | assert ospf_covergence is True, "setup_module :Failed \n Error:" " {}".format( |
359 | ospf_covergence | |
360 | ) | |
a3276d2c | 361 | |
362 | step( | |
363 | "All the neighbours are up and routes are installed before the" | |
5980ad0a DS |
364 | " restart. Verify OSPF route table and ip route table." |
365 | ) | |
366 | dut = "r1" | |
367 | protocol = "ospf" | |
a3276d2c | 368 | result = verify_ospf_rib(tgen, dut, input_dict, next_hop=nh) |
5980ad0a | 369 | assert result is True, "Testcase {} : Failed \n Error: {}".format(tc_name, result) |
a3276d2c | 370 | |
5980ad0a DS |
371 | result = verify_rib(tgen, "ipv4", dut, input_dict, protocol=protocol, next_hop=nh) |
372 | assert result is True, "Testcase {} : Failed \n Error: {}".format(tc_name, result) | |
a3276d2c | 373 | |
374 | step("Restart frr on R1") | |
5980ad0a DS |
375 | stop_router(tgen, "r1") |
376 | start_router(tgen, "r1") | |
a3276d2c | 377 | |
378 | step("Verify OSPF neighbors are up after restarting R1") | |
379 | # Api call verify whether OSPF is converged | |
380 | ospf_covergence = verify_ospf_neighbor(tgen, topo) | |
5980ad0a DS |
381 | assert ospf_covergence is True, "setup_module :Failed \n Error:" " {}".format( |
382 | ospf_covergence | |
383 | ) | |
a3276d2c | 384 | |
385 | step( | |
386 | "All the neighbours are up and routes are installed before the" | |
5980ad0a DS |
387 | " restart. Verify OSPF route table and ip route table." |
388 | ) | |
389 | dut = "r1" | |
390 | protocol = "ospf" | |
a3276d2c | 391 | result = verify_ospf_rib(tgen, dut, input_dict, next_hop=nh) |
5980ad0a | 392 | assert result is True, "Testcase {} : Failed \n Error: {}".format(tc_name, result) |
a3276d2c | 393 | |
5980ad0a DS |
394 | result = verify_rib(tgen, "ipv4", dut, input_dict, protocol=protocol, next_hop=nh) |
395 | assert result is True, "Testcase {} : Failed \n Error: {}".format(tc_name, result) | |
a3276d2c | 396 | |
397 | write_test_footer(tc_name) | |
398 | ||
399 | ||
400 | def test_ospf_chaos_tc34_p1(request): | |
401 | """ | |
402 | verify ospf functionality when staticd is restarted. | |
403 | ||
404 | Verify ospf functionalitywhen staticroutes are | |
405 | redistributed & Staticd is restarted. | |
406 | """ | |
407 | tc_name = request.node.name | |
408 | write_test_header(tc_name) | |
409 | tgen = get_topogen() | |
410 | global topo | |
411 | step("Bring up the base config as per the topology") | |
412 | reset_config_on_routers(tgen) | |
413 | ||
414 | step( | |
415 | "Create static routes(10.0.20.1/32) in R1 and redistribute " | |
5980ad0a DS |
416 | "to OSPF using route map." |
417 | ) | |
a3276d2c | 418 | |
419 | # Create Static routes | |
420 | input_dict = { | |
421 | "r0": { | |
422 | "static_routes": [ | |
423 | { | |
5980ad0a | 424 | "network": NETWORK["ipv4"][0], |
a3276d2c | 425 | "no_of_ip": 5, |
5980ad0a | 426 | "next_hop": "Null0", |
a3276d2c | 427 | } |
428 | ] | |
429 | } | |
430 | } | |
431 | result = create_static_routes(tgen, input_dict) | |
5980ad0a | 432 | assert result is True, "Testcase {} : Failed \n Error: {}".format(tc_name, result) |
a3276d2c | 433 | |
5980ad0a | 434 | ospf_red_r0 = {"r0": {"ospf": {"redistribute": [{"redist_type": "static"}]}}} |
a3276d2c | 435 | result = create_router_ospf(tgen, topo, ospf_red_r0) |
5980ad0a | 436 | assert result is True, "Testcase {} : Failed \n Error: {}".format(tc_name, result) |
a3276d2c | 437 | |
438 | step("Verify OSPF neighbors after base config is done.") | |
439 | # Api call verify whether OSPF is converged | |
440 | ospf_covergence = verify_ospf_neighbor(tgen, topo) | |
5980ad0a DS |
441 | assert ospf_covergence is True, "setup_module :Failed \n Error:" " {}".format( |
442 | ospf_covergence | |
443 | ) | |
a3276d2c | 444 | |
445 | step("Verify that route is advertised to R1.") | |
5980ad0a DS |
446 | dut = "r1" |
447 | protocol = "ospf" | |
448 | nh = topo["routers"]["r0"]["links"]["r1"]["ipv4"].split("/")[0] | |
a3276d2c | 449 | result = verify_ospf_rib(tgen, dut, input_dict, next_hop=nh) |
5980ad0a | 450 | assert result is True, "Testcase {} : Failed \n Error: {}".format(tc_name, result) |
a3276d2c | 451 | |
5980ad0a DS |
452 | result = verify_rib(tgen, "ipv4", dut, input_dict, protocol=protocol, next_hop=nh) |
453 | assert result is True, "Testcase {} : Failed \n Error: {}".format(tc_name, result) | |
a3276d2c | 454 | |
455 | step("Kill staticd daemon on R0.") | |
456 | kill_router_daemons(tgen, "r0", ["staticd"]) | |
457 | ||
458 | step("Verify that route advertised to R1 are deleted from RIB and FIB.") | |
5980ad0a DS |
459 | dut = "r1" |
460 | protocol = "ospf" | |
a3276d2c | 461 | result = verify_ospf_rib(tgen, dut, input_dict, expected=False) |
0b25370e DS |
462 | assert ( |
463 | result is not True | |
464 | ), "Testcase {} : Failed \n " "r1: OSPF routes are present \n Error: {}".format( | |
5980ad0a | 465 | tc_name, result |
0b25370e | 466 | ) |
a3276d2c | 467 | |
0b25370e DS |
468 | result = verify_rib( |
469 | tgen, "ipv4", dut, input_dict, protocol=protocol, expected=False | |
470 | ) | |
471 | assert ( | |
472 | result is not True | |
473 | ), "Testcase {} : Failed \n " "r1: routes are still present \n Error: {}".format( | |
5980ad0a | 474 | tc_name, result |
0b25370e | 475 | ) |
a3276d2c | 476 | |
477 | step("Bring up staticd daemon on R0.") | |
478 | start_router_daemons(tgen, "r0", ["staticd"]) | |
479 | ||
480 | step("Verify OSPF neighbors are up after bringing back ospfd in R0") | |
481 | # Api call verify whether OSPF is converged | |
482 | ospf_covergence = verify_ospf_neighbor(tgen, topo) | |
5980ad0a DS |
483 | assert ospf_covergence is True, "setup_module :Failed \n Error:" " {}".format( |
484 | ospf_covergence | |
485 | ) | |
a3276d2c | 486 | |
487 | step( | |
488 | "All the neighbours are up and routes are installed before the" | |
5980ad0a DS |
489 | " restart. Verify OSPF route table and ip route table." |
490 | ) | |
491 | dut = "r1" | |
492 | protocol = "ospf" | |
a3276d2c | 493 | result = verify_ospf_rib(tgen, dut, input_dict, next_hop=nh) |
5980ad0a | 494 | assert result is True, "Testcase {} : Failed \n Error: {}".format(tc_name, result) |
a3276d2c | 495 | |
5980ad0a DS |
496 | result = verify_rib(tgen, "ipv4", dut, input_dict, protocol=protocol, next_hop=nh) |
497 | assert result is True, "Testcase {} : Failed \n Error: {}".format(tc_name, result) | |
a3276d2c | 498 | |
499 | step("Kill staticd daemon on R1.") | |
500 | kill_router_daemons(tgen, "r1", ["staticd"]) | |
501 | ||
502 | step("Bring up staticd daemon on R1.") | |
503 | start_router_daemons(tgen, "r1", ["staticd"]) | |
504 | ||
505 | step("Verify OSPF neighbors are up after bringing back ospfd in R1") | |
506 | # Api call verify whether OSPF is converged | |
507 | ospf_covergence = verify_ospf_neighbor(tgen, topo) | |
5980ad0a DS |
508 | assert ospf_covergence is True, "setup_module :Failed \n Error:" " {}".format( |
509 | ospf_covergence | |
510 | ) | |
a3276d2c | 511 | |
512 | step( | |
513 | "All the neighbours are up and routes are installed before the" | |
5980ad0a DS |
514 | " restart. Verify OSPF route table and ip route table." |
515 | ) | |
a3276d2c | 516 | |
5980ad0a DS |
517 | dut = "r1" |
518 | protocol = "ospf" | |
a3276d2c | 519 | result = verify_ospf_rib(tgen, dut, input_dict, next_hop=nh) |
5980ad0a | 520 | assert result is True, "Testcase {} : Failed \n Error: {}".format(tc_name, result) |
a3276d2c | 521 | |
5980ad0a DS |
522 | result = verify_rib(tgen, "ipv4", dut, input_dict, protocol=protocol, next_hop=nh) |
523 | assert result is True, "Testcase {} : Failed \n Error: {}".format(tc_name, result) | |
a3276d2c | 524 | |
525 | write_test_footer(tc_name) | |
526 | ||
527 | ||
528 | if __name__ == "__main__": | |
529 | args = ["-s"] + sys.argv[1:] | |
530 | sys.exit(pytest.main(args)) |