blob: 5fa60e526419406311848c6020becb59eba246c6 [file] [log] [blame]
Hyunsun Moon9cf43db2016-02-12 15:59:53 -08001/*
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 */
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 ports resource requests.
36 */
37@Path("ports")
38public class NeutronMl2PortsWebResource extends AbstractWebResource {
39 protected final Logger log = LoggerFactory.getLogger(getClass());
40 private static final String PORTS_MESSAGE = "Received ports %s";
41
42 @POST
43 @Consumes(MediaType.APPLICATION_JSON)
44 @Produces(MediaType.APPLICATION_JSON)
45 public Response createPorts(InputStream input) {
46 log.debug(String.format(PORTS_MESSAGE, "create"));
47 return Response.status(Response.Status.OK).build();
48 }
49
50 @PUT
51 @Path("{id}")
52 @Consumes(MediaType.APPLICATION_JSON)
53 @Produces(MediaType.APPLICATION_JSON)
54 public Response updatePorts(@PathParam("id") String id, InputStream input) {
55 log.debug(String.format(PORTS_MESSAGE, "update"));
56 return Response.status(Response.Status.OK).build();
57 }
58
59 @Path("{id}")
60 @DELETE
61 @Produces(MediaType.APPLICATION_JSON)
62 public Response deletePorts(@PathParam("id") String id) {
63 log.debug(String.format(PORTS_MESSAGE, "delete"));
64 return Response.status(Response.Status.OK).build();
65 }
66}