summaryrefslogtreecommitdiffstats
path: root/adaptors
diff options
context:
space:
mode:
authorStan Bonev (sb5356) <sb5356@att.com>2024-01-10 11:05:12 -0500
committerDan Timoney <dtimoney@att.com>2024-01-10 18:04:37 +0000
commit7f7b50d25f1e75706a9f1c22a897c715c377d1d9 (patch)
treefb4cc023d3aef1f3870a2f31abd610f76f45cbbb /adaptors
parent9c8fc6851745906dba90eaf717f4605ee8509cd8 (diff)
RA: Support for using allocated number in the entity id
Issue-ID: CCSDK-3977 Change-Id: Iaf1275edee3ca8c6593263c7f3f7c4684aae0d97 Signed-off-by: Stan Bonev <sb5356@att.com> (cherry picked from commit e65b8638cb888f66d3c03f5507a804ff07851e0e)
Diffstat (limited to 'adaptors')
-rw-r--r--adaptors/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/rm/util/RangeUtil.java11
1 files changed, 9 insertions, 2 deletions
diff --git a/adaptors/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/rm/util/RangeUtil.java b/adaptors/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/rm/util/RangeUtil.java
index 2e378f1aa..77600b46b 100644
--- a/adaptors/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/rm/util/RangeUtil.java
+++ b/adaptors/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/rm/util/RangeUtil.java
@@ -122,8 +122,8 @@ public class RangeUtil {
rai.resourceKey.assetId = req.assetId;
rai.resourceKey.resourceName = req.resourceName;
rai.applicationId = req.applicationId;
- rai.resourceSetId = req.resourceSetId;
- rai.resourceUnionId = req.resourceUnionId;
+ rai.resourceSetId = req.resourceSetId = replaceNumber(req.resourceSetId, requestedNumbers);
+ rai.resourceUnionId = req.resourceUnionId = replaceNumber(req.resourceUnionId, requestedNumbers);
rai.resourceShareGroupList = req.resourceShareGroupList;
rai.used = requestedNumbers;
@@ -142,6 +142,13 @@ public class RangeUtil {
recalculate(rr);
}
+ private static String replaceNumber(String s, SortedSet<Integer> numbers) {
+ if (s == null || numbers == null || numbers.isEmpty()) {
+ return s;
+ }
+ return s.replaceAll("\\$\\{n\\}", numbers.first().toString());
+ }
+
private static boolean eq(Object o1, Object o2) {
return o1 == null ? o2 == null : o1.equals(o2);
}