sanghoshin | 94872a1 | 2015-10-16 18:04:34 +0900 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2015 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.openstackswitching.web; |
| 17 | |
sanghoshin | 94872a1 | 2015-10-16 18:04:34 +0900 | [diff] [blame] | 18 | import org.onosproject.rest.AbstractWebResource; |
| 19 | import org.slf4j.Logger; |
| 20 | import org.slf4j.LoggerFactory; |
| 21 | |
| 22 | import javax.ws.rs.Consumes; |
sanghoshin | f25d2e0 | 2015-11-11 23:07:17 +0900 | [diff] [blame] | 23 | import javax.ws.rs.DELETE; |
sanghoshin | 94872a1 | 2015-10-16 18:04:34 +0900 | [diff] [blame] | 24 | import javax.ws.rs.POST; |
sanghoshin | f25d2e0 | 2015-11-11 23:07:17 +0900 | [diff] [blame] | 25 | import javax.ws.rs.PUT; |
sanghoshin | 94872a1 | 2015-10-16 18:04:34 +0900 | [diff] [blame] | 26 | import javax.ws.rs.Path; |
| 27 | import javax.ws.rs.Produces; |
| 28 | import javax.ws.rs.core.MediaType; |
| 29 | import javax.ws.rs.core.Response; |
| 30 | import java.io.InputStream; |
| 31 | |
sanghoshin | f25d2e0 | 2015-11-11 23:07:17 +0900 | [diff] [blame] | 32 | /** |
| 33 | * Handles REST API call of Neutron ML2 plugin. |
| 34 | */ |
sanghoshin | 94872a1 | 2015-10-16 18:04:34 +0900 | [diff] [blame] | 35 | @Path("networks") |
| 36 | public class OpenstackNetworkWebResource extends AbstractWebResource { |
| 37 | |
| 38 | protected static final Logger log = LoggerFactory |
| 39 | .getLogger(OpenstackNetworkWebResource.class); |
| 40 | |
sanghoshin | 94872a1 | 2015-10-16 18:04:34 +0900 | [diff] [blame] | 41 | @POST |
| 42 | @Consumes(MediaType.APPLICATION_JSON) |
| 43 | @Produces(MediaType.APPLICATION_JSON) |
| 44 | public Response createNetwork(InputStream input) { |
sanghoshin | f25d2e0 | 2015-11-11 23:07:17 +0900 | [diff] [blame] | 45 | log.debug("REST API networks is called {}", input.toString()); |
| 46 | return Response.status(Response.Status.OK).build(); |
| 47 | } |
sanghoshin | 94872a1 | 2015-10-16 18:04:34 +0900 | [diff] [blame] | 48 | |
sanghoshin | f25d2e0 | 2015-11-11 23:07:17 +0900 | [diff] [blame] | 49 | @PUT |
| 50 | @Path("{id}") |
| 51 | @Consumes(MediaType.APPLICATION_JSON) |
| 52 | @Produces(MediaType.APPLICATION_JSON) |
| 53 | public Response updateNetwork(InputStream input) { |
| 54 | log.debug("REST API networks is called {}", input.toString()); |
| 55 | return Response.status(Response.Status.OK).build(); |
| 56 | } |
sanghoshin | 94872a1 | 2015-10-16 18:04:34 +0900 | [diff] [blame] | 57 | |
sanghoshin | f25d2e0 | 2015-11-11 23:07:17 +0900 | [diff] [blame] | 58 | @DELETE |
| 59 | @Path("{id}") |
| 60 | @Consumes(MediaType.APPLICATION_JSON) |
| 61 | @Produces(MediaType.APPLICATION_JSON) |
| 62 | public Response deleteNetwork(InputStream input) { |
| 63 | log.debug("REST API networks is called {}", input.toString()); |
| 64 | return Response.status(Response.Status.OK).build(); |
sanghoshin | 94872a1 | 2015-10-16 18:04:34 +0900 | [diff] [blame] | 65 | } |
| 66 | } |