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 | |
Abhilash Endurthi | f1e925c | 2022-03-09 16:26:46 -0800 | [diff] [blame] | 18 | helm repo add sdran --username USER --password PASSWORD https://charts.aetherproject.org |
Elena Stoeva | 084ee83 | 2021-08-04 20:45:03 +0300 | [diff] [blame] | 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 | |
Sean Condon | 1df1fcf | 2021-09-20 09:45:39 +0100 | [diff] [blame] | 31 | 1. Deploy the ``aether-roc-umbrella`` chart from the Aether repo with the following command: |
Elena Stoeva | 084ee83 | 2021-08-04 20:45:03 +0300 | [diff] [blame] | 32 | |
| 33 | .. code-block:: shell |
| 34 | |
Sean Condon | 1df1fcf | 2021-09-20 09:45:39 +0100 | [diff] [blame] | 35 | helm -n micro-onos install aether-roc-umbrella aether/aether-roc-umbrella |
Elena Stoeva | 084ee83 | 2021-08-04 20:45:03 +0300 | [diff] [blame] | 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 | |
Abhilash Endurthi | f1e925c | 2022-03-09 16:26:46 -0800 | [diff] [blame] | 43 | 3. Once all pods are in a Running state, port-forward aether-roc-api to port 8181 with the following command: |
Elena Stoeva | 084ee83 | 2021-08-04 20:45:03 +0300 | [diff] [blame] | 44 | |
| 45 | .. code-block:: shell |
| 46 | |
Abhilash Endurthi | f1e925c | 2022-03-09 16:26:46 -0800 | [diff] [blame] | 47 | kubectl -n micro-onos port-forward service/aether-roc-api 8181 & |
Elena Stoeva | 084ee83 | 2021-08-04 20:45:03 +0300 | [diff] [blame] | 48 | |
Abhilash Endurthi | f1e925c | 2022-03-09 16:26:46 -0800 | [diff] [blame] | 49 | 4. Port-forward onos-config to port 5150 with the following command: |
Elena Stoeva | 084ee83 | 2021-08-04 20:45:03 +0300 | [diff] [blame] | 50 | |
| 51 | .. code-block:: shell |
| 52 | |
Abhilash Endurthi | f1e925c | 2022-03-09 16:26:46 -0800 | [diff] [blame] | 53 | kubectl -n micro-onos port-forward service/onos-config 5150 & |
Elena Stoeva | 084ee83 | 2021-08-04 20:45:03 +0300 | [diff] [blame] | 54 | |
| 55 | Now that we have access to the ROC API, we can proceed with running the ROC API tests from the ``aether-system-tests`` |
| 56 | repository: |
| 57 | |
| 58 | 1. 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 | |
| 64 | 2. Go to the repo directory: |
| 65 | |
| 66 | .. code-block:: shell |
| 67 | |
| 68 | cd aether-system-tests |
| 69 | |
| 70 | 3. 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 | |
| 77 | 4. 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 Endurthi | f1e925c | 2022-03-09 16:26:46 -0800 | [diff] [blame] | 83 | --models=variables/2_0_0_model_list.json \ |
Elena Stoeva | 084ee83 | 2021-08-04 20:45:03 +0300 | [diff] [blame] | 84 | --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 Endurthi | f1e925c | 2022-03-09 16:26:46 -0800 | [diff] [blame] | 88 | --models=variables/2_0_0_model_list.json \ |
Elena Stoeva | 084ee83 | 2021-08-04 20:45:03 +0300 | [diff] [blame] | 89 | --template=tests/api/codegen/templates/tests_template.robot.tmpl \ |
| 90 | --target_directory=tests/api |
| 91 | |
| 92 | 5. Go to the directory that contains the test files: |
| 93 | |
| 94 | .. code-block:: shell |
| 95 | |
Abhilash Endurthi | f1e925c | 2022-03-09 16:26:46 -0800 | [diff] [blame] | 96 | cd tests/api/2_0_0 |
Elena Stoeva | 084ee83 | 2021-08-04 20:45:03 +0300 | [diff] [blame] | 97 | |
| 98 | 6. Create a folder for the logs and the output files from the tests: |
| 99 | |
| 100 | .. code-block:: shell |
| 101 | |
| 102 | mkdir results |
| 103 | |
Abhilash Endurthi | f1e925c | 2022-03-09 16:26:46 -0800 | [diff] [blame] | 104 | 7. Run any Robot Framework test file from the ``2_0_0`` directory. |
| 105 | Each test file corresponds to one of the Aether 2.0.0 models. |
Elena Stoeva | 084ee83 | 2021-08-04 20:45:03 +0300 | [diff] [blame] | 106 | |
| 107 | .. code-block:: shell |
| 108 | |
| 109 | robot -d results <model-name>.robot |
| 110 | |
| 111 | This will generate test reports and logs in the ``results`` directory. |
| 112 | |
| 113 | Running the ROC GUI tests |
| 114 | ------------------------- |
Elena Stoeva | 084ee83 | 2021-08-04 20:45:03 +0300 | [diff] [blame] | 115 | |
Abhilash Endurthi | f1e925c | 2022-03-09 16:26:46 -0800 | [diff] [blame] | 116 | We test the ROC GUI by installing the ROC with keycloak-dev.onlab.us. |
| 117 | Currently, only v4 GUI automation tests are supported: |
Zack Williams | 1ae109e | 2021-07-27 11:17:04 -0700 | [diff] [blame] | 118 | |
Sean Condon | 1df1fcf | 2021-09-20 09:45:39 +0100 | [diff] [blame] | 119 | 1. Deploy the ``aether-roc-umbrella`` chart from the Aether repo with the |
Zack Williams | 1ae109e | 2021-07-27 11:17:04 -0700 | [diff] [blame] | 120 | following command: |
Elena Stoeva | 084ee83 | 2021-08-04 20:45:03 +0300 | [diff] [blame] | 121 | |
| 122 | .. code-block:: shell |
| 123 | |
Abhilash Endurthi | f1e925c | 2022-03-09 16:26:46 -0800 | [diff] [blame] | 124 | 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 | |
| 133 | Alternatively, 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 Stoeva | 084ee83 | 2021-08-04 20:45:03 +0300 | [diff] [blame] | 143 | |
| 144 | 2. Check if all pods are in a Running state: |
| 145 | |
| 146 | .. code-block:: shell |
| 147 | |
| 148 | kubectl -n micro-onos get pods |
| 149 | |
Elena Stoeva | 084ee83 | 2021-08-04 20:45:03 +0300 | [diff] [blame] | 150 | 3. 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 Endurthi | f1e925c | 2022-03-09 16:26:46 -0800 | [diff] [blame] | 154 | kubectl -n micro-onos port-forward service/aether-roc-gui-v4 8183:80 & |
Elena Stoeva | 084ee83 | 2021-08-04 20:45:03 +0300 | [diff] [blame] | 155 | |
Abhilash Endurthi | f1e925c | 2022-03-09 16:26:46 -0800 | [diff] [blame] | 156 | 4. Port-forward to port 8181 to access the ROC API (which is necessary for some test cases): |
Elena Stoeva | 084ee83 | 2021-08-04 20:45:03 +0300 | [diff] [blame] | 157 | |
| 158 | .. code-block:: shell |
| 159 | |
Abhilash Endurthi | f1e925c | 2022-03-09 16:26:46 -0800 | [diff] [blame] | 160 | kubectl -n micro-onos port-forward service/aether-roc-api 8181 & |
Elena Stoeva | 084ee83 | 2021-08-04 20:45:03 +0300 | [diff] [blame] | 161 | |
| 162 | Now 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 | |
| 165 | 1. 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 | |
| 171 | 2. Go to the repo directory: |
| 172 | |
| 173 | .. code-block:: shell |
| 174 | |
| 175 | cd aether-system-tests |
| 176 | |
| 177 | 3. 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 | |
| 184 | 4. 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 Endurthi | f1e925c | 2022-03-09 16:26:46 -0800 | [diff] [blame] | 190 | --models=variables/4_0_0_model_list.json \ |
Elena Stoeva | 084ee83 | 2021-08-04 20:45:03 +0300 | [diff] [blame] | 191 | --template=tests/gui/codegen/templates/tests_template.robot.tmpl \ |
| 192 | --target_directory=tests/gui |
| 193 | |
| 194 | 5. Go to the directory that contains the test files: |
| 195 | |
| 196 | .. code-block:: shell |
| 197 | |
Abhilash Endurthi | f1e925c | 2022-03-09 16:26:46 -0800 | [diff] [blame] | 198 | cd tests/gui/4_0_0 |
Elena Stoeva | 084ee83 | 2021-08-04 20:45:03 +0300 | [diff] [blame] | 199 | |
| 200 | 6. Create a folder for the logs and the output files from the tests: |
| 201 | |
| 202 | .. code-block:: shell |
| 203 | |
| 204 | mkdir results |
| 205 | |
Abhilash Endurthi | f1e925c | 2022-03-09 16:26:46 -0800 | [diff] [blame] | 206 | 7. 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 Stoeva | 084ee83 | 2021-08-04 20:45:03 +0300 | [diff] [blame] | 208 | |
| 209 | .. code-block:: shell |
| 210 | |
| 211 | robot -d results <model-name>.robot |
| 212 | |
Zack Williams | 1ae109e | 2021-07-27 11:17:04 -0700 | [diff] [blame] | 213 | This will generate test reports and logs in the ``results`` directory. |