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 |
---|
language | bash |
---|
firstline | 1 |
---|
title | basic_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 |
---|
language | bash |
---|
firstline | 6 |
---|
title | Policy 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/api
$ cd api/
$ mvn clean install -Pdocker
|
3- Check if the images are indeed built and then run the docker image.
Code Block |
---|
language | bash |
---|
firstline | 6 |
---|
title | Policy API Docker Image Run |
---|
|
$ docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
onap/policy-api 2.0.0-SNAPSHOT 891f162e17fc 28 hours ago 1e+03MB
onap/policy-api 2.0.0-SNAPSHOT-20190212T1205 891f162e17fc 28 hours ago 1e+03MB
onap/policy-api 2.0.0-SNAPSHOT-latest 891f162e17fc 28 hours ago 1e+03MB
onap/policy-api latest 891f162e17fc 28 hours ago 1e+03MB
# Run policy-api container
docker run -d --name policy-api -p 6969:6969 -it onap/policy-api:2.0.0-SNAPSHOT-latest
|
35- Check health status of the API service with following command:
Code Block |
---|
language | bash |
---|
title | Health Check |
---|
|
curl --user healthcheck:zb\!XztG34 -H “Accept=application/json, Content-Type=application/json” -k https://<VM_IP_ADDRESS>:6969/healthcheck
e.g,
$ curl --user healthcheck:zb\!XztG34 -H “Accept=application/json, Content-Type=application/json” -k https://10.12.6.93:6969/healthcheck
{"name":"Policy API","url":"self","healthy":true,"code":200,"message":"alive"} |
46- Check for statistics API with Sample Output
Code Block |
---|
language | bash |
---|
title | Statistics API |
---|
|
$ curl --user healthcheck:zb\!XztG34 -H “Accept=application/json, Content-Type=application/json” -k https://10.12.6.93:6969/statistics
{"code":200,"totalApiCallCount":0,"apiCallSuccessCount":0,"apiCallFailureCount":0,"totalPolicyGetCount":0,"totalPolicyPostCount":0,"totalTemplateGetCount":0,"totalTemplatePostCount":0,"policyGetSuccessCount":0,"policyGetFailureCount":0,"policyPostSuccessCount":0,"policyPostFailureCount":0,"templateGetSuccessCount":0,"templateGetFailureCount":0,"templatePostSuccessCount":0,"templatePostFailureCount":0} |
JMeter VM Setup: VM2
7- Install JMeter on VM2.
Code Block |
---|
language | bash |
---|
title | JMeter 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.
Code Block |
---|
language | bash |
---|
title | Stability Tests |
---|
|
# Go into the directory where stability tests are placed.
~/apache-jmeter-5.0/bin/jmeter.sh -n -t stability.jmx -Jretry=200 -Jduration=3600 -Jusers=1 -l stability.log
cat stability.log | grep "failed" |