From 211249a3b789cd82d61f340cdda7a0dbe99a10b8 Mon Sep 17 00:00:00 2001 From: Louis Scalbert Date: Tue, 26 Dec 2023 16:07:48 +0100 Subject: [PATCH] topotests: bgp_rpki_topo1, failure on error packet RPKI FRR module should not send any RPKI error packet during the tests. Exit rtrd when receiving error packet. Skip tests with errors if rtrd has stopped. Signed-off-by: Louis Scalbert --- tests/topotests/bgp_rpki_topo1/r1/rtrd.py | 3 +++ .../bgp_rpki_topo1/test_bgp_rpki_topo1.py | 20 +++++++++++++++++++ 2 files changed, 23 insertions(+) diff --git a/tests/topotests/bgp_rpki_topo1/r1/rtrd.py b/tests/topotests/bgp_rpki_topo1/r1/rtrd.py index d34539a8f9..bca58a66ac 100755 --- a/tests/topotests/bgp_rpki_topo1/r1/rtrd.py +++ b/tests/topotests/bgp_rpki_topo1/r1/rtrd.py @@ -273,6 +273,9 @@ class RTRConnHandler(socketserver.BaseRequestHandler): def handle_error(self, buf: bytes): dbg(f">Error: {str(buf)}") + self.server.shutdown() + self.server.stopped = True + raise ConnectionError("Received an RPKI error packet from FRR. Exiting") def handle(self): while True: diff --git a/tests/topotests/bgp_rpki_topo1/test_bgp_rpki_topo1.py b/tests/topotests/bgp_rpki_topo1/test_bgp_rpki_topo1.py index e6b2c4c4f2..36bc0b7200 100644 --- a/tests/topotests/bgp_rpki_topo1/test_bgp_rpki_topo1.py +++ b/tests/topotests/bgp_rpki_topo1/test_bgp_rpki_topo1.py @@ -112,6 +112,11 @@ def test_show_bgp_rpki_prefixes(): if tgen.routers_have_failure(): pytest.skip(tgen.errors) + for rname in ["r1", "r3"]: + logger.info("{}: checking if rtrd is running".format(rname)) + if rtrd_process.poll() is not None: + pytest.skip(tgen.errors) + rname = "r2" step("Check RPKI prefix table") @@ -149,6 +154,11 @@ def test_show_bgp_rpki_prefixes_no_rpki_cache(): if tgen.routers_have_failure(): pytest.skip(tgen.errors) + for rname in ["r1", "r3"]: + logger.info("{}: checking if rtrd is running".format(rname)) + if rtrd_process.poll() is not None: + pytest.skip(tgen.errors) + def _show_rpki_no_connection(rname): output = json.loads( tgen.gears[rname].vtysh_cmd("show rpki cache-connection json") @@ -180,6 +190,11 @@ def test_show_bgp_rpki_prefixes_reconnect(): if tgen.routers_have_failure(): pytest.skip(tgen.errors) + for rname in ["r1", "r3"]: + logger.info("{}: checking if rtrd is running".format(rname)) + if rtrd_process.poll() is not None: + pytest.skip(tgen.errors) + step("Restore RPKI server configuration") rname = "r2" @@ -224,6 +239,11 @@ def test_show_bgp_rpki_route_map(): if tgen.routers_have_failure(): pytest.skip(tgen.errors) + for rname in ["r1", "r3"]: + logger.info("{}: checking if rtrd is running".format(rname)) + if rtrd_process.poll() is not None: + pytest.skip(tgen.errors) + step("Apply RPKI valid route-map on neighbor") rname = "r2" -- 2.39.5