Skip to content

Commit

Permalink
Fixed ability for user to track different metric keys, it was due to …
Browse files Browse the repository at this point in the history
…the addition of the GraphDataAggregator not creating new classes with the current graph_categories
  • Loading branch information
jfuruness committed Dec 14, 2024
1 parent d3ace43 commit 38e305f
Show file tree
Hide file tree
Showing 3 changed files with 56 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ def __add__(self, other: Any) -> "GraphDataAggregator":
for graph_category, data_dict in obj.data.items():
for data_point_key, percents in data_dict.items():
new_data[graph_category][data_point_key].extend(percents)
return self.__class__(data=new_data)
return self.__class__(data=new_data, graph_categories=self.graph_categories)
else:
return NotImplemented

Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"

[project]
name = "bgpy_pkg"
version = "12.1.0"
version = "12.1.1"
requires-python = ">=3.10"
description = "Simulates BGP, ROV, ASPA, etc in an extensible manner"
readme = "README.md"
Expand Down
54 changes: 54 additions & 0 deletions scripts/debug_metric_keys.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
import time
from typing import Iterable
from pathlib import Path

from bgpy.shared.enums import SpecialPercentAdoptions
from bgpy.simulation_framework import (
ScenarioConfig,
Simulation,
VictimsPrefix,
)
from bgpy.shared.enums import ASGroups, InAdoptingASNs, Outcomes, Plane
from bgpy.simulation_framework.graph_data_aggregator.graph_category import GraphCategory


def get_all_graph_categories() -> Iterable[GraphCategory]:
"""Returns all possible metric key combos"""

for plane in [Plane.DATA, Plane.CTRL]:
for as_group in [ASGroups.ALL_WOUT_IXPS, ASGroups.STUBS_OR_MH]:
for outcome in [x for x in Outcomes if x != Outcomes.UNDETERMINED]:
for in_adopting_asns_enum in list(InAdoptingASNs):
yield GraphCategory(
plane=plane,
as_group=as_group,
outcome=outcome,
in_adopting_asns=in_adopting_asns_enum,
)



def main():
"""Runs the defaults"""

# Simulation for the paper
sim = Simulation(
percent_adoptions=(
0.5,
),
scenario_configs=(
ScenarioConfig(ScenarioCls=VictimsPrefix),
),
output_dir=Path("~/Desktop/debug").expanduser(),
num_trials=1,
parse_cpus=1,
graph_categories=tuple(get_all_graph_categories()),
control_plane_tracking=True
)
sim.run()


if __name__ == "__main__":
start = time.perf_counter()
main()
print(f"{time.perf_counter() - start:.2f}s")

0 comments on commit 38e305f

Please sign in to comment.