Device-Cisco-NXAPI

 view release on metacpan or  search on metacpan

lib/Device/Cisco/NXAPI.pm  view on Meta::CPAN

package Device::Cisco::NXAPI;

use 5.020;
use strict;
use warnings;

use Moose;
use Modern::Perl;
use LWP::UserAgent;
use HTTP::Request;
use Data::Dumper;
use JSON;
use Carp;
use List::MoreUtils qw( natatime );
use Params::Validate qw(:all);
use URI;

use Device::Cisco::NXAPI::Test;


=head1 NAME

Device::Cisco::NXAPI - Interact with the NX-API (Nexus 9K Switches)

=head1 VERSION

Version 0.03

=cut

our $VERSION = '0.03';


=head1 SYNOPSIS

This module provides methods to make API calls and extract information from devices that support the NX-API.
This is predominantly the Nexus 9K range of switches in NXOS mode (not in ACI mode).

    use Device::Cisco::NXAPI;

    my $switch_api = Device::Cisco::NXAPI->new(uri => "https://192.168.1.1:8080", username => "admin", password => "admin");

    my @route_info = $switch_api->routes(vrf => "CustVRF");
    my %version_info = $switch_api->version();

=cut

has 'user_agent'    => ( is => 'rw', isa => 'LWP::UserAgent', default => sub { LWP::UserAgent->new });
has 'http_request'  => ( is => 'rw', isa => 'HTTP::Request');
has 'uri'          => ( is => 'ro', isa => 'Str', required => 1);
has 'username'      => ( is => 'ro', isa => 'Str', required => 1);
has 'password'      => ( is => 'ro', isa => 'Str', required => 1);
has 'debug'         => ( is => 'ro', isa => 'Bool', default => 0);

=head1 CONSTRUCTOR
 
This method constructs a new C<Device::Cisco::NXAPI> object.
 
    my $switch_api = Device::Cisco::NXAPI->new(
                                    # Mandatory parameters:
                                    uri => '',                  # URI of the switch to connect to.
                                    username => '',             # Username to logon to the switch
                                    password => '',             # Password to logon to the switch

                                    # Optional Parameters
                                    debug => (0 | 1),           # Output debugging information to stderr
                                );

 view all matches for this distribution
 view release on metacpan -  search on metacpan

( run in 1.473 second using v1.00-cache-2.02-grep-82fe00e-cpan-f5108d614456 )