コード例 #1
0
    def _getSelfKeyPath (self, registered
                         
                         , junkForTemplate):
        for logFunc in self._log('get-self-key-path').debug3Func(): logFunc('called. PARAMS, junkForTemplate=%s', junkForTemplate)
        keyPath = KeyPath()
        
        
        ancestorVal = Value()
        ancestorVal.setEnum(registered.getValue());
        keyPath.addKeyPathPrefix(ancestorVal)
        
        xmlVal = Value()
        xmlVal.setXmlTag(("registered", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-system-alarms", "qt-sys-alarms"))
        keyPath.addKeyPathPrefix(xmlVal)
        
        
        xmlVal = Value()
        xmlVal.setXmlTag(("alarms", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-system-alarms", "qt-sys-alarms"))
        keyPath.addKeyPathPrefix(xmlVal)
        
        
        xmlVal = Value()
        xmlVal.setXmlTag(("system", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-system", "qt-sys"))
        keyPath.addKeyPathPrefix(xmlVal)
        
        
        xmlVal = Value()
        xmlVal.setXmlTag(("tech", "http://qwilt.com/ns/yang/device/tech/qwilt-tech", "qt"))
        keyPath.addKeyPathPrefix(xmlVal)
        

        for logFunc in self._log('get-self-key-path-done').debug3Func(): logFunc('done. keyPath=%s. PARAMS', keyPath)
        return keyPath
コード例 #2
0
    def _collectItemsToDelete (self,
                               
                               itemsToDelete):
        self.myInitGuard.isInitOrCrash()
        for logFunc in self._log('collect-items-to-delete').debug3Func(): logFunc('called: itemsToDelete=%s. PARAMS', itemsToDelete)

        for key in self.registereds.keys():
            if self.registereds[key]:
                res = self.registereds[key]._collectItemsToDelete(
                                                                     key,
                                                                     itemsToDelete)
                if res != ReturnCodes.kOk:
                    for logFunc in self._log('collect-items-to-delete-registered-failed').errorFunc(): logFunc('registeredObj._collectItemsToDelete() failed. key=%s. PARAMS', key)
                    return ReturnCodes.kGeneralError

            else:
                keyPath = self._getSelfKeyPath(
                                               None)
                xmlVal = Value()
                xmlVal.setXmlTag(("registered", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-system-alarms", "qt-sys-alarms"))
                keyPath.addKeyPathPostfix(xmlVal)
                valKey = Value()
                valKey.setEnum(key.getValue())
                keyPath.addKeyPathPostfix(valKey)

                itemsToDelete.append(keyPath)

        for logFunc in self._log('collect-items-to-delete-done').debug3Func(): logFunc('done: itemsToDelete=%s. PARAMS', itemsToDelete)
        return ReturnCodes.kOk
コード例 #3
0
    def _fillReadTagValues (self, tagValueList):
        self.myInitGuard.isInitOrCrash()
        for logFunc in self._log('fill-read-tag-values').debug3Func(): logFunc('called: tagValueList=%s', tagValueList)

        for key in self.registereds.keys():
            if self.registereds[key]:
                valBegin = Value()
                (tag, ns, prefix) = ("registered", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-system-alarms", "qt-sys-alarms")
                valBegin.setXmlBegin((tag, ns, prefix))
                tagValueList.push((tag, ns), valBegin)

                valKey = Value()
                valKey.setEnum(key.getValue())
                tagValueList.push(("name", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-system-alarms"), valKey)

                tagValueListLen = tagValueList.getLen()

                res = self.registereds[key]._fillReadTagValues(tagValueList)
                if res != ReturnCodes.kOk:
                    for logFunc in self._log('fill-read-tag-values-registered-failed').errorFunc(): logFunc('registered._fillReadTagValues() failed. key=%s', key)
                    return ReturnCodes.kGeneralError

                if tagValueList.getLen() == tagValueListLen:
                    # descendant didn't add anything, no need to read it.
                    tagValueList.pop()
                    tagValueList.pop()
                else:
                    valEnd = Value()
                    valEnd.setXmlEnd((tag, ns, prefix))
                    tagValueList.push((tag, ns), valEnd)

        return ReturnCodes.kOk
コード例 #4
0
    def _fillWriteTagValues (self, tagValueList):
        self.myInitGuard.isInitOrCrash()
        for logFunc in self._log('fill-write-tag-values').debug3Func(): logFunc('called: tagValueList=%s', tagValueList)

        
        if self.hasId():
            valId = Value()
            if self.id is not None:
                valId.setString(self.id)
            else:
                valId.setEmpty()
            tagValueList.push(("id", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-system-alarms"), valId)
        
        if self.hasName():
            valName = Value()
            if self.name is not None:
                valName.setEnum(self.name.getValue())
            else:
                valName.setEmpty()
            tagValueList.push(("name", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-system-alarms"), valName)
        
        if self.hasEntity():
            valEntity = Value()
            if self.entity is not None:
                valEntity.setString(self.entity)
            else:
                valEntity.setEmpty()
            tagValueList.push(("entity", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-system-alarms"), valEntity)
        

        

        return ReturnCodes.kOk
コード例 #5
0
    def _fillWriteTagValues (self, tagValueList):
        self.myInitGuard.isInitOrCrash()
        for logFunc in self._log('fill-write-tag-values').debug3Func(): logFunc('called: tagValueList=%s', tagValueList)

        
        if self.hasEntryName():
            valEntryName = Value()
            if self.entryName is not None:
                valEntryName.setString(self.entryName)
            else:
                valEntryName.setEmpty()
            tagValueList.push(("entry-name", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-snmp"), valEntryName)
        
        if self.hasAccessMode():
            valAccessMode = Value()
            if self.accessMode is not None:
                valAccessMode.setEnum(self.accessMode.getValue())
            else:
                valAccessMode.setEmpty()
            tagValueList.push(("access-mode", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-snmp"), valAccessMode)
        
        if self.hasCommunity():
            valCommunity = Value()
            if self.community is not None:
                valCommunity.setString(self.community)
            else:
                valCommunity.setEmpty()
            tagValueList.push(("community", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-snmp"), valCommunity)
        

        

        return ReturnCodes.kOk
コード例 #6
0
    def _fillWriteTagValues (self, tagValueList):
        self.myInitGuard.isInitOrCrash()
        for logFunc in self._log('fill-write-tag-values').debug3Func(): logFunc('called: tagValueList=%s', tagValueList)

        
        if self.hasType_():
            valType_ = Value()
            if self.type_ is not None:
                valType_.setEnum(self.type_.getValue())
            else:
                valType_.setEmpty()
            tagValueList.push(("type", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-content-line"), valType_)
        
        if self.hasEnabled():
            valEnabled = Value()
            if self.enabled is not None:
                valEnabled.setBool(self.enabled)
            else:
                valEnabled.setEmpty()
            tagValueList.push(("enabled", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-content-line"), valEnabled)
        

        

        return ReturnCodes.kOk
コード例 #7
0
    def fillTagValues(self, keyPath, tagValueList, operData):
        initialListSize = tagValueList.getLen()
        for logFunc in self._log("fill-tag-values").debug3Func():
            logFunc("called. operData=%s, keyPath=%s, initialListSize=%d",
                    operData.debugStr(True), keyPath, initialListSize)
        # fill tag values up to current
        if self.myKeyPath.isEqualLen(keyPath, keyPath.getLen()):
            i = keyPath.getLen()
            while i < self.myKeyPath.getLen():
                valBegin = Value()
                (tag, ns, prefix) = self.myKeyPath.getAt(i).asXmlTag()
                valBegin.setXmlBegin((tag, ns, prefix))
                tagValueList.push((tag, ns), valBegin)
                for logFunc in self._log(
                        "fill-tag-values-adding").debug3Func():
                    logFunc(
                        "adding xml begin. i=%d, valBegin=%s, self.myKeyPath.getLen()=%d",
                        i, valBegin, self.myKeyPath.getLen())
                i += 1

        if operData.isColorRequested() and operData.hasColor():
            val = Value()
            val.setEnum(operData.color.getValue())
            tagValueList.push(("color", "http://qwilt.com/model/lake-example"),
                              val)

        if operData.isPatternRequested() and operData.hasPattern():
            val = Value()
            val.setString(operData.pattern)
            tagValueList.push(
                ("pattern", "http://qwilt.com/model/lake-example"), val)

        if operData.isMacAddressRequested() and operData.hasMacAddress():
            val = Value()
            val.setBinary(operData.macAddress.getAddress())
            tagValueList.push(
                ("mac-address", "http://qwilt.com/model/lake-example"), val)

        if operData.isLineWidthRequested() and operData.hasLineWidth():
            val = Value()
            val.setInt8(operData.lineWidth)
            tagValueList.push(
                ("line-width", "http://qwilt.com/model/lake-example"), val)

        if self.myKeyPath.isEqualLen(keyPath, keyPath.getLen()):
            i = self.myKeyPath.getLen() - 1
            while i >= keyPath.getLen():
                valEnd = Value()
                (tag, ns, prefix) = self.myKeyPath.getAt(i).asXmlTag()
                valEnd.setXmlEnd((tag, ns, prefix))
                tagValueList.push((tag, ns), valEnd)
                i -= 1

        for logFunc in self._log("fill-tag-values-ended").debug3Func():
            logFunc(
                "ended. operData=%s, keyPath=%s, initialListSize=%d, finalListSize=%d",
                operData.debugStr(True), keyPath, initialListSize,
                tagValueList.getLen())
        return ReturnCodes.kOk
コード例 #8
0
ファイル: ipv4_maapi_gen.py プロジェクト: afeset/miner2-tools
    def _fillWriteTagValues (self, tagValueList):
        self.myInitGuard.isInitOrCrash()
        for logFunc in self._log('fill-write-tag-values').debug3Func(): logFunc('called: tagValueList=%s', tagValueList)

        
        if self.hasMethod():
            valMethod = Value()
            if self.method is not None:
                valMethod.setEnum(self.method.getValue())
            else:
                valMethod.setEmpty()
            tagValueList.push(("method", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-interfaces"), valMethod)
        

        
        if self.arpObj:
            valBegin = Value()
            (tag, ns, prefix) = ("arp" , "http://qwilt.com/ns/yang/device/tech/qwilt-tech-interfaces", "qt-if")
            valBegin.setXmlBegin((tag, ns, prefix))
            tagValueList.push((tag, ns), valBegin)

            tagValueListLen = tagValueList.getLen()

            res = self.arpObj._fillWriteTagValues(tagValueList)
            if res != ReturnCodes.kOk:
                for logFunc in self._log('fill-write-tag-values-arp-failed').errorFunc(): logFunc('arpObj._fillWriteTagValues() failed. PARAMS')
                return ReturnCodes.kGeneralError

            if tagValueList.getLen() == tagValueListLen:
                # descendant didn't add anything, no need to read it.
                tagValueList.pop()
            else:
                valEnd = Value()
                valEnd.setXmlEnd((tag, ns, prefix))
                tagValueList.push((tag, ns), valEnd)
        
        if self.pingObj:
            valBegin = Value()
            (tag, ns, prefix) = ("ping" , "http://qwilt.com/ns/yang/device/tech/qwilt-tech-interfaces", "qt-if")
            valBegin.setXmlBegin((tag, ns, prefix))
            tagValueList.push((tag, ns), valBegin)

            tagValueListLen = tagValueList.getLen()

            res = self.pingObj._fillWriteTagValues(tagValueList)
            if res != ReturnCodes.kOk:
                for logFunc in self._log('fill-write-tag-values-ping-failed').errorFunc(): logFunc('pingObj._fillWriteTagValues() failed. PARAMS')
                return ReturnCodes.kGeneralError

            if tagValueList.getLen() == tagValueListLen:
                # descendant didn't add anything, no need to read it.
                tagValueList.pop()
            else:
                valEnd = Value()
                valEnd.setXmlEnd((tag, ns, prefix))
                tagValueList.push((tag, ns), valEnd)
        

        return ReturnCodes.kOk
コード例 #9
0
    def _fillWriteTagValues (self, tagValueList):
        self.myInitGuard.isInitOrCrash()
        for logFunc in self._log('fill-write-tag-values').debug3Func(): logFunc('called: tagValueList=%s', tagValueList)

        
        if self.hasName():
            valName = Value()
            if self.name is not None:
                valName.setString(self.name)
            else:
                valName.setEmpty()
            tagValueList.push(("name", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-snmp"), valName)
        
        if self.hasDestination():
            valDestination = Value()
            if self.destination is not None:
                valDestination.setString(self.destination)
            else:
                valDestination.setEmpty()
            tagValueList.push(("destination", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-snmp"), valDestination)
        
        if self.hasCommunity():
            valCommunity = Value()
            if self.community is not None:
                valCommunity.setString(self.community)
            else:
                valCommunity.setEmpty()
            tagValueList.push(("community", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-snmp"), valCommunity)
        
        if self.hasVersion():
            valVersion = Value()
            if self.version is not None:
                valVersion.setEnum(self.version.getValue())
            else:
                valVersion.setEmpty()
            tagValueList.push(("version", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-snmp"), valVersion)
        
        if self.hasType_():
            valType_ = Value()
            if self.type_ is not None:
                valType_.setEnum(self.type_.getValue())
            else:
                valType_.setEmpty()
            tagValueList.push(("type", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-snmp"), valType_)
        
        if self.hasPort():
            valPort = Value()
            if self.port is not None:
                valPort.setUint16(self.port)
            else:
                valPort.setEmpty()
            tagValueList.push(("port", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-snmp"), valPort)
        

        

        return ReturnCodes.kOk
コード例 #10
0
    def _fillWriteTagValues (self, tagValueList):
        self.myInitGuard.isInitOrCrash()
        for logFunc in self._log('fill-write-tag-values').debug3Func(): logFunc('called: tagValueList=%s', tagValueList)

        
        if self.hasType_():
            valType_ = Value()
            if self.type_ is not None:
                valType_.setEnum(self.type_.getValue())
            else:
                valType_.setEmpty()
            tagValueList.push(("type", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-content-line"), valType_)
        
        if self.hasEnabled():
            valEnabled = Value()
            if self.enabled is not None:
                valEnabled.setBool(self.enabled)
            else:
                valEnabled.setEmpty()
            tagValueList.push(("enabled", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-content-line"), valEnabled)
        
        if self.hasName():
            valName = Value()
            if self.name is not None:
                valName.setString(self.name)
            else:
                valName.setEmpty()
            tagValueList.push(("name", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-content-line"), valName)
        

        
        if self.systemDefaultsObj:
            valBegin = Value()
            (tag, ns, prefix) = ("system-defaults" , "http://qwilt.com/ns/yang/device/tech/qwilt-tech-content-line", "qtc-line")
            valBegin.setXmlBegin((tag, ns, prefix))
            tagValueList.push((tag, ns), valBegin)

            tagValueListLen = tagValueList.getLen()

            res = self.systemDefaultsObj._fillWriteTagValues(tagValueList)
            if res != ReturnCodes.kOk:
                for logFunc in self._log('fill-write-tag-values-system-defaults-failed').errorFunc(): logFunc('systemDefaultsObj._fillWriteTagValues() failed. PARAMS')
                return ReturnCodes.kGeneralError

            if tagValueList.getLen() == tagValueListLen:
                # descendant didn't add anything, no need to read it.
                tagValueList.pop()
            else:
                valEnd = Value()
                valEnd.setXmlEnd((tag, ns, prefix))
                tagValueList.push((tag, ns), valEnd)
        

        return ReturnCodes.kOk
コード例 #11
0
    def fillTagValues(self, keyPath, tagValueList, operData):
        initialListSize = tagValueList.getLen()
        for logFunc in self._log("fill-tag-values").debug3Func():
            logFunc("called. operData=%s, keyPath=%s, initialListSize=%d",
                    operData.debugStr(True), keyPath, initialListSize)
        # fill tag values up to current
        if self.myKeyPath.isEqualLen(keyPath, keyPath.getLen()):
            i = keyPath.getLen()
            while i < self.myKeyPath.getLen():
                valBegin = Value()
                (tag, ns, prefix) = self.myKeyPath.getAt(i).asXmlTag()
                valBegin.setXmlBegin((tag, ns, prefix))
                tagValueList.push((tag, ns), valBegin)
                for logFunc in self._log(
                        "fill-tag-values-adding").debug3Func():
                    logFunc(
                        "adding xml begin. i=%d, valBegin=%s, self.myKeyPath.getLen()=%d",
                        i, valBegin, self.myKeyPath.getLen())
                i += 1

        if operData.isContentDiskFailureReasonRequested(
        ) and operData.hasContentDiskFailureReason():
            val = Value()
            val.setEnum(operData.contentDiskFailureReason.getValue())
            tagValueList.push(
                ("content-disk-failure-reason",
                 "http://qwilt.com/ns/yang/device/tech/qwilt-tech-storage-disk"
                 ), val)

        if operData.isContentDiskFailureAlarmRequested(
        ) and operData.hasContentDiskFailureAlarm():
            val = Value()
            val.setBool(operData.contentDiskFailureAlarm)
            tagValueList.push(
                ("content-disk-failure-alarm",
                 "http://qwilt.com/ns/yang/device/tech/qwilt-tech-storage-disk"
                 ), val)

        if self.myKeyPath.isEqualLen(keyPath, keyPath.getLen()):
            i = self.myKeyPath.getLen() - 1
            while i >= keyPath.getLen():
                valEnd = Value()
                (tag, ns, prefix) = self.myKeyPath.getAt(i).asXmlTag()
                valEnd.setXmlEnd((tag, ns, prefix))
                tagValueList.push((tag, ns), valEnd)
                i -= 1

        for logFunc in self._log("fill-tag-values-ended").debug3Func():
            logFunc(
                "ended. operData=%s, keyPath=%s, initialListSize=%d, finalListSize=%d",
                operData.debugStr(True), keyPath, initialListSize,
                tagValueList.getLen())
        return ReturnCodes.kOk
コード例 #12
0
    def fillTagValues (self, keyPath, tagValueList, operData):
        initialListSize = tagValueList.getLen()
        for logFunc in self._log("fill-tag-values").debug3Func(): logFunc("called. operData=%s, keyPath=%s, initialListSize=%d", operData.debugStr(True), keyPath, initialListSize)
        # fill tag values up to current
        if self.myKeyPath.isEqualLen(keyPath, keyPath.getLen()):
            i = keyPath.getLen()
            while i < self.myKeyPath.getLen():
                valBegin = Value()
                (tag, ns, prefix) = self.myKeyPath.getAt(i).asXmlTag()
                valBegin.setXmlBegin((tag, ns, prefix))
                tagValueList.push((tag, ns), valBegin)
                for logFunc in self._log("fill-tag-values-adding").debug3Func(): logFunc("adding xml begin. i=%d, valBegin=%s, self.myKeyPath.getLen()=%d", i, valBegin, self.myKeyPath.getLen())
                i+=1
        
        if operData.isCountRequested() and operData.hasCount():
            val = Value()
            val.setInt64(operData.count)
            tagValueList.push(("count", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-platform-temperature"), val)
        
        if operData.isTemperatureWarningRequested() and operData.hasTemperatureWarning():
            val = Value()
            val.setBool(operData.temperatureWarning)
            tagValueList.push(("temperature-warning", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-platform-temperature"), val)
        
        if operData.isTemperatureCriticalRequested() and operData.hasTemperatureCritical():
            val = Value()
            val.setBool(operData.temperatureCritical)
            tagValueList.push(("temperature-critical", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-platform-temperature"), val)
        
        if operData.isTemperatureCriticalReasonRequested() and operData.hasTemperatureCriticalReason():
            val = Value()
            val.setEnum(operData.temperatureCriticalReason.getValue())
            tagValueList.push(("temperature-critical-reason", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-platform-temperature"), val)
        
        if operData.isTemperatureWarningReasonRequested() and operData.hasTemperatureWarningReason():
            val = Value()
            val.setEnum(operData.temperatureWarningReason.getValue())
            tagValueList.push(("temperature-warning-reason", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-platform-temperature"), val)
        
        
        if self.myKeyPath.isEqualLen(keyPath, keyPath.getLen()):
            i = self.myKeyPath.getLen() - 1
            while i >= keyPath.getLen():
                valEnd = Value()
                (tag, ns, prefix) = self.myKeyPath.getAt(i).asXmlTag()
                valEnd.setXmlEnd((tag, ns, prefix))
                tagValueList.push((tag, ns), valEnd)
                i-=1

        for logFunc in self._log("fill-tag-values-ended").debug3Func(): logFunc("ended. operData=%s, keyPath=%s, initialListSize=%d, finalListSize=%d",
                                                  operData.debugStr(True), keyPath, initialListSize, tagValueList.getLen())
        return ReturnCodes.kOk
コード例 #13
0
    def getNext (self, trxContext, keypath, next):
        for logFunc in self._log("get-next").debug3Func(): logFunc("called. keypath=%s, next=%s, trxContext=%s", keypath, next, trxContext)

        var = AlarmNameType.kTemperatureSensorWarning
        isCompleted = True
        if self.myIsActive:
            if self.myGetNextFunctor:
                timeoutGuardName = str(self.myKeyPath) + "-" + "get-next-functor"
                
                
                
                
                
                
                timeoutGuard = TimeoutGuard(self._log, timeoutGuardName, 
                                            self.getFunctorTimeout(self.GET_NEXT_FUNCTOR), 
                                            self.getFunctorMildTimeout(self.GET_NEXT_FUNCTOR))
                var_PBR = PassByRef(var)
                next_PBR = PassByRef(next)
                isCompleted_PBR = PassByRef(None)
                res = self.myGetNextFunctor(trxContext, 
                                            
                                            var_PBR,
                                            next_PBR,
                                            isCompleted_PBR)
                timeoutGuard.checkAndLog("application problem: functor=%s" % self.myGetNextFunctor.__name__)
                if res != ReturnCodes.kOk:
                    for logFunc in self._log("get-next-functor-failed").errorFunc(): logFunc(
                        "functor failed. res=%s, keypath=%s, trxContext=%s", res, keypath, trxContext)
                    return ReturnCodes.kGeneralError
                var = var_PBR.value()
                next = next_PBR.value()
                isCompleted = isCompleted_PBR.value()
                for logFunc in self._log("get-next-send-next-key-functor-returned").debug3Func(): logFunc(
                    "functor returned. keypath=%s, trxContext=%s, var=%s, next=%s, isCompeted=%s", 
                    keypath, trxContext, var, next, isCompleted)

        nextKeyValue = Value()
        if isCompleted == True:
            nextKeyValue.setEmpty()
        else:
            nextKeyValue.setEnum(var.getValue())

        res = self.myDomain.sendNextKeyValue(trxContext, nextKeyValue, next)
        if res != ReturnCodes.kOk:
            for logFunc in self._log("get-next-send-next-key-value-failed").errorFunc(): logFunc(
                "domain.sendNextKeyValue() failed. res=%s, keypath=%s, trxContext=%s, nextKeyValue=%s, next=%s", 
                res, keypath, trxContext, nextKeyValue, next)
            return ReturnCodes.kGeneralError

        return ReturnCodes.kOk;
コード例 #14
0
    def _fillWriteTagValues(self, tagValueList):
        self.myInitGuard.isInitOrCrash()
        for logFunc in self._log('fill-write-tag-values').debug3Func():
            logFunc('called: tagValueList=%s', tagValueList)

        if self.hasController():
            valController = Value()
            if self.controller is not None:
                valController.setString(self.controller)
            else:
                valController.setEmpty()
            tagValueList.push((
                "controller",
                "http://qwilt.com/ns/yang/device/tech/qwilt-tech-storage-module"
            ), valController)

        if self.hasEnabled():
            valEnabled = Value()
            if self.enabled is not None:
                valEnabled.setBool(self.enabled)
            else:
                valEnabled.setEmpty()
            tagValueList.push((
                "enabled",
                "http://qwilt.com/ns/yang/device/tech/qwilt-tech-storage-module"
            ), valEnabled)

        if self.hasDescription():
            valDescription = Value()
            if self.description is not None:
                valDescription.setString(self.description)
            else:
                valDescription.setEmpty()
            tagValueList.push((
                "description",
                "http://qwilt.com/ns/yang/device/tech/qwilt-tech-storage-module"
            ), valDescription)

        if self.hasLocationType():
            valLocationType = Value()
            if self.locationType is not None:
                valLocationType.setEnum(self.locationType.getValue())
            else:
                valLocationType.setEmpty()
            tagValueList.push((
                "location-type",
                "http://qwilt.com/ns/yang/device/tech/qwilt-tech-storage-module"
            ), valLocationType)

        return ReturnCodes.kOk
コード例 #15
0
    def _fillWriteTagValues(self, tagValueList):
        self.myInitGuard.isInitOrCrash()
        for logFunc in self._log('fill-write-tag-values').debug3Func():
            logFunc('called: tagValueList=%s', tagValueList)

        if self.hasSystemProtected():
            valSystemProtected = Value()
            if self.systemProtected is not None:
                valSystemProtected.setBool(self.systemProtected)
            else:
                valSystemProtected.setEmpty()
            tagValueList.push((
                "system-protected",
                "http://qwilt.com/ns/yang/device/tech/qwilt-tech-linux-variables"
            ), valSystemProtected)

        if self.hasInitPhase():
            valInitPhase = Value()
            if self.initPhase is not None:
                valInitPhase.setEnum(self.initPhase.getValue())
            else:
                valInitPhase.setEmpty()
            tagValueList.push((
                "init-phase",
                "http://qwilt.com/ns/yang/device/tech/qwilt-tech-linux-variables"
            ), valInitPhase)

        if self.hasDescription():
            valDescription = Value()
            if self.description is not None:
                valDescription.setString(self.description)
            else:
                valDescription.setEmpty()
            tagValueList.push((
                "description",
                "http://qwilt.com/ns/yang/device/tech/qwilt-tech-linux-variables"
            ), valDescription)

        if self.hasValue():
            valValue = Value()
            if self.value is not None:
                valValue.setString(self.value)
            else:
                valValue.setEmpty()
            tagValueList.push((
                "value",
                "http://qwilt.com/ns/yang/device/tech/qwilt-tech-linux-variables"
            ), valValue)

        return ReturnCodes.kOk
コード例 #16
0
    def _fillWriteTagValues (self, tagValueList):
        self.myInitGuard.isInitOrCrash()
        for logFunc in self._log('fill-write-tag-values').debug3Func(): logFunc('called: tagValueList=%s', tagValueList)

        
        if self.hasPciDeviceId():
            valPciDeviceId = Value()
            if self.pciDeviceId is not None:
                valPciDeviceId.setString(self.pciDeviceId)
            else:
                valPciDeviceId.setEmpty()
            tagValueList.push(("pci-device-id", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-interfaces"), valPciDeviceId)
        
        if self.hasCountersClearEvent():
            valCountersClearEvent = Value()
            if self.countersClearEvent is not None:
                valCountersClearEvent.setEnum(self.countersClearEvent.getValue())
            else:
                valCountersClearEvent.setEmpty()
            tagValueList.push(("counters-clear-event", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-interfaces"), valCountersClearEvent)
        
        if self.hasPciVendorId():
            valPciVendorId = Value()
            if self.pciVendorId is not None:
                valPciVendorId.setString(self.pciVendorId)
            else:
                valPciVendorId.setEmpty()
            tagValueList.push(("pci-vendor-id", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-interfaces"), valPciVendorId)
        
        if self.hasPciIndex():
            valPciIndex = Value()
            if self.pciIndex is not None:
                valPciIndex.setUint64(self.pciIndex)
            else:
                valPciIndex.setEmpty()
            tagValueList.push(("pci-index", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-interfaces"), valPciIndex)
        
        if self.hasOsName():
            valOsName = Value()
            if self.osName is not None:
                valOsName.setString(self.osName)
            else:
                valOsName.setEmpty()
            tagValueList.push(("os-name", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-interfaces"), valOsName)
        

        

        return ReturnCodes.kOk
コード例 #17
0
    def _fillWriteTagValues (self, tagValueList):
        self.myInitGuard.isInitOrCrash()
        for logFunc in self._log('fill-write-tag-values').debug3Func(): logFunc('called: tagValueList=%s', tagValueList)

        
        if self.hasOsDevice():
            valOsDevice = Value()
            if self.osDevice is not None:
                valOsDevice.setString(self.osDevice)
            else:
                valOsDevice.setEmpty()
            tagValueList.push(("os-device", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-storage-disk"), valOsDevice)
        
        if self.hasImplementation():
            valImplementation = Value()
            if self.implementation is not None:
                valImplementation.setEnum(self.implementation.getValue())
            else:
                valImplementation.setEmpty()
            tagValueList.push(("implementation", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-storage-disk"), valImplementation)
        
        if self.hasRaidType():
            valRaidType = Value()
            if self.raidType is not None:
                valRaidType.setEnum(self.raidType.getValue())
            else:
                valRaidType.setEmpty()
            tagValueList.push(("raid-type", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-storage-disk"), valRaidType)
        
        if self.hasName():
            valName = Value()
            if self.name is not None:
                valName.setString(self.name)
            else:
                valName.setEmpty()
            tagValueList.push(("name", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-storage-disk"), valName)
        
        if self.hasAutoInit():
            valAutoInit = Value()
            if self.autoInit is not None:
                valAutoInit.setBool(self.autoInit)
            else:
                valAutoInit.setEmpty()
            tagValueList.push(("auto-init", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-storage-disk"), valAutoInit)
        

        

        return ReturnCodes.kOk
コード例 #18
0
    def fillTagValues (self, keyPath, tagValueList, operData):
        initialListSize = tagValueList.getLen()
        for logFunc in self._log("fill-tag-values").debug3Func(): logFunc("called. operData=%s, keyPath=%s, initialListSize=%d", operData.debugStr(True), keyPath, initialListSize)
        # fill tag values up to current
        if self.myKeyPath.isEqualLen(keyPath, keyPath.getLen()):
            i = keyPath.getLen()
            while i < self.myKeyPath.getLen():
                valBegin = Value()
                (tag, ns, prefix) = self.myKeyPath.getAt(i).asXmlTag()
                valBegin.setXmlBegin((tag, ns, prefix))
                tagValueList.push((tag, ns), valBegin)
                for logFunc in self._log("fill-tag-values-adding").debug3Func(): logFunc("adding xml begin. i=%d, valBegin=%s, self.myKeyPath.getLen()=%d", i, valBegin, self.myKeyPath.getLen())
                i+=1
        
        if operData.isReportsQueueGettingFullReasonRequested() and operData.hasReportsQueueGettingFullReason():
            val = Value()
            val.setEnum(operData.reportsQueueGettingFullReason.getValue())
            tagValueList.push(("reports-queue-getting-full-reason", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-content-reporting"), val)
        
        if operData.isReportsQueueGettingFullRequested() and operData.hasReportsQueueGettingFull():
            val = Value()
            val.setBool(operData.reportsQueueGettingFull)
            tagValueList.push(("reports-queue-getting-full", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-content-reporting"), val)
        
        if operData.isReportsQueueFullReasonRequested() and operData.hasReportsQueueFullReason():
            val = Value()
            val.setEnum(operData.reportsQueueFullReason.getValue())
            tagValueList.push(("reports-queue-full-reason", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-content-reporting"), val)
        
        if operData.isReportsQueueFullRequested() and operData.hasReportsQueueFull():
            val = Value()
            val.setBool(operData.reportsQueueFull)
            tagValueList.push(("reports-queue-full", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-content-reporting"), val)
        
        
        if self.myKeyPath.isEqualLen(keyPath, keyPath.getLen()):
            i = self.myKeyPath.getLen() - 1
            while i >= keyPath.getLen():
                valEnd = Value()
                (tag, ns, prefix) = self.myKeyPath.getAt(i).asXmlTag()
                valEnd.setXmlEnd((tag, ns, prefix))
                tagValueList.push((tag, ns), valEnd)
                i-=1

        for logFunc in self._log("fill-tag-values-ended").debug3Func(): logFunc("ended. operData=%s, keyPath=%s, initialListSize=%d, finalListSize=%d",
                                                  operData.debugStr(True), keyPath, initialListSize, tagValueList.getLen())
        return ReturnCodes.kOk
コード例 #19
0
    def fillTagValues (self, keyPath, tagValueList, operData):
        initialListSize = tagValueList.getLen()
        for logFunc in self._log("fill-tag-values").debug3Func(): logFunc("called. operData=%s, keyPath=%s, initialListSize=%d", operData.debugStr(True), keyPath, initialListSize)
        # fill tag values up to current
        if self.myKeyPath.isEqualLen(keyPath, keyPath.getLen()):
            i = keyPath.getLen()
            while i < self.myKeyPath.getLen():
                valBegin = Value()
                (tag, ns, prefix) = self.myKeyPath.getAt(i).asXmlTag()
                valBegin.setXmlBegin((tag, ns, prefix))
                tagValueList.push((tag, ns), valBegin)
                for logFunc in self._log("fill-tag-values-adding").debug3Func(): logFunc("adding xml begin. i=%d, valBegin=%s, self.myKeyPath.getLen()=%d", i, valBegin, self.myKeyPath.getLen())
                i+=1
        
        if operData.isOsDeviceRequested() and operData.hasOsDevice():
            val = Value()
            val.setString(operData.osDevice)
            tagValueList.push(("os-device", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-storage-disk"), val)
        
        if operData.isOprtationalStatusRequested() and operData.hasOprtationalStatus():
            val = Value()
            val.setEnum(operData.oprtationalStatus.getValue())
            tagValueList.push(("oprtational-status", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-storage-disk"), val)
        
        if operData.isOperationalStatusReasonRequested() and operData.hasOperationalStatusReason():
            val = Value()
            val.setEnum(operData.operationalStatusReason.getValue())
            tagValueList.push(("operational-status-reason", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-storage-disk"), val)
        
        if operData.isSizeRequested() and operData.hasSize():
            val = Value()
            val.setInt64(operData.size)
            tagValueList.push(("size", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-storage-disk"), val)
        
        
        if self.myKeyPath.isEqualLen(keyPath, keyPath.getLen()):
            i = self.myKeyPath.getLen() - 1
            while i >= keyPath.getLen():
                valEnd = Value()
                (tag, ns, prefix) = self.myKeyPath.getAt(i).asXmlTag()
                valEnd.setXmlEnd((tag, ns, prefix))
                tagValueList.push((tag, ns), valEnd)
                i-=1

        for logFunc in self._log("fill-tag-values-ended").debug3Func(): logFunc("ended. operData=%s, keyPath=%s, initialListSize=%d, finalListSize=%d",
                                                  operData.debugStr(True), keyPath, initialListSize, tagValueList.getLen())
        return ReturnCodes.kOk
コード例 #20
0
    def fillTagValues (self, keyPath, tagValueList, operData):
        initialListSize = tagValueList.getLen()
        for logFunc in self._log("fill-tag-values").debug3Func(): logFunc("called. operData=%s, keyPath=%s, initialListSize=%d", operData.debugStr(True), keyPath, initialListSize)
        # fill tag values up to current
        if self.myKeyPath.isEqualLen(keyPath, keyPath.getLen()):
            i = keyPath.getLen()
            while i < self.myKeyPath.getLen():
                valBegin = Value()
                (tag, ns, prefix) = self.myKeyPath.getAt(i).asXmlTag()
                valBegin.setXmlBegin((tag, ns, prefix))
                tagValueList.push((tag, ns), valBegin)
                for logFunc in self._log("fill-tag-values-adding").debug3Func(): logFunc("adding xml begin. i=%d, valBegin=%s, self.myKeyPath.getLen()=%d", i, valBegin, self.myKeyPath.getLen())
                i+=1
        
        if operData.isColorRequested() and operData.hasColor():
            val = Value()
            val.setEnum(operData.color.getValue())
            tagValueList.push(("color", "http://qwilt.com/model/lake-example"), val)
        
        if operData.isPatternRequested() and operData.hasPattern():
            val = Value()
            val.setString(operData.pattern)
            tagValueList.push(("pattern", "http://qwilt.com/model/lake-example"), val)
        
        if operData.isMacAddressRequested() and operData.hasMacAddress():
            val = Value()
            val.setBinary(operData.macAddress.getAddress())
            tagValueList.push(("mac-address", "http://qwilt.com/model/lake-example"), val)
        
        if operData.isLineWidthRequested() and operData.hasLineWidth():
            val = Value()
            val.setInt8(operData.lineWidth)
            tagValueList.push(("line-width", "http://qwilt.com/model/lake-example"), val)
        
        
        if self.myKeyPath.isEqualLen(keyPath, keyPath.getLen()):
            i = self.myKeyPath.getLen() - 1
            while i >= keyPath.getLen():
                valEnd = Value()
                (tag, ns, prefix) = self.myKeyPath.getAt(i).asXmlTag()
                valEnd.setXmlEnd((tag, ns, prefix))
                tagValueList.push((tag, ns), valEnd)
                i-=1

        for logFunc in self._log("fill-tag-values-ended").debug3Func(): logFunc("ended. operData=%s, keyPath=%s, initialListSize=%d, finalListSize=%d",
                                                  operData.debugStr(True), keyPath, initialListSize, tagValueList.getLen())
        return ReturnCodes.kOk
コード例 #21
0
    def _fillWriteTagValues (self, tagValueList):
        self.myInitGuard.isInitOrCrash()
        for logFunc in self._log('fill-write-tag-values').debug3Func(): logFunc('called: tagValueList=%s', tagValueList)

        
        if self.hasForceOperationalStatus():
            valForceOperationalStatus = Value()
            if self.forceOperationalStatus is not None:
                valForceOperationalStatus.setEnum(self.forceOperationalStatus.getValue())
            else:
                valForceOperationalStatus.setEmpty()
            tagValueList.push(("force-operational-status", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-platform-power"), valForceOperationalStatus)
        

        

        return ReturnCodes.kOk
コード例 #22
0
    def _fillWriteTagValues (self, tagValueList):
        self.myInitGuard.isInitOrCrash()
        for logFunc in self._log('fill-write-tag-values').debug3Func(): logFunc('called: tagValueList=%s', tagValueList)

        
        if self.hasForceOperationalStatus():
            valForceOperationalStatus = Value()
            if self.forceOperationalStatus is not None:
                valForceOperationalStatus.setEnum(self.forceOperationalStatus.getValue())
            else:
                valForceOperationalStatus.setEmpty()
            tagValueList.push(("force-operational-status", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-platform-fans"), valForceOperationalStatus)
        

        

        return ReturnCodes.kOk
コード例 #23
0
    def _fillWriteTagValues (self, tagValueList):
        self.myInitGuard.isInitOrCrash()
        for logFunc in self._log('fill-write-tag-values').debug3Func(): logFunc('called: tagValueList=%s', tagValueList)

        
        if self.hasImplementation():
            valImplementation = Value()
            if self.implementation is not None:
                valImplementation.setEnum(self.implementation.getValue())
            else:
                valImplementation.setEmpty()
            tagValueList.push(("implementation", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-storage-controller"), valImplementation)
        
        if self.hasInternalId():
            valInternalId = Value()
            if self.internalId is not None:
                valInternalId.setString(self.internalId)
            else:
                valInternalId.setEmpty()
            tagValueList.push(("internal-id", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-storage-controller"), valInternalId)
        

        
        if self.timeoutsObj:
            valBegin = Value()
            (tag, ns, prefix) = ("timeouts" , "http://qwilt.com/ns/yang/device/tech/qwilt-tech-storage-controller", "qt-strg-ctrl")
            valBegin.setXmlBegin((tag, ns, prefix))
            tagValueList.push((tag, ns), valBegin)

            tagValueListLen = tagValueList.getLen()

            res = self.timeoutsObj._fillWriteTagValues(tagValueList)
            if res != ReturnCodes.kOk:
                for logFunc in self._log('fill-write-tag-values-timeouts-failed').errorFunc(): logFunc('timeoutsObj._fillWriteTagValues() failed. PARAMS')
                return ReturnCodes.kGeneralError

            if tagValueList.getLen() == tagValueListLen:
                # descendant didn't add anything, no need to read it.
                tagValueList.pop()
            else:
                valEnd = Value()
                valEnd.setXmlEnd((tag, ns, prefix))
                tagValueList.push((tag, ns), valEnd)
        

        return ReturnCodes.kOk
コード例 #24
0
    def fillTagValues (self, keyPath, tagValueList, operData):
        initialListSize = tagValueList.getLen()
        for logFunc in self._log("fill-tag-values").debug3Func(): logFunc("called. operData=%s, keyPath=%s, initialListSize=%d", operData.debugStr(True), keyPath, initialListSize)
        # fill tag values up to current
        if self.myKeyPath.isEqualLen(keyPath, keyPath.getLen()):
            i = keyPath.getLen()
            while i < self.myKeyPath.getLen():
                valBegin = Value()
                (tag, ns, prefix) = self.myKeyPath.getAt(i).asXmlTag()
                valBegin.setXmlBegin((tag, ns, prefix))
                tagValueList.push((tag, ns), valBegin)
                for logFunc in self._log("fill-tag-values-adding").debug3Func(): logFunc("adding xml begin. i=%d, valBegin=%s, self.myKeyPath.getLen()=%d", i, valBegin, self.myKeyPath.getLen())
                i+=1
        
        if operData.isDriverTypeRequested() and operData.hasDriverType():
            val = Value()
            val.setEnum(operData.driverType.getValue())
            tagValueList.push(("driver-type", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-interfaces"), val)
        
        if operData.isPciAddressRequested() and operData.hasPciAddress():
            val = Value()
            val.setString(operData.pciAddress)
            tagValueList.push(("pci-address", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-interfaces"), val)
        
        if operData.isRouteTableIdRequested() and operData.hasRouteTableId():
            val = Value()
            val.setString(operData.routeTableId)
            tagValueList.push(("route-table-id", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-interfaces"), val)
        
        
        if self.myKeyPath.isEqualLen(keyPath, keyPath.getLen()):
            i = self.myKeyPath.getLen() - 1
            while i >= keyPath.getLen():
                valEnd = Value()
                (tag, ns, prefix) = self.myKeyPath.getAt(i).asXmlTag()
                valEnd.setXmlEnd((tag, ns, prefix))
                tagValueList.push((tag, ns), valEnd)
                i-=1

        for logFunc in self._log("fill-tag-values-ended").debug3Func(): logFunc("ended. operData=%s, keyPath=%s, initialListSize=%d, finalListSize=%d",
                                                  operData.debugStr(True), keyPath, initialListSize, tagValueList.getLen())
        return ReturnCodes.kOk
コード例 #25
0
    def fillTagValues (self, keyPath, tagValueList, operData):
        initialListSize = tagValueList.getLen()
        for logFunc in self._log("fill-tag-values").debug3Func(): logFunc("called. operData=%s, keyPath=%s, initialListSize=%d", operData.debugStr(True), keyPath, initialListSize)
        # fill tag values up to current
        if self.myKeyPath.isEqualLen(keyPath, keyPath.getLen()):
            i = keyPath.getLen()
            while i < self.myKeyPath.getLen():
                valBegin = Value()
                (tag, ns, prefix) = self.myKeyPath.getAt(i).asXmlTag()
                valBegin.setXmlBegin((tag, ns, prefix))
                tagValueList.push((tag, ns), valBegin)
                for logFunc in self._log("fill-tag-values-adding").debug3Func(): logFunc("adding xml begin. i=%d, valBegin=%s, self.myKeyPath.getLen()=%d", i, valBegin, self.myKeyPath.getLen())
                i+=1
        
        if operData.isOperationalStatusRequested() and operData.hasOperationalStatus():
            val = Value()
            val.setEnum(operData.operationalStatus.getValue())
            tagValueList.push(("operational-status", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-platform-power"), val)
        
        if operData.isOperationalStatusReasonRequested() and operData.hasOperationalStatusReason():
            val = Value()
            val.setEnum(operData.operationalStatusReason.getValue())
            tagValueList.push(("operational-status-reason", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-platform-power"), val)
        
        if operData.isLocationRequested() and operData.hasLocation():
            val = Value()
            val.setString(operData.location)
            tagValueList.push(("location", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-platform-power"), val)
        
        
        if self.myKeyPath.isEqualLen(keyPath, keyPath.getLen()):
            i = self.myKeyPath.getLen() - 1
            while i >= keyPath.getLen():
                valEnd = Value()
                (tag, ns, prefix) = self.myKeyPath.getAt(i).asXmlTag()
                valEnd.setXmlEnd((tag, ns, prefix))
                tagValueList.push((tag, ns), valEnd)
                i-=1

        for logFunc in self._log("fill-tag-values-ended").debug3Func(): logFunc("ended. operData=%s, keyPath=%s, initialListSize=%d, finalListSize=%d",
                                                  operData.debugStr(True), keyPath, initialListSize, tagValueList.getLen())
        return ReturnCodes.kOk
コード例 #26
0
    def _fillWriteTagValues (self, tagValueList):
        self.myInitGuard.isInitOrCrash()
        for logFunc in self._log('fill-write-tag-values').debug3Func(): logFunc('called: tagValueList=%s', tagValueList)

        
        if self.hasController():
            valController = Value()
            if self.controller is not None:
                valController.setString(self.controller)
            else:
                valController.setEmpty()
            tagValueList.push(("controller", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-storage-module"), valController)
        
        if self.hasEnabled():
            valEnabled = Value()
            if self.enabled is not None:
                valEnabled.setBool(self.enabled)
            else:
                valEnabled.setEmpty()
            tagValueList.push(("enabled", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-storage-module"), valEnabled)
        
        if self.hasDescription():
            valDescription = Value()
            if self.description is not None:
                valDescription.setString(self.description)
            else:
                valDescription.setEmpty()
            tagValueList.push(("description", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-storage-module"), valDescription)
        
        if self.hasLocationType():
            valLocationType = Value()
            if self.locationType is not None:
                valLocationType.setEnum(self.locationType.getValue())
            else:
                valLocationType.setEmpty()
            tagValueList.push(("location-type", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-storage-module"), valLocationType)
        

        

        return ReturnCodes.kOk
コード例 #27
0
    def _fillWriteTagValues (self, tagValueList):
        self.myInitGuard.isInitOrCrash()
        for logFunc in self._log('fill-write-tag-values').debug3Func(): logFunc('called: tagValueList=%s', tagValueList)

        
        if self.hasSystemProtected():
            valSystemProtected = Value()
            if self.systemProtected is not None:
                valSystemProtected.setBool(self.systemProtected)
            else:
                valSystemProtected.setEmpty()
            tagValueList.push(("system-protected", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-linux-variables"), valSystemProtected)
        
        if self.hasInitPhase():
            valInitPhase = Value()
            if self.initPhase is not None:
                valInitPhase.setEnum(self.initPhase.getValue())
            else:
                valInitPhase.setEmpty()
            tagValueList.push(("init-phase", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-linux-variables"), valInitPhase)
        
        if self.hasDescription():
            valDescription = Value()
            if self.description is not None:
                valDescription.setString(self.description)
            else:
                valDescription.setEmpty()
            tagValueList.push(("description", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-linux-variables"), valDescription)
        
        if self.hasValue():
            valValue = Value()
            if self.value is not None:
                valValue.setString(self.value)
            else:
                valValue.setEmpty()
            tagValueList.push(("value", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-linux-variables"), valValue)
        

        

        return ReturnCodes.kOk
コード例 #28
0
    def _fillWriteTagValues (self, tagValueList):
        self.myInitGuard.isInitOrCrash()
        for logFunc in self._log('fill-write-tag-values').debug3Func(): logFunc('called: tagValueList=%s', tagValueList)

        
        if self.hasLogBacktrace():
            valLogBacktrace = Value()
            if self.logBacktrace is not None:
                valLogBacktrace.setEnum(self.logBacktrace.getValue())
            else:
                valLogBacktrace.setEmpty()
            tagValueList.push(("log-backtrace", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-debug"), valLogBacktrace)
        
        if self.hasIgnoreCondition():
            valIgnoreCondition = Value()
            if self.ignoreCondition is not None:
                valIgnoreCondition.setEnum(self.ignoreCondition.getValue())
            else:
                valIgnoreCondition.setEmpty()
            tagValueList.push(("ignore-condition", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-debug"), valIgnoreCondition)
        
        if self.hasLog():
            valLog = Value()
            if self.log is not None:
                valLog.setEnum(self.log.getValue())
            else:
                valLog.setEmpty()
            tagValueList.push(("log", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-debug"), valLog)
        

        

        return ReturnCodes.kOk
コード例 #29
0
    def _fillWriteTagValues(self, tagValueList):
        self.myInitGuard.isInitOrCrash()
        for logFunc in self._log('fill-write-tag-values').debug3Func():
            logFunc('called: tagValueList=%s', tagValueList)

        if self.hasId():
            valId = Value()
            if self.id is not None:
                valId.setString(self.id)
            else:
                valId.setEmpty()
            tagValueList.push((
                "id",
                "http://qwilt.com/ns/yang/device/tech/qwilt-tech-system-alarms"
            ), valId)

        if self.hasName():
            valName = Value()
            if self.name is not None:
                valName.setEnum(self.name.getValue())
            else:
                valName.setEmpty()
            tagValueList.push((
                "name",
                "http://qwilt.com/ns/yang/device/tech/qwilt-tech-system-alarms"
            ), valName)

        if self.hasEntity():
            valEntity = Value()
            if self.entity is not None:
                valEntity.setString(self.entity)
            else:
                valEntity.setEmpty()
            tagValueList.push((
                "entity",
                "http://qwilt.com/ns/yang/device/tech/qwilt-tech-system-alarms"
            ), valEntity)

        return ReturnCodes.kOk
コード例 #30
0
    def _fillWriteTagValues(self, tagValueList):
        self.myInitGuard.isInitOrCrash()
        for logFunc in self._log('fill-write-tag-values').debug3Func():
            logFunc('called: tagValueList=%s', tagValueList)

        if self.hasImplementation():
            valImplementation = Value()
            if self.implementation is not None:
                valImplementation.setEnum(self.implementation.getValue())
            else:
                valImplementation.setEmpty()
            tagValueList.push(
                ("implementation",
                 "http://qwilt.com/ns/yang/device/tech/qwilt-tech-storage-disk"
                 ), valImplementation)

        if self.hasController():
            valController = Value()
            if self.controller is not None:
                valController.setString(self.controller)
            else:
                valController.setEmpty()
            tagValueList.push(
                ("controller",
                 "http://qwilt.com/ns/yang/device/tech/qwilt-tech-storage-disk"
                 ), valController)

        if self.hasId():
            valId = Value()
            if self.id is not None:
                valId.setString(self.id)
            else:
                valId.setEmpty()
            tagValueList.push(
                ("id",
                 "http://qwilt.com/ns/yang/device/tech/qwilt-tech-storage-disk"
                 ), valId)

        return ReturnCodes.kOk
コード例 #31
0
    def _getSelfKeyPath(self, registered, junkForTemplate):
        for logFunc in self._log('get-self-key-path').debug3Func():
            logFunc('called. PARAMS, junkForTemplate=%s', junkForTemplate)
        keyPath = KeyPath()

        ancestorVal = Value()
        ancestorVal.setEnum(registered.getValue())
        keyPath.addKeyPathPrefix(ancestorVal)

        xmlVal = Value()
        xmlVal.setXmlTag(
            ("registered",
             "http://qwilt.com/ns/yang/device/tech/qwilt-tech-system-alarms",
             "qt-sys-alarms"))
        keyPath.addKeyPathPrefix(xmlVal)

        xmlVal = Value()
        xmlVal.setXmlTag(
            ("alarms",
             "http://qwilt.com/ns/yang/device/tech/qwilt-tech-system-alarms",
             "qt-sys-alarms"))
        keyPath.addKeyPathPrefix(xmlVal)

        xmlVal = Value()
        xmlVal.setXmlTag(
            ("system",
             "http://qwilt.com/ns/yang/device/tech/qwilt-tech-system",
             "qt-sys"))
        keyPath.addKeyPathPrefix(xmlVal)

        xmlVal = Value()
        xmlVal.setXmlTag(
            ("tech", "http://qwilt.com/ns/yang/device/tech/qwilt-tech", "qt"))
        keyPath.addKeyPathPrefix(xmlVal)

        for logFunc in self._log('get-self-key-path-done').debug3Func():
            logFunc('done. keyPath=%s. PARAMS', keyPath)
        return keyPath
コード例 #32
0
    def _fillWriteTagValues(self, tagValueList):
        self.myInitGuard.isInitOrCrash()
        for logFunc in self._log('fill-write-tag-values').debug3Func():
            logFunc('called: tagValueList=%s', tagValueList)

        if self.hasAutoInit():
            valAutoInit = Value()
            if self.autoInit is not None:
                valAutoInit.setBool(self.autoInit)
            else:
                valAutoInit.setEmpty()
            tagValueList.push(
                ("auto-init",
                 "http://qwilt.com/ns/yang/device/tech/qwilt-tech-storage-disk"
                 ), valAutoInit)

        if self.hasOsDevice():
            valOsDevice = Value()
            if self.osDevice is not None:
                valOsDevice.setString(self.osDevice)
            else:
                valOsDevice.setEmpty()
            tagValueList.push(
                ("os-device",
                 "http://qwilt.com/ns/yang/device/tech/qwilt-tech-storage-disk"
                 ), valOsDevice)

        if self.hasImplementation():
            valImplementation = Value()
            if self.implementation is not None:
                valImplementation.setEnum(self.implementation.getValue())
            else:
                valImplementation.setEmpty()
            tagValueList.push(
                ("implementation",
                 "http://qwilt.com/ns/yang/device/tech/qwilt-tech-storage-disk"
                 ), valImplementation)

        if self.hasRaidType():
            valRaidType = Value()
            if self.raidType is not None:
                valRaidType.setEnum(self.raidType.getValue())
            else:
                valRaidType.setEmpty()
            tagValueList.push(
                ("raid-type",
                 "http://qwilt.com/ns/yang/device/tech/qwilt-tech-storage-disk"
                 ), valRaidType)

        if self.hasName():
            valName = Value()
            if self.name is not None:
                valName.setString(self.name)
            else:
                valName.setEmpty()
            tagValueList.push(
                ("name",
                 "http://qwilt.com/ns/yang/device/tech/qwilt-tech-storage-disk"
                 ), valName)

        if self.statusObj:
            valBegin = Value()
            (tag, ns, prefix) = (
                "status",
                "http://qwilt.com/ns/yang/device/tech/qwilt-tech-storage-disk",
                "qt-strg-dsk")
            valBegin.setXmlBegin((tag, ns, prefix))
            tagValueList.push((tag, ns), valBegin)

            tagValueListLen = tagValueList.getLen()

            res = self.statusObj._fillWriteTagValues(tagValueList)
            if res != ReturnCodes.kOk:
                for logFunc in self._log(
                        'fill-write-tag-values-status-failed').errorFunc():
                    logFunc('statusObj._fillWriteTagValues() failed. PARAMS')
                return ReturnCodes.kGeneralError

            if tagValueList.getLen() == tagValueListLen:
                # descendant didn't add anything, no need to read it.
                tagValueList.pop()
            else:
                valEnd = Value()
                valEnd.setXmlEnd((tag, ns, prefix))
                tagValueList.push((tag, ns), valEnd)

        return ReturnCodes.kOk
コード例 #33
0
    def fillTagValues (self, keyPath, tagValueList, operData):
        initialListSize = tagValueList.getLen()
        for logFunc in self._log("fill-tag-values").debug3Func(): logFunc("called. operData=%s, keyPath=%s, initialListSize=%d", operData.debugStr(True), keyPath, initialListSize)
        # fill tag values up to current
        if self.myKeyPath.isEqualLen(keyPath, keyPath.getLen()):
            i = keyPath.getLen()
            while i < self.myKeyPath.getLen():
                valBegin = Value()
                (tag, ns, prefix) = self.myKeyPath.getAt(i).asXmlTag()
                valBegin.setXmlBegin((tag, ns, prefix))
                tagValueList.push((tag, ns), valBegin)
                for logFunc in self._log("fill-tag-values-adding").debug3Func(): logFunc("adding xml begin. i=%d, valBegin=%s, self.myKeyPath.getLen()=%d", i, valBegin, self.myKeyPath.getLen())
                i+=1
        
        if operData.isStatusRequested() and operData.hasStatus():
            val = Value()
            val.setEnum(operData.status.getValue())
            tagValueList.push(("status", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-platform-fans"), val)
        
        if operData.isIndexRequested() and operData.hasIndex():
            val = Value()
            val.setString(operData.index)
            tagValueList.push(("index", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-platform-fans"), val)
        
        if operData.isMinimumWarningRpmRequested() and operData.hasMinimumWarningRpm():
            val = Value()
            val.setString(operData.minimumWarningRpm)
            tagValueList.push(("minimum-warning-rpm", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-platform-fans"), val)
        
        if operData.isCurrentRpmRequested() and operData.hasCurrentRpm():
            val = Value()
            val.setString(operData.currentRpm)
            tagValueList.push(("current-rpm", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-platform-fans"), val)
        
        if operData.isMaximumWarningRpmRequested() and operData.hasMaximumWarningRpm():
            val = Value()
            val.setString(operData.maximumWarningRpm)
            tagValueList.push(("maximum-warning-rpm", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-platform-fans"), val)
        
        if operData.isProbeNameRequested() and operData.hasProbeName():
            val = Value()
            val.setString(operData.probeName)
            tagValueList.push(("probe-name", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-platform-fans"), val)
        
        if operData.isStatusRawRequested() and operData.hasStatusRaw():
            val = Value()
            val.setString(operData.statusRaw)
            tagValueList.push(("status-raw", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-platform-fans"), val)
        
        if operData.isMinimumErrorRpmRequested() and operData.hasMinimumErrorRpm():
            val = Value()
            val.setString(operData.minimumErrorRpm)
            tagValueList.push(("minimum-error-rpm", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-platform-fans"), val)
        
        if operData.isMaximumErrorRpmRequested() and operData.hasMaximumErrorRpm():
            val = Value()
            val.setString(operData.maximumErrorRpm)
            tagValueList.push(("maximum-error-rpm", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-platform-fans"), val)
        
        
        if self.myKeyPath.isEqualLen(keyPath, keyPath.getLen()):
            i = self.myKeyPath.getLen() - 1
            while i >= keyPath.getLen():
                valEnd = Value()
                (tag, ns, prefix) = self.myKeyPath.getAt(i).asXmlTag()
                valEnd.setXmlEnd((tag, ns, prefix))
                tagValueList.push((tag, ns), valEnd)
                i-=1

        for logFunc in self._log("fill-tag-values-ended").debug3Func(): logFunc("ended. operData=%s, keyPath=%s, initialListSize=%d, finalListSize=%d",
                                                  operData.debugStr(True), keyPath, initialListSize, tagValueList.getLen())
        return ReturnCodes.kOk
コード例 #34
0
    def _fillWriteTagValues (self, tagValueList):
        self.myInitGuard.isInitOrCrash()
        for logFunc in self._log('fill-write-tag-values').debug3Func(): logFunc('called: tagValueList=%s', tagValueList)

        
        if self.hasAutoInit():
            valAutoInit = Value()
            if self.autoInit is not None:
                valAutoInit.setBool(self.autoInit)
            else:
                valAutoInit.setEmpty()
            tagValueList.push(("auto-init", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-storage-disk"), valAutoInit)
        
        if self.hasOsDevice():
            valOsDevice = Value()
            if self.osDevice is not None:
                valOsDevice.setString(self.osDevice)
            else:
                valOsDevice.setEmpty()
            tagValueList.push(("os-device", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-storage-disk"), valOsDevice)
        
        if self.hasImplementation():
            valImplementation = Value()
            if self.implementation is not None:
                valImplementation.setEnum(self.implementation.getValue())
            else:
                valImplementation.setEmpty()
            tagValueList.push(("implementation", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-storage-disk"), valImplementation)
        
        if self.hasRaidType():
            valRaidType = Value()
            if self.raidType is not None:
                valRaidType.setEnum(self.raidType.getValue())
            else:
                valRaidType.setEmpty()
            tagValueList.push(("raid-type", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-storage-disk"), valRaidType)
        
        if self.hasName():
            valName = Value()
            if self.name is not None:
                valName.setString(self.name)
            else:
                valName.setEmpty()
            tagValueList.push(("name", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-storage-disk"), valName)
        

        
        if self.statusObj:
            valBegin = Value()
            (tag, ns, prefix) = ("status" , "http://qwilt.com/ns/yang/device/tech/qwilt-tech-storage-disk", "qt-strg-dsk")
            valBegin.setXmlBegin((tag, ns, prefix))
            tagValueList.push((tag, ns), valBegin)

            tagValueListLen = tagValueList.getLen()

            res = self.statusObj._fillWriteTagValues(tagValueList)
            if res != ReturnCodes.kOk:
                for logFunc in self._log('fill-write-tag-values-status-failed').errorFunc(): logFunc('statusObj._fillWriteTagValues() failed. PARAMS')
                return ReturnCodes.kGeneralError

            if tagValueList.getLen() == tagValueListLen:
                # descendant didn't add anything, no need to read it.
                tagValueList.pop()
            else:
                valEnd = Value()
                valEnd.setXmlEnd((tag, ns, prefix))
                tagValueList.push((tag, ns), valEnd)
        

        return ReturnCodes.kOk
コード例 #35
0
    def fillTagValues(self, keyPath, tagValueList, operData):
        initialListSize = tagValueList.getLen()
        for logFunc in self._log("fill-tag-values").debug3Func():
            logFunc("called. operData=%s, keyPath=%s, initialListSize=%d",
                    operData.debugStr(True), keyPath, initialListSize)
        # fill tag values up to current
        if self.myKeyPath.isEqualLen(keyPath, keyPath.getLen()):
            i = keyPath.getLen()
            while i < self.myKeyPath.getLen():
                valBegin = Value()
                (tag, ns, prefix) = self.myKeyPath.getAt(i).asXmlTag()
                valBegin.setXmlBegin((tag, ns, prefix))
                tagValueList.push((tag, ns), valBegin)
                for logFunc in self._log(
                        "fill-tag-values-adding").debug3Func():
                    logFunc(
                        "adding xml begin. i=%d, valBegin=%s, self.myKeyPath.getLen()=%d",
                        i, valBegin, self.myKeyPath.getLen())
                i += 1

        if operData.isErrorCountRequested() and operData.hasErrorCount():
            val = Value()
            val.setInt64(operData.errorCount)
            tagValueList.push((
                "error-count",
                "http://qwilt.com/ns/yang/device/tech/qwilt-tech-system-alarms"
            ), val)

        if operData.isEmergencyCountRequested() and operData.hasEmergencyCount(
        ):
            val = Value()
            val.setInt64(operData.emergencyCount)
            tagValueList.push((
                "emergency-count",
                "http://qwilt.com/ns/yang/device/tech/qwilt-tech-system-alarms"
            ), val)

        if operData.isHighestSeverityRequested(
        ) and operData.hasHighestSeverity():
            val = Value()
            val.setEnum(operData.highestSeverity.getValue())
            tagValueList.push((
                "highest-severity",
                "http://qwilt.com/ns/yang/device/tech/qwilt-tech-system-alarms"
            ), val)

        if operData.isCriticalCountRequested() and operData.hasCriticalCount():
            val = Value()
            val.setInt64(operData.criticalCount)
            tagValueList.push((
                "critical-count",
                "http://qwilt.com/ns/yang/device/tech/qwilt-tech-system-alarms"
            ), val)

        if operData.isWarningCountRequested() and operData.hasWarningCount():
            val = Value()
            val.setInt64(operData.warningCount)
            tagValueList.push((
                "warning-count",
                "http://qwilt.com/ns/yang/device/tech/qwilt-tech-system-alarms"
            ), val)

        if operData.isAlertCountRequested() and operData.hasAlertCount():
            val = Value()
            val.setInt64(operData.alertCount)
            tagValueList.push((
                "alert-count",
                "http://qwilt.com/ns/yang/device/tech/qwilt-tech-system-alarms"
            ), val)

        if operData.isNoticeCountRequested() and operData.hasNoticeCount():
            val = Value()
            val.setInt64(operData.noticeCount)
            tagValueList.push((
                "notice-count",
                "http://qwilt.com/ns/yang/device/tech/qwilt-tech-system-alarms"
            ), val)

        if self.myKeyPath.isEqualLen(keyPath, keyPath.getLen()):
            i = self.myKeyPath.getLen() - 1
            while i >= keyPath.getLen():
                valEnd = Value()
                (tag, ns, prefix) = self.myKeyPath.getAt(i).asXmlTag()
                valEnd.setXmlEnd((tag, ns, prefix))
                tagValueList.push((tag, ns), valEnd)
                i -= 1

        for logFunc in self._log("fill-tag-values-ended").debug3Func():
            logFunc(
                "ended. operData=%s, keyPath=%s, initialListSize=%d, finalListSize=%d",
                operData.debugStr(True), keyPath, initialListSize,
                tagValueList.getLen())
        return ReturnCodes.kOk
コード例 #36
0
    def fillTagValues(self, keyPath, tagValueList, operData):
        initialListSize = tagValueList.getLen()
        for logFunc in self._log("fill-tag-values").debug3Func():
            logFunc("called. operData=%s, keyPath=%s, initialListSize=%d",
                    operData.debugStr(True), keyPath, initialListSize)
        # fill tag values up to current
        if self.myKeyPath.isEqualLen(keyPath, keyPath.getLen()):
            i = keyPath.getLen()
            while i < self.myKeyPath.getLen():
                valBegin = Value()
                (tag, ns, prefix) = self.myKeyPath.getAt(i).asXmlTag()
                valBegin.setXmlBegin((tag, ns, prefix))
                tagValueList.push((tag, ns), valBegin)
                for logFunc in self._log(
                        "fill-tag-values-adding").debug3Func():
                    logFunc(
                        "adding xml begin. i=%d, valBegin=%s, self.myKeyPath.getLen()=%d",
                        i, valBegin, self.myKeyPath.getLen())
                i += 1

        if operData.isDescriptionRequested() and operData.hasDescription():
            val = Value()
            val.setString(operData.description)
            tagValueList.push((
                "description",
                "http://qwilt.com/ns/yang/device/tech/qwilt-tech-system-alarms"
            ), val)

        if operData.isSeverityRequested() and operData.hasSeverity():
            val = Value()
            val.setEnum(operData.severity.getValue())
            tagValueList.push((
                "severity",
                "http://qwilt.com/ns/yang/device/tech/qwilt-tech-system-alarms"
            ), val)

        if operData.isNumberRequested() and operData.hasNumber():
            val = Value()
            val.setInt64(operData.number)
            tagValueList.push((
                "number",
                "http://qwilt.com/ns/yang/device/tech/qwilt-tech-system-alarms"
            ), val)

        if operData.isEntityRequested() and operData.hasEntity():
            val = Value()
            val.setString(operData.entity)
            tagValueList.push((
                "entity",
                "http://qwilt.com/ns/yang/device/tech/qwilt-tech-system-alarms"
            ), val)

        if operData.isSourceRequested() and operData.hasSource():
            val = Value()
            val.setString(operData.source)
            tagValueList.push((
                "source",
                "http://qwilt.com/ns/yang/device/tech/qwilt-tech-system-alarms"
            ), val)

        if operData.isSimulatedRequested() and operData.hasSimulated():
            val = Value()
            val.setBool(operData.simulated)
            tagValueList.push((
                "simulated",
                "http://qwilt.com/ns/yang/device/tech/qwilt-tech-system-alarms"
            ), val)

        if operData.isNameRequested() and operData.hasName():
            val = Value()
            val.setEnum(operData.name.getValue())
            tagValueList.push((
                "name",
                "http://qwilt.com/ns/yang/device/tech/qwilt-tech-system-alarms"
            ), val)

        if self.myKeyPath.isEqualLen(keyPath, keyPath.getLen()):
            i = self.myKeyPath.getLen() - 1
            while i >= keyPath.getLen():
                valEnd = Value()
                (tag, ns, prefix) = self.myKeyPath.getAt(i).asXmlTag()
                valEnd.setXmlEnd((tag, ns, prefix))
                tagValueList.push((tag, ns), valEnd)
                i -= 1

        for logFunc in self._log("fill-tag-values-ended").debug3Func():
            logFunc(
                "ended. operData=%s, keyPath=%s, initialListSize=%d, finalListSize=%d",
                operData.debugStr(True), keyPath, initialListSize,
                tagValueList.getLen())
        return ReturnCodes.kOk
コード例 #37
0
    def _fillWriteTagValues(self, tagValueList):
        self.myInitGuard.isInitOrCrash()
        for logFunc in self._log('fill-write-tag-values').debug3Func():
            logFunc('called: tagValueList=%s', tagValueList)

        if self.hasName():
            valName = Value()
            if self.name is not None:
                valName.setString(self.name)
            else:
                valName.setEmpty()
            tagValueList.push(
                ("name",
                 "http://qwilt.com/ns/yang/device/tech/qwilt-tech-snmp"),
                valName)

        if self.hasDestination():
            valDestination = Value()
            if self.destination is not None:
                valDestination.setString(self.destination)
            else:
                valDestination.setEmpty()
            tagValueList.push(
                ("destination",
                 "http://qwilt.com/ns/yang/device/tech/qwilt-tech-snmp"),
                valDestination)

        if self.hasCommunity():
            valCommunity = Value()
            if self.community is not None:
                valCommunity.setString(self.community)
            else:
                valCommunity.setEmpty()
            tagValueList.push(
                ("community",
                 "http://qwilt.com/ns/yang/device/tech/qwilt-tech-snmp"),
                valCommunity)

        if self.hasVersion():
            valVersion = Value()
            if self.version is not None:
                valVersion.setEnum(self.version.getValue())
            else:
                valVersion.setEmpty()
            tagValueList.push(
                ("version",
                 "http://qwilt.com/ns/yang/device/tech/qwilt-tech-snmp"),
                valVersion)

        if self.hasType_():
            valType_ = Value()
            if self.type_ is not None:
                valType_.setEnum(self.type_.getValue())
            else:
                valType_.setEmpty()
            tagValueList.push(
                ("type",
                 "http://qwilt.com/ns/yang/device/tech/qwilt-tech-snmp"),
                valType_)

        if self.hasPort():
            valPort = Value()
            if self.port is not None:
                valPort.setUint16(self.port)
            else:
                valPort.setEmpty()
            tagValueList.push(
                ("port",
                 "http://qwilt.com/ns/yang/device/tech/qwilt-tech-snmp"),
                valPort)

        return ReturnCodes.kOk
コード例 #38
0
    def _fillWriteTagValues (self, tagValueList):
        self.myInitGuard.isInitOrCrash()
        for logFunc in self._log('fill-write-tag-values').debug3Func(): logFunc('called: tagValueList=%s', tagValueList)

        
        if self.hasThreadAffinity():
            valThreadAffinity = Value()
            if self.threadAffinity is not None:
                valThreadAffinity.setString(self.threadAffinity)
            else:
                valThreadAffinity.setEmpty()
            tagValueList.push(("thread-affinity", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-content-line"), valThreadAffinity)
        
        if self.hasIdleSleepMsec():
            valIdleSleepMsec = Value()
            if self.idleSleepMsec is not None:
                valIdleSleepMsec.setInt64(self.idleSleepMsec)
            else:
                valIdleSleepMsec.setEmpty()
            tagValueList.push(("idle-sleep-msec", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-content-line"), valIdleSleepMsec)
        
        if self.hasEnabled():
            valEnabled = Value()
            if self.enabled is not None:
                valEnabled.setBool(self.enabled)
            else:
                valEnabled.setEmpty()
            tagValueList.push(("enabled", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-content-line"), valEnabled)
        
        if self.hasMode():
            valMode = Value()
            if self.mode is not None:
                valMode.setEnum(self.mode.getValue())
            else:
                valMode.setEmpty()
            tagValueList.push(("mode", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-content-line"), valMode)
        
        if self.hasThreadPriority():
            valThreadPriority = Value()
            if self.threadPriority is not None:
                valThreadPriority.setString(self.threadPriority)
            else:
                valThreadPriority.setEmpty()
            tagValueList.push(("thread-priority", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-content-line"), valThreadPriority)
        

        
        if self.loggingObj:
            valBegin = Value()
            (tag, ns, prefix) = ("logging" , "http://qwilt.com/ns/yang/device/tech/qwilt-tech-content-line", "qtc-line")
            valBegin.setXmlBegin((tag, ns, prefix))
            tagValueList.push((tag, ns), valBegin)

            tagValueListLen = tagValueList.getLen()

            res = self.loggingObj._fillWriteTagValues(tagValueList)
            if res != ReturnCodes.kOk:
                for logFunc in self._log('fill-write-tag-values-logging-failed').errorFunc(): logFunc('loggingObj._fillWriteTagValues() failed. PARAMS')
                return ReturnCodes.kGeneralError

            if tagValueList.getLen() == tagValueListLen:
                # descendant didn't add anything, no need to read it.
                tagValueList.pop()
            else:
                valEnd = Value()
                valEnd.setXmlEnd((tag, ns, prefix))
                tagValueList.push((tag, ns), valEnd)
        
        if self.vipObj:
            valBegin = Value()
            (tag, ns, prefix) = ("vip" , "http://qwilt.com/ns/yang/device/tech/qwilt-tech-content-line", "qtc-line")
            valBegin.setXmlBegin((tag, ns, prefix))
            tagValueList.push((tag, ns), valBegin)

            tagValueListLen = tagValueList.getLen()

            res = self.vipObj._fillWriteTagValues(tagValueList)
            if res != ReturnCodes.kOk:
                for logFunc in self._log('fill-write-tag-values-vip-failed').errorFunc(): logFunc('vipObj._fillWriteTagValues() failed. PARAMS')
                return ReturnCodes.kGeneralError

            if tagValueList.getLen() == tagValueListLen:
                # descendant didn't add anything, no need to read it.
                tagValueList.pop()
            else:
                valEnd = Value()
                valEnd.setXmlEnd((tag, ns, prefix))
                tagValueList.push((tag, ns), valEnd)
        

        return ReturnCodes.kOk
コード例 #39
0
    def _fillWriteTagValues(self, tagValueList):
        self.myInitGuard.isInitOrCrash()
        for logFunc in self._log('fill-write-tag-values').debug3Func():
            logFunc('called: tagValueList=%s', tagValueList)

        if self.hasOsDevice():
            valOsDevice = Value()
            if self.osDevice is not None:
                valOsDevice.setString(self.osDevice)
            else:
                valOsDevice.setEmpty()
            tagValueList.push(
                ("os-device",
                 "http://qwilt.com/ns/yang/device/tech/qwilt-tech-storage-disk"
                 ), valOsDevice)

        if self.hasImplementation():
            valImplementation = Value()
            if self.implementation is not None:
                valImplementation.setEnum(self.implementation.getValue())
            else:
                valImplementation.setEmpty()
            tagValueList.push(
                ("implementation",
                 "http://qwilt.com/ns/yang/device/tech/qwilt-tech-storage-disk"
                 ), valImplementation)

        if self.hasRaidType():
            valRaidType = Value()
            if self.raidType is not None:
                valRaidType.setEnum(self.raidType.getValue())
            else:
                valRaidType.setEmpty()
            tagValueList.push(
                ("raid-type",
                 "http://qwilt.com/ns/yang/device/tech/qwilt-tech-storage-disk"
                 ), valRaidType)

        if self.hasName():
            valName = Value()
            if self.name is not None:
                valName.setString(self.name)
            else:
                valName.setEmpty()
            tagValueList.push(
                ("name",
                 "http://qwilt.com/ns/yang/device/tech/qwilt-tech-storage-disk"
                 ), valName)

        if self.hasAutoInit():
            valAutoInit = Value()
            if self.autoInit is not None:
                valAutoInit.setBool(self.autoInit)
            else:
                valAutoInit.setEmpty()
            tagValueList.push(
                ("auto-init",
                 "http://qwilt.com/ns/yang/device/tech/qwilt-tech-storage-disk"
                 ), valAutoInit)

        return ReturnCodes.kOk
コード例 #40
0
    def _fillWriteTagValues (self, tagValueList):
        self.myInitGuard.isInitOrCrash()
        for logFunc in self._log('fill-write-tag-values').debug3Func(): logFunc('called: tagValueList=%s', tagValueList)

        
        if self.hasFileBaseName():
            valFileBaseName = Value()
            if self.fileBaseName is not None:
                valFileBaseName.setString(self.fileBaseName)
            else:
                valFileBaseName.setEmpty()
            tagValueList.push(("file-base-name", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-debug"), valFileBaseName)
        
        if self.hasMaxFileSizePercent():
            valMaxFileSizePercent = Value()
            if self.maxFileSizePercent is not None:
                valMaxFileSizePercent.setInt64(self.maxFileSizePercent)
            else:
                valMaxFileSizePercent.setEmpty()
            tagValueList.push(("max-file-size-percent", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-debug"), valMaxFileSizePercent)
        
        if self.hasFileDirectory():
            valFileDirectory = Value()
            if self.fileDirectory is not None:
                valFileDirectory.setString(self.fileDirectory)
            else:
                valFileDirectory.setEmpty()
            tagValueList.push(("file-directory", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-debug"), valFileDirectory)
        
        if self.hasArchiveMode():
            valArchiveMode = Value()
            if self.archiveMode is not None:
                valArchiveMode.setEnum(self.archiveMode.getValue())
            else:
                valArchiveMode.setEmpty()
            tagValueList.push(("archive-mode", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-debug"), valArchiveMode)
        
        if self.hasMaxSizeMb():
            valMaxSizeMb = Value()
            if self.maxSizeMb is not None:
                valMaxSizeMb.setInt64(self.maxSizeMb)
            else:
                valMaxSizeMb.setEmpty()
            tagValueList.push(("max-size-mb", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-debug"), valMaxSizeMb)
        
        if self.hasWriteMode():
            valWriteMode = Value()
            if self.writeMode is not None:
                valWriteMode.setEnum(self.writeMode.getValue())
            else:
                valWriteMode.setEmpty()
            tagValueList.push(("write-mode", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-debug"), valWriteMode)
        
        if self.hasFileRotationIntervalMinutes():
            valFileRotationIntervalMinutes = Value()
            if self.fileRotationIntervalMinutes is not None:
                valFileRotationIntervalMinutes.setInt64(self.fileRotationIntervalMinutes)
            else:
                valFileRotationIntervalMinutes.setEmpty()
            tagValueList.push(("file-rotation-interval-minutes", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-debug"), valFileRotationIntervalMinutes)
        

        

        return ReturnCodes.kOk
コード例 #41
0
    def fillTagValues (self, keyPath, tagValueList, operData):
        initialListSize = tagValueList.getLen()
        for logFunc in self._log("fill-tag-values").debug3Func(): logFunc("called. operData=%s, keyPath=%s, initialListSize=%d", operData.debugStr(True), keyPath, initialListSize)
        # fill tag values up to current
        if self.myKeyPath.isEqualLen(keyPath, keyPath.getLen()):
            i = keyPath.getLen()
            while i < self.myKeyPath.getLen():
                valBegin = Value()
                (tag, ns, prefix) = self.myKeyPath.getAt(i).asXmlTag()
                valBegin.setXmlBegin((tag, ns, prefix))
                tagValueList.push((tag, ns), valBegin)
                for logFunc in self._log("fill-tag-values-adding").debug3Func(): logFunc("adding xml begin. i=%d, valBegin=%s, self.myKeyPath.getLen()=%d", i, valBegin, self.myKeyPath.getLen())
                i+=1
        
        if operData.isPhysicalIdListRequested() and operData.hasPhysicalIdList():
            val = Value()
            val.setString(operData.physicalIdList)
            tagValueList.push(("physical-id-list", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-storage-disk"), val)
        
        if operData.isStatusRequested() and operData.hasStatus():
            val = Value()
            val.setEnum(operData.status.getValue())
            tagValueList.push(("status", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-storage-disk"), val)
        
        if operData.isStateRawRequested() and operData.hasStateRaw():
            val = Value()
            val.setString(operData.stateRaw)
            tagValueList.push(("state-raw", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-storage-disk"), val)
        
        if operData.isReadPolicyRequested() and operData.hasReadPolicy():
            val = Value()
            val.setString(operData.readPolicy)
            tagValueList.push(("read-policy", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-storage-disk"), val)
        
        if operData.isBadBlocksRequested() and operData.hasBadBlocks():
            val = Value()
            val.setBool(operData.badBlocks)
            tagValueList.push(("bad-blocks", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-storage-disk"), val)
        
        if operData.isMediaTypeRequested() and operData.hasMediaType():
            val = Value()
            val.setString(operData.mediaType)
            tagValueList.push(("media-type", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-storage-disk"), val)
        
        if operData.isHotSparePolicyViolationRequested() and operData.hasHotSparePolicyViolation():
            val = Value()
            val.setString(operData.hotSparePolicyViolation)
            tagValueList.push(("hot-spare-policy-violation", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-storage-disk"), val)
        
        if operData.isIdRequested() and operData.hasId():
            val = Value()
            val.setString(operData.id)
            tagValueList.push(("id", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-storage-disk"), val)
        
        if operData.isStateRequested() and operData.hasState():
            val = Value()
            val.setEnum(operData.state.getValue())
            tagValueList.push(("state", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-storage-disk"), val)
        
        if operData.isStatusRawRequested() and operData.hasStatusRaw():
            val = Value()
            val.setString(operData.statusRaw)
            tagValueList.push(("status-raw", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-storage-disk"), val)
        
        if operData.isDiskCachePolicyRequested() and operData.hasDiskCachePolicy():
            val = Value()
            val.setString(operData.diskCachePolicy)
            tagValueList.push(("disk-cache-policy", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-storage-disk"), val)
        
        if operData.isBadBlocksRawRequested() and operData.hasBadBlocksRaw():
            val = Value()
            val.setString(operData.badBlocksRaw)
            tagValueList.push(("bad-blocks-raw", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-storage-disk"), val)
        
        if operData.isCachePolicyRequested() and operData.hasCachePolicy():
            val = Value()
            val.setString(operData.cachePolicy)
            tagValueList.push(("cache-policy", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-storage-disk"), val)
        
        if operData.isWritePolicyRequested() and operData.hasWritePolicy():
            val = Value()
            val.setString(operData.writePolicy)
            tagValueList.push(("write-policy", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-storage-disk"), val)
        
        if operData.isRaidTypeRequested() and operData.hasRaidType():
            val = Value()
            val.setString(operData.raidType)
            tagValueList.push(("raid-type", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-storage-disk"), val)
        
        if operData.isStripeElementSizeRequested() and operData.hasStripeElementSize():
            val = Value()
            val.setString(operData.stripeElementSize)
            tagValueList.push(("stripe-element-size", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-storage-disk"), val)
        
        if operData.isSizeRawRequested() and operData.hasSizeRaw():
            val = Value()
            val.setString(operData.sizeRaw)
            tagValueList.push(("size-raw", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-storage-disk"), val)
        
        if operData.isSizeRequested() and operData.hasSize():
            val = Value()
            val.setInt64(operData.size)
            tagValueList.push(("size", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-storage-disk"), val)
        
        
        if self.myKeyPath.isEqualLen(keyPath, keyPath.getLen()):
            i = self.myKeyPath.getLen() - 1
            while i >= keyPath.getLen():
                valEnd = Value()
                (tag, ns, prefix) = self.myKeyPath.getAt(i).asXmlTag()
                valEnd.setXmlEnd((tag, ns, prefix))
                tagValueList.push((tag, ns), valEnd)
                i-=1

        for logFunc in self._log("fill-tag-values-ended").debug3Func(): logFunc("ended. operData=%s, keyPath=%s, initialListSize=%d, finalListSize=%d",
                                                  operData.debugStr(True), keyPath, initialListSize, tagValueList.getLen())
        return ReturnCodes.kOk
コード例 #42
0
    def fillTagValues (self, keyPath, tagValueList, operData):
        initialListSize = tagValueList.getLen()
        for logFunc in self._log("fill-tag-values").debug3Func(): logFunc("called. operData=%s, keyPath=%s, initialListSize=%d", operData.debugStr(True), keyPath, initialListSize)
        # fill tag values up to current
        if self.myKeyPath.isEqualLen(keyPath, keyPath.getLen()):
            i = keyPath.getLen()
            while i < self.myKeyPath.getLen():
                valBegin = Value()
                (tag, ns, prefix) = self.myKeyPath.getAt(i).asXmlTag()
                valBegin.setXmlBegin((tag, ns, prefix))
                tagValueList.push((tag, ns), valBegin)
                for logFunc in self._log("fill-tag-values-adding").debug3Func(): logFunc("adding xml begin. i=%d, valBegin=%s, self.myKeyPath.getLen()=%d", i, valBegin, self.myKeyPath.getLen())
                i+=1
        
        if operData.isErrorCountRequested() and operData.hasErrorCount():
            val = Value()
            val.setInt64(operData.errorCount)
            tagValueList.push(("error-count", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-system-alarms"), val)
        
        if operData.isEmergencyCountRequested() and operData.hasEmergencyCount():
            val = Value()
            val.setInt64(operData.emergencyCount)
            tagValueList.push(("emergency-count", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-system-alarms"), val)
        
        if operData.isHighestSeverityRequested() and operData.hasHighestSeverity():
            val = Value()
            val.setEnum(operData.highestSeverity.getValue())
            tagValueList.push(("highest-severity", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-system-alarms"), val)
        
        if operData.isCriticalCountRequested() and operData.hasCriticalCount():
            val = Value()
            val.setInt64(operData.criticalCount)
            tagValueList.push(("critical-count", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-system-alarms"), val)
        
        if operData.isWarningCountRequested() and operData.hasWarningCount():
            val = Value()
            val.setInt64(operData.warningCount)
            tagValueList.push(("warning-count", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-system-alarms"), val)
        
        if operData.isAlertCountRequested() and operData.hasAlertCount():
            val = Value()
            val.setInt64(operData.alertCount)
            tagValueList.push(("alert-count", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-system-alarms"), val)
        
        if operData.isNoticeCountRequested() and operData.hasNoticeCount():
            val = Value()
            val.setInt64(operData.noticeCount)
            tagValueList.push(("notice-count", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-system-alarms"), val)
        
        
        if self.myKeyPath.isEqualLen(keyPath, keyPath.getLen()):
            i = self.myKeyPath.getLen() - 1
            while i >= keyPath.getLen():
                valEnd = Value()
                (tag, ns, prefix) = self.myKeyPath.getAt(i).asXmlTag()
                valEnd.setXmlEnd((tag, ns, prefix))
                tagValueList.push((tag, ns), valEnd)
                i-=1

        for logFunc in self._log("fill-tag-values-ended").debug3Func(): logFunc("ended. operData=%s, keyPath=%s, initialListSize=%d, finalListSize=%d",
                                                  operData.debugStr(True), keyPath, initialListSize, tagValueList.getLen())
        return ReturnCodes.kOk
コード例 #43
0
    def fillTagValues (self, keyPath, tagValueList, operData):
        initialListSize = tagValueList.getLen()
        for logFunc in self._log("fill-tag-values").debug3Func(): logFunc("called. operData=%s, keyPath=%s, initialListSize=%d", operData.debugStr(True), keyPath, initialListSize)
        # fill tag values up to current
        if self.myKeyPath.isEqualLen(keyPath, keyPath.getLen()):
            i = keyPath.getLen()
            while i < self.myKeyPath.getLen():
                valBegin = Value()
                (tag, ns, prefix) = self.myKeyPath.getAt(i).asXmlTag()
                valBegin.setXmlBegin((tag, ns, prefix))
                tagValueList.push((tag, ns), valBegin)
                for logFunc in self._log("fill-tag-values-adding").debug3Func(): logFunc("adding xml begin. i=%d, valBegin=%s, self.myKeyPath.getLen()=%d", i, valBegin, self.myKeyPath.getLen())
                i+=1
        
        if operData.isFirmwareVersionRequested() and operData.hasFirmwareVersion():
            val = Value()
            val.setString(operData.firmwareVersion)
            tagValueList.push(("firmware-version", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-platform-power"), val)
        
        if operData.isIndexRequested() and operData.hasIndex():
            val = Value()
            val.setString(operData.index)
            tagValueList.push(("index", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-platform-power"), val)
        
        if operData.isFruDeviceRequested() and operData.hasFruDevice():
            val = Value()
            val.setString(operData.fruDevice)
            tagValueList.push(("fru-device", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-platform-power"), val)
        
        if operData.isManufactureDateRequested() and operData.hasManufactureDate():
            val = Value()
            val.setString(operData.manufactureDate)
            tagValueList.push(("manufacture-date", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-platform-power"), val)
        
        if operData.isOnlineStatusRequested() and operData.hasOnlineStatus():
            val = Value()
            val.setEnum(operData.onlineStatus.getValue())
            tagValueList.push(("online-status", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-platform-power"), val)
        
        if operData.isPartNumberRequested() and operData.hasPartNumber():
            val = Value()
            val.setString(operData.partNumber)
            tagValueList.push(("part-number", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-platform-power"), val)
        
        if operData.isSerialNumberRequested() and operData.hasSerialNumber():
            val = Value()
            val.setString(operData.serialNumber)
            tagValueList.push(("serial-number", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-platform-power"), val)
        
        if operData.isStatusRequested() and operData.hasStatus():
            val = Value()
            val.setEnum(operData.status.getValue())
            tagValueList.push(("status", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-platform-power"), val)
        
        if operData.isLocationRequested() and operData.hasLocation():
            val = Value()
            val.setString(operData.location)
            tagValueList.push(("location", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-platform-power"), val)
        
        if operData.isOnlineStatusRawRequested() and operData.hasOnlineStatusRaw():
            val = Value()
            val.setString(operData.onlineStatusRaw)
            tagValueList.push(("online-status-raw", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-platform-power"), val)
        
        if operData.isStatusRawRequested() and operData.hasStatusRaw():
            val = Value()
            val.setString(operData.statusRaw)
            tagValueList.push(("status-raw", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-platform-power"), val)
        
        if operData.isInputTypeRequested() and operData.hasInputType():
            val = Value()
            val.setString(operData.inputType)
            tagValueList.push(("input-type", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-platform-power"), val)
        
        if operData.isRatedInputWattageRequested() and operData.hasRatedInputWattage():
            val = Value()
            val.setString(operData.ratedInputWattage)
            tagValueList.push(("rated-input-wattage", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-platform-power"), val)
        
        if operData.isMaximumOutputWattageRequested() and operData.hasMaximumOutputWattage():
            val = Value()
            val.setString(operData.maximumOutputWattage)
            tagValueList.push(("maximum-output-wattage", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-platform-power"), val)
        
        if operData.isManufacturerRequested() and operData.hasManufacturer():
            val = Value()
            val.setString(operData.manufacturer)
            tagValueList.push(("manufacturer", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-platform-power"), val)
        
        if operData.isRevisionRequested() and operData.hasRevision():
            val = Value()
            val.setString(operData.revision)
            tagValueList.push(("revision", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-platform-power"), val)
        
        
        if self.myKeyPath.isEqualLen(keyPath, keyPath.getLen()):
            i = self.myKeyPath.getLen() - 1
            while i >= keyPath.getLen():
                valEnd = Value()
                (tag, ns, prefix) = self.myKeyPath.getAt(i).asXmlTag()
                valEnd.setXmlEnd((tag, ns, prefix))
                tagValueList.push((tag, ns), valEnd)
                i-=1

        for logFunc in self._log("fill-tag-values-ended").debug3Func(): logFunc("ended. operData=%s, keyPath=%s, initialListSize=%d, finalListSize=%d",
                                                  operData.debugStr(True), keyPath, initialListSize, tagValueList.getLen())
        return ReturnCodes.kOk
コード例 #44
0
ファイル: ipv4_maapi_gen.py プロジェクト: afeset/miner2-tools
    def _fillWriteTagValues (self, tagValueList):
        self.myInitGuard.isInitOrCrash()
        for logFunc in self._log('fill-write-tag-values').debug3Func(): logFunc('called: tagValueList=%s', tagValueList)

        
        if self.hasMethod():
            valMethod = Value()
            if self.method is not None:
                valMethod.setEnum(self.method.getValue())
            else:
                valMethod.setEmpty()
            tagValueList.push(("method", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-interfaces"), valMethod)
        

        
        if self.statusObj:
            valBegin = Value()
            (tag, ns, prefix) = ("status" , "http://qwilt.com/ns/yang/device/tech/qwilt-tech-interfaces", "qt-if")
            valBegin.setXmlBegin((tag, ns, prefix))
            tagValueList.push((tag, ns), valBegin)

            tagValueListLen = tagValueList.getLen()

            res = self.statusObj._fillWriteTagValues(tagValueList)
            if res != ReturnCodes.kOk:
                for logFunc in self._log('fill-write-tag-values-status-failed').errorFunc(): logFunc('statusObj._fillWriteTagValues() failed. PARAMS')
                return ReturnCodes.kGeneralError

            if tagValueList.getLen() == tagValueListLen:
                # descendant didn't add anything, no need to read it.
                tagValueList.pop()
            else:
                valEnd = Value()
                valEnd.setXmlEnd((tag, ns, prefix))
                tagValueList.push((tag, ns), valEnd)
        
        if self.arpObj:
            valBegin = Value()
            (tag, ns, prefix) = ("arp" , "http://qwilt.com/ns/yang/device/tech/qwilt-tech-interfaces", "qt-if")
            valBegin.setXmlBegin((tag, ns, prefix))
            tagValueList.push((tag, ns), valBegin)

            tagValueListLen = tagValueList.getLen()

            res = self.arpObj._fillWriteTagValues(tagValueList)
            if res != ReturnCodes.kOk:
                for logFunc in self._log('fill-write-tag-values-arp-failed').errorFunc(): logFunc('arpObj._fillWriteTagValues() failed. PARAMS')
                return ReturnCodes.kGeneralError

            if tagValueList.getLen() == tagValueListLen:
                # descendant didn't add anything, no need to read it.
                tagValueList.pop()
            else:
                valEnd = Value()
                valEnd.setXmlEnd((tag, ns, prefix))
                tagValueList.push((tag, ns), valEnd)
        
        if self.pingObj:
            valBegin = Value()
            (tag, ns, prefix) = ("ping" , "http://qwilt.com/ns/yang/device/tech/qwilt-tech-interfaces", "qt-if")
            valBegin.setXmlBegin((tag, ns, prefix))
            tagValueList.push((tag, ns), valBegin)

            tagValueListLen = tagValueList.getLen()

            res = self.pingObj._fillWriteTagValues(tagValueList)
            if res != ReturnCodes.kOk:
                for logFunc in self._log('fill-write-tag-values-ping-failed').errorFunc(): logFunc('pingObj._fillWriteTagValues() failed. PARAMS')
                return ReturnCodes.kGeneralError

            if tagValueList.getLen() == tagValueListLen:
                # descendant didn't add anything, no need to read it.
                tagValueList.pop()
            else:
                valEnd = Value()
                valEnd.setXmlEnd((tag, ns, prefix))
                tagValueList.push((tag, ns), valEnd)
        
        if self.countersObj:
            valBegin = Value()
            (tag, ns, prefix) = ("counters" , "http://qwilt.com/ns/yang/device/tech/qwilt-tech-interfaces", "qt-if")
            valBegin.setXmlBegin((tag, ns, prefix))
            tagValueList.push((tag, ns), valBegin)

            tagValueListLen = tagValueList.getLen()

            res = self.countersObj._fillWriteTagValues(tagValueList)
            if res != ReturnCodes.kOk:
                for logFunc in self._log('fill-write-tag-values-counters-failed').errorFunc(): logFunc('countersObj._fillWriteTagValues() failed. PARAMS')
                return ReturnCodes.kGeneralError

            if tagValueList.getLen() == tagValueListLen:
                # descendant didn't add anything, no need to read it.
                tagValueList.pop()
            else:
                valEnd = Value()
                valEnd.setXmlEnd((tag, ns, prefix))
                tagValueList.push((tag, ns), valEnd)
        

        return ReturnCodes.kOk
コード例 #45
0
    def fillTagValues(self, keyPath, tagValueList, operData):
        initialListSize = tagValueList.getLen()
        for logFunc in self._log("fill-tag-values").debug3Func():
            logFunc("called. operData=%s, keyPath=%s, initialListSize=%d",
                    operData.debugStr(True), keyPath, initialListSize)
        # fill tag values up to current
        if self.myKeyPath.isEqualLen(keyPath, keyPath.getLen()):
            i = keyPath.getLen()
            while i < self.myKeyPath.getLen():
                valBegin = Value()
                (tag, ns, prefix) = self.myKeyPath.getAt(i).asXmlTag()
                valBegin.setXmlBegin((tag, ns, prefix))
                tagValueList.push((tag, ns), valBegin)
                for logFunc in self._log(
                        "fill-tag-values-adding").debug3Func():
                    logFunc(
                        "adding xml begin. i=%d, valBegin=%s, self.myKeyPath.getLen()=%d",
                        i, valBegin, self.myKeyPath.getLen())
                i += 1

        if operData.isInterfaceIndexRequested() and operData.hasInterfaceIndex(
        ):
            val = Value()
            val.setUint32(operData.interfaceIndex)
            tagValueList.push(
                ("interface-index",
                 "http://qwilt.com/ns/yang/device/tech/qwilt-tech-interfaces"),
                val)

        if operData.isSpeedMegabitRequested() and operData.hasSpeedMegabit():
            val = Value()
            val.setUint32(operData.speedMegabit)
            tagValueList.push(
                ("speed-megabit",
                 "http://qwilt.com/ns/yang/device/tech/qwilt-tech-interfaces"),
                val)

        if operData.isMibAdminStatusRequested() and operData.hasMibAdminStatus(
        ):
            val = Value()
            val.setEnum(operData.mibAdminStatus.getValue())
            tagValueList.push(
                ("mib-admin-status",
                 "http://qwilt.com/ns/yang/device/tech/qwilt-tech-interfaces"),
                val)

        if operData.isPromiscuousRequested() and operData.hasPromiscuous():
            val = Value()
            val.setEnum(operData.promiscuous.getValue())
            tagValueList.push(
                ("promiscuous",
                 "http://qwilt.com/ns/yang/device/tech/qwilt-tech-interfaces"),
                val)

        if operData.isMibNameRequested() and operData.hasMibName():
            val = Value()
            val.setString(operData.mibName)
            tagValueList.push(
                ("mib-name",
                 "http://qwilt.com/ns/yang/device/tech/qwilt-tech-interfaces"),
                val)

        if operData.isMtuRequested() and operData.hasMtu():
            val = Value()
            val.setInt32(operData.mtu)
            tagValueList.push(
                ("mtu",
                 "http://qwilt.com/ns/yang/device/tech/qwilt-tech-interfaces"),
                val)

        if operData.isCounterDiscontinuityTicksRequested(
        ) and operData.hasCounterDiscontinuityTicks():
            val = Value()
            val.setUint32(operData.counterDiscontinuityTicks)
            tagValueList.push(
                ("counter-discontinuity-ticks",
                 "http://qwilt.com/ns/yang/device/tech/qwilt-tech-interfaces"),
                val)

        if operData.isMibIanaTypeRequested() and operData.hasMibIanaType():
            val = Value()
            val.setEnum(operData.mibIanaType.getValue())
            tagValueList.push(
                ("mib-iana-type",
                 "http://qwilt.com/ns/yang/device/tech/qwilt-tech-interfaces"),
                val)

        if operData.isMibSpeed32BitRequested() and operData.hasMibSpeed32Bit():
            val = Value()
            val.setUint32(operData.mibSpeed32Bit)
            tagValueList.push(
                ("mib-speed-32bit",
                 "http://qwilt.com/ns/yang/device/tech/qwilt-tech-interfaces"),
                val)

        if operData.isSpeedRequested() and operData.hasSpeed():
            val = Value()
            val.setUint64(operData.speed)
            tagValueList.push(
                ("speed",
                 "http://qwilt.com/ns/yang/device/tech/qwilt-tech-interfaces"),
                val)

        if operData.isConnectorPresentRequested(
        ) and operData.hasConnectorPresent():
            val = Value()
            val.setEnum(operData.connectorPresent.getValue())
            tagValueList.push(
                ("connector-present",
                 "http://qwilt.com/ns/yang/device/tech/qwilt-tech-interfaces"),
                val)

        if operData.isOperationalStatusRequested(
        ) and operData.hasOperationalStatus():
            val = Value()
            val.setEnum(operData.operationalStatus.getValue())
            tagValueList.push(
                ("operational-status",
                 "http://qwilt.com/ns/yang/device/tech/qwilt-tech-interfaces"),
                val)

        if self.myKeyPath.isEqualLen(keyPath, keyPath.getLen()):
            i = self.myKeyPath.getLen() - 1
            while i >= keyPath.getLen():
                valEnd = Value()
                (tag, ns, prefix) = self.myKeyPath.getAt(i).asXmlTag()
                valEnd.setXmlEnd((tag, ns, prefix))
                tagValueList.push((tag, ns), valEnd)
                i -= 1

        for logFunc in self._log("fill-tag-values-ended").debug3Func():
            logFunc(
                "ended. operData=%s, keyPath=%s, initialListSize=%d, finalListSize=%d",
                operData.debugStr(True), keyPath, initialListSize,
                tagValueList.getLen())
        return ReturnCodes.kOk
コード例 #46
0
    def fillTagValues (self, keyPath, tagValueList, operData):
        initialListSize = tagValueList.getLen()
        for logFunc in self._log("fill-tag-values").debug3Func(): logFunc("called. operData=%s, keyPath=%s, initialListSize=%d", operData.debugStr(True), keyPath, initialListSize)
        # fill tag values up to current
        if self.myKeyPath.isEqualLen(keyPath, keyPath.getLen()):
            i = keyPath.getLen()
            while i < self.myKeyPath.getLen():
                valBegin = Value()
                (tag, ns, prefix) = self.myKeyPath.getAt(i).asXmlTag()
                valBegin.setXmlBegin((tag, ns, prefix))
                tagValueList.push((tag, ns), valBegin)
                for logFunc in self._log("fill-tag-values-adding").debug3Func(): logFunc("adding xml begin. i=%d, valBegin=%s, self.myKeyPath.getLen()=%d", i, valBegin, self.myKeyPath.getLen())
                i+=1
        
        if operData.isInterfaceIndexRequested() and operData.hasInterfaceIndex():
            val = Value()
            val.setUint32(operData.interfaceIndex)
            tagValueList.push(("interface-index", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-interfaces"), val)
        
        if operData.isSpeedMegabitRequested() and operData.hasSpeedMegabit():
            val = Value()
            val.setUint32(operData.speedMegabit)
            tagValueList.push(("speed-megabit", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-interfaces"), val)
        
        if operData.isMibAdminStatusRequested() and operData.hasMibAdminStatus():
            val = Value()
            val.setEnum(operData.mibAdminStatus.getValue())
            tagValueList.push(("mib-admin-status", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-interfaces"), val)
        
        if operData.isPromiscuousRequested() and operData.hasPromiscuous():
            val = Value()
            val.setEnum(operData.promiscuous.getValue())
            tagValueList.push(("promiscuous", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-interfaces"), val)
        
        if operData.isMibNameRequested() and operData.hasMibName():
            val = Value()
            val.setString(operData.mibName)
            tagValueList.push(("mib-name", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-interfaces"), val)
        
        if operData.isMtuRequested() and operData.hasMtu():
            val = Value()
            val.setInt32(operData.mtu)
            tagValueList.push(("mtu", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-interfaces"), val)
        
        if operData.isCounterDiscontinuityTicksRequested() and operData.hasCounterDiscontinuityTicks():
            val = Value()
            val.setUint32(operData.counterDiscontinuityTicks)
            tagValueList.push(("counter-discontinuity-ticks", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-interfaces"), val)
        
        if operData.isMibIanaTypeRequested() and operData.hasMibIanaType():
            val = Value()
            val.setEnum(operData.mibIanaType.getValue())
            tagValueList.push(("mib-iana-type", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-interfaces"), val)
        
        if operData.isMibSpeed32BitRequested() and operData.hasMibSpeed32Bit():
            val = Value()
            val.setUint32(operData.mibSpeed32Bit)
            tagValueList.push(("mib-speed-32bit", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-interfaces"), val)
        
        if operData.isSpeedRequested() and operData.hasSpeed():
            val = Value()
            val.setUint64(operData.speed)
            tagValueList.push(("speed", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-interfaces"), val)
        
        if operData.isConnectorPresentRequested() and operData.hasConnectorPresent():
            val = Value()
            val.setEnum(operData.connectorPresent.getValue())
            tagValueList.push(("connector-present", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-interfaces"), val)
        
        if operData.isOperationalStatusRequested() and operData.hasOperationalStatus():
            val = Value()
            val.setEnum(operData.operationalStatus.getValue())
            tagValueList.push(("operational-status", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-interfaces"), val)
        
        
        if self.myKeyPath.isEqualLen(keyPath, keyPath.getLen()):
            i = self.myKeyPath.getLen() - 1
            while i >= keyPath.getLen():
                valEnd = Value()
                (tag, ns, prefix) = self.myKeyPath.getAt(i).asXmlTag()
                valEnd.setXmlEnd((tag, ns, prefix))
                tagValueList.push((tag, ns), valEnd)
                i-=1

        for logFunc in self._log("fill-tag-values-ended").debug3Func(): logFunc("ended. operData=%s, keyPath=%s, initialListSize=%d, finalListSize=%d",
                                                  operData.debugStr(True), keyPath, initialListSize, tagValueList.getLen())
        return ReturnCodes.kOk
コード例 #47
0
    def _fillWriteTagValues(self, tagValueList):
        self.myInitGuard.isInitOrCrash()
        for logFunc in self._log('fill-write-tag-values').debug3Func():
            logFunc('called: tagValueList=%s', tagValueList)

        if self.hasFileBaseName():
            valFileBaseName = Value()
            if self.fileBaseName is not None:
                valFileBaseName.setString(self.fileBaseName)
            else:
                valFileBaseName.setEmpty()
            tagValueList.push(
                ("file-base-name",
                 "http://qwilt.com/ns/yang/device/tech/qwilt-tech-debug"),
                valFileBaseName)

        if self.hasMaxFileSizePercent():
            valMaxFileSizePercent = Value()
            if self.maxFileSizePercent is not None:
                valMaxFileSizePercent.setInt64(self.maxFileSizePercent)
            else:
                valMaxFileSizePercent.setEmpty()
            tagValueList.push(
                ("max-file-size-percent",
                 "http://qwilt.com/ns/yang/device/tech/qwilt-tech-debug"),
                valMaxFileSizePercent)

        if self.hasFileDirectory():
            valFileDirectory = Value()
            if self.fileDirectory is not None:
                valFileDirectory.setString(self.fileDirectory)
            else:
                valFileDirectory.setEmpty()
            tagValueList.push(
                ("file-directory",
                 "http://qwilt.com/ns/yang/device/tech/qwilt-tech-debug"),
                valFileDirectory)

        if self.hasArchiveMode():
            valArchiveMode = Value()
            if self.archiveMode is not None:
                valArchiveMode.setEnum(self.archiveMode.getValue())
            else:
                valArchiveMode.setEmpty()
            tagValueList.push(
                ("archive-mode",
                 "http://qwilt.com/ns/yang/device/tech/qwilt-tech-debug"),
                valArchiveMode)

        if self.hasMaxSizeMb():
            valMaxSizeMb = Value()
            if self.maxSizeMb is not None:
                valMaxSizeMb.setInt64(self.maxSizeMb)
            else:
                valMaxSizeMb.setEmpty()
            tagValueList.push(
                ("max-size-mb",
                 "http://qwilt.com/ns/yang/device/tech/qwilt-tech-debug"),
                valMaxSizeMb)

        if self.hasWriteMode():
            valWriteMode = Value()
            if self.writeMode is not None:
                valWriteMode.setEnum(self.writeMode.getValue())
            else:
                valWriteMode.setEmpty()
            tagValueList.push(
                ("write-mode",
                 "http://qwilt.com/ns/yang/device/tech/qwilt-tech-debug"),
                valWriteMode)

        if self.hasFileRotationIntervalMinutes():
            valFileRotationIntervalMinutes = Value()
            if self.fileRotationIntervalMinutes is not None:
                valFileRotationIntervalMinutes.setInt64(
                    self.fileRotationIntervalMinutes)
            else:
                valFileRotationIntervalMinutes.setEmpty()
            tagValueList.push(
                ("file-rotation-interval-minutes",
                 "http://qwilt.com/ns/yang/device/tech/qwilt-tech-debug"),
                valFileRotationIntervalMinutes)

        return ReturnCodes.kOk
コード例 #48
0
    def createTargetParamTableEntry (self, trxContext, entryName):
        """
        create an entry with the entryName in SNMP-TARGET-MIB snmpTargetParamsTable snmpTargetParamsEntry 
            set snmpTargetParamsMPModel to 0 (v1)
            set snmpTargetParamsSecurityModel to 1 (v1)
            set snmpTargetParamsSecurityName to _<entryName>_notif
            set snmpTargetParamsSecurityLevel to noAuthNoPriv
        """

        self._log("create-target-param-table-entry").debug2("called. trxContext=%s, entryName=%s", trxContext, entryName)

        targetKeyPath = KeyPath()

        valTarget = Value()
        (tag, ns, prefix) = ("SNMP-TARGET-MIB", "http://tail-f.com/ns/mibs/SNMP-TARGET-MIB/200210140000Z", "SNMP_TARGET_MIB")
        valTarget.setXmlTag((tag, ns, prefix))
        targetKeyPath.addKeyPathPostfix(valTarget)

        tagValueList = TagValues()

        valTargetParamTable = Value()
        (tag, ns, prefix) = ("snmpTargetParamsTable","http://tail-f.com/ns/mibs/SNMP-TARGET-MIB/200210140000Z", "SNMP_TARGET_MIB")
        valTargetParamTable.setXmlBegin((tag, ns, prefix))
        tagValueList.push((tag, ns), valTargetParamTable)

        valBegin = Value()
        (tag, ns, prefix) = ("snmpTargetParamsEntry", "http://tail-f.com/ns/mibs/SNMP-TARGET-MIB/200210140000Z", "SNMP_TARGET_MIB")
        valBegin.setXmlBegin((tag, ns, prefix))
        tagValueList.push((tag, ns), valBegin)

        valKey = Value()
        valKey.setString(entryName)
        tagValueList.push(("snmpTargetParamsName", "http://tail-f.com/ns/mibs/SNMP-TARGET-MIB/200210140000Z"), valKey)

        # snmpTargetParamsMPModel to 0 (v1)
        valMPModel = Value()
        valMPModel.setInt32(self.MP_MODEL_V1)
        tagValueList.push(("snmpTargetParamsMPModel", "http://tail-f.com/ns/mibs/SNMP-TARGET-MIB/200210140000Z"), valMPModel)

        # snmpTargetParamsSecurityModel to 1 (v1)
        valSecurityModel = Value()
        valSecurityModel.setInt32(self.SECURITY_MODEL_V1)
        tagValueList.push(("snmpTargetParamsSecurityModel", "http://tail-f.com/ns/mibs/SNMP-TARGET-MIB/200210140000Z"), valSecurityModel)

        # snmpTargetParamsSecurityName to all-traps
        valSecurityName = Value()
        valSecurityName.setString(self.makeSecurityName(entryName))
        tagValueList.push(("snmpTargetParamsSecurityName", "http://tail-f.com/ns/mibs/SNMP-TARGET-MIB/200210140000Z"), valSecurityName)

        # snmpTargetParamsSecurityLevel to noAuthNoPriv
        valSecurityLevel = Value()
        valSecurityLevel.setEnum(self.SECURITY_LEVEL_NO_AUTH_NO_PRIV)
        tagValueList.push(("snmpTargetParamsSecurityLevel", "http://tail-f.com/ns/mibs/SNMP-TARGET-MIB/200210140000Z"), valSecurityLevel)

        valEnd = Value()
        valEnd.setXmlEnd((tag, ns, prefix))
        tagValueList.push((tag, ns), valEnd)

        valTargetParamTable = Value()
        (tag, ns, prefix) = ("snmpTargetParamsTable","http://tail-f.com/ns/mibs/SNMP-TARGET-MIB/200210140000Z", "SNMP_TARGET_MIB")
        valTargetParamTable.setXmlEnd((tag, ns, prefix))
        tagValueList.push((tag, ns), valTargetParamTable)

        res = self._maapiDomain.writeMaapi(tagValueList, targetKeyPath, trxContext)
        if res != ReturnCodes.kOk:
            self._log('create-target-param-table-entry-write-domain-failed').error('self._maapiDomain.writeMaapi() failed. PARAMS')
            return ReturnCodes.kGeneralError

        self._log("create-target-param-table-entry-done").debug2("done. trxContext=%s, entryName=%s", trxContext, entryName)
        return ReturnCodes.kOk
コード例 #49
0
    def fillTagValues (self, keyPath, tagValueList, operData):
        initialListSize = tagValueList.getLen()
        for logFunc in self._log("fill-tag-values").debug3Func(): logFunc("called. operData=%s, keyPath=%s, initialListSize=%d", operData.debugStr(True), keyPath, initialListSize)
        # fill tag values up to current
        if self.myKeyPath.isEqualLen(keyPath, keyPath.getLen()):
            i = keyPath.getLen()
            while i < self.myKeyPath.getLen():
                valBegin = Value()
                (tag, ns, prefix) = self.myKeyPath.getAt(i).asXmlTag()
                valBegin.setXmlBegin((tag, ns, prefix))
                tagValueList.push((tag, ns), valBegin)
                for logFunc in self._log("fill-tag-values-adding").debug3Func(): logFunc("adding xml begin. i=%d, valBegin=%s, self.myKeyPath.getLen()=%d", i, valBegin, self.myKeyPath.getLen())
                i+=1
        
        if operData.isDescriptionRequested() and operData.hasDescription():
            val = Value()
            val.setString(operData.description)
            tagValueList.push(("description", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-system-alarms"), val)
        
        if operData.isSeverityRequested() and operData.hasSeverity():
            val = Value()
            val.setEnum(operData.severity.getValue())
            tagValueList.push(("severity", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-system-alarms"), val)
        
        if operData.isNumberRequested() and operData.hasNumber():
            val = Value()
            val.setInt64(operData.number)
            tagValueList.push(("number", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-system-alarms"), val)
        
        if operData.isEntityRequested() and operData.hasEntity():
            val = Value()
            val.setString(operData.entity)
            tagValueList.push(("entity", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-system-alarms"), val)
        
        if operData.isSourceRequested() and operData.hasSource():
            val = Value()
            val.setString(operData.source)
            tagValueList.push(("source", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-system-alarms"), val)
        
        if operData.isSimulatedRequested() and operData.hasSimulated():
            val = Value()
            val.setBool(operData.simulated)
            tagValueList.push(("simulated", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-system-alarms"), val)
        
        if operData.isNameRequested() and operData.hasName():
            val = Value()
            val.setEnum(operData.name.getValue())
            tagValueList.push(("name", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-system-alarms"), val)
        
        
        if self.myKeyPath.isEqualLen(keyPath, keyPath.getLen()):
            i = self.myKeyPath.getLen() - 1
            while i >= keyPath.getLen():
                valEnd = Value()
                (tag, ns, prefix) = self.myKeyPath.getAt(i).asXmlTag()
                valEnd.setXmlEnd((tag, ns, prefix))
                tagValueList.push((tag, ns), valEnd)
                i-=1

        for logFunc in self._log("fill-tag-values-ended").debug3Func(): logFunc("ended. operData=%s, keyPath=%s, initialListSize=%d, finalListSize=%d",
                                                  operData.debugStr(True), keyPath, initialListSize, tagValueList.getLen())
        return ReturnCodes.kOk
コード例 #50
0
    def _fillWriteTagValues (self, tagValueList):
        self.myInitGuard.isInitOrCrash()
        for logFunc in self._log('fill-write-tag-values').debug3Func(): logFunc('called: tagValueList=%s', tagValueList)

        
        if self.hasMinLevel():
            valMinLevel = Value()
            if self.minLevel is not None:
                valMinLevel.setEnum(self.minLevel.getValue())
            else:
                valMinLevel.setEmpty()
            tagValueList.push(("min-level", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-debug"), valMinLevel)
        
        if self.hasDestinationType():
            valDestinationType = Value()
            if self.destinationType is not None:
                valDestinationType.setEnum(self.destinationType.getValue())
            else:
                valDestinationType.setEmpty()
            tagValueList.push(("type", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-debug"), valDestinationType)
        
        if self.hasEnabled():
            valEnabled = Value()
            if self.enabled is not None:
                valEnabled.setBool(self.enabled)
            else:
                valEnabled.setEmpty()
            tagValueList.push(("enabled", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-debug"), valEnabled)
        

        
        if self.outputObj:
            valBegin = Value()
            (tag, ns, prefix) = ("output" , "http://qwilt.com/ns/yang/device/tech/qwilt-tech-debug", "qt-debug")
            valBegin.setXmlBegin((tag, ns, prefix))
            tagValueList.push((tag, ns), valBegin)

            tagValueListLen = tagValueList.getLen()

            res = self.outputObj._fillWriteTagValues(tagValueList)
            if res != ReturnCodes.kOk:
                for logFunc in self._log('fill-write-tag-values-output-failed').errorFunc(): logFunc('outputObj._fillWriteTagValues() failed. PARAMS')
                return ReturnCodes.kGeneralError

            if tagValueList.getLen() == tagValueListLen:
                # descendant didn't add anything, no need to read it.
                tagValueList.pop()
            else:
                valEnd = Value()
                valEnd.setXmlEnd((tag, ns, prefix))
                tagValueList.push((tag, ns), valEnd)
        
        if self.formatObj:
            valBegin = Value()
            (tag, ns, prefix) = ("format" , "http://qwilt.com/ns/yang/device/tech/qwilt-tech-debug", "qt-debug")
            valBegin.setXmlBegin((tag, ns, prefix))
            tagValueList.push((tag, ns), valBegin)

            tagValueListLen = tagValueList.getLen()

            res = self.formatObj._fillWriteTagValues(tagValueList)
            if res != ReturnCodes.kOk:
                for logFunc in self._log('fill-write-tag-values-format-failed').errorFunc(): logFunc('formatObj._fillWriteTagValues() failed. PARAMS')
                return ReturnCodes.kGeneralError

            if tagValueList.getLen() == tagValueListLen:
                # descendant didn't add anything, no need to read it.
                tagValueList.pop()
            else:
                valEnd = Value()
                valEnd.setXmlEnd((tag, ns, prefix))
                tagValueList.push((tag, ns), valEnd)
        

        return ReturnCodes.kOk