예제 #1
0
    def test_update_pool_stats(self):
        """Implements test case for update_pool_stats method
        of loadbalancer agent's LBaasRpcSender class.

        Returns: none

        """

        sc, conf, rpc_mgr = self._get_configurator_rpc_manager_object()
        agent = lb.LBaasRpcSender(sc)
        context = test_data.Context()
        agent.update_pool_stats('pool_id', 'stats', context)
예제 #2
0
    def test_get_logical_device(self):
        """Implements test case for get_logical_device method
        of loadbalancer agent's LBaasRpcSender class.

        Returns: none

        """

        sc, conf, rpc_mgr = self._get_configurator_rpc_manager_object()
        agent = lb.LBaasRpcSender(sc)
        agent.get_logical_device(
            '6350c0fd-07f8-46ff-b797-62acd23760de',
            test_data.FakeObjects()._get_context_logical_device())
예제 #3
0
    def test_update_status(self):
        """Implements test case for update_status method
        of loadbalancer agent's LBaasRpcSender class.

        Returns: none

        """

        sc, conf, rpc_mgr = self._get_configurator_rpc_manager_object()
        agent = lb.LBaasRpcSender(sc)
        agent_info = {'context': 'context', 'resource': 'pool'}
        agent.update_status('pool', 'object_id',
                            'status', agent_info, 'pool')
예제 #4
0
    def test_update_status(self):
        """Implements test case for update_status method
        of loadbalancer agent's LBaasRpcSender class.

        Returns: none

        """

        sc, conf, rpc_mgr = self._get_configurator_rpc_manager_object()
        agent = lb.LBaasRpcSender(sc)
        agent_info = {'context': 'context', 'resource': 'pool'}
        with mock.patch.object(
                sc, 'new_event',
                return_value='foo') as mock_new_event, (mock.patch.object(
                    sc, 'stash_event')) as mock_stash_event:

            agent.update_status('pool', 'object_id', 'status', agent_info,
                                'pool')

            data = {
                'info': {
                    'service_type': "loadbalancer",
                    'context': 'context'
                },
                'notification': [{
                    'resource': 'pool',
                    'data': {
                        'obj_type': 'pool',
                        'obj_id': 'object_id',
                        'notification_type': 'update_status',
                        'status': 'status',
                        'pool': 'pool'
                    }
                }]
            }
            mock_new_event.assert_called_with(id=const.EVENT_STASH,
                                              key=const.EVENT_STASH,
                                              data=data)
            mock_stash_event.assert_called_with('foo')