sonic-net / sonic-mgmt

Configuration management examples for SONiC
Other
173 stars 691 forks source link

Setup TACACS server on ptf for daily work and none TACACS test case #13400

Open liuh-80 opened 1 month ago

liuh-80 commented 1 month ago

Setup TACACS server on ptf for daily work and none TACACS test case.

Why I did it

Improve TACACS feature coverage.

Work item tracking

How I did it

Setup TACACS server on PTF device and bind to port 49. Because one test bed may run test case in parallel with multiple DUT: For none TACACS test case, run test case with new TACACS server on port 49. For TACACS test case, run test case with old TACACS server on port 59. Force user login with TACACS account, account name is 'admin' password is the value in 'ansible_altpasswords' variable or 'ansible_altpassword' variable.

How to verify it

Pass all test case.

Which release branch to backport (provide reason below if selected)

Tested branch (Please provide the tested image version)

Description for the changelog

Setup TACACS server on ptf for daily work and none TACACS test case.

Link to config_db schema for YANG module changes

A picture of a cute animal (not mandatory but encouraged)

mssonicbld commented 1 month 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 ansible/scripts/tacacs_daily_daemon

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

Fixing ansible/scripts/start_tacacs.sh
Fixing ansible/scripts/tacacs_daily_daemon

check yaml...............................................................Passed
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>
mssonicbld commented 1 month 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.................................................Passed
fix end of files.........................................................Failed
- hook id: end-of-file-fixer
- exit code: 1
- files were modified by this hook

Fixing ansible/scripts/start_tacacs.sh

check yaml...............................................................Passed
check for added large files..............................................Passed
check python ast.........................................................Passed
flake8...................................................................Passed
flake8...............................................(no files to check)Skipped
check conditional mark sort..............................................Passed

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>
liuh-80 commented 4 weeks ago

This PR depends on https://github.com/sonic-net/sonic-mgmt/pull/13422 merge first, then this PR need merge with master branch again.

mssonicbld commented 2 weeks 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.................................................Passed
fix end of files.........................................................Failed
- hook id: end-of-file-fixer
- exit code: 1
- files were modified by this hook

Fixing docs/testbed/README.testbed.TACACS.md
Fixing docs/testbed/README.md
Fixing docs/testbed/README.testbed.Example.Config.md

check yaml...............................................................Passed
check for added large files..............................................Passed
check python ast.........................................................Passed
flake8...................................................................Passed
flake8...............................................(no files to check)Skipped
check conditional mark sort..............................................Passed

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>
mssonicbld commented 2 weeks 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 docs/testbed/README.testbed.TACACS.md

fix end of files.........................................................Passed
check yaml...............................................................Passed
check for added large files..............................................Passed
check python ast.........................................................Passed
flake8...................................................................Passed
flake8...............................................(no files to check)Skipped
check conditional mark sort..............................................Passed

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>
mssonicbld commented 1 week 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.................................................Passed
fix end of files.........................................................Passed
check yaml...............................................................Passed
check for added large files..............................................Passed
check python ast.........................................................Passed
flake8...................................................................Failed
- hook id: flake8
- exit code: 1

tests/common/fixtures/tacacs.py:14:1: E303 too many blank lines (3)

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

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>