]> git.puffer.fish Git - mirror/frr.git/commitdiff
tests: expand bsr topotest to cover ipv6 17256/head
authorJafar Al-Gharaibeh <jafar@atcorp.com>
Wed, 23 Oct 2024 05:09:06 +0000 (00:09 -0500)
committerMergify <37929162+mergify[bot]@users.noreply.github.com>
Sun, 27 Oct 2024 19:12:49 +0000 (19:12 +0000)
Signed-off-by: Jafar Al-Gharaibeh <jafar@atcorp.com>
(cherry picked from commit a7e7cc301d4784c738ef40e0a2231e3078419aae)

tests/topotests/pim_cand_rp_bsr/r1/frr.conf
tests/topotests/pim_cand_rp_bsr/r2/frr.conf
tests/topotests/pim_cand_rp_bsr/r3/frr.conf
tests/topotests/pim_cand_rp_bsr/r4/frr.conf
tests/topotests/pim_cand_rp_bsr/r5/frr.conf
tests/topotests/pim_cand_rp_bsr/r6/frr.conf
tests/topotests/pim_cand_rp_bsr/test_pim_cand_rp_bsr.py

index d0aa3d529fb266a5acb03db5a932791c755e749d..899e9c06841310f879b25f78f28c71c3871b7c1e 100644 (file)
@@ -5,21 +5,45 @@ log file /tmp/r1-frr.log
 !
 !debug pim packet
 !debug pim bsm
+!debug pimv6 bsm
 !
-ip route 0.0.0.0/0 10.0.0.4
+!
+interface lo
+ ip address 10.0.0.1/32
+ ipv6 address fd00:0:0:0::1/128
+ ip pim
+ ipv6 pim
+ ipv6 ospf6 area 0
 !
 interface r1-eth0
  ip address 10.0.0.1/24
+ ipv6 address fd00:0:0:0::1/64
  ip igmp
  ip pim
+ ipv6 pim
+ ipv6 ospf6 area 0
 !
 interface r1-eth1
  ip address 10.0.1.1/24
+ ipv6 address fd00:0:0:1::1/64
  ip igmp
  ip pim
+ ipv6 pim
+ ipv6 ospf6 area 0
 !
 router pim
   bsr candidate-bsr priority 200 source address 10.0.0.1
 !
+router pim6
+  bsr candidate-bsr priority 200 source address fd00:0:0:0::1
+!
+router ospf
+ ospf router-id 10.0.0.1
+ network 10.0.0.0/16 area 0
+!
+router ospf6
+  ospf6 router-id 10.0.0.1
+!
 ip forwarding
+ipv6 forwarding
 !
index 741c839f192356d8448aa035c562c4bb414c1482..85af461d5eb9568162b6ee7a8a8dc6242e4b5a85 100644 (file)
@@ -3,20 +3,46 @@ hostname r2
 password zebra
 log file /tmp/r2-frr.log
 !
-ip route 0.0.0.0/0 10.0.0.4
+!debug pim packet
+!debug pim bsm
+!debug pimv6 bsm
+!
+interface lo
+ ip address 10.0.0.2/32
+ ipv6 address fd00:0:0:0::2/128
+ ip pim
+ ipv6 pim
+ ipv6 ospf6 area 0
 !
 interface r2-eth0
  ip address 10.0.0.2/24
+ ipv6 address fd00:0:0:0::2/64
  ip igmp
  ip pim
+ ipv6 pim
+ ipv6 ospf6 area 0
 !
 interface r2-eth1
  ip address 10.0.2.2/24
+ ipv6 address fd00:0:0:2::2/64
  ip igmp
  ip pim
+ ipv6 pim
+ ipv6 ospf6 area 0
 !
 router pim
-  bsr candidate-bsr priority 100 source address 10.0.0.2
+  bsr candidate-bsr priority 100
+!
+router pim6
+  bsr candidate-bsr priority 100
+!
+router ospf
+ ospf router-id 10.0.0.2
+ network 10.0.0.0/16 area 0
+!
+router ospf6
+  ospf6 router-id 10.0.0.2
 !
 ip forwarding
+ipv6 forwarding
 !
index bd5c8ce93ff9f003ecccfc488e3c9defb07eabc0..022c44ea58b70a878ec9711c4c407d776c09e996 100644 (file)
@@ -5,28 +5,48 @@ log file /tmp/r3-frr.log
 !
 !debug pim packet
 !debug pim bsm
+!debug pimv6 bsm
 !
-ip route 0.0.0.0/0 10.0.3.4
-ip route 10.0.6.0/24 10.0.3.6
 !
 interface r3-eth0
  ip address 10.0.1.3/24
+ ipv6 address fd00:0:0:1::3/64
  ip igmp
  ip pim
+ ipv6 pim
+ ipv6 ospf6 area 0
 !
 interface r3-eth1
  ip address 10.0.3.3/24
+ ipv6 address fd00:0:0:3::3/64
  ip igmp
  ip pim
+ ipv6 pim
+ ipv6 ospf6 area 0
 !
 interface r3-eth2
  ip address 10.0.4.3/24
+ ipv6 address fd00:0:0:4::3/64
  ip igmp
  ip pim
+ ipv6 pim
+ ipv6 ospf6 area 0
 !
 router pim
   bsr candidate-rp group 239.0.0.0/16
   bsr candidate-rp priority 10 source address 10.0.3.3
 !
+router pim6
+ bsr candidate-rp group ffbb::/64
+ bsr candidate-rp priority 10 source address fd00:0:0:3::3
+!
+router ospf
+ ospf router-id 10.0.1.3
+ network 10.0.0.0/16 area 0
+!
+router ospf6
+  ospf6 router-id 10.0.1.3
+!
 ip forwarding
+ipv6 forwarding
 !
index 825b227728d1629b58c946b29962a2d2d118a364..2d0a035f9a9d636d92e115d4d5f579c899430c52 100644 (file)
@@ -3,35 +3,64 @@ hostname r4
 password zebra
 log file /tmp/r4-frr.log
 !
-ip route 10.0.1.0/24 10.0.0.1
-ip route 10.0.4.0/24 10.0.3.3
-ip route 10.0.6.0/24 10.0.3.6
+!
+interface lo
+ ip address 10.0.3.4/32
+ ipv6 address fd00:0:0:3::4/64
+ ip pim
+ ipv6 pim
 !
 interface r4-eth0
  ip address 10.0.2.4/24
+ ipv6 address fd00:0:0:2::4/64
  ip igmp
  ip pim
+ ipv6 pim
+ ipv6 ospf6 area 0
 !
 interface r4-eth1
  ip address 10.0.3.4/24
+ ipv6 address fd00:0:0:3::4/64
  ip igmp
  ip pim
+ ipv6 pim
+ ipv6 ospf6 area 0
 !
 interface r4-eth2
  ip address 10.0.5.4/24
+ ipv6 address fd00:0:0:5::4/64
  ip igmp
  ip pim
+ ipv6 pim
+ ipv6 ospf6 area 0
 !
 interface r4-eth3
  ip address 10.0.0.4/24
+ ipv6 address fd00:0:0:0::4/64
  ip igmp
  ip pim
+ ipv6 pim
+ ipv6 ospf6 area 0
 !
 router pim
   bsr candidate-rp group 239.0.0.0/24
   bsr candidate-rp group 239.0.0.0/16
   bsr candidate-rp group 239.0.0.0/8
-  bsr candidate-rp priority 20 source address 10.0.3.4
+  bsr candidate-rp priority 20
+!
+router pim6
+ bsr candidate-rp group ffbb::/124
+ bsr candidate-rp group ffbb::/64
+ bsr candidate-rp group ffbb::/108
+ bsr candidate-rp priority 20
+!
+router ospf
+ ospf router-id 10.0.2.4
+ network 10.0.0.0/16 area 0
+!
+router ospf6
+  ospf6 router-id 10.0.2.4
 !
 ip forwarding
+ipv6 forwarding
 !
index c934717d0820f0f90cc5194194623c6625d9b1fc..552e51f417f6754006e635b4054c27949edd9155 100644 (file)
@@ -3,15 +3,32 @@ hostname r5
 password zebra
 log file /tmp/r5-frr.log
 !
-ip route 0.0.0.0/0 10.0.4.3
 !
 interface r5-eth0
  ip address 10.0.4.5/24
+ ipv6 address fd00:0:0:4::5/64
  ip igmp
  ip pim
+ ipv6 pim
+ ipv6 ospf6 area 0
 !
 interface r5-eth1
  ip address 10.0.6.5/24
+ ipv6 address fd00:0:0:6::5/64
+ ip igmp
+ ip pim
+ ipv6 pim
+ ipv6 ospf6 area 0
+!
+router pim6
+!
+router ospf
+ ospf router-id 10.0.4.5
+ network 10.0.0.0/16 area 0
+!
+router ospf6
+  ospf6 router-id 10.0.4.5
 !
 ip forwarding
+ipv6 forwarding
 !
index fd9d1eb5c4223748a57dcd75b1c760291168fdd7..20955a12c70907a83bb1dee31e8131fe05b350ea 100644 (file)
@@ -3,20 +3,40 @@ hostname r6
 password zebra
 log file /tmp/r6-frr.log
 !
-ip route 0.0.0.0/0 10.0.6.6
 !
 interface r6-eth0
  ip address 10.0.5.6/24
+ ipv6 address fd00:0:0:5::6/64
  ip igmp
  ip pim
+ ipv6 pim
+ ipv6 ospf6 area 0
 !
 interface r6-eth1
  ip address 10.0.6.6/24
+ ipv6 address fd00:0:0:6::6/64
+ ip igmp
+ ip pim
+ ipv6 pim
+ ipv6 ospf6 area 0
 !
 interface r6-eth2
  ip address 10.0.3.6/24
+ ipv6 address fd00:0:0:3::6/64
  ip igmp
  ip pim
+ ipv6 pim
+ ipv6 ospf6 area 0
+!
+router pim6
+!
+router ospf
+ ospf router-id 10.0.5.6
+ network 10.0.0.0/16 area 0
+!
+router ospf6
+  ospf6 router-id 10.0.5.6
 !
 ip forwarding
+ipv6 forwarding
 !
index ce7bc9dc56a1e2477c2950b96415100795e3aa88..96a3241a2b83c59aa15fd7532fed260bf0f9bc18 100644 (file)
@@ -59,7 +59,12 @@ CWD = os.path.dirname(os.path.realpath(__file__))
 sys.path.append(os.path.join(CWD, "../"))
 
 # Required to instantiate the topology builder class.
-pytestmark = [pytest.mark.pimd]
+pytestmark = [
+    pytest.mark.pimd,
+    pytest.mark.pim6d,
+    pytest.mark.ospfd,
+    pytest.mark.ospf6d,
+]
 
 
 def build_topo(tgen):
@@ -102,6 +107,7 @@ def build_topo(tgen):
     sw1.add_link(tgen.gears["r4"])
     sw3.add_link(tgen.gears["r6"])
 
+
 def setup_module(mod):
     logger.info("PIM Candidate RP/BSR:\n {}".format(TOPOLOGY))
 
@@ -125,6 +131,7 @@ def teardown_module(mod):
     tgen = get_topogen()
     tgen.stop_topology()
 
+
 def test_pim_bsr_election_r1(request):
     "Test PIM BSR Election"
     tgen = get_topogen()
@@ -137,19 +144,18 @@ def test_pim_bsr_election_r1(request):
     r2 = tgen.gears["r2"]
     # r1 should be the BSR winner because it has higher priority
     expected = {
-        "bsr":"10.0.0.1",
-        "priority":200,
-        "state":"ACCEPT_PREFERRED",
+        "bsr": "10.0.0.1",
+        "priority": 200,
+        "state": "ACCEPT_PREFERRED",
     }
 
-    test_func = partial(
-        topotest.router_json_cmp, r2, "show ip pim bsr json", expected
-    )
+    test_func = partial(topotest.router_json_cmp, r2, "show ip pim bsr json", expected)
     _, result = topotest.run_and_expect(test_func, None, count=60, wait=1)
 
     assertmsg = "r2: r1 was not elected, bsr election mismatch"
     assert result is None, assertmsg
 
+
 def test_pim_bsr_cand_bsr_r1(request):
     "Test PIM BSR candidate BSR"
     tgen = get_topogen()
@@ -162,11 +168,7 @@ def test_pim_bsr_cand_bsr_r1(request):
     r2 = tgen.gears["r2"]
 
     # r2 is a candidate bsr with low priority: elected = False
-    expected = {
-        "address": "10.0.0.2",
-        "priority": 100,
-        "elected": False
-    }
+    expected = {"address": "10.0.0.2", "priority": 100, "elected": False}
     test_func = partial(
         topotest.router_json_cmp, r2, "show ip pim bsr candidate-bsr json", expected
     )
@@ -175,6 +177,7 @@ def test_pim_bsr_cand_bsr_r1(request):
     assertmsg = "r2: candidate bsr mismatch "
     assert result is None, assertmsg
 
+
 def test_pim_bsr_cand_rp(request):
     "Test PIM BSR candidate RP"
     tgen = get_topogen()
@@ -187,10 +190,7 @@ def test_pim_bsr_cand_rp(request):
     r3 = tgen.gears["r3"]
 
     # r3 is a candidate rp
