Skip to Content.
Sympa Menu

perfsonar-dev - perfsonar: r2190 - tags/CL-MP-1.0-RC5/src/org/perfsonar/service/measurementPoint/commandLine/tools

Subject: perfsonar development work

List archive

perfsonar: r2190 - tags/CL-MP-1.0-RC5/src/org/perfsonar/service/measurementPoint/commandLine/tools


Chronological Thread 
  • From:
  • To:
  • Subject: perfsonar: r2190 - tags/CL-MP-1.0-RC5/src/org/perfsonar/service/measurementPoint/commandLine/tools
  • Date: Mon, 5 Mar 2007 14:58:30 -0500

Author: fernandes
Date: 2007-03-05 14:58:30 -0500 (Mon, 05 Mar 2007)
New Revision: 2190

Modified:

tags/CL-MP-1.0-RC5/src/org/perfsonar/service/measurementPoint/commandLine/tools/Bwctl.java

tags/CL-MP-1.0-RC5/src/org/perfsonar/service/measurementPoint/commandLine/tools/Owamp.java
Log:
Wrong files were sent to the stable branch.




Modified:
tags/CL-MP-1.0-RC5/src/org/perfsonar/service/measurementPoint/commandLine/tools/Bwctl.java
===================================================================
---
tags/CL-MP-1.0-RC5/src/org/perfsonar/service/measurementPoint/commandLine/tools/Bwctl.java
2007-03-05 19:36:22 UTC (rev 2189)
+++
tags/CL-MP-1.0-RC5/src/org/perfsonar/service/measurementPoint/commandLine/tools/Bwctl.java
2007-03-05 19:58:30 UTC (rev 2190)
@@ -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
}
@@ -296,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);

@@ -342,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);

@@ -353,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,30 +505,52 @@
}
}
} catch (IOException e) {
- logger.fatal(
- CNAME + " IOException when parsing bwctl
results: "+e.getMessage();
- );
+ 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)
{
- logger.fatal(
- CNAME + " IOException when parsing bwctl results:
"+e.getMessage();
- );
+ 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()];
@@ -521,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:
tags/CL-MP-1.0-RC5/src/org/perfsonar/service/measurementPoint/commandLine/tools/Owamp.java
===================================================================
---
tags/CL-MP-1.0-RC5/src/org/perfsonar/service/measurementPoint/commandLine/tools/Owamp.java
2007-03-05 19:36:22 UTC (rev 2189)
+++
tags/CL-MP-1.0-RC5/src/org/perfsonar/service/measurementPoint/commandLine/tools/Owamp.java
2007-03-05 19:58:30 UTC (rev 2190)
@@ -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:");
}
}



  • perfsonar: r2190 - tags/CL-MP-1.0-RC5/src/org/perfsonar/service/measurementPoint/commandLine/tools, svnlog, 03/05/2007

Archive powered by MHonArc 2.6.16.

Top of Page