diff --git a/gns3server/controller/link.py b/gns3server/controller/link.py index dbfb1cfa..432dfc99 100644 --- a/gns3server/controller/link.py +++ b/gns3server/controller/link.py @@ -27,6 +27,7 @@ class Link: self._vms = [] self._project = project self._data_link_type = data_link_type + self._capturing = False @asyncio.coroutine def addVM(self, vm, adapter_number, port_number): @@ -86,6 +87,10 @@ class Link: def id(self): return self._id + @property + def capturing(self): + return self._capturing + def __json__(self): res = [] for side in self._vms: @@ -94,4 +99,4 @@ class Link: "adapter_number": side["adapter_number"], "port_number": side["port_number"] }) - return {"vms": res, "link_id": self._id} + return {"vms": res, "link_id": self._id, "capturing": self._capturing} diff --git a/gns3server/controller/udp_link.py b/gns3server/controller/udp_link.py index 1ff91ef3..854ea931 100644 --- a/gns3server/controller/udp_link.py +++ b/gns3server/controller/udp_link.py @@ -90,6 +90,7 @@ class UDPLink(Link): "data_link_type": data_link_type } yield from self._capture_vm["vm"].post("/adapters/{adapter_number}/ports/{port_number}/start_capture".format(adapter_number=self._capture_vm["adapter_number"], port_number=self._capture_vm["port_number"]), data=data) + self._capturing = True @asyncio.coroutine def stop_capture(self): @@ -99,6 +100,7 @@ class UDPLink(Link): if self._capture_vm: yield from self._capture_vm["vm"].post("/adapters/{adapter_number}/ports/{port_number}/stop_capture".format(adapter_number=self._capture_vm["adapter_number"], port_number=self._capture_vm["port_number"])) self._capture_vm = None + self._capturing = False def _choose_capture_side(self): """ diff --git a/gns3server/schemas/link.py b/gns3server/schemas/link.py index f344852a..4d0db2f1 100644 --- a/gns3server/schemas/link.py +++ b/gns3server/schemas/link.py @@ -53,7 +53,11 @@ LINK_OBJECT_SCHEMA = { "required": ["vm_id", "adapter_number", "port_number"], "additionalProperties": False } - } + }, + "capturing": { + "description": "Read only propertie. Is a capture running on the link", + "type": "boolean" + }, }, "required": ["vms"], "additionalProperties": False diff --git a/gns3server/templates/project.html b/gns3server/templates/project.html index f493e411..17ebb7f7 100644 --- a/gns3server/templates/project.html +++ b/gns3server/templates/project.html @@ -42,10 +42,12 @@ in futur GNS3 versions.
ID + | Capture | |
---|---|---|
{{link.id}} | +{{link.id}} | +{{link.capturing}} |