Skip to content

Commit

Permalink
topotests: bgp_rpki_topo1, failure on error packet
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
louis-6wind committed Jan 11, 2024
1 parent 1b3b483 commit 211249a
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
3 changes: 3 additions & 0 deletions tests/topotests/bgp_rpki_topo1/r1/rtrd.py
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,9 @@ def handle_reset(self):

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:
Expand Down
20 changes: 20 additions & 0 deletions tests/topotests/bgp_rpki_topo1/test_bgp_rpki_topo1.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down Expand Up @@ -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")
Expand Down Expand Up @@ -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"
Expand Down Expand Up @@ -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"
Expand Down

0 comments on commit 211249a

Please sign in to comment.