From 5118fd10184b14e8d2e1f1e9f5a858a907a1bd78 Mon Sep 17 00:00:00 2001 From: Y Bharath Date: Tue, 7 May 2024 20:31:03 +0530 Subject: [PATCH] tests: catch exception during switch shutdown Signed-off-by: y-bharath14 --- tests/topotests/lib/topogen.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/tests/topotests/lib/topogen.py b/tests/topotests/lib/topogen.py index 7941e5c1d233..14dd61b077eb 100644 --- a/tests/topotests/lib/topogen.py +++ b/tests/topotests/lib/topogen.py @@ -492,7 +492,16 @@ def stop_topology(self): "Errors found post shutdown - details follow: {}".format(errors) ) - self.net.stop() + try: + self.net.stop() + + except OSError as error: + # OSError exception is raised when mininet tries to stop switch + # though switch is stopped once but mininet tries to stop same + # switch again, where it ended up with exception + + logger.info(error) + logger.info("Exception ignored: switch is already stopped") def get_exabgp_cmd(self): if not self.exabgp_cmd: