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
This commit is contained in:
Eduardo Olivares 2024-02-02 17:44:43 +01:00
parent 26dbe89b9d
commit 197da7188d
5 changed files with 18 additions and 16 deletions

View File

@ -22,8 +22,9 @@ from oslo_log import log
import tobiko import tobiko
from tobiko.openstack import neutron from tobiko.openstack import neutron
from tobiko.openstack.topology import _config from tobiko.openstack.neutron import _agent
from tobiko.openstack.topology import _topology from tobiko.openstack import topology
from tobiko import podified
from tobiko.shell import files from tobiko.shell import files
@ -49,14 +50,14 @@ class NeutronNovaCommonReader(tobiko.SharedFixture):
groups: typing.List[str] groups: typing.List[str]
message_pattern: str message_pattern: str
datetime_pattern: typing.Pattern datetime_pattern: typing.Pattern
config = tobiko.required_fixture(_config.OpenStackTopologyConfig) config = tobiko.required_fixture(topology.OpenStackTopologyConfig)
service_name = neutron.SERVER service_name = neutron.SERVER
def setup_fixture(self): def setup_fixture(self):
self.datetime_pattern = re.compile( self.datetime_pattern = re.compile(
self.config.conf.log_datetime_pattern) self.config.conf.log_datetime_pattern)
self.log_digger = self.useFixture( self.log_digger = self.useFixture(
_topology.get_log_file_digger( topology.get_log_file_digger(
service_name=self.service_name, service_name=self.service_name,
groups=self.groups, groups=self.groups,
pattern=self.message_pattern)) pattern=self.message_pattern))
@ -129,7 +130,8 @@ class UnsupportedDhcpOptionMessage(typing.NamedTuple):
return self.timestamp < other.timestamp return self.timestamp < other.timestamp
@neutron.skip_unless_is_ovn() @podified.skip_if_podified
@_agent.skip_unless_is_ovn()
class OvnUnsupportedDhcpOptionReader(NeutronNovaCommonReader): class OvnUnsupportedDhcpOptionReader(NeutronNovaCommonReader):
groups = ['controller'] groups = ['controller']
message_pattern = ( message_pattern = (

View File

@ -14,9 +14,9 @@
from __future__ import absolute_import from __future__ import absolute_import
from tobiko.openstack.topology import _assert from tobiko.openstack.topology import _assert
from tobiko.openstack.topology import _config
from tobiko.openstack.topology import _exception from tobiko.openstack.topology import _exception
from tobiko.openstack.topology import _namespace from tobiko.openstack.topology import _namespace
from tobiko.openstack.topology import _neutron
from tobiko.openstack.topology import _topology from tobiko.openstack.topology import _topology
from tobiko.openstack.topology import _sh from tobiko.openstack.topology import _sh
@ -26,12 +26,6 @@ assert_unreachable_nodes = _assert.assert_unreachable_nodes
NoSuchOpenStackTopologyNodeGroup = _exception.NoSuchOpenStackTopologyNodeGroup NoSuchOpenStackTopologyNodeGroup = _exception.NoSuchOpenStackTopologyNodeGroup
NoSuchOpenStackTopologyNode = _exception.NoSuchOpenStackTopologyNode 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 get_hosts_namespaces = _namespace.get_hosts_namespaces
assert_namespace_in_hosts = _namespace.assert_namespace_in_hosts assert_namespace_in_hosts = _namespace.assert_namespace_in_hosts
assert_namespace_not_in_hosts = _namespace.assert_namespace_not_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 get_config_setting = _topology.get_config_setting
node_name_from_hostname = _topology.node_name_from_hostname node_name_from_hostname = _topology.node_name_from_hostname
remove_duplications = _topology.remove_duplications remove_duplications = _topology.remove_duplications
OpenstackGroupNamesType = _topology.OpenstackGroupNamesType OpenstackGroupNamesType = _topology.OpenstackGroupNamesType
OpenStackTopologyConfig = _config.OpenStackTopologyConfig

View File

@ -27,6 +27,7 @@ EDPM_OTHER_GROUP = _openshift.EDPM_OTHER_GROUP
PodifiedTopology = _topology.PodifiedTopology PodifiedTopology = _topology.PodifiedTopology
skip_if_not_podified = _topology.skip_if_not_podified 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 get_dataplane_ssh_keypair = _openshift.get_dataplane_ssh_keypair
has_podified_cp = _openshift.has_podified_cp has_podified_cp = _openshift.has_podified_cp

View File

@ -33,6 +33,9 @@ LOG = log.getLogger(__name__)
skip_if_not_podified = tobiko.skip_unless( skip_if_not_podified = tobiko.skip_unless(
"Podified deployment not configured", _openshift.has_podified_cp "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' # In Podified topology there are groups like 'edpm-compute', 'edpm-networker'
# and 'edpm-other' but we need to provide also "virtual" group which will # and 'edpm-other' but we need to provide also "virtual" group which will

View File

@ -29,6 +29,7 @@ from tobiko.shell import ping
from tobiko.shell import ip from tobiko.shell import ip
from tobiko.shell import sh from tobiko.shell import sh
from tobiko.openstack import neutron from tobiko.openstack import neutron
from tobiko.openstack.neutron import neutron_log_reader
from tobiko.openstack import stacks from tobiko.openstack import stacks
from tobiko.openstack import topology from tobiko.openstack import topology
from tobiko.tripleo import overcloud from tobiko.tripleo import overcloud
@ -185,7 +186,7 @@ class ExtraDhcpOptsPortLoggingTest(testtools.TestCase):
def test_extra_dhcp_opts_logs_unsupported_options(self): def test_extra_dhcp_opts_logs_unsupported_options(self):
# initialize logs that match the pattern # 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_ipv4_option = 'wrong-ipv4-option'
wrong_ipv6_option = 'bananas' wrong_ipv6_option = 'bananas'
@ -211,7 +212,7 @@ class ExtraDhcpOptsPortLoggingTest(testtools.TestCase):
invalid_options = [wrong_ipv4_option, invalid_options = [wrong_ipv4_option,
a_valid_ipv4_option_used_for_ipv6] a_valid_ipv4_option_used_for_ipv6]
# assert every invalid dhcp option is logged # 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, unsupported_options=invalid_options,
port_uuid=port['id']) port_uuid=port['id'])
@ -223,6 +224,6 @@ class ExtraDhcpOptsPortLoggingTest(testtools.TestCase):
**{'extra_dhcp_opts': extra_dhcp_opts}) **{'extra_dhcp_opts': extra_dhcp_opts})
invalid_options.append(wrong_ipv6_option) invalid_options.append(wrong_ipv6_option)
# assert every invalid dhcp option is logged # 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, unsupported_options=invalid_options,
port_uuid=port['id']) port_uuid=port['id'])