Commit a3083d60 authored by Jonathon Duerig's avatar Jonathon Duerig

Flack 17.19 -- Various bugfixes. egre-tunnel support. New Flack unified loader

parent 383092cc
\z\work\flex\bin\mxmlc -load-config config-duerig.xml src\flack.mxml
This diff is collapsed.
/*
Eliminate any default margins/padding and set the height of the
html element and the body element to 100%, because Firefox, or any
Gecko based browser, interprets percentage as the percentage of the
height of its parent container, which has to be set explicitly.
Initially, don't display flashContent div so it won't show if
JavaScript disabled.
*/
html, body
{
height: 100%;
}
body
{
margin:0;
padding:0;
overflow:auto;
text-align:center;
background-color: #d2e1f0;
}
object:focus
{
outline:none;
}
#flashContent
{
display:none;
}
#socketPool
{
visibility:hidden;
}
This diff is collapsed.
This diff is collapsed.
......@@ -282,6 +282,11 @@
}
function logToConsole(message)
{
console.log('--- ' + message);
}
// setServerCert(tlsval);
// tlsval = "KEY";
// setClientKey(tlsval);
......@@ -302,7 +307,7 @@
flashvars.saurl = "https%3A%2F%2Fch.geni.net%3A8443%2F";
flashvars.saurn = "urn%3Apublicid%3AIDN%2Bgeni%3Agpo%3Aportal%2Bauthority%2Bsa";
flashvars.churl = "https%3A%2F%2Fch.geni.net%3A8443%2F";
flashvars.sliceurn = "urn%3Apublicid%3AIDN%2Bch.geni.net%3Apgeni-testing%2Bslice%2Bjon-test";
flashvars.sliceurn = "urn%3Apublicid%3AIDN%2Bch.geni.net%3Apgeni-testing%2Bslice%2Bimage-test";
var params = {};
params.quality = "high";
params.bgcolor = "#d2e1f0";
......@@ -892,7 +897,6 @@ IwePprDrd6V9CigMKsrniEghHjtblA70pTRj75CO5TUIPNpsL3d8+juPPNou+wwX
DU13v1h/AbAioWbTOCd8fRPq3vKiKLNUWtTrENl1cfxLYy6H6s7ETlQwXxcoEEDz
SBkIDe0qTE3zSWjZm1zfOEkCWzrbQFhkSrryQpa7MkrPxi1Q
-----END CERTIFICATE-----
----
-----BEGIN CERTIFICATE-----
MIIESzCCAzOgAwIBAgIJAPzyDLVtbM9vMA0GCSqGSIb3DQEBBQUAMIG7MQswCQYD
VQQGEwItLTESMBAGA1UECAwJU29tZVN0YXRlMREwDwYDVQQHDAhTb21lQ2l0eTEZ
......
var isPortal = false;
var basePath = '';
(function () {
var importList = [
'forge/debug.js',
'forge/util.js',
'forge/log.js',
'forge/socket.js',
'forge/md5.js',
'forge/sha1.js',
'forge/hmac.js',
'forge/aes.js',
'forge/asn1.js',
'forge/jsbn.js',
'forge/prng.js',
'forge/random.js',
'forge/oids.js',
'forge/rsa.js',
'forge/pki.js',
'forge/tls.js',
'forge/tlssocket.js',
'forge/http.js',
'main.js'
];
var sourceOptionList = ['local', 'devel', 'stable', 'none'];
var sourceOptions = {
'local': 'http://localhost:8080/',
'devel': 'https://www.emulab.net/protogeni/flack-devel/',
'stable': 'https://www.emulab.net/protogeni/flack-stable/',
'none': ''
};
function getQueryParams(qs) {
qs = qs.split('+').join(' ');
var params = {};
var re = /[?&]?([^=]+)=([^&]*)/g;
var tokens = re.exec(qs);
while (tokens) {
params[decodeURIComponent(tokens[1])]
= decodeURIComponent(tokens[2]);
tokens = re.exec(qs);
}
return params;
}
var params = getQueryParams(window.location.search);
if (params['portal'] && params['portal'] === '1')
{
isPortal = true;
}
var sourceName = params['source'];
var basePath = sourceOptions['stable'];
if (sourceOptionList.indexOf(sourceName) !== -1)
{
basePath = sourceOptions[sourceName];
}
var body = document.getElementsByTagName('body')[0];
var i = 0;
for (i = 0; i < importList.length; i += 1)
{
var script = document.createElement('script');
script.src = basePath + importList[i];
script.type = 'application/javascript';
script.async = false;
script.defer = false;
body.appendChild(script);
}
}());
(function ()
{
// For version detection, set to min. required Flash Player version, or 0 (or 0.0.0), for no version detection.
var swfVersionStr = "11.1.0";
// To use express install, set to playerProductInstall.swf, otherwise the empty string.
var xiSwfUrlStr = "playerProductInstall.swf";
var flashvars = {};
if (isPortal)
{
flashvars.skipstartup = '1';
flashvars.bundlepreset = '1';
flashvars.keycertpreset = '1';
flashvars.loadallmanagerswithoutasking = '1';
flashvars.saurl = encodeURIComponent(document.getElementById('sa-url-parameter').innerText);
flashvars.saurn = encodeURIComponent(document.getElementById('sa-urn-parameter').innerText);
flashvars.churl = encodeURIComponent(document.getElementById('ch-url-parameter').innerText);
flashvars.sliceurn = encodeURIComponent(document.getElementById('slice-urn-parameter').innerText);
}
var params = {};
params.quality = "high";
params.bgcolor = "#d2e1f0";
params.allowscriptaccess = "always";
params.allowfullscreen = "true";
params.fullScreenOnSelection = "true";
var attributes = {};
attributes.id = "flack";
attributes.name = "flack";
attributes.align = "middle";
swfobject.embedSWF(
basePath + "flack.swf", "flashContent",
"100%", "100%",
swfVersionStr, xiSwfUrlStr,
flashvars, params, attributes);
// JavaScript enabled so display the flashContent div in case it is not replaced with a swf object.
swfobject.createCSS("#flashContent", "display:block;text-align:left;");
swfobject.embedSWF(
basePath + 'forge/SocketPool.swf', 'socketPool',
'0', '0',
'9.0.0', false,
{}, {allowscriptaccess: 'always'}, {});
swfobject.createCSS("#socketPool", "visibility:visible;");
}());
// CA certificate for test server
var serverCerts = [];
var clientCerts = [];
var clientKey = '';
var flash_id = "";
function getSWF()
{
if (navigator.appName.indexOf("Microsoft") != -1)
{
return window[flash_id];
}
else
{
return document[flash_id];
}
}
var sp;
function init(new_flash_id)
{
try
{
if (isPortal)
{
setServerCert(document.getElementById('server-cert-parameter').innerHTML);
setClientKey(document.getElementById('client-key-parameter').innerHTML);
setClientCert(document.getElementById('client-cert-parameter').innerHTML);
}
flash_id = new_flash_id;
sp = forge.net.createSocketPool({
flashId: 'socketPool',
policyPort: 843,
msie: false
});
}
catch(ex)
{
console.log('ERROR init:');
console.dir(ex);
}
}
// local aliases
var tls = window.forge.tls;
var http = window.forge.http;
var util = window.forge.util;
var clients = new Object();
function make_request(instance, host, path, sendData)
{
try
{
var newClient = client_init(host);
if (clients[instance] == null)
{
clients[instance] = newClient;
client_send(newClient, path, sendData, instance);
}
}
catch(ex)
{
console.log('ERROR make_request:');
console.dir(ex);
}
}
function cancel_request(instance)
{
try
{
var client = clients[instance];
if (client != null)
{
client_cleanup(client);
delete client[instance];
}
}
catch(ex)
{
console.log('ERROR cancel_request:');
console.dir(ex);
}
return false;
}
function setServerCert(newCert)
{
try
{
serverCerts = [];
var list = newCert.split("-----END CERTIFICATE-----");
for (var i = 0; i < list.length - 1; ++i)
{
serverCerts.push(list[i] + "-----END CERTIFICATE-----\n");
}
}
catch(ex)
{
console.log('ERROR setServerCert:');
console.dir(ex);
}
}
function addServerCert(newCert)
{
try
{
var list = newCert.split("-----END CERTIFICATE-----");
for (var i = 0; i < list.length - 1; ++i)
{
serverCerts.push(list[i] + "-----END CERTIFICATE-----\n");
}
}
catch(ex)
{
console.log('ERROR addServerCert:');
console.dir(ex);
}
}
function setClientCert(newCert)
{
try
{
clientCerts = [];
if (typeof(newCert) === "string")
{
var list = newCert.split("-----END CERTIFICATE-----");
for (var i = 0; i < list.length - 1; ++i)
{
clientCerts.push(list[i] + "-----END CERTIFICATE-----\n");
}
}
else
{
clientCerts = newCert;
}
}
catch (ex)
{
console.log('ERROR setting client cert:');
console.dir(ex);
}
}
function setClientKey(newKey)
{
try
{
clientKey = newKey;
}
catch(ex)
{
console.log('ERROR setting client key:');
console.dir(ex);
}
}
function client_init(host)
{
var result = null;
try
{
var arg = {
url: host,
socketPool: sp,
connections: 1,
// optional cipher suites in order of preference
caCerts : serverCerts,
cipherSuites: [
tls.CipherSuites.TLS_RSA_WITH_AES_128_CBC_SHA,
tls.CipherSuites.TLS_RSA_WITH_AES_256_CBC_SHA],
verify: function(c, verified, depth, certs)
{
/*
forge.log.debug('forge.tests.tls',
'TLS certificate ' + depth + ' subject: ' + certs[depth].subject.getField('CN').value + " issuer: " + certs[depth].issuer.getField('CN').value, verified);
// Note: change to always true to test verifying without cert
//return verified;
// FIXME: temporarily accept any cert to allow hitting any bpe
if(verified !== true)
{
forge.log.warning('forge.tests.tls',
'Certificate NOT verified. Ignored for test.');
}
return true;
*/
return verified;
},
primeTlsSockets: false
};
if (clientCerts.length > 0)
{
arg.getCertificate = function(c, request) { return clientCerts; };
arg.getPrivateKey = function(c, cert) { return clientKey; };
}
result = http.createClient(arg);
}
catch(ex)
{
console.log('ERROR: client_init');
console.dir(ex);
}
return result;
}
function client_cleanup(client)
{
client.destroy();
}
function client_send(client, path, data, instance)
{
var requestArg = {
path: path,
method: 'GET'
};
if (data != "")
{
requestArg.method = 'POST';
requestArg.headers = [{'Content-Type': 'text/xml'}];
requestArg.body = data;
}
var request = http.createRequest(requestArg);
client.send({
request: request,
connected: function(e)
{
// forge.log.debug('forge.tests.tls', 'connected', e);
},
headerReady: function(e)
{
// forge.log.debug('forge.tests.tls', 'header ready', e);
},
bodyReady: function(e)
{
// forge.log.debug('forge.tests.tls', 'body ready called', e);
var response = e.response.body;
e.socket.close();
getSWF().flash_onbody(instance, response);
},
error: function(e)
{
var response = e.type + ": " + e.message;
if (e.cause != null)
{
// response += ": " + String(e.cause);
}
e.socket.close();
getSWF().flash_onerror(instance, response);
}
});
return false;
}
......@@ -100,7 +100,7 @@ package com.flack.geni
{
var sliceCollection:SliceCollection = new SliceCollection();
sliceCollection.add(GeniMain.useSlice);
SharedMain.tasker.add(new GetSlicesTaskGroup(sliceCollection));
SharedMain.tasker.add(new GetSlicesTaskGroup(sliceCollection, GeniMain.loadAllManagersWithoutAsking));
var sliceArea:SliceArea = new SliceArea();
FlexGlobals.topLevelApplication.viewContent(sliceArea);
sliceArea.slice = GeniMain.useSlice;
......
......@@ -358,7 +358,7 @@ IN THE WORK.
{
if(workingSliceTasks.getOfClass(DescribeSlicesTaskGroup).length == 0 || Sliver.isAllocated(_slice.AllocationState))
{
dashboardViewstack.selectedChild = sliceView;
// dashboardViewstack.selectedChild = sliceView;
validateNow();
}
}
......
......@@ -148,10 +148,8 @@ IN THE WORK.
var supportedTypes:SupportedLinkTypeCollection = link.interfaceRefs.Interfaces.Managers.CommonLinkTypes;
for each(var supportedType:SupportedLinkType in supportedTypes.collection)
{
if(supportedType.name.length == 0)
supportedType.name = "Stitched (Unspecified)";
types.addItem(supportedType);
if(supportedType.name == link.type.name || (supportedType.name == "Stitched (Unspecified)" && link.type.name.length == 0))
types.addItem(supportedType);
if(supportedType.name == link.type.name)
typeList.selectedIndex = types.length-1;
}
if(supportedTypes.getByName(link.type.name) == null)
......
......@@ -65,6 +65,7 @@ IN THE WORK.
import com.flack.geni.resources.sites.managers.SupportedSliverTypeCollection;
import com.flack.geni.resources.virt.ExecuteService;
import com.flack.geni.resources.virt.InstallService;
import com.flack.geni.resources.virt.LoginService;
import com.flack.geni.resources.virt.Sliver;
import com.flack.geni.resources.virt.VirtualInterface;
import com.flack.geni.resources.virt.VirtualInterfaceCollection;
......@@ -74,12 +75,14 @@ IN THE WORK.
import com.flack.geni.resources.virt.VirtualNodeCollection;
import com.flack.geni.tasks.groups.ListImagesTaskGroup;
import com.flack.geni.tasks.xmlrpc.protogeni.cm.CreateImageCmTask;
import com.flack.geni.tasks.xmlrpc.am.CreateImageTask;
import com.flack.shared.FlackEvent;
import com.flack.shared.SharedMain;
import com.flack.shared.display.areas.DocumentArea;
import com.flack.shared.display.components.DataButton;
import com.flack.shared.display.windows.TextInputWindow;
import com.flack.shared.resources.sites.FlackManager;
import com.flack.shared.resources.sites.ApiDetails;
import com.flack.shared.utils.ColorUtil;
import com.flack.shared.utils.ImageUtil;
import com.flack.shared.utils.NetUtil;
......@@ -206,13 +209,14 @@ IN THE WORK.
statusImage.visible = false;
}
}
if(node.services.loginServices != null && node.services.loginServices.length > 0)
var defaultLogin : LoginService = node.services.getDefaultLogin();
if(defaultLogin != null)
{
loginGroup.visible = true;
usernameText.text = node.services.loginServices[0].username;
hostnameText.text = node.services.loginServices[0].FullHostname;
visitButton.toolTip = "Click to launch http://" + node.services.loginServices[0].hostname;
sshButton.toolTip = "Click to launch ssh://" + node.services.loginServices[0].FullLogin;
usernameText.text = defaultLogin.username;
hostnameText.text = defaultLogin.FullHostname;
visitButton.toolTip = "Click to launch http://" + defaultLogin.hostname;
sshButton.toolTip = "Click to launch ssh://" + defaultLogin.FullLogin;
}
managerList.selectedItem = node.manager;
......@@ -339,8 +343,11 @@ IN THE WORK.
public function openSsh():void
{
if(node.services.loginServices.length > 0)
NetUtil.openWebsite("ssh://" + node.services.loginServices[0].FullLogin);
var defaultLogin : LoginService = node.services.getDefaultLogin();
if(defaultLogin != null)
{
NetUtil.openWebsite("ssh://" + defaultLogin.FullLogin);
}
}
public function viewManifest():void
......@@ -836,9 +843,18 @@ IN THE WORK.
public function userChoseImageName(newName:String):void
{
var createImageTask:CreateImageCmTask = new CreateImageCmTask(node, newName, diskImageGlobalCheckbox.selected);
createImageTask.forceRunNow = true;
SharedMain.tasker.add(createImageTask);
if (node.manager.api.type == ApiDetails.API_GENIAM)
{
var amTask:CreateImageTask = new CreateImageTask(node, newName, diskImageGlobalCheckbox.selected);
amTask.forceRunNow = true;
SharedMain.tasker.add(amTask);
}
else if (node.manager.api.type == ApiDetails.API_PROTOGENI)
{
var cmTask:CreateImageCmTask = new CreateImageCmTask(node, newName, diskImageGlobalCheckbox.selected);
cmTask.forceRunNow = true;
SharedMain.tasker.add(cmTask);
}
}
protected function diskImageText_changeHandler(event:Event):void
......
......@@ -42,6 +42,7 @@ IN THE WORK.
<![CDATA[
import com.flack.geni.display.DisplayUtil;
import com.flack.geni.plugins.emulab.RawPcSliverType;
import com.flack.geni.plugins.emulab.EmulabXenSliverType;
import com.flack.geni.resources.SliverTypes;
import com.flack.geni.resources.sites.GeniManager;
import com.flack.geni.resources.sites.managers.SupportedSliverType;
......@@ -110,12 +111,30 @@ IN THE WORK.
);
if(managerTypes.Shared.length > 0)
{
var sharedTypes : SupportedSliverTypeCollection = managerTypes.Shared;
var defaultType : SupportedSliverType = null;
if (defaultType == null)
{
defaultType = sharedTypes.getByName('emulab-openvz');
}
if (defaultType == null)
{
defaultType = sharedTypes.getByName('emulab-xen');
}
if (defaultType == null)
{
defaultType = sharedTypes.getByName('XOSmall');
}
if (defaultType == null)
{
defaultType = sharedTypes.collection[0];
}
var sharedVm:VirtualNode = new VirtualNode(
null,
manager,
"VM",
false,
managerTypes.Shared.collection[0].type.name
defaultType.type.name
);
managerTypes.remove(managerTypes.getByName(sharedVm.sliverType.name));
addVmSharedButton.setStyle("chromeColor", ColorUtil.colorsDark[manager.colorIdx]);
......
......@@ -36,8 +36,8 @@ IN THE WORK.
xmlns:mx="library://ns.adobe.com/flex/mx"
xmlns:components="com.flack.shared.display.components.*"
skinClass="com.flack.shared.display.skins.TitleWindowSkinNoCloseButton"
width="440"
height="300"
width="540"
height="400"
title="List resources from..."
initialize="init()"
defaultButton="{okButton}" xmlns:windows="com.flack.shared.display.windows.*">
......
......@@ -38,7 +38,7 @@ package com.flack.geni.resources.sites.clearinghouses
*/
public class ProtogeniClearinghouse extends IdentifiableObject
{
public var url:String = "https://www.emulab.net:12369/protogeni/xmlrpc/";
public var url:String = "https://www.emulab.net:12369/protogeni/xmlrpc/ch";
public function ProtogeniClearinghouse()
{
......
/*
* Copyright (c) 2008-2013 University of Utah and the Flux Group.
*
*
* {{{GENIPUBLIC-LICENSE
*
*
* GENI Public License
*
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and/or hardware specification (the "Work") to
* deal in the Work without restriction, including without limitation the
* rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Work, and to permit persons to whom the Work
* is furnished to do so, subject to the following conditions:
*
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Work.
*
*
* THE WORK IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
......@@ -23,69 +23,70 @@
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE WORK OR THE USE OR OTHER DEALINGS
* IN THE WORK.
*
*
* }}}
*/
package com.flack.geni.resources.sites.managers
{
import com.flack.geni.resources.virt.LinkType;
import com.flack.geni.resources.virt.LinkType;
public class SupportedLinkType
{
public var name:String;
public var maxConnections:Number = Number.POSITIVE_INFINITY;
public var supportsManyManagers:Boolean = false;
public var requiresIpAddresses:Boolean = false;
public var supportsSameManager:Boolean = true;
public var defaultCapacity:Number = NaN;
public var level:int = int.MAX_VALUE;
public function SupportedLinkType(newName:String)
{
name = newName;
switch(name)
{
case LinkType.VLAN:
maxConnections = 2;
supportsManyManagers = true;
defaultCapacity = 500;
level = 1500;
break;
case LinkType.ION:
case LinkType.GPENI:
maxConnections = 2;
supportsManyManagers = true;