Skip to content

Commit 2f19191

Browse files
Merge branch 'main' into l1_tests_reboot_device
2 parents 5b01ffb + 898d3c7 commit 2f19191

66 files changed

Lines changed: 2189 additions & 821 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

DentOS_Framework/DentOsTestbed/src/dent_os_testbed/constants.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,8 @@
8181
'suite_functional_storm_control': 'Functional Storm Control tests',
8282
'suite_functional_policer': 'Policer functional tests',
8383
'suite_functional_devlink': 'Devlink functional tests',
84+
'suite_functional_hard_drop_counters': 'Hard Drop counters functional tests',
85+
'suite_functional_table_size': 'Table size functional tests',
8486
}
8587

8688
PYTEST_SUITE_GROUPS = {
@@ -127,5 +129,7 @@
127129
'suite_functional_storm_control',
128130
'suite_functional_policer',
129131
'suite_functional_devlink',
132+
'suite_functional_hard_drop_counters',
133+
'suite_functional_table_size',
130134
]
131135
}
Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
from functools import reduce
2+
import pytest_asyncio
3+
import asyncio
4+
5+
from dent_os_testbed.lib.ethtool.ethtool import Ethtool
6+
from dent_os_testbed.lib.ip.ip_link import IpLink
7+
8+
from dent_os_testbed.utils.test_utils.tgen_utils import (
9+
tgen_utils_get_dent_devices_with_tgen,
10+
)
11+
12+
13+
adv_modes = {
14+
'10baseT/Half': 0x001,
15+
'10baseT/Full': 0x002,
16+
'100baseT/Half': 0x004,
17+
'100baseT/Full': 0x008,
18+
'1000baseT/Full': 0x020,
19+
'10000baseT/Full': 0x1000,
20+
}
21+
22+
23+
@pytest_asyncio.fixture()
24+
async def restore_port_speed(testbed):
25+
tgen_dev, dent_devices = await tgen_utils_get_dent_devices_with_tgen(testbed, [], 2)
26+
if not tgen_dev or not dent_devices:
27+
print('The testbed does not have enough dent with tgen connections')
28+
return
29+
dent = dent_devices[0].host_name
30+
ports = tgen_dev.links_dict[dent][1]
31+
32+
out = await IpLink.show(input_data=[{dent: [{'cmd_options': '-j'}]}], parse_output=True)
33+
assert out[0][dent]['rc'] == 0, 'Failed to get port state'
34+
35+
if not all(link['operstate'] == 'UP'
36+
for link in out[0][dent]['parsed_output']
37+
if link['ifname'] in ports):
38+
# not all ports are up
39+
# port hast to be UP to see current advertisement modes and/or speed
40+
out = await IpLink.set(input_data=[{dent: [
41+
{'device': port, 'operstate': 'up'}
42+
for port in ports
43+
]}])
44+
assert out[0][dent]['rc'] == 0, 'Failed to set operstate up'
45+
46+
await asyncio.sleep(10)
47+
48+
ethtool = await asyncio.gather(*[
49+
Ethtool.show(input_data=[{dent: [{'devname': port}]}], parse_output=True)
50+
for port in ports
51+
])
52+
assert all(out[0][dent]['rc'] == 0 for out in ethtool), 'Failed to get ports\' speed'
53+
54+
yield # Run the test
55+
56+
cmd = []
57+
for out, port in zip(ethtool, ports):
58+
mode = out[0][dent]['parsed_output']
59+
if 'Unknown!' in mode['speed']:
60+
continue
61+
if mode['auto-negotiation'] == 'on':
62+
adv = reduce(lambda x, y: x | y,
63+
[adv_modes[m]
64+
for m in mode['advertised_link_modes'].split(' ')
65+
if m in adv_modes])
66+
cmd.append({
67+
'devname': port,
68+
'autoneg': mode['auto-negotiation'],
69+
'advertise': f'{adv:X}',
70+
})
71+
else: # not autoneg
72+
cmd.append({
73+
'devname': port,
74+
'autoneg': 'off',
75+
'speed': int(mode['speed'][:-4]),
76+
'duplex': mode['duplex'].lower(),
77+
})
78+
79+
if cmd:
80+
await Ethtool.set(input_data=[{dent: cmd}])

DentOS_Framework/DentOsTestbed/src/dent_os_testbed/test/test_suite/functional/L1/test_l1_autodetect.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222

2323
pytestmark = [pytest.mark.suite_functional_l1,
2424
pytest.mark.asyncio,
25-
pytest.mark.usefixtures('cleanup_bridges', 'cleanup_tgen')]
25+
pytest.mark.usefixtures('cleanup_bridges', 'cleanup_tgen', 'restore_port_speed')]
2626

2727

2828
@pytest.mark.parametrize('speed , duplex',

DentOS_Framework/DentOsTestbed/src/dent_os_testbed/test/test_suite/functional/L1/test_l1_autoneg.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121

2222
pytestmark = [pytest.mark.suite_functional_l1,
2323
pytest.mark.asyncio,
24-
pytest.mark.usefixtures('cleanup_bridges', 'cleanup_tgen')]
24+
pytest.mark.usefixtures('cleanup_bridges', 'cleanup_tgen', 'restore_port_speed')]
2525

2626

2727
@pytest.mark.parametrize('speed , duplex',

DentOS_Framework/DentOsTestbed/src/dent_os_testbed/test/test_suite/functional/L1/test_l1_config.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
pytestmark = [pytest.mark.suite_functional_l1,
1616
pytest.mark.asyncio,
17-
pytest.mark.usefixtures('cleanup_bridges', 'cleanup_tgen')]
17+
pytest.mark.usefixtures('cleanup_bridges', 'cleanup_tgen', 'restore_port_speed')]
1818

1919

2020
@pytest.mark.parametrize('l1_settings', ['autodetect', 'autoneg'])

DentOS_Framework/DentOsTestbed/src/dent_os_testbed/test/test_suite/functional/L1/test_l1_forced_speed.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121

2222
pytestmark = [pytest.mark.suite_functional_l1,
2323
pytest.mark.asyncio,
24-
pytest.mark.usefixtures('cleanup_bridges', 'cleanup_tgen')]
24+
pytest.mark.usefixtures('cleanup_bridges', 'cleanup_tgen', 'restore_port_speed')]
2525

2626

2727
@pytest.mark.parametrize('speed , duplex',

DentOS_Framework/DentOsTestbed/src/dent_os_testbed/test/test_suite/functional/L1/test_l1_mixed_speed.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919

2020
pytestmark = [pytest.mark.suite_functional_l1,
2121
pytest.mark.asyncio,
22-
pytest.mark.usefixtures('cleanup_bridges', 'cleanup_tgen')]
22+
pytest.mark.usefixtures('cleanup_bridges', 'cleanup_tgen', 'restore_port_speed')]
2323

2424

2525
async def test_l1_mixed_speed(testbed):

DentOS_Framework/DentOsTestbed/src/dent_os_testbed/test/test_suite/functional/L1/test_l1_port_state.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@ async def test_l1_port_state_status(testbed):
9292
await port_state(testbed, 1)
9393

9494

95+
@pytest.mark.skip(reason='https://github.com/dentproject/dentOS/issues/152')
9596
async def test_l1_link_up_state_software_power_cycle(testbed):
9697
"""
9798
Test Name: test_l1_link_up_state_software_power_cycle

DentOS_Framework/DentOsTestbed/src/dent_os_testbed/test/test_suite/functional/acl/test_acl_all_selectors.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,7 @@ async def test_acl_all_selectors(testbed, action, use_tagged_traffic, qdisc_type
204204
await tgen_utils_stop_traffic(tgen_dev)
205205

206206
# 10. Verify "pass" and "trap" traffic was forwarded, "drop" was dropped
207+
await asyncio.sleep(5)
207208
ixia_stats = await tgen_utils_get_traffic_stats(tgen_dev, 'Flow Statistics')
208209

209210
for row in ixia_stats.Rows:

DentOS_Framework/DentOsTestbed/src/dent_os_testbed/test/test_suite/functional/bridging/test_bridging_admin_state_down_up.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,9 +128,8 @@ async def test_bridging_admin_state_down_up(testbed):
128128
await tgen_utils_stop_traffic(tgen_dev)
129129

130130
# check the traffic stats
131-
stats = await tgen_utils_get_traffic_stats(tgen_dev, 'Traffic Item Statistics')
131+
stats = await tgen_utils_get_traffic_stats(tgen_dev, 'Flow Statistics')
132132
for row in stats.Rows:
133-
assert float(row['Tx Frames']) > 0.000, f'Failed>Ixia should transmit traffic: {row["Tx Frames"]}'
134133
assert tgen_utils_get_loss(row) == 100.000, \
135134
f"Verify that traffic from {row['Tx Port']} to {row['Rx Port']} not forwarded.\n{out}"
136135

0 commit comments

Comments
 (0)