#    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.
"""
The MatchMaker classes should accept a Topic or Fanout exchange key and
return keys for direct exchanges, per (approximate) AMQP parlance.
"""

from oslo.config import cfg

from oslo.messaging._drivers import matchmaker as mm_common
from oslo.messaging.openstack.common import importutils

redis = importutils.try_import('redis')


matchmaker_redis_opts = [
    cfg.StrOpt('host',
               default='127.0.0.1',
               help='Host to locate redis.'),
    cfg.IntOpt('port',
               default=6379,
               help='Use this port to connect to redis host.'),
    cfg.StrOpt('password',
               default=None,
               help='Password for Redis server (optional).'),
]

CONF = cfg.CONF
from oslo.config import cfg
import six

from oslo.messaging._drivers import amqp as rpc_amqp
from oslo.messaging._drivers import amqpdriver
from oslo.messaging._drivers import common as rpc_common
from oslo.messaging import exceptions
from oslo.messaging.openstack.common import importutils
from oslo.messaging.openstack.common import jsonutils
from oslo.messaging.openstack.common import network_utils

# FIXME(markmc): remove this
_ = lambda s: s

qpid_codec = importutils.try_import("qpid.codec010")
qpid_messaging = importutils.try_import("qpid.messaging")
qpid_exceptions = importutils.try_import("qpid.messaging.exceptions")

LOG = logging.getLogger(__name__)

