summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorimamSidero <imam.hussain@est.tech>2022-07-21 17:17:38 +0100
committerMichael Morris <michael.morris@est.tech>2022-08-02 18:31:02 +0000
commita9d0bcd206b7a677b82e5e9b497a8b52b38e3a43 (patch)
treec114c9b85e841609af62a89204fa14576f75b3be
parent4eb2c0d521f2b16b920f27f738cb8ba146c23fdd (diff)
Enabled configuration of instance name
The given name for the instance dragged and dropped is changed to <type name>_<instance count> Signed-off-by: Imam hussain <imam.hussain@est.tech> Issue-ID: SDC-4109 Change-Id: Ibce6f911480841df496f0e7bb17a6d7cd533e803
-rw-r--r--catalog-be/src/main/docker/backend/chef-repo/cookbooks/sdc-catalog-be/templates/default/BE-configuration.yaml.erb2
-rw-r--r--catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/NodeTemplateOperation.java6
-rw-r--r--catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/ToscaOperationFacade.java6
-rw-r--r--common-app-api/src/main/java/org/openecomp/sdc/be/config/Configuration.java1
4 files changed, 11 insertions, 4 deletions
diff --git a/catalog-be/src/main/docker/backend/chef-repo/cookbooks/sdc-catalog-be/templates/default/BE-configuration.yaml.erb b/catalog-be/src/main/docker/backend/chef-repo/cookbooks/sdc-catalog-be/templates/default/BE-configuration.yaml.erb
index b0cb7ddec5..d1f3bd2c60 100644
--- a/catalog-be/src/main/docker/backend/chef-repo/cookbooks/sdc-catalog-be/templates/default/BE-configuration.yaml.erb
+++ b/catalog-be/src/main/docker/backend/chef-repo/cookbooks/sdc-catalog-be/templates/default/BE-configuration.yaml.erb
@@ -1289,3 +1289,5 @@ externalCsarStore:
secretKey: "password"
tempPath: "/home/onap/temp/"
uploadPartSize: 200000000
+#This configuration specifies the delimiter used to differentiate instance name and count
+componentInstanceCounterDelimiter: " "
diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/NodeTemplateOperation.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/NodeTemplateOperation.java
index 0e7b9f0193..910b9e3afa 100644
--- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/NodeTemplateOperation.java
+++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/NodeTemplateOperation.java
@@ -1559,7 +1559,11 @@ public class NodeTemplateOperation extends BaseOperation {
}
private String buildComponentInstanceName(String instanceSuffixNumber, String instanceName) {
- return instanceName + " " + (instanceSuffixNumber == null ? 0 : instanceSuffixNumber);
+ String delimiter = ConfigurationManager.getConfigurationManager().getConfiguration().getComponentInstanceCounterDelimiter();
+ if(delimiter == null){
+ delimiter = " ";
+ }
+ return instanceName + delimiter + (instanceSuffixNumber == null ? 0 : instanceSuffixNumber);
}
public Either<RequirementCapabilityRelDef, StorageOperationStatus> associateResourceInstances(Component component, String componentId,
diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/ToscaOperationFacade.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/ToscaOperationFacade.java
index 7c34da89f0..02fda3c51b 100644
--- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/ToscaOperationFacade.java
+++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/ToscaOperationFacade.java
@@ -1323,10 +1323,10 @@ public class ToscaOperationFacade {
private Integer getMaxCounterFromNamesAndIds(Component containerComponent, String normalizedName) {
List<String> countersInNames = containerComponent.getComponentInstances().stream()
.filter(ci -> ci.getNormalizedName() != null && ci.getNormalizedName().startsWith(normalizedName))
- .map(ci -> ci.getNormalizedName().split(normalizedName)[1]).collect(Collectors.toList());
+ .map(ci -> ci.getNormalizedName().split(normalizedName)[1].replaceAll("\\D", "")).collect(Collectors.toList());
List<String> countersInIds = containerComponent.getComponentInstances().stream()
- .filter(ci -> ci.getUniqueId() != null && ci.getUniqueId().contains(normalizedName)).map(ci -> ci.getUniqueId().split(normalizedName)[1])
- .collect(Collectors.toList());
+ .filter(ci -> ci.getUniqueId() != null && ci.getUniqueId().contains(normalizedName))
+ .map(ci -> ci.getUniqueId().split(normalizedName)[1].replaceAll("\\D", "")).collect(Collectors.toList());
List<String> namesAndIdsList = new ArrayList<>(countersInNames);
namesAndIdsList.addAll(countersInIds);
return getMaxInteger(namesAndIdsList);
diff --git a/common-app-api/src/main/java/org/openecomp/sdc/be/config/Configuration.java b/common-app-api/src/main/java/org/openecomp/sdc/be/config/Configuration.java
index 69e863b4fd..5a1eacdb58 100644
--- a/common-app-api/src/main/java/org/openecomp/sdc/be/config/Configuration.java
+++ b/common-app-api/src/main/java/org/openecomp/sdc/be/config/Configuration.java
@@ -146,6 +146,7 @@ public class Configuration extends BasicConfiguration {
private Map<String, Map<String, List<String>>> componentAllowedInstanceTypes;
private ExternalCsarStore externalCsarStore;
private CsarFormat csarFormat;
+ private String componentInstanceCounterDelimiter;
@SuppressWarnings("unchecked")
private <K, V> Map<K, V> safeGetCapsInsensitiveMap(Map<K, V> map) {