Skip to content

Commit

Permalink
VxLAN Tunnel Counters and Rates implementation (#1748)
Browse files Browse the repository at this point in the history
* Vxlan Tunnel counters implementation
  • Loading branch information
dgsudharsan authored Oct 29, 2021
1 parent 80a10dc commit 0665d6f
Show file tree
Hide file tree
Showing 7 changed files with 526 additions and 0 deletions.
6 changes: 6 additions & 0 deletions clear/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,12 @@ def dropcounters():
command = "dropstat -c clear"
run_command(command)

@cli.command()
def tunnelcounters():
"""Clear Tunnel counters"""
command = "tunnelstat -c"
run_command(command)

#
# 'clear watermarks
#
Expand Down
36 changes: 36 additions & 0 deletions counterpoll/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,39 @@ def disable():
configdb.mod_entry("FLEX_COUNTER_TABLE", "PG_WATERMARK", fc_info)
configdb.mod_entry("FLEX_COUNTER_TABLE", BUFFER_POOL_WATERMARK, fc_info)

# Tunnel counter commands
@cli.group()
def tunnel():
""" Tunnel counter commands """

@tunnel.command()
@click.argument('poll_interval', type=click.IntRange(100, 30000))
def interval(poll_interval):
""" Set tunnel counter query interval """
configdb = ConfigDBConnector()
configdb.connect()
tunnel_info = {}
tunnel_info['POLL_INTERVAL'] = poll_interval
configdb.mod_entry("FLEX_COUNTER_TABLE", "TUNNEL", tunnel_info)

@tunnel.command()
def enable():
""" Enable tunnel counter query """
configdb = ConfigDBConnector()
configdb.connect()
tunnel_info = {}
tunnel_info['FLEX_COUNTER_STATUS'] = ENABLE
configdb.mod_entry("FLEX_COUNTER_TABLE", "TUNNEL", tunnel_info)

@tunnel.command()
def disable():
""" Disable tunnel counter query """
configdb = ConfigDBConnector()
configdb.connect()
tunnel_info = {}
tunnel_info['FLEX_COUNTER_STATUS'] = DISABLE
configdb.mod_entry("FLEX_COUNTER_TABLE", "TUNNEL", tunnel_info)

@cli.command()
def show():
""" Show the counter configuration """
Expand All @@ -254,6 +287,7 @@ def show():
pg_wm_info = configdb.get_entry('FLEX_COUNTER_TABLE', 'PG_WATERMARK')
pg_drop_info = configdb.get_entry('FLEX_COUNTER_TABLE', PG_DROP)
buffer_pool_wm_info = configdb.get_entry('FLEX_COUNTER_TABLE', BUFFER_POOL_WATERMARK)
tunnel_info = configdb.get_entry('FLEX_COUNTER_TABLE', 'TUNNEL')

header = ("Type", "Interval (in ms)", "Status")
data = []
Expand All @@ -273,6 +307,8 @@ def show():
data.append(['PG_DROP_STAT', pg_drop_info.get("POLL_INTERVAL", DEFLT_10_SEC), pg_drop_info.get("FLEX_COUNTER_STATUS", DISABLE)])
if buffer_pool_wm_info:
data.append(["BUFFER_POOL_WATERMARK_STAT", buffer_pool_wm_info.get("POLL_INTERVAL", DEFLT_10_SEC), buffer_pool_wm_info.get("FLEX_COUNTER_STATUS", DISABLE)])
if tunnel_info:
data.append(["TUNNEL_STAT", rif_info.get("POLL_INTERVAL", DEFLT_10_SEC), rif_info.get("FLEX_COUNTER_STATUS", DISABLE)])

click.echo(tabulate(data, headers=header, tablefmt="simple", missingval=""))

Expand Down
Loading

0 comments on commit 0665d6f

Please sign in to comment.