aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--jython-tosca-parser/pom.xml2
-rw-r--r--jython-tosca-parser/src/main/java/org/openecomp/sdc/toscaparser/api/EntityTemplate.java13
-rw-r--r--jython-tosca-parser/src/main/java/org/openecomp/sdc/toscaparser/api/Group.java22
-rw-r--r--jython-tosca-parser/src/main/java/org/openecomp/sdc/toscaparser/api/Metadata.java28
-rw-r--r--jython-tosca-parser/src/main/java/org/openecomp/sdc/toscaparser/api/NodeTemplate.java15
-rw-r--r--jython-tosca-parser/src/main/java/org/openecomp/sdc/toscaparser/api/SubstitutionMappings.java16
-rw-r--r--jython-tosca-parser/src/main/java/org/openecomp/sdc/toscaparser/api/TopologyTemplate.java21
-rw-r--r--jython-tosca-parser/src/main/java/org/openecomp/sdc/toscaparser/api/ToscaTemplate.java7
-rw-r--r--jython-tosca-parser/src/main/java/org/openecomp/sdc/toscaparser/api/parameters/Input.java7
-rw-r--r--jython-tosca-parser/src/main/java/org/openecomp/sdc/toscaparser/jython/JyGroup.java7
-rw-r--r--jython-tosca-parser/src/main/java/org/openecomp/sdc/toscaparser/jython/JyNodeTemplate.java3
-rw-r--r--jython-tosca-parser/src/main/java/org/openecomp/sdc/toscaparser/jython/JySubstitutionMappings.java1
-rw-r--r--jython-tosca-parser/src/main/java/org/openecomp/sdc/toscaparser/jython/JyTopologyTemplate.java4
-rw-r--r--jython-tosca-parser/src/main/java/org/openecomp/sdc/toscaparser/jython/JyToscaTemplate.java4
-rw-r--r--jython-tosca-parser/src/main/java/org/openecomp/sdc/toscaparser/jython/parameters/JyInput.java2
-rw-r--r--jython-tosca-parser/src/main/resources/Lib/site-packages/tosca_parser-0.7.0-py2.7.egg/toscaparser/groups.py6
-rw-r--r--jython-tosca-parser/src/main/resources/Lib/site-packages/tosca_parser-0.7.0-py2.7.egg/toscaparser/nodetemplate.py4
-rw-r--r--jython-tosca-parser/src/main/resources/Lib/site-packages/tosca_parser-0.7.0-py2.7.egg/toscaparser/parameters.py5
-rw-r--r--jython-tosca-parser/src/main/resources/Lib/site-packages/tosca_parser-0.7.0-py2.7.egg/toscaparser/substitution_mappings.py6
-rw-r--r--jython-tosca-parser/src/main/resources/Lib/site-packages/tosca_parser-0.7.0-py2.7.egg/toscaparser/topology_template.py1
-rw-r--r--jython-tosca-parser/src/main/resources/Lib/site-packages/tosca_parser-0.7.0-py2.7.egg/toscaparser/tosca_template.py14
-rw-r--r--pom.xml2
-rw-r--r--sdc-distribution-ci/pom.xml2
-rw-r--r--sdc-distribution-ci/src/main/java/org/openecomp/test/ClientTest.java10
-rw-r--r--sdc-distribution-client/pom.xml2
-rw-r--r--sdc-tosca-parser/pom.xml2
-rw-r--r--sdc-tosca-parser/src/main/java/org/openecomp/sdc/tosca/parser/api/ISdcCsarHelper.java31
-rw-r--r--sdc-tosca-parser/src/main/java/org/openecomp/sdc/tosca/parser/impl/SdcCsarHelperImpl.java422
-rw-r--r--sdc-tosca-parser/src/main/java/org/openecomp/sdc/tosca/parser/impl/SdcToscaParserFactory.java18
-rw-r--r--sdc-tosca-parser/src/main/java/org/openecomp/sdc/tosca/parser/utils/GeneralUtility.java8
-rw-r--r--sdc-tosca-parser/src/test/java/org/openecomp/sdc/impl/ToscaParserStubsTest.java477
-rw-r--r--sdc-tosca-parser/src/test/resources/csars/csar_hello_world.zipbin0 -> 936 bytes
-rw-r--r--sdc-tosca-parser/src/test/resources/csars/service-ServiceFdnt-csar-cp-vfc-req-cap-8.csarbin0 -> 40116 bytes
-rw-r--r--sdc-tosca-parser/src/test/resources/csars/service-ServiceFdnt-csar-flat-input-9-1.csarbin0 -> 40109 bytes
-rw-r--r--sdc-tosca-parser/src/test/resources/csars/service-ServiceFdnt-csar-group-meta-10.csarbin0 -> 40118 bytes
-rw-r--r--sdc-tosca-parser/src/test/resources/csars/service-ServiceFdnt-csar-inputs-9.csarbin0 -> 40130 bytes
-rw-r--r--sdc-tosca-parser/src/test/resources/csars/service-ServiceFdnt-csar-no-vf.csarbin0 -> 39954 bytes
-rw-r--r--sdc-tosca-parser/src/test/resources/csars/service-ServiceFdnt-csar-rainy.csarbin0 -> 39675 bytes
-rw-r--r--sdc-tosca-parser/src/test/resources/csars/service-ServiceFdnt-csar-service-vl-7.csarbin0 -> 40014 bytes
-rw-r--r--sdc-tosca-parser/src/test/resources/csars/service-ServiceFdnt-csar-two-vfs-5.csarbin0 -> 39964 bytes
-rw-r--r--sdc-tosca-parser/src/test/resources/csars/service-ServiceFdnt-test-csar.csarbin0 -> 39938 bytes
41 files changed, 969 insertions, 193 deletions
diff --git a/jython-tosca-parser/pom.xml b/jython-tosca-parser/pom.xml
index 7e29249..01507cc 100644
--- a/jython-tosca-parser/pom.xml
+++ b/jython-tosca-parser/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>org.openecomp.sdc.sdc-distribution-client</groupId>
<artifactId>sdc-main-distribution-client</artifactId>
- <version>1.1.0-SNAPSHOT</version>
+ <version>1.1.6-SNAPSHOT</version>
</parent>
<artifactId>jython-tosca-parser</artifactId>
diff --git a/jython-tosca-parser/src/main/java/org/openecomp/sdc/toscaparser/api/EntityTemplate.java b/jython-tosca-parser/src/main/java/org/openecomp/sdc/toscaparser/api/EntityTemplate.java
index a6f9868..5a928e0 100644
--- a/jython-tosca-parser/src/main/java/org/openecomp/sdc/toscaparser/api/EntityTemplate.java
+++ b/jython-tosca-parser/src/main/java/org/openecomp/sdc/toscaparser/api/EntityTemplate.java
@@ -2,12 +2,15 @@ package org.openecomp.sdc.toscaparser.api;
import static com.google.common.collect.ImmutableList.toImmutableList;
+import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import org.openecomp.sdc.toscaparser.api.elements.StatefulEntityType;
+import org.openecomp.sdc.toscaparser.jython.JyCapability;
import org.openecomp.sdc.toscaparser.jython.JyEntityTemplate;
+import org.openecomp.sdc.toscaparser.jython.JyProperty;
import com.google.common.base.MoreObjects;
import com.google.common.base.MoreObjects.ToStringHelper;
@@ -36,17 +39,19 @@ public abstract class EntityTemplate {
}
public List<Property> getProperties() {
- return jyEntityTemplate.getJyProperties()
+ List<JyProperty> jyProperties = jyEntityTemplate.getJyProperties();
+ return jyProperties != null ? jyProperties
.stream()
.map(Property::new)
- .collect(toImmutableList());
+ .collect(toImmutableList()) : new ArrayList<>();
}
public List<Capability> getCapabilities() {
- return jyEntityTemplate.getJyCapabilities()
+ List<JyCapability> jyCapabilities = jyEntityTemplate.getJyCapabilities();
+ return jyCapabilities != null ? jyCapabilities
.stream()
.map(Capability::new)
- .collect(toImmutableList());
+ .collect(toImmutableList()) : new ArrayList<>();
}
public List<Map<String, Map<String, Object>>> getRequirements() {
diff --git a/jython-tosca-parser/src/main/java/org/openecomp/sdc/toscaparser/api/Group.java b/jython-tosca-parser/src/main/java/org/openecomp/sdc/toscaparser/api/Group.java
index 65f6857..0fa0d9c 100644
--- a/jython-tosca-parser/src/main/java/org/openecomp/sdc/toscaparser/api/Group.java
+++ b/jython-tosca-parser/src/main/java/org/openecomp/sdc/toscaparser/api/Group.java
@@ -1,10 +1,32 @@
package org.openecomp.sdc.toscaparser.api;
+import java.util.List;
+
import org.openecomp.sdc.toscaparser.jython.JyGroup;
+import com.google.common.base.MoreObjects.ToStringHelper;
+
public class Group extends EntityTemplate {
+ private final JyGroup jyGroup;
+
public Group(JyGroup jyGroup) {
super(jyGroup);
+ this.jyGroup = jyGroup;
+ }
+
+ public List<String> getMembers(){
+ return jyGroup.getJyMembers();
}
+
+ public Metadata getMetadata(){
+ return jyGroup.getJyMetadata() != null ? new Metadata(jyGroup.getJyMetadata()) : null;
+ }
+
+ @Override
+ protected ToStringHelper toStringHelper() {
+ return super.toStringHelper()
+ .add("members", getMembers())
+ .add("metadata", getMetadata());
+ }
}
diff --git a/jython-tosca-parser/src/main/java/org/openecomp/sdc/toscaparser/api/Metadata.java b/jython-tosca-parser/src/main/java/org/openecomp/sdc/toscaparser/api/Metadata.java
new file mode 100644
index 0000000..4fa3646
--- /dev/null
+++ b/jython-tosca-parser/src/main/java/org/openecomp/sdc/toscaparser/api/Metadata.java
@@ -0,0 +1,28 @@
+package org.openecomp.sdc.toscaparser.api;
+
+import java.util.Map;
+
+import com.google.common.base.MoreObjects;
+
+public class Metadata {
+
+ private final Map<String, Object> metadataMap;
+
+ public Metadata(Map<String, Object> metadataMap) {
+ this.metadataMap = metadataMap;
+ }
+
+ public String getValue(String key) {
+ return !isEmpty() ? String.valueOf(this.metadataMap.get(key)) : null;
+ }
+
+ private boolean isEmpty() {
+ return this.metadataMap == null || this.metadataMap.size() == 0;
+ }
+
+ @Override
+ public String toString() {
+ return MoreObjects.toStringHelper(this)
+ .add("metadataMap", metadataMap).toString();
+ }
+}
diff --git a/jython-tosca-parser/src/main/java/org/openecomp/sdc/toscaparser/api/NodeTemplate.java b/jython-tosca-parser/src/main/java/org/openecomp/sdc/toscaparser/api/NodeTemplate.java
index d8cac9e..3592a69 100644
--- a/jython-tosca-parser/src/main/java/org/openecomp/sdc/toscaparser/api/NodeTemplate.java
+++ b/jython-tosca-parser/src/main/java/org/openecomp/sdc/toscaparser/api/NodeTemplate.java
@@ -1,8 +1,7 @@
package org.openecomp.sdc.toscaparser.api;
-import java.util.Map;
-
import org.openecomp.sdc.toscaparser.jython.JyNodeTemplate;
+import org.openecomp.sdc.toscaparser.jython.JySubstitutionMappings;
import com.google.common.base.MoreObjects.ToStringHelper;
@@ -15,13 +14,19 @@ public class NodeTemplate extends EntityTemplate {
this.jyNodeTemplate = jyNodeTemplate;
}
- public Map<String, String> getMetadata() {
- return jyNodeTemplate.getJyMetadata();
+ public Metadata getMetadata() {
+ return jyNodeTemplate.getJyMetadata() != null ? new Metadata(jyNodeTemplate.getJyMetadata()) : null;
+ }
+
+ public SubstitutionMappings getSubstitutionMappings(){
+ JySubstitutionMappings jySubstitutionMappings = jyNodeTemplate.getJySubstitutionMappings();
+ return jySubstitutionMappings != null ? new SubstitutionMappings(jySubstitutionMappings) : null;
}
@Override
protected ToStringHelper toStringHelper() {
return super.toStringHelper()
- .add("metadata", getMetadata());
+ .add("metadata", getMetadata())
+ .add("substitutionMappings", getSubstitutionMappings());
}
}
diff --git a/jython-tosca-parser/src/main/java/org/openecomp/sdc/toscaparser/api/SubstitutionMappings.java b/jython-tosca-parser/src/main/java/org/openecomp/sdc/toscaparser/api/SubstitutionMappings.java
index 526a0e3..30de2a8 100644
--- a/jython-tosca-parser/src/main/java/org/openecomp/sdc/toscaparser/api/SubstitutionMappings.java
+++ b/jython-tosca-parser/src/main/java/org/openecomp/sdc/toscaparser/api/SubstitutionMappings.java
@@ -2,12 +2,15 @@ package org.openecomp.sdc.toscaparser.api;
import static com.google.common.collect.ImmutableList.toImmutableList;
+import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
import org.openecomp.sdc.toscaparser.api.elements.NodeType;
import org.openecomp.sdc.toscaparser.api.parameters.Input;
+import org.openecomp.sdc.toscaparser.jython.JyGroup;
import org.openecomp.sdc.toscaparser.jython.JySubstitutionMappings;
+import org.openecomp.sdc.toscaparser.jython.parameters.JyInput;
import com.google.common.base.MoreObjects;
@@ -25,12 +28,21 @@ public class SubstitutionMappings {
.map(NodeTemplate::new)
.collect(toImmutableList());
}
+
+ public List<Group> getGroups() {
+ List<JyGroup> jyGroups = jySubstitutionMappings.getJyGroups();
+ return jyGroups != null ? jyGroups
+ .stream()
+ .map(Group::new)
+ .collect(toImmutableList()) : new ArrayList<>();
+ }
public List<Input> getInputs() {
- return jySubstitutionMappings.getJyInputs()
+ List<JyInput> jyInputs = jySubstitutionMappings.getJyInputs();
+ return jyInputs != null ? jyInputs
.stream()
.map(Input::new)
- .collect(toImmutableList());
+ .collect(toImmutableList()) : new ArrayList<>();
}
public NodeType getNodeDefinition() {
diff --git a/jython-tosca-parser/src/main/java/org/openecomp/sdc/toscaparser/api/TopologyTemplate.java b/jython-tosca-parser/src/main/java/org/openecomp/sdc/toscaparser/api/TopologyTemplate.java
index 5c9db48..0d0dd10 100644
--- a/jython-tosca-parser/src/main/java/org/openecomp/sdc/toscaparser/api/TopologyTemplate.java
+++ b/jython-tosca-parser/src/main/java/org/openecomp/sdc/toscaparser/api/TopologyTemplate.java
@@ -2,13 +2,17 @@ package org.openecomp.sdc.toscaparser.api;
import static com.google.common.collect.ImmutableList.toImmutableList;
+import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import org.openecomp.sdc.toscaparser.api.parameters.Input;
+import org.openecomp.sdc.toscaparser.jython.JyGroup;
+import org.openecomp.sdc.toscaparser.jython.JyNodeTemplate;
import org.openecomp.sdc.toscaparser.jython.JySubstitutionMappings;
import org.openecomp.sdc.toscaparser.jython.JyTopologyTemplate;
+import org.openecomp.sdc.toscaparser.jython.parameters.JyInput;
import com.google.common.base.MoreObjects;
@@ -25,24 +29,27 @@ public class TopologyTemplate {
}
public List<NodeTemplate> getNodeTemplates() {
- return jyTopologyTemplate.getJyNodeTemplates()
+ List<JyNodeTemplate> jyNodeTemplates = jyTopologyTemplate.getJyNodeTemplates();
+ return jyNodeTemplates != null ? jyNodeTemplates
.stream()
.map(NodeTemplate::new)
- .collect(toImmutableList());
+ .collect(toImmutableList()) : new ArrayList<>();
}
public List<Input> getInputs() {
- return jyTopologyTemplate.getJyInputs()
+ List<JyInput> jyInputs = jyTopologyTemplate.getJyInputs();
+ return jyInputs != null ? jyInputs
.stream()
.map(Input::new)
- .collect(toImmutableList());
+ .collect(toImmutableList()) : new ArrayList<>();
}
public List<Group> getGroups() {
- return jyTopologyTemplate.getJyGroups()
+ List<JyGroup> jyGroups = jyTopologyTemplate.getJyGroups();
+ return jyGroups != null ? jyGroups
.stream()
.map(Group::new)
- .collect(toImmutableList());
+ .collect(toImmutableList()) : new ArrayList<>();
}
public SubstitutionMappings getSubstitutionMappings() {
@@ -50,7 +57,7 @@ public class TopologyTemplate {
return jySubstitutionMappings != null ? new SubstitutionMappings(jySubstitutionMappings) : null;
}
- public Map<String, String> getMetadata() {
+ public Metadata getMetadata() {
return jyTopologyTemplate.getJyMetadata();
}
diff --git a/jython-tosca-parser/src/main/java/org/openecomp/sdc/toscaparser/api/ToscaTemplate.java b/jython-tosca-parser/src/main/java/org/openecomp/sdc/toscaparser/api/ToscaTemplate.java
index abf1b53..0aaafff 100644
--- a/jython-tosca-parser/src/main/java/org/openecomp/sdc/toscaparser/api/ToscaTemplate.java
+++ b/jython-tosca-parser/src/main/java/org/openecomp/sdc/toscaparser/api/ToscaTemplate.java
@@ -23,6 +23,10 @@ public class ToscaTemplate {
public String getVersion() {
return jyToscaTemplate.getJyVersion();
}
+
+ public Metadata getMetadata() {
+ return jyToscaTemplate.getJyMetadata() != null ? new Metadata(jyToscaTemplate.getJyMetadata()) : null;
+ }
public String getDescription() {
return jyToscaTemplate.getJyDescription();
@@ -37,7 +41,7 @@ public class ToscaTemplate {
}
public List<TopologyTemplate> getNestedTopologyTemplates() {
- return jyToscaTemplate.getNestedTopologyTemplates()
+ return jyToscaTemplate.getJyNestedTopologyTemplates()
.stream()
.map(TopologyTemplate::new)
.collect(toImmutableList());
@@ -53,6 +57,7 @@ public class ToscaTemplate {
.add("version", getVersion())
.add("description", getDescription())
.add("topologyTemplate", topologyTemplate)
+ .add("nestedTopologyTemplates", getNestedTopologyTemplates())
.toString();
}
} \ No newline at end of file
diff --git a/jython-tosca-parser/src/main/java/org/openecomp/sdc/toscaparser/api/parameters/Input.java b/jython-tosca-parser/src/main/java/org/openecomp/sdc/toscaparser/api/parameters/Input.java
index 0b9ad7d..2339bb4 100644
--- a/jython-tosca-parser/src/main/java/org/openecomp/sdc/toscaparser/api/parameters/Input.java
+++ b/jython-tosca-parser/src/main/java/org/openecomp/sdc/toscaparser/api/parameters/Input.java
@@ -22,8 +22,6 @@ public class Input {
return jyInput.getJyType();
}
-
-
public boolean isRequired() {
return jyInput.isJyRequired();
}
@@ -31,6 +29,10 @@ public class Input {
public String getDescription() {
return jyInput.getJyDescription();
}
+
+ public Object getDefault() {
+ return jyInput.getJyDefault();
+ }
@Override
public String toString() {
@@ -39,6 +41,7 @@ public class Input {
.add("type", getType())
.add("required", isRequired())
.add("description", getDescription())
+ .add("default", getDefault())
.toString();
}
}
diff --git a/jython-tosca-parser/src/main/java/org/openecomp/sdc/toscaparser/jython/JyGroup.java b/jython-tosca-parser/src/main/java/org/openecomp/sdc/toscaparser/jython/JyGroup.java
index c155dc6..e12a31e 100644
--- a/jython-tosca-parser/src/main/java/org/openecomp/sdc/toscaparser/jython/JyGroup.java
+++ b/jython-tosca-parser/src/main/java/org/openecomp/sdc/toscaparser/jython/JyGroup.java
@@ -1,5 +1,10 @@
package org.openecomp.sdc.toscaparser.jython;
-public interface JyGroup extends JyEntityTemplate {
+import java.util.List;
+import java.util.Map;
+public interface JyGroup extends JyEntityTemplate {
+
+ List<String> getJyMembers();
+ Map<String, Object> getJyMetadata();
}
diff --git a/jython-tosca-parser/src/main/java/org/openecomp/sdc/toscaparser/jython/JyNodeTemplate.java b/jython-tosca-parser/src/main/java/org/openecomp/sdc/toscaparser/jython/JyNodeTemplate.java
index a837137..620cc1c 100644
--- a/jython-tosca-parser/src/main/java/org/openecomp/sdc/toscaparser/jython/JyNodeTemplate.java
+++ b/jython-tosca-parser/src/main/java/org/openecomp/sdc/toscaparser/jython/JyNodeTemplate.java
@@ -4,5 +4,6 @@ import java.util.Map;
public interface JyNodeTemplate extends JyEntityTemplate {
- Map<String, String> getJyMetadata();
+ Map<String, Object> getJyMetadata();
+ JySubstitutionMappings getJySubstitutionMappings();
}
diff --git a/jython-tosca-parser/src/main/java/org/openecomp/sdc/toscaparser/jython/JySubstitutionMappings.java b/jython-tosca-parser/src/main/java/org/openecomp/sdc/toscaparser/jython/JySubstitutionMappings.java
index bd95cdc..1130e8c 100644
--- a/jython-tosca-parser/src/main/java/org/openecomp/sdc/toscaparser/jython/JySubstitutionMappings.java
+++ b/jython-tosca-parser/src/main/java/org/openecomp/sdc/toscaparser/jython/JySubstitutionMappings.java
@@ -9,5 +9,6 @@ public interface JySubstitutionMappings {
List<JyNodeTemplate> getJyNodeTemplates();
List<JyInput> getJyInputs();
+ List<JyGroup> getJyGroups();
JyNodeType getJyNodeDefinition();
}
diff --git a/jython-tosca-parser/src/main/java/org/openecomp/sdc/toscaparser/jython/JyTopologyTemplate.java b/jython-tosca-parser/src/main/java/org/openecomp/sdc/toscaparser/jython/JyTopologyTemplate.java
index 9cdc38b..d16ef5c 100644
--- a/jython-tosca-parser/src/main/java/org/openecomp/sdc/toscaparser/jython/JyTopologyTemplate.java
+++ b/jython-tosca-parser/src/main/java/org/openecomp/sdc/toscaparser/jython/JyTopologyTemplate.java
@@ -1,8 +1,8 @@
package org.openecomp.sdc.toscaparser.jython;
import java.util.List;
-import java.util.Map;
+import org.openecomp.sdc.toscaparser.api.Metadata;
import org.openecomp.sdc.toscaparser.jython.parameters.JyInput;
public interface JyTopologyTemplate {
@@ -12,5 +12,5 @@ public interface JyTopologyTemplate {
List<JyInput> getJyInputs();
List<JyGroup> getJyGroups();
JySubstitutionMappings getJySubstitutionMappings();
- Map<String, String> getJyMetadata();
+ Metadata getJyMetadata();
}
diff --git a/jython-tosca-parser/src/main/java/org/openecomp/sdc/toscaparser/jython/JyToscaTemplate.java b/jython-tosca-parser/src/main/java/org/openecomp/sdc/toscaparser/jython/JyToscaTemplate.java
index 7cba568..a2180c7 100644
--- a/jython-tosca-parser/src/main/java/org/openecomp/sdc/toscaparser/jython/JyToscaTemplate.java
+++ b/jython-tosca-parser/src/main/java/org/openecomp/sdc/toscaparser/jython/JyToscaTemplate.java
@@ -1,12 +1,14 @@
package org.openecomp.sdc.toscaparser.jython;
import java.util.List;
+import java.util.Map;
public interface JyToscaTemplate {
String getJyVersion();
String getJyDescription();
List<JyNodeTemplate> getJyNodeTemplates();
- List<JyTopologyTemplate> getNestedTopologyTemplates();
+ List<JyTopologyTemplate> getJyNestedTopologyTemplates();
JyTopologyTemplate getJyTopologyTemplate();
+ Map<String, Object> getJyMetadata();
}
diff --git a/jython-tosca-parser/src/main/java/org/openecomp/sdc/toscaparser/jython/parameters/JyInput.java b/jython-tosca-parser/src/main/java/org/openecomp/sdc/toscaparser/jython/parameters/JyInput.java
index 253805b..c1614ce 100644
--- a/jython-tosca-parser/src/main/java/org/openecomp/sdc/toscaparser/jython/parameters/JyInput.java
+++ b/jython-tosca-parser/src/main/java/org/openecomp/sdc/toscaparser/jython/parameters/JyInput.java
@@ -4,7 +4,7 @@ public interface JyInput {
String getJyName();
String getJyType();
- String getJyDefault();
+ Object getJyDefault();
boolean isJyRequired();
String getJyDescription();
}
diff --git a/jython-tosca-parser/src/main/resources/Lib/site-packages/tosca_parser-0.7.0-py2.7.egg/toscaparser/groups.py b/jython-tosca-parser/src/main/resources/Lib/site-packages/tosca_parser-0.7.0-py2.7.egg/toscaparser/groups.py
index f1da5b0..cb9c20d 100644
--- a/jython-tosca-parser/src/main/resources/Lib/site-packages/tosca_parser-0.7.0-py2.7.egg/toscaparser/groups.py
+++ b/jython-tosca-parser/src/main/resources/Lib/site-packages/tosca_parser-0.7.0-py2.7.egg/toscaparser/groups.py
@@ -37,6 +37,12 @@ class Group(EntityTemplate, JyGroup):
self.member_nodes = member_nodes
self._validate_keys()
+ def getJyMembers(self):
+ return self.members
+
+ def getJyMetadata(self):
+ return self.meta_data
+
@property
def members(self):
return self.entity_tpl.get('members')
diff --git a/jython-tosca-parser/src/main/resources/Lib/site-packages/tosca_parser-0.7.0-py2.7.egg/toscaparser/nodetemplate.py b/jython-tosca-parser/src/main/resources/Lib/site-packages/tosca_parser-0.7.0-py2.7.egg/toscaparser/nodetemplate.py
index ee7622c..fadc8d0 100644
--- a/jython-tosca-parser/src/main/resources/Lib/site-packages/tosca_parser-0.7.0-py2.7.egg/toscaparser/nodetemplate.py
+++ b/jython-tosca-parser/src/main/resources/Lib/site-packages/tosca_parser-0.7.0-py2.7.egg/toscaparser/nodetemplate.py
@@ -61,6 +61,10 @@ class NodeTemplate(EntityTemplate, JyNodeTemplate):
def getJyMetadata(self):
return self.meta_data
+ def getJySubstitutionMappings(self):
+ return self.sub_mapping_tosca_template
+
+
@property
def relationships(self):
if not self._relationships:
diff --git a/jython-tosca-parser/src/main/resources/Lib/site-packages/tosca_parser-0.7.0-py2.7.egg/toscaparser/parameters.py b/jython-tosca-parser/src/main/resources/Lib/site-packages/tosca_parser-0.7.0-py2.7.egg/toscaparser/parameters.py
index 1bb58be..765ccb7 100644
--- a/jython-tosca-parser/src/main/resources/Lib/site-packages/tosca_parser-0.7.0-py2.7.egg/toscaparser/parameters.py
+++ b/jython-tosca-parser/src/main/resources/Lib/site-packages/tosca_parser-0.7.0-py2.7.egg/toscaparser/parameters.py
@@ -44,7 +44,7 @@ class Input(JyInput):
return self.name
def getJyType(self):
- return self.name
+ return self.type
def isJyRequired(self):
return self.required
@@ -93,7 +93,8 @@ class Input(JyInput):
def validate_type(self, input_type):
if input_type not in Schema.PROPERTY_TYPES:
ExceptionCollector.appendException(
- ValueError(_('Invalid type "%s".') % type))
+ #ValueError(_('Invalid type "%s".') % type))
+ ValueError(_('Invalid type "%s".') % input_type))
# TODO(anyone) Need to test for any built-in datatype not just network
# that is, tosca.datatypes.* and not assume tosca.datatypes.network.*
diff --git a/jython-tosca-parser/src/main/resources/Lib/site-packages/tosca_parser-0.7.0-py2.7.egg/toscaparser/substitution_mappings.py b/jython-tosca-parser/src/main/resources/Lib/site-packages/tosca_parser-0.7.0-py2.7.egg/toscaparser/substitution_mappings.py
index 859b7a4..9a14f6f 100644
--- a/jython-tosca-parser/src/main/resources/Lib/site-packages/tosca_parser-0.7.0-py2.7.egg/toscaparser/substitution_mappings.py
+++ b/jython-tosca-parser/src/main/resources/Lib/site-packages/tosca_parser-0.7.0-py2.7.egg/toscaparser/substitution_mappings.py
@@ -38,12 +38,13 @@ class SubstitutionMappings(JySubstitutionMappings):
OPTIONAL_OUTPUTS = ['tosca_id', 'tosca_name', 'state']
- def __init__(self, sub_mapping_def, nodetemplates, inputs, outputs,
+ def __init__(self, sub_mapping_def, nodetemplates, inputs, outputs, groups, #ATT
sub_mapped_node_template, custom_defs):
self.nodetemplates = nodetemplates
self.sub_mapping_def = sub_mapping_def
self.inputs = inputs or []
self.outputs = outputs or []
+ self.groups = groups or [] #ATT
self.sub_mapped_node_template = sub_mapped_node_template
self.custom_defs = custom_defs or {}
self._validate()
@@ -57,6 +58,9 @@ class SubstitutionMappings(JySubstitutionMappings):
def getJyInputs(self):
return self.inputs
+ def getJyGroups(self): #ATT
+ return self.groups
+
def getJyNodeDefinition(self):
return self.node_definition
diff --git a/jython-tosca-parser/src/main/resources/Lib/site-packages/tosca_parser-0.7.0-py2.7.egg/toscaparser/topology_template.py b/jython-tosca-parser/src/main/resources/Lib/site-packages/tosca_parser-0.7.0-py2.7.egg/toscaparser/topology_template.py
index c56e7b9..a64c561 100644
--- a/jython-tosca-parser/src/main/resources/Lib/site-packages/tosca_parser-0.7.0-py2.7.egg/toscaparser/topology_template.py
+++ b/jython-tosca-parser/src/main/resources/Lib/site-packages/tosca_parser-0.7.0-py2.7.egg/toscaparser/topology_template.py
@@ -146,6 +146,7 @@ class TopologyTemplate(JyTopologyTemplate):
self.nodetemplates,
self.inputs,
self.outputs,
+ self.groups, #ATT
self.sub_mapped_node_template,
self.custom_defs)
diff --git a/jython-tosca-parser/src/main/resources/Lib/site-packages/tosca_parser-0.7.0-py2.7.egg/toscaparser/tosca_template.py b/jython-tosca-parser/src/main/resources/Lib/site-packages/tosca_parser-0.7.0-py2.7.egg/toscaparser/tosca_template.py
index 6b3ea87..c2c3f36 100644
--- a/jython-tosca-parser/src/main/resources/Lib/site-packages/tosca_parser-0.7.0-py2.7.egg/toscaparser/tosca_template.py
+++ b/jython-tosca-parser/src/main/resources/Lib/site-packages/tosca_parser-0.7.0-py2.7.egg/toscaparser/tosca_template.py
@@ -13,6 +13,7 @@
import logging
import os
+#import shutil
from copy import deepcopy
from toscaparser.common.exception import ExceptionCollector
@@ -73,6 +74,7 @@ class ToscaTemplate(JyToscaTemplate):
self.input_path = None
self.path = None
self.tpl = None
+ self.csar_tempdir = None
self.nested_tosca_tpls_with_topology = {}
self.nested_tosca_templates_with_topology = []
if path:
@@ -97,6 +99,7 @@ class ToscaTemplate(JyToscaTemplate):
self.parsed_params = parsed_params
self._validate_field()
self.version = self._tpl_version()
+ self.metadata = self._tpl_metadata()
self.relationship_types = self._tpl_relationship_types()
self.description = self._tpl_description()
self.topology_template = self._topology_template()
@@ -109,12 +112,19 @@ class ToscaTemplate(JyToscaTemplate):
self._handle_nested_tosca_templates_with_topology()
self.graph = ToscaGraph(self.nodetemplates)
+ if self.csar_tempdir:
+ #shutil.rmtree(self.csar_tempdir)
+ csar_tempdir = None
+
ExceptionCollector.stop()
self.verify_template()
def getJyVersion(self):
return self.version
+ def getJyMetadata(self):
+ return self.metadata
+
def getJyDescription(self):
return self.description
@@ -146,6 +156,9 @@ class ToscaTemplate(JyToscaTemplate):
def _tpl_version(self):
return self.tpl.get(DEFINITION_VERSION)
+ def _tpl_metadata(self):
+ return self.tpl.get(METADATA)
+
def _tpl_description(self):
desc = self.tpl.get(DESCRIPTION)
if desc:
@@ -290,6 +303,7 @@ class ToscaTemplate(JyToscaTemplate):
if csar.validate():
csar.decompress()
self.a_file = True # the file has been decompressed locally
+ self.csar_tempdir = csar.temp_dir
return os.path.join(csar.temp_dir, csar.get_main_template())
else:
ExceptionCollector.appendException(
diff --git a/pom.xml b/pom.xml
index 7c348e9..04634b6 100644
--- a/pom.xml
+++ b/pom.xml
@@ -4,7 +4,7 @@
<groupId>org.openecomp.sdc.sdc-distribution-client</groupId>
<artifactId>sdc-main-distribution-client</artifactId>
- <version>1.1.0-SNAPSHOT</version>
+ <version>1.1.6-SNAPSHOT</version>
<packaging>pom</packaging>
<modules>
diff --git a/sdc-distribution-ci/pom.xml b/sdc-distribution-ci/pom.xml
index 93cd214..a570d62 100644
--- a/sdc-distribution-ci/pom.xml
+++ b/sdc-distribution-ci/pom.xml
@@ -6,7 +6,7 @@
<parent>
<groupId>org.openecomp.sdc.sdc-distribution-client</groupId>
<artifactId>sdc-main-distribution-client</artifactId>
- <version>1.1.0-SNAPSHOT</version>
+ <version>1.1.6-SNAPSHOT</version>
</parent>
<artifactId>sdc-distribution-ci</artifactId>
diff --git a/sdc-distribution-ci/src/main/java/org/openecomp/test/ClientTest.java b/sdc-distribution-ci/src/main/java/org/openecomp/test/ClientTest.java
index d944bf0..e44013c 100644
--- a/sdc-distribution-ci/src/main/java/org/openecomp/test/ClientTest.java
+++ b/sdc-distribution-ci/src/main/java/org/openecomp/test/ClientTest.java
@@ -33,15 +33,7 @@ import ch.qos.logback.classic.LoggerContext;
public class ClientTest {
public static void main(String[] args) throws Exception {
- try (SdcToscaParserFactory toscaParserFactory = SdcToscaParserFactory.getInstance()){
- //ISdcCsarHelper csarHelper = toscaParserFactory.getSdcCsarHelper("C:\\Users\\pa0916\\Desktop\\Work\\ASDC\\CSARs\\service-ServiceFdnt-csar-nt-metadata.csar");
- ISdcCsarHelper csarHelper = toscaParserFactory.getSdcCsarHelper("C:\\Users\\pa0916\\Desktop\\Work\\ASDC\\CSARs\\service-ServiceFdnt-csar-nt-props.csar");
- //ISdcCsarHelper csarHelper = toscaParserFactory.getSdcCsarHelper("C:\\Users\\pa0916\\Desktop\\Work\\ASDC\\CSARs\\service-ServiceFdnt-csar.csar");
- String serviceSubstitutionMappingsTypeName = csarHelper.getServiceSubstitutionMappingsTypeName();
- System.out.println("serviceSubstitutionMappingsTypeName is "+serviceSubstitutionMappingsTypeName);
- String nodeTemplatePropertyLeafValue = csarHelper.getNodeTemplatePropertyLeafValue(csarHelper.getServiceVfList().get(0), "nf_role#nf_naming#ecomp_generated_naming");
- System.out.println("property is "+nodeTemplatePropertyLeafValue);
- }
+
LoggerContext lc = (LoggerContext) LoggerFactory.getILoggerFactory();
lc.getLogger("org.apache.http").setLevel(Level.INFO);
diff --git a/sdc-distribution-client/pom.xml b/sdc-distribution-client/pom.xml
index ec93149..9ec6d02 100644
--- a/sdc-distribution-client/pom.xml
+++ b/sdc-distribution-client/pom.xml
@@ -6,7 +6,7 @@
<parent>
<groupId>org.openecomp.sdc.sdc-distribution-client</groupId>
<artifactId>sdc-main-distribution-client</artifactId>
- <version>1.1.0-SNAPSHOT</version>
+ <version>1.1.6-SNAPSHOT</version>
</parent>
<artifactId>sdc-distribution-client</artifactId>
diff --git a/sdc-tosca-parser/pom.xml b/sdc-tosca-parser/pom.xml
index cd6e49e..3bc6a80 100644
--- a/sdc-tosca-parser/pom.xml
+++ b/sdc-tosca-parser/pom.xml
@@ -6,7 +6,7 @@
<parent>
<groupId>org.openecomp.sdc.sdc-distribution-client</groupId>
<artifactId>sdc-main-distribution-client</artifactId>
- <version>1.1.0-SNAPSHOT</version>
+ <version>1.1.6-SNAPSHOT</version>
</parent>
<artifactId>sdc-tosca-parser</artifactId>
diff --git a/sdc-tosca-parser/src/main/java/org/openecomp/sdc/tosca/parser/api/ISdcCsarHelper.java b/sdc-tosca-parser/src/main/java/org/openecomp/sdc/tosca/parser/api/ISdcCsarHelper.java
index 26995c4..88e22a0 100644
--- a/sdc-tosca-parser/src/main/java/org/openecomp/sdc/tosca/parser/api/ISdcCsarHelper.java
+++ b/sdc-tosca-parser/src/main/java/org/openecomp/sdc/tosca/parser/api/ISdcCsarHelper.java
@@ -20,11 +20,12 @@ package org.openecomp.sdc.tosca.parser.api;
import java.util.List;
-import java.util.Map;
import org.apache.commons.lang3.tuple.Pair;
import org.openecomp.sdc.toscaparser.api.Group;
+import org.openecomp.sdc.toscaparser.api.Metadata;
import org.openecomp.sdc.toscaparser.api.NodeTemplate;
+import org.openecomp.sdc.toscaparser.api.parameters.Input;
public interface ISdcCsarHelper {
@@ -120,17 +121,18 @@ public interface ISdcCsarHelper {
* @param metadata - metadata object.
* @param metadataPropertyName - the name of the metadata property.
* @return metadata property value
- *//*
- //public String getMetadataPropertyValue(Metadata metadata, String metadataPropertyName);
- */
+ */
+ public String getMetadataPropertyValue(Metadata metadata, String metadataPropertyName);
+
/**
* Get input leaf value for the CSAR service, by full path separated by #.<br>
* Same logic as in {@link #getNodeTemplatePropertyLeafValue(NodeTemplate, String) getNodeTemplatePropertyLeafValue}, only for an input full path.
+ * The expected format is "input_name#default[optionally #rest_of_path]"
* @param inputLeafValuePath by full path separated by #.
* @return input leaf value for the service.
*/
- public String getServiceInputLeafValue(String inputLeafValuePath);
+ public String getServiceInputLeafValueOfDefault(String inputLeafValuePath);
/**
* Get the type name of the CSAR service's substitution mappings element.<br>
@@ -151,7 +153,7 @@ public interface ISdcCsarHelper {
* Get the CSAR service metadata
* @return - the service metadata object.
*/
- public Map<String, String> getServiceMetadata();
+ public Metadata getServiceMetadata();
/**
* Get all VFC node templates from a specified VF.
@@ -178,13 +180,14 @@ public interface ISdcCsarHelper {
&nbsp;&nbsp;members: [vIPR_ATM_Ha_Two, vIPR_ATM_Ha_One, vIPR_ATM_OAM_SG, vIPR_ATM_HA_TWO_SG, vIPR_ATM_HA_ONE_SG]<br><br>
calling<br>
- getMembersOfGroup(group)<br>
- will return List of the following Strings: "vIPR_ATM_Ha_Two, vIPR_ATM_Ha_One, vIPR_ATM_OAM_SG, vIPR_ATM_HA_TWO_SG, vIPR_ATM_HA_ONE_SG"<br>
- * @param group - group to return the members.
- * @return names of all group members.
+ getMembersOfVfModule(NoteTemplate vfNodeTemplate, Group group)<br>
+ will return List of the following Node templates in the vfNodeTemplate: "vIPR_ATM_Ha_Two, vIPR_ATM_Ha_One, vIPR_ATM_OAM_SG, vIPR_ATM_HA_TWO_SG, vIPR_ATM_HA_ONE_SG"<br>
+ * @param vf - VF to return the node templates from.
+ * @param vfModule - group to return the members from.
+ * @return node templates from vf with the names as in members section.
*
*/
- public List<String> getMembersOfGroup(Group group);
+ public List<NodeTemplate> getMembersOfVfModule(NodeTemplate vf, Group vfModule);
/**
@@ -238,4 +241,10 @@ public interface ISdcCsarHelper {
*/
public String getTypeOfNodeTemplate(NodeTemplate nodeTemplate);
+ /**
+ * Get the CSAR service inputs list.
+ * @return - the service inputs list.
+ */
+ public List<Input> getServiceInputs();
+
}
diff --git a/sdc-tosca-parser/src/main/java/org/openecomp/sdc/tosca/parser/impl/SdcCsarHelperImpl.java b/sdc-tosca-parser/src/main/java/org/openecomp/sdc/tosca/parser/impl/SdcCsarHelperImpl.java
index d5caa5d..612bc04 100644
--- a/sdc-tosca-parser/src/main/java/org/openecomp/sdc/tosca/parser/impl/SdcCsarHelperImpl.java
+++ b/sdc-tosca-parser/src/main/java/org/openecomp/sdc/tosca/parser/impl/SdcCsarHelperImpl.java
@@ -20,27 +20,27 @@
package org.openecomp.sdc.tosca.parser.impl;
+import org.apache.commons.lang3.tuple.ImmutablePair;
+import org.apache.commons.lang3.tuple.Pair;
+import org.openecomp.sdc.tosca.parser.api.ISdcCsarHelper;
+import org.openecomp.sdc.tosca.parser.utils.GeneralUtility;
+import org.openecomp.sdc.toscaparser.api.*;
+import org.openecomp.sdc.toscaparser.api.elements.NodeType;
+import org.openecomp.sdc.toscaparser.api.parameters.Input;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.yaml.snakeyaml.Yaml;
+
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Optional;
-import java.util.stream.Collector;
import java.util.stream.Collectors;
-import org.apache.commons.lang3.tuple.Pair;
-import org.openecomp.sdc.tosca.parser.api.ISdcCsarHelper;
-import org.openecomp.sdc.toscaparser.api.Group;
-import org.openecomp.sdc.toscaparser.api.NodeTemplate;
-import org.openecomp.sdc.toscaparser.api.Property;
-import org.openecomp.sdc.toscaparser.api.TopologyTemplate;
-import org.openecomp.sdc.toscaparser.api.ToscaTemplate;
-import org.yaml.snakeyaml.Yaml;
-
public class SdcCsarHelperImpl implements ISdcCsarHelper {
private ToscaTemplate toscaTemplate;
- private static Yaml defaultYaml = new Yaml();
-
+ private static Logger log = LoggerFactory.getLogger(SdcCsarHelperImpl.class.getName());
public SdcCsarHelperImpl(ToscaTemplate toscaTemplate) {
this.toscaTemplate = toscaTemplate;
@@ -49,38 +49,62 @@ public class SdcCsarHelperImpl implements ISdcCsarHelper {
@Override
//Sunny flow - covered with UT, flat and nested
public String getNodeTemplatePropertyLeafValue(NodeTemplate nodeTemplate, String leafValuePath) {
+ if (nodeTemplate == null) {
+ log.error("getNodeTemplatePropertyLeafValue - nodeTemplate is null");
+ return null;
+ }
+ if (GeneralUtility.isEmptyString(leafValuePath)) {
+ log.error("getNodeTemplatePropertyLeafValue - leafValuePath is null or empty");
+ return null;
+ }
+ log.trace("getNodeTemplatePropertyLeafValue - nodeTemplate is : {}, leafValuePath is {} ", nodeTemplate.toString(), leafValuePath);
String[] split = leafValuePath.split("#");
List<Property> properties = nodeTemplate.getProperties();
- Optional<Property> findFirst = properties.stream().filter(x -> x.getName().equals(split[0])).findFirst();
- if (findFirst.isPresent()){
- Property property = findFirst.get();
- Object current = property.getValue();
- if (split.length > 1){
- current = defaultYaml.load((String)current);
- for (int i = 1; i < split.length; i++) {
- current = ((Map<String, Object>)current).get(split[i]);
- }
- }
- return String.valueOf(current);
- }
- return null;
+ log.trace("getNodeTemplatePropertyLeafValue - properties of nodeTemplate are : {}", properties.toString());
+ return processProperties(split, properties);
}
@Override
+ //Sunny flow - covered with UT
public List<NodeTemplate> getServiceVlList() {
- return getNodeTemplateBySdcType(toscaTemplate.getTopologyTemplate(), Types.TYPE_VL);
-
+ List<NodeTemplate> serviceVlList = getNodeTemplateBySdcType(toscaTemplate.getTopologyTemplate(), Types.TYPE_VL);
+ log.trace("getServiceVlList - the VL list is {}", serviceVlList);
+ return serviceVlList;
}
@Override
//Sunny flow - covered with UT
public List<NodeTemplate> getServiceVfList() {
- return getNodeTemplateBySdcType(toscaTemplate.getTopologyTemplate(), Types.TYPE_VF);
+ List<NodeTemplate> serviceVfList = getNodeTemplateBySdcType(toscaTemplate.getTopologyTemplate(), Types.TYPE_VF);
+ log.trace("getServiceVfList - the VF list is {}", serviceVfList);
+ return serviceVfList;
+ }
+
+ @Override
+ //Sunny flow - covered with UT
+ public String getMetadataPropertyValue(Metadata metadata, String metadataPropertyName) {
+ if (GeneralUtility.isEmptyString(metadataPropertyName)) {
+ log.error("getMetadataPropertyValue - the metadataPropertyName is null or empty");
+ return null;
+ }
+ if (metadata == null) {
+ log.error("getMetadataPropertyValue - the metadata is null");
+ return null;
+ }
+ String metadataPropertyValue = metadata.getValue(metadataPropertyName);
+ log.trace("getMetadataPropertyValue - metadata is {} metadataPropertyName is {} the value is : {}", metadata.toString(), metadataPropertyName , metadataPropertyValue);
+ return metadataPropertyValue;
}
+
@Override
//Sunny flow - covered with UT
public List<NodeTemplate> getServiceNodeTemplatesByType(String nodeType) {
+ if (GeneralUtility.isEmptyString(nodeType)) {
+ log.error("getServiceNodeTemplatesByType - nodeType - is null or empty");
+ return new ArrayList<>();
+ }
+
List<NodeTemplate> res = new ArrayList<>();
List<NodeTemplate> nodeTemplates = toscaTemplate.getNodeTemplates();
for (NodeTemplate nodeTemplate : nodeTemplates){
@@ -88,132 +112,336 @@ public class SdcCsarHelperImpl implements ISdcCsarHelper {
res.add(nodeTemplate);
}
}
+
+ log.trace("getServiceNodeTemplatesByType - NodeTemplate list value is: {}", res);
return res;
}
@Override
+ //Sunny flow - covered with UT
public List<NodeTemplate> getVfcListByVf(String vfCustomizationId) {
+ if (GeneralUtility.isEmptyString(vfCustomizationId)) {
+ log.error("getVfcListByVf - vfCustomizationId - is null or empty");
+ return new ArrayList<>();
+ }
+
List<NodeTemplate> serviceVfList = getServiceVfList();
NodeTemplate vfInstance = getNodeTemplateByCustomizationUuid(serviceVfList, vfCustomizationId);
+ log.trace("getVfcListByVf - serviceVfList value: {}, vfInstance value: {}", serviceVfList, vfInstance);
return getNodeTemplateBySdcType(vfInstance, Types.TYPE_VFC);
}
- //Assumed to be unique property for the list
- private NodeTemplate getNodeTemplateByCustomizationUuid(List<NodeTemplate> nodeTemplates, String customizationId){
- for (NodeTemplate nodeTemplate : nodeTemplates){
- if (customizationId.equals(nodeTemplate.getMetadata().get(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID))){
- return nodeTemplate;
- }
- }
- return null;
- }
-
@Override
+ //Sunny flow - covered with UT
public List<Group> getVfModulesByVf(String vfCustomizationUuid) {
List<NodeTemplate> serviceVfList = getServiceVfList();
- List<Group> res = new ArrayList<>();
NodeTemplate nodeTemplateByCustomizationUuid = getNodeTemplateByCustomizationUuid(serviceVfList, vfCustomizationUuid);
- //Asked Yaniv about getGroups from NodeTemplate
- /*
- List<Group> groups = nodeTemplateByCustomizationUuid.;
- for (Group group : groups){
- if (Types.TYPE_VFMODULE.equals(group.getType())){
- res.add(group);
+ if (nodeTemplateByCustomizationUuid != null){
+ SubstitutionMappings substitutionMappings = nodeTemplateByCustomizationUuid.getSubstitutionMappings();
+ if (substitutionMappings != null){
+ List<Group> groups = substitutionMappings.getGroups();
+ if (groups != null){
+ return groups.stream().filter(x -> "org.openecomp.groups.VfModule".equals(x.getTypeDefinition().getType())).collect(Collectors.toList());
+ }
}
- }*/
- return res;
+ }
+ return new ArrayList<>();
}
@Override
- public String getServiceInputLeafValue(String inputLeafValuePath) {
- //toscaTemplate.getTopologyTemplate().getNodeTemplates().get(0).getProperties().get(0).
- return null;//getLeafPropertyValue(toscaTemplate, inputLeafValuePath);
+ //Sunny flow - covered with UT
+ public String getServiceInputLeafValueOfDefault(String inputLeafValuePath) {
+ if (GeneralUtility.isEmptyString(inputLeafValuePath)) {
+ log.error("getServiceInputLeafValueOfDefault - inputLeafValuePath is null or empty");
+ return null;
+ }
+
+ String[] split = inputLeafValuePath.split("#");
+ if (split.length < 2 || !split[1].equals("default")){
+ log.error("getServiceInputLeafValue - inputLeafValuePath should be of format <input name>#default[optionally #<rest of path>] ");
+ return null;
+ }
+
+ List<Input> inputs = toscaTemplate.getInputs();
+ log.trace("getServiceInputLeafValue - the leafValuePath is {} , the inputs are {}", inputLeafValuePath, inputs);
+ if (inputs != null){
+ Optional<Input> findFirst = inputs.stream().filter(x -> x.getName().equals(split[0])).findFirst();
+ if (findFirst.isPresent()){
+ log.trace("getServiceInputLeafValue - find first item is {}", findFirst.get().toString());
+ Input input = findFirst.get();
+ Object current = input.getDefault();
+ if (current == null){
+ log.error("getServiceInputLeafValue - this input has no default");
+ return null;
+ }
+ if (split.length > 2){
+ current = new Yaml().load((String)current);
+ for (int i = 2; i < split.length; i++) {
+ if (current instanceof Map){
+ current = ((Map<String, Object>)current).get(split[i]);
+ } else {
+ log.error("getServiceInputLeafValue - found an unexpected leaf where expected to find a complex type");
+ return null;
+ }
+ }
+ }
+ if (current != null){
+ log.trace("getServiceInputLeafValue - the input default leaf value is {}", String.valueOf(current));
+ return String.valueOf(current);
+ }
+ }
+ }
+ log.error("getServiceInputLeafValue - value not found");
+ return null;
}
+
@Override
+ //Sunny flow - covered with UT
public String getServiceSubstitutionMappingsTypeName() {
- return toscaTemplate.getTopologyTemplate().getSubstitutionMappings().getNodeDefinition().getType();
- }
+ SubstitutionMappings substitutionMappings = toscaTemplate.getTopologyTemplate().getSubstitutionMappings();
+ if (substitutionMappings == null) {
+ log.trace("getServiceSubstitutionMappingsTypeName - No Substitution Mappings defined");
+ return null;
+ }
+ log.trace("getServiceSubstitutionMappingsTypeName - SubstitutionMappings value: {}", substitutionMappings);
- @Override
- public Map<String, String> getServiceMetadata() {
- TopologyTemplate topologyTemplate = toscaTemplate.getTopologyTemplate();
- System.out.println(topologyTemplate.toString());
- return topologyTemplate.getMetadata();
+ NodeType nodeType = substitutionMappings.getNodeDefinition();
+ if (nodeType == null) {
+ log.trace("getServiceSubstitutionMappingsTypeName - No Substitution Mappings node defined");
+ return null;
+ }
+ log.trace("getServiceSubstitutionMappingsTypeName - nodeType value: {}", nodeType);
+
+ return nodeType.getType();
}
- //Get property from group
@Override
- public String getGroupPropertyLeafValue(Group group, String propertyName) {
- return null;//getLeafPropertyValue(group, propertyName);
+ //Sunny flow - covered with UT
+ public Metadata getServiceMetadata() {
+ return toscaTemplate.getMetadata();
}
- private List<NodeTemplate> getNodeTemplateBySdcType(NodeTemplate nodeTemplate, String sdcType){
- //Need metadata to fetch by type
-
- /*List<NodeTemplate> nodeTemplates = nodeTemplate.getNestedNodeTemplates();
- List<NodeTemplate> res = new ArrayList<>();
- for (NodeTemplate nodeTemplateEntry : nodeTemplates){
- if (nodeTemplateEntry.getMetadata().getMetadataPropertyValue(SdcPropertyNames.PROPERTY_NAME_TYPE).equals(sdcType)){
- res.add(nodeTemplateEntry);
- }
- }*/
- return null;
+ @Override
+ //Sunny flow - covered with UT
+ public List<Input> getServiceInputs() {
+ return toscaTemplate.getInputs();
}
- private List<NodeTemplate> getNodeTemplateBySdcType(TopologyTemplate topologyTemplate, String sdcType){
- //Need metadata to fetch by type
+ @Override
+ //Sunny flow - covered with UT
+ public String getGroupPropertyLeafValue(Group group, String leafValuePath) {
+ if (group == null) {
+ log.error("getGroupPropertyLeafValue - group is null");
+ return null;
+ }
- List<NodeTemplate> nodeTemplates = topologyTemplate.getNodeTemplates();
- List<NodeTemplate> res = new ArrayList<>();
- for (NodeTemplate nodeTemplateEntry : nodeTemplates){
- //TODO switch back to type condition
- if (nodeTemplateEntry.getTypeDefinition().getType().contains("."+sdcType.toLowerCase()+".")){
- //if (sdcType.equals(nodeTemplateEntry.getMetadata().get(SdcPropertyNames.PROPERTY_NAME_TYPE))){
- res.add(nodeTemplateEntry);
- }
+ if (GeneralUtility.isEmptyString(leafValuePath)) {
+ log.error("getGroupPropertyLeafValue - leafValuePath is null or empty");
+ return null;
}
- return res;
+
+ String[] split = leafValuePath.split("#");
+ List<Property> properties = group.getProperties();
+ return processProperties(split, properties);
}
@Override
+ //Sunny flow - covered with UT
public List<NodeTemplate> getCpListByVf(String vfCustomizationId) {
+ List<NodeTemplate> cpList = new ArrayList<>();
+ if (GeneralUtility.isEmptyString(vfCustomizationId)){
+ log.error("getCpListByVf vfCustomizationId string is empty");
+ return cpList;
+ }
+
List<NodeTemplate> serviceVfList = getServiceVfList();
+ if (serviceVfList == null || serviceVfList.size() == 0){
+ log.error("getCpListByVf Vfs not exist for vfCustomizationId {}",vfCustomizationId);
+ return cpList;
+ }
NodeTemplate vfInstance = getNodeTemplateByCustomizationUuid(serviceVfList, vfCustomizationId);
- return getNodeTemplateBySdcType(vfInstance, Types.TYPE_CP);
+ log.debug("getCpListByVf vf list is {}", vfInstance);
+ if (vfInstance == null) {
+ log.debug("getCpListByVf vf list is null");
+ return cpList;
+ }
+ cpList = getNodeTemplateBySdcType(vfInstance, Types.TYPE_CP);
+ if(cpList == null || cpList.size()==0)
+ log.trace("getCpListByVf cps not exist for vfCustomizationId {}",vfCustomizationId);
+ return cpList;
}
@Override
- public List<String> getMembersOfGroup(Group group) {
- //Can be done
- return null;//toscaTemplate.getTopologyTemplate().getSubstitutionMappings().getNodeTemplates().get(0).get
+ //Sunny flow - covered with UT
+ public List<NodeTemplate> getMembersOfVfModule(NodeTemplate vf, Group vfModule) {
+ if (vf == null) {
+ log.error("getMembersOfVfModule - vf is null");
+ return new ArrayList<>();
+ }
+
+ if (vfModule == null) {
+ log.error("getMembersOfVfModule - vfModule is null");
+ return new ArrayList<>();
+ }
+
+ List<String> members = vfModule.getMembers();
+ if (members != null){
+ SubstitutionMappings substitutionMappings = vf.getSubstitutionMappings();
+ if (substitutionMappings != null){
+ return substitutionMappings.getNodeTemplates().stream().filter(x -> members.contains(x.getName())).collect(Collectors.toList());
+ }
+ }
+ return new ArrayList<>();
}
@Override
+ //Sunny flow - covered with UT
public List<Pair<NodeTemplate, NodeTemplate>> getNodeTemplatePairsByReqName(
List<NodeTemplate> listOfReqNodeTemplates, List<NodeTemplate> listOfCapNodeTemplates, String reqName) {
- //TODO - Can be done
- return new ArrayList<>();
+ if (listOfReqNodeTemplates == null || listOfCapNodeTemplates == null || reqName == null){
+ //TODO error message
+ return new ArrayList<>();
+ }
+
+ List<Pair<NodeTemplate, NodeTemplate>> pairsList = new ArrayList<>();
+
+ if (listOfReqNodeTemplates != null){
+ for (NodeTemplate reqNodeTemplate : listOfReqNodeTemplates) {
+ List<Map<String, Map<String, Object>>> requirements = reqNodeTemplate.getRequirements();
+ if (requirements != null){
+ for (Map<String, Map<String, Object>> reqEntry : requirements){
+ Map<String, Object> reqEntryMap = reqEntry.get(reqName);
+
+ if (reqEntryMap != null){
+ Object node = reqEntryMap.get("node");
+ if (node != null){
+ String nodeString = (String)node;
+ Optional<NodeTemplate> findFirst = listOfCapNodeTemplates.stream().filter(x -> x.getName().equals(nodeString)).findFirst();
+ if (findFirst.isPresent()){
+ pairsList.add(new ImmutablePair<NodeTemplate, NodeTemplate>(reqNodeTemplate, findFirst.get()));
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ return pairsList;
}
@Override
+ //Sunny flow - covered with UT
//TODO constant strings
public List<NodeTemplate> getAllottedResources() {
- List<NodeTemplate> nodeTemplates = toscaTemplate.getTopologyTemplate().getNodeTemplates();
- return nodeTemplates.stream().filter(x -> x.getMetadata() != null && x.getMetadata().get("category").equals("allotted_resources")).collect(Collectors.toList());
+ List<NodeTemplate> nodeTemplates = null;
+ nodeTemplates = toscaTemplate.getTopologyTemplate().getNodeTemplates();
+ if(nodeTemplates==null || nodeTemplates.size()==0 ){
+ log.error("getAllottedResources nodeTemplates not exist");
+ }
+ nodeTemplates = nodeTemplates.stream().filter(x -> x.getMetadata() != null && x.getMetadata().getValue("category").equals("Allotted Resources")).collect(Collectors.toList());
+ if(nodeTemplates==null || nodeTemplates.size()==0 ){
+ log.trace("getAllottedResources - allotted resources not exist");
+ }else
+ log.trace("getAllottedResources - the allotted resources list is {}", nodeTemplates);
+ return nodeTemplates;
}
-
@Override
//Sunny flow - covered with UT
public String getTypeOfNodeTemplate(NodeTemplate nodeTemplate) {
- //Can be done
+ if(nodeTemplate == null){
+
+ log.error("getTypeOfNodeTemplate nodeTemplate is null");
+ return null;
+ }
+ log.debug("getTypeOfNodeTemplate node template type is {}",nodeTemplate.getTypeDefinition().getType());
return nodeTemplate.getTypeDefinition().getType();
}
- /*//Not part of API, for inner/test use
- public NodeTemplate getNodeTemplateByName(TopologyTemplate topologyTemplate, String topologyName){
+ /************************************* helper functions ***********************************/
+ private List<NodeTemplate> getNodeTemplateBySdcType(NodeTemplate nodeTemplate, String sdcType){
+ if (nodeTemplate == null) {
+ log.error("getNodeTemplateBySdcType - nodeTemplate is null or empty");
+ return new ArrayList<>();
+ }
+
+ if (GeneralUtility.isEmptyString(sdcType)) {
+ log.error("getNodeTemplateBySdcType - sdcType is null or empty");
+ return new ArrayList<>();
+ }
+
+ SubstitutionMappings substitutionMappings = nodeTemplate.getSubstitutionMappings();
+
+ if (substitutionMappings != null) {
+ List<NodeTemplate> nodeTemplates = substitutionMappings.getNodeTemplates();
+ if (nodeTemplates != null && nodeTemplates.size() > 0)
+ return nodeTemplates.stream().filter(x -> (x.getMetadata() != null && sdcType.equals(x.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_TYPE)))).collect(Collectors.toList());
+ else
+ log.trace("getNodeTemplateBySdcType - SubstitutionMappings' node Templates not exist");
+ } else
+ log.trace("getNodeTemplateBySdcType - SubstitutionMappings not exist");
+
+ return new ArrayList<>();
+ }
+
+ private List<NodeTemplate> getNodeTemplateBySdcType(TopologyTemplate topologyTemplate, String sdcType){
+ if (GeneralUtility.isEmptyString(sdcType)) {
+ log.error("getNodeTemplateBySdcType - sdcType is null or empty");
+ return new ArrayList<>();
+ }
+
+ if (topologyTemplate == null) {
+ log.error("getNodeTemplateBySdcType - topologyTemplate is null");
+ return new ArrayList<>();
+ }
+
List<NodeTemplate> nodeTemplates = topologyTemplate.getNodeTemplates();
- Optional<NodeTemplate> findFirst = nodeTemplates.stream().filter(x -> x.getName().equals(topologyName)).findFirst();
- return findFirst.isPresent() ? findFirst.get() : null;
- }*/
+
+ if (nodeTemplates != null && nodeTemplates.size() > 0)
+ return nodeTemplates.stream().filter(x -> (x.getMetadata() != null && sdcType.equals(x.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_TYPE)))).collect(Collectors.toList());
+
+ log.trace("getNodeTemplateBySdcType - topologyTemplate's nodeTemplates not exist");
+ return new ArrayList<>();
+ }
+
+ //Assumed to be unique property for the list
+ private NodeTemplate getNodeTemplateByCustomizationUuid(List<NodeTemplate> nodeTemplates, String customizationId){
+ for (NodeTemplate nodeTemplate : nodeTemplates){
+ if (customizationId.equals(nodeTemplate.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID))){
+ return nodeTemplate;
+ }
+ }
+ return null;
+ }
+
+ private String processProperties(String[] split, List<Property> properties) {
+ log.trace("processProperties - the leafValuePath is {} , the properties are {}", split.toString(), properties.toString());
+ Optional<Property> findFirst = properties.stream().filter(x -> x.getName().equals(split[0])).findFirst();
+ if (findFirst.isPresent()){
+ log.trace("processProperties - find first item is {}", findFirst.get().toString());
+ Property property = findFirst.get();
+ Object current = property.getValue();
+ if (current == null){
+ log.error("processProperties - this property has no value");
+ return null;
+ }
+ if (split.length > 1){
+ current = new Yaml().load((String)current);
+ for (int i = 1; i < split.length; i++) {
+ if (current instanceof Map){
+ current = ((Map<String, Object>)current).get(split[i]);
+ } else {
+ log.error("processProperties - found an unexpected leaf where expected to find a complex type");
+ return null;
+ }
+ }
+ }
+ if (current != null){
+ log.trace("processProperties - the property value is {}", String.valueOf(current));
+ return String.valueOf(current);
+ }
+ }
+ log.error("processProperties - Dont find property");
+ return null;
+ }
}
diff --git a/sdc-tosca-parser/src/main/java/org/openecomp/sdc/tosca/parser/impl/SdcToscaParserFactory.java b/sdc-tosca-parser/src/main/java/org/openecomp/sdc/tosca/parser/impl/SdcToscaParserFactory.java
index 6be293e..243d238 100644
--- a/sdc-tosca-parser/src/main/java/org/openecomp/sdc/tosca/parser/impl/SdcToscaParserFactory.java
+++ b/sdc-tosca-parser/src/main/java/org/openecomp/sdc/tosca/parser/impl/SdcToscaParserFactory.java
@@ -1,10 +1,14 @@
package org.openecomp.sdc.tosca.parser.impl;
import java.io.IOException;
+import java.util.List;
import org.openecomp.sdc.tosca.parser.api.ISdcCsarHelper;
import org.openecomp.sdc.tosca.parser.exceptions.SdcToscaParserException;
+import org.openecomp.sdc.toscaparser.ToscaParser;
import org.openecomp.sdc.toscaparser.ToscaParserFactory;
+import org.openecomp.sdc.toscaparser.api.NodeTemplate;
+import org.openecomp.sdc.toscaparser.api.ToscaTemplate;
public class SdcToscaParserFactory implements AutoCloseable{
@@ -42,7 +46,10 @@ public class SdcToscaParserFactory implements AutoCloseable{
throw new SdcToscaParserException("The factory is closed. It was probably closed too soon.");
}
try {
- return new SdcCsarHelperImpl(toscaParserFactory.create().parse(csarPath));
+ ToscaParser create = toscaParserFactory.create();
+ ToscaTemplate parse = create.parse(csarPath);
+ SdcCsarHelperImpl sdcCsarHelperImpl = new SdcCsarHelperImpl(parse);
+ return sdcCsarHelperImpl;
} catch (IOException e) {
throw new SdcToscaParserException("Exception when creating the parser: "+e.getMessage());
}
@@ -66,4 +73,13 @@ public class SdcToscaParserFactory implements AutoCloseable{
}
}
}
+
+ public static void main(String[] args) throws SdcToscaParserException {
+ try (SdcToscaParserFactory factory = SdcToscaParserFactory.getInstance()){ //Autoclosable
+ ISdcCsarHelper sdcCsarHelper = factory.getSdcCsarHelper("C:\\Users\\pa0916\\Desktop\\Work\\ASDC\\CSARs\\csar_hello_world.zip");
+ //Can run methods on the helper
+ List<NodeTemplate> allottedResources = sdcCsarHelper.getAllottedResources();
+ //..............
+ }
+ }
} \ No newline at end of file
diff --git a/sdc-tosca-parser/src/main/java/org/openecomp/sdc/tosca/parser/utils/GeneralUtility.java b/sdc-tosca-parser/src/main/java/org/openecomp/sdc/tosca/parser/utils/GeneralUtility.java
new file mode 100644
index 0000000..e4d92f5
--- /dev/null
+++ b/sdc-tosca-parser/src/main/java/org/openecomp/sdc/tosca/parser/utils/GeneralUtility.java
@@ -0,0 +1,8 @@
+package org.openecomp.sdc.tosca.parser.utils;
+
+public class GeneralUtility {
+
+ public static boolean isEmptyString(String str){
+ return str == null || str.trim().isEmpty();
+ }
+}
diff --git a/sdc-tosca-parser/src/test/java/org/openecomp/sdc/impl/ToscaParserStubsTest.java b/sdc-tosca-parser/src/test/java/org/openecomp/sdc/impl/ToscaParserStubsTest.java
index aac552c..6a23cc4 100644
--- a/sdc-tosca-parser/src/test/java/org/openecomp/sdc/impl/ToscaParserStubsTest.java
+++ b/sdc-tosca-parser/src/test/java/org/openecomp/sdc/impl/ToscaParserStubsTest.java
@@ -1,96 +1,493 @@
package org.openecomp.sdc.impl;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+
import java.io.File;
+import java.util.ArrayList;
import java.util.List;
-import java.util.Map;
+import org.apache.commons.lang3.tuple.Pair;
import org.junit.AfterClass;
-import static org.junit.Assert.*;
import org.junit.BeforeClass;
import org.junit.Test;
import org.openecomp.sdc.tosca.parser.api.ISdcCsarHelper;
import org.openecomp.sdc.tosca.parser.exceptions.SdcToscaParserException;
import org.openecomp.sdc.tosca.parser.impl.SdcToscaParserFactory;
+import org.openecomp.sdc.toscaparser.api.Group;
+import org.openecomp.sdc.toscaparser.api.Metadata;
import org.openecomp.sdc.toscaparser.api.NodeTemplate;
+import org.openecomp.sdc.toscaparser.api.parameters.Input;
public class ToscaParserStubsTest {
- private static ISdcCsarHelper csarHelper;
- private static SdcToscaParserFactory factory;
-
+ static SdcToscaParserFactory factory;
+ static ISdcCsarHelper rainyCsarHelperSingleVf;
+ static ISdcCsarHelper rainyCsarHelperMultiVfs;
+ static ISdcCsarHelper rainyCsarHelperNoVf;
+ static ISdcCsarHelper sunnyCsarHelperMultipleVf;
@BeforeClass
public static void init() throws SdcToscaParserException{
+ long startTime = System.currentTimeMillis();
factory = SdcToscaParserFactory.getInstance();
- //csarHelper = factory.getSdcCsarHelper("C:\\Users\\pa0916\\Desktop\\Work\\ASDC\\CSARs\\service-ServiceFdnt-csar-allotted-resources-4.csar");
- String fileStr = ToscaParserStubsTest.class.getClassLoader().getResource("csars/service-ServiceFdnt-csar-allotted-resources-4.csar").getFile();
+ long estimatedTime = System.currentTimeMillis() - startTime;
+ System.out.println("Time to init factory "+estimatedTime);
+ String fileStr2 = ToscaParserStubsTest.class.getClassLoader().getResource("csars/service-ServiceFdnt-csar-group-meta-10.csar").getFile();
+ File file2 = new File(fileStr2);
+ startTime = System.currentTimeMillis();
+ sunnyCsarHelperMultipleVf = factory.getSdcCsarHelper(file2.getAbsolutePath());
+ estimatedTime = System.currentTimeMillis() - startTime;
+ System.out.println("init CSAR Execution time: "+estimatedTime);
+ String fileStr = ToscaParserStubsTest.class.getClassLoader().getResource("csars/service-ServiceFdnt-csar-rainy.csar").getFile();
File file = new File(fileStr);
- csarHelper = factory.getSdcCsarHelper(file.getAbsolutePath());
+ rainyCsarHelperMultiVfs = factory.getSdcCsarHelper(file.getAbsolutePath());
+ String fileStr3 = ToscaParserStubsTest.class.getClassLoader().getResource("csars/service-ServiceFdnt-csar.csar").getFile();
+ File file3 = new File(fileStr3);
+ rainyCsarHelperSingleVf = factory.getSdcCsarHelper(file3.getAbsolutePath());
+ String fileStr4 = ToscaParserStubsTest.class.getClassLoader().getResource("csars/service-ServiceFdnt-csar-no-vf.csar").getFile();
+ File file4 = new File(fileStr3);
+ rainyCsarHelperNoVf = factory.getSdcCsarHelper(file3.getAbsolutePath());
}
-
-
+
@Test
- //TODO add rainy flows
public void testNumberOfVfSunnyFlow() throws SdcToscaParserException {
- List<NodeTemplate> serviceVfList = csarHelper.getServiceVfList();
+ List<NodeTemplate> serviceVfList = sunnyCsarHelperMultipleVf.getServiceVfList();
assertNotNull(serviceVfList);
- assertEquals(1, serviceVfList.size());
+ assertEquals(2, serviceVfList.size());
}
@Test
- //TODO add rainy flows
public void testNodeTemplateFlatProperty() throws SdcToscaParserException {
- List<NodeTemplate> serviceVfList = csarHelper.getServiceVfList();
- String nodeTemplatePropertyLeafValue = csarHelper.getNodeTemplatePropertyLeafValue(serviceVfList.get(0), "availability_zone_max_count");
+ List<NodeTemplate> serviceVfList = sunnyCsarHelperMultipleVf.getServiceVfList();
+ String nodeTemplatePropertyLeafValue = sunnyCsarHelperMultipleVf.getNodeTemplatePropertyLeafValue(serviceVfList.get(0), "availability_zone_max_count");
assertEquals("2", nodeTemplatePropertyLeafValue);
}
+
+ @Test
+ public void testGroupFlatProperty() throws SdcToscaParserException {
+ List<Group> vfModulesByVf = sunnyCsarHelperMultipleVf.getVfModulesByVf("56179cd8-de4a-4c38-919b-bbc4452d2d72");
+ String volumeGroup = sunnyCsarHelperMultipleVf.getGroupPropertyLeafValue(vfModulesByVf.get(0), "volume_group");
+ assertEquals("false", volumeGroup);
+ }
@Test
- //TODO add rainy flows
public void testNodeTemplateNestedProperty() throws SdcToscaParserException {
- List<NodeTemplate> serviceVfList = csarHelper.getServiceVfList();
- String nodeTemplatePropertyLeafValue = csarHelper.getNodeTemplatePropertyLeafValue(serviceVfList.get(0), "nf_role#nf_naming#instance_name");
- assertEquals("FDNT_instance_VF", nodeTemplatePropertyLeafValue);
+ List<NodeTemplate> serviceVfList = sunnyCsarHelperMultipleVf.getServiceVfList();
+ String nodeTemplatePropertyLeafValue = sunnyCsarHelperMultipleVf.getNodeTemplatePropertyLeafValue(serviceVfList.get(0), "nf_role#nf_naming#ecomp_generated_naming");
+ assertEquals("false", nodeTemplatePropertyLeafValue);
}
@Test
- //TODO add rainy flows
public void testServiceNodeTemplatesByType() throws SdcToscaParserException {
- List<NodeTemplate> serviceVfList = csarHelper.getServiceNodeTemplatesByType("org.openecomp.resource.vf.Fdnt");
+ List<NodeTemplate> serviceVfList = sunnyCsarHelperMultipleVf.getServiceNodeTemplatesByType("org.openecomp.resource.vf.Fdnt");
assertNotNull(serviceVfList);
- assertEquals(1, serviceVfList.size());
+ assertEquals(2, serviceVfList.size());
}
@Test
- //TODO add rainy flows
public void testGetTypeOfNodeTemplate() {
- List<NodeTemplate> serviceVfList = csarHelper.getServiceVfList();
- String typeOfNodeTemplate = csarHelper.getTypeOfNodeTemplate(serviceVfList.get(0));
+ List<NodeTemplate> serviceVfList = sunnyCsarHelperMultipleVf.getServiceVfList();
+ String typeOfNodeTemplate = sunnyCsarHelperMultipleVf.getTypeOfNodeTemplate(serviceVfList.get(0));
assertEquals("org.openecomp.resource.vf.Fdnt", typeOfNodeTemplate);
}
-
- //@Test
- //TODO add rainy flows
+ @Test
public void testGetServiceMetadata() {
- //FAILS!! Metadata is null
- Map<String, String> serviceMetadata = csarHelper.getServiceMetadata();
+ Metadata serviceMetadata = sunnyCsarHelperMultipleVf.getServiceMetadata();
assertNotNull(serviceMetadata);
- assertEquals("78c72999-1003-4a35-8534-bbd7d96fcae3", serviceMetadata.get("invariantUUID"));
- assertEquals("Service FDNT", serviceMetadata.get("name"));
- assertEquals("true", serviceMetadata.get("serviceEcompNaming"));
+ assertEquals("78c72999-1003-4a35-8534-bbd7d96fcae3", serviceMetadata.getValue("invariantUUID"));
+ assertEquals("Service FDNT", serviceMetadata.getValue("name"));
+ assertEquals("true", String.valueOf(serviceMetadata.getValue("serviceEcompNaming")));
}
@Test
- //TODO add rainy flows
public void testGetAllottedResources() {
- List<NodeTemplate> allottedResources = csarHelper.getAllottedResources();
- assertEquals(1, allottedResources.size());
+ List<NodeTemplate> allottedResources = sunnyCsarHelperMultipleVf.getAllottedResources();
+ assertEquals(2, allottedResources.size());
+ }
+
+ @Test
+ public void testGetServiceSubstitutionMappingsTypeName() {
+ String serviceSubstitutionMappingsTypeName = sunnyCsarHelperMultipleVf.getServiceSubstitutionMappingsTypeName();
+ assertEquals("org.openecomp.service.ServiceFdnt", serviceSubstitutionMappingsTypeName);
+ }
+
+ @Test
+ public void testGetVfcFromVf(){
+ List<NodeTemplate> vfcListByVf = sunnyCsarHelperMultipleVf.getVfcListByVf("56179cd8-de4a-4c38-919b-bbc4452d2d72");
+ assertEquals(2, vfcListByVf.size());
+ }
+
+ @Test
+ public void testGetCpFromVf(){
+ List<NodeTemplate> cpListByVf = sunnyCsarHelperMultipleVf.getCpListByVf("56179cd8-de4a-4c38-919b-bbc4452d2d72");
+ assertEquals(1, cpListByVf.size());
+ NodeTemplate nodeTemplate = cpListByVf.get(0);
+ assertEquals("DNT_PORT", nodeTemplate.getName());
+ }
+
+ @Test
+ public void testServiceVl(){
+ List<NodeTemplate> vlList = sunnyCsarHelperMultipleVf.getServiceVlList();
+ assertEquals(1, vlList.size());
+ }
+
+ @Test
+ public void testVfModulesFromVf(){
+ List<Group> vfModulesByVf = sunnyCsarHelperMultipleVf.getVfModulesByVf("56179cd8-de4a-4c38-919b-bbc4452d2d72");
+ assertEquals(2, vfModulesByVf.size());
+ }
+
+ @Test
+ public void testGetNodeTemplatePairsByReqName(){
+ List<Pair<NodeTemplate, NodeTemplate>> nodeTemplatePairsByReqName = sunnyCsarHelperMultipleVf.getNodeTemplatePairsByReqName(sunnyCsarHelperMultipleVf.getCpListByVf("56179cd8-de4a-4c38-919b-bbc4452d2d72"), sunnyCsarHelperMultipleVf.getVfcListByVf("56179cd8-de4a-4c38-919b-bbc4452d2d72"), "binding");
+ assertNotNull(nodeTemplatePairsByReqName);
+ assertEquals(1, nodeTemplatePairsByReqName.size());
+ Pair<NodeTemplate, NodeTemplate> pair = nodeTemplatePairsByReqName.get(0);
+ NodeTemplate cp = pair.getLeft();
+ NodeTemplate vfc = pair.getRight();
+ assertEquals("DNT_PORT", cp.getName());
+ assertEquals("DNT_FW_RHRG", vfc.getName());
+ }
+
+ @Test
+ public void testGetMembersOfVfModule(){
+ NodeTemplate vf = sunnyCsarHelperMultipleVf.getServiceVfList().get(0);
+ List<Group> vfModulesByVf = sunnyCsarHelperMultipleVf.getVfModulesByVf(vf.getMetadata().getValue("customizationUUID"));
+ assertEquals(2, vfModulesByVf.size());
+ for (Group group : vfModulesByVf){
+ List<NodeTemplate> membersOfVfModule = sunnyCsarHelperMultipleVf.getMembersOfVfModule(vf, group);
+ assertNotNull(membersOfVfModule);
+ if (group.getName().equals("Fdnt..base_stsi_dnt_frwl..module-0")){
+ assertEquals(1, membersOfVfModule.size());
+ NodeTemplate nodeTemplate = membersOfVfModule.get(0);
+ assertEquals("DNT_FW_RSG_SI_1", nodeTemplate.getName());
+ } else {
+ assertEquals("Fdnt..mod_vmsi_dnt_fw_parent..module-1", group.getName());
+ assertEquals(1, membersOfVfModule.size());
+ NodeTemplate nodeTemplate = membersOfVfModule.get(0);
+ assertEquals("DNT_FW_RHRG", nodeTemplate.getName());
+ }
+ }
+ }
+
+ @Test
+ public void testGetServiceInputs(){
+ List<Input> serviceInputs = sunnyCsarHelperMultipleVf.getServiceInputs();
+ assertNotNull(serviceInputs);
+ assertEquals(1, serviceInputs.size());
+ }
+
+ @Test
+ public void testGetMetadataProperty(){
+ Metadata serviceMetadata = sunnyCsarHelperMultipleVf.getServiceMetadata();
+ String metadataPropertyValue = sunnyCsarHelperMultipleVf.getMetadataPropertyValue(serviceMetadata, "invariantUUID");
+ assertEquals("78c72999-1003-4a35-8534-bbd7d96fcae3", metadataPropertyValue);
+ }
+
+ @Test
+ public void testGetGroupMetadata(){
+ NodeTemplate vf = sunnyCsarHelperMultipleVf.getServiceVfList().get(0);
+ List<Group> vfModulesByVf = sunnyCsarHelperMultipleVf.getVfModulesByVf(vf.getMetadata().getValue("customizationUUID"));
+ boolean found = false;
+ for (Group group : vfModulesByVf){
+ if (group.getName().equals("Fdnt..base_stsi_dnt_frwl..module-0")){
+ found = true;
+ Metadata metadata = group.getMetadata();
+ assertNotNull(metadata);
+ assertEquals("1", metadata.getValue("vfModuleModelVersion"));
+ }
+ }
+ assertTrue(found);
+ }
+
+
+ @Test
+ public void testGetServiceInputLeafValue(){
+ String serviceInputLeafValue = sunnyCsarHelperMultipleVf.getServiceInputLeafValueOfDefault("service_naming#default");
+ assertEquals("test service naming", serviceInputLeafValue);
+ }
+
+
+ /***************** RAINY TESTS ***************************/
+
+
+ @Test
+ public void testGetServiceInputLeafValueNotExists(){
+ String serviceInputLeafValue = sunnyCsarHelperMultipleVf.getServiceInputLeafValueOfDefault("service_naming#default#kuku");
+ assertNull(serviceInputLeafValue);
+ }
+
+ @Test
+ public void testGetServiceInputLeafValueNull(){
+ String serviceInputLeafValue = sunnyCsarHelperMultipleVf.getServiceInputLeafValueOfDefault(null);
+ assertNull(serviceInputLeafValue);
}
+ @Test
+ public void testNodeTemplateNestedPropertyNotExists() throws SdcToscaParserException {
+ List<NodeTemplate> serviceVfList = sunnyCsarHelperMultipleVf.getServiceVfList();
+ String nodeTemplatePropertyLeafValue = sunnyCsarHelperMultipleVf.getNodeTemplatePropertyLeafValue(serviceVfList.get(0), "nf_role#nf_naming#kuku");
+ assertNull(nodeTemplatePropertyLeafValue);
+ }
- @AfterClass
- public static void close(){
- factory.close();
+ @Test
+ public void testGetGroupEmptyMetadata(){
+ NodeTemplate vf = sunnyCsarHelperMultipleVf.getServiceVfList().get(0);
+ List<Group> vfModulesByVf = sunnyCsarHelperMultipleVf.getVfModulesByVf(vf.getMetadata().getValue("customizationUUID"));
+ boolean found = false;
+ for (Group group : vfModulesByVf){
+ if (group.getName().equals("Fdnt..mod_vmsi_dnt_fw_parent..module-1")){
+ found = true;
+ Metadata metadata = group.getMetadata();
+ assertNull(metadata);
+ }
}
+ assertTrue(found);
+ }
+
+ @Test
+ public void testNodeTemplateFlatPropertyByNotFoundProperty() throws SdcToscaParserException {
+ List<NodeTemplate> serviceVfList = rainyCsarHelperMultiVfs.getServiceVfList();
+ String nodeTemplatePropertyLeafValue = rainyCsarHelperMultiVfs.getNodeTemplatePropertyLeafValue(serviceVfList.get(0), "XXXX");
+ assertNull(nodeTemplatePropertyLeafValue);
+ }
+
+ @Test
+ public void testNodeTemplateFlatPropertyByNullProperty() throws SdcToscaParserException {
+ List<NodeTemplate> serviceVfList = rainyCsarHelperMultiVfs.getServiceVfList();
+ String nodeTemplatePropertyLeafValue = rainyCsarHelperMultiVfs.getNodeTemplatePropertyLeafValue(serviceVfList.get(0), null);
+ assertNull(nodeTemplatePropertyLeafValue);
+ }
+
+ @Test
+ public void testNodeTemplateFlatPropertyByNullNodeTemplate() throws SdcToscaParserException {
+ String nodeTemplatePropertyLeafValue = rainyCsarHelperMultiVfs.getNodeTemplatePropertyLeafValue(null, "availability_zone_max_count");
+ assertNull(nodeTemplatePropertyLeafValue);
+ }
+
+ @Test
+ public void testNumberOfVLRainyFlow() throws SdcToscaParserException {
+ List<NodeTemplate> serviceVlList = rainyCsarHelperMultiVfs.getServiceVlList();
+ assertNotNull(serviceVlList);
+ assertEquals(0, serviceVlList.size());
+ }
+
+ @Test
+ public void testSingleVFWithNotMetadata() throws SdcToscaParserException {
+ //If there is no metadata on VF level - There is no VF's because the type is taken from metadata values.
+ List<NodeTemplate> serviceVfList = rainyCsarHelperSingleVf.getServiceVfList();
+ assertNotNull(serviceVfList);
+ assertEquals(0, serviceVfList.size());
+ }
+
+ @Test
+ public void testGetNullMetadataPropertyValue() {
+ String value = rainyCsarHelperMultiVfs.getMetadataPropertyValue(null, "XXX");
+ assertNull(value);
+ }
+
+ @Test
+ public void testGetMetadataByNullPropertyValue() {
+ Metadata metadata = rainyCsarHelperMultiVfs.getServiceMetadata();
+ String value = rainyCsarHelperMultiVfs.getMetadataPropertyValue(metadata, null);
+ assertNull(value);
+ }
+
+ @Test
+ public void testGetMetadataByEmptyPropertyValue() {
+ Metadata metadata = rainyCsarHelperMultiVfs.getServiceMetadata();
+ String value = rainyCsarHelperMultiVfs.getMetadataPropertyValue(metadata, "");
+ assertNull(value);
+ }
+
+ @Test
+ public void testGetCpFromVfByNullId() {
+ List<NodeTemplate> cpListByVf = rainyCsarHelperMultiVfs.getCpListByVf(null);
+ assertNotNull(cpListByVf);
+ assertEquals(0, cpListByVf.size());
+ }
+
+ @Test
+ public void testGetAllottedResourcesZero() {
+ List<NodeTemplate> allottedResources = rainyCsarHelperMultiVfs.getAllottedResources();
+ assertNotNull(allottedResources);
+ assertEquals(0, allottedResources.size());
+ }
+
+ @Test
+ public void testGetTypeOfNullNodeTemplate() {
+ String typeOfNodeTemplate = rainyCsarHelperMultiVfs.getTypeOfNodeTemplate(null);
+ assertNull(typeOfNodeTemplate);
+ }
+
+ @Test
+ public void testGetCpFromVfXxx() {
+ List<NodeTemplate> cpListByVf = rainyCsarHelperMultiVfs.getCpListByVf("XXXXX");
+ assertNotNull(cpListByVf);
+ assertEquals(0, cpListByVf.size());
+ }
+
+ @Test
+ public void testServiceNodeTemplatesByNull() {
+ List<NodeTemplate> nodeTemplates = rainyCsarHelperMultiVfs.getServiceNodeTemplatesByType(null);
+ assertNotNull(nodeTemplates);
+ assertEquals(0, nodeTemplates.size());
+ }
+
+ @Test
+ public void testServiceNodeTemplatesByNotFoundProperty() {
+ List<NodeTemplate> nodeTemplates = rainyCsarHelperMultiVfs.getServiceNodeTemplatesByType("XXX");
+ assertNotNull(nodeTemplates);
+ assertEquals(0, nodeTemplates.size());
+ }
+
+ @Test
+ public void testVfcListByNull() {
+ List<NodeTemplate> vfcList = rainyCsarHelperMultiVfs.getVfcListByVf(null);
+ assertNotNull(vfcList);
+ assertEquals(0, vfcList.size());
+ }
+
+ @Test
+ public void testVfcListByNotFoundProperty() {
+ List<NodeTemplate> vfcList = rainyCsarHelperMultiVfs.getVfcListByVf("XXX");
+ assertNotNull(vfcList);
+ assertEquals(0, vfcList.size());
+ }
+
+ @Test
+ public void testServiceSubstitutionMappingsTypeName() {
+ String substitutionMappingsTypeName = rainyCsarHelperMultiVfs.getServiceSubstitutionMappingsTypeName();
+ assertNull(substitutionMappingsTypeName);
+ }
+
+ @Test
+ public void testServiceMetadata() {
+ Metadata metadata = rainyCsarHelperSingleVf.getServiceMetadata();
+ assertNull(metadata);
+ }
+
+ @Test
+ public void testGetVfModuleNonExisitingVf() {
+ List<Group> vfModulesByVf = rainyCsarHelperSingleVf.getVfModulesByVf("dummy");
+ assertNotNull(vfModulesByVf);
+ assertEquals(0, vfModulesByVf.size());
+ }
+
+ @Test
+ public void testGetVfModuleNullVf() {
+ List<Group> vfModulesByVf = rainyCsarHelperSingleVf.getVfModulesByVf(null);
+ assertNotNull(vfModulesByVf);
+ assertEquals(0, vfModulesByVf.size());
+ }
+
+ @Test
+ public void testGroupPropertyLeafValueByNullGroup() {
+ String groupProperty = sunnyCsarHelperMultipleVf.getGroupPropertyLeafValue(null, "volume_group");
+ assertNull(groupProperty);
+ }
+
+ @Test
+ public void testGroupPropertyLeafValueByNullProperty() {
+ List<Group> vfModulesByVf = sunnyCsarHelperMultipleVf.getVfModulesByVf("56179cd8-de4a-4c38-919b-bbc4452d2d72");
+ String groupProperty = sunnyCsarHelperMultipleVf.getGroupPropertyLeafValue(vfModulesByVf.get(0), null);
+ assertNull(groupProperty);
+ }
+
+ @Test
+ public void testGroupPropertyLeafValueByDummyProperty() {
+ List<Group> vfModulesByVf = sunnyCsarHelperMultipleVf.getVfModulesByVf("56179cd8-de4a-4c38-919b-bbc4452d2d72");
+ String groupProperty = sunnyCsarHelperMultipleVf.getGroupPropertyLeafValue(vfModulesByVf.get(0), "XXX");
+ assertNull(groupProperty);
+ }
+
+ @Test
+ public void testMembersOfVfModuleByNullVf() {
+ List<Group> vfModulesByVf = sunnyCsarHelperMultipleVf.getVfModulesByVf("56179cd8-de4a-4c38-919b-bbc4452d2d72");
+ List<NodeTemplate> nodeTemplates = sunnyCsarHelperMultipleVf.getMembersOfVfModule(null, vfModulesByVf.get(0));
+ assertNotNull(nodeTemplates);
+ assertEquals(0, nodeTemplates.size());
+ }
+
+ @Test
+ public void testMembersOfVfModuleByNullGroup() {
+ List<NodeTemplate> serviceVfList = rainyCsarHelperMultiVfs.getServiceVfList();
+ List<NodeTemplate> nodeTemplates = rainyCsarHelperMultiVfs.getMembersOfVfModule(serviceVfList.get(0), null);
+ assertNotNull(nodeTemplates);
+ assertEquals(0, nodeTemplates.size());
+ }
+
+ @Test
+ public void testGetNodeTemplatePairsByReqNameWithNullVF(){
+ List<Pair<NodeTemplate, NodeTemplate>> nodeTemplatePairsByReqName = sunnyCsarHelperMultipleVf.getNodeTemplatePairsByReqName(
+ null, sunnyCsarHelperMultipleVf.getVfcListByVf("56179cd8-de4a-4c38-919b-bbc4452d2d72"), "binding");
+ assertNotNull(nodeTemplatePairsByReqName);
+ assertEquals(0, nodeTemplatePairsByReqName.size());
+ }
+
+ @Test
+ public void testGetNodeTemplatePairsByReqNameWithEmptyVF(){
+ List<Pair<NodeTemplate, NodeTemplate>> nodeTemplatePairsByReqName = sunnyCsarHelperMultipleVf.getNodeTemplatePairsByReqName(
+ new ArrayList<>(), sunnyCsarHelperMultipleVf.getVfcListByVf("56179cd8-de4a-4c38-919b-bbc4452d2d72"), "binding");
+ assertNotNull(nodeTemplatePairsByReqName);
+ assertEquals(0, nodeTemplatePairsByReqName.size());
+ }
+
+ @Test
+ public void testGetNodeTemplatePairsByReqNameWithNullCap(){
+ List<Pair<NodeTemplate, NodeTemplate>> nodeTemplatePairsByReqName = sunnyCsarHelperMultipleVf.getNodeTemplatePairsByReqName(
+ sunnyCsarHelperMultipleVf.getCpListByVf("56179cd8-de4a-4c38-919b-bbc4452d2d72"), null, "binding");
+ assertNotNull(nodeTemplatePairsByReqName);
+ assertEquals(0, nodeTemplatePairsByReqName.size());
+ }
+
+ @Test
+ public void testGetNodeTemplatePairsByReqNameWithEmptyCap(){
+ List<Pair<NodeTemplate, NodeTemplate>> nodeTemplatePairsByReqName = sunnyCsarHelperMultipleVf.getNodeTemplatePairsByReqName(
+ sunnyCsarHelperMultipleVf.getCpListByVf("56179cd8-de4a-4c38-919b-bbc4452d2d72"), new ArrayList<>(), "binding");
+ assertNotNull(nodeTemplatePairsByReqName);
+ assertEquals(0, nodeTemplatePairsByReqName.size());
+ }
+
+ @Test
+ public void testGetNodeTemplatePairsByReqNameWithNullReq(){
+ List<Pair<NodeTemplate, NodeTemplate>> nodeTemplatePairsByReqName = sunnyCsarHelperMultipleVf.getNodeTemplatePairsByReqName(
+ sunnyCsarHelperMultipleVf.getCpListByVf("56179cd8-de4a-4c38-919b-bbc4452d2d72"), sunnyCsarHelperMultipleVf.getVfcListByVf("56179cd8-de4a-4c38-919b-bbc4452d2d72"), null);
+ assertNotNull(nodeTemplatePairsByReqName);
+ assertEquals(0, nodeTemplatePairsByReqName.size());
+ }
+
+ @Test
+ public void testGetNodeTemplatePairsByReqNameWithDummyReq(){
+ List<Pair<NodeTemplate, NodeTemplate>> nodeTemplatePairsByReqName = sunnyCsarHelperMultipleVf.getNodeTemplatePairsByReqName(
+ sunnyCsarHelperMultipleVf.getCpListByVf("56179cd8-de4a-4c38-919b-bbc4452d2d72"), sunnyCsarHelperMultipleVf.getVfcListByVf("56179cd8-de4a-4c38-919b-bbc4452d2d72"), "XXX");
+ assertNotNull(nodeTemplatePairsByReqName);
+ assertEquals(0, nodeTemplatePairsByReqName.size());
+ }
+
+ @Test
+ public void testServiceInputs() {
+ List<Input> inputs = rainyCsarHelperSingleVf.getServiceInputs();
+ assertNotNull(inputs);
+ assertEquals(0, inputs.size());
+ }
+
+ @Test
+ public void testServiceWithoutVF() {
+ List<NodeTemplate> vfList = rainyCsarHelperNoVf.getServiceVfList();
+ assertNotNull(vfList);
+ assertEquals(0, vfList.size());
+ }
+
+ @AfterClass
+ public static void close(){
+ long startTime = System.currentTimeMillis();
+ factory.close();
+ long estimatedTime = System.currentTimeMillis() - startTime;
+ System.out.println("close Execution time: "+estimatedTime);
}
+}
diff --git a/sdc-tosca-parser/src/test/resources/csars/csar_hello_world.zip b/sdc-tosca-parser/src/test/resources/csars/csar_hello_world.zip
new file mode 100644
index 0000000..43ffbbc
--- /dev/null
+++ b/sdc-tosca-parser/src/test/resources/csars/csar_hello_world.zip
Binary files differ
diff --git a/sdc-tosca-parser/src/test/resources/csars/service-ServiceFdnt-csar-cp-vfc-req-cap-8.csar b/sdc-tosca-parser/src/test/resources/csars/service-ServiceFdnt-csar-cp-vfc-req-cap-8.csar
new file mode 100644
index 0000000..be254a0
--- /dev/null
+++ b/sdc-tosca-parser/src/test/resources/csars/service-ServiceFdnt-csar-cp-vfc-req-cap-8.csar
Binary files differ
diff --git a/sdc-tosca-parser/src/test/resources/csars/service-ServiceFdnt-csar-flat-input-9-1.csar b/sdc-tosca-parser/src/test/resources/csars/service-ServiceFdnt-csar-flat-input-9-1.csar
new file mode 100644
index 0000000..4ae4c6f
--- /dev/null
+++ b/sdc-tosca-parser/src/test/resources/csars/service-ServiceFdnt-csar-flat-input-9-1.csar
Binary files differ
diff --git a/sdc-tosca-parser/src/test/resources/csars/service-ServiceFdnt-csar-group-meta-10.csar b/sdc-tosca-parser/src/test/resources/csars/service-ServiceFdnt-csar-group-meta-10.csar
new file mode 100644
index 0000000..dc21ce9
--- /dev/null
+++ b/sdc-tosca-parser/src/test/resources/csars/service-ServiceFdnt-csar-group-meta-10.csar
Binary files differ
diff --git a/sdc-tosca-parser/src/test/resources/csars/service-ServiceFdnt-csar-inputs-9.csar b/sdc-tosca-parser/src/test/resources/csars/service-ServiceFdnt-csar-inputs-9.csar
new file mode 100644
index 0000000..c1c2855
--- /dev/null
+++ b/sdc-tosca-parser/src/test/resources/csars/service-ServiceFdnt-csar-inputs-9.csar
Binary files differ
diff --git a/sdc-tosca-parser/src/test/resources/csars/service-ServiceFdnt-csar-no-vf.csar b/sdc-tosca-parser/src/test/resources/csars/service-ServiceFdnt-csar-no-vf.csar
new file mode 100644
index 0000000..c35baf5
--- /dev/null
+++ b/sdc-tosca-parser/src/test/resources/csars/service-ServiceFdnt-csar-no-vf.csar
Binary files differ
diff --git a/sdc-tosca-parser/src/test/resources/csars/service-ServiceFdnt-csar-rainy.csar b/sdc-tosca-parser/src/test/resources/csars/service-ServiceFdnt-csar-rainy.csar
new file mode 100644
index 0000000..412935f
--- /dev/null
+++ b/sdc-tosca-parser/src/test/resources/csars/service-ServiceFdnt-csar-rainy.csar
Binary files differ
diff --git a/sdc-tosca-parser/src/test/resources/csars/service-ServiceFdnt-csar-service-vl-7.csar b/sdc-tosca-parser/src/test/resources/csars/service-ServiceFdnt-csar-service-vl-7.csar
new file mode 100644
index 0000000..db3af99
--- /dev/null
+++ b/sdc-tosca-parser/src/test/resources/csars/service-ServiceFdnt-csar-service-vl-7.csar
Binary files differ
diff --git a/sdc-tosca-parser/src/test/resources/csars/service-ServiceFdnt-csar-two-vfs-5.csar b/sdc-tosca-parser/src/test/resources/csars/service-ServiceFdnt-csar-two-vfs-5.csar
new file mode 100644
index 0000000..565929a
--- /dev/null
+++ b/sdc-tosca-parser/src/test/resources/csars/service-ServiceFdnt-csar-two-vfs-5.csar
Binary files differ
diff --git a/sdc-tosca-parser/src/test/resources/csars/service-ServiceFdnt-test-csar.csar b/sdc-tosca-parser/src/test/resources/csars/service-ServiceFdnt-test-csar.csar
new file mode 100644
index 0000000..5a364cd
--- /dev/null
+++ b/sdc-tosca-parser/src/test/resources/csars/service-ServiceFdnt-test-csar.csar
Binary files differ