diff --git a/scripts/psushow b/scripts/psushow index 242f10d374..60d7123346 100755 --- a/scripts/psushow +++ b/scripts/psushow @@ -35,7 +35,7 @@ def psu_status_show(index): else: psu_ids = [index] - header = ['PSU', 'Status'] + header = ['PSU', 'Status', 'LED'] status_table = [] for psu in psu_ids: @@ -51,7 +51,8 @@ def psu_status_show(index): msg = 'OK' if oper_status == 'true' else "NOT OK" else: msg = 'NOT PRESENT' - status_table.append([psu_name, msg]) + led_status = db.get(db.STATE_DB, 'PSU_INFO|{}'.format(psu_name), 'led_status') + status_table.append([psu_name, msg, led_status]) if status_table: print tabulate(status_table, header, tablefmt="simple") diff --git a/sonic-utilities-tests/mock_tables/state_db.json b/sonic-utilities-tests/mock_tables/state_db.json index 14f60801a7..924600ae4b 100644 --- a/sonic-utilities-tests/mock_tables/state_db.json +++ b/sonic-utilities-tests/mock_tables/state_db.json @@ -53,11 +53,13 @@ }, "PSU_INFO|PSU 1": { "presence": "true", - "status": "true" + "status": "true", + "led_status": "green" }, "PSU_INFO|PSU 2": { "presence": "true", - "status": "true" + "status": "true", + "led_status": "green" }, "SWITCH_CAPABILITY|switch": { "MIRROR": "true", diff --git a/sonic-utilities-tests/psu_test.py b/sonic-utilities-tests/psu_test.py index 2c8c7e2661..b4dd740e45 100644 --- a/sonic-utilities-tests/psu_test.py +++ b/sonic-utilities-tests/psu_test.py @@ -36,9 +36,9 @@ def test_verbose(self): def test_single_psu(self): runner = CliRunner() result = runner.invoke(show.cli.commands["platform"].commands["psustatus"], ["--index=1"]) - expected = """PSU Status ------ -------- -PSU 1 OK + expected = """PSU Status LED +----- -------- ----- +PSU 1 OK green """ assert result.output == expected