summaryrefslogtreecommitdiffstats
path: root/adaptors/resource-assignment/provider/src/main
diff options
context:
space:
mode:
authorStan Bonev (sb5356) <sb5356@att.com>2021-07-15 13:47:22 -0400
committerStan Bonev (sb5356) <sb5356@att.com>2021-07-15 13:48:47 -0400
commiteb36deb15c4882ec373e972eab40fcb947b5f002 (patch)
treef2561ad8cbc1bf6177f9c5112d936eb3d5ec8abe /adaptors/resource-assignment/provider/src/main
parent87bd7fe2daaa236dea20b4eba7b347175b0e5799 (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')
-rw-r--r--adaptors/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/ResourceAllocator.java4
-rw-r--r--adaptors/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/alloc/DbAllocationRule.java10
-rw-r--r--adaptors/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/comp/ResourceRequest.java2
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;