summaryrefslogtreecommitdiffstats
path: root/openecomp-be/lib/openecomp-tosca-converter-lib
diff options
context:
space:
mode:
authorDmitry Puzikov <dmitry.puzikov@tieto.com>2020-01-14 15:01:20 +0100
committerOfir Sonsino <ofir.sonsino@intl.att.com>2020-01-29 14:56:33 +0000
commit22b57cf9313f0b21a1dca090088b811eec8cca6a (patch)
treec13bf50660892cd4a35037e434d27ea1b99e4fe2 /openecomp-be/lib/openecomp-tosca-converter-lib
parentabc10d923a2520e7233f3681a8c5811516908891 (diff)
Implement policy element convertion during onboarding VSP
Implement absent policy convertion. Add test data for policies section convertion and explicit test for checking if policies been converted. Change-Id: I7d431a22922e1f9da0fbf0de4654995c3da42fcb Issue-ID: SDC-2727 Signed-off-by: Dmitry Puzikov <d.puzikov2@partner.samsung.com>
Diffstat (limited to 'openecomp-be/lib/openecomp-tosca-converter-lib')
-rw-r--r--openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-api/src/main/java/org/openecomp/core/converter/ServiceTemplateReaderService.java22
-rw-r--r--openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-api/src/main/java/org/openecomp/core/converter/datatypes/Constants.java73
-rw-r--r--openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/main/java/org/openecomp/core/impl/VnfTopologyTemplateConverter.java95
-rw-r--r--openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/main/java/org/openecomp/core/impl/services/ServiceTemplateReaderServiceImpl.java138
-rw-r--r--openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/test/java/org/openecomp/core/impl/ToscaConverterImplTest.java18
-rw-r--r--openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/test/resources/mock/toscaConverter/convertMainSt/in/MainServiceTemplate.yaml11
-rw-r--r--openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/test/resources/mock/toscaConverter/convertMainSt/out/MainServiceTemplate.yaml11
-rw-r--r--openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/test/resources/mock/toscaConverter/convertPolicies/in/Artifacts/checksum.lst1
-rw-r--r--openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/test/resources/mock/toscaConverter/convertPolicies/in/Artifacts/csar.meta3
-rw-r--r--openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/test/resources/mock/toscaConverter/convertPolicies/in/Definitions/GlobalSubstitutionTypesServiceTemplate.yaml60
-rw-r--r--openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/test/resources/mock/toscaConverter/convertPolicies/in/MainServiceTemplate.mf12
-rw-r--r--openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/test/resources/mock/toscaConverter/convertPolicies/in/MainServiceTemplate.yaml572
-rw-r--r--openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/test/resources/mock/toscaConverter/convertPolicies/in/TOSCA-Metadata/TOSCA.meta135
13 files changed, 997 insertions, 154 deletions
diff --git a/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-api/src/main/java/org/openecomp/core/converter/ServiceTemplateReaderService.java b/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-api/src/main/java/org/openecomp/core/converter/ServiceTemplateReaderService.java
index 3b861e425d..8a97957be9 100644
--- a/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-api/src/main/java/org/openecomp/core/converter/ServiceTemplateReaderService.java
+++ b/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-api/src/main/java/org/openecomp/core/converter/ServiceTemplateReaderService.java
@@ -26,23 +26,25 @@ import java.util.Map;
public interface ServiceTemplateReaderService {
- Map<String, Object> readServiceTemplate(byte[] serivceTemplateContent);
+ Map<String, Object> readServiceTemplate(byte[] serivceTemplateContent);
- Object getMetadata();
+ Object getMetadata();
- Object getToscaVersion();
+ Object getToscaVersion();
- Map<String, Object> getNodeTypes();
+ Map<String, Object> getNodeTypes();
- Object getTopologyTemplate();
+ Object getTopologyTemplate();
- Map<String, Object> getNodeTemplates();
+ Map<String, Object> getNodeTemplates();
- Map<String, Object> getInputs();
+ Map<String, Object> getInputs();
- Map<String, Object> getOutputs();
+ Map<String, Object> getOutputs();
- Map<String, Object> getSubstitutionMappings();
+ Map<String, Object> getSubstitutionMappings();
- List<Object> getImports();
+ List<Object> getImports();
+
+ Map<String, Object> getPolicies();
}
diff --git a/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-api/src/main/java/org/openecomp/core/converter/datatypes/Constants.java b/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-api/src/main/java/org/openecomp/core/converter/datatypes/Constants.java
index 90ce3f6f6b..18e6a49aa5 100644
--- a/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-api/src/main/java/org/openecomp/core/converter/datatypes/Constants.java
+++ b/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-api/src/main/java/org/openecomp/core/converter/datatypes/Constants.java
@@ -19,44 +19,45 @@ package org.openecomp.core.converter.datatypes;
import java.io.File;
public class Constants {
- public static final String mainStName = "MainServiceTemplate.yaml";
- public static final String globalStName = "GlobalSubstitutionTypesServiceTemplate.yaml";
- public static final String manifestFileName = "MainServiceTemplate.mf";
- public static final String definitionsDir = "Definitions/";
- public static final String metadataFile = "TOSCA-Metadata/TOSCA.meta";
+ public static final String mainStName = "MainServiceTemplate.yaml";
+ public static final String globalStName = "GlobalSubstitutionTypesServiceTemplate.yaml";
+ public static final String manifestFileName = "MainServiceTemplate.mf";
+ public static final String definitionsDir = "Definitions/";
+ public static final String metadataFile = "TOSCA-Metadata/TOSCA.meta";
- public static final String definitionVersion = "tosca_definitions_version";
- private static final String DEFAULT_NAMESPACE = "tosca_default_namespace";
- private static final String TEMPLATE_NAME = "template_name";
- public static final String topologyTemplate = "topology_template";
- private static final String TEMPLATE_AUTHOR = "template_author";
- private static final String TEMPLATE_VERSION = "template_version";
- private static final String DESCRIPTION = "description";
- private static final String IMPORTS = "imports";
- private static final String DSL_DEFINITIONS = "dsl_definitions";
- public static final String nodeType = "node_type";
- public static final String nodeTypes = "node_types";
- private static final String RELATIONSHIP_TYPES = "relationship_types";
- private static final String RELATIONSHIP_TEMPLATES = "relationship_templates";
- private static final String CAPABILITY_TYPES = "capability_types";
- private static final String ARTIFACT_TYPES = "artifact_types";
- private static final String DATA_TYPES = "data_types";
- private static final String INTERFACE_TYPES = "interface_types";
- private static final String POLICY_TYPES = "policy_types";
- private static final String GROUP_TYPES = "group_types";
- private static final String REPOSITORIES = "repositories";
- public static final String metadata = "metadata";
- public static final String nodeTemplates = "node_templates";
- public static final String inputs = "inputs";
- public static final String outputs = "outputs";
- public static final String substitutionMappings = "substitution_mappings";
- public static final String capabilities = "capabilities";
- public static final String requirements = "requirements";
+ public static final String definitionVersion = "tosca_definitions_version";
+ private static final String DEFAULT_NAMESPACE = "tosca_default_namespace";
+ private static final String TEMPLATE_NAME = "template_name";
+ public static final String topologyTemplate = "topology_template";
+ private static final String TEMPLATE_AUTHOR = "template_author";
+ private static final String TEMPLATE_VERSION = "template_version";
+ private static final String DESCRIPTION = "description";
+ private static final String IMPORTS = "imports";
+ private static final String DSL_DEFINITIONS = "dsl_definitions";
+ public static final String nodeType = "node_type";
+ public static final String nodeTypes = "node_types";
+ private static final String RELATIONSHIP_TYPES = "relationship_types";
+ private static final String RELATIONSHIP_TEMPLATES = "relationship_templates";
+ private static final String CAPABILITY_TYPES = "capability_types";
+ private static final String ARTIFACT_TYPES = "artifact_types";
+ private static final String DATA_TYPES = "data_types";
+ private static final String INTERFACE_TYPES = "interface_types";
+ private static final String POLICY_TYPES = "policy_types";
+ private static final String GROUP_TYPES = "group_types";
+ private static final String REPOSITORIES = "repositories";
+ public static final String metadata = "metadata";
+ public static final String nodeTemplates = "node_templates";
+ public static final String inputs = "inputs";
+ public static final String outputs = "outputs";
+ public static final String substitutionMappings = "substitution_mappings";
+ public static final String capabilities = "capabilities";
+ public static final String requirements = "requirements";
+ public static final String POLICIES = "policies";
- public static final String openecompHeatIndex = "openecomp_heat_index";
- public static final String ONAP_INDEX = "onap_index";
- public static final String globalSubstitution = "GlobalSubstitutionTypes";
+ public static final String openecompHeatIndex = "openecomp_heat_index";
+ public static final String ONAP_INDEX = "onap_index";
+ public static final String globalSubstitution = "GlobalSubstitutionTypes";
- public static final String externalFilesFolder = "External" + File.separator;
+ public static final String externalFilesFolder = "External" + File.separator;
}
diff --git a/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/main/java/org/openecomp/core/impl/VnfTopologyTemplateConverter.java b/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/main/java/org/openecomp/core/impl/VnfTopologyTemplateConverter.java
index e6978bcfe1..b676fb2fad 100644
--- a/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/main/java/org/openecomp/core/impl/VnfTopologyTemplateConverter.java
+++ b/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/main/java/org/openecomp/core/impl/VnfTopologyTemplateConverter.java
@@ -28,9 +28,11 @@ import org.onap.sdc.tosca.datatypes.model.CapabilityAssignment;
import org.onap.sdc.tosca.datatypes.model.NodeFilter;
import org.onap.sdc.tosca.datatypes.model.NodeTemplate;
import org.onap.sdc.tosca.datatypes.model.ParameterDefinition;
+import org.onap.sdc.tosca.datatypes.model.PolicyDefinition;
import org.onap.sdc.tosca.datatypes.model.RequirementAssignment;
import org.onap.sdc.tosca.datatypes.model.ServiceTemplate;
import org.onap.sdc.tosca.datatypes.model.SubstitutionMapping;
+import org.onap.sdc.tosca.datatypes.model.Trigger;
import org.openecomp.core.converter.ServiceTemplateReaderService;
import org.openecomp.core.converter.datatypes.Constants;
import org.openecomp.core.converter.errors.SubstitutionMappingsConverterErrorBuilder;
@@ -51,64 +53,54 @@ import static org.openecomp.core.converter.datatypes.Constants.requirements;
public class VnfTopologyTemplateConverter {
- public void convertTopologyTemplate(ServiceTemplate serviceTemplate,
- ServiceTemplateReaderService readerService) {
-
+ public void convertTopologyTemplate(ServiceTemplate serviceTemplate, ServiceTemplateReaderService readerService) {
convertInputs(serviceTemplate, readerService);
convertNodeTemplates(serviceTemplate, readerService);
convertOutputs(serviceTemplate, readerService);
convertSubstitutionMappings(serviceTemplate, readerService);
+ convertPolicies(serviceTemplate, readerService);
}
- private void convertInputs(ServiceTemplate serviceTemplate,
- ServiceTemplateReaderService readerService) {
+ private void convertInputs(ServiceTemplate serviceTemplate, ServiceTemplateReaderService readerService) {
Map<String, Object> inputs = readerService.getInputs();
addInputsOrOutputsToServiceTemplate(serviceTemplate, inputs, Constants.inputs);
}
- private void convertOutputs(ServiceTemplate serviceTemplate,
- ServiceTemplateReaderService readerService) {
+ private void convertOutputs(ServiceTemplate serviceTemplate, ServiceTemplateReaderService readerService) {
Map<String, Object> outputs = readerService.getOutputs();
addInputsOrOutputsToServiceTemplate(serviceTemplate, outputs, Constants.outputs);
}
- private void addInputsOrOutputsToServiceTemplate(ServiceTemplate serviceTemplate,
- Map<String, Object> mapToConvert,
- String inputsOrOutputs) {
+ private void addInputsOrOutputsToServiceTemplate(ServiceTemplate serviceTemplate, Map<String, Object> mapToConvert,
+ String inputsOrOutputs) {
if (MapUtils.isEmpty(mapToConvert)) {
return;
}
for (Map.Entry<String, Object> entry : mapToConvert.entrySet()) {
- Optional<ParameterDefinition> parameterDefinition =
- ToscaConverterUtil.createObjectFromClass(
- entry.getKey(), entry.getValue(), ParameterDefinition.class);
+ Optional<ParameterDefinition> parameterDefinition = ToscaConverterUtil.createObjectFromClass(entry.getKey(),
+ entry.getValue(), ParameterDefinition.class);
parameterDefinition.ifPresent(parameterDefinitionValue -> {
Optional<Object> defaultValue =
ToscaConverterUtil.getDefaultValue(entry.getValue(), parameterDefinition.get());
defaultValue.ifPresent(parameterDefinitionValue::set_default);
- addToServiceTemplateAccordingToSection(
- serviceTemplate, inputsOrOutputs, entry.getKey(), parameterDefinition.get());
+ addToServiceTemplateAccordingToSection(serviceTemplate, inputsOrOutputs, entry.getKey(),
+ parameterDefinition.get());
});
}
}
- private void addToServiceTemplateAccordingToSection(ServiceTemplate serviceTemplate,
- String inputsOrOutputs,
- String parameterId,
- ParameterDefinition parameterDefinition) {
+ private void addToServiceTemplateAccordingToSection(ServiceTemplate serviceTemplate, String inputsOrOutputs,
+ String parameterId, ParameterDefinition parameterDefinition) {
if (inputsOrOutputs.equals(inputs)) {
- DataModelUtil
- .addInputParameterToTopologyTemplate(serviceTemplate, parameterId, parameterDefinition);
+ DataModelUtil.addInputParameterToTopologyTemplate(serviceTemplate, parameterId, parameterDefinition);
} else if (inputsOrOutputs.equals(outputs)) {
- DataModelUtil
- .addOutputParameterToTopologyTemplate(serviceTemplate, parameterId, parameterDefinition);
+ DataModelUtil.addOutputParameterToTopologyTemplate(serviceTemplate, parameterId, parameterDefinition);
}
}
- private void convertNodeTemplates(ServiceTemplate serviceTemplate,
- ServiceTemplateReaderService readerService) {
+ private void convertNodeTemplates(ServiceTemplate serviceTemplate, ServiceTemplateReaderService readerService) {
Map<String, Object> nodeTemplates = readerService.getNodeTemplates();
if (MapUtils.isEmpty(nodeTemplates)) {
return;
@@ -129,15 +121,12 @@ public class VnfTopologyTemplateConverter {
nodeTemplate.setCopy((String) nodeTemplateAsMap.get("copy"));
nodeTemplate.setDescription((String) nodeTemplateAsMap.get("description"));
nodeTemplate.setDirectives((List<String>) nodeTemplateAsMap.get("directives"));
- nodeTemplate.setInterfaces(
- (Map<String, Object>) nodeTemplateAsMap.get("interfaces"));
+ nodeTemplate.setInterfaces((Map<String, Object>) nodeTemplateAsMap.get("interfaces"));
nodeTemplate.setNode_filter((NodeFilter) nodeTemplateAsMap.get("node_filter"));
nodeTemplate.setProperties((Map<String, Object>) nodeTemplateAsMap.get("properties"));
- nodeTemplate.setRequirements(
- (List<Map<String, RequirementAssignment>>) nodeTemplateAsMap.get("requirements"));
+ nodeTemplate.setRequirements((List<Map<String, RequirementAssignment>>) nodeTemplateAsMap.get("requirements"));
nodeTemplate.setType((String) nodeTemplateAsMap.get("type"));
- nodeTemplate.setCapabilities(
- convertCapabilities((Map<String, Object>) nodeTemplateAsMap.get("capabilities")));
+ nodeTemplate.setCapabilities(convertCapabilities((Map<String, Object>) nodeTemplateAsMap.get("capabilities")));
return nodeTemplate;
}
@@ -149,19 +138,20 @@ public class VnfTopologyTemplateConverter {
Map<String, CapabilityAssignment> convertedCapabilities = new HashMap<>();
for (Map.Entry<String, Object> capabilityAssignmentEntry : capabilities.entrySet()) {
- Optional<CapabilityAssignment> capabilityAssignment = ToscaConverterUtil.createObjectFromClass
- (capabilityAssignmentEntry.getKey(), capabilityAssignmentEntry.getValue(),
- CapabilityAssignment.class);
+ Optional<CapabilityAssignment> capabilityAssignment = ToscaConverterUtil.createObjectFromClass(
+ capabilityAssignmentEntry.getKey(), capabilityAssignmentEntry.getValue(),
+ CapabilityAssignment.class);
- capabilityAssignment.ifPresent(capabilityAssignmentValue ->
- convertedCapabilities.put(capabilityAssignmentEntry.getKey(), capabilityAssignmentValue));
+ capabilityAssignment.ifPresent(capabilityAssignmentValue -> convertedCapabilities
+ .put(capabilityAssignmentEntry.getKey(),
+ capabilityAssignmentValue));
}
return convertedCapabilities;
}
private void convertSubstitutionMappings(ServiceTemplate serviceTemplate,
- ServiceTemplateReaderService readerService) {
+ ServiceTemplateReaderService readerService) {
Map<String, Object> substitutionMappings = readerService.getSubstitutionMappings();
if (MapUtils.isEmpty(substitutionMappings)) {
return;
@@ -170,8 +160,7 @@ public class VnfTopologyTemplateConverter {
DataModelUtil.addSubstitutionMapping(serviceTemplate, substitutionMapping);
}
- private SubstitutionMapping convertSubstitutionMappings(
- Map<String, Object> substitutionMappings) {
+ private SubstitutionMapping convertSubstitutionMappings(Map<String, Object> substitutionMappings) {
SubstitutionMapping substitutionMapping = new SubstitutionMapping();
substitutionMapping.setNode_type((String) substitutionMappings.get(nodeType));
@@ -183,17 +172,15 @@ public class VnfTopologyTemplateConverter {
return substitutionMapping;
}
- private Map<String, List<String>> convertSubstitutionMappingsSections(String sectionName,
- Object sectionToConvert) {
+ private Map<String, List<String>> convertSubstitutionMappingsSections(String sectionName, Object sectionToConvert) {
if (Objects.isNull(sectionToConvert)) {
return null;
}
if (!(sectionToConvert instanceof Map)) {
- throw new CoreException(
- new SubstitutionMappingsConverterErrorBuilder(
- sectionName, sectionToConvert.getClass().getSimpleName()).build());
+ throw new CoreException(new SubstitutionMappingsConverterErrorBuilder(sectionName,
+ sectionToConvert.getClass().getSimpleName()).build());
}
return convertSection(sectionToConvert);
@@ -217,4 +204,24 @@ public class VnfTopologyTemplateConverter {
return convertedSection;
}
+ private void convertPolicies(ServiceTemplate serviceTemplate, ServiceTemplateReaderService readerService) {
+ Map<String, Object> policiesAsMap = readerService.getPolicies();
+ for (Map.Entry<String, Object> policy : policiesAsMap.entrySet()) {
+ PolicyDefinition policyDefinition = convertPolicy(policy.getValue());
+ DataModelUtil.addPolicyDefinition(serviceTemplate, policy.getKey(), policyDefinition);
+ }
+ }
+
+ private PolicyDefinition convertPolicy(Object policyCandidate) {
+ PolicyDefinition policyDefinition = new PolicyDefinition();
+ Map<String, Object> policy = (Map<String, Object>) policyCandidate;
+ policyDefinition.setDescription((String) policy.get("description"));
+ policyDefinition.setType((String) policy.get("type"));
+ policyDefinition.setMetadata((Map<String, String>) policy.get("metadata"));
+ policyDefinition.setProperties((Map<String, Object>) policy.get("properties"));
+ policyDefinition.setTargets((List<String>) policy.get("targets"));
+ policyDefinition.setTriggers((Map<String, Trigger>) policy.get("triggers"));
+
+ return policyDefinition;
+ }
}
diff --git a/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/main/java/org/openecomp/core/impl/services/ServiceTemplateReaderServiceImpl.java b/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/main/java/org/openecomp/core/impl/services/ServiceTemplateReaderServiceImpl.java
index 44b0c80e24..f41caff349 100644
--- a/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/main/java/org/openecomp/core/impl/services/ServiceTemplateReaderServiceImpl.java
+++ b/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/main/java/org/openecomp/core/impl/services/ServiceTemplateReaderServiceImpl.java
@@ -33,68 +33,78 @@ import static org.openecomp.core.converter.datatypes.Constants.*;
public class ServiceTemplateReaderServiceImpl implements ServiceTemplateReaderService {
- private Map<String, Object> readServiceTemplate = new HashMap<>();
-
- public ServiceTemplateReaderServiceImpl(byte[] serviceTemplateContent){
- this.readServiceTemplate = readServiceTemplate(serviceTemplateContent);
- }
-
- @Override
- public Map<String, Object> readServiceTemplate(byte[] serviceTemplateContent) {
-
- return
- new YamlUtil().yamlToObject(new String(serviceTemplateContent), Map.class);
-
- }
-
- @Override
- public List<Object> getImports(){
- return Objects.isNull(this.readServiceTemplate.get("imports")) ?
- new ArrayList<>() : (List<Object>) this.readServiceTemplate.get("imports");
- }
-
- @Override
- public Object getMetadata(){
- return this.readServiceTemplate.get(metadata);
- }
-
- @Override
- public Object getToscaVersion(){
- return this.readServiceTemplate.get(definitionVersion);
- }
-
- @Override
- public Map<String, Object> getNodeTypes(){
- return Objects.isNull(this.readServiceTemplate.get(nodeTypes)) ? new HashMap<>()
- :(Map<String, Object>) this.readServiceTemplate.get(nodeTypes);
- }
-
- @Override
- public Object getTopologyTemplate(){
- return this.readServiceTemplate.get(topologyTemplate);
- }
-
- @Override
- public Map<String, Object> getNodeTemplates(){
- return Objects.isNull(this.getTopologyTemplate()) ? new HashMap<>()
- : (Map<String, Object>) ((Map<String, Object>)this.getTopologyTemplate()).get(nodeTemplates);
- }
-
- @Override
- public Map<String, Object> getInputs(){
- return Objects.isNull(this.getTopologyTemplate()) ? new HashMap<>()
- : (Map<String, Object>) ((Map<String, Object>)this.getTopologyTemplate()).get(inputs);
- }
-
- @Override
- public Map<String, Object> getOutputs(){
- return Objects.isNull(this.getTopologyTemplate()) ? new HashMap<>()
- : (Map<String, Object>) ((Map<String, Object>)this.getTopologyTemplate()).get(outputs);
- }
-
- @Override
- public Map<String, Object> getSubstitutionMappings(){
- return Objects.isNull(this.getTopologyTemplate()) ? new HashMap<>()
- : (Map<String, Object>) ((Map<String, Object>)this.getTopologyTemplate()).get(substitutionMappings);
- }
+ private Map<String, Object> readServiceTemplate = new HashMap<>();
+
+ public ServiceTemplateReaderServiceImpl(byte[] serviceTemplateContent) {
+ this.readServiceTemplate = readServiceTemplate(serviceTemplateContent);
+ }
+
+ @Override
+ public Map<String, Object> readServiceTemplate(byte[] serviceTemplateContent) {
+
+ return new YamlUtil().yamlToObject(new String(serviceTemplateContent), Map.class);
+
+ }
+
+ @Override
+ public List<Object> getImports() {
+ return Objects.isNull(this.readServiceTemplate.get("imports")) ? new ArrayList<>()
+ : (List<Object>) this.readServiceTemplate.get("imports");
+ }
+
+ @Override
+ public Map<String, Object> getPolicies() {
+ Map<String, Object> policiesAsMap = new HashMap<>();
+ if (!Objects.isNull(this.getTopologyTemplate()) && !Objects.isNull(
+ ((Map<String, Object>) this.getTopologyTemplate()).get(POLICIES))) {
+ policiesAsMap = (Map<String, Object>) ((Map<String, Object>) this.getTopologyTemplate()).get(POLICIES);
+ }
+ return policiesAsMap;
+ }
+
+ @Override
+ public Object getMetadata() {
+ return this.readServiceTemplate.get(metadata);
+ }
+
+ @Override
+ public Object getToscaVersion() {
+ return this.readServiceTemplate.get(definitionVersion);
+ }
+
+ @Override
+ public Map<String, Object> getNodeTypes() {
+ return Objects.isNull(this.readServiceTemplate.get(nodeTypes)) ? new HashMap<>()
+ : (Map<String, Object>) this.readServiceTemplate.get(nodeTypes);
+ }
+
+ @Override
+ public Object getTopologyTemplate() {
+ return this.readServiceTemplate.get(topologyTemplate);
+ }
+
+ @Override
+ public Map<String, Object> getNodeTemplates() {
+ return Objects.isNull(this.getTopologyTemplate()) ? new HashMap<>()
+ : (Map<String, Object>) ((Map<String, Object>) this.getTopologyTemplate()).get(nodeTemplates);
+ }
+
+ @Override
+ public Map<String, Object> getInputs() {
+ return Objects.isNull(this.getTopologyTemplate()) ? new HashMap<>()
+ : (Map<String, Object>) ((Map<String, Object>) this.getTopologyTemplate()).get(inputs);
+ }
+
+ @Override
+ public Map<String, Object> getOutputs() {
+ return Objects.isNull(this.getTopologyTemplate()) ? new HashMap<>()
+ : (Map<String, Object>) ((Map<String, Object>) this.getTopologyTemplate()).get(outputs);
+ }
+
+ @Override
+ public Map<String, Object> getSubstitutionMappings() {
+ return Objects.isNull(this.getTopologyTemplate()) ? new HashMap<>()
+ : (Map<String, Object>) ((Map<String, Object>) this.getTopologyTemplate())
+ .get(substitutionMappings);
+ }
}
diff --git a/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/test/java/org/openecomp/core/impl/ToscaConverterImplTest.java b/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/test/java/org/openecomp/core/impl/ToscaConverterImplTest.java
index 3e4e62a0d1..bcfc3d8eda 100644
--- a/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/test/java/org/openecomp/core/impl/ToscaConverterImplTest.java
+++ b/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/test/java/org/openecomp/core/impl/ToscaConverterImplTest.java
@@ -40,6 +40,7 @@ import java.nio.file.NotDirectoryException;
import java.util.*;
import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
import static org.openecomp.core.converter.datatypes.Constants.globalStName;
import static org.openecomp.core.converter.datatypes.Constants.mainStName;
@@ -134,6 +135,23 @@ public class ToscaConverterImplTest {
Assert.assertEquals(1, occurrences[1]);
}
+ @Test
+ public void testPoliciesBeenConverted() throws IOException {
+ String inputFilesPath = BASE_DIR + "/convertPolicies/in";
+ FileContentHandler fileContentHandler =
+ createFileContentHandlerFromInput(inputFilesPath);
+ ToscaServiceModel toscaServiceModel = toscaConverter.convert(fileContentHandler);
+ Optional<ServiceTemplate> st = toscaServiceModel.getServiceTemplate("MainServiceTemplate.yaml");
+
+ assertTrue(st.isPresent());
+
+ Map<String, PolicyDefinition> pds = st.get().getTopology_template().getPolicies();
+
+ assertEquals(2, pds.size());
+ assertTrue(pds.containsKey("scaling_aspects"));
+ assertTrue(pds.containsKey("instantiation_levels"));
+ }
+
private Object[] buildOccurrences(String... bounds) {
return buildOccurrences(Arrays.asList(bounds));
}
diff --git a/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/test/resources/mock/toscaConverter/convertMainSt/in/MainServiceTemplate.yaml b/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/test/resources/mock/toscaConverter/convertMainSt/in/MainServiceTemplate.yaml
index 041afbacf8..a650f7d29d 100644
--- a/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/test/resources/mock/toscaConverter/convertMainSt/in/MainServiceTemplate.yaml
+++ b/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/test/resources/mock/toscaConverter/convertMainSt/in/MainServiceTemplate.yaml
@@ -548,4 +548,15 @@ topology_template:
substitution_mappings:
node_type: tosca.nodes.nfv.VNF.vPCRF
+ policies:
+ scaling_aspects:
+ type: tosca.policies.nfv.ScalingAspects
+ properties:
+ aspects:
+ processing:
+ name: processing
+ description: aspect for processing
+ max_scale_level: 5
+ step_deltas:
+ - delta_1
tosca_definitions_version: tosca_simple_yaml_1_0 \ No newline at end of file
diff --git a/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/test/resources/mock/toscaConverter/convertMainSt/out/MainServiceTemplate.yaml b/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/test/resources/mock/toscaConverter/convertMainSt/out/MainServiceTemplate.yaml
index 0f41bb0d8b..f40f214929 100644
--- a/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/test/resources/mock/toscaConverter/convertMainSt/out/MainServiceTemplate.yaml
+++ b/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/test/resources/mock/toscaConverter/convertMainSt/out/MainServiceTemplate.yaml
@@ -544,5 +544,16 @@ topology_template:
- virtual_link:
capability: virtual_linkable
node: Fabric
+ policies:
+ scaling_aspects:
+ type: tosca.policies.nfv.ScalingAspects
+ properties:
+ aspects:
+ processing:
+ name: processing
+ description: aspect for processing
+ max_scale_level: 5
+ step_deltas:
+ - delta_1
substitution_mappings:
node_type: tosca.nodes.nfv.VNF.vPCRF
diff --git a/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/test/resources/mock/toscaConverter/convertPolicies/in/Artifacts/checksum.lst b/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/test/resources/mock/toscaConverter/convertPolicies/in/Artifacts/checksum.lst
new file mode 100644
index 0000000000..701f14d45d
--- /dev/null
+++ b/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/test/resources/mock/toscaConverter/convertPolicies/in/Artifacts/checksum.lst
@@ -0,0 +1 @@
+Definitions/openovnf__vPCRF.yaml:75bd8963ecc09bf769d0bb5cb475314d
diff --git a/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/test/resources/mock/toscaConverter/convertPolicies/in/Artifacts/csar.meta b/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/test/resources/mock/toscaConverter/convertPolicies/in/Artifacts/csar.meta
new file mode 100644
index 0000000000..aac2fed3c3
--- /dev/null
+++ b/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/test/resources/mock/toscaConverter/convertPolicies/in/Artifacts/csar.meta
@@ -0,0 +1,3 @@
+Type:NFAR
+Version:v1.0
+Provider:Huawei \ No newline at end of file
diff --git a/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/test/resources/mock/toscaConverter/convertPolicies/in/Definitions/GlobalSubstitutionTypesServiceTemplate.yaml b/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/test/resources/mock/toscaConverter/convertPolicies/in/Definitions/GlobalSubstitutionTypesServiceTemplate.yaml
new file mode 100644
index 0000000000..a88171701e
--- /dev/null
+++ b/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/test/resources/mock/toscaConverter/convertPolicies/in/Definitions/GlobalSubstitutionTypesServiceTemplate.yaml
@@ -0,0 +1,60 @@
+node_types:
+ tosca.nodes.nfv.VDU.Compute:
+ attributes:
+ private_address:
+ type: string
+ public_address:
+ type: string
+ networks:
+ type: string
+ ports:
+ type: string
+ capabilities:
+ scalable:
+ type: tosca.capabilities.Scalable
+ virtual_compute:
+ type: tosca.capabilities.nfv.VirtualCompute
+ endpoint:
+ type: tosca.capabilities.Endpoint.Admin
+ os:
+ type: tosca.capabilities.OperatingSystem
+ virtual_binding:
+ type: tosca.capabilities.nfv.VirtualBindable
+ host:
+ type: tosca.capabilities.Container
+ binding:
+ type: tosca.capabilities.network.Bindable
+ monitoring_parameter:
+ type: tosca.capabilities.nfv.Metric
+ derived_from: tosca.nodes.Root
+ properties:
+ configurable_properties:
+ entry_schema:
+ type: tosca.datatypes.nfv.VnfcConfigurableProperties
+ type: map
+ name:
+ type: string
+ nfvi_constraints:
+ entry_schema:
+ type: string
+ required: false
+ type: list
+ descrption:
+ type: string
+ boot_order:
+ entry_schema:
+ type: string
+ required: false
+ type: list
+ requirements:
+ - local_storage:
+ capability: tosca.capabilities.Attachment
+ occurrences:
+ - 0
+ - UNBOUNDED
+ - virtual_storage:
+ capability: tosca.capabilities.nfv.VirtualStorage
+ occurrences:
+ - 0
+ - UNBOUNDED
+tosca_definitions_version: tosca_simple_yaml_1_0
diff --git a/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/test/resources/mock/toscaConverter/convertPolicies/in/MainServiceTemplate.mf b/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/test/resources/mock/toscaConverter/convertPolicies/in/MainServiceTemplate.mf
new file mode 100644
index 0000000000..e45f002332
--- /dev/null
+++ b/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/test/resources/mock/toscaConverter/convertPolicies/in/MainServiceTemplate.mf
@@ -0,0 +1,12 @@
+Manifest-Version: 1.0
+
+Name: Entry-Definitions
+Name: MainServiceTemplate.yaml
+
+Name: Definitions\GlobalSubstitutionTypesServiceTemplate.yaml
+
+Name: Artifacts\install.sh
+
+Name: Artifacts\create_stack.sh
+
+Name: Licenses\license.xml
diff --git a/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/test/resources/mock/toscaConverter/convertPolicies/in/MainServiceTemplate.yaml b/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/test/resources/mock/toscaConverter/convertPolicies/in/MainServiceTemplate.yaml
new file mode 100644
index 0000000000..2a3de9d1e9
--- /dev/null
+++ b/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/test/resources/mock/toscaConverter/convertPolicies/in/MainServiceTemplate.yaml
@@ -0,0 +1,572 @@
+imports:
+- openovnf__tosca.nodes.nfv.VNF.vPCRF.yaml
+- openonfv__tosca.capabilities.Scalable.yaml
+- openonfv__tosca.capabilities.nfv.Metric.yaml
+- openonfv__tosca.nodes.nfv.VnfVirtualLinkDesc.yaml
+- openonfv__tosca.capabilities.network.Bindable.yaml
+- openonfv__tosca.capabilities.Attachment.yaml
+- openonfv__tosca.capabilities.nfv.VirtualBindable.yaml
+- openonfv__tosca.capabilities.nfv.VirtualLinkable.yaml
+- openonfv__tosca.requirements.nfv.VirtualStorage.yaml
+- openonfv__tosca.nodes.nfv.VDU.VirtualStorage.yaml
+- openonfv__tosca.relationships.nfv.VirtualBindsTo.yaml
+- openonfv__tosca.nodes.nfv.VDU.Compute.yaml
+- openonfv__tosca.relationships.nfv.VirtualLinksTo.yaml
+- openonfv__tosca.capabilities.nfv.VirtualCompute.yaml
+- openonfv__tosca.capabilities.Container.yaml
+- openonfv__tosca.capabilities.nfv.VirtualStorage.yaml
+- openonfv__tosca.requirements.nfv.VirtualBinding.yaml
+- openonfv__tosca.capabilities.Endpoint.Admin.yaml
+- openonfv__tosca.capabilities.OperatingSystem.yaml
+- openonfv__tosca.nodes.nfv.VduCpd.yaml
+- openonfv__tosca.relationships.nfv.VDU.AttachedTo.yaml
+
+metadata:
+ vendor: Huawei
+ csarVersion: v1.0
+ csarProvider: Huawei
+ id: vPCRF_NF_HW
+ version: v1.0
+ csarType: NFAR
+ name: vPCRF
+ vnfdVersion: v1.0
+ vnfmType: hwvnfm
+
+node_types:
+ org.openecomp.resource.vfc.nodes.heat.nat_fw:
+ derived_from: org.openecomp.resource.vfc.nodes.heat.nova.Server
+
+topology_template:
+ node_templates:
+ PUPDU_Storage:
+ attributes:
+ tosca_name: PUPDU_Storage
+ properties:
+ id: PUPDU_Storage
+ size_of_storage: 200G
+ type_of_storage: volume
+ type: tosca.nodes.nfv.VDU.VirtualStorage
+ USRSU:
+ attributes:
+ tosca_name: USRSU
+ capabilities:
+ virtual_compute:
+ properties:
+ virtual_memory:
+ virtual_mem_size: 24G
+ requested_additional_capabilities: {}
+ virtual_cpu:
+ num_virtual_cpu: 4
+ properties:
+ configurable_properties:
+ test: {"additional_vnfc_configurable_properties":{"aaa":"1"}}
+ name: USRSU
+ descrption: the virtual machine of USRSU
+ requirements:
+ - virtual_storage:
+ capability: virtual_storage
+ node: USRSU_Storage
+ - local_storage:
+ node: tosca.nodes.Root
+ type: tosca.nodes.nfv.VDU.Compute
+ USPID3_VduCpd_Fabric:
+ attributes:
+ tosca_name: USPID3_VduCpd_Fabric
+ properties:
+ role: root
+ layer_protocol: ipv4
+ requirements:
+ - virtual_binding:
+ capability: virtual_binding
+ node: USPID3
+ - virtual_link:
+ capability: virtual_linkable
+ node: Fabric
+ type: tosca.nodes.nfv.VduCpd
+ PUPDU_VduCpd_Base:
+ attributes:
+ tosca_name: PUPDU_VduCpd_Base
+ properties:
+ role: root
+ layer_protocol: ipv4
+ requirements:
+ - virtual_binding:
+ capability: virtual_binding
+ node: PUPDU
+ - virtual_link:
+ capability: virtual_linkable
+ node: Base
+ type: tosca.nodes.nfv.VduCpd
+ OMU_VduCpd_Fabric:
+ attributes:
+ tosca_name: OMU_VduCpd_Fabric
+ properties:
+ role: root
+ layer_protocol: ipv4
+ requirements:
+ - virtual_binding:
+ capability: virtual_binding
+ node: OMU
+ - virtual_link:
+ capability: virtual_linkable
+ node: Fabric
+ type: tosca.nodes.nfv.VduCpd
+ USPID3:
+ attributes:
+ tosca_name: USPID3
+ capabilities:
+ virtual_compute:
+ properties:
+ virtual_memory:
+ virtual_mem_size: 24G
+ requested_additional_capabilities: {}
+ virtual_cpu:
+ num_virtual_cpu: 4
+ properties:
+ configurable_properties:
+ test: {"additional_vnfc_configurable_properties":{"aaa":"1"}}
+ name: USPID3
+ descrption: the virtual machine of USPID3
+ requirements:
+ - virtual_storage:
+ capability: virtual_storage
+ node: USPID3_Storage
+ - local_storage:
+ node: tosca.nodes.Root
+ type: tosca.nodes.nfv.VDU.Compute
+ UPIRU_VduCpd_Base:
+ attributes:
+ tosca_name: UPIRU_VduCpd_Base
+ properties:
+ role: root
+ layer_protocol: ipv4
+ requirements:
+ - virtual_binding:
+ capability: virtual_binding
+ node: UPIRU
+ - virtual_link:
+ capability: virtual_linkable
+ node: Base
+ type: tosca.nodes.nfv.VduCpd
+ OMU2ManageNet:
+ attributes:
+ tosca_name: OMU2ManageNet
+ properties:
+ role: root
+ layer_protocol: ipv4
+ requirements:
+ - virtual_binding:
+ node: tosca.nodes.Root
+ - virtual_link:
+ node: tosca.nodes.Root
+ type: tosca.nodes.nfv.VduCpd
+ OMU_Storage:
+ attributes:
+ tosca_name: OMU_Storage
+ properties:
+ id: OMU_Storage
+ size_of_storage: 256G
+ rdma_enabled: false
+ type_of_storage: volume
+ type: tosca.nodes.nfv.VDU.VirtualStorage
+ UPSPU:
+ attributes:
+ tosca_name: UPSPU
+ capabilities:
+ virtual_compute:
+ properties:
+ virtual_memory:
+ virtual_mem_size: 24G
+ requested_additional_capabilities: {}
+ virtual_cpu:
+ num_virtual_cpu: 4
+ properties:
+ configurable_properties:
+ test: {"additional_vnfc_configurable_properties":{"aaa":"1"}}
+ name: UPSPU
+ descrption: the virtual machine of UPSPU
+ requirements:
+ - virtual_storage:
+ capability: virtual_storage
+ node: UPSPU_Storage
+ - local_storage:
+ node: tosca.nodes.Root
+ type: tosca.nodes.nfv.VDU.Compute
+ PUPDU_VduCpd_Fabric:
+ attributes:
+ tosca_name: PUPDU_VduCpd_Fabric
+ properties:
+ role: root
+ layer_protocol: ipv4
+ requirements:
+ - virtual_binding:
+ capability: virtual_binding
+ node: PUPDU
+ - virtual_link:
+ capability: virtual_linkable
+ node: Fabric
+ type: tosca.nodes.nfv.VduCpd
+ USPID2BossNet:
+ attributes:
+ tosca_name: USPID2BossNet
+ properties:
+ role: root
+ layer_protocol: ethernet
+ requirements:
+ - virtual_binding:
+ capability: virtual_binding
+ node: USPID3
+ - virtual_link:
+ node: tosca.nodes.Root
+ type: tosca.nodes.nfv.VduCpd
+ OMU_VduCpd_Base:
+ attributes:
+ tosca_name: OMU_VduCpd_Base
+ properties:
+ role: root
+ layer_protocol: ipv4
+ requirements:
+ - virtual_binding:
+ capability: virtual_binding
+ node: OMU
+ - virtual_link:
+ capability: virtual_linkable
+ node: Base
+ type: tosca.nodes.nfv.VduCpd
+ USPID3_Storage:
+ attributes:
+ tosca_name: USPID3_Storage
+ properties:
+ id: USPID3_Storage
+ size_of_storage: 300G
+ type_of_storage: volume
+ type: tosca.nodes.nfv.VDU.VirtualStorage
+ UPIRU2DataNet2:
+ attributes:
+ tosca_name: UPIRU2DataNet2
+ properties:
+ role: root
+ layer_protocol: ipv4
+ requirements:
+ - virtual_binding:
+ capability: virtual_binding
+ node: UPIRU
+ - virtual_link:
+ node: tosca.nodes.Root
+ type: tosca.nodes.nfv.VduCpd
+ USPID2ManageNet:
+ attributes:
+ tosca_name: USPID2ManageNet
+ properties:
+ role: root
+ layer_protocol: ipv4
+ requirements:
+ - virtual_binding:
+ capability: virtual_binding
+ node: USPID3
+ - virtual_link:
+ node: tosca.nodes.Root
+ type: tosca.nodes.nfv.VduCpd
+ UPIRU2DataNet3:
+ attributes:
+ tosca_name: UPIRU2DataNet3
+ properties:
+ role: root
+ layer_protocol: ipv4
+ requirements:
+ - virtual_binding:
+ capability: virtual_binding
+ node: UPIRU
+ - virtual_link:
+ node: tosca.nodes.Root
+ type: tosca.nodes.nfv.VduCpd
+ PUPDU2DataNet3:
+ attributes:
+ tosca_name: PUPDU2DataNet3
+ properties:
+ role: root
+ layer_protocol: ethernet
+ requirements:
+ - virtual_binding:
+ capability: virtual_binding
+ node: PUPDU
+ - virtual_link:
+ node: tosca.nodes.Root
+ type: tosca.nodes.nfv.VduCpd
+ USRSU2DataNet1:
+ attributes:
+ tosca_name: USRSU2DataNet1
+ properties:
+ role: root
+ layer_protocol: ipv4
+ requirements:
+ - virtual_binding:
+ capability: virtual_binding
+ node: USRSU
+ - virtual_link:
+ node: tosca.nodes.Root
+ type: tosca.nodes.nfv.VduCpd
+ USRSU2DataNet2:
+ attributes:
+ tosca_name: USRSU2DataNet2
+ properties:
+ role: root
+ layer_protocol: ipv4
+ requirements:
+ - virtual_binding:
+ capability: virtual_binding
+ node: USRSU
+ - virtual_link:
+ node: tosca.nodes.Root
+ type: tosca.nodes.nfv.VduCpd
+ UPIRU_Storage:
+ attributes:
+ tosca_name: UPIRU_Storage
+ properties:
+ id: UPIRU_Storage
+ size_of_storage: 4G
+ type_of_storage: volume
+ type: tosca.nodes.nfv.VDU.VirtualStorage
+ PUPDU2SignalNet1:
+ attributes:
+ tosca_name: PUPDU2SignalNet1
+ properties:
+ role: root
+ layer_protocol: ipv4
+ requirements:
+ - virtual_binding:
+ capability: virtual_binding
+ node: PUPDU
+ - virtual_link:
+ node: tosca.nodes.Root
+ type: tosca.nodes.nfv.VduCpd
+ UPIRU2DataNet1:
+ attributes:
+ tosca_name: UPIRU2DataNet1
+ properties:
+ role: root
+ layer_protocol: ipv4
+ requirements:
+ - virtual_binding:
+ capability: virtual_binding
+ node: UPIRU
+ - virtual_link:
+ node: tosca.nodes.Root
+ type: tosca.nodes.nfv.VduCpd
+ USPID3_VduCpd_Base:
+ attributes:
+ tosca_name: USPID3_VduCpd_Base
+ properties:
+ role: root
+ layer_protocol: ipv4
+ requirements:
+ - virtual_binding:
+ capability: virtual_binding
+ node: USPID3
+ - virtual_link:
+ capability: virtual_linkable
+ node: Base
+ type: tosca.nodes.nfv.VduCpd
+ Base:
+ attributes:
+ tosca_name: Base
+ properties:
+ vl_flavours:
+ flavours: test2
+ connectivity_type:
+ layer_protocol: ipv4
+ flow_pattern:
+ type: tosca.nodes.nfv.VnfVirtualLinkDesc
+ USRSU_Storage:
+ attributes:
+ tosca_name: USRSU_Storage
+ properties:
+ id: USRSU_Storage
+ size_of_storage: 200G
+ type_of_storage: volume
+ type: tosca.nodes.nfv.VDU.VirtualStorage
+ UPSPU_VduCpd_Base:
+ attributes:
+ tosca_name: UPSPU_VduCpd_Base
+ properties:
+ role: root
+ layer_protocol: ipv4
+ requirements:
+ - virtual_binding:
+ capability: virtual_binding
+ node: UPSPU
+ - virtual_link:
+ capability: virtual_linkable
+ node: Base
+ type: tosca.nodes.nfv.VduCpd
+ PUPDU:
+ attributes:
+ tosca_name: PUPDU
+ capabilities:
+ virtual_compute:
+ properties:
+ virtual_memory:
+ virtual_mem_size: 24G
+ requested_additional_capabilities: {}
+ virtual_cpu:
+ num_virtual_cpu: 4
+ properties:
+ configurable_properties:
+ test: {"additional_vnfc_configurable_properties":{"aaa":"1"}}
+ name: PUPDU
+ descrption: the virtual machine of PUPDU
+ requirements:
+ - virtual_storage:
+ capability: virtual_storage
+ node: PUPDU_Storage
+ - local_storage:
+ node: tosca.nodes.Root
+ type: tosca.nodes.nfv.VDU.Compute
+ USRSU_VduCpd_Base:
+ attributes:
+ tosca_name: USRSU_VduCpd_Base
+ properties:
+ role: root
+ layer_protocol: ipv4
+ requirements:
+ - virtual_binding:
+ capability: virtual_binding
+ node: USRSU
+ - virtual_link:
+ capability: virtual_linkable
+ node: Base
+ type: tosca.nodes.nfv.VduCpd
+ OMU:
+ attributes:
+ tosca_name: OMU
+ capabilities:
+ virtual_compute:
+ properties:
+ virtual_memory:
+ virtual_mem_size: 16G
+ requested_additional_capabilities: {}
+ virtual_cpu:
+ num_virtual_cpu: 4
+ properties:
+ configurable_properties:
+ test: {"additional_vnfc_configurable_properties":{"aaa":"1"}}
+ name: OMU
+ descrption: the virtual machine of OMU
+ requirements:
+ - virtual_storage:
+ capability: virtual_storage
+ node: OMU_Storage
+ - local_storage:
+ node: tosca.nodes.Root
+ type: tosca.nodes.nfv.VDU.Compute
+ UPIRU_VduCpd_Fabric:
+ attributes:
+ tosca_name: UPIRU_VduCpd_Fabric
+ properties:
+ role: root
+ layer_protocol: ipv4
+ requirements:
+ - virtual_binding:
+ capability: virtual_binding
+ node: UPIRU
+ - virtual_link:
+ capability: virtual_linkable
+ node: Fabric
+ type: tosca.nodes.nfv.VduCpd
+ UPSPU_Storage:
+ attributes:
+ tosca_name: UPSPU_Storage
+ properties:
+ id: UPSPU_Storage
+ size_of_storage: 4G
+ type_of_storage: volume
+ type: tosca.nodes.nfv.VDU.VirtualStorage
+ PUPDU2ManageNet:
+ attributes:
+ tosca_name: PUPDU2ManageNet
+ properties:
+ role: root
+ layer_protocol: ethernet
+ requirements:
+ - virtual_binding:
+ capability: virtual_binding
+ node: PUPDU
+ - virtual_link:
+ node: tosca.nodes.Root
+ type: tosca.nodes.nfv.VduCpd
+ USRSU_VduCpd_Fabric:
+ attributes:
+ tosca_name: USRSU_VduCpd_Fabric
+ properties:
+ role: root
+ layer_protocol: ipv4
+ requirements:
+ - virtual_binding:
+ capability: virtual_binding
+ node: USRSU
+ - virtual_link:
+ capability: virtual_linkable
+ node: Fabric
+ type: tosca.nodes.nfv.VduCpd
+ UPIRU2SignalNet1:
+ attributes:
+ tosca_name: UPIRU2SignalNet1
+ properties:
+ role: root
+ layer_protocol: ipv4
+ requirements:
+ - virtual_binding:
+ capability: virtual_binding
+ node: UPIRU
+ - virtual_link:
+ node: tosca.nodes.Root
+ type: tosca.nodes.nfv.VduCpd
+ Fabric:
+ attributes:
+ tosca_name: Fabric
+ properties:
+ vl_flavours:
+ flavours: test1
+ connectivity_type:
+ layer_protocol: ipv4
+ flow_pattern:
+ type: tosca.nodes.nfv.VnfVirtualLinkDesc
+ UPSPU_VduCpd_Fabric:
+ attributes:
+ tosca_name: UPSPU_VduCpd_Fabric
+ properties:
+ role: root
+ layer_protocol: ipv4
+ requirements:
+ - virtual_binding:
+ capability: virtual_binding
+ node: UPSPU
+ - virtual_link:
+ capability: virtual_linkable
+ node: Fabric
+ type: tosca.nodes.nfv.VduCpd
+
+ substitution_mappings:
+ node_type: tosca.nodes.nfv.VNF.vPCRF
+ policies:
+ scaling_aspects:
+ type: tosca.policies.nfv.ScalingAspects
+ properties:
+ aspects:
+ processing:
+ name: processing
+ description: aspect for processing
+ max_scale_level: 5
+ step_deltas:
+ - delta_1
+ instantiation_levels:
+ type: tosca.policies.nfv.InstantiationLevels
+ description: test policy
+ properties:
+ levels:
+ instantiation_level_1:
+ scale_info:
+ processing:
+ scale_level: 0
+ default_level: instantiation_level_1
+tosca_definitions_version: tosca_simple_yaml_1_0 \ No newline at end of file
diff --git a/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/test/resources/mock/toscaConverter/convertPolicies/in/TOSCA-Metadata/TOSCA.meta b/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/test/resources/mock/toscaConverter/convertPolicies/in/TOSCA-Metadata/TOSCA.meta
new file mode 100644
index 0000000000..69f62ca864
--- /dev/null
+++ b/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/test/resources/mock/toscaConverter/convertPolicies/in/TOSCA-Metadata/TOSCA.meta
@@ -0,0 +1,135 @@
+TOSCA-Meta-Version: 1.0
+CSAR-Version: 1.0
+Created-By: Winery 0.1.37-SNAPSHOT
+Entry-Definitions: Definitions/openovnf__vPCRF.yaml
+
+Name: Definitions/openovnf__vPCRF.yaml
+Content-Type: application/vnd.oasis.tosca.definitions
+
+Name: Definitions/openovnf__tosca.nodes.nfv.VNF.vPCRF.yaml
+Content-Type: application/vnd.oasis.tosca.definitions
+
+Name: Definitions/openonfv__tosca.capabilities.Scalable.yaml
+Content-Type: application/vnd.oasis.tosca.definitions
+
+Name: Definitions/openonfv__tosca.capabilities.nfv.Metric.yaml
+Content-Type: application/vnd.oasis.tosca.definitions
+
+Name: Definitions/openonfv__tosca.nodes.nfv.VnfVirtualLinkDesc.yaml
+Content-Type: application/vnd.oasis.tosca.definitions
+
+Name: Definitions/openonfv__tosca.capabilities.network.Bindable.yaml
+Content-Type: application/vnd.oasis.tosca.definitions
+
+Name: Definitions/openonfv__tosca.capabilities.Attachment.yaml
+Content-Type: application/vnd.oasis.tosca.definitions
+
+Name: Definitions/openonfv__tosca.capabilities.nfv.VirtualBindable.yaml
+Content-Type: application/vnd.oasis.tosca.definitions
+
+Name: Definitions/openonfv__tosca.capabilities.nfv.VirtualLinkable.yaml
+Content-Type: application/vnd.oasis.tosca.definitions
+
+Name: Definitions/openonfv__tosca.requirements.nfv.VirtualStorage.yaml
+Content-Type: application/vnd.oasis.tosca.definitions
+
+Name: Definitions/openonfv__tosca.nodes.nfv.VDU.VirtualStorage.yaml
+Content-Type: application/vnd.oasis.tosca.definitions
+
+Name: Definitions/openonfv__tosca.relationships.nfv.VirtualBindsTo.yaml
+Content-Type: application/vnd.oasis.tosca.definitions
+
+Name: Definitions/openonfv__tosca.nodes.nfv.VDU.Compute.yaml
+Content-Type: application/vnd.oasis.tosca.definitions
+
+Name: Definitions/openonfv__tosca.relationships.nfv.VirtualLinksTo.yaml
+Content-Type: application/vnd.oasis.tosca.definitions
+
+Name: Definitions/openonfv__tosca.capabilities.nfv.VirtualCompute.yaml
+Content-Type: application/vnd.oasis.tosca.definitions
+
+Name: Definitions/openonfv__tosca.capabilities.Container.yaml
+Content-Type: application/vnd.oasis.tosca.definitions
+
+Name: Definitions/openonfv__tosca.capabilities.nfv.VirtualStorage.yaml
+Content-Type: application/vnd.oasis.tosca.definitions
+
+Name: Definitions/openonfv__tosca.requirements.nfv.VirtualBinding.yaml
+Content-Type: application/vnd.oasis.tosca.definitions
+
+Name: Definitions/openonfv__tosca.capabilities.Endpoint.Admin.yaml
+Content-Type: application/vnd.oasis.tosca.definitions
+
+Name: Definitions/openonfv__tosca.capabilities.OperatingSystem.yaml
+Content-Type: application/vnd.oasis.tosca.definitions
+
+Name: Definitions/openonfv__tosca.nodes.nfv.VduCpd.yaml
+Content-Type: application/vnd.oasis.tosca.definitions
+
+Name: Definitions/openonfv__tosca.relationships.nfv.VDU.AttachedTo.yaml
+Content-Type: application/vnd.oasis.tosca.definitions
+
+Name: Definitions/openonfv__tosca.requirements.nfv.VirtualLink.yaml
+Content-Type: application/vnd.oasis.tosca.definitions
+
+Name: Definitions/openovnf__tosca.nodes.nfv.VNF.yaml
+Content-Type: application/vnd.oasis.tosca.definitions
+
+Name: nodetypes/http%3A%2F%2Fwww.open-o.org%2Ftosca%2Fnfv/tosca.nodes.nfv.VDU.VirtualStorage/propertiesdefinition/Properties.xsd
+Content-Type: text/xml
+
+Name: nodetypes/http%3A%2F%2Fwww.open-o.org%2Ftosca%2Fnfv/tosca.nodes.nfv.VnfVirtualLinkDesc/appearance/bigIcon.png
+Content-Type: image/png
+
+Name: nodetypes/http%3A%2F%2Fwww.open-o.org%2Ftosca%2Fnfv/tosca.nodes.nfv.VnfVirtualLinkDesc/appearance/smallIcon.png
+Content-Type: image/png
+
+Name: nodetypes/http%3A%2F%2Fwww.open-o.org%2Ftosca%2Fnfv/tosca.nodes.nfv.VDU.Compute/propertiesdefinition/Properties.xsd
+Content-Type: text/xml
+
+Name: nodetypes/http%3A%2F%2Fwww.open-o.org%2Ftosca%2Fnfv/tosca.nodes.nfv.VduCpd/propertiesdefinition/Properties.xsd
+Content-Type: text/xml
+
+Name: capabilitytypes/http%3A%2F%2Fwww.open-o.org%2Ftosca%2Fnfv/tosca.capabilities.nfv.VirtualCompute/propertiesdefinition/Properties.xsd
+Content-Type: text/xml
+
+Name: nodetypes/http%3A%2F%2Fwww.open-o.org%2Ftosca%2Fnfv%2Fvnf/tosca.nodes.nfv.VNF/propertiesdefinition/Properties.xsd
+Content-Type: text/xml
+
+Name: nodetypes/http%3A%2F%2Fwww.open-o.org%2Ftosca%2Fnfv/tosca.nodes.nfv.VDU.VirtualStorage/appearance/bigIcon.png
+Content-Type: image/png
+
+Name: nodetypes/http%3A%2F%2Fwww.open-o.org%2Ftosca%2Fnfv/tosca.nodes.nfv.VDU.VirtualStorage/appearance/smallIcon.png
+Content-Type: image/png
+
+Name: capabilitytypes/http%3A%2F%2Fwww.open-o.org%2Ftosca%2Fnfv/tosca.capabilities.Container/propertiesdefinition/Properties.xsd
+Content-Type: text/xml
+
+Name: nodetypes/http%3A%2F%2Fwww.open-o.org%2Ftosca%2Fnfv/tosca.nodes.nfv.VDU.Compute/appearance/bigIcon.png
+Content-Type: image/png
+
+Name: nodetypes/http%3A%2F%2Fwww.open-o.org%2Ftosca%2Fnfv/tosca.nodes.nfv.VDU.Compute/appearance/smallIcon.png
+Content-Type: image/png
+
+Name: nodetypes/http%3A%2F%2Fwww.open-o.org%2Ftosca%2Fnfv%2Fvnf/tosca.nodes.nfv.VNF.vPCRF/propertiesdefinition/Properties.xsd
+Content-Type: text/xml
+
+Name: capabilitytypes/http%3A%2F%2Fwww.open-o.org%2Ftosca%2Fnfv/tosca.capabilities.OperatingSystem/propertiesdefinition/Properties.xsd
+Content-Type: text/xml
+
+Name: nodetypes/http%3A%2F%2Fwww.open-o.org%2Ftosca%2Fnfv/tosca.nodes.nfv.VnfVirtualLinkDesc/propertiesdefinition/Properties.xsd
+Content-Type: text/xml
+
+Name: nodetypes/http%3A%2F%2Fwww.open-o.org%2Ftosca%2Fnfv/tosca.nodes.nfv.VduCpd/appearance/bigIcon.png
+Content-Type: image/png
+
+Name: nodetypes/http%3A%2F%2Fwww.open-o.org%2Ftosca%2Fnfv/tosca.nodes.nfv.VduCpd/appearance/smallIcon.png
+Content-Type: image/png
+
+Name: capabilitytypes/http%3A%2F%2Fwww.open-o.org%2Ftosca%2Fnfv/tosca.capabilities.Scalable/propertiesdefinition/Properties.xsd
+Content-Type: text/xml
+
+Name: relationshiptypes/http%3A%2F%2Fwww.open-o.org%2Ftosca%2Fnfv/tosca.relationships.nfv.VDU.AttachedTo/propertiesdefinition/Properties.xsd
+Content-Type: text/xml
+
+