# Cloud-Enabled Deployment of 5G Core Network with Analytics Features
## 4 The Testbed
### Slicing Configuration
3. ip tuntap add name ogstun mode tun 4. ip tuntap add name ogstun2 mode tun 5. ip addr add 10.45.0.1/16 dev ogstun 6. ip addr add 10.46.0.1/16 dev ogstun2
4. ip link set ogstun up 6. ip link set ogstun2 up 7. iptables -t nat -A POSTROUTING -s 10.45.0.0/16! -o ogstun -j MASQUERADE 8. iptables -t nat -A POSTROUTING -s 10.46.0.0/16! -o ogstun2 -j MASQUERADE

The final step in deploying the virtualized 5G network is to execute the UERANSIM software, which emulates the gNB. The gNB then establishes the N2 link with the 5 GCN AMF, setting up the SCTP interface between the 5 GAN and the 5 GCN. The AMF log file will show data received from the gNB, including information about supported slices, TAC, and PLMN, matching the configured values. The 5G network deployment process is considered complete once the gNB is registered and the N2 connection is established. ### Problem Statement

**Identified problem. ** During the initial registration, the UE also requests the establishment of a PDU session. While network registration is successful, session establishment fails. After several attempts to establish a PDU session, UE1 does not receive any response to its _InitialUEMessage_ and switches to the IDLE state. **Context of the problem. ** This issue was identified in the Open5 GS implementation of the 5G core. Open5 GS is regarded as the most suitable open-source tool for deploying private 5G networks, especially in cloud environments. **Root cause. ** The AMF log file helped trace the root cause of this issue. Listing 5 reveals that the AMF is unable to connect to an HTTP/2 server at the 127.0.0.24 address, which corresponds to the SBI interface of SMF2. Consequently, the AMF mistakenly requests the establishment of the PDU session for UE1 through an invalid SMF. This request should be routed to SMF1, as SMF2 is designated to handle a different slice associated with UE2. Thus, the SMF selection process is flawed. **Listing 5**. AMF attempt to establish session for UE1 at SMF2. ```
11/0514:16:32.754:[sbi]DEBUG:[POST]/nsmf-pdusession/v1/sm-contexts (../lib/sbi/nghttp2-server.c:800)
11/0514:16:32.754:[sbi]DEBUG:RECEIVED:1142(../lib/sbi/nghttp2-server.c:804)
11/0514:16:32.755:[sbi]DEBUG:....-KepEqNu8K4*VigBUOK4 YIQ= Content-Type:application/json { \"supi\":\"imsi-660100000000001\", \"pei\":\"imeisv-4370816125816151\", \"pduSessionId\":1, \"dnn\":\"internet\", \"Nssa\":{ \"sst\":1, \"sd\":\"000001\" }, }
```
Upon further verification, the AMF has been found to cause the SMF2 to crash by issuing a request to establish a PDU session to a DN which is unsupported by the targeted SMF2. Before issuing the faulty request, the AMF executes an internal SMF selection procedure. This procedure can be bypassed if the AMF has local access to SMF information. This explains the absence of an actual SMF selection process, as both SMF1 and SMF2 reside within one NSI and are registered with a common NRF. The AMF retrieves SMF information through notifications sent by the NRF to the _/nnrf-nfn/v1/nf-status-notify_ endpoint and retains this information until deregistration. **Impact of the problem. ** Unfortunately, the Open5 GS documentation does not provide guidance on resolving the SMF selection issue. This abnormal behavior likely stems from the scenario where multiple S-NSSAIs are linked to a single NSI. Given Open5 GS'sadvantages and its critical role in cloud-based deployments, any fixes, improvements, or enhancements to this tool are invaluable to the community. Therefore, we propose a solution to this issue, which is detailed in the next section. **Ideal solution that did not work. ** To understand why the AMF fails to anchor the PDU session in the appropriate SMF, we adopted a reverse engineering approach. The issue with the faulty SMF selection may be related to the _nf_instance_ itself. Since SMF2 was called after SMF1, it may have been incorrectly selected as the desired node to request the establishment of the session. To address this issue, we reversed the execution order of the SMFs.