mirror of
https://github.com/LibreQoE/LibreQoS.git
synced 2025-02-25 18:55:32 -06:00
Correct traversal depth
This commit is contained in:
parent
0328bc10a3
commit
2cfd1f90b7
@ -18,13 +18,15 @@ pub fn write_network_file(
|
||||
|
||||
// Write the network JSON file
|
||||
let root = traverse_sites(sites, root_idx, 0)?;
|
||||
let json = serde_json::to_string_pretty(&root).unwrap();
|
||||
write(network_path, &json).map_err(|e| {
|
||||
error!("Unable to write network.json");
|
||||
error!("{e:?}");
|
||||
UispIntegrationError::WriteNetJson
|
||||
})?;
|
||||
info!("Written network.json");
|
||||
if let Some(children) = root.get("children") {
|
||||
let json = serde_json::to_string_pretty(&children).unwrap();
|
||||
write(network_path, &json).map_err(|e| {
|
||||
error!("Unable to write network.json");
|
||||
error!("{e:?}");
|
||||
UispIntegrationError::WriteNetJson
|
||||
})?;
|
||||
info!("Written network.json");
|
||||
}
|
||||
|
||||
Ok(())
|
||||
}
|
||||
@ -48,7 +50,7 @@ fn traverse_sites(
|
||||
_ => "site",
|
||||
};
|
||||
|
||||
if depth < 2 {
|
||||
if depth < 10 {
|
||||
let mut children = serde_json::Map::new();
|
||||
for (child_id, child) in sites.iter().enumerate() {
|
||||
if let Some(parent) = child.selected_parent {
|
||||
|
@ -85,7 +85,7 @@ fn traverse(
|
||||
circuit_name: sites[idx].name.clone(),
|
||||
device_id: device.id.clone(),
|
||||
device_name: device.name.clone(),
|
||||
parent_node: sites[idx].name.clone(),
|
||||
parent_node: sites[sites[idx].selected_parent.unwrap()].name.clone(),
|
||||
mac: device.mac.clone(),
|
||||
ipv4: device.ipv4_list(),
|
||||
ipv6: device.ipv6_list(),
|
||||
|
Loading…
Reference in New Issue
Block a user