mirror of
https://github.com/FRRouting/frr.git
synced 2025-04-30 13:37:17 +02:00
topotests: test SSM matching
Simple topology test with a single router just to call the group matching functionality. Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
This commit is contained in:
parent
58a071f351
commit
990d045844
14
tests/topotests/multicast_ssm_topo1/r1/frr.conf
Normal file
14
tests/topotests/multicast_ssm_topo1/r1/frr.conf
Normal file
|
@ -0,0 +1,14 @@
|
|||
log commands
|
||||
!
|
||||
ip prefix-list pim-ssm permit 230.0.0.0/8
|
||||
!
|
||||
ipv6 prefix-list pim6-ssm permit ff35::/32
|
||||
!
|
||||
router pim
|
||||
ssm prefix-list pim-ssm
|
||||
exit
|
||||
!
|
||||
router pim6
|
||||
ssm prefix-list pim6-ssm
|
||||
exit
|
||||
!
|
|
@ -0,0 +1,94 @@
|
|||
#!/usr/bin/env python
|
||||
# SPDX-License-Identifier: ISC
|
||||
|
||||
#
|
||||
# test_multicast_ssm_topo1.py
|
||||
# Part of NetDEF Topology Tests
|
||||
#
|
||||
# Copyright (c) 2025 by
|
||||
# Network Device Education Foundation, Inc. ("NetDEF")
|
||||
#
|
||||
|
||||
"""
|
||||
test_multicast_ssm_topo1.py: Test PIM SSM configuration.
|
||||
"""
|
||||
|
||||
import os
|
||||
import sys
|
||||
import json
|
||||
from functools import partial
|
||||
import re
|
||||
import pytest
|
||||
|
||||
# Save the Current Working Directory to find configuration files.
|
||||
CWD = os.path.dirname(os.path.realpath(__file__))
|
||||
sys.path.append(os.path.join(CWD, "../"))
|
||||
|
||||
# pylint: disable=C0413
|
||||
# Import topogen and topotest helpers
|
||||
from lib import topotest
|
||||
|
||||
# Required to instantiate the topology builder class.
|
||||
from lib.topogen import Topogen, TopoRouter, get_topogen
|
||||
from lib.topolog import logger
|
||||
|
||||
pytestmark = [pytest.mark.pimd]
|
||||
|
||||
|
||||
def build_topo(tgen):
|
||||
tgen.add_router(f"r1")
|
||||
|
||||
|
||||
def setup_module(mod):
|
||||
"Sets up the pytest environment"
|
||||
tgen = Topogen(build_topo, mod.__name__)
|
||||
tgen.start_topology()
|
||||
|
||||
tgen.gears["r1"].load_frr_config(os.path.join(CWD, f"r1/frr.conf"))
|
||||
tgen.start_router()
|
||||
|
||||
|
||||
def teardown_module():
|
||||
"Teardown the pytest environment"
|
||||
tgen = get_topogen()
|
||||
tgen.stop_topology()
|
||||
|
||||
|
||||
def test_multicast_ssm():
|
||||
"Test SSM group"
|
||||
pim_test = [
|
||||
{"address": "229.0.0.100", "type": "ASM"},
|
||||
{"address": "230.0.0.100", "type": "SSM"}
|
||||
]
|
||||
pim6_test = [
|
||||
{"address": "FF32::100", "type": "ASM"},
|
||||
{"address": "FF35::100", "type": "SSM"}
|
||||
]
|
||||
|
||||
tgen = get_topogen()
|
||||
if tgen.routers_have_failure():
|
||||
pytest.skip(tgen.errors)
|
||||
|
||||
router = tgen.gears["r1"]
|
||||
|
||||
for test in pim_test:
|
||||
output = router.vtysh_cmd(f"show ip pim group-type {test['address']} json", isjson=True)
|
||||
assert test["type"] == output["groupType"], "Wrong group type"
|
||||
|
||||
for test in pim6_test:
|
||||
output = router.vtysh_cmd(f"show ipv6 pim group-type {test['address']} json", isjson=True)
|
||||
assert test["type"] == output["groupType"], "Wrong group type"
|
||||
|
||||
|
||||
def test_memory_leak():
|
||||
"Run the memory leak test and report results."
|
||||
tgen = get_topogen()
|
||||
if not tgen.is_memleak_enabled():
|
||||
pytest.skip("Memory leak test/report is disabled")
|
||||
|
||||
tgen.report_memory_leaks()
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
args = ["-s"] + sys.argv[1:]
|
||||
sys.exit(pytest.main(args))
|
Loading…
Reference in a new issue