X-Git-Url: https://osm.etsi.org/gitweb/?a=blobdiff_plain;f=src%2Femuvim%2Fapi%2Frest%2Frest_api_endpoint.py;h=71f87b94cd27fffdff6843ea900966e19cbf0080;hb=ee5179f161d10b35a8a73f495ca3692fda9b2e71;hp=4767be45519ac1253b40b401858db83e01625667;hpb=23be11bc2e8fcb8e177694c61d95e65682a84238;p=osm%2Fvim-emu.git 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 @@ 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). """ + import logging import threading from flask import Flask @@ -42,6 +43,9 @@ from network import NetworkAction 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 @@ class RestApiEndpoint(object): 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 @@ class RestApiEndpoint(object): 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(