Skip to Content.
Sympa Menu

perfsonar-dev - perfsonar: r3533 - in trunk/surfnet_java-flowsa-ma: . conf src/main/java/org/perfsonar/service/measurementArchive/flowsa src/main/java/org/perfsonar/service/measurementArchive/flowsa/nfcapd src/main/java/org/perfsonar/service/measurementArchive/flowsa/nfdump src/main/java/org/perfsonar/service/measurementArchive/flowsa/nfdump/outputreaders

Subject: perfsonar development work

List archive

perfsonar: r3533 - in trunk/surfnet_java-flowsa-ma: . conf src/main/java/org/perfsonar/service/measurementArchive/flowsa src/main/java/org/perfsonar/service/measurementArchive/flowsa/nfcapd src/main/java/org/perfsonar/service/measurementArchive/flowsa/nfdump src/main/java/org/perfsonar/service/measurementArchive/flowsa/nfdump/outputreaders


Chronological Thread 
  • From:
  • To:
  • Subject: perfsonar: r3533 - in trunk/surfnet_java-flowsa-ma: . conf src/main/java/org/perfsonar/service/measurementArchive/flowsa src/main/java/org/perfsonar/service/measurementArchive/flowsa/nfcapd src/main/java/org/perfsonar/service/measurementArchive/flowsa/nfdump src/main/java/org/perfsonar/service/measurementArchive/flowsa/nfdump/outputreaders
  • Date: Tue, 18 Mar 2008 10:58:35 -0400

Author: michael.bischoff
Date: 2008-03-18 10:58:34 -0400 (Tue, 18 Mar 2008)
New Revision: 3533

Modified:
trunk/surfnet_java-flowsa-ma/conf/eventType-map.xml
trunk/surfnet_java-flowsa-ma/conf/service.properties
trunk/surfnet_java-flowsa-ma/pom.xml

trunk/surfnet_java-flowsa-ma/src/main/java/org/perfsonar/service/measurementArchive/flowsa/FlowStatisticsResponse.java

trunk/surfnet_java-flowsa-ma/src/main/java/org/perfsonar/service/measurementArchive/flowsa/FlowsaMAServiceEngine.java

trunk/surfnet_java-flowsa-ma/src/main/java/org/perfsonar/service/measurementArchive/flowsa/nfcapd/Exporter.java

trunk/surfnet_java-flowsa-ma/src/main/java/org/perfsonar/service/measurementArchive/flowsa/nfcapd/NfcapdControll.java

trunk/surfnet_java-flowsa-ma/src/main/java/org/perfsonar/service/measurementArchive/flowsa/nfdump/NfdumpControll.java

trunk/surfnet_java-flowsa-ma/src/main/java/org/perfsonar/service/measurementArchive/flowsa/nfdump/Statistics.java

trunk/surfnet_java-flowsa-ma/src/main/java/org/perfsonar/service/measurementArchive/flowsa/nfdump/outputreaders/Nfdump1_5_5OutputReaderImpl.java
Log:
RESOLVED - bug 371: Flow S&A MA: MA selects one log file more than it should
https://bugzilla.perfsonar.net/show_bug.cgi?id=371

fixed pom.

Modified: trunk/surfnet_java-flowsa-ma/conf/eventType-map.xml
===================================================================
--- trunk/surfnet_java-flowsa-ma/conf/eventType-map.xml 2008-03-18 14:40:11
UTC (rev 3532)
+++ trunk/surfnet_java-flowsa-ma/conf/eventType-map.xml 2008-03-18 14:58:34
UTC (rev 3533)
@@ -9,6 +9,7 @@
<eventType>
<name>http://ggf.org/ns/nmwg/tools/flow/raw/2.0/</name>

<metadataQueryGenerator>org.perfsonar.service.measurementArchive.metadataConfig.queryGenerator.FlowQueryGenerator</metadataQueryGenerator>
-
<baseChainingMerger>org.perfsonar.service.measurementArchive.flowsa.NMWGInterfaceBaseChaining</baseChainingMerger>
+
<baseChainingMerger>org.perfsonar.service.measurementArchive.flowsa.NMWGInterfaceBaseChaining</baseChainingMerger>
+ <authentication>no</authentication>
</eventType>
</eventType-config>

