SSH commands dialog
diff --git a/planetstack/core/xoslib/dashboards/xosTenant.html b/planetstack/core/xoslib/dashboards/xosTenant.html
index 6735da3..141e3ee 100644
--- a/planetstack/core/xoslib/dashboards/xosTenant.html
+++ b/planetstack/core/xoslib/dashboards/xosTenant.html
@@ -22,6 +22,7 @@
     <button class="btn btn-high btn-tenant-create">Create New Slice</button>
     <button class="btn btn-high btn-tenant-delete">Delete Slice</button>
     <button class="btn btn-high btn-tenant-add-user">Edit Users</button>
+    <button class="btn btn-high btn-tenant-download-ssh">SSH Commands</button>
     <button class="btn btn-high btn-tenant-save">Save</button>
   </div>
 </script>
@@ -63,6 +64,10 @@
 <div id="tenant-edit-users-dialog" title="Edit Users">

 <div id="tenant-edit-users-interior"></div>

 </div>

+

+<div id="tenant-ssh-commands-dialog" title="SSH Commands">

+<div id="tenant-ssh-commands-interior"></div>

+</div>

 
 <div id="xos-error-dialog" title="Error Message">
 </div>

diff --git a/planetstack/core/xoslib/objects/sliceplus.py b/planetstack/core/xoslib/objects/sliceplus.py
index 7e9836c..9187bff 100644
--- a/planetstack/core/xoslib/objects/sliceplus.py
+++ b/planetstack/core/xoslib/objects/sliceplus.py
@@ -19,6 +19,7 @@
             used_sites = {}
             used_deployments = {}
             sliverCount = 0
+            sshCommands = []
             for sliver in self.slivers.all():
                 site = sliver.node.site_deployment.site
                 deployment = sliver.node.site_deployment.deployment
@@ -26,6 +27,10 @@
                 used_deployments[deployment.name] = used_deployments.get(deployment.name, 0) + 1
                 sliverCount = sliverCount + 1
 
+                if (sliver.instance_id and sliver.instance_name):
+                    sshCommand = 'ssh -o "ProxyCommand ssh -q %s@%s" ubuntu@%s' % (sliver.instance_id, sliver.node.name, sliver.instance_name)
+                    sshCommands.append(sshCommand);
+
             users = {}
             for priv in SlicePrivilege.objects.filter(slice=self):
                 if not (priv.user.id in users.keys()):
@@ -37,7 +42,8 @@
                     "sliverCount": sliverCount,
                     "siteCount": len(used_sites.keys()),
                     "users": users,
-                    "roles": []}
+                    "roles": [],
+                    "sshCommands": sshCommands}
 
         if user:
             auser = self._sliceInfo["users"].get(user.id, None)
diff --git a/planetstack/core/xoslib/static/js/xosTenant.js b/planetstack/core/xoslib/static/js/xosTenant.js
index 286537d..07762ed 100644
--- a/planetstack/core/xoslib/static/js/xosTenant.js
+++ b/planetstack/core/xoslib/static/js/xosTenant.js
@@ -72,6 +72,7 @@
                      "click button.btn-tenant-delete": "deleteClicked",
                      "click button.btn-tenant-add-user": "addUserClicked",
                      "click button.btn-tenant-save": "saveClicked",
+                     "click button.btn-tenant-download-ssh": "downloadClicked",
                      },
 
             createClicked: function(e) {
@@ -86,6 +87,10 @@
                      XOSTenantApp.editUsers(this.options.linkedView.model);
                      },
 
+            downloadClicked: function(e) {
+                     XOSTenantApp.downloadSSH(this.options.linkedView.model);
+                     },
+
             saveClicked: function(e) {
                      model = this.options.linkedView.model;
                      model.tenantSiteCollection.putToSlice(model);
@@ -113,6 +118,7 @@
     tenantButtons: "#tenantButtons",
     tenantAddSliceInterior: "#tenant-addslice-interior",
     tenantEditUsersInterior: "#tenant-edit-users-interior",
+    tenantSSHCommandsInterior: "#tenant-ssh-commands-interior",
 });
 
 XOSTenantApp.setDirty = function(dirty) {
@@ -269,6 +275,51 @@
     $("#tenant-edit-users-dialog").dialog("open");

 };

 

+XOSTenantApp.downloadSSHOld = function(model) {

+    sshCommands = "";

+    for (index in model.attributes.sliceInfo.sshCommands) {

+         sshCommand = model.attributes.sliceInfo.sshCommands[index];

+         sshCommands = sshCommands + sshCommand + "\n";

+    }

+

+    if (sshCommands.length == 0) {

+         alert("this slice has no instantiated slivers yet");

+         return;

+    }

+

+    var myWindow = window.open("", "ssh_command_list",""); // "width=640, height=480");

+    myWindow.document.write("<html><head><title>SSH Commands</title></head><body><pre>" + sshCommands + "</pre></body></html>");

+    myWindow.document.close();

+};

+

+XOSTenantApp.downloadSSH = function(model) {

+    sshCommands = "";

+    for (index in model.attributes.sliceInfo.sshCommands) {

+         sshCommand = model.attributes.sliceInfo.sshCommands[index];

+         sshCommands = sshCommands + sshCommand + "\n";

+    }

+

+    if (sshCommands.length == 0) {

+         alert("this slice has no instantiated slivers yet");

+         return;

+    }

+

+    var htmlView = new HTMLView({html: "<pre>" + sshCommands + "</pre>"});

+    XOSTenantApp.tenantSSHCommandsInterior.show(htmlView);

+

+    $("#tenant-ssh-commands-dialog").dialog({

+       autoOpen: false,
+       modal: true,
+       width: 640,
+       buttons : {
+            "Ok" : function() {
+              $(this).dialog("close");
+            },
+          }
+        });
+    $("#tenant-ssh-commands-dialog").dialog("open");

+};

+

 XOSTenantApp.deleteSlice = function(model) {

     var app=this;

     app.deleteDialog(model, function() { console.log("afterDelete"); app.viewSlice(undefined); });