Interface definition 95/35995/3
authortalio <tali.orenbach@amdocs.com>
Thu, 15 Mar 2018 12:46:20 +0000 (14:46 +0200)
committertalio <tali.orenbach@amdocs.com>
Thu, 15 Mar 2018 14:54:28 +0000 (16:54 +0200)
Add separate Interface definition for node type and node template

Change-Id: I0c4446227dd096959158fd4a4741cb5aa043e495
Issue-ID: SDC-1043
Signed-off-by: talio <tali.orenbach@amdocs.com>
18 files changed:
common/openecomp-tosca-datatype/src/main/java/org/openecomp/sdc/tosca/datatypes/model/Implementation.java [new file with mode: 0644]
common/openecomp-tosca-datatype/src/main/java/org/openecomp/sdc/tosca/datatypes/model/InterfaceDefinition.java
common/openecomp-tosca-datatype/src/main/java/org/openecomp/sdc/tosca/datatypes/model/InterfaceDefinitionTemplate.java [new file with mode: 0644]
common/openecomp-tosca-datatype/src/main/java/org/openecomp/sdc/tosca/datatypes/model/InterfaceDefinitionType.java [new file with mode: 0644]
common/openecomp-tosca-datatype/src/main/java/org/openecomp/sdc/tosca/datatypes/model/InterfaceType.java
common/openecomp-tosca-datatype/src/main/java/org/openecomp/sdc/tosca/datatypes/model/NodeTemplate.java
common/openecomp-tosca-datatype/src/main/java/org/openecomp/sdc/tosca/datatypes/model/OperationDefinition.java
common/openecomp-tosca-datatype/src/main/java/org/openecomp/sdc/tosca/datatypes/model/OperationDefinitionTemplate.java [new file with mode: 0644]
common/openecomp-tosca-datatype/src/main/java/org/openecomp/sdc/tosca/datatypes/model/OperationDefinitionType.java [new file with mode: 0644]
openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/resources/mock/heat/nested/nestedwithoutNodeTemplates/expectedoutputfiles/module_1_perimeta_swmu_a_childServiceTemplate.yaml
openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/resources/mock/heat/nested/nestedwithoutNodeTemplates/expectedoutputfiles/module_1_perimeta_swmu_b_childServiceTemplate.yaml
openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/resources/mock/heat/nested/nestedwithoutNodeTemplates/expectedoutputfiles/module_2_perimeta_sw_a_childServiceTemplate.yaml
openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/resources/mock/heat/nested/nestedwithoutNodeTemplates/expectedoutputfiles/module_2_perimeta_sw_b_childServiceTemplate.yaml
openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/main/java/org/openecomp/core/impl/ToscaConverterImpl.java
openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/services/DataModelUtil.java
openecomp-be/lib/openecomp-tosca-lib/src/test/java/org/openecomp/sdc/tosca/datatypes/ToscaModelTest.java
openecomp-be/lib/openecomp-tosca-lib/src/test/resources/mock/model/serviceTemplateWithInterfaceAndOperation.yaml
openecomp-be/lib/openecomp-tosca-lib/src/test/resources/mock/model/serviceTemplateWithNodeTemplateInterface.yaml

diff --git a/common/openecomp-tosca-datatype/src/main/java/org/openecomp/sdc/tosca/datatypes/model/Implementation.java b/common/openecomp-tosca-datatype/src/main/java/org/openecomp/sdc/tosca/datatypes/model/Implementation.java
new file mode 100644 (file)
index 0000000..cb79691
--- /dev/null
@@ -0,0 +1,61 @@
+/*
+ * Copyright © 2016-2018 European Support Limited
+ *
+ * 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.
+ */
+package org.openecomp.sdc.tosca.datatypes.model;
+
+import java.util.List;
+import java.util.Objects;
+
+
+public class Implementation {
+
+  private String primary;
+  private List<String> dependencies;
+
+  public String getPrimary() {
+    return primary;
+  }
+
+  public void setPrimary(String primary) {
+    this.primary = primary;
+  }
+
+  public List<String> getDependencies() {
+    return dependencies;
+  }
+
+  public void setDependencies(List<String> dependencies) {
+    this.dependencies = dependencies;
+  }
+
+  @Override
+  public boolean equals(Object o) {
+    if (this == o) {
+      return true;
+    }
+    if (!(o instanceof Implementation)) {
+      return false;
+    }
+    Implementation that = (Implementation) o;
+    return Objects.equals(primary, that.primary) &&
+        Objects.equals(dependencies, that.dependencies);
+  }
+
+  @Override
+  public int hashCode() {
+
+    return Objects.hash(primary, dependencies);
+  }
+}
index 745f49d..2f629ef 100644 (file)
@@ -1,9 +1,6 @@
-/*-
- * ============LICENSE_START=======================================================
- * SDC
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
+/*
+ * Copyright © 2016-2018 European Support Limited
+ *
  * 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
  * 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.datatypes.model;
 
 import org.apache.commons.collections4.MapUtils;
 
 import java.util.HashMap;
 import java.util.Map;
-import java.util.Objects;
 
 public class InterfaceDefinition {
-
-  private String type;
-  private Map<String, PropertyDefinition> inputs;
-  private Map<String, OperationDefinition> operations;
-
-  public String getType() {
-    return type;
-  }
-
-  public void setType(String type) {
-    this.type = type;
-  }
-
-  public Map<String, PropertyDefinition> getInputs() {
-    return inputs;
-  }
-
-  public void setInputs(
-      Map<String, PropertyDefinition> inputs) {
-    this.inputs = inputs;
-  }
+  protected Map<String, OperationDefinition> operations;
 
   public Map<String, OperationDefinition> getOperations() {
     return operations;
   }
 
+  public void setOperations(
+      Map<String, OperationDefinition> operations) {
+    this.operations = operations;
+  }
+
   public void addOperation(String operationName, OperationDefinition operationDefinition) {
     if (MapUtils.isEmpty(this.operations)) {
       this.operations = new HashMap<>();
@@ -68,14 +47,15 @@ public class InterfaceDefinition {
     if (!(o instanceof InterfaceDefinition)) {
       return false;
     }
+
     InterfaceDefinition that = (InterfaceDefinition) o;
-    return Objects.equals(type, that.type) &&
-        Objects.equals(inputs, that.inputs) &&
-        Objects.equals(operations, that.operations);
+
+    return getOperations() != null ? getOperations().equals(that.getOperations())
+        : that.getOperations() == null;
   }
 
   @Override
   public int hashCode() {
-    return Objects.hash(type, inputs, operations);
+    return getOperations() != null ? getOperations().hashCode() : 0;
   }
 }
diff --git a/common/openecomp-tosca-datatype/src/main/java/org/openecomp/sdc/tosca/datatypes/model/InterfaceDefinitionTemplate.java b/common/openecomp-tosca-datatype/src/main/java/org/openecomp/sdc/tosca/datatypes/model/InterfaceDefinitionTemplate.java
new file mode 100644 (file)
index 0000000..85dc0c5
--- /dev/null
@@ -0,0 +1,55 @@
+/*
+ * Copyright © 2016-2018 European Support Limited
+ *
+ * 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.
+ */
+
+package org.openecomp.sdc.tosca.datatypes.model;
+
+import java.util.Map;
+import java.util.Objects;
+
+public class InterfaceDefinitionTemplate extends InterfaceDefinition {
+
+  private Map<String, Object> inputs;
+
+  public Map<String, Object> getInputs() {
+    return inputs;
+  }
+
+  public void setInputs(
+      Map<String, Object> inputs) {
+    this.inputs = inputs;
+  }
+
+  @Override
+  public boolean equals(Object o) {
+    if (this == o) {
+      return true;
+    }
+    if (!(o instanceof InterfaceDefinitionTemplate)) {
+      return false;
+    }
+    if (!super.equals(o)) {
+      return false;
+    }
+    InterfaceDefinitionTemplate that = (InterfaceDefinitionTemplate) o;
+    return Objects.equals(inputs, that.inputs);
+  }
+
+  @Override
+  public int hashCode() {
+
+    return Objects.hash(super.hashCode(), inputs);
+  }
+}
diff --git a/common/openecomp-tosca-datatype/src/main/java/org/openecomp/sdc/tosca/datatypes/model/InterfaceDefinitionType.java b/common/openecomp-tosca-datatype/src/main/java/org/openecomp/sdc/tosca/datatypes/model/InterfaceDefinitionType.java
new file mode 100644 (file)
index 0000000..fdd1109
--- /dev/null
@@ -0,0 +1,65 @@
+/*
+ * Copyright © 2016-2018 European Support Limited
+ *
+ * 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.
+ */
+
+package org.openecomp.sdc.tosca.datatypes.model;
+
+import java.util.Map;
+import java.util.Objects;
+
+public class InterfaceDefinitionType extends InterfaceDefinition {
+
+  private String type;
+  private Map<String, PropertyDefinition> inputs;
+
+  public String getType() {
+    return type;
+  }
+
+  public void setType(String type) {
+    this.type = type;
+  }
+
+  public Map<String, PropertyDefinition> getInputs() {
+    return inputs;
+  }
+
+  public void setInputs(
+      Map<String, PropertyDefinition> inputs) {
+    this.inputs = inputs;
+  }
+
+  @Override
+  public boolean equals(Object o) {
+    if (this == o) {
+      return true;
+    }
+    if (!(o instanceof InterfaceDefinitionType)) {
+      return false;
+    }
+    if (!super.equals(o)) {
+      return false;
+    }
+    InterfaceDefinitionType that = (InterfaceDefinitionType) o;
+    return Objects.equals(type, that.type) &&
+        Objects.equals(inputs, that.inputs);
+  }
+
+  @Override
+  public int hashCode() {
+
+    return Objects.hash(super.hashCode(), type, inputs);
+  }
+}
index 22d8e7c..f32ebc3 100644 (file)
@@ -24,6 +24,7 @@ import org.apache.commons.collections4.MapUtils;
 
 import java.util.HashMap;
 import java.util.Map;