Modified: trunk/surfnet_java-flowsa-ma/conf/service.properties
===================================================================
--- trunk/surfnet_java-flowsa-ma/conf/service.properties 2008-03-18
14:40:11 UTC (rev 3532)
+++ trunk/surfnet_java-flowsa-ma/conf/service.properties 2008-03-18
14:58:34 UTC (rev 3533)
@@ -81,13 +81,15 @@
# nfdump.source - location of nfcapd files
# nfdump.location - the location of the nfdump executable (including nfdump
filename)
# nfdump.outputreader - fully qualified name of the class used for output
reading (expects a class implementing NfdumpOutputReader)
-#service.ma.flowsa.nfdump.source=/usr/local/var/nfdump/flows
-service.ma.flowsa.nfdump.location=/usr/local/bin/nfdump
+service.ma.flowsa.nfdump.source=/usr/local/var/nfdump/flows
+#service.ma.flowsa.nfdump.location=/usr/local/bin/nfdump

service.ma.flowsa.nfdump.ouputreader=org.perfsonar.service.measurementArchive.flowsa.nfdump.outputreaders.Nfdump1_5_5OutputReaderFactory

# --- nfcapd properties ---
-# nfcapd.start-processes - if nfcapd should start processes for exporters;
specify false if this is done externally
+# UPSUPPORTED nfcapd.start-processes - if nfcapd should start processes for
exporters; specify false if this is done externally
+# service.ma.flowsa.nfcapd.interval - interval between nfcapd writing a new
file.
service.ma.flowsa.nfcapd.start-processes=false
+service.ma.flowsa.nfcapd.interval=5

# === Logger properties ===
service.log.log4j.config=/perfsonar/conf/log4j.properties

Modified: trunk/surfnet_java-flowsa-ma/pom.xml
===================================================================
--- trunk/surfnet_java-flowsa-ma/pom.xml 2008-03-18 14:40:11 UTC (rev
3532)
+++ trunk/surfnet_java-flowsa-ma/pom.xml 2008-03-18 14:58:34 UTC (rev
3533)
@@ -148,7 +148,7 @@
<dependency>
<groupId>perfsonar</groupId>
<artifactId>perfsonar-base</artifactId>
- <version>1.0.20071121</version>
+ <version>1.0.20080303</version>
</dependency>
<dependency>
<groupId>perfsonar</groupId>

Modified:
trunk/surfnet_java-flowsa-ma/src/main/java/org/perfsonar/service/measurementArchive/flowsa/FlowStatisticsResponse.java
===================================================================
---
trunk/surfnet_java-flowsa-ma/src/main/java/org/perfsonar/service/measurementArchive/flowsa/FlowStatisticsResponse.java
2008-03-18 14:40:11 UTC (rev 3532)
+++
trunk/surfnet_java-flowsa-ma/src/main/java/org/perfsonar/service/measurementArchive/flowsa/FlowStatisticsResponse.java
2008-03-18 14:58:34 UTC (rev 3533)
@@ -16,12 +16,12 @@

private static final String ISO8601_PATTERN =
"yyyy-MM-dd'T'HH:mm:ssZ";

