From 460738b84f59514e3d16eb5e8843121a76c7299c Mon Sep 17 00:00:00 2001 From: Pavel 'LEdoian' Turinsky Date: Sun, 9 Jul 2023 16:43:39 +0200 Subject: [PATCH] Implement the two types of costs in TopologyV3 --- birdvisu/topo_v3.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/birdvisu/topo_v3.py b/birdvisu/topo_v3.py index 0b37175..5790299 100644 --- a/birdvisu/topo_v3.py +++ b/birdvisu/topo_v3.py @@ -205,6 +205,10 @@ class Vertex: outgoing_edges: set['Edge'] = field(default_factory=set) incoming_edges: set['Edge'] = field(default_factory=set) +class MetricType(IntEnum): + Type1 = 1 + Type2 = 2 + @dataclass(frozen=True) class Edge: """An edge of the topology. @@ -220,6 +224,8 @@ class Edge: cost: int # The network is a multigraph, so we need to know how many times to count this edge count: int + # Oh how much I would love to have this near the cost, but dataclasses said No! + metric_type: MetricType = MetricType.Type1 # Virtual links are basically an implementation detail of OSPF. # Nonetheless, it might be useful to be able to show them, so we allow # adding them to a topology.