Merge "Fix configuration file generator"

changes/74/395974/5
Jenkins 6 years ago committed by Gerrit Code Review
commit 65c628d0b1
  1. 4
      etc/tricircle_plugin-cfg-gen.conf
  2. 9
      tox.ini
  3. 17
      tricircle/network/central_plugin.py
  4. 4
      tricircle/network/managers.py
  5. 22
      tricircle/network/opts.py

@ -1,4 +0,0 @@
[DEFAULT]
output_file = etc/tricircle_plugin.conf.sample
wrap_width = 79
namespace = tricircle.network

@ -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]

@ -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:

@ -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:

@ -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),
]
Loading…
Cancel
Save