diff --git a/neutron/objects/logapi/event_types.py b/neutron/objects/logapi/event_types.py deleted file mode 100644 index 7a96ba02318..00000000000 --- a/neutron/objects/logapi/event_types.py +++ /dev/null @@ -1,38 +0,0 @@ -# All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. You may obtain -# a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. - -from neutron_lib.services.logapi import constants as log_const -from oslo_versionedobjects import fields as obj_fields - -from neutron._i18n import _ - - -class SecurityEvent(obj_fields.String): - def __init__(self, valid_values, **kwargs): - self._valid_values = valid_values - super(SecurityEvent, self).__init__(**kwargs) - - def coerce(self, obj, attr, value): - if value not in self._valid_values: - msg = ( - _("Field value %(value)s is not in the list " - "of valid values: %(values)s") % - {'value': value, 'values': self._valid_values} - ) - raise ValueError(msg) - return super(SecurityEvent, self).coerce(obj, attr, value) - - -class SecurityEventField(obj_fields.AutoTypedField): - AUTO_TYPE = SecurityEvent(valid_values=log_const.LOG_EVENTS) diff --git a/neutron/objects/logapi/logging_resource.py b/neutron/objects/logapi/logging_resource.py index 3cbb73d91ac..e11548f2d62 100644 --- a/neutron/objects/logapi/logging_resource.py +++ b/neutron/objects/logapi/logging_resource.py @@ -13,13 +13,13 @@ # License for the specific language governing permissions and limitations # under the License. +from neutron_lib.objects.logapi import event_types from neutron_lib.services.logapi import constants as log_const from oslo_versionedobjects import fields as obj_fields from neutron.db.models import loggingapi as log_db from neutron.objects import base from neutron.objects import common_types -from neutron.objects.logapi import event_types @base.NeutronObjectRegistry.register diff --git a/neutron/tests/unit/objects/test_base.py b/neutron/tests/unit/objects/test_base.py index 0ecd3acd2e7..85f7eaaf676 100644 --- a/neutron/tests/unit/objects/test_base.py +++ b/neutron/tests/unit/objects/test_base.py @@ -24,6 +24,7 @@ from neutron_lib.db import api as db_api from neutron_lib.db import model_query from neutron_lib import exceptions as n_exc from neutron_lib.objects import exceptions as o_exc +from neutron_lib.objects.logapi import event_types from neutron_lib.objects import utils as obj_utils from neutron_lib.tests import tools as lib_test_tools from neutron_lib.utils import helpers @@ -42,7 +43,6 @@ from neutron.objects import base from neutron.objects import common_types from neutron.objects.db import api as obj_db_api from neutron.objects import flavor -from neutron.objects.logapi import event_types from neutron.objects import network as net_obj from neutron.objects import ports from neutron.objects.qos import policy as qos_policy