def setUp(self): super(TestBacklogHostingDevice, self).setUp() self.status = device_status.DeviceStatus() device_status._is_pingable = mock.MagicMock(return_value=True) self.can_connect_mock = mock.MagicMock(return_value=True) device_status._can_connect = self.can_connect_mock self.hosting_device = { 'id': 123, 'host_type': 'VM', 'management_ip_address': '10.0.0.1', 'protocol_port': '22', 'booting_time': 420 } self.created_at_str = datetime.datetime.utcnow().strftime( "%Y-%m-%d %H:%M:%S") self.hosting_device['created_at'] = self.created_at_str # if is_pingable, then hd_state is 'Active' self.hosting_device['hd_state'] = cc.HD_ACTIVE self.router_id = _uuid() self.router = { id: self.router_id, 'hosting_device': self.hosting_device } # mock out drv_mgr self.drv_mgr = mock.MagicMock() self.drv_mock = mock.MagicMock() self.drv_mgr.get_driver_for_hosting_device.return_value = self.drv_mock
def __init__(self, host, conf=None): self.conf = conf or cfg.CONF self._dev_status = device_status.DeviceStatus() self.context = n_context.get_admin_context_without_session() self._initialize_rpc(host) self._initialize_service_helpers(host) self._start_periodic_tasks() super(CiscoCfgAgent, self).__init__(host=self.conf.host)
def __init__(self, host, conf=None): self.conf = conf or cfg.CONF self._credentials = ( config.obtain_hosting_device_credentials_from_config()) self._dev_status = device_status.DeviceStatus() self._dev_status.enable_heartbeat = ( self.conf.cfg_agent.enable_heartbeat) self.context = bc.context.get_admin_context_without_session() self._initialize_rpc(host) self._initialize_service_helpers(host) self._start_periodic_tasks() super(CiscoCfgAgent, self).__init__(host=self.conf.host)
def __init__(self, host, conf, cfg_agent): self.conf = conf self.cfg_agent = cfg_agent self.context = n_context.get_admin_context_without_session() self.plugin_rpc = CiscoRoutingPluginApi(topics.L3PLUGIN, host) self._dev_status = device_status.DeviceStatus() self._drivermgr = driver_mgr.DeviceDriverManager() self.router_info = {} self.updated_routers = set() self.removed_routers = set() self.sync_devices = set() self.fullsync = True self.topic = '%s.%s' % (c_constants.CFG_AGENT_L3_ROUTING, host) self._setup_rpc()
def setUp(self): super(TestHostingDevice, self).setUp() self.status = device_status.DeviceStatus() device_status._is_pingable = mock.MagicMock(return_value=True) self.hosting_device = {'id': 123, 'host_type': 'CSR1kv', 'management_ip_address': '10.0.0.1', 'port': '22', 'booting_time': 420} self.created_at_str = datetime.datetime.utcnow().strftime( "%Y-%m-%d %H:%M:%S") self.hosting_device['created_at'] = self.created_at_str self.router_id = _uuid() self.router = {id: self.router_id, 'hosting_device': self.hosting_device}
def __init__(self, host, conf, cfg_agent): self.conf = conf self.cfg_agent = cfg_agent self.context = n_context.get_admin_context_without_session() self.plugin_rpc = CiscoRoutingPluginApi(topics.L3PLUGIN, host) self._dev_status = device_status.DeviceStatus() self._dev_status.enable_heartbeat = ( self.conf.cfg_agent.enable_heartbeat) self._drivermgr = driver_mgr.DeviceDriverManager() self.router_info = {} self.updated_routers = set() self.removed_routers = set() self.sync_devices = set() self.sync_devices_attempts = 0 self.fullsync = True self.sync_routers_chunk_size = SYNC_ROUTERS_MAX_CHUNK_SIZE self.topic = '%s.%s' % (c_constants.CFG_AGENT_L3_ROUTING, host) self.hardware_router_type = None self.hardware_router_type_id = None self._setup_rpc()