blob: 1648ecd319ec735338c2d32965bf18869cfe7c6c [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
Abhilash Endurthif1e925c2022-03-09 16:26:46 -080018 helm repo add sdran --username USER --password PASSWORD https://charts.aetherproject.org
Elena Stoeva084ee832021-08-04 20:45:03 +030019
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
Abhilash Endurthif1e925c2022-03-09 16:26:46 -0800433. Once all pods are in a Running state, port-forward aether-roc-api to port 8181 with the following command:
Elena Stoeva084ee832021-08-04 20:45:03 +030044
45.. code-block:: shell
46
Abhilash Endurthif1e925c2022-03-09 16:26:46 -080047 kubectl -n micro-onos port-forward service/aether-roc-api 8181 &
Elena Stoeva084ee832021-08-04 20:45:03 +030048
Abhilash Endurthif1e925c2022-03-09 16:26:46 -0800494. Port-forward onos-config to port 5150 with the following command:
Elena Stoeva084ee832021-08-04 20:45:03 +030050
51.. code-block:: shell
52
Abhilash Endurthif1e925c2022-03-09 16:26:46 -080053 kubectl -n micro-onos port-forward service/onos-config 5150 &
Elena Stoeva084ee832021-08-04 20:45:03 +030054
55Now that we have access to the ROC API, we can proceed with running the ROC API tests from the ``aether-system-tests``
56repository:
57
581. Checkout the aether-system-tests repo:
59
60.. code-block:: shell
61
62 git clone "ssh://$GIT_USER@gerrit.opencord.org:29418/aether-system-tests"
63
642. Go to the repo directory:
65
66.. code-block:: shell
67
68 cd aether-system-tests
69
703. Install the requirements and create a virtual environment:
71
72.. code-block:: shell
73
74 make ast-venv
75 source ast-venv/bin/activate
76
774. Go to the ``roc`` folder and generate the ROC API test framework and test files:
78
79.. code-block:: shell
80
81 cd roc
82 python libraries/api/codegen/class_generator.py \
Abhilash Endurthif1e925c2022-03-09 16:26:46 -080083 --models=variables/2_0_0_model_list.json \
Elena Stoeva084ee832021-08-04 20:45:03 +030084 --template=libraries/api/codegen/templates/class_template.py.tmpl \
85 --common_files_directory=libraries/api/codegen/common \
86 --target_directory=libraries/api/
87 python tests/api/codegen/tests_generator.py \
Abhilash Endurthif1e925c2022-03-09 16:26:46 -080088 --models=variables/2_0_0_model_list.json \
Elena Stoeva084ee832021-08-04 20:45:03 +030089 --template=tests/api/codegen/templates/tests_template.robot.tmpl \
90 --target_directory=tests/api
91
925. Go to the directory that contains the test files:
93
94.. code-block:: shell
95
Abhilash Endurthif1e925c2022-03-09 16:26:46 -080096 cd tests/api/2_0_0
Elena Stoeva084ee832021-08-04 20:45:03 +030097
986. Create a folder for the logs and the output files from the tests:
99
100.. code-block:: shell
101
102 mkdir results
103
Abhilash Endurthif1e925c2022-03-09 16:26:46 -08001047. Run any Robot Framework test file from the ``2_0_0`` directory.
105Each test file corresponds to one of the Aether 2.0.0 models.
Elena Stoeva084ee832021-08-04 20:45:03 +0300106
107.. code-block:: shell
108
109 robot -d results <model-name>.robot
110
111This will generate test reports and logs in the ``results`` directory.
112
113Running the ROC GUI tests
114-------------------------
Elena Stoeva084ee832021-08-04 20:45:03 +0300115
Abhilash Endurthif1e925c2022-03-09 16:26:46 -0800116We test the ROC GUI by installing the ROC with keycloak-dev.onlab.us.
117Currently, only v4 GUI automation tests are supported:
Zack Williams1ae109e2021-07-27 11:17:04 -0700118
Sean Condon1df1fcf2021-09-20 09:45:39 +01001191. Deploy the ``aether-roc-umbrella`` chart from the Aether repo with the
Zack Williams1ae109e2021-07-27 11:17:04 -0700120 following command:
Elena Stoeva084ee832021-08-04 20:45:03 +0300121
122.. code-block:: shell
123
Abhilash Endurthif1e925c2022-03-09 16:26:46 -0800124 helm -n micro-onos install aether-roc-umbrella aether/aether-roc-umbrella \
125 --set import.sdcore-adapter.v4.enabled=true \
126 --set import.aether-roc-gui.v4.enabled=true \
127 --set onos-config.openidc.issuer=https://keycloak-dev.onlab.us/auth/realms/master \
128 --set aether-roc-api.openidc.issuer=https://keycloak-dev.onlab.us/auth/realms/master \
129 --set aether-roc-gui-v4.openidc.issuer=https://keycloak-dev.onlab.us/auth/realms/master \
130 --set prom-label-proxy-acc.config.openidc.issuer=https://keycloak-dev.onlab.us/auth/realms/master \
131 --set prom-label-proxy-amp.config.openidc.issuer=https://keycloak-dev.onlab.us/auth/realms/master
132
133Alternatively, v2 GUI can be deployed with the following command:
134
135.. code-block:: shell
136
137 helm -n micro-onos install aether-roc-umbrella aether/aether-roc-umbrella \
138 --set onos-config.openidc.issuer=https://keycloak-dev.onlab.us/auth/realms/master \
139 --set aether-roc-api.openidc.issuer=https://keycloak-dev.onlab.us/auth/realms/master \
140 --set aether-roc-gui-v2.openidc.issuer=https://keycloak-dev.onlab.us/auth/realms/master \
141 --set prom-label-proxy-acc.config.openidc.issuer=https://keycloak-dev.onlab.us/auth/realms/master \
142 --set prom-label-proxy-amp.config.openidc.issuer=https://keycloak-dev.onlab.us/auth/realms/master
Elena Stoeva084ee832021-08-04 20:45:03 +0300143
1442. Check if all pods are in a Running state:
145
146.. code-block:: shell
147
148 kubectl -n micro-onos get pods
149
Elena Stoeva084ee832021-08-04 20:45:03 +03001503. Once all pods are in a Running state, port-forward to port 8183 to access the ROC GUI:
151
152.. code-block:: shell
153
Abhilash Endurthif1e925c2022-03-09 16:26:46 -0800154 kubectl -n micro-onos port-forward service/aether-roc-gui-v4 8183:80 &
Elena Stoeva084ee832021-08-04 20:45:03 +0300155
Abhilash Endurthif1e925c2022-03-09 16:26:46 -08001564. Port-forward to port 8181 to access the ROC API (which is necessary for some test cases):
Elena Stoeva084ee832021-08-04 20:45:03 +0300157
158.. code-block:: shell
159
Abhilash Endurthif1e925c2022-03-09 16:26:46 -0800160 kubectl -n micro-onos port-forward service/aether-roc-api 8181 &
Elena Stoeva084ee832021-08-04 20:45:03 +0300161
162Now that we have access to the ROC API and GUI, we can proceed with running the ROC GUI tests from the
163``aether-system-tests`` repository:
164
1651. Checkout the aether-system-tests repo:
166
167.. code-block:: shell
168
169 git clone "ssh://$GIT_USER@gerrit.opencord.org:29418/aether-system-tests"
170
1712. Go to the repo directory:
172
173.. code-block:: shell
174
175 cd aether-system-tests
176
1773. Install the requirements and create a virtual environment:
178
179.. code-block:: shell
180
181 make ast-venv
182 source ast-venv/bin/activate
183
1844. Go to the ``roc`` folder and generate the ROC GUI test files:
185
186.. code-block:: shell
187
188 cd roc
189 python tests/gui/codegen/tests_generator.py \
Abhilash Endurthif1e925c2022-03-09 16:26:46 -0800190 --models=variables/4_0_0_model_list.json \
Elena Stoeva084ee832021-08-04 20:45:03 +0300191 --template=tests/gui/codegen/templates/tests_template.robot.tmpl \
192 --target_directory=tests/gui
193
1945. Go to the directory that contains the test files:
195
196.. code-block:: shell
197
Abhilash Endurthif1e925c2022-03-09 16:26:46 -0800198 cd tests/gui/4_0_0
Elena Stoeva084ee832021-08-04 20:45:03 +0300199
2006. Create a folder for the logs and the output files from the tests:
201
202.. code-block:: shell
203
204 mkdir results
205
Abhilash Endurthif1e925c2022-03-09 16:26:46 -08002067. Run any Robot Framework test file from the ``4_0_0`` directory. Each test
207 file corresponds to one of the Aether 4.0.0 models.
Elena Stoeva084ee832021-08-04 20:45:03 +0300208
209.. code-block:: shell
210
211 robot -d results <model-name>.robot
212
Zack Williams1ae109e2021-07-27 11:17:04 -0700213This will generate test reports and logs in the ``results`` directory.