From 84365b48ca3aafb5d7a8569946a2b8ad5176efef Mon Sep 17 00:00:00 2001 From: rchac Date: Mon, 20 Jul 2026 09:31:00 -0600 Subject: [PATCH] changes --- src/rust/lqos_topology/src/lib.rs | 2 +- src/rust/lqos_topology/src/publish.rs | 20 +++++++++++++++----- src/rust/lqos_topology/src/tests/group_01.rs | 4 ++++ src/rust/lqos_topology/src/tests/helpers.rs | 6 +++--- 4 files changed, 23 insertions(+), 9 deletions(-) diff --git a/src/rust/lqos_topology/src/lib.rs b/src/rust/lqos_topology/src/lib.rs index 649fd2a3..558eaa69 100644 --- a/src/rust/lqos_topology/src/lib.rs +++ b/src/rust/lqos_topology/src/lib.rs @@ -15,7 +15,7 @@ use lqos_config::{ TopologyEffectiveNodeState, TopologyEffectiveStateFile, TopologyQueueVisibilityPolicy, TopologyRuntimeStatusFile, TopologyShapingCircuitInput, TopologyShapingDeviceInput, TopologyShapingInputsFile, TopologyShapingResolutionSource, circuit_anchors_path, - compute_effective_network_generation, detect_shaping_cpus, plan_top_level_assignments, + compute_effective_network_file_generation, detect_shaping_cpus, plan_top_level_assignments, topology_auto_attachment_option, topology_effective_network_path, topology_effective_state_path, topology_runtime_status_path, topology_shaping_inputs_path, }; diff --git a/src/rust/lqos_topology/src/publish.rs b/src/rust/lqos_topology/src/publish.rs index 8e3e9125..e5f90ba4 100644 --- a/src/rust/lqos_topology/src/publish.rs +++ b/src/rust/lqos_topology/src/publish.rs @@ -35,11 +35,6 @@ pub fn publish_effective_topology_artifacts( let effective_state_value = serde_json::to_value(&artifacts.effective)?; let effective_network_path = topology_effective_network_path(config); - let effective_generation = artifacts - .effective_network - .as_ref() - .map(compute_effective_network_generation) - .transpose()?; let shaping_inputs_path = topology_shaping_inputs_path(config); let shaping_inputs = build_shaping_inputs(config, artifacts)?; @@ -88,6 +83,21 @@ pub fn publish_effective_topology_artifacts( })?; } + let effective_generation = if artifacts.effective_network.is_some() { + Some( + compute_effective_network_file_generation(&effective_network_path).with_context( + || { + format!( + "Unable to compute effective topology generation from {:?}", + effective_network_path + ) + }, + )?, + ) + } else { + None + }; + match prepared_shaping_inputs { Some((shaping_inputs, shaping_inputs_value)) => { let current_shaping_inputs = TopologyShapingInputsFile::load(config).ok(); diff --git a/src/rust/lqos_topology/src/tests/group_01.rs b/src/rust/lqos_topology/src/tests/group_01.rs index 5c95a7b9..37b7b7cc 100644 --- a/src/rust/lqos_topology/src/tests/group_01.rs +++ b/src/rust/lqos_topology/src/tests/group_01.rs @@ -565,6 +565,10 @@ assert!(ready.ready); assert_eq!(ready.error, None); assert!(!ready.shaping_generation.is_empty()); + let effective_network_generation = + compute_effective_network_file_generation(&topology_effective_network_path(&config)) + .expect("effective network generation should compute from published file"); + assert_eq!(ready.effective_generation, effective_network_generation); assert_eq!( ready.effective_state_path, topology_effective_state_path(&config) diff --git a/src/rust/lqos_topology/src/tests/helpers.rs b/src/rust/lqos_topology/src/tests/helpers.rs index 625573ab..7ffe6b75 100644 --- a/src/rust/lqos_topology/src/tests/helpers.rs +++ b/src/rust/lqos_topology/src/tests/helpers.rs @@ -18,9 +18,9 @@ TopologyCanonicalRateInputSource, TopologyCanonicalStateFile, TopologyEditorNode, TopologyEditorStateFile, TopologyEffectiveAttachmentState, TopologyEffectiveNodeState, TopologyEffectiveStateFile, TopologyQueueVisibilityPolicy, TopologyRuntimeStatusFile, - TopologyShapingResolutionSource, topology_auto_attachment_option as auto_attachment_option, - topology_effective_network_path, topology_effective_state_path, topology_runtime_status_path, - topology_shaping_inputs_path, + TopologyShapingResolutionSource, compute_effective_network_file_generation, + topology_auto_attachment_option as auto_attachment_option, topology_effective_network_path, + topology_effective_state_path, topology_runtime_status_path, topology_shaping_inputs_path, }; use lqos_overrides::{TopologyAttachmentMode, TopologyOverridesFile}; use serde_json::{Value, json};