mypy: Use tuple type for SUPPORTED_LOGGING_TYPES

Change-Id: I92729f321a216ef646934c40061d94c3f8c91251
This commit is contained in:
Ihar Hrachyshka 2024-09-18 22:11:52 -04:00
parent 943d26da20
commit e163bb5b6c
10 changed files with 9 additions and 10 deletions

View File

@ -79,7 +79,6 @@ exclude = (?x)(
| ^neutron/plugins/ml2/drivers/ovn/mech_driver/ovsdb/commands.py$ | ^neutron/plugins/ml2/drivers/ovn/mech_driver/ovsdb/commands.py$
| ^neutron/plugins/ml2/drivers/ovn/mech_driver/ovsdb/ovn_client.py$ | ^neutron/plugins/ml2/drivers/ovn/mech_driver/ovsdb/ovn_client.py$
| ^neutron/plugins/ml2/drivers/ovn/mech_driver/ovsdb/ovsdb_monitor.py$ | ^neutron/plugins/ml2/drivers/ovn/mech_driver/ovsdb/ovsdb_monitor.py$
| ^neutron/services/logapi/drivers/openvswitch/ovs_firewall_log.py$
| ^neutron/tests/$ | ^neutron/tests/$
) )

View File

@ -37,7 +37,7 @@ class LoggingDriver(object, metaclass=abc.ABCMeta):
"""Defines abstract interface for logging driver""" """Defines abstract interface for logging driver"""
# specific logging types are supported # specific logging types are supported
SUPPORTED_LOGGING_TYPES = None SUPPORTED_LOGGING_TYPES = tuple()
@abc.abstractmethod @abc.abstractmethod
def initialize(self, resource_rpc, **kwargs): def initialize(self, resource_rpc, **kwargs):

View File

@ -28,7 +28,7 @@ LOG = logging.getLogger(__name__)
DRIVER = None DRIVER = None
SUPPORTED_LOGGING_TYPES = ['security_group'] SUPPORTED_LOGGING_TYPES = ('security_group',)
class OVSDriver(base.DriverBase): class OVSDriver(base.DriverBase):

View File

@ -131,7 +131,7 @@ class OFPortLog(object):
class OVSFirewallLoggingDriver(log_ext.LoggingDriver): class OVSFirewallLoggingDriver(log_ext.LoggingDriver):
SUPPORTED_LOGGING_TYPES = ['security_group'] SUPPORTED_LOGGING_TYPES = ('security_group',)
REQUIRED_PROTOCOLS = [ REQUIRED_PROTOCOLS = [
ovs_consts.OPENFLOW13, ovs_consts.OPENFLOW13,
ovs_consts.OPENFLOW14, ovs_consts.OPENFLOW14,

View File

@ -41,7 +41,7 @@ DRIVER = None
log_cfg.register_log_driver_opts() log_cfg.register_log_driver_opts()
MAX_INT_LABEL = 2**32 MAX_INT_LABEL = 2**32
SUPPORTED_LOGGING_TYPES = [log_const.SECURITY_GROUP] SUPPORTED_LOGGING_TYPES = (log_const.SECURITY_GROUP,)
class LoggingNotSupported(n_exceptions.NeutronException): class LoggingNotSupported(n_exceptions.NeutronException):

View File

@ -32,7 +32,7 @@ _uuid = uuidutils.generate_uuid
class FakeLogDriver(log_ext.LoggingDriver): class FakeLogDriver(log_ext.LoggingDriver):
SUPPORTED_LOGGING_TYPES = ['fake_resource'] SUPPORTED_LOGGING_TYPES = ('fake_resource',)
def initialize(self, resource_rpc, **kwargs): def initialize(self, resource_rpc, **kwargs):
pass pass

View File

@ -33,7 +33,7 @@ from neutron.tests import base
class FakeLogDriver(log_ext.LoggingDriver): class FakeLogDriver(log_ext.LoggingDriver):
SUPPORTED_LOGGING_TYPES = ['security_group'] SUPPORTED_LOGGING_TYPES = ('security_group',)
def initialize(self, resource_rpc, **kwargs): def initialize(self, resource_rpc, **kwargs):
pass pass

View File

@ -112,7 +112,7 @@ class TestOVSFirewallLoggingDriver(base.BaseTestCase):
agent_rpc, 'LoggingApiStub', autospec=True).start() agent_rpc, 'LoggingApiStub', autospec=True).start()
self.log_driver.start_logapp = mock.Mock() self.log_driver.start_logapp = mock.Mock()
self.log_driver.initialize(resource_rpc_mock) self.log_driver.initialize(resource_rpc_mock)
self.log_driver.SUPPORTED_LOGGING_TYPES = ['security_group'] self.log_driver.SUPPORTED_LOGGING_TYPES = ('security_group',)
self.mock_bridge = self.log_driver.int_br self.mock_bridge = self.log_driver.int_br
self.mock_bridge.reset_mock() self.mock_bridge.reset_mock()
self.fake_ovs_port = FakeOVSPort('port', 1, '00:00:00:00:00:00') self.fake_ovs_port = FakeOVSPort('port', 1, '00:00:00:00:00:00')

View File

@ -18,7 +18,7 @@ from neutron_lib.api.definitions import portbindings
from neutron.services.logapi.drivers import base as log_base_driver from neutron.services.logapi.drivers import base as log_base_driver
from neutron.tests import base from neutron.tests import base
SUPPORTED_LOGGING_TYPES = ['security_group'] SUPPORTED_LOGGING_TYPES = ('security_group',)
class FakeDriver(log_base_driver.DriverBase): class FakeDriver(log_base_driver.DriverBase):

View File

@ -30,7 +30,7 @@ from neutron.services.logapi.common import sg_validate
from neutron.tests.unit.services.logapi import base from neutron.tests.unit.services.logapi import base
DB_PLUGIN_KLASS = 'neutron.db.db_base_plugin_v2.NeutronDbPluginV2' DB_PLUGIN_KLASS = 'neutron.db.db_base_plugin_v2.NeutronDbPluginV2'
SUPPORTED_LOGGING_TYPES = ['security_group'] SUPPORTED_LOGGING_TYPES = ('security_group',)
class TestLoggingPlugin(base.BaseLogTestCase): class TestLoggingPlugin(base.BaseLogTestCase):