aboutsummaryrefslogtreecommitdiffstats
path: root/catalog-be/src/main
diff options
context:
space:
mode:
authorKrupaNagabhushan <krupa.nagabhushan@est.tech>2022-05-23 17:20:05 +0100
committerMichael Morris <michael.morris@est.tech>2022-06-02 21:12:38 +0000
commit3274debd73e079c795eff3b6536018efc078794c (patch)
tree86166ce0238c161c572fefddfa8df990114edd71 /catalog-be/src/main
parente2e644755baa33030a4aba228fb6be319cdbc81c (diff)
Maintain VFC external capabilities and requirements
When a VFC is added to a component and capabilities or requirement are set as external on that VFC instance those values should be maintained if the VFC instance version is changed Issue-ID: SDC-4016 Signed-off-by: KrupaNagabhushan <krupa.nagabhushan@est.tech> Change-Id: Idc86a6b5cae0cf75d8f4c37fafb01f1572908be7
Diffstat (limited to 'catalog-be/src/main')
-rw-r--r--catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ComponentInstanceBusinessLogic.java37
1 files changed, 37 insertions, 0 deletions
diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ComponentInstanceBusinessLogic.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ComponentInstanceBusinessLogic.java
index 7ea00b1d46..392020be4d 100644
--- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ComponentInstanceBusinessLogic.java
+++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ComponentInstanceBusinessLogic.java
@@ -2955,6 +2955,7 @@ public class ComponentInstanceBusinessLogic extends BaseBusinessLogic {
newComponentInstance.setInstanceCount(resResourceInfo.getInstanceCount());
newComponentInstance.setMaxOccurrences(resResourceInfo.getMaxOccurrences());
newComponentInstance.setMinOccurrences(resResourceInfo.getMinOccurrences());
+ checkForExternalReqAndCapabilities(origComponent, resResourceInfo);
ComponentInstance updatedComponentInstance =
createComponentInstanceOnGraph(containerComponent, origComponent, newComponentInstance, user);
@@ -2994,6 +2995,42 @@ public class ComponentInstanceBusinessLogic extends BaseBusinessLogic {
}
}
+ private void checkForExternalReqAndCapabilities(Component component, ComponentInstance resResourceInfo) {
+ Map<String, List<RequirementDefinition>> requirementsMap = resResourceInfo.getRequirements();
+ Map<String, List<RequirementDefinition>> externalRequirementsMap = new HashMap<>();
+ List<RequirementDefinition> externalRequirementList = new ArrayList<>();
+ if (requirementsMap != null && !requirementsMap.isEmpty()) {
+ requirementsMap.forEach((type, requirementDefinitions) -> {
+ if (requirementDefinitions != null && !requirementDefinitions.isEmpty()) {
+ for (final RequirementDefinition requirementDefinition : requirementDefinitions) {
+ if (requirementDefinition.isExternal()) {
+ externalRequirementList.add(requirementDefinition);
+ externalRequirementsMap.put(type, externalRequirementList);
+ }
+ }
+ }
+ });
+ }
+
+ Map<String, List<CapabilityDefinition>> capabilitiesMap = resResourceInfo.getCapabilities();
+ Map<String, List<CapabilityDefinition>> externalCapabilitiesMap = new HashMap<>();
+ List<CapabilityDefinition> externalCapabilitiesList = new ArrayList<>();
+ if (capabilitiesMap != null && !capabilitiesMap.isEmpty()) {
+ capabilitiesMap.forEach((type, capabilityDefinitions) -> {
+ if (capabilityDefinitions != null && !capabilityDefinitions.isEmpty()) {
+ for (final CapabilityDefinition capabilityDefinition : capabilityDefinitions) {
+ if (capabilityDefinition.isExternal()) {
+ externalCapabilitiesList.add(capabilityDefinition);
+ externalCapabilitiesMap.put(type, externalCapabilitiesList);
+ }
+ }
+ }
+ });
+ }
+ component.setCapabilities(externalCapabilitiesMap);
+ component.setRequirements(externalRequirementsMap);
+ }
+
private boolean isFillProxyRes(StorageOperationStatus fillProxyRes) {
if (fillProxyRes != StorageOperationStatus.OK) {
log.debug("Failed to fill service proxy resource data with data from service, error {}", fillProxyRes);