1NAS(1) User Contributed Perl Documentation NAS(1)
2
3
4
6 nas - Create Reusable Session Scripts
7
9 $ nas --help
10
11 nas [options] [hostname or IP]
12
13 -p, --personality Device <personality> (default: "ios")
14 -t, --transport <transport> method (Serial, Telnet, default: SSH)
15 -u, --username <username> to connect as on device (default: $USER)
16
17 -R, --record Record session
18 -P, --playback Play back session
19 -s, --script When recording, save playback script to this <filename>
20 -l, --cmdlog NAS <file> to record commands to, or play them back from
21
22 -e, --exit-last Num. of output lines from last command is program exit status
23 -c, --cloginrc RANCID cloginrc <file> with device credentials
24 -z, --nopassword Do not ask for device password (if not using cloginrc)
25 -o, --echo Echo commands sent, when playing back the recorded script/cmdlog
26 -M, --paging Do not attempt to disable command output paging
27 -B, --nobanner Suppress display of any login banner received from the device
28
29 -q, --quiet Hide informational messages
30 -v, --verbose NCI log <level> ("debug", "notice", "info", etc)
31 -V, --version Display this program's version number
32 -h, --help Display this help text
33
35 Use this program to help write reusable Net::Appliance::Session
36 scripts, play them back, and also to more easily connect to network
37 devices.
38
39 · Start a connection to a network device using CLI switches, and
40 prompts for credentials. This is easier than writing short Perl
41 programs.
42
43 · Record a set of commands issued to one network device into a
44 command log, then replay that log against other devices ("-R -l
45 <log>" and "-P -l <log>").
46
47 · Record a session and produce a Perl script which when run, replays
48 the session to the same host, or overridable to other devices ("-R
49 -s <script>" and then run the script).
50
51 Once connected to the device you can enter any command and it will be
52 run.
53
55 Please see the "SYNOPSIS" section and the command line help for the
56 available options. In the future more documentation will be
57 forthcoming, I promise. Here are some highlights:
58
59 The "exit-last" option can be useful for creating a session script
60 which checks for some error condition. Assuming the last command should
61 have no output on success, then the exit status of the script will be
62 non-zero when there's a problem. Use this with "-R" to make a reuseable
63 script.
64
65 To play a script with no output other than that returned from the
66 device in response to sent commands, use the switch combination
67 "-Bqoz". Note that you will need to be able to login automatically, and
68 RANCID config isn't yet supported.
69
70 If you don't provide a hostname or IP then the script goes into a loop
71 waiting for the hostname on standard input. This way, you can pipe a
72 list of device names to the script and it will execute the commands on
73 each one.
74
75 In case you didn't know, the library has support for connecting to
76 linux boxes using the "-p bash" setting to chose the Bash shell
77 personality.
78
79 Getting to be a super-user is a little clunky at the moment. I need to
80 work on that a little more. Take care that your scripts don't contain
81 any passwords!
82
84 The methods of Net::Appliance::Session are available by using the
85 command "!s <method-name>". The best use of this is to gracefully
86 disconnect, by issuing:
87
88 !s close
89
90 You can also enter the command "!m" to see a list of available Macros.
91 If you don't know what a Macro is, please move a long, there's nothing
92 to see here. You run a Macro with the "!m <macro-name> [params]"
93 command.
94
96 · https://github.com/aol/trigger
97
98 · http://www.shrubbery.net/rancid/
99
101 Oliver Gorwits <oliver@cpan.org>
102
104 This software is copyright (c) 2017 by Oliver Gorwits.
105
106 This is free software; you can redistribute it and/or modify it under
107 the same terms as the Perl 5 programming language system itself.
108
109
110
111perl v5.28.1 2019-02-02 NAS(1)