Add OVN metadata and OVN controller tests to test_neutron_agents

TODO: do not skip network agent tests with OVN+OSP13 deployments

Change-Id: I2723bf92b88dff5b8d0f166a6f78f0aeed6dd8a2
This commit is contained in:
Eduardo Olivares 2020-10-23 12:04:19 +02:00
parent 313b90c211
commit 6a7714af08
3 changed files with 65 additions and 6 deletions

View File

@ -181,7 +181,9 @@ class OpenStackTopology(tobiko.SharedFixture):
neutron.DHCP_AGENT: 'devstack@q-dhcp',
neutron.L3_AGENT: 'devstack@q-l3',
neutron.OPENVSWITCH_AGENT: 'devstack@q-agt',
neutron.METADATA_AGENT: 'devstack@q-meta'
neutron.METADATA_AGENT: 'devstack@q-meta',
neutron.OVN_METADATA_AGENT: 'devstack@q-ovn-metadata-agent',
neutron.OVN_CONTROLLER: 'devstack@ovn-controller'
}
agent_to_container_name_mappings: typing.Dict[str, str] = {}

View File

@ -482,10 +482,28 @@ class OpenVSwitchAgentTest(BaseAgentTest):
ping.ping_until_received(self.stack.ip_address).assert_replied()
@neutron.skip_if_missing_networking_agents(neutron.METADATA_AGENT)
class MetadataAgentTest(BaseAgentTest):
# TODO(eolivare): these tests will always be skipped on OSP13 because 'agent
# list' requests return empty list with OVN+OSP13
# Search for the corresponding container instead of the networking agent
@neutron.skip_if_missing_networking_agents(neutron.OVN_CONTROLLER)
class OvnControllerTest(BaseAgentTest):
agent_name = neutron.METADATA_AGENT
agent_name = neutron.OVN_CONTROLLER
#: Resources stack with Nova server to send messages to
stack = tobiko.required_setup_fixture(stacks.CirrosServerStackFixture)
def test_restart_ovn_controller(self):
'''Test that OVN controller agents can be restarted successfully
'''
self.stop_agent()
ping.ping_until_received(self.stack.ip_address).assert_replied()
self.start_agent()
ping.ping_until_received(self.stack.ip_address).assert_replied()
class BaseMetadataAgentTest(BaseAgentTest):
#: Resources stack with Nova server to send messages to
stack = tobiko.required_setup_fixture(stacks.CirrosServerStackFixture)
@ -547,6 +565,12 @@ class MetadataAgentTest(BaseAgentTest):
"Metadata server reached from Nova server:\n"
f"{curl_output}")
@neutron.skip_if_missing_networking_agents(neutron.METADATA_AGENT)
class MetadataAgentTest(BaseMetadataAgentTest):
agent_name = neutron.METADATA_AGENT
def test_metadata_service_restart(self):
# Ensure service is up
self.start_agent()
@ -568,6 +592,35 @@ class MetadataAgentTest(BaseAgentTest):
self.wait_for_metadata_status(is_reachable=True)
# TODO(eolivare): these tests will always be skipped on OSP13 because 'agent
# list' requests return empty list with OVN+OSP13
# Search for the corresponding container instead of the networking agent
@neutron.skip_if_missing_networking_agents(neutron.OVN_METADATA_AGENT)
class OvnMetadataAgentTest(BaseMetadataAgentTest):
agent_name = neutron.OVN_METADATA_AGENT
def test_ovn_metadata_agent_restart(self):
# Ensure service is up
self.start_agent()
self.wait_for_metadata_status(is_reachable=True)
# Ensure the servive gets down
self.stop_agent()
self.wait_for_metadata_status(is_reachable=False)
# Ensure service gets up again
self.start_agent()
self.wait_for_metadata_status(is_reachable=True)
def test_vm_reachability_when_ovn_metadata_agent_is_down(self):
self.stop_agent()
self.wait_for_metadata_status(is_reachable=False)
ping.ping_until_received(self.stack.ip_address).assert_replied()
self.start_agent()
self.wait_for_metadata_status(is_reachable=True)
def parse_http_status(curl_output: str) -> int:
http_head = curl_output.split('\n', 1)[0]
return int(http_head.split(' ', 2)[1])

View File

@ -33,14 +33,18 @@ class TripleoTopology(topology.OpenStackTopology):
neutron.DHCP_AGENT: 'tripleo_neutron_dhcp',
neutron.L3_AGENT: 'tripleo_neutron_l3_agent',
neutron.OPENVSWITCH_AGENT: 'tripleo_neutron_ovs_agent',
neutron.METADATA_AGENT: 'tripleo_neutron_metadata_agent'
neutron.METADATA_AGENT: 'tripleo_neutron_metadata_agent',
neutron.OVN_METADATA_AGENT: 'tripleo_ovn_metadata_agent',
neutron.OVN_CONTROLLER: 'tripleo_ovn_controller'
}
agent_to_container_name_mappings = {
neutron.DHCP_AGENT: 'neutron_dhcp',
neutron.L3_AGENT: 'neutron_l3_agent',
neutron.OPENVSWITCH_AGENT: 'neutron_ovs_agent',
neutron.METADATA_AGENT: 'neutron_metadata_agent'
neutron.METADATA_AGENT: 'neutron_metadata_agent',
neutron.OVN_METADATA_AGENT: 'ovn_metadata_agent',
neutron.OVN_CONTROLLER: 'ovn_controller'
}
has_containers = True