Documentation changes for PAP S3P testing
[policy/parent.git] / docs / development / devtools / pap-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 .. _pap-s3p-label:
6
7 .. toctree::
8    :maxdepth: 2
9
10 Policy PAP component
11 ~~~~~~~~~~~~~~~~~~~~
12
13 Both the Performance and the Stability tests were executed by performing requests
14 against Policy components installed as part of a full ONAP OOM deployment in Nordix lab.
15
16 Setup Details
17 +++++++++++++
18
19 - Policy-PAP along with all policy components deployed as part of a full ONAP OOM deployment.
20 - A second instance of APEX-PDP is spun up in the setup. Update the configuration file(OnapPfConfig.json) such that the PDP can register to the new group created by PAP in the tests.
21 - Both tests were run via jMeter, which was installed on a separate VM.
22
23 Stability Test of PAP
24 +++++++++++++++++++++
25
26 Test Plan
27 ---------
28 The 72 hours stability test ran the following steps sequentially in a single threaded loop.
29
30 - **Create Policy defaultDomain** - creates an operational policy using policy/api component
31 - **Create Policy sampleDomain** - creates an operational policy using policy/api component
32 - **Check Health** - checks the health status of pap
33 - **Check Statistics** - checks the statistics of pap
34 - **Change state to ACTIVE** - changes the state of defaultGroup PdpGroup to ACTIVE
35 - **Check PdpGroup Query** - makes a PdpGroup query request and verifies that PdpGroup is in the ACTIVE state.
36 - **Deploy defaultDomain Policy** - deploys the policy defaultDomain in the existing PdpGroup
37 - **Create/Update PDP Group** - creates a new PDPGroup named sampleGroup.
38 - **Check PdpGroup Query** - makes a PdpGroup query request and verifies that 2 PdpGroups are in the ACTIVE state and defaultGroup has a policy deployed on it.
39 - **Deployment Update sampleDomain** - deploys the policy sampleDomain in sampleGroup PdpGroup using pap api
40 - **Check PdpGroup Query** - makes a PdpGroup query request and verifies that the defaultGroup has a policy defaultDomain deployed on it and sampleGroup has policy sampleDomain deployed on it.
41 - **Check Consolidated Health** - checks the consolidated health status of all policy components.
42 - **Check Deployed Policies** - checks for all the deployed policies using pap api.
43 - **Undeploy Policy sampleDomain** - undeploys the policy sampleDomain from sampleGroup PdpGroup using pap api
44 - **Undeploy Default Policy** - undeploys the policy defaultDomain from PdpGroup
45 - **Change state to PASSIVE(sampleGroup)** - changes the state of sampleGroup PdpGroup to PASSIVE
46 - **Delete PdpGroup SampleGroup** - delete the sampleGroup PdpGroup using pap api
47 - **Change State to PASSIVE(defaultGroup)** - changes the state of defaultGroup PdpGroup to PASSIVE
48 - **Check PdpGroup Query** - makes a PdpGroup query request and verifies that PdpGroup is in the PASSIVE state.
49 - **Delete Policy defaultDomain** - deletes the operational policy defaultDomain using policy/api component
50 - **Delete Policy sampleDomain** - deletes the operational policy sampleDomain using policy/api component
51
52 The following steps can be used to configure the parameters of test plan.
53
54 - **HTTP Authorization Manager** - used to store user/password authentication details.
55 - **HTTP Header Manager** - used to store headers which will be used for making HTTP requests.
56 - **User Defined Variables** -  used to store following user defined parameters.
57
58 ===========   ===================================================================
59  **Name**      **Description**
60 ===========   ===================================================================
61  PAP_HOST      IP Address or host name of PAP component
62  PAP_PORT      Port number of PAP for making REST API calls
63  API_HOST      IP Address or host name of API component
64  API_PORT      Port number of API for making REST API calls
65 ===========   ===================================================================
66
67 The test was run in the background via "nohup", to prevent it from being interrupted:
68
69 .. code-block:: bash
70
71     nohup ./jMeter/apache-jmeter-5.3/bin/jmeter.sh -n -t stability.jmx -l testresults.jtl
72
73 Test Results
74 ------------
75
76 **Summary**
77
78 Stability test plan was triggered for 72 hours.
79
80 .. Note::
81
82               .. container:: paragraph
83
84                   As part of the OOM deployment, another APEX-PDP pod is spun up with the pdpGroup name specified as 'sampleGroup'.
85                   After creating the new group called 'sampleGroup' as part of the test, a time delay of 2 minutes is added,
86                   so that the pdp is registered to the newly created group.
87                   This has  resulted in a spike in the Average time taken per request. But, this is required to make proper assertions,
88                   and also for the consolidated health check.
89
90 **Test Statistics**
91
92 =======================  =================  ==================  ==================================
93 **Total # of requests**  **Success %**      **Error %**         **Average time taken per request**
94 =======================  =================  ==================  ==================================
95 35059                    99.99 %            0.01 %              354 ms
96 =======================  =================  ==================  ==================================
97
98 .. Note::
99
100               .. container:: paragraph
101
102                   There were only 3 failures during the 72 hours test, and all these 3 happened because the 2nd PDP instance didn't
103                   get registered in time to the new group created, and as a result, the PdpGroup Query failed. This can be ignored,
104                   as it was only a matter of one missing heartbeat over a period of 24 hours.
105
106 **JMeter Screenshot**
107
108 .. image:: images/pap-s3p-jm-stability.JPG
109
110 **Memory and CPU usage**
111
112 The memory and CPU usage can be monitored by running "top" command on the PAP pod. A snapshot is taken before and after test execution to monitor the changes in resource utilization.
113
114 Memory and CPU usage before test execution:
115
116 .. image:: images/pap-s3p-top-before.JPG
117
118 Memory and CPU usage after test execution:
119
120 .. image:: images/pap-s3p-top-after.JPG
121
122 The CPU and memory usage by the PAP pod is consistent over the period of 72 hours test execution.
123
124 Performance Test of PAP
125 ++++++++++++++++++++++++
126
127 Introduction
128 ------------
129
130 Performance test of PAP has the goal of testing the min/avg/max processing time and rest call throughput for all the requests with multiple requests at the same time.
131
132 Setup Details
133 -------------
134
135 The performance test is performed on a similar setup as Stability test. The JMeter VM will be sending a large number of REST requests to the PAP component and collecting the statistics.
136
137
138 Test Plan
139 ---------
140
141 Performance test plan is the same as the stability test plan above except for the few differences listed below.
142
143 - Increase the number of threads up to 5 (simulating 5 users' behaviours at the same time).
144 - Reduce the test time to 2 hours.
145 - Usage of counters to create different groups by the 'Create/Update PDP Group' test case.
146 - Removed the delay to wait for the new PDP to be registered. Also removed the corresponding assertions where the Pdp instance registration to the newly created group is validated.
147
148 Run Test
149 --------
150
151 Running/Triggering 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*.
152
153 .. code-block:: bash
154
155     nohup ./jMeter/apache-jmeter-5.3/bin/jmeter.sh -n -t perf.jmx -l perftestresults.jtl
156
157 Once the test execution is completed, execute the below script to get the statistics:
158
159 .. code-block:: bash
160
161     $ cd /home/ubuntu/pap/testsuites/performance/src/main/resources/testplans
162     $ ./results.sh /home/ubuntu/pap_perf/resultTree.log
163
164 Test Results
165 ------------
166
167 Test results are shown as below.
168
169 **Test Statistics**
170
171 =======================  =================  ==================  ==================================  =======================
172 **Total # of requests**  **Success %**      **Error %**         **Average time taken per request**  **Requests/sec**
173 =======================  =================  ==================  ==================================  =======================
174 44293                    100 %              0.00 %              943 ms                              8858
175 =======================  =================  ==================  ==================================  =======================
176
177 **JMeter Screenshot**
178
179 .. image:: images/pap-s3p-jm-performance.JPG