mirror of
https://github.com/opennetworkinglab/onos.git
synced 2025-10-21 12:22:18 +02:00
[ONOS-2718][ONOS-2722][ONOS-2723] Fix three bugs of vtnweb.
Change-Id: I4dc631c879e1a7239ce1538289cea51d903ddb50
This commit is contained in:
parent
743a8492b8
commit
bac6283d17
@ -15,6 +15,7 @@
|
||||
*/
|
||||
package org.onosproject.vtnweb.resources;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkArgument;
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
import static javax.ws.rs.core.Response.Status.INTERNAL_SERVER_ERROR;
|
||||
|
||||
@ -225,6 +226,8 @@ public class SubnetWebResource extends AbstractWebResource {
|
||||
*/
|
||||
public Iterable<Subnet> changeJsonToSub(JsonNode subnetNodes) {
|
||||
checkNotNull(subnetNodes, JSON_NOT_NULL);
|
||||
checkArgument(!subnetNodes.get("enable_dhcp").isBoolean(), "enable_dhcp should be boolean");
|
||||
checkArgument(!subnetNodes.get("shared").isBoolean(), "shared should be boolean");
|
||||
Map<SubnetId, Subnet> subMap = new HashMap<SubnetId, Subnet>();
|
||||
if (!subnetNodes.hasNonNull("id")) {
|
||||
return null;
|
||||
@ -245,7 +248,7 @@ public class SubnetWebResource extends AbstractWebResource {
|
||||
ipVersion = Version.INET;
|
||||
break;
|
||||
default:
|
||||
ipVersion = null;
|
||||
throw new IllegalArgumentException("ipVersion should be 4 or 6.");
|
||||
}
|
||||
|
||||
IpPrefix cidr = IpPrefix.valueOf(subnetNodes.get("cidr").asText());
|
||||
|
@ -16,6 +16,7 @@
|
||||
package org.onosproject.vtnweb.resources;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
import static com.google.common.base.Preconditions.checkArgument;
|
||||
import static javax.ws.rs.core.Response.Status.INTERNAL_SERVER_ERROR;
|
||||
import static javax.ws.rs.core.Response.Status.OK;
|
||||
|
||||
@ -268,6 +269,9 @@ public class TenantNetworkWebResource extends AbstractWebResource {
|
||||
ConcurrentMap<TenantNetworkId, TenantNetwork> networksMap = Maps
|
||||
.newConcurrentMap();
|
||||
if (node != null) {
|
||||
checkArgument(!node.get("admin_state_up").isBoolean(), "admin_state_up should be boolean");
|
||||
checkArgument(!node.get("shared").isBoolean(), "shared should be boolean");
|
||||
checkArgument(!node.get("router:external").isBoolean(), "router:external should be boolean");
|
||||
String name = node.get("name").asText();
|
||||
boolean adminStateUp = node.get("admin_state_up").asBoolean();
|
||||
String state = node.get("status").asText();
|
||||
|
@ -94,7 +94,7 @@ public class VirtualPortWebResource extends AbstractWebResource {
|
||||
public Response getportsById(@PathParam("id") String id) {
|
||||
|
||||
if (!get(VirtualPortService.class).exists(VirtualPortId.portId(id))) {
|
||||
return ok("the virtualPort does not exists").build();
|
||||
return ok("The virtualPort does not exists").build();
|
||||
}
|
||||
VirtualPort virtualPort = nullIsNotFound(get(VirtualPortService.class)
|
||||
.getPort(VirtualPortId.portId(id)), VPORT_NOT_FOUND);
|
||||
|
Loading…
x
Reference in New Issue
Block a user