Plugin was built extensively around podified/devstack setups, maybe more types in the future. It isn't likely to be changed any time soon, such change will require adding code into plenty of conditions spread around plugin. We can replace manually maintained configuration with automated check to reduce CI maintenance upstream/downstream. As documented for devstack [1] home directory can optionally be `/opt/stack`, for this plugin's devstack jobs it is commonly used, check should work to tell the difference. [1] https://docs.openstack.org/devstack/latest/ Related-Bug: #OSPRH-16056 Related-Bug: #OSPRH-15819 Change-Id: I2d3f807b07e5eb810b87320e31cf64ad72f2f2a9
68 lines
2.6 KiB
Python
68 lines
2.6 KiB
Python
# 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.
|
|
_config = wb_base.ConfigOption('ovn', 'fdb_age_threshold',
|
|
random.randint(10000, 90000))
|
|
self.set_service_setting(file=wb_utils.get_ml2_conf_file(),
|
|
config_list=[_config],
|
|
wait_res='deploy/neutron')
|
|
|
|
# 3) Restart Neutron API on all controllers simultaneously.
|
|
if self.is_devstack:
|
|
service_ptn = self.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')
|