aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortalio <tali.orenbach@amdocs.com>2018-01-28 09:47:38 +0200
committerAvi Gaffa <avi.gaffa@amdocs.com>2018-02-04 06:56:25 +0000
commitb43e8ebd9f3e7436a51c2a6b9fe71f254d92b833 (patch)
tree88ef13834fc4529c26bf325fb7188c90309f4e3e
parent693a3f26aba6104fad1659d9b481cbdd0b75d6d8 (diff)
change capabilities datatype
change node template capabilities datatype from list of map to map Change-Id: Ie0fa71b8a41ec732ae5290a72c4d8e908701ce17 Issue-ID: SDC-968 Signed-off-by: talio <tali.orenbach@amdocs.com>
-rw-r--r--common/openecomp-tosca-datatype/src/main/java/org/openecomp/sdc/tosca/datatypes/model/NodeTemplate.java6
-rw-r--r--openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/main/java/org/openecomp/sdc/enrichment/impl/tosca/PortMirroringEnricher.java4
-rw-r--r--openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/test/resources/mock/enrichPortMirroring/nested/multiLevel/in/Nested_pd_server_2ServiceTemplate.yaml2
-rw-r--r--openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/test/resources/mock/enrichPortMirroring/nested/multiLevel/out/Nested_pd_serverServiceTemplate.yaml2
-rw-r--r--openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/test/resources/mock/enrichPortMirroring/nested/multiLevel/out/Nested_pd_server_1ServiceTemplate.yaml2
-rw-r--r--openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/test/resources/mock/enrichPortMirroring/nested/multiLevel/out/Nested_pd_server_2ServiceTemplate.yaml2
-rw-r--r--openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/test/resources/mock/enrichPortMirroring/nested/multiLevel/out/Nested_pd_server_3ServiceTemplate.yaml2
-rw-r--r--openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/test/resources/mock/enrichPortMirroring/nested/multiLevel/out/Nested_pd_server_4ServiceTemplate.yaml2
-rw-r--r--openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/test/resources/mock/enrichPortMirroring/nested/multiLevel/out/Nested_pd_server_6ServiceTemplate.yaml2
-rw-r--r--openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/test/resources/mock/enrichPortMirroring/nested/oneLevel/out/MainServiceTemplate.yaml2
-rw-r--r--openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/test/resources/mock/enrichPortMirroring/nested/oneLevel/out/nested-pcm_v0.1ServiceTemplate.yaml4
-rw-r--r--openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/test/resources/mock/enrichPortMirroring/scalingInstance/out/MainServiceTemplate.yaml4
-rw-r--r--openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/test/resources/mock/enrichPortMirroring/scalingInstance/out/Nested_pd_serverServiceTemplate.yaml2
-rw-r--r--openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/test/resources/mock/enrichPortMirroring/singleSubstitution/diffPortType/out/MainServiceTemplate.yaml4
-rw-r--r--openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/test/resources/mock/enrichPortMirroring/singleSubstitution/diffPortType/out/Nested_pd_serverServiceTemplate.yaml2
-rw-r--r--openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/test/resources/mock/enrichPortMirroring/singleSubstitution/samePortType/out/MainServiceTemplate.yaml4
-rw-r--r--openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/test/resources/mock/enrichPortMirroring/singleSubstitution/samePortType/out/Nested_pd_serverServiceTemplate.yaml2
-rw-r--r--openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/main/java/org/openecomp/core/impl/ToscaConverterImpl.java389
-rw-r--r--openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/test/resources/mock/toscaConverter/conversionWithInt/out/MainServiceTemplate.yaml2
-rw-r--r--openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/test/resources/mock/toscaConverter/convertMainSt/out/MainServiceTemplate.yaml10
-rw-r--r--openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/services/DataModelUtil.java8
-rw-r--r--openecomp-be/lib/openecomp-tosca-lib/src/test/java/org/openecomp/sdc/tosca/datatypes/ToscaModelTest.java3
-rw-r--r--openecomp-be/lib/openecomp-tosca-lib/src/test/resources/mock/model/serviceTemplate.yaml2
-rw-r--r--openecomp-be/lib/openecomp-tosca-lib/src/test/resources/mock/model/serviceTemplateHeatExtend.yaml2
24 files changed, 229 insertions, 235 deletions
diff --git a/common/openecomp-tosca-datatype/src/main/java/org/openecomp/sdc/tosca/datatypes/model/NodeTemplate.java b/common/openecomp-tosca-datatype/src/main/java/org/openecomp/sdc/tosca/datatypes/model/NodeTemplate.java
index 9901ea3138..bfbf343e6d 100644
--- a/common/openecomp-tosca-datatype/src/main/java/org/openecomp/sdc/tosca/datatypes/model/NodeTemplate.java
+++ b/common/openecomp-tosca-datatype/src/main/java/org/openecomp/sdc/tosca/datatypes/model/NodeTemplate.java
@@ -34,7 +34,7 @@ public class NodeTemplate implements Template {
private Map<String, Object> properties;
private Map<String, Object> attributes;
private List<Map<String, RequirementAssignment>> requirements;
- private List<Map<String, CapabilityAssignment>> capabilities;
+ private Map<String, CapabilityAssignment> capabilities;
private Map<String, InterfaceDefinition> interfaces;
private Map<String, ArtifactDefinition> artifacts;
private NodeFilter node_filter;
@@ -88,11 +88,11 @@ public class NodeTemplate implements Template {
this.requirements = requirements;
}
- public List<Map<String, CapabilityAssignment>> getCapabilities() {
+ public Map<String, CapabilityAssignment> getCapabilities() {
return capabilities;
}
- public void setCapabilities(List<Map<String, CapabilityAssignment>> capabilities) {
+ public void setCapabilities(Map<String, CapabilityAssignment> capabilities) {
this.capabilities = capabilities;
}
diff --git a/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/main/java/org/openecomp/sdc/enrichment/impl/tosca/PortMirroringEnricher.java b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/main/java/org/openecomp/sdc/enrichment/impl/tosca/PortMirroringEnricher.java
index 4ad81210df..629868cb3a 100644
--- a/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/main/java/org/openecomp/sdc/enrichment/impl/tosca/PortMirroringEnricher.java
+++ b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/main/java/org/openecomp/sdc/enrichment/impl/tosca/PortMirroringEnricher.java
@@ -257,10 +257,6 @@ public class PortMirroringEnricher {
}
private void addPortMirroringCapability(NodeTemplate portNodeTemplate) {
- List<Map<String, CapabilityAssignment>> capabilities = portNodeTemplate.getCapabilities();
- if (Objects.isNull(capabilities)) {
- capabilities = new ArrayList<>();
- }
Map<String, Object> portMirroringCapabilityProperties = new HashMap<>();
PortMirroringConnectionPointDescription connectionPoint = new
PortMirroringConnectionPointDescription();
diff --git a/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/test/resources/mock/enrichPortMirroring/nested/multiLevel/in/Nested_pd_server_2ServiceTemplate.yaml b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/test/resources/mock/enrichPortMirroring/nested/multiLevel/in/Nested_pd_server_2ServiceTemplate.yaml
index d6293b81af..95a17aea47 100644
--- a/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/test/resources/mock/enrichPortMirroring/nested/multiLevel/in/Nested_pd_server_2ServiceTemplate.yaml
+++ b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/test/resources/mock/enrichPortMirroring/nested/multiLevel/in/Nested_pd_server_2ServiceTemplate.yaml
@@ -121,7 +121,7 @@ topology_template:
node: pd_server
relationship: tosca.relationships.network.BindsTo
capabilities:
- - port_mirroring:
+ port_mirroring:
properties:
connection_point:
nfc_type: pd_server
diff --git a/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/test/resources/mock/enrichPortMirroring/nested/multiLevel/out/Nested_pd_serverServiceTemplate.yaml b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/test/resources/mock/enrichPortMirroring/nested/multiLevel/out/Nested_pd_serverServiceTemplate.yaml
index 975b38838c..1cee498cd2 100644
--- a/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/test/resources/mock/enrichPortMirroring/nested/multiLevel/out/Nested_pd_serverServiceTemplate.yaml
+++ b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/test/resources/mock/enrichPortMirroring/nested/multiLevel/out/Nested_pd_serverServiceTemplate.yaml
@@ -123,7 +123,7 @@ topology_template:
node: pd_server
relationship: tosca.relationships.network.BindsTo
capabilities:
- - port_mirroring:
+ port_mirroring:
properties:
connection_point:
nf_type: ''
diff --git a/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/test/resources/mock/enrichPortMirroring/nested/multiLevel/out/Nested_pd_server_1ServiceTemplate.yaml b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/test/resources/mock/enrichPortMirroring/nested/multiLevel/out/Nested_pd_server_1ServiceTemplate.yaml
index cad189fdba..9722ffec88 100644
--- a/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/test/resources/mock/enrichPortMirroring/nested/multiLevel/out/Nested_pd_server_1ServiceTemplate.yaml
+++ b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/test/resources/mock/enrichPortMirroring/nested/multiLevel/out/Nested_pd_server_1ServiceTemplate.yaml
@@ -123,7 +123,7 @@ topology_template:
node: pd_server
relationship: tosca.relationships.network.BindsTo
capabilities:
- - port_mirroring:
+ port_mirroring:
properties:
connection_point:
nf_type: ''
diff --git a/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/test/resources/mock/enrichPortMirroring/nested/multiLevel/out/Nested_pd_server_2ServiceTemplate.yaml b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/test/resources/mock/enrichPortMirroring/nested/multiLevel/out/Nested_pd_server_2ServiceTemplate.yaml
index d6293b81af..95a17aea47 100644
--- a/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/test/resources/mock/enrichPortMirroring/nested/multiLevel/out/Nested_pd_server_2ServiceTemplate.yaml
+++ b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/test/resources/mock/enrichPortMirroring/nested/multiLevel/out/Nested_pd_server_2ServiceTemplate.yaml
@@ -121,7 +121,7 @@ topology_template:
node: pd_server
relationship: tosca.relationships.network.BindsTo
capabilities:
- - port_mirroring:
+ port_mirroring:
properties:
connection_point:
nfc_type: pd_server
diff --git a/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/test/resources/mock/enrichPortMirroring/nested/multiLevel/out/Nested_pd_server_3ServiceTemplate.yaml b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/test/resources/mock/enrichPortMirroring/nested/multiLevel/out/Nested_pd_server_3ServiceTemplate.yaml
index 4aae018766..4d98183c51 100644
--- a/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/test/resources/mock/enrichPortMirroring/nested/multiLevel/out/Nested_pd_server_3ServiceTemplate.yaml
+++ b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/test/resources/mock/enrichPortMirroring/nested/multiLevel/out/Nested_pd_server_3ServiceTemplate.yaml
@@ -123,7 +123,7 @@ topology_template:
node: pd_server
relationship: tosca.relationships.network.BindsTo
capabilities:
- - port_mirroring:
+ port_mirroring:
properties:
connection_point:
nf_type: ''
diff --git a/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/test/resources/mock/enrichPortMirroring/nested/multiLevel/out/Nested_pd_server_4ServiceTemplate.yaml b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/test/resources/mock/enrichPortMirroring/nested/multiLevel/out/Nested_pd_server_4ServiceTemplate.yaml
index 2fe496ea2d..44f068ba31 100644
--- a/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/test/resources/mock/enrichPortMirroring/nested/multiLevel/out/Nested_pd_server_4ServiceTemplate.yaml
+++ b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/test/resources/mock/enrichPortMirroring/nested/multiLevel/out/Nested_pd_server_4ServiceTemplate.yaml
@@ -123,7 +123,7 @@ topology_template:
node: pd_server
relationship: tosca.relationships.network.BindsTo
capabilities:
- - port_mirroring:
+ port_mirroring:
properties:
connection_point:
nf_type: ''
diff --git a/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/test/resources/mock/enrichPortMirroring/nested/multiLevel/out/Nested_pd_server_6ServiceTemplate.yaml b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/test/resources/mock/enrichPortMirroring/nested/multiLevel/out/Nested_pd_server_6ServiceTemplate.yaml
index 9a3f9aff3c..4750ccc1f2 100644
--- a/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/test/resources/mock/enrichPortMirroring/nested/multiLevel/out/Nested_pd_server_6ServiceTemplate.yaml
+++ b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/test/resources/mock/enrichPortMirroring/nested/multiLevel/out/Nested_pd_server_6ServiceTemplate.yaml
@@ -123,7 +123,7 @@ topology_template:
node: pd_server
relationship: tosca.relationships.network.BindsTo
capabilities:
- - port_mirroring:
+ port_mirroring:
properties:
connection_point:
nf_type: ''
diff --git a/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/test/resources/mock/enrichPortMirroring/nested/oneLevel/out/MainServiceTemplate.yaml b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/test/resources/mock/enrichPortMirroring/nested/oneLevel/out/MainServiceTemplate.yaml
index 00091c6b44..8841a6d74b 100644
--- a/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/test/resources/mock/enrichPortMirroring/nested/oneLevel/out/MainServiceTemplate.yaml
+++ b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/test/resources/mock/enrichPortMirroring/nested/oneLevel/out/MainServiceTemplate.yaml
@@ -215,7 +215,7 @@ topology_template:
mac_count_required:
is_required: false
capabilities:
- - port_mirroring:
+ port_mirroring:
properties:
connection_point:
nf_type: ''
diff --git a/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/test/resources/mock/enrichPortMirroring/nested/oneLevel/out/nested-pcm_v0.1ServiceTemplate.yaml b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/test/resources/mock/enrichPortMirroring/nested/oneLevel/out/nested-pcm_v0.1ServiceTemplate.yaml
index ac6f6704ee..5c6f4aee86 100644
--- a/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/test/resources/mock/enrichPortMirroring/nested/oneLevel/out/nested-pcm_v0.1ServiceTemplate.yaml
+++ b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/test/resources/mock/enrichPortMirroring/nested/oneLevel/out/nested-pcm_v0.1ServiceTemplate.yaml
@@ -255,7 +255,7 @@ topology_template:
network:
get_input: oam_net_name
capabilities:
- - port_mirroring:
+ port_mirroring:
properties:
connection_point:
nf_type: ''
@@ -324,7 +324,7 @@ topology_template:
node: server_pcm
relationship: tosca.relationships.network.BindsTo
capabilities:
- - port_mirroring:
+ port_mirroring:
properties:
connection_point:
nf_type: ''
diff --git a/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/test/resources/mock/enrichPortMirroring/scalingInstance/out/MainServiceTemplate.yaml b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/test/resources/mock/enrichPortMirroring/scalingInstance/out/MainServiceTemplate.yaml
index 16223e48e3..45ebd436d0 100644
--- a/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/test/resources/mock/enrichPortMirroring/scalingInstance/out/MainServiceTemplate.yaml
+++ b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/test/resources/mock/enrichPortMirroring/scalingInstance/out/MainServiceTemplate.yaml
@@ -135,7 +135,7 @@ topology_template:
mac_count_required:
is_required: false
capabilities:
- - port_mirroring:
+ port_mirroring:
properties:
connection_point:
nf_type: ''
@@ -156,7 +156,7 @@ topology_template:
mac_count_required:
is_required: false
capabilities:
- - port_mirroring:
+ port_mirroring:
properties:
connection_point:
nf_type: ''
diff --git a/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/test/resources/mock/enrichPortMirroring/scalingInstance/out/Nested_pd_serverServiceTemplate.yaml b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/test/resources/mock/enrichPortMirroring/scalingInstance/out/Nested_pd_serverServiceTemplate.yaml
index 24fb1715bf..0f80630051 100644
--- a/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/test/resources/mock/enrichPortMirroring/scalingInstance/out/Nested_pd_serverServiceTemplate.yaml
+++ b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/test/resources/mock/enrichPortMirroring/scalingInstance/out/Nested_pd_serverServiceTemplate.yaml
@@ -193,7 +193,7 @@ topology_template:
node: pd_server
relationship: tosca.relationships.network.BindsTo
capabilities:
- - port_mirroring:
+ port_mirroring:
properties:
connection_point:
nf_type: ''
diff --git a/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/test/resources/mock/enrichPortMirroring/singleSubstitution/diffPortType/out/MainServiceTemplate.yaml b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/test/resources/mock/enrichPortMirroring/singleSubstitution/diffPortType/out/MainServiceTemplate.yaml
index 4b935307f5..8fd8b17b55 100644
--- a/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/test/resources/mock/enrichPortMirroring/singleSubstitution/diffPortType/out/MainServiceTemplate.yaml
+++ b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/test/resources/mock/enrichPortMirroring/singleSubstitution/diffPortType/out/MainServiceTemplate.yaml
@@ -277,7 +277,7 @@ topology_template:
mac_count_required:
is_required: false
capabilities:
- - port_mirroring:
+ port_mirroring:
properties:
connection_point:
nf_type: ''
@@ -287,7 +287,7 @@ topology_template:
template_VMInt_OAM_lb_external_VMI:
type: org.openecomp.resource.cp.v2.extContrailCP
capabilities:
- - port_mirroring:
+ port_mirroring:
properties:
connection_point:
nf_type: ''
diff --git a/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/test/resources/mock/enrichPortMirroring/singleSubstitution/diffPortType/out/Nested_pd_serverServiceTemplate.yaml b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/test/resources/mock/enrichPortMirroring/singleSubstitution/diffPortType/out/Nested_pd_serverServiceTemplate.yaml
index 2a20dac284..1c327d212e 100644
--- a/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/test/resources/mock/enrichPortMirroring/singleSubstitution/diffPortType/out/Nested_pd_serverServiceTemplate.yaml
+++ b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/test/resources/mock/enrichPortMirroring/singleSubstitution/diffPortType/out/Nested_pd_serverServiceTemplate.yaml
@@ -383,7 +383,7 @@ topology_template:
node: pd_server
relationship: tosca.relationships.network.BindsTo
capabilities:
- - port_mirroring:
+ port_mirroring:
properties:
connection_point:
nf_type: ''
diff --git a/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/test/resources/mock/enrichPortMirroring/singleSubstitution/samePortType/out/MainServiceTemplate.yaml b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/test/resources/mock/enrichPortMirroring/singleSubstitution/samePortType/out/MainServiceTemplate.yaml
index 2a4b89cb04..8a030f4628 100644
--- a/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/test/resources/mock/enrichPortMirroring/singleSubstitution/samePortType/out/MainServiceTemplate.yaml
+++ b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/test/resources/mock/enrichPortMirroring/singleSubstitution/samePortType/out/MainServiceTemplate.yaml
@@ -266,7 +266,7 @@ topology_template:
template_VMInt_OAM_lb_external_VMI:
type: org.openecomp.resource.cp.v2.extContrailCP
capabilities:
- - port_mirroring:
+ port_mirroring:
properties:
connection_point:
nf_type: ''
@@ -306,7 +306,7 @@ topology_template:
mac_count_required:
is_required: false
capabilities:
- - port_mirroring:
+ port_mirroring:
properties:
connection_point:
nf_type: ''
diff --git a/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/test/resources/mock/enrichPortMirroring/singleSubstitution/samePortType/out/Nested_pd_serverServiceTemplate.yaml b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/test/resources/mock/enrichPortMirroring/singleSubstitution/samePortType/out/Nested_pd_serverServiceTemplate.yaml
index c7202c3ac0..4cd5cd0894 100644
--- a/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/test/resources/mock/enrichPortMirroring/singleSubstitution/samePortType/out/Nested_pd_serverServiceTemplate.yaml
+++ b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/test/resources/mock/enrichPortMirroring/singleSubstitution/samePortType/out/Nested_pd_serverServiceTemplate.yaml
@@ -267,7 +267,7 @@ topology_template:
node: pd_server
relationship: tosca.relationships.network.BindsTo
capabilities:
- - port_mirroring:
+ port_mirroring:
properties:
connection_point:
nf_type: ''
diff --git a/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/main/java/org/openecomp/core/impl/ToscaConverterImpl.java b/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/main/java/org/openecomp/core/impl/ToscaConverterImpl.java
index a5421c0be8..f8b9f75b8f 100644
--- a/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/main/java/org/openecomp/core/impl/ToscaConverterImpl.java
+++ b/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/main/java/org/openecomp/core/impl/ToscaConverterImpl.java
@@ -79,21 +79,24 @@ import java.util.regex.Pattern;
public class ToscaConverterImpl implements ToscaConverter {
private static final String ORIGINAL = ".original";
-
- @Override
- public ToscaServiceModel convert(FileContentHandler fileContentHandler)
- throws IOException {
- Map<String, byte[]> csarFiles = new HashMap<>(fileContentHandler.getFiles());
- ToscaServiceModel toscaServiceModel = new ToscaServiceModel();
- Map<String, ServiceTemplate> serviceTemplates = new HashMap<>();
- FileContentHandler artifacts = new FileContentHandler();
- GlobalSubstitutionServiceTemplate gsst = new GlobalSubstitutionServiceTemplate();
- for (Map.Entry<String, byte[]> fileEntry : csarFiles.entrySet()) {
- CsarFileTypes fileType = getFileType(fileEntry.getKey());
- switch (fileType) {
- case mainServiceTemplate:
- handleServiceTemplate(mainStName, fileEntry.getKey(), csarFiles, serviceTemplates);
- break;
+ public ToscaConverterImpl() {
+
+ }
+
+ @Override
+ public ToscaServiceModel convert(FileContentHandler fileContentHandler)
+ throws IOException {
+ Map<String, byte[]> csarFiles = new HashMap<>(fileContentHandler.getFiles());
+ ToscaServiceModel toscaServiceModel = new ToscaServiceModel();
+ Map<String, ServiceTemplate> serviceTemplates = new HashMap<>();
+ FileContentHandler artifacts = new FileContentHandler();
+ GlobalSubstitutionServiceTemplate gsst = new GlobalSubstitutionServiceTemplate();
+ for (Map.Entry<String, byte[]> fileEntry : csarFiles.entrySet()) {
+ CsarFileTypes fileType = getFileType(fileEntry.getKey());
+ switch (fileType) {
+ case mainServiceTemplate:
+ handleServiceTemplate(mainStName, fileEntry.getKey(), csarFiles, serviceTemplates);
+ break;
case globalServiceTemplate:
handleServiceTemplate(globalStName, fileEntry.getKey(), csarFiles, serviceTemplates);
@@ -284,58 +287,58 @@ public class ToscaConverterImpl implements ToscaConverter {
return;
}
- for (Map.Entry<String, Object> nodeTypeEntry : nodeTypes.entrySet()) {
- Optional<NodeType> nodeType = ToscaConverterUtil
- .createObjectFromClass(nodeTypeEntry.getKey(), nodeTypeEntry.getValue(),
- NodeType.class);
+ for (Map.Entry<String, Object> nodeTypeEntry : nodeTypes.entrySet()) {
+ Optional<NodeType> nodeType = ToscaConverterUtil
+ .createObjectFromClass(nodeTypeEntry.getKey(), nodeTypeEntry.getValue(),
+ NodeType.class);
- nodeType.ifPresent(nodeTypeValue -> DataModelUtil
- .addNodeType(serviceTemplate, nodeTypeEntry.getKey(), nodeTypeValue));
- }
+ nodeType.ifPresent(nodeTypeValue -> DataModelUtil
+ .addNodeType(serviceTemplate, nodeTypeEntry.getKey(), nodeTypeValue));
}
+ }
- private void convertTopologyTemplate(ServiceTemplate serviceTemplate,
- ServiceTemplateReaderService readerService) {
+ private void convertTopologyTemplate(ServiceTemplate serviceTemplate,
+ ServiceTemplateReaderService readerService) {
- convertInputs(serviceTemplate, readerService);
- convertNodeTemplates(serviceTemplate, readerService);
- convertOutputs(serviceTemplate, readerService);
- convertSubstitutionMappings(serviceTemplate, readerService);
- }
+ convertInputs(serviceTemplate, readerService);
+ convertNodeTemplates(serviceTemplate, readerService);
+ convertOutputs(serviceTemplate, readerService);
+ convertSubstitutionMappings(serviceTemplate, readerService);
+ }
- private void convertInputs(ServiceTemplate serviceTemplate,
- ServiceTemplateReaderService readerService) {
- Map<String, Object> inputs = readerService.getInputs();
- addInputsOrOutputsToServiceTemplate(serviceTemplate, inputs, Constants.inputs);
- }
+ private void convertInputs(ServiceTemplate serviceTemplate,
+ ServiceTemplateReaderService readerService) {
+ Map<String, Object> inputs = readerService.getInputs();
+ addInputsOrOutputsToServiceTemplate(serviceTemplate, inputs, Constants.inputs);
+ }
+
+ private void convertOutputs(ServiceTemplate serviceTemplate,
+ ServiceTemplateReaderService readerService) {
+ Map<String, Object> outputs = readerService.getOutputs();
+ addInputsOrOutputsToServiceTemplate(serviceTemplate, outputs, Constants.outputs);
+ }
- private void convertOutputs(ServiceTemplate serviceTemplate,
- ServiceTemplateReaderService readerService) {
- Map<String, Object> outputs = readerService.getOutputs();
- addInputsOrOutputsToServiceTemplate(serviceTemplate, outputs, Constants.outputs);
+ private void addInputsOrOutputsToServiceTemplate(ServiceTemplate serviceTemplate,
+ Map<String, Object> mapToConvert,
+ String inputsOrOutputs) {
+ if (MapUtils.isEmpty(mapToConvert)) {
+ return;
}
- private void addInputsOrOutputsToServiceTemplate(ServiceTemplate serviceTemplate,
- Map<String, Object> mapToConvert,
- String inputsOrOutputs) {
- if (MapUtils.isEmpty(mapToConvert)) {
- return;
- }
+ for (Map.Entry<String, Object> entry : mapToConvert.entrySet()) {
+ Optional<ParameterDefinition> parameterDefinition =
+ ToscaConverterUtil.createObjectFromClass(
+ entry.getKey(), entry.getValue(), ParameterDefinition.class);
- for (Map.Entry<String, Object> entry : mapToConvert.entrySet()) {
- Optional<ParameterDefinition> parameterDefinition =
- ToscaConverterUtil.createObjectFromClass(
- entry.getKey(), entry.getValue(), ParameterDefinition.class);
-
- parameterDefinition.ifPresent(parameterDefinitionValue -> {
- Optional<Object> defaultValue =
- ToscaConverterUtil.getDefaultValue(entry.getValue(), parameterDefinition.get());
- defaultValue.ifPresent(parameterDefinitionValue::set_default);
- addToServiceTemplateAccordingToSection(
- serviceTemplate, inputsOrOutputs, entry.getKey(), parameterDefinition.get());
- } );
- }
+ parameterDefinition.ifPresent(parameterDefinitionValue -> {
+ Optional<Object> defaultValue =
+ ToscaConverterUtil.getDefaultValue(entry.getValue(), parameterDefinition.get());
+ defaultValue.ifPresent(parameterDefinitionValue::set_default);
+ addToServiceTemplateAccordingToSection(
+ serviceTemplate, inputsOrOutputs, entry.getKey(), parameterDefinition.get());
+ });
}
+ }
private void addToServiceTemplateAccordingToSection(ServiceTemplate serviceTemplate,
String inputsOrOutputs,
@@ -350,177 +353,175 @@ public class ToscaConverterImpl implements ToscaConverter {
}
}
- private void convertNodeTemplates(ServiceTemplate serviceTemplate,
- ServiceTemplateReaderService readerService) {
- Map<String, Object> nodeTemplates = readerService.getNodeTemplates();
- if (MapUtils.isEmpty(nodeTemplates)) {
- return;
- }
+ private void convertNodeTemplates(ServiceTemplate serviceTemplate,
+ ServiceTemplateReaderService readerService) {
+ Map<String, Object> nodeTemplates = readerService.getNodeTemplates();
+ if (MapUtils.isEmpty(nodeTemplates)) {
+ return;
+ }
- for (Map.Entry<String, Object> nodeTemplateEntry : nodeTemplates.entrySet()) {
- NodeTemplate nodeTemplate = convertNodeTemplate(nodeTemplateEntry.getValue());
- DataModelUtil.addNodeTemplate(serviceTemplate, nodeTemplateEntry.getKey(), nodeTemplate);
- }
+ for (Map.Entry<String, Object> nodeTemplateEntry : nodeTemplates.entrySet()) {
+ NodeTemplate nodeTemplate = convertNodeTemplate(nodeTemplateEntry.getValue());
+ DataModelUtil.addNodeTemplate(serviceTemplate, nodeTemplateEntry.getKey(), nodeTemplate);
}
+ }
- private void convertSubstitutionMappings(ServiceTemplate serviceTemplate,
- ServiceTemplateReaderService readerService) {
- Map<String, Object> substitutionMappings = readerService.getSubstitutionMappings();
- if (MapUtils.isEmpty(substitutionMappings)) {
- return;
- }
- SubstitutionMapping substitutionMapping = convertSubstitutionMappings(substitutionMappings);
- DataModelUtil.addSubstitutionMapping(serviceTemplate, substitutionMapping);
+ private void convertSubstitutionMappings(ServiceTemplate serviceTemplate,
+ ServiceTemplateReaderService readerService) {
+ Map<String, Object> substitutionMappings = readerService.getSubstitutionMappings();
+ if (MapUtils.isEmpty(substitutionMappings)) {
+ return;
}
+ SubstitutionMapping substitutionMapping = convertSubstitutionMappings(substitutionMappings);
+ DataModelUtil.addSubstitutionMapping(serviceTemplate, substitutionMapping);
+ }
+
+ private SubstitutionMapping convertSubstitutionMappings(
+ Map<String, Object> substitutionMappings) {
+ SubstitutionMapping substitutionMapping = new SubstitutionMapping();
- private SubstitutionMapping convertSubstitutionMappings(Map<String, Object> substitutionMappings) {
- SubstitutionMapping substitutionMapping = new SubstitutionMapping();
+ substitutionMapping.setNode_type((String) substitutionMappings.get(nodeType));
+ substitutionMapping.setCapabilities(
+ convertSubstitutionMappingsSections(capabilities, substitutionMappings.get(capabilities)));
+ substitutionMapping.setRequirements(
+ convertSubstitutionMappingsSections(requirements, substitutionMappings.get(requirements)));
- substitutionMapping.setNode_type((String) substitutionMappings.get(nodeType));
- substitutionMapping.setCapabilities(
- convertSubstitutionMappingsSections(capabilities, substitutionMappings.get(capabilities)));
- substitutionMapping.setRequirements(
- convertSubstitutionMappingsSections(requirements, substitutionMappings.get(requirements)));
+ return substitutionMapping;
+ }
- return substitutionMapping;
+ private Map<String, List<String>> convertSubstitutionMappingsSections(String sectionName,
+ Object sectionToConvert) {
+
+ if (Objects.isNull(sectionToConvert)) {
+ return null;
}
- private Map<String, List<String>> convertSubstitutionMappingsSections(String sectionName,
- Object sectionToConvert) {
+ if (!(sectionToConvert instanceof Map)) {
+ throw new CoreException(
+ new SubstitutionMappingsConverterErrorBuilder(
+ sectionName, sectionToConvert.getClass().getSimpleName()).build());
+ }
- if(Objects.isNull(sectionToConvert)){
- return null;
- }
+ return convertSection(sectionToConvert);
+ }
- if(!(sectionToConvert instanceof Map)) {
- throw new CoreException(
- new SubstitutionMappingsConverterErrorBuilder(
- sectionName, sectionToConvert.getClass().getSimpleName()).build());
- }
+ private Map<String, List<String>> convertSection(Object sectionToConvert) {
+
+ Map<String, Object> sectionAsMap = (Map<String, Object>) sectionToConvert;
+ Map<String, List<String>> convertedSection = new HashMap<>();
- return convertSection(sectionToConvert);
+ if (MapUtils.isEmpty(sectionAsMap)) {
+ return null;
}
- private Map<String, List<String>> convertSection(Object sectionToConvert) {
+ for (Map.Entry<String, Object> entry : sectionAsMap.entrySet()) {
+ if (entry.getValue() instanceof List) {
+ convertedSection.put(entry.getKey(), (List<String>) entry.getValue());
+ }
+ }
- Map<String, Object> sectionAsMap = (Map<String, Object>)sectionToConvert;
- Map<String, List<String>> convertedSection = new HashMap<>();
+ return convertedSection;
+ }
- if (MapUtils.isEmpty(sectionAsMap)) {
- return null;
- }
+ private CsarFileTypes getFileType(String fileName) {
+ if (isMainServiceTemplate(fileName)) {
+ return CsarFileTypes.mainServiceTemplate;
+ } else if (isGlobalServiceTemplate(fileName)) {
+ return CsarFileTypes.globalServiceTemplate;
+ } else if (isDefinitions(fileName)) {
+ return CsarFileTypes.definitionsFile;
+ } else if (isMetadataFile(fileName)) {
+ return CsarFileTypes.toscaMetadata;
+ }
+ return CsarFileTypes.externalFile;
+ }
- for (Map.Entry<String, Object> entry : sectionAsMap.entrySet()) {
- if (entry.getValue() instanceof List) {
- convertedSection.put(entry.getKey(), (List<String>) entry.getValue());
- }
- }
+ private Optional<Manifest> getCsarManifest(Map<String, byte[]> csarFiles) throws IOException {
+ Optional<byte[]> manifestContent = getManifestContent(csarFiles);
- return convertedSection;
- }
+ if (manifestContent.isPresent()) {
+ ByteArrayInputStream byteInputStream = new ByteArrayInputStream(manifestContent.get());
- private CsarFileTypes getFileType(String fileName) {
- if (isMainServiceTemplate(fileName)) {
- return CsarFileTypes.mainServiceTemplate;
- } else if (isGlobalServiceTemplate(fileName)) {
- return CsarFileTypes.globalServiceTemplate;
- } else if (isDefinitions(fileName)) {
- return CsarFileTypes.definitionsFile;
- } else if (isMetadataFile(fileName)) {
- return CsarFileTypes.toscaMetadata;
- }
- return CsarFileTypes.externalFile;
+ return Optional.of(new Manifest(byteInputStream));
}
- private Optional<Manifest> getCsarManifest(Map<String, byte[]> csarFiles) throws IOException {
- Optional<byte[]> manifestContent = getManifestContent(csarFiles);
+ return Optional.empty();
+ }
- if (manifestContent.isPresent()) {
- ByteArrayInputStream byteInputStream = new ByteArrayInputStream(manifestContent.get());
+ private NodeTemplate convertNodeTemplate(Object candidateNodeTemplate) {
+ NodeTemplate nodeTemplate = new NodeTemplate();
- return Optional.of(new Manifest(byteInputStream));
- }
+ Map<String, Object> nodeTemplateAsMap = (Map<String, Object>) candidateNodeTemplate;
+ nodeTemplate.setArtifacts((Map<String, ArtifactDefinition>) nodeTemplateAsMap.get("artifacts"));
+ nodeTemplate.setAttributes((Map<String, Object>) nodeTemplateAsMap.get("attributes"));
+ nodeTemplate.setCopy((String) nodeTemplateAsMap.get("copy"));
+ nodeTemplate.setDescription((String) nodeTemplateAsMap.get("description"));
+ nodeTemplate.setDirectives((List<String>) nodeTemplateAsMap.get("directives"));
+ nodeTemplate.setInterfaces(
+ (Map<String, InterfaceDefinition>) nodeTemplateAsMap.get("interfaces"));
+ nodeTemplate.setNode_filter((NodeFilter) nodeTemplateAsMap.get("node_filter"));
+ nodeTemplate.setProperties((Map<String, Object>) nodeTemplateAsMap.get("properties"));
+ nodeTemplate.setRequirements(
+ (List<Map<String, RequirementAssignment>>) nodeTemplateAsMap.get("requirements"));
+ nodeTemplate.setType((String) nodeTemplateAsMap.get("type"));
+ nodeTemplate.setCapabilities(
+ convertCapabilities((Map<String, Object>) nodeTemplateAsMap.get("capabilities")));
- return Optional.empty();
- }
+ return nodeTemplate;
+ }
- private NodeTemplate convertNodeTemplate(Object candidateNodeTemplate) {
- NodeTemplate nodeTemplate = new NodeTemplate();
-
- Map<String, Object> nodeTemplateAsMap = (Map<String, Object>) candidateNodeTemplate;
- nodeTemplate.setArtifacts((Map<String, ArtifactDefinition>) nodeTemplateAsMap.get("artifacts"));
- nodeTemplate.setAttributes((Map<String, Object>) nodeTemplateAsMap.get("attributes"));
- nodeTemplate.setCopy((String) nodeTemplateAsMap.get("copy"));
- nodeTemplate.setDescription((String) nodeTemplateAsMap.get("description"));
- nodeTemplate.setDirectives((List<String>) nodeTemplateAsMap.get("directives"));
- nodeTemplate.setInterfaces(
- (Map<String, InterfaceDefinition>) nodeTemplateAsMap.get("interfaces"));
- nodeTemplate.setNode_filter((NodeFilter) nodeTemplateAsMap.get("node_filter"));
- nodeTemplate.setProperties((Map<String, Object>) nodeTemplateAsMap.get("properties"));
- nodeTemplate.setRequirements(
- (List<Map<String, RequirementAssignment>>) nodeTemplateAsMap.get("requirements"));
- nodeTemplate.setType((String) nodeTemplateAsMap.get("type"));
- nodeTemplate.setCapabilities(
- convertCapabilities((Map<String, Object>) nodeTemplateAsMap.get("capabilities")));
-
- return nodeTemplate;
+ private Map<String, CapabilityAssignment> convertCapabilities(Map<String, Object> capabilities) {
+ if (MapUtils.isEmpty(capabilities)) {
+ return null;
}
- private List<Map<String, CapabilityAssignment>> convertCapabilities(Map<String, Object> capabilities) {
- List<Map<String, CapabilityAssignment>> convertedCapabilities = new ArrayList<>();
- if (MapUtils.isEmpty(capabilities)) {
- return null;
- }
- for (Map.Entry<String, Object> capabilityAssignmentEntry : capabilities.entrySet()) {
- Map<String, CapabilityAssignment> tempMap = new HashMap<>();
- Optional<CapabilityAssignment> capabilityAssignment = ToscaConverterUtil.createObjectFromClass
- (capabilityAssignmentEntry.getKey(), capabilityAssignmentEntry.getValue(),
- CapabilityAssignment.class);
-
- capabilityAssignment.ifPresent(capabilityAssignmentValue -> {
- tempMap.put(capabilityAssignmentEntry.getKey(), capabilityAssignmentValue);
- convertedCapabilities.add(tempMap);
- }
- );
+ Map<String, CapabilityAssignment> convertedCapabilities = new HashMap<>();
+ for (Map.Entry<String, Object> capabilityAssignmentEntry : capabilities.entrySet()) {
+ Optional<CapabilityAssignment> capabilityAssignment = ToscaConverterUtil.createObjectFromClass
+ (capabilityAssignmentEntry.getKey(), capabilityAssignmentEntry.getValue(),
+ CapabilityAssignment.class);
+
+ capabilityAssignment.ifPresent(capabilityAssignmentValue ->
+ convertedCapabilities.put(capabilityAssignmentEntry.getKey(), capabilityAssignmentValue));
- }
- return convertedCapabilities;
}
+ return convertedCapabilities;
+ }
- private boolean isMainServiceTemplate(String fileName) {
- return fileName.endsWith(mainStName);
- }
+ private boolean isMainServiceTemplate(String fileName) {
+ return fileName.endsWith(mainStName);
+ }
- private boolean isMetadataFile(String fileName) {
- return fileName.equals(metadataFile);
- }
+ private boolean isMetadataFile(String fileName) {
+ return fileName.equals(metadataFile);
+ }
- private boolean isGlobalServiceTemplate(String fileName) {
- return fileName.endsWith(globalStName);
- }
+ private boolean isGlobalServiceTemplate(String fileName) {
+ return fileName.endsWith(globalStName);
+ }
- private boolean isDefinitions(String fileName) {
- return fileName.startsWith(definitionsDir);
- }
+ private boolean isDefinitions(String fileName) {
+ return fileName.startsWith(definitionsDir);
+ }
- private String getTemplateNameFromStName(String serviceTemplateName) {
- String fileNameWithoutDirectories;
- fileNameWithoutDirectories = getFileNameWithoutDirectories(serviceTemplateName);
- return fileNameWithoutDirectories.split("ServiceTemplate")[0];
- }
+ private String getTemplateNameFromStName(String serviceTemplateName) {
+ String fileNameWithoutDirectories;
+ fileNameWithoutDirectories = getFileNameWithoutDirectories(serviceTemplateName);
+ return fileNameWithoutDirectories.split("ServiceTemplate")[0];
+ }
- private String getFileNameWithoutDirectories(String serviceTemplateName) {
- String fileNameWithoutDirectories;
- if (serviceTemplateName.contains("/")) {
- String[] split = serviceTemplateName.split("/");
- fileNameWithoutDirectories = split[split.length - 1];
- } else if (serviceTemplateName.contains(File.separator)) {
- String[] split = serviceTemplateName.split(Pattern.quote(File.separator));
- fileNameWithoutDirectories = split[split.length - 1];
- } else {
- fileNameWithoutDirectories = serviceTemplateName;
- }
- return fileNameWithoutDirectories;
- }
+ private String getFileNameWithoutDirectories(String serviceTemplateName) {
+ String fileNameWithoutDirectories;
+ if (serviceTemplateName.contains("/")) {
+ String[] split = serviceTemplateName.split("/");
+ fileNameWithoutDirectories = split[split.length - 1];
+ } else if (serviceTemplateName.contains(File.separator)) {
+ String[] split = serviceTemplateName.split(Pattern.quote(File.separator));
+ fileNameWithoutDirectories = split[split.length - 1];
+ } else {
+ fileNameWithoutDirectories = serviceTemplateName;
+ }
+ return fileNameWithoutDirectories;
+ }
}
diff --git a/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/test/resources/mock/toscaConverter/conversionWithInt/out/MainServiceTemplate.yaml b/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/test/resources/mock/toscaConverter/conversionWithInt/out/MainServiceTemplate.yaml
index 1a5c61efbe..9cf2427c2d 100644
--- a/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/test/resources/mock/toscaConverter/conversionWithInt/out/MainServiceTemplate.yaml
+++ b/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/test/resources/mock/toscaConverter/conversionWithInt/out/MainServiceTemplate.yaml
@@ -34,7 +34,7 @@ topology_template:
capability: virtual_storage
node: SCU_Storage
capabilities:
- - virtual_compute:
+ virtual_compute:
properties:
virtual_memory:
virtual_mem_size: 24G
diff --git a/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/test/resources/mock/toscaConverter/convertMainSt/out/MainServiceTemplate.yaml b/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/test/resources/mock/toscaConverter/convertMainSt/out/MainServiceTemplate.yaml
index 88ae60529d..0f41bb0d8b 100644
--- a/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/test/resources/mock/toscaConverter/convertMainSt/out/MainServiceTemplate.yaml
+++ b/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/test/resources/mock/toscaConverter/convertMainSt/out/MainServiceTemplate.yaml
@@ -48,7 +48,7 @@ topology_template:
- local_storage:
node: tosca.nodes.Root
capabilities:
- - virtual_compute:
+ virtual_compute:
properties:
virtual_memory:
virtual_mem_size: 24G
@@ -116,7 +116,7 @@ topology_template:
- local_storage:
node: tosca.nodes.Root
capabilities:
- - virtual_compute:
+ virtual_compute:
properties:
virtual_memory:
virtual_mem_size: 24G
@@ -177,7 +177,7 @@ topology_template:
- local_storage:
node: tosca.nodes.Root
capabilities:
- - virtual_compute:
+ virtual_compute:
properties:
virtual_memory:
virtual_mem_size: 24G
@@ -410,7 +410,7 @@ topology_template:
- local_storage:
node: tosca.nodes.Root
capabilities:
- - virtual_compute:
+ virtual_compute:
properties:
virtual_memory:
virtual_mem_size: 24G
@@ -450,7 +450,7 @@ topology_template:
- local_storage:
node: tosca.nodes.Root
capabilities:
- - virtual_compute:
+ virtual_compute:
properties:
virtual_memory:
virtual_mem_size: 16G
diff --git a/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/services/DataModelUtil.java b/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/services/DataModelUtil.java
index fd89faeb85..8da2fc8c54 100644
--- a/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/services/DataModelUtil.java
+++ b/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/services/DataModelUtil.java
@@ -1114,16 +1114,14 @@ public class DataModelUtil {
public static void addNodeTemplateCapability(NodeTemplate nodeTemplate, String capabilityId,
Map<String, Object> capabilityProperties,
Map<String, Object> capabilityAttributes) {
- List<Map<String, CapabilityAssignment>> capabilities = nodeTemplate.getCapabilities();
+ Map<String, CapabilityAssignment> capabilities = nodeTemplate.getCapabilities();
if (Objects.isNull(capabilities)) {
- capabilities = new ArrayList<>();
+ capabilities = new HashMap<>();
}
CapabilityAssignment capabilityAssignment = new CapabilityAssignment();
capabilityAssignment.setProperties(capabilityProperties);
capabilityAssignment.setAttributes(capabilityAttributes);
- Map<String, CapabilityAssignment> nodeTemplateCapability = new HashMap<>();
- nodeTemplateCapability.put(capabilityId, capabilityAssignment);
- capabilities.add(nodeTemplateCapability);
+ capabilities.put(capabilityId, capabilityAssignment);
nodeTemplate.setCapabilities(capabilities);
}
diff --git a/openecomp-be/lib/openecomp-tosca-lib/src/test/java/org/openecomp/sdc/tosca/datatypes/ToscaModelTest.java b/openecomp-be/lib/openecomp-tosca-lib/src/test/java/org/openecomp/sdc/tosca/datatypes/ToscaModelTest.java
index e8c9c602f8..60f59dbd81 100644
--- a/openecomp-be/lib/openecomp-tosca-lib/src/test/java/org/openecomp/sdc/tosca/datatypes/ToscaModelTest.java
+++ b/openecomp-be/lib/openecomp-tosca-lib/src/test/java/org/openecomp/sdc/tosca/datatypes/ToscaModelTest.java
@@ -238,8 +238,7 @@ public class ToscaModelTest {
capAtts.put("num_cpus", "66");
capAss.setAttributes(capAtts);
nodeTemplateCapability.put("cap1", capAss);
- nodeTemplate.setCapabilities(new ArrayList<>());
- nodeTemplate.getCapabilities().add(nodeTemplateCapability);
+ nodeTemplate.setCapabilities(nodeTemplateCapability);
NodeFilter nodeTemplateNodeFilter = new NodeFilter();
Map<String, List<Constraint>> ntProp = new HashMap<>();
diff --git a/openecomp-be/lib/openecomp-tosca-lib/src/test/resources/mock/model/serviceTemplate.yaml b/openecomp-be/lib/openecomp-tosca-lib/src/test/resources/mock/model/serviceTemplate.yaml
index 2fb8042e00..c49f30f97b 100644
--- a/openecomp-be/lib/openecomp-tosca-lib/src/test/resources/mock/model/serviceTemplate.yaml
+++ b/openecomp-be/lib/openecomp-tosca-lib/src/test/resources/mock/model/serviceTemplate.yaml
@@ -99,7 +99,7 @@ topology_template:
node: nodeA
relationship: relationB
capabilities:
- - cap1:
+ cap1:
properties:
num_cpus: '{ get_input: cpus }'
attributes:
diff --git a/openecomp-be/lib/openecomp-tosca-lib/src/test/resources/mock/model/serviceTemplateHeatExtend.yaml b/openecomp-be/lib/openecomp-tosca-lib/src/test/resources/mock/model/serviceTemplateHeatExtend.yaml
index 6f34a76ab4..ac349313c2 100644
--- a/openecomp-be/lib/openecomp-tosca-lib/src/test/resources/mock/model/serviceTemplateHeatExtend.yaml
+++ b/openecomp-be/lib/openecomp-tosca-lib/src/test/resources/mock/model/serviceTemplateHeatExtend.yaml
@@ -104,7 +104,7 @@ topology_template:
node: nodeA
relationship: relationB
capabilities:
- - cap1:
+ cap1:
properties:
num_cpus: '{ get_input: cpus }'
attributes: