diff options
Diffstat (limited to 'catalog-be/src/main')
9 files changed, 139 insertions, 3 deletions
diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/InterfaceDefinitionHandler.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/InterfaceDefinitionHandler.java index 9f0adcf217..c8d7862306 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/InterfaceDefinitionHandler.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/InterfaceDefinitionHandler.java @@ -31,6 +31,7 @@ import static org.openecomp.sdc.be.utils.TypeUtils.ToscaTagNamesEnum.OPERATIONS; import static org.openecomp.sdc.be.utils.TypeUtils.ToscaTagNamesEnum.REQUIRED; import static org.openecomp.sdc.be.utils.TypeUtils.ToscaTagNamesEnum.STATUS; import static org.openecomp.sdc.be.utils.TypeUtils.ToscaTagNamesEnum.TYPE; +import static org.openecomp.sdc.be.utils.TypeUtils.ToscaTagNamesEnum.VALUE; import static org.openecomp.sdc.be.utils.TypeUtils.ToscaTagNamesEnum.WORKFLOW; import com.google.gson.Gson; @@ -211,10 +212,13 @@ public class InterfaceDefinitionHandler { for (Object activityValue : milestoneActivities) { ActivityDataDefinition activity = new ActivityDataDefinition(); if (activityValue instanceof Map) { - Map<String, String> activityMap = (Map<String, String>) activityValue; + Map<String, Object> activityMap = (Map<String, Object>) activityValue; + if (activityMap.containsKey(INPUTS.getElementName())) { + activity.setInputs(handleInterfaceOperationInputs((Map<String, Object>) activityMap.get(INPUTS.getElementName()))); + } if (activityMap.containsKey(TYPE.getElementName()) && activityMap.containsKey(WORKFLOW.getElementName())) { - activity.setType(activityMap.get(TYPE.getElementName())); - activity.setWorkflow(activityMap.get(WORKFLOW.getElementName())); + activity.setType((String) activityMap.get(TYPE.getElementName())); + activity.setWorkflow((String) activityMap.get(WORKFLOW.getElementName())); activities.add(activity); } else { return new ListDataDefinition<>(); @@ -268,6 +272,11 @@ public class InterfaceDefinitionHandler { LOGGER.debug(WITH_ATTRIBUTE, DEFAULT.getElementName(), json); operationInput.setToscaDefaultValue(json); } + if (inputPropertyValue.get(VALUE.getElementName()) != null) { + final Gson gson = new Gson(); + final String json = gson.toJson(inputPropertyValue.get(VALUE.getElementName())); + operationInput.setValue(json); + } if (inputPropertyValue.get(STATUS.getElementName()) != null) { final String status = inputPropertyValue.get(STATUS.getElementName()).toString(); LOGGER.debug(WITH_ATTRIBUTE, STATUS.getElementName(), status); diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/tosca/InterfacesOperationsConverter.java b/catalog-be/src/main/java/org/openecomp/sdc/be/tosca/InterfacesOperationsConverter.java index e95f16eaac..52fdfcc4e5 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/tosca/InterfacesOperationsConverter.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/tosca/InterfacesOperationsConverter.java @@ -36,6 +36,7 @@ import java.util.Set; import java.util.stream.Collectors; import org.apache.commons.collections.MapUtils; import org.apache.commons.collections4.CollectionUtils; +import org.apache.commons.lang3.ObjectUtils; import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.math.NumberUtils; import org.openecomp.sdc.be.datatypes.elements.ActivityDataDefinition; @@ -332,6 +333,10 @@ public class InterfacesOperationsConverter { Map<String, ToscaActivity> toscaActivityMap = new HashMap<>(); ToscaActivity toscaActivity = new ToscaActivity(); toscaActivity.setWorkflow(activity.getWorkflow()); + Map<String, Object> inputs = getToscaActivityInputs(activity.getInputs(), dataTypes); + if (!inputs.isEmpty()) { + toscaActivity.setInputs(inputs); + } toscaActivityMap.put(activity.getType(), toscaActivity); toscaActivities.add(toscaActivityMap); } @@ -342,6 +347,21 @@ public class InterfacesOperationsConverter { toscaOperation.setMilestones(toscaMilestones); } + private Map<String, Object> getToscaActivityInputs(ListDataDefinition<OperationInputDefinition> inputs, + Map<String, DataTypeDefinition> dataTypes) { + if (Objects.isNull(inputs) || inputs.isEmpty()) { + return null; + } + Map<String, Object> toscaInputs = new HashMap<>(); + for (OperationInputDefinition input : inputs.getListToscaDataDefinition()) { + Object value = propertyConvertor.convertToToscaObject(input, getInputValue(input), dataTypes, false); + if (ObjectUtils.isNotEmpty(value)) { + toscaInputs.put(input.getName(), value); + } + } + return toscaInputs; + } + private boolean operationHasAnImplementation(OperationDataDefinition operation) { return operation.getImplementation() != null && StringUtils.isNotEmpty(operation.getImplementation().getArtifactName()) && !operation.getImplementation().getArtifactName().equals("''"); diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/tosca/model/ToscaActivity.java b/catalog-be/src/main/java/org/openecomp/sdc/be/tosca/model/ToscaActivity.java index 736988e85e..3f33bc7ab3 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/tosca/model/ToscaActivity.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/tosca/model/ToscaActivity.java @@ -21,10 +21,12 @@ package org.openecomp.sdc.be.tosca.model; +import java.util.Map; import lombok.Data; @Data public class ToscaActivity { String workflow; + private Map<String, Object> inputs; } diff --git a/catalog-be/src/main/resources/import/tosca/data-types/dataTypes.yml b/catalog-be/src/main/resources/import/tosca/data-types/dataTypes.yml index 1b2c0402c1..24bed4d567 100644 --- a/catalog-be/src/main/resources/import/tosca/data-types/dataTypes.yml +++ b/catalog-be/src/main/resources/import/tosca/data-types/dataTypes.yml @@ -3478,3 +3478,21 @@ tosca.datatypes.asd.requiredPlugin: description: "the version of the required K8s plugin" type: string required: true + +tosca.dataTypes.tmf.milestoneJeopardyData: + derived_from: tosca.datatypes.Root + properties: + name: + type: string + required: true + message: + type: string + required: true + eventType: + type: string + required: true + valid_values: [milestone, jeopardy] + jeopardyType: + type: string + required: false + valid_values: [normal, critical, hazard] diff --git a/catalog-be/src/main/resources/import/tosca/models/init/acm/imports/acm.yaml b/catalog-be/src/main/resources/import/tosca/models/init/acm/imports/acm.yaml index c88d7235e9..9ef248232d 100644 --- a/catalog-be/src/main/resources/import/tosca/models/init/acm/imports/acm.yaml +++ b/catalog-be/src/main/resources/import/tosca/models/init/acm/imports/acm.yaml @@ -584,3 +584,20 @@ node_types: typeVersion: 1.0.0 description: The connfiguration entities the Automation Composition Element is managing and their associated REST requests + tosca.dataTypes.tmf.milestoneJeopardyData: + derived_from: tosca.datatypes.Root + properties: + name: + type: string + required: true + message: + type: string + required: true + eventType: + type: string + required: true + valid_values: [milestone, jeopardy] + jeopardyType: + type: string + required: false + valid_values: [normal, critical, hazard] diff --git a/catalog-be/src/main/resources/import/tosca/models/init/acm/tosca/data-types/dataTypes.yml b/catalog-be/src/main/resources/import/tosca/models/init/acm/tosca/data-types/dataTypes.yml index 48e514288a..7cc808bdb3 100644 --- a/catalog-be/src/main/resources/import/tosca/models/init/acm/tosca/data-types/dataTypes.yml +++ b/catalog-be/src/main/resources/import/tosca/models/init/acm/tosca/data-types/dataTypes.yml @@ -374,3 +374,21 @@ org.onap.datatypes.policy.clamp.acm.httpAutomationCompositionElement.Configurati type: org.onap.datatypes.policy.clamp.acm.httpAutomationCompositionElement.RestRequest typeVersion: 1.0.0 description: A sequence of REST commands to send to the REST endpoint + +tosca.dataTypes.tmf.milestoneJeopardyData: + derived_from: tosca.datatypes.Root + properties: + name: + type: string + required: true + message: + type: string + required: true + eventType: + type: string + required: true + valid_values: [milestone, jeopardy] + jeopardyType: + type: string + required: false + valid_values: [normal, critical, hazard] diff --git a/catalog-be/src/main/resources/import/tosca/models/init/etsi-SOL001-v2.5.1/imports/etsi_nfv_sol001_nsd_types.yaml b/catalog-be/src/main/resources/import/tosca/models/init/etsi-SOL001-v2.5.1/imports/etsi_nfv_sol001_nsd_types.yaml index 6462c3d66c..0b1a6217ee 100644 --- a/catalog-be/src/main/resources/import/tosca/models/init/etsi-SOL001-v2.5.1/imports/etsi_nfv_sol001_nsd_types.yaml +++ b/catalog-be/src/main/resources/import/tosca/models/init/etsi-SOL001-v2.5.1/imports/etsi_nfv_sol001_nsd_types.yaml @@ -525,3 +525,20 @@ policy_types: - less_or_equal: 65535 default: 65535 targets: [ tosca.nodes.nfv.Sap ] + tosca.dataTypes.tmf.milestoneJeopardyData: + derived_from: tosca.datatypes.Root + properties: + name: + type: string + required: true + message: + type: string + required: true + eventType: + type: string + required: true + valid_values: [milestone, jeopardy] + jeopardyType: + type: string + required: false + valid_values: [normal, critical, hazard] diff --git a/catalog-be/src/main/resources/import/tosca/models/init/etsi-SOL001-v2.5.1/imports/etsi_nfv_sol001_vnfd_types.yaml b/catalog-be/src/main/resources/import/tosca/models/init/etsi-SOL001-v2.5.1/imports/etsi_nfv_sol001_vnfd_types.yaml index 48f8e6478c..51b691f223 100644 --- a/catalog-be/src/main/resources/import/tosca/models/init/etsi-SOL001-v2.5.1/imports/etsi_nfv_sol001_vnfd_types.yaml +++ b/catalog-be/src/main/resources/import/tosca/models/init/etsi-SOL001-v2.5.1/imports/etsi_nfv_sol001_vnfd_types.yaml @@ -1607,3 +1607,20 @@ policy_types: description: Provide additional data to access the interface endpoint required: false targets: [ tosca.nodes.nfv.VnfExtCp, tosca.nodes.nfv.VduCp ] + tosca.dataTypes.tmf.milestoneJeopardyData: + derived_from: tosca.datatypes.Root + properties: + name: + type: string + required: true + message: + type: string + required: true + eventType: + type: string + required: true + valid_values: [milestone, jeopardy] + jeopardyType: + type: string + required: false + valid_values: [normal, critical, hazard] diff --git a/catalog-be/src/main/resources/import/tosca/models/init/etsi-SOL001-v2.5.1/tosca/data-types/dataTypes.yml b/catalog-be/src/main/resources/import/tosca/models/init/etsi-SOL001-v2.5.1/tosca/data-types/dataTypes.yml index 8d8b779d25..12bc82a33f 100644 --- a/catalog-be/src/main/resources/import/tosca/models/init/etsi-SOL001-v2.5.1/tosca/data-types/dataTypes.yml +++ b/catalog-be/src/main/resources/import/tosca/models/init/etsi-SOL001-v2.5.1/tosca/data-types/dataTypes.yml @@ -971,3 +971,21 @@ tosca.datatypes.nfv.VnfLcmOperationsConfiguration: type: tosca.datatypes.nfv.VnfChangeExtConnectivityOperationConfiguration description: Configuration parameters for the changeExtVnfConnectivityOpConfig operation required: false + +tosca.dataTypes.tmf.milestoneJeopardyData: + derived_from: tosca.datatypes.Root + properties: + name: + type: string + required: true + message: + type: string + required: true + eventType: + type: string + required: true + valid_values: [milestone, jeopardy] + jeopardyType: + type: string + required: false + valid_values: [normal, critical, hazard] |