Re: Tcl (Cisco) ping program.....
- From: "Earl Greida" <eGREGIOUSgrieda@xxxxxxxxxxxxxxxx>
- Date: Tue, 28 Nov 2006 18:41:03 GMT
"Cameron Laird" <claird@xxxxxxxxx> wrote in message
news:v49u34-lri.ln1@xxxxxxxxxxxx
In article <ciZah.4238$ql2.804@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx>,need
Earl Greida <eGREGIOUSgrieda@xxxxxxxxxxxxxxxx> wrote:
"Lag" <clfarris@xxxxxxxxx> wrote in message
news:1164728844.824942.173070@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
I'm completely new to Tcl. I'm trying to come up with a program that
will be feed a list of IP addresses on the screen, one at a time (i.e.
192.168.1.20 - 192.168.1.55) and ping each IP. The program needs to
output the success or failure of the ping. This program will be
running on Cisco equipment! I really could use some help, please. And
if anyone knows any good links or books on Tcl Programming (besides
cisco.com, I've downloaded everything they have...LOL) it would be
appreciated.
Sample Output:
-----------------------------------------------------
IP Successful Ping?
-----------------------------------------------------
192.168.1.20 YES
192.168.1.21 YES
192.168.1.22 NO
192.168.1.23 YES
......
------------------------------------------------------
This program will be a fun exercise and give you good experience. You
into use Expect and Tcl. Download/install Activestate since it includes
Expect. Buy "Exploring Expect" by Don Libes and "Practicle Programming
Tcl/Tk" by Brent Welch.
Earl, this might be misleading. While I advocate *Exploring Expect*
as much as anyone, it's possible that Expect is NOT required in any
meaningful way, depending on exactly what the original poster means,
nor is much study. Maybe he just wants
for {set address 20} {$address <= 55} {incr address} {
set ip 192.168.1.$address
if [catch {exec ping -c 1 $ip}] {
set result NO
} else {
set result YES
}
puts [format %20s\t\t\t%20s $ip $result]
}
Is that close, Mr. Farris? Is so, we can work out the formatting.
Maybe, maybe not. However, if he is going to do any meaningful work in
networking test/automation then he needs to know Expect. Also, he needs to
derive the solutions himself. Providing sample code that he just copies is
not helping him learn anything.
.
- Follow-Ups:
- Re: Tcl (Cisco) ping program.....
- From: Fredderic
- Re: Tcl (Cisco) ping program.....
- References:
- Tcl (Cisco) ping program.....
- From: Lag
- Re: Tcl (Cisco) ping program.....
- From: Earl Greida
- Re: Tcl (Cisco) ping program.....
- From: Cameron Laird
- Tcl (Cisco) ping program.....
- Prev by Date: Re: proc needs to always calculate the following Saturday but fails Nov - Apr
- Next by Date: Re: proc needs to always calculate the following Saturday but fails Nov - Apr
- Previous by thread: Re: Tcl (Cisco) ping program.....
- Next by thread: Re: Tcl (Cisco) ping program.....
- Index(es):