Generalize the Network-as-Graph Data Model

Remember the avoid duplicate data in network automation data models challenge and the restructuring we did to represent a network as a graph.

Well, I was not happy with the end result - I hated the complexity of supporting Jinja2 templates that had to check left- and right nodes of a link, so I generalized the data structure a bit, and all of a sudden I could model stub interfaces, P2P links and multi-access networks.

keep reading

2 comments:

  1. Do I understand your OSPF type 2 LSA analogy correctly: If we have for example 4 routers connected via (broadcast) multiple access network, one would have 4 node,iflist dictionaries in a list element of the links dictionary? Or do you elect a pseudonode in such a case and change the data model?
    Also your iflist is really an ifdict, isn't it?
    Replies
    1. "If we have for example 4 routers connected via (broadcast) multiple access network, one would have 4 node,iflist dictionaries" << Correct

      "Or do you elect a pseudonode in such a case and change the data model?" << Absolutely not, OSPF needs pseudonode because in a regular graph cannot have more than two nodes attached to an edge.

      "Also your iflist is really an ifdict, isn't it?" << fair point ;)
Add comment
Sidebar