# 5G Service-Based Architecture

## Summary


Cellular core networks till LTE used specialized telecom protocols running on specialized telecom hardware. With LTE vEPC, the first efforts were made towards virtualization. Service-Based Architecture (SBA) is an evolution of this approach and it's been adopted by 5G System.

In SBA, a set of Network Functions (NFs) provide services to other authorized NFs. These NFs are nothing more than software implementations running on commercial off-the-shelf hardware, possibly in the cloud. A NF can offer one or more services. NFs are interfaced via well-defined APIs and a client-server model. Traditional telecom signalling messages are replaced with API calls on a logically shared service bus. 

SBA utilizes the maturity of web and cloud technologies. Modularity, scalability, reliability, cost-effective operation, easy deployments, and faster innovation are some of the benefits of moving to SBA.

## Discussion

### Why does the 5G Core need a service-based architecture?

5G is not just about new devices, new use cases and higher speeds. The core network needs to be modernized to be able to support demanding performance requirements. eMBB, mMTC and URLLC are all different use cases that can't be satisfied by a monolithic architecture. We're expecting a massive increase in high-bandwidth content, low-latency applications and huge volumes of small data packets from IoT sensors. 

5G Core needs to be flexible, agile and scalable. User plane and control plane need to be scaled independently. Traffic handling must be optimized. Network operators must be able to quickly launch new services. This calls for virtualization, a software-driven approach and adopting web protocols and cloud technologies. The network must be composed of loosely coupled network functions that can be managed independently but interfaced efficiently via mature and scalable technologies. 

To reduce both CAPEX and OPEX, there's a need to use off-the-shelf hardware running multi-vendor software exposing open interfaces. Operators must have the flexibility to use private or public clouds. Compute and storage should be distributed. There's a need to support edge computing. 


### What are the benefits of moving to 5G SBA?

Since NFs are loosely coupled and interfaced with APIs, each NF can be evolved and deployed independently. SBA signifies a move from monolithic to **modular architecture**. New NFs can be rolled out without impacting existing ones. Via NEF, external applications can interwork with 5G Core. Across the 5G ecosystem, this enables **faster innovation**. 

SBA brings **scalability and resilience**. Rather than add physical nodes that may take weeks, new instances of NFs can be created/destroyed dynamically in minutes. If an instance or a physical node fails, monitoring systems can detect this and quickly spin up new instances.  

SBA's modular design enables **network slicing**. Multiple logical networks can run on a single physical network, thus catering to multiple industry verticals.  

In terms of true business value, Oracle has noted that, 

> SBAs provide a set of loosely coupled services that empower communications service providers (CSPs) to be more agile and enable rapid service delivery.


### What web technologies are enabling 5G SBA?

Telecom protocols common in earlier generations have been replaced in 5G Core with web technologies. SCCP, TCAP, SCTP and Diameter are some examples that have been replaced with TCP/IP for networking, HTTP/2 at the web application layer and JSON as the data serialization format. For security, TLS is used above TCP layer.  

Network functions in SBA are exposed via well-defined Service-Based Interfaces (SBIs). The bottom-up layering of L2, IP, TCP, TLS, HTTP/2 and application layers is formally called the **SBI protocol stack**. 

The interfaces themselves are defined with an Interface Definition Language (IDL) called **OpenAPI Specification**.  

Interfaces are exposed as **RESTful APIs**. 5G SBA has adopted the web's client-server model but a client is called **Service Consumer** and a server is called **Service Provider**. 

Many cloud native tools and technologies are enabling 5G SBA: Docker for containerization, Kubernetes for container orchestration, Istio for service mesh, Prometheus for monitoring, Grafana for visualization, and many more. 


### Could you describe the architecture of 5G SBA?

5G SBA is described by a **reference point representation** that names the points by which each NF connects to other NFs. In practice, the reference points are implemented by corresponding NF **Service-Based Interfaces (SBIs)**. Instead of point-to-point connections, NFs interconnect on a logically shared infrastructure or service bus. For instance, AMF and SMF are connected via the N11 reference point for which the corresponding SBIs are Namf and Nsmf. 

