LSClient

From GEANT2-JRA1 Wiki

Contents

LS client

LS client is a Python script that enables easy LS registration, deregistration and lookup from applications, that do not need to construct and parse XML messages.

Installation

Requirements:

  • Python 2.3 or better (developed on 2.3.5)
  • Python XML extensions (known as python-xml in Debian)
  • Python SOAP interface (known as python-soappy in Debian)
  • NMWGpy and SONARpy packages

When the above required packages are available, no additional installation is needed.

Running LS client

The following command shows usage instructions. Read them, they also include examples!

perfsonar_ls_client.py -h

More examples follow.

Example - registration of service without data

This can be used for a service such as tbwMP, which does not include data (e.g., monitored interfaces).

 perfsonar_ls_client.py \
   http://selena.acad.bg:8070/axis/services/LookupService register \
   servicetype=tbwMP servicename='CESNET tbwMP 1' servicedescription='CESNET tbwMP 1' \
   accesspoint='http://perfmon1.cesnet.cz:8090' 
 LS-Result-Code: result.success
 LS-Result-Description: Data has been registered with key 
   http://perfmon1.cesnet.cz:8090
 LS-Registration-Key: 
   http://perfmon1.cesnet.cz:8090

Example - registration of service with data

This can be used for a service such as RRD MA, which includes data (e.g., monitored interfaces). RRD MA configuration file is passed as filedata argument. Optional filedataxpath argument selects only a subset of interfaces monitored by RRD MA to be registered with LS.

 perfsonar_ls_client.py \
   http://selena.acad.bg:8070/axis/services/LookupService register \
   servicetype=MA servicename='CESNET Java MA' servicedescription='This is CESNET Java RRD MA' \
   accesspoint='http://perfmonc.cesnet.cz:8080/axis/services/MeasurementArchiveService' \
   filedata='/usr/local/perfSONAR-1.0/conf/rrd-database_CESNET.xml' \
   filedataxpath='/nmwg:store/nmwg:metadata[@id="meta126"] | \
     /nmwg:store/nmwg:metadata[@id="meta127"]'
 LS-Result-Code: result.success
 LS-Result-Description: Data has been registered with key
   http://perfmonc.cesnet.cz:8080/axis/services/MeasurementArchiveService
 LS-Registration-Key:
   http://perfmonc.cesnet.cz:8080/axis/services/MeasurementArchiveService

Example - deregistration

The key obtained from registration is passed as key argument.

 perfsonar_ls_client.py \
   http://selena.acad.bg:8070/axis/services/LookupService deregister \
   key='http://perfmon1.cesnet.cz:8090'
 LS-Result-Code: result.success
 LS-Result-Description: Removed [2] metadata and [1] data blocks for key  http://perfmon1.cesnet.cz:8090

Example - lookup of service without data, result in plain format

Plain text output of LS lookup can be easily parsed by grep and other command-line utilities.

perfsonar_ls_client.py \
   http://selena.acad.bg:8070/axis/services/LookupService query \
   outfmt=flat \
   selectxpath='/nmwg:store/nmwg:metadata[@id="http://perfmon1.cesnet.cz:8090"]'
metadata(id="http://perfmon1.cesnet.cz:8090")/parameters(id="control-parameters")/parameter(name="timestamp")   1172154233441
metadata(id="http://perfmon1.cesnet.cz:8090")/subject(id="subject0")/service(id="localhost.d202414:110e7b7128d:-3abe")/serviceName      CESNET tbwMP 1
metadata(id="http://perfmon1.cesnet.cz:8090")/subject(id="subject0")/service(id="localhost.d202414:110e7b7128d:-3abe")/accessPoint      http://perfmon1.cesnet.cz:8090
metadata(id="http://perfmon1.cesnet.cz:8090")/subject(id="subject0")/service(id="localhost.d202414:110e7b7128d:-3abe")/serviceType      tbwMP
metadata(id="http://perfmon1.cesnet.cz:8090")/subject(id="subject0")/service(id="localhost.d202414:110e7b7128d:-3abe")/serviceDescription       CESNET tbwMP 1

Example - lookup of service with data, result in XML format

 perfsonar_ls_client.py \
   http://selena.acad.bg:8070/axis/services/LookupService query \
   outfmt=xml \
   selectxpath='/nmwg:store/nmwg:metadata[@id="http://perfmonc.cesnet.cz:8080/axis/services/MeasurementArchiveService"]'       
<?xml version="1.0" ?>
   <selectxpath xmlns:nmwg="http://ggf.org/ns/nmwg/base/2.0/"
      xmlns:perfsonar="http://ggf.org/ns/nmwg/tools/org/perfsonar/1.0/"
      xmlns:psservice="http://ggf.org/ns/nmwg/tools/org/perfsonar/service/1.0/">
<nmwg:metadata
   id="http://perfmonc.cesnet.cz:8080/axis/services/MeasurementArchiveService">
   <nmwg:parameters id="control-parameters">
      <nmwg:parameter name="timestamp">1172153810863</nmwg:parameter>
   </nmwg:parameters>
</nmwg:metadata><nmwg:metadata
   id="http://perfmonc.cesnet.cz:8080/axis/services/MeasurementArchiveService">
<perfsonar:subject id="subject0">
   <psservice:service id="localhost.d202414:110e7b7128d:-3cce">
      <psservice:serviceName>CESNET Java MA</psservice:serviceName>
      <psservice:accessPoint>http://perfmonc.cesnet.cz:8080/axis/services/MeasurementArchiveService</psservice:accessPoint>
      <psservice:serviceType>MA</psservice:serviceType>
      <psservice:serviceDescription>This is CESNET Java RRD MA</psservice:serviceDescription>
   </psservice:service>
</perfsonar:subject>
</nmwg:metadata></selectxpath>

Example - listing all keys registered with LS

This is a very easy way to check what keys are registered with LS.

 perfsonar_ls_client.py \
   http://selena.acad.bg:8070/axis/services/LookupService listkeys
http://gandalf.rrze.uni-erlangen.de:8090/services/MP/OWAMP
http://archive.sonar.net.switch.ch:8180/axis/services/MeasurementArchiveService
http://gandalf.rrze.uni-erlangen.de:50000/services/MP/BWCTL
http://selena.acad.bg:8080/axis/services/MeasurementArchiveService
http://gandalf.rrze.uni-erlangen.de:8090/services/MA/IPPM
http://gandalf.rrze.uni-erlangen.de:8090/services/MP/BWCTL
http://perfmonc.cesnet.cz:8080/axis/services/MeasurementArchiveService
http://gandalf.rrze.uni-erlangen.de:8090/services/MA/RIPE

Download

Perfsonar_ls_client.tgz

The tarball includes just the Python LS client script. For unknown reason, the Media Wiki server permits only certain file suffixes, hence it is wrapped in tgz.

Contact

Developed by Vladimir Macek, CESNET.

Contact macek (-at-) sandbox.cz or ubik (-at-) cesnet.cz

Personal tools