Docs for Danube 3
[bottlenecks.git] / docs / testing / developer / devguide / posca_guide.rst
1 .. This work is licensed under a Creative Commons Attribution 4.0 International License.
2 .. http://creativecommons.org/licenses/by/4.0
3 .. (c) Huawei Technologies Co.,Ltd and others.
4
5 *********************
6 POSCA Testsuite Guide
7 *********************
8
9
10 POSCA Introduction
11 ====================
12 The POSCA (Parametric Bottlenecks Testing Catalogue) testsuite
13 classifies the bottlenecks test cases and results into 5 categories.
14 Then the results will be analyzed and bottlenecks will be searched
15 among these categories.
16
17 The POSCA testsuite aims to locate the bottlenecks in parmetric
18 manner and to decouple the bottlenecks regarding the deployment
19 requirements.
20 The POSCA testsuite provides an user friendly way to profile and
21 understand the E2E system behavior and deployment requirements.
22
23 Goals of the POSCA testsuite:
24  a) Automatically locate the bottlenecks in a iterative manner.
25  b) Automatically generate the testing report for bottlenecks in different categories.
26  c) Implementing Automated Staging.
27
28 Scopes of the POSCA testsuite:
29  a) Modeling, Testing and Test Result analysis.
30  b) Parameters choosing and Algorithms.
31
32 Test stories of POSCA testsuite:
33  a) Factor test (Stress test): base test cases that Feature test and Optimization will be dependant on.
34  b) Feature test: test cases for features/scenarios.
35  c) Optimization test: test to tune the system parameter.
36
37 Detailed workflow is illutrated below.
38
39 * https://wiki.opnfv.org/display/bottlenecks
40
41
42 Preinstall Packages
43 ====================
44
45 * Docker: https://docs.docker.com/engine/installation/
46     * For Ubuntu, please refer to https://docs.docker.com/engine/installation/linux/ubuntu/
47
48 * Docker-Compose: https://docs.docker.com/compose/
49
50 .. code-block:: bash
51
52     if [ -d usr/local/bin/docker-compose ]; then
53         rm -rf usr/local/bin/docker-compose
54     fi
55     curl -L https://github.com/docker/compose/releases/download/1.11.0/docker-compose-`uname -s`-`uname -m` > /usr/local/bin/docker-compose
56     chmod +x /usr/local/bin/docker-compose
57
58
59 Run POSCA Locally
60 =================
61
62 POSCA testsuite is highly automated regarding test environment preparation, installing testing tools, excuting tests and showing the report/analysis.
63 A few steps are needed to run it locally.
64
65 It is presumed that a user is using Compass4nfv to deploy OPNFV Danube and the user logins jumper server as root.
66
67
68 Downloading Bottlenecks Software
69 --------------------------------
70
71 .. code-block:: bash
72
73     mkdir /home/opnfv
74     cd /home/opnfv
75     git clone https://gerrit.opnfv.org/gerrit/bottlenecks
76     cd bottlenecks
77
78
79 Preparing Python Virtual Evnironment
80 ------------------------------------
81
82 .. code-block:: bash
83
84     . pre_virt_env.sh
85
86
87 Excuting Specified Testcase
88 ---------------------------
89
90 Bottlencks provide a CLI interface to run the tests, which is one of the most convenient way since it is more close to our natural languge. An GUI interface with rest API will also be provided in later update.
91
92 .. code-block:: bash
93
94     bottlenecks [testcase run <testcase>] [teststory run <teststory>]
95
96 For the *testcase* command, testcase name should be as the same name of the test case configuration file located in testsuites/posca/testcase_cfg.
97 For stress tests in Danube, *testcase* should be replaced by either *posca_factor_ping* or *posca_factor_system_bandwidth*.
98 For the *teststory* command, a user could specified the test cases to be excuted by defined it in a teststory configuration file located in testsuites/posca/testsuite_story. There is also an example there named *posca_factor_test*.
99
100 There are also other 2 ways to run test cases and test stories.
101 The first one is using shell script.
102
103 .. code-block:: bash
104
105     bash run_tests.sh [-h|--help] [-s <testsuite>] [-c <testcase>]
106
107 The second is using python interpreter.
108
109 .. code-block:: bash
110
111     docker-compose -f docker/bottleneck-compose/docker-compose.yml up -d
112     docker pull tutum/influxdb:0.13
113     sleep 5
114     POSCA_SCRIPT="/home/opnfv/bottlenecks/testsuites/posca"
115     docker exec bottleneckcompose_bottlenecks_1 python ${POSCA_SCRIPT}/run_posca.py [testcase <testcase>] [teststory <teststory>]
116
117
118 Showing Report
119 --------------
120
121 Bottlenecks uses ELK to illustrate the testing results.
122 Asumming IP of the SUT (System Under Test) is denoted as ipaddr,
123 then the address of Kibana is http://[ipaddr]:5601. One can visit this address to see the illustrations.
124 Address for elasticsearch is http://[ipaddr]:9200. One can use any Rest Tool to visit the testing data stored in elasticsearch.
125
126 Cleaning Up Environment
127 -----------------------
128
129 .. code-block:: bash
130
131     . rm_virt_env.sh
132
133
134 If you want to clean the dockers that established during the test, you can excute the additional commands below.
135
136 .. code-block:: bash
137
138     docker-compose -f docker/bottleneck-compose/docker-compose.yml down -d
139     docker ps -a | grep 'influxdb' | awk '{print $1}' | xargs docker rm -f >/dev/stdout
140
141 Or you can just run the following command
142
143 .. code-block:: bash
144
145     bash run_tests.sh --cleanup
146
147 Note that you can also add cleanup parameter when you run a test case. Then environment will be automatically cleaned up when
148 completing the test.
149
150 Run POSCA through Community CI
151 ==============================
152 POSCA test cases are runned by OPNFV CI now. See https://build.opnfv.org for details of the building jobs.
153 Each building job is set up to execute a single test case. The test results/logs will be printed on the web page and
154 reported automatically to community MongoDB. There are two ways to report the results.
155
156 1. Report testing result by shell script
157
158 .. code-block:: bash
159
160     bash run_tests.sh [-h|--help] [-s <testsuite>] [-c <testcase>] --report
161
162 2. Report testing result by python interpreter
163
164 .. code-block:: bash
165
166     docker-compose -f docker/bottleneck-compose/docker-compose.yml up -d
167     docker pull tutum/influxdb:0.13
168     sleep 5
169     REPORT="True"
170     POSCA_SCRIPT="/home/opnfv/bottlenecks/testsuites/posca"
171     docker exec bottleneckcompose_bottlenecks_1 python ${POSCA_SCRIPT}/run_posca.py [testcase <testcase>] [teststory <teststory>] REPORT
172
173 Test Result Description
174 =======================
175 * Please refer to release notes and also https://wiki.opnfv.org/display/testing/Result+alignment+for+ELK+post-processing