Skip to Content.
Sympa Menu

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

Subject: perfsonar development work

List archive

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


Chronological Thread 
  • From:
  • To:
  • Subject: [pS-dev] [GEANT/SA2/SA2T3-OPPD] r627 - in branches/perfsonar-oppd-new-architect/lib/perfSONAR: . DataStruct MP
  • Date: Wed, 8 Sep 2010 08:24:08 +0100

Author: dfn.calim
Date: 2010-09-08 08:24:08 +0100 (Wed, 08 Sep 2010)
New Revision: 627

Removed:
branches/perfsonar-oppd-new-architect/lib/perfSONAR/OWAMP.pm
Modified:
branches/perfsonar-oppd-new-architect/lib/perfSONAR/DataStruct.pm
branches/perfsonar-oppd-new-architect/lib/perfSONAR/DataStruct/NMWG.pm
branches/perfsonar-oppd-new-architect/lib/perfSONAR/MP/OWAMP.pm
Log:
1. Delete old OWAMP.pm 2. Add more error result messages

Modified:
branches/perfsonar-oppd-new-architect/lib/perfSONAR/DataStruct/NMWG.pm
===================================================================
--- branches/perfsonar-oppd-new-architect/lib/perfSONAR/DataStruct/NMWG.pm
2010-09-02 12:40:21 UTC (rev 626)
+++ branches/perfsonar-oppd-new-architect/lib/perfSONAR/DataStruct/NMWG.pm
2010-09-08 07:24:08 UTC (rev 627)
@@ -88,6 +88,8 @@
#Check messagetype
if (!$self->NMWGcheckMessagetype($messagetype,\$ds)){
$self->{LOGGER}->error("Error in checking message type");
+ my $et = "error.nmwg.action_not_supported";
+ $ds->{REQUESTMSG}->return_result_code($et, "$ds->{ERRMSG}",
"message");
$ds->{ERROROCCUR} = 1;
return;
}
@@ -298,7 +300,8 @@
my $errorstring = "Unknown messagetype: $messagetype";
$self->{LOGGER}->error($errorstring);
$$ds->{REQUESTMSG}->set_message_type("ErrorResponse");
- return -1;
+ $$ds->{ERRMSG} = $errorstring;
+ return 0;
}
return 1;
#$self->{LOGGER}->info("Messagetype: finish");

Modified: branches/perfsonar-oppd-new-architect/lib/perfSONAR/DataStruct.pm
===================================================================
--- branches/perfsonar-oppd-new-architect/lib/perfSONAR/DataStruct.pm
2010-09-02 12:40:21 UTC (rev 626)
+++ branches/perfsonar-oppd-new-architect/lib/perfSONAR/DataStruct.pm
2010-09-08 07:24:08 UTC (rev 627)
@@ -39,6 +39,7 @@
The structure is defined as follow:

$self ERROROCCUR If error occur set to 1. Default 0
+ ERRORMSG If error occur here is the error msg
SERVICE The called service
SERVICES The availible services as Reference
REQUESTMSG A reference to the requested message type with the
handlers
@@ -81,6 +82,7 @@
my $self = {};
$self->{LOGGER} = get_logger( $CLASSPATH );
$self->{ERROROCCUR} = 0; #If error occur set to 1
+ $self->{ERRMSG} = ""; #If error occur look here for error message at
the moment only string message is supported
$self->{SERVICE} = undef; #The request message
$self->{SERVICES} = ();
$self->{RETURNMSG} = undef;

Modified: branches/perfsonar-oppd-new-architect/lib/perfSONAR/MP/OWAMP.pm
===================================================================
--- branches/perfsonar-oppd-new-architect/lib/perfSONAR/MP/OWAMP.pm
2010-09-02 12:40:21 UTC (rev 626)
+++ branches/perfsonar-oppd-new-architect/lib/perfSONAR/MP/OWAMP.pm
2010-09-08 07:24:08 UTC (rev 627)
@@ -104,6 +104,12 @@
push @commandline, "-R";
$self->{OUTPUTTYPE} = "raw";
}
+ elsif ($parameters{"output"} ){
+ #unknown output type
+ $errormsg = "You choose a unknown output type: $parameters{output}.";
+ $self->{LOGGER}->error($errormsg);
+ return "ERROR", $errormsg, "error.mp.owamp";
+ }
else{
#No output type defined
$self->{OUTPUTTYPE} = "default";
@@ -158,12 +164,12 @@
my ($self, $ds, $id) = @_;
my $result = $$ds->{PARAMS}->{$id}->{MEASRESULT};
my @result = split(/\n/, $result);
- my @datalines;
my $time = time;
+ my @datalines = ();

- foreach my $resultline (@result){
- #$self->{LOGGER}->debug(Dumper($resultline));
- if ($self->{OUTPUTTYPE} eq "raw"){
+
+ if ($self->{OUTPUTTYPE} eq "raw"){
+ foreach my $resultline (@result){
if ($resultline =~
#SEQNO STIME SSYNC SERR RTIME RSYNC RERR TTL\n
/(\d+)\s*(\d+)\s*(\d+)\s(.+)\s(\d+)\s(\d+)\s(.+)\s(\d+)/){
@@ -177,16 +183,52 @@
$data_hash{"receiver_error"} = $7;
$data_hash{"TTL"} = $8;
push @datalines, \%data_hash;
+ } #End foreach
+ }#End if
+ }elsif ($self->{OUTPUTTYPE} eq "machine_readable"){
+ my $begin_buckets = 0;
+ my $begin_nreorder = 0;
+ my %data_hash = ();
+ my $linecount = 0;
+
+
+ #$self->{LOGGER}->debug(Dumper(@result));
+
+ foreach my $resultline (@result){
+ next if $resultline =~ /Approximately/;
+ next if $resultline =~ s/^\s+//;
+
+ #look if <BUCKETS> begin
+ $begin_buckets = 1 if $resultline =~ /<BUCKETS/;
+
+ #Look if <NREORDERING>
+ $begin_nreorder = 1 if $resultline =~ /<NREORDERING>/;
+
+
+ if (!$begin_buckets){
+ if (!$begin_nreorder){
+ my ($key, $value) = split (/\s+/, $resultline);
+ $data_hash{$key} = $value;
+ $linecount++;
+ if ($linecount == 24){
+ push @datalines, \%data_hash;
+ $linecount = 0;
+ }
+ }
+ }#End if (!$begin_buckets
+ else{
+ #TODO add buckets
}
- }elsif ($self->{OUTPUTTYPE} eq "machine_readable"){
- next if $resultline =~ /Approximately/;
- my %data_hash;
- my ($key, $value) = split (/\s+/, $resultline);
- $data_hash{$key} = $value;
- push @datalines, \%data_hash;
- $self->{LOGGER}->debug(Dumper($resultline));
- }
- else{
+
+ $begin_buckets = 0 if $resultline =~ /\/BUCKETS/;
+ $begin_nreorder = 0 if $resultline =~ /\/NREORDERING/;
+
+ #$self->{LOGGER}->debug(Dumper($linecount));
+ }# End foreach
+
+ }#End if
+ else{
+ foreach my $resultline (@result){
if ($resultline =~
#10 sent, 0 lost (0.000%), 0 duplicates

/(\d+)\s+sent,\s+(\d+)\s+lost\s+\((\S+)\),\s+(\d+)\s+duplicates/){
@@ -210,8 +252,9 @@
$data_hash{"error_units"} = $4;
push @datalines, \%data_hash;
} else { next; }
- }#End else
- }#End foreach my $resultline
+ }#End foreach
+ }#End else
+

if($#datalines < 0){
#no data -> something wrong, write result as error description:

Deleted: branches/perfsonar-oppd-new-architect/lib/perfSONAR/OWAMP.pm
===================================================================
--- branches/perfsonar-oppd-new-architect/lib/perfSONAR/OWAMP.pm
2010-09-02 12:40:21 UTC (rev 626)
+++ branches/perfsonar-oppd-new-architect/lib/perfSONAR/OWAMP.pm
2010-09-08 07:24:08 UTC (rev 627)
@@ -1,150 +0,0 @@
-package perfSONAR::OWAMP;
-#
-# Copyright 2010 Verein zur Foerderung eines Deutschen Forschungsnetzes e.
V.
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-#
-
-use strict;
-use warnings;
-
-#DEBUG
-use Data::Dumper;
-#DEBUG
-
-#composing of commandline and parsing of results of owamp
-
-
-sub commandline {
- my %parameters = @_;
- #print Dumper(\%parameters);
- my $commandline = "";
-
- $commandline = $commandline . " -S $parameters{src}"
if($parameters{"src"});
- $commandline = $commandline . " -c $parameters{count}"
if($parameters{"count"});
- $commandline = $commandline . " -L $parameters{timeout}"
if($parameters{"timeout"});
- $commandline = $commandline . " -s $parameters{size}"
if($parameters{"size"});
- $commandline = $commandline . " -H $parameters{PHB}"
if($parameters{"PHB"});
- $commandline = $commandline . " -D $parameters{DSCP}"
if($parameters{"DSCP"});
- $commandline = $commandline . " -i $parameters{send_schedule}"
if($parameters{"send_schedule"});
- $commandline = $commandline . " -E $parameters{enddelay}"
if($parameters{"enddelay"});
- $commandline = $commandline . " -z $parameters{startdelay}"
if($parameters{"startdelay"});
- $commandline = $commandline . " -b $parameters{bucket_width}"
if($parameters{"bucket_width"});
- $commandline = $commandline . " -N $parameters{intermediates}"
if($parameters{"intermediates"});
- $commandline = $commandline . " -v" if ($parameters{"output"} &&
($parameters{"output"} eq "per_packet"));
- $commandline = $commandline . " -M" if ($parameters{"output"} &&
($parameters{"output"} eq "machine_readable"));
- $commandline = $commandline . " -R" if ($parameters{"output"} &&
($parameters{"output"} eq "raw"));
- $commandline = $commandline . " -P $parameters{portrange}"
if($parameters{"portrange"});
- $commandline = $commandline . " -a" if($parameters{"percentile"});
- $commandline = $commandline . " -f" if($parameters{"one_way"} &&
($parameters{"one_way"} eq "from"));
- $commandline = $commandline . " -t" if($parameters{"one_way"} &&
($parameters{"one_way"} eq "to"));
- $commandline = $commandline . " $parameters{dst}" if ($parameters{"dst"});
- $commandline = $commandline . ":$parameters{port}" if
($parameters{"port"});
-
-
- print "commandline: $commandline\n";
- return $commandline;
-}
-
-sub parse_result {
- my $type = shift;
- my @result = @_;
- my @datalines;
- #print
Dumper(\@result);
-
- #output raw data:
- #SEQNO SENDTIME SSYNC SERR RECVTIME RSYNC RERR
- #if ($type eq "raw"){
- if ($type eq "ippm"){
- foreach my $resultline (@result){
- next unless ($resultline =~
- /(\d+)\s*(\d+)\s*(\d+)\s(.+)\s(\d+)\s(\d+)\s(.+)/);
- my %data_hash;
- $data_hash{"seq_number"} = $1;
- $data_hash{"send_time"} = $2;
- $data_hash{"sender_sync"} = $3;
- $data_hash{"sender_error"} = $4;
- $data_hash{"receive_time"} = $5;
- $data_hash{"receiver_sync"} = $6;
- $data_hash{"receiver_error"} = $7;
- push @datalines, \%data_hash;
- }
- #output individual delay data:
- #seq_no delay sync precision
- } elsif ($type eq "per_packet") {
- print "individual delay\n";
- foreach my $resultline (@result){
- next unless ($resultline =~
-
#/seq_no=(\d+)\s+delay=(.+)\s+(\w+)\s+\((\w+),\s+precision\s+(.+)\s+(\w+)/);
- /seq_no=(\d+)\s+delay=(.+)\s+(\w+)\s+\((\w+),\s+err=(.+)\s+(\w+)/);
- my %data_hash;
- $data_hash{"seq_number"} = $1;
- $data_hash{"delay"} = $2;
- $data_hash{"delay_units"} = $3;
- $data_hash{"sync"} = $4;
- $data_hash{"error"} = $5;
- $data_hash{"error_units"} = $6;
- push @datalines, \%data_hash;
- }
- } elsif ($type eq "machine_readable") { #TODO!
- foreach my $resultline (@result){
- next if $resultline =~ /Approximately/;
- next if $resultline =~ /BUCKETS/;
- next if $resultline =~ /^\s+/; #TODO buckets
- #$resultline =~ s/^\s+//;
- my %data_hash;
- my ($key, $value) = split (/\s+/, $resultline);
- $data_hash{$key} = $value;
- push @datalines, \%data_hash;
- }
- #output summarized (default):
- } else {
- foreach my $resultline (@result){
- if ($resultline =~
- #10 sent, 0 lost (0.000%), 0 duplicates
- #/(\d+)\spackets transmitted,\s(\d+)\spackets
lost\s\((\d+\.\d+\%)/){
- /(\d+)\s+sent,\s+(\d+)\s+lost\s+\((\S+)\),\s+(\d+)\s+duplicates/){
- my %data_hash;
- $data_hash{"number_of_packets"} = $1;
- $data_hash{"lost_packets"} = $2;
- $data_hash{"lost_percent"} = $3;
- $data_hash{"duplicate_packets"} = $4;
- push @datalines, \%data_hash;
- } elsif ($resultline =~
- #one-way delay min/median/max = 0.202/0.4/0.582 ms, (err=0.628 ms)
- /one-way delay min\/median\/max =
(\S+\/\S+\/\S+)\s+(\w+),\s+\(err=(.+)\s+(\w+)/){
- my %data_hash;
- my $delay = $1;
- my ($min,$med,$max) = split ("/", $delay);
- $data_hash{"delay_min"} = $min;
- $data_hash{"delay_med"} = $med;
- $data_hash{"delay_max"} = $max;
- $data_hash{"delay_units"} = $2;
- $data_hash{"error"} = $3;
- $data_hash{"error_units"} = $4;
- push @datalines, \%data_hash;
- } else { next; }
- }
-
- }
- if($#datalines < 0){
- #no data -> something wrong, write result as error description:
- $datalines[0]="OWPING Error:";
- foreach my $resultline (@result){
- push @datalines, $resultline;
- }
- }
- return @datalines;
-}
-1;



  • [pS-dev] [GEANT/SA2/SA2T3-OPPD] r627 - in branches/perfsonar-oppd-new-architect/lib/perfSONAR: . DataStruct MP, svn-noreply, 09/08/2010

Archive powered by MHonArc 2.6.16.

Top of Page