blob: c5c31819f8104964f81fb837c5afdf0c29c60729 [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 networks resource requests.
36 */
37@Path("networks")
38public class NeutronMl2NetworksWebResource extends AbstractWebResource {
39 protected final Logger log = LoggerFactory.getLogger(getClass());
40 private static final String NETWORKS_MESSAGE = "Received networks %s";
41
42 @POST
43 @Consumes(MediaType.APPLICATION_JSON)
44 @Produces(MediaType.APPLICATION_JSON)
45 public Response createNetwork(InputStream input) {
Hyunsun Moon32f3b8e2016-03-02 19:27:26 -080046 log.trace(String.format(NETWORKS_MESSAGE, "create"));
Hyunsun Moon9cf43db2016-02-12 15:59:53 -080047 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 updateNetwork(@PathParam("id") String id, InputStream input) {
Hyunsun Moon32f3b8e2016-03-02 19:27:26 -080055 log.trace(String.format(NETWORKS_MESSAGE, "update"));
Hyunsun Moon9cf43db2016-02-12 15:59:53 -080056 return Response.status(Response.Status.OK).build();
57 }
58
59 @DELETE
60 @Path("{id}")
61 @Produces(MediaType.APPLICATION_JSON)
62 public Response deleteNetwork(@PathParam("id") String id) {
Hyunsun Moon32f3b8e2016-03-02 19:27:26 -080063 log.trace(String.format(NETWORKS_MESSAGE, "delete"));
Hyunsun Moon9cf43db2016-02-12 15:59:53 -080064 return Response.status(Response.Status.OK).build();
65 }
66}