Skip to content
Snippets Groups Projects
Select Git revision
  • 2eded2f79277e596637921a53306a63eba9259b1
  • 3.9 default
  • develop
  • 6.0
  • 5.0
  • 4.0
  • scrutinizer-patch-4
  • scrutinizer-patch-3
  • scrutinizer-patch-2
  • scrutinizer-patch-1
  • 3.7
  • 3.8
  • 3.6
  • 3.9_backported
  • 3.8_backported
  • 3.7_backported
  • 3.5
  • 3.6_backported
  • 3.5_backported
  • 3.4
  • 3.3_backported
  • 6.0.4
  • 6.0.3
  • 5.0.7
  • 6.0.2
  • 6.0.1
  • 5.0.6
  • 6.0.0
  • 5.0.5
  • 6.0.0-rc
  • 5.0.4
  • 6.0.0-beta
  • 5.0.3
  • 4.0.6
  • 5.0.2
  • 5.0.1
  • 4.0.5
  • 5.0.0
  • 4.0.4
  • 5.0.0-rc2
  • 5.0.0-rc1
41 results

ajax.lib.php

Blame
  • 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