2 * Copyright (c) 2015 Yale University and others. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
8 package org.opendaylight.alto.northbound;
10 import javax.ws.rs.GET;
11 import javax.ws.rs.Path;
12 import javax.ws.rs.PathParam;
13 import javax.ws.rs.Produces;
14 import javax.ws.rs.core.Response;
16 import org.opendaylight.alto.commons.types.mapper.JSONMapper;
17 import org.opendaylight.alto.commons.types.rfc7285.MediaType;
18 import org.opendaylight.alto.services.AltoService;
19 import org.opendaylight.yang.gen.v1.urn.opendaylight.alto.rev150404.resources.network.maps.NetworkMap;
20 import org.opendaylight.yang.gen.v1.urn.opendaylight.alto.service.types.rev150404.IRD;
21 import org.opendaylight.yang.gen.v1.urn.opendaylight.alto.service.types.rev150404.ResourceId;
24 public class AltoNorthbound {
25 private AltoService altoService = new AltoService();
26 private JSONMapper mapper = new JSONMapper();
29 @Produces({ MediaType.ALTO_DIRECTORY, MediaType.ALTO_ERROR })
30 public Response retrieveIRD() {
32 IRD ird = altoService.getIRD();
33 return Response.ok(ird, MediaType.ALTO_DIRECTORY).build();
34 } catch (Exception e) {
36 return Response.ok("", MediaType.ALTO_ERROR).build();
39 @Path("/networkmap/{networkmap_id}")
41 @Produces({ MediaType.ALTO_NETWORKMAP, MediaType.ALTO_ERROR })
42 public Response retrieveNetworkMap(
43 @PathParam(value = "networkmap_id") String nmap_id) {
44 NetworkMap networkMap = altoService.getNetworkMap(new ResourceId(nmap_id));
46 return Response.ok("", MediaType.ALTO_NETWORKMAP).build();
47 } catch (Exception e) {
48 return Response.ok("", MediaType.ALTO_ERROR).build();