add son-emu dashboard to the python setup file, so it is served from the Flask app, at the dummygatekeeper's ip:port
diff --git a/dashboard/README.md b/dashboard/README.md
index db15c9d..70161b7 100755
--- a/dashboard/README.md
+++ b/dashboard/README.md
@@ -1,4 +1 @@
-# son-emu Dashboard
-
-A simple web-based dashboard that polls the REST API and displays running services etc. It does not do much more than son-cli but it looks nicer and improves the visualization of the emulator state for live demos.
-
+dashboard is moved to src/emuvim/dashboard so it can be part of the python-based installation script
diff --git a/dashboard/dashboard b/dashboard/dashboard
new file mode 120000
index 0000000..fa6d186
--- /dev/null
+++ b/dashboard/dashboard
@@ -0,0 +1 @@
+../src/emuvim/dashboard/
\ No newline at end of file
diff --git a/setup.py b/setup.py
index ce1c47f..186356c 100755
--- a/setup.py
+++ b/setup.py
@@ -38,7 +38,8 @@
packages=find_packages('src'),
include_package_data=True,
package_data= {
- 'emuvim.api.sonata': ['*.yml']
+ 'emuvim.api.sonata': ['*.yml'],
+ 'emuvim.dashboard' : ['*.html', 'css/*.css','img/*','js/*.js']
},
install_requires=[
'pyaml',
diff --git a/src/emuvim/api/rest/rest_api_endpoint.py b/src/emuvim/api/rest/rest_api_endpoint.py
index 4767be4..71f87b9 100755
--- a/src/emuvim/api/rest/rest_api_endpoint.py
+++ b/src/emuvim/api/rest/rest_api_endpoint.py
@@ -25,6 +25,7 @@
acknowledge the contributions of their colleagues of the SONATA
partner consortium (www.sonata-nfv.eu).
"""
+
import logging
import threading
from flask import Flask
@@ -42,6 +43,9 @@
import monitor
from monitor import MonitorInterfaceAction, MonitorFlowAction, MonitorLinkAction, MonitorSkewAction
+import pkg_resources
+from os import path
+
logging.basicConfig(level=logging.INFO)
@@ -57,7 +61,12 @@
self.port = port
# setup Flask
- self.app = Flask(__name__)
+ # find directory of dashboard files
+ dashboard_file = pkg_resources.resource_filename('emuvim.dashboard', "index.html")
+ dashboard_dir = path.dirname(dashboard_file)
+ logging.info("Started emu dashboard: {0}".format(dashboard_dir))
+
+ self.app = Flask(__name__, static_folder=dashboard_dir, static_url_path='/dashboard')
self.api = Api(self.app)
# setup endpoints
@@ -96,6 +105,7 @@
logging.debug("Created API endpoint %s(%s:%d)" % (self.__class__.__name__, self.ip, self.port))
+
def connectDatacenter(self, dc):
compute.dcs[dc.label] = dc
logging.info(
diff --git a/src/emuvim/api/sonata/dummygatekeeper.py b/src/emuvim/api/sonata/dummygatekeeper.py
index 4e98c6a..76ed3c2 100755
--- a/src/emuvim/api/sonata/dummygatekeeper.py
+++ b/src/emuvim/api/sonata/dummygatekeeper.py
@@ -1012,10 +1012,6 @@
api.add_resource(Exit, '/emulator/exit')
-#def initialize_GK():
-# global GK
-# GK = Gatekeeper()
-
def start_rest_api(host, port, datacenters=dict()):
GK.dcs = datacenters
diff --git a/src/emuvim/dashboard/README.md b/src/emuvim/dashboard/README.md
new file mode 100755
index 0000000..db15c9d
--- /dev/null
+++ b/src/emuvim/dashboard/README.md
@@ -0,0 +1,4 @@
+# son-emu Dashboard
+
+A simple web-based dashboard that polls the REST API and displays running services etc. It does not do much more than son-cli but it looks nicer and improves the visualization of the emulator state for live demos.
+
diff --git a/src/emuvim/dashboard/__init__.py b/src/emuvim/dashboard/__init__.py
new file mode 100644
index 0000000..45ad698
--- /dev/null
+++ b/src/emuvim/dashboard/__init__.py
@@ -0,0 +1,27 @@
+"""
+Copyright (c) 2017 SONATA-NFV
+ALL RIGHTS RESERVED.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+
+Neither the name of the SONATA-NFV [, ANY ADDITIONAL AFFILIATION]
+nor the names of its contributors may be used to endorse or promote
+products derived from this software without specific prior written
+permission.
+
+This work has been performed in the framework of the SONATA project,
+funded by the European Commission under Grant number 671517 through
+the Horizon 2020 and 5G-PPP programmes. The authors would like to
+acknowledge the contributions of their colleagues of the SONATA
+partner consortium (www.sonata-nfv.eu).
+"""
\ No newline at end of file
diff --git a/dashboard/css/main.css b/src/emuvim/dashboard/css/main.css
similarity index 100%
rename from dashboard/css/main.css
rename to src/emuvim/dashboard/css/main.css
diff --git a/dashboard/img/SONATA_new.png b/src/emuvim/dashboard/img/SONATA_new.png
similarity index 100%
rename from dashboard/img/SONATA_new.png
rename to src/emuvim/dashboard/img/SONATA_new.png
Binary files differ
diff --git a/dashboard/index.html b/src/emuvim/dashboard/index.html
similarity index 97%
rename from dashboard/index.html
rename to src/emuvim/dashboard/index.html
index 3c31bec..6f77d08 100755
--- a/dashboard/index.html
+++ b/src/emuvim/dashboard/index.html
@@ -58,7 +58,7 @@
<form class="navbar-form navbar-right">
<div class="input-group">
<span class="input-group-addon">http://</span>
- <input type="text" class="form-control" placeholder="api-url.or.ip" value="sonata-emulator.cs.upb.de:5001" id="text_api_host" data-provide="typeahead" size="30">
+ <input type="text" class="form-control" placeholder="api-url.or.ip" value="localhost:5001" id="text_api_host" data-provide="typeahead" size="30">
</div>
<button type="button" class="btn btn-success" id="btn_connect">Connect <span class="glyphicon glyphicon-play-circle"></span></button>
<button type="button" class="btn btn-danger disabled" id="btn_disconnect">Disconnect <span class="glyphicon glyphicon-off"></span></button>
diff --git a/dashboard/js/main.js b/src/emuvim/dashboard/js/main.js
similarity index 100%
rename from dashboard/js/main.js
rename to src/emuvim/dashboard/js/main.js
diff --git a/dashboard/son-emu-dashboard-screenshot.png b/src/emuvim/dashboard/son-emu-dashboard-screenshot.png
similarity index 100%
rename from dashboard/son-emu-dashboard-screenshot.png
rename to src/emuvim/dashboard/son-emu-dashboard-screenshot.png
Binary files differ