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
92282070
Commit
92282070
authored
Oct 02, 2020
by
Tien-Thinh Nguyen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update Release SM Context procedure
parent
076b8645
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
92 additions
and
22 deletions
+92
-22
src/api-server/api/IndividualSMContextApi.cpp
src/api-server/api/IndividualSMContextApi.cpp
+42
-6
src/api-server/api/IndividualSMContextApi.h
src/api-server/api/IndividualSMContextApi.h
+1
-1
src/api-server/impl/IndividualSMContextApiImpl.cpp
src/api-server/impl/IndividualSMContextApiImpl.cpp
+38
-13
src/api-server/impl/IndividualSMContextApiImpl.h
src/api-server/impl/IndividualSMContextApiImpl.h
+1
-1
src/smf_app/smf_context.cpp
src/smf_app/smf_context.cpp
+1
-1
src/smf_app/smf_msg.hpp
src/smf_app/smf_msg.hpp
+9
-0
No files found.
src/api-server/api/IndividualSMContextApi.cpp
View file @
92282070
...
...
@@ -87,25 +87,61 @@ void IndividualSMContextApi::setupRoutes() {
void
IndividualSMContextApi
::
release_sm_context_handler
(
const
Pistache
::
Rest
::
Request
&
request
,
Pistache
::
Http
::
ResponseWriter
response
)
{
// Getting the path params
auto
smContextRef
=
request
.
param
(
":smContextRef"
).
as
<
std
::
string
>
();
// Getting the body param
Logger
::
smf_api_server
().
debug
(
""
);
Logger
::
smf_api_server
().
info
(
"Received a SM context Release request from AMF."
);
Logger
::
smf_api_server
().
debug
(
"Request body: %s
\n
"
,
request
.
body
().
c_str
());
SmContextReleaseMessage
smContextReleaseMessage
=
{
};
//simple parser
mime_parser
sp
=
{
};
sp
.
parse
(
request
.
body
());
SmContextReleaseData
smContextReleaseData
;
std
::
vector
<
mime_part
>
parts
=
{
};
sp
.
get_mime_parts
(
parts
);
uint8_t
size
=
parts
.
size
();
Logger
::
smf_api_server
().
debug
(
"Number of MIME parts %d"
,
size
);
// Getting the body param
SmContextReleaseData
smContextReleaseData
=
{
};
try
{
nlohmann
::
json
::
parse
(
request
.
body
()).
get_to
(
smContextReleaseData
);
this
->
release_sm_context
(
smContextRef
,
smContextReleaseData
,
response
);
if
(
size
>
0
)
{
nlohmann
::
json
::
parse
(
parts
[
0
].
body
.
c_str
()).
get_to
(
smContextReleaseData
);
}
else
{
nlohmann
::
json
::
parse
(
request
.
body
().
c_str
()).
get_to
(
smContextReleaseData
);
}
smContextReleaseMessage
.
setJsonData
(
smContextReleaseData
);
for
(
int
i
=
1
;
i
<
size
;
i
++
)
{
if
(
parts
[
i
].
content_type
.
compare
(
"application/vnd.3gpp.ngap"
)
==
0
)
{
smContextReleaseMessage
.
setBinaryDataN2SmInformation
(
parts
[
i
].
body
);
Logger
::
smf_api_server
().
debug
(
"N2 SM information is set"
);
}
}
// Getting the path params
auto
smContextRef
=
request
.
param
(
":smContextRef"
).
as
<
std
::
string
>
();
this
->
release_sm_context
(
smContextRef
,
smContextReleaseMessage
,
response
);
}
catch
(
nlohmann
::
detail
::
exception
&
e
)
{
//send a 400 error
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
(
"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
;
}
}
void
IndividualSMContextApi
::
retrieve_sm_context_handler
(
...
...
src/api-server/api/IndividualSMContextApi.h
View file @
92282070
...
...
@@ -98,7 +98,7 @@ class IndividualSMContextApi {
/// <param name="smContextReleaseData">representation of the data to be sent to the SMF when releasing the SM context (optional)</param>
virtual
void
release_sm_context
(
const
std
::
string
&
smContextRef
,
const
SmContextRelease
Data
&
smContextReleaseData
,
const
SmContextRelease
Message
&
smContextReleaseMessage
,
Pistache
::
Http
::
ResponseWriter
&
response
)
=
0
;
/// <summary>
...
...
src/api-server/impl/IndividualSMContextApiImpl.cpp
View file @
92282070
...
...
@@ -52,13 +52,41 @@ IndividualSMContextApiImpl::IndividualSMContextApiImpl(
void
IndividualSMContextApiImpl
::
release_sm_context
(
const
std
::
string
&
smContextRef
,
const
SmContextRelease
Data
&
smContextReleaseData
,
const
SmContextRelease
Message
&
smContextReleaseMessage
,
Pistache
::
Http
::
ResponseWriter
&
response
)
{
//TODO: to be updated as update_sm_context_handler
Logger
::
smf_api_server
().
info
(
"release_sm_context..."
);
//Get the SmContextReleaseData from this message and process in smf_app
Logger
::
smf_api_server
().
info
(
"Received a PDUSession_ReleaseSMContext Request from AMF."
);
smf
::
pdu_session_release_sm_context_request
sm_context_req_msg
=
{
};
SmContextReleaseData
smContextReleaseData
=
smContextReleaseMessage
.
getJsonData
();
if
(
smContextReleaseData
.
n2SmInfoIsSet
())
{
//N2 SM (for Session establishment)
std
::
string
n2_sm_information
=
smContextReleaseMessage
.
getBinaryDataN2SmInformation
();
Logger
::
smf_api_server
().
debug
(
"N2 SM Information %s"
,
n2_sm_information
.
c_str
());
boost
::
shared_ptr
<
boost
::
promise
<
smf
::
pdu_session_release_sm_context_response
>
>
p
=
std
::
string
n2_sm_info_type
=
smContextReleaseData
.
getN2SmInfoType
();
sm_context_req_msg
.
set_n2_sm_information
(
n2_sm_information
);
sm_context_req_msg
.
set_n2_sm_info_type
(
n2_sm_info_type
);
}
//Step 2. TODO: initialize necessary values for sm context req from smContextReleaseData
// cause:
// ngApCause:
// 5gMmCauseValue:
// ueLocation:
//ueTimeZone:
//addUeLocation:
//vsmfReleaseOnly:
//ismfReleaseOnly:
boost
::
shared_ptr
<
boost
::
promise
<
smf
::
pdu_session_release_sm_context_response
>
>
p
=
boost
::
make_shared
<
boost
::
promise
<
smf
::
pdu_session_release_sm_context_response
>
>
();
boost
::
shared_future
<
smf
::
pdu_session_release_sm_context_response
>
f
;
...
...
@@ -69,16 +97,11 @@ void IndividualSMContextApiImpl::release_sm_context(
Logger
::
smf_api_server
().
debug
(
"Promise ID generated %d"
,
promise_id
);
m_smf_app
->
add_promise
(
promise_id
,
p
);
//handle Nsmf_PDUSession_UpdateSMContext Request
Logger
::
smf_api_server
().
info
(
"Received a PDUSession_ReleaseSMContext Request: PDU Session Release request from AMF."
);
//Step 3. Handle the itti_n11_release_sm_context_request message in smf_app
std
::
shared_ptr
<
itti_n11_release_sm_context_request
>
itti_msg
=
std
::
make_shared
<
itti_n11_release_sm_context_request
>
(
TASK_SMF_N11
,
TASK_SMF_APP
,
promise_id
,
smContextRef
);
itti_msg
->
scid
=
smContextRef
;
std
::
make_shared
<
itti_n11_release_sm_context_request
>
(
TASK_SMF_N11
,
TASK_SMF_APP
,
promise_id
,
smContextRef
);
itti_msg
->
req
=
sm_context_req_msg
;
itti_msg
->
http_version
=
1
;
m_smf_app
->
handle_pdu_session_release_sm_context_request
(
itti_msg
);
...
...
@@ -86,7 +109,9 @@ void IndividualSMContextApiImpl::release_sm_context(
smf
::
pdu_session_release_sm_context_response
sm_context_response
=
f
.
get
();
Logger
::
smf_api_server
().
debug
(
"Got result for promise ID %d"
,
promise_id
);
//TODO: process the response
response
.
send
(
Pistache
::
Http
::
Code
(
sm_context_response
.
get_http_code
()));
}
void
IndividualSMContextApiImpl
::
retrieve_sm_context
(
...
...
src/api-server/impl/IndividualSMContextApiImpl.h
View file @
92282070
...
...
@@ -76,7 +76,7 @@ class IndividualSMContextApiImpl :
void
release_sm_context
(
const
std
::
string
&
smContextRef
,
const
SmContextRelease
Data
&
smContextReleaseData
,
const
SmContextRelease
Message
&
smContextReleaseMessage
,
Pistache
::
Http
::
ResponseWriter
&
response
);
void
retrieve_sm_context
(
const
std
::
string
&
smContextRef
,
const
SmContextRetrieveData
&
smContextRetrieveData
,
...
...
src/smf_app/smf_context.cpp
View file @
92282070
src/smf_app/smf_msg.hpp
View file @
92282070
...
...
@@ -417,6 +417,15 @@ class pdu_session_release_sm_context_request : public pdu_session_msg {
}
;
private:
//From smContextReleaseData
// cause:
// ngApCause:
// 5gMmCauseValue:
// ueLocation:
//ueTimeZone:
//addUeLocation:
//vsmfReleaseOnly:
//ismfReleaseOnly:
};
//---------------------------------------------------------------------------------------
...
...
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