Satish K
Committed by Gerrit Code Review

Wrong Check and invalid check fix

Change-Id: I99e55295c68c073f4aa4c4d5c3218e5bc460e6cc
......@@ -269,7 +269,6 @@ public class TenantNetworkWebResource extends AbstractWebResource {
TenantNetwork network = null;
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");
......@@ -280,14 +279,12 @@ public class TenantNetworkWebResource extends AbstractWebResource {
String tenantId = node.get("tenant_id").asText();
boolean routerExternal = node.get("router:external").asBoolean();
String type = node.get("provider:network_type").asText();
String physicalNetwork = node.get("provider:physical_network")
.asText();
String segmentationId = node.get("provider:segmentation_id")
.asText();
String physicalNetwork = node.get("provider:physical_network").asText();
String segmentationId = node.get("provider:segmentation_id").asText();
TenantNetworkId id = null;
if (flag == CREATE_NETWORK) {
if (flag.equals(CREATE_NETWORK)) {
id = TenantNetworkId.networkId(node.get("id").asText());
} else if (flag == UPDATE_NETWORK) {
} else if (flag.equals(UPDATE_NETWORK)) {
id = networkId;
}
network = new DefaultTenantNetwork(
......@@ -304,7 +301,7 @@ public class TenantNetworkWebResource extends AbstractWebResource {
SegmentationId
.segmentationId(segmentationId));
networksMap.putIfAbsent(id, network);
}
return Collections.unmodifiableCollection(networksMap.values());
}
......@@ -319,7 +316,6 @@ public class TenantNetworkWebResource extends AbstractWebResource {
TenantNetwork network = null;
ConcurrentMap<TenantNetworkId, TenantNetwork> networksMap = Maps
.newConcurrentMap();
if (nodes != null) {
for (JsonNode node : nodes) {
String id = node.get("id").asText();
String name = node.get("name").asText();
......@@ -330,13 +326,10 @@ public class TenantNetworkWebResource extends AbstractWebResource {
boolean routerExternal = node.get("router:external")
.asBoolean();
String type = node.get("provider:network_type").asText();
String physicalNetwork = node.get("provider:physical_network")
.asText();
String segmentationId = node.get("provider:segmentation_id")
.asText();
String physicalNetwork = node.get("provider:physical_network").asText();
String segmentationId = node.get("provider:segmentation_id").asText();
network = new DefaultTenantNetwork(
TenantNetworkId
.networkId(id),
TenantNetworkId.networkId(id),
name,
adminStateUp,
isState(state),
......@@ -344,13 +337,11 @@ public class TenantNetworkWebResource extends AbstractWebResource {
TenantId.tenantId(tenantId),
routerExternal,
isType(type),
PhysicalNetwork
.physicalNetwork(physicalNetwork),
SegmentationId
.segmentationId(segmentationId));
PhysicalNetwork.physicalNetwork(physicalNetwork),
SegmentationId.segmentationId(segmentationId));
networksMap.putIfAbsent(TenantNetworkId.networkId(id), network);
}
}
return Collections.unmodifiableCollection(networksMap.values());
}
......