Commit 49601f01 authored by Jonathon Duerig's avatar Jonathon Duerig

Checkpoint of changes made to run at the GEC at the end of May.

parent b2bade9a
#!/usr/bin/perl
$command = 'scp demo.swf duerig@boss.emulab.net:/usr/testbed/www/protogeni-demo-fed.swf';
print $command."\n";
system $command;
#!/bin/sh
scp demo.swf duerig@boss.emulab.net:/usr/testbed/www/protogeni-demo.swf
No preview for this file type
<html>
<body>
<table>
<tr>
<?php
$names = explode(",", $_GET["names"]);
$cms = explode(",", $_GET["cms"]);
$hosts = explode(",", $_GET["hostnames"]);
$width = 3;
$i = 0;
for (; $i < count($names); ++$i)
{
$url = "http://" . $hosts[$i] . "/speed-test.swf";
if ($i != 0 && $i % $width == 0)
{
echo "</tr><tr>\n";
}
?>
<td bgcolor="#ccccff" align="center">
<h3>
<?php
echo $cms[$i];
?>
--
<?php
echo $names[$i];
?>
</h3>
<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"
codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0"
width="337" height="250" id="demo" align="middle">
<param name="allowScriptAccess" value="sameDomain" />
<param name="allowFullScreen" value="false" />
<param name="movie"
<?php
echo "value=\"" . $url . "\"";
?>
/>
<paran name="hostname"
<?php
echo "value=\"" . $hosts[$i] . "\" ";
?>
/>
<param name="quality" value="high" />
<param name="bgcolor" value="#cccccc" />
<embed
<?php
echo "src=\"" . $url . "\" ";
echo "hostname=\"" . $hosts[$i] . "\" ";
?>
quality="high" bgcolor="#cccccc"
width="337" height="250" name="demo" align="middle"
allowScriptAccess="sameDomain" allowFullScreen="false"
type="application/x-shockwave-flash"
pluginspage="http://www.macromedia.com/go/getflashplayer" />
</object>
</td>
<?php
}
?>
</tr>
</table>
</body>
</html>
/* GENIPUBLIC-COPYRIGHT
* Copyright (c) 2009 University of Utah and the Flux Group.
* All rights reserved.
*
* Permission to use, copy, modify and distribute this software is hereby
* granted provided that (1) source code retains these copyright, permission,
* and disclaimer notices, and (2) redistributions including binaries
* reproduce the notices in supporting documentation.
*
* THE UNIVERSITY OF UTAH ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
* CONDITION. THE UNIVERSITY OF UTAH DISCLAIMS ANY LIABILITY OF ANY KIND
* FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
*/
package
{
import flash.display.MovieClip;
import flash.display.Shape;
import flash.text.TextField;
import flash.events.Event;
import flash.events.ProgressEvent;
import flash.events.HTTPStatusEvent;
import flash.events.IOErrorEvent;
import flash.events.SecurityErrorEvent;
import flash.geom.ColorTransform;
import flash.net.URLRequest;
import flash.net.URLLoader;
import flash.net.URLRequestHeader;
import flash.utils.getTimer;
public class Main
{
public function Main(parent : MovieClip, newBack : BackgroundClip,
newStatusText : TextField,
newThroughput : TextField) : void
{
parent.addEventListener(Event.ENTER_FRAME, enterFrame);
back = newBack;
statusText = newStatusText;
throughput = newThroughput;
var myUrl = parent.stage.loaderInfo.loaderURL;
var urlIndex = myUrl.lastIndexOf("/");
url = myUrl.substring(0, urlIndex) + "/download.jpg";
sizeX = parent.stage.stageWidth;
sizeY = parent.stage.stageHeight;
loader = null;
isLoading = false;
deadline = getTimer() + Math.floor(Math.random()*WAIT_TIME);
startTime = 0;
}
function enterFrame(event : Event) : void
{
if (! isLoading && getTimer() > deadline)
{
loadUrl();
}
}
function draw(color : ColorTransform) : void
{
back.back.transform.colorTransform = color;
}
function loadUrl() : void
{
startTime = getTimer();
statusText.text = "Downloading";
var request = new URLRequest(url + "?foo=" + String(Math.random()));
var headers : Array
= new Array(new URLRequestHeader("Cache-Control", "no-store"),
new URLRequestHeader("Pragma", "no-cache"));
request.requestHeaders = headers;
loader = new URLLoader(request);
loader.addEventListener(Event.COMPLETE, complete);
loader.addEventListener(ProgressEvent.PROGRESS, progress);
loader.addEventListener(HTTPStatusEvent.HTTP_STATUS, statusFail);
loader.addEventListener(IOErrorEvent.IO_ERROR, ioFail);
loader.addEventListener(SecurityErrorEvent.SECURITY_ERROR,
securityFail);
isLoading = true;
}
function cleanupUrl() : void
{
loader.removeEventListener(Event.COMPLETE, complete);
loader.removeEventListener(ProgressEvent.PROGRESS, progress);
loader.removeEventListener(HTTPStatusEvent.HTTP_STATUS, statusFail);
loader.removeEventListener(IOErrorEvent.IO_ERROR, ioFail);
loader.removeEventListener(SecurityErrorEvent.SECURITY_ERROR,
securityFail);
loader = null;
isLoading = false;
deadline = getTimer() + WAIT_TIME;
}
function complete(event : Event) : void
{
draw(GREEN);
statusText.text = "Download Succeeded";
var diff = (getTimer() - startTime)/1000;
var bits = loader.bytesLoaded * 8;
var bps = 0;
if (diff > 0)
{
bps = bits/diff;
}
if (bps < 1000)
{
throughput.text = String(int(bps)) + " bps";
}
else
{
var kbps = bps / 1000;
if (kbps < 1000)
{
throughput.text = String(int(kbps)) + " Kbps";
}
else
{
var mbps = kbps / 1000;
throughput.text = String(int(mbps)) + " Mbps";
}
}
cleanupUrl();
}
function progress(event : ProgressEvent) : void
{
draw(GREEN);
}
function statusFail(event : HTTPStatusEvent) : void
{
}
function ioFail(event : IOErrorEvent) : void
{
draw(RED);
statusText.text = "Download Failed";
throughput.text = "";
cleanupUrl();
}
function securityFail(event : SecurityErrorEvent) : void
{
draw(RED);
statusText.text = "Security Failure";
throughput.text = "";
cleanupUrl();
}
var back : BackgroundClip;
var statusText : TextField;
var throughput : TextField;
var url : String;
var sizeX : int;
var sizeY : int;
var loader : URLLoader;
var isLoading : Boolean;
var deadline : int;
var startTime : int;
static var WAIT_TIME = 10000;
static var RED : ColorTransform = new ColorTransform(1.5, 0.5, 0.5, 1.0,
0, 0, 0, 0);
static var GREEN : ColorTransform = new ColorTransform(0.5, 1.5, 0.5, 1.0,
0, 0, 0, 0);
static var YELLOW : ColorTransform = new ColorTransform(1.5, 1.5, 0.5, 1.0,
0, 0, 0, 0);
}
}
chmod a-x speed-test.swf && scp speed-test.swf duerig@node.pelab-devbox.tbres.emulab.net:/local/speed-test/web
......@@ -77,11 +77,13 @@ package
linkLayer = null;
}
public function addNode(name : String, uuid : String, cmIndex : int,
public function addNode(name : String, uuid : String,
interfaces : Array, cmIndex : int,
nodeIndex : int, cleanupMethod : Function,
x : int, y : int) : void
{
var newNode : Node = new Node(nodeLayer, name, uuid, cmIndex, nodeIndex,
var newNode : Node = new Node(nodeLayer, name, uuid, interfaces,
cmIndex, nodeIndex,
cleanupMethod, nodes.length,
beginDragEvent, beginAddLink);
dragX = Node.CENTER_X;
......@@ -286,14 +288,28 @@ package
return result;
}
public function getXml(cmIndex : int) : XML
public function setSliverId(cmIndex : int, name : String,
sliverId : String) : void
{
var i : int = 0;
for (; i < nodes.length; ++i)
{
if (nodes[i].getCmIndex() == cmIndex
&& nodes[i].getName() == name)
{
nodes[i].setSliverId(sliverId);
}
}
}
public function getXml(cmIndex : int, useTunnels : Boolean) : XML
{
var result : XML = null;
var i : int = 0;
for (i = 0; i < nodes.length; ++i)
{
var currentNode : XML = nodes[i].getXml(cmIndex);
var currentNode : XML = nodes[i].getXml(cmIndex, useTunnels);
if (currentNode != null)
{
if (result == null)
......@@ -306,7 +322,7 @@ package
for (i = 0; i < links.length; ++i)
{
var currentLink : XML = links[i].getXml(cmIndex);
var currentLink : XML = links[i].getXml(cmIndex, useTunnels);
if (currentLink != null)
{
result.appendChild(currentLink);
......@@ -359,6 +375,51 @@ package
return result;
}
public function hasTunnels(cmIndex : int) : Boolean
{
var result : Boolean = false;
var i : int = 0;
for (; i < links.length && !result; ++i)
{
result = result || links[i].hasTunnelTo(cmIndex);
}
return result;
}
public function getSpeedUrl() : String
{
var result : String = null;
var names : String = "";
var cms : String = "";
var hostnames : String = "";
var isFirst : Boolean = true;
var i : int = 0;
for (; i < nodes.length; ++i)
{
if (nodes[i].isBooted())
{
if (!isFirst)
{
names += ",";
cms += ",";
hostnames += ",";
}
isFirst = false;
names += nodes[i].getName();
cms += ComponentManager.cmNames[nodes[i].getCmIndex()];
hostnames += nodes[i].getHostName();
}
}
if (names != "")
{
result = "http://boss.emulab.net/speed-test.php?";
result += "names=" + names + "&";
result += "cms=" + cms + "&";
result += "hostnames=" + hostnames;
}
return result;
}
var nodes : Array;
var links : Array;
var parent : DisplayObjectContainer;
......
/* GENIPUBLIC-COPYRIGHT
* Copyright (c) 2009 University of Utah and the Flux Group.
* All rights reserved.
*
* Permission to use, copy, modify and distribute this software is hereby
* granted provided that (1) source code retains these copyright, permission,
* and disclaimer notices, and (2) redistributions including binaries
* reproduce the notices in supporting documentation.
*
* THE UNIVERSITY OF UTAH ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
* CONDITION. THE UNIVERSITY OF UTAH DISCLAIMS ANY LIABILITY OF ANY KIND
* FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
*/
package
{
import flash.events.MouseEvent;
public class ButtonList
{
public function ButtonList(newButtons : Array, newFunctions : Array) : void
{
buttons = newButtons;
functions = newFunctions;
var i : int = 0;
for (; i < buttons.length; ++i)
{
buttons[i].addEventListener(MouseEvent.CLICK, functions[i]);
buttons[i].addEventListener(MouseEvent.MOUSE_OVER, rollOver);
buttons[i].addEventListener(MouseEvent.MOUSE_OUT, rollOut);
buttons[i].mouseChildren = false;
}
}
public function cleanup() : void
{
var i : int = 0;
for (; i < buttons.length; ++i)
{
buttons[i].removeEventListener(MouseEvent.CLICK, functions[i]);
buttons[i].removeEventListener(MouseEvent.MOUSE_OVER, rollOver);
buttons[i].removeEventListener(MouseEvent.MOUSE_OUT, rollOut);
}
}
function rollOver(event : MouseEvent) : void
{
var index : int = getIndex(event);
if (index != -1
&& buttons[index].currentFrame == NORMAL)
{
buttons[index].gotoAndStop(OVER);
}
}
function rollOut(event : MouseEvent) : void
{
var index : int = getIndex(event);
if (index != -1
&& buttons[index].currentFrame == OVER)
{
buttons[index].gotoAndStop(NORMAL);
}
}
function getIndex(event : MouseEvent) : int
{
var index : int = -1;
var i : int = 0;
for (; i < buttons.length; ++i)
{
if (buttons[i] == event.target)
{
index = i;
break;
}
}
return index;
}
var buttons : Array;
var functions : Array;
public static var NORMAL : int = 1;
public static var OVER : int = 2;
public static var GHOSTED : int = 3;
}
}
/* GENIPUBLIC-COPYRIGHT
* Copyright (c) 2009 University of Utah and the Flux Group.
* All rights reserved.
*
* Permission to use, copy, modify and distribute this software is hereby
* granted provided that (1) source code retains these copyright, permission,
* and disclaimer notices, and (2) redistributions including binaries
* reproduce the notices in supporting documentation.
*
* THE UNIVERSITY OF UTAH ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
* CONDITION. THE UNIVERSITY OF UTAH DISCLAIMS ANY LIABILITY OF ANY KIND
* FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
*/
// A component has the raw information from the ptop file which is
// used to create nodes.
package
{
public class Component
{
public function Component() : void
{
name = "";
uuid = "";
interfaces = new Array();
}
public var name : String;
public var uuid : String;
public var interfaces : Array;
}
}
......@@ -22,6 +22,7 @@ package
import fl.controls.List;
import fl.events.ListEvent;
import flash.events.Event;
import flash.utils.Dictionary;
class ComponentManager
{
......@@ -37,21 +38,21 @@ package
listStatus.alpha = 0.3;
nodes = newNodes;
names = new Array();
uuids = new Array();
components = new Array();
used = new Array();
tickets = new Array();
states = new Array();
select.removeAll();
select.selectedIndex = 0;
select.rowCount = 4;
var i : int = 0;
for (; i < cmNames.length; ++i)
{
select.addItem(new ListItem(cmNames[i], null));
names.push(new Array());
uuids.push(new Array());
components.push(new Array());
used.push(new Array());
tickets.push(null);
states.push(LOADING);
......@@ -115,8 +116,10 @@ package
{
if (used[select.selectedIndex].indexOf(event.index) == -1)
{
nodes.addNode(names[select.selectedIndex][event.index],
uuids[select.selectedIndex][event.index],
var com = components[select.selectedIndex][event.index];
nodes.addNode(com.name,
com.uuid,
com.interfaces,
select.selectedIndex,
event.index,
removeNode,
......@@ -143,9 +146,9 @@ package
list.removeAll();
list.clearSelection();
var i : int = 0;
for (; i < names[current].length; ++i)
for (; i < components[current].length; ++i)
{
list.addItem(new ListItem(names[current][i], "NodeNone"));
list.addItem(new ListItem(components[current][i].name, "NodeNone"));
}
list.selectedIndices = used[current].slice();
if (states[current] == NORMAL)
......@@ -168,31 +171,91 @@ package
public function populateNodes(index : int, str : String) : void
{
if (str != null)
var console = Main.getConsole();
if (console != null)
{
console.appendText("\npopulateNodes: " + cmNames[index] + "\n");
}
try
{
var rspec : XML = XML(str);
var nodeName : QName = new QName(rspec.namespace(), "node");
var xmlNodes : Array = new Array();
for each (var element in rspec.elements(nodeName))
if (str != null)
{
if (element.attribute("component_uuid") != null
&& element.attribute("component_uuid") != "")
var uuidToNode = new Dictionary();
var rspec : XML = XML(str);
var nodeName : QName = new QName(rspec.namespace(), "node");
var xmlNodes : Array = new Array();
for each (var element in rspec.elements(nodeName))
{
var uuidAtt : String = element.attribute("component_uuid");
if (uuidAtt != "")
{
xmlNodes.push(element);
}
}
xmlNodes.sort(xmlSort);
var i : int = 0;
for (; i < xmlNodes.length; ++i)
{
xmlNodes.push(element);
var com : Component = new Component();
components[index].push(com);
var uuid : String = xmlNodes[i].attribute("component_uuid");
uuidToNode[uuid] = com;
com.name = xmlNodes[i].attribute("component_name");
com.uuid = uuid;
var interfaceName = new QName(rspec.namespace(), "interface");
var interfaceList = xmlNodes[i].elements(interfaceName);
for each (var inter in interfaceList)
{
var interName = inter.attribute("component_name");
com.interfaces.push(new Interface(interName));
}
}
parseLinks(rspec, uuidToNode);
}
xmlNodes.sort(xmlSort);
var i : int = 0;
for (; i < xmlNodes.length; ++i)
states[index] = NORMAL;
updateList();
}
catch (e : Error)
{