# Implanting Intelligence in 5G Mobile Networks--A Practical Approach
## 2 Tutorial & Background
### 5G Service Based Architecture  
The 3 GPP standardization body introduces the 5G core network architecture in the technical specification (TS 23.501) as service-based architecture (SBA), where the elementary module is the \"Service\" which defines a Network Function (NF). In SBA the architectural elements defined as NFs offer their services via interfaces of a common framework to any NFs that are allowed to make use of these provided services. The SBA realizes the flexible addition and extension of functions including proprietary ones leveraging to connect to other components without introducing specific new interfaces. The 5G SBA specified by the 3 GPP is shown in Figure 1 where several NFs are defined, such as SMF, AMF, UPF, etc. The Authentication Server Function (AUSF) uses the Extensible Authentication Protocol (EAP) for authentication; the Access and Mobility Management Function (AMF) is responsible for hosting all mobility management-related functionality and terminates the non-access stratum (NAS) and N2 reference point messages. The NAS messages are sent between the UE and the AMF for mobility management and between the UE and Session Management Function (SMF) for session management. The Network Slice Selection Function (NSSF) selects the set of network slice instances to serve the UE; the Policy Control Function (PCF) provides policy rules to the control pane functions; and the SMF controls the User Plane Function (UPF) to manage the session (e.g., session establishment, modify, and release). The Unified Data Management (UDM) stores the subscription and authentication data, and the UPF is the user plane gateway serving the UE by connecting the RAN nodes to the data network (DN). The Application Function (AF) enables dynamic policy and charging control for applications. The UE is the mobile terminal and the DN may be operator services, internet access, or third-party services [15].  
Under this architecture, real-time communication between each NF is greatly guaranteed through the central service bus connection and the communication path of each NF service can be optimized according to the demand. The communication between the NF service is realized through REST programming application interface (API) calls using a standard HTTP/2 routing mechanism. The HTTP/2 over Transmission Control Protocol (TCP) is used as the protocol to invoke the API(s). However, the access elements in the network such as Radio Access Network (RAN), UE, and NFs transferring the user plane communication still use the dedicated reference points.  
The three main components of an SBA service framework are service registration, discovery, and authentication. To execute the service framework, the Network Repository Function (NRF) is introduced. A new service registers with NRF by providing the relevant information such as the type of service and network address characteristics etc. In this way, the service acts as a service provider, allowing it to be discovered anytime it is needed. Service consumers are those who use a particular service. Therefore, the service discovery method allows a service consumer to find the right service provider while the authentication system ensures that only those who have been granted access to the service can use it [16].