+import java.util.Objects;
 
 public class InterfaceType {
   private String derived_from;
@@ -98,40 +99,18 @@ public class InterfaceType {
     if (!(o instanceof InterfaceType)) {
       return false;
     }
-
     InterfaceType that = (InterfaceType) o;
-
-    if (getDerived_from() != null ? !getDerived_from().equals(that.getDerived_from())
-        : that.getDerived_from() != null) {
-      return false;
-    }
-    if (getVersion() != null ? !getVersion().equals(that.getVersion())
-        : that.getVersion() != null) {
-      return false;
-    }
-    if (getMetadata() != null ? !getMetadata().equals(that.getMetadata())
-        : that.getMetadata() != null) {
-      return false;
-    }
-    if (getDescription() != null ? !getDescription().equals(that.getDescription())
-        : that.getDescription() != null) {
-      return false;
-    }
-    if (getInputs() != null ? !getInputs().equals(that.getInputs()) : that.getInputs() != null) {
-      return false;
-    }
-    return getOperations() != null ? getOperations().equals(that.getOperations())
-        : that.getOperations() == null;
+    return Objects.equals(derived_from, that.derived_from) &&
+        Objects.equals(version, that.version) &&
+        Objects.equals(metadata, that.metadata) &&
+        Objects.equals(description, that.description) &&
+        Objects.equals(inputs, that.inputs) &&
+        Objects.equals(operations, that.operations);
   }
 
   @Override
   public int hashCode() {
-    int result = getDerived_from() != null ? getDerived_from().hashCode() : 0;
-    result = 31 * result + (getVersion() != null ? getVersion().hashCode() : 0);
-    result = 31 * result + (getMetadata() != null ? getMetadata().hashCode() : 0);
-    result = 31 * result + (getDescription() != null ? getDescription().hashCode() : 0);
-    result = 31 * result + (getInputs() != null ? getInputs().hashCode() : 0);
-    result = 31 * result + (getOperations() != null ? getOperations().hashCode() : 0);
-    return result;
+
+    return Objects.hash(derived_from, version, metadata, description, inputs, operations);
   }
 }
index 01b1c6a..6ce1ce0 100644 (file)
@@ -24,6 +24,7 @@ import org.openecomp.sdc.tosca.services.YamlUtil;
 
 import java.util.List;
 import java.util.Map;
+import java.util.Objects;
 
 
 public class NodeTemplate implements Template {
@@ -151,57 +152,26 @@ public class NodeTemplate implements Template {
     if (!(o instanceof NodeTemplate)) {
       return false;
     }
-
     NodeTemplate that = (NodeTemplate) o;
-
-    if (type != null ? !type.equals(that.type) : that.type != null) {
-      return false;
-    }
-    if (description != null ? !description.equals(that.description) : that.description != null) {
-      return false;
-    }
-    if (directives != null ? !directives.equals(that.directives) : that.directives != null) {
-      return false;
-    }
-    if (properties != null ? !properties.equals(that.properties) : that.properties != null) {
-      return false;
-    }
-    if (attributes != null ? !attributes.equals(that.attributes) : that.attributes != null) {
-      return false;
-    }
-    if (requirements != null ? !requirements.equals(that.requirements)
-        : that.requirements != null) {
-      return false;
-    }
-    if (capabilities != null ? !capabilities.equals(that.capabilities)
-        : that.capabilities != null) {
-      return false;
-    }
-    if (interfaces != null ? !interfaces.equals(that.interfaces) : that.interfaces != null) {
-      return false;
-    }
-    if (artifacts != null ? !artifacts.equals(that.artifacts) : that.artifacts != null) {
-      return false;
-    }
-    if (node_filter != null ? !node_filter.equals(that.node_filter) : that.node_filter != null) {
-      return false;
-    }
-    return copy != null ? copy.equals(that.copy) : that.copy == null;
+    return Objects.equals(type, that.type) &&
+        Objects.equals(description, that.description) &&
+        Objects.equals(metadata, that.metadata) &&
+        Objects.equals(directives, that.directives) &&
+        Objects.equals(properties, that.properties) &&
+        Objects.equals(attributes, that.attributes) &&
+        Objects.equals(requirements, that.requirements) &&
+        Objects.equals(capabilities, that.capabilities) &&
+        Objects.equals(interfaces, that.interfaces) &&
+        Objects.equals(artifacts, that.artifacts) &&
+        Objects.equals(node_filter, that.node_filter) &&
+        Objects.equals(copy, that.copy);
   }
 
   @Override
   public int hashCode() {
-    int result = type != null ? type.hashCode() : 0;
-    result = 31 * result + (description != null ? description.hashCode() : 0);
-    result = 31 * result + (directives != null ? directives.hashCode() : 0);
-    result = 31 * result + (properties != null ? properties.hashCode() : 0);
-    result = 31 * result + (attributes != null ? attributes.hashCode() : 0);
-    result = 31 * result + (requirements != null ? requirements.hashCode() : 0);
-    result = 31 * result + (capabilities != null ? capabilities.hashCode() : 0);
-    result = 31 * result + (interfaces != null ? interfaces.hashCode() : 0);
-    result = 31 * result + (artifacts != null ? artifacts.hashCode() : 0);
-    result = 31 * result + (node_filter != null ? node_filter.hashCode() : 0);
-    result = 31 * result + (copy != null ? copy.hashCode() : 0);
-    return result;
+
+    return Objects
+        .hash(type, description, metadata, directives, properties, attributes, requirements,
+            capabilities, interfaces, artifacts, node_filter, copy);
   }
 }
