Update documentation for ACM S3P test in Kohn
[policy/parent.git] / docs / development / devtools / clamp-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 .. _acm-s3p-label:
6
7 .. toctree::
8    :maxdepth: 2
9
10 Policy Clamp Automation Composition
11 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
12
13 Both the Performance and the Stability tests were executed by performing requests
14 against acm components installed as docker images in local environment.
15
16
17 ACM Deployment
18 ++++++++++++++
19
20 The docker containers can be deployed via Policy CSIT script.
21 Clone the Policy/docker repo to the local vm
22
23 .. code-block:: bash
24
25     git clone "https://gerrit.onap.org/r/policy/docker"
26
27 Set the following environment variables on the system before deploying the containers.
28
29 .. code-block:: bash
30
31     export CONTAINER_LOCATION=nexus3.onap.org:10001/
32     export PROJECT=clamp
33
34 Invoke the following script from the ~/docker/csit folder.
35
36 .. code-block:: bash
37
38     ./start-all.sh
39
40 This script installs the docker containers of ACM and Policy components required for running the tests.
41
42
43 Jmeter setup
44 ++++++++++++
45
46 Apache jmeter tool is installed either on the same virtual machine or on a different virtual machine.
47
48 .. code-block:: bash
49
50     # Install required packages
51     sudo apt install -y wget unzip
52
53     # Install JMeter
54     mkdir -p jmeter
55     cd jmeter
56     wget https://dlcdn.apache.org//jmeter/binaries/apache-jmeter-5.5.zip # check if valid version
57     unzip -q apache-jmeter-5.5.zip
58     rm apache-jmeter-5.5.zip
59
60
61 Setup Verification
62 ++++++++++++++++++
63 Ensure the following components are up and running before executing the test.
64
65 - acm runtime component docker image is started and running.
66 - Participant docker images policy-clamp-cl-pf-ppnt, policy-clamp-cl-http-ppnt, policy-clamp-cl-k8s-ppnt are started and running.
67 - Dmaap simulator for communication between components.
68 - mariadb docker container for policy and clampacm database.
69 - policy-api for communication between policy participant and policy-framework
70 - Both tests were run via jMeter, which was installed on a separate VM.
71
72 Stability Test of acm components
73 ++++++++++++++++++++++++++++++++
74
75 Test Plan
76 ---------
77 The 72 hours stability test ran the following steps sequentially in a single threaded loop.
78
79 - **Create Policy defaultDomain** - creates an operational policy using policy/api component
80 - **Delete Policy sampleDomain** - deletes the operational policy sampleDomain using policy/api component
81 - **Commission AC definition** - commissions the acm definition in runtime
82 - **Instantiate acm** - Instantiate the acm towards participants
83 - **Check acm state** - check the current state of acm
84 - **Change State to PASSIVE** - change the state of the acm to PASSIVE
85 - **Check acm state** - check the current state of acm
86 - **Change State to UNINITIALISED** - change the state of the ACM to UNINITIALISED
87 - **Check acm state** - check the current state of acm
88 - **Delete instantiated acm** - delete the instantiated acm from all participants
89 - **Delete ACM Definition** - delete the acm definition on runtime
90
91 The following parameters can be configured on the JMX file for the test.
92
93 - **HTTP Authorization Manager** - used to store user/password authentication details.
94 - **HTTP Header Manager** - used to store headers which will be used for making HTTP requests.
95 - **User Defined Variables** -  used to store following user defined parameters.
96
97 =============================  ========================================================================
98  **Name**                      **Description**
99 =============================  ========================================================================
100  RUNTIME_HOST                  IP Address or host name of acm runtime component
101  RUNTIME_PORT                  Port number of acm runtime components for making REST API calls
102  POLICY_PARTICIPANT_HOST       IP Address or host name of policy participant
103  POLICY_PARTICIPANT_HOST_PORT  Port number of policy participant
104 =============================  ========================================================================
105
106 Download the ACM stability.jmx and performance.jmx files from the Policy-Clamp repo.
107
108 Stability jmx file
109
110 .. code-block:: bash
111
112     ~/clamp/testsuites/stability/src/main/resources/testplans/stability.jmx
113
114 The test was run in the background via "nohup", to prevent it from being interrupted:
115
116 .. code-block:: bash
117
118     nohup ./jmeter/apache-jmeter-5.5/bin/jmeter -n -t stability.jmx -l testresults.jtl
119
120 Test Results
121 ------------
122
123 **Summary**
124
125 Stability test plan was triggered for 72 hours.
126
127 .. Note::
128
129               .. container:: paragraph
130                           
131                   The assertions of state changes are not completely taken care of, as the stability is ran with acm components
132                   alone, and not including complete policy framework deployment, which makes it difficult for actual state changes from
133                   PASSIVE to RUNNING etc to happen.
134
135 **Test Statistics**
136
137 =======================  =================  ==================  ==================================
138 **Total # of requests**  **Success %**      **Error %**         **Average time taken per request**
139 =======================  =================  ==================  ==================================
140 97916                    100.00 %           0.00 %              246 ms
141 =======================  =================  ==================  ==================================
142
143 **ACM component Setup**
144
145 ================  ============================================================    ===========================================  =========================
146 **CONTAINER ID**  **IMAGE**                                                       **PORT**                                     **NAME**
147 ================  ============================================================    ===========================================  =========================
148  a9cb0cd103cf     nexus3.onap.org:10001/onap/policy-clamp-runtime-acm:latest      6969/tcp                                     policy-clamp-runtime-acm
149  886e572b8438     nexus3.onap.org:10001/onap/policy-clamp-ac-pf-ppnt:latest       6969/tcp                                     policy-clamp-ac-pf-ppnt
150  035707b1b95f     nexus3.onap.org:10001/onap/policy-api:latest                    6969/tcp                                     policy-api
151  d34204f95ff3     nexus3.onap.org:10001/onap/policy-clamp-ac-http-ppnt:latest     6969/tcp                                     policy-clamp-ac-http-ppnt
152  4470e608c9a8     nexus3.onap.org:10001/onap/policy-clamp-ac-k8s-ppnt:latest      6969/tcp                                     policy-clamp-ac-k8s-ppnt
153  62229d46b79c     nexus3.onap.org:10001/onap/policy-models-simulator:latest       3905/tcp, 6666/tcp, 6668-6670/tcp, 6680/tcp  simulator
154  efaf0ca5e1f0     nexus3.onap.org:10001/mariadb:10.5.8                            3306/tcp                                     mariadb
155  e84cf17db2a4     nexus3.onap.org:10001/onap/policy-pap:latest                    6969/tcp                                     policy-pap
156  0a16eecd13c9     nexus3.onap.org:10001/onap/policy-apex-pdp:latest               6969/tcp                                     policy-apex-pdp
157 ================  ============================================================    ===========================================  =========================
158
159 .. Note::
160
161               .. container:: paragraph
162
163                   There were no failures during the 72 hours test.
164
165 **JMeter Screenshot**
166
167 .. image:: clamp-s3p-results/acm_stability_jmeter.png
168
169 **JMeter Screenshot**
170
171 .. image:: clamp-s3p-results/acm_stability_table.png
172
173 **Memory and CPU usage**
174
175 The memory and CPU usage can be monitored by running "docker stats" command.
176
177 Memory and CPU usage after test execution:
178
179 .. image:: clamp-s3p-results/Stability_after_stats.png
180
181
182 Performance Test of acm components
183 ++++++++++++++++++++++++++++++++++
184
185 Introduction
186 ------------
187
188 Performance test of acm components 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.
189
190 Setup Details
191 -------------
192
193 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 runtime component and collecting the statistics.
194
195
196 Test Plan
197 ---------
198
199 Performance test plan is the same as the stability test plan above except for the few differences listed below.
200
201 - Increase the number of threads up to 5 (simulating 5 users' behaviours at the same time).
202 - Reduce the test time to 2 hours.
203
204 Run Test
205 --------
206
207 Performance jmx file
208
209 .. code-block:: bash
210
211     ~/clamp/testsuites/performance/src/main/resources/testplans/performance.jmx
212
213 Running/Triggering the performance test will be the same as the stability test. That is, launch JMeter pointing to corresponding *.jmx* test plan. The *RUNTIME_HOST*, *RUNTIME_PORT*, *POLICY_PARTICIPANT_HOST*, *POLICY_PARTICIPANT_HOST_PORT* are already set up in *.jmx*
214
215 .. code-block:: bash
216
217     nohup ./jmeter/apache-jmeter-5.5/bin/jmeter -n -t performance.jmx -l testresults.jtl
218
219 Once the test execution is completed, execute the below script to get the statistics:
220
221 .. code-block:: bash
222
223     $ cd ./clamp/testsuites/performance/src/main/resources/testplans
224     $ ./results.sh resultTree.log
225
226 Test Results
227 ------------
228
229 Test results are shown as below.
230
231 **Test Statistics**
232
233 =======================  =================  ==================  ==================================
234 **Total # of requests**  **Success %**      **Error %**         **Average time taken per request**
235 =======================  =================  ==================  ==================================
236 13591                    100 %              0.00 %              249 ms
237 =======================  =================  ==================  ==================================
238
239 **ACM component Setup**
240
241 ================  ============================================================    ===========================================  =========================
242 **CONTAINER ID**  **IMAGE**                                                       **PORT**                                     **NAME**
243 ================  ============================================================    ===========================================  =========================
244  a9cb0cd103cf     nexus3.onap.org:10001/onap/policy-clamp-runtime-acm:latest      6969/tcp                                     policy-clamp-runtime-acm
245  886e572b8438     nexus3.onap.org:10001/onap/policy-clamp-ac-pf-ppnt:latest       6969/tcp                                     policy-clamp-ac-pf-ppnt
246  035707b1b95f     nexus3.onap.org:10001/onap/policy-api:latest                    6969/tcp                                     policy-api
247  d34204f95ff3     nexus3.onap.org:10001/onap/policy-clamp-ac-http-ppnt:latest     6969/tcp                                     policy-clamp-ac-http-ppnt
248  4470e608c9a8     nexus3.onap.org:10001/onap/policy-clamp-ac-k8s-ppnt:latest      6969/tcp                                     policy-clamp-ac-k8s-ppnt
249  62229d46b79c     nexus3.onap.org:10001/onap/policy-models-simulator:latest       3905/tcp, 6666/tcp, 6668-6670/tcp, 6680/tcp  simulator
250  efaf0ca5e1f0     nexus3.onap.org:10001/mariadb:10.5.8                            3306/tcp                                     mariadb
251  e84cf17db2a4     nexus3.onap.org:10001/onap/policy-pap:latest                    6969/tcp                                     policy-pap
252  0a16eecd13c9     nexus3.onap.org:10001/onap/policy-apex-pdp:latest               6969/tcp                                     policy-apex-pdp
253 ================  ============================================================    ===========================================  =========================
254
255 **JMeter Screenshot**
256
257 .. image:: clamp-s3p-results/acm_performance_jmeter.png