Skip to content

Commit

Permalink
Changes for supporting install-then-advertise behavior
Browse files Browse the repository at this point in the history
Functional specification:
sonic-net/SONiC#424
The routes will be pushed by BGP to Zebra to fpm to be installed
in hardware. If fpm returns error, the routes will not be sent by BGP to
its peers. Only successful routes are sent by BGP to its peers. The
feature can be enabled/disabled in BGP by a CLI. By default, the feature
is disabled. Functional specification:
sonic-net/SONiC#424
Signed-off by: Preetham Singh [email protected]
Signed-off by: Sudhanshu Kumar [email protected]
  • Loading branch information
sudhanshukumar22 committed Oct 18, 2019
1 parent 342f3a1 commit a4b5417
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions config/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -1055,6 +1055,37 @@ def bgp():
def shutdown():
"""Shut down BGP session(s)"""
pass
@bgp.group('error-handling')
def error_handling():
"""Handle BGP route install errors"""
pass
@error_handling.group(invoke_without_command=True)
@click.pass_context
def disable(ctx):
"""Administratively Disable BGP error-handling"""
config_db = ConfigDBConnector(host="127.0.0.1")
config_db.connect()
curr_mode = config_db.get_entry('BGP_ERROR_CFG_TABLE', "config").get('enable')
if (curr_mode == "true"):
cmd = 'sudo vtysh -c "configure terminal" -c "no bgp error-handling enable"'
run_command(cmd)
config_db.set_entry("BGP_ERROR_CFG_TABLE", "config", {"enable": "false"})
pass
pass
@error_handling.group(invoke_without_command=True)
@click.pass_context
def enable(ctx):
"""Administratively Enable BGP error handling"""
if ctx.invoked_subcommand is None:
config_db = ConfigDBConnector(host="127.0.0.1")
config_db.connect()
curr_mode = config_db.get_entry('BGP_ERROR_CFG_TABLE', "config").get('enable')
if (curr_mode != "true"):
cmd = 'sudo vtysh -c "configure terminal" -c "bgp error-handling enable"'
run_command(cmd)
config_db.set_entry("BGP_ERROR_CFG_TABLE", "config", {"enable": "true"})
pass
pass

# 'all' subcommand
@shutdown.command()
Expand Down

0 comments on commit a4b5417

Please sign in to comment.