kytos-ng / kytos

Kytos SDN Platform. Kytos is designed to be easy to install, use, develop and share Network Apps (NApps).
https://kytos-ng.github.io/
MIT License
3 stars 7 forks source link

Changed KytosEvent into a dataclass with type annotations #403

Closed Ktmi closed 6 months ago

Ktmi commented 1 year ago

Summary

This converts KytosEvent into a dataclass with type annotations. Additionally it changes it so that it is now considered a bug for an event to not have a name set.

Local Tests

Seems to work correctly. Can create evcs and have them interrupted by maintenance windows.

End To End Tests

These seem to fail pretty badly, and I don't understand what's going on here.

kytos-end-to-end-tests-kytos-1  | Starting enhanced syslogd: rsyslogd.
kytos-end-to-end-tests-kytos-1  | /etc/openvswitch/conf.db does not exist ... (warning).
kytos-end-to-end-tests-kytos-1  | Creating empty database /etc/openvswitch/conf.db.
kytos-end-to-end-tests-kytos-1  | Starting ovsdb-server.
kytos-end-to-end-tests-kytos-1  | Configuring Open vSwitch system IDs.
kytos-end-to-end-tests-kytos-1  | Starting ovs-vswitchd.
kytos-end-to-end-tests-kytos-1  | Enabling remote OVSDB managers.
kytos-end-to-end-tests-kytos-1  | + sed -i 's/STATS_INTERVAL = 60/STATS_INTERVAL = 7/g' /var/lib/kytos/napps/kytos/of_core/settings.py
kytos-end-to-end-tests-kytos-1  | + sed -i 's/CONSISTENCY_MIN_VERDICT_INTERVAL =.*/CONSISTENCY_MIN_VERDICT_INTERVAL = 60/g' /var/lib/kytos/napps/kytos/flow_manager/settings.py
kytos-end-to-end-tests-kytos-1  | + sed -i 's/LINK_UP_TIMER = 10/LINK_UP_TIMER = 1/g' /var/lib/kytos/napps/kytos/topology/settings.py
kytos-end-to-end-tests-kytos-1  | + sed -i 's/DEPLOY_EVCS_INTERVAL = 60/DEPLOY_EVCS_INTERVAL = 5/g' /var/lib/kytos/napps/kytos/mef_eline/settings.py
kytos-end-to-end-tests-kytos-1  | + sed -i 's/LLDP_LOOP_ACTIONS = \["log"\]/LLDP_LOOP_ACTIONS = \["disable","log"\]/' /var/lib/kytos/napps/kytos/of_lldp/settings.py
kytos-end-to-end-tests-kytos-1  | + sed -i 's/LLDP_IGNORED_LOOPS = {}/LLDP_IGNORED_LOOPS = {"00:00:00:00:00:00:00:01": \[\[4, 5\]\]}/' /var/lib/kytos/napps/kytos/of_lldp/settings.py
kytos-end-to-end-tests-kytos-1  | + sed -i 's/CONSISTENCY_COOKIE_IGNORED_RANGE =.*/CONSISTENCY_COOKIE_IGNORED_RANGE = [(0xdd00000000000000, 0xdd00000000000009)]/g' /var/lib/kytos/napps/kytos/flow_manager/settings.py
kytos-end-to-end-tests-kytos-1  | + sed -i 's/LIVENESS_DEAD_MULTIPLIER =.*/LIVENESS_DEAD_MULTIPLIER = 3/g' /var/lib/kytos/napps/kytos/of_lldp/settings.py
kytos-end-to-end-tests-kytos-1  | + kytosd --help
kytos-end-to-end-tests-kytos-1  | + sed -i s/WARNING/INFO/g /etc/kytos/logging.ini
kytos-end-to-end-tests-kytos-1  | + test -z ''
kytos-end-to-end-tests-kytos-1  | + TESTS=tests/
kytos-end-to-end-tests-kytos-1  | + test -z ''
kytos-end-to-end-tests-kytos-1  | + RERUNS=2
kytos-end-to-end-tests-kytos-1  | + python3 scripts/wait_for_mongo.py
kytos-end-to-end-tests-kytos-1  | Trying to run hello command on MongoDB...
kytos-end-to-end-tests-kytos-1  | Trying to run 'hello' command on MongoDB...
kytos-end-to-end-tests-kytos-1  | Trying to run 'hello' command on MongoDB...
kytos-end-to-end-tests-kytos-1  | Ran 'hello' command on MongoDB successfully. It's ready!
kytos-end-to-end-tests-kytos-1  | + python3 -m pytest tests/ --reruns 2 -r fEr
kytos-end-to-end-tests-kytos-1  | ============================= test session starts ==============================
kytos-end-to-end-tests-kytos-1  | platform linux -- Python 3.9.2, pytest-7.2.0, pluggy-1.2.0
kytos-end-to-end-tests-kytos-1  | rootdir: /tests
kytos-end-to-end-tests-kytos-1  | plugins: rerunfailures-10.2, timeout-2.1.0, anyio-3.6.2
kytos-end-to-end-tests-kytos-1  | collected 239 items
kytos-end-to-end-tests-kytos-1  | 
kytos-end-to-end-tests-kytos-1  | tests/test_e2e_01_kytos_startup.py ..                                    [  0%]
kytos-end-to-end-tests-kytos-1  | tests/test_e2e_05_topology.py ..RRF.RRF.RRF.RRF.RRFRRFRRFRRF....         [  8%]
kytos-end-to-end-tests-kytos-1  | tests/test_e2e_10_mef_eline.py .RRFRRFRRFRRFRRFRRFRRFRRFRRFssRRFRRF...x. [ 16%]
kytos-end-to-end-tests-kytos-1  | RRFRRFRRF.xRRFRRFRRFRRF.RRFRRFRRFRRFRRF..RRF...                          [ 25%]
kytos-end-to-end-tests-kytos-1  | tests/test_e2e_11_mef_eline.py RRFRRFRRFRRF..                            [ 27%]
kytos-end-to-end-tests-kytos-1  | tests/test_e2e_12_mef_eline.py ....RRFXxRRF                              [ 30%]
kytos-end-to-end-tests-kytos-1  | tests/test_e2e_13_mef_eline.py .....xs.s......xs.s.xxxxRRFxxxx.RRFXRRF.. [ 45%]
kytos-end-to-end-tests-kytos-1  | .........                                                                [ 49%]
kytos-end-to-end-tests-kytos-1  | tests/test_e2e_14_mef_eline.py x                                         [ 49%]
kytos-end-to-end-tests-kytos-1  | tests/test_e2e_15_mef_eline.py RRFRRF                                    [ 50%]
kytos-end-to-end-tests-kytos-1  | tests/test_e2e_20_flow_manager.py RRFRRFRRF..RRFRRFRRFRRFRRFRRFRRFRRFRRF [ 56%]
kytos-end-to-end-tests-kytos-1  | RRFRRFRRFRRFRRFRRFRRF                                                    [ 59%]
kytos-end-to-end-tests-kytos-1  | tests/test_e2e_21_flow_manager.py RRFRRFRRF                              [ 60%]
kytos-end-to-end-tests-kytos-1  | tests/test_e2e_22_flow_manager.py ...............                        [ 66%]
kytos-end-to-end-tests-kytos-1  | tests/test_e2e_23_flow_manager.py RRFRRFRRFRRFRRFRRFRRFRRFRRFRRFRRFRRFRR [ 72%]
kytos-end-to-end-tests-kytos-1  | FRRF                                                                     [ 72%]
kytos-end-to-end-tests-kytos-1  | tests/test_e2e_30_of_lldp.py .RRFRRF.                                    [ 74%]
kytos-end-to-end-tests-kytos-1  | tests/test_e2e_31_of_lldp.py RRFRRFRRF                                   [ 75%]
kytos-end-to-end-tests-kytos-1  | tests/test_e2e_32_of_lldp.py RRF..                                       [ 76%]
kytos-end-to-end-tests-kytos-1  | tests/test_e2e_40_sdntrace.py RRERRERRERRERRERRERRERRERRERRERRE          [ 81%]
kytos-end-to-end-tests-kytos-1  | tests/test_e2e_41_kytos_auth.py ........                                 [ 84%]
kytos-end-to-end-tests-kytos-1  | tests/test_e2e_50_maintenance.py .RRF....RRF.RRFRRF..RRFRRFRRF.RRF.RRFRR [ 93%]
kytos-end-to-end-tests-kytos-1  | FRRFRRFRRFRRF                                                            [ 94%]
kytos-end-to-end-tests-kytos-1  | tests/test_e2e_60_of_multi_table.py RRFRRFRRFRRF.                        [ 97%]
kytos-end-to-end-tests-kytos-1  | tests/test_e2e_70_kytos_stats.py RRFRRFRRFRRFRRFRRFR                     [100%]R [100%]F [100%]
kytos-end-to-end-tests-kytos-1  | 
Ktmi commented 1 year ago

