blob: 257fb6d0aee5218ae6eba2a7f3961ef2f8c94076 [file] [log] [blame]
Zack Williams1ae109e2021-07-27 11:17:04 -07001ROC Testing
2===========
Elena Stoeva084ee832021-08-04 20:45:03 +03003
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
Zack Williams1ae109e2021-07-27 11:17:04 -070014Additionally, it is necessary to add the SD-RAN chart repo with the following command:
Elena Stoeva084ee832021-08-04 20:45:03 +030015
16.. code-block:: shell
17
18 helm repo add sdran --username USER --password PASSWORD https://sdrancharts.onosproject.org
19
Zack Williams1ae109e2021-07-27 11:17:04 -070020where USER and PASSWORD can be obtained from the Aether Login Information file,
21which is accessible to the ``onfstaff`` group.
Elena Stoeva084ee832021-08-04 20:45:03 +030022
Zack Williams1ae109e2021-07-27 11:17:04 -070023Finally, the ROC GUI tests are running on the Firefox browser, so it is
24necessary to have the Firefox browser and the Firefox web driver
25(``geckodriver``) installed on the system in order to run these tests.
Elena Stoeva084ee832021-08-04 20:45:03 +030026
27Running the ROC API tests
28-------------------------
29Follow the steps below to access the ROC API:
30
Sean Condon1df1fcf2021-09-20 09:45:39 +0100311. Deploy the ``aether-roc-umbrella`` chart from the Aether repo with the following command:
Elena Stoeva084ee832021-08-04 20:45:03 +030032
33.. code-block:: shell
34
Sean Condon1df1fcf2021-09-20 09:45:39 +010035 helm -n micro-onos install aether-roc-umbrella aether/aether-roc-umbrella
Elena Stoeva084ee832021-08-04 20:45:03 +030036
372. Check if all pods are in a Running state:
38
39.. code-block:: shell
40
41 kubectl -n micro-onos get pods
42
43This should print a table like the one below:
44
45.. code-block:: shell
46
47 NAME READY STATUS RESTARTS AGE
48 aether-roc-api-df499d585-7xmt5 2/2 Running 0 2m52s
49 aether-roc-gui-56bfb5fc67-sgxh7 1/1 Running 0 2m52s
50 aether-roc-umbrella-grafana-6b4d4b55c-4mdww 1/1 Running 0 2m52s
51 aether-roc-umbrella-prometheus-alertmanager-694c449885-8fsbs 2/2 Running 0 2m52s
52 aether-roc-umbrella-prometheus-server-59c974f84-d56td 2/2 Running 0 2m52s
53 aether-roc-umbrella-sdcore-test-dummy-7f4895c59c-4pvdg 1/1 Running 0 2m52s
54 onos-cli-846d9c8df6-njqgs 1/1 Running 0 2m52s
55 onos-config-759fff55f-k9fzr 5/5 Running 0 2m52s
56 onos-consensus-store-1-0 1/1 Running 0 2m50s
57 onos-topo-56b687f77b-9l8ns 3/3 Running 0 2m52s
58 sdcore-adapter-v21-5688b8d458-5sn67 1/1 Running 0 2m52s
59 sdcore-adapter-v3-56667fd848-9szt5 2/2 Running 0 2m52s
60
61
623. Once all pods are in a Running state, port-forward to port 8181 with the following command:
63
64.. code-block:: shell
65
66 kubectl -n micro-onos port-forward $(kubectl -n micro-onos get pods -l type=api -o name) 8181
67
68
69Now that we have access to the ROC API, we can proceed with running the ROC API tests from the ``aether-system-tests``
70repository:
71
721. Checkout the aether-system-tests repo:
73
74.. code-block:: shell
75
76 git clone "ssh://$GIT_USER@gerrit.opencord.org:29418/aether-system-tests"
77
782. Go to the repo directory:
79
80.. code-block:: shell
81
82 cd aether-system-tests
83
843. Install the requirements and create a virtual environment:
85
86.. code-block:: shell
87
88 make ast-venv
89 source ast-venv/bin/activate
90
914. Go to the ``roc`` folder and generate the ROC API test framework and test files:
92
93.. code-block:: shell
94
95 cd roc
96 python libraries/api/codegen/class_generator.py \
97 --models=variables/3_0_0_model_list.json \
98 --template=libraries/api/codegen/templates/class_template.py.tmpl \
99 --common_files_directory=libraries/api/codegen/common \
100 --target_directory=libraries/api/
101 python tests/api/codegen/tests_generator.py \
102 --models=variables/3_0_0_model_list.json \
103 --template=tests/api/codegen/templates/tests_template.robot.tmpl \
104 --target_directory=tests/api
105
1065. Go to the directory that contains the test files:
107
108.. code-block:: shell
109
110 cd tests/api/3_0_0
111
1126. Create a folder for the logs and the output files from the tests:
113
114.. code-block:: shell
115
116 mkdir results
117
1187. Run any Robot Framework test file from the ``3_0_0`` directory.
119Each test file corresponds to one of the Aether 3.0.0 models.
120
121.. code-block:: shell
122
123 robot -d results <model-name>.robot
124
125This will generate test reports and logs in the ``results`` directory.
126
127Running the ROC GUI tests
128-------------------------
Elena Stoeva084ee832021-08-04 20:45:03 +0300129
Zack Williams1ae109e2021-07-27 11:17:04 -0700130We test the ROC GUI by installing the ROC on a local Dex server. To install the
131Dex server, please follow the steps under the "Helm install" section of the
132readme file in `this repository
133<https://github.com/onosproject/onos-helm-charts/tree/master/dex-ldap-umbrella>`_.
Elena Stoeva084ee832021-08-04 20:45:03 +0300134
Zack Williams1ae109e2021-07-27 11:17:04 -0700135Once that you have installed the ``dex-ldap-umbrella`` chart, follow the steps
136below to install the ROC on a local Dex server:
137
Sean Condon1df1fcf2021-09-20 09:45:39 +01001381. Deploy the ``aether-roc-umbrella`` chart from the Aether repo with the
Zack Williams1ae109e2021-07-27 11:17:04 -0700139 following command:
Elena Stoeva084ee832021-08-04 20:45:03 +0300140
141.. code-block:: shell
142
Sean Condon1df1fcf2021-09-20 09:45:39 +0100143 helm -n micro-onos install aether-roc-umbrella aether/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
Elena Stoeva084ee832021-08-04 20:45:03 +0300144
1452. Check if all pods are in a Running state:
146
147.. code-block:: shell
148
149 kubectl -n micro-onos get pods
150
151This should print a table like the one below:
152
153.. code-block:: shell
154
155 NAME READY STATUS RESTARTS AGE
156 aether-roc-api-df499d585-srf4c 2/2 Running 0 3m36s
157 aether-roc-gui-799d57456-smx6r 1/1 Running 0 3m36s
158 aether-roc-umbrella-grafana-55cccb986c-t47gz 1/1 Running 0 3m37s
159 aether-roc-umbrella-prometheus-alertmanager-694c449885-rk47g 2/2 Running 0 3m36s
160 aether-roc-umbrella-prometheus-server-59c974f84-97z5t 2/2 Running 0 3m36s
161 aether-roc-umbrella-sdcore-test-dummy-7f4895c59c-cv6j7 1/1 Running 0 3m36s
162 dex-ldap-umbrella-75bbc9d676-wfvcb 1/1 Running 0 8m36s
163 dex-ldap-umbrella-openldap-fc47667c8-9s7q4 1/1 Running 0 8m36s
164 dex-ldap-umbrella-phpldapadmin-b899f9966-rzwkr 1/1 Running 0 8m36s
165 onos-cli-846d9c8df6-kf2xk 1/1 Running 0 3m37s
166 onos-config-5568487f84-dwfs8 5/5 Running 0 3m37s
167 onos-consensus-store-1-0 1/1 Running 0 3m35s
168 onos-topo-56b687f77b-vb2sx 3/3 Running 0 3m36s
169 sdcore-adapter-v3-56667fd848-g7dh2 2/2 Running 0 3m37s
170
171
1723. Once all pods are in a Running state, port-forward to port 8183 to access the ROC GUI:
173
174.. code-block:: shell
175
176 kubectl -n micro-onos port-forward $(kubectl -n micro-onos get pods -l type=arg -o name) 8183:80
177
1783. Port-forward to port 8181 to access the ROC API (which is necessary for some test cases):
179
180.. code-block:: shell
181
182 kubectl -n micro-onos port-forward $(kubectl -n micro-onos get pods -l type=api -o name) 8181
183
Zack Williams1ae109e2021-07-27 11:17:04 -07001843. Finally, port-forward the Dex service to port 5556:
Elena Stoeva084ee832021-08-04 20:45:03 +0300185
186.. code-block:: shell
187
188 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}") &&
189 kubectl -n micro-onos port-forward $DEX_POD_NAME 5556:5556
190
191Now that we have access to the ROC API and GUI, we can proceed with running the ROC GUI tests from the
192``aether-system-tests`` repository:
193
1941. Checkout the aether-system-tests repo:
195
196.. code-block:: shell
197
198 git clone "ssh://$GIT_USER@gerrit.opencord.org:29418/aether-system-tests"
199
2002. Go to the repo directory:
201
202.. code-block:: shell
203
204 cd aether-system-tests
205
2063. Install the requirements and create a virtual environment:
207
208.. code-block:: shell
209
210 make ast-venv
211 source ast-venv/bin/activate
212
2134. Go to the ``roc`` folder and generate the ROC GUI test files:
214
215.. code-block:: shell
216
217 cd roc
218 python tests/gui/codegen/tests_generator.py \
219 --models=variables/3_0_0_model_list.json \
220 --template=tests/gui/codegen/templates/tests_template.robot.tmpl \
221 --target_directory=tests/gui
222
2235. Go to the directory that contains the test files:
224
225.. code-block:: shell
226
227 cd tests/gui/3_0_0
228
2296. Create a folder for the logs and the output files from the tests:
230
231.. code-block:: shell
232
233 mkdir results
234
Zack Williams1ae109e2021-07-27 11:17:04 -07002357. Run any Robot Framework test file from the ``3_0_0`` directory. Each test
236 file corresponds to one of the Aether 3.0.0 models.
Elena Stoeva084ee832021-08-04 20:45:03 +0300237
238.. code-block:: shell
239
240 robot -d results <model-name>.robot
241
Zack Williams1ae109e2021-07-27 11:17:04 -0700242This will generate test reports and logs in the ``results`` directory.