mirror of
https://github.com/LibreQoE/LibreQoS.git
synced 2025-02-25 18:55:32 -06:00
More depth tweaking
This commit is contained in:
parent
2cfd1f90b7
commit
d1b9b4e02a
@ -25,7 +25,7 @@ use crate::strategies::full::squash_single_entry_aps::squash_single_aps;
|
|||||||
use crate::strategies::full::tree_walk::walk_tree_for_routing;
|
use crate::strategies::full::tree_walk::walk_tree_for_routing;
|
||||||
use crate::strategies::full::uisp_fetch::load_uisp_data;
|
use crate::strategies::full::uisp_fetch::load_uisp_data;
|
||||||
use crate::strategies::full::utils::{print_sites, warn_of_no_parents};
|
use crate::strategies::full::utils::{print_sites, warn_of_no_parents};
|
||||||
use crate::uisp_types::UispSite;
|
use crate::uisp_types::{UispSite, UispSiteType};
|
||||||
pub use bandwidth_overrides::BandwidthOverrides;
|
pub use bandwidth_overrides::BandwidthOverrides;
|
||||||
use lqos_config::Config;
|
use lqos_config::Config;
|
||||||
|
|
||||||
@ -57,6 +57,24 @@ pub async fn build_full_network(
|
|||||||
// Set the site root
|
// Set the site root
|
||||||
set_root_site(&mut sites, &root_site)?;
|
set_root_site(&mut sites, &root_site)?;
|
||||||
|
|
||||||
|
// Create a new "_Infrastructure" node for the parent, since we can't link to the top
|
||||||
|
// level very easily
|
||||||
|
if let Some(root_idx) = sites.iter().position(|s| s.name == root_site) {
|
||||||
|
sites.push(UispSite {
|
||||||
|
id: format!("{}_Infrastructure", sites[root_idx].name.clone()),
|
||||||
|
name: format!("{}_Infrastructure", sites[root_idx].name.clone()),
|
||||||
|
site_type: UispSiteType::Site,
|
||||||
|
uisp_parent_id: None,
|
||||||
|
parent_indices: Default::default(),
|
||||||
|
max_down_mbps: sites[root_idx].max_down_mbps,
|
||||||
|
max_up_mbps: sites[root_idx].max_down_mbps,
|
||||||
|
suspended: false,
|
||||||
|
device_indices: vec![],
|
||||||
|
route_weights: vec![],
|
||||||
|
selected_parent: Some(root_idx),
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
// Search for devices that provide links elsewhere
|
// Search for devices that provide links elsewhere
|
||||||
promote_access_points(
|
promote_access_points(
|
||||||
&mut sites,
|
&mut sites,
|
||||||
|
@ -32,7 +32,7 @@ pub fn write_shaped_devices(
|
|||||||
let mut shaped_devices = Vec::new();
|
let mut shaped_devices = Vec::new();
|
||||||
|
|
||||||
// Traverse
|
// Traverse
|
||||||
traverse(sites, root_idx, 0, devices, &mut shaped_devices, config);
|
traverse(sites, root_idx, 0, devices, &mut shaped_devices, config, root_idx);
|
||||||
|
|
||||||
// Write the CSV
|
// Write the CSV
|
||||||
let mut writer = csv::WriterBuilder::new()
|
let mut writer = csv::WriterBuilder::new()
|
||||||
@ -60,6 +60,7 @@ fn traverse(
|
|||||||
devices: &[UispDevice],
|
devices: &[UispDevice],
|
||||||
shaped_devices: &mut Vec<ShapedDevice>,
|
shaped_devices: &mut Vec<ShapedDevice>,
|
||||||
config: &Config,
|
config: &Config,
|
||||||
|
root_idx: usize,
|
||||||
) {
|
) {
|
||||||
if !sites[idx].device_indices.is_empty() {
|
if !sites[idx].device_indices.is_empty() {
|
||||||
// We have devices!
|
// We have devices!
|
||||||
@ -102,6 +103,11 @@ fn traverse(
|
|||||||
// It's an infrastructure node
|
// It's an infrastructure node
|
||||||
for device in sites[idx].device_indices.iter() {
|
for device in sites[idx].device_indices.iter() {
|
||||||
let device = &devices[*device];
|
let device = &devices[*device];
|
||||||
|
let parent_node = if idx != root_idx {
|
||||||
|
sites[idx].name.clone()
|
||||||
|
} else {
|
||||||
|
format!("{}_Infrastructure", sites[idx].name.clone())
|
||||||
|
};
|
||||||
if device.has_address() {
|
if device.has_address() {
|
||||||
let download_max = (sites[idx].max_down_mbps as f32
|
let download_max = (sites[idx].max_down_mbps as f32
|
||||||
* config.uisp_integration.bandwidth_overhead_factor)
|
* config.uisp_integration.bandwidth_overhead_factor)
|
||||||
@ -120,7 +126,7 @@ fn traverse(
|
|||||||
circuit_name: format!("{} Infrastructure", sites[idx].name),
|
circuit_name: format!("{} Infrastructure", sites[idx].name),
|
||||||
device_id: device.id.clone(),
|
device_id: device.id.clone(),
|
||||||
device_name: device.name.clone(),
|
device_name: device.name.clone(),
|
||||||
parent_node: sites[idx].name.clone(),
|
parent_node,
|
||||||
mac: device.mac.clone(),
|
mac: device.mac.clone(),
|
||||||
ipv4: device.ipv4_list(),
|
ipv4: device.ipv4_list(),
|
||||||
ipv6: device.ipv6_list(),
|
ipv6: device.ipv6_list(),
|
||||||
@ -136,11 +142,11 @@ fn traverse(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if depth < 8 {
|
if depth < 10 {
|
||||||
for (child_idx, child) in sites.iter().enumerate() {
|
for (child_idx, child) in sites.iter().enumerate() {
|
||||||
if let Some(parent_idx) = child.selected_parent {
|
if let Some(parent_idx) = child.selected_parent {
|
||||||
if parent_idx == idx {
|
if parent_idx == idx {
|
||||||
traverse(sites, child_idx, depth + 1, devices, shaped_devices, config);
|
traverse(sites, child_idx, depth + 1, devices, shaped_devices, config, root_idx);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user