summaryrefslogtreecommitdiffstats
path: root/catalog-model/src
diff options
context:
space:
mode:
authorMichaelMorris <michael.morris@est.tech>2021-07-16 09:05:12 +0100
committerAnderson Ribeiro <anderson.ribeiro@est.tech>2021-08-04 15:39:41 +0000
commit50619616a9bd803bb9bb820fe83d999f26ba3f34 (patch)
treedd66b8adc10e0fc83b309ac76ed1288c1cdf1239 /catalog-model/src
parent4959218f8ced87d458151d14a38891b1fdc70c7d (diff)
Import VSP top. template handling non SDC model
Signed-off-by: MichaelMorris <michael.morris@est.tech> Issue-ID: SDC-3649 Change-Id: I2e2004187f5694f92d65b73139436fc990e7a6af
Diffstat (limited to 'catalog-model/src')
-rw-r--r--catalog-model/src/main/java/org/openecomp/sdc/be/model/ParsedToscaYamlInfo.java1
-rw-r--r--catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/NodeTemplateOperation.java3
-rw-r--r--catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/ToscaOperationFacade.java40
3 files changed, 41 insertions, 3 deletions
diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/ParsedToscaYamlInfo.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/ParsedToscaYamlInfo.java
index a8de860b28..ce7c6deb91 100644
--- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/ParsedToscaYamlInfo.java
+++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/ParsedToscaYamlInfo.java
@@ -33,4 +33,5 @@ public class ParsedToscaYamlInfo {
Map<String, UploadComponentInstanceInfo> instances;
Map<String, GroupDefinition> groups;
Map<String, PolicyDefinition> policies;
+ String substitutionMappingNodeType;
}
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 87bcda99d7..9db61e8ec3 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
@@ -1110,6 +1110,7 @@ public class NodeTemplateOperation extends BaseOperation {
private void bindCapabilityDefinition(final CapabilityDataDefinition fromCapabilityDefinition,
final CapabilityDataDefinition capabilityDefinitionToUpdate) {
capabilityDefinitionToUpdate.setExternal(fromCapabilityDefinition.isExternal());
+ capabilityDefinitionToUpdate.setExternalName(fromCapabilityDefinition.getExternalName());
}
private Optional<GraphVertex> findComponentVertex(final String componentId) {
@@ -1190,7 +1191,7 @@ public class NodeTemplateOperation extends BaseOperation {
listRequirementDataDefinition.getListToscaDataDefinition().stream()
.filter(e -> requirementDataDefinition.getOwnerId().equals(e.getOwnerId()) && requirementDataDefinition.getName().equals(e.getName()))
- .forEach(r -> r.setExternal(requirementDataDefinition.isExternal()));
+ .forEach(r -> {r.setExternal(requirementDataDefinition.isExternal()); r.setExternalName(requirementDataDefinition.getExternalName());});
return updateCalculatedReqOnGraph(componentId, containerV, existingReqs);
}
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 ec5721b95a..faedba5363 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
@@ -1871,6 +1871,36 @@ public class ToscaOperationFacade {
updateInstancesCapAndReqOnComponentFromDB(component);
return storageOperationStatus;
}
+
+ public StorageOperationStatus updateCalculatedCapabilitiesRequirements(final Map<ComponentInstance, Map<String, List<CapabilityDefinition>>> instCapabilties,
+ final Map<ComponentInstance, Map<String, List<RequirementDefinition>>> instReg,
+ final Component component) {
+ StorageOperationStatus storageOperationStatus = StorageOperationStatus.OK;
+ if (instCapabilties != null) {
+ for (Entry<ComponentInstance, Map<String, List<CapabilityDefinition>>> entry : instCapabilties.entrySet()) {
+ final Map<String, List<CapabilityDefinition>> cap = entry.getValue();
+ for (List<CapabilityDefinition> capabilityList: cap.values()) {
+ for (CapabilityDefinition capability: capabilityList) {
+ nodeTemplateOperation.updateComponentInstanceCapabilities(component.getUniqueId(), entry.getKey().getUniqueId(), capability);
+ }
+ }
+ }
+ }
+ if (instReg != null) {
+ for (Entry<ComponentInstance, Map<String, List<RequirementDefinition>>> entry : instReg.entrySet()) {
+ final Map<String, List<RequirementDefinition>> req = entry.getValue();
+ for (List<RequirementDefinition> requirementList: req.values()) {
+ for (RequirementDefinition requirement: requirementList) {
+ storageOperationStatus = nodeTemplateOperation.updateComponentInstanceRequirement(component.getUniqueId(), entry.getKey().getUniqueId(), requirement);
+ if (storageOperationStatus != StorageOperationStatus.OK) {
+ return storageOperationStatus;
+ }
+ }
+ }
+ }
+ }
+ return storageOperationStatus;
+ }
private void updateInstancesCapAndReqOnComponentFromDB(Component component) {
ComponentParametersView componentParametersView = new ComponentParametersView(true);
@@ -1896,6 +1926,9 @@ public class ToscaOperationFacade {
// include props
hasProps.put(GraphPropertyEnum.COMPONENT_TYPE, ComponentTypeEnum.SERVICE.name());
hasProps.put(GraphPropertyEnum.IS_HIGHEST_VERSION, true);
+ if (modelName != null) {
+ hasProps.put(GraphPropertyEnum.MODEL, modelName);
+ }
// exclude props
states.add(LifecycleStateEnum.NOT_CERTIFIED_CHECKOUT);
hasNotProps.put(GraphPropertyEnum.STATE, states);
@@ -1912,7 +1945,7 @@ public class ToscaOperationFacade {
List<Service> services = null;
Map<GraphPropertyEnum, Object> hasProps = new EnumMap<>(GraphPropertyEnum.class);
Map<GraphPropertyEnum, Object> hasNotProps = new EnumMap<>(GraphPropertyEnum.class);
- fillPropsMap(hasProps, hasNotProps, internalComponentType, componentTypeEnum, isAbstract, vertexType);
+ fillPropsMap(hasProps, hasNotProps, internalComponentType, componentTypeEnum, isAbstract, vertexType, modelName);
Either<List<GraphVertex>, JanusGraphOperationStatus> getRes = janusGraphDao
.getByCriteria(vertexType, hasProps, hasNotProps, JsonParseFlagEnum.ParseMetadata);
if (getRes.isRight() && !JanusGraphOperationStatus.NOT_FOUND.equals(getRes.right().value())) {
@@ -2155,11 +2188,14 @@ public class ToscaOperationFacade {
}
private void fillPropsMap(Map<GraphPropertyEnum, Object> hasProps, Map<GraphPropertyEnum, Object> hasNotProps, String internalComponentType,
- ComponentTypeEnum componentTypeEnum, boolean isAbstract, VertexTypeEnum internalVertexType) {
+ ComponentTypeEnum componentTypeEnum, boolean isAbstract, VertexTypeEnum internalVertexType, String modelName) {
hasNotProps.put(GraphPropertyEnum.STATE, LifecycleStateEnum.NOT_CERTIFIED_CHECKOUT.name());
hasNotProps.put(GraphPropertyEnum.IS_DELETED, true);
hasNotProps.put(GraphPropertyEnum.IS_ARCHIVED, true);
hasProps.put(GraphPropertyEnum.IS_HIGHEST_VERSION, true);
+ if (modelName != null) {
+ hasProps.put(GraphPropertyEnum.MODEL, modelName);
+ }
if (VertexTypeEnum.NODE_TYPE == internalVertexType) {
hasProps.put(GraphPropertyEnum.IS_ABSTRACT, isAbstract);
if (internalComponentType != null) {