コード例 #1
0
    def get(self, session=None, entity=None, obj=None, attribute=None):

        devices = obj.split(".")
        newlist = []
        for devs in devices:
            newlist.append(devs.split("#"))
        devDic = dict(newlist)
        CPUNum = devDic["cpu"]
        CPUName = "CPU " + CPUNum

        URL = Util.getURL(entity, obj, attribute, "get")
        Param = Util.getParam(entity, obj, attribute, "get")

        value = generic.getValue(self, session, URL)
        json_data = json.loads(value.text)
        try:

            for key in json_data['Temperatures']:
                if CPUName in key['Name']:
                    return key[Param]
                    break

                else:
                    continue

        except Exception as e:
            log.Error("Error in finding Get Parameter in the Response")
            raise ParamInResponseGetError
コード例 #2
0
    def get(self, session=None, entity=None, obj=None, attribute=None):
        URL = Util.getURL(entity, obj, attribute, "get")
        Param = Util.getParam(entity, obj, attribute, "get")
        value = generic.getValue(self, session, URL)
        json_data = json.loads(value.text)

        try:
            AttrValue = json_data[Param]
        except Exception as e:
            log.Error("Error in finding Get Parameter in the Response")
            raise ParamInResponseGetError
        voltage = float(AttrValue) / 10
        return voltage
コード例 #3
0
ファイル: Ilo_Docker_Power.py プロジェクト: pwrapi/rafpa
    def get(self, session=None, entity=None, obj=None, attribute=None):

        URL = Util.getURL(entity, obj, attribute, "get")
        Param = Util.getParam(entity, obj, attribute, "get")
        value = generic.getValue(self, session, URL)
        json_data = json.loads(value.text)

        try:
            for key in json_data['PowerControl']:
                AttrValue = key[Param]

        except Exception as e:
            log.Error("Error in finding Get Parameter in the Response")
            raise ParamInResponseGetError
        return AttrValue
コード例 #4
0
    def get(self, session=None, entity=None, obj=None, attribute=None):

        dev = obj.replace("#", "")
        dev = dev.split(".")
        r = re.compile("([a-zA-Z]+)([0-9]+)")
        d = dict([r.match(string).groups() for string in dev])

        Proc_Str = "P{0}".format(d["cpu"])
        ProcDimm = Proc_Str + " DIMM"

        URL = Util.getURL(entity, obj, attribute, "get")
        Param = Util.getParam(entity, obj, attribute, "get")
        value = generic.getValue(self, session, URL)
        json_data = json.loads(value.text)
        try:
            for key in json_data['Temperatures']:
                if ProcDimm in key['Name']:
                    alist.append(key['Name'])

                for x in alist:

                    dimm = x
                    if Proc_str in dimm:
                        index = dimm.find('DIMM')

                        dimm_range = dimm[index + 5:]
                        low, high = dimm_range.split("-")
                        low = int(low)
                        high = int(high)

                        if low <= int(d["memory"]) <= high:
                            if key['Name'] == x:
                                return key[Param]
                                break

                        else:
                            continue

        except Exception as e:
            log.Error("Error in finding Get Parameter in the Response")
            raise ParamInResponseGetError