-    expected = {
-        "address":"10.0.3.3",
-        "priority":10
-    }
+    expected = {"address": "10.0.3.3", "priority": 10}
     test_func = partial(
         topotest.router_json_cmp, r3, "show ip pim bsr candidate-rp json", expected
     )
@@ -211,29 +211,95 @@ def test_pim_bsr_rp_info(request):
 
     # At this point, all nodes, including r5 should have synced the RP state
     step("Verify rp-info on r5 from BSR")
-    result = verify_pim_rp_info(tgen, None, "r5", "239.0.0.0/16", None, "10.0.3.3",
-                                "BSR", False, "ipv4", True, retry_timeout = 90)
+    result = verify_pim_rp_info(
+        tgen,
+        None,
+        "r5",
+        "239.0.0.0/16",
+        None,
+        "10.0.3.3",
+        "BSR",
+        False,
+        "ipv4",
+        True,
+        retry_timeout=90,
+    )
     assert result is True, "Testcase {} :Failed \n Error: {}".format(tc_name, result)
 
-    result = verify_pim_rp_info(tgen, None, "r5", "239.0.0.0/8", None, "10.0.3.4",
-                                "BSR", False, "ipv4", True,  retry_timeout = 30)
+    result = verify_pim_rp_info(
+        tgen,
+        None,
+        "r5",
+        "239.0.0.0/8",
+        None,
+        "10.0.3.4",
+        "BSR",
+        False,
+        "ipv4",
+        True,
+        retry_timeout=30,
+    )
     assert result is True, "Testcase {} :Failed \n Error: {}".format(tc_name, result)
 
-    result = verify_pim_rp_info(tgen, None, "r5", "239.0.0.0/24", None, "10.0.3.4",
-                                "BSR", False, "ipv4", True,  retry_timeout = 30)
+    result = verify_pim_rp_info(
+        tgen,
+        None,
+        "r5",
+        "239.0.0.0/24",
+        None,
+        "10.0.3.4",
+        "BSR",
+        False,
+        "ipv4",
+        True,
+        retry_timeout=30,
+    )
     assert result is True, "Testcase {} :Failed \n Error: {}".format(tc_name, result)
 
     step("Verify rp-info on the BSR node itself r1")
-    result = verify_pim_rp_info(tgen, None, "r1", "239.0.0.0/16", None, "10.0.3.3",
-                                "BSR", False, "ipv4", True, retry_timeout = 10)
+    result = verify_pim_rp_info(
+        tgen,
+        None,
+        "r1",
+        "239.0.0.0/16",
+        None,
+        "10.0.3.3",
+        "BSR",
+        False,
+        "ipv4",
+        True,
+        retry_timeout=10,
+    )
     assert result is True, "Testcase {} :Failed \n Error: {}".format(tc_name, result)
 
-    result = verify_pim_rp_info(tgen, None, "r1", "239.0.0.0/8", None, "10.0.3.4",
-                                "BSR", False, "ipv4", True,  retry_timeout = 10)
+    result = verify_pim_rp_info(
+        tgen,
+        None,
+        "r1",
+        "239.0.0.0/8",
+        None,
+        "10.0.3.4",
+        "BSR",
+        False,
+        "ipv4",
+        True,
+        retry_timeout=10,
+    )
     assert result is True, "Testcase {} :Failed \n Error: {}".format(tc_name, result)
 
-    result = verify_pim_rp_info(tgen, None, "r1", "239.0.0.0/24", None, "10.0.3.4",
-                                "BSR", False, "ipv4", True,  retry_timeout = 10)
+    result = verify_pim_rp_info(
+        tgen,
+        None,
+        "r1",
+        "239.0.0.0/24",
+        None,
+        "10.0.3.4",
+        "BSR",
+        False,
+        "ipv4",
+        True,
+        retry_timeout=10,
+    )
     assert result is True, "Testcase {} :Failed \n Error: {}".format(tc_name, result)
 
 
@@ -253,7 +319,8 @@ def test_pim_bsr_election_fallback_r2(request):
         configure
           router pim
             no bsr candidate-bsr priority 200 source address 10.0.0.1
-        """)
+        """
+    )
 
     step("Verify r1 is no longer a BSR candidate")
     expected = {}
@@ -269,16 +336,14 @@ def test_pim_bsr_election_fallback_r2(request):
     r2 = tgen.gears["r2"]
     # We should fall back to r2 as the BSR
     expected = {
-        "bsr":"10.0.0.2",
-        "priority":100,
-        "state":"BSR_ELECTED",
+        "bsr": "10.0.0.2",
+        "priority": 100,
+        "state": "BSR_ELECTED",
     }
 
     step("Verify that we fallback to r2 as the new BSR")
 
