Refactor s3p documents
[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 - **Check status of defaultGroup** - checks the status of defaultGroup PdpGroup with the defaultDomain policy 1.0.0.
38 - **Check PdpGroup Audit defaultGroup** - checks the audit information for the defaultGroup PdpGroup.
39 - **Check PdpGroup Audit Policy (defaultGroup)** - checks the audit information for the defaultGroup PdpGroup with the defaultDomain policy 1.0.0.
40 - **Create/Update PDP Group** - creates a new PDPGroup named sampleGroup.
41 - **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.
42 - **Deployment Update sampleDomain** - deploys the policy sampleDomain in sampleGroup PdpGroup using pap api
43 - **Check status of sampleGroup** - checks the status of the sampleGroup PdpGroup.
44 - **Check status of PdpGroups** - checks the status of both PdpGroups.
45 - **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.
46 - **Check Audit** - checks the audit information for all PdpGroups.
47 - **Check Consolidated Health** - checks the consolidated health status of all policy components.
48 - **Check Deployed Policies** - checks for all the deployed policies using pap api.
49 - **Undeploy Policy sampleDomain** - undeploys the policy sampleDomain from sampleGroup PdpGroup using pap api
50 - **Undeploy Default Policy** - undeploys the policy defaultDomain from PdpGroup
51 - **Change state to PASSIVE(sampleGroup)** - changes the state of sampleGroup PdpGroup to PASSIVE
52 - **Delete PdpGroup SampleGroup** - delete the sampleGroup PdpGroup using pap api
53 - **Change State to PASSIVE(defaultGroup)** - changes the state of defaultGroup PdpGroup to PASSIVE
54 - **Check PdpGroup Query** - makes a PdpGroup query request and verifies that PdpGroup is in the PASSIVE state.
55 - **Delete Policy defaultDomain** - deletes the operational policy defaultDomain using policy/api component
56 - **Delete Policy sampleDomain** - deletes the operational policy sampleDomain using policy/api component
57
58 The following steps can be used to configure the parameters of test plan.
59
60 - **HTTP Authorization Manager** - used to store user/password authentication details.
61 - **HTTP Header Manager** - used to store headers which will be used for making HTTP requests.
62 - **User Defined Variables** -  used to store following user defined parameters.
63
64 ===========   ===================================================================
65  **Name**      **Description**
66 ===========   ===================================================================
67  PAP_HOST      IP Address or host name of PAP component
68  PAP_PORT      Port number of PAP for making REST API calls
69  API_HOST      IP Address or host name of API component
70  API_PORT      Port number of API for making REST API calls
71 ===========   ===================================================================
72
73 The test was run in the background via "nohup", to prevent it from being interrupted:
74
75 .. code-block:: bash
76
77     nohup ./jMeter/apache-jmeter-5.3/bin/jmeter.sh -n -t stability.jmx -l testresults.jtl
78
79 Test Results
80 ------------
81
82 **Summary**
83
84 Stability test plan was triggered for 72 hours.
85
86 .. Note::
87
88               .. container:: paragraph
89
90                   As part of the OOM deployment, another APEX-PDP pod is spun up with the pdpGroup name specified as 'sampleGroup'.
91                   After creating the new group called 'sampleGroup' as part of the test, a time delay of 2 minutes is added,
92                   so that the pdp is registered to the newly created group.
93                   This has  resulted in a spike in the Average time taken per request. But, this is required to make proper assertions,
94                   and also for the consolidated health check.
95
96 **Test Statistics**
97
98 =======================  =================  ==================  ==================================
99 **Total # of requests**  **Success %**      **Error %**         **Average time taken per request**
100 =======================  =================  ==================  ==================================
101 34053                    99.14 %            0.86 %              1051 ms
102 =======================  =================  ==================  ==================================
103
104 .. Note::
105
106               .. container:: paragraph
107
108                   There were some failures during the 72 hour stability tests. These tests were caused by the apex-pdp pods restarting
109                   intermitently due to limited resources in our testing environment. The second apex instance was configured as a
110                   replica of the apex-pdp pod and therefore, when it restarted, registered to the "defaultGroup" as the configuration 
111                   was taken from the original apex-pdp pod. This meant a manual change whenever the pods restarted to make apex-pdp-"2"
112                   register with the "sampleGroup".
113                   When both pods were running as expected, no errors relating to the pap functionality were observed. These errors are
114                   strictly caused by the environment setup and not by pap.
115
116 **JMeter Screenshot**
117
118 .. image:: pap-s3p-results/pap-s3p-stability-result-jmeter.png
119
120 **Memory and CPU usage**
121
122 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.
123
124 Memory and CPU usage before test execution:
125
126 .. image:: pap-s3p-results/pap-s3p-mem-bt.png
127
128 Memory and CPU usage after test execution:
129
130 .. image:: pap-s3p-results/pap-s3p-mem-at.png
131
132
133 Performance Test of PAP
134 ++++++++++++++++++++++++
135
136 Introduction
137 ------------
138
139 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.
140
141 Setup Details
142 -------------
143
144 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.
145
146
147 Test Plan
148 ---------
149
150 Performance test plan is the same as the stability test plan above except for the few differences listed below.
151
152 - Increase the number of threads up to 5 (simulating 5 users' behaviours at the same time).
153 - Reduce the test time to 2 hours.
154 - Usage of counters to create different groups by the 'Create/Update PDP Group' test case.
155 - 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.
156
157 Run Test
158 --------
159
160 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*.
161
162 .. code-block:: bash
163
164     nohup ./jMeter/apache-jmeter-5.3/bin/jmeter.sh -n -t performance.jmx -l perftestresults.jtl
165
166 Once the test execution is completed, execute the below script to get the statistics:
167
168 .. code-block:: bash
169
170     $ cd /home/ubuntu/pap/testsuites/performance/src/main/resources/testplans
171     $ ./results.sh /home/ubuntu/pap_perf/resultTree.log
172
173 Test Results
174 ------------
175
176 Test results are shown as below.
177
178 **Test Statistics**
179
180 =======================  =================  ==================  ==================================
181 **Total # of requests**  **Success %**      **Error %**         **Average time taken per request**
182 =======================  =================  ==================  ==================================
183 24092                    100 %              0.00 %              2467 ms
184 =======================  =================  ==================  ==================================
185
186 **JMeter Screenshot**
187
188 .. image:: pap-s3p-results/pap-s3p-performance-result-jmeter.png