[202205][chassis] update the asic_status.py to read from CHASSIS_FABRIC_ASIC_INFO_TABLE (#12780)
Signed-off-by: Arvindsrinivasan Lakshmi Narasimhan <arlakshm@microsoft.com> Signed-off-by: Arvindsrinivasan Lakshmi Narasimhan <arlakshm@microsoft.com>
This commit is contained in:
parent
37cff8be2b
commit
b86b3b0d7d
@ -48,21 +48,23 @@ if [ "$SUBTYPE" == "DualToR" ]; then
|
||||
cp /usr/share/sonic/templates/tunnel_packet_handler.conf /etc/supervisor/conf.d/
|
||||
fi
|
||||
|
||||
IS_SUPERVISOR=/etc/sonic/chassisdb.conf
|
||||
USE_PCI_ID_IN_CHASSIS_STATE_DB=/usr/share/sonic/platform/use_pci_id_chassis
|
||||
ASIC_ID="asic$NAMESPACE_ID"
|
||||
if [ -f "$USE_PCI_ID_IN_CHASSIS_STATE_DB" ]; then
|
||||
while true; do
|
||||
PCI_ID=$(sonic-db-cli -s CHASSIS_STATE_DB HGET "CHASSIS_ASIC_TABLE|$ASIC_ID" asic_pci_address)
|
||||
if [ -z "$PCI_ID" ]; then
|
||||
sleep 3
|
||||
else
|
||||
# Update asic_id in CONFIG_DB, which is used by orchagent and fed to syncd
|
||||
if [[ $PCI_ID == ????:??:??.? ]]; then
|
||||
sonic-db-cli CONFIG_DB HSET 'DEVICE_METADATA|localhost' 'asic_id' ${PCI_ID#*:}
|
||||
break
|
||||
if [ -f "$IS_SUPERVISOR" ]; then
|
||||
if [ -f "$USE_PCI_ID_IN_CHASSIS_STATE_DB" ]; then
|
||||
while true; do
|
||||
PCI_ID=$(sonic-db-cli -s CHASSIS_STATE_DB HGET "CHASSIS_ASIC_TABLE|$ASIC_ID" asic_pci_address)
|
||||
if [ -z "$PCI_ID" ]; then
|
||||
sleep 3
|
||||
else
|
||||
# Update asic_id in CONFIG_DB, which is used by orchagent and fed to syncd
|
||||
if [[ $PCI_ID == ????:??:??.? ]]; then
|
||||
sonic-db-cli CONFIG_DB HSET 'DEVICE_METADATA|localhost' 'asic_id' ${PCI_ID#*:}
|
||||
break
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
done
|
||||
done
|
||||
fi
|
||||
fi
|
||||
|
||||
exec /usr/local/bin/supervisord
|
||||
|
@ -17,7 +17,7 @@ except ImportError as e:
|
||||
# Constants ====================================================================
|
||||
#
|
||||
SYSLOG_IDENTIFIER = 'asic_status.py'
|
||||
CHASSIS_ASIC_INFO_TABLE = 'CHASSIS_ASIC_TABLE'
|
||||
CHASSIS_FABRIC_ASIC_INFO_TABLE = 'CHASSIS_FABRIC_ASIC_TABLE'
|
||||
SELECT_TIMEOUT_MSECS = 5000
|
||||
|
||||
def main():
|
||||
@ -40,7 +40,7 @@ def main():
|
||||
state_db = daemon_base.db_connect("CHASSIS_STATE_DB")
|
||||
|
||||
sel = swsscommon.Select()
|
||||
sst = swsscommon.SubscriberStateTable(state_db, CHASSIS_ASIC_INFO_TABLE)
|
||||
sst = swsscommon.SubscriberStateTable(state_db, CHASSIS_FABRIC_ASIC_INFO_TABLE)
|
||||
sel.addSelectable(sst)
|
||||
|
||||
while True:
|
||||
|
@ -26,7 +26,7 @@ NEIGH_DEVICE_METADATA_CFG_DB_TABLE = 'DEVICE_NEIGHBOR_METADATA'
|
||||
DEFAULT_NAMESPACE = ''
|
||||
PORT_ROLE = 'role'
|
||||
CHASSIS_STATE_DB='CHASSIS_STATE_DB'
|
||||
CHASSIS_ASIC_INFO_TABLE='CHASSIS_ASIC_TABLE'
|
||||
CHASSIS_FABRIC_ASIC_INFO_TABLE='CHASSIS_FABRIC_ASIC_TABLE'
|
||||
|
||||
# Dictionary to cache config_db connection handle per namespace
|
||||
# to prevent duplicate connections from being opened
|
||||
@ -479,7 +479,7 @@ def get_asic_presence_list():
|
||||
# Get asic list from CHASSIS_ASIC_TABLE which lists only the asics
|
||||
# present based on Fabric card detection by the platform.
|
||||
db = swsscommon.DBConnector(CHASSIS_STATE_DB, 0, True)
|
||||
asic_table = swsscommon.Table(db, CHASSIS_ASIC_INFO_TABLE)
|
||||
asic_table = swsscommon.Table(db, CHASSIS_FABRIC_ASIC_INFO_TABLE)
|
||||
if asic_table:
|
||||
asics_presence_list = list(asic_table.getKeys())
|
||||
for asic in asics_presence_list:
|
||||
|
Reference in New Issue
Block a user