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

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

        self.assert_expectations()
コード例 #2
0
ファイル: test_thermal.py プロジェクト: nazariig/sonic-mgmt
    def test_set_low_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, "low-threshold")
            threshold_controllable = self.get_thermal_facts(duthost, i, True, "controllable")
            if not threshold_supported or not threshold_controllable:
                logger.info("test_set_low_threshold: Skipping thermal {} (threshold not supported or controllable)".format(i))
                thermals_skipped += 1
                continue

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

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

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

        self.assert_expectations()
コード例 #3
0
ファイル: test_thermal.py プロジェクト: emilmih/sonic-mgmt
    def test_set_low_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):
            low_temperature = 20
            result = thermal.set_low_threshold(platform_api_conn, i,
                                               low_temperature)
            if self.expect(result is not None,
                           "Failed to perform set_low_threshold"):
                self.expect(
                    result is True,
                    "Failed to set set_low_threshold for thermal {} to {}".
                    format(i, low_temperature))

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

        self.assert_expectations()
コード例 #4
0
ファイル: test_thermal.py プロジェクト: smaheshm/sonic-mgmt
    def test_get_low_threshold(self, duthosts,
                               enum_rand_one_per_hwsku_hostname, localhost,
                               platform_api_conn):
        duthost = duthosts[enum_rand_one_per_hwsku_hostname]
        thermals_skipped = 0

        for i in range(self.num_thermals):
            threshold_supported = self.get_thermal_facts(
                duthost, i, True, "low-threshold")
            logger.info("threshold_supported: {}".format(threshold_supported))
            if not threshold_supported:
                logger.info(
                    "test_get_low_threshold: Skipping thermal {} (threshold not supported)"
                    .format(i))
                thermals_skipped += 1
                continue

            low_threshold = thermal.get_low_threshold(platform_api_conn, i)

            # Ensure the thermal low threshold temperature is sane
            if self.expect(
                    low_threshold is not None,
                    "Unable to retrieve Thermal {} low threshold".format(i)):
                self.expect(
                    isinstance(low_threshold, float),
                    "Thermal {} low threshold appears incorrect".format(i))

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

        self.assert_expectations()
コード例 #5
0
ファイル: test_thermal.py プロジェクト: dinesh0692/sonic-mgmt
    def test_get_low_threshold(self, duthost, localhost, platform_api_conn):
        # Ensure the thermal low threshold temperature is sane
        for i in range(self.num_thermals):
            low_threshold = thermal.get_low_threshold(platform_api_conn, i)

            if self.expect(low_threshold is not None, "Unable to retrieve Thermal {} low threshold".format(i)):
                if self.expect(isinstance(low_threshold, float), "Thermal {} low threshold appears incorrect".format(i)):
                    self.expect(low_threshold >= 0 and low_threshold <= 100,
                                "Thermal {} low threshold {} reading is not within range".format(i, low_threshold))
        self.assert_expectations()
コード例 #6
0
ファイル: test_thermal.py プロジェクト: emilmih/sonic-mgmt
    def test_get_low_threshold(self, duthosts,
                               enum_rand_one_per_hwsku_hostname, localhost,
                               platform_api_conn):
        # Ensure the thermal low threshold temperature is sane
        for i in range(self.num_thermals):
            low_threshold = thermal.get_low_threshold(platform_api_conn, i)

            if self.expect(
                    low_threshold is not None,
                    "Unable to retrieve Thermal {} low threshold".format(i)):
                self.expect(
                    isinstance(low_threshold, float),
                    "Thermal {} low threshold appears incorrect".format(i))
        self.assert_expectations()