Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: @rest endpoints are now run by starlette/uvicorn instead of flask/werkzeug #148

Merged
merged 11 commits into from
May 3, 2023

Conversation

viniarck
Copy link
Member

@viniarck viniarck commented Apr 25, 2023

Closes #142
Closes #143

This PR depends on kytos-ng/kytos#375

(I'll revert the pinned branch feat/starlette on requirements/dev.in later on, it's need for tests to pass)

Summary

Notice that requirements/dev.in is being used directly now instead of requirements/dev.txt to simplify code maintenance and house keeping, for more information check out the linked issue, in summary, we're making a trade-off to trust kytos-ng dev upstream transitive dependencies.

Local Tests

Exercised flow_manager with coloring, of_lldp, and mef_eline:

kytos $> 2023-04-25 15:13:31,370 - INFO [kytos.napps.kytos/of_core] (thread_pool_sb_2) Connection ('127.0.0.1', 57706), Switch 00:00:00:00:00:00:00:02: OPENFLOW HANDSHAKE COMPLETE       
2023-04-25 15:13:31,417 - INFO [kytos.napps.kytos/flow_manager] (AnyIO worker thread) Send FlowMod from request dpid: 00:00:00:00:00:00:00:02, command: add, force: False, flows_dict: {'f
lows': [{'priority': 1000, 'table_id': 0, 'cookie': 12321848580485677058, 'match': {'dl_type': 35020, 'dl_vlan': 3799}, 'actions': [{'action_type': 'output', 'port': 4294967293}]}]}
2023-04-25 15:13:31,421 - INFO [kytos.napps.kytos/flow_manager] (AnyIO worker thread) Send FlowMod from request dpid: 00:00:00:00:00:00:00:02, command: add, force: True, flows_dict: {'fl
ows': [{'table_id': 0, 'match': {'dl_src': 'ee:ee:ee:ee:ee:03'}, 'priority': 50000, 'actions': [{'action_type': 'output', 'port': 4294967293}], 'cookie': 12393906174523604994}, {'table_i
d': 0, 'match': {'dl_src': 'ee:ee:ee:ee:ee:01'}, 'priority': 50000, 'actions': [{'action_type': 'output', 'port': 4294967293}], 'cookie': 12393906174523604994}], 'force': True}
2023-04-25 15:13:31,426 - INFO [uvicorn.access] (ThreadPoolExecutor-1_0) 127.0.0.1:44226 - "POST /api/kytos/flow_manager/v2/flows/00%3A00%3A00%3A00%3A00%3A00%3A00%3A02 HTTP/1.1" 202
2023-04-25 15:13:31,439 - INFO [uvicorn.access] (ThreadPoolExecutor-1_0) 127.0.0.1:44220 - "POST /api/kytos/flow_manager/v2/flows/00%3A00%3A00%3A00%3A00%3A00%3A00%3A02 HTTP/1.1" 202
2023-04-25 15:13:40,381 - 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')))
2023-04-25 15:13:40,385 - INFO [uvicorn.access] (ThreadPoolExecutor-1_0) 127.0.0.1:56646 - "GET /api/kytos/topology/v3/links HTTP/1.1" 200
2023-04-25 15:13:41,478 - INFO [kytos.napps.kytos/mef_eline] (thread_pool_app_7) Event handle_link_up Link(Interface('s1-eth3', 3, Switch('00:00:00:00:00:00:00:01')), Interface('s2-eth2'
, 2, Switch('00:00:00:00:00:00:00:02')))
2023-04-25 15:13:41,488 - INFO [kytos.napps.kytos/mef_eline] (thread_pool_app_0) Event handle_link_up Link(Interface('s2-eth3', 3, Switch('00:00:00:00:00:00:00:02')), Interface('s3-eth2'
, 2, Switch('00:00:00:00:00:00:00:03')))
2023-04-25 15:13:41,493 - INFO [uvicorn.access] (ThreadPoolExecutor-1_0) 127.0.0.1:56650 - "GET /api/kytos/topology/v3/links HTTP/1.1" 200
2023-04-25 15:13:41,502 - INFO [uvicorn.access] (ThreadPoolExecutor-1_0) 127.0.0.1:56666 - "GET /api/kytos/topology/v3/links HTTP/1.1" 200
2023-04-25 15:14:27,156 - INFO [uvicorn.access] (ThreadPoolExecutor-1_0) 127.0.0.1:48566 - "GET /api/kytos/flow_manager/v2/stored_flows/?state=installed HTTP/1.1" 200
2023-04-25 15:14:27,161 - INFO [uvicorn.access] (ThreadPoolExecutor-1_0) 127.0.0.1:48562 - "PUT /api/amlight/sdntrace_cp/v1/traces HTTP/1.1" 200
2023-04-25 15:14:27,163 - INFO [kytos.napps.kytos/mef_eline] (mef_eline) EVC(40d9cde9f6d74b, epl) enabled but inactive - activating
kytos $>                                                                                                                                                                                  

kytos $> 2023-04-25 15:15:25,411 - INFO [kytos.napps.kytos/flow_manager] (AnyIO worker thread) Send FlowMod from request dpid: 00:00:00:00:00:00:00:01, command: add, force: False, flows_
dict: {'force': False, 'flows': [{'priority': 55000, 'cookie': 100, 'match': {'in_port': 1, 'dl_vlan': 222}, 'actions': [{'action_type': 'output', 'port': 2}]}]}
2023-04-25 15:15:25,425 - INFO [uvicorn.access] (ThreadPoolExecutor-1_0) 127.0.0.1:40474 - "POST /api/kytos/flow_manager/v2/flows/00%3A00%3A00%3A00%3A00%3A00%3A00%3A01 HTTP/1.1" 202
kytos $>                                                                                                                                                                                  

kytos $> 2023-04-25 15:15:50,749 - INFO [uvicorn.access] (ThreadPoolExecutor-1_0) 127.0.0.1:58072 - "GET /api/kytos/flow_manager/v2/stored_flows?dpid=00:00:00:00:00:00:00:01&cookie_range
=[1,2]&state=installed HTTP/1.1" 400
2023-04-25 15:15:54,036 - INFO [uvicorn.access] (ThreadPoolExecutor-1_0) 127.0.0.1:58072 - "GET /api/kytos/flow_manager/v2/stored_flows?dpid=00:00:00:00:00:00:00:01&cookie_range=[1,2]&st
ate=installed HTTP/1.1" 400
2023-04-25 15:16:12,991 - INFO [uvicorn.access] (ThreadPoolExecutor-1_0) 127.0.0.1:57594 - "GET /api/kytos/flow_manager/v2/stored_flows?dpid=00:00:00:00:00:00:00:01&cookie_range=1&state=
installed HTTP/1.1" 400
2023-04-25 15:16:20,247 - INFO [uvicorn.access] (ThreadPoolExecutor-1_0) 127.0.0.1:57596 - "GET /api/kytos/flow_manager/v2/stored_flows?dpid=00:00:00:00:00:00:00:01&cookie_range=1&state=
installed&cookie_range=2 HTTP/1.1" 200
2023-04-25 15:16:25,129 - INFO [uvicorn.access] (ThreadPoolExecutor-1_0) 127.0.0.1:57596 - "GET /api/kytos/flow_manager/v2/stored_flows?dpid=00:00:00:00:00:00:00:01&cookie_range=1&state=
installed&cookie_range=100 HTTP/1.1" 200
2023-04-25 15:16:33,446 - INFO [uvicorn.access] (ThreadPoolExecutor-1_0) 127.0.0.1:41738 - "GET /api/kytos/flow_manager/v2/stored_flows?dpid=00:00:00:00:00:00:00:01&cookie_range=1&state=
installedx&cookie_range=100 HTTP/1.1" 200
2023-04-25 15:16:35,029 - INFO [uvicorn.access] (ThreadPoolExecutor-1_0) 127.0.0.1:41738 - "GET /api/kytos/flow_manager/v2/stored_flows?dpid=00:00:00:00:00:00:00:01&cookie_range=1&state=
installed&cookie_range=100 HTTP/1.1" 200

End-to-End Tests

e2e tests with this PR and related starlette PRs can be found here, they're passing

@viniarck viniarck requested a review from a team as a code owner April 25, 2023 18:23
@viniarck viniarck marked this pull request as draft April 25, 2023 18:23
requirements/dev.in Outdated Show resolved Hide resolved
@viniarck viniarck marked this pull request as ready for review May 1, 2023 15:42
@viniarck viniarck merged commit af7f8c9 into master May 3, 2023
@viniarck viniarck deleted the chore/starlette branch May 3, 2023 18:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant