From a9efe026a3938946cf03a4fcaaabd42f9c67eb76 Mon Sep 17 00:00:00 2001 From: "rick.mollard" <rick.mollard@nebraska.edu> Date: Tue, 12 Jul 2022 10:18:41 -0500 Subject: [PATCH] Delete FindLinkTransitions.py --- FindLinkTransitions.py | 62 ------------------------------------------ 1 file changed, 62 deletions(-) delete mode 100644 FindLinkTransitions.py diff --git a/FindLinkTransitions.py b/FindLinkTransitions.py deleted file mode 100644 index 060e981..0000000 --- a/FindLinkTransitions.py +++ /dev/null @@ -1,62 +0,0 @@ -from urllib3 import exceptions # Prevent SSL Self-Signed Certificate Error -import requests # Creation Of New Object -import urllib3 -import re -from netmiko import (ConnectHandler,NetmikoTimeoutException) # SSH Connection -import socket # DNS Lookup -import time # For Waiting -import CampusSelector - - -def main(ArubaUsername, ArubaPassword): - # Preparatory Work for SSH Connection - urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning) # Disable Certificate Warning - interfaces = {} # Initialize the interface variable - current_interface = "" # Initialize Current Interface to make sure it isn't null - port_configuration = ['vlan access 1', 'enable', 'enable'] - exception = ['trunk allowed 2000', 'trunk allowed 1999'] - int_changes = [] - - # Get the Campus or Switch IP Address - campus = CampusSelector.Campus_Selector() - ip = campus[1] - campus_selection = campus[2] - campus_file = campus[0] - transitions = "2000" - Switch = 1 - SwitchPort = 1 - - if campus_selection != "6": - with open(campus_file) as file: - while line := file.readline().rstrip(): - ip = line - hostname = socket.getfqdn(ip) - print('Current Switch:', hostname, ":", ip) - - missing = [] - # Create Session Object - session = requests.session() - - # Create SSH Connection - try: - ssh = ConnectHandler( - device_type="aruba_procurve", - host=ip, - username=ArubaUsername, - password=ArubaPassword, - ) - print(username) - - login = session.post(f"https://{ip}/rest/v1/login", data=(username,password), verify=False) - get_log = session.get(f"https://{ip}/rest/v10.04/system/interfaces/{Switch}%2F1%2F{SwitchPort}?attributes=link_resets&depth=2&selector=statistics") - print(get_logs) - logout = session.post(f"https://{ip}/rest/v1/logout") - print(f"Logout Code from Switch:{logout.status_code}") - - finally: - print("Logging Out From Switch", hostname, ip) - ssh.disconnect() - time.sleep(1) - - - \ No newline at end of file -- GitLab