Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re: use telnet to router with expect

by RMGir (Prior)
on Mar 14, 2014 at 13:18 UTC ( [id://1078327]=note: print w/replies, xml ) Need Help??


in reply to use telnet to router with expect

"Does not run" meaning the spawn fails? Or at a later step? You might want to add an
or die "Expect spawn failed, error $!";
to the end of your spawn command - that might tell you WHY it's failing...

I assume 000.000.000.000 isn't the IP address you're actually using - but if it is, that would explain the failure :)


Mike

Replies are listed 'Best First'.
Re^2: use telnet to router with expect
by fionbarr (Friar) on Mar 14, 2014 at 13:52 UTC
    thanks Mike...everything works except the 'show inventory' command. The login succeeds and I see the router prompt. At that point, the script says: 'print $command "show inventory"' and the command does not execute.
      Interesting...

      I'd download a copy of wireshark (a.k.a. tcpdump) and look at what goes over the wire when you do the command interactively with telnet - perhaps there's a \r sent somewhere you're using a \n, for example.


      Mike
      Another possibility - maybe "hard_close" is closing the command before the server can respond?

      What happens if you switch that to "soft_close", or even expect something you'd see at the end of the inventory before closing?


      Mike

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1078327]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others contemplating the Monastery: (6)
As of 2024-04-24 04:04 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found