summaryrefslogtreecommitdiffstats
path: root/sdc-tosca-parser
diff options
context:
space:
mode:
authorPavel Aharoni <pa0916@att.com>2017-03-29 13:35:45 +0300
committerPavel Aharoni <pa0916@att.com>2017-03-29 13:35:45 +0300
commite2cc2530fc6d54ebc975c01a4ff887ce12f0a736 (patch)
tree38385867295c8a09fb0d7f8eaf5fa78179e5b13a /sdc-tosca-parser
parentbccebaa9888906f8ff78172f62ec592956066d82 (diff)
[SDC-6] sdc-distribution-client 1707 rebasing
Change-Id: I322a05fd79beb6ba4fee4d32afffecf531b86e98 Signed-off-by: Pavel Aharoni <pa0916@att.com>
Diffstat (limited to 'sdc-tosca-parser')
-rw-r--r--sdc-tosca-parser/pom.xml116
-rw-r--r--sdc-tosca-parser/src/main/java/org/openecomp/sdc/tosca/parser/api/ISdcCsarHelper.java240
-rw-r--r--sdc-tosca-parser/src/main/java/org/openecomp/sdc/tosca/parser/exceptions/SdcToscaParserException.java9
-rw-r--r--sdc-tosca-parser/src/main/java/org/openecomp/sdc/tosca/parser/impl/SdcCsarHelperImpl.java193
-rw-r--r--sdc-tosca-parser/src/main/java/org/openecomp/sdc/tosca/parser/impl/SdcPropertyNames.java109
-rw-r--r--sdc-tosca-parser/src/main/java/org/openecomp/sdc/tosca/parser/impl/Types.java32
6 files changed, 699 insertions, 0 deletions
diff --git a/sdc-tosca-parser/pom.xml b/sdc-tosca-parser/pom.xml
new file mode 100644
index 0000000..ffd439d
--- /dev/null
+++ b/sdc-tosca-parser/pom.xml
@@ -0,0 +1,116 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.openecomp.sdc</groupId>
+ <artifactId>sdc-main-distribution-client</artifactId>
+ <version>1.1.0-SNAPSHOT</version>
+ </parent>
+
+ <artifactId>sdc-tosca-parser</artifactId>
+ <name>SDC Tosca Parser</name>
+ <description>Tosca Parser JAR file for use by consumers</description>
+ <packaging>jar</packaging>
+
+
+ <dependencies>
+
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-api</artifactId>
+ <version>1.7.10</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>com.google.code.gson</groupId>
+ <artifactId>gson</artifactId>
+ <version>2.3.1</version>
+ <scope>compile</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.functionaljava</groupId>
+ <artifactId>functionaljava</artifactId>
+ <version>4.2</version>
+ <scope>compile</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>commons-io</groupId>
+ <artifactId>commons-io</artifactId>
+ <version>2.5</version>
+ <scope>compile</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>commons-codec</groupId>
+ <artifactId>commons-codec</artifactId>
+ <version>1.9</version>
+ <scope>compile</scope>
+ </dependency>
+
+ <!-- YAML parser -->
+ <dependency>
+ <groupId>org.yaml</groupId>
+ <artifactId>snakeyaml</artifactId>
+ <version>${snakeyaml.version}</version>
+ <scope>compile</scope>
+ </dependency>
+
+ <!-- Apache Commons -->
+ <dependency>
+ <groupId>org.apache.commons</groupId>
+ <artifactId>commons-lang3</artifactId>
+ <version>3.5</version>
+ <scope>compile</scope>
+ </dependency>
+
+ <!-- Jython Tosca Parser -->
+ <dependency>
+ <groupId>org.openecomp.sdc</groupId>
+ <artifactId>jython-tosca-parser</artifactId>
+ <version>0.3.1-SNAPSHOT</version>
+ </dependency>
+
+
+ <!-- TEST -->
+ <dependency>
+ <groupId>org.eclipse.jetty</groupId>
+ <artifactId>jetty-servlet</artifactId>
+ <scope>test</scope>
+ <version>9.2.10.v20150310</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.eclipse.jetty</groupId>
+ <artifactId>jetty-webapp</artifactId>
+ <version>9.2.10.v20150310</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.12</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.mockito</groupId>
+ <artifactId>mockito-all</artifactId>
+ <version>1.10.19</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>com.google.guava</groupId>
+ <artifactId>guava</artifactId>
+ <version>15.0</version>
+ <scope>test</scope>
+ </dependency>
+
+ </dependencies>
+
+</project>
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
new file mode 100644
index 0000000..916953c
--- /dev/null
+++ b/sdc-tosca-parser/src/main/java/org/openecomp/sdc/tosca/parser/api/ISdcCsarHelper.java
@@ -0,0 +1,240 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * sdc-distribution-client
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+package org.openecomp.sdc.tosca.parser.api;
+
+
+import java.util.List;
+
+import org.apache.commons.lang3.tuple.Pair;
+import org.openecomp.sdc.toscaparser.api.Group;
+import org.openecomp.sdc.toscaparser.api.NodeTemplate;
+
+
+public interface ISdcCsarHelper {
+
+ /**
+ * Get all node templates by node_type for this CSAR service.
+ *
+ * @param nodeType - the TOSCA type of the node.
+ * @return service node templates of this type.
+ */
+ public List<NodeTemplate> getServiceNodeTemplatesByType(String nodeType);
+
+ /**
+ * Get groups of a VF with type "org.openecomp.groups.VfModule".
+ *
+ * @param vfCustomizationUuid - customizationUuid of VF instance.
+ * @return list of vfModule groups.
+ */
+ public List<Group> getVfModulesByVf(String vfCustomizationUuid);
+
+
+ /**
+ * Get any property leaf value for node template by full path separated by #.<br>
+ * For example, for node template with this property:<br><br>
+ * network_assignments:<br>
+ &nbsp;&nbsp;ecomp_generated_network_assignment: true<br>
+ &nbsp;&nbsp;is_shared_network: false<br>
+ &nbsp;&nbsp;is_external_network: false<br>
+ &nbsp;&nbsp;ipv4_subnet_default_assignments:<br>
+ &nbsp;&nbsp;&nbsp;&nbsp;use_ipv4: true<br>
+ &nbsp;&nbsp;&nbsp;&nbsp;ip_network_address_plan: 1.2.3.4<br>
+ &nbsp;&nbsp;&nbsp;&nbsp;dhcp_enabled: true<br>
+ &nbsp;&nbsp;&nbsp;&nbsp;ip_version: 4<br>
+ &nbsp;&nbsp;&nbsp;&nbsp;cidr_mask: 24<br>
+ &nbsp;&nbsp;&nbsp;&nbsp;min_subnets_count: 1<br>
+ &nbsp;&nbsp;ipv6_subnet_default_assignments:<br>
+ &nbsp;&nbsp;&nbsp;&nbsp;use_ipv6: false<br><br>
+
+ * calling<br>
+ * getNodeTemplatePropertyLeafValue(nodeTemplate, "network_assignments#ipv6_subnet_default_assignments#use_ipv6")<br>
+ * 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 String, or null if there's no such property, or it's not a leaf.
+ */
+ public String getNodeTemplatePropertyLeafValue(NodeTemplate nodeTemplate, String pathToPropertyLeafValue);
+
+ /**
+ * Get any property leaf 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 String, or null if there's no such property, or it's not a leaf.
+ */
+ public String getGroupPropertyLeafValue(Group group, String propertyName);
+
+
+ /**
+ * Get all VL node templates of the CSAR service.
+ * @return - all VL node templates.
+ */
+ public List<NodeTemplate> getServiceVlList();
+
+ /**
+ * Get all VF node templates of the CSAR service.
+ * @return - all VF node templates.
+ */
+ public List<NodeTemplate> getServiceVfList();
+
+
+ /**
+ *
+ * Get a property from a metadata object.<br>
+ * This is just sugaring method, same as calling metadata.getMetadataPropertyValue(metadataPropertyName).<br>
+ *
+ * For metadata object representing the below: <br><br>
+ *
+ * metadata:<br>
+ &nbsp;&nbsp;invariantUUID: 4598a404-00e1-42a6-8767-0bda343e2066<br>
+ &nbsp;&nbsp;UUID: e17940d6-42f8-4989-bad0-31de5addc619<br>
+ &nbsp;&nbsp;customizationUUID: 83d086b2-a861-4d3b-aa84-3bfbb9b2ec20<br>
+ &nbsp;&nbsp;version: '0.1'<br>
+ &nbsp;&nbsp;name: vIPR_ATM<br>
+ &nbsp;&nbsp;description: vIPR_ATM<br>
+ &nbsp;&nbsp;type: VF<br>
+ &nbsp;&nbsp;category: category1<br>
+ &nbsp;&nbsp;subcategory: subCategory1<br><br>
+
+ calling<br>
+ getMetadataPropertyValue(metadata,"invariantUUID")<br>
+ will return "4598a404-00e1-42a6-8767-0bda343e2066".
+
+ * @param metadata - metadata object.
+ * @param metadataPropertyName - the name of the metadata property.
+ * @return metadata property value
+ */
+ //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.
+ * @param inputLeafValuePath by full path separated by #.
+ * @return input leaf value for the service.
+ */
+ public String getServiceInputLeafValue(String inputLeafValuePath);
+
+ /**
+ * Get the type name of the CSAR service's substitution mappings element.<br>
+ *
+ * For the below:<br><br>
+ *
+ * substitution_mappings:<br>
+ &nbsp;&nbsp;type: org.openecomp.services.ViprATM<br>
+
+ calling<br>
+ getServiceSubstitutionMappingsTypeName()<br>
+ will return "org.openecomp.services.ViprATM"
+ * @return - the type name of the CSAR service's substitution mappings element
+ */
+ public String getServiceSubstitutionMappingsTypeName();
+
+ /**
+ * Get the CSAR service metadata
+ * @return - the service metadata object.
+ */
+ //public Metadata getServiceMetadata();
+
+ /**
+ * Get all VFC node templates from a specified VF.
+ * @param vfCustomizationId - customizationUuid of the VF node template.
+ * @return all VFC node templates from a specified VF
+ */
+ public List<NodeTemplate> getVfcListByVf(String vfCustomizationId);
+
+ /**
+ * Get all CP node templates from a specified VF.
+ * @param vfCustomizationId - customizationUuid of the VF node template.
+ * @return all CP node templates from a specified VF
+ */
+ public List<NodeTemplate> getCpListByVf(String vfCustomizationId);
+
+ /**
+ * Get all members of this group definition.<br>
+ *
+ * For example, for this group definition:<br><br>
+ *
+ * ViprAtm..vIPR-ATM-Base..module-0:<br>
+ &nbsp;&nbsp;type: org.openecomp.groups.VfModule<br>
+ &nbsp;&nbsp;.................<br>
+ &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.
+ *
+ */
+ public List<String> getMembersOfGroup(Group group);
+
+
+ /**
+ * Get list of node template pairs, where for each pair,<br>
+ * the left node template in pair has requirement with name reqName, <br>
+ * which should be satisfied with respective capability by the right node template in pair.<br>
+ *
+ * For example, if we have the below two node templates in the vIPR VF:<br><br>
+ *
+ * oam_extCP:<br>
+ &nbsp;&nbsp;type: org.openecomp.resources.cp.extCP<br>
+ &nbsp;&nbsp;requirements:<br>
+ &nbsp;&nbsp;&nbsp;&nbsp;- virtualBinding: vipr_atm_firewall<br><br>
+ *
+ * vipr_atm_firewall: <br>
+ &nbsp;&nbsp;type: org.openecomp.resources.vfc.ViprAtm.abstract.nodes.heat.vipr_atm<br>
+ ........<br><br>
+ *
+
+ * calling<br>
+ * getNodeTemplatePairsByReqName(getCpListByVf(viprCustomUuid), getVfcListByVf(viprCustomUuid), "virtualBinding")<br>
+ * will return a list with one Pair - where left element of pair will be "oam_extCP" node template,<br>
+ * and right element will be "vipr_atm_firewall" node template.<br>
+ *
+ * @param listOfReqNodeTemplates - list of node templates in which the "reqName" requirement should be looked.
+ * @param listOfCapNodeTemplates - list of node templates in which the capability matching the "reqName" requirement should be looked.
+ * @param reqName - the name of a requirement definition to match by.
+ * @return
+ */
+ public List<Pair<NodeTemplate,NodeTemplate>> getNodeTemplatePairsByReqName(List<NodeTemplate> listOfReqNodeTemplates, List<NodeTemplate> listOfCapNodeTemplates, String reqName);
+
+ /**
+ * Get all allotted node templates from this service.
+ * @return all allotted node templates from this service.
+ */
+ public List<NodeTemplate> getAllottedResources();
+
+ /**
+ * Get node_type of a node template.<br>
+ *
+ * For this node template:<br>
+ *
+ * vipr_atm_firewall: <br>
+ &nbsp;&nbsp;type: org.openecomp.resources.vfc.ViprAtm.abstract.nodes.heat.vipr_atm<br>
+ ........<br><br>
+ *
+ * the function will return "org.openecomp.resources.vfc.ViprAtm.abstract.nodes.heat.vipr_atm"
+ *
+ * @param nodeTemplate - node template object
+ * @return - node type string.
+ */
+ public String getTypeOfNodeTemplate(NodeTemplate nodeTemplate);
+
+}
diff --git a/sdc-tosca-parser/src/main/java/org/openecomp/sdc/tosca/parser/exceptions/SdcToscaParserException.java b/sdc-tosca-parser/src/main/java/org/openecomp/sdc/tosca/parser/exceptions/SdcToscaParserException.java
new file mode 100644
index 0000000..5d57fc9
--- /dev/null
+++ b/sdc-tosca-parser/src/main/java/org/openecomp/sdc/tosca/parser/exceptions/SdcToscaParserException.java
@@ -0,0 +1,9 @@
+package org.openecomp.sdc.tosca.parser.exceptions;
+
+public class SdcToscaParserException extends Exception{
+ /**
+ *
+ */
+ private static final long serialVersionUID = 626014844866501196L;
+
+}
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
new file mode 100644
index 0000000..0d59a4d
--- /dev/null
+++ b/sdc-tosca-parser/src/main/java/org/openecomp/sdc/tosca/parser/impl/SdcCsarHelperImpl.java
@@ -0,0 +1,193 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * sdc-distribution-client
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdc.tosca.parser.impl;
+
+import java.util.ArrayList;
+import java.util.List;
+
+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.TopologyTemplate;
+import org.openecomp.sdc.toscaparser.api.ToscaTemplate;
+import org.openecomp.sdc.tosca.parser.impl.Types;
+
+public class SdcCsarHelperImpl implements ISdcCsarHelper {
+
+ private ToscaTemplate toscaTemplate;
+
+ public SdcCsarHelperImpl(ToscaTemplate toscaTemplate) {
+ this.toscaTemplate = toscaTemplate;
+ }
+
+ @Override
+ public String getNodeTemplatePropertyLeafValue(NodeTemplate nodeTemplate, String leafValuePath) {
+ //TODO
+ return null;/*getLeafPropertyValue(nodeTemplate, leafValuePath);*/
+ }
+
+ @Override
+ public List<NodeTemplate> getServiceVlList() {
+ return getNodeTemplateBySdcType(toscaTemplate.getTopologyTemplate(), Types.TYPE_VL);
+
+ }
+
+ @Override
+ public List<NodeTemplate> getServiceVfList() {
+ return getNodeTemplateBySdcType(toscaTemplate.getTopologyTemplate(), Types.TYPE_VF);
+ }
+
+ @Override
+ public List<NodeTemplate> getServiceNodeTemplatesByType(String nodeType) {
+ List<NodeTemplate> res = new ArrayList<>();
+ List<NodeTemplate> nodeTemplates = toscaTemplate.getNodeTemplates();
+ for (NodeTemplate nodeTemplate : nodeTemplates){
+ if (nodeTemplate.getTypeDefinition().getType().equals(nodeType)){
+ res.add(nodeTemplate);
+ }
+ }
+ return res;
+ }
+
+ @Override
+ public List<NodeTemplate> getVfcListByVf(String vfCustomizationId) {
+ List<NodeTemplate> serviceVfList = getServiceVfList();
+ NodeTemplate vfInstance = getNodeTemplateByCustomizationUuid(serviceVfList, vfCustomizationId);
+ return getNodeTemplateBySdcType(vfInstance, Types.TYPE_VFC);
+ }
+
+ //Assumed to be unique property for the list
+ private NodeTemplate getNodeTemplateByCustomizationUuid(List<NodeTemplate> nodeTemplates, String customizationId){
+ //TODO Metadata is missing
+ /*for (NodeTemplate nodeTemplate : nodeTemplates){
+ if (nodeTemplate.getMetadata().getMetadataPropertyValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID).equals(customizationId)){
+ return nodeTemplate;
+ }
+ }*/
+ return null;
+ }
+
+ @Override
+ 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);
+ }
+ }*/
+ return res;
+ }
+
+ //Metadata question
+ /*@Override
+ public String getMetadataPropertyValue(Metadata metadata, String metadataPropertyName) {
+ return metadata.getMetadataPropertyValue(metadataPropertyName);
+ }*/
+
+ @Override
+ public String getServiceInputLeafValue(String inputLeafValuePath) {
+ toscaTemplate.getTopologyTemplate().getNodeTemplates().get(0).getTypeDefinition().getType();
+ return null;//getLeafPropertyValue(toscaTemplate, inputLeafValuePath);
+ }
+
+ @Override
+ public String getServiceSubstitutionMappingsTypeName() {
+ return toscaTemplate.getTopologyTemplate().getSubstitutionMappings().getNodeDefinition().getType();
+ }
+
+ //Metadata question
+ /*@Override
+ public Metadata getServiceMetadata() {
+ return toscaTemplate.getMetadata();
+ }*/
+
+ //Get property from group
+ @Override
+ public String getGroupPropertyLeafValue(Group group, String propertyName) {
+ return null;//getLeafPropertyValue(group, propertyName);
+ }
+
+ 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;
+ }
+
+ private List<NodeTemplate> getNodeTemplateBySdcType(TopologyTemplate topologyTemplate, String sdcType){
+ //Need metadata to fetch by type
+
+/* List<NodeTemplate> nodeTemplates = topologyTemplate.getNodeTemplates();
+ 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
+ public List<NodeTemplate> getCpListByVf(String vfCustomizationId) {
+ List<NodeTemplate> serviceVfList = getServiceVfList();
+ NodeTemplate vfInstance = getNodeTemplateByCustomizationUuid(serviceVfList, vfCustomizationId);
+ return getNodeTemplateBySdcType(vfInstance, Types.TYPE_CP);
+ }
+
+ @Override
+ public List<String> getMembersOfGroup(Group group) {
+ //Can be done
+ return null;//toscaTemplate.getTopologyTemplate().getSubstitutionMappings().getNodeTemplates().get(0).get
+ }
+
+ @Override
+ public List<Pair<NodeTemplate, NodeTemplate>> getNodeTemplatePairsByReqName(
+ List<NodeTemplate> listOfReqNodeTemplates, List<NodeTemplate> listOfCapNodeTemplates, String reqName) {
+ //TODO - Can be done
+ return new ArrayList<>();
+ }
+
+ @Override
+ public List<NodeTemplate> getAllottedResources() {
+ //TODO - Need metadata
+ return new ArrayList<>();
+ }
+
+ @Override
+ public String getTypeOfNodeTemplate(NodeTemplate nodeTemplate) {
+ //Can be done
+ return nodeTemplate.getTypeDefinition().getType();
+ }
+
+
+}
diff --git a/sdc-tosca-parser/src/main/java/org/openecomp/sdc/tosca/parser/impl/SdcPropertyNames.java b/sdc-tosca-parser/src/main/java/org/openecomp/sdc/tosca/parser/impl/SdcPropertyNames.java
new file mode 100644
index 0000000..7d34c6f
--- /dev/null
+++ b/sdc-tosca-parser/src/main/java/org/openecomp/sdc/tosca/parser/impl/SdcPropertyNames.java
@@ -0,0 +1,109 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * sdc-distribution-client
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdc.tosca.parser.impl;
+
+public class SdcPropertyNames {
+ public static String PROPERTY_NAME_INVARIANTUUID = "invariantUUID";
+ public static String PROPERTY_NAME_UUID = "UUID";
+ public static String PROPERTY_NAME_CUSTOMIZATIONUUID = "customizationUUID";
+ public static String PROPERTY_NAME_VERSION = "version";
+
+ //Groups metadata
+ public static String PROPERTY_NAME_VFMODULEMODELINVARIANTUUID = "vfModuleModelInvariantUUID";
+ public static String PROPERTY_NAME_VFMODULEMODELUUID = "vfModuleModelUUID";
+ public static String PROPERTY_NAME_VFMODULECUSTOMIZATIONUUID = "vfModuleCustomizationUUID";
+ public static String PROPERTY_NAME_VFMODULEMODELVERSION = "vfModuleModelVersion";
+ public static String PROPERTY_NAME_VFMODULEMODELNAME = "vfModuleModelName";
+
+ //Groups properties
+ public static String PROPERTY_NAME_VFMODULETYPE = "vf_module_type";
+ public static String PROPERTY_NAME_VFMODULELABEL = "vf_module_label";
+ public static String PROPERTY_NAME_MINVFMODULEINSTANCES = "min_vf_module_instances";
+ public static String PROPERTY_NAME_MAXVFMODULEINSTANCES = "max_vf_module_instances";
+ public static String PROPERTY_NAME_INITIALCOUNT = "initial_count";
+
+
+ public static String PROPERTY_NAME_DESCRIPTION = "description";
+ public static String PROPERTY_NAME_TYPE = "type";
+ public static String PROPERTY_NAME_CATEGORY = "category";
+ public static String PROPERTY_NAME_SUBCATEGORY = "subcategory";
+ public static String PROPERTY_NAME_RESOURCEVENDOR = "resourceVendor";
+ public static String PROPERTY_NAME_RESOURCEVENDORRELEASE = "resourceVendorRelease";
+ //VFC
+ public static String PROPERTY_NAME_NFCCODE = "nfc_code";
+ public static String PROPERTY_NAME_VMTYPETAG = "vm_type_tag";
+ public static String PROPERTY_NAME_VMTYPE = "vm_type";
+ public static String PROPERTY_NAME_VFCNAMING_ECOMPGENERATEDNAMING="vfc_naming#ecomp_generated_naming";
+ public static String PROPERTY_NAME_VFCNAMING_NAMINGPOLICY="vfc_naming#naming_policy";
+ //VF
+ public static String PROPERTY_NAME_NFTYPE = "nf_type";
+ public static String PROPERTY_NAME_NFROLE = "nf_role";
+ public static String PROPERTY_NAME_NFFUNCTION = "nf_function";
+ public static String PROPERTY_NAME_NFCODE = "nf_code";
+ public static String PROPERTY_NAME_MININSTANCES = "min_instances";
+ public static String PROPERTY_NAME_MAXINSTANCES = "max_instances";
+ public static String PROPERTY_NAME_AVAILABILITYZONEMAXCOUNT = "availability_zone_max_count";
+ public static String PROPERTY_NAME_AVAILABILITYZONECOUNT = "availability_zone_count";
+ public static String PROPERTY_NAME_NAME = "name";
+ public static String PROPERTY_NAME_VNFECOMPNAMING_ECOMPGENERATEDNAMING="vnf_ecomp_naming#ecomp_generated_naming";
+ public static String PROPERTY_NAME_VNFECOMPNAMING_NAMINGPOLICY="vnf_ecomp_naming#naming_policy";
+ public static String PROPERTY_NAME_ECOMPGENERATEDVMASSIGNMENTS = "ecomp_generated_vm_assignments";
+ //Service
+ public static String PROPERTY_NAME_SERVICENAMING_DEFAULT_ECOMPGENERATEDNAMING="service_naming#default#ecomp_generated_naming";
+ public static String PROPERTY_NAME_SERVICENAMING_DEFAULT_NAMINGPOLICY="service_naming#default#naming_policy";
+ //VL
+ public static String PROPERTY_NAME_NETWORKTYPE="network_type";
+ public static String PROPERTY_NAME_NETWORKROLE="network_role";
+ public static String PROPERTY_NAME_NETWORKROLETAG="network_role_tag";
+ public static String PROPERTY_NAME_NETWORKTECHNOLOGY="network_technology";
+ public static String PROPERTY_NAME_NETWORKSCOPE="network_scope";
+ public static String PROPERTY_NAME_NETWORKECOMPNAMING_ECOMPGENERATEDNAMING="network_ecomp_naming#ecomp_generated_naming";
+ public static String PROPERTY_NAME_NETWORKECOMPNAMING_NAMINGPOLICY="network_ecomp_naming#naming_policy";
+ public static String PROPERTY_NAME_NETWORKASSIGNMENTS_ISSHAREDNETWORK="network_assignments#is_shared_network";
+ public static String PROPERTY_NAME_NETWORKASSIGNMENTS_ISEXTERNALNETWORK="network_assignments#is_external_network";
+ public static String PROPERTY_NAME_NETWORKASSIGNMENTS_IPV4SUBNETDEFAULTASSIGNMENTS_ECOMPGENERATEDNETWORKASSIGNMENT="network_assignments#ecomp_generated_network_assignment";
+ public static String PROPERTY_NAME_NETWORKASSIGNMENTS_IPV4SUBNETDEFAULTASSIGNMENTS_USEIPV4="network_assignments#ipv4_subnet_default_assignments#use_ipv4";
+ public static String PROPERTY_NAME_NETWORKASSIGNMENTS_IPV4SUBNETDEFAULTASSIGNMENTS_IPNETWORKADDRESSPLAN="network_assignments#ipv4_subnet_default_assignments#ip_network_address_plan";
+ public static String PROPERTY_NAME_NETWORKASSIGNMENTS_IPV4SUBNETDEFAULTASSIGNMENTS_DHCPENABLED="network_assignments#ipv4_subnet_default_assignments#dhcp_enabled";
+ public static String PROPERTY_NAME_NETWORKASSIGNMENTS_IPV4SUBNETDEFAULTASSIGNMENTS_IPVERSION="network_assignments#ipv4_subnet_default_assignments#ip_version";
+ public static String PROPERTY_NAME_NETWORKASSIGNMENTS_IPV4SUBNETDEFAULTASSIGNMENTS_CIDRMASK="network_assignments#ipv4_subnet_default_assignments#cidr_mask";
+ public static String PROPERTY_NAME_NETWORKASSIGNMENTS_IPV4SUBNETDEFAULTASSIGNMENTS_MINSUBNETSCOUNT="network_assignments#ipv4_subnet_default_assignments#min_subnets_count";
+ public static String PROPERTY_NAME_NETWORKASSIGNMENTS_IPV6SUBNETDEFAULTASSIGNMENTS_USEIPV6="network_assignments#ipv6_subnet_default_assignments#use_ipv6";
+ public static String PROPERTY_NAME_NETWORKASSIGNMENTS_IPV6SUBNETDEFAULTASSIGNMENTS_IPNETWORKADDRESSPLAN="network_assignments#ipv6_subnet_default_assignments#ip_network_address_plan";
+ public static String PROPERTY_NAME_NETWORKASSIGNMENTS_IPV6SUBNETDEFAULTASSIGNMENTS_DHCPENABLED="network_assignments#ipv6_subnet_default_assignments#dhcp_enabled";
+ public static String PROPERTY_NAME_NETWORKASSIGNMENTS_IPV6SUBNETDEFAULTASSIGNMENTS_IPVERSION="network_assignments#ipv6_subnet_default_assignments#ip_version";
+ public static String PROPERTY_NAME_NETWORKASSIGNMENTS_IPV6SUBNETDEFAULTASSIGNMENTS_CIDRMASK="network_assignments#ipv6_subnet_default_assignments#cidr_mask";
+ public static String PROPERTY_NAME_NETWORKASSIGNMENTS_IPV6SUBNETDEFAULTASSIGNMENTS_MINSUBNETSCOUNT="network_assignments#ipv6_subnet_default_assignments#min_subnets_count";
+
+ /*public static String PROPERTY_NAME_NETWORKASSIGNMENTS_PROVIDERNETWORK_ISPROVIDERNETWORK="network_assignments#provider_network#is_provider_network";
+ public static String PROPERTY_NAME_NETWORKASSIGNMENTS_PROVIDERNETWORK_PHYSICALNETWORKNAME="network_assignments#provider_network#physical_network_name";
+ public static String PROPERTY_NAME_NETWORKASSIGNMENTS_PROVIDERNETWORK_NUMA="network_assignments#provider_network#numa";
+ public static String PROPERTY_NAME_NETWORKASSIGNMENTS_PROVIDERNETWORK_PNICINSTANCE="network_assignments#provider_network#pnic_instance";
+ */
+
+ public static String PROPERTY_NAME_PROVIDERNETWORK_ISPROVIDERNETWORK="provider_network#is_provider_network";
+ public static String PROPERTY_NAME_PROVIDERNETWORK_PHYSICALNETWORKNAME="provider_network#physical_network_name";
+ public static String PROPERTY_NAME_PROVIDERNETWORK_NUMA="provider_network#numa";
+ public static String PROPERTY_NAME_PROVIDERNETWORK_PNICINSTANCE="provider_network#pnic_instance";
+
+ public static String PROPERTY_NAME_NETWORKFLOWS_ISBOUNDTOVPN="network_flows#is_bound_to_vpn";
+ public static String PROPERTY_NAME_NETWORKFLOWS_VPNBINDING="network_flows#vpn_binding";
+}
diff --git a/sdc-tosca-parser/src/main/java/org/openecomp/sdc/tosca/parser/impl/Types.java b/sdc-tosca-parser/src/main/java/org/openecomp/sdc/tosca/parser/impl/Types.java
new file mode 100644
index 0000000..9e71476
--- /dev/null
+++ b/sdc-tosca-parser/src/main/java/org/openecomp/sdc/tosca/parser/impl/Types.java
@@ -0,0 +1,32 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * sdc-distribution-client
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdc.tosca.parser.impl;
+
+public class Types {
+ public static String TYPE_VFMODULE = "org.openecomp.groups.VfModule";
+
+ // types found under metadata, type property
+ public static String TYPE_CP = "CP";
+ public static String TYPE_VL = "VL";
+ public static String TYPE_VF = "VF";
+ public static String TYPE_VFC = "VFC";
+ public static String TYPE_SERVICE = "Service";
+}