[%
# 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;

-%]
