Skip to Content.
Sympa Menu

perfsonar-dev - perfsonar: r2321 - in trunk/perfsonar: ant ant/clmp src/org/perfsonar/service/measurementPoint/commandLine src/org/perfsonar/service/measurementPoint/commandLine/tools

Subject: perfsonar development work

List archive

perfsonar: r2321 - in trunk/perfsonar: ant ant/clmp src/org/perfsonar/service/measurementPoint/commandLine src/org/perfsonar/service/measurementPoint/commandLine/tools


Chronological Thread 
  • From:
  • To:
  • Subject: perfsonar: r2321 - in trunk/perfsonar: ant ant/clmp src/org/perfsonar/service/measurementPoint/commandLine src/org/perfsonar/service/measurementPoint/commandLine/tools
  • Date: Thu, 5 Apr 2007 10:38:51 -0400

Author: fernandes
Date: 2007-04-05 10:38:51 -0400 (Thu, 05 Apr 2007)
New Revision: 2321

Removed:
trunk/perfsonar/ant/perfsonar-install.xml
Modified:
trunk/perfsonar/ant/clmp/clmp-axis-deploy-targets.xml
trunk/perfsonar/ant/clmp/clmp-client-run-targets.xml
trunk/perfsonar/ant/clmp/clmp-configure-targets.xml
trunk/perfsonar/ant/clmp/clmp-libs-download-targets.xml
trunk/perfsonar/ant/clmp/clmp-pre-install-targets.xml

trunk/perfsonar/src/org/perfsonar/service/measurementPoint/commandLine/CommandLineExec.java

trunk/perfsonar/src/org/perfsonar/service/measurementPoint/commandLine/CommandLineToolBundleFactory.java

trunk/perfsonar/src/org/perfsonar/service/measurementPoint/commandLine/tools/Bwctl.java

trunk/perfsonar/src/org/perfsonar/service/measurementPoint/commandLine/tools/Owamp.java

trunk/perfsonar/src/org/perfsonar/service/measurementPoint/commandLine/tools/Ping.java

trunk/perfsonar/src/org/perfsonar/service/measurementPoint/commandLine/tools/Traceroute.java
Log:
merging latest CL-MP version from CL-MP-STABLE to trunk

Modified: trunk/perfsonar/ant/clmp/clmp-axis-deploy-targets.xml
===================================================================
--- trunk/perfsonar/ant/clmp/clmp-axis-deploy-targets.xml 2007-04-05
13:03:07 UTC (rev 2320)
+++ trunk/perfsonar/ant/clmp/clmp-axis-deploy-targets.xml 2007-04-05
14:38:51 UTC (rev 2321)
@@ -21,14 +21,6 @@

<target name="copy-jars-for-clmp" depends="copy-jars-for-service">

- <copy
file="./lib/repository/commons-digester/commons-digester/1.7/commons-digester-1.7.jar"
todir="${service.home}/${deploy.root}/WEB-INF/lib"/>
- <copy
file="./lib/repository/commons-beanutils/commons-beanutils/1.7.0/commons-beanutils-1.7.0.jar"
todir="${service.home}/${deploy.root}/WEB-INF/lib"/>
- <copy
file="./lib/repository/commons-collections/commons-collections/3.2/commons-collections-3.2.jar"
todir="${service.home}/${deploy.root}/WEB-INF/lib"/>
-
- <copy file="./lib/repository/net/sf/saxon/saxon/8.7/saxon-8.7.jar"

todir="${service.home}/${deploy.root}/WEB-INF/lib"/>
- <copy
file="./lib/repository/net/sf/saxon/saxon-jdom/8.7/saxon-jdom-8.7.jar"
todir="${service.home}/${deploy.root}/WEB-INF/lib"/>
- <copy
file="./lib/repository/net/sf/saxon/saxon-dom/8.7/saxon-dom-8.7.jar"
todir="${service.home}/${deploy.root}/WEB-INF/lib"/>
-
<copy file="./conf/wsdd/${wsdd.file.deploy}"

todir="${service.home}/${deploy.root}/wsdd"/>
<copy file="./conf/wsdd/${wsdd.file.undeploy}"

todir="${service.home}/${deploy.root}/wsdd"/>

@@ -37,14 +29,6 @@

<target name="delete-jars-for-clmp" depends="delete-jars-for-service">

- <delete
file="${service.home}/${deploy.root}/WEB-INF/lib/commons-digester-1.7.jar"/>
- <delete
file="${service.home}/${deploy.root}/WEB-INF/lib/commons-beanutils-1.7.0.jar"/>
- <delete
file="${service.home}/${deploy.root}/WEB-INF/lib/commons-collections-3.2.jar"/>
-
- <delete
file="${service.home}/${deploy.root}/WEB-INF/lib/saxon-8.7.jar"/>
- <delete
file="${service.home}/${deploy.root}/WEB-INF/lib/saxon-jdom-8.7.jar"/>
- <delete
file="${service.home}/${deploy.root}/WEB-INF/lib/saxon-dom-8.7.jar"/>
-
<delete
file="${service.home}/${deploy.root}/wsdd/${wsdd.file.deploy}" />
<delete
file="${service.home}/${deploy.root}/wsdd/${wsdd.file.undeploy}" />


