Skip to content

Check TACACS login performance by check how many commands run during login.#12149

Merged
qiluo-msft merged 3 commits intosonic-net:masterfrom
liuh-80:dev/liuh/test_login_latency
Mar 12, 2025
Merged

Check TACACS login performance by check how many commands run during login.#12149
qiluo-msft merged 3 commits intosonic-net:masterfrom
liuh-80:dev/liuh/test_login_latency

Conversation

@liuh-80
Copy link
Contributor

@liuh-80 liuh-80 commented Mar 25, 2024

Check TACACS login performance by check how many commands run during login.

Why I did it

When TACACS enabled, If some hardware SKU run too many commands during user login, it will cause login performance issue. Add new test case to check and prevent this happen.

Work item tracking
  • Microsoft ADO: 25504697

How I did it

Check how many commands run during user login.

How to verify it

Pass all test case.
Add new test case.

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

  • 201811
  • 201911
  • 202006
  • 202012
  • 202106
  • 202111
  • 202205
  • 202211
  • 202305

Tested branch (Please provide the tested image version)

will updated with this PR image later.

  • [] SONiC.master-16482.360728-2c8b4066f

Description for the changelog

Check TACACS login performance by check how many commands run during login.

Link to config_db schema for YANG module changes

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

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

Fixing tests/tacacs/test_authorization.py

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/tacacs/test_accounting.py:16:1: F401 'tests.common.errors.RunAnsibleModuleFail' imported but unused
tests/tacacs/test_authorization.py:65:1: F811 redefinition of unused 'ssh_run_command' from line 7
tests/tacacs/test_authorization.py:754:121: E501 line too long (149 > 120 characters)

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
  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>

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

Fixing tests/tacacs/test_authorization.py

fix end of files.........................................................Passed
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
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>

@liuh-80
Copy link
Contributor Author

liuh-80 commented Mar 26, 2024

This PR depends on #12146 merge first

@qiluo-msft
Copy link
Contributor

qiluo-msft commented Apr 28, 2024

@liuh-80 Please resolve conflicts. #Closed

@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.........................................................Failed
- hook id: check-ast
- exit code: 1

tests/tacacs/utils.py: failed parsing with CPython 3.8.10:

Traceback (most recent call last):
File "/home/AzDevOps/.cache/pre-commit/repo0aoxzddh/py_env-python3/lib/python3.8/site-packages/pre_commit_hooks/check_ast.py", line 21, in main
ast.parse(f.read(), filename=filename)
File "/usr/lib/python3.8/ast.py", line 47, in parse
return compile(source, filename, mode, flags,
File "tests/tacacs/utils.py", line 384
<<<<<<< HEAD
^
SyntaxError: invalid syntax
...
[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
  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>

@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/tacacs/test_authorization.py:14:1: F811 redefinition of unused 'check_server_received' from line 7

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>

@qiluo-msft
Copy link
Contributor

qiluo-msft commented Feb 24, 2025

Please resolve conflicts again. #Closed

@liuh-80 liuh-80 force-pushed the dev/liuh/test_login_latency branch from 8b50dd1 to cfd659b Compare March 10, 2025 07:45
@mssonicbld
Copy link
Collaborator

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@mssonicbld
Copy link
Collaborator

/azp run

@azure-pipelines
Copy link

Azure Pipelines will not run the associated pipelines, because the pull request was updated after the run command was issued. Review the pull request again and issue a new run command.

@liuh-80
Copy link
Contributor Author

liuh-80 commented Mar 10, 2025

/azpw run Azure.sonic-mgmt

@mssonicbld
Copy link
Collaborator

/AzurePipelines run Azure.sonic-mgmt

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@liuh-80 liuh-80 marked this pull request as ready for review March 10, 2025 09:36
@qiluo-msft qiluo-msft enabled auto-merge (squash) March 10, 2025 17:31
auto-merge was automatically disabled March 12, 2025 00:00

Head branch was pushed to by a user without write access

@mssonicbld
Copy link
Collaborator

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@qiluo-msft qiluo-msft merged commit 623e9e1 into sonic-net:master Mar 12, 2025
14 checks passed
nnelluri-cisco pushed a commit to nnelluri-cisco/sonic-mgmt that referenced this pull request Mar 15, 2025
…login. (sonic-net#12149)

Check TACACS login performance by check how many commands run during login.

Why I did it
When TACACS enabled, If some hardware SKU run too many commands during user login, it will cause login performance issue. Add new test case to check and prevent this happen.

Work item tracking
Microsoft ADO: 25504697
How I did it
Check how many commands run during user login.

How to verify it
Pass all test case.
Add new test case.
Description for the changelog
Check TACACS login performance by check how many commands run during login.
OriTrabelsi pushed a commit to OriTrabelsi/sonic-mgmt that referenced this pull request Apr 1, 2025
…login. (sonic-net#12149)

Check TACACS login performance by check how many commands run during login.

Why I did it
When TACACS enabled, If some hardware SKU run too many commands during user login, it will cause login performance issue. Add new test case to check and prevent this happen.

Work item tracking
Microsoft ADO: 25504697
How I did it
Check how many commands run during user login.

How to verify it
Pass all test case.
Add new test case.
Description for the changelog
Check TACACS login performance by check how many commands run during login.
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.

3 participants