File: Phrasebook.pod

package info (click to toggle)
libnet-cli-interact-perl 2.142720-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 420 kB
  • ctags: 127
  • sloc: perl: 1,907; makefile: 2
file content (242 lines) | stat: -rw-r--r-- 7,280 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
=head1 NAME

Net::CLI::Interact::Manual::Phrasebook - List of Supported CLIs

=head1 INTRODUCTION

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 L<Net::CLI::Interact::Phrasebook>.

For each supported CLI, there is a name which must be passed in the
C<personality> option to L<Net::CLI::Interact>'s C<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
L<Tutorial|Net::CLI::Interact::Manual::Tutorial> and
L<Cookbook|Net::CLI::Interact::Manual::Cookbook>.

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)

=head1 PERSONALITIES

=head2 Bash

This personality goes by the name of C<bash>.

Prompts are C<prompt>, C<privileged>, C<user> and C<pass>. The C<pass>
prompt works either for an initial SSH connection, or a C<sudo> request.

Macros are C<begin_privileged>, C<end_privileged>, and C<disconnect>. The
C<begin_privileged> macro issues a C<sudo> request to become the root user.

=head2 Cisco

This personality goes by the name of C<cisco> and provides a basis for many
other CLI dictionaries.

Prompts are C<basic>, C<privileged>, C<configure>, C<user>, and C<pass>.

Macros are C<begin_privileged>, C<end_privileged>, C<begin_configure>,
C<end_configure>, and C<disconnect>.

=head2 CatOS

This personality goes by the name of C<catos> and inherits from the C<cisco>
dictionary.

Additionally it provides the C<privileged> Prompt.

Additionally it also provides the C<paging> Macro to set the terminal page
size.

=head2 ExtremeOS

This personality goes by the name of C<extremeos> and inherits from the
C<cisco> dictionary.

Additional Prompts are C<basic>, C<privileged>, C<configure>, C<user>, and
C<pass>.

Additional Macros are C<begin_privileged>, C<end_privileged>, and
C<disconnect>.

=head2 Foundry / Brocade

This personality goes by the name of C<foundry> and inherits from the C<cisco>
dictionary. Before connecting to the device you probably want to set the
output separator to be:

 $nci->transport->ors("\r\n");

For users of L<Net::Appliance::Session> this should be:

 $session_obj->nci->transport->ors("\r\n");

=head2 IOS

This personality goes by the name of C<ios> and inherits from the C<cisco>
dictionary.

Additionally it provides the C<paging> Macro to set the terminal page size.

=head2 HP

This personality goes by the name of C<hp> and inherits from the C<cisco>
dictionary.

Additionally it provides the C<basic> and C<user> Prompts.

Additionally it provides C<enable_paging> and C<disable_paging> Macros.

=head2 JunOS

This personality goes by the name of C<junos> and inherits from the C<cisco>
dictionary.

Additionally it provides the C<privileged>, C<configure>, and C<user> Prompts.

Additionally it also provides the C<begin_configure> and C<paging> Macros.

=head2 Nortel

This personality goes by the name of C<nortel> and inherits from the C<cisco>
dictionary.

Additionally it provides the C<user> Prompt.

=head2 PIXOS

This personality goes by the name of C<pixos> and inherits from the C<cisco>
dictionary.

Additionally it provides the C<paging> Macro to set the terminal page size.

It can be used in its own right for Cisco PIX firewalls, but is
also used as a base for other dictionaries.

=head2 PIXOS 7

This personality goes by the name of C<pixos7> and inherits from the C<pixos>
dictionary.

Additionally it provides the C<paging> Macro to set the terminal page size.

=head2 FWSM

This personality goes by the name of C<fwsm> and inherits from the C<pixos>
dictionary.

It provides no further functionality, as Cisco FWSM software version 1 and 2
was the same as the PIX OS.

=head2 FWSM 3

This personality goes by the name of C<fwsm3> and inherits from the C<pixos>
dictionary.

Additionally it provides the C<paging> Macro to set the terminal page size.

=head1 SUPPORTING A NEW DEVICE

In order to support a new device, particularly for the L<Net::Appliance::Session>
module, there is a basic set of prompts and macros you must create.

=head2 Required Prompts

With SSH, no C<user> prompt is required, but for other transports you should
include a prompt named C<user> which matches the "C<Username:>" prompt
presented by the device.

 # example only!
 prompt user
     match /[Uu]sername/

With all transports you must provide a C<pass> prompt which matches the
"C<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 C<generic>.

 # example only!
 prompt generic
     match /> ?$/

=head2 Desirable Prompt and Macros

To cleanly disconnect from your device session, you might want to include a
macro named C<disconnect> with the relevant command. Note there is no need for
a C<match> statement in this macro, as the device should have detached!

 # example only!
 macro disconnect
     send exit

For paging support, include either only a C<prompt> macro, or two macros named
C<enable_paging> and C<disable_paging>, depending on what the device requires.
In all cases, there must be one substitution ("C<%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 C<privileged>
first, and then include macros named C<begin_privileged> and C<end_privileged>
to enter and leave the mode, respectively. Note that both macros will require
explicit match statements, because the prompt encountered I<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 C<configure> first, and
then include macros named C<begin_configure> and C<end_configure> to enter and
leave the mode, respectively. Note that both macros will require explicit
match statements, because the prompt encountered I<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

=cut