Committed by
Gerrit Code Review
ONOS-4512 fix bug to get and delete
Change-Id: I952085be7548830b660e133cf1c59fcdf98e8f69
Showing
10 changed files
with
32 additions
and
4 deletions
... | @@ -18,6 +18,7 @@ package org.onosproject.vtnweb.resources; | ... | @@ -18,6 +18,7 @@ package org.onosproject.vtnweb.resources; |
18 | import javax.ws.rs.GET; | 18 | import javax.ws.rs.GET; |
19 | import javax.ws.rs.Path; | 19 | import javax.ws.rs.Path; |
20 | import javax.ws.rs.Produces; | 20 | import javax.ws.rs.Produces; |
21 | +import javax.ws.rs.Consumes; | ||
21 | import javax.ws.rs.core.MediaType; | 22 | import javax.ws.rs.core.MediaType; |
22 | import javax.ws.rs.core.Response; | 23 | import javax.ws.rs.core.Response; |
23 | 24 | ||
... | @@ -45,6 +46,7 @@ public class ClassifierWebResource extends AbstractWebResource { | ... | @@ -45,6 +46,7 @@ public class ClassifierWebResource extends AbstractWebResource { |
45 | */ | 46 | */ |
46 | @GET | 47 | @GET |
47 | @Produces(MediaType.APPLICATION_JSON) | 48 | @Produces(MediaType.APPLICATION_JSON) |
49 | + @Consumes(MediaType.APPLICATION_JSON) | ||
48 | public Response getClassifiers() { | 50 | public Response getClassifiers() { |
49 | 51 | ||
50 | ObjectNode result = mapper().createObjectNode(); | 52 | ObjectNode result = mapper().createObjectNode(); | ... | ... |
... | @@ -75,6 +75,7 @@ public class FloatingIpWebResource extends AbstractWebResource { | ... | @@ -75,6 +75,7 @@ public class FloatingIpWebResource extends AbstractWebResource { |
75 | 75 | ||
76 | @GET | 76 | @GET |
77 | @Produces(MediaType.APPLICATION_JSON) | 77 | @Produces(MediaType.APPLICATION_JSON) |
78 | + @Consumes(MediaType.APPLICATION_JSON) | ||
78 | public Response listFloatingIps() { | 79 | public Response listFloatingIps() { |
79 | Collection<FloatingIp> floatingIps = get(FloatingIpService.class) | 80 | Collection<FloatingIp> floatingIps = get(FloatingIpService.class) |
80 | .getFloatingIps(); | 81 | .getFloatingIps(); |
... | @@ -87,6 +88,7 @@ public class FloatingIpWebResource extends AbstractWebResource { | ... | @@ -87,6 +88,7 @@ public class FloatingIpWebResource extends AbstractWebResource { |
87 | @GET | 88 | @GET |
88 | @Path("{floatingIpUUID}") | 89 | @Path("{floatingIpUUID}") |
89 | @Produces(MediaType.APPLICATION_JSON) | 90 | @Produces(MediaType.APPLICATION_JSON) |
91 | + @Consumes(MediaType.APPLICATION_JSON) | ||
90 | public Response getFloatingIp(@PathParam("floatingIpUUID") String id, | 92 | public Response getFloatingIp(@PathParam("floatingIpUUID") String id, |
91 | @QueryParam("fields") List<String> fields) { | 93 | @QueryParam("fields") List<String> fields) { |
92 | 94 | ... | ... |
... | @@ -59,6 +59,7 @@ public class FlowClassifierWebResource extends AbstractWebResource { | ... | @@ -59,6 +59,7 @@ public class FlowClassifierWebResource extends AbstractWebResource { |
59 | * @return 200 OK | 59 | * @return 200 OK |
60 | */ | 60 | */ |
61 | @GET | 61 | @GET |
62 | + @Consumes(MediaType.APPLICATION_JSON) | ||
62 | @Produces(MediaType.APPLICATION_JSON) | 63 | @Produces(MediaType.APPLICATION_JSON) |
63 | public Response getFlowClassifiers() { | 64 | public Response getFlowClassifiers() { |
64 | Iterable<FlowClassifier> flowClassifiers = get(FlowClassifierService.class).getFlowClassifiers(); | 65 | Iterable<FlowClassifier> flowClassifiers = get(FlowClassifierService.class).getFlowClassifiers(); |
... | @@ -81,6 +82,7 @@ public class FlowClassifierWebResource extends AbstractWebResource { | ... | @@ -81,6 +82,7 @@ public class FlowClassifierWebResource extends AbstractWebResource { |
81 | */ | 82 | */ |
82 | @GET | 83 | @GET |
83 | @Path("{flow_id}") | 84 | @Path("{flow_id}") |
85 | + @Consumes(MediaType.APPLICATION_JSON) | ||
84 | @Produces(MediaType.APPLICATION_JSON) | 86 | @Produces(MediaType.APPLICATION_JSON) |
85 | public Response getFlowClassifier(@PathParam("flow_id") String id) { | 87 | public Response getFlowClassifier(@PathParam("flow_id") String id) { |
86 | FlowClassifier flowClassifier = nullIsNotFound(get(FlowClassifierService.class) | 88 | FlowClassifier flowClassifier = nullIsNotFound(get(FlowClassifierService.class) |
... | @@ -154,6 +156,8 @@ public class FlowClassifierWebResource extends AbstractWebResource { | ... | @@ -154,6 +156,8 @@ public class FlowClassifierWebResource extends AbstractWebResource { |
154 | */ | 156 | */ |
155 | @Path("{flow_id}") | 157 | @Path("{flow_id}") |
156 | @DELETE | 158 | @DELETE |
159 | + @Produces(MediaType.APPLICATION_JSON) | ||
160 | + @Consumes(MediaType.APPLICATION_JSON) | ||
157 | public Response deleteFlowClassifier(@PathParam("flow_id") String id) { | 161 | public Response deleteFlowClassifier(@PathParam("flow_id") String id) { |
158 | log.debug("Deletes flow classifier by identifier {}.", id); | 162 | log.debug("Deletes flow classifier by identifier {}.", id); |
159 | FlowClassifierId flowClassifierId = FlowClassifierId.of(id); | 163 | FlowClassifierId flowClassifierId = FlowClassifierId.of(id); | ... | ... |
... | @@ -62,6 +62,7 @@ public class PortChainWebResource extends AbstractWebResource { | ... | @@ -62,6 +62,7 @@ public class PortChainWebResource extends AbstractWebResource { |
62 | */ | 62 | */ |
63 | @GET | 63 | @GET |
64 | @Produces(MediaType.APPLICATION_JSON) | 64 | @Produces(MediaType.APPLICATION_JSON) |
65 | + @Consumes(MediaType.APPLICATION_JSON) | ||
65 | public Response getPortChains() { | 66 | public Response getPortChains() { |
66 | Iterable<PortChain> portChains = get(PortChainService.class).getPortChains(); | 67 | Iterable<PortChain> portChains = get(PortChainService.class).getPortChains(); |
67 | ObjectNode result = mapper().createObjectNode(); | 68 | ObjectNode result = mapper().createObjectNode(); |
... | @@ -83,6 +84,7 @@ public class PortChainWebResource extends AbstractWebResource { | ... | @@ -83,6 +84,7 @@ public class PortChainWebResource extends AbstractWebResource { |
83 | @GET | 84 | @GET |
84 | @Path("{chain_id}") | 85 | @Path("{chain_id}") |
85 | @Produces(MediaType.APPLICATION_JSON) | 86 | @Produces(MediaType.APPLICATION_JSON) |
87 | + @Consumes(MediaType.APPLICATION_JSON) | ||
86 | public Response getPortPain(@PathParam("chain_id") String id) { | 88 | public Response getPortPain(@PathParam("chain_id") String id) { |
87 | 89 | ||
88 | PortChain portChain = nullIsNotFound(get(PortChainService.class).getPortChain(PortChainId.of(id)), | 90 | PortChain portChain = nullIsNotFound(get(PortChainService.class).getPortChain(PortChainId.of(id)), |
... | @@ -150,6 +152,8 @@ public class PortChainWebResource extends AbstractWebResource { | ... | @@ -150,6 +152,8 @@ public class PortChainWebResource extends AbstractWebResource { |
150 | */ | 152 | */ |
151 | @Path("{chain_id}") | 153 | @Path("{chain_id}") |
152 | @DELETE | 154 | @DELETE |
155 | + @Produces(MediaType.APPLICATION_JSON) | ||
156 | + @Consumes(MediaType.APPLICATION_JSON) | ||
153 | public Response deletePortPain(@PathParam("chain_id") String id) { | 157 | public Response deletePortPain(@PathParam("chain_id") String id) { |
154 | log.debug("Deletes port chain by identifier {}.", id); | 158 | log.debug("Deletes port chain by identifier {}.", id); |
155 | PortChainId portChainId = PortChainId.of(id); | 159 | PortChainId portChainId = PortChainId.of(id); | ... | ... |
... | @@ -64,6 +64,7 @@ public class PortPairGroupWebResource extends AbstractWebResource { | ... | @@ -64,6 +64,7 @@ public class PortPairGroupWebResource extends AbstractWebResource { |
64 | */ | 64 | */ |
65 | @GET | 65 | @GET |
66 | @Produces(MediaType.APPLICATION_JSON) | 66 | @Produces(MediaType.APPLICATION_JSON) |
67 | + @Consumes(MediaType.APPLICATION_JSON) | ||
67 | public Response getPortPairGroups() { | 68 | public Response getPortPairGroups() { |
68 | Iterable<PortPairGroup> portPairGroups = get(PortPairGroupService.class).getPortPairGroups(); | 69 | Iterable<PortPairGroup> portPairGroups = get(PortPairGroupService.class).getPortPairGroups(); |
69 | ObjectNode result = mapper().createObjectNode(); | 70 | ObjectNode result = mapper().createObjectNode(); |
... | @@ -85,6 +86,7 @@ public class PortPairGroupWebResource extends AbstractWebResource { | ... | @@ -85,6 +86,7 @@ public class PortPairGroupWebResource extends AbstractWebResource { |
85 | @GET | 86 | @GET |
86 | @Path("{group_id}") | 87 | @Path("{group_id}") |
87 | @Produces(MediaType.APPLICATION_JSON) | 88 | @Produces(MediaType.APPLICATION_JSON) |
89 | + @Consumes(MediaType.APPLICATION_JSON) | ||
88 | public Response getPortPairGroup(@PathParam("group_id") String id) { | 90 | public Response getPortPairGroup(@PathParam("group_id") String id) { |
89 | PortPairGroup portPairGroup = nullIsNotFound(get(PortPairGroupService.class) | 91 | PortPairGroup portPairGroup = nullIsNotFound(get(PortPairGroupService.class) |
90 | .getPortPairGroup(PortPairGroupId.of(id)), | 92 | .getPortPairGroup(PortPairGroupId.of(id)), |
... | @@ -157,6 +159,8 @@ public class PortPairGroupWebResource extends AbstractWebResource { | ... | @@ -157,6 +159,8 @@ public class PortPairGroupWebResource extends AbstractWebResource { |
157 | */ | 159 | */ |
158 | @Path("{group_id}") | 160 | @Path("{group_id}") |
159 | @DELETE | 161 | @DELETE |
162 | + @Produces(MediaType.APPLICATION_JSON) | ||
163 | + @Consumes(MediaType.APPLICATION_JSON) | ||
160 | public Response deletePortPairGroup(@PathParam("group_id") String id) { | 164 | public Response deletePortPairGroup(@PathParam("group_id") String id) { |
161 | log.debug("Deletes port pair group by identifier {}.", id); | 165 | log.debug("Deletes port pair group by identifier {}.", id); |
162 | PortPairGroupId portPairGroupId = PortPairGroupId.of(id); | 166 | PortPairGroupId portPairGroupId = PortPairGroupId.of(id); | ... | ... |
... | @@ -62,6 +62,7 @@ public class PortPairWebResource extends AbstractWebResource { | ... | @@ -62,6 +62,7 @@ public class PortPairWebResource extends AbstractWebResource { |
62 | */ | 62 | */ |
63 | @GET | 63 | @GET |
64 | @Produces(MediaType.APPLICATION_JSON) | 64 | @Produces(MediaType.APPLICATION_JSON) |
65 | + @Consumes(MediaType.APPLICATION_JSON) | ||
65 | public Response getPortPairs() { | 66 | public Response getPortPairs() { |
66 | Iterable<PortPair> portPairs = get(PortPairService.class).getPortPairs(); | 67 | Iterable<PortPair> portPairs = get(PortPairService.class).getPortPairs(); |
67 | ObjectNode result = mapper().createObjectNode(); | 68 | ObjectNode result = mapper().createObjectNode(); |
... | @@ -83,6 +84,7 @@ public class PortPairWebResource extends AbstractWebResource { | ... | @@ -83,6 +84,7 @@ public class PortPairWebResource extends AbstractWebResource { |
83 | @GET | 84 | @GET |
84 | @Path("{pair_id}") | 85 | @Path("{pair_id}") |
85 | @Produces(MediaType.APPLICATION_JSON) | 86 | @Produces(MediaType.APPLICATION_JSON) |
87 | + @Consumes(MediaType.APPLICATION_JSON) | ||
86 | public Response getPortPair(@PathParam("pair_id") String id) { | 88 | public Response getPortPair(@PathParam("pair_id") String id) { |
87 | PortPair portPair = nullIsNotFound(get(PortPairService.class).getPortPair(PortPairId.of(id)), | 89 | PortPair portPair = nullIsNotFound(get(PortPairService.class).getPortPair(PortPairId.of(id)), |
88 | PORT_PAIR_NOT_FOUND); | 90 | PORT_PAIR_NOT_FOUND); |
... | @@ -149,6 +151,8 @@ public class PortPairWebResource extends AbstractWebResource { | ... | @@ -149,6 +151,8 @@ public class PortPairWebResource extends AbstractWebResource { |
149 | */ | 151 | */ |
150 | @Path("{pair_id}") | 152 | @Path("{pair_id}") |
151 | @DELETE | 153 | @DELETE |
154 | + @Produces(MediaType.APPLICATION_JSON) | ||
155 | + @Consumes(MediaType.APPLICATION_JSON) | ||
152 | public Response deletePortPair(@PathParam("pair_id") String id) { | 156 | public Response deletePortPair(@PathParam("pair_id") String id) { |
153 | 157 | ||
154 | PortPairId portPairId = PortPairId.of(id); | 158 | PortPairId portPairId = PortPairId.of(id); | ... | ... |
... | @@ -83,6 +83,7 @@ public class RouterWebResource extends AbstractWebResource { | ... | @@ -83,6 +83,7 @@ public class RouterWebResource extends AbstractWebResource { |
83 | 83 | ||
84 | @GET | 84 | @GET |
85 | @Produces(MediaType.APPLICATION_JSON) | 85 | @Produces(MediaType.APPLICATION_JSON) |
86 | + @Consumes(MediaType.APPLICATION_JSON) | ||
86 | public Response listRouters() { | 87 | public Response listRouters() { |
87 | Collection<Router> routers = get(RouterService.class).getRouters(); | 88 | Collection<Router> routers = get(RouterService.class).getRouters(); |
88 | ObjectNode result = new ObjectMapper().createObjectNode(); | 89 | ObjectNode result = new ObjectMapper().createObjectNode(); |
... | @@ -93,6 +94,7 @@ public class RouterWebResource extends AbstractWebResource { | ... | @@ -93,6 +94,7 @@ public class RouterWebResource extends AbstractWebResource { |
93 | @GET | 94 | @GET |
94 | @Path("{routerUUID}") | 95 | @Path("{routerUUID}") |
95 | @Produces(MediaType.APPLICATION_JSON) | 96 | @Produces(MediaType.APPLICATION_JSON) |
97 | + @Consumes(MediaType.APPLICATION_JSON) | ||
96 | public Response getRouter(@PathParam("routerUUID") String id, | 98 | public Response getRouter(@PathParam("routerUUID") String id, |
97 | @QueryParam("fields") List<String> fields) { | 99 | @QueryParam("fields") List<String> fields) { |
98 | 100 | ... | ... |
... | @@ -75,6 +75,7 @@ public class SubnetWebResource extends AbstractWebResource { | ... | @@ -75,6 +75,7 @@ public class SubnetWebResource extends AbstractWebResource { |
75 | 75 | ||
76 | @GET | 76 | @GET |
77 | @Produces(MediaType.APPLICATION_JSON) | 77 | @Produces(MediaType.APPLICATION_JSON) |
78 | + @Consumes(MediaType.APPLICATION_JSON) | ||
78 | public Response listSubnets() { | 79 | public Response listSubnets() { |
79 | Iterable<Subnet> subnets = get(SubnetService.class).getSubnets(); | 80 | Iterable<Subnet> subnets = get(SubnetService.class).getSubnets(); |
80 | ObjectNode result = new ObjectMapper().createObjectNode(); | 81 | ObjectNode result = new ObjectMapper().createObjectNode(); |
... | @@ -85,6 +86,7 @@ public class SubnetWebResource extends AbstractWebResource { | ... | @@ -85,6 +86,7 @@ public class SubnetWebResource extends AbstractWebResource { |
85 | @GET | 86 | @GET |
86 | @Path("{subnetUUID}") | 87 | @Path("{subnetUUID}") |
87 | @Produces(MediaType.APPLICATION_JSON) | 88 | @Produces(MediaType.APPLICATION_JSON) |
89 | + @Consumes(MediaType.APPLICATION_JSON) | ||
88 | public Response getSubnet(@PathParam("subnetUUID") String id) { | 90 | public Response getSubnet(@PathParam("subnetUUID") String id) { |
89 | 91 | ||
90 | if (!get(SubnetService.class).exists(SubnetId.subnetId(id))) { | 92 | if (!get(SubnetService.class).exists(SubnetId.subnetId(id))) { | ... | ... |
... | @@ -77,7 +77,8 @@ public class TenantNetworkWebResource extends AbstractWebResource { | ... | @@ -77,7 +77,8 @@ public class TenantNetworkWebResource extends AbstractWebResource { |
77 | .newConcurrentMap(); | 77 | .newConcurrentMap(); |
78 | 78 | ||
79 | @GET | 79 | @GET |
80 | - @Produces({ MediaType.APPLICATION_JSON }) | 80 | + @Produces(MediaType.APPLICATION_JSON) |
81 | + @Consumes(MediaType.APPLICATION_JSON) | ||
81 | public Response getNetworks(@QueryParam("id") String queryId, | 82 | public Response getNetworks(@QueryParam("id") String queryId, |
82 | @QueryParam("name") String queryName, | 83 | @QueryParam("name") String queryName, |
83 | @QueryParam("admin_state_up") String queryadminStateUp, | 84 | @QueryParam("admin_state_up") String queryadminStateUp, |
... | @@ -144,7 +145,8 @@ public class TenantNetworkWebResource extends AbstractWebResource { | ... | @@ -144,7 +145,8 @@ public class TenantNetworkWebResource extends AbstractWebResource { |
144 | 145 | ||
145 | @GET | 146 | @GET |
146 | @Path("{id}") | 147 | @Path("{id}") |
147 | - @Produces({ MediaType.APPLICATION_JSON }) | 148 | + @Produces(MediaType.APPLICATION_JSON) |
149 | + @Consumes(MediaType.APPLICATION_JSON) | ||
148 | public Response getNetwork(@PathParam("id") String id) { | 150 | public Response getNetwork(@PathParam("id") String id) { |
149 | 151 | ||
150 | if (!get(TenantNetworkService.class).exists(TenantNetworkId | 152 | if (!get(TenantNetworkService.class).exists(TenantNetworkId | ... | ... |
... | @@ -80,7 +80,8 @@ public class VirtualPortWebResource extends AbstractWebResource { | ... | @@ -80,7 +80,8 @@ public class VirtualPortWebResource extends AbstractWebResource { |
80 | .getLogger(VirtualPortService.class); | 80 | .getLogger(VirtualPortService.class); |
81 | 81 | ||
82 | @GET | 82 | @GET |
83 | - @Produces({ MediaType.APPLICATION_JSON }) | 83 | + @Produces(MediaType.APPLICATION_JSON) |
84 | + @Consumes(MediaType.APPLICATION_JSON) | ||
84 | public Response getPorts() { | 85 | public Response getPorts() { |
85 | Iterable<VirtualPort> virtualPorts = get(VirtualPortService.class) | 86 | Iterable<VirtualPort> virtualPorts = get(VirtualPortService.class) |
86 | .getPorts(); | 87 | .getPorts(); |
... | @@ -91,7 +92,8 @@ public class VirtualPortWebResource extends AbstractWebResource { | ... | @@ -91,7 +92,8 @@ public class VirtualPortWebResource extends AbstractWebResource { |
91 | 92 | ||
92 | @GET | 93 | @GET |
93 | @Path("{id}") | 94 | @Path("{id}") |
94 | - @Produces({ MediaType.APPLICATION_JSON }) | 95 | + @Produces(MediaType.APPLICATION_JSON) |
96 | + @Consumes(MediaType.APPLICATION_JSON) | ||
95 | public Response getportsById(@PathParam("id") String id) { | 97 | public Response getportsById(@PathParam("id") String id) { |
96 | 98 | ||
97 | if (!get(VirtualPortService.class).exists(VirtualPortId.portId(id))) { | 99 | if (!get(VirtualPortService.class).exists(VirtualPortId.portId(id))) { | ... | ... |
-
Please register or login to post a comment