marker: drive uBridge enabled/pause/resume in real time

Wire gns3-server to uBridge's real-time marker controls (contract
../ubridge/doc/gns3server-integration.md §3.2), in three layers:

A. enabled reaches uBridge — _markers_for_node no longer drops disabled
   markers controller-side; it carries `enabled` in the NIO spec. apply
   installs every marker then issues `enable_packet_filter … off` for the
   disabled ones (base_node bridge / iou iol_bridge; old-ubridge errors
   downgrade to a warning so a toggle can't break link create).

B. instant per-filter toggle — apply records name→bridge so a new
   `_ubridge_set_marker_filter_state` can flip a running filter with
   `enable_packet_filter on|off` (iou overrides for iol_bridge + bay/unit).
   Each marker-capable node type gains PUT /markers/{name}; update_marker
   short-circuits to it when only `enabled` changes (no NIO rebuild, no pcap
   flush), falling back to reset+reapply if the route is unavailable.

C. global pause/resume — `_ubridge_marker_pause/resume` send `marker pause`
   / `marker resume` direct to the hypervisor (pause stops signal+pcap,
   resume instant, sink retained). Six node-type routes add POST
   /markers/pause|resume; project.pause_all/resume_all_markers fan out to
   each capture node (deduped, best-effort); REST exposes
   POST /projects/{id}/markers/pause|resume.

Toggling enabled and pause/resume are now both instant — only marker create
or a bpf change still go through reset+reapply.
This commit is contained in:
YueGuobin committed 2026-08-02 16:19:20 +08:00
1 parent 7368e4a65b
commit 3d06c4e22f
13 files changed
+404 -6

No files matched your search

+35
View File
@@ -924,6 +924,41 @@ class Project:
}
return result
async def pause_all_markers(self):
"""
Pause marker signal+pcap emission on every node hosting a marker
(``marker pause`` per capture node's uBridge). Node-deduplicated and
best-effort: a node hosting markers on several links is paused once,
and a node that is down or running an old compute is skipped.
"""
seen = set()
for link in list(self._links.values()):
for info in link.markers.values():
node_id = info.get("capture_node_id")
if not node_id or node_id in seen:
continue
seen.add(node_id)
try:
await self.get_node(node_id).post("/markers/pause")
except Exception:
pass
async def resume_all_markers(self):
"""Resume marker signal+pcap emission on every marker-hosting node."""
seen = set()
for link in list(self._links.values()):
for info in link.markers.values():
node_id = info.get("capture_node_id")
if not node_id or node_id in seen:
continue
seen.add(node_id)
try:
await self.get_node(node_id).post("/markers/resume")
except Exception:
pass
@property
def marker_definitions(self):
"""