Пример #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()
Пример #2
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()
Пример #3
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()