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

feat: basic validation for cookie and cookie_mask when installing or removing flows. #151

Merged
merged 6 commits into from
May 12, 2023

Conversation

viniarck
Copy link
Member

@viniarck viniarck commented May 11, 2023

Closes #146
Closes #91

Summary

See updated changelog file

Local Tests

  • Created one EVC, simulated link down and EVC removal:
kytos $> 2023-05-11 14:53:20,132 - INFO [uvicorn.access] [httptools_impl.py:506:send] (MainThread) 127.0.0.1:46284 - "POST /api/kytos/mef_eline/v2/evc/ HTTP/1.1" 400                    
2023-05-11 14:56:05,093 - INFO [kytos.napps.kytos/mef_eline] [evc.py:805:setup_failover_path] (thread_pool_app_4) Failover path for EVC(c96386c0dfe243, epl) was deployed.

2023-05-11 14:56:40,654 - INFO [kytos.napps.kytos/mef_eline] [main.py:706:handle_link_down] (thread_pool_app_2) Event handle_link_down Link(Interface('s1-eth4', 4, Switch('00:00:00:00:0
0:00:00:01')), Interface('s3-eth3', 3, Switch('00:00:00:00:00:00:00:03')))
2023-05-11 14:56:40,655 - INFO [kytos.napps.kytos/flow_manager] [main.py:558:handle_flows_install_delete] (thread_pool_app_9) Send FlowMod from KytosEvent dpid: 00:00:00:00:00:00:00:01,
 command: add, force: False, flows_dict: {'flows': [{'match': {'in_port': 1}, 'cookie': 12306476887179256387, 'actions': [{'action_type': 'push_vlan', 'tag_type': 's'}, {'action_type': 
'set_vlan', 'vlan_id': 2}, {'action_type': 'output', 'port': 3}], 'owner': 'mef_eline', 'table_group': 'epl', 'table_id': 0, 'priority': 10000}]}
2023-05-11 14:56:40,657 - INFO [kytos.napps.kytos/flow_manager] [main.py:558:handle_flows_install_delete] (thread_pool_app_7) Send FlowMod from KytosEvent dpid: 00:00:00:00:00:00:00:03,
 command: add, force: False, flows_dict: {'flows': [{'match': {'in_port': 1}, 'cookie': 12306476887179256387, 'actions': [{'action_type': 'push_vlan', 'tag_type': 's'}, {'action_type': 
'set_vlan', 'vlan_id': 2}, {'action_type': 'output', 'port': 2}], 'owner': 'mef_eline', 'table_group': 'epl', 'table_id': 0, 'priority': 10000}]}
2023-05-11 14:56:41,169 - INFO [kytos.napps.kytos/mef_eline] [main.py:756:handle_link_down] (thread_pool_app_2) EVC(c96386c0dfe243, epl) redeployed with failover due to link down c8b553
59990f89a5849813dc348d30e9e1f991bad1dcb7f82112bd35429d9b07

End-to-End Tests

============================= test session starts ==============================
platform linux -- Python 3.9.2, pytest-7.2.0, pluggy-1.0.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 227 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................  [ 26%]
tests/test_e2e_11_mef_eline.py ......                                    [ 29%]
tests/test_e2e_12_mef_eline.py .....Xx.                                  [ 32%]
tests/test_e2e_13_mef_eline.py .....xs.s......xs.s.XXxX.xxxx..X......... [ 50%]
...                                                                      [ 51%]
tests/test_e2e_14_mef_eline.py x                                         [ 52%]
tests/test_e2e_15_mef_eline.py ..                                        [ 53%]
tests/test_e2e_20_flow_manager.py .....................                  [ 62%]
tests/test_e2e_21_flow_manager.py ...                                    [ 63%]
tests/test_e2e_22_flow_manager.py ...............                        [ 70%]
tests/test_e2e_23_flow_manager.py ..............                         [ 76%]
tests/test_e2e_30_of_lldp.py ....                                        [ 78%]
tests/test_e2e_31_of_lldp.py ...                                         [ 79%]
tests/test_e2e_32_of_lldp.py ...                                         [ 81%]
tests/test_e2e_40_sdntrace.py ...........                                [ 85%]
tests/test_e2e_41_kytos_auth.py ........                                 [ 89%]
tests/test_e2e_50_maintenance.py ........................                [100%]
=============================== warnings summary ===============================
= 205 passed, 6 skipped, 11 xfailed, 5 xpassed, 799 warnings in 10615.20s (2:56:55) =

@viniarck viniarck requested a review from a team as a code owner May 11, 2023 18:05
log.error(msg)
return

try:
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This isn't still full-blown error handling, eventually once issue #73 is address we'll start propagating it back, however since the event-oriented interface is primarily used by other NApps only and typically the payloads are passed by a developer and not from an external interface then it's a very controlled case. So, living with it as it is, it's fine for now.

@viniarck viniarck merged commit a7762d1 into master May 12, 2023
@viniarck viniarck deleted the feat/cookie_basic_validation branch May 12, 2023 18:23
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