aboutsummaryrefslogtreecommitdiffstats
path: root/deployment/heat
diff options
context:
space:
mode:
authorBartek Grzybowski <b.grzybowski@partner.samsung.com>2020-12-15 12:33:31 +0100
committerBartek Grzybowski <b.grzybowski@partner.samsung.com>2020-12-15 13:51:28 +0100
commitb761beb3ea2bafd786473775b5ba0afcb3fa2fd3 (patch)
treef27107d9d214c85db91c0ac5d0a79a39d9644cc5 /deployment/heat
parentc63869d48d77034f9805a57ef693b44d71b9fed4 (diff)
Move Masspnf simulator code from Integration repository to it's own
Change-Id: Id48ca08ec0d042d93e204b49ae9fe1bc86efd67b Issue-ID: INT-1810 Signed-off-by: Bartek Grzybowski <b.grzybowski@partner.samsung.com>
Diffstat (limited to 'deployment/heat')
-rw-r--r--deployment/heat/README.rst58
-rw-r--r--deployment/heat/cloud-config.yaml30
-rw-r--r--deployment/heat/heat.env10
-rw-r--r--deployment/heat/heat.yaml103
-rw-r--r--deployment/heat/mass-pnf-sim_run.sh11
5 files changed, 212 insertions, 0 deletions
diff --git a/deployment/heat/README.rst b/deployment/heat/README.rst
new file mode 100644
index 0000000..60473fa
--- /dev/null
+++ b/deployment/heat/README.rst
@@ -0,0 +1,58 @@
+----------------------------------------------
+Heat template for deploying Mass PNF Simulator
+----------------------------------------------
+
+About
+=====
+
+This directory contains the setup that allows the deploy of Mass PNF Simulator to an OpenStack cloud instance. After successful VM run a predefined number of PNF instances will be spawned on it and VES event sending will be triggered.
+
+Prerequisites
+=============
+
+1) In order to instantiate the VM with the simulator a running OpenStack infrastructure is needed with HOT (Heat Orchestration Template) support and a preconfigured floating ip network for accessing the instance.
+
+2) An Ubuntu 18.04 image is required to boot the instance. It may also work on 16.04 or newer images albeit the setup was only validated on Ubuntu Bionic.
+
+3) A running instance of ONAP with VES Collector is required only if it's desired to send the PM events from simulator to a real collector instance. In other case any arbitrary mockup service e.g. *netcat* can be used to listen to the events. In either case a valid http link is required.
+
+Configuration
+=============
+
+Prior running the Heat template *heat.env* needs to be filled with appropriate parameters:
+
+**image_name: ubuntu-18.04-server-cloudimg-amd64**
+ Name of the image for the instance. See remarks above concerning validated setup.
+
+**flavor_name:**
+ Flavor name should depend on the number of simulator instances required. Tests show that a setup with 50 PNF simulator instances require approximately 16GB of RAM
+
+**key_name:**
+ Name of the existing key for passwordless login
+
+**instance_net_id:**
+ Id of the tenant network for instance
+
+**float_net_id:**
+ Id of the public network with floating IPs
+
+**simulator_instances:**
+ Requested number of PNF simulator instances to run on the VM
+
+**ves_url:**
+ A http link to the VES Collector's event listener. Can be any arbitrary mock service that will merely receive the events for debugging purposes.
+
+**ftp_user:**
+ A username for the ftp service exposed by the running setup that serves the PM files
+
+**ftp_password:**
+ A password for the ftp service
+
+Running
+=======
+
+To instantiate the Heat template run from *openstack* CLI:
+
+::
+
+ stack create -t integration/test/mocks/masspnfsim/deployment/heat/heat.yaml -e integration/test/mocks/masspnfsim/deployment/heat/heat.env
diff --git a/deployment/heat/cloud-config.yaml b/deployment/heat/cloud-config.yaml
new file mode 100644
index 0000000..8203a84
--- /dev/null
+++ b/deployment/heat/cloud-config.yaml
@@ -0,0 +1,30 @@
+#cloud-config
+package_upgrade: true
+packages:
+ - apt-transport-https
+ - ca-certificates
+ - gnupg-agent
+ - software-properties-common
+ - docker-ce
+ - docker-ce-cli
+ - containerd.io
+ - docker-compose
+ - python3-virtualenv
+ - python3-pip
+ - maven
+ - openjdk-8-jdk-headless
+# Docker's apt key needs to be injected early in the boot as 'apt' cloud-init
+# module doesn't support configuring key from file
+bootcmd:
+ - [curl, "https://download.docker.com/linux/ubuntu/gpg", -o, /run/docker.key]
+ - [apt-key, add, /run/docker.key]
+apt:
+ sources:
+ docker:
+ source: "deb [arch=amd64] https://download.docker.com/linux/ubuntu $RELEASE stable"
+runcmd:
+ - [pip3, install, tox]
+ - [mkdir, /root/.m2]
+ - [curl, "https://git.onap.org/oparent/plain/settings.xml", -o, /root/.m2/settings.xml]
+ - [update-java-alternatives, -s, java-1.8.0-openjdk-amd64]
+ - [bash, /root/mass-pnf-sim_run.sh]
diff --git a/deployment/heat/heat.env b/deployment/heat/heat.env
new file mode 100644
index 0000000..3e402fe
--- /dev/null
+++ b/deployment/heat/heat.env
@@ -0,0 +1,10 @@
+parameters:
+ image_name: ubuntu-18.04-server-cloudimg-amd64
+ flavor_name: m1.medium
+ key_name:
+ instance_net_id:
+ float_net_id:
+ simulator_instances:
+ ves_url:
+ ftp_user:
+ ftp_password:
diff --git a/deployment/heat/heat.yaml b/deployment/heat/heat.yaml
new file mode 100644
index 0000000..9718c5c
--- /dev/null
+++ b/deployment/heat/heat.yaml
@@ -0,0 +1,103 @@
+description: Heat template for deploying Mass PNF Simulator
+heat_template_version: '2017-02-24'
+parameters:
+ flavor_name:
+ description: Flavor name of the simulator instance. This should depend on the requested amount of simulator instances
+ type: string
+ image_name:
+ description: Name or id of the image (Debian family only)
+ type: string
+ key_name:
+ label: Key pair name for passwordless login to instance
+ type: string
+ float_net_id:
+ description: ID of the network with a pool of floating IPs
+ label: Floating IP network
+ type: string
+ instance_net_id:
+ type: string
+ description: Id of a private network for instance interface
+ simulator_instances:
+ type: number
+ description: Number of simulator instances to run on cloud instance
+ ves_url:
+ type: string
+ description: VES Collector url
+ ftp_user:
+ type: string
+ description: Username for the ftp server
+ ftp_password:
+ type: string
+ description: Password for the ftp server
+resources:
+ config:
+ type: OS::Heat::SoftwareConfig
+ properties:
+ config:
+ get_file: cloud-config.yaml
+ sim_script:
+ type: OS::Heat::SoftwareConfig
+ properties:
+ config:
+ str_replace:
+ template:
+ get_file: mass-pnf-sim_run.sh
+ params:
+ $SIMULATOR_INSTANCES: { get_param: simulator_instances }
+ $VES_URL: { get_param: ves_url }
+ $FILE_SERVER: { get_attr: [simulator_floating_ip, floating_ip_address] }
+ $FTP_USER: { get_param: ftp_user }
+ $FTP_PASSWORD: { get_param: ftp_password }
+ sim_script_file:
+ type: OS::Heat::CloudConfig
+ properties:
+ cloud_config:
+ write_files:
+ - path: /root/mass-pnf-sim_run.sh
+ content:
+ get_attr: [sim_script, config]
+ simulator_port:
+ type: OS::Neutron::Port
+ properties:
+ network:
+ get_param: instance_net_id
+ simulator_floating_ip:
+ type: OS::Neutron::FloatingIP
+ properties:
+ floating_network:
+ get_param: float_net_id
+ port_id:
+ get_resource: simulator_port
+ cloud_config:
+ type: OS::Heat::MultipartMime
+ properties:
+ parts:
+ - config:
+ get_resource: config
+ - config:
+ get_resource: sim_script_file
+ simulator:
+ type: OS::Nova::Server
+ properties:
+ name: mass-pnf-simulator
+ key_name:
+ get_param: key_name
+ image:
+ get_param: image_name
+ flavor:
+ get_param: flavor_name
+ networks:
+ - port:
+ get_resource: simulator_port
+ user_data_format: RAW
+ user_data:
+ get_resource: cloud_config
+outputs:
+ simulator_instance_id:
+ description: ID of the simulator instance
+ value:
+ get_resource: simulator
+ simulator_instance_fip:
+ description: Floating IP address of the simulator instance
+ value:
+ get_attr: [simulator_floating_ip, floating_ip_address]
diff --git a/deployment/heat/mass-pnf-sim_run.sh b/deployment/heat/mass-pnf-sim_run.sh
new file mode 100644
index 0000000..184684b
--- /dev/null
+++ b/deployment/heat/mass-pnf-sim_run.sh
@@ -0,0 +1,11 @@
+#!/bin/bash
+pushd /root
+git clone https://git.onap.org/integration
+pushd integration/test/mocks/masspnfsim
+./setup.sh
+source .tox/MassPnfSim-runtime/bin/activate
+./mass-pnf-sim.py build
+./mass-pnf-sim.py bootstrap --count $SIMULATOR_INSTANCES --urlves $VES_URL --ipfileserver $FILE_SERVER --typefileserver ftps --ipstart 10.11.0.16 --user $FTP_USER --password $FTP_PASSWORD
+./mass-pnf-sim.py start
+sleep 30
+./mass-pnf-sim.py trigger