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
fc314ef1
Commit
fc314ef1
authored
Mar 30, 2020
by
Tien-Thinh Nguyen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
polish code for SMF API server
parent
1cd1db49
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
17 additions
and
14 deletions
+17
-14
src/api-server/api/IndividualSMContextApi.cpp
src/api-server/api/IndividualSMContextApi.cpp
+3
-2
src/api-server/api/SMContextsCollectionApi.cpp
src/api-server/api/SMContextsCollectionApi.cpp
+5
-3
src/api-server/api/SMContextsCollectionApi.h
src/api-server/api/SMContextsCollectionApi.h
+1
-1
src/api-server/impl/SMContextsCollectionApiImpl.cpp
src/api-server/impl/SMContextsCollectionApiImpl.cpp
+8
-8
No files found.
src/api-server/api/IndividualSMContextApi.cpp
View file @
fc314ef1
...
...
@@ -162,6 +162,7 @@ void IndividualSMContextApi::update_sm_context_handler(const Pistache::Rest::Req
Logger
::
smf_api_server
().
info
(
"Received a SM context update request from AMF"
);
Logger
::
smf_api_server
().
debug
(
"Request body: %s
\n
"
,
request
.
body
().
c_str
());
//find boundary
std
::
size_t
found
=
request
.
body
().
find
(
"Content-Type"
);
std
::
string
boundary_str
=
request
.
body
().
substr
(
2
,
found
-
4
);
Logger
::
smf_api_server
().
debug
(
"Boundary: %s"
,
boundary_str
.
c_str
());
...
...
@@ -236,12 +237,12 @@ void IndividualSMContextApi::update_sm_context_handler(const Pistache::Rest::Req
}
catch
(
nlohmann
::
detail
::
exception
&
e
)
{
//send a 400 error
Logger
::
smf_api_server
().
warn
(
"Error in parsing json
, send a msg with a 400 error code to AMF"
);
Logger
::
smf_api_server
().
warn
(
"Error in parsing json
(error: %s), send a msg with a 400 error code to AMF"
,
e
.
what
()
);
response
.
send
(
Pistache
::
Http
::
Code
::
Bad_Request
,
e
.
what
());
return
;
}
catch
(
std
::
exception
&
e
)
{
//send a 500 error
Logger
::
smf_api_server
().
warn
(
"
Send a msg with a 500 error code to AMF"
);
Logger
::
smf_api_server
().
warn
(
"
Error (%s ), Send a msg with a 500 error code to AMF"
,
e
.
what
()
);
response
.
send
(
Pistache
::
Http
::
Code
::
Internal_Server_Error
,
e
.
what
());
return
;
}
...
...
src/api-server/api/SMContextsCollectionApi.cpp
View file @
fc314ef1
...
...
@@ -72,9 +72,10 @@ void SMContextsCollectionApi::setupRoutes() {
void
SMContextsCollectionApi
::
post_sm_contexts_handler
(
const
Pistache
::
Rest
::
Request
&
request
,
Pistache
::
Http
::
ResponseWriter
response
)
{
Logger
::
smf_api_server
().
info
(
"Received a SM context create request from AMF"
);
Logger
::
smf_api_server
().
debug
(
"Request body: %s
\n
"
,
request
.
body
().
c_str
());
Logger
::
smf_api_server
().
info
(
"
\n
Received a SM context create request from AMF"
);
Logger
::
smf_api_server
().
debug
(
"Request body: %s"
,
request
.
body
().
c_str
());
//find boundary
std
::
size_t
found
=
request
.
body
().
find
(
"Content-Type"
);
std
::
string
boundary_str
=
request
.
body
().
substr
(
2
,
found
-
4
);
Logger
::
smf_api_server
().
debug
(
"Boundary: %s"
,
boundary_str
.
c_str
());
...
...
@@ -127,11 +128,12 @@ void SMContextsCollectionApi::post_sm_contexts_handler(const Pistache::Rest::Req
this
->
post_sm_contexts
(
smContextMessage
,
response
);
}
catch
(
nlohmann
::
detail
::
exception
&
e
)
{
//send a 400 error
Logger
::
smf_api_server
().
warn
(
"Can not parse the json data
!"
);
Logger
::
smf_api_server
().
warn
(
"Can not parse the json data
(error: %s)!"
,
e
.
what
()
);
response
.
send
(
Pistache
::
Http
::
Code
::
Bad_Request
,
e
.
what
());
return
;
}
catch
(
std
::
exception
&
e
)
{
//send a 500 error
Logger
::
smf_api_server
().
warn
(
"Error: %s!"
,
e
.
what
());
response
.
send
(
Pistache
::
Http
::
Code
::
Internal_Server_Error
,
e
.
what
());
return
;
}
...
...
src/api-server/api/SMContextsCollectionApi.h
View file @
fc314ef1
...
...
@@ -78,7 +78,7 @@ private:
/// Create SM Context
/// </summary>
/// <remarks>
///
///
/// </remarks>
/// <param name="smContextMessage"></param>
virtual
void
post_sm_contexts
(
const
SmContextMessage
&
smContextMessage
,
Pistache
::
Http
::
ResponseWriter
&
response
)
=
0
;
...
...
src/api-server/impl/SMContextsCollectionApiImpl.cpp
View file @
fc314ef1
...
...
@@ -64,7 +64,7 @@ void SMContextsCollectionApiImpl::post_sm_contexts(const SmContextMessage &smCon
Logger
::
smf_api_server
().
debug
(
"smContextMessage, N1 SM message: %s"
,
n1_sm_msg
.
c_str
());
//Step 2. Create a pdu_session_create_sm_context_request message and store the necessary information
Logger
::
smf_api_server
().
debug
(
"Create a pdu_session_create_sm_context_request message and store the necessary information
\n
"
);
Logger
::
smf_api_server
().
debug
(
"Create a pdu_session_create_sm_context_request message and store the necessary information"
);
smf
::
pdu_session_create_sm_context_request
sm_context_req_msg
=
{};
//set N1 SM Message
...
...
@@ -80,27 +80,27 @@ void SMContextsCollectionApiImpl::post_sm_contexts(const SmContextMessage &smCon
smf_string_to_supi
(
&
supi
,
supi_str
.
c_str
());
sm_context_req_msg
.
set_supi
(
supi
);
sm_context_req_msg
.
set_supi_prefix
(
supi_prefix
);
Logger
::
smf_api_server
().
debug
(
"SmContextCreateData, supi %s, prefix %s, imsi %s
\n
"
,
smContextCreateData
.
getSupi
().
c_str
(),
supi_prefix
.
c_str
(),
supi_str
.
c_str
());
Logger
::
smf_api_server
().
debug
(
"SmContextCreateData, supi %s, prefix %s, imsi %s"
,
smContextCreateData
.
getSupi
().
c_str
(),
supi_prefix
.
c_str
(),
supi_str
.
c_str
());
//dnn
Logger
::
smf_api_server
().
debug
(
"SmContextCreateData, dnn %s
\n
"
,
smContextCreateData
.
getDnn
().
c_str
());
Logger
::
smf_api_server
().
debug
(
"SmContextCreateData, dnn %s"
,
smContextCreateData
.
getDnn
().
c_str
());
sm_context_req_msg
.
set_dnn
(
smContextCreateData
.
getDnn
().
c_str
());
//S-Nssai
Logger
::
smf_api_server
().
debug
(
"SmContextCreateData, S-NSSAI sst %d, sd %s
\n
"
,
smContextCreateData
.
getSNssai
().
getSst
(),
smContextCreateData
.
getSNssai
().
getSd
().
c_str
());
Logger
::
smf_api_server
().
debug
(
"SmContextCreateData, S-NSSAI sst %d, sd %s"
,
smContextCreateData
.
getSNssai
().
getSst
(),
smContextCreateData
.
getSNssai
().
getSd
().
c_str
());
snssai_t
snssai
(
smContextCreateData
.
getSNssai
().
getSst
(),
smContextCreateData
.
getSNssai
().
getSd
().
c_str
());
sm_context_req_msg
.
set_snssai
(
snssai
);
//PDU session ID
Logger
::
smf_api_server
().
debug
(
"SmContextCreateData, PDU SessionID %d
\n
"
,
smContextCreateData
.
getPduSessionId
());
Logger
::
smf_api_server
().
debug
(
"SmContextCreateData, PDU SessionID %d"
,
smContextCreateData
.
getPduSessionId
());
sm_context_req_msg
.
set_pdu_session_id
(
smContextCreateData
.
getPduSessionId
());
//AMF ID (ServingNFId)
Logger
::
smf_api_server
().
debug
(
"SmContextCreateDatea, ServingNfId %s
\n
"
,
smContextCreateData
.
getServingNfId
().
c_str
());
Logger
::
smf_api_server
().
debug
(
"SmContextCreateDatea, ServingNfId %s"
,
smContextCreateData
.
getServingNfId
().
c_str
());
sm_context_req_msg
.
set_serving_nf_id
(
smContextCreateData
.
getServingNfId
().
c_str
());
//TODO: should be verified that AMF ID is stored in GUAMI or ServingNfId
//Request Type
Logger
::
smf_api_server
().
debug
(
"SmContextCreateData, RequestType %s
\n
"
,
smContextCreateData
.
getRequestType
().
c_str
());
Logger
::
smf_api_server
().
debug
(
"SmContextCreateData, RequestType %s"
,
smContextCreateData
.
getRequestType
().
c_str
());
sm_context_req_msg
.
set_request_type
(
smContextCreateData
.
getRequestType
());
//PCF ID
// Priority Access
...
...
@@ -117,7 +117,7 @@ void SMContextsCollectionApiImpl::post_sm_contexts(const SmContextMessage &smCon
//PCFId
// DNN Selection Mode
Logger
::
smf_api_server
().
debug
(
"SmContextCreateData, SelMode %s
\n
"
,
smContextCreateData
.
getSelMode
().
c_str
());
Logger
::
smf_api_server
().
debug
(
"SmContextCreateData, SelMode %s"
,
smContextCreateData
.
getSelMode
().
c_str
());
sm_context_req_msg
.
set_dnn_selection_mode
(
smContextCreateData
.
getSelMode
().
c_str
());
//Subscription for PDU Session Status Notification
...
...
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