Skip to content

[platform][test_auto_negotiation] Fix issue where the port selection exceed boundary#4055

Merged
Blueve merged 15 commits intosonic-net:masterfrom
Blueve:dev/jika/negotiation
Aug 24, 2021
Merged

[platform][test_auto_negotiation] Fix issue where the port selection exceed boundary#4055
Blueve merged 15 commits intosonic-net:masterfrom
Blueve:dev/jika/negotiation

Conversation

@Blueve
Copy link
Collaborator

@Blueve Blueve commented Aug 17, 2021

Description of PR

Summary:
This PR is for fixing an issue hwere the port selection exceed boundary in test_auto_negotiation.
The issue were introduced from this PR: #3376

According the original code, the intend is to build a candidates list before run testing. However we will only get one candidate if we put a dedicate port name to build_test_candidates() and then all test will failed to setup due to we cannot sampling 3 ports from a list that contains only 1 item.

Type of change

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

Back port request

  • 201911

Approach

What is the motivation for this PR?

The issue were introduced from this PR: #3376

According the original code, the intend is to build a candidates list before run testing. However we will only get one candidate if we put a dedicate port name to build_test_candidates() and then all test will failed to setup due to we cannot sampling 3 ports from a list that contains only 1 item.

How did you do it?

  1. Make sure the setup fixture get all ports before sampling
  2. Add extra protection to the sampling method in case a device have less than 3 ports
  3. Refactor tests, make test_force_speed and test_auto_negotiation_advertised_each_speed parameterlize
  4. Update EOS object to support new hardware command since the original one has deprecated on new OS
  5. Update SONiC object to avoid crash when OS not support interface neg command

How did you verify/test it?

Test on physical DUT which connected to a fanout that not support auto-neg

All tests are skipped

Test on physical DUT which support auto-neg

All tests are passed except test_auto_negotiation_advertised_each_speed due to platform limitation

Any platform specific information?

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

Documentation

logger.info('Collecting existing port configuration for DUT and fanout...')
for duthost in duthosts:
if dutname == 'unknown' or dutname == duthost.hostname:
all_ports = build_test_candidates(duthost, fanouthosts, portname)
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

We will get a list that contains only 1 port by this way.
If we want to enumerate all ports, we have to put "all_ports" in it parameter list.

@Blueve Blueve changed the title [platform][test_auto_negotiation] Fix issue where the port selection … [platform][test_auto_negotiation] Fix issue where the port selection exceed boundary Aug 17, 2021
@lgtm-com
Copy link

lgtm-com bot commented Aug 18, 2021

This pull request introduces 1 alert when merging c359fa7 into 55b8b67 - view on LGTM.com

new alerts:

  • 1 for Testing equality to None

@Blueve Blueve marked this pull request as ready for review August 18, 2021 02:47
@Blueve Blueve requested review from a team and sujinmkang as code owners August 18, 2021 02:47
@lgtm-com
Copy link

lgtm-com bot commented Aug 18, 2021

This pull request introduces 1 alert when merging d790a35 into 55b8b67 - view on LGTM.com

new alerts:

  • 1 for Testing equality to None

@Blueve Blueve requested a review from sujinmkang August 24, 2021 02:12
@Blueve Blueve merged commit e85f7cd into sonic-net:master Aug 24, 2021
@Blueve Blueve deleted the dev/jika/negotiation branch August 24, 2021 23:50
vmittal-msft pushed a commit to vmittal-msft/sonic-mgmt that referenced this pull request Sep 28, 2021
…exceed boundary (sonic-net#4055)

* [platform][test_auto_negotiation] Fix issue where the port selection exceed boundary

* Enumerate all ports for selecting candidaties
* Only do the sampling for DUT once
* Refactor test
* Skip test if fanout does not support setting auto-neg mode
* Support new eos hardware command

Signed-off-by: Jing Kan [email protected]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants