Enable hacking H301 check

This commit enables the H301 hacking rule by removing all the
multiple imports in a single line from neutron.

Partial-Bug: #1291032

Change-Id: I7ba7f82fb36a433d73190eb3d568b6961ccb57c6
This commit is contained in:
Matthew Treinish 2014-03-31 17:17:44 -04:00
parent 9e90eb6965
commit 0755e7b379
11 changed files with 119 additions and 123 deletions

View File

@ -26,7 +26,7 @@ from neutron.debug.debug_agent import NeutronDebugAgent
from neutron.openstack.common import importutils
from neutronclient.common import exceptions as exc
from neutronclient.common import utils
from neutronclient.shell import env, NeutronShell, NEUTRON_API_VERSION
from neutronclient import shell
COMMAND_V2 = {
'probe-create': utils.import_class(
@ -46,7 +46,7 @@ COMMAND_V2 = {
COMMANDS = {'2.0': COMMAND_V2}
class NeutronDebugShell(NeutronShell):
class NeutronDebugShell(shell.NeutronShell):
def __init__(self, api_version):
super(NeutronDebugShell, self).__init__(api_version)
for k, v in COMMANDS[api_version].items():
@ -56,7 +56,8 @@ class NeutronDebugShell(NeutronShell):
parser = super(NeutronDebugShell, self).build_option_parser(
description, version)
default = (
env('NEUTRON_TEST_CONFIG_FILE') or env('QUANTUM_TEST_CONFIG_FILE')
shell.env('NEUTRON_TEST_CONFIG_FILE') or
shell.env('QUANTUM_TEST_CONFIG_FILE')
)
parser.add_argument(
'--config-file',
@ -85,4 +86,5 @@ class NeutronDebugShell(NeutronShell):
def main(argv=None):
return NeutronDebugShell(NEUTRON_API_VERSION).run(argv or sys.argv[1:])
return NeutronDebugShell(shell.NEUTRON_API_VERSION).run(
argv or sys.argv[1:])

View File

@ -20,15 +20,14 @@ v2 Neutron Plug-in API specification.
methods that needs to be implemented by a v2 Neutron Plug-in.
"""
from abc import ABCMeta, abstractmethod
import abc
import six
@six.add_metaclass(ABCMeta)
@six.add_metaclass(abc.ABCMeta)
class NeutronPluginBaseV2(object):
@abstractmethod
@abc.abstractmethod
def create_subnet(self, context, subnet):
"""Create a subnet.
@ -43,7 +42,7 @@ class NeutronPluginBaseV2(object):
"""
pass
@abstractmethod
@abc.abstractmethod
def update_subnet(self, context, id, subnet):
"""Update values of a subnet.
@ -57,7 +56,7 @@ class NeutronPluginBaseV2(object):
"""
pass
@abstractmethod
@abc.abstractmethod
def get_subnet(self, context, id, fields=None):
"""Retrieve a subnet.
@ -71,7 +70,7 @@ class NeutronPluginBaseV2(object):
"""
pass
@abstractmethod
@abc.abstractmethod
def get_subnets(self, context, filters=None, fields=None,
sorts=None, limit=None, marker=None, page_reverse=False):
"""Retrieve a list of subnets.
@ -119,7 +118,7 @@ class NeutronPluginBaseV2(object):
"""
raise NotImplementedError
@abstractmethod
@abc.abstractmethod
def delete_subnet(self, context, id):
"""Delete a subnet.
@ -128,7 +127,7 @@ class NeutronPluginBaseV2(object):
"""
pass
@abstractmethod
@abc.abstractmethod
def create_network(self, context, network):
"""Create a network.
@ -144,7 +143,7 @@ class NeutronPluginBaseV2(object):
"""
pass
@abstractmethod
@abc.abstractmethod
def update_network(self, context, id, network):
"""Update values of a network.
@ -158,7 +157,7 @@ class NeutronPluginBaseV2(object):
"""
pass
@abstractmethod
@abc.abstractmethod
def get_network(self, context, id, fields=None):
"""Retrieve a network.
@ -172,7 +171,7 @@ class NeutronPluginBaseV2(object):
"""
pass
@abstractmethod
@abc.abstractmethod
def get_networks(self, context, filters=None, fields=None,
sorts=None, limit=None, marker=None, page_reverse=False):
"""Retrieve a list of networks.
@ -220,7 +219,7 @@ class NeutronPluginBaseV2(object):
"""
raise NotImplementedError
@abstractmethod
@abc.abstractmethod
def delete_network(self, context, id):
"""Delete a network.
@ -229,7 +228,7 @@ class NeutronPluginBaseV2(object):
"""
pass
@abstractmethod
@abc.abstractmethod
def create_port(self, context, port):
"""Create a port.
@ -244,7 +243,7 @@ class NeutronPluginBaseV2(object):
"""
pass
@abstractmethod
@abc.abstractmethod
def update_port(self, context, id, port):
"""Update values of a port.
@ -257,7 +256,7 @@ class NeutronPluginBaseV2(object):
"""
pass
@abstractmethod
@abc.abstractmethod
def get_port(self, context, id, fields=None):
"""Retrieve a port.
@ -271,7 +270,7 @@ class NeutronPluginBaseV2(object):
"""
pass
@abstractmethod
@abc.abstractmethod
def get_ports(self, context, filters=None, fields=None,
sorts=None, limit=None, marker=None, page_reverse=False):
"""Retrieve a list of ports.
@ -316,7 +315,7 @@ class NeutronPluginBaseV2(object):
"""
raise NotImplementedError
@abstractmethod
@abc.abstractmethod
def delete_port(self, context, id):
"""Delete a port.

View File

@ -16,13 +16,12 @@
#
# @author: Sumit Naiksatam, Cisco Systems, Inc.
from abc import ABCMeta, abstractmethod
import abc
import inspect
import six
@six.add_metaclass(ABCMeta)
@six.add_metaclass(abc.ABCMeta)
class L2DevicePluginBase(object):
"""Base class for a device-specific plugin.
@ -31,7 +30,7 @@ class L2DevicePluginBase(object):
the configuration on each device.
"""
@abstractmethod
@abc.abstractmethod
def create_network(self, tenant_id, net_name, net_id, vlan_name, vlan_id,
**kwargs):
"""Create network.
@ -41,7 +40,7 @@ class L2DevicePluginBase(object):
"""
pass
@abstractmethod
@abc.abstractmethod
def delete_network(self, tenant_id, net_id, **kwargs):
"""Delete network.
@ -50,7 +49,7 @@ class L2DevicePluginBase(object):
"""
pass
@abstractmethod
@abc.abstractmethod
def update_network(self, tenant_id, net_id, name, **kwargs):
"""Update network.
@ -59,7 +58,7 @@ class L2DevicePluginBase(object):
"""
pass
@abstractmethod
@abc.abstractmethod
def create_port(self, tenant_id, net_id, port_state, port_id, **kwargs):
"""Create port.
@ -68,7 +67,7 @@ class L2DevicePluginBase(object):
"""
pass
@abstractmethod
@abc.abstractmethod
def delete_port(self, tenant_id, net_id, port_id, **kwargs):
"""Delete port.
@ -77,7 +76,7 @@ class L2DevicePluginBase(object):
"""
pass
@abstractmethod
@abc.abstractmethod
def update_port(self, tenant_id, net_id, port_id, **kwargs):
"""Update port.
@ -86,7 +85,7 @@ class L2DevicePluginBase(object):
"""
pass
@abstractmethod
@abc.abstractmethod
def plug_interface(self, tenant_id, net_id, port_id, remote_interface_id,
**kwargs):
"""Plug interface.
@ -96,7 +95,7 @@ class L2DevicePluginBase(object):
"""
pass
@abstractmethod
@abc.abstractmethod
def unplug_interface(self, tenant_id, net_id, port_id, **kwargs):
"""Unplug interface.

View File

@ -26,13 +26,12 @@ from neutron.db import external_net_db
from neutron.db import extraroute_db
from neutron.db import l3_db
from neutron.db import models_v2
from neutron.extensions.flavor import (FLAVOR_NETWORK, FLAVOR_ROUTER)
from neutron.extensions import flavor as ext_flavor
from neutron.openstack.common import importutils
from neutron.openstack.common import log as logging
from neutron.plugins.metaplugin.common import config # noqa
from neutron.plugins.metaplugin import meta_db_v2
from neutron.plugins.metaplugin.meta_models_v2 import (NetworkFlavor,
RouterFlavor)
from neutron.plugins.metaplugin import meta_models_v2
LOG = logging.getLogger(__name__)
@ -40,19 +39,21 @@ LOG = logging.getLogger(__name__)
# Hooks used to select records which belong a target plugin.
def _meta_network_model_hook(context, original_model, query):
return query.outerjoin(NetworkFlavor,
NetworkFlavor.network_id == models_v2.Network.id)
return query.outerjoin(meta_models_v2.NetworkFlavor,
meta_models_v2.NetworkFlavor.network_id ==
models_v2.Network.id)
def _meta_port_model_hook(context, original_model, query):
return query.join(NetworkFlavor,
NetworkFlavor.network_id == models_v2.Port.network_id)
return query.join(meta_models_v2.NetworkFlavor,
meta_models_v2.NetworkFlavor.network_id ==
models_v2.Port.network_id)
def _meta_flavor_filter_hook(query, filters):
if FLAVOR_NETWORK in filters:
return query.filter(NetworkFlavor.flavor ==
filters[FLAVOR_NETWORK][0])
if ext_flavor.FLAVOR_NETWORK in filters:
return query.filter(meta_models_v2.NetworkFlavor.flavor ==
filters[ext_flavor.FLAVOR_NETWORK][0])
return query
@ -200,11 +201,11 @@ class MetaPluginV2(db_base_plugin_v2.NeutronDbPluginV2,
def _extend_network_dict(self, context, network):
flavor = self._get_flavor_by_network_id(context, network['id'])
network[FLAVOR_NETWORK] = flavor
network[ext_flavor.FLAVOR_NETWORK] = flavor
def create_network(self, context, network):
n = network['network']
flavor = n.get(FLAVOR_NETWORK)
flavor = n.get(ext_flavor.FLAVOR_NETWORK)
if str(flavor) not in self.plugins:
flavor = self.default_flavor
plugin = self._get_plugin(flavor)
@ -238,7 +239,7 @@ class MetaPluginV2(db_base_plugin_v2.NeutronDbPluginV2,
plugin = self._get_plugin(flavor)
net = plugin.get_network(context, id, fields)
net['id'] = id
if not fields or FLAVOR_NETWORK in fields:
if not fields or ext_flavor.FLAVOR_NETWORK in fields:
self._extend_network_dict(context, net)
if fields and 'id' not in fields:
del net['id']
@ -247,8 +248,8 @@ class MetaPluginV2(db_base_plugin_v2.NeutronDbPluginV2,
def get_networks(self, context, filters=None, fields=None):
nets = []
for flavor, plugin in self.plugins.items():
if (filters and FLAVOR_NETWORK in filters and
not flavor in filters[FLAVOR_NETWORK]):
if (filters and ext_flavor.FLAVOR_NETWORK in filters and
not flavor in filters[ext_flavor.FLAVOR_NETWORK]):
continue
if filters:
#NOTE: copy each time since a target plugin may modify
@ -256,11 +257,11 @@ class MetaPluginV2(db_base_plugin_v2.NeutronDbPluginV2,
plugin_filters = filters.copy()
else:
plugin_filters = {}
plugin_filters[FLAVOR_NETWORK] = [flavor]
plugin_filters[ext_flavor.FLAVOR_NETWORK] = [flavor]
plugin_nets = plugin.get_networks(context, plugin_filters, fields)
for net in plugin_nets:
if not fields or FLAVOR_NETWORK in fields:
net[FLAVOR_NETWORK] = flavor
if not fields or ext_flavor.FLAVOR_NETWORK in fields:
net[ext_flavor.FLAVOR_NETWORK] = flavor
nets.append(net)
return nets
@ -316,7 +317,7 @@ class MetaPluginV2(db_base_plugin_v2.NeutronDbPluginV2,
plugin_filters = filters.copy()
else:
plugin_filters = {}
plugin_filters[FLAVOR_NETWORK] = [flavor]
plugin_filters[ext_flavor.FLAVOR_NETWORK] = [flavor]
ports = plugin.get_ports(context, plugin_filters, fields)
all_ports += ports
return all_ports
@ -343,11 +344,11 @@ class MetaPluginV2(db_base_plugin_v2.NeutronDbPluginV2,
def _extend_router_dict(self, context, router):
flavor = self._get_flavor_by_router_id(context, router['id'])
router[FLAVOR_ROUTER] = flavor
router[ext_flavor.FLAVOR_ROUTER] = flavor
def create_router(self, context, router):
r = router['router']
flavor = r.get(FLAVOR_ROUTER)
flavor = r.get(ext_flavor.FLAVOR_ROUTER)
if str(flavor) not in self.l3_plugins:
flavor = self.default_l3_flavor
plugin = self._get_l3_plugin(flavor)
@ -381,20 +382,20 @@ class MetaPluginV2(db_base_plugin_v2.NeutronDbPluginV2,
flavor = meta_db_v2.get_flavor_by_router(context.session, id)
plugin = self._get_l3_plugin(flavor)
router = plugin.get_router(context, id, fields)
if not fields or FLAVOR_ROUTER in fields:
if not fields or ext_flavor.FLAVOR_ROUTER in fields:
self._extend_router_dict(context, router)
return router
def get_routers_with_flavor(self, context, filters=None,
fields=None):
collection = self._model_query(context, l3_db.Router)
r_model = RouterFlavor
r_model = meta_models_v2.RouterFlavor
collection = collection.join(r_model,
l3_db.Router.id == r_model.router_id)
if filters:
for key, value in filters.iteritems():
if key == FLAVOR_ROUTER:
column = RouterFlavor.flavor
if key == ext_flavor.FLAVOR_ROUTER:
column = meta_models_v2.RouterFlavor.flavor
else:
column = getattr(l3_db.Router, key, None)
if column:

View File

@ -13,8 +13,7 @@
# License for the specific language governing permissions and limitations
# under the License.
from abc import ABCMeta, abstractmethod, abstractproperty
import abc
import six
# The following keys are used in the segment dictionaries passed via
@ -28,7 +27,7 @@ PHYSICAL_NETWORK = 'physical_network'
SEGMENTATION_ID = 'segmentation_id'
@six.add_metaclass(ABCMeta)
@six.add_metaclass(abc.ABCMeta)
class TypeDriver(object):
"""Define stable abstract interface for ML2 type drivers.
@ -46,7 +45,7 @@ class TypeDriver(object):
either be excluded or stored as None.
"""
@abstractmethod
@abc.abstractmethod
def get_type(self):
"""Get driver's network type.
@ -54,7 +53,7 @@ class TypeDriver(object):
"""
pass
@abstractmethod
@abc.abstractmethod
def initialize(self):
"""Perform driver initialization.
@ -64,7 +63,7 @@ class TypeDriver(object):
"""
pass
@abstractmethod
@abc.abstractmethod
def validate_provider_segment(self, segment):
"""Validate attributes of a provider network segment.
@ -84,7 +83,7 @@ class TypeDriver(object):
"""
pass
@abstractmethod
@abc.abstractmethod
def reserve_provider_segment(self, session, segment):
"""Reserve resource associated with a provider network segment.
@ -98,7 +97,7 @@ class TypeDriver(object):
"""
pass
@abstractmethod
@abc.abstractmethod
def allocate_tenant_segment(self, session):
"""Allocate resource for a new tenant network segment.
@ -114,7 +113,7 @@ class TypeDriver(object):
"""
pass
@abstractmethod
@abc.abstractmethod
def release_segment(self, session, segment):
"""Release network segment.
@ -129,7 +128,7 @@ class TypeDriver(object):
pass
@six.add_metaclass(ABCMeta)
@six.add_metaclass(abc.ABCMeta)
class NetworkContext(object):
"""Context passed to MechanismDrivers for changes to network resources.
@ -139,7 +138,7 @@ class NetworkContext(object):
MechanismDrivers can freely access the same information.
"""
@abstractproperty
@abc.abstractproperty
def current(self):
"""Return the current state of the network.
@ -149,7 +148,7 @@ class NetworkContext(object):
"""
pass
@abstractproperty
@abc.abstractproperty
def original(self):
"""Return the original state of the network.
@ -159,13 +158,13 @@ class NetworkContext(object):
"""
pass
@abstractproperty
@abc.abstractproperty
def network_segments(self):
"""Return the segments associated with this network resource."""
pass
@six.add_metaclass(ABCMeta)
@six.add_metaclass(abc.ABCMeta)
class SubnetContext(object):
"""Context passed to MechanismDrivers for changes to subnet resources.
@ -175,7 +174,7 @@ class SubnetContext(object):
MechanismDrivers can freely access the same information.
"""
@abstractproperty
@abc.abstractproperty
def current(self):
"""Return the current state of the subnet.
@ -185,7 +184,7 @@ class SubnetContext(object):
"""
pass
@abstractproperty
@abc.abstractproperty
def original(self):
"""Return the original state of the subnet.
@ -196,7 +195,7 @@ class SubnetContext(object):
pass
@six.add_metaclass(ABCMeta)
@six.add_metaclass(abc.ABCMeta)
class PortContext(object):
"""Context passed to MechanismDrivers for changes to port resources.
@ -206,7 +205,7 @@ class PortContext(object):
freely access the same information.
"""
@abstractproperty
@abc.abstractproperty
def current(self):
"""Return the current state of the port.
@ -216,7 +215,7 @@ class PortContext(object):
"""
pass
@abstractproperty
@abc.abstractproperty
def original(self):
"""Return the original state of the port.
@ -226,17 +225,17 @@ class PortContext(object):
"""
pass
@abstractproperty
@abc.abstractproperty
def network(self):
"""Return the NetworkContext associated with this port."""
pass
@abstractproperty
@abc.abstractproperty
def bound_segment(self):
"""Return the currently bound segment dictionary."""
pass
@abstractproperty
@abc.abstractproperty
def original_bound_segment(self):
"""Return the original bound segment dictionary.
@ -246,12 +245,12 @@ class PortContext(object):
"""
pass
@abstractproperty
@abc.abstractproperty
def bound_driver(self):
"""Return the currently bound mechanism driver name."""
pass
@abstractproperty
@abc.abstractproperty
def original_bound_driver(self):
"""Return the original bound mechanism driver name.
@ -261,7 +260,7 @@ class PortContext(object):
"""
pass
@abstractmethod
@abc.abstractmethod
def host_agents(self, agent_type):
"""Get agents of the specified type on port's host.
@ -270,7 +269,7 @@ class PortContext(object):
"""
pass
@abstractmethod
@abc.abstractmethod
def set_binding(self, segment_id, vif_type, vif_details):
"""Set the binding for the port.
@ -285,7 +284,7 @@ class PortContext(object):
pass
@six.add_metaclass(ABCMeta)
@six.add_metaclass(abc.ABCMeta)
class MechanismDriver(object):
"""Define stable abstract interface for ML2 mechanism drivers.
@ -307,7 +306,7 @@ class MechanismDriver(object):
methods that are part of the database transaction.
"""
@abstractmethod
@abc.abstractmethod
def initialize(self):
"""Perform driver initialization.

View File

@ -13,8 +13,7 @@
# License for the specific language governing permissions and limitations
# under the License.
from abc import ABCMeta, abstractmethod
import abc
import six
from neutron.extensions import portbindings
@ -24,7 +23,7 @@ from neutron.plugins.ml2 import driver_api as api
LOG = log.getLogger(__name__)
@six.add_metaclass(ABCMeta)
@six.add_metaclass(abc.ABCMeta)
class AgentMechanismDriverBase(api.MechanismDriver):
"""Base class for drivers that attach to networks using an L2 agent.
@ -74,7 +73,7 @@ class AgentMechanismDriverBase(api.MechanismDriver):
LOG.warning(_("Attempting to bind with dead agent: %s"),
agent)
@abstractmethod
@abc.abstractmethod
def try_to_bind_segment_for_agent(self, context, segment, agent):
"""Try to bind with segment for agent.
@ -94,7 +93,7 @@ class AgentMechanismDriverBase(api.MechanismDriver):
"""
@six.add_metaclass(ABCMeta)
@six.add_metaclass(abc.ABCMeta)
class SimpleAgentMechanismDriverBase(AgentMechanismDriverBase):
"""Base class for simple drivers using an L2 agent.
@ -134,7 +133,7 @@ class SimpleAgentMechanismDriverBase(AgentMechanismDriverBase):
else:
return False
@abstractmethod
@abc.abstractmethod
def check_segment_for_agent(self, segment, agent):
"""Check if segment can be bound for agent.

View File

@ -12,8 +12,7 @@
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
from abc import ABCMeta, abstractmethod
import abc
import six
from neutron.common import exceptions as exc
@ -26,7 +25,7 @@ LOG = log.getLogger(__name__)
TUNNEL = 'tunnel'
@six.add_metaclass(ABCMeta)
@six.add_metaclass(abc.ABCMeta)
class TunnelTypeDriver(api.TypeDriver):
"""Define stable abstract interface for ML2 type drivers.
@ -34,7 +33,7 @@ class TunnelTypeDriver(api.TypeDriver):
methods to manage these endpoints.
"""
@abstractmethod
@abc.abstractmethod
def add_endpoint(self, ip):
"""Register the endpoint in the type_driver database.
@ -42,7 +41,7 @@ class TunnelTypeDriver(api.TypeDriver):
"""
pass
@abstractmethod
@abc.abstractmethod
def get_endpoints(self):
"""Get every endpoint managed by the type_driver

View File

@ -16,12 +16,11 @@
# @author: Ryota MIBU
# @author: Akihiro MOTOKI
from abc import ABCMeta, abstractmethod
import abc
import six
@six.add_metaclass(ABCMeta)
@six.add_metaclass(abc.ABCMeta)
class OFCDriverBase(object):
"""OpenFlow Controller (OFC) Driver Specification.
@ -29,7 +28,7 @@ class OFCDriverBase(object):
It would be better that other methods like update_* are implemented.
"""
@abstractmethod
@abc.abstractmethod
def create_tenant(self, description, tenant_id=None):
"""Create a new tenant at OpenFlow Controller.
@ -41,7 +40,7 @@ class OFCDriverBase(object):
"""
pass
@abstractmethod
@abc.abstractmethod
def delete_tenant(self, ofc_tenant_id):
"""Delete a tenant at OpenFlow Controller.
@ -49,7 +48,7 @@ class OFCDriverBase(object):
"""
pass
@abstractmethod
@abc.abstractmethod
def create_network(self, ofc_tenant_id, description, network_id=None):
"""Create a new network on specified OFC tenant at OpenFlow Controller.
@ -64,7 +63,7 @@ class OFCDriverBase(object):
"""
pass
@abstractmethod
@abc.abstractmethod
def delete_network(self, ofc_network_id):
"""Delete a netwrok at OpenFlow Controller.
@ -72,7 +71,7 @@ class OFCDriverBase(object):
"""
pass
@abstractmethod
@abc.abstractmethod
def create_port(self, ofc_network_id, portinfo,
port_id=None, filters=None):
"""Create a new port on specified network at OFC.
@ -97,7 +96,7 @@ class OFCDriverBase(object):
"""
pass
@abstractmethod
@abc.abstractmethod
def delete_port(self, ofc_port_id):
"""Delete a port at OpenFlow Controller.

View File

@ -27,7 +27,7 @@ from neutron import context
from neutron.db import api as db
from neutron.db import db_base_plugin_v2
from neutron.db import models_v2
from neutron.extensions.flavor import (FLAVOR_NETWORK, FLAVOR_ROUTER)
from neutron.extensions import flavor as ext_flavor
from neutron.openstack.common import uuidutils
from neutron.plugins.metaplugin.meta_neutron_plugin import (
FaildToAddFlavorBinding)
@ -130,7 +130,7 @@ class MetaNeutronPluginV2Test(base.BaseTestCase):
'shared': False,
'router:external': [],
'tenant_id': self.fake_tenant_id,
FLAVOR_NETWORK: flavor}}
ext_flavor.FLAVOR_NETWORK: flavor}}
return data
def _fake_port(self, net_id):
@ -162,22 +162,22 @@ class MetaNeutronPluginV2Test(base.BaseTestCase):
def _fake_router(self, flavor):
data = {'router': {'name': flavor, 'admin_state_up': True,
'tenant_id': self.fake_tenant_id,
FLAVOR_ROUTER: flavor,
ext_flavor.FLAVOR_ROUTER: flavor,
'external_gateway_info': None}}
return data
def test_create_delete_network(self):
network1 = self._fake_network('fake1')
ret1 = self.plugin.create_network(self.context, network1)
self.assertEqual('fake1', ret1[FLAVOR_NETWORK])
self.assertEqual('fake1', ret1[ext_flavor.FLAVOR_NETWORK])
network2 = self._fake_network('fake2')
ret2 = self.plugin.create_network(self.context, network2)
self.assertEqual('fake2', ret2[FLAVOR_NETWORK])
self.assertEqual('fake2', ret2[ext_flavor.FLAVOR_NETWORK])
network3 = self._fake_network('proxy')
ret3 = self.plugin.create_network(self.context, network3)
self.assertEqual('proxy', ret3[FLAVOR_NETWORK])
self.assertEqual('proxy', ret3[ext_flavor.FLAVOR_NETWORK])
db_ret1 = self.plugin.get_network(self.context, ret1['id'])
self.assertEqual('fake1', db_ret1['name'])
@ -191,8 +191,9 @@ class MetaNeutronPluginV2Test(base.BaseTestCase):
db_ret4 = self.plugin.get_networks(self.context)
self.assertEqual(3, len(db_ret4))
db_ret5 = self.plugin.get_networks(self.context,
{FLAVOR_NETWORK: ['fake1']})
db_ret5 = self.plugin.get_networks(
self.context,
{ext_flavor.FLAVOR_NETWORK: ['fake1']})
self.assertEqual(1, len(db_ret5))
self.assertEqual('fake1', db_ret5[0]['name'])
self.plugin.delete_network(self.context, ret1['id'])
@ -307,14 +308,14 @@ class MetaNeutronPluginV2Test(base.BaseTestCase):
router2 = self._fake_router('fake2')
router_ret2 = self.plugin.create_router(self.context, router2)
self.assertEqual('fake1', router_ret1[FLAVOR_ROUTER])
self.assertEqual('fake2', router_ret2[FLAVOR_ROUTER])
self.assertEqual('fake1', router_ret1[ext_flavor.FLAVOR_ROUTER])
self.assertEqual('fake2', router_ret2[ext_flavor.FLAVOR_ROUTER])
router_in_db1 = self.plugin.get_router(self.context, router_ret1['id'])
router_in_db2 = self.plugin.get_router(self.context, router_ret2['id'])
self.assertEqual('fake1', router_in_db1[FLAVOR_ROUTER])
self.assertEqual('fake2', router_in_db2[FLAVOR_ROUTER])
self.assertEqual('fake1', router_in_db1[ext_flavor.FLAVOR_ROUTER])
self.assertEqual('fake2', router_in_db2[ext_flavor.FLAVOR_ROUTER])
self.plugin.delete_router(self.context, router_ret1['id'])
self.plugin.delete_router(self.context, router_ret2['id'])

View File

@ -15,9 +15,8 @@
import mock
import requests
from neutron.services.loadbalancer.drivers.netscaler import (
ncc_client, netscaler_driver
)
from neutron.services.loadbalancer.drivers.netscaler import ncc_client
from neutron.services.loadbalancer.drivers.netscaler import netscaler_driver
from neutron.tests.unit import testlib_api
NCC_CLIENT_CLASS = ('neutron.services.loadbalancer.drivers'

View File

@ -41,10 +41,9 @@ commands = {posargs}
# E711/E712 comparison to False should be 'if cond is False:' or 'if not cond:'
# query = query.filter(Component.disabled == False)
# E125 continuation line does not distinguish itself from next logical line
# H301 one import per line
# H302 import only modules
# TODO(marun) H404 multi line docstring should start with a summary
ignore = E711,E712,E125,H301,H302,H404
ignore = E711,E712,E125,H302,H404
show-source = true
builtins = _
exclude=.venv,.git,.tox,dist,doc,*openstack/common*,*lib/python*,*egg,tools