-
Notifications
You must be signed in to change notification settings - Fork 746
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
SAI validation #15324
base: master
Are you sure you want to change the base?
SAI validation #15324
Conversation
- Key changes detected
of N unique keys while waiting
Is there a way to avoid committing a deb package into this repo? I have 2 concerns:
|
Regarding (1.) As the package will need to be installed on the DUT which most likely won't have Internet access. And I am not sure if it is okay to assume the server (in MS / community test environments) on which the tests run have Internet access either. Hence, I checked them into the repository. I see similar practice followed for some files specific to Mellanox -
Regarding (2.) The two versions of |
Most likely these packages are no longer being used. And this is not a good practice anyway. I don't feel it is a good idea to go further on this path. |
|
|
||
## Introduction | ||
|
||
SONiC management tests are Pytest modules running in the SONiC management container on the developer/CI/test environment and PTF tests running from the PTF container on the testbed server. As part of the setup and tear down activities the tests make configuration changes to SONiC, run the tests and verify if the tests ran successfully by making additional configuration checks and finally tear down the configuration changes. The tests use command line utilities on the DUT like `config`, `sonic-db-cli` or `redis-cli` to set and get configuration values. In some cases tests export / dump the contents of the database to examine its results and verify if tests ran successfully. These configuration changes are propogated to the ASIC through ASIC_DB. The aim of this design document is to identify a mechanism for tests to validate the configuration changes against ASIC_DB entries or SAI object types. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
SONiC management tests
-> SONiC tests in the sonic-mgmt repository
?
|
||
## Introduction | ||
|
||
SONiC management tests are Pytest modules running in the SONiC management container on the developer/CI/test environment and PTF tests running from the PTF container on the testbed server. As part of the setup and tear down activities the tests make configuration changes to SONiC, run the tests and verify if the tests ran successfully by making additional configuration checks and finally tear down the configuration changes. The tests use command line utilities on the DUT like `config`, `sonic-db-cli` or `redis-cli` to set and get configuration values. In some cases tests export / dump the contents of the database to examine its results and verify if tests ran successfully. These configuration changes are propogated to the ASIC through ASIC_DB. The aim of this design document is to identify a mechanism for tests to validate the configuration changes against ASIC_DB entries or SAI object types. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
SONiC management container
-> sonic-mgmt container
.
|
||
- **Using threading and polling** as implemented in [SWSS VS Tests](https://github.com/sonic-net/sonic-swss/blob/master/tests/README.md), [conftest](https://github.com/sonic-net/sonic-swss/blob/master/tests/conftest.py), [dvslib/dvs_database](https://github.com/sonic-net/sonic-swss/blob/master/tests/dvslib/dvs_database.py) | ||
|
||
- **Using Redis pubsub** This approach takes advantage of Redis pubsub to get notification of keyspace changes instead of using threading or polling to watch for key value changes. This mechanism improves performance and predictability of watching for keyspace changes. The tests don't have to rely on threads or sleep timers to check for value changes. The keyspace notifications are enabled by default for `ASIC_DB`. Keyspace notifications are enabled by default (`AKE`) in SONiC Redis instance. There are two kinds of message types received in pubsub `psubscribe` and `pmessage`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In "Keyspace notifications are enabled by default (AKE
) in SONiC Redis instance."
What does AKE
mean?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
AKE
are flags which translate to "all the events except for new key events (n) and missed events (m)". More details are available here https://redis.io/docs/latest/develop/use/keyspace-notifications/#configuration. I have updated the design doc with this link too.
After=database.service | ||
|
||
[Service] | ||
ExecStart=/usr/bin/socat TCP4-LISTEN:6381,fork TCP:localhost:6379 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The template has port 6381
hard coded. The added pytest option --exposed-db-port
is not actually being used.
|
||
time.sleep(1) | ||
# check all STATE_DB BFD_SESSION_TABLE neighbors' state is Up | ||
status, actual_wait = wait_until_condition(q, prefix, neighbor_addrs, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If exception is raised in wait_until_condition
, it would return None. Can this tuple assignment pass if wait_until_condition
returns None
? If not, then there is a problem here. And other wait_until_*
tools have the similar problem.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed. ThreadPoolExecutor.submit
raises RuntimeError
, TypeError
and BrokenThreadPool
all of these shouldn't be handled. The concurrent.futures.Future.result
submit()
can raise TimeoutError
, CancelledError
and Exception
which have been handled by logging and returning appropriate return values.
Thanks @wangxin. I agree that committing Debian packages to the repository is not the best way forward. I am checking with the SONiC team to see if |
Modify template to use exposed db port; Update documentation; Add __init__.py to tests/common/database;
/azp run |
Pull request contains merge conflicts. |
/azp run |
Azure Pipelines successfully started running 1 pipeline(s). |
/azp run |
Azure Pipelines successfully started running 1 pipeline(s). |
/azp run |
Azure Pipelines successfully started running 1 pipeline(s). |
Description of PR
redis-py
native Python library instead of relying onsonic-db-cli
.wait_until
which performssleep->check
cycle.STATE_DB
changes using the new notification library intest_bfd.py::test_bfd_basic
.Summary:
Fixes # Not applicable
Type of change
Back port request
Approach
What is the motivation for this PR?
Motivation is to add a simple and easy to use library that allows tests (where applicable) to perform SAI validation and allow tests to use event notification-based method to monitor DB changes.
How did you do it?
Refer to description above.
How did you verify/test it?
Verified
ACL
tests (ont0
) andBFD
basic tests (ont1
) testbeds.Any platform specific information?
No
Supported testbed topology if it's a new test case?
NA
Documentation
TBD.