]> git.proxmox.com Git - mirror_frr.git/blame - tests/topotests/example_test/test_template_json.py
Merge pull request #12798 from donaldsharp/rib_match_multicast
[mirror_frr.git] / tests / topotests / example_test / test_template_json.py
CommitLineData
36c19497 1#!/usr/bin/env python3
acddc0ed 2# SPDX-License-Identifier: ISC
36c19497
CH
3#
4# September 5 2021, Christian Hopps <chopps@labn.net>
5#
6# Copyright (c) 2021, LabN Consulting, L.L.C.
7# Copyright (c) 2017 by
8# Network Device Education Foundation, Inc. ("NetDEF")
9#
36c19497
CH
10
11"""
12<template>.py: Test <template>.
13"""
14
15import pytest
16
17# Import topogen and topotest helpers
18from lib import bgp
19from lib import fixtures
20
21
22# TODO: select markers based on daemons used during test
23pytestmark = [
24 pytest.mark.bgpd,
25 # pytest.mark.ospfd,
26 # pytest.mark.ospf6d
27 # ...
28]
29
30# Use tgen_json fixture (invoked by use test arg of same name) to
31# setup/teardown standard JSON topotest
32tgen = pytest.fixture(fixtures.tgen_json, scope="module")
33
34
35# tgen is defined above
36# topo is a fixture defined in ../conftest.py
37def test_bgp_convergence(tgen, topo):
38 "Test for BGP convergence."
39
40 # Don't run this test if we have any failure.
41 if tgen.routers_have_failure():
42 pytest.skip(tgen.errors)
43
44 bgp_convergence = bgp.verify_bgp_convergence(tgen, topo)
45 assert bgp_convergence
46
47
48# Memory leak test template
49def test_memory_leak(tgen):
50 "Run the memory leak test and report results."
51
52 if not tgen.is_memleak_enabled():
53 pytest.skip("Memory leak test/report is disabled")
54
55 tgen.report_memory_leaks()