Create a /server API for register servers

This allow to push to the controller information about
the connection to a server.
This commit is contained in:
Julien Duponchelle committed 2016-03-03 16:05:09 +01:00
1 parent 84eb8356e8
commit aad69e9650
10 files changed
+311 -25

No files matched your search

+16
View File
@@ -22,6 +22,9 @@ from ..config import Config
class Controller:
"""The controller manage multiple gns3 servers"""
def __init__(self):
self._servers = {}
def isEnabled(self):
"""
:returns: True if current instance is the controller
@@ -29,6 +32,19 @@ class Controller:
"""
return Config.instance().get_section_config("Server").getboolean("controller")
def addServer(self, server):
"""
Add a server to the dictionnary of servers controlled by GNS3
"""
self._servers[server.id] = server
@property
def servers(self):
"""
:returns: The dictionnary of servers managed by GNS3
"""
return self._servers
@staticmethod
def instance():
"""