Modified: trunk/perfsonar/ant/clmp/clmp-client-run-targets.xml
===================================================================
--- trunk/perfsonar/ant/clmp/clmp-client-run-targets.xml 2007-04-05
13:03:07 UTC (rev 2320)
+++ trunk/perfsonar/ant/clmp/clmp-client-run-targets.xml 2007-04-05
14:38:51 UTC (rev 2321)
@@ -28,8 +28,8 @@
<java classname="org.perfsonar.client.testHarness.SOAPClient"
classpathref="classpath" fork="true">
<arg value="${clmp.local}"/>
- <arg
value="${basedir}/schema/example-instances/sonar/CommandLineMP-Ping-Request.xml"/>
- <arg
value="${basedir}/schema/example-instances/sonar/response.xml"/>
+ <arg
value="${basedir}/schema/example-instances/perfSONAR/cliTypeMP/CommandLineMP-Ping-Request.xml"/>
+ <arg
value="${basedir}/schema/example-instances/perfSONAR/cliTypeMP/response.xml"/>

<classpath>
<pathelement location="build/perfSONAR-generic.jar"/>
@@ -38,8 +38,8 @@
</java>

<echo>Test ended successfully.</echo>
- <echo>Message used for request:
${basedir}/schema/example-instances/sonar/CommandLineMP-Ping-Request.xml</echo>
- <echo>You can check the response at:
${basedir}/schema/example-instances/sonar/response.xml</echo>
+ <echo>Message used for request:
${basedir}/schema/example-instances/perfSONAR/cliTypeMP/CommandLineMP-Ping-Request.xml</echo>
+ <echo>You can check the response at:
${basedir}/schema/example-instances/perfSONAR/cliTypeMP/response.xml</echo>

</target>

@@ -50,8 +50,8 @@
<java classname="org.perfsonar.client.testHarness.SOAPClient"
classpathref="classpath" fork="true">
<arg value="${clmp.local}"/>
- <arg
value="${basedir}/schema/example-instances/sonar/Echo-Req.xml"/>
- <arg
value="${basedir}/schema/example-instances/sonar/response.xml"/>
+ <arg
value="${basedir}/schema/example-instances/perfSONAR/Echo-Req.xml"/>
+ <arg
value="${basedir}/schema/example-instances/perfSONAR/response.xml"/>
</java>

</target>

Modified: trunk/perfsonar/ant/clmp/clmp-configure-targets.xml
===================================================================
--- trunk/perfsonar/ant/clmp/clmp-configure-targets.xml 2007-04-05 13:03:07
UTC (rev 2320)
+++ trunk/perfsonar/ant/clmp/clmp-configure-targets.xml 2007-04-05 14:38:51
UTC (rev 2321)
@@ -15,27 +15,17 @@
<project name="clmp-configure-targets">


-
- <property name="service.name" value="perfSONAR-CLMP-1.1-beta" />
+ <property file="ant/const.properties" />
<property name="deploy.root" value="${service.name}" />


- <!-- creating const.properties file -->

+ <target name="set-const-properties-for-clmp">

- <target name="set-const-properties-for-clmp"
- depends="get-server-address,
- get-server-port,
- get-tomcat-directory">
-
<propertyfile file="ant/const.properties"
comment="This file was created by the Ant
configuration script.">

- <entry key="service.name" value="${service.name}"/>
<entry key="deploy.root" value="${deploy.root}"/>
- <entry key="tomcat.home" value="${tomcat.install.location}"/>
- <entry key="target.server" value="${server.address}"/>
- <entry key="target.port" value="${server.port}"/>
<entry key="webservice.name" value="CommandLineService"/>
<entry key="build" value="build"/>
<entry key="package.root" value="org/perfsonar"/>
@@ -63,15 +53,13 @@
comment="This file was created by the Ant
configuration script.">

<entry key="service.r.type" value="mp"/>
- <entry key="service.r.access_point"
value="http://${target.server}:${target.port}/${deploy.root}/services/${webservice.name}"/>
<entry key="service.r.service_name" value="Command Line
Measurement Point"/>
<entry key="service.r.service_type" value="CL MP"/>
<entry key="service.r.service_description" value="Command Line
MP, perfSONAR project"/>

- <entry key="service.log.log4j.config"
value="${basedir}/conf/log4j.properties"/>
- <entry key="service.sax_parser.config"
value="${basedir}/src/objects.config"/>
-
- <entry key="service.mp.message_types"
value="MeasurementRequest"/>
+ <entry key="service.log.log4j.config"
value="${service.home}/${deploy.root}/WEB-INF/classes/perfsonar/conf/log4j.properties"/>
+ <entry key="service.sax_parser.config"
value="${service.home}/${deploy.root}/WEB-INF/classes/perfsonar/conf/objects.config"/>
+ <entry key="service.mp.message_types"
value="MeasurementRequest,EchoRequest"/>
<entry key="service.mp.class_name"
value="org.perfsonar.service.measurementPoint.commandLine.CommandLineMPServiceEngine"/>

<entry key="service.ls.registration_file"
value=""/>

Modified: trunk/perfsonar/ant/clmp/clmp-libs-download-targets.xml
===================================================================
--- trunk/perfsonar/ant/clmp/clmp-libs-download-targets.xml 2007-04-05
13:03:07 UTC (rev 2320)
+++ trunk/perfsonar/ant/clmp/clmp-libs-download-targets.xml 2007-04-05
14:38:51 UTC (rev 2321)
@@ -23,14 +23,9 @@


