• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..03-May-2022-

lib/Net/CLI/H19-Apr-2019-4,4722,059

share/phrasebook/H19-Apr-2019-470329

t/H19-Apr-2019-519342

Build.PLH A D19-Apr-20191.1 KiB4846

ChangesH A D19-Apr-20197.2 KiB255146

MANIFESTH A D19-Apr-20192.2 KiB7271

META.jsonH A D19-Apr-20195.1 KiB161160

META.ymlH A D19-Apr-20193.6 KiB110109

README.mdH A D19-Apr-20192 KiB7250

README.md

1### Net::CLI::Interact - Toolkit for CLI Automation ###
2
3Automating command line interface (CLI) interactions is not a new idea, but
4can be tricky to implement. This module aims to provide a simple and
5manageable interface to CLI interactions, supporting:
6
7* SSH, Telnet and Serial-Line connections
8* Unix and Windows support
9* Reuseable device command phrasebooks
10
11If you're a new user, please read the
12[Tutorial](https://metacpan.org/pod/Net::CLI::Interact::Manual::Tutorial).
13There's also a
14[Cookbook](https://metacpan.org/pod/Net::CLI::Interact::Manual::Cookbook)
15and a
16[Phrasebook Listing](https://metacpan.org/pod/Net::CLI::Interact::Manual::Phrasebook).
17
18#### Installation ####
19
20Using cpanm:
21
22    cpanm Net::CLI::Interact
23
24Or manually, from the source:
25
26    perl Makefile.PL
27    make test && make install
28
29#### Example Usage ####
30
31```perl
32    use Net::CLI::Interact;
33
34    my $s = Net::CLI::Interact->new({
35        personality     => 'cisco',
36        transport       => 'Telnet',
37        connect_options => { host => '192.0.2.1' },
38    });
39
40    # respond to a usename/password prompt
41    $s->macro('to_user_exec', {
42        params => ['my_username', 'my_password'],
43    });
44
45    my $interfaces = $s->cmd('show ip interfaces brief');
46
47    $s->macro('to_priv_exec', {
48        params => ['my_password'],
49    });
50    # matched prompt is updated automatically
51
52    # paged output is slurped into one response
53    $s->macro('show_run');
54    my $config = $s->last_response;
55```
56
57For a more complete worked example check out the
58[Net::Appliance::Session](https://metacpan.org/pod/Net::Appliance::Session)
59distribution, for which this module was written.
60
61For more information on the API, please check out
62[Net::CLI::Interact's complete documentation](https://metacpan.org/pod/Net::CLI::Interact)
63on CPAN.
64
65#### Copyright and License
66
67This software is copyright (c) 2014-2015 by Oliver Gorwits.
68
69This is free software; you can redistribute it and/or modify it under
70the same terms as the Perl 5 programming language system itself.
71
72