-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Provide support to install platform extensions (#1578)
cisco-8000 : show commands support as plugins show platform idprom show platform inventory
- Loading branch information
1 parent
c97fe54
commit 2088a9a
Showing
3 changed files
with
36 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
#!/usr/bin/env python | ||
######################################################### | ||
# Copyright 2021 Cisco Systems, Inc. | ||
# All rights reserved. | ||
# | ||
# CLI Extensions for show command | ||
######################################################### | ||
|
||
try: | ||
import click | ||
import yaml | ||
from show import platform | ||
from sonic_py_common import device_info | ||
import utilities_common.cli as clicommon | ||
except ImportError as e: | ||
raise ImportError("%s - required module not found" % str(e)) | ||
|
||
PLATFORM_PY = '/opt/cisco/bin/platform.py' | ||
|
||
@click.command() | ||
def inventory(): | ||
"""Show Platform Inventory""" | ||
args = [ PLATFORM_PY, 'inventoryshow' ] | ||
clicommon.run_command(args) | ||
|
||
@click.command() | ||
def idprom(): | ||
"""Show Platform Idprom Inventory""" | ||
args = [ PLATFORM_PY, 'idprom' ] | ||
clicommon.run_command(args) | ||
|
||
def register(cli): | ||
version_info = device_info.get_sonic_version_info() | ||
if (version_info and version_info.get('asic_type') == 'cisco-8000'): | ||
cli.commands['platform'].add_command(inventory) | ||
cli.commands['platform'].add_command(idprom) |