ip_address = str(netaddr.IPAddress(data['ip_address']))
lease_remaining = int(data['lease_remaining'])
self.callback(network_id, ip_address, lease_remaining)
- except ValueError, e:
+ except ValueError as e:
LOG.warn(_('Unable to parse lease relay msg to dict.'))
LOG.warn(_('Exception value: %s'), e)
LOG.warn(_('Message representation: %s'), repr(msg))
- except Exception, e:
+ except Exception as e:
LOG.exception(_('Unable update lease. Exception'))
def start(self):
full_args = ["ovs-vsctl", "--timeout=2"] + args
try:
return utils.execute(full_args, root_helper=self.root_helper)
- except Exception, e:
+ except Exception as e:
LOG.error(_("Unable to execute %(cmd)s. Exception: %(exception)s"),
{'cmd': full_args, 'exception': e})
full_args = ["ovs-ofctl", cmd, self.br_name] + args
try:
return utils.execute(full_args, root_helper=self.root_helper)
- except Exception, e:
+ except Exception as e:
LOG.error(_("Unable to execute %(cmd)s. Exception: %(exception)s"),
{'cmd': full_args, 'exception': e})
"param-key=nicira-iface-id", "uuid=%s" % xs_vif_uuid]
try:
return utils.execute(args, root_helper=self.root_helper).strip()
- except Exception, e:
+ except Exception as e:
LOG.error(_("Unable to execute %(cmd)s. Exception: %(exception)s"),
{'cmd': args, 'exception': e})
port_name = match.group('port_name')
ofport = int(match.group('ofport'))
return VifPort(port_name, ofport, vif_id, vif_mac, self)
- except Exception, e:
+ except Exception as e:
LOG.info(_("Unable to parse regex results. Exception: %s"), e)
return
args = ["ovs-vsctl", "--timeout=2", "list-br"]
try:
return utils.execute(args, root_helper=root_helper).strip().split("\n")
- except Exception, e:
+ except Exception as e:
LOG.exception(_("Unable to retrieve bridges. Exception: %s"), e)
return []
def checkout(self, dbapi_con, con_record, con_proxy):
try:
dbapi_con.cursor().execute('select 1')
- except dbapi_con.OperationalError, ex:
+ except dbapi_con.OperationalError as ex:
if ex.args[0] in (2006, 2013, 2014, 2045, 2055):
LOG.warn(_('Got mysql server has gone away: %s'), ex)
raise DisconnectionError(_("Database server went away"))
def do_alembic_command(config, cmd, *args, **kwargs):
try:
getattr(alembic_command, cmd)(config, *args, **kwargs)
- except alembic_util.CommandError, e:
+ except alembic_util.CommandError as e:
alembic_util.err(str(e))
except greenlet.GreenletExit:
# ignore these since they are just from shutdowns
pass
- except rpc_common.ClientException, e:
+ except rpc_common.ClientException as e:
LOG.debug(_("Expected exception during message handling (%s)") %
e._exc_info[1])
return {'exc':
bind_dict["port-id"] = str(bind.port_id)
bind_dict["vlan-id"] = str(bind.vlan_id)
bindings.append(bind_dict)
- except Exception, exc:
+ except Exception as exc:
LOG.error("Failed to get all bindings: %s" % str(exc))
return bindings
bind_dict["port-id"] = str(bind.port_id)
bind_dict["vlan-id"] = str(bind.vlan_id)
binding.append(bind_dict)
- except Exception, exc:
+ except Exception as exc:
LOG.error("Failed to get all bindings: %s" % str(exc))
return binding
bind_dict["port-id"] = str(res.port_id)
bind_dict["vlan-id"] = str(res.vlan_id)
return bind_dict
- except Exception, exc:
+ except Exception as exc:
LOG.error("Failed to create nexus binding: %s" % str(exc))
def delete_nexusportbinding(self, vlan_id):
bind_dict["port-id"] = res.port_id
bindings.append(bind_dict)
return bindings
- except Exception, exc:
+ except Exception as exc:
raise Exception("Failed to delete nexus port binding: %s"
% str(exc))
bind_dict["port-id"] = str(res.port_id)
bind_dict["vlan-id"] = str(res.vlan_id)
return bind_dict
- except Exception, exc:
+ except Exception as exc:
raise Exception("Failed to update nexus port binding vnic: %s"
% str(exc))
vlan_dict["vlan-name"] = vlan_bind.vlan_name
vlan_dict["net-id"] = str(vlan_bind.network_id)
vlans.append(vlan_dict)
- except Exception, exc:
+ except Exception as exc:
LOG.error("Failed to get all vlan bindings: %s" % str(exc))
return vlans
vlan_dict["vlan-name"] = vlan_bind.vlan_name
vlan_dict["net-id"] = str(vlan_bind.network_id)
vlan.append(vlan_dict)
- except Exception, exc:
+ except Exception as exc:
LOG.error("Failed to get vlan binding: %s" % str(exc))
return vlan
vlan_dict["vlan-name"] = res.vlan_name
vlan_dict["net-id"] = str(res.network_id)
return vlan_dict
- except Exception, exc:
+ except Exception as exc:
LOG.error("Failed to create vlan binding: %s" % str(exc))
def delete_vlan_binding(self, network_id):
vlan_dict = {}
vlan_dict["vlan-id"] = str(res.vlan_id)
return vlan_dict
- except Exception, exc:
+ except Exception as exc:
raise Exception("Failed to delete vlan binding: %s" % str(exc))
def update_vlan_binding(self, network_id, vlan_id, vlan_name):
vlan_dict["vlan-name"] = res.vlan_name
vlan_dict["net-id"] = str(res.network_id)
return vlan_dict
- except Exception, exc:
+ except Exception as exc:
raise Exception("Failed to update vlan binding: %s" % str(exc))
net_dict["net-id"] = str(net.uuid)
net_dict["net-name"] = net.name
nets.append(net_dict)
- except Exception, exc:
+ except Exception as exc:
LOG.error("Failed to get all networks: %s" % str(exc))
return nets
net_dict["net-id"] = str(net.uuid)
net_dict["net-name"] = net.name
net.append(net_dict)
- except Exception, exc:
+ except Exception as exc:
LOG.error("Failed to get network: %s" % str(exc))
return net
net_dict["net-id"] = str(res.uuid)
net_dict["net-name"] = res.name
return net_dict
- except Exception, exc:
+ except Exception as exc:
LOG.error("Failed to create network: %s" % str(exc))
def delete_network(self, net_id):
net_dict = {}
net_dict["net-id"] = str(net.uuid)
return net_dict
- except Exception, exc:
+ except Exception as exc:
raise Exception("Failed to delete port: %s" % str(exc))
def update_network(self, tenant_id, net_id, **kwargs):
net_dict["net-id"] = str(net.uuid)
net_dict["net-name"] = net.name
return net_dict
- except Exception, exc:
+ except Exception as exc:
raise Exception("Failed to update network: %s" % str(exc))
def get_all_ports(self, net_id):
port_dict["net"] = port.network
ports.append(port_dict)
return ports
- except Exception, exc:
+ except Exception as exc:
LOG.error("Failed to get all ports: %s" % str(exc))
def get_port(self, net_id, port_id):
port_dict["state"] = port.state
port_list.append(port_dict)
return port_list
- except Exception, exc:
+ except Exception as exc:
LOG.error("Failed to get port: %s" % str(exc))
def create_port(self, net_id):
port_dict["int-id"] = port.interface_id
port_dict["state"] = port.state
return port_dict
- except Exception, exc:
+ except Exception as exc:
LOG.error("Failed to create port: %s" % str(exc))
def delete_port(self, net_id, port_id):
port_dict = {}
port_dict["port-id"] = str(port.uuid)
return port_dict
- except Exception, exc:
+ except Exception as exc:
raise Exception("Failed to delete port: %s" % str(exc))
def update_port(self, net_id, port_id, port_state):
port_dict["int-id"] = port.interface_id
port_dict["state"] = port.state
return port_dict
- except Exception, exc:
+ except Exception as exc:
raise Exception("Failed to update port state: %s" % str(exc))
def plug_interface(self, net_id, port_id, int_id):
port_dict["int-id"] = port.interface_id
port_dict["state"] = port.state
return port_dict
- except Exception, exc:
+ except Exception as exc:
raise Exception("Failed to plug interface: %s" % str(exc))
def unplug_interface(self, net_id, port_id):
port_dict["int-id"] = port.interface_id
port_dict["state"] = port.state
return port_dict
- except Exception, exc:
+ except Exception as exc:
raise Exception("Failed to unplug interface: %s" % str(exc))
else:
reason = _("An operation on OFC is failed.")
raise nexc.OFCException(reason=reason)
- except (socket.error, IOError), e:
+ except (socket.error, IOError) as e:
reason = _("Failed to connect OFC : %s") % str(e)
LOG.error(reason)
raise nexc.OFCException(reason=reason)
agent = OVSQuantumOFPRyuAgent(integ_br, tunnel_ip, ovsdb_ip,
ovsdb_port, polling_interval,
root_helper)
- except httplib.HTTPException, e:
+ except httplib.HTTPException as e:
LOG.error(_("Initialization failed: %s"), e)
sys.exit(1)
break
return self._parse_stats(raw_stats)
- except socket.error, e:
+ except socket.error as e:
LOG.warn(_('Error while connecting to stats socket: %s') % e)
return {}
else:
try:
quantum_service = service.serve_wsgi(service.QuantumApiService)
quantum_service.wait()
- except RuntimeError, e:
+ except RuntimeError as e:
sys.exit(_("ERROR: %s") % e)
net_dict["id"] = str(net.uuid)
net_dict["name"] = net.name
nets.append(net_dict)
- except Exception, exc:
+ except Exception as exc:
LOG.error("Failed to get all networks: %s", str(exc))
return nets
net_dict["id"] = str(net.uuid)
net_dict["name"] = net.name
net.append(net_dict)
- except Exception, exc:
+ except Exception as exc:
LOG.error("Failed to get network: %s", str(exc))
return net
net_dict["id"] = str(res.uuid)
net_dict["name"] = res.name
return net_dict
- except Exception, exc:
+ except Exception as exc:
LOG.error("Failed to create network: %s", str(exc))
def delete_network(self, net_id):
net_dict = {}
net_dict["id"] = str(net.uuid)
return net_dict
- except Exception, exc:
+ except Exception as exc:
LOG.error("Failed to delete network: %s", str(exc))
def update_network(self, tenant_id, net_id, param_data):
net_dict["id"] = str(net.uuid)
net_dict["name"] = net.name
return net_dict
- except Exception, exc:
+ except Exception as exc:
LOG.error("Failed to update network: %s", str(exc))
def get_all_ports(self, net_id):
port_dict["state"] = port.state
ports.append(port_dict)
return ports
- except Exception, exc:
+ except Exception as exc:
LOG.error("Failed to get all ports: %s", str(exc))
def get_port(self, net_id, port_id):
port_dict["state"] = port.state
port_list.append(port_dict)
return port_list
- except Exception, exc:
+ except Exception as exc:
LOG.error("Failed to get port: %s", str(exc))
def create_port(self, net_id):
port_dict["attachment"] = port.interface_id
port_dict["state"] = port.state
return port_dict
- except Exception, exc:
+ except Exception as exc:
LOG.error("Failed to create port: %s", str(exc))
def delete_port(self, net_id, port_id):
port_dict = {}
port_dict["id"] = str(port.uuid)
return port_dict
- except Exception, exc:
+ except Exception as exc:
LOG.error("Failed to delete port: %s", str(exc))
def update_port(self, net_id, port_id, **kwargs):
port_dict["attachment"] = port.interface_id
port_dict["state"] = port.state
return port_dict
- except Exception, exc:
+ except Exception as exc:
LOG.error("Failed to update port state: %s", str(exc))
def plug_interface(self, net_id, port_id, int_id):
port_dict["attachment"] = port.interface_id
port_dict["state"] = port.state
return port_dict
- except Exception, exc:
+ except Exception as exc:
LOG.error("Failed to plug interface: %s", str(exc))
def unplug_interface(self, net_id, port_id):
try:
db.port_unset_attachment(port_id, net_id)
LOG.debug("Detached interface from port %s", port_id)
- except Exception, exc:
+ except Exception as exc:
LOG.error("Failed to unplug interface: %s", str(exc))
try:
msg_dict = dict(url=request.url, status=response.status_int)
msg = _("%(url)s returned with HTTP %(status)d") % msg_dict
- except AttributeError, e:
+ except AttributeError as e:
msg_dict = dict(url=request.url, exception=e)
msg = _("%(url)s returned a fault: %(exception)s") % msg_dict