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

[UT] Add UT for chassis qos reload #3234

Open
wants to merge 62 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 16 commits
Commits
Show all changes
62 commits
Select commit Hold shift + click to select a range
7a9df01
fix precedence
wenyiz2021 Jun 13, 2023
dde6591
Merge branch 'sonic-net:master' into master
wenyiz2021 Jul 19, 2023
81701e6
Merge branch 'sonic-net:master' into master
wenyiz2021 Sep 11, 2023
31848f8
Merge branch 'sonic-net:master' into master
wenyiz2021 Mar 21, 2024
b2481cd
Add support for chassis in qos reload
wenyiz2021 Mar 21, 2024
4f48e1c
Update main.py
wenyiz2021 Mar 22, 2024
86324c9
Create update_qos_multi_dut.json
wenyiz2021 Mar 22, 2024
ad984c6
Update config_test.py
wenyiz2021 Mar 22, 2024
ff01652
Merge branch 'master' into qos_reload
wenyiz2021 Mar 22, 2024
ebb11c3
Update config_test.py
wenyiz2021 Mar 22, 2024
4527ea3
Update config_test.py
wenyiz2021 Mar 22, 2024
f8fd0d8
Update config_test.py
wenyiz2021 Mar 22, 2024
20857f7
Update config_test.py
wenyiz2021 Mar 22, 2024
2339578
Update config_test.py
wenyiz2021 Mar 23, 2024
50a7d91
Update config_test.py
wenyiz2021 Mar 25, 2024
c0f6dcc
Update config_test.py
wenyiz2021 Mar 25, 2024
d55144a
Update config_test.py
wenyiz2021 Mar 26, 2024
8d7cb25
Update main.py
wenyiz2021 Mar 26, 2024
2401aba
Update update_qos_multi_dut.json
wenyiz2021 Mar 26, 2024
9616897
Update config_test.py
wenyiz2021 Mar 26, 2024
24ae658
Update main.py
wenyiz2021 Mar 26, 2024
efe8177
Update config_test.py
wenyiz2021 Mar 27, 2024
5cd0f64
Update buffers_config.j2
wenyiz2021 Mar 27, 2024
8d8c9b2
Update update_qos_multi_dut.json
wenyiz2021 Mar 27, 2024
b2f849c
Update update_qos_multi_dut.json
wenyiz2021 Mar 27, 2024
062888e
Update config_test.py
wenyiz2021 Mar 27, 2024
8fabb00
Update update_qos_multi_dut.json
wenyiz2021 Mar 27, 2024
e652ade
Update buffers_config.j2
wenyiz2021 Mar 27, 2024
30cf727
Update update_qos_multi_dut.json
wenyiz2021 Mar 27, 2024
e11c71e
Update update_qos_multi_dut.json
wenyiz2021 Mar 27, 2024
78b2726
Update config_test.py
wenyiz2021 Mar 27, 2024
650acd6
Update update_qos_multi_dut.json
wenyiz2021 Mar 27, 2024
0852709
Update config_test.py
wenyiz2021 Mar 27, 2024
6742519
Update buffers_config.j2
wenyiz2021 Mar 28, 2024
35a78a6
Update buffers_config.j2
wenyiz2021 Mar 28, 2024
641ec8d
Update buffers_config.j2
wenyiz2021 Mar 28, 2024
09a0940
Update config_test.py
wenyiz2021 Mar 28, 2024
17de81f
Update config_test.py
wenyiz2021 Mar 28, 2024
a35a52f
Merge branch 'sonic-net:master' into qos_reload
wenyiz2021 Mar 28, 2024
218233b
Update buffers_config.j2
wenyiz2021 Mar 28, 2024
e021890
Update config_test.py
wenyiz2021 Mar 28, 2024
af69f3a
Update config_test.py
wenyiz2021 Mar 28, 2024
dd5dd2d
Update buffers_config.j2
wenyiz2021 Mar 28, 2024
cf81768
Update buffers_config.j2
wenyiz2021 Mar 29, 2024
dbfc1b6
Update config_test.py
wenyiz2021 Mar 29, 2024
47dfd8f
Update config_test.py
wenyiz2021 Mar 29, 2024
d2b0c36
Update buffers_config.j2
wenyiz2021 Mar 29, 2024
341204d
Update buffers_config.j2
wenyiz2021 Mar 29, 2024
cea6520
Update buffers_config.j2
wenyiz2021 Mar 29, 2024
a2ce8a9
Update buffers_config.j2
wenyiz2021 Mar 29, 2024
22be219
Update buffers_config.j2
wenyiz2021 Mar 29, 2024
acbc747
Update buffers_config.j2
wenyiz2021 Mar 29, 2024
8852bfc
Update buffers_config.j2
wenyiz2021 Mar 29, 2024
0acc1c0
Update buffers_config.j2
wenyiz2021 Apr 1, 2024
e1ee4e2
Update buffers_config.j2
wenyiz2021 Apr 1, 2024
fa849f0
Update buffers_config.j2
wenyiz2021 Apr 1, 2024
d969b79
Update buffers_config.j2
wenyiz2021 Apr 1, 2024
1f87bfd
Update buffers_config.j2
wenyiz2021 Apr 1, 2024
ddf71f6
Update buffers_config.j2
wenyiz2021 Apr 1, 2024
f71a918
Update buffers_config.j2
wenyiz2021 Apr 2, 2024
5d24a1d
Update buffers_config.j2
wenyiz2021 Apr 2, 2024
5ca8b63
Merge branch 'sonic-net:master' into qos_reload
wenyiz2021 May 2, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion config/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -3001,7 +3001,8 @@ def _qos_update_ports(ctx, ports, dry_run, json_data):
if element.startswith('Eth'):
port = element
break
assert port is not None, "Port is not found in config DB"
if port is None:
ctx.fail("Port is not found in config DB")
if not port in portset_to_handle:
continue
config_db.set_entry(table_name, '|'.join(key), None)
Expand Down
21 changes: 20 additions & 1 deletion tests/config_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -911,12 +911,30 @@ def test_qos_update_single(
)
assert filecmp.cmp(output_file, expected_result, shallow=False)

