ONOS-4512 fix bug to get and delete
Change-Id: I952085be7548830b660e133cf1c59fcdf98e8f69
diff --git a/apps/vtn/vtnweb/src/main/java/org/onosproject/vtnweb/resources/ClassifierWebResource.java b/apps/vtn/vtnweb/src/main/java/org/onosproject/vtnweb/resources/ClassifierWebResource.java
index 884ce8c..94534f2 100644
--- a/apps/vtn/vtnweb/src/main/java/org/onosproject/vtnweb/resources/ClassifierWebResource.java
+++ b/apps/vtn/vtnweb/src/main/java/org/onosproject/vtnweb/resources/ClassifierWebResource.java
@@ -18,6 +18,7 @@
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
+import javax.ws.rs.Consumes;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
@@ -45,6 +46,7 @@
*/
@GET
@Produces(MediaType.APPLICATION_JSON)
+ @Consumes(MediaType.APPLICATION_JSON)
public Response getClassifiers() {
ObjectNode result = mapper().createObjectNode();
diff --git a/apps/vtn/vtnweb/src/main/java/org/onosproject/vtnweb/resources/FloatingIpWebResource.java b/apps/vtn/vtnweb/src/main/java/org/onosproject/vtnweb/resources/FloatingIpWebResource.java
index c5ddb07..c2c4632 100644
--- a/apps/vtn/vtnweb/src/main/java/org/onosproject/vtnweb/resources/FloatingIpWebResource.java
+++ b/apps/vtn/vtnweb/src/main/java/org/onosproject/vtnweb/resources/FloatingIpWebResource.java
@@ -75,6 +75,7 @@
@GET
@Produces(MediaType.APPLICATION_JSON)
+ @Consumes(MediaType.APPLICATION_JSON)
public Response listFloatingIps() {
Collection<FloatingIp> floatingIps = get(FloatingIpService.class)
.getFloatingIps();
@@ -87,6 +88,7 @@
@GET
@Path("{floatingIpUUID}")
@Produces(MediaType.APPLICATION_JSON)
+ @Consumes(MediaType.APPLICATION_JSON)
public Response getFloatingIp(@PathParam("floatingIpUUID") String id,
@QueryParam("fields") List<String> fields) {
diff --git a/apps/vtn/vtnweb/src/main/java/org/onosproject/vtnweb/resources/FlowClassifierWebResource.java b/apps/vtn/vtnweb/src/main/java/org/onosproject/vtnweb/resources/FlowClassifierWebResource.java
index 10cb399..b3b2bcb 100644
--- a/apps/vtn/vtnweb/src/main/java/org/onosproject/vtnweb/resources/FlowClassifierWebResource.java
+++ b/apps/vtn/vtnweb/src/main/java/org/onosproject/vtnweb/resources/FlowClassifierWebResource.java
@@ -59,6 +59,7 @@
* @return 200 OK
*/
@GET
+ @Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
public Response getFlowClassifiers() {
Iterable<FlowClassifier> flowClassifiers = get(FlowClassifierService.class).getFlowClassifiers();
@@ -81,6 +82,7 @@
*/
@GET
@Path("{flow_id}")
+ @Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
public Response getFlowClassifier(@PathParam("flow_id") String id) {
FlowClassifier flowClassifier = nullIsNotFound(get(FlowClassifierService.class)
@@ -154,6 +156,8 @@
*/
@Path("{flow_id}")
@DELETE
+ @Produces(MediaType.APPLICATION_JSON)
+ @Consumes(MediaType.APPLICATION_JSON)
public Response deleteFlowClassifier(@PathParam("flow_id") String id) {
log.debug("Deletes flow classifier by identifier {}.", id);
FlowClassifierId flowClassifierId = FlowClassifierId.of(id);
diff --git a/apps/vtn/vtnweb/src/main/java/org/onosproject/vtnweb/resources/PortChainWebResource.java b/apps/vtn/vtnweb/src/main/java/org/onosproject/vtnweb/resources/PortChainWebResource.java
index d5948cc..8326f87 100644
--- a/apps/vtn/vtnweb/src/main/java/org/onosproject/vtnweb/resources/PortChainWebResource.java
+++ b/apps/vtn/vtnweb/src/main/java/org/onosproject/vtnweb/resources/PortChainWebResource.java
@@ -62,6 +62,7 @@
*/
@GET
@Produces(MediaType.APPLICATION_JSON)
+ @Consumes(MediaType.APPLICATION_JSON)
public Response getPortChains() {
Iterable<PortChain> portChains = get(PortChainService.class).getPortChains();
ObjectNode result = mapper().createObjectNode();
@@ -83,6 +84,7 @@
@GET
@Path("{chain_id}")
@Produces(MediaType.APPLICATION_JSON)
+ @Consumes(MediaType.APPLICATION_JSON)
public Response getPortPain(@PathParam("chain_id") String id) {
PortChain portChain = nullIsNotFound(get(PortChainService.class).getPortChain(PortChainId.of(id)),
@@ -150,6 +152,8 @@
*/
@Path("{chain_id}")
@DELETE
+ @Produces(MediaType.APPLICATION_JSON)
+ @Consumes(MediaType.APPLICATION_JSON)
public Response deletePortPain(@PathParam("chain_id") String id) {
log.debug("Deletes port chain by identifier {}.", id);
PortChainId portChainId = PortChainId.of(id);
diff --git a/apps/vtn/vtnweb/src/main/java/org/onosproject/vtnweb/resources/PortPairGroupWebResource.java b/apps/vtn/vtnweb/src/main/java/org/onosproject/vtnweb/resources/PortPairGroupWebResource.java
index 68fc6bd..28b14c7 100644
--- a/apps/vtn/vtnweb/src/main/java/org/onosproject/vtnweb/resources/PortPairGroupWebResource.java
+++ b/apps/vtn/vtnweb/src/main/java/org/onosproject/vtnweb/resources/PortPairGroupWebResource.java
@@ -64,6 +64,7 @@
*/
@GET
@Produces(MediaType.APPLICATION_JSON)
+ @Consumes(MediaType.APPLICATION_JSON)
public Response getPortPairGroups() {
Iterable<PortPairGroup> portPairGroups = get(PortPairGroupService.class).getPortPairGroups();
ObjectNode result = mapper().createObjectNode();
@@ -85,6 +86,7 @@
@GET
@Path("{group_id}")
@Produces(MediaType.APPLICATION_JSON)
+ @Consumes(MediaType.APPLICATION_JSON)
public Response getPortPairGroup(@PathParam("group_id") String id) {
PortPairGroup portPairGroup = nullIsNotFound(get(PortPairGroupService.class)
.getPortPairGroup(PortPairGroupId.of(id)),
@@ -157,6 +159,8 @@
*/
@Path("{group_id}")
@DELETE
+ @Produces(MediaType.APPLICATION_JSON)
+ @Consumes(MediaType.APPLICATION_JSON)
public Response deletePortPairGroup(@PathParam("group_id") String id) {
log.debug("Deletes port pair group by identifier {}.", id);
PortPairGroupId portPairGroupId = PortPairGroupId.of(id);
diff --git a/apps/vtn/vtnweb/src/main/java/org/onosproject/vtnweb/resources/PortPairWebResource.java b/apps/vtn/vtnweb/src/main/java/org/onosproject/vtnweb/resources/PortPairWebResource.java
index 34bea37..22a7b4b 100644
--- a/apps/vtn/vtnweb/src/main/java/org/onosproject/vtnweb/resources/PortPairWebResource.java
+++ b/apps/vtn/vtnweb/src/main/java/org/onosproject/vtnweb/resources/PortPairWebResource.java
@@ -62,6 +62,7 @@
*/
@GET
@Produces(MediaType.APPLICATION_JSON)
+ @Consumes(MediaType.APPLICATION_JSON)
public Response getPortPairs() {
Iterable<PortPair> portPairs = get(PortPairService.class).getPortPairs();
ObjectNode result = mapper().createObjectNode();
@@ -83,6 +84,7 @@
@GET
@Path("{pair_id}")
@Produces(MediaType.APPLICATION_JSON)
+ @Consumes(MediaType.APPLICATION_JSON)
public Response getPortPair(@PathParam("pair_id") String id) {
PortPair portPair = nullIsNotFound(get(PortPairService.class).getPortPair(PortPairId.of(id)),
PORT_PAIR_NOT_FOUND);
@@ -149,6 +151,8 @@
*/
@Path("{pair_id}")
@DELETE
+ @Produces(MediaType.APPLICATION_JSON)
+ @Consumes(MediaType.APPLICATION_JSON)
public Response deletePortPair(@PathParam("pair_id") String id) {
PortPairId portPairId = PortPairId.of(id);
diff --git a/apps/vtn/vtnweb/src/main/java/org/onosproject/vtnweb/resources/RouterWebResource.java b/apps/vtn/vtnweb/src/main/java/org/onosproject/vtnweb/resources/RouterWebResource.java
index f8b87cc..855209c 100644
--- a/apps/vtn/vtnweb/src/main/java/org/onosproject/vtnweb/resources/RouterWebResource.java
+++ b/apps/vtn/vtnweb/src/main/java/org/onosproject/vtnweb/resources/RouterWebResource.java
@@ -83,6 +83,7 @@
@GET
@Produces(MediaType.APPLICATION_JSON)
+ @Consumes(MediaType.APPLICATION_JSON)
public Response listRouters() {
Collection<Router> routers = get(RouterService.class).getRouters();
ObjectNode result = new ObjectMapper().createObjectNode();
@@ -93,6 +94,7 @@
@GET
@Path("{routerUUID}")
@Produces(MediaType.APPLICATION_JSON)
+ @Consumes(MediaType.APPLICATION_JSON)
public Response getRouter(@PathParam("routerUUID") String id,
@QueryParam("fields") List<String> fields) {
diff --git a/apps/vtn/vtnweb/src/main/java/org/onosproject/vtnweb/resources/SubnetWebResource.java b/apps/vtn/vtnweb/src/main/java/org/onosproject/vtnweb/resources/SubnetWebResource.java
index e77358d..ca4f749 100644
--- a/apps/vtn/vtnweb/src/main/java/org/onosproject/vtnweb/resources/SubnetWebResource.java
+++ b/apps/vtn/vtnweb/src/main/java/org/onosproject/vtnweb/resources/SubnetWebResource.java
@@ -75,6 +75,7 @@
@GET
@Produces(MediaType.APPLICATION_JSON)
+ @Consumes(MediaType.APPLICATION_JSON)
public Response listSubnets() {
Iterable<Subnet> subnets = get(SubnetService.class).getSubnets();
ObjectNode result = new ObjectMapper().createObjectNode();
@@ -85,6 +86,7 @@
@GET
@Path("{subnetUUID}")
@Produces(MediaType.APPLICATION_JSON)
+ @Consumes(MediaType.APPLICATION_JSON)
public Response getSubnet(@PathParam("subnetUUID") String id) {
if (!get(SubnetService.class).exists(SubnetId.subnetId(id))) {
diff --git a/apps/vtn/vtnweb/src/main/java/org/onosproject/vtnweb/resources/TenantNetworkWebResource.java b/apps/vtn/vtnweb/src/main/java/org/onosproject/vtnweb/resources/TenantNetworkWebResource.java
index cf17985..2b0cd3b 100644
--- a/apps/vtn/vtnweb/src/main/java/org/onosproject/vtnweb/resources/TenantNetworkWebResource.java
+++ b/apps/vtn/vtnweb/src/main/java/org/onosproject/vtnweb/resources/TenantNetworkWebResource.java
@@ -77,7 +77,8 @@
.newConcurrentMap();
@GET
- @Produces({ MediaType.APPLICATION_JSON })
+ @Produces(MediaType.APPLICATION_JSON)
+ @Consumes(MediaType.APPLICATION_JSON)
public Response getNetworks(@QueryParam("id") String queryId,
@QueryParam("name") String queryName,
@QueryParam("admin_state_up") String queryadminStateUp,
@@ -144,7 +145,8 @@
@GET
@Path("{id}")
- @Produces({ MediaType.APPLICATION_JSON })
+ @Produces(MediaType.APPLICATION_JSON)
+ @Consumes(MediaType.APPLICATION_JSON)
public Response getNetwork(@PathParam("id") String id) {
if (!get(TenantNetworkService.class).exists(TenantNetworkId
diff --git a/apps/vtn/vtnweb/src/main/java/org/onosproject/vtnweb/resources/VirtualPortWebResource.java b/apps/vtn/vtnweb/src/main/java/org/onosproject/vtnweb/resources/VirtualPortWebResource.java
index a635c11..1e1cc79 100644
--- a/apps/vtn/vtnweb/src/main/java/org/onosproject/vtnweb/resources/VirtualPortWebResource.java
+++ b/apps/vtn/vtnweb/src/main/java/org/onosproject/vtnweb/resources/VirtualPortWebResource.java
@@ -80,7 +80,8 @@
.getLogger(VirtualPortService.class);
@GET
- @Produces({ MediaType.APPLICATION_JSON })
+ @Produces(MediaType.APPLICATION_JSON)
+ @Consumes(MediaType.APPLICATION_JSON)
public Response getPorts() {
Iterable<VirtualPort> virtualPorts = get(VirtualPortService.class)
.getPorts();
@@ -91,7 +92,8 @@
@GET
@Path("{id}")
- @Produces({ MediaType.APPLICATION_JSON })
+ @Produces(MediaType.APPLICATION_JSON)
+ @Consumes(MediaType.APPLICATION_JSON)
public Response getportsById(@PathParam("id") String id) {
if (!get(VirtualPortService.class).exists(VirtualPortId.portId(id))) {