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.

Pre-reqs

All files are located on the PingER svn under the bin directory.

Database

A new database to replace the existing NODEDETAILS database was created and the information detailed SOMEWHERE.

Conversion from sites.txt

One can convert from the sites.txt file and insert the data into the new database using:

cat /afs/slac/www/comp/net/wan-mon/tulip/newsites.txt | perl insert_sites-xml.pl | mysql -u pinger -p -D pinger3

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 create_sites-xml.pl:

51cottrell@pinger:~>bin/create_sites-xml.pl -help
Creates the sites.xml PingER configuration from a database
Usage: bin/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
  --ability=i             whether to get enabled or disabled landmarks
                          default = 1 (1=enabled, 0=disabled)
  --help                  this help message
Purpose:
      Script to create the sites.xml file as per
      http://confluence.slac.stanford.edu/display/IEPM/PingER+Sites+XML
      it will poll a mysql database and write out the xml file from a template.
      all this script does is to construct a useable datastructure to populate
      the template file and spits it out to STDOUT
      Output:
  The xml file of landmarks is written to STDOUT
Examples:
  create_sites-xml.pl > /afs/slac/www/comp/net/wan-mon/tulip/sites.xml
  create_sites-xml.pl --ability 0 > /afs/slac/www/comp/net/wan-mon/tulip/sites-disabled.xml
  create_sites-xml.pl --help
Version=Version 1.1, 12/10/09; Author: Qasim Bilal; Maintainer: Les Cottrell

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.

sites-xml.tt2
<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.tulipTier %]<pinger:tier>[% node.tulipTier %]</pinger:tulipTier>[% END %]
      [% IF node.tulipScalingFactor %]<pinger:tulipScalingFactor>[% node.tulipScalingFactor %]</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>

Example

An example sites.xml file can be found at

http://www.slac.stanford.edu/comp/net/wan-mon/tulip/sites.xml

  • No labels