def _getSelfKeyPath (self, kid , toys , junkForTemplate): for logFunc in self._log('get-self-key-path').debug3Func(): logFunc('called. PARAMS, junkForTemplate=%s', junkForTemplate) keyPath = KeyPath() ancestorVal = Value() ancestorVal.setString(toys); keyPath.addKeyPathPrefix(ancestorVal) xmlVal = Value() xmlVal.setXmlTag(("toys", "http://qwilt.com/model/family", "family")) keyPath.addKeyPathPrefix(xmlVal) ancestorVal = Value() ancestorVal.setString(kid); keyPath.addKeyPathPrefix(ancestorVal) xmlVal = Value() xmlVal.setXmlTag(("kid", "http://qwilt.com/model/family", "family")) 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) 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 _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(("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 _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
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 _getSelfKeyPath (self, lll , junkForTemplate): for logFunc in self._log('get-self-key-path').debug3Func(): logFunc('called. PARAMS, junkForTemplate=%s', junkForTemplate) keyPath = KeyPath() xmlVal = Value() xmlVal.setXmlTag(("bbb", "http://qwilt.com/model/benchmark", "bnch")) keyPath.addKeyPathPrefix(xmlVal) ancestorVal = Value() ancestorVal.setString(lll); keyPath.addKeyPathPrefix(ancestorVal) xmlVal = Value() xmlVal.setXmlTag(("lll", "http://qwilt.com/model/benchmark", "bnch")) keyPath.addKeyPathPrefix(xmlVal) xmlVal = Value() xmlVal.setXmlTag(("base", "http://qwilt.com/model/benchmark", "bnch")) 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, destination , junkForTemplate): for logFunc in self._log('get-self-key-path').debug3Func(): logFunc('called. PARAMS, junkForTemplate=%s', junkForTemplate) keyPath = KeyPath() ancestorVal = Value() ancestorVal.setString(destination); keyPath.addKeyPathPrefix(ancestorVal) xmlVal = Value() xmlVal.setXmlTag(("destination", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-snmp", "qt-snmp")) keyPath.addKeyPathPrefix(xmlVal) xmlVal = Value() xmlVal.setXmlTag(("notifications", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-snmp", "qt-snmp")) keyPath.addKeyPathPrefix(xmlVal) xmlVal = Value() xmlVal.setXmlTag(("snmp", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-snmp", "qt-snmp")) 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, loggerClass , instance , junkForTemplate): for logFunc in self._log('get-self-key-path').debug3Func(): logFunc('called. PARAMS, junkForTemplate=%s', junkForTemplate) keyPath = KeyPath() 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 _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.kids.keys(): if self.kids[key]: res = self.kids[key]._collectItemsToDelete( key, itemsToDelete) if res != ReturnCodes.kOk: for logFunc in self._log('collect-items-to-delete-kid-failed').errorFunc(): logFunc('kidObj._collectItemsToDelete() failed. key=%s. PARAMS', key) return ReturnCodes.kGeneralError else: keyPath = self._getSelfKeyPath( None) xmlVal = Value() xmlVal.setXmlTag(("kid", "http://qwilt.com/model/family", "family")) keyPath.addKeyPathPostfix(xmlVal) valKey = Value() valKey.setString(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) 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 _getSelfKeyPath (self, module , 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-storage-module", "qt-strg-module")) keyPath.addKeyPathPrefix(xmlVal) ancestorVal = Value() ancestorVal.setString(module); keyPath.addKeyPathPrefix(ancestorVal) xmlVal = Value() xmlVal.setXmlTag(("module", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-storage-module", "qt-strg-module")) 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 _collectItemsToDelete (self, ipv4, itemsToDelete): self.myInitGuard.isInitOrCrash() for logFunc in self._log('collect-items-to-delete').debug3Func(): logFunc('called: itemsToDelete=%s. PARAMS', itemsToDelete) for key in self.hosts.keys(): if self.hosts[key]: res = self.hosts[key]._collectItemsToDelete(ipv4, key, itemsToDelete) if res != ReturnCodes.kOk: for logFunc in self._log('collect-items-to-delete-host-failed').errorFunc(): logFunc('hostObj._collectItemsToDelete() failed. key=%s. PARAMS', key) return ReturnCodes.kGeneralError else: 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) valKey = Value() valKey.setString(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 setElement (self, trxContext, keyPath, newValue): self._log("set-element").debug2("called. trxContext=%s, keyPath=%s, newValue=%s", trxContext, keyPath, newValue) entryName = keyPath.getAt(keyPath.getLen()-2).asString() valLeafTag = keyPath.getAt(keyPath.getLen()-1).asXmlTag() self._log("set-element-details").debug2("read details: entry-name=%s, valLeafTag=%s. trxContext=%s, keyPath=%s, newValue=%s", entryName, valLeafTag, trxContext, keyPath, newValue) doWrite = False tagValueList = TagValues() if valLeafTag[0] == "contact": valContact = Value() valContact.setString(newValue.asString()) tagValueList.push(("sysContact", "http://tail-f.com/ns/mibs/SNMPv2-MIB/200210160000Z"), valContact) doWrite = True elif valLeafTag[0] == "location": valLocation = Value() valLocation.setString(newValue.asString()) tagValueList.push(("sysLocation", "http://tail-f.com/ns/mibs/SNMPv2-MIB/200210160000Z"), valLocation) doWrite = True if doWrite: res = self._maapiDomain.writeMaapi(tagValueList, self._keyPathSnmpV2, trxContext) if res != ReturnCodes.kOk: self._log('set-element-domain-failed').error('self._maapiDomain.writeMaapi() failed. PARAMS') 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.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 createSecToGroupTableEntry (self, trxContext, securityModel, securityName): self._log("create-sec-to-group-table-entry").debug2("called. trxContext=%s, securityModel=%s, securityName=%s", trxContext, securityModel, securityName) """ create an entry with the securityName in SNMP-VIEW-BASED-ACM-MIB vacmSecurityToGroupTable vacmSecurityToGroupEntry set vacmSecurityModel to securityModel set vacmSecurityName to securityName set vacmGroupName to notif-only """ self._log("create-sec-to-group-table-entry").debug2("called. trxContext=%s, securityModel=%s, securityName=%s", trxContext, securityModel, securityName) targetKeyPath = KeyPath() valVacm = Value() (tag, ns, prefix) = ("SNMP-VIEW-BASED-ACM-MIB", "http://tail-f.com/ns/mibs/SNMP-VIEW-BASED-ACM-MIB/200210160000Z", "SNMP_VIEW_BASED_ACM_MIB") valVacm.setXmlTag((tag, ns, prefix)) targetKeyPath.addKeyPathPostfix(valVacm) tagValueList = TagValues() valVacmSecToGroupTable = Value() (tag, ns, prefix) = ("vacmSecurityToGroupTable", "http://tail-f.com/ns/mibs/SNMP-VIEW-BASED-ACM-MIB/200210160000Z", "SNMP_VIEW_BASED_ACM_MIB") valVacmSecToGroupTable.setXmlBegin((tag, ns, prefix)) tagValueList.push((tag, ns), valVacmSecToGroupTable) valBegin = Value() (tag, ns, prefix) = ("vacmSecurityToGroupEntry", "http://tail-f.com/ns/mibs/SNMP-VIEW-BASED-ACM-MIB/200210160000Z", "SNMP_VIEW_BASED_ACM_MIB") valBegin.setXmlBegin((tag, ns, prefix)) tagValueList.push((tag, ns), valBegin) valKeyModel = Value() valKeyModel.setInt32(securityModel) tagValueList.push(("vacmSecurityModel", "http://tail-f.com/ns/mibs/SNMP-VIEW-BASED-ACM-MIB/200210160000Z"), valKeyModel) valKeySecName = Value() valKeySecName.setString(securityName) tagValueList.push(("vacmSecurityName", "http://tail-f.com/ns/mibs/SNMP-VIEW-BASED-ACM-MIB/200210160000Z"), valKeySecName) # vacmGroupName to notif-only valGroupName = Value() valGroupName.setString(self.AC_NOTIF_ONLY) tagValueList.push(("vacmGroupName", "http://tail-f.com/ns/mibs/SNMP-VIEW-BASED-ACM-MIB/200210160000Z"), valGroupName) valEnd = Value() valEnd.setXmlEnd((tag, ns, prefix)) tagValueList.push((tag, ns), valEnd) valTargetParamTable = Value() (tag, ns, prefix) = ("vacmSecurityToGroupTable","http://tail-f.com/ns/mibs/SNMP-VIEW-BASED-ACM-MIB/200210160000Z", "SNMP_VIEW_BASED_ACM_MIB") valTargetParamTable.setXmlEnd((tag, ns, prefix)) tagValueList.push((tag, ns), valTargetParamTable) res = self._maapiDomain.writeMaapi(tagValueList, targetKeyPath, trxContext) if res != ReturnCodes.kOk: self._log('create-sec-to-group-table-entry-write-domain-failed').error('self._maapiDomain.writeMaapi() failed. PARAMS') return ReturnCodes.kGeneralError self._log("create-sec-to-group-table-entry-done").debug2("done. trxContext=%s, securityModel=%s, securityName=%s", trxContext, securityModel, securityName) return ReturnCodes.kOk
def _getSelfKeyPath (self, lake , fish_ , junkForTemplate): for logFunc in self._log('get-self-key-path').debug3Func(): logFunc('called. PARAMS, junkForTemplate=%s', junkForTemplate) keyPath = KeyPath() xmlVal = Value() xmlVal.setXmlTag(("mood", "http://qwilt.com/model/lake-example", "lake-example")) keyPath.addKeyPathPrefix(xmlVal) ancestorVal = Value() ancestorVal.setString(fish_); keyPath.addKeyPathPrefix(ancestorVal) xmlVal = Value() xmlVal.setXmlTag(("fish", "http://qwilt.com/model/lake-example", "lake-example")) keyPath.addKeyPathPrefix(xmlVal) ancestorVal = Value() ancestorVal.setString(lake); keyPath.addKeyPathPrefix(ancestorVal) xmlVal = Value() xmlVal.setXmlTag(("lake", "http://qwilt.com/model/lake-example", "lake-example")) keyPath.addKeyPathPrefix(xmlVal) for logFunc in self._log('get-self-key-path-done').debug3Func(): logFunc('done. keyPath=%s. PARAMS', keyPath) return keyPath
def removeTargetParamTableEntry (self, trxContext, entryName): self._log("remove-target-param-table-entry").debug2("called. trxContext=%s, entryName=%s", trxContext, entryName) pathToDelete = 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)) pathToDelete.addKeyPathPostfix(valTarget) valTargetAddrTable = Value() (tag, ns, prefix) = ("snmpTargetParamsTable","http://tail-f.com/ns/mibs/SNMP-TARGET-MIB/200210140000Z", "SNMP_TARGET_MIB") valTargetAddrTable.setXmlTag((tag, ns, prefix)) pathToDelete.addKeyPathPostfix(valTargetAddrTable) valEntry = Value() (tag, ns, prefix) = ("snmpTargetParamsEntry", "http://tail-f.com/ns/mibs/SNMP-TARGET-MIB/200210140000Z", "SNMP_TARGET_MIB") valEntry.setXmlTag((tag, ns, prefix)) pathToDelete.addKeyPathPostfix(valEntry) valKey = Value() valKey.setString(entryName) pathToDelete.addKeyPathPostfix(valKey) res = self._maapiDomain.writeMaapi(None, None, trxContext, itemsToDelete=[pathToDelete]) if res != ReturnCodes.kOk: self._log('remove-domain-failed').error('self._maapiDomain.writeMaapi() failed. PARAMS') return ReturnCodes.kGeneralError self._log("remove-target-addr-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.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 _fillWriteTagValues (self, tagValueList): self.myInitGuard.isInitOrCrash() for logFunc in self._log('fill-write-tag-values').debug3Func(): logFunc('called: tagValueList=%s', tagValueList) if self.hasId(): valId = Value() if self.id is not None: valId.setString(self.id) else: valId.setEmpty() tagValueList.push(("id", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-system-alarms"), valId) if self.hasName(): valName = Value() if self.name is not None: valName.setEnum(self.name.getValue()) else: valName.setEmpty() tagValueList.push(("name", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-system-alarms"), valName) if self.hasEntity(): valEntity = Value() if self.entity is not None: valEntity.setString(self.entity) else: valEntity.setEmpty() tagValueList.push(("entity", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-system-alarms"), valEntity) return ReturnCodes.kOk
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 _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(("counters", "http://qwilt.com/ns/yang/ut/sys/blinky/example/python/oper-example", "oe")) keyPath.addKeyPathPrefix(xmlVal) 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 _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.aliens.keys(): if self.aliens[key]: res = self.aliens[key]._collectItemsToDelete( key, itemsToDelete) if res != ReturnCodes.kOk: for logFunc in self._log('collect-items-to-delete-alien-failed').errorFunc(): logFunc('alienObj._collectItemsToDelete() failed. key=%s. PARAMS', key) return ReturnCodes.kGeneralError else: 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) valKey = Value() valKey.setString(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, zone , junkForTemplate): for logFunc in self._log('get-self-key-path').debug3Func(): logFunc('called. PARAMS, junkForTemplate=%s', junkForTemplate) keyPath = KeyPath() ancestorVal = Value() ancestorVal.setString(zone); keyPath.addKeyPathPrefix(ancestorVal) xmlVal = Value() xmlVal.setXmlTag(("zone", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-content", "qtc")) keyPath.addKeyPathPrefix(xmlVal) xmlVal = Value() xmlVal.setXmlTag(("zones", "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, linux_ , variableCollection , junkForTemplate): for logFunc in self._log('get-self-key-path').debug3Func(): logFunc('called. PARAMS, junkForTemplate=%s', junkForTemplate) keyPath = KeyPath() ancestorVal = Value() ancestorVal.setString(variableCollection); keyPath.addKeyPathPrefix(ancestorVal) xmlVal = Value() xmlVal.setXmlTag(("variable-collection", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-linux-variables", "qt-lnx-variables")) keyPath.addKeyPathPrefix(xmlVal) 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 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, opV , junkForTemplate): for logFunc in self._log('get-self-key-path').debug3Func(): logFunc('called. PARAMS, junkForTemplate=%s', junkForTemplate) keyPath = KeyPath() xmlVal = Value() xmlVal.setXmlTag(("op-y", "http://qwilt.com/model/oper", "oper")) keyPath.addKeyPathPrefix(xmlVal) 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 _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 _getSelfKeyPath (self, source , junkForTemplate): for logFunc in self._log('get-self-key-path').debug3Func(): logFunc('called. PARAMS, junkForTemplate=%s', junkForTemplate) keyPath = KeyPath() 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 _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, line, itemsToDelete): self.myInitGuard.isInitOrCrash() for logFunc in self._log('collect-items-to-delete').debug3Func(): logFunc('called: itemsToDelete=%s. PARAMS', itemsToDelete) for key in self.queueGroups.keys(): if self.queueGroups[key]: res = self.queueGroups[key]._collectItemsToDelete(line, key, itemsToDelete) if res != ReturnCodes.kOk: for logFunc in self._log('collect-items-to-delete-queueGroup-failed').errorFunc(): logFunc('queueGroupObj._collectItemsToDelete() failed. key=%s. PARAMS', key) return ReturnCodes.kGeneralError else: keyPath = self._getSelfKeyPath(line, None) xmlVal = Value() xmlVal.setXmlTag(("queue-group", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-content-line", "qtc-line")) keyPath.addKeyPathPostfix(xmlVal) valKey = Value() valKey.setString(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 fillTagValues(self, keyPath, tagValueList, operData): initialListSize = tagValueList.getLen() for logFunc in self._log("fill-tag-values").debug3Func(): logFunc("called. operData=%s, keyPath=%s, initialListSize=%d", operData.debugStr(True), keyPath, initialListSize) # fill tag values up to current if self.myKeyPath.isEqualLen(keyPath, keyPath.getLen()): i = keyPath.getLen() while i < self.myKeyPath.getLen(): valBegin = Value() (tag, ns, prefix) = self.myKeyPath.getAt(i).asXmlTag() valBegin.setXmlBegin((tag, ns, prefix)) tagValueList.push((tag, ns), valBegin) for logFunc in self._log( "fill-tag-values-adding").debug3Func(): logFunc( "adding xml begin. i=%d, valBegin=%s, self.myKeyPath.getLen()=%d", i, valBegin, self.myKeyPath.getLen()) i += 1 if operData.isPhysicalIdListRequested() and operData.hasPhysicalIdList( ): val = Value() val.setString(operData.physicalIdList) tagValueList.push( ("physical-id-list", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-storage-disk" ), val) if operData.isStatusRequested() and operData.hasStatus(): val = Value() val.setEnum(operData.status.getValue()) tagValueList.push( ("status", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-storage-disk" ), val) if operData.isStateRawRequested() and operData.hasStateRaw(): val = Value() val.setString(operData.stateRaw) tagValueList.push( ("state-raw", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-storage-disk" ), val) if operData.isReadPolicyRequested() and operData.hasReadPolicy(): val = Value() val.setString(operData.readPolicy) tagValueList.push( ("read-policy", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-storage-disk" ), val) if operData.isBadBlocksRequested() and operData.hasBadBlocks(): val = Value() val.setBool(operData.badBlocks) tagValueList.push( ("bad-blocks", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-storage-disk" ), val) if operData.isMediaTypeRequested() and operData.hasMediaType(): val = Value() val.setString(operData.mediaType) tagValueList.push( ("media-type", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-storage-disk" ), val) if operData.isHotSparePolicyViolationRequested( ) and operData.hasHotSparePolicyViolation(): val = Value() val.setString(operData.hotSparePolicyViolation) tagValueList.push( ("hot-spare-policy-violation", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-storage-disk" ), val) if operData.isIdRequested() and operData.hasId(): val = Value() val.setString(operData.id) tagValueList.push( ("id", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-storage-disk" ), val) if operData.isStateRequested() and operData.hasState(): val = Value() val.setEnum(operData.state.getValue()) tagValueList.push( ("state", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-storage-disk" ), val) if operData.isStatusRawRequested() and operData.hasStatusRaw(): val = Value() val.setString(operData.statusRaw) tagValueList.push( ("status-raw", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-storage-disk" ), val) if operData.isDiskCachePolicyRequested( ) and operData.hasDiskCachePolicy(): val = Value() val.setString(operData.diskCachePolicy) tagValueList.push( ("disk-cache-policy", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-storage-disk" ), val) if operData.isBadBlocksRawRequested() and operData.hasBadBlocksRaw(): val = Value() val.setString(operData.badBlocksRaw) tagValueList.push( ("bad-blocks-raw", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-storage-disk" ), val) if operData.isCachePolicyRequested() and operData.hasCachePolicy(): val = Value() val.setString(operData.cachePolicy) tagValueList.push( ("cache-policy", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-storage-disk" ), val) if operData.isWritePolicyRequested() and operData.hasWritePolicy(): val = Value() val.setString(operData.writePolicy) tagValueList.push( ("write-policy", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-storage-disk" ), val) if operData.isRaidTypeRequested() and operData.hasRaidType(): val = Value() val.setString(operData.raidType) tagValueList.push( ("raid-type", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-storage-disk" ), val) if operData.isStripeElementSizeRequested( ) and operData.hasStripeElementSize(): val = Value() val.setString(operData.stripeElementSize) tagValueList.push( ("stripe-element-size", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-storage-disk" ), val) if operData.isSizeRawRequested() and operData.hasSizeRaw(): val = Value() val.setString(operData.sizeRaw) tagValueList.push( ("size-raw", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-storage-disk" ), val) if operData.isSizeRequested() and operData.hasSize(): val = Value() val.setInt64(operData.size) tagValueList.push( ("size", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-storage-disk" ), val) if self.myKeyPath.isEqualLen(keyPath, keyPath.getLen()): i = self.myKeyPath.getLen() - 1 while i >= keyPath.getLen(): valEnd = Value() (tag, ns, prefix) = self.myKeyPath.getAt(i).asXmlTag() valEnd.setXmlEnd((tag, ns, prefix)) tagValueList.push((tag, ns), valEnd) i -= 1 for logFunc in self._log("fill-tag-values-ended").debug3Func(): logFunc( "ended. operData=%s, keyPath=%s, initialListSize=%d, finalListSize=%d", operData.debugStr(True), keyPath, initialListSize, tagValueList.getLen()) return ReturnCodes.kOk
def s_create(cls, logger, interface, domain): __pychecker__ = "no-argsused" logger('s-create-blinkydelivery').info( 'called. domain=%s, _validationPointId=%s, _actionPointId=%s', domain, BlinkyDelivery._validationPointId, BlinkyDelivery._actionPointId) confd_key = KeyPath() xmlVal = Value() xmlVal.setXmlTag(( "delivery", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-content-interfaces", "qtc-if")) confd_key.addKeyPathPrefix(xmlVal) xmlVal = Value() xmlVal.setXmlTag(( "system-defaults", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-content-interfaces", "qtc-if")) confd_key.addKeyPathPrefix(xmlVal) ancestorVal = Value() ancestorVal.setString(interface) confd_key.addKeyPathPrefix(ancestorVal) xmlVal = Value() xmlVal.setXmlTag(( "interface", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-content-interfaces", "qtc-if")) confd_key.addKeyPathPrefix(xmlVal) xmlVal = Value() xmlVal.setXmlTag(( "interfaces", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-content-interfaces", "qtc-if")) confd_key.addKeyPathPrefix(xmlVal) xmlVal = Value() xmlVal.setXmlTag( ("content", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-content", "qtc")) confd_key.addKeyPathPrefix(xmlVal) xmlVal = Value() xmlVal.setXmlTag( ("tech", "http://qwilt.com/ns/yang/device/tech/qwilt-tech", "qt")) confd_key.addKeyPathPrefix(xmlVal) newNode = BlinkyDelivery(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, disk, domain): __pychecker__="no-argsused" logger('s-create-blinkytimeouts').info('called. domain=%s, _validationPointId=%s, _actionPointId=%s', domain, BlinkyTimeouts._validationPointId, BlinkyTimeouts._actionPointId) confd_key=KeyPath() xmlVal = Value() xmlVal.setXmlTag(("timeouts", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-storage-disk", "qt-strg-dsk")) confd_key.addKeyPathPrefix(xmlVal) xmlVal = Value() xmlVal.setXmlTag(("file-system", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-storage-disk", "qt-strg-dsk")) confd_key.addKeyPathPrefix(xmlVal) ancestorVal = Value() ancestorVal.setString(disk); confd_key.addKeyPathPrefix(ancestorVal) xmlVal = Value() xmlVal.setXmlTag(("disk", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-storage-disk", "qt-strg-dsk")) confd_key.addKeyPathPrefix(xmlVal) xmlVal = Value() xmlVal.setXmlTag(("storage", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-storage", "qt-strg")) confd_key.addKeyPathPrefix(xmlVal) xmlVal = Value() xmlVal.setXmlTag(("tech", "http://qwilt.com/ns/yang/device/tech/qwilt-tech", "qt")) confd_key.addKeyPathPrefix(xmlVal) newNode=BlinkyTimeouts(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.hasIp(): valIp = Value() if self.ip is not None: valIp.setIPv4(self.ip) else: valIp.setEmpty() tagValueList.push(("ip", "http://qwilt.com/model/family"), valIp) 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/family"), valName) if self.sizeObj: valBegin = Value() (tag, ns, prefix) = ("size" , "http://qwilt.com/model/family", "family") valBegin.setXmlBegin((tag, ns, prefix)) tagValueList.push((tag, ns), valBegin) tagValueListLen = tagValueList.getLen() res = self.sizeObj._fillWriteTagValues(tagValueList) if res != ReturnCodes.kOk: for logFunc in self._log('fill-write-tag-values-size-failed').errorFunc(): logFunc('sizeObj._fillWriteTagValues() failed. PARAMS') return ReturnCodes.kGeneralError if tagValueList.getLen() == tagValueListLen: # descendant didn't add anything, no need to read it. tagValueList.pop() else: valEnd = Value() valEnd.setXmlEnd((tag, ns, prefix)) tagValueList.push((tag, ns), valEnd) if self.toysListObj: valBegin = Value() (tag, ns, prefix) = ("toys" , "http://qwilt.com/model/family", "family") valBegin.setXmlBegin((tag, ns, prefix)) tagValueList.push((tag, ns), valBegin) tagValueListLen = tagValueList.getLen() res = self.toysListObj._fillWriteTagValues(tagValueList) if res != ReturnCodes.kOk: for logFunc in self._log('fill-write-tag-values-toys-failed').errorFunc(): logFunc('toysListObj._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.hasEyeNumber(): valEyeNumber = Value() if self.eyeNumber is not None: valEyeNumber.setInt64(self.eyeNumber) else: valEyeNumber.setEmpty() tagValueList.push(("eye-number", "http://qwilt.com/model/room"), 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/room"), 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/room"), 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/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._fillWriteTagValues(tagValueList) if res != ReturnCodes.kOk: for logFunc in self._log('fill-write-tag-values-antenna-failed').errorFunc(): logFunc('antennaObj._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.isStatusRequested() and operData.hasStatus(): val = Value() val.setEnum(operData.status.getValue()) tagValueList.push(( "status", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-platform-temperature" ), val) if operData.isIndexRequested() and operData.hasIndex(): val = Value() val.setString(operData.index) tagValueList.push(( "index", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-platform-temperature" ), val) if operData.isTemperatureRawRequested() and operData.hasTemperatureRaw( ): val = Value() val.setString(operData.temperatureRaw) tagValueList.push(( "temperature-raw", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-platform-temperature" ), val) if operData.isMaximumCriticalRawRequested( ) and operData.hasMaximumCriticalRaw(): val = Value() val.setString(operData.maximumCriticalRaw) tagValueList.push(( "maximum-critical-raw", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-platform-temperature" ), val) if operData.isMaximumWarningRawRequested( ) and operData.hasMaximumWarningRaw(): val = Value() val.setString(operData.maximumWarningRaw) tagValueList.push(( "maximum-warning-raw", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-platform-temperature" ), val) if operData.isMinimumWarningRawRequested( ) and operData.hasMinimumWarningRaw(): val = Value() val.setString(operData.minimumWarningRaw) tagValueList.push(( "minimum-warning-raw", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-platform-temperature" ), val) if operData.isMinimumCriticalRawRequested( ) and operData.hasMinimumCriticalRaw(): val = Value() val.setString(operData.minimumCriticalRaw) tagValueList.push(( "minimum-critical-raw", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-platform-temperature" ), val) if operData.isProbeNameRequested() and operData.hasProbeName(): val = Value() val.setString(operData.probeName) tagValueList.push(( "probe-name", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-platform-temperature" ), val) if operData.isStatusRawRequested() and operData.hasStatusRaw(): val = Value() val.setString(operData.statusRaw) tagValueList.push(( "status-raw", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-platform-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 _fillWriteTagValues(self, tagValueList): self.myInitGuard.isInitOrCrash() for logFunc in self._log('fill-write-tag-values').debug3Func(): logFunc('called: tagValueList=%s', tagValueList) if self.hasName(): valName = Value() if self.name is not None: valName.setString(self.name) else: valName.setEmpty() tagValueList.push( ("name", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-debug"), valName) if self.internalObj: valBegin = Value() (tag, ns, prefix) = ( "internal", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-debug", "qt-debug") valBegin.setXmlBegin((tag, ns, prefix)) tagValueList.push((tag, ns), valBegin) tagValueListLen = tagValueList.getLen() res = self.internalObj._fillWriteTagValues(tagValueList) if res != ReturnCodes.kOk: for logFunc in self._log( 'fill-write-tag-values-internal-failed').errorFunc(): logFunc('internalObj._fillWriteTagValues() failed. PARAMS') return ReturnCodes.kGeneralError if tagValueList.getLen() == tagValueListLen: # descendant didn't add anything, no need to read it. tagValueList.pop() else: valEnd = Value() valEnd.setXmlEnd((tag, ns, prefix)) tagValueList.push((tag, ns), valEnd) if self.destinationListObj: valBegin = Value() (tag, ns, prefix) = ( "destination", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-debug", "qt-debug") valBegin.setXmlBegin((tag, ns, prefix)) tagValueList.push((tag, ns), valBegin) tagValueListLen = tagValueList.getLen() res = self.destinationListObj._fillWriteTagValues(tagValueList) if res != ReturnCodes.kOk: for logFunc in self._log( 'fill-write-tag-values-destination-failed').errorFunc( ): logFunc( 'destinationListObj._fillWriteTagValues() failed. PARAMS' ) return ReturnCodes.kGeneralError if tagValueList.getLen() == tagValueListLen: # descendant didn't add anything, no need to read it. tagValueList.pop() else: valEnd = Value() valEnd.setXmlEnd((tag, ns, prefix)) tagValueList.push((tag, ns), valEnd) if self.systemDefaultsObj: valBegin = Value() (tag, ns, prefix) = ( "system-defaults", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-debug", "qt-debug") valBegin.setXmlBegin((tag, ns, prefix)) tagValueList.push((tag, ns), valBegin) tagValueListLen = tagValueList.getLen() res = self.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) if self.ruleListObj: valBegin = Value() (tag, ns, prefix) = ( "rule", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-debug", "qt-debug") valBegin.setXmlBegin((tag, ns, prefix)) tagValueList.push((tag, ns), valBegin) tagValueListLen = tagValueList.getLen() res = self.ruleListObj._fillWriteTagValues(tagValueList) if res != ReturnCodes.kOk: for logFunc in self._log( 'fill-write-tag-values-rule-failed').errorFunc(): logFunc('ruleListObj._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.hasPostMount(): valPostMount = Value() if self.postMount is not None: valPostMount.setString(self.postMount) else: valPostMount.setEmpty() tagValueList.push(("post-mount", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-storage-disk"), valPostMount) if self.hasPreMountExtras(): valPreMountExtras = Value() if self.preMountExtras is not None: valPreMountExtras.setString(self.preMountExtras) else: valPreMountExtras.setEmpty() tagValueList.push(("pre-mount-extras", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-storage-disk"), valPreMountExtras) if self.hasPreMount(): valPreMount = Value() if self.preMount is not None: valPreMount.setString(self.preMount) else: valPreMount.setEmpty() tagValueList.push(("pre-mount", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-storage-disk"), valPreMount) if self.hasPostMountExtras(): valPostMountExtras = Value() if self.postMountExtras is not None: valPostMountExtras.setString(self.postMountExtras) else: valPostMountExtras.setEmpty() tagValueList.push(("post-mount-extras", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-storage-disk"), valPostMountExtras) if self.hasMkfs(): valMkfs = Value() if self.mkfs is not None: valMkfs.setString(self.mkfs) else: valMkfs.setEmpty() tagValueList.push(("mkfs", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-storage-disk"), valMkfs) if self.hasMkfsExtras(): valMkfsExtras = Value() if self.mkfsExtras is not None: valMkfsExtras.setString(self.mkfsExtras) else: valMkfsExtras.setEmpty() tagValueList.push(("mkfs-extras", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-storage-disk"), valMkfsExtras) if self.hasMountExtras(): valMountExtras = Value() if self.mountExtras is not None: valMountExtras.setString(self.mountExtras) else: valMountExtras.setEmpty() tagValueList.push(("mount-extras", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-storage-disk"), valMountExtras) if self.hasMount(): valMount = Value() if self.mount is not None: valMount.setString(self.mount) else: valMount.setEmpty() tagValueList.push(("mount", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-storage-disk"), valMount) return ReturnCodes.kOk
def s_create (cls, logger, lake, fish_, testGenerationUnderscore, domain): __pychecker__="no-argsused" logger('s-create-blinkytestgenerationunderscore').info('called. domain=%s, _validationPointId=%s, _actionPointId=%s', domain, BlinkyTestGenerationUnderscore._validationPointId, BlinkyTestGenerationUnderscore._actionPointId) confd_key=KeyPath() ancestorVal = Value() ancestorVal.setString(testGenerationUnderscore); confd_key.addKeyPathPrefix(ancestorVal) xmlVal = Value() xmlVal.setXmlTag(("test-generation_underscore", "http://qwilt.com/model/lake-example", "lake-example")) confd_key.addKeyPathPrefix(xmlVal) ancestorVal = Value() ancestorVal.setString(fish_); confd_key.addKeyPathPrefix(ancestorVal) xmlVal = Value() xmlVal.setXmlTag(("fish", "http://qwilt.com/model/lake-example", "lake-example")) confd_key.addKeyPathPrefix(xmlVal) ancestorVal = Value() ancestorVal.setString(lake); confd_key.addKeyPathPrefix(ancestorVal) xmlVal = Value() xmlVal.setXmlTag(("lake", "http://qwilt.com/model/lake-example", "lake-example")) confd_key.addKeyPathPrefix(xmlVal) newNode=BlinkyTestGenerationUnderscore(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.hasExecutable(): valExecutable = Value() if self.executable is not None: valExecutable.setString(self.executable) else: valExecutable.setEmpty() tagValueList.push( ("executable", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-process"), valExecutable) if self.hasShell(): valShell = Value() if self.shell is not None: valShell.setBool(self.shell) else: valShell.setEmpty() tagValueList.push( ("shell", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-process"), valShell) if self.hasExtraArgs(): valExtraArgs = Value() if self.extraArgs is not None: valExtraArgs.setString(self.extraArgs) else: valExtraArgs.setEmpty() tagValueList.push( ("extra-args", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-process"), valExtraArgs) if self.hasArgs(): valArgs = Value() if self.args is not None: valArgs.setString(self.args) else: valArgs.setEmpty() tagValueList.push( ("args", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-process"), valArgs) if self.hasValgrind(): valValgrind = Value() if self.valgrind is not None: valValgrind.setBool(self.valgrind) else: valValgrind.setEmpty() tagValueList.push( ("valgrind", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-process"), valValgrind) 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.hasMuteReporting(): valMuteReporting = Value() if self.muteReporting is not None: valMuteReporting.setBool(self.muteReporting) else: valMuteReporting.setEmpty() tagValueList.push(( "mute-reporting", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-platform-fans" ), valMuteReporting) if self.hasLocation(): valLocation = Value() if self.location is not None: valLocation.setString(self.location) else: valLocation.setEmpty() tagValueList.push(( "location", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-platform-fans" ), valLocation) if self.deviceObj: valBegin = Value() (tag, ns, prefix) = ( "device", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-platform-fans", "qt-pltf-fans") valBegin.setXmlBegin((tag, ns, prefix)) tagValueList.push((tag, ns), valBegin) tagValueListLen = tagValueList.getLen() res = self.deviceObj._fillWriteTagValues(tagValueList) if res != ReturnCodes.kOk: for logFunc in self._log( 'fill-write-tag-values-device-failed').errorFunc(): logFunc('deviceObj._fillWriteTagValues() failed. PARAMS') return ReturnCodes.kGeneralError if tagValueList.getLen() == tagValueListLen: # descendant didn't add anything, no need to read it. tagValueList.pop() else: valEnd = Value() valEnd.setXmlEnd((tag, ns, prefix)) tagValueList.push((tag, ns), valEnd) if self.simulationObj: valBegin = Value() (tag, ns, prefix) = ( "simulation", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-platform-fans", "qt-pltf-fans") valBegin.setXmlBegin((tag, ns, prefix)) tagValueList.push((tag, ns), valBegin) tagValueListLen = tagValueList.getLen() res = self.simulationObj._fillWriteTagValues(tagValueList) if res != ReturnCodes.kOk: for logFunc in self._log( 'fill-write-tag-values-simulation-failed').errorFunc(): logFunc( 'simulationObj._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