The 5G Core presents several Network Functions, each of which has its own set of service interfaces. This is a collection of reusable service consumer libraries designed to talk to the 5G Core Network Functions using some of these service interfaces. These interfaces are based upon Open5GS v2.7.2.
In addition, command line tools are provided to demonstrate the use of these service consumer libraries.
Additional information can be found at: https://5g-mag.github.io/Getting-Started/pages/5g-core-service-consumers/
These libraries and tools are based upon the Open5GS framework.
The Binding Support Function (BSF) is responsible for maintaining a mapping between UE PDU Session and the PCF which is managing that PDU Session.
The libscbsf library aids in discovery of the BSF in the 5G Core (by interrogating the NRF) and subsequently looking
up which PCF is managing the PDU Session for a UE, identified by its IP address.
This library implements the service consumer end of the following service-based APIs:
- Nbsf_Management
The Policy Control Function (PCF) is responsible for applying charging and network policy to the PDU sessions of UEs. The Npcf_PolicyAuthorization service API is used at reference point N5 by an Application Function (AF) to request policy changes to the PDU session on behalf of the UE. This allows an Application Function to manipulate particular network QoS parameters for selected IP traffic flows within the PDU session.
The libscpcf library allows an application to connect to a PCF and request an AppSessionContext which it can then
use to manipulate the network routing policies for traffic passing across specific application flows within a UE's PDU
Session.
This library implements the service consumer end of the following service-based APIs:
- Npcf_PolicyAuthorization
The Multicast/Broadcast Session Management Function (MB-SMF) is responsible for allocating and deallocating Temporary Mobile Group Identities (TMGIs) and for the management of Multicast/Broadcast Services (MBS) on the Multicast/Broadcast User Plane Function (MB-UPF). The Nmbsmf_TMGI service API is used at reference point Nmb1 for the allocation and deallocation of TMGIs, and the Nmbsmf_MBSSession service API is used to reference point Nmb1 for the creation, modification and destruction of MBS Sessions and for the management of notification subscriptions to events arising on those MBS Sessions. This provides a Network Function with the ability to setup MBS Sessions for Multicast/Broadcast distribution to UEs and to remove those MBS Sessions once the Multicast/Broadcast channel is no longer needed.
The libscmbsmf library provides a simple create/destroy interface for TMGI management and an MBS Session and
notifications subscriptions model for management of MBS Sessions.
This library implements the service consumer end of the following service-based APIs:
- Nmbsmf_TMGI
- Nmbsmf_MBSSession
The pcf-policyauthorization tool manipulates the network Quality of Service parameters of Application Session Contexts
in the PCF by using the PCF service consumer library to invoke operations on the Npcf_PolicyAuthorization service
API.
The PCF address can be explicitly specified at the command line if this is already known. Alternatively, the tool can also use the BSF service consumer library to look up which PCF instance is managing the PDU Session of interest ( based on the IP address of a UE registered with the AMF).
The tmgi-tool provides a simple command line interface to either request the creation or destruction of a TMGI using
the interfaces provided by the MB-SMF service consumer library to invoke operations on the Nmbsmf_TMGI service
API.
The mbs-service-tool can register an MBS Session and will then wait for notifications for that MBS Session. It does
this by using the interfaces provided by the MB-SMF service consumer library to invoke operations on the
Nmbsmf_MBSSession service API.
To build and use the service consumer libraries and accompanying command line tools, you will need to install the following packages:
sudo apt install git ninja-build build-essential flex bison libsctp-dev libgnutls28-dev libgcrypt-dev libssl-dev libidn11-dev libmongoc-dev libbson-dev libyaml-dev libnghttp2-dev libmicrohttpd-dev libcurl4-gnutls-dev libnghttp2-dev libtins-dev libtalloc-dev libpcre2-dev meson cmake python3-pipRelease tar files can be downloaded from https://github.com/5G-MAG/rt-5gc-service-consumers/releases.
The source can be obtained by cloning the GitHub repository.
For example, to download the latest release you can use:
cd ~
git clone --recurse-submodules https://github.com/5G-MAG/rt-5gc-service-consumers.gitThe build process requires a working Internet connection as project dependencies are downloaded during the build.
To build the libraries and tools from the source:
cd ~/rt-5gc-service-consumers
meson build
ninja -C buildYou can optionally build documentation. For this you will need doxygen installed. If you want diagrams in the
documentation you
will also need dot and plantuml.
To install the documentation dependencies on Ubuntu use the command:
sudo apt install doxygen graphviz plantumlTo build the documentation:
cd ~/rt-5gc-service-consumers
meson setup --reconfigure build -Dbuild_docs=true
ninja -C build docsThe documentation will then be found under the ~/rt-5gc-service-consumers/build/docs directory.
To install the built libraries and tools:
cd ~/rt-5gc-service-consumers/build
sudo meson install --no-rebuildPlease refer to the Tutorials for contextual information on the use of the different libraries.
The full command help for the different tools provide information on how to use the tools:
For the PCF PolicyAuthorization tool use the command:
/usr/local/bin/pcf-policyauthorization -hFor the TMGI Allocation and Deallocation tool use the command:
/usr/local/bin/tmgi-tool -hFor the MBS Service tool use the command:
/usr/local/bin/mbs-service-tool -hThis project follows
the Gitflow workflow. The
development branch of this project serves as an integration branch for new features. Consequently, please make sure to
switch to the development branch before starting the implementation of a new feature.
Development of the BSF and PCF service consumer libraries was funded by the UK Government through the REASON project.
In case the meson version that is installed via apt does not fulfill the version requirements of this project you
will get an error like this during the build process:
meson.build:12:20: ERROR: Meson version is 1.3.2 but project requires >= 1.4.0
In this case you can run the following command to upgrade meson via python3:
sudo apt-get remove meson
sudo python3 -m pip install --break-system-packages --upgrade meson
In case the libscbsf.so.2 library is not found when trying to run one of the tools you can run the following command to find the library:
find /usr/local -name 'libscbsf.so*' 2>/dev/null
This should return the location of the library, e.g:
/usr/local/lib/x86_64-linux-gnu/libscbsf.so.1.0.0
/usr/local/lib/x86_64-linux-gnu/libscbsf.so.2.0.0
/usr/local/lib/x86_64-linux-gnu/libscbsf.so
/usr/local/lib/x86_64-linux-gnu/libscbsf.so.2
/usr/local/lib/x86_64-linux-gnu/libscbsf.so.1
Now add the path to the configuration file to make it available to the dynamic linker:
echo '/usr/local/lib/x86_64-linux-gnu' | sudo tee /etc/ld.so.conf.d/usr-local-x86_64.conf
sudo ldconfig
If you are using the Open5GS PCF, it will reject AppSessionContext requests if the Media-Type in the requested QoS is not set to
audio, video or control. It will also reject if a default PCC Rule for the 5QI associated with the Media-Type has not been
configured in the Open5GS Core. You will need a default PCC Rule for 5QI 1 for audio Media-Type, 2 for video Media-Type and 5 for
control Media-Type. You can use the Open5GS WebUI to configure the default PCC Rules for a subscriber UE.