perfsonar-dev - [pS-dev] [GEANT/SA2/SA2T3-OPPD] r684 - in branches/perfsonar-oppd-new-architect: bin lib/perfSONAR/DataStruct lib/perfSONAR/MA
Subject: perfsonar development work
List archive
[pS-dev] [GEANT/SA2/SA2T3-OPPD] r684 - in branches/perfsonar-oppd-new-architect: bin lib/perfSONAR/DataStruct lib/perfSONAR/MA
Chronological Thread
- From:
- To:
- Subject: [pS-dev] [GEANT/SA2/SA2T3-OPPD] r684 - in branches/perfsonar-oppd-new-architect: bin lib/perfSONAR/DataStruct lib/perfSONAR/MA
- Date: Fri, 4 Mar 2011 12:22:28 GMT
Author: dfn.calim
Date: 2011-03-04 12:22:28 +0000 (Fri, 04 Mar 2011)
New Revision: 684
Modified:
branches/perfsonar-oppd-new-architect/bin/oppd.pl
branches/perfsonar-oppd-new-architect/lib/perfSONAR/DataStruct/NMWG.pm
branches/perfsonar-oppd-new-architect/lib/perfSONAR/MA/Hades.pm
Log:
Fix bug for Hades MA for aggregated data
Modified: branches/perfsonar-oppd-new-architect/bin/oppd.pl
===================================================================
--- branches/perfsonar-oppd-new-architect/bin/oppd.pl 2011-02-18 11:48:29
UTC (rev 683)
+++ branches/perfsonar-oppd-new-architect/bin/oppd.pl 2011-03-04 12:22:28
UTC (rev 684)
@@ -752,6 +752,7 @@
#Use the new DataStruct
#At the moment NMWG parse to DS
my $nmwg_message = NMWG::Message->new( ($soap_message->body)[0] );
+ #$logger->info(Dumper($nmwg_message->as_string()));
#TODO: Auth
if ($auth){
perfSONAR::Auth::authenticate($soap_message, $nmwg_message, $as_url);
@@ -770,6 +771,9 @@
}
$nmwg_response = $ds->{REQUESTMSG};
+ #We dont need ds
+ $ds = undef;
+ #$logger->info($nmwg_response->as_string());
#TODO $nmwg_message <-> $nmwg_response? clone?
#TODO what about header?
$soap_message->body($nmwg_response->as_dom()->documentElement);
Modified:
branches/perfsonar-oppd-new-architect/lib/perfSONAR/DataStruct/NMWG.pm
===================================================================
--- branches/perfsonar-oppd-new-architect/lib/perfSONAR/DataStruct/NMWG.pm
2011-02-18 11:48:29 UTC (rev 683)
+++ branches/perfsonar-oppd-new-architect/lib/perfSONAR/DataStruct/NMWG.pm
2011-03-04 12:22:28 UTC (rev 684)
@@ -66,7 +66,8 @@
$self->{NS}->{RAW} = "http://ggf.org/ns/nmwg/tools/owd/raw";
$self->{NS}->{HADES} =
"http://ggf.org/ns/nwmg/tools/hades/aggregated";
$self->{NS}->{HOPLIST} =
"http://ggf.org/ns/nmwg/tools/hades/traceroute/hoplist/2.0/";
-
+
+ $self->{HADES}->{RESPARAMS}->{OCCUR} = undef;
$self->{HADES}->{ACTIONS} = {
ippm_aggregated => [
@@ -252,6 +253,8 @@
if ($ds->{SERVICE}->{NAME} =~ /MA\/HADES/){
if ($ds->{SERVICE}->{NAME} =~ /STATUS/){
$ds->{SERVICE}->{NAME} =~ s/\/STATUS//;
+ $self->{HADES}->{ACTION}->{TYPE} = "traceroute";
+ $ds->{SERVICE}->{DOPARSE} = 1;
}
if (!$select){
my $error = "No select block found for data id: $dataid";
@@ -279,6 +282,7 @@
}
my $agg_ets = join ('_',
@{$self->{HADES}->{ACTIONS}->{"ippm_aggregated"}});
my $raw_ets = join ('_',
@{$self->{HADES}->{ACTIONS}->{"ippm_raw"}});
+
#$self->{LOGGER}->info(Dumper($self->{HADES}->{ACTION}->{EVENTYPE}));
if ($agg_ets =~ /$self->{HADES}->{ACTION}->{EVENTYPE}/){
$self->{HADES}->{ACTION}->{TYPE} = "ippm_aggregated";
} elsif($raw_ets =~ /$self->{HADES}->{ACTION}->{EVENTYPE}/){
@@ -288,7 +292,9 @@
if ($$filter{"interval"}){
$$filter{"interval"} *= 1000000;
}
+ #$self->{LOGGER}->info(Dumper($filter));
$self->{HADES}->{FILTER} = $filter;
+ #$self->{LOGGER}->info(Dumper($self->{HADES}->{FILTER}));
}# End Hades stuff
my $error = $self->checkParams($ds, %parameters);
@@ -452,38 +458,48 @@
id field to get the specific result. Some checks are needed in this method
to decide if it is a EchoRequest or a error is occured
=cut
sub parseResult{
+
my ($self, $ds) = @_;
my $ns_serivce = $$ds->{SERVICE}->{NAME};
$ns_serivce =~ s/\///;
my $ns = $self->{NS}->{$ns_serivce};
+
+ #Set ns if MA::Hades
+ if ($ns_serivce =~ /MAHADES/){
+ $ns = $self->{NS}->{HADES};
+ }
+
my $data = $$ds->{SERVICE}->{DATA};
-
- #Do here all for MetakeyDataRequest
my $messagetype = $$ds->{REQUESTMSG}->get_message_type();
- $self->{LOGGER}->info("Starting parse...");
-
+
foreach my $id (keys %{$data}){
+ #Hades MA params occur
+ if ($$ds->{NMWG}->{HADES}->{$id}->{RESPARAMS}->{OCCURARRAY}){
+ my $result_params =
$$ds->{NMWG}->{HADES}->{$id}->{RESPARAMS}->{DATA};
+ $$ds->{REQUESTMSG}->set_parameter_list(@$result_params);
+ }
+ 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));
+ $$ds->{REQUESTMSG}->set_parameter_hash(%result_params);
+ }
my $datalines_ref = $$ds->{SERVICE}->{DATA}->{$id}->{MRESULT};
- #$self->{LOGGER}->debug(Dumper(@$datalines_ref));
if ($$ds->{DOECHO}){
my $data_hash = pop @$datalines_ref;
my %echo = %$data_hash;
$$ds->{REQUESTMSG}->return_result_code($echo{echocode},
$echo{echomsg}, "$id")
}elsif ($$ds->{ERROROCCUR}){
my $et = pop @$datalines_ref;
- #Hades MA parameters occur
- if ($$ds->{NMWG}->{HADES}->{RESPARAMS}->{OCCUR}){
- my $result_params =
$$ds->{NMWG}->{HADES}->{RESPARAMS}->{DATA};
- $$ds->{REQUESTMSG}->set_parameter_list(@$result_params);
- }
$$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/){
+ $self->{LOGGER}->info("Starting parse STATUS MA");
+
$self->parseHadesMA($$ds->{NMWG}->{HADES}->{STATUSDATA},$id,$ds);
+ }
+ }
}else{
- #Look if Hades MA parameters should be append
- if ($$ds->{NMWG}->{HADES}->{RESPARAMS}->{OCCUR}){
- my %result_params =
%{$$ds->{NMWG}->{HADES}->{RESPARAMS}->{DATA}};
- $result_params{metadataIdRef} =
$$ds->{REQUESTMSG}->{"dataIDs"}{$id}{"metaref"};
- $$ds->{REQUESTMSG}->set_parameter_hash(%result_params);
- }
#Hades MA need a another parse
if ($$ds->{SERVICE}->{NAME} =~ /HADES/){
$datalines_ref = $self->parseHadesMA($datalines_ref,$id,$ds);
@@ -594,8 +610,7 @@
my ($self, $data_obj,$id,$ds) = @_;
my @datalines;
my $ns = $self->{NS}->{HADES};
-
- #$self->{LOGGER}->info(Dumper($data_ref));
+ #$self->{LOGGER}->info(Dumper($$data_obj));
if ($$data_obj->isa("Hades::Data::IPPM_Raw")){
$self->{LOGGER}->info("IPPM-RAW");
}elsif ($$data_obj->isa("Hades::Data::IPPM_Aggregated")){
Modified: branches/perfsonar-oppd-new-architect/lib/perfSONAR/MA/Hades.pm
===================================================================
--- branches/perfsonar-oppd-new-architect/lib/perfSONAR/MA/Hades.pm
2011-02-18 11:48:29 UTC (rev 683)
+++ branches/perfsonar-oppd-new-architect/lib/perfSONAR/MA/Hades.pm
2011-03-04 12:22:28 UTC (rev 684)
@@ -100,8 +100,9 @@
else{
$self->{FINDER}->set_type($$ds->{$$ds->{DSTYPE}}->{HADES}->{ACTION}->{EVENTYPE}
);
}
+
#$self->{LOGGER}->error(Dumper($$ds->{$$ds->{DSTYPE}}->{HADES}->{FILTER}));
$self->{FINDER}->set_mid($mid); # ignores "undef"
- $self->{FINDER}->set_filter($self->{HADES}->{FILTER}); # filter with
metadata
+
$self->{FINDER}->set_filter($$ds->{$$ds->{DSTYPE}}->{HADES}->{FILTER}); #
filter with metadata
my @results = $self->{FINDER}->find;
unless (@results) {
@@ -115,6 +116,7 @@
}
my @result_params;
+ #$self->{LOGGER}->info(Dumper(@results));
if ($#results > 0){ #More than one measurment result found matching
the request pattern
#get_meta_info($msg);
my $output = "";
@@ -145,8 +147,8 @@
$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;
+ $$ds->{$$ds->{DSTYPE}}->{HADES}->{$id}->{RESPARAMS}->{OCCURARRAY}
= 1;
+ $$ds->{$$ds->{DSTYPE}}->{HADES}->{$id}->{RESPARAMS}->{DATA} =
\@result_params;
$self->{LOGGER}->debug($message);
$$ds->{ERROROCCUR} = 1;
@@ -183,17 +185,15 @@
} #End foreach my $key
$par{"sender"} = $data_obj->{"sender"};
+ $par{"mid"} = $data_obj->{"mid"};
$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;
-
+ $$ds->{$$ds->{DSTYPE}}->{HADES}->{$id}->{RESPARAMS}->{OCCURHASH} = 1;
+ $$ds->{$$ds->{DSTYPE}}->{HADES}->{$id}->{RESPARAMS}->{DATA} = \%par;
if(!(exists $data_obj->{meta})) {
my @errmsg;
push @errmsg, "No meta data found";
+ push @errmsg, "error.ma.data";
$self->{LOGGER}->error("@errmsg");
- push @errmsg, "error.ma.data";
$$ds->{SERVICE}->{DATA}->{$id}->{MRESULT} =
\@errmsg;
$$ds->{ERROROCCUR} = 1;
return;
@@ -227,7 +227,7 @@
$self->{LOGGER}->info("Data retrieval seems to be successful");
- $$ds->{SERVICE}->{DATA}->{$id}->{MRESULT} = \$data_obj
+ $$ds->{SERVICE}->{DATA}->{$id}->{MRESULT} = \$data_obj;
}#End foreach my $id (keys
return;
- [pS-dev] [GEANT/SA2/SA2T3-OPPD] r684 - in branches/perfsonar-oppd-new-architect: bin lib/perfSONAR/DataStruct lib/perfSONAR/MA, svn-noreply, 03/04/2011
Archive powered by MHonArc 2.6.16.