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

        
        if self.hasPciDeviceId():
            valPciDeviceId = Value()
            if self.pciDeviceId is not None:
                valPciDeviceId.setString(self.pciDeviceId)
            else:
                valPciDeviceId.setEmpty()
            tagValueList.push(("pci-device-id", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-interfaces"), valPciDeviceId)
        
        if self.hasCountersClearEvent():
            valCountersClearEvent = Value()
            if self.countersClearEvent is not None:
                valCountersClearEvent.setEnum(self.countersClearEvent.getValue())
            else:
                valCountersClearEvent.setEmpty()
            tagValueList.push(("counters-clear-event", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-interfaces"), valCountersClearEvent)
        
        if self.hasPciVendorId():
            valPciVendorId = Value()
            if self.pciVendorId is not None:
                valPciVendorId.setString(self.pciVendorId)
            else:
                valPciVendorId.setEmpty()
            tagValueList.push(("pci-vendor-id", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-interfaces"), valPciVendorId)
        
        if self.hasPciIndex():
            valPciIndex = Value()
            if self.pciIndex is not None:
                valPciIndex.setUint64(self.pciIndex)
            else:
                valPciIndex.setEmpty()
            tagValueList.push(("pci-index", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-interfaces"), valPciIndex)
        
        if self.hasOsName():
            valOsName = Value()
            if self.osName is not None:
                valOsName.setString(self.osName)
            else:
                valOsName.setEmpty()
            tagValueList.push(("os-name", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-interfaces"), valOsName)
        

        

        return ReturnCodes.kOk
Example #2
0
    def fillTagValues(self, keyPath, tagValueList, operData):
        initialListSize = tagValueList.getLen()
        for logFunc in self._log("fill-tag-values").debug3Func():
            logFunc("called. operData=%s, keyPath=%s, initialListSize=%d",
                    operData.debugStr(True), keyPath, initialListSize)
        # fill tag values up to current
        if self.myKeyPath.isEqualLen(keyPath, keyPath.getLen()):
            i = keyPath.getLen()
            while i < self.myKeyPath.getLen():
                valBegin = Value()
                (tag, ns, prefix) = self.myKeyPath.getAt(i).asXmlTag()
                valBegin.setXmlBegin((tag, ns, prefix))
                tagValueList.push((tag, ns), valBegin)
                for logFunc in self._log(
                        "fill-tag-values-adding").debug3Func():
                    logFunc(
                        "adding xml begin. i=%d, valBegin=%s, self.myKeyPath.getLen()=%d",
                        i, valBegin, self.myKeyPath.getLen())
                i += 1

        if operData.isQueueUtilizationPercentRequested(
        ) and operData.hasQueueUtilizationPercent():
            val = Value()
            val.setUint64(operData.queueUtilizationPercent)
            tagValueList.push((
                "queue-utilization-percent",
                "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
Example #3
0
    def fillTagValues (self, keyPath, tagValueList, operData):
        initialListSize = tagValueList.getLen()
        for logFunc in self._log("fill-tag-values").debug3Func(): logFunc("called. operData=%s, keyPath=%s, initialListSize=%d", operData.debugStr(True), keyPath, initialListSize)
        # fill tag values up to current
        if self.myKeyPath.isEqualLen(keyPath, keyPath.getLen()):
            i = keyPath.getLen()
            while i < self.myKeyPath.getLen():
                valBegin = Value()
                (tag, ns, prefix) = self.myKeyPath.getAt(i).asXmlTag()
                valBegin.setXmlBegin((tag, ns, prefix))
                tagValueList.push((tag, ns), valBegin)
                for logFunc in self._log("fill-tag-values-adding").debug3Func(): logFunc("adding xml begin. i=%d, valBegin=%s, self.myKeyPath.getLen()=%d", i, valBegin, self.myKeyPath.getLen())
                i+=1
        
        if operData.isStrTestRequested() and operData.hasStrTest():
            val = Value()
            val.setString(operData.strTest)
            tagValueList.push(("str-test", "http://qwilt.com/ns/yang/ut/sys/blinky/example/python/oper-example"), val)
        
        if operData.isMoodRequested() and operData.hasMood():
            val = Value()
            val.setUint64(operData.mood)
            tagValueList.push(("mood", "http://qwilt.com/ns/yang/ut/sys/blinky/example/python/oper-example"), val)
        
        
        if self.myKeyPath.isEqualLen(keyPath, keyPath.getLen()):
            i = self.myKeyPath.getLen() - 1
            while i >= keyPath.getLen():
                valEnd = Value()
                (tag, ns, prefix) = self.myKeyPath.getAt(i).asXmlTag()
                valEnd.setXmlEnd((tag, ns, prefix))
                tagValueList.push((tag, ns), valEnd)
                i-=1

        for logFunc in self._log("fill-tag-values-ended").debug3Func(): logFunc("ended. operData=%s, keyPath=%s, initialListSize=%d, finalListSize=%d",
                                                  operData.debugStr(True), keyPath, initialListSize, tagValueList.getLen())
        return ReturnCodes.kOk
    def 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.isInterfaceIndexRequested() and operData.hasInterfaceIndex(
        ):
            val = Value()
            val.setUint32(operData.interfaceIndex)
            tagValueList.push(
                ("interface-index",
                 "http://qwilt.com/ns/yang/device/tech/qwilt-tech-interfaces"),
                val)

        if operData.isSpeedMegabitRequested() and operData.hasSpeedMegabit():
            val = Value()
            val.setUint32(operData.speedMegabit)
            tagValueList.push(
                ("speed-megabit",
                 "http://qwilt.com/ns/yang/device/tech/qwilt-tech-interfaces"),
                val)

        if operData.isMibAdminStatusRequested() and operData.hasMibAdminStatus(
        ):
            val = Value()
            val.setEnum(operData.mibAdminStatus.getValue())
            tagValueList.push(
                ("mib-admin-status",
                 "http://qwilt.com/ns/yang/device/tech/qwilt-tech-interfaces"),
                val)

        if operData.isPromiscuousRequested() and operData.hasPromiscuous():
            val = Value()
            val.setEnum(operData.promiscuous.getValue())
            tagValueList.push(
                ("promiscuous",
                 "http://qwilt.com/ns/yang/device/tech/qwilt-tech-interfaces"),
                val)

        if operData.isMibNameRequested() and operData.hasMibName():
            val = Value()
            val.setString(operData.mibName)
            tagValueList.push(
                ("mib-name",
                 "http://qwilt.com/ns/yang/device/tech/qwilt-tech-interfaces"),
                val)

        if operData.isMtuRequested() and operData.hasMtu():
            val = Value()
            val.setInt32(operData.mtu)
            tagValueList.push(
                ("mtu",
                 "http://qwilt.com/ns/yang/device/tech/qwilt-tech-interfaces"),
                val)

        if operData.isCounterDiscontinuityTicksRequested(
        ) and operData.hasCounterDiscontinuityTicks():
            val = Value()
            val.setUint32(operData.counterDiscontinuityTicks)
            tagValueList.push(
                ("counter-discontinuity-ticks",
                 "http://qwilt.com/ns/yang/device/tech/qwilt-tech-interfaces"),
                val)

        if operData.isMibIanaTypeRequested() and operData.hasMibIanaType():
            val = Value()
            val.setEnum(operData.mibIanaType.getValue())
            tagValueList.push(
                ("mib-iana-type",
                 "http://qwilt.com/ns/yang/device/tech/qwilt-tech-interfaces"),
                val)

        if operData.isMibSpeed32BitRequested() and operData.hasMibSpeed32Bit():
            val = Value()
            val.setUint32(operData.mibSpeed32Bit)
            tagValueList.push(
                ("mib-speed-32bit",
                 "http://qwilt.com/ns/yang/device/tech/qwilt-tech-interfaces"),
                val)

        if operData.isSpeedRequested() and operData.hasSpeed():
            val = Value()
            val.setUint64(operData.speed)
            tagValueList.push(
                ("speed",
                 "http://qwilt.com/ns/yang/device/tech/qwilt-tech-interfaces"),
                val)

        if operData.isConnectorPresentRequested(
        ) and operData.hasConnectorPresent():
            val = Value()
            val.setEnum(operData.connectorPresent.getValue())
            tagValueList.push(
                ("connector-present",
                 "http://qwilt.com/ns/yang/device/tech/qwilt-tech-interfaces"),
                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-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 _fillWriteTagValues (self, tagValueList):
        self.myInitGuard.isInitOrCrash()
        for logFunc in self._log('fill-write-tag-values').debug3Func(): logFunc('called: tagValueList=%s', tagValueList)

        
        if self.hasPriority():
            valPriority = Value()
            if self.priority is not None:
                valPriority.setString(self.priority)
            else:
                valPriority.setEmpty()
            tagValueList.push(("priority", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-process"), valPriority)
        
        if self.hasUmask():
            valUmask = Value()
            if self.umask is not None:
                valUmask.setUint64(self.umask)
            else:
                valUmask.setEmpty()
            tagValueList.push(("umask", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-process"), valUmask)
        
        if self.hasAffinity():
            valAffinity = Value()
            if self.affinity is not None:
                valAffinity.setString(self.affinity)
            else:
                valAffinity.setEmpty()
            tagValueList.push(("affinity", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-process"), valAffinity)
        

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

            tagValueListLen = tagValueList.getLen()

            res = self.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)
        
        if self.commandObj:
            valBegin = Value()
            (tag, ns, prefix) = ("command" , "http://qwilt.com/ns/yang/device/tech/qwilt-tech-process", "qt-proc")
            valBegin.setXmlBegin((tag, ns, prefix))
            tagValueList.push((tag, ns), valBegin)

            tagValueListLen = tagValueList.getLen()

            res = self.commandObj._fillWriteTagValues(tagValueList)
            if res != ReturnCodes.kOk:
                for logFunc in self._log('fill-write-tag-values-command-failed').errorFunc(): logFunc('commandObj._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.isInterfaceIndexRequested() and operData.hasInterfaceIndex():
            val = Value()
            val.setUint32(operData.interfaceIndex)
            tagValueList.push(("interface-index", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-interfaces"), val)
        
        if operData.isSpeedMegabitRequested() and operData.hasSpeedMegabit():
            val = Value()
            val.setUint32(operData.speedMegabit)
            tagValueList.push(("speed-megabit", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-interfaces"), val)
        
        if operData.isMibAdminStatusRequested() and operData.hasMibAdminStatus():
            val = Value()
            val.setEnum(operData.mibAdminStatus.getValue())
            tagValueList.push(("mib-admin-status", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-interfaces"), val)
        
        if operData.isPromiscuousRequested() and operData.hasPromiscuous():
            val = Value()
            val.setEnum(operData.promiscuous.getValue())
            tagValueList.push(("promiscuous", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-interfaces"), val)
        
        if operData.isMibNameRequested() and operData.hasMibName():
            val = Value()
            val.setString(operData.mibName)
            tagValueList.push(("mib-name", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-interfaces"), val)
        
        if operData.isMtuRequested() and operData.hasMtu():
            val = Value()
            val.setInt32(operData.mtu)
            tagValueList.push(("mtu", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-interfaces"), val)
        
        if operData.isCounterDiscontinuityTicksRequested() and operData.hasCounterDiscontinuityTicks():
            val = Value()
            val.setUint32(operData.counterDiscontinuityTicks)
            tagValueList.push(("counter-discontinuity-ticks", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-interfaces"), val)
        
        if operData.isMibIanaTypeRequested() and operData.hasMibIanaType():
            val = Value()
            val.setEnum(operData.mibIanaType.getValue())
            tagValueList.push(("mib-iana-type", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-interfaces"), val)
        
        if operData.isMibSpeed32BitRequested() and operData.hasMibSpeed32Bit():
            val = Value()
            val.setUint32(operData.mibSpeed32Bit)
            tagValueList.push(("mib-speed-32bit", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-interfaces"), val)
        
        if operData.isSpeedRequested() and operData.hasSpeed():
            val = Value()
            val.setUint64(operData.speed)
            tagValueList.push(("speed", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-interfaces"), val)
        
        if operData.isConnectorPresentRequested() and operData.hasConnectorPresent():
            val = Value()
            val.setEnum(operData.connectorPresent.getValue())
            tagValueList.push(("connector-present", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-interfaces"), 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-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 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.isOutGratuitousArpPacketsRequested() and operData.hasOutGratuitousArpPackets():
            val = Value()
            val.setUint64(operData.outGratuitousArpPackets)
            tagValueList.push(("out-gratuitous-arp-packets", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-interfaces"), val)
        
        if operData.isOutUnicastPacketsRequested() and operData.hasOutUnicastPackets():
            val = Value()
            val.setUint64(operData.outUnicastPackets)
            tagValueList.push(("out-unicast-packets", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-interfaces"), val)
        
        if operData.isInUnknownProtocolPacketsRequested() and operData.hasInUnknownProtocolPackets():
            val = Value()
            val.setUint64(operData.inUnknownProtocolPackets)
            tagValueList.push(("in-unknown-protocol-packets", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-interfaces"), val)
        
        if operData.isOutDiscardPacketsRequested() and operData.hasOutDiscardPackets():
            val = Value()
            val.setUint64(operData.outDiscardPackets)
            tagValueList.push(("out-discard-packets", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-interfaces"), val)
        
        if operData.isInOctetsRequested() and operData.hasInOctets():
            val = Value()
            val.setUint64(operData.inOctets)
            tagValueList.push(("in-octets", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-interfaces"), val)
        
        if operData.isInErrorPacketsRequested() and operData.hasInErrorPackets():
            val = Value()
            val.setUint64(operData.inErrorPackets)
            tagValueList.push(("in-error-packets", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-interfaces"), val)
        
        if operData.isInPacketsRateRequested() and operData.hasInPacketsRate():
            val = Value()
            val.setUint64(operData.inPacketsRate)
            tagValueList.push(("in-packets-rate", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-interfaces"), val)
        
        if operData.isOutPacketsRequested() and operData.hasOutPackets():
            val = Value()
            val.setUint64(operData.outPackets)
            tagValueList.push(("out-packets", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-interfaces"), val)
        
        if operData.isInDiscardPacketsRequested() and operData.hasInDiscardPackets():
            val = Value()
            val.setUint64(operData.inDiscardPackets)
            tagValueList.push(("in-discard-packets", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-interfaces"), val)
        
        if operData.isInMulticastPacketsRequested() and operData.hasInMulticastPackets():
            val = Value()
            val.setUint64(operData.inMulticastPackets)
            tagValueList.push(("in-multicast-packets", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-interfaces"), val)
        
        if operData.isOutBroadcastPacketsRequested() and operData.hasOutBroadcastPackets():
            val = Value()
            val.setUint64(operData.outBroadcastPackets)
            tagValueList.push(("out-broadcast-packets", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-interfaces"), val)
        
        if operData.isOutOctetsRequested() and operData.hasOutOctets():
            val = Value()
            val.setUint64(operData.outOctets)
            tagValueList.push(("out-octets", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-interfaces"), val)
        
        if operData.isOutMulticastPacketsRequested() and operData.hasOutMulticastPackets():
            val = Value()
            val.setUint64(operData.outMulticastPackets)
            tagValueList.push(("out-multicast-packets", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-interfaces"), val)
        
        if operData.isInUnicastPacketsRequested() and operData.hasInUnicastPackets():
            val = Value()
            val.setUint64(operData.inUnicastPackets)
            tagValueList.push(("in-unicast-packets", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-interfaces"), val)
        
        if operData.isOutErrorPacketsRequested() and operData.hasOutErrorPackets():
            val = Value()
            val.setUint64(operData.outErrorPackets)
            tagValueList.push(("out-error-packets", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-interfaces"), val)
        
        if operData.isOutPacketsRateRequested() and operData.hasOutPacketsRate():
            val = Value()
            val.setUint64(operData.outPacketsRate)
            tagValueList.push(("out-packets-rate", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-interfaces"), val)
        
        if operData.isInPacketsRequested() and operData.hasInPackets():
            val = Value()
            val.setUint64(operData.inPackets)
            tagValueList.push(("in-packets", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-interfaces"), val)
        
        if operData.isOperationalStatusChangesRequested() and operData.hasOperationalStatusChanges():
            val = Value()
            val.setUint64(operData.operationalStatusChanges)
            tagValueList.push(("operational-status-changes", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-interfaces"), val)
        
        if operData.isInBitsRateRequested() and operData.hasInBitsRate():
            val = Value()
            val.setUint64(operData.inBitsRate)
            tagValueList.push(("in-bits-rate", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-interfaces"), val)
        
        if operData.isOutBitsRateRequested() and operData.hasOutBitsRate():
            val = Value()
            val.setUint64(operData.outBitsRate)
            tagValueList.push(("out-bits-rate", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-interfaces"), val)
        
        if operData.isInBroadcastPacketsRequested() and operData.hasInBroadcastPackets():
            val = Value()
            val.setUint64(operData.inBroadcastPackets)
            tagValueList.push(("in-broadcast-packets", "http://qwilt.com/ns/yang/device/tech/qwilt-tech-interfaces"), val)
        
        
        if self.myKeyPath.isEqualLen(keyPath, keyPath.getLen()):
            i = self.myKeyPath.getLen() - 1
            while i >= keyPath.getLen():
                valEnd = Value()
                (tag, ns, prefix) = self.myKeyPath.getAt(i).asXmlTag()
                valEnd.setXmlEnd((tag, ns, prefix))
                tagValueList.push((tag, ns), valEnd)
                i-=1

        for logFunc in self._log("fill-tag-values-ended").debug3Func(): logFunc("ended. operData=%s, keyPath=%s, initialListSize=%d, finalListSize=%d",
                                                  operData.debugStr(True), keyPath, initialListSize, tagValueList.getLen())
        return ReturnCodes.kOk
Example #8
0
    def _fillWriteTagValues(self, tagValueList):
        self.myInitGuard.isInitOrCrash()
        for logFunc in self._log('fill-write-tag-values').debug3Func():
            logFunc('called: tagValueList=%s', tagValueList)

        if self.hasPriority():
            valPriority = Value()
            if self.priority is not None:
                valPriority.setString(self.priority)
            else:
                valPriority.setEmpty()
            tagValueList.push(
                ("priority",
                 "http://qwilt.com/ns/yang/device/tech/qwilt-tech-process"),
                valPriority)

        if self.hasUmask():
            valUmask = Value()
            if self.umask is not None:
                valUmask.setUint64(self.umask)
            else:
                valUmask.setEmpty()
            tagValueList.push(
                ("umask",
                 "http://qwilt.com/ns/yang/device/tech/qwilt-tech-process"),
                valUmask)

        if self.hasAffinity():
            valAffinity = Value()
            if self.affinity is not None:
                valAffinity.setString(self.affinity)
            else:
                valAffinity.setEmpty()
            tagValueList.push(
                ("affinity",
                 "http://qwilt.com/ns/yang/device/tech/qwilt-tech-process"),
                valAffinity)

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

            tagValueListLen = tagValueList.getLen()

            res = self.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)

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

            tagValueListLen = tagValueList.getLen()

            res = self.commandObj._fillWriteTagValues(tagValueList)
            if res != ReturnCodes.kOk:
                for logFunc in self._log(
                        'fill-write-tag-values-command-failed').errorFunc():
                    logFunc('commandObj._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