ajay | f66b38e | 2021-12-09 23:44:54 -0800 | [diff] [blame] | 1 | .. |
| 2 | SPDX-FileCopyrightText: © 2021 Open Networking Foundation <support@opennetworking.org> |
| 3 | SPDX-License-Identifier: Apache-2.0 |
| 4 | |
ajay | ce0380c | 2021-12-14 21:51:00 -0800 | [diff] [blame] | 5 | .. _sdcore-testing: |
| 6 | |
| 7 | Test frameworks and coverage |
| 8 | ============================ |
ajay | f66b38e | 2021-12-09 23:44:54 -0800 | [diff] [blame] | 9 | |
| 10 | Test Framework |
| 11 | -------------- |
| 12 | |
| 13 | NG40 |
| 14 | """" |
| 15 | |
| 16 | NG40 tool is used as RAN emulator in SD-Core testing. NG40 runs inside a VM |
| 17 | which is connected to both Aether control plane and data plane. In testing |
| 18 | scenarios that involve data plane verification, NG40 also emulates a few |
| 19 | application servers which serve as the destinations of data packets. |
| 20 | |
| 21 | A typical NG40 test case involves UE attaching, data plane verification and |
| 22 | UE detaching. During the test NG40 acts as UEs and eNBs and talks to the |
| 23 | mobile core to complete attach procedures for each UE it emulates. Then NG40 |
| 24 | verifies that data plane works for each attached UE by sending traffic between |
| 25 | UEs and application servers. Before finishing each test NG40 performs detach |
| 26 | procedures for each attached UE. |
| 27 | |
| 28 | Test cases |
| 29 | '''''''''' |
| 30 | |
| 31 | Currently the following NG40 test cases are implemented: |
| 32 | |
| 33 | 4G Tests: |
| 34 | |
| 35 | 1. ``4G_M2AS_PING_FIX`` (attach, dl ping, detach) |
| 36 | 2. ``4G_M2AS_UDP`` (attach, dl+ul udp traffic, detach) |
| 37 | 3. ``4G_M2AS_TCP`` (attach, release, service request, dl+ul tcp traffic, detach) |
| 38 | 4. ``4G_AS2M_PAGING`` (attach, release, dl udp traffic, detach) |
| 39 | 5. ``4G_M2AS_SRQ_UDP`` (attach, release, service request, dl+ul udp traffic) |
| 40 | 6. ``4G_M2CN_PS`` (combined IMSI/PTMSI attach, detach) |
| 41 | 7. ``4G_HO`` (attach, relocate and dl ping, detach) |
| 42 | 8. ``4G_SCALE`` (attach, dl ping, detach with multiple UEs) |
| 43 | |
| 44 | 5G Tests: |
| 45 | |
| 46 | 1. ``5G_SA_Register_Deregister`` (registration, deregistration) |
| 47 | 2. ``5G_SA_Register`` (registration, session establishment, deregistration) |
| 48 | 3. ``5G_SA_Release`` (registration, session establishment, dl ping, release, deregistration) |
| 49 | 4. ``5G_SA_Activate_Release`` (registration, session establishment, dl ping, release, service request, |
| 50 | dl ping, deregistration) |
| 51 | 5. ``5G_SA_Scale`` (registration, session establishment, dl ping, deregistration for multiple UEs) |
| 52 | 6. ``5G_SA_M2AS_ICMP`` (registration, session establishment, dl ping, deregistration) |
| 53 | 7. ``5G_SA_M2AS_TCP`` (registration, session establishment, dl+ul tcp traffic, deregistration) |
| 54 | 8. ``5G_SA_M2AS_UDP`` (registration, session establishment, dl+ul udp traffic, deregistration) |
| 55 | |
| 56 | All the test cases are parameterized and can take arguments to specify number |
| 57 | of UEs, attach/detach rate, traffic type/rate etc. For example, ``4G_SCALE`` |
| 58 | test case can be configured as a mini scalability test which performs only 5 |
| 59 | UE attaches in a patchset pre-merge test, while in the nightly tests it can |
| 60 | take different arguments to run 10K UE attaches with a high attach rate. |
| 61 | |
| 62 | Test suites |
| 63 | ''''''''''' |
| 64 | |
| 65 | The test cases are atomic testing units and can be combined to build test |
| 66 | suites. The following test suites have been built so far: |
| 67 | |
| 68 | 1. ``functionality test suite`` verifies basic functionality of the |
| 69 | mobile core. 4G functionality suite runs 4G test case #1 to #8 including |
| 70 | ``4G_SCALE`` which attaches 5 UEs with 1/s attach rate. 5G functionality |
| 71 | suite runs 5G test case #1 to #8 including ``5G_SA_Scale`` which attaches |
| 72 | 100 UEs with 1/s attach rate. |
| 73 | 2. ``scalability test suite`` tests the system by scale and verifies |
| 74 | system stability. It runs ``4G_SCALE`` (or ``5G_SA_Scale``) which attaches |
| 75 | a large number of UEs with high attach rate (16k UEs with 100/s rate on 4G |
| 76 | CI pod, 1k UEs with 10/s rate on 4G staging pod, and 1k UEs with 1/s rate |
| 77 | on 5G CI pod). |
| 78 | 3. ``performance test suite`` measures performance of the control and |
| 79 | data plane. It runs ``4G_SCALE`` multiple times with different attach rates |
| 80 | to understand how the system performs under different loads. |
| 81 | |
| 82 | Robot Framework |
| 83 | """"""""""""""" |
| 84 | |
| 85 | Robot Framework was chosen to build test cases that involve interacting with |
| 86 | not only NG40 but also other parts of the system. In these scenarios Robot |
| 87 | Framework acts as a high level orchestrator which drives various components |
| 88 | of the system using component specific libraries including NG40. |
| 89 | |
| 90 | Currently the ``Integration test suite`` is implemented using Robot |
| 91 | Framework. In the integration tests Robot Framework calls the ng40 library to |
| 92 | perform normal attach/detach procedures. Meanwhile it injects failures into |
| 93 | the system (container restarts, link down etc.) by calling functions |
| 94 | implemented in the k8s library. |
| 95 | |
| 96 | The following integration tests are implemented at the moment: |
| 97 | |
| 98 | 1. Subscriber Attach with HSS Restart |
| 99 | 2. Subscriber Attach with MME Restart |
| 100 | 3. Subscriber Attach with SPGWC Restart |
| 101 | 4. Subscriber Attach with PFCP Agent Restart |
| 102 | |
| 103 | .. Note:: |
| 104 | More integration tests are being developed as part of Robot Framework |
| 105 | |
| 106 | Test Schedules |
| 107 | -------------- |
| 108 | |
| 109 | Nightly Tests |
| 110 | """"""""""""" |
| 111 | |
| 112 | SD-Core nightly tests are a set of jobs managed by Aether Jenkins. |
| 113 | All four test suites we mentioned above are scheduled to run nightly. |
| 114 | |
| 115 | 1. ``functionality job (func)`` runs NG40 test cases included in the |
| 116 | functionality suite and verifies all tests pass. |
| 117 | 2. ``scalability job (scale)`` runs the scalability test suite and reports |
| 118 | the number of successful/failed attaches, detaches and pings. |
| 119 | 3. ``performance job (perf)`` runs the performance test suite and reports |
| 120 | SCTP heartbeat RTT, GTP ICMP RTT and call setup latency numbers. |
| 121 | |
| 122 | And all these jobs can be scheduled on any of the Aether PODs including |
| 123 | ``ci-4g`` pod, ``ci-5g`` pod, ``staging`` pod and ``qa`` pod. By combining |
| 124 | the test type and test pod the following Jenkins jobs are generated: |
| 125 | |
| 126 | 1. ``ci-4g`` pod: `sdcore_func_ci-4g`, `sdcore_scale_ci-4g`, `sdcore_perf_ci-4g`, `sdcore_integ_ci-4g` |
| 127 | 1. ``ci-5g`` pod: `sdcore_func_ci-5g`, `sdcore_scale_ci-5g` |
| 128 | 2. ``staging`` pod: `func_staging`, `scale_staging`, `perf_staging`, `integ_staging` |
| 129 | 3. ``qa`` pod: `func_qa`, `scale_qa`, `perf_qa`, `integ_qa` |
| 130 | |
| 131 | Nightly Job structure |
| 132 | """"""""""""""""""""" |
| 133 | |
| 134 | Take `sdcore_scale_ci-4g` job as an example. It runs the following downstream jobs: |
| 135 | |
| 136 | 1. `omec_deploy_ci-4g`: this job re-deploys the ``ci-4g`` pod with latest OMEC images. |
| 137 | |
| 138 | .. Note:: |
| 139 | only the ``ci-4g`` and ``ci-5g`` pod jobs trigger deployment downstream job. No |
| 140 | re-deployment is performed on the staging and qa pod before the tests |
| 141 | |
| 142 | 2. `ng40-test_ci-4g`: this job executes the scalability test suite. |
| 143 | 3. `archive-artifacts_ci-4g`: this job collects and uploads k8s and container logs. |
| 144 | 4. `post-results_ci-4g`: this job collects the NG40 test logs/pcaps and pushes the |
| 145 | test data to database. It also generates plots using Rscript for func and |
| 146 | scale tests |
| 147 | |
| 148 | The integration tests are written using Robot Framework so have a slightly |
| 149 | different Jenkins Job structure. Take `sdcore_integ_ci-4g` as an example. It runs the |
| 150 | following downstream jobs: |
| 151 | |
| 152 | 1. `omec_deploy_ci-4g`: this job executes the scalability test suite. |
| 153 | 2. `robotframework-test_ci-4g`: this job is similar to `ng40-test_ci-4g` with the |
| 154 | exception that instead of directly executing NG40 commands it calls robot |
| 155 | framework to execute the test cases and publishes the test results using |
| 156 | `RobotPublisher` Jenkins plugin. The robot results will also be copied to |
| 157 | the upstream job and published there. |
| 158 | 3. `archive-artifacts_ci-4g`: this job collects and uploads k8s and container logs. |
| 159 | 4. `post-results_ci-4g`: this job collects the NG40 test logs/pcaps and pushes the |
| 160 | test data to database. It also generates plots using Rscript for func and |
| 161 | scale tests |
| 162 | |
| 163 | Patchset Tests |
| 164 | -------------- |
| 165 | |
| 166 | SD-Core pre-merge verification covers the following public Github repos: ``c3po``, |
| 167 | ``Nucleus``, ``upf-epc`` and the following private Github repos: ``spgw``. ``amf``, |
| 168 | ``smf``, ``ausf``, ``nssf``, ``nrf``, ``pcf``, ``udm``, ``udr``, ``webconsole``. |
| 169 | SD-Core CI verifies the following: |
| 170 | |
| 171 | 1. ONF CLA verification |
| 172 | 2. License verification (FOSSA/Reuse) |
| 173 | 3. NG40 tests |
| 174 | |
| 175 | These jobs are automatically triggered by submitted or updated PR to the repos |
| 176 | above. They can also be triggered manually by commenting ``retest this please`` |
| 177 | to the PR. At this moment only CLI and NG40 verification are mandatory. |
| 178 | |
| 179 | The NG40 verification are a set of jobs running on both opencord Jenkins and |
| 180 | Aether Jenkins (private). The jobs run on opencord Jenkins include |
| 181 | |
| 182 | 1. `omec_c3po_container_remote <https://jenkins.opencord.org/job/omec_c3po_container_remote/>`_ (public) |
| 183 | 2. `omec_Nucleus_container_remote <https://jenkins.opencord.org/job/omec_Nucleus_container_remote/>`_ (public) |
| 184 | 3. `omec_upf-epc_container_remote <https://jenkins.opencord.org/job/omec_upf-epc_container_remote/>`_ (public) |
| 185 | 4. `omec_spgw_container_remote` (private, under member-only folder) |
| 186 | |
| 187 | And the jobs run on Aether Jenkins include |
| 188 | |
| 189 | 1. `c3po_premerge_ci-4g` |
| 190 | 2. `Nucleus_premerge_ci-4g` |
| 191 | 3. `upf-epc_premerge_ci-4g` |
| 192 | 4. `spgw_premerge_ci-4g` |
| 193 | 5. `amf_premerge_ci-5g` |
| 194 | 6. `smf_premerge_ci-5g` |
| 195 | 7. `ausf_premerge_ci-5g` |
| 196 | 8. `nssf_premerge_ci-5g` |
| 197 | 9. `nrf_premerge_ci-5g` |
| 198 | 10. `pcf_premerge_ci-5g` |
| 199 | 11. `udm_premerge_ci-5g` |
| 200 | 12. `udr_premerge_ci-5g` |
| 201 | 13. `webconsole_premerge_ci-5g` |
| 202 | |
| 203 | Patchset Job structure |
| 204 | """""""""""""""""""""" |
| 205 | |
| 206 | Take ``c3po`` jobs as an example. ``c3po`` PR triggers a public job |
| 207 | `omec_c3po_container_remote |
| 208 | <https://jenkins.opencord.org/job/omec_c3po_container_remote/>`_ job running |
| 209 | on opencord Jenkins through Github webhooks, which then triggers a private job |
| 210 | `c3po_premerge_ci-4g` running on Aether Jenkins using a Jenkins plugin called |
| 211 | `Parameterized Remote Trigger Plugin |
| 212 | <https://www.jenkins.io/doc/pipeline/steps/Parameterized-Remote-Trigger/>`_. |
| 213 | |
| 214 | The private ``c3po`` job runs the following downstream jobs sequentially: |
| 215 | |
| 216 | 1. `docker-publish-github_c3po`: this job downloads the ``c3po`` PR, runs docker |
| 217 | build and publishes the ``c3po`` docker images to `Aether registry`. |
| 218 | 2. `omec_deploy_ci-4g`: this job deploys the images built from previous job onto |
| 219 | the omec ``ci-4g`` pod. |
| 220 | 3. `ng40-test_ci-4g`: this job executes the functionality test suite. |
| 221 | 4. `archive-artifacts_ci-4g`: this job collects and uploads k8s and container logs. |
| 222 | |
| 223 | After all the downstream jobs are finished, the upstream job (`c3po_premerge_ci-4g`) |
| 224 | copies artifacts including k8s/container/ng40 logs and pcap files from |
| 225 | downstream jobs and saves them as Jenkins job artifacts. |
| 226 | |
| 227 | These artifacts are also copied to and published by the public job |
| 228 | (`omec_c3po_container_remote <https://jenkins.opencord.org/job/omec_c3po_container_remote/>`_) |
| 229 | on opencord Jenkins so that they can be accessed by the OMEC community. |
| 230 | |
| 231 | Pre-merge jobs for other SD-Core repos share the same structure. |
| 232 | |
| 233 | Post-merge |
| 234 | """""""""" |
| 235 | |
| 236 | The following jobs are triggered as post-merge jobs when PRs are merged to |
| 237 | SD-Core repos: |
| 238 | |
| 239 | 1. `docker-publish-github-merge_c3po` |
| 240 | 2. `docker-publish-github-merge_Nucleus` |
| 241 | 3. `docker-publish-github-merge_upf-epc` |
| 242 | 4. `docker-publish-github-merge_spgw` |
| 243 | 5. `docker-publish-github-merge_amf` |
| 244 | 6. `docker-publish-github-merge_smf` |
| 245 | 7. `docker-publish-github-merge_ausf` |
| 246 | 8. `docker-publish-github-merge_nssf` |
| 247 | 9. `docker-publish-github-merge_nrf` |
| 248 | 10. `docker-publish-github-merge_pcf` |
| 249 | 11. `docker-publish-github-merge_udm` |
| 250 | 12. `docker-publish-github-merge_udr` |
| 251 | 13. `docker-publish-github-merge_webconsole` |
| 252 | |
| 253 | Again take the ``c3po`` job as an example. The post-merge job (`docker-publish-github-merge_c3po`) |
| 254 | runs the following downstream jobs sequentially: |
| 255 | |
| 256 | 1. `docker-publish-github_c3po`: this is the same job as the one in pre-merge |
| 257 | section. It checks out the latest ``c3po`` code, runs docker build and |
| 258 | publishes the ``c3po`` docker images to `docker hub <https://hub.docker.com/u/omecproject>`__. |
| 259 | |
| 260 | .. Note:: |
| 261 | the images for private repos are published to Aether registry instead of docker hub |
| 262 | |
| 263 | 2. `c3po_postrelease`: this job submits a patchset to aether-pod-configs repo |
| 264 | for updating the CD pipeline with images published in the job above. |
| 265 | |
| 266 | Post-merge jobs for other SD-Core repos share the same structure. |