blob: c54b04f8d0a93b8d51a303bf4696c5079f23df01 [file] [log] [blame]
Hyunsun Moon9cf43db2016-02-12 15:59:53 -08001/*
Brian O'Connor5ab426f2016-04-09 01:19:45 -07002 * Copyright 2016-present Open Networking Laboratory
Hyunsun Moon9cf43db2016-02-12 15:59:53 -08003 *
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 */
16package org.onosproject.cordvtn.rest;
17
18import org.onosproject.rest.AbstractWebResource;
19import org.slf4j.Logger;
20import org.slf4j.LoggerFactory;
21
22import javax.ws.rs.Consumes;
23import javax.ws.rs.DELETE;
24import javax.ws.rs.POST;
25import javax.ws.rs.PUT;
26import javax.ws.rs.Path;
27import javax.ws.rs.PathParam;
28import javax.ws.rs.Produces;
29import javax.ws.rs.core.MediaType;
30import javax.ws.rs.core.Response;
31import java.io.InputStream;
32
33/**
34 * Dummy Neutron ML2 mechanism driver.
35 * It just returns OK for subnets resource requests.
36 */
37@Path("subnets")
38public 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) {
Hyunsun Moon32f3b8e2016-03-02 19:27:26 -080046 log.trace(String.format(SUBNETS_MESSAGE, "create"));
Hyunsun Moon9cf43db2016-02-12 15:59:53 -080047 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) {
Hyunsun Moon32f3b8e2016-03-02 19:27:26 -080056 log.trace(String.format(SUBNETS_MESSAGE, "update"));
Hyunsun Moon9cf43db2016-02-12 15:59:53 -080057 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) {
Hyunsun Moon32f3b8e2016-03-02 19:27:26 -080065 log.trace(String.format(SUBNETS_MESSAGE, "delete"));
Hyunsun Moon9cf43db2016-02-12 15:59:53 -080066 return Response.status(Response.Status.OK).build();
67 }
68}