Menu

Telnet, rlogin to other machines with STAF

Help
Mike
2008-03-18
2013-06-12
  • Mike

    Mike - 2008-03-18

    Dear Team,

    I'm a new user of STAF. It looks to be a great Automation tool.

    I installed STAF on a server machine. In my test cases, operators need to telnet/rlogin from the server machine to various other devices (some of them are embedded Linux, some are not Linux at all), execute some tests, observe the output on telnet session and determine test pass/failure.

    Can STAF/STAX work for this? Is any STAF Service needed to install?
    Or I have to use Expect/tcl to work around this? If so, is any sample or reference about how to do it?

    Thanks a lot in advance!
    -Mike Li

     
    • Sharon Lucas

      Sharon Lucas - 2008-03-18

      Thanks for the nice words on STAF.

      STAF doesn't provide process interaction capabilities.  But if telnet/rlogin allows you to specify the commands you want to run in a file and pass the file as an input parameter to the telnet/rlogin command, you might be able to do this using STAF's PROCESS service (a core STAF service) by specifying this file for the STDIN option on a PROCESS START request.  There's an example of providing a stdin file for ftp via a STAX job in http://sourceforge.net/forum/message.php?msg_id=3214450.  This could be done without using STAX by submitting a START request to the PROCESS service.

      Otherwise, using Expect should work.  Expect is designed to interact with the input/output of programs.  You can google for examples of how to use expect to interact with the telnet command.  For example, see http://linuxgazette.net/issue50/tag/34.html.  If desired, you could use STAF's PROCESS START request to run an expect script.

       
      • Mike

        Mike - 2008-03-19

        Thank slucas for quick and helpful response!

        If I pass a file as input to telnet, how to handle the output on screen generated by shell commands in the telnet session? Does STAF have some functions to parse the output, such as searching specific string and value to determine the output is expected?

        I'll look at how to use Expect. Thanks again,

        -Mike

         
        • Charles Rankin

          Charles Rankin - 2008-03-19

          If you are using telnet/rlogin to simply invoke a command and look at the ouput, then you likely don't need expect.  With STAF you can invoke the command on the remote system and tell STAF to return the stdout/stderr which you can then inspect to determine the success/failure.

          However, if you actually need to interact with the running command (such as responding to prompts from the program), then you'll need to use expect (or something similar) to handle the process interaction.  As Sharon mentioned, STAF doesn't currently allow you to interact with the stdin of processes it starts.

           

Log in to post a comment.

MongoDB Logo MongoDB