Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
O
OpenXG-SMF
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
OpenXG
OpenXG-SMF
Commits
3fa12767
Commit
3fa12767
authored
Jun 30, 2021
by
Tien-Thinh Nguyen
Browse files
Options
Browse Files
Download
Plain Diff
Fix conflict
parents
824b4f0a
c99d5a7f
Changes
14
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
47 additions
and
30 deletions
+47
-30
README.md
README.md
+4
-0
ci-scripts/Jenkinsfile-GitLab-Docker
ci-scripts/Jenkinsfile-GitLab-Docker
+2
-2
docker/Dockerfile.smf.rhel8
docker/Dockerfile.smf.rhel8
+0
-0
docker/Dockerfile.smf.ubuntu18
docker/Dockerfile.smf.ubuntu18
+0
-0
src/api-server/impl/IndividualSMContextApiImpl.cpp
src/api-server/impl/IndividualSMContextApiImpl.cpp
+3
-4
src/api-server/impl/SMContextsCollectionApiImpl.cpp
src/api-server/impl/SMContextsCollectionApiImpl.cpp
+1
-2
src/api-server/smf-http2-server.cpp
src/api-server/smf-http2-server.cpp
+3
-4
src/common/utils/mime_parser.cpp
src/common/utils/mime_parser.cpp
+11
-0
src/common/utils/mime_parser.hpp
src/common/utils/mime_parser.hpp
+3
-3
src/pfcp/3gpp_29.244.hpp
src/pfcp/3gpp_29.244.hpp
+4
-0
src/pfcp/CMakeLists.txt
src/pfcp/CMakeLists.txt
+1
-0
src/smf_app/smf_app.cpp
src/smf_app/smf_app.cpp
+7
-0
src/smf_app/smf_app.hpp
src/smf_app/smf_app.hpp
+1
-5
src/smf_app/smf_sbi.cpp
src/smf_app/smf_sbi.cpp
+7
-10
No files found.
README.md
View file @
3fa12767
...
...
@@ -9,7 +9,11 @@ OPENAIR-CN-5G is an implementation of the 3GPP specifications for the 5G Core Ne
At the moment, it contains the following network elements:
*
Access and Mobility Management Function (
**AMF**
)
*
Authentication Server Management Function (
**AUSF**
)
*
Network Repository Function (
**NRF**
)
*
Session Management Function (
**SMF**
)
*
Unified Data Management (
**UDM**
)
*
Unified Data Repository (
**UDR**
)
*
User Plane Function (
**UPF**
)
Each has its own repository: this repository (
`oai-cn5g-smf`
) is meant for SMF.
...
...
ci-scripts/Jenkinsfile-GitLab-Docker
View file @
3fa12767
...
...
@@ -179,7 +179,7 @@ pipeline {
echo
"Maybe a previous build went wrong"
}
// In case of push to `develop` branch we build from scratch
myShCmd
(
'docker build --no-cache --target oai-smf --tag oai-smf:'
+
smf_tag
+
' --file docker/Dockerfile.
ubuntu18.04
--build-arg NEEDED_GIT_PROXY="http://proxy.eurecom.fr:8080" . > archives/smf_docker_image_build.log 2>&1'
,
rem_u18_host_flag
,
rem_u18_host_user
,
rem_u18_host
)
myShCmd
(
'docker build --no-cache --target oai-smf --tag oai-smf:'
+
smf_tag
+
' --file docker/Dockerfile.
smf.ubuntu18
--build-arg NEEDED_GIT_PROXY="http://proxy.eurecom.fr:8080" . > archives/smf_docker_image_build.log 2>&1'
,
rem_u18_host_flag
,
rem_u18_host_user
,
rem_u18_host
)
}
if
(
"MERGE"
.
equals
(
env
.
gitlabActionType
))
{
try
{
...
...
@@ -235,7 +235,7 @@ pipeline {
myShCmd
(
'mkdir -p tmp/ca tmp/entitlement'
,
rem_rhel_host_flag
,
rem_rhel_host_user
,
rem_rhel_host
)
myShCmd
(
'cp /etc/pki/entitlement/*pem tmp/entitlement'
,
rem_rhel_host_flag
,
rem_rhel_host_user
,
rem_rhel_host
)
myShCmd
(
'sudo cp /etc/rhsm/ca/redhat-uep.pem tmp/ca'
,
rem_rhel_host_flag
,
rem_rhel_host_user
,
rem_rhel_host
)
myShCmd
(
'sudo podman build --no-cache --target oai-smf --tag oai-smf:'
+
smf_tag
+
' --file docker/Dockerfile.smf.rhel8
.2
--build-arg NEEDED_GIT_PROXY="http://proxy.eurecom.fr:8080" . > archives/smf_podman_image_build.log 2>&1'
,
rem_rhel_host_flag
,
rem_rhel_host_user
,
rem_rhel_host
)
myShCmd
(
'sudo podman build --no-cache --target oai-smf --tag oai-smf:'
+
smf_tag
+
' --file docker/Dockerfile.smf.rhel8 --build-arg NEEDED_GIT_PROXY="http://proxy.eurecom.fr:8080" . > archives/smf_podman_image_build.log 2>&1'
,
rem_rhel_host_flag
,
rem_rhel_host_user
,
rem_rhel_host
)
myShCmd
(
'sudo podman image ls >> archives/smf_podman_image_build.log'
,
rem_rhel_host_flag
,
rem_rhel_host_user
,
rem_rhel_host
)
if
(
"MERGE"
.
equals
(
env
.
gitlabActionType
))
{
myShCmd
(
'sudo podman image tag oai-smf:'
+
smf_tag
+
' oai-smf:'
+
rhel_smf_tag
,
rem_rhel_host_flag
,
rem_rhel_host_user
,
rem_rhel_host
)
...
...
docker/Dockerfile.smf.rhel8
.2
→
docker/Dockerfile.smf.rhel8
View file @
3fa12767
File moved
docker/Dockerfile.
ubuntu18.04
→
docker/Dockerfile.
smf.ubuntu18
View file @
3fa12767
File moved
src/api-server/impl/IndividualSMContextApiImpl.cpp
View file @
3fa12767
...
...
@@ -143,7 +143,6 @@ void IndividualSMContextApiImpl::update_sm_context(
Logger
::
smf_api_server
().
debug
(
"Got result for promise ID %d"
,
promise_id
);
nlohmann
::
json
json_data
=
{};
mime_parser
parser
=
{};
std
::
string
body
=
{};
std
::
string
json_format
;
...
...
@@ -153,7 +152,7 @@ void IndividualSMContextApiImpl::update_sm_context(
if
(
sm_context_response
.
n1_sm_msg_is_set
()
and
sm_context_response
.
n2_sm_info_is_set
())
{
parser
.
create_multipart_related_content
(
mime_parser
::
create_multipart_related_content
(
body
,
json_data
.
dump
(),
CURL_MIME_BOUNDARY
,
sm_context_response
.
get_n1_sm_message
(),
sm_context_response
.
get_n2_sm_information
(),
json_format
);
...
...
@@ -161,7 +160,7 @@ void IndividualSMContextApiImpl::update_sm_context(
Pistache
::
Http
::
Mime
::
MediaType
(
"multipart/related; boundary="
+
std
::
string
(
CURL_MIME_BOUNDARY
)));
}
else
if
(
sm_context_response
.
n1_sm_msg_is_set
())
{
parser
.
create_multipart_related_content
(
mime_parser
::
create_multipart_related_content
(
body
,
json_data
.
dump
(),
CURL_MIME_BOUNDARY
,
sm_context_response
.
get_n1_sm_message
(),
multipart_related_content_part_e
::
NAS
,
json_format
);
...
...
@@ -169,7 +168,7 @@ void IndividualSMContextApiImpl::update_sm_context(
Pistache
::
Http
::
Mime
::
MediaType
(
"multipart/related; boundary="
+
std
::
string
(
CURL_MIME_BOUNDARY
)));
}
else
if
(
sm_context_response
.
n2_sm_info_is_set
())
{
parser
.
create_multipart_related_content
(
mime_parser
::
create_multipart_related_content
(
body
,
json_data
.
dump
(),
CURL_MIME_BOUNDARY
,
sm_context_response
.
get_n2_sm_information
(),
multipart_related_content_part_e
::
NGAP
,
json_format
);
...
...
src/api-server/impl/SMContextsCollectionApiImpl.cpp
View file @
3fa12767
...
...
@@ -103,7 +103,6 @@ void SMContextsCollectionApiImpl::post_sm_contexts(
Logger
::
smf_api_server
().
debug
(
"Got result for promise ID %d"
,
promise_id
);
nlohmann
::
json
json_data
=
{};
mime_parser
parser
=
{};
std
::
string
json_format
=
{};
std
::
string
body
=
{};
...
...
@@ -112,7 +111,7 @@ void SMContextsCollectionApiImpl::post_sm_contexts(
if
(
sm_context_response
.
n1_sm_msg_is_set
())
{
// add N1 container if
// available
parser
.
create_multipart_related_content
(
mime_parser
::
create_multipart_related_content
(
body
,
json_data
.
dump
(),
CURL_MIME_BOUNDARY
,
sm_context_response
.
get_n1_sm_message
(),
multipart_related_content_part_e
::
NAS
,
json_format
);
...
...
src/api-server/smf-http2-server.cpp
View file @
3fa12767
...
...
@@ -420,7 +420,6 @@ void smf_http2_server::update_sm_context_handler(
Logger
::
smf_api_server
().
debug
(
"Got result for promise ID %d"
,
promise_id
);
nlohmann
::
json
json_data
=
{};
mime_parser
parser
=
{};
std
::
string
body
=
{};
header_map
h
=
{};
std
::
string
json_format
=
{};
...
...
@@ -431,7 +430,7 @@ void smf_http2_server::update_sm_context_handler(
if
(
sm_context_response
.
n1_sm_msg_is_set
()
and
sm_context_response
.
n2_sm_info_is_set
())
{
parser
.
create_multipart_related_content
(
mime_parser
::
create_multipart_related_content
(
body
,
json_data
.
dump
(),
CURL_MIME_BOUNDARY
,
sm_context_response
.
get_n1_sm_message
(),
sm_context_response
.
get_n2_sm_information
(),
json_format
);
...
...
@@ -439,7 +438,7 @@ void smf_http2_server::update_sm_context_handler(
"content-type"
,
header_value
{
"multipart/related; boundary="
+
std
::
string
(
CURL_MIME_BOUNDARY
)});
}
else
if
(
sm_context_response
.
n1_sm_msg_is_set
())
{
parser
.
create_multipart_related_content
(
mime_parser
::
create_multipart_related_content
(
body
,
json_data
.
dump
(),
CURL_MIME_BOUNDARY
,
sm_context_response
.
get_n1_sm_message
(),
multipart_related_content_part_e
::
NAS
,
json_format
);
...
...
@@ -447,7 +446,7 @@ void smf_http2_server::update_sm_context_handler(
"content-type"
,
header_value
{
"multipart/related; boundary="
+
std
::
string
(
CURL_MIME_BOUNDARY
)});
}
else
if
(
sm_context_response
.
n2_sm_info_is_set
())
{
parser
.
create_multipart_related_content
(
mime_parser
::
create_multipart_related_content
(
body
,
json_data
.
dump
(),
CURL_MIME_BOUNDARY
,
sm_context_response
.
get_n2_sm_information
(),
multipart_related_content_part_e
::
NGAP
,
json_format
);
...
...
src/common/utils/mime_parser.cpp
View file @
3fa12767
...
...
@@ -23,6 +23,10 @@
#include "logger.hpp"
#include "conversions.hpp"
extern
"C"
{
#include "dynamic_memory_check.h"
}
bool
mime_parser
::
parse
(
const
std
::
string
&
str
)
{
std
::
string
CRLF
=
"
\r\n
"
;
Logger
::
smf_app
().
debug
(
"Parsing the message with Simple Parser"
);
...
...
@@ -127,6 +131,10 @@ void mime_parser::create_multipart_related_content(
body
.
append
(
CRLF
);
body
.
append
(
std
::
string
((
char
*
)
n2_msg_hex
,
n2_message
.
length
()
/
2
)
+
CRLF
);
body
.
append
(
"--"
+
boundary
+
"--"
+
CRLF
);
// free memory
free_wrapper
((
void
**
)
&
n1_msg_hex
);
free_wrapper
((
void
**
)
&
n2_msg_hex
);
}
//------------------------------------------------------------------------------
...
...
@@ -158,4 +166,7 @@ void mime_parser::create_multipart_related_content(
body
.
append
(
CRLF
);
body
.
append
(
std
::
string
((
char
*
)
msg_hex
,
message
.
length
()
/
2
)
+
CRLF
);
body
.
append
(
"--"
+
boundary
+
"--"
+
CRLF
);
// free memory
free_wrapper
((
void
**
)
&
msg_hex
);
}
src/common/utils/mime_parser.hpp
View file @
3fa12767
...
...
@@ -62,7 +62,7 @@ class mime_parser {
* @param [const std::string&] str: input string
* @return String represents string in hex format
*/
unsigned
char
*
format_string_as_hex
(
const
std
::
string
&
str
);
static
unsigned
char
*
format_string_as_hex
(
const
std
::
string
&
str
);
/*
* Create HTTP body content for multipart/related message
...
...
@@ -73,7 +73,7 @@ class mime_parser {
* @param [std::string] n2_message: N2 (NGAP) part
* @return void
*/
void
create_multipart_related_content
(
void
static
create_multipart_related_content
(
std
::
string
&
body
,
const
std
::
string
&
json_part
,
const
std
::
string
boundary
,
const
std
::
string
&
n1_message
,
const
std
::
string
&
n2_message
,
...
...
@@ -88,7 +88,7 @@ class mime_parser {
* @param [uint8_t] content_type: 1 for NAS content, else NGAP content
* @return void
*/
void
create_multipart_related_content
(
void
static
create_multipart_related_content
(
std
::
string
&
body
,
const
std
::
string
&
json_part
,
const
std
::
string
boundary
,
const
std
::
string
&
message
,
const
multipart_related_content_part_e
content_type
,
...
...
src/pfcp/3gpp_29.244.hpp
View file @
3fa12767
...
...
@@ -33,6 +33,7 @@
#include "logger.hpp"
#include "msg_pfcp.hpp"
#include "serializable.hpp"
#include "string.hpp"
#include <arpa/inet.h>
#include <cstring>
...
...
@@ -868,11 +869,14 @@ class pfcp_fteid_ie : public pfcp_ie {
class
pfcp_network_instance_ie
:
public
pfcp_ie
{
public:
std
::
string
network_instance
;
std
::
string
network_instance_dotted
;
//--------
explicit
pfcp_network_instance_ie
(
const
pfcp
::
network_instance_t
&
b
)
:
pfcp_ie
(
PFCP_IE_NETWORK_INSTANCE
)
{
network_instance
=
b
.
network_instance
;
util
::
string_to_dotted
(
network_instance
,
network_instance_dotted
);
network_instance
=
network_instance_dotted
;
tlv
.
set_length
(
network_instance
.
size
());
}
//--------
...
...
src/pfcp/CMakeLists.txt
View file @
3fa12767
...
...
@@ -23,6 +23,7 @@ include_directories(${SRC_TOP_DIR}/common)
include_directories
(
${
SRC_TOP_DIR
}
/itti
)
include_directories
(
${
SRC_TOP_DIR
}
/common/msg
)
include_directories
(
${
SRC_TOP_DIR
}
/common/utils
)
include_directories
(
${
SRC_TOP_DIR
}
/common/utils/bstr
)
include_directories
(
${
SRC_TOP_DIR
}
/oai_smf
)
include_directories
(
${
SRC_TOP_DIR
}
/pfcp
)
include_directories
(
${
SRC_TOP_DIR
}
/udp
)
...
...
src/smf_app/smf_app.cpp
View file @
3fa12767
...
...
@@ -363,6 +363,13 @@ smf_app::smf_app(const std::string& config_file)
Logger
::
smf_app
().
startup
(
"Started"
);
}
//------------------------------------------------------------------------------
smf_app
::~
smf_app
()
{
Logger
::
smf_app
().
debug
(
"Delete SMF_APP instance..."
);
// TODO: Unregister NRF
if
(
smf_n4_inst
)
delete
smf_n4_inst
;
if
(
smf_sbi_inst
)
delete
smf_sbi_inst
;
}
//------------------------------------------------------------------------------
void
smf_app
::
start_upf_association
(
const
pfcp
::
node_id_t
&
node_id
)
{
std
::
time_t
time_epoch
=
std
::
time
(
nullptr
);
...
...
src/smf_app/smf_app.hpp
View file @
3fa12767
...
...
@@ -206,11 +206,7 @@ class smf_app {
public:
explicit
smf_app
(
const
std
::
string
&
config_file
);
smf_app
(
smf_app
const
&
)
=
delete
;
virtual
~
smf_app
()
{
Logger
::
smf_app
().
debug
(
"Delete SMF_APP instance..."
);
// TODO: Unregister NRF
}
virtual
~
smf_app
();
void
operator
=
(
smf_app
const
&
)
=
delete
;
...
...
src/smf_app/smf_sbi.cpp
View file @
3fa12767
...
...
@@ -192,7 +192,6 @@ void smf_sbi::send_n1n2_message_transfer_request(
"Send Communication_N1N2MessageTransfer to AMF (HTTP version %d)"
,
sm_context_res
->
http_version
);
mime_parser
parser
=
{};
nlohmann
::
json
json_data
=
{};
std
::
string
body
;
...
...
@@ -201,12 +200,12 @@ void smf_sbi::send_n1n2_message_transfer_request(
// Add N2 content if available
auto
n2_sm_found
=
json_data
.
count
(
"n2InfoContainer"
);
if
(
n2_sm_found
>
0
)
{
parser
.
create_multipart_related_content
(
mime_parser
::
create_multipart_related_content
(
body
,
json_part
,
CURL_MIME_BOUNDARY
,
sm_context_res
->
res
.
get_n1_sm_message
(),
sm_context_res
->
res
.
get_n2_sm_information
());
}
else
{
parser
.
create_multipart_related_content
(
mime_parser
::
create_multipart_related_content
(
body
,
json_part
,
CURL_MIME_BOUNDARY
,
sm_context_res
->
res
.
get_n1_sm_message
(),
multipart_related_content_part_e
::
NAS
);
...
...
@@ -292,7 +291,6 @@ void smf_sbi::send_n1n2_message_transfer_request(
sm_session_modification
)
{
Logger
::
smf_sbi
().
debug
(
"Send Communication_N1N2MessageTransfer to AMF"
);
mime_parser
parser
=
{};
std
::
string
body
;
nlohmann
::
json
json_data
=
{};
std
::
string
json_part
;
...
...
@@ -302,12 +300,12 @@ void smf_sbi::send_n1n2_message_transfer_request(
// add N2 content if available
auto
n2_sm_found
=
json_data
.
count
(
"n2InfoContainer"
);
if
(
n2_sm_found
>
0
)
{
parser
.
create_multipart_related_content
(
mime_parser
::
create_multipart_related_content
(
body
,
json_part
,
CURL_MIME_BOUNDARY
,
sm_session_modification
->
msg
.
get_n1_sm_message
(),
sm_session_modification
->
msg
.
get_n2_sm_information
());
}
else
{
parser
.
create_multipart_related_content
(
mime_parser
::
create_multipart_related_content
(
body
,
json_part
,
CURL_MIME_BOUNDARY
,
sm_session_modification
->
msg
.
get_n1_sm_message
(),
multipart_related_content_part_e
::
NAS
);
...
...
@@ -360,7 +358,6 @@ void smf_sbi::send_n1n2_message_transfer_request(
"Send Communication_N1N2MessageTransfer to AMF (Network-initiated "
"Service Request)"
);
mime_parser
parser
=
{};
std
::
string
n2_message
=
report_msg
->
res
.
get_n2_sm_information
();
nlohmann
::
json
json_data
=
{};
std
::
string
body
;
...
...
@@ -371,11 +368,11 @@ void smf_sbi::send_n1n2_message_transfer_request(
auto
n1_sm_found
=
json_data
.
count
(
"n1MessageContainer"
);
if
(
n1_sm_found
>
0
)
{
std
::
string
n1_message
=
report_msg
->
res
.
get_n1_sm_message
();
//
P
repare the body content for Curl
parser
.
create_multipart_related_content
(
//
p
repare the body content for Curl
mime_parser
::
create_multipart_related_content
(
body
,
json_part
,
CURL_MIME_BOUNDARY
,
n1_message
,
n2_message
);
}
else
{
parser
.
create_multipart_related_content
(
mime_parser
::
create_multipart_related_content
(
body
,
json_part
,
CURL_MIME_BOUNDARY
,
n2_message
,
multipart_related_content_part_e
::
NGAP
);
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment