コード例 #1
0
 def __init__(self):
     # Used to provide trunk lookups for the agent.
     registry.provide(trunk_by_port_provider, resources.TRUNK)
     self._connection = n_rpc.Connection()
     self._connection.create_consumer(constants.TRUNK_BASE_TOPIC, [self],
                                      fanout=False)
     self._connection.consume_in_threads()
コード例 #2
0
ファイル: server.py プロジェクト: igordcard/neutron
 def __init__(self):
     # Used to provide trunk lookups for the agent.
     registry.provide(trunk_by_port_provider, resources.TRUNK)
     self._connection = n_rpc.Connection()
     self._connection.create_consumer(
         constants.TRUNK_BASE_TOPIC, [self], fanout=False)
     self._connection.consume_in_threads()
コード例 #3
0
    def test_pull_does_not_raise_on_none(self):
        def _none_cb(*args, **kwargs):
            pass

        registry.provide(_none_cb, resources.QOS_POLICY)

        obj = registry.pull(resources.QOS_POLICY, 'fake_id')
        self.assertIsNone(obj)
コード例 #4
0
    def test_pull_raises_on_wrong_object_type(self):
        def _wrong_type_cb(*args, **kwargs):
            return object()

        registry.provide(_wrong_type_cb, resources.QOS_POLICY)

        self.assertRaises(exceptions.CallbackWrongResourceType, registry.pull,
                          resources.QOS_POLICY, 'fake_id')
コード例 #5
0
ファイル: test_registry.py プロジェクト: 21atlas/neutron
    def test_pull_does_not_raise_on_none(self):
        def _none_cb(*args, **kwargs):
            pass

        registry.provide(_none_cb, resources.QOS_POLICY)

        obj = registry.pull(resources.QOS_POLICY, 'fake_id')
        self.assertIsNone(obj)
コード例 #6
0
    def test_clear_unprovides_all_producers(self):
        def _fake_policy_cb(*args, **kwargs):
            pass

        registry.provide(_fake_policy_cb, resources.QOS_POLICY)
        registry.clear()

        self.assertRaises(exceptions.CallbackNotFound, registry.pull,
                          resources.QOS_POLICY, 'fake_id')
コード例 #7
0
ファイル: test_registry.py プロジェクト: 21atlas/neutron
    def test_pull_raises_on_wrong_object_type(self):
        def _wrong_type_cb(*args, **kwargs):
            return object()

        registry.provide(_wrong_type_cb, resources.QOS_POLICY)

        self.assertRaises(
            exceptions.CallbackWrongResourceType,
            registry.pull, resources.QOS_POLICY, 'fake_id')
コード例 #8
0
    def test_pull_returns_callback_result(self):
        policy_obj = policy.QosPolicy(context=None)

        def _fake_policy_cb(*args, **kwargs):
            return policy_obj

        registry.provide(_fake_policy_cb, resources.QOS_POLICY)

        self.assertEqual(policy_obj,
                         registry.pull(resources.QOS_POLICY, 'fake_id'))
コード例 #9
0
ファイル: test_registry.py プロジェクト: 21atlas/neutron
    def test_clear_unprovides_all_producers(self):
        def _fake_policy_cb(*args, **kwargs):
            pass

        registry.provide(_fake_policy_cb, resources.QOS_POLICY)
        registry.clear()

        self.assertRaises(
            exceptions.CallbackNotFound,
            registry.pull, resources.QOS_POLICY, 'fake_id')
コード例 #10
0
    def __init__(self):
        self._drivers = []
        self.rpc_notifications_required = False
        rpc_registry.provide(self._get_qos_policy_cb, resources.QOS_POLICY)
        # notify any registered QoS driver that we're ready, those will
        # call the driver manager back with register_driver if they
        # are enabled
        registry.notify(qos_consts.QOS_PLUGIN, events.AFTER_INIT, self)

        if self.rpc_notifications_required:
            self.push_api = resources_rpc.ResourcesPushRpcApi()
コード例 #11
0
ファイル: test_registry.py プロジェクト: 21atlas/neutron
    def test_pull_returns_callback_result(self):
        policy_obj = policy.QosPolicy(context=None)

        def _fake_policy_cb(*args, **kwargs):
            return policy_obj

        registry.provide(_fake_policy_cb, resources.QOS_POLICY)

        self.assertEqual(
            policy_obj,
            registry.pull(resources.QOS_POLICY, 'fake_id'))
コード例 #12
0
ファイル: manager.py プロジェクト: openstack/neutron
    def __init__(self):
        self._drivers = []
        self.rpc_notifications_required = False
        rpc_registry.provide(self._get_qos_policy_cb, resources.QOS_POLICY)
        # notify any registered QoS driver that we're ready, those will
        # call the driver manager back with register_driver if they
        # are enabled
        registry.publish(qos_consts.QOS_PLUGIN, events.AFTER_INIT, self)

        if self.rpc_notifications_required:
            self.push_api = resources_rpc.ResourcesPushRpcApi()
コード例 #13
0
ファイル: manager.py プロジェクト: zhouqiang-cl/neutron
    def __init__(self, enable_rpc=False):
        self._drivers = []
        self.notification_api = resources_rpc.ResourcesPushRpcApi()
        #TODO(mangelajo): remove the enable_rpc parameter in Pike since
        #                 we only use it when a message_queue derived driver
        #                 is found in the notification_drivers
        self.rpc_notifications_required = enable_rpc
        rpc_registry.provide(self._get_qos_policy_cb, resources.QOS_POLICY)
        # notify any registered QoS driver that we're ready, those will
        # call the driver manager back with register_driver if they
        # are enabled
        registry.notify(qos_consts.QOS_PLUGIN, events.AFTER_INIT, self)

        if self.rpc_notifications_required:
            self.push_api = resources_rpc.ResourcesPushRpcApi()
コード例 #14
0
 def __init__(self):
     self.notification_api = resources_rpc.ResourcesPushRpcApi()
     registry.provide(_get_qos_policy_cb, resources.QOS_POLICY)
コード例 #15
0
ファイル: message_queue.py プロジェクト: dingboopt/neutron-x
 def __init__(self):
     self.notification_api = resources_rpc.ResourcesPushRpcApi()
     registry.provide(_get_qos_policy_cb, resources.QOS_POLICY)