mirror of https://github.com/apache/cloudstack.git
bug 12380: return cidr in listNetworks response
status 12380: resolved fixed
This commit is contained in:
parent
04c7bb7518
commit
c83b1ddb05
|
|
@ -49,11 +49,8 @@ public class NetworkResponse extends BaseResponse implements ControlledEntityRes
|
|||
@SerializedName(ApiConstants.NETMASK) @Param(description="the network's netmask")
|
||||
private String netmask;
|
||||
|
||||
@SerializedName(ApiConstants.START_IP) @Param(description="the start ip of the network")
|
||||
private String startIp;
|
||||
|
||||
@SerializedName(ApiConstants.END_IP) @Param(description="the end ip of the network")
|
||||
private String endIp;
|
||||
@SerializedName(ApiConstants.CIDR) @Param(description="the cidr the network")
|
||||
private String cidr;
|
||||
|
||||
@SerializedName(ApiConstants.ZONE_ID) @Param(description="zone id of the network")
|
||||
private IdentityProxy zoneId = new IdentityProxy("data_center");
|
||||
|
|
@ -206,14 +203,6 @@ public class NetworkResponse extends BaseResponse implements ControlledEntityRes
|
|||
this.displaytext = displaytext;
|
||||
}
|
||||
|
||||
public void setStartIp(String startIp) {
|
||||
this.startIp = startIp;
|
||||
}
|
||||
|
||||
public void setEndIp(String endIp) {
|
||||
this.endIp = endIp;
|
||||
}
|
||||
|
||||
public void setVlan(String vlan) {
|
||||
this.vlan = vlan;
|
||||
}
|
||||
|
|
@ -267,4 +256,8 @@ public class NetworkResponse extends BaseResponse implements ControlledEntityRes
|
|||
public void setZoneName(String zoneName) {
|
||||
this.zoneName = zoneName;
|
||||
}
|
||||
|
||||
public void setCidr(String cidr) {
|
||||
this.cidr = cidr;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2641,9 +2641,6 @@ public class ApiResponseHelper implements ResponseGenerator {
|
|||
if (network.getBroadcastDomainType() != null) {
|
||||
response.setBroadcastDomainType(network.getBroadcastDomainType().toString());
|
||||
}
|
||||
if (network.getBroadcastUri() != null) {
|
||||
response.setBroadcastUri(network.getBroadcastUri().toString());
|
||||
}
|
||||
|
||||
if (network.getTrafficType() != null) {
|
||||
response.setTrafficType(network.getTrafficType().name());
|
||||
|
|
@ -2652,18 +2649,19 @@ public class ApiResponseHelper implements ResponseGenerator {
|
|||
if (network.getGuestType() != null) {
|
||||
response.setType(network.getGuestType().toString());
|
||||
}
|
||||
|
||||
// get start ip and end ip of corresponding vlan
|
||||
List<? extends Vlan> vlan = ApiDBUtils.listVlanByNetworkId(network.getId());
|
||||
if (vlan != null && !vlan.isEmpty()) {
|
||||
Vlan singleVlan = vlan.get(0);
|
||||
String ipRange = singleVlan.getIpRange();
|
||||
String[] range = ipRange.split("-");
|
||||
response.setStartIp(range[0]);
|
||||
response.setEndIp(range[1]);
|
||||
response.setGateway(singleVlan.getVlanGateway());
|
||||
response.setNetmask(singleVlan.getVlanNetmask());
|
||||
response.setVlan(singleVlan.getVlanTag());
|
||||
|
||||
response.setGateway(network.getGateway());
|
||||
|
||||
//FIXME - either set netmask or cidr
|
||||
response.setCidr(network.getCidr());
|
||||
response.setNetmask(NetUtils.cidr2Netmask(network.getCidr()));
|
||||
|
||||
//FIXME - either set broadcast URI or vlan
|
||||
if (network.getBroadcastUri() != null) {
|
||||
String broadcastUri = network.getBroadcastUri().toString();
|
||||
response.setBroadcastUri(broadcastUri);
|
||||
String vlan = broadcastUri.substring("vlan://".length(), broadcastUri.length());
|
||||
response.setVlan(vlan);
|
||||
}
|
||||
|
||||
DataCenter zone = ApiDBUtils.findZoneById(network.getDataCenterId());
|
||||
|
|
|
|||
Loading…
Reference in New Issue