I keep getting weird behavior out of this on end to end tests. I can't seem to figure out what went wrong. It seems, that in the e2e tests, events aren't getting properly passed around, though I can't wholly confirm that's the cause. When I run kytos normally, events seem to get passed around as they should. In the mean time, I'm going to keep this patch running in my environment until I can figure out why it doesn't work correctly in end to end tests.

viniarck commented 1 year ago

I keep getting weird behavior out of this on end to end tests. I can't seem to figure out what went wrong. It seems, that in the e2e tests, events aren't getting properly passed around, though I can't wholly confirm that's the cause. When I run kytos normally, events seem to get passed around as they should. In the mean time, I'm going to keep this patch running in my environment until I can figure out why it doesn't work correctly in end to end tests.

Interesting. OK. Btw, we currently do have a few sdntrace failing tests though https://github.com/kytos-ng/kytos-end-to-end-tests/issues/255 that @gretelliz will fix, but sounds like you've hit a more generalized problem.

viniarck commented 1 year ago

@Ktmi, based on what we just discussed on our weekly meeting, the easiest route here is to set it as a draft, until the e2e issue is sorted, OK. I'll go ahead and mark it as a draft.

Ktmi commented 6 months ago

Gonna close this for now. It's a nice idea, but the strange technical issues that are popping up make it untenable.