From: Loic Baron Date: Wed, 1 Oct 2014 10:01:00 +0000 (+0200) Subject: Integration of Ofelia OCF Plugin X-Git-Tag: myslice-1.2~1^2~21^2~1 X-Git-Url: http://git.onelab.eu/?p=myslice.git;a=commitdiff_plain;h=1096997ba479d2bb01faa5a70a527e7de6d3b837 Integration of Ofelia OCF Plugin --- diff --git a/portal/sliceresourceview.py b/portal/sliceresourceview.py index 3fe521ad..eaf7931c 100644 --- a/portal/sliceresourceview.py +++ b/portal/sliceresourceview.py @@ -1,8 +1,8 @@ from django.template import RequestContext from django.shortcuts import render_to_response -from manifold.core.query import Query, AnalyzedQuery -from manifoldapi.manifoldapi import execute_query +from manifold.core.query import Query, AnalyzedQuery +from manifoldapi.manifoldapi import execute_query import json from django.views.generic.base import TemplateView @@ -22,6 +22,16 @@ from plugins.googlemap import GoogleMap from plugins.filter_status import FilterStatusPlugin from plugins.testbeds import TestbedsPlugin from plugins.scheduler2 import Scheduler2 + +# Bristol plugin +from plugins.univbris import Univbris +from plugins.univbrisfoam import UnivbrisFoam +from plugins.univbrisfv import UnivbrisFv +from plugins.univbrisfvf import UnivbrisFvf +from plugins.univbrisfvfo import UnivbrisFvfo +from plugins.univbristopo import UnivbrisTopo + + from plugins.columns_editor import ColumnsEditor from plugins.sladialog import SlaDialog from plugins.lists.simplelist import SimpleList @@ -84,7 +94,7 @@ class SliceResourceView (LoginRequiredView, ThemeView): sq_lease = aq.subquery('lease') query_resource_all = Query.get('resource').select(resource_fields) - #page.enqueue_query(query_resource_all) + page.enqueue_query(query_resource_all) # leases query #lease_md = metadata.details_by_object('lease') @@ -247,7 +257,86 @@ class SliceResourceView (LoginRequiredView, ThemeView): username = request.user, ) + # -------------------------------------------------------------------------- + # Ofelia OpenFlow Plugin + # Bristol plugin + + # plugin which display a "gathering resources" message + # waiting for all resources to be returned by manifold + univbriswelcome = Univbris( + page = page, + title = 'univbris_welcome', + domid = 'univbris_welcome', + query = query_resource_all, + ) + + univbrisfoamlist = UnivbrisFoam( + page = page, + title = 'univbris_foam_ports_selection', + domid = 'univbris_foam_ports_selection', + query = query_resource_all, + query_all = query_resource_all, + checkboxes = False, + datatables_options = { + 'iDisplayLength': 10, + 'bLengthChange' : True, + 'bAutoWidth' : True, + }, + ) + #plugin which manages the different flowspaces that the user creates, and also sends flowspaces to manifold + univbrisfvlist = UnivbrisFv( + page = page, + title = 'univbris_flowspace_selection', + domid = 'univbris_flowspace_selection', + query = None, + query_all = None, + sync_query = query_resource_all, + datatables_options = { + 'iDisplayLength': 5, + 'bLengthChange' : True, + 'bAutoWidth' : True, + }, + ) + + #plugin which allows the definition of a single flowspace + univbrisfvform = UnivbrisFvf( + page = page, + title = 'univbris_flowspace_form', + domid = 'univbris_flowspace_form', + query = query_resource_all, + query_all = None, + datatables_options = { + 'iDisplayLength': 3, + 'bLengthChange' : True, + 'bAutoWidth' : True, + }, + ) + + #plugin which allows the definition the match criteria on a single OPTICAL flowspace + + univbrisofvform = UnivbrisFvfo( + page = page, + title = 'univbris_oflowspace_form', + domid = 'univbris_oflowspace_form', + query = None, + query_all = None, + datatables_options = { + 'iDisplayLength': 3, + 'bLengthChange' : True, + 'bAutoWidth' : True, + }, + ) + + #plugin which display the gathered topology + univbristopology = UnivbrisTopo( + page = page, + title = 'univbris_topology', + domid = 'univbris_topology', + query = query_resource_all, + #query = query_resource_all, + ) + # -------------------------------------------------------------------------- # SLA View and accept dialog @@ -296,6 +385,15 @@ class SliceResourceView (LoginRequiredView, ThemeView): template_env['map_resources'] = map_resources.render(self.request) template_env['scheduler'] = resources_as_scheduler2.render(self.request) + + # Bristol plugin + template_env['welcome'] = univbriswelcome.render(self.request) + template_env['resources'] = univbrisfoamlist.render(self.request) + template_env['flowspaces'] = univbrisfvlist.render(self.request) + template_env['oflowspaces_form'] = univbrisofvform.render(self.request) + template_env['flowspaces_form'] = univbrisfvform.render(self.request) + template_env['topology'] = univbristopology.render(self.request) + # template_env['pending_resources'] = pending_resources.render(self.request) template_env['sla_dialog'] = '' # sla_dialog.render(self.request) template_env["theme"] = self.theme diff --git a/portal/templates/fibre/fibre_slice-resource-view.html b/portal/templates/fibre/fibre_slice-resource-view.html new file mode 100644 index 00000000..17e13830 --- /dev/null +++ b/portal/templates/fibre/fibre_slice-resource-view.html @@ -0,0 +1,134 @@ +{% extends "layout_wide.html" %} +{% load portal_filters %} + +{% block head %} + + + +{% endblock %} + +{% block content %} +{% widget '_widget-slice-sections.html' %} +
+
+
+ + {{filter_testbeds}} +
+
+
+ {% if msg %} +

{{ msg }}

+ {% endif %} +
+ +
+
+ {{ filter_status }} +
+
+ {{ apply }} +
+
+ + +
+
+ +
+
+ + + + + +
+
+
+
+ + + {{list_resources}} + +
+
+ {{map_resources}} +
+
+ +

{{welcome}}

+

{{flowspaces}}

+

{{flowspaces_form}}

+

{{oflowspaces_form}}

+

{{topology}}

+

{{resources}}

+ +

{{below_table}}

+ +
+
+ {{scheduler}} +
+ + + +
+
+
+
+
+
+{% endblock %} diff --git a/portal/templates/slice-resource-view.html b/portal/templates/slice-resource-view.html index 3fefedf7..17e13830 100644 --- a/portal/templates/slice-resource-view.html +++ b/portal/templates/slice-resource-view.html @@ -54,6 +54,7 @@ $(document).ready(function() { @@ -90,6 +91,18 @@ $(document).ready(function() {
{{map_resources}}
+
+ +

{{welcome}}

+

{{flowspaces}}

+

{{flowspaces_form}}

+

{{oflowspaces_form}}

+

{{topology}}

+

{{resources}}

+ +

{{below_table}}

+ +
{{scheduler}}
diff --git a/portal/templates/univbris.html b/portal/templates/univbris.html index 05c044ce..2f6147d5 100644 --- a/portal/templates/univbris.html +++ b/portal/templates/univbris.html @@ -5,13 +5,15 @@ {% block unfold_main %} -

Book OpenFlow Resources

- -

{{resources}}

+

Book OpenFlow Resources

+

{{welcome}}

{{flowspaces}}

{{flowspaces_form}}

+

{{oflowspaces_form}}

+

{{topology}}

+

{{resources}}

@@ -19,4 +21,3 @@

{{below_table}}

{% endblock %} - diff --git a/portal/univbrisview.py b/portal/univbrisview.py index 806aaecb..7154b8ab 100644 --- a/portal/univbrisview.py +++ b/portal/univbrisview.py @@ -1,22 +1,26 @@ import json +from manifold.core.query import Query +from manifoldapi.manifoldapi import execute_query -from manifold.core.query import Query -from manifoldapi.manifoldapi import execute_query +from unfold.page import Page + +from plugins.lists.testbedlist import TestbedList +from plugins.lists.slicelist import SliceList -from unfold.page import Page from unfold.loginrequired import FreeAccessView -from unfold.loginrequired import LoginRequiredAutoLogoutView -from ui.topmenu import topmenu_items_live, the_user +from unfold.loginrequired import LoginRequiredAutoLogoutView -from plugins.lists.testbedlist import TestbedList -from plugins.lists.slicelist import SliceList -from plugins.querytable import QueryTable -from plugins.univbrisfoam import UnivbrisFoam -from plugins.univbrisfv import UnivbrisFv -from plugins.lists.staticlist import StaticList -from plugins.lists.slicelist import SliceList -from plugins.messages import Messages -from plugins.univbrisfvf import UnivbrisFvf +from ui.topmenu import topmenu_items_live, the_user +from plugins.querytable import QueryTable +from plugins.univbrisfoam import UnivbrisFoam +from plugins.univbrisfv import UnivbrisFv +from plugins.lists.staticlist import StaticList +from plugins.lists.slicelist import SliceList +from plugins.messages import Messages +from plugins.univbrisfvf import UnivbrisFvf +from plugins.univbrisfvfo import UnivbrisFvfo +from plugins.univbris import Univbris +from plugins.univbristopo import UnivbrisTopo #This view requires login class UnivbrisView (LoginRequiredAutoLogoutView): @@ -27,22 +31,46 @@ class UnivbrisView (LoginRequiredAutoLogoutView): page = Page(self.request) #print "UNIVBRIS page" - - #create new query to manifold----query is not called yet - #need to modify to get i2cat of resources also + metadata = page.get_metadata() + page.expose_js_metadata() + + resource_md = metadata.details_by_object('resource') + resource_fields = [column['name'] for column in resource_md['column']] + + user_md = metadata.details_by_object('user') + user_fields = ['user_hrn'] # [column['name'] for column in user_md['column']] + + + #create new query to manifold----query is not called yet + #need to modify to get i2cat of resources also univbrisfoam_query=Query().get('ofelia-bristol-of:resource').select('urn') + #print univbrisfoam_query #.select('urn') + #Query().get('ofelia-bristol-of:resource') + ##custom query to communication between univbris plugins + #univbris_query=Query() - #queue the query + #queue the query page.enqueue_query(univbrisfoam_query) + #page.enqueue_query(univbris_query) page.expose_js_metadata() - - #plugin which collects different openflow ports from maniford + + + #plugin which display a "gathering resources" message waiting for all resources to be returned by manifold + univbriswelcome = Univbris( + page = page, + title = 'univbris_welcome', + domid = 'univbris_welcome', + query = univbrisfoam_query, + ) + + #plugin which collects different openflow ports from maniford univbrisfoamlist = UnivbrisFoam( page = page, title = 'univbris_foam_ports_selection', domid = 'univbris_foam_ports_selection', query = univbrisfoam_query, query_all = univbrisfoam_query, + sync_query= univbrisfoam_query, checkboxes = False, datatables_options = { 'iDisplayLength': 10, @@ -51,26 +79,42 @@ class UnivbrisView (LoginRequiredAutoLogoutView): }, ) - #plugin which manages the different flowspaces that the user creates, and also sends flowspaces to manifold + #plugin which manages the different flowspaces that the user creates, and also sends flowspaces to manifold univbrisfvlist = UnivbrisFv( - page = page, - title = 'univbris_flowspace_selection', - domid = 'univbris_flowspace_selection', - query = None, - query_all = None, - datatables_options = { - 'iDisplayLength': 5, - 'bLengthChange' : True, - 'bAutoWidth' : True, - }, - ) + page = page, + title = 'univbris_flowspace_selection', + domid = 'univbris_flowspace_selection', + query = None, + query_all = None, + sync_query= univbrisfoam_query, + datatables_options = { + 'iDisplayLength': 5, + 'bLengthChange' : True, + 'bAutoWidth' : True, + }, + ) - #plugin which allows the definition of a single flowspace + #plugin which allows the definition the match criteria on a single PACKET flowspace univbrisfvform = UnivbrisFvf( + page = page, + title = 'univbris_flowspace_form', + domid = 'univbris_flowspace_form', + query = None, + query_all = None, + datatables_options = { + 'iDisplayLength': 3, + 'bLengthChange' : True, + 'bAutoWidth' : True, + }, + ) + + #plugin which allows the definition the match criteria on a single OPTICAL flowspace + + univbrisofvform = UnivbrisFvfo( page = page, - title = 'univbris_flowspace_form', - domid = 'univbris_flowspace_form', - query = None, + title = 'univbris_oflowspace_form', + domid = 'univbris_oflowspace_form', + query = None, query_all = None, datatables_options = { 'iDisplayLength': 3, @@ -78,13 +122,25 @@ class UnivbrisView (LoginRequiredAutoLogoutView): 'bAutoWidth' : True, }, ) - - #render plugins in each context within a single page, but not all plugins are visible at all time. + + + #plugin which display the gathered topology + univbristopology = UnivbrisTopo( + page = page, + title = 'univbris_topology', + domid = 'univbris_topology', + query = univbrisfoam_query, + ) + + #render plugins in each context within a single page, but not all plugins are visible at all time. context = super(UnivbrisView, self).get_context_data(**kwargs) context['person'] = self.request.user + context['welcome'] = univbriswelcome.render(self.request) context['resources'] = univbrisfoamlist.render(self.request) context['flowspaces']= univbrisfvlist.render(self.request) + context['oflowspaces_form']= univbrisofvform.render(self.request) context['flowspaces_form']= univbrisfvform.render(self.request) + context['topology']=univbristopology.render(self.request) # XXX This is repeated in all pages # more general variables expected in the template @@ -93,15 +149,14 @@ class UnivbrisView (LoginRequiredAutoLogoutView): context['topmenu_items'] = topmenu_items_live('univbris', page) # so we can sho who is logged context['username'] = the_user(self.request) - + context.update(page.prelude_env()) page.expose_js_metadata() - + # the page header and other stuff context.update(page.prelude_env()) - + context['layout_1_or_2']="layout-unfold2.html" if not context['username'] else "layout-unfold1.html" - + return context -