def setup(self): self.conn_string = ( 'driver={0};server={1};port={2};uid={3};pwd={4}'.format( self.conf.driver, self.conf.db_ip, self.conf.db_port, self.conf.db_username, self.conf.db_password)) nsodbc = nsodbc_factory() self.conn = nsodbc.connect(self.conn_string) self.switch_database, exists = self.conn.create(self.conf.switches_doc) if not exists: init_switch_db(self.switch_database) self.flow_database, exists = self.conn.create(self.conf.flows_doc) if not exists: init_flow_db(self.flow_database) self.db_update_counter = int(self.conf.db_update_counter)
def setup(self): self.conn_string = ( "driver={0};server={1};port={2};uid={3};pwd={4}".format( self.conf.driver, self.conf.db_ip, self.conf.db_port, self.conf.db_username, self.conf.db_password)) nsodbc = nsodbc_factory() self.conn = nsodbc.connect(self.conn_string) self.switch_database, exists = self.conn.create(self.conf.switches_doc) if not exists: init_switch_db(self.switch_database) self.flow_database, exists = self.conn.create(self.conf.flows_doc) if not exists: init_flow_db(self.flow_database) self.db_update_counter = int(self.conf.db_update_counter)
def refresh_switchdb(self): if self.conf is None: return self.conn.delete(self.conf.switches_doc) self.switch_database, _ = self.conn.create(self.conf.switches_doc) init_switch_db(self.switch_database)
def refresh_switchdb(self): self.conn.delete(self.conf.switches_doc) self.switch_database, _ = self.conn.create(self.conf.switches_doc) init_switch_db(self.switch_database)