From: tierno Date: Thu, 5 Mar 2020 16:57:09 +0000 (+0000) Subject: sdn arista: fix reconnecting issue. Enhance logging X-Git-Tag: v7.1.0rc1~1^2~19 X-Git-Url: https://osm.etsi.org/gitweb/?p=osm%2FRO.git;a=commitdiff_plain;h=3fc485da0c34345a1ee8f63acf198d669dfc2c5b;hp=f33ea71e00f0fb9ec9f8525d9e50e005702a5354 sdn arista: fix reconnecting issue. Enhance logging Change-Id: I25851d747c263c827d3d910b2e0209080d2de664 Signed-off-by: tierno --- diff --git a/RO-SDN-arista/osm_rosdn_arista/wimconn_arista.py b/RO-SDN-arista/osm_rosdn_arista/wimconn_arista.py index b0e5b137..76d14b4c 100644 --- a/RO-SDN-arista/osm_rosdn_arista/wimconn_arista.py +++ b/RO-SDN-arista/osm_rosdn_arista/wimconn_arista.py @@ -38,6 +38,7 @@ import difflib import logging import uuid from enum import Enum +from requests import RequestException from cvprac.cvp_client import CvpClient from cvprac.cvp_client_errors import CvpLoginError, CvpSessionLogOutError, CvpApiError @@ -497,6 +498,8 @@ class AristaSdnConnector(SdnConnectorBase): Provide the parameter http_code """ try: + self.logger.debug("invoked create_connectivity_service '{}' ports: {}". + format(service_type, connection_points)) self.__get_Connection() self.__check_service(service_type, connection_points, @@ -1200,7 +1203,8 @@ class AristaSdnConnector(SdnConnectorBase): SdnConnectorError: In case of error. """ try: - self.logger.debug('invoked edit_connectivity_service for service {}'.format(service_uuid)) + self.logger.debug('invoked edit_connectivity_service for service {}. ports: {}'.format(service_uuid, + connection_points)) if not service_uuid: raise SdnConnectorError(message='Unable to perform operation, missing or empty uuid', @@ -1408,7 +1412,8 @@ class AristaSdnConnector(SdnConnectorBase): if self.client is None: self.client = self.__connect() self.client.api.get_cvp_info() - except CvpSessionLogOutError: + except (CvpSessionLogOutError, RequestException) as e: + self.logger.debug("Connection error '{}'. Reconnencting".format(e)) self.client = self.__connect() self.client.api.get_cvp_info()