Vadims06 / topolograph

Topolograph.com is an online project which can visualize OSPF/ISIS topology based on LSDB output from a single network device. Then you can not only see (and check) the shortest path from source to destination, but also see the outcome from link or node failure along the path to the destination.
https://topolograph.com
MIT License
177 stars 23 forks source link

Add Network Reaction API #24

Closed svoropaev closed 2 years ago

svoropaev commented 2 years ago

Please add a possibility to check how topology is changing in case of link(-s) and node(-s) failure via API. Typical usage:

Vadims06 commented 2 years ago

Thank you @svoropaev for your feature request. We need to think about the result output. Regarding Link over utilisation - what the best notation of link distinguishing? Source Node Id - Destination Node Id - Cost, i.e. 10.10.10.1_10.10.10.2_100 ? If more traffic will be routed over this link the positive integer will be, if less traffic - negative. Does it make sense? An example of the output. {result: affected_links: ["10.10.10.1_10.10.10.2_100": 500, "20.20.20.1_20.20.20.2_7": -20], isGraphConnected: True, disJoinedNodes: [] } disJoinedNodes (isolated nodes) is always empty if the Graph remains connected after the node failure. But if the graph will be splited into two groups, i.e. 2 and 200 groups, both groups should be printed in isolated node list, I think both lists should be printed?

svoropaev commented 2 years ago

Hi Vadim,

Regarding "Some nodes will be isolated?" request. I guess isGraphConnected: [True, False] is a minimum which should be returned. Not connected graph is a group of connected graphs. For me it would be enough to return the groups of connected graphs. For example we had a connected graph with nodes [N1,N2,...,Nn]. Without Ni [N1,N2,...,Nn] is separated to [[N1,N2,N5], [N3,N4,N8], [Nj,...,Nk]]. If we know how graph is separated we can predict business impact.

Regarding the "Link over utilisation". It is more difficult question. We don't know from OSPF database how more traffic each pair of nodes consume over the link(-s). And we don't know a real link utilisation. But we can calculate the worst case scenario. For example in worst case if link XXX failed or node XXX failed traffic over the link a-b will be increasing twice. But it looks like a difficult math task.

Vadims06 commented 2 years ago

Hi @svoropaev , try vadims06/topolograph:2.25 image

Request:

import requests
from pprint import pprint as pp
r_post = requests.post('http://<topolograph-host>/api/network_reaction/node_failure/', auth=('   ', '    '), 
                          json={"graph_time": "25Nov2021_08h20m45s_7_hosts", "failed_nodes_list": ["10.1.1.2", "10.1.1.4"]})
pp(r_post.json())

Reply


{'affectedLinks': {'sptPathsDecreasedInPercent': {},
                   'sptPathsIncreasedInPercent': {'from': '10.1.1.1',
                                                  'to': '10.1.1.3',
                                                  'value': 60}},
 'disjointedNodes': [['10.1.123.23', '10.1.123.24'],
                     ['192.168.100.100'],
                     ['10.1.1.1', '10.1.1.3']],
 'isGraphStillConnected': False}```
svoropaev commented 2 years ago

Hi Vadim.

It looks good.

Vadims06 commented 2 years ago

@svoropaev If you don't mind - I will close this feature request.