예제 #1
0
파일: test_api.py 프로젝트: dsetia/neutron
    def setUp(self):
        super(TestApiCache, self).setUp()
        self.addCleanup(mock.patch.stopall)

        self.api = api.LbaasAgentApi('topic', mock.sentinel.context, 'host')
        self.make_msg = mock.patch.object(self.api, 'make_msg').start()
        self.mock_call = mock.patch.object(self.api, 'call').start()
예제 #2
0
 def _setup_rpc(self):
     self.plugin_rpc = agent_api.LbaasAgentApi(
         plugin_driver.TOPIC_PROCESS_ON_HOST, self.context, self.conf.host)
     self.state_rpc = agent_rpc.PluginReportStateAPI(
         plugin_driver.TOPIC_PROCESS_ON_HOST)
     report_interval = self.conf.AGENT.report_interval
     if report_interval:
         heartbeat = loopingcall.FixedIntervalLoopingCall(
             self._report_state)
         heartbeat.start(interval=report_interval)
예제 #3
0
    def __init__(self, conf):
        self.conf = conf
        self.context = context.get_admin_context_without_session()
        self.plugin_rpc = agent_api.LbaasAgentApi(
            plugin_driver.TOPIC_LOADBALANCER_PLUGIN, self.context,
            self.conf.host)
        self._load_drivers()

        self.agent_state = {
            'binary': 'neutron-lbaas-agent',
            'host': conf.host,
            'topic': plugin_driver.TOPIC_LOADBALANCER_AGENT,
            'configurations': {
                'device_drivers': self.device_drivers.keys()
            },
            'agent_type': n_const.AGENT_TYPE_LOADBALANCER,
            'start_flag': True
        }
        self.admin_state_up = True

        self._setup_state_rpc()
        self.needs_resync = False
        # pool_id->device_driver_name mapping used to store known instances
        self.instance_mapping = {}