From 197da7188d572b629b7ade52f03edb0dbea9f940 Mon Sep 17 00:00:00 2001 From: Eduardo Olivares Date: Fri, 2 Feb 2024 17:44:43 +0100 Subject: [PATCH] class OvnUnsupportedDhcpOptionReader skipped with Podified setups The implementation of OvnUnsupportedDhcpOptionReader requires to connect to controller nodes and access neutron logs, which is not supported yet The module tobiko.openstack.topology._neutron has been moved to tobiko.openstack.neutron.neutron_log_reader because it only includes neutron-related operations. Change-Id: I56f222da145399ddfa8096bb92fde500b1b8c6d1 --- .../_neutron.py => neutron/neutron_log_reader.py} | 12 +++++++----- tobiko/openstack/topology/__init__.py | 11 +++-------- tobiko/podified/__init__.py | 1 + tobiko/podified/_topology.py | 3 +++ tobiko/tests/scenario/neutron/test_port.py | 7 ++++--- 5 files changed, 18 insertions(+), 16 deletions(-) rename tobiko/openstack/{topology/_neutron.py => neutron/neutron_log_reader.py} (95%) diff --git a/tobiko/openstack/topology/_neutron.py b/tobiko/openstack/neutron/neutron_log_reader.py similarity index 95% rename from tobiko/openstack/topology/_neutron.py rename to tobiko/openstack/neutron/neutron_log_reader.py index 6596d1ceb..18f811f3b 100644 --- a/tobiko/openstack/topology/_neutron.py +++ b/tobiko/openstack/neutron/neutron_log_reader.py @@ -22,8 +22,9 @@ from oslo_log import log import tobiko from tobiko.openstack import neutron -from tobiko.openstack.topology import _config -from tobiko.openstack.topology import _topology +from tobiko.openstack.neutron import _agent +from tobiko.openstack import topology +from tobiko import podified from tobiko.shell import files @@ -49,14 +50,14 @@ class NeutronNovaCommonReader(tobiko.SharedFixture): groups: typing.List[str] message_pattern: str datetime_pattern: typing.Pattern - config = tobiko.required_fixture(_config.OpenStackTopologyConfig) + config = tobiko.required_fixture(topology.OpenStackTopologyConfig) service_name = neutron.SERVER def setup_fixture(self): self.datetime_pattern = re.compile( self.config.conf.log_datetime_pattern) self.log_digger = self.useFixture( - _topology.get_log_file_digger( + topology.get_log_file_digger( service_name=self.service_name, groups=self.groups, pattern=self.message_pattern)) @@ -129,7 +130,8 @@ class UnsupportedDhcpOptionMessage(typing.NamedTuple): return self.timestamp < other.timestamp -@neutron.skip_unless_is_ovn() +@podified.skip_if_podified +@_agent.skip_unless_is_ovn() class OvnUnsupportedDhcpOptionReader(NeutronNovaCommonReader): groups = ['controller'] message_pattern = ( diff --git a/tobiko/openstack/topology/__init__.py b/tobiko/openstack/topology/__init__.py index d2e0ac19b..fe1620272 100644 --- a/tobiko/openstack/topology/__init__.py +++ b/tobiko/openstack/topology/__init__.py @@ -14,9 +14,9 @@ from __future__ import absolute_import from tobiko.openstack.topology import _assert +from tobiko.openstack.topology import _config from tobiko.openstack.topology import _exception from tobiko.openstack.topology import _namespace -from tobiko.openstack.topology import _neutron from tobiko.openstack.topology import _topology from tobiko.openstack.topology import _sh @@ -26,12 +26,6 @@ assert_unreachable_nodes = _assert.assert_unreachable_nodes NoSuchOpenStackTopologyNodeGroup = _exception.NoSuchOpenStackTopologyNodeGroup NoSuchOpenStackTopologyNode = _exception.NoSuchOpenStackTopologyNode -NeutronNovaResponse = _neutron.NeutronNovaResponse -NeutronNovaResponseReader = _neutron.NeutronNovaResponseReader -read_neutron_nova_responses = _neutron.read_neutron_nova_responses -assert_ovn_unsupported_dhcp_option_messages = ( - _neutron.assert_ovn_unsupported_dhcp_option_messages) - get_hosts_namespaces = _namespace.get_hosts_namespaces assert_namespace_in_hosts = _namespace.assert_namespace_in_hosts assert_namespace_not_in_hosts = _namespace.assert_namespace_not_in_hosts @@ -65,5 +59,6 @@ verify_osp_version = _topology.verify_osp_version get_config_setting = _topology.get_config_setting node_name_from_hostname = _topology.node_name_from_hostname remove_duplications = _topology.remove_duplications - OpenstackGroupNamesType = _topology.OpenstackGroupNamesType + +OpenStackTopologyConfig = _config.OpenStackTopologyConfig diff --git a/tobiko/podified/__init__.py b/tobiko/podified/__init__.py index 310a09251..06e39942b 100644 --- a/tobiko/podified/__init__.py +++ b/tobiko/podified/__init__.py @@ -27,6 +27,7 @@ EDPM_OTHER_GROUP = _openshift.EDPM_OTHER_GROUP PodifiedTopology = _topology.PodifiedTopology skip_if_not_podified = _topology.skip_if_not_podified +skip_if_podified = _topology.skip_if_podified get_dataplane_ssh_keypair = _openshift.get_dataplane_ssh_keypair has_podified_cp = _openshift.has_podified_cp diff --git a/tobiko/podified/_topology.py b/tobiko/podified/_topology.py index 3300d82bb..d12e8dd7a 100644 --- a/tobiko/podified/_topology.py +++ b/tobiko/podified/_topology.py @@ -33,6 +33,9 @@ LOG = log.getLogger(__name__) skip_if_not_podified = tobiko.skip_unless( "Podified deployment not configured", _openshift.has_podified_cp ) +skip_if_podified = tobiko.skip_if( + "This test cannot run on a Podified deployment", _openshift.has_podified_cp +) # In Podified topology there are groups like 'edpm-compute', 'edpm-networker' # and 'edpm-other' but we need to provide also "virtual" group which will diff --git a/tobiko/tests/scenario/neutron/test_port.py b/tobiko/tests/scenario/neutron/test_port.py index b8058ade2..375d054b3 100644 --- a/tobiko/tests/scenario/neutron/test_port.py +++ b/tobiko/tests/scenario/neutron/test_port.py @@ -29,6 +29,7 @@ from tobiko.shell import ping from tobiko.shell import ip from tobiko.shell import sh from tobiko.openstack import neutron +from tobiko.openstack.neutron import neutron_log_reader from tobiko.openstack import stacks from tobiko.openstack import topology from tobiko.tripleo import overcloud @@ -185,7 +186,7 @@ class ExtraDhcpOptsPortLoggingTest(testtools.TestCase): def test_extra_dhcp_opts_logs_unsupported_options(self): # initialize logs that match the pattern - topology.assert_ovn_unsupported_dhcp_option_messages() + neutron_log_reader.assert_ovn_unsupported_dhcp_option_messages() wrong_ipv4_option = 'wrong-ipv4-option' wrong_ipv6_option = 'bananas' @@ -211,7 +212,7 @@ class ExtraDhcpOptsPortLoggingTest(testtools.TestCase): invalid_options = [wrong_ipv4_option, a_valid_ipv4_option_used_for_ipv6] # assert every invalid dhcp option is logged - topology.assert_ovn_unsupported_dhcp_option_messages( + neutron_log_reader.assert_ovn_unsupported_dhcp_option_messages( unsupported_options=invalid_options, port_uuid=port['id']) @@ -223,6 +224,6 @@ class ExtraDhcpOptsPortLoggingTest(testtools.TestCase): **{'extra_dhcp_opts': extra_dhcp_opts}) invalid_options.append(wrong_ipv6_option) # assert every invalid dhcp option is logged - topology.assert_ovn_unsupported_dhcp_option_messages( + neutron_log_reader.assert_ovn_unsupported_dhcp_option_messages( unsupported_options=invalid_options, port_uuid=port['id'])