Skip to content

Commit

Permalink
Adding bgp's warmrestart timer and on-off knob (sonic-net#378)
Browse files Browse the repository at this point in the history
root@node1# config warm_restart bgp_timer 14

root@node1# show warm_restart config
name    enable    timer_name    timer_duration
------  --------  ------------  ----------------
bgp     false     bgp_timer     14
system  true      NULL          NULL

root@7d3e5fba80c0:/# config warm_restart enable bgp

root@7d3e5fba80c0:/# show warm_restart config
name    enable    timer_name    timer_duration
------  --------  ------------  ----------------
bgp     true      bgp_timer     14
system  false     NULL          NULL

Signed-off-by: Rodny Molina <rmolina@linkedin.com>
  • Loading branch information
rodnymolina authored and lguohan committed Nov 15, 2018
1 parent 45d85c9 commit c6b4fe7
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
13 changes: 11 additions & 2 deletions config/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -526,14 +526,14 @@ def warm_restart(ctx, redis_unix_socket_path):
pass

@warm_restart.command('enable')
@click.argument('module', metavar='<module>', default='system', required=False, type=click.Choice(["system", "swss"]))
@click.argument('module', metavar='<module>', default='system', required=False, type=click.Choice(["system", "swss", "bgp"]))
@click.pass_context
def warm_restart_enable(ctx, module):
db = ctx.obj['db']
db.mod_entry('WARM_RESTART', module, {'enable': 'true'})

@warm_restart.command('disable')
@click.argument('module', metavar='<module>', default='system', required=False, type=click.Choice(["system", "swss"]))
@click.argument('module', metavar='<module>', default='system', required=False, type=click.Choice(["system", "swss", "bgp"]))
@click.pass_context
def warm_restart_enable(ctx, module):
db = ctx.obj['db']
Expand All @@ -548,6 +548,15 @@ def warm_restart_neighsyncd_timer(ctx, seconds):
ctx.fail("neighsyncd warm restart timer must be in range 1-9999")
db.mod_entry('WARM_RESTART', 'swss', {'neighsyncd_timer': seconds})

@warm_restart.command('bgp_timer')
@click.argument('seconds', metavar='<seconds>', required=True, type=int)
@click.pass_context
def warm_restart_bgp_timer(ctx, seconds):
db = ctx.obj['db']
if seconds not in range(1,3600):
ctx.fail("bgp warm restart timer must be in range 1-3600")
db.mod_entry('WARM_RESTART', 'bgp', {'bgp_timer': seconds})

#
# 'vlan' group ('config vlan ...')
#
Expand Down
3 changes: 3 additions & 0 deletions show/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -1663,6 +1663,9 @@ def tablelize(keys, data):
if 'neighsyncd_timer' in data[k]:
r.append("neighsyncd_timer")
r.append(data[k]['neighsyncd_timer'])
elif 'bgp_timer' in data[k]:
r.append("bgp_timer")
r.append(data[k]['bgp_timer'])
else:
r.append("NULL")
r.append("NULL")
Expand Down

0 comments on commit c6b4fe7

Please sign in to comment.