summaryrefslogtreecommitdiffstats
path: root/catalog-model
diff options
context:
space:
mode:
authorJvD_Ericsson <jeff.van.dam@est.tech>2023-09-11 10:56:37 +0100
committerMichael Morris <michael.morris@est.tech>2023-09-25 08:50:01 +0000
commitceaf83e0f29c10e4521321abcd6dd17080d2db60 (patch)
tree4ff4ac46184543f6a86f35a1860a9a5b7d6a24e8 /catalog-model
parentda6b4a245482f4eebade8f487fc9d63f456469ab (diff)
Support setting interfaces on instances
Issue-ID: SDC-4620 Signed-off-by: JvD_Ericsson <jeff.van.dam@est.tech> Change-Id: I4f78eb5e017e79120d61870ecc3b7268f83b4206
Diffstat (limited to 'catalog-model')
-rw-r--r--catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/NodeTemplateOperation.java74
-rw-r--r--catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/ToscaOperationFacade.java60
2 files changed, 76 insertions, 58 deletions
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 f75c7a6b06..0b296757cf 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
@@ -17,6 +17,7 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
+
package org.openecomp.sdc.be.model.jsonjanusgraph.operations;
import fj.data.Either;
@@ -134,7 +135,8 @@ public class NodeTemplateOperation extends BaseOperation {
static final String HEAT_VF_ENV_NAME = "VfHeatEnv";
static final String HEAT_ENV_SUFFIX = "env";
private static final String FAILED_TO_FETCH_CONTAINER_VERTEX_ERROR = "Failed to fetch container vertex {} error {}";
- private static final String FAILED_TO_UPDATE_TOPOLOGY_TEMPLATE_WITH_NEW_COMPONENT_INSTANCE = "Failed to update topology template {} with new component instance {}. ";
+ private static final String FAILED_TO_UPDATE_TOPOLOGY_TEMPLATE_WITH_NEW_COMPONENT_INSTANCE =
+ "Failed to update topology template {} with new component instance {}. ";
private static final String ARTIFACT_PLACEHOLDER_TYPE = "type";
private static final String ARTIFACT_PLACEHOLDER_DISPLAY_NAME = "displayName";
private static final Object ARTIFACT_PLACEHOLDER_DESCRIPTION = "description";
@@ -669,31 +671,35 @@ public class NodeTemplateOperation extends BaseOperation {
if (composition != null) {
Map<String, RelationshipInstDataDefinition> relations = composition.getRelations();
if (MapUtils.isNotEmpty(relations)) {
- Either<Pair<GraphVertex, Map<String, MapListCapabilityDataDefinition>>, StorageOperationStatus> capResult = fetchContainerCalculatedCapability(
- containerV, EdgeLabelEnum.CALCULATED_CAPABILITIES);
+ Either<Pair<GraphVertex, Map<String, MapListCapabilityDataDefinition>>, StorageOperationStatus> capResult =
+ fetchContainerCalculatedCapability(
+ containerV, EdgeLabelEnum.CALCULATED_CAPABILITIES);
if (capResult.isRight()) {
return capResult.right().value();
}
Map<String, MapListCapabilityDataDefinition> calculatedCapabilty = capResult.left().value().getRight();
- Either<Pair<GraphVertex, Map<String, MapListCapabilityDataDefinition>>, StorageOperationStatus> capFullResult = fetchContainerCalculatedCapability(
- containerV, EdgeLabelEnum.FULLFILLED_CAPABILITIES);
+ Either<Pair<GraphVertex, Map<String, MapListCapabilityDataDefinition>>, StorageOperationStatus> capFullResult =
+ fetchContainerCalculatedCapability(
+ containerV, EdgeLabelEnum.FULLFILLED_CAPABILITIES);
if (capFullResult.isRight()) {
return capFullResult.right().value();
}
Map<String, MapListCapabilityDataDefinition> fullFilledCapabilty = capFullResult.left().value().getRight();
- Either<Pair<GraphVertex, Map<String, MapListRequirementDataDefinition>>, StorageOperationStatus> reqResult = fetchContainerCalculatedRequirement(
- containerV, EdgeLabelEnum.CALCULATED_REQUIREMENTS);
+ Either<Pair<GraphVertex, Map<String, MapListRequirementDataDefinition>>, StorageOperationStatus> reqResult =
+ fetchContainerCalculatedRequirement(
+ containerV, EdgeLabelEnum.CALCULATED_REQUIREMENTS);
if (reqResult.isRight()) {
return reqResult.right().value();
}
Map<String, MapListRequirementDataDefinition> calculatedRequirement = reqResult.left().value().getRight();
- Either<Pair<GraphVertex, Map<String, MapListRequirementDataDefinition>>, StorageOperationStatus> reqFullResult = fetchContainerCalculatedRequirement(
- containerV, EdgeLabelEnum.FULLFILLED_REQUIREMENTS);
+ Either<Pair<GraphVertex, Map<String, MapListRequirementDataDefinition>>, StorageOperationStatus> reqFullResult =
+ fetchContainerCalculatedRequirement(
+ containerV, EdgeLabelEnum.FULLFILLED_REQUIREMENTS);
if (reqResult.isRight()) {
return reqResult.right().value();
}
@@ -1588,26 +1594,30 @@ public class NodeTemplateOperation extends BaseOperation {
return Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(error));
}
GraphVertex containerV = containerVEither.left().value();
- Either<Pair<GraphVertex, Map<String, MapListCapabilityDataDefinition>>, StorageOperationStatus> capResult = fetchContainerCalculatedCapability(
- containerV, EdgeLabelEnum.CALCULATED_CAPABILITIES);
+ Either<Pair<GraphVertex, Map<String, MapListCapabilityDataDefinition>>, StorageOperationStatus> capResult =
+ fetchContainerCalculatedCapability(
+ containerV, EdgeLabelEnum.CALCULATED_CAPABILITIES);
if (capResult.isRight()) {
return Either.right(capResult.right().value());
}
Map<String, MapListCapabilityDataDefinition> calculatedCapabilty = capResult.left().value().getRight();
- Either<Pair<GraphVertex, Map<String, MapListCapabilityDataDefinition>>, StorageOperationStatus> capFullResult = fetchContainerCalculatedCapability(
- containerV, EdgeLabelEnum.FULLFILLED_CAPABILITIES);
+ Either<Pair<GraphVertex, Map<String, MapListCapabilityDataDefinition>>, StorageOperationStatus> capFullResult =
+ fetchContainerCalculatedCapability(
+ containerV, EdgeLabelEnum.FULLFILLED_CAPABILITIES);
if (capResult.isRight()) {
return Either.right(capResult.right().value());
}
Map<String, MapListCapabilityDataDefinition> fullFilledCapabilty = capFullResult.left().value().getRight();
- Either<Pair<GraphVertex, Map<String, MapListRequirementDataDefinition>>, StorageOperationStatus> reqResult = fetchContainerCalculatedRequirement(
- containerV, EdgeLabelEnum.CALCULATED_REQUIREMENTS);
+ Either<Pair<GraphVertex, Map<String, MapListRequirementDataDefinition>>, StorageOperationStatus> reqResult =
+ fetchContainerCalculatedRequirement(
+ containerV, EdgeLabelEnum.CALCULATED_REQUIREMENTS);
if (reqResult.isRight()) {
return Either.right(reqResult.right().value());
}
Map<String, MapListRequirementDataDefinition> calculatedRequirement = reqResult.left().value().getRight();
- Either<Pair<GraphVertex, Map<String, MapListRequirementDataDefinition>>, StorageOperationStatus> reqFullResult = fetchContainerCalculatedRequirement(
- containerV, EdgeLabelEnum.FULLFILLED_REQUIREMENTS);
+ Either<Pair<GraphVertex, Map<String, MapListRequirementDataDefinition>>, StorageOperationStatus> reqFullResult =
+ fetchContainerCalculatedRequirement(
+ containerV, EdgeLabelEnum.FULLFILLED_REQUIREMENTS);
if (reqResult.isRight()) {
return Either.right(reqResult.right().value());
}
@@ -1823,26 +1833,30 @@ public class NodeTemplateOperation extends BaseOperation {
}
Map<String, RelationshipInstDataDefinition> relations = compositionDataDefinition.getRelations();
List<CapabilityRequirementRelationship> relationPairList = requirementDef.getRelationships();
- Either<Pair<GraphVertex, Map<String, MapListCapabilityDataDefinition>>, StorageOperationStatus> capResult = fetchContainerCalculatedCapability(
- containerV, EdgeLabelEnum.CALCULATED_CAPABILITIES);
+ Either<Pair<GraphVertex, Map<String, MapListCapabilityDataDefinition>>, StorageOperationStatus> capResult =
+ fetchContainerCalculatedCapability(
+ containerV, EdgeLabelEnum.CALCULATED_CAPABILITIES);
if (capResult.isRight()) {
return Either.right(capResult.right().value());
}
Map<String, MapListCapabilityDataDefinition> calculatedCapability = capResult.left().value().getRight();
- Either<Pair<GraphVertex, Map<String, MapListCapabilityDataDefinition>>, StorageOperationStatus> capFullResult = fetchContainerCalculatedCapability(
- containerV, EdgeLabelEnum.FULLFILLED_CAPABILITIES);
+ Either<Pair<GraphVertex, Map<String, MapListCapabilityDataDefinition>>, StorageOperationStatus> capFullResult =
+ fetchContainerCalculatedCapability(
+ containerV, EdgeLabelEnum.FULLFILLED_CAPABILITIES);
if (capResult.isRight()) {
return Either.right(capResult.right().value());
}
Map<String, MapListCapabilityDataDefinition> fulfilledCapability = capFullResult.left().value().getRight();
- Either<Pair<GraphVertex, Map<String, MapListRequirementDataDefinition>>, StorageOperationStatus> reqResult = fetchContainerCalculatedRequirement(
- containerV, EdgeLabelEnum.CALCULATED_REQUIREMENTS);
+ Either<Pair<GraphVertex, Map<String, MapListRequirementDataDefinition>>, StorageOperationStatus> reqResult =
+ fetchContainerCalculatedRequirement(
+ containerV, EdgeLabelEnum.CALCULATED_REQUIREMENTS);
if (reqResult.isRight()) {
return Either.right(reqResult.right().value());
}
Map<String, MapListRequirementDataDefinition> calculatedRequirement = reqResult.left().value().getRight();
- Either<Pair<GraphVertex, Map<String, MapListRequirementDataDefinition>>, StorageOperationStatus> reqFullResult = fetchContainerCalculatedRequirement(
- containerV, EdgeLabelEnum.FULLFILLED_REQUIREMENTS);
+ Either<Pair<GraphVertex, Map<String, MapListRequirementDataDefinition>>, StorageOperationStatus> reqFullResult =
+ fetchContainerCalculatedRequirement(
+ containerV, EdgeLabelEnum.FULLFILLED_REQUIREMENTS);
if (reqResult.isRight()) {
return Either.right(reqResult.right().value());
}
@@ -2237,8 +2251,9 @@ public class NodeTemplateOperation extends BaseOperation {
private Either<Pair<GraphVertex, Map<String, MapListCapabilityDataDefinition>>, StorageOperationStatus> fetchContainerCalculatedCapability(
GraphVertex containerV, EdgeLabelEnum capLabel) {
- Either<Pair<GraphVertex, Map<String, MapListCapabilityDataDefinition>>, JanusGraphOperationStatus> calculatedCapabiltyEither = getDataAndVertexFromGraph(
- containerV, capLabel);
+ Either<Pair<GraphVertex, Map<String, MapListCapabilityDataDefinition>>, JanusGraphOperationStatus> calculatedCapabiltyEither =
+ getDataAndVertexFromGraph(
+ containerV, capLabel);
if (calculatedCapabiltyEither.isRight()) {
JanusGraphOperationStatus error = calculatedCapabiltyEither.right().value();
CommonUtility
@@ -2251,8 +2266,9 @@ public class NodeTemplateOperation extends BaseOperation {
private Either<Pair<GraphVertex, Map<String, MapListRequirementDataDefinition>>, StorageOperationStatus> fetchContainerCalculatedRequirement(
GraphVertex containerV, EdgeLabelEnum reqLabel) {
- Either<Pair<GraphVertex, Map<String, MapListRequirementDataDefinition>>, JanusGraphOperationStatus> calculatedRequirementEither = getDataAndVertexFromGraph(
- containerV, reqLabel);
+ Either<Pair<GraphVertex, Map<String, MapListRequirementDataDefinition>>, JanusGraphOperationStatus> calculatedRequirementEither =
+ getDataAndVertexFromGraph(
+ containerV, reqLabel);
if (calculatedRequirementEither.isRight()) {
JanusGraphOperationStatus error = calculatedRequirementEither.right().value();
CommonUtility
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 951dc5aaed..b6339e85ec 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
@@ -17,13 +17,39 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
+
package org.openecomp.sdc.be.model.jsonjanusgraph.operations;
+import static java.util.Objects.requireNonNull;
+import static org.apache.commons.collections.CollectionUtils.isEmpty;
+import static org.apache.commons.collections.CollectionUtils.isNotEmpty;
+import static org.janusgraph.core.attribute.Text.REGEX;
+import static org.openecomp.sdc.be.dao.jsongraph.types.VertexTypeEnum.TOPOLOGY_TEMPLATE;
+
import com.vdurmont.semver4j.Semver;
import com.vdurmont.semver4j.Semver.SemverType;
import fj.data.Either;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.EnumMap;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+import java.util.Map.Entry;
+import java.util.Objects;
+import java.util.Optional;
+import java.util.Set;
+import java.util.TreeSet;
+import java.util.function.BiPredicate;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
+import java.util.stream.Collectors;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.collections.MapUtils;
import org.apache.commons.lang3.StringUtils;
@@ -113,32 +139,6 @@ import org.openecomp.sdc.common.log.wrappers.Logger;
import org.openecomp.sdc.common.util.ValidationUtils;
import org.springframework.beans.factory.annotation.Autowired;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Comparator;
-import java.util.EnumMap;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
-import java.util.Map.Entry;
-import java.util.Objects;
-import java.util.Optional;
-import java.util.Set;
-import java.util.TreeSet;
-import java.util.function.BiPredicate;
-import java.util.stream.Collectors;
-
-import static java.util.Objects.requireNonNull;
-import static org.apache.commons.collections.CollectionUtils.isEmpty;
-import static org.apache.commons.collections.CollectionUtils.isNotEmpty;
-import static org.janusgraph.core.attribute.Text.REGEX;
-import static org.openecomp.sdc.be.dao.jsongraph.types.VertexTypeEnum.TOPOLOGY_TEMPLATE;
-
@org.springframework.stereotype.Component("tosca-operation-facade")
public class ToscaOperationFacade {
@@ -146,9 +146,11 @@ public class ToscaOperationFacade {
public static final String PROXY_SUFFIX = "_proxy";
// region - Fields
private static final String COULDNT_FETCH_A_COMPONENT_WITH_AND_UNIQUE_ID_ERROR = "Couldn't fetch a component with and UniqueId {}, error: {}";
- private static final String FAILED_TO_FIND_RECENTLY_ADDED_PROPERTY_ON_THE_RESOURCE_STATUS_IS = "Failed to find recently added property {} on the resource {}. Status is {}. ";
+ private static final String FAILED_TO_FIND_RECENTLY_ADDED_PROPERTY_ON_THE_RESOURCE_STATUS_IS =
+ "Failed to find recently added property {} on the resource {}. Status is {}. ";
private static final String FAILED_TO_GET_UPDATED_RESOURCE_STATUS_IS = "Failed to get updated resource {}. Status is {}. ";
- private static final String FAILED_TO_ADD_THE_PROPERTY_TO_THE_RESOURCE_STATUS_IS = "Failed to add the property {} to the resource {}. Status is {}. ";
+ private static final String FAILED_TO_ADD_THE_PROPERTY_TO_THE_RESOURCE_STATUS_IS =
+ "Failed to add the property {} to the resource {}. Status is {}. ";
private static final String SERVICE = "service";
private static final String VF = "VF";
private static final String NOT_SUPPORTED_COMPONENT_TYPE = "Not supported component type {}";
@@ -2532,7 +2534,7 @@ public class ToscaOperationFacade {
}
Component component = latestVersionList.size() == 1 ? latestVersionList.get(0)
: latestVersionList.stream().max((c1, c2) -> Double.compare(Double.parseDouble(c1.getVersion()), Double.parseDouble(c2.getVersion())))
- .get();
+ .get();
return Either.left(component);
}