def test_modules(self, duthosts, enum_rand_one_per_hwsku_hostname, localhost, platform_api_conn): try: num_modules = int(chassis.get_num_modules(platform_api_conn)) except: pytest.fail("num_modules is not an integer") else: if num_modules == 0: pytest.skip("No modules found on device") module_list = chassis.get_all_modules(platform_api_conn) pytest_assert(module_list is not None, "Failed to retrieve modules") pytest_assert( isinstance(module_list, list) and len(module_list) == num_modules, "Modules appear to be incorrect") for i in range(num_modules): module_idx = chassis.get_module(platform_api_conn, i) module_name = module.get_name(platform_api_conn, i) module_index = chassis.get_module_index(platform_api_conn, module_name) self.expect(module_idx and module_idx == module_list[i], "Module {} is incorrect".format(i)) self.expect(module_index == i, "Module index {} is not correct".format(module_index)) self.assert_expectations()
def test_modules(self, duthost, localhost, platform_api_conn): try: num_modules = int(chassis.get_num_modules(platform_api_conn)) except: pytest.fail("num_modules is not an integer") module_list = chassis.get_all_modules(platform_api_conn) pytest_assert(module_list is not None, "Failed to retrieve modules") pytest_assert(isinstance(module_list, list) and len(module_list) == num_modules, "Modules appear to be incorrect") for i in range(num_modules): module = chassis.get_module(platform_api_conn, i) self.expect(module and module == module_list[i], "Module {} is incorrect".format(i)) self.assert_expectations()