And yet moar flake8 fixes
This commit is contained in:
@@ -406,8 +406,10 @@ class NVPDriver(base.BaseDriver):
|
|||||||
return results
|
return results
|
||||||
|
|
||||||
def _lswitch_select_open(self, context, switches=None, **kwargs):
|
def _lswitch_select_open(self, context, switches=None, **kwargs):
|
||||||
"""Selects an open lswitch for a network. Note that it does not select
|
"""Selects an open lswitch for a network.
|
||||||
the most full switch, but merely one with ports available.
|
|
||||||
|
Note that it does not select the most full switch, but merely one with
|
||||||
|
ports available.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
if switches is not None:
|
if switches is not None:
|
||||||
|
@@ -23,8 +23,8 @@ import uuid
|
|||||||
import netaddr
|
import netaddr
|
||||||
from neutron.common import exceptions
|
from neutron.common import exceptions
|
||||||
from neutron.openstack.common import log as logging
|
from neutron.openstack.common import log as logging
|
||||||
from neutron.openstack.common import timeutils
|
|
||||||
from neutron.openstack.common.notifier import api as notifier_api
|
from neutron.openstack.common.notifier import api as notifier_api
|
||||||
|
from neutron.openstack.common import timeutils
|
||||||
from oslo.config import cfg
|
from oslo.config import cfg
|
||||||
|
|
||||||
from quark.db import api as db_api
|
from quark.db import api as db_api
|
||||||
@@ -286,6 +286,7 @@ class QuarkIpam(object):
|
|||||||
def _allocate_from_v6_subnet(self, context, net_id, subnet,
|
def _allocate_from_v6_subnet(self, context, net_id, subnet,
|
||||||
port_id, ip_address=None, **kwargs):
|
port_id, ip_address=None, **kwargs):
|
||||||
"""This attempts to allocate v6 addresses as per RFC2462 and RFC3041.
|
"""This attempts to allocate v6 addresses as per RFC2462 and RFC3041.
|
||||||
|
|
||||||
To accomodate this, we effectively treat all v6 assignment as a
|
To accomodate this, we effectively treat all v6 assignment as a
|
||||||
first time allocation utilizing the MAC address of the VIF. Because
|
first time allocation utilizing the MAC address of the VIF. Because
|
||||||
we recycle MACs, we will eventually attempt to recreate a previously
|
we recycle MACs, we will eventually attempt to recreate a previously
|
||||||
|
@@ -18,8 +18,8 @@ from neutron.common import config as neutron_cfg
|
|||||||
from neutron.common import exceptions
|
from neutron.common import exceptions
|
||||||
from neutron.openstack.common import importutils
|
from neutron.openstack.common import importutils
|
||||||
from neutron.openstack.common import log as logging
|
from neutron.openstack.common import log as logging
|
||||||
from neutron.openstack.common import timeutils
|
|
||||||
from neutron.openstack.common.notifier import api as notifier_api
|
from neutron.openstack.common.notifier import api as notifier_api
|
||||||
|
from neutron.openstack.common import timeutils
|
||||||
from oslo.config import cfg
|
from oslo.config import cfg
|
||||||
|
|
||||||
from quark.db import api as db_api
|
from quark.db import api as db_api
|
||||||
|
@@ -19,8 +19,7 @@ from neutron.db import quota_db
|
|||||||
|
|
||||||
|
|
||||||
class QuarkQuotaDriver(quota_db.DbQuotaDriver):
|
class QuarkQuotaDriver(quota_db.DbQuotaDriver):
|
||||||
"""Driver to perform necessary checks to enforce quotas and obtain quota
|
"""Driver to perform necessary checks to enforce and obtain quotas.
|
||||||
information.
|
|
||||||
|
|
||||||
The default driver utilizes the local database.
|
The default driver utilizes the local database.
|
||||||
"""
|
"""
|
||||||
|
@@ -160,7 +160,9 @@ class QuarkIPAddressFindReallocatable(QuarkIpamBaseFunctionalTest):
|
|||||||
yield net_mod
|
yield net_mod
|
||||||
|
|
||||||
def test_find_reallocatable_ips_does_not_raise(self):
|
def test_find_reallocatable_ips_does_not_raise(self):
|
||||||
"""A patch recently introduced a bug wherein addressses
|
"""Regression testing
|
||||||
|
|
||||||
|
A patch recently introduced a bug wherein addressses
|
||||||
could not be returned to the ip_address_find call in
|
could not be returned to the ip_address_find call in
|
||||||
attempt_to_reallocate_ip. Adding this test to prevent
|
attempt_to_reallocate_ip. Adding this test to prevent
|
||||||
a future regression.
|
a future regression.
|
||||||
|
@@ -624,7 +624,9 @@ class TestQuarkCreateSubnet(test_quark_plugin.TestQuarkPlugin):
|
|||||||
self.plugin.create_subnet(self.context, subnet_request)
|
self.plugin.create_subnet(self.context, subnet_request)
|
||||||
|
|
||||||
def test_create_subnet_default_route_gateway_ip(self):
|
def test_create_subnet_default_route_gateway_ip(self):
|
||||||
"""If default route (host_routes) and gateway_ip are both provided,
|
"""Host_routes precedence
|
||||||
|
|
||||||
|
If default route (host_routes) and gateway_ip are both provided,
|
||||||
then host_route takes precedence.
|
then host_route takes precedence.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
@@ -661,9 +663,7 @@ class TestQuarkCreateSubnet(test_quark_plugin.TestQuarkPlugin):
|
|||||||
self.assertEqual(res[key], subnet["subnet"][key])
|
self.assertEqual(res[key], subnet["subnet"][key])
|
||||||
|
|
||||||
def test_create_subnet_null_gateway_no_routes(self):
|
def test_create_subnet_null_gateway_no_routes(self):
|
||||||
"""Creating a subnet with a NULL gateway IP shouldn't
|
"""A subnet with a NULL gateway IP shouldn't create routes."""
|
||||||
create routes.
|
|
||||||
"""
|
|
||||||
|
|
||||||
routes = [dict(cidr="0.0.0.0/0", gateway="172.16.0.4")]
|
routes = [dict(cidr="0.0.0.0/0", gateway="172.16.0.4")]
|
||||||
subnet = dict(
|
subnet = dict(
|
||||||
|
@@ -14,7 +14,6 @@
|
|||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
import unittest2
|
import unittest2
|
||||||
|
|
||||||
from neutron import context
|
from neutron import context
|
||||||
|
|
||||||
|
|
||||||
|
@@ -23,8 +23,8 @@ from neutron.openstack.common.notifier import api as notifier_api
|
|||||||
from oslo.config import cfg
|
from oslo.config import cfg
|
||||||
|
|
||||||
from quark.db import models
|
from quark.db import models
|
||||||
import quark.ipam
|
|
||||||
from quark import exceptions as q_exc
|
from quark import exceptions as q_exc
|
||||||
|
import quark.ipam
|
||||||
from quark.tests import test_base
|
from quark.tests import test_base
|
||||||
|
|
||||||
|
|
||||||
|
@@ -145,9 +145,7 @@ class TestNVPDriverCreateNetwork(TestNVPDriver):
|
|||||||
|
|
||||||
|
|
||||||
class TestNVPDriverProviderNetwork(TestNVPDriver):
|
class TestNVPDriverProviderNetwork(TestNVPDriver):
|
||||||
"""Testing all of the network types is unnecessary, but it's nice for peace
|
"""Testing all of the network types is unnecessary, but a nice have"""
|
||||||
of mind.
|
|
||||||
"""
|
|
||||||
|
|
||||||
@contextlib.contextmanager
|
@contextlib.contextmanager
|
||||||
def _stubs(self, tz):
|
def _stubs(self, tz):
|
||||||
@@ -211,7 +209,9 @@ class TestNVPDriverProviderNetwork(TestNVPDriver):
|
|||||||
zone_uuid="net_uuid", transport_type="local", vlan_id=None)
|
zone_uuid="net_uuid", transport_type="local", vlan_id=None)
|
||||||
|
|
||||||
def test_config_provider_attrs_bridge_net(self):
|
def test_config_provider_attrs_bridge_net(self):
|
||||||
"""Exists because internal driver calls can also call this method,
|
"""A specialized case for NVP
|
||||||
|
|
||||||
|
This exists because internal driver calls can also call this method,
|
||||||
and they may pass bridge in as the type as that's how it's known
|
and they may pass bridge in as the type as that's how it's known
|
||||||
to NVP.
|
to NVP.
|
||||||
"""
|
"""
|
||||||
|
@@ -97,8 +97,10 @@ class TestOptimizedNVPDriverDeleteNetwork(TestOptimizedNVPDriver):
|
|||||||
|
|
||||||
|
|
||||||
class TestOptimizedNVPDriverDeletePortMultiSwitch(TestOptimizedNVPDriver):
|
class TestOptimizedNVPDriverDeletePortMultiSwitch(TestOptimizedNVPDriver):
|
||||||
'''Need to test if ports on switch = 0 delete switch if it is not the last
|
'''Test for 0 ports on the switch, and the switch not last in network.
|
||||||
switch on the network.
|
|
||||||
|
Need to test if ports on switch = 0 and delete the switch if it is not
|
||||||
|
the last switch on the network.
|
||||||
'''
|
'''
|
||||||
|
|
||||||
@contextlib.contextmanager
|
@contextlib.contextmanager
|
||||||
@@ -137,9 +139,7 @@ class TestOptimizedNVPDriverDeletePortMultiSwitch(TestOptimizedNVPDriver):
|
|||||||
|
|
||||||
|
|
||||||
class TestOptimizedNVPDriverDeletePortSingleSwitch(TestOptimizedNVPDriver):
|
class TestOptimizedNVPDriverDeletePortSingleSwitch(TestOptimizedNVPDriver):
|
||||||
'''Need to test if ports on switch = 0 delete switch unless it is the last
|
'''If ports on switch = 0, delete switch unless last on the network'''
|
||||||
switch on the network.
|
|
||||||
'''
|
|
||||||
|
|
||||||
@contextlib.contextmanager
|
@contextlib.contextmanager
|
||||||
def _stubs(self, port_count=2):
|
def _stubs(self, port_count=2):
|
||||||
@@ -170,6 +170,7 @@ class TestOptimizedNVPDriverDeletePortSingleSwitch(TestOptimizedNVPDriver):
|
|||||||
|
|
||||||
class TestOptimizedNVPDriverCreatePort(TestOptimizedNVPDriver):
|
class TestOptimizedNVPDriverCreatePort(TestOptimizedNVPDriver):
|
||||||
'''In no case should the optimized driver query for an lswitch.'''
|
'''In no case should the optimized driver query for an lswitch.'''
|
||||||
|
|
||||||
@contextlib.contextmanager
|
@contextlib.contextmanager
|
||||||
def _stubs(self, has_lswitch=True, maxed_ports=False):
|
def _stubs(self, has_lswitch=True, maxed_ports=False):
|
||||||
with contextlib.nested(
|
with contextlib.nested(
|
||||||
@@ -433,9 +434,10 @@ class TestGetNetworkDetails(TestOptimizedNVPDriver):
|
|||||||
|
|
||||||
|
|
||||||
class TestQueryMethods(TestOptimizedNVPDriver):
|
class TestQueryMethods(TestOptimizedNVPDriver):
|
||||||
"""These tests provide coverage on the query helpers. No serious
|
"""These tests provide coverage on the query helpers.
|
||||||
assertions are made, as there's no sense in testing that sqlalchemy
|
|
||||||
does in fact do what it's supposed to do.
|
No serious assertions are made, as there's no sense in testing that
|
||||||
|
sqlalchemy does in fact do what it's supposed to do.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
@contextlib.contextmanager
|
@contextlib.contextmanager
|
||||||
|
@@ -15,10 +15,10 @@
|
|||||||
|
|
||||||
|
|
||||||
import contextlib
|
import contextlib
|
||||||
import time
|
|
||||||
import sys
|
|
||||||
|
|
||||||
import cProfile as profiler
|
import cProfile as profiler
|
||||||
|
import sys
|
||||||
|
import time
|
||||||
|
|
||||||
import gc
|
import gc
|
||||||
try:
|
try:
|
||||||
import pstats
|
import pstats
|
||||||
|
Reference in New Issue
Block a user