Cisco::SNMP::IP - IP Interface for Cisco Management
use Cisco::SNMP::IP;
The following methods are for IP management. These methods implement the IP-MIB.
IP-MIB
my $cm = Cisco::SNMP::IP->new([OPTIONS]);
Create a new Cisco::SNMP::IP object with OPTIONS as optional parameters. See Cisco::SNMP for options.
my @ipOIDs = $cm->ipOIDs();
Return list of IP MIB object ID names.
my @addrOIDs = $cm->addrOIDs();
Return list of IP address MIB object ID names.
my @routeOIDs = $cm->routeOIDs();
Return list of route MIB object ID names.
my $ips = $cm->ip_info();
Populate a data structure with the IP information for device.
Allows the following accessors to be called.
$ips->ipForwarding();
Return the IP forwarding state of the device.
$ips->ipDefaultTTL();
Return the IP default time to live of the device.
$ips->ipInReceives();
Return the IP in receives of the device.
$ips->ipInHdrErrors();
Return the IP in hardware errors of the device.
$ips->ipInAddrErrors();
Return the IP in address errors of the device.
$ips->ipForwDatagrams();
Return the IP forward datagrams of the device.
$ips->InUnknownProtos();
Return the IP unknown protocols of the device.
$ips->ipInDiscards();
Return the IP in discards of the device.
$ips->ipInDelivers();
Return the IP in delivers of the device.
$ips->ipOutRequests();
Return the IP out requests of the device.
$ips->ipOutDiscards();
Return the IP out discards of the device.
$ips->ipOutNoRoutes();
Return the IP out no routes of the device.
$ips->ipReasmTimeout();
Return the IP reassembly timeout of the device.
$ips->ipReasmReqds();
Return the IP reassembly required of the device.
$ips->ipReasmOKs();
Return the IP reassembly OK of the device.
$ips->ipReasmFails();
Return the IP reassembly fails of the device.
$ips->ipFragOKs();
Return the IP fragments OK of the device.
$ips->ipFragFails();
Return the IP fragment fails of the device.
$ips->ipFragCreates();
Return the IP fragment creates of the device.
$cm->ip_forwardingOn;
Enable IP forwarding (ip routing command).
ip routing
$cm->ip_forwardingOff;
Disable IP forwarding (no ip routing command).
no ip routing
my $addrs = $cm->addr_info();
Populate a data structure with the IP information per interface. If successful, returns a pointer to a hash containing interface IP information.
$addrs->{1}->[0]->{'Addr', 'IfIndex, 'NetMask', ...} [1]->{'Addr', 'IfIndex, 'NetMask', ...} ... ... $addrs->{n}->[0]->{'Addr', 'IfIndex, 'NetMask', ...}
First hash value is the interface ifIndex, next array is the list of current IP information per the interface ifIndex.
$addrs->addrAddr([$if[,$ip]]);
Return the address of the IP on interface $if, IP address index $ip. Defaults to 0.
$addrs->addrIfIndex([$if[,$ip]]);
Return the interface index of the IP on interface $if, IP address index $ip. Defaults to 0.
$addrs->addrNetMask([$if[,$ip]]);
Return the mask of the IP on interface $if, IP address index $ip. Defaults to 0.
$addrs->addrBcastAddr([$if[,$ip]]);
Return the broadcast address of the IP on interface $if, IP address index $ip. Defaults to 0.
$addrs->addrReasmMaxSize([$if[,$ip]]);
Return the reassembly max size of the IP on interface $if, IP address index $ip. Defaults to 0.
my $route = $cm->route_info();
Populate a data structure with the route information for the device. If successful, returns a pointer to a hash containing route information.
$route->[0]->{'Dest', 'IfIndex, 'Metric1', ...} [1]->{'Dest', 'IfIndex, 'Metric1', ...} ... ... $route->[0]->{'Dest', 'IfIndex, 'Metric1', ...}
$route->routeDest($ip);
Return the destination of the route $ip. Defaults to 0.0.0.0.
$route->routeIfIndex($ip);
Return the interface index of the route $ip. Defaults to 0.0.0.0.
$route->routeMetric1($ip);
Return the metric1 value of the route $ip. Defaults to 0.0.0.0.
$route->routeMetric2($ip);
Return the metric2 value of the route $ip. Defaults to 0.0.0.0.
$route->routeMetric3($ip);
Return the metric3 value of the route $ip. Defaults to 0.0.0.0.
$route->routeMetric4($ip);
Return the metric4 value of the route $ip. Defaults to 0.0.0.0.
$route->routeNextHop($ip);
Return the next hop of the route $ip. Defaults to 0.0.0.0.
$route->routeType($ip);
Return the type of the route $ip. Defaults to 0.0.0.0.
$route->routeProto($ip);
Return the protocol of the route $ip. Defaults to 0.0.0.0.
$route->routeAge($ip);
Return the age of the route $ip. Defaults to 0.0.0.0.
$route->routeMask($ip);
Return the mask of the route $ip. Defaults to 0.0.0.0.
$route->routeMetric5($ip);
Return the metric5 value of the route $ip. Defaults to 0.0.0.0.
$route->routeInfo($ip);
Return the info of the route $ip. Defaults to 0.0.0.0.
The following methods can be called on the Cisco::SNMP::IP object directly to access the values directly.
Get IP OIDs.
Set IP OIDs.
Get IP address OIDS where (ip) is the IP address.
Get route OIDS where (ip) is the IP route.
The following are inherited methods. See Cisco::SNMP for more information.
None by default.
This distribution comes with several scripts (installed to the default bin install directory) that not only demonstrate example uses but also provide functional execution.
bin
This software is released under the same terms as Perl itself. If you don't know what that means visit http://perl.com/.
Copyright (C) Michael Vincent 2015
http://www.VinsWorld.com
All rights reserved
To install Cisco::SNMP, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Cisco::SNMP
CPAN shell
perl -MCPAN -e shell install Cisco::SNMP
For more information on module installation, please visit the detailed CPAN module installation guide.