# 🇮🇩 2023-UI-TEEP-Free5GC
:::info
**Resources**
1. https://www.free5gc.org/installations/stage-3/
2. https://www.youtube.com/@free5gc447
3. https://github.com/free5gc/free5gc
:::
[toc]
> written by :
[Naufal](https://trello.com/c/hliJFwGm) and
[Bachul](https://trello.com/c/y4F0P9GR)
# **Overview Free5GC**
**What is Free5GC**
**Free5GC is a computer program that allows 5G networks to function properly**. 5G networks are the latest generation of mobile networks, and they offer faster speeds, more reliable connections, and the ability to support more devices than previous generations. **Free5GC is a particular implementation of the 5G core network that is designed to be flexible and modular, which means that it can be customized to meet the specific needs of different 5G networks**.

For example, different 5G networks may require different levels of performance, security, or functionality, depending on factors such as the number of users, geographic coverage, or specific use cases.
The 3GPP (3rd Generation Partnership Project) is a global collaboration between telecommunications standards organizations that develop standards for mobile communication systems. **The 3GPP standard defines the technical specifications for the design, operation, and maintenance of 5G networks**, as well as previous generations of mobile networks, such as 4G/LTE and 3G.
<iframe width="400" height="300" src="https://www.youtube.com/embed/SFO2z5-4zxs" title="free5GC Demonstration with 5G SA gNB and UE" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" allowfullscreen></iframe>
Free5GC is open-source, which means that the program's code is publicly available for anyone to access, modify, and use. This is important because it allows researchers and developers to experiment with Free5GC and create new applications and services that can be used on 5G networks.
Free5GC is made up of several different components, which work together to make the network function properly. **These components include the Access and Mobility Management Function (AMF), the User Plane Function (UPF), the Session Management Function (SMF), and the Network Repository Function (NRF).** Each of these components plays an important role in making sure that data is transmitted correctly and efficiently on a 5G network.
<iframe width="400" height="300" src="https://www.youtube.com/embed/tMcVTx1XlIk" title="free5GC demo (Stage1)" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" allowfullscreen></iframe>
Overall, **Free5GC is an important tool for anyone who is interested in working with 5G networks.** It allows researchers and developers to create new applications and services that can be used on 5G networks, and it provides a flexible and modular framework for building customized 5G core networks.
# Importance of Free5GC on 5G Ecosystem
Free5GC acts as an important component of 5G in the ecosystem because it helps eneable the development and deployment of 5G in a more flexible and customized way.
Here are a few points that explain the importance of Free5GC in 5G ecosystem:
1. **Flexibility and Customization**
Free5GC allows service providers to make adaptation of the software to their own specific needs and requirements. It enables them to build 5G networks that are tailored to particular use cases. In Indonesia, one of the prime example is smart city applications.
2. **Accelerates 5G Adoption**
Free5GC accelerates the adoption of 5G technology by making it more accessible for providers to deploy and test 5G networks through built-in functions. It leads to faster commercialization of 5G services that benefit businesses and customers.
3. **Open-source**
Free5GC is an open-sourced project that allows everyone to access and continue the development of the software without license. This fact encourages collaboration and innovation among developers, service providers, and other stakeholders.
4. **Standard Complience**
Free5GC is designed to comply with the 3GPP 5G specifications, which are the industry standards for 5G networks. This means that free5GC can be used to test and evaluate new 5G features and services in a standardized and interoperable way.
5. **Community Supporrt**
Free5GC has a growing community of developers and contributors, which means that researchers can benefit from community-driven development, bug fixes, and other support resources.
# **Recommended Environtment**
To support this research we need some environment that we can divide by 3 Object and each specification, that is :
1. UE (User Equipment)
User equipment, or UE, **is a term used in LTE, 4G, and 5G wireless communications to describe a mobile device, such as a smartphone, tablet, laptop, or other type of wireless device that is used to access the network.**
Specification:
1.1. Anything UE that could connect to wifi or the internet.
2. eNodeB (enhanced Node Base Station)
**eNodeB** (also called Evolved Node B or eNB) **is a key component of the 4G LTE** radio access network (RAN) **and serves as the main communication interface** between the user equipment (UE) and the core network.
Specification:
2.1 LTE Small Cell (Wistron NeWeb OSQ4G-01E2)
3. Core Network
The **core network** is a critical component of a mobile network, including 5G. It is **responsible for providing various network functions that are necessary for the operation of the network and for delivering services to the end-users.**
The 5G core network is designed to be more flexible, scalable, and efficient than previous generations of mobile networks, and it is based on a service-based architecture (SBA) that uses web APIs to provide the various network functions.
:::info
Core Network will be implemented in some modules like HSS, AMF, SMF, PCRF and UPF.
:::
Specification:
3.1. The minimum Specification of Hardware is:
- CPU: Intel i5 processor
- RAM: 4GB
- Hard drive: 160GB
- NIC: Any 1Gbps Ethernet card supported in the Linux kernel
3.2. Recommendation Specifications of Hardware is:
- CPU: Intel i7 processor
- RAM: 8GB
- Hard drive: 1TB
- NIC: Any 10Gbps Ethernet card supported in the Linux kernel
3.3. The general Requirements are :
- OS: Ubuntu 20.04.1
- gcc 7.3.0
- Go 1.14.4 linux/amd64
- kernel version 5.4.0-42-generic
This Information assumes that we will run all 5GC elements on a single machine.
---
# System Architecture and Network Element & Function

## **AMF (Access and Mobility Management Function)**
**Authentication and Authorization**
AMF is responsible for authenticating and authorizing user access to the network. This will be done by things such as verifying user identity and making access policies
**Mobility and Session Management**
AMF will be responsible for managing user mobility within the network such as handovers between different nodes in the network and tracking user location information. Besides that AMF will be working with SMF to manage user session and coordinate session establishment
**Network Slicing**
AMF will be responsible also for coordinating network slicing for different user groups or services
**Security Management**
The control plane will be handled by AMF. Such functions such as authentication and key management will be implemented
## **SMF (Session Management Function)**
**Session Management**
SMF will be responsible for managing session for data and voice services.
**Policy and charging Control**
SMF will be responsible for policies and charging rules for user based on sessions bu enforcing data caps and applying QoS policies
**Data Forwarding**
SMF will be responsible for forwarding user data from network nodes (ie. UPF) to data plane processing
**Encryption and Security**
SMF will be also implementing security functions for the user plane such as encryption and integrity function
## **UPF (User Plane Function)**
**Packet Forwarding**
UPF will be responsible for forwarding data packets between the RAN and CORE network. This will ensure the packets are delivered based on level of priority and reliability values of QoS parameters.
**Traffic Management**
UPF will be responsible for managing different types of traffic sych as streaming data, voice and video, and internet browsing. It will apply traffic shaping with policies so that all resources in the network is used efficiently.
## **HSS (Home Subscriber Server)**
**Subscriber Management**
The HSS will be responsible for subscriber related information such as user credentials, making sure that the information is available for other network components
**Security**
HSS will also be responsible for some security aspects such as authenticating and authorizing subscriber acces to the network and also is responsible for implementing policy and charging rules for subscriber sessions.
**Roaming**
HSS is responsible for managing subscriber when they are outside their usual area in other words for roaming services
## **PCRF (Policy and Charging Function)**
**Policy and Charging Control**
The PCRF will be responsible for implementing and managing policy and charging rules for user session and providing records related to the usage charging. Other than that the PCRF is also responsible for managing SLA (Service Level Agreement) for ensuring that the user gets according to what is stated in the SLA.
**Network Slicing**
The PCRF will also take part in coordinating network slicing functions which enables dedicated network slices for different user groups
# More about 5G Core

## CUPS Architecture
One of the first steps towards evolving from 4G to 5G core network is to apply the CUPS architecture to the 4G Evolved Packet Core (EPC). CUPS stands for Control and User Plane Separation, which means separating the user plane functionality and control plane functionality of the serving gateway (SGW) and the packet data network gateway (PGW) in 4G EPC.
The user plane functionality refers to the processing and forwarding of user data packets between the RAN and the data network. The control plane functionality refers to the signaling and management of user sessions, mobility events, policies, charging, etc. In 4G EPC, both SGW and PGW perform both user plane and control plane functions.
The CUPS architecture splits SGW and PGW into two separate entities: SGW-C (control plane) and SGW-U (user plane), PGW-C (control plane) and PGW-U (user plane). This allows more flexibility in deploying and scaling the user plane functions closer to the edge of the network, where they can reduce latency, improve user experience, and enable new services that require real-time processing. The control plane functions can be centralized or distributed depending on the operator’s preference.
The CUPS architecture also enables the virtualization of the network functions, meaning that they can be implemented as software processes that run on any commercial off-the-shelf (COTS) hardware or cloud infrastructure. This reduces the dependency on vendor-specific hardware and software solutions and allows more cost-efficiency and innovation in network deployment and operation.
The CUPS architecture is specified in release 14 of 3GPP. It is an intermediate step towards migrating from 4G EPC to 5G core network. Once CUPS is applied to 4G EPC, it becomes easier to introduce new 5G core network functions alongside existing ones.
1. 5G Service Based Architecture
The 5G service based architecture is a new design principle that applies IT network principles and a cloud-native approach to enable network functions to communicate with each other through a common API framework and a network repository function that enables discovery and registration of services. The service based architecture is more flexible and agile than the reference point architecture, as it allows network functions to be deployed and scaled independently and dynamically according to the network needs and demands.
The network functions are connected to a common bus that carries the service based interfaces (SBIs) between them. The SBIs are based on RESTful API design principles, which use HTTP methods and URIs to provide a uniform interface for accessing resources and services offered by network functions. The SBIs also support two types of services: request-response services and subscription-notification services.
Some of the key features and benefits of 5G service based architecture are:
* Modularity: The network functions are designed as self-contained and reusable modules that can be deployed and scaled independently and dynamically according to the network needs and demands.
* Flexibility: The network functions can communicate with each other through a common API framework that allows more flexibility in network deployment and operation. The network functions can also expose their services to external applications through the NEF (Network Exposure Function).
* Discovery: The network functions can discover and register their services with the NRF (Network Repository Function), which acts as a directory service for the network. The NRF also provides information on the availability, location, and load of the network functions.
* Security: The network functions can authenticate and authorize each other using certificates and tokens provided by the AUSF (Authentication Server Function). The network functions can also encrypt and protect their communications using TLS (Transport Layer Security) protocol.
* Virtualization: The network functions are implemented as software processes that run on any commercial off-the-shelf (COTS) hardware or cloud infrastructure. This enables network virtualization, which allows multiple logical networks to share the same physical resources.
* Slicing: The network functions can support network slicing, which allows creating multiple virtual networks on top of the same physical network. Each network slice can have its own characteristics, policies, and services tailored for different use cases and applications.
* Edge computing: The network functions can support edge computing, which allows moving some of the processing and storage capabilities closer to the end users and devices. This reduces latency, improves user experience, and enables new services that require real-time processing and local data analysis.
2. Category of Services in 5G
eMBB, mMTC, and URLLC are three categories of services that can be provided by 5G networks.
* eMBB (enhanced Mobile Broadband): This category is focused on providing high-speed, high-bandwidth services to support applications such as 4K/8K video streaming, virtual reality, and augmented reality. eMBB is designed to provide data rates of up to 20 Gbps, which is significantly faster than 4G networks.
* mMTC (massive Machine Type Communications): This category is focused on supporting massive machine-to-machine communication for the Internet of Things (IoT) devices. This includes sensors, smart meters, and other devices that require low data rates and long battery life.
* URLLC (Ultra-Reliable Low-Latency Communications): This category is focused on providing highly reliable, low-latency communications for mission-critical applications such as autonomous driving, industrial automation, and remote surgery. URLLC is designed to provide latencies as low as 1 ms and error rates as low as 10^-9.
Each category has different requirements and priorities, and it is important to use the appropriate category based on the specific application or use case. Using URLLC for applications that don't require ultra-reliability or low-latency could be overkill and result in unnecessary costs, while using eMBB for mission-critical applications could lead to unacceptable delays or errors.
3. 3GPP Release 16
A release in 3GPP is a set of specifications that provide developers with a stable platform for the implementation of features at a given point and then allow for the addition of new functionality in subsequent releases.
Release 16 of 3GPP is the second phase of 5G standardization that was completed in July 2020. It introduces new features and enhancements to the 5G system, such as ultra-reliable low-latency communication (URLLC), vehicle-to-everything (V2X) communication, industrial IoT, private networks, etc. It also introduces new network functions and interfaces to support non-3GPP access and interworking between different 5G networks.
Some of the new feature of Release 16 are:
* **IMT-2020 submission**: This is the formal process of submitting the 5G standard to the International Telecommunication Union (ITU) for recognition as a candidate for the IMT-2020 radio interface technology. IMT-2020 is the ITU’s vision for the next generation of mobile communication systems that will provide enhanced capabilities such as higher data rates, lower latency, higher mobility, increased connectivity and better quality of service. Release 16 fulfills all the requirements and performance criteria set by the ITU for IMT-2020.
* **Multimedia Priority Service (MPS)**: This feature enables priority access and treatment for certain types of multimedia services over 5G networks, such as public safety communication, emergency calls, disaster relief operations, etc. MPS provides mechanisms for identifying, marking, routing and handling MPS traffic with higher priority than other traffic in the network. MPS also supports end-to-end quality of service (QoS) assurance and resource allocation for MPS users.
* **Vehicle-to-everything (V2X) application layer services**: This feature defines a set of application layer services for V2X communication over 5G networks, such as cooperative awareness, basic safety message, collective perception, remote driving, etc. V2X communication enables vehicles to exchange information with other vehicles, infrastructure, pedestrians and network entities to improve road safety, traffic efficiency and user experience. V2X communication can also support autonomous driving and intelligent transportation systems.
* **5G satellite access**: This feature enables the integration of satellite networks with 5G networks to provide seamless and ubiquitous coverage for users in remote or rural areas where terrestrial networks are not available or reliable. Satellite access can also complement terrestrial networks by providing additional capacity or resilience in case of congestion or failure. Satellite access can support various use cases such as broadband access, backhaul, multicast/broadcast, IoT/MTC, etc.
* **Local Area Network support in 5G**: This feature enables the support of local area network (LAN) services over 5G networks, such as Wi-Fi or Ethernet. LAN support in 5G allows users to access local resources or devices within a certain area using their 5G devices or terminals. LAN support in 5G can also enable seamless mobility and handover between different types of networks (e.g., Wi-Fi to cellular or vice versa).
* **Wireless and wireline convergence for 5G**: This feature enables the convergence of wireless and wireline networks for 5G services,such as broadband access, edge computing, hybrid access, etc. Wireless and wireline convergence (WWC) provides a common control plane and user plane for both mobile and fixed subscribers, using a 5G core network and a new network function called Access Gateway Function (AGF). The AGF acts as a bridge between wireline access nodes (e.g., GPON OLTs) and the 5G core network, providing authentication, policy, QoS and traffic management functions. WWC reduces the complexity and cost of managing separate networks and enables a consistent service experience across different access technologies.
* **Terminal positioning and location**: This feature enables the support of accurate and reliable positioning and location services for 5G terminals, using various methods such as GNSS, network-based or hybrid. Terminal positioning and location can support various use cases such as navigation, augmented reality, asset tracking, emergency services, etc. Release 16 enhances the positioning and location capabilities of 5G by introducing new reference signals, measurements, protocols and architectures to improve the accuracy, latency, availability and reliability of positioning information.
* **Communications in vertical domains**: This feature enables the support of specific communication requirements and scenarios for different vertical domains over 5G networks, such as industrial IoT, smart grid, healthcare, automotive, etc. Communications in vertical domains can leverage the flexibility and versatility of 5G to provide customized solutions for different industries and applications. Release 16 defines new features and enhancements for communications in vertical domains such as time-sensitive networking (TSN), ultra-reliable low-latency communication (URLLC), non-public networks (NPNs), network slicing, multicast/broadcast services, etc
* **Network automation**: This feature enables the automation of network operations and management for 5G networks, using artificial intelligence (AI), machine learning (ML) and data analytics. Network automation can improve the efficiency, performance and reliability of 5G networks by enabling self-configuration, self-optimization, self-healing and self-protection functions. Release 16 defines new features and enhancements for network automation such as network data analytics function (NWDAF), network exposure function (NEF), network slice management function (NSMF), etc
* **Novel radio techniques**: This feature enables the exploration of novel radio techniques for 5G networks, such as massive MIMO, beamforming, full-duplex communication, non-orthogonal multiple access (NOMA), etc. Novel radio techniques can improve the spectral efficiency, capacity, coverage and quality of 5G networks by exploiting advanced signal processing and antenna technologies. Release 16 defines new features and enhancements for novel radio techniques such as integrated access and backhaul (IAB), sidelink communication (SL), dynamic spectrum sharing (DSS), etc
Some of the new network functions of Release 16 are:
* **N3IWF**: Non-3GPP Interworking Function, which is the network function that enables interworking between 5G core network and non-3GPP access networks, such as Wi-Fi or wireline. It acts as a gateway that terminates the N2 interface from the RAN and the N3 interface from the UPF and provides security, mobility, and session management for UEs accessing the 5G core network through non-3GPP access networks.
* **TNGF**: Trusted Non-3GPP Gateway Function, which is the network function that enables interworking between 5G core network and trusted non-3GPP access networks, such as Wi-Fi or wireline. It acts as a gateway that terminates the N2 interface from the RAN and provides security, mobility, and session management for UEs accessing the 5G core network through trusted non-3GPP access networks. A trusted non-3GPP access network is a non-3GPP access network that belongs to the same operator as the 5G core network or has a trust relationship with it.
* **W-AGF**: Wireline Access Gateway Function, which is the network function that enables interworking between 5G core network and wireline access networks, such as DSL or cable. It acts as a gateway that terminates the N2 interface from the RAN and provides security, mobility, and session management for UEs accessing the 5G core network through wireline access networks.
* **TWIF**: Trusted WLAN Interworking Function, which is the network function that enables interworking between 5G core network and trusted WLAN access networks, such as Wi-Fi. It acts as a gateway that terminates the N2 interface from the RAN and provides security, mobility, and session management for UEs accessing the 5G core network through trusted WLAN access networks. A trusted WLAN access network is a WLAN access network that belongs to the same operator as the 5G core network or has a trust relationship with it.
* **SCP**: Service Communication Proxy, which is the network function that enables interworking between different 5G core networks for roaming scenarios. It acts as a proxy that relays service based interface messages between different network functions in different 5G core networks. It also performs security, routing, and translation functions for interworking purposes.
* **SEPP**: Security Edge Protection Proxy, which is the network function that enables interworking between different 5G core networks for roaming scenarios. It acts as a proxy that relays user data packets between different UPFs in different 5G core networks. It also performs security, routing, and translation functions for interworking purposes.
4. Network Slicing
Network slicing is a key feature of 5G that allows the operator to create multiple logical networks over the same physical infrastructure. Each network slice can have its own characteristics, capabilities, and resources to meet the specific requirements of a use case or a customer. For example, a network slice for eMBB can provide high bandwidth and low latency for video streaming or gaming applications, while a network slice for mMTC can provide low bandwidth and high coverage for IoT devices or smart meters.
Each category of 5G network slicing has its own importance and use case. eMBB is important for applications that require high-speed data transmission and low latency, such as video streaming and online gaming. mMTC is important for applications that require a large number of devices to be connected, such as smart homes and industrial IoT. URLLC is important for applications that require ultra-reliable and low-latency communication, such as autonomous driving and remote surgery.
A network slice consists of three domains: RAN, transport, and core. Each domain can be configured and optimized according to the slice requirements. For example, a RAN domain can use different radio access technologies (RATs), such as NR or LTE, or different frequency bands, such as sub-6 GHz or mmWave. A transport domain can use different transport technologies, such as Ethernet or optical fiber, or different routing protocols, such as MPLS or Segment Routing. A core domain can use different NFs or different instances of NFs to provide different control and user plane functions.
A network slice is identified by a single network slice identifier (S-NSSAI), which consists of a slice/service type (SST) and a slice differentiation identifier (SD). The SST indicates the generic category of services that the slice supports, such as eMBB, mMTC, or URLLC. The SD indicates the specific differentiation of services within a category, such as video quality or device density. The S-NSSAI is used by the UE to request a network slice and by the network to select and assign a network slice for the UE.
The network slicing process involves four steps: preparation, instantiation, selection, and operation :
4.1. **Preparation**: The operator defines the network slice templates (NSTs) that specify the characteristics, capabilities, and resources of each network slice. The operator also defines the network slice instances (NSIs) that instantiate the NSTs on the physical infrastructure. The operator also registers the NSIs and their services in the NRF for discovery.
4.2. **Instantiation**: The operator activates the NSIs on demand or in advance according to the service demand or customer agreement. The operator also configures and optimizes the RAN, transport, and core domains for each NSI. The operator also monitors and manages the NSIs using the MANO framework.
4.3. **Selection**: The UE requests a network slice by sending its S-NSSAI to the network. The network selects an appropriate NSI for the UE based on its S-NSSAI, subscription, location, and availability. The network also assigns an AMF and an SMF for the UE to handle its access and session management in the selected NSI.
4.4. **Operation**: The UE establishes a PDU session with the selected NSI by communicating with its assigned AMF and SMF. The UE also establishes QoS flows with different QoS parameters within the PDU session according to its service needs. The UE can access the services and applications provided by the selected NSI through its UPF and data network.
<!--
5. Synchronization Signal Block
A synchronization signal block (SSB) is a unit of transmission that contains the synchronization signals and some broadcast information for UE. It has a fixed size and structure in both time and frequency domains. In terms of frequency, it occupies 240 subcarriers, which is equivalent to 20 physical resource blocks (PRBs). In terms of time, it occupies 4 OFDM symbols. The subcarrier spacing of SSB is predefined for each frequency band and known by UE in advance.
The SSB consists of three components: PSS, SSS, and PBCH. PSS and SSS are located in the same 127 subcarriers, but in different symbols.
5.1. Primary Synchronization Signal
The primary synchronization signal (PSS) is used by UE to synchronize with the first symbol in a radio frame, which is 10 milliseconds long. It also provides a value called N2, which ranges from 0 to 2 and is used for calculating PCI. PSS is a known sequence that UE can compare with the received signal and determine N2.
5.2. Secondary Synchronization Signal
The secondary synchronization signal (SSS) is used by UE to synchronize with the first symbol in a subframe, which is 1 millisecond long. It also provides a value called N1, which ranges from 0 to 335 and is used for calculating PCI. SSS is also a known sequence that UE can compare with the received signal and determine N1.
5.3. Physical Broadcast Channel
The physical broadcast channel (PBCH) carries some broadcast information for UE, such as system frame number, cell identity group, cell barring information, etc. It also carries a demodulation reference signal (DMRS) that helps UE to demodulate PBCH. The broadcast information is encoded in a master information block (MIB), which has a periodicity of 40 milliseconds and can be decoded by UE after receiving four consecutive SSBs.
6. Physical Cell Identity
The physical cell identity (PCI) is a number that identifies a cell in the network. It ranges from 0 to 1007 and can be calculated from PSS and SSS values as follows:
:::info
PCI = 3 * N1 + N2
For example, if N1 = 303 and N2 = 1, then PCI = 910.
:::
7. Synchronization Raster
The synchronization raster is a set of frequency positions where SSB can be located for system acquisition. It depends on the frequency band and subcarrier spacing used by the network. UE knows the synchronization raster for each band it supports and can search for SSB accordingly.
The synchronization raster frequencies are denoted by SSREF, which are calculated from GSCN numbers using different formulas for different frequency ranges.
| Frequency range | GSCN number | SSREF frequency |
| -------- | -------- | -------- |
| 0 - 3 GHz | n * 1200 kHz + m * 50 kHz <br> where n = 1 - 2499 <br> m = 1,3 or 5 | n * m + m / 24 MHz < |
* For FR1 (0-3000 MHz) and 15 kHz subcarrier spacing, the formula is:
SSREF = N * 1200 kHz + M * 50 kHz
where N = 1:2499, M ϵ {1,3,5}, and GSCN = 3N + (M-3)/2
* For FR1 (0-3000 MHz) and 30 kHz subcarrier spacing, the formula is:
SSREF = N * 1200 kHz + M * 50 kHz
where N = 1:2499, M ϵ {2,4,6}, and GSCN = 3N + (M-3)/2
* For FR1 (3000-24250 MHz) and 15 kHz subcarrier spacing, the formula is:
SSREF = 3000 MHz + N * 1.44 MHz
where N = 0:14756, and GSCN = 7499 + N
* For FR1 (3000-24250 MHz) and 30 kHz subcarrier spacing, the formula is:
SSREF = 3000 MHz + N * 1.44 MHz
where N = 0:14756, and GSCN = 7505 + N
* For FR2 (24250-100000 MHz) and 30 kHz subcarrier spacing, the formula is:
SSREF = 24250.08 MHz + N * 17.28 MHz
where N = 0:4383, and GSCN = 22256 + N
* For FR2 (24250-100000 MHz) and 60 kHz subcarrier spacing, the formula is:
SSREF = 24250.08 MHz + N * 17.28 MHz
where N = 0:4383, and GSCN = 22262 + N
:::warning
hm? A bit confused. Will study about this again later
:::
8. SS Burst Set
An SS burst set is a set of SSBs that are transmitted within 5 milliseconds with a periodicity of 20 milliseconds by default. The number and location of SSBs in an SS burst set depend on the frequency band and subcarrier spacing used by the network. The maximum number of SSBs in an SS burst set is 4 for frequencies below 3 GHz, 8 for frequencies between 3 and 6 GHz, and 64 for frequencies above 24.25 GHz.
The SS burst set is used for beam sweeping, which is a technique to transmit SSBs in different directions using beamforming. Beamforming is a technique to focus the radio signal in a specific direction using multiple antennas. By transmitting SSBs in different beams, the network can cover a larger area and reach more UEs. The following figure shows an example of beam sweeping with four beams:
UE can receive SSBs from different beams and choose the best one based on the received signal quality. The chosen beam will be used for further communication with the network.
9. Synchronization Procedure
The synchronization procedure describes the steps involved in UE acquiring and connecting to the network using SSB. The following figure shows an overview of the synchronization procedure:
The synchronization procedure consists of the following steps:
9.1. UE searches for SSB on the synchronization raster frequencies and subcarrier spacings that it supports.
9.2. UE decodes PSS and determines N2 and the first symbol in a radio frame.
9.3. UE decodes SSS and determines N1 and the first symbol in a subframe.
9.4. UE calculates PCI from N1 and N2 values.
9.5. UE decodes PBCH and DMRS and obtains MIB and other broadcast information.
9.6. UE performs random access to request a connection with the network by sending message 1.
9.7. Network responds with message 2 and assigns resources to UE.
9.8. UE sends radio resource control (RRC) connection request message to establish a connection with the network.
9.9. Network sends RRC connection setup message to complete the connection establishment.
After completing the synchronization procedure, UE can communicate with the network using data channels.
10. Timing Unit
Timing unit is the sampling time in 5G new radio. It is the time interval between two consecutive samples of a signal. Sampling is the process of converting a continuous signal into a discrete sequence of values. Sampling rate is the number of samples taken per second.
The timing unit in 5G new radio is given by the following formula:
$$T_c = \frac{1}{\Delta f_{max} N_{ref}}$$
where $T_c$ is the timing unit, $\Delta f_{max}$ is the maximum subcarrier spacing and $N_{ref}$ is the reference FFT size.
Subcarrier spacing is the frequency difference between two adjacent subcarriers in an OFDM system. OFDM stands for orthogonal frequency division multiplexing, which is a modulation technique that divides a wideband signal into multiple narrowband subcarriers. Each subcarrier can carry a different data stream.
FFT stands for fast Fourier transform, which is a mathematical operation that converts a time domain signal into a frequency domain signal. FFT size is the number of points used in the FFT operation. It determines the frequency resolution and the number of subcarriers.
The maximum subcarrier spacing in 5G new radio is 480 kHz, which is double of the highest numerology defined in release 15 and 16. Numerology is a set of parameters that defines the subcarrier spacing, slot duration and cyclic prefix length for different use cases and frequency bands.
The reference FFT size in 5G new radio is 4096, which is chosen to support the maximum number of subcarriers possible in different numerologies and channel bandwidths.
If we plug in these values into the formula, we get:
$$T_c = \frac{1}{480 \times 10^3 \times 4096} = 0.509 \text{ ns}$$
where ns stands for nanosecond, which is one billionth of a second.
The timing unit in 5G new radio is very small compared to LTE, which has a timing unit of 32.55 ns. This means that 5G new radio has a higher sampling rate and can support higher bandwidths and data rates.
11. Cyclic Prefix
Cyclic prefix is a guard time added before each symbol in an OFDM system. A symbol is a group of bits that are modulated onto a subcarrier. A guard time is a period of silence or no transmission that prevents interference between symbols.
Interference between symbols can occur due to multipath propagation, which is when a signal travels along different paths from the transmitter to the receiver due to reflection, refraction or scattering from obstacles. This causes different copies of the same signal to arrive at different times and with different phases at the receiver. This phenomenon is called inter-symbol interference (ISI) and it can degrade the quality of the signal.
To avoid ISI, the guard time should be longer than the maximum delay spread of the channel. Delay spread is the difference between the arrival times of the earliest and the latest copy of a signal.
However, adding a plain guard time would reduce the spectral efficiency and disturb the orthogonality of the subcarriers. Orthogonality means that each subcarrier has zero correlation with other subcarriers at certain sampling points. This property allows OFDM to avoid inter-carrier interference (ICI) and demodulate each subcarrier independently.
To preserve orthogonality and spectral efficiency, cyclic prefix is used instead of plain guard time. Cyclic prefix is a copy of the last part of a symbol that is appended to the beginning of the same symbol. This way, each symbol becomes cyclically continuous and maintains its frequency characteristics.
Cyclic prefix also acts as a circular buffer that can store some information from the previous symbol in case it is lost or distorted due to channel impairments. This can improve the robustness and reliability of OFDM systems.
The length of cyclic prefix depends on several factors such as numerology, channel bandwidth, frequency band and coverage area. In general, higher numerologies require shorter cyclic prefixes because they have shorter symbol durations and smaller coverage areas. However, there are some exceptions such as numerology 2 which can have both normal and extended cyclic prefixes depending on whether it is used in FR1 or FR2.
FR1 stands for frequency range 1, which covers the sub-6 GHz spectrum from 410 MHz to 7.125 GHz. FR2 stands for frequency range 2, which covers the millimeter wave spectrum from 24.25 GHz to 52.6 GHz.
The cyclic prefix length in 5G new radio is given by the following formulas:
$$N_{CP} = 512 \times K \times 2^{-\mu}$$
for extended cyclic prefix in numerology 2,
$$N_{CP} = (144 \times K + 16 \times K) \times 2^{-\mu}$$
for longer cyclic prefix at symbol 0 and half of the subframe,
$$N_{CP} = 144 \times K \times 2^{-\mu}$$
for normal cyclic prefix at all other symbols,
where $N_{CP}$ is the number of samples for cyclic prefix, $K$ is a constant equal to $T_s/T_c$, where $T_s$ is the timing unit in LTE and $T_c$ is the timing unit in 5G new radio, $\mu$ is the numerology index.
The cyclic prefix duration can be obtained by multiplying $N_{CP}$ by $T_c$.
The following table shows the cyclic prefix length and duration for different numerologies and types:
| Numerology | Subcarrier spacing (kHz) | Extended CP (ns) | Longer CP (ns) | Normal CP (ns) |
| -------- | -------- | -------- | -------- | -------- |
| 0 | 15 | - | 5.2 | 4.69 |
| 1 | 30 | - | 2.73 | 2.34 |
| 2 | 60 | 4.17 | 1.43 | 1.17 |
| 3 | 120 | - | 0.78 | 0.59 |
| 4 | 240 | - | 0.43 | 0.3 |
We can see that the cyclic prefix duration decreases as the subcarrier spacing increases, except for the extended cyclic prefix in numerology 2 which is longer than the normal cyclic prefix in numerology 1.
12. Symbol Duration
Symbol duration is the time interval between two consecutive symbols in an OFDM system. It includes both the useful symbol time and the cyclic prefix time.
The symbol duration in 5G new radio can be calculated by subtracting the total cyclic prefix time from the slot duration and dividing it by the number of symbols per slot.
The slot duration in 5G new radio is given by:
$$T_{slot} = \frac{10^{-3}}{2{\mu}}$$
where $\mu$ is the numerology index.
The number of symbols per slot in 5G new radio is fixed at 14 for all numerologies.
The total cyclic prefix time in a slot depends on the type and number of cyclic prefixes used.
For example, for numerology 0 with normal cyclic prefix, we have:
$$T_{slot} = \frac{10^{-3}}{2{0}} = 10^{-3} \text{ s}$$
$$N_{sym} = 14$$
$$T_{CP,total} = (5.2 + (13 \times 4.69)) \times 10^{-9} \text{ s}$$
The symbol duration can be obtained by:
$$T_{sym} = \frac{T_{slot} - T_{CP,total}}{N_{sym}}$$
$$T_{sym} = \frac{10^{-3} - 66.68 \times 10^{-9}}{14}$$
$$T_{sym} = 66.67 \times 10^{-6} \text{ s}$$
The following table shows the symbol duration for different numerologies and types of cyclic prefix:
| Numerology | Subcarrier spacing (kHz) | Extended CP (ns) | Longer CP (ns) | Normal CP (ns) |
| -------- | -------- | -------- | -------- | -------- |
| 0 | 15 | - | 66.67 | 66.67 |
| 1 | 30 | - | 35.71 | 35.71 |
| 2 | 60 | 28.57 | 17.86 | 17.86 |
| 3 | 120 | - | 9.52 | 9.52 |
| 4 | 240 | - | 5 | 5 |
We can see that the symbol duration decreases as the subcarrier spacing increases, except for the extended cyclic prefix in numerology 2 which has the same symbol duration as numerology 1.
13. Multipath Distance
Multipath distance is the maximum distance that a signal can travel along different paths from the transmitter to the receiver without causing inter-symbol interference.
The multipath distance in an OFDM system depends on the cyclic prefix length. The longer the cyclic prefix, the longer the multipath distance.
The multipath distance can be calculated by multiplying the cyclic prefix duration by the speed of light, which is approximately $3 \times 10^8$ m/s.
For example, for numerology 0 with normal cyclic prefix, we have:
$$T_{CP} = 4.69 \times 10^{-9} \text{ s}$$
$$D_{MP} = T_{CP} \times 3 \times 10^8 \text{ m/s}$$
$$D_{MP} = 1407 \text{ m}$$
The following table shows the multipath distance for different numerologies and types of cyclic prefix:
| Numerology | Subcarrier spacing (kHz) | Extended CP (ns) | Longer CP (ns) | Normal CP (ns) |
| -------- | -------- | -------- | -------- | -------- |
| 0 | 15 | - | 1560 | 1407 |
| 1 | 30 | - | 819 | 702 |
| 2 | 60 | 1251 | 429 | 351 |
| 3 | 120 | - | 234 | 177 |
| 4 | 240 | - | 129 | 90 |
We can see that the multipath distance decreases as the subcarrier spacing increases, except for the extended cyclic prefix in numerology 2 which has a longer multipath distance than numerology 1.
-->
4. Additional Information
The source code of the latest version free5GC can be downloaded from [here](https://github.com/free5gc/free5gc).
[](https://github.com/free5gc/free5gc)
The source code of free5GC stage 2 (ARM version) can be downloaded from [here](https://github.com/free5gc/free5GC-ARM).
[](https://github.com/free5gc/free5GC-ARM)
The source code of free5GC stage 1 can be downloaded from [here](https://bitbucket.org/nctu_5g/free5gc-stage-1/src/master/).
[](https://bitbucket.org/nctu_5g/free5gc-stage-1/src/master/)
Features history can be found [here](https://www.free5gc.org/history/).
[](https://www.free5gc.org/history/)
# Installing VMBox and Ubuntu
:::info
To run the fee5GC that we will be using, we need several tools to be installed on our device. Specifically, we need the Virtual Machine Box software application and the Linux Ubuntu Operating System to run the server that we will use for free5GC.
:::
## Install VMBox
1. We can download the VMBox application from the following link :
https://virtualbox.org/
Then, an image similar to the following will appear :

2. After that, select the Downloads sidebar and there will be a display as follows :

3. Choose the default Operating System that we use to download VM Box. If it has been installed, then the VMBox display will look like this :
:::spoiler

:::
## Install Ubuntu
:::info
In addition, we need to download the Ubuntu version ubuntu-20.04.1-live-server-amd64.iso from the following link:
https://old-releases.ubuntu.com/releases/20.04.1/
:::
1. Choose the specified version of Ubuntu to use the correct kernel, which is ubuntu-20.04.1-live-server-amd64.iso :

2. Then, go back to VMBox and select the "New" menu to create a new OS with the Linux OS option and select the Ubuntu 64-bit version.

3. Set the amount of RAM to be allocated, with a recommendation of 2 to 4 GB.

4. Continue the installation by clicking the "Continue" button until it finishes (assuming default settings).
5. Once it's finished, select the "Settings" menu and then select the "System" submenu to change the number of processors used to 2. Then, go to the "Storage" submenu and add a new IDE, and select the Ubuntu file we downloaded earlier, which is ubuntu-20.04.1-live-server-amd64.iso. Next, select the "Network" submenu, choose "Network 2", and enable the network adapter with the "Host-only Adapter" option.
:::spoiler



:::
:::success
After completing all of the above steps, the installation and configuration between the Virtual Machine and the OS used should be correct. Next, we will configure the settings in VMBox that we have created.
:::
### Configuring OS Ubuntu
:::info
To configure this OS, we need to run the OS that we created by clicking on the OS and then the "Run" button in the VMBox menu. **Please note that the OS we are using is a live server, so there is no GUI when using the OS.**
:::
1. Once it's running, the program will run an automatic configuration and prompt you to select a language.
Choose the preffered language (In this case, We'll go with english)

2. Next, the program will recommend that you update your OS version. However, choose to continue without updating, as we will be using the appropriate version so that the kernel we will use is correct. Continue the configuration by selecting the "Done" option or continue until you see the following image :





3. Enable the disk that we will use according to the image by pressing the "Enter" button and continue the configuration:



*No partitions will be used so we'll use the entire hard disk.*
4. Next, set up our user profile according to our needs and preferences. Do not forget the password that you write down as it will be used later on. Select the "Reboot" menu and the program will automatically reboot our VM.


5. The program will automatically reboot and wait until it is finished. After finishing the reboot, login using the username and password that we have created before:

6. To install ifconfig using the terminal prompt, follow these steps:
```
ubuntu@ubuntu:~$ sudo apt install net-tools
```

7. Run the ifconfig prompt to check the network interface:
```
ubuntu@ubuntu:~$ ifconfig
```

:::info
Your display may be different, but note the IP address of the Host-only interface. In the example above, it shows 192.168.56.101. You can SSH from the host machine into this virtual Ubuntu machine using that IP address later. (The other IP address, 10.0.2.15, is the IP address of the NAT interface, which applications on your host machine cannot access).
:::
### Configuration to connect VM with SSH.
1. Choose the IP address that you obtained in your laptop's configuration. Type the following prompt:
```
ssh ip_address -I ubuntu
```
:::info
The command "ssh ip_address -I ubuntu" is used to remotely log in to a host identified by its IP address (ip_address) using the Secure Shell (SSH) protocol. The option "-I ubuntu" specifies the user identity used when logging into the target host. In this case, the user identity used is "ubuntu".
:::
2. Please provide the prompts you are referring to as they seem to be missing in the message :
```
sudo apt update
sudo apt upgrade
```
:::info
Both of these commands are used on Ubuntu operating systems or other Linux distributions to update and upgrade the installed packages on the system.
The sudo apt update command is used to update the package list from the repositories or package sources available on the system. After running this command, it will check if there are any changes or updates to the package list, so the package list on the system will be updated.
Meanwhile, the sudo apt upgrade command is used to upgrade or update the installed packages on the system. After running this command, it will check the version of the packages available in the repository with the version of the packages installed on the system. If there is a newer version in the repository, then the package version on the system will be upgraded or updated to the newer version.
By running these two commands regularly, the system will always have updated and latest packages, which can improve the performance and security of the system.
:::
3. After configuring these settings, the Ubuntu interface will look like the following:

## Free5GC Installation
:::info
This section is written by Daniel and Joshevan
:::
This installation is done on Ubuntu 20.04 VM
### Install Prequisites
1. **Install Go 1.17.8**
For x86 Architecture:
```
wget https://dl.google.com/go/go1.17.8.linux-amd64.tar.gz
sudo tar -C /usr/local -zxvf go1.17.8.linux-amd64.tar.gz
mkdir -p ~/go/{bin,pkg,src}
```
For macOS with ARM-based Chip :
```
wget https://dl.google.com/go/go1.17.8.darwin-amd64.tar.gz
sudo tar -C /usr/local -zxvf go1.17.8.go1.17.8.darwin-amd64.tar.gz
mkdir -p ~/go/{bin,pkg,src}
```


:::info
These commands are used to install the Go programming language version 1.17.8 on a Linux system.
:::
:::spoiler
- First command uses wget (a command-line utility for downloading files from the web) to download the Go language archive file in .tar.gz format.
- Second command extracts the contents of the Go archive file to the /usr/local directory on the Linux system.
- Then, It attempts to create a directory structure in the home directory of the current user for storing Go packages and projects.
:::
2. **Configure Environment for go by modifying bashrc file**
```
sudo nano ~/.bashrc
export GOPATH=$HOME/go
export GOROOT=/usr/local/go
export PATH=$PATH:$GOPATH/bin:$GOROOT/bin
export GO111MODULE=auto
source ~/.bashrc
```



:::info
These commands are used to configure the Go programming language environment variables on a Linux system.
:::
:::spoiler
- First command opens the user's bash configuration file, .bashrc, in the Nano text editor.
- Second command sets the GOPATH environment variable to the go directory in the user's home directory.
- The GOROOT environment variable is used by Go to locate its binary files and resources.
- 'source ~/.bashrc' This command reloads the user's bash configuration file, so that the changes made in the previous steps take effect.
:::
3. **Install mongodb**
For x86 Architecture:
```
sudo apt -y update
sudo apt -y install mongodb wget git
sudo systemctl start mongodb
```
For System with ARM-based Chip:
```
sudo apt -y update
sudo apt -y install wget git
wget https://fastdl.mongodb.org/linux/mongodb-linux-aarch64-ubuntu2004-4.4.19.tgz
tar -zxvf mongodb-linux-aarch64-ubuntu2004-4.4.19.tgz
```

:::info
These commands are used to update the system package repository, install MongoDB, Git, and Wget, and start the MongoDB service.
:::
:::spoiler
- First command updates the system package repository with the latest version of available packages.
- Second command installs MongoDB, Git, and Wget on the Linux system.
- Third command starts the MongoDB service on the Linux system using the systemctl command. The start subcommand is used to start the service. Once started, MongoDB will be available for use on the system.
:::
4. **Install Control-Plane and User-Plane Supporting Packages**
```
sudo apt -y update
sudo apt -y install git gcc g++ cmake autoconf libtool pkg-config libmnl-dev libyaml-dev
```

:::info
These commands are used to update the system package repository and install several development tools and libraries on a Linux system.
:::
:::spoiler
- First command update system package repository
- Second command installs several development tools and libraries like git, gcc, g++, cmake, autoconf, libtool, etc
:::
5. **Configuration for Linux Host Network**
```
sudo sysctl -w net.ipv4.ip_forward=1
sudo iptables -t nat -A POSTROUTING -o <dn_interface> -j MASQUERADE
sudo iptables -A FORWARD -p tcp -m tcp --tcp-flags SYN,RST SYN -j TCPMSS --set-mss 1400
sudo systemctl stop ufw
```
:::warning
Replace <dn_interface> with the host interface. We can check the host interface information by typing ifconfig on terminal.
:::

:::info
These commands are used to configure network settings on a Linux system for routing and forwarding of network traffic.
:::
:::spoiler
- First command sets the net.ipv4.ip_forward kernel parameter to 1, which enables IP forwarding on the Linux system. IP forwarding allows packets to be forwarded between network interfaces on the system.
- Second command configures NAT (Network Address Translation) on the Linux system. It sets up a rule in the nat table of the iptables firewall to masquerade outgoing packets from the specified interface (<dn_interface>) with the IP address of that interface. This allows packets to be sent to the internet and return to the correct interface.
- Third command sets a rule in the iptables firewall to limit the maximum segment size (MSS) for TCP connections. It limits the MSS to 1400 bytes for packets that are part of a TCP connection. This helps to avoid issues with packet fragmentation.
- Last command stops the ufw (Uncomplicated Firewall) service on the Linux system. This is necessary because ufw may interfere with the iptables firewall rules that were just set up. By stopping ufw, the iptables rules will be the only firewall rules in effect.
:::
### Install Control Plane Elements
1. Clone Free5GC Respository
```
cd ~
git clone --recursive -b v3.2.1 -j `nproc` https://github.com/free5gc/free5gc.git
cd free5gc
```

:::info
The given commands are used to clone and navigate to the free5gc repository on a Linux system.
:::
2. Compile Network Functions in Free5GC
```
cd ~/free5gc
make
```

:::info
This command invokes the make tool to build the free5gc project.
The Makefile in the root of the project directory specifies the build process, which may involve compiling source code, linking object files, and producing executable files.
:::
:::success
Once the build process is complete, the resulting executables can be found in the relevant directories under ~/free5gc.
:::
### Install User Plane Functions (UPF)
1. Retrieve the 5G GTP-U kernel module using git and build it
```
git clone -b v0.6.8 https://github.com/free5gc/gtp5g.git
cd gtp5g
make
sudo make install
```



:::info
The given commands are used to download and install the gtp5g library on a Linux system.
:::
:::spoiler
- First command clones the gtp5g repository from GitHub onto the Linux system. The -b flag is used to specify the branch (v0.6.8) to be checked out.
- Second command navigates to the gtp5g directory that was just cloned. This directory contains the source code for the gtp5g library.
- 'make' command invokes the make tool to build the gtp5g library.
- Last command installs the gtp5g library system-wide, making it available for other programs to use. The make install command typically copies the library file to a standard location such as /usr/local/lib, and may also copy header files to a standard location such as /usr/local/include.
:::
### Install Web Console
2. **Install Node.js and Yarn**
```
sudo apt remove cmdtest
sudo apt remove yarn
curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -
echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
curl -sL https://deb.nodesource.com/setup_12.x | sudo -E bash -
sudo apt-get update
sudo apt-get install -y nodejs yarn
```




:::info
The given commands are used to install Node.js and Yarn
:::
:::spoiler
The given commands are used to install Node.js and Yarn on a Linux system. First, the cmdtest package is removed from the system, which can conflict with Node.js installations. Next, the yarn package is removed, if it is already installed. Then, the GPG public key for the Yarn repository is downloaded and added to the system's keyring, followed by adding the Yarn repository to the system's list of software sources. The Node.js repository is also added to the system's list of software sources by downloading a script from the NodeSource repository and running it with elevated privileges. After updating the package list on the system to include the newly added repositories, both Node.js and Yarn are installed on the system using the package manager. The -y flag is used to automatically confirm any prompts during installation. Once completed, Node.js and Yarn should be successfully installed on the Linux system.
:::
3. **Build Web Console**
```
cd ~/free5gc
make webconsole
```
:::info
The command 'cd ~/free5gc' changes the current directory to the free5gc directory in the user's home directory. The next command make webconsole builds the web console module of the free5gc project.
:::
:::spoiler
*The web console is a user interface that allows users to interact with the 5G Core Network's management plane. It enables the user to view and modify network configurations and monitor network status. The make webconsole command runs the build process for the web console module using the Makefile in the project's root directory*.
:::
:::warning
This command may take some time to complete depending on the system's resources and the size of the project. Once the build process is complete, the web console module should be successfully built and ready to use.
:::

4. Web Console run
```
go run server.go
```
:::info
The command go run server.go runs a Go program called server.go.
:::

5. Web Console interface


## Free5GC Testing
:::info
This section is written by Daniel and Joshevan
:::
### TestRegistration
using this code:
```
./test.sh TestRegistration
```
:::info
TestRegistration is used to register a user to the 5G Core Network by sending a registration request to the Authentication and Authorization Server (AUSF) and the Home Subscriber Server (HSS). The function handles the registration process by verifying the user's identity and authentication information, generating and storing session keys, and providing the necessary information to the other network functions for further communication.
:::
:::spoiler



:::
### TestGUTIRegistration
using this command:
```
./test.sh TestGUTIRegistration
```
:::info
TestGUTIRegistration is used to register a user using their GUTI. It sends a registration request to the MME, which verifies the GUTI and performs the necessary authentication and authorization procedures with the AUSF and HSS. Once the registration is complete, the MME assigns a permanent identity to the user, known as the Subscriber Permanent Identifier (SUPI), which is used for subsequent communication with the user.
:::
:::spoiler



:::
### TestServiceRequest
using this command:
```
./test.sh TestServiceRequest
```
:::info
TestServiceRequest is a test function that allows simulation of service requests from users in the 5G Core Network. It generates a service request message and sends it to the SEAF (Service Authorization Function) to check user authorization and network conditions. If authorized, the SEAF sends a response message to TestServiceRequest, which proceeds with setting up the necessary resources for the requested service.
:::
:::spoiler



:::
### TestXnHandover
using this command:
```
./test.sh TestXnHandover
```
:::info
Xn handover is a procedure used for transferring the data session of a user from the source base station (gNB) to the target base station (gNB) during handover. TestXnHandover simulates this process by initiating the handover procedure and exchanging messages between the source gNB, target gNB, and other network functions involved in the handover process.
:::
:::spoiler



:::
### TestDeregistration
using this command:
```
./test.sh TestDeregistration
```
:::info
TestDeregistration is a test function that enables the simulation of user deregistration by generating a deregistration request message and sending it to the AMF. It facilitates the termination of the user's connection with the network and releases the resources allocated to the user by communicating with other network functions.
:::
:::spoiler



:::
### TestPDUSessionReleaseRequest
using this command:
```
./test.sh TestPDUSessionReleaseRequest
```
:::info
TestPDUSessionReleaseRequest is a test function that attempts to simulate PDU session released by generating a release request message and sending it to the SMF. It facilitates the termination of the PDU session and releases the resources allocated to the session by communicating with other network functions.
:::
:::spoiler



:::
### TestPaging
using this command:
```
./test.sh TestPaging
```
:::info
TestPaging is a test function simulates the paging procedure by initiating the paging request, exchanging messages between the network functions involved in the process, and setting up the necessary resources for the requested service.
:::
:::spoiler



:::
### TestN2Handover
using this command:
```
./test.sh TestN2Handover
```
:::info
TestN2Handover is a test function that simulates the N2 handover procedure by exchanging messages between the source gNB, target gNB, and other network functions involved in the handover process. It facilitates the transfer of the control plane and user plane connections from the source gNB to the target gNB, while maintaining the session and routing information for the user.
:::
:::spoiler



:::
### TestNon3GPP
using this command:
```
./test.sh TestNon3GPP
```
:::info
TestNon3GPP is a function in the 5G Core Network that simulates the Non-3GPP Access procedure by initiating the registration process, exchanging messages between the network functions involved in the process, and setting up the necessary resources for the requested service.
:::
:::spoiler



:::
### TestReSynchronization
using this command:
```
./test.sh TestReSynchronization
```
:::info
TestReSynchronization is a test function that simulates the Re-Synchronization procedure by initiating the procedure, exchanging messages between the network functions involved in the process, and verifying that synchronization has been re-established between the network functions after a temporary loss of synchronization.
:::
:::spoiler



:::
### TestULCL
using this command:
```
./test_ulcl.sh TestRequestTwoPDUSessions
```
:::info
TestULCL is a test function that simulates the ULI Consolidation List (ULCL) procedure by initiating the consolidation of ULI from multiple sources into a single list, verifying that the consolidation is successful, and returning a response based on the result of the consolidation.
:::
:::spoiler



:::
## Installing UERANSIM - a UE/RAN Simulator
:::info
To install and testing the UERANSIM, we need to clone our previous VM
:::
### VM for UERANSIM
1. Clone the VM UERANSIM FROM PREVIOUS VM

2. Try to login using SSH
3. Change the hostname to ueransim
:::success
hostnamectl set-hostname ueransim
:::

4. Set Static IP Address
5. Reboot the VM Ware
:::success
sudo reboot
:::

6. Try to ping to another VM free5gc
6.1 ip address VM free5gc
![Uploading file..._1fvqugyfe]()
6.2 Ping from VM UERANSIM
![Uploading file..._ogrq4x0hl]()
### Install UERANSIM
:::info
Clone the code of installation UERANSIM from this [github](https://https://github.com/aligungr/UERANSIM)
:::
1. Using this command to install and clone the resource
```
cd ~
git clone https://github.com/aligungr/UERANSIM
cd UERANSIM
git checkout v3.1.0
```
![Uploading file..._ihfgzvc38]()
2. Update and Upgrade VM
Using this command :
```
sudo apt update
sudo apt upgrade
```
![Uploading file..._5ri4h4bj6]()
3. Install required tools:
using this command :
```
sudo apt install make
sudo apt install g++
sudo apt install libsctp-dev lksctp-tools
sudo apt install iproute2
sudo snap install cmake --classic
```
![Uploading file..._887433uwx]()
4. Build UERANSIM
Using this command :
```
cd ~/UERANSIM
make
```
![Uploading file..._23mxn3cpo]()
![Uploading file..._luhkiggux]()
### Install free5gc webconsole
:::info
To build WebConsole we need Node.js and Yarn.
:::
1. SSH to main VM
Remove obsolete tools that may exists
```
sudo apt remove cmdtest
sudo apt remove yarn
```
![Uploading file..._lhrg9rzba]()
2. Install Node.js and Yarn
```
curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -
echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
sudo apt-get update
sudo apt-get install -y nodejs yarn
```
![Uploading file..._zl3bgar68]()
3. Build WebConsole
```
cd ~/free5gc
make webconsole
```
### Use WebConsole to Add an UE
1. Start up the webconsole server
```
cd ~/free5gc/webconsole
go run server.go
```
![Uploading file..._5mjefma6i]()
:::info
The port number will be used at 5000. Try to access them using your web browser :
http://yourmainvmip:5000
For me it is :
http://172.20.10.6:5000
:::
2. Dashboard Login Page
In the login page, you can input the username of **admin** and the password is **free5gc**.
![Uploading file..._1kw8s4hvf]()
You will see the dashboard once you have login like this :
![Uploading file..._ojn8w9izz]()
Choose Subscribers and create a new data:
- Note that other than the “Operator Code Type” field which you should choose “OP” for now, leave other fields unchanged. This registration data is used for ease of testing and actual use later.
![Uploading file..._cttxal5wc]()
![Uploading file..._c7kr07bk4]()
After the data is created successfully, you can press Ctrl-C on the terminal to quit WebConsole
![Uploading file..._yelpi70vm]()
## Cloud Computing
> Written by [Bachul](https://trello.com/c/y4F0P9GR/3-%F0%9F%87%AE%F0%9F%87%A9-2023-ui-bachul-free5gc)
### What is Cloud Computing

Cloud computing is an abstraction of a computer that integrates an internet network to enable the application and use of resources without having to possess complex infrastructure or software systems in that environment. The use of cloud computing includes data storage, data processing, and applications.
In cloud computing, computing resources are provided by a cloud service provider and can be accessed by users via the internet. Users only need to pay for the resources they use, making the use of computing resources more efficient and cost-effective.
:::info
Cloud computing is like renting computer resources (storage, processing power, and applications) over the internet from a provider, instead of buying and managing them yourself. It saves you money and makes using technology more efficient.
:::
### Types of Services in Cloud Computing

There are 4 types of services in cloud computing, namely On-Premise, SaaS, PaaS, and IaaS. Each service has a different purpose and implementation, and we need to determine which service is suitable for us based on cost and environment. Here's a brief explanation:
1. On-Premise: This type of service requires us to fully manage and prepare everything from networking, storage, servers, to applications, and we need a physical server and a dedicated room for it.
2. Infrastructure as a Service (IaaS): Most of the infrastructure is managed by the provider, and we only need to manage around 60% of it, such as the operating system, middleware, and applications. We don't need to worry about the size, server, or hardware characteristics.
3. Platform as a Service (PaaS): This is where we can deploy a program or application we have created without having to install the operating system or middleware.
4. Software as a Service (SaaS): This is the simplest and easiest service for users, where we can operate the software available and enjoy the results of the application, such as Gmail, Google Docs, and others.
Example application that using cloud computing:

:::info
Choosing the right type of cloud computing service depends on factors such as the level of control and customization required, the type of application being developed, and the resources and budget available.
:::
### Deployment Model of Cloud Computing

Deployment model refers to the way in which cloud computing services are deployed and provided to users. There are four main deployment models: public cloud, private cloud, community cloud, and hybrid cloud.
1. Public Cloud: A public cloud is a deployment model where the cloud services are offered over a public network and can be used by anyone who subscribes to the service. The infrastructure is owned and operated by a third-party cloud provider, and users can access services on a pay-per-use basis.
2. Private Cloud: A private cloud is a deployment model where the cloud services are offered to a single organization or entity. The infrastructure can be owned and operated by the organization itself or by a third-party provider. Private clouds are typically used by organizations that require high levels of security and control over their data.
3. Community Cloud: A community cloud is a deployment model where the cloud services are shared by several organizations with similar requirements, such as security or compliance. The infrastructure can be owned and operated by one or more of the organizations in the community or by a third-party provider.
4. Hybrid Cloud: A hybrid cloud is a deployment model that combines two or more of the above deployment models. For example, an organization may use a private cloud for its sensitive data and a public cloud for its less sensitive data. The different clouds are integrated through standardized or proprietary technology to ensure data and application portability.
:::info
Different deployment models offer different levels of control and security, so it's important to choose one that fits your specific needs and requirements. When choosing a deployment model, consider factors such as cost, scalability, security, compliance requirements, and the level of control you need over your resources.
:::
:::warning
For the free5gc project, we will use the Amazon Web Services (AWS) platform as a tool for cloud computing.
:::
# What is Amazon Web Server
> Written by [Fateen](https://trello.com/c/gCddZXP2)
Amazon Web Services (AWS) is a cloud computing platform that provides a wide range of services to help individuals and organizations build and deploy their applications and services in the cloud. AWS is one of the largest cloud providers in the world, offering a variety of services, including computing, storage, databases, networking, analytics, machine learning, security, and more.

AWS allows users to select the specific services they need, and pay only for what they use, without needing to invest in physical hardware or infrastructure. This makes it a cost-effective solution for businesses of all sizes. Some of the most popular AWS services include Amazon Elastic Compute Cloud (EC2), Amazon Simple Storage Service (S3), Amazon Relational Database Service (RDS), Amazon Lambda, and Amazon Elastic Beanstalk.
## Services Used by Free5GC in Amazon Web Services
1. Computing:
- Amazon Elastic Compute Cloud (EC2): A web service that provides scalable compute capacity in the cloud, allowing users to run applications on virtual machines.
4. Networking and Content Delivery:
- Amazon Virtual Private Cloud (VPC): A virtual network that allows you to launch AWS resources into a virtual network that you define.
# Installing Free5GC in Amazon Web Services
> This part is done by
[Fateen](https://trello.com/c/gCddZXP2),
Naufal and Natthan
1. Make EC2 Instance in AWS

2. Create AWS account.
3. We want to create a VM. So, launch instances
::: info

:::
4. Setup the name and choose the OS
:::info

:::
5. Choose the instance type that matches Free5GC specification and cheap
:::info

:::
Also create the key pair for connecting the VM using SSH. We need to allow SSH from anywhere just to make it easy for us (it is not the best practice as far as i know)
6. Launch instance!
:::info

:::
7. The instance will be automatically started
:::info

:::
8. Click connect
:::info

:::
9. Connect with SSH client. I'm using Windows Powershell here.
:::info

:::
10. However, if we follow the command directly, it will show that the .pem key has bad permission. This is because we only want the private key to be read only.
:::info

:::
11. In Ubuntu, we should do this to our private key (.pem file)
```sh
chmod 400 free5gc-1.pem
```
This command will change the permissions of the file to read and write only for the owner, and no permissions for anyone else.
However, I'm using Windows. So, we need to disable the inheritance permission for the private key file and add full control over my username like this.
:::info

:::
12. Connect using ssh with private key
```
ssh -i "free5gc-1.pem" ubuntu@ec2-18-141-209-116.ap-southeast-1.compute.amazonaws.com
```
:::info

:::
13. Checking Golang Version
```
Go Version
```
:::info

:::
14. Installing control-plane Supporting Packages
```
sudo apt -y update
sudo apt -y install mongodb wget git
sudo systemctl start mongodb
```
:::info

:::
:::info

:::
:::info

:::
15. Installing user-plane Supporting Packages
```
sudo apt -y update
```
:::info

:::
```
sudo apt -y install git gcc g++ cmake autoconf libtool pkg-config libmnl-dev libyaml-dev
```
:::info

:::
16. Linux Host Network Settings
```
sudo sysctl -w net.ipv4.ip_forward=1
```
:::info

:::
```
sudo iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
```
:::info

:::
```
sudo iptables -A FORWARD -p tcp -m tcp --tcp-flags SYN,RST SYN -j TCPMSS --set-mss 1400
sudo systemctl stop ufw
sudo sysctl -w net.ipv4.ip_forward=1
```
:::info

:::
18. Installing Control Plan Elements
```
cd ~
git clone --recursive -b v3.2.1 -j `nproc` https://github.com/free5gc/free5gc.git
cd free5gc
```
:::info

:::
:::info

:::
```
cd ~/free5gc
make
```
:::info

:::
19. Installing User Plane Function (UPF)
```
git clone -b v0.6.8 https://github.com/free5gc/gtp5g.git
cd gtp5g
make
sudo make install
```
:::info



:::
20. Installing WebConsole
```
sudo apt remove cmdtest
sudo apt remove yarn
curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -
echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
curl -sL https://deb.nodesource.com/setup_12.x | sudo -E bash -
sudo apt-get update
sudo apt-get install -y nodejs yarn
```
:::info

:::
:::info

:::
# Testing the Free5GC in AWS
1. Prequisite
```
cd ~/free5gc
make upf
chmod +x ./test.sh
```
:::success

:::
2. Testing for Registration
:::info
Registration testing is used to send request to Access and Mobility and Management Function AMF to register the number so user can access the core network.
:::
```
./test.sh TestRegistration
```
:::success

:::
3. Testing for GUTI Registration
:::info
GUTI stands for Globally Unique Temporary Identifier. GUTI is provided by AMF. It used by sistem to increase privacy because each UE is asigned to GUTI.
:::
```
./test.sh TestGUTIRegistration
```
:::success

:::
4. Testing for service request
:::info
service request is activating user plan to have a PDU session. This request is made with UEs and AMF
:::
```
./test.sh TestServiceRequest
```
:::success

:::
5. Testing for Xn Handover
:::info
Xn Handover is a process to hand over the UEs from one gNB to other gNB closest to the UEs. this test determining where this hand over works or not.
:::
```
./test.sh TestXnHandover
```
:::success

:::
6. Testing for deregistration
:::info
Testing deregistration in Free5GC involves verifying the ability of the system to handle the request from the User Equipment (UE) or the network to unregister or remove the UE from the network.
:::
```
./test.sh TestDeregistration
```
:::success

:::
7. Testing for PDU Session Release Request
:::info
Testing PDU (Packet Data Unit) Session Release Request in Free5GC involves verifying the ability of the system to release a user's PDU session and free up network resources when the session is no longer needed.
:::
```
./test.sh TestPDUSessionReleaseRequest
```
:::success

:::
8. Testing for paging
:::info
Testing Paging in Free5GC involves verifying the ability of the system to locate and notify a user of an incoming call or message.
:::
```
./test.sh TestPaging
```
:::success

:::
9. Testing for N2 Handover
:::info
Testing N2 Handover in Free5GC involves verifying the ability of the system to handover a user's session from one Access and Mobility Management Function (AMF) to another AMF, while maintaining the continuity of the session.
:::
```
./test.sh TestN2Handover
```
:::success

:::
10. Testing for Non 3GPP
:::info
Testing Non-3GPP (Third Generation Partnership Project) access in Free5GC involves verifying the ability of the system to support communication with devices that are not based on the 3GPP standards.
:::
```
./test.sh TestNon3GPP
```
:::success

:::
:::spoiler
:::danger

error after terminating the Unified Data Management
:::
11. Testing for resynchronization
:::info
Testing resynchronization in Free5GC involves verifying the ability of the system to recover from failures or disruptions and resynchronize the state of the network elements.
:::
```
./test.sh TestReSynchronization
```
:::success

:::
12. Testing for requesting two PDU sessions
:::info
This testing is done to make sure that multiple PDU sessions is supported in the 5G Network. In an actual 5G network, a PDU session represent point to point connection between the UE and the PDN (Packet Data Network). In this case it is testing if the UE will be able to establish multiple PDU sessions.
:::
```
./test_ulcl.sh TestRequestTwoPDUSessions
```
:::success

:::
## Running Free5GC and WebConsole
1. Running WebConsole
```
cd ~/free5gc
make webconsole
```
:::success

:::
```link!
http://52.221.237.5:5000
```
:::success

:::
2. Running Free5GC
```
cd ~/free5gc
./run.sh
```
:::success

:::
:::success

:::
# Notes on Development of ORAN Strategy MNO-A Architecture Facing Merger MNO C+D Using Tactical Benchmarking in Java
## Seminar Notes
The current MNO-A now have reach the limit of its performance in terms of frequency capacity. While facing the challenge, MNO C+D merger is outrunning the MNO-A performance. On this issue, the paper have the solution to resolve this by implementing ORAN strategy in the MNO-A Architecture. By implementing ORAN, MNO-A can simplify infrastructure development strategies, including the plan of deploying 2000 sites with 323.3 MHz frequency bandwidth and service coverage operation of 26.89%. In term of cost, the investment could reduce Capex (Capital Expenses) by 36.7% and Opex (Operational Expenses) by 17.36% with business value of IRR more than 100% and BCR (Benefit Cost Ration) that exceeds 6.18 or 37% more than traditional architecture.