@Override
public VlanIpRangeResponse createVlanIpRangeResponse(Vlan vlan) {
Long podId = ApiDBUtils.getPodIdForVlan(vlan.getId());
VlanIpRangeResponse vlanResponse = new VlanIpRangeResponse();
vlanResponse.setId(vlan.getId());
vlanResponse.setForVirtualNetwork(vlan.getVlanType().equals(VlanType.VirtualNetwork));
vlanResponse.setVlan(vlan.getVlanTag());
vlanResponse.setZoneId(vlan.getDataCenterId());
if (podId != null) {
HostPodVO pod = ApiDBUtils.findPodById(podId);
vlanResponse.setPodId(podId);
if (pod != null) {
vlanResponse.setPodName(pod.getName());
}
}
vlanResponse.setGateway(vlan.getVlanGateway());
vlanResponse.setNetmask(vlan.getVlanNetmask());
// get start ip and end ip of corresponding vlan
String ipRange = vlan.getIpRange();
String[] range = ipRange.split("-");
vlanResponse.setStartIp(range[0]);
vlanResponse.setEndIp(range[1]);
vlanResponse.setNetworkId(vlan.getNetworkId());
Account owner = ApiDBUtils.getVlanAccount(vlan.getId());
if (owner != null) {
populateAccount(vlanResponse, owner.getId());
populateDomain(vlanResponse, owner.getDomainId());
}
vlanResponse.setPhysicalNetworkId(vlan.getPhysicalNetworkId());
vlanResponse.setObjectName("vlan");
return vlanResponse;
}