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.
35 lines
1.0 KiB
35 lines
1.0 KiB
[%
|
|
# Return an array of hashes, each hash containing dispatcher_id and ips,
|
|
# which is an array of shared ips, for a given cluster set type.
|
|
#
|
|
# @param argv.type The type of element we are interested in (rtp, lb)
|
|
# @return out The array of hashes
|
|
-%]
|
|
[%
|
|
blktmp.processed_hosts = {};
|
|
out = [];
|
|
FOREACH set IN cluster_sets.keys;
|
|
set = cluster_sets.$set;
|
|
IF set.${argv.type}.defined;
|
|
theset = { dispatcher_id = set.dispatcher_id };
|
|
theset.ips = [];
|
|
FOREACH entry IN set.${argv.type};
|
|
iftype = entry.iface;
|
|
host = entry.host;
|
|
NEXT IF blktmp.processed_hosts.$host.defined;
|
|
FOREACH iface IN hosts.$host.interfaces;
|
|
realiface = hosts.$host.$iface;
|
|
NEXT UNLESS realiface.type.grep('^' _ iftype _ '$').size();
|
|
blktmp.processed_hosts.$peer = 1;
|
|
FOREACH ip IN realiface.shared_ip;
|
|
theset.ips.push(ip);
|
|
END;
|
|
END;
|
|
END;
|
|
IF theset.ips.size();
|
|
out.push(theset);
|
|
END;
|
|
END;
|
|
END;
|
|
-%]
|