blob: c547b2e22e5f60d551d56145fed6c1b781df358b [file] [log] [blame]
sanghoshin94872a12015-10-16 18:04:34 +09001/*
Brian O'Connor5ab426f2016-04-09 01:19:45 -07002 * Copyright 2016-present Open Networking Laboratory
sanghoshin94872a12015-10-16 18:04:34 +09003 *
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 */
sangho0c2a3da2016-02-16 13:39:07 +090016package org.onosproject.openstacknetworking.web;
sanghoshin94872a12015-10-16 18:04:34 +090017
sanghoshin94872a12015-10-16 18:04:34 +090018import org.onosproject.rest.AbstractWebResource;
19import org.slf4j.Logger;
20import org.slf4j.LoggerFactory;
21
22import javax.ws.rs.Consumes;
sanghoshinf25d2e02015-11-11 23:07:17 +090023import javax.ws.rs.DELETE;
sanghoshin94872a12015-10-16 18:04:34 +090024import javax.ws.rs.POST;
sanghoshinf25d2e02015-11-11 23:07:17 +090025import javax.ws.rs.PUT;
sanghoshin94872a12015-10-16 18:04:34 +090026import javax.ws.rs.Path;
27import javax.ws.rs.Produces;
28import javax.ws.rs.core.MediaType;
29import javax.ws.rs.core.Response;
30import java.io.InputStream;
31
sanghoshinf25d2e02015-11-11 23:07:17 +090032/**
33 * Handles REST API call of Neutron ML2 plugin.
34 */
sanghoshin94872a12015-10-16 18:04:34 +090035@Path("networks")
36public class OpenstackNetworkWebResource extends AbstractWebResource {
37
sangho0c2a3da2016-02-16 13:39:07 +090038 private final Logger log = LoggerFactory.getLogger(getClass());
sanghoshin94872a12015-10-16 18:04:34 +090039
sanghoshin94872a12015-10-16 18:04:34 +090040 @POST
41 @Consumes(MediaType.APPLICATION_JSON)
42 @Produces(MediaType.APPLICATION_JSON)
43 public Response createNetwork(InputStream input) {
sanghoshinf25d2e02015-11-11 23:07:17 +090044 log.debug("REST API networks is called {}", input.toString());
45 return Response.status(Response.Status.OK).build();
46 }
sanghoshin94872a12015-10-16 18:04:34 +090047
sanghoshinf25d2e02015-11-11 23:07:17 +090048 @PUT
49 @Path("{id}")
50 @Consumes(MediaType.APPLICATION_JSON)
51 @Produces(MediaType.APPLICATION_JSON)
52 public Response updateNetwork(InputStream input) {
53 log.debug("REST API networks is called {}", input.toString());
54 return Response.status(Response.Status.OK).build();
55 }
sanghoshin94872a12015-10-16 18:04:34 +090056
sanghoshinf25d2e02015-11-11 23:07:17 +090057 @DELETE
58 @Path("{id}")
59 @Consumes(MediaType.APPLICATION_JSON)
sanghoshinf25d2e02015-11-11 23:07:17 +090060 public Response deleteNetwork(InputStream input) {
61 log.debug("REST API networks is called {}", input.toString());
Jian Lic2a542b2016-05-10 11:48:19 -070062 return Response.noContent().build();
sanghoshin94872a12015-10-16 18:04:34 +090063 }
64}