Control-CLI-Extreme
view release on metacpan or search on metacpan
lib/Control/CLI/Extreme.pm view on Meta::CPAN
my $CTRL_C = "\cC";
my $CTRL_U = "\cU";
my $CTRL_X = "\cX";
my $CTRL_Y = "\cY";
my $CTRL_Z = "\cZ";
my %LoginPatterns = ( # Patterns to check for during device login (Telnet/Serial) and initial connection to CLI
bell => "\x07",
banner => 'Enter Ctrl-Y to begin',
menu => 'Use arrow keys to highlight option, press <Return> or <Enter> to select option',
submenu => 'Press Ctrl-R to return to previous menu. Press Ctrl-C to return to Main Menu',
username => 'Enter Username: ',
password => "Enter Password: \e[?", # Should match only on the initial password prompt and not subsequent ones where * are printed
lastlogin => 'Failed retries since last login:',
localfail => 'Incorrect',
localfail_xos => 'Login incorrect',
radiusfail => 'Access Denied from RADIUS',
radiustimeout1 => 'no response from RADIUS servers',
radiustimeout2 => 'No reply from RADIUS server',
srbanner => "\((?:Secure Router|VSP4K)",
xlrbanner => "\x0d************************************\n",
lib/Control/CLI/Extreme.pm view on Meta::CPAN
}
# Now handle any pattern matches we had above
if ($pattern eq 'banner' || $pattern eq 'bell') { # We got the banner, send a CTRL-Y to get in
$self->debugMsg(8,"\nlogin() Processing Stackable Banner\n\n");
$self->put(string => $CTRL_Y, errmode => 'return')
or return $self->poll_return($self->error("$pkgsub: Unable to send CTRL-Y sequence // ".$self->errmsg));
next;
}
elsif ($pattern eq 'menu') { # We got the menu, send a 'c' and get into CLI
$self->debugMsg(8,"\nlogin() Processing Stackable Menu\n\n");
$self->put(string => 'c', errmode => 'return')
or return $self->poll_return($self->error("$pkgsub: Unable to select 'Command Line Interface...' // ".$self->errmsg));
next;
}
elsif ($pattern eq 'submenu') { # We are in a sub-menu page, send a 'CTRL_C' to get to main menu page
$self->debugMsg(8,"\nlogin() Processing Stackable Sub-Menu page\n\n");
$self->put(string => $CTRL_C, errmode => 'return')
or return $self->poll_return($self->error("$pkgsub: Unable to go back to main menu page // ".$self->errmsg));
next;
}
elsif ($pattern =~ /^more\d$/) { # We are connecting on the console port, and we are in the midst of more-paged output
$self->debugMsg(8,"\nlogin() Quitting residual more-paged output for serial port access\n");
$self->put(string => 'q', errmode => 'return')
or return $self->poll_return($self->error("$pkgsub: Unable to quit more-paged output found after serial connect // ".$self->errmsg));
next;
}
lib/Control/CLI/Extreme.pm view on Meta::CPAN
[Non_recognized_login => $flag,]
[Generic_login => $flag,]
);
Polling method (only applicable in non-blocking mode):
$ok = $obj->login_poll();
($ok, $output || $outputRef) = $obj->login_poll();
This method handles login authentication for Telnet and Serial port access (also for SSH access in the case of the WLAN2300 WSS controllers, since they use no SSH authentication but instead use an interactive login once the SSH connection is establis...
On success the method returns a true (1) value. On failure the error mode action is performed. See errmode().
In non-blocking mode (blocking disabled) the login() method will most likely immediately return with a false, but defined, value of 0. You will then need to call the login_poll() method at regular intervals until it returns a true (1) value indicatin...
In the first form only a success/failure value is returned in scalar context, while in the second form, in list context, both the success/failure value is returned as well as any output received from the host device during the login sequence; the lat...
This method internally uses the readwait() method and by default sets the read_attemps for it to 10 (which is a safe value to ensure proper connection to any Extreme Networking device); the read_attempts argument provided by login() can be used to ov...
Once a valid Extreme Networking CLI prompt is detected (using pre-configured pattern match strings), this method records the actual CLI prompt of the host device for the remainder of the session by automatically invoking the prompt() method with a ne...
At the same time this method will also set the --more-- prompt used by the device when paging output as well as a number of attributes depending on what family_type was detected for the host device. See attribute().
Note that this method is automatically invoked by the connect() method and therefore should seldom need to be invoked by itself. A possible reason to invoke this method on its own could be if initially connecting to, say, an ERS8800 device and from t...
( run in 2.005 seconds using v1.01-cache-2.11-cpan-49f99fa48dc )