diff --git a/gns3server/controller/__init__.py b/gns3server/controller/__init__.py index 53518b26..d1d2f2eb 100644 --- a/gns3server/controller/__init__.py +++ b/gns3server/controller/__init__.py @@ -115,7 +115,7 @@ class Controller: controller=self, protocol=server_config.get("protocol", "http"), host=server_config.get("host", "localhost"), - port=server_config.get("port", 3080), + port=server_config.getint("port", 3080), user=server_config.get("user", ""), password=server_config.get("password", "")) return self._computes["local"] diff --git a/gns3server/controller/compute.py b/gns3server/controller/compute.py index 97cafa41..d64929ab 100644 --- a/gns3server/controller/compute.py +++ b/gns3server/controller/compute.py @@ -51,6 +51,7 @@ class Compute: self._controller = controller self._setAuth(user, password) self._session = aiohttp.ClientSession() + self._version = None # If the compute is local but the compute id is local # it's a configuration issue @@ -71,6 +72,20 @@ class Compute: else: self._auth = None + @property + def version(self): + """ + :returns: Version of compute node (string or None if not connected) + """ + return self._version + + @property + def connected(self): + """ + :returns: True if compute node is connected + """ + return self._connected + @property def id(self): """ @@ -160,6 +175,7 @@ class Compute: if "version" not in response.json: raise aiohttp.web.HTTPConflict(text="The server {} is not a GNS3 server".format(self._id)) + self._version = response.json["version"] if parse_version(__version__)[:2] != parse_version(response.json["version"])[:2]: raise aiohttp.web.HTTPConflict(text="The server {} versions are not compatible {} != {}".format(self._id, __version__, response.json["version"])) diff --git a/gns3server/templates/controller.html b/gns3server/templates/controller.html index a9064f16..871e72ce 100644 --- a/gns3server/templates/controller.html +++ b/gns3server/templates/controller.html @@ -28,11 +28,21 @@ in futur GNS3 versions.
ID + | ID | +Version | +Connected | +Protocol | +Host | +Port |
---|---|---|---|---|---|---|
{{compute.id}} | +{{compute.version}} | +{{compute.connected}} | +{{compute.protocol}} | +{{compute.host}} | +{{compute.port}} |