mirror of https://github.com/sipwise/ngcpcfg.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
32 lines
1020 B
32 lines
1020 B
[%
|
|
# Return an array of hashes, each hash containing dispatcher_id and ips,
|
|
# which is an array of ips, for a given cluster set type.
|
|
#
|
|
# @param argv.role The role of element we are interested in (rtp, lb)
|
|
# @param argv.type The type of the interfaces (rtp_int, sip_int...)
|
|
# @return out The array of hashes
|
|
-%]
|
|
[%
|
|
out = [];
|
|
|
|
FOREACH set IN cluster_sets.keys;
|
|
NEXT IF (set == 'default_set' || set == 'type');
|
|
theset = { dispatcher_id = cluster_sets.$set.dispatcher_id };
|
|
theset.ips = [];
|
|
|
|
FOREACH host IN hosts.keys;
|
|
NEXT UNLESS hosts.$host.role.grep('^' _ argv.role _ '$').size();
|
|
FOREACH iface IN hosts.$host.interfaces;
|
|
NEXT UNLESS hosts.$host.$iface.cluster_sets.grep('^' _ set _ '$').size();
|
|
NEXT UNLESS hosts.$host.$iface.type.grep('^' _ argv.type _ '$').size();
|
|
theset.ips.push(hosts.$host.$iface.ip) UNLESS theset.ips.defined(hosts.$host.$iface.ip);
|
|
END;
|
|
END;
|
|
|
|
IF theset.ips.size();
|
|
out.push(theset);
|
|
END;
|
|
|
|
END;
|
|
-%]
|