Skip to content

Commit

Permalink
topotests: test MSDP SA filtering
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
rzalamena committed Oct 3, 2023
1 parent bc3fcc2 commit c445b27
Show file tree
Hide file tree
Showing 2 changed files with 93 additions and 0 deletions.
10 changes: 10 additions & 0 deletions tests/topotests/msdp_topo1/r4/pimd.conf
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,16 @@ interface r4-eth2
!
ip msdp timers 10 20 3
ip msdp peer 192.168.2.1 source 192.168.2.2
ip msdp peer 192.168.2.1 sa-filter forbidden-multicast in
ip msdp peer 192.168.2.1 sa-filter local-only-multicast out
ip msdp peer 192.168.3.1 source 192.168.3.2
ip msdp peer 192.168.3.1 sa-filter forbidden-multicast in
ip msdp peer 192.168.3.1 sa-filter local-only-multicast out
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
83 changes: 83 additions & 0 deletions tests/topotests/msdp_topo1/test_msdp_topo1.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down Expand Up @@ -428,6 +430,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()
Expand Down

0 comments on commit c445b27

Please sign in to comment.