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

Leave 1 ACL rule in test_crm.py::test_acl_entry #9054

Merged

Conversation

arista-nwolfe
Copy link
Contributor

Some platforms (like broadcom-dnx) allocate ACL banks dynamically so if there are no ACL rules it returns a NULL value for CRM purposes. So leave 1 ACL rule when comparing the returned used/available CRM values.

Also on broadcom-dnx an ACL entry is used per bind point so account for that when calculating the expected available acl entries.

Summary:
Fixes #8812

Type of change

  • Test case(new/improvement)

Back port request

  • 202205
  • 202305

Some platforms (like broadcom-dnx) allocate ACL banks dynamically so if
there are no ACL rules it returns a NULL value for CRM purposes.
@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/crm/test_crm.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/crm/test_crm.py:942:27: E201 whitespace after '['
tests/crm/test_crm.py:942:34: E202 whitespace before ']'
tests/crm/test_crm.py:946:49: E201 whitespace after '('
tests/crm/test_crm.py:946:65: E202 whitespace before ')'
tests/crm/test_crm.py:947:41: E201 whitespace after '('
...
[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>

@kenneth-arista
Copy link
Contributor

@arlakshm FYI

@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/crm/test_crm.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/crm/test_crm.py:952:121: E501 line too long (156 > 120 characters)
tests/crm/test_crm.py:954:121: E501 line too long (131 > 120 characters)
tests/crm/test_crm.py:991:1: E302 expected 2 blank lines, found 1

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>

@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/crm/test_crm.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/crm/test_crm.py:953:15: E127 continuation line over-indented for visual indent

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>

@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/crm/test_crm.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/crm/test_crm.py:953:41: E127 continuation line over-indented for visual indent

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>

@rlhui rlhui requested a review from arlakshm July 26, 2023 17:21
Copy link
Contributor

@judyjoseph judyjoseph left a comment

Choose a reason for hiding this comment

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

Could you share the brcm CSP if you have one to get more details

@arista-nwolfe
Copy link
Contributor Author

This is briefly talked about in CSP CS00012288540.
We also discussed this change in a bit more detail in an email, I'll forward you the email Judy.

@kenneth-arista
Copy link
Contributor

@arlakshm can we merge this PR?

@arlakshm arlakshm merged commit 91b76e3 into sonic-net:master Aug 3, 2023
12 checks passed
mssonicbld pushed a commit to mssonicbld/sonic-mgmt that referenced this pull request Aug 4, 2023
Some platforms (like broadcom-dnx) allocate ACL banks dynamically so if there are no ACL rules it returns a NULL value for CRM purposes. So leave 1 ACL rule when comparing the returned used/available CRM values.

Also on broadcom-dnx an ACL entry is used per bind point so account for that when calculating the expected available acl entries.

Summary:
Fixes sonic-net#8812

Type of change
 Test case(new/improvement)
Back port request
 202205
 202305
@mssonicbld
Copy link
Collaborator

Cherry-pick PR to 202205: #9271

mssonicbld pushed a commit to mssonicbld/sonic-mgmt that referenced this pull request Aug 4, 2023
Some platforms (like broadcom-dnx) allocate ACL banks dynamically so if there are no ACL rules it returns a NULL value for CRM purposes. So leave 1 ACL rule when comparing the returned used/available CRM values.

Also on broadcom-dnx an ACL entry is used per bind point so account for that when calculating the expected available acl entries.

Summary:
Fixes sonic-net#8812

Type of change
 Test case(new/improvement)
Back port request
 202205
 202305
@mssonicbld
Copy link
Collaborator

Cherry-pick PR to 202305: #9272

mssonicbld pushed a commit that referenced this pull request Aug 4, 2023
Some platforms (like broadcom-dnx) allocate ACL banks dynamically so if there are no ACL rules it returns a NULL value for CRM purposes. So leave 1 ACL rule when comparing the returned used/available CRM values.

Also on broadcom-dnx an ACL entry is used per bind point so account for that when calculating the expected available acl entries.

Summary:
Fixes #8812

Type of change
 Test case(new/improvement)
Back port request
 202205
 202305
mssonicbld pushed a commit that referenced this pull request Aug 5, 2023
Some platforms (like broadcom-dnx) allocate ACL banks dynamically so if there are no ACL rules it returns a NULL value for CRM purposes. So leave 1 ACL rule when comparing the returned used/available CRM values.

Also on broadcom-dnx an ACL entry is used per bind point so account for that when calculating the expected available acl entries.

Summary:
Fixes #8812

Type of change
 Test case(new/improvement)
Back port request
 202205
 202305
yutongzhang-microsoft added a commit that referenced this pull request Aug 18, 2023
Description of PR
In PR #9054, it will try to get duthost.facts["platform_asic"] in test_crm.py, but in file tests/common/devices/sonic.py, which define the duthost.facts, platform_asic may not exist in duthost.facts. And this will cause KeyError in test_crm.py. In this PR, if platform_asic doesn't exist in duthost.facts, we set it None.

What is the motivation for this PR?
In PR #9054, it will try to get duthost.facts["platform_asic"] in test_crm.py, but in file tests/common/devices/sonic.py, which define the duthost.facts, platform_asic may not exist in duthost.facts. And this will cause KeyError in test_crm.py. In this PR, if platform_asic doesn't exist in duthost.facts, we set it None.

Signed-off-by: Yutong Zhang <yutongzhang@microsoft.com>
mssonicbld pushed a commit to mssonicbld/sonic-mgmt that referenced this pull request Aug 28, 2023
Description of PR
In PR sonic-net#9054, it will try to get duthost.facts["platform_asic"] in test_crm.py, but in file tests/common/devices/sonic.py, which define the duthost.facts, platform_asic may not exist in duthost.facts. And this will cause KeyError in test_crm.py. In this PR, if platform_asic doesn't exist in duthost.facts, we set it None.

What is the motivation for this PR?
In PR sonic-net#9054, it will try to get duthost.facts["platform_asic"] in test_crm.py, but in file tests/common/devices/sonic.py, which define the duthost.facts, platform_asic may not exist in duthost.facts. And this will cause KeyError in test_crm.py. In this PR, if platform_asic doesn't exist in duthost.facts, we set it None.

Signed-off-by: Yutong Zhang <yutongzhang@microsoft.com>
mssonicbld pushed a commit to mssonicbld/sonic-mgmt that referenced this pull request Aug 28, 2023
Description of PR
In PR sonic-net#9054, it will try to get duthost.facts["platform_asic"] in test_crm.py, but in file tests/common/devices/sonic.py, which define the duthost.facts, platform_asic may not exist in duthost.facts. And this will cause KeyError in test_crm.py. In this PR, if platform_asic doesn't exist in duthost.facts, we set it None.

What is the motivation for this PR?
In PR sonic-net#9054, it will try to get duthost.facts["platform_asic"] in test_crm.py, but in file tests/common/devices/sonic.py, which define the duthost.facts, platform_asic may not exist in duthost.facts. And this will cause KeyError in test_crm.py. In this PR, if platform_asic doesn't exist in duthost.facts, we set it None.

Signed-off-by: Yutong Zhang <yutongzhang@microsoft.com>
mssonicbld pushed a commit that referenced this pull request Aug 28, 2023
Description of PR
In PR #9054, it will try to get duthost.facts["platform_asic"] in test_crm.py, but in file tests/common/devices/sonic.py, which define the duthost.facts, platform_asic may not exist in duthost.facts. And this will cause KeyError in test_crm.py. In this PR, if platform_asic doesn't exist in duthost.facts, we set it None.

What is the motivation for this PR?
In PR #9054, it will try to get duthost.facts["platform_asic"] in test_crm.py, but in file tests/common/devices/sonic.py, which define the duthost.facts, platform_asic may not exist in duthost.facts. And this will cause KeyError in test_crm.py. In this PR, if platform_asic doesn't exist in duthost.facts, we set it None.

Signed-off-by: Yutong Zhang <yutongzhang@microsoft.com>
mssonicbld pushed a commit that referenced this pull request Aug 28, 2023
Description of PR
In PR #9054, it will try to get duthost.facts["platform_asic"] in test_crm.py, but in file tests/common/devices/sonic.py, which define the duthost.facts, platform_asic may not exist in duthost.facts. And this will cause KeyError in test_crm.py. In this PR, if platform_asic doesn't exist in duthost.facts, we set it None.

What is the motivation for this PR?
In PR #9054, it will try to get duthost.facts["platform_asic"] in test_crm.py, but in file tests/common/devices/sonic.py, which define the duthost.facts, platform_asic may not exist in duthost.facts. And this will cause KeyError in test_crm.py. In this PR, if platform_asic doesn't exist in duthost.facts, we set it None.

Signed-off-by: Yutong Zhang <yutongzhang@microsoft.com>
AharonMalkin pushed a commit to AharonMalkin/sonic-mgmt that referenced this pull request Jan 25, 2024
Some platforms (like broadcom-dnx) allocate ACL banks dynamically so if there are no ACL rules it returns a NULL value for CRM purposes. So leave 1 ACL rule when comparing the returned used/available CRM values.

Also on broadcom-dnx an ACL entry is used per bind point so account for that when calculating the expected available acl entries.

Summary:
Fixes sonic-net#8812

Type of change
 Test case(new/improvement)
Back port request
 202205
 202305
AharonMalkin pushed a commit to AharonMalkin/sonic-mgmt that referenced this pull request Jan 25, 2024
Description of PR
In PR sonic-net#9054, it will try to get duthost.facts["platform_asic"] in test_crm.py, but in file tests/common/devices/sonic.py, which define the duthost.facts, platform_asic may not exist in duthost.facts. And this will cause KeyError in test_crm.py. In this PR, if platform_asic doesn't exist in duthost.facts, we set it None.

What is the motivation for this PR?
In PR sonic-net#9054, it will try to get duthost.facts["platform_asic"] in test_crm.py, but in file tests/common/devices/sonic.py, which define the duthost.facts, platform_asic may not exist in duthost.facts. And this will cause KeyError in test_crm.py. In this PR, if platform_asic doesn't exist in duthost.facts, we set it None.

Signed-off-by: Yutong Zhang <yutongzhang@microsoft.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment