Skip to content

Tests for tag capable update#401

Open
Ktmi wants to merge 9 commits intomasterfrom
feat/tag_capable
Open

Tests for tag capable update#401
Ktmi wants to merge 9 commits intomasterfrom
feat/tag_capable

Conversation

@Ktmi
Copy link
Copy Markdown

@Ktmi Ktmi commented Nov 6, 2025

Part of tests for kytos-ng/topology#281

Summary

Updates tests to properly use tag capable interfaces and links.

End-to-End Tests

Here are the results with all the tag_capable branches being used:

kytos-1  | Starting enhanced syslogd: rsyslogd.
kytos-1  | /etc/openvswitch/conf.db does not exist ... (warning).
kytos-1  | Creating empty database /etc/openvswitch/conf.db.
kytos-1  | Starting ovsdb-server.
kytos-1  | rsyslogd: error during config processing: omfile: chown for file '/var/log/syslog' failed: Operation not permitted [v8.2302.0 try https://www.rsyslog.com/e/2207 ]
kytos-1  | Configuring Open vSwitch system IDs.
kytos-1  | Starting ovs-vswitchd.
kytos-1  | Enabling remote OVSDB managers.
kytos-1  | + '[' -z '' ']'
kytos-1  | + '[' -z '' ']'
kytos-1  | + echo 'There is no NAPPS_PATH specified. Default will be used.'
kytos-1  | + NAPPS_PATH=
kytos-1  | + sed -i 's/STATS_INTERVAL = 60/STATS_INTERVAL = 7/g' /var/lib/kytos/napps/kytos/of_core/settings.py
kytos-1  | There is no NAPPS_PATH specified. Default will be used.
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-1  | + sed -i 's/LINK_UP_TIMER = 10/LINK_UP_TIMER = 1/g' /var/lib/kytos/napps/kytos/topology/settings.py
kytos-1  | + sed -i 's/DEPLOY_EVCS_INTERVAL = 60/DEPLOY_EVCS_INTERVAL = 5/g' /var/lib/kytos/napps/kytos/mef_eline/settings.py
kytos-1  | + sed -i 's/LLDP_LOOP_ACTIONS = \["log"\]/LLDP_LOOP_ACTIONS = \["disable","log"\]/' /var/lib/kytos/napps/kytos/of_lldp/settings.py
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-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-1  | + sed -i 's/LIVENESS_DEAD_MULTIPLIER =.*/LIVENESS_DEAD_MULTIPLIER = 3/g' /var/lib/kytos/napps/kytos/of_lldp/settings.py
kytos-1  | + kytosd --help
kytos-1  | + sed -i s/WARNING/INFO/g /etc/kytos/logging.ini
kytos-1  | + sed -i 's/keys: root,kytos,api_server,socket/keys: root,kytos,api_server,socket,aiokafka/' /etc/kytos/logging.ini
kytos-1  | + echo -e '\n\n[logger_aiokafka]\nlevel: INFO\nhandlers:\nqualname: aiokafka'
kytos-1  | + test -z ''
kytos-1  | + TESTS=tests/
kytos-1  | + test -z ''
kytos-1  | + RERUNS=2
kytos-1  | + python3 scripts/wait_for_mongo.py
kytos-1  | Trying to run hello command on MongoDB...
kytos-1  | Trying to run 'hello' command on MongoDB...
kytos-1  | Trying to run 'hello' command on MongoDB...
kytos-1  | Ran 'hello' command on MongoDB successfully. It's ready!
kytos-1  | + python3 scripts/setup_kafka.py
kytos-1  | Starting setup_kafka.py...
kytos-1  | Attempting to create an admin client at ['broker1:19092', 'broker2:19092', 'broker3:19092']...
kytos-1  | Admin client was successful! Attempting to validate cluster...
kytos-1  | Cluster info: {'throttle_time_ms': 0, 'brokers': [{'node_id': 1, 'host': 'broker1', 'port': 19092, 'rack': None}, {'node_id': 2, 'host': 'broker2', 'port': 19092, 'rack': None}, {'node_id': 3, 'host': 'broker3', 'port': 19092, 'rack': None}], 'cluster_id': '5L6g3nShT-eMCtK--X86sw', 'controller_id': 2}
kytos-1  | Cluster was successfully validated! Attempting to create topic 'event_logs'...
kytos-1  | Topic 'event_logs' was created! Attempting to close the admin client...
kytos-1  | Kafka admin client closed.
kytos-1  | + python3 -m pytest tests/ --reruns 2 -r fEr
kytos-1  | ============================= test session starts ==============================
kytos-1  | platform linux -- Python 3.11.2, pytest-8.4.2, pluggy-1.6.0
kytos-1  | rootdir: /
kytos-1  | configfile: pytest.ini
kytos-1  | plugins: rerunfailures-13.0, timeout-2.2.0, asyncio-1.1.0, anyio-4.3.0
kytos-1  | asyncio: mode=Mode.AUTO, asyncio_default_fixture_loop_scope=None, asyncio_default_test_loop_scope=function
kytos-1  | collected 297 items
kytos-1  | 
kytos-1  | tests/test_e2e_01_kytos_startup.py ..                                    [  0%]
kytos-1  | tests/test_e2e_05_topology.py ...................                        [  7%]
kytos-1  | tests/test_e2e_06_topology.py ....                                       [  8%]
kytos-1  | tests/test_e2e_10_mef_eline.py ..........ss.....x....................... [ 22%]
kytos-1  | .                                                                        [ 22%]
kytos-1  | tests/test_e2e_11_mef_eline.py ......                                    [ 24%]
kytos-1  | tests/test_e2e_12_mef_eline.py .....Xx.                                  [ 27%]
kytos-1  | tests/test_e2e_13_mef_eline.py ....Xs.s.....Xs.s.XXxX.xxxx..X........... [ 41%]
kytos-1  | .                                                                        [ 41%]
kytos-1  | tests/test_e2e_14_mef_eline.py ......                                    [ 43%]
kytos-1  | tests/test_e2e_15_mef_eline.py ......                                    [ 45%]
kytos-1  | tests/test_e2e_16_mef_eline.py ..                                        [ 46%]
kytos-1  | tests/test_e2e_17_mef_eline.py ....                                      [ 47%]
kytos-1  | tests/test_e2e_18_mef_eline.py .....                                     [ 49%]
kytos-1  | tests/test_e2e_20_flow_manager.py ............................           [ 58%]
kytos-1  | tests/test_e2e_21_flow_manager.py ...                                    [ 59%]
kytos-1  | tests/test_e2e_22_flow_manager.py ...............                        [ 64%]
kytos-1  | tests/test_e2e_23_flow_manager.py ..............                         [ 69%]
kytos-1  | tests/test_e2e_30_of_lldp.py .R...                                       [ 70%]
kytos-1  | tests/test_e2e_31_of_lldp.py ....                                        [ 72%]
kytos-1  | tests/test_e2e_32_of_lldp.py ...                                         [ 73%]
kytos-1  | tests/test_e2e_40_sdntrace.py .............R...                          [ 78%]
kytos-1  | tests/test_e2e_41_kytos_auth.py ........                                 [ 81%]
kytos-1  | tests/test_e2e_42_sdntrace.py ..                                         [ 81%]
kytos-1  | tests/test_e2e_50_maintenance.py ...............................         [ 92%]
kytos-1  | tests/test_e2e_60_of_multi_table.py .....                                [ 93%]
kytos-1  | tests/test_e2e_70_kytos_stats.py .........                               [ 96%]
kytos-1  | tests/test_e2e_80_pathfinder.py ss......                                 [ 99%]
kytos-1  | tests/test_e2e_90_kafka_events.py .                                      [100%]
kytos-1  | 
kytos-1  | =============================== warnings summary ===============================
kytos-1  | usr/local/lib/python3.11/dist-packages/kytos/core/config.py:254
kytos-1  |   /usr/local/lib/python3.11/dist-packages/kytos/core/config.py:254: UserWarning: Unknown arguments: ['tests/', '--reruns', '2', '-r', 'fEr']
kytos-1  |     warnings.warn(f"Unknown arguments: {unknown}")
kytos-1  | 
kytos-1  | tests/test_e2e_01_kytos_startup.py: 17 warnings
kytos-1  | tests/test_e2e_05_topology.py: 17 warnings
kytos-1  | tests/test_e2e_06_topology.py: 37 warnings
kytos-1  | tests/test_e2e_10_mef_eline.py: 17 warnings
kytos-1  | tests/test_e2e_11_mef_eline.py: 25 warnings
kytos-1  | tests/test_e2e_12_mef_eline.py: 17 warnings
kytos-1  | tests/test_e2e_13_mef_eline.py: 17 warnings
kytos-1  | tests/test_e2e_14_mef_eline.py: 76 warnings
kytos-1  | tests/test_e2e_15_mef_eline.py: 17 warnings
kytos-1  | tests/test_e2e_16_mef_eline.py: 17 warnings
kytos-1  | tests/test_e2e_17_mef_eline.py: 37 warnings
kytos-1  | tests/test_e2e_18_mef_eline.py: 17 warnings
kytos-1  | tests/test_e2e_20_flow_manager.py: 17 warnings
kytos-1  | tests/test_e2e_21_flow_manager.py: 17 warnings
kytos-1  | tests/test_e2e_22_flow_manager.py: 17 warnings
kytos-1  | tests/test_e2e_23_flow_manager.py: 17 warnings
kytos-1  | tests/test_e2e_30_of_lldp.py: 16 warnings
kytos-1  | tests/test_e2e_31_of_lldp.py: 17 warnings
kytos-1  | tests/test_e2e_32_of_lldp.py: 11 warnings
kytos-1  | tests/test_e2e_40_sdntrace.py: 48 warnings
kytos-1  | tests/test_e2e_41_kytos_auth.py: 17 warnings
kytos-1  | tests/test_e2e_42_sdntrace.py: 84 warnings
kytos-1  | tests/test_e2e_50_maintenance.py: 17 warnings
kytos-1  | tests/test_e2e_60_of_multi_table.py: 17 warnings
kytos-1  | tests/test_e2e_70_kytos_stats.py: 17 warnings
kytos-1  | tests/test_e2e_80_pathfinder.py: 37 warnings
kytos-1  | tests/test_e2e_90_kafka_events.py: 17 warnings
kytos-1  |   /usr/lib/python3/dist-packages/mininet/node.py:1121: DeprecationWarning: distutils Version classes are deprecated. Use packaging.version instead.
kytos-1  |     return ( StrictVersion( cls.OVSVersion ) <
kytos-1  | 
kytos-1  | tests/test_e2e_01_kytos_startup.py: 17 warnings
kytos-1  | tests/test_e2e_05_topology.py: 17 warnings
kytos-1  | tests/test_e2e_06_topology.py: 37 warnings
kytos-1  | tests/test_e2e_10_mef_eline.py: 17 warnings
kytos-1  | tests/test_e2e_11_mef_eline.py: 25 warnings
kytos-1  | tests/test_e2e_12_mef_eline.py: 17 warnings
kytos-1  | tests/test_e2e_13_mef_eline.py: 17 warnings
kytos-1  | tests/test_e2e_14_mef_eline.py: 76 warnings
kytos-1  | tests/test_e2e_15_mef_eline.py: 17 warnings
kytos-1  | tests/test_e2e_16_mef_eline.py: 17 warnings
kytos-1  | tests/test_e2e_17_mef_eline.py: 37 warnings
kytos-1  | tests/test_e2e_18_mef_eline.py: 17 warnings
kytos-1  | tests/test_e2e_20_flow_manager.py: 17 warnings
kytos-1  | tests/test_e2e_21_flow_manager.py: 17 warnings
kytos-1  | tests/test_e2e_22_flow_manager.py: 17 warnings
kytos-1  | tests/test_e2e_23_flow_manager.py: 17 warnings
kytos-1  | tests/test_e2e_30_of_lldp.py: 16 warnings
kytos-1  | tests/test_e2e_31_of_lldp.py: 17 warnings
kytos-1  | tests/test_e2e_32_of_lldp.py: 11 warnings
kytos-1  | tests/test_e2e_40_sdntrace.py: 48 warnings
kytos-1  | tests/test_e2e_41_kytos_auth.py: 17 warnings
kytos-1  | tests/test_e2e_42_sdntrace.py: 84 warnings
kytos-1  | tests/test_e2e_50_maintenance.py: 17 warnings
kytos-1  | tests/test_e2e_60_of_multi_table.py: 17 warnings
kytos-1  | tests/test_e2e_70_kytos_stats.py: 17 warnings
kytos-1  | tests/test_e2e_80_pathfinder.py: 37 warnings
kytos-1  | tests/test_e2e_90_kafka_events.py: 17 warnings
kytos-1  |   /usr/lib/python3/dist-packages/mininet/node.py:1122: DeprecationWarning: distutils Version classes are deprecated. Use packaging.version instead.
kytos-1  |     StrictVersion( '1.10' ) )
kytos-1  | 
kytos-1  | tests/test_e2e_90_kafka_events.py::TestE2EKafkaEvents::test_01_napp_sends_data_correctly
kytos-1  |   /tests/test_e2e_90_kafka_events.py:87: RuntimeWarning: coroutine 'TestE2EKafkaEvents.topic_exists' was never awaited
kytos-1  |     if self.topic_exists():
kytos-1  |   Enable tracemalloc to get traceback where the object was allocated.
kytos-1  |   See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info.
kytos-1  | 
kytos-1  | -- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
kytos-1  | ------------------------------- start/stop times -------------------------------
kytos-1  | rerun: 0
kytos-1  | tests/test_e2e_30_of_lldp.py::TestE2EOfLLDP::test_010_disable_of_lldp: 2025-11-05,22:29:29.916270 - 2025-11-05,22:29:54.861484
kytos-1  | self = <tests.test_e2e_30_of_lldp.TestE2EOfLLDP object at 0x765d3b83d050>
kytos-1  | 
kytos-1  |     def test_010_disable_of_lldp(self):
kytos-1  |         """ Test if the disabling OF LLDP in an interface worked properly. """
kytos-1  |         self.net.start_controller(clean_config=True, enable_all=False)
kytos-1  |         self.net.wait_switches_connect()
kytos-1  |         time.sleep(5)
kytos-1  |         self.enable_all_interfaces()
kytos-1  |     
kytos-1  |         # disabling all the UNI interfaces
kytos-1  |         payload = {
kytos-1  |             "interfaces": [
kytos-1  |                 "00:00:00:00:00:00:00:01:1", "00:00:00:00:00:00:00:01:2", "00:00:00:00:00:00:00:01:4294967294",
kytos-1  |                 "00:00:00:00:00:00:00:02:1", "00:00:00:00:00:00:00:02:4294967294",
kytos-1  |                 "00:00:00:00:00:00:00:03:1", "00:00:00:00:00:00:00:03:4294967294"
kytos-1  |             ]
kytos-1  |         }
kytos-1  |         expected_interfaces = [
kytos-1  |                 "00:00:00:00:00:00:00:01:3", "00:00:00:00:00:00:00:01:4",
kytos-1  |                 "00:00:00:00:00:00:00:02:2", "00:00:00:00:00:00:00:02:3",
kytos-1  |                 "00:00:00:00:00:00:00:03:2", "00:00:00:00:00:00:00:03:3"
kytos-1  |         ]
kytos-1  |     
kytos-1  |         api_url = KYTOS_API + '/of_lldp/v1/interfaces/disable/'
kytos-1  |         response = requests.post(api_url, json=payload)
kytos-1  |         assert response.status_code == 200, response.text
kytos-1  |     
kytos-1  |         api_url = KYTOS_API + '/of_lldp/v1/interfaces/'
kytos-1  |         response = requests.get(api_url)
kytos-1  |         data = response.json()
kytos-1  |         assert set(data["interfaces"]) == set(expected_interfaces)
kytos-1  |     
kytos-1  |         h11, h12, h2, h3 = self.net.net.get('h11', 'h12', 'h2', 'h3')
kytos-1  |         rx_stats_h11 = self.get_iface_stats_rx_pkt(h11)
kytos-1  |         rx_stats_h12 = self.get_iface_stats_rx_pkt(h12)
kytos-1  |         rx_stats_h2 = self.get_iface_stats_rx_pkt(h2)
kytos-1  |         rx_stats_h3 = self.get_iface_stats_rx_pkt(h3)
kytos-1  |         time.sleep(10)
kytos-1  |         rx_stats_h11_2 = self.get_iface_stats_rx_pkt(h11)
kytos-1  |         rx_stats_h12_2 = self.get_iface_stats_rx_pkt(h12)
kytos-1  |         rx_stats_h2_2 = self.get_iface_stats_rx_pkt(h2)
kytos-1  |         rx_stats_h3_2 = self.get_iface_stats_rx_pkt(h3)
kytos-1  |     
kytos-1  | >       assert rx_stats_h11_2 == rx_stats_h11 \
kytos-1  |             and rx_stats_h12_2 == rx_stats_h12 \
kytos-1  |             and rx_stats_h2_2 == rx_stats_h2 \
kytos-1  |             and rx_stats_h3_2 == rx_stats_h3
kytos-1  | E       assert (19 == 18)
kytos-1  | 
kytos-1  | tests/test_e2e_30_of_lldp.py:127: AssertionError
kytos-1  | rerun: 0
kytos-1  | tests/test_e2e_40_sdntrace.py::TestE2ESDNTrace::test_100_trace_circuit_vlan_range: 2025-11-05,22:49:51.209772 - 2025-11-05,22:49:51.368102
kytos-1  | cls = <tests.test_e2e_40_sdntrace.TestE2ESDNTrace object at 0x765d3b857310>
kytos-1  | 
kytos-1  |     def test_100_trace_circuit_vlan_range(cls):
kytos-1  |         """Test traces for circuit with vlan range"""
kytos-1  |         cls.create_evc([[12, 21]])
kytos-1  |         vlan1 = random.randrange(12, 16)
kytos-1  |         vlan2 = random.randrange(16, 20)
kytos-1  |         vlan3 = random.randrange(20, 22)
kytos-1  |         payload = [
kytos-1  |             {"trace": {
kytos-1  |                 "switch": {"dpid": "00:00:00:00:00:00:00:01", "in_port": 1},
kytos-1  |                 "eth": {"dl_type": 33024, "dl_vlan": vlan1}
kytos-1  |             }},
kytos-1  |             {"trace": {
kytos-1  |                 "switch": {"dpid": "00:00:00:00:00:00:00:01", "in_port": 1},
kytos-1  |                 "eth": {"dl_type": 33024, "dl_vlan": vlan2}
kytos-1  |             }},
kytos-1  |             {"trace": {
kytos-1  |                 "switch": {"dpid": "00:00:00:00:00:00:00:01", "in_port": 1},
kytos-1  |                 "eth": {"dl_type": 33024, "dl_vlan": vlan3}
kytos-1  |             }}
kytos-1  |         ]
kytos-1  |     
kytos-1  |         api_url = KYTOS_API + '/amlight/sdntrace_cp/v1/traces'
kytos-1  |         response = requests.put(api_url, json=payload)
kytos-1  |         assert response.status_code == 200, response.text
kytos-1  |         data = response.json()["result"]
kytos-1  |     
kytos-1  |         last_dpid = "00:00:00:00:00:00:00:0a"
kytos-1  |         vlan_list = [vlan1, vlan2, vlan3]
kytos-1  |         assert len(data) == 3, data
kytos-1  |         for i, trace in enumerate(data):
kytos-1  | >           assert len(trace) == 10, trace
kytos-1  | E           AssertionError: []
kytos-1  | E           assert 0 == 10
kytos-1  | E            +  where 0 = len([])
kytos-1  | 
kytos-1  | tests/test_e2e_40_sdntrace.py:1104: AssertionError
kytos-1  | =========================== rerun test summary info ============================
kytos-1  | RERUN tests/test_e2e_30_of_lldp.py::TestE2EOfLLDP::test_010_disable_of_lldp
kytos-1  | RERUN tests/test_e2e_40_sdntrace.py::TestE2ESDNTrace::test_100_trace_circuit_vlan_range
kytos-1  | = 275 passed, 8 skipped, 7 xfailed, 7 xpassed, 1356 warnings, 2 rerun in 12573.00s (3:29:33) =

�[Kkytos-1 exited with code 0

@Ktmi Ktmi requested a review from a team as a code owner November 6, 2025 02:36
Copy link
Copy Markdown
Member

@viniarck viniarck left a comment

Choose a reason for hiding this comment

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

Nice to have the tests augmented, overall looks good.

I'll do another pass when the related changes progress too

intf_id = "00:00:00:00:00:00:00:02:2"
api_url = KYTOS_API + f'/topology/v3/interfaces/{intf_id}/tag_ranges'
response = requests.post(api_url, json=payload)
assert response.status_code == 200, response.text
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The tag_ranges calls and assertions look good to me. But, this test case test_210_bulk_update_evc was meant only for testing the bulk update of metadata.

Does this test break now with the upcoming changes or was it just extra coverage for tag_ranges? If the latter, then let's move these extra tag_ranges related assertions to another test case.

Copy link
Copy Markdown
Member

@viniarck viniarck left a comment

Choose a reason for hiding this comment

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

@Ktmi can you also cover resizing tag_ranges with a topology specific test suite? Let's validate both shrinking and growing, while also ensuring that link and interface tag_ranges never overlaps. Cool to also assert the initial link formation inherited/borrowed intersected tag ranges, including also deleting that link. Let's also test a case where tag_ranges vlan of a link don't overlap partially and ensuring it gets the correct expected intersection

@viniarck viniarck self-requested a review February 24, 2026 17:40
Copy link
Copy Markdown
Member

@viniarck viniarck left a comment

Choose a reason for hiding this comment

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

Comments haven't been addressed

@Ktmi
Copy link
Copy Markdown
Author

Ktmi commented Mar 26, 2026

Added some tests for growing and shrinking tag ranges, as well as moving them between interfaces and links.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants