Merge "Test Neutron API restart time"

This commit is contained in:
Zuul 2024-09-16 12:46:33 +00:00 committed by Gerrit Code Review
commit a7c3c9454f
2 changed files with 70 additions and 2 deletions

View File

@ -0,0 +1,66 @@
# Copyright 2024 Red Hat, Inc.
# 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 random
from oslo_log import log
from oslo_utils import timeutils
from tempest import config
from whitebox_neutron_tempest_plugin.common import utils as wb_utils
from whitebox_neutron_tempest_plugin.tests.scenario import base as wb_base
CONF = config.CONF
WB_CONF = CONF.whitebox_neutron_plugin_options
LOG = log.getLogger(__name__)
class NeutronAPIServerTest(wb_base.BaseTempestTestCaseOvn):
@classmethod
def resource_setup(cls):
super().resource_setup()
cls.discover_nodes()
def test_neutron_api_restart(self):
# 1) Checks the Neutron API is responding and init the timer.
wb_utils.wait_for_neutron_api(self.client)
t1 = timeutils.utcnow()
# 2) Do a trivial configuration change. In a "podified" environment,
# that will trigger the Neutron API restart. In a "devstack"
# environment, it will be needed to manually restart the Neutron API
# server.
self.set_service_setting(file=wb_utils.get_ml2_conf_file(),
section='ovn',
param='fdb_age_threshold',
value=random.randint(10000, 90000))
# 3) Restart Neutron API on all controllers simultaneously.
if not WB_CONF.openstack_type == 'podified':
service_ptn = wb_utils.get_neutron_api_service_name()
for node in self.nodes:
if node['is_controller']:
# NOTE(mblue): if reset fails on multinode, consider
# wait_until_active=False for a more simultaneous reset
self.reset_node_service(service_ptn, node['client'])
wb_utils.wait_for_neutron_api(self.client)
t2 = timeutils.utcnow()
tdelta = t2 - t1
self.assertLess(tdelta.seconds, 120,
msg='The Neutron API took more than 120 seconds to '
'restart')

View File

@ -35,7 +35,8 @@
(^whitebox_neutron_tempest_plugin.*test_previously_used_ip)|\
(^whitebox_neutron_tempest_plugin.tests.scenario.test_ovn_dbs.OvnDbsMonitoringTest.*)|\
(^whitebox_neutron_tempest_plugin.*ovn_controller_restart)|\
(^whitebox_neutron_tempest_plugin.tests.scenario.test_ovn_fdb.*)"
(^whitebox_neutron_tempest_plugin.tests.scenario.test_ovn_fdb.*)|\
(^whitebox_neutron_tempest_plugin.tests.scenario.test_api_server.*)"
devstack_localrc:
USE_PYTHON3: true
NETWORK_API_EXTENSIONS: "{{ (network_api_extensions_common + network_api_extensions_tempest) | join(',') }}"
@ -446,7 +447,8 @@
(^whitebox_neutron_tempest_plugin.*test_previously_used_ip)|\
(^whitebox_neutron_tempest_plugin.tests.scenario.test_ovn_dbs.OvnDbsMonitoringTest.*)|\
(^whitebox_neutron_tempest_plugin.*ovn_controller_restart)|\
(^whitebox_neutron_tempest_plugin.tests.scenario.test_ovn_fdb.*)"
(^whitebox_neutron_tempest_plugin.tests.scenario.test_ovn_fdb.*)|\
(^whitebox_neutron_tempest_plugin.tests.scenario.test_api_server.*)"
# NOTE(mblue): Enable metadata rate limiting tests
# when OSPRH-9569 is resolved (feature code available in RHOSO).
tempest_exclude_regex: "\