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

Support both str and int type for slot_id received in pmon API #5518

Merged
merged 1 commit into from
May 18, 2022
Merged
Show file tree
Hide file tree
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
4 changes: 2 additions & 2 deletions tests/platform_tests/api/test_chassis.py
Original file line number Diff line number Diff line change
Expand Up @@ -530,13 +530,13 @@ def test_get_eeprom(self, duthosts, enum_rand_one_per_hwsku_hostname, localhost,
def test_get_supervisor_slot(self, duthosts, enum_rand_one_per_hwsku_hostname, localhost, platform_api_conn):
if chassis.is_modular_chassis(platform_api_conn):
sup_slot = chassis.get_supervisor_slot(platform_api_conn)
pytest_assert(isinstance(sup_slot, int), "supervisor slot is not type integer")
pytest_assert(isinstance(sup_slot, int) or isinstance(sup_slot, STRING_TYPE), "supervisor slot is not type integer")
else:
pytest.skip("skipped as this test is applicable to modular chassis only")

def test_get_my_slot(self, duthosts, enum_rand_one_per_hwsku_hostname, localhost, platform_api_conn):
if chassis.is_modular_chassis(platform_api_conn):
my_slot = chassis.get_my_slot(platform_api_conn)
pytest_assert(isinstance(my_slot, int), "supervisor slot is not type integer")
pytest_assert(isinstance(my_slot, int) or isinstance(my_slot, STRING_TYPE), "supervisor slot is not type integer")
else:
pytest.skip("skipped as this test is applicable to modular chassis only")
2 changes: 1 addition & 1 deletion tests/platform_tests/api/test_module.py
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,7 @@ def test_get_slot(self, duthosts, enum_rand_one_per_hwsku_hostname, localhost, p
for i in range(self.num_modules):
slot_id = module.get_slot(platform_api_conn, i)
if self.expect(slot_id is not None, "Unable to retrieve module {} slot id".format(i)):
self.expect(isinstance(slot_id, int), "Module {} slot id is not correct ".format(i))
self.expect(isinstance(slot_id, int) or isinstance(slot_id, STRING_TYPE), "Module {} slot id is not correct ".format(i))
self.assert_expectations()

def test_get_type(self, duthosts, enum_rand_one_per_hwsku_hostname, localhost, platform_api_conn):
Expand Down