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

[platform api] Fix sfp index #2937

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions tests/platform_tests/api/test_sfp.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,14 +115,14 @@ def setup(self, request, platform_api_conn):
self.candidate_sfp = []
if self.skip_absent_sfp:
# Skip absent SFP if option "--skip-absent-sfp" set to True
for i in range(self.num_sfps):
for i in range(1, self.num_sfps + 1):
try:
if sfp.get_presence(platform_api_conn, i):
self.candidate_sfp.append(i)
except Exception:
pytest.fail("get_presence API is not supported, failed to compose present SFP list")
else:
self.candidate_sfp = range(self.num_sfps)
self.candidate_sfp = range(1, self.num_sfps + 1)
#
# Helper functions
#
Expand All @@ -133,7 +133,7 @@ def compare_value_with_platform_facts(self, key, value, sfp_idx):
if self.chassis_facts:
expected_sfps = self.chassis_facts.get("sfps")
if expected_sfps:
expected_value = expected_sfps[sfp_idx].get(key)
expected_value = expected_sfps[sfp_idx - 1].get(key)

if self.expect(expected_value is not None,
"Unable to get expected value for '{}' from platform.json file for SFP {}".format(key, sfp_idx)):
Expand Down