From c64d8d857780e59fd4fad6c6ffd1c712d097bca8 Mon Sep 17 00:00:00 2001 From: Donald Sharp Date: Thu, 20 Feb 2020 15:38:33 -0500 Subject: [PATCH] tests: Add a test for the `ip pim register-accept-list PLIST` command Add a test to the pim-basic to ensure that the prefix-list works as expected. Signed-off-by: Donald Sharp --- tests/topotests/pim-basic/r1/pimd.conf | 4 ++++ tests/topotests/pim-basic/r1/zebra.conf | 3 +++ tests/topotests/pim-basic/r3/pimd.conf | 1 + tests/topotests/pim-basic/r3/zebra.conf | 8 ++++++++ tests/topotests/pim-basic/rp/pimd.conf | 3 +++ tests/topotests/pim-basic/test_pim.py | 13 ++++++++++++- 6 files changed, 31 insertions(+), 1 deletion(-) create mode 100644 tests/topotests/pim-basic/r3/pimd.conf create mode 100644 tests/topotests/pim-basic/r3/zebra.conf diff --git a/tests/topotests/pim-basic/r1/pimd.conf b/tests/topotests/pim-basic/r1/pimd.conf index cec765699d..f64a46deb3 100644 --- a/tests/topotests/pim-basic/r1/pimd.conf +++ b/tests/topotests/pim-basic/r1/pimd.conf @@ -7,6 +7,10 @@ interface r1-eth0 interface r1-eth1 ip pim ! +interface r1-eth2 + ip igmp + ip pim +! interface lo ip pim ! diff --git a/tests/topotests/pim-basic/r1/zebra.conf b/tests/topotests/pim-basic/r1/zebra.conf index b0a25f12aa..e43041758b 100644 --- a/tests/topotests/pim-basic/r1/zebra.conf +++ b/tests/topotests/pim-basic/r1/zebra.conf @@ -6,6 +6,9 @@ interface r1-eth0 interface r1-eth1 ip address 10.0.30.1/24 ! +interface r1-eth2 + ip address 10.0.40.1/24 +! interface lo ip address 10.254.0.1/32 ! diff --git a/tests/topotests/pim-basic/r3/pimd.conf b/tests/topotests/pim-basic/r3/pimd.conf new file mode 100644 index 0000000000..f94ee99930 --- /dev/null +++ b/tests/topotests/pim-basic/r3/pimd.conf @@ -0,0 +1 @@ +hostname r3 diff --git a/tests/topotests/pim-basic/r3/zebra.conf b/tests/topotests/pim-basic/r3/zebra.conf new file mode 100644 index 0000000000..8e58e8c66a --- /dev/null +++ b/tests/topotests/pim-basic/r3/zebra.conf @@ -0,0 +1,8 @@ +hostname r3 +! +interface r3-eth0 + ip address 10.0.40.4/24 +! +interface lo + ip address 10.254.0.4/32 +! diff --git a/tests/topotests/pim-basic/rp/pimd.conf b/tests/topotests/pim-basic/rp/pimd.conf index 3f1b4d65c9..6e35c97971 100644 --- a/tests/topotests/pim-basic/rp/pimd.conf +++ b/tests/topotests/pim-basic/rp/pimd.conf @@ -7,3 +7,6 @@ interface lo ip pim ! ip pim rp 10.254.0.3 +ip pim register-accept-list ACCEPT + +ip prefix-list ACCEPT seq 5 permit 10.0.20.0/24 le 32 diff --git a/tests/topotests/pim-basic/test_pim.py b/tests/topotests/pim-basic/test_pim.py index 0e0569e234..9101d7e035 100644 --- a/tests/topotests/pim-basic/test_pim.py +++ b/tests/topotests/pim-basic/test_pim.py @@ -46,14 +46,18 @@ class PIMTopo(Topo): "Build function" tgen = get_topogen(self) - for routern in range(1, 3): + for routern in range(1, 4): tgen.add_router('r{}'.format(routern)) tgen.add_router('rp') + # rp ------ r1 -------- r2 + # \ + # --------- r3 # r1 -> .1 # r2 -> .2 # rp -> .3 + # r3 -> .4 # loopback network is 10.254.0.X/32 # # r1 <- sw1 -> r2 @@ -70,6 +74,10 @@ class PIMTopo(Topo): sw.add_link(tgen.gears['r1']) sw.add_link(tgen.gears['rp']) + # 10.0.40.0/24 + sw = tgen.add_switch('sw3') + sw.add_link(tgen.gears['r1']) + sw.add_link(tgen.gears['r3']) def setup_module(mod): "Sets up the pytest environment" @@ -130,12 +138,15 @@ def test_pim_send_mcast_stream(): pytest.skip(tgen.errors) rp = tgen.gears['rp'] + r3 = tgen.gears['r3'] r2 = tgen.gears['r2'] r1 = tgen.gears['r1'] # Let's establish a S,G stream from r2 -> r1 CWD = os.path.dirname(os.path.realpath(__file__)) r2.run("{}/mcast-tx.py --ttl 5 --count 5 --interval 10 229.1.1.1 r2-eth0 > /tmp/bar".format(CWD)) + # And from r3 -> r1 + r3.run("{}/mcast-tx.py --ttl 5 --count 5 --interval 10 229.1.1.1 r3-eth0 > /tmp/bar".format(CWD)) # Let's see that it shows up and we have established some basic state out = r1.vtysh_cmd("show ip pim upstream json", isjson=True)