Merge "Tempest: Add availability-zone for agent"

This commit is contained in:
Zuul 2017-11-14 20:27:40 +00:00 committed by Gerrit Code Review
commit f3d64799dd
4 changed files with 72 additions and 0 deletions

View File

@ -101,6 +101,7 @@ case $VENV in
load_rc_hook trunk
load_conf_hook vlan_provider
load_conf_hook osprofiler
load_conf_hook availability_zone
if [[ "$VENV" =~ "dsvm-scenario" ]]; then
load_rc_hook ubuntu_image
fi

View File

@ -0,0 +1,14 @@
[[test-config|$TEMPEST_CONFIG]]
[neutron_plugin_options]
agent_availability_zone = nova
[[post-config|/$NEUTRON_L3_CONF]]
[agent]
availability_zone = nova
[[post-config|/$NEUTRON_DHCP_CONF]]
[agent]
availability_zone = nova

View File

@ -0,0 +1,53 @@
# 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.
from neutron_lib import constants
from tempest.lib import decorators
import testtools
from neutron.tests.tempest.api import base
from neutron.tests.tempest import config
AZ_SUPPORTED_AGENTS = [constants.AGENT_TYPE_DHCP, constants.AGENT_TYPE_L3]
CONF = config.CONF
class AgentAvailabilityZoneTestCase(base.BaseAdminNetworkTest):
required_extensions = ['agent', 'availability_zone']
@classmethod
def resource_setup(cls):
super(AgentAvailabilityZoneTestCase, cls).resource_setup()
body = cls.admin_client.list_agents()
agents = body['agents']
agents_type = [agent.get('agent_type') for agent in agents]
for az_agent in AZ_SUPPORTED_AGENTS:
if az_agent in agents_type:
return
msg = 'availability_zone supported agent not found.'
raise cls.skipException(msg)
@decorators.idempotent_id('3ffa661e-cfcc-417d-8b63-1c5ec4a22e54')
@testtools.skipUnless(CONF.neutron_plugin_options.agent_availability_zone,
"Need a single availability_zone assumption.")
def test_agents_availability_zone(self):
"""
Test list agents availability_zone, only L3 and DHCP agent support
availability_zone, default availability_zone is "nova".
"""
body = self.admin_client.list_agents()
agents = body['agents']
for agent in agents:
if agent.get('agent_type') in AZ_SUPPORTED_AGENTS:
self.assertEqual(
CONF.neutron_plugin_options.agent_availability_zone,
agent.get('availability_zone'))

View File

@ -34,6 +34,10 @@ NeutronPluginOptions = [
default=False,
help='Image that supports features that cirros does not, like'
' Ubuntu or CentOS supporting advanced features'),
cfg.StrOpt('agent_availability_zone',
help='The availability zone for all agents in the deployment. '
'Configure this only when the single value is used by '
'all agents in the deployment.'),
]
# TODO(amuller): Redo configuration options registration as part of the planned