def _fillWriteTagValues(self, tagValueList): self.myInitGuard.isInitOrCrash() for logFunc in self._log('fill-write-tag-values').debug3Func(): logFunc('called: tagValueList=%s', tagValueList) if self.hasAddress(): valAddress = Value() if self.address is not None: valAddress.setIPv4(self.address) else: valAddress.setEmpty() tagValueList.push( ("address", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-system"), valAddress) 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.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-temperature"), valId) 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.hasPrefix(): valPrefix = Value() if self.prefix is not None: valPrefix.setIPv6Prefix(self.prefix) else: valPrefix.setEmpty() tagValueList.push( ("prefix", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-content"), valPrefix) return ReturnCodes.kOk
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(("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.hasDeliveryInterfaceFailover(): valDeliveryInterfaceFailover = Value() if self.deliveryInterfaceFailover is not None: valDeliveryInterfaceFailover.setBool(self.deliveryInterfaceFailover) else: valDeliveryInterfaceFailover.setEmpty() tagValueList.push(("delivery-interface-failover", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-content"), valDeliveryInterfaceFailover) 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.hasEnabled(): valEnabled = Value() if self.enabled is not None: valEnabled.setBool(self.enabled) else: valEnabled.setEmpty() tagValueList.push( ("enabled", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-content-line" ), valEnabled) return ReturnCodes.kOk
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(("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.hasInstance(): valInstance = Value() if self.instance is not None: valInstance.setString(self.instance) else: valInstance.setEmpty() tagValueList.push( ("instance", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-linux"), valInstance) 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.hasForceOperationalStatus(): valForceOperationalStatus = Value() if self.forceOperationalStatus is not None: valForceOperationalStatus.setEnum(self.forceOperationalStatus.getValue()) else: valForceOperationalStatus.setEmpty() tagValueList.push(("force-operational-status", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-platform-fans"), valForceOperationalStatus) return ReturnCodes.kOk
def _getSelfKeyPath(self, line, unit, junkForTemplate): for logFunc in self._log('get-self-key-path').debug3Func(): logFunc('called. PARAMS, junkForTemplate=%s', junkForTemplate) keyPath = KeyPath() 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
def setDestinationInTargetTableEntry (self, trxContext, entryName, ipAddress): self._log("set-destination-in-target-table-entry").debug2("called. trxContext=%s, entryName=%s", trxContext, entryName) targetKeyPath = KeyPath() valTarget = Value() (tag, ns, prefix) = ("SNMP-TARGET-MIB", "http://tail-f.com/ns/mibs/SNMP-TARGET-MIB/200210140000Z", "SNMP_TARGET_MIB") valTarget.setXmlTag((tag, ns, prefix)) targetKeyPath.addKeyPathPostfix(valTarget) tagValueList = TagValues() valTargetAddrTable = Value() (tag, ns, prefix) = ("snmpTargetAddrTable","http://tail-f.com/ns/mibs/SNMP-TARGET-MIB/200210140000Z", "SNMP_TARGET_MIB") valTargetAddrTable.setXmlBegin((tag, ns, prefix)) tagValueList.push((tag, ns), valTargetAddrTable) valBegin = Value() (tag, ns, prefix) = ("snmpTargetAddrEntry", "http://tail-f.com/ns/mibs/SNMP-TARGET-MIB/200210140000Z", "SNMP_TARGET_MIB") valBegin.setXmlBegin((tag, ns, prefix)) tagValueList.push((tag, ns), valBegin) valKey = Value() valKey.setString(entryName) tagValueList.push(("snmpTargetAddrName", "http://tail-f.com/ns/mibs/SNMP-TARGET-MIB/200210140000Z"), valKey) # snmpTargetAddrTAddress to 0.0.0.0.0.162 valTAddr = Value() addrStr = ipAddress valTAddr.setBinary(addrStr) tagValueList.push(("snmpTargetAddrTAddress", "http://tail-f.com/ns/mibs/SNMP-TARGET-MIB/200210140000Z"), valTAddr) valEnd = Value() valEnd.setXmlEnd((tag, ns, prefix)) tagValueList.push((tag, ns), valEnd) valTargetAddrTable = Value() (tag, ns, prefix) = ("snmpTargetAddrTable","http://tail-f.com/ns/mibs/SNMP-TARGET-MIB/200210140000Z", "SNMP_TARGET_MIB") valTargetAddrTable.setXmlEnd((tag, ns, prefix)) tagValueList.push((tag, ns), valTargetAddrTable) res = self._maapiDomain.writeMaapi(tagValueList, targetKeyPath, trxContext) if res != ReturnCodes.kOk: self._log('get-destination-in-target-table-entry-write-domain-failed').error('self._maapiDomain.writeMaapi() failed. PARAMS') return ReturnCodes.kGeneralError self._log("set-destination-in-target-table-entry-done").debug2("done. trxContext=%s, entryName=%s", trxContext, entryName) 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.hasPreferredDeliveryInterface(): valPreferredDeliveryInterface = Value() if self.preferredDeliveryInterface is not None: valPreferredDeliveryInterface.setString( self.preferredDeliveryInterface) else: valPreferredDeliveryInterface.setEmpty() tagValueList.push(( "preferred-delivery-interface", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-content-interfaces" ), valPreferredDeliveryInterface) return ReturnCodes.kOk
def s_create(cls, logger, domain): __pychecker__ = "no-argsused" logger('s-create-blinkychair').info( 'called. domain=%s, _validationPointId=%s, _actionPointId=%s', domain, BlinkyChair._validationPointId, BlinkyChair._actionPointId) confd_key = KeyPath() xmlVal = Value() xmlVal.setXmlTag(( "chair", "http://qwilt.com/ns/yang/ut/sys/blinky/example/python/simple-example", "se")) confd_key.addKeyPathPrefix(xmlVal) newNode = BlinkyChair(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 _fillReadTagValues (self, tagValueList): self.myInitGuard.isInitOrCrash() for logFunc in self._log('fill-read-tag-values').debug3Func(): logFunc('called: tagValueList=%s', tagValueList) if self.isEyeNumberRequested(): valEyeNumber = Value() valEyeNumber.setEmpty() tagValueList.push(("eye-number", "http://qwilt.com/model/room"), valEyeNumber) if self.isTransparentFieldRequested(): valTransparentField = Value() valTransparentField.setEmpty() tagValueList.push(("transparent-field", "http://qwilt.com/model/room"), valTransparentField) if self.isIdRequested(): valId = Value() valId.setEmpty() tagValueList.push(("id", "http://qwilt.com/model/room"), valId) if self.isHasTailRequested(): valHasTail = Value() valHasTail.setEmpty() tagValueList.push(("has-tail", "http://qwilt.com/model/room"), valHasTail) if self.antennaObj: valBegin = Value() (tag, ns, prefix) = ("antenna" , "http://qwilt.com/model/room", "room") valBegin.setXmlBegin((tag, ns, prefix)) tagValueList.push((tag, ns), valBegin) tagValueListLen = tagValueList.getLen() res = self.antennaObj._fillReadTagValues(tagValueList) if res != ReturnCodes.kOk: for logFunc in self._log('fill-read-tag-values-antenna-failed').errorFunc(): logFunc('antennaObj._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 _getSelfKeyPath(self, loggerClass, instance, 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-debug", "qt-debug")) keyPath.addKeyPathPrefix(xmlVal) ancestorVal = Value() ancestorVal.setString(instance) keyPath.addKeyPathPrefix(ancestorVal) xmlVal = Value() xmlVal.setXmlTag( ("instance", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-debug", "qt-debug")) keyPath.addKeyPathPrefix(xmlVal) ancestorVal = Value() ancestorVal.setString(loggerClass) keyPath.addKeyPathPrefix(ancestorVal) xmlVal = Value() xmlVal.setXmlTag( ("logger-class", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-debug", "qt-debug")) 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 _fillReadTagValues (self, tagValueList): self.myInitGuard.isInitOrCrash() for logFunc in self._log('fill-read-tag-values').debug3Func(): logFunc('called: tagValueList=%s', tagValueList) if self.isErrorCountRequested(): valErrorCount = Value() valErrorCount.setEmpty() tagValueList.push(("error-count", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-system-alarms"), valErrorCount) if self.isEmergencyCountRequested(): valEmergencyCount = Value() valEmergencyCount.setEmpty() tagValueList.push(("emergency-count", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-system-alarms"), valEmergencyCount) if self.isHighestSeverityRequested(): valHighestSeverity = Value() valHighestSeverity.setEmpty() tagValueList.push(("highest-severity", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-system-alarms"), valHighestSeverity) if self.isCriticalCountRequested(): valCriticalCount = Value() valCriticalCount.setEmpty() tagValueList.push(("critical-count", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-system-alarms"), valCriticalCount) if self.isWarningCountRequested(): valWarningCount = Value() valWarningCount.setEmpty() tagValueList.push(("warning-count", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-system-alarms"), valWarningCount) if self.isAlertCountRequested(): valAlertCount = Value() valAlertCount.setEmpty() tagValueList.push(("alert-count", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-system-alarms"), valAlertCount) if self.isNoticeCountRequested(): valNoticeCount = Value() valNoticeCount.setEmpty() tagValueList.push(("notice-count", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-system-alarms"), valNoticeCount) return ReturnCodes.kOk
def _getSelfKeyPath (self, table , fish_ , part , junkForTemplate): for logFunc in self._log('get-self-key-path').debug3Func(): logFunc('called. PARAMS, junkForTemplate=%s', junkForTemplate) keyPath = KeyPath() ancestorVal = Value() ancestorVal.setString(part); keyPath.addKeyPathPrefix(ancestorVal) xmlVal = Value() xmlVal.setXmlTag(("parts", "http://qwilt.com/model/room", "room")) keyPath.addKeyPathPrefix(xmlVal) xmlVal = Value() xmlVal.setXmlTag(("antenna", "http://qwilt.com/model/room", "room")) keyPath.addKeyPathPrefix(xmlVal) ancestorVal = Value() ancestorVal.setString(fish_); keyPath.addKeyPathPrefix(ancestorVal) xmlVal = Value() xmlVal.setXmlTag(("fish", "http://qwilt.com/model/room", "room")) keyPath.addKeyPathPrefix(xmlVal) ancestorVal = Value() ancestorVal.setString(table); keyPath.addKeyPathPrefix(ancestorVal) xmlVal = Value() xmlVal.setXmlTag(("table", "http://qwilt.com/model/room", "room")) 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, interface , junkForTemplate): for logFunc in self._log('get-self-key-path').debug3Func(): logFunc('called. PARAMS, junkForTemplate=%s', junkForTemplate) keyPath = KeyPath() xmlVal = Value() xmlVal.setXmlTag(("status", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-interfaces", "qt-if")) keyPath.addKeyPathPrefix(xmlVal) xmlVal = Value() xmlVal.setXmlTag(("ipv6", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-interfaces", "qt-if")) keyPath.addKeyPathPrefix(xmlVal) xmlVal = Value() xmlVal.setXmlTag(("connectivity-check", "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 _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( ("status", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-network-ipv6", "qt-net-ip6")) keyPath.addKeyPathPrefix(xmlVal) xmlVal = Value() xmlVal.setXmlTag( ("application-initiated-discovery", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-network-ipv6", "qt-net-ip6")) keyPath.addKeyPathPrefix(xmlVal) xmlVal = Value() xmlVal.setXmlTag( ("neighbors", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-network-ipv6", "qt-net-ip6")) keyPath.addKeyPathPrefix(xmlVal) xmlVal = Value() xmlVal.setXmlTag( ("ipv6", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-network-ipv6", "qt-net-ip6")) keyPath.addKeyPathPrefix(xmlVal) xmlVal = Value() xmlVal.setXmlTag( ("network", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-network", "qt-net")) 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, rule , junkForTemplate): for logFunc in self._log('get-self-key-path').debug3Func(): logFunc('called. PARAMS, junkForTemplate=%s', junkForTemplate) keyPath = KeyPath() xmlVal = Value() xmlVal.setXmlTag(("actions", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-content", "qtc")) keyPath.addKeyPathPrefix(xmlVal) 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
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
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.isResultDownRequested() and operData.hasResultDown(): val = Value() val.setInt64(operData.resultDown) tagValueList.push(("result-down", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-interfaces"), val) if operData.isResultUnknownRequested() and operData.hasResultUnknown(): val = Value() val.setInt64(operData.resultUnknown) tagValueList.push(("result-unknown", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-interfaces"), val) if operData.isTestsRequested() and operData.hasTests(): val = Value() val.setInt64(operData.tests) tagValueList.push(("tests", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-interfaces"), val) if operData.isResultUpRequested() and operData.hasResultUp(): val = Value() val.setInt64(operData.resultUp) tagValueList.push(("result-up", "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
def replyElement(self, dpTrxCtx, keyPath, operData): for logFunc in self._log("reply-element").debug3Func(): logFunc("called. dpTrxCtx=%s, operData=%s, keyPath=%s", dpTrxCtx, operData.debugStr(True), keyPath) val = Value() res = self.fillValue(val, keyPath, operData) if res != ReturnCodes.kOk: for logFunc in self._log( "reply-element-fill-value-failed").errorFunc(): logFunc("fillValue() failed. operData=%s, keyPath=%s", operData.debugStr(True), keyPath) return ReturnCodes.kGeneralError res = self.myDomain.sendValue(dpTrxCtx, val) if res != ReturnCodes.kOk: for logFunc in self._log( "reply-element-send-value-failed").errorFunc(): logFunc( "myDomain.sendValue() failed. operData=%s, keyPath=%s, value=%s", operData.debugStr(True), keyPath, val) return ReturnCodes.kGeneralError return ReturnCodes.kOk
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( ("simulation", "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 _getSelfKeyPath(self, process, junkForTemplate): for logFunc in self._log('get-self-key-path').debug3Func(): logFunc('called. PARAMS, junkForTemplate=%s', junkForTemplate) keyPath = KeyPath() xmlVal = Value() xmlVal.setXmlTag( ("temp-memory", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-process", "qt-proc")) keyPath.addKeyPathPrefix(xmlVal) xmlVal = Value() xmlVal.setXmlTag( ("status", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-process", "qt-proc")) keyPath.addKeyPathPrefix(xmlVal) xmlVal = Value() xmlVal.setXmlTag( ("execution", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-process", "qt-proc")) keyPath.addKeyPathPrefix(xmlVal) ancestorVal = Value() ancestorVal.setString(process) keyPath.addKeyPathPrefix(ancestorVal) xmlVal = Value() xmlVal.setXmlTag( ("process", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-process", "qt-proc")) 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, source, junkForTemplate): for logFunc in self._log('get-self-key-path').debug3Func(): logFunc('called. PARAMS, junkForTemplate=%s', junkForTemplate) keyPath = KeyPath() xmlVal = Value() xmlVal.setXmlTag(( "counters", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-platform-manager", "qt-pltf-mngr")) keyPath.addKeyPathPrefix(xmlVal) ancestorVal = Value() ancestorVal.setString(source) keyPath.addKeyPathPrefix(ancestorVal) xmlVal = Value() xmlVal.setXmlTag(( "source", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-platform-manager", "qt-pltf-mngr")) keyPath.addKeyPathPrefix(xmlVal) 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
def _getSelfKeyPath(self, disk, junkForTemplate): for logFunc in self._log('get-self-key-path').debug3Func(): logFunc('called. PARAMS, junkForTemplate=%s', junkForTemplate) keyPath = KeyPath() xmlVal = Value() xmlVal.setXmlTag( ("timeouts", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-storage-disk", "qt-strg-dsk")) keyPath.addKeyPathPrefix(xmlVal) xmlVal = Value() xmlVal.setXmlTag( ("file-system", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-storage-disk", "qt-strg-dsk")) keyPath.addKeyPathPrefix(xmlVal) ancestorVal = Value() ancestorVal.setString(disk) keyPath.addKeyPathPrefix(ancestorVal) xmlVal = Value() xmlVal.setXmlTag( ("disk", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-storage-disk", "qt-strg-dsk")) keyPath.addKeyPathPrefix(xmlVal) xmlVal = Value() xmlVal.setXmlTag( ("storage", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-storage", "qt-strg")) 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, search, junkForTemplate): for logFunc in self._log('get-self-key-path').debug3Func(): logFunc('called. PARAMS, junkForTemplate=%s', junkForTemplate) keyPath = KeyPath() ancestorVal = Value() ancestorVal.setString(search) keyPath.addKeyPathPrefix(ancestorVal) xmlVal = Value() xmlVal.setXmlTag( ("search", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-system", "qt-sys")) keyPath.addKeyPathPrefix(xmlVal) xmlVal = Value() xmlVal.setXmlTag( ("dns", "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
def _fillReadTagValues (self, tagValueList): self.myInitGuard.isInitOrCrash() for logFunc in self._log('fill-read-tag-values').debug3Func(): logFunc('called: tagValueList=%s', tagValueList) if self.isActiveSecondsRequested(): valActiveSeconds = Value() valActiveSeconds.setEmpty() tagValueList.push(("active-seconds", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-log"), valActiveSeconds) if self.isTotalSecondsRequested(): valTotalSeconds = Value() valTotalSeconds.setEmpty() tagValueList.push(("total-seconds", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-log"), valTotalSeconds) if self.isPollsRequested(): valPolls = Value() valPolls.setEmpty() tagValueList.push(("polls", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-log"), valPolls) if self.isPollsMissedRequested(): valPollsMissed = Value() valPollsMissed.setEmpty() tagValueList.push(("polls-missed", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-log"), valPollsMissed) if self.isPollLatencyWarningsRequested(): valPollLatencyWarnings = Value() valPollLatencyWarnings.setEmpty() tagValueList.push(("poll-latency-warnings", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-log"), valPollLatencyWarnings) if self.isPollLatencyErrorsRequested(): valPollLatencyErrors = Value() valPollLatencyErrors.setEmpty() tagValueList.push(("poll-latency-errors", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-log"), valPollLatencyErrors) return ReturnCodes.kOk