Automating CLI telnet cmd scripts for APs
Last Post: August 1, 2006:
-
Hi All
I would appreciate it if someone can throw some light into my trouble
I used CLI scripts to telnet with the AP ip address via cmd to change AP config settings (channel, ssid). The end of my script is a reebot 0 command which i need to use for the AP changes to take place. However this reebot command causes the cmd prompt to freeze so I have to manually open another cmd prompt and paste the next telnet AP script and so on. This gets pretty frustrating esp when I have to do 40 AO reconfigs with my laptop connected via a switch.
So the solution i am looking for is something that will let me run all the telnet scripts at one time without opening cmd prompts for each telnet script.
Appreciate it
Glenn -
gtronx,
I have done something like this using Unix shell scripts (Korn, Bourne, C or Perl). Basically you open a telnet session within a shell script and redirect your cli commands to the telnet session. The shell script should loop through each IP address and execute the telnet session with its imbedded CLI commands. The shell script may need to be able to parse output from commands if there are any dependencies. The script will need a variable to hold the IP address and it may need them for unames and passwords if they are not sychronized. These can be passed to the script as command line parameters or as output from another file.
I won't kid you and say it is trivial but if you understand programming and Unix it is doable.
regards,
moe -
Thanks Moe for you valuable input
I do have some C++ programming knowledge from college.
I dont have any exposure to Unix (I use a laptop running XP. can i still do shell scripting)
for me...seems like your idea works..just one question
with each script being unique will assigning a variable for the IP address act like a pointer to point to the right script?
Id really appreciate if you can recommend a few books on shell scripting based on my needs.. and also where i can get a free or trial version on UNIX hopefully a dual boot feature with my XP laptop
thanks again..
Glenn -
Glenn,
Are you doing the same commands (like setting the channel and SSID) for each AP but just using different values? Or will the commands differ from AP to AP?
If the commands are the same and the values are changing then there are some shell commands that can read these values from a file of records and place them into variables. The variables can be used in constructing the command dynamically.
I don't have the book titles with me. When I get back to work tomorrow I will send them to you. The books are very old (mid to late 90's) so there may be better ways of doing this now. Check your personal messages and continue watching this thread as others may have better suggestions.
moe -
Glenn,
You can try Cygwin ( www.cygwin.com ) that will provide you a Unix environment under Windows.
When I have to do automatic scripts under Unix, I often use "expect". Cygwin also supports expect.
One of the books about scripting under Unix is "Learning the Bash shell".
HTH,
Vu -
If this is for a Cisco Aironet environment, you could use the Wireless LAN Solution Engine (WLSE) to manage the APs as a whole system rather than writing scripts to manage them on a one-by-one basis.
Joel -
Since you know some C++, you could write a small program to make a socket connection to port 23 and send the username/password and script to each device, then close the socket once you have finished writing your script to it. It is very simple to do, since telnet connections are all plain-text. You can even do one for SSH if you use libssh or something similar. I did it in PHP without too much trouble.
-
Thank you all of you
I finally got it working
I decided to install CYGWIN, wrote a perl script integrated with Expect.
After adding a couple of sleep functions here and there the automation works almost flawlessly
Thank you all for your tips and support
Cheers -
Way to go gtronx!
-
I believe what you want to do is to 'sub out' from your script so that the parent isn't waiting on a response from the child. 'Call' a separate program to reboot the AP is one way.
- 1