use of com.woorea.openstack.nova.model.FixedIp in project AJSC by att.
the class OpenStackNetworkService method getInterfaces.
/**
* @throws ZoneException
* @see com.att.cdp.zones.NetworkService#getInterfaces(java.lang.String)
*/
@Override
public List<com.att.cdp.zones.model.Port> getInterfaces(String serverId) throws ZoneException {
InterfaceAttachments list = null;
com.att.cdp.zones.model.Port port = null;
List<com.att.cdp.zones.model.Port> ports = new ArrayList<>();
connect();
trackRequest();
RequestState.put(RequestState.SERVICE, "Compute");
RequestState.put(RequestState.SERVICE_URL, novaConnector.getEndpoint());
try {
list = novaConnector.getClient().servers().listInterfaceAttachments(serverId).execute();
if (list != null && list.getList() != null && list.getList().size() > 0) {
for (InterfaceAttachment intf : list.getList()) {
port = new com.att.cdp.zones.model.Port();
port.setPortState(OpenStackPort.mapState(intf.getPortState()));
port.setMacAddr(intf.getMacAddress());
port.setId(intf.getPortId());
port.setSubnetId(intf.getNetworkId());
List<String> addresses = new ArrayList<>();
for (FixedIp ip : intf.getFixedIps()) {
addresses.add(ip.getIpAddress());
}
port.setAddresses(addresses);
ports.add(port);
}
}
} catch (OpenStackBaseException e) {
ExceptionMapper.mapException(e);
}
return ports;
}
Aggregations