Skip to content

Commit

Permalink
[MultiDB] shoule use multiDB API (sonic-net#57)
Browse files Browse the repository at this point in the history
  • Loading branch information
dzhangalibaba authored Jun 5, 2020
1 parent 9b90a87 commit 0f4fd83
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 13 deletions.
2 changes: 1 addition & 1 deletion sonic-ledd/scripts/ledd
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ class DaemonLedd(DaemonBase):
sys.exit(LEDUTIL_LOAD_ERROR)

# Open a handle to the Application database
appl_db = daemon_base.db_connect(swsscommon.APPL_DB)
appl_db = daemon_base.db_connect("APPL_DB")

# Subscribe to PORT table notifications in the Application DB
sel = swsscommon.Select()
Expand Down
2 changes: 1 addition & 1 deletion sonic-psud/scripts/psud
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ class DaemonPsud(DaemonBase):
sys.exit(PSUUTIL_LOAD_ERROR)

# Connect to STATE_DB and create psu/chassis info tables
state_db = daemon_base.db_connect(swsscommon.STATE_DB)
state_db = daemon_base.db_connect("STATE_DB")
chassis_tbl = swsscommon.Table(state_db, CHASSIS_INFO_TABLE)
psu_tbl = swsscommon.Table(state_db, PSU_INFO_TABLE)

Expand Down
2 changes: 1 addition & 1 deletion sonic-syseepromd/scripts/syseepromd
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ class DaemonSyseeprom(DaemonBase):
self.stop_event = threading.Event()
self.eeprom = None

state_db = daemon_base.db_connect(swsscommon.STATE_DB)
state_db = daemon_base.db_connect("STATE_DB")
self.eeprom_tbl = swsscommon.Table(state_db, EEPROM_TABLE_NAME)
self.eepromtbl_keys = []

Expand Down
4 changes: 2 additions & 2 deletions sonic-thermalctld/scripts/thermalctld
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ class FanUpdater(object):
"""
self.chassis = chassis
self.fan_status_dict = {}
state_db = daemon_base.db_connect(swsscommon.STATE_DB)
state_db = daemon_base.db_connect("STATE_DB")
self.table = swsscommon.Table(state_db, FanUpdater.FAN_INFO_TABLE_NAME)

def deinit(self):
Expand Down Expand Up @@ -458,7 +458,7 @@ class TemperatureUpdater(object):
"""
self.chassis = chassis
self.temperature_status_dict = {}
state_db = daemon_base.db_connect(swsscommon.STATE_DB)
state_db = daemon_base.db_connect("STATE_DB")
self.table = swsscommon.Table(state_db, TemperatureUpdater.TEMPER_INFO_TABLE_NAME)

def deinit(self):
Expand Down
16 changes: 8 additions & 8 deletions sonic-xcvrd/scripts/xcvrd
Original file line number Diff line number Diff line change
Expand Up @@ -381,11 +381,11 @@ def post_port_dom_info_to_db(logical_port_name, table, stop_event=threading.Even
def post_port_sfp_dom_info_to_db(is_warm_start, stop_event=threading.Event()):
# Connect to STATE_DB and create transceiver dom/sfp info tables
transceiver_dict = {}
state_db = daemon_base.db_connect(swsscommon.STATE_DB)
state_db = daemon_base.db_connect("STATE_DB")
int_tbl = swsscommon.Table(state_db, TRANSCEIVER_INFO_TABLE)
dom_tbl = swsscommon.Table(state_db, TRANSCEIVER_DOM_SENSOR_TABLE)

appl_db = daemon_base.db_connect(swsscommon.APPL_DB)
appl_db = daemon_base.db_connect("APPL_DB")
app_port_tbl = swsscommon.ProducerStateTable(appl_db,
swsscommon.APP_PORT_TABLE_NAME)

Expand Down Expand Up @@ -678,7 +678,7 @@ def detect_port_in_error_status(logical_port_name, status_tbl):
# Init TRANSCEIVER_STATUS table
def init_port_sfp_status_tbl(stop_event=threading.Event()):
# Connect to STATE_DB and create transceiver status table
state_db = daemon_base.db_connect(swsscommon.STATE_DB)
state_db = daemon_base.db_connect("STATE_DB")
status_tbl = swsscommon.Table(state_db, TRANSCEIVER_STATUS_TABLE)

# Init TRANSCEIVER_STATUS table
Expand Down Expand Up @@ -715,7 +715,7 @@ class dom_info_update_task:
logger.log_info("Start DOM monitoring loop")

# Connect to STATE_DB and create transceiver dom info table
state_db = daemon_base.db_connect(swsscommon.STATE_DB)
state_db = daemon_base.db_connect("STATE_DB")
dom_tbl = swsscommon.Table(state_db, TRANSCEIVER_DOM_SENSOR_TABLE)
status_tbl = swsscommon.Table(state_db, TRANSCEIVER_STATUS_TABLE)

Expand Down Expand Up @@ -775,13 +775,13 @@ class sfp_state_update_task:

transceiver_dict = {}
# Connect to STATE_DB and create transceiver dom/sfp info tables
state_db = daemon_base.db_connect(swsscommon.STATE_DB)
state_db = daemon_base.db_connect("STATE_DB")
int_tbl = swsscommon.Table(state_db, TRANSCEIVER_INFO_TABLE)
dom_tbl = swsscommon.Table(state_db, TRANSCEIVER_DOM_SENSOR_TABLE)
status_tbl = swsscommon.Table(state_db, TRANSCEIVER_STATUS_TABLE)

# Connect to APPL_DB to notify Media notifications
appl_db = daemon_base.db_connect(swsscommon.APPL_DB)
appl_db = daemon_base.db_connect("APPL_DB")
app_port_tbl = swsscommon.ProducerStateTable(appl_db,
swsscommon.APP_PORT_TABLE_NAME)

Expand Down Expand Up @@ -1017,7 +1017,7 @@ class DaemonXcvrd(DaemonBase):
# Wait for port config is done
def wait_for_port_config_done(self):
# Connect to APPL_DB and subscribe to PORT table notifications
appl_db = daemon_base.db_connect(swsscommon.APPL_DB)
appl_db = daemon_base.db_connect("APPL_DB")

sel = swsscommon.Select()
sst = swsscommon.SubscriberStateTable(appl_db, swsscommon.APP_PORT_TABLE_NAME)
Expand Down Expand Up @@ -1089,7 +1089,7 @@ class DaemonXcvrd(DaemonBase):
sys.exit(PORT_CONFIG_LOAD_ERROR)

# Connect to STATE_DB and create transceiver dom/sfp info tables
state_db = daemon_base.db_connect(swsscommon.STATE_DB)
state_db = daemon_base.db_connect("STATE_DB")
self.int_tbl = swsscommon.Table(state_db, TRANSCEIVER_INFO_TABLE)
self.dom_tbl = swsscommon.Table(state_db, TRANSCEIVER_DOM_SENSOR_TABLE)
self.status_tbl = swsscommon.Table(state_db, TRANSCEIVER_STATUS_TABLE)
Expand Down

0 comments on commit 0f4fd83

Please sign in to comment.