Add initial config support for the visualisation code

Change-Id: Ib47f5f4ed94a9e5f8eb00a88d4d276c83032703e
diff --git a/config/config.py b/config/config.py
index 8b20e2b..3e77182 100644
--- a/config/config.py
+++ b/config/config.py
@@ -55,6 +55,11 @@
     def __repr__(self):
         return "<LoggingConfig: level: %s, filename: %s>" % (self.level, self.filename)
 
+class VisualisationConfigClass:
+    """ Simple container for stuff to make for nicer syntax """
+    def __repr__(self):
+        return "<VisualisationConfig: enabled: %s, port: %s>" % (self.enabled, self.port)
+
 class SwitchConfigClass:
     """ Simple container for stuff to make for nicer syntax """
     def __repr__(self):
@@ -68,6 +73,7 @@
             # Set default values
             'server': None,
             'port': None,
+            'enabled': False,
             'dbname': None,
             'username': None,
             'password': None,
@@ -100,6 +106,11 @@
         self.vland.port = 3080
         self.vland.default_vlan_tag = 1
 
+        # Visualisation is disabled by default
+        self.visualisation = VisualisationConfigClass()
+        self.visualisation.port = 3081
+        self.visualisation.enabled = False
+        
         # No switch-specific defaults to set
         self.switches = {}
 
@@ -164,7 +175,7 @@
 
             elif section == 'vland':
                 try:
-                    self.vland.port = config.getint(section, 'port')
+                    self.vland = config.getint(section, 'port')
                 except ConfigParser.NoOptionError:
                     pass
                 except:
@@ -177,6 +188,25 @@
                 except:
                     raise ConfigError('Invalid vland configuration (default_vlan_tag)')
 
+            elif section == 'visualisation':
+                try:
+                    self.visualisation.port = config.getint(section, 'port')
+                except ConfigParser.NoOptionError:
+                    pass
+                except:
+                    raise ConfigError('Invalid visualisation configuration (port)')
+
+                try:
+                    self.visualisation.enabled = config.get(section, 'enabled')
+                    if not is_positive(self.visualisation.enabled):
+                        self.visualisation.enabled = False
+                    elif is_positive(self.visualisation.enabled):
+                        self.visualisation.enabled = True
+                except ConfigParser.NoOptionError:
+                    pass
+                except:
+                    raise ConfigError('Invalid visualisation configuration (enabled)')
+
             else:
                 match = sw_regex.match(section)
                 if match: