Solved

Adtran router reboot via TCL scrip

Posted on 2008-10-23
3
1,053 Views
Last Modified: 2013-11-22
I'm looking for some guidance on a tcl script to reboot a router should an interface go down. Can anyone point me in the right direction?

Thanks,

Brad
0
Comment
Question by:bctel
3 Comments
 
LVL 51

Expert Comment

by:ahoffmann
ID: 22827230
is there a specific reason to do it with Tcl?
0
 
LVL 1

Accepted Solution

by:
tinh20012002 earned 500 total points
ID: 23369360
I used Activetcl 8.4.19 from activestate.com.  Make sure you select the free version package.  
This package.  After installation (on windows). you write the scripts similar to this:
----
package require Expect;
# telnet the to router and check interaface.  #If down reboot router. # need minor modification to fit your #Environment.  
spawn telnet $Router_IP;
      expect "user: "; send "username\r";   expect "Password: "; send "pwd\r";
      expect -re "#"; sleep 3 ; # the "#" here  is the prompt of your router      
      set expect_out(buffer) "";
      send "place the command to checkk routeer interace here";       
      expect -re "#"; sleep 2; set test_buff $expect_out(buffer);
      if { [regexp "down" $test_buff ] == 1 } {
            puts "interface status: $test_buff"
            send "reboot cmd \r";       expect -re "w\confirm";       send "Y \r"
      }      

# you can also use Linux completely, or cywgin for windows.
0

Featured Post

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I hope you'll find this tutorial useful and interesting. So let's try to extend Tcl with a new package.  For anyone more deeply interested please check out the book "Practical Programming in Tcl and Tk". It's really one of the best written books abo…
There are two basic ways to configure a static route for Cisco IOS devices. I've written this article to highlight a case study comparing the configuration of a static route using the next-hop IP and the configuration of a static route using an outg…
Learn the basics of if, else, and elif statements in Python 2.7. Use "if" statements to test a specified condition.: The structure of an if statement is as follows: (CODE) Use "else" statements to allow the execution of an alternative, if the …
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

773 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question