Commit 7352c47d authored by Jonathon Duerig's avatar Jonathon Duerig
Browse files

Miscellaneous fixes. Hacks for v2 APIs and Valas.

parent 84ab96e4
......@@ -285,6 +285,15 @@ package
var newInterface = new Interface("virt-"
+ String(interfaceNumber),
interName);
var interRole = inter.attribute("role");
if (interRole == "control")
{
newInterface.role = Interface.UNUSED_CONTROL;
}
else if (interRole == "experimental")
{
newInterface.role = Interface.UNUSED_EXPERIMENTAL;
}
com.interfaces.push(newInterface);
++interfaceNumber;
}
......@@ -333,6 +342,13 @@ package
var linkName : QName = new QName(rspec.namespace(), "link");
for each (var link in rspec.elements(linkName))
{
var bandwidthName : QName = new QName(rspec.namespace(),
"bandwidth");
var bandwidth : int = 100000;
for each (var current in link.elements(bandwidthName))
{
bandwidth = int(current.text());
}
var interElement : QName = new QName(rspec.namespace(),
"interface_ref");
if (version < 2)
......@@ -364,7 +380,15 @@ package
{
if (interName == nodeInter.name)
{
nodeInter.role = Interface.EXPERIMENTAL;
if (nodeInter.role == Interface.UNUSED_EXPERIMENTAL)
{
nodeInter.role = Interface.EXPERIMENTAL;
}
else if (nodeInter.role == Interface.UNUSED_CONTROL)
{
nodeInter.role = Interface.CONTROL;
}
nodeInter.bandwidth = bandwidth;
}
}
}
......
......@@ -21,6 +21,8 @@ package
private static var ses : String = "ses";
private static var ch : String = "ch";
private static var cmv2 : String = "cmv2";
public static var sesUrl : String = "https://myboss.emulab.geni.emulab.net/protogeni/xmlrpc/";
//"https://boss.emulab.net:443/protogeni/xmlrpc/";
......@@ -44,8 +46,10 @@ package
public static var sliverStatus : Array = new Array(cm, "SliverStatus");
public static var sliverTicket : Array = new Array(cm, "SliverTicket");
public static var discoverResourcesv2 : Array = new Array(cmv2, "DiscoverResources");
public static var map : Array = new Array(ses, "Map");
public static var listComponents : Array = new Array(ch, "ListComponents");
}
}
......@@ -21,7 +21,8 @@ package
virtualId = newVirtualId;
name = newName;
used = false;
role = CONTROL;
role = UNUSED;
bandwidth = 0;
}
public function clone() : Interface
......@@ -29,6 +30,7 @@ package
var result = new Interface(virtualId, name);
result.used = used;
result.role = role;
result.bandwidth = bandwidth;
return result;
}
......@@ -36,8 +38,12 @@ package
public var name : String;
public var used : Boolean;
public var role : int;
public var bandwidth : int;
public static var CONTROL = 0;
public static var EXPERIMENTAL = 1;
public static var UNUSED = 2;
public static var UNUSED_CONTROL = 3;
public static var UNUSED_EXPERIMENTAL = 4;
}
}
......@@ -30,7 +30,13 @@ package
override public function start(credential : Credential) : Operation
{
opName = "Discovering Resources";
op.reset(Geni.discoverResources);
var opType = Geni.discoverResources;
if (cm.getName() == "Wisconsin" || cm.getName() == "Kentucky"
|| cm.getName() == "CMU")
{
opType = Geni.discoverResourcesv2;
}
op.reset(opType);
op.addField("credential", credential.slice);
op.setUrl(cm.getUrl());
return op;
......
......@@ -72,12 +72,14 @@ package
".emulab.net",
"https://myboss.myelab.testbed.emulab.net:443/protogeni/xmlrpc",
updateList, 2),
new ComponentManager("28a10955-aa00-11dd-ad1f-001143e453fe",
"Emulab",
".emulab.net",
"https://boss.emulab.net:443/protogeni/xmlrpc",
// Doesn't work ??? "https://boss.emulab.net:443/dev/stoller/protogeni/xmlrpc",
updateList, 2),
/*
new ComponentManager("be300821-ecb7-11dd-a0f8-001143e43ff3",
"gtwelab",
......@@ -85,6 +87,11 @@ package
"https://myboss.emulab.geni.emulab.net:443/protogeni/xmlrpc",
updateList, 2),
*/
new ComponentManager("27cd73fb-b908-11de-837a-0002b33f8548",
"jonlab",
".emulab.net",
"https://myboss.jonlab.geni.emulab.net:443/protogeni/xmlrpc",
updateList, 2),
new ComponentManager("b83b47be-e7f0-11dd-848b-0013468d3dc8",
"Kentucky",
".uky.emulab.net",
......
......@@ -31,8 +31,8 @@ package
left.addLink(this);
right = newRight;
right.addLink(this);
leftInterface = "";
rightInterface = "";
leftInterface = null;
rightInterface = null;
tunnelIp = 0;
if (isTunnel())
{
......@@ -41,7 +41,9 @@ package
else
{
leftInterface = left.allocateInterface();
leftInterfaceName = interfaceToName(left, leftInterface);
rightInterface = right.allocateInterface();
rightInterfaceName = interfaceToName(right, rightInterface);
}
removeClick = newRemoveClick;
......@@ -68,6 +70,20 @@ package
right.removeLink(this);
}
public function interfaceToName(node : Node, iface : Interface) : String
{
var result = "";
if (node.getManager().getVersion() == 0)
{
result = iface.name;
}
else
{
result = iface.virtualId;
}
return result;
}
public function renumber(number : int) : void
{
removeClip.number = number;
......@@ -110,6 +126,10 @@ package
{
result.@virtual_id = "link" + String(number);
}
if (! isTunnel())
{
result.appendChild(getBandwidthXml());
}
if (version >= 3)
{
......@@ -137,8 +157,10 @@ package
}
}
result.appendChild(getInterfaceXml(left, leftInterface, 0, version));
result.appendChild(getInterfaceXml(right, rightInterface, 1, version));
result.appendChild(getInterfaceXml(left, leftInterfaceName, 0,
version));
result.appendChild(getInterfaceXml(right, rightInterfaceName, 1,
version));
}
return result;
}
......@@ -190,6 +212,13 @@ package
return result;
}
function getBandwidthXml() : XML
{
var bandwidth = Math.floor(Math.min(leftInterface.bandwidth,
rightInterface.bandwidth));
return XML("<bandwidth>" + bandwidth + "</bandwidth>");
}
function ipToString(ip : int) : String
{
var first : int = ((ip >> 8) & 0xff);
......@@ -225,9 +254,11 @@ package
var number : int;
var left : Node;
var leftInterface : String;
var leftInterface : Interface;
var leftInterfaceName : String;
var right : Node;
var rightInterface : String;
var rightInterface : Interface;
var rightInterfaceName : String;
var tunnelIp : int;
var canvas : Shape;
var removeClick : Function;
......
......@@ -177,7 +177,7 @@ package
if (code == 0)
{
user = response.value;
startSliceLookup();
startSliceDelete();
}
else
{
......@@ -217,8 +217,7 @@ package
clip.loadText.text = "Deleting existing slice";
op.reset(Geni.remove);
op.addField("credential", credential.base);
// op.addField("uuid", sliceId);
op.addField("hrn", "urn:publicid:IDN+emulab.net+slice+"+sliceName);
op.addField("hrn", "urn:publicid:IDN+" + AUTHORITY + "+slice+"+sliceName);
op.addField("type", "Slice");
op.call(completeSliceDelete, failure);
addSend();
......@@ -243,7 +242,7 @@ package
clip.loadText.text = "Creating new slice";
op.reset(Geni.register);
op.addField("credential", credential.base);
op.addField("hrn", "urn:publicid:IDN+emulab.net+slice+"+sliceName);
op.addField("hrn", "urn:publicid:IDN+" + AUTHORITY + "+slice+"+sliceName);
// op.addField("hrn", sliceName);
op.addField("type", "Slice");
// op.addField("userbindings", new Array(user.uuid));
......@@ -306,6 +305,8 @@ package
var user : Object;
var credential : Credential;
static var userName : String = "ricci";
static var userName : String = "duerig";
static var AUTHORITY : String = "emulab.net";
// static var AUTHORITY : String = "jonlab.geni.emulab.net";
}
}
......@@ -191,22 +191,15 @@ package
return name + manager.getHostName();
}
public function allocateInterface() : String
public function allocateInterface() : Interface
{
var result = null;
var result : Interface = null;
for each (var candidate in interfaces)
{
if (! candidate.used && candidate.role == Interface.EXPERIMENTAL)
{
candidate.used = true;
if (manager.getVersion() == 0)
{
result = candidate.name;
}
else
{
result = candidate.virtualId;
}
result = candidate;
break;
}
}
......@@ -216,17 +209,18 @@ package
null);
newInterface.used = true;
newInterface.role = Interface.EXPERIMENTAL;
newInterface.bandwidth = 100000;
interfaces.push(newInterface);
result = newInterface.virtualId;
result = newInterface;
}
return result;
}
public function freeInterface(interName : String) : void
public function freeInterface(iface : Interface) : void
{
for each (var candidate in interfaces)
{
if (interName == candidate.virtualId)
if (iface == candidate)
{
candidate.used = false;
break;
......@@ -338,6 +332,8 @@ package
{
str += "exclusive=\"1\"";
}
// str += "tarfiles=\"/tmp http://valas.gtnoise.net/files/mux-client.tar.gz\" ";
// str += "startup_command=\"/tmp/client.py\" ";
str += ">";
if (component.isBgpMux)
{
......@@ -422,7 +418,7 @@ package
}
for each (var inter in interfaces)
{
if (inter.used || inter.role == Interface.CONTROL)
if (inter.used || inter.role != Interface.EXPERIMENTAL)
{
result += "<font color=\"#770000\">";
}
......
......@@ -16,13 +16,10 @@ package
{
class RequestReleaseTicket extends Request
{
public function RequestReleaseTicket(newTicket : String,
newUrl : String,
newServer : String) : void
public function RequestReleaseTicket(newManager : ComponentManager) : void
{
super(newServer);
ticket = newTicket;
url = newUrl;
super(newManager.getName());
manager = newManager;
}
override public function cleanup() : void
......@@ -34,12 +31,22 @@ package
{
opName = "Release Ticket";
op.reset(Geni.releaseTicket);
op.addField("ticket", ticket);
op.setUrl(url);
op.addField("credential", credential.slice);
op.addField("ticket", manager.getTicket());
op.setUrl(manager.getUrl());
return op;
}
var ticket : String;
var url : String;
override public function complete(code : Number, response : Object,
credential : Credential) : Request
{
if (code == 0)
{
manager.setTicket(null);
}
return null;
}
var manager : ComponentManager;
}
}
......@@ -114,10 +114,7 @@ package
var result : Request = null;
if (manager.getTicket() != null)
{
result = new RequestReleaseTicket(manager.getTicket(),
manager.getUrl(),
manager.getName());
manager.setTicket(null);
result = new RequestReleaseTicket(manager);
}
return result;
}
......
......@@ -99,9 +99,7 @@ package
{
if (ticket != null && manager.getVersion() > 0)
{
result = new RequestReleaseTicket(ticket, manager.getUrl(),
manager.getName());
manager.setTicket(null);
result = new RequestReleaseTicket(manager);
}
if (beginTunnel)
{
......
Supports Markdown
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