From: Yasin Date: Thu, 18 Dec 2014 14:22:47 +0000 (+0100) Subject: Dynamically display/hide tools page based on reserved resources X-Git-Tag: myslice-1.1~12 X-Git-Url: http://git.onelab.eu/?p=myslice.git;a=commitdiff_plain;h=c0b59313c0516a7bfcd80246c6c84db0398170da Dynamically display/hide tools page based on reserved resources --- diff --git a/portal/slicetabexperiment.py b/portal/slicetabexperiment.py index 023c2060..f8b6b382 100644 --- a/portal/slicetabexperiment.py +++ b/portal/slicetabexperiment.py @@ -29,20 +29,49 @@ class ExperimentView (FreeAccessView, ThemeView): query_current_resources = Query.get('slice').select('resource').filter_by('slice_hrn','==',slicename) current_resources = execute_query(request, query_current_resources) - formatted_resource_list=[] + ple_resource_list=[] + nitos_resource_list=[] + nitos_paris_resource_list=[] + iotlab_resource_list=[] try: for resources in current_resources: list_res = resources['resource'] + #print "list_b4" + #print list_res for res in list_res: split_list = res.split('+') # split the resource urn - if [s for s in split_list if 'ple' in s]: # search only ple resources + #print "list_after" + #print split_list + if [s for s in split_list if 'ple' in s]: # find ple resources res_hrn = split_list[-1] # last element is resource hrn - formatted_resource_list.append(res_hrn) + ple_resource_list.append(res_hrn) + if [s for s in split_list if 'omf:paris.fit-nitos.fr' in s]: # find nitos_paris resources + res_hrn = split_list[-1] # last element is resource hrn + nitos_paris_resource_list.append(res_hrn) + if [s for s in split_list if 'iotlab' in s]: # find iotlab resources + res_hrn = split_list[-1] # last element is resource hrn + iotlab_resource_list.append(res_hrn) + if [s for s in split_list if 'omf:nitos.indoor' in s]: # find nitos_indoor resources + res_hrn = split_list[-1] # last element is resource hrn + nitos_resource_list.append(res_hrn) + if [s for s in split_list if 'omf:nitos.outdoor' in s]: # find nitos_outdoor resources + res_hrn = split_list[-1] # last element is resource hrn + nitos_resource_list.append(res_hrn) + + except Exception,e: print "Exception in slicetabexperiment.py in ple resource search %s" % e - print "list of ple resource hrns" - print formatted_resource_list + #print "list of ple res hrns" + #print ple_resource_list + #print "list of nit_paris res hrns" + #print nitos_paris_resource_list + #print "list of iotLab res hrns" + #print iotlab_resource_list + #print "list of nitos res hrns" + #print nitos_resource_list + + - return render_to_response(self.template, { 'theme' : self.theme,'slicename':slicename, 'ple_slicename':ple_slicename, 'username':username, 'ple_resources':formatted_resource_list }, context_instance=RequestContext(request)) + return render_to_response(self.template, { 'theme' : self.theme,'slicename':slicename, 'ple_slicename':ple_slicename, 'username':username, 'ple_resources':ple_resource_list, 'nitos_resources': nitos_resource_list, 'nitos_paris_resources':nitos_paris_resource_list, 'iotlab_resources':iotlab_resource_list }, context_instance=RequestContext(request)) diff --git a/portal/templates/slice-tab-experiment.html b/portal/templates/slice-tab-experiment.html index 34873dae..b29963a6 100644 --- a/portal/templates/slice-tab-experiment.html +++ b/portal/templates/slice-tab-experiment.html @@ -1,25 +1,19 @@
-

How to access your slice

+ {% if ple_resources or iotlab_resources or nitos_resources or nitos_paris_resources%} +

How to access your reserved resources

+ {% endif %} + {% if ple_resources %}

PlanetLab Europe

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:

- {%if ple_resources%}

{%for resource in ple_resources %} $ ssh {{ple_slicename}}@{{resource}}
{%endfor%}

-

Windows users

-

Use SSH client.

- {%else%} -

NOTE: You did not reserve any PLE resources yet. Once reserved, you will get the actual SSH command. A specimen command is given below:

-

- $ ssh {{ple_slicename}}@planetlab-resource.hostname.com
-

- {%endif%}

Windows users

Use SSH client.

NOTE: Your original slicename {{slicename}} has been converted to PlanetLab specific format {{ple_slicename}} in order to do SSH.

@@ -28,7 +22,9 @@ 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.

- + {% endif %} + + {% if iotlab_resources %}

FIT IoT-Lab

FIT IoT-Lab resources are accessible directly via SSH and web GUI. To acess IoT-Lab resources using web GUI, use the same login and password of OneLab portal. To acess Iot-Lab resources using SSH type @@ -39,67 +35,63 @@

Windows users

Use SSH client.

- + {% endif %} + {% if nitos_resources or nitos_paris_resources %}

NITOS

NITOS resources are not directly accessible. You will need to log in on a gateway server and from there access the node. You will find the ssh commands to connect to NITOS nodes below:

+ + {% if nitos_resources %}

NITLab

$ ssh {{slicename}}@nitlab.inf.uth.gr

-

FIT NITOS-Lab Paris

-

- $ ssh {{slicename}}@griffin.ipv6.lip6.fr -

- -
Windows users
-

Use SSH client.

- -

- -

- -

- You will then need to prepare the resource by loading an OMF image on it: -

+

For each of the reserved nodes, follo the steps given below:

- $ omf load -i baseline_grid.ndz -t node016 + {%for resource in nitos_resources %} + $ omf load -i baseline_grid.ndz -t {{resource}} #loading OMF image on the node
+ $ omf tell -a on -t {{resource}} #turn on the node
+ $ ssh root@{{resource}} #ssh to the node
+ {%endfor%}

+ {% endif %} -

- Turn on the node: -

- -

- $ omf tell -a on -t node016 -

-

- And finally ssh on the node: -

+ {% if nitos_paris_resources %} +

FIT NITOS-Lab Paris

+

+ $ ssh {{slicename}}@griffin.ipv6.lip6.fr +

+

For each of the reserved nodes, follo the steps given below:

- $ ssh root@node016 + {%for resource in nitos_paris_resources %} + $ omf load -i baseline_grid.ndz -t {{resource}} #loading OMF image on the node
+ $ omf tell -a on -t {{resource}} #turn on the node
+ $ ssh root@{{resource}} #ssh to the node

+ {%endfor%}

+ {%endif%} +

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:

- $ omf exec --slice slice_name your_exp.rb + $ omf exec --slice {{slicename}} your_exp.rb

The complete tutorial is available at the following address: NITOS basic tutorial

To learn more about OMF6, please click here.

+ {% endif %} -
+
Windows users
+

Use SSH client.

+

Available Tools

SSH