Skip to content
Snippets Groups Projects
Commit e112d105 authored by rick.mollard's avatar rick.mollard
Browse files

updates

parent 2a08aeed
No related branches found
No related tags found
No related merge requests found
from netmiko import (ConnectHandler,NetmikoTimeoutException)
from getpass import getpass
import requests
import urllib3
import re
import time
import getpass
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
#
# This script will look to see which ports are in a "failed" state and try to reathenticate the port.
#
#
###########################################################################
print(" 1 = UNL-City \n 2 = UNL-East \n 3 = UNO \n 4 = UNK \n Select Campus:")
campus = input()
print(f"Campus Selected: {campus}")
print("----------------------------------")
if campus == "1":
file = [line.strip() for line in open("unlCitySwitches-cx.txt", 'r')]
if campus == "2":
file = [line.strip() for line in open("unlEastSwitches-cx.txt", 'r')]
if campus == "3":
file = [line.strip() for line in open("unoSwitches-cx.txt", 'r')]
if campus == "4":
file = [line.strip() for line in open("unkSwitches-cx.txt", 'r')]
#print(file[])
#file.close()
Switches48port = ["JL661A","JL659A"]
##########################################################################
print("Enter Username:")
Ausername = input()
print("Enter Password:")
Apassword = getpass.getpass()
creds = {"username": {Ausername}, "password": {Apassword}}
for selectIP in file:
ip_add = selectIP
print(ip_add)
try:
net_connect = ConnectHandler(
device_type="aruba_procurve",
host=ip_add,
username=Ausername,
password=Apassword,
)
###############################################################################
output = net_connect.send_command(f"show vsf")
to1 = output.split("\n")
for to in to1 :
to = to.lstrip()
if "JL661A" in to: # Checks for 48 port switch
print(to)
#checks for
elif "JL659A" in to: # Checks for CL6 48 port Switch
print(to)
to = to.split(" ")[0]
net_connect.disconnect()
except (NetmikoTimeoutException) as error:
print("Switch is not responding-----> " + ip_add)
print("Switch is not responding-----> " + ip_add)
print("Switch is not responding-----> " + ip_add)
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment