Skip to Content.
Sympa Menu

perfsonar-dev - [pS-dev] [GEANT/SA2/SA2T3-OPPD] r757 - branches/perfsonar-oppd-all-0.53/tools/perfSONAR-client

Subject: perfsonar development work

List archive

[pS-dev] [GEANT/SA2/SA2T3-OPPD] r757 - branches/perfsonar-oppd-all-0.53/tools/perfSONAR-client


Chronological Thread 
  • From:
  • To:
  • Subject: [pS-dev] [GEANT/SA2/SA2T3-OPPD] r757 - branches/perfsonar-oppd-all-0.53/tools/perfSONAR-client
  • Date: Wed, 11 Jul 2012 13:16:18 +0100 (BST)

Author: dfn.calim
Date: 2012-07-11 13:16:18 +0100 (Wed, 11 Jul 2012)
New Revision: 757

Added:
branches/perfsonar-oppd-all-0.53/tools/perfSONAR-client/BWCTL-Scheduler.pl

branches/perfsonar-oppd-all-0.53/tools/perfSONAR-client/BWCTL-reverse-Scheduler.pl
branches/perfsonar-oppd-all-0.53/tools/perfSONAR-client/template.xml
Modified:

branches/perfsonar-oppd-all-0.53/tools/perfSONAR-client/owamp-summary-req-01.xml
branches/perfsonar-oppd-all-0.53/tools/perfSONAR-client/perfsonar-client.pl
Log:
Adding schedule f?\195?\188r OWAMP and BWCTL MP

Added:
branches/perfsonar-oppd-all-0.53/tools/perfSONAR-client/BWCTL-Scheduler.pl
===================================================================
---
branches/perfsonar-oppd-all-0.53/tools/perfSONAR-client/BWCTL-Scheduler.pl
(rev 0)
+++
branches/perfsonar-oppd-all-0.53/tools/perfSONAR-client/BWCTL-Scheduler.pl
2012-07-11 12:16:18 UTC (rev 757)
@@ -0,0 +1,45 @@
+#!/usr/bin/perl
+
+
+my $port = 8090;
+my $tool = "perfsonar-client.pl";
+my $path = "/usr/lib/perfsonar/services/oppd/tools/perfsonar-client";
+
+my ($src, $dst) = @ARGV;
+
+if (!$src || !$dst){
+ print "usage: BWCTL-Scheduler.pl <src> <dst>";
+ exit;
+}
+
+#check if src and dst are ip-adresses
+if (!($src =~ /\d+\.\d+\.\d+\.\d+/) || !($dst =~ /\d+\.\d+\.\d+\.\d+/)){
+ print "<src> and <dst> must be IP adresses!\n";
+ exit;
+}
+
+
+my $template = "$path/template.xml";
+
+#read in template XML file, set src/dst paramters
+my $request;
+open (TEMPLATE, "$template") || die "cannot open template.xml: $!";
+while (<TEMPLATE>){
+ my $line = $_;
+ $line =~ s/endPoint type="ipv4" value="src"/endPoint type="ipv4"
value="$src"/;
+ $line =~ s/src type="ipv4" value="src"/src type="ipv4" value="$src"/;
+ $line =~ s/dst type="ipv4" value="dst"/dst type="ipv4" value="$dst"/;
+ $request .= $line;
+}
+
+print "$request";
+
+my $req_file = "/tmp/$src-$dst-request.xml";
+
+open (REQUEST, "> $req_file");
+print REQUEST $request;
+close REQUEST;
+
+my $status = `$path/$tool --reqfile=$req_file
--uri=http://$src:8090/services/MP/BWCTL --host=$src`;
+print "Status: $status\n";
+unlink $req_file;


Property changes on:
branches/perfsonar-oppd-all-0.53/tools/perfSONAR-client/BWCTL-Scheduler.pl
___________________________________________________________________
Added: svn:executable
+ *

Added:
branches/perfsonar-oppd-all-0.53/tools/perfSONAR-client/BWCTL-reverse-Scheduler.pl
===================================================================
---
branches/perfsonar-oppd-all-0.53/tools/perfSONAR-client/BWCTL-reverse-Scheduler.pl
(rev 0)
+++
branches/perfsonar-oppd-all-0.53/tools/perfSONAR-client/BWCTL-reverse-Scheduler.pl
2012-07-11 12:16:18 UTC (rev 757)
@@ -0,0 +1,45 @@
+#!/usr/bin/perl
+
+
+my $port = 8090;
+my $tool = "perfsonar-client.pl";
+my $path = "/usr/lib/perfsonar/services/oppd/tools/perfsonar-client";
+
+my ($src, $dst) = @ARGV;
+
+if (!$src || !$dst){
+ print "usage: BWCTL-Scheduler.pl <src> <dst>";
+ exit;
+}
+
+#check if src and dst are ip-adresses
+if (!($src =~ /\d+\.\d+\.\d+\.\d+/) || !($dst =~ /\d+\.\d+\.\d+\.\d+/)){
+ print "<src> and <dst> must be IP adresses!\n";
+ exit;
+}
+
+
+my $template = "$path/template.xml";
+
+#read in template XML file, set src/dst paramters
+my $request;
+open (TEMPLATE, "$template") || die "cannot open template.xml: $!";
+while (<TEMPLATE>){
+ my $line = $_;
+ $line =~ s/endPoint type="ipv4" value="src"/endPoint type="ipv4"
value="$src"/;
+ $line =~ s/src type="ipv4" value="src"/src type="ipv4" value="$src"/;
+ $line =~ s/dst type="ipv4" value="dst"/dst type="ipv4" value="$dst"/;
+ $request .= $line;
+}
+
+print "$request";
+
+my $req_file = "/tmp/$src-$dst-request.xml";
+
+open (REQUEST, "> $req_file");
+print REQUEST $request;
+close REQUEST;
+
+my $status = `$path/$tool --reqfile=$req_file
--uri=http://$dst:8090/services/MP/BWCTL --host=$dst`;
+print "Status: $status\n";
+unlink $req_file;


Property changes on:
branches/perfsonar-oppd-all-0.53/tools/perfSONAR-client/BWCTL-reverse-Scheduler.pl
___________________________________________________________________
Added: svn:executable
+ *

Modified:
branches/perfsonar-oppd-all-0.53/tools/perfSONAR-client/owamp-summary-req-01.xml
===================================================================
---
branches/perfsonar-oppd-all-0.53/tools/perfSONAR-client/owamp-summary-req-01.xml
2012-07-03 12:52:58 UTC (rev 756)
+++
branches/perfsonar-oppd-all-0.53/tools/perfSONAR-client/owamp-summary-req-01.xml
2012-07-11 12:16:18 UTC (rev 757)
@@ -13,7 +13,7 @@
<nmwg:metadata id="meta1">
<perfsonar:subject id="subj1">
<nmwgt:endPointPair>
- <nmwgt:src type="ipv4" value="131.188.81.234"/> <!-- The host
where is OWAMP M -->
+ <nmwgt:src type="ipv4" value="131.188.81.230"/> <!-- The host
where is OWAMP M -->
<nmwgt:dst type="ipv4" value="198.124.252.101"/> <!--
destination host -->
</nmwgt:endPointPair>
</perfsonar:subject>

Modified:
branches/perfsonar-oppd-all-0.53/tools/perfSONAR-client/perfsonar-client.pl
===================================================================
---
branches/perfsonar-oppd-all-0.53/tools/perfSONAR-client/perfsonar-client.pl
2012-07-03 12:52:58 UTC (rev 756)
+++
branches/perfsonar-oppd-all-0.53/tools/perfSONAR-client/perfsonar-client.pl
2012-07-11 12:16:18 UTC (rev 757)
@@ -1,7 +1,8 @@
#!/usr/bin/perl

#TODO
-# Nothing known
+# - Improvements depend on improvements to SOAP::Lite
+# Can we somehow use doc/lit support of SOAP::Lite??

use warnings;
use strict;
@@ -136,7 +137,7 @@

$result = $response->as_string(2);

