X-Git-Url: https://osm.etsi.org/gitweb/?a=blobdiff_plain;f=vimconn_openvim.py;h=fb59ecccea44a2ba5e8c9fcd09b7142c7d91edb4;hb=0a3fc475690c26c63fb61269315dc17e05584b55;hp=4a0843b53498ee6970f7650eb45216ecbcebc430;hpb=fa51c20775384588b66c08ed38fca01780614bc2;p=osm%2FRO.git diff --git a/vimconn_openvim.py b/vimconn_openvim.py index 4a0843b5..fb59eccc 100644 --- a/vimconn_openvim.py +++ b/vimconn_openvim.py @@ -377,7 +377,7 @@ class vimconnector(vimconn.vimconnector): js_v(client_data, schema) #print "Input data: ", str(client_data) return True, client_data - except js_e.ValidationError, exc: + except js_e.ValidationError as exc: print "validate_in error, jsonschema exception ", exc.message, "at", exc.path return False, ("validate_in error, jsonschema exception ", exc.message, "at", exc.path) @@ -753,7 +753,7 @@ class vimconnector(vimconn.vimconnector): payload_req = vm_data try: vim_response = requests.post(self.url+'/'+self.tenant+'/servers', headers = self.headers_req, data=payload_req) - except requests.exceptions.RequestException, e: + except requests.exceptions.RequestException as e: print "new_vminstancefromJSON Exception: ", e.args return -vimconn.HTTP_Not_Found, str(e.args[0]) print vim_response @@ -1080,7 +1080,7 @@ class vimconnector(vimconn.vimconnector): url=self.url+'/hosts' try: vim_response = requests.get(url) - except requests.exceptions.RequestException, e: + except requests.exceptions.RequestException as e: print "get_hosts_info Exception: ", e.args return -vimconn.HTTP_Not_Found, str(e.args[0]) print "vim get", url, "response:", vim_response.status_code, vim_response.json() @@ -1102,7 +1102,7 @@ class vimconnector(vimconn.vimconnector): url=self.url+'/hosts/'+host['id'] try: vim_response = requests.get(url) - except requests.exceptions.RequestException, e: + except requests.exceptions.RequestException as e: print "get_hosts_info Exception: ", e.args return -vimconn.HTTP_Not_Found, str(e.args[0]) print "vim get", url, "response:", vim_response.status_code, vim_response.json() @@ -1124,7 +1124,7 @@ class vimconnector(vimconn.vimconnector): url=self.url+'/hosts' try: vim_response = requests.get(url) - except requests.exceptions.RequestException, e: + except requests.exceptions.RequestException as e: print "get_hosts Exception: ", e.args return -vimconn.HTTP_Not_Found, str(e.args[0]) print "vim get", url, "response:", vim_response.status_code, vim_response.json() @@ -1145,7 +1145,7 @@ class vimconnector(vimconn.vimconnector): url=self.url+'/' + vim_tenant + '/servers?hostId='+host['id'] try: vim_response = requests.get(url) - except requests.exceptions.RequestException, e: + except requests.exceptions.RequestException as e: print "get_hosts Exception: ", e.args return -vimconn.HTTP_Not_Found, str(e.args[0]) print "vim get", url, "response:", vim_response.status_code, vim_response.json() @@ -1165,7 +1165,7 @@ class vimconnector(vimconn.vimconnector): url=self.url+'/processor_ranking' try: vim_response = requests.get(url) - except requests.exceptions.RequestException, e: + except requests.exceptions.RequestException as e: print "get_processor_rankings Exception: ", e.args return -vimconn.HTTP_Not_Found, str(e.args[0]) print "vim get", url, "response:", vim_response.status_code, vim_response.json() @@ -1208,7 +1208,7 @@ class vimconnector(vimconn.vimconnector): payload_req = port_data try: vim_response = requests.post(self.url_admin+'/ports', headers = self.headers_req, data=payload_req) - except requests.exceptions.RequestException, e: + except requests.exceptions.RequestException as e: self.logger.error("new_external_port Exception: ", str(e)) return -vimconn.HTTP_Not_Found, str(e.args[0]) print vim_response @@ -1242,7 +1242,7 @@ class vimconnector(vimconn.vimconnector): payload_req = '{"network":{"name": "' + net_name + '","shared":true,"type": "' + net_type + '"}}' try: vim_response = requests.post(self.url+'/networks', headers = self.headers_req, data=payload_req) - except requests.exceptions.RequestException, e: + except requests.exceptions.RequestException as e: self.logger.error( "new_external_network Exception: ", e.args) return -vimconn.HTTP_Not_Found, str(e.args[0]) print vim_response @@ -1282,7 +1282,7 @@ class vimconnector(vimconn.vimconnector): url= self.url try: vim_response = requests.put(url +'/ports/'+port_id, headers = self.headers_req, data=payload_req) - except requests.exceptions.RequestException, e: + except requests.exceptions.RequestException as e: print "connect_port_network Exception: ", e.args return -vimconn.HTTP_Not_Found, str(e.args[0]) print vim_response