Cisco::ShowIPRoute::Parser - parse Cisco 'show ip route' command
use Cisco::ShowIPRoute::Parser; # Router.log holds the output from 'show ip route' my $log = 'Router.log'; my $r = new Cisco::ShowIPRoute::Parser($log); my $dest = '10.159.25.44'; my @routes = $r->getroutes($dest); print "@routes\n";
This File contains the encapsulation of Raj's route parser. It will parse the output from a Cisco 'show ip route' command and return all the routes to a specified IP address.
When collecting the routes please ensure it is in decimal format. This can be enabled by doing the following at the router prompt:
term len 0 terminal ip netmask-format decimal show ip route
the log file as a string
Handle to our object.
Define some initial states and open the log file that is to be used when parsing routes
the IP address to get the routes for as a string
An array of IP addresses, or "directly connected..." messages.
Or a null list if no routes found
We call ipRouteCheck() and routeIterate() to find all the routes. This is the main interface. You shouldn't need any other methods.
It is highly possible there are bugs. But we don't think so. We have tested this over 4000 routers and pulled routes across this network often. Whenever we think the code is wrong we invariably find we have a network routing problems.
Mark Pfeiffer <markpf@mlp-consulting.com.au>
Rajiv Santiago <batrax@hotmail.com>
Copyright (c) 2003 Rajiv Santiago and Mark Pfeiffer. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
Cisco is a registered trade mark of Cisco Systems, Inc.
This code is in no way associated with Cisco Systems, Inc.
All other trademarks mentioned in this document are the property of their respective owners.
We make no warranties, implied or otherwise, about the suitability of this software. We shall not in any case be liable for special, incidental, consequential, indirect or other similar damages arising from the transfer, storage, or use of this code.
This code is offered in good faith and in the hope that it may be of use.
1 POD Error
The following errors were encountered while parsing the POD:
Unknown directive: =head
To install Cisco::ShowIPRoute::Parser, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Cisco::ShowIPRoute::Parser
CPAN shell
perl -MCPAN -e shell install Cisco::ShowIPRoute::Parser
For more information on module installation, please visit the detailed CPAN module installation guide.