|
39 | 39 | CHASSIS_INFO_MODEL_FIELD = 'model'
|
40 | 40 | CHASSIS_INFO_REV_FIELD = 'revision'
|
41 | 41 |
|
42 |
| -# Get hardware information |
43 |
| -def get_platform_info(): |
44 |
| - """ |
45 |
| - This function is used to get the HW info helper function |
46 |
| - """ |
47 |
| - from .multi_asic import get_num_asics |
48 |
| - |
49 |
| - hw_info_dict = {} |
50 |
| - |
51 |
| - version_info = get_sonic_version_info() |
52 |
| - |
53 |
| - hw_info_dict['platform'] = get_platform() |
54 |
| - hw_info_dict['hwsku'] = get_hwsku() |
55 |
| - hw_info_dict['asic_type'] = version_info['asic_type'] |
56 |
| - hw_info_dict['asic_count'] = get_num_asics() |
57 |
| - |
58 |
| - return hw_info_dict |
59 |
| - |
60 |
| - |
61 |
| -def get_chassis_info(): |
62 |
| - """ |
63 |
| - This function is used to get the Chassis serial / model / rev number |
64 |
| - """ |
65 |
| - |
66 |
| - chassis_info_dict = {} |
67 |
| - |
68 |
| - try: |
69 |
| - # Init statedb connection |
70 |
| - db = SonicV2Connector() |
71 |
| - db.connect(db.STATE_DB) |
72 |
| - table = CHASSIS_INFO_TABLE.format(1) |
73 |
| - |
74 |
| - chassis_info_dict['serial'] = db.get(db.STATE_DB, table, CHASSIS_INFO_SERIAL_FIELD) |
75 |
| - chassis_info_dict['model'] = db.get(db.STATE_DB, table, CHASSIS_INFO_MODEL_FIELD) |
76 |
| - chassis_info_dict['revision'] = db.get(db.STATE_DB, table, CHASSIS_INFO_REV_FIELD) |
77 |
| - except: |
78 |
| - pass |
79 |
| - |
80 |
| - return chassis_info_dict |
81 |
| - |
82 | 42 |
|
83 | 43 | def get_localhost_info(field):
|
84 | 44 | try:
|
@@ -350,6 +310,47 @@ def get_sonic_version_file():
|
350 | 310 |
|
351 | 311 | return SONIC_VERSION_YAML_PATH
|
352 | 312 |
|
| 313 | + |
| 314 | +# Get hardware information |
| 315 | +def get_platform_info(): |
| 316 | + """ |
| 317 | + This function is used to get the HW info helper function |
| 318 | + """ |
| 319 | + from .multi_asic import get_num_asics |
| 320 | + |
| 321 | + hw_info_dict = {} |
| 322 | + |
| 323 | + version_info = get_sonic_version_info() |
| 324 | + |
| 325 | + hw_info_dict['platform'] = get_platform() |
| 326 | + hw_info_dict['hwsku'] = get_hwsku() |
| 327 | + hw_info_dict['asic_type'] = version_info['asic_type'] |
| 328 | + hw_info_dict['asic_count'] = get_num_asics() |
| 329 | + |
| 330 | + return hw_info_dict |
| 331 | + |
| 332 | + |
| 333 | +def get_chassis_info(): |
| 334 | + """ |
| 335 | + This function is used to get the Chassis serial / model / rev number |
| 336 | + """ |
| 337 | + |
| 338 | + chassis_info_dict = {} |
| 339 | + |
| 340 | + try: |
| 341 | + # Init statedb connection |
| 342 | + db = SonicV2Connector() |
| 343 | + db.connect(db.STATE_DB) |
| 344 | + table = CHASSIS_INFO_TABLE.format(1) |
| 345 | + |
| 346 | + chassis_info_dict['serial'] = db.get(db.STATE_DB, table, CHASSIS_INFO_SERIAL_FIELD) |
| 347 | + chassis_info_dict['model'] = db.get(db.STATE_DB, table, CHASSIS_INFO_MODEL_FIELD) |
| 348 | + chassis_info_dict['revision'] = db.get(db.STATE_DB, table, CHASSIS_INFO_REV_FIELD) |
| 349 | + except: |
| 350 | + pass |
| 351 | + |
| 352 | + return chassis_info_dict |
| 353 | + |
353 | 354 | #
|
354 | 355 | # Multi-NPU functionality
|
355 | 356 | #
|
|
0 commit comments