Skip to Content.
Sympa Menu

perfsonar-dev - [pS-dev] [GEANT/SA2/SA2T3-OPPD] r626 - in branches/perfsonar-oppd-new-architect: etc/oppd-mdm/oppd.d lib/perfSONAR lib/perfSONAR/DataStruct lib/perfSONAR/MP tools/perfSONAR-client

Subject: perfsonar development work

List archive

[pS-dev] [GEANT/SA2/SA2T3-OPPD] r626 - in branches/perfsonar-oppd-new-architect: etc/oppd-mdm/oppd.d lib/perfSONAR lib/perfSONAR/DataStruct lib/perfSONAR/MP tools/perfSONAR-client


Chronological Thread 
  • From:
  • To:
  • Subject: [pS-dev] [GEANT/SA2/SA2T3-OPPD] r626 - in branches/perfsonar-oppd-new-architect: etc/oppd-mdm/oppd.d lib/perfSONAR lib/perfSONAR/DataStruct lib/perfSONAR/MP tools/perfSONAR-client
  • Date: Thu, 2 Sep 2010 13:40:21 +0100

Author: dfn.calim
Date: 2010-09-02 13:40:21 +0100 (Thu, 02 Sep 2010)
New Revision: 626

Added:

branches/perfsonar-oppd-new-architect/tools/perfSONAR-client/owamp-machine-req.xml
Removed:
branches/perfsonar-oppd-new-architect/lib/perfSONAR/BWCTL.pm
Modified:
branches/perfsonar-oppd-new-architect/etc/oppd-mdm/oppd.d/owamp.conf
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/Echo.pm
branches/perfsonar-oppd-new-architect/lib/perfSONAR/MP.pm
branches/perfsonar-oppd-new-architect/lib/perfSONAR/MP/OWAMP.pm

branches/perfsonar-oppd-new-architect/tools/perfSONAR-client/owamp-ind2-req.xml

branches/perfsonar-oppd-new-architect/tools/perfSONAR-client/owamp-raw-req.xml
Log:
adding some checks for owamp mp

Modified: branches/perfsonar-oppd-new-architect/etc/oppd-mdm/oppd.d/owamp.conf
===================================================================
--- branches/perfsonar-oppd-new-architect/etc/oppd-mdm/oppd.d/owamp.conf
2010-09-01 09:23:40 UTC (rev 625)
+++ branches/perfsonar-oppd-new-architect/etc/oppd-mdm/oppd.d/owamp.conf
2010-09-02 12:40:21 UTC (rev 626)
@@ -23,6 +23,7 @@
metric "bandwidth"
# Measurement metric(s). More than one element definition possible.
tool "owping" # Tool name
+ countlimit 1000 # Number of packages allowed. Not to
overflow the server

#
# Module parameters

