fabric-testbed / InformationModel

FABRIC Information Model library
MIT License
7 stars 1 forks source link

Issue with drawing aggregate topologies #105

Closed ibaldin closed 2 years ago

ibaldin commented 2 years ago

Per @kthare10 I am occasionally observing the following exception when drawing the AdvertisedTopology in JupyertNotebook.

IndexError                                Traceback (most recent call last)
/tmp/ipykernel_311/631881169.py in <module>
      1 if status == Status.OK:
----> 2     advertised_topology.draw()

/opt/conda/lib/python3.9/site-packages/fim/user/topology.py in draw(self, file_name, interactive, topo_detail, layout)
    868             edge_labels = dict()
    869             for k, v in graph_edges.items():
--> 870                 derived_graph.add_edge(v[0], v[1])
    871                 #edge_labels[(v[0], v[1])] = k
    872                 edge_labels[(v[0], v[1])] = ""

IndexError: list index out of range

The likely cause is query ordering in NetworkX.

ibaldin commented 2 years ago

The issue is the interfaces property (list_interfaces) methods return dicts, whcih may have collisions on interface names that are repeated. For now fixed by using interface_list properties and methods which return a list instead. In the future it is possible that interfaces property needs to be deprecated as there is no good way to deal with collisions.