mirror of https://github.com/sipwise/ngcpcfg.git
We need to add a new script, which finds and grabs a list needed advertised ip addresses for a particular instance. Change-Id: Id33c4e2d4de071c5feb34dd9346a33ef4a61381bmr10.4
parent
99e563b8b6
commit
1030182d04
@ -0,0 +1,40 @@
|
||||
[%
|
||||
# vi: ft=tt2
|
||||
|
||||
# Return an advertised IP from the interface of a given LB instance
|
||||
# @param argv.instance instance object
|
||||
#
|
||||
# @param argv.type The interface type of LB to extract the advertised IP
|
||||
# from, one of:
|
||||
# sip_int, sip_ext
|
||||
# @param argv.status node status [ online, offline, inactive ]
|
||||
# default value: ['online', 'inactive']
|
||||
# @return out The array of IPs.
|
||||
|
||||
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 = [];
|
||||
RETURN UNLESS status.item(argv.instance.status);
|
||||
|
||||
FOREACH iface IN argv.instance.interfaces;
|
||||
NEXT UNLESS iface.type.grep('^' _ argv.type _ '$').size();
|
||||
FOREACH adv IN iface.advertised_ip;
|
||||
NEXT UNLESS adv;
|
||||
out.push(adv);
|
||||
END;
|
||||
END;
|
||||
|
||||
out = out.sort.unique;
|
||||
|
||||
-%]
|
||||
Loading…
Reference in new issue