File tree Expand file tree Collapse file tree 3 files changed +36
-4
lines changed
Expand file tree Collapse file tree 3 files changed +36
-4
lines changed Original file line number Diff line number Diff line change 5757from . import warm_restart
5858from . import plugins
5959
60-
6160# Global Variables
6261PLATFORM_JSON = 'platform.json'
6362HWSKU_JSON = 'hwsku.json'
@@ -1676,12 +1675,10 @@ def ztp(status, verbose):
16761675 cmd = cmd + " --verbose"
16771676 run_command (cmd , display_cmd = verbose )
16781677
1679-
16801678# Load plugins and register them
16811679helper = util_base .UtilHelper ()
16821680for plugin in helper .load_plugins (plugins ):
16831681 helper .register_plugin (plugin , cli )
16841682
1685-
16861683if __name__ == '__main__' :
16871684 cli ()
Original file line number Diff line number Diff line change @@ -134,7 +134,6 @@ def temperature():
134134 cmd = 'tempershow'
135135 clicommon .run_command (cmd )
136136
137-
138137# 'firmware' subcommand ("show platform firmware")
139138@platform .command (
140139 context_settings = dict (
Original file line number Diff line number Diff line change 1+ #!/usr/bin/env python
2+ #########################################################
3+ # Copyright 2021 Cisco Systems, Inc.
4+ # All rights reserved.
5+ #
6+ # CLI Extensions for show command
7+ #########################################################
8+
9+ try :
10+ import click
11+ import yaml
12+ from show import platform
13+ from sonic_py_common import device_info
14+ import utilities_common .cli as clicommon
15+ except ImportError as e :
16+ raise ImportError ("%s - required module not found" % str (e ))
17+
18+ PLATFORM_PY = '/opt/cisco/bin/platform.py'
19+
20+ @click .command ()
21+ def inventory ():
22+ """Show Platform Inventory"""
23+ args = [ PLATFORM_PY , 'inventoryshow' ]
24+ clicommon .run_command (args )
25+
26+ @click .command ()
27+ def idprom ():
28+ """Show Platform Idprom Inventory"""
29+ args = [ PLATFORM_PY , 'idprom' ]
30+ clicommon .run_command (args )
31+
32+ def register (cli ):
33+ version_info = device_info .get_sonic_version_info ()
34+ if (version_info and version_info .get ('asic_type' ) == 'cisco-8000' ):
35+ cli .commands ['platform' ].add_command (inventory )
36+ cli .commands ['platform' ].add_command (idprom )
You can’t perform that action at this time.
0 commit comments