summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--sdc-distribution-ci/pom.xml2
-rw-r--r--sdc-distribution-ci/src/main/java/org/openecomp/test/CsarToscaTester.java58
2 files changed, 57 insertions, 3 deletions
diff --git a/sdc-distribution-ci/pom.xml b/sdc-distribution-ci/pom.xml
index e4c2152..8cfc4a1 100644
--- a/sdc-distribution-ci/pom.xml
+++ b/sdc-distribution-ci/pom.xml
@@ -32,7 +32,7 @@
<dependency>
<groupId>org.openecomp.sdc.sdc-tosca</groupId>
<artifactId>sdc-tosca</artifactId>
- <version>1.1.31-SNAPSHOT</version>
+ <version>1.1.32-SNAPSHOT</version>
<scope>compile</scope>
</dependency>
diff --git a/sdc-distribution-ci/src/main/java/org/openecomp/test/CsarToscaTester.java b/sdc-distribution-ci/src/main/java/org/openecomp/test/CsarToscaTester.java
index 8690257..1ce3619 100644
--- a/sdc-distribution-ci/src/main/java/org/openecomp/test/CsarToscaTester.java
+++ b/sdc-distribution-ci/src/main/java/org/openecomp/test/CsarToscaTester.java
@@ -7,10 +7,16 @@ import java.text.SimpleDateFormat;
import java.util.Arrays;
import java.util.Date;
import java.util.List;
+import java.util.Map;
+import org.openecomp.sdc.tosca.parser.api.ISdcCsarHelper;
import org.openecomp.sdc.tosca.parser.exceptions.SdcToscaParserException;
-import org.openecomp.sdc.tosca.parser.impl.SdcPropertyNames;
import org.openecomp.sdc.tosca.parser.impl.SdcToscaParserFactory;
+import org.openecomp.sdc.tosca.parser.impl.SdcTypes;
+import org.openecomp.sdc.toscaparser.api.Group;
+import org.openecomp.sdc.toscaparser.api.NodeTemplate;
+import org.openecomp.sdc.toscaparser.api.elements.Metadata;
+import org.openecomp.sdc.toscaparser.api.parameters.Input;
import org.openecomp.sdc.toscaparser.api.utils.ThreadLocalsHolder;
public class CsarToscaTester {
@@ -36,7 +42,7 @@ public class CsarToscaTester {
dir = new File(currentCsarDir);
dir.mkdir();
try {
- factory.getSdcCsarHelper(file.getAbsolutePath());
+ processCsar(factory, file);
} catch (SdcToscaParserException e){
System.out.println("SdcToscaParserException caught. Code: "+e.getCode()+", message: "+ e.getMessage());
}
@@ -60,6 +66,54 @@ public class CsarToscaTester {
}
}
+ private static void processCsar(SdcToscaParserFactory factory, File file) throws SdcToscaParserException {
+ ISdcCsarHelper sdcCsarHelper = factory.getSdcCsarHelper(file.getAbsolutePath());
+ //Service level
+ System.out.println("Invoking sdc-tosca methods on this CSAR....");
+ String conformanceLevel = sdcCsarHelper.getConformanceLevel();
+ System.out.println("getConformanceLevel() - conformance level is "+conformanceLevel);
+ String serviceSubstitutionMappingsTypeName = sdcCsarHelper.getServiceSubstitutionMappingsTypeName();
+ System.out.println("serviceSubstitutionMappingsTypeName() - subst mappings type of service is "+serviceSubstitutionMappingsTypeName);
+ List<Input> serviceInputs = sdcCsarHelper.getServiceInputs();
+ System.out.println("getServiceInputs() - service inputs are "+serviceInputs);
+ Metadata serviceMetadata = sdcCsarHelper.getServiceMetadata();
+ System.out.println("getServiceMetadata() - service metadata is "+serviceMetadata);
+ Map<String, Object> serviceMetadataProperties = sdcCsarHelper.getServiceMetadataProperties();
+ System.out.println("getServiceMetadataProperties() - service metadata properties is "+serviceMetadataProperties);
+ List<NodeTemplate> allottedResources = sdcCsarHelper.getAllottedResources();
+ System.out.println("getAllottedResources() - service allotted resources are "+allottedResources);
+ List<NodeTemplate> serviceVfList = sdcCsarHelper.getServiceVfList();
+ System.out.println("getServiceVfList() - VF list is "+serviceVfList);
+ List<NodeTemplate> serviceNodeTemplateBySdcType = sdcCsarHelper.getServiceNodeTemplateBySdcType(SdcTypes.VF);
+ System.out.println("getServiceNodeTemplateBySdcType() - VF list is "+serviceNodeTemplateBySdcType);
+ List<NodeTemplate> serviceNodeTemplates = sdcCsarHelper.getServiceNodeTemplates();
+ System.out.println("getServiceNodeTemplates() - all node templates list of service is "+serviceNodeTemplates);
+
+ serviceVfList.forEach(x -> {
+ String nodeTemplateCustomizationUuid = sdcCsarHelper.getNodeTemplateCustomizationUuid(x);
+ System.out.println("getNodeTemplateCustomizationUuid() - VF ID is "+nodeTemplateCustomizationUuid);
+ String typeOfNodeTemplate = sdcCsarHelper.getTypeOfNodeTemplate(x);
+ System.out.println("getTypeOfNodeTemplate() - VF tosca type is "+typeOfNodeTemplate);
+ List<Group> vfModulesByVf = sdcCsarHelper.getVfModulesByVf(nodeTemplateCustomizationUuid);
+ System.out.println("getVfModulesByVf() - VF modules list is "+vfModulesByVf);
+ vfModulesByVf.forEach(y -> {
+ List<NodeTemplate> membersOfVfModule = sdcCsarHelper.getMembersOfVfModule(x, y);
+ System.out.println("getMembersOfVfModule() - members of VfModule are "+membersOfVfModule);
+ });
+ List<NodeTemplate> vfcListByVf = sdcCsarHelper.getVfcListByVf(nodeTemplateCustomizationUuid);
+ System.out.println("getVfcListByVf() - VFC list is "+vfcListByVf);
+ vfcListByVf.forEach(z -> {
+ List<NodeTemplate> nodeTemplateBySdcType = sdcCsarHelper.getNodeTemplateBySdcType(z, SdcTypes.CP);
+ System.out.println("getNodeTemplateBySdcType() - CP children node templates of this VFC are "+nodeTemplateBySdcType);
+ Map<String, Map<String, Object>> cpPropertiesFromVfcAsObject = sdcCsarHelper.getCpPropertiesFromVfcAsObject(z);
+ System.out.println("getCpPropertiesFromVfcAsObject() - consolidated CP properties for this VFC are "+cpPropertiesFromVfcAsObject);
+ boolean hasTopology = sdcCsarHelper.hasTopology(z);
+ System.out.println("hasTopology() - this VFC is "+(hasTopology ? "nested" : "not nested"));
+ });
+ });
+
+ }
+
private static void generateReport(String time, String name, String currentCsarDir, List<String> criticalsReport, String type)
throws IOException {
FileWriter fw;