Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[CLI][show][platform] Added ASIC count in the output. #1185

Merged
merged 4 commits into from
Oct 26, 2020
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 15 additions & 6 deletions show/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@
import vlan
import system_health

from sonic_py_common import device_info
from sonic_py_common import device_info, multi_asic
from swsssdk import ConfigDBConnector, SonicV2Connector
from tabulate import tabulate
from utilities_common.db import Db
import utilities_common.multi_asic as multi_asic_util
import utilities_common.multi_asic as multi_asic_util


# Global Variables
Expand Down Expand Up @@ -991,6 +991,7 @@ def get_hw_info_dict():
hw_info_dict['platform'] = device_info.get_platform()
hw_info_dict['hwsku'] = device_info.get_hwsku()
hw_info_dict['asic_type'] = version_info['asic_type']
hw_info_dict['asic_count'] = multi_asic.get_num_asics()

return hw_info_dict

Expand All @@ -1005,12 +1006,20 @@ def platform():

# 'summary' subcommand ("show platform summary")
@platform.command()
def summary():
@click.option('--verbose', is_flag=True, help="Enable verbose output")
@click.option('--json', is_flag=True, help="JSON output")
def summary(verbose, json):
"""Show hardware platform information"""

hw_info_dict = get_hw_info_dict()
click.echo("Platform: {}".format(hw_info_dict['platform']))
click.echo("HwSKU: {}".format(hw_info_dict['hwsku']))
click.echo("ASIC: {}".format(hw_info_dict['asic_type']))
if json:
click.echo(hw_info_dict)
jleveque marked this conversation as resolved.
Show resolved Hide resolved
else:
click.echo("Platform: {}".format(hw_info_dict['platform']))
click.echo("HwSKU: {}".format(hw_info_dict['hwsku']))
click.echo("ASIC: {}".format(hw_info_dict['asic_type']))
if verbose:
click.echo("ASIC Count: {}".format(hw_info_dict['asic_count']))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it may be better to always display this line without the need for a --verbose flag. Just need to check the rest of the SONiC codebase to see if this output is parsed anywhere and make sure it is smart enough to handle an additional line.

Does anyone disagree?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At this point it may seem redundant for most cases, but I prefer that too - show by default.


# 'syseeprom' subcommand ("show platform syseeprom")
@platform.command()
Expand Down