summaryrefslogtreecommitdiffstats
path: root/tests/topotests/zebra_nht_resolution
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-08-05 09:56:23 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-08-05 09:56:23 +0000
commitc15d6efd40655f717841d00839a43df1ead5cb26 (patch)
tree35d579f9a19170e2b39085669ca92533c2d161b4 /tests/topotests/zebra_nht_resolution
parentAdding upstream version 10.0.1. (diff)
downloadfrr-c15d6efd40655f717841d00839a43df1ead5cb26.tar.xz
frr-c15d6efd40655f717841d00839a43df1ead5cb26.zip
Adding upstream version 10.1.upstream/10.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/topotests/zebra_nht_resolution')
-rw-r--r--tests/topotests/zebra_nht_resolution/test_verify_nh_resolution.py49
1 files changed, 21 insertions, 28 deletions
diff --git a/tests/topotests/zebra_nht_resolution/test_verify_nh_resolution.py b/tests/topotests/zebra_nht_resolution/test_verify_nh_resolution.py
index 6956ab7..fbef0fe 100644
--- a/tests/topotests/zebra_nht_resolution/test_verify_nh_resolution.py
+++ b/tests/topotests/zebra_nht_resolution/test_verify_nh_resolution.py
@@ -33,30 +33,36 @@ sys.path.append(os.path.join(CWD, "../"))
pytestmark = [pytest.mark.sharpd]
-#GLOBAL VARIABLES
+# GLOBAL VARIABLES
NH1 = "2.2.2.32"
+
def build_topo(tgen):
tgen.add_router("r1")
switch = tgen.add_switch("sw1")
switch.add_link(tgen.gears["r1"])
+
def setup_module(mod):
tgen = Topogen(build_topo, mod.__name__)
tgen.start_topology()
router_list = tgen.routers()
for rname, router in tgen.routers().items():
- router.load_config(TopoRouter.RD_ZEBRA, os.path.join(CWD, "{}/zebra.conf".format(rname)))
+ router.load_config(
+ TopoRouter.RD_ZEBRA, os.path.join(CWD, "{}/zebra.conf".format(rname))
+ )
router.load_config(
TopoRouter.RD_SHARP, os.path.join(CWD, "{}/sharpd.conf".format(rname))
)
tgen.start_router()
+
def teardown_module(_mod):
tgen = get_topogen()
tgen.stop_topology()
+
def test_verify_zebra_nh_resolution(request):
tgen = get_topogen()
tc_name = request.node.name
@@ -67,31 +73,18 @@ def test_verify_zebra_nh_resolution(request):
step("Configure static route")
input_dict_1 = {
- "r1": {
- "static_routes": [
- {"network": "2.2.2.0/24", "next_hop": "r1-eth0"}
- ]
- }
- }
+ "r1": {"static_routes": [{"network": "2.2.2.0/24", "next_hop": "r1-eth0"}]}
+ }
result = create_static_routes(tgen, input_dict_1)
- assert result is True, "Testcase {} : Failed \n Error: {}".format(
- tc_name, result
- )
+ assert result is True, "Testcase {} : Failed \n Error: {}".format(tc_name, result)
step("Verify static routes in RIB of R1")
- input_dict_2 = {
- "r1": {
- "static_routes": [
- {"network": "2.2.2.0/24"}
- ]
- }
- }
+ input_dict_2 = {"r1": {"static_routes": [{"network": "2.2.2.0/24"}]}}
dut = "r1"
result = verify_rib(tgen, "ipv4", dut, input_dict_2)
- assert result is True, "Testcase {} :Failed \n Error: {}".format(
- tc_name, result)
+ assert result is True, "Testcase {} :Failed \n Error: {}".format(tc_name, result)
step("Set the connected flag on the NH tracking entry")
r1.vtysh_cmd("sharp watch nexthop 2.2.2.32 connected")
@@ -108,8 +101,7 @@ def test_verify_zebra_nh_resolution(request):
}
result = verify_ip_nht(tgen, input_dict_nh)
assert result is True, "Testcase {} : Failed \n"
- "Error: Nexthop is missing in RIB".format(
- tc_name, result)
+ "Error: Nexthop is missing in RIB".format(tc_name, result)
step("Add a .32/32 route with the NH as itself")
r1.vtysh_cmd("sharp install routes 2.2.2.32 nexthop 2.2.2.32 1")
@@ -126,11 +118,12 @@ def test_verify_zebra_nh_resolution(request):
}
result = verify_ip_nht(tgen, input_dict_nh)
assert result is True, "Testcase {} : Failed \n"
- "Error: Nexthop became unresolved".format(
- tc_name, result)
+ "Error: Nexthop became unresolved".format(tc_name, result)
- step("Add a .31/32 route with the NH as 2.2.2.32"
- "to verify the NH Resolution behaviour")
+ step(
+ "Add a .31/32 route with the NH as 2.2.2.32"
+ "to verify the NH Resolution behaviour"
+ )
r1.vtysh_cmd("sharp install routes 2.2.2.31 nexthop 2.2.2.32 1")
step("Verify that NH 2.2.2.2/32 doesn't become unresolved")
@@ -145,8 +138,8 @@ def test_verify_zebra_nh_resolution(request):
}
result = verify_ip_nht(tgen, input_dict_nh)
assert result is True, "Testcase {} : Failed \n"
- "Error: Nexthop became unresolved".format(
- tc_name, result)
+ "Error: Nexthop became unresolved".format(tc_name, result)
+
if __name__ == "__main__":
args = ["-s"] + sys.argv[1:]