]> git.proxmox.com Git - mirror_frr.git/blob - tests/topotests/mgmt_startup/test_bigconf.py
Merge pull request #13649 from donaldsharp/unlock_the_node_or_else
[mirror_frr.git] / tests / topotests / mgmt_startup / test_bigconf.py
1 # -*- coding: utf-8 eval: (blacken-mode 1) -*-
2 # SPDX-License-Identifier: ISC
3 #
4 # May 2 2023, Christian Hopps <chopps@labn.net>
5 #
6 # Copyright (c) 2023, LabN Consulting, L.L.C.
7 #
8 """
9 Test static route startup functionality
10 """
11
12 import datetime
13 import logging
14 import os
15
16 import pytest
17 from lib.common_config import step
18 from lib.topogen import Topogen, TopoRouter
19 from munet.base import Timeout
20 from util import check_kernel, check_vtysh_up, write_big_route_conf
21
22 CWD = os.path.dirname(os.path.realpath(__file__))
23
24 # pytestmark = [pytest.mark.staticd, pytest.mark.mgmtd]
25 pytestmark = [pytest.mark.staticd]
26
27
28 track = Timeout(0)
29 ROUTE_COUNT = 2500
30 ROUTE_RANGE = [None, None]
31
32
33 @pytest.fixture(scope="module")
34 def tgen(request):
35 "Setup/Teardown the environment and provide tgen argument to tests"
36
37 global start_time
38 topodef = {
39 "s1": ("r1",),
40 }
41
42 tgen = Topogen(topodef, request.module.__name__)
43 tgen.start_topology()
44
45 confpath = f"{tgen.gears['r1'].gearlogdir}/r1-late-big.conf"
46 start, end = write_big_route_conf("10.0.0.0/8", ROUTE_COUNT, confpath)
47 ROUTE_RANGE[0] = start
48 ROUTE_RANGE[1] = end
49
50 # configure mgmtd using current mgmtd config file
51 tgen.gears["r1"].load_config(TopoRouter.RD_ZEBRA, "zebra.conf")
52 tgen.gears["r1"].load_config(TopoRouter.RD_MGMTD, confpath)
53
54 track.started_on = datetime.datetime.now()
55
56 tgen.start_router()
57 yield tgen
58 tgen.stop_topology()
59
60
61 def test_staticd_latestart(tgen):
62 if tgen.routers_have_failure():
63 pytest.skip(tgen.errors)
64
65 r1 = tgen.routers()["r1"]
66
67 step(f"Verifying {ROUTE_COUNT} startup routes are present")
68
69 check_vtysh_up(r1)
70 logging.info("r1: vtysh connected after %ss", track.elapsed())
71
72 result = check_kernel(r1, ROUTE_RANGE[0], retry_timeout=60)
73 assert result is None
74 logging.info("r1: first route installed after %ss", track.elapsed())
75
76 result = check_kernel(r1, ROUTE_RANGE[1], retry_timeout=60)
77 assert result is None
78 logging.info("r1: last route installed after %ss", track.elapsed())