Skip to content

Commit

Permalink
Added change to not return error for Sonic t2/spine-router role
Browse files Browse the repository at this point in the history
when config bgp shut/startup command given for BGP Neighbor if the given
neighbor are not present. This is done because for T2 BGP neighbors are
present across different LC's so it's possible when command is executed
that neighbor might not be present on that LC

Signed-off-by: Abhishek Dosi <abdosi@microsoft.com>
  • Loading branch information
abdosi committed Feb 5, 2024
1 parent 7dc1a54 commit 49d9087
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions config/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -3619,8 +3619,12 @@ def neighbor(ipaddr_or_hostname, verbose):
if _change_bgp_session_status(config_db, ipaddr_or_hostname, 'down', verbose):
found_neighbor = True

device_metadata = config_db.get_entry('DEVICE_METADATA', 'localhost')
if not found_neighbor:
click.get_current_context().fail("Could not locate neighbor '{}'".format(ipaddr_or_hostname))
if device_metadata['type'] == 'SpineRouter':
click.echo("Could not locate neighbor '{}'".format(ipaddr_or_hostname))
else:
click.get_current_context().fail("Could not locate neighbor '{}'".format(ipaddr_or_hostname))

@bgp.group(cls=clicommon.AbbreviationGroup)
def startup():
Expand Down Expand Up @@ -3674,8 +3678,12 @@ def neighbor(ipaddr_or_hostname, verbose):
if _change_bgp_session_status(config_db, ipaddr_or_hostname, 'up', verbose):
found_neighbor = True

device_metadata = config_db.get_entry('DEVICE_METADATA', 'localhost')
if not found_neighbor:
click.get_current_context().fail("Could not locate neighbor '{}'".format(ipaddr_or_hostname))
if device_metadata['type'] == 'SpineRouter':
click.echo("Could not locate neighbor '{}'".format(ipaddr_or_hostname))
else:
click.get_current_context().fail("Could not locate neighbor '{}'".format(ipaddr_or_hostname))

#
# 'remove' subgroup ('config bgp remove ...')
Expand Down

0 comments on commit 49d9087

Please sign in to comment.