Пример #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
 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
    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
    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
    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
    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
    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
    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()
 def __init__(self):
     self.notification_api = resources_rpc.ResourcesPushRpcApi()
     registry.provide(_get_qos_policy_cb, resources.QOS_POLICY)
Пример #15
0
 def __init__(self):
     self.notification_api = resources_rpc.ResourcesPushRpcApi()
     registry.provide(_get_qos_policy_cb, resources.QOS_POLICY)