DataScript: avi.utils.ip.netaddr

Function avi.utils.ip.netaddr(ip_addr, netmask)
Description Accepts an IPv4 or IPv6 IP address and netmask and returns the network address.
Parameter ip_addr is a string containing the IP address.

netmask is an integer containing the network mask.
Returns If
  • ip_addr or mask is nil,
  • ip_addr contains "NIL", or
  • ip_addr contains an invalid IPv6 or IPv4 address,
then the function returns NIL

else the function returns the IPv6 or IPv4 address of the network.
Example avi.utils.ip.netaddr ("", 24) returns

avi.utils.ip.netaddr ("2001:0db8:85a3:0000:0000:8a2e:0370:7334", 53) returns 1:2001:db8:85a3::

Note: Starting with NSX Advanced Load Balancing version 20.1.1, DataScript function avi.ip.netaddr(ip, prefixlen) is deprecated. Datascript function avi.utils.ip.netaddr(ip_addr, netmask) can be used instead of avi.ip.netaddr(ip, prefixlen).