<target name="libs-for-clmp" depends="init-libs">
- <artifact:dependencies>
- <dependency groupId="commons-digester"
artifactId="commons-digester" version="1.7"/>
- <dependency groupId="net.sf.saxon" artifactId="saxon"
version="8.7"/>
- <dependency groupId="net.sf.saxon" artifactId="saxon-jdom"
version="8.7"/>
- <dependency groupId="net.sf.saxon" artifactId="saxon-dom"
version="8.7"/>
-
- <localRepository refid="local.repository"/>
- <remoteRepository refid="remote.repository"/>
+ <artifact:dependencies>
+ <localRepository refid="local.repository"/>
+ <remoteRepository refid="remote.repository"/>
</artifact:dependencies>
</target>


Modified: trunk/perfsonar/ant/clmp/clmp-pre-install-targets.xml
===================================================================
--- trunk/perfsonar/ant/clmp/clmp-pre-install-targets.xml 2007-04-05
13:03:07 UTC (rev 2320)
+++ trunk/perfsonar/ant/clmp/clmp-pre-install-targets.xml 2007-04-05
14:38:51 UTC (rev 2321)
@@ -14,19 +14,23 @@


<project name="clmp-pre-install-targets">
+ <property name="service.name" value="perfSONAR-CLMP-1.0" />

-
<!-- the main target -->


<target name="pre-install">
-
- <echo>Preparing the installation of ${service.name}...</echo>
-
+ <echo>Preparing the installation of CLMP...</echo>
+ <echo />
+ <echo>Answer to all questions. If you go wrong, cancel (ctrl-c) and
start again.</echo>
+ <echo />
+
+ <antcall target="get-service-name"/>
<antcall target="get-service-home"/>
-
<antcall target="webservice-container-download"/>
-
+ <antcall target="get-server-address"/>
+ <antcall target="get-server-port"/>
+
</target>



Deleted: trunk/perfsonar/ant/perfsonar-install.xml

Modified:
trunk/perfsonar/src/org/perfsonar/service/measurementPoint/commandLine/CommandLineExec.java
===================================================================
---
trunk/perfsonar/src/org/perfsonar/service/measurementPoint/commandLine/CommandLineExec.java
2007-04-05 13:03:07 UTC (rev 2320)
+++
trunk/perfsonar/src/org/perfsonar/service/measurementPoint/commandLine/CommandLineExec.java
2007-04-05 14:38:51 UTC (rev 2321)
@@ -255,7 +255,7 @@

public void waitFor(
int timeout
- )
+ ) throws SystemException
{
long curr_time = System.currentTimeMillis();
long end_time = curr_time + timeout;
@@ -296,7 +296,7 @@
err.interrupt();
}

- return;
+ throw new SystemException("error.mp.clmp.exec", "The request timed
out (configured timeout: "+timeout+"ms).");
}

public void run_synchronous(
@@ -305,7 +305,7 @@
) throws IOException, SystemException
{
if(cmdarr.length < 1){
- throw new SystemException("CommandLineExec: null cmd specified");
+ throw new SystemException("error.mp.clmp.exec",
"CommandLineExec: null cmd specified");
}
this.cmdarr = cmdarr;


Modified:
trunk/perfsonar/src/org/perfsonar/service/measurementPoint/commandLine/CommandLineToolBundleFactory.java
===================================================================
---
trunk/perfsonar/src/org/perfsonar/service/measurementPoint/commandLine/CommandLineToolBundleFactory.java
2007-04-05 13:03:07 UTC (rev 2320)
+++
trunk/perfsonar/src/org/perfsonar/service/measurementPoint/commandLine/CommandLineToolBundleFactory.java
2007-04-05 14:38:51 UTC (rev 2321)
@@ -89,7 +89,7 @@
if (m2c == null){
logger.error("CommandLineToolBundleFactory: hashtable not
created");

- throw new SystemException("error.mp.clmp.toolFactory.hashtable",
+ throw new
SystemException("error.mp.clmp.system.toolFactory.hashtable",
"CommandLineToolBundleFactory: "
+ "Could not create tools hashtable. "
+ "Cannot continue with the request");
@@ -100,6 +100,13 @@
String eventString = eventType.getEventType();
String className = (String) m2c.get(eventString.toUpperCase());

+ if (className == null){
+ throw new SystemException("error.mp.clmp.unsupported_tool",
+ "The requested tool isn't currently supported by the
CL-MP. " +
+ "The following events are supported: owamp, bwctl,
ping and traceroute."
+ );
+ }
+
logger.debug("CommandLineToolBundleFactory: classname asked for is "
+ className);


Modified:
trunk/perfsonar/src/org/perfsonar/service/measurementPoint/commandLine/tools/Bwctl.java
===================================================================
---
trunk/perfsonar/src/org/perfsonar/service/measurementPoint/commandLine/tools/Bwctl.java
2007-04-05 13:03:07 UTC (rev 2320)
+++
trunk/perfsonar/src/org/perfsonar/service/measurementPoint/commandLine/tools/Bwctl.java
2007-04-05 14:38:51 UTC (rev 2321)
@@ -16,31 +16,28 @@
*/
package org.perfsonar.service.measurementPoint.commandLine.tools;

-import java.io.FileReader;
import java.io.BufferedReader;
-import java.io.InputStreamReader;
+import java.io.File;
import java.io.FileInputStream;
+import java.io.FileReader;
import java.io.IOException;
-
+import java.io.InputStreamReader;
+import java.util.ArrayList;
import java.util.Hashtable;
-import java.util.ArrayList;
-
import java.util.regex.Matcher;
import java.util.regex.Pattern;

+import org.ggf.ns.nmwg.base.v2_0.Data;
import org.ggf.ns.nmwg.base.v2_0.Message;
-import org.ggf.ns.nmwg.base.v2_0.Data;
import org.ggf.ns.nmwg.base.v2_0.Metadata;
+import org.ggf.ns.nmwg.base.v2_0.Parameter;
import org.ggf.ns.nmwg.base.v2_0.Parameters;
-import org.ggf.ns.nmwg.base.v2_0.Parameter;
import org.ggf.ns.nmwg.tools.bwctl.v2_0.Datum;
-
-import org.perfsonar.service.commons.exceptions.RequestException;
-import org.perfsonar.service.commons.exceptions.SystemException;
import org.perfsonar.commons.auxiliary.AuxiliaryComponentManager;
import org.perfsonar.commons.auxiliary.ComponentNames;
-import
org.perfsonar.commons.auxiliary.components.configuration.ConfigurationComponent;
import org.perfsonar.commons.auxiliary.components.logger.LoggerComponent;
+import org.perfsonar.service.commons.exceptions.RequestException;
+import org.perfsonar.service.commons.exceptions.SystemException;
import org.perfsonar.service.measurementPoint.commandLine.CommandLineExec;
import
org.perfsonar.service.measurementPoint.commandLine.CommandLineResourceProtector;
import
org.perfsonar.service.measurementPoint.commandLine.CommandLineToolBundle;
@@ -135,15 +132,40 @@

org.ggf.ns.nmwg.tools.bwctl.v2_0.Subject sub =
(org.ggf.ns.nmwg.tools.bwctl.v2_0.Subject) subject.getSubject();
+
+ if (sub == null){
+ throw new
SystemException("error.mp.clmp.validator.malformed_request",
+ "The request message metadata must have a subject
element with " +
+ "an endPointPair element. The endPointPair element must
have at" +
+ " least a dst element."
+ );
+ }
+
org.ggf.ns.nmwg.topology.v2_0.EndPointPair end =
sub.getEndPointPair();
+
+ if (end == null){
+ throw new
SystemException("error.mp.clmp.validator.malformed_request",
+ "The request message must have an endPointPair element
inside " +
+ "the subject element of its metadata. The endPointPair
element" +
+ " must have at least a dst element."
+ );
+ }
+
org.ggf.ns.nmwg.topology.v2_0.Dst dst = end.getDestinationElement();
org.ggf.ns.nmwg.topology.v2_0.Src src = end.getSourceElement();

//String tmpFolder = System.getProperty("java.io.tmpdir");

- Parameters params = subject.getParameters();
+ Parameters params = subject.getParameters();
Parameter p = null;

+ if (params == null){
+ throw new
SystemException("error.mp.clmp.validator.malformed_request",
+ "The request message metadata must have a parameters
element. If " +
+ "no parameters are wanted, an empty parameters element
must exist."
+ );
+ }
+
/*
* Build cmd array
*/
@@ -177,7 +199,10 @@

// Check for dst addr
if(dst == null){
- //TODO: throw request exception
+ throw new
SystemException("error.mp.clmp.validator.malformed_request",
+ "The endPointPair element must have at least a
dst element. " +
+ "The dst element informs the destination IP
address."
+ );
}
else{
if (dst.getPort().length() > 0) {
@@ -196,8 +221,9 @@
cmd.add("-u");
else if
(p.getParameterValue().toLowerCase().equals("tcp")) {
} else
- //throw exception
- ;
+ throw new
SystemException("error.mp.clmp.validator.malformed_request",
+ "Parameter protocol must be 'tcp' or
'udp'."
+ );
} else {
//default TCP test
}
@@ -249,18 +275,17 @@
* TODO: convert from string response into data elements
*/

- return parseResultMessage(datums, mdArr);
+ return parseResultMessage(datums, mdArr, subject);
}

- private Message parseResultMessage(Datum[][] datums, Metadata[]
metadata) {
- Message respMess = null;
+ private Message parseResultMessage(Datum[][] datums, Metadata[]
metadata, Metadata subject) {
+ Message respMess = new Message();

- respMess = new Message();
- respMess.setType("MeasurementResponse");
-
Parameters params = null;
Parameter p = null;

+ respMess.addChild(subject);
+
for (int j = 0; j < metadata.length; j++) {

if (metadata[j].getSubject() != null)
@@ -280,7 +305,7 @@
}
}
}
-
+ respMess.setType("MeasurementResponse");
return respMess;
}

@@ -297,7 +322,7 @@
return respMess;
}

- private Datum[][] parseResults(CommandLineExec cle) {
+ private Datum[][] parseResults(CommandLineExec cle) throws
SystemException{
String datumRegex =
"[^]]*[^0-9]*([0-9]*\\.[0-9]*)\\-[^0-9]*([0-9]*\\.[0-9]*)[^a-zA-Z]*([a-zA-Z]*)[^0-9]*([0-9]*)[^a-zA-Z]*([a-zA-Z]*)[^0-9]*([0-9]*)[^a-zA-Z]*([a-zA-Z\\/]*)([^0-9]*([0-9]*\\.[0-9]*)[^a-zA-Z]*([a-zA-Z]*)[^0-9]*([0-9]*)\\/[^0-9]*([0-9]*)[^\\(]*\\(([0-9]*))?.*";
Pattern datumPattern = Pattern.compile(datumRegex);

@@ -343,8 +368,11 @@
datumList[0] = new ArrayList();
datumList[1] = new ArrayList();

+ File os = cle.getOsFile();
+ File es = cle.getEsFile();
+
try{
- FileInputStream fis = new FileInputStream(cle.getOsFile());
+ FileInputStream fis = new FileInputStream(os);
InputStreamReader isr = new InputStreamReader(fis);
BufferedReader br = new BufferedReader(isr);

@@ -354,6 +382,16 @@
Matcher matcher = null;
int idxDatumList;

+ if (cle.getOsFile().length() < 2){
+ logger.debug(
+ CNAME + ": Got empty out response for the
request. Check the error file "+ es.getName()
+ );
+ throw new
SystemException("error.mp.clmp.system.tool_response",
+ "The tool returned no response data. This might
be caused by a wrong parameter syntax " +
+ "or this tool might not be available at the
server."
+ );
+ }
+
while( (line = br.readLine()) != null){
System.out.println(line);
if (line.endsWith("bw")) {
@@ -466,18 +504,53 @@

datumList[idxDatumList].add(datum);
}
}
- } catch (IOException e) {
- }
-
+ } catch (IOException e) {
+ logger.debug(
+ CNAME + ": IOException
ocurred while processing response. " +
+ "Related files: "+ os.getName() + "
and "+ es.getName()
+ );
+ throw new
SystemException("error.mp.clmp.system.ioexception.bwctl",
+ "An error ocurred while trying to parse
the results of the request. Please try again. " +
+ "If this problem persists, contact the
service administrator."
+ );
+ }
+
+ try {
+ File tmp = new File(line);
+ if (tmp != null){
+ tmp.delete();
+ }
+ }catch(Exception e){
+
+ }
}
}
br.close();
+ isr.close();
+ fis.close();
}
catch(IOException ioe)
{
- //Define how to handle this Exceptions
+ logger.debug(
+ CNAME + ": IOException ocurred while
processing response. " +
+ "Related files: "+ os.getName() + " and "+
es.getName()
+ );
+ throw new
SystemException("error.mp.clmp.system.ioexception.bwctl",
+ "An error ocurred while trying to parse the results of
the request. Please try again. " +
+ "If this problem persists, contact the service
administrator."
+ );
}

+ try {
+
+ if (os != null)
+ os.delete();
+ if (es != null)
+ es.delete();
+ }catch(Exception e){
+
+ }
+
Datum[][] datums = new Datum[datumList.length][];

datums[0] = new Datum[datumList[0].size()];
@@ -509,12 +582,9 @@
toolOptions.put("dynamicWindowSize","-W:");
toolOptions.put("concurrentConnections","-P:");
toolOptions.put("tos","-S:");
+ toolOptions.put("unsynchronized","-a:novalue");
toolOptions.put("bandwidth","-b:");
toolOptions.put("duration","-t:");
- toolOptions.put("sessionInterval","-I:");
- toolOptions.put("testNumber","-n:");
- toolOptions.put("randomize","-R:");
- toolOptions.put("latestDelay","-L:");

}
}

Modified:
trunk/perfsonar/src/org/perfsonar/service/measurementPoint/commandLine/tools/Owamp.java
===================================================================
---
trunk/perfsonar/src/org/perfsonar/service/measurementPoint/commandLine/tools/Owamp.java
2007-04-05 13:03:07 UTC (rev 2320)
+++
trunk/perfsonar/src/org/perfsonar/service/measurementPoint/commandLine/tools/Owamp.java
2007-04-05 14:38:51 UTC (rev 2321)
@@ -17,6 +17,7 @@
package org.perfsonar.service.measurementPoint.commandLine.tools;

import java.io.BufferedReader;
+import java.io.File;
import java.io.InputStreamReader;
import java.io.FileInputStream;
import java.io.IOException;
@@ -97,13 +98,38 @@

org.ggf.ns.nmwg.tools.owamp.v2_0.Subject sub =
(org.ggf.ns.nmwg.tools.owamp.v2_0.Subject) mdArr[0].getSubject();
+
+ if (sub == null){
+ throw new
SystemException("error.mp.clmp.validator.malformed_request",
+ "The request message metadata must have a subject
element with " +
+ "an endPointPair element. The endPointPair element must
have at" +
+ " least a dst element."
+ );
+ }
+
org.ggf.ns.nmwg.topology.v2_0.EndPointPair end =
sub.getEndPointPair();
+
+ if (end == null){
+ throw new
SystemException("error.mp.clmp.validator.malformed_request",
+ "The request message must have an endPointPair element
inside " +
+ "the subject element of its metadata. The endPointPair
element" +
+ " must have at least a dst element."
+ );
+ }
+
org.ggf.ns.nmwg.topology.v2_0.Dst dst = end.getDestinationElement();
org.ggf.ns.nmwg.topology.v2_0.Src src = end.getSourceElement();

