Smarts ASL: How do you convert a hexadecimal string to an IP address in ASL?
book
Article ID: 303892
calendar_today
Updated On:
Products
VMware Smart Assurance
Issue/Introduction
Symptoms:
How do you convert a hexadecimal string to an IP address in Smarts ASL?
Trying to use the hexToIP method(operation) to convert a hexadecimal string to an IP address in ASL, but it seems to only work for the Availability Manager product.
Environment
VMware Smart Assurance - SMARTS
Cause
Availability Manager is the only Smarts product that can use the hexToIP method(operation).
Resolution
The following sample code shows how a hexadecimal string can be converted to an IP address in Smarts ASL:
//Break the hexadecimal string into two character pieces:
my_input = "0A011903";
START { input = my_input; ip : HEX_IP } do { print(ip); stop(); }
// To read only 2 hex chars, we need to use 2 '1 character' matches READ_HEX_BYTE { c : rep(char, 2) } do { h = MY_HEX(c); return h; }
// We then essentially interpret those two characters as a hex string // (the integer equivalent is what gets saved) MY_HEX(x) { input = x; i : hex } do { return i; }