Explicitly return NO CONTENT type response for http DELETE request
Change-Id: I920084b92197bb1687e7d978ad350b2e1290ecbc
Showing
38 changed files
with
263 additions
and
272 deletions
... | @@ -113,25 +113,25 @@ public class AclWebResource extends AbstractWebResource { | ... | @@ -113,25 +113,25 @@ public class AclWebResource extends AbstractWebResource { |
113 | * Remove ACL rule. | 113 | * Remove ACL rule. |
114 | * | 114 | * |
115 | * @param id ACL rule id (in hex string format) | 115 | * @param id ACL rule id (in hex string format) |
116 | - * @return 200 OK | 116 | + * @return 204 NO CONTENT |
117 | */ | 117 | */ |
118 | @DELETE | 118 | @DELETE |
119 | @Path("{id}") | 119 | @Path("{id}") |
120 | public Response removeAclRule(@PathParam("id") String id) { | 120 | public Response removeAclRule(@PathParam("id") String id) { |
121 | RuleId ruleId = new RuleId(Long.parseLong(id.substring(2), 16)); | 121 | RuleId ruleId = new RuleId(Long.parseLong(id.substring(2), 16)); |
122 | get(AclService.class).removeAclRule(ruleId); | 122 | get(AclService.class).removeAclRule(ruleId); |
123 | - return Response.ok().build(); | 123 | + return Response.noContent().build(); |
124 | } | 124 | } |
125 | 125 | ||
126 | /** | 126 | /** |
127 | * Remove all ACL rules. | 127 | * Remove all ACL rules. |
128 | * | 128 | * |
129 | - * @return 200 OK | 129 | + * @return 204 NO CONTENT |
130 | */ | 130 | */ |
131 | @DELETE | 131 | @DELETE |
132 | public Response clearAcl() { | 132 | public Response clearAcl() { |
133 | get(AclService.class).clearAcl(); | 133 | get(AclService.class).clearAcl(); |
134 | - return Response.ok().build(); | 134 | + return Response.noContent().build(); |
135 | } | 135 | } |
136 | 136 | ||
137 | /** | 137 | /** | ... | ... |
... | @@ -58,10 +58,8 @@ public class NeutronMl2NetworksWebResource extends AbstractWebResource { | ... | @@ -58,10 +58,8 @@ public class NeutronMl2NetworksWebResource extends AbstractWebResource { |
58 | 58 | ||
59 | @DELETE | 59 | @DELETE |
60 | @Path("{id}") | 60 | @Path("{id}") |
61 | - @Consumes(MediaType.APPLICATION_JSON) | ||
62 | - @Produces(MediaType.APPLICATION_JSON) | ||
63 | public Response deleteNetwork(@PathParam("id") String id) { | 61 | public Response deleteNetwork(@PathParam("id") String id) { |
64 | log.trace(String.format(NETWORKS_MESSAGE, "delete")); | 62 | log.trace(String.format(NETWORKS_MESSAGE, "delete")); |
65 | - return Response.status(Response.Status.OK).build(); | 63 | + return Response.noContent().build(); |
66 | } | 64 | } |
67 | } | 65 | } | ... | ... |
... | @@ -108,10 +108,8 @@ public class NeutronMl2PortsWebResource extends AbstractWebResource { | ... | @@ -108,10 +108,8 @@ public class NeutronMl2PortsWebResource extends AbstractWebResource { |
108 | 108 | ||
109 | @Path("{id}") | 109 | @Path("{id}") |
110 | @DELETE | 110 | @DELETE |
111 | - @Consumes(MediaType.APPLICATION_JSON) | ||
112 | - @Produces(MediaType.APPLICATION_JSON) | ||
113 | public Response deletePorts(@PathParam("id") String id) { | 111 | public Response deletePorts(@PathParam("id") String id) { |
114 | log.trace(String.format(PORTS_MESSAGE, "delete")); | 112 | log.trace(String.format(PORTS_MESSAGE, "delete")); |
115 | - return Response.status(Response.Status.OK).build(); | 113 | + return Response.noContent().build(); |
116 | } | 114 | } |
117 | } | 115 | } | ... | ... |
... | @@ -60,10 +60,8 @@ public class NeutronMl2SubnetsWebResource extends AbstractWebResource { | ... | @@ -60,10 +60,8 @@ public class NeutronMl2SubnetsWebResource extends AbstractWebResource { |
60 | 60 | ||
61 | @DELETE | 61 | @DELETE |
62 | @Path("{id}") | 62 | @Path("{id}") |
63 | - @Consumes(MediaType.APPLICATION_JSON) | ||
64 | - @Produces(MediaType.APPLICATION_JSON) | ||
65 | public Response deleteSubnet(@PathParam("id") String id) { | 63 | public Response deleteSubnet(@PathParam("id") String id) { |
66 | log.trace(String.format(SUBNETS_MESSAGE, "delete")); | 64 | log.trace(String.format(SUBNETS_MESSAGE, "delete")); |
67 | - return Response.status(Response.Status.OK).build(); | 65 | + return Response.noContent().build(); |
68 | } | 66 | } |
69 | } | 67 | } | ... | ... |
... | @@ -79,14 +79,13 @@ public class ServiceDependencyWebResource extends AbstractWebResource { | ... | @@ -79,14 +79,13 @@ public class ServiceDependencyWebResource extends AbstractWebResource { |
79 | * | 79 | * |
80 | * @param tServiceId tenant service id | 80 | * @param tServiceId tenant service id |
81 | * @param pServiceId provider service id | 81 | * @param pServiceId provider service id |
82 | - * @return 200 OK, or 400 Bad Request | 82 | + * @return 204 NO CONTENT |
83 | */ | 83 | */ |
84 | @DELETE | 84 | @DELETE |
85 | @Path("{tenantServiceId}/{providerServiceId}") | 85 | @Path("{tenantServiceId}/{providerServiceId}") |
86 | - @Produces(MediaType.APPLICATION_JSON) | ||
87 | public Response removeServiceDependency(@PathParam("tenantServiceId") String tServiceId, | 86 | public Response removeServiceDependency(@PathParam("tenantServiceId") String tServiceId, |
88 | @PathParam("providerServiceId") String pServiceId) { | 87 | @PathParam("providerServiceId") String pServiceId) { |
89 | service.removeServiceDependency(CordServiceId.of(tServiceId), CordServiceId.of(pServiceId)); | 88 | service.removeServiceDependency(CordServiceId.of(tServiceId), CordServiceId.of(pServiceId)); |
90 | - return Response.status(Response.Status.OK).build(); | 89 | + return Response.noContent().build(); |
91 | } | 90 | } |
92 | } | 91 | } | ... | ... |
... | @@ -14,11 +14,15 @@ | ... | @@ -14,11 +14,15 @@ |
14 | */ | 14 | */ |
15 | package org.onosproject.kafkaintegration.rest; | 15 | package org.onosproject.kafkaintegration.rest; |
16 | 16 | ||
17 | -import static com.google.common.base.Preconditions.checkNotNull; | 17 | +import com.fasterxml.jackson.databind.ObjectMapper; |
18 | -import static javax.ws.rs.core.Response.Status.BAD_REQUEST; | 18 | +import com.fasterxml.jackson.databind.node.ObjectNode; |
19 | - | 19 | +import org.onosproject.codec.JsonCodec; |
20 | -import java.io.IOException; | 20 | +import org.onosproject.kafkaintegration.api.EventExporterService; |
21 | -import java.io.InputStream; | 21 | +import org.onosproject.kafkaintegration.api.dto.EventSubscriber; |
22 | +import org.onosproject.kafkaintegration.api.dto.EventSubscriberGroupId; | ||
23 | +import org.onosproject.rest.AbstractWebResource; | ||
24 | +import org.slf4j.Logger; | ||
25 | +import org.slf4j.LoggerFactory; | ||
22 | 26 | ||
23 | import javax.ws.rs.Consumes; | 27 | import javax.ws.rs.Consumes; |
24 | import javax.ws.rs.DELETE; | 28 | import javax.ws.rs.DELETE; |
... | @@ -27,17 +31,11 @@ import javax.ws.rs.Path; | ... | @@ -27,17 +31,11 @@ import javax.ws.rs.Path; |
27 | import javax.ws.rs.Produces; | 31 | import javax.ws.rs.Produces; |
28 | import javax.ws.rs.core.MediaType; | 32 | import javax.ws.rs.core.MediaType; |
29 | import javax.ws.rs.core.Response; | 33 | import javax.ws.rs.core.Response; |
34 | +import java.io.IOException; | ||
35 | +import java.io.InputStream; | ||
30 | 36 | ||
31 | -import org.onosproject.codec.JsonCodec; | 37 | +import static com.google.common.base.Preconditions.checkNotNull; |
32 | -import org.onosproject.kafkaintegration.api.EventExporterService; | 38 | +import static javax.ws.rs.core.Response.Status.BAD_REQUEST; |
33 | -import org.onosproject.kafkaintegration.api.dto.EventSubscriber; | ||
34 | -import org.onosproject.kafkaintegration.api.dto.EventSubscriberGroupId; | ||
35 | -import org.onosproject.rest.AbstractWebResource; | ||
36 | -import org.slf4j.Logger; | ||
37 | -import org.slf4j.LoggerFactory; | ||
38 | - | ||
39 | -import com.fasterxml.jackson.databind.ObjectMapper; | ||
40 | -import com.fasterxml.jackson.databind.node.ObjectNode; | ||
41 | 39 | ||
42 | /** | 40 | /** |
43 | * Rest Interfaces for subscribing/unsubscribing to event notifications. | 41 | * Rest Interfaces for subscribing/unsubscribing to event notifications. |
... | @@ -85,8 +83,6 @@ public class EventExporterWebResource extends AbstractWebResource { | ... | @@ -85,8 +83,6 @@ public class EventExporterWebResource extends AbstractWebResource { |
85 | * @onos.rsModel KafkaRegistration | 83 | * @onos.rsModel KafkaRegistration |
86 | */ | 84 | */ |
87 | @DELETE | 85 | @DELETE |
88 | - @Produces(MediaType.APPLICATION_JSON) | ||
89 | - @Consumes(MediaType.APPLICATION_JSON) | ||
90 | @Path("unregister") | 86 | @Path("unregister") |
91 | public Response removeKafkaListener(String appName) { | 87 | public Response removeKafkaListener(String appName) { |
92 | EventExporterService service = get(EventExporterService.class); | 88 | EventExporterService service = get(EventExporterService.class); |
... | @@ -148,7 +144,7 @@ public class EventExporterWebResource extends AbstractWebResource { | ... | @@ -148,7 +144,7 @@ public class EventExporterWebResource extends AbstractWebResource { |
148 | * @onos.rsModel KafkaSubscription | 144 | * @onos.rsModel KafkaSubscription |
149 | */ | 145 | */ |
150 | @DELETE | 146 | @DELETE |
151 | - @Produces(MediaType.APPLICATION_JSON) | 147 | + @Consumes(MediaType.APPLICATION_JSON) |
152 | @Path("unsubscribe") | 148 | @Path("unsubscribe") |
153 | public Response unsubscribe(InputStream input) { | 149 | public Response unsubscribe(InputStream input) { |
154 | 150 | ... | ... |
... | @@ -66,10 +66,9 @@ public class OltWebResource extends AbstractWebResource { | ... | @@ -66,10 +66,9 @@ public class OltWebResource extends AbstractWebResource { |
66 | * | 66 | * |
67 | * @param device device id | 67 | * @param device device id |
68 | * @param port port number | 68 | * @param port port number |
69 | - * @return 200 OK | 69 | + * @return 204 NO CONTENT |
70 | */ | 70 | */ |
71 | @DELETE | 71 | @DELETE |
72 | - @Produces(MediaType.APPLICATION_JSON) | ||
73 | @Path("{device}/{port}") | 72 | @Path("{device}/{port}") |
74 | public Response removeSubscriber( | 73 | public Response removeSubscriber( |
75 | @PathParam("device")String device, | 74 | @PathParam("device")String device, |
... | @@ -79,6 +78,6 @@ public class OltWebResource extends AbstractWebResource { | ... | @@ -79,6 +78,6 @@ public class OltWebResource extends AbstractWebResource { |
79 | PortNumber portNumber = PortNumber.portNumber(port); | 78 | PortNumber portNumber = PortNumber.portNumber(port); |
80 | ConnectPoint connectPoint = new ConnectPoint(deviceId, portNumber); | 79 | ConnectPoint connectPoint = new ConnectPoint(deviceId, portNumber); |
81 | service.removeSubscriber(connectPoint); | 80 | service.removeSubscriber(connectPoint); |
82 | - return ok("").build(); | 81 | + return Response.noContent().build(); |
83 | } | 82 | } |
84 | } | 83 | } | ... | ... |
... | @@ -143,7 +143,6 @@ public class OpensatckRouterWebResource extends AbstractWebResource { | ... | @@ -143,7 +143,6 @@ public class OpensatckRouterWebResource extends AbstractWebResource { |
143 | 143 | ||
144 | @DELETE | 144 | @DELETE |
145 | @Path("{id}") | 145 | @Path("{id}") |
146 | - @Produces(MediaType.APPLICATION_JSON) | ||
147 | public Response deleteRouter(@PathParam("id") String id) { | 146 | public Response deleteRouter(@PathParam("id") String id) { |
148 | checkNotNull(id); | 147 | checkNotNull(id); |
149 | OpenstackRoutingService routingService | 148 | OpenstackRoutingService routingService |
... | @@ -151,7 +150,7 @@ public class OpensatckRouterWebResource extends AbstractWebResource { | ... | @@ -151,7 +150,7 @@ public class OpensatckRouterWebResource extends AbstractWebResource { |
151 | routingService.deleteRouter(id); | 150 | routingService.deleteRouter(id); |
152 | 151 | ||
153 | log.debug("REST API DELETE routers is called {}", id); | 152 | log.debug("REST API DELETE routers is called {}", id); |
154 | - return Response.status(Response.Status.OK).build(); | 153 | + return Response.noContent().build(); |
155 | } | 154 | } |
156 | 155 | ||
157 | @PUT | 156 | @PUT | ... | ... |
... | @@ -125,7 +125,7 @@ public class OpenstackFloatingIpWebResource extends AbstractWebResource { | ... | @@ -125,7 +125,7 @@ public class OpenstackFloatingIpWebResource extends AbstractWebResource { |
125 | * Delete FloatingIP. | 125 | * Delete FloatingIP. |
126 | * | 126 | * |
127 | * @param id FloatingIP identifier | 127 | * @param id FloatingIP identifier |
128 | - * @return 200 OK | 128 | + * @return 204 OK |
129 | */ | 129 | */ |
130 | @DELETE | 130 | @DELETE |
131 | @Path("{id}") | 131 | @Path("{id}") |
... | @@ -139,7 +139,7 @@ public class OpenstackFloatingIpWebResource extends AbstractWebResource { | ... | @@ -139,7 +139,7 @@ public class OpenstackFloatingIpWebResource extends AbstractWebResource { |
139 | 139 | ||
140 | log.debug("REST API DELETE floatingip is called {}", id); | 140 | log.debug("REST API DELETE floatingip is called {}", id); |
141 | 141 | ||
142 | - return Response.status(Response.Status.OK).build(); | 142 | + return Response.noContent().build(); |
143 | } | 143 | } |
144 | 144 | ||
145 | } | 145 | } | ... | ... |
... | @@ -57,9 +57,8 @@ public class OpenstackNetworkWebResource extends AbstractWebResource { | ... | @@ -57,9 +57,8 @@ public class OpenstackNetworkWebResource extends AbstractWebResource { |
57 | @DELETE | 57 | @DELETE |
58 | @Path("{id}") | 58 | @Path("{id}") |
59 | @Consumes(MediaType.APPLICATION_JSON) | 59 | @Consumes(MediaType.APPLICATION_JSON) |
60 | - @Produces(MediaType.APPLICATION_JSON) | ||
61 | public Response deleteNetwork(InputStream input) { | 60 | public Response deleteNetwork(InputStream input) { |
62 | log.debug("REST API networks is called {}", input.toString()); | 61 | log.debug("REST API networks is called {}", input.toString()); |
63 | - return Response.status(Response.Status.OK).build(); | 62 | + return Response.noContent().build(); |
64 | } | 63 | } |
65 | } | 64 | } | ... | ... |
... | @@ -72,7 +72,6 @@ public class OpenstackPortWebResource extends AbstractWebResource { | ... | @@ -72,7 +72,6 @@ public class OpenstackPortWebResource extends AbstractWebResource { |
72 | } | 72 | } |
73 | 73 | ||
74 | @Path("{portUUID}") | 74 | @Path("{portUUID}") |
75 | - @Produces(MediaType.APPLICATION_JSON) | ||
76 | @DELETE | 75 | @DELETE |
77 | public Response deletePorts(@PathParam("portUUID") String id) { | 76 | public Response deletePorts(@PathParam("portUUID") String id) { |
78 | OpenstackSwitchingService switchingService = | 77 | OpenstackSwitchingService switchingService = |
... | @@ -85,7 +84,7 @@ public class OpenstackPortWebResource extends AbstractWebResource { | ... | @@ -85,7 +84,7 @@ public class OpenstackPortWebResource extends AbstractWebResource { |
85 | 84 | ||
86 | switchingService.removePort(id); | 85 | switchingService.removePort(id); |
87 | 86 | ||
88 | - return Response.status(Response.Status.OK).build(); | 87 | + return Response.noContent().build(); |
89 | } | 88 | } |
90 | 89 | ||
91 | @PUT | 90 | @PUT | ... | ... |
... | @@ -57,10 +57,7 @@ public class OpenstackSubnetWebResource extends AbstractWebResource { | ... | @@ -57,10 +57,7 @@ public class OpenstackSubnetWebResource extends AbstractWebResource { |
57 | 57 | ||
58 | @DELETE | 58 | @DELETE |
59 | @Path("{subnetId}") | 59 | @Path("{subnetId}") |
60 | - @Produces(MediaType.APPLICATION_JSON) | ||
61 | public Response deleteSubnet(@PathParam("subnetId") String id) { | 60 | public Response deleteSubnet(@PathParam("subnetId") String id) { |
62 | - return Response.status(Response.Status.OK).build(); | 61 | + return Response.noContent().build(); |
63 | } | 62 | } |
64 | - | ||
65 | - | ||
66 | } | 63 | } | ... | ... |
... | @@ -64,7 +64,6 @@ public class PolicyWebResource extends AbstractWebResource { | ... | @@ -64,7 +64,6 @@ public class PolicyWebResource extends AbstractWebResource { |
64 | * | 64 | * |
65 | * @param input JSON stream for policy to create | 65 | * @param input JSON stream for policy to create |
66 | * @return status of the request - OK if the policy is created, | 66 | * @return status of the request - OK if the policy is created, |
67 | - * INTERNAL_SERVER_ERROR if the JSON is invalid or the policy cannot be created | ||
68 | * @throws IOException if JSON processing fails | 67 | * @throws IOException if JSON processing fails |
69 | */ | 68 | */ |
70 | @POST | 69 | @POST |
... | @@ -87,8 +86,7 @@ public class PolicyWebResource extends AbstractWebResource { | ... | @@ -87,8 +86,7 @@ public class PolicyWebResource extends AbstractWebResource { |
87 | * Delete a segment routing policy. | 86 | * Delete a segment routing policy. |
88 | * | 87 | * |
89 | * @param input JSON stream for policy to delete | 88 | * @param input JSON stream for policy to delete |
90 | - * @return status of the request - OK if the policy is removed, | 89 | + * @return 204 NO CONTENT if the policy is removed |
91 | - * INTERNAL_SERVER_ERROR otherwise | ||
92 | * @throws IOException if JSON is invalid | 90 | * @throws IOException if JSON is invalid |
93 | */ | 91 | */ |
94 | @DELETE | 92 | @DELETE |
... | @@ -101,8 +99,7 @@ public class PolicyWebResource extends AbstractWebResource { | ... | @@ -101,8 +99,7 @@ public class PolicyWebResource extends AbstractWebResource { |
101 | // TODO: Check the result | 99 | // TODO: Check the result |
102 | srService.removePolicy(policyInfo); | 100 | srService.removePolicy(policyInfo); |
103 | 101 | ||
104 | - return Response.ok().build(); | 102 | + return Response.noContent().build(); |
105 | - | ||
106 | } | 103 | } |
107 | 104 | ||
108 | } | 105 | } | ... | ... |
... | @@ -64,7 +64,6 @@ public class TunnelWebResource extends AbstractWebResource { | ... | @@ -64,7 +64,6 @@ public class TunnelWebResource extends AbstractWebResource { |
64 | * | 64 | * |
65 | * @param input JSON stream for tunnel to create | 65 | * @param input JSON stream for tunnel to create |
66 | * @return status of the request - OK if the tunnel is created, | 66 | * @return status of the request - OK if the tunnel is created, |
67 | - * INTERNAL_SERVER_ERROR if the JSON is invalid or the tunnel cannot be created | ||
68 | * @throws IOException if the JSON is invalid | 67 | * @throws IOException if the JSON is invalid |
69 | */ | 68 | */ |
70 | @POST | 69 | @POST |
... | @@ -83,8 +82,7 @@ public class TunnelWebResource extends AbstractWebResource { | ... | @@ -83,8 +82,7 @@ public class TunnelWebResource extends AbstractWebResource { |
83 | * Delete a segment routing tunnel. | 82 | * Delete a segment routing tunnel. |
84 | * | 83 | * |
85 | * @param input JSON stream for tunnel to delete | 84 | * @param input JSON stream for tunnel to delete |
86 | - * @return status of the request - OK if the tunnel is removed, | 85 | + * @return 204 NO CONTENT, if the tunnel is removed |
87 | - * INTERNAL_SERVER_ERROR otherwise | ||
88 | * @throws IOException if JSON is invalid | 86 | * @throws IOException if JSON is invalid |
89 | */ | 87 | */ |
90 | @DELETE | 88 | @DELETE |
... | @@ -96,7 +94,7 @@ public class TunnelWebResource extends AbstractWebResource { | ... | @@ -96,7 +94,7 @@ public class TunnelWebResource extends AbstractWebResource { |
96 | Tunnel tunnelInfo = TUNNEL_CODEC.decode(tunnelJson, this); | 94 | Tunnel tunnelInfo = TUNNEL_CODEC.decode(tunnelJson, this); |
97 | srService.removeTunnel(tunnelInfo); | 95 | srService.removeTunnel(tunnelInfo); |
98 | 96 | ||
99 | - return Response.ok().build(); | 97 | + return Response.noContent().build(); |
100 | } | 98 | } |
101 | 99 | ||
102 | } | 100 | } | ... | ... |
... | @@ -89,15 +89,16 @@ public class VbngResource extends AbstractWebResource { | ... | @@ -89,15 +89,16 @@ public class VbngResource extends AbstractWebResource { |
89 | * Delete a virtual BNG connection. | 89 | * Delete a virtual BNG connection. |
90 | * | 90 | * |
91 | * @param privateIp IP Address for the BNG private network | 91 | * @param privateIp IP Address for the BNG private network |
92 | - * @return public IP address for the new connection | 92 | + * @return 200 OK |
93 | */ | 93 | */ |
94 | @DELETE | 94 | @DELETE |
95 | @Path("{privateip}") | 95 | @Path("{privateip}") |
96 | - public String privateIpDeleteNotification(@PathParam("privateip") | 96 | + public Response privateIpDeleteNotification(@PathParam("privateip") |
97 | String privateIp) { | 97 | String privateIp) { |
98 | + String result; | ||
98 | if (privateIp == null) { | 99 | if (privateIp == null) { |
99 | log.info("Private IP address to delete is null"); | 100 | log.info("Private IP address to delete is null"); |
100 | - return "0"; | 101 | + result = "0"; |
101 | } | 102 | } |
102 | log.info("Received a private IP address : {} to delete", privateIp); | 103 | log.info("Received a private IP address : {} to delete", privateIp); |
103 | IpAddress privateIpAddress = IpAddress.valueOf(privateIp); | 104 | IpAddress privateIpAddress = IpAddress.valueOf(privateIp); |
... | @@ -109,10 +110,11 @@ public class VbngResource extends AbstractWebResource { | ... | @@ -109,10 +110,11 @@ public class VbngResource extends AbstractWebResource { |
109 | assignedPublicIpAddress = vbngService.deleteVbng(privateIpAddress); | 110 | assignedPublicIpAddress = vbngService.deleteVbng(privateIpAddress); |
110 | 111 | ||
111 | if (assignedPublicIpAddress != null) { | 112 | if (assignedPublicIpAddress != null) { |
112 | - return assignedPublicIpAddress.toString(); | 113 | + result = assignedPublicIpAddress.toString(); |
113 | } else { | 114 | } else { |
114 | - return "0"; | 115 | + result = "0"; |
115 | } | 116 | } |
117 | + return Response.ok().entity(result).build(); | ||
116 | } | 118 | } |
117 | 119 | ||
118 | /** | 120 | /** | ... | ... |
... | @@ -15,54 +15,51 @@ | ... | @@ -15,54 +15,51 @@ |
15 | */ | 15 | */ |
16 | package org.onosproject.vtnweb.resources; | 16 | package org.onosproject.vtnweb.resources; |
17 | 17 | ||
18 | -import static com.google.common.base.Preconditions.checkNotNull; | 18 | +import com.fasterxml.jackson.databind.JsonNode; |
19 | -import static javax.ws.rs.core.Response.Status.BAD_REQUEST; | 19 | +import com.fasterxml.jackson.databind.ObjectMapper; |
20 | -import static javax.ws.rs.core.Response.Status.NOT_FOUND; | 20 | +import com.fasterxml.jackson.databind.node.ObjectNode; |
21 | -import static javax.ws.rs.core.Response.Status.CREATED; | 21 | +import com.google.common.collect.Sets; |
22 | -import static javax.ws.rs.core.Response.Status.CONFLICT; | ||
23 | -import static javax.ws.rs.core.Response.Status.NO_CONTENT; | ||
24 | - | ||
25 | -import java.io.IOException; | ||
26 | -import java.io.InputStream; | ||
27 | -import java.util.Collection; | ||
28 | -import java.util.Collections; | ||
29 | -import java.util.HashMap; | ||
30 | -import java.util.List; | ||
31 | -import java.util.Map; | ||
32 | -import java.util.Set; | ||
33 | - | ||
34 | -import javax.ws.rs.Consumes; | ||
35 | -import javax.ws.rs.DELETE; | ||
36 | -import javax.ws.rs.GET; | ||
37 | -import javax.ws.rs.POST; | ||
38 | -import javax.ws.rs.PUT; | ||
39 | -import javax.ws.rs.Path; | ||
40 | -import javax.ws.rs.PathParam; | ||
41 | -import javax.ws.rs.Produces; | ||
42 | -import javax.ws.rs.QueryParam; | ||
43 | -import javax.ws.rs.core.MediaType; | ||
44 | -import javax.ws.rs.core.Response; | ||
45 | - | ||
46 | import org.onlab.packet.IpAddress; | 22 | import org.onlab.packet.IpAddress; |
47 | import org.onlab.util.ItemNotFoundException; | 23 | import org.onlab.util.ItemNotFoundException; |
48 | import org.onosproject.rest.AbstractWebResource; | 24 | import org.onosproject.rest.AbstractWebResource; |
49 | import org.onosproject.vtnrsc.DefaultFloatingIp; | 25 | import org.onosproject.vtnrsc.DefaultFloatingIp; |
50 | import org.onosproject.vtnrsc.FloatingIp; | 26 | import org.onosproject.vtnrsc.FloatingIp; |
27 | +import org.onosproject.vtnrsc.FloatingIp.Status; | ||
51 | import org.onosproject.vtnrsc.FloatingIpId; | 28 | import org.onosproject.vtnrsc.FloatingIpId; |
29 | +import org.onosproject.vtnrsc.RouterId; | ||
52 | import org.onosproject.vtnrsc.TenantId; | 30 | import org.onosproject.vtnrsc.TenantId; |
53 | import org.onosproject.vtnrsc.TenantNetworkId; | 31 | import org.onosproject.vtnrsc.TenantNetworkId; |
54 | import org.onosproject.vtnrsc.VirtualPortId; | 32 | import org.onosproject.vtnrsc.VirtualPortId; |
55 | -import org.onosproject.vtnrsc.RouterId; | ||
56 | -import org.onosproject.vtnrsc.FloatingIp.Status; | ||
57 | import org.onosproject.vtnrsc.floatingip.FloatingIpService; | 33 | import org.onosproject.vtnrsc.floatingip.FloatingIpService; |
58 | import org.onosproject.vtnweb.web.FloatingIpCodec; | 34 | import org.onosproject.vtnweb.web.FloatingIpCodec; |
59 | import org.slf4j.Logger; | 35 | import org.slf4j.Logger; |
60 | import org.slf4j.LoggerFactory; | 36 | import org.slf4j.LoggerFactory; |
61 | 37 | ||
62 | -import com.fasterxml.jackson.databind.JsonNode; | 38 | +import javax.ws.rs.Consumes; |
63 | -import com.fasterxml.jackson.databind.ObjectMapper; | 39 | +import javax.ws.rs.DELETE; |
64 | -import com.fasterxml.jackson.databind.node.ObjectNode; | 40 | +import javax.ws.rs.GET; |
65 | -import com.google.common.collect.Sets; | 41 | +import javax.ws.rs.POST; |
42 | +import javax.ws.rs.PUT; | ||
43 | +import javax.ws.rs.Path; | ||
44 | +import javax.ws.rs.PathParam; | ||
45 | +import javax.ws.rs.Produces; | ||
46 | +import javax.ws.rs.QueryParam; | ||
47 | +import javax.ws.rs.core.MediaType; | ||
48 | +import javax.ws.rs.core.Response; | ||
49 | +import java.io.IOException; | ||
50 | +import java.io.InputStream; | ||
51 | +import java.util.Collection; | ||
52 | +import java.util.Collections; | ||
53 | +import java.util.HashMap; | ||
54 | +import java.util.List; | ||
55 | +import java.util.Map; | ||
56 | +import java.util.Set; | ||
57 | + | ||
58 | +import static com.google.common.base.Preconditions.checkNotNull; | ||
59 | +import static javax.ws.rs.core.Response.Status.BAD_REQUEST; | ||
60 | +import static javax.ws.rs.core.Response.Status.CONFLICT; | ||
61 | +import static javax.ws.rs.core.Response.Status.CREATED; | ||
62 | +import static javax.ws.rs.core.Response.Status.NOT_FOUND; | ||
66 | 63 | ||
67 | @Path("floatingips") | 64 | @Path("floatingips") |
68 | public class FloatingIpWebResource extends AbstractWebResource { | 65 | public class FloatingIpWebResource extends AbstractWebResource { |
... | @@ -165,7 +162,7 @@ public class FloatingIpWebResource extends AbstractWebResource { | ... | @@ -165,7 +162,7 @@ public class FloatingIpWebResource extends AbstractWebResource { |
165 | if (!result) { | 162 | if (!result) { |
166 | return Response.status(CONFLICT).entity(DELETE_FAIL).build(); | 163 | return Response.status(CONFLICT).entity(DELETE_FAIL).build(); |
167 | } | 164 | } |
168 | - return Response.status(NO_CONTENT).entity(DELETE_SUCCESS).build(); | 165 | + return Response.noContent().entity(DELETE_SUCCESS).build(); |
169 | } catch (Exception e) { | 166 | } catch (Exception e) { |
170 | return Response.status(NOT_FOUND).entity(e.getMessage()).build(); | 167 | return Response.status(NOT_FOUND).entity(e.getMessage()).build(); |
171 | } | 168 | } | ... | ... |
... | @@ -149,16 +149,16 @@ public class FlowClassifierWebResource extends AbstractWebResource { | ... | @@ -149,16 +149,16 @@ public class FlowClassifierWebResource extends AbstractWebResource { |
149 | /** | 149 | /** |
150 | * Delete details of a flow classifier. | 150 | * Delete details of a flow classifier. |
151 | * | 151 | * |
152 | - * @param id | 152 | + * @param id flow classifier id |
153 | - * flow classifier id | 153 | + * @return 204 NO CONTENT |
154 | */ | 154 | */ |
155 | @Path("{flow_id}") | 155 | @Path("{flow_id}") |
156 | @DELETE | 156 | @DELETE |
157 | - public void deleteFlowClassifier(@PathParam("flow_id") String id) { | 157 | + public Response deleteFlowClassifier(@PathParam("flow_id") String id) { |
158 | log.debug("Deletes flow classifier by identifier {}.", id); | 158 | log.debug("Deletes flow classifier by identifier {}.", id); |
159 | FlowClassifierId flowClassifierId = FlowClassifierId.of(id); | 159 | FlowClassifierId flowClassifierId = FlowClassifierId.of(id); |
160 | Boolean issuccess = nullIsNotFound(get(FlowClassifierService.class).removeFlowClassifier(flowClassifierId), | 160 | Boolean issuccess = nullIsNotFound(get(FlowClassifierService.class).removeFlowClassifier(flowClassifierId), |
161 | FLOW_CLASSIFIER_NOT_FOUND); | 161 | FLOW_CLASSIFIER_NOT_FOUND); |
162 | - | 162 | + return Response.noContent().build(); |
163 | } | 163 | } |
164 | } | 164 | } | ... | ... |
... | @@ -146,10 +146,11 @@ public class PortChainWebResource extends AbstractWebResource { | ... | @@ -146,10 +146,11 @@ public class PortChainWebResource extends AbstractWebResource { |
146 | * Delete details of a specified port chain id. | 146 | * Delete details of a specified port chain id. |
147 | * | 147 | * |
148 | * @param id port chain id | 148 | * @param id port chain id |
149 | + * @return 204 NO CONTENT | ||
149 | */ | 150 | */ |
150 | @Path("{chain_id}") | 151 | @Path("{chain_id}") |
151 | @DELETE | 152 | @DELETE |
152 | - public void deletePortPain(@PathParam("chain_id") String id) { | 153 | + public Response deletePortPain(@PathParam("chain_id") String id) { |
153 | log.debug("Deletes port chain by identifier {}.", id); | 154 | log.debug("Deletes port chain by identifier {}.", id); |
154 | PortChainId portChainId = PortChainId.of(id); | 155 | PortChainId portChainId = PortChainId.of(id); |
155 | 156 | ||
... | @@ -158,5 +159,6 @@ public class PortChainWebResource extends AbstractWebResource { | ... | @@ -158,5 +159,6 @@ public class PortChainWebResource extends AbstractWebResource { |
158 | if (!issuccess) { | 159 | if (!issuccess) { |
159 | log.debug("Port Chain identifier {} does not exist", id); | 160 | log.debug("Port Chain identifier {} does not exist", id); |
160 | } | 161 | } |
162 | + return Response.noContent().build(); | ||
161 | } | 163 | } |
162 | } | 164 | } | ... | ... |
... | @@ -153,10 +153,11 @@ public class PortPairGroupWebResource extends AbstractWebResource { | ... | @@ -153,10 +153,11 @@ public class PortPairGroupWebResource extends AbstractWebResource { |
153 | * Delete details of a specified port pair group id. | 153 | * Delete details of a specified port pair group id. |
154 | * | 154 | * |
155 | * @param id port pair group id | 155 | * @param id port pair group id |
156 | + * @return 204 NO CONTENT | ||
156 | */ | 157 | */ |
157 | @Path("{group_id}") | 158 | @Path("{group_id}") |
158 | @DELETE | 159 | @DELETE |
159 | - public void deletePortPairGroup(@PathParam("group_id") String id) { | 160 | + public Response deletePortPairGroup(@PathParam("group_id") String id) { |
160 | log.debug("Deletes port pair group by identifier {}.", id); | 161 | log.debug("Deletes port pair group by identifier {}.", id); |
161 | PortPairGroupId portPairGroupId = PortPairGroupId.of(id); | 162 | PortPairGroupId portPairGroupId = PortPairGroupId.of(id); |
162 | Boolean issuccess = nullIsNotFound(get(PortPairGroupService.class).removePortPairGroup(portPairGroupId), | 163 | Boolean issuccess = nullIsNotFound(get(PortPairGroupService.class).removePortPairGroup(portPairGroupId), |
... | @@ -164,5 +165,7 @@ public class PortPairGroupWebResource extends AbstractWebResource { | ... | @@ -164,5 +165,7 @@ public class PortPairGroupWebResource extends AbstractWebResource { |
164 | if (!issuccess) { | 165 | if (!issuccess) { |
165 | log.debug("Port pair group identifier {} does not exist", id); | 166 | log.debug("Port pair group identifier {} does not exist", id); |
166 | } | 167 | } |
168 | + | ||
169 | + return Response.noContent().build(); | ||
167 | } | 170 | } |
168 | } | 171 | } | ... | ... |
... | @@ -145,15 +145,17 @@ public class PortPairWebResource extends AbstractWebResource { | ... | @@ -145,15 +145,17 @@ public class PortPairWebResource extends AbstractWebResource { |
145 | * Delete details of a specified port pair id. | 145 | * Delete details of a specified port pair id. |
146 | * | 146 | * |
147 | * @param id port pair id | 147 | * @param id port pair id |
148 | + * @return 204 NO CONTENT | ||
148 | */ | 149 | */ |
149 | @Path("{pair_id}") | 150 | @Path("{pair_id}") |
150 | @DELETE | 151 | @DELETE |
151 | - public void deletePortPair(@PathParam("pair_id") String id) { | 152 | + public Response deletePortPair(@PathParam("pair_id") String id) { |
152 | 153 | ||
153 | PortPairId portPairId = PortPairId.of(id); | 154 | PortPairId portPairId = PortPairId.of(id); |
154 | Boolean isSuccess = nullIsNotFound(get(PortPairService.class).removePortPair(portPairId), PORT_PAIR_NOT_FOUND); | 155 | Boolean isSuccess = nullIsNotFound(get(PortPairService.class).removePortPair(portPairId), PORT_PAIR_NOT_FOUND); |
155 | if (!isSuccess) { | 156 | if (!isSuccess) { |
156 | log.debug("Port pair identifier {} does not exist", id); | 157 | log.debug("Port pair identifier {} does not exist", id); |
157 | } | 158 | } |
159 | + return Response.noContent().build(); | ||
158 | } | 160 | } |
159 | } | 161 | } | ... | ... |
... | @@ -15,37 +15,11 @@ | ... | @@ -15,37 +15,11 @@ |
15 | */ | 15 | */ |
16 | package org.onosproject.vtnweb.resources; | 16 | package org.onosproject.vtnweb.resources; |
17 | 17 | ||
18 | -import static com.google.common.base.Preconditions.checkArgument; | 18 | +import com.fasterxml.jackson.databind.JsonNode; |
19 | -import static com.google.common.base.Preconditions.checkNotNull; | 19 | +import com.fasterxml.jackson.databind.ObjectMapper; |
20 | -import static javax.ws.rs.core.Response.Status.BAD_REQUEST; | 20 | +import com.fasterxml.jackson.databind.node.ObjectNode; |
21 | -import static javax.ws.rs.core.Response.Status.CONFLICT; | 21 | +import com.google.common.collect.Maps; |
22 | -import static javax.ws.rs.core.Response.Status.CREATED; | 22 | +import com.google.common.collect.Sets; |
23 | -import static javax.ws.rs.core.Response.Status.NOT_FOUND; | ||
24 | -import static javax.ws.rs.core.Response.Status.NO_CONTENT; | ||
25 | - | ||
26 | -import java.io.IOException; | ||
27 | -import java.io.InputStream; | ||
28 | -import java.util.ArrayList; | ||
29 | -import java.util.Collection; | ||
30 | -import java.util.Collections; | ||
31 | -import java.util.HashMap; | ||
32 | -import java.util.List; | ||
33 | -import java.util.Map; | ||
34 | -import java.util.Set; | ||
35 | -import java.util.concurrent.ConcurrentMap; | ||
36 | - | ||
37 | -import javax.ws.rs.Consumes; | ||
38 | -import javax.ws.rs.DELETE; | ||
39 | -import javax.ws.rs.GET; | ||
40 | -import javax.ws.rs.POST; | ||
41 | -import javax.ws.rs.PUT; | ||
42 | -import javax.ws.rs.Path; | ||
43 | -import javax.ws.rs.PathParam; | ||
44 | -import javax.ws.rs.Produces; | ||
45 | -import javax.ws.rs.QueryParam; | ||
46 | -import javax.ws.rs.core.MediaType; | ||
47 | -import javax.ws.rs.core.Response; | ||
48 | - | ||
49 | import org.onlab.packet.IpAddress; | 23 | import org.onlab.packet.IpAddress; |
50 | import org.onlab.util.ItemNotFoundException; | 24 | import org.onlab.util.ItemNotFoundException; |
51 | import org.onosproject.rest.AbstractWebResource; | 25 | import org.onosproject.rest.AbstractWebResource; |
... | @@ -66,11 +40,34 @@ import org.onosproject.vtnweb.web.RouterCodec; | ... | @@ -66,11 +40,34 @@ import org.onosproject.vtnweb.web.RouterCodec; |
66 | import org.slf4j.Logger; | 40 | import org.slf4j.Logger; |
67 | import org.slf4j.LoggerFactory; | 41 | import org.slf4j.LoggerFactory; |
68 | 42 | ||
69 | -import com.fasterxml.jackson.databind.JsonNode; | 43 | +import javax.ws.rs.Consumes; |
70 | -import com.fasterxml.jackson.databind.ObjectMapper; | 44 | +import javax.ws.rs.DELETE; |
71 | -import com.fasterxml.jackson.databind.node.ObjectNode; | 45 | +import javax.ws.rs.GET; |
72 | -import com.google.common.collect.Maps; | 46 | +import javax.ws.rs.POST; |
73 | -import com.google.common.collect.Sets; | 47 | +import javax.ws.rs.PUT; |
48 | +import javax.ws.rs.Path; | ||
49 | +import javax.ws.rs.PathParam; | ||
50 | +import javax.ws.rs.Produces; | ||
51 | +import javax.ws.rs.QueryParam; | ||
52 | +import javax.ws.rs.core.MediaType; | ||
53 | +import javax.ws.rs.core.Response; | ||
54 | +import java.io.IOException; | ||
55 | +import java.io.InputStream; | ||
56 | +import java.util.ArrayList; | ||
57 | +import java.util.Collection; | ||
58 | +import java.util.Collections; | ||
59 | +import java.util.HashMap; | ||
60 | +import java.util.List; | ||
61 | +import java.util.Map; | ||
62 | +import java.util.Set; | ||
63 | +import java.util.concurrent.ConcurrentMap; | ||
64 | + | ||
65 | +import static com.google.common.base.Preconditions.checkArgument; | ||
66 | +import static com.google.common.base.Preconditions.checkNotNull; | ||
67 | +import static javax.ws.rs.core.Response.Status.BAD_REQUEST; | ||
68 | +import static javax.ws.rs.core.Response.Status.CONFLICT; | ||
69 | +import static javax.ws.rs.core.Response.Status.CREATED; | ||
70 | +import static javax.ws.rs.core.Response.Status.NOT_FOUND; | ||
74 | 71 | ||
75 | @Path("routers") | 72 | @Path("routers") |
76 | public class RouterWebResource extends AbstractWebResource { | 73 | public class RouterWebResource extends AbstractWebResource { |
... | @@ -168,7 +165,7 @@ public class RouterWebResource extends AbstractWebResource { | ... | @@ -168,7 +165,7 @@ public class RouterWebResource extends AbstractWebResource { |
168 | RouterId routerId = RouterId.valueOf(id); | 165 | RouterId routerId = RouterId.valueOf(id); |
169 | Set<RouterId> routerIds = Sets.newHashSet(routerId); | 166 | Set<RouterId> routerIds = Sets.newHashSet(routerId); |
170 | get(RouterService.class).removeRouters(routerIds); | 167 | get(RouterService.class).removeRouters(routerIds); |
171 | - return Response.status(NO_CONTENT).entity(DELETE_SUCCESS).build(); | 168 | + return Response.noContent().entity(DELETE_SUCCESS).build(); |
172 | } catch (Exception e) { | 169 | } catch (Exception e) { |
173 | return Response.status(BAD_REQUEST).entity(e.getMessage()).build(); | 170 | return Response.status(BAD_REQUEST).entity(e.getMessage()).build(); |
174 | } | 171 | } | ... | ... |
... | @@ -158,7 +158,7 @@ public class SubnetWebResource extends AbstractWebResource { | ... | @@ -158,7 +158,7 @@ public class SubnetWebResource extends AbstractWebResource { |
158 | Set<SubnetId> subIds = new HashSet<>(); | 158 | Set<SubnetId> subIds = new HashSet<>(); |
159 | subIds.add(subId); | 159 | subIds.add(subId); |
160 | get(SubnetService.class).removeSubnets(subIds); | 160 | get(SubnetService.class).removeSubnets(subIds); |
161 | - return Response.status(201).entity("SUCCESS").build(); | 161 | + return Response.noContent().entity("SUCCESS").build(); |
162 | } catch (Exception e) { | 162 | } catch (Exception e) { |
163 | return Response.status(INTERNAL_SERVER_ERROR).entity(e.toString()) | 163 | return Response.status(INTERNAL_SERVER_ERROR).entity(e.toString()) |
164 | .build(); | 164 | .build(); | ... | ... |
... | @@ -15,31 +15,10 @@ | ... | @@ -15,31 +15,10 @@ |
15 | */ | 15 | */ |
16 | package org.onosproject.vtnweb.resources; | 16 | package org.onosproject.vtnweb.resources; |
17 | 17 | ||
18 | -import static com.google.common.base.Preconditions.checkNotNull; | 18 | +import com.fasterxml.jackson.databind.JsonNode; |
19 | -import static com.google.common.base.Preconditions.checkArgument; | 19 | +import com.fasterxml.jackson.databind.ObjectMapper; |
20 | -import static javax.ws.rs.core.Response.Status.INTERNAL_SERVER_ERROR; | 20 | +import com.fasterxml.jackson.databind.node.ObjectNode; |
21 | -import static javax.ws.rs.core.Response.Status.OK; | 21 | +import com.google.common.collect.Maps; |
22 | -import static javax.ws.rs.core.Response.Status.NOT_FOUND; | ||
23 | - | ||
24 | -import java.io.InputStream; | ||
25 | -import java.util.Collections; | ||
26 | -import java.util.HashSet; | ||
27 | -import java.util.Iterator; | ||
28 | -import java.util.Set; | ||
29 | -import java.util.concurrent.ConcurrentMap; | ||
30 | - | ||
31 | -import javax.ws.rs.Consumes; | ||
32 | -import javax.ws.rs.DELETE; | ||
33 | -import javax.ws.rs.GET; | ||
34 | -import javax.ws.rs.POST; | ||
35 | -import javax.ws.rs.PUT; | ||
36 | -import javax.ws.rs.Path; | ||
37 | -import javax.ws.rs.PathParam; | ||
38 | -import javax.ws.rs.Produces; | ||
39 | -import javax.ws.rs.QueryParam; | ||
40 | -import javax.ws.rs.core.MediaType; | ||
41 | -import javax.ws.rs.core.Response; | ||
42 | - | ||
43 | import org.onlab.util.ItemNotFoundException; | 22 | import org.onlab.util.ItemNotFoundException; |
44 | import org.onosproject.rest.AbstractWebResource; | 23 | import org.onosproject.rest.AbstractWebResource; |
45 | import org.onosproject.vtnrsc.DefaultTenantNetwork; | 24 | import org.onosproject.vtnrsc.DefaultTenantNetwork; |
... | @@ -47,18 +26,37 @@ import org.onosproject.vtnrsc.PhysicalNetwork; | ... | @@ -47,18 +26,37 @@ import org.onosproject.vtnrsc.PhysicalNetwork; |
47 | import org.onosproject.vtnrsc.SegmentationId; | 26 | import org.onosproject.vtnrsc.SegmentationId; |
48 | import org.onosproject.vtnrsc.TenantId; | 27 | import org.onosproject.vtnrsc.TenantId; |
49 | import org.onosproject.vtnrsc.TenantNetwork; | 28 | import org.onosproject.vtnrsc.TenantNetwork; |
50 | -import org.onosproject.vtnrsc.TenantNetworkId; | ||
51 | import org.onosproject.vtnrsc.TenantNetwork.State; | 29 | import org.onosproject.vtnrsc.TenantNetwork.State; |
52 | import org.onosproject.vtnrsc.TenantNetwork.Type; | 30 | import org.onosproject.vtnrsc.TenantNetwork.Type; |
31 | +import org.onosproject.vtnrsc.TenantNetworkId; | ||
53 | import org.onosproject.vtnrsc.tenantnetwork.TenantNetworkService; | 32 | import org.onosproject.vtnrsc.tenantnetwork.TenantNetworkService; |
54 | import org.onosproject.vtnweb.web.TenantNetworkCodec; | 33 | import org.onosproject.vtnweb.web.TenantNetworkCodec; |
55 | import org.slf4j.Logger; | 34 | import org.slf4j.Logger; |
56 | import org.slf4j.LoggerFactory; | 35 | import org.slf4j.LoggerFactory; |
57 | 36 | ||
58 | -import com.fasterxml.jackson.databind.JsonNode; | 37 | +import javax.ws.rs.Consumes; |
59 | -import com.fasterxml.jackson.databind.ObjectMapper; | 38 | +import javax.ws.rs.DELETE; |
60 | -import com.fasterxml.jackson.databind.node.ObjectNode; | 39 | +import javax.ws.rs.GET; |
61 | -import com.google.common.collect.Maps; | 40 | +import javax.ws.rs.POST; |
41 | +import javax.ws.rs.PUT; | ||
42 | +import javax.ws.rs.Path; | ||
43 | +import javax.ws.rs.PathParam; | ||
44 | +import javax.ws.rs.Produces; | ||
45 | +import javax.ws.rs.QueryParam; | ||
46 | +import javax.ws.rs.core.MediaType; | ||
47 | +import javax.ws.rs.core.Response; | ||
48 | +import java.io.InputStream; | ||
49 | +import java.util.Collections; | ||
50 | +import java.util.HashSet; | ||
51 | +import java.util.Iterator; | ||
52 | +import java.util.Set; | ||
53 | +import java.util.concurrent.ConcurrentMap; | ||
54 | + | ||
55 | +import static com.google.common.base.Preconditions.checkArgument; | ||
56 | +import static com.google.common.base.Preconditions.checkNotNull; | ||
57 | +import static javax.ws.rs.core.Response.Status.INTERNAL_SERVER_ERROR; | ||
58 | +import static javax.ws.rs.core.Response.Status.NOT_FOUND; | ||
59 | +import static javax.ws.rs.core.Response.Status.OK; | ||
62 | 60 | ||
63 | /** | 61 | /** |
64 | * REST resource for interacting with the inventory of networks. | 62 | * REST resource for interacting with the inventory of networks. |
... | @@ -253,7 +251,7 @@ public class TenantNetworkWebResource extends AbstractWebResource { | ... | @@ -253,7 +251,7 @@ public class TenantNetworkWebResource extends AbstractWebResource { |
253 | return Response.status(INTERNAL_SERVER_ERROR) | 251 | return Response.status(INTERNAL_SERVER_ERROR) |
254 | .entity(NETWORK_ID_NOT_EXIST).build(); | 252 | .entity(NETWORK_ID_NOT_EXIST).build(); |
255 | } | 253 | } |
256 | - return Response.status(OK).entity(issuccess.toString()).build(); | 254 | + return ok(issuccess.toString()).build(); |
257 | } | 255 | } |
258 | 256 | ||
259 | /** | 257 | /** | ... | ... |
... | @@ -15,32 +15,11 @@ | ... | @@ -15,32 +15,11 @@ |
15 | */ | 15 | */ |
16 | package org.onosproject.vtnweb.resources; | 16 | package org.onosproject.vtnweb.resources; |
17 | 17 | ||
18 | -import static com.google.common.base.Preconditions.checkArgument; | 18 | +import com.fasterxml.jackson.databind.JsonNode; |
19 | -import static com.google.common.base.Preconditions.checkNotNull; | 19 | +import com.fasterxml.jackson.databind.ObjectMapper; |
20 | -import static javax.ws.rs.core.Response.Status.INTERNAL_SERVER_ERROR; | 20 | +import com.fasterxml.jackson.databind.node.ObjectNode; |
21 | -import static javax.ws.rs.core.Response.Status.OK; | 21 | +import com.google.common.collect.Maps; |
22 | -import static javax.ws.rs.core.Response.Status.NOT_FOUND; | 22 | +import com.google.common.collect.Sets; |
23 | - | ||
24 | -import java.io.InputStream; | ||
25 | -import java.util.Collection; | ||
26 | -import java.util.Collections; | ||
27 | -import java.util.HashMap; | ||
28 | -import java.util.HashSet; | ||
29 | -import java.util.Map; | ||
30 | -import java.util.Set; | ||
31 | -import java.util.concurrent.ConcurrentMap; | ||
32 | - | ||
33 | -import javax.ws.rs.Consumes; | ||
34 | -import javax.ws.rs.DELETE; | ||
35 | -import javax.ws.rs.GET; | ||
36 | -import javax.ws.rs.POST; | ||
37 | -import javax.ws.rs.PUT; | ||
38 | -import javax.ws.rs.Path; | ||
39 | -import javax.ws.rs.PathParam; | ||
40 | -import javax.ws.rs.Produces; | ||
41 | -import javax.ws.rs.core.MediaType; | ||
42 | -import javax.ws.rs.core.Response; | ||
43 | - | ||
44 | import org.onlab.packet.IpAddress; | 23 | import org.onlab.packet.IpAddress; |
45 | import org.onlab.packet.MacAddress; | 24 | import org.onlab.packet.MacAddress; |
46 | import org.onlab.util.ItemNotFoundException; | 25 | import org.onlab.util.ItemNotFoundException; |
... | @@ -62,11 +41,30 @@ import org.onosproject.vtnweb.web.VirtualPortCodec; | ... | @@ -62,11 +41,30 @@ import org.onosproject.vtnweb.web.VirtualPortCodec; |
62 | import org.slf4j.Logger; | 41 | import org.slf4j.Logger; |
63 | import org.slf4j.LoggerFactory; | 42 | import org.slf4j.LoggerFactory; |
64 | 43 | ||
65 | -import com.fasterxml.jackson.databind.JsonNode; | 44 | +import javax.ws.rs.Consumes; |
66 | -import com.fasterxml.jackson.databind.ObjectMapper; | 45 | +import javax.ws.rs.DELETE; |
67 | -import com.fasterxml.jackson.databind.node.ObjectNode; | 46 | +import javax.ws.rs.GET; |
68 | -import com.google.common.collect.Maps; | 47 | +import javax.ws.rs.POST; |
69 | -import com.google.common.collect.Sets; | 48 | +import javax.ws.rs.PUT; |
49 | +import javax.ws.rs.Path; | ||
50 | +import javax.ws.rs.PathParam; | ||
51 | +import javax.ws.rs.Produces; | ||
52 | +import javax.ws.rs.core.MediaType; | ||
53 | +import javax.ws.rs.core.Response; | ||
54 | +import java.io.InputStream; | ||
55 | +import java.util.Collection; | ||
56 | +import java.util.Collections; | ||
57 | +import java.util.HashMap; | ||
58 | +import java.util.HashSet; | ||
59 | +import java.util.Map; | ||
60 | +import java.util.Set; | ||
61 | +import java.util.concurrent.ConcurrentMap; | ||
62 | + | ||
63 | +import static com.google.common.base.Preconditions.checkArgument; | ||
64 | +import static com.google.common.base.Preconditions.checkNotNull; | ||
65 | +import static javax.ws.rs.core.Response.Status.INTERNAL_SERVER_ERROR; | ||
66 | +import static javax.ws.rs.core.Response.Status.NOT_FOUND; | ||
67 | +import static javax.ws.rs.core.Response.Status.OK; | ||
70 | 68 | ||
71 | /** | 69 | /** |
72 | * REST resource for interacting with the inventory of infrastructure | 70 | * REST resource for interacting with the inventory of infrastructure |
... | @@ -146,7 +144,7 @@ public class VirtualPortWebResource extends AbstractWebResource { | ... | @@ -146,7 +144,7 @@ public class VirtualPortWebResource extends AbstractWebResource { |
146 | return Response.status(INTERNAL_SERVER_ERROR) | 144 | return Response.status(INTERNAL_SERVER_ERROR) |
147 | .entity(VPORT_ID_NOT_EXIST).build(); | 145 | .entity(VPORT_ID_NOT_EXIST).build(); |
148 | } | 146 | } |
149 | - return Response.status(OK).entity(issuccess.toString()).build(); | 147 | + return ok(issuccess.toString()).build(); |
150 | } catch (Exception e) { | 148 | } catch (Exception e) { |
151 | log.error("Deletes VirtualPort failed because of exception {}", | 149 | log.error("Deletes VirtualPort failed because of exception {}", |
152 | e.toString()); | 150 | e.toString()); | ... | ... |
... | @@ -104,16 +104,15 @@ public class ApplicationsWebResource extends AbstractWebResource { | ... | @@ -104,16 +104,15 @@ public class ApplicationsWebResource extends AbstractWebResource { |
104 | * Uninstalls the specified application deactivating it first if necessary. | 104 | * Uninstalls the specified application deactivating it first if necessary. |
105 | * | 105 | * |
106 | * @param name application name | 106 | * @param name application name |
107 | - * @return 200 OK; 404; 401 | 107 | + * @return 204 NO CONTENT |
108 | */ | 108 | */ |
109 | @DELETE | 109 | @DELETE |
110 | - @Produces(MediaType.APPLICATION_JSON) | ||
111 | @Path("{name}") | 110 | @Path("{name}") |
112 | public Response uninstallApp(@PathParam("name") String name) { | 111 | public Response uninstallApp(@PathParam("name") String name) { |
113 | ApplicationAdminService service = get(ApplicationAdminService.class); | 112 | ApplicationAdminService service = get(ApplicationAdminService.class); |
114 | ApplicationId appId = service.getId(name); | 113 | ApplicationId appId = service.getId(name); |
115 | service.uninstall(appId); | 114 | service.uninstall(appId); |
116 | - return Response.ok().build(); | 115 | + return Response.noContent().build(); |
117 | } | 116 | } |
118 | 117 | ||
119 | /** | 118 | /** | ... | ... |
... | @@ -20,11 +20,13 @@ import org.onosproject.cfg.ComponentConfigService; | ... | @@ -20,11 +20,13 @@ import org.onosproject.cfg.ComponentConfigService; |
20 | import org.onosproject.cfg.ConfigProperty; | 20 | import org.onosproject.cfg.ConfigProperty; |
21 | import org.onosproject.rest.AbstractWebResource; | 21 | import org.onosproject.rest.AbstractWebResource; |
22 | 22 | ||
23 | +import javax.ws.rs.Consumes; | ||
23 | import javax.ws.rs.DELETE; | 24 | import javax.ws.rs.DELETE; |
24 | import javax.ws.rs.GET; | 25 | import javax.ws.rs.GET; |
25 | import javax.ws.rs.POST; | 26 | import javax.ws.rs.POST; |
26 | import javax.ws.rs.Path; | 27 | import javax.ws.rs.Path; |
27 | import javax.ws.rs.PathParam; | 28 | import javax.ws.rs.PathParam; |
29 | +import javax.ws.rs.core.MediaType; | ||
28 | import javax.ws.rs.core.Response; | 30 | import javax.ws.rs.core.Response; |
29 | import java.io.IOException; | 31 | import java.io.IOException; |
30 | import java.io.InputStream; | 32 | import java.io.InputStream; |
... | @@ -87,6 +89,7 @@ public class ComponentConfigWebResource extends AbstractWebResource { | ... | @@ -87,6 +89,7 @@ public class ComponentConfigWebResource extends AbstractWebResource { |
87 | * @throws IOException to signify bad request | 89 | * @throws IOException to signify bad request |
88 | */ | 90 | */ |
89 | @POST | 91 | @POST |
92 | + @Consumes(MediaType.APPLICATION_JSON) | ||
90 | @Path("{component}") | 93 | @Path("{component}") |
91 | public Response setConfigs(@PathParam("component") String component, | 94 | public Response setConfigs(@PathParam("component") String component, |
92 | InputStream request) throws IOException { | 95 | InputStream request) throws IOException { |
... | @@ -103,10 +106,11 @@ public class ComponentConfigWebResource extends AbstractWebResource { | ... | @@ -103,10 +106,11 @@ public class ComponentConfigWebResource extends AbstractWebResource { |
103 | * | 106 | * |
104 | * @param component component name | 107 | * @param component component name |
105 | * @param request JSON configuration | 108 | * @param request JSON configuration |
106 | - * @return 200 OK | 109 | + * @return 204 NO CONTENT |
107 | * @throws IOException to signify bad request | 110 | * @throws IOException to signify bad request |
108 | */ | 111 | */ |
109 | @DELETE | 112 | @DELETE |
113 | + @Consumes(MediaType.APPLICATION_JSON) | ||
110 | @Path("{component}") | 114 | @Path("{component}") |
111 | public Response unsetConfigs(@PathParam("component") String component, | 115 | public Response unsetConfigs(@PathParam("component") String component, |
112 | InputStream request) throws IOException { | 116 | InputStream request) throws IOException { | ... | ... |
... | @@ -224,11 +224,12 @@ public class FlowsWebResource extends AbstractWebResource { | ... | @@ -224,11 +224,12 @@ public class FlowsWebResource extends AbstractWebResource { |
224 | * | 224 | * |
225 | * @param deviceId device identifier | 225 | * @param deviceId device identifier |
226 | * @param flowId flow rule identifier | 226 | * @param flowId flow rule identifier |
227 | + * @return 204 NO CONTENT | ||
227 | */ | 228 | */ |
228 | @DELETE | 229 | @DELETE |
229 | @Produces(MediaType.APPLICATION_JSON) | 230 | @Produces(MediaType.APPLICATION_JSON) |
230 | @Path("{deviceId}/{flowId}") | 231 | @Path("{deviceId}/{flowId}") |
231 | - public void deleteFlowByDeviceIdAndFlowId(@PathParam("deviceId") String deviceId, | 232 | + public Response deleteFlowByDeviceIdAndFlowId(@PathParam("deviceId") String deviceId, |
232 | @PathParam("flowId") long flowId) { | 233 | @PathParam("flowId") long flowId) { |
233 | final Iterable<FlowEntry> flowEntries = | 234 | final Iterable<FlowEntry> flowEntries = |
234 | service.getFlowEntries(DeviceId.deviceId(deviceId)); | 235 | service.getFlowEntries(DeviceId.deviceId(deviceId)); |
... | @@ -240,16 +241,18 @@ public class FlowsWebResource extends AbstractWebResource { | ... | @@ -240,16 +241,18 @@ public class FlowsWebResource extends AbstractWebResource { |
240 | StreamSupport.stream(flowEntries.spliterator(), false) | 241 | StreamSupport.stream(flowEntries.spliterator(), false) |
241 | .filter(entry -> entry.id().value() == flowId) | 242 | .filter(entry -> entry.id().value() == flowId) |
242 | .forEach(service::removeFlowRules); | 243 | .forEach(service::removeFlowRules); |
244 | + return Response.noContent().build(); | ||
243 | } | 245 | } |
244 | 246 | ||
245 | /** | 247 | /** |
246 | * Removes a batch of flow rules. | 248 | * Removes a batch of flow rules. |
247 | * | 249 | * |
248 | * @param stream stream for posted JSON | 250 | * @param stream stream for posted JSON |
251 | + * @return NO CONTENT | ||
249 | */ | 252 | */ |
250 | @DELETE | 253 | @DELETE |
251 | @Produces(MediaType.APPLICATION_JSON) | 254 | @Produces(MediaType.APPLICATION_JSON) |
252 | - public void deleteFlows(InputStream stream) { | 255 | + public Response deleteFlows(InputStream stream) { |
253 | ListMultimap<DeviceId, Long> deviceMap = ArrayListMultimap.create(); | 256 | ListMultimap<DeviceId, Long> deviceMap = ArrayListMultimap.create(); |
254 | List<FlowEntry> rulesToRemove = new ArrayList<>(); | 257 | List<FlowEntry> rulesToRemove = new ArrayList<>(); |
255 | 258 | ||
... | @@ -283,6 +286,7 @@ public class FlowsWebResource extends AbstractWebResource { | ... | @@ -283,6 +286,7 @@ public class FlowsWebResource extends AbstractWebResource { |
283 | }); | 286 | }); |
284 | 287 | ||
285 | service.removeFlowRules(rulesToRemove.toArray(new FlowEntry[0])); | 288 | service.removeFlowRules(rulesToRemove.toArray(new FlowEntry[0])); |
289 | + return Response.noContent().build(); | ||
286 | } | 290 | } |
287 | 291 | ||
288 | } | 292 | } | ... | ... |
... | @@ -172,15 +172,17 @@ public class GroupsWebResource extends AbstractWebResource { | ... | @@ -172,15 +172,17 @@ public class GroupsWebResource extends AbstractWebResource { |
172 | * | 172 | * |
173 | * @param deviceId device identifier | 173 | * @param deviceId device identifier |
174 | * @param appCookie application cookie to be used for lookup | 174 | * @param appCookie application cookie to be used for lookup |
175 | + * @return 204 NO CONTENT | ||
175 | */ | 176 | */ |
176 | @DELETE | 177 | @DELETE |
177 | @Produces(MediaType.APPLICATION_JSON) | 178 | @Produces(MediaType.APPLICATION_JSON) |
178 | @Path("{deviceId}/{appCookie}") | 179 | @Path("{deviceId}/{appCookie}") |
179 | - public void deleteGroupByDeviceIdAndAppCookie(@PathParam("deviceId") String deviceId, | 180 | + public Response deleteGroupByDeviceIdAndAppCookie(@PathParam("deviceId") String deviceId, |
180 | - @PathParam("appCookie") String appCookie) { | 181 | + @PathParam("appCookie") String appCookie) { |
181 | DeviceId deviceIdInstance = DeviceId.deviceId(deviceId); | 182 | DeviceId deviceIdInstance = DeviceId.deviceId(deviceId); |
182 | GroupKey appCookieInstance = new DefaultGroupKey(appCookie.getBytes()); | 183 | GroupKey appCookieInstance = new DefaultGroupKey(appCookie.getBytes()); |
183 | 184 | ||
184 | groupService.removeGroup(deviceIdInstance, appCookieInstance, null); | 185 | groupService.removeGroup(deviceIdInstance, appCookieInstance, null); |
186 | + return Response.noContent().build(); | ||
185 | } | 187 | } |
186 | } | 188 | } | ... | ... |
... | @@ -15,25 +15,7 @@ | ... | @@ -15,25 +15,7 @@ |
15 | */ | 15 | */ |
16 | package org.onosproject.rest.resources; | 16 | package org.onosproject.rest.resources; |
17 | 17 | ||
18 | -import java.io.IOException; | 18 | +import com.fasterxml.jackson.databind.node.ObjectNode; |
19 | -import java.io.InputStream; | ||
20 | -import java.util.Objects; | ||
21 | -import java.util.concurrent.CountDownLatch; | ||
22 | -import java.util.concurrent.TimeUnit; | ||
23 | - | ||
24 | -import javax.ws.rs.Consumes; | ||
25 | -import javax.ws.rs.DELETE; | ||
26 | -import javax.ws.rs.GET; | ||
27 | -import javax.ws.rs.POST; | ||
28 | -import javax.ws.rs.Path; | ||
29 | -import javax.ws.rs.PathParam; | ||
30 | -import javax.ws.rs.Produces; | ||
31 | -import javax.ws.rs.core.Context; | ||
32 | -import javax.ws.rs.core.MediaType; | ||
33 | -import javax.ws.rs.core.Response; | ||
34 | -import javax.ws.rs.core.UriBuilder; | ||
35 | -import javax.ws.rs.core.UriInfo; | ||
36 | - | ||
37 | import org.onosproject.core.ApplicationId; | 19 | import org.onosproject.core.ApplicationId; |
38 | import org.onosproject.core.CoreService; | 20 | import org.onosproject.core.CoreService; |
39 | import org.onosproject.net.intent.HostToHostIntent; | 21 | import org.onosproject.net.intent.HostToHostIntent; |
... | @@ -47,7 +29,23 @@ import org.onosproject.net.intent.PointToPointIntent; | ... | @@ -47,7 +29,23 @@ import org.onosproject.net.intent.PointToPointIntent; |
47 | import org.onosproject.rest.AbstractWebResource; | 29 | import org.onosproject.rest.AbstractWebResource; |
48 | import org.slf4j.Logger; | 30 | import org.slf4j.Logger; |
49 | 31 | ||
50 | -import com.fasterxml.jackson.databind.node.ObjectNode; | 32 | +import javax.ws.rs.Consumes; |
33 | +import javax.ws.rs.DELETE; | ||
34 | +import javax.ws.rs.GET; | ||
35 | +import javax.ws.rs.POST; | ||
36 | +import javax.ws.rs.Path; | ||
37 | +import javax.ws.rs.PathParam; | ||
38 | +import javax.ws.rs.Produces; | ||
39 | +import javax.ws.rs.core.Context; | ||
40 | +import javax.ws.rs.core.MediaType; | ||
41 | +import javax.ws.rs.core.Response; | ||
42 | +import javax.ws.rs.core.UriBuilder; | ||
43 | +import javax.ws.rs.core.UriInfo; | ||
44 | +import java.io.IOException; | ||
45 | +import java.io.InputStream; | ||
46 | +import java.util.Objects; | ||
47 | +import java.util.concurrent.CountDownLatch; | ||
48 | +import java.util.concurrent.TimeUnit; | ||
51 | 49 | ||
52 | import static org.onlab.util.Tools.nullIsNotFound; | 50 | import static org.onlab.util.Tools.nullIsNotFound; |
53 | import static org.onosproject.net.intent.IntentState.FAILED; | 51 | import static org.onosproject.net.intent.IntentState.FAILED; |
... | @@ -168,10 +166,11 @@ public class IntentsWebResource extends AbstractWebResource { | ... | @@ -168,10 +166,11 @@ public class IntentsWebResource extends AbstractWebResource { |
168 | * | 166 | * |
169 | * @param appId application identifier | 167 | * @param appId application identifier |
170 | * @param key intent key | 168 | * @param key intent key |
169 | + * @return 204 NO CONTENT | ||
171 | */ | 170 | */ |
172 | @DELETE | 171 | @DELETE |
173 | @Path("{appId}/{key}") | 172 | @Path("{appId}/{key}") |
174 | - public void deleteIntentById(@PathParam("appId") String appId, | 173 | + public Response deleteIntentById(@PathParam("appId") String appId, |
175 | @PathParam("key") String key) { | 174 | @PathParam("key") String key) { |
176 | final ApplicationId app = get(CoreService.class).getAppId(appId); | 175 | final ApplicationId app = get(CoreService.class).getAppId(appId); |
177 | 176 | ||
... | @@ -185,10 +184,9 @@ public class IntentsWebResource extends AbstractWebResource { | ... | @@ -185,10 +184,9 @@ public class IntentsWebResource extends AbstractWebResource { |
185 | if (intent == null) { | 184 | if (intent == null) { |
186 | // No such intent. REST standards recommend a positive status code | 185 | // No such intent. REST standards recommend a positive status code |
187 | // in this case. | 186 | // in this case. |
188 | - return; | 187 | + return Response.noContent().build(); |
189 | } | 188 | } |
190 | 189 | ||
191 | - | ||
192 | Key k = intent.key(); | 190 | Key k = intent.key(); |
193 | 191 | ||
194 | // set up latch and listener to track uninstall progress | 192 | // set up latch and listener to track uninstall progress |
... | @@ -216,6 +214,7 @@ public class IntentsWebResource extends AbstractWebResource { | ... | @@ -216,6 +214,7 @@ public class IntentsWebResource extends AbstractWebResource { |
216 | // clean up the listener | 214 | // clean up the listener |
217 | service.removeListener(listener); | 215 | service.removeListener(listener); |
218 | } | 216 | } |
217 | + return Response.noContent().build(); | ||
219 | } | 218 | } |
220 | 219 | ||
221 | } | 220 | } | ... | ... |
... | @@ -165,11 +165,11 @@ public class MetersWebResource extends AbstractWebResource { | ... | @@ -165,11 +165,11 @@ public class MetersWebResource extends AbstractWebResource { |
165 | * | 165 | * |
166 | * @param deviceId device identifier | 166 | * @param deviceId device identifier |
167 | * @param meterId meter identifier | 167 | * @param meterId meter identifier |
168 | + * @return 204 NO CONTENT | ||
168 | */ | 169 | */ |
169 | @DELETE | 170 | @DELETE |
170 | - @Produces(MediaType.APPLICATION_JSON) | ||
171 | @Path("{deviceId}/{meterId}") | 171 | @Path("{deviceId}/{meterId}") |
172 | - public void deleteMeterByDeviceIdAndMeterId(@PathParam("deviceId") String deviceId, | 172 | + public Response deleteMeterByDeviceIdAndMeterId(@PathParam("deviceId") String deviceId, |
173 | @PathParam("meterId") String meterId) { | 173 | @PathParam("meterId") String meterId) { |
174 | DeviceId did = DeviceId.deviceId(deviceId); | 174 | DeviceId did = DeviceId.deviceId(deviceId); |
175 | MeterId mid = MeterId.meterId(Long.valueOf(meterId)); | 175 | MeterId mid = MeterId.meterId(Long.valueOf(meterId)); |
... | @@ -178,6 +178,7 @@ public class MetersWebResource extends AbstractWebResource { | ... | @@ -178,6 +178,7 @@ public class MetersWebResource extends AbstractWebResource { |
178 | final MeterRequest meterRequest = meterToMeterRequest(tmpMeter, "REMOVE"); | 178 | final MeterRequest meterRequest = meterToMeterRequest(tmpMeter, "REMOVE"); |
179 | meterService.withdraw(meterRequest, tmpMeter.id()); | 179 | meterService.withdraw(meterRequest, tmpMeter.id()); |
180 | } | 180 | } |
181 | + return Response.noContent().build(); | ||
181 | } | 182 | } |
182 | 183 | ||
183 | /** | 184 | /** | ... | ... |
... | @@ -87,12 +87,12 @@ public class MulticastRouteWebResource extends AbstractWebResource { | ... | @@ -87,12 +87,12 @@ public class MulticastRouteWebResource extends AbstractWebResource { |
87 | * Removes a route from the multicast RIB. | 87 | * Removes a route from the multicast RIB. |
88 | * | 88 | * |
89 | * @param stream multicast route JSON | 89 | * @param stream multicast route JSON |
90 | + * @return 204 NO CONTENT | ||
90 | * @onos.rsModel McastRoutePost | 91 | * @onos.rsModel McastRoutePost |
91 | */ | 92 | */ |
92 | @DELETE | 93 | @DELETE |
93 | @Consumes(MediaType.APPLICATION_JSON) | 94 | @Consumes(MediaType.APPLICATION_JSON) |
94 | - @Produces(MediaType.APPLICATION_JSON) | 95 | + public Response deleteRoute(InputStream stream) { |
95 | - public void deleteRoute(InputStream stream) { | ||
96 | MulticastRouteService service = get(MulticastRouteService.class); | 96 | MulticastRouteService service = get(MulticastRouteService.class); |
97 | try { | 97 | try { |
98 | ObjectNode jsonTree = (ObjectNode) mapper().readTree(stream); | 98 | ObjectNode jsonTree = (ObjectNode) mapper().readTree(stream); |
... | @@ -101,5 +101,6 @@ public class MulticastRouteWebResource extends AbstractWebResource { | ... | @@ -101,5 +101,6 @@ public class MulticastRouteWebResource extends AbstractWebResource { |
101 | } catch (IOException ex) { | 101 | } catch (IOException ex) { |
102 | throw new IllegalArgumentException(ex); | 102 | throw new IllegalArgumentException(ex); |
103 | } | 103 | } |
104 | + return Response.noContent().build(); | ||
104 | } | 105 | } |
105 | } | 106 | } | ... | ... |
... | @@ -289,7 +289,7 @@ public class NetworkConfigWebResource extends AbstractWebResource { | ... | @@ -289,7 +289,7 @@ public class NetworkConfigWebResource extends AbstractWebResource { |
289 | /** | 289 | /** |
290 | * Clear entire network configuration base. | 290 | * Clear entire network configuration base. |
291 | * | 291 | * |
292 | - * @return empty response | 292 | + * @return 204 NO CONTENT |
293 | */ | 293 | */ |
294 | @DELETE | 294 | @DELETE |
295 | @SuppressWarnings("unchecked") | 295 | @SuppressWarnings("unchecked") |
... | @@ -299,22 +299,24 @@ public class NetworkConfigWebResource extends AbstractWebResource { | ... | @@ -299,22 +299,24 @@ public class NetworkConfigWebResource extends AbstractWebResource { |
299 | .forEach(subjectClass -> service.getSubjects(subjectClass) | 299 | .forEach(subjectClass -> service.getSubjects(subjectClass) |
300 | .forEach(subject -> service.getConfigs(subject) | 300 | .forEach(subject -> service.getConfigs(subject) |
301 | .forEach(config -> service.removeConfig(subject, config.getClass())))); | 301 | .forEach(config -> service.removeConfig(subject, config.getClass())))); |
302 | - return Response.ok().build(); | 302 | + return Response.noContent().build(); |
303 | } | 303 | } |
304 | 304 | ||
305 | /** | 305 | /** |
306 | * Clear all network configurations for a subject class. | 306 | * Clear all network configurations for a subject class. |
307 | * | 307 | * |
308 | * @param subjectClassKey subject class key | 308 | * @param subjectClassKey subject class key |
309 | + * @return 204 NO CONTENT | ||
309 | */ | 310 | */ |
310 | @DELETE | 311 | @DELETE |
311 | @Path("{subjectClassKey}") | 312 | @Path("{subjectClassKey}") |
312 | @SuppressWarnings("unchecked") | 313 | @SuppressWarnings("unchecked") |
313 | - public void delete(@PathParam("subjectClassKey") String subjectClassKey) { | 314 | + public Response delete(@PathParam("subjectClassKey") String subjectClassKey) { |
314 | NetworkConfigService service = get(NetworkConfigService.class); | 315 | NetworkConfigService service = get(NetworkConfigService.class); |
315 | service.getSubjects(service.getSubjectFactory(subjectClassKey).subjectClass()) | 316 | service.getSubjects(service.getSubjectFactory(subjectClassKey).subjectClass()) |
316 | .forEach(subject -> service.getConfigs(subject) | 317 | .forEach(subject -> service.getConfigs(subject) |
317 | .forEach(config -> service.removeConfig(subject, config.getClass()))); | 318 | .forEach(config -> service.removeConfig(subject, config.getClass()))); |
319 | + return Response.noContent().build(); | ||
318 | } | 320 | } |
319 | 321 | ||
320 | /** | 322 | /** |
... | @@ -322,15 +324,17 @@ public class NetworkConfigWebResource extends AbstractWebResource { | ... | @@ -322,15 +324,17 @@ public class NetworkConfigWebResource extends AbstractWebResource { |
322 | * | 324 | * |
323 | * @param subjectClassKey subjectKey class key | 325 | * @param subjectClassKey subjectKey class key |
324 | * @param subjectKey subjectKey key | 326 | * @param subjectKey subjectKey key |
327 | + * @return 204 NO CONTENT | ||
325 | */ | 328 | */ |
326 | @DELETE | 329 | @DELETE |
327 | @Path("{subjectClassKey}/{subjectKey}") | 330 | @Path("{subjectClassKey}/{subjectKey}") |
328 | @SuppressWarnings("unchecked") | 331 | @SuppressWarnings("unchecked") |
329 | - public void delete(@PathParam("subjectClassKey") String subjectClassKey, | 332 | + public Response delete(@PathParam("subjectClassKey") String subjectClassKey, |
330 | @PathParam("subjectKey") String subjectKey) { | 333 | @PathParam("subjectKey") String subjectKey) { |
331 | NetworkConfigService service = get(NetworkConfigService.class); | 334 | NetworkConfigService service = get(NetworkConfigService.class); |
332 | Object s = service.getSubjectFactory(subjectClassKey).createSubject(subjectKey); | 335 | Object s = service.getSubjectFactory(subjectClassKey).createSubject(subjectKey); |
333 | service.getConfigs(s).forEach(c -> service.removeConfig(s, c.getClass())); | 336 | service.getConfigs(s).forEach(c -> service.removeConfig(s, c.getClass())); |
337 | + return Response.noContent().build(); | ||
334 | } | 338 | } |
335 | 339 | ||
336 | /** | 340 | /** |
... | @@ -339,16 +343,18 @@ public class NetworkConfigWebResource extends AbstractWebResource { | ... | @@ -339,16 +343,18 @@ public class NetworkConfigWebResource extends AbstractWebResource { |
339 | * @param subjectClassKey subjectKey class key | 343 | * @param subjectClassKey subjectKey class key |
340 | * @param subjectKey subjectKey key | 344 | * @param subjectKey subjectKey key |
341 | * @param configKey configuration class key | 345 | * @param configKey configuration class key |
346 | + * @return 204 NO CONTENT | ||
342 | */ | 347 | */ |
343 | @DELETE | 348 | @DELETE |
344 | @Path("{subjectClassKey}/{subjectKey}/{configKey}") | 349 | @Path("{subjectClassKey}/{subjectKey}/{configKey}") |
345 | @SuppressWarnings("unchecked") | 350 | @SuppressWarnings("unchecked") |
346 | - public void delete(@PathParam("subjectClassKey") String subjectClassKey, | 351 | + public Response delete(@PathParam("subjectClassKey") String subjectClassKey, |
347 | @PathParam("subjectKey") String subjectKey, | 352 | @PathParam("subjectKey") String subjectKey, |
348 | @PathParam("configKey") String configKey) { | 353 | @PathParam("configKey") String configKey) { |
349 | NetworkConfigService service = get(NetworkConfigService.class); | 354 | NetworkConfigService service = get(NetworkConfigService.class); |
350 | service.removeConfig(service.getSubjectFactory(subjectClassKey).createSubject(subjectKey), | 355 | service.removeConfig(service.getSubjectFactory(subjectClassKey).createSubject(subjectKey), |
351 | service.getConfigClass(subjectClassKey, configKey)); | 356 | service.getConfigClass(subjectClassKey, configKey)); |
357 | + return Response.noContent().build(); | ||
352 | } | 358 | } |
353 | 359 | ||
354 | } | 360 | } | ... | ... |
... | @@ -173,11 +173,10 @@ public class RegionsWebResource extends AbstractWebResource { | ... | @@ -173,11 +173,10 @@ public class RegionsWebResource extends AbstractWebResource { |
173 | */ | 173 | */ |
174 | @DELETE | 174 | @DELETE |
175 | @Path("{regionId}") | 175 | @Path("{regionId}") |
176 | - @Produces(MediaType.APPLICATION_JSON) | ||
177 | public Response removeRegion(@PathParam("regionId") String regionId) { | 176 | public Response removeRegion(@PathParam("regionId") String regionId) { |
178 | final RegionId rid = RegionId.regionId(regionId); | 177 | final RegionId rid = RegionId.regionId(regionId); |
179 | regionAdminService.removeRegion(rid); | 178 | regionAdminService.removeRegion(rid); |
180 | - return Response.ok().build(); | 179 | + return Response.noContent().build(); |
181 | } | 180 | } |
182 | 181 | ||
183 | /** | 182 | /** |
... | @@ -213,13 +212,12 @@ public class RegionsWebResource extends AbstractWebResource { | ... | @@ -213,13 +212,12 @@ public class RegionsWebResource extends AbstractWebResource { |
213 | * | 212 | * |
214 | * @param regionId region identifier | 213 | * @param regionId region identifier |
215 | * @param stream deviceIds JSON stream | 214 | * @param stream deviceIds JSON stream |
216 | - * @return 200 OK, 404 not found | 215 | + * @return 204 NO CONTENT |
217 | * @onos.rsModel RegionDeviceIds | 216 | * @onos.rsModel RegionDeviceIds |
218 | */ | 217 | */ |
219 | @DELETE | 218 | @DELETE |
220 | @Path("{regionId}/devices") | 219 | @Path("{regionId}/devices") |
221 | @Consumes(MediaType.APPLICATION_JSON) | 220 | @Consumes(MediaType.APPLICATION_JSON) |
222 | - @Produces(MediaType.APPLICATION_JSON) | ||
223 | public Response removeDevices(@PathParam("regionId") String regionId, | 221 | public Response removeDevices(@PathParam("regionId") String regionId, |
224 | InputStream stream) { | 222 | InputStream stream) { |
225 | final RegionId rid = RegionId.regionId(regionId); | 223 | final RegionId rid = RegionId.regionId(regionId); |
... | @@ -230,7 +228,7 @@ public class RegionsWebResource extends AbstractWebResource { | ... | @@ -230,7 +228,7 @@ public class RegionsWebResource extends AbstractWebResource { |
230 | throw new IllegalArgumentException(e); | 228 | throw new IllegalArgumentException(e); |
231 | } | 229 | } |
232 | 230 | ||
233 | - return Response.ok().build(); | 231 | + return Response.noContent().build(); |
234 | } | 232 | } |
235 | 233 | ||
236 | /** | 234 | /** | ... | ... |
... | @@ -97,7 +97,7 @@ public class TenantWebResource extends AbstractWebResource { | ... | @@ -97,7 +97,7 @@ public class TenantWebResource extends AbstractWebResource { |
97 | * Removes the specified tenant with the specified tenant identifier. | 97 | * Removes the specified tenant with the specified tenant identifier. |
98 | * | 98 | * |
99 | * @param tenantId tenant identifier | 99 | * @param tenantId tenant identifier |
100 | - * @return 200 OK, 404 not found | 100 | + * @return 204 NO CONTENT |
101 | */ | 101 | */ |
102 | @DELETE | 102 | @DELETE |
103 | @Path("{tenantId}") | 103 | @Path("{tenantId}") |
... | @@ -105,7 +105,7 @@ public class TenantWebResource extends AbstractWebResource { | ... | @@ -105,7 +105,7 @@ public class TenantWebResource extends AbstractWebResource { |
105 | final TenantId tid = TenantId.tenantId(tenantId); | 105 | final TenantId tid = TenantId.tenantId(tenantId); |
106 | final TenantId existingTid = getExistingTenantId(vnetAdminService, tid); | 106 | final TenantId existingTid = getExistingTenantId(vnetAdminService, tid); |
107 | vnetAdminService.unregisterTenantId(existingTid); | 107 | vnetAdminService.unregisterTenantId(existingTid); |
108 | - return Response.ok().build(); | 108 | + return Response.noContent().build(); |
109 | } | 109 | } |
110 | 110 | ||
111 | /** | 111 | /** | ... | ... |
... | @@ -135,14 +135,14 @@ public class VirtualNetworkWebResource extends AbstractWebResource { | ... | @@ -135,14 +135,14 @@ public class VirtualNetworkWebResource extends AbstractWebResource { |
135 | * Removes the virtual network with the specified network identifier. | 135 | * Removes the virtual network with the specified network identifier. |
136 | * | 136 | * |
137 | * @param networkId network identifier | 137 | * @param networkId network identifier |
138 | - * @return 200 OK, 404 not found | 138 | + * @return 204 NO CONTENT |
139 | */ | 139 | */ |
140 | @DELETE | 140 | @DELETE |
141 | @Path("{networkId}") | 141 | @Path("{networkId}") |
142 | public Response removeVirtualNetwork(@PathParam("networkId") long networkId) { | 142 | public Response removeVirtualNetwork(@PathParam("networkId") long networkId) { |
143 | NetworkId nid = NetworkId.networkId(networkId); | 143 | NetworkId nid = NetworkId.networkId(networkId); |
144 | vnetAdminService.removeVirtualNetwork(nid); | 144 | vnetAdminService.removeVirtualNetwork(nid); |
145 | - return Response.ok().build(); | 145 | + return Response.noContent().build(); |
146 | } | 146 | } |
147 | 147 | ||
148 | // VirtualDevice | 148 | // VirtualDevice |
... | @@ -203,7 +203,7 @@ public class VirtualNetworkWebResource extends AbstractWebResource { | ... | @@ -203,7 +203,7 @@ public class VirtualNetworkWebResource extends AbstractWebResource { |
203 | * | 203 | * |
204 | * @param networkId network identifier | 204 | * @param networkId network identifier |
205 | * @param deviceId device identifier | 205 | * @param deviceId device identifier |
206 | - * @return 200 OK, 404 not found | 206 | + * @return 204 NO CONTENT |
207 | */ | 207 | */ |
208 | @DELETE | 208 | @DELETE |
209 | @Path("{networkId}/devices/{deviceId}") | 209 | @Path("{networkId}/devices/{deviceId}") |
... | @@ -212,7 +212,7 @@ public class VirtualNetworkWebResource extends AbstractWebResource { | ... | @@ -212,7 +212,7 @@ public class VirtualNetworkWebResource extends AbstractWebResource { |
212 | NetworkId nid = NetworkId.networkId(networkId); | 212 | NetworkId nid = NetworkId.networkId(networkId); |
213 | DeviceId did = DeviceId.deviceId(deviceId); | 213 | DeviceId did = DeviceId.deviceId(deviceId); |
214 | vnetAdminService.removeVirtualDevice(nid, did); | 214 | vnetAdminService.removeVirtualDevice(nid, did); |
215 | - return Response.ok().build(); | 215 | + return Response.noContent().build(); |
216 | } | 216 | } |
217 | 217 | ||
218 | // VirtualPort | 218 | // VirtualPort |
... | @@ -293,7 +293,7 @@ public class VirtualNetworkWebResource extends AbstractWebResource { | ... | @@ -293,7 +293,7 @@ public class VirtualNetworkWebResource extends AbstractWebResource { |
293 | * @param networkId network identifier | 293 | * @param networkId network identifier |
294 | * @param deviceId virtual device identifier | 294 | * @param deviceId virtual device identifier |
295 | * @param portNum virtual port number | 295 | * @param portNum virtual port number |
296 | - * @return 200 OK, 404 not found | 296 | + * @return 204 NO CONTENT |
297 | */ | 297 | */ |
298 | @DELETE | 298 | @DELETE |
299 | @Path("{networkId}/devices/{deviceId}/ports/{portNum}") | 299 | @Path("{networkId}/devices/{deviceId}/ports/{portNum}") |
... | @@ -303,7 +303,7 @@ public class VirtualNetworkWebResource extends AbstractWebResource { | ... | @@ -303,7 +303,7 @@ public class VirtualNetworkWebResource extends AbstractWebResource { |
303 | NetworkId nid = NetworkId.networkId(networkId); | 303 | NetworkId nid = NetworkId.networkId(networkId); |
304 | vnetAdminService.removeVirtualPort(nid, DeviceId.deviceId(deviceId), | 304 | vnetAdminService.removeVirtualPort(nid, DeviceId.deviceId(deviceId), |
305 | PortNumber.portNumber(portNum)); | 305 | PortNumber.portNumber(portNum)); |
306 | - return Response.ok().build(); | 306 | + return Response.noContent().build(); |
307 | } | 307 | } |
308 | 308 | ||
309 | // VirtualLink | 309 | // VirtualLink |
... | @@ -364,7 +364,7 @@ public class VirtualNetworkWebResource extends AbstractWebResource { | ... | @@ -364,7 +364,7 @@ public class VirtualNetworkWebResource extends AbstractWebResource { |
364 | * | 364 | * |
365 | * @param networkId network identifier | 365 | * @param networkId network identifier |
366 | * @param stream virtual link JSON stream | 366 | * @param stream virtual link JSON stream |
367 | - * @return 200 OK, 404 not found | 367 | + * @return 204 NO CONTENT |
368 | * @onos.rsModel VirtualLink | 368 | * @onos.rsModel VirtualLink |
369 | */ | 369 | */ |
370 | @DELETE | 370 | @DELETE |
... | @@ -386,7 +386,7 @@ public class VirtualNetworkWebResource extends AbstractWebResource { | ... | @@ -386,7 +386,7 @@ public class VirtualNetworkWebResource extends AbstractWebResource { |
386 | throw new IllegalArgumentException(e); | 386 | throw new IllegalArgumentException(e); |
387 | } | 387 | } |
388 | 388 | ||
389 | - return Response.ok().build(); | 389 | + return Response.noContent().build(); |
390 | } | 390 | } |
391 | 391 | ||
392 | /** | 392 | /** | ... | ... |
... | @@ -21,6 +21,7 @@ import com.eclipsesource.json.JsonObject; | ... | @@ -21,6 +21,7 @@ import com.eclipsesource.json.JsonObject; |
21 | import com.google.common.collect.ImmutableList; | 21 | import com.google.common.collect.ImmutableList; |
22 | import com.google.common.collect.ImmutableSet; | 22 | import com.google.common.collect.ImmutableSet; |
23 | import com.google.common.collect.Sets; | 23 | import com.google.common.collect.Sets; |
24 | +import org.glassfish.jersey.client.ClientProperties; | ||
24 | import org.hamcrest.Description; | 25 | import org.hamcrest.Description; |
25 | import org.hamcrest.TypeSafeMatcher; | 26 | import org.hamcrest.TypeSafeMatcher; |
26 | import org.junit.Before; | 27 | import org.junit.Before; |
... | @@ -383,7 +384,7 @@ public class RegionsResourceTest extends ResourceTest { | ... | @@ -383,7 +384,7 @@ public class RegionsResourceTest extends ResourceTest { |
383 | WebTarget wt = target(); | 384 | WebTarget wt = target(); |
384 | Response response = wt.path("regions/" + region1.id().toString()) | 385 | Response response = wt.path("regions/" + region1.id().toString()) |
385 | .request().delete(); | 386 | .request().delete(); |
386 | - assertThat(response.getStatus(), is(HttpURLConnection.HTTP_OK)); | 387 | + assertThat(response.getStatus(), is(HttpURLConnection.HTTP_NO_CONTENT)); |
387 | 388 | ||
388 | verify(mockRegionAdminService); | 389 | verify(mockRegionAdminService); |
389 | } | 390 | } |
... | @@ -452,16 +453,16 @@ public class RegionsResourceTest extends ResourceTest { | ... | @@ -452,16 +453,16 @@ public class RegionsResourceTest extends ResourceTest { |
452 | replay(mockRegionAdminService); | 453 | replay(mockRegionAdminService); |
453 | 454 | ||
454 | 455 | ||
455 | - WebTarget wt = target(); | 456 | + WebTarget wt = target() |
457 | + .property(ClientProperties.SUPPRESS_HTTP_COMPLIANCE_VALIDATION, true); | ||
456 | InputStream jsonStream = RegionsResourceTest.class | 458 | InputStream jsonStream = RegionsResourceTest.class |
457 | .getResourceAsStream("region-deviceIds.json"); | 459 | .getResourceAsStream("region-deviceIds.json"); |
458 | 460 | ||
459 | // FIXME: need to consider whether to use jsonStream for entry deletion | 461 | // FIXME: need to consider whether to use jsonStream for entry deletion |
460 | Response response = wt.path("regions/" + | 462 | Response response = wt.path("regions/" + |
461 | region1.id().toString() + "/devices") | 463 | region1.id().toString() + "/devices") |
462 | - .request(MediaType.APPLICATION_JSON_TYPE) | 464 | + .request().method("DELETE", Entity.json(jsonStream)); |
463 | - .delete(); | 465 | + assertThat(response.getStatus(), is(HttpURLConnection.HTTP_NO_CONTENT)); |
464 | - // assertThat(response.getStatus(), is(HttpURLConnection.HTTP_OK)); | 466 | + verify(mockRegionAdminService); |
465 | - // verify(mockRegionAdminService); | ||
466 | } | 467 | } |
467 | } | 468 | } | ... | ... |
... | @@ -289,7 +289,7 @@ public class TenantWebResourceTest extends ResourceTest { | ... | @@ -289,7 +289,7 @@ public class TenantWebResourceTest extends ResourceTest { |
289 | .request(MediaType.APPLICATION_JSON_TYPE) | 289 | .request(MediaType.APPLICATION_JSON_TYPE) |
290 | .delete(); | 290 | .delete(); |
291 | 291 | ||
292 | - assertThat(response.getStatus(), is(HttpURLConnection.HTTP_OK)); | 292 | + assertThat(response.getStatus(), is(HttpURLConnection.HTTP_NO_CONTENT)); |
293 | 293 | ||
294 | verify(mockVnetAdminService); | 294 | verify(mockVnetAdminService); |
295 | } | 295 | } | ... | ... |
... | @@ -486,7 +486,7 @@ public class VirtualNetworkWebResourceTest extends ResourceTest { | ... | @@ -486,7 +486,7 @@ public class VirtualNetworkWebResourceTest extends ResourceTest { |
486 | .request(MediaType.APPLICATION_JSON_TYPE) | 486 | .request(MediaType.APPLICATION_JSON_TYPE) |
487 | .delete(); | 487 | .delete(); |
488 | 488 | ||
489 | - assertThat(response.getStatus(), is(HttpURLConnection.HTTP_OK)); | 489 | + assertThat(response.getStatus(), is(HttpURLConnection.HTTP_NO_CONTENT)); |
490 | 490 | ||
491 | verify(mockVnetAdminService); | 491 | verify(mockVnetAdminService); |
492 | } | 492 | } |
... | @@ -662,7 +662,7 @@ public class VirtualNetworkWebResourceTest extends ResourceTest { | ... | @@ -662,7 +662,7 @@ public class VirtualNetworkWebResourceTest extends ResourceTest { |
662 | .request(MediaType.APPLICATION_JSON_TYPE) | 662 | .request(MediaType.APPLICATION_JSON_TYPE) |
663 | .delete(); | 663 | .delete(); |
664 | 664 | ||
665 | - assertThat(response.getStatus(), is(HttpURLConnection.HTTP_OK)); | 665 | + assertThat(response.getStatus(), is(HttpURLConnection.HTTP_NO_CONTENT)); |
666 | 666 | ||
667 | verify(mockVnetAdminService); | 667 | verify(mockVnetAdminService); |
668 | } | 668 | } |
... | @@ -828,7 +828,7 @@ public class VirtualNetworkWebResourceTest extends ResourceTest { | ... | @@ -828,7 +828,7 @@ public class VirtualNetworkWebResourceTest extends ResourceTest { |
828 | .request(MediaType.APPLICATION_JSON_TYPE) | 828 | .request(MediaType.APPLICATION_JSON_TYPE) |
829 | .delete(); | 829 | .delete(); |
830 | 830 | ||
831 | - assertThat(response.getStatus(), is(HttpURLConnection.HTTP_OK)); | 831 | + assertThat(response.getStatus(), is(HttpURLConnection.HTTP_NO_CONTENT)); |
832 | 832 | ||
833 | verify(mockVnetAdminService); | 833 | verify(mockVnetAdminService); |
834 | } | 834 | } |
... | @@ -1034,7 +1034,7 @@ public class VirtualNetworkWebResourceTest extends ResourceTest { | ... | @@ -1034,7 +1034,7 @@ public class VirtualNetworkWebResourceTest extends ResourceTest { |
1034 | String reqLocation = "vnets/" + networkId.toString() + "/links"; | 1034 | String reqLocation = "vnets/" + networkId.toString() + "/links"; |
1035 | Response response = wt.path(reqLocation).request().method("DELETE", Entity.json(jsonStream)); | 1035 | Response response = wt.path(reqLocation).request().method("DELETE", Entity.json(jsonStream)); |
1036 | 1036 | ||
1037 | - assertThat(response.getStatus(), is(HttpURLConnection.HTTP_OK)); | 1037 | + assertThat(response.getStatus(), is(HttpURLConnection.HTTP_NO_CONTENT)); |
1038 | verify(mockVnetAdminService); | 1038 | verify(mockVnetAdminService); |
1039 | } | 1039 | } |
1040 | } | 1040 | } | ... | ... |
-
Please register or login to post a comment