Re: TCL Script help

From: Adam Booth <adam.booth_at_gmail.com>
Date: Sat, 13 Nov 2010 11:31:26 +1000

For learning about TCL, I have found that TCL Tutor -
http://www.msen.com/%7Eclif/TclTutor.html is a great resource.

It's a tutorial for TCL in general (not IOS specific) and has a built in
execution environment within the tutorials so you can wrap your head around
the general TCL syntax and mechanisms and then once you are happy that you
have the general ideas right such as string evaluation, logical flow and
learning regexs, you can then apply the ideas to your router within the IOS
specific context.

Cheers,
Adam

On Sat, Nov 13, 2010 at 9:08 AM, Marko Milivojevic <markom_at_ipexpert.com>wrote:

> TCL Scripting for Cisco IOS (ISBN: 1587059452)
>
> --
> Marko Milivojevic - CCIE #18427
> Senior Technical Instructor - IPexpert
>
> FREE CCIE training: http://bit.ly/vLecture
>
> Mailto: markom_at_ipexpert.com
> Telephone: +1.810.326.1444
> Web: http://www.ipexpert.com/
>
> On Fri, Nov 12, 2010 at 03:37, Senthil Kumar <2008ccie_at_live.com> wrote:
> > Tyson,
> > Could you please recommend any book for TCL script? I have little
> > knowledge, and I would like to learn deeper... I appreciate your reply
> > Thanks
> >
> > On 12/11/10 3:11 AM, "Tyson Scott" <tscott_at_ipexpert.com> wrote:
> >
> >>proc ping1 {IP} {
> >> set PING [ exec "ping vrf CUST1 $IP repeat 10" ]
> >> set PING [ regexp -inline -all {[\.!]{3}} $PING ]
> >> if { [ string first "!" $PING ] == -1 } {
> >> puts "[format "%-40s %s" "ping $IP" "****** FAILED *******" ]"
> >> } else { puts "[format "%-40s %s" "ping $IP" "****** PASSED *******" ]"
> }
> >>}
> >>proc ping2 {IP} {
> >> set PING [ exec "ping vrf C-GRATE $IP repeat 10" ]
> >> set PING [ regexp -inline -all {[\.!]{3}} $PING ]
> >> if { [ string first "!" $PING ] == -1 } {
> >> puts "[format "%-40s %s" "ping $IP" "****** FAILED *******" ]"
> >> } else { puts "[format "%-40s %s" "ping $IP" "****** PASSED *******" ]"
> }
> >>}
> >>foreach address {
> >>10.8.2.1
> >>10.8.2.2
> >>10.8.2.7
> >>10.8.0.45
> >>10.3.1.1
> >>10.3.2.1
> >>10.3.0.26
> >>10.3.0.3
> >>172.16.64.1
> >>172.16.68.1
> >>} { ping2 $address }
> >>foreach address {
> >>167.10.10.5
> >>10.10.0.1
> >>10.10.0.5
> >>} { ping1 $address }
> >>
> >>Regards,
> >>
> >>Tyson Scott - CCIE #13513 R&S, Security, and SP
> >>Managing Partner / Sr. Instructor - IPexpert, Inc.
> >>Mailto: tscott_at_ipexpert.com
> >>
> >>
> >>-----Original Message-----
> >>From: nobody_at_groupstudy.com [mailto:nobody_at_groupstudy.com] On Behalf Of
> >>Marcin Zgola
> >>Sent: Thursday, November 11, 2010 1:31 AM
> >>To: Cisco certification
> >>Subject: TCL Script help
> >>
> >>i have a PE router, that i want to develop TCL script that will check
> >>connectivity to all of the customers.
> >>
> >>I am confused with the script. HEre is list of ip addresses i want to
> ping
> >>sourcing from each VRF< and results either PASSED or FAILED.
> >>
> >>can some one help me?
> >>
> >>set cust2 {
> >>10.8.2.1
> >>10.8.2.2
> >>10.8.2.7
> >>10.8.0.45
> >>10.3.1.1
> >>10.3.2.1
> >>10.3.0.26
> >>10.3.0.3
> >>172.16.64.1
> >>172.16.68.1
> >>}
> >>set cust1 {
> >>167.10.10.5
> >>10.10.0.1
> >>10.10.0.5
> >>}
> >>foreach address {
> >>
> >>} {
> >>if { [regexp "(!!!!!!!!!)" [exec "ping vrf CUST1 $address rep 10" ]] } {
> >>puts "$address B ****** PASSED *******"
> >>} else { puts "$address ****** FAILED ******" }
> >>}
> >>if { [regexp "(!!!!!!!!!)" [exec "ping vrf C-GRATE $addressgrate rep 10"
> >>]]
> >>} {
> >>puts "$address B ****** PASSED *******"
> >>} else { puts "$address ****** FAILED ******" }
> >>
> >>Marcin Zgola
> >>Internetwork Lead
> >>CCIE #18676
> >>Netrix, LLC
> >>http://www.netrixllc.com
> >>Ph. 847-964-5300
> >>Fax.: 847-964-5350
> >>
> >>
> >>Blogs and organic groups at http://www.ccie.net
> >>
> >>_______________________________________________________________________
> >>Subscription information may be found at:
> >>http://www.groupstudy.com/list/CCIELab.html
> >>
> >>
> >>Blogs and organic groups at http://www.ccie.net
> >>
> >>_______________________________________________________________________
> >>Subscription information may be found at:
> >>http://www.groupstudy.com/list/CCIELab.html
> >
> >
> > Blogs and organic groups at http://www.ccie.net
> >
> > _______________________________________________________________________
> > Subscription information may be found at:
> > http://www.groupstudy.com/list/CCIELab.html
>
>
> Blogs and organic groups at http://www.ccie.net
>
> _______________________________________________________________________
> Subscription information may be found at:
> http://www.groupstudy.com/list/CCIELab.html

Blogs and organic groups at http://www.ccie.net
Received on Sat Nov 13 2010 - 11:31:26 ART

This archive was generated by hypermail 2.2.0 : Sun Dec 05 2010 - 22:14:56 ART