From 27fed258bd045e4af8cdc1181ebf3cef8d0822cc Mon Sep 17 00:00:00 2001 From: eleonorali Date: Sun, 11 Feb 2018 14:04:58 +0200 Subject: Artifact was not associated ASDC is not associating get_file Change-Id: I56cda457c061e5228012d43b5743ebfa24b4bb0d Issue-ID: SDC-1016 Signed-off-by: eleonorali --- .../heat/services/tree/HeatTreeManagerUtil.java | 6 +- .../heat/services/tree/HeatTreeManagerTest.java | 58 ++- .../MANIFEST.json | 72 ++++ .../heatTreeArtifactsValidationOutput/base_ocg.env | 9 + .../base_ocg.yaml | 74 ++++ .../heatTreeArtifactsValidationOutput/ocgapp.env | 28 ++ .../heatTreeArtifactsValidationOutput/ocgapp.yaml | 333 ++++++++++++++++++ .../ocgapp_nested_volume.yaml | 45 +++ .../ocgapp_volume.env | 7 + .../ocgapp_volume.yaml | 45 +++ .../heatTreeArtifactsValidationOutput/ocgmgr.env | 26 ++ .../heatTreeArtifactsValidationOutput/ocgmgr.yaml | 188 ++++++++++ .../ocgmgr_nested.txt | 389 +++++++++++++++++++++ .../ocgmgr_nested_volume.yaml | 45 +++ .../ocgmgr_volume.env | 8 + .../ocgmgr_volume.yaml | 44 +++ 16 files changed, 1363 insertions(+), 14 deletions(-) create mode 100644 openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-core/src/test/resources/heatTreeArtifactsValidationOutput/MANIFEST.json create mode 100644 openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-core/src/test/resources/heatTreeArtifactsValidationOutput/base_ocg.env create mode 100644 openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-core/src/test/resources/heatTreeArtifactsValidationOutput/base_ocg.yaml create mode 100644 openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-core/src/test/resources/heatTreeArtifactsValidationOutput/ocgapp.env create mode 100644 openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-core/src/test/resources/heatTreeArtifactsValidationOutput/ocgapp.yaml create mode 100644 openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-core/src/test/resources/heatTreeArtifactsValidationOutput/ocgapp_nested_volume.yaml create mode 100644 openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-core/src/test/resources/heatTreeArtifactsValidationOutput/ocgapp_volume.env create mode 100644 openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-core/src/test/resources/heatTreeArtifactsValidationOutput/ocgapp_volume.yaml create mode 100644 openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-core/src/test/resources/heatTreeArtifactsValidationOutput/ocgmgr.env create mode 100644 openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-core/src/test/resources/heatTreeArtifactsValidationOutput/ocgmgr.yaml create mode 100644 openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-core/src/test/resources/heatTreeArtifactsValidationOutput/ocgmgr_nested.txt create mode 100644 openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-core/src/test/resources/heatTreeArtifactsValidationOutput/ocgmgr_nested_volume.yaml create mode 100644 openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-core/src/test/resources/heatTreeArtifactsValidationOutput/ocgmgr_volume.env create mode 100644 openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-core/src/test/resources/heatTreeArtifactsValidationOutput/ocgmgr_volume.yaml diff --git a/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/services/tree/HeatTreeManagerUtil.java b/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/services/tree/HeatTreeManagerUtil.java index 87022f4e37..7a2dfc971b 100644 --- a/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/services/tree/HeatTreeManagerUtil.java +++ b/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/services/tree/HeatTreeManagerUtil.java @@ -1,5 +1,5 @@ /* - * Copyright © 2016-2017 European Support Limited + * Copyright © 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. @@ -96,8 +96,8 @@ public class HeatTreeManagerUtil { Collection properties = resource.getProperties() == null ? null : resource.getProperties().values(); - artifactSet = getArtifactsFromPropertiesAndAddInArtifactSet(properties, - filename, globalContext); + artifactSet.addAll(getArtifactsFromPropertiesAndAddInArtifactSet(properties, + filename, globalContext)); } } return artifactSet; diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-core/src/test/java/org/openecomp/sdc/heat/services/tree/HeatTreeManagerTest.java b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-core/src/test/java/org/openecomp/sdc/heat/services/tree/HeatTreeManagerTest.java index e5d1a88821..c43c55721e 100644 --- a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-core/src/test/java/org/openecomp/sdc/heat/services/tree/HeatTreeManagerTest.java +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-core/src/test/java/org/openecomp/sdc/heat/services/tree/HeatTreeManagerTest.java @@ -1,22 +1,18 @@ -/*- - * ============LICENSE_START======================================================= - * SDC - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ +/* + * Copyright © 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. - * ============LICENSE_END========================================================= - */ +*/ package org.openecomp.sdc.heat.services.tree; @@ -31,7 +27,7 @@ import org.testng.annotations.Test; import java.io.File; import java.io.FileInputStream; import java.io.IOException; -import java.net.URL; +import java.net.URL;; public class HeatTreeManagerTest { @@ -62,6 +58,46 @@ public class HeatTreeManagerTest { Assert.assertEquals(tree.getHeat().size(), 2); } + @Test + public void testHeatTreeArtifactsCreated() { + + FileContentHandler fileContentMap = new FileContentHandler(); + URL url = this.getClass().getResource("/heatTreeArtifactsValidationOutput"); + + File templateDir = new File(url.getFile()); + File[] files = templateDir.listFiles(); + + if (files == null || files.length == 0) { + return; + } + + for (File file : files) { + fileContentMap.addFile(file.getName(), getFileContent(file)); + } + + HeatTreeManager heatTreeManager = HeatTreeManagerUtil.initHeatTreeManager(fileContentMap); + heatTreeManager.createTree(); + HeatStructureTree tree = heatTreeManager.getTree(); + Assert.assertNotNull(tree); + Assert.assertEquals(tree.getHeat().size(), 3); + verifyHeatArtifacts(tree, "ocgmgr.yaml", 1); + verifyHeatArtifacts(tree, "ocgapp.yaml", 0); + verifyHeatArtifacts(tree, "base_ocg.yaml", 0); + + } + + private void verifyHeatArtifacts(HeatStructureTree tree, String heatName, int expectedArtifactNum ) { + HeatStructureTree heat = HeatStructureTree.getHeatStructureTreeByName(tree.getHeat(), heatName); + if(expectedArtifactNum > 0) { + Assert.assertNotNull(heat.getArtifacts()); + Assert.assertEquals(heat.getArtifacts().size(), expectedArtifactNum); + } else { + Assert.assertNull(heat.getArtifacts()); + } + + } + + private byte[] getFileContent(File file) { try { return FileUtils.toByteArray(new FileInputStream(file)); diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-core/src/test/resources/heatTreeArtifactsValidationOutput/MANIFEST.json b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-core/src/test/resources/heatTreeArtifactsValidationOutput/MANIFEST.json new file mode 100644 index 0000000000..d8250a6f2b --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-core/src/test/resources/heatTreeArtifactsValidationOutput/MANIFEST.json @@ -0,0 +1,72 @@ +{ + "name": "vOCG-1802-VSP", + "description": "vOCG HEAT January 16 2018", + "version": "0.0", + "data": [ + { + "isBase": false, + "file": "ocgmgr.yaml", + "type": "HEAT", + "data": [ + { + "file": "ocgmgr.env", + "type": "HEAT_ENV" + }, + { + "file": "ocgmgr_volume.yaml", + "type": "HEAT_VOL", + "data": [ + { + "file": "ocgmgr_volume.env", + "type": "HEAT_ENV" + } + ] + } + ] + }, + { + "isBase": false, + "file": "ocgapp.yaml", + "type": "HEAT", + "data": [ + { + "file": "ocgapp.env", + "type": "HEAT_ENV" + }, + { + "file": "ocgapp_volume.yaml", + "type": "HEAT_VOL", + "data": [ + { + "file": "ocgapp_volume.env", + "type": "HEAT_ENV" + } + ] + } + ] + }, + { + "isBase": true, + "file": "base_ocg.yaml", + "type": "HEAT", + "data": [ + { + "file": "base_ocg.env", + "type": "HEAT_ENV" + } + ] + }, + { + "file": "ocgmgr_nested_volume.yaml", + "type": "HEAT" + }, + { + "file": "ocgapp_nested_volume.yaml", + "type": "HEAT" + }, + { + "file": "ocgmgr_nested.txt", + "type": "OTHER" + } + ] +} \ No newline at end of file diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-core/src/test/resources/heatTreeArtifactsValidationOutput/base_ocg.env b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-core/src/test/resources/heatTreeArtifactsValidationOutput/base_ocg.env new file mode 100644 index 0000000000..26e28e7a40 --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-core/src/test/resources/heatTreeArtifactsValidationOutput/base_ocg.env @@ -0,0 +1,9 @@ +#OCG Base Template ENV File +#Version 1.0 +#Authors: + +##################### +parameters: +##################### + +# vnf_name: 'zrdm6bvocg01' diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-core/src/test/resources/heatTreeArtifactsValidationOutput/base_ocg.yaml b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-core/src/test/resources/heatTreeArtifactsValidationOutput/base_ocg.yaml new file mode 100644 index 0000000000..585d9a039c --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-core/src/test/resources/heatTreeArtifactsValidationOutput/base_ocg.yaml @@ -0,0 +1,74 @@ +heat_template_version: 2015-04-30 +#OCG Base Template +#AUTHORS: +description: > + Base HOT template to create The Security Group for the the OCG VNF + +##################### +parameters: +##################### + +## GLOBAL//Basic Parameters + vnf_name: + type: string + description: Unique name for this VF instance +# For manual spinups, value must be in the ENV file. Must be removed from ENV before uploading to ASDC + +##################### +resources: +##################### + + OCGAPP_SECURITY_GROUP: + type: OS::Neutron::SecurityGroup + properties: + description: ocg app security group + name: + str_replace: + template: VF_NAME_sec_grp_OCGAPP + params: + VF_NAME: {get_param: vnf_name} + rules: [{"direction": egress, "ethertype": IPv4, "port_range_min": 1, "port_range_max": 65535, "protocol": tcp, "remote_ip_prefix": 0.0.0.0/0}, + {"direction": egress, "ethertype": IPv4, "port_range_min": 1, "port_range_max": 65535, "protocol": udp, "remote_ip_prefix": 0.0.0.0/0}, + {"direction": egress, "ethertype": IPv4, "protocol": icmp, "remote_ip_prefix": 0.0.0.0/0}, + {"direction": ingress, "ethertype": IPv4, "port_range_min": 1, "port_range_max": 65535, "protocol": tcp, "remote_ip_prefix": 0.0.0.0/0}, + {"direction": ingress, "ethertype": IPv4, "port_range_min": 1, "port_range_max": 65535, "protocol": udp, "remote_ip_prefix": 0.0.0.0/0}, + {"direction": ingress, "ethertype": IPv4, "protocol": icmp, "remote_ip_prefix": 0.0.0.0/0}, + {"direction": egress, "ethertype": IPv6, "port_range_min": 1, "port_range_max": 65535, "protocol": tcp, "remote_ip_prefix": "::/0"}, + {"direction": egress, "ethertype": IPv6, "port_range_min": 1, "port_range_max": 65535, "protocol": udp, "remote_ip_prefix": "::/0"}, + {"direction": egress, "ethertype": IPv6, "protocol": icmp, "remote_ip_prefix": "::/0"}, + {"direction": ingress, "ethertype": IPv6, "port_range_min": 1, "port_range_max": 65535, "protocol": tcp, "remote_ip_prefix": "::/0"}, + {"direction": ingress, "ethertype": IPv6, "port_range_min": 1, "port_range_max": 65535, "protocol": udp, "remote_ip_prefix": "::/0"}, + {"direction": ingress, "ethertype": IPv6, "protocol": icmp, "remote_ip_prefix": "::/0"} + ] + + OCGMGR_SECURITY_GROUP: + type: OS::Neutron::SecurityGroup + properties: + description: ocg mgr security group + name: + str_replace: + template: VF_NAME_sec_grp_OCGMGR + params: + VF_NAME: {get_param: vnf_name} + rules: [{"direction": egress, "ethertype": IPv4, "port_range_min": 1, "port_range_max": 65535, "protocol": tcp, "remote_ip_prefix": 0.0.0.0/0}, + {"direction": egress, "ethertype": IPv4, "port_range_min": 1, "port_range_max": 65535, "protocol": udp, "remote_ip_prefix": 0.0.0.0/0}, + {"direction": egress, "ethertype": IPv4, "protocol": icmp, "remote_ip_prefix": 0.0.0.0/0}, + {"direction": ingress, "ethertype": IPv4, "port_range_min": 1, "port_range_max": 65535, "protocol": tcp, "remote_ip_prefix": 0.0.0.0/0}, + {"direction": ingress, "ethertype": IPv4, "port_range_min": 1, "port_range_max": 65535, "protocol": udp, "remote_ip_prefix": 0.0.0.0/0}, + {"direction": ingress, "ethertype": IPv4, "protocol": icmp, "remote_ip_prefix": 0.0.0.0/0}, + #{"direction": egress, "ethertype": IPv6, "port_range_min": 1, "port_range_max": 65535, "protocol": tcp, "remote_ip_prefix": "::/0"}, + #{"direction": egress, "ethertype": IPv6, "port_range_min": 1, "port_range_max": 65535, "protocol": udp, "remote_ip_prefix": "::/0"}, + #{"direction": egress, "ethertype": IPv6, "protocol": icmp, "remote_ip_prefix": "::/0"}, + #{"direction": ingress, "ethertype": IPv6, "port_range_min": 1, "port_range_max": 65535, "protocol": tcp, "remote_ip_prefix": "::/0"}, + #{"direction": ingress, "ethertype": IPv6, "port_range_min": 1, "port_range_max": 65535, "protocol": udp, "remote_ip_prefix": "::/0"}, + #{"direction": ingress, "ethertype": IPv6, "protocol": icmp, "remote_ip_prefix": "::/0"} + ] + +outputs: + ocgapp_shared_sec_grp_id: + description: UUID of OCG APP Resource SecurityGroup + value: { get_resource: OCGAPP_SECURITY_GROUP } + + ocgmgr_shared_sec_grp_id: + description: UUID of OCG MGR Resource SecutiryGroup + value: {get_resource: OCGMGR_SECURITY_GROUP} \ No newline at end of file diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-core/src/test/resources/heatTreeArtifactsValidationOutput/ocgapp.env b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-core/src/test/resources/heatTreeArtifactsValidationOutput/ocgapp.env new file mode 100644 index 0000000000..4a1c26c465 --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-core/src/test/resources/heatTreeArtifactsValidationOutput/ocgapp.env @@ -0,0 +1,28 @@ +#file version 1.0 +parameters: + ocgapp_image_name: 'NIMBUS_OCG-APPLICATION_170921.qcow2' + ocgapp_flavor_name: nv.c8r32d320 +# ocgapp_public_key: 'ssh-rsa AAAAB3NzaC1yc2EAAAABJQAAAQEAh5B/f9JmJL5HcIJT+XeGnE9Jlv22NYGweMx+M2eX53X0sxdB8onhqDiLFODgDgXUuQk11NM2tQeA+xH+nlZxdETK+5uKb2SLwsPjZnxHQPrGQP1KKAZi9aKoZFjYmWrYuqzQFT9QRz3gehG+pX82mzMkkE/Da2/XJ62zu8PKfapn63MhhmxG5w5onuN2XsM2zfI6GILFM56ppLtMCkgvzXVcWOpr7pD4kpnC9WavxwAkmQPrWIbTi0MKIEeuON0B+KRgC3b8GnCpuE2GFTffAm1MBgi0Urs8e3XGHsilVMqYdaCPZwq5ZKlzivX5wZQH9yT9m9Db6XLL66ZIaBHt2w== rsa-key-20170906' +# oam_protected_net_name: MNS-25180-T-RDM6B_oam_protected_net_1 +# oam_direct_net_name: MNS-25180-T-RDM6B_oam_direct_net_1 +# cor_direct_net_name: MNS-25180-T-RDM6B_cor_direct_net_1 +# ocgapp_oam_protected_ips: 107.112.163.80,107.112.163.81,107.112.163.82,107.112.163.83 +# ocgapp_oam_direct_ips: 107.112.168.134,107.112.168.135,107.112.168.136,107.112.168.137 +# ocgapp_cor_direct_ips: 107.242.64.54,107.242.64.55,107.242.64.56,107.242.64.57 +# ocgapp_cor_direct_v6_ips: 2606:ae00:2e20:1404::6,2606:ae00:2e20:1404::7,2606:ae00:2e20:1404::8,2606:ae00:2e20:1404::9 +# ocgapp_names: zrdm6bvocg01app001,zrdm6bvocg01app002,zrdm6bvocg01app003,zrdm6bvocg01app004 +# availability_zone_0: rdm6b-kvm-az01 +# availability_zone_1: rdm6b-kvm-az02 +# ocgapp_shared_sec_grp_id: f289cfb2-92c8-4165-9588-37c4a32feccc +# ocgapp_volume_ids: [ +# "4ba31434-e199-4eeb-a342-18baa238e757", +# "8030b870-6079-4afb-82f6-6cfbe47209f2", +# "2980fef4-316f-4711-8243-4a8a518e8933", +# "c98a0439-4d56-46d0-b0ca-f800c2ac1dfc" +#] +# vnf_name: zrdm6bvocg01 + ocgapp_route_eth1: | + 130.4.134.0/24 via 107.103.65.161 dev eth1 + 130.4.134.0/24 via 107.103.65.169 dev eth1 +# vnf_id: 'dummy' +# vf_module_id: 'dummy' diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-core/src/test/resources/heatTreeArtifactsValidationOutput/ocgapp.yaml b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-core/src/test/resources/heatTreeArtifactsValidationOutput/ocgapp.yaml new file mode 100644 index 0000000000..bb074d5b0c --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-core/src/test/resources/heatTreeArtifactsValidationOutput/ocgapp.yaml @@ -0,0 +1,333 @@ +heat_template_version: 2015-04-30 +#file version 1.0 +description: OCG Apps template + +parameters: + ocgapp_image_name: + type: string + description: operative system image + ocgapp_flavor_name: + type: string + description: resources to be applied on instances + ocgapp_public_key: + type: string + description: creator's ssh public key + oam_protected_net_name: + type: string + description: OAM network where instances will connect + oam_direct_net_name: + type: string + description: OAM network where instances will connect + cor_direct_net_name: + type: string + description: COR_DIRECT network where instances will connect + ocgapp_oam_protected_ips: + type: comma_delimited_list + description: OCG OAM IP list + ocgapp_oam_direct_ips: + type: comma_delimited_list + description: OCG OAM IP list + ocgapp_cor_direct_ips: + type: comma_delimited_list + description: OCG COR_DIRECT IP list + ocgapp_cor_direct_v6_ips: + type: comma_delimited_list + description: fixed IP assignment for VM's on the COR_DIRECT network + ocgapp_names: + type: comma_delimited_list + description: OCG VM server name list (there should be 2, since we have 2 app vms) + availability_zone_0: + type: string + description: availability zone 1 ID or name + availability_zone_1: + type: string + description: availability zone 2 ID or name + ocgapp_shared_sec_grp_id: + type: string + description: security group + ocgapp_volume_ids: + type: json + description: Unique IDs for volumes + vnf_name: + type: string + description: Unique name for this VF instance + vnf_id: + type: string + description: Unique ID for this VF instance + vf_module_id: + type: string + description: Unique ID for this VF module instance + ocgapp_route_eth1: + type: string + description: OAM network routes + +resources: + + ocgapp_admin_key: + type: OS::Nova::KeyPair + properties: + name: + str_replace: + template: VNF_NAME_STACK_NAME_key_pair + params: + VNF_NAME: {get_param: vnf_name} + STACK_NAME: {get_param: 'OS::stack_name'} + public_key: {get_param: ocgapp_public_key} + save_private_key: false + + # APP_SERVER_0 + ocgapp_oam_protected_0_port: + type: OS::Neutron::Port + properties: + name: + str_replace: + template: VNF_NAME_ocgapp_oam_protected_port_0 + params: + VNF_NAME: {get_param: vnf_name} + network: {get_param: oam_protected_net_name} + fixed_ips: [{"ip_address": {get_param: [ocgapp_oam_protected_ips, 0]}}] + security_groups: [{get_param: ocgapp_shared_sec_grp_id}] + + ocgapp_oam_direct_0_port: + type: OS::Neutron::Port + properties: + name: + str_replace: + template: VNF_NAME_ocgapp_oam_direct_port_0 + params: + VNF_NAME: {get_param: vnf_name} + network: {get_param: oam_direct_net_name} + fixed_ips: [{"ip_address": {get_param: [ocgapp_oam_direct_ips, 0]}}] + security_groups: [{get_param: ocgapp_shared_sec_grp_id}] + + ocgapp_cor_direct_0_port: + type: OS::Neutron::Port + properties: + name: + str_replace: + template: VNF_NAME_ocgapp_cor_port_0 + params: + VNF_NAME: {get_param: vnf_name} + network: {get_param: cor_direct_net_name} + fixed_ips: [{"ip_address": {get_param: [ocgapp_cor_direct_ips, 0]}}, {"ip_address": {get_param: [ocgapp_cor_direct_v6_ips, 0]}}] + security_groups: [{get_param: ocgapp_shared_sec_grp_id}] + + ocgapp_server_0: + type: OS::Nova::Server + properties: + key_name: {get_resource: ocgapp_admin_key} + name: {get_param: [ocgapp_names, 0]} + image: {get_param: ocgapp_image_name} + flavor: {get_param: ocgapp_flavor_name} + availability_zone: {get_param: availability_zone_0} + networks: + - port: {get_resource: ocgapp_oam_protected_0_port} + - port: {get_resource: ocgapp_oam_direct_0_port} + - port: {get_resource: ocgapp_cor_direct_0_port} + metadata: + vnf_id: {get_param: vnf_id} + vf_module_id: {get_param: vf_module_id} + vnf_name: {get_param: vnf_name} + user_data_format: RAW + user_data: {get_resource: server_interface_config} + +# APP_SERVER_1 + ocgapp_oam_protected_1_port: + type: OS::Neutron::Port + properties: + name: + str_replace: + template: VNF_NAME_ocgapp_oam_protected_port_1 + params: + VNF_NAME: {get_param: vnf_name} + network: {get_param: oam_protected_net_name} + fixed_ips: [{"ip_address": {get_param: [ocgapp_oam_protected_ips, 1]}}] + security_groups: [{get_param: ocgapp_shared_sec_grp_id}] + + ocgapp_oam_direct_1_port: + type: OS::Neutron::Port + properties: + name: + str_replace: + template: VNF_NAME_ocgapp_oam_direct_port_1 + params: + VNF_NAME: {get_param: vnf_name} + network: {get_param: oam_direct_net_name} + fixed_ips: [{"ip_address": {get_param: [ocgapp_oam_direct_ips, 1]}}] + security_groups: [{get_param: ocgapp_shared_sec_grp_id}] + + ocgapp_cor_direct_1_port: + type: OS::Neutron::Port + properties: + name: + str_replace: + template: VNF_NAME_ocgapp_cor_port_1 + params: + VNF_NAME: {get_param: vnf_name} + network: {get_param: cor_direct_net_name} + fixed_ips: [{"ip_address": {get_param: [ocgapp_cor_direct_ips, 1]}}, {"ip_address": {get_param: [ocgapp_cor_direct_v6_ips, 1]}}] + security_groups: [{get_param: ocgapp_shared_sec_grp_id}] + + ocgapp_server_1: + type: OS::Nova::Server + properties: + key_name: {get_resource: ocgapp_admin_key} + name: {get_param: [ocgapp_names, 1]} + image: {get_param: ocgapp_image_name} + flavor: {get_param: ocgapp_flavor_name} + availability_zone: {get_param: availability_zone_0} + networks: + - port: {get_resource: ocgapp_oam_protected_1_port} + - port: {get_resource: ocgapp_oam_direct_1_port} + - port: {get_resource: ocgapp_cor_direct_1_port} + metadata: + vnf_id: {get_param: vnf_id} + vf_module_id: {get_param: vf_module_id} + vnf_name: {get_param: vnf_name} + user_data_format: RAW + user_data: {get_resource: server_interface_config} + +# APP_SERVER_2 + ocgapp_oam_protected_2_port: + type: OS::Neutron::Port + properties: + name: + str_replace: + template: VNF_NAME_ocgapp_oam_protected_port_2 + params: + VNF_NAME: {get_param: vnf_name} + network: {get_param: oam_protected_net_name} + fixed_ips: [{"ip_address": {get_param: [ocgapp_oam_protected_ips, 2]}}] + security_groups: [{get_param: ocgapp_shared_sec_grp_id}] + + ocgapp_oam_direct_2_port: + type: OS::Neutron::Port + properties: + name: + str_replace: + template: VNF_NAME_ocgapp_oam_direct_port_2 + params: + VNF_NAME: {get_param: vnf_name} + network: {get_param: oam_direct_net_name} + fixed_ips: [{"ip_address": {get_param: [ocgapp_oam_direct_ips, 2]}}] + security_groups: [{get_param: ocgapp_shared_sec_grp_id}] + + ocgapp_cor_direct_2_port: + type: OS::Neutron::Port + properties: + name: + str_replace: + template: VNF_NAME_ocgapp_cor_port_2 + params: + VNF_NAME: {get_param: vnf_name} + network: {get_param: cor_direct_net_name} + fixed_ips: [{"ip_address": {get_param: [ocgapp_cor_direct_ips, 2]}}, {"ip_address": {get_param: [ocgapp_cor_direct_v6_ips, 2]}}] + security_groups: [{get_param: ocgapp_shared_sec_grp_id}] + + ocgapp_server_2: + type: OS::Nova::Server + properties: + key_name: {get_resource: ocgapp_admin_key} + name: {get_param: [ocgapp_names, 2]} + image: {get_param: ocgapp_image_name} + flavor: {get_param: ocgapp_flavor_name} + availability_zone: {get_param: availability_zone_1} + networks: + - port: {get_resource: ocgapp_oam_protected_2_port} + - port: {get_resource: ocgapp_oam_direct_2_port} + - port: {get_resource: ocgapp_cor_direct_2_port} + metadata: + vnf_id: {get_param: vnf_id} + vf_module_id: {get_param: vf_module_id} + vnf_name: {get_param: vnf_name} + user_data_format: RAW + user_data: {get_resource: server_interface_config} + +# APP_SERVER_3 + ocgapp_oam_protected_3_port: + type: OS::Neutron::Port + properties: + name: + str_replace: + template: VNF_NAME_ocgapp_oam_protected_port_3 + params: + VNF_NAME: {get_param: vnf_name} + network: {get_param: oam_protected_net_name} + fixed_ips: [{"ip_address": {get_param: [ocgapp_oam_protected_ips, 3]}}] + security_groups: [{get_param: ocgapp_shared_sec_grp_id}] + + ocgapp_oam_direct_3_port: + type: OS::Neutron::Port + properties: + name: + str_replace: + template: VNF_NAME_ocgapp_oam_direct_port_3 + params: + VNF_NAME: {get_param: vnf_name} + network: {get_param: oam_direct_net_name} + fixed_ips: [{"ip_address": {get_param: [ocgapp_oam_direct_ips, 3]}}] + security_groups: [{get_param: ocgapp_shared_sec_grp_id}] + + ocgapp_cor_direct_3_port: + type: OS::Neutron::Port + properties: + name: + str_replace: + template: VNF_NAME_ocgapp_cor_port_3 + params: + VNF_NAME: {get_param: vnf_name} + network: {get_param: cor_direct_net_name} + fixed_ips: [{"ip_address": {get_param: [ocgapp_cor_direct_ips, 3]}}, {"ip_address": {get_param: [ocgapp_cor_direct_v6_ips, 3]}}] + security_groups: [{get_param: ocgapp_shared_sec_grp_id}] + + ocgapp_server_3: + type: OS::Nova::Server + properties: + key_name: {get_resource: ocgapp_admin_key} + name: {get_param: [ocgapp_names, 3]} + image: {get_param: ocgapp_image_name} + flavor: {get_param: ocgapp_flavor_name} + availability_zone: {get_param: availability_zone_1} + networks: + - port: {get_resource: ocgapp_oam_protected_3_port} + - port: {get_resource: ocgapp_oam_direct_3_port} + - port: {get_resource: ocgapp_cor_direct_3_port} + metadata: + vnf_id: {get_param: vnf_id} + vf_module_id: {get_param: vf_module_id} + vnf_name: {get_param: vnf_name} + user_data_format: RAW + user_data: {get_resource: server_interface_config} + + ocgapp_volume_attachment_0: + type: OS::Cinder::VolumeAttachment + properties: + volume_id: {get_param: [ocgapp_volume_ids, 0]} + instance_uuid: {get_resource: ocgapp_server_0} + + ocgapp_volume_attachment_1: + type: OS::Cinder::VolumeAttachment + properties: + volume_id: {get_param: [ocgapp_volume_ids, 1]} + instance_uuid: {get_resource: ocgapp_server_1} + + ocgapp_volume_attachment_2: + type: OS::Cinder::VolumeAttachment + properties: + volume_id: {get_param: [ocgapp_volume_ids, 2]} + instance_uuid: {get_resource: ocgapp_server_2} + + ocgapp_volume_attachment_3: + type: OS::Cinder::VolumeAttachment + properties: + volume_id: {get_param: [ocgapp_volume_ids, 3]} + instance_uuid: {get_resource: ocgapp_server_3} + + server_interface_config: + type: OS::Heat::CloudConfig + properties: + cloud_config: + write_files: + - path: /etc/sysconfig/network-scripts/route-eth1 + permissions: "0644" + content: {get_param: ocgapp_route_eth1} diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-core/src/test/resources/heatTreeArtifactsValidationOutput/ocgapp_nested_volume.yaml b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-core/src/test/resources/heatTreeArtifactsValidationOutput/ocgapp_nested_volume.yaml new file mode 100644 index 0000000000..11e57ce675 --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-core/src/test/resources/heatTreeArtifactsValidationOutput/ocgapp_nested_volume.yaml @@ -0,0 +1,45 @@ +heat_template_version: 2015-04-30 +description: Nested file for ocg apps +parameters: + + index: + type: number + label: Volume Index + description: number of volumes to spin up +# constraints: +# - allowed_values: [0,1,2,4] + size: + type: number + label: Volume Size + description: size of the cinder volumes + constraints: + - range: { min: 50, max: 400 } + volume_type: + type: string + label: Volume Type + description: type of cinder volumes + vnf_name: + type: string + label: VNF Name + description: vnf name + + +resources: + ocgapp_volume_0: + type: OS::Cinder::Volume + properties: + size: {get_param: size} + volume_type: {get_param: volume_type} + name: + str_replace: + template: VF_NAME_STACK_NAME_INDEX + params: + VF_NAME: { get_param: vnf_name } + STACK_NAME: { get_param: 'OS::stack_name' } + INDEX: {get_param: index} + + +outputs: + ocgapp_volume_id_0: + description: the ocgapp volume uuid + value: {get_resource: ocgapp_volume_0} diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-core/src/test/resources/heatTreeArtifactsValidationOutput/ocgapp_volume.env b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-core/src/test/resources/heatTreeArtifactsValidationOutput/ocgapp_volume.env new file mode 100644 index 0000000000..518f2fb7ac --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-core/src/test/resources/heatTreeArtifactsValidationOutput/ocgapp_volume.env @@ -0,0 +1,7 @@ +#file version 1.0 +parameters: + vnf_name: 'zrdm6bvocg01' + ocgapp_volume_size_0: 400 + #ocgapp_volume_size_1: 100 + ocgapp_volume_type_0: SF-Default-SSD + volume_count: 4 diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-core/src/test/resources/heatTreeArtifactsValidationOutput/ocgapp_volume.yaml b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-core/src/test/resources/heatTreeArtifactsValidationOutput/ocgapp_volume.yaml new file mode 100644 index 0000000000..dcb5a337ec --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-core/src/test/resources/heatTreeArtifactsValidationOutput/ocgapp_volume.yaml @@ -0,0 +1,45 @@ +heat_template_version: 2015-04-30 + +description: OCG template for the APP volumes +#file version 1.0 +parameters: + vnf_name: + type: string + label: OCG VNF Name + description: OCG VNF Name + ocgapp_volume_size_0: + type: number + label: Cinder volume 1 size + description: the size of the Cinder volume + constraints: + - range: { min: 50, max: 400 } + ocgapp_volume_type_0: + type: string + label: app vm 1 volume type + description: the name of the target volume backend for the first OCG APP + volume_count: + type: number + label: volume count + description: num of volumes needed + constraints: + - allowed_values: [1,2,4] + +resources: + + ocgapp_volume_resource_group: + type: OS::Heat::ResourceGroup + properties: + count: {get_param: volume_count} + index_var: index + resource_def: + type: ocgapp_nested_volume.yaml + properties: + index: index + size: {get_param: ocgapp_volume_size_0} + volume_type: {get_param: ocgapp_volume_type_0} + vnf_name: {get_param: vnf_name} + +outputs: + ocgapp_volume_ids: + description: ocgapp volume ids + value: {get_attr: [ocgapp_volume_resource_group, ocgapp_volume_id_0]} diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-core/src/test/resources/heatTreeArtifactsValidationOutput/ocgmgr.env b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-core/src/test/resources/heatTreeArtifactsValidationOutput/ocgmgr.env new file mode 100644 index 0000000000..18f39baad2 --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-core/src/test/resources/heatTreeArtifactsValidationOutput/ocgmgr.env @@ -0,0 +1,26 @@ +#file version 1.0 +parameters: + ocgmgr_image_name: 'NIMBUS-FN_VOCG-01MGR-001-AP-SNAPSHOT_180116' + ocgmgr_flavor_name: nv.c8r32d320 + java_home: /home/fworks/java/jdk1.8.0_112 + ocg_user: fworks + ovlm_install_dir: /home/fworks/Installer/weaver + ocg_install_jar: /home/fworks/Installer/ocg10/installer.jar + ocg_install_properties: /tmp/ocg.install.properties + wim_install_file: /home/fworks/Installer/wim/ovlm-integration-module.sh + keycloak_rpm_name: keycloak-pkg-x86_64.rpm + ovlm_install_properties: /tmp/ovlm.install.properties +# ocgmgr_public_key: 'ssh-rsa AAAAB3NzaC1yc2EAAAABJQAAAQEAh5B/f9JmJL5HcIJT+XeGnE9Jlv22NYGweMx+M2eX53X0sxdB8onhqDiLFODgDgXUuQk11NM2tQeA+xH+nlZxdETK+5uKb2SLwsPjZnxHQPrGQP1KKAZi9aKoZFjYmWrYuqzQFT9QRz3gehG+pX82mzMkkE/Da2/XJ62zu8PKfapn63MhhmxG5w5onuN2XsM2zfI6GILFM56ppLtMCkgvzXVcWOpr7pD4kpnC9WavxwAkmQPrWIbTi0MKIEeuON0B+KRgC3b8GnCpuE2GFTffAm1MBgi0Urs8e3XGHsilVMqYdaCPZwq5ZKlzivX5wZQH9yT9m9Db6XLL66ZIaBHt2w== rsa-key-20170906' +# oam_protected_net_name: MNS-25180-T-RDM6B_oam_protected_net_1 +# ocgmgr_oam_protected_ips: 107.112.163.100,107.112.163.101 +# ocgmgr_names: zrdm6bvocg01mgr001-ap,zrdm6bvocg01mgr002-ap +# availability_zone_0: rdm6b-kvm-az01 +# availability_zone_1: rdm6b-kvm-az02 +# ocgmgr_shared_sec_grp_id: ca86ec60-38b7-4d72-b1f6-423a4f0c4be9 +# ocgmgr_volume_ids: [ +# "0848cea8-c9de-45e5-a047-472b778488fe", +# "c089f811-5122-4273-80c1-e6f48034b0a5" +#] +# vnf_name: zrdm6bvocg01_ap +# vnf_id: 'dummy' +# vf_module_id: 'dummy' diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-core/src/test/resources/heatTreeArtifactsValidationOutput/ocgmgr.yaml b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-core/src/test/resources/heatTreeArtifactsValidationOutput/ocgmgr.yaml new file mode 100644 index 0000000000..52f3253285 --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-core/src/test/resources/heatTreeArtifactsValidationOutput/ocgmgr.yaml @@ -0,0 +1,188 @@ +heat_template_version: 2015-04-30 +#file version 1.0 +description: OCG Managers template + +parameters: + ocgmgr_image_name: + type: string + description: operative system image + ocgmgr_flavor_name: + type: string + description: resources to be applied on instances + ocgmgr_public_key: + type: string + description: creator's ssh public key + oam_protected_net_name: + type: string + description: OAM network where instances will connect + ocgmgr_oam_protected_ips: + type: comma_delimited_list + description: OCG OAM IP list + ocgmgr_names: + type: comma_delimited_list + description: OCG MGR VM names list (should be 2, since we have 2 MGR VMs) + availability_zone_0: + type: string + description: availability zone 0 ID or name + availability_zone_1: + type: string + description: availability zone 1 ID or name + ocgmgr_shared_sec_grp_id: + type: string + description: security group + ocgmgr_volume_ids: + type: json + description: Unique IDs for volumes + vnf_name: + type: string + description: Unique name for this VF instance + vnf_id: + type: string + description: Unique ID for this VF instance + vf_module_id: + type: string + description: Unique ID for this VF module instance + java_home: + type: string + description: java home + ocg_user: + type: string + description: user to install ocg + ocg_install_jar: + type: string + description: location of ocg installer + ocg_install_properties: + type: string + description: location of ocg install properties + wim_install_file: + type: string + description: WIM Install File location + ovlm_install_dir: + type: string + description: Location of the ovlm-install dir + keycloak_rpm_name: + type: string + description: keycloak rpm name + ovlm_install_properties: + type: string + description: ovlm install properties +resources: + vm_config: + type: OS::Heat::SoftwareConfig + properties: + group: ungrouped + config: + str_replace: + template: {get_file: ocgmgr_nested.txt} +# resource_def: +# type: ocgmgr_nested.yaml + params: + $java_home: { get_param: java_home } + $ocg_user: { get_param: ocg_user } + $ocg_install_jar: { get_param: ocg_install_jar } + $ocg_install_properties: { get_param: ocg_install_properties } + $ocg_hostname: { get_param: [ocgmgr_names, 0]} + $ocg_hostip: { get_param: [ocgmgr_oam_protected_ips, 0]} + $wim_install_file: { get_param: wim_install_file } + $ovlm_install_properties: { get_param: ovlm_install_properties } + $ovlm_hostname: {get_param: [ocgmgr_names, 0]} + $ovlm_mgr002_hostname: {get_param: [ocgmgr_names, 1]} + $ovlm_install_dir: {get_param: ovlm_install_dir} + $keycloak_rpm_name: {get_param: keycloak_rpm_name} + ocgmgr_admin_key: + type: OS::Nova::KeyPair + properties: + name: + str_replace: + template: VNF_NAME_STACK_NAME_key_pair + params: + VNF_NAME: {get_param: vnf_name} + STACK_NAME: {get_param: 'OS::stack_name'} + public_key: {get_param: ocgmgr_public_key} + save_private_key: false + + ocgmgr_oam_protected_0_port: + type: OS::Neutron::Port + properties: + name: + str_replace: + template: VNF_NAME_ocgmgr_oam_port_0 + params: + VNF_NAME: {get_param: vnf_name} + network: {get_param: oam_protected_net_name} + fixed_ips: [{"ip_address": {get_param: [ocgmgr_oam_protected_ips, 0]}}] + security_groups: [{get_param: ocgmgr_shared_sec_grp_id}] + + ocgmgr_config_0: + type: OS::Heat::MultipartMime + properties: + parts: + - config: {get_resource: vm_config} + + ocgmgr_server_0: + type: OS::Nova::Server + properties: + key_name: {get_resource: ocgmgr_admin_key} + name: {get_param: [ocgmgr_names, 0]} + image: {get_param: ocgmgr_image_name} + flavor: {get_param: ocgmgr_flavor_name} + availability_zone: {get_param: availability_zone_0} + networks: + - port: {get_resource: ocgmgr_oam_protected_0_port} + metadata: + vnf_id: {get_param: vnf_id} + vf_module_id: {get_param: vf_module_id} + vnf_name: {get_param: vnf_name} + user_data_format: SOFTWARE_CONFIG + user_data: {get_resource: ocgmgr_config_0} + #user_data: {get_resource: server_interface_config} + + ocgmgr_oam_protected_1_port: + type: OS::Neutron::Port + properties: + name: + str_replace: + template: VNF_NAME_ocgmgr_oam_port_1 + params: + VNF_NAME: {get_param: vnf_name} + network: {get_param: oam_protected_net_name} + fixed_ips: [{"ip_address": {get_param: [ocgmgr_oam_protected_ips, 1]}}] + security_groups: [{get_param: ocgmgr_shared_sec_grp_id}] + + ocgmgr_server_1: + type: OS::Nova::Server + properties: + key_name: {get_resource: ocgmgr_admin_key} + name: {get_param: [ocgmgr_names, 1]} + image: {get_param: ocgmgr_image_name} + flavor: {get_param: ocgmgr_flavor_name} + availability_zone: {get_param: availability_zone_1} + networks: + - port: {get_resource: ocgmgr_oam_protected_1_port} + metadata: + vnf_id: {get_param: vnf_id} + vf_module_id: {get_param: vf_module_id} + vnf_name: {get_param: vnf_name} + user_data_format: RAW + #user_data: {get_resource: server_interface_config} + + ocgmgr_volume_attachment_0: + type: OS::Cinder::VolumeAttachment + properties: + volume_id: {get_param: [ocgmgr_volume_ids, 0]} + instance_uuid: {get_resource: ocgmgr_server_0} + + ocgmgr_volume_attachment_1: + type: OS::Cinder::VolumeAttachment + properties: + volume_id: {get_param: [ocgmgr_volume_ids, 1]} + instance_uuid: {get_resource: ocgmgr_server_1} + + #server_interface_config: + # type: OS::Heat::CloudConfig + # properties: + # cloud_config: + # write_files: + # - path: /etc/sysconfig/network-scripts/route-eth0 + # permissions: "0644" + # content: { get_param: dns_route_eth0 } diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-core/src/test/resources/heatTreeArtifactsValidationOutput/ocgmgr_nested.txt b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-core/src/test/resources/heatTreeArtifactsValidationOutput/ocgmgr_nested.txt new file mode 100644 index 0000000000..05b8c86eb5 --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-core/src/test/resources/heatTreeArtifactsValidationOutput/ocgmgr_nested.txt @@ -0,0 +1,389 @@ +#cloud-config + +write_files: + - path: /tmp/ocg-bashrc + content: | + export JAVA_HOME=$java_home + export FUSIONWORKS_HOME=/home/$ocg_user/ocg10/fwhome + export FUSIONWORKS_PROD=/home/$ocg_user/ocg10/fwprod + export PATH=$PATH:$JAVA_HOME/bin:$FUSIONWORKS_PROD/bin:$FUSIONWORKS_HOME:$FUSIONWORKS_PROD:$HOME:. + export OVLMCM_BASEURL=https://$ovlm_hostname:28010 + export OVLMFE_BASEURL=https://$ovlm_hostname:28050 + export OVLMDM_BASEURL=https://$ovlm_hostname:28130 + export OVLMFA_BASEURL=https://$ovlm_hostname:28800 + export baseurl=https://localhost:28050 + export OVLM_INTEGRATION_HOME=/home/$ocg_user/ovlm-integration-module + export OVLMFE_VERIFY_SERVER_CERTIFICATE=yes + export OVLMFE_CA_BUNDLE_PATH=~/weaver_install/ovlm-install/certs/ca_bundle + export OVLMCM_VERIFY_SERVER_CERTIFICATE=yes + export OVLMCM_CA_BUNDLE_PATH=~/weaver_install/ovlm-install/certs/ca_bundle + export OVLMDM_VERIFY_SERVER_CERTIFICATE=yes + export OVLMDM_CA_BUNDLE_PATH=~/weaver_install/ovlm-install/certs/ca_bundle + export OVLMFA_VERIFY_SERVER_CERTIFICATE=yes + export OVLMFA_CA_BUNDLE_PATH=~/weaver_install/ovlm-install/certs/ca_bundle + + - path: /tmp/keycloak-bashrc + content: | + export JBOSS_HOME=/home/$ocg_user/keycloak + export JAVA_HOME=$java_home + export PATH=$PATH:$JAVA_HOME/bin + + - path: /tmp/keycloak-setup.sh + permissions: '0755' + content: | + cp -f /tmp/keycloak.conf /home/$ocg_user/keycloak/etc/keycloak.conf + cp -f /tmp/keycloak.properties /home/$ocg_user/keycloak/etc/keycloak.properties + sed -i -e 's//& /' /home/$ocg_user/keycloak/etc/standalone/standalone.xml + sed -i -e 's/127.0.0.1/$ovlm_hostname/' /home/$ocg_user/keycloak/etc/standalone/standalone.xml + sed -i -e 's/8080/8090/' /home/$ocg_user/keycloak/etc/standalone/standalone.xml + sed -i -e 's/8443/9443/' /home/$ocg_user/keycloak/etc/standalone/standalone.xml + sed -i -e "s//&\ + \ + \ + \ + \ + <\/ssl>\ + <\/server-identities>\ + <\/security-realm>/" /home/$ocg_user/keycloak/etc/standalone/standalone.xml + + - path: /tmp/keycloak.conf + content: | + KEYCLOAK_MODE=standalone + KEYCLOAK_BIND=0.0.0.0 + JAVA_HOME=$java_home + KEYCLOAK_JAVA_OPTS="\ + -Djava.net.preferIPv4Stack=true \ + -Djava.awt.headless=true \ + -Xms64m -Xmx512m -XX:MetaspaceSize=96M -XX:MaxMetaspaceSize=256m" + KEYCLOAK_SERVER_OPTS="--properties=/home/$ocg_user/keycloak/etc/keycloak.properties" + JBOSS_LOG_DIR=/home/$ocg_user/keycloak/log/standalone + JBOSS_CONFIG_DIR=/home/$ocg_user/keycloak/etc/standalone + JBOSS_HOME=/home/$ocg_user/keycloak + + - path: /tmp/keycloak.properties + content: | + jboss.http.port=8090 + jboss.https.port=9443 + jboss.management.http.port=9990 + jboss.management.https.port=9993 + jboss.server.data.dir=/home/$ocg_user/keycloak/var/standalone + + - path: $ocg_install_properties + content: | + InstallationId=ocg-master + TimeZone=America/New_York + + # Directories where the binaries and configuration will be stored + # If the specified directories exist then their content will be deleted. + FusionWorksHomeDirectory=/home/$ocg_user/ocg10/fwhome + FusionWorksProductDirectory=/home/$ocg_user/ocg10/fwprod + ConfigPort=25000 + ConfigHost=$ocg_hostname + EventPort=25010 + EventHost=$ocg_hostname + SNMPAgentPort=25020 + MediationServerDatabasePort=25030 + + JBOSSHost=$ocg_hostname + JBOSSHttpPort=25041 + JBOSSHttpsPort=25042 + JBOSSRemotePort=25043 + JBOSSPortBase=25050 + JAVA_HOME=$java_home + + # addons FW install.properties.template install.properties.template.1 install.properties.template.2 install.properties.template.dup.props install.properties.template.sorted install.properties.template.sorted.uniq java share xml + # Do not change these values + DatabaseUserName=OCG + DatabasePassword=OCG + + # Enable SSL (https) access to the OAM and Policy Manager web applications. + # Choices are: OFF, ON + EnableWebSsl= + # Security option choices are: ON, OFF + SecurityOption= + + - path: $ovlm_install_properties + content: | + protocol: https + https_configuration: + server: + keystore_path: key_store.jks + keystore_password: password + key_password: password + client: + verify_server_certificate: true + truststore_path: trust_store.jks + service_owner: + user: ovlm + user_group: ovlm + ssh_user: ovlmrsync + log_rotation: + interval: monthly + max_file_size: 5000000 + installer: + ssh_bin: /usr/bin/ssh + rsync_bin: /usr/bin/rsync + ssh_options: '' + installation_directories: + path_bin: /opt/weaver_home/bin/ + path_cfg: /opt/weaver_home/etc/ + path_run: /opt/weaver_home/run/ + snmp: + manager: $ovlm_hostname + community: public + deployment_manager: + hosts: + - $ovlm_hostname + properties: + server: + port: 28130 + spring: + datasource: + username: dm + password: dm + logging: + file: /opt/weaver_home/ovlm-dm.log + workflow_engine: + hosts: + - $ovlm_hostname + properties: + server: + port: 8099 + logging: + path: /opt/weaver_home/WF/ + vnfm_gui: + hosts: + - $ovlm_hostname + properties: + server: + port: 28200 + logging: + file: /opt/weaver_home/ovlm-vnfm.log + frontend: + hosts: + - $ovlm_hostname + properties: + server: + port: 28050 + logging: + file: /opt/weaver_home/ovlm-fe.log + configuration_manager: + hosts: + - $ovlm_hostname + properties: + server: + port: 28010 + rsync_port: 28000 + repository-root: /opt/weaver_home/repository-root + logging: + file: /opt/weaver_home/ovlm-cm.log + resource_manager: + hosts: + - $ovlm_hostname + properties: + server: + port: 28020 + logging: + file: /opt/weaver_home/ovlm-rm.log + resource_agent: + properties: + server: + port: 28030 + sudo_privileges_required: true + sudo_privileges: + - /bin/postgresql-setup + - /bin/rpm + - /usr/bin/yum + - /bin/bash + - /bin/sudo * + - /usr/bin/sudo * + - /usr/bin/systemctl status * + - /usr/bin/systemctl start * + - /usr/bin/systemctl stop * + - /usr/bin/systemctl restart * + - /usr/bin/systemctl is-active * + - /usr/bin/systemctl daemon-reload + - /sbin/useradd + - /sbin/userdel + - /sbin/usermod + - /bin/mkdir + - /bin/rm + - /bin/rsync + - /usr/bin/rsync + - /bin/chown + - /bin/chmod + resource_agent: + metadata: + stage: + timeout: 100 + parameters: + rsync: + timeout: 100 + bin: rsync + repository-root: /opt/weaver_home/repository-root + logging: + path: /opt/weaver_home/RA/ + instance_inventory_manager: + hosts: + - $ovlm_hostname + properties: + server: + port: 28120 + logging: + file: /opt/weaver_home/ovlm-iim.log + auth_server: + hosts: + - $ovlm_hostname + admin: + username: admin + password: Openet01 + url: https://$ovlm_hostname:9443/auth + properties: + server: + port: 9443 + failover_agent: + hosts: + - $ovlm_hostname + properties: + server: + port: 28800 + mode: + init_mode: active + remote_host: $ovlm_mgr002_hostname + remote_port: 28800 + post_failover: + rsync: + interval: 360 + bin: /usr/bin/rsync + timeout: 100 + location_list: + - destination: /tmp/ovlm_dm_failover_dbsync/ + source: /tmp/ovlm_dm_failover_dbsync/ + pre: /opt/weaver_home/bin/dm/failover/backup_dm_db.sh + complete: /opt/weaver_home/bin/dm/failover/restore_dm_db.sh + - destination: /opt/weaver_home/bin/dm/repository-root/ + source: /opt/weaver_home/bin/dm/repository-root/ + - destination: /opt/weaver_home/repository-root/ + source: /opt/weaver_home/repository-root/ + - destination: /opt/weaver_home/bin/iim/repository-root/ + source: /opt/weaver_home/bin/iim/repository-root/ + - destination: /opt/weaver_home/etc/fe/meta/flow_mappings.yml + source: /opt/weaver_home/etc/fe/meta/flow_mappings.yml + - destination: /tmp/ovlm_keycloak_backup.zip + source: /tmp/ovlm_keycloak_backup.zip + pre: sudo bash /home/fworks/keycloak/scripts/backup-db.sh /tmp/ovlm_keycloak_backup.zip + complete: sudo bash /home/fworks/keycloak/scripts/restore-db.sh /tmp/ovlm_keycloak_backup.zip + post: + - destination: /home/fworks/ocg10/fwhome/ + source: /home/fworks/ocg10/fwhome/ + - destination: /home/fworks/ocg10/fwprod/ + source: /home/fworks/ocg10/fwprod/ + - destination: /home/fworks/ovlm-integration-module/ + source: /home/fworks/ovlm-integration-module/ + sudo_privileges_required: true + sudo_privileges: + - /bin/bash + - /bin/sudo * + - /usr/bin/sudo * + - /usr/bin/rsync + - /usr/bin/systemctl status * + - /usr/bin/systemctl start * + - /usr/bin/systemctl stop * + - /usr/bin/systemctl restart * + - /usr/bin/systemctl is-active * + - /usr/bin/systemctl daemon-reload + logging: + file: /opt/weaver_home/ovlm-fa.log +runcmd: + - echo "alias l='ls -lrt'" >> /etc/bashrc + # Allow for host resolution - With proper DNS in place, this is not needed + - echo "$ocg_hostip $ocg_hostname" >> /etc/hosts + ############## + # OCG install + ############## + - echo "Installing ocg as user $ocg_user" + # Set up the ocg_user environment + - su -s /bin/bash -l -c 'cat /tmp/ocg-bashrc >> ~/.bashrc' $ocg_user + - su -s /bin/bash -l -c 'cat /tmp/ocg-bashrc >> ~/.profile' $ocg_user + - su -s /bin/bash -l -c 'cd && java -jar $ocg_install_jar -install $ocg_install_properties' $ocg_user + - su -s /bin/bash -l -c 'cd && StartNameServ && StartMediationServer && StartJBossAppServer' $ocg_user + ############## + # WIM install + ############## + #- echo "Installing WIM as user $ocg_user" + - su -s /bin/bash -l -c 'cd && cp $wim_install_file .' $ocg_user + - su -s /bin/bash -l -c 'cd && ./ovlm-integration-module.sh' $ocg_user + + ############## + # OVLM install + ############## + - echo "Installing ovlm as user $ocg_user" + + # Need to set up password-less ssh for ocg_user so that ovlm-deploy will succeed + - su -s /bin/bash -l -c 'ssh-keygen -f ~/.ssh/id_rsa -t rsa -N "" ' $ocg_user + - su -s /bin/bash -l -c 'cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys && chmod 600 ~/.ssh/authorized_keys' $ocg_user + # Allow sudo on non-tty login for ovlm-install user + - echo "Defaults:$ocg_user !requiretty" >> /etc/sudoers + # Create directory and Expand the install media + - su -s /bin/bash -l -c 'cd && mkdir weaver_install' $ocg_user + - su -s /bin/bash -l -c 'cd ~/weaver_install && cp $ovlm_install_dir/ovlm-core-install-enterprise.tar .' $ocg_user + - su -s /bin/bash -l -c 'cd ~/weaver_install && cp $ovlm_install_dir/ovlm-thirdparty-dependencies.tar .' $ocg_user + - su -s /bin/bash -l -c 'cd ~/weaver_install && tar xvf $ovlm_install_dir/ovlm-core-install-enterprise.tar' $ocg_user + - su -s /bin/bash -l -c 'cd ~/weaver_install && cp $ovlm_install_dir/ovlm-client.sh .' $ocg_user + - su -s /bin/bash -l -c 'cd ~/weaver_install && tar xvf $ovlm_install_dir/ovlm-thirdparty-dependencies.tar' $ocg_user + # Create certs + - su -s /bin/bash -l -c 'cd ~/weaver_install/ovlm-install && mkdir -p certs' $ocg_user + - su -s /bin/bash -l -c 'cd ~/weaver_install/ovlm-install/certs && echo "subjectAltName=DNS:$ovlm_hostname,DNS:$ovlm_mgr002_hostname" > extFile' $ocg_user + - su -s /bin/bash -l -c 'cd ~/weaver_install/ovlm-install/certs && openssl genrsa -out server.key 2048' $ocg_user + - su -s /bin/bash -l -c 'cd ~/weaver_install/ovlm-install/certs && openssl req -new -out server.csr -key server.key -subj "/C=IE/L=Dublin/O=DigiCert/CN=*.novalocal"' $ocg_user + - su -s /bin/bash -l -c 'cd ~/weaver_install/ovlm-install/certs && openssl x509 -req -days 365 -in server.csr -signkey server.key -out server.crt -extfile extFile' $ocg_user + - su -s /bin/bash -l -c 'cd ~/weaver_install/ovlm-install/certs && cp server.crt ca_bundle' $ocg_user + - su -s /bin/bash -l -c 'cd ~/weaver_install/ovlm-install/certs && openssl pkcs12 -export -name weaver -in server.crt -inkey server.key -out server.p12 -passout pass:password' $ocg_user + - su -s /bin/bash -l -c 'cd ~/weaver_install/ovlm-install/certs && $java_home/bin/keytool -importkeystore -destkeystore keycloak.jks -srckeystore server.p12 -srcstoretype pkcs12 -alias weaver -srcstorepass password -noprompt -deststorepass password -deststoretype JKS -destalias weaver' $ocg_user + # Configure and Install keycloak + #- cd ~/ovlm-install && rpm -ivh rpms/$keycloak_rpm_name + - su -s /bin/bash -l -c 'cat /tmp/keycloak-bashrc >> ~/.profile' $ocg_user + - su -s /bin/bash -l -c 'cat /tmp/keycloak-bashrc >> ~/.bashrc' $ocg_user + - export KEYCLOAK_USER=$ocg_user;export KEYCLOAK_USER_GROUP=$ocg_user; sudo -E rpm -ivh --relocate /opt/keycloak=/home/$ocg_user/keycloak --relocate /etc/keycloak=/home/$ocg_user/keycloak/etc --relocate /var/log/keycloak=/home/$ocg_user/keycloak/log --relocate /var/run/keycloak=/home/$ocg_user/keycloak/run --relocate /var/opt/keycloak=/home/$ocg_user/keycloak/var /home/$ocg_user/weaver_install/ovlm-install/rpms/keycloak-pkg-x86_64.rpm + # setup keycloak + - su -s /bin/bash -l -c '/tmp/keycloak-setup.sh' $ocg_user + # copy keystore file + - su -s /bin/bash -l -c 'cp /home/$ocg_user/weaver_install/ovlm-install/certs/keycloak.jks /home/$ocg_user/keycloak/etc/standalone/.' $ocg_user + # Config admin user + - su -s /bin/bash -l -c '/home/$ocg_user/keycloak/bin/add-user-keycloak.sh -u admin -p Openet01' $ocg_user + # Enable keycloak daemon + - systemctl enable keycloak + # Start keycloak service + - systemctl restart keycloak + # Set up the config file and do the weaver install + - su -s /bin/bash -l -c 'cd ~/weaver_install/ovlm-install && cp $ovlm_install_properties ./ovlm-install.yml' $ocg_user + - su -s /bin/bash -l -c 'cd ~/weaver_install/ovlm-install && ./utilities/cipher/encrypt_scripts/encrypt-password.sh -f ./ovlm-install.yml' $ocg_user + - su -s /bin/bash -l -c 'cd ~/weaver_install/ovlm-install && ./ovlm-deploy.sh -i ovlm-install.yml -u $ocg_user' $ocg_user + - su -s /bin/bash -l -c 'cd ~/weaver_install && sudo bash ovlm-client.sh' $ocg_user + + # Configure keycloak user for Weaver realm + - su -s /bin/bash -l -c '/home/$ocg_user/keycloak/bin/add-user-keycloak.sh -u weaver -p Openet01 -r weaver' $ocg_user + + # Restart service + - systemctl restart keycloak + + # Steps for weaver.profile + - su -s /bin/bash -l -c 'cd && cp ~/weaver_install/ovlm-install/weaver.profile .' $ocg_user + - su -s /bin/bash -l -c 'cd && source weaver.profile' $ocg_user + - su -s /bin/bash -l -c 'echo "source weaver.profile" >> ~/.profile' $ocg_user + - su -s /bin/bash -l -c 'echo "eval \$(on-auth-client -u weaver -p Openet01 --ca_bundle_path /home/fworks/weaver_install/ovlm-install/certs/ca_bundle)" >> ~/.profile' $ocg_user + + # Step to prepare the upload the files + - su -s /bin/bash -l -c 'cd && . ~/.profile && cd ~/weaver_install/ovlm-install && ./ovlm-dm-util.sh prepare upload_files' $ocg_user + + # Step to upload the resource agent related binary file into deployment manager + - su -s /bin/bash -l -c 'cd && . ~/.profile && cd ~/weaver_install/ovlm-install && ovlm-dm artifact upload -f /home/fworks/weaver_install/ovlm-install/artifact/ovlm-install.tar.gz' $ocg_user + + # Step to upload related configuration files into deployment manager + - su -s /bin/bash -l -c 'cd && . ~/.profile && cd ~/weaver_install/ovlm-install && ovlm-dm configuration create -i ovlm-install.yml -u $ocg_user -secure_stage_traffic false -s /home/fworks/weaver_install/ovlm-install/artifact/ssh-keys.tar.gz -c /home/fworks/weaver_install/ovlm-install/artifact/certs.tar.gz -k ~/.ssh/id_rsa -e /home/fworks/weaver_install/ovlm-install/artifact/.installer.png' $ocg_user + + # Step to check OCG-Mgr health status + - su -s /bin/bash -l -c 'cd && . ~/.profile && ovlm-fe health status' $ocg_user + + # Step for Replication Import + - su -s /bin/bash -l -c 'ReplicationImport -u Administrator -p Openet00 /home/fworks/Installer/OCG_BASE_CONFIG.xml' $ocg_user diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-core/src/test/resources/heatTreeArtifactsValidationOutput/ocgmgr_nested_volume.yaml b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-core/src/test/resources/heatTreeArtifactsValidationOutput/ocgmgr_nested_volume.yaml new file mode 100644 index 0000000000..cf354d97da --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-core/src/test/resources/heatTreeArtifactsValidationOutput/ocgmgr_nested_volume.yaml @@ -0,0 +1,45 @@ +heat_template_version: 2015-04-30 +description: Nested volume file for ocg mgrs +parameters: + + index: + type: number + label: Volume index + description: number of volumes to spin up + constraints: + - allowed_values: [0, 1, 2] + size: + type: number + label: Volume Size + description: size of the cinder volumes + constraints: + - range: { min: 50, max: 400 } + volume_type: + type: string + label: Volume Type + description: type of cinder volumes + vnf_name: + type: string + label: VNF Name + description: vnf name + + +resources: + ocgmgr_volume_0: + type: OS::Cinder::Volume + properties: + size: {get_param: size} + volume_type: {get_param: volume_type} + name: + str_replace: + template: VF_NAME_STACK_NAME_INDEX + params: + VF_NAME: {get_param: vnf_name} + STACK_NAME: {get_param: 'OS::stack_name'} + INDEX: {get_param: index} + + +outputs: + ocgmgr_volume_id_0: + description: the ocgmgr volume uuids + value: {get_resource: ocgmgr_volume_0} diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-core/src/test/resources/heatTreeArtifactsValidationOutput/ocgmgr_volume.env b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-core/src/test/resources/heatTreeArtifactsValidationOutput/ocgmgr_volume.env new file mode 100644 index 0000000000..dd36b3e80f --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-core/src/test/resources/heatTreeArtifactsValidationOutput/ocgmgr_volume.env @@ -0,0 +1,8 @@ +#file version 1.0 +parameters: + vnf_name: 'zrdm6bvocg01' + ocgmgr_volume_size_0: 400 + #ocgmgr_volume_size_1: 100 + ocgmgr_volume_type_0: SF-Default-SSD + #ocgmgr_volume_type_1: SF-Default-SSD + volume_count: 2 diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-core/src/test/resources/heatTreeArtifactsValidationOutput/ocgmgr_volume.yaml b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-core/src/test/resources/heatTreeArtifactsValidationOutput/ocgmgr_volume.yaml new file mode 100644 index 0000000000..6a458c8eca --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-core/src/test/resources/heatTreeArtifactsValidationOutput/ocgmgr_volume.yaml @@ -0,0 +1,44 @@ +heat_template_version: 2015-04-30 + +description: OCG template for MGR volumes +#file version 1.0 +parameters: + vnf_name: + type: string + label: OCG VNF Name + description: OCG VNF Name + ocgmgr_volume_size_0: + type: number + label: Cinder volume 1 size + description: the size of the Cinder volume + constraints: + - range: { min: 50, max: 400 } + ocgmgr_volume_type_0: + type: string + label: mgr vm 1 volume type + description: the name of the target volume backend for the first OCG MGR + volume_count: + type: number + label: volume count + description: num of volumes needed + constraints: + - allowed_values: [0, 1, 2] +resources: + + ocgmgr_volume_resource_group: + type: OS::Heat::ResourceGroup + properties: + count: {get_param: volume_count} + index_var: index + resource_def: + type: ocgmgr_nested_volume.yaml + properties: + index: index + size: {get_param: ocgmgr_volume_size_0} + volume_type: {get_param: ocgmgr_volume_type_0} + vnf_name: {get_param: vnf_name} + +outputs: + ocgmgr_volume_ids: + description: ocgmgr volume ids + value: {get_attr: [ocgmgr_volume_resource_group, ocgmgr_volume_id_0]} -- cgit 1.2.3-korg