def version(): """Show version information""" version_info = sonic_platform.get_sonic_version_info() click.echo("SONiC Software Version: SONiC.{}".format( version_info['build_version'])) click.echo("Distribution: Debian {}".format( version_info['debian_version'])) click.echo("Kernel: {}".format(version_info['kernel_version'])) click.echo("Build commit: {}".format(version_info['commit_id'])) click.echo("Build date: {}".format(version_info['build_date'])) click.echo("Built by: {}".format(version_info['built_by'])) click.echo("\nDocker images:") cmd = 'sudo docker images --format "table {{.Repository}}\\t{{.Tag}}\\t{{.ID}}\\t{{.Size}}"' p = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE) click.echo(p.stdout.read())
def summary(): """Show hardware platform information""" machine_info = sonic_platform.get_machine_info() platform = sonic_platform.get_platform_info(machine_info) config_db = ConfigDBConnector() config_db.connect() data = config_db.get_table('DEVICE_METADATA') try: hwsku = data['localhost']['hwsku'] except KeyError: hwsku = "Unknown" version_info = sonic_platform.get_sonic_version_info() asic_type = version_info['asic_type'] click.echo("Platform: {}".format(platform)) click.echo("HwSKU: {}".format(hwsku)) click.echo("ASIC: {}".format(asic_type))
cmd = "sudo lldpshow" run_command(cmd, display_cmd=verbose) # # 'platform' group ("show platform ...") # @cli.group(cls=AliasedGroup, default_if_no_args=False) def platform(): """Show platform-specific hardware info""" pass version_info = sonic_platform.get_sonic_version_info() if (version_info and version_info.get('asic_type') == 'mellanox'): platform.add_command(mlnx.mlnx) # 'summary' subcommand ("show platform summary") @platform.command() def summary(): """Show hardware platform information""" machine_info = sonic_platform.get_machine_info() platform = sonic_platform.get_platform_info(machine_info) config_db = ConfigDBConnector() config_db.connect() data = config_db.get_table('DEVICE_METADATA')
def asymmetric(ctx, status): """Set asymmetric PFC configuration.""" config_db = ctx.obj["config_db"] interface = ctx.obj["interface_name"] run_command("pfc config asymmetric {0} {1}".format(status, interface)) # # 'platform' group ('config platform ...') # @config.group() def platform(): """Platform-related configuration tasks""" version_info = sonic_platform.get_sonic_version_info() if (version_info and version_info.get('asic_type') == 'mellanox'): platform.add_command(mlnx.mlnx) # # 'watermark' group ("show watermark telemetry interval") # @config.group() def watermark(): """Configure watermark """ pass @watermark.group() def telemetry(): """Configure watermark telemetry"""