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

modifying snmp psu test to fit format using psu keys instead of index #11944

Open
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

gregoryboudreau
Copy link
Contributor

@gregoryboudreau gregoryboudreau commented Mar 11, 2024

Description of PR

Modifies SNMP test cases to use ordered offsets of psu keys instead of direct indexing for PSU information in the snmp facts

Summary:
Fixes testcase to work with modifications as a part of sonic-net/sonic-snmpagent#312

Type of change

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

Back port request

  • 201911
  • 202012
  • 202205
  • 202305
  • 202311

Approach

What is the motivation for this PR?

Fix SNMP test case to work with new implementation for psus

How did you do it?

Have snmp_psu info being traversed via an ordered offset for comparison with the SNMP populated facts

How did you verify/test it?

Ran modified test cases on Cisco SONiC distributed chassis

Any platform specific information?

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

Documentation

Related PRs:
sonic-net/sonic-utilities#3208
sonic-net/sonic-platform-daemons#446
sonic-net/sonic-snmpagent#312

@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/snmp/test_snmp_psu.py:15:1: E302 expected 2 blank lines, found 1

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>

@gechiang
Copy link
Contributor

gechiang commented Jun 3, 2024

/azp run

Copy link

Commenter does not have sufficient privileges for PR 11944 in repo sonic-net/sonic-mgmt

@gechiang gechiang requested review from prgeor and wangxin June 3, 2024 21:24
@gechiang
Copy link
Contributor

gechiang commented Jun 3, 2024

@wangxin , @prgeor
Please help review and restart the PR tests so that we can get fresh status to see what is the issue with the build failure.

@gregoryboudreau
Copy link
Contributor Author

@wangxin , @prgeor Please help review and restart the PR tests so that we can get fresh status to see what is the issue with the build failure.

seems that kvmtest-t0 is timing out after about 75% completion, seems its getting stuck somewhere. I wouldn't expect this behavior to happen as a result of this PR, worst this would do is cause a failure on the specific case though it shouldn't.

@gechiang
Copy link
Contributor

@wangxin , @prgeor Please help review and restart the PR tests so that we can get fresh status to see what is the issue with the build failure.

seems that kvmtest-t0 is timing out after about 75% completion, seems its getting stuck somewhere. I wouldn't expect this behavior to happen as a result of this PR, worst this would do is cause a failure on the specific case though it shouldn't.

Have kickstart the test again to see if it can pass now...

@abdosi
Copy link
Contributor

abdosi commented Sep 13, 2024

@SuvarnaMeenakshi : can you help review of this ?

@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/snmp/test_snmp_psu.py:6:1: F811 redefinition of unused 'logging' from line 2

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>

bpar9
bpar9 previously approved these changes Sep 20, 2024
Copy link
Contributor

@bpar9 bpar9 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@yejianquan
Copy link
Collaborator

/azp run

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@yejianquan
Copy link
Collaborator

@gregoryboudreau snmp/test_snmp_psu.py is failing in the PR test, please check

@gregoryboudreau
Copy link
Contributor Author

gregoryboudreau commented Sep 24, 2024

@gregoryboudreau snmp/test_snmp_psu.py is failing in the PR test, please check

if I had to guess, it seems the issue is due to a query for the PSU keys being piped into natsort occurring before the check below:

    # For kvm testbed, there is no snmp psu info
    if duthost.facts["asic_type"] == "vs":
        logging.info("No snmp psu info on kvm testbed.")
        return

Was a miss on my part! Will update.

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.

7 participants