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 The "exit-last" option can be useful for creating a session script
56 which checks for some error condition. Assuming the last command should
57 have no output on success, then the exit status of the script will be
58 non-zero when there's a problem. Use this with "-R" to make a reuseable
59 script.
60
61 To play a script with no output other than that returned from the
62 device in response to sent commands, use the switch combination
63 "-Bqoz". Note that you will need to be able to login automatically, and
64 RANCID config isn't yet supported.
65
66 If you don't provide a hostname or IP then the script goes into a loop
67 waiting for the hostname on standard input. This way, you can pipe a
68 list of device names to the script and it will execute the commands on
69 each one.
70
71 In case you didn't know, the library has support for connecting to
72 linux boxes using the "-p bash" setting to chose the Bash shell
73 personality.
74
75 Getting to be a super-user is a little clunky at the moment. I need to
76 work on that a little more. Take care that your scripts don't contain
77 any passwords!
78
80 The methods of Net::Appliance::Session are available by using the
81 command "!s <method-name>". The best use of this is to gracefully
82 disconnect, by issuing:
83
84 !s close
85
86 You can also enter the command "!m" to see a list of available Macros.
87 If you don't know what a Macro is, please move a long, there's nothing
88 to see here. You run a Macro with the "!m <macro-name> [params]"
89 command.
90
92 • https://github.com/aol/trigger
93
94 • http://www.shrubbery.net/rancid/
95
97 Oliver Gorwits <oliver@cpan.org>
98
100 This software is copyright (c) 2019 by Oliver Gorwits.
101
102 This is free software; you can redistribute it and/or modify it under
103 the same terms as the Perl 5 programming language system itself.
104
105
106
107perl v5.36.0 2023-01-20 NAS(1)