Commit 4343a5a4 authored by U-CASSANDRA\duerig's avatar U-CASSANDRA\duerig
Browse files

Bugfixes to flash client and modifications to work with minimal API. Updates to speed-test.

parent 55aebea1
<html>
<head>
</head>
<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">
<iframe width="380" height="350" scrolling="no" frameborder="0"
<?php
echo "src=\"single-speed-test.php?name=" . $names[$i]
. "&cm=" . $cms[$i] . "&hostname=" . $hosts[$i] . "\"";
?>
></iframe>
</td>
<?php
}
?>
</tr>
</table>
</body>
</html>
......@@ -52,6 +52,7 @@ package
public static var getSliver : Array = new Array(cm, "GetSliver");
public static var sliverStatus : Array = new Array(cm, "SliverStatus");
public static var sliverTicket : Array = new Array(cm, "SliverTicket");
public static var createSliver : Array = new Array(cm, "CreateSliver");
public static var discoverResourcesv2 : Array = new Array(cmv2, "DiscoverResources");
......
......@@ -56,5 +56,12 @@ package
+ "\n";
}
}
public static function makeUrn(authority : String,
type : String,
name : String) : String
{
return "urn:publicid:IDN+" + authority + "+" + type + "+" + name;
}
}
}
<html>
<head>
<script type="text/JavaScript">
<!--
function init(time)
{
setTimeout("refresh();", time);
}
function refresh()
{
if (window.success === undefined) {
location.reload(true);
}
}
function loadSuccess()
{
window.success = 1;
}
// -->
</script>
</head>
<body bgcolor="#cccccc" onload="javascript:init(10000);">
<center>
<?php
$name = $_GET["name"];
$cm = $_GET["cm"];
$host = $_GET["hostname"];
$width = 3;
?>
<h3>
<?php
echo $name;
?>
</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="always" />
<param name="allowNeworking" value="all" />
<param name="allowFullScreen" value="false" />
<param name="movie"
<?php
echo "value=\"http://" . $host . "/speed-test.swf\"";
?>
/>
<param name="FlashVars"
<?php
echo "value=\"url=http://" . $host . "\" ";
?>
/>
<param name="quality" value="high" />
<param name="bgcolor" value="#cccccc" />
<embed
<?php
echo "src=\"http://" . $host . "/speed-test.swf\"";
?>
<?php
echo "FlashVars=\"url=http://" . $host . "\" ";
?>
quality="high" bgcolor="#cccccc"
width="337" height="250" name="demo" align="middle"
allowScriptAccess="always" allowFullScreen="false"
allowNetworking="all"
type="application/x-shockwave-flash"
pluginspage="http://www.macromedia.com/go/getflashplayer" />
</object>
</center>
</body>
</html>
<html>
<body>
<head>
<script type="text/JavaScript">
<!--
function refresh(time)
{
setTimeout("location.reload(true);", time);
}
// -->
</script>
</head>
<body onload="javascript:refresh(10000);">
<table>
<tr>
......@@ -24,12 +34,6 @@ for (; $i < count($names); ++$i)
<td bgcolor="#ccccff" align="center">
<h3>
<?php
echo $cms[$i];
?>
--
<?php
echo $names[$i];
?>
......@@ -38,34 +42,36 @@ for (; $i < count($names); ++$i)
<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="allowScriptAccess" value="always" />
<param name="allowNeworking" value="all" />
<param name="allowFullScreen" value="false" />
<param name="movie"
<?php
echo "value=\"" . $url . "\"";
echo "value=\"http://" . $hosts[$i] . "/speed-test.swf\"";
?>
/>
<paran name="hostname"
/>
<param name="FlashVars"
<?php
echo "value=\"" . $hosts[$i] . "\" ";
echo "value=\"url=http://" . $hosts[$i] . "\" ";
?>
/>
<param name="quality" value="high" />
<param name="bgcolor" value="#cccccc" />
<embed
<?php
echo "src=\"http://" . $hosts[$i] . "/speed-test.swf\"";
?>
<?php
echo "src=\"" . $url . "\" ";
echo "hostname=\"" . $hosts[$i] . "\" ";
echo "FlashVars=\"url=http://" . $hosts[$i] . "\" ";
?>
quality="high" bgcolor="#cccccc"
width="337" height="250" name="demo" align="middle"
allowScriptAccess="sameDomain" allowFullScreen="false"
allowScriptAccess="always" allowFullScreen="false"
allowNetworking="all"
type="application/x-shockwave-flash"
pluginspage="http://www.macromedia.com/go/getflashplayer" />
</object>
......
......@@ -27,6 +27,7 @@ package
import flash.net.URLLoader;
import flash.net.URLRequestHeader;
import flash.utils.getTimer;
import flash.external.ExternalInterface;
public class Main
{
......@@ -34,14 +35,19 @@ package
newStatusText : TextField,
newThroughput : TextField) : void
{
ExternalInterface.call("loadSuccess");
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";
var myUrl = parent.stage.loaderInfo.parameters["url"];
// var myUrl = parent.stage.loaderInfo.loaderURL;
// var urlIndex = myUrl.lastIndexOf("/");
// url = myUrl.substring(0, urlIndex) + "/speed-test.swf";
url = myUrl + "/speed-test.swf";
statusText.text = url;
sizeX = parent.stage.stageWidth;
sizeY = parent.stage.stageHeight;
......
......@@ -35,12 +35,14 @@ package
newManagers : ComponentView,
newArena : SliceDetailClip,
newCredential : Credential,
newText : String) : void
newText : String,
newSliceName : String) : void
{
nodes = newNodes;
managers = newManagers;
arena = newArena;
credential = newCredential;
sliceUrn = Util.makeUrn(Geni.defaultAuthority, "slice", newSliceName);
clip = new ConsoleClip();
parent.addChild(clip);
......@@ -164,12 +166,12 @@ package
if (cm.getSliver() == null)
{
rspec = nodes.getXml(false, cm);
result = new RequestSliverCreate(cm, nodes, rspec, arena.sliceName.text);
result = new RequestSliverCreate(cm, nodes, rspec, sliceUrn);
}
else if (cm.getVersion() >= 2)
{
rspec = nodes.getXml(true, cm);
result = new RequestSliverUpdate(cm, nodes, rspec, false, arena.sliceName.text);
result = new RequestSliverUpdate(cm, nodes, rspec, false, sliceUrn);
}
}
return result;
......@@ -188,7 +190,7 @@ package
var result : Request = null;
if (nodes.existsState(cm, ActiveNodes.CREATED))
{
result = new RequestSliverStart(cm, nodes, arena.sliceName.text);
result = new RequestSliverStart(cm, nodes, sliceUrn);
}
return result;
}
......@@ -221,7 +223,7 @@ package
|| nodes.existsState(cm, ActiveNodes.CREATED)
|| nodes.existsState(cm, ActiveNodes.BOOTED))
{
result = new RequestSliverDestroy(cm, nodes, arena.sliceName.text);
result = new RequestSliverDestroy(cm, nodes, sliceUrn);
}
return result;
}
......@@ -384,5 +386,6 @@ package
var working : Boolean;
var credential : Credential;
var sliceUrn : String;
}
}
......@@ -218,8 +218,8 @@ package
clip.loadText.text = "Deleting existing slice";
op.reset(Geni.remove);
op.addField("credential", credential.base);
op.addField("hrn", "urn:publicid:IDN+" + Geni.defaultAuthority
+ "+slice+"+sliceName);
op.addField("hrn", Util.makeUrn(Geni.defaultAuthority, "slice",
sliceName));
op.addField("type", "Slice");
op.call(completeSliceDelete, failure);
addSend();
......@@ -232,12 +232,12 @@ package
{
startSliceCreate();
}
else if(code == 7)
{
var newMenu = new MenuSliceSelect();
Main.changeState(newMenu);
newMenu.setSliceName(sliceName + " hasn't expired");
}
else if(code == 7)
{
var newMenu = new MenuSliceSelect();
Main.changeState(newMenu);
newMenu.setSliceName(sliceName + " hasn't expired");
}
else
{
codeFailure();
......@@ -250,8 +250,8 @@ package
clip.loadText.text = "Creating new slice";
op.reset(Geni.register);
op.addField("credential", credential.base);
op.addField("hrn", "urn:publicid:IDN+" + Geni.defaultAuthority
+ "+slice+"+sliceName);
op.addField("hrn", Util.makeUrn(Geni.defaultAuthority, "slice",
sliceName));
// op.addField("hrn", sliceName);
op.addField("type", "Slice");
// op.addField("userbindings", new Array(user.uuid));
......
......@@ -38,68 +38,68 @@ package
nodes = new ActiveNodes(parent, clip.nodeList, clip.description);
managers = new ComponentView(clip.cmSelect, clip.nodeList, nodes);
console = new Console(parent, nodes, managers, clip,
credential, Main.getText());
credential, Main.getText(), sliceName);
console.discoverResources();
wait = new SliceWait(clip.wait, clip.opText, console);
abstract = new AbstractNodes(clip, nodes, managers);
}
public override function getComponent(urn:String, cm:String):String
{
var compm : ComponentManager = null;
var cms : Array = managers.getManagers();
// Get CM
var length:int = cms.length;
for(var i:int = 0; i < length; i++)
{
if( cms[i].getName() == cm )
{
compm = ComponentManager(cms[i]);
break;
}
}
// Get component
if(compm != null)
{
var index:int;
try
{
index = compm.getIndexFromUuid(urn);
} catch(e:Error)
{
return "Node not found, most likely because it isn't available.";
}
if(compm.isUsed(index))
return "Component is being used already";
var component = compm.getComponent(index);
var superNode = null;
var superNodeName = null;
if (component.superNode != -1)
{
superNode = compm.getComponent(component.superNode);
superNodeName = superNode.name;
}
var randomX:Number = Math.round(Math.random() * 601 + 180);
var randomY:Number = Math.round(Math.random() * 385 + 75);
nodes.addNode(component, compm, index,
randomX, randomY, false,
superNodeName);
compm.addUsed(index);
if (superNode != null)
{
randomX = Math.round(Math.random() * 601 + 180);
randomY = Math.round(Math.random() * 385 + 75);
nodes.addNode(superNode, compm, component.superNode,
randomX, randomY, false, null);
compm.addUsed(component.superNode);
}
return "Successfully added " + urn + " on " + cm + "!";
} else {
return "Could not find component manager named " + cm;
}
}
public override function getComponent(urn:String, cm:String):String
{
var compm : ComponentManager = null;
var cms : Array = managers.getManagers();
// Get CM
var length:int = cms.length;
for(var i:int = 0; i < length; i++)
{
if( cms[i].getName() == cm )
{
compm = ComponentManager(cms[i]);
break;
}
}
// Get component
if(compm != null)
{
var index:int;
try
{
index = compm.getIndexFromUuid(urn);
} catch(e:Error)
{
return "Node not found, most likely because it isn't available.";
}
if(compm.isUsed(index))
return "Component is being used already";
var component = compm.getComponent(index);
var superNode = null;
var superNodeName = null;
if (component.superNode != -1)
{
superNode = compm.getComponent(component.superNode);
superNodeName = superNode.name;
}
var randomX:Number = Math.round(Math.random() * 601 + 180);
var randomY:Number = Math.round(Math.random() * 385 + 75);
nodes.addNode(component, compm, index,
randomX, randomY, false,
superNodeName);
compm.addUsed(index);
if (superNode != null)
{
randomX = Math.round(Math.random() * 601 + 180);
randomY = Math.round(Math.random() * 385 + 75);
nodes.addNode(superNode, compm, component.superNode,
randomX, randomY, false, null);
compm.addUsed(component.superNode);
}
return "Successfully added " + urn + " on " + cm + "!";
} else {
return "Could not find component manager named " + cm;
}
}
override public function cleanup() : void
{
......
......@@ -19,14 +19,14 @@ package
public function RequestSliverCreate(newManager : ComponentManager,
newNodes : ActiveNodes,
newRspec : String,
newSliceUrn : String) : void
newSliceUrn : String) : void
{
super(newManager.getName());
manager = newManager;
nodes = newNodes;
rspec = newRspec;
sliceUrn = newSliceUrn;
sliceUrn = newSliceUrn;
}
override public function cleanup() : void
......@@ -36,6 +36,7 @@ package
override public function start(credential : Credential) : Operation
{
/*
if (manager.getTicket() == null)
{
nodes.changeState(manager, ActiveNodes.PLANNED, ActiveNodes.CREATED);
......@@ -58,6 +59,15 @@ package
op.addField("keys", credential.ssh);
op.setUrl(manager.getUrl());
}
*/
nodes.changeState(manager, ActiveNodes.PLANNED, ActiveNodes.BOOTED);
opName = "Creating Sliver";
op.reset(Geni.createSliver);
op.addField("slice_urn", sliceUrn);
op.addField("rspec", rspec);
op.addField("keys", credential.ssh);
op.addField("credentials", new Array(credential.slice));
op.setUrl(manager.getUrl());
return op;
}
......@@ -65,6 +75,7 @@ package
credential : Credential) : Request
{
var result : Request = null;
/*
if (code == 0)
{
if (manager.getTicket() == null)
......@@ -104,6 +115,17 @@ package
result = releaseTicket();
nodes.revertState(manager);
}
*/
if (code == 0)
{
manager.setSliver(response.value[0]);
manager.setManifest(response.value[1]);
nodes.commitState(manager);
}
else
{
nodes.revertState(manager);
}
return result;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment