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.
38 lines
886 B
38 lines
886 B
[%
|
|
# vi: ft=tt2
|
|
|
|
# Return a hash of set_name=>dispatcher_id for a given cluster set type.
|
|
#
|
|
# @param argv.type The type of element we are interested in (rtp, lb).
|
|
# @param argv.status node status [ online, offline, inactive ]
|
|
# default value: ['online', 'inactive']
|
|
# @return out The hash.
|
|
|
|
IF !argv.status.size;
|
|
argv.status = ['online', 'inactive'];
|
|
END;
|
|
|
|
status = {
|
|
online = 0
|
|
offline = 0
|
|
inactive = 0
|
|
};
|
|
FOREACH val IN argv.status;
|
|
status.$val = 1;
|
|
END;
|
|
|
|
out = {};
|
|
|
|
FOREACH set IN cluster_sets.sets;
|
|
FOREACH host IN hosts.keys.sort;
|
|
NEXT UNLESS status.item(hosts.$host.status);
|
|
NEXT UNLESS ngcp.has_role(host, argv.role);
|
|
FOREACH iface IN hosts.$host.interfaces;
|
|
NEXT UNLESS hosts.$host.$iface.cluster_sets.grep('^' _ set.name _ '$').size();
|
|
out.${set.name} = set.dispatcher_id;
|
|
END;
|
|
END;
|
|
END;
|
|
|
|
-%]
|