From dc99cadceeff327ec5decd9430079a948f78e86c Mon Sep 17 00:00:00 2001 From: armando-migliaccio Date: Mon, 12 Jan 2015 14:33:40 -0800 Subject: [PATCH] Establish a successful baseline for CI jobs Tweaks involved renaming the odl module to avoid dashes. Also, a copy of the policy.json file was needed to get existing tests to pass. Something smarter will have to be devised to avoid holding a copy of a file that ultimately belongs to Neutron core. Missing doc files were also added. Lastly, prune the requirements to use only the ones that are stricly required. Change-Id: I8addb54d519ce1ab4398d32eee1bebf87c5e37b6 --- .gitignore | 4 +- .testr.conf | 5 +- CONTRIBUTING.rst | 2 +- doc/source/conf.py | 75 +++++++++ doc/source/contributing.rst | 4 + doc/source/index.rst | 25 +++ doc/source/installation.rst | 12 ++ doc/source/readme.rst | 1 + doc/source/usage.rst | 7 + etc/policy.json | 143 ++++++++++++++++++ .../__init__.py | 2 +- .../openstack/__init__.py | 0 .../openstack/common/__init__.py | 0 .../openstack/common/_i18n.py | 4 +- .../openstack/common/cache/__init__.py | 0 .../openstack/common/cache/backends.py | 0 .../openstack/common/cache/cache.py | 6 +- .../openstack/common/context.py | 0 .../openstack/common/eventlet_backdoor.py | 4 +- .../openstack/common/fileutils.py | 0 .../openstack/common/fixture/__init__.py | 0 .../openstack/common/fixture/logging.py | 0 .../openstack/common/local.py | 0 .../openstack/common/log.py | 4 +- .../openstack/common/loopingcall.py | 4 +- .../openstack/common/middleware/__init__.py | 0 .../common/middleware/catch_errors.py | 2 +- .../openstack/common/middleware/request_id.py | 2 +- .../openstack/common/periodic_task.py | 4 +- .../openstack/common/policy.py | 6 +- .../openstack/common/service.py | 10 +- .../openstack/common/systemd.py | 2 +- .../openstack/common/threadgroup.py | 4 +- .../openstack/common/uuidutils.py | 0 .../openstack/common/versionutils.py | 6 +- .../plugins/ml2/__init__.py | 0 .../plugins/ml2/drivers/README.odl | 0 .../plugins/ml2/drivers/__init__.py | 0 .../plugins/ml2/drivers/mechanism_odl.py | 0 .../tests/__init__.py | 0 .../tests/unit/__init__.py | 0 .../tests/unit/db/__init__.py | 0 .../tests/unit/ml2/__init__.py | 0 .../tests/unit/ml2/test_mechanism_odl.py | 0 openstack-common.conf | 2 +- requirements.txt | 34 +---- setup.cfg | 10 +- test-requirements.txt | 17 +-- tox.ini | 77 ++-------- 49 files changed, 334 insertions(+), 144 deletions(-) create mode 100755 doc/source/conf.py create mode 100644 doc/source/contributing.rst create mode 100644 doc/source/index.rst create mode 100644 doc/source/installation.rst create mode 100644 doc/source/readme.rst create mode 100644 doc/source/usage.rst create mode 100644 etc/policy.json rename {networking-odl => networking_odl}/__init__.py (93%) rename {networking-odl => networking_odl}/openstack/__init__.py (100%) rename {networking-odl => networking_odl}/openstack/common/__init__.py (100%) rename {networking-odl => networking_odl}/openstack/common/_i18n.py (95%) rename {networking-odl => networking_odl}/openstack/common/cache/__init__.py (100%) rename {networking-odl => networking_odl}/openstack/common/cache/backends.py (100%) rename {networking-odl => networking_odl}/openstack/common/cache/cache.py (93%) rename {networking-odl => networking_odl}/openstack/common/context.py (100%) rename {networking-odl => networking_odl}/openstack/common/eventlet_backdoor.py (97%) rename {networking-odl => networking_odl}/openstack/common/fileutils.py (100%) rename {networking-odl => networking_odl}/openstack/common/fixture/__init__.py (100%) rename {networking-odl => networking_odl}/openstack/common/fixture/logging.py (100%) rename {networking-odl => networking_odl}/openstack/common/local.py (100%) rename {networking-odl => networking_odl}/openstack/common/log.py (99%) rename {networking-odl => networking_odl}/openstack/common/loopingcall.py (97%) rename {networking-odl => networking_odl}/openstack/common/middleware/__init__.py (100%) rename {networking-odl => networking_odl}/openstack/common/middleware/catch_errors.py (93%) rename {networking-odl => networking_odl}/openstack/common/middleware/request_id.py (94%) rename {networking-odl => networking_odl}/openstack/common/periodic_task.py (98%) rename {networking-odl => networking_odl}/openstack/common/policy.py (99%) rename {networking-odl => networking_odl}/openstack/common/service.py (98%) rename {networking-odl => networking_odl}/openstack/common/systemd.py (98%) rename {networking-odl => networking_odl}/openstack/common/threadgroup.py (97%) rename {networking-odl => networking_odl}/openstack/common/uuidutils.py (100%) rename {networking-odl => networking_odl}/openstack/common/versionutils.py (97%) rename {networking-odl => networking_odl}/plugins/ml2/__init__.py (100%) rename {networking-odl => networking_odl}/plugins/ml2/drivers/README.odl (100%) rename {networking-odl => networking_odl}/plugins/ml2/drivers/__init__.py (100%) rename {networking-odl => networking_odl}/plugins/ml2/drivers/mechanism_odl.py (100%) rename {networking-odl => networking_odl}/tests/__init__.py (100%) rename {networking-odl => networking_odl}/tests/unit/__init__.py (100%) rename {networking-odl => networking_odl}/tests/unit/db/__init__.py (100%) rename {networking-odl => networking_odl}/tests/unit/ml2/__init__.py (100%) rename {networking-odl => networking_odl}/tests/unit/ml2/test_mechanism_odl.py (100%) diff --git a/.gitignore b/.gitignore index af0db9e33..4f3cc8c65 100644 --- a/.gitignore +++ b/.gitignore @@ -9,8 +9,8 @@ doc/build *.DS_Store *.pyc networking_odl.egg-info/ -networking-odl/vcsversion.py -networking-odl/versioninfo +networking_odl/vcsversion.py +networking_odl/versioninfo pbr*.egg/ quantum.egg-info/ quantum/vcsversion.py diff --git a/.testr.conf b/.testr.conf index e28753cb1..6d83b3c4e 100644 --- a/.testr.conf +++ b/.testr.conf @@ -1,4 +1,7 @@ [DEFAULT] -test_command=OS_STDOUT_CAPTURE=1 OS_STDERR_CAPTURE=1 OS_LOG_CAPTURE=1 ${PYTHON:-python} -m subunit.run discover -t ./ ${OS_TEST_PATH:-./networking-odl/tests/unit} $LISTOPT $IDOPTION +test_command=OS_STDOUT_CAPTURE=${OS_STDOUT_CAPTURE:-1} \ + OS_STDERR_CAPTURE=${OS_STDERR_CAPTURE:-1} \ + OS_TEST_TIMEOUT=${OS_TEST_TIMEOUT:-60} \ + ${PYTHON:-python} -m subunit.run discover -t ./ . $LISTOPT $IDOPTION test_id_option=--load-list $IDFILE test_list_option=--list diff --git a/CONTRIBUTING.rst b/CONTRIBUTING.rst index 7f62f3f6f..3d2d39eac 100644 --- a/CONTRIBUTING.rst +++ b/CONTRIBUTING.rst @@ -13,4 +13,4 @@ Pull requests submitted through GitHub will be ignored. Bugs should be filed on Launchpad, not GitHub: - https://bugs.launchpad.net/neutron + https://bugs.launchpad.net/neutron-odl diff --git a/doc/source/conf.py b/doc/source/conf.py new file mode 100755 index 000000000..309859fbc --- /dev/null +++ b/doc/source/conf.py @@ -0,0 +1,75 @@ +# -*- coding: utf-8 -*- +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +# implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import os +import sys + +sys.path.insert(0, os.path.abspath('../..')) +# -- General configuration ---------------------------------------------------- + +# Add any Sphinx extension module names here, as strings. They can be +# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom ones. +extensions = [ + 'sphinx.ext.autodoc', + #'sphinx.ext.intersphinx', + 'oslosphinx' +] + +# autodoc generation is a bit aggressive and a nuisance when doing heavy +# text edit cycles. +# execute "export SPHINX_DEBUG=1" in your terminal to disable + +# The suffix of source filenames. +source_suffix = '.rst' + +# The master toctree document. +master_doc = 'index' + +# General information about the project. +project = u'networking-odl' +copyright = u'2013, OpenStack Foundation' + +# If true, '()' will be appended to :func: etc. cross-reference text. +add_function_parentheses = True + +# If true, the current module name will be prepended to all description +# unit titles (such as .. function::). +add_module_names = True + +# The name of the Pygments (syntax highlighting) style to use. +pygments_style = 'sphinx' + +# -- Options for HTML output -------------------------------------------------- + +# The theme to use for HTML and HTML Help pages. Major themes that come with +# Sphinx are currently 'default' and 'sphinxdoc'. +# html_theme_path = ["."] +# html_theme = '_theme' +# html_static_path = ['static'] + +# Output file base name for HTML help builder. +htmlhelp_basename = '%sdoc' % project + +# Grouping the document tree into LaTeX files. List of tuples +# (source start file, target name, title, author, documentclass +# [howto/manual]). +latex_documents = [ + ('index', + '%s.tex' % project, + u'%s Documentation' % project, + u'OpenStack Foundation', 'manual'), +] + +# Example configuration for intersphinx: refer to the Python standard library. +#intersphinx_mapping = {'http://docs.python.org/': None} diff --git a/doc/source/contributing.rst b/doc/source/contributing.rst new file mode 100644 index 000000000..1728a61ca --- /dev/null +++ b/doc/source/contributing.rst @@ -0,0 +1,4 @@ +============ +Contributing +============ +.. include:: ../../CONTRIBUTING.rst diff --git a/doc/source/index.rst b/doc/source/index.rst new file mode 100644 index 000000000..b606e069c --- /dev/null +++ b/doc/source/index.rst @@ -0,0 +1,25 @@ +.. networking-odl documentation master file, created by + sphinx-quickstart on Tue Jul 9 22:26:36 2013. + You can adapt this file completely to your liking, but it should at least + contain the root `toctree` directive. + +Welcome to networking-odl's documentation! +======================================================== + +Contents: + +.. toctree:: + :maxdepth: 2 + + readme + installation + usage + contributing + +Indices and tables +================== + +* :ref:`genindex` +* :ref:`modindex` +* :ref:`search` + diff --git a/doc/source/installation.rst b/doc/source/installation.rst new file mode 100644 index 000000000..29c6e4590 --- /dev/null +++ b/doc/source/installation.rst @@ -0,0 +1,12 @@ +============ +Installation +============ + +At the command line:: + + $ pip install networking-odl + +Or, if you have virtualenvwrapper installed:: + + $ mkvirtualenv networking-odl + $ pip install networking-odl diff --git a/doc/source/readme.rst b/doc/source/readme.rst new file mode 100644 index 000000000..a6210d3d8 --- /dev/null +++ b/doc/source/readme.rst @@ -0,0 +1 @@ +.. include:: ../../README.rst diff --git a/doc/source/usage.rst b/doc/source/usage.rst new file mode 100644 index 000000000..003ed666d --- /dev/null +++ b/doc/source/usage.rst @@ -0,0 +1,7 @@ +======== +Usage +======== + +To use networking-odl in a project:: + + import networking_odl diff --git a/etc/policy.json b/etc/policy.json new file mode 100644 index 000000000..4c7f00368 --- /dev/null +++ b/etc/policy.json @@ -0,0 +1,143 @@ +{ + "context_is_admin": "role:admin", + "admin_or_owner": "rule:context_is_admin or tenant_id:%(tenant_id)s", + "context_is_advsvc": "role:advsvc", + "admin_or_network_owner": "rule:context_is_admin or tenant_id:%(network:tenant_id)s", + "admin_only": "rule:context_is_admin", + "regular_user": "", + "shared": "field:networks:shared=True", + "shared_firewalls": "field:firewalls:shared=True", + "external": "field:networks:router:external=True", + "default": "rule:admin_or_owner", + + "create_subnet": "rule:admin_or_network_owner", + "get_subnet": "rule:admin_or_owner or rule:shared", + "update_subnet": "rule:admin_or_network_owner", + "delete_subnet": "rule:admin_or_network_owner", + + "create_network": "", + "get_network": "rule:admin_or_owner or rule:shared or rule:external or rule:context_is_advsvc", + "get_network:router:external": "rule:regular_user", + "get_network:segments": "rule:admin_only", + "get_network:provider:network_type": "rule:admin_only", + "get_network:provider:physical_network": "rule:admin_only", + "get_network:provider:segmentation_id": "rule:admin_only", + "get_network:queue_id": "rule:admin_only", + "create_network:shared": "rule:admin_only", + "create_network:router:external": "rule:admin_only", + "create_network:segments": "rule:admin_only", + "create_network:provider:network_type": "rule:admin_only", + "create_network:provider:physical_network": "rule:admin_only", + "create_network:provider:segmentation_id": "rule:admin_only", + "update_network": "rule:admin_or_owner", + "update_network:segments": "rule:admin_only", + "update_network:shared": "rule:admin_only", + "update_network:provider:network_type": "rule:admin_only", + "update_network:provider:physical_network": "rule:admin_only", + "update_network:provider:segmentation_id": "rule:admin_only", + "update_network:router:external": "rule:admin_only", + "delete_network": "rule:admin_or_owner", + + "create_port": "", + "create_port:mac_address": "rule:admin_or_network_owner or rule:context_is_advsvc", + "create_port:fixed_ips": "rule:admin_or_network_owner or rule:context_is_advsvc", + "create_port:port_security_enabled": "rule:admin_or_network_owner or rule:context_is_advsvc", + "create_port:binding:host_id": "rule:admin_only", + "create_port:binding:profile": "rule:admin_only", + "create_port:mac_learning_enabled": "rule:admin_or_network_owner or rule:context_is_advsvc", + "get_port": "rule:admin_or_owner or rule:context_is_advsvc", + "get_port:queue_id": "rule:admin_only", + "get_port:binding:vif_type": "rule:admin_only", + "get_port:binding:vif_details": "rule:admin_only", + "get_port:binding:host_id": "rule:admin_only", + "get_port:binding:profile": "rule:admin_only", + "update_port": "rule:admin_or_owner or rule:context_is_advsvc", + "update_port:fixed_ips": "rule:admin_or_network_owner or rule:context_is_advsvc", + "update_port:port_security_enabled": "rule:admin_or_network_owner or rule:context_is_advsvc", + "update_port:binding:host_id": "rule:admin_only", + "update_port:binding:profile": "rule:admin_only", + "update_port:mac_learning_enabled": "rule:admin_or_network_owner or rule:context_is_advsvc", + "delete_port": "rule:admin_or_owner or rule:context_is_advsvc", + + "get_router:ha": "rule:admin_only", + "create_router": "rule:regular_user", + "create_router:external_gateway_info:enable_snat": "rule:admin_only", + "create_router:distributed": "rule:admin_only", + "create_router:ha": "rule:admin_only", + "get_router": "rule:admin_or_owner", + "get_router:distributed": "rule:admin_only", + "update_router:external_gateway_info:enable_snat": "rule:admin_only", + "update_router:distributed": "rule:admin_only", + "update_router:ha": "rule:admin_only", + "delete_router": "rule:admin_or_owner", + + "add_router_interface": "rule:admin_or_owner", + "remove_router_interface": "rule:admin_or_owner", + + "create_router:external_gateway_info:external_fixed_ips": "rule:admin_only", + "update_router:external_gateway_info:external_fixed_ips": "rule:admin_only", + + "create_firewall": "", + "get_firewall": "rule:admin_or_owner", + "create_firewall:shared": "rule:admin_only", + "get_firewall:shared": "rule:admin_only", + "update_firewall": "rule:admin_or_owner", + "update_firewall:shared": "rule:admin_only", + "delete_firewall": "rule:admin_or_owner", + + "create_firewall_policy": "", + "get_firewall_policy": "rule:admin_or_owner or rule:shared_firewalls", + "create_firewall_policy:shared": "rule:admin_or_owner", + "update_firewall_policy": "rule:admin_or_owner", + "delete_firewall_policy": "rule:admin_or_owner", + + "create_firewall_rule": "", + "get_firewall_rule": "rule:admin_or_owner or rule:shared_firewalls", + "update_firewall_rule": "rule:admin_or_owner", + "delete_firewall_rule": "rule:admin_or_owner", + + "create_qos_queue": "rule:admin_only", + "get_qos_queue": "rule:admin_only", + + "update_agent": "rule:admin_only", + "delete_agent": "rule:admin_only", + "get_agent": "rule:admin_only", + + "create_dhcp-network": "rule:admin_only", + "delete_dhcp-network": "rule:admin_only", + "get_dhcp-networks": "rule:admin_only", + "create_l3-router": "rule:admin_only", + "delete_l3-router": "rule:admin_only", + "get_l3-routers": "rule:admin_only", + "get_dhcp-agents": "rule:admin_only", + "get_l3-agents": "rule:admin_only", + "get_loadbalancer-agent": "rule:admin_only", + "get_loadbalancer-pools": "rule:admin_only", + + "create_floatingip": "rule:regular_user", + "create_floatingip:floating_ip_address": "rule:admin_only", + "update_floatingip": "rule:admin_or_owner", + "delete_floatingip": "rule:admin_or_owner", + "get_floatingip": "rule:admin_or_owner", + + "create_network_profile": "rule:admin_only", + "update_network_profile": "rule:admin_only", + "delete_network_profile": "rule:admin_only", + "get_network_profiles": "", + "get_network_profile": "", + "update_policy_profiles": "rule:admin_only", + "get_policy_profiles": "", + "get_policy_profile": "", + + "create_metering_label": "rule:admin_only", + "delete_metering_label": "rule:admin_only", + "get_metering_label": "rule:admin_only", + + "create_metering_label_rule": "rule:admin_only", + "delete_metering_label_rule": "rule:admin_only", + "get_metering_label_rule": "rule:admin_only", + + "get_service_provider": "rule:regular_user", + "get_lsn": "rule:admin_only", + "create_lsn": "rule:admin_only" +} diff --git a/networking-odl/__init__.py b/networking_odl/__init__.py similarity index 93% rename from networking-odl/__init__.py rename to networking_odl/__init__.py index ea6bee208..dd20cd524 100644 --- a/networking-odl/__init__.py +++ b/networking_odl/__init__.py @@ -16,4 +16,4 @@ import gettext -gettext.install('networking-odl', unicode=1) +gettext.install('networking_odl', unicode=1) diff --git a/networking-odl/openstack/__init__.py b/networking_odl/openstack/__init__.py similarity index 100% rename from networking-odl/openstack/__init__.py rename to networking_odl/openstack/__init__.py diff --git a/networking-odl/openstack/common/__init__.py b/networking_odl/openstack/common/__init__.py similarity index 100% rename from networking-odl/openstack/common/__init__.py rename to networking_odl/openstack/common/__init__.py diff --git a/networking-odl/openstack/common/_i18n.py b/networking_odl/openstack/common/_i18n.py similarity index 95% rename from networking-odl/openstack/common/_i18n.py rename to networking_odl/openstack/common/_i18n.py index 79ab5a042..e0652c0cf 100644 --- a/networking-odl/openstack/common/_i18n.py +++ b/networking_odl/openstack/common/_i18n.py @@ -24,7 +24,7 @@ try: # repository. It is OK to have more than one translation function # using the same domain, since there will still only be one message # catalog. - _translators = oslo.i18n.TranslatorFactory(domain='networking-odl') + _translators = oslo.i18n.TranslatorFactory(domain='networking_odl') # The primary translation function using the well-known name "_" _ = _translators.primary @@ -40,6 +40,6 @@ try: _LC = _translators.log_critical except ImportError: # NOTE(dims): Support for cases where a project wants to use - # code from networking-odl-incubator, but is not ready to be internationalized + # code from networking_odl-incubator, but is not ready to be internationalized # (like tempest) _ = _LI = _LW = _LE = _LC = lambda x: x diff --git a/networking-odl/openstack/common/cache/__init__.py b/networking_odl/openstack/common/cache/__init__.py similarity index 100% rename from networking-odl/openstack/common/cache/__init__.py rename to networking_odl/openstack/common/cache/__init__.py diff --git a/networking-odl/openstack/common/cache/backends.py b/networking_odl/openstack/common/cache/backends.py similarity index 100% rename from networking-odl/openstack/common/cache/backends.py rename to networking_odl/openstack/common/cache/backends.py diff --git a/networking-odl/openstack/common/cache/cache.py b/networking_odl/openstack/common/cache/cache.py similarity index 93% rename from networking-odl/openstack/common/cache/cache.py rename to networking_odl/openstack/common/cache/cache.py index f3621b235..1c596d30a 100644 --- a/networking-odl/openstack/common/cache/cache.py +++ b/networking_odl/openstack/common/cache/cache.py @@ -25,10 +25,10 @@ Supported configuration options: # THIS MODULE IS DEPRECATED # # Please refer to -# https://etherpad.openstack.org/p/kilo-networking-odl-library-proposals for +# https://etherpad.openstack.org/p/kilo-networking_odl-library-proposals for # the discussion leading to this deprecation. # -# We recommend helping with the new networking-odl.cache library being created +# We recommend helping with the new networking_odl.cache library being created # as a wrapper for dogpile. # ######################################################################## @@ -85,7 +85,7 @@ def get_cache(url='memory://'): parameters = parse.parse_qsl(query) kwargs = {'options': dict(parameters)} - mgr = driver.DriverManager('networking-odl.openstack.common.cache.backends', backend, + mgr = driver.DriverManager('networking_odl.openstack.common.cache.backends', backend, invoke_on_load=True, invoke_args=[parsed], invoke_kwds=kwargs) diff --git a/networking-odl/openstack/common/context.py b/networking_odl/openstack/common/context.py similarity index 100% rename from networking-odl/openstack/common/context.py rename to networking_odl/openstack/common/context.py diff --git a/networking-odl/openstack/common/eventlet_backdoor.py b/networking_odl/openstack/common/eventlet_backdoor.py similarity index 97% rename from networking-odl/openstack/common/eventlet_backdoor.py rename to networking_odl/openstack/common/eventlet_backdoor.py index 69d51b519..1e4287a9f 100644 --- a/networking-odl/openstack/common/eventlet_backdoor.py +++ b/networking_odl/openstack/common/eventlet_backdoor.py @@ -30,8 +30,8 @@ import eventlet.backdoor import greenlet from oslo.config import cfg -from networking-odl.openstack.common._i18n import _LI -from networking-odl.openstack.common import log as logging +from networking_odl.openstack.common._i18n import _LI +from networking_odl.openstack.common import log as logging help_for_backdoor_port = ( "Acceptable values are 0, , and :, where 0 results " diff --git a/networking-odl/openstack/common/fileutils.py b/networking_odl/openstack/common/fileutils.py similarity index 100% rename from networking-odl/openstack/common/fileutils.py rename to networking_odl/openstack/common/fileutils.py diff --git a/networking-odl/openstack/common/fixture/__init__.py b/networking_odl/openstack/common/fixture/__init__.py similarity index 100% rename from networking-odl/openstack/common/fixture/__init__.py rename to networking_odl/openstack/common/fixture/__init__.py diff --git a/networking-odl/openstack/common/fixture/logging.py b/networking_odl/openstack/common/fixture/logging.py similarity index 100% rename from networking-odl/openstack/common/fixture/logging.py rename to networking_odl/openstack/common/fixture/logging.py diff --git a/networking-odl/openstack/common/local.py b/networking_odl/openstack/common/local.py similarity index 100% rename from networking-odl/openstack/common/local.py rename to networking_odl/openstack/common/local.py diff --git a/networking-odl/openstack/common/log.py b/networking_odl/openstack/common/log.py similarity index 99% rename from networking-odl/openstack/common/log.py rename to networking_odl/openstack/common/log.py index 880d60de8..ffb8598a8 100644 --- a/networking-odl/openstack/common/log.py +++ b/networking_odl/openstack/common/log.py @@ -46,8 +46,8 @@ from six import moves _PY26 = sys.version_info[0:2] == (2, 6) -from networking-odl.openstack.common._i18n import _ -from networking-odl.openstack.common import local +from networking_odl.openstack.common._i18n import _ +from networking_odl.openstack.common import local _DEFAULT_LOG_DATE_FORMAT = "%Y-%m-%d %H:%M:%S" diff --git a/networking-odl/openstack/common/loopingcall.py b/networking_odl/openstack/common/loopingcall.py similarity index 97% rename from networking-odl/openstack/common/loopingcall.py rename to networking_odl/openstack/common/loopingcall.py index 17f5b3212..6dd1fdd30 100644 --- a/networking-odl/openstack/common/loopingcall.py +++ b/networking_odl/openstack/common/loopingcall.py @@ -21,8 +21,8 @@ import time from eventlet import event from eventlet import greenthread -from networking-odl.openstack.common._i18n import _LE, _LW -from networking-odl.openstack.common import log as logging +from networking_odl.openstack.common._i18n import _LE, _LW +from networking_odl.openstack.common import log as logging LOG = logging.getLogger(__name__) diff --git a/networking-odl/openstack/common/middleware/__init__.py b/networking_odl/openstack/common/middleware/__init__.py similarity index 100% rename from networking-odl/openstack/common/middleware/__init__.py rename to networking_odl/openstack/common/middleware/__init__.py diff --git a/networking-odl/openstack/common/middleware/catch_errors.py b/networking_odl/openstack/common/middleware/catch_errors.py similarity index 93% rename from networking-odl/openstack/common/middleware/catch_errors.py rename to networking_odl/openstack/common/middleware/catch_errors.py index efd01d25e..fc99016cb 100644 --- a/networking-odl/openstack/common/middleware/catch_errors.py +++ b/networking_odl/openstack/common/middleware/catch_errors.py @@ -14,7 +14,7 @@ from oslo.middleware import catch_errors -from networking-odl.openstack.common import versionutils +from networking_odl.openstack.common import versionutils @versionutils.deprecated(as_of=versionutils.deprecated.KILO, diff --git a/networking-odl/openstack/common/middleware/request_id.py b/networking_odl/openstack/common/middleware/request_id.py similarity index 94% rename from networking-odl/openstack/common/middleware/request_id.py rename to networking_odl/openstack/common/middleware/request_id.py index 156d89416..9019ed853 100644 --- a/networking-odl/openstack/common/middleware/request_id.py +++ b/networking_odl/openstack/common/middleware/request_id.py @@ -14,7 +14,7 @@ from oslo.middleware import request_id -from networking-odl.openstack.common import versionutils +from networking_odl.openstack.common import versionutils ENV_REQUEST_ID = 'openstack.request_id' diff --git a/networking-odl/openstack/common/periodic_task.py b/networking_odl/openstack/common/periodic_task.py similarity index 98% rename from networking-odl/openstack/common/periodic_task.py rename to networking_odl/openstack/common/periodic_task.py index 80241153b..2f614e965 100644 --- a/networking-odl/openstack/common/periodic_task.py +++ b/networking_odl/openstack/common/periodic_task.py @@ -18,8 +18,8 @@ import time from oslo.config import cfg import six -from networking-odl.openstack.common._i18n import _, _LE, _LI -from networking-odl.openstack.common import log as logging +from networking_odl.openstack.common._i18n import _, _LE, _LI +from networking_odl.openstack.common import log as logging periodic_opts = [ diff --git a/networking-odl/openstack/common/policy.py b/networking_odl/openstack/common/policy.py similarity index 99% rename from networking-odl/openstack/common/policy.py rename to networking_odl/openstack/common/policy.py index 4eebc6d99..2c561ce38 100644 --- a/networking-odl/openstack/common/policy.py +++ b/networking_odl/openstack/common/policy.py @@ -100,9 +100,9 @@ import six import six.moves.urllib.parse as urlparse import six.moves.urllib.request as urlrequest -from networking-odl.openstack.common import fileutils -from networking-odl.openstack.common._i18n import _, _LE, _LI -from networking-odl.openstack.common import log as logging +from networking_odl.openstack.common import fileutils +from networking_odl.openstack.common._i18n import _, _LE, _LI +from networking_odl.openstack.common import log as logging policy_opts = [ diff --git a/networking-odl/openstack/common/service.py b/networking_odl/openstack/common/service.py similarity index 98% rename from networking-odl/openstack/common/service.py rename to networking_odl/openstack/common/service.py index ce906de4f..e2d84513b 100644 --- a/networking-odl/openstack/common/service.py +++ b/networking_odl/openstack/common/service.py @@ -37,11 +37,11 @@ import eventlet from eventlet import event from oslo.config import cfg -from networking-odl.openstack.common import eventlet_backdoor -from networking-odl.openstack.common._i18n import _LE, _LI, _LW -from networking-odl.openstack.common import log as logging -from networking-odl.openstack.common import systemd -from networking-odl.openstack.common import threadgroup +from networking_odl.openstack.common import eventlet_backdoor +from networking_odl.openstack.common._i18n import _LE, _LI, _LW +from networking_odl.openstack.common import log as logging +from networking_odl.openstack.common import systemd +from networking_odl.openstack.common import threadgroup CONF = cfg.CONF diff --git a/networking-odl/openstack/common/systemd.py b/networking_odl/openstack/common/systemd.py similarity index 98% rename from networking-odl/openstack/common/systemd.py rename to networking_odl/openstack/common/systemd.py index 6209671ee..ac9c7b68c 100644 --- a/networking-odl/openstack/common/systemd.py +++ b/networking_odl/openstack/common/systemd.py @@ -20,7 +20,7 @@ import os import socket import sys -from networking-odl.openstack.common import log as logging +from networking_odl.openstack.common import log as logging LOG = logging.getLogger(__name__) diff --git a/networking-odl/openstack/common/threadgroup.py b/networking_odl/openstack/common/threadgroup.py similarity index 97% rename from networking-odl/openstack/common/threadgroup.py rename to networking_odl/openstack/common/threadgroup.py index 7ad49e5e8..2f5842243 100644 --- a/networking-odl/openstack/common/threadgroup.py +++ b/networking_odl/openstack/common/threadgroup.py @@ -16,8 +16,8 @@ import threading import eventlet from eventlet import greenpool -from networking-odl.openstack.common import log as logging -from networking-odl.openstack.common import loopingcall +from networking_odl.openstack.common import log as logging +from networking_odl.openstack.common import loopingcall LOG = logging.getLogger(__name__) diff --git a/networking-odl/openstack/common/uuidutils.py b/networking_odl/openstack/common/uuidutils.py similarity index 100% rename from networking-odl/openstack/common/uuidutils.py rename to networking_odl/openstack/common/uuidutils.py diff --git a/networking-odl/openstack/common/versionutils.py b/networking_odl/openstack/common/versionutils.py similarity index 97% rename from networking-odl/openstack/common/versionutils.py rename to networking_odl/openstack/common/versionutils.py index ed5f25052..ad3d534b8 100644 --- a/networking-odl/openstack/common/versionutils.py +++ b/networking_odl/openstack/common/versionutils.py @@ -23,8 +23,8 @@ import inspect import pkg_resources import six -from networking-odl.openstack.common._i18n import _ -from networking-odl.openstack.common import log as logging +from networking_odl.openstack.common._i18n import _ +from networking_odl.openstack.common import log as logging LOG = logging.getLogger(__name__) @@ -136,7 +136,7 @@ class deprecated(object): # TODO(tsufiev): change `functools` module to `six` as # soon as six 1.7.4 (with fix for passing `assigned` # argument to underlying `functools.wraps`) is released - # and added to the networking-odl-incubator requrements + # and added to the networking_odl-incubator requrements @functools.wraps(orig_init, assigned=('__name__', '__doc__')) def new_init(self, *args, **kwargs): LOG.deprecated(msg, details) diff --git a/networking-odl/plugins/ml2/__init__.py b/networking_odl/plugins/ml2/__init__.py similarity index 100% rename from networking-odl/plugins/ml2/__init__.py rename to networking_odl/plugins/ml2/__init__.py diff --git a/networking-odl/plugins/ml2/drivers/README.odl b/networking_odl/plugins/ml2/drivers/README.odl similarity index 100% rename from networking-odl/plugins/ml2/drivers/README.odl rename to networking_odl/plugins/ml2/drivers/README.odl diff --git a/networking-odl/plugins/ml2/drivers/__init__.py b/networking_odl/plugins/ml2/drivers/__init__.py similarity index 100% rename from networking-odl/plugins/ml2/drivers/__init__.py rename to networking_odl/plugins/ml2/drivers/__init__.py diff --git a/networking-odl/plugins/ml2/drivers/mechanism_odl.py b/networking_odl/plugins/ml2/drivers/mechanism_odl.py similarity index 100% rename from networking-odl/plugins/ml2/drivers/mechanism_odl.py rename to networking_odl/plugins/ml2/drivers/mechanism_odl.py diff --git a/networking-odl/tests/__init__.py b/networking_odl/tests/__init__.py similarity index 100% rename from networking-odl/tests/__init__.py rename to networking_odl/tests/__init__.py diff --git a/networking-odl/tests/unit/__init__.py b/networking_odl/tests/unit/__init__.py similarity index 100% rename from networking-odl/tests/unit/__init__.py rename to networking_odl/tests/unit/__init__.py diff --git a/networking-odl/tests/unit/db/__init__.py b/networking_odl/tests/unit/db/__init__.py similarity index 100% rename from networking-odl/tests/unit/db/__init__.py rename to networking_odl/tests/unit/db/__init__.py diff --git a/networking-odl/tests/unit/ml2/__init__.py b/networking_odl/tests/unit/ml2/__init__.py similarity index 100% rename from networking-odl/tests/unit/ml2/__init__.py rename to networking_odl/tests/unit/ml2/__init__.py diff --git a/networking-odl/tests/unit/ml2/test_mechanism_odl.py b/networking_odl/tests/unit/ml2/test_mechanism_odl.py similarity index 100% rename from networking-odl/tests/unit/ml2/test_mechanism_odl.py rename to networking_odl/tests/unit/ml2/test_mechanism_odl.py diff --git a/openstack-common.conf b/openstack-common.conf index ae6e533cb..de6bfeb6f 100644 --- a/openstack-common.conf +++ b/openstack-common.conf @@ -20,4 +20,4 @@ module=threadgroup module=uuidutils # The base module to hold the copy of openstack.common -base=networking-odl +base=networking_odl diff --git a/requirements.txt b/requirements.txt index 395e39b95..6ead9fead 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,37 +1,7 @@ # 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. + pbr>=0.6,!=0.7,<1.0 - -Paste -PasteDeploy>=1.5.0 -Routes>=1.12.3,!=2.0 -anyjson>=0.3.3 -argparse -eventlet>=0.15.2 -greenlet>=0.3.2 -httplib2>=0.7.5 -requests>=2.2.0,!=2.4.0 -iso8601>=0.1.9 -jsonrpclib -Jinja2>=2.6 # BSD License (3 clause) -keystonemiddleware>=1.0.0 -netaddr>=0.7.12 -python-neutronclient>=2.3.6,<3 -SQLAlchemy>=0.9.7,<=0.9.99 -WebOb>=1.2.3 -python-keystoneclient>=0.11.1 -alembic>=0.6.4 -six>=1.7.0 -stevedore>=1.1.0 # Apache-2.0 -oslo.config>=1.4.0 # Apache-2.0 -oslo.db>=1.1.0 # Apache-2.0 -oslo.i18n>=1.0.0 # Apache-2.0 -oslo.messaging>=1.4.0,!=1.5.0 -oslo.middleware>=0.1.0 # Apache-2.0 -oslo.rootwrap>=1.3.0 -oslo.serialization>=1.0.0 # Apache-2.0 -oslo.utils>=1.1.0 # Apache-2.0 - -python-novaclient>=2.18.0 +Babel>=1.3 -e git://git.openstack.org/openstack/neutron.git#egg=neutron diff --git a/setup.cfg b/setup.cfg index 44e355b40..840e64042 100644 --- a/setup.cfg +++ b/setup.cfg @@ -19,7 +19,7 @@ classifier = [files] packages = - networking-odl + networking_odl data_files = etc/neutron = etc/neutron/plugins/ml2/ml2_conf_odl.ini @@ -40,16 +40,16 @@ source-dir = doc/source [extract_messages] keywords = _ gettext ngettext l_ lazy_gettext mapping_file = babel.cfg -output_file = networking-odl/locale/networking-odl.pot +output_file = networking_odl/locale/networking-odl.pot [compile_catalog] -directory = networking-odl/locale +directory = networking_odl/locale domain = networking-odl [update_catalog] domain = networking-odl -output_dir = networking-odl/locale -input_file = networking-odl/locale/networking-odl.pot +output_dir = networking_odl/locale +input_file = networking_odl/locale/networking-odl.pot [wheel] universal = 1 diff --git a/test-requirements.txt b/test-requirements.txt index cb11b2add..040d99f49 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -1,21 +1,16 @@ # 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. + hacking>=0.9.2,<0.10 -cliff>=1.7.0 # Apache-2.0 coverage>=3.6 discover -fixtures>=0.3.14 -mock>=1.0 -python-subunit>=0.0.18 -requests-mock>=0.5.1 # Apache-2.0 -sphinx>=1.1.2,!=1.2.0,!=1.3b1,<1.3 -oslosphinx>=2.2.0 # Apache-2.0 +python-subunit +sphinx>=1.1.2 +oslosphinx +oslotest>=1.1.0.0a1 testrepository>=0.0.18 -testtools>=0.9.36,!=1.2.0 testscenarios>=0.4 WebTest>=2.0 -oslotest>=1.2.0 # Apache-2.0 -psycopg2 -MySQL-python +testtools>=0.9.34 diff --git a/tox.ini b/tox.ini index aee3b8ddf..02f947d97 100644 --- a/tox.ini +++ b/tox.ini @@ -1,86 +1,41 @@ [tox] -envlist = py27,py33,py34,pep8 +envlist = py27,pep8 minversion = 1.6 skipsdist = True [testenv] -# Note the hash seed is set to 0 until neutron can be tested with a -# random hash seed successfully. setenv = VIRTUAL_ENV={envdir} - PYTHONHASHSEED=0 usedevelop = True install_command = pip install -r requirements.txt -U {opts} {packages} deps = -r{toxinidir}/test-requirements.txt whitelist_externals = sh -commands = - sh tools/pretty_tox.sh '{posargs}' -# there is also secret magic in pretty_tox.sh which lets you run in a fail only -# mode. To do this define the TRACE_FAILONLY environmental variable. - -[testenv:hashtest] -# This is the same as default environment, but with a random PYTHONHASHSEED. -# You can also specify a specific hashseed (for test repeatability) as follows: -# tox --hashseed 1235130571 -e hashtest -setenv = VIRTUAL_ENV={envdir} - -[testenv:functional] -setenv = OS_TEST_PATH=./networking-odl/tests/functional - -[testenv:dsvm-functional] -setenv = OS_TEST_PATH=./networking-odl/tests/functional - OS_SUDO_TESTING=1 - OS_ROOTWRAP_CMD=sudo /usr/local/bin/neutron-rootwrap /etc/neutron/rootwrap.conf - OS_FAIL_ON_MISSING_DEPS=1 -sitepackages=True - -[tox:jenkins] -sitepackages = True -downloadcache = ~/cache/pip +commands = python setup.py testr --slowest --testr-args='{posargs}' [testenv:pep8] -commands = - sh ./tools/check_bash.sh - flake8 - neutron-db-manage check_migration -whitelist_externals = sh +commands = flake8 [testenv:i18n] commands = python ./tools/check_i18n.py ./networking-odl ./tools/i18n_cfg.py -[testenv:cover] -commands = - python -m neutron.openstack.common.lockutils python setup.py testr --coverage --testr-args='{posargs}' - [testenv:venv] commands = {posargs} +[testenv:cover] +commands = python setup.py testr --coverage --testr-args='{posargs}' + [testenv:docs] commands = python setup.py build_sphinx -[flake8] -# E125 continuation line does not distinguish itself from next logical line -# E126 continuation line over-indented for hanging indent -# E128 continuation line under-indented for visual indent -# E129 visually indented line with same indent as next logical line -# E265 block comment should start with ‘# ‘ -# H305 imports not grouped correctly -# H307 like imports should be grouped together -# H402 one line docstring needs punctuation -# H404 multi line docstring should start with a summary -# H405 multi line docstring summary not separated with an empty line -# H904 Wrap long lines in parentheses instead of a backslash -ignore = E125,E126,E128,E129,E265,H305,H307,H402,H404,H405,H904 -show-source = true -builtins = _ -exclude = .venv,.git,.tox,dist,doc,*openstack/common*,*lib/python*,*egg,build,tools,.ropeproject,rally-scenarios - -[testenv:pylint] -deps = - {[testenv]deps} - pylint -commands = - pylint --rcfile=.pylintrc --output-format=colorized {posargs:networking-odl} - [hacking] import_exceptions = neutron.i18n local-check-factory = neutron.hacking.checks.factory +show-source = True +ignore = E123,E124,E125,H803 + +[flake8] +# H803 skipped on purpose per list discussion. +# E123, E125 skipped as they are invalid PEP-8. +show-source = True +ignore = E123,E125,H803 +builtins = _ +exclude=.venv,.git,.tox,dist,doc,*openstack/common*,*lib/python*,*egg,build,tools