Skip to content

Commit

Permalink
BUGFIX: Avoid marking single-provider links as multi-provider
Browse files Browse the repository at this point in the history
Fixes #1658
  • Loading branch information
jbemmel authored Dec 16, 2024
1 parent db40372 commit f405076
Showing 1 changed file with 13 additions and 9 deletions.
22 changes: 13 additions & 9 deletions netsim/providers/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -236,17 +236,21 @@ def pre_transform(self,topology : Box) -> None:
return

for l in topology.links:
providers = {}
for intf in l.interfaces:
node = topology.nodes[intf.node]
if not 'provider' in node:
continue

p_name = topology.provider # Get primary and secondary provider
s_name = node.provider # ... to make the rest of the code more readable

l[p_name].provider[s_name] = True # Collect secondary link provider(s)
if 'uplink' in l[p_name]: # ... and copy primary uplink to secondary uplink
l[s_name].uplink = l[p_name].uplink
provider = node.get('provider',topology.provider)
providers[ provider ] = True

if len(providers)<=1:
continue # Not a multi-provider link - continue

p_name = topology.provider # Get primary and secondary provider
s_name = node.provider # ... to make the rest of the code more readable

l[p_name].provider[s_name] = True # Collect secondary link provider(s)
if 'uplink' in l[p_name]: # ... and copy primary uplink to secondary uplink
l[s_name].uplink = l[p_name].uplink

"""
Generic provider pre-output transform: remove loopback links
Expand Down

0 comments on commit f405076

Please sign in to comment.