perfsonar-dev - [pS-dev] [GEANT/SA2/SA2T3-OPPD] r708 - in trunk/lib: . NMWG/examples/2.0 perfSONAR perfSONAR/DataStruct perfSONAR/MP
Subject: perfsonar development work
List archive
[pS-dev] [GEANT/SA2/SA2T3-OPPD] r708 - in trunk/lib: . NMWG/examples/2.0 perfSONAR perfSONAR/DataStruct perfSONAR/MP
Chronological Thread
- From:
- To:
- Subject: [pS-dev] [GEANT/SA2/SA2T3-OPPD] r708 - in trunk/lib: . NMWG/examples/2.0 perfSONAR perfSONAR/DataStruct perfSONAR/MP
- Date: Wed, 11 May 2011 09:06:08 +0100
Author: dfn.calim
Date: 2011-05-11 09:06:08 +0100 (Wed, 11 May 2011)
New Revision: 708
Added:
trunk/lib/NMWG/examples/2.0/Echo-selftest-request.xml
trunk/lib/NMWG/examples/2.0/Echo-selftest-response-bwctl.xml
trunk/lib/NMWG/examples/2.0/Echo-selftest-response-owamp.xml
Modified:
trunk/lib/perfSONAR.pm
trunk/lib/perfSONAR/DataStruct/NMWG.pm
trunk/lib/perfSONAR/Echo.pm
trunk/lib/perfSONAR/MP.pm
trunk/lib/perfSONAR/MP/BWCTL.pm
trunk/lib/perfSONAR/MP/OWAMP.pm
Log:
selftest for MP OWAMP and BWCTL added
Added: trunk/lib/NMWG/examples/2.0/Echo-selftest-request.xml
===================================================================
--- trunk/lib/NMWG/examples/2.0/Echo-selftest-request.xml
(rev 0)
+++ trunk/lib/NMWG/examples/2.0/Echo-selftest-request.xml 2011-05-11
08:06:08 UTC (rev 708)
@@ -0,0 +1,11 @@
+<nmwg:message xmlns:nmwg="http://ggf.org/ns/nmwg/base/2.0/"
+ type="EchoRequest" id="EchoMessage1">
+
+ <nmwg:metadata xmlns:nmwg="http://ggf.org/ns/nmwg/base/2.0/"
id="metadata1">
+
<nmwg:eventType>http://schemas.perfsonar.net/tools/admin/selftest/1.0</nmwg:eventType>
+ </nmwg:metadata>
+
+ <nmwg:data xmlns:nmwg="http://ggf.org/ns/nmwg/base/2.0/"
+ id="data1" metadataIdRef="metadata1" />
+
+</nmwg:message>
Added: trunk/lib/NMWG/examples/2.0/Echo-selftest-response-bwctl.xml
===================================================================
--- trunk/lib/NMWG/examples/2.0/Echo-selftest-response-bwctl.xml
(rev 0)
+++ trunk/lib/NMWG/examples/2.0/Echo-selftest-response-bwctl.xml
2011-05-11 08:06:08 UTC (rev 708)
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+ <nmwg:message id="EchoMessage1" type="EchoResponse"
+ xmlns:nmwg="http://ggf.org/ns/nmwg/base/2.0/"
xmlns:nmwgr="http://ggf.org/ns/nmwg/result/2.0/">
+ <nmwg:metadata id="metadata1">
+
<nmwg:eventType>http://schemas.perfsonar.net/tools/admin/selftest/1.0</nmwg:eventType>
+ </nmwg:metadata>
+
+ <nmwg:data id="data1" metadataIdRef="metadata1"/>
+
+ <nmwg:metadata id="ntpd_running_test">
+
<nmwg:eventType>http://schemas.perfsonar.net/tools/admin/selftest/MP/BWCTL/ntpd_running_test/success/1.0</nmwg:eventType>
+ </nmwg:metadata>
+
+ <nmwg:data id="data_ntpd_running_test" metadataIdRef="ntpd_running_test">
+ <nmwgr:datum>Service ntpd is running.</nmwgr:datum>
+ </nmwg:data>
+
+ <nmwg:metadata id="bwctl_command_test">
+
<nmwg:eventType>http://schemas.perfsonar.net/tools/admin/selftest/MP/BWCTL/bwctl_command_test/success/1.0</nmwg:eventType>
+ </nmwg:metadata>
+
+ <nmwg:data id="data_bwctl_command_test"
metadataIdRef="bwctl_command_test">
+ <nmwgr:datum>Service tool bwctl found and is executable.</nmwgr:datum>
+ </nmwg:data>
+
+ <nmwg:metadata id="bwctld_running_test">
+
<nmwg:eventType>http://schemas.perfsonar.net/tools/admin/selftest/MP/BWCTL/bwctld_running_test/error/1.0</nmwg:eventType>
+ </nmwg:metadata>
+
+ <nmwg:data id="data_bwctld_running_test"
metadataIdRef="bwctld_running_test">
+ <nmwgr:datum>Service bwctld not running! </nmwgr:datum>
+ </nmwg:data>
+
+</nmwg:message>
Added: trunk/lib/NMWG/examples/2.0/Echo-selftest-response-owamp.xml
===================================================================
--- trunk/lib/NMWG/examples/2.0/Echo-selftest-response-owamp.xml
(rev 0)
+++ trunk/lib/NMWG/examples/2.0/Echo-selftest-response-owamp.xml
2011-05-11 08:06:08 UTC (rev 708)
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="UTF-8"?>
+ <nmwg:message id="EchoMessage1" type="EchoResponse"
+ xmlns:nmwg="http://ggf.org/ns/nmwg/base/2.0/"
xmlns:nmwgr="http://ggf.org/ns/nmwg/result/2.0/">
+ <nmwg:metadata id="metadata1">
+
<nmwg:eventType>http://schemas.perfsonar.net/tools/admin/selftest/1.0</nmwg:eventType>
+ </nmwg:metadata>
+
+ <nmwg:data id="data1" metadataIdRef="metadata1"/>
+
+ <nmwg:metadata id="ntpd_running_test">
+
<nmwg:eventType>http://schemas.perfsonar.net/tools/admin/selftest/MP/OWAMP/ntpd_running_test/success/1.0</nmwg:eventType>
+ </nmwg:metadata>
+ <nmwg:data id="data_ntpd_running_test" metadataIdRef="ntpd_running_test">
+ <nmwgr:datum>Service ntpd is running.</nmwgr:datum>
+ </nmwg:data>
+
+ <nmwg:metadata id="owping_command_test">
+
<nmwg:eventType>http://schemas.perfsonar.net/tools/admin/selftest/MP/OWAMP/owping_command_test/success/1.0</nmwg:eventType>
+ </nmwg:metadata>
+
+ <nmwg:data id="data_owping_command_test"
metadataIdRef="owping_command_test">
+ <nmwgr:datum>Service tool owping found and is executable.</nmwgr:datum>
+ </nmwg:data>
+
+ <nmwg:metadata id="owampd_running_test">
+
<nmwg:eventType>http://schemas.perfsonar.net/tools/admin/selftest/MP/OWAMP/owampd_running_test/error/1.0</nmwg:eventType>
+ </nmwg:metadata>
+
+ <nmwg:data id="data_owampd_running_test"
metadataIdRef="owampd_running_test">
+ <nmwgr:datum>Service owampd not running! </nmwgr:datum>
+ </nmwg:data>
+
+</nmwg:message>
Modified: trunk/lib/perfSONAR/DataStruct/NMWG.pm
===================================================================
--- trunk/lib/perfSONAR/DataStruct/NMWG.pm 2011-04-14 15:21:43 UTC (rev
707)
+++ trunk/lib/perfSONAR/DataStruct/NMWG.pm 2011-05-11 08:06:08 UTC (rev
708)
@@ -100,7 +100,8 @@
"owamp",
"bwctl",
"store",
- "http://schemas.perfsonar.net/tools/admin/echo/2.0"
+ "http://schemas.perfsonar.net/tools/admin/echo/2.0",
+ "http://schemas.perfsonar.net/tools/admin/selftest/1.0"
);
bless $self, $class;
@@ -174,11 +175,12 @@
#look for echo
if ($et =~ /admin\/echo/){
$ds->{DOECHO} = 1;;
- $self->{LOGGER}->info("Get Echo Request");
+ $self->{LOGGER}->info("Get Echo request");
}
#look for selftest
if ($et =~ /admin\/selftest/){
- $ds->{DOSELFTEST} = 1;;
+ $ds->{DOSELFTEST} = 1;
+ $self->{LOGGER}->info("Get selftest request");
}
my $found = undef;
@@ -479,7 +481,7 @@
my $result_params =
$$ds->{NMWG}->{HADES}->{$id}->{RESPARAMS}->{DATA};
$$ds->{REQUESTMSG}->set_parameter_list(@$result_params);
}
- if ($$ds->{NMWG}->{HADES}->{$id}->{RESPARAMS}->{OCCURHASH}){
+ if ($$ds->{NMWG}->{HADES}->{$id}->{RESPARAMS}->{OCCURHASH}){
my %result_params =
%{$$ds->{NMWG}->{HADES}->{$id}->{RESPARAMS}->{DATA}};
$result_params{metadataIdRef} =
$self->{HADES}->{FILTER}{"metaID"};
#$self->{LOGGER}->info(Dumper(%result_params));
@@ -489,10 +491,18 @@
if ($$ds->{DOECHO}){
my $data_hash = pop @$datalines_ref;
my %echo = %$data_hash;
- $$ds->{REQUESTMSG}->return_result_code($echo{echocode},
$echo{echomsg}, "$id")
+ $$ds->{REQUESTMSG}->return_result_code($echo{echocode},
$echo{echomsg},$$ds->{REQUESTMSG}->{"dataIDs"}{$id}{"metaref"})
+ }elsif ($$ds->{DOSELFTEST}){
+ my $data_hash = pop @$datalines_ref;
+ my $response_et =
"http://schemas.perfsonar.net/tools/admin/selftest/";
+ foreach my $name (keys %{$data_hash}){
+ my $array_ref= $data_hash->{$name};
+ my $ns_selftest =
"$response_et$$ds->{SERVICE}->{NAME}/$name/@$array_ref[1]/1.0";
+
$$ds->{REQUESTMSG}->return_result_code($ns_selftest,"@$array_ref[0]",$$ds->{REQUESTMSG}->{"dataIDs"}{$id}{"metaref"},"$name");;
+ }
}elsif ($$ds->{ERROROCCUR}){
my $et = pop @$datalines_ref;
- $$ds->{REQUESTMSG}->return_result_code($et, "@$datalines_ref",
$$ds->{REQUESTMSG}->{"dataIDs"}{$id}{"metaref"});
+ $$ds->{REQUESTMSG}->return_result_code($et,
"@$datalines_ref",$$ds->{REQUESTMSG}->{"dataIDs"}{$id}{"metaref"});
#Sometimes we need here parse result
if ($$ds->{SERVICE}->{DOPARSE}){
if ($$ds->{SERVICE}->{NAME} =~ /HADES/){
Modified: trunk/lib/perfSONAR/Echo.pm
===================================================================
--- trunk/lib/perfSONAR/Echo.pm 2011-04-14 15:21:43 UTC (rev 707)
+++ trunk/lib/perfSONAR/Echo.pm 2011-05-11 08:06:08 UTC (rev 708)
@@ -62,13 +62,15 @@
}
}
+=head2 selftest($tool,$servicetype)
-=head2 doselftests({})
-This method is used to get status for the called service tool.
-Start this method in the service so settings from this service is used.
+to start the selftest for the service start this method. Override this
method
+in the service.
=cut
-sub doselftests{
-
+sub selftest{
+ my $self = shift;
+ return undef;
}
+
1;
Modified: trunk/lib/perfSONAR/MP/BWCTL.pm
===================================================================
--- trunk/lib/perfSONAR/MP/BWCTL.pm 2011-04-14 15:21:43 UTC (rev 707)
+++ trunk/lib/perfSONAR/MP/BWCTL.pm 2011-05-11 08:06:08 UTC (rev 708)
@@ -55,7 +55,7 @@
=cut
sub run{
my ($self, $ds) = @_;
-
+ $self->{LOGGER} = get_logger(__PACKAGE__);
$self->{DS} = $ds;
$self->runMeasurement();
}
@@ -195,4 +195,25 @@
}
+=head2 selftest()
+Define here the steps for the selftest
+=cut
+sub selftest{
+ my ($self, $ds, $id) = @_;
+ my $params = $$ds->{SERVICE}->{DATA};
+ my @datalines;
+
+ foreach my $id (keys %{$params}){
+ my %data_hash;
+
+ $data_hash{'bwctl_command_test'} =
[$self->checkTool("bwctl")];
+ $data_hash{"bwctld_running_test"} =
[$self->checkToolisrunning("bwctld")];
+ $data_hash{"ntpd_running_test"} =
[$self->checkToolisrunning("ntpd")];
+
+ push @datalines, \%data_hash;
+ $$ds->{SERVICE}->{DATA}->{$id}->{MRESULT} =
\@datalines
+ }#End foreach
+ return;
+}
+
1;
\ No newline at end of file
Modified: trunk/lib/perfSONAR/MP/OWAMP.pm
===================================================================
--- trunk/lib/perfSONAR/MP/OWAMP.pm 2011-04-14 15:21:43 UTC (rev 707)
+++ trunk/lib/perfSONAR/MP/OWAMP.pm 2011-05-11 08:06:08 UTC (rev 708)
@@ -56,7 +56,7 @@
=cut
sub run{
my ($self, $ds) = @_;
-
+ $self->{LOGGER} = get_logger(__PACKAGE__);
$self->{DS} = $ds;
$self->runMeasurement();
}
@@ -289,4 +289,26 @@
return @datalines;
}
+
+=head2 selftest()
+Define here the steps for the selftest
+=cut
+sub selftest{
+ my ($self, $ds, $id) = @_;
+ $self->{LOGGER} = get_logger(__PACKAGE__);
+ my $params = $$ds->{SERVICE}->{DATA};
+ my @datalines;
+
+ foreach my $id (keys %{$params}){
+ my %data_hash;
+
+ $data_hash{'owping_command_test'} =
[$self->checkTool("owping")];
+ $data_hash{"owampd_running_test"} =
[$self->checkToolisrunning("owampd")];
+ $data_hash{"ntpd_running_test"} =
[$self->checkToolisrunning("ntpd")];
+
+ push @datalines, \%data_hash;
+ $$ds->{SERVICE}->{DATA}->{$id}->{MRESULT} =
\@datalines
+ }#End foreach
+ return;
+}
1;
Modified: trunk/lib/perfSONAR/MP.pm
===================================================================
--- trunk/lib/perfSONAR/MP.pm 2011-04-14 15:21:43 UTC (rev 707)
+++ trunk/lib/perfSONAR/MP.pm 2011-05-11 08:06:08 UTC (rev 708)
@@ -50,6 +50,7 @@
use IO::Pty;
use POSIX ":sys_wait_h";
use base qw(perfSONAR::Echo);
+use base qw(perfSONAR::Selftest);
=head1 Methods:
@@ -61,7 +62,8 @@
the command. Dont include the tool name like bwctl or owping. Return as
result this array.
=cut
sub createCommandLine{
-
+ my $self = shift;
+ return undef;
}
=head2 parse_result($datastruct_ref, $id_of_measurement)
@@ -76,7 +78,8 @@
=cut
sub parse_result{
-
+ my $self = shift;
+ return undef;
}
=head2 run($reference_to_datastructucre)
Modified: trunk/lib/perfSONAR.pm
===================================================================
--- trunk/lib/perfSONAR.pm 2011-04-14 15:21:43 UTC (rev 707)
+++ trunk/lib/perfSONAR.pm 2011-05-11 08:06:08 UTC (rev 708)
@@ -102,6 +102,8 @@
if ($ds->{DOECHO}){
$ds->{SERVICES}->{$ds->{SERVICE}->{NAME}}->{handler}->handle_echo_request(\$ds);
+ }elsif ($ds->{DOSELFTEST}){
+ $ds->{SERVICES}->{$ds->{SERVICE}->{NAME}}->{handler}->selftest(\$ds);
}else{
$ds->{SERVICES}->{$ds->{SERVICE}->{NAME}}->{handler}->run(\$ds);
}
- [pS-dev] [GEANT/SA2/SA2T3-OPPD] r708 - in trunk/lib: . NMWG/examples/2.0 perfSONAR perfSONAR/DataStruct perfSONAR/MP, svn-noreply, 05/11/2011
Archive powered by MHonArc 2.6.16.