- public FlowStatisticsResponse(Metadata[] metadatas, Statistics
statistics) {
+ public FlowStatisticsResponse(Metadata[] metadatas, TimeRange range,
Statistics statistics) {
super(metadatas);
- setData(convertToData(statistics));
+ setData(convertToData(range, statistics));
}

- private Data convertToData(Statistics statistics) {
+ private Data convertToData(TimeRange range, Statistics statistics) {
Data data = new Data();
data.setId("data1");
Datum datum = new Datum();
@@ -45,7 +45,7 @@
datum.setMsecFirst(statistics.getMsecFirst());
datum.setMsecLast(statistics.getMsecLast());
datum.setSequenceFailures(statistics.getSequenceFailures());
- datum.addChild(convertToTime(statistics.getRange()));
+ datum.addChild(convertToTime(range));
data.addChild(datum);
return data;
}

Modified:
trunk/surfnet_java-flowsa-ma/src/main/java/org/perfsonar/service/measurementArchive/flowsa/FlowsaMAServiceEngine.java
===================================================================
---
trunk/surfnet_java-flowsa-ma/src/main/java/org/perfsonar/service/measurementArchive/flowsa/FlowsaMAServiceEngine.java
2008-03-18 14:40:11 UTC (rev 3532)
+++
trunk/surfnet_java-flowsa-ma/src/main/java/org/perfsonar/service/measurementArchive/flowsa/FlowsaMAServiceEngine.java
2008-03-18 14:58:34 UTC (rev 3533)
@@ -3,6 +3,11 @@
import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
+import java.text.DateFormat;
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.Calendar;
+import java.util.Date;
import java.util.List;
import java.util.Set;
import java.util.TreeSet;
@@ -27,6 +32,7 @@
import org.perfsonar.service.measurementArchive.flowsa.nfdump.RawFlowsQuery;
import org.perfsonar.service.measurementArchive.flowsa.nfdump.Statistics;
import
org.perfsonar.service.measurementArchive.flowsa.nfdump.StatisticsQuery;
+import org.perfsonar.service.measurementArchive.flowsa.nfdump.TimeRange;
import
org.perfsonar.service.measurementArchive.flowsa.nfdump.TooManyResultsException;
import org.perfsonar.service.measurementArchive.flowsa.nfdump.TopDatum;
import org.perfsonar.service.measurementArchive.flowsa.nfdump.TopQuery;
@@ -47,6 +53,7 @@

protected static final int DEFAULT_MAX_RESULTS = 1000;
protected static final int DEFAULT_TIMEOUT = 10;
+ protected static final int DEFAULT_NFCAPDINTERVAL = 5;
protected static final File DEFAULT_NFDUMP_EXECUTABLE = new
File("/usr/local/bin/nfdump");
protected static final File DEFAULT_NFCAPD_EXECUTABLE = new
File("/usr/local/bin/nfcapd");
protected static final String DEFAULT_READERFACTORYCLASSNAME =
"org.perfsonar.service.measurementArchive.flowsa.FlowsaMAServiceEngine";
@@ -60,6 +67,7 @@
protected static final String SOURCEDIRECTORY_PROPERTY_KEY =
"service.ma.flowsa.nfdump.source";
protected static final String NFCAPDLOCATION_PROPERTY_KEY =
"service.ma.flowsa.nfcapd.location";
protected static final String SHOULDSTARTNFCAPDPROCESSES_PROPERTY_KEY
= "service.ma.flowsa.nfcapd.start-processes";
+ protected static final String NFCAPDINTERVAL_PROPERTY_KEY =
"service.ma.flowsa.nfcapd.interval";
protected static final String EXPORTERS_PROPERTY_KEY =
"service.ma.flowsa.exporters";
protected static final String EXPORTER_PROPERTY_PART =
"service.ma.flowsa.exporter";
protected static final String EXPORTERHOST_PROPERTY_PART =
".hostname";
@@ -73,7 +81,7 @@
protected static final String EXPORTERLOCATIONCOUNTRY_PROPERTY_PART =
".location.country";
protected static final String EXPORTERLOCATIONLATITUDE_PROPERTY_PART
= ".location.latitude";
protected static final String
EXPORTERLOCATIONLONGTITUDE_PROPERTY_PART = ".location.longitude";
-
+
protected final LoggerComponent logger;
protected final ConfigurationComponent configuration;
protected final NfdumpControll nfdump;
@@ -224,7 +232,22 @@
logger.debug("FlowsaMAServiceEngine.handleRawFlowRequest: Executing
query.");
Statistics result = nfdump.execute(query);
logger.debug("FlowsaMAServiceEngine.handleRawFlowRequest: Creating
response.");
- return new FlowStatisticsResponse(request.getMetadata(), result);
+
+ TimeRange range = null;
+
+ DateFormat dateFormat = new
SimpleDateFormat("'nfcapd.'yyyyMMddHHmm");
+ try {
+ Date start = dateFormat.parse(query.getStartFile());
+ Date end = dateFormat.parse(query.getEndFile());
+ Calendar cal = Calendar.getInstance();
+ cal.setTime(end);
+ cal.add(Calendar.MINUTE, nfcapd.getInterval());
+ range = new TimeRange(start,cal.getTime());
+ } catch (ParseException e) {
+ new RuntimeException("couldn't parse date, this
should never happen here and this exception indicates a bug");
+ }
+
+ return new FlowStatisticsResponse(request.getMetadata(), range,
result);
}
/**
* handles a TopFlowRequest. creates a query from
@@ -327,8 +350,11 @@
);
}

- return new NfcapdControll(nfcapdExecutable, exporters,
startNfcapdProcesses);
+ int interval = getNfcapdInterval(configuration);
+
+ return new NfcapdControll(nfcapdExecutable, exporters,
interval, startNfcapdProcesses);
}
+
/**
* @param request
* @return FileData based on the request
@@ -463,9 +489,8 @@
* @return property for Timeout value
*/
private int getTimeoutValueFrom(ConfigurationComponent source) {
- int timeoutValue = 0;
try {
- timeoutValue =
Integer.parseInt(source.getProperty(TIMEOUT_PROPERTY_KEY));
+ return
Integer.parseInt(source.getProperty(TIMEOUT_PROPERTY_KEY));
} catch (PerfSONARException e) {
logger.debug("No configuration found: using standard MaxResult
for nfDump");
return DEFAULT_TIMEOUT;
@@ -473,7 +498,6 @@
logger.debug("Couldn't parse from configuration: using standard
MaxResult for nfDump");
return DEFAULT_TIMEOUT;
}
- return timeoutValue;
}
/**
* looks up the property from the specified source. returns the
default value
@@ -482,9 +506,8 @@
* @return property for MaxResults
*/
private int getMaxResultsFrom(ConfigurationComponent source) {
- int maxResults = 0;
try {
- maxResults =
Integer.parseInt(source.getProperty(MAXRESULTS_PROPERTY_KEY));
+ return
Integer.parseInt(source.getProperty(MAXRESULTS_PROPERTY_KEY));
} catch (PerfSONARException e) {
logger.debug("No configuration found: using standard MaxResult
for nfDump");
return DEFAULT_MAX_RESULTS;
@@ -492,7 +515,6 @@
logger.debug("Couldn't parse from configuration: using standard
MaxResult for nfDump");
return DEFAULT_MAX_RESULTS;
}
- return maxResults;
}
/**
* looks up the property from the specified source. returns the
default value
@@ -527,6 +549,23 @@
return new File(name);
}
/**
+ * looks up the property from the specified source. returns the
default value
+ * if the source didn't supply one.
+ * @param source
+ * @return property for SourceDirectory
+ */
+ private int getNfcapdInterval(ConfigurationComponent source) {
+ try {
+ return
Integer.parseInt(source.getProperty(NFCAPDINTERVAL_PROPERTY_KEY));
+ } catch (PerfSONARException e) {
+ logger.debug("No configuration found: using standard interval
for nfcapd");
+ return DEFAULT_NFCAPDINTERVAL;
+ } catch (NumberFormatException e) {
+ logger.debug("Couldn't parse from configuration: using standard
interval for nfcapd");
+ return DEFAULT_NFCAPDINTERVAL;
+ }
+ }
+ /**
* gets the configuration component
* @return
* @throws PerfSONARException

Modified:
trunk/surfnet_java-flowsa-ma/src/main/java/org/perfsonar/service/measurementArchive/flowsa/nfcapd/Exporter.java
===================================================================
---
trunk/surfnet_java-flowsa-ma/src/main/java/org/perfsonar/service/measurementArchive/flowsa/nfcapd/Exporter.java
2008-03-18 14:40:11 UTC (rev 3532)
+++
trunk/surfnet_java-flowsa-ma/src/main/java/org/perfsonar/service/measurementArchive/flowsa/nfcapd/Exporter.java
2008-03-18 14:58:34 UTC (rev 3533)
@@ -84,21 +84,23 @@
* time. if there is no file before time it returns null
* after time.
* @param time
- * @return filename
+ * @return filename or null if no such file exists
*/
public String getClosestFileBefore(Date time) {
if(time==null) throw new IllegalArgumentException("time
cannot be null");
+ String selected = null;
if(myDirectory.exists()) {
String value = new
SimpleDateFormat("'nfcapd.'yyyyMMddHHmm").format(time);
String[] sortedFiles = myDirectory.list();
Arrays.sort(sortedFiles);
for(String file : sortedFiles) {

- if(file.compareTo(value)<=0) {
- return file;
+ if(file.compareTo(value)>0) {
+ return selected;
}
+ selected = file;
}
}
- return null;
+ return selected;
}

/**
@@ -106,11 +108,10 @@
* returned is the filename of the file thats holds the oldest data
after
* time
* @param time
- * @return filename
+ * @return filename or null if no such file exists
*/
public String getClosestFileAfter(Date time) {
if(time==null) throw new IllegalArgumentException("time
cannot be null");
- String last = null;
if(myDirectory.exists()) {
String value = new
SimpleDateFormat("'nfcapd.'yyyyMMddHHmm").format(time);
String[] sortedFiles = myDirectory.list();
@@ -119,19 +120,42 @@
if(!(file.compareTo(value)<0)) {
return file;
}
- last = file;
}
}
- return last;
+ return null;
}

/**
+ * returns a filename that contains data of the time supplied. the
file
+ * name returned is the filename of the file thats holds the oldest
data
+ * after time
+ * @param time
+ * @return filename or null if no such file exists
+ */
+ public String getFileContaining(Date time) {
+ if(time==null) throw new IllegalArgumentException("time
cannot be null");
+ String selected = null;
+ if(myDirectory.exists()) {
+ String value = new
SimpleDateFormat("'nfcapd.'yyyyMMddHHmm").format(time);
+ String[] sortedFiles = myDirectory.list();
+ Arrays.sort(sortedFiles);
+ for(String file : sortedFiles) {

+ if(!(file.compareTo(value)<=0)) {
+ return selected;
+ }
+ selected = file;
+ }
+ }
+ return null;
+ }
+
+ /**
* checks if it has both source files.
*
* TODO add check for files in between.
* @param startFile
* @param endFile
- * @return
+ * @return predicate value
*/
public boolean hasFiles(String startFile, String endFile) {
if(!myDirectory.canRead()) return false;

Modified:
trunk/surfnet_java-flowsa-ma/src/main/java/org/perfsonar/service/measurementArchive/flowsa/nfcapd/NfcapdControll.java
===================================================================
---
trunk/surfnet_java-flowsa-ma/src/main/java/org/perfsonar/service/measurementArchive/flowsa/nfcapd/NfcapdControll.java
2008-03-18 14:40:11 UTC (rev 3532)
+++
trunk/surfnet_java-flowsa-ma/src/main/java/org/perfsonar/service/measurementArchive/flowsa/nfcapd/NfcapdControll.java
2008-03-18 14:58:34 UTC (rev 3533)
@@ -59,14 +59,23 @@
private final File nfcapdExecutable;
private final Set<Exporter> exporters;
private final boolean startingNfcapdProcesses;
+ private int interval;

- public NfcapdControll(File nfcapdExecutable, Set<Exporter> exporters,
boolean startNfcapdProcesses) {
+ /**
+ * @param nfcapdExecutable the nfcapdexecutable file
+ * @param exporters the exporters controlled by nfcapd
+ * @param interval in mins that nfcapd writes files.
+ * @param startNfcapdProcesses if nfcapdcontroll should start
processes.
+ */
+ public NfcapdControll(File nfcapdExecutable, Set<Exporter> exporters,
int interval, boolean startNfcapdProcesses) {
if(startNfcapdProcesses && !nfcapdExecutable.exists()) {
throw new IllegalArgumentException("Nfcapd doesn't
exist.");
}
this.nfcapdExecutable = nfcapdExecutable;
this.exporters = exporters;
this.startingNfcapdProcesses = startNfcapdProcesses;
+ this.interval = interval;
+
if(startNfcapdProcesses) {
startNfcapdProcesses();
}
@@ -113,14 +122,14 @@
throw new IOException("Cannot find / unkown
Exporter("+hostName+"), no data avail.");
}
if(startFile!=null) {
- // here we presume that files for exporters
are all written at the same interval leading
+ // TODO document: here we presume that files
for exporters are all written at the same interval leading
// to the same names among the directories
this might cause problems
if(!exporter.hasFiles(startFile, endFile))
throw new FileNotFoundException("Data not avail for specified interval");
directories.add(exporter.getDirectory());
continue;
}
startFile = exporter.getClosestFileBefore(startTime);
- endFile = exporter.getClosestFileAfter(endTime);
+ endFile = exporter.getFileContaining(endTime);
if(startFile==null) {
throw new FileNotFoundException("Data not
avail for specified interval");
}
@@ -154,4 +163,8 @@
}

}
+
+ public int getInterval() {
+ return interval;
+ }
}

Modified:
trunk/surfnet_java-flowsa-ma/src/main/java/org/perfsonar/service/measurementArchive/flowsa/nfdump/NfdumpControll.java
===================================================================
---
trunk/surfnet_java-flowsa-ma/src/main/java/org/perfsonar/service/measurementArchive/flowsa/nfdump/NfdumpControll.java
2008-03-18 14:40:11 UTC (rev 3532)
+++
trunk/surfnet_java-flowsa-ma/src/main/java/org/perfsonar/service/measurementArchive/flowsa/nfdump/NfdumpControll.java
2008-03-18 14:58:34 UTC (rev 3533)
@@ -5,11 +5,9 @@

import java.io.File;
import java.text.DateFormat;
-import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Arrays;
-import java.util.Date;
import java.util.List;
import java.util.concurrent.Callable;
import java.util.concurrent.ExecutionException;
@@ -177,15 +175,7 @@
}
};

- Statistics statistics = submit(task);
- DateFormat dateFormat = new
SimpleDateFormat("'nfcapd.'yyyyMMddHHmm");
- try {
- Date start = dateFormat.parse(query.getStartFile());
- Date end = dateFormat.parse(query.getEndFile());
- statistics.setRange(new TimeRange(start,end));
- } catch (ParseException e) {
- new RuntimeException("couldn't parse date, this
should never happen here and this exception indicates a bug");
- }
+ Statistics statistics = submit(task);
return statistics;
}
/**

Modified:
trunk/surfnet_java-flowsa-ma/src/main/java/org/perfsonar/service/measurementArchive/flowsa/nfdump/Statistics.java
===================================================================
---
trunk/surfnet_java-flowsa-ma/src/main/java/org/perfsonar/service/measurementArchive/flowsa/nfdump/Statistics.java
2008-03-18 14:40:11 UTC (rev 3532)
+++
trunk/surfnet_java-flowsa-ma/src/main/java/org/perfsonar/service/measurementArchive/flowsa/nfdump/Statistics.java
2008-03-18 14:58:34 UTC (rev 3533)
@@ -27,7 +27,6 @@
private String msecFirst;
private String msecLast;
private String sequenceFailures;
- private TimeRange range;

public String getFlows() {
return flows;
@@ -149,10 +148,4 @@
public void setSequenceFailures(String sequenceFailures) {
this.sequenceFailures = sequenceFailures;
}
- public TimeRange getRange() {
- return range;
- }
- public void setRange(TimeRange range) {
- this.range = range;
- }
}

Modified:
trunk/surfnet_java-flowsa-ma/src/main/java/org/perfsonar/service/measurementArchive/flowsa/nfdump/outputreaders/Nfdump1_5_5OutputReaderImpl.java
===================================================================
---
trunk/surfnet_java-flowsa-ma/src/main/java/org/perfsonar/service/measurementArchive/flowsa/nfdump/outputreaders/Nfdump1_5_5OutputReaderImpl.java
2008-03-18 14:40:11 UTC (rev 3532)
+++
trunk/surfnet_java-flowsa-ma/src/main/java/org/perfsonar/service/measurementArchive/flowsa/nfdump/outputreaders/Nfdump1_5_5OutputReaderImpl.java
2008-03-18 14:58:34 UTC (rev 3533)
@@ -62,90 +62,95 @@
String line;
for (int lineNumber = 1; (line = myReader.readLine()) !=
null; lineNumber++) {
String[] parts = line.trim().split(":");
- check(parts.length == 2);
+ if(parts.length != 2) {
+ throw new IOException(
+ "Cannot read nfdump output:
unexpected output( expected 'key:value' got "+line+")"
+ );
+ }
+
switch (lineNumber) {
case 1:
catchOutputError(line);
- check(parts[0].equals("Ident"));
+ assertEquals(parts[0],"Ident");
break;
case 2:
- check(parts[0].equals("Flows"));
+ assertEquals(parts[0],"Flows");
statistics.setFlows(parts[1].trim());
break;
case 3:
- check(parts[0].equals("Flows_tcp"));
+ assertEquals(parts[0],"Flows_tcp");
statistics.setFlowsTcp(parts[1].trim());
break;
case 4:
- check(parts[0].equals("Flows_udp"));
+ assertEquals(parts[0],"Flows_udp");
statistics.setFlowsUdp(parts[1].trim());
break;
case 5:
- check(parts[0].equals("Flows_icmp"));
+ assertEquals(parts[0],"Flows_icmp");
statistics.setFlowsIcmp(parts[1].trim());
break;
case 6:
- check(parts[0].equals("Flows_other"));
+ assertEquals(parts[0],"Flows_other");
statistics.setFlowsOther(parts[1].trim());
break;
case 7:
- check(parts[0].equals("Packets"));
+ assertEquals(parts[0],"Packets");
statistics.setPackets(parts[1].trim());
break;
case 8:
- check(parts[0].equals("Packets_tcp"));
+ assertEquals(parts[0],"Packets_tcp");
statistics.setPacketsTcp(parts[1].trim());
break;
case 9:
- check(parts[0].equals("Packets_udp"));
+ assertEquals(parts[0],"Packets_udp");
statistics.setPacketsUdp(parts[1].trim());
break;
case 10:
- check(parts[0].equals("Packets_icmp"));
+ assertEquals(parts[0],"Packets_icmp");
statistics.setPacketsIcmp(parts[1].trim());
break;
case 11:
- check(parts[0].equals("Packets_other"));
+ assertEquals(parts[0],"Packets_other");
statistics.setPacketsOther(parts[1].trim());
break;
case 12:
- check(parts[0].equals("Bytes"));
+ assertEquals(parts[0],"Bytes");
statistics.setBytes(parts[1].trim());
break;
case 13:
- check(parts[0].equals("Bytes_tcp"));
+ assertEquals(parts[0],"Bytes_tcp");
statistics.setBytesTcp(parts[1].trim());
break;
case 14:
- check(parts[0].equals("Bytes_udp"));
+ assertEquals(parts[0],"Bytes_udp");
statistics.setBytesUdp(parts[1].trim());
break;
case 15:
- check(parts[0].equals("Bytes_icmp"));
+ assertEquals(parts[0],"Bytes_icmp");
statistics.setBytesIcmp(parts[1].trim());
break;
case 16:
- check(parts[0].equals("Bytes_other"));
+ assertEquals(parts[0],"Bytes_other");
statistics.setBytesOther(parts[1].trim());
break;
case 17:
- check(parts[0].equals("First"));
+ assertEquals(parts[0],"First");
statistics.setFirst(parts[1].trim());
break;
case 18:
- check(parts[0].equals("Last"));
+ assertEquals(parts[0], "Last");
statistics.setLast(parts[1].trim());
break;
case 19:
- check(parts[0].equals("msec_first"));
+ assertEquals(parts[0],"msec_first");
statistics.setMsecFirst(parts[1].trim());
break;
case 20:
- check(parts[0].equals("msec_last"));
+ assertEquals(parts[0],"msec_last");
statistics.setMsecLast(parts[1].trim());
break;
case 21:
- check(parts[0].equals("Sequence failures"));
+ assertEquals(parts[0],"Sequence failures");

statistics.setSequenceFailures(parts[1].trim());
return statistics;
default:
@@ -157,10 +162,10 @@
"Cannot read nfdump output: Number of Lines
did not match");
}

- private void check(boolean testValue) throws IOException {
- if (testValue == false) {
+ private void assertEquals(String output, String expected) throws
IOException {
+ if (!output.equals(expected)) {
throw new IOException(
- "Cannot read nfdump output:
unexpected output"
+ "Cannot read nfdump output:
unexpected output( expected:'"+ expected +"' was:'"+ output +"')"
);
}
}



  • perfsonar: r3533 - in trunk/surfnet_java-flowsa-ma: . conf src/main/java/org/perfsonar/service/measurementArchive/flowsa src/main/java/org/perfsonar/service/measurementArchive/flowsa/nfcapd src/main/java/org/perfsonar/service/measurementArchive/flowsa/nfdump src/main/java/org/perfsonar/service/measurementArchive/flowsa/nfdump/outputreaders, svnlog, 03/18/2008

Archive powered by MHonArc 2.6.16.

Top of Page