NAME
Device::Cisco::NXAPI::Test - Run a suite of tests on switches that support NXAPI.
VERSION
Version 0.02
SYNOPSIS
This module contains a set of methods that run tests against an NXAPI compatible switch. The functions take arguments and return 1 or 0 depending on the current runtime state of the switch.
These methods should be used in conjunction with the ok() function provided by Test::More.
use Device::Cisco::NXAPI;
use Test::More;
# The Device::Cisco::NXAPI module provides a method that returns a Device::Cisco::NXAPI::Test object.
my $tests = Device::Cisco::NXAPI->new(uri => 'http://hostname', username => 'admin', password => 'admin')->tester();
# Test whether interfaces are up
ok( $tests->interfaces_up(interfaces => ['Ethernet1/1', 'Ethernet1/2']), "Interfaces are up" );
# Test for the presence of routes
ok( $tests->routes(routes => ['192.168.1.0/24', '10.0.0.0/8']), 'Routes in routing table' );
SUBROUTINES
routes(%options)
ok(
$tests->routes(
vrf => '',
af => 'ipv4' | 'ipv6',
routes => [],
)
);
Returns 1 is all of the routes specified in the ARRAYREF are present in the routing table. Returns 0 if any of the routes are not int the routing table.
vrf => defaults to the global routing table if not specified, af => defaults to 'ipv4'.
arp_entries(%options)
ok(
$tests->arp_entries(
vrf => '',
ips => [ ]
)
);
Returns 1 if all of the IPs specified by ips => have valid entries in the ARP table of the specified VRF, otherwise returns 0. vrf => defaults to the global routing table if not specified.
interfaces_up(%options)
ok(
$tests->interfaces_up(
interfaces => [ ]
)
);
Returns 1 if all of the interfaces specified are in the 'up' operational state, otherwise returns 0. Interfaces must be written exactly as they would appear in the CLI, and are case sensitive. e.g. [ 'Ethernet1/4', 'mgmt0' ]
bgp_peers_up(%options)
ok(
$tests->bgp_peers_up(
vrf => '',
af => 'ipv4 | ipv6',
peers => [ ]
)
);
Returns 1 if all of the peers specified are in the 'up' operational state, otherwise returns 0. BGP peers are specified by upon their IP address.
vrf => defaults to the global routing table if not specified, af => defaults to 'ipv4'.
bgp_rib_prefixes(%options)
ok(
$tests->bgp_rib_prefixes(
vrf => '',
af => 'ipv4 | ipv6',
prefixes => [ ]
)
);
Searches for the prefixes within the BGP RIB. All of the prefixes must be present in the RIB for the function to return 'true', otherwise the function returns false.
vrf => defaults to the global routing table if not specified, af => defaults to 'ipv4'.
AUTHOR
Greg Foletta, <greg at foletta.org>
BUGS
Please report any bugs or feature requests to bug-switch-nxapi at rt.cpan.org
, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Switch-NXAPI. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.
SUPPORT
You can find documentation for this module with the perldoc command.
perldoc Device::Cisco::NXAPI
You can also look for information at:
RT: CPAN's request tracker (report bugs here)
AnnoCPAN: Annotated CPAN documentation
CPAN Ratings
Search CPAN
ACKNOWLEDGEMENTS
LICENSE AND COPYRIGHT
Copyright 2016 Greg Foletta.
This program is free software; you can redistribute it and/or modify it under the terms of the the Artistic License (2.0). You may obtain a copy of the full license at:
http://www.perlfoundation.org/artistic_license_2_0
Any use, modification, and distribution of the Standard or Modified Versions is governed by this Artistic License. By using, modifying or distributing the Package, you accept this license. Do not use, modify, or distribute the Package, if you do not accept this license.
If your Modified Version has been derived from a Modified Version made by someone other than you, you are nevertheless required to ensure that your Modified Version complies with the requirements of this license.
This license does not grant you the right to use any trademark, service mark, tradename, or logo of the Copyright Holder.
This license includes the non-exclusive, worldwide, free-of-charge patent license to make, have made, use, offer to sell, sell, import and otherwise transfer the Package with respect to any patent claims licensable by the Copyright Holder that are necessarily infringed by the Package. If you institute patent litigation (including a cross-claim or counterclaim) against any party alleging that the Package constitutes direct or contributory patent infringement, then this Artistic License to you shall terminate on the date that such litigation is filed.
Disclaimer of Warranty: THE PACKAGE IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTORS "AS IS' AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES. THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED TO THE EXTENT PERMITTED BY YOUR LOCAL LAW. UNLESS REQUIRED BY LAW, NO COPYRIGHT HOLDER OR CONTRIBUTOR WILL BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING IN ANY WAY OUT OF THE USE OF THE PACKAGE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.