Net::CLI::Interact::Manual::Phrasebook - List of Supported CLIs
The bundled phrasebook includes support for a variety of network device CLIs. Many were contributed by users of the module. If you set up a new CLI dictionary, please consider contributing it back! The phrasebook specification is given in Net::CLI::Interact::Phrasebook.
For each supported CLI, there is a name which must be passed in the personality option to Net::CLI::Interact's new() method. After that, you can call the included Macros, and the module will use the included Prompt to match the current state of the CLI. More information is available in the Tutorial and Cookbook.
personality
new()
Below is a list of all current bundled CLI dictionaries. Each lists its name, the available Prompts, Macros and Continuations, and from which other CLI dictionaries it inherits.
IOS # Cisco IOS CatOS # for older, pre-IOS Cisco devices PIXOS # for PIX OS-based devices PIXOS7 # Slightly different commands from other PIXOS versions FWSM # currently the same as 'PIXOS' FWSM3 # for FWSM Release 3.x devices (slightly different to FWSM 2.x) JunOS # Juniper JUNOS support HP # HP support Nortel # Nortel support ExtremeOS # Extreme Networks support Foundry # Foundry/Brocade device support Bash # GNU Bourne-Again SHell (i.e. most linux systems)
This personality goes by the name of bash.
bash
Prompts are prompt, privileged, user and pass. The pass prompt works either for an initial SSH connection, or a sudo request.
prompt
privileged
user
pass
sudo
Macros are begin_privileged, end_privileged, and disconnect. The begin_privileged macro issues a sudo request to become the root user.
begin_privileged
end_privileged
disconnect
This personality goes by the name of cisco and provides a basis for many other CLI dictionaries.
cisco
Prompts are basic, privileged, configure, user, and pass.
basic
configure
Macros are begin_privileged, end_privileged, begin_configure, end_configure, and disconnect.
begin_configure
end_configure
This personality goes by the name of catos and inherits from the cisco dictionary.
catos
Additionally it provides the privileged Prompt.
Additionally it also provides the paging Macro to set the terminal page size.
paging
This personality goes by the name of extremeos and inherits from the cisco dictionary.
extremeos
Additional Prompts are basic, privileged, configure, user, and pass.
Additional Macros are begin_privileged, end_privileged, and disconnect.
This personality goes by the name of foundry and inherits from the cisco dictionary. Before connecting to the device you probably want to set the output separator to be:
foundry
$nci->transport->ors("\r\n");
For users of Net::Appliance::Session this should be:
$session_obj->nci->transport->ors("\r\n");
This personality goes by the name of ios and inherits from the cisco dictionary.
ios
Additionally it provides the paging Macro to set the terminal page size.
This personality goes by the name of hp and inherits from the cisco dictionary.
hp
Additionally it provides the basic and user Prompts.
Additionally it provides enable_paging and disable_paging Macros.
enable_paging
disable_paging
This personality goes by the name of junos and inherits from the cisco dictionary.
junos
Additionally it provides the privileged, configure, and user Prompts.
Additionally it also provides the begin_configure and paging Macros.
This personality goes by the name of nortel and inherits from the cisco dictionary.
nortel
Additionally it provides the user Prompt.
This personality goes by the name of pixos and inherits from the cisco dictionary.
pixos
It can be used in its own right for Cisco PIX firewalls, but is also used as a base for other dictionaries.
This personality goes by the name of pixos7 and inherits from the pixos dictionary.
pixos7
This personality goes by the name of fwsm and inherits from the pixos dictionary.
fwsm
It provides no further functionality, as Cisco FWSM software version 1 and 2 was the same as the PIX OS.
This personality goes by the name of fwsm3 and inherits from the pixos dictionary.
fwsm3
In order to support a new device, particularly for the Net::Appliance::Session module, there is a basic set of prompts and macros you must create.
With SSH, no user prompt is required, but for other transports you should include a prompt named user which matches the "Username:" prompt presented by the device.
Username:
# example only! prompt user match /[Uu]sername/
With all transports you must provide a pass prompt which matches the "password:" prompt presented by the device.
password:
# example only! prompt pass match /[Pp]assword: ?$/
The last essential prompt is of course a simple command line prompt match, and this should be named generic.
generic
# example only! prompt generic match /> ?$/
To cleanly disconnect from your device session, you might want to include a macro named disconnect with the relevant command. Note there is no need for a match statement in this macro, as the device should have detached!
match
# example only! macro disconnect send exit
For paging support, include either only a prompt macro, or two macros named enable_paging and disable_paging, depending on what the device requires. In all cases, there must be one substitution ("%s") which is where the number of page lines will be inserted into the command.
%s
# example only! macro paging send terminal length %s
For privileged mode (super-user) support, include a prompt named privileged first, and then include macros named begin_privileged and end_privileged to enter and leave the mode, respectively. Note that both macros will require explicit match statements, because the prompt encountered after issuing the command will be different to that encountered before.
# example only! prompt privileged match /# ?$/ macro begin_privileged send enable match user or pass or privileged macro end_privileged send disable match generic
Similarly for configure mode, include a prompt named configure first, and then include macros named begin_configure and end_configure to enter and leave the mode, respectively. Note that both macros will require explicit match statements, because the prompt encountered after issuing the command will be different to that encountered before.
# example only! prompt configure match /\(config[^)]*\)# ?$/ macro begin_configure send configure terminal match configure macro end_configure send exit match privileged
To install Net::CLI::Interact, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Net::CLI::Interact
CPAN shell
perl -MCPAN -e shell install Net::CLI::Interact
For more information on module installation, please visit the detailed CPAN module installation guide.