Skip to content

Commit

Permalink
[fanshow] Add column drawer name and led status to output of show pla…
Browse files Browse the repository at this point in the history
…tform fan (sonic-net#881)
  • Loading branch information
Junchao-Mellanox authored May 13, 2020
1 parent 4601ade commit c0f5884
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions scripts/fanshow
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,15 @@ from swsssdk import SonicV2Connector
from natsort import natsorted


header = ['FAN', 'Speed', 'Direction', 'Presence', 'Status', 'Timestamp']
header = ['Drawer', 'LED', 'FAN', 'Speed', 'Direction', 'Presence', 'Status', 'Timestamp']

FAN_TABLE_NAME = 'FAN_INFO'
DRAWER_FIELD_NAME = 'drawer_name'
SPEED_FIELD_NAME = 'speed'
DIRECTION_FIELD_NAME = 'direction'
PRESENCE_FIELD_NAME = 'presence'
STATUS_FIELD_NAME = 'status'
LED_STATUS_FIELD_NAME = 'led_status'
TIMESTAMP_FIELD_NAME = 'timestamp'


Expand Down Expand Up @@ -58,7 +60,8 @@ class FanShow(object):
else:
status = 'N/A'

table.append((name, speed, data_dict[DIRECTION_FIELD_NAME], presence, status, data_dict[TIMESTAMP_FIELD_NAME]))
table.append((data_dict[DRAWER_FIELD_NAME], data_dict[LED_STATUS_FIELD_NAME], name, speed, data_dict[DIRECTION_FIELD_NAME], presence, status,
data_dict[TIMESTAMP_FIELD_NAME]))

if table:
print(tabulate(table, header, tablefmt='simple', stralign='right'))
Expand Down

0 comments on commit c0f5884

Please sign in to comment.