module.call(<string>)
Call a named virtual module.
A "virtual module" is a configuration block of one of the following
types, defined in the modules {...} section of the configuration:
-
group -
redundant -
redundant-load-balance -
load-balance
The name of the virtual module is the section’s second name, for
example load-balance sqlpool {...} would be named sqlpool.
If a virtual module has been defined then it can be called based on a
dynamically expanded string. See mods-available/home_server_pool for
a worked example.
Example 1. The virtual module in mods-enabled/pool1
redundant pool1 {
load-balance "%{Calling-Station-Id}%{User-Name}" {
radius1
radius2
# ... other modules
}
#
# This policy will be run then the above "load-balance" section
# fails.
#
group {
# ... policy ...
}
}
You can then call the module at run-time.
if (User-Name =~ /@example.com$) {
%module.call('pool1')
}
The argument to the function is a string, which can be taken from anywhere, e.g. an SQL query, LDAP query, or created dynamically by concatenating string values.