コード例 #1
0
 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)
コード例 #2
0
ファイル: watcher.py プロジェクト: Baloc/faucet
 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)