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

[pytest][qos][config] Added pytests for "config qos reload" commands #1346

Merged
merged 1 commit into from
Jan 14, 2021

Conversation

smaheshm
Copy link
Contributor

@smaheshm smaheshm commented Jan 4, 2021

- What I did
Added pytests for "config qos reload" commands for single and multi ASIC platforms.

NOTE: The origin PR #1266 was reverted due to a failure in sonic-buildimage unit tests,
which was due to an un-implemented API. This is now fixed in
PR sonic-net/sonic-buildimage#6309 (sonic-buildimage)

- How I did it
Since 'config qos reload' command invokdes'sonic-cfggen' process, add a "--dry-run" option to 'config qos reload' command so that it passes the right parameters to 'sonic-cfggen' to not 'read and write' to config DB in unit test env. Also added '--json-data' option that gives flexibility to test variable parameters like tiers and switch roles.

- How to verify it

Unit test.

======================================
samaddik@83f02bcc27aa:/sonic/src/sonic-utilities/tests$ pytest-3  -s -k reload
============================= test session starts ==============================
platform linux -- Python 3.7.3, pytest-3.10.1, py-1.7.0, pluggy-0.8.0
rootdir: /sonic/src/sonic-utilities/tests, inifile: pytest.ini
plugins: cov-2.6.0
collected 337 items / 335 deselected

config_test.py SETUP
Saving output in /tmp/qos_config_output.json
0
Running command: /usr/local/bin/sonic-cfggen  --additional-data '{"DEVICE_METADATA": {"localhost": {}}}' -t /sonic/src/sonic-utilities/tests/qos_config_input/buffers.json.j2,/tmp/qos_config_output.json -t /sonic/src/sonic-utilities/tests/qos_config_input/qos.json.j2,/tmp/qos_config_output.json -y /sonic/src/sonic-utilities/tests/qos_config_input/sonic_version.yml

.TEARDOWN
SETUP
Saving output in /tmp/qos_config_output.json<0,1,2..>
0
Running command: /usr/local/bin/sonic-cfggen -n asic0 --additional-data '{"DEVICE_METADATA": {"localhost": {}}}' -t /sonic/src/sonic-utilities/tests/qos_config_input/0/buffers.json.j2,/tmp/qos_config_output.json0 -t /sonic/src/sonic-utilities/tests/qos_config_input/0/qos.json.j2,/tmp/qos_config_output.json0 -y /sonic/src/sonic-utilities/tests/qos_config_input/sonic_version.yml
Running command: /usr/local/bin/sonic-cfggen -n asic1 --additional-data '{"DEVICE_METADATA": {"localhost": {}}}' -t /sonic/src/sonic-utilities/tests/qos_config_input/1/buffers.json.j2,/tmp/qos_config_output.json1 -t /sonic/src/sonic-utilities/tests/qos_config_input/1/qos.json.j2,/tmp/qos_config_output.json1 -y /sonic/src/sonic-utilities/tests/qos_config_input/sonic_version.yml

.TEARDOWN


=================== 2 passed, 335 deselected in 1.51 seconds ===================

- Previous command output (if the output of a command-line utility has changed)

- New command output (if the output of a command-line utility has changed)

…eload" commands (sonic-net#1266)""

This reverts commit de14939.

The commit was reverted due to a failure in sonic-buildimage unit tests,
which was due to an un-implemented API. This is now fixed in
PR #6309 (sonic-buildimage)
@smaheshm
Copy link
Contributor Author

retest this please

@smaheshm
Copy link
Contributor Author

@judyjoseph This was already approved and committed but reverted due to vs-image test failure. Recreated a new PR.

@smaheshm smaheshm merged commit aa4b2d5 into sonic-net:master Jan 14, 2021
lguohan pushed a commit to sonic-net/sonic-buildimage that referenced this pull request Jan 20, 2021
- [route_check.py] - update includes checks on subscriptions (sonic-net/sonic-utilities#1344)
- Validations checks while adding a member to PortChannel and removing a member from a Portchannel (sonic-net/sonic-utilities#1328)
- [show] Add subcommand to show midplane status for modular chassis (sonic-net/sonic-utilities#1267)
- [pytest][qos][config] Added pytests for "config qos reload" commands" (sonic-net/sonic-utilities#1346)
- Drop explict 3 seconds pause between two object updates/deletes. (sonic-net/sonic-utilities#1359)
- [show]fix for show muxcable status by replacing "hostname" to "peer_switch" for deriving tor ipv4_address (sonic-net/sonic-utilities#1360)
- [PFCWD] Fix 'start' pfcwd command (sonic-net/sonic-utilities#1345)

Signed-off-by: Shlomi Bitton <[email protected]>
lguohan pushed a commit to sonic-net/sonic-buildimage that referenced this pull request Jan 21, 2021
- [route_check.py] - update includes checks on subscriptions (sonic-net/sonic-utilities#1344)
- Validations checks while adding a member to PortChannel and removing a member from a Portchannel (sonic-net/sonic-utilities#1328)
- [show] Add subcommand to show midplane status for modular chassis (sonic-net/sonic-utilities#1267)
- [pytest][qos][config] Added pytests for "config qos reload" commands" (sonic-net/sonic-utilities#1346)
- Drop explict 3 seconds pause between two object updates/deletes. (sonic-net/sonic-utilities#1359)
- [show]fix for show muxcable status by replacing "hostname" to "peer_switch" for deriving tor ipv4_address (sonic-net/sonic-utilities#1360)
- [PFCWD] Fix 'start' pfcwd command (sonic-net/sonic-utilities#1345)

Signed-off-by: Shlomi Bitton <[email protected]>
@smaheshm smaheshm deleted the config_qos_2 branch February 26, 2021 22:33
anand-kumar-subramanian pushed a commit to anand-kumar-subramanian/sonic-utilities that referenced this pull request Mar 2, 2021
…sonic-net#1346)

Added pytest to verify QoS config generation on multi ASIC platform.
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