diff options
author | Stan Bonev (sb5356) <sb5356@att.com> | 2021-07-15 13:47:22 -0400 |
---|---|---|
committer | Stan Bonev (sb5356) <sb5356@att.com> | 2021-07-15 13:48:47 -0400 |
commit | eb36deb15c4882ec373e972eab40fcb947b5f002 (patch) | |
tree | f2561ad8cbc1bf6177f9c5112d936eb3d5ec8abe /adaptors/resource-assignment/provider/src/main | |
parent | 87bd7fe2daaa236dea20b4eba7b347175b0e5799 (diff) |
RA: Add 2 fields in RA parameters from DG context
Issue-ID: CCSDK-3372
Signed-off-by: Stan Bonev (sb5356) <sb5356@att.com>
Change-Id: I7e107c1b1c15dc0336c604b102b11293ee4b8920
Diffstat (limited to 'adaptors/resource-assignment/provider/src/main')
3 files changed, 14 insertions, 2 deletions
diff --git a/adaptors/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/ResourceAllocator.java b/adaptors/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/ResourceAllocator.java index 10f3e02b7..d41465949 100644 --- a/adaptors/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/ResourceAllocator.java +++ b/adaptors/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/ResourceAllocator.java @@ -457,6 +457,10 @@ public class ResourceAllocator implements SvcLogicResource { rr.rangeForceNewNumbers = Boolean.parseBoolean(rangeForceNewNumbersStr); String rangeNextInSequenceStr = getParam(ctx, "range-next-in-sequence", false, "false"); rr.rangeNextInSequence = Boolean.parseBoolean(rangeNextInSequenceStr); + String rangeRequestedCountStr = getParam(ctx, "range-requested-count", false, "1"); + rr.rangeRequestedCount = Integer.parseInt(rangeRequestedCountStr); + String rangeSequentialStr = getParam(ctx, "range-sequential", false, "false"); + rr.rangeSequential = Boolean.parseBoolean(rangeSequentialStr); String replaceStr = getParam(ctx, "replace", false, "true"); rr.replace = Boolean.parseBoolean(replaceStr); rr.applicationId = getParam(ctx, "application-id", false, "SDNC"); diff --git a/adaptors/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/alloc/DbAllocationRule.java b/adaptors/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/alloc/DbAllocationRule.java index d15b1508f..3b4ac3b1d 100644 --- a/adaptors/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/alloc/DbAllocationRule.java +++ b/adaptors/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/alloc/DbAllocationRule.java @@ -134,8 +134,11 @@ public class DbAllocationRule implements AllocationRule { ar.assetId = resourceTarget.resourceTargetType + "::" + resourceTarget.resourceTargetId; ar.requestedNumbers = StrUtil.listInt(resourceRequest.rangeRequestedNumbers, "Invalid value for requested-numbers"); - if (ar.requestedNumbers != null) { + if (ar.requestedNumbers != null && !ar.requestedNumbers.isEmpty()) { ar.requestedCount = ar.requestedNumbers.size(); + } else { + ar.requestedCount = resourceRequest.rangeRequestedCount; + ar.sequential = resourceRequest.rangeSequential; } ar.excludeNumbers = StrUtil.listInt(resourceRequest.rangeExcludeNumbers, "Invalid value for exclude-numbers"); ar.reverseOrder = resourceRequest.rangeReverseOrder; @@ -212,8 +215,11 @@ public class DbAllocationRule implements AllocationRule { ar.assetId = resourceTarget.resourceTargetType + "::" + resourceTarget.resourceTargetId; ar.requestedNumbers = StrUtil.listInt(resourceRequest.rangeRequestedNumbers, "Invalid value for requested-numbers"); - if (ar.requestedNumbers != null) { + if (ar.requestedNumbers != null && !ar.requestedNumbers.isEmpty()) { ar.requestedCount = ar.requestedNumbers.size(); + } else { + ar.requestedCount = resourceRequest.rangeRequestedCount; + ar.sequential = resourceRequest.rangeSequential; } ar.excludeNumbers = StrUtil.listInt(resourceRequest.rangeExcludeNumbers, "Invalid value for exclude-numbers"); ar.reverseOrder = resourceRequest.rangeReverseOrder; diff --git a/adaptors/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/comp/ResourceRequest.java b/adaptors/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/comp/ResourceRequest.java index 2ebad4c89..3b2264259 100644 --- a/adaptors/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/comp/ResourceRequest.java +++ b/adaptors/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/comp/ResourceRequest.java @@ -36,6 +36,8 @@ public class ResourceRequest { public int rangeMaxOverride; public boolean rangeForceNewNumbers; public boolean rangeNextInSequence; + public int rangeRequestedCount; + public boolean rangeSequential; public boolean replace; public String requestType; public String serviceModel; |