Fix: 添加详细调试日志诊断拓扑连线问题
- 在拓扑构建时输出每个设备的邻居详情 - 显示邻居的RemoteIP、RemoteDevice、接口信息 - 从数据库加载设备后重建拓扑确保连线正确 - 帮助诊断为什么邻居无法自动连线
This commit is contained in:
@@ -265,6 +265,13 @@ func (app *App) handleGetDevices(w http.ResponseWriter, r *http.Request) {
|
||||
log.Printf("Error: failed to get devices from database: %v", err)
|
||||
// 降级到 builder获取
|
||||
devices = app.builder.GetDevices()
|
||||
} else {
|
||||
// 重新构建设备到builder中,确保拓扑正确
|
||||
app.builder = topology.NewBuilder()
|
||||
for _, dev := range devices {
|
||||
app.builder.AddDevice(dev)
|
||||
}
|
||||
log.Printf("Rebuilt topology with %d devices from database", len(devices))
|
||||
}
|
||||
log.Printf("Returning %d devices from storage", len(devices))
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user