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
+!
# 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")
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)
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()