Skip to content

Commit

Permalink
Add 'config interface shutdown/startup' commands (sonic-net#79)
Browse files Browse the repository at this point in the history
  • Loading branch information
jleveque authored Jul 17, 2017
1 parent 69b0184 commit 203f872
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions config/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,39 @@ def neighbor(ipaddr_or_hostname, verbose):

_bgp_session_startup(bgp_asn, ipaddress, verbose)

#
# 'interface' group
#

@cli.group()
def interface():
"""Interface-related configuration tasks"""
pass

#
# 'shutdown' subcommand
#

@interface.command()
@click.argument('interface_name', metavar='<interface_name>', required=True)
@click.option('-v', '--verbose', is_flag=True, help="Enable verbose output")
def shutdown(interface_name, verbose):
"""Shut down interface"""
command = "ip link set {} down".format(interface_name)
run_command(command, display_cmd=verbose)

#
# 'startup' subcommand
#

@interface.command()
@click.argument('interface_name', metavar='<interface_name>', required=True)
@click.option('-v', '--verbose', is_flag=True, help="Enable verbose output")
def startup(interface_name, verbose):
"""Start up interface"""
command = "ip link set {} up".format(interface_name)
run_command(command, display_cmd=verbose)


if __name__ == '__main__':
cli()

0 comments on commit 203f872

Please sign in to comment.