Select Git revision
ajax.lib.php
-
Regis Houssin authored
New: ajax button on/off for constant
Regis Houssin authoredNew: ajax button on/off for constant
SwitchCommands.py 1.60 KiB
import netmiko
import ConfigChecker
import time
# File to hold switch commands
def defaultport(ssh, current_interface):
interface_configuration = [f'interface {current_interface}', 'shutdown'
'no routing',
'vlan access 1', 'spanning-tree bpdu-guard',
'spanning-tree port-type admin-edge',
'aaa authentication port-access auth-precedence mac-auth dot1x',
'aaa authentication port-access auth-priority dot1x mac-auth',
'aaa authentication port-access client-limit 15',
'aaa authentication port-access dot1x authenticator max-eapol-requests 1',
'aaa authentication port-access dot1x authenticator max-retries 3',
'aaa authentication port-access dot1x authenticator enable',
'aaa authentication port-access mac-auth enable',
'loop-protect', 'no shutdown']
ssh.send_config_set(interface_configuration) # Send the Command To Reset The Interface
print("Interface:", current_interface, "has been reset.")
def shutport(ssh, current_interface):
interface_configuration = [f'interface {current_interface}', 'shut']
ssh.send_config_set(interface_configuration) # Send a Shutdown Command
def noshutport(ssh, current_interface):
interface_configuration = [f'interface {current_interface}', 'no shut']
ssh.send_config_set(interface_configuration) # Send a No Shutdown Command