Commit 3f0a4e7f authored by Jonathon Duerig's avatar Jonathon Duerig
Browse files

Assorted fixes. Added support to use ListComponents at the CH rather than a hardcoded list

parent ce323b1a
......@@ -17,14 +17,21 @@ package
public class Geni
{
private static var sa : String = "sa";
private static var cm : String = "cm";
private static var cm : String = null;
private static var ses : String = "ses";
private static var ch : String = "ch";
private static var cmv2 : String = "cmv2";
// public static var defaultAuthority : String = "jonlab.testbed.emulab.net";
public static var defaultAuthority : String = "emulab.net";
// public static var defaultHost : String = "myboss.jonlab.testbed.emulab.net";
public static var defaultHost : String = "boss.emulab.net";
public static var sesUrl : String = "https://myboss.emulab.geni.emulab.net/protogeni/xmlrpc/";
//"https://boss.emulab.net:443/protogeni/xmlrpc/";
public static var chUrl : String = "https://boss.emulab.net/protogeni/xmlrpc/";
public static var getCredential : Array = new Array(sa, "GetCredential");
public static var getKeys : Array = new Array(sa, "GetKeys");
......
......@@ -30,6 +30,7 @@ package
public function reset(qualifiedMethod : Array) : void
{
cleanup();
if (qualifiedMethod != null)
{
module = qualifiedMethod[0];
......@@ -48,12 +49,20 @@ package
public function resetUrl() : void
{
url = "https://" + XMLRPC_SERVER + SERVER_PATH + module;
url = "https://" + Geni.defaultHost + SERVER_PATH;
if (module != null)
{
url += module;
}
}
public function setUrl(newUrl : String) : void
{
url = newUrl + "/" + module;
url = newUrl;
if (module != null)
{
url += "/" + module;
}
}
public function setExactUrl(newUrl : String) : void
......@@ -101,7 +110,7 @@ package
}
catch (e : Error)
{
Main.getConsole().appendText("\n\nException on XMLRPC Call: "
+ e.toString() + "\n\n");
}
......@@ -119,7 +128,7 @@ package
private function callSuccess(event : Event) : void
{
cleanup();
// cleanup();
success(Number(server.getResponse().code),
// server.getResponse().value.toString(),
// String(server.getResponse().output),
......@@ -128,16 +137,21 @@ package
private function callFailure(event : ErrorEvent) : void
{
cleanup();
// cleanup();
failure(event, server.getFault());
}
public function cleanup() : void
{
server.removeEventListener(Event.COMPLETE, callSuccess);
server.removeEventListener(ErrorEvent.ERROR, callFailure);
server.observeTimer.stop();
server.observeTimer = null;
if (server != null)
{
server.removeEventListener(Event.COMPLETE, callSuccess);
server.removeEventListener(ErrorEvent.ERROR, callFailure);
server.observeTimer.stop();
server.observeTimer = null;
server.cleanup();
server = null;
}
}
private var module : String;
......@@ -148,8 +162,6 @@ package
private var success : Function;
private var failure : Function;
private static var XMLRPC_SERVER : String = "boss.emulab.net:443";
// private static var XMLRPC_SERVER : String = "myboss.jonlab.geni.emulab.net:443";
private static var SERVER_PATH : String = "/protogeni/xmlrpc/";
private static var visitedSites : Dictionary = new Dictionary();
......
......@@ -72,8 +72,8 @@ package
listStatus.alpha = 0.3;
nodes = newNodes;
georgia.setUpdate(updateList);
managers = new Array(
/*
managers = new Array(
new ComponentManager("", "", "", "", updateList, 2),
new ComponentManager("e2a9e480-aa9f-11dd-9fcd-001143e43770",
"ProtoGENI",
......@@ -88,13 +88,13 @@ package
// "https://boss.emulab.net/protogeni/stoller/xmlrpc",
updateList, 2),
/*
new ComponentManager("be300821-ecb7-11dd-a0f8-001143e43ff3",
"gtwelab",
".emulab.net",
"https://myboss.emulab.geni.emulab.net:443/protogeni/xmlrpc",
updateList, 2),
*/
new ComponentManager("27cd73fb-b908-11de-837a-0002b33f8548",
"jonlab",
".emulab.net",
......@@ -105,13 +105,13 @@ package
".uky.emulab.net",
"https://www.uky.emulab.net/protogeni/xmlrpc",
updateList, 2),
/*
new ComponentManager("f38e8571-f7af-11dd-ab88-00304868a4be",
"Wisconsin",
".schooner.wail.wisc.edu",
"https://www.schooner.wail.wisc.edu/protogeni/xmlrpc",
updateList, 0),
*/
new ComponentManager("b14b4a9d-8e53-11de-be30-001ec9540a39", "CMU", ".cmcl.cs.cmu.edu",
"https://boss.cmcl.cs.cmu.edu/protogeni/xmlrpc",
updateList, 2),
......@@ -121,15 +121,21 @@ package
"https://boss.uml.emulab.net/protogeni/xmlrpc",
updateList, 2),
georgia);
*/
managers = new Array();
select.removeAll();
select.selectedIndex = 0;
addManager(new ComponentManager("", "", "", "", updateList, 2));
addManager(georgia);
/*
var i : int = 0;
for (; i < managers.length; ++i)
{
select.addItem(new ListItem(managers[i].getName(), managers[i]));
}
*/
managers[0].setState(ComponentManager.NORMAL);
list.addEventListener(ListEvent.ITEM_CLICK, clickItem);
......@@ -139,6 +145,14 @@ package
updateList();
}
public function addManager(newManager : ComponentManager) : void
{
newManager.setUpdate(updateList);
managers.push(newManager);
select.addItem(new ListItem(newManager.getName(), ""));
updateList();
}
public function cleanup() : void
{
list.removeEventListener(ListEvent.ITEM_CLICK, clickItem);
......
......@@ -83,6 +83,7 @@ package
public function discoverResources() : void
{
pushRequest(new RequestListComponents(managers));
forEachComponent(discoverSliver);
}
......@@ -102,7 +103,7 @@ package
}
else
{
return new RequestResourceDiscovery(cm);
return new RequestResourceDiscovery(cm, null);
}
}
else
......@@ -346,18 +347,25 @@ package
function complete(code : Number, response : Object) : void
{
clip.text.appendText(Util.getResponse(queue.front().getOpName(),
queue.front().getUrl(),
queue.front().getResponseXml()));
clip.text.scrollV = clip.text.maxScrollV;
var next : Request = queue.front().complete(code, response, credential);
queue.front().cleanup();
queue.pop();
if (next != null)
try
{
queue.push(next);
clip.text.appendText(Util.getResponse(queue.front().getOpName(),
queue.front().getUrl(),
queue.front().getResponseXml()));
clip.text.scrollV = clip.text.maxScrollV;
var next : Request = queue.front().complete(code, response, credential);
queue.front().cleanup();
queue.pop();
if (next != null)
{
queue.push(next);
}
start();
}
catch (e : Error)
{
clip.text.appendText("\n" + e.toString() + "\n\n" + e.getStackTrace());
}
start();
}
public function isWorking() : Boolean
......
......@@ -47,6 +47,7 @@ package
override public function cleanup() : void
{
op.cleanup();
clip.removeEventListener(Event.ENTER_FRAME, enterFrame);
clip.parent.removeChild(clip);
}
......@@ -217,7 +218,8 @@ package
clip.loadText.text = "Deleting existing slice";
op.reset(Geni.remove);
op.addField("credential", credential.base);
op.addField("hrn", "urn:publicid:IDN+" + AUTHORITY + "+slice+"+sliceName);
op.addField("hrn", "urn:publicid:IDN+" + Geni.defaultAuthority
+ "+slice+"+sliceName);
op.addField("type", "Slice");
op.call(completeSliceDelete, failure);
addSend();
......@@ -242,7 +244,8 @@ package
clip.loadText.text = "Creating new slice";
op.reset(Geni.register);
op.addField("credential", credential.base);
op.addField("hrn", "urn:publicid:IDN+" + AUTHORITY + "+slice+"+sliceName);
op.addField("hrn", "urn:publicid:IDN+" + Geni.defaultAuthority
+ "+slice+"+sliceName);
// op.addField("hrn", sliceName);
op.addField("type", "Slice");
// op.addField("userbindings", new Array(user.uuid));
......@@ -306,7 +309,5 @@ package
var credential : Credential;
static var userName : String = "duerig";
static var AUTHORITY : String = "emulab.net";
// static var AUTHORITY : String = "jonlab.geni.emulab.net";
}
}
......@@ -378,12 +378,12 @@ package
if (current.used)
{
str += "<interface virtual_id=\"" + current.virtualId + "\" ";
/*
if (current.name != null)
{
str += "component_id=\"" + current.name + "\" ";
}
*/
str += " />";
}
}
......
/* GENIPUBLIC-COPYRIGHT
* Copyright (c) 2008, 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
{
public class RequestListComponents extends Request
{
public function RequestListComponents(newView : ComponentView) : void
{
super("Clearinghouse");
view = newView;
}
override public function cleanup() : void
{
super.cleanup();
}
override public function start(credential : Credential) : Operation
{
opName = "Listing ComponentManagers";
var opType = Geni.listComponents;
op.reset(opType);
op.addField("credential", credential.slice);
op.setUrl(Geni.chUrl);
return op;
}
override public function complete(code : Number, response : Object,
credential : Credential) : Request
{
var result : Request = null;
if (code == 0)
{
var head : RequestResourceDiscovery = null;
for each (var input in response.value)
{
var current : ComponentManager
= new ComponentManager(input.urn, input.hrn, "REMOVEME",
input.url, null, 2);
view.addManager(current);
head = new RequestResourceDiscovery(current, head);
}
result = head;
}
else
{
Main.getConsole().appendText("ListComponents Failed\n");
}
return result;
}
private var view : ComponentView;
}
}
......@@ -16,10 +16,12 @@ package
{
public class RequestResourceDiscovery extends Request
{
public function RequestResourceDiscovery(newCm : ComponentManager) : void
public function RequestResourceDiscovery(newCm : ComponentManager,
newNext : Request) : void
{
super(newCm.getName());
cm = newCm;
next = newNext;
}
override public function cleanup() : void
......@@ -45,6 +47,7 @@ package
override public function complete(code : Number, response : Object,
credential : Credential) : Request
{
var result : Request = next;
if (code == 0)
{
cm.resourceSuccess(response.value);
......@@ -53,9 +56,10 @@ package
{
cm.resourceFailure();
}
return null;
return result;
}
private var cm : ComponentManager;
private var next : Request;
}
}
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