Skip to content

Commit

Permalink
Allow to pass both vlanId and subnetAddressId into getFreeIPAddress m…
Browse files Browse the repository at this point in the history
…ethod
  • Loading branch information
dolfinus committed Jan 6, 2020
1 parent 3a44e04 commit 94dea67
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions src/org/camunda/latera/bss/connectors/hid/hydra/Address.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -952,7 +952,7 @@ trait Address {
input.remove('subnetAddress')
}
if (input.containsKey('subnetAddresses') && notEmpty(input.subnetAddresses) && isList(input.subnetAddresses)) {
input.subnetAddressIds = getAddressesBy(code: [in: input.subnetAddresses], addrType: 'ADDR_TYPE_Subnet', order: [n_value: 'asc']).collect {Map address -> address?.n_address_id}
input.subnetAddressIds = getAddressesBy(code: [in: input.subnetAddresses], addrType: 'ADDR_TYPE_Subnet', order: [n_value: 'asc']).collect { Map address -> toIntSafe(address.n_address_id) }
input.remove('subnetAddress')
}
if (input.containsKey('vlan') && notEmpty(input.vlan)) {
Expand All @@ -965,12 +965,17 @@ trait Address {
params.subnetAddressIds = [params.subnetAddressId]
params.remove('subnetAddressId')
}
if (params.vlanId && !params.subnetAddressIds) {
params.subnetAddressIds = getSubnetAddressesByVLAN(vlanId: params.vlanId).collect{ Map subnet -> subnet.n_subnet_id }
}
if (!params.subnetAddressIds) {
params.subnetAddressIds = []
}
if (params.vlanId) {
List subnetIdsByVLAN = getSubnetAddressesByVLAN(vlanId: params.vlanId).collect{ Map subnet -> toIntSafe(subnet.n_subnet_id) }
if (params.subnetAddressIds) {
params.subnetAddressIds = params.subnetAddressIds.findAll { Map subnetAddrId -> toIntSafe(subnetAddrId) in subnetIdsByVLAN }
} else {
params.subnetAddressIds = subnetIdsByVLAN
}
}
List addresses = []
String date = encodeDateStr(params.operationDate)

Expand All @@ -979,7 +984,7 @@ trait Address {
filterReal = "UTILS_ADDRESSES_PKG_S.IS_REAL_IP(A.N_VALUE) = '${params.isPublic ? 'Y' : 'N'}'"
}

(params.subnetAddressIds ?: [null]).each { def subnetAddressId ->
(params.subnetAddressIds ?: [null]).each { def subnetAddrId ->
try {
if (!addresses) {
if (params.objectId) {
Expand Down

0 comments on commit 94dea67

Please sign in to comment.