Background
This page details the creation of the new sites.txt
format. The {{sites.txt} file is a list of sites for each pinger site to ping. The main problems of the current set up is that it is a purely text based file which is prone to error. It is also currently generated by hand, which makes things laborious and error prone.
This page details information in the creation of this new file.
Database
A new database to replace the existing NODEDETAILS
database was created and the information detailed SOMEWHERE.
PerfSONAR compatibility
The schema follows closely with the new perfsonar topology schema and has been extended to allow support for specific PingER related tags, mostly associated with the serviceInterface
and tulip
data.
Code
The new XML file sites.xml
can be generated from the above database using the script:
[ytl@pinger:~/Work/svn/pinger/trunk/bin]$ perl create_sites-xml.pl --help Creates the sites.xml PingER configuration from a databaseUsage: create_sites-xml.pl [options] Options: --template=s template file to use for xml creation --host=s hostname of database location --port=s port number for database --db=s database name --user=s username for database --password=s password for database --help this help message
You can change the details of how and what to communicate to in order to create the xml file.
Running the program will generate the XML file to STDOUT.
Template
The script uses a template library in order to make the changing of xml schema easy(er). The template is detailed below.
<pinger:topology xmlns:nmtl2="http://ogf.org/schema/network/topology/l2/20070707/" xmlns:nmtl3="http://ogf.org/schema/network/topology/l3/20070707/" xmlns:nmtl4="http://ogf.org/schema/network/topology/l4/20070707/" xmlns:nmtb="http://ogf.org/schema/network/topology/base/20070707/"> xmlns:pinger="http://namespaces.slac.stanford.edu/schema/pinger/20071120"> [% FOREACH domain = domains %] <nmtb:domain id="urn:ogf:network:domain=[% domain.name %]"> [% FOREACH node = domain.nodes %] <nmtb:node id="urn:ogf:network:domain=[% node.domain %]:node=[% node.id %]"> <nmtb:name type="string">[% node.name %]</nmtb:name> <nmtb:hostName>[% node.hostName %]</nmtb:hostName> <nmtb:description>[% node.description %]</nmtb:description> [% FOREACH serviceInterface = node.serviceInterface %] <pinger:serviceInterface type="[% serviceInterface.type %]"> [% IF serviceInterface.planetLabScript %]<pinger:planetLabScript>[% serviceInterface.planetLabScript %]</pinger:planetLabScript>[% END %] [% IF serviceInterface.pingURL %]<pinger:pingURL>[% serviceInterface.pingURL %]</pinger:pingURL>[% END %] [% IF serviceInterface.tracerouteURL %]<pinger:tracerouteURL>[% serviceInterface.tracerouteURL %]</pinger:tracerouteURL>[% END %] </pinger:serviceInterface> [% END %] [% IF node.tier %]<pinger:tier>[% node.tier %]</pinger:tier>[% END %] [% IF node.scalingFactor %]<pinger:scalingFactor>[% node.scalingFactor %]</pinger:scalingFactor>[% END %] [% IF node.comments %]<nmtb:comments>[% node.comments %]</nmtb:comments>[% END %] [% FOREACH contact = node.contact %] <nmtb:contact priority="[% contact.priority %]"> [% IF contact.administrator %]<nmtb:administrator>[% contact.administrator %]</nmtb:administrator>[% END %] [% IF contact.email %]<nmtb:email>[% contact.email %]</nmtb:email>[% END %] [% IF contact.phoneNumber %]<nmtb:phoneNumber>[% contact.phoneNumber %]</nmtb:phoneNumber>[% END %] [% IF contact.institution %]<nmtb:institution>[% contact.institution %]</nmtb:institution>[% END %] </nmtb:contact> [% END %] <nmtb:location> [% IF node.location.institution %]<nmtb:institution>[% node.location.institution %]</nmtb:institution>[% END %] [% IF node.location.country %]<nmtb:country>[% node.location.country %]</nmtb:country>[% END %] [% IF node.location.zipcode %]<nmtb:zipcode>[% node.location.zipcode %]</nmtb:zipcode>[% END %] [% IF node.location.state %]<nmtb:state>[% node.location.state %]</nmtb:state>[% END %] [% IF node.location.city %]<nmtb:city>[% node.location.city %]</nmtb:city>[% END %] [% IF node.location.streetAddress %]<nmtb:streetAddress>[% node.location.streetAddress %]</nmtb:streetAddress>[% END %] [% IF node.location.floor %]<nmtb:floor>[% node.location.floor %]</nmtb:floor>[% END %] [% IF node.location.room %]<nmtb:room>[% node.location.room %]</nmtb:room>[% END %] [% IF node.location.cage %]<nmtb:cage>[% node.location.cage %]</nmtb:cage>[% END %] [% IF node.location.rack %]<nmtb:rack>[% node.location.rack %]</nmtb:rack>[% END %] [% IF node.location.shelf %]<nmtb:shelf>[% node.location.shelf %]</nmtb:shelf>[% END %] [% IF node.location.longitude %]<nmtb:longitude>[% node.location.longitude %]</nmtb:longitude>[% END %] [% IF node.location.latitude %]<nmtb:latitude>[% node.location.latitude %]</nmtb:latitude>[% END %] </nmtb:location> [% FOREACH port = node.ports %] <nmtl3:port id="urn:ogf:network:domain=[% node.domain %]:node=[% node.id %]:port=[% node.port.ipAddress %]"> <nmtl3:ipAddress type="IPv4">[% node.port.ipAddress %]</nmtl3:ipAddress> </nmtl3:port> [% END %] </nmtb:node> [% END %] </nmtb:domain> [% END %] </pinger:topology>