mirror of
https://github.com/LibreQoE/LibreQoS.git
synced 2026-10-25 22:30:05 -05:00
changes
This commit is contained in:
1 parent
935e22a3d9
commit
1bf4f62e81
14 files changed
+150
-9
No files matched your search
@@ -96,8 +96,8 @@ pub use topology_runtime_state::{
|
||||
TopologyEffectiveNodeState, TopologyEffectiveStateFile, TopologyRuntimeShapingPayloadIdentity,
|
||||
TopologyRuntimeStateError, TopologyRuntimeStatusFile, TopologyShapingCircuitInput,
|
||||
TopologyShapingDeviceInput, TopologyShapingInputsFile, TopologyShapingResolutionSource,
|
||||
active_runtime_shaping_inputs_path, compute_effective_network_generation,
|
||||
active_runtime_shaping_inputs_path_from_status, compute_topology_source_generation,
|
||||
active_runtime_shaping_inputs_path, active_runtime_shaping_inputs_path_from_status,
|
||||
compute_effective_network_generation, compute_topology_source_generation,
|
||||
load_active_runtime_shaping_inputs, load_active_runtime_shaping_inputs_from_status,
|
||||
topology_attachment_health_state_path, topology_compiled_shaping_path,
|
||||
topology_effective_network_path, topology_effective_state_path, topology_import_path,
|
||||
|
||||
@@ -37,6 +37,8 @@ pub enum TopologyCanonicalIngressKind {
|
||||
pub enum TopologyCanonicalRateInputSource {
|
||||
/// The canonical node rate input came from the richest available attachment metadata.
|
||||
AttachmentMax,
|
||||
/// The canonical node rate input came from an operator-saved rate override.
|
||||
OperatorOverride,
|
||||
/// The canonical node rate input came from an imported legacy `network.json`.
|
||||
ImportedNetworkJson,
|
||||
/// The canonical node rate input came from the compatibility export tree.
|
||||
|
||||
@@ -4571,6 +4571,50 @@ mod tests {
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn native_operator_override_rates_still_cap_nodes() {
|
||||
let mut root = sample_effective_bandwidth_tree();
|
||||
let canonical = TopologyCanonicalStateFile {
|
||||
ingress_kind: TopologyCanonicalIngressKind::NativeIntegration,
|
||||
nodes: vec![
|
||||
canonical_node_with_rate_source(
|
||||
"site-hoodoo",
|
||||
"Hoodoo Hill",
|
||||
774,
|
||||
774,
|
||||
TopologyCanonicalRateInputSource::AttachmentMax,
|
||||
),
|
||||
canonical_node_with_rate_source(
|
||||
"ap-thunderhill",
|
||||
"HoodooHill-Thunderhill",
|
||||
300,
|
||||
300,
|
||||
TopologyCanonicalRateInputSource::OperatorOverride,
|
||||
),
|
||||
],
|
||||
..Default::default()
|
||||
};
|
||||
|
||||
super::recompile_effective_network_bandwidths(
|
||||
&mut root,
|
||||
&canonical,
|
||||
&TopologyEditorStateFile::default(),
|
||||
&TopologyEffectiveStateFile::default(),
|
||||
);
|
||||
|
||||
let ap = root["Hoodoo Hill"]["children"]["HoodooHill-Thunderhill"]
|
||||
.as_object()
|
||||
.expect("AP node should exist");
|
||||
assert_eq!(
|
||||
super::node_bandwidth_mbps(ap, "downloadBandwidthMbps"),
|
||||
Some(300)
|
||||
);
|
||||
assert_eq!(
|
||||
super::node_bandwidth_mbps(ap, "uploadBandwidthMbps"),
|
||||
Some(300)
|
||||
);
|
||||
}
|
||||
|
||||
fn write_runtime_json_fixture(path: PathBuf, value: &Value, label: &str) {
|
||||
let parent = path
|
||||
.parent()
|
||||
|
||||
+1
-1
@@ -1070,7 +1070,7 @@ def apply_network_adjustments_to_canonical_state(canonical_state: dict, adjustme
|
||||
rate_input['legacy_imported_upload_mbps'] = normalized_upload
|
||||
nodes_changed = True
|
||||
if download is not None or upload is not None:
|
||||
rate_input['source'] = 'compatibility_export'
|
||||
rate_input['source'] = 'operator_override'
|
||||
elif adj_type == 'set_node_virtual':
|
||||
target_name = adj.get('node_name', '')
|
||||
virtual_val = adj.get('virtual', None)
|
||||
|
||||
@@ -1525,6 +1525,10 @@ class TestSchedulerOverrideMerge(unittest.TestCase):
|
||||
mock_write_network.assert_not_called()
|
||||
mock_write_sd.assert_not_called()
|
||||
mock_write_canonical.assert_called_once()
|
||||
rate_input = canonical_state["nodes"][0]["rate_input"]
|
||||
self.assertEqual(rate_input["source"], "operator_override")
|
||||
self.assertEqual(rate_input["intrinsic_download_mbps"], 80)
|
||||
self.assertEqual(rate_input["intrinsic_upload_mbps"], 40)
|
||||
|
||||
def test_override_devices_to_rows_preserves_anchor_node_id(self):
|
||||
header = [
|
||||
|
||||
Reference in new issue
Block a user