diff --git a/poor_mans_visualisation.py b/poor_mans_visualisation.py index 3ef4365..00a5229 100755 --- a/poor_mans_visualisation.py +++ b/poor_mans_visualisation.py @@ -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