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
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
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')
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
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
--- /dev/null
+{% extends "layout_wide.html" %}
+{% load portal_filters %}
+
+{% block head %}
+<!-- <script type="text/javascript" src="https://maps.googleapis.com/maps/api/js?key=AIzaSyC1RUj824JAiHRVqgc2CSIg4CpKHhh84Lw&sensor=false"></script> -->
+<script src="{{ STATIC_URL }}js/onelab_slice-resource-view.js"></script>
+<script>
+ //myslice.slice = "{{ slice }}";
+
+$(document).ready(function() {
+ $('a[data-toggle="tab"]').on('shown.bs.tab', function (e) {
+ // find the plugin object inside the tab content referenced by the current tabs
+ $('.plugin', $($(e.target).attr('href'))).trigger('shown.bs.tab');
+ $('.plugin', $($(e.target).attr('href'))).trigger('show');
+ });
+});
+</script>
+{% endblock %}
+
+{% block content %}
+{% widget '_widget-slice-sections.html' %}
+<div class="container-fluid container-resource">
+ <div class="row">
+ <div class="col-md-2">
+ <!-- <div id="select-platform" class="list-group"></div> -->
+ {{filter_testbeds}}
+ </div>
+ <div class="col-md-10" style="height:100%;">
+ <div class="row">
+ {% if msg %}
+ <div class="col-md-12"><p class="alert-success">{{ msg }}</p></div>
+ {% endif %}
+ </div>
+
+ <div class="row">
+ <div class="col-md-6">
+ {{ filter_status }}
+ </div>
+ <div class="col-md-1">
+ {{ apply }}
+ </div>
+ </div>
+ <!--
+ <div class="list-group-item list-resources">
+ <span class="list-group-item-heading" style="padding-left: 0;">Resource status:</span>
+ <a class="list-group-item active" data-panel="resources" href="#" style='display: inline-block !important;'>All</a>
+ <a class="list-group-item" data-panel="reserved" href="#" style='display: inline-block !important;'>Reserved</a>
+ <a class="list-group-item" data-panel="pending" href="#" style='display: inline-block !important;'>Pending <span class="badge" id="badge-pending" data-number="0"></span></a>
+ </div>
+ -->
+
+ <div class="row">
+ <div class="col-md-12">
+ <ul class="nav nav-tabs">
+ <li class="active"><a href="#resourcelist" role="tab" data-toggle="tab">Table</a></li>
+ <li> <a href="#resourcemap" role="tab" data-toggle="tab">Map</a></li>
+ <li> <a href="#resourceflowspace" role="tab" data-toggle="tab">Flowspace</a></li>
+ <li> <a href="#resourcescheduler" role="tab" data-toggle="tab">Scheduler</a></li>
+ </ul>
+ </div>
+ </div>
+
+ <!-- Modal - columns selector -->
+ <div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
+ <div class="modal-dialog">
+ <div class="modal-content">
+ <div class="modal-header">
+ <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
+ <h4 class="modal-title" id="myModalLabel">Columns selector</h4>
+ </div>
+ <div class="modal-body">
+ {{columns_editor}}
+ </div>
+ <div class="modal-footer">
+ <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
+ </div>
+ </div>
+ </div>
+ </div>
+
+
+ <div class="row">
+ <div class="col-md-12">
+ <div class="tab-content" style="height:100%;">
+ <div class="tab-pane active" id="resourcelist">
+ <!-- Button trigger modal - columns selector -->
+ <button class="btn btn-default btn-sm" style="float:right;" data-toggle="modal" data-target="#myModal">...</button>
+ {{list_resources}}
+ <!-- <table cellpadding="0" cellspacing="0" border="0" class="table" id="objectList"></table> -->
+ </div>
+ <div class="tab-pane" id="resourcemap">
+ {{map_resources}}
+ </div>
+ <div class="tab-pane" id="resourceflowspace">
+
+ <p>{{welcome}}</p>
+ <p>{{flowspaces}}</p>
+ <p>{{flowspaces_form}}</p>
+ <p>{{oflowspaces_form}}</p>
+ <p>{{topology}}</p>
+ <p>{{resources}}</p>
+
+ <p>{{below_table}}</p>
+
+ </div>
+ <div class="tab-pane" id="resourcescheduler">
+ {{scheduler}}
+ </div>
+
+ <!--
+ <div id="reserved" class="tab-pane" style="height:370px;display:none;">
+ <table width="80%">
+ <tr><th width="50%" style="text-align:center;">resources</th><th width="50%" style="text-align:center;">leases</th></tr>
+ <tr>
+ <td style="text-align:center">{{list_reserved_resources}}</td>
+ <td style="text-align:center">{{list_reserved_leases}}</td>
+ </tr>
+ </table>
+ </div>
+ <div id="pending" class="tab-pane" style="height:370px;display:none;">
+ {{pending_resources}}
+ </div>
+ <div id="sla_dialog" class="tab-pane" style="height:370px;display:none;">
+ {{sla_dialog}}
+ </div>
+ -->
+
+ </div>
+ </div>
+ </div>
+ </div>
+ </div>
+</div>
+{% endblock %}
<ul class="nav nav-tabs">
<li class="active"><a href="#resourcelist" role="tab" data-toggle="tab">Table</a></li>
<li> <a href="#resourcemap" role="tab" data-toggle="tab">Map</a></li>
+ <li> <a href="#resourceflowspace" role="tab" data-toggle="tab">Flowspace</a></li>
<li> <a href="#resourcescheduler" role="tab" data-toggle="tab">Scheduler</a></li>
</ul>
</div>
<div class="tab-pane" id="resourcemap">
{{map_resources}}
</div>
+ <div class="tab-pane" id="resourceflowspace">
+
+ <p>{{welcome}}</p>
+ <p>{{flowspaces}}</p>
+ <p>{{flowspaces_form}}</p>
+ <p>{{oflowspaces_form}}</p>
+ <p>{{topology}}</p>
+ <p>{{resources}}</p>
+
+ <p>{{below_table}}</p>
+
+ </div>
<div class="tab-pane" id="resourcescheduler">
{{scheduler}}
</div>
{% block unfold_main %}
-<center><h1>Book OpenFlow Resources </h1></center>
-
-<p>{{resources}}</p>
+<center><h1>Book OpenFlow Resources</h1></center>
+<p>{{welcome}}</p>
<p>{{flowspaces}}</p>
<p>{{flowspaces_form}}</p>
+<p>{{oflowspaces_form}}</p>
+<p>{{topology}}</p>
+<p>{{resources}}</p>
<p>{{below_table}}</p>
{% endblock %}
-
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):
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,
},
)
- #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,
'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
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
-