aboutsummaryrefslogtreecommitdiffstats
path: root/test/mocks/masspnfsim/deployment
diff options
context:
space:
mode:
authorEli Halych <illia.halych@t-mobile.pl>2020-11-24 09:59:07 +0000
committerEli Halych <illia.halych@t-mobile.pl>2020-11-24 10:14:45 +0000
commitdcccf6e2c90ef7b079ac6a4f6258b7d550fa79c5 (patch)
tree4d24f92105fb4142bda28d5637636dee41cef9b3 /test/mocks/masspnfsim/deployment
parent6b92f67b5c2e41dfe6272f401989d17c7452c089 (diff)
Change mass-pnf-sim folder name to masspnfsim
Details: - Allows for importing python files/classes/methods via normal import. - Dashes in mass-pnf-sim prevented from a normal Python import. - mass-pnf-sim path referenced in the project files changed to masspnfsim. - Possibility of using masspnfsim as a git submodule that requires noraml import. Issue-ID: INT-1789 Signed-off-by: Eli Halych <illia.halych@t-mobile.pl> Change-Id: I00cd753181c9b240b99881057cf777cf7977387a
Diffstat (limited to 'test/mocks/masspnfsim/deployment')
-rw-r--r--test/mocks/masspnfsim/deployment/heat/README.rst58
-rw-r--r--test/mocks/masspnfsim/deployment/heat/cloud-config.yaml30
-rw-r--r--test/mocks/masspnfsim/deployment/heat/heat.env10
-rw-r--r--test/mocks/masspnfsim/deployment/heat/heat.yaml103
-rw-r--r--test/mocks/masspnfsim/deployment/heat/mass-pnf-sim_run.sh11
5 files changed, 212 insertions, 0 deletions
diff --git a/test/mocks/masspnfsim/deployment/heat/README.rst b/test/mocks/masspnfsim/deployment/heat/README.rst
new file mode 100644
index 000000000..60473fa74
--- /dev/null
+++ b/test/mocks/masspnfsim/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/test/mocks/masspnfsim/deployment/heat/cloud-config.yaml b/test/mocks/masspnfsim/deployment/heat/cloud-config.yaml
new file mode 100644
index 000000000..8203a8470
--- /dev/null
+++ b/test/mocks/masspnfsim/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/test/mocks/masspnfsim/deployment/heat/heat.env b/test/mocks/masspnfsim/deployment/heat/heat.env
new file mode 100644
index 000000000..3e402fe49
--- /dev/null
+++ b/test/mocks/masspnfsim/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/test/mocks/masspnfsim/deployment/heat/heat.yaml b/test/mocks/masspnfsim/deployment/heat/heat.yaml
new file mode 100644
index 000000000..9718c5c68
--- /dev/null
+++ b/test/mocks/masspnfsim/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/test/mocks/masspnfsim/deployment/heat/mass-pnf-sim_run.sh b/test/mocks/masspnfsim/deployment/heat/mass-pnf-sim_run.sh
new file mode 100644
index 000000000..184684bbe
--- /dev/null
+++ b/test/mocks/masspnfsim/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