acknowledge the contributions of their colleagues of the SONATA
partner consortium (www.sonata-nfv.eu).
"""
+
import logging
import threading
from flask import Flask
from flask_restful import Api
+#from gevent.wsgi import WSGIServer
# need to import total module to set its global variable dcs
import compute
import monitor
from monitor import MonitorInterfaceAction, MonitorFlowAction, MonitorLinkAction, MonitorSkewAction
+import pkg_resources
+from os import path
+
logging.basicConfig(level=logging.INFO)
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
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(
def _start_flask(self):
self.app.run(self.ip, self.port, debug=True, use_reloader=False)
+ #this should be a more production-fit http-server
+ #http_server = WSGIServer((self.ip, self.port), self.app)
+ #http_server.serve_forever()