Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

0- This process requires 2 VMs. Both VMs should be accessible from each other. Here we'll provide instructions for VM1 setup and then on VM2 setup.

1- Install the basic packages on VM1 and VM2.

Code Block
languagebash
firstline1
titlebasic_packages
$ sudo apt-get update
$ sudo apt-get install -y openjdk-8-jdk docker docker-compose zip unzip curl wget ssh telnet maven
# make sure docker can be launched with normal user
$ sudo groupadd docker
$ sudo gpasswd -a $USER docker
$ newgrp docker

Policy API VM Setup: VM1

2- Download and build policy API and its docker image.

Code Block
languagebash
firstline6
titlePolicy API Docker Image Build
$ cd ~/

$ git clone https://gerrit.onap.org/r/oparent
$ cd oparent/
$ cp settings.xml ~/.m2/
$ mvn clean install

$ cd ../
$ git clone https://gerrit.onap.org/r/policy/parent
$ cd parent/
$ mvn clean install


$ cd ../
$ git clone https://gerrit.onap.org/r/policy/pap
$ cd pap/
$ mvn clean install -Pdocker

3- Check if the images are indeed built and then run the docker  image.

Code Block
languagebash
firstline6
titlePolicy API Docker Image Run
$ docker ps
CONTAINER ID        IMAGE                                   COMMAND                  CREATED             STATUS              PORTS                    NAMES
bf5f76a3c8f2        onap/policy-pap:2.0.0-SNAPSHOT-latest   "bash ./policy-pap.sh"   2 minutes ago       Up 2 minutes        0.0.0.0:6969->6969/tcp   policy-api

# Run policy-pap container
docker run -d --name policy-pap -p 6969:6969 -it onap/policy-pap:2.0.0-SNAPSHOT-latest

5- Check health status of the API service with following command:

Code Block
languagebash
titleHealth Check
$ curl --user healthcheck:zb\!XztG34 -H “Accept=application/json, Content-Type=application/json” -k https://127.0.0.1:6969/healthcheck
Content-Type=application
{"name":"Policy PAP","url":"self","healthy":true,"code":200,"message":"alive"

6- Check for statistics API with Sample Output

Code Block
languagebash
titleStatistics API
$ curl --user healthcheck:zb\!XztG34 -H “Accept=application/json, Content-Type=application/json” -k https://127.0.0.1:6969/statistics
Content-Type=application
{"code":200,"totalPdpCount":0,"totalPdpGroupCount":0,"totalPolicyDeployCount":0,"policyDeploySuccessCount":0,"policyDeployFailureCount":0,"totalPolicyDownloadCount":0,"policyDownloadSuccessCount":0,"policyDownloadFailureCount":0}

JMeter VM Setup: VM2

7- Install JMeter on VM2.

Code Block
languagebash
titleJMeter Install
$ cd ~/
$ wget http://mirrors.whoishostingthis.com/apache//jmeter/binaries/apache-jmeter-5.0.zip
$ unzip apache-jmeter-5.0.zip 

8- Run JMeter Stability Tests.

      Jduration is time in seconds to run the tests.

      Jusers is the number of threads to be started.

    Results of the run are stored in stability.log file.

    To check for any failures search for any "failed"/"Failed" message.

...

languagebash
titleStability Tests

...

Introduction

The 72 hour Stability Test for PAP has the goal of introducing a steady flow of transactions initiated from a test client server running JMeter for the duration of 72 hours.

Setup details

The stability test is performed on VM's running in OpenStack cloud environment.

There are 2 seperate VM's, one for running PAP & other one for running JMeter to simulate steady flow of transactions.

All the dependencies like dmaap simulator, pdp simulator & policy/api component are installed in the VM having JMeter.

OpenStack environment details

Version: Mitaka

PAP VM details

OS:Ubuntu 16.04 LTS

CPU: 4 core

RAM: 4 GB

HardDisk: 40 GB

Docker Version: 18.09.6

Java: openjdk version "1.8.0_212"

JMeter VM details

OS: Ubuntu 16.04 LTS

CPU: 4 core

RAM: 4 GB

HardDisk: 40 GB

Docker Version: 18.09.6

Java: openjdk version "1.8.0_212"

JMeter: 5.1.1

Install JMeter in virtual machine

Update the ubuntu software installer

Code Block
apt-get update


Check & Install Java

apt-get install -y openjdk-8-jdk
  
java -version


Download & install JMeter

mkdir jMeter
 
 
cd jMeter
 
 
wget http://mirrors.whoishostingthis.com/apache//jmeter/binaries/apache-jmeter-5.0.zip
 
 
unzip apache-jmeter-5.0.zip


Run JMeter

/home/ubuntu/jMeter/apache-jmeter-5.0/bin/jmeter

The above command will load the JMeter UI. Then navigate to File → Open → Browse and select the test plan jmx file to open. The jmx file is present in the apex-pdp git repository - jmx file path

Install apex-pdp in virtual machine

We will be running apex-pdp as docker container. So we need to first install docker and then create the container hosting apex-pdp by pulling the image from ONAP repository.

Docker Installation

  1. Make the etc/hosts entries

    echo $(hostname -I | cut -d\  -f1) $(hostname) | sudo tee -a /etc/hosts


  2. Make the DNS entries

    echo "nameserver <PrimaryDNSIPIP>" >> /etc/resolvconf/resolv.conf.d/head
    echo "nameserver <SecondaryDNSIP>" >> /etc/resolvconf/resolv.conf.d/head
    resolvconf -u


  3. Update the ubuntu software installer

    apt-get update


  4. Check and Install Java

    apt-get install -y openjdk-8-jdk
    java -version

    Ensure that the Java version that is executing is OpenJDK version 8

  5. Check and install docker

    curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
    add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
    apt-get update
    apt-cache policy docker-ce
    apt-get install -y docker-ce
    systemctl status docker
    docker ps


  6. Change the permissions of the Docker socket file

    chmod 777 /var/run/docker.sock


  7. Check the status of the Docker service and ensure it is running correctly

    service docker status
    docker ps


Install apex-pdp

  1. Run the below command to create the container hosting apex-pdp by pulling the image from ONAP repository.

    docker run -d --name apex -p 12561:12561 -p 23324:23324 -it nexus3.onap.org:10001/onap/policy-apex-pdp:2.0-SNAPSHOT-latest /bin/bash -c "/opt/app/policy/apex-pdp/bin/apexEngine.sh -c /opt/app/policy/apex-pdp/examples/config/SampleDomain/RESTServerJsonEvent.json"
    docker ps

    Note: If you observe that requests from JMeter client is failing due to timeout, then modify the "RESTServerJsonEvent.json" mentioned in the above command and increase the "synchronousTimeout" property as per needed.


Install & Configure VisualVM

VisualVM needs to be installed in the virtual machine having apex-pdp. It will be used to monitor CPU, Memory, GC for apex-pdp while stability test is running.


Install visualVM

sudo apt-get install visualvm


Login to docker container (using root)

docker exec -u 0 -it apex /bin/bash


Run few commands to configure permissions

cd /usr/lib/jvm/java-8-openjdk-amd64/bin/
 
touch visualvm.policy
 
vi visualvm.policy
 
Add the following in visualvm.policy
 
 
grant codebase "file:/usr/lib/jvm/java-8-openjdk-amd64/lib/tools.jar" {
   permission java.security.AllPermission;
};
 
 
chmod 777 visualvm.policy
 
 
exit


Login to docker container (using normal user)

docker exec -it apex /bin/bash


Run following commands to start jstatd using port 1111

cd /usr/lib/jvm/java-8-openjdk-amd64/bin/
 
 
./jstatd -p 1111 -J-Djava.security.policy=visualvm.policy  &
 
 
exit


Login to VM using graphical interface in separate terminal window.

ssh -X <user>@<VM-IP-ADDRESS>


Open visualVM

visualvm &


Connect to jstatd & remote apex-pdp JVM

  1. Right click on "Remote" in the left panel of the screen and select "Add Remote Host..."
  2. Enter the IP address of apex-pdp docker container.

  3. Right click on IP address, select "Add jstatd Connection..."
  4. In "jstatd Connections" tab, enter port 1111 and click OK.
  5. Right click on IP address, select "Add JMX Connection..."
  6. Enter the apex-pdp docker container IP Address (from step 2) <IP address>:9991 ( for example - 172.18.0.7:9991) and click OK.
  7. Double click on the newly added nodes under "Remote" to start monitoring CPU, Memory & GC.


Sample Screenshot of visualVM

Image Added

Test Plan

The 72 hours stability test will run the following steps in 20 threaded loop.

  • Send Input Event - sends an input message to rest interface of apex-pdp.

  • Assert Response Code - assert the response code coming from apex-pdp.

  • Assert Response Message - assert the response message coming from apex-pdp.


The following steps can be used to configure the parameters of test plan.

  • HTTP Header Manager - used to store headers which will be used for making HTTP requests.
  • HTTP Request Defaults -  used to store HTTP request details like Server Name or IP, Port, Protocol etc.
  • User Defined Variables -  used to store following user defined parameters.

    Name

    Description

    Default Value

    Name

    Description

    Default Value

    waitWait time after each request (in milliseconds)500
    threadsNumber of threads to run test cases in parallel.20
    threadsTimeOutInMsSynchronization timer for threads running in parallel (in milliseconds).5000

             

Screenshot of apex-pdp stability test plan

Image Added