mirror of
https://github.com/GNS3/gns3-server.git
synced 2026-11-03 05:51:15 +02:00
fix(marker): ride markers on NIO so they survive node restart and project reload
Mirror the packet-filter lifecycle: marker specs now live on the NIO (next to filters), ride in link_data from controller to compute on every NIO create/update, and are reapplied by _ubridge_apply_markers in add_ubridge_udp_connection (bridge creation / node restart) and update_ubridge_udp_connection (NIO update — following the preceding reset_packet_filters so markers survive filter changes). Changes: - NIO / NIOUDP: _markers property + asdict - schemas/compute/nios.py: UDPNIO.markers field - base_manager.create_nio: nio.markers from settings - PUT /nio routes (vpcs/qemu/docker): nio.markers update - base_node: _ubridge_apply_markers(bridge_name, nio) iterates nio.markers, computes pcap path, calls _ubridge_add_marker_filter + MarkerManager.register; called after _ubridge_apply_filters - controller udp_link: _get_node_markers + _markers_for_node (route by capture_node_id); markers in create() and update() link_data - /markers/start,stop endpoints: mirror spec onto nio.markers so the marker survives a subsequent node stop/start without a PUT - tests: add markers field to NIO data expectations This covers: - Node restart: NIO persists, add_ubridge_udp_connection re-applies - Filter update: reset wipes markers, _ubridge_apply_markers re-adds - Project reload: create() carries markers in link_data → create_nio - Immediate create: endpoint sets nio.markers immediately
This commit is contained in:
10 files changed
+123
-2
No files matched your search
@@ -294,6 +294,7 @@ async def update_docker_node_nio(
|
||||
nio.filters.clear()
|
||||
if nio_data.filters:
|
||||
nio.filters = nio_data.filters
|
||||
nio.markers = nio_data.markers or {}
|
||||
await node.adapter_update_nio_binding(adapter_number, nio)
|
||||
return nio.asdict()
|
||||
|
||||
@@ -378,6 +379,11 @@ async def start_docker_node_marker(
|
||||
MarkerManager.instance().register(
|
||||
str(project_id), node.id, marker_data.name, marker_data.link_id, marker_data.tag
|
||||
)
|
||||
nio = node.get_nio(adapter_number)
|
||||
if nio:
|
||||
nio.markers[marker_data.name] = {
|
||||
"bpf": marker_data.bpf, "tag": marker_data.tag, "link_id": marker_data.link_id
|
||||
}
|
||||
return {"pcap_file_path": str(pcap_path)}
|
||||
|
||||
|
||||
@@ -398,6 +404,9 @@ async def stop_docker_node_marker(
|
||||
|
||||
await node.stop_marker(adapter_number, marker_data.name)
|
||||
MarkerManager.instance().unregister(node.id, marker_data.name)
|
||||
nio = node.get_nio(adapter_number)
|
||||
if nio:
|
||||
nio.markers.pop(marker_data.name, None)
|
||||
|
||||
|
||||
@router.get(
|
||||
|
||||
Reference in new issue
Block a user