aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormark.j.leonard <mark.j.leonard@gmail.com>2018-08-07 18:33:38 +0100
committermark.j.leonard <mark.j.leonard@gmail.com>2018-08-07 18:36:49 +0100
commit93f9fec9586702a15d6a562ead3d0d432a12b487 (patch)
treec13557a84a7ccac89431fb0118fd96e74eae9cfc
parent8ef1cdfadf5d8c112ea1cc6a99f61ed21fb986de (diff)
Add VF Module Groups to the SD-WAN Service test
Create additional TOSCA YAML content for the existing SD-WAN Service CSAR input file, so that the VF Module processing code is invoked. Issue-ID: AAI-1250 Change-Id: I24a842223154d52e1a4a19e5b9cd739b0ceee4f4 Signed-off-by: mark.j.leonard <mark.j.leonard@gmail.com>
-rw-r--r--src/test/java/org/onap/aai/babel/csar/extractor/YamlExtractorTest.java13
-rw-r--r--src/test/resources/compressedArtifacts/service-SdWanServiceTest-csar.csarbin16003 -> 18148 bytes
-rw-r--r--src/test/resources/generatedXml/AAI-SD-WAN-Service-Test-service-1.0.xml41
-rw-r--r--src/test/resources/ymlFiles/groups.yml104
-rw-r--r--src/test/resources/ymlFiles/resource-Allotedresource-template.yml62
5 files changed, 216 insertions, 4 deletions
diff --git a/src/test/java/org/onap/aai/babel/csar/extractor/YamlExtractorTest.java b/src/test/java/org/onap/aai/babel/csar/extractor/YamlExtractorTest.java
index f783e7c..faeb536 100644
--- a/src/test/java/org/onap/aai/babel/csar/extractor/YamlExtractorTest.java
+++ b/src/test/java/org/onap/aai/babel/csar/extractor/YamlExtractorTest.java
@@ -113,13 +113,17 @@ public class YamlExtractorTest {
payloads.add("ymlFiles/resource-SdWanTestVsp-template.yml");
payloads.add("ymlFiles/resource-TunnelXconntest-template.yml");
payloads.add("ymlFiles/service-SdWanServiceTest-template.yml");
+ payloads.add("ymlFiles/resource-Allotedresource-template.yml");
payloads.add("ymlFiles/artifacts.yml");
payloads.add("ymlFiles/data.yml");
+ payloads.add("ymlFiles/groups.yml");
new ArtifactTestUtils().performYmlAsserts(ymlFiles, payloads);
}
/**
+ * Call the extractor with the specified arguments and assert that an exception is thrown.
+ *
* @param archive
* @param name
* @param version
@@ -136,12 +140,17 @@ public class YamlExtractorTest {
}
/**
+ * Extract Artifacts from the specified CSAR resource.
+ *
* @param resourceName
- * @return
+ * the CSAR file
+ * @return the extracted artifacts
* @throws InvalidArchiveException
* @throws IOException
+ * for I/O errors
*/
private List<Artifact> extractArchive(String resourceName) throws InvalidArchiveException, IOException {
- return new YamlExtractor().extract(new ArtifactTestUtils().getCompressedArtifact(resourceName), resourceName, "v1");
+ byte[] csar = new ArtifactTestUtils().getCompressedArtifact(resourceName);
+ return new YamlExtractor().extract(csar, resourceName, "v1");
}
}
diff --git a/src/test/resources/compressedArtifacts/service-SdWanServiceTest-csar.csar b/src/test/resources/compressedArtifacts/service-SdWanServiceTest-csar.csar
index 9d6132a..bbace0b 100644
--- a/src/test/resources/compressedArtifacts/service-SdWanServiceTest-csar.csar
+++ b/src/test/resources/compressedArtifacts/service-SdWanServiceTest-csar.csar
Binary files differ
diff --git a/src/test/resources/generatedXml/AAI-SD-WAN-Service-Test-service-1.0.xml b/src/test/resources/generatedXml/AAI-SD-WAN-Service-Test-service-1.0.xml
index 8ca25c3..fab91fd 100644
--- a/src/test/resources/generatedXml/AAI-SD-WAN-Service-Test-service-1.0.xml
+++ b/src/test/resources/generatedXml/AAI-SD-WAN-Service-Test-service-1.0.xml
@@ -11,7 +11,44 @@
<model-element>
<new-data-del-flag>T</new-data-del-flag>
<cardinality>unbounded</cardinality>
- <model-elements/>
+ <model-elements>
+ <model-element>
+ <new-data-del-flag>T</new-data-del-flag>
+ <cardinality>unbounded</cardinality>
+ <model-elements />
+ <relationship-list>
+ <relationship>
+ <related-to>model-ver</related-to>
+ <relationship-data>
+ <relationship-key>model-ver.model-version-id</relationship-key>
+ <relationship-value>2a111111-1111-1111-1111-111111111111</relationship-value>
+ </relationship-data>
+ <relationship-data>
+ <relationship-key>model.model-invariant-id</relationship-key>
+ <relationship-value>1a111111-1111-1111-1111-111111111111</relationship-value>
+ </relationship-data>
+ </relationship>
+ </relationship-list>
+ </model-element>
+ <model-element>
+ <new-data-del-flag>T</new-data-del-flag>
+ <cardinality>unbounded</cardinality>
+ <model-elements />
+ <relationship-list>
+ <relationship>
+ <related-to>model-ver</related-to>
+ <relationship-data>
+ <relationship-key>model-ver.model-version-id</relationship-key>
+ <relationship-value>2b111111-1111-1111-1111-111111111111</relationship-value>
+ </relationship-data>
+ <relationship-data>
+ <relationship-key>model.model-invariant-id</relationship-key>
+ <relationship-value>1b111111-1111-1111-1111-111111111111</relationship-value>
+ </relationship-data>
+ </relationship>
+ </relationship-list>
+ </model-element>
+ </model-elements>
<relationship-list>
<relationship>
<related-to>model-ver</related-to>
@@ -29,4 +66,4 @@
</model-elements>
</model-ver>
</model-vers>
-</model>
+</model> \ No newline at end of file
diff --git a/src/test/resources/ymlFiles/groups.yml b/src/test/resources/ymlFiles/groups.yml
new file mode 100644
index 0000000..0fea540
--- /dev/null
+++ b/src/test/resources/ymlFiles/groups.yml
@@ -0,0 +1,104 @@
+#
+# 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.
+#
+
+tosca_definitions_version: tosca_simple_yaml_1_0
+
+#metadata:
+# filename: tosca/groups.yml
+# version: '1.0'
+
+imports:
+- data.yml
+
+group_types:
+ tosca.groups.Root:
+ description: This is the default (root) TOSCA Group Type definition that all other TOSCA base Group Types derive from.
+ interfaces:
+ standard:
+ type: tosca.interfaces.node.lifecycle.Standard
+ org.openecomp.groups.VfModule:
+ derived_from: tosca.groups.Root
+ description: Grouped all heat resources which are in the same VF Module
+ properties:
+ isBase:
+ description: Whether this module should be deployed before other modules
+ type: boolean
+ status: supported
+ default: false
+ required: true
+ vf_module_label:
+ description: |
+ Alternate textual key used to reference this VF-Module model. Must be unique within the VNF model
+ type: string
+ required: true
+ vf_module_description:
+ description: |
+ Description of the VF-modules contents and purpose (e.g. "Front-End" or "Database Cluster")
+ type: string
+ required: true
+ min_vf_module_instances:
+ description: The minimum instances of this VF-Module
+ type: integer
+ required: true
+ max_vf_module_instances:
+ description: The maximum instances of this VF-Module
+ type: integer
+ required: false
+ initial_count:
+ description: |
+ The initial count of instances of the VF-Module. The value must be in the range between min_vfmodule_instances and max_vfmodule_instances. If no value provided the initial count is the min_vfmodule_instances.
+ type: integer
+ required: false
+ vf_module_type:
+ type: string
+ required: true
+ constraints:
+ - valid_values:
+ - Base
+ - Expansion
+ volume_group:
+ description: |
+ "true" indicates that this VF Module model requires attachment to a Volume Group. VID operator must select the Volume Group instance to attach to a VF-Module at deployment time.
+ type: boolean
+ default: false
+ required: true
+ availability_zone_count:
+ type: integer
+ required: false
+ description: >
+ Quantity of Availability Zones needed for this VF-Module
+ (source: Extracted from VF-Module HEAT template)
+ vfc_list:
+ type: map
+ entry_schema:
+ description: <vfc_id>:<count>
+ type: string
+ required: false
+ description: >
+ Identifies the set of VM types and their count included in the VF-Module
+
+ org.openecomp.groups.heat.HeatStack:
+ derived_from: org.openecomp.groups.VfModule
+ description: Grouped all heat resources which are in the same heat stack
+ properties:
+ heat_file:
+ description: Heat file which associate to this group/heat stack
+ type: string
+ status: supported
+ required: true
+ description:
+ description: group description
+ type: string
+ status: supported
+ required: true
diff --git a/src/test/resources/ymlFiles/resource-Allotedresource-template.yml b/src/test/resources/ymlFiles/resource-Allotedresource-template.yml
new file mode 100644
index 0000000..cd405e8
--- /dev/null
+++ b/src/test/resources/ymlFiles/resource-Allotedresource-template.yml
@@ -0,0 +1,62 @@
+tosca_definitions_version: tosca_simple_yaml_1_0
+metadata:
+ invariantUUID: cf3ccc9c-b6ea-468e-8eef-f45479978fc1
+ UUID: 76ba485f-50a3-480d-895e-5c319191bc11
+ name: Allotedresource
+ description: Allotedresource
+ type: VFC
+ category: Allotted Resource
+ subcategory: Allotted Resource
+ resourceVendor: '123'
+ resourceVendorRelease: '123'
+imports:
+- nodes:
+ file: nodes.yml
+- datatypes:
+ file: data.yml
+- capabilities:
+ file: capabilities.yml
+- relationships:
+ file: relationships.yml
+- groups:
+ file: groups.yml
+- policies:
+ file: policies.yml
+node_types:
+ org.openecomp.resource.vfc.AllottedResource1235:
+ derived_from: tosca.nodes.Root
+ description: Allotedresource
+ properties:
+ target_network_role:
+ type: string
+ description: Target network role
+ providing_service_invariant_uuid:
+ type: string
+ description: The depending service invariant uuid in order to map the allotted resource to the specific service version
+ role:
+ type: string
+ description: Unique label that defines the role that this allotted resource performs
+ providing_service_uuid:
+ type: string
+ description: The depending service uuid in order to map the allotted resource to the specific service version
+ ecomp_naming:
+ type: org.openecomp.datatypes.EcompNaming
+ providing_service_name:
+ type: string
+ description: The depending service name in order to map the allotted resource to the specific service version
+ max_instances:
+ type: integer
+ default: 1
+ min_instances:
+ type: integer
+ default: 1
+ ecomp_homing:
+ type: org.openecomp.datatypes.EcompHoming
+ requirements:
+ - service_dependency:
+ occurrences:
+ - 1
+ - 1
+ capability: org.openecomp.capabilities.AllottedResource
+ node: tosca.services.Root
+ relationship: tosca.relationships.DependsOn