blob: 6399566b3fb6ab49e4d25bcac57282eec575713e [file] [log] [blame]
Andy Bavierf73c3d22021-08-30 10:29:06 -07001.. vim: syntax=rst
2
Andy Bavierf3e24b62022-03-30 19:53:01 -04003Aether-in-a-Box for Developers
4==============================
Andy Bavierf73c3d22021-08-30 10:29:06 -07005
Andy Bavier840e0b42021-09-16 17:10:23 -07006Aether-in-a-Box (AiaB) provides an easy way to deploy Aether's SD-CORE and ROC
7components, and then run basic tests to validate the installation.
8This guide describes the steps to set up AiaB.
Andy Bavierf73c3d22021-08-30 10:29:06 -07009
Andy Bavier840e0b42021-09-16 17:10:23 -070010AiaB can be set up with a 4G or 5G SD-CORE. In either case, SD-CORE configuration
11can be done with or without the ROC. The ROC
12provides an interactive GUI for examining and changing the configuration, and is used to
13manage the production Aether; it can be deployed to test the integration between
14ROC and SD-CORE. If the ROC is not deployed, a simple tool called SimApp
15is used to configure the required state in SD-CORE for testing core functionality.
16
17Helm charts are the primary method of installing the SD-CORE and ROC resources.
18AiaB offers a great deal of flexibility regarding which Helm chart versions to install:
19
20* Local definitions of charts (for testing Helm chart changes)
21* Latest published charts (for deploying a development version of Aether)
22* Specified versions of charts (for deploying a specific Aether release)
23
24AiaB can be run on a bare metal machine or VM. System prerequisites:
Andy Bavierf73c3d22021-08-30 10:29:06 -070025
Andy Bavier296bfa52022-02-10 17:48:37 -070026* Ubuntu 18.04 clean install
Andy Bavierf73c3d22021-08-30 10:29:06 -070027* Kernel 4.15 or later
28* Haswell CPU or newer
Andy Bavier72547672022-02-03 14:45:16 -070029* At least 4 CPUs and 12GB RAM
Andy Bavier296bfa52022-02-10 17:48:37 -070030* Ability to run "sudo" without a password. Due to this requirement, AiaB is most suited to disposable environments like a VM or a `CloudLab <https://cloudlab.us>`_ machine.
Andy Bavierf73c3d22021-08-30 10:29:06 -070031
32Clone Repositories
33------------------
34
Andy Bavier296bfa52022-02-10 17:48:37 -070035To initialize the AiaB environment, first clone the following repository::
Andy Bavierf73c3d22021-08-30 10:29:06 -070036
Andy Bavier840e0b42021-09-16 17:10:23 -070037 cd ~
Hyunsun Moon09d63bb2022-03-16 09:45:55 -070038 git clone "https://gerrit.opencord.org/aether-in-a-box"
Andy Bavier840e0b42021-09-16 17:10:23 -070039
40If you are going to install AiaB using published Helm charts, you can proceed to the
41next section.
42
Andy Bavier99892132022-03-11 14:49:10 -070043If you wish to install from local Helm charts, clone these additional repositories::
Andy Bavier840e0b42021-09-16 17:10:23 -070044
45 mkdir -p ~/cord
46 cd ~/cord
Hyunsun Moon09d63bb2022-03-16 09:45:55 -070047 git clone "https://gerrit.opencord.org/sdcore-helm-charts"
48 git clone "https://gerrit.opencord.org/roc-helm-charts"
Andy Bavier840e0b42021-09-16 17:10:23 -070049
50Now change to *~/aether-in-a-box* directory.
Andy Bavierf73c3d22021-08-30 10:29:06 -070051
Andy Bavier62678402022-04-18 12:06:52 -070052RKE2 vs. Kubespray Install
53--------------------------
54
55The AiaB installer will bring up Kubernetes on the server where it is run. By default it
56uses `RKE2 <https://docs.rke2.io>`_ as the Kubernetes platform. However, older versions of AiaB
57used `Kubespray <https://kubernetes.io/docs/setup/production-environment/tools/kubespray/>`_
58and that is still an option. To switch to Kubespray as the Kubernetes platform, edit the
59Makefile and replace *rke2* with *kubespray* on this line::
60
61 K8S_INSTALL := rke2
62
Andy Bavier840e0b42021-09-16 17:10:23 -070063Installing the ROC
64------------------
Andy Bavierf73c3d22021-08-30 10:29:06 -070065
Andy Bavier840e0b42021-09-16 17:10:23 -070066Note that you must install the ROC *before* installing SD-CORE.
67If you are not using the ROC to configure SD-CORE, you can skip this step.
Andy Bavierf73c3d22021-08-30 10:29:06 -070068
Andy Bavier840e0b42021-09-16 17:10:23 -070069First choose whether you will install the 4G or 5G SD-CORE. To install the ROC to
70configure the 4G SD-CORE::
Andy Bavierf73c3d22021-08-30 10:29:06 -070071
Andy Bavier840e0b42021-09-16 17:10:23 -070072 make roc-4g-models
73
74To install the ROC to configure the 5G SD-CORE::
75
76 make roc-5g-models
77
78By default the above commands install the ROC from the local charts in the Git repos cloned
79earlier. In order to install the ROC using the latest published charts, add *CHARTS=latest*
80to the command, e.g.,::
81
82 CHARTS=latest make roc-4g-models
83
Andy Bavier99892132022-03-11 14:49:10 -070084To install the Aether 2.0 release, add *CHARTS=release-2.0*::
Andy Bavier840e0b42021-09-16 17:10:23 -070085
Andy Bavier99892132022-03-11 14:49:10 -070086 CHARTS=release-2.0 make roc-4g-models
Andy Bavier840e0b42021-09-16 17:10:23 -070087
Andy Bavier4d27e4e2022-02-07 14:49:45 -070088The ROC has successfully initialized when you see output like this::
89
90 echo "ONOS CLI pod: pod/onos-cli-5b947f8f6-4r5nm"
91 ONOS CLI pod: pod/onos-cli-5b947f8f6-4r5nm
92 until kubectl -n aether-roc exec pod/onos-cli-5b947f8f6-4r5nm -- \
93 curl -s -f -L -X PATCH "http://aether-roc-api:8181/aether-roc-api" \
94 --header 'Content-Type: application/json' \
Andy Bavier99892132022-03-11 14:49:10 -070095 --data-raw "$(cat /root/aether-in-a-box//roc-5g-models.json)"; do sleep 5; done
Andy Bavier4d27e4e2022-02-07 14:49:45 -070096 command terminated with exit code 22
97 command terminated with exit code 22
98 command terminated with exit code 22
99 "9513ea10-883d-11ec-84bf-721e388172cd"
100
101Don't worry if you see a few lines of *command terminated with exit code 22*; that command is trying to
102load the ROC models, and the message appears if the ROC isn't ready yet. However if you see that message
103more than 10 times then something is probably wrong with the ROC or its models.
104
Andy Bavier840e0b42021-09-16 17:10:23 -0700105Start the 4G SD-CORE
106--------------------
107
108If you are installing the 5G SD-CORE, you can skip this step.
109
110To deploy the 4G SD-CORE and run a simple ping test::
111
112 make test
113
114By default the above commands install the 4G SD-CORE from the local charts in the Git repos cloned
115earlier. In order to install the SD-CORE using the latest published charts, add *CHARTS=latest*
116to the command, e.g.,::
117
118 CHARTS=latest make test
119
Andy Bavier99892132022-03-11 14:49:10 -0700120To install the Aether 2.0 release, add *CHARTS=release-2.0*::
Andy Bavierf73c3d22021-08-30 10:29:06 -0700121
Andy Bavier99892132022-03-11 14:49:10 -0700122 CHARTS=release-2.0 make test
Andy Bavierf73c3d22021-08-30 10:29:06 -0700123
Fatemeh Rouzbeh104c01a2022-05-16 14:08:27 -0700124Getting Started with 4G AiaB
125^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1264G SD-CORE deploys the following core components to provide mobile connectivity:
127
128* SPGW (Serving/PDN Gateway): Combined Serving Gateway and Packet Data Network (PDN) Gateway
129* UPF (User Plane Function): The interconnect between the mobile infrastructure and the Data Network (DN).
130* PCRF (Policy and Charging Rules Function): Data flow detection, policy enforcement, and flow-based charging.
131* MME (Mobility Management Entity): Manages UE access network and mobility, and establishing the bearer path for UE.
132* HSS (Home Subscriber Server): The main subscriber database.
133
134.. figure:: images/4g-call-flow.png
135 :align: center
136 :width: 80 %
137
138 *Communication between 4G SD-CORE Components*
139
140The eNB (evolved Node B) is the Radio Access Network (RAN) of the 4G architecture and allows
141the UEs to connect to the Mobile network.
142It passes UE's attach request to MME via S1AP interface to be identified and authenticated through HSS.
143MME sends the session request to SPGW to create the GTP tunnel and request the default bearer. SPGW sends back the UPF
144address to establish the connectivity (GTP tunnel) to the DN through the user plane.
145
146When the AiaB is up, by configuring the routing table you
147can route traffic to arbitrary destinations through the AiaB user plane::
148
149 ip route add <Destination-Network-Address> dev oip1
150
151Or you can explicitly specify the *oip1* interface within the command, such as::
152
153 curl --interface oip1 google.com
154 ping -I oip1 google.com
155
156AiaB deploys a router pod in the "default" namespace with four interfaces: *ran-gw* for the radio network,
157*access-gw* for access network, *core-gw* for core network, and *eth0* for the external network.
158When a UE starts sending traffics to the data network through the user plane (access network),
159the outgoing data packets traverse the following path across the pods::
160
161 (oip1) enb-0 (enb) ==GTP==> (ran-gw) router (access-gw) ==GTP==> (access) upf-0 (core)
162 ----> (core-gw) router (NAT,eth0)
163
164And the incoming packets follow as::
165
166 (NAT,eth0) router (core-gw) ----> (core) upf-0 (access) ==GTP==> (access-gw) router (ran-gw)
167 ==GTP==> (enb) enb-0 (oip1)
168
169**Notes:** In the above notations, network interfaces within each pod are shown in parenthesis.
170The IP packets sent/received between the UE and external host via the user plane are GTP-encapsulated
171and tunneled between the eNB and UPF.
172
173Ksniff
174~~~~~~
175Ksniff is a Kubernetes-integrated packet sniffer shipped as a kubectl plugin.
176Ksniff uses tcpdump and Wireshark (Wireshark 3.x) to capture traffic on a specific pod within the cluster.
177After installing Ksniff using Krew and Wireshark, by running the following command
178you can see the communications between the components. Ksniff uses kubectl to upload
179the tcpdump binary into the target container (e.g. mme, upf, ...), and redirects the output to Wireshark::
180
181 kubectl ksniff -n omec mme-0
182
183You can see the packets sent/received between the core components from the moment an
184UE initiates the attach procedure through eNB until
185the dedicated bearer (uplink and downlink) has been established (see figure below).
186After the bearer has been established, traffic sent from UE's interface (*oip1*) will go through the eNB and UPF.
187
188.. figure:: images/wireshark-4g.png
189 :width: 80 %
190 :align: center
191
192 *Wireshark output of ksniff on mme pod*
193
194Using Ksniff on the router pod you can see all the packets exchanged between the UE and external hosts
195(e.g. ping an external host from the UE interface)::
196
197 kubectl ksniff -n default router
198
199.. figure:: images/4g-ue-ping.png
200 :width: 80 %
201 :align: center
202
203 *Data Flow from UE to an external host through the User Plane (filtered on UE's IP address)*
204
205Looking at the packet's details, the first and second packets are from *enb* to *router*
206and then to *upf* in a GTP tunnel. And the third packet is sent from *router* to the external network via NAT.
207The rest are the reply packets from the external host to the UE.
208
209By default, Ksniff runs *tcpdump* on all interfaces (i.e. *-i any*). To retrieve more details
210of packets (e.g. ethernet header information) on a specific interface,
211you can explicitly specify the interface along with options (e.g. *-e*). e.g.::
212
213 kubectl sniff -n default router -i access-gw -f "-e"
214
215For more information, please visit the links below:
216
217* `Ksniff <https://github.com/eldadru/ksniff>`_
218* `3gpp Spec <https://www.etsi.org/deliver/etsi_ts/136100_136199/136101/14.05.00_60/ts_136101v140500p.pdf>`_
219* `4G LTE Concepts and Call Flow <https://www.udemy.com/course/4g-lte-evolved-packet-core-deep-dive-and-call-flows/>`_
220
221
Andy Bavier840e0b42021-09-16 17:10:23 -0700222Start the 5G SD-CORE
223--------------------
Andy Bavierf73c3d22021-08-30 10:29:06 -0700224
Andy Bavier840e0b42021-09-16 17:10:23 -0700225If you have already installed the 4G SD-CORE, you must skip this step. Only one version of
226the SD-CORE can be installed at a time.
Andy Bavierf73c3d22021-08-30 10:29:06 -0700227
Andy Bavier1d631762022-01-10 15:47:51 -0800228To deploy the 5G SD-CORE and run a test with gNBSim that performs Registration + UE-initiated
229PDU Session Establishment + sends User Data packets::
Andy Bavierf73c3d22021-08-30 10:29:06 -0700230
Andy Bavier1d631762022-01-10 15:47:51 -0800231 make 5g-test
Andy Bavierf73c3d22021-08-30 10:29:06 -0700232
Andy Bavier840e0b42021-09-16 17:10:23 -0700233By default the above commands install the 5G SD-CORE from the local charts in the Git repos cloned
234earlier. In order to install the SD-CORE using the latest published charts, add *CHARTS=latest*
235to the command, e.g.,::
Andy Bavierf73c3d22021-08-30 10:29:06 -0700236
Andy Bavier1d631762022-01-10 15:47:51 -0800237 CHARTS=latest make 5g-test
Andy Bavierf73c3d22021-08-30 10:29:06 -0700238
Andy Bavier99892132022-03-11 14:49:10 -0700239To install the Aether 2.0 release, add *CHARTS=release-2.0*::
Andy Bavierf73c3d22021-08-30 10:29:06 -0700240
Andy Bavier05eca6b2022-04-01 15:14:34 -0400241 CHARTS=release-2.0 make 5g-test
Andy Bavierf73c3d22021-08-30 10:29:06 -0700242
Andy Bavier1d631762022-01-10 15:47:51 -0800243To change the behavior of the test run by gNBSim, change the contents of *gnb.conf*
Andy Bavier4cda1402022-02-15 15:33:31 -0700244in *sd-core-5g-values.yaml*. Consult the
Andy Bavier1d631762022-01-10 15:47:51 -0800245`gNBSim documentation <https://docs.sd-core.opennetworking.org/master/developer/gnbsim.html>`_ for more information.
Andy Bavierf73c3d22021-08-30 10:29:06 -0700246
Andy Bavier4d27e4e2022-02-07 14:49:45 -0700247Exploring AiaB
248--------------
249
250The *kubectl* tool is the best way to get familiar with the pods and other Kubernetes objects installed by AiaB.
251The SD-CORE services, UPF, and simulated edge devices run in the *omec* namespace, while the ROC is running
252in the *aether-roc* namespace.
253
254The ROC GUI is available on port 31194 on the host running AiaB.
255
Andy Bavier840e0b42021-09-16 17:10:23 -0700256Cleanup
257-------
Andy Bavierf73c3d22021-08-30 10:29:06 -0700258
Andy Bavier840e0b42021-09-16 17:10:23 -0700259The first time you build AiaB, it takes a while because it sets up the Kubernetes cluster.
260Subsequent builds will be much faster if you follow these steps to clean up the Helm charts without
261destroying the Kubernetes cluster.
Andy Bavierf73c3d22021-08-30 10:29:06 -0700262
Andy Bavier840e0b42021-09-16 17:10:23 -0700263* Clean up the 4G SD-CORE: *make reset-test*
Andy Bavier72547672022-02-03 14:45:16 -0700264* Reset the 4G UE / eNB in order to re-run the 4G test: *make reset-ue*
Andy Bavier840e0b42021-09-16 17:10:23 -0700265* Clean up the 5G SD-CORE: *make reset-5g-test*
266* Clean up the ROC: *make roc-clean*
267
268It's normal for the above commands to take a minute or two to complete.
269
270As an example, suppose that you want to test the 4G SD-CORE with the ROC, and then the 5G SD-CORE
271with the ROC. You could run these commands::
272
273 CHARTS=latest make roc-4g-models # Install ROC with 4G configuration
274 CHARTS=latest make test # Install 4G SD-CORE and run ping test
275 make reset-test
276 make roc-clean
277 CHARTS=latest make roc-5g-models # Install ROC with 5G configuration
Andy Bavier1d631762022-01-10 15:47:51 -0800278 CHARTS=latest make 5g-test # Install 5G SD-CORE and run gNB Sim test
Andy Bavier840e0b42021-09-16 17:10:23 -0700279 make reset-5g-test
280 make roc-clean
281
Andy Bavier62678402022-04-18 12:06:52 -0700282To completely remove AiaB by tearing down the Kubernetes cluster, run *make clean*.
283
Andy Bavier840e0b42021-09-16 17:10:23 -0700284Developer Loop
285--------------
286
287Suppose you wish to test a new build of a 5G SD-CORE services. You can deploy custom images
Andy Bavier4cda1402022-02-15 15:33:31 -0700288by editing `~/aether-in-a-box/sd-core-5g-values.yaml`, for example::
Andy Bavierf73c3d22021-08-30 10:29:06 -0700289
Andy Bavier4cda1402022-02-15 15:33:31 -0700290 omec-control-plane:
291 images:
292 tags:
293 webui: registry.aetherproject.org/omecproject/5gc-webui:onf-release3.0.5-roc-935305f
294 pullPolicy: IfNotPresent
Andy Bavierf73c3d22021-08-30 10:29:06 -0700295
Andy Bavier840e0b42021-09-16 17:10:23 -0700296To upgrade a running 5G SD-CORE with the new image, or to deploy the 5G SD-CORE with the image::
Andy Bavierf73c3d22021-08-30 10:29:06 -0700297
Andy Bavier4cda1402022-02-15 15:33:31 -0700298 make reset-5g-test; make 5g-test
Andy Bavier840e0b42021-09-16 17:10:23 -0700299
300Troubleshooting / Known Issues
301------------------------------
302
303If you suspect a problem, first verify that all pods are in Running state::
304
305 kubectl -n omec get pods
306 kubectl -n aether-roc get pods
307
Andy Bavier840e0b42021-09-16 17:10:23 -07003084G Test Fails
309^^^^^^^^^^^^^
310Occasionally *make test* (for 4G) fails for unknown reasons; this is true regardless of which Helm charts are used.
Andy Bavier72547672022-02-03 14:45:16 -0700311If this happens, first try recreating the simulated UE / eNB and re-running the test as follows::
312
313 make reset-ue
314 make test
315
316If that does not work, try cleaning up AiaB as described above and re-building it.
317
318If *make test* fails consistently, check whether the configuration has been pushed to the SD-CORE::
Andy Bavier840e0b42021-09-16 17:10:23 -0700319
320 kubectl -n omec logs config4g-0 | grep "Successfully"
321
322You should see that a device group and slice has been pushed::
323
324 [INFO][WebUI][CONFIG] Successfully posted message for device group 4g-oaisim-user to main config thread
325 [INFO][WebUI][CONFIG] Successfully posted message for slice default to main config thread
326
327Then tail the *config4g-0* log and make sure that the configuration has been successfully pushed to all
328SD-CORE components.
Andy Bavier2e20f972022-04-21 11:09:02 -0700329
3305G Test Fails
331^^^^^^^^^^^^^
332
333If the 5G test fails (*make 5g-test*) then you will see output like this::
334
335 2022-04-21T17:59:12Z [INFO][GNBSIM][Summary] Profile Name: profile2 , Profile Type: pdusessest
336 2022-04-21T17:59:12Z [INFO][GNBSIM][Summary] Ue's Passed: 2 , Ue's Failed: 3
337 2022-04-21T17:59:12Z [INFO][GNBSIM][Summary] Profile Errors:
338 2022-04-21T17:59:12Z [ERRO][GNBSIM][Summary] imsi:imsi-208930100007492, procedure:REGISTRATION-PROCEDURE, error:triggering event:REGESTRATION-REQUEST-EVENT, expected event:AUTHENTICATION-REQUEST-EVENT, received event:REGESTRATION-REJECT-EVENT
339 2022-04-21T17:59:12Z [ERRO][GNBSIM][Summary] imsi:imsi-208930100007493, procedure:REGISTRATION-PROCEDURE, error:triggering event:REGESTRATION-REQUEST-EVENT, expected event:AUTHENTICATION-REQUEST-EVENT, received event:REGESTRATION-REJECT-EVENT
340 2022-04-21T17:59:12Z [ERRO][GNBSIM][Summary] imsi:imsi-208930100007494, procedure:REGISTRATION-PROCEDURE, error:triggering event:REGESTRATION-REQUEST-EVENT, expected event:AUTHENTICATION-REQUEST-EVENT, received event:REGESTRATION-REJECT-EVENT
341 2022-04-21T17:59:12Z [INFO][GNBSIM][Summary] Simulation Result: FAIL
342
343In this case check whether the *webui* pod has restarted... this can happen if it times out waiting
344for the database to come up::
345
346 $ kubectl -n omec get pod -l app=webui
347 NAME READY STATUS RESTARTS AGE
348 webui-6b9c957565-zjqls 1/1 Running 1 (6m55s ago) 7m56s
349
350If the output shows any restarts, then restart the *simapp* pod to cause it to re-push its subscriber state::
351
352 $ kubectl -n omec delete pod -l app=simapp
353 pod "simapp-6c49b87c96-hpf82" deleted
354
355Re-run the 5G test, it should now pass.