コード例 #1
0
ファイル: psu.py プロジェクト: zero804/sonic-buildimage
    def get_type(self):
        """
        Retrives the Power Type of PSU

        Returns :
            A string, PSU power type
        """
        psu_type = [None, 'AC', 'AC', 'DC']
        type_res = get_ipmitool_raw_output(self.psu_type_raw_cmd)
        if type_res is not None and len(type_res) == 1:
            return psu_type[type_res[0]]
        return None
コード例 #2
0
    def get_direction(self):
        """
        Retrieves the fan airfow direction
        Returns:
            A string, either FAN_DIRECTION_INTAKE or FAN_DIRECTION_EXHAUST
            depending on fan direction

        Notes:
            In DellEMC platforms,
            - Forward/Exhaust : Air flows from Port side to Fan side.
            - Reverse/Intake  : Air flows from Fan side to Port side.
        """
        direction = [self.FAN_DIRECTION_EXHAUST, self.FAN_DIRECTION_INTAKE]
        fan_status = self.get_presence()
        if not fan_status:
            return None
        dir_res = get_ipmitool_raw_output(self.fan_dir_raw_cmd)
        if dir_res is not None and len(dir_res) == 1:
            return direction[dir_res[0]]
        else:
            return None