Ejemplo n.º 1
0
    def test_fan_drawers(self, duthosts, enum_rand_one_per_hwsku_hostname,
                         localhost, platform_api_conn):
        duthost = duthosts[enum_rand_one_per_hwsku_hostname]
        try:
            num_fan_drawers = int(
                chassis.get_num_fan_drawers(platform_api_conn))
        except:
            pytest.fail("num_fan_drawers is not an integer")
        else:
            if num_fan_drawers == 0:
                pytest.skip("No fan drawers found on device")

        if duthost.facts.get("chassis"):
            expected_num_fan_drawers = len(
                duthost.facts.get("chassis").get('fan_drawers'))
            pytest_assert(
                num_fan_drawers == expected_num_fan_drawers,
                "Number of fan drawers ({}) does not match expected number ({})"
                .format(num_fan_drawers, expected_num_fan_drawers))

        fan_drawer_list = chassis.get_all_fan_drawers(platform_api_conn)
        pytest_assert(fan_drawer_list is not None,
                      "Failed to retrieve fan drawers")
        pytest_assert(
            isinstance(fan_drawer_list, list)
            and len(fan_drawer_list) == num_fan_drawers,
            "Fan drawerss appear to be incorrect")

        for i in range(num_fan_drawers):
            fan_drawer = chassis.get_fan_drawer(platform_api_conn, i)
            self.expect(fan_drawer and fan_drawer == fan_drawer_list[i],
                        "Fan drawer {} is incorrect".format(i))
        self.assert_expectations()
Ejemplo n.º 2
0
 def setup(self, platform_api_conn):
     if self.num_fan_drawers is None:
         try:
             self.num_fan_drawers = chassis.get_num_fan_drawers(
                 platform_api_conn)
         except:
             pytest.fail("num_fans is not an integer")
Ejemplo n.º 3
0
    def test_fan_drawers(self, duthost, localhost, platform_api_conn):
        try:
            num_fan_drawers = int(
                chassis.get_num_fan_drawers(platform_api_conn))
        except:
            pytest.fail("num_fan_drawers is not an integer")

        if self.chassis_facts:
            expected_num_fan_drawers = len(
                self.chassis_facts.get('fan_drawers'))
            pytest_assert(
                num_fan_drawers == expected_num_fan_drawers,
                "Number of fan drawers ({}) does not match expected number ({})"
                .format(num_fan_drawers, expected_num_fan_drawers))

        fan_drawer_list = chassis.get_all_fan_drawers(platform_api_conn)
        pytest_assert(fan_drawer_list is not None,
                      "Failed to retrieve fan drawers")
        pytest_assert(
            isinstance(fan_drawer_list, list)
            and len(fan_drawer_list) == num_fan_drawers,
            "Fan drawerss appear to be incorrect")

        for i in range(num_fan_drawers):
            fan_drawer = chassis.get_fan_drawer(platform_api_conn, i)
            self.expect(fan_drawer and fan_drawer == fan_drawer_list[i],
                        "Fan drawer {} is incorrect".format(i))
        self.assert_expectations()
Ejemplo n.º 4
0
 def setup(self, duthost, platform_api_conn):
     if self.num_fan_drawers is None:
         try:
             self.num_fan_drawers = int(
                 chassis.get_num_fan_drawers(platform_api_conn))
         except:
             pytest.fail("num_fan_drawers is not an integer")
         else:
             if self.num_fan_drawers == 0:
                 pytest.skip("No fan drawers found on device")
Ejemplo n.º 5
0
 def setup(self, platform_api_conn, duthost):
     if self.num_fan_drawers is None:
         try:
             self.num_fan_drawers = chassis.get_num_fan_drawers(
                 platform_api_conn)
         except:
             pytest.fail("num_fans is not an integer")
         else:
             if self.num_fan_drawers == 0:
                 pytest.skip("No fan drawers found on device")
     stop_thermal_control_daemon(duthost)
     yield
     start_thermal_control_daemon(duthost)
Ejemplo n.º 6
0
    def setup(self, duthost, platform_api_conn):
        if self.num_fan_drawers is None:
            try:
                self.num_fan_drawers = int(
                    chassis.get_num_fan_drawers(platform_api_conn))
            except:
                pytest.fail("num_fan_drawers is not an integer")

        chassis_truth = duthost.facts.get('chassis', None)
        if chassis_truth:
            self.fan_drawer_truth = chassis_truth.get('fan_drawers', None)
            if not self.fan_drawer_truth:
                logger.warning(
                    "Unable to get fan_drawer_truth from platform.json, test results will not be comprehensive"
                )
        else:
            logger.warning(
                "Unable to get chassis_truth from platform.json, test results will not be comprehensive"
            )
Ejemplo n.º 7
0
    def test_fan_drawers(self, duthost, localhost, platform_api_conn):
        # TODO: Ensure the number of fan drawers and that the returned list is correct for this platform
        try:
            num_fan_drawers = int(
                chassis.get_num_fan_drawers(platform_api_conn))
        except:
            pytest.fail("num_fan_drawers is not an integer")

        fan_drawer_list = chassis.get_all_fan_drawers(platform_api_conn)
        pytest_assert(fan_drawer_list is not None,
                      "Failed to retrieve fan drawers")
        pytest_assert(
            isinstance(fan_drawer_list, list)
            and len(fan_drawer_list) == num_fan_drawers,
            "Fan drawerss appear to be incorrect")

        for i in range(num_fan_drawers):
            fan_drawer = chassis.get_fan_drawer(platform_api_conn, i)
            self.expect(fan_drawer and fan_drawer == fan_drawer_list[i],
                        "Fan drawer {} is incorrect".format(i))
        self.assert_expectations()