vRealize Orchestrator (vRO) is frequently used with Network related automation which may involve working with IP Addresses. From an end user perspective, it is nice to specify a range of addresses such as 192.168.1.1-192.168.1.100 rather than having to specify all addresses. I found some simple Javascript in this Converting IP Addresses article that is easily adapted to vRO. You can use the code included in this article to either return an array of addresses in the range specified, or simply it by returning the total number of addresses in the range. Either way, I hope you find this code helpful in your workflows.
  1. To get started, create an action named getAddressesInRange
  2. Set the Return Type to Array/string as this will be an array containing ALL the addresses in the range
  3. Define two inputs: startIP and endIP - both as strings and give them Descriptions as "Starting IP Address" and "Ending IP Address" respectively
  4. Now, paste in the following code for the script
var startNum = dot2num(startIP);
var endNum = dot2num(endIP);

var ipList = new Array();

System.debug("Total Addresses in Range: "+((endNum + 1)-startNum));

for (i = startNum; i != endNum +1 ; i++ ){
    System.debug(num2dot(i));	
ipList.push(num2dot(i)); } return ipList; // Function source: http://javascript.about.com/library/blipconvert.htm function dot2num(dot) { var d = dot.split('.'); return ((((((+d[0])*256)+(+d[1]))*256)+(+d[2]))*256)+(+d[3]); } function num2dot(num) { var d = num%256; for (var i = 3; i > 0; i--) { num = Math.floor(num/256); d = num%256 + '.' + d; } return d; }

 Some example output:

[2015-01-08 14:57:54.182] [D] Total Addresses in Range: 15
[2015-01-08 14:57:54.183] [D] 192.168.1.1
[2015-01-08 14:57:54.185] [D] 192.168.1.2
[2015-01-08 14:57:54.187] [D] 192.168.1.3
[2015-01-08 14:57:54.188] [D] 192.168.1.4
[2015-01-08 14:57:54.190] [D] 192.168.1.5
[2015-01-08 14:57:54.192] [D] 192.168.1.6
[2015-01-08 14:57:54.193] [D] 192.168.1.7
[2015-01-08 14:57:54.195] [D] 192.168.1.8
[2015-01-08 14:57:54.196] [D] 192.168.1.9
[2015-01-08 14:57:54.197] [D] 192.168.1.10
[2015-01-08 14:57:54.199] [D] 192.168.1.11
[2015-01-08 14:57:54.199] [D] 192.168.1.12
[2015-01-08 14:57:54.200] [D] 192.168.1.13
[2015-01-08 14:57:54.201] [D] 192.168.1.14
[2015-01-08 14:57:54.202] [D] 192.168.1.15