Merge branch 'onelab' of ssh://git.onelab.eu/git/myslice into onelab
authorCiro Scognamiglio <ciro.scognamiglio@cslash.net>
Wed, 17 Dec 2014 16:21:33 +0000 (17:21 +0100)
committerCiro Scognamiglio <ciro.scognamiglio@cslash.net>
Wed, 17 Dec 2014 16:21:33 +0000 (17:21 +0100)
18 files changed:
README
manifoldapi/static/js/manifold.js
myslice/settings.py
myslice/urls.py
plugins/querytable/static/js/querytable.js
portal/sliceresourceview.py
portal/static/img/fed4fire_favicon.ico [new file with mode: 0644]
portal/static/img/myslice_favicon.ico [new file with mode: 0644]
portal/static/img/onelab_favicon.ico [new file with mode: 0644]
portal/templates/base.html
portal/templates/fed4fire/fed4fire_home-view.html
portal/templates/fed4fire/fed4fire_slice-tab-experiment.html [new file with mode: 0644]
portal/templates/onelab/onelab_base.html [deleted file]
portal/templates/onelab/onelab_slice-view.html
portal/templates/onelab/onelab_widget-slice-sections.html
portal/templates/slice-tab-experiment.html
rest/monitor.py
rest/sfa_api.py

diff --git a/README b/README
index b1f201d..3530ed2 100644 (file)
--- a/README
+++ b/README
@@ -1,6 +1,6 @@
 This file documents the contents of this module
 change
-Last update 4 sept. 2013
+Last update 4 DEC. 2014
 
 See the devel/ subdir for more devel-oriented doc.
 
index ca111de..b25647b 100644 (file)
@@ -243,6 +243,7 @@ function QueryStore() {
         // XXX query.change_action() should become deprecated
         update_query = query.clone();
         update_query.action = 'update';
+        update_query.fields = [];
         update_query.analyzed_query.action = 'update';
         update_query.params = {};
         update_query_ext = new QueryExt(update_query);
@@ -1091,7 +1092,11 @@ var manifold = {
             // Has it a domain query, and has it completed ?
             $.each(records, function(i, record) {
                 var key = manifold.metadata.get_key(query.object);
-                var record_key = manifold.record_get_value(record, key);
+                if ( typeof record === "string" ){
+                    var record_key = record;
+                }else{
+                    var record_key = manifold.record_get_value(record, key);
+                }
                 manifold.query_store.set_record_state(query.query_uuid, record_key, STATE_SET, STATE_SET_IN);
             });
 
@@ -1363,8 +1368,9 @@ case TYPE_LIST_OF_VALUES:
                 case TYPE_LIST_OF_VALUES: // XXX Until fixed
                 case TYPE_LIST_OF_RECORDS:
                     var key, new_state, cur_query_uuid;
-
-                    cur_query_uuid = query.analyzed_query.subqueries[field].query_uuid;
+                    if($.inArray(field,Object.keys(query.analyzed_query.subqueries)) > -1){
+                        cur_query_uuid = query.analyzed_query.subqueries[field].query_uuid;
+                    }
 
                     // example: slice.resource
                     //  - update_query_orig.params.resource = resources in slice before update
@@ -1449,6 +1455,8 @@ case TYPE_LIST_OF_VALUES:
         var query_ext = manifold.query_store.find_query_ext(query.query_uuid);
         query_ext.query_state = QUERY_STATE_DONE;
 
+        var tmp_query = manifold.query_store.find_analyzed_query(query.query_uuid);
+        manifold.publish_result_rec(tmp_query, records);
 
         // Send DONE message to plugins
         query.iter_subqueries(function(sq, data, parent_query) {
@@ -1884,6 +1892,7 @@ case TYPE_LIST_OF_VALUES:
                 break;
 
             case RUN_UPDATE:
+                query_ext.main_query_ext.update_query_ext.query.fields = [];
                 manifold.run_query(query_ext.main_query_ext.update_query_ext.query);
                 break;
 
index fe71e10..bd1474b 100644 (file)
@@ -2,6 +2,9 @@
 
 import os.path
 
+import djcelery
+djcelery.setup_loader()
+
 ### detect if we're in a build environment
 try:
     import manifold
@@ -233,6 +236,9 @@ INSTALLED_APPS = [
     'south', 
     # Uncomment the next line to enable the admin:
      'django.contrib.admin',
+       # FORGE Plugin app
+       'djcelery',
+       'forge',
     # Uncomment the next line to enable admin documentation:
     # 'django.contrib.admindocs',
     'portal',
@@ -242,6 +248,8 @@ INSTALLED_APPS = [
 # this app won't load in a build environment
 if not building: INSTALLED_APPS.append ('rest')
 
+BROKER_URL = "amqp://myslice:myslice@localhost:5672/myslice"
+
 for aux in auxiliaries:
     if os.path.isdir(os.path.join(ROOT,aux)): 
         print "Using devel auxiliary",aux
index af9a800..5f4c7d4 100644 (file)
@@ -44,6 +44,8 @@ import portal.slicetabmeasurements
 import portal.managementtababout
 import portal.managementtabrequests
 
+import forge.views
+
 #### high level choices
 # main entry point (set to the / URL)
 # beware that if this view is broken you end up in an endless cycle...
@@ -107,6 +109,7 @@ urls = [
     (r'^testbeds/(?P<slicename>[^/]+)/?$', portal.slicetabtestbeds.SliceTabTestbeds.as_view()),
     (r'^measurements/(?P<slicename>[^/]+)/?$', portal.slicetabmeasurements.SliceTabMeasurements.as_view()),
     (r'^experiment/(?P<slicename>[^/]+)/?$', portal.slicetabexperiment.ExperimentView.as_view()),
+    (r'^studentslabs/(?P<slicename>[^/]+)/?$', forge.views.CreateCourseViev.as_view()),
     
     url(r'^about/?$', AboutView.as_view(), name='about'),
     
index 3c1aab2..8d931d5 100644 (file)
@@ -158,8 +158,13 @@ QUERYTABLE_BGCOLOR_REMOVED = 2;
             });
 
             /* Processing hidden_columns */
+            arr = [];
+            arr = $.map(Object.keys(QUERYTABLE_MAP), function(x, i) { return QUERYTABLE_MAP[x]; });
             $.each(this.options.hidden_columns, function(i, field) {
-                self.hide_column(field);
+                is_inarray = $.inArray(field,arr);
+                if(is_inarray==-1){
+                    self.hide_column(field);
+                }
             });
             $(".dataTables_filter").append("<div style='display:inline-block;height:27px;width:27px;padding-left:6px;padding-top:4px;'><span class='glyphicon glyphicon-search'></span></div>");
             $(".dataTables_filter input").css("width","100%");
@@ -182,7 +187,6 @@ QUERYTABLE_BGCOLOR_REMOVED = 2;
                 };
                 
                 
-                console.log(network_hrn);
                 //Greece: 37.6687092,22.2282404
                 if (network_hrn == 'omf.nitos') {
                     var logo = 'nitos';
index 75ede2a..85bd368 100644 (file)
@@ -59,41 +59,54 @@ class SliceResourceView (LoginRequiredView, ThemeView):
         user_md = metadata.details_by_object('user')
         user_fields = ['user_hrn'] # [column['name'] for column in user_md['column']]
 
+        query_resource_all = Query.get('resource').select(resource_fields)
+        page.enqueue_query(query_resource_all)
+
+        # leases query
+        #lease_md = metadata.details_by_object('lease')
+        #lease_fields = [column['name'] for column in lease_md['column']]
+
+        #query_lease_all = Query.get('lease').select(lease_fields)
+        #page.enqueue_query(query_lease_all)
+
+        slice_md = metadata.details_by_object('slice')
+        slice_fields = [column['name'] for column in slice_md['column']]
+        print "SLICE RES VIEW fields = %s" % slice_fields
         # TODO The query to run is embedded in the URL
         # Example: select slice_hrn, resource.urn, lease.resource, lease.start_time, lease.end_time from slice where slice_hrn == "ple.upmc.myslicedemo"
         main_query = Query.get('slice').filter_by('slice_hrn', '=', slicename)
-        main_query.select(
-                # SLICE
-                'slice_hrn',
-                # - The record key is needed otherwise the storage of records
-                #   bugs !
-                'slice_urn',
-                # RESOURCES
-                'resource',
-                'lease',
-                'resource.urn',
-                'resource.hostname', 'resource.type',
-                # - The facility_name and testbed_name are required for the
-                #   testbeds plugin to properly work.
-                'resource.facility_name', 
-                'resource.testbed_name',
-                # LEASES
-                'lease.resource',
-                'lease.start_time',
-                'lease.end_time',
-                # - The lease_id is important for NITOS identify already existing
-                #   leases
-                'lease.lease_id', 
-
-                # FLOWSPACE
-                #'flowspace',               
-                # VMS
-                #'vms',
-
-
-                #'user.user_hrn',
-                #'application.measurement_point.counter'
-        )
+        main_query.select(slice_fields)
+        #        # SLICE
+        #        'slice_hrn',
+        #        # - The record key is needed otherwise the storage of records
+        #        #   bugs !
+        #        'slice_urn',
+        #        # RESOURCES
+        #        'resource',
+        #        'lease',
+        #        'resource.urn',
+        #        'resource.hostname', 'resource.type',
+        #        # - The facility_name and testbed_name are required for the
+        #        #   testbeds plugin to properly work.
+        #        'resource.facility_name',
+        #        'resource.testbed_name',
+        #        # LEASES
+        #        'lease.resource',
+        #        'lease.start_time',
+        #        'lease.end_time',
+        #        # - The lease_id is important for NITOS identify already existing
+        #        #   leases
+        #        'lease.lease_id',
+
+        #        # FLOWSPACE
+        #        #'flowspace',
+        #        # VMS
+        #        #'vms',
+
+
+        #        #'user.user_hrn',
+        #        #'application.measurement_point.counter'
+        #)
         # for internal use in the querytable plugin;
         # needs to be a unique column present for each returned record
         main_query_init_key = 'urn'
@@ -104,16 +117,6 @@ class SliceResourceView (LoginRequiredView, ThemeView):
         #sq_flowspace   = aq.subquery('flowspace')
         #sq_vms         = aq.subquery('vms')
 
-        query_resource_all = Query.get('resource').select(resource_fields)
-        page.enqueue_query(query_resource_all)
-
-        # leases query
-        #lease_md = metadata.details_by_object('lease')
-        #lease_fields = [column['name'] for column in lease_md['column']]
-
-        #query_lease_all = Query.get('lease').select(lease_fields)
-        #page.enqueue_query(query_lease_all)
-
         # --------------------------------------------------------------------------
         # ALL RESOURCES LIST
         # resources as a list using datatable plugin
diff --git a/portal/static/img/fed4fire_favicon.ico b/portal/static/img/fed4fire_favicon.ico
new file mode 100644 (file)
index 0000000..c2d91a0
Binary files /dev/null and b/portal/static/img/fed4fire_favicon.ico differ
diff --git a/portal/static/img/myslice_favicon.ico b/portal/static/img/myslice_favicon.ico
new file mode 100644 (file)
index 0000000..08b8cd4
Binary files /dev/null and b/portal/static/img/myslice_favicon.ico differ
diff --git a/portal/static/img/onelab_favicon.ico b/portal/static/img/onelab_favicon.ico
new file mode 100644 (file)
index 0000000..a2754aa
Binary files /dev/null and b/portal/static/img/onelab_favicon.ico differ
index df8fd9c..9bc52dd 100644 (file)
@@ -74,22 +74,17 @@ $(document).ready(function() {
         Launch queries to get the resources and leases in Manifold Cache
     */
         
-    $.post("/rest/resource/", function( data ) {
-    });
-    $.post("/rest/lease/", function( data ) {
-    });
-
-   
     function drawSlices(slices){
         var items = [];
                
         $.each( slices, function(i, val) {
             items.push( "<li><a href=\"/resources/"+val+"\">" + val + "</a></li>" );
             /*
-            Launch a Query for each slice to get resources and leases in Manifold Cache
-            */
+            // Launch a Query for each slice to get resources and leases in Manifold Cache
+            // Now only done in Homeview to speed up the other pages
             $.post("/rest/slice/", { 'filters': { 'slice_hrn' : val } }, function(data) {
             });
+            */
         });
         $("div#home-slice-list").html($( "<ul/>", { html: items.join( "" ) }));
         $("ul#dropdown-slice-list").append(items.join( "" ));
index 98a7982..fed82dc 100644 (file)
@@ -82,9 +82,9 @@
                        </div>
                        <h3 title="Some tools do their own slice creation and management.">Experiment now</h3>
                        <a class="btn btn-primary" style="width: 150px;" 
-                    href='http://jfed.iminds.be/releases/r1389/webstart/experimenter/jfed-experimenter.jnlp'
+                    href='http://jfed.iminds.be/releases/5.4-dev/r2289/webstart/experimenter/jfed-experimenter.jnlp'
                                        title="Click here to start your experiment with jFed" 
-                                       onclick="return  launchApplication('http://jfed.iminds.be/releases/r1389/webstart/experimenter/jfed-experimenter.jnlp');">
+                                       onclick="return  launchApplication('http://jfed.iminds.be/releases/5.4-dev/r2289/webstart/experimenter/jfed-experimenter.jnlp');">
                     <span class="glyphicon glyphicon-cloud"></span> jFed</a>
                </div>
                <div class="col-md-3">
                        {%endif%}
                        <h3 title="Some tools do their own slice creation and management.">Experiment now</h3>
                        <a class="btn btn-primary" style="width: 150px;" 
-                    href='http://jfed.iminds.be/releases/r1389/webstart/experimenter/jfed-experimenter.jnlp'
+                    href='http://jfed.iminds.be/releases/5.4-dev/r2289/webstart/experimenter/jfed-experimenter.jnlp'
                                        title="Click here to start your experiment with jFed" 
-                                       onclick="return  launchApplication('http://jfed.iminds.be/releases/r1389/webstart/experimenter/jfed-experimenter.jnlp');">
+                                       onclick="return  launchApplication('http://jfed.iminds.be/releases/5.4-dev/r2289/webstart/experimenter/jfed-experimenter.jnlp');">
                     <span class="glyphicon glyphicon-cloud"></span> jFed</a>   
                </div>
                <div class="col-md-4">
         // myslice.user is in LocalStorage
         if(myslice.user.slices.length>0){
             $.each( myslice.user.slices, function(i, val) {
-                /*
-                Launch a Query for each slice to get resources and leases in Manifold Cache
-                */
+                // Launch a Query for each slice to get resources and leases in Manifold Cache
                 $.post("/rest/slice/", { 'filters': { 'slice_hrn' : val } }, function(data) {
                 });
             });
diff --git a/portal/templates/fed4fire/fed4fire_slice-tab-experiment.html b/portal/templates/fed4fire/fed4fire_slice-tab-experiment.html
new file mode 100644 (file)
index 0000000..0ca237f
--- /dev/null
@@ -0,0 +1,111 @@
+<div class="col-md-2">
+</div>
+<div class="col-md-8">
+       <h2>How to access your slice</h2>
+       <h3>PlanetLab Europe</h3>
+       
+       <p>
+               PlanetLab Europe resources are accessible directly via SSH. Your SSH public key is deployed automatically
+               on the reserved nodes. To access your slice on a resource just type the following command:
+       </p>
+       {%if ple_resources%}
+       <p class="command">
+       {%for resource in ple_resources %}
+               $ ssh {{ple_slicename}}@{{resource}}<br>
+       {%endfor%}
+       </p>
+        <h4>Windows users</h4>
+        <p>Use <a href="http://www.putty.org/" target="_blank">SSH client.</a></p>
+
+       {%else%}
+               <p><b>NOTE:</b> You did not reserve any PLE resources yet. Once reserved, you will get the actual SSH command. A specimen command is given below:</p>
+               <p class="command">
+               $ ssh {{ple_slicename}}@planetlab-resource.hostname.com<br>
+               </p>
+                <h4>Windows users</h4>
+                <p>Use <a href="http://www.putty.org/" target="_blank">SSH client.</a></p>
+
+       {%endif%}
+       <p><strong>NOTE:</strong> Your original slicename <b>{{slicename}}</b> has been converted to PlanetLab specific format <b>{{ple_slicename}}</b> in order to do SSH.</p>
+       <p>Please note that the first '.' is replaced by number 8 and the rest of the dot/s are replaced by underscore/s.</p>
+       <p>
+               Be aware that after you reserve a PlanetLab Europe resource your slice will be deployed with a delay of about 15 minutes, 
+               after witch you will be able to access the resource.
+       </p>
+       
+       <h3>NITOS</h3>
+       
+       <p>
+        NITOS resources are not directly accessible. You will need to log in on a gateway server and from there access the node.
+        The NITOS server address is nitlab.inf.uth.gr, so to connect to the NITOS server:
+       </p>
+       <p class="command">
+       $ ssh {{slicename}}@nitlab.inf.uth.gr
+       </p>
+       <h4>Windows users</h4>
+       <p>Use <a href="http://www.putty.org/" target="_blank">SSH client.</a></p>
+
+       <p>
+       <!-- In order to connect to NITOS server he has to upload his public key on the server. 
+       For now we do it this way: http://nitlab.inf.uth.gr/NITlab/index.php/your-ssh-keys. 
+       I think this is a procedure that needs to be done at the registration phase of the user, 
+       through myslice, Broker etc. but I will answer you in a couple of days for sure. -->
+       </p>
+
+       <p>
+               You will then need to prepare the resource by loading an OMF image on it:
+       </p>
+       
+       <p class="command">
+               $ omf load -i baseline_grid.ndz -t omf.nitos.node016
+       </p>
+
+       <p>
+               Turn on the node:
+       </p>
+       
+       <p class="command">
+               $ omf tell -a on -t omf.nitos.node016
+       </p>
+       <p>
+               And finally ssh on the node:
+       </p>
+       <p class="command">
+               $ ssh root@node016
+       </p>
+       <p>
+               On the node itself you will have to modify the file /etc/omf-resctl-5.3/omf-resctl.yaml according to your slice settings and then
+               restart the OMF Resource Controller and finally execute the experiment:
+       </p>
+       <p class="command">
+               $ omf exec --slice slice_name your_exp.rb
+       </p>
+       <p>
+       The complete tutorial is available at the following address:
+       <a target="_blank" href="http://nitlab.inf.uth.gr/NITlab/index.php/testbed/instructions/basic-tutorial">NITOS basic tutorial</a>
+       </p>
+       
+       <br />
+       
+       <h2>Available Tools</h2>
+       <p><img src="{{ STATIC_URL }}img/terminal_icon.png" width="50"> <b>SSH</b></p>
+       <p>
+       Secure Shell (SSH) is a cryptographic network protocol for secure data communication, remote command-line login, remote command execution, and other secure network services between two networked computers that connects, via a secure channel over an insecure network, a server and a client (running SSH server and SSH client programs, respectively). The protocol specification distinguishes between two major versions that are referred to as SSH-1 and SSH-2.
+       </p>
+       <p> More Info: <a href="http://en.wikipedia.org/wiki/Secure_Shell" target="_blank">http://en.wikipedia.org/wiki/Secure_Shell</a></p>
+       <br>
+       <br>
+       <p><img src="{{ STATIC_URL }}img/nepi_logo.png" width="90"></p>
+       <p>NEPI, the Network Experimentation Programming Interface, is a life-cycle management tool for network experiments. The idea behind NEPI is to provide a single tool to design, deploy, and control network experiments, and gather the experiment results. Going further, NEPI was specially conceived to function with arbitrary experimentation platforms, so researchers could use a single tool to work with network simulators, emulators, or physical testbeds, or even a mixture of them. To accomplish this, NEPI provides a high-level interface to describe experiments that is independent from any experimentation platform, but is able to capture platform specific configurations. Experiment definitions can be stored in XML format to be later reproduced, and modified according to experimentation needs. Experiment execution is orchestrated by a global experiment controller, that is platform independent, and different platform-dependent testbed controllers, creating a control hierarchy that is able t adapt to platform specific requirements while providing an integrated control scheme.</p>
+       <p> More Info: <a href="http://nepi.inria.fr" target="_blank">http://nepi.inria.fr</a></p>
+       <br>
+       <p><img src="{{ STATIC_URL }}img/omf-logo.png" width="90"></p>
+       <p>OMF is a Testbed Control, Measurement and Management Framework.</p>
+       <p>
+       OMF was originally developed for the ORBIT wireless testbed at Winlab, Rutgers University. Since 2007, OMF has been actively extended to operate on testbeds with many different type of network and resource technologies. It is now deployed and used on different testbeds in Australia, Europe, and in the U.S. OMF is currently being extended further to support exciting new features and technologies. This website is hosting this ongoing activity. OMF development is now conducted essentially within the TEMPO project at NICTA (Australia) in strong collaboration with Winlab (Rutgers University).
+       </p>
+       <p>In addition to the main OMF software, this site also hosts OMF sub-projects addressing various related aspects of a testbed's control, measurement, and management.</p>
+       <p>More Info: <a href="http://mytestbed.net/projects/omf" target="_blank">http://mytestbed.net/projects/omf</a></p>
+</div>
+<div class="col-md-2">
+</div>
diff --git a/portal/templates/onelab/onelab_base.html b/portal/templates/onelab/onelab_base.html
deleted file mode 100644 (file)
index fdab352..0000000
+++ /dev/null
@@ -1,49 +0,0 @@
-{# This is required by insert_above #}{% insert_handler %}<!DOCTYPE html>
-<html lang="en"><head>
-<title>OneLab - {{ section }}</title>
-<meta name="viewport" content="width=device-width, initial-scale=1.0">
-<link rel="shortcut icon" href="/static/img/myslice-icon.png">
-{# This is where insert_str will end up #}{% media_container prelude %}
-{% include 'messages-transient-header.html' %}
-<script type="text/javascript"> {# raw js code - use {% insert prelude_js %} ... {% endinsert %} #} {% container prelude_js %}</script>
-<script src="{{ STATIC_URL }}js/jquery.dataTables.min.js"></script>
-<script src="{{ STATIC_URL }}js/bootstrap.datatables.js"></script>
-<script src="{{ STATIC_URL }}js/myslice.js"></script>
-<script src="{{ STATIC_URL }}js/myslice-ui.js"></script>
-<style type="text/css">{# In case we need to add raw css code #}{% container prelude_css %}</style>
-{{ header_prelude }}
-{% block head %} {% endblock head %}
-{# let's add these ones no matter what #}
-{% insert_str prelude "js/jquery.min.js" %}
-{% insert_str prelude "js/angular/angular.min.js" %}
-{% insert_str prelude "js/jquery.html5storage.min.js" %}
-{% insert_str prelude "js/messages-runtime.js" %}
-{% insert_str prelude "js/class.js" %}
-{% insert_str prelude "js/plugin-helper.js" %}
-{% insert_str prelude "js/mustache.js" %}
-{% insert_str prelude "js/hashtable.js" %}
-{% insert_str prelude "js/plugin.js" %}
-{% insert_str prelude "js/manifold.js" %}
-{% insert_str prelude "css/manifold.css" %}
-{% insert_str prelude "css/plugin.css" %}
-{% insert_str prelude "js/bootstrap.js" %}
-{% insert_str prelude "css/bootstrap.css" %}
-{% insert_str prelude "js/bootstrap-datepicker.js" %}
-{% insert_str prelude "css/datepicker.css" %}
-{% insert_str prelude "js/bootstrap-slider.js" %}
-{% insert_str prelude "css/slider.css" %}
-{% insert_str prelude "css/topmenu.css" %}
-{% insert_str prelude "js/logout.js" %}
-<link rel="stylesheet" type="text/css" href="{{ STATIC_URL }}css/{{ theme }}.css">
-</head>
-<body ng-app="ManifoldApp">
-{% block container %}
-       {% block topmenu %}
-       {% include theme|add:"__widget-topmenu.html" %}
-       {% endblock topmenu %}
-       {% include 'messages-transient.html' %}
-       {% block base_content %}
-       {% endblock %}
-{% endblock container %}
-</body>
-</html>
index c2d52c3..c8b6b44 100644 (file)
@@ -14,5 +14,6 @@
   <!-- <div class="tab-pane row" id="statistics">...</div> -->
   <!-- <div class="tab-pane row" id="measurements">...</div> -->
   <div class="tab-pane row" id="experiment">...</div>
+  <!-- <div class="tab-pane row" id="studentslabs">...</div> -->
 </div>         
 {% endblock %}
index 40761b5..e03a53c 100644 (file)
@@ -20,6 +20,7 @@
        <!-- <li><a href="/slice/{{ slice }}#experiment">Statistics</a></li> -->
        <!-- <li><a href="/slice/{{ slice }}#experiment">Measurements</a></li> -->
        <li><a href="/slice/{{ slice }}#experiment">Tools</a></li>
+       <!-- <li><a href="/slice/{{ slice }}#studentslabs">Students Labs</a></li> -->
 </ul>
 {% else %}
 <ul class="nav nav-tabs nav-section">
@@ -30,6 +31,7 @@
        <!-- <li class="statistics"><a href="#experiment">Statistics</a></li> -->
        <!-- <li class="measurements"><a href="#experiment">Measurements</a></li> -->
        <li class="experiment"><a href="#experiment">Tools</a></li>
+       <!-- <li class="studentslabs"><a href="#studentslabs">Students Labs</a></li> -->
 </ul>
 
 <script>
@@ -53,4 +55,4 @@ $(document).ready(function() {
 {% endif %}
 </div>
 </div>
-</div>
\ No newline at end of file
+</div>
index 2fb051c..34873da 100644 (file)
                $ ssh {{ple_slicename}}@{{resource}}<br>
        {%endfor%}
        </p>
+        <h4>Windows users</h4>
+        <p>Use <a href="http://www.putty.org/" target="_blank">SSH client.</a></p>
        {%else%}
                <p><b>NOTE:</b> You did not reserve any PLE resources yet. Once reserved, you will get the actual SSH command. A specimen command is given below:</p>
                <p class="command">
                $ ssh {{ple_slicename}}@planetlab-resource.hostname.com<br>
                </p>
        {%endif%}
+       <h4>Windows users</h4>
+       <p>Use <a href="http://www.putty.org/" target="_blank">SSH client.</a></p>
        <p><strong>NOTE:</strong> Your original slicename <b>{{slicename}}</b> has been converted to PlanetLab specific format <b>{{ple_slicename}}</b> in order to do SSH.</p>
        <p>Please note that the first '.' is replaced by number 8 and the rest of the dot/s are replaced by underscore/s.</p>
        <p>
        <p class="command">
                ssh {{username}}@fit3-dev.inrialpes.fr
        </p>
-       
+       <h4>Windows users</h4>
+       <p>Use <a href="http://www.putty.org/" target="_blank">SSH client.</a></p>
+
        <h3>NITOS</h3>
        
        <p>
         NITOS resources are not directly accessible. You will need to log in on a gateway server and from there access the node.
-        The NITOS server address is nitlab.inf.uth.gr, so to connect to the NITOS server:
+        You will find the ssh commands to connect to NITOS nodes below:
        </p>
+       <h4>NITLab</h4>
        <p class="command">
        $ ssh {{slicename}}@nitlab.inf.uth.gr
        </p>
-       
+       <h4>FIT NITOS-Lab Paris</h4>
+        <p class="command">
+       $ ssh {{slicename}}@griffin.ipv6.lip6.fr
+        </p>
+
+        <h5>Windows users</h5>
+        <p>Use <a href="http://www.putty.org/" target="_blank">SSH client.</a></p>
+
        <p>
        <!-- In order to connect to NITOS server he has to upload his public key on the server. 
        For now we do it this way: http://nitlab.inf.uth.gr/NITlab/index.php/your-ssh-keys. 
@@ -56,7 +70,7 @@
        </p>
        
        <p class="command">
-               $ omf load -i baseline_grid.ndz -t omf.nitos.node016
+               $ omf load -i baseline_grid.ndz -t node016
        </p>
 
        <p>
@@ -64,7 +78,7 @@
        </p>
        
        <p class="command">
-               $ omf tell -a on -t omf.nitos.node016
+               $ omf tell -a on -t node016
        </p>
        <p>
                And finally ssh on the node:
@@ -83,6 +97,7 @@
        The complete tutorial is available at the following address:
        <a target="_blank" href="http://nitlab.inf.uth.gr/NITlab/index.php/testbed/instructions/basic-tutorial">NITOS basic tutorial</a>
        </p>
+       <p>To learn more about OMF6, please click <a href="http://omf.mytestbed.net/projects/omf6/wiki/Wiki" target="_blank">here.</a></p>
        
        <br />
        
        <p>
        Secure Shell (SSH) is a cryptographic network protocol for secure data communication, remote command-line login, remote command execution, and other secure network services between two networked computers that connects, via a secure channel over an insecure network, a server and a client (running SSH server and SSH client programs, respectively). The protocol specification distinguishes between two major versions that are referred to as SSH-1 and SSH-2.
        </p>
-       <p> More Info: <a href="http://en.wikipedia.org/wiki/Secure_Shell" target="_blank">http://en.wikipedia.org/wiki/Secure_Shell</a></p>
+       <p> More info: <a href="http://en.wikipedia.org/wiki/Secure_Shell" target="_blank">http://en.wikipedia.org/wiki/Secure_Shell</a></p>
        <br>
+       <p><img src="{{ STATIC_URL }}img/putty-logo.png" width="50"> <b>PuTTY</b></p>
+       <p>
+               PuTTY is an SSH and telnet client, developed originally by Simon Tatham for the Windows platform. PuTTY is open source software that is available with source code and is developed and supported by a group of volunteers.
+       </p>
+       <p>More info: <a href="http://www.putty.org/" target="_blank">http://www.putty.org/</a></p>     
        <br>
        <p><img src="{{ STATIC_URL }}img/nepi_logo.png" width="90"></p>
        <p>NEPI, the Network Experimentation Programming Interface, is a life-cycle management tool for network experiments. The idea behind NEPI is to provide a single tool to design, deploy, and control network experiments, and gather the experiment results. Going further, NEPI was specially conceived to function with arbitrary experimentation platforms, so researchers could use a single tool to work with network simulators, emulators, or physical testbeds, or even a mixture of them. To accomplish this, NEPI provides a high-level interface to describe experiments that is independent from any experimentation platform, but is able to capture platform specific configurations. Experiment definitions can be stored in XML format to be later reproduced, and modified according to experimentation needs. Experiment execution is orchestrated by a global experiment controller, that is platform independent, and different platform-dependent testbed controllers, creating a control hierarchy that is able t adapt to platform specific requirements while providing an integrated control scheme.</p>
-       <p> More Info: <a href="http://nepi.inria.fr" target="_blank">http://nepi.inria.fr</a></p>
+       <p> More info: <a href="http://nepi.inria.fr" target="_blank">http://nepi.inria.fr</a></p>
        <br>
        <p><img src="{{ STATIC_URL }}img/omf-logo.png" width="90"></p>
        <p>OMF is a Testbed Control, Measurement and Management Framework.</p>
index 2252189..4372a35 100644 (file)
@@ -59,4 +59,4 @@ def servicesStatus(request):
                 result[s]['status'] = 'ko'
 
         
-    return HttpResponse(json.dumps(result), content_type="application/json")
\ No newline at end of file
+    return HttpResponse(json.dumps(result), content_type="application/json")
index a408274..04b156b 100644 (file)
@@ -1,12 +1,15 @@
-from sfa.trust.certificate              import Keypair, Certificate
-from sfa.client.sfaserverproxy import SfaServerProxy
-from sfa.client.return_value import ReturnValue
-
+from sfa.trust.certificate      import Keypair, Certificate
+from sfa.client.sfaserverproxy  import SfaServerProxy
+from sfa.client.return_value    import ReturnValue
+from sfa.util.xrn               import Xrn, get_leaf, get_authority, hrn_to_urn, urn_to_hrn
 from manifold.core.query        import Query
+from manifold.models            import db
+from manifold.models.platform   import Platform
+from manifold.models.user       import User
 
-from django.shortcuts               import render_to_response
+from django.shortcuts           import render_to_response
 
-from unfold.loginrequired           import LoginRequiredView
+from unfold.loginrequired       import LoginRequiredView
 
 from rest import ObjectRequest, error
 
@@ -16,7 +19,20 @@ from django.http import HttpResponse
 from rest import error
 import os,json
 
+import ConfigParser 
+
 def dispatch(request, method):
+    Config = ConfigParser.ConfigParser()
+    Config.read(os.getcwd() + "/myslice/monitor.ini")
+
+    # hardcoded user to be replaced by auth
+    user_email = "loic.baron@lip6.fr"
+
+    # Get this as parameters
+    slice_hrn = "fed4fire.upmc.berlin"
+    urn = hrn_to_urn(slice_hrn, "slice")
+    #urn = hrn_to_urn("fed4fire.upmc.loic_baron", "user")
+
     platforms = list()
     options   = list()
     rspec = ''
@@ -41,9 +57,7 @@ def dispatch(request, method):
 
     from manifoldapi.manifoldapi    import execute_admin_query
     for pf in platforms:
-        platform_query = Query().get('local:platform').filter_by('platform', '==', pf).select('config')
-        platform_result = execute_admin_query(request, platform_query)
-        platform = json.loads(platform_result[0]['config'])
+        platform = get_platform_config(pf)
         print platform
         if 'sm' in platform and len(platform['sm']) > 0:
             print 'sm'
@@ -55,28 +69,74 @@ def dispatch(request, method):
             print 'registry'
             server_url = platform['registry']
     
-        pkey_path = os.path.abspath(platform['user_private_key'])
-        if not os.path.isfile(pkey_path) :
+        if not Config.has_option('monitor', 'cert') :
+             return HttpResponse(json.dumps({'error' : '-1'}), content_type="application/json")
+
+        cert = os.path.abspath(Config.get('monitor', 'cert'))
+        if not os.path.isfile(cert) :
+             return HttpResponse(json.dumps({'error' : '-1'}), content_type="application/json")
+
+        if not Config.has_option('monitor', 'pkey') :
              return HttpResponse(json.dumps({'error' : '-2'}), content_type="application/json")
-        pkey_file = open(pkey_path,'r')
-        pkey = pkey_file.read()
-        x = pkey.encode('latin1')
-        keypair = Keypair(string=x)
-        self_signed = Certificate(subject = platform['user'])
-        self_signed.set_pubkey(keypair)
-        self_signed.set_issuer(keypair, subject=platform['user'].encode('latin1'))
-        self_signed.sign()
-        sscert_path = self_signed.save_to_random_tmp_file()
-        print "path of tmp sscert: %s" % sscert_path
-        print server_url
-        server = SfaServerProxy(server_url, pkey_path, sscert_path)
-        os.remove(sscert_path)
-       
+
+        pkey = os.path.abspath(Config.get('monitor', 'pkey'))
+        if not os.path.isfile(pkey) :
+             return HttpResponse(json.dumps({'error' : '-2'}), content_type="application/json")
+        server = SfaServerProxy(server_url, pkey, cert)
+
+        # Get user config from Manifold
+        user_config = get_user_config(user_email, pf)
+        if 'delegated_user_credential' in user_config:
+            user_cred = user_config['delegated_user_credential']
+        else:
+            user_cred = {}
+
+        #if 'delegated_slice_credentials' in user_config:
+        #    for slice_name, cred in user_config['delegated_slice_credentials']:
+        #        if slice_name == slice_param
+
         if method == "GetVersion": 
-            print "this is the result of GetVersion:"
             result = server.GetVersion()
+        elif method == "ListResources":
+            api_options = {}
+            #api_options ['call_id'] = unique_call_id()
+            api_options['geni_rspec_version'] = {'type': 'GENI', 'version': '3'}
+            result = server.ListResources([user_cred], api_options)
+        elif method == "Describe":
+            api_options = {}
+            #api_options ['call_id'] = unique_call_id()
+            api_options['geni_rspec_version'] = {'type': 'GENI', 'version': '3'}
+            result = server.Describe([urn] ,[object_cred], api_options)
+
         else:
-            return HttpResponse(json.dumps({'error' : '-1','msg':'method not supported yet'}), content_type="application/json")
+            return HttpResponse(json.dumps({'error' : '-3','msg':'method not supported yet'}), content_type="application/json")
 
         results[pf] = result
+
     return HttpResponse(json.dumps(results), content_type="application/json")
+
+def get_user_account(user_email, platform_name):
+    """
+    Returns the user configuration for a given platform.
+    This function does not resolve references.
+    """
+    user = db.query(User).filter(User.email == user_email).one()
+    platform = db.query(Platform).filter(Platform.platform == platform_name).one()
+    accounts = [a for a in user.accounts if a.platform == platform]
+    if not accounts:
+        raise Exception, "this account does not exist"
+
+    if accounts[0].auth_type == 'reference':
+        pf = json.loads(accounts[0].config)['reference_platform']
+        return get_user_account(user_email, pf)
+
+    return accounts[0]
+
+def get_user_config(user_email, platform_name):
+    account = get_user_account(user_email, platform_name)
+    return json.loads(account.config) if account.config else {}
+
+def get_platform_config(platform_name):
+    platform = db.query(Platform).filter(Platform.platform == platform_name).one()
+    return json.loads(platform.config) if platform.config else {}