Switch ipv6_edge_router to quagga #8
1 changed files with 3 additions and 3 deletions
|
@ -18,7 +18,7 @@ def parse_bgp_summary(summary):
|
||||||
res['routes'] = int(match.group('routes'))
|
res['routes'] = int(match.group('routes'))
|
||||||
uptime = match.group('uptime')
|
uptime = match.group('uptime')
|
||||||
if re.fullmatch(r'[0-9]+:[0-9]+:[0-9]+', uptime) is not None:
|
if re.fullmatch(r'[0-9]+:[0-9]+:[0-9]+', uptime) is not None:
|
||||||
uptime = line[8].split(':')
|
uptime = uptime.split(':')
|
||||||
uptime = int(uptime[0])*3600 + int(uptime[1])*60 + int(uptime[2])
|
uptime = int(uptime[0])*3600 + int(uptime[1])*60 + int(uptime[2])
|
||||||
else:
|
else:
|
||||||
uptime_match = re.fullmatch(r'([0-9]+)d([0-9]+)h([0-9]+)m', uptime)
|
uptime_match = re.fullmatch(r'([0-9]+)d([0-9]+)h([0-9]+)m', uptime)
|
||||||
|
@ -38,8 +38,8 @@ def parse_bgp_summary(summary):
|
||||||
return res
|
return res
|
||||||
|
|
||||||
def prompt(version='ipv4'):
|
def prompt(version='ipv4'):
|
||||||
summary = subprocess.run(['/usr/bin/vtysh', '-c', f'show bgp {version} unicast summary'], capture_output=True).stdout.decode('utf-8')
|
bgp_unicast_summary = subprocess.run(['/usr/bin/vtysh', '-c', f'show bgp {version} unicast summary'], capture_output=True).stdout.decode('utf-8')
|
||||||
bgp_routes_uptime = parse_bgp_summary(bgp_ipv4_unicast_summary)
|
bgp_routes_uptime = parse_bgp_summary(bgp_unicast_summary)
|
||||||
routes = bgp_routes_uptime['routes']
|
routes = bgp_routes_uptime['routes']
|
||||||
uptime = bgp_routes_uptime['uptime']
|
uptime = bgp_routes_uptime['uptime']
|
||||||
print(f'# HELP quagga_bgp_{version}_routes Number of {version} routes added by quagga')
|
print(f'# HELP quagga_bgp_{version}_routes Number of {version} routes added by quagga')
|
||||||
|
|
Loading…
Reference in a new issue