perfSONAR_PS::Client::LS::Remote - A module that provides a client API for an LS
This module aims to offer simple methods for dealing with requests for information, and the related tasks of interacting with backend storage.
use perfSONAR_PS::Client::LS::Remote; my %conf = (); $conf{"SERVICE_ACCESSPOINT"} = "http://someorganization.org:8080/perfSONAR_PS/services/service"; $conf{"SERVICE_NAME"} = "Some Organization's Service MA" $conf{"SERVICE_TYPE"} = "MA" $conf{"SERVICE_DESCRIPTION"} = "Service MA" my $ls = "http://someorganization.org:8080/perfSONAR_PS/services/LS"; my $ls_client = perfSONAR_PS::Client::LS::Remote->new($ls, \%conf, \%ns); # or # $ls_client = perfSONAR_PS::Client::LS::Remote->new; # $ls_client->setURI($ls); # $ls_client->setConf(\%conf); # $ls_client->setNamespaces(\%ns); $ls_client->registerStatic(\@data); $ls_client->sendKeepalive($conf{"SERVICE_ACCESSPOINT"}); $ls_client->sendDeregister($conf{"SERVICE_ACCESSPOINT"}); my $ls2 = "http://otherorganization.org:8080/perfSONAR_PS/services/LS"; my $ls_client2 = perfSONAR_PS::Client::LS::Remote->new($ls2); my %queries = (); $queries{"req1"} = ""; $queries{"req1"} .= "declare namespace nmwg=\"http://ggf.org/ns/nmwg/base/2.0/\";\n"; $queries{"req1"} .= "for \$data in /nmwg:store/nmwg:data\n"; $queries{"req1"} .= " let \$metadata_id := \$data/\@metadataIdRef\n"; $queries{"req1"} .= " where \$data//*:link[\@id=\"link1\"] and \$data//nmwg:eventType[text()=\"http://ggf.org/ns/nmwg/characteristic/link/status/20070809\"]\n"; $queries{"req1"} .= " return /nmwg:store/nmwg:metadata[\@id=\$metadata_id]\n"; $queries{"req2"} = ""; $queries{"req2"} .= "declare namespace nmwg=\"http://ggf.org/ns/nmwg/base/2.0/\";\n"; $queries{"req2"} .= "for \$data in /nmwg:store/nmwg:data\n"; $queries{"req2"} .= " let \$metadata_id := \$data/\@metadataIdRef\n"; $queries{"req2"} .= " where \$data//*:link[\@id=\"link2\"] and \$data//nmwg:eventType[text()=\"http://ggf.org/ns/nmwg/characteristic/link/status/20070809\"]\n"; $queries{"req2"} .= " return /nmwg:store/nmwg:metadata[\@id=\$metadata_id]\n"; my ($status, $res) = $ls_client2->query(\%queries); if ($status != 0 or not defined $res{"req1"} or not defined $res{"req2"}) { print "Error: querying $ls2 failed\n"; exit(-1); } my ($query_status, $query_res); ($query_status, $query_res) = $res{"req1"}; if ($query_status != 0) { print "Couldn't get information on query req1: ".$query_res."\n"; exit(-1); } else { print "Results for res1: ".$query_res->toString()."\n"; } ($query_status, $query_res) = $res{"req2"}; if ($query_status != 0) { print "Couldn't get information on query req2: ".$query_res."\n"; exit(-1); } else { print "Results for res1: ".$query_res->toString()."\n"; }
The offered API is simple, but offers the key functions we need in a measurement archive.
The parameters are the URI of the Lookup Service, a %conf describing the service for registration purposes.
The %conf can have 4 keys in it:
SERVICE_NAME - The name of the service registering data SERVICE_ACCESSPOINT - The URL for the service registering data SERVICE_TYPE - The type (MA, LS, etc) of the service registering data SERVICE_DESCRIPTION - A description of the service registering data
Log::Log4perl, perfSONAR_PS::Common, perfSONAR_PS::Transport, perfSONAR_PS::Messages, perfSONAR_PS::Client::Echo
To join the 'perfSONAR-PS' mailing list, please visit:
https://mail.internet2.edu/wws/info/i2-perfsonar
The perfSONAR-PS subversion repository is located at:
https://svn.internet2.edu/svn/perfSONAR-PS
Questions and comments can be directed to the author, or the mailing list. Bugs, feature requests, and improvements can be directed here:
https://bugs.internet2.edu/jira/browse/PSPS
$Id$
Aaron Brown, aaron@internet2.edu Jason Zurawski, zurawski@internet2.edu
You should have received a copy of the Internet2 Intellectual Property Framework along with this software. If not, see <http://www.internet2.edu/membership/ip.html>
Copyright (c) 2004-2008, Internet2 and the University of Delaware
All rights reserved.
To install perfSONAR_PS::Client::LS::Remote, copy and paste the appropriate command in to your terminal.
cpanm
cpanm perfSONAR_PS::Client::LS::Remote
CPAN shell
perl -MCPAN -e shell install perfSONAR_PS::Client::LS::Remote
For more information on module installation, please visit the detailed CPAN module installation guide.