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

[9332][platform_test] PSU API test_power fails since get_maximum_supplied_power is not implemented #8646

Closed
tjchadaga opened this issue Sep 1, 2021 · 1 comment

Comments

@tjchadaga
Copy link
Contributor

tjchadaga commented Sep 1, 2021

Description

PSU api test - test_power fails since get_maximum_supplied_power is not

Steps to reproduce the issue:

  1. Run TestPsuApi::test_power script on 9332 testbed

Describe the results you received:

Test case fails with the following error due to unimplemented API

    def test_power(self, duthost, localhost, platform_api_conn):
        ''' PSU power test '''
        for psu_id in range(self.num_psus):
            name = psu.get_name(platform_api_conn, psu_id)
            if name in self.psu_skip_list:
                logger.info("skipping check for {}".format(name))
            else:
                voltage = psu.get_voltage(platform_api_conn, psu_id)
                if self.expect(voltage is not None, "Failed to retrieve voltage of PSU {}".format(psu_id)):
                    self.expect(isinstance(voltage, float), "PSU {} voltage appears incorrect".format(psu_id))
                current = psu.get_current(platform_api_conn, psu_id)
                if self.expect(current is not None, "Failed to retrieve current of PSU {}".format(psu_id)):
                    self.expect(isinstance(current, float), "PSU {} current appears incorrect".format(psu_id))
                power = psu.get_power(platform_api_conn, psu_id)
                if self.expect(power is not None, "Failed to retrieve power of PSU {}".format(psu_id)):
                    self.expect(isinstance(power, float), "PSU {} power appears incorrect".format(psu_id))
                max_supp_power = psu.get_maximum_supplied_power(platform_api_conn, psu_id)
                if self.expect(max_supp_power is not None,
                               "Failed to retrieve maximum supplied power power of PSU {}".format(psu_id)):
                    self.expect(isinstance(power, float), "PSU {} power appears incorrect".format(psu_id))
    
                if current is not None and voltage is not None and power is not None:
                    self.expect(abs(power - (voltage*current)) < power*0.1, "PSU {} reading does not make sense \
                        (power:{}, voltage:{}, current:{})".format(psu_id, power, voltage, current))
    
                powergood_status = psu.get_powergood_status(platform_api_conn, psu_id)
                if self.expect(powergood_status is not None, "Failed to retrieve operational status of PSU {}".format(psu_id)):
                    self.expect(powergood_status is True, "PSU {} is not operational".format(psu_id))
    
                high_threshold = psu.get_voltage_high_threshold(platform_api_conn, psu_id)
                if self.expect(high_threshold is not None, "Failed to retrieve the high voltage threshold of PSU {}".format(psu_id)):
                    self.expect(isinstance(high_threshold, float), "PSU {} voltage high threshold appears incorrect".format(psu_id))
                low_threshold = psu.get_voltage_low_threshold(platform_api_conn, psu_id)
                if self.expect(low_threshold is not None, "Failed to retrieve the low voltage threshold of PSU {}".format(psu_id)):
                    self.expect(isinstance(low_threshold, float), "PSU {} voltage low threshold appears incorrect".format(psu_id))
                if high_threshold is not None and low_threshold is not None:
                    self.expect(voltage < high_threshold and voltage > low_threshold,
                                "Voltage {} of PSU {} is not in between {} and {}".format(voltage, psu_id,
                                                                                          low_threshold,
                                                                                          high_threshold))
>       self.assert_expectations()

current    = 34.0
duthost    = <MultiAsicSonicHost> str2-z9332f-01
high_threshold = 12.6
localhost  = <tests.common.devices.local.Localhost object at 0x7f101aad5590>
low_threshold = 11.4
max_supp_power = None
name       = 'PSU2'
platform_api_conn = <httplib.HTTPConnection instance at 0x7f1003725d20>
power      = 408.0
powergood_status = True
psu_id     = 1
self       = <test_psu.TestPsuApi object at 0x7f10039d6a50>
voltage    = 12.0

platform_tests/api/test_psu.py:199: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <test_psu.TestPsuApi object at 0x7f10039d6a50>

    def assert_expectations(self):
        """
        Checks if there are any error messages waiting in failed_expectations.
        If so, it will fail an assert and pass a concatenation of all pending
        error messages. It will also clear failed_expectations to prepare it
        for the next use.
        """
        if len(self.failed_expectations) > 0:
            err_msg = ", ".join(self.failed_expectations)
            # TODO: When we move to Python 3.3+, we can use self.failed_expectations.clear() instead
            del self.failed_expectations[:]
>           pytest_assert(False, err_msg)
E           Failed: Failed to retrieve maximum supplied power power of PSU 1

err_msg    = 'Failed to retrieve maximum supplied power power of PSU 1'
self       = <test_psu.TestPsuApi object at 0x7f10039d6a50>

platform_tests/api/platform_api_test_base.py:32: Failed

Syslog

Sep  1 02:17:09.441082 str2-z9332f-05 WARNING pmon#platform_api_server.py: API 'get_maximum_supplied_power' not implemented

Describe the results you expected:

test case should pass

Output of show version:

SONiC Software Version: SONiC.20201231.20
Distribution: Debian 10.10
Kernel: 4.19.0-12-2-amd64
Build commit: 21a1781936
Build date: Fri Aug 27 14:24:54 UTC 2021
Built by: AzDevOps@sonic-int-build-workers-00036B

Platform: x86_64-dellemc_z9332f_d1508-r0
HwSKU: DellEMC-Z9332f-M-O16C64
ASIC: broadcom
ASIC Count: 1
Serial Number: TH04CN21CET0004K0123
Uptime: 02:40:43 up 53 min,  1 user,  load average: 1.02, 1.22, 1.16

Output of show techsupport:

(paste your output here or download and attach the file here )

Additional information you deem important (e.g. issue happens only occasionally):

Issue is easily reproducible

@tjchadaga
Copy link
Contributor Author

APIs added as part of #8787

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant