Merge "Add test that verifies connectivity from computes to OVN DBS"

This commit is contained in:
Zuul 2022-09-15 15:28:24 +00:00 committed by Gerrit Code Review
commit 04f6f04eaa
4 changed files with 61 additions and 0 deletions

View File

@ -27,6 +27,7 @@ test_ovs_bridges_mac_table_size = _neutron.test_ovs_bridges_mac_table_size
test_ovs_namespaces_are_absent = _neutron.test_ovs_namespaces_are_absent
test_ovs_interfaces_are_absent = _neutron.test_ovs_interfaces_are_absent
test_raft_cluster = _neutron.test_raft_cluster
test_raft_clients_connected = _neutron.test_raft_clients_connected
test_evacuable_server_creation = _nova.test_evacuable_server_creation
test_server_creation = _nova.test_server_creation

View File

@ -424,6 +424,48 @@ def test_raft_cluster():
test_case.assertEqual(socs[0]['process'][0], 'ovsdb-server')
def test_raft_clients_connected():
"""Verifies that all SBDB readers are connected to active nodes
Unlike HA environment all operations are allowed to be performed to any
available node. To have the better performance all heavy write operations
are done to leader node, but readers are spreaded across all cluster
controllers
"""
test_case = tobiko.get_test_case()
test_case.assertTrue(_overcloud.is_ovn_using_raft())
db_con_str = get_ovn_db_connections()['sb']
addrs, port = parse_ips_from_db_connections(db_con_str)
for node_details in collect_raft_cluster_details('sb'):
if node_details['Role'] == 'leader':
leader_ips, _ = parse_ips_from_db_connections(
node_details['Address'])
break
test_case.assertIsNotNone(locals().get('leader_ips'))
leader_ip = leader_ips[0]
for node in topology.list_openstack_nodes(group='compute'):
socs = ss.tcp_connected(dst_port=port, ssh_client=node.ssh_client)
ovn_controller_found = False
for soc in socs:
if soc['process'][0] == 'ovn-controller':
ovn_controller_found = True
test_case.assertIn(soc['remote_addr'], addrs)
test_case.assertTrue(ovn_controller_found)
for node in topology.list_openstack_nodes(group='controller'):
socs = ss.tcp_connected(dst_port=port, ssh_client=node.ssh_client)
ref_processes = {'ovn-controller', 'neutron-server:', 'ovn-northd'}
processes = set()
for soc in socs:
processes.add(soc['process'][0])
if soc['process'][0] == 'ovn-northd':
test_case.assertEqual(soc['remote_addr'], leader_ip)
else:
test_case.assertIn(soc['remote_addr'], addrs)
test_case.assertEqual(processes, ref_processes)
def test_ovs_bridges_mac_table_size():
test_case = tobiko.get_test_case()
expected_mac_table_size = '50000'

View File

@ -246,6 +246,23 @@ def tcp_listening(address: str = '',
return _ss(params=params, parser=parse_tcp_socket, **exec_params)
def tcp_connected(src_address: str = '',
src_port: str = '',
dst_address: str = '',
dst_port: str = '',
**exec_params) -> typing.List[SockData]:
params = '-t state connected'
if src_port:
params += ' sport {}'.format(src_port)
if src_address:
params += ' src {}'.format(src_address)
if dst_port:
params += ' dport {}'.format(dst_port)
if dst_address:
params += ' dst {}'.format(dst_address)
return _ss(params=params, parser=parse_tcp_socket, **exec_params)
def unix_listening(file_name: str = '',
**exec_params) -> typing.List[SockData]:
"""List of unix sockets in listening state

View File

@ -30,3 +30,4 @@ class TestRAFTDisruption(testtools.TestCase):
def test_raft_status(self):
tests.test_raft_cluster()
tests.test_raft_clients_connected()