Search in sources :

Example 1 with OpenStackRouter

use of com.att.cdp.openstack.model.OpenStackRouter in project AJSC by att.

the class OpenStackNetworkService method getRouters.

/**
 * @return List<Router>
 * @throws ZoneException
 *             If the context cannot be used to get the list or routers
 * @see com.att.cdp.zones.NetworkService#getRouters()
 */
@SuppressWarnings("nls")
@Override
public List<Router> getRouters() throws ZoneException {
    connect();
    Context context = getContext();
    trackRequest();
    RequestState.put(RequestState.SERVICE, "Network");
    RequestState.put(RequestState.SERVICE_URL, quantumConnector.getEndpoint());
    ArrayList<Router> list = new ArrayList<>();
    try {
        Quantum client = quantumConnector.getClient();
        RoutersResource resource = client.routers();
        for (com.woorea.openstack.quantum.model.Router openstackRouter : resource.list().execute().getList()) {
            Router r = new OpenStackRouter(context, openstackRouter);
            list.add(r);
        }
    } catch (OpenStackBaseException e) {
        ExceptionMapper.mapException(e);
    }
    return list;
}
Also used : Context(com.att.cdp.zones.Context) OpenStackContext(com.att.cdp.openstack.OpenStackContext) Quantum(com.woorea.openstack.quantum.Quantum) OpenStackBaseException(com.woorea.openstack.base.client.OpenStackBaseException) ArrayList(java.util.ArrayList) OpenStackRouter(com.att.cdp.openstack.model.OpenStackRouter) Router(com.att.cdp.zones.model.Router) OpenStackRouter(com.att.cdp.openstack.model.OpenStackRouter) RoutersResource(com.woorea.openstack.quantum.api.RoutersResource)

Aggregations

OpenStackContext (com.att.cdp.openstack.OpenStackContext)1 OpenStackRouter (com.att.cdp.openstack.model.OpenStackRouter)1 Context (com.att.cdp.zones.Context)1 Router (com.att.cdp.zones.model.Router)1 OpenStackBaseException (com.woorea.openstack.base.client.OpenStackBaseException)1 Quantum (com.woorea.openstack.quantum.Quantum)1 RoutersResource (com.woorea.openstack.quantum.api.RoutersResource)1 ArrayList (java.util.ArrayList)1