data = body[self._resource_name]
except KeyError:
# raise if _resource_name is not in req body.
- raise exc.HTTPBadRequest("Unable to find '%s' in request body"\
+ raise exc.HTTPBadRequest("Unable to find '%s' in request body"
% self._resource_name)
for param in params:
param_name = param['param-name']
def _filter_port_has_interface(port, has_interface, **kwargs):
# convert to bool
match_has_interface = has_interface.lower() == 'true'
- really_has_interface = 'attachment' in port and port['attachment'] != None
+ really_has_interface = ('attachment' in port and
+ port['attachment'] is not None)
return match_has_interface == really_has_interface
return cls()
+# NOTE(jkoelker) Since to_primitive isn't used anywhere can we just drop it
def to_primitive(value):
- if type(value) is type([]) or type(value) is type((None,)):
+ if isinstance(value, (list, tuple)):
o = []
for v in value:
o.append(to_primitive(v))
return o
- elif type(value) is type({}):
+ elif isinstance(value, dict):
o = {}
for k, v in value.iteritems():
o[k] = to_primitive(v)
obj = subprocess.Popen(cmd, shell=True, stdin=subprocess.PIPE,
stdout=subprocess.PIPE, stderr=subprocess.PIPE, env=env)
result = None
- if process_input != None:
+ if process_input is not None:
result = obj.communicate(process_input)
else:
result = obj.communicate()
for l in fp:
l = l.strip()
if not l.startswith('#') and ' ' in l:
- canonical_email, alias = [x for x in l.split(' ') \
- if x.startswith('<')]
+ canonical_email, alias = [x for x in l.split(' ')
+ if x.startswith('<')]
mapping[alias] = canonical_email
return mapping
raise c_exc.PortProfileBindingAlreadyExists(pp_id=ppid,
port_id=portid)
except exc.NoResultFound:
- binding = l2network_models.PortProfileBinding(tenantid, portid, \
- ppid, default)
+ binding = l2network_models.PortProfileBinding(tenantid, portid,
+ ppid, default)
session.add(binding)
session.flush()
return binding
"""Adds a services binding"""
LOG.debug("add_services_binding() called")
session = db.get_session()
- binding = services_models.ServicesBinding(service_id, mngnet_id, \
+ binding = services_models.ServicesBinding(service_id, mngnet_id,
nbnet_id, sbnet_id)
session.add(binding)
session.flush()
one()
raise c_exc.PortVnicBindingAlreadyExists(port_id=port_id)
except exc.NoResultFound:
- port_binding = ucs_models.PortBinding(port_id, blade_intf_dn, \
- portprofile_name, vlan_name, vlan_id, qos)
+ port_binding = ucs_models.PortBinding(port_id, blade_intf_dn,
+ portprofile_name, vlan_name,
+ vlan_id, qos)
session.add(port_binding)
session.flush()
return port_binding
attachment_id = attachment_id[:const.UUID_LENGTH]
remote_interface_id = remote_interface_id[:const.UUID_LENGTH]
if remote_interface_id != attachment_id:
- LOG.debug("Existing attachment_id:%s, remote_interface_id:%s" % \
+ LOG.debug("Existing attachment_id:%s, remote_interface_id:%s" %
(attachment_id, remote_interface_id))
raise exc.PortInUse(port_id=port_id, net_id=net_id,
att_id=attachment_id)
"for the VIF driver." % name)
return
LOG.error("Quantum plugin does not support required \"%s\" extension"
- " for the VIF driver. nova-compute will quit." \
+ " for the VIF driver. nova-compute will quit."
% CSCO_EXT_NAME)
raise excp.ServiceUnavailable()
project_id = instance['project_id']
vif_id = mapping['vif_uuid']
- instance_data_dict = \
- {'novatenant': \
- {'instance_id': instance_id,
- 'instance_desc': \
- {'user_id': user_id,
- 'project_id': project_id,
- 'vif_id': vif_id}}}
+ instance_data_dict = {
+ 'novatenant': {
+ 'instance_id': instance_id,
+ 'instance_desc': {
+ 'user_id': user_id,
+ 'project_id': project_id,
+ 'vif_id': vif_id}}}
client = Client(HOST, PORT, USE_SSL, format='json', version=VERSION,
uri_prefix=URI_PREFIX_CSCO, tenant=TENANT_ID,
service_logic = servlogcs.ServicesLogistics()
net_list = {}
multiport_net_list = []
- networks_name_list = [management_net_name, northbound_net_name, \
+ networks_name_list = [management_net_name, northbound_net_name,
southbound_net_name]
client = Client(HOST, PORT, USE_SSL, format='json', tenant=tenant_id)
for net in networks_name_list:
cmd, " ".join(["<%s>" % y for y in SERVICE_COMMANDS[cmd]["args"]]))
sys.exit()
if len(arglist) > 0:
- LOG.debug("Too many arguments for \"%s\" (expected: %d, got: %d)" \
+ LOG.debug("Too many arguments for \"%s\" (expected: %d, got: %d)"
% (cmd, len(cmdargs), len(orig_arglist)))
print "Service Insertion Usage:\n %s %s" % (
cmd, " ".join(["<%s>" % y for y in SERVICE_COMMANDS[cmd]["args"]]))
db.validate_port_ownership(tenant_id, net_id, port_id)
port = db.port_get(port_id, net_id)
attachment_id = port[const.INTERFACEID]
- if attachment_id == None:
+ if attachment_id is None:
return
db.port_unset_attachment(port_id, net_id)
db.port_update(port_id, net_id, op_status=OperationalStatus.DOWN)
def get_bridge_name(self, network_id):
if not network_id:
- LOG.warning("Invalid Network ID, will lead to incorrect bridge" \
+ LOG.warning("Invalid Network ID, will lead to incorrect bridge"
"name")
bridge_name = self.br_name_prefix + network_id[0:11]
return bridge_name
def get_subinterface_name(self, vlan_id):
if not vlan_id:
- LOG.warning("Invalid VLAN ID, will lead to incorrect " \
+ LOG.warning("Invalid VLAN ID, will lead to incorrect "
"subinterface name")
subinterface_name = '%s.%s' % (self.physical_interface, vlan_id)
return subinterface_name
def get_tap_device_name(self, interface_id):
if not interface_id:
- LOG.warning("Invalid Interface ID, will lead to incorrect " \
+ LOG.warning("Invalid Interface ID, will lead to incorrect "
"tap device name")
tap_device_name = TAP_INTERFACE_PREFIX + interface_id[0:11]
return tap_device_name
def initConfig(cfile=None):
config = ConfigParser.ConfigParser()
- if cfile == None:
+ if cfile is None:
if os.path.exists(CONFIG_FILE):
cfile = CONFIG_FILE
else:
cfile = find_config(os.path.abspath(os.path.dirname(__file__)))
- if cfile == None:
+ if cfile is None:
raise Exception("Configuration file \"%s\" doesn't exist" % (cfile))
LOG.info("Using configuration file: %s" % cfile)
config.read(cfile)
LOG.debug("Executing command \"%s\" with args: %s" % (CMD, args))
manager = None
- if COMMANDS[CMD]["need_login"] == True:
+ if COMMANDS[CMD]["need_login"] is True:
if not os.path.exists(options.configfile):
LOG.error("NVP plugin configuration file \"%s\" doesn't exist!" %
options.configfile)
LOG.error("Port or Network not found, Error: %s" % str(e))
raise exception.PortNotFound(port_id=port, net_id=network)
except NvpApiClient.Conflict as e:
- LOG.error("Conflict while making attachment to port, " \
+ LOG.error("Conflict while making attachment to port, "
"Error: %s" % str(e))
raise exception.AlreadyAttached(att_id=attachment,
port_id=port,
from quantum.openstack.common.setup import write_git_changelog
from quantum.openstack.common.setup import write_vcsversion
-import sys
-import os
-import subprocess
requires = parse_requirements()
depend_links = parse_dependency_links()
eager_resources=EagerResources,
entry_points={
'console_scripts': [
- 'quantum-linuxbridge-agent =' \
+ 'quantum-linuxbridge-agent ='
'quantum.plugins.linuxbridge.agent.linuxbridge_quantum_agent:main',
- 'quantum-openvswitch-agent =' \
+ 'quantum-openvswitch-agent ='
'quantum.plugins.openvswitch.agent.ovs_quantum_agent:main',
- 'quantum-ryu-agent = ' \
+ 'quantum-ryu-agent = '
'quantum.plugins.ryu.agent.ryu_quantum_agent:main',
'quantum-server = quantum.server:main',
]