TCL in XR

All,

Is the TCL language the same in XR as IOS?  Wanting to write a reachability script in XR just in case.

Thanks,

 

Warjack

Comments

  • The problem with TCL on XR is that you cannot use on rack rentals (INE rack rentals) or the CCIE lab. The feature is apparently not authorized unless you have admin priviledges to the box. In both of these cases, we have just SDR access and you will see "command not authorized". 

    If your only reason for doing TCL on IOS-XR is so that you can use it in the CCIE lab, then don't waste your time =). You will be able to use TCL on all of the 7200 IOU boxes though. I did most of my verification this way. 

  • Except the priviledges problem which plucena mentioned, you can invoke the tcl shell on XR using "run tclsh", but for IPv4 pings, you won't be able to define the source interface/ip from the tcl shell.

  • Thanks plucena for the Clarification, I used TCLSH script in my XR Study, but it seems I'm not gonna able to use it in the Lab Exam.

    For Wixi, here are the TCL commands for IPv4 and IPv6 in IOS-XR

    run tclsh

    set lo0 <IPv4>

    foreach IPV4 {

    ....

    } { ping $lo0 $IPV4}

     

    for IPv6

    set lo0 <IPv6>

    foreach IPV6 {

    ....

    } {ping6 -S $lo0 $IPV6}

     

    I hope that can help you to know the TCL in XR though :p

  • As discussed here

    http://ieoc.com/forums/t/26821.aspx

    I am also not able to use the source, see

    RP/0/7/CPU0:G1#run tclsh

    % foreach X {
    1.1.1.1
    2.2.2.2
    } {ping $X source 192.168.242.145}
    % Invalid parameter(s)
    child process exited abnormally
    %

    % set lo 192.168.242.145
    192.168.242.145
    % foreach IPV4 {
    1.1.1.1
    2.2.2.2
    } { ping $IPV4 $lo }
    % Invalid parameter(s)
    child process exited abnormally
    %

    I think you swapped the Lo and ping destination in your example but still

    % foreach IPV4 {
    1.1.1.1
    2.2.2.2
    } { ping $lo $IPV4 }
    % Invalid parameter(s)
    child process exited abnormally
    %
    I cannot verify the ping6, but I believe it is working, since from TCL shell I see

    % ping6 -S
    ping6: option requires an argument -- S
    usage: ping6 [-dfHnNqtvwW] [-a [aAclsg]] [-b sockbufsiz] [-c count]
            [-I interface] [-i wait] [-l preload] [-p pattern] [-S sourceaddr] [-R vrfname]
            [-s packetsize] [-h hoplimit] [hops...] host [-x sweep]
    child process exited abnormally
    %

    % puts $tcl_version
    8.3
    %

    running on 12k 3.9.1

     

    I am not sure the quotes will do the trick, see the behaviour below

     

    RP/0/7/CPU0:G1#show run int loo2
    interface Loopback2
     ipv4 address 192.168.242.145 255.255.255.255
    !

    RP/0/7/CPU0:G1#

    RP/0/7/CPU0:G1#ping 2.2.2.2 source lo2
    Type escape sequence to abort.
    Sending 5, 100-byte ICMP Echos to 2.2.2.2, timeout is 2 seconds:
    !!!!!
    Success rate is 100 percent (5/5), round-trip min/avg/max = 1/1/4 ms
    RP/0/7/CPU0:G1#

    RP/0/7/CPU0:G1#run tclsh

    % ping "2.2.2.2 source 192.168.242.145"
    Type escape sequence to abort.
    Sending 5, 100-byte ICMP Echos to 2.2.2.2, timeout is 2 seconds:
    .....
    Success rate is 0 percent (0/5)
    %
    So the same as if I do not specify the source from CLI

    RP/0/7/CPU0:G1#ping 2.2.2.2

    Type escape sequence to abort.
    Sending 5, 100-byte ICMP Echos to 2.2.2.2, timeout is 2 seconds:
    .....
    Success rate is 0 percent (0/5)
    RP/0/7/CPU0:G1#

     

     

     

  • The reason this is not working is because TCL is expecting the run level command for ping. 

    That means that the command syntax needed does not match the one provided on the exec CLI wrapper. 

    The run level syntax which you need to include to make this work for ipv4 should be: 

    ping -p 0xf -s loopback2 $X

    Alternatively for ipv6 the syntax would be: 

    ping6 -p 0xf -S <src address> <dst address>

    In my opinion however a much easier option would be to use the config level alias option as described in my earlier post (http://ieoc.com/forums/t/26821.aspx), this avoids having to decyper the run level commands for a simple ping script. 

     

  • Bluebell, thanks, that works perfectly, how did you find the -p switch ?

  • Hello Wixi, 

    the run level translation that you require to generate you TCL scripts can be identified using the IOS XR "describe" syntax: 

    RP/5/RP0/CPU0:ios#describe ping 192.168.1.1 source Loopback0

    <snip>

      Spawn the process:

            ping -p 0xf -z 0xa -s Loopback0 192.168.1.1 

    RP/5/RP0/CPU0:ios#

    It should be noted, in IOS XR TCLSH runs from the QNX shell hence it always expects the run level command syntax, never the global syntax which you are familiar with from the CLI. 
Sign In or Register to comment.