use logapi constants from neutron-lib

Consume the logapi constants from neutron-lib by removing them from
neutron and using them from neutron-lib instead.

NeutronLibImpact

Depends-On: https://review.opendev.org/#/c/660826/
Change-Id: I55edf26598d38de34038f005b05ba3d2e96972aa
changes/27/660827/1
Boden R 4 years ago
parent 8887343782
commit 67b1c4552e
  1. 2
      neutron/objects/logapi/event_types.py
  2. 2
      neutron/objects/logapi/logging_resource.py
  3. 60
      neutron/services/logapi/common/constants.py
  4. 2
      neutron/services/logapi/common/db_api.py
  5. 3
      neutron/services/logapi/common/sg_callback.py
  6. 2
      neutron/services/logapi/common/sg_validate.py
  7. 2
      neutron/services/logapi/common/snat_validate.py
  8. 2
      neutron/services/logapi/drivers/base.py
  9. 2
      neutron/services/logapi/drivers/manager.py
  10. 2
      neutron/services/logapi/drivers/openvswitch/driver.py
  11. 2
      neutron/services/logapi/drivers/openvswitch/ovs_firewall_log.py
  12. 2
      neutron/services/logapi/logging_plugin.py
  13. 3
      neutron/services/logapi/rpc/agent.py
  14. 2
      neutron/services/logapi/rpc/server.py
  15. 3
      neutron/tests/tools.py
  16. 2
      neutron/tests/unit/services/logapi/common/test_db_api.py
  17. 2
      neutron/tests/unit/services/logapi/drivers/test_manager.py
  18. 2
      neutron/tests/unit/services/logapi/rpc/test_server.py

@ -12,10 +12,10 @@
# 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 _
from neutron.services.logapi.common import constants as log_const
class SecurityEvent(obj_fields.String):

@ -13,13 +13,13 @@
# 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.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
from neutron.services.logapi.common import constants as log_const
@base.NeutronObjectRegistry.register

@ -1,60 +0,0 @@
# Copyright 2017 Fujitsu Limited.
# 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.
ACCEPT_EVENT = 'ACCEPT'
DROP_EVENT = 'DROP'
ALL_EVENT = 'ALL'
LOG_EVENTS = [ACCEPT_EVENT, DROP_EVENT, ALL_EVENT]
LOGGING_PLUGIN = 'logging-plugin'
# supported logging types
SECURITY_GROUP = 'security_group'
# TODO(annp): Moving to neutron-lib
SNAT = 'snat'
# target resource types
PORT = 'port'
RPC_NAMESPACE_LOGGING = 'logging-plugin'
# Define for rpc_method_key
LOG_RESOURCE = 'log_resource'
# String literal for identifying log resource
LOGGING = 'log'
# Method names for Logging Driver
PRECOMMIT_POSTFIX = '_precommit'
CREATE_LOG = 'create_log'
CREATE_LOG_PRECOMMIT = CREATE_LOG + PRECOMMIT_POSTFIX
UPDATE_LOG = 'update_log'
UPDATE_LOG_PRECOMMIT = UPDATE_LOG + PRECOMMIT_POSTFIX
DELETE_LOG = 'delete_log'
DELETE_LOG_PRECOMMIT = DELETE_LOG + PRECOMMIT_POSTFIX
# Tell to agent when resources related log_objects update
RESOURCE_UPDATE = 'resource_update'
LOG_CALL_METHODS = (
CREATE_LOG,
CREATE_LOG_PRECOMMIT,
UPDATE_LOG,
UPDATE_LOG_PRECOMMIT,
DELETE_LOG,
DELETE_LOG_PRECOMMIT,
RESOURCE_UPDATE
)
DIRECTION_IP_PREFIX = {'ingress': 'source_ip_prefix',
'egress': 'dest_ip_prefix'}

@ -15,6 +15,7 @@
from neutron_lib import constants as const
from neutron_lib.db import api as db_api
from neutron_lib.services.logapi import constants
from oslo_log import log as logging
from sqlalchemy.orm import exc as orm_exc
@ -22,7 +23,6 @@ from neutron.db.models import securitygroup as sg_db
from neutron.objects.logapi import logging_resource as log_object
from neutron.objects import ports as port_objects
from neutron.objects import securitygroup as sg_object
from neutron.services.logapi.common import constants
from neutron.services.logapi.common import validators
LOG = logging.getLogger(__name__)

@ -13,7 +13,8 @@
# License for the specific language governing permissions and limitations
# under the License.
from neutron.services.logapi.common import constants as log_const
from neutron_lib.services.logapi import constants as log_const
from neutron.services.logapi.common import db_api
from neutron.services.logapi.drivers import manager

@ -13,6 +13,7 @@
# License for the specific language governing permissions and limitations
# under the License.
from neutron_lib.services.logapi import constants as log_const
from oslo_log import log as logging
from sqlalchemy.orm import exc as orm_exc
@ -20,7 +21,6 @@ from neutron.db import _utils as db_utils
from neutron.db.models import securitygroup as sg_db
from neutron.objects import ports
from neutron.objects import securitygroup as sg_object
from neutron.services.logapi.common import constants as log_const
from neutron.services.logapi.common import exceptions as log_exc
from neutron.services.logapi.common import validators

