Browse Source

not required func

master
Mael G. 6 months ago
parent
commit
86fcbfb363
  1. 10
      web.py

10
web.py

@ -56,13 +56,9 @@ def show(short_url = False, ipaddr = ""):
if(not re.match('^((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)(/(3[0-2]|2[0-9]|1[0-9]|[0-9]))?$', actiondata['ip_addr'])):
error_msg = "Please enter a valid IPv4 or IPv6 with or without his CIDR."
return render_template('index.html', config = config, actiondata=actiondata, graph={}, cmd_res=error_msg)
else:
iptype = 2 # 1 = ipv6 / 2 = ipv4
else:
error_msg = "Please enter a valid IPv6 with or without his CIDR."
return render_template('index.html', config = config, actiondata=actiondata, graph={}, cmd_res=error_msg)
else:
iptype = 1 # 1 = ipv6 / 2 = ipv4
#Init ssh client
client = SSHClient()
@ -85,11 +81,7 @@ def show(short_url = False, ipaddr = ""):
if(actiondata['action_type'] == "1"):
if(rtr["bgpcapable"]):
#Launching CMD
if(iptype == 2): #IPv4 cli command
stdin, stdout, stderr = client.exec_command(f'vtysh -c "sh bgp {actiondata["ip_addr"]}"')
else: #IPv6 cli command
stdin, stdout, stderr = client.exec_command(f'vtysh -c "sh bgp ipv6 {actiondata["ip_addr"]}"')
stdin, stdout, stderr = client.exec_command(f'vtysh -c "sh bgp {actiondata["ip_addr"]}"')
time.sleep(0.1)
conresult = stdout.read().decode("utf8")

Loading…
Cancel
Save