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 _getSelfKeyPath (self, list , junkForTemplate): for logFunc in self._log('get-self-key-path').debug3Func(): logFunc('called. PARAMS, junkForTemplate=%s', junkForTemplate) keyPath = KeyPath() ancestorVal = Value() ancestorVal.setInt64(list); keyPath.addKeyPathPrefix(ancestorVal) xmlVal = Value() xmlVal.setXmlTag(("list", "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
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
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) if self.hasPatternName(): valPatternName = Value() if self.patternName is not None: valPatternName.setString(self.patternName) else: valPatternName.setEmpty() tagValueList.push(("pattern-name", "http://qwilt.com/model/lake-example"), valPatternName) 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.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.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.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
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
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
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) if self.hasPatternName(): valPatternName = Value() if self.patternName is not None: valPatternName.setString(self.patternName) else: valPatternName.setEmpty() tagValueList.push( ("pattern-name", "http://qwilt.com/model/lake-example"), valPatternName) return ReturnCodes.kOk
def _collectItemsToDelete (self, itemsToDelete): self.myInitGuard.isInitOrCrash() for logFunc in self._log('collect-items-to-delete').debug3Func(): logFunc('called: itemsToDelete=%s. PARAMS', itemsToDelete) for key in self.configPs.keys(): if self.configPs[key]: res = self.configPs[key]._collectItemsToDelete( key, itemsToDelete) if res != ReturnCodes.kOk: for logFunc in self._log('collect-items-to-delete-configP-failed').errorFunc(): logFunc('configPObj._collectItemsToDelete() failed. key=%s. PARAMS', key) return ReturnCodes.kGeneralError else: keyPath = self._getSelfKeyPath( None) xmlVal = Value() xmlVal.setXmlTag(("config-p", "http://qwilt.com/model/oper", "oper")) keyPath.addKeyPathPostfix(xmlVal) valKey = Value() valKey.setInt64(key) keyPath.addKeyPathPostfix(valKey) itemsToDelete.append(keyPath) for logFunc in self._log('collect-items-to-delete-done').debug3Func(): logFunc('done: itemsToDelete=%s. PARAMS', itemsToDelete) return ReturnCodes.kOk
def _getSelfKeyPath (self, opC , junkForTemplate): for logFunc in self._log('get-self-key-path').debug3Func(): logFunc('called. PARAMS, junkForTemplate=%s', junkForTemplate) keyPath = KeyPath() ancestorVal = Value() ancestorVal.setInt64(opC); keyPath.addKeyPathPrefix(ancestorVal) xmlVal = Value() xmlVal.setXmlTag(("op-c", "http://qwilt.com/model/oper", "oper")) keyPath.addKeyPathPrefix(xmlVal) xmlVal = Value() xmlVal.setXmlTag(("op-b", "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 _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
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 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 _collectItemsToDelete (self, itemsToDelete): self.myInitGuard.isInitOrCrash() for logFunc in self._log('collect-items-to-delete').debug3Func(): logFunc('called: itemsToDelete=%s. PARAMS', itemsToDelete) for key in self.lists.keys(): if self.lists[key]: res = self.lists[key]._collectItemsToDelete( key, itemsToDelete) if res != ReturnCodes.kOk: for logFunc in self._log('collect-items-to-delete-list-failed').errorFunc(): logFunc('listObj._collectItemsToDelete() failed. key=%s. PARAMS', key) return ReturnCodes.kGeneralError else: keyPath = self._getSelfKeyPath( None) xmlVal = Value() xmlVal.setXmlTag(("list", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-system-alarms", "qt-sys-alarms")) keyPath.addKeyPathPostfix(xmlVal) valKey = Value() valKey.setInt64(key) keyPath.addKeyPathPostfix(valKey) itemsToDelete.append(keyPath) for logFunc in self._log('collect-items-to-delete-done').debug3Func(): logFunc('done: itemsToDelete=%s. PARAMS', itemsToDelete) return ReturnCodes.kOk
def _fillWriteTagValues (self, tagValueList): self.myInitGuard.isInitOrCrash() for logFunc in self._log('fill-write-tag-values').debug3Func(): logFunc('called: tagValueList=%s', tagValueList) if self.hasName(): valName = Value() if self.name is not None: valName.setString(self.name) else: valName.setEmpty() tagValueList.push(("name", "http://qwilt.com/model/lake-example"), valName) if self.hasValue(): valValue = Value() if self.value is not None: valValue.setInt64(self.value) else: valValue.setEmpty() tagValueList.push(("value", "http://qwilt.com/model/lake-example"), valValue) 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.lists.keys(): if self.lists[key]: valBegin = Value() (tag, ns, prefix) = ("list", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-system-alarms", "qt-sys-alarms") valBegin.setXmlBegin((tag, ns, prefix)) tagValueList.push((tag, ns), valBegin) valKey = Value() valKey.setInt64(key) tagValueList.push(("number", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-system-alarms"), valKey) tagValueListLen = tagValueList.getLen() res = self.lists[key]._fillReadTagValues(tagValueList) if res != ReturnCodes.kOk: for logFunc in self._log('fill-read-tag-values-list-failed').errorFunc(): logFunc('list._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 _getSelfKeyPath (self, configP , junkForTemplate): for logFunc in self._log('get-self-key-path').debug3Func(): logFunc('called. PARAMS, junkForTemplate=%s', junkForTemplate) keyPath = KeyPath() xmlVal = Value() xmlVal.setXmlTag(("op-r", "http://qwilt.com/model/oper", "oper")) keyPath.addKeyPathPrefix(xmlVal) ancestorVal = Value() ancestorVal.setInt64(configP); keyPath.addKeyPathPrefix(ancestorVal) xmlVal = Value() xmlVal.setXmlTag(("config-p", "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 _collectItemsToDelete(self, itemsToDelete): self.myInitGuard.isInitOrCrash() for logFunc in self._log('collect-items-to-delete').debug3Func(): logFunc('called: itemsToDelete=%s. PARAMS', itemsToDelete) for key in self.opCs.keys(): if self.opCs[key]: res = self.opCs[key]._collectItemsToDelete(key, itemsToDelete) if res != ReturnCodes.kOk: for logFunc in self._log( 'collect-items-to-delete-opC-failed').errorFunc(): logFunc( 'opCObj._collectItemsToDelete() failed. key=%s. PARAMS', key) return ReturnCodes.kGeneralError else: keyPath = self._getSelfKeyPath(None) xmlVal = Value() xmlVal.setXmlTag( ("op-c", "http://qwilt.com/model/oper", "oper")) keyPath.addKeyPathPostfix(xmlVal) valKey = Value() valKey.setInt64(key) keyPath.addKeyPathPostfix(valKey) itemsToDelete.append(keyPath) for logFunc in self._log('collect-items-to-delete-done').debug3Func(): logFunc('done: itemsToDelete=%s. PARAMS', itemsToDelete) return ReturnCodes.kOk
def _fillWriteTagValues(self, tagValueList): self.myInitGuard.isInitOrCrash() for logFunc in self._log('fill-write-tag-values').debug3Func(): logFunc('called: tagValueList=%s', tagValueList) if self.hasTrimContentItemSizeMb(): valTrimContentItemSizeMb = Value() if self.trimContentItemSizeMb is not None: valTrimContentItemSizeMb.setInt64(self.trimContentItemSizeMb) else: valTrimContentItemSizeMb.setEmpty() tagValueList.push( ("trim-content-item-size-mb", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-content-line" ), valTrimContentItemSizeMb) if self.hasName(): valName = Value() if self.name is not None: valName.setString(self.name) else: valName.setEmpty() tagValueList.push( ("name", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-content-line" ), valName) if self.systemDefaultsObj: valBegin = Value() (tag, ns, prefix) = ( "system-defaults", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-content-line", "qtc-line") valBegin.setXmlBegin((tag, ns, prefix)) tagValueList.push((tag, ns), valBegin) tagValueListLen = tagValueList.getLen() res = self.systemDefaultsObj._fillWriteTagValues(tagValueList) if res != ReturnCodes.kOk: for logFunc in self._log( 'fill-write-tag-values-system-defaults-failed' ).errorFunc(): logFunc( 'systemDefaultsObj._fillWriteTagValues() failed. PARAMS' ) return ReturnCodes.kGeneralError if tagValueList.getLen() == tagValueListLen: # descendant didn't add anything, no need to read it. tagValueList.pop() else: valEnd = Value() valEnd.setXmlEnd((tag, ns, prefix)) tagValueList.push((tag, ns), valEnd) return ReturnCodes.kOk
def _fillWriteTagValues(self, tagValueList): self.myInitGuard.isInitOrCrash() for logFunc in self._log('fill-write-tag-values').debug3Func(): logFunc('called: tagValueList=%s', tagValueList) if self.hasName(): valName = Value() if self.name is not None: valName.setString(self.name) else: valName.setEmpty() tagValueList.push(( "name", "http://qwilt.com/ns/yang/ut/sys/blinky/example/python/oper-example" ), valName) if self.hasHeight(): valHeight = Value() if self.height is not None: valHeight.setInt64(self.height) else: valHeight.setEmpty() tagValueList.push(( "height", "http://qwilt.com/ns/yang/ut/sys/blinky/example/python/oper-example" ), valHeight) if self.statusWrapperObj: valBegin = Value() (tag, ns, prefix) = ( "status-wrapper", "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.statusWrapperObj._fillWriteTagValues(tagValueList) if res != ReturnCodes.kOk: for logFunc in self._log( 'fill-write-tag-values-status-wrapper-failed' ).errorFunc(): logFunc( 'statusWrapperObj._fillWriteTagValues() failed. PARAMS' ) return ReturnCodes.kGeneralError if tagValueList.getLen() == tagValueListLen: # descendant didn't add anything, no need to read it. tagValueList.pop() else: valEnd = Value() valEnd.setXmlEnd((tag, ns, prefix)) tagValueList.push((tag, ns), valEnd) return ReturnCodes.kOk
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
def getNext(self, trxContext, keypath, next): for logFunc in self._log("get-next").debug3Func(): logFunc("called. keypath=%s, next=%s, trxContext=%s", keypath, next, trxContext) var = 0 isCompleted = True if self.myIsActive: if self.myGetNextFunctor: timeoutGuardName = str( self.myKeyPath) + "-" + "get-next-functor" timeoutGuard = TimeoutGuard( self._log, timeoutGuardName, self.getFunctorTimeout(self.GET_NEXT_FUNCTOR), self.getFunctorMildTimeout(self.GET_NEXT_FUNCTOR)) var_PBR = PassByRef(var) next_PBR = PassByRef(next) isCompleted_PBR = PassByRef(None) res = self.myGetNextFunctor(trxContext, var_PBR, next_PBR, isCompleted_PBR) timeoutGuard.checkAndLog("application problem: functor=%s" % self.myGetNextFunctor.__name__) if res != ReturnCodes.kOk: for logFunc in self._log( "get-next-functor-failed").errorFunc(): logFunc( "functor failed. res=%s, keypath=%s, trxContext=%s", res, keypath, trxContext) return ReturnCodes.kGeneralError var = var_PBR.value() next = next_PBR.value() isCompleted = isCompleted_PBR.value() for logFunc in self._log( "get-next-send-next-key-functor-returned").debug3Func( ): logFunc( "functor returned. keypath=%s, trxContext=%s, var=%s, next=%s, isCompeted=%s", keypath, trxContext, var, next, isCompleted) nextKeyValue = Value() if isCompleted == True: nextKeyValue.setEmpty() else: nextKeyValue.setInt64(var) res = self.myDomain.sendNextKeyValue(trxContext, nextKeyValue, next) if res != ReturnCodes.kOk: for logFunc in self._log( "get-next-send-next-key-value-failed").errorFunc(): logFunc( "domain.sendNextKeyValue() failed. res=%s, keypath=%s, trxContext=%s, nextKeyValue=%s, next=%s", res, keypath, trxContext, nextKeyValue, next) return ReturnCodes.kGeneralError return ReturnCodes.kOk
def _fillWriteTagValues (self, tagValueList): self.myInitGuard.isInitOrCrash() for logFunc in self._log('fill-write-tag-values').debug3Func(): logFunc('called: tagValueList=%s', tagValueList) if self.hasColor(): valColor = Value() if self.color is not None: valColor.setString(self.color) else: valColor.setEmpty() tagValueList.push(("color", "http://qwilt.com/ns/yang/ut/sys/blinky/example/python/simple-example"), valColor) if self.hasPretty(): valPretty = Value() if self.pretty is not None: valPretty.setBool(self.pretty) else: valPretty.setEmpty() tagValueList.push(("pretty", "http://qwilt.com/ns/yang/ut/sys/blinky/example/python/simple-example"), valPretty) if self.hasNumOfLegs(): valNumOfLegs = Value() if self.numOfLegs is not None: valNumOfLegs.setInt64(self.numOfLegs) else: valNumOfLegs.setEmpty() tagValueList.push(("num-of-legs", "http://qwilt.com/ns/yang/ut/sys/blinky/example/python/simple-example"), valNumOfLegs) if self.statusObj: valBegin = Value() (tag, ns, prefix) = ("status" , "http://qwilt.com/ns/yang/ut/sys/blinky/example/python/simple-example", "se") valBegin.setXmlBegin((tag, ns, prefix)) tagValueList.push((tag, ns), valBegin) tagValueListLen = tagValueList.getLen() res = self.statusObj._fillWriteTagValues(tagValueList) if res != ReturnCodes.kOk: for logFunc in self._log('fill-write-tag-values-status-failed').errorFunc(): logFunc('statusObj._fillWriteTagValues() failed. PARAMS') return ReturnCodes.kGeneralError if tagValueList.getLen() == tagValueListLen: # descendant didn't add anything, no need to read it. tagValueList.pop() else: valEnd = Value() valEnd.setXmlEnd((tag, ns, prefix)) tagValueList.push((tag, ns), valEnd) return ReturnCodes.kOk
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-system-alarms"), valEnabled) if self.hasRaiseTestAlarm(): valRaiseTestAlarm = Value() if self.raiseTestAlarm is not None: valRaiseTestAlarm.setBool(self.raiseTestAlarm) else: valRaiseTestAlarm.setEmpty() tagValueList.push(("raise-test-alarm", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-system-alarms"), valRaiseTestAlarm) if self.hasPollInterval(): valPollInterval = Value() if self.pollInterval is not None: valPollInterval.setInt64(self.pollInterval) else: valPollInterval.setEmpty() tagValueList.push(("poll-interval", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-system-alarms"), valPollInterval) if self.thresholdsObj: valBegin = Value() (tag, ns, prefix) = ("thresholds" , "http://qwilt.com/ns/yang/device/tech/qwilt-tech-system-alarms", "qt-sys-alarms") valBegin.setXmlBegin((tag, ns, prefix)) tagValueList.push((tag, ns), valBegin) tagValueListLen = tagValueList.getLen() res = self.thresholdsObj._fillWriteTagValues(tagValueList) if res != ReturnCodes.kOk: for logFunc in self._log('fill-write-tag-values-thresholds-failed').errorFunc(): logFunc('thresholdsObj._fillWriteTagValues() failed. PARAMS') return ReturnCodes.kGeneralError if tagValueList.getLen() == tagValueListLen: # descendant didn't add anything, no need to read it. tagValueList.pop() else: valEnd = Value() valEnd.setXmlEnd((tag, ns, prefix)) tagValueList.push((tag, ns), valEnd) return ReturnCodes.kOk
def _fillWriteTagValues (self, tagValueList): self.myInitGuard.isInitOrCrash() for logFunc in self._log('fill-write-tag-values').debug3Func(): logFunc('called: tagValueList=%s', tagValueList) if self.hasMaxActiveConnections(): valMaxActiveConnections = Value() if self.maxActiveConnections is not None: valMaxActiveConnections.setInt64(self.maxActiveConnections) else: valMaxActiveConnections.setEmpty() tagValueList.push(("max-active-connections", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-content-line"), valMaxActiveConnections) 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.hasMaxRedirectRate(): valMaxRedirectRate = Value() if self.maxRedirectRate is not None: valMaxRedirectRate.setInt64(self.maxRedirectRate) else: valMaxRedirectRate.setEmpty() tagValueList.push(("max-redirect-rate", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-content-line"), valMaxRedirectRate) if self.blockerObj: valBegin = Value() (tag, ns, prefix) = ("blocker" , "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.blockerObj._fillWriteTagValues(tagValueList) if res != ReturnCodes.kOk: for logFunc in self._log('fill-write-tag-values-blocker-failed').errorFunc(): logFunc('blockerObj._fillWriteTagValues() failed. PARAMS') return ReturnCodes.kGeneralError if tagValueList.getLen() == tagValueListLen: # descendant didn't add anything, no need to read it. tagValueList.pop() else: valEnd = Value() valEnd.setXmlEnd((tag, ns, prefix)) tagValueList.push((tag, ns), valEnd) return ReturnCodes.kOk
def fillTagValues (self, keyPath, tagValueList, operData): initialListSize = tagValueList.getLen() for logFunc in self._log("fill-tag-values").debug3Func(): logFunc("called. operData=%s, keyPath=%s, initialListSize=%d", operData.debugStr(True), keyPath, initialListSize) # fill tag values up to current if self.myKeyPath.isEqualLen(keyPath, keyPath.getLen()): i = keyPath.getLen() while i < self.myKeyPath.getLen(): valBegin = Value() (tag, ns, prefix) = self.myKeyPath.getAt(i).asXmlTag() valBegin.setXmlBegin((tag, ns, prefix)) tagValueList.push((tag, ns), valBegin) for logFunc in self._log("fill-tag-values-adding").debug3Func(): logFunc("adding xml begin. i=%d, valBegin=%s, self.myKeyPath.getLen()=%d", i, valBegin, self.myKeyPath.getLen()) i+=1 if operData.isCountRequested() and operData.hasCount(): val = Value() val.setInt64(operData.count) tagValueList.push(("count", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-platform-temperature"), val) if operData.isTemperatureWarningRequested() and operData.hasTemperatureWarning(): val = Value() val.setBool(operData.temperatureWarning) tagValueList.push(("temperature-warning", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-platform-temperature"), val) if operData.isTemperatureCriticalRequested() and operData.hasTemperatureCritical(): val = Value() val.setBool(operData.temperatureCritical) tagValueList.push(("temperature-critical", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-platform-temperature"), val) if operData.isTemperatureCriticalReasonRequested() and operData.hasTemperatureCriticalReason(): val = Value() val.setEnum(operData.temperatureCriticalReason.getValue()) tagValueList.push(("temperature-critical-reason", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-platform-temperature"), val) if operData.isTemperatureWarningReasonRequested() and operData.hasTemperatureWarningReason(): val = Value() val.setEnum(operData.temperatureWarningReason.getValue()) tagValueList.push(("temperature-warning-reason", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-platform-temperature"), val) if self.myKeyPath.isEqualLen(keyPath, keyPath.getLen()): i = self.myKeyPath.getLen() - 1 while i >= keyPath.getLen(): valEnd = Value() (tag, ns, prefix) = self.myKeyPath.getAt(i).asXmlTag() valEnd.setXmlEnd((tag, ns, prefix)) tagValueList.push((tag, ns), valEnd) i-=1 for logFunc in self._log("fill-tag-values-ended").debug3Func(): logFunc("ended. operData=%s, keyPath=%s, initialListSize=%d, finalListSize=%d", operData.debugStr(True), keyPath, initialListSize, tagValueList.getLen()) return ReturnCodes.kOk
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 getNext (self, trxContext, keypath, next): for logFunc in self._log("get-next").debug3Func(): logFunc("called. keypath=%s, next=%s, trxContext=%s", keypath, next, trxContext) var = 0 isCompleted = True if self.myIsActive: if self.myGetNextFunctor: timeoutGuardName = str(self.myKeyPath) + "-" + "get-next-functor" timeoutGuard = TimeoutGuard(self._log, timeoutGuardName, self.getFunctorTimeout(self.GET_NEXT_FUNCTOR), self.getFunctorMildTimeout(self.GET_NEXT_FUNCTOR)) var_PBR = PassByRef(var) next_PBR = PassByRef(next) isCompleted_PBR = PassByRef(None) res = self.myGetNextFunctor(trxContext, var_PBR, next_PBR, isCompleted_PBR) timeoutGuard.checkAndLog("application problem: functor=%s" % self.myGetNextFunctor.__name__) if res != ReturnCodes.kOk: for logFunc in self._log("get-next-functor-failed").errorFunc(): logFunc( "functor failed. res=%s, keypath=%s, trxContext=%s", res, keypath, trxContext) return ReturnCodes.kGeneralError var = var_PBR.value() next = next_PBR.value() isCompleted = isCompleted_PBR.value() for logFunc in self._log("get-next-send-next-key-functor-returned").debug3Func(): logFunc( "functor returned. keypath=%s, trxContext=%s, var=%s, next=%s, isCompeted=%s", keypath, trxContext, var, next, isCompleted) nextKeyValue = Value() if isCompleted == True: nextKeyValue.setEmpty() else: nextKeyValue.setInt64(var) res = self.myDomain.sendNextKeyValue(trxContext, nextKeyValue, next) if res != ReturnCodes.kOk: for logFunc in self._log("get-next-send-next-key-value-failed").errorFunc(): logFunc( "domain.sendNextKeyValue() failed. res=%s, keypath=%s, trxContext=%s, nextKeyValue=%s, next=%s", res, keypath, trxContext, nextKeyValue, next) return ReturnCodes.kGeneralError return ReturnCodes.kOk;
def s_create (cls, logger, configP, domain): __pychecker__="no-argsused" logger('s-create-blinkyconfigp').info('called. domain=%s, _validationPointId=%s, _actionPointId=%s', domain, BlinkyConfigP._validationPointId, BlinkyConfigP._actionPointId) confd_key=KeyPath() ancestorVal = Value() ancestorVal.setInt64(configP); confd_key.addKeyPathPrefix(ancestorVal) xmlVal = Value() xmlVal.setXmlTag(("config-p", "http://qwilt.com/model/oper", "oper")) confd_key.addKeyPathPrefix(xmlVal) xmlVal = Value() xmlVal.setXmlTag(("config-a", "http://qwilt.com/model/oper", "oper")) confd_key.addKeyPathPrefix(xmlVal) newNode=BlinkyConfigP(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, configP, domain): __pychecker__ = "no-argsused" logger('s-create-blinkyconfigp').info( 'called. domain=%s, _validationPointId=%s, _actionPointId=%s', domain, BlinkyConfigP._validationPointId, BlinkyConfigP._actionPointId) confd_key = KeyPath() ancestorVal = Value() ancestorVal.setInt64(configP) confd_key.addKeyPathPrefix(ancestorVal) xmlVal = Value() xmlVal.setXmlTag(("config-p", "http://qwilt.com/model/oper", "oper")) confd_key.addKeyPathPrefix(xmlVal) xmlVal = Value() xmlVal.setXmlTag(("config-a", "http://qwilt.com/model/oper", "oper")) confd_key.addKeyPathPrefix(xmlVal) newNode = BlinkyConfigP(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 _fillWriteTagValues(self, tagValueList): self.myInitGuard.isInitOrCrash() for logFunc in self._log('fill-write-tag-values').debug3Func(): logFunc('called: tagValueList=%s', tagValueList) if self.hasDummy(): valDummy = Value() if self.dummy is not None: valDummy.setInt64(self.dummy) else: valDummy.setEmpty() tagValueList.push(("dummy", "http://qwilt.com/model/oper"), valDummy) 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.isNumOfCracksRequested() and operData.hasNumOfCracks(): val = Value() val.setInt64(operData.numOfCracks) tagValueList.push(("num-of-cracks", "http://qwilt.com/ns/yang/ut/sys/blinky/example/python/generator-test"), val) if operData.isVersionRequested() and operData.hasVersion(): val = Value() val.setString(operData.version) tagValueList.push(("version", "http://qwilt.com/ns/yang/ut/sys/blinky/example/python/generator-test"), val) if operData.isHealthRequested() and operData.hasHealth(): val = Value() val.setString(operData.health) tagValueList.push(("health", "http://qwilt.com/ns/yang/ut/sys/blinky/example/python/generator-test"), val) if operData.isLinux_Requested() and operData.hasLinux_(): val = Value() val.setString(operData.linux_) tagValueList.push(("linux", "http://qwilt.com/ns/yang/ut/sys/blinky/example/python/generator-test"), 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.isOsDeviceRequested() and operData.hasOsDevice(): val = Value() val.setString(operData.osDevice) tagValueList.push(("os-device", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-storage-disk"), val) if operData.isOprtationalStatusRequested() and operData.hasOprtationalStatus(): val = Value() val.setEnum(operData.oprtationalStatus.getValue()) tagValueList.push(("oprtational-status", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-storage-disk"), val) if operData.isOperationalStatusReasonRequested() and operData.hasOperationalStatusReason(): val = Value() val.setEnum(operData.operationalStatusReason.getValue()) tagValueList.push(("operational-status-reason", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-storage-disk"), val) if operData.isSizeRequested() and operData.hasSize(): val = Value() val.setInt64(operData.size) tagValueList.push(("size", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-storage-disk"), val) if self.myKeyPath.isEqualLen(keyPath, keyPath.getLen()): i = self.myKeyPath.getLen() - 1 while i >= keyPath.getLen(): valEnd = Value() (tag, ns, prefix) = self.myKeyPath.getAt(i).asXmlTag() valEnd.setXmlEnd((tag, ns, prefix)) tagValueList.push((tag, ns), valEnd) i-=1 for logFunc in self._log("fill-tag-values-ended").debug3Func(): logFunc("ended. operData=%s, keyPath=%s, initialListSize=%d, finalListSize=%d", operData.debugStr(True), keyPath, initialListSize, tagValueList.getLen()) return ReturnCodes.kOk
def _fillWriteTagValues (self, tagValueList): self.myInitGuard.isInitOrCrash() for logFunc in self._log('fill-write-tag-values').debug3Func(): logFunc('called: tagValueList=%s', tagValueList) if self.hasTrimContentItemSizeMb(): valTrimContentItemSizeMb = Value() if self.trimContentItemSizeMb is not None: valTrimContentItemSizeMb.setInt64(self.trimContentItemSizeMb) else: valTrimContentItemSizeMb.setEmpty() tagValueList.push(("trim-content-item-size-mb", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-content-line"), valTrimContentItemSizeMb) if self.hasName(): valName = Value() if self.name is not None: valName.setString(self.name) else: valName.setEmpty() tagValueList.push(("name", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-content-line"), valName) if self.systemDefaultsObj: valBegin = Value() (tag, ns, prefix) = ("system-defaults" , "http://qwilt.com/ns/yang/device/tech/qwilt-tech-content-line", "qtc-line") valBegin.setXmlBegin((tag, ns, prefix)) tagValueList.push((tag, ns), valBegin) tagValueListLen = tagValueList.getLen() res = self.systemDefaultsObj._fillWriteTagValues(tagValueList) if res != ReturnCodes.kOk: for logFunc in self._log('fill-write-tag-values-system-defaults-failed').errorFunc(): logFunc('systemDefaultsObj._fillWriteTagValues() failed. PARAMS') return ReturnCodes.kGeneralError if tagValueList.getLen() == tagValueListLen: # descendant didn't add anything, no need to read it. tagValueList.pop() else: valEnd = Value() valEnd.setXmlEnd((tag, ns, prefix)) tagValueList.push((tag, ns), valEnd) return ReturnCodes.kOk
def _fillWriteTagValues (self, tagValueList): self.myInitGuard.isInitOrCrash() for logFunc in self._log('fill-write-tag-values').debug3Func(): logFunc('called: tagValueList=%s', tagValueList) if self.hasTrimContentItemSizeMb(): valTrimContentItemSizeMb = Value() if self.trimContentItemSizeMb is not None: valTrimContentItemSizeMb.setInt64(self.trimContentItemSizeMb) else: valTrimContentItemSizeMb.setEmpty() tagValueList.push(("trim-content-item-size-mb", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-content-line"), valTrimContentItemSizeMb) 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.hasVal(): valVal = Value() if self.val is not None: valVal.setInt64(self.val) else: valVal.setEmpty() tagValueList.push(("val", "http://qwilt.com/model/lake-example"), valVal) 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.hasName(): valName = Value() if self.name is not None: valName.setString(self.name) else: valName.setEmpty() tagValueList.push(("name", "http://qwilt.com/ns/yang/ut/sys/blinky/example/python/oper-example"), valName) if self.hasHeight(): valHeight = Value() if self.height is not None: valHeight.setInt64(self.height) else: valHeight.setEmpty() tagValueList.push(("height", "http://qwilt.com/ns/yang/ut/sys/blinky/example/python/oper-example"), valHeight) if self.statusWrapperObj: valBegin = Value() (tag, ns, prefix) = ("status-wrapper" , "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.statusWrapperObj._fillWriteTagValues(tagValueList) if res != ReturnCodes.kOk: for logFunc in self._log('fill-write-tag-values-status-wrapper-failed').errorFunc(): logFunc('statusWrapperObj._fillWriteTagValues() failed. PARAMS') return ReturnCodes.kGeneralError if tagValueList.getLen() == tagValueListLen: # descendant didn't add anything, no need to read it. tagValueList.pop() else: valEnd = Value() valEnd.setXmlEnd((tag, ns, prefix)) tagValueList.push((tag, ns), valEnd) return ReturnCodes.kOk
def _fillWriteTagValues (self, tagValueList): self.myInitGuard.isInitOrCrash() for logFunc in self._log('fill-write-tag-values').debug3Func(): logFunc('called: tagValueList=%s', tagValueList) if self.hasConfigDummy(): valConfigDummy = Value() if self.configDummy is not None: valConfigDummy.setInt64(self.configDummy) else: valConfigDummy.setEmpty() tagValueList.push(("config-dummy", "http://qwilt.com/model/oper"), valConfigDummy) 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.hasEyeNumber(): valEyeNumber = Value() if self.eyeNumber is not None: valEyeNumber.setInt64(self.eyeNumber) else: valEyeNumber.setEmpty() tagValueList.push(("eye-number", "http://qwilt.com/model/family"), valEyeNumber) if self.hasTransparentField(): valTransparentField = Value() if self.transparentField is not None: valTransparentField.setBool(self.transparentField) else: valTransparentField.setEmpty() tagValueList.push( ("transparent-field", "http://qwilt.com/model/family"), valTransparentField) if self.hasId(): valId = Value() if self.id is not None: valId.setString(self.id) else: valId.setEmpty() tagValueList.push(("id", "http://qwilt.com/model/family"), valId) if self.hasHasTail(): valHasTail = Value() if self.hasTail is not None: valHasTail.setBool(self.hasTail) else: valHasTail.setEmpty() tagValueList.push(("has-tail", "http://qwilt.com/model/family"), valHasTail) 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.isVersionRequested() and operData.hasVersion(): val = Value() val.setString(operData.version) tagValueList.push(("version", "http://qwilt.com/ns/yang/ut/sys/blinky/example/python/simple-example"), val) if operData.isHealthRequested() and operData.hasHealth(): val = Value() val.setString(operData.health) tagValueList.push(("health", "http://qwilt.com/ns/yang/ut/sys/blinky/example/python/simple-example"), val) if operData.isNumOfCracksRequested() and operData.hasNumOfCracks(): val = Value() val.setInt64(operData.numOfCracks) tagValueList.push(("num-of-cracks", "http://qwilt.com/ns/yang/ut/sys/blinky/example/python/simple-example"), val) if self.myKeyPath.isEqualLen(keyPath, keyPath.getLen()): i = self.myKeyPath.getLen() - 1 while i >= keyPath.getLen(): valEnd = Value() (tag, ns, prefix) = self.myKeyPath.getAt(i).asXmlTag() valEnd.setXmlEnd((tag, ns, prefix)) tagValueList.push((tag, ns), valEnd) i-=1 for logFunc in self._log("fill-tag-values-ended").debug3Func(): logFunc("ended. operData=%s, keyPath=%s, initialListSize=%d, finalListSize=%d", operData.debugStr(True), keyPath, initialListSize, tagValueList.getLen()) return ReturnCodes.kOk
def _fillWriteTagValues (self, tagValueList): self.myInitGuard.isInitOrCrash() for logFunc in self._log('fill-write-tag-values').debug3Func(): logFunc('called: tagValueList=%s', tagValueList) if self.hasCommandWarningTimeout(): valCommandWarningTimeout = Value() if self.commandWarningTimeout is not None: valCommandWarningTimeout.setInt64(self.commandWarningTimeout) else: valCommandWarningTimeout.setEmpty() tagValueList.push(("command-warning-timeout", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-platform-manager"), valCommandWarningTimeout) if self.hasCommandTimeout(): valCommandTimeout = Value() if self.commandTimeout is not None: valCommandTimeout.setInt64(self.commandTimeout) else: valCommandTimeout.setEmpty() tagValueList.push(("command-timeout", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-platform-manager"), valCommandTimeout) 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-platform-manager"), valEnabled) if self.hasSimulationFile(): valSimulationFile = Value() if self.simulationFile is not None: valSimulationFile.setString(self.simulationFile) else: valSimulationFile.setEmpty() tagValueList.push(("simulation-file", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-platform-manager"), valSimulationFile) 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.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.hasSleepMsec(): valSleepMsec = Value() if self.sleepMsec is not None: valSleepMsec.setInt64(self.sleepMsec) else: valSleepMsec.setEmpty() tagValueList.push(("sleep-msec", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-content-line"), valSleepMsec) if self.hasCountersUpdateIntervalMsec(): valCountersUpdateIntervalMsec = Value() if self.countersUpdateIntervalMsec is not None: valCountersUpdateIntervalMsec.setInt64(self.countersUpdateIntervalMsec) else: valCountersUpdateIntervalMsec.setEmpty() tagValueList.push(("counters-update-interval-msec", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-content-line"), valCountersUpdateIntervalMsec) 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 _fillWriteTagValues (self, tagValueList): self.myInitGuard.isInitOrCrash() for logFunc in self._log('fill-write-tag-values').debug3Func(): logFunc('called: tagValueList=%s', tagValueList) if self.hasEyeNumber(): valEyeNumber = Value() if self.eyeNumber is not None: valEyeNumber.setInt64(self.eyeNumber) else: valEyeNumber.setEmpty() tagValueList.push(("eye-number", "http://qwilt.com/model/family"), valEyeNumber) if self.hasTransparentField(): valTransparentField = Value() if self.transparentField is not None: valTransparentField.setBool(self.transparentField) else: valTransparentField.setEmpty() tagValueList.push(("transparent-field", "http://qwilt.com/model/family"), valTransparentField) if self.hasId(): valId = Value() if self.id is not None: valId.setString(self.id) else: valId.setEmpty() tagValueList.push(("id", "http://qwilt.com/model/family"), valId) if self.hasHasTail(): valHasTail = Value() if self.hasTail is not None: valHasTail.setBool(self.hasTail) else: valHasTail.setEmpty() tagValueList.push(("has-tail", "http://qwilt.com/model/family"), valHasTail) 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.hasQueueThresholdLow(): valQueueThresholdLow = Value() if self.queueThresholdLow is not None: valQueueThresholdLow.setInt64(self.queueThresholdLow) else: valQueueThresholdLow.setEmpty() tagValueList.push(("queue-threshold-low", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-content-line"), valQueueThresholdLow) if self.hasQueueThresholdHigh(): valQueueThresholdHigh = Value() if self.queueThresholdHigh is not None: valQueueThresholdHigh.setInt64(self.queueThresholdHigh) else: valQueueThresholdHigh.setEmpty() tagValueList.push(("queue-threshold-high", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-content-line"), valQueueThresholdHigh) if self.hasQueueSize(): valQueueSize = Value() if self.queueSize is not None: valQueueSize.setInt64(self.queueSize) else: valQueueSize.setEmpty() tagValueList.push(("queue-size", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-content-line"), valQueueSize) 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.hasTestTimeoutMsec(): valTestTimeoutMsec = Value() if self.testTimeoutMsec is not None: valTestTimeoutMsec.setInt64(self.testTimeoutMsec) else: valTestTimeoutMsec.setEmpty() tagValueList.push( ("test-timeout-msec", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-interfaces"), valTestTimeoutMsec) if self.hasTestIntervalMsec(): valTestIntervalMsec = Value() if self.testIntervalMsec is not None: valTestIntervalMsec.setInt64(self.testIntervalMsec) else: valTestIntervalMsec.setEmpty() tagValueList.push( ("test-interval-msec", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-interfaces"), valTestIntervalMsec) if self.hasUpPeriod(): valUpPeriod = Value() if self.upPeriod is not None: valUpPeriod.setInt64(self.upPeriod) else: valUpPeriod.setEmpty() tagValueList.push( ("up-period", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-interfaces"), valUpPeriod) if self.hasDownPeriod(): valDownPeriod = Value() if self.downPeriod is not None: valDownPeriod.setInt64(self.downPeriod) else: valDownPeriod.setEmpty() tagValueList.push( ("down-period", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-interfaces"), valDownPeriod) 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.hasEmployed(): valEmployed = Value() if self.employed is not None: valEmployed.setBool(self.employed) else: valEmployed.setEmpty() tagValueList.push(( "employed", "http://qwilt.com/ns/yang/ut/sys/blinky/example/python/list-example" ), valEmployed) if self.hasName(): valName = Value() if self.name is not None: valName.setString(self.name) else: valName.setEmpty() tagValueList.push(( "name", "http://qwilt.com/ns/yang/ut/sys/blinky/example/python/list-example" ), valName) if self.hasHeight(): valHeight = Value() if self.height is not None: valHeight.setInt64(self.height) else: valHeight.setEmpty() tagValueList.push(( "height", "http://qwilt.com/ns/yang/ut/sys/blinky/example/python/list-example" ), valHeight) 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.hasEstimatedDeliveryTrxPerConnection(): valEstimatedDeliveryTrxPerConnection = Value() if self.estimatedDeliveryTrxPerConnection is not None: valEstimatedDeliveryTrxPerConnection.setInt64(self.estimatedDeliveryTrxPerConnection) else: valEstimatedDeliveryTrxPerConnection.setEmpty() tagValueList.push(("estimated-delivery-trx-per-connection", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-content-line"), valEstimatedDeliveryTrxPerConnection) if self.hasSimulatedDiskSizeGb(): valSimulatedDiskSizeGb = Value() if self.simulatedDiskSizeGb is not None: valSimulatedDiskSizeGb.setInt64(self.simulatedDiskSizeGb) else: valSimulatedDiskSizeGb.setEmpty() tagValueList.push(("simulated-disk-size-gb", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-content-line"), valSimulatedDiskSizeGb) if self.hasDeliveryMaxActiveConnections(): valDeliveryMaxActiveConnections = Value() if self.deliveryMaxActiveConnections is not None: valDeliveryMaxActiveConnections.setInt64(self.deliveryMaxActiveConnections) else: valDeliveryMaxActiveConnections.setEmpty() tagValueList.push(("delivery-max-active-connections", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-content-line"), valDeliveryMaxActiveConnections) 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.hasDeliveryMaxBwMbps(): valDeliveryMaxBwMbps = Value() if self.deliveryMaxBwMbps is not None: valDeliveryMaxBwMbps.setInt64(self.deliveryMaxBwMbps) else: valDeliveryMaxBwMbps.setEmpty() tagValueList.push(("delivery-max-bw-mbps", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-content-line"), valDeliveryMaxBwMbps) return ReturnCodes.kOk