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.
RequiredPrompts
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.
# 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.
# 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".
# example only!
prompt generic
match /> ?$/
DesirablePromptandMacros
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!
# 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.
# 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
perl v5.36.0 2023-10-28 Net::CLI::Inter...ual::Phrasebook(3pm)