Skip to content

Commit

Permalink
FRR: fix show bgp and clear bgp to provide the full set of cli option…
Browse files Browse the repository at this point in the history
…s available (sonic-net#149)
  • Loading branch information
nikos-github authored and lguohan committed Nov 23, 2017
1 parent a4087dd commit cbd956d
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 546 deletions.
226 changes: 0 additions & 226 deletions clear/bgp_frr_v4.py

This file was deleted.

114 changes: 0 additions & 114 deletions clear/bgp_frr_v6.py

This file was deleted.

23 changes: 16 additions & 7 deletions clear/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,20 +151,29 @@ def ipv6():


#
# Inserting BGP functionality into cli's clear parse-chain. The insertion point
# and the specific BGP commands to import, will be determined by the routing-stack
# being elected.
# Inserting BGP functionality into cli's clear parse-chain.
# BGP commands are determined by the routing-stack being elected.
#
if routing_stack == "quagga":
from .bgp_quagga_v4 import bgp
ip.add_command(bgp)
from .bgp_quagga_v6 import bgp
ipv6.add_command(bgp)
elif routing_stack == "frr":
from .bgp_frr_v4 import bgp
cli.add_command(bgp)
from .bgp_frr_v6 import bgp
cli.add_command(bgp)
@cli.command()
@click.argument('bgp_args', nargs = -1, required = False)
def bgp(bgp_args):
"""BGP information"""
bgp_cmd = "clear bgp"
options = False
for arg in bgp_args:
bgp_cmd += " " + str(arg)
options = True
if options is True:
command = 'sudo vtysh -c "{}"'.format(bgp_cmd)
else:
command = 'sudo vtysh -c "clear bgp *"'
run_command(command)


@cli.command()
Expand Down
Loading

0 comments on commit cbd956d

Please sign in to comment.