Skip to content

Commit

Permalink
Merge pull request sonic-net#2 from pettershao-ragilenetworks/get-ser…
Browse files Browse the repository at this point in the history
…ial-number-from-STATE_DB

Add serial_num field into device_info
  • Loading branch information
pettershao-ragilenetworks authored Apr 1, 2022
2 parents 668052a + 83bc130 commit 310de76
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/sonic-py-common/sonic_py_common/device_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
CHASSIS_INFO_TABLE = 'CHASSIS_INFO|chassis {}'
CHASSIS_INFO_CARD_NUM_FIELD = 'module_num'
CHASSIS_INFO_SERIAL_FIELD = 'serial'
CHASSIS_INFO_SERIAL_NUM_FIELD = 'serial_num'
CHASSIS_INFO_MODEL_FIELD = 'model'
CHASSIS_INFO_REV_FIELD = 'revision'

Expand Down Expand Up @@ -371,7 +372,7 @@ def get_platform_info():

def get_chassis_info():
"""
This function is used to get the Chassis serial / model / rev number
This function is used to get the Chassis serial / model / rev number / serial number
"""

chassis_info_dict = {}
Expand All @@ -385,6 +386,7 @@ def get_chassis_info():
chassis_info_dict['serial'] = db.get(db.STATE_DB, table, CHASSIS_INFO_SERIAL_FIELD)
chassis_info_dict['model'] = db.get(db.STATE_DB, table, CHASSIS_INFO_MODEL_FIELD)
chassis_info_dict['revision'] = db.get(db.STATE_DB, table, CHASSIS_INFO_REV_FIELD)
chassis_info_dict['serial_num'] = db.get(db.STATE_DB, table, CHASSIS_INFO_SERIAL_NUM_FIELD)
except Exception:
pass

Expand Down

0 comments on commit 310de76

Please sign in to comment.