index 591e94e..bdfe937 100644 (file)
@@ -1,12 +1,10 @@
 package org.openecomp.sdc.tosca.datatypes.model;
 
-import java.util.Map;
+import java.util.Objects;
 
 public class OperationDefinition {
 
-  private String description;
-  private String implementation;
-  private Map<String, PropertyDefinition> inputs;
+  protected String description;
 
   public String getDescription() {
     return description;
@@ -16,23 +14,6 @@ public class OperationDefinition {
     this.description = description;
   }
 
-  public String getImplementation() {
-    return implementation;
-  }
-
-  public void setImplementation(String implementation) {
-    this.implementation = implementation;
-  }
-
-  public Map<String, PropertyDefinition> getInputs() {
-    return inputs;
-  }
-
-  public void setInputs(
-      Map<String, PropertyDefinition> inputs) {
-    this.inputs = inputs;
-  }
-
   @Override
   public boolean equals(Object o) {
     if (this == o) {
@@ -41,25 +22,13 @@ public class OperationDefinition {
     if (!(o instanceof OperationDefinition)) {
       return false;
     }
-
     OperationDefinition that = (OperationDefinition) o;
-
-    if (getDescription() != null ? !getDescription().equals(that.getDescription())
-        : that.getDescription() != null) {
-      return false;
-    }
-    if (getImplementation() != null ? !getImplementation().equals(that.getImplementation())
-        : that.getImplementation() != null) {
-      return false;
-    }
-    return getInputs() != null ? getInputs().equals(that.getInputs()) : that.getInputs() == null;
+    return Objects.equals(description, that.description);
   }
 
   @Override
   public int hashCode() {
-    int result = getDescription() != null ? getDescription().hashCode() : 0;
-    result = 31 * result + (getImplementation() != null ? getImplementation().hashCode() : 0);
-    result = 31 * result + (getInputs() != null ? getInputs().hashCode() : 0);
-    return result;
+
+    return Objects.hash(description);
   }
 }
diff --git a/common/openecomp-tosca-datatype/src/main/java/org/openecomp/sdc/tosca/datatypes/model/OperationDefinitionTemplate.java b/common/openecomp-tosca-datatype/src/main/java/org/openecomp/sdc/tosca/datatypes/model/OperationDefinitionTemplate.java
new file mode 100644 (file)
index 0000000..155175a
--- /dev/null
@@ -0,0 +1,45 @@
+package org.openecomp.sdc.tosca.datatypes.model;
+
+import java.util.Map;
+import java.util.Objects;
+
+public class OperationDefinitionTemplate {
+
+  private Implementation implementation;
+  private Map<String, Object> inputs;
+
+  public Implementation getImplementation() {
+    return implementation;
+  }
+
+  public void setImplementation(Implementation implementation) {
+    this.implementation = implementation;
+  }
+
+  public Map<String, Object> getInputs() {
+    return inputs;
+  }
+
+  public void setInputs(Map<String, Object> inputs) {
+    this.inputs = inputs;
+  }
+
+  @Override
+  public boolean equals(Object o) {
+    if (this == o) {
+      return true;
+    }
+    if (!(o instanceof OperationDefinitionTemplate)) {
+      return false;
+    }
+    OperationDefinitionTemplate that = (OperationDefinitionTemplate) o;
+    return Objects.equals(implementation, that.implementation) &&
+        Objects.equals(inputs, that.inputs);
+  }
+
+  @Override
+  public int hashCode() {
+
+    return Objects.hash(implementation, inputs);
+  }
+}
diff --git a/common/openecomp-tosca-datatype/src/main/java/org/openecomp/sdc/tosca/datatypes/model/OperationDefinitionType.java b/common/openecomp-tosca-datatype/src/main/java/org/openecomp/sdc/tosca/datatypes/model/OperationDefinitionType.java
new file mode 100644 (file)
index 0000000..70c6a58
--- /dev/null
@@ -0,0 +1,46 @@
+package org.openecomp.sdc.tosca.datatypes.model;
+
+import java.util.Map;
+import java.util.Objects;
+
+public class OperationDefinitionType extends OperationDefinition {
+
+  private String implementation;
+  private Map<String, PropertyDefinition> inputs;
+
+  public String getImplementation() {
+    return implementation;
+  }
+
+  public void setImplementation(String implementation) {
+    this.implementation = implementation;
+  }
+
+  public Map<String, PropertyDefinition> getInputs() {
+    return inputs;
+  }
+
+  public void setInputs(
+      Map<String, PropertyDefinition> inputs) {
+    this.inputs = inputs;
+  }
+
+  @Override
+  public boolean equals(Object o) {
+    if (this == o) {
+      return true;
+    }
+    if (!(o instanceof OperationDefinitionType)) {
+      return false;
+    }
+    OperationDefinitionType that = (OperationDefinitionType) o;
+    return Objects.equals(implementation, that.implementation) &&
+        Objects.equals(inputs, that.inputs);
+  }
+
+  @Override
+  public int hashCode() {
+
+    return Objects.hash(implementation, inputs);
+  }
+}
index f41a92c..aa69d20 100644 (file)
@@ -210,6 +210,11 @@ topology_template:
             is_required: true\r
           floating_ip_count_required:\r
             is_required: false\r
+        - ip_version: 6\r
+          ip_count_required:\r
+            is_required: false\r
+          floating_ip_count_required:\r
+            is_required: false\r
         security_groups:\r
           get_input: perimeta_sec_groups\r
         fixed_ips:\r
@@ -243,6 +248,11 @@ topology_template:
             is_required: true\r
           floating_ip_count_required:\r
             is_required: true\r
+        - ip_version: 6\r
+          ip_count_required:\r
+            is_required: false\r
+          floating_ip_count_required:\r
+            is_required: false\r
         security_groups:\r
           get_input: perimeta_sec_groups\r
         fixed_ips:\r
@@ -279,6 +289,11 @@ topology_template:
             is_required: true\r
           floating_ip_count_required:\r
             is_required: true\r
+        - ip_version: 6\r
+          ip_count_required:\r
+            is_required: false\r
+          floating_ip_count_required:\r
+            is_required: false\r
         security_groups:\r
           get_input: perimeta_sec_groups\r
         fixed_ips:\r
@@ -360,6 +375,11 @@ topology_template:
             is_required: true\r
           floating_ip_count_required:\r
             is_required: true\r
+        - ip_version: 6\r
+          ip_count_required:\r
+            is_required: false\r
+          floating_ip_count_required:\r
+            is_required: false\r
         security_groups:\r
           get_input: perimeta_sec_groups\r
         fixed_ips:\r
@@ -396,6 +416,11 @@ topology_template:
             is_required: false\r
           floating_ip_count_required:\r
             is_required: false\r
+        - ip_version: 6\r
+          ip_count_required:\r
+            is_required: false\r
+          floating_ip_count_required:\r
+            is_required: false\r
         mac_requirements:\r
           mac_count_required:\r
             is_required: false\r
@@ -424,6 +449,11 @@ topology_template:
             is_required: true\r
           floating_ip_count_required:\r
             is_required: true\r
+        - ip_version: 6\r
+          ip_count_required:\r
+            is_required: false\r
+          floating_ip_count_required:\r
+            is_required: false\r
         security_groups:\r
           get_input: perimeta_sec_groups\r
         fixed_ips:\r
@@ -907,4 +937,4 @@ topology_template:
       - dependency\r
       dependency_perimeta_ssc_a_server_0:\r
       - perimeta_ssc_a_server_0\r
-      - dependency\r
\ No newline at end of file
+      - dependency
\ No newline at end of file
index e03377b..20b8002 100644 (file)
@@ -205,6 +205,11 @@ topology_template:
             is_required: true\r
           floating_ip_count_required:\r
             is_required: true\r
+        - ip_version: 6\r
+          ip_count_required:\r
+            is_required: false\r
+          floating_ip_count_required:\r
+            is_required: false\r
         security_groups:\r
           get_input: perimeta_sec_groups\r
         fixed_ips:\r
@@ -241,6 +246,11 @@ topology_template:
             is_required: true\r
           floating_ip_count_required:\r
             is_required: true\r
+        - ip_version: 6\r
+          ip_count_required:\r
+            is_required: false\r
+          floating_ip_count_required:\r
+            is_required: false\r
         security_groups:\r
           get_input: perimeta_sec_groups\r
         fixed_ips:\r
@@ -322,6 +332,11 @@ topology_template:
             is_required: true\r
           floating_ip_count_required:\r
             is_required: true\r
+        - ip_version: 6\r
+          ip_count_required:\r
+            is_required: false\r
+          floating_ip_count_required:\r
+            is_required: false\r
         security_groups:\r
           get_input: perimeta_sec_groups\r
         fixed_ips:\r
@@ -358,6 +373,11 @@ topology_template:
             is_required: false\r
           floating_ip_count_required:\r
             is_required: false\r
+        - ip_version: 6\r
+          ip_count_required:\r
+            is_required: false\r
+          floating_ip_count_required:\r
+            is_required: false\r
         mac_requirements:\r
           mac_count_required:\r
             is_required: false\r
@@ -418,6 +438,11 @@ topology_template:
             is_required: true\r
           floating_ip_count_required:\r
             is_required: true\r
+        - ip_version: 6\r
+          ip_count_required:\r
+            is_required: false\r
+          floating_ip_count_required:\r
+            is_required: false\r
         security_groups:\r
           get_input: perimeta_sec_groups\r
         fixed_ips:\r
@@ -454,6 +479,11 @@ topology_template:
             is_required: true\r
           floating_ip_count_required:\r
             is_required: false\r
+        - ip_version: 6\r
+          ip_count_required:\r
+            is_required: false\r
+          floating_ip_count_required:\r
+            is_required: false\r
         security_groups:\r
           get_input: perimeta_sec_groups\r
         fixed_ips:\r
@@ -893,4 +923,4 @@ topology_template:
       - dependency\r
       link_perimeta_ssc_b_ha_0_port:\r
       - perimeta_ssc_b_ha_0_port\r
-      - link\r
\ No newline at end of file
+      - link
\ No newline at end of file
index 50294fa..0001491 100644 (file)
@@ -285,6 +285,11 @@ topology_template:
         - ip_version: 4\r
           ip_count_required:\r
             is_required: true\r
+          floating_ip_count_required:\r
+            is_required: true\r
+        - ip_version: 6\r
+          ip_count_required:\r
+            is_required: false\r
           floating_ip_count_required:\r
             is_required: false\r
         security_groups:\r
@@ -329,6 +334,11 @@ topology_template:
             is_required: true\r
           floating_ip_count_required:\r
             is_required: false\r
+        - ip_version: 6\r
+          ip_count_required:\r
+            is_required: false\r
+          floating_ip_count_required:\r
+            is_required: false\r
         security_groups:\r
           get_input: perimeta_sec_groups\r
         fixed_ips:\r
@@ -364,6 +374,11 @@ topology_template:
         - ip_version: 4\r
           ip_count_required:\r
             is_required: true\r
+          floating_ip_count_required:\r
+            is_required: true\r
+        - ip_version: 6\r
+          ip_count_required:\r
+            is_required: false\r
           floating_ip_count_required:\r
             is_required: false\r
         security_groups:\r
@@ -451,6 +466,11 @@ topology_template:
         - ip_version: 4\r
           ip_count_required:\r
             is_required: true\r
+          floating_ip_count_required:\r
+            is_required: true\r
+        - ip_version: 6\r
+          ip_count_required:\r
+            is_required: false\r
           floating_ip_count_required:\r
             is_required: false\r
         security_groups:\r
@@ -815,4 +835,4 @@ topology_template:
       - link\r
       link_perimeta_rtp_msc_a_ha_0_port:\r
       - perimeta_rtp_msc_a_ha_0_port\r
-      - link\r
\ No newline at end of file
+      - link
\ No newline at end of file
index 7fc9626..171b3ef 100644 (file)
@@ -225,6 +225,11 @@ topology_template:
         - ip_version: 4\r
           ip_count_required:\r
             is_required: true\r
+          floating_ip_count_required:\r
+            is_required: true\r
+        - ip_version: 6\r
+          ip_count_required:\r
+            is_required: false\r
           floating_ip_count_required:\r
             is_required: false\r
         security_groups:\r
@@ -267,6 +272,11 @@ topology_template:
         - ip_version: 4\r
           ip_count_required:\r
             is_required: true\r
+          floating_ip_count_required:\r
+            is_required: true\r
+        - ip_version: 6\r
+          ip_count_required:\r
+            is_required: false\r
           floating_ip_count_required:\r
             is_required: false\r
         security_groups:\r
@@ -402,6 +412,11 @@ topology_template:
             is_required: true\r
           floating_ip_count_required:\r
             is_required: false\r
+        - ip_version: 6\r
+          ip_count_required:\r
+            is_required: false\r
+          floating_ip_count_required:\r
+            is_required: false\r
         security_groups:\r
           get_input: perimeta_sec_groups\r
         fixed_ips:\r
@@ -437,6 +452,11 @@ topology_template:
         - ip_version: 4\r
           ip_count_required:\r
             is_required: true\r
+          floating_ip_count_required:\r
+            is_required: true\r
+        - ip_version: 6\r
+          ip_count_required:\r
+            is_required: false\r
           floating_ip_count_required:\r
             is_required: false\r
         security_groups:\r
@@ -801,4 +821,4 @@ topology_template:
       - link\r
       link_perimeta_rtp_msc_b_untrusted_parent_0_port:\r
       - perimeta_rtp_msc_b_untrusted_parent_0_port\r
-      - link\r
\ No newline at end of file
+      - link
\ No newline at end of file
index e9a8f58..a625bb6 100644 (file)
@@ -49,7 +49,6 @@ import org.openecomp.sdc.tosca.datatypes.ToscaServiceModel;
 import org.openecomp.sdc.tosca.datatypes.model.ArtifactDefinition;
 import org.openecomp.sdc.tosca.datatypes.model.CapabilityAssignment;
 import org.openecomp.sdc.tosca.datatypes.model.Import;
-import org.openecomp.sdc.tosca.datatypes.model.InterfaceDefinition;
 import org.openecomp.sdc.tosca.datatypes.model.NodeFilter;
 import org.openecomp.sdc.tosca.datatypes.model.NodeTemplate;
 import org.openecomp.sdc.tosca.datatypes.model.NodeType;
@@ -62,18 +61,15 @@ import org.openecomp.sdc.tosca.services.ToscaUtil;
 import org.openecomp.sdc.translator.services.heattotosca.globaltypes.GlobalTypesGenerator;
 import org.yaml.snakeyaml.error.YAMLException;
 
-import java.io.ByteArrayInputStream;
 import java.io.File;
 import java.io.IOException;
 import java.util.ArrayList;
 import java.util.Collection;
-import java.util.Collections;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 import java.util.Objects;
 import java.util.Optional;
-import java.util.jar.Manifest;
 import java.util.regex.Pattern;
 
 public class ToscaConverterImpl implements ToscaConverter {
@@ -84,8 +80,7 @@ public class ToscaConverterImpl implements ToscaConverter {
   }
 
   @Override
-  public ToscaServiceModel convert(FileContentHandler fileContentHandler)
-      throws IOException {
+  public ToscaServiceModel convert(FileContentHandler fileContentHandler) {
     Map<String, byte[]> csarFiles = new HashMap<>(fileContentHandler.getFiles());
     ToscaServiceModel toscaServiceModel = new ToscaServiceModel();
     Map<String, ServiceTemplate> serviceTemplates = new HashMap<>();
@@ -197,16 +192,6 @@ public class ToscaConverterImpl implements ToscaConverter {
         serviceTemplates.put(serviceTemplateName, serviceTemplate);
     }
 
-    private Optional<byte[]> getManifestContent(Map<String, byte[]> csarFiles) {
-        for (Map.Entry<String, byte[]> csarFileEntry : csarFiles.entrySet()) {
-            if (csarFileEntry.getKey().contains(manifestFileName)) {
-                return Optional.of(csarFileEntry.getValue());
-            }
-        }
-
-        return Optional.empty();
-    }
-
     private Optional<ServiceTemplate> getServiceTemplateFromCsar(String fileName,
                                                                  Map<String, byte[]> csarFiles) {
         byte[] fileContent = csarFiles.get(fileName);
index aef23be..6b1046b 100644 (file)
@@ -40,6 +40,7 @@ import org.openecomp.sdc.tosca.datatypes.model.EntrySchema;
 import org.openecomp.sdc.tosca.datatypes.model.GroupDefinition;
 import org.openecomp.sdc.tosca.datatypes.model.Import;
 import org.openecomp.sdc.tosca.datatypes.model.InterfaceDefinition;
+import org.openecomp.sdc.tosca.datatypes.model.InterfaceDefinitionType;
 import org.openecomp.sdc.tosca.datatypes.model.InterfaceType;
 import org.openecomp.sdc.tosca.datatypes.model.NodeTemplate;
 import org.openecomp.sdc.tosca.datatypes.model.NodeType;
@@ -1212,33 +1213,32 @@ public class DataModelUtil {
     return convertedInterfaceTypes;
   }
 
-  public static Optional<InterfaceDefinition> convertObjToInterfaceDefinition(
-      String interfaceId, Object interfaceObj)
-      throws CoreException {
+  public static <T extends InterfaceDefinition> Optional<T>
+  convertObjToInterfaceDefinition(
+      String interfaceId, Object interfaceObj, Class<T> interfaceClass) {
 
     try {
-      Optional<InterfaceDefinition> interfaceDefinition =
-          CommonUtil.createObjectUsingSetters(interfaceObj, InterfaceDefinition.class);
-      interfaceDefinition.ifPresent(interfaceDefinition1 -> updateInterfaceDefinitionOperations(
+      Optional<T> interfaceDefinition =
+          CommonUtil.createObjectUsingSetters(interfaceObj, interfaceClass);
+      interfaceDefinition.ifPresent(interfaceDefinitionType1 -> updateInterfaceDefinitionOperations(
           CommonUtil.getObjectAsMap(interfaceObj),
-          interfaceDefinition1));
+          interfaceDefinitionType1));
       return interfaceDefinition;
     } catch (Exception ex) {
       throw new CoreException(
-          new CreateInterfaceObjectErrorBuilder(InterfaceDefinition.class.getName(), interfaceId,
+          new CreateInterfaceObjectErrorBuilder(InterfaceDefinitionType.class.getName(), interfaceId,
               ex.getMessage()).build());
     }
 
   }
 
   public static Optional<Object> convertInterfaceDefinitionToObj(
-      InterfaceDefinition interfaceDefinition) {
-    return converInetrfaceToToscaInterfaceObj(interfaceDefinition);
+      InterfaceDefinitionType interfaceDefinitionType) {
+    return converInetrfaceToToscaInterfaceObj(interfaceDefinitionType);
   }
 
   public static Optional<InterfaceType> convertObjToInterfaceType(String interfaceId,
-                                                                  Object interfaceObj)
-      throws CoreException {
+                                                                  Object interfaceObj) {
     try {
       Optional<InterfaceType> interfaceType =
           CommonUtil.createObjectUsingSetters(interfaceObj, InterfaceType.class);
@@ -1289,8 +1289,7 @@ public class DataModelUtil {
 
   private static Optional<OperationDefinition> createOperation(String propertyName,
                                                                Object operationCandidate,
-                                                               Set<String> fieldNames)
-      throws CoreException {
+                                                               Set<String> fieldNames) {
     if (!fieldNames.contains(propertyName)) {
       try {
         return CommonUtil.createObjectUsingSetters(operationCandidate, OperationDefinition.class);
@@ -1306,7 +1305,7 @@ public class DataModelUtil {
   private static void updateInterfaceDefinitionOperations(Map<String, Object> interfaceAsMap,
                                                           InterfaceDefinition interfaceDefinition) {
 
-    Set<String> fieldNames = CommonUtil.getClassFieldNames(InterfaceDefinition.class);
+    Set<String> fieldNames = CommonUtil.getClassFieldNames(InterfaceDefinitionType.class);
 
     for (Map.Entry<String, Object> entry : interfaceAsMap.entrySet()) {
       Optional<OperationDefinition> operationDefinition =
index 31dc3ab..ced1083 100644 (file)
@@ -30,11 +30,13 @@ import org.openecomp.sdc.tosca.datatypes.model.Constraint;
 import org.openecomp.sdc.tosca.datatypes.model.Directive;
 import org.openecomp.sdc.tosca.datatypes.model.Import;
 import org.openecomp.sdc.tosca.datatypes.model.InterfaceDefinition;
+import org.openecomp.sdc.tosca.datatypes.model.InterfaceDefinitionType;
 import org.openecomp.sdc.tosca.datatypes.model.InterfaceType;
 import org.openecomp.sdc.tosca.datatypes.model.NodeFilter;
 import org.openecomp.sdc.tosca.datatypes.model.NodeTemplate;
 import org.openecomp.sdc.tosca.datatypes.model.NodeType;
 import org.openecomp.sdc.tosca.datatypes.model.OperationDefinition;
+import org.openecomp.sdc.tosca.datatypes.model.OperationDefinitionType;
 import org.openecomp.sdc.tosca.datatypes.model.ParameterDefinition;
 import org.openecomp.sdc.tosca.datatypes.model.PropertyDefinition;
 import org.openecomp.sdc.tosca.datatypes.model.PropertyType;
@@ -374,8 +376,9 @@ public class ToscaModelTest {
 
     NodeTemplate nodeTemplate =
         DataModelUtil.getNodeTemplate(serviceTemplate, NODE_TEMPLATE_ID);
-    InterfaceDefinition interfaceDefinition = getInterfaceDefinition();
-    Optional<Object> interfaceObj = DataModelUtil.convertInterfaceDefinitionToObj(interfaceDefinition);
+    InterfaceDefinitionType interfaceDefinitionType = getInterfaceDefinition();
+    Optional<Object> interfaceObj = DataModelUtil.convertInterfaceDefinitionToObj(
+        interfaceDefinitionType);
 
     Assert.assertTrue(interfaceObj.isPresent());
     Map<String, Object> interfaces = new HashMap<>();
@@ -396,13 +399,15 @@ public class ToscaModelTest {
         DataModelUtil.getNodeTemplate(serviceTemplateWithInterfaceDef, NODE_TEMPLATE_ID);
     Map<String, Object> interfaces = nodeTemplateWithInterface.getInterfaces();
     Object interfaceObj = interfaces.get(INTERFACE_ID);
-    Optional<InterfaceDefinition> actualInterfaceDefinition =
-        DataModelUtil.convertObjToInterfaceDefinition(INTERFACE_ID, interfaceObj);
+
+    Optional<? extends InterfaceDefinition> actualInterfaceDefinition =
+        DataModelUtil.convertObjToInterfaceDefinition(INTERFACE_ID, interfaceObj,
+            InterfaceDefinitionType.class);
 
     Assert.assertTrue(actualInterfaceDefinition.isPresent());
 
-    InterfaceDefinition expectedInterfaceDefinition = getInterfaceDefinition();
-    Assert.assertEquals(expectedInterfaceDefinition, actualInterfaceDefinition.get());
+    InterfaceDefinitionType expectedInterfaceDefinitionType = getInterfaceDefinition();
+    Assert.assertEquals(expectedInterfaceDefinitionType, actualInterfaceDefinition.get());
   }
 
   @Test
@@ -438,16 +443,15 @@ public class ToscaModelTest {
   private OperationDefinition getOperationDefinition() {
     OperationDefinition operationDefinition = new OperationDefinition();
     operationDefinition.setDescription("start operation");
-    operationDefinition.setImplementation("start.sh");
     return operationDefinition;
   }
 
-  private InterfaceDefinition getInterfaceDefinition() {
+  private InterfaceDefinitionType getInterfaceDefinition() {
     OperationDefinition operationDefinition = getOperationDefinition();
-    InterfaceDefinition interfaceDefinition = new InterfaceDefinition();
-    interfaceDefinition.setType("test interface");
-    interfaceDefinition.addOperation("start", operationDefinition);
-    return interfaceDefinition;
+    InterfaceDefinitionType interfaceDefinitionType = new InterfaceDefinitionType();
+    interfaceDefinitionType.setType("test interface");
+    interfaceDefinitionType.addOperation("start", operationDefinition);
+    return interfaceDefinitionType;
   }
 
 }
index 6df071c..3f63ee9 100644 (file)
@@ -73,12 +73,6 @@ topology_template:
       directives:
       - selectable
       - substitutable
-      interfaces:
-        inter_1:
-          type: test interface
-          start:
-            description: start operation
-            implementation: start.sh
       properties:
         prop2: '{ get_input: my_mysql_rootpw }'
         prop1: abcd
@@ -104,6 +98,11 @@ topology_template:
           capability: capA
           node: nodeA
           relationship: relationB
+      interfaces:
+        inter_1:
+          type: test interface
+          start:
+            description: start operation
   substitution_mappings:
     node_type: myNodeType.node
     capabilities: