for (String zoneId : api.getConfiguredZones()) {
Optional<? extends FloatingIPApi> apiOption = api.getFloatingIPExtensionForZone(zoneId);
if (!apiOption.isPresent())
continue;
FloatingIPApi api = apiOption.get();
ServerApi serverApi = this.api.getServerApiForZone(zoneId);
Server server = createServerInZone(zoneId);
FloatingIP floatingIP = api.create();
assertNotNull(floatingIP);
try {
api.addToServer(floatingIP.getIp(), server.getId());
assertEventually(new ServerHasFloatingIP(serverApi, server.getId(), floatingIP.getIp()));
} finally {
api.removeFromServer(floatingIP.getIp(), server.getId());
serverApi.delete(server.getId());
}
}
}