Check OVN DBs listening on VIP (BZ1600151)
Verify OVN DBs are listening on proper VIP IP and both SB and NB ports Change-Id: I4909a764834f970c9f77a2a0c958171944fdb68d
This commit is contained in:
parent
0b53fcf8dc
commit
bc4e996d6a
|
@ -20,7 +20,7 @@ from tobiko.openstack.tests import _neutron
|
|||
from tobiko.openstack.tests import _nova
|
||||
|
||||
test_neutron_agents_are_alive = _neutron.test_neutron_agents_are_alive
|
||||
test_ovn_dbs_are_synchronized = _neutron.test_ovn_dbs_are_synchronized
|
||||
test_ovn_dbs_validations = _neutron.test_ovn_dbs_validations
|
||||
|
||||
test_evacuable_server_creation = _nova.test_evacuable_server_creation
|
||||
test_server_creation = _nova.test_server_creation
|
||||
|
|
|
@ -95,13 +95,7 @@ def test_neutron_agents_are_alive(timeout=300., interval=5.):
|
|||
return agents
|
||||
|
||||
|
||||
def test_ovn_dbs_are_synchronized():
|
||||
if not is_ovn_configured():
|
||||
LOG.debug('OVN not configured. OVN DB sync validations skipped')
|
||||
return
|
||||
|
||||
test_case = tobiko.get_test_case()
|
||||
|
||||
def ovn_dbs_are_synchronized(test_case):
|
||||
# declare commands
|
||||
search_container_cmd = (
|
||||
"%s ps --format '{{.Names}}' -f name=ovn-dbs-bundle" %
|
||||
|
@ -171,3 +165,60 @@ def test_ovn_dbs_are_synchronized():
|
|||
ovn_master_dbs_show_dict[db])
|
||||
|
||||
LOG.info("All OVN DBs are synchronized")
|
||||
|
||||
|
||||
def ovn_dbs_vip_bindings(test_case):
|
||||
# commands to obtain OVN SB and NB connection strings
|
||||
get_ovn_nb_conn_cmd = (
|
||||
'crudini --get /var/lib/config-data/puppet-generated/neutron/etc/'
|
||||
'neutron/plugins/ml2/ml2_conf.ini ovn ovn_nb_connection')
|
||||
get_ovn_sb_conn_cmd = get_ovn_nb_conn_cmd.replace('ovn_nb_connection',
|
||||
'ovn_sb_connection')
|
||||
|
||||
controllers = topology.list_openstack_nodes(group='controller')
|
||||
ovn_conn_str = {}
|
||||
ovn_conn_str['nb'] = sh.execute(get_ovn_nb_conn_cmd,
|
||||
ssh_client=controllers[0].ssh_client,
|
||||
sudo=True).stdout.splitlines()[0]
|
||||
ovn_conn_str['sb'] = sh.execute(get_ovn_sb_conn_cmd,
|
||||
ssh_client=controllers[0].ssh_client,
|
||||
sudo=True).stdout.splitlines()[0]
|
||||
ovn_conn = {}
|
||||
for db in ('nb', 'sb'):
|
||||
ovn_conn[db] = {}
|
||||
ipv6 = re.findall(r'\[.*\]', ovn_conn_str[db])
|
||||
if len(ipv6) == 1:
|
||||
ovn_conn[db]['ip'] = ipv6[0]
|
||||
elif len(ipv6) == 0:
|
||||
ovn_conn[db]['ip'] = ovn_conn_str[db].split(':')[1]
|
||||
else:
|
||||
raise RuntimeError('Error parsing ovn db connection string from '
|
||||
'configuration file')
|
||||
ovn_conn[db]['port'] = ovn_conn_str[db].split(':')[-1]
|
||||
|
||||
# command to obtain sockets listening on OVN SB and DB DBs
|
||||
get_ovn_db_sockets_listening_cmd = \
|
||||
"ss -p state listening 'sport = {srcport} and src {srcip}'"
|
||||
|
||||
for controller in controllers:
|
||||
for db in ('nb', 'sb'):
|
||||
ovn_db_sockets_listening = sh.execute(
|
||||
get_ovn_db_sockets_listening_cmd.format(
|
||||
srcport=ovn_conn[db]['port'],
|
||||
srcip=ovn_conn[db]['ip']),
|
||||
ssh_client=controller.ssh_client,
|
||||
sudo=True).stdout.splitlines()
|
||||
test_case.assertEqual(2, len(ovn_db_sockets_listening))
|
||||
test_case.assertIn('ovsdb-server', ovn_db_sockets_listening[1])
|
||||
|
||||
|
||||
def test_ovn_dbs_validations():
|
||||
if not is_ovn_configured():
|
||||
LOG.debug('OVN not configured. OVN DB sync validations skipped')
|
||||
return
|
||||
|
||||
test_case = tobiko.get_test_case()
|
||||
|
||||
# run validations
|
||||
ovn_dbs_are_synchronized(test_case)
|
||||
ovn_dbs_vip_bindings(test_case)
|
||||
|
|
|
@ -27,7 +27,7 @@ def overcloud_health_checks(passive_checks_only=False):
|
|||
containers.assert_all_tripleo_containers_running()
|
||||
containers.assert_equal_containers_state()
|
||||
containers.run_container_config_validations()
|
||||
tests.test_ovn_dbs_are_synchronized()
|
||||
tests.test_ovn_dbs_validations()
|
||||
validations.run_post_deployment_validations()
|
||||
|
||||
|
||||
|
|
|
@ -284,11 +284,8 @@ def run_container_config_validations():
|
|||
for node in topology.list_openstack_nodes(
|
||||
group=config_check['node_group']):
|
||||
for param_check in config_check['param_validations']:
|
||||
# 'docker' is used here in order to be compatible with old OSP
|
||||
# versions. On versions with podman, 'docker' command is
|
||||
# linked to 'podman'
|
||||
obtained_param = sh.execute(
|
||||
"docker exec -uroot "
|
||||
f"{container_runtime_name} exec -uroot "
|
||||
f"{config_check['container_name']} crudini "
|
||||
f"--get {config_check['config_file']} "
|
||||
f"{param_check['section']} {param_check['param']}",
|
||||
|
|
Loading…
Reference in New Issue