Deleted: branches/perfsonar-oppd-new-architect/lib/perfSONAR/BWCTL.pm
===================================================================
--- branches/perfsonar-oppd-new-architect/lib/perfSONAR/BWCTL.pm
2010-09-01 09:23:40 UTC (rev 625)
+++ branches/perfsonar-oppd-new-architect/lib/perfSONAR/BWCTL.pm
2010-09-02 12:40:21 UTC (rev 626)
@@ -1,220 +0,0 @@
-package perfSONAR::BWCTL;
-#
-# 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;
-
-use IPC::Run qw( run timeout start finish pump);
-use IO::Pty;
-
-use perfSONAR qw( print_log);
-
-#DEBUG
-use Data::Dumper;
-#DEBUG
-
-#TODO Error handling
-#composing of commandline and parsing of results of bwctl
-
-sub commandline {
- my %parameters = @_;
- my @commandline;
- unless ($parameters{"src"} || $parameters{"dst"}) {
- return "ERROR", "Neither source nor destination ip address specified.";
- }
- if (!$parameters{"src"} || !$parameters{"dst"}){ #find out end point
- #my @result = `/sbin/ifconfig eth0`;
- #grep(/^\s+\w+\s+\w+\:(\d+\.\d+\.\d+\.\d+)/, @result);
- my $ip_result = `/sbin/ip addr show dev eth0 scope global primary`;
- $ip_result =~ /\n\s+inet\s+(\d+\.\d+\.\d+\.\d+)/;
- my $local_ip = $1;
- unless ($local_ip) {
- return "ERROR", "Cannot determine local ip address.";
- }
- $parameters{"src"} = $local_ip unless $parameters{"src"};
- $parameters{"dst"} = $local_ip unless $parameters{"dst"};
- if ($parameters{"src"} eq $parameters{"dst"}) {
- return "ERROR", "Measurement requested " .
- "using same local IP address as source and destination.";
- }
- }
- if ($parameters{"src"} eq $parameters{"dst"}) {
- return "ERROR", "Source ip address equal to destination ip address.";
- }
-
- #check parameters to be correct input:
- foreach my $param (keys %parameters){
- next if ($param eq "param_ns_prefix" ||
- $param eq "metaID" ||
- $param eq "subject_ns_prefix" ||
- $param eq "parameter_ID" ||
- $param eq "param_ns_uri" ||
- $param eq "subject_ns_uri");
-
- next if ($param eq "src" || $param eq "dst");
- if ($param eq "login" || $param eq "password"){
- unless ($parameters{$param} =~ /^\w+$/){
- return "ERROR", "Invalid login/password string specified.";
- }
- next;
- }
- if ($param eq "TOS"){
- unless ($parameters{$param} =~ /^\d+|0x\d+$/){
- return "ERROR", "Invalid TOS string specified.";
- }
- next;
- }
- if ($param eq "protocol"){
- unless ($parameters{$param} =~ /^udp$/i || $parameters{$param} =~
/^tcp$/i){
- return "ERROR", "Unknown protocol: $parameters{protocol}";
- }
- next;
- }
- unless ($parameters{$param} =~ /^\d+$/){
- return "ERROR", "Invalid value specified for $param.";
- }
-
- }
-
- push @commandline , "-s" , $parameters{"src"};
- push @commandline , "AE", "AESKEY" if($parameters{"login"});
- push @commandline , $parameters{login} if($parameters{"login"});
- push @commandline , "-c", $parameters{dst};
- push @commandline , "AE", "AESKEY" if($parameters{"login"});
- push @commandline , $parameters{login} if($parameters{"login"});
-
-
- push @commandline , "-i", $parameters{interval}
if($parameters{"interval"});
- push @commandline , "-t", $parameters{duration}
if($parameters{"duration"});
- push @commandline , "-w", $parameters{windowSize}
if($parameters{"windowSize"});
-
-=cut obsolete
- if (! $parameters{"protocol"}) {
- # We assume default for undef, "" and 0
- # => Do nothing
- } elsif ($parameters{"protocol"} =~ /^udp$/i) {
- push @commandline , "-u";
- } elsif ($parameters{"protocol"} =~ /^tcp$/i) {
- # tcp is default
- } else {
- return "ERROR", "Unknown protocol: $parameters{protocol}";
- }
-=cut
-
- push @commandline , "-u" if ($parameters{"protocol"} &&
$parameters{"protocol"} =~ /^udp$/i);
- push @commandline , "-l", $parameters{bufferSize}
if($parameters{"bufferSize"});
- push @commandline , "-b", $parameters{bandwidth}
if($parameters{"bandwidth"});
- push @commandline , "-S", $parameters{TOS} if($parameters{"TOS"});
- return @commandline;
-}
-
-sub do_bwctl {
- my $tool = shift;
- my $pass = shift;
- my @bwctl = @_;
-
- print_log ("info", "do_bwctl called with $tool\n");
- my ($in, $out, $err);
- unshift @bwctl, $tool;
-
- if(!$pass){
- my $command = join (" ", @bwctl);
- my $out=`$command 2>&1`;
- return $out;
- }
- my $h = start
(\@bwctl,
'<pty<', \$in, '>pty>', \$out, '2>', \$err);
- while (1){
- pump $h;
- if ($err =~ /passphrase/){
- $in = "$pass\n" ;
- $err = "";
- }
- elsif ($err ne "\n"){
- last;
- }
- }
-
- my $out_tmp = $out;
- my $err_tmp = $err;
-
- finish $h;
- if (!$out){
- return "$err_tmp" . "$err";
- }
- return "$out_tmp" . "$out";
-
-}
-sub parse_result {
- my $time = shift;
- my $result = shift;
- my @result = split(/\n/, $result);
- my @datalines;
-
- foreach my $resultline (@result){
- next unless ($resultline =~
-
/(\d+\.\d+\s*\-\s*\d+\.\d+)\s+sec\s+(\d+\.?\d*)\s+(\w+)\s+(\d+\.?\d*)\s+(\w+\/\w+)/);
-
- my %data_hash;
- $data_hash{"timeType"} = "unix";
- $data_hash{"timeValue"} = $time;
- $data_hash{"interval"} = $1;
- $data_hash{"numBytes"} = $2;
- $data_hash{"numBytesUnits"} = $3;
- $data_hash{"value"} = $4;
- $data_hash{"valueUnits"} = $5;
- push @datalines, \%data_hash;
-
- }
- if($#datalines < 0){
- #no data -> something wrong, write result as error description:
- $datalines[0]="BWCTL Error:";
- foreach my $resultline (@result){
- push @datalines, $resultline;
- }
- }
-
- return @datalines;
-}
-
-
-sub parse_header {
- my $result = shift;
- my @result = split(/\n/, $result);
- my %header;
-
- foreach my $resultline (@result){
- next if ($resultline =~
-
/(\d+\.\d+\s*\-\s*\d+\.\d+)\s+sec\s+(\d+\.?\d*)\s+(\w+)\s+(\d+\.?\d*)\s+(\w+\/\w+)/);
- #print "header: $resultline\n";
- if ($resultline =~ /TCP/){
- $header{"proto"} = "TCP";
- }
- if ($resultline =~ /UDP/){
- $header{"proto"} = "UDP";
- }
- if ($resultline =~ /TCP window size:\s*(\d+)\s*(\w+)/){
- $header{"windowsize"} = $1; #$2 is always "Byte"
- }
- if ($resultline =~ /-t\s*(\d+)/){
- $header{"duration"} = $1;
- }
- }
- return %header;
-}
-
-1;

