|
|
|
|
@ -9,6 +9,7 @@
|
|
|
|
|
# @param argv.type The interface type of a node to extract the IP
|
|
|
|
|
# from, one of:
|
|
|
|
|
# web_int, web_ext, sip_int, sip_ext, ...
|
|
|
|
|
# @param argv.format Optional reformatting of IPv6 addresses.
|
|
|
|
|
# @param argv.status node status [ online, offline, inactive ]
|
|
|
|
|
# default value: ['online', 'inactive']
|
|
|
|
|
# @return out The array of IPs.
|
|
|
|
|
@ -35,9 +36,19 @@ FOREACH host IN hosts.keys.sort;
|
|
|
|
|
FOREACH realiface IN hosts.$host.keys;
|
|
|
|
|
NEXT IF realiface != iface;
|
|
|
|
|
NEXT UNLESS hosts.$host.$realiface.type.grep('^' _ argv.type _ '$').size();
|
|
|
|
|
NEXT UNLESS hosts.$host.$realiface.v6ip;
|
|
|
|
|
|
|
|
|
|
out.push(hosts.$host.$realiface.v6ip);
|
|
|
|
|
FOREACH ip IN hosts.$host.$realiface.v6ip;
|
|
|
|
|
IF argv.format == 'expand';
|
|
|
|
|
WHILE ip.match('::') && ip.match(':', 1).size < 8;
|
|
|
|
|
ip = ip.replace('::', '::0:');
|
|
|
|
|
END;
|
|
|
|
|
ip = ip.replace('::', ':');
|
|
|
|
|
ip = ip.replace('^:', '0:');
|
|
|
|
|
ip = ip.replace(':$', ':0');
|
|
|
|
|
END;
|
|
|
|
|
NEXT UNLESS ip;
|
|
|
|
|
out.push(ip);
|
|
|
|
|
END;
|
|
|
|
|
END;
|
|
|
|
|
END;
|
|
|
|
|
END;
|
|
|
|
|
|