SBIs are defined only for the control plane. Thus, the reference point between SMF and UPF is N4. It has no equivalent SBI. Likewise, SBIs are defined for 5G Core functionality. Thus, reference points N1, N2 and N3 that involve the UE or RAN don't have SBIs. 


### Which are the main functions in 5G SBA?

5G Core has about two dozen **network functions**: Access and Mobility Management Function (AMF), Application Function (AF), Authentication Server Function (AUSF), Binding Support Function (BSF), CHarging Function (CHF), Network Data Analytics Function (NWDAF), Network Exposure Function (NEF), Network Repository Function (NRF), Network Slice Selection Function (NSSF), Network Slice Specific Authentication and Authorization Function (NSSAAF), Policy Control Function (PCF), Session Management Function (SMF), UE radio Capability Management Function (UCMF) and Unstructured Data Storage Function (UDSF), Unified Data Repository (UDR), User Plane Function (UPF) and Unified Data Management (UDM). 

Among the network **entities** are Service Communication Proxy (SCP) and Security Edge Protection Proxy (SEPP). 

For **interworking** with non-3GPP access networks, we have Non-3GPP InterWorking Function (N3IWF), Trusted Non-3GPP Gateway Function (TNGF), Wireline Access Gateway Function (W-AGF) and Trusted WLAN Interworking Function (TWIF). 

For **location services**, NFs include Location Management Function (LMF), Location Retrieval Function (LRF) and Gateway Mobile Location Centre (GMLC). 


### Could you describe some of the network functions in 5G SBA?

We note a few of Release 15 NFs: 

    + **AMF**: Registration, access control and mobility management.
    + **SMF**: Creates, updates and removes PDU sessions. Manages session context with UPF. UE IP address allocation and DHCP role.
    + **UPF**: User plane packet forwarding and routing. Anchor point for mobility.
    + **NRF**: Maintains updated records of services provided by other NFs.
    + **NEF**: Securely opens up the network to third-party applications.
    + **AUSF**: Authentication for 3GPP access and untrusted non-3GPP access.
    + **PCF**: Unified policy framework to govern network behaviour. Provides policy rules for control plane.
    + **NSSF**: Selects network slice instances for the UE. Determines AMF set to serve the UE.
    + **UDM**: Generates AKA authentication credentials. Authorizes access based on subscription data.
    + **AF**: Interfaces with 3GPP core network for traffic routing preferences, NEF access, policy framework interactions and IMS interactions.
    + **BSF**: Binds an AF request to the relevant PCF.

### Could you describe an example how services communicate in 5G SBA?

A service producer will register itself with the Network Repository Function (NRF). A service consumer will consult the NRF to discover available NF instances. Thus, the process involves **Service Registration** and **Service Discovery**. 

Once so discovered, the service consumer can **directly consume** authorized APIs exposed by the service producer. These API calls are RESTful: client-server model, stateless calls, unique URIs, and use of HTTP verbs GET/POST/PUT/PATCH/DELETE. 

**Indirect communication** is also possible via Service Communication Proxy (SCP). Service registration and discovery still happen with the NRF but this may be delegated to the SCP. Consumers send their requests through the SCP. The SCP itself doesn't expose any network function. 

Finally, it's possible to configure consumers with NF profiles of producers. This bypasses service registration and discovery. In fact, the specification identifies this as Model A. Model B is direct communication. Model C and Model D are indirect communications. 

All NF services are detailed in TS 23.502 specification. Services within an NF can call one another but their interactions are not specified in Release 16. 


### What are the challenges with 5G SBA?

**Security** is one the big challenges with many possible vulnerabilities. JSON is an exact opposite of telecom world's ASN.1. JSON specification is less rigorous and has versioning problems. Implementing and deploying OAuth 2.0 is going to be complex. The web's practice of rapid changes and CI/CD pipelines can make telecom systems less secure. REST APIs have many known vulnerabilities. There are also problems with TLS. 

