diff options
Diffstat (limited to 'src/onaptests/templates/heat-files/ubuntu18/base_ubuntu18.yaml')
-rw-r--r-- | src/onaptests/templates/heat-files/ubuntu18/base_ubuntu18.yaml | 153 |
1 files changed, 153 insertions, 0 deletions
diff --git a/src/onaptests/templates/heat-files/ubuntu18/base_ubuntu18.yaml b/src/onaptests/templates/heat-files/ubuntu18/base_ubuntu18.yaml new file mode 100644 index 0000000..73612a0 --- /dev/null +++ b/src/onaptests/templates/heat-files/ubuntu18/base_ubuntu18.yaml @@ -0,0 +1,153 @@ +heat_template_version: 2013-05-23 + +description: Heat template to deploy ubuntu VM Closed Loop for ONAP + +parameters: + # Metadata required by ONAP + vnf_name: + type: string + label: VM name + description: The VM name + vnf_id: + type: string + label: VNF ID + description: The VNF ID is provided by ONAP + vf_module_id: + type: string + label: VF module ID + description: The VF Module ID is provided by ONAP + +# Server parameters, naming required by ONAP + ubuntu18_image_name: + type: string + label: Image name or ID + description: Image to be used for compute instance + ubuntu18_flavor_name: + type: string + label: Flavor + description: Type of instance (flavor) to be used + ubuntu18_pub_key: + type: string + label: Public key + description: Public key to be installed on the compute instance + ubuntu18_name_0: + type: string + label: VM name + description: The VM name + +# Network parameters, naming required by ONAP + admin_plane_net_name: + type: string + label: management network + description: The external management network + +# DCAE parameters + dcae_collector_ip: + type: string + label: DCAE collector IP address + description: IP address of the DCAE collector + dcae_collector_port: + type: string + label: DCAE collector port + description: Port of the DCAE collector + +resources: + random-str: + type: OS::Heat::RandomString + properties: + length: 4 + + ubuntu18_instantiated_key_name: + type: OS::Nova::KeyPair + properties: + name: + str_replace: + template: pre_base_rand + params: + pre: key_ + base: { get_param: vnf_name } + rand: { get_resource: random-str } + public_key: { get_param: ubuntu18_pub_key } + save_private_key: false + + ubuntu18_admin_security_group: + type: OS::Neutron::SecurityGroup + properties: + description: security group + name: + str_replace: + template: pre_base_rand + params: + pre: sg_ + base: { get_param: vnf_name } + rand: { get_resource: random-str } + rules: [ + {remote_ip_prefix: 0.0.0.0/0, protocol: tcp, port_range_min: 22, port_range_max: 22}, + {remote_ip_prefix: 0.0.0.0/0, protocol: icmp}] + + ubuntu18_0_admin_plane_port_0: + type: OS::Neutron::Port + properties: + name: + str_replace: + template: pre_base_rand + params: + pre: port_ + base: { get_param: vnf_name } + rand: { get_resource: random-str } + network: { get_param: admin_plane_net_name } + security_groups: [{ get_resource: ubuntu18_admin_security_group }] + + ubuntu18_VM_settings: + type: OS::Heat::SoftwareConfig + properties: + config: | + #!/bin/bash + sudo apt-get update + + ubuntu18_server_0: + type: OS::Nova::Server + properties: + image: { get_param: ubuntu18_image_name } + flavor: { get_param: ubuntu18_flavor_name } + name: { get_param: ubuntu18_name_0 } + metadata: {vnf_id: { get_param: vnf_id }, vf_module_id: { get_param: vf_module_id }, vnf_name: { get_param: vnf_name }} + key_name: { get_resource: ubuntu18_instantiated_key_name } + networks: + - port: { get_resource: ubuntu18_0_admin_plane_port_0 } + user_data_format: RAW + user_data: + str_replace: + params: + __dcae_collector_ip__: { get_param: dcae_collector_ip } + __dcae_collector_port__: { get_param: dcae_collector_port } + template: | + #!/bin/bash + + # Create configuration files + sudo mkdir /opt/config + echo __dcae_collector_ip__ > /opt/config/dcae_collector_ip.txt + echo __dcae_collector_port__ > /opt/config/dcae_collector_port.txt + cd /opt + sudo apt-get update + sudo apt-get install --allow-unauthenticated -y make gcc rpl + sudo apt-get update && sudo apt-get -y upgrade + sudo apt-get install -y libcurl4-openssl-dev + sudo git clone https://github.com/onap/vnfsdk-ves-agent.git + sudo cp -r vnfsdk-ves-agent/veslibrary/ves_clibrary/ /opt + sudo rm -rf /opt/vnfsdk-ves-agent/ + sudo chmod +x /opt/ves_clibrary/evel/evel-library/code/VESreporting_vFW/go-client.sh + cd /opt/ves_clibrary/evel/evel-library/bldjobs/ + sudo mv ../code/VESreporting_vFW ../code/VESreporting + # choose HTTPS + sudo rpl "0, /* HTTPS?" "1, /* HTTPS?" ../code/VESreporting/vpp_measurement_reporter.c + sudo make clean + sudo make all + sudo sleep 1 + cd /opt/ves_clibrary/evel/evel-library/libs/x86_64 + sudo cp libevel.so /usr/lib + sudo ldconfig + # Start VES client + cd /opt/ves_clibrary/evel/evel-library/code/VESreporting/ + ./go-client.sh &>/dev/null &disown + #get_resource: ubuntu18_VM_settings |