]> git.proxmox.com Git - mirror_frr.git/blame - tests/topotests/mgmt_startup/test_bigconf.py
tests: add unified config tests
[mirror_frr.git] / tests / topotests / mgmt_startup / test_bigconf.py
CommitLineData
e3c4bd24
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"""
9Test static route startup functionality
10"""
11
12import datetime
e3c4bd24 13import logging
e3c4bd24 14import os
e3c4bd24
CH
15
16import pytest
7cd87abc 17from lib.common_config import step
e3c4bd24 18from lib.topogen import Topogen, TopoRouter
e3c4bd24 19from munet.base import Timeout
7cd87abc 20from util import check_kernel, check_vtysh_up, write_big_route_conf
e3c4bd24
CH
21
22CWD = os.path.dirname(os.path.realpath(__file__))
23
24# pytestmark = [pytest.mark.staticd, pytest.mark.mgmtd]
25pytestmark = [pytest.mark.staticd]
26
27
e3c4bd24 28track = Timeout(0)
7cd87abc 29ROUTE_COUNT = 2500
e3c4bd24
CH
30ROUTE_RANGE = [None, None]
31
32
e3c4bd24
CH
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
7cd87abc
CH
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)
e3c4bd24
CH
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")
7cd87abc 52 tgen.gears["r1"].load_config(TopoRouter.RD_MGMTD, confpath)
e3c4bd24
CH
53
54 track.started_on = datetime.datetime.now()
55
56 tgen.start_router()
57 yield tgen
58 tgen.stop_topology()
59
60
7cd87abc 61def test_staticd_latestart(tgen):
e3c4bd24
CH
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
7cd87abc 69 check_vtysh_up(r1)
e3c4bd24
CH
70 logging.info("r1: vtysh connected after %ss", track.elapsed())
71
72 result = check_kernel(r1, ROUTE_RANGE[0], retry_timeout=20)
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=20)
77 assert result is None
78 logging.info("r1: last route installed after %ss", track.elapsed())