Parameters params = mdArr[0].getParameters();
Parameter p = null;

+ if (params == null){
+ throw new
SystemException("error.mp.clmp.validator.malformed_request",
+ "The request message metadata must have a parameters
element. If " +
+ "no parameters are wanted, an empty parameters element
must exist."
+ );
+ }
+
/*
* Build cmd array
*/
@@ -125,18 +151,27 @@
else if
(p.getParameterValue().toLowerCase().equals("to")) {
cmd.add("-t");
} else
- //throw exception
- ;
+ throw new
SystemException("error.mp.clmp.validator.malformed_request",
+ "Parameter direction must be 'from' or
'to'."
+ );
} else {
- //default both directions test
+ cmd.add("-t");
}
}

cmd = cl.checkParameters(cmd, params, toolOptions);

+ if(src != null){
+ cmd.add("-S");
+ cmd.add(src.getValue());
+ }
+
// Check for dst addr
if(dst == null){
- //TODO: throw request exception
+ throw new
SystemException("error.mp.clmp.validator.malformed_request",
+ "The endPointPair element must have at least a
dst element. " +
+ "The dst element informs the destination IP
address."
+ );
}
else{
cmd.add(dst.getValue());
@@ -210,7 +245,7 @@
return respMess;
}

- private Datum[] parseResults(CommandLineExec cle) {
+ private Datum[] parseResults(CommandLineExec cle) throws SystemException{
//0 14401306382784727093 1 2.15625 14401306380491903908 1 0.0544434
255
String datumRegex = "([0-9]*) ([0-9]*) ([0-9]) ([0-9\\.[Ee]\\-?]*)
([0-9]*) ([0-9]) ([0-9\\.[Ee]\\-?]*) ([0-9]*)";
Pattern datumPattern = Pattern.compile(datumRegex);
@@ -226,8 +261,11 @@

ArrayList datumList = new ArrayList();

+ File os = cle.getOsFile();
+ File es = cle.getEsFile();
+
try{
- FileInputStream fis = new FileInputStream(cle.getOsFile());
+ FileInputStream fis = new FileInputStream(os);
InputStreamReader isr = new InputStreamReader(fis);
BufferedReader br = new BufferedReader(isr);

@@ -235,6 +273,17 @@

String line = null;
Matcher matcher = null;
+
+ if (cle.getOsFile().length() < 2){
+ logger.debug(
+ CNAME + ": Got empty out response for the
request. Check the error file "+ es.getName()
+ );
+ throw new
SystemException("error.mp.clmp.system.tool_response",
+ "The tool returned no response data. This might
be caused by a wrong parameter syntax " +
+ "or this tool might not be available at the
server."
+ );
+ }
+
while( (line = br.readLine()) != null){
matcher = datumPattern.matcher(line);
System.out.println(line);
@@ -264,12 +313,30 @@
}
}
br.close();
+ isr.close();
+ fis.close();
}
catch(IOException ioe)
{
- //Define how to handle this Exceptions
+ logger.debug(
+ CNAME + ": IOException ocurred while
processing response. " +
+ "Related files: "+ os.getName() + " and "+
es.getName()
+ );
+ throw new
SystemException("error.mp.clmp.system.ioexception.owamp",
+ "An error ocurred while trying to parse the results of
the request. Please try again. " +
+ "If this problem persists, contact the service
administrator."
+ );
}

+ try {
+
+ if (os != null)
+ os.delete();
+ if (es != null)
+ es.delete();
+ }catch(Exception e){
+ }
+
Datum[] datums = new Datum[datumList.size()];
datumList.toArray(datums);

@@ -294,8 +361,8 @@
toolOptions.put("phb","-H:");
toolOptions.put("wait","-i:");
toolOptions.put("timeOut","-L:");
- toolOptions.put("padding","-s:");
- toolOptions.put("delayStart","-z:");
+ toolOptions.put("padding","-s:");
toolOptions.put("portRange","-P:");
+ toolOptions.put("endDelay","-E:");
}
}

Modified:
trunk/perfsonar/src/org/perfsonar/service/measurementPoint/commandLine/tools/Ping.java
===================================================================
---
trunk/perfsonar/src/org/perfsonar/service/measurementPoint/commandLine/tools/Ping.java
2007-04-05 13:03:07 UTC (rev 2320)
+++
trunk/perfsonar/src/org/perfsonar/service/measurementPoint/commandLine/tools/Ping.java
2007-04-05 14:38:51 UTC (rev 2321)
@@ -17,6 +17,7 @@
package org.perfsonar.service.measurementPoint.commandLine.tools;

import java.io.BufferedReader;
+import java.io.File;
import java.io.InputStreamReader;
import java.io.FileInputStream;
import java.io.IOException;
@@ -106,13 +107,37 @@

