예제 #1
0
    def test_get_fans_target_speed(self, duthosts,
                                   enum_rand_one_per_hwsku_hostname, localhost,
                                   platform_api_conn):

        for j in range(self.num_psus):
            num_fans = psu.get_num_fans(platform_api_conn, j)

            for i in range(num_fans):

                speed_target_val = 25
                speed_set = psu_fan.set_speed(platform_api_conn, j, i,
                                              speed_target_val)
                target_speed = psu_fan.get_target_speed(
                    platform_api_conn, j, i)
                if self.expect(
                        target_speed is not None,
                        "Unable to retrieve psu {} fan {} target speed".format(
                            j, i)):
                    if self.expect(
                            isinstance(target_speed, int),
                            "psu {} fan {} target speed appears incorrect".
                            format(j, i)):
                        self.expect(
                            target_speed == speed_target_val,
                            "psu {} fan {} target speed setting is not correct, speed_target_val {} target_speed = {}"
                            .format(j, i, speed_target_val, target_speed))

        self.assert_expectations()
예제 #2
0
    def test_get_fans_target_speed(self, duthosts,
                                   enum_rand_one_per_hwsku_hostname, localhost,
                                   platform_api_conn):

        duthost = duthosts[enum_rand_one_per_hwsku_hostname]
        psus_skipped = 0

        for j in range(self.num_psus):
            num_fans = psu.get_num_fans(platform_api_conn, j)
            fans_skipped = 0

            for i in range(num_fans):
                speed_target_val = 25
                speed_controllable = self.get_fan_facts(
                    duthost, j, i, True, "speed", "controllable")
                if not speed_controllable:
                    logger.info(
                        "test_get_fans_target_speed: Skipping PSU {} fan {} (speed not controllable)"
                        .format(j, i))
                    fans_skipped += 1
                    continue

                speed_minimum = self.get_fan_facts(duthost, j, i, 25, "speed",
                                                   "minimum")
                speed_maximum = self.get_fan_facts(duthost, j, i, 100, "speed",
                                                   "maximum")
                if speed_minimum > speed_target_val or speed_maximum < speed_target_val:
                    speed_target_val = random.randint(speed_minimum,
                                                      speed_maximum)

                speed_set = psu_fan.set_speed(platform_api_conn, j, i,
                                              speed_target_val)
                target_speed = psu_fan.get_target_speed(
                    platform_api_conn, j, i)
                if self.expect(
                        target_speed is not None,
                        "Unable to retrieve psu {} fan {} target speed".format(
                            j, i)):
                    if self.expect(
                            isinstance(target_speed, int),
                            "psu {} fan {} target speed appears incorrect".
                            format(j, i)):
                        self.expect(
                            target_speed == speed_target_val,
                            "psu {} fan {} target speed setting is not correct, speed_target_val {} target_speed = {}"
                            .format(j, i, speed_target_val, target_speed))

            if num_fans != 0 and fans_skipped == num_fans:
                psus_skipped += 1

        if psus_skipped == self.num_psus:
            pytest.skip("skipped as all PSU fans' speed is not controllable")

        self.assert_expectations()