Switch to hacking 3.0.1 and to testing on focal

Make the code compatible with hacking rules:
* import order problems
* line break before/after binary operator (for this added ignore for
W504, line break after binary operator
* indentation problems

I removed the rule N530 (Direct neutron imports not allowed), as that is
a longer story.

Fix mysql syntax in tools/test-setup.sh
Fix constraints files for testing on focal

Change-Id: Iacb12d5add773404468e2b755cf95c4e6e54ec99
Depends-On: https://review.opendev.org/#/c/708965/
Depends-On: https://review.opendev.org/752416
This commit is contained in:
elajkat 2020-03-20 15:10:21 +01:00 committed by Lajos Katona
parent 8332a396b1
commit dd49e36bab
20 changed files with 275 additions and 192 deletions

View File

@ -1,9 +1,9 @@
# The order of packages is significant, because pip processes them in the order
# of appearance. Changing the order has an impact on the overall integration
# process, which may cause wedges in the gate later.
sphinx!=1.6.6,!=1.6.7,>=1.6.2 # BSD
openstackdocstheme>=1.30.0 # Apache-2.0
reno>=2.5.0 # Apache-2.0
sphinx>=2.0.0,!=2.1.0 # BSD
openstackdocstheme>=2.2.1 # Apache-2.0
reno>=3.1.0 # Apache-2.0
sphinxcontrib-blockdiag>=1.5.4 # BSD
sphinxcontrib-seqdiag>=0.8.4 # BSD

View File

@ -1,147 +1,199 @@
alabaster==0.7.10
alembic==0.9.8
amqp==2.2.2
appdirs==1.4.3
Babel==2.3.4
beautifulsoup4==4.6.0
cachetools==2.0.1
certifi==2018.1.18
cffi==1.11.5
chardet==3.0.4
cliff==2.11.0
cmd2==0.8.1
contextlib2==0.5.5
coverage==4.0
debtcollector==1.19.0
decorator==4.2.1
deprecation==2.0
docutils==0.14
dogpile.cache==0.6.5
dulwich==0.19.0
enum-compat==0.0.2
eventlet==0.20.0
alembic==1.4.2
amqp==2.6.1
appdirs==1.4.4
asn1crypto==0.23.0
Babel==2.8.0
beautifulsoup4==4.9.1
blockdiag==1.5.3
cachetools==4.1.1
cffi==1.14.2
cliff==3.4.0
cmd2==1.3.8
contextlib2==0.4.0
coverage==5.2.1
cryptography==3.1
debtcollector==1.2.0
decorator==4.4.2
deprecation==1.0
Django==2.2
django-appconf==1.0.2
django-babel==0.6.2
django-compressor==2.0
django-pyscss==2.0.2
docutils==0.11
dogpile.cache==1.0.2
eventlet==0.26.1
exabgp==4.0.4
extras==1.0.0
fasteners==0.14.1
fixtures==3.0.0
flake8==2.5.5
future==0.16.0
futurist==1.6.0
greenlet==0.4.13
hacking==0.12.0
httplib2==0.10.3
idna==2.6
imagesize==1.0.0
funcparserlib==0.3.6
future==0.18.2
futurist==2.3.0
greenlet==0.4.16
horizon==17.1.0
httplib2==0.18.1
idna==2.10
imagesize==0.7.1
iso8601==0.1.12
Jinja2==2.10
jmespath==0.9.3
jsonpatch==1.21
isort==4.3.21
Jinja2==2.11.2
jmespath==0.10.0
jsonpatch==1.26
jsonpointer==2.0
jsonschema==2.6.0
keystoneauth1==3.4.0
keystonemiddleware==4.21.0
kombu==4.1.0
jsonschema==3.2.0
keystoneauth1==4.2.1
keystonemiddleware==9.1.0
kombu==5.0.1
linecache2==1.0.0
logilab-common==1.4.1
logutils==0.3.5
Mako==1.0.7
MarkupSafe==1.0
mccabe==0.2.1
monotonic==1.4
mox3==0.25.0
msgpack-python==0.5.6
msgpack==0.5.6
munch==2.2.0
netaddr==0.7.19
netifaces==0.10.6
neutron-lib==1.25.0
neutron==14.0.0.0b3
openstacksdk==0.12.0
os-client-config==1.29.0
os-service-types==1.2.0
os-xenapi==0.3.1
osc-lib==1.10.0
oslo.cache==1.29.0
oslo.concurrency==3.26.0
oslo.config==5.2.0
oslo.context==2.20.0
oslo.db==4.35.0
oslo.i18n==3.20.0
oslo.log==3.37.0
oslo.messaging==5.36.0
oslo.middleware==3.35.0
oslo.policy==1.34.0
oslo.privsep==1.28.0
oslo.reports==1.27.0
oslo.rootwrap==5.13.0
oslo.serialization==2.25.0
oslo.service==1.30.0
oslo.utils==3.36.0
oslo.versionedobjects==1.32.0
oslosphinx==4.7.0
oslotest==3.2.0
osprofiler==2.0.0
ovs==2.8.1
ovsdbapp==0.10.0
packaging==17.1
Paste==2.0.3
PasteDeploy==1.5.2
pbr==2.0.0
pecan==1.2.1
pep8==1.5.7
pika-pool==0.1.3
Mako==1.1.3
MarkupSafe==1.1.1
mock==3.0.0
monotonic==1.5
mox3==0.20.0
msgpack-python==0.4.0
munch==2.5.0
netaddr==0.8.0
netifaces==0.10.9
neutron==16.0.0.0b1
neutron-lib==2.6.0
openstacksdk==0.49.0
os-client-config==2.1.0
os-ken==1.2.0
os-service-types==1.7.0
os-testr==1.0.0
os-traits==2.4.0
os-xenapi==0.3.4
os-vif==1.15.1
osc-lib==2.2.1
oslo.cache==2.6.1
oslo.concurrency==4.3.0
oslo.config==8.3.2
oslo.context==3.1.1
oslo.db==8.4.0
oslo.i18n==5.0.1
oslo.log==4.4.0
oslo.messaging==12.5.0
oslo.middleware==4.1.1
oslo.policy==3.5.0
oslo.privsep==2.4.0
oslo.reports==2.2.0
oslo.rootwrap==6.2.0
oslo.serialization==4.0.1
oslo.service==2.4.0
oslo.upgradecheck==1.1.1
oslo.utils==4.6.0
oslo.versionedobjects==2.3.0
oslotest==4.4.1
osprofiler==3.4.0
ovs==2.13.0
ovsdbapp==1.5.0
packaging==20.4
paramiko==2.7.2
Paste==3.4.3
PasteDeploy==2.1.0
pbr==5.5.0
pecan==1.3.3
pika==0.10.0
pika-pool==0.1.3
Pillow==2.4.0
Pint==0.5
positional==1.2.1
prettytable==0.7.2
psutil==5.4.3
psycopg2==2.7.5
pycadf==2.7.0
pycparser==2.18
pyflakes==0.8.1
Pygments==2.2.0
psutil==5.7.2
psycopg2==2.8.5
pycadf==3.1.1
pycodestyle==2.5.0
pycparser==2.20
pyflakes==2.1.1
pyinotify==0.9.6
PyMySQL==0.7.6
pyparsing==2.2.0
pyperclip==1.6.0
pyroute2==0.4.21
python-dateutil==2.7.0
python-designateclient==2.9.0
python-editor==1.0.3
python-keystoneclient==3.15.0
pylint==2.2.0
PyMySQL==0.10.0
pyOpenSSL==19.1.0
pyparsing==2.4.7
pyperclip==1.8.0
pyroute2==0.5.14
pyScss==1.3.7
pytest==5.3.5
python-cinderclient==5.0.0
python-dateutil==2.5.3
python-designateclient==4.1.0
python-editor==1.0.4
python-glanceclient==2.8.0
python-keystoneclient==4.1.1
python-mimeparse==1.6.0
python-neutronclient==6.7.0
python-novaclient==10.1.0
python-subunit==1.0.0
pytz==2018.3
PyYAML==3.12
reno==2.5.0
python-neutronclient==7.2.1
python-novaclient==17.2.1
python-subunit==1.4.0
python-swiftclient==3.2.0
pytz==2020.1
PyYAML==5.3.1
rcssmin==1.0.6
repoze.lru==0.7
requests==2.18.4
requests==2.23.0
requestsexceptions==1.4.0
rfc3986==1.1.0
rfc3986==1.4.0
rjsmin==1.0.12
Routes==2.4.1
ryu==4.23
simplejson==3.13.2
six==1.11.0
ryu==4.24
semantic-version==2.3.1
seqdiag==0.9.5
simplejson==3.17.2
snowballstemmer==1.2.1
Sphinx==1.6.2
sphinxcontrib-websupport==1.0.1
sqlalchemy-migrate==0.11.0
SQLAlchemy==1.2.5
sqlparse==0.2.4
statsd==3.2.2
stestr==1.0.0
stevedore==1.28.0
Sphinx==2.0.0
SQLAlchemy==1.3.19
sqlalchemy-migrate==0.13.0
sqlparse==0.3.1
statsd==3.3.0
stestr==3.0.1
stevedore==3.2.2
tempest==17.1.0
Tempita==0.5.2
tenacity==4.9.0
testrepository==0.0.20
testresources==2.0.0
testscenarios==0.4
testtools==2.2.0
tinyrpc==0.8
tenacity==6.2.0
testrepository==0.0.18
testresources==2.0.1
testscenarios==0.5.0
testtools==2.4.0
tinyrpc==1.0.4
tooz==2.7.1
traceback2==1.4.0
unittest2==1.1.0
urllib3==1.22
vine==1.1.4
voluptuous==0.11.1
waitress==1.1.0
WebOb==1.7.4
WebTest==2.0.29
wrapt==1.10.11
urllib3==1.25.10
vine==1.3.0
waitress==1.4.4
warlock==1.2.0
webcolors==1.7
WebOb==1.8.6
websocket-client==0.40.0
WebTest==2.0.35
wrapt==1.12.1
XStatic==1.0.0
XStatic-Angular==1.5.8.0
XStatic-Angular-Bootstrap==2.2.0.0
XStatic-Angular-FileUpload==12.0.4.0
XStatic-Angular-Gettext==2.3.8.0
XStatic-Angular-lrdragndrop==1.0.2.2
XStatic-Angular-Schema-Form==0.8.13.0
XStatic-Bootstrap-Datepicker==1.3.1.0
XStatic-Bootstrap-SCSS==3.3.7.1
XStatic-bootswatch==3.3.7.0
XStatic-D3==3.5.17.0
XStatic-Font-Awesome==4.7.0.0
XStatic-Hogan==2.0.0.2
XStatic-Jasmine==2.4.1.1
XStatic-jQuery==1.8.2.1
XStatic-JQuery-Migrate==1.2.1.1
XStatic-jquery-ui==1.10.4.1
XStatic-JQuery.quicksearch==2.0.3.1
XStatic-JQuery.TableSorter==2.14.5.1
XStatic-JSEncrypt==2.3.1.1
XStatic-mdi==1.4.57.0
XStatic-objectpath==1.2.1.0
XStatic-Rickshaw==1.5.0.0
XStatic-roboto-fontface==0.5.0.0
XStatic-smart-table==1.4.13.2
XStatic-Spin==1.2.5.2
XStatic-term.js==0.0.7.0
XStatic-tv4==1.2.7.0

View File

@ -13,6 +13,9 @@
# License for the specific language governing permissions and limitations
# under the License.
from alembic import op
"""Remove network-id from tap-service
Revision ID: 1817af933379
@ -25,8 +28,6 @@ Create Date: 2016-04-05 21:59:28.829793
revision = '1817af933379'
down_revision = '80c85b675b6e'
from alembic import op
def upgrade():
op.drop_column('tap_services', 'network_id')

View File

@ -12,6 +12,9 @@
# See the License for the specific language governing permissions and
# limitations under the License.
from alembic import op
"""add foreign key constraint on tap id association
Revision ID: 2ecce0368a62
@ -24,8 +27,6 @@ Create Date: 2016-05-19 11:39:52.892610
revision = '2ecce0368a62'
down_revision = '1817af933379'
from alembic import op
def upgrade():
op.create_foreign_key(

View File

@ -13,6 +13,13 @@
# under the License.
#
from alembic import op
import sqlalchemy as sa
from sqlalchemy.engine import reflection
from neutron.db import migration
"""rename tenant to project
Revision ID: 4086b3cffc01
@ -25,12 +32,6 @@ Create Date: 2016-07-30 22:09:16.372917
revision = '4086b3cffc01'
down_revision = '2ecce0368a62'
from alembic import op
import sqlalchemy as sa
from sqlalchemy.engine import reflection
from neutron.db import migration
_INSPECTOR = None

View File

@ -12,6 +12,9 @@
# License for the specific language governing permissions and limitations
# under the License.
from neutron.db.migration import cli
"""initial Newton no op contract script
Revision ID: 80c85b675b6e
@ -20,7 +23,6 @@ Create Date: 2016-05-06 04:58:04.510568
"""
from neutron.db.migration import cli
# revision identifiers, used by Alembic.
revision = '80c85b675b6e'

View File

@ -12,6 +12,9 @@
# License for the specific language governing permissions and limitations
# under the License.
from neutron.db.migration import cli
"""initial Newton no op expand script
Revision ID: 04625466c6fa
@ -20,7 +23,6 @@ Create Date: 2016-05-06 05:17:30.172181
"""
from neutron.db.migration import cli
# revision identifiers, used by Alembic.
revision = '04625466c6fa'

View File

@ -12,6 +12,12 @@
# License for the specific language governing permissions and limitations
# under the License.
from alembic import op
from neutron.db import migration
from neutron_lib import constants
import sqlalchemy as sa
"""add status
Revision ID: fddbdec8711a
@ -24,11 +30,6 @@ Create Date: 2016-06-06 10:54:42.252898
revision = 'fddbdec8711a'
down_revision = '04625466c6fa'
from alembic import op
from neutron.db import migration
from neutron_lib import constants
import sqlalchemy as sa
# milestone identifier, used by neutron-db-manage
neutron_milestone = [

View File

@ -12,6 +12,13 @@
# See the License for the specific language governing permissions and
# limitations under the License.
from alembic import op
from sqlalchemy.engine import reflection
import sqlalchemy as sa
from neutron.db import migration
"""Alter TapIdAssociations to support tap id reuse
Revision ID: bac61f603e39
@ -24,13 +31,6 @@ Create Date: 2016-07-27 09:31:54.200165
revision = 'bac61f603e39'
down_revision = '4086b3cffc01'
from alembic import op
from sqlalchemy.engine import reflection
import sqlalchemy as sa
from neutron.db import migration
# milestone identifier, used by neutron-db-manage
neutron_milestone = [

View File

@ -12,6 +12,9 @@
# See the License for the specific language governing permissions and
# limitations under the License.
from neutron_taas.db.migration import taas_init_ops
"""start neutron-taas chain
Revision ID: start_neutron_taas
@ -25,8 +28,5 @@ revision = 'start_neutron_taas'
down_revision = None
from neutron_taas.db.migration import taas_init_ops
def upgrade():
taas_init_ops.upgrade()

View File

@ -12,6 +12,12 @@
# License for the specific language governing permissions and limitations
# under the License.
from alembic import op
import sqlalchemy as sa
from neutron.db import migration
"""add_vlan_filter_to_tap_flow
Revision ID: ccbcc559d175
@ -24,11 +30,6 @@ Create Date: 2018-09-18 19:33:32.119458
revision = 'ccbcc559d175'
down_revision = 'fddbdec8711a'
from alembic import op
import sqlalchemy as sa
from neutron.db import migration
# milestone identifier, used by neutron-db-manage
neutron_milestone = [migration.STEIN]

View File

@ -448,8 +448,8 @@ class OvsTaasDriver(taas_base.TaasAgentDriver):
def _create_ingress_bcmc_flow_action(self, taas_id_list, out_port_id):
flow_action = "normal"
for taas_id in taas_id_list:
flow_action += (",mod_vlan_vid:%d,output:%d" %
(taas_id, out_port_id))
flow_action += (",mod_vlan_vid:%d,output:%d" %
(taas_id, out_port_id))
return flow_action

View File

@ -180,7 +180,7 @@ class SriovNicUtils(object):
A VF is associated with an VF number, which ip link command uses to
configure it. This can be obtained from the PCI device filesystem.
"""
VIRTFN_RE = re.compile("virtfn(\d+)")
VIRTFN_RE = re.compile(r"virtfn(\d+)")
virtfns_path = "/sys/bus/pci/devices/%s/physfn/virtfn*" % (pci_addr)
vf_num = None
LOG.debug("TaaS: pci_addr: %(pci_addr)s "

View File

@ -458,8 +458,8 @@ class NetworkScenarioTest(ScenarioTest):
port_map = [(p["id"], fxip["ip_address"])
for p in ports
for fxip in p["fixed_ips"]
if netutils.is_valid_ipv4(fxip["ip_address"])
and p['status'] in p_status]
if netutils.is_valid_ipv4(fxip["ip_address"]) and
p['status'] in p_status]
inactive = [p for p in ports if p['status'] != 'ACTIVE']
if inactive:
LOG.warning("Instance has ports that are not ACTIVE: %s", inactive)

View File

@ -255,7 +255,8 @@ class TestTaasPlugin(testlib_api.SqlTestCase):
def test_create_tap_flow_wrong_tenant_id(self):
with self.tap_service() as ts, \
testtools.ExpectedException(taas_ext.TapServiceNotBelongToTenant), \
testtools.ExpectedException(
taas_ext.TapServiceNotBelongToTenant), \
self.tap_flow(tap_service=ts['id'], tenant_id='other-tenant'):
pass

View File

@ -10,7 +10,10 @@
# implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
import pbr.version
# tap-as-a-service documentation build configuration file, created by
# sphinx-quickstart on Sun May 8 12:21:42 2016.
#
@ -65,7 +68,6 @@ author = u'Tap-as-a-service developers'
# built documents.
#
# The short X.Y version.
import pbr.version
version_info = pbr.version.VersionInfo('tap-as-a-service')
version = version_info.version_string_with_vcs()
# The full version, including alpha/beta/rc tags.

View File

@ -2,10 +2,10 @@
# of appearance. Changing the order has an impact on the overall integration
# process, which may cause wedges in the gate later.
pbr!=2.1.0,>=2.0.0 # Apache-2.0
Babel!=2.4.0,>=2.3.4 # BSD
neutron>=12.0.0 # Apache-2.0
neutron-lib>=1.25.0 # Apache-2.0
pbr>=5.5.0 # Apache-2.0
Babel>=2.8.0 # BSD
neutron>=16.0.0 # Apache-2.0
neutron-lib>=2.6.0 # Apache-2.0
# Opt-in for neutron-lib consumption patches
# http://lists.openstack.org/pipermail/openstack-dev/2018-September/135063.html

View File

@ -2,15 +2,21 @@
# 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
psycopg2>=2.7.5 # LGPL/ZPL
PyMySQL>=0.7.6 # MIT License
oslotest>=3.2.0 # Apache-2.0
reno>=2.5.0 # Apache-2.0
stestr>=1.0.0 # Apache-2.0
testresources>=2.0.0 # Apache-2.0/BSD
testscenarios>=0.4 # Apache-2.0/BSD
testtools>=2.2.0 # MIT
coverage>=5.2.1 # Apache-2.0
python-subunit>=1.4.0 # Apache-2.0/BSD
psycopg2>=2.8.5 # LGPL/ZPL
PyMySQL>=0.10.0 # MIT License
oslotest>=4.4.1 # Apache-2.0
stestr>=3.0.1 # Apache-2.0
testresources>=2.0.1 # Apache-2.0/BSD
testscenarios>=0.5.0 # Apache-2.0/BSD
testtools>=2.4.0 # MIT
# This is necessary as in lower-constraints job neutron
# imports it
mock>=3.0.0 # BSD
astroid==2.1.0 # LGPLv2.1
pylint==2.2.0 # GPLv2
isort==4.3.21 # MIT

View File

@ -22,9 +22,11 @@ sudo -H mysqladmin -u root password $DB_ROOT_PW
# other connections from that host will not work.
sudo -H mysql -u root -p$DB_ROOT_PW -h localhost -e "
DELETE FROM mysql.user WHERE User='';
FLUSH PRIVILEGES;
GRANT ALL PRIVILEGES ON *.*
TO '$DB_USER'@'%' identified by '$DB_PW' WITH GRANT OPTION;"
CREATE USER '$DB_USER'@'localhost' IDENTIFIED BY '$DB_PW';
CREATE USER '$DB_USER' IDENTIFIED BY '$DB_PW';
GRANT ALL PRIVILEGES ON *.* TO '$DB_USER'@'localhost';
GRANT ALL PRIVILEGES ON *.* TO '$DB_USER';
FLUSH PRIVILEGES;"
# Now create our database.
mysql -u $DB_USER -p$DB_PW -h 127.0.0.1 -e "

15
tox.ini
View File

@ -61,12 +61,23 @@ commands = oslo_debug_helper {posargs}
[flake8]
# E123, E125 skipped as they are invalid PEP-8.
# W504 Line break occurred after a binary operator
show-source = True
ignore = E123,E125
ignore = E123,E125,W504
builtins = _
exclude=.venv,.git,.tox,dist,doc,*openstack/common*,*lib/python*,*egg,build
[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
[hacking]
import_exceptions = neutron_taas._i18n