in reply to Re: Re: Telnet into Cisco switches
in thread Telnet into Cisco switches

here is my code, in case i am missing something obvious:
my $session; $session = Net::Telnet::Cisco->new(Host => $switch->{IP}); $session->login(Password => $switch->{PASS1}); $session->close();

Replies are listed 'Best First'.
Re: Re: Re: Re: Telnet into Cisco switches
by blue_cowdawg (Monsignor) on Jul 11, 2003 at 16:08 UTC

    Is the prompt from the switch what Net::Telnet::Cisco thinks it should be?


    Peter L. BergholdBrewer of Belgian Ales
    Peter@Berghold.Netwww.berghold.net
    Unix Professional
Re: Re: Re: Re: Telnet into Cisco switches
by naChoZ (Curate) on Jul 11, 2003 at 16:08 UTC
    Yes, you are.

    $session->login(Password => $switch->{PASS1});

    login needs both username and password.

    ~~
    naChoZ

Re: Re: Re: Re: Telnet into Cisco switches
by primus (Scribe) on Jul 11, 2003 at 16:19 UTC
    nachoz, i tried
    $session->login(undef,'password');
    because there is no username for the login, just a password, but that did not work. and the router has a prompt
    router> router# router$
    so is that okay?

      Sometime after I wrote my script, my boss in his infinite wisdom decided to hack the sh*t out of my code and render it unreconizable and unreadable. Otherwise I would have posted sniglets of it here.

      Here is what I remember of what I did when I wrote my login routine:

      • First off I did not use the login method supplied by Net::Telnet or Net::Telnet::Cisco.
      • Instead I used the print -- waitfor combination and decided what to do next based on ($match,$prematch)
      • Since there are multiple passwords in our environmet for the network elemenets on our network. To get around that issue I used my own form of try<->catch type of logic.


      Peter L. BergholdBrewer of Belgian Ales
      Peter@Berghold.Netwww.berghold.net
      Unix Professional