kytos-ng / topology

Kytos Main Topology Network Application (NApp)
https://kytos-ng.github.io/api/topology.html
MIT License
0 stars 7 forks source link

bug: when handling `.*.topology.switch.interface.created` it's ignoring deactivated interfaces #186

Closed viniarck closed 6 months ago

viniarck commented 6 months ago

When handling .*.topology.switch.interface.created, it was always treating it as an interface going up, otherwise it was ignoring. Which, most of time works correctly, but, if switches lose connectivity and have interfaces down, in the next port description these interfaces are deactivated correctly, so, their state will be correct, but it won't notify as kytos/topology.link_down, and this event is important for network convergence on mef_eline.

Similarly, in this problematic state, if the interface flaps going up again, since it hasn't been previously notified as down, since we have stateful only once notifications it won't notify it as up again, so the end result is as if a kytos/topology.link_up is never sent, but the link status should be correct as UP though.

Here's how to reproduce:

kytos $> 2024-03-01 13:39:46,512 - INFO [kytos.core.atcp_server] (MainThread) Connection lost with client 127.0.0.1:44798. Reason: Request closed by client                              
2024-03-01 13:39:49,234 - INFO [kytos.core.atcp_server] (MainThread) Connection lost with client 127.0.0.1:44794. Reason: Request closed by client
2024-03-01 13:39:55,597 - INFO [uvicorn.access] (MainThread) 127.0.0.1:34422 - "GET /api/kytos/topology/v3/ HTTP/1.1" 200
kytos $>                                                                                                                                                                                 

kytos $> 2024-03-01 13:40:10,372 - INFO [kytos.core.atcp_server] (MainThread) New connection from 127.0.0.1:43026                                                                        
2024-03-01 13:40:10,412 - INFO [kytos.napps.kytos/of_core] (thread_pool_sb_4) Connection ('127.0.0.1', 43026), Switch 00:00:00:00:00:00:00:01: OPENFLOW HANDSHAKE COMPLETE
2024-03-01 13:40:10,428 - INFO [uvicorn.access] (MainThread) 127.0.0.1:39474 - "GET /api/kytos/flow_manager/v2/stored_flows?state=installed&cookie_range=12321848580485677056&cookie_rang
e=12393906174523604991&dpid=00%3A00%3A00%3A00%3A00%3A00%3A00%3A01 HTTP/1.1" 200
2024-03-01 13:40:14,744 - INFO [kytos.core.atcp_server] (MainThread) New connection from 127.0.0.1:43034
2024-03-01 13:40:14,915 - INFO [kytos.napps.kytos/of_core] (thread_pool_sb_2) Connection ('127.0.0.1', 43034), Switch 00:00:00:00:00:00:00:03: OPENFLOW HANDSHAKE COMPLETE
2024-03-01 13:40:14,932 - INFO [uvicorn.access] (MainThread) 127.0.0.1:39486 - "GET /api/kytos/flow_manager/v2/stored_flows?state=installed&cookie_range=12321848580485677056&cookie_rang
e=12393906174523604991&dpid=00%3A00%3A00%3A00%3A00%3A00%3A00%3A03 HTTP/1.1" 200
2024-03-01 13:40:17,877 - INFO [uvicorn.access] (MainThread) 127.0.0.1:42782 - "GET /api/kytos/topology/v3/ HTTP/1.1" 200
❯ sudo ovs-vsctl set-controller s3 tcp:127.0.0.1:6654

❯ sudo ovs-vsctl set-controller s1 tcp:127.0.0.1:6654

❯ sudo ifconfig s1-eth4 down  

❯ sudo ovs-vsctl set-controller s1 tcp:127.0.0.1:6653

❯ sudo ovs-vsctl set-controller s3 tcp:127.0.0.1:6653

❯ sudo ifconfig s1-eth4 up