Home Installation Documentation Screenshots Analyser
Best practice Configuration Visualization Router Update FAQ Topology


Documentation



Topology files

The discovered topology is stored in XML files. Previous versions of OSPFviz (0.5 and below) used Perl's Data::Dumper format which is not covered here.
The file is structured hierarchical: first level contains all devices addressed by its OSPF router ID. Second level is the neighbor router addressed by the neighbors interface IP. Third level contains attribute/value pairs containing the OSPF settings of the device (metric, area ID, etc).
212.7.9.15 --> 212.7.8.1 --> ifDescr = FastEthernet2/1
localIP = 212.7.8.2
netmask = 255.255.255.252
AreaId = 15
212.119.3.5 --> ifDescr = ATM2/8
localIP = 212.119.3.6
netmask = 255.255.255.252
AreaId = 92
212.7.9.15 --> ifDescr = Loopback0
localIP = 212.7.9.15
netmask = 255.255.255.255
AreaId = 0
sysName = tbr1-cl1.sffca.ip.att.net/td>



External access

With the following subroutines you can access to topology files from another software by using predefined functions. All provided subroutines require the name of the topology file and at least one argument for the query. To use the latest topology file in a given directory use the asterisk (*) as file name. The main result is a reference to a hash containing all resulting attributes.
To use the given functions you must include the OSPFviz module in your Perl script:
use ospfviz;
Refer to the sample code in the example directory of the OSPFviz distribution.

GetAttrByIfDescr ()

sub GetAttrByIfDescr (topology file, OspfRouterId, interface)
Subroutine that searches the topology file for a given interface name/description (e.g. FastEthernet3/1) on a specific device, e.g.
%attr = %{ GetAttrByIfDescr ('my-topo-file.xml', '17.9.3.251', 'FastEthernet3/1') };
printf ("%s\n", $attr{netmask});
This would print the netmask 255.255.255.0.

GetAttrByIpAddr ()

sub GetAttrByIpAddr (topology file, ip address)
This subroutine searches the topology file for a given IP address. Return value is a hash reference and the OspfRouterId that owns the IP, e.g.
($attr, $id) = GetAttrByIpAddr ('my-topo-file.xml', '17.9.0.144');
%attr = %$attr;
printf ("%s on %s\n", $attr{ifDescr}, $id);
This would print the interface name and the OSPF router ID: GigabitEthernet0/3 on 17.9.3.112.

GetAttrByValue ()

sub GetAttrByValue (topology file, OspfRouterId, leaf name, search pattern)
With this subroutine you can build universal queries, searching the topology for any defined attribute. It's a little complicated so try to use any of the other subs unless your query is not covered by them.
leaf name is the name of the attribute (e.g. ospfRouterId) and search pattern is the value of the leaf that you want to find. In case you search for something very common (interface name Ethernet0) please keep in mind that only the first occurence is returned.
GetAttrByValue ('myfile.xml', '12.122.10.6', 'ospfRouterId', '12.122.10.6');
printf ("%s\n", $attr{sysName});
This would print the system name: tbr1-cl1.sffca.ip.att.net.