perfsonar-user - Re: [perfsonar-user] Perfsonar lookup service question
Subject: perfSONAR User Q&A and Other Discussion
List archive
- From: Andrew Lake <>
- To: Weiping Mandrawa <>
- Cc: <>, <>
- Subject: Re: [perfsonar-user] Perfsonar lookup service question
- Date: Mon, 3 May 2010 12:49:03 -0400
Hi Weiping,
The first should work and is what you want. Which gLS did you send the
request to? I sent the exact request to
"http://ps4.es.net:9990/perfSONAR_PS/services/gLS" and it worked.
Andy
On May 3, 2010, at 12:41 PM, Weiping Mandrawa wrote:
> Hi Andy,
>
> I did try as you suggested
>
>
> my $xquery = "declare namespace
> nmwg=\"http://ggf.org/ns/nmwg/base/2.0/\";\n";
> $xquery .=
> "/nmwg:store[\@type=\"LSStore\"]/nmwg:data/nmwg:metadata/summary:parameters/nmwg:parameter[\@name=\"keyword\"]";
>
> my $gLSResult = $glsClient->queryRequestLS(
> {
> query => $xquery,
> format => 1 #want response to be formated as XML
> }
> );
>
> and it return nothing.
>
> I tried to modify a code a little bit
> my $xquery = "declare namespace
> nmwg=\"http://ggf.org/ns/nmwg/base/2.0/\";\n";
> $xquery .= "for \$metadata in
> /nmwg:store[\@type=\"LSStore\"]/nmwg:metadata\n";
> $xquery .= " let \$metadata_id :=
> \$metadata/\@id
> \n";
> $xquery .= " let \$data :=
> /nmwg:store[\@type=\"LSStore\"]/nmwg:data/nmwg:metadata/summary:parameters/nmwg:parameter[\@name=\"keyword\"]\n";
> $xquery .= " return
> \$metadata/perfsonar:subject/psservice:service/psservice:accessPoint";
>
>
> # Send query to the global lookup service
> my $gLSResult = $glsClient->queryRequestLS(
> {
> query => $xquery,
> format => 1 #want response to be formated as XML
> }
> );
>
> and it returns something like this
>
> GLS Response = <psservice:datum
> xmlns:psservice="http://ggf.org/ns/nmwg/tools/org/perfsonar/service/1.0/"><psservice:accessPoint
>
> xmlns:psservice="http://ggf.org/ns/nmwg/tools/org/perfsonar/service/1.0/">http://129.82.183.103:8095/perfSONAR_PS/services/hLS</psservice:accessPoint><psservice:accessPoint
>
> xmlns:psservice="http://ggf.org/ns/nmwg/tools/org/perfsonar/service/1.0/">http://18.12.1.172:8095/perfSONAR_PS/services/hLS</psservice:accessPoint><psservice:accessPoint
>
> xmlns:psservice="http://ggf.org/ns/nmwg/tools/org/perfsonar/service/1.0/">http://ps-bw.es.net:8095/perfSONAR_PS/services/hLS</psservice:accessPoint>
>
>
> and based on result, I can't find any keyword related that have something
> like project:ESnet
>
>
> Thank you
>
>
>>>> Andrew Lake
>>>> <>
>>>> 4/30/2010 3:34 PM >>>
> Hi Weiping,
>
> Send an XQuery like the following to one of the global Lookup Services
> (gLS):
>
> my $xquery = "declare namespace
> nmwg=\"http://ggf.org/ns/nmwg/base/2.0/\";\n";
> $xquery .=
> "/nmwg:store[\@type=\"LSStore\"]/nmwg:data/nmwg:metadata/summary:parameters/nmwg:parameter[\@name=\"keyword\"]";
>
> The "value" attribute in the returned elements will contain the keywords.
> You'll have to sort out the unique ones. A list of global lookup services
> where you can send the above query are listed here:
> http://www.perfsonar.net/gls.root.hints. You only need to send the request
> to one since they should all be synced. A few on the list occasionally have
> problems so you may just want to stick to the es.net and internet2.edu
> services.
>
> Also the checks are case sensitive. This is a feature of xquery. There are
> some ways to make XQuery do a case insensitive search but none of them are
> that straight-forward.
>
> Let me know if you need any clarification on the info above.
>
> Thanks!
> Andy
>
> On Apr 30, 2010, at 2:01 PM, Weiping Mandrawa wrote:
>
>> Andy,
>>
>> Thank you for clarification and quick response.
>>
>> I tested the code and it is working well.
>>
>>
>> I have another question,
>>
>> let say I want to filter my lookup search based on Project name (e.g
>> ESnet) and
>> in the example code (ls-ex3-bwctl.pl)
>>
>> \$keyword=\"project:ESnet\" . Is this case sensitive ?
>> and how do I get list of keyword "project"
>> e.g LBNL, Internet2 etc to be used with lookup service
>>
>>
>> Thank you
>>
>> Kind Regards
>>
>> Weiping
>>
>>
>>
>>
>>
>>
>>
>>>>> Andrew Lake
>>>>> <>
>>>>> 04/30/10 1:28 PM >>>
>> Hi Weiping,
>>
>> The html on the page was causing those lines to be displayed incorrectly.
>> The </ in the regular expression was the source of the problem. I have now
>> corrected the page. The correct code block looks like the following:
>>
>> if( $hLSResult->{response} && $hLSResult->{response} =~ /^<./ ){
>> # Print list of matching bwctl server addresses
>> my $resParser = XML::LibXML->new();
>> my $hLSDoc = $resParser->parse_string($hLSResult->{response});
>>
>> Also, if it helps you may download the code examples on this page here:
>> http://psps.perfsonar.net/ps-client-examples-v1.1.tar.gz. There is also a
>> link to this file on the bottom of the page.
>>
>> Thanks!
>> Andy
>>
>>
>> On Apr 30, 2010, at 1:09 PM, Jason Zurawski wrote:
>>
>>> Hello, I am trying to understand lookup service based on the address
>>>
>>> http://psps.perfsonar.net/client-doc.html
>>>
>>> In the paragraph
>>>
>>> The instance in the above example is the URL of an LS service to contact.
>>> Examples
>>> 1. Find all SNMP Measurement Archives
>>>
>>>
>>> There are examples how to crate XQuery to be sent to home lookup services
>>>
>>> In the example code (XQuery to be sent up to home lookup based on Find
>>> all SNMP Measurement Archieves)
>>>
>>>
>>> (Line1) if($hLSResult->{response} && $hLSResult->{response} =~ /^new();
>>> (Line2) my $hLSDoc =
>>> $resParser->parse_string($hLSResult->{response});
>>>
>>>
>>>
>>> For some reason, perl can't understand (Line1) to (Line2)
>>>
>>> for example
>>>
>>> in Line2 , it is using $resParser but $resParser is not declared anywhere
>>> in the code
>>> and when I run the code, it complains about it
>>>
>>>
>>>
>>> if I change $resParser to $parser, it complains that
>>>
>>> Thread 65 terminated abnormally: Can't call method "parse_string" on
>>> unblessed reference
>>>
>>>
>>> Thank you
>>>
>>
>>
>
- Re: [perfsonar-user] Perfsonar lookup service question, Weiping Mandrawa, 05/03/2010
- Re: [perfsonar-user] Perfsonar lookup service question, Andrew Lake, 05/03/2010
- Another Perfsonar lookup service question, Weiping Mandrawa, 05/19/2010
- Re: [perfsonar-user] Another Perfsonar lookup service question, Jason Zurawski, 05/19/2010
- Another Perfsonar lookup service question, Weiping Mandrawa, 05/19/2010
- Re: [perfsonar-user] Perfsonar lookup service question, Andrew Lake, 05/03/2010
Archive powered by MHonArc 2.6.16.