Implement the two types of costs in TopologyV3

styling
LEdoian 1 year ago
parent 2ae6c5a44b
commit 460738b84f

@ -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.

Loading…
Cancel
Save