From 2857d9a07021b1a8b247d3ea77317371c5a42460 Mon Sep 17 00:00:00 2001 From: Julien Duponchelle Date: Thu, 12 May 2016 19:15:46 +0200 Subject: [PATCH] Send a field status in the node object --- gns3server/controller/node.py | 8 +++++++- gns3server/schemas/node.py | 4 ++++ tests/controller/test_node.py | 3 ++- 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/gns3server/controller/node.py b/gns3server/controller/node.py index c19b45d0..98d296c2 100644 --- a/gns3server/controller/node.py +++ b/gns3server/controller/node.py @@ -49,11 +49,16 @@ class Node: self._properties = properties self._command_line = None self._node_directory = None + self._status = "stopped" @property def id(self): return self._id + @property + def status(self): + return self._status + @property def name(self): return self._name @@ -236,5 +241,6 @@ class Node: "console": self._console, "console_type": self._console_type, "command_line": self._command_line, - "properties": self._properties + "properties": self._properties, + "status": self._status } diff --git a/gns3server/schemas/node.py b/gns3server/schemas/node.py index ba274f21..d9575adf 100644 --- a/gns3server/schemas/node.py +++ b/gns3server/schemas/node.py @@ -113,6 +113,10 @@ NODE_OBJECT_SCHEMA = { "properties": { "description": "Properties specific to an emulator", "type": "object" + }, + "status": { + "description": "Status of the node", + "enum": ["stopped", "started"] } }, "additionalProperties": False, diff --git a/tests/controller/test_node.py b/tests/controller/test_node.py index 29f88f4f..dfcfcadd 100644 --- a/tests/controller/test_node.py +++ b/tests/controller/test_node.py @@ -57,7 +57,8 @@ def test_json(node, compute): "console_type": node.console_type, "command_line": None, "node_directory": None, - "properties": node.properties + "properties": node.properties, + "status": node.status }