Skip to Content.
Sympa Menu

perfsonar-dev - r1642 - in trunk/perfsonar/src/org/perfsonar/service: commons/transport measurementPoint/tracefileCaptureType

Subject: perfsonar development work

List archive

r1642 - in trunk/perfsonar/src/org/perfsonar/service: commons/transport measurementPoint/tracefileCaptureType


Chronological Thread 
  • From:
  • To:
  • Subject: r1642 - in trunk/perfsonar/src/org/perfsonar/service: commons/transport measurementPoint/tracefileCaptureType
  • Date: Wed, 20 Sep 2006 11:25:59 -0400

Author: uros
Date: 2006-09-20 11:25:58 -0400 (Wed, 20 Sep 2006)
New Revision: 1642

Added:

trunk/perfsonar/src/org/perfsonar/service/commons/transport/FileTransportFactory.java
Modified:

trunk/perfsonar/src/org/perfsonar/service/measurementPoint/tracefileCaptureType/TCMPTypeMeasurementExecutor.java
Log:
FileTransportFactory used for constructing different implementations of
FileTransport. MeasurementExecutor updated to copy DiMAPI created PCAP files
from remote DiMAPI machine to local machine using native ssh client.

Added:
trunk/perfsonar/src/org/perfsonar/service/commons/transport/FileTransportFactory.java


Property changes on:
trunk/perfsonar/src/org/perfsonar/service/commons/transport/FileTransportFactory.java
___________________________________________________________________
Name: svn:keywords
+ Author Date Id Revision
Name: svn:eol-style
+ native

Modified:
trunk/perfsonar/src/org/perfsonar/service/measurementPoint/tracefileCaptureType/TCMPTypeMeasurementExecutor.java
===================================================================
---
trunk/perfsonar/src/org/perfsonar/service/measurementPoint/tracefileCaptureType/TCMPTypeMeasurementExecutor.java
2006-09-19 14:46:45 UTC (rev 1641)
+++
trunk/perfsonar/src/org/perfsonar/service/measurementPoint/tracefileCaptureType/TCMPTypeMeasurementExecutor.java
2006-09-20 15:25:58 UTC (rev 1642)
@@ -51,7 +51,11 @@
import si.arnes.jra1.perfsonar.jni.mapijni.MAPIMonitorRequest;
import si.arnes.jra1.perfsonar.jni.mapijni.MAPIException;

+import org.perfsonar.service.commons.transport.Location;
+import org.perfsonar.service.commons.transport.FileTransportFactory;
+import org.perfsonar.service.commons.transport.FileTransport;

+
/**
* This class provides the capability to interact with
* MAPI to interact with DAG, NIC, COMBO9, ... cards.
@@ -311,12 +315,14 @@

// Create needed info ((interface, host:interface) and datum)
// depending on capIf
+ String host = null;
String hostIf = null;
String datumFile = null;
boolean isRemoteFlow = false;
switch (capIf) {
case FIRST:
- if
(localHostsIPs.contains(this.request.getFirstEndPointHost().toLowerCase()))
+ host = this.request.getFirstEndPointHost().toLowerCase();
+ if (localHostsIPs.contains(host))
hostIf = this.request.getFirstEndPointInterface();
else {

@@ -330,7 +336,8 @@
break;

case SECOND:
- if
(localHostsIPs.contains(this.request.getSecondEndPointHost().toLowerCase()))
+ host =
this.request.getSecondEndPointHost().toLowerCase();
+ if (localHostsIPs.contains(host))
hostIf = this.request.getSecondEndPointInterface();
else {

@@ -347,6 +354,35 @@
"error.mp.tcmp.unknown_capture_interface",
"Unknown capture interface");
}
+
+ // If this is a remote flow, check if required tracefile exists
+ // already. Throw SystemException if it does.
+ FileTransport ft = null;
+ Location localLoc = null;
+ Location remoteLoc = null;
+ String fileName = null;
+ if (isRemoteFlow) {
+
+ localLoc = new Location();
+ File f = new File(datumFile);
+ fileName = f.getName();
+ localLoc.setPath(f.getParent());
+
+ remoteLoc = new Location();
+ remoteLoc.setAddress(host);
+ remoteLoc.setUsername("root");
+ remoteLoc.setPath(f.getParent());
+
+ ft = FileTransportFactory.getFileTransport(
+ FileTransportFactory.SSH_FILE_TRANSPORT_IMPL);
+
+ if (ft.exists(fileName, remoteLoc))
+ throw new SystemException(
+
"error.mp.tcmp.validator.remote_datum_filename_exists",
+ "Remote datum filename (" + fileName
+ + ") already exists. Use different datum filename.");
+
+ }

// Create MAPI monitor request
MonitorRequest monReq = new MAPIMonitorRequest();
@@ -413,15 +449,22 @@
this.logger.info(type + ".run: Closed flow to " + hostIf
+ " (tid=" + Thread.currentThread().getId() + ")");

- // TODO: If this is a remote flow we are talking about
- // (@see isRemoteFlow), then use user supplied parametric
- // command to copy files from remote host to local
repository
- // Command should not require parametric login (use public
key
- // with scp for example). This feature may be added later.
- // Example of parametric command:
- // scp
root@sonar2:{0}
{1}
- // Where {0} is filled with absolute path to remote source
file and
- // {1} is filled with absolute path to destination local
file by TCMP.
+
+ // If remote flow, copy remotely created PCAP file to local
+ // directory and remove it remotely
+ if (isRemoteFlow) {
+ this.logger.info(type + ".run: Transporting remote PCAP file
'"
+ + datumFile + "' from host " + host + " to localhost"
+ + " (tid=" + Thread.currentThread().getId() + ")");
+
+ ft.copy(fileName, remoteLoc, localLoc);
+
+ this.logger.info(type + ".run: Removing remote PCAP file '"
+ + datumFile + "' on host " + host
+ + " (tid=" + Thread.currentThread().getId() + ")");
+
+ ft.delete(fileName, remoteLoc);
+ }

this.logger.info(type + ".run: Thread exiting (tid="
+ Thread.currentThread().getId() + ")");
@@ -1154,6 +1197,9 @@
}

// and check if files exist already (they should not)
+ // This is again verified before actual flow is started
+ // (in a separate thread), but then we have no way to warn
+ // a requestor about existance of files.
File fl = new File(req.getFirstFilePath());
if (fl.exists()) {




  • r1642 - in trunk/perfsonar/src/org/perfsonar/service: commons/transport measurementPoint/tracefileCaptureType, svnlog, 09/20/2006

Archive powered by MHonArc 2.6.16.

Top of Page