Skip to content

Commit

Permalink
Removed 'show interfaces alias and show interfaces summary'. (sonic-n…
Browse files Browse the repository at this point in the history
…et#412)

Removed 'show interfaces summary'.
  • Loading branch information
romankachur-mlnx authored and lguohan committed Dec 12, 2018
1 parent fda7742 commit 3d03c13
Showing 1 changed file with 0 additions and 54 deletions.
54 changes: 0 additions & 54 deletions show/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -408,43 +408,6 @@ def interfaces():
"""Show details of the network interfaces"""
pass

# 'alias' subcommand ("show interfaces alias")
@interfaces.command()
@click.argument('interfacename', required=False)
def alias(interfacename):
"""Show Interface Name/Alias Mapping"""

cmd = 'sonic-cfggen -d --var-json "PORT"'
p = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE)

port_dict = json.loads(p.stdout.read())

header = ['Name', 'Alias']
body = []

if interfacename is not None:
if get_interface_mode() == "alias":
interfacename = iface_alias_converter.alias_to_name(interfacename)

# If we're given an interface name, output name and alias for that interface only
if interfacename in port_dict:
if 'alias' in port_dict[interfacename]:
body.append([interfacename, port_dict[interfacename]['alias']])
else:
body.append([interfacename, interfacename])
else:
click.echo("Invalid interface name, '{0}'".format(interfacename))
return
else:
# Output name and alias for all interfaces
for port_name in natsorted(port_dict.keys()):
if 'alias' in port_dict[port_name]:
body.append([port_name, port_dict[port_name]['alias']])
else:
body.append([port_name, port_name])

click.echo(tabulate(body, header))

#
# 'neighbor' group ###
#
Expand Down Expand Up @@ -493,23 +456,6 @@ def expected(interfacename):

click.echo(tabulate(body, header))

# 'summary' subcommand ("show interfaces summary")
@interfaces.command()
@click.argument('interfacename', required=False)
@click.option('--verbose', is_flag=True, help="Enable verbose output")
def summary(interfacename, verbose):
"""Show interface status and information"""

cmd = "/sbin/ifconfig"

if interfacename is not None:
if get_interface_mode() == "alias":
interfacename = iface_alias_converter.alias_to_name(interfacename)

cmd += " {}".format(interfacename)

run_command(cmd, display_cmd=verbose)


@interfaces.group(cls=AliasedGroup, default_if_no_args=False)
def transceiver():
Expand Down

0 comments on commit 3d03c13

Please sign in to comment.