Fix/update: Simplified emulator dashboard that only shows running containers and...
[osm/vim-emu.git] / src / emuvim / api / rest / rest_api_endpoint.py
index 0c9e1bc..10b6c26 100755 (executable)
@@ -41,7 +41,7 @@ import network
 from network import NetworkAction, DrawD3jsgraph
 
 import monitor
-from monitor import MonitorInterfaceAction, MonitorFlowAction, MonitorLinkAction, MonitorSkewAction
+from monitor import MonitorInterfaceAction, MonitorFlowAction, MonitorLinkAction, MonitorSkewAction, MonitorTerminal
 
 import pkg_resources
 from os import path
@@ -103,6 +103,9 @@ class RestApiEndpoint(object):
         # the skewness metric is exported
         self.api.add_resource(MonitorSkewAction,
                               "/restapi/monitor/skewness")
+        # start a terminal window for the specified vnfs
+        self.api.add_resource(MonitorTerminal,
+                              "/restapi/monitor/term")
 
 
         logging.debug("Created API endpoint %s(%s:%d)" % (self.__class__.__name__, self.ip, self.port))
@@ -127,7 +130,11 @@ class RestApiEndpoint(object):
         logging.info("Started API endpoint @ http://%s:%d" % (self.ip, self.port))
 
     def _start_flask(self):
-        #self.app.run(self.ip, self.port, debug=True, use_reloader=False)
+        #self.app.run(self.ip, self.port, debug=False, use_reloader=False)
         #this should be a more production-fit http-server
-        http_server = WSGIServer((self.ip, self.port), self.app)
+        #self.app.logger.setLevel(logging.ERROR)
+        http_server = WSGIServer((self.ip, self.port),
+                                 self.app,
+                                 log=open("/dev/null", "w")  # This disables HTTP request logs to not mess up the CLI when e.g. the auto-updated dashboard is used
+        )
         http_server.serve_forever()