1
0
mirror of https://github.com/checktheroads/hyperglass synced 2024-05-11 05:55:08 +00:00

fixed issue with ssh connections

This commit is contained in:
checktheroads
2019-05-27 07:53:56 -07:00
parent 3ca26037aa
commit e221f4be4a
3 changed files with 18 additions and 23 deletions

View File

@ -1,5 +1,3 @@
#!/usr/bin/env python3
# Module Imports
import re
import sys
@ -16,6 +14,7 @@ code = configuration.codes()
def frr(cmd, ipprefix, device):
"""Validates input and constructs API call to FRRouting Stack via hyperglass-frr API"""
d_address = device["address"]
d_src_addr_ipv4 = device["src_addr_ipv4"]
d_src_addr_ipv6 = device["src_addr_ipv6"]
@ -24,7 +23,6 @@ def frr(cmd, ipprefix, device):
d_port = device["port"]
d_type = device["type"]
logger.info(f"Constructing {cmd} command for FRR router {d_name} to {ipprefix}...")
# BGP Community Query
if cmd in ["bgp_community"]:
# Extended Communities, new-format
@ -108,7 +106,7 @@ def frr(cmd, ipprefix, device):
def ssh(cmd, ipprefix, device):
"""Receives JSON from Flask, constucts the command that will be passed to the router. Also handles input validation & error handling."""
"""Validates input and constructs usable commands to run via netmiko"""
d_address = device["address"]
d_src_addr_ipv4 = device["src_addr_ipv4"]
d_src_addr_ipv6 = device["src_addr_ipv6"]
@ -117,8 +115,6 @@ def ssh(cmd, ipprefix, device):
d_port = device["port"]
d_type = device["type"]
logger.info(f"Constructing {cmd} command for {d_name} to {ipprefix}...")
c = configuration.command(d_type)
# BGP Community Query
if cmd == "bgp_community":