blob: 023fec444b2b1bcfdcc67d251f09f8955d3f8e08 [file] [log] [blame]
Elena Stoeva084ee832021-08-04 20:45:03 +03001Instructions For Running The ROC Tests
2======================================
3
4The REST API and the GUI of the Aether ROC is tested utilizing the Robot Framework.
5The tests are located inside the aether-system-tests repository and they are run nightly using
6a Jenkins job.
7
8Development Prerequisites
9-------------------------
10To access the ROC from a local system, it is necessary to deploy the components of ยตONOS.
11This can be done with the use of Helm (see instructions on
12`this page <https://docs.onosproject.org/onos-docs/docs/content/developers/deploy_with_helm/>`_).
13
14Additionally, it is necessary to add the sdran chart repo with the following command:
15
16.. code-block:: shell
17
18 helm repo add sdran --username USER --password PASSWORD https://sdrancharts.onosproject.org
19
20where USER and PASSWORD can be obtained from the Aether Login Information file, which is
21accessibble to the ``onfstaff`` group.
22
23Finally, the ROC GUI tests are running on the Firefox browser, so it is nesessary to have the Firefox browser and the
24Firefox web driver (geckodriver) installed on the system in order to run these tests.
25
26Running the ROC API tests
27-------------------------
28Follow the steps below to access the ROC API:
29
301. Deploy the aether-roc-umbrella chart from the sdran repo with the following command:
31
32.. code-block:: shell
33
34 helm -n micro-onos install aether-roc-umbrella sdran/aether-roc-umbrella
35
362. Check if all pods are in a Running state:
37
38.. code-block:: shell
39
40 kubectl -n micro-onos get pods
41
42This should print a table like the one below:
43
44.. code-block:: shell
45
46 NAME READY STATUS RESTARTS AGE
47 aether-roc-api-df499d585-7xmt5 2/2 Running 0 2m52s
48 aether-roc-gui-56bfb5fc67-sgxh7 1/1 Running 0 2m52s
49 aether-roc-umbrella-grafana-6b4d4b55c-4mdww 1/1 Running 0 2m52s
50 aether-roc-umbrella-prometheus-alertmanager-694c449885-8fsbs 2/2 Running 0 2m52s
51 aether-roc-umbrella-prometheus-server-59c974f84-d56td 2/2 Running 0 2m52s
52 aether-roc-umbrella-sdcore-test-dummy-7f4895c59c-4pvdg 1/1 Running 0 2m52s
53 onos-cli-846d9c8df6-njqgs 1/1 Running 0 2m52s
54 onos-config-759fff55f-k9fzr 5/5 Running 0 2m52s
55 onos-consensus-store-1-0 1/1 Running 0 2m50s
56 onos-topo-56b687f77b-9l8ns 3/3 Running 0 2m52s
57 sdcore-adapter-v21-5688b8d458-5sn67 1/1 Running 0 2m52s
58 sdcore-adapter-v3-56667fd848-9szt5 2/2 Running 0 2m52s
59
60
613. Once all pods are in a Running state, port-forward to port 8181 with the following command:
62
63.. code-block:: shell
64
65 kubectl -n micro-onos port-forward $(kubectl -n micro-onos get pods -l type=api -o name) 8181
66
67
68Now that we have access to the ROC API, we can proceed with running the ROC API tests from the ``aether-system-tests``
69repository:
70
711. Checkout the aether-system-tests repo:
72
73.. code-block:: shell
74
75 git clone "ssh://$GIT_USER@gerrit.opencord.org:29418/aether-system-tests"
76
772. Go to the repo directory:
78
79.. code-block:: shell
80
81 cd aether-system-tests
82
833. Install the requirements and create a virtual environment:
84
85.. code-block:: shell
86
87 make ast-venv
88 source ast-venv/bin/activate
89
904. Go to the ``roc`` folder and generate the ROC API test framework and test files:
91
92.. code-block:: shell
93
94 cd roc
95 python libraries/api/codegen/class_generator.py \
96 --models=variables/3_0_0_model_list.json \
97 --template=libraries/api/codegen/templates/class_template.py.tmpl \
98 --common_files_directory=libraries/api/codegen/common \
99 --target_directory=libraries/api/
100 python tests/api/codegen/tests_generator.py \
101 --models=variables/3_0_0_model_list.json \
102 --template=tests/api/codegen/templates/tests_template.robot.tmpl \
103 --target_directory=tests/api
104
1055. Go to the directory that contains the test files:
106
107.. code-block:: shell
108
109 cd tests/api/3_0_0
110
1116. Create a folder for the logs and the output files from the tests:
112
113.. code-block:: shell
114
115 mkdir results
116
1177. Run any Robot Framework test file from the ``3_0_0`` directory.
118Each test file corresponds to one of the Aether 3.0.0 models.
119
120.. code-block:: shell
121
122 robot -d results <model-name>.robot
123
124This will generate test reports and logs in the ``results`` directory.
125
126Running the ROC GUI tests
127-------------------------
128We are testing the ROC GUI by installing the ROC on a local dex server. To install the dex server, please follow
129the steps under the "Helm install" section of the Readme file in `this repository <https://github.com/onosproject/onos-helm-charts/tree/master/dex-ldap-umbrella>`_.
130
131Once that you have installed the ``dex-ldap-umbrella`` chart, follow the steps below to install the ROC
132on a local dex server:
133
1341. Deploy the aether-roc-umbrella chart from the sdran repo with the following command:
135
136.. code-block:: shell
137
138 helm -n micro-onos install aether-roc-umbrella sdran/aether-roc-umbrella --set onos-config.openidc.issuer=http://dex-ldap-umbrella:5556 --set aether-roc-gui-v3.openidc.issuer=http://dex-ldap-umbrella:5556 --set import.sdcore-adapter.v2_1.enabled=false
139
1402. Check if all pods are in a Running state:
141
142.. code-block:: shell
143
144 kubectl -n micro-onos get pods
145
146This should print a table like the one below:
147
148.. code-block:: shell
149
150 NAME READY STATUS RESTARTS AGE
151 aether-roc-api-df499d585-srf4c 2/2 Running 0 3m36s
152 aether-roc-gui-799d57456-smx6r 1/1 Running 0 3m36s
153 aether-roc-umbrella-grafana-55cccb986c-t47gz 1/1 Running 0 3m37s
154 aether-roc-umbrella-prometheus-alertmanager-694c449885-rk47g 2/2 Running 0 3m36s
155 aether-roc-umbrella-prometheus-server-59c974f84-97z5t 2/2 Running 0 3m36s
156 aether-roc-umbrella-sdcore-test-dummy-7f4895c59c-cv6j7 1/1 Running 0 3m36s
157 dex-ldap-umbrella-75bbc9d676-wfvcb 1/1 Running 0 8m36s
158 dex-ldap-umbrella-openldap-fc47667c8-9s7q4 1/1 Running 0 8m36s
159 dex-ldap-umbrella-phpldapadmin-b899f9966-rzwkr 1/1 Running 0 8m36s
160 onos-cli-846d9c8df6-kf2xk 1/1 Running 0 3m37s
161 onos-config-5568487f84-dwfs8 5/5 Running 0 3m37s
162 onos-consensus-store-1-0 1/1 Running 0 3m35s
163 onos-topo-56b687f77b-vb2sx 3/3 Running 0 3m36s
164 sdcore-adapter-v3-56667fd848-g7dh2 2/2 Running 0 3m37s
165
166
1673. Once all pods are in a Running state, port-forward to port 8183 to access the ROC GUI:
168
169.. code-block:: shell
170
171 kubectl -n micro-onos port-forward $(kubectl -n micro-onos get pods -l type=arg -o name) 8183:80
172
1733. Port-forward to port 8181 to access the ROC API (which is necessary for some test cases):
174
175.. code-block:: shell
176
177 kubectl -n micro-onos port-forward $(kubectl -n micro-onos get pods -l type=api -o name) 8181
178
1793. Finalluy, port-forward the dex service to port 5556:
180
181.. code-block:: shell
182
183 DEX_POD_NAME=$(kubectl -n micro-onos get pods -l "app.kubernetes.io/name=dex,app.kubernetes.io/instance=dex-ldap-umbrella" -o jsonpath="{.items[0].metadata.name}") &&
184 kubectl -n micro-onos port-forward $DEX_POD_NAME 5556:5556
185
186Now that we have access to the ROC API and GUI, we can proceed with running the ROC GUI tests from the
187``aether-system-tests`` repository:
188
1891. Checkout the aether-system-tests repo:
190
191.. code-block:: shell
192
193 git clone "ssh://$GIT_USER@gerrit.opencord.org:29418/aether-system-tests"
194
1952. Go to the repo directory:
196
197.. code-block:: shell
198
199 cd aether-system-tests
200
2013. Install the requirements and create a virtual environment:
202
203.. code-block:: shell
204
205 make ast-venv
206 source ast-venv/bin/activate
207
2084. Go to the ``roc`` folder and generate the ROC GUI test files:
209
210.. code-block:: shell
211
212 cd roc
213 python tests/gui/codegen/tests_generator.py \
214 --models=variables/3_0_0_model_list.json \
215 --template=tests/gui/codegen/templates/tests_template.robot.tmpl \
216 --target_directory=tests/gui
217
2185. Go to the directory that contains the test files:
219
220.. code-block:: shell
221
222 cd tests/gui/3_0_0
223
2246. Create a folder for the logs and the output files from the tests:
225
226.. code-block:: shell
227
228 mkdir results
229
2307. Run any Robot Framework test file from the ``3_0_0`` directory.
231Each test file corresponds to one of the Aether 3.0.0 models.
232
233.. code-block:: shell
234
235 robot -d results <model-name>.robot
236
237| This will generate test reports and logs in the ``results`` directory.