Skip to content

Commit

Permalink
Merge pull request #41 from abdosi/202205
Browse files Browse the repository at this point in the history
[202205-msft] Added change to not return error for Sonic t2/spine-router role when config bgp shutdown/startup is given
  • Loading branch information
gechiang authored Feb 5, 2024
2 parents 7dc1a54 + 49d9087 commit 9099585
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 9099585

Please sign in to comment.