aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java
diff options
context:
space:
mode:
authorPavel Aharoni <pa0916@att.com>2017-07-17 16:26:48 +0300
committerPavel Aharoni <pa0916@att.com>2017-07-17 16:27:08 +0300
commit9f2d31d8cb8c4e28c3b1bea809867d39df36e502 (patch)
tree3bd56754012ad9b54bde3e7f51c62d2d7ecff41b /src/main/java
parentf118ea26bcea3a3d9af27faa7d54e895a0202dcf (diff)
[SDC-136] support CVFC type
Change-Id: I36af758d5bff633972245d7100a8c892a47527fb Signed-off-by: Pavel Aharoni <pa0916@att.com>
Diffstat (limited to 'src/main/java')
-rw-r--r--src/main/java/org/openecomp/sdc/tosca/parser/api/ISdcCsarHelper.java9
-rw-r--r--src/main/java/org/openecomp/sdc/tosca/parser/impl/SdcCsarHelperImpl.java21
-rw-r--r--src/main/java/org/openecomp/sdc/tosca/parser/impl/SdcTypes.java10
3 files changed, 36 insertions, 4 deletions
diff --git a/src/main/java/org/openecomp/sdc/tosca/parser/api/ISdcCsarHelper.java b/src/main/java/org/openecomp/sdc/tosca/parser/api/ISdcCsarHelper.java
index 45d8392..6c8f5df 100644
--- a/src/main/java/org/openecomp/sdc/tosca/parser/api/ISdcCsarHelper.java
+++ b/src/main/java/org/openecomp/sdc/tosca/parser/api/ISdcCsarHelper.java
@@ -368,6 +368,11 @@ public interface ISdcCsarHelper {
* @return VNF Configuration Node Template.
*/
public NodeTemplate getVnfConfig(String vfCustomizationUuid);
-
-
+
+ /**
+ * Check if Node Template has Topology Template
+ * @param nodeTemplate - Node Template to check
+ * @return true if node template has topology template, false if not.
+ */
+ public boolean hasTopology(NodeTemplate nodeTemplate);
}
diff --git a/src/main/java/org/openecomp/sdc/tosca/parser/impl/SdcCsarHelperImpl.java b/src/main/java/org/openecomp/sdc/tosca/parser/impl/SdcCsarHelperImpl.java
index 0ed4c97..7b901ec 100644
--- a/src/main/java/org/openecomp/sdc/tosca/parser/impl/SdcCsarHelperImpl.java
+++ b/src/main/java/org/openecomp/sdc/tosca/parser/impl/SdcCsarHelperImpl.java
@@ -215,7 +215,10 @@ public class SdcCsarHelperImpl implements ISdcCsarHelper {
List<NodeTemplate> serviceVfList = getServiceVfList();
NodeTemplate vfInstance = getNodeTemplateByCustomizationUuid(serviceVfList, vfCustomizationId);
- return getNodeTemplateBySdcType(vfInstance, SdcTypes.VFC);
+ List<NodeTemplate> vfcs = getNodeTemplateBySdcType(vfInstance, SdcTypes.VFC);
+ vfcs.addAll(getNodeTemplateBySdcType(vfInstance, SdcTypes.CVFC));
+
+ return vfcs;
}
@Override
@@ -649,6 +652,22 @@ public class SdcCsarHelperImpl implements ISdcCsarHelper {
return vnfConfig;
}
+ @Override
+ public boolean hasTopology(NodeTemplate nodeTemplate) {
+ if (nodeTemplate == null) {
+ log.error("hasTopology - nodeTemplate - is null");
+ return false;
+ }
+
+ if (nodeTemplate.getMetaData() != null) {
+ String type = nodeTemplate.getMetaData().getValue("type");
+ log.debug("hasTopology - node template {} is a {} type", nodeTemplate.getName(), type);
+ return SdcTypes.isComplex(SdcTypes.valueOf(type));
+ }
+
+ return false;
+ }
+
/************************************* helper functions ***********************************/
private Map<String, String> filterProperties(Object property, String path, FilterType filterType, String pattern, Map<String, String> filterMap) {
diff --git a/src/main/java/org/openecomp/sdc/tosca/parser/impl/SdcTypes.java b/src/main/java/org/openecomp/sdc/tosca/parser/impl/SdcTypes.java
index 5b68aea..9f885f4 100644
--- a/src/main/java/org/openecomp/sdc/tosca/parser/impl/SdcTypes.java
+++ b/src/main/java/org/openecomp/sdc/tosca/parser/impl/SdcTypes.java
@@ -20,8 +20,16 @@
package org.openecomp.sdc.tosca.parser.impl;
+import java.util.Arrays;
+import java.util.List;
+
public enum SdcTypes {
- CP, VL, VF, VFC, PNF, SERVICE
+ CP, VL, VF, VFC, PNF, SERVICE, CVFC;
+
+ public static List<SdcTypes> complexTypes = Arrays.asList(VF, PNF, SERVICE, CVFC);
+ public static boolean isComplex(SdcTypes sdcType) {
+ return complexTypes.contains(sdcType);
+ }
}