04-10-2017 09:45 PM - edited 03-05-2019 08:20 AM
Hi Everyone,
I have a project to upgrade several sites with new cisco 2911 routers and 2960x switches that already have been purchased.
I have my own scripts (wordpad) for standard configs like aaa, accesslists, local logins, and etc..
is there an easier way to push out scripts ? or any good advise out there on a deployment besides having a standard configs in a word pad and copy and pasting?
Thank you!
PC
04-10-2017 10:06 PM
04-10-2017 10:58 PM
thanks! I will have to look into python.
I have putty and crt for ssh /telnet
whats the advantages or difference between python and Cisco macros ?
Is there a good site where I can read up on building a python script? And how to deploy it?
04-10-2017 11:05 PM
Oh and what's a good client application to create the script?
04-10-2017 11:24 PM
Hiii,
I would recommend you first deploy in GNS.
- you need to install python in your machine, preferably ver 2.7.installation is avaliable on youtube.
- most of your query will be answer on http://stackoverflow.com/.
###################################################
telnet program script use in gns ro get sh ip int brief
##################################################
import sys
import telnetlib
import os
# 1.1.1.1 is router IP, for simplicity i have use "no login" under VTY so that router wont ask #user name and password,
IP="1.1.1.1"
tn =telnetlib.Telnet(IP)
TELNET_PROMPT=IP
TIMEOUT=5
tn.write("term len 0" + "\n")
tn.write("en"+"\n")
tn.write("cisco"+"\n")
tn.write("sh ip int brief "+"\n")
tn.write("#stop"+"\n")
output=tn.read_until("#stop", TIMEOUT)
print output
c=open("CommandPJNB520.txt","r")
for line in c:
tn.write(line)
tn.write("########################################################"+"\n")
tn.write("#stop"+"\n")
output=tn.read_until("#stop", TIMEOUT)
D=open(r"c:\Python27\PostTESTPJNB520.txt", "w")
sys.stdout = open(r"c:\Python27\PostTESTPJNB520.txt", "a")
print output
04-10-2017 10:41 PM
Hi,
Personally i won't recommend using python script or any other script for AAA configuration, you may lose the access;.
for rest of the config. you can use python. you need to import telnetlib library for telnet and paramiko for SSH.
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide