コード例 #1
0
ファイル: test_thermal.py プロジェクト: nazariig/sonic-mgmt
    def test_set_high_threshold(self, duthosts, enum_rand_one_per_hwsku_hostname, localhost, platform_api_conn):
        duthost = duthosts[enum_rand_one_per_hwsku_hostname]
        thermals_skipped = 0
        skip_release_for_platform(duthost, ["202012", "201911", "201811"], ["arista"])

        # Ensure the thermal temperature is sane
        for i in range(self.num_thermals):
            threshold_supported = self.get_thermal_facts(duthost, i, True, "high-threshold")
            threshold_controllable = self.get_thermal_facts(duthost, i, True, "controllable")
            if not threshold_supported or not threshold_controllable:
                logger.info("test_set_high_threshold: Skipping thermal {} (threshold not controllable)".format(i))
                thermals_skipped += 1
                continue

            high_temperature = 80
            result = thermal.set_high_threshold(platform_api_conn, i, high_temperature)
            if self.expect(result is not None, "Failed to perform set_high_threshold"):
                self.expect(result is True, "Failed to set set_high_threshold for thermal {} to {}".format(i, high_temperature))

            temperature = thermal.get_high_threshold(platform_api_conn, i)
            if self.expect(temperature is not None, "Unable to retrieve Thermal {} high threshold".format(i)):
                if self.expect(isinstance(temperature, float), "Thermal {} high threshold appears incorrect".format(i)):
                    self.expect(temperature == 80,
                                "Thermal {} high threshold {} is not matching the set value {}".format(i, temperature, high_temperature))

        if thermals_skipped == self.num_thermals:
            pytest.skip("skipped as all chassis thermals' high-threshold is not controllable")

        self.assert_expectations()
コード例 #2
0
ファイル: test_thermal.py プロジェクト: zero804/sonic-mgmt
    def test_set_high_threshold(self, duthost, localhost, platform_api_conn):
        # Ensure the thermal temperature is sane
        for i in range(self.num_thermals):
            high_temperature = 80
            result = thermal.set_high_threshold(platform_api_conn, i,
                                                high_temperature)
            if self.expect(result is not None,
                           "Failed to perform set_high_threshold"):
                self.expect(
                    result is True,
                    "Failed to set set_high_threshold for thermal {} to {}".
                    format(i, high_temperature))

            temperature = thermal.get_high_threshold(platform_api_conn, i)
            if self.expect(
                    temperature is not None,
                    "Unable to retrieve Thermal {} high threshold".format(i)):
                if self.expect(
                        isinstance(temperature, float),
                        "Thermal {} high threshold appears incorrect".format(
                            i)):
                    self.expect(
                        temperature == 80,
                        "Thermal {} high threshold {} is not matching the set value {}"
                        .format(i, temperature, high_temperature))
        self.assert_expectations()
コード例 #3
0
ファイル: test_thermal.py プロジェクト: emilmih/sonic-mgmt
    def test_set_high_threshold(self, duthosts,
                                enum_rand_one_per_hwsku_hostname, localhost,
                                platform_api_conn):
        duthost = duthosts[enum_rand_one_per_hwsku_hostname]
        skip_release_for_platform(duthost, ["202012", "201911", "201811"],
                                  ["arista"])

        # Ensure the thermal temperature is sane
        for i in range(self.num_thermals):
            high_temperature = 80
            result = thermal.set_high_threshold(platform_api_conn, i,
                                                high_temperature)
            if self.expect(result is not None,
                           "Failed to perform set_high_threshold"):
                self.expect(
                    result is True,
                    "Failed to set set_high_threshold for thermal {} to {}".
                    format(i, high_temperature))

            temperature = thermal.get_high_threshold(platform_api_conn, i)
            if self.expect(
                    temperature is not None,
                    "Unable to retrieve Thermal {} high threshold".format(i)):
                if self.expect(
                        isinstance(temperature, float),
                        "Thermal {} high threshold appears incorrect".format(
                            i)):
                    self.expect(
                        temperature == 80,
                        "Thermal {} high threshold {} is not matching the set value {}"
                        .format(i, temperature, high_temperature))
        self.assert_expectations()