Skip to content

Commit 7a5ba8b

Browse files
James CaesarJames Caesar
James Caesar
authored and
James Caesar
committed
Make ClearDesc platform independent
Script previously just cleared descriptions for port ranges on a 9396. Now polls for list of interfaces and clears them all.
1 parent 4e8d932 commit 7a5ba8b

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

ClearDesc.py

+8-5
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,14 @@
22
from nxapi_base import NXOS
33

44
def main(args):
5-
n9k = NXOS(args.mgmt_ip)
6-
n9k.PromptCreds()
7-
commands = ['int m0 ;no desc', 'int e1/1-48 ;no desc', 'int e2/1-12 ;no desc',
8-
'int Po1 ;no desc']
9-
n9k.cli_conf(commands)
5+
device = NXOS(args.mgmt_ip)
6+
device.PromptCreds()
7+
intfstatus = device.cli_show('show interface status')
8+
intflist = intfstatus['TABLE_interface']['ROW_interface']
9+
commands = []
10+
for intf in intflist:
11+
commands.append("int {} ;no description".format(intf['interface']))
12+
device.cli_conf(commands)
1013
print "Descriptions Cleared."
1114

1215
if __name__ == '__main__':

0 commit comments

Comments
 (0)