use of org.openstack4j.model.network.NetFloatingIP in project cloudbreak by hortonworks.
the class PortApiExtractor method extractMetadata.
@Override
public CloudInstanceMetaData extractMetadata(OSClient<?> client, Server server, String instanceId) {
String hypervisor = hypervisorExtractor.getHypervisor(server);
LOGGER.debug("Address map was empty, trying to extract ips");
List<? extends Port> ports = client.networking().port().list(getPortListOptions(instanceId));
String portId = ports.get(0).getId();
List<? extends NetFloatingIP> floatingIps = client.networking().floatingip().list(getFloatingIpListOptions(portId));
NetFloatingIP ips = floatingIps.get(0);
LOGGER.info("PrivateIp of instance: {} is {}", server.getName(), ips.getFixedIpAddress());
LOGGER.info("FloatingIp of instance: {} is {}", server.getName(), ips.getFloatingIpAddress());
return new CloudInstanceMetaData(ips.getFixedIpAddress(), ips.getFloatingIpAddress(), hypervisor);
}
Aggregations