diff --git a/etc/tricircle_plugin-cfg-gen.conf b/etc/tricircle_plugin-cfg-gen.conf deleted file mode 100644 index fa224225..00000000 --- a/etc/tricircle_plugin-cfg-gen.conf +++ /dev/null @@ -1,4 +0,0 @@ -[DEFAULT] -output_file = etc/tricircle_plugin.conf.sample -wrap_width = 79 -namespace = tricircle.network diff --git a/tox.ini b/tox.ini index e5de6c32..60a5370e 100644 --- a/tox.ini +++ b/tox.ini @@ -14,10 +14,12 @@ setenv = deps = -r{toxinidir}/test-requirements.txt -egit+https://git.openstack.org/openstack/neutron@master#egg=neutron -commands = python setup.py testr --slowest --testr-args='{posargs}' +commands = python setup.py testr --slowest --testr-args='{posargs}' whitelist_externals = rm [testenv:pep8] +deps = + -r{toxinidir}/test-requirements.txt commands = flake8 [testenv:venv] @@ -27,11 +29,14 @@ commands = {posargs} commands = python setup.py testr --coverage --testr-args='{posargs}' [testenv:genconfig] +deps = + -r{toxinidir}/test-requirements.txt commands = oslo-config-generator --config-file=etc/api-cfg-gen.conf oslo-config-generator --config-file=etc/xjob-cfg-gen.conf - oslo-config-generator --config-file=etc/tricircle_plugin-cfg-gen.conf [testenv:docs] +deps = + -r{toxinidir}/test-requirements.txt commands = python setup.py build_sphinx [testenv:debug] diff --git a/tricircle/network/central_plugin.py b/tricircle/network/central_plugin.py index c2d5cabd..1cd104e0 100644 --- a/tricircle/network/central_plugin.py +++ b/tricircle/network/central_plugin.py @@ -36,6 +36,7 @@ from neutron.extensions import availability_zone as az_ext from neutron.extensions import external_net from neutron.extensions import l3 from neutron.extensions import providernet as provider +from neutron_lib.api import validators from neutron_lib import constants import neutronclient.common.exceptions as q_cli_exceptions @@ -179,7 +180,7 @@ class TricirclePlugin(db_base_plugin_v2.NeutronDbPluginV2, @staticmethod def _ensure_az_set_for_external_network(context, req_data): external = req_data.get(external_net.EXTERNAL) - external_set = attributes.is_attr_set(external) + external_set = validators.is_attr_set(external) if not external_set or not external: return False if az_ext.AZ_HINTS in req_data and req_data[az_ext.AZ_HINTS]: @@ -210,7 +211,7 @@ class TricirclePlugin(db_base_plugin_v2.NeutronDbPluginV2, provider_attrs = ('provider:network_type', 'provider:segmentation_id', 'provider:physical_network') for provider_attr in provider_attrs: - if attributes.is_attr_set(net.get(provider_attr)): + if validators.is_attr_set(net.get(provider_attr)): body['network'][provider_attr] = net[provider_attr] self._prepare_bottom_element( @@ -233,7 +234,7 @@ class TricirclePlugin(db_base_plugin_v2.NeutronDbPluginV2, attrs = ('ip_version', 'cidr', 'gateway_ip', 'allocation_pools', 'enable_dhcp') for attr in attrs: - if attributes.is_attr_set(subnet.get(attr)): + if validators.is_attr_set(subnet.get(attr)): body['subnet'][attr] = subnet[attr] self._prepare_bottom_element( t_ctx, subnet['tenant_id'], pod, {'id': top_id}, @@ -975,10 +976,10 @@ class TricirclePlugin(db_base_plugin_v2.NeutronDbPluginV2, 'name': subnet_name, 'prefixlen': 24, 'ip_version': 4, - 'allocation_pools': attributes.ATTR_NOT_SPECIFIED, - 'dns_nameservers': attributes.ATTR_NOT_SPECIFIED, - 'host_routes': attributes.ATTR_NOT_SPECIFIED, - 'cidr': attributes.ATTR_NOT_SPECIFIED, + 'allocation_pools': constants.ATTR_NOT_SPECIFIED, + 'dns_nameservers': constants.ATTR_NOT_SPECIFIED, + 'host_routes': constants.ATTR_NOT_SPECIFIED, + 'cidr': constants.ATTR_NOT_SPECIFIED, 'subnetpool_id': pool_id, 'enable_dhcp': False, 'tenant_id': project_id @@ -1142,7 +1143,7 @@ class TricirclePlugin(db_base_plugin_v2.NeutronDbPluginV2, router_data = copy.deepcopy(router['router']) need_update_bottom = False is_add = False - if attributes.is_attr_set(router_data.get(l3.EXTERNAL_GW_INFO)): + if validators.is_attr_set(router_data.get(l3.EXTERNAL_GW_INFO)): need_update_bottom = True ext_net_id = router_data[l3.EXTERNAL_GW_INFO].get('network_id') if ext_net_id: diff --git a/tricircle/network/managers.py b/tricircle/network/managers.py index afbe4473..6b7ebfc9 100644 --- a/tricircle/network/managers.py +++ b/tricircle/network/managers.py @@ -16,9 +16,9 @@ from oslo_config import cfg from oslo_log import log -from neutron.api.v2 import attributes from neutron.extensions import external_net from neutron.plugins.ml2 import managers +from neutron_lib.api import validators from tricircle.common.i18n import _LE from tricircle.common.i18n import _LI @@ -69,7 +69,7 @@ class TricircleTypeManager(managers.TypeManager): @staticmethod def _is_external_network(network): external = network.get(external_net.EXTERNAL) - external_set = attributes.is_attr_set(external) + external_set = validators.is_attr_set(external) if not external_set or not external: return False else: diff --git a/tricircle/network/opts.py b/tricircle/network/opts.py deleted file mode 100644 index 0a4265e9..00000000 --- a/tricircle/network/opts.py +++ /dev/null @@ -1,22 +0,0 @@ -# Copyright 2015 Huawei Technologies Co., Ltd. -# All Rights Reserved -# -# 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 tricircle.network.plugin - - -def list_opts(): - return [ - ('DEFAULT', tricircle.network.plugin.tricircle_opts), - ]