Fix: 添加详细调试日志诊断拓扑连线问题

- 在拓扑构建时输出每个设备的邻居详情
- 显示邻居的RemoteIP、RemoteDevice、接口信息
- 从数据库加载设备后重建拓扑确保连线正确
- 帮助诊断为什么邻居无法自动连线
このコミットが含まれているのは:
Your Name
2026-04-26 00:33:42 +08:00
コミット e5e624d72e
2個のファイルの変更16行の追加0行の削除
+9
ファイルの表示
@@ -50,6 +50,15 @@ func (b *Builder) Build() models.TopologyGraph {
}
nodeMap[device.IP] = node
graph.Nodes = append(graph.Nodes, node)
// 调试信息
fmt.Printf("Node added: %s (%s) with %d neighbors\n",
device.IP, device.Type, len(device.Neighbors))
for i, neighbor := range device.Neighbors {
fmt.Printf(" Neighbor %d: RemoteIP=%s, RemoteDevice=%s, LocalIf=%s, RemoteIf=%s\n",
i+1, neighbor.RemoteIP, neighbor.RemoteDevice,
neighbor.LocalInterface, neighbor.RemoteInterface)
}
}
// 构建边(基于邻居信息)