ce61e55ecb141157d6757be5912327ff45c4081c
[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 Both the Stability and the Performance tests were executed in a full ONAP OOM deployment in Nordix lab.
14
15
16 Setup Details
17 +++++++++++++
18
19 - APEX-PDP along with all policy components deployed as part of a full ONAP OOM deployment.
20 - Policy-models-simulator is deployed to use CDS and DMaaP simulators during policy execution.
21     Simulator configurations used are available in apex-pdp repository:
22       testsuites/apex-pdp-stability/src/main/resources/simulatorConfig/
23 - Two APEX policies are executed in the APEX-PDP engine, and are triggered by multiple threads during the tests.
24 - Both tests were run via jMeter.
25
26     Stability test script is available in apex-pdp repository:
27       testsuites/apex-pdp-stability/src/main/resources/apexPdpStabilityTestPlan.jmx
28
29     Performance test script is available in apex-pdp repository:
30       testsuites/performance/performance-benchmark-test/src/main/resources/apexPdpPerformanceTestPlan.jmx
31
32 .. Note::
33    Policy executions are validated in a more strict fashion during the tests.
34    There are test cases where upto 80 events are expected on the DMaaP topic.
35    DMaaP simulator is used to keep it simple and avoid any message pickup timing related issues.
36
37 Stability Test of APEX-PDP
38 ++++++++++++++++++++++++++
39
40 Test Plan
41 ---------
42
43 The 72 hours stability test ran the following steps.
44
45 Setup Phase
46 """""""""""
47
48 Policies are created and deployed to APEX-PDP during this phase. Only one thread is in action and this step is done only once.
49
50 - **Create Policy onap.policies.apex.Simplecontrolloop** - creates the first APEX policy using policy/api component.
51       This is a sample policy used for PNF testing.
52 - **Create Policy onap.policies.apex.Example** - creates the second APEX policy using policy/api component.
53       This is a sample policy used for VNF testing.
54 - **Deploy Policies** - Deploy both the policies created to APEX-PDP using policy/pap component
55
56 Main Phase
57 """"""""""
58
59 Once the policies are created and deployed to APEX-PDP by the setup thread, five threads execute the below tests for 72 hours.
60
61 - **Healthcheck** - checks the health status of APEX-PDP
62 - **Prometheus Metrics** - checks that APEX-PDP is exposing prometheus metrics
63 - **Test Simplecontrolloop policy success case** - Send a trigger event to *unauthenticated.DCAE_CL_OUTPUT* DMaaP topic.
64     If the policy execution is successful, 3 different notification events are sent to *APEX-CL-MGT* topic by each one of the 5 threads.
65     So, it is checked if 15 notification messages are received in total on *APEX-CL-MGT* topic with the relevant messages.
66 - **Test Simplecontrolloop policy failure case** - Send a trigger event with invalid pnfName to *unauthenticated.DCAE_CL_OUTPUT* DMaaP topic.
67     The policy execution is expected to fail due to AAI failure response. 2 notification events are expected on *APEX-CL-MGT* topic by a thread in this case.
68     It is checked if 10 notification messages are received in total on *APEX-CL-MGT* topic with the relevant messages.
69 - **Test Example policy success case** - Send a trigger event to *unauthenticated.DCAE_POLICY_EXAMPLE_OUTPUT* DMaaP topic.
70     If the policy execution is successful, 4 different notification events are sent to *APEX-CL-MGT* topic by each one of the 5 threads.
71     So, it is checked if 20 notification messages are received in total on *APEX-CL-MGT* topic with the relevant messages.
72 - **Test Example policy failure case** - Send a trigger event with invalid vnfName to *unauthenticated.DCAE_POLICY_EXAMPLE_OUTPUT* DMaaP topic.
73     The policy execution is expected to fail due to AAI failure response. 2 notification events are expected on *APEX-CL-MGT* topic by a thread in this case.
74     So, it is checked if 10 notification messages are received in total on *APEX-CL-MGT* topic with the relevant messages.
75 - **Clean up DMaaP notification topic** - DMaaP notification topic which is *APEX-CL-MGT* is cleaned up after each test to make sure that one failure doesn't lead to cascading errors.
76
77
78 Teardown Phase
79 """"""""""""""
80
81 Policies are undeployed from APEX-PDP and deleted during this phase.
82 Only one thread is in action and this step is done only once after the Main phase is complete.
83
84 - **Undeploy Policies** - Undeploy both the policies from APEX-PDP using policy/pap component
85 - **Delete Policy onap.policies.apex.Simplecontrolloop** - delete the first APEX policy using policy/api component.
86 - **Delete Policy onap.policies.apex.Example** - delete the second APEX policy also using policy/api component.
87
88
89 The following steps can be used to configure the parameters of test plan.
90
91 - **HTTP Authorization Manager** - used to store user/password authentication details.
92 - **HTTP Header Manager** - used to store headers which will be used for making HTTP requests.
93 - **User Defined Variables** -  used to store following user defined parameters.
94
95 ===================  ===============================================================================
96  **Name**            **Description**
97 ===================  ===============================================================================
98  HOSTNAME            IP Address or host name to access the components
99  PAP_PORT            Port number of PAP for making REST API calls such as deploy/undeploy of policy
100  API_PORT            Port number of API for making REST API calls such as create/ delete of policy
101  APEX_PORT           Port number of APEX for making REST API calls such as healthcheck/metrics
102  wait                Wait time if required after a request (in milliseconds)
103  threads             Number of threads to run test cases in parallel
104  threadsTimeOutInMs  Synchronization timer for threads running in parallel (in milliseconds)
105 ===================  ===============================================================================
106
107 Run Test
108 --------
109
110 The test was run in the background via "nohup", to prevent it from being interrupted:
111
112 .. code-block:: bash
113
114     nohup ./apache-jmeter-5.4.1/bin/jmeter.sh -n -t apexPdpStabilityTestPlan.jmx -l stabilityTestResults.jtl
115
116 Test Results
117 ------------
118
119 **Summary**
120
121 Stability test plan was triggered for 72 hours. There were no failures during the 72 hours test.
122
123
124 **Test Statistics**
125
126 =======================  =================  ==================  ==================================
127 **Total # of requests**  **Success %**      **Error %**         **Average time taken per request**
128 =======================  =================  ==================  ==================================
129 428661                    100 %             0.00 %              162 ms
130 =======================  =================  ==================  ==================================
131
132 .. Note::
133
134    There were no failures during the 72 hours test.
135
136 **JMeter Screenshot**
137
138 .. image:: apex-s3p-results/apex_stability_jmeter_results.JPG
139
140 **Memory and CPU usage**
141
142 The memory and CPU usage can be monitored by running "top" command in the APEX-PDP pod.
143 A snapshot is taken before and after test execution to monitor the changes in resource utilization.
144 Prometheus metrics is also collected before and after the test execution.
145
146 Memory and CPU usage before test execution:
147
148 .. image:: apex-s3p-results/apex_top_before_72h.JPG
149
150 :download:`Prometheus metrics before 72h test  <apex-s3p-results/apex_metrics_before_72h.txt>`
151
152 Memory and CPU usage after test execution:
153
154 .. image:: apex-s3p-results/apex_top_after_72h.JPG
155
156 :download:`Prometheus metrics after 72h test  <apex-s3p-results/apex_metrics_after_72h.txt>`
157
158 Performance Test of APEX-PDP
159 ++++++++++++++++++++++++++++
160
161 Introduction
162 ------------
163
164 Performance test of APEX-PDP is done similar to the stability test, but in a more extreme manner using higher thread count.
165
166 Setup Details
167 -------------
168
169 The performance test is performed on a similar setup as Stability test.
170
171
172 Test Plan
173 ---------
174
175 Performance test plan is the same as the stability test plan above except for the few differences listed below.
176
177 - Increase the number of threads used in the Main Phase from 5 to 20.
178 - Reduce the test time to 2 hours.
179
180 Run Test
181 --------
182
183 .. code-block:: bash
184
185     nohup ./apache-jmeter-5.4.1/bin/jmeter.sh -n -t apexPdpPerformanceTestPlan.jmx -l perftestresults.jtl
186
187
188 Test Results
189 ------------
190
191 Test results are shown as below.
192
193 **Test Statistics**
194
195 =======================  =================  ==================  ==================================
196 **Total # of requests**  **Success %**      **Error %**         **Average time taken per request**
197 =======================  =================  ==================  ==================================
198 46946                    100 %              0.00 %              198 ms
199 =======================  =================  ==================  ==================================
200
201 **JMeter Screenshot**
202
203 .. image:: apex-s3p-results/apex_perf_jmeter_results.JPG
204
205 Summary
206 +++++++
207
208 Multiple policies were executed in a multi threaded fashion for both stability and performance tests.
209 Both tests ran smoothly without any issues.