Set a better(?) fallback for unusable BIRD.

topo-mov
LEdoian 1 year ago
parent 722961d128
commit 87935c7e3a

@ -12,10 +12,22 @@ if len(sys.argv) > 1:
ref_topo = OspfFileTopologyProvider(ref_topo_file).get_topology()
try:
cur_topo = BirdSocketTopologyProvider(instance='ospf1', area=0).get_topology()
except OSError as e:
raise NotImplementedError('Cannot create a mock topology atm') from e
def get_empty_topology():
from birdvisu.topo_v3 import TopologyV3
topo = TopologyV3()
topo.freeze()
return topo
if len(sys.argv) > 2 and sys.argv[2] == '--no-bird':
cur_topo = get_empty_topology()
else:
try:
cur_topo = BirdSocketTopologyProvider(instance='ospf1', area=0).get_topology()
except OSError as e:
# I know this is not how you print exceptions.
print('Cannot get topology from BIRD: {e}')
print('Will provide an empty topology.')
cur_topo = get_empty_topology()
# Create combined topology

Loading…
Cancel
Save