tests: fix exception handling around vapi.connect()/.disconnect()
vapi.connect() only raises subclasses of vpp_papi.VPPIOError.
vapi.disconnect() doesn't raise any exceptions, removed uneeded try block.
Type: test
Change-Id: Ide6e6db298b205f14382065862e358757619a5ba
Signed-off-by: Paul Vinciguerra <pvinci@vinciconsulting.com>
diff --git a/test/framework.py b/test/framework.py
index 24ee869..affd448 100644
--- a/test/framework.py
+++ b/test/framework.py
@@ -28,6 +28,7 @@
from vpp_lo_interface import VppLoInterface
from vpp_bvi_interface import VppBviInterface
from vpp_papi_provider import VppPapiProvider
+import vpp_papi
from vpp_papi.vpp_stats import VPPStats
from vpp_papi.vpp_transport_shmem import VppTransportShmemIOError
from log import RED, GREEN, YELLOW, double_line_delim, single_line_delim, \
@@ -571,11 +572,10 @@
raise
try:
cls.vapi.connect()
- except Exception:
- try:
- cls.vapi.disconnect()
- except Exception:
- pass
+ except vpp_papi.VPPIOError as e:
+ cls.logger.debug("Exception connecting to vapi: %s" % e)
+ cls.vapi.disconnect()
+
if cls.debug_gdbserver:
print(colorize("You're running VPP inside gdbserver but "
"VPP-API connection failed, did you forget "