def _fillReadTagValues (self, tagValueList): self.myInitGuard.isInitOrCrash() for logFunc in self._log('fill-read-tag-values').debug3Func(): logFunc('called: tagValueList=%s', tagValueList) if self.isDefaultGatewayRequested(): valDefaultGateway = Value() valDefaultGateway.setEmpty() tagValueList.push(("default-gateway", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-interfaces"), valDefaultGateway) if self.addressListObj: valBegin = Value() (tag, ns, prefix) = ("address" , "http://qwilt.com/ns/yang/device/tech/qwilt-tech-interfaces", "qt-if") valBegin.setXmlBegin((tag, ns, prefix)) tagValueList.push((tag, ns), valBegin) tagValueListLen = tagValueList.getLen() res = self.addressListObj._fillReadTagValues(tagValueList) if res != ReturnCodes.kOk: for logFunc in self._log('fill-read-tag-values-address-failed').errorFunc(): logFunc('addressListObj._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 _fillReadTagValues (self, tagValueList): self.myInitGuard.isInitOrCrash() for logFunc in self._log('fill-read-tag-values').debug3Func(): logFunc('called: tagValueList=%s', tagValueList) if self.orderedListListObj: valBegin = Value() (tag, ns, prefix) = ("ordered-list" , "http://qwilt.com/model/lake-example", "lake-example") valBegin.setXmlBegin((tag, ns, prefix)) tagValueList.push((tag, ns), valBegin) tagValueListLen = tagValueList.getLen() res = self.orderedListListObj._fillReadTagValues(tagValueList) if res != ReturnCodes.kOk: for logFunc in self._log('fill-read-tag-values-ordered-list-failed').errorFunc(): logFunc('orderedListListObj._fillReadTagValues() failed. PARAMS') return ReturnCodes.kGeneralError if tagValueList.getLen() == tagValueListLen: # descendant didn't add anything, no need to read it. tagValueList.pop() else: valEnd = Value() valEnd.setXmlEnd((tag, ns, prefix)) tagValueList.push((tag, ns), valEnd) return ReturnCodes.kOk
def _fillWriteTagValues (self, tagValueList): self.myInitGuard.isInitOrCrash() for logFunc in self._log('fill-write-tag-values').debug3Func(): logFunc('called: tagValueList=%s', tagValueList) for key in self.kids.keys(): if self.kids[key]: valBegin = Value() (tag, ns, prefix) = ("kid", "http://qwilt.com/model/family", "family") valBegin.setXmlBegin((tag, ns, prefix)) tagValueList.push((tag, ns), valBegin) valKey = Value() valKey.setString(key) tagValueList.push(("name", "http://qwilt.com/model/family"), valKey) tagValueListLen = tagValueList.getLen() res = self.kids[key]._fillWriteTagValues(tagValueList) if res != ReturnCodes.kOk: for logFunc in self._log('fill-write-tag-values-kid-failed').errorFunc(): logFunc('kid._fillWriteTagValues() failed. key=%s', key) return ReturnCodes.kGeneralError if tagValueList.getLen() == tagValueListLen: # descendant didn't add anything, no need to read it. tagValueList.pop() tagValueList.pop() else: valEnd = Value() valEnd.setXmlEnd((tag, ns, prefix)) tagValueList.push((tag, ns), valEnd) return ReturnCodes.kOk
def _fillReadTagValues (self, tagValueList): self.myInitGuard.isInitOrCrash() for logFunc in self._log('fill-read-tag-values').debug3Func(): logFunc('called: tagValueList=%s', tagValueList) if self.isHeightRequested(): valHeight = Value() valHeight.setEmpty() tagValueList.push(("height", "http://qwilt.com/model/room"), valHeight) if self.partListObj: valBegin = Value() (tag, ns, prefix) = ("parts" , "http://qwilt.com/model/room", "room") valBegin.setXmlBegin((tag, ns, prefix)) tagValueList.push((tag, ns), valBegin) tagValueListLen = tagValueList.getLen() res = self.partListObj._fillReadTagValues(tagValueList) if res != ReturnCodes.kOk: for logFunc in self._log('fill-read-tag-values-parts-failed').errorFunc(): logFunc('partListObj._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 _fillReadTagValues (self, tagValueList): self.myInitGuard.isInitOrCrash() for logFunc in self._log('fill-read-tag-values').debug3Func(): logFunc('called: tagValueList=%s', tagValueList) if self.isEnabledRequested(): valEnabled = Value() valEnabled.setEmpty() tagValueList.push(("enabled", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-content-line"), valEnabled) if self.controllerObj: valBegin = Value() (tag, ns, prefix) = ("controller" , "http://qwilt.com/ns/yang/device/tech/qwilt-tech-content-line", "qtc-line") valBegin.setXmlBegin((tag, ns, prefix)) tagValueList.push((tag, ns), valBegin) tagValueListLen = tagValueList.getLen() res = self.controllerObj._fillReadTagValues(tagValueList) if res != ReturnCodes.kOk: for logFunc in self._log('fill-read-tag-values-controller-failed').errorFunc(): logFunc('controllerObj._fillReadTagValues() failed. PARAMS') return ReturnCodes.kGeneralError if tagValueList.getLen() == tagValueListLen: # descendant didn't add anything, no need to read it. tagValueList.pop() else: valEnd = Value() valEnd.setXmlEnd((tag, ns, prefix)) tagValueList.push((tag, ns), valEnd) return ReturnCodes.kOk
def _fillReadTagValues (self, tagValueList): self.myInitGuard.isInitOrCrash() for logFunc in self._log('fill-read-tag-values').debug3Func(): logFunc('called: tagValueList=%s', tagValueList) for key in self.hosts.keys(): if self.hosts[key]: valBegin = Value() (tag, ns, prefix) = ("host", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-system", "qt-sys") valBegin.setXmlBegin((tag, ns, prefix)) tagValueList.push((tag, ns), valBegin) valKey = Value() valKey.setString(key) tagValueList.push(("hostname", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-system"), valKey) tagValueListLen = tagValueList.getLen() res = self.hosts[key]._fillReadTagValues(tagValueList) if res != ReturnCodes.kOk: for logFunc in self._log('fill-read-tag-values-host-failed').errorFunc(): logFunc('host._fillReadTagValues() failed. key=%s', key) return ReturnCodes.kGeneralError if tagValueList.getLen() == tagValueListLen: # descendant didn't add anything, no need to read it. tagValueList.pop() tagValueList.pop() else: valEnd = Value() valEnd.setXmlEnd((tag, ns, prefix)) tagValueList.push((tag, ns), valEnd) return ReturnCodes.kOk
def _fillReadTagValues (self, tagValueList): self.myInitGuard.isInitOrCrash() for logFunc in self._log('fill-read-tag-values').debug3Func(): logFunc('called: tagValueList=%s', tagValueList) 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 _fillWriteTagValues (self, tagValueList): self.myInitGuard.isInitOrCrash() for logFunc in self._log('fill-write-tag-values').debug3Func(): logFunc('called: tagValueList=%s', tagValueList) if self.lllListObj: valBegin = Value() (tag, ns, prefix) = ("lll" , "http://qwilt.com/model/benchmark", "bnch") valBegin.setXmlBegin((tag, ns, prefix)) tagValueList.push((tag, ns), valBegin) tagValueListLen = tagValueList.getLen() res = self.lllListObj._fillWriteTagValues(tagValueList) if res != ReturnCodes.kOk: for logFunc in self._log('fill-write-tag-values-lll-failed').errorFunc(): logFunc('lllListObj._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.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 _fillReadTagValues (self, tagValueList): self.myInitGuard.isInitOrCrash() for logFunc in self._log('fill-read-tag-values').debug3Func(): logFunc('called: tagValueList=%s', tagValueList) if self.destinationListObj: valBegin = Value() (tag, ns, prefix) = ("destination" , "http://qwilt.com/ns/yang/device/tech/qwilt-tech-snmp", "qt-snmp") valBegin.setXmlBegin((tag, ns, prefix)) tagValueList.push((tag, ns), valBegin) tagValueListLen = tagValueList.getLen() res = self.destinationListObj._fillReadTagValues(tagValueList) if res != ReturnCodes.kOk: for logFunc in self._log('fill-read-tag-values-destination-failed').errorFunc(): logFunc('destinationListObj._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 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 _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 _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 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 fillTagValuesOpD (self, keyPath, tagValueList, operData): initialListSize = tagValueList.getLen() for logFunc in self._log("fill-tag-values-opd").debug3Func(): logFunc("called. operData=%s, keyPath=%s, initialListSize=%d", operData.debugStr(True), keyPath, initialListSize) if operData.isOpDRequested() and operData.hasOpD(): valBegin = Value() valBegin.setXmlBegin("op-d", "http://qwilt.com/model/oper", "oper") tagValueList.push(("op-d", "http://qwilt.com/model/oper"), valBegin) res = self.myOpD.fillTagValues(keyPath, tagValueList, operData.myOpD) if res != ReturnCodes.kOk: for logFunc in self._log("fill-tag-values-opd-my-internal-failed").errorFunc(): logFunc( "myOpD->fillTagValues() failed. operData=%s, keyPath=%s, initialListSize=%d, tagValueList.getLen()=%d", operData.debugStr(True), keyPath, initialListSize, tagValueList.getLen()) while tagValueList.getLen() > initialListSize: tagValueList.pop() return ReturnCodes.kGeneralError if tagValueList.getLen() == (initialListSize+1): # no values were added by opd - rollback the xmltag added tagValueList.pop() else: valEnd = Value() valEnd.setXmlEnd("op-d", "http://qwilt.com/model/oper", "oper") tagValueList.push(("op-d", "http://qwilt.com/model/oper"), valEnd) for logFunc in self._log("fill-tag-values-opd-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.applicationInitiatedDiscoveryObj: valBegin = Value() (tag, ns, prefix) = ("application-initiated-discovery" , "http://qwilt.com/ns/yang/device/tech/qwilt-tech-network-ipv6", "qt-net-ip6") valBegin.setXmlBegin((tag, ns, prefix)) tagValueList.push((tag, ns), valBegin) tagValueListLen = tagValueList.getLen() res = self.applicationInitiatedDiscoveryObj._fillWriteTagValues(tagValueList) if res != ReturnCodes.kOk: for logFunc in self._log('fill-write-tag-values-application-initiated-discovery-failed').errorFunc(): logFunc('applicationInitiatedDiscoveryObj._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.hasHostname(): valHostname = Value() if self.hostname is not None: valHostname.setString(self.hostname) else: valHostname.setEmpty() tagValueList.push(("hostname", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-system"), valHostname) if self.systemDefaultsObj: valBegin = Value() (tag, ns, prefix) = ("system-defaults" , "http://qwilt.com/ns/yang/device/tech/qwilt-tech-system", "qt-sys") 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.nameResolutionObj: valBegin = Value() (tag, ns, prefix) = ("name-resolution" , "http://qwilt.com/ns/yang/device/tech/qwilt-tech-system", "qt-sys") valBegin.setXmlBegin((tag, ns, prefix)) tagValueList.push((tag, ns), valBegin) tagValueListLen = tagValueList.getLen() res = self.nameResolutionObj._fillWriteTagValues(tagValueList) if res != ReturnCodes.kOk: for logFunc in self._log('fill-write-tag-values-name-resolution-failed').errorFunc(): logFunc('nameResolutionObj._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"), valEnabled) if self.nameServersObj: valBegin = Value() (tag, ns, prefix) = ("name-servers" , "http://qwilt.com/ns/yang/device/tech/qwilt-tech-system", "qt-sys") valBegin.setXmlBegin((tag, ns, prefix)) tagValueList.push((tag, ns), valBegin) tagValueListLen = tagValueList.getLen() res = self.nameServersObj._fillWriteTagValues(tagValueList) if res != ReturnCodes.kOk: for logFunc in self._log('fill-write-tag-values-name-servers-failed').errorFunc(): logFunc('nameServersObj._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.searchListObj: valBegin = Value() (tag, ns, prefix) = ("search" , "http://qwilt.com/ns/yang/device/tech/qwilt-tech-system", "qt-sys") valBegin.setXmlBegin((tag, ns, prefix)) tagValueList.push((tag, ns), valBegin) tagValueListLen = tagValueList.getLen() res = self.searchListObj._fillWriteTagValues(tagValueList) if res != ReturnCodes.kOk: for logFunc in self._log('fill-write-tag-values-search-failed').errorFunc(): logFunc('searchListObj._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.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) if self.ipv4Obj: valBegin = Value() (tag, ns, prefix) = ("ipv4" , "http://qwilt.com/ns/yang/device/tech/qwilt-tech-content-interfaces", "qtc-if") valBegin.setXmlBegin((tag, ns, prefix)) tagValueList.push((tag, ns), valBegin) tagValueListLen = tagValueList.getLen() res = self.ipv4Obj._fillWriteTagValues(tagValueList) if res != ReturnCodes.kOk: for logFunc in self._log('fill-write-tag-values-ipv4-failed').errorFunc(): logFunc('ipv4Obj._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.ipv6Obj: valBegin = Value() (tag, ns, prefix) = ("ipv6" , "http://qwilt.com/ns/yang/device/tech/qwilt-tech-content-interfaces", "qtc-if") valBegin.setXmlBegin((tag, ns, prefix)) tagValueList.push((tag, ns), valBegin) tagValueListLen = tagValueList.getLen() res = self.ipv6Obj._fillWriteTagValues(tagValueList) if res != ReturnCodes.kOk: for logFunc in self._log('fill-write-tag-values-ipv6-failed').errorFunc(): logFunc('ipv6Obj._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.hasDummy(): valDummy = Value() if self.dummy is not None: valDummy.setBool(self.dummy) else: valDummy.setEmpty() tagValueList.push(("dummy", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-log"), valDummy) if self.thresholdsObj: valBegin = Value() (tag, ns, prefix) = ("thresholds" , "http://qwilt.com/ns/yang/device/tech/qwilt-tech-log", "qt-log") 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) if self.countersObj: valBegin = Value() (tag, ns, prefix) = ("counters" , "http://qwilt.com/ns/yang/device/tech/qwilt-tech-log", "qt-log") valBegin.setXmlBegin((tag, ns, prefix)) tagValueList.push((tag, ns), valBegin) tagValueListLen = tagValueList.getLen() res = self.countersObj._fillWriteTagValues(tagValueList) if res != ReturnCodes.kOk: for logFunc in self._log('fill-write-tag-values-counters-failed').errorFunc(): logFunc('countersObj._fillWriteTagValues() failed. PARAMS') return ReturnCodes.kGeneralError if tagValueList.getLen() == tagValueListLen: # descendant didn't add anything, no need to read it. tagValueList.pop() else: valEnd = Value() valEnd.setXmlEnd((tag, ns, prefix)) tagValueList.push((tag, ns), valEnd) return ReturnCodes.kOk
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.isCommandWarningTimeoutsRequested() and operData.hasCommandWarningTimeouts(): val = Value() val.setInt64(operData.commandWarningTimeouts) tagValueList.push(("command-warning-timeouts", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-platform-manager"), val) if operData.isCommandErrorsRequested() and operData.hasCommandErrors(): val = Value() val.setInt64(operData.commandErrors) tagValueList.push(("command-errors", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-platform-manager"), val) if operData.isFileErrorsRequested() and operData.hasFileErrors(): val = Value() val.setInt64(operData.fileErrors) tagValueList.push(("file-errors", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-platform-manager"), val) if operData.isReadsRequested() and operData.hasReads(): val = Value() val.setInt64(operData.reads) tagValueList.push(("reads", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-platform-manager"), val) if operData.isParsingErrorsRequested() and operData.hasParsingErrors(): val = Value() val.setInt64(operData.parsingErrors) tagValueList.push(("parsing-errors", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-platform-manager"), val) if operData.isCommandTimeoutsRequested() and operData.hasCommandTimeouts(): val = Value() val.setInt64(operData.commandTimeouts) tagValueList.push(("command-timeouts", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-platform-manager"), 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.isUuidRequested() and operData.hasUuid(): val = Value() val.setString(operData.uuid) tagValueList.push(("uuid", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-storage-disk"), val) if operData.isOperationalStatusRequested() and operData.hasOperationalStatus(): val = Value() val.setEnum(operData.operationalStatus.getValue()) tagValueList.push(("operational-status", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-storage-disk"), val) if operData.isFileSystemTypeRawRequested() and operData.hasFileSystemTypeRaw(): val = Value() val.setString(operData.fileSystemTypeRaw) tagValueList.push(("file-system-type-raw", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-storage-disk"), val) if operData.isFileSystemTypeRequested() and operData.hasFileSystemType(): val = Value() val.setEnum(operData.fileSystemType.getValue()) tagValueList.push(("file-system-type", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-storage-disk"), val) if operData.isExpectedUuidRequested() and operData.hasExpectedUuid(): val = Value() val.setString(operData.expectedUuid) tagValueList.push(("expected-uuid", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-storage-disk"), val) if operData.isOperationalStatusReasonRequested() and operData.hasOperationalStatusReason(): val = Value() val.setEnum(operData.operationalStatusReason.getValue()) tagValueList.push(("operational-status-reason", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-storage-disk"), val) if self.myKeyPath.isEqualLen(keyPath, keyPath.getLen()): i = self.myKeyPath.getLen() - 1 while i >= keyPath.getLen(): valEnd = Value() (tag, ns, prefix) = self.myKeyPath.getAt(i).asXmlTag() valEnd.setXmlEnd((tag, ns, prefix)) tagValueList.push((tag, ns), valEnd) i-=1 for logFunc in self._log("fill-tag-values-ended").debug3Func(): logFunc("ended. operData=%s, keyPath=%s, initialListSize=%d, finalListSize=%d", operData.debugStr(True), keyPath, initialListSize, tagValueList.getLen()) return ReturnCodes.kOk
def 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.isSilentDroppedPacketsRequested() and operData.hasSilentDroppedPackets(): val = Value() val.setInt64(operData.silentDroppedPackets) tagValueList.push(("silent-dropped-packets", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-snmp"), val) if operData.isInPacketsRequested() and operData.hasInPackets(): val = Value() val.setInt64(operData.inPackets) tagValueList.push(("in-packets", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-snmp"), val) if operData.isInBadVersionPacketsRequested() and operData.hasInBadVersionPackets(): val = Value() val.setInt64(operData.inBadVersionPackets) tagValueList.push(("in-bad-version-packets", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-snmp"), val) if operData.isInBadCommunityUsePacketsRequested() and operData.hasInBadCommunityUsePackets(): val = Value() val.setInt64(operData.inBadCommunityUsePackets) tagValueList.push(("in-bad-community-use-packets", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-snmp"), val) if operData.isInAsnParseErrorsRequested() and operData.hasInAsnParseErrors(): val = Value() val.setInt64(operData.inAsnParseErrors) tagValueList.push(("in-asn-parse-errors", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-snmp"), val) if operData.isInBadCommunityPacketsRequested() and operData.hasInBadCommunityPackets(): val = Value() val.setInt64(operData.inBadCommunityPackets) tagValueList.push(("in-bad-community-packets", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-snmp"), val) if self.myKeyPath.isEqualLen(keyPath, keyPath.getLen()): i = self.myKeyPath.getLen() - 1 while i >= keyPath.getLen(): valEnd = Value() (tag, ns, prefix) = self.myKeyPath.getAt(i).asXmlTag() valEnd.setXmlEnd((tag, ns, prefix)) tagValueList.push((tag, ns), valEnd) i-=1 for logFunc in self._log("fill-tag-values-ended").debug3Func(): logFunc("ended. operData=%s, keyPath=%s, initialListSize=%d, finalListSize=%d", operData.debugStr(True), keyPath, initialListSize, tagValueList.getLen()) return ReturnCodes.kOk
def _fillReadTagValues (self, tagValueList): self.myInitGuard.isInitOrCrash() for logFunc in self._log('fill-read-tag-values').debug3Func(): logFunc('called: tagValueList=%s', tagValueList) if self.isOpValueBRequested(): valOpValueB = Value() valOpValueB.setEmpty() tagValueList.push(("op-value-b", "http://qwilt.com/model/oper"), valOpValueB) if self.opCListObj: valBegin = Value() (tag, ns, prefix) = ("op-c" , "http://qwilt.com/model/oper", "oper") valBegin.setXmlBegin((tag, ns, prefix)) tagValueList.push((tag, ns), valBegin) tagValueListLen = tagValueList.getLen() res = self.opCListObj._fillReadTagValues(tagValueList) if res != ReturnCodes.kOk: for logFunc in self._log('fill-read-tag-values-op-c-failed').errorFunc(): logFunc('opCListObj._fillReadTagValues() failed. PARAMS') return ReturnCodes.kGeneralError if tagValueList.getLen() == tagValueListLen: # descendant didn't add anything, no need to read it. tagValueList.pop() else: valEnd = Value() valEnd.setXmlEnd((tag, ns, prefix)) tagValueList.push((tag, ns), valEnd) if self.opDObj: valBegin = Value() (tag, ns, prefix) = ("op-d" , "http://qwilt.com/model/oper", "oper") valBegin.setXmlBegin((tag, ns, prefix)) tagValueList.push((tag, ns), valBegin) tagValueListLen = tagValueList.getLen() res = self.opDObj._fillReadTagValues(tagValueList) if res != ReturnCodes.kOk: for logFunc in self._log('fill-read-tag-values-op-d-failed').errorFunc(): logFunc('opDObj._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 _fillReadTagValues (self, tagValueList): self.myInitGuard.isInitOrCrash() for logFunc in self._log('fill-read-tag-values').debug3Func(): logFunc('called: tagValueList=%s', tagValueList) if self.isTimezoneRequested(): valTimezone = Value() valTimezone.setEmpty() tagValueList.push(("timezone", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-system-clock"), valTimezone) if self.statusObj: valBegin = Value() (tag, ns, prefix) = ("status" , "http://qwilt.com/ns/yang/device/tech/qwilt-tech-system-clock", "qt-sys-clock") valBegin.setXmlBegin((tag, ns, prefix)) tagValueList.push((tag, ns), valBegin) tagValueListLen = tagValueList.getLen() res = self.statusObj._fillReadTagValues(tagValueList) if res != ReturnCodes.kOk: for logFunc in self._log('fill-read-tag-values-status-failed').errorFunc(): logFunc('statusObj._fillReadTagValues() failed. PARAMS') return ReturnCodes.kGeneralError if tagValueList.getLen() == tagValueListLen: # descendant didn't add anything, no need to read it. tagValueList.pop() else: valEnd = Value() valEnd.setXmlEnd((tag, ns, prefix)) tagValueList.push((tag, ns), valEnd) if self.systemDefaultsObj: valBegin = Value() (tag, ns, prefix) = ("system-defaults" , "http://qwilt.com/ns/yang/device/tech/qwilt-tech-system-clock", "qt-sys-clock") valBegin.setXmlBegin((tag, ns, prefix)) tagValueList.push((tag, ns), valBegin) tagValueListLen = tagValueList.getLen() res = self.systemDefaultsObj._fillReadTagValues(tagValueList) if res != ReturnCodes.kOk: for logFunc in self._log('fill-read-tag-values-system-defaults-failed').errorFunc(): logFunc('systemDefaultsObj._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 _fillReadTagValues (self, tagValueList): self.myInitGuard.isInitOrCrash() for logFunc in self._log('fill-read-tag-values').debug3Func(): logFunc('called: tagValueList=%s', tagValueList) if self.isAutoInitRequested(): valAutoInit = Value() valAutoInit.setEmpty() tagValueList.push(("auto-init", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-storage-disk"), valAutoInit) if self.isOsDeviceRequested(): valOsDevice = Value() valOsDevice.setEmpty() tagValueList.push(("os-device", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-storage-disk"), valOsDevice) if self.isImplementationRequested(): valImplementation = Value() valImplementation.setEmpty() tagValueList.push(("implementation", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-storage-disk"), valImplementation) if self.isRaidTypeRequested(): valRaidType = Value() valRaidType.setEmpty() tagValueList.push(("raid-type", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-storage-disk"), valRaidType) if self.isNameRequested(): valName = Value() valName.setEmpty() tagValueList.push(("name", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-storage-disk"), valName) if self.statusObj: valBegin = Value() (tag, ns, prefix) = ("status" , "http://qwilt.com/ns/yang/device/tech/qwilt-tech-storage-disk", "qt-strg-dsk") valBegin.setXmlBegin((tag, ns, prefix)) tagValueList.push((tag, ns), valBegin) tagValueListLen = tagValueList.getLen() res = self.statusObj._fillReadTagValues(tagValueList) if res != ReturnCodes.kOk: for logFunc in self._log('fill-read-tag-values-status-failed').errorFunc(): logFunc('statusObj._fillReadTagValues() failed. PARAMS') return ReturnCodes.kGeneralError if tagValueList.getLen() == tagValueListLen: # descendant didn't add anything, no need to read it. tagValueList.pop() else: valEnd = Value() valEnd.setXmlEnd((tag, ns, prefix)) tagValueList.push((tag, ns), valEnd) return ReturnCodes.kOk
def _fillWriteTagValues (self, tagValueList): self.myInitGuard.isInitOrCrash() for logFunc in self._log('fill-write-tag-values').debug3Func(): logFunc('called: tagValueList=%s', tagValueList) if self.hasType_(): valType_ = Value() if self.type_ is not None: valType_.setEnum(self.type_.getValue()) else: valType_.setEmpty() tagValueList.push(("type", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-content-line"), valType_) if self.hasEnabled(): valEnabled = Value() if self.enabled is not None: valEnabled.setBool(self.enabled) else: valEnabled.setEmpty() tagValueList.push(("enabled", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-content-line"), valEnabled) if self.hasName(): valName = Value() if self.name is not None: valName.setString(self.name) else: valName.setEmpty() tagValueList.push(("name", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-content-line"), valName) if self.systemDefaultsObj: valBegin = Value() (tag, ns, prefix) = ("system-defaults" , "http://qwilt.com/ns/yang/device/tech/qwilt-tech-content-line", "qtc-line") valBegin.setXmlBegin((tag, ns, prefix)) tagValueList.push((tag, ns), valBegin) tagValueListLen = tagValueList.getLen() res = self.systemDefaultsObj._fillWriteTagValues(tagValueList) if res != ReturnCodes.kOk: for logFunc in self._log('fill-write-tag-values-system-defaults-failed').errorFunc(): logFunc('systemDefaultsObj._fillWriteTagValues() failed. PARAMS') return ReturnCodes.kGeneralError if tagValueList.getLen() == tagValueListLen: # descendant didn't add anything, no need to read it. tagValueList.pop() else: valEnd = Value() valEnd.setXmlEnd((tag, ns, prefix)) tagValueList.push((tag, ns), valEnd) return ReturnCodes.kOk
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 _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 _fillReadTagValues(self, tagValueList): self.myInitGuard.isInitOrCrash() for logFunc in self._log('fill-read-tag-values').debug3Func(): logFunc('called: tagValueList=%s', tagValueList) if self.isMuteReportingRequested(): valMuteReporting = Value() valMuteReporting.setEmpty() tagValueList.push(( "mute-reporting", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-platform-fans" ), valMuteReporting) if self.isLocationRequested(): valLocation = Value() 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._fillReadTagValues(tagValueList) if res != ReturnCodes.kOk: for logFunc in self._log( 'fill-read-tag-values-device-failed').errorFunc(): logFunc('deviceObj._fillReadTagValues() failed. PARAMS') return ReturnCodes.kGeneralError if tagValueList.getLen() == tagValueListLen: # descendant didn't add anything, no need to read it. tagValueList.pop() else: valEnd = Value() valEnd.setXmlEnd((tag, ns, prefix)) tagValueList.push((tag, ns), valEnd) if self.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._fillReadTagValues(tagValueList) if res != ReturnCodes.kOk: for logFunc in self._log( 'fill-read-tag-values-simulation-failed').errorFunc(): logFunc( 'simulationObj._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 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 fillTagValues(self, keyPath, tagValueList, operData): initialListSize = tagValueList.getLen() for logFunc in self._log("fill-tag-values").debug3Func(): logFunc("called. operData=%s, keyPath=%s, initialListSize=%d", operData.debugStr(True), keyPath, initialListSize) # fill tag values up to current if self.myKeyPath.isEqualLen(keyPath, keyPath.getLen()): i = keyPath.getLen() while i < self.myKeyPath.getLen(): valBegin = Value() (tag, ns, prefix) = self.myKeyPath.getAt(i).asXmlTag() valBegin.setXmlBegin((tag, ns, prefix)) tagValueList.push((tag, ns), valBegin) for logFunc in self._log( "fill-tag-values-adding").debug3Func(): logFunc( "adding xml begin. i=%d, valBegin=%s, self.myKeyPath.getLen()=%d", i, valBegin, self.myKeyPath.getLen()) i += 1 if operData.isReportsQueueGettingFullReasonRequested( ) and operData.hasReportsQueueGettingFullReason(): val = Value() val.setEnum(operData.reportsQueueGettingFullReason.getValue()) tagValueList.push(( "reports-queue-getting-full-reason", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-content-reporting" ), val) if operData.isReportsQueueGettingFullRequested( ) and operData.hasReportsQueueGettingFull(): val = Value() val.setBool(operData.reportsQueueGettingFull) tagValueList.push(( "reports-queue-getting-full", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-content-reporting" ), val) if operData.isReportsQueueFullReasonRequested( ) and operData.hasReportsQueueFullReason(): val = Value() val.setEnum(operData.reportsQueueFullReason.getValue()) tagValueList.push(( "reports-queue-full-reason", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-content-reporting" ), val) if operData.isReportsQueueFullRequested( ) and operData.hasReportsQueueFull(): val = Value() val.setBool(operData.reportsQueueFull) tagValueList.push(( "reports-queue-full", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-content-reporting" ), val) if self.myKeyPath.isEqualLen(keyPath, keyPath.getLen()): i = self.myKeyPath.getLen() - 1 while i >= keyPath.getLen(): valEnd = Value() (tag, ns, prefix) = self.myKeyPath.getAt(i).asXmlTag() valEnd.setXmlEnd((tag, ns, prefix)) tagValueList.push((tag, ns), valEnd) i -= 1 for logFunc in self._log("fill-tag-values-ended").debug3Func(): logFunc( "ended. operData=%s, keyPath=%s, initialListSize=%d, finalListSize=%d", operData.debugStr(True), keyPath, initialListSize, tagValueList.getLen()) return ReturnCodes.kOk