return networks;
}
@DB
protected NicProfile createPrivateNicProfileForGateway(VpcGateway privateGateway) {
Network privateNetwork = _networkModel.getNetwork(privateGateway.getNetworkId());
PrivateIpVO ipVO = _privateIpDao.allocateIpAddress(privateNetwork.getDataCenterId(), privateNetwork.getId(), privateGateway.getIp4Address());
Nic privateNic = _nicDao.findByIp4AddressAndNetworkId(ipVO.getIpAddress(), privateNetwork.getId());
NicProfile privateNicProfile = new NicProfile();
if (privateNic != null) {
VirtualMachine vm = _vmDao.findById(privateNic.getId());
privateNicProfile = new NicProfile(privateNic, privateNetwork, privateNic.getBroadcastUri(), privateNic.getIsolationUri(),
_networkModel.getNetworkRate(privateNetwork.getId(), vm.getId()),
_networkModel.isSecurityGroupSupportedInNetwork(privateNetwork),
_networkModel.getNetworkTag(vm.getHypervisorType(), privateNetwork));
} else {
String vlanTag = privateNetwork.getBroadcastUri().getHost();
String netmask = NetUtils.getCidrNetmask(privateNetwork.getCidr());
PrivateIpAddress ip = new PrivateIpAddress(ipVO, vlanTag, privateNetwork.getGateway(), netmask,
NetUtils.long2Mac(NetUtils.createSequenceBasedMacAddress(ipVO.getMacAddress())));
privateNicProfile.setIp4Address(ip.getIpAddress());
privateNicProfile.setGateway(ip.getGateway());
privateNicProfile.setNetmask(ip.getNetmask());