[%
# 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;
  FOREACH realiface IN hosts.${host}.keys;
    IF realiface == iface;
      IF hosts.${host}.$realiface.gateway;

        IF argv.gw == 'yes';
          out.push(hosts.${host}.$realiface.gateway);
        END;

        IF argv.dns == 'yes';
          FOREACH dns_server_ip IN hosts.${host}.${realiface}.dns_nameservers;
            out.push(dns_server_ip);
          END;
        END;

      END;
    END;
  END;
END;

out = out.sort;

-%]