Architecture, frameworks, libraries and tools need greater **maturity**. Cloud-native architecture was developed for enterprise clouds, not for telecom systems that need low downtime of few minutes per year. Kubernetes lacks networking features such as ECMP, GTP tunnelling, SCTP and LACP. In a distributed environment involving hundreds of nodes, deploying and operating OpenStack and Kubernetes for NFVI and MANO are not trivial. Complexity increases when extensions such as DPDK are included. Traditional network visibility tools must evolve to monitor at the container level.  

With NFs being developed by many vendors, integration and **interoperability** may become an issue. LTE EPC and 5G Core need to interoperate as well and shouldn't be managed in silos. Legacy OAM tools for 4G that can't handle 5G Core may lead to inefficient operations. 

## Milestones

1990

This is the decade when **Service-Oriented Architecture (SOA)** starts to gain wider adoption. Applications are not monoliths but composed of isolated and independent services. Services are loosely bound together by a standard communications framework.

2000

In this decade, **Web Services**, a web-based implementation of SOA, becomes popular over proprietary methods such as CORBA or DCOM. 

2010

Many web and cloud technologies develop and become popular through the 2010s: the term **microservices** is coined (2011); **REST** and **JSON** become the de facto standard to consume backend data (2012); **Docker** for containerization gets open sourced (2013); and Google open sources **Kubernetes**, a container orchestration system. These developments soon enable the birth of 5G's service-based architecture.

Feb  
2013

At Mobile World Congress, **Virtual Evolved Packet Core (vEPC)** solutions are showcased by NEC, Cisco and Intel. In October, NEC claims to be the world's first to offer a vEPC solution on commercial off-the-shelf (COTS) hardware based on Intel architecture. Deployment of vEPC solutions gathers pace and adoption through 2014. By 2015, operators see the value in virtualization of the core network. 

Jul  
2016

At the ÜberConf 2016 conference, Ford and Richards deliver presentations on **service-based architecture**. SOA breaks applications by layers but microservices breaks them by domain. They note that moving a monolithic application to microservices is not a trivial exercise. SBA offers a middle ground with dozens of services rather than hundreds of microservices. Services in SBA may even share a common data storage. 

Jan  
2017

3GPP publishes version 0.0.0 of *TS 23.501: System architecture for the 5G System*. In future, this is the main document that would detail 5G Core's service-based architecture. This evolves to version 1.0.0 by June. 

Dec  
2017

3GPP publishes **Release 15** "early drop". In TS 23.501, this release includes network functions and entities AUSF, AMF, UDSF, NEF, NRF, NSSF, PCF, SMF, UDM, UDR, UPF, AF, 5G-EIR and SEPP. BSF is also included in this release. 

Jan  
2018

In an interview, we come to learn that 3GPP Core Networks and Terminals (CT) Working Groups are interfacing with IETF on how to adopt **QUIC**. As a replacement to the TCP/IP stack in the 5G Core, QUIC may be considered. As of Release 16 (July 2020), QUIC isn't part of 5G Core. 

Jun  
2020

Towards supporting **Location Services (LCS)**, relevant network functions are defined in TS 23.273, version 16.0.0. These include Gateway Mobile Location Centre (GMLC), Location Retrieval Function (LRF) and Location Management Function (LMF). 

Jul  
2020

3GPP publishes **Release 16** specifications. New capabilities are NEF-based infrequent small data transfer via NAS, which will benefit MTC use cases and IoT applications; indirect communication between network services via Service Communication Proxy (SCP) and implicit discovery; support of trusted non-3GPP access; NF Set and NF Service Set; and more. New NFs include UCMF, NWDAF, CHF, N3IWF, TNGF, W-AGF. 

Jul  
2020

A study involving service providers who operator 30% of the world's commercial 5G networks shows that **Unified Data Management (UDM)** is the most tested and deployed network function. This comes from the realization that data is the new gold. Operators wish to control and monetize it.