topotests: test MSDP SA filtering

Modify existing MSDP topology to use test SA filtering:
- Add new multicast host (so we get two sources for same group)
- Test group only filtering
- Test source / group filtering

Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
This commit is contained in:
Rafael Zalamena 2022-12-09 14:34:13 -03:00
parent ae31d9b17b
commit 7b650fb836
2 changed files with 96 additions and 1 deletions

View File

@ -20,3 +20,16 @@ ip msdp peer 192.168.2.1 source 192.168.2.2
ip msdp peer 192.168.3.1 source 192.168.3.2
ip pim rp 10.254.254.4
ip pim join-prune-interval 5
!
access-list forbidden-multicast seq 5 deny 229.2.1.0 0.0.0.255
access-list forbidden-multicast seq 1000 permit any
access-list local-only-multicast seq 5 deny 229.3.1.0 0.0.0.255
access-list local-only-multicast seq 6 deny ip 192.168.4.100 0.0.0.0 229.10.1.0 0.0.0.255
access-list local-only-multicast seq 1000 permit any
!
router pim
msdp peer 192.168.2.1 sa-filter forbidden-multicast in
msdp peer 192.168.2.1 sa-filter local-only-multicast out
msdp peer 192.168.3.1 sa-filter forbidden-multicast in
msdp peer 192.168.3.1 sa-filter local-only-multicast out
!

View File

@ -66,7 +66,9 @@ def build_topo(tgen):
# Create a host connected and direct at r4:
tgen.add_host("h1", "192.168.4.100/24", "via 192.168.4.1")
tgen.add_host("h3", "192.168.4.120/24", "via 192.168.4.1")
switch.add_link(tgen.gears["h1"])
switch.add_link(tgen.gears["h3"])
# Create a host connected and direct at r1:
switch = tgen.add_switch("s6")
@ -82,7 +84,6 @@ def setup_module(mod):
router_list = tgen.routers()
for rname, router in router_list.items():
daemon_file = "{}/{}/zebra.conf".format(CWD, rname)
if os.path.isfile(daemon_file):
router.load_config(TopoRouter.RD_ZEBRA, daemon_file)
@ -428,6 +429,87 @@ def test_msdp():
assert val is None, "multicast route convergence failure"
def test_msdp_sa_filter():
"Start a number of multicast streams and check if filtering works"
tgen = get_topogen()
# Flow from r1 -> r4
for multicast_address in ["229.2.1.1", "229.2.1.2", "229.2.2.1"]:
app_helper.run("h1", [multicast_address, "h1-eth0"])
app_helper.run("h2", ["--send=0.7", multicast_address, "h2-eth0"])
# Flow from r4 -> r1
for multicast_address in ["229.3.1.1", "229.3.1.2", "229.3.2.1"]:
app_helper.run("h1", ["--send=0.7", multicast_address, "h1-eth0"])
app_helper.run("h2", [multicast_address, "h2-eth0"])
# Flow from r4 -> r1 but with more sources
for multicast_address in ["229.10.1.1", "229.11.1.1"]:
app_helper.run("h1", ["--send=0.7", multicast_address, "h1-eth0"])
app_helper.run("h2", [multicast_address, "h2-eth0"])
app_helper.run("h3", ["--send=0.7", multicast_address, "h3-eth0"])
# Test that we don't learn any filtered multicast streams.
r4_sa_expected = {
"229.2.1.1": None,
"229.2.1.2": None,
"229.2.2.1": {
"192.168.10.100": {
"local": "no",
"sptSetup": "yes",
}
},
}
test_func = partial(
topotest.router_json_cmp,
tgen.gears["r4"],
"show ip msdp sa json",
r4_sa_expected,
)
logger.info("Waiting for r4 MDSP SA data")
_, val = topotest.run_and_expect(test_func, None, count=30, wait=1)
assert val is None, "multicast route convergence failure"
# Test that we don't send any filtered multicast streams.
r1_sa_expected = {
"229.3.1.1": None,
"229.3.1.2": None,
"229.3.2.1": {
"192.168.4.100": {
"local": "no",
"sptSetup": "yes",
}
},
"229.10.1.1": {
"192.168.4.100": None,
"192.168.4.120": {
"local": "no",
"sptSetup": "yes",
},
},
"229.11.1.1": {
"192.168.4.100": {
"local": "no",
"sptSetup": "yes",
},
"192.168.4.120": {
"local": "no",
"sptSetup": "yes",
},
},
}
test_func = partial(
topotest.router_json_cmp,
tgen.gears["r1"],
"show ip msdp sa json",
r1_sa_expected,
)
logger.info("Waiting for r1 MDSP SA data")
_, val = topotest.run_and_expect(test_func, None, count=30, wait=1)
assert val is None, "multicast route convergence failure"
def test_memory_leak():
"Run the memory leak test and report results."
tgen = get_topogen()