perfsonar-dev - perfsonar: r4632 - branches/perfsonarui/src/org/perfsonar/perfsonarui/bwctl
Subject: perfsonar development work
List archive
- From:
- To:
- Subject: perfsonar: r4632 - branches/perfsonarui/src/org/perfsonar/perfsonarui/bwctl
- Date: Mon, 20 Oct 2008 09:11:54 -0400
Author: nemanja.zutic
Date: 2008-10-20 09:11:53 -0400 (Mon, 20 Oct 2008)
New Revision: 4632
Added:
branches/perfsonarui/src/org/perfsonar/perfsonarui/bwctl/RTTRequest.java
branches/perfsonarui/src/org/perfsonar/perfsonarui/bwctl/RTTUserData.java
Modified:
branches/perfsonarui/src/org/perfsonar/perfsonarui/bwctl/BWCTLMainComponent.java
branches/perfsonarui/src/org/perfsonar/perfsonarui/bwctl/BWCTLPerfsonarTab.java
branches/perfsonarui/src/org/perfsonar/perfsonarui/bwctl/BWCTLRequest.java
Log:
New funcionality for the BWCTL tab. Calculating Max BW based on the TCP
Window Size and RTT.
Modified:
branches/perfsonarui/src/org/perfsonar/perfsonarui/bwctl/BWCTLMainComponent.java
===================================================================
---
branches/perfsonarui/src/org/perfsonar/perfsonarui/bwctl/BWCTLMainComponent.java
2008-10-20 13:02:49 UTC (rev 4631)
+++
branches/perfsonarui/src/org/perfsonar/perfsonarui/bwctl/BWCTLMainComponent.java
2008-10-20 13:11:53 UTC (rev 4632)
@@ -8,6 +8,7 @@
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.net.URL;
+import java.util.Hashtable;
import javax.swing.BorderFactory;
import javax.swing.ButtonGroup;
@@ -21,6 +22,7 @@
import javax.swing.JTextField;
import javax.swing.SwingConstants;
+import org.apache.commons.collections.functors.OnePredicate;
import org.perfsonar.perfsonarui.plugins.IPerfsonarTab;
import org.perfsonar.perfsonarui.plugins.MAEndpoint;
import org.perfsonar.perfsonarui.plugins.MAEndpointList;
@@ -34,6 +36,12 @@
public class BWCTLMainComponent extends PluginMainPanel
implements ActionListener
{
+ protected Hashtable<String,String> namePairs = new
Hashtable<String,String>();
+
+ protected String sourceName;
+
+ protected String destinationName;
+
protected JTextField sourceAddress;
protected JLabel sourceAddressLabel;
@@ -56,6 +64,9 @@
protected JTextField windowSize;
protected JLabel windowSizeLabel;
+
+ protected JTextField userRTT;
+ protected JLabel userRTTLabel;
protected JTextField bufferSize;
protected JLabel bufferSizeLabel;
@@ -82,13 +93,33 @@
protected JPasswordField password;
protected JLabel passwordLabel;
+ protected JSeparator oneWayDelaySeparator;
+
+ protected JLabel oneWayDelayInfoLabel;
+
protected JSeparator resultSeparator;
-
+
protected JTextArea result;
public BWCTLMainComponent(Component parentComponent, IPerfsonarTab
psModel) {
super(parentComponent, psModel);
+ namePairs.put("ARNES_Ljubljana_JRA1", "Ljubljana_ARNES");
+ namePairs.put("BELNET_Gent_JRA1","Gent_BELNET");
+ namePairs.put("CARNET_Zagreb_JRA1", "Zagreb_CARNET");
+ namePairs.put("CESNET_Prague_JRA1", "Prague_CESNET");
+ namePairs.put("FCCN_Lisbon_JRA1", "Lisbon_FCCN");
+ namePairs.put("GARR_Bologna_JRA1", "Bologna_GARR");
+ namePairs.put("GARR_Rome_JRA1", "none");
+ namePairs.put("GRNET_Athens_JRA1", "Athens_GRNET");
+ namePairs.put("GRNET_Thessaloniki_JRA1",
"Thessaloniki_GRNET");
+ namePairs.put("Hungarnet_Budapest_JRA1",
"Budapest_HUNGARNET");
+ namePairs.put("ISTF_Sofia_JRA1", "Sofia_ISTF");
+ namePairs.put("RENATER_Paris_JRA1", "none");
+ namePairs.put("SURFNet_Amsterdam_JRA1", "Amsterdam_SURFnet");
+ namePairs.put("PSNC_Poznan_JRA1", "Poznan_GEANT");
+ namePairs.put("UNINet_Tromsoe_JRA1", "Tromso_UNINet");
}
+
public void addWidgets() {
GridBagConstraints constraints;
@@ -193,6 +224,20 @@
windowSizeLabel.setLabelFor(windowSize);
add(windowSizeLabel, constraints);
+ userRTT = new JTextField("");
+ constraints.gridx = 4;
+ constraints.gridy = 4;
+ userRTT.setToolTipText("Note: Either enter RTT manually " +
+ "or retrieve it using IPPM OneWayDelay
requsets "+
+ "by clicking 'Estimate RTT' command");
+ add(userRTT, constraints);
+
+ userRTTLabel = new JLabel("RTT (s)");
+ constraints.gridx -= 1;
+ userRTTLabel.setLabelFor(userRTT);
+ add(userRTTLabel, constraints);
+
+
bufferSize = new JTextField("");
constraints.gridx = 4;
constraints.gridy = 3;
@@ -288,12 +333,25 @@
constraints.gridy = 10;
constraints.gridwidth = 5;
add(resultSeparator, constraints);
- constraints.gridwidth = 1;
+ //constraints.gridwidth = 1;
+ oneWayDelayInfoLabel = new JLabel("Click 'Estimate RTT' to
get the estimated RTT between two points (based on IPPM OWD)");
+ constraints.gridx = 0;
+ constraints.gridy = 11;
+ constraints.gridwidth = 5;
+ constraints.fill = GridBagConstraints.HORIZONTAL;
+ add(oneWayDelayInfoLabel, constraints);
+
+ oneWayDelaySeparator = new JSeparator();
+ constraints.gridx = 0;
+ constraints.gridy = 12;
+ constraints.gridwidth = 5;
+ add(oneWayDelaySeparator, constraints);
+
result = new JTextArea("Result");
result.setBorder(BorderFactory.createEtchedBorder());
constraints.gridx = 0;
- constraints.gridy = 11;
+ constraints.gridy = 13;
constraints.gridwidth = 5;
constraints.fill = GridBagConstraints.BOTH;
//result.setAutoscrolls(true);
@@ -343,6 +401,7 @@
endpoints = model.getEndpointList();
sourceAddress.setText(getEndpointHost(endpoints));
+ sourceName = getEndpointName(endpoints);
for (int i = 0; i < endpoints.size(); i++)
{
endpoint = endpoints.get(i);
@@ -352,14 +411,25 @@
break;
}
}
+ resetRTTData();
}
public void updateDestination()
{
destinationAddress.setText(getEndpointHost(
((BWCTLPerfsonarTab) model).destinations));
+ destinationName =
getEndpointName(((BWCTLPerfsonarTab)model).destinations);
+ resetRTTData();
}
+ public String getSourceName() {
+ return namePairs.get(sourceName);
+ }
+
+ public String getDestinationName() {
+ return namePairs.get(destinationName);
+ }
+
public String getEndpointHost(MAEndpointList endpoints)
{
if (endpoints == null)
@@ -396,7 +466,37 @@
/* No active endpoint */
return null;
}
+
+ public String getEndpointName(MAEndpointList endpoints)
+ {
+ if (endpoints == null)
+ {
+ return null;
+ }
+ for (int i = 0; i < endpoints.size(); i++)
+ {
+ MAEndpoint endpoint;
+ String name;
+
+ endpoint = endpoints.get(i);
+ if (! endpoint.isEnabled())
+ {
+ continue;
+ }
+
+ name = endpoint.getTitle();
+
+ /* Needs a bit more work for IPv6
+ * service addresses, see RFC 2732.
+ */
+ return name;
+ }
+
+ /* No active endpoint */
+ return null;
+ }
+
public void actionPerformed(ActionEvent event)
{
if (event == null) return;
@@ -409,16 +509,26 @@
bandwidthLabel.setVisible(false);
windowSize.setVisible(true);
windowSizeLabel.setVisible(true);
+ userRTT.setVisible(true);
+ userRTTLabel.setVisible(true);
+ resetRTTData();
return;
}
if (event.getActionCommand().equals("UDP"))
{
windowSize.setVisible(false);
windowSizeLabel.setVisible(false);
+ userRTT.setVisible(false);
+ userRTTLabel.setVisible(false);
bufferSize.setVisible(true);
bufferSizeLabel.setVisible(true);
bandwidth.setVisible(true);
bandwidthLabel.setVisible(true);
+ resetRTTData();
}
}
+ public void resetRTTData(){
+ userRTT.setText("");
+ oneWayDelayInfoLabel.setText("Click 'Estimate RTT' to get the
estimated RTT between two points (based on IPPM OWD)");
+ }
}
Modified:
branches/perfsonarui/src/org/perfsonar/perfsonarui/bwctl/BWCTLPerfsonarTab.java
===================================================================
---
branches/perfsonarui/src/org/perfsonar/perfsonarui/bwctl/BWCTLPerfsonarTab.java
2008-10-20 13:02:49 UTC (rev 4631)
+++
branches/perfsonarui/src/org/perfsonar/perfsonarui/bwctl/BWCTLPerfsonarTab.java
2008-10-20 13:11:53 UTC (rev 4632)
@@ -5,17 +5,20 @@
import java.util.ArrayList;
import java.util.List;
+import org.perfsonar.perfsonarui.AbstractUserData;
import org.perfsonar.perfsonarui.IPerfsonarSchema;
import org.perfsonar.perfsonarui.PSException;
import org.perfsonar.perfsonarui.PerfsonarSchema;
import org.perfsonar.perfsonarui.SmartMARequest;
import org.perfsonar.perfsonarui.UnsupportedTypeException;
+import org.perfsonar.perfsonarui.lookingglass.MetadataKeyRequestAction;
import org.perfsonar.perfsonarui.plugins.IPerfsonarRequest;
import org.perfsonar.perfsonarui.plugins.MAEndpoint;
import org.perfsonar.perfsonarui.plugins.MAEndpointList;
import org.perfsonar.perfsonarui.ui.PerfsonarModel;
import org.perfsonar.perfsonarui.ui.actions.PSUIAction;
import org.perfsonar.perfsonarui.ui.actions.PerfsonarRequestAction;
+import org.perfsonar.perfsonarui.ui.actions.SetupDataRequestAction;
import org.perfsonar.perfsonarui.ui.actions.ShowEndpointsAction;
/**
@@ -63,14 +66,14 @@
{
return request;
}
-
return new SmartMARequest() {
public IPerfsonarRequest createMARequest(MAEndpoint
endpoint) throws PSException {
String schema;
-
schema = endpoint.getSchema().getSchema();
- if (schema.equals(BWCTLRequest.REQUEST_TYPE))
+ if (schema.equals("bwctl"))
return new BWCTLRequest(pane);
+ if (schema.equals("ippm"))
+ return new RTTRequest(pane);
throw new UnsupportedTypeException(endpoint);
}
};
@@ -86,15 +89,13 @@
pane = new BWCTLMainComponent(parentComponent, this);
return pane;
}
-
- /**
- * Not supported (or necessary) for this plugin
- */
- public PerfsonarRequestAction createMetadataRequestAction()
- {
- return null;
+
+ public PerfsonarRequestAction createMetadataRequestAction(){
+ AbstractUserData rttUserData = new AbstractUserData();
+ rttUserData.setEndpoint(new
MAEndpoint("GEANT,http://radagast.x-win.dfn.de:8090/services/MA/HADES/GEANT,ippm,,ippm_aggregated,ippm_aggregated"));
+ return new
SetupDataRequestAction(createSmartRequest(),rttUserData,responseData,"Estimate
RTT",null,defaultGroupQuery);
}
-
+
public String toString()
{
return "BWCTL";
@@ -116,7 +117,6 @@
public MAEndpointList createEndpoints()
{
MAEndpointList list;
-
list = super.createEndpoints();
list.setMultipleEndpoints(false);
return list;
Modified:
branches/perfsonarui/src/org/perfsonar/perfsonarui/bwctl/BWCTLRequest.java
===================================================================
---
branches/perfsonarui/src/org/perfsonar/perfsonarui/bwctl/BWCTLRequest.java
2008-10-20 13:02:49 UTC (rev 4631)
+++
branches/perfsonarui/src/org/perfsonar/perfsonarui/bwctl/BWCTLRequest.java
2008-10-20 13:11:53 UTC (rev 4632)
@@ -5,7 +5,6 @@
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.NodeList;
-import org.w3c.dom.Node;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.DocumentBuilder;
@@ -26,14 +25,6 @@
{
public static final String REQUEST_TYPE = "bwctl";
public static final String XML_TEMPLATE =
"org/perfsonar/perfsonarui/bwctl/BWCTL-Request-template.xml";
-
-/*
- protected static String[][] URI_nmwgt =
{{"nmwgt","http://ggf.org/ns/nmwg/topology/2.0/"}};
- protected static String[][] URI_nmwg =
{{"nmwg","http://ggf.org/ns/nmwg/base/2.0/"}};
- protected static String[][] URI_nmwgm =
{{"nmwgm","http://ggf.org/ns/nmwg/time/2.0/"}};
- protected static String[][] URI_bwctl =
{{"bwctl","http://ggf.org/ns/nmwg/tools/bwctl/2.0/"}};
- protected static String[][] URI_iperf =
{{"iperf","http://ggf.org/ns/nmwg/tools/iperf/2.0/"}};
-*/
private BWCTLMainComponent mainComponent;
public BWCTLRequest(BWCTLMainComponent pane) {
@@ -63,7 +54,7 @@
messageType);
}
}
-
+
private Document createSetupDataRequest(IUserData userData)
throws Exception
{
@@ -166,11 +157,10 @@
{
return REQUEST_TYPE;
}
-
+
public void process(IUserData uData, Document response,
IPerfsonarResponse listener)
{
- NodeList returnCode;
NodeList datas;
Element data;
NodeList datums;
@@ -195,7 +185,6 @@
{
String returnMessage;
- String metadataRef;
datas = response.getElementsByTagName("nmwg:data");
@@ -257,7 +246,7 @@
output = output +
"Interval: " +
datum.getAttribute("duration") +
- "Transferred: " +
+ " Transferred: " +
datum.getAttribute("numBytes") + " " +
datum.getAttribute("numBytesUnits") +
" / " +
@@ -266,6 +255,22 @@
datum.getAttribute("valueUnits") +
"\n";
}
+ if(mainComponent.protocolTCP.isSelected()){
+ Double rtt = 0.0;
+ Double window = 0.0;
+ Double maxBW = 0.0;
+ try {
+ rtt =
Double.parseDouble(mainComponent.userRTT.getText());
+ window =
Double.parseDouble(mainComponent.windowSize.getText());
+ }catch (NumberFormatException e){
+ output+="\nRTT or window size is not
a valid number";
+ }
+ window*=8;
+ if(rtt!=0.0) maxBW = window/rtt;
+ Long maxBWLong = new Long(maxBW.longValue());
+ if (maxBWLong!=0) output+="\nExpected maximum
BW (based on window size and RTT) is:\n" + maxBWLong + " bits/sec";
+ else output+="\nCannot calculate expected
maximum BW\nCheck window size and RTT";
+ }
}
mainComponent.result.setText(output);
}
Added:
branches/perfsonarui/src/org/perfsonar/perfsonarui/bwctl/RTTRequest.java
Added:
branches/perfsonarui/src/org/perfsonar/perfsonarui/bwctl/RTTUserData.java
- perfsonar: r4632 - branches/perfsonarui/src/org/perfsonar/perfsonarui/bwctl, svnlog, 10/20/2008
Archive powered by MHonArc 2.6.16.