Merge "Switch to hacking 3.0.1"

This commit is contained in:
Zuul
2020年08月20日 00:29:07 +00:00
committed by Gerrit Code Review

View File

@@ -46,6 +46,7 @@ disable=
invalid-name,
len-as-condition,
missing-docstring,
multiple-statements,
superfluous-parens,
# "R" Refactor recommendations
abstract-class-little-used,

View File

@@ -57,20 +57,20 @@ class DeleteRouterAssociation(tables.DeleteAction):
class UpdateRouterAssociation(tables.LinkAction):
name = "update"
verbose_name = _("Update Router Association")
url = "horizon:project:bgpvpn:update-router-association"
classes = ("ajax-modal",)
icon = "pencil"
name = "update"
verbose_name = _("Update Router Association")
url = "horizon:project:bgpvpn:update-router-association"
classes = ("ajax-modal",)
icon = "pencil"
def get_link_url(self, asso):
bgpvpn_id = self.table.kwargs['bgpvpn_id']
return reverse(self.url, args=(bgpvpn_id, asso.id))
def get_link_url(self, asso):
bgpvpn_id = self.table.kwargs['bgpvpn_id']
return reverse(self.url, args=(bgpvpn_id, asso.id))
def allowed(self, request, datum=None):
if api.neutron.is_extension_supported(request,
'bgpvpn-routes-control'):
return True
def allowed(self, request, datum=None):
if api.neutron.is_extension_supported(request,
'bgpvpn-routes-control'):
return True
class CreateRouterAssociation(tables.LinkAction):

View File

@@ -20,10 +20,10 @@ from horizon import forms
from horizon import workflows
from openstack_dashboard import api
LOG = logging.getLogger(__name__)
from bgpvpn_dashboard.api import bgpvpn as bgpvpn_api
LOG = logging.getLogger(__name__)
class AddRouterParametersInfoAction(workflows.Action):

View File

@@ -15,24 +15,26 @@
from horizon.test.settings import * # noqa
from openstack_dashboard.test.settings import * # noqa
# pop these keys to avoid log warnings about deprecation
# update_dashboards will populate them anyway
HORIZON_CONFIG.pop('dashboards', None)
HORIZON_CONFIG.pop('default_dashboard', None)
import bgpvpn_dashboard.enabled
import openstack_dashboard.enabled
from openstack_dashboard.utils import settings
# pop these keys to avoid log warnings about deprecation
# update_dashboards will populate them anyway
HORIZON_CONFIG.pop('dashboards', None) # noqa: F405
HORIZON_CONFIG.pop('default_dashboard', None) # noqa: F405
settings.update_dashboards(
[
bgpvpn_dashboard.enabled,
openstack_dashboard.enabled,
],
HORIZON_CONFIG,
INSTALLED_APPS
HORIZON_CONFIG, # noqa: F405
INSTALLED_APPS # noqa: F405
)
# Ensure any duplicate apps are removed after the update_dashboards call
INSTALLED_APPS = list(set(INSTALLED_APPS))
INSTALLED_APPS = list(set(INSTALLED_APPS)) # noqa: F405

View File

@@ -141,7 +141,8 @@ def main():
print("[Done]")
if __name__ == '__main__':
main()
main()
__all__ = ['main']

View File

@@ -3,7 +3,6 @@ alembic==0.8.10
amqp==2.1.1
appdirs==1.4.3
asn1crypto==0.23.0
astroid==1.6.5
Babel==2.3.4
beautifulsoup4==4.6.0
blockdiag==1.5.3
@@ -29,12 +28,10 @@ exabgp==4.0.4
extras==1.0.0
fasteners==0.7.0
fixtures==3.0.0
flake8==2.5.5
funcparserlib==0.3.6
future==0.16.0
futurist==1.2.0
greenlet==0.4.10
hacking==0.12.0
horizon==17.1.0
httplib2==0.9.1
idna==2.6
@@ -54,7 +51,6 @@ logilab-common==1.4.1
logutils==0.3.5
Mako==0.4.0
MarkupSafe==1.0
mccabe==0.2.1
monotonic==0.6
mox3==0.20.0
msgpack-python==0.4.0
@@ -98,7 +94,6 @@ Paste==2.0.2
PasteDeploy==1.5.0
pbr==4.0.0
pecan==1.3.2
pep8==1.5.7
pika==0.10.0
pika-pool==0.1.3
Pillow==2.4.0
@@ -110,10 +105,8 @@ psycopg2==2.7.7
pyasn1==0.1.8
pycadf==1.1.0
pycparser==2.18
pyflakes==0.8.1
Pygments==2.2.0
pyinotify==0.9.6
pylint==1.9.2
pymongo==3.0.2
PyMySQL==0.7.6
pyOpenSSL==17.1.0

View File

@@ -241,7 +241,7 @@ def port_assoc_route_dict_from_db(route_db):
return route
class BGPVPNPluginDb(object):
class BGPVPNPluginDb():
"""BGPVPN service plugin database class using SQLAlchemy models."""
def __new__(cls, *args, **kwargs):
@@ -551,8 +551,8 @@ class BGPVPNPluginDb(object):
with db_api.CONTEXT_WRITER.using(context):
for route in port_association['routes']:
_add_port_assoc_route_db_from_dict(context,
route, port_assoc_db.id)
_add_port_assoc_route_db_from_dict(
context, route, port_assoc_db.id)
return self._make_port_assoc_dict(port_assoc_db)
@db_api.CONTEXT_READER

View File

@@ -13,6 +13,11 @@
# under the License.
#
from alembic import op
import sqlalchemy as sa
from sqlalchemy.engine import reflection
"""rename tenant to project
Revision ID: 010308b06b49
@@ -26,10 +31,6 @@ revision = '23ce05e0a19f'
down_revision = '180baa4183e0'
depends_on = ('0ab4049986b8',)
from alembic import op
import sqlalchemy as sa
from sqlalchemy.engine import reflection
_INSPECTOR = None

View File

@@ -14,6 +14,9 @@
# under the License.
#
from alembic import op
import sqlalchemy as sa
"""add vni to bgpvpn table
Revision ID: 39411aacf9b8
@@ -26,9 +29,6 @@ Create Date: 2017年09月19日 17:37:11.359338
revision = '39411aacf9b8'
down_revision = '9a6664f3b8d4'
from alembic import op
import sqlalchemy as sa
def upgrade():
op.add_column('bgpvpns', sa.Column('vni', sa.Integer))

View File

@@ -13,6 +13,9 @@
# under the License.
#
from alembic import op
import sqlalchemy as sa
"""Add 'extra-routes' to router association table
Revision ID: 4610803bdf0d
@@ -25,9 +28,6 @@ Create Date: 2017年06月26日 17:39:11.086696
revision = '4610803bdf0d'
down_revision = '39411aacf9b8'
from alembic import op
import sqlalchemy as sa
def upgrade():
op.add_column('bgpvpn_router_associations',

View File

@@ -13,6 +13,9 @@
# under the License.
#
from alembic import op
import sqlalchemy as sa
""" Add local_pref to bgpvpns table
Revision ID: 666c706fea3b
@@ -25,9 +28,6 @@ Create Date: 2018年01月18日 15:40:05.723129
revision = '666c706fea3b'
down_revision = '4610803bdf0d'
from alembic import op
import sqlalchemy as sa
def upgrade():
op.add_column('bgpvpns', sa.Column('local_pref',

View File

@@ -13,6 +13,9 @@
# under the License.
#
from alembic import op
import sqlalchemy as sa
"""Add tables for port associations
Revision ID: 9a6664f3b8d4
@@ -25,9 +28,6 @@ Create Date: 2017年06月26日 17:34:14.411603
revision = '9a6664f3b8d4'
down_revision = '0ab4049986b8'
from alembic import op
import sqlalchemy as sa
def upgrade():
op.create_table(

View File

@@ -13,6 +13,9 @@
# under the License.
#
from alembic import op
import sqlalchemy as sa
"""Add standard FK and constraints, and defs for existing objects
Revision ID: 9d7f1ae5fa56
@@ -26,8 +29,6 @@ revision = '9d7f1ae5fa56'
down_revision = '23ce05e0a19f'
depends_on = ('7a9482036ecd',)
from alembic import op
import sqlalchemy as sa
# adapted from b12a3ef66e62_add_standardattr_to_qos_policies.py

View File

@@ -13,6 +13,9 @@
# under the License.
#
from alembic import op
import sqlalchemy as sa
"""Add standard attributes
Revision ID: 7a9482036ecd
@@ -25,9 +28,6 @@ Create Date: 2018年04月04日 10:12:40.399032
revision = '7a9482036ecd'
down_revision = '666c706fea3b'
from alembic import op
import sqlalchemy as sa
def upgrade():
for table in ('bgpvpns', 'bgpvpn_network_associations',

View File

@@ -380,8 +380,9 @@ class BaGPipeBGPVPNDriver(v2.BaGPipeBGPVPNDriver):
self.agent_rpc.delete_bgpvpn(context, formated_bgpvpn)
def _ignore_port(self, context, port):
if (port['device_owner'].startswith(const.DEVICE_OWNER_NETWORK_PREFIX)
and not port['device_owner'] in
if (port['device_owner'].startswith(
const.DEVICE_OWNER_NETWORK_PREFIX) and not
port['device_owner'] in
(debug_agent.DEVICE_OWNER_COMPUTE_PROBE,
debug_agent.DEVICE_OWNER_NETWORK_PROBE)):
LOG.info("Port %s owner is network:*, we'll do nothing",
@@ -428,7 +429,7 @@ class BaGPipeBGPVPNDriver(v2.BaGPipeBGPVPNDriver):
pass
elif (port['status'] == const.PORT_STATUS_DOWN and
original_port['status'] != const.PORT_STATUS_DOWN):
original_port['status'] != const.PORT_STATUS_DOWN):
LOG.debug("notify_port_updated, port became DOWN")
self.agent_rpc.detach_port_from_bgpvpn(context,
port_bgpvpn_info,

View File

@@ -23,7 +23,7 @@ from networking_bgpvpn.neutron.extensions \
import bgpvpn_routes_control as bgpvpn_rc
class BGPVPNDriverBase(object, metaclass=abc.ABCMeta):
class BGPVPNDriverBase(metaclass=abc.ABCMeta):
"""BGPVPNDriver interface for driver
That driver interface does not persist BGPVPN data in any database. The

View File

@@ -127,7 +127,7 @@ def _get_bgpvpn_id(client, name_or_id):
client, BGPVPN.resource, name_or_id)
class BGPVPNAssociation(object):
class BGPVPNAssociation():
def add_known_arguments(self, parser):
parser.add_argument('bgpvpn', metavar='BGPVPN',

View File

@@ -45,11 +45,12 @@ class _TestModelsMigrationsBGPVPN(test_migrations._TestModelsMigrations):
return head.get_metadata()
def include_object(self, object_, name, type_, reflected, compare_to):
if type_ == 'table' and (name.startswith('alembic') or
name == VERSION_TABLE or
name in EXTERNAL_TABLES or
any([match in name
for match in IGNORED_TABLES_MATCH])):
if (type_ == "table" and (
name.startswith("alembic") or
name == VERSION_TABLE or
name in EXTERNAL_TABLES or
any([match in name for match in IGNORED_TABLES_MATCH])
)):
return False
if type_ == 'index' and reflected and name.startswith("idx_autoinc_"):
return False

View File

@@ -31,9 +31,9 @@ _uuid = uuidutils.generate_uuid
_get_path = test_base._get_path
BGPVPN_PREFIX = 'bgpvpn'
BGPVPN_URI = BGPVPN_PREFIX + '/' + 'bgpvpns'
BGPVPN_PLUGIN_BASE_NAME = (
bgpvpn.BGPVPNPluginBase.__module__ + '.' +
bgpvpn.BGPVPNPluginBase.__name__)
BGPVPN_PLUGIN_BASE_NAME = (bgpvpn.BGPVPNPluginBase.__module__ +
'.' +
bgpvpn.BGPVPNPluginBase.__name__)
class BgpvpnVniTestExtensionManager(object):

View File

@@ -40,11 +40,11 @@ from networking_bagpipe.objects import bgpvpn as objs
def _expected_formatted_bgpvpn(id, net_id, rt=None, gateway_mac=None):
return {'id': id,
'network_id': net_id,
'l3vpn': {'import_rt': rt or mock.ANY,
'export_rt': rt or mock.ANY},
'gateway_mac': gateway_mac or mock.ANY}
return {'id': id,
'network_id': net_id,
'l3vpn': {'import_rt': rt or mock.ANY,
'export_rt': rt or mock.ANY},
'gateway_mac': gateway_mac or mock.ANY}
class TestCorePluginWithAgents(db_base_plugin_v2.NeutronDbPluginV2,
@@ -514,6 +514,7 @@ class TestBagpipeServiceDriver(TestBagpipeCommon):
'gateway_mac': itf_port['mac_address']
}, r)
RT = '12345:1'
BGPVPN_INFO = {'mac_address': 'de:ad:00:00:be:ef',

View File

@@ -50,8 +50,8 @@ def http_client_error(req, res):
class TestBgpvpnDriverWithVni(driver_api.BGPVPNDriverRC):
more_supported_extension_aliases = (
driver_api.BGPVPNDriverRC.more_supported_extension_aliases +
[bgpvpn_vni_def.ALIAS])
driver_api.BGPVPNDriverRC.more_supported_extension_aliases + [
bgpvpn_vni_def.ALIAS])
def __init__(self, *args, **kwargs):
super(TestBgpvpnDriverWithVni, self).__init__(*args, **kwargs)
@@ -807,8 +807,7 @@ class TestBGPVPNServiceDriverDB(BgpvpnTestCaseMixin):
super(TestBGPVPNServiceDriverDB, self).setUp()
def _raise_bgpvpn_driver_precommit_exc(self, *args, **kwargs):
raise extensions.bgpvpn.BGPVPNDriverError(
method='precommit method')
raise extensions.bgpvpn.BGPVPNDriverError(method='precommit method')
@mock.patch.object(driver_api.BGPVPNDriver,
'create_bgpvpn_postcommit')

View File

@@ -2,7 +2,7 @@
# of appearance. Changing the order has an impact on the overall integration
# process, which may cause wedges in the gate later.
hacking!=0.13.0,<0.14,>=0.12.0 # Apache-2.0
hacking>=3.0.0,<3.1 # Apache-2.0
coverage!=4.4,>=4.0 # Apache-2.0
python-subunit>=1.0.0 # Apache-2.0/BSD

15
tox.ini
View File

@@ -97,12 +97,21 @@ commands = oslopolicy-sample-generator --config-file=etc/oslo-policy-generator/p
show-source = True
# E123, E125 skipped as they are invalid PEP-8.
# N530 direct neutron imports not allowed
ignore = E123,E125,N530
# W504 Line break occurred after a binary operator
ignore = E123,E125,N530,W504
builtins = _
exclude=.venv,.git,.tox,dist,doc,*lib/python*,*egg,build,tools,.tmp
[hacking]
local-check-factory = neutron_lib.hacking.checks.factory
[flake8:local-plugins]
extension =
# Checks from neutron-lib
N521 = neutron_lib.hacking.checks:use_jsonutils
N524 = neutron_lib.hacking.checks:check_no_contextlib_nested
N529 = neutron_lib.hacking.checks:no_mutable_default_args
N532 = neutron_lib.hacking.translation_checks:check_log_warn_deprecated
N534 = neutron_lib.hacking.translation_checks:check_raised_localized_exceptions
N536 = neutron_lib.hacking.checks:assert_equal_none
N537 = neutron_lib.hacking.translation_checks:no_translate_logs
[testenv:lower-constraints]
deps =
Reference in New Issue
openstack/networking-bgpvpn
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.

The note is not visible to the blocked user.