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

[NTP] Update tests for new NTP configuration #10749

Merged
merged 1 commit into from
Nov 21, 2023

Conversation

fastiuk
Copy link
Contributor

@fastiuk fastiuk commented Nov 15, 2023

Description of PR

Summary:
Fixes #1254

Type of change

  • Bug fix
  • Testbed and Framework(new/improvement)
  • Test case(new/improvement)

Back port request

  • 201911
  • 202012
  • 202205
  • 202305

Approach

What is the motivation for this PR?

To alignt the tests for new NTP configuration

How did you do it?

Add a new test and left the old one as backward compatibility

How did you verify/test it?

By running it on the switch

@mssonicbld
Copy link
Collaborator

The pre-commit check detected issues in the files touched by this pull request.
The pre-commit check is a mandatory check, please fix detected issues.

Detailed pre-commit check results:
trim trailing whitespace.................................................Passed
fix end of files.........................................................Passed
check yaml...........................................(no files to check)Skipped
check for added large files..............................................Passed
check python ast.........................................................Passed
flake8...................................................................Failed
- hook id: flake8
- exit code: 1

tests/generic_config_updater/test_ntp.py:136:9: E722 do not use bare 'except'
tests/generic_config_updater/test_ntp.py:224:9: E722 do not use bare 'except'

flake8...............................................(no files to check)Skipped
check conditional mark sort..........................(no files to check)Skipped

To run the pre-commit checks locally, you can follow below steps:

  1. Ensure that default python is python3. In sonic-mgmt docker container, default python is python2. You can run
    the check by activating the python3 virtual environment in sonic-mgmt docker container or outside of sonic-mgmt
    docker container.
  2. Ensure that the pre-commit package is installed:
sudo pip install pre-commit
  1. Go to repository root folder
  2. Install the pre-commit hooks:
pre-commit install
  1. Use pre-commit to check staged file:
pre-commit
  1. Alternatively, you can check committed files using:
pre-commit run --from-ref <commit_id> --to-ref <commit_id>

@saiarcot895
Copy link
Contributor

Looks like there's a failure because of the changes?

@fastiuk
Copy link
Contributor Author

fastiuk commented Nov 16, 2023

Looks like there's a failure because of the changes?

My bad, I missed the fact that expect_op_success calls patest.fail, and I can't catch it. Aligned the test, waiting for the result.
I made the test to be backward compatible with old version, so it should pass here. And we will see the result on the new code in sonic-net/sonic-buildimage#15058

@fastiuk
Copy link
Contributor Author

fastiuk commented Nov 16, 2023

@saiarcot895 updated

@liat-grozovik liat-grozovik merged commit dde0910 into sonic-net:master Nov 21, 2023
13 checks passed
qiluo-msft pushed a commit to sonic-net/sonic-buildimage that referenced this pull request Dec 11, 2023
hld [#1296](sonic-net/SONiC#1296)
closes [#1254](sonic-net/SONiC#1254)
depends-on [#60](sonic-net/sonic-host-services#60), [#781](sonic-net/sonic-swss-common#781), [#2835](sonic-net/sonic-utilities#2835), [#10749](sonic-net/sonic-mgmt#10749)

#### Why I did it
To cover the next AIs:
* Configure NTP global parameters
* Add/remove new NTP servers
* Change the configuration for NTP servers
* Show NTP status
* Show NTP configuration

### How I did it
* Add YANG model for a new configuration
* Extend configuration templates to support new knobs

### Description for the changelog
* Add ability to configure NTP global parameters such as authentication, dhcp, admin state
* Change the configuration for NTP servers
* Add an ability to show NTP configuration

#### Link to config_db schema for YANG module changes
[NTP configuration](https://github.com/sonic-net/sonic-buildimage/blob/master/src/sonic-yang-models/doc/Configuration.md#ntp-and-syslog-servers)
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.

NTP: Additional NTP configuration knobs + NTP server provisioning
4 participants