-
Notifications
You must be signed in to change notification settings - Fork 680
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
sonic-utilities: Create SONiC ISIS show commands
* Update show/main.py Include "isis" as a cli group option for show commands * Create show/isis_frr.py Add "isis" as a cli group option for show commands and add support for "show isis neighbors", "show isis database", "show isis hostname", and "show isis interface" Signed-off-by: cchoate54@gmail.com
- Loading branch information
Showing
2 changed files
with
103 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,101 @@ | ||
import click | ||
|
||
import utilities_common.bgp_util as bgp_util | ||
import utilities_common.cli as clicommon | ||
|
||
############################################################################### | ||
# | ||
# 'show isis' cli stanza | ||
# | ||
############################################################################### | ||
|
||
|
||
@click.group(cls=clicommon.AliasedGroup, name="isis") | ||
def isis(): | ||
"""Show ISIS (Intermediate System to Intermediate System) information""" | ||
pass | ||
|
||
|
||
# 'neighbors' subcommand ("show isis neighbors") | ||
@isis.command() | ||
@click.argument('system_id', required=False) | ||
@click.argument('info_type', | ||
metavar='[detail]', | ||
type=click.Choice( | ||
['detail']), | ||
required=False) | ||
@click.option('--verbose', is_flag=True, help="Enable verbose output") | ||
def neighbors(system_id, info_type, verbose): | ||
"""Show ISIS neighbors""" | ||
|
||
command = 'show isis neighbor' | ||
if system_id is not None: | ||
command += ' {0}'.format(system_id) | ||
elif info_type or verbose: | ||
command += ' detail' | ||
|
||
output = "" | ||
output += bgp_util.run_bgp_show_command(command) | ||
|
||
click.echo(output.rstrip('\n')) | ||
|
||
# 'database' subcommand ("show isis database") | ||
@isis.command() | ||
@click.argument('lsp_id', required=False) | ||
@click.argument('info_type', | ||
metavar='[detail]', | ||
type=click.Choice( | ||
['detail']), | ||
required=False) | ||
@click.option('--verbose', is_flag=True, help="Enable verbose output") | ||
def database(lsp_id, info_type, verbose): | ||
"""Show ISIS database""" | ||
|
||
command = 'show isis database' | ||
if lsp_id is not None: | ||
command += ' {0}'.format(lsp_id) | ||
elif info_type or verbose: | ||
command += ' detail' | ||
|
||
output = "" | ||
output += bgp_util.run_bgp_show_command(command) | ||
|
||
click.echo(output.rstrip('\n')) | ||
|
||
# 'hostname' subcommand ("show isis hostname") | ||
@isis.command() | ||
def hostname(): | ||
"""Show ISIS hostname""" | ||
|
||
command = 'show isis hostname' | ||
|
||
output = "" | ||
output += bgp_util.run_bgp_show_command(command) | ||
|
||
click.echo(output.rstrip('\n')) | ||
|
||
# 'interface' subcommand ("show isis interface") | ||
@isis.command() | ||
@click.argument('interface', required=False) | ||
@click.argument('info_type', | ||
metavar='[detail]', | ||
type=click.Choice( | ||
['detail']), | ||
required=False) | ||
@click.option('--verbose', is_flag=True, help="Enable verbose output") | ||
def interface(interface, info_type, verbose): | ||
"""Show ISIS interface""" | ||
|
||
command = 'show isis interface' | ||
if interface is not None and clicommon.get_interface_naming_mode() == "alias": | ||
interface = clicommon.iface_alias_converter.alias_to_name(interface) | ||
|
||
if interface is not None: | ||
command += ' {0}'.format(interface) | ||
elif info_type or verbose: | ||
command += ' detail' | ||
|
||
output = "" | ||
output += bgp_util.run_bgp_show_command(command) | ||
|
||
click.echo(output.rstrip('\n')) |
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