Closed igoryonya closed 5 years ago
Hi, yes the module is hanging waiting for the next command line prompt as it's in a mode where there is one command, then some output, then a prompt.
You can write a telnet macro:
macro telnet_to
send telnet %s
match user
send %s
match pass
send %s
match generic
user and pass are existing prompts known to the module: https://github.com/ollyg/Net-CLI-Interact/blob/master/share/phrasebook/cisco/pb
and you run it like:
$s->macro('telnet_to', { params => ['desthost', 'username', 'password'] });
these guides should help: https://metacpan.org/pod/distribution/Net-CLI-Interact/lib/Net/CLI/Interact/Manual/Cookbook.pod https://metacpan.org/pod/distribution/Net-CLI-Interact/lib/Net/CLI/Interact/Manual/Phrasebook.pod https://metacpan.org/pod/distribution/Net-CLI-Interact/lib/Net/CLI/Interact/Manual/Tutorial.pod
And note that the Net::CLI::Interact instance used in the manuals is available with the $s->nas()
method on the Net::Appliance::Session instance.
I need to monitor a router, that's not visible directly, but only from an other router, so, I telnet to the router, visible by me directly, then I issue a nested telnet command to a remote router form the router, that I am in telnet session currently, but it doesn't work that way. I guess, it hangs on user name/password prompts: