Skip to Content.
Sympa Menu

perfsonar-dev - [pS-dev] [GEANT/SA2/SA2T3-OPPD] r683 - in branches/perfsonar-oppd-new-architect/lib/perfSONAR: . DataStruct

Subject: perfsonar development work

List archive

[pS-dev] [GEANT/SA2/SA2T3-OPPD] r683 - in branches/perfsonar-oppd-new-architect/lib/perfSONAR: . DataStruct


Chronological Thread 
  • From:
  • To:
  • Subject: [pS-dev] [GEANT/SA2/SA2T3-OPPD] r683 - in branches/perfsonar-oppd-new-architect/lib/perfSONAR: . DataStruct
  • Date: Fri, 18 Feb 2011 11:48:29 GMT

Author: dfn.calim
Date: 2011-02-18 11:48:29 +0000 (Fri, 18 Feb 2011)
New Revision: 683

Modified:
branches/perfsonar-oppd-new-architect/lib/perfSONAR/DataStruct/NMWG.pm
branches/perfsonar-oppd-new-architect/lib/perfSONAR/MA.pm
Log:
New Hades MA modul added

Modified:
branches/perfsonar-oppd-new-architect/lib/perfSONAR/DataStruct/NMWG.pm
===================================================================
--- branches/perfsonar-oppd-new-architect/lib/perfSONAR/DataStruct/NMWG.pm
2011-02-11 08:40:47 UTC (rev 682)
+++ branches/perfsonar-oppd-new-architect/lib/perfSONAR/DataStruct/NMWG.pm
2011-02-18 11:48:29 UTC (rev 683)
@@ -65,6 +65,7 @@
$self->{NS}->{STORE} = "http://ggf.org/ns/nmwg/ops/store/2.0/";;
$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}->{ACTIONS} = {

@@ -120,7 +121,8 @@
($ds->{SERVICE}->{NAME} = $ds->{URI}) =~ s/^.*\/services\///;
$ds->{SERVICE}->{NAME} =~ s/\/$//;
$self->{LOGGER}->info("Requested service: $ds->{SERVICE}->{NAME}");
-
+ #$self->{LOGGER}->info("Message: $messagetype ");
+ #$self->{LOGGER}->info($nmwg->as_string());
#Check messagetype
if (!$self->NMWGcheckMessagetype($messagetype,\$ds)){
$self->{LOGGER}->error("Error in checking message type");
@@ -166,9 +168,11 @@
foreach my $meta (keys %{$ds->{REQUESTMSG}->{"metadataIDs"}}){
#check for unknown eventTypes
my $et = $ds->{REQUESTMSG}->{"metadataIDs"}{$meta}{"eventType"};
+ #$self->{LOGGER}->info("Eventype: $et");
#look for echo
if ($et =~ /admin\/echo/){
$ds->{DOECHO} = 1;;
+ $self->{LOGGER}->info("Get Echo Request");
}
#look for selftest
if ($et =~ /admin\/selftest/){
@@ -246,6 +250,9 @@

#Do here some MA::HADES Stuff
if ($ds->{SERVICE}->{NAME} =~ /MA\/HADES/){
+ if ($ds->{SERVICE}->{NAME} =~ /STATUS/){
+ $ds->{SERVICE}->{NAME} =~ s/\/STATUS//;
+ }
if (!$select){
my $error = "No select block found for data id: $dataid";
$self->{LOGGER}->error($error);
@@ -258,10 +265,10 @@

!($ds->{REQUESTMSG}->{"dataIDs"}{$dataid}{$select}{"endTime"})){
my $error = "No timespan specified!";
$self->{LOGGER}->error($error);
-
$ds->{REQUESTMSG}->return_result_code("error.ma.parameters",
+
$ds->{REQUESTMSG}->return_result_code("error.ma.parameters",
$error,
$ds->{REQUESTMSG}->{"dataIDs"}{$dataid}{"metaref"});
- $ds->{ERROROCCUR} = 1;
- return;
+ $ds->{ERROROCCUR} = 1;
+ return;
}
#At fist get eventype from message nor from metadata
foreach my $key (keys
%{$ds->{REQUESTMSG}->{"dataIDs"}{$dataid}}){
@@ -276,16 +283,12 @@
$self->{HADES}->{ACTION}->{TYPE} = "ippm_aggregated";
} elsif($raw_ets =~ /$self->{HADES}->{ACTION}->{EVENTYPE}/){
$self->{HADES}->{ACTION}->{TYPE} = "ippm_raw";
-<<<<<<< .mine
}
my $filter =
$ds->{REQUESTMSG}->{"dataIDs"}{$dataid}{$self->{HADES}->{ACTION}->{EVENTYPE}};

if ($$filter{"interval"}){
$$filter{"interval"} *= 1000000;
}
$self->{HADES}->{FILTER} = $filter;
-=======
- }
->>>>>>> .r679
}# End Hades stuff

my $error = $self->checkParams($ds, %parameters);
@@ -483,7 +486,7 @@
}
#Hades MA need a another parse
if ($$ds->{SERVICE}->{NAME} =~ /HADES/){
- $self->{LOGGER}->info("Parsing Hades MA data...");
+ $datalines_ref = $self->parseHadesMA($datalines_ref,$id,$ds);
}
$$ds->{REQUESTMSG}->set_data_ns ($id, $ns, @$datalines_ref);

@@ -587,8 +590,104 @@
return 1;
}

+sub parseHadesMA{
+ my ($self, $data_obj,$id,$ds) = @_;
+ my @datalines;
+ my $ns = $self->{NS}->{HADES};

+ #$self->{LOGGER}->info(Dumper($data_ref));
+ if ($$data_obj->isa("Hades::Data::IPPM_Raw")){
+ $self->{LOGGER}->info("IPPM-RAW");
+ }elsif ($$data_obj->isa("Hades::Data::IPPM_Aggregated")){
+ my $data = $$data_obj->{data};
+ my $metric =
$$ds->{REQUESTMSG}->{"dataIDs"}{$id}{"select"}{"metric"};
+ my $sample =
$$ds->{REQUESTMSG}->{"dataIDs"}{$id}{"select"}{"sample"};
+ my $count = -1;
+
+ foreach my $ref (@$data) {
+ my %data_hash;
+ my $time = $$ref{"time"};
+ next unless $time;
+
+ if ($sample){
+ $count++;
+ next unless $count % $sample == 0;
+ }

+ $data_hash{"time"} = $time;
+
+ if (!$metric || $metric eq "all" || $metric eq "owd"){
+ $data_hash{"min_delay"} = $$ref{"min_owd"};
+ $data_hash{"med_delay"} = $$ref{"med_owd"};
+ $data_hash{"max_delay"} = $$ref{"max_owd"};
+ }

+ if (!$metric || $metric eq "all" || $metric eq "ipdv"){
+ $data_hash{"min_ipdv_jitter"} = $$ref{"min_ipdv"};
+ $data_hash{"med_ipdv_jitter"} = $$ref{"med_ipdv"};
+ $data_hash{"max_ipdv_jitter"} = $$ref{"max_ipdv"};
+ }

+ if (!$metric || $metric eq "all" || $metric eq "lost_packets"){
+ $data_hash{"loss"} = $$ref{"lost_packets"};
+ }
+ if (!$metric || $metric eq "all" || $metric eq
"duplicate_packets"){
+ $data_hash{"duplicates"} = $$ref{"duplicate_packets"};
+ }
+
+ $data_hash{"sync"} = "yes";
+ push @datalines, \%data_hash;
+ } #End foreach my $ref
+ } #End elsif ($$data_obj->isa(
+ elsif ($$data_obj->isa("Hades::Data::Traceroute")){
+ $$data_obj->extract_data();
+ my $eventType = $self->{HADES}->{ACTION}->{EVENTYPE};
+ if ($$data_obj->isa("Hades::Data::Traceroute")){
+ foreach my $timestamp (@{$$data_obj->{"timeline"}}){
+ my $ref = $timestamp->{"ref"};
+ next if (!defined $ref); #TODO Doesn't this ignore gaps ???
+ my $time = $timestamp->{"time"};
+ my (@hops, $hopcount);
+ if ($ref >= 0) {
+ @hops = @{$$data_obj->{"traceroutes"}->[$ref]};
+ $hopcount = $#hops;
+ } else {
+ @hops = (); $hopcount = 0;
+ }
+ if ($eventType =~ /aggregated/){
+ my %data_hash;
+ $data_hash{"timeValue"} = $time;
+ $data_hash{"timeType"} = "unix";
+ $data_hash{"hopcount"} = $hopcount;
+ $data_hash{"routeref"} = $ref;
+ push @datalines, \%data_hash;
+ } elsif ($eventType =~ /hoplist/){
+ my $datanode =
$$ds->{REQUESTMSG}->{"dataIDs"}{$id}{"node"};
+ $ns = $self->{NS}->{HOPLIST};
+ my $i = 0;
+ my $timenode = $$ds->{REQUESTMSG}->add_attribute(parent
=> $datanode, nodename => "commonTime",
+ type => "unix", value => $time);
+ foreach my $entry (@hops){
+ my %data_hash;
+ $data_hash{"index"} = $i;
+ $data_hash{"hopAddress"} = $entry->{"ip"};
+ $data_hash{"type"} = "ipv4"; #TODO IPv6!
+ $data_hash{"hopHostname"} = $entry->{"name"};
+
+ $$ds->{REQUESTMSG}->add_attribute(parent =>
$timenode, nodename => "datum",
+ namespace => $self->{NS}->{HOPLIST},
%data_hash);
+ $i++;
+ }
+ }
+
+ }
+ }
+ }#End elsif ($data->isa("Hades::Data::Traceroute
+
+ return
\@datalines;
+
+}
+
+
+
1;

Modified: branches/perfsonar-oppd-new-architect/lib/perfSONAR/MA.pm
===================================================================
--- branches/perfsonar-oppd-new-architect/lib/perfSONAR/MA.pm 2011-02-11
08:40:47 UTC (rev 682)
+++ branches/perfsonar-oppd-new-architect/lib/perfSONAR/MA.pm 2011-02-18
11:48:29 UTC (rev 683)
@@ -40,6 +40,7 @@
our $VERSION = 0.53;

use Log::Log4perl qw(get_logger);
+use base qw(perfSONAR::Echo);


=head2 new()



  • [pS-dev] [GEANT/SA2/SA2T3-OPPD] r683 - in branches/perfsonar-oppd-new-architect/lib/perfSONAR: . DataStruct, svn-noreply, 02/18/2011

Archive powered by MHonArc 2.6.16.

Top of Page