Example #1
0
    def test_fans(self, duthosts, enum_rand_one_per_hwsku_hostname, localhost,
                  platform_api_conn):
        duthost = duthosts[enum_rand_one_per_hwsku_hostname]
        try:
            num_fans = int(chassis.get_num_fans(platform_api_conn))
        except:
            pytest.fail("num_fans is not an integer")
        else:
            if num_fans == 0:
                pytest.skip("No fans found on device")

        if duthost.facts.get("chassis"):
            expected_num_fans = len(duthost.facts.get("chassis").get('fans'))
            pytest_assert(
                num_fans == expected_num_fans,
                "Number of fans ({}) does not match expected number ({})".
                format(num_fans, expected_num_fans))

        fan_list = chassis.get_all_fans(platform_api_conn)
        pytest_assert(fan_list is not None, "Failed to retrieve fans")
        pytest_assert(
            isinstance(fan_list, list) and len(fan_list) == num_fans,
            "Fans appear to be incorrect")

        for i in range(num_fans):
            fan = chassis.get_fan(platform_api_conn, i)
            self.expect(fan and fan == fan_list[i],
                        "Fan {} is incorrect".format(i))
        self.assert_expectations()
 def setup(self, platform_api_conn):
     if self.num_fans is None:
         try:
             self.num_fans = int(chassis.get_num_fans(platform_api_conn))
         except:
             pytest.fail("num_fans is not an integer")
         else:
             if self.num_fans == 0:
                 pytest.skip("No fans found on device")
Example #3
0
 def setup(self, platform_api_conn, duthost):
     if self.num_fans is None:
         try:
             self.num_fans = int(chassis.get_num_fans(platform_api_conn))
         except:
             pytest.fail("num_fans is not an integer")
         else:
             if self.num_fans == 0:
                 pytest.skip("No fans found on device")
     stop_thermal_control_daemon(duthost)
     yield
     start_thermal_control_daemon(duthost)
Example #4
0
    def test_fans(self, duthost, localhost, platform_api_conn):
        # TODO: Ensure the number of fans and that the returned list is correct for this platform
        try:
            num_fans = int(chassis.get_num_fans(platform_api_conn))
        except:
            pytest.fail("num_fans is not an integer")

        fan_list = chassis.get_all_fans(platform_api_conn)
        pytest_assert(fan_list is not None, "Failed to retrieve fans")
        pytest_assert(
            isinstance(fan_list, list) and len(fan_list) == num_fans,
            "Fans appear to be incorrect")

        for i in range(num_fans):
            fan = chassis.get_fan(platform_api_conn, i)
            self.expect(fan and fan == fan_list[i],
                        "Fan {} is incorrect".format(i))
        self.assert_expectations()
Example #5
0
    def test_fans(self, duthost, localhost, platform_api_conn):
        try:
            num_fans = int(chassis.get_num_fans(platform_api_conn))
        except:
            pytest.fail("num_fans is not an integer")

        if self.chassis_facts:
            expected_num_fans = len(self.chassis_facts.get('fans'))
            pytest_assert(num_fans == expected_num_fans,
                          "Number of fans ({}) does not match expected number ({})"
                          .format(num_fans, expected_num_fans))

        fan_list = chassis.get_all_fans(platform_api_conn)
        pytest_assert(fan_list is not None, "Failed to retrieve fans")
        pytest_assert(isinstance(fan_list, list) and len(fan_list) == num_fans, "Fans appear to be incorrect")

        for i in range(num_fans):
            fan = chassis.get_fan(platform_api_conn, i)
            self.expect(fan and fan == fan_list[i], "Fan {} is incorrect".format(i))
        self.assert_expectations()
Example #6
0
 def setup(self, platform_api_conn):
     if self.num_fans is None:
         try:
             self.num_fans = int(chassis.get_num_fans(platform_api_conn))
         except:
             pytest.fail("num_fans is not an integer")