Ask is moving to Stack Overflow and Serverfault.com! Please use the "opendaylight" tag on either of these sites. This site is now in Read-Only mode

Revision history [back]

click to hide/show revision 1
initial version

I could get the shortest path between two hosts with ODL topology REST API & Python Networkx module. I used mininet simulator and created a custom network topology with multipath.

  1. From ODL network topology REST api response, extracted hosts, switch & links details. You can even use ODL python client SDK python-odl to get the topology information

      GET http://192.168.1.124:8181/restconf/operational/network-topology:network-topology
    
  2. With the links details, i generated a Graph using python networkx module.

      import networkx as nx
      graph = nx.Graph()
      graph.add_edges_from(graph_links)
    
  3. Then by using Dijkstra's Algorithm, can find the shortest path between any two hosts in the topology

     path = nx.dijkstra_path(graph, source_node, dest_node)
    

Even we can find the list of shortest paths available for a set of hosts

     nx.all_shortest_paths(graph, source=source, target=dest)

Please share your comments on this approach.

Thanks.