-    test_func = partial(
-        topotest.router_json_cmp, r2, "show ip pim bsr json", expected
-    )
+    test_func = partial(topotest.router_json_cmp, r2, "show ip pim bsr json", expected)
     _, result = topotest.run_and_expect(test_func, None, count=180, wait=1)
 
     assertmsg = "r2: failed to fallback to r2 as a BSR"
@@ -301,12 +366,129 @@ def test_pim_bsr_rp_info_fallback(request):
         configure
           router pim
             no bsr candidate-rp group 239.0.0.0/16
-        """)
+        """
+    )
 
     step("Verify falling back to r4 as the new RP for 239.0.0.0/16")
 
-    result = verify_pim_rp_info(tgen, None, "r5", "239.0.0.0/16", None, "10.0.3.4",
-                                "BSR", False, "ipv4", True, retry_timeout = 30)
+    result = verify_pim_rp_info(
+        tgen,
+        None,
+        "r5",
+        "239.0.0.0/16",
+        None,
+        "10.0.3.4",
+        "BSR",
+        False,
+        "ipv4",
+        True,
+        retry_timeout=30,
+    )
+    assert result is True, "Testcase {} :Failed \n Error: {}".format(tc_name, result)
+
+
+def test_pimv6_bsr_election_r1(request):
+    "Test PIMv6 BSR Election"
+    tgen = get_topogen()
+    tc_name = request.node.name
+    write_test_header(tc_name)
+
+    if tgen.routers_have_failure():
+        pytest.skip("skipped because of router(s) failure")
+
+    r2 = tgen.gears["r2"]
+    # r1 should be the BSR winner because it has higher priority
+    expected = {
+        "bsr": "fd00::1",
+        "priority": 200,
+        "state": "ACCEPT_PREFERRED",
+    }
+
+    test_func = partial(
+        topotest.router_json_cmp, r2, "show ipv6 pim bsr json", expected
+    )
+    _, result = topotest.run_and_expect(test_func, None, count=60, wait=1)
+
+    assertmsg = "r2: r1 was not elected, IPv6 bsr election mismatch"
+    assert result is None, assertmsg
+
+
+def test_pimv6_bsr_cand_rp(request):
+    "Test PIMv6 BSR candidate RP"
+    tgen = get_topogen()
+    tc_name = request.node.name
+    write_test_header(tc_name)
+
+    if tgen.routers_have_failure():
+        pytest.skip("skipped because of router(s) failure")
+
+    r3 = tgen.gears["r3"]
+
+    # r3 is a candidate rp
+    expected = {"address": "fd00:0:0:3::3", "priority": 10}
+    test_func = partial(
+        topotest.router_json_cmp, r3, "show ipv6 pim bsr candidate-rp json", expected
+    )
+    _, result = topotest.run_and_expect(test_func, None, count=60, wait=1)
+
+    assertmsg = "r3: bsr candidate rp mismatch"
+    assert result is None, assertmsg
+
+
+def test_pimv6_bsr_rp_info(request):
+    "Test IPv6 RP info state"
+    tgen = get_topogen()
+    tc_name = request.node.name
+    write_test_header(tc_name)
+
+    if tgen.routers_have_failure():
+        pytest.skip("skipped because of router(s) failure")
+
+    # At this point, all nodes, including r5 should have synced the RP state
+    step("Verify rp-info on r5 from BSR")
+    result = verify_pim_rp_info(
+        tgen,
+        None,
+        "r5",
+        "ffbb::0/64",
+        None,
+        "fd00:0:0:3::3",
+        "BSR",
+        False,
+        "ipv6",
+        True,
+        retry_timeout=90,
+    )
+    assert result is True, "Testcase {} :Failed \n Error: {}".format(tc_name, result)
+
+    result = verify_pim_rp_info(
+        tgen,
+        None,
+        "r5",
+        "ffbb::0/124",
+        None,
+        "fd00:0:0:3::4",
+        "BSR",
+        False,
+        "ipv6",
+        True,
+        retry_timeout=30,
+    )
+    assert result is True, "Testcase {} :Failed \n Error: {}".format(tc_name, result)
+
+    result = verify_pim_rp_info(
+        tgen,
+        None,
+        "r5",
+        "ffbb::0/108",
+        None,
+        "fd00:0:0:3::4",
+        "BSR",
+        False,
+        "ipv6",
+        True,
+        retry_timeout=30,
+    )
     assert result is True, "Testcase {} :Failed \n Error: {}".format(tc_name, result)