Skip to content

Commit 6a028aa

Browse files
committed
cleanup
1 parent 617c1b1 commit 6a028aa

9 files changed

Lines changed: 15 additions & 329 deletions

examples/baseline.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -78,9 +78,6 @@ build:
7878
dc_regions_per_metro: 1
7979
dc_region_blueprint: DCRegion
8080

81-
capacity_allocation:
82-
enabled: false
83-
8481
components:
8582
assignments:
8683
core:

examples/small_test_baseline.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,9 +63,6 @@ build:
6363
dc_regions_per_metro: 1
6464
dc_region_blueprint: DCRegion
6565

66-
capacity_allocation:
67-
enabled: false
68-
6966
tm_sizing:
7067
enabled: true
7168
matrix_name: baseline_traffic_matrix

examples/small_test_clos.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,6 @@ build:
3535
dc_regions_per_metro: 1
3636
dc_region_blueprint: DCRegion
3737

38-
capacity_allocation:
39-
enabled: false
40-
4138
tm_sizing:
4239
enabled: true
4340
matrix_name: baseline_traffic_matrix

tests/test_components_scenario_builder.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ def test_build_blueprints_section_basic(self):
116116

117117
core_group = single_router["groups"]["core"]
118118
assert "attrs" in core_group
119-
assert core_group["attrs"]["hw_component"] == "CoreRouter"
119+
assert core_group["attrs"].get("hardware", {}).get("component") == "CoreRouter"
120120

121121
def test_build_blueprints_section_with_role_assignments(self):
122122
"""Test building blueprints section uses role assignments only."""
@@ -142,9 +142,9 @@ def test_build_blueprints_section_with_role_assignments(self):
142142
spine_group = clos_blueprint["groups"]["spine"]
143143
leaf_group = clos_blueprint["groups"]["leaf"]
144144

145-
# Should use role-based components
146-
assert spine_group["attrs"]["hw_component"] == "CoreRouter"
147-
assert leaf_group["attrs"]["hw_component"] == "CoreRouter"
145+
# Should use role-based hardware mapping
146+
assert spine_group["attrs"].get("hardware", {}).get("component") == "CoreRouter"
147+
assert leaf_group["attrs"].get("hardware", {}).get("component") == "CoreRouter"
148148

149149
def test_build_blueprints_section_preserves_existing_attrs(self):
150150
"""Test that building blueprints preserves existing node attributes."""
@@ -171,8 +171,8 @@ def test_build_blueprints_section_preserves_existing_attrs(self):
171171
assert spine_group["attrs"]["role"] == "spine"
172172
assert spine_group["attrs"]["tier"] == "spine"
173173

174-
# And add new component assignment
175-
assert spine_group["attrs"]["hw_component"] == "CoreRouter"
174+
# And add new hardware assignment
175+
assert spine_group["attrs"].get("hardware", {}).get("component") == "CoreRouter"
176176

177177
def test_build_blueprints_section_unknown_blueprint(self):
178178
"""Test error when unknown blueprint is requested."""
@@ -191,9 +191,9 @@ def test_build_blueprints_section_no_role_assignment(self):
191191

192192
assert "SingleRouter" in blueprints
193193

194-
# Should not add hw_component if no assignment
194+
# Should not add hardware if no assignment
195195
core_group = blueprints["SingleRouter"]["groups"]["core"]
196-
assert "hw_component" not in core_group["attrs"]
196+
assert "hardware" not in core_group["attrs"]
197197

198198
def test_build_blueprints_section_role_inference(self):
199199
"""Test that role is correctly inferred from group name."""
@@ -208,7 +208,7 @@ def test_build_blueprints_section_role_inference(self):
208208
core_group = full_mesh["groups"]["core"]
209209

210210
# Should use default core assignment since no override
211-
assert core_group["attrs"]["hw_component"] == "CoreRouter"
211+
assert core_group["attrs"].get("hardware", {}).get("component") == "CoreRouter"
212212

213213
def test_components_section_includes_only_referenced(self):
214214
"""Test that components section includes only referenced components."""

tests/test_site_graph_sot.py

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -34,13 +34,7 @@ def test_sites_section_includes_per_site_blueprint_and_components():
3434
cfg.build.build_defaults.site_blueprint = "SingleRouter"
3535
cfg.build.build_defaults.dc_region_blueprint = "DCRegion"
3636

37-
# Provide explicit role->component assignments to be serialized per site
38-
cfg.components.hw_component = {
39-
"core": "CoreRouter",
40-
"leaf": "LeafRouter",
41-
"spine": "SpineRouter",
42-
"dc": "CoreRouter",
43-
}
37+
# Per-site assignments removed; blueprint-level hardware covers nodes
4438

4539
yaml_str = build_scenario(graph, cfg)
4640
data = yaml.safe_load(yaml_str)

topogen/config.py

Lines changed: 0 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -186,33 +186,11 @@ class BuildConfig:
186186

187187
build_defaults: BuildDefaults = field(default_factory=BuildDefaults)
188188
build_overrides: dict[str, dict[str, Any]] = field(default_factory=dict)
189-
# Capacity allocation policy
190-
# Hardware-aware capacity allocation is disabled by default for
191-
# strict backward compatibility.
192-
capacity_allocation: "BuildCapacityAllocationConfig" = field( # type: ignore[name-defined]
193-
default_factory=lambda: BuildCapacityAllocationConfig()
194-
)
195189
tm_sizing: "BuildTmSizingConfig" = field( # type: ignore[name-defined]
196190
default_factory=lambda: BuildTmSizingConfig()
197191
)
198192

199193

200-
@dataclass
201-
class BuildCapacityAllocationConfig:
202-
"""Hardware-aware capacity allocation settings.
203-
204-
When enabled, capacity allocation for dc_to_pop, intra_metro, and
205-
inter_metro links becomes aware of platform capacities. Base capacities
206-
from configuration are treated as minimums. Remaining capacity is
207-
allocated to inter-metro links in discrete increments.
208-
209-
Attributes:
210-
enabled: Turn on HW-aware allocation. Default False.
211-
"""
212-
213-
enabled: bool = False
214-
215-
216194
@dataclass
217195
class BuildTmSizingConfig:
218196
"""Traffic-matrix-based capacity sizing configuration.
@@ -626,17 +604,12 @@ def _from_dict(cls, config_dict: dict[str, Any]) -> TopologyConfig:
626604

627605
build_defaults_dict = build_dict.get("build_defaults", {})
628606
build_overrides_list = build_dict.get("build_overrides", [])
629-
capacity_alloc_dict = build_dict.get("capacity_allocation", {})
630607
tm_sizing_dict = build_dict.get("tm_sizing", {})
631608

632609
if not isinstance(build_defaults_dict, dict):
633610
raise ValueError("'build_defaults' must be a dictionary")
634611
if not isinstance(build_overrides_list, list):
635612
raise ValueError("'build_overrides' must be a list of override entries")
636-
if capacity_alloc_dict is None:
637-
capacity_alloc_dict = {}
638-
if not isinstance(capacity_alloc_dict, dict):
639-
raise ValueError("'capacity_allocation' must be a dictionary if provided")
640613
if tm_sizing_dict is None:
641614
tm_sizing_dict = {}
642615
if not isinstance(tm_sizing_dict, dict):
@@ -698,18 +671,6 @@ def _from_dict(cls, config_dict: dict[str, Any]) -> TopologyConfig:
698671
inter_metro_link=inter_metro_link,
699672
dc_to_pop_link=dc_to_pop_link,
700673
)
701-
# Capacity allocation configuration
702-
# Strictly allow only the supported key 'enabled'
703-
_allowed_ca_keys = {"enabled"}
704-
_extra_keys = set(capacity_alloc_dict.keys()) - _allowed_ca_keys
705-
if _extra_keys:
706-
raise ValueError(
707-
f"Unknown keys in 'build.capacity_allocation': {_extra_keys}. Allowed keys: {_allowed_ca_keys}"
708-
)
709-
capacity_allocation = BuildCapacityAllocationConfig(
710-
enabled=bool(capacity_alloc_dict.get("enabled", False))
711-
)
712-
713674
# TM-based sizing configuration
714675
_allowed_tm_keys = {
715676
"enabled",
@@ -792,7 +753,6 @@ def _from_dict(cls, config_dict: dict[str, Any]) -> TopologyConfig:
792753
build = BuildConfig(
793754
build_defaults=build_defaults,
794755
build_overrides=normalized_overrides,
795-
capacity_allocation=capacity_allocation,
796756
tm_sizing=tm_sizing,
797757
)
798758

topogen/metro_clusters.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -456,7 +456,7 @@ def _export_cluster_files(metro_clusters: list[MetroCluster], target_crs: str) -
456456
df = pd.DataFrame(metro_data)
457457
metro_gdf = gpd.GeoDataFrame(df)
458458
metro_gdf = metro_gdf.set_crs(target_crs)
459-
# Prefix not available here; use fixed filename for GeoJSON for backward compat
459+
# Prefix not available here; use fixed filename for GeoJSON
460460
metro_path = output_dir / "metro_clusters.geojson"
461461
if metro_gdf is not None:
462462
metro_gdf.to_file(metro_path, driver="GeoJSON")

0 commit comments

Comments
 (0)