From: tierno Date: Fri, 13 Jul 2018 13:11:44 +0000 (+0200) Subject: Capture more exceptions for SDN floodlight plugin X-Git-Tag: BUILD_v4.0.1_1~2 X-Git-Url: https://osm.etsi.org/gitweb/?a=commitdiff_plain;h=e8b761a52439e28b5deb0c0d24b82eefff8e2309;p=osm%2Fopenvim.git Capture more exceptions for SDN floodlight plugin Change-Id: Ib3f7f51e9b963d1f07205c3297511b1dd450d6ab Signed-off-by: tierno --- diff --git a/osm_openvim/floodlight.py b/osm_openvim/floodlight.py index 826e300..810572b 100644 --- a/osm_openvim/floodlight.py +++ b/osm_openvim/floodlight.py @@ -137,8 +137,8 @@ class OF_conn(openflow_conn.OpenflowConn): if self.version == None: if 'dpid' in info[0] and 'inetAddress' in info[0]: self._set_version("0.9") - elif 'switchDPID' in info[0] and 'inetAddress' in info[0]: - self._set_version("1.X") + # elif 'switchDPID' in info[0] and 'inetAddress' in info[0]: + # self._set_version("1.X") else: self.logger.error( "get_of_switches. Unexpected response, not found 'dpid' or 'switchDPID' field: %s", @@ -154,7 +154,7 @@ class OF_conn(openflow_conn.OpenflowConn): error_text = type(e).__name__ + ": " + str(e) self.logger.error("get_of_switches " + error_text) raise openflow_conn.OpenflowconnConnectionException(error_text) - except ValueError as e: + except Exception as e: # ValueError in the case that JSON can not be decoded error_text = type(e).__name__ + ": " + str(e) self.logger.error("get_of_switches " + error_text) @@ -267,7 +267,7 @@ class OF_conn(openflow_conn.OpenflowConn): error_text = type(e).__name__ + ": " + str(e) self.logger.error("get_of_rules " + error_text) raise openflow_conn.OpenflowconnConnectionException(error_text) - except ValueError as e: + except Exception as e: # ValueError in the case that JSON can not be decoded error_text = type(e).__name__ + ": " + str(e) self.logger.error("get_of_rules " + error_text) @@ -345,7 +345,7 @@ class OF_conn(openflow_conn.OpenflowConn): error_text = type(e).__name__ + ": " + str(e) self.logger.error("obtain_port_correspondence " + error_text) raise openflow_conn.OpenflowconnConnectionException(error_text) - except ValueError as e: + except Exception as e: # ValueError in the case that JSON can not be decoded error_text = type(e).__name__ + ": " + str(e) self.logger.error("obtain_port_correspondence " + error_text) @@ -381,6 +381,11 @@ class OF_conn(openflow_conn.OpenflowConn): error_text = type(e).__name__ + ": " + str(e) self.logger.error("del_flow " + error_text) raise openflow_conn.OpenflowconnConnectionException(error_text) + except Exception as e: + # ValueError in the case that JSON can not be decoded + error_text = type(e).__name__ + ": " + str(e) + self.logger.error("del_flow " + error_text) + raise openflow_conn.OpenflowconnUnexpectedResponse(error_text) def new_flow(self, data): """ @@ -443,6 +448,11 @@ class OF_conn(openflow_conn.OpenflowConn): error_text = type(e).__name__ + ": " + str(e) self.logger.error("new_flow " + error_text) raise openflow_conn.OpenflowconnConnectionException(error_text) + except Exception as e: + # ValueError in the case that JSON can not be decoded + error_text = type(e).__name__ + ": " + str(e) + self.logger.error("new_flow " + error_text) + raise openflow_conn.OpenflowconnUnexpectedResponse(error_text) def clear_all_flows(self): """ @@ -470,4 +480,8 @@ class OF_conn(openflow_conn.OpenflowConn): error_text = type(e).__name__ + ": " + str(e) self.logger.error("clear_all_flows " + error_text) raise openflow_conn.OpenflowconnConnectionException(error_text) - + except Exception as e: + # ValueError in the case that JSON can not be decoded + error_text = type(e).__name__ + ": " + str(e) + self.logger.error("clear_all_flows " + error_text) + raise openflow_conn.OpenflowconnUnexpectedResponse(error_text) diff --git a/osm_openvim/ovim.py b/osm_openvim/ovim.py index 6b95456..9cfecca 100755 --- a/osm_openvim/ovim.py +++ b/osm_openvim/ovim.py @@ -43,7 +43,7 @@ import openflow_conn __author__ = "Alfonso Tierno, Leonardo Mirabal" __date__ = "$06-Feb-2017 12:07:15$" -__version__ = "0.5.25-r545" +__version__ = "0.5.26-r546" version_date = "Jul 2018" database_version = 23 #needed database schema version