Hyunsun Moon | b6febbe | 2016-02-12 15:59:53 -0800 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2016 Open Networking Laboratory |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | package org.onosproject.cordvtn.rest; |
| 17 | |
| 18 | import org.onosproject.rest.AbstractWebResource; |
| 19 | import org.slf4j.Logger; |
| 20 | import org.slf4j.LoggerFactory; |
| 21 | |
| 22 | import javax.ws.rs.Consumes; |
| 23 | import javax.ws.rs.DELETE; |
| 24 | import javax.ws.rs.POST; |
| 25 | import javax.ws.rs.PUT; |
| 26 | import javax.ws.rs.Path; |
| 27 | import javax.ws.rs.PathParam; |
| 28 | import javax.ws.rs.Produces; |
| 29 | import javax.ws.rs.core.MediaType; |
| 30 | import javax.ws.rs.core.Response; |
| 31 | import java.io.InputStream; |
| 32 | |
| 33 | /** |
| 34 | * Dummy Neutron ML2 mechanism driver. |
| 35 | * It just returns OK for subnets resource requests. |
| 36 | */ |
| 37 | @Path("subnets") |
| 38 | public class NeutronMl2SubnetsWebResource extends AbstractWebResource { |
| 39 | protected final Logger log = LoggerFactory.getLogger(getClass()); |
| 40 | private static final String SUBNETS_MESSAGE = "Received subnets %s"; |
| 41 | |
| 42 | @POST |
| 43 | @Consumes(MediaType.APPLICATION_JSON) |
| 44 | @Produces(MediaType.APPLICATION_JSON) |
| 45 | public Response createSubnet(InputStream input) { |
| 46 | log.debug(String.format(SUBNETS_MESSAGE, "create")); |
| 47 | return Response.status(Response.Status.OK).build(); |
| 48 | } |
| 49 | |
| 50 | |
| 51 | @PUT |
| 52 | @Path("{id}") |
| 53 | @Produces(MediaType.APPLICATION_JSON) |
| 54 | @Consumes(MediaType.APPLICATION_JSON) |
| 55 | public Response updateSubnet(@PathParam("id") String id, InputStream input) { |
| 56 | log.debug(String.format(SUBNETS_MESSAGE, "update")); |
| 57 | return Response.status(Response.Status.OK).build(); |
| 58 | |
| 59 | } |
| 60 | |
| 61 | @DELETE |
| 62 | @Path("{id}") |
| 63 | @Produces(MediaType.APPLICATION_JSON) |
| 64 | public Response deleteSubnet(@PathParam("id") String id) { |
| 65 | log.debug(String.format(SUBNETS_MESSAGE, "delete")); |
| 66 | return Response.status(Response.Status.OK).build(); |
| 67 | } |
| 68 | } |