def __init__(self, conf): super(LbaasAgentManager, self).__init__() self.conf = conf self.context = context.get_admin_context_without_session() self.plugin_rpc = agent_api.LbaasAgentApi(topics.LOADBALANCER_PLUGIN, self.context, self.conf.host) self._load_drivers() self.agent_state = { 'binary': 'neutron-lbaas-agent', 'host': conf.host, 'topic': topics.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 # loadbalancer_id->device_driver_name mapping used to store known instances self.instance_mapping = {} # loadbalancer_id->tenant_id mapping used to store known instances self.label_tenant_id = {} collect_statistic = loopingcall.FixedIntervalLoopingCall( self.collect_stats_for_monitor) collect_statistic.start(interval=cfg.CONF.collect_periodic_interval)
def __init__(self, conf): super(LbaasAgentManager, self).__init__() self.conf = conf self.context = context.get_admin_context_without_session() self.plugin_rpc = agent_api.LbaasAgentApi(topics.LOADBALANCER_PLUGIN, self.context, self.conf.host) self._load_drivers() self.haproxy_int_driver = self.device_drivers.get( integration_driver.DRIVER_NAME) # pool_id->device_driver_name mapping used to store known instances self.instance_mapping = {} self.agent_state = { 'binary': 'neutron-lbaas-agent', 'host': self.conf.host, 'topic': topics.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
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()