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
35a96ac9
Commit
35a96ac9
authored
Jan 08, 2020
by
Tien-Thinh Nguyen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
prepare to use NGAP lib to decode N2 SM Information
parent
b187b9c8
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
56 additions
and
8 deletions
+56
-8
src/api-server/impl/IndividualSMContextApiImpl.cpp
src/api-server/impl/IndividualSMContextApiImpl.cpp
+26
-2
src/api-server/impl/SMContextsCollectionApiImpl.cpp
src/api-server/impl/SMContextsCollectionApiImpl.cpp
+1
-2
src/smf_app/smf_app.cpp
src/smf_app/smf_app.cpp
+20
-4
src/smf_app/smf_app.hpp
src/smf_app/smf_app.hpp
+9
-0
No files found.
src/api-server/impl/IndividualSMContextApiImpl.cpp
View file @
35a96ac9
...
...
@@ -11,7 +11,9 @@
*/
#include "IndividualSMContextApiImpl.h"
extern
"C"
{
#include "Ngap_NGAP-PDU.h"
}
namespace
oai
{
namespace
smf_server
{
namespace
api
{
...
...
@@ -38,13 +40,35 @@ void IndividualSMContextApiImpl::update_sm_context(const std::string &smContextR
//Get the SmContextUpdateData from this message and process in smf_app
smf
::
pdu_session_update_sm_context_request
sm_context_req_msg
=
{};
//TODO: initialize necessary values for sm context req from smContextUpdateData and smContextRef
//decode NGAP message and assign the necessary informations to pdu_session_update_sm_context_request
//and pass this message to SMF to handle this message
Ngap_NGAP_PDU_t
decoded_ngap_msg
=
{};
std
::
string
n2_sm_information
=
(
smContextUpdateData
.
getN2SmInfo
()).
getContentId
();
std
::
string
n2_sm_msg_hex
;
m_smf_app
->
convert_string_2_hex
(
n2_sm_information
,
n2_sm_msg_hex
);
Logger
::
smf_api_server
().
debug
(
"smContextMessage, n2 sm information %s"
,
n2_sm_information
.
c_str
());
//Step1. Decode N2 SM information into decoded ngap msg
int
decoder_rc
=
m_smf_app
->
decode_ngap_message
(
decoded_ngap_msg
,
n2_sm_msg_hex
);
if
(
decoder_rc
!=
RETURNok
)
{
//TODO: error, should send reply to AMF with error code!!
}
//Step 2. TODO: initialize necessary values for sm context req from smContextUpdateData
//Step 3. Handle the itti_n11_update_sm_context_request message in smf_app
std
::
shared_ptr
<
itti_n11_update_sm_context_request
>
itti_msg
=
std
::
make_shared
<
itti_n11_update_sm_context_request
>
(
TASK_SMF_N11
,
TASK_SMF_APP
,
response
,
smContextRef
);
itti_msg
->
req
=
sm_context_req_msg
;
itti_msg
->
scid
=
smContextRef
;
m_smf_app
->
handle_amf_msg
(
itti_msg
);
}
}
...
...
src/api-server/impl/SMContextsCollectionApiImpl.cpp
View file @
35a96ac9
...
...
@@ -155,8 +155,7 @@ void SMContextsCollectionApiImpl::post_sm_contexts(const SmContextMessage &smCon
//SM PDU DN request container (Optional)
//Extended protocol configuration options (Optional) e.g, FOR DHCP
//Step 3. Handle the pdu_session_create_sm_context_request message in pwg_app
//m_smf_app->handle_amf_msg(sm_context_req_msg, response);
//Step 3. Handle the pdu_session_create_sm_context_request message in smf_app
//itti_n11_create_sm_context_request *itti_msg = new itti_n11_create_sm_context_request(TASK_SMF_N11, TASK_SMF_APP, response);
//itti_msg->req = sm_context_req_msg;
...
...
src/smf_app/smf_app.cpp
View file @
35a96ac9
...
...
@@ -473,7 +473,7 @@ void smf_app::handle_amf_msg (std::shared_ptr<itti_n11_update_sm_context_request
oai
::
smf_server
::
model
::
RefToBinaryData
binary_data
;
std
::
string
n1_container
;
//N1 SM container
//S
M Context ID, N2 SM information, Request Type
//S
tep 0. get supi, dnn, pdu_session id from sm_context
//SM Context ID - uint32_t in our case
scid_t
scid
;
try
{
...
...
@@ -485,13 +485,18 @@ void smf_app::handle_amf_msg (std::shared_ptr<itti_n11_update_sm_context_request
}*/
catch
(
const
std
::
exception
&
err
)
{
//TODO: reject with invalid context
//TODO:
send
reject with invalid context
}
//Step 1. get necessary information (N2 SM information)
supi_t
supi
=
smreq
->
req
.
get_supi
();
auto
sm_context
=
scid_2_smf_context
(
scid
);
supi_t
supi
=
std
::
get
<
0
>
(
sm_context
);
std
::
string
dnn
=
std
::
get
<
1
>
(
sm_context
);
pdu_session_id_t
pdu_session_id
=
std
::
get
<
2
>
(
sm_context
);
supi64_t
supi64
=
smf_supi_to_u64
(
supi
);
//Step 1. get necessary information (N2 SM information)
//Step 2. find the smf context
std
::
shared_ptr
<
smf_context
>
sc
;
...
...
@@ -3033,7 +3038,18 @@ int smf_app::decode_nas_message_n1_sm_container(nas_message_t& nas_msg, std::str
return
decoder_rc
;
}
//---------------------------------------------------------------------------------------------
int
smf_app
::
decode_ngap_message
(
Ngap_NGAP_PDU_t
&
ngap_msg
,
std
::
string
&
n2_sm_info
){
//TODO: should work with BUPT to finish this function
Logger
::
smf_app
().
info
(
"Decode NGAP message from N2 SM Information
\n
"
);
//step 1. Decode NGAP message (for instance, ... only served as an example)
int
decoder_rc
=
RETURNok
;
return
decoder_rc
;
}
//---------------------------------------------------------------------------------------------
void
smf_app
::
convert_string_2_hex
(
std
::
string
&
input_str
,
std
::
string
&
output_str
){
unsigned
char
*
data
=
(
unsigned
char
*
)
malloc
(
input_str
.
length
()
+
1
);
...
...
src/smf_app/smf_app.hpp
View file @
35a96ac9
...
...
@@ -44,6 +44,7 @@
extern
"C"
{
#include "nas_message.h"
#include "mmData.h"
#include "Ngap_NGAP-PDU.h"
}
#include <map>
...
...
@@ -238,6 +239,14 @@ public:
*/
void
convert_string_2_hex
(
std
::
string
&
input_str
,
std
::
string
&
output_str
);
/*
* Decode N2 SM Information (using NGAP lib)
* @param [Ngap_NGAP_PDU_t&] ngap_msg Store decoded NGAP message
* @param [std::string&] n2_sm_info N2 SM Information from AMF
* @return status of the decode process
*/
int
decode_ngap_message
(
Ngap_NGAP_PDU_t
&
ngap_msg
,
std
::
string
&
n2_sm_info
);
};
}
#include "smf_config.hpp"
...
...
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