Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changes for supporting install-then-advertise behavior #709

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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