Search in sources :

Example 1 with VirtualInterface

use of com.att.cdp.zones.model.VirtualInterface in project AJSC by att.

the class OpenStackComputeService method getVirtualInterfaces.

/**
 * This method returns a list of OS Virtual Interfaces for a specified server instance.
 * <p>
 * This includes the ID for the virtual interface as well as the associated mac address.
 * </p>
 *
 * @return A list of virtual interfaces
 * @throws ZoneException
 *             If the virtual interfaces cannot be listed
 * @see com.att.cdp.zones.ComputeService#getVirtualInterfaces(java.lang.String)
 */
@SuppressWarnings("nls")
@Override
public List<VirtualInterface> getVirtualInterfaces(String id) throws ZoneException {
    checkArg(id, "id");
    connect();
    Context context = getContext();
    trackRequest();
    RequestState.put(RequestState.SERVICE, "Compute");
    RequestState.put(RequestState.SERVICE_URL, nova.getEndpoint());
    ArrayList<VirtualInterface> list = new ArrayList<>();
    try {
        com.woorea.openstack.nova.model.VirtualInterfaces virtualInterfaces = nova.getClient().servers().listVirtualInterfaces(id).execute();
        for (com.woorea.openstack.nova.model.VirtualInterface vi : virtualInterfaces.getList()) {
            VirtualInterface virtualInterface = new OpenStackVirtualInterface(context, vi);
            list.add(virtualInterface);
        }
    } catch (OpenStackBaseException e) {
        ExceptionMapper.mapException(e);
    }
    return list;
}
Also used : Context(com.att.cdp.zones.Context) OpenStackContext(com.att.cdp.openstack.OpenStackContext) VirtualInterface(com.att.cdp.zones.model.VirtualInterface) OpenStackVirtualInterface(com.att.cdp.openstack.model.OpenStackVirtualInterface) OpenStackBaseException(com.woorea.openstack.base.client.OpenStackBaseException) ArrayList(java.util.ArrayList) OpenStackVirtualInterface(com.att.cdp.openstack.model.OpenStackVirtualInterface)

Aggregations

OpenStackContext (com.att.cdp.openstack.OpenStackContext)1 OpenStackVirtualInterface (com.att.cdp.openstack.model.OpenStackVirtualInterface)1 Context (com.att.cdp.zones.Context)1 VirtualInterface (com.att.cdp.zones.model.VirtualInterface)1 OpenStackBaseException (com.woorea.openstack.base.client.OpenStackBaseException)1 ArrayList (java.util.ArrayList)1