From 517609895b2f996c888acf25d181b7ce589289b6 Mon Sep 17 00:00:00 2001 From: Philippe Guibert Date: Thu, 19 Dec 2024 17:28:21 +0100 Subject: [PATCH] topotests: add unified configuration Replace the various per-daemon config files with a unique frr.conf configuration file. Signed-off-by: Philippe Guibert --- tests/topotests/bgp_bmp/test_bgp_bmp_1.py | 2 +- .../bgp_evpn_rt5/r1/{bgpd.conf => frr.conf} | 23 +++++++++++++++++++ tests/topotests/bgp_evpn_rt5/r1/zebra.conf | 23 ------------------- .../bgp_evpn_rt5/r2/{bgpd.conf => frr.conf} | 19 +++++++++++++++ tests/topotests/bgp_evpn_rt5/r2/zebra.conf | 19 --------------- .../bgp_evpn_rt5/r3/{bgpd.conf => frr.conf} | 13 +++++++++++ tests/topotests/bgp_evpn_rt5/r3/zebra.conf | 13 ----------- tests/topotests/bgp_evpn_rt5/test_bgp_evpn.py | 18 ++++++--------- 8 files changed, 63 insertions(+), 67 deletions(-) rename tests/topotests/bgp_evpn_rt5/r1/{bgpd.conf => frr.conf} (77%) delete mode 100644 tests/topotests/bgp_evpn_rt5/r1/zebra.conf rename tests/topotests/bgp_evpn_rt5/r2/{bgpd.conf => frr.conf} (84%) delete mode 100644 tests/topotests/bgp_evpn_rt5/r2/zebra.conf rename tests/topotests/bgp_evpn_rt5/r3/{bgpd.conf => frr.conf} (81%) delete mode 100644 tests/topotests/bgp_evpn_rt5/r3/zebra.conf diff --git a/tests/topotests/bgp_bmp/test_bgp_bmp_1.py b/tests/topotests/bgp_bmp/test_bgp_bmp_1.py index be3e07929a0f..1d7aa9747359 100644 --- a/tests/topotests/bgp_bmp/test_bgp_bmp_1.py +++ b/tests/topotests/bgp_bmp/test_bgp_bmp_1.py @@ -78,7 +78,7 @@ def setup_module(mod): "tcpdump -nni r1-eth0 -s 0 -w {} &".format(pcap_file), stdout=None ) - for rname, router in tgen.routers().items(): + for _, (rname, router) in enumerate(tgen.routers().items(), 1): logger.info("Loading router %s" % rname) router.load_frr_config( os.path.join(CWD, "{}/frr.conf".format(rname)), diff --git a/tests/topotests/bgp_evpn_rt5/r1/bgpd.conf b/tests/topotests/bgp_evpn_rt5/r1/frr.conf similarity index 77% rename from tests/topotests/bgp_evpn_rt5/r1/bgpd.conf rename to tests/topotests/bgp_evpn_rt5/r1/frr.conf index c49f3ce12db0..fa3fe57c51b5 100644 --- a/tests/topotests/bgp_evpn_rt5/r1/bgpd.conf +++ b/tests/topotests/bgp_evpn_rt5/r1/frr.conf @@ -1,6 +1,27 @@ +log stdout + +hostname r1 +password zebra + +! debug zebra vxlan +! debug zebra kernel +! debug zebra dplane +! debug zebra rib ! debug bgp neighbor-events ! debug bgp updates ! debug bgp zebra +log stdout +vrf r1-vrf-101 + vni 101 + exit-vrf +! +interface r1-eth0 + ip address 192.168.100.21/24 +! +interface loop101 vrf r1-vrf-101 + ip address 192.168.102.21/32 + ipv6 address fd00::1/128 +! router bgp 65000 bgp router-id 192.168.100.21 bgp log-neighbor-changes @@ -40,3 +61,5 @@ exit route-map rmap_r1 permit 1 match evpn vni 101 exit + + diff --git a/tests/topotests/bgp_evpn_rt5/r1/zebra.conf b/tests/topotests/bgp_evpn_rt5/r1/zebra.conf deleted file mode 100644 index c3d508c2b628..000000000000 --- a/tests/topotests/bgp_evpn_rt5/r1/zebra.conf +++ /dev/null @@ -1,23 +0,0 @@ -log stdout - -hostname r1 -password zebra - -! debug zebra vxlan -! debug zebra kernel -! debug zebra dplane -! debug zebra rib -log stdout -vrf r1-vrf-101 - vni 101 - exit-vrf -! -interface r1-eth0 - ip address 192.168.100.21/24 -! -interface loop101 vrf r1-vrf-101 - ip address 192.168.102.21/32 - ipv6 address fd00::1/128 -! - - diff --git a/tests/topotests/bgp_evpn_rt5/r2/bgpd.conf b/tests/topotests/bgp_evpn_rt5/r2/frr.conf similarity index 84% rename from tests/topotests/bgp_evpn_rt5/r2/bgpd.conf rename to tests/topotests/bgp_evpn_rt5/r2/frr.conf index 4f1d8e4a3788..c40269ed2f90 100644 --- a/tests/topotests/bgp_evpn_rt5/r2/bgpd.conf +++ b/tests/topotests/bgp_evpn_rt5/r2/frr.conf @@ -1,6 +1,24 @@ +log stdout + +hostname r2 +password zebra + +! debug zebra vxlan ! debug bgp neighbor-events ! debug bgp updates ! debug bgp zebra + +vrf r2-vrf-101 + vni 101 + exit-vrf +! +interface loop101 vrf r2-vrf-101 + ip address 192.168.101.41/32 + ipv6 address fd00::2/128 +! +interface r2-eth0 + ip address 192.168.100.41/24 +! router bgp 65000 bgp router-id 192.168.100.41 bgp log-neighbor-changes @@ -47,3 +65,4 @@ exit route-map rmap6 deny 2 match ipv6 address acl6_2 exit + diff --git a/tests/topotests/bgp_evpn_rt5/r2/zebra.conf b/tests/topotests/bgp_evpn_rt5/r2/zebra.conf deleted file mode 100644 index 7db40cb59c0d..000000000000 --- a/tests/topotests/bgp_evpn_rt5/r2/zebra.conf +++ /dev/null @@ -1,19 +0,0 @@ -log stdout - -hostname r2 -password zebra - -! debug zebra vxlan - -vrf r2-vrf-101 - vni 101 - exit-vrf -! -interface loop101 vrf r2-vrf-101 - ip address 192.168.101.41/32 - ipv6 address fd00::2/128 -! -interface r2-eth0 - ip address 192.168.100.41/24 -! - diff --git a/tests/topotests/bgp_evpn_rt5/r3/bgpd.conf b/tests/topotests/bgp_evpn_rt5/r3/frr.conf similarity index 81% rename from tests/topotests/bgp_evpn_rt5/r3/bgpd.conf rename to tests/topotests/bgp_evpn_rt5/r3/frr.conf index 43f04c8bd856..b78ec9ae8122 100644 --- a/tests/topotests/bgp_evpn_rt5/r3/bgpd.conf +++ b/tests/topotests/bgp_evpn_rt5/r3/frr.conf @@ -1,6 +1,17 @@ ! debug bgp neighbor-events ! debug bgp updates ! debug bgp zebra +vrf r3-vrf-102 + vni 102 + exit-vrf +! +interface r3-eth0 + ip address 192.168.100.61/24 +! +interface loop102 vrf r3-vrf-102 + ip address 192.168.102.61/32 + ipv6 address fd00:6::1/128 +! router bgp 65500 bgp router-id 192.168.100.61 bgp log-neighbor-changes @@ -29,3 +40,5 @@ router bgp 65000 vrf r3-vrf-102 advertise ipv6 unicast exit-address-family ! + + diff --git a/tests/topotests/bgp_evpn_rt5/r3/zebra.conf b/tests/topotests/bgp_evpn_rt5/r3/zebra.conf deleted file mode 100644 index 3ab51423d978..000000000000 --- a/tests/topotests/bgp_evpn_rt5/r3/zebra.conf +++ /dev/null @@ -1,13 +0,0 @@ -vrf r3-vrf-102 - vni 102 - exit-vrf -! -interface r3-eth0 - ip address 192.168.100.61/24 -! -interface loop102 vrf r3-vrf-102 - ip address 192.168.102.61/32 - ipv6 address fd00:6::1/128 -! - - diff --git a/tests/topotests/bgp_evpn_rt5/test_bgp_evpn.py b/tests/topotests/bgp_evpn_rt5/test_bgp_evpn.py index aed9b726a9db..ae25c24ac150 100644 --- a/tests/topotests/bgp_evpn_rt5/test_bgp_evpn.py +++ b/tests/topotests/bgp_evpn_rt5/test_bgp_evpn.py @@ -159,21 +159,17 @@ def setup_module(mod): tgen.net["r1"].cmd_raises("ip -n r1-vrf-101 link set bridge-101 up") tgen.net["r1"].cmd_raises("ip -n r1-vrf-101 link set vxlan-101 up") - for rname, router in router_list.items(): + for rname, router in tgen.routers().items(): + logger.info("Loading router %s" % rname) if rname == "r1": - router.load_config(TopoRouter.RD_MGMTD, None, "--vrfwnetns") - router.load_config( - TopoRouter.RD_ZEBRA, - os.path.join(CWD, "{}/zebra.conf".format(rname)), - "--vrfwnetns", + router.load_frr_config( + os.path.join(CWD, "{}/frr.conf".format(rname)), + [(TopoRouter.RD_MGMTD, "--vrfwnetns"), (TopoRouter.RD_ZEBRA, "--vrfwnetns"), (TopoRouter.RD_BGP, None)], ) else: - router.load_config( - TopoRouter.RD_ZEBRA, os.path.join(CWD, "{}/zebra.conf".format(rname)) + router.load_frr_config( + os.path.join(CWD, "{}/frr.conf".format(rname)) ) - router.load_config( - TopoRouter.RD_BGP, os.path.join(CWD, "{}/bgpd.conf".format(rname)) - ) # Initialize all routers. tgen.start_router()