A class to handle ULong64 return values in Java
Published May 30, 2007
Version 1.0Was this article helpful?
from iControl import CommonULong64
class UsefulU64(object):
def __init__(self,ulong=CommonULong64()):
self.ulong=ulong
self.value=0
high=ulong.getHigh()
low=ulong.getLow()
rollOver = 0x7fffffff
rollOver += 1
tmpVal=0
if(high >=0):
tmpVal = high << 32 & 0xffff0000
else:
tmpVal = ((high & 0x7fffffff) << 32) + (0x80000000 << 32)
if(low >=0):
tmpVal = tmpVal + low
else:
tmpVal = tmpVal + (low & 0x7fffffff) + rollOver
self.value=tmpVal
def __str__(self):
size = ""
value=self.value
if(value / 1024 >= 1.0):
size = "K"
value = value / 1024
if(value / 1024 >= 1.0):
size = "M"
value = value / 1024
if(value / 1024 >= 1.0):
size = "G"
value = value / 1024
return "%.2f%s"%(value,size)
if __name__ == "__main__":
import iControl
ic=iControl.Interfaces()
ic.initialize("10.1.1.245","admin","admin")
result=ic.localLBPool.get_all_statistics()
stats=result.statistics
print "Pool name: %s"%stats[0].pool_name
print "Stats type: %s"%stats[0].statistics[0].type
value=stats[0].statistics[0].value
print "Stat value: %s"%UsefulU64(value)