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

[test_genric_hash.py]: cisco platform checks fix #16135

Merged
merged 4 commits into from
Jan 13, 2025

Conversation

harjotsinghpawra
Copy link
Contributor

@harjotsinghpawra harjotsinghpawra commented Dec 18, 2024

Description of PR

Cisco support different HASH algorithms and fields as of now than default

Some issues were because CISCO was not supporting certain hash algorithms and Fields which led to issues like below

/12/2024 03:58:04 __init__.pytest_runtest_call             L0040 ERROR  | Traceback (most recent call last):
  File "/usr/local/lib/python3.8/dist-packages/_pytest/python.py", line 1788, in runtest
    self.ihook.pytest_pyfunc_call(pyfuncitem=self)
  File "/usr/local/lib/python3.8/dist-packages/pluggy/_hooks.py", line 513, in __call__
    return self._hookexec(self.name, self._hookimpls.copy(), kwargs, firstresult)
  File "/usr/local/lib/python3.8/dist-packages/pluggy/_manager.py", line 120, in _hookexec
    return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
  File "/usr/local/lib/python3.8/dist-packages/pluggy/_callers.py", line 139, in _multicall
    raise exception.with_traceback(exception.__traceback__)
  File "/usr/local/lib/python3.8/dist-packages/pluggy/_callers.py", line 103, in _multicall
    res = hook_impl.function(*args)
  File "/usr/local/lib/python3.8/dist-packages/_pytest/python.py", line 194, in pytest_pyfunc_call
    result = testfunction(**testargs)
  File "/data/tests/hash/test_generic_hash.py", line 151, in test_ecmp_hash
    lag_hash_fields.remove(ecmp_test_hash_field)
ValueError: list.remove(x): x not in list

some algorithm config is missing i have listed one of many errors whose root cause is same

Summary:
Fixes # (issue)

Type of change

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

Back port request

  • 202012
  • 202205
  • 202305
  • 202311
  • 202405

Approach

What is the motivation for this PR?

  • To add support for CISCO specific supported hash alogrithms and fields

How did you do it?

  • added asic_type = 'cisco-8000'check for platform specific algo and fields to be picked

How did you verify/test it?

Tested it on T1/T0 cisco platforms where correct calulation was done after my fox and only supported fields were picked

Any platform specific information?

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

Documentation

@mssonicbld
Copy link
Collaborator

/azp run

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@mssonicbld
Copy link
Collaborator

/azp run

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@mssonicbld
Copy link
Collaborator

/azp run

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@harjotsinghpawra
Copy link
Contributor Author

/azp run

Copy link

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

@harjotsinghpawra harjotsinghpawra marked this pull request as ready for review December 19, 2024 19:41
@rajendrat
Copy link
Contributor

@wsycqyz @bpar9 : Please help review

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.

@harjotsinghpawra can you add rest of the info in the PR description template - Motivation for PR (what the current checks were lacking) (2) also how/which topo it was verified and need verification for both lag & non-lag

@harjotsinghpawra
Copy link
Contributor Author

@bpar9 Added more details in the PR

logging.info('Check only one port in a portchannel received traffic')
assert False, 'The traffic is balanced over portchannel members.'
if hit_port_number == len(self.expected_port_groups[0]):
logging.info('Check if all ports in a portchannel received traffic')
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think this change doesn't make sense here.The purpose of this function is to just check the load balancing not happening on the port channel.

assert _calculate_balance(expected_hit_cnt_per_port), "The balancing result is beyond the range."

expected_total_hit_cnt = self.balancing_test_times * len(self.expected_port_list)
lag_expected_total_hit_cnt = self.balancing_test_times * len(self.expected_port_groups[0])
Copy link
Collaborator

Choose a reason for hiding this comment

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

all the packet should reach to the same ECMP path in this function, the expected hit cunt should use expected_total_hit_cnt, rather than lag_expected_total_hit_cnt

@mssonicbld
Copy link
Collaborator

/azp run

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@harjotsinghpawra
Copy link
Contributor Author

@kevinskwang Hi kevin , i think i miss understood the test cases . I though that normal ECMP and lag hashes are tested individually . But i understand in one case we don't have any ECMP hash algorithm enabled and only enable lag hash algo then we test lag hash. Vice versa is also true where ECMP hash is tested and lag hash is disabled . I have reverted my changes back and only kept platform checks specific to CISCO . I hope my understanding of case is now correct

@bpar9
Copy link
Contributor

bpar9 commented Jan 10, 2025

@harjotsinghpawra , can you modify the title and description of the PR reflecting the reduced changes which the PR now has. Should specify that you are making only cisco related platform checks and remove the check_balance fix info as you have dropped those changes. Approved the PR for the current Cisco related changes

@harjotsinghpawra harjotsinghpawra changed the title [test_genric_hash.py]: cisco platform checks and some check_balance fix [test_genric_hash.py]: cisco platform checks fix Jan 10, 2025
@kevinskwang kevinskwang merged commit e9a000f into sonic-net:master Jan 13, 2025
19 checks passed
mssonicbld pushed a commit to mssonicbld/sonic-mgmt that referenced this pull request Jan 13, 2025
* [test_genric_hash.py]: cisco platform checks and some check_balance fix

* line spaces and artifact fixes

* indent fix

* check_balance fixes revert commit
@mssonicbld
Copy link
Collaborator

Cherry-pick PR to 202405: #16496

mssonicbld pushed a commit to mssonicbld/sonic-mgmt that referenced this pull request Jan 13, 2025
* [test_genric_hash.py]: cisco platform checks and some check_balance fix

* line spaces and artifact fixes

* indent fix

* check_balance fixes revert commit
@mssonicbld
Copy link
Collaborator

Cherry-pick PR to 202411: #16497

mssonicbld pushed a commit that referenced this pull request Jan 13, 2025
* [test_genric_hash.py]: cisco platform checks and some check_balance fix

* line spaces and artifact fixes

* indent fix

* check_balance fixes revert commit
mssonicbld pushed a commit that referenced this pull request Jan 15, 2025
* [test_genric_hash.py]: cisco platform checks and some check_balance fix

* line spaces and artifact fixes

* indent fix

* check_balance fixes revert commit
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants