Add Neutron OVS agent faults tests

This patch adds faults test for neutron-ovs-agent. Test checks
if vm can be still reachable when Neutron OVS agent's process is
down.

Change-Id: I2a414349dff710ca256891cc8ef3b98070cf2633
This commit is contained in:
Slawek Kaplonski 2020-03-14 23:16:53 +01:00 committed by Federico Ressi
parent 4b2c921194
commit 5d003d5677
3 changed files with 50 additions and 0 deletions

View File

@ -156,6 +156,7 @@ class OpenStackTopology(tobiko.SharedFixture):
agent_to_service_name_mappings = {
'neutron-dhcp-agent': 'devstack@q-dhcp',
'neutron-l3-agent': 'devstack@q-l3',
'neutron-ovs-agent': 'devstack@q-agt',
}
def __init__(self):

View File

@ -20,6 +20,7 @@ import tobiko
from tobiko.openstack import neutron
from tobiko.openstack import stacks
from tobiko.openstack import topology
from tobiko.shell import ping
from tobiko.shell import sh
@ -196,3 +197,50 @@ class L3AgentTest(testtools.TestCase, AgentTestMixin):
router_radvd_pids,
self.get_process_pids_for_resource(
"radvd", self.router_id, network_l3_agents))
class OvsAgentTest(testtools.TestCase, AgentTestMixin):
#: Resources stack with Nova server to send messages to
stack = tobiko.required_setup_fixture(stacks.CirrosServerStackFixture)
agent_type = 'Open vSwitch agent'
def setUp(self):
super(OvsAgentTest, self).setUp()
os_topology = topology.get_openstack_topology()
self.agent_service_name = os_topology.get_agent_service_name(
"neutron-ovs-agent")
if not self.agent_service_name:
self.skip("Neutron OVS agent's service name not defined for "
"the topology %s" % os_topology)
self.ovs_agents = neutron.list_agents(agent_type=self.agent_type)
if not self.ovs_agents:
self.skip("No Neutron OVS agents found in the cloud.")
self.stopped_agents = []
def tearDown(self):
super(OvsAgentTest, self).tearDown()
# Try to start all agents which may be down during the tests
self.start_service_on_agents(
self.agent_service_name, self.stopped_agents)
def _get_agent_from_host(self, host):
for agent in self.ovs_agents:
if agent['host'] == host.name:
return agent
def test_vm_reachability_during_stop_ovs_agent(self):
# Check if vm is reachable before test
ping.ping_until_received(
self.stack.ip_address).assert_replied()
vm_host = topology.get_openstack_node(
hostname=self.stack.hypervisor_host)
agent = self._get_agent_from_host(vm_host)
self.stop_service_on_agents(self.agent_service_name, [agent])
ping.ping_until_received(
self.stack.floating_ip_address).assert_replied()
self.start_service_on_agents(self.agent_service_name, [agent])

View File

@ -30,6 +30,7 @@ class TripleoTopology(topology.OpenStackTopology):
agent_to_service_name_mappings = {
'neutron-dhcp-agent': 'tripleo_neutron_dhcp',
'neutron-l3-agent': 'tripleo_neutron_l3',
'neutron-ovs-agent': 'tripleo_neutron_ovs_agent',
}
def discover_nodes(self):