sonic-net / sonic-mgmt

Configuration management examples for SONiC
Other
194 stars 712 forks source link

[Golden Config Override] Build test infra to simulate NDM override behavior to test new features #13477

Closed wen587 closed 2 months ago

wen587 commented 3 months ago

Description of PR

Summary: This PR is to build a test insfrasture to simulate the process of Golden Config override with new table or exisitint tables. Fixes # (issue)

Type of change

Back port request

Approach

What is the motivation for this PR?

There is a need to validate new feature or new tables without change in minigraph parser. Here we setup a test infrastructure to mimic the behavior of Golden Config override process and override ConfigDB with the desired template.

How did you do it?

Define a new way of config reload with override. Add a common template to generate common feature and add a test case to generate specific table to test.

How did you verify/test it?

E2E test

Any platform specific information?

Supported testbed topology if it's a new test case?

Documentation

mssonicbld commented 3 months ago

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.................................................Failed
- hook id: trailing-whitespace
- exit code: 1
- files were modified by this hook

Fixing tests/golden_config_infra/test_config_reload_with_rendered_golden_config.py

fix end of files.........................................................Failed
- hook id: end-of-file-fixer
- exit code: 1
- files were modified by this hook

Fixing tests/common/templates/goldel_config_db.j2
Fixing tests/golden_config_infra/templates/sample_goldel_config_db.j2

check yaml...........................................(no files to check)Skipped
check for added large files..............................................Passed
check python ast.........................................................Passed
flake8...................................................................Passed
flake8...............................................(no files to check)Skipped
...
[truncated extra lines, please run pre-commit locally to view full check results]

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
  3. Go to repository root folder
  4. Install the pre-commit hooks:
    pre-commit install
  5. Use pre-commit to check staged file:
    pre-commit
  6. Alternatively, you can check committed files using:
    pre-commit run --from-ref <commit_id> --to-ref <commit_id>
isabelmsft commented 2 months ago

LGTM with suggestion to replace NDM mention in description to general "golden config override" description, as in code changes

bingwang-ms commented 2 months ago

@wen587 @qiluo-msft Do we need this PR for release branches?

wen587 commented 1 month ago

Hi @bingwang-ms , it should be include in 202405.

mssonicbld commented 1 month ago

@wen587 PR conflicts with 202405 branch

wen587 commented 1 month ago

Hi @bingwang-ms , please check conflict resolve PR: https://github.com/sonic-net/sonic-mgmt/pull/13997 Only diff is .azure-pipelines/pr_test_scripts.yaml