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.
ngcpcfg/lib/get_default_pingnodes

31 lines
642 B

[%
# vi: ft=tt2
# Returns a list of IPs to ping.
#
# @param argv.gw A boolean selecting whether to add GW IP.
# @param argv.dns A boolean selecting whether to add DNS IPs.
# @return out List of pingnodes.
host = ngcp.get_hostname();
out = [];
FOREACH iface IN hosts.${host}.interfaces;
NEXT UNLESS hosts.${host}.exists(iface);
NEXT UNLESS hosts.${host}.$iface.gateway;
IF argv.gw == 'yes';
out.push(hosts.${host}.$iface.gateway);
END;
IF argv.dns == 'yes';
FOREACH dns_server_ip IN hosts.${host}.${iface}.dns_nameservers;
out.push(dns_server_ip);
END;
END;
END;
out = out.sort;
-%]