calculateSubnet
A Workflow Engine function that generates subnet data from an IP address and a suitable network mask (either a bitmask or CIDR bit count). The resulting subnet data is copied to the workflowContext
(workflowContext.subnetData
).
This function is available as a feature of the Add-ons v2.4 download and later.
This function is available for event, alert, and Situation workflows.
This function is eventless.
Back to Workflow Engine Functions Reference.
Arguments
Workflow Engine function calculateSubnet
takes the following arguments:
Name | Required | Type | Description |
---|---|---|---|
| yes | string | The IP and mask in either bitmask or CIDR format.
|
Example
The following example demonstrates typical use of Workflow Engine function calculateSubnet
.
Given an event which contains the following custom_info
:
custom_info :{ ... "ipAddress" : "10.0.0.1", "mask" : "255.255.0.0" }
The subnetDetails
parameter is defined as a substitution:
$(custom_info.ipAddress)/$(custom_info.mask)
The resulting workflowContext.subnetData
will contain:
{ "subnetData": { "subnet": "10.0.0.0", "firstHostAddress": "10.0.0.1", "lastHostAddress": "10.0.255.254", "numHosts": 65534, "broadcastAddress": "10.0.255.255", "subnetMask": "255.255.0.0", "maskBits": 16, "subnetName": "10.0.0.0/16" } }