Modified:
branches/perfsonar-oppd-new-architect/lib/perfSONAR/DataStruct/NMWG.pm
===================================================================
--- branches/perfsonar-oppd-new-architect/lib/perfSONAR/DataStruct/NMWG.pm
2010-09-01 09:23:40 UTC (rev 625)
+++ branches/perfsonar-oppd-new-architect/lib/perfSONAR/DataStruct/NMWG.pm
2010-09-02 12:40:21 UTC (rev 626)
@@ -136,9 +136,14 @@
foreach my $meta (keys %{$ds->{REQUESTMSG}->{"metadataIDs"}}){
#check for unknown eventTypes
my $et = $ds->{REQUESTMSG}->{"metadataIDs"}{$meta}{"eventType"};
- if ($et =~ /admin/){ #dispatch to Echo module
+ #look for echo
+ if ($et =~ /admin\/echo/){
$ds->{DOECHO} = 1;;
}
+ #look for selftest
+ if ($et =~ /admin\/selftest/){
+ $ds->{DOSELFTEST} = 1;;
+ }

my $found = undef;
foreach my $sup_et (@module_ets){

Modified: branches/perfsonar-oppd-new-architect/lib/perfSONAR/DataStruct.pm
===================================================================
--- branches/perfsonar-oppd-new-architect/lib/perfSONAR/DataStruct.pm
2010-09-01 09:23:40 UTC (rev 625)
+++ branches/perfsonar-oppd-new-architect/lib/perfSONAR/DataStruct.pm
2010-09-02 12:40:21 UTC (rev 626)
@@ -38,14 +38,22 @@

The structure is defined as follow:

-$self ERROROCCUR If error occur set to 1
+$self ERROROCCUR If error occur set to 1. Default 0
SERVICE The called service
SERVICES The availible services as Reference
+ REQUESTMSG A reference to the requested message type with the
handlers
+ DOECHO If echo is requested set to 1. Default 0
+ DOSELFTEST If selftest is requested set to 1. Default 0
RETURNMSG
PARAMS The measurement structure
|-$id
- |-%meaurement result The result of a measurement
- |-%parameters The parameters for a measurement
+ |-MRESULT The result of a measurement command as a array
of data hashes.
+ All requests return a array. If a call was not
succesfull,
+ ERROROCCUR set to 1 then this array is used as a
error container
+ where @[0] contains the error occurnes for
example ERROR BWCTL
+ @[lastitem] error types
+ and the lines betwenn this contains the
error messages
+


=head1 Methods

Modified: branches/perfsonar-oppd-new-architect/lib/perfSONAR/Echo.pm
===================================================================
--- branches/perfsonar-oppd-new-architect/lib/perfSONAR/Echo.pm 2010-09-01
09:23:40 UTC (rev 625)
+++ branches/perfsonar-oppd-new-architect/lib/perfSONAR/Echo.pm 2010-09-02
12:40:21 UTC (rev 626)
@@ -38,8 +38,10 @@
my $selftest_et = "http://schemas.perfsonar.net/tools/admin/selftest/1.0";;
my $response_et = "http://schemas.perfsonar.net/tools/admin/selftest/";;

+=head2 handle_echo_request()
+ This method is used from the services to return a status response for the
service
+=cut

-
sub handle_echo_request{

my ($self, $ds) = @_;
@@ -53,38 +55,11 @@
#echo request
my %data_hash;
$logger->info("Reply to EchoRequest ping");
- $data_hash{'echocode'} = "success";
+ $data_hash{'echocode'} = "success.echo";
$data_hash{'echomsg'} = "Service: $$ds->{SERVICE} is ready for call";
push @datalines, \%data_hash;
$$ds->{PARAMS}->{$id}->{MRESULT} =
\@datalines
}

- ;
-=head2
- elsif ($et =~ /$selftest_et/){
-
- #my %refs = $services{$service}->{handler}->selftest();
- my $refs = $services{$service}->{handler}->selftest();
- if (!$refs){
- print_log("notice", "error.echo: Action not supported: $et.");
- $msg->return_result_code("error.echo", "Action not supported: $et.",
$key);
- return $msg;
- }
- foreach my $name (keys %{$refs}){
- my $ref = $refs->{$name};
- my ($message, $status) = $services{$service}->{handler}->$ref;
- print_log("notice", "$message $service");
- $msg->return_result_code("$response_et$service/$name/$status/1.0",
"$message", "$key", "$name");
- }
-
- }
- else { #some different eventtype, return error
- $msg->return_result_code("error.echo", "Unknown eventType: $et", $key);
- return $msg;
- }
- #return success message
- return $msg;
- }
-=cut
}
1;

Modified: branches/perfsonar-oppd-new-architect/lib/perfSONAR/MP/OWAMP.pm
===================================================================
--- branches/perfsonar-oppd-new-architect/lib/perfSONAR/MP/OWAMP.pm
2010-09-01 09:23:40 UTC (rev 625)
+++ branches/perfsonar-oppd-new-architect/lib/perfSONAR/MP/OWAMP.pm
2010-09-02 12:40:21 UTC (rev 626)
@@ -74,6 +74,7 @@
my ($self,%parameters) = @_;
my @commandline;
my $errormsg;
+ my $ds = $self->{DS};

#$self->{LOGGER}->debug(Dumper(%parameters));

@@ -125,12 +126,18 @@
}
}
else{
- $errormsg = "No destination ip address or port specified.";
+ $errormsg = "No destination address specified.";
$self->{LOGGER}->error($errormsg);
- return "ERROR", $errormsg, "error.mp.owping";
+ return "ERROR", $errormsg, "error.mp.owamp";
}

