]> git.proxmox.com Git - mirror_frr.git/blame - tests/topotests/mgmt_startup/test_late_bigconf.py
tests: add unified config tests
[mirror_frr.git] / tests / topotests / mgmt_startup / test_late_bigconf.py
CommitLineData
7cd87abc
CH
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"""
10Verify large set of routes present when staticd (backend client) is started after it's
11startup config is present during launch.
12"""
13
14import logging
15import os
16
17import pytest
18from lib.common_config import step
19from lib.topogen import Topogen, TopoRouter
20from munet.base import Timeout
21from util import check_kernel, check_vtysh_up, write_big_route_conf
22
23CWD = os.path.dirname(os.path.realpath(__file__))
24
25# pytestmark = [pytest.mark.staticd, pytest.mark.mgmtd]
26pytestmark = [pytest.mark.staticd]
27
28track = Timeout(0)
29ROUTE_COUNT = 2500
30ROUTE_RANGE = [None, None]
31
32
33@pytest.fixture(scope="module")
34def 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 # Explicit disable staticd now..
55 tgen.gears["r1"].net.daemons["staticd"] = 0
56
57 tgen.start_router()
58 yield tgen
59 tgen.stop_topology()
60
61
62def test_staticd_latestart(tgen):
63 if tgen.routers_have_failure():
64 pytest.skip(tgen.errors)
65
66 r1 = tgen.routers()["r1"]
67
68 check_vtysh_up(r1)
69 logging.info("r1: vtysh connected after %ss", track.elapsed())
70
71 result = check_kernel(r1, ROUTE_RANGE[0], retry_timeout=20, expected=False)
72 assert result is not None, "first route present and should not be"
73 result = check_kernel(r1, ROUTE_RANGE[1], retry_timeout=20, expected=False)
74 assert result is not None, "last route present and should not be"
75
76 step("Starting staticd")
77 r1.startDaemons(["staticd"])
78
79 result = check_kernel(r1, ROUTE_RANGE[0], retry_timeout=60)
80 assert result is None, "first route not present and should be"
81 result = check_kernel(r1, ROUTE_RANGE[1], retry_timeout=20)
82 assert result is None, "last route not present and should be"