DataScript: avi.ipgroup.contains


Function avi.ipgroup.contains ( ipgroup, ipaddress )
Description An IPv4 (or, starting with 18.1.3, IPv6) address is compared against the list of IP addresses in an IP group. The IP group may be either a list of IP addresses, networks, or countries.

The comparison returns true upon the any match. If the IP group has entries for,, and and the evaluated IP address is, the function will match successfully.

See IP group for further help on creating and using IP groups.

Parameter ipgroup is the name of the IP group to make the comparison against. The IP group must be mapped to the DataScript in the DataScript creation of the GUI or API.

ipaddress is an IP address in dotted quad notation (

Strarting with Avi Vantage 20.1.1, the IP group Datascript accepts IP Group names as variables too.
For example,
ipgrp_name = “IPGRP1”
avi.ipgroup.contains(ipgrp_name, ip_address)
Returns match returns true if a match was found, or false if no match.
Version v16.3 and later
Related avi.stringgroup.contains() Matches a custom string against a string group.
Example Discard clients matched against an IP blacklist
var = avi.vs.client_ip()
if avi.ipgroup.contains("IP-Group", var) then
   avi.vs.log("Blacklisted IP" .. var.. "attempting to log in")