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

Use xcvr_skip_list to skip sfp tests #4157

Merged
merged 1 commit into from
Sep 4, 2021

Conversation

prgeor
Copy link
Contributor

@prgeor prgeor commented Sep 1, 2021

Signed-off-by: Prince George prgeor@microsoft.com

Description of PR

This PR unifies two approaches to skip testing SFP on a port

  1. xcvr_skip_list - contains list of SFP ports of type "RJ45" and its read from hwsku.json
  2. pytest option --skip-absent-sfp which depends upon the SFP test api "get_presence"

2 is now removed in favor of 1 because 2 is not reliable since "get_presence()" itself is an API under test.

Ports under test will be those ports which are part of device connection graph.

Removed the test cases test_get_status(), test_get_position_in_parent() as the corresponding API is not used by SFP or not applicable for SFP.

Fixed compare_value_with_platform_facts() when list of SFPs can have holes due to some ports skipped from tests.

Fixes: sonic-net/sonic-buildimage#8436

Type of change

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

Back port request

  • 201911

Approach

What is the motivation for this PR?

Unify different approaches to skip testing a SFP port under one - xcvr_skip_list

How did you verify/test it?

Run tests in test_sfp.py with two scenarios:-

  1. All ports under tests
  2. Some ports skipped

Signed-off-by: Prince George <prgeor@microsoft.com>
@prgeor prgeor requested review from sujinmkang and a team as code owners September 1, 2021 08:38
@prgeor
Copy link
Contributor Author

prgeor commented Sep 1, 2021

@rawal01 @lguohan @yxieca can you please review

@lgtm-com
Copy link

lgtm-com bot commented Sep 1, 2021

This pull request introduces 1 alert when merging 8c15c5a into 1b9bc5b - view on LGTM.com

new alerts:

  • 1 for Unused local variable

@lguohan
Copy link
Contributor

lguohan commented Sep 1, 2021

i am ok with this approach.

--skip-absent-sfp is introduce by mellanox, I suggest to notify them before we actually remove this option, give a graceful period. So, I suggest to keep them for now.

I also do not think skip-absent-sfp is a good option, we should remove them, but let's give people time to adapt that.

@lguohan
Copy link
Contributor

lguohan commented Sep 1, 2021

the pr description is not clear. what is "port:-1"?

the reason to remove 2 is because 1? i do not see connection between 2 and 1.

@prgeor
Copy link
Contributor Author

prgeor commented Sep 1, 2021

the pr description is not clear. what is "port:-1"?

the reason to remove 2 is because 1? i do not see connection between 2 and 1.

@lguohan I updated the comment. Both 1 and 2 are used to skip test on a port. Instead of having both approaches, this PR is going with approach '1' i.e use 'xcvr_skip_list'

@prgeor
Copy link
Contributor Author

prgeor commented Sep 2, 2021

i am ok with this approach.

--skip-absent-sfp is introduce by mellanox, I suggest to notify them before we actually remove this option, give a graceful period. So, I suggest to keep them for now.

I also do not think skip-absent-sfp is a good option, we should remove them, but let's give people time to adapt that.

@lguohan checking with Mellanox team if its OK to remove --skip-absent-sfp option


for asic_index in duthost.get_frontend_asic_ids():
# Get interfaces of this asic
interface_list = get_port_map(duthost, asic_index)
interfaces_per_asic = {k:v for k, v in interface_list.items() if k in phy_intfs}
interfaces_per_asic = {k:v for k, v in interface_list.items() if k in logical_intfs}
Copy link
Collaborator

Choose a reason for hiding this comment

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

I had a chat with Guohan about this. I think the main issue is that we are running SFP test against disabled (admin down) ports. If we could skip the admin down ports, that would be a much easier and generic solution.

can you update PR with that approach?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes, we are passing all interfaces which are in conn_graph_facts that are based on the connection graph and will not include 'admin' down' port. get_physical_port_indices() is a helper function which will give indices for the input list of logical interfaces. The list of interfaces is formed in setup() fixture in test_sfp.py

@prgeor prgeor merged commit 1f9f642 into sonic-net:master Sep 4, 2021
@Blueve
Copy link
Contributor

Blueve commented Sep 14, 2021

@prgeor This PR is breaking test_sfp you modified in this PR: https://github.com/Azure/sonic-mgmt/pull/4099/files

vmittal-msft pushed a commit to vmittal-msft/sonic-mgmt that referenced this pull request Sep 28, 2021
Signed-off-by: Prince George <prgeor@microsoft.com>
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.

[202012 platform_tests ] TestSfpApi::test_get_presence failure on vms20-t1-7050cx3-3.1
4 participants