Skip to Content.
Sympa Menu

perfsonar-dev - [pS-dev] [GEANT/SA2/SA2T3-OPPD] r680 - in branches/perfsonar-oppd-new-architect: etc/oppd-mdm/oppd.d lib/perfSONAR lib/perfSONAR/MA

Subject: perfsonar development work

List archive

[pS-dev] [GEANT/SA2/SA2T3-OPPD] r680 - in branches/perfsonar-oppd-new-architect: etc/oppd-mdm/oppd.d lib/perfSONAR lib/perfSONAR/MA


Chronological Thread 
  • From:
  • To:
  • Subject: [pS-dev] [GEANT/SA2/SA2T3-OPPD] r680 - in branches/perfsonar-oppd-new-architect: etc/oppd-mdm/oppd.d lib/perfSONAR lib/perfSONAR/MA
  • Date: Thu, 10 Feb 2011 12:46:43 GMT

Author: dfn.calim
Date: 2011-02-10 12:46:42 +0000 (Thu, 10 Feb 2011)
New Revision: 680

Modified:
branches/perfsonar-oppd-new-architect/etc/oppd-mdm/oppd.d/hades.conf
branches/perfsonar-oppd-new-architect/lib/perfSONAR/DataStruct.pm
branches/perfsonar-oppd-new-architect/lib/perfSONAR/MA/Hades.pm
Log:
Add Hades MA request

Modified: branches/perfsonar-oppd-new-architect/etc/oppd-mdm/oppd.d/hades.conf
===================================================================
--- branches/perfsonar-oppd-new-architect/etc/oppd-mdm/oppd.d/hades.conf
2011-02-08 15:41:28 UTC (rev 679)
+++ branches/perfsonar-oppd-new-architect/etc/oppd-mdm/oppd.d/hades.conf
2011-02-10 12:46:42 UTC (rev 680)
@@ -31,7 +31,7 @@
#
<module_param>

- config "/etc/hades-mydomain.conf"
+ config "/opt/hades/etc/hades-win.conf"
# Hades domain for which data should be available via this service

# You can add further Hades configuration parameters here.

Modified: branches/perfsonar-oppd-new-architect/lib/perfSONAR/DataStruct.pm
===================================================================
--- branches/perfsonar-oppd-new-architect/lib/perfSONAR/DataStruct.pm
2011-02-08 15:41:28 UTC (rev 679)
+++ branches/perfsonar-oppd-new-architect/lib/perfSONAR/DataStruct.pm
2011-02-10 12:46:42 UTC (rev 680)
@@ -150,6 +150,7 @@
precedence => 1,
groupsize => 1,
interval => 1,
+ mid => 1,
};

$self->{"unsupported_parameters"} = {

Modified: branches/perfsonar-oppd-new-architect/lib/perfSONAR/MA/Hades.pm
===================================================================
--- branches/perfsonar-oppd-new-architect/lib/perfSONAR/MA/Hades.pm
2011-02-08 15:41:28 UTC (rev 679)
+++ branches/perfsonar-oppd-new-architect/lib/perfSONAR/MA/Hades.pm
2011-02-10 12:46:42 UTC (rev 680)
@@ -34,6 +34,7 @@
sub new{
my ($class,%module_param) = @_;
my $self = $class->SUPER::new(%module_param);
+

# Now create config and initialise everything
$Hades::configfile = undef;
@@ -52,6 +53,7 @@

sub run{
my ($self, $ds) = @_;
+ my $et = "error.ma.parameters";

$self->{DS} = $ds;
my $data = $$ds->{SERVICE}->{DATA};
@@ -61,13 +63,13 @@
#At teh moment all MA steps happen here
#We have no other MA services
foreach my $id (keys %{$data}){
- my $startTime = $data->{$id}->{PARAMS}->{"startTime"};
- my $endTime = $data->{$id}->{PARAMS}->{"endTime"};
+ my %params = %{$data->{$id}->{PARAMS}};
+ my $startTime = $params{startTime};
+ my $endTime = $params{endTime};
my $currentTime = time;

if ($endTime > $currentTime){
$endTime = $currentTime;
- my $et = "error.ma.parameters";
my @errmsg;
my $warnmsg = "WARN: endTime value lies ahead!";
push @errmsg, $warnmsg;
@@ -76,11 +78,161 @@
$$ds->{SERVICE}->{DATA}->{$id}->{WARN}->{OCCUR} = 1;
$self->{LOGGER}->warn($warnmsg);
}
- }#End foreach my $id (keys
+
+ my $src = $params{src};
+ my $dst = $params{dst};
+ my $mid = $params{mid};
+
+ $self->{FINDER}->reset;
+ if (! $self->{FINDER}->set_time_epoch($startTime,$endTime)){
+ $$ds->{ERROROCCUR} = 1;
+ my @errmsg;
+ push @errmsg, "Invalid date format";
+ $self->{LOGGER}->error("@errmsg");
+ push @errmsg, $et;
+ $$ds->{SERVICE}->{DATA}->{$id}->{MRESULT} =
\@errmsg;
+ return;
+ }
+ $self->{FINDER}->set_route($src,$dst); # set_route understands
"undef"!!!
+ if (defined $$ds->{$$ds->{DSTYPE}}->{HADES}->{ACTION}->{TYPE}){
+
$self->{FINDER}->set_type($$ds->{$$ds->{DSTYPE}}->{HADES}->{ACTION}->{TYPE});
+ }
+ else{
+
$self->{FINDER}->set_type($$ds->{$$ds->{DSTYPE}}->{HADES}->{ACTION}->{EVENTYPE}
);
+ }
+ $self->{FINDER}->set_mid($mid); # ignores "undef"
+ $self->{FINDER}->set_filter($self->{HADES}->{FILTER}); # filter with
metadata
+ my @results = $self->{FINDER}->find;
+
+ unless (@results) {
+ my @errmsg;
+ push @errmsg, "No data found for id: $id";
+ $self->{LOGGER}->error("@errmsg");
+ push @errmsg, "error.ma.data";
+ $$ds->{SERVICE}->{DATA}->{$id}->{MRESULT} =
\@errmsg;
+ $$ds->{ERROROCCUR} = 1;
+ return;
+ }
+
+ my @result_params;
+ if ($#results > 0){ #More than one measurment result found matching
the request pattern
+ #get_meta_info($msg);
+ my $output = "";
+ my $count = 0;
+ foreach my $result (@results){
+ my $info = $result->{meta};
+ my %par;
+ foreach my $key (keys %{$info}){
+ next if ($key eq "sender_port" || $key eq
"receiver_port");
+ if ($key eq "interval"){
+ $par{"interval"} = $info->{"interval"} / 1000000;
+ } else {
+ $par{$key} = $info->{$key};
+ }
+ }#End foreach my $key
+
+ $par{"sender"} = $result->{"sender"};
+ $par{"receiver"} = $result->{"receiver"};
+ $par{"mid"} = $result->{"mid"};
+ $par{"metadataIdRef"} = "result$count";
+ $count++;
+
+ push @result_params, \%par;
+ $output = $output . "$result->{sender} to $result->{receiver} "
+ . $result->type2string() . ", mid: $result->{mid}\n";
+ }#End foreach my $result
+ my $message = "More than one measurement result found";
+ $self->{LOGGER}->warn($message);
+ $self->{LOGGER}->debug("Measurements:\n$output");
+ #Strore params for return msg
+ $$ds->{$$ds->{DSTYPE}}->{HADES}->{RESPARAMS}->{OCCUR} = 1;
+ $$ds->{$$ds->{DSTYPE}}->{HADES}->{RESPARAMS}->{DATA} =
\@result_params;
+
+ $self->{LOGGER}->debug($message);
+ $$ds->{ERROROCCUR} = 1;
+ my @errmsg;
+ push @errmsg, $message;
+ push @errmsg, "warning.ma.parameters";
+ $$ds->{SERVICE}->{DATA}->{$id}->{MRESULT} =
\@errmsg;
+ return;
+ }#iEnd if ($#results > 0
+
+ my $warnings = $self->{FINDER}->{warnings}->get_string();
+ if ($warnings) {
+ #TODO is that right/useful???
+ my @errmsg;
+ push @errmsg, "Warnings from data modules:\n$warnings";
+ $self->{LOGGER}->error("@errmsg");
+ push @errmsg, "error.ma.data";
+ $$ds->{SERVICE}->{DATA}->{$id}->{MRESULT} =
\@errmsg;
+ $$ds->{ERROROCCUR} = 1;
+ return;
+ }
+
+ my $data_obj = $results[0];
+ my $info = $data_obj->{meta};
+ my %par;
+
+ foreach my $key (keys %{$info}){
+ next if ($key eq "sender_port" || $key eq "receiver_port");
+ if ($key eq "interval"){
+ $par{"interval"} = $info->{"interval"} / 1000000;
+ } else {
+ $par{$key} = $info->{$key};
+ }
+ } #End foreach my $key
+
+ $par{"sender"} = $data_obj->{"sender"};
+ $par{"receiver"} = $data_obj->{"receiver"};
+ $par{"mid"} = $data_obj->{"mid"};
+ #$par{"metadataIdRef"} = $$filter{"metaID"};
+ $$ds->{$$ds->{DSTYPE}}->{HADES}->{RESPARAMS}->{OCCUR} = 1;
+ $$ds->{$$ds->{DSTYPE}}->{HADES}->{RESPARAMS}->{DATA} = \%par;
+
+ if(!(exists $data_obj->{meta})) {
+ my @errmsg;
+ push @errmsg, "No meta data found";
+ $self->{LOGGER}->error("@errmsg");
+ push @errmsg, "error.ma.data";
+ $$ds->{SERVICE}->{DATA}->{$id}->{MRESULT} =
\@errmsg;
+ $$ds->{ERROROCCUR} = 1;
+ return;
+ }
+
+ $self->{LOGGER}->info("Meta data retrieval seems to be successful");
+
+ $data_obj->extract_data();
+ $warnings = $self->{FINDER}->{warnings}->get_string();
+ if ($warnings) {
+ #TODO is that right/useful???
+ $$ds->{ERROROCCUR} = 1;
+ my @errmsg;
+ push @errmsg,"Warnings from data modules:\n$warnings";
+ $self->{LOGGER}->error("@errmsg");
+ push @errmsg, "error.ma.data";
+ $$ds->{SERVICE}->{DATA}->{$id}->{MRESULT} =
\@errmsg;
+ return;
+ }
+
+ my $data = $data_obj->get_data;
+ unless (defined $data) {
+ $$ds->{ERROROCCUR} = 1;
+ my @errmsg;
+ push @errmsg,"No data found";
+ $self->{LOGGER}->error("@errmsg");
+ push @errmsg, "error.ma.data";
+ $$ds->{SERVICE}->{DATA}->{$id}->{MRESULT} =
\@errmsg;
+ return;
+ }

- return;
+ $self->{LOGGER}->info("Data retrieval seems to be successful");
+
+ $$ds->{SERVICE}->{DATA}->{$id}->{MRESULT} = \$data_obj
+ }#End foreach my $id (keys

+ return;

+
}

1;



  • [pS-dev] [GEANT/SA2/SA2T3-OPPD] r680 - in branches/perfsonar-oppd-new-architect: etc/oppd-mdm/oppd.d lib/perfSONAR lib/perfSONAR/MA, svn-noreply, 02/10/2011

Archive powered by MHonArc 2.6.16.

Top of Page