rafaelweingartner commented on a change in pull request #2595:
CLOUDSTACK-10199: Support requesting a specific IPv4 address
URL: https://github.com/apache/cloudstack/pull/2595#discussion_r185860073
##########
File path: engine/schema/src/main/java/com/cloud/dc/dao/VlanDaoImpl.java
##########
@@ -82,6 +83,24 @@ public VlanVO findByZoneAndVlanId(long zoneId, String
vlanId) {
return findOneBy(sc);
}
+ /**
+ * Returns a vlan by the network id and if the given IPv4 is in the
network IP range.
+ */
+ @Override
+ public VlanVO findByNetworkIdAndIpv4Range(long networkId, String
ipv4Address) {
+ List<VlanVO> vlanVoList = listVlansByNetworkId(networkId);
+ for (VlanVO vlan : vlanVoList) {
+ String ipRange = vlan.getIpRange();
+ String[] ipRangeParts = ipRange.split("-");
+ String startIP = ipRangeParts[0];
+ String endIP = ipRangeParts[1];
+ if (NetUtils.isIpInRange(ipv4Address, startIP, endIP)) {
Review comment:
ok, got it
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services