From cef5e142eb2ed15fab73aea03b71085fe7faf6d0 Mon Sep 17 00:00:00 2001 From: Joe LeVeque Date: Wed, 14 Oct 2020 02:26:46 +0000 Subject: [PATCH] [Platform API][Chassis][Module] Remove tests for deprecated, redundant get_serial_number() methods --- tests/common/helpers/platform_api/chassis.py | 4 ---- tests/common/helpers/platform_api/module.py | 4 ---- tests/platform_tests/api/test_chassis.py | 13 ------------ tests/platform_tests/api/test_module.py | 21 +------------------- 4 files changed, 1 insertion(+), 41 deletions(-) diff --git a/tests/common/helpers/platform_api/chassis.py b/tests/common/helpers/platform_api/chassis.py index 6e3424745d1..1893f9e9cbe 100644 --- a/tests/common/helpers/platform_api/chassis.py +++ b/tests/common/helpers/platform_api/chassis.py @@ -52,10 +52,6 @@ def get_base_mac(conn): return chassis_api(conn, 'get_base_mac') -def get_serial_number(conn): - return chassis_api(conn, 'get_serial_number') - - def get_system_eeprom_info(conn): return chassis_api(conn, 'get_system_eeprom_info') diff --git a/tests/common/helpers/platform_api/module.py b/tests/common/helpers/platform_api/module.py index cc92f732e21..ee83870e906 100644 --- a/tests/common/helpers/platform_api/module.py +++ b/tests/common/helpers/platform_api/module.py @@ -54,10 +54,6 @@ def get_base_mac(conn, mod_idx): return module_api(conn, mod_idx, 'get_base_mac') -def get_serial_number(conn, mod_idx): - return module_api(conn, mod_idx, 'get_serial_number') - - def get_system_eeprom_info(conn, mod_idx): return module_api(conn, mod_idx, 'get_system_eeprom_info') diff --git a/tests/platform_tests/api/test_chassis.py b/tests/platform_tests/api/test_chassis.py index 77f13216279..63973f65702 100644 --- a/tests/platform_tests/api/test_chassis.py +++ b/tests/platform_tests/api/test_chassis.py @@ -146,19 +146,6 @@ def test_get_base_mac(self, duthost, localhost, platform_api_conn): pytest_assert(re.match(REGEX_MAC_ADDRESS, base_mac), "Base MAC address appears to be incorrect") self.compare_value_with_device_facts('base_mac', base_mac, False) - def test_get_serial_number(self, duthost, localhost, platform_api_conn): - # Ensure the serial number is sane - # Note: It appears that when retrieving some variable-length fields, - # the value is padded with trailing '\x00' bytes because the field - # length is longer than the actual value, so we strip those bytes - # here before comparing. We may want to change the EEPROM parsing - # logic to ensure that trailing '\x00' bytes are removed when retreiving - # a variable-length value. - serial = chassis.get_serial_number(platform_api_conn).rstrip('\x00') - pytest_assert(serial is not None, "Failed to retrieve serial number") - pytest_assert(re.match(REGEX_SERIAL_NUMBER, serial), "Serial number appears to be incorrect") - self.compare_value_with_device_facts('serial', serial) - def test_get_system_eeprom_info(self, duthost, localhost, platform_api_conn): ''' Test that we can retrieve sane system EEPROM info from the DUT via the platform API ''' diff --git a/tests/platform_tests/api/test_module.py b/tests/platform_tests/api/test_module.py index 1377315ce66..0df9aa6b9fc 100644 --- a/tests/platform_tests/api/test_module.py +++ b/tests/platform_tests/api/test_module.py @@ -107,7 +107,7 @@ def test_get_serial(self, duthost, localhost, platform_api_conn): for i in range(self.num_modules): serial = module.get_serial(platform_api_conn, i) - if self.expect(serial is not None, "Unable to retrieve module {} serial number".format(i)): + if self.expect(serial is not None, "Module {}: Failed to retrieve serial number".format(i)): self.expect(isinstance(serial, STRING_TYPE), "Module {} serial number appears incorrect".format(i)) self.assert_expectations() @@ -138,25 +138,6 @@ def test_get_base_mac(self, duthost, localhost, platform_api_conn): self.expect(re.match(REGEX_MAC_ADDRESS, base_mac), "Module {}: Base MAC address appears to be incorrect".format(i)) self.assert_expectations() - def test_get_serial_number(self, duthost, localhost, platform_api_conn): - if self.num_modules == 0: - pytest.skip("No modules found on device") - - # Ensure the serial number of each module is sane - # Note: It appears that when retrieving some variable-length fields, - # the value is padded with trailing '\x00' bytes because the field - # length is longer than the actual value, so we strip those bytes - # here before comparing. We may want to change the EEPROM parsing - # logic to ensure that trailing '\x00' bytes are removed when retreiving - # a variable-length value. - # TODO: Add expected serial number of each module to inventory file and compare against it - for i in range(self.num_modules): - serial = module.get_serial_number(platform_api_conn, i).rstrip('\x00') - if not self.expect(serial is not None, "Module {}: Failed to retrieve serial number".format(i)): - continue - self.expect(re.match(REGEX_SERIAL_NUMBER, serial), "Module {}: Serial number appears to be incorrect".format(i)) - self.assert_expectations() - def test_get_system_eeprom_info(self, duthost, localhost, platform_api_conn): """ Test that we can retrieve sane system EEPROM info from each module of the DUT via the platform API