Search in sources :

Example 1 with Router

use of com.att.cdp.zones.model.Router 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)

Example 2 with Router

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

the class TestNetworkService method testGetRouters.

/**
 * Verifies that we can get ports
 *
 * @throws ZoneException
 *             If the connection fails, user is not authorized, or the provider cannot perform the operation.
 */
@Test
@Ignore
public void testGetRouters() throws ZoneException {
    Context context = connect();
    NetworkService service = context.getNetworkService();
    List<Router> routers = service.getRouters();
    assertNotNull(routers);
    assertFalse(routers.isEmpty());
}
Also used : Context(com.att.cdp.zones.Context) NetworkService(com.att.cdp.zones.NetworkService) Router(com.att.cdp.zones.model.Router) Ignore(org.junit.Ignore) Test(org.junit.Test)

Aggregations

Context (com.att.cdp.zones.Context)2 Router (com.att.cdp.zones.model.Router)2 OpenStackContext (com.att.cdp.openstack.OpenStackContext)1 OpenStackRouter (com.att.cdp.openstack.model.OpenStackRouter)1 NetworkService (com.att.cdp.zones.NetworkService)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 Ignore (org.junit.Ignore)1 Test (org.junit.Test)1