org.ggf.ns.nmwg.tools.ping.v2_0.Subject sub =
(org.ggf.ns.nmwg.tools.ping.v2_0.Subject) mdArr[0].getSubject();
+
+ if (sub == null){
+ throw new
SystemException("error.mp.clmp.validator.malformed_request",
+ "The request message metadata must have a subject
element with " +
+ "an endPointPair element. The endPointPair element must
have at" +
+ " least a dst element."
+ );
+ }
+
org.ggf.ns.nmwg.topology.v2_0.EndPointPair end =
sub.getEndPointPair();
+
+ if (end == null){
+ throw new
SystemException("error.mp.clmp.validator.malformed_request",
+ "The request message must have an endPointPair element
inside " +
+ "the subject element of its metadata. The endPointPair
element" +
+ " must have at least a dst element."
+ );
+ }
+
org.ggf.ns.nmwg.topology.v2_0.Dst dst = end.getDestinationElement();
org.ggf.ns.nmwg.topology.v2_0.Src src = end.getSourceElement();

Parameters params = mdArr[0].getParameters();
Parameter p = null;

+ if (params == null){
+ throw new
SystemException("error.mp.clmp.validator.malformed_request",
+ "The request message metadata must have a parameters
element. If " +
+ "no parameters are wanted, an empty parameters element
must exist."
+ );
+ }
/*
* Build cmd array
*/
@@ -141,7 +166,10 @@

// Check for dst addr
if(dst == null){
- //TODO: throw request exception
+ throw new
SystemException("error.mp.clmp.validator.malformed_request",
+ "The endPointPair element must have at least a
dst element. " +
+ "The dst element informs the destination IP
address."
+ );
}
else{
cmd.add(dst.getValue());
@@ -218,7 +246,7 @@
return respMess;
}

