Browse Source

Tempest: Add availability-zone for agent

Change-Id: I586420488cc2db43e849132c0d2465185e4b32d0
Partial-Bug: #1684069
changes/23/475123/14
Dongcan Ye 4 years ago
parent
commit
e774b88428
4 changed files with 72 additions and 0 deletions
  1. +1
    -0
      neutron/tests/contrib/gate_hook.sh
  2. +14
    -0
      neutron/tests/contrib/hooks/availability_zone
  3. +53
    -0
      neutron/tests/tempest/api/admin/test_agent_availability_zone.py
  4. +4
    -0
      neutron/tests/tempest/config.py

+ 1
- 0
neutron/tests/contrib/gate_hook.sh 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


+ 14
- 0
neutron/tests/contrib/hooks/availability_zone 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

+ 53
- 0
neutron/tests/tempest/api/admin/test_agent_availability_zone.py 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'))

+ 4
- 0
neutron/tests/tempest/config.py 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


Loading…
Cancel
Save