/** @return the ports required for a specific entity */
protected Collection<Integer> getRequiredOpenPorts(Entity entity) {
Set<Integer> ports = MutableSet.of(22);
for (ConfigKey<?> k: entity.getEntityType().getConfigKeys()) {
if (PortRange.class.isAssignableFrom(k.getType())) {
PortRange p = (PortRange) entity.getConfig(k);
if (p != null && !p.isEmpty()) ports.add(p.iterator().next());
}
}
LOG.debug("getRequiredOpenPorts detected default {} for {}", ports, entity);
return ports;
}