[Contents] [Prev] [Next] [Index] [Report an Error]

Establishing the Connection

After obtaining values for the parameters required for the JUNOS::Device object (see Obtaining and Recording Parameters Required by the JUNOS::Device Object), each sample script records them in the %deviceinfo hash:

     my %deviceinfo = (
         access => $access,
         login => $login,
         password => $password,
         hostname => $hostname,
     );

The script then invokes the JUNOScript-specific new subroutine to create a JUNOS::Device object and establish a connection to the specified routing platform. If the connection attempt fails (as tested by the ref operator), the script exits.

     my $jnx = new JUNOS::Device(%deviceinfo);
     unless ( ref $jnx ) {
         die "ERROR: $deviceinfo{hostname}: failed to connect.\n";

[Contents] [Prev] [Next] [Index] [Report an Error]