Update Apex-PDP s3p Tests documentation
[policy/parent.git] / docs / development / devtools / apex-s3p.rst
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 .. _apex-s3p-label:
6
7 .. toctree::
8    :maxdepth: 2
9
10 Policy APEX PDP component
11 ~~~~~~~~~~~~~~~~~~~~~~~~~
12
13 Setting up Stability Tests in APEX
14 ++++++++++++++++++++++++++++++++++
15
16 Introduction
17 ------------
18
19 The 72 hour Stability Test for apex-pdp has the goal of introducing a steady flow of transactions initiated from a test client server running JMeter. The pdp is configured to start a rest server inside it and take input from rest clients (JMeter) and send back output to the rest clients (JMeter).
20
21 The input events will be submitted through rest interface of apex-pdp and the results are verified using the rest responses coming out from apex-pdp.
22
23 The test will be performed in a multi-threaded environment where 5 threads running in JMeter will keep sending events to apex-pdp for the duration of 72 hours.
24
25 Setup details
26 -------------
27
28 Stability test is performed on VM's running in OpenStack cloud environment. APEX-PDP along with other components in Policy Framework is deployed in an OOM ONAP installation. JMeter runs on a separate VM to simulate a steady flow of transactions.
29
30
31 Test Plan
32 ---------
33
34 The 72 hours stability test will run the following steps in a 5 threaded loop.
35
36 Setup stage (these calls run only once - at the beginning)
37 - **Create Policy** - creates a policy using the policy/api component
38 - **Deploy Policy** - deploys the policy in the existing PdpGroup
39 Test stage (these calls run over and over again)
40 - **Check Health** - checks the health status of apex
41 - **Send Input Event** - triggers 'unauthenticated.DCAE_CL_OUTPUT' event of DMaaP.
42 - **Get Output Event Response** - checks for the triggered output event.
43 Teardown stage (this calls run only once - at the end)
44 - **Undeploy Policy** - undeploys the policy from PdpGroup
45 - **Delete Policy** - deletes the policy using the policy/api component
46
47 The following steps can be used to configure the parameters of the test plan.
48
49 - **HTTP Header Manager** - used to store headers which will be used for making HTTP requests.
50 - **HTTP Request Defaults** -  used to store HTTP request details like Server Name or IP, Port, Protocol etc.
51 - **User Defined Variables** -  used to store the following user defined parameters:
52
53 ==================  ============================================================================  ============================
54 **Name**            **Description**                                                               **Default Value**
55 ==================  ============================================================================  ============================
56 wait                Wait time after each request (in milliseconds)                                10000
57 threads             Number of threads to run test cases in parallel.                              5
58 threadsTimeOutInMs  Synchronization timer for threads running in parallel (in milliseconds).      5000
59 PAP_PORT            Port number of PAP for making REST API calls
60 API_PORT            Port number of API for making REST API calls
61 APEX_PORT           Port number of APEX for making REST API calls
62 DMAAP_PORT          Port number of DMAAP for making REST API calls
63 HOSTNAME            Server IP address for making REST API calls
64 ==================  ============================================================================  ============================
65
66
67 Download and update the jmx file presented in the apex-pdp git repository - `jmx file path <https://gerrit.onap.org/r/gitweb?p=policy/apex-pdp.git;a=tree;f=testsuites/apex-pdp-stability/src/main/resources;h=99d373033a190a690d4e05012bc3a656cae7bc3f;hb=refs/heads/master>`_.
68
69 - ThreadGroup.duration - Set the duration to 259200 seconds (72 hours)
70
71 Use the CLI mode to start the test
72
73 .. code-block:: bash
74
75     nohup ./jmeter.sh -n -t ~/apexPdpStabilityTestPlan.jmx -Jusers=1 -l ~/stability.log
76
77
78 Stability Test Results
79 ----------------------
80
81 The stability test plan was triggered for 72 hours, injecting input events to apex-pdp pod from 5 client threads running in JMeter.
82
83 The stability tests were executed as part of a full ONAP OOM deployment in Nordix lab.
84
85 Once the tests complete, we can generate an HTML test report via the command:
86
87 .. code-block:: bash
88
89     ~/jMeter/apache-jmeter-5.2.1/bin/jmeter -g stability.log -o ./result/
90
91 ==============================================  ================================  =============  ============ ============================
92 **Number of Client Threads running in JMeter**  **Total number of input events**  **Success %**  **Error %**  **Average Time per Request**
93 ==============================================  ================================  =============  ============ ============================
94 5                                               129326                            100%           0%           6716.12
95 ==============================================  ================================  =============  ============ ============================
96
97
98 **JMeter Screenshot**
99
100 .. image:: images/apex_s3p_jm-1.png
101 .. image:: images/apex_s3p_jm-2.png
102
103 :download:`result.zip <apex-s3p-results/apex_s3p_results.zip>`
104
105 Setting up Performance Tests in APEX
106 ++++++++++++++++++++++++++++++++++++
107
108 The Performance test is performed on a similar setup to the Stability test. JMeter will send a large number of REST requests and will then retrieve those requests.
109
110 Performance test plan will be the same as the stability test plan except for some differences listed below:
111
112 - Increase the number of threads from 5 to 20.
113 - Reduce test time to ninety minutes. (ThreadGroup.duration - Set the duration to 5400 seconds)
114
115 Download and update the jmx file presented in the apex-pdp git repository - `jmx file path <https://gerrit.onap.org/r/gitweb?p=policy/apex-pdp.git;a=tree;f=testsuites/performance/performance-benchmark-test/src/main/resources;h=b0ed1058b11f82b42fb5be1a07009114e1e8b593;hb=refs/heads/master>`_.
116
117
118 Run Test
119 --------
120
121 Running the performance test will be the same as the stability test. That is, launch JMeter pointing to corresponding *.jmx* test plan. The *API_HOST* , *API_PORT* , *PAP_HOST* , *PAP_PORT* are already set up in *.jmx*.
122
123 .. code-block:: bash
124
125     nohup ./jmeter.sh -n -t ~/performance.jmx -Jusers=1 -l ~/perf.log
126
127 Once the tests have completed, run the following the gather results.
128
129 .. code-block:: bash
130
131     ~/jMeter/apache-jmeter-5.2.1/bin/jmeter -g perf.log -o ./performance_result/
132
133 Performance Test Result
134 -----------------------
135
136 **Summary**
137
138 Performance test was triggered for 90 minutes. The results are shown below.
139
140 **Test Statistics**
141
142 ============================ =========== ========= ==================================
143 **Total Number of Requests** **Success** **Error** **Average Time Taken per Request**
144 ============================ =========== ========= ==================================
145 32304                        99,99 %     0.01 %    8746.50 ms
146 ============================ =========== ========= ==================================
147
148 **JMeter Screenshot**
149
150 .. image:: images/apex_perf_jm_1.PNG
151
152 .. image:: images/apex_perf_jm_2.PNG