kytos-ng / topology

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

fix: handled deactivated interface when an interface gets created. #187

Closed viniarck closed 9 months ago

viniarck commented 9 months ago

Closes #186

Summary

See updated changelog file

Local Tests

I repeated the same test mentioned on issue 186, no longer the problem happens, notice below as soon as the switch reconnects the link_down gets notified now if an interface is deactivated when a switch is disabled:

kytos $> 2024-03-01 14:18:11,771 - INFO [kytos.core.atcp_server] (MainThread) Connection lost with client 127.0.0.1:36958. Reason: Request closed by client                              
2024-03-01 14:18:16,106 - INFO [kytos.core.atcp_server] (MainThread) Connection lost with client 127.0.0.1:36962. Reason: Request closed by client
kytos $>                                                                                                                                                                                 

kytos $> 2024-03-01 14:18:23,654 - INFO [uvicorn.access] (MainThread) 127.0.0.1:42190 - "GET /api/kytos/topology/v3/ HTTP/1.1" 200                                                       
2024-03-01 14:18:54,258 - INFO [kytos.core.atcp_server] (MainThread) New connection from 127.0.0.1:47684
2024-03-01 14:18:54,676 - INFO [kytos.napps.kytos/of_core] (thread_pool_sb_14) Connection ('127.0.0.1', 47684), Switch 00:00:00:00:00:00:00:03: OPENFLOW HANDSHAKE COMPLETE
2024-03-01 14:18:54,689 - INFO [kytos.napps.kytos/mef_eline] (dynamic_single_0) Event handle_link_down Link(Interface('s1-eth4', 4, Switch('00:00:00:00:00:00:00:01')), Interface('s3-eth
3', 3, Switch('00:00:00:00:00:00:00:03')), c8b55359990f89a5849813dc348d30e9e1f991bad1dcb7f82112bd35429d9b07)
2024-03-01 14:18:54,696 - INFO [uvicorn.access] (MainThread) 127.0.0.1:51032 - "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
kytos $>                                                                                                                                                                                 

kytos $> 2024-03-01 14:19:06,516 - INFO [kytos.core.atcp_server] (MainThread) New connection from 127.0.0.1:42310                                                                        
2024-03-01 14:19:06,691 - INFO [kytos.napps.kytos/of_core] (thread_pool_sb_12) Connection ('127.0.0.1', 42310), Switch 00:00:00:00:00:00:00:01: OPENFLOW HANDSHAKE COMPLETE
2024-03-01 14:19:06,709 - INFO [uvicorn.access] (MainThread) 127.0.0.1:37638 - "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
kytos $>                                                                                                                                                                                 

kytos $> 2024-03-01 14:19:22,784 - INFO [uvicorn.access] (MainThread) 127.0.0.1:38074 - "GET /api/kytos/topology/v3/ HTTP/1.1" 200                                                       
2024-03-01 14:19:32,088 - INFO [uvicorn.access] (MainThread) 127.0.0.1:46400 - "GET /api/kytos/topology/v3/ HTTP/1.1" 200
kytos $>                                                                                                                                                                                 

kytos $> # now I'll activate s1-eth4 in the switch                                                                                                                                       

kytos $> 2024-03-01 14:20:05,237 - INFO [kytos.napps.kytos/of_core] (MainThread) PortStatus modified interface 00:00:00:00:00:00:00:01:4 state OFPPS_LIVE                                
2024-03-01 14:20:05,238 - INFO [kytos.napps.kytos/of_core] (MainThread) PortStatus modified interface 00:00:00:00:00:00:00:03:3 state OFPPS_LIVE
2024-03-01 14:20:08,244 - INFO [kytos.napps.kytos/mef_eline] (thread_pool_app_2) Event handle_link_up Link(Interface('s1-eth4', 4, Switch('00:00:00:00:00:00:00:01')), Interface('s3-eth3
', 3, Switch('00:00:00:00:00:00:00:03')), c8b55359990f89a5849813dc348d30e9e1f991bad1dcb7f82112bd35429d9b07)
kytos $>                                                                                                                                                                                 

kytos $> 2024-03-01 14:20:13,954 - INFO [uvicorn.access] (MainThread) 127.0.0.1:58222 - "GET /api/kytos/topology/v3/ HTTP/1.1" 200                                                       
kytos $>                                                                                                                                                                                 
link_flap test iteration 0
[sudo] password for viniarck: 
         waiting for 10 secs before next iteration
link_flap test iteration 1
         waiting for 10 secs before next iteration
link_flap test iteration 2
         waiting for 10 secs before next iteration
link_flap test iteration 3
         waiting for 10 secs before next iteration
link_flap test iteration 4
         waiting for 10 secs before next iteration

End-to-End Tests

Exec with this branch:

+ python3 -m pytest tests/ --reruns 2 -r fEr
============================= test session starts ==============================
platform linux -- Python 3.9.2, pytest-7.2.0, pluggy-1.4.0
rootdir: /builds/amlight/kytos-end-to-end-tester/kytos-end-to-end-tests
plugins: rerunfailures-10.2, timeout-2.1.0, anyio-3.6.2
collected 261 items
tests/test_e2e_01_kytos_startup.py ..                                    [  0%]
tests/test_e2e_05_topology.py ....................                       [  8%]
tests/test_e2e_10_mef_eline.py ..........ss.....x.....x................  [ 23%]
tests/test_e2e_11_mef_eline.py ......                                    [ 26%]
tests/test_e2e_12_mef_eline.py .....Xx.                                  [ 29%]
tests/test_e2e_13_mef_eline.py ....Xs.s.....Xs.s.XXxX.xxxx..X........... [ 44%]
.                                                                        [ 45%]
tests/test_e2e_14_mef_eline.py x                                         [ 45%]
tests/test_e2e_15_mef_eline.py .....                                     [ 47%]
tests/test_e2e_16_mef_eline.py .                                         [ 47%]
tests/test_e2e_20_flow_manager.py .....................                  [ 55%]
tests/test_e2e_21_flow_manager.py ...                                    [ 57%]
tests/test_e2e_22_flow_manager.py ...............                        [ 62%]
tests/test_e2e_23_flow_manager.py ..............                         [ 68%]
tests/test_e2e_30_of_lldp.py ....                                        [ 69%]
tests/test_e2e_31_of_lldp.py ...                                         [ 70%]
tests/test_e2e_32_of_lldp.py ...                                         [ 72%]
tests/test_e2e_40_sdntrace.py ..............                             [ 77%]
tests/test_e2e_41_kytos_auth.py ........                                 [ 80%]
tests/test_e2e_42_sdntrace.py ..                                         [ 81%]
tests/test_e2e_50_maintenance.py ............................            [ 91%]
tests/test_e2e_60_of_multi_table.py .....                                [ 93%]
tests/test_e2e_70_kytos_stats.py ........                                [ 96%]
tests/test_e2e_80_pathfinder.py ss......                                 [100%]
=============================== warnings summary ===============================
------------------------------- start/stop times -------------------------------
= 237 passed, 8 skipped, 9 xfailed, 7 xpassed, 1143 warnings in 12211.93s (3:23:31) =
viniarck commented 9 months ago

LGTM. Great you found this before we actually need it! :)

Yes, one few issue to deal with in prod later. Appreciated your review.