- private Datum[] parseResults(CommandLineExec cle) {
+ private Datum[] parseResults(CommandLineExec cle) throws SystemException{
String datumRegex = "([0-9]*)
([a-zA-Z]*)[^=]*=([0-9]*)[^=]*=([0-9]*)[^=]*=([0-9\\.]*) ([a-zA-Z]*)";
Pattern datumPattern = Pattern.compile(datumRegex);

@@ -231,8 +259,11 @@

ArrayList datumList = new ArrayList();

+ File os = cle.getOsFile();
+ File es = cle.getEsFile();
+
try{
- FileInputStream fis = new FileInputStream(cle.getOsFile());
+ FileInputStream fis = new FileInputStream(os);
InputStreamReader isr = new InputStreamReader(fis);
BufferedReader br = new BufferedReader(isr);

@@ -240,6 +271,17 @@

String line = null;
Matcher matcher = null;
+
+ if (cle.getOsFile().length() < 2){
+ logger.debug(
+ CNAME + ": Got empty out response for the
request. Check the error file "+ es.getName()
+ );
+ throw new
SystemException("error.mp.clmp.system.tool_response",
+ "The tool returned no response data. This might
be caused by a wrong parameter syntax " +
+ "or this tool might not be available at the
server."
+ );
+ }
+
while( (line = br.readLine()) != null){
matcher = datumPattern.matcher(line);
if (matcher.matches()) {
@@ -267,9 +309,25 @@
}
catch(IOException ioe)
{
- //Define how to handle this Exceptions
+ logger.debug(
+ CNAME + ": IOException ocurred while
processing response. " +
+ "Related files: "+ os.getName() + " and "+
es.getName()
+ );
+ throw new
SystemException("error.mp.clmp.system.ioexception.ping",
+ "An error ocurred while trying to parse the results of
the request. Please try again. " +
+ "If this problem persists, contact the service
administrator."
+ );
}

+ try {
+
+ if (os != null)
+ os.delete();
+ if (es != null)
+ es.delete();
+ }catch(Exception e){
+ }
+
Datum[] datums = new Datum[datumList.size()];
datumList.toArray(datums);


Modified:
trunk/perfsonar/src/org/perfsonar/service/measurementPoint/commandLine/tools/Traceroute.java
===================================================================
---
trunk/perfsonar/src/org/perfsonar/service/measurementPoint/commandLine/tools/Traceroute.java
2007-04-05 13:03:07 UTC (rev 2320)
+++
trunk/perfsonar/src/org/perfsonar/service/measurementPoint/commandLine/tools/Traceroute.java
2007-04-05 14:38:51 UTC (rev 2321)
@@ -17,6 +17,7 @@
package org.perfsonar.service.measurementPoint.commandLine.tools;

import java.io.BufferedReader;
+import java.io.File;
import java.io.InputStreamReader;
import java.io.FileInputStream;
import java.io.IOException;
@@ -103,12 +104,38 @@

org.ggf.ns.nmwg.tools.traceroute.v2_0.Subject sub =
(org.ggf.ns.nmwg.tools.traceroute.v2_0.Subject)
mdArr[0].getSubject();
+
+ if (sub == null){
+ throw new
SystemException("error.mp.clmp.validator.malformed_request",
+ "The request message metadata must have a subject
element with " +
+ "an endPointPair element. The endPointPair element must
have at" +
+ " least a dst element."
+ );
+ }
+
org.ggf.ns.nmwg.topology.v2_0.EndPointPair end =
sub.getEndPointPair();
+
+ if (end == null){
+ throw new
SystemException("error.mp.clmp.validator.malformed_request",
+ "The request message must have an endPointPair element
inside " +
+ "the subject element of its metadata. The endPointPair
element" +
+ " must have at least a dst element."
+ );
+ }
+
org.ggf.ns.nmwg.topology.v2_0.Dst dst = end.getDestinationElement();
org.ggf.ns.nmwg.topology.v2_0.Src src = end.getSourceElement();

Parameters params = mdArr[0].getParameters();
Parameter p = null;
+
+ if (params == null){
+ throw new
SystemException("error.mp.clmp.validator.malformed_request",
+ "The request message metadata must have a parameters
element. If " +
+ "no parameters are wanted, an empty parameters element
must exist."
+ );
+ }
+
/*
* Build cmd array
*/
@@ -119,20 +146,22 @@
// cmd itself
// TODO: Check config for cmd name
cmd.add("traceroute");
- cmd.add("-n");
- if (OS.indexOf("linux") > -1) {
- cmd.add("-l");
- }
+ cmd.add("-n");

// Check for src addr
cmd = cl.checkParameters(cmd, params, toolOptions);
// Check for dst addr
if(dst == null){
- //TODO: throw request exception
+ throw new
SystemException("error.mp.clmp.validator.malformed_request",
+ "The endPointPair element must have at least a
dst element. " +
+ "The dst element informs the destination IP
address."
+ );
}
else{
cmd.add(dst.getValue());
}
+
+ int maxTtl = 30;
if (params != null) {
p = params.getParameterByName("packetSize");
if(p != null){
@@ -144,6 +173,10 @@
} else {
this.numQueries = 3;
}
+ p = params.getParameterByName("maxTtl");
+ if(p != null){
+ maxTtl = Integer.parseInt(p.getParameterValue());
+ }
}

// Now execute
@@ -154,7 +187,7 @@

// TODO: make timeout an option somehow
// timeout - 30 seconds
- protector.run(cl, 60000, parametersList);
+ protector.run(cl, numQueries*1000*maxTtl, parametersList);

datums = parseResults(cl);

}
@@ -196,7 +229,7 @@
return respMess;
}

- private Datum[] parseResults(CommandLineExec cle) {
+ private Datum[] parseResults(CommandLineExec cle) throws SystemException{

String datumRegex =
"[^0-9]*([0-9]*)[^0-9]*(([0-9]{1,3}\\.){3}([0-9]{1,3}))";
String datumQueryRegex =
"(([^0-9]*([0-9\\.]*)[^a-zA-Z]*([a-zA-Z]*)([^\\(]*\\(([0-9]*)\\))?)?|\\*)";
@@ -221,13 +254,16 @@

ArrayList datumList = new ArrayList();

+ File os = cle.getOsFile();
+ File es = cle.getEsFile();
+
try{
Datum datum = null;

String line = null;
Matcher matcher = null;

- FileInputStream efis = new FileInputStream(cle.getEsFile());
+ FileInputStream efis = new FileInputStream(es);
InputStreamReader eisr = new InputStreamReader(efis);
BufferedReader ebr = new BufferedReader(eisr);

@@ -244,10 +280,20 @@
}
}

- FileInputStream fis = new FileInputStream(cle.getOsFile());
+ FileInputStream fis = new FileInputStream(os);
InputStreamReader isr = new InputStreamReader(fis);
BufferedReader br = new BufferedReader(isr);
-
+
+ if (cle.getOsFile().length() < 2){
+ logger.debug(
+ CNAME + ": Got empty out response for the
request. Check the error file "+ es.getName()
+ );
+ throw new
SystemException("error.mp.clmp.system.tool_response",
+ "The tool returned no response data. This might
be caused by a wrong parameter syntax " +
+ "or this tool might not be available at the
server."
+ );
+ }
+
while( (line = br.readLine()) != null){
matcher = datumPattern.matcher(line);

@@ -293,9 +339,25 @@
}
catch(IOException ioe)
{
- //Define how to handle this Exceptions
+ logger.debug(
+ CNAME + ": IOException ocurred while processing
response. " +
+ "Related files: "+ os.getName() + " and "+
es.getName()
+ );
+ throw new
SystemException("error.mp.clmp.system.ioexception.traceroute",
+ "An error ocurred while trying to parse the results of
the request. Please try again. " +
+ "If this problem persists, contact the service
administrator."
+ );
}

+ try {
+
+ if (os != null)
+ os.delete();
+ if (es != null)
+ es.delete();
+ }catch(Exception e){
+ }
+
Datum[] datums = new Datum[datumList.size()];
datumList.toArray(datums);

@@ -318,7 +380,7 @@
* VALUE= string containing [command line option]:[default value
(if any)]
*/
toolOptions.put("firstTtl","-f:");
- toolOptions.put("maxTtl","-m:");
+ toolOptions.put("maxTtl","-m:");
toolOptions.put("waitTime","-w:");
toolOptions.put("pause","-z:");
toolOptions.put("dontFragment","-F:novalue");
@@ -326,5 +388,9 @@
toolOptions.put("port","-p:");
toolOptions.put("tos","-t:");
toolOptions.put("numQueries","-q:3");
+
+ if (OS.indexOf("linux") > -1) {
+ toolOptions.put("displayTtl","-l:novalue");
+ }
}
}



  • perfsonar: r2321 - in trunk/perfsonar: ant ant/clmp src/org/perfsonar/service/measurementPoint/commandLine src/org/perfsonar/service/measurementPoint/commandLine/tools, svnlog, 04/05/2007

Archive powered by MHonArc 2.6.16.

Top of Page