Net-Appliance-Session - Login Method

Posted on Wed Aug 27 10:45:27 2008 by raimundh
Login Method
Hi, me again ;)

How easy would it be to implement a login method (similar again to Net::Telnet::Cisco) for the following type of scenario:

We are an ISP, auditing both configs on our PE routers and on the appropriate CE routers that are connected.

During the course of the script, if certain conditions are true, we connect (from the PE router) to the CE router. In this way, we reuse the session object that we created to connect to the PE. (this is because we can't necessarily reach the CE router from our management station).

Net::Appliance::Session handles both the connection and the login in the one method, connect. using the above example, with NTC we could do something like the following:

$session = new Net::Telnet::Cisco(...); #init the object with various variables. $session->login(Name => $peUser, Password => $pePass); #login to the PE router $session->cmd("show ip interface Serial1/0:0"); #run commands on PE router $session->cmd("show interface Serial1/0:0"); #run commands on PE router $session->print("telnet ".$ceIP." /vrf ".$vrf); #run telnet on PE -> CE $session->login(Name => $ceUser, Password => $cePass); #login on CE $session->cmd("show interface Serial0/1/0"); #run command on CE router

I'm not sure if a login method would be used very often with NAS, as the connect method generally handles all it needs to, but it would be handy.

Thanks
Raimund

Direct Responses: 8719 | Write a response