コード例 #1
0
    def test_psus(self, duthosts, enum_rand_one_per_hwsku_hostname, localhost,
                  platform_api_conn):
        duthost = duthosts[enum_rand_one_per_hwsku_hostname]
        try:
            num_psus = int(chassis.get_num_psus(platform_api_conn))
        except:
            pytest.fail("num_psus is not an integer")
        else:
            if num_psus == 0:
                pytest.skip("No psus found on device")

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

        psu_list = chassis.get_all_psus(platform_api_conn)
        pytest_assert(psu_list is not None, "Failed to retrieve PSUs")
        pytest_assert(
            isinstance(psu_list, list) and len(psu_list) == num_psus,
            "PSUs appear to be incorrect")

        for i in range(num_psus):
            psu = chassis.get_psu(platform_api_conn, i)
            self.expect(psu and psu == psu_list[i],
                        "PSU {} is incorrect".format(i))
        self.assert_expectations()
コード例 #2
0
ファイル: test_psu_fans.py プロジェクト: xumia/sonic-mgmt
 def setup(self, platform_api_conn):
     if self.num_psus is None:
         try:
             self.num_psus = chassis.get_num_psus(platform_api_conn)
         except:
             pytest.fail("num_fans is not an integer")
         else:
             if self.num_psus == 0:
                 pytest.skip("No psus found on device")
コード例 #3
0
ファイル: test_psu.py プロジェクト: bratashX/sonic-mgmt
    def setup(self, platform_api_conn, duthosts, enum_rand_one_per_hwsku_hostname):
        if self.num_psus is None:
            try:
                self.num_psus = int(chassis.get_num_psus(platform_api_conn))
            except:
                pytest.fail("num_psus is not an integer")

        duthost = duthosts[enum_rand_one_per_hwsku_hostname]
        self.psu_skip_list = get_skip_mod_list(duthost, ['psus'])
コード例 #4
0
    def test_psus(self, duthost, localhost, platform_api_conn):
        # TODO: Ensure the number of PSUs and that the returned list is correct for this platform
        try:
            num_psus = int(chassis.get_num_psus(platform_api_conn))
        except:
            pytest.fail("num_psus is not an integer")

        psu_list = chassis.get_all_psus(platform_api_conn)
        pytest_assert(psu_list is not None, "Failed to retrieve PSUs")
        pytest_assert(
            isinstance(psu_list, list) and len(psu_list) == num_psus,
            "PSUs appear to be incorrect")

        for i in range(num_psus):
            psu = chassis.get_psu(platform_api_conn, i)
            self.expect(psu and psu == psu_list[i],
                        "PSU {} is incorrect".format(i))
        self.assert_expectations()
コード例 #5
0
    def test_psus(self, duthost, localhost, platform_api_conn):
        try:
            num_psus = int(chassis.get_num_psus(platform_api_conn))
        except:
            pytest.fail("num_psus is not an integer")

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

        psu_list = chassis.get_all_psus(platform_api_conn)
        pytest_assert(psu_list is not None, "Failed to retrieve PSUs")
        pytest_assert(isinstance(psu_list, list) and len(psu_list) == num_psus, "PSUs appear to be incorrect")

        for i in range(num_psus):
            psu = chassis.get_psu(platform_api_conn, i)
            self.expect(psu and psu == psu_list[i], "PSU {} is incorrect".format(i))
        self.assert_expectations()
コード例 #6
0
ファイル: test_psu_fans.py プロジェクト: smaheshm/sonic-mgmt
 def setup(self, platform_api_conn):
     if self.num_psus is None:
         try:
             self.num_psus = chassis.get_num_psus(platform_api_conn)
         except:
             pytest.fail("num_fans is not an integer")