Use max port per router as a constant

The patch [1] set value of ovn_max_controller_gw_ports_per_router
to 1 which is not alighed with default ovn config.
This caused AZ tests behave not correctly.
We can use the value as a constant set to 5 which is alighed
with default ovn setting.

[1] https://review.opendev.org/c/x/whitebox-neutron-tempest-plugin/+/912348

Change-Id: I51a9a7bf1bc9ad56fa80b735401fbe210fff879a
This commit is contained in:
Roman Safronov 2024-04-24 18:13:13 +03:00
parent a4089d24e2
commit 0222b13376
3 changed files with 10 additions and 16 deletions

View File

@ -16,6 +16,7 @@
GLOBAL_IP = '1.1.1.1'
METADATA_SERVICE_IP = '169.254.169.254'
NODE_TUNNEL_INTERFACE = 'genev_sys_6081'
OVN_MAX_GW_PORTS_PER_ROUTER = 5
NCAT_PORT = 65000
NCAT_TIMEOUT = 30
IP_HEADER_LENGTH = 20

View File

@ -129,10 +129,6 @@ WhiteboxNeutronPluginOptions = [
'external network. In case the value is set to None the '
'interface name will be discovered from a list of '
'interfaces under bridge connected to external network'),
cfg.IntOpt('ovn_max_controller_gw_ports_per_router',
default=1,
help='The number of network nodes used '
'for the OVN router HA.'),
cfg.IntOpt('minbw_placement_nic_kbps_egress',
default=None,
help='BW configured per NIC for the minimum BW placement '

View File

@ -19,6 +19,7 @@ from oslo_log import log
from tempest.lib import decorators
from tempest.lib import exceptions
from whitebox_neutron_tempest_plugin.common import constants as local_constants
from whitebox_neutron_tempest_plugin.tests.scenario import base
AZ_SUPPORTED_AGENTS = ['OVN Controller Gateway agent']
@ -75,10 +76,6 @@ class OvnAvaliabilityzonesTest(
for param, func in agent_params.items():
cls.agent_conf[param] = func(
cls.master_cont_cmd_executor(cmd.format(param)))
# TODO(ccamposr): Hard-coded value, should be extracted from the env
# it could be extracted from ovn database
cls.max_controller_gw_ports_per_router = \
WB_CONF.ovn_max_controller_gw_ports_per_router
def _check_az_router(self, az, router):
"""Check that resource is correctly spawned in required AZs
@ -117,14 +114,14 @@ class OvnAvaliabilityzonesTest(
az_hosts.append(agent_host)
# Scenario 1 from docstring
if self.max_controller_gw_ports_per_router >= len(az_hosts):
if local_constants.OVN_MAX_GW_PORTS_PER_ROUTER >= len(az_hosts):
# Check that the router is deployed over all the az_hosts
for host in az_hosts:
self.assertIn(host, resource_hosts)
# Check that router isn't deployed over other az hosts
self.assertEqual(len(az_hosts), len(resource_hosts))
# Scenario 2 from docstring
elif self.max_controller_gw_ports_per_router >= len(az):
elif local_constants.OVN_MAX_GW_PORTS_PER_ROUTER >= len(az):
tmp_zones = []
# Check that the router is only deployed over az hosts
for host in resource_hosts:
@ -135,7 +132,7 @@ class OvnAvaliabilityzonesTest(
set())
# Check that the max redundancy is reached
self.assertEqual(len(resource_hosts),
self.max_controller_gw_ports_per_router)
local_constants.OVN_MAX_GW_PORTS_PER_ROUTER)
# Scenario 3 from docstring
else:
tmp_zones = []
@ -147,7 +144,7 @@ class OvnAvaliabilityzonesTest(
self.assertEqual(len(tmp_zones), len(set(tmp_zones)))
# Check that the max redundancy is reached
self.assertEqual(len(resource_hosts),
self.max_controller_gw_ports_per_router)
local_constants.OVN_MAX_GW_PORTS_PER_ROUTER)
@decorators.idempotent_id('bc0439e3-f503-4ebc-9194-0babe155a406')
def test_router_created_in_single_az_with_not_enough_agents(self):
@ -163,7 +160,7 @@ class OvnAvaliabilityzonesTest(
tmp_counter = az_host_counter.get(tmp_az, 0) + 1
az_host_counter[tmp_az] = tmp_counter
for tmp_az, counter in az_host_counter.items():
if counter < self.max_controller_gw_ports_per_router:
if counter < local_constants.OVN_MAX_GW_PORTS_PER_ROUTER:
az = tmp_az
break
else:
@ -186,7 +183,7 @@ class OvnAvaliabilityzonesTest(
tmp_counter = az_host_counter.get(tmp_az, 0) + 1
az_host_counter[tmp_az] = tmp_counter
for tmp_az, counter in az_host_counter.items():
if counter >= self.max_controller_gw_ports_per_router:
if counter >= local_constants.OVN_MAX_GW_PORTS_PER_ROUTER:
az = tmp_az
break
else:
@ -221,9 +218,9 @@ class OvnAvaliabilityzonesTest(
if len(self.AZs_list) <= 2:
raise self.skipException("More than 2 AZs required")
if self.max_controller_gw_ports_per_router <= 1:
if local_constants.OVN_MAX_GW_PORTS_PER_ROUTER <= 1:
raise self.skipException("More than 1 OVN gw required")
amount = min(self.max_controller_gw_ports_per_router,
amount = min(local_constants.OVN_MAX_GW_PORTS_PER_ROUTER,
len(self.AZs_list) - 1)
router = self.create_router_by_client(
availability_zone_hints=self.AZs_list[:amount])