qpid_opts = [
    cfg.StrOpt('qpid_hostname',
               default='localhost',
               help='Qpid broker hostname.'),
    cfg.IntOpt('qpid_port',
               default=5672,
               help='Qpid broker port.'),
    cfg.ListOpt('qpid_hosts',
                default=['$qpid_hostname:$qpid_port'],
                help='Qpid HA cluster host:port pairs.'),
import uuid

import eventlet
import greenlet
import six
from six import moves

from oslo.config import cfg
from oslo.messaging._drivers import base
from oslo.messaging._drivers import common as rpc_common
from oslo.messaging._executors import impl_eventlet  # FIXME(markmc)
from oslo.messaging.openstack.common import excutils
from oslo.messaging.openstack.common import importutils
from oslo.messaging.openstack.common import jsonutils

zmq = importutils.try_import('eventlet.green.zmq')

# for convenience, are not modified.
pformat = pprint.pformat
Timeout = eventlet.timeout.Timeout
LOG = logging.getLogger(__name__)
RPCException = rpc_common.RPCException

# FIXME(markmc): remove this
_ = lambda s: s

zmq_opts = [
    cfg.StrOpt('rpc_zmq_bind_address', default='*',
               help='ZeroMQ bind address. Should be a wildcard (*), '
                    'an ethernet interface, or IP. '
                    'The "host" option should point or resolve to this '
#    WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
#    License for the specific language governing permissions and limitations
#    under the License.
"""
The MatchMaker classes should accept a Topic or Fanout exchange key and
return keys for direct exchanges, per (approximate) AMQP parlance.
"""

import logging

from oslo.config import cfg

from oslo.messaging._drivers import matchmaker as mm_common
from oslo.messaging.openstack.common import importutils

redis = importutils.try_import('redis')

matchmaker_redis_opts = [
    cfg.StrOpt('host', default='127.0.0.1', help='Host to locate redis'),
    cfg.IntOpt('port',
               default=6379,
               help='Use this port to connect to redis host.'),
    cfg.StrOpt('password',
               default=None,
               help='Password for Redis server. (optional)'),
]

CONF = cfg.CONF
opt_group = cfg.OptGroup(name='matchmaker_redis',
                         title='Options for Redis-based MatchMaker')
CONF.register_group(opt_group)
    due to missing dependencies.  Stubs out the _amqp1_opts option list and
    provides a fake 'Task' superclass so the sub-classes SendTask, ListenTask,
    and ReplyTask defined by this module will parse correctly on import.

    This allows the tests to import the driver.py module without failing even
    if the proton libraries are not installed.  Be aware that attempting to use
    (instantiate) the PythonDriver will raise a NotImplementedError if the fake
    controller is in use.  This is by design since the driver really cannot
    work without the real controller and its dependencies.
    """
    fake_controller = True
    Task = type('Task', (object, ), {})
    _amqp1_opts = list()


proton = importutils.try_import("proton")
try:
    from oslo.messaging._drivers.protocols.amqp import controller
except ImportError:
    controller = _FakeController()


def get_opts():
    """Provide access to the controller's configuration options."""
    return controller._amqp1_opts


# TODO(kgiusti) End of hack

LOG = logging.getLogger(__name__)
    import xmlrpclib
except ImportError:
    # NOTE(jaypipes): xmlrpclib was renamed to xmlrpc.client in Python3
    #                 however the function and object call signatures
    #                 remained the same. This whole try/except block should
    #                 be removed and replaced with a call to six.moves once
    #                 six 1.4.2 is released. See http://bit.ly/1bqrVzu
    import xmlrpc.client as xmlrpclib

import six

from oslo.messaging.openstack.common import gettextutils
from oslo.messaging.openstack.common import importutils
from oslo.messaging.openstack.common import timeutils

netaddr = importutils.try_import("netaddr")

_nasty_type_tests = [
    inspect.ismodule,
    inspect.isclass,
    inspect.ismethod,
    inspect.isfunction,
    inspect.isgeneratorfunction,
    inspect.isgenerator,
    inspect.istraceback,
    inspect.isframe,
    inspect.iscode,
    inspect.isbuiltin,
    inspect.isroutine,
    inspect.isabstract,
]
import eventlet
import greenlet
from oslo.config import cfg

from oslo.messaging._drivers import amqp as rpc_amqp
from oslo.messaging._drivers import amqpdriver
from oslo.messaging._drivers import common as rpc_common
from oslo.messaging.openstack.common import excutils
from oslo.messaging.openstack.common import importutils
from oslo.messaging.openstack.common import jsonutils

# FIXME(markmc): remove this
_ = lambda s: s

qpid_codec = importutils.try_import("qpid.codec010")
qpid_messaging = importutils.try_import("qpid.messaging")
qpid_exceptions = importutils.try_import("qpid.messaging.exceptions")

LOG = logging.getLogger(__name__)

qpid_opts = [
    cfg.StrOpt('qpid_hostname',
               default='localhost',
               help='Qpid broker hostname'),
    cfg.IntOpt('qpid_port',
               default=5672,
               help='Qpid broker port'),
    cfg.ListOpt('qpid_hosts',
                default=['$qpid_hostname:$qpid_port'],
                help='Qpid HA cluster host:port pairs'),
#    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.
"""
The MatchMaker classes should accept a Topic or Fanout exchange key and
return keys for direct exchanges, per (approximate) AMQP parlance.
"""

from oslo.config import cfg

from oslo.messaging._drivers import matchmaker as mm_common
from oslo.messaging.openstack.common import importutils

redis = importutils.try_import("redis")


matchmaker_redis_opts = [
    cfg.StrOpt("host", default="127.0.0.1", help="Host to locate redis."),
    cfg.IntOpt("port", default=6379, help="Use this port to connect to redis host."),
    cfg.StrOpt("password", default=None, help="Password for Redis server (optional)."),
]

CONF = cfg.CONF
opt_group = cfg.OptGroup(name="matchmaker_redis", title="Options for Redis-based MatchMaker")
CONF.register_group(opt_group)
CONF.register_opts(matchmaker_redis_opts, opt_group)


class RedisExchange(mm_common.Exchange):
Exemple #9
0
    # simplejson module if available
    try:
        import simplejson as json
    except ImportError:
        import json
else:
    import json

import six
import six.moves.xmlrpc_client as xmlrpclib

from oslo.messaging.openstack.common import gettextutils
from oslo.messaging.openstack.common import importutils
from oslo.messaging.openstack.common import timeutils

netaddr = importutils.try_import("netaddr")

_nasty_type_tests = [inspect.ismodule, inspect.isclass, inspect.ismethod,
                     inspect.isfunction, inspect.isgeneratorfunction,
                     inspect.isgenerator, inspect.istraceback, inspect.isframe,
                     inspect.iscode, inspect.isbuiltin, inspect.isroutine,
                     inspect.isabstract]

_simple_types = (six.string_types + six.integer_types
                 + (type(None), bool, float))


def to_primitive(value, convert_instances=False, convert_datetime=True,
                 level=0, max_depth=3):
    """Convert a complex object into primitives.
Exemple #10
0
import uuid

import eventlet
import greenlet
from oslo.config import cfg
import six
from six import moves

from oslo.messaging._drivers import base
from oslo.messaging._drivers import common as rpc_common
from oslo.messaging._executors import impl_eventlet  # FIXME(markmc)
from oslo.messaging.openstack.common import excutils
from oslo.messaging.openstack.common import importutils
from oslo.messaging.openstack.common import jsonutils

zmq = importutils.try_import('eventlet.green.zmq')

# for convenience, are not modified.
pformat = pprint.pformat
Timeout = eventlet.timeout.Timeout
LOG = logging.getLogger(__name__)
RPCException = rpc_common.RPCException

# FIXME(markmc): remove this
_ = lambda s: s

zmq_opts = [
    cfg.StrOpt('rpc_zmq_bind_address',
               default='*',
               help='ZeroMQ bind address. Should be a wildcard (*), '
               'an ethernet interface, or IP. '
import threading
import time
import uuid

from six import moves
import testtools

from oslo import messaging
from oslo.messaging._drivers.protocols.amqp import driver as amqp_driver
from oslo.messaging.openstack.common import importutils
from tests import utils as test_utils

# TODO(kgiusti) Conditionally run these tests only if the necessary
# dependencies are installed.  This should be removed once the proton libraries
# are available in the base repos for all supported platforms.
pyngus = importutils.try_import("pyngus")

LOG = logging.getLogger(__name__)


class _ListenerThread(threading.Thread):
    """Run a blocking listener in a thread."""
    def __init__(self, listener, msg_count):
        super(_ListenerThread, self).__init__()
        self.listener = listener
        self.msg_count = msg_count
        self.messages = moves.queue.Queue()
        self.daemon = True
        self.start()

    def run(self):
import threading
import time
import uuid

from six import moves
import testtools

from oslo import messaging
from oslo.messaging._drivers.protocols.amqp import driver as amqp_driver
from oslo.messaging.openstack.common import importutils
from tests import utils as test_utils

# TODO(kgiusti) Conditionally run these tests only if the necessary
# dependencies are installed.  This should be removed once the proton libraries
# are available in the base repos for all supported platforms.
pyngus = importutils.try_import("pyngus")

LOG = logging.getLogger(__name__)


class _ListenerThread(threading.Thread):
    """Run a blocking listener in a thread."""
    def __init__(self, listener, msg_count):
        super(_ListenerThread, self).__init__()
        self.listener = listener
        self.msg_count = msg_count
        self.messages = moves.queue.Queue()
        self.daemon = True
        self.start()

    def run(self):
Exemple #13
0
    due to missing dependencies.  Stubs out the _amqp1_opts option list and
    provides a fake 'Task' superclass so the sub-classes SendTask, ListenTask,
    and ReplyTask defined by this module will parse correctly on import.

    This allows the tests to import the driver.py module without failing even
    if the proton libraries are not installed.  Be aware that attempting to use
    (instantiate) the PythonDriver will raise a NotImplementedError if the fake
    controller is in use.  This is by design since the driver really cannot
    work without the real controller and its dependencies.
    """
    fake_controller = True
    Task = type('Task', (object,), {})
    _amqp1_opts = list()


proton = importutils.try_import("proton")
try:
    from oslo.messaging._drivers.protocols.amqp import controller
except ImportError:
    controller = _FakeController()


def get_opts():
    """Provide access to the controller's configuration options."""
    return controller._amqp1_opts
# TODO(kgiusti) End of hack

LOG = logging.getLogger(__name__)


class SendTask(controller.Task):