Zack Williams | 1ae109e | 2021-07-27 11:17:04 -0700 | [diff] [blame] | 1 | ROC Testing |
| 2 | =========== |
Elena Stoeva | 084ee83 | 2021-08-04 20:45:03 +0300 | [diff] [blame] | 3 | |
| 4 | The REST API and the GUI of the Aether ROC is tested utilizing the Robot Framework. |
| 5 | The tests are located inside the aether-system-tests repository and they are run nightly using |
| 6 | a Jenkins job. |
| 7 | |
| 8 | Development Prerequisites |
| 9 | ------------------------- |
| 10 | To access the ROC from a local system, it is necessary to deploy the components of ยตONOS. |
| 11 | This 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 Williams | 1ae109e | 2021-07-27 11:17:04 -0700 | [diff] [blame] | 14 | Additionally, it is necessary to add the SD-RAN chart repo with the following command: |
Elena Stoeva | 084ee83 | 2021-08-04 20:45:03 +0300 | [diff] [blame] | 15 | |
| 16 | .. code-block:: shell |
| 17 | |
| 18 | helm repo add sdran --username USER --password PASSWORD https://sdrancharts.onosproject.org |
| 19 | |
Zack Williams | 1ae109e | 2021-07-27 11:17:04 -0700 | [diff] [blame] | 20 | where USER and PASSWORD can be obtained from the Aether Login Information file, |
| 21 | which is accessible to the ``onfstaff`` group. |
Elena Stoeva | 084ee83 | 2021-08-04 20:45:03 +0300 | [diff] [blame] | 22 | |
Zack Williams | 1ae109e | 2021-07-27 11:17:04 -0700 | [diff] [blame] | 23 | Finally, the ROC GUI tests are running on the Firefox browser, so it is |
| 24 | necessary to have the Firefox browser and the Firefox web driver |
| 25 | (``geckodriver``) installed on the system in order to run these tests. |
Elena Stoeva | 084ee83 | 2021-08-04 20:45:03 +0300 | [diff] [blame] | 26 | |
| 27 | Running the ROC API tests |
| 28 | ------------------------- |
| 29 | Follow the steps below to access the ROC API: |
| 30 | |
Zack Williams | 1ae109e | 2021-07-27 11:17:04 -0700 | [diff] [blame] | 31 | 1. Deploy the ``aether-roc-umbrella`` chart from the SD-RAN repo with the following command: |
Elena Stoeva | 084ee83 | 2021-08-04 20:45:03 +0300 | [diff] [blame] | 32 | |
| 33 | .. code-block:: shell |
| 34 | |
| 35 | helm -n micro-onos install aether-roc-umbrella sdran/aether-roc-umbrella |
| 36 | |
| 37 | 2. Check if all pods are in a Running state: |
| 38 | |
| 39 | .. code-block:: shell |
| 40 | |
| 41 | kubectl -n micro-onos get pods |
| 42 | |
| 43 | This 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 | |
| 62 | 3. 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 | |
| 69 | Now that we have access to the ROC API, we can proceed with running the ROC API tests from the ``aether-system-tests`` |
| 70 | repository: |
| 71 | |
| 72 | 1. 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 | |
| 78 | 2. Go to the repo directory: |
| 79 | |
| 80 | .. code-block:: shell |
| 81 | |
| 82 | cd aether-system-tests |
| 83 | |
| 84 | 3. 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 | |
| 91 | 4. 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 | |
| 106 | 5. Go to the directory that contains the test files: |
| 107 | |
| 108 | .. code-block:: shell |
| 109 | |
| 110 | cd tests/api/3_0_0 |
| 111 | |
| 112 | 6. Create a folder for the logs and the output files from the tests: |
| 113 | |
| 114 | .. code-block:: shell |
| 115 | |
| 116 | mkdir results |
| 117 | |
| 118 | 7. Run any Robot Framework test file from the ``3_0_0`` directory. |
| 119 | Each 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 | |
| 125 | This will generate test reports and logs in the ``results`` directory. |
| 126 | |
| 127 | Running the ROC GUI tests |
| 128 | ------------------------- |
Elena Stoeva | 084ee83 | 2021-08-04 20:45:03 +0300 | [diff] [blame] | 129 | |
Zack Williams | 1ae109e | 2021-07-27 11:17:04 -0700 | [diff] [blame] | 130 | We test the ROC GUI by installing the ROC on a local Dex server. To install the |
| 131 | Dex server, please follow the steps under the "Helm install" section of the |
| 132 | readme file in `this repository |
| 133 | <https://github.com/onosproject/onos-helm-charts/tree/master/dex-ldap-umbrella>`_. |
Elena Stoeva | 084ee83 | 2021-08-04 20:45:03 +0300 | [diff] [blame] | 134 | |
Zack Williams | 1ae109e | 2021-07-27 11:17:04 -0700 | [diff] [blame] | 135 | Once that you have installed the ``dex-ldap-umbrella`` chart, follow the steps |
| 136 | below to install the ROC on a local Dex server: |
| 137 | |
| 138 | 1. Deploy the ``aether-roc-umbrella`` chart from the SD-RAN repo with the |
| 139 | following command: |
Elena Stoeva | 084ee83 | 2021-08-04 20:45:03 +0300 | [diff] [blame] | 140 | |
| 141 | .. code-block:: shell |
| 142 | |
| 143 | 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 |
| 144 | |
| 145 | 2. Check if all pods are in a Running state: |
| 146 | |
| 147 | .. code-block:: shell |
| 148 | |
| 149 | kubectl -n micro-onos get pods |
| 150 | |
| 151 | This 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 | |
| 172 | 3. 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 | |
| 178 | 3. 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 Williams | 1ae109e | 2021-07-27 11:17:04 -0700 | [diff] [blame] | 184 | 3. Finally, port-forward the Dex service to port 5556: |
Elena Stoeva | 084ee83 | 2021-08-04 20:45:03 +0300 | [diff] [blame] | 185 | |
| 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 | |
| 191 | Now 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 | |
| 194 | 1. 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 | |
| 200 | 2. Go to the repo directory: |
| 201 | |
| 202 | .. code-block:: shell |
| 203 | |
| 204 | cd aether-system-tests |
| 205 | |
| 206 | 3. 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 | |
| 213 | 4. 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 | |
| 223 | 5. Go to the directory that contains the test files: |
| 224 | |
| 225 | .. code-block:: shell |
| 226 | |
| 227 | cd tests/gui/3_0_0 |
| 228 | |
| 229 | 6. Create a folder for the logs and the output files from the tests: |
| 230 | |
| 231 | .. code-block:: shell |
| 232 | |
| 233 | mkdir results |
| 234 | |
Zack Williams | 1ae109e | 2021-07-27 11:17:04 -0700 | [diff] [blame] | 235 | 7. 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 Stoeva | 084ee83 | 2021-08-04 20:45:03 +0300 | [diff] [blame] | 237 | |
| 238 | .. code-block:: shell |
| 239 | |
| 240 | robot -d results <model-name>.robot |
| 241 | |
Zack Williams | 1ae109e | 2021-07-27 11:17:04 -0700 | [diff] [blame] | 242 | This will generate test reports and logs in the ``results`` directory. |