Common::ULong64 returning Signed Integers in iControl

Is the documentation correct? I am getting signed values returned from the LocalLB::ProfileClientSSL::get_statistics module using iControl with Powershell. I’ve seen some other posts stating that the High and Low members were actually Signed 32bit Integers (which would not make much sense as they are used to derive into an Unsigned 64bit Integer). What is the correct types and conversion factor.

DevCentral Common::ULong64 iControl :: Common :: ULong64 Introduced : BIG-IP_v9.0 A 64-bit, unsigned integer.

Member Type Description high long The high-order 32-bit unsigned integer.

low long The low-order 32-bit unsigned integer.

The numbers passed back for high and low should be unsigned 32-bit integers. At least that is how they are passed in the SOAP Response. You may have to do some casting in your client language of choice. Which client library are you using?

To be honest, this is the one regret I have with developing iControl way back when. I really wished I would have went with a string for the 64 bit native value. The reason why I went with a high and low 32-bit value was because Java at the time didn’t support 64 bit numbers and since we had a lot of Java customers, we needed a high and low value. I should have added a 3rd value to the struct with the string representation of the number.

-Joe

Thanks so much Joe for the feedback - absolutely tried using the casting to unsigned 32 bit integers before posting the question here. Also, in the mean while I have found that by casting them as uint64 variables is a way to get around the errors as listed bellow. Initial testing looks like the returned values are correct when using that type casting however, I’ll need to do more analysis before declaring that as a valid work around.

PS C:\temp>

(Get-Command "C:\Program Files (x86)\F5 Networks\iControlSnapIn\iControl.dll").FileVersionInfo

ProductVersion FileVersion FileName

11.4.1.0 11.4.1.0 C:\Program Files (x86)\F5 Networks\iControlSnapIn\iControl.dll

PS C:\temp>

$PSVersionTable.PSVersion

Major Minor Build Revision

3 0 -1 -1

-------------------------------------------------------------------------
 function Convert-To-64bit
-------------------------------------------------------------------------
function Convert-To-64bit()
{
  param([uint32]$high, [uint32]$low);
    [uint64]$ResultAs64 = (($high*[Math]::Pow(2,32)) + $low);
  return $ResultAs64;
}

----------------------------------------------------------------------------
function Get-ClientSSL-Stats()
----------------------------------------------------------------------------
{
  param(
    [string]$SSLProfileName,
    [string]$FilePrefix,
    [string]$FileName
  );
    
    $ProfileSSLStats = $(Get-F5.iControl).LocalLBProfileClientSSL.get_statistics((,$SSLProfileName));
    $ProfileStats = $ProfileSSLStats.statistics;
    $ProfileTime = Convert-TimeStamp $ProfileSSLStats.time_stamp;

    foreach($StatEntry in $ProfileStats)
    {
       $ProfileItemStats = $StatEntry.statistics;
       $ProfileName = $StatEntry.profile_name;

       foreach($StatItem in $ProfileItemStats)
       {
           $StatType = $StatItem.type;
           [uint32]$StatHigh = $StatItem.value.high;
           [uint32]$StatLow = $StatItem.value.low;
           $StatValue = Convert-To-64bit $StatHigh $StatLow;

           if ( $FileName.Length -eq 0) 
           {
              Write-Host "$F5LTM, $UsePartition, $ProfileName, $StatType, $StatValue, $ProfileTime";
           }
           else 
           {
              "$F5LTM, $UsePartition, $ProfileName, $StatType, $StatValue, $ProfileTime" | out-file -filepath ($FilePrefix+$FileName) -append -width 500;
           }
       }
    }
}

ERRORS

Line 256: [uint32]$StatLow = $StatItem.value.low;

Cannot convert value “-177651969” to type “System.UInt32”. Error: “Value was either too large or too small for a UInt32.” At C:\Scripts\F5_VipDetails.ps1:256 char:12 + [uint32]$StatLow = $StatItem.value.low; + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : InvalidArgument: (:slight_smile: [], RuntimeException + FullyQualifiedErrorId : InvalidCastIConvertible

Cannot convert value “-754719906” to type “System.UInt32”. Error: “Value was either too large or too small for a UInt32.” At C:\Scripts\F5_VipDetails.ps1:256 char:12 + [uint32]$StatLow = $StatItem.value.low; + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : InvalidArgument: (:slight_smile: [], RuntimeException + FullyQualifiedErrorId : InvalidCastIConvertible

Cannot convert value “-355986981” to type “System.UInt32”. Error: “Value was either too large or too small for a UInt32.” At C:\Scripts\F5_VipDetails.ps1:256 char:12 + [uint32]$StatLow = $StatItem.value.low; + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : InvalidArgument: (:slight_smile: [], RuntimeException + FullyQualifiedErrorId : InvalidCastIConvertible