device = ip_lib.IPDevice(interface_name, self.conf.root_helper,
namespace=ri.ns_name())
- if not ip_cidr in [addr['cidr'] for addr in device.addr.list()]:
+ if ip_cidr not in [addr['cidr'] for addr in device.addr.list()]:
net = netaddr.IPNetwork(ip_cidr)
device.addr.add(net.version, ip_cidr, str(net.broadcast))
self._send_gratuitous_arp_packet(ri, interface_name, floating_ip)
def update_port_filter(self, port):
LOG.debug(_("Updating device (%s) filter"), port['device'])
- if not port['device'] in self.filtered_ports:
+ if port['device'] not in self.filtered_ports:
LOG.info(_('Attempted to update port filter which is not '
'filtered %s'), port['device'])
return
"""Return a dict of ActionExtensionController-s by collection."""
action_controllers = {}
for action in ext_mgr.get_actions():
- if not action.collection in action_controllers.keys():
+ if action.collection not in action_controllers.keys():
controller = ActionExtensionController(application)
mapper.connect("/%s/:(id)/action.:(format)" %
action.collection,
"""Returns a dict of RequestExtensionController-s by collection."""
request_ext_controllers = {}
for req_ext in ext_mgr.get_request_extensions():
- if not req_ext.key in request_ext_controllers.keys():
+ if req_ext.key not in request_ext_controllers.keys():
controller = RequestExtensionController(application)
mapper.connect(req_ext.url_route + '.:(format)',
action='process',
LOG.error(_("%(f_name)s: %(msg)s"), locals())
return msg
# Validate 'service' attribute
- if not svc_name in constants.ALLOWED_SERVICES:
+ if svc_name not in constants.ALLOWED_SERVICES:
msg = (_("Service name '%s' unspecified "
"or invalid") % svc_name)
LOG.error(_("%(f_name)s: %(msg)s"), locals())
# marked as reserved, else we temporarily mark it as unreserved
# based on the UCSM state, but may later change it if a port
# association is found in the DB
- if not const.TENANTID in blade_intf_data[blade_intf].keys():
+ if const.TENANTID not in blade_intf_data[blade_intf].keys():
blade_intf_data[blade_intf][const.TENANTID] = None
- if not const.PORTID in blade_intf_data[blade_intf].keys():
+ if const.PORTID not in blade_intf_data[blade_intf].keys():
blade_intf_data[blade_intf][const.PORTID] = None
- if not const.PROFILE_ID in blade_intf_data[blade_intf].keys():
+ if const.PROFILE_ID not in blade_intf_data[blade_intf].keys():
blade_intf_data[blade_intf][const.PROFILE_ID] = None
- if not const.INSTANCE_ID in blade_intf_data[blade_intf].keys():
+ if const.INSTANCE_ID not in blade_intf_data[blade_intf].keys():
blade_intf_data[blade_intf][const.INSTANCE_ID] = None
- if not const.VIF_ID in blade_intf_data[blade_intf].keys():
+ if const.VIF_ID not in blade_intf_data[blade_intf].keys():
blade_intf_data[blade_intf][const.VIF_ID] = None
if (blade_intf_data[blade_intf][const.BLADE_INTF_LINK_STATE] ==
def _port_unbound(self, port_id):
(net_uuid, map) = self._get_network_vswitch_map_by_port_id(port_id)
- if not net_uuid in self._network_vswitch_map:
+ if net_uuid not in self._network_vswitch_map:
LOG.info(_('Network %s is not avalailable on this agent'),
net_uuid)
return
port = kwargs.get('port')
tap_device_name = self.agent.br_mgr.get_tap_device_name(port['id'])
devices = self.agent.br_mgr.udev_get_tap_devices()
- if not tap_device_name in devices:
+ if tap_device_name not in devices:
return
if 'security_groups' in port:
db._ENGINE = None
self.default_flavor = cfg.CONF.META.default_flavor
- if not self.default_flavor in self.plugins:
+ if self.default_flavor not in self.plugins:
raise exc.Invalid(_('default_flavor %s is not plugin list') %
self.default_flavor)
self.default_l3_flavor = cfg.CONF.META.default_l3_flavor
- if not self.default_l3_flavor in self.l3_plugins:
+ if self.default_l3_flavor not in self.l3_plugins:
raise exc.Invalid(_('default_l3_flavor %s is not plugin list') %
self.default_l3_flavor)
return plugin_klass()
def _get_plugin(self, flavor):
- if not flavor in self.plugins:
+ if flavor not in self.plugins:
raise FlavorNotFound(flavor=flavor)
return self.plugins[flavor]
def _get_l3_plugin(self, flavor):
- if not flavor in self.l3_plugins:
+ if flavor not in self.l3_plugins:
raise FlavorNotFound(flavor=flavor)
return self.l3_plugins[flavor]
def create_network(self, context, network):
n = network['network']
flavor = n.get(FLAVOR_NETWORK)
- if not str(flavor) in self.plugins:
+ if str(flavor) not in self.plugins:
flavor = self.default_flavor
plugin = self._get_plugin(flavor)
with context.session.begin(subtransactions=True):
def create_port(self, context, port):
p = port['port']
- if not 'network_id' in p:
+ if 'network_id' not in p:
raise exc.NotFound
plugin = self._get_plugin_by_network_id(context, p['network_id'])
return plugin.create_port(context, port)
def create_subnet(self, context, subnet):
s = subnet['subnet']
- if not 'network_id' in s:
+ if 'network_id' not in s:
raise exc.NotFound
plugin = self._get_plugin_by_network_id(context,
s['network_id'])
def create_router(self, context, router):
r = router['router']
flavor = r.get(FLAVOR_ROUTER)
- if not str(flavor) in self.l3_plugins:
+ if str(flavor) not in self.l3_plugins:
flavor = self.default_l3_flavor
plugin = self._get_l3_plugin(flavor)
with context.session.begin(subtransactions=True):
if allow_extra_lswitches:
main_ls = [ls for ls in lswitches if ls['uuid'] == network.id]
tag_dict = dict((x['scope'], x['tag']) for x in main_ls[0]['tags'])
- if not 'multi_lswitch' in tag_dict:
+ if 'multi_lswitch' not in tag_dict:
nvplib.update_lswitch(cluster,
main_ls[0]['uuid'],
main_ls[0]['display_name'],
results = []
for parsed_file in cfg.CONF._cparser.parsed:
for parsed_item in parsed_file.keys():
- if not parsed_item in cfg.CONF:
+ if parsed_item not in cfg.CONF:
items = key and parsed_item.split(delimiter)
if not key or key == items[0]:
results.append(parsed_item)
}
if default:
data[self.resource_name]['default'] = default
- if not 'tenant_id' in data[self.resource_name]:
+ if 'tenant_id' not in data[self.resource_name]:
data[self.resource_name]['tenant_id'] = 'fake'
return self.api.post_json(_get_path('service-types'), data,
expect_errors=expect_errors)
def get_content_type(self):
allowed_types = ("application/xml", "application/json")
- if not "Content-Type" in self.headers:
+ if "Content-Type" not in self.headers:
LOG.debug(_("Missing Content-Type"))
return None
type = self.content_type