`OvnMetadataAgentTest
` to test OVN agent too
The class test ``OvnMetadataAgentTest`` can be executed with two different agents: * OVN Metadata agent, that is being deprecated. * OVN agent, that can be configured with the metadata extension and provide the same functionality as the first one. Also switched to F41 guest image as F40 moved to https://archives.fedoraproject.org. Depends-On: https://review.opendev.org/c/openstack/neutron/+/956174 Closes-Bug: #2118398 Closes-Bug: #2118902 Signed-off-by: Rodolfo Alonso Hernandez <ralonsoh@redhat.com> Change-Id: I760add39a052f4ae46385df24497e6487836f693
This commit is contained in:

committed by
Rodolfo Alonso

parent
1cd797b19d
commit
225707f026
@@ -6,8 +6,8 @@ Ansible role but if Tobiko tests are executed locally it may be needed to
|
||||
prepare such image and upload it to Glance.
|
||||
This can be done with simple script::
|
||||
|
||||
$ wget https://download.fedoraproject.org/pub/fedora/linux/releases/40/Cloud/x86_64/images/Fedora-Cloud-Base-Generic.x86_64-40-1.14.qcow2 \
|
||||
-O /tmp/Fedora-Cloud-Base-Generic.x86_64-40-1.14.qcow2
|
||||
$ wget https://download.fedoraproject.org/pub/fedora/linux/releases/41/Cloud/x86_64/images/Fedora-Cloud-Base-Generic-41-1.4.x86_64.qcow2 \
|
||||
-O /tmp/Fedora-Cloud-Base-Generic-41-1.4.x86_64.qcow2
|
||||
|
||||
$ cat << EOF > /tmp/iperf3-server.service
|
||||
[Unit]
|
||||
@@ -35,7 +35,7 @@ This can be done with simple script::
|
||||
EOF
|
||||
|
||||
$ TMPPATH=$(mktemp)
|
||||
$ cp /tmp/Fedora-Cloud-Base-Generic.x86_64-40-1.14.qcow2 $TMPPATH
|
||||
$ cp /tmp/Fedora-Cloud-Base-Generic-41-1.4.x86_64.qcow2 $TMPPATH
|
||||
$ LIBGUESTFS_BACKEND=direct
|
||||
$ virt-customize -a $TMPPATH \
|
||||
--copy-in /tmp/config:/etc/selinux \
|
||||
|
@@ -63,7 +63,7 @@ download_images_default:
|
||||
advanced_vm:
|
||||
username: fedora
|
||||
type: advanced_vm
|
||||
url: "https://download.fedoraproject.org/pub/fedora/linux/releases/40/Cloud/x86_64/images/Fedora-Cloud-Base-Generic.x86_64-40-1.14.qcow2"
|
||||
url: "https://download.fedoraproject.org/pub/fedora/linux/releases/41/Cloud/x86_64/images/Fedora-Cloud-Base-Generic-41-1.4.x86_64.qcow2"
|
||||
customized: false
|
||||
copy_in_files:
|
||||
- nginx_id.conf
|
||||
|
@@ -35,6 +35,7 @@ OPENVSWITCH_AGENT = _agent.OPENVSWITCH_AGENT
|
||||
OVN_CONTROLLER = _agent.OVN_CONTROLLER
|
||||
OVN_METADATA_AGENT = _agent.OVN_METADATA_AGENT
|
||||
NEUTRON_OVN_METADATA_AGENT = _agent.NEUTRON_OVN_METADATA_AGENT
|
||||
NEUTRON_OVN_AGENT = _agent.NEUTRON_OVN_AGENT
|
||||
OVN_BGP_AGENT = _agent.OVN_BGP_AGENT
|
||||
FRR = _agent.FRR
|
||||
NEUTRON = _agent.NEUTRON
|
||||
@@ -53,6 +54,7 @@ list_agents = _agent.list_agents
|
||||
list_dhcp_agent_hosting_network = _agent.list_dhcp_agent_hosting_network
|
||||
list_l3_agent_hosting_routers = _agent.list_l3_agent_hosting_routers
|
||||
list_networking_agents = _agent.list_networking_agents
|
||||
has_networking_agents = _agent.has_networking_agents
|
||||
skip_if_missing_networking_agents = _agent.skip_if_missing_networking_agents
|
||||
skip_unless_is_ovn = _agent.skip_unless_is_ovn
|
||||
skip_unless_is_ovs = _agent.skip_unless_is_ovs
|
||||
|
@@ -38,6 +38,7 @@ OVN_CONTROLLER = 'ovn-controller'
|
||||
# called 'neutron-ovn-metadata-agent'
|
||||
OVN_METADATA_AGENT = 'networking-ovn-metadata-agent'
|
||||
NEUTRON_OVN_METADATA_AGENT = 'neutron-ovn-metadata-agent'
|
||||
NEUTRON_OVN_AGENT = 'neutron-ovn-agent'
|
||||
OVN_BGP_AGENT = 'ovn-bgp-agent'
|
||||
FRR = 'frr'
|
||||
NEUTRON = 'neutron'
|
||||
|
@@ -294,6 +294,7 @@ class OpenStackTopology(tobiko.SharedFixture):
|
||||
neutron.METADATA_AGENT: 'devstack@q-meta',
|
||||
neutron.OVN_METADATA_AGENT: 'devstack@q-ovn-metadata-agent',
|
||||
neutron.NEUTRON_OVN_METADATA_AGENT: 'devstack@q-ovn-metadata-agent',
|
||||
neutron.NEUTRON_OVN_AGENT: 'devstack@q-ovn-agent',
|
||||
neutron.OVN_CONTROLLER: 'ovn-controller',
|
||||
neutron.OVN_BGP_AGENT: 'ovn-bgp-agent',
|
||||
neutron.FRR: 'frr',
|
||||
|
@@ -64,6 +64,7 @@ class PodifiedTopology(rhosp.RhospTopology):
|
||||
neutron.METADATA_AGENT: 'edpm_neutron_metadata_agent',
|
||||
neutron.OVN_METADATA_AGENT: 'edpm_ovn_metadata_agent',
|
||||
neutron.NEUTRON_OVN_METADATA_AGENT: 'edpm_ovn_metadata_agent',
|
||||
neutron.NEUTRON_OVN_AGENT: 'edpm_ovn_agent',
|
||||
neutron.OVN_CONTROLLER: 'edpm_ovn_controller',
|
||||
neutron.OVN_BGP_AGENT: 'edpm_ovn_bgp_agent',
|
||||
neutron.FRR: 'edpm_frr'
|
||||
@@ -77,6 +78,7 @@ class PodifiedTopology(rhosp.RhospTopology):
|
||||
neutron.METADATA_AGENT: 'neutron_metadata_agent',
|
||||
neutron.OVN_METADATA_AGENT: 'ovn_metadata_agent',
|
||||
neutron.NEUTRON_OVN_METADATA_AGENT: 'ovn_metadata_agent',
|
||||
neutron.NEUTRON_OVN_AGENT: 'ovn_agent',
|
||||
neutron.OVN_CONTROLLER: 'ovn_controller',
|
||||
neutron.OVN_BGP_AGENT: 'ovn_bgp_agent',
|
||||
neutron.FRR: 'frr'
|
||||
|
@@ -48,15 +48,39 @@ RESTART = "restart"
|
||||
|
||||
class BaseAgentTest(testtools.TestCase):
|
||||
|
||||
agent_name: str = '<undefined agent name>'
|
||||
_agent_name: typing.Union[str, typing.List[str]] = '<undefined agent name>'
|
||||
|
||||
@classmethod
|
||||
def setUpClass(cls):
|
||||
cls.agent_name: str = cls._get_agent_name()
|
||||
cls.service_name: str = topology.get_agent_service_name(cls.agent_name)
|
||||
cls.container_name: str = ''
|
||||
cls.agents: AgentListType = \
|
||||
neutron.list_networking_agents(binary=cls.agent_name)
|
||||
|
||||
@classmethod
|
||||
def _get_agent_name(cls) -> str:
|
||||
"""Return the valid class agent
|
||||
|
||||
In case of defining more than one possible agent (OVN Metadata agent,
|
||||
OVN agent), this class first retrieves the agent list and determines
|
||||
which one applies. Some agents, like the ones provided in the example,
|
||||
are interchangeable but only one can be running.
|
||||
|
||||
If no agent is listed, the returned name will be first one provided;
|
||||
the class logic will skip the test later.
|
||||
"""
|
||||
if isinstance(cls._agent_name, str):
|
||||
return cls._agent_name
|
||||
|
||||
for _agent_name in cls._agent_name:
|
||||
if neutron.has_networking_agents(binary=_agent_name):
|
||||
return _agent_name
|
||||
|
||||
# Default the agent name to the first one in the list, but none of the
|
||||
# provided agent names are present in the system.
|
||||
return cls._agent_name[0]
|
||||
|
||||
def setUp(self):
|
||||
super(BaseAgentTest, self).setUp()
|
||||
if not self.agents:
|
||||
@@ -385,7 +409,7 @@ class BaseAgentTest(testtools.TestCase):
|
||||
|
||||
class DHCPAgentTest(BaseAgentTest):
|
||||
|
||||
agent_name = neutron.DHCP_AGENT
|
||||
_agent_name = neutron.DHCP_AGENT
|
||||
|
||||
#: Resources stack with Nova server to send messages to
|
||||
stack = tobiko.required_fixture(stacks.CirrosServerStackFixture)
|
||||
@@ -438,7 +462,7 @@ class DHCPAgentTest(BaseAgentTest):
|
||||
|
||||
class L3AgentTest(BaseAgentTest):
|
||||
|
||||
agent_name = neutron.L3_AGENT
|
||||
_agent_name = neutron.L3_AGENT
|
||||
|
||||
#: Resources stack with Nova server to send messages to
|
||||
stack = tobiko.required_fixture(stacks.CirrosPeerServerStackFixture)
|
||||
@@ -581,7 +605,7 @@ class L3AgentTest(BaseAgentTest):
|
||||
|
||||
class OpenVSwitchAgentTest(BaseAgentTest):
|
||||
|
||||
agent_name = neutron.OPENVSWITCH_AGENT
|
||||
_agent_name = neutron.OPENVSWITCH_AGENT
|
||||
|
||||
#: Resources stack with Nova server to send messages to
|
||||
stack = tobiko.required_fixture(stacks.CirrosServerStackFixture)
|
||||
@@ -607,7 +631,7 @@ class OpenVSwitchAgentTest(BaseAgentTest):
|
||||
|
||||
class OvnControllerTest(BaseAgentTest):
|
||||
|
||||
agent_name = neutron.OVN_CONTROLLER
|
||||
_agent_name = neutron.OVN_CONTROLLER
|
||||
|
||||
#: Resources stack with Nova server to send messages to
|
||||
stack = tobiko.required_fixture(stacks.CirrosServerStackFixture)
|
||||
@@ -820,7 +844,7 @@ class MetadataAgentTest(BaseAgentTest):
|
||||
#: Resources stack with Nova server to send messages to
|
||||
stack = tobiko.required_fixture(stacks.CirrosServerStackFixture)
|
||||
|
||||
agent_name = neutron.METADATA_AGENT
|
||||
_agent_name: typing.Union[str, typing.List[str]] = neutron.METADATA_AGENT
|
||||
|
||||
def wait_for_metadata_status(self, count=None, timeout=60., interval=2.,
|
||||
is_reachable: typing.Optional[bool] = None):
|
||||
@@ -911,7 +935,10 @@ class MetadataAgentTest(BaseAgentTest):
|
||||
# Search for the corresponding container instead of the networking agent
|
||||
class OvnMetadataAgentTest(MetadataAgentTest):
|
||||
|
||||
agent_name = neutron.NEUTRON_OVN_METADATA_AGENT
|
||||
_agent_name = [
|
||||
neutron.NEUTRON_OVN_METADATA_AGENT,
|
||||
neutron.NEUTRON_OVN_AGENT,
|
||||
]
|
||||
|
||||
def setUp(self):
|
||||
self.get_ovn_agents_from_containers()
|
||||
|
@@ -37,7 +37,7 @@
|
||||
--
|
||||
--collect-dir {{ test_collect_dir | quote }}
|
||||
--customized-fedora-image-url
|
||||
https://download.fedoraproject.org/pub/fedora/linux/releases/40/Cloud/x86_64/images/Fedora-Cloud-Base-Generic.x86_64-40-1.14.qcow2
|
||||
https://download.fedoraproject.org/pub/fedora/linux/releases/41/Cloud/x86_64/images/Fedora-Cloud-Base-Generic-41-1.4.x86_64.qcow2
|
||||
tox_environ:
|
||||
ANSIBLE_INVENTORY: '{{ test_inventory_file }}'
|
||||
zuul_output_dir: '{{ ansible_user_dir }}/zuul-output'
|
||||
|
Reference in New Issue
Block a user