mirror of
https://github.com/GNS3/gns3-server.git
synced 2026-11-04 22:41:12 +02:00
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:
10 files changed
+311
-25
No files matched your search
@@ -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():
|
||||
"""
|
||||
|
||||
Reference in new issue
Block a user