- #$self->{LOGGER}->info(Dumper(@commandline));
+ #Check the command
+ my $countlimit = $$ds->{SERVICES}->{$$ds->{SERVICE}}->{countlimit};
+ if (int($parameters{"count"}) >int($countlimit)){
+ $errormsg = "count greater than $countlimit is not allowed. Please
change it in your request.";
+ return "ERROR", $errormsg, "error.mp.owamp";
+ }
+ #$self->{LOGGER}->info(Dumper($countlimit));

return @commandline;

@@ -155,8 +162,29 @@
my $time = time;

foreach my $resultline (@result){
- if ($self->{OUTPUTTYPE} eq "per_packet"){
-
+ #$self->{LOGGER}->debug(Dumper($resultline));
+ if ($self->{OUTPUTTYPE} eq "raw"){
+ if ($resultline =~
+ #SEQNO STIME SSYNC SERR RTIME RSYNC RERR TTL\n
+ /(\d+)\s*(\d+)\s*(\d+)\s(.+)\s(\d+)\s(\d+)\s(.+)\s(\d+)/){
+ 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;
+ $data_hash{"TTL"} = $8;
+ push @datalines, \%data_hash;
+ }
+ }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{
if ($resultline =~

Modified: branches/perfsonar-oppd-new-architect/lib/perfSONAR/MP.pm
===================================================================
--- branches/perfsonar-oppd-new-architect/lib/perfSONAR/MP.pm 2010-09-01
09:23:40 UTC (rev 625)
+++ branches/perfsonar-oppd-new-architect/lib/perfSONAR/MP.pm 2010-09-02
12:40:21 UTC (rev 626)
@@ -82,7 +82,8 @@
%{$$ds->{PARAMS}->{$id}});

if ($commandline[0] eq "ERROR") {
- $$ds->{REQUESTMSG}->return_result_code($commandline[2],
$commandline[1], $$ds->{REQUESTMSG}->{"dataIDs"}{$id}{"metaref"});
+ $$ds->{ERROROCCUR} = 1;
+ $$ds->{PARAMS}->{$id}->{MRESULT} =
\@commandline;
return;
}
#Start commandline
@@ -136,5 +137,4 @@

}

-
1;

Modified:
branches/perfsonar-oppd-new-architect/tools/perfSONAR-client/owamp-ind2-req.xml
===================================================================
---
branches/perfsonar-oppd-new-architect/tools/perfSONAR-client/owamp-ind2-req.xml
2010-09-01 09:23:40 UTC (rev 625)
+++
branches/perfsonar-oppd-new-architect/tools/perfSONAR-client/owamp-ind2-req.xml
2010-09-02 12:40:21 UTC (rev 626)
@@ -29,5 +29,22 @@
<nmwg:data id="1" metadataIdRef="meta1"/>


+ <nmwg:metadata id="meta2">
+ <perfsonar:subject id="subj2">
+ <nmwgt:endPointPair>
+ <nmwgt:src type="ipv4" value="131.188.81.34"/>
+ <nmwgt:dst type="ipv4" value="142.104.63.180"/>
+ </nmwgt:endPointPair>
+ </perfsonar:subject>
+
+ <nmwg:eventType>owamp</nmwg:eventType>
+ <nmwg:parameters id="param2">
+ <nmwg:parameter name="port" value="861"/>
+ <nmwg:parameter name="count" value="200"/>
+ </nmwg:parameters>
+ </nmwg:metadata>
+
+ <!-- triggers to indicate head of chains -->
+ <nmwg:data id="2" metadataIdRef="meta2"/>
</nmwg:message>


Added:
branches/perfsonar-oppd-new-architect/tools/perfSONAR-client/owamp-machine-req.xml
===================================================================
---
branches/perfsonar-oppd-new-architect/tools/perfSONAR-client/owamp-machine-req.xml
(rev 0)
+++
branches/perfsonar-oppd-new-architect/tools/perfSONAR-client/owamp-machine-req.xml
2010-09-02 12:40:21 UTC (rev 626)
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<nmwg:message type="SetupDataRequest"
+ id="datarq2-1"
+ xmlns="http://ggf.org/ns/nmwg/tools/org/perfsonar/1.0/";
+
xmlns:perfsonar="http://ggf.org/ns/nmwg/tools/org/perfsonar/1.0/";
+ xmlns:nmwg="http://ggf.org/ns/nmwg/base/2.0/";
+ xmlns:nmtm="http://ggf.org/ns/nmwg/time/2.0/";
+ xmlns:select="http://ggf.org/ns/nmwg/ops/select/2.0/";
+ xmlns:nmwgt="http://ggf.org/ns/nmwg/topology/2.0/";>
+
+ <nmwg:metadata id="meta1">
+ <perfsonar:subject id="subj1">
+ <nmwgt:endPointPair>
+ <nmwgt:src type="ipv4" value="131.188.81.34"/>
+ <nmwgt:dst type="ipv4" value="131.188.81.178"/>
+ </nmwgt:endPointPair>
+ </perfsonar:subject>
+
+ <nmwg:eventType>owamp</nmwg:eventType>
+ <nmwg:parameters id="param1">
+ <nmwg:parameter name="output" value="machine_readable"/>
+ <nmwg:parameter name="count" value="10"/>
+ </nmwg:parameters>
+ </nmwg:metadata>
+
+ <!-- triggers to indicate head of chains -->
+ <nmwg:data id="1" metadataIdRef="meta1"/>
+
+
+</nmwg:message>
+

Modified:
branches/perfsonar-oppd-new-architect/tools/perfSONAR-client/owamp-raw-req.xml
===================================================================
---
branches/perfsonar-oppd-new-architect/tools/perfSONAR-client/owamp-raw-req.xml
2010-09-01 09:23:40 UTC (rev 625)
+++
branches/perfsonar-oppd-new-architect/tools/perfSONAR-client/owamp-raw-req.xml
2010-09-02 12:40:21 UTC (rev 626)
@@ -12,15 +12,15 @@
<nmwg:metadata id="meta1">
<perfsonar:subject id="subj1">
<nmwgt:endPointPair>
- <nmwgt:src type="ipv4" value="131.188.81.61"/>
- <nmwgt:dst type="ipv4" value="131.188.81.14"/>
+ <nmwgt:src type="ipv4" value="131.188.81.34"/>
+ <nmwgt:dst type="ipv4" value="131.188.81.178"/>
</nmwgt:endPointPair>
</perfsonar:subject>

<nmwg:eventType>owamp</nmwg:eventType>
<nmwg:parameters id="param1">
- <nmwg:parameter name="raw" value="yes"/>
- <nmwg:parameter name="port" value="6767"/>
+ <nmwg:parameter name="output" value="raw"/>
+ <nmwg:parameter name="count" value="10"/>
</nmwg:parameters>
</nmwg:metadata>




  • [pS-dev] [GEANT/SA2/SA2T3-OPPD] r626 - in branches/perfsonar-oppd-new-architect: etc/oppd-mdm/oppd.d lib/perfSONAR lib/perfSONAR/DataStruct lib/perfSONAR/MP tools/perfSONAR-client, svn-noreply, 09/02/2010

Archive powered by MHonArc 2.6.16.

Top of Page