def _fillWriteTagValues (self, tagValueList):
        self.myInitGuard.isInitOrCrash()
        for logFunc in self._log('fill-write-tag-values').debug3Func(): logFunc('called: tagValueList=%s', tagValueList)

        
        if self.hasActivate():
            valActivate = Value()
            if self.activate is not None:
                valActivate.setInt64(self.activate)
            else:
                valActivate.setEmpty()
            tagValueList.push(("activate", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-storage-disk"), valActivate)
        
        if self.hasGetStatus():
            valGetStatus = Value()
            if self.getStatus is not None:
                valGetStatus.setInt64(self.getStatus)
            else:
                valGetStatus.setEmpty()
            tagValueList.push(("get-status", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-storage-disk"), valGetStatus)
        

        

        return ReturnCodes.kOk
Example #2
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-platform-power"), valId)
        
        if self.hasFruId():
            valFruId = Value()
            if self.fruId is not None:
                valFruId.setString(self.fruId)
            else:
                valFruId.setEmpty()
            tagValueList.push(("fru-id", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-platform-power"), valFruId)
        

        

        return ReturnCodes.kOk
Example #3
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.hasLength():
            valLength = Value()
            if self.length is not None:
                valLength.setInt64(self.length)
            else:
                valLength.setEmpty()
            tagValueList.push(("length", "http://qwilt.com/model/tv"), valLength)
        
        if self.hasBoringLevel():
            valBoringLevel = Value()
            if self.boringLevel is not None:
                valBoringLevel.setInt64(self.boringLevel)
            else:
                valBoringLevel.setEmpty()
            tagValueList.push(("boring-level", "http://qwilt.com/model/tv"), valBoringLevel)
        

        

        return ReturnCodes.kOk
Example #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.hasChannelQueueSize():
            valChannelQueueSize = Value()
            if self.channelQueueSize is not None:
                valChannelQueueSize.setInt64(self.channelQueueSize)
            else:
                valChannelQueueSize.setEmpty()
            tagValueList.push(("channel-queue-size", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-content-line"), valChannelQueueSize)
        
        if self.hasMemSize():
            valMemSize = Value()
            if self.memSize is not None:
                valMemSize.setInt64(self.memSize)
            else:
                valMemSize.setEmpty()
            tagValueList.push(("mem-size", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-content-line"), valMemSize)
        

        

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

        
        if self.hasPollLatencyErrorSeconds():
            valPollLatencyErrorSeconds = Value()
            if self.pollLatencyErrorSeconds is not None:
                valPollLatencyErrorSeconds.setInt64(self.pollLatencyErrorSeconds)
            else:
                valPollLatencyErrorSeconds.setEmpty()
            tagValueList.push(("poll-latency-error-seconds", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-log"), valPollLatencyErrorSeconds)
        
        if self.hasPollLatencyWarningSeconds():
            valPollLatencyWarningSeconds = Value()
            if self.pollLatencyWarningSeconds is not None:
                valPollLatencyWarningSeconds.setInt64(self.pollLatencyWarningSeconds)
            else:
                valPollLatencyWarningSeconds.setEmpty()
            tagValueList.push(("poll-latency-warning-seconds", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-log"), valPollLatencyWarningSeconds)
        

        

        return ReturnCodes.kOk
    def readListKeys (self
                      , show
                      
                      , trxContext=None):
        self.myInitGuard.isInitOrCrash()
        for logFunc in self._log('read-list-keys').debug3Func(): logFunc('called')

        # clear the old map
        self.actors = {}
        self.actorKeys = []

        keyPath = self._getSelfKeyPath(show, 
                                       
                                       None)

        xmlVal = Value()
        xmlVal.setXmlTag(("actor", "http://qwilt.com/model/tv", "tv"))
        keyPath.addKeyPathPostfix(xmlVal)

        keys = []

        res = self.domain.readMaapiKeys(keyPath, keys, trxContext)
        if res != ReturnCodes.kOk:
            for logFunc in self._log('read-list-keys-domain-failed').errorFunc(): logFunc('domain.readMaapiKeys() failed')
            return ReturnCodes.kGeneralError

        for key in keys:
            self.actorKeys.append(key.getCannonicalStr())
            self.actors[key.getCannonicalStr()] = None

        return ReturnCodes.kOk
Example #7
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.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.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)
        

        

        return ReturnCodes.kOk
    def readListKeys (self
                      
                      , trxContext=None):
        self.myInitGuard.isInitOrCrash()
        for logFunc in self._log('read-list-keys').debug3Func(): logFunc('called')

        # clear the old map
        self.aliens = {}
        self.alienKeys = []

        keyPath = self._getSelfKeyPath(
                                       None)

        xmlVal = Value()
        xmlVal.setXmlTag(("alien", "http://qwilt.com/ns/yang/ut/sys/blinky/example/python/oper-example", "oe"))
        keyPath.addKeyPathPostfix(xmlVal)

        keys = []

        res = self.domain.readMaapiKeys(keyPath, keys, trxContext)
        if res != ReturnCodes.kOk:
            for logFunc in self._log('read-list-keys-domain-failed').errorFunc(): logFunc('domain.readMaapiKeys() failed')
            return ReturnCodes.kGeneralError

        for key in keys:
            self.alienKeys.append(key.getCannonicalStr())
            self.aliens[key.getCannonicalStr()] = None

        return ReturnCodes.kOk
Example #9
0
    def deepConvertConfdHKeyPathToPyKeyPath (confdHKeyPathPtr, pyKeyPath):
        """
        This function performs a deep convertion of a confd_hkeypath object to a python KeyPath object.
        It reallocates all data memory, making the python KeyPath object its owner.
        pyKeyPath must be pre-constructed
        """
        for logFunc in pyconfdlib._log("deep-convert-confd-hkeypath-to-pykeypath").debug4Func(): logFunc("deepConvertConfdHKeyPathToPyKeyPath called. confdHKeyPathPtr=%s, pyKeyPath=%s", ConfdHKeyPathLow.ConfdHKeyPathToStr(confdHKeyPathPtr), pyKeyPath)
        if not pyKeyPath or not confdHKeyPathPtr:
            for logFunc in pyconfdlib._log("deep-convert-confd-value-to-pyvalue-invalid-args").errorFunc(): logFunc("deepConvertConfdValueToPyValue invalid args: confdHKeyPathPtr=%s, pyKeyPath=%s", ConfdHKeyPathLow.ConfdHKeyPathToStr(confdHKeyPathPtr), pyKeyPath)
            return ReturnCodes.kGeneralError
        confdKeyPathLen = pyconfdlib.dll.py_getHkeypathLen(confdHKeyPathPtr)
        for logFunc in pyconfdlib._log("deep-convert-confd-hkeypath-to-pykeypath-len").debug4Func(): logFunc("deepConvertConfdHKeyPathToPyKeyPath: confdKetPathLen=%d, confdHKeyPathPtr=%s, pyKeyPath=%s", confdKeyPathLen, ConfdHKeyPathLow.ConfdHKeyPathToStr(confdHKeyPathPtr), pyKeyPath)
        for i in range(confdKeyPathLen):
            level = []
            for j in range(pyconfdlib.MAXKEYLEN):
                confdValPtr = pyconfdlib.dll.py_getHkeypathValue(confdHKeyPathPtr, confdKeyPathLen-1-i, j, False)
                pyValue = Value()
                rc = ConfdValueLow.deepConvertConfdValueToPyValue(confdValPtr, pyValue)
                if rc != ReturnCodes.kOk:
                    for logFunc in pyconfdlib._log("deep-convert-confd-hkeypath-to-pykeypath-convert-keypath-failed").errorFunc(): logFunc("deepConvertConfdHKeyPathToPyKeyPath: deepConvertConfdValueToPyValue "\
                                                                                                             "failed: i=%d, j=%d, confdHKeyPathPtr=%s, pyKeyPath=%s, rc=%s", i, j, ConfdHKeyPathLow.ConfdHKeyPathToStr(confdHKeyPathPtr), pyKeyPath, str(rc))
                    return ReturnCodes.kGeneralError
                if pyValue.getType() == Value.kEmpty:
                    break
                level.append(pyValue)
            if level:
                #for logFunc in pyconfdlib._log("deep-convert-confd-hkeypath-to-pykeypath-appending").debug4Func(): logFunc("deepConvertConfdHKeyPathToPyKeyPath: appending level=%s", level)
                pyKeyPath._key.append(level)

        for logFunc in pyconfdlib._log("deep-convert-confd-hkeypath-to-pykeypath-done").debug4Func(): logFunc("deepConvertConfdHKeyPathToPyKeyPath done. confdHKeyPathPtr=%s, pyKeyPath=%s", ConfdHKeyPathLow.ConfdHKeyPathToStr(confdHKeyPathPtr), pyKeyPath)
        return ReturnCodes.kOk
    def _fillWriteTagValues (self, tagValueList):
        self.myInitGuard.isInitOrCrash()
        for logFunc in self._log('fill-write-tag-values').debug3Func(): logFunc('called: tagValueList=%s', tagValueList)

        
        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.hasCid():
            valCid = Value()
            if self.cid is not None:
                valCid.setString(self.cid)
            else:
                valCid.setEmpty()
            tagValueList.push(("cid", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-content-line"), valCid)
        

        

        return ReturnCodes.kOk
    def readListKeys (self
                      , ipv4
                      
                      , trxContext=None):
        self.myInitGuard.isInitOrCrash()
        for logFunc in self._log('read-list-keys').debug3Func(): logFunc('called')

        # clear the old map
        self.hosts = {}
        self.hostKeys = []

        keyPath = self._getSelfKeyPath(ipv4, 
                                       
                                       None)

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

        keys = []

        res = self.domain.readMaapiKeys(keyPath, keys, trxContext)
        if res != ReturnCodes.kOk:
            for logFunc in self._log('read-list-keys-domain-failed').errorFunc(): logFunc('domain.readMaapiKeys() failed')
            return ReturnCodes.kGeneralError

        for key in keys:
            self.hostKeys.append(key.getCannonicalStr())
            self.hosts[key.getCannonicalStr()] = None

        return ReturnCodes.kOk
Example #12
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.hasLength():
            valLength = Value()
            if self.length is not None:
                valLength.setInt64(self.length)
            else:
                valLength.setEmpty()
            tagValueList.push(("length", "http://qwilt.com/model/family"), valLength)
        
        if self.hasSmartness():
            valSmartness = Value()
            if self.smartness is not None:
                valSmartness.setInt64(self.smartness)
            else:
                valSmartness.setEmpty()
            tagValueList.push(("smartness", "http://qwilt.com/model/family"), valSmartness)
        

        

        return ReturnCodes.kOk
Example #13
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.hasCatalogId():
            valCatalogId = Value()
            if self.catalogId is not None:
                valCatalogId.setInt64(self.catalogId)
            else:
                valCatalogId.setEmpty()
            tagValueList.push(("catalog-id", "http://qwilt.com/model/room"), valCatalogId)
        
        if self.hasName():
            valName = Value()
            if self.name is not None:
                valName.setString(self.name)
            else:
                valName.setEmpty()
            tagValueList.push(("name", "http://qwilt.com/model/room"), valName)
        

        

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

        
        if self.hasWidth():
            valWidth = Value()
            if self.width is not None:
                valWidth.setInt64(self.width)
            else:
                valWidth.setEmpty()
            tagValueList.push(("width", "http://qwilt.com/model/lake-example"), valWidth)
        
        if self.hasLength():
            valLength = Value()
            if self.length is not None:
                valLength.setInt64(self.length)
            else:
                valLength.setEmpty()
            tagValueList.push(("length", "http://qwilt.com/model/lake-example"), valLength)
        

        

        return ReturnCodes.kOk
 def getOperRelativePath (self, operRelativePath):
     for logFunc in self._log("get-oper-relative-path").debug3Func(): logFunc("called")
     
     val = Value()
     val.setXmlTag(("continuous-counters-32bit", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-interfaces", "qt-if"))
     operRelativePath.addKeyPathPostfix(val)
     
     for logFunc in self._log("getOperRelativePath-done").debug3Func(): logFunc("done. operRelativePath=%s", operRelativePath)
 def getOperRelativePath (self, operRelativePath):
     for logFunc in self._log("get-oper-relative-path").debug3Func(): logFunc("called")
     
     val = Value()
     val.setXmlTag(("alarm", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-content-reporting", "qtc-report"))
     operRelativePath.addKeyPathPostfix(val)
     
     for logFunc in self._log("getOperRelativePath-done").debug3Func(): logFunc("done. operRelativePath=%s", operRelativePath)
 def getOperRelativePath (self, operRelativePath):
     for logFunc in self._log("get-oper-relative-path").debug3Func(): logFunc("called")
     
     val = Value()
     val.setXmlTag(("design", "http://qwilt.com/model/lake-example", "lake-example"))
     operRelativePath.addKeyPathPostfix(val)
     
     for logFunc in self._log("getOperRelativePath-done").debug3Func(): logFunc("done. operRelativePath=%s", operRelativePath)
 def getOperRelativePath (self, operRelativePath):
     for logFunc in self._log("get-oper-relative-path").debug3Func(): logFunc("called")
     
     val = Value()
     val.setXmlTag(("actual", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-storage-module", "qt-strg-module"))
     operRelativePath.addKeyPathPostfix(val)
     
     for logFunc in self._log("getOperRelativePath-done").debug3Func(): logFunc("done. operRelativePath=%s", operRelativePath)
 def getOperRelativePath (self, operRelativePath):
     for logFunc in self._log("get-oper-relative-path").debug3Func(): logFunc("called")
     
     val = Value()
     val.setXmlTag(("counters", "http://qwilt.com/ns/yang/ut/sys/blinky/example/python/oper-example", "oe"))
     operRelativePath.addKeyPathPostfix(val)
     
     for logFunc in self._log("getOperRelativePath-done").debug3Func(): logFunc("done. operRelativePath=%s", operRelativePath)
 def getOperRelativePath (self, operRelativePath):
     for logFunc in self._log("get-oper-relative-path").debug3Func(): logFunc("called")
     
     val = Value()
     val.setXmlTag(("status", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-platform-fans", "qt-pltf-fans"))
     operRelativePath.addKeyPathPostfix(val)
     
     for logFunc in self._log("getOperRelativePath-done").debug3Func(): logFunc("done. operRelativePath=%s", operRelativePath)
    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.hosts.keys():
            if self.hosts[key]:
                valBegin = Value()
                (tag, ns, prefix) = ("host", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-system", "qt-sys")
                valBegin.setXmlBegin((tag, ns, prefix))
                tagValueList.push((tag, ns), valBegin)

                valKey = Value()
                valKey.setString(key)
                tagValueList.push(("hostname", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-system"), valKey)

                tagValueListLen = tagValueList.getLen()

                res = self.hosts[key]._fillReadTagValues(tagValueList)
                if res != ReturnCodes.kOk:
                    for logFunc in self._log('fill-read-tag-values-host-failed').errorFunc(): logFunc('host._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
    def _fillReadTagValues (self, tagValueList):
        self.myInitGuard.isInitOrCrash()
        for logFunc in self._log('fill-read-tag-values').debug3Func(): logFunc('called: tagValueList=%s', tagValueList)

        
        if self.isEnabledRequested():
            valEnabled = Value()
            valEnabled.setEmpty()
            tagValueList.push(("enabled", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-content-line"), valEnabled)
        

        
        if self.controllerObj:
            valBegin = Value()
            (tag, ns, prefix) = ("controller" , "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.controllerObj._fillReadTagValues(tagValueList)
            if res != ReturnCodes.kOk:
                for logFunc in self._log('fill-read-tag-values-controller-failed').errorFunc(): logFunc('controllerObj._fillReadTagValues() 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
Example #23
0
    def _fillWriteTagValues (self, tagValueList):
        self.myInitGuard.isInitOrCrash()
        for logFunc in self._log('fill-write-tag-values').debug3Func(): logFunc('called: tagValueList=%s', tagValueList)

        for key in self.kids.keys():
            if self.kids[key]:
                valBegin = Value()
                (tag, ns, prefix) = ("kid", "http://qwilt.com/model/family", "family")
                valBegin.setXmlBegin((tag, ns, prefix))
                tagValueList.push((tag, ns), valBegin)

                valKey = Value()
                valKey.setString(key)
                tagValueList.push(("name", "http://qwilt.com/model/family"), valKey)

                tagValueListLen = tagValueList.getLen()

                res = self.kids[key]._fillWriteTagValues(tagValueList)
                if res != ReturnCodes.kOk:
                    for logFunc in self._log('fill-write-tag-values-kid-failed').errorFunc(): logFunc('kid._fillWriteTagValues() 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
    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.aliens.keys():
            if self.aliens[key]:
                valBegin = Value()
                (tag, ns, prefix) = ("alien", "http://qwilt.com/ns/yang/ut/sys/blinky/example/python/oper-example", "oe")
                valBegin.setXmlBegin((tag, ns, prefix))
                tagValueList.push((tag, ns), valBegin)

                valKey = Value()
                valKey.setString(key)
                tagValueList.push(("name", "http://qwilt.com/ns/yang/ut/sys/blinky/example/python/oper-example"), valKey)

                tagValueListLen = tagValueList.getLen()

                res = self.aliens[key]._fillReadTagValues(tagValueList)
                if res != ReturnCodes.kOk:
                    for logFunc in self._log('fill-read-tag-values-alien-failed').errorFunc(): logFunc('alien._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
    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.isOpValueDRequested() and operData.hasOpValueD():
            val = Value()
            val.setInt64(operData.opValueD)
            tagValueList.push(("op-value-d", "http://qwilt.com/model/oper"), 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
    def _fillWriteTagValues (self, tagValueList):
        self.myInitGuard.isInitOrCrash()
        for logFunc in self._log('fill-write-tag-values').debug3Func(): logFunc('called: tagValueList=%s', tagValueList)

        for key in self.instancess.keys():
            if self.instancess[key]:
                valBegin = Value()
                (tag, ns, prefix) = ("instances", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-content-pre-topper", "qtc-pt")
                valBegin.setXmlBegin((tag, ns, prefix))
                tagValueList.push((tag, ns), valBegin)

                valKey = Value()
                valKey.setString(key)
                tagValueList.push(("instance", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-content-pre-topper"), valKey)

                tagValueListLen = tagValueList.getLen()

                res = self.instancess[key]._fillWriteTagValues(tagValueList)
                if res != ReturnCodes.kOk:
                    for logFunc in self._log('fill-write-tag-values-instances-failed').errorFunc(): logFunc('instances._fillWriteTagValues() 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
    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.isActualDeliveryInterfaceRequested() and operData.hasActualDeliveryInterface():
            val = Value()
            val.setString(operData.actualDeliveryInterface)
            tagValueList.push(("actual-delivery-interface", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-content-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
    def _getSelfKeyPath (self, linux_
                         
                         , junkForTemplate):
        for logFunc in self._log('get-self-key-path').debug3Func(): logFunc('called. PARAMS. junkForTemplate=%s', junkForTemplate)
        keyPath = KeyPath()

        
        
        
        
        ancestorVal = Value()
        ancestorVal.setString(linux_);
        keyPath.addKeyPathPrefix(ancestorVal)
        
        
        xmlVal = Value()
        xmlVal.setXmlTag(("linux", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-linux", "qt-lnx"))
        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
    def _getSelfKeyPath (self
                         , junkForTemplate):
        for logFunc in self._log('get-self-key-path').debug3Func(): logFunc('called. PARAMS. junkForTemplate=%s', junkForTemplate)
        keyPath = KeyPath()

        
        
        
        
        
        xmlVal = Value()
        xmlVal.setXmlTag(("reporting", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-content-reporting", "qtc-report"))
        keyPath.addKeyPathPrefix(xmlVal)
        
        
        
        xmlVal = Value()
        xmlVal.setXmlTag(("content", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-content", "qtc"))
        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
    def _getSelfKeyPath (self
                         , junkForTemplate):
        for logFunc in self._log('get-self-key-path').debug3Func(): logFunc('called. PARAMS. junkForTemplate=%s', junkForTemplate)
        keyPath = KeyPath()

        
        
        
        
        
        xmlVal = Value()
        xmlVal.setXmlTag(("manager", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-platform-manager", "qt-pltf-mngr"))
        keyPath.addKeyPathPrefix(xmlVal)
        
        
        
        xmlVal = Value()
        xmlVal.setXmlTag(("platform", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-platform", "qt-pltf"))
        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
Example #31
0
    def _fillReadTagValues(self, tagValueList):
        self.myInitGuard.isInitOrCrash()
        for logFunc in self._log('fill-read-tag-values').debug3Func():
            logFunc('called: tagValueList=%s', tagValueList)

        if self.isThreadPriorityRequested():
            valThreadPriority = Value()
            valThreadPriority.setEmpty()
            tagValueList.push(
                ("thread-priority",
                 "http://qwilt.com/ns/yang/device/tech/qwilt-tech-content-line"
                 ), valThreadPriority)

        if self.isEnabledRequested():
            valEnabled = Value()
            valEnabled.setEmpty()
            tagValueList.push(
                ("enabled",
                 "http://qwilt.com/ns/yang/device/tech/qwilt-tech-content-line"
                 ), valEnabled)

        if self.isThreadAffinityRequested():
            valThreadAffinity = Value()
            valThreadAffinity.setEmpty()
            tagValueList.push(
                ("thread-affinity",
                 "http://qwilt.com/ns/yang/device/tech/qwilt-tech-content-line"
                 ), valThreadAffinity)

        return ReturnCodes.kOk
Example #32
0
    def _getSelfKeyPath(self, line, unit, junkForTemplate):
        for logFunc in self._log('get-self-key-path').debug3Func():
            logFunc('called. PARAMS, junkForTemplate=%s', junkForTemplate)
        keyPath = KeyPath()

        xmlVal = Value()
        xmlVal.setXmlTag(
            ("system-defaults",
             "http://qwilt.com/ns/yang/device/tech/qwilt-tech-content-line",
             "qtc-line"))
        keyPath.addKeyPathPrefix(xmlVal)

        ancestorVal = Value()
        ancestorVal.setString(unit)
        keyPath.addKeyPathPrefix(ancestorVal)

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

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

        ancestorVal = Value()
        ancestorVal.setString(line)
        keyPath.addKeyPathPrefix(ancestorVal)

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

        xmlVal = Value()
        xmlVal.setXmlTag(
            ("content",
             "http://qwilt.com/ns/yang/device/tech/qwilt-tech-content", "qtc"))
        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
Example #33
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.sites.keys():
            if self.sites[key]:
                valBegin = Value()
                (tag, ns, prefix) = (
                    "site",
                    "http://qwilt.com/ns/yang/device/tech/qwilt-tech-content",
                    "qtc")
                valBegin.setXmlBegin((tag, ns, prefix))
                tagValueList.push((tag, ns), valBegin)

                valKey = Value()
                valKey.setString(key)
                tagValueList.push((
                    "site",
                    "http://qwilt.com/ns/yang/device/tech/qwilt-tech-content"),
                                  valKey)

                tagValueListLen = tagValueList.getLen()

                res = self.sites[key]._fillReadTagValues(tagValueList)
                if res != ReturnCodes.kOk:
                    for logFunc in self._log(
                            'fill-read-tag-values-site-failed').errorFunc():
                        logFunc('site._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
Example #34
0
    def _getSelfKeyPath(self, rule, junkForTemplate):
        for logFunc in self._log('get-self-key-path').debug3Func():
            logFunc('called. PARAMS. junkForTemplate=%s', junkForTemplate)
        keyPath = KeyPath()

        ancestorVal = Value()
        ancestorVal.setString(rule)
        keyPath.addKeyPathPrefix(ancestorVal)

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

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

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

        xmlVal = Value()
        xmlVal.setXmlTag(
            ("content",
             "http://qwilt.com/ns/yang/device/tech/qwilt-tech-content", "qtc"))
        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
Example #35
0
    def _fillReadTagValues(self, tagValueList):
        self.myInitGuard.isInitOrCrash()
        for logFunc in self._log('fill-read-tag-values').debug3Func():
            logFunc('called: tagValueList=%s', tagValueList)

        if self.isIdRequested():
            valId = Value()
            valId.setEmpty()
            tagValueList.push((
                "id",
                "http://qwilt.com/ns/yang/device/tech/qwilt-tech-platform-power"
            ), valId)

        if self.isFruIdRequested():
            valFruId = Value()
            valFruId.setEmpty()
            tagValueList.push((
                "fru-id",
                "http://qwilt.com/ns/yang/device/tech/qwilt-tech-platform-power"
            ), valFruId)

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

            tagValueListLen = tagValueList.getLen()

            res = self.statusObj._fillReadTagValues(tagValueList)
            if res != ReturnCodes.kOk:
                for logFunc in self._log(
                        'fill-read-tag-values-status-failed').errorFunc():
                    logFunc('statusObj._fillReadTagValues() 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
Example #36
0
    def _getSelfKeyPath(self, powerSupply, junkForTemplate):
        for logFunc in self._log('get-self-key-path').debug3Func():
            logFunc('called. PARAMS, junkForTemplate=%s', junkForTemplate)
        keyPath = KeyPath()

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

        ancestorVal = Value()
        ancestorVal.setString(powerSupply)
        keyPath.addKeyPathPrefix(ancestorVal)

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

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

        xmlVal = Value()
        xmlVal.setXmlTag(
            ("platform",
             "http://qwilt.com/ns/yang/device/tech/qwilt-tech-platform",
             "qt-pltf"))
        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
    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
Example #38
0
    def _fillReadTagValues(self, tagValueList):
        self.myInitGuard.isInitOrCrash()
        for logFunc in self._log('fill-read-tag-values').debug3Func():
            logFunc('called: tagValueList=%s', tagValueList)

        if self.isValueOpV1Requested():
            valValueOpV1 = Value()
            valValueOpV1.setEmpty()
            tagValueList.push(("value-op-v1", "http://qwilt.com/model/oper"),
                              valValueOpV1)

        if self.opYObj:
            valBegin = Value()
            (tag, ns, prefix) = ("op-y", "http://qwilt.com/model/oper", "oper")
            valBegin.setXmlBegin((tag, ns, prefix))
            tagValueList.push((tag, ns), valBegin)

            tagValueListLen = tagValueList.getLen()

            res = self.opYObj._fillReadTagValues(tagValueList)
            if res != ReturnCodes.kOk:
                for logFunc in self._log(
                        'fill-read-tag-values-op-y-failed').errorFunc():
                    logFunc('opYObj._fillReadTagValues() 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.opWObj:
            valBegin = Value()
            (tag, ns, prefix) = ("op-w", "http://qwilt.com/model/oper", "oper")
            valBegin.setXmlBegin((tag, ns, prefix))
            tagValueList.push((tag, ns), valBegin)

            tagValueListLen = tagValueList.getLen()

            res = self.opWObj._fillReadTagValues(tagValueList)
            if res != ReturnCodes.kOk:
                for logFunc in self._log(
                        'fill-read-tag-values-op-w-failed').errorFunc():
                    logFunc('opWObj._fillReadTagValues() 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
    def _fillWriteTagValues(self, tagValueList):
        self.myInitGuard.isInitOrCrash()
        for logFunc in self._log('fill-write-tag-values').debug3Func():
            logFunc('called: tagValueList=%s', tagValueList)

        if self.hasWidth():
            valWidth = Value()
            if self.width is not None:
                valWidth.setInt64(self.width)
            else:
                valWidth.setEmpty()
            tagValueList.push(("width", "http://qwilt.com/model/lake-example"),
                              valWidth)

        if self.hasLength():
            valLength = Value()
            if self.length is not None:
                valLength.setInt64(self.length)
            else:
                valLength.setEmpty()
            tagValueList.push(
                ("length", "http://qwilt.com/model/lake-example"), valLength)

        return ReturnCodes.kOk
Example #40
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.isLocalTimeStringRequested() and operData.hasLocalTimeString():
            val = Value()
            val.setString(operData.localTimeString)
            tagValueList.push(("local-time-string", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-system-clock"), val)
        
        if operData.isUtcTimeStringRequested() and operData.hasUtcTimeString():
            val = Value()
            val.setString(operData.utcTimeString)
            tagValueList.push(("utc-time-string", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-system-clock"), val)
        
        if operData.isDaylightSavingTimeRequested() and operData.hasDaylightSavingTime():
            val = Value()
            val.setBool(operData.daylightSavingTime)
            tagValueList.push(("daylight-saving-time", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-system-clock"), val)
        
        if operData.isEpochRequested() and operData.hasEpoch():
            val = Value()
            val.setInt64(operData.epoch)
            tagValueList.push(("epoch", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-system-clock"), val)
        
        if operData.isUtcOffsetMinutesRequested() and operData.hasUtcOffsetMinutes():
            val = Value()
            val.setInt64(operData.utcOffsetMinutes)
            tagValueList.push(("utc-offset-minutes", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-system-clock"), 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
    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.isIpValRequested() and operData.hasIpVal():
            val = Value()
            val.setIPv4(operData.ipVal)
            tagValueList.push(("ip-val", "http://qwilt.com/model/oper"), val)

        if operData.isIdRequested() and operData.hasId():
            val = Value()
            val.setInt64(operData.id)
            tagValueList.push(("id", "http://qwilt.com/model/oper"), val)

        if operData.isValRequested() and operData.hasVal():
            val = Value()
            val.setInt64(operData.val)
            tagValueList.push(("val", "http://qwilt.com/model/oper"), val)

        if operData.isIpPrefixValRequested() and operData.hasIpPrefixVal():
            val = Value()
            val.setIPv4Prefix(operData.ipPrefixVal)
            tagValueList.push(("ip-prefix-val", "http://qwilt.com/model/oper"),
                              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
Example #42
0
    def _getSelfKeyPath(self, junkForTemplate):
        for logFunc in self._log('get-self-key-path').debug3Func():
            logFunc('called. PARAMS, junkForTemplate=%s', junkForTemplate)
        keyPath = KeyPath()

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

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

        xmlVal = Value()
        xmlVal.setXmlTag(
            ("platform",
             "http://qwilt.com/ns/yang/device/tech/qwilt-tech-platform",
             "qt-pltf"))
        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
Example #43
0
    def _fillWriteTagValues(self, tagValueList):
        self.myInitGuard.isInitOrCrash()
        for logFunc in self._log('fill-write-tag-values').debug3Func():
            logFunc('called: tagValueList=%s', tagValueList)

        for key in self.kids.keys():
            if self.kids[key]:
                valBegin = Value()
                (tag, ns, prefix) = ("kid", "http://qwilt.com/model/family",
                                     "family")
                valBegin.setXmlBegin((tag, ns, prefix))
                tagValueList.push((tag, ns), valBegin)

                valKey = Value()
                valKey.setString(key)
                tagValueList.push(("name", "http://qwilt.com/model/family"),
                                  valKey)

                tagValueListLen = tagValueList.getLen()

                res = self.kids[key]._fillWriteTagValues(tagValueList)
                if res != ReturnCodes.kOk:
                    for logFunc in self._log(
                            'fill-write-tag-values-kid-failed').errorFunc():
                        logFunc('kid._fillWriteTagValues() 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
Example #44
0
    def s_create(cls, logger, loggerClass, domain):
        __pychecker__ = "no-argsused"

        logger('s-create-blinkyloggerclass').info(
            'called. domain=%s, _validationPointId=%s, _actionPointId=%s',
            domain, BlinkyLoggerClass._validationPointId,
            BlinkyLoggerClass._actionPointId)

        confd_key = KeyPath()

        ancestorVal = Value()
        ancestorVal.setString(loggerClass)
        confd_key.addKeyPathPrefix(ancestorVal)

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

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

        newNode = BlinkyLoggerClass(logger)
        logger("s-create-keypath").info("confd_key=%s", confd_key)
        newNode.setParent(None)
        newNode.setKeyPath(confd_key)
        newNode.setDomain(domain)
        res = newNode.internalInit()
        if (res != ReturnCodes.kOk):
            logger("s-create-internal-init-failed")\
                .error("internalInit() failed. confd_key=%s", confd_key)

        if newNode._validationPointId:
            res = domain.registerValidationPoint(newNode._validationPointId,
                                                 newNode)
            if (res != ReturnCodes.kOk):
                logger("s-create-register-validation-node--failed")\
                    .error("registerValidationNode(%s) failed",  newNode._validationPointId)
                return None
        newNode.validateRegistrationDone = True
        if newNode._actionPointId:
            res = domain.registerActionPoint(newNode._actionPointId, newNode)
            if (res != ReturnCodes.kOk):
                logger("s-create-register-action-node--failed")\
                    .error("registerActionNode(%s) failed",  newNode._actionPointId)
                return None
        newNode.actionRegistrationDone = True

        return newNode
    def s_create(cls, logger, domain):
        __pychecker__ = "no-argsused"

        logger('s-create-blinkysimulation').info(
            'called. domain=%s, _validationPointId=%s, _actionPointId=%s',
            domain, BlinkySimulation._validationPointId,
            BlinkySimulation._actionPointId)

        confd_key = KeyPath()

        xmlVal = Value()
        xmlVal.setXmlTag(
            ("simulation",
             "http://qwilt.com/ns/yang/device/tech/qwilt-tech-platform-power",
             "qt-pltf-pwr"))
        confd_key.addKeyPathPrefix(xmlVal)

        xmlVal = Value()
        xmlVal.setXmlTag(
            ("system-defaults",
             "http://qwilt.com/ns/yang/device/tech/qwilt-tech-platform-power",
             "qt-pltf-pwr"))
        confd_key.addKeyPathPrefix(xmlVal)

        xmlVal = Value()
        xmlVal.setXmlTag(
            ("power",
             "http://qwilt.com/ns/yang/device/tech/qwilt-tech-platform-power",
             "qt-pltf-pwr"))
        confd_key.addKeyPathPrefix(xmlVal)

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

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

        newNode = BlinkySimulation(logger)
        logger("s-create-keypath").info("confd_key=%s", confd_key)
        newNode.setParent(None)
        newNode.setKeyPath(confd_key)
        newNode.setDomain(domain)
        res = newNode.internalInit()
        if (res != ReturnCodes.kOk):
            logger("s-create-internal-init-failed")\
                .error("internalInit() failed. confd_key=%s", confd_key)

        if newNode._validationPointId:
            res = domain.registerValidationPoint(newNode._validationPointId,
                                                 newNode)
            if (res != ReturnCodes.kOk):
                logger("s-create-register-validation-node--failed")\
                    .error("registerValidationNode(%s) failed",  newNode._validationPointId)
                return None
        newNode.validateRegistrationDone = True
        if newNode._actionPointId:
            res = domain.registerActionPoint(newNode._actionPointId, newNode)
            if (res != ReturnCodes.kOk):
                logger("s-create-register-action-node--failed")\
                    .error("registerActionNode(%s) failed",  newNode._actionPointId)
                return None
        newNode.actionRegistrationDone = True

        return newNode
Example #46
0
    def _getSelfKeyPath(self, junkForTemplate):
        for logFunc in self._log('get-self-key-path').debug3Func():
            logFunc('called. PARAMS, junkForTemplate=%s', junkForTemplate)
        keyPath = KeyPath()

        xmlVal = Value()
        xmlVal.setXmlTag(
            ("thresholds",
             "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
Example #47
0
    def _getSelfKeyPath(self, ipv4, host, junkForTemplate):
        for logFunc in self._log('get-self-key-path').debug3Func():
            logFunc('called. PARAMS, junkForTemplate=%s', junkForTemplate)
        keyPath = KeyPath()

        ancestorVal = Value()
        ancestorVal.setString(host)
        keyPath.addKeyPathPrefix(ancestorVal)

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

        ancestorVal = Value()
        ancestorVal.setString(ipv4)
        keyPath.addKeyPathPrefix(ancestorVal)

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

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

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

        xmlVal = Value()
        xmlVal.setXmlTag(
            ("name-resolution",
             "http://qwilt.com/ns/yang/device/tech/qwilt-tech-system",
             "qt-sys"))
        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
Example #48
0
    def _fillReadTagValues(self, tagValueList):
        self.myInitGuard.isInitOrCrash()
        for logFunc in self._log('fill-read-tag-values').debug3Func():
            logFunc('called: tagValueList=%s', tagValueList)

        if self.isSinglePollDurationWarningMsecRequested():
            valSinglePollDurationWarningMsec = Value()
            valSinglePollDurationWarningMsec.setEmpty()
            tagValueList.push((
                "single-poll-duration-warning-msec",
                "http://qwilt.com/ns/yang/device/tech/qwilt-tech-system-alarms"
            ), valSinglePollDurationWarningMsec)

        if self.isPollLatencyErrorSecondsRequested():
            valPollLatencyErrorSeconds = Value()
            valPollLatencyErrorSeconds.setEmpty()
            tagValueList.push((
                "poll-latency-error-seconds",
                "http://qwilt.com/ns/yang/device/tech/qwilt-tech-system-alarms"
            ), valPollLatencyErrorSeconds)

        if self.isSinglePollDurationErrorMsecRequested():
            valSinglePollDurationErrorMsec = Value()
            valSinglePollDurationErrorMsec.setEmpty()
            tagValueList.push((
                "single-poll-duration-error-msec",
                "http://qwilt.com/ns/yang/device/tech/qwilt-tech-system-alarms"
            ), valSinglePollDurationErrorMsec)

        if self.isOverallPollDurationErrorMsecRequested():
            valOverallPollDurationErrorMsec = Value()
            valOverallPollDurationErrorMsec.setEmpty()
            tagValueList.push((
                "overall-poll-duration-error-msec",
                "http://qwilt.com/ns/yang/device/tech/qwilt-tech-system-alarms"
            ), valOverallPollDurationErrorMsec)

        if self.isPollLatencyWarningSecondsRequested():
            valPollLatencyWarningSeconds = Value()
            valPollLatencyWarningSeconds.setEmpty()
            tagValueList.push((
                "poll-latency-warning-seconds",
                "http://qwilt.com/ns/yang/device/tech/qwilt-tech-system-alarms"
            ), valPollLatencyWarningSeconds)

        if self.isOverallPollDurationWarningMsecRequested():
            valOverallPollDurationWarningMsec = Value()
            valOverallPollDurationWarningMsec.setEmpty()
            tagValueList.push((
                "overall-poll-duration-warning-msec",
                "http://qwilt.com/ns/yang/device/tech/qwilt-tech-system-alarms"
            ), valOverallPollDurationWarningMsec)

        return ReturnCodes.kOk
Example #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.isActiveSecondsRequested() and operData.hasActiveSeconds():
            val = Value()
            val.setInt64(operData.activeSeconds)
            tagValueList.push(("active-seconds", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-log"), val)
        
        if operData.isTotalSecondsRequested() and operData.hasTotalSeconds():
            val = Value()
            val.setInt64(operData.totalSeconds)
            tagValueList.push(("total-seconds", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-log"), val)
        
        if operData.isPollsRequested() and operData.hasPolls():
            val = Value()
            val.setInt64(operData.polls)
            tagValueList.push(("polls", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-log"), val)
        
        if operData.isPollsMissedRequested() and operData.hasPollsMissed():
            val = Value()
            val.setInt64(operData.pollsMissed)
            tagValueList.push(("polls-missed", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-log"), val)
        
        if operData.isPollLatencyWarningsRequested() and operData.hasPollLatencyWarnings():
            val = Value()
            val.setInt64(operData.pollLatencyWarnings)
            tagValueList.push(("poll-latency-warnings", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-log"), val)
        
        if operData.isPollLatencyErrorsRequested() and operData.hasPollLatencyErrors():
            val = Value()
            val.setInt64(operData.pollLatencyErrors)
            tagValueList.push(("poll-latency-errors", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-log"), 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
Example #50
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.configPs.keys():
            if self.configPs[key]:
                valBegin = Value()
                (tag, ns, prefix) = ("config-p", "http://qwilt.com/model/oper",
                                     "oper")
                valBegin.setXmlBegin((tag, ns, prefix))
                tagValueList.push((tag, ns), valBegin)

                valKey = Value()
                valKey.setInt64(key)
                tagValueList.push(("id", "http://qwilt.com/model/oper"),
                                  valKey)

                tagValueListLen = tagValueList.getLen()

                res = self.configPs[key]._fillReadTagValues(tagValueList)
                if res != ReturnCodes.kOk:
                    for logFunc in self._log(
                            'fill-read-tag-values-configP-failed').errorFunc():
                        logFunc('configP._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
Example #51
0
    def _getSelfKeyPath (self, interface
                         
                         , junkForTemplate):
        for logFunc in self._log('get-self-key-path').debug3Func(): logFunc('called. PARAMS, junkForTemplate=%s', junkForTemplate)
        keyPath = KeyPath()
        
        
        xmlVal = Value()
        xmlVal.setXmlTag(("management", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-interfaces", "qt-if"))
        keyPath.addKeyPathPrefix(xmlVal)
        
        
        xmlVal = Value()
        xmlVal.setXmlTag(("system-defaults", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-interfaces", "qt-if"))
        keyPath.addKeyPathPrefix(xmlVal)
        
        
        ancestorVal = Value()
        ancestorVal.setString(interface);
        keyPath.addKeyPathPrefix(ancestorVal)
        
        xmlVal = Value()
        xmlVal.setXmlTag(("interface", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-interfaces", "qt-if"))
        keyPath.addKeyPathPrefix(xmlVal)
        
        
        xmlVal = Value()
        xmlVal.setXmlTag(("interfaces", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-interfaces", "qt-if"))
        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
    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.isUuidRequested() and operData.hasUuid():
            val = Value()
            val.setString(operData.uuid)
            tagValueList.push(
                ("uuid",
                 "http://qwilt.com/ns/yang/device/tech/qwilt-tech-storage-disk"
                 ), 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-storage-disk"
                 ), val)

        if operData.isFileSystemTypeRawRequested(
        ) and operData.hasFileSystemTypeRaw():
            val = Value()
            val.setString(operData.fileSystemTypeRaw)
            tagValueList.push(
                ("file-system-type-raw",
                 "http://qwilt.com/ns/yang/device/tech/qwilt-tech-storage-disk"
                 ), val)

        if operData.isFileSystemTypeRequested() and operData.hasFileSystemType(
        ):
            val = Value()
            val.setEnum(operData.fileSystemType.getValue())
            tagValueList.push(
                ("file-system-type",
                 "http://qwilt.com/ns/yang/device/tech/qwilt-tech-storage-disk"
                 ), val)

        if operData.isExpectedUuidRequested() and operData.hasExpectedUuid():
            val = Value()
            val.setString(operData.expectedUuid)
            tagValueList.push(
                ("expected-uuid",
                 "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 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
    def _fillReadTagValues (self, tagValueList):
        self.myInitGuard.isInitOrCrash()
        for logFunc in self._log('fill-read-tag-values').debug3Func(): logFunc('called: tagValueList=%s', tagValueList)

        
        if self.isDummyRequested():
            valDummy = Value()
            valDummy.setEmpty()
            tagValueList.push(("dummy", "http://qwilt.com/ns/yang/ut/sys/blinky/example/python/oper-example"), valDummy)
        

        
        if self.countersObj:
            valBegin = Value()
            (tag, ns, prefix) = ("counters" , "http://qwilt.com/ns/yang/ut/sys/blinky/example/python/oper-example", "oe")
            valBegin.setXmlBegin((tag, ns, prefix))
            tagValueList.push((tag, ns), valBegin)

            tagValueListLen = tagValueList.getLen()

            res = self.countersObj._fillReadTagValues(tagValueList)
            if res != ReturnCodes.kOk:
                for logFunc in self._log('fill-read-tag-values-counters-failed').errorFunc(): logFunc('countersObj._fillReadTagValues() 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
Example #54
0
    def _getSelfKeyPath(self, opV, junkForTemplate):
        for logFunc in self._log('get-self-key-path').debug3Func():
            logFunc('called. PARAMS, junkForTemplate=%s', junkForTemplate)
        keyPath = KeyPath()

        ancestorVal = Value()
        ancestorVal.setString(opV)
        keyPath.addKeyPathPrefix(ancestorVal)

        xmlVal = Value()
        xmlVal.setXmlTag(("op-v", "http://qwilt.com/model/oper", "oper"))
        keyPath.addKeyPathPrefix(xmlVal)

        xmlVal = Value()
        xmlVal.setXmlTag(("config-a", "http://qwilt.com/model/oper", "oper"))
        keyPath.addKeyPathPrefix(xmlVal)

        for logFunc in self._log('get-self-key-path-done').debug3Func():
            logFunc('done. keyPath=%s. PARAMS', keyPath)
        return keyPath
    def _getSelfKeyPath (self, alien
                         
                         , junkForTemplate):
        for logFunc in self._log('get-self-key-path').debug3Func(): logFunc('called. PARAMS, junkForTemplate=%s', junkForTemplate)
        keyPath = KeyPath()
        
        
        xmlVal = Value()
        xmlVal.setXmlTag(("status-wrapper", "http://qwilt.com/ns/yang/ut/sys/blinky/example/python/oper-example", "oe"))
        keyPath.addKeyPathPrefix(xmlVal)
        
        
        ancestorVal = Value()
        ancestorVal.setString(alien);
        keyPath.addKeyPathPrefix(ancestorVal)
        
        xmlVal = Value()
        xmlVal.setXmlTag(("alien", "http://qwilt.com/ns/yang/ut/sys/blinky/example/python/oper-example", "oe"))
        keyPath.addKeyPathPrefix(xmlVal)
        
        
        xmlVal = Value()
        xmlVal.setXmlTag(("root", "http://qwilt.com/ns/yang/ut/sys/blinky/example/python/oper-example", "oe"))
        keyPath.addKeyPathPrefix(xmlVal)
        

        for logFunc in self._log('get-self-key-path-done').debug3Func(): logFunc('done. keyPath=%s. PARAMS', keyPath)
        return keyPath
    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.isActualDeliveryInterfaceRequested(
        ) and operData.hasActualDeliveryInterface():
            val = Value()
            val.setString(operData.actualDeliveryInterface)
            tagValueList.push((
                "actual-delivery-interface",
                "http://qwilt.com/ns/yang/device/tech/qwilt-tech-content-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
Example #57
0
    def _fillReadTagValues(self, tagValueList):
        self.myInitGuard.isInitOrCrash()
        for logFunc in self._log('fill-read-tag-values').debug3Func():
            logFunc('called: tagValueList=%s', tagValueList)

        if self.isEnabledRequested():
            valEnabled = Value()
            valEnabled.setEmpty()
            tagValueList.push(
                ("enabled",
                 "http://qwilt.com/ns/yang/device/tech/qwilt-tech-process"),
                valEnabled)

        if self.isNameRequested():
            valName = Value()
            valName.setEmpty()
            tagValueList.push(
                ("name",
                 "http://qwilt.com/ns/yang/device/tech/qwilt-tech-process"),
                valName)

        if self.executionObj:
            valBegin = Value()
            (tag, ns, prefix) = (
                "execution",
                "http://qwilt.com/ns/yang/device/tech/qwilt-tech-process",
                "qt-proc")
            valBegin.setXmlBegin((tag, ns, prefix))
            tagValueList.push((tag, ns), valBegin)

            tagValueListLen = tagValueList.getLen()

            res = self.executionObj._fillReadTagValues(tagValueList)
            if res != ReturnCodes.kOk:
                for logFunc in self._log(
                        'fill-read-tag-values-execution-failed').errorFunc():
                    logFunc('executionObj._fillReadTagValues() 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
Example #58
0
    def _fillReadTagValues(self, tagValueList):
        self.myInitGuard.isInitOrCrash()
        for logFunc in self._log('fill-read-tag-values').debug3Func():
            logFunc('called: tagValueList=%s', tagValueList)

        if self.houseKeeperObj:
            valBegin = Value()
            (tag, ns, prefix) = (
                "house-keeper",
                "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.houseKeeperObj._fillReadTagValues(tagValueList)
            if res != ReturnCodes.kOk:
                for logFunc in self._log(
                        'fill-read-tag-values-house-keeper-failed').errorFunc(
                        ):
                    logFunc(
                        'houseKeeperObj._fillReadTagValues() 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.queueGroupListObj:
            valBegin = Value()
            (tag, ns, prefix) = (
                "queue-group",
                "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.queueGroupListObj._fillReadTagValues(tagValueList)
            if res != ReturnCodes.kOk:
                for logFunc in self._log(
                        'fill-read-tag-values-queue-group-failed').errorFunc():
                    logFunc(
                        'queueGroupListObj._fillReadTagValues() 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.interfaceListObj:
            valBegin = Value()
            (tag, ns, prefix) = (
                "interface",
                "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.interfaceListObj._fillReadTagValues(tagValueList)
            if res != ReturnCodes.kOk:
                for logFunc in self._log(
                        'fill-read-tag-values-interface-failed').errorFunc():
                    logFunc(
                        'interfaceListObj._fillReadTagValues() 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.unitListObj:
            valBegin = Value()
            (tag, ns, prefix) = (
                "unit",
                "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.unitListObj._fillReadTagValues(tagValueList)
            if res != ReturnCodes.kOk:
                for logFunc in self._log(
                        'fill-read-tag-values-unit-failed').errorFunc():
                    logFunc('unitListObj._fillReadTagValues() 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.dpdkObj:
            valBegin = Value()
            (tag, ns, prefix) = (
                "dpdk",
                "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.dpdkObj._fillReadTagValues(tagValueList)
            if res != ReturnCodes.kOk:
                for logFunc in self._log(
                        'fill-read-tag-values-dpdk-failed').errorFunc():
                    logFunc('dpdkObj._fillReadTagValues() 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
Example #59
0
    def _getSelfKeyPath (self, sensor
                         
                         , junkForTemplate):
        for logFunc in self._log('get-self-key-path').debug3Func(): logFunc('called. PARAMS, junkForTemplate=%s', junkForTemplate)
        keyPath = KeyPath()
        
        
        xmlVal = Value()
        xmlVal.setXmlTag(("device", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-platform-temperature", "qt-pltf-temperature"))
        keyPath.addKeyPathPrefix(xmlVal)
        
        
        xmlVal = Value()
        xmlVal.setXmlTag(("system-defaults", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-platform-temperature", "qt-pltf-temperature"))
        keyPath.addKeyPathPrefix(xmlVal)
        
        
        ancestorVal = Value()
        ancestorVal.setString(sensor);
        keyPath.addKeyPathPrefix(ancestorVal)
        
        xmlVal = Value()
        xmlVal.setXmlTag(("sensor", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-platform-temperature", "qt-pltf-temperature"))
        keyPath.addKeyPathPrefix(xmlVal)
        
        
        xmlVal = Value()
        xmlVal.setXmlTag(("temperature", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-platform-temperature", "qt-pltf-temperature"))
        keyPath.addKeyPathPrefix(xmlVal)
        
        
        xmlVal = Value()
        xmlVal.setXmlTag(("platform", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-platform", "qt-pltf"))
        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
Example #60
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.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.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.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)

        return ReturnCodes.kOk