]>
git.proxmox.com Git - mirror_frr.git/blob - tests/topotests/example_test/test_template_json.py
3 # September 5 2021, Christian Hopps <chopps@labn.net>
5 # Copyright (c) 2021, LabN Consulting, L.L.C.
6 # Copyright (c) 2017 by
7 # Network Device Education Foundation, Inc. ("NetDEF")
9 # Permission to use, copy, modify, and/or distribute this software
10 # for any purpose with or without fee is hereby granted, provided
11 # that the above copyright notice and this permission notice appear
14 # THE SOFTWARE IS PROVIDED "AS IS" AND NETDEF DISCLAIMS ALL WARRANTIES
15 # WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
16 # MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL NETDEF BE LIABLE FOR
17 # ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY
18 # DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
19 # WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
20 # ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
25 <template>.py: Test <template>.
30 # Import topogen and topotest helpers
32 from lib
import fixtures
35 # TODO: select markers based on daemons used during test
43 # Use tgen_json fixture (invoked by use test arg of same name) to
44 # setup/teardown standard JSON topotest
45 tgen
= pytest
.fixture(fixtures
.tgen_json
, scope
="module")
48 # tgen is defined above
49 # topo is a fixture defined in ../conftest.py
50 def test_bgp_convergence(tgen
, topo
):
51 "Test for BGP convergence."
53 # Don't run this test if we have any failure.
54 if tgen
.routers_have_failure():
55 pytest
.skip(tgen
.errors
)
57 bgp_convergence
= bgp
.verify_bgp_convergence(tgen
, topo
)
58 assert bgp_convergence
61 # Memory leak test template
62 def test_memory_leak(tgen
):
63 "Run the memory leak test and report results."
65 if not tgen
.is_memleak_enabled():
66 pytest
.skip("Memory leak test/report is disabled")
68 tgen
.report_memory_leaks()