X-Git-Url: https://osm.etsi.org/gitweb/?a=blobdiff_plain;f=RO-SDN-floodlight_openflow%2Fosm_rosdn_floodlightof%2Ffloodlight_of.py;h=43b3a302bdee68fbd904c70b02c0e6d6955f9571;hb=aca8cb5e63ebd11cc69373323d8df62b5d8cbfe2;hp=238b43472c4007936ca3daffff901a1c98013808;hpb=80135b928ab442c38898750b4751480205b4affc;p=osm%2FRO.git diff --git a/RO-SDN-floodlight_openflow/osm_rosdn_floodlightof/floodlight_of.py b/RO-SDN-floodlight_openflow/osm_rosdn_floodlightof/floodlight_of.py index 238b4347..43b3a302 100644 --- a/RO-SDN-floodlight_openflow/osm_rosdn_floodlightof/floodlight_of.py +++ b/RO-SDN-floodlight_openflow/osm_rosdn_floodlightof/floodlight_of.py @@ -28,17 +28,18 @@ It creates the class OF_conn to create dataplane connections with static rules based on packet destination MAC address """ -__author__ = "Pablo Montes, Alfonso Tierno" -__date__ = "$28-oct-2014 12:07:15$" - import json -import requests import logging + from osm_ro_plugin.openflow_conn import ( OpenflowConn, - OpenflowConnUnexpectedResponse, OpenflowConnConnectionException, + OpenflowConnUnexpectedResponse, ) +import requests + +__author__ = "Pablo Montes, Alfonso Tierno" +__date__ = "$28-oct-2014 12:07:15$" class OfConnFloodLight(OpenflowConn): @@ -240,7 +241,7 @@ class OfConnFloodLight(OpenflowConn): self.logger.debug("get_of_rules " + error_text) info = of_response.json() - if type(info) != dict: + if not info.isinstance(dict): self.logger.error( "get_of_rules. Unexpected response not a dict %s", str(type(info)) ) @@ -444,7 +445,7 @@ class OfConnFloodLight(OpenflowConn): self.logger.debug("obtain_port_correspondence " + error_text) info = of_response.json() - if type(info) != dict: + if not info.isinstance(dict): raise OpenflowConnUnexpectedResponse( "unexpected openflow port-desc response, " "not a dict. Wrong version?" @@ -456,10 +457,9 @@ class OfConnFloodLight(OpenflowConn): "'portDesc' not found. Wrong version?" ) - if ( - type(info["portDesc"]) != list - and type(info["portDesc"]) != tuple - ): + if not info["portDesc"].isinstance(list) and not info[ + "portDesc" + ].isinstance(tuple): raise OpenflowConnUnexpectedResponse( "unexpected openflow port-desc response at " "'portDesc', not a list. Wrong version?"