Skip to content

Noowan/Huawei-Disable-inactive-interfaces

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

This script disables inactive interfaces on huawei network devices.

Dependecies are:

Paramiko - https://github.com/paramiko/paramiko
You can install it with "pip install paramiko" command

Disabling only physical interfaces(L2) like GigabitEthernetX/X/X,FastEthernetX/X/X, XGigabitEthernetX/X/X and etc.

Tested with AR2504-D-H, S5700, S5720, AR3260(has a bug: disabling each interface two times). Over 10000 ports were disabled in large service provider network

To run script you need to place it into your preffered directory and run with python.


Please change your username and password in main.py

Required arguments is:

     --mode show/shut:

        "show" -  only print interfaces that able to be shutdowned because their operstatus is DOWN and there is no description;

        "shut" - send interface *** shutdown command

    --devip *device_ip*:
        execute script only for this ip

    --fname *name_of_file_with_extention*
        parse your file to get device names and device ip adresses

File should be like this:

DEVICENAME1 192.168.1.1
DEVICENAME2 192.168.1.2
DEVICENAME3 192.168.1.3
DEVICENAME4 192.168.1.4
DEVICENAME5 192.168.1.5
DEVICENAME6 192.168.1.6 

You can see example in devices_example.txt


Running examples:

python3 main.py --mode=show --devip=192.168.1.1
or
python3 main.py --mode=show --fname=devices.txt

script generates output files:

errors.txt: all errors here
success_disable.txt: device names, ip's and list of ports which are disabled. Only in "shut" mode
success_print_cadidates.txt device names, ip's and list of ports which can be disabled. Only in "show" mode

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages