コード例 #1
0
    def setUp(self):
        super(TestNovaListeners, self).setUp()
        self.servers_plugin = self.initialized_plugins['OS::Nova::Server']
        self.sg_plugin = self.initialized_plugins['OS::Nova::ServerGroup']
        self.flavor_plugin = self.initialized_plugins['OS::Nova::Flavor']

        notification_plugins = {
            plugin.document_type: utils.StevedoreMock(plugin)
            for plugin in (self.servers_plugin, self.sg_plugin,
                           self.flavor_plugin)
        }
        self.notification_endpoint = NotificationEndpoint(
            notification_plugins, PipelineManager(notification_plugins))
        self.listener_alias = self.servers_plugin.alias_name_listener
コード例 #2
0
    def setUp(self):
        version_notifications = \
            'searchlight.elasticsearch.plugins.nova.notification_handler'\
            '.InstanceHandler._use_versioned_notifications'
        mock_versioned = mock.patch(version_notifications, return_value=False)
        mock_versioned.start()
        self.addCleanup(mock_versioned.stop)

        super(TestNovaUnversionedListener, self).setUp()
        self.servers_plugin = self.initialized_plugins['OS::Nova::Server']
        self.server_events = self._load_fixture_data('events/servers.json')

        sp = self.servers_plugin
        notification_plugins = {sp.document_type: utils.StevedoreMock(sp)}

        self.notification_endpoint = NotificationEndpoint(
            notification_plugins, PipelineManager(notification_plugins))
        self.listener_alias = self.servers_plugin.alias_name_listener
コード例 #3
0
    def start(self):
        super(ListenerService, self).start()
        transport = oslo_messaging.get_notification_transport(CONF)
        targets = [
            oslo_messaging.Target(topic=pl_topic, exchange=pl_exchange)
            for pl_topic, pl_exchange in self.topics_exchanges_set
        ]
        endpoints = [
            NotificationEndpoint(self.plugins, PipelineManager(self.plugins))
        ]
        listener = oslo_messaging.get_notification_listener(
            transport,
            targets,
            endpoints,
            executor='threading',
            pool=CONF.listener.notifications_pool)

        listener.start()
        self.listeners.append(listener)
コード例 #4
0
    def setUp(self):
        super(TestNeutronListeners, self).setUp()

        self.networks_plugin = self.initialized_plugins['OS::Neutron::Net']
        self.ports_plugin = self.initialized_plugins['OS::Neutron::Port']
        self.subnets_plugin = self.initialized_plugins['OS::Neutron::Subnet']
        self.routers_plugin = self.initialized_plugins['OS::Neutron::Router']
        self.fip_plugin = self.initialized_plugins['OS::Neutron::FloatingIP']
        self.secgroup_plugin = (
            self.initialized_plugins['OS::Neutron::SecurityGroup'])

        notification_plugins = {
            plugin.document_type: utils.StevedoreMock(plugin)
            for plugin in (self.networks_plugin, self.ports_plugin,
                           self.subnets_plugin, self.routers_plugin,
                           self.fip_plugin, self.secgroup_plugin)
        }
        self.notification_endpoint = NotificationEndpoint(
            notification_plugins, PipelineManager(notification_plugins))

        self.listener_alias = self.networks_plugin.alias_name_listener
コード例 #5
0
    def setUp(self):
        super(TestGlanceListener, self).setUp()
        openstack_client_mod = "searchlight.elasticsearch.plugins." \
                               "openstack_clients.get_glanceclient"
        osclient_patcher = mock.patch(
            openstack_client_mod, mock_glance_pyclient.get_fake_glance_client)
        osclient_patcher.start()
        self.addCleanup(osclient_patcher.stop)

        self.images_plugin = self.initialized_plugins['OS::Glance::Image']
        self.metadefs_plugin = self.initialized_plugins['OS::Glance::Metadef']

        notification_plugins = {
            plugin.document_type: utils.StevedoreMock(plugin)
            for plugin in (self.images_plugin, self.metadefs_plugin)
        }
        self.notification_endpoint = NotificationEndpoint(
            notification_plugins, PipelineManager(notification_plugins))

        self.images_index = self.images_plugin.alias_name_listener
        self.metadefs_index = self.metadefs_plugin.alias_name_listener
コード例 #6
0
    def setUp(self):
        super(TestDesignateListener, self).setUp()

        self.zones_plugin = self.initialized_plugins['OS::Designate::Zone']
        self.recordsets_plugin = self.initialized_plugins[
            'OS::Designate::RecordSet']
        '''openstack_client_mod = "searchlight.elasticsearch.plugins." \
                               "openstack_clients.get_designateclient"
        osclient_patcher = mock.patch(
            openstack_client_mod,
            mock_designate_pyclient.get_fake_designate_client
        )
        osclient_patcher.start()
        self.addCleanup(osclient_patcher.stop)'''

        notification_plugins = {
            plugin.document_type: utils.StevedoreMock(plugin)
            for plugin in (self.zones_plugin, self.recordsets_plugin)
        }
        self.notification_endpoint = NotificationEndpoint(
            notification_plugins, PipelineManager(notification_plugins))

        self.listener_alias = self.zones_plugin.alias_name_listener
コード例 #7
0
    def setUp(self):
        super(TestCinderNotifications, self).setUp()
        self.volume_plugin = self.initialized_plugins['OS::Cinder::Volume']
        self.snapshot_plugin = self.initialized_plugins['OS::Cinder::Snapshot']

        self.volume_events = self._load_fixture_data('events/volumes.json')
        self.snapshot_events = self._load_fixture_data('events/snapshots.json')

        notification_plugins = {
            plugin.document_type: utils.StevedoreMock(plugin)
            for plugin in (self.volume_plugin, self.snapshot_plugin)
        }
        self.notification_endpoint = NotificationEndpoint(
            notification_plugins, PipelineManager(notification_plugins))

        self.index_alias = self.volume_plugin.alias_name_listener

        volume = {
            'id': VOLUME_ID1,
            'user_id': USER_ID,
            'created_at': '2016-03-07T16:51:09.000000',
            'updated_at': '2016-03-07T16:51:09.000000'
        }
        self.volume_fixture = utils.DictObj(**volume)