# openair-cn5g-smf

It is distributed under OAI Public License V1.0. 
The license information is distributed under LICENSE file in the same directory.

The OpenAirInterface CN SMF software is composed of the following parts: 

openair-cn5g-smf
├── build:         Build directory, contains targets and object files generated by compilation of network functions. 
    ├── log:       Directory containing build log files.
    ├── scripts:   Directory containing scripts for building network functions
    └── smf:       Directory containing CMakefile.txt and object files generated by compilation of SMF network function. 
├── etc:           Directory containing the configuration file to be deployed for SMF.
└── src:           Source files of SMF.
    ├── api-server: SMF services APIs. 
    ├── common:    Common header files
    │   ├── msg:   ITTI messages definitions.
    │   └── utils: Common utilities.
    ├── gtpv1u:    Generic GTPV1-U stack implementation
    ├── gtpv2c:    Generic GTPV2-C stack implementation
    ├── itti:      Inter task interface 
    ├── nas:       NAS protocol implememtation
    ├── mgap:      NGAP protocol implememtation
    ├── oai_smf:   SMF main directory, contains the "main" CMakeLists.txt file.
    ├── pfcp:      Generic PFCP stack implementation.
    ├── smf_app:   SMF network functions procedures and contexts.
    ├── test:      Minimal implementation for AMF, UDM network functions for testing purpose.
    ├── utils:     Common utilities.   
    └── udp :      UDP server implementation.

# OAI-SMF testbed: network topology
AMF (eno1:amf 172.16.1.102)-----------------SBI interfaces-----------------(eno1:udm 172.16.1.103) UDM 
                                               |
                                               |
                                     (eno1:smf 172.16.1.101)
                                              SMF
                                     (eno1:sn4 172.16.2.101)
                                               |
                                               |
                                    (eno1:sn4 172.16.2.102)                                                        
gNB (172.16.3.101)---(eno1:s1u 172.16.3.102)UPF/SPGW-U (SGI: eno1)----------------------------DNN

## Download source code from Gitlab
git clone https://gitlab.eurecom.fr/oai/oai-cn5g-smf/
cd oai-cn5g-smf/
git checkout develop

## install dependencies
cd /oai-cn5g-smf/build/scripts
./build_smf -I -f
## build SMF
./build_smf -c -V -b Debug -j

## Create configuration file for SMF
cd /oai-cn5g-smf/build/scripts
./smf_conf.sh

## launch SMF
sudo smf -c /usr/local/etc/oai/smf.conf -o 

## Build UPF (SPGWU) and Launch UPF (SPGWU)
git clone https://github.com/OPENAIRINTERFACE/openair-cn-cups/
cd /openair-cn-cups/build/scripts
./build_spgwu -I -f
./build_spgwu -c -V -b Debug -j

#configure SPGWU using an example configure file (spgw_u.conf)
cd /oai-cn5g-smf/src/test/upf/
./spgwu_conf.sh
sudo spgwu -c /usr/local/etc/oai/spgw_u.conf  -o

## Build and launch UDM
cd /oai-cn5g-smf/src/test/udm
mkdir build
cd build
cmake ..
make
sudo ./udm-server -i 172.16.1.103

## Build and launch AMF server
cd /oai-cn5g-smf/src/test/amf
mkdir build
cd build
cmake ..
make
sudo ./amf-server -i 172.16.1.102

## Build and launch AMF client
cd /oai-cn5g-smf/src/test/amf_client
mkdir build
cd build
cmake ..
make
./amf-client -i 172.16.1.101


