Pamela Dragosh | ba45dc6 | 2020-04-16 09:27:44 -0400 | [diff] [blame] | 1 | .. This work is licensed under a |
| 2 | .. Creative Commons Attribution 4.0 International License. |
| 3 | .. http://creativecommons.org/licenses/by/4.0 |
| 4 | |
| 5 | .. _pap-s3p-label: |
| 6 | |
| 7 | .. toctree:: |
| 8 | :maxdepth: 2 |
| 9 | |
| 10 | Policy PAP component |
| 11 | ~~~~~~~~~~~~~~~~~~~~ |
| 12 | |
| 13 | 72 Hours Stability Test of PAP |
| 14 | ++++++++++++++++++++++++++++++ |
| 15 | |
| 16 | Introduction |
| 17 | ------------ |
| 18 | |
| 19 | 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. |
| 20 | |
| 21 | Setup details |
| 22 | ------------- |
| 23 | |
| 24 | The stability test is performed on VM's running in OpenStack cloud environment. |
| 25 | |
| 26 | There are 2 seperate VM's, one for running PAP & other one for running JMeter to simulate steady flow of transactions. |
| 27 | |
| 28 | All the dependencies like mariadb, dmaap simulator, pdp simulator & policy/api component are installed in the VM having JMeter. |
| 29 | |
| 30 | For simplicity lets assume |
| 31 | |
| 32 | VM1 will be running JMeter, MariaDB, DMaaP simulator, PDP simulator & API component. |
| 33 | |
| 34 | VM2 will be running only PAP component. |
| 35 | |
| 36 | **OpenStack environment details** |
| 37 | |
| 38 | Version: Mitaka |
| 39 | |
| 40 | **PAP VM details (VM2)** |
| 41 | |
| 42 | OS:Ubuntu 16.04 LTS |
| 43 | |
| 44 | CPU: 4 core |
| 45 | |
| 46 | RAM: 4 GB |
| 47 | |
| 48 | HardDisk: 40 GB |
| 49 | |
| 50 | Docker Version: 18.09.6 |
| 51 | |
| 52 | Java: openjdk version "1.8.0_212" |
| 53 | |
| 54 | **JMeter VM details (VM1)** |
| 55 | |
| 56 | OS: Ubuntu 16.04 LTS |
| 57 | |
| 58 | CPU: 4 core |
| 59 | |
| 60 | RAM: 4 GB |
| 61 | |
| 62 | HardDisk: 40 GB |
| 63 | |
| 64 | Docker Version: 18.09.6 |
| 65 | |
| 66 | Java: openjdk version "1.8.0_212" |
| 67 | |
| 68 | JMeter: 5.1.1 |
| 69 | |
| 70 | Install Docker in VM1 & VM2 |
| 71 | --------------------------- |
| 72 | |
| 73 | Make sure to execute below commands in VM1 & VM2 both. |
| 74 | |
| 75 | Make the etc/hosts entries |
| 76 | |
| 77 | .. code-block:: bash |
| 78 | |
| 79 | $ echo $(hostname -I | cut -d\ -f1) $(hostname) | sudo tee -a /etc/hosts |
| 80 | |
| 81 | Make the DNS entries |
| 82 | |
| 83 | .. code-block:: bash |
| 84 | |
| 85 | $ echo "nameserver <PrimaryDNSIPIP>" >> /etc/resolvconf/resolv.conf.d/head |
| 86 | $ echo "nameserver <SecondaryDNSIP>" >> /etc/resolvconf/resolv.conf.d/head |
| 87 | $ resolvconf -u |
| 88 | |
| 89 | Update the ubuntu software installer |
| 90 | |
| 91 | .. code-block:: bash |
| 92 | |
| 93 | $ apt-get update |
| 94 | |
| 95 | Check and Install Java |
| 96 | |
| 97 | .. code-block:: bash |
| 98 | |
| 99 | $ apt-get install -y openjdk-8-jdk |
| 100 | $ java -version |
| 101 | |
| 102 | Ensure that the Java version that is executing is OpenJDK version 8 |
| 103 | |
| 104 | |
| 105 | Check and install docker |
| 106 | |
| 107 | .. code-block:: bash |
| 108 | |
| 109 | $ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add - |
| 110 | $ add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" |
| 111 | $ apt-get update |
| 112 | $ apt-cache policy docker-ce |
| 113 | $ apt-get install -y docker-ce |
| 114 | $ systemctl status docker |
| 115 | $ docker ps |
| 116 | |
| 117 | Change the permissions of the Docker socket file |
| 118 | |
| 119 | .. code-block:: bash |
| 120 | |
| 121 | $ chmod 777 /var/run/docker.sock |
| 122 | |
| 123 | Check the status of the Docker service and ensure it is running correctly |
| 124 | |
| 125 | .. code-block:: bash |
| 126 | |
| 127 | $ service docker status |
| 128 | $ docker ps |
| 129 | |
| 130 | Install JMeter in VM1 |
| 131 | --------------------- |
| 132 | |
| 133 | Download & install JMeter |
| 134 | |
| 135 | .. code-block:: bash |
| 136 | |
| 137 | $ mkdir jMeter |
| 138 | $ cd jMeter |
| 139 | $ wget http://mirrors.whoishostingthis.com/apache//jmeter/binaries/apache-jmeter-5.1.1.zip |
| 140 | $ unzip apache-jmeter-5.1.1.zip |
| 141 | |
| 142 | Run JMeter |
| 143 | |
| 144 | .. code-block:: bash |
| 145 | |
| 146 | $ /home/ubuntu/jMeter/apache-jmeter-5.1.1/bin/jmeter |
| 147 | |
| 148 | The above command will load the JMeter UI. Then navigate to File ā Open ā Browse and select the test plan jmx file to open. |
| 149 | The jmx file is present in the policy/pap git repository. |
| 150 | |
| 151 | Install simulators in VM1 |
| 152 | ------------------------- |
| 153 | |
| 154 | For installing simulator, there is a script placed at `install simulator script <https://gerrit.onap.org/r/gitweb?p=policy/pap.git;a=blob;f=testsuites/stability/src/main/resources/simulatorsetup/setup_components.sh;h=86de3c1efcb468431a2395eef610db209a613fc3;hb=refs/heads/master>`_ |
| 155 | |
| 156 | Copy the script & all related files in virtual machine and run it. |
| 157 | |
| 158 | After installation make sure that following 4 docker containers are up and running. |
| 159 | |
| 160 | .. code-block:: bash |
| 161 | |
| 162 | root@policytest-policytest-3-p5djn6as2477:/home/ubuntu/simulator# docker ps |
| 163 | CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES |
| 164 | 887efa8dac12 nexus3.onap.org:10001/onap/policy-api "bash ./policy-api.sh" 6 days ago Up 6 days 0.0.0.0:6969->6969/tcp policy-api |
| 165 | 0a931c0a63ac pdp/simulator:latest "bash pdp-sim.sh" 6 days ago Up 6 days pdp-simulator |
| 166 | a41adcb32afb dmaap/simulator:latest "bash dmaap-sim.sh" 6 days ago Up 6 days 0.0.0.0:3904->3904/tcp dmaap-simulator |
| 167 | d52d6b750ba0 mariadb:10.2.14 "docker-entrypoint.sā¦" 6 days ago Up 6 days 0.0.0.0:3306->3306/tcp mariadb |
| 168 | |
| 169 | Install PAP in VM2 |
| 170 | ------------------ |
| 171 | |
| 172 | For installing PAP, there is a script placed at `install pap script <https://gerrit.onap.org/r/gitweb?p=policy/pap.git;a=blob;f=testsuites/stability/src/main/resources/papsetup/setup_pap.sh;h=dc5e69e76da9f48f6b23cc012e14148f1373d1e1;hb=refs/heads/master>`_ |
| 173 | |
| 174 | Copy the script & all related files in virtual machine and run it. |
| 175 | |
| 176 | After installation make sure that following docker container is up and running. |
| 177 | |
| 178 | .. code-block:: bash |
| 179 | |
| 180 | root@policytest-policytest-0-uc3y2h5x6p4j:/home/ubuntu/pap# docker ps |
| 181 | CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES |
| 182 | 42ac0ed4b713 nexus3.onap.org:10001/onap/policy-pap:2.0.0-SNAPSHOT-latest "bash ./policy-pap.sh" 3 days ago Up 3 days 0.0.0.0:6969->6969/tcp, 0.0.0.0:9090->9090/tcp policy-pap |
| 183 | |
| 184 | Install & configure visualVM in VM2 |
| 185 | ----------------------------------- |
| 186 | |
| 187 | visualVM needs to be installed in the virtual machine having PAP. It will be used to monitor CPU, Memory, GC for PAP while stability test is running. |
| 188 | |
| 189 | Install visualVM |
| 190 | |
| 191 | .. code-block:: bash |
| 192 | |
| 193 | $ sudo apt-get install visualvm |
| 194 | |
| 195 | Run few commands to configure permissions |
| 196 | |
| 197 | .. code-block:: bash |
| 198 | |
| 199 | $ cd /usr/lib/jvm/java-8-openjdk-amd64/bin/ |
| 200 | $ sudo touch visualvm.policy |
| 201 | $ sudo chmod 777 visualvm.policy |
| 202 | |
| 203 | $ vi visualvm.policy |
| 204 | |
| 205 | Add the following in visualvm.policy |
| 206 | |
| 207 | |
| 208 | grant codebase "file:/usr/lib/jvm/java-8-openjdk-amd64/lib/tools.jar" { |
| 209 | permission java.security.AllPermission; |
| 210 | }; |
| 211 | |
| 212 | Run following commands to start jstatd using port 1111 |
| 213 | |
| 214 | .. code-block:: bash |
| 215 | |
| 216 | $ cd /usr/lib/jvm/java-8-openjdk-amd64/bin/ |
| 217 | $ ./jstatd -p 1111 -J-Djava.security.policy=visualvm.policy & |
| 218 | |
| 219 | Run visualVM locally to connect to remote VM2 |
| 220 | |
| 221 | .. code-block:: bash |
| 222 | |
| 223 | # On your windows machine or your linux box locally, launch visualVM |
| 224 | |
| 225 | Connect to jstatd & remote apex-pdp JVM |
| 226 | |
| 227 | 1. Right click on "Remote" in the left panel of the screen and select "Add Remote Host..." |
| 228 | 2. Enter the IP address of VM2. |
| 229 | 3. Right click on IP address, select "Add JMX Connection..." |
| 230 | 4. Enter the VM2 IP Address (from step 2) <IP address>:9090 ( for example -10.12.6.201:9090) and click OK. |
| 231 | 5. Double click on the newly added nodes under "Remote" to start monitoring CPU, Memory & GC. |
| 232 | |
| 233 | Sample Screenshot of visualVM |
| 234 | |
| 235 | .. image:: images/pap-s3p-vvm-sample.png |
| 236 | |
| 237 | Test Plan |
| 238 | --------- |
| 239 | |
| 240 | The 72 hours stability test will run the following steps sequentially in a single threaded loop. |
| 241 | |
| 242 | - **Create Policy Type** - creates an operational policy type using policy/api component |
| 243 | - **Create Policy** - creates an operational policy using the policy type create in above step using policy/api component |
| 244 | - **Check Health** - checks the health status of pap |
| 245 | - **Check Statistics** - checks the statistics of pap |
| 246 | - **Change state to ACTIVE** - changes the state of PdpGroup to ACTIVE |
| 247 | - **Check PdpGroup Query** - makes a PdpGroup query request and verify that PdpGroup is in ACTIVE state. |
| 248 | - **Deploy Policy** - deploys the policy in PdpGroup |
| 249 | - **Undeploy Policy** - undeploy the policy from PdpGroup |
| 250 | - **Change state to PASSIVE** - changes the state of PdpGroup to PASSIVE |
| 251 | - **Check PdpGroup Query** - makes a PdpGroup query request and verify that PdpGroup is in PASSIVE state. |
| 252 | - **Delete Policy** - deletes the operational policy using policy/api component |
| 253 | - **Delete Policy Type** - deletes the operational policy type using policy/api component |
| 254 | |
| 255 | The following steps can be used to configure the parameters of test plan. |
| 256 | |
| 257 | - **HTTP Authorization Manager** - used to store user/password authentication details. |
| 258 | - **HTTP Header Manager** - used to store headers which will be used for making HTTP requests. |
| 259 | - **User Defined Variables** - used to store following user defined parameters. |
| 260 | |
| 261 | ========== =============================================== |
| 262 | **Name** **Description** |
| 263 | ========== =============================================== |
| 264 | PAP_HOST IP Address or host name of PAP component |
| 265 | PAP_PORT Port number of PAP for making REST API calls |
| 266 | API_HOST IP Address or host name of API component |
| 267 | API_PORT Port number of API for making REST API calls |
| 268 | ========== =============================================== |
| 269 | |
| 270 | Screenshot of PAP stability test plan |
| 271 | |
| 272 | .. image:: images/pap-s3p-testplan.png |
| 273 | |
| 274 | Test Results |
| 275 | ------------ |
| 276 | |
| 277 | **Summary** |
| 278 | |
| 279 | Stability test plan was triggered for 72 hours. |
| 280 | |
| 281 | **Test Statistics** |
| 282 | |
| 283 | ======================= ================= ================== ================================== |
| 284 | **Total # of requests** **Success %** **Error %** **Average time taken per request** |
| 285 | ======================= ================= ================== ================================== |
| 286 | 178208 100 % 0 % 76 ms |
| 287 | ======================= ================= ================== ================================== |
| 288 | |
| 289 | **VisualVM Screenshot** |
| 290 | |
| 291 | .. image:: images/pap-s3p-vvm-1.png |
| 292 | .. image:: images/pap-s3p-vvm-2.png |
| 293 | |
| 294 | **JMeter Screenshot** |
| 295 | |
| 296 | .. image:: images/pap-s3p-jm-1.png |
| 297 | .. image:: images/pap-s3p-jm-1.png |