If configured, start the visualisation server too
Change-Id: Ia97c0876ef006af1f4aac9e27019c8e982ad4224
diff --git a/vland.py b/vland.py
index 5410831..05699eb 100755
--- a/vland.py
+++ b/vland.py
@@ -32,6 +32,7 @@
from ipc.ipc import VlanIpc
from errors import InputError, SocketError
from util import VlanUtil
+from visualisation.visualisation import Visualisation
class DaemonState:
""" Simple container for stuff to make for nicer syntax """
@@ -40,6 +41,10 @@
state.version = "0.4-DEV"
state.banner = "Linaro VLANd version %s" % state.version
state.starttime = time.time()
+state.vis = None
+
+os.environ['TZ'] = 'UTC'
+time.tzset()
print '%s' % state.banner
@@ -47,6 +52,9 @@
state.config = VlanConfig(filenames=('./vland.cfg',))
print ' Config knows about %d switches' % len(state.config.switches)
+if state.config.visualisation.enabled:
+ state.vis = Visualisation(state)
+
util = VlanUtil()
print 'Connecting to DB...'
@@ -213,6 +221,9 @@
# We've been asked to shut down. Do that as cleanly as we can
ipc.server_close()
+if state.config.visualisation.enabled:
+ state.vis.shutdown()
+
logging.info('%s shutting down', state.banner)
switches = state.db.all_switches()
logging.info(' DB knows about %d switches', len(switches))