From 7f05e4ea488144ba8bdecbed0aaa853a6d001a38 Mon Sep 17 00:00:00 2001 From: Pavel Aharoni Date: Sun, 14 May 2017 17:56:49 +0300 Subject: [SDC-20] fix sdc csar for tosca parser dev2dev Change-Id: I7ea8c3a9cc29be93c5cf6fb79b2b3dc23fb0bb0a Signed-off-by: Pavel Aharoni --- jtosca/pom.xml | 4 +-- .../sdc/toscaparser/api/elements/NodeType.java | 5 ++- pom.xml | 4 ++- sdc-distribution-ci/pom.xml | 2 +- .../java/org/openecomp/test/CsarToscaTester.java | 4 +-- sdc-distribution-client/pom.xml | 4 +-- sdc-tosca-parser/pom.xml | 42 ++++++++++------------ .../sdc/tosca/parser/api/ISdcCsarHelper.java | 27 +++++++++----- 8 files changed, 52 insertions(+), 40 deletions(-) diff --git a/jtosca/pom.xml b/jtosca/pom.xml index ce50fec..3ef6a3c 100644 --- a/jtosca/pom.xml +++ b/jtosca/pom.xml @@ -5,11 +5,11 @@ org.openecomp.sdc.sdc-distribution-client sdc-main-distribution-client - 1.1.9-SNAPSHOT + 1.1.13-SNAPSHOT jtosca - 0.1.3-SNAPSHOT + 0.1.6-SNAPSHOT diff --git a/jtosca/src/main/java/org/openecomp/sdc/toscaparser/api/elements/NodeType.java b/jtosca/src/main/java/org/openecomp/sdc/toscaparser/api/elements/NodeType.java index 853b8ac..e7dc464 100644 --- a/jtosca/src/main/java/org/openecomp/sdc/toscaparser/api/elements/NodeType.java +++ b/jtosca/src/main/java/org/openecomp/sdc/toscaparser/api/elements/NodeType.java @@ -106,7 +106,10 @@ public class NodeType extends StatefulEntityType { // the capability type String captype = (String)req.get("capability"); String value = _getNodeTypeByCap(captype); - relation = _getRelation(key,value); + String getRelation = _getRelation(key,value); + if (getRelation != null) { + relation = getRelation; + } keyword = key; nodeType = value; } diff --git a/pom.xml b/pom.xml index 2b3583e..51bcfe5 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ org.openecomp.sdc.sdc-distribution-client sdc-main-distribution-client - 1.1.10-SNAPSHOT + 1.1.13-SNAPSHOT pom @@ -35,6 +35,8 @@ 1.1.2 4.12 1.14 + 21.0 + true ${project.basedir} diff --git a/sdc-distribution-ci/pom.xml b/sdc-distribution-ci/pom.xml index f76457c..68cbd9c 100644 --- a/sdc-distribution-ci/pom.xml +++ b/sdc-distribution-ci/pom.xml @@ -6,7 +6,7 @@ org.openecomp.sdc.sdc-distribution-client sdc-main-distribution-client - 1.1.10-SNAPSHOT + 1.1.13-SNAPSHOT sdc-distribution-ci 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 404f6d2..068ef24 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 @@ -40,9 +40,9 @@ public class CsarToscaTester { List vflist = csarHelper.getServiceVfList(); List inputs = csarHelper.getServiceInputs(); List exceptionReport = ExceptionCollector.getCriticalsReport(); - System.out.println("CRITICALS during CSAR parsing are: " + (exceptionReport != null ? exceptionReport.toString() : "none")); + //System.out.println("CRITICALS during CSAR parsing are: " + (exceptionReport != null ? exceptionReport.toString() : "none")); List warningsReport = ExceptionCollector.getWarningsReport(); - System.out.println("WARNINGS during CSAR parsing are: " + (warningsReport != null ? warningsReport.toString() : "none")); + //System.out.println("WARNINGS during CSAR parsing are: " + (warningsReport != null ? warningsReport.toString() : "none")); if (!exceptionReport.isEmpty()) { diff --git a/sdc-distribution-client/pom.xml b/sdc-distribution-client/pom.xml index d7f0ea7..2047ff3 100644 --- a/sdc-distribution-client/pom.xml +++ b/sdc-distribution-client/pom.xml @@ -6,7 +6,7 @@ org.openecomp.sdc.sdc-distribution-client sdc-main-distribution-client - 1.1.10-SNAPSHOT + 1.1.13-SNAPSHOT sdc-distribution-client @@ -137,7 +137,7 @@ com.google.guava guava - 15.0 + ${guava.version} test diff --git a/sdc-tosca-parser/pom.xml b/sdc-tosca-parser/pom.xml index f027a96..d6b0bb8 100644 --- a/sdc-tosca-parser/pom.xml +++ b/sdc-tosca-parser/pom.xml @@ -6,14 +6,14 @@ org.openecomp.sdc.sdc-distribution-client sdc-main-distribution-client - 1.1.10-SNAPSHOT + 1.1.13-SNAPSHOT sdc-tosca-parser SDC Tosca Parser Tosca Parser JAR file for use by consumers jar - + @@ -58,7 +58,7 @@ ${snakeyaml.version} compile - + org.apache.commons @@ -66,12 +66,19 @@ 3.5 compile + + + com.google.guava + guava + ${guava.version} + compile + org.openecomp.sdc.sdc-distribution-client jtosca - 0.1.3-SNAPSHOT + 0.1.6-SNAPSHOT @@ -90,12 +97,12 @@ test - - - - - - + + + + + + org.testng @@ -111,19 +118,8 @@ test - - com.google.guava - guava - 15.0 - - - - + 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 e1c1802..fd5a435 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 @@ -96,7 +96,7 @@ public interface ISdcCsarHelper { * will return "false". * @param nodeTemplate - nodeTemplate where the property should be looked up. * @param pathToPropertyLeafValue - the full path of the required property. - * @return the leaf value as Object, or null if there's no such property, or it's not a leaf. + * @return the leaf value as Object, or null if there's no such property. It's up to the caller to cast it to a proper type. */ public Object getNodeTemplatePropertyAsObject(NodeTemplate nodeTemplate, String pathToPropertyLeafValue); @@ -110,11 +110,11 @@ public interface ISdcCsarHelper { public String getGroupPropertyLeafValue(Group group, String propertyName); /** - * Get any property leaf value for a group definition by full path separated by #. + * Get any property value for a group definition by full path separated by #. * Same logic as in {@link #getNodeTemplatePropertyLeafValue(NodeTemplate, String) getNodeTemplatePropertyLeafValue}, only for a group. * @param group - group where the property should be looked up. * @param propertyName - the name of the required property. - * @return the leaf value as Object, or null if there's no such property, or it's not a leaf. + * @return the leaf value as Object, or null if there's no such property. It's up to the caller to cast it to a proper type. */ public Object getGroupPropertyAsObject(Group group, String propertyName); @@ -174,7 +174,7 @@ public interface ISdcCsarHelper { * 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 as Service. + * @return input value for the service as Object. It's up to the caller to cast it to a proper type. */ public Object getServiceInputLeafValueOfDefaultAsObject(String inputLeafValuePath); @@ -292,14 +292,25 @@ public interface ISdcCsarHelper { public List getServiceInputs(); - + /** + * Get the conformance level of this CSAR.
+ * The conformance level value of the CSAR is located in csar.meta file at the top level of the CSAR file.
+ * For 1707 CSARs, the conformance level is 3.0. + * @return the conformance level of the CSAR. + */ public String getConformanceLevel(); /** - * Get the map of CP-related props from - * @param vfc - VFC to look for CP-related props. - * @return map of CP node template name to a map of CP-related properties key-value for this CP. + * Get the map of CP-related props from a VFC node template.
+ * Let's say there are 5 CPs related to this VFC. Then the output will look like this:

+ * {port_fe1_sigtran={ip_requirements#ip_count_required#count=1, ip_requirements#dhcp_enabled=true, ip_requirements#ip_version=4, subnetpoolid="subnet_1", network_role_tag="SIGNET_vrf_B1_direct"},
+ * port_fe_cluster={ip_requirements#ip_count_required#count=2, ip_requirements#dhcp_enabled=true, ip_requirements#ip_version=4},
+ * port_fe_slan={ip_requirements#ip_count_required#count=1, ip_requirements#dhcp_enabled=true, ip_requirements#ip_version=4},
+ * port_fe_interce={ip_requirements#ip_count_required#count=1, ip_requirements#dhcp_enabled=true, ip_requirements#ip_version=4},
+ * port_fe_oam={ip_requirements#ip_count_required#count=2, ip_requirements#dhcp_enabled=true, ip_requirements#ip_version=4, subnetpoolid="subnet_2", network_role_tag="Mobility_OAM_protected"}}

+ * @param vfc - VFC node template to look for CP-related props. + * @return map to a map of . */ public Map> getCpPropertiesFromVfc(NodeTemplate vfc); } -- cgit 1.2.3-korg