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, 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}