- } elsif ($module eq "http" || $module eq "raw") {
+ } elsif ($module eq "http") {
require LWP::UserAgent;
require HTTP::Request;
require HTTP::Response;
@@ -145,14 +146,10 @@

my $userAgent = LWP::UserAgent->new(timeout => 5000);

- unless ($module eq "raw") {
- # For "raw" we are not adding the soap envelope
- $req = $soap_prefix . $req . $soap_suffix;
- }
my $sendSoap = HTTP::Request->new(
POST => $httpEndpoint,
new HTTP::Headers,
- $req
+ $soap_prefix . $req . $soap_suffix
);
$sendSoap->header('SOAPAction' => '""');
$sendSoap->content_type ('text/xml');
@@ -166,6 +163,34 @@
my $responseContent = $httpResponse->content();
$result = $httpResponse->as_string(2);

+ } elsif ($module eq "raw"){
+
+ require LWP::UserAgent;
+ require HTTP::Request;
+ require HTTP::Response;
+
+ my $httpEndpoint = $uri || "http://$host:$port$endpoint";;
+
+ my $userAgent = LWP::UserAgent->new(timeout => 5000);
+
+ my $sendSoap = HTTP::Request->new(
+ POST => $httpEndpoint,
+ new HTTP::Headers,
+ $req
+ );
+ $sendSoap->header('SOAPAction' => '""');
+ $sendSoap->content_type ('text/xml');
+ $sendSoap->content_length(length($req));
+ $sendSoap->protocol("HTTP/1.0");
+ $sendSoap->header('pragma' => 'no-cache');
+ $sendSoap->header('cache-control' => 'no-cache');
+ $sendSoap->header('accept' => 'application/soap+xml, application/dime,
multipart/related, text/*');
+ my $httpResponse = $userAgent->request($sendSoap);
+ my $responseCode = $httpResponse->code();
+ my $responseContent = $httpResponse->content();
+ $result = $httpResponse->as_string(2);
+
+
} else {
pod2usage("Unkown module type: $module.\n");
}
@@ -332,10 +357,8 @@

=head1 SYNOPSIS

-B<perfsonar-client.pl> S<[B<--help>]>
- S<[B<--module>|B<-m>=soap|sendReceive|http|raw]>
- ( S<B<--host>|B<-h>=HOSTNAME> S<B<--port>|B<-p>=PORT>
- S<B<--endpoint>|B<-p>=ENDPOINT> ) |
+B<perfsonar-client.pl> S<[B<--help>]> S<[B<--module>|B<-m>=nmwg|soap|http]>
+ ( S<B<--host>|B<-h>=HOSTNAME> S<B<--port>|B<-p>=PORT>
S<B<--endpoint>|B<-p>=ENDPOINT> ) |
( S<B<--uri>|B<-u>=URI> )
S<[B<--test>=set|xmldiff|...]>
S<B<--reqfile>|B<-f>=F<REQFILE>> | REQFILE1 REQFILE2 ...
@@ -359,11 +382,13 @@
Prints a help message and exits.


-=item B<--module>|B<-m>=soap|sendReceive|http|raw
+=item B<--module>|B<-m>=soap|http|nmwg

-Select method for doing the communication with the service.
+Use Perl module SOAP::Lite (soap) or Perl module LWP::UserAgent (http) for
+accessing the service.

-TODO explain them all
+IMPORTANT: SOAP::Lite only does rpc/encoded and LWP::UserAgent only does
+document/literal SOAP requests!


=item B<--host>|B<-h>=HOST

Added: branches/perfsonar-oppd-all-0.53/tools/perfSONAR-client/template.xml
===================================================================
--- branches/perfsonar-oppd-all-0.53/tools/perfSONAR-client/template.xml
(rev 0)
+++ branches/perfsonar-oppd-all-0.53/tools/perfSONAR-client/template.xml
2012-07-11 12:16:18 UTC (rev 757)
@@ -0,0 +1,41 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<nmwg:message type="SetupDataRequest"
+ id="bwctl-request"
+ xmlns="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:bwctl="http://ggf.org/ns/nmwg/tools/bwctl/2.0/";
+ xmlns:iperf="http://ggf.org/ns/nmwg/tools/iperf/2.0/";
+ xmlns:nmwgt="http://ggf.org/ns/nmwg/topology/2.0/";>
+
+ <nmwg:metadata id="bwctl-metadata">
+ <bwctl:subject id="bwctl-subject">
+ <nmwgt:endPoint type="ipv4" value="src"/>
+ </bwctl:subject>
+
+ <nmwg:eventType>http://ggf.org/ns/nmwg/tools/bwctl/2.0</nmwg:eventType>
+ <bwctl:parameters id="bwctl-parameters">
+ <nmwg:parameter name="duration" value="30"/>
+ </bwctl:parameters>
+ </nmwg:metadata>
+
+ <nmwg:metadata id="iperf-metadata">
+ <iperf:subject id="iperf-subject" metadataIdRef="bwctl-metadata">
+ <nmwgt:endPointPair>
+ <nmwgt:src type="ipv4" value="src"/>
+ <nmwgt:dst type="ipv4" value="dst"/>
+ </nmwgt:endPointPair>
+ </iperf:subject>
+ <iperf:parameters id="iperf-parameters">
+ <nmwg:parameter name="interval" value="6"/>
+ <nmwg:parameter name="protocol" value="tcp"/>
+ </iperf:parameters>
+ <nmwg:eventType>http://ggf.org/ns/nmwg/tools/iperf/2.0</nmwg:eventType>
+ </nmwg:metadata>
+
+ <!-- triggers to indicate head of chains -->
+ <nmwg:data id="1" metadataIdRef="iperf-metadata"/>
+
+
+</nmwg:message>



  • [pS-dev] [GEANT/SA2/SA2T3-OPPD] r757 - branches/perfsonar-oppd-all-0.53/tools/perfSONAR-client, svn-noreply, 07/11/2012

Archive powered by MHonArc 2.6.16.

Top of Page