@ -13,10 +13,10 @@
# License for the specific language governing permissions and limitations
# under the License.
from neutron_lib.services.logapi import constants as log_const
from oslo_log import log as logging
from neutron.objects import router
from neutron.services.logapi.common import constants as log_const
from neutron.services.logapi.common import exceptions as log_exc
from neutron.services.logapi.common import validators

@ -15,9 +15,9 @@
from neutron_lib.callbacks import events
from neutron_lib.callbacks import registry
from neutron_lib.services.logapi import constants as log_const
from oslo_log import log as logging
from neutron.services.logapi.common import constants as log_const
from neutron.services.logapi.rpc import server as server_rpc
LOG = logging.getLogger(__name__)

@ -16,9 +16,9 @@
from neutron_lib.callbacks import events
from neutron_lib.callbacks import registry
from neutron_lib import exceptions
from neutron_lib.services.logapi import constants as log_const
from oslo_log import log as logging
from neutron.services.logapi.common import constants as log_const
from neutron.services.logapi.common import exceptions as log_exc
from neutron.services.logapi.rpc import server as server_rpc

@ -15,10 +15,10 @@
from neutron_lib.api.definitions import portbindings
from neutron_lib.callbacks import resources
from neutron_lib.services.logapi import constants as log_const
from oslo_log import log as logging
from oslo_utils import importutils
from neutron.services.logapi.common import constants as log_const
from neutron.services.logapi.common import sg_callback
from neutron.services.logapi.drivers import base
from neutron.services.logapi.drivers import manager

@ -16,6 +16,7 @@
import collections
from neutron_lib import constants as lib_const
from neutron_lib.services.logapi import constants as log_const
from os_ken.base import app_manager
from os_ken.lib.packet import packet
from oslo_config import cfg
@ -29,7 +30,6 @@ from neutron.agent.linux.openvswitch_firewall import rules
from neutron.plugins.ml2.drivers.openvswitch.agent.common import constants \
as ovs_consts
from neutron.services.logapi.agent import log_extension as log_ext
from neutron.services.logapi.common import constants as log_const
from neutron.services.logapi.common import exceptions as log_exc
from neutron.services.logapi.drivers.openvswitch import log_oskenapp

@ -15,12 +15,12 @@
from neutron_lib.api.definitions import logging
from neutron_lib.db import api as db_api
from neutron_lib.services.logapi import constants as log_const
from neutron.db import db_base_plugin_common
from neutron.extensions import logging as log_ext
from neutron.objects import base as base_obj
from neutron.objects.logapi import logging_resource as log_object
from neutron.services.logapi.common import constants as log_const
from neutron.services.logapi.common import exceptions as log_exc
from neutron.services.logapi.common import validators
from neutron.services.logapi.drivers import manager as driver_mgr

@ -14,11 +14,10 @@
# under the License.
from neutron_lib import rpc as n_rpc
from neutron_lib.services.logapi import constants as log_const
from oslo_log import helpers as log_helpers
import oslo_messaging
from neutron.services.logapi.common import constants as log_const
class LoggingApiStub(object):
"""Stub proxy code for agent->server communication."""

@ -15,13 +15,13 @@
from neutron_lib.callbacks import resources as r_const
from neutron_lib import rpc as n_rpc
from neutron_lib.services.logapi import constants as log_const
from oslo_log import helpers as log_helpers
from oslo_log import log as logging
import oslo_messaging
from neutron.api.rpc.callbacks import events
from neutron.api.rpc.handlers import resources_rpc
from neutron.services.logapi.common import constants as log_const
from neutron.services.logapi.common import db_api
LOG = logging.getLogger(__name__)

@ -23,6 +23,7 @@ import fixtures
import mock
import netaddr
from neutron_lib import constants
from neutron_lib.services.logapi import constants as log_const
from neutron_lib.tests import tools
from neutron_lib.utils import helpers
from neutron_lib.utils import net
@ -30,8 +31,6 @@ from oslo_utils import netutils
from oslo_utils import timeutils
import unittest2
from neutron.services.logapi.common import constants as log_const
# NOTE(yamahata): from neutron-lib 1.9.1, callback priority was added and
# priority_group module was added for constants of priority.

@ -16,11 +16,11 @@
import mock
from neutron_lib import constants as const
from neutron_lib import context
from neutron_lib.services.logapi import constants as log_const
from oslo_utils import uuidutils
from neutron.common import utils
from neutron.objects.logapi import logging_resource as log_object
from neutron.services.logapi.common import constants as log_const
from neutron.services.logapi.common import db_api
from neutron.services.logapi.common import validators
from neutron.services.logapi.rpc import server as server_rpc

@ -17,8 +17,8 @@ import mock
from neutron_lib.callbacks import events
from neutron_lib import exceptions
from neutron_lib import fixture
from neutron_lib.services.logapi import constants as log_const
from neutron.services.logapi.common import constants as log_const
from neutron.services.logapi.common import exceptions as log_exc
from neutron.services.logapi.drivers import base as log_driver_base
from neutron.services.logapi.drivers import manager as driver_mgr

@ -15,12 +15,12 @@
import mock
from neutron_lib import rpc
from neutron_lib.services.logapi import constants as log_const
from oslo_config import cfg
import oslo_messaging
from neutron.api.rpc.callbacks import events
from neutron.api.rpc.handlers import resources_rpc
from neutron.services.logapi.common import constants as log_const
from neutron.services.logapi.rpc import server as server_rpc
from neutron.tests import base

Loading…
Cancel
Save