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 <louis.scalbert@6wind.com>
This commit is contained in:
Louis Scalbert 2023-12-26 16:07:48 +01:00
parent 1b3b483342
commit 211249a3b7
2 changed files with 23 additions and 0 deletions

View File

@ -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:

View File

@ -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"