]>
git.proxmox.com Git - mirror_frr.git/blob - tests/topotests/example_test/test_template_json.py
2 # SPDX-License-Identifier: ISC
4 # September 5 2021, Christian Hopps <chopps@labn.net>
6 # Copyright (c) 2021, LabN Consulting, L.L.C.
7 # Copyright (c) 2017 by
8 # Network Device Education Foundation, Inc. ("NetDEF")
12 <template>.py: Test <template>.
17 # Import topogen and topotest helpers
19 from lib
import fixtures
22 # TODO: select markers based on daemons used during test
30 # Use tgen_json fixture (invoked by use test arg of same name) to
31 # setup/teardown standard JSON topotest
32 tgen
= pytest
.fixture(fixtures
.tgen_json
, scope
="module")
35 # tgen is defined above
36 # topo is a fixture defined in ../conftest.py
37 def test_bgp_convergence(tgen
, topo
):
38 "Test for BGP convergence."
40 # Don't run this test if we have any failure.
41 if tgen
.routers_have_failure():
42 pytest
.skip(tgen
.errors
)
44 bgp_convergence
= bgp
.verify_bgp_convergence(tgen
, topo
)
45 assert bgp_convergence
48 # Memory leak test template
49 def test_memory_leak(tgen
):
50 "Run the memory leak test and report results."
52 if not tgen
.is_memleak_enabled():
53 pytest
.skip("Memory leak test/report is disabled")
55 tgen
.report_memory_leaks()