Commit 4a0d36de authored by Tien-Thinh Nguyen's avatar Tien-Thinh Nguyen

Merge branch 'develop' into pfcp_v16.0.0

parents 9a8c723d e43b4429
# RELEASE NOTES: #
## v1.0.0 -- September 2020 ##
* Initial release
# Contributing to OpenAir-CN-5G #
We want to make contributing to this project as easy and transparent as possible.
Please refer to the steps described on our website: [How to contribute to OAI](https://www.openairinterface.org/?page_id=112)
1. Sign and return a Contributor License Agreement to OAI team.
2. Create an account on [Eurecom GiLab Server](https://gitlab.eurecom.fr/users/sign_in) if you do not have any.
- If your email domain (`@domain.com`) is not whitelisted, please contact us (mailto:contact@openairinterface.org).
- Eurecom GitLab does NOT accept public email domains.
3. Provide the `username` of this account to the OAI team (mailto:contact@openairinterface.org) so you have developer rights on this repository.
4. The policies are described in these wiki pages: [OAI Policies](https://gitlab.eurecom.fr/oai/openairinterface5g/wikis/oai-policies-home)
- You can fork onto another hosting system. But we will **NOT** accept a pull request from a forked repository.
* This decision was made for the license reasons.
* The Continuous Integration will reject your pull request.
- All pull requests SHALL have **`develop`** branch as target branch.
## Coding Styles ##
We are using `clang-format` as formatting tool on the C/C++ code.
At the time of writing (March 30th, 2020), we are using `clang-format` version 8.0.0 or above. By default, on a Ubuntu bionic Desktop edition, you would install version 6.0.0.
So it is very likely you will have to install it manually. Again, at the time of writing, the working version we found was 9.0.0.
```bash
$ wget https://releases.llvm.org/9.0.0/clang+llvm-9.0.0-x86_64-linux-gnu-ubuntu-18.04.tar.xz
$ mkdir clang_tmp
$ tar xvfJ clang+llvm-9.0.0-x86_64-linux-gnu-ubuntu-18.04.tar.xz -C ./clang_tmp
$ sudo cp clang_tmp/clang+llvm-9.0.0-x86_64-linux-gnu-ubuntu-18.04/bin/clang-format /usr/bin/clang-format
$ rm -Rf clang*
$ clang-format --version
clang-format version 9.0.0 (tags/RELEASE_900/final)
```
How to format:
```bash
$ cd myClonedWorkspace/src
$ clang-format -i theFilesYouWantToFormat
```
## License ##
By contributing to OpenAirInterface, you agree that your contributions will be licensed under the [LICENSE](LICENSE) file in the root directory of this source tree.
## Continuous Integration process ##
1. You push your modified code with the new branch onto our [official GitLab repository](https://gitlab.eurecom.fr/oai/cn5g/oai-cn5g-smf).
- Please make the name of the branch explicit and short.
2. You create a pull request from the [dedicated web page](https://gitlab.eurecom.fr/oai/cn5g/oai-cn5g-smf/-/merge_requests).
- The `target` (`base` in the web-page) branch **SHALL be `develop`**.
- The `source` (`compare` in the web-page) branch is your branch.
3. Our Continuous Integration (CI) process will be triggered automatically on your proposed modified code and check the validity.
- Check build
- Check some formatting rules
- Run a bunch of tests
4. If at least one of these steps fails, you will have to push corrections onto your source branch.
- The step 3. will be again automatically triggered on this new commit.
- Please wait that your run is finished before committing and pushing new modifications on your source branch.
- That will allow fairness on the CI usage to other contributors.
4. When this automated process passes, one of our CI administrators will review your changes or assign a senior contributor
to do a peer-review.
5. Once the peer reviewer accepts your modification, one of our CI administrators will accept and merge your pull request
- The CI will run again on the new `develop` branch commit.
- The source branch WILL be deleted by one of our CI administrators.
# openair-cn5g-smf
------------------------------------------------------------------------------
It is distributed under OAI Public License V1.0.
The license information is distributed under LICENSE file in the same directory.
OPENAIR-CN-5G
An implementation of the 5G Core network by the OpenAirInterface community.
------------------------------------------------------------------------------
OPENAIR-CN-5G is an implementation of the 3GPP specifications for the 5G Core Network.
At the moment, it contains the following network elements:
* Access and Mobility Management Function (**AMF**)
* Session Management Function (**SMF**)
* User Plane Function (**UPF**)
Each has its own repository: this repository (`oai-cn5g-smf`) is meant for SMF.
# Licence info
It is distributed under `OAI Public License V1.1`.
See [OAI Website for more details](https://www.openairinterface.org/?page_id=698).
The text for `OAI Public License V1.1` is also available under [LICENSE](LICENSE)
file at the root of this repository.
# Where to start
The Openair-CN-5G SMF code is written, executed, and tested on UBUNTU server bionic version.
Other Linux distributions support will be added later on.
More details on the supported feature set is available on this [page](docs/FEATURE_SET.md).
# Collaborative work
This source code is managed through a GITLAB server, a collaborative development platform:
* URL: [https://gitlab.eurecom.fr/oai/cn5g/oai-cn5g-smf](https://gitlab.eurecom.fr/oai/cn5g/oai-cn5g-smf).
Process is explained in [CONTRIBUTING](CONTRIBUTING.md) file.
# Contribution requests
In a general way, anybody who is willing can contribute on any part of the
code in any network component.
Contributions can be simple bugfixes, advices and remarks on the design,
architecture, coding/implementation.
# Release Notes
They are available on the [CHANGELOG](CHANGELOG.md) file.
# Repository Structure:
The OpenAirInterface CN SMF software is composed of the following parts:
<pre>
openair-cn5g-smf
├── 3gpp-specs: Directory containing 3GPP specification files (YAML) used to implement SMF network function.
├── build: Build directory, contains targets and object files generated by compilation of network functions.
......@@ -27,76 +76,4 @@ openair-cn5g-smf
├── smf_app: SMF network functions procedures and contexts.
├── test: Minimal implementation for AMF, UDM network functions for testing purpose.
└── 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
## 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
## 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
## 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
#Launch AMF client with HTTP2 (-v: http version, -p: port)
./amf-client -i 172.16.1.101 -v 2 -p 9090
</pre>
......@@ -17,12 +17,15 @@ SMF_CONF[@SMF_INTERFACE_NAME_FOR_SBI@]='ens3'
SMF_CONF[@SMF_INTERFACE_PORT_FOR_SBI@]='80'
SMF_CONF[@SMF_INTERFACE_HTTP2_PORT_FOR_SBI@]='9090'
SMF_CONF[@SMF_API_VERSION@]='v1'
SMF_CONF[@UDM_IPV4_ADDRESS@]='172.16.1.103'
SMF_CONF[@UDM_PORT@]='80'
SMF_CONF[@UDM_API_VERSION@]='v2'
SMF_CONF[@AMF_IPV4_ADDRESS@]='192.168.122.183'
SMF_CONF[@AMF_PORT@]='80'
SMF_CONF[@AMF_API_VERSION@]='v1'
SMF_CONF[@UPF_IPV4_ADDRESS@]='192.168.122.151'
......
This diff is collapsed.
......@@ -30,11 +30,14 @@ class smfConfigGen():
self.sbi_name = ''
self.sbi_port = '80'
self.sbi_http2_port = '9090'
self.sbi_api_version = 'v1'
self.n4_name = ''
self.amf_ip_addr = ''
self.amf_port = '80'
self.amf_api_version = 'v1'
self.udm_ip_addr = ''
self.udm_port = '80'
self.udm_api_version = 'v2'
self.upf_ip_addr = ''
self.apn = 'carrier.com'
self.dns1_ip = '192.168.18.129'
......@@ -68,17 +71,20 @@ class smfConfigGen():
smfFile.write('\n')
smfFile.write('SMF_CONF[@INSTANCE@]=$INSTANCE\n')
smfFile.write('SMF_CONF[@PID_DIRECTORY@]=\'/var/run\'\n')
smfFile.write('SMF_CONF[@SMF_INTERFACE_NAME_FOR_N4@]=\'' + self.n4_name + '\'\n')
smfFile.write('SMF_CONF[@SMF_INTERFACE_NAME_FOR_SBI@]=\'' + self.sbi_name + '\'\n')
smfFile.write('SMF_CONF[@SMF_INTERFACE_PORT_FOR_SBI@]=' + self.sbi_port + '\n')
smfFile.write('SMF_CONF[@SMF_INTERFACE_HTTP2_PORT_FOR_SBI@]=' + self.sbi_http2_port + '\n')
smfFile.write('SMF_CONF[@SMF_INTERFACE_NAME_FOR_N4@]=\'' + self.n4_name + '\'\n')
smfFile.write('SMF_CONF[@SMF_INTERFACE_HTTP2_PORT_FOR_SBI@]=' + self.sbi_http2_port + '\n')
smfFile.write('SMF_CONF[@SMF_API_VERSION@]=\'' + self.sbi_api_version + '\'\n')
smfFile.write('SMF_CONF[@DEFAULT_DNS_IPV4_ADDRESS@]=$MY_PRIMARY_DNS\n')
smfFile.write('SMF_CONF[@DEFAULT_DNS_SEC_IPV4_ADDRESS@]=$MY_SECONDARY_DNS\n')
#smfFile.write('SMF_CONF[@DEFAULT_APN@]=$MY_APN\n')
smfFile.write('SMF_CONF[@AMF_IPV4_ADDRESS@]=\'' + self.amf_ip_addr + '\'\n')
smfFile.write('SMF_CONF[@AMF_PORT@]=' + self.amf_port + '\n')
smfFile.write('SMF_CONF[@AMF_API_VERSION@]=\'' + self.amf_api_version + '\'\n')
smfFile.write('SMF_CONF[@UDM_IPV4_ADDRESS@]=\'' + self.udm_ip_addr + '\'\n')
smfFile.write('SMF_CONF[@UDM_PORT@]=' + self.udm_port + '\n')
smfFile.write('SMF_CONF[@UDM_API_VERSION@]=\'' + self.udm_api_version + '\'\n')
smfFile.write('SMF_CONF[@UPF_IPV4_ADDRESS@]=\'' + self.upf_ip_addr + '\'\n')
smfFile.write('\n')
smfFile.write('for K in "${!SMF_CONF[@]}"; do \n')
......
......@@ -38,6 +38,8 @@ class HtmlReport():
self.git_pull_request = False
self.git_target_branch = ''
self.git_target_commit = ''
self.nb_warnings = 0
self.warning_rows = ''
def generate(self):
cwd = os.getcwd()
......@@ -359,6 +361,20 @@ class HtmlReport():
def buildSummaryFooter(self):
self.file.write(' </table>\n')
self.file.write(' <br>\n')
if self.nb_warnings > 0:
self.file.write(' <h3>Compilation Warnings Details</h3>\n')
self.file.write(' <button data-toggle="collapse" data-target="#oai-compilation-details">Details for Compilation Errors and Warnings </button>\n')
self.file.write(' <div id="oai-compilation-details" class="collapse">\n')
self.file.write(' <table class="table-bordered">\n')
self.file.write(' <tr bgcolor = "#33CCFF" >\n')
self.file.write(' <th>File</th>\n')
self.file.write(' <th>Line Number</th>\n')
self.file.write(' <th>Status</th>\n')
self.file.write(' <th>Message</th>\n')
self.file.write(self.warning_rows)
self.file.write(' </tr>\n')
self.file.write(' </table>\n')
self.file.write(' </div>\n')
def testBuildSummaryHeader(self):
self.file.write(' <h2>Test Images Build Summary</h2>\n')
......@@ -661,6 +677,15 @@ class HtmlReport():
result = re.search('warning:', line)
if result is not None:
nb_warnings += 1
if nfType == 'SMF':
correctLine = re.sub("^.*/openair-smf","/openair-smf",line.strip())
wordsList = correctLine.split(None,2)
filename = re.sub(":[0-9]*:[0-9]*:","", wordsList[0])
linenumber = re.sub(filename + ':',"", wordsList[0])
linenumber = re.sub(':[0-9]*:',"", linenumber)
error_warning_status = re.sub(':',"", wordsList[1])
error_warning_msg = re.sub('^.*' + error_warning_status + ':', '', correctLine)
self.warning_rows += '<tr><td>' + filename + '</td><td>' + linenumber + '</td><td>' + error_warning_status + '</td><td>' + error_warning_msg + '</td></tr>\n'
logfile.close()
if nb_warnings == 0 and nb_errors == 0:
cell_msg = ' <td bgcolor="LimeGreen"><pre style="border:none; background-color:LimeGreen"><b>'
......@@ -671,6 +696,8 @@ class HtmlReport():
if nb_errors > 0:
cell_msg += str(nb_errors) + ' errors found in compile log\n'
cell_msg += str(nb_warnings) + ' warnings found in compile log</b></pre></td>\n'
if nfType == 'SMF':
self.nb_warnings = nb_warnings
else:
cell_msg = ' <td bgcolor="Tomato"><pre style="border:none; background-color:Tomato"><b>'
cell_msg += 'KO: logfile (' + logFileName + ') not found</b></pre></td>\n'
......@@ -816,7 +843,7 @@ class HtmlReport():
if section_status:
if nfType == 'SMF':
if self.git_pull_request:
result = re.search('oai-smf *ci-temp', line)
result = re.search('oai-smf *ci-tmp', line)
else:
result = re.search('oai-smf *develop', line)
if nfType == 'AMF-Server':
......
......@@ -30,13 +30,7 @@
#---------------------------------------------------------------------
FROM ubuntu:bionic as oai-smf-builder
ARG EURECOM_PROXY
ARG GITLAB_USERNAME
ARG GITLAB_PASSWORD
ARG BUILD_FOR_CI
ARG CI_SRC_BRANCH
ARG CI_SRC_COMMIT
ARG CI_DEST_BRANCH
ARG NEEDED_GIT_PROXY
ENV DEBIAN_FRONTEND=noninteractive
ENV TZ=Europe
......@@ -47,17 +41,13 @@ RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get upgrade --yes && DE
&& rm -rf /var/lib/apt/lists/*
# Some GIT configuration command quite useful
RUN /bin/bash -c "if [[ -v EURECOM_PROXY ]]; then git config --global http.proxy $EURECOM_PROXY; fi"
RUN /bin/bash -c "if [[ -v NEEDED_GIT_PROXY ]]; then git config --global http.proxy $NEEDED_GIT_PROXY; fi"
RUN git config --global https.postBuffer 123289600
RUN git config --global http.sslverify false
# In normal case, we build out of the develop branch
RUN /bin/bash -c "if [[ -v CI_SRC_BRANCH ]]; then git clone https://$GITLAB_USERNAME:$GITLAB_PASSWORD@gitlab.eurecom.fr/oai/cn5g/oai-cn5g-smf.git -b $CI_SRC_BRANCH /openair-smf; else git clone https://$GITLAB_USERNAME:$GITLAB_PASSWORD@gitlab.eurecom.fr/oai/cn5g/oai-cn5g-smf.git -b develop /openair-smf; fi"
# For CI, especially for Pull/Merge Requests, we build out of temp merge
# Copying source code
WORKDIR /openair-smf
RUN /bin/bash -c "if [[ -v BUILD_FOR_CI ]]; then git config --global user.name \"OAI CI\"; fi"
RUN /bin/bash -c "if [[ -v BUILD_FOR_CI ]]; then git config --global user.email ci@openairinterface.org; fi"
RUN /bin/bash -c "if [[ -v BUILD_FOR_CI ]]; then git checkout -f $CI_SRC_COMMIT; fi"
RUN /bin/bash -c "if [[ -v BUILD_FOR_CI ]]; then git merge --ff origin/$CI_DEST_BRANCH -m \"Temporary merge for CI\"; fi"
COPY . /openair-smf
# Installing and Building SMF
WORKDIR /openair-smf/build/scripts
......
......@@ -28,40 +28,9 @@
#---------------------------------------------------------------------
# BUILDER IMAGE
#---------------------------------------------------------------------
FROM ubuntu:bionic as oai-smf-builder
FROM oai-smf-builder-installed:latest as oai-smf-builder
ARG EURECOM_PROXY
ARG GITLAB_USERNAME
ARG GITLAB_PASSWORD
ARG BUILD_FOR_CI
ARG CI_SRC_BRANCH
ARG CI_SRC_COMMIT
ARG CI_DEST_BRANCH
ENV DEBIAN_FRONTEND=noninteractive
ENV TZ=Europe
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get upgrade --yes && DEBIAN_FRONTEND=noninteractive apt-get install --yes \
psmisc \
git \
&& rm -rf /var/lib/apt/lists/*
# Some GIT configuration command quite useful
RUN /bin/bash -c "if [[ -v EURECOM_PROXY ]]; then git config --global http.proxy $EURECOM_PROXY; fi"
RUN git config --global https.postBuffer 123289600
RUN git config --global http.sslverify false
# In normal case, we build out of the develop branch
RUN /bin/bash -c "if [[ -v CI_SRC_BRANCH ]]; then git clone https://$GITLAB_USERNAME:$GITLAB_PASSWORD@gitlab.eurecom.fr/oai/cn5g/oai-cn5g-smf.git -b $CI_SRC_BRANCH /openair-smf; else git clone https://$GITLAB_USERNAME:$GITLAB_PASSWORD@gitlab.eurecom.fr/oai/cn5g/oai-cn5g-smf.git -b develop /openair-smf; fi"
# For CI, especially for Pull/Merge Requests, we build out of temp merge
WORKDIR /openair-smf
RUN /bin/bash -c "if [[ -v BUILD_FOR_CI ]]; then git config --global user.name \"OAI CI\"; fi"
RUN /bin/bash -c "if [[ -v BUILD_FOR_CI ]]; then git config --global user.email ci@openairinterface.org; fi"
RUN /bin/bash -c "if [[ -v BUILD_FOR_CI ]]; then git checkout -f $CI_SRC_COMMIT; fi"
RUN /bin/bash -c "if [[ -v BUILD_FOR_CI ]]; then git merge --ff origin/$CI_DEST_BRANCH -m \"Temporary merge for CI\"; fi"
# Installing and Building SMF
WORKDIR /openair-smf/build/scripts
RUN ./build_smf --install-deps --force
# Building AMF-Client
WORKDIR /openair-smf/src/test/amf_client
RUN mkdir build && cd build && cmake .. && make
......
......@@ -28,40 +28,9 @@
#---------------------------------------------------------------------
# BUILDER IMAGE
#---------------------------------------------------------------------
FROM ubuntu:bionic as oai-smf-builder
FROM oai-smf-builder-installed:latest as oai-smf-builder
ARG EURECOM_PROXY
ARG GITLAB_USERNAME
ARG GITLAB_PASSWORD
ARG BUILD_FOR_CI
ARG CI_SRC_BRANCH
ARG CI_SRC_COMMIT
ARG CI_DEST_BRANCH
ENV DEBIAN_FRONTEND=noninteractive
ENV TZ=Europe
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get upgrade --yes && DEBIAN_FRONTEND=noninteractive apt-get install --yes \
psmisc \
git \
&& rm -rf /var/lib/apt/lists/*
# Some GIT configuration command quite useful
RUN /bin/bash -c "if [[ -v EURECOM_PROXY ]]; then git config --global http.proxy $EURECOM_PROXY; fi"
RUN git config --global https.postBuffer 123289600
RUN git config --global http.sslverify false
# In normal case, we build out of the develop branch
RUN /bin/bash -c "if [[ -v CI_SRC_BRANCH ]]; then git clone https://$GITLAB_USERNAME:$GITLAB_PASSWORD@gitlab.eurecom.fr/oai/cn5g/oai-cn5g-smf.git -b $CI_SRC_BRANCH /openair-smf; else git clone https://$GITLAB_USERNAME:$GITLAB_PASSWORD@gitlab.eurecom.fr/oai/cn5g/oai-cn5g-smf.git -b develop /openair-smf; fi"
# For CI, especially for Pull/Merge Requests, we build out of temp merge
WORKDIR /openair-smf
RUN /bin/bash -c "if [[ -v BUILD_FOR_CI ]]; then git config --global user.name \"OAI CI\"; fi"
RUN /bin/bash -c "if [[ -v BUILD_FOR_CI ]]; then git config --global user.email ci@openairinterface.org; fi"
RUN /bin/bash -c "if [[ -v BUILD_FOR_CI ]]; then git checkout -f $CI_SRC_COMMIT; fi"
RUN /bin/bash -c "if [[ -v BUILD_FOR_CI ]]; then git merge --ff origin/$CI_DEST_BRANCH -m \"Temporary merge for CI\"; fi"
# Installing and Building SMF
WORKDIR /openair-smf/build/scripts
RUN ./build_smf --install-deps --force
# Building AMF-Server
WORKDIR /openair-smf/src/test/amf
RUN mkdir build && cd build && cmake .. && make
......
......@@ -28,40 +28,9 @@
#---------------------------------------------------------------------
# BUILDER IMAGE
#---------------------------------------------------------------------
FROM ubuntu:bionic as oai-smf-builder
FROM oai-smf-builder-installed:latest as oai-smf-builder
ARG EURECOM_PROXY
ARG GITLAB_USERNAME
ARG GITLAB_PASSWORD
ARG BUILD_FOR_CI
ARG CI_SRC_BRANCH
ARG CI_SRC_COMMIT
ARG CI_DEST_BRANCH
ENV DEBIAN_FRONTEND=noninteractive
ENV TZ=Europe
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get upgrade --yes && DEBIAN_FRONTEND=noninteractive apt-get install --yes \
psmisc \
git \
&& rm -rf /var/lib/apt/lists/*
# Some GIT configuration command quite useful
RUN /bin/bash -c "if [[ -v EURECOM_PROXY ]]; then git config --global http.proxy $EURECOM_PROXY; fi"
RUN git config --global https.postBuffer 123289600
RUN git config --global http.sslverify false
# In normal case, we build out of the develop branch
RUN /bin/bash -c "if [[ -v CI_SRC_BRANCH ]]; then git clone https://$GITLAB_USERNAME:$GITLAB_PASSWORD@gitlab.eurecom.fr/oai/cn5g/oai-cn5g-smf.git -b $CI_SRC_BRANCH /openair-smf; else git clone https://$GITLAB_USERNAME:$GITLAB_PASSWORD@gitlab.eurecom.fr/oai/cn5g/oai-cn5g-smf.git -b develop /openair-smf; fi"
# For CI, especially for Pull/Merge Requests, we build out of temp merge
WORKDIR /openair-smf
RUN /bin/bash -c "if [[ -v BUILD_FOR_CI ]]; then git config --global user.name \"OAI CI\"; fi"
RUN /bin/bash -c "if [[ -v BUILD_FOR_CI ]]; then git config --global user.email ci@openairinterface.org; fi"
RUN /bin/bash -c "if [[ -v BUILD_FOR_CI ]]; then git checkout -f $CI_SRC_COMMIT; fi"
RUN /bin/bash -c "if [[ -v BUILD_FOR_CI ]]; then git merge --ff origin/$CI_DEST_BRANCH -m \"Temporary merge for CI\"; fi"
# Installing and Building SMF
WORKDIR /openair-smf/build/scripts
RUN ./build_smf --install-deps --force
# Building UDM-server
WORKDIR /openair-smf/src/test/udm
RUN mkdir build && cd build && cmake .. && make
......
......@@ -39,7 +39,7 @@ Based on document **3GPP TS 23.501 v16.0.0 §6.2.2**.
| **ID** | **Classification** | **Status** | **Comments** |
| ------ | ------------------------------------------------------------------- | ------------------ | ------------------------------------------- |
| 1 | Session Management (Session Establishment/Modification/Release) | :heavy_check_mark: | |
| 2 | UE IP address allocation & management​ | :heavy_check_mark: | Only support static ipv4 address allocation |
| 2 | UE IP address allocation & management​ | :heavy_check_mark: | IP Address pool is controlled by SMF |
| 3 | DHCPv4 (server and client) and DHCPv6 (server and client) function | :x: | |
| 4 | Respond to ARP requests and/or IPv6 Neighbour Solicitation requests | :x: | |
| 5 | Selection of UPF function​ | :heavy_check_mark: | Local configuration in SMF |
......
......@@ -21,26 +21,26 @@
SMF =
{
INSTANCE = @INSTANCE@; # 0 is the default
PID_DIRECTORY = "@PID_DIRECTORY@"; # /var/run is the default
INSTANCE = @INSTANCE@; # 0 is the default
PID_DIRECTORY = "@PID_DIRECTORY@"; # /var/run is the default
INTERFACES :
{
N4 :
{
# SMF binded interface for N4 communication (UPF)
INTERFACE_NAME = "@SMF_INTERFACE_NAME_FOR_N4@"; # STRING, interface name
IPV4_ADDRESS = "read"; # STRING, CIDR or "read" to let app read interface configured IP address
INTERFACE_NAME = "@SMF_INTERFACE_NAME_FOR_N4@"; # YOUR NETWORK CONFIG HERE
IPV4_ADDRESS = "read";
};
SBI :
{
# SMF binded interface for SBI interface (e.g., communication with AMF, UDM)
INTERFACE_NAME = "@SMF_INTERFACE_NAME_FOR_SBI@"; # STRING, interface name
#IPV4_ADDRESS = "@SMF_INTERFACE_IPV4_ADDRESS_FOR_SBI@"; # STRING, CIDR or "read" to let app read interface configured IP address
IPV4_ADDRESS = "read";
PORT = @SMF_INTERFACE_PORT_FOR_SBI@; #Normally we don't need this (default port 80)
HTTP2_PORT = @SMF_INTERFACE_HTTP2_PORT_FOR_SBI@;
INTERFACE_NAME = "@SMF_INTERFACE_NAME_FOR_SBI@"; # YOUR NETWORK CONFIG HERE
IPV4_ADDRESS = "read";
PORT = @SMF_INTERFACE_PORT_FOR_SBI@; # YOUR NETWORK CONFIG HERE (default: 80)
HTTP2_PORT = @SMF_INTERFACE_HTTP2_PORT_FOR_SBI@; # YOUR NETWORK CONFIG HERE
API_VERSION = "@SMF_API_VERSION@"; # YOUR SMF API VERSION CONFIG HERE
};
};
......@@ -48,62 +48,64 @@ SMF =
# Pool of UE assigned IP addresses
# Do not make IP pools overlap
# first IPv4 address X.Y.Z.1 is reserved for GTP network device on SPGW
# Normally no more than 96 pools allowed, but for non OVS GTP solution, only one pool allowed (TODO).
# first IPv4 address X.Y.Z.1 is reserved for GTP network device on UPF
IP_ADDRESS_POOL :
{
IPV4_LIST = (
{RANGE = "12.1.1.2 - 12.1.1.128";}, # STRING, IPv4 RANGE IP_start - IP_end, YOUR NETWORK CONFIG HERE.
{RANGE = "12.1.1.129 - 12.1.1.224";}, # STRING, IPv4 RANGE IP_start - IP_end, YOUR NETWORK CONFIG HERE.
{RANGE = "192.169.0.2 - 192.169.255.253";}, # STRING, IPv4 RANGE IP_start - IP_end, YOUR NETWORK CONFIG HERE.
{RANGE = "192.170.0.2 - 192.170.255.253";}, # STRING, IPv4 RANGE IP_start - IP_end, YOUR NETWORK CONFIG HERE.
{RANGE = "192.171.0.2 - 192.171.255.253";} # STRING, IPv4 RANGE IP_start - IP_end, YOUR NETWORK CONFIG HERE.
{RANGE = "12.1.1.2 - 12.1.1.128";}, # STRING, IPv4 RANGE IP_start - IP_end, YOUR NETWORK CONFIG HERE.
{RANGE = "12.1.1.129 - 12.1.1.224";}, # STRING, IPv4 RANGE IP_start - IP_end, YOUR NETWORK CONFIG HERE.
{RANGE = "192.169.0.2 - 192.169.255.253";}, # STRING, IPv4 RANGE IP_start - IP_end, YOUR NETWORK CONFIG HERE.
{RANGE = "192.170.0.2 - 192.170.255.253";}, # STRING, IPv4 RANGE IP_start - IP_end, YOUR NETWORK CONFIG HERE.
{RANGE = "192.171.0.2 - 192.171.255.253";} # STRING, IPv4 RANGE IP_start - IP_end, YOUR NETWORK CONFIG HERE.
);
IPV6_LIST = (
{PREFIX = "2001:1:2::/64";}, # STRING, IPv6 prefix, YOUR NETWORK CONFIG HERE.
{PREFIX = "3001:1:2::/64";}, # STRING, IPv6 prefix, YOUR NETWORK CONFIG HERE.
{PREFIX = "4001:1:2::/64";} # STRING, IPv6 prefix, YOUR NETWORK CONFIG HERE.
{PREFIX = "2001:1:2::/64";}, # STRING, IPv6 prefix, YOUR NETWORK CONFIG HERE.
{PREFIX = "3001:1:2::/64";}, # STRING, IPv6 prefix, YOUR NETWORK CONFIG HERE.
{PREFIX = "4001:1:2::/64";} # STRING, IPv6 prefix, YOUR NETWORK CONFIG HERE.
);
};
DNN_LIST = (
# IPV4_POOL, IPV6_POOL are index in IPV4_LIST, IPV6_LIST, PDN_TYPE choice in {IPv4, IPv6, IPv4v6}
{DNN_NI = "default"; PDN_TYPE = "IPv4"; IPV4_POOL = 0; IPV6_POOL = -1},
{DNN_NI = "carrier.com"; PDN_TYPE = "IPv4"; IPV4_POOL = 1; IPV6_POOL = -1},
{DNN_NI = "apn2"; PDN_TYPE = "IPv4"; IPV4_POOL = 2; IPV6_POOL = -1},
{DNN_NI = "apn3"; PDN_TYPE = "IPv4"; IPV4_POOL = 3; IPV6_POOL = -1},
{DNN_NI = "apn4"; PDN_TYPE = "IPv4"; IPV4_POOL = 4; IPV6_POOL = -1}
# IPV4_POOL, IPV6_POOL are index in IPV4_LIST, IPV6_LIST, PDU_SESSION_TYPE choice in {IPv4, IPv6, IPv4v6}
{DNN_NI = "default"; PDU_SESSION_TYPE = "IPv4"; IPV4_POOL = 0; IPV6_POOL = -1},
{DNN_NI = "carrier.com"; PDU_SESSION_TYPE = "IPv4"; IPV4_POOL = 1; IPV6_POOL = -1},
{DNN_NI = "apn2"; PDU_SESSION_TYPE = "IPv4"; IPV4_POOL = 2; IPV6_POOL = -1},
{DNN_NI = "apn3"; PDU_SESSION_TYPE = "IPv4"; IPV4_POOL = 3; IPV6_POOL = -1},
{DNN_NI = "apn4"; PDU_SESSION_TYPE = "IPv4"; IPV4_POOL = 4; IPV6_POOL = -1}
);
# DNS address communicated to UEs
DEFAULT_DNS_IPV4_ADDRESS = "@DEFAULT_DNS_IPV4_ADDRESS@"; # YOUR NETWORK CONFIG HERE
DEFAULT_DNS_SEC_IPV4_ADDRESS = "@DEFAULT_DNS_SEC_IPV4_ADDRESS@"; # YOUR NETWORK CONFIG HERE
DEFAULT_DNS_IPV6_ADDRESS = "2001:4860:4860::8888"; # FFU
DEFAULT_DNS_SEC_IPV6_ADDRESS = "2001:4860:4860::8844"; # FFU
DEFAULT_DNS_IPV4_ADDRESS = "@DEFAULT_DNS_IPV4_ADDRESS@"; # YOUR DNS CONFIG HERE
DEFAULT_DNS_SEC_IPV4_ADDRESS = "@DEFAULT_DNS_SEC_IPV4_ADDRESS@"; # YOUR DNS CONFIG HERE
DEFAULT_DNS_IPV6_ADDRESS = "2001:4860:4860::8888"; # YOUR DNS CONFIG HERE
DEFAULT_DNS_SEC_IPV6_ADDRESS = "2001:4860:4860::8844"; # YOUR DNS CONFIG HERE
# Non standard feature, normally should be set to "no", but you may need to set to yes for UE that do not explicitly request a PDN address through NAS signalling
FORCE_PUSH_PROTOCOL_CONFIGURATION_OPTIONS = "no"; # STRING, {"yes", "no"}.
FORCE_PUSH_PROTOCOL_CONFIGURATION_OPTIONS = "no"; # STRING, {"yes", "no"}.
AMF :
{
IPV4_ADDRESS="@AMF_IPV4_ADDRESS@";
PORT = @AMF_PORT@; #should be removed (default: 80)
IPV4_ADDRESS = "@AMF_IPV4_ADDRESS@"; # YOUR AMF CONFIG HERE
PORT = @AMF_PORT@; # YOUR AMF CONFIG HERE (default: 80)
API_VERSION = "@AMF_API_VERSION@"; # YOUR SMF API VERSION FOR SBI CONFIG HERE
};
UDM :
{
IPV4_ADDRESS="@UDM_IPV4_ADDRESS@";
PORT = @UDM_PORT@; #should be removed (default 80)
IPV4_ADDRESS = "@UDM_IPV4_ADDRESS@"; # YOUR UDM CONFIG HERE
PORT = @UDM_PORT@; # YOUR UDM CONFIG HERE (default: 80)
API_VERSION = "@UDM_API_VERSION@"; # YOUR UDM API VERSION FOR SBI CONFIG HERE
};
UPF_LIST = (
{IPV4_ADDRESS="@UPF_IPV4_ADDRESS@" ;}
{IPV4_ADDRESS = "@UPF_IPV4_ADDRESS@" ;} # YOUR UPF CONFIG HERE
);
LOCAL_CONFIGURATION :
{
USE_LOCAL_CONFIGURATION = "yes";
SESSION_MANAGEMENT_SUBSCRIPTION_LIST = (
{ NSSAI_SST = 222; NSSAI_SD = "123", DNN = "default", DEFAULT_SESSION_TYPE = "IPV4", DEFAULT_SSC_MODE = 1,
{ NSSAI_SST = 222, NSSAI_SD = "123", DNN = "default", DEFAULT_SESSION_TYPE = "IPV4", DEFAULT_SSC_MODE = 1,
QOS_PROFILE_5QI = 6, QOS_PROFILE_PRIORITY_LEVEL = 1, QOS_PROFILE_ARP_PRIORITY_LEVEL = 1, QOS_PROFILE_ARP_PREEMPTCAP = "NOT_PREEMPT",
QOS_PROFILE_ARP_PREEMPTVULN = "NOT_PREEMPTABLE", SESSION_AMBR_UL = "20Mbps", SESSION_AMBR_DL = "22Mbps"},
{ NSSAI_SST = 222; NSSAI_SD = "123", DNN = "carrier.com", DEFAULT_SESSION_TYPE = "IPV4", DEFAULT_SSC_MODE = 1,
......
################################################################################
# Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The OpenAirInterface Software Alliance licenses this file to You under
# the OAI Public License, Version 1.1 (the "License"); you may not use this file
# except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.openairinterface.org/?page_id=698
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#-------------------------------------------------------------------------------
# For more information about the OpenAirInterface (OAI) Software Alliance:
# contact@openairinterface.org
################################################################################
set(SMF_API_SERVER_DIR "${SRC_TOP_DIR}/api-server")
include_directories(${SMF_API_SERVER_DIR}/api)
......
......@@ -12,6 +12,9 @@
#include "IndividualPDUSessionHSMFApi.h"
#include "Helpers.h"
#include "smf_config.hpp"
extern smf::smf_config smf_cfg;
namespace oai {
namespace smf_server {
......@@ -34,12 +37,12 @@ void IndividualPDUSessionHSMFApi::setupRoutes() {
Routes::Post(
*router,
base + "/pdu-sessions/:pduSessionRef/release",
base + smf_cfg.sbi_api_version + "/pdu-sessions/:pduSessionRef/release",
Routes::bind(&IndividualPDUSessionHSMFApi::release_pdu_session_handler,
this));
Routes::Post(
*router,
base + "/pdu-sessions/:pduSessionRef/modify",
base + smf_cfg.sbi_api_version + "/pdu-sessions/:pduSessionRef/modify",
Routes::bind(&IndividualPDUSessionHSMFApi::update_pdu_session_handler,
this));
......
......@@ -18,6 +18,7 @@
#ifndef IndividualPDUSessionHSMFApi_H_
#define IndividualPDUSessionHSMFApi_H_
#include <string>
#include <pistache/http.h>
#include <pistache/router.h>
#include <pistache/http_headers.h>
......@@ -28,7 +29,6 @@
#include "HsmfUpdatedData.h"
#include "ProblemDetails.h"
#include "ReleaseData.h"
#include <string>
namespace oai {
namespace smf_server {
......@@ -43,7 +43,7 @@ class IndividualPDUSessionHSMFApi {
}
void init();
const std::string base = "/nsmf-pdusession/v1";
const std::string base = "/nsmf-pdusession/";
private:
void setupRoutes();
......
......@@ -44,6 +44,9 @@
#include "logger.hpp"
#include "Helpers.h"
#include "mime_parser.hpp"
#include "smf_config.hpp"
extern smf::smf_config smf_cfg;
namespace oai {
namespace smf_server {
......@@ -65,13 +68,13 @@ void IndividualSMContextApi::setupRoutes() {
using namespace Pistache::Rest;
Routes::Post(
*router, base + "/sm-contexts/:smContextRef/release",
*router, base + smf_cfg.sbi_api_version + "/sm-contexts/:smContextRef/release",
Routes::bind(&IndividualSMContextApi::release_sm_context_handler, this));
Routes::Post(
*router, base + "/sm-contexts/:smContextRef/retrieve",
*router, base + smf_cfg.sbi_api_version + "/sm-contexts/:smContextRef/retrieve",
Routes::bind(&IndividualSMContextApi::retrieve_sm_context_handler, this));
Routes::Post(
*router, base + "/sm-contexts/:smContextRef/modify",
*router, base + smf_cfg.sbi_api_version + "/sm-contexts/:smContextRef/modify",
Routes::bind(&IndividualSMContextApi::update_sm_context_handler, this));
// Default handler, called when a route is not found
......
......@@ -71,7 +71,7 @@ class IndividualSMContextApi {
}
void init();
const std::string base = "/nsmf-pdusession/v1";
const std::string base = "/nsmf-pdusession/";
private:
void setupRoutes();
......
......@@ -12,6 +12,9 @@
#include "PDUSessionsCollectionApi.h"
#include "Helpers.h"
#include "smf_config.hpp"
extern smf::smf_config smf_cfg;
namespace oai {
namespace smf_server {
......@@ -33,7 +36,7 @@ void PDUSessionsCollectionApi::setupRoutes() {
using namespace Pistache::Rest;
Routes::Post(
*router, base + "/pdu-sessions",
*router, base + smf_cfg.sbi_api_version + "/pdu-sessions",
Routes::bind(&PDUSessionsCollectionApi::post_pdu_sessions_handler, this));
// Default handler, called when a route is not found
......
......@@ -41,7 +41,7 @@ class PDUSessionsCollectionApi {
}
void init();
const std::string base = "/nsmf-pdusession/v1";
const std::string base = "/nsmf-pdusession/";
private:
void setupRoutes();
......
......@@ -44,6 +44,9 @@
#include "logger.hpp"
#include "Helpers.h"
#include "mime_parser.hpp"
#include "smf_config.hpp"
extern smf::smf_config smf_cfg;
namespace oai {
namespace smf_server {
......@@ -65,7 +68,7 @@ void SMContextsCollectionApi::setupRoutes() {
using namespace Pistache::Rest;
Routes::Post(
*router, base + "/sm-contexts",
*router, base + smf_cfg.sbi_api_version + "/sm-contexts",
Routes::bind(&SMContextsCollectionApi::post_sm_contexts_handler, this));
// Default handler, called when a route is not found
......
......@@ -62,7 +62,7 @@ class SMContextsCollectionApi {
}
void init();
const std::string base = "/nsmf-pdusession/v1";
const std::string base = "/nsmf-pdusession/";
private:
void setupRoutes();
......
......@@ -37,6 +37,9 @@
#include "itti_msg_n11.hpp"
#include "3gpp_29.502.h"
#include <nghttp2/asio_http2_server.h>
#include "smf_config.hpp"
extern smf::smf_config smf_cfg;
namespace oai {
namespace smf_server {
......@@ -75,7 +78,7 @@ void SMContextsCollectionApiImpl::post_sm_contexts(
//set N1 SM Message
sm_context_req_msg.set_n1_sm_message(n1_sm_msg);
//set api root to be used as location header in HTTP response
sm_context_req_msg.set_api_root(m_address + base + "/sm-contexts");
sm_context_req_msg.set_api_root(m_address + base + smf_cfg.sbi_api_version + "/sm-contexts");
//supi
supi_t supi = { .length = 0 };
......
......@@ -40,18 +40,21 @@
#include "3gpp_29.502.h"
#include "mime_parser.hpp"
#include "3gpp_29.500.h"
#include "smf_config.hpp"
using namespace nghttp2::asio_http2;
using namespace nghttp2::asio_http2::server;
using namespace oai::smf_server::model;
extern smf::smf_config smf_cfg;
//------------------------------------------------------------------------------
void smf_http2_server::start() {
boost::system::error_code ec;
Logger::smf_api_server().info("HTTP2 server started");
//Create SM Context Request
server.handle(NSMF_PDU_SESSION_SM_CONTEXT_CREATE_URL,
server.handle(NSMF_PDU_SESSION_BASE + smf_cfg.sbi_api_version + NSMF_PDU_SESSION_SM_CONTEXT_CREATE_URL,
[&](const request &request, const response &response) {
request.on_data([&](const uint8_t *data, std::size_t len) {
......@@ -131,7 +134,7 @@ void smf_http2_server::start() {
});
//Update SM Context Request
server.handle(NSMF_PDU_SESSION_SM_CONTEXT_UPDATE_URL,
server.handle(NSMF_PDU_SESSION_BASE + smf_cfg.sbi_api_version + NSMF_PDU_SESSION_SM_CONTEXT_UPDATE_URL,
[&](const request &request, const response &response) {
request.on_data([&](const uint8_t *data, std::size_t len) {
......@@ -292,7 +295,7 @@ void smf_http2_server::create_sm_contexts_handler(
//set api root to be used as location header in HTTP response
sm_context_req_msg.set_api_root(
m_address + ":" + std::to_string(m_port)
+ "/nsmf-pdusession/v1/sm-context");
+ "/nsmf-pdusession/" + smf_cfg.sbi_api_version + "/sm-context");
//supi
supi_t supi = { .length = 0 };
......@@ -389,17 +392,21 @@ void smf_http2_server::create_sm_contexts_handler(
Logger::smf_api_server().debug("Got result for promise ID %d", promise_id);
nlohmann::json json_data = { };
sm_context_response.get_json_data(json_data);
//Add header
header_map h;
//Location header
if (sm_context_response.get_smf_context_uri().size() > 0) {
Logger::smf_api_server().debug(
"Add location header %s",
sm_context_response.get_smf_context_uri().c_str());
header_map h;
h.emplace("location", header_value {
sm_context_response.get_smf_context_uri().c_str() });
response.write_head(sm_context_response.get_http_code(), h);
} else {
response.write_head(sm_context_response.get_http_code());
}
//content-type header
h.emplace("content-type", header_value {"application/json"});
response.write_head(sm_context_response.get_http_code(), h);
response.end(json_data.dump().c_str());
}
......
......@@ -1425,8 +1425,8 @@ struct fully_qualified_tunnel_endpoint_identifier_s {
std::string s = { };
interface_type_t iface_type((interface_type_e) interface_type);
if ((v4) || (v6)) {
s.append("Interface type=").append(iface_type.toString());
s.append(", TEID=").append(std::to_string(teid_gre_key));
//s.append("Interface type=").append(iface_type.toString());
s.append("TEID=").append(std::to_string(teid_gre_key));
if (v4) {
s.append(", IPv4=").append(conv::toString(ipv4_address));
}
......
......@@ -18,6 +18,7 @@
# For more information about the OpenAirInterface (OAI) Software Alliance:
# contact@openairinterface.org
################################################################################
include_directories(${CMAKE_CURRENT_SOURCE_DIR})
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/msg)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/nas)
......
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
#ifndef FILE_AMF_SEEN
#define FILE_AMF_SEEN
#endif
......@@ -55,17 +55,19 @@ void Logger::_init(const char *app, const bool log_stdout,
std::stringstream ss;
ss << "[%Y-%m-%dT%H:%M:%S.%f] [" << app << "] [%n] [%l] %v";
m_async_cmd = new _Logger("async_c ", m_sinks, ss.str().c_str());
m_itti = new _Logger("itti ", m_sinks, ss.str().c_str());
m_smf_app = new _Logger("smf_app ", m_sinks, ss.str().c_str());
m_system = new _Logger("system ", m_sinks, ss.str().c_str());
m_udp = new _Logger("udp ", m_sinks, ss.str().c_str());
m_pfcp = new _Logger("pfcp ", m_sinks, ss.str().c_str());
m_pfcp_switch = new _Logger("pfcp_sw ", m_sinks, ss.str().c_str());
m_smf_n4 = new _Logger("smf_n4 ", m_sinks, ss.str().c_str());
m_smf_n10 = new _Logger("smf_n10 ", m_sinks, ss.str().c_str());
m_smf_n11 = new _Logger("smf_n11 ", m_sinks, ss.str().c_str());
m_smf_api_server = new _Logger("smf_api_server ", m_sinks, ss.str().c_str());
m_async_cmd = new _Logger("async_c", m_sinks, ss.str().c_str());
m_itti = new _Logger("itti ", m_sinks, ss.str().c_str());
m_smf_app = new _Logger("smf_app", m_sinks, ss.str().c_str());
m_system = new _Logger("system ", m_sinks, ss.str().c_str());
m_udp = new _Logger("udp ", m_sinks, ss.str().c_str());
m_pfcp = new _Logger("pfcp ", m_sinks, ss.str().c_str());
m_pfcp_switch = new _Logger("pfcp_sw ", m_sinks, ss.str().c_str());
m_smf_n1 = new _Logger("smf_n1 ", m_sinks, ss.str().c_str());
m_smf_n2 = new _Logger("smf_n2 ", m_sinks, ss.str().c_str());
m_smf_n4 = new _Logger("smf_n4 ", m_sinks, ss.str().c_str());
m_smf_n10 = new _Logger("smf_n10", m_sinks, ss.str().c_str());
m_smf_n11 = new _Logger("smf_n11", m_sinks, ss.str().c_str());
m_smf_api_server = new _Logger("sbi_srv", m_sinks, ss.str().c_str());
}
////////////////////////////////////////////////////////////////////////////////
......
......@@ -107,6 +107,13 @@ class Logger {
static _Logger& pfcp_switch() {
return *singleton().m_pfcp_switch;
}
static _Logger& smf_n1() {
return *singleton().m_smf_n1;
}
static _Logger& smf_n2() {
return *singleton().m_smf_n2;
}
static _Logger& smf_n4() {
return *singleton().m_smf_n4;
}
......@@ -146,6 +153,8 @@ class Logger {
_Logger *m_udp;
_Logger *m_pfcp;
_Logger *m_pfcp_switch;
_Logger *m_smf_n1;
_Logger *m_smf_n2;
_Logger *m_smf_n4;
_Logger *m_smf_n10;
_Logger *m_smf_n11;
......
......@@ -179,14 +179,18 @@ typedef struct qos_profile_s {
} qos_profile_t;
//URL, N1, N2 (may get from configuration file)
#define NAMF_COMMUNICATION_N1N2_MESSAGE_TRANSFER_URL "/namf-comm/v1/ue-contexts/{}/n1-n2-messages" //context id
#define NUDM_SDM_GET_SM_DATA_URL "/nudm-sdm/v2/{}/sm-data" //ue Id
#define NAMF_COMMUNICATION_BASE "/namf-comm/"
#define NAMF_COMMUNICATION_N1N2_MESSAGE_TRANSFER_URL "/ue-contexts/{}/n1-n2-messages" //context id
#define NUDM_SDM_BASE "/nudm-sdm/"
#define NUDM_SDM_GET_SM_DATA_URL "/{}/sm-data" //ue Id
#define N1_SM_CONTENT_ID "n1SmMsg"
#define N1N2_MESSAGE_CLASS "SM"
#define N1N2_MESSAGE_CLASS "SM"
#define N2_SM_CONTENT_ID "n2msg"
#define NSMF_CALLBACK_N1N2_MESSAGE_TRANSFER_FAILURE "/nsmf-pdusession/v1/callback/N1N2MsgTxfrFailureNotification/{}" //UE Id
#define NSMF_PDU_SESSION_SM_CONTEXT_CREATE_URL "/nsmf-pdusession/v1/sm-contexts"
#define NSMF_PDU_SESSION_SM_CONTEXT_UPDATE_URL "/nsmf-pdusession/v1/sm-contexts/"
#define NSMF_PDU_SESSION_BASE "/nsmf-pdusession/"
#define NSMF_CALLBACK_N1N2_MESSAGE_TRANSFER_FAILURE "/callback/N1N2MsgTxfrFailureNotification/{}" //UE Id
#define NSMF_PDU_SESSION_SM_CONTEXT_CREATE_URL "/sm-contexts"
#define NSMF_PDU_SESSION_SM_CONTEXT_UPDATE_URL "/sm-contexts/"
//for CURL
#define AMF_CURL_TIMEOUT_MS 100L
......
......@@ -74,194 +74,6 @@
#define APPEND_3GPPNETWORK append("3gppnetwork.org")
namespace EPC {
enum AppServiceEnum {
x_3gpp_unknown,
x_3gpp_pgw,
x_3gpp_sgw,
x_3gpp_ggsn,
x_3gpp_sgsn,
x_3gpp_mme,
x_3gpp_msc
};
enum AppProtocolEnum {
x_unknown,
x_gn,
x_gp,
x_nq,
x_nqprime,
x_s10,
x_s11,
x_s12,
x_s1_mme,
x_s1_u,
x_s16,
x_s2a_gtp,
x_s2a_mipv4,
x_s2a_pmip,
x_s2b_gtp,
x_s2b_pmip,
x_s2c_dsmip,
x_s3,
x_s4,
x_s5_gtp,
x_s5_pmip,
x_s6a,
x_s8_gtp,
x_s8_pmip,
x_sv
};
enum PGWAppProtocolEnum {
pgw_x_gn,
pgw_x_gp,
pgw_x_s2a_gtp,
pgw_x_s2a_mipv4,
pgw_x_s2a_pmip,
pgw_x_s2b_gtp,
pgw_x_s2b_pmip,
pgw_x_s2c_dsmip,
pgw_x_s5_gtp,
pgw_x_s5_pmip,
pgw_x_s8_gtp,
pgw_x_s8_pmip
};
enum SGWAppProtocolEnum {
sgw_x_s11,
sgw_x_s12,
sgw_x_s1_u,
sgw_x_s2a_pmip,
sgw_x_s2b_pmip,
sgw_x_s4,
sgw_x_s5_gtp,
sgw_x_s5_pmip,
sgw_x_s8_gtp,
sgw_x_s8_pmip
};
enum GGSNAppProtocolEnum {
ggsn_x_gn,
ggsn_x_gp
};
enum SGSNAppProtocolEnum {
sgsn_x_gn,
sgsn_x_gp,
sgsn_x_nqprime,
sgsn_x_s16,
sgsn_x_s3,
sgsn_x_s4,
sgsn_x_sv
};
enum MMEAppProtocolEnum {
mme_x_gn,
mme_x_gp,
mme_x_nq,
mme_x_s10,
mme_x_s11,
mme_x_s1_mme,
mme_x_s3,
mme_x_s6a,
mme_x_sv
};
enum MSCAppProtocolEnum {
msc_x_sv
};
enum DiameterApplicationEnum {
dia_app_unknown,
/*
+------------------+----------------------------+
| Tag | Diameter Application |
+------------------+----------------------------+
| aaa+ap1 | NASREQ [RFC3588] |
| aaa+ap2 | Mobile IPv4 [RFC4004] |
| aaa+ap3 | Base Accounting [RFC3588] |
| aaa+ap4 | Credit Control [RFC4006] |
| aaa+ap5 | EAP [RFC4072] |
| aaa+ap6 | SIP [RFC4740] |
| aaa+ap7 | Mobile IPv6 IKE [RFC5778] |
| aaa+ap8 | Mobile IPv6 Auth [RFC5778] |
| aaa+ap9 | QoS [RFC5866] |
| aaa+ap4294967295 | Relay [RFC3588] |
+------------------+----------------------------+
*/
dia_app_nasreq,
dia_app_mobile_ipv4,
dia_app_base_accounting,
dia_app_credit_control,
dia_app_eap,
dia_app_sip6,
dia_app_mobile_ipv6_ike,
dia_app_mobile_ipv6_auth,
dia_app_qos,
dia_app_relay,
/*
+----------------+----------------------+
| Tag | Diameter Application |
+----------------+----------------------+
| aaa+ap16777250 | 3GPP STa [TS29.273] |
| aaa+ap16777251 | 3GPP S6a [TS29.272] |
| aaa+ap16777264 | 3GPP SWm [TS29.273] |
| aaa+ap16777267 | 3GPP S9 [TS29.215] |
+----------------+----------------------+
*/
dia_app_3gpp_sta,
dia_app_3gpp_s6a,
dia_app_3gpp_swm,
dia_app_3gpp_s9,
/*
+----------------+--------------------------------------------------+
| Tag | Diameter Application |
+----------------+--------------------------------------------------+
| aaa+ap16777281 | WiMAX Network Access Authentication and |
| | Authorization Diameter Application (WNAAADA) |
| | [WiMAX-BASE] |
| aaa+ap16777282 | WiMAX Network Accounting Diameter Application |
| | (WNADA) [WiMAX-BASE] |
| aaa+ap16777283 | WiMAX MIP4 Diameter Application (WM4DA) |
| | [WiMAX-BASE] |
| aaa+ap16777284 | WiMAX MIP6 Diameter Application (WM6DA) |
| | [WiMAX-BASE] |
| aaa+ap16777285 | WiMAX DHCP Diameter Application (WDDA) |
| | [WiMAX-BASE] |
| aaa+ap16777286 | WiMAX Location Authentication Authorization |
| | Diameter Application (WLAADA) [WiMAX-LBS] |
| aaa+ap16777287 | WiMAX Policy and Charging Control R3 Policies |
| | Diameter Application (WiMAX PCC-R3-P) |
| | [WiMAX-PCC] |
| aaa+ap16777288 | WiMAX Policy and Charging Control R3 Offline |
| | Charging Diameter Application (WiMAX PCC-R3-OFC) |
| | [WiMAX-PCC] |
| aaa+ap16777289 | WiMAX Policy and Charging Control R3 Offline |
| | Charging Prime Diameter Application (WiMAX |
| | PCC-R3-OFC-PRIME) [WiMAX-PCC] |
| aaa+ap16777290 | WiMAX Policy and Charging Control R3 Online |
| | Charging Diameter Application (WiMAX PCC-R3-OC) |
| | [WiMAX-PCC] |
+----------------+--------------------------------------------------+
*/
dia_app_wimax_wnaaada,
dia_app_wimax_wnada,
dia_app_wimax_wm4da,
dia_app_wimax_wm6da,
dia_app_wimax_wdda,
dia_app_wimax_wlaada,
dia_app_wimax_pcc_r3_p,
dia_app_wimax_pcc_r3_ofc,
dia_app_wimax_pcc_r3_ofc_prime,
dia_app_wimax_pcc_r3_oc
};
enum DiameterProtocolEnum {
dia_protocol_unknown,
dia_protocol_tcp,
dia_protocol_sctp,
dia_protocol_tls_tcp
};
class Utility {
public:
......@@ -343,27 +155,7 @@ class Utility {
static std::string dnn(const char *apnoi, const unsigned char *plmnid);
static std::string dnn_label(const std::string &dnn);
static AppServiceEnum getAppService(const std::string &s);
static AppProtocolEnum getAppProtocol(const std::string &p);
static const char* getAppService(AppServiceEnum s);
static const char* getAppProtocol(AppProtocolEnum proto);
static AppProtocolEnum getAppProtocol(PGWAppProtocolEnum proto);
static AppProtocolEnum getAppProtocol(SGWAppProtocolEnum proto);
static AppProtocolEnum getAppProtocol(GGSNAppProtocolEnum proto);
static AppProtocolEnum getAppProtocol(SGSNAppProtocolEnum proto);
static AppProtocolEnum getAppProtocol(MMEAppProtocolEnum proto);
static AppProtocolEnum getAppProtocol(MSCAppProtocolEnum proto);
static std::string diameter_fqdn(const char *mnc, const char *mcc);
static std::string diameter_fqdn(const unsigned char *plmnid);
static uint32_t getDiameterApplication(DiameterApplicationEnum app);
static const char* getDiameterProtocol(DiameterProtocolEnum protocol);
static std::string getDiameterService(DiameterApplicationEnum app,
DiameterProtocolEnum protocol);
private:
Utility() {
......
################################################################################
# Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The OpenAirInterface Software Alliance licenses this file to You under
# the OAI Public License, Version 1.1 (the "License"); you may not use this file
# except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.openairinterface.org/?page_id=698
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#-------------------------------------------------------------------------------
# For more information about the OpenAirInterface (OAI) Software Alliance:
# contact@openairinterface.org
################################################################################
set(NAS_DIR "${SRC_TOP_DIR}/nas")
include_directories(${NAS_DIR})
include_directories(${NAS_DIR}/ies)
......
......@@ -18,6 +18,7 @@
# For more information about the OpenAirInterface (OAI) Software Alliance:
# contact@openairinterface.org
################################################################################
include_directories(${SRC_TOP_DIR}/common)
include_directories(${SRC_TOP_DIR}/itti)
include_directories(${SRC_TOP_DIR}/common/msg)
......
......@@ -18,6 +18,7 @@
# For more information about the OpenAirInterface (OAI) Software Alliance:
# contact@openairinterface.org
################################################################################
include_directories(${SRC_TOP_DIR}/common)
include_directories(${SRC_TOP_DIR}/common/msg)
include_directories(${SRC_TOP_DIR}/common/utils)
......@@ -49,7 +50,8 @@ add_library (SMF STATIC
smf_app.cpp
smf_config.cpp
smf_context.cpp
smf_n1_n2.cpp
smf_n1.cpp
smf_n2.cpp
smf_pfcp_association.cpp
smf_pco.cpp
smf_procedure.cpp
......
......@@ -44,7 +44,7 @@
#include "3gpp_24.007.h"
#include "smf.h"
#include "3gpp_24.501.h"
#include "smf_n1_n2.hpp"
#include "smf_n1.hpp"
#include "smf_paa_dynamic.hpp"
#include "smf_n4.hpp"
#include "smf_n10.hpp"
......@@ -65,7 +65,6 @@ extern "C" {
using namespace smf;
#define SYSTEM_CMD_MAX_STR_SIZE 512
extern util::async_shell_cmd *async_shell_cmd_inst;
extern smf_app *smf_app_inst;
extern smf_config smf_cfg;
......@@ -548,7 +547,7 @@ void smf_app::handle_pdu_session_create_sm_context_request(
oai::smf_server::model::ProblemDetails problem_details = { };
oai::smf_server::model::RefToBinaryData refToBinaryData = { };
std::string n1_sm_message, n1_sm_message_hex;
smf_n1_n2 smf_n1_n2_inst = { };
smf_n1 smf_n1_inst = { };
nas_message_t decoded_nas_msg = { };
cause_value_5gsm_e cause_n1 = { cause_value_5gsm_e::CAUSE_0_UNKNOWN };
pdu_session_type_t pdu_session_type = { .pdu_session_type =
......@@ -557,19 +556,20 @@ void smf_app::handle_pdu_session_create_sm_context_request(
//Step 1. Decode NAS and get the necessary information
std::string n1_sm_msg = smreq->req.get_n1_sm_message();
int decoder_rc = smf_n1_n2_inst.decode_n1_sm_container(decoded_nas_msg,
int decoder_rc = smf_n1_inst.decode_n1_sm_container(decoded_nas_msg,
n1_sm_msg);
//Failed to decode, send reply to AMF with PDU Session Establishment Reject
if (decoder_rc != RETURNok) {
//error, send reply to AMF with PDU Session Establishment Reject
Logger::smf_app().warn("N1 SM container cannot be decoded correctly!");
problem_details.setCause(
pdu_session_application_error_e2str[PDU_SESSION_APPLICATION_ERROR_N1_SM_ERROR]);
smContextCreateError.setError(problem_details);
refToBinaryData.setContentId(N1_SM_CONTENT_ID);
smContextCreateError.setN1SmMsg(refToBinaryData);
if (smf_n1_n2_inst.create_n1_sm_container(
smreq->req, PDU_SESSION_ESTABLISHMENT_REJECT, n1_sm_message,
cause_value_5gsm_e::CAUSE_95_SEMANTICALLY_INCORRECT_MESSAGE)) {
if (smf_n1_inst.create_n1_pdu_session_establishment_reject(
smreq->req, n1_sm_message,
cause_value_5gsm_e::CAUSE_95_SEMANTICALLY_INCORRECT_MESSAGE)) {
smf_app_inst->convert_string_2_hex(n1_sm_message, n1_sm_message_hex);
//trigger to send reply to AMF
trigger_http_response(http_status_code_e::HTTP_STATUS_CODE_403_FORBIDDEN,
......@@ -599,7 +599,6 @@ void smf_app::handle_pdu_session_create_sm_context_request(
//PDU session type (Optional)
if (decoded_nas_msg.plain.sm.header.message_type
== PDU_SESSION_ESTABLISHMENT_REQUEST) {
//TODO: Disable this command temporarily since can't get this info from tester
Logger::smf_app().debug(
"PDU Session Type %d",
decoded_nas_msg.plain.sm.pdu_session_establishment_request
......@@ -608,7 +607,6 @@ void smf_app::handle_pdu_session_create_sm_context_request(
.pdu_session_establishment_request._pdusessiontype
.pdu_session_type_value;
}
smreq->req.set_pdu_session_type(pdu_session_type.pdu_session_type);
//TODO: Support IPv4 only for now
......@@ -625,9 +623,8 @@ void smf_app::handle_pdu_session_create_sm_context_request(
refToBinaryData.setContentId(N1_SM_CONTENT_ID);
smContextCreateError.setN1SmMsg(refToBinaryData);
//PDU Session Establishment Reject
if (smf_n1_n2_inst.create_n1_sm_container(smreq->req,
PDU_SESSION_ESTABLISHMENT_REJECT,
n1_sm_message, cause_n1)) {
if (smf_n1_inst.create_n1_pdu_session_establishment_reject(smreq->req,
n1_sm_message, cause_n1)) {
smf_app_inst->convert_string_2_hex(n1_sm_message, n1_sm_message_hex);
//trigger to send reply to AMF
trigger_http_response(http_status_code_e::HTTP_STATUS_CODE_403_FORBIDDEN,
......@@ -677,9 +674,9 @@ void smf_app::handle_pdu_session_create_sm_context_request(
refToBinaryData.setContentId(N1_SM_CONTENT_ID);
smContextCreateError.setN1SmMsg(refToBinaryData);
//PDU Session Establishment Reject including cause "#81 Invalid PTI value" (section 7.3.1 @3GPP TS 24.501)
if (smf_n1_n2_inst.create_n1_sm_container(
smreq->req, PDU_SESSION_ESTABLISHMENT_REJECT, n1_sm_message,
cause_value_5gsm_e::CAUSE_81_INVALID_PTI_VALUE)) {
if (smf_n1_inst.create_n1_pdu_session_establishment_reject(
smreq->req, n1_sm_message,
cause_value_5gsm_e::CAUSE_81_INVALID_PTI_VALUE)) {
smf_app_inst->convert_string_2_hex(n1_sm_message, n1_sm_message_hex);
//trigger to send reply to AMF
trigger_http_response(http_status_code_e::HTTP_STATUS_CODE_403_FORBIDDEN,
......@@ -717,12 +714,10 @@ void smf_app::handle_pdu_session_create_sm_context_request(
smContextCreateError.setN1SmMsg(refToBinaryData);
//PDU Session Establishment Reject
//(24.501 (section 7.4)) implementation dependent->do similar to UE: response with a 5GSM STATUS message including cause "#98 message type not compatible with protocol state."
if (smf_n1_n2_inst.create_n1_sm_container(
smreq->req,
PDU_SESSION_ESTABLISHMENT_REJECT,
n1_sm_message,
cause_value_5gsm_e::CAUSE_98_MESSAGE_TYPE_NOT_COMPATIBLE_WITH_PROTOCOL_STATE)) {
if (smf_n1_inst.create_n1_pdu_session_establishment_reject(
smreq->req,
n1_sm_message,
cause_value_5gsm_e::CAUSE_98_MESSAGE_TYPE_NOT_COMPATIBLE_WITH_PROTOCOL_STATE)) {
smf_app_inst->convert_string_2_hex(n1_sm_message, n1_sm_message_hex);
//trigger to send reply to AMF
trigger_http_response(http_status_code_e::HTTP_STATUS_CODE_403_FORBIDDEN,
......@@ -759,9 +754,9 @@ void smf_app::handle_pdu_session_create_sm_context_request(
refToBinaryData.setContentId(N1_SM_CONTENT_ID);
smContextCreateError.setN1SmMsg(refToBinaryData);
//PDU Session Establishment Reject, 24.501 cause "#27 Missing or unknown DNN"
if (smf_n1_n2_inst.create_n1_sm_container(
smreq->req, PDU_SESSION_ESTABLISHMENT_REJECT, n1_sm_message,
cause_value_5gsm_e::CAUSE_27_MISSING_OR_UNKNOWN_DNN)) {
if (smf_n1_inst.create_n1_pdu_session_establishment_reject(
smreq->req, n1_sm_message,
cause_value_5gsm_e::CAUSE_27_MISSING_OR_UNKNOWN_DNN)) {
smf_app_inst->convert_string_2_hex(n1_sm_message, n1_sm_message_hex);
//trigger to send reply to AMF
trigger_http_response(http_status_code_e::HTTP_STATUS_CODE_403_FORBIDDEN,
......@@ -851,12 +846,11 @@ void smf_app::handle_pdu_session_create_sm_context_request(
refToBinaryData.setContentId(N1_SM_CONTENT_ID);
smContextCreateError.setN1SmMsg(refToBinaryData);
//PDU Session Establishment Reject, with cause "29 User authentication or authorization failed"
if (smf_n1_n2_inst.create_n1_sm_container(
if (smf_n1_inst.create_n1_pdu_session_establishment_reject(
smreq->req,
PDU_SESSION_ESTABLISHMENT_REJECT,
n1_sm_message,
cause_value_5gsm_e::CAUSE_29_USER_AUTHENTICATION_OR_AUTHORIZATION_FAILED)) {
smf_app_inst->convert_string_2_hex(n1_sm_message, n1_sm_message_hex);
smf_app_inst->convert_string_2_hex(n1_sm_message, n1_sm_message_hex);
//trigger to send reply to AMF
trigger_http_response(
http_status_code_e::HTTP_STATUS_CODE_403_FORBIDDEN,
......
......@@ -77,7 +77,6 @@ typedef enum {
} pdu_session_procedure_t;
class smf_config;
// same namespace
class smf_context_ref {
public:
......
This diff is collapsed.
......@@ -54,6 +54,8 @@
#define SMF_CONFIG_STRING_INTERFACE_N4 "N4"
#define SMF_CONFIG_STRING_INTERFACE_SBI "SBI"
#define SMF_CONFIG_STRING_SBI_HTTP2_PORT "HTTP2_PORT"
#define SMF_CONFIG_STRING_API_VERSION "API_VERSION"
#define SMF_CONFIG_STRING_NAS_FORCE_PUSH_PCO "FORCE_PUSH_PROTOCOL_CONFIGURATION_OPTIONS"
......@@ -73,19 +75,15 @@
#define SMF_CONFIG_STRING_DEFAULT_DNS_IPV6_ADDRESS "DEFAULT_DNS_IPV6_ADDRESS"
#define SMF_CONFIG_STRING_DEFAULT_DNS_SEC_IPV6_ADDRESS "DEFAULT_DNS_SEC_IPV6_ADDRESS"
#define SMF_CONFIG_STRING_UE_MTU "UE_MTU"
#define SMF_CONFIG_STRING_GTPV1U_REALIZATION "GTPV1U_REALIZATION"
#define SMF_CONFIG_STRING_INTERFACE_DISABLED "none"
#define SMF_CONFIG_STRING_DNN_LIST "DNN_LIST"
#define SMF_CONFIG_STRING_DNN_NI "DNN_NI"
#define SMF_CONFIG_STRING_PDN_TYPE "PDN_TYPE"
#define SMF_CONFIG_STRING_PDN_TYPE "PDU_SESSION_TYPE"
#define SMF_CONFIG_STRING_IPV4_POOL "IPV4_POOL"
#define SMF_CONFIG_STRING_IPV6_POOL "IPV6_POOL"
#define SMF_CONFIG_STRING_AUTOMATIC_PUSH_DEDICATED_BEARER_PCC_RULE "AUTOMATIC_PUSH_DEDICATED_BEARER_PCC_RULE"
#define SMF_CONFIG_STRING_DEFAULT_BEARER_STATIC_PCC_RULE "DEFAULT_BEARER_STATIC_PCC_RULE"
#define SMF_CONFIG_STRING_PUSH_STATIC_PCC_RULES "PUSH_STATIC_PCC_RULES"
#define SMF_ABORT_ON_ERROR true
#define SMF_WARN_ON_ERROR false
......@@ -165,6 +163,7 @@ class smf_config {
interface_cfg_t n4;
interface_cfg_t sbi;
unsigned int sbi_http2_port;
std::string sbi_api_version;
itti_cfg_t itti;
struct in_addr default_dnsv4;
......@@ -202,11 +201,13 @@ class smf_config {
struct {
struct in_addr ipv4_addr;
unsigned int port;
std::string api_version;
} amf_addr;
struct {
struct in_addr ipv4_addr;
unsigned int port;
std::string api_version;
} udm_addr;
std::vector<pfcp::node_id_t> upfs;
......@@ -269,8 +270,10 @@ class smf_config {
amf_addr.ipv4_addr.s_addr = INADDR_ANY;
amf_addr.port = 80;
amf_addr.ipv4_addr.s_addr = INADDR_ANY;
amf_addr.api_version = "v1";
udm_addr.ipv4_addr.s_addr = INADDR_ANY;
udm_addr.port = 80;
udm_addr.api_version = "v1";
local_configuration = false;
num_session_management_subscription = 0;
......@@ -278,7 +281,8 @@ class smf_config {
for (int i = 0; i < SMF_NUM_SESSION_MANAGEMENT_SUBSCRIPTION_MAX; i++) {
session_management_subscription[i] = {};
}
sbi_http2_port = 0;
sbi_http2_port = 8080;
sbi_api_version = "v1";
}
;
......
This diff is collapsed.
This diff is collapsed.
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
/*! \file smf_n1.hpp
* \brief
\author Tien-Thinh NGUYEN
\company Eurecom
\date 2019
\email: tien-thinh.nguyen@eurecom.fr
*/
#ifndef FILE_SMF_N1_HPP_SEEN
#define FILE_SMF_N1_HPP_SEEN
#include <string>
#include "smf.h"
#include "smf_context.hpp"
#include "smf_msg.hpp"
#include "3gpp_29.502.h"
extern "C" {
#include "nas_message.h"
}
namespace smf {
class smf_n1 {
private:
public:
smf_n1() {
}
;
smf_n1(smf_n1 const&) = delete;
void operator=(smf_n1 const&) = delete;
/*
* Create N1 SM Container: PDU Session Establishment Accept
* @param [pdu_session_create_sm_context_response] sm_context_res: include necessary information for encoding NGAP msg
* @param [std::string&] ngap_msg_str store the created NGAP message in form of string
* @param [uint8_t] sm_cause store NAS Cause
* @return boolean: True if the NGAP message has been created successfully, otherwise return false
*
*/
bool create_n1_pdu_session_establishment_accept(pdu_session_create_sm_context_response &sm_context_res,
std::string &nas_msg_str,
cause_value_5gsm_e sm_cause);
/*
* Create N1 SM Container: PDU Session Establishment Reject
* @param [pdu_session_msg] msg: include necessary information for encoding NGAP msg
* @param [std::string&] ngap_msg_str store the created NGAP message in form of string
* @param [uint8_t] sm_cause store NAS Cause
* @return boolean: True if the NGAP message has been created successfully, otherwise return false
*
*/
bool create_n1_pdu_session_establishment_reject(pdu_session_msg &msg,
std::string &nas_msg_str,
cause_value_5gsm_e sm_cause);
//TODO: separate into 4 functions (verify if necessary)
/*
bool create_n1_pdu_session_establishment_accept(pdu_session_create_sm_context_response &sm_context_res,
std::string &nas_msg_str,
cause_value_5gsm_e sm_cause);
bool create_n1_pdu_session_establishment_reject(pdu_session_create_sm_context_request &msg, uint8_t msg_type,
std::string &nas_msg_str,
cause_value_5gsm_e sm_cause);
bool create_n1_pdu_session_establishment_reject(pdu_session_update_sm_context_response &msg, uint8_t msg_type,
std::string &nas_msg_str,
cause_value_5gsm_e sm_cause);
bool create_n1_pdu_session_establishment_reject(pdu_session_update_sm_context_request &msg, uint8_t msg_type,
std::string &nas_msg_str,
cause_value_5gsm_e sm_cause);
*/
//For testing purpose
bool create_n1_pdu_session_modification_request(pdu_session_update_sm_context_response &msg,
std::string &nas_msg_str,
cause_value_5gsm_e sm_cause);
/*
* Create N1 SM Container: PDU Session Modification Command
* Included in PDU Session Update SM Context Response (PDU Session Modification UE-Initiated procedure - step 1)
* @param [pdu_session_msg] msg: include necessary information for encoding NGAP msg
* @param [std::string&] ngap_msg_str store the created NGAP message in form of string
* @param [uint8_t] sm_cause store NAS Cause
* @return boolean: True if the NGAP message has been created successfully, otherwise return false
*
*/
bool create_n1_pdu_session_modification_command(pdu_session_update_sm_context_response &msg,
std::string &nas_msg_str,
cause_value_5gsm_e sm_cause);
/*
* Create N1 SM Container: PDU Session Modification Command
* Included in N1N2MessageTransfer Request (PDU Session Modification SMF-Requested, step 1 (from SMF to AMF))
* @param [pdu_session_msg] msg: include necessary information for encoding NGAP msg
* @param [std::string&] ngap_msg_str store the created NGAP message in form of string
* @param [uint8_t] sm_cause store NAS Cause
* @return boolean: True if the NGAP message has been created successfully, otherwise return false
*
*/
bool create_n1_pdu_session_modification_command(pdu_session_modification_network_requested &msg,
std::string &nas_msg_str,
cause_value_5gsm_e sm_cause);
/*
* Create N1 SM Container: PDU Session Release Reject
* Included in PDU Session Update SM Context Response (PDU Session Release UE-Initiated, step 1)
* @param [pdu_session_msg] msg: include necessary information for encoding NGAP msg
* @param [std::string&] ngap_msg_str store the created NGAP message in form of string
* @param [uint8_t] sm_cause store NAS Cause
* @return boolean: True if the NGAP message has been created successfully, otherwise return false
*
*/
bool create_n1_pdu_session_release_reject(pdu_session_update_sm_context_request &sm_context_res,
std::string &nas_msg_str,
cause_value_5gsm_e sm_cause);
/*
* Create N1 SM Container: PDU Session Release Command
* Included in PDU Session Update SM Context Response (PDU Session Release UE-Initiated, step 1)
* @param [pdu_session_msg] msg: include necessary information for encoding NGAP msg
* @param [std::string&] ngap_msg_str store the created NGAP message in form of string
* @param [uint8_t] sm_cause store NAS Cause
* @return boolean: True if the NGAP message has been created successfully, otherwise return false
*
*/
bool create_n1_pdu_session_release_command(pdu_session_update_sm_context_response &msg,
std::string &nas_msg_str,
cause_value_5gsm_e sm_cause);
/*
* Create N1 SM Container: PDU Session Release Command
* Included in N1N2MessageTransfer Request (PDU Session Release SMF-Requested, step 1)
* @param [pdu_session_msg] msg: include necessary information for encoding NGAP msg
* @param [std::string&] ngap_msg_str store the created NGAP message in form of string
* @param [uint8_t] sm_cause store NAS Cause
* @return boolean: True if the NGAP message has been created successfully, otherwise return false
*
*/
bool create_n1_pdu_session_release_command(pdu_session_modification_network_requested &msg,
std::string &nas_msg_str,
cause_value_5gsm_e sm_cause);
/*
* Decode N1 SM Container into the NAS mesasge (using NAS lib)
* @param [nas_message_t&] nas_msg Store NAS message after decoded
* @param [const std::string&] n1_sm_msg N1 SM Container
* @return status of the decode process
*/
int decode_n1_sm_container(nas_message_t &nas_msg, const std::string &n1_sm_msg);
};
} // namespace smf
#endif /* FILE_SMF_N1_HPP_SEEN */
......@@ -117,6 +117,7 @@ bool smf_n10::get_sm_data(
std::string url = std::string(
inet_ntoa(*((struct in_addr*) &smf_cfg.udm_addr.ipv4_addr))) + ":"
+ std::to_string(smf_cfg.udm_addr.port)
+ NUDM_SDM_BASE + smf_cfg.udm_addr.api_version
+ fmt::format(NUDM_SDM_GET_SM_DATA_URL, std::to_string(supi));
Logger::smf_n10().debug("UDM's URL: %s ", url.c_str());
......
......@@ -42,7 +42,6 @@
#include "logger.hpp"
#include "smf_app.hpp"
#include "smf_config.hpp"
#include "smf_n1_n2.hpp"
#include "mime_parser.hpp"
extern "C" {
......@@ -129,7 +128,6 @@ void smf_n11::send_n1n2_message_transfer_request(
Logger::smf_n11().debug("Send Communication_N1N2MessageTransfer to AMF (HTTP version %d)", sm_context_res->http_version);
mime_parser parser = {};
smf_n1_n2 smf_n1_n2_inst = { };
std::string n1_message = sm_context_res->res.get_n1_sm_message();
nlohmann::json json_data = {};
std::string body;
......@@ -248,7 +246,6 @@ void smf_n11::send_n1n2_message_transfer_request(
mime_parser parser = {};
std::string body;
smf_n1_n2 smf_n1_n2_inst = { };
nlohmann::json json_data = {};
std::string json_part;
std::string n1_message = sm_session_modification->msg.get_n1_sm_message();
......@@ -337,7 +334,6 @@ void smf_n11::send_n1n2_message_transfer_request(
"Send Communication_N1N2MessageTransfer to AMF (Network-initiated Service Request)");
mime_parser parser = {};
smf_n1_n2 smf_n1_n2_inst = { };
std::string n2_message = report_msg->res.get_n2_sm_information();
nlohmann::json json_data = {};
std::string body;
......
This diff is collapsed.
This diff is collapsed.
......@@ -415,17 +415,17 @@ void smf_n4::handle_receive_association_setup_response(
if (!error) {
if (not msg_ies_container.node_id.first) {
// Should be detected by lower layers
Logger::smf_app().warn(
Logger::smf_n4().warn(
"Received N4 ASSOCIATION SETUP RESPONSE without node id IE!, ignore message");
return;
}
if (not msg_ies_container.recovery_time_stamp.first) {
// Should be detected by lower layers
Logger::smf_app().warn(
Logger::smf_n4().warn(
"Received N4 ASSOCIATION SETUP RESPONSE without recovery time stamp IE!, ignore message");
return;
}
Logger::smf_app().info("Received N4 ASSOCIATION SETUP RESPONSE");
Logger::smf_n4().info("Received N4 ASSOCIATION SETUP RESPONSE");
bool restore_n4_sessions = false;
if (msg_ies_container.up_function_features.first) {
pfcp_associations::get_instance().add_association(
......
This diff is collapsed.
################################################################################
# Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The OpenAirInterface Software Alliance licenses this file to You under
# the OAI Public License, Version 1.1 (the "License"); you may not use this file
# except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.openairinterface.org/?page_id=698
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#-------------------------------------------------------------------------------
# For more information about the OpenAirInterface (OAI) Software Alliance:
# contact@openairinterface.org
################################################################################
cmake_minimum_required (VERSION 3.2)
project(amf-client)
......
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
/*! \file amf_client.cpp
\author Tien-Thinh NGUYEN
\company Eurecom
\date 2019
\email: tien-thinh.nguyen@eurecom.fr
*/
#include <curl/curl.h>
#include <nlohmann/json.hpp>
#include <iostream>
......
......@@ -18,6 +18,7 @@
# For more information about the OpenAirInterface (OAI) Software Alliance:
# contact@openairinterface.org
################################################################################
include_directories(${SRC_TOP_DIR}/common)
include_directories(${SRC_TOP_DIR}/common/msg)
include_directories(${SRC_TOP_DIR}/common/utils)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment