oslo: migrate to namespace-less import paths

Oslo project decided to move away from using oslo.* namespace for all their
libraries [1], so we should migrate to new import path.

This patch applies new paths for:
- oslo.config
- oslo.db
- oslo.i18n
- oslo.messaging
- oslo.middleware
- oslo.rootwrap
- oslo.serialization
- oslo.utils

Added hacking check to enforce new import paths for all oslo libraries.

Updated setup.cfg entry points.

We'll cleanup old imports from oslo-incubator modules on demand or
if/when oslo officially deprecates old namespace in one of the next
cycles.

[1]: https://blueprints.launchpad.net/oslo-incubator/+spec/drop-namespace-packages

Depends-On: https://review.openstack.org/#/c/147248/
Depends-On: https://review.openstack.org/#/c/152292/
Depends-On: https://review.openstack.org/#/c/147240/

Closes-Bug: #1409733
Change-Id: If0dce29a0980206ace9866112be529436194d47e
This commit is contained in:
Ihar Hrachyshka 2015-01-08 17:25:23 +01:00
parent 38f2704a85
commit 7a2a85623d
366 changed files with 693 additions and 670 deletions

View File

@ -12,6 +12,7 @@ Neutron Specific Commandments
- [N320] Validate that LOG messages, except debug ones, have translations - [N320] Validate that LOG messages, except debug ones, have translations
- [N321] Validate that jsonutils module is used instead of json - [N321] Validate that jsonutils module is used instead of json
- [N322] Detect common errors with assert_called_once_with - [N322] Detect common errors with assert_called_once_with
- [N323] Enforce namespace-less imports for oslo libraries
Creating Unit Tests Creating Unit Tests
------------------- -------------------

View File

@ -15,7 +15,7 @@
import os import os
from oslo.config import cfg from oslo_config import cfg
from neutron.common import config from neutron.common import config
from neutron.openstack.common import log as logging from neutron.openstack.common import log as logging

View File

@ -18,9 +18,9 @@ import os
import eventlet import eventlet
from oslo.config import cfg from oslo_config import cfg
from oslo import messaging import oslo_messaging
from oslo.utils import importutils from oslo_utils import importutils
from neutron.agent.common import config from neutron.agent.common import config
from neutron.agent.linux import dhcp from neutron.agent.linux import dhcp
@ -49,7 +49,7 @@ class DhcpAgent(manager.Manager):
client side to execute the methods here. For more information about client side to execute the methods here. For more information about
changing rpc interfaces, see doc/source/devref/rpc_api.rst. changing rpc interfaces, see doc/source/devref/rpc_api.rst.
""" """
target = messaging.Target(version='1.0') target = oslo_messaging.Target(version='1.0')
def __init__(self, host=None): def __init__(self, host=None):
super(DhcpAgent, self).__init__(host=host) super(DhcpAgent, self).__init__(host=host)
@ -125,7 +125,7 @@ class DhcpAgent(manager.Manager):
{'net_id': network.id, 'action': action}) {'net_id': network.id, 'action': action})
except Exception as e: except Exception as e:
self.schedule_resync(e, network.id) self.schedule_resync(e, network.id)
if (isinstance(e, messaging.RemoteError) if (isinstance(e, oslo_messaging.RemoteError)
and e.exc_type == 'NetworkNotFound' and e.exc_type == 'NetworkNotFound'
or isinstance(e, exceptions.NetworkNotFound)): or isinstance(e, exceptions.NetworkNotFound)):
LOG.warning(_LW("Network %s has been deleted."), network.id) LOG.warning(_LW("Network %s has been deleted."), network.id)
@ -400,7 +400,7 @@ class DhcpPluginApi(object):
self.context = context self.context = context
self.host = cfg.CONF.host self.host = cfg.CONF.host
self.use_namespaces = use_namespaces self.use_namespaces = use_namespaces
target = messaging.Target( target = oslo_messaging.Target(
topic=topic, topic=topic,
namespace=constants.RPC_NAMESPACE_DHCP_PLUGIN, namespace=constants.RPC_NAMESPACE_DHCP_PLUGIN,
version='1.0') version='1.0')

View File

@ -14,7 +14,7 @@
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # under the License.
from oslo.config import cfg from oslo_config import cfg
DHCP_AGENT_OPTS = [ DHCP_AGENT_OPTS = [
cfg.IntOpt('resync_interval', default=5, cfg.IntOpt('resync_interval', default=5,

View File

@ -19,7 +19,7 @@ import sys
import eventlet import eventlet
eventlet.monkey_patch() eventlet.monkey_patch()
from oslo.config import cfg from oslo_config import cfg
from neutron.agent.common import config from neutron.agent.common import config
from neutron.agent.dhcp import config as dhcp_config from neutron.agent.dhcp import config as dhcp_config

View File

@ -15,7 +15,7 @@
import abc import abc
from oslo.config import cfg from oslo_config import cfg
import six import six
from neutron.common import constants as n_const from neutron.common import constants as n_const

View File

@ -15,11 +15,11 @@
import eventlet import eventlet
import netaddr import netaddr
from oslo.config import cfg from oslo_config import cfg
from oslo import messaging import oslo_messaging
from oslo.utils import excutils from oslo_utils import excutils
from oslo.utils import importutils from oslo_utils import importutils
from oslo.utils import timeutils from oslo_utils import timeutils
from neutron.agent.common import config from neutron.agent.common import config
from neutron.agent.l3 import dvr from neutron.agent.l3 import dvr
@ -77,7 +77,7 @@ class L3PluginApi(object):
def __init__(self, topic, host): def __init__(self, topic, host):
self.host = host self.host = host
target = messaging.Target(topic=topic, version='1.0') target = oslo_messaging.Target(topic=topic, version='1.0')
self.client = n_rpc.get_client(target) self.client = n_rpc.get_client(target)
def get_routers(self, context, router_ids=None): def get_routers(self, context, router_ids=None):
@ -89,9 +89,9 @@ class L3PluginApi(object):
def get_external_network_id(self, context): def get_external_network_id(self, context):
"""Make a remote process call to retrieve the external network id. """Make a remote process call to retrieve the external network id.
@raise messaging.RemoteError: with TooManyExternalNetworks as @raise oslo_messaging.RemoteError: with TooManyExternalNetworks as
exc_type if there are more than one exc_type if there are more than one
external network external network
""" """
cctxt = self.client.prepare() cctxt = self.client.prepare()
return cctxt.call(context, 'get_external_network_id', host=self.host) return cctxt.call(context, 'get_external_network_id', host=self.host)
@ -138,7 +138,7 @@ class L3NATAgent(firewall_l3_agent.FWaaSL3AgentRpcCallback,
- del_arp_entry - del_arp_entry
Needed by the L3 service when dealing with DVR Needed by the L3 service when dealing with DVR
""" """
target = messaging.Target(version='1.2') target = oslo_messaging.Target(version='1.2')
def __init__(self, host, conf=None): def __init__(self, host, conf=None):
if conf: if conf:
@ -178,7 +178,7 @@ class L3NATAgent(firewall_l3_agent.FWaaSL3AgentRpcCallback,
try: try:
self.neutron_service_plugins = ( self.neutron_service_plugins = (
self.plugin_rpc.get_service_plugin_list(self.context)) self.plugin_rpc.get_service_plugin_list(self.context))
except messaging.RemoteError as e: except oslo_messaging.RemoteError as e:
with excutils.save_and_reraise_exception() as ctx: with excutils.save_and_reraise_exception() as ctx:
ctx.reraise = False ctx.reraise = False
LOG.warning(_LW('l3-agent cannot check service plugins ' LOG.warning(_LW('l3-agent cannot check service plugins '
@ -189,7 +189,7 @@ class L3NATAgent(firewall_l3_agent.FWaaSL3AgentRpcCallback,
'UnsupportedVersion you can ignore this ' 'UnsupportedVersion you can ignore this '
'warning. Detail message: %s'), e) 'warning. Detail message: %s'), e)
self.neutron_service_plugins = None self.neutron_service_plugins = None
except messaging.MessagingTimeout as e: except oslo_messaging.MessagingTimeout as e:
with excutils.save_and_reraise_exception() as ctx: with excutils.save_and_reraise_exception() as ctx:
if retry_count > 0: if retry_count > 0:
ctx.reraise = False ctx.reraise = False
@ -335,7 +335,7 @@ class L3NATAgent(firewall_l3_agent.FWaaSL3AgentRpcCallback,
self.target_ex_net_id = self.plugin_rpc.get_external_network_id( self.target_ex_net_id = self.plugin_rpc.get_external_network_id(
self.context) self.context)
return self.target_ex_net_id return self.target_ex_net_id
except messaging.RemoteError as e: except oslo_messaging.RemoteError as e:
with excutils.save_and_reraise_exception() as ctx: with excutils.save_and_reraise_exception() as ctx:
if e.exc_type == 'TooManyExternalNetworks': if e.exc_type == 'TooManyExternalNetworks':
ctx.reraise = False ctx.reraise = False
@ -1172,7 +1172,7 @@ class L3NATAgent(firewall_l3_agent.FWaaSL3AgentRpcCallback,
routers = self.plugin_rpc.get_routers(context, routers = self.plugin_rpc.get_routers(context,
[self.conf.router_id]) [self.conf.router_id])
except messaging.MessagingException: except oslo_messaging.MessagingException:
LOG.exception(_LE("Failed synchronizing routers due to RPC error")) LOG.exception(_LE("Failed synchronizing routers due to RPC error"))
else: else:
LOG.debug('Processing :%r', routers) LOG.debug('Processing :%r', routers)

View File

@ -14,7 +14,7 @@
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # under the License.
from oslo.config import cfg from oslo_config import cfg
OPTS = [ OPTS = [

View File

@ -15,7 +15,7 @@
import os import os
from oslo.config import cfg from oslo_config import cfg
from neutron.common import constants as l3_constants from neutron.common import constants as l3_constants
from neutron.i18n import _LE from neutron.i18n import _LE

View File

@ -16,7 +16,7 @@
import datetime import datetime
import Queue import Queue
from oslo.utils import timeutils from oslo_utils import timeutils
# Lower value is higher priority # Lower value is higher priority
PRIORITY_RPC = 0 PRIORITY_RPC = 0

View File

@ -19,7 +19,7 @@ import sys
import eventlet import eventlet
eventlet.monkey_patch() eventlet.monkey_patch()
from oslo.config import cfg from oslo_config import cfg
from neutron.agent.common import config from neutron.agent.common import config
from neutron.agent.l3 import config as l3_config from neutron.agent.l3 import config as l3_config

View File

@ -22,8 +22,8 @@ import socket
import sys import sys
import netaddr import netaddr
from oslo.serialization import jsonutils from oslo_serialization import jsonutils
from oslo.utils import importutils from oslo_utils import importutils
import six import six
from neutron.agent.linux import ip_lib from neutron.agent.linux import ip_lib

View File

@ -16,8 +16,8 @@ import collections
import os.path import os.path
import eventlet import eventlet
from oslo.config import cfg
from oslo_concurrency import lockutils from oslo_concurrency import lockutils
from oslo_config import cfg
from neutron.agent.common import config as agent_cfg from neutron.agent.common import config as agent_cfg
from neutron.agent.linux import ip_lib from neutron.agent.linux import ip_lib
@ -135,7 +135,7 @@ class ProcessMonitor(object):
"""Handle multiple process managers and watch over all of them. """Handle multiple process managers and watch over all of them.
:param config: oslo config object with the agent configuration. :param config: oslo config object with the agent configuration.
:type config: oslo.config.ConfigOpts :type config: oslo_config.ConfigOpts
:param root_helper: root helper to be used with new ProcessManagers :param root_helper: root helper to be used with new ProcessManagers
:type root_helper: str :type root_helper: str
:param resource_type: can be dhcp, router, load_balancer, etc. :param resource_type: can be dhcp, router, load_balancer, etc.

View File

@ -16,8 +16,8 @@
import abc import abc
import netaddr import netaddr
from oslo.config import cfg from oslo_config import cfg
from oslo.utils import importutils from oslo_utils import importutils
import six import six
from neutron.agent.common import config from neutron.agent.common import config

View File

@ -17,7 +17,7 @@ import eventlet
import os import os
import netaddr import netaddr
from oslo.config import cfg from oslo_config import cfg
from neutron.agent.linux import utils from neutron.agent.linux import utils
from neutron.common import exceptions from neutron.common import exceptions

View File

@ -14,7 +14,7 @@
# under the License. # under the License.
import netaddr import netaddr
from oslo.config import cfg from oslo_config import cfg
from neutron.agent import firewall from neutron.agent import firewall
from neutron.agent.linux import ipset_manager from neutron.agent.linux import ipset_manager

View File

@ -23,9 +23,9 @@ import os
import re import re
import sys import sys
from oslo.config import cfg
from oslo.utils import excutils
from oslo_concurrency import lockutils from oslo_concurrency import lockutils
from oslo_config import cfg
from oslo_utils import excutils
from neutron.agent.common import config from neutron.agent.common import config
from neutron.agent.linux import iptables_comments as ic from neutron.agent.linux import iptables_comments as ic

View File

@ -18,7 +18,7 @@ import os
import stat import stat
import netaddr import netaddr
from oslo.config import cfg from oslo_config import cfg
from neutron.agent.linux import external_process from neutron.agent.linux import external_process
from neutron.agent.linux import utils from neutron.agent.linux import utils

View File

@ -17,8 +17,8 @@ import collections
import itertools import itertools
import operator import operator
from oslo.config import cfg from oslo_config import cfg
from oslo.utils import excutils from oslo_utils import excutils
import retrying import retrying
import six import six

View File

@ -16,8 +16,8 @@ import collections
import itertools import itertools
import uuid import uuid
from oslo.serialization import jsonutils from oslo_serialization import jsonutils
from oslo.utils import excutils from oslo_utils import excutils
from neutron.agent.linux import utils from neutron.agent.linux import utils
from neutron.agent import ovsdb from neutron.agent import ovsdb

View File

@ -15,7 +15,7 @@
import jinja2 import jinja2
import netaddr import netaddr
from oslo.config import cfg from oslo_config import cfg
import six import six
from neutron.agent.linux import utils from neutron.agent.linux import utils

View File

@ -23,7 +23,7 @@ import tempfile
from eventlet.green import subprocess from eventlet.green import subprocess
from eventlet import greenthread from eventlet import greenthread
from oslo.utils import excutils from oslo_utils import excutils
from neutron.common import constants from neutron.common import constants
from neutron.common import utils from neutron.common import utils

View File

@ -20,9 +20,9 @@ import socket
import eventlet import eventlet
import httplib2 import httplib2
from neutronclient.v2_0 import client from neutronclient.v2_0 import client
from oslo.config import cfg from oslo_config import cfg
from oslo import messaging import oslo_messaging
from oslo.utils import excutils from oslo_utils import excutils
import six.moves.urllib.parse as urlparse import six.moves.urllib.parse as urlparse
import webob import webob
@ -56,9 +56,10 @@ class MetadataPluginAPI(object):
""" """
def __init__(self, topic): def __init__(self, topic):
target = messaging.Target(topic=topic, target = oslo_messaging.Target(
namespace=n_const.RPC_NAMESPACE_METADATA, topic=topic,
version='1.0') namespace=n_const.RPC_NAMESPACE_METADATA,
version='1.0')
self.client = n_rpc.get_client(target) self.client = n_rpc.get_client(target)
def get_ports(self, context, filters): def get_ports(self, context, filters):
@ -121,7 +122,7 @@ class MetadataProxyHandler(object):
if self.use_rpc: if self.use_rpc:
try: try:
return self.plugin_rpc.get_ports(self.context, filters) return self.plugin_rpc.get_ports(self.context, filters)
except (messaging.MessagingException, AttributeError): except (oslo_messaging.MessagingException, AttributeError):
# TODO(obondarev): remove fallback once RPC is proven # TODO(obondarev): remove fallback once RPC is proven
# to work fine with metadata agent (K or L release at most) # to work fine with metadata agent (K or L release at most)
LOG.warning(_LW('Server does not support metadata RPC, ' LOG.warning(_LW('Server does not support metadata RPC, '

View File

@ -12,7 +12,7 @@
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # under the License.
from oslo.config import cfg from oslo_config import cfg
from neutron.common import utils from neutron.common import utils

View File

@ -15,7 +15,7 @@
import os import os
from oslo.config import cfg from oslo_config import cfg
from neutron.agent.common import config from neutron.agent.common import config
from neutron.agent.linux import external_process from neutron.agent.linux import external_process

View File

@ -19,7 +19,7 @@ import eventlet
eventlet.monkey_patch() eventlet.monkey_patch()
import httplib2 import httplib2
from oslo.config import cfg from oslo_config import cfg
import six.moves.urllib.parse as urlparse import six.moves.urllib.parse as urlparse
import webob import webob

View File

@ -17,7 +17,7 @@ import sys
import eventlet import eventlet
eventlet.monkey_patch() eventlet.monkey_patch()
from oslo.config import cfg from oslo_config import cfg
from neutron.agent.common import config as agent_conf from neutron.agent.common import config as agent_conf
from neutron.agent.metadata import agent from neutron.agent.metadata import agent

View File

@ -14,8 +14,8 @@
import abc import abc
from oslo.config import cfg from oslo_config import cfg
from oslo.utils import importutils from oslo_utils import importutils
import six import six
interface_map = { interface_map = {

View File

@ -14,8 +14,8 @@
# under the License. # under the License.
import itertools import itertools
from oslo import messaging import oslo_messaging
from oslo.utils import timeutils from oslo_utils import timeutils
from neutron.common import rpc as n_rpc from neutron.common import rpc as n_rpc
from neutron.common import topics from neutron.common import topics
@ -58,7 +58,7 @@ def create_consumers(endpoints, prefix, topic_details, start_listening=True):
class PluginReportStateAPI(object): class PluginReportStateAPI(object):
def __init__(self, topic): def __init__(self, topic):
target = messaging.Target(topic=topic, version='1.0') target = oslo_messaging.Target(topic=topic, version='1.0')
self.client = n_rpc.get_client(target) self.client = n_rpc.get_client(target)
def report_state(self, context, agent_state, use_call=False): def report_state(self, context, agent_state, use_call=False):
@ -82,7 +82,7 @@ class PluginApi(object):
''' '''
def __init__(self, topic): def __init__(self, topic):
target = messaging.Target(topic=topic, version='1.0') target = oslo_messaging.Target(topic=topic, version='1.0')
self.client = n_rpc.get_client(target) self.client = n_rpc.get_client(target)
def get_device_details(self, context, device, agent_id, host=None): def get_device_details(self, context, device, agent_id, host=None):
@ -95,7 +95,7 @@ class PluginApi(object):
cctxt = self.client.prepare(version='1.3') cctxt = self.client.prepare(version='1.3')
res = cctxt.call(context, 'get_devices_details_list', res = cctxt.call(context, 'get_devices_details_list',
devices=devices, agent_id=agent_id, host=host) devices=devices, agent_id=agent_id, host=host)
except messaging.UnsupportedVersion: except oslo_messaging.UnsupportedVersion:
# If the server has not been upgraded yet, a DVR-enabled agent # If the server has not been upgraded yet, a DVR-enabled agent
# may not work correctly, however it can function in 'degraded' # may not work correctly, however it can function in 'degraded'
# mode, in that DVR routers may not be in the system yet, and # mode, in that DVR routers may not be in the system yet, and

View File

@ -16,9 +16,9 @@
import functools import functools
from oslo.config import cfg from oslo_config import cfg
from oslo import messaging import oslo_messaging
from oslo.utils import importutils from oslo_utils import importutils
from neutron.agent import firewall from neutron.agent import firewall
from neutron.common import constants from neutron.common import constants
@ -96,8 +96,9 @@ class SecurityGroupServerRpcApi(object):
doc/source/devref/rpc_api.rst. doc/source/devref/rpc_api.rst.
""" """
def __init__(self, topic): def __init__(self, topic):
target = messaging.Target(topic=topic, version='1.0', target = oslo_messaging.Target(
namespace=constants.RPC_NAMESPACE_SECGROUP) topic=topic, version='1.0',
namespace=constants.RPC_NAMESPACE_SECGROUP)
self.client = n_rpc.get_client(target) self.client = n_rpc.get_client(target)
def security_group_rules_for_devices(self, context, devices): def security_group_rules_for_devices(self, context, devices):
@ -199,7 +200,7 @@ class SecurityGroupAgentRpc(object):
try: try:
self.plugin_rpc.security_group_info_for_devices( self.plugin_rpc.security_group_info_for_devices(
self.context, devices=[]) self.context, devices=[])
except messaging.UnsupportedVersion: except oslo_messaging.UnsupportedVersion:
LOG.warning(_LW('security_group_info_for_devices rpc call not ' LOG.warning(_LW('security_group_info_for_devices rpc call not '
'supported by the server, falling back to old ' 'supported by the server, falling back to old '
'security_group_rules_for_devices which scales ' 'security_group_rules_for_devices which scales '

View File

@ -15,7 +15,7 @@
import urllib import urllib
from oslo.config import cfg from oslo_config import cfg
from webob import exc from webob import exc
from neutron.common import constants from neutron.common import constants

View File

@ -20,7 +20,7 @@ import imp
import itertools import itertools
import os import os
from oslo.config import cfg from oslo_config import cfg
import routes import routes
import six import six
import webob.dec import webob.dec

View File

@ -13,7 +13,7 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
from oslo import messaging import oslo_messaging
from neutron.common import constants from neutron.common import constants
from neutron.common import rpc as n_rpc from neutron.common import rpc as n_rpc
@ -48,7 +48,7 @@ class DhcpAgentNotifyAPI(object):
def __init__(self, topic=topics.DHCP_AGENT, plugin=None): def __init__(self, topic=topics.DHCP_AGENT, plugin=None):
self._plugin = plugin self._plugin = plugin
target = messaging.Target(topic=topic, version='1.0') target = oslo_messaging.Target(topic=topic, version='1.0')
self.client = n_rpc.get_client(target) self.client = n_rpc.get_client(target)
@property @property

View File

@ -15,7 +15,7 @@
import random import random
from oslo import messaging import oslo_messaging
from neutron.common import constants from neutron.common import constants
from neutron.common import rpc as n_rpc from neutron.common import rpc as n_rpc
@ -34,7 +34,7 @@ class L3AgentNotifyAPI(object):
"""API for plugin to notify L3 agent.""" """API for plugin to notify L3 agent."""
def __init__(self, topic=topics.L3_AGENT): def __init__(self, topic=topics.L3_AGENT):
target = messaging.Target(topic=topic, version='1.0') target = oslo_messaging.Target(topic=topic, version='1.0')
self.client = n_rpc.get_client(target) self.client = n_rpc.get_client(target)
def _notification_host(self, context, method, payload, host): def _notification_host(self, context, method, payload, host):

View File

@ -12,7 +12,7 @@
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # under the License.
from oslo import messaging import oslo_messaging
from neutron.common import constants from neutron.common import constants
from neutron.common import rpc as n_rpc from neutron.common import rpc as n_rpc
@ -30,7 +30,7 @@ class MeteringAgentNotifyAPI(object):
def __init__(self, topic=topics.METERING_AGENT): def __init__(self, topic=topics.METERING_AGENT):
self.topic = topic self.topic = topic
target = messaging.Target(topic=topic, version='1.0') target = oslo_messaging.Target(topic=topic, version='1.0')
self.client = n_rpc.get_client(target) self.client = n_rpc.get_client(target)
def _agent_notification(self, context, method, routers): def _agent_notification(self, context, method, routers):

View File

@ -16,10 +16,10 @@
import itertools import itertools
import operator import operator
from oslo.config import cfg from oslo_config import cfg
from oslo.db import exception as db_exc from oslo_db import exception as db_exc
from oslo import messaging import oslo_messaging
from oslo.utils import excutils from oslo_utils import excutils
from neutron.api.v2 import attributes from neutron.api.v2 import attributes
from neutron.common import constants from neutron.common import constants
@ -47,8 +47,9 @@ class DhcpRpcCallback(object):
# 1.0 - Initial version. # 1.0 - Initial version.
# 1.1 - Added get_active_networks_info, create_dhcp_port, # 1.1 - Added get_active_networks_info, create_dhcp_port,
# and update_dhcp_port methods. # and update_dhcp_port methods.
target = messaging.Target(namespace=constants.RPC_NAMESPACE_DHCP_PLUGIN, target = oslo_messaging.Target(
version='1.1') namespace=constants.RPC_NAMESPACE_DHCP_PLUGIN,
version='1.1')
def _get_active_networks(self, context, **kwargs): def _get_active_networks(self, context, **kwargs):
"""Retrieve and return a list of the active networks.""" """Retrieve and return a list of the active networks."""

View File

@ -13,7 +13,7 @@
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # under the License.
from oslo import messaging import oslo_messaging
from neutron.common import log from neutron.common import log
from neutron.common import rpc as n_rpc from neutron.common import rpc as n_rpc
@ -28,7 +28,7 @@ class DVRServerRpcApi(object):
"""Agent-side RPC (stub) for agent-to-plugin interaction.""" """Agent-side RPC (stub) for agent-to-plugin interaction."""
def __init__(self, topic): def __init__(self, topic):
target = messaging.Target(topic=topic, version='1.0') target = oslo_messaging.Target(topic=topic, version='1.0')
self.client = n_rpc.get_client(target) self.client = n_rpc.get_client(target)
@log.log @log.log
@ -59,7 +59,7 @@ class DVRServerRpcCallback(object):
# History # History
# 1.0 Initial version # 1.0 Initial version
target = messaging.Target(version='1.0') target = oslo_messaging.Target(version='1.0')
@property @property
def plugin(self): def plugin(self):

View File

@ -13,9 +13,9 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
from oslo.config import cfg from oslo_config import cfg
from oslo import messaging import oslo_messaging
from oslo.serialization import jsonutils from oslo_serialization import jsonutils
from neutron.common import constants from neutron.common import constants
from neutron.common import exceptions from neutron.common import exceptions
@ -40,7 +40,7 @@ class L3RpcCallback(object):
# 1.2 Added methods for DVR support # 1.2 Added methods for DVR support
# 1.3 Added a method that returns the list of activated services # 1.3 Added a method that returns the list of activated services
# 1.4 Added L3 HA update_router_state # 1.4 Added L3 HA update_router_state
target = messaging.Target(version='1.4') target = oslo_messaging.Target(version='1.4')
@property @property
def plugin(self): def plugin(self):

View File

@ -13,7 +13,7 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
from oslo import messaging import oslo_messaging
from neutron.common import constants from neutron.common import constants
from neutron import manager from neutron import manager
@ -30,8 +30,8 @@ class MetadataRpcCallback(object):
""" """
# 1.0 MetadataPluginAPI BASE_RPC_API_VERSION # 1.0 MetadataPluginAPI BASE_RPC_API_VERSION
target = messaging.Target(version='1.0', target = oslo_messaging.Target(version='1.0',
namespace=constants.RPC_NAMESPACE_METADATA) namespace=constants.RPC_NAMESPACE_METADATA)
@property @property
def plugin(self): def plugin(self):

View File

@ -12,7 +12,7 @@
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # under the License.
from oslo import messaging import oslo_messaging
from neutron.common import constants from neutron.common import constants
from neutron import manager from neutron import manager
@ -37,8 +37,8 @@ class SecurityGroupServerRpcCallback(object):
# NOTE: target must not be overridden in subclasses # NOTE: target must not be overridden in subclasses
# to keep RPC API version consistent across plugins. # to keep RPC API version consistent across plugins.
target = messaging.Target(version='1.2', target = oslo_messaging.Target(version='1.2',
namespace=constants.RPC_NAMESPACE_SECGROUP) namespace=constants.RPC_NAMESPACE_SECGROUP)
@property @property
def plugin(self): def plugin(self):

View File

@ -17,8 +17,8 @@ import copy
import netaddr import netaddr
import webob.exc import webob.exc
from oslo.config import cfg from oslo_config import cfg
from oslo.utils import excutils from oslo_utils import excutils
from neutron.api import api_common from neutron.api import api_common
from neutron.api.rpc.agentnotifiers import dhcp_rpc_agent_api from neutron.api.rpc.agentnotifiers import dhcp_rpc_agent_api

View File

@ -20,7 +20,7 @@ Utility methods for working with WSGI servers redux
import sys import sys
import netaddr import netaddr
from oslo import i18n import oslo_i18n
import six import six
import webob.dec import webob.dec
import webob.exc import webob.exc
@ -173,7 +173,7 @@ def translate(translatable, locale):
:returns: the translated object, or the object as-is if it :returns: the translated object, or the object as-is if it
was not translated was not translated
""" """
localize = i18n.translate localize = oslo_i18n.translate
if isinstance(translatable, exceptions.NeutronException): if isinstance(translatable, exceptions.NeutronException):
translatable.msg = localize(translatable.msg, locale) translatable.msg = localize(translatable.msg, locale)
elif isinstance(translatable, webob.exc.HTTPError): elif isinstance(translatable, webob.exc.HTTPError):

View File

@ -13,7 +13,7 @@
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # under the License.
from oslo.config import cfg from oslo_config import cfg
from neutron.api import extensions from neutron.api import extensions
from neutron.api.v2 import base from neutron.api.v2 import base

View File

@ -13,7 +13,7 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
from oslo.config import cfg from oslo_config import cfg
import routes as routes_mapper import routes as routes_mapper
import six.moves.urllib.parse as urlparse import six.moves.urllib.parse as urlparse
import webob import webob

View File

@ -13,7 +13,7 @@
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # under the License.
from oslo import i18n import oslo_i18n
import webob.dec import webob.dec
from neutron.api.views import versions as versions_view from neutron.api.views import versions as versions_view
@ -43,7 +43,7 @@ class Versions(object):
if req.path != '/': if req.path != '/':
language = req.best_match_language() language = req.best_match_language()
msg = _('Unknown API version specified') msg = _('Unknown API version specified')
msg = i18n.translate(msg, language) msg = oslo_i18n.translate(msg, language)
return webob.exc.HTTPNotFound(explanation=msg) return webob.exc.HTTPNotFound(explanation=msg)
builder = versions_view.get_view_builder(req) builder = versions_view.get_view_builder(req)

View File

@ -12,8 +12,8 @@
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # under the License.
from oslo.config import cfg from oslo_config import cfg
from oslo.middleware import request_id from oslo_middleware import request_id
import webob.dec import webob.dec
import webob.exc import webob.exc

View File

@ -18,8 +18,8 @@ import re
import eventlet import eventlet
eventlet.monkey_patch() eventlet.monkey_patch()
from oslo.config import cfg from oslo_config import cfg
from oslo.utils import importutils from oslo_utils import importutils
from neutron.agent.common import config as agent_config from neutron.agent.common import config as agent_config
from neutron.agent.dhcp import config as dhcp_config from neutron.agent.dhcp import config as dhcp_config

View File

@ -13,7 +13,7 @@
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # under the License.
from oslo.config import cfg from oslo_config import cfg
from neutron.agent.common import config as agent_config from neutron.agent.common import config as agent_config
from neutron.agent.l3 import config as l3_config from neutron.agent.l3 import config as l3_config

View File

@ -20,7 +20,7 @@ from neutron.cmd.sanity import checks
from neutron.common import config from neutron.common import config
from neutron.i18n import _LE, _LW from neutron.i18n import _LE, _LW
from neutron.openstack.common import log as logging from neutron.openstack.common import log as logging
from oslo.config import cfg from oslo_config import cfg
LOG = logging.getLogger(__name__) LOG = logging.getLogger(__name__)

View File

@ -20,9 +20,9 @@ Routines for configuring Neutron
import os import os
import sys import sys
from oslo.config import cfg from oslo_config import cfg
from oslo.db import options as db_options from oslo_db import options as db_options
from oslo import messaging import oslo_messaging
from paste import deploy from paste import deploy
from neutron.api.v2 import attributes from neutron.api.v2 import attributes
@ -134,7 +134,7 @@ cfg.CONF.register_opts(core_opts)
cfg.CONF.register_cli_opts(core_cli_opts) cfg.CONF.register_cli_opts(core_cli_opts)
# Ensure that the control exchange is set correctly # Ensure that the control exchange is set correctly
messaging.set_transport_defaults(control_exchange='neutron') oslo_messaging.set_transport_defaults(control_exchange='neutron')
_SQL_CONNECTION_DEFAULT = 'sqlite://' _SQL_CONNECTION_DEFAULT = 'sqlite://'
# Update the default QueuePool parameters. These can be tweaked by the # Update the default QueuePool parameters. These can be tweaked by the
# configuration variables - max_pool_size, max_overflow and pool_timeout # configuration variables - max_pool_size, max_overflow and pool_timeout

View File

@ -17,7 +17,7 @@
Neutron base exception handling. Neutron base exception handling.
""" """
from oslo.utils import excutils from oslo_utils import excutils
class NeutronException(Exception): class NeutronException(Exception):

View File

@ -17,7 +17,7 @@ import ConfigParser
import importlib import importlib
import os import os
from oslo.config import cfg from oslo_config import cfg
from neutron.openstack.common import log as logging from neutron.openstack.common import log as logging
@ -62,7 +62,7 @@ class NeutronModules(object):
def alembic_name(self, module): def alembic_name(self, module):
return self.MODULES[module]['alembic-name'] return self.MODULES[module]['alembic-name']
# Return an INI parser for the child module. oslo.conf is a bit too # Return an INI parser for the child module. oslo.config is a bit too
# magical in its INI loading, and in one notable case, we need to merge # magical in its INI loading, and in one notable case, we need to merge
# together the [service_providers] section across at least four # together the [service_providers] section across at least four
# repositories. # repositories.

View File

@ -14,9 +14,9 @@
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # under the License.
from oslo.config import cfg from oslo_config import cfg
from oslo import messaging import oslo_messaging
from oslo.messaging import serializer as om_serializer from oslo_messaging import serializer as om_serializer
from neutron.common import exceptions from neutron.common import exceptions
from neutron import context from neutron import context
@ -51,11 +51,11 @@ TRANSPORT_ALIASES = {
def init(conf): def init(conf):
global TRANSPORT, NOTIFIER global TRANSPORT, NOTIFIER
exmods = get_allowed_exmods() exmods = get_allowed_exmods()
TRANSPORT = messaging.get_transport(conf, TRANSPORT = oslo_messaging.get_transport(conf,
allowed_remote_exmods=exmods, allowed_remote_exmods=exmods,
aliases=TRANSPORT_ALIASES) aliases=TRANSPORT_ALIASES)
serializer = RequestContextSerializer() serializer = RequestContextSerializer()
NOTIFIER = messaging.Notifier(TRANSPORT, serializer=serializer) NOTIFIER = oslo_messaging.Notifier(TRANSPORT, serializer=serializer)
def cleanup(): def cleanup():
@ -81,17 +81,17 @@ def get_allowed_exmods():
def get_client(target, version_cap=None, serializer=None): def get_client(target, version_cap=None, serializer=None):
assert TRANSPORT is not None assert TRANSPORT is not None
serializer = RequestContextSerializer(serializer) serializer = RequestContextSerializer(serializer)
return messaging.RPCClient(TRANSPORT, return oslo_messaging.RPCClient(TRANSPORT,
target, target,
version_cap=version_cap, version_cap=version_cap,
serializer=serializer) serializer=serializer)
def get_server(target, endpoints, serializer=None): def get_server(target, endpoints, serializer=None):
assert TRANSPORT is not None assert TRANSPORT is not None
serializer = RequestContextSerializer(serializer) serializer = RequestContextSerializer(serializer)
return messaging.get_rpc_server(TRANSPORT, target, endpoints, return oslo_messaging.get_rpc_server(TRANSPORT, target, endpoints,
'eventlet', serializer) 'eventlet', serializer)
def get_notifier(service=None, host=None, publisher_id=None): def get_notifier(service=None, host=None, publisher_id=None):
@ -185,7 +185,7 @@ class Connection(object):
self.servers = [] self.servers = []
def create_consumer(self, topic, endpoints, fanout=False): def create_consumer(self, topic, endpoints, fanout=False):
target = messaging.Target( target = oslo_messaging.Target(
topic=topic, server=cfg.CONF.host, fanout=fanout) topic=topic, server=cfg.CONF.host, fanout=fanout)
server = get_server(target, endpoints) server = get_server(target, endpoints)
self.servers.append(server) self.servers.append(server)

View File

@ -31,9 +31,9 @@ import socket
import uuid import uuid
from eventlet.green import subprocess from eventlet.green import subprocess
from oslo.config import cfg
from oslo.utils import excutils
from oslo_concurrency import lockutils from oslo_concurrency import lockutils
from oslo_config import cfg
from oslo_utils import excutils
from neutron.common import constants as q_const from neutron.common import constants as q_const
from neutron.openstack.common import log as logging from neutron.openstack.common import log as logging

View File

@ -15,11 +15,11 @@
from eventlet import greenthread from eventlet import greenthread
from oslo.config import cfg from oslo_config import cfg
from oslo.db import exception as db_exc from oslo_db import exception as db_exc
from oslo import messaging import oslo_messaging
from oslo.serialization import jsonutils from oslo_serialization import jsonutils
from oslo.utils import timeutils from oslo_utils import timeutils
import sqlalchemy as sa import sqlalchemy as sa
from sqlalchemy.orm import exc from sqlalchemy.orm import exc
from sqlalchemy import sql from sqlalchemy import sql
@ -222,7 +222,7 @@ class AgentDbMixin(ext_agent.AgentPluginBase):
class AgentExtRpcCallback(object): class AgentExtRpcCallback(object):
"""Processes the rpc report in plugin implementations.""" """Processes the rpc report in plugin implementations."""
target = messaging.Target(version='1.0') target = oslo_messaging.Target(version='1.0')
START_TIME = timeutils.utcnow() START_TIME = timeutils.utcnow()
def __init__(self, plugin=None): def __init__(self, plugin=None):

View File

@ -17,8 +17,8 @@ import datetime
import random import random
import time import time
from oslo.config import cfg from oslo_config import cfg
from oslo.utils import timeutils from oslo_utils import timeutils
import sqlalchemy as sa import sqlalchemy as sa
from sqlalchemy import orm from sqlalchemy import orm
from sqlalchemy.orm import exc from sqlalchemy.orm import exc

View File

@ -13,8 +13,8 @@
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # under the License.
from oslo.config import cfg from oslo_config import cfg
from oslo.db.sqlalchemy import session from oslo_db.sqlalchemy import session
_FACADE = None _FACADE = None

View File

@ -14,9 +14,9 @@
# under the License. # under the License.
import netaddr import netaddr
from oslo.config import cfg from oslo_config import cfg
from oslo.db import exception as db_exc from oslo_db import exception as db_exc
from oslo.utils import excutils from oslo_utils import excutils
from sqlalchemy import and_ from sqlalchemy import and_
from sqlalchemy import event from sqlalchemy import event
from sqlalchemy import orm from sqlalchemy import orm

View File

@ -13,7 +13,7 @@
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # under the License.
from oslo.db import exception as db_exc from oslo_db import exception as db_exc
import sqlalchemy as sa import sqlalchemy as sa
@ -26,7 +26,7 @@ from neutron.extensions import portbindings
from neutron.i18n import _LE from neutron.i18n import _LE
from neutron import manager from neutron import manager
from neutron.openstack.common import log as logging from neutron.openstack.common import log as logging
from oslo.config import cfg from oslo_config import cfg
from sqlalchemy.orm import exc from sqlalchemy.orm import exc
LOG = logging.getLogger(__name__) LOG = logging.getLogger(__name__)

View File

@ -14,7 +14,7 @@
# under the License. # under the License.
import netaddr import netaddr
from oslo.config import cfg from oslo_config import cfg
import sqlalchemy as sa import sqlalchemy as sa
from sqlalchemy import orm from sqlalchemy import orm

View File

@ -12,9 +12,9 @@
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # under the License.
from oslo.config import cfg from oslo_config import cfg
from oslo.db import exception as db_exc from oslo_db import exception as db_exc
from oslo import messaging import oslo_messaging
import sqlalchemy as sa import sqlalchemy as sa
from sqlalchemy import func from sqlalchemy import func
from sqlalchemy import or_ from sqlalchemy import or_
@ -111,7 +111,7 @@ class L3AgentSchedulerDbMixin(l3agentscheduler.L3AgentSchedulerPluginBase,
try: try:
self.reschedule_router(context, binding.router_id) self.reschedule_router(context, binding.router_id)
except (l3agentscheduler.RouterReschedulingFailed, except (l3agentscheduler.RouterReschedulingFailed,
messaging.RemoteError): oslo_messaging.RemoteError):
# Catch individual router rescheduling errors here # Catch individual router rescheduling errors here
# so one broken one doesn't stop the iteration. # so one broken one doesn't stop the iteration.
LOG.exception(_LE("Failed to reschedule router %s"), LOG.exception(_LE("Failed to reschedule router %s"),

View File

@ -12,7 +12,7 @@
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # under the License.
from oslo.config import cfg from oslo_config import cfg
from neutron.api.v2 import attributes from neutron.api.v2 import attributes
from neutron.common import constants as l3_const from neutron.common import constants as l3_const

View File

@ -15,7 +15,7 @@
import random import random
from oslo.db import exception as db_exc from oslo_db import exception as db_exc
import sqlalchemy as sa import sqlalchemy as sa
from sqlalchemy import orm from sqlalchemy import orm
from sqlalchemy.orm import exc from sqlalchemy.orm import exc

View File

@ -14,9 +14,9 @@
# #
import netaddr import netaddr
from oslo.config import cfg from oslo_config import cfg
from oslo.db import exception as db_exc from oslo_db import exception as db_exc
from oslo.utils import excutils from oslo_utils import excutils
import sqlalchemy as sa import sqlalchemy as sa
from sqlalchemy import orm from sqlalchemy import orm

View File

@ -12,7 +12,7 @@
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # under the License.
from oslo import messaging import oslo_messaging
from neutron.common import constants as consts from neutron.common import constants as consts
from neutron.common import utils from neutron.common import utils
@ -26,7 +26,7 @@ LOG = logging.getLogger(__name__)
class MeteringRpcCallbacks(object): class MeteringRpcCallbacks(object):
target = messaging.Target(version='1.0') target = oslo_messaging.Target(version='1.0')
def __init__(self, meter_plugin): def __init__(self, meter_plugin):
self.meter_plugin = meter_plugin self.meter_plugin = meter_plugin

View File

@ -15,8 +15,8 @@
from logging import config as logging_config from logging import config as logging_config
from alembic import context from alembic import context
from oslo.config import cfg from oslo_config import cfg
from oslo.db.sqlalchemy import session from oslo_db.sqlalchemy import session
import sqlalchemy as sa import sqlalchemy as sa
from sqlalchemy import event from sqlalchemy import event

View File

@ -20,8 +20,8 @@ from alembic import config as alembic_config
from alembic import environment from alembic import environment
from alembic import script as alembic_script from alembic import script as alembic_script
from alembic import util as alembic_util from alembic import util as alembic_util
from oslo.config import cfg from oslo_config import cfg
from oslo.utils import importutils from oslo_utils import importutils
from neutron.common import repos from neutron.common import repos

View File

@ -60,7 +60,7 @@ To manually test migration from ovs to ml2 with devstack:
import argparse import argparse
from oslo.db.sqlalchemy import session from oslo_db.sqlalchemy import session
import sqlalchemy as sa import sqlalchemy as sa
from neutron.extensions import portbindings from neutron.extensions import portbindings

View File

@ -13,7 +13,7 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
from oslo.db.sqlalchemy import models from oslo_db.sqlalchemy import models
from sqlalchemy.ext import declarative from sqlalchemy.ext import declarative
from sqlalchemy import orm from sqlalchemy import orm

View File

@ -17,7 +17,7 @@ import shlex
import socket import socket
import netaddr import netaddr
from oslo.config import cfg from oslo_config import cfg
from neutron.agent.common import config from neutron.agent.common import config
from neutron.agent.linux import dhcp from neutron.agent.linux import dhcp

View File

@ -15,8 +15,8 @@
import sys import sys
from oslo.config import cfg from oslo_config import cfg
from oslo.utils import importutils from oslo_utils import importutils
from neutron.agent.common import config from neutron.agent.common import config
from neutron.agent.linux import interface from neutron.agent.linux import interface

View File

@ -16,7 +16,7 @@ import webob.exc
from neutron.api.v2 import attributes as attr from neutron.api.v2 import attributes as attr
from neutron.common import exceptions as nexception from neutron.common import exceptions as nexception
from oslo.config import cfg from oslo_config import cfg
allowed_address_pair_opts = [ allowed_address_pair_opts = [
#TODO(limao): use quota framework when it support quota for attributes #TODO(limao): use quota framework when it support quota for attributes

View File

@ -15,7 +15,7 @@
import abc import abc
from oslo.config import cfg from oslo_config import cfg
from neutron.api import extensions from neutron.api import extensions
from neutron.api.v2 import attributes as attr from neutron.api.v2 import attributes as attr

View File

@ -13,8 +13,8 @@
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # under the License.
from oslo.config import cfg from oslo_config import cfg
from oslo.utils import importutils from oslo_utils import importutils
import webob import webob
from neutron.api import extensions from neutron.api import extensions

View File

@ -16,7 +16,7 @@
import abc import abc
import netaddr import netaddr
from oslo.config import cfg from oslo_config import cfg
import six import six
from neutron.api import extensions from neutron.api import extensions

View File

@ -53,6 +53,10 @@ log_translation_hint = re.compile(
for level, hint in _all_log_levels.iteritems())) for level, hint in _all_log_levels.iteritems()))
oslo_namespace_imports_dot = re.compile(r"from[\s]*oslo[.]")
oslo_namespace_imports_root = re.compile(r"from[\s]*oslo[\s]*import[\s]*")
def validate_log_translations(logical_line, physical_line, filename): def validate_log_translations(logical_line, physical_line, filename):
# Translations are not required in the test directory # Translations are not required in the test directory
if "neutron/tests" in filename: if "neutron/tests" in filename:
@ -114,8 +118,22 @@ def check_assert_called_once_with(logical_line, filename):
yield (0, msg) yield (0, msg)
def check_oslo_namespace_imports(logical_line, blank_before, filename):
if re.match(oslo_namespace_imports_dot, logical_line):
msg = ("N323: '%s' must be used instead of '%s'.") % (
logical_line.replace('oslo.', 'oslo_'),
logical_line)
yield(0, msg)
elif re.match(oslo_namespace_imports_root, logical_line):
msg = ("N323: '%s' must be used instead of '%s'.") % (
logical_line.replace('from oslo import ', 'import oslo_'),
logical_line)
yield(0, msg)
def factory(register): def factory(register):
register(validate_log_translations) register(validate_log_translations)
register(use_jsonutils) register(use_jsonutils)
register(check_assert_called_once_with) register(check_assert_called_once_with)
register(no_translate_debug_logs) register(no_translate_debug_logs)
register(check_oslo_namespace_imports)

View File

@ -12,9 +12,9 @@
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # under the License.
from oslo import i18n import oslo_i18n
_translators = i18n.TranslatorFactory(domain='neutron') _translators = oslo_i18n.TranslatorFactory(domain='neutron')
# The primary translation function using the well-known name "_" # The primary translation function using the well-known name "_"
_ = _translators.primary _ = _translators.primary

View File

@ -15,9 +15,9 @@
import weakref import weakref
from oslo.config import cfg from oslo_config import cfg
from oslo import messaging import oslo_messaging
from oslo.utils import importutils from oslo_utils import importutils
from neutron.common import utils from neutron.common import utils
from neutron.i18n import _LE, _LI from neutron.i18n import _LE, _LI
@ -36,7 +36,7 @@ CORE_PLUGINS_NAMESPACE = 'neutron.core_plugins'
class Manager(periodic_task.PeriodicTasks): class Manager(periodic_task.PeriodicTasks):
# Set RPC API version to 1.0 by default. # Set RPC API version to 1.0 by default.
target = messaging.Target(version='1.0') target = oslo_messaging.Target(version='1.0')
def __init__(self, host=None): def __init__(self, host=None):
if not host: if not host:

View File

@ -17,7 +17,7 @@ import eventlet
from novaclient import exceptions as nova_exceptions from novaclient import exceptions as nova_exceptions
import novaclient.v1_1.client as nclient import novaclient.v1_1.client as nclient
from novaclient.v1_1.contrib import server_external_events from novaclient.v1_1.contrib import server_external_events
from oslo.config import cfg from oslo_config import cfg
from sqlalchemy.orm import attributes as sql_attr from sqlalchemy.orm import attributes as sql_attr
from neutron.common import constants from neutron.common import constants

View File

@ -22,9 +22,9 @@ import time
import eventlet import eventlet
eventlet.monkey_patch() eventlet.monkey_patch()
from oslo.config import cfg from oslo_config import cfg
from oslo import messaging import oslo_messaging
from oslo.utils import excutils from oslo_utils import excutils
from neutron.agent.linux import ovs_lib from neutron.agent.linux import ovs_lib
from neutron.agent.linux import utils from neutron.agent.linux import utils
@ -73,7 +73,7 @@ class IVSBridge(ovs_lib.OVSBridge):
class RestProxyAgent(sg_rpc.SecurityGroupAgentRpcCallbackMixin): class RestProxyAgent(sg_rpc.SecurityGroupAgentRpcCallbackMixin):
target = messaging.Target(version='1.1') target = oslo_messaging.Target(version='1.1')
def __init__(self, integ_br, polling_interval, root_helper, vs='ovs'): def __init__(self, integ_br, polling_interval, root_helper, vs='ovs'):
super(RestProxyAgent, self).__init__() super(RestProxyAgent, self).__init__()

View File

@ -17,7 +17,7 @@
This module manages configuration options This module manages configuration options
""" """
from oslo.config import cfg from oslo_config import cfg
from neutron.agent.common import config as agconfig from neutron.agent.common import config as agconfig
from neutron.common import utils from neutron.common import utils

View File

@ -17,9 +17,9 @@ import re
import string import string
import time import time
from oslo.config import cfg from oslo_config import cfg
from oslo.db import exception as db_exc from oslo_db import exception as db_exc
from oslo.db.sqlalchemy import session from oslo_db.sqlalchemy import session
import sqlalchemy as sa import sqlalchemy as sa
from neutron.db import model_base from neutron.db import model_base

View File

@ -22,8 +22,8 @@ It is intended to be used in conjunction with the Big Switch ML2 driver or the
Big Switch core plugin. Big Switch core plugin.
""" """
from oslo.config import cfg from oslo_config import cfg
from oslo.utils import excutils from oslo_utils import excutils
from neutron.api import extensions as neutron_extensions from neutron.api import extensions as neutron_extensions
from neutron.common import exceptions from neutron.common import exceptions

View File

@ -46,9 +46,9 @@ import httplib
import re import re
import eventlet import eventlet
from oslo.config import cfg from oslo_config import cfg
from oslo import messaging import oslo_messaging
from oslo.utils import importutils from oslo_utils import importutils
from sqlalchemy.orm import exc as sqlexc from sqlalchemy.orm import exc as sqlexc
from neutron.agent import securitygroups_rpc as sg_rpc from neutron.agent import securitygroups_rpc as sg_rpc
@ -98,7 +98,7 @@ class AgentNotifierApi(sg_rpc.SecurityGroupAgentRpcApiMixin):
def __init__(self, topic): def __init__(self, topic):
self.topic = topic self.topic = topic
target = messaging.Target(topic=topic, version='1.0') target = oslo_messaging.Target(topic=topic, version='1.0')
self.client = n_rpc.get_client(target) self.client = n_rpc.get_client(target)
def port_update(self, context, port): def port_update(self, context, port):

View File

@ -13,7 +13,7 @@
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # under the License.
from oslo.config import cfg from oslo_config import cfg
import sqlalchemy as sa import sqlalchemy as sa
from sqlalchemy import orm from sqlalchemy import orm

View File

@ -36,9 +36,9 @@ import weakref
import eventlet import eventlet
import eventlet.corolocal import eventlet.corolocal
from oslo.config import cfg from oslo_config import cfg
from oslo.serialization import jsonutils from oslo_serialization import jsonutils
from oslo.utils import excutils from oslo_utils import excutils
from neutron.common import exceptions from neutron.common import exceptions
from neutron.i18n import _LE, _LI, _LW from neutron.i18n import _LE, _LI, _LW

View File

@ -22,7 +22,7 @@ from __future__ import print_function
import re import re
from oslo.serialization import jsonutils from oslo_serialization import jsonutils
from six import moves from six import moves
from wsgiref import simple_server from wsgiref import simple_server

View File

@ -19,10 +19,10 @@
"""Implentation of Brocade Neutron Plugin.""" """Implentation of Brocade Neutron Plugin."""
from oslo.config import cfg from oslo_config import cfg
from oslo import messaging
from oslo.utils import importutils
from oslo_context import context as oslo_context from oslo_context import context as oslo_context
import oslo_messaging
from oslo_utils import importutils
from neutron.agent import securitygroups_rpc as sg_rpc from neutron.agent import securitygroups_rpc as sg_rpc
from neutron.api.rpc.agentnotifiers import dhcp_rpc_agent_api from neutron.api.rpc.agentnotifiers import dhcp_rpc_agent_api
@ -80,7 +80,7 @@ cfg.CONF.register_opts(PHYSICAL_INTERFACE_OPTS, "PHYSICAL_INTERFACE")
class BridgeRpcCallbacks(object): class BridgeRpcCallbacks(object):
"""Agent callback.""" """Agent callback."""
target = messaging.Target(version='1.2') target = oslo_messaging.Target(version='1.2')
# Device names start with "tap" # Device names start with "tap"
# history # history
# 1.1 Support Security Group RPC # 1.1 Support Security Group RPC
@ -177,7 +177,7 @@ class AgentNotifierApi(sg_rpc.SecurityGroupAgentRpcApiMixin):
def __init__(self, topic): def __init__(self, topic):
self.topic = topic self.topic = topic
target = messaging.Target(topic=topic, version='1.0') target = oslo_messaging.Target(topic=topic, version='1.0')
self.client = n_rpc.get_client(target) self.client = n_rpc.get_client(target)
self.topic_network_delete = topics.get_topic_name(topic, self.topic_network_delete = topics.get_topic_name(topic,
topics.NETWORK, topics.NETWORK,

View File

@ -19,7 +19,7 @@ Neutron network life-cycle management.
""" """
from ncclient import manager from ncclient import manager
from oslo.utils import excutils from oslo_utils import excutils
from neutron.i18n import _LE from neutron.i18n import _LE
from neutron.openstack.common import log as logging from neutron.openstack.common import log as logging

View File

@ -18,11 +18,11 @@ import pprint
import sys import sys
import time import time
from oslo.config import cfg
from oslo import messaging
from oslo.utils import importutils
from oslo.utils import timeutils
from oslo_concurrency import lockutils from oslo_concurrency import lockutils
from oslo_config import cfg
import oslo_messaging
from oslo_utils import importutils
from oslo_utils import timeutils
from neutron.agent.common import config from neutron.agent.common import config
from neutron.agent.linux import external_process from neutron.agent.linux import external_process
@ -54,7 +54,7 @@ class CiscoDeviceManagementApi(object):
def __init__(self, topic, host): def __init__(self, topic, host):
self.host = host self.host = host
target = messaging.Target(topic=topic, version='1.0') target = oslo_messaging.Target(topic=topic, version='1.0')
self.client = n_rpc.get_client(target) self.client = n_rpc.get_client(target)
def report_dead_hosting_devices(self, context, hd_ids=None): def report_dead_hosting_devices(self, context, hd_ids=None):
@ -94,7 +94,7 @@ class CiscoCfgAgent(manager.Manager):
The main entry points in this class are the `process_services()` and The main entry points in this class are the `process_services()` and
`_backlog_task()` . `_backlog_task()` .
""" """
target = messaging.Target(version='1.1') target = oslo_messaging.Target(version='1.1')
OPTS = [ OPTS = [
cfg.IntOpt('rpc_loop_interval', default=10, cfg.IntOpt('rpc_loop_interval', default=10,

View File

@ -21,7 +21,7 @@ import xml.etree.ElementTree as ET
import ciscoconfparse import ciscoconfparse
from ncclient import manager from ncclient import manager
from oslo.config import cfg from oslo_config import cfg
from neutron.i18n import _LE, _LI, _LW from neutron.i18n import _LE, _LI, _LW
from neutron.plugins.cisco.cfg_agent import cfg_exceptions as cfg_exc from neutron.plugins.cisco.cfg_agent import cfg_exceptions as cfg_exc

View File

@ -12,8 +12,8 @@
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # under the License.
from oslo.utils import excutils from oslo_utils import excutils
from oslo.utils import importutils from oslo_utils import importutils
from neutron.i18n import _LE from neutron.i18n import _LE
from neutron.openstack.common import log as logging from neutron.openstack.common import log as logging

View File

@ -14,7 +14,7 @@
import logging import logging
from oslo.serialization import jsonutils from oslo_serialization import jsonutils
from neutron.plugins.cisco.cfg_agent.device_drivers import devicedriver_api from neutron.plugins.cisco.cfg_agent.device_drivers import devicedriver_api

View File

@ -14,8 +14,8 @@
import datetime import datetime
from oslo.config import cfg from oslo_config import cfg
from oslo.utils import timeutils from oslo_utils import timeutils
from neutron.agent.linux import utils as linux_utils from neutron.agent.linux import utils as linux_utils
from neutron.i18n import _LI, _LW from neutron.i18n import _LI, _LW

View File

@ -16,8 +16,8 @@ import collections
import eventlet import eventlet
import netaddr import netaddr
from oslo import messaging import oslo_messaging
from oslo.utils import excutils from oslo_utils import excutils
from neutron.common import constants as l3_constants from neutron.common import constants as l3_constants
from neutron.common import rpc as n_rpc from neutron.common import rpc as n_rpc
@ -90,7 +90,7 @@ class CiscoRoutingPluginApi(object):
def __init__(self, topic, host): def __init__(self, topic, host):
self.host = host self.host = host
target = messaging.Target(topic=topic, version='1.0') target = oslo_messaging.Target(topic=topic, version='1.0')
self.client = n_rpc.get_client(target) self.client = n_rpc.get_client(target)
def get_routers(self, context, router_ids=None, hd_ids=None): def get_routers(self, context, router_ids=None, hd_ids=None):
@ -281,7 +281,7 @@ class RoutingServiceHelper(object):
if device_ids: if device_ids:
return self.plugin_rpc.get_routers(self.context, return self.plugin_rpc.get_routers(self.context,
hd_ids=device_ids) hd_ids=device_ids)
except messaging.MessagingException: except oslo_messaging.MessagingException:
LOG.exception(_LE("RPC Error in fetching routers from plugin")) LOG.exception(_LE("RPC Error in fetching routers from plugin"))
self.fullsync = True self.fullsync = True

View File

@ -12,7 +12,7 @@
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # under the License.
from oslo.config import cfg from oslo_config import cfg
from neutron.agent.common import config from neutron.agent.common import config

View File

@ -16,9 +16,9 @@ import random
from keystoneclient import exceptions as k_exceptions from keystoneclient import exceptions as k_exceptions
from keystoneclient.v2_0 import client as k_client from keystoneclient.v2_0 import client as k_client
from oslo.config import cfg from oslo_config import cfg
from oslo.utils import importutils from oslo_utils import importutils
from oslo.utils import timeutils from oslo_utils import timeutils
from sqlalchemy.orm import exc from sqlalchemy.orm import exc
from sqlalchemy.orm import joinedload from sqlalchemy.orm import joinedload

View File

@ -14,8 +14,8 @@
import copy import copy
from oslo.config import cfg
from oslo_concurrency import lockutils from oslo_concurrency import lockutils
from oslo_config import cfg
from sqlalchemy.orm import exc from sqlalchemy.orm import exc
from sqlalchemy.orm import joinedload from sqlalchemy.orm import joinedload
from sqlalchemy.sql import expression as expr from sqlalchemy.sql import expression as expr

View File

@ -14,8 +14,8 @@
import netaddr import netaddr
from oslo.config import cfg from oslo_config import cfg
from oslo.utils import excutils from oslo_utils import excutils
from neutron.i18n import _LE from neutron.i18n import _LE
from neutron import manager from neutron import manager

View File

@ -14,7 +14,7 @@
import eventlet import eventlet
from oslo.config import cfg from oslo_config import cfg
from sqlalchemy.orm import exc from sqlalchemy.orm import exc
from sqlalchemy.sql import expression as expr from sqlalchemy.sql import expression as expr

Some files were not shown because too many files have changed in this diff Show More