def test_qos_update_multi_dut(
self, get_cmd_module, setup_qos_mock_apis
):
(config, show) = get_cmd_module
json_data = '{"DEVICE_METADATA": {"localhost": {}}, "PORT": {"Ethernet0": {}}}'
runner = CliRunner()
output_file = os.path.join(os.sep, "tmp", "qos_config_update_multi_dut.json")
cmd_vector = ["reload", "--ports", "Ethernet0"]
result = runner.invoke(config.config.commands["qos"], cmd_vector)
print(result.exit_code)
assert result.output == "ok"
print(result.output)
assert result.exit_code == 0
cwd = os.path.dirname(os.path.realpath(__file__))
expected_result = os.path.join(
cwd, "qos_config_input", "update_qos_multi_dut.json"
)
assert filecmp.cmp(output_file, expected_result, shallow=False)

@classmethod
def teardown_class(cls):
print("TEARDOWN")
os.environ['UTILITIES_UNIT_TESTING'] = "0"


class TestConfigQosMasic(object):
@classmethod
def setup_class(cls):
Expand Down Expand Up @@ -1009,6 +1027,7 @@ def teardown_class(cls):
importlib.reload(mock_single_asic)
dbconnector.load_namespace_config()


class TestGenericUpdateCommands(unittest.TestCase):
def setUp(self):
os.environ['UTILITIES_UNIT_TESTING'] = "1"
Expand Down
60 changes: 60 additions & 0 deletions tests/qos_config_input/update_qos_multi_dut.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
{
"BUFFER_PG": {
"Ethernet0|0": {
"profile": "ingress_lossy_profile"
}
"lc1-1|asic0|Ethernet88|0-2": {
"profile": "ingress_lossy_profile"
}
},
"BUFFER_QUEUE": {
"Ethernet0|0-2": {
"profile": "egress_lossy_profile"
},
"Ethernet0|3-4": {
"profile": "egress_lossless_profile"
},
"Ethernet0|5-6": {
"profile": "egress_lossy_profile"
}
},
"CABLE_LENGTH": {
"AZURE": {
"Ethernet0": "300m"
}
},
"PORT_QOS_MAP": {
"Ethernet0": {
"dscp_to_tc_map": "AZURE",
"pfc_enable": "3,4",
"pfc_to_queue_map": "AZURE",
"tc_to_pg_map": "AZURE",
"tc_to_queue_map": "AZURE"
}
},
"QUEUE": {
"Ethernet0|0": {
"scheduler": "scheduler.0"
},
"Ethernet0|1": {
"scheduler": "scheduler.0"
},
"Ethernet0|2": {
"scheduler": "scheduler.0"
},
"Ethernet0|3": {
"scheduler": "scheduler.1",
"wred_profile": "AZURE_LOSSLESS"
},
"Ethernet0|4": {
"scheduler": "scheduler.1",
"wred_profile": "AZURE_LOSSLESS"
},
"Ethernet0|5": {
"scheduler": "scheduler.0"
},
"Ethernet0|6": {
"scheduler": "scheduler.0"
}
}
}
Loading