Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
O
OpenXG-AMF
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
1
Issues
1
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-AMF
Commits
b849a49c
Commit
b849a49c
authored
Dec 07, 2022
by
Tien-Thinh Nguyen
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'pdu_session_release' into 'develop'
Pdu session release See merge request oai/cn5g/oai-cn5g-amf!165
parents
66728d53
bb35c2c9
Changes
21
Hide whitespace changes
Inline
Side-by-side
Showing
21 changed files
with
957 additions
and
2 deletions
+957
-2
src/amf-app/amf_app.cpp
src/amf-app/amf_app.cpp
+57
-0
src/amf-app/amf_app.hpp
src/amf-app/amf_app.hpp
+19
-0
src/contexts/ue_context.cpp
src/contexts/ue_context.cpp
+9
-0
src/contexts/ue_context.hpp
src/contexts/ue_context.hpp
+2
-0
src/itti/itti_msg.hpp
src/itti/itti_msg.hpp
+1
-0
src/itti/msgs/itti_msg_n2.hpp
src/itti/msgs/itti_msg_n2.hpp
+1
-1
src/itti/msgs/itti_msg_sbi.hpp
src/itti/msgs/itti_msg_sbi.hpp
+40
-1
src/sbi/amf_server/AMFApiServer.cpp
src/sbi/amf_server/AMFApiServer.cpp
+4
-0
src/sbi/amf_server/AMFApiServer.hpp
src/sbi/amf_server/AMFApiServer.hpp
+4
-0
src/sbi/amf_server/api/StatusNotifyApi.cpp
src/sbi/amf_server/api/StatusNotifyApi.cpp
+95
-0
src/sbi/amf_server/api/StatusNotifyApi.h
src/sbi/amf_server/api/StatusNotifyApi.h
+77
-0
src/sbi/amf_server/impl/StatusNotifyApiImpl.cpp
src/sbi/amf_server/impl/StatusNotifyApiImpl.cpp
+113
-0
src/sbi/amf_server/impl/StatusNotifyApiImpl.h
src/sbi/amf_server/impl/StatusNotifyApiImpl.h
+82
-0
src/sbi/amf_server/model/Cause.cpp
src/sbi/amf_server/model/Cause.cpp
+45
-0
src/sbi/amf_server/model/Cause.h
src/sbi/amf_server/model/Cause.h
+62
-0
src/sbi/amf_server/model/ResourceStatus.cpp
src/sbi/amf_server/model/ResourceStatus.cpp
+49
-0
src/sbi/amf_server/model/ResourceStatus.h
src/sbi/amf_server/model/ResourceStatus.h
+55
-0
src/sbi/amf_server/model/SmContextStatusNotification.cpp
src/sbi/amf_server/model/SmContextStatusNotification.cpp
+46
-0
src/sbi/amf_server/model/SmContextStatusNotification.h
src/sbi/amf_server/model/SmContextStatusNotification.h
+60
-0
src/sbi/amf_server/model/StatusInfo.cpp
src/sbi/amf_server/model/StatusInfo.cpp
+66
-0
src/sbi/amf_server/model/StatusInfo.h
src/sbi/amf_server/model/StatusInfo.h
+70
-0
No files found.
src/amf-app/amf_app.cpp
View file @
b849a49c
...
...
@@ -148,6 +148,13 @@ void amf_app_task(void*) {
amf_app_inst
->
handle_itti_message
(
ref
(
*
m
));
}
break
;
case
SBI_PDU_SESSION_RELEASE_NOTIF
:
{
Logger
::
amf_app
().
debug
(
"Received SBI_PDU_SESSION_RELEASE_NOTIF"
);
itti_sbi_pdu_session_release_notif
*
m
=
dynamic_cast
<
itti_sbi_pdu_session_release_notif
*>
(
msg
);
amf_app_inst
->
handle_itti_message
(
ref
(
*
m
));
}
break
;
case
SBI_AMF_CONFIGURATION
:
{
Logger
::
amf_app
().
debug
(
"Received SBI_AMF_CONFIGURATION"
);
itti_sbi_amf_configuration
*
m
=
...
...
@@ -293,6 +300,24 @@ bool amf_app::get_pdu_sessions_context(
return
true
;
}
//------------------------------------------------------------------------------
bool
amf_app
::
update_pdu_sessions_context
(
const
string
&
ue_id
,
const
uint8_t
&
pdu_session_id
,
const
oai
::
amf
::
model
::
SmContextStatusNotification
&
statusNotification
)
{
if
(
!
is_supi_2_ue_context
(
ue_id
))
return
false
;
std
::
shared_ptr
<
ue_context
>
uc
=
{};
uc
=
supi_2_ue_context
(
ue_id
);
// TODO: process SmContextStatusNotification
oai
::
amf
::
model
::
StatusInfo
statusInfo
=
statusNotification
.
getStatusInfo
();
oai
::
amf
::
model
::
ResourceStatus
resourceStatus
=
statusInfo
.
getResourceStatus
();
std
::
string
pdu_session_status
=
resourceStatus
.
getValue
();
if
(
boost
::
iequals
(
pdu_session_status
,
"released"
))
{
if
(
uc
->
remove_pdu_sessions_context
(
pdu_session_id
))
return
true
;
}
return
false
;
}
//------------------------------------------------------------------------------
evsub_id_t
amf_app
::
generate_ev_subscription_id
()
{
return
evsub_id_generator
.
get_uid
();
...
...
@@ -708,6 +733,38 @@ void amf_app::handle_itti_message(itti_sbi_n1n2_message_unsubscribe& itti_msg) {
}
}
//------------------------------------------------------------------------------
void
amf_app
::
handle_itti_message
(
itti_sbi_pdu_session_release_notif
&
itti_msg
)
{
Logger
::
amf_app
().
info
(
"Handle an PDU Session Release notification from SMF (HTTP version "
"%d)"
,
itti_msg
.
http_version
);
// Process the request and trigger the response from AMF API Server
nlohmann
::
json
response_data
=
{};
if
(
update_pdu_sessions_context
(
itti_msg
.
ue_id
,
itti_msg
.
pdu_session_id
,
itti_msg
.
smContextStatusNotification
))
{
Logger
::
amf_app
().
debug
(
"Update PDU Session Release successfully"
);
response_data
[
"httpResponseCode"
]
=
static_cast
<
uint32_t
>
(
http_response_codes_e
::
HTTP_RESPONSE_CODE_204_NO_CONTENT
);
}
else
{
response_data
[
"httpResponseCode"
]
=
static_cast
<
uint32_t
>
(
http_response_codes_e
::
HTTP_RESPONSE_CODE_204_NO_CONTENT
);
// TODO check if we set problem_details
Logger
::
amf_app
().
debug
(
"Update PDU Session Release failed"
);
}
// Notify to the result
if
(
itti_msg
.
promise_id
>
0
)
{
trigger_process_response
(
itti_msg
.
promise_id
,
response_data
);
return
;
}
}
//------------------------------------------------------------------------------
void
amf_app
::
handle_itti_message
(
itti_sbi_amf_configuration
&
itti_msg
)
{
Logger
::
amf_app
().
info
(
...
...
src/amf-app/amf_app.hpp
View file @
b849a49c
...
...
@@ -143,6 +143,13 @@ class amf_app {
*/
void
handle_itti_message
(
itti_sbi_n1n2_message_unsubscribe
&
itti_msg
);
/*
* Handle ITTI message (SBI PDU Session Release Notification)
* @param [itti_sbi_pdu_session_release_notif&]: ITTI message
* @return void
*/
void
handle_itti_message
(
itti_sbi_pdu_session_release_notif
&
itti_msg
);
/*
* Handle ITTI message (SBI AMF configuration)
* @param [itti_sbi_amf_configuration&]: ITTI message
...
...
@@ -289,6 +296,18 @@ class amf_app {
const
string
&
supi
,
std
::
vector
<
std
::
shared_ptr
<
pdu_session_context
>>&
sessions_ctx
);
/*
* Update PDU Session Context status
* @param [const std::string&] ue_id: UE SUPI
* @param [const uint8_t&] pdu_session_id: PDU Session ID
* @param [const oai::amf::model::SmContextStatusNotification&]
* statusNotification: Notification information received from SMF
* @return true if success, otherwise false
*/
bool
update_pdu_sessions_context
(
const
string
&
ue_id
,
const
uint8_t
&
pdu_session_id
,
const
oai
::
amf
::
model
::
SmContextStatusNotification
&
statusNotification
);
/*
* Generate a TMSI value for UE
* @param void
...
...
src/contexts/ue_context.cpp
View file @
b849a49c
...
...
@@ -54,10 +54,12 @@ void ue_context::add_pdu_session_context(
pdu_sessions
[
session_id
]
=
context
;
}
//------------------------------------------------------------------------------
void
ue_context
::
copy_pdu_sessions
(
std
::
shared_ptr
<
ue_context
>&
ue_ctx
)
{
pdu_sessions
=
ue_ctx
->
pdu_sessions
;
}
//------------------------------------------------------------------------------
bool
ue_context
::
get_pdu_sessions_context
(
std
::
vector
<
std
::
shared_ptr
<
pdu_session_context
>>&
sessions_ctx
)
{
std
::
shared_lock
lock
(
m_pdu_session
);
...
...
@@ -66,3 +68,10 @@ bool ue_context::get_pdu_sessions_context(
}
return
true
;
}
//------------------------------------------------------------------------------
bool
ue_context
::
remove_pdu_sessions_context
(
const
uint8_t
&
pdu_session_id
)
{
std
::
shared_lock
lock
(
m_pdu_session
);
pdu_sessions
.
erase
(
pdu_session_id
);
return
true
;
}
src/contexts/ue_context.hpp
View file @
b849a49c
...
...
@@ -52,6 +52,8 @@ class ue_context {
bool
get_pdu_sessions_context
(
std
::
vector
<
std
::
shared_ptr
<
pdu_session_context
>>&
sessions_ctx
);
bool
remove_pdu_sessions_context
(
const
uint8_t
&
pdu_session_id
);
public:
uint32_t
ran_ue_ngap_id
;
// 32bits
long
amf_ue_ngap_id
:
40
;
// 40bits
...
...
src/itti/itti_msg.hpp
View file @
b849a49c
...
...
@@ -96,6 +96,7 @@ typedef enum {
SBI_N1_MESSAGE_NOTIFICATION
,
SBI_N1N2_MESSAGE_SUBSCRIBE
,
SBI_N1N2_MESSAGE_UNSUBSCRIBE
,
SBI_PDU_SESSION_RELEASE_NOTIF
,
HANDOVER_REQUIRED_MSG
,
HANDOVER_REQUEST_ACK
,
HANDOVER_NOTIFY
,
...
...
src/itti/msgs/itti_msg_n2.hpp
View file @
b849a49c
...
...
@@ -327,7 +327,7 @@ class itti_ue_context_release_command : public itti_msg_n2 {
public:
uint32_t
ran_ue_ngap_id
;
long
amf_ue_ngap_id
;
Cause
cause
;
ngap
::
Cause
cause
;
};
class
itti_ue_context_release_complete
:
public
itti_msg_n2
{
...
...
src/itti/msgs/itti_msg_sbi.hpp
View file @
b849a49c
...
...
@@ -30,7 +30,7 @@
#include "amf_profile.hpp"
#include "bstrlib.h"
#include "itti_msg.hpp"
//#include "pistache/http.h"
#include <SmContextStatusNotification.h>
extern
"C"
{
#include "dynamic_memory_check.h"
...
...
@@ -543,4 +543,43 @@ class itti_sbi_update_amf_configuration : public itti_sbi_msg {
nlohmann
::
json
configuration
;
};
//-----------------------------------------------------------------------------
class
itti_sbi_pdu_session_release_notif
:
public
itti_sbi_msg
{
public:
itti_sbi_pdu_session_release_notif
(
const
task_id_t
orig
,
const
task_id_t
dest
,
uint32_t
pid
)
:
itti_sbi_msg
(
SBI_PDU_SESSION_RELEASE_NOTIF
,
orig
,
dest
),
http_version
(
1
),
promise_id
(
pid
),
ue_id
(),
pdu_session_id
(),
smContextStatusNotification
()
{}
itti_sbi_pdu_session_release_notif
(
const
itti_sbi_pdu_session_release_notif
&
i
)
:
itti_sbi_msg
(
i
),
http_version
(
1
),
promise_id
(),
ue_id
(),
pdu_session_id
(),
smContextStatusNotification
(
i
.
smContextStatusNotification
)
{}
itti_sbi_pdu_session_release_notif
(
const
itti_sbi_pdu_session_release_notif
&
i
,
const
task_id_t
orig
,
const
task_id_t
dest
)
:
itti_sbi_msg
(
i
,
orig
,
dest
),
http_version
(
i
.
http_version
),
promise_id
(
i
.
promise_id
),
ue_id
(
i
.
ue_id
),
pdu_session_id
(
i
.
pdu_session_id
),
smContextStatusNotification
(
i
.
smContextStatusNotification
)
{}
virtual
~
itti_sbi_pdu_session_release_notif
(){};
const
char
*
get_msg_name
()
{
return
"SBI_PDU_SESSION_RELEASE_NOTIF"
;
};
uint8_t
http_version
;
uint32_t
promise_id
;
std
::
string
ue_id
;
uint8_t
pdu_session_id
;
oai
::
amf
::
model
::
SmContextStatusNotification
smContextStatusNotification
;
};
#endif
/* ITTI_MSG_SBI_HPP_INCLUDED_ */
src/sbi/amf_server/AMFApiServer.cpp
View file @
b849a49c
...
...
@@ -22,6 +22,7 @@ void AMFApiServer::init(size_t thr) {
m_subscriptionsCollectionDocumentApiImpl
->
init
();
m_subscriptionsCollectionDocumentApiImplEventExposure
->
init
();
m_n1MessageNotifyApiImpl
->
init
();
m_statusNotifyApiImpl
->
init
();
Logger
::
amf_server
().
debug
(
"Initiate AMF Server Endpoints done!"
);
}
...
...
@@ -72,6 +73,9 @@ void AMFApiServer::start() {
if
(
m_n1MessageNotifyApiImpl
!=
nullptr
)
Logger
::
amf_server
().
debug
(
"AMF handler for N1MessageNotifyApiImpl"
);
if
(
m_statusNotifyApiImpl
!=
nullptr
)
Logger
::
amf_server
().
debug
(
"AMF handler for StatusNotifyApiImpl"
);
m_httpEndpoint
->
setHandler
(
m_router
->
handler
());
m_httpEndpoint
->
serveThreaded
();
}
...
...
src/sbi/amf_server/AMFApiServer.hpp
View file @
b849a49c
...
...
@@ -20,6 +20,7 @@
#include "SubscriptionsCollectionDocumentApiImpl.h"
#include "SubscriptionsCollectionDocumentApiImplEventExposure.h"
#include "N1MessageNotifyApiImpl.h"
#include "StatusNotifyApiImpl.h"
#define PISTACHE_SERVER_THREADS 2
#define PISTACHE_SERVER_MAX_PAYLOAD 32768
...
...
@@ -75,6 +76,8 @@ class AMFApiServer {
m_router
,
amf_app_inst
);
m_n1MessageNotifyApiImpl
=
std
::
make_shared
<
N1MessageNotifyApiImpl
>
(
m_router
,
amf_app_inst
);
m_statusNotifyApiImpl
=
std
::
make_shared
<
StatusNotifyApiImpl
>
(
m_router
,
amf_app_inst
);
}
void
init
(
size_t
thr
=
1
);
...
...
@@ -111,6 +114,7 @@ class AMFApiServer {
std
::
shared_ptr
<
SubscriptionsCollectionDocumentApiImplEventExposure
>
m_subscriptionsCollectionDocumentApiImplEventExposure
;
std
::
shared_ptr
<
N1MessageNotifyApiImpl
>
m_n1MessageNotifyApiImpl
;
std
::
shared_ptr
<
StatusNotifyApiImpl
>
m_statusNotifyApiImpl
;
std
::
string
m_address
;
};
src/sbi/amf_server/api/StatusNotifyApi.cpp
0 → 100644
View file @
b849a49c
/*
* 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
*/
#include "StatusNotifyApi.h"
#include "Helpers.h"
#include "amf_config.hpp"
#include "SmContextStatusNotification.h"
extern
config
::
amf_config
amf_cfg
;
namespace
oai
{
namespace
amf
{
namespace
api
{
using
namespace
oai
::
amf
::
helpers
;
using
namespace
oai
::
amf
::
model
;
StatusNotifyApi
::
StatusNotifyApi
(
std
::
shared_ptr
<
Pistache
::
Rest
::
Router
>
rtr
)
{
router
=
rtr
;
}
void
StatusNotifyApi
::
init
()
{
setupRoutes
();
}
void
StatusNotifyApi
::
setupRoutes
()
{
using
namespace
Pistache
::
Rest
;
Routes
::
Post
(
*
router
,
base
+
amf_cfg
.
sbi_api_version
+
"/pdu-session-release/callback/:ueContextId/:pduSessionId"
,
Routes
::
bind
(
&
StatusNotifyApi
::
notify_pdu_session_status_handler
,
this
));
// Default handler, called when a route is not found
router
->
addCustomHandler
(
Routes
::
bind
(
&
StatusNotifyApi
::
notify_status_default_handler
,
this
));
}
void
StatusNotifyApi
::
notify_pdu_session_status_handler
(
const
Pistache
::
Rest
::
Request
&
request
,
Pistache
::
Http
::
ResponseWriter
response
)
{
// Get SUPI
auto
ueContextId
=
request
.
param
(
":ueContextId"
).
as
<
std
::
string
>
();
// Get PDU Session ID
auto
pduSessionId
=
request
.
param
(
":pduSessionId"
).
as
<
std
::
string
>
();
// Getting the body param
SmContextStatusNotification
statusNotification
;
try
{
nlohmann
::
json
::
parse
(
request
.
body
()).
get_to
(
statusNotification
);
this
->
receive_pdu_session_status_notification
(
ueContextId
,
pduSessionId
,
statusNotification
,
response
);
}
catch
(
nlohmann
::
detail
::
exception
&
e
)
{
// send a 400 error
response
.
send
(
Pistache
::
Http
::
Code
::
Bad_Request
,
e
.
what
());
return
;
}
catch
(
Pistache
::
Http
::
HttpError
&
e
)
{
response
.
send
(
static_cast
<
Pistache
::
Http
::
Code
>
(
e
.
code
()),
e
.
what
());
return
;
}
catch
(
std
::
exception
&
e
)
{
// send a 500 error
response
.
send
(
Pistache
::
Http
::
Code
::
Internal_Server_Error
,
e
.
what
());
return
;
}
}
void
StatusNotifyApi
::
notify_status_default_handler
(
const
Pistache
::
Rest
::
Request
&
,
Pistache
::
Http
::
ResponseWriter
response
)
{
response
.
send
(
Pistache
::
Http
::
Code
::
Not_Found
,
"The requested method does not exist"
);
}
}
// namespace api
}
// namespace amf
}
// namespace oai
src/sbi/amf_server/api/StatusNotifyApi.h
0 → 100644
View file @
b849a49c
/*
* 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
*/
/*
* StatusNotifyApi.h
*
*
*/
#ifndef StatusNotifyApi_H_
#define StatusNotifyApi_H_
#include <pistache/http.h>
#include <pistache/router.h>
#include <pistache/http_headers.h>
#include <pistache/optional.h>
#include <SmContextStatusNotification.h>
namespace
oai
::
amf
::
api
{
using
namespace
oai
::
amf
::
model
;
class
StatusNotifyApi
{
public:
StatusNotifyApi
(
std
::
shared_ptr
<
Pistache
::
Rest
::
Router
>
);
virtual
~
StatusNotifyApi
()
{}
void
init
();
const
std
::
string
base
=
"/namf-status-notify/"
;
private:
void
setupRoutes
();
void
notify_pdu_session_status_handler
(
const
Pistache
::
Rest
::
Request
&
request
,
Pistache
::
Http
::
ResponseWriter
response
);
void
notify_status_default_handler
(
const
Pistache
::
Rest
::
Request
&
request
,
Pistache
::
Http
::
ResponseWriter
response
);
std
::
shared_ptr
<
Pistache
::
Rest
::
Router
>
router
;
/// <summary>
///
/// </summary>
/// <remarks>
///
/// </remarks>
/// <param name="NotificationData"></param>
virtual
void
receive_pdu_session_status_notification
(
const
std
::
string
&
ueContextId
,
const
std
::
string
&
pduSessionId
,
const
SmContextStatusNotification
&
statusNotification
,
Pistache
::
Http
::
ResponseWriter
&
response
)
=
0
;
};
}
// namespace oai::amf::api
#endif
/* StatusNotifyApi_H_ */
src/sbi/amf_server/impl/StatusNotifyApiImpl.cpp
0 → 100644
View file @
b849a49c
/**
* Nsmf_EventExposure
* Session Management Event Exposure Service. © 2019, 3GPP Organizational
* Partners (ARIB, ATIS, CCSA, ETSI, TSDSI, TTA, TTC). All rights reserved.
*
* The version of the OpenAPI document: 1.1.0.alpha-1
*
*
* NOTE: This class is auto generated by OpenAPI Generator
* (https://openapi-generator.tech). https://openapi-generator.tech Do not edit
* the class manually.
*/
/*
* 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
*/
#include "3gpp_29.500.h"
#include "logger.hpp"
#include "itti_msg_sbi.hpp"
#include "StatusNotifyApiImpl.h"
#include "conversions.hpp"
extern
itti_mw
*
itti_inst
;
namespace
oai
{
namespace
amf
{
namespace
api
{
using
namespace
oai
::
amf
::
model
;
StatusNotifyApiImpl
::
StatusNotifyApiImpl
(
std
::
shared_ptr
<
Pistache
::
Rest
::
Router
>
rtr
,
amf_application
::
amf_app
*
amf_app_inst
)
:
StatusNotifyApi
(
rtr
),
m_amf_app
(
amf_app_inst
)
{}
void
StatusNotifyApiImpl
::
receive_pdu_session_status_notification
(
const
std
::
string
&
ueContextId
,
const
std
::
string
&
pduSessionId
,
const
SmContextStatusNotification
&
statusNotification
,
Pistache
::
Http
::
ResponseWriter
&
response
)
{
Logger
::
amf_server
().
debug
(
"Receive PDU Session Release notification, handling..."
);
uint8_t
pdu_session_id
=
0
;
if
(
conv
::
string_to_int8
(
pduSessionId
,
pdu_session_id
))
{
// TODO:
Logger
::
amf_server
().
debug
(
"Invalid PDU Session ID value"
);
response
.
send
(
Pistache
::
Http
::
Code
::
No_Content
);
}
// Generate a promise and associate this promise to the ITTI message
uint32_t
promise_id
=
m_amf_app
->
generate_promise_id
();
Logger
::
amf_n1
().
debug
(
"Promise ID generated %d"
,
promise_id
);
boost
::
shared_ptr
<
boost
::
promise
<
nlohmann
::
json
>>
p
=
boost
::
make_shared
<
boost
::
promise
<
nlohmann
::
json
>>
();
boost
::
shared_future
<
nlohmann
::
json
>
f
=
p
->
get_future
();
m_amf_app
->
add_promise
(
promise_id
,
p
);
// Handle the PDU Session Release in amf_app
std
::
shared_ptr
<
itti_sbi_pdu_session_release_notif
>
itti_msg
=
std
::
make_shared
<
itti_sbi_pdu_session_release_notif
>
(
TASK_AMF_SBI
,
TASK_AMF_APP
,
promise_id
);
itti_msg
->
http_version
=
1
;
itti_msg
->
promise_id
=
promise_id
;
itti_msg
->
ue_id
=
ueContextId
;
itti_msg
->
pdu_session_id
=
pdu_session_id
;
itti_msg
->
smContextStatusNotification
=
statusNotification
;
int
ret
=
itti_inst
->
send_msg
(
itti_msg
);
if
(
0
!=
ret
)
{
Logger
::
amf_server
().
error
(
"Could not send ITTI message %s to task TASK_AMF_APP"
,
itti_msg
->
get_msg_name
());
}
boost
::
future_status
status
;
// wait for timeout or ready
status
=
f
.
wait_for
(
boost
::
chrono
::
milliseconds
(
FUTURE_STATUS_TIMEOUT_MS
));
if
(
status
==
boost
::
future_status
::
ready
)
{
assert
(
f
.
is_ready
());
assert
(
f
.
has_value
());
assert
(
!
f
.
has_exception
());
// Wait for the result from APP
// result includes json content and http response code
nlohmann
::
json
result
=
f
.
get
();
Logger
::
amf_server
().
debug
(
"Got result for promise ID %d"
,
promise_id
);
response
.
send
(
Pistache
::
Http
::
Code
::
No_Content
);
}
}
}
// namespace api
}
// namespace amf
}
// namespace oai
src/sbi/amf_server/impl/StatusNotifyApiImpl.h
0 → 100644
View file @
b849a49c
/**
* Nsmf_EventExposure
* Session Management Event Exposure Service. © 2019, 3GPP Organizational
* Partners (ARIB, ATIS, CCSA, ETSI, TSDSI, TTA, TTC). All rights reserved.
*
* The version of the OpenAPI document: 1.1.0.alpha-1
*
*
* NOTE: This class is auto generated by OpenAPI Generator
* (https://openapi-generator.tech). https://openapi-generator.tech Do not edit
* the class manually.
*/
/*
* StatusNotifyApiImpl.h
*
*
*/
/*
* 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 STATUS_NOTIFY_API_IMPL_H_
#define STATUS_NOTIFY_API_IMPL_H_
#include <pistache/endpoint.h>
#include <pistache/http.h>
#include <pistache/router.h>
#include <memory>
#include <pistache/optional.h>
#include "StatusNotifyApi.h"
#include "ProblemDetails.h"
#include "amf_app.hpp"
namespace
oai
{
namespace
amf
{
namespace
api
{
using
namespace
oai
::
amf
::
model
;
class
StatusNotifyApiImpl
:
public
oai
::
amf
::
api
::
StatusNotifyApi
{
public:
StatusNotifyApiImpl
(
std
::
shared_ptr
<
Pistache
::
Rest
::
Router
>
,
amf_application
::
amf_app
*
amf_app_inst
);
~
StatusNotifyApiImpl
()
{}
void
receive_pdu_session_status_notification
(
const
std
::
string
&
ueContextId
,
const
std
::
string
&
pduSessionId
,
const
SmContextStatusNotification
&
statusNotification
,
Pistache
::
Http
::
ResponseWriter
&
response
);
private:
amf_application
::
amf_app
*
m_amf_app
;
// std::string m_address;
};
}
// namespace api
}
// namespace amf
}
// namespace oai
#endif
src/sbi/amf_server/model/Cause.cpp
0 → 100644
View file @
b849a49c
/**
* Nsmf_PDUSession
* SMF PDU Session Service. © 2019, 3GPP Organizational Partners (ARIB, ATIS,
* CCSA, ETSI, TSDSI, TTA, TTC). All rights reserved.
*
* The version of the OpenAPI document: 1.1.0.alpha-1
*
*
* NOTE: This class is auto generated by OpenAPI Generator
* (https://openapi-generator.tech). https://openapi-generator.tech Do not edit
* the class manually.
*/
#include "Cause.h"
namespace
oai
{
namespace
amf
{
namespace
model
{
Cause
::
Cause
()
{}
Cause
::~
Cause
()
{}
void
Cause
::
validate
()
{
// TODO: implement validation
}
std
::
string
Cause
::
getValue
()
const
{
return
cause
;
}
void
Cause
::
setValue
(
const
std
::
string
&
value
)
{
cause
=
value
;
}
void
to_json
(
nlohmann
::
json
&
j
,
const
Cause
&
o
)
{
j
=
nlohmann
::
json
();
}
void
from_json
(
const
nlohmann
::
json
&
j
,
Cause
&
o
)
{
j
.
get_to
(
o
.
cause
);
}
}
// namespace model
}
// namespace amf
}
// namespace oai
src/sbi/amf_server/model/Cause.h
0 → 100644
View file @
b849a49c
/**
* Nsmf_PDUSession
* SMF PDU Session Service. © 2019, 3GPP Organizational Partners (ARIB, ATIS,
* CCSA, ETSI, TSDSI, TTA, TTC). All rights reserved.
*
* The version of the OpenAPI document: 1.1.0.alpha-1
*
*
* NOTE: This class is auto generated by OpenAPI Generator
* (https://openapi-generator.tech). https://openapi-generator.tech Do not edit
* the class manually.
*/
/*
* Cause.h
*
* Possible values are - REL_DUE_TO_HO - EPS_FALLBACK - REL_DUE_TO_UP_SEC -
* DNN_CONGESTION - S_NSSAI_CONGESTION - REL_DUE_TO_REACTIVATION -
* 5G_AN_NOT_RESPONDING - REL_DUE_TO_SLICE_NOT_AVAILABLE -
* REL_DUE_TO_DUPLICATE_SESSION_ID - PDU_SESSION_STATUS_MISMATCH - HO_FAILURE -
* INSUFFICIENT_UP_RESOURCES - PDU_SESSION_HANDED_OVER
*/
#ifndef Cause_H_
#define Cause_H_
#include <nlohmann/json.hpp>
namespace
oai
{
namespace
amf
{
namespace
model
{
/// <summary>
/// Possible values are - REL_DUE_TO_HO - EPS_FALLBACK - REL_DUE_TO_UP_SEC -
/// DNN_CONGESTION - S_NSSAI_CONGESTION - REL_DUE_TO_REACTIVATION -
/// 5G_AN_NOT_RESPONDING - REL_DUE_TO_SLICE_NOT_AVAILABLE -
/// REL_DUE_TO_DUPLICATE_SESSION_ID - PDU_SESSION_STATUS_MISMATCH - HO_FAILURE -
/// INSUFFICIENT_UP_RESOURCES - PDU_SESSION_HANDED_OVER
/// </summary>
class
Cause
{
public:
Cause
();
virtual
~
Cause
();
void
validate
();
/////////////////////////////////////////////
/// Cause members
std
::
string
getValue
()
const
;
void
setValue
(
const
std
::
string
&
value
);
friend
void
to_json
(
nlohmann
::
json
&
j
,
const
Cause
&
o
);
friend
void
from_json
(
const
nlohmann
::
json
&
j
,
Cause
&
o
);
protected:
std
::
string
cause
;
};
}
// namespace model
}
// namespace amf
}
// namespace oai
#endif
/* Cause_H_ */
src/sbi/amf_server/model/ResourceStatus.cpp
0 → 100644
View file @
b849a49c
/**
* Nsmf_PDUSession
* SMF PDU Session Service. © 2019, 3GPP Organizational Partners (ARIB, ATIS,
* CCSA, ETSI, TSDSI, TTA, TTC). All rights reserved.
*
* The version of the OpenAPI document: 1.1.0.alpha-1
*
*
* NOTE: This class is auto generated by OpenAPI Generator
* (https://openapi-generator.tech). https://openapi-generator.tech Do not edit
* the class manually.
*/
#include "ResourceStatus.h"
namespace
oai
{
namespace
amf
{
namespace
model
{
ResourceStatus
::
ResourceStatus
()
{}
ResourceStatus
::~
ResourceStatus
()
{}
void
ResourceStatus
::
validate
()
{
// TODO: implement validation
}
std
::
string
ResourceStatus
::
getValue
()
const
{
return
status
;
}
void
ResourceStatus
::
getValue
(
std
::
string
&
v
)
const
{
v
=
status
;
}
void
ResourceStatus
::
setValue
(
const
std
::
string
&
v
)
{
status
=
v
;
}
void
to_json
(
nlohmann
::
json
&
j
,
const
ResourceStatus
&
o
)
{
j
=
nlohmann
::
json
();
}
void
from_json
(
const
nlohmann
::
json
&
j
,
ResourceStatus
&
o
)
{
j
.
get_to
(
o
.
status
);
}
}
// namespace model
}
// namespace amf
}
// namespace oai
src/sbi/amf_server/model/ResourceStatus.h
0 → 100644
View file @
b849a49c
/**
* Nsmf_PDUSession
* SMF PDU Session Service. © 2019, 3GPP Organizational Partners (ARIB, ATIS,
* CCSA, ETSI, TSDSI, TTA, TTC). All rights reserved.
*
* The version of the OpenAPI document: 1.1.0.alpha-1
*
*
* NOTE: This class is auto generated by OpenAPI Generator
* (https://openapi-generator.tech). https://openapi-generator.tech Do not edit
* the class manually.
*/
/*
* ResourceStatus.h
*
* Possible values are - RELEASED
*/
#ifndef ResourceStatus_H_
#define ResourceStatus_H_
#include <nlohmann/json.hpp>
namespace
oai
{
namespace
amf
{
namespace
model
{
/// <summary>
/// Possible values are - RELEASED
/// </summary>
class
ResourceStatus
{
public:
ResourceStatus
();
virtual
~
ResourceStatus
();
void
validate
();
std
::
string
getValue
()
const
;
void
getValue
(
std
::
string
&
value
)
const
;
void
setValue
(
const
std
::
string
&
v
);
/////////////////////////////////////////////
/// ResourceStatus members
friend
void
to_json
(
nlohmann
::
json
&
j
,
const
ResourceStatus
&
o
);
friend
void
from_json
(
const
nlohmann
::
json
&
j
,
ResourceStatus
&
o
);
protected:
std
::
string
status
;
};
}
// namespace model
}
// namespace amf
}
// namespace oai
#endif
/* ResourceStatus_H_ */
src/sbi/amf_server/model/SmContextStatusNotification.cpp
0 → 100644
View file @
b849a49c
/**
* Nsmf_PDUSession
* SMF PDU Session Service. © 2019, 3GPP Organizational Partners (ARIB, ATIS,
* CCSA, ETSI, TSDSI, TTA, TTC). All rights reserved.
*
* The version of the OpenAPI document: 1.1.0.alpha-1
*
*
* NOTE: This class is auto generated by OpenAPI Generator
* (https://openapi-generator.tech). https://openapi-generator.tech Do not edit
* the class manually.
*/
#include "SmContextStatusNotification.h"
namespace
oai
{
namespace
amf
{
namespace
model
{
SmContextStatusNotification
::
SmContextStatusNotification
()
{}
SmContextStatusNotification
::~
SmContextStatusNotification
()
{}
void
SmContextStatusNotification
::
validate
()
{
// TODO: implement validation
}
void
to_json
(
nlohmann
::
json
&
j
,
const
SmContextStatusNotification
&
o
)
{
j
=
nlohmann
::
json
();
j
[
"statusInfo"
]
=
o
.
m_StatusInfo
;
}
void
from_json
(
const
nlohmann
::
json
&
j
,
SmContextStatusNotification
&
o
)
{
j
.
at
(
"statusInfo"
).
get_to
(
o
.
m_StatusInfo
);
}
StatusInfo
SmContextStatusNotification
::
getStatusInfo
()
const
{
return
m_StatusInfo
;
}
void
SmContextStatusNotification
::
setStatusInfo
(
StatusInfo
const
&
value
)
{
m_StatusInfo
=
value
;
}
}
// namespace model
}
// namespace amf
}
// namespace oai
src/sbi/amf_server/model/SmContextStatusNotification.h
0 → 100644
View file @
b849a49c
/**
* Nsmf_PDUSession
* SMF PDU Session Service. © 2019, 3GPP Organizational Partners (ARIB, ATIS,
* CCSA, ETSI, TSDSI, TTA, TTC). All rights reserved.
*
* The version of the OpenAPI document: 1.1.0.alpha-1
*
*
* NOTE: This class is auto generated by OpenAPI Generator
* (https://openapi-generator.tech). https://openapi-generator.tech Do not edit
* the class manually.
*/
/*
* SmContextStatusNotification.h
*
*
*/
#ifndef SmContextStatusNotification_H_
#define SmContextStatusNotification_H_
#include "StatusInfo.h"
#include <nlohmann/json.hpp>
namespace
oai
{
namespace
amf
{
namespace
model
{
/// <summary>
///
/// </summary>
class
SmContextStatusNotification
{
public:
SmContextStatusNotification
();
virtual
~
SmContextStatusNotification
();
void
validate
();
/////////////////////////////////////////////
/// SmContextStatusNotification members
/// <summary>
///
/// </summary>
StatusInfo
getStatusInfo
()
const
;
void
setStatusInfo
(
StatusInfo
const
&
value
);
friend
void
to_json
(
nlohmann
::
json
&
j
,
const
SmContextStatusNotification
&
o
);
friend
void
from_json
(
const
nlohmann
::
json
&
j
,
SmContextStatusNotification
&
o
);
protected:
StatusInfo
m_StatusInfo
;
};
}
// namespace model
}
// namespace amf
}
// namespace oai
#endif
/* SmContextStatusNotification_H_ */
src/sbi/amf_server/model/StatusInfo.cpp
0 → 100644
View file @
b849a49c
/**
* Nsmf_PDUSession
* SMF PDU Session Service. © 2019, 3GPP Organizational Partners (ARIB, ATIS,
* CCSA, ETSI, TSDSI, TTA, TTC). All rights reserved.
*
* The version of the OpenAPI document: 1.1.0.alpha-1
*
*
* NOTE: This class is auto generated by OpenAPI Generator
* (https://openapi-generator.tech). https://openapi-generator.tech Do not edit
* the class manually.
*/
#include "StatusInfo.h"
namespace
oai
{
namespace
amf
{
namespace
model
{
StatusInfo
::
StatusInfo
()
{
m_CauseIsSet
=
false
;
}
StatusInfo
::~
StatusInfo
()
{}
void
StatusInfo
::
validate
()
{
// TODO: implement validation
}
void
to_json
(
nlohmann
::
json
&
j
,
const
StatusInfo
&
o
)
{
j
=
nlohmann
::
json
();
j
[
"resourceStatus"
]
=
o
.
m_ResourceStatus
;
if
(
o
.
causeIsSet
())
j
[
"cause"
]
=
o
.
m_Cause
;
}
void
from_json
(
const
nlohmann
::
json
&
j
,
StatusInfo
&
o
)
{
j
.
at
(
"resourceStatus"
).
get_to
(
o
.
m_ResourceStatus
);
if
(
j
.
find
(
"cause"
)
!=
j
.
end
())
{
j
.
at
(
"cause"
).
get_to
(
o
.
m_Cause
);
o
.
m_CauseIsSet
=
true
;
}
}
ResourceStatus
StatusInfo
::
getResourceStatus
()
const
{
return
m_ResourceStatus
;
}
void
StatusInfo
::
setResourceStatus
(
ResourceStatus
const
&
value
)
{
m_ResourceStatus
=
value
;
}
Cause
StatusInfo
::
getCause
()
const
{
return
m_Cause
;
}
void
StatusInfo
::
setCause
(
Cause
const
&
value
)
{
m_Cause
=
value
;
m_CauseIsSet
=
true
;
}
bool
StatusInfo
::
causeIsSet
()
const
{
return
m_CauseIsSet
;
}
void
StatusInfo
::
unsetCause
()
{
m_CauseIsSet
=
false
;
}
}
// namespace model
}
// namespace amf
}
// namespace oai
src/sbi/amf_server/model/StatusInfo.h
0 → 100644
View file @
b849a49c
/**
* Nsmf_PDUSession
* SMF PDU Session Service. © 2019, 3GPP Organizational Partners (ARIB, ATIS,
* CCSA, ETSI, TSDSI, TTA, TTC). All rights reserved.
*
* The version of the OpenAPI document: 1.1.0.alpha-1
*
*
* NOTE: This class is auto generated by OpenAPI Generator
* (https://openapi-generator.tech). https://openapi-generator.tech Do not edit
* the class manually.
*/
/*
* StatusInfo.h
*
*
*/
#ifndef StatusInfo_H_
#define StatusInfo_H_
#include "Cause.h"
#include "ResourceStatus.h"
#include <nlohmann/json.hpp>
namespace
oai
{
namespace
amf
{
namespace
model
{
/// <summary>
///
/// </summary>
class
StatusInfo
{
public:
StatusInfo
();
virtual
~
StatusInfo
();
void
validate
();
/////////////////////////////////////////////
/// StatusInfo members
/// <summary>
///
/// </summary>
ResourceStatus
getResourceStatus
()
const
;
void
setResourceStatus
(
ResourceStatus
const
&
value
);
/// <summary>
///
/// </summary>
Cause
getCause
()
const
;
void
setCause
(
Cause
const
&
value
);
bool
causeIsSet
()
const
;
void
unsetCause
();
friend
void
to_json
(
nlohmann
::
json
&
j
,
const
StatusInfo
&
o
);
friend
void
from_json
(
const
nlohmann
::
json
&
j
,
StatusInfo
&
o
);
protected:
ResourceStatus
m_ResourceStatus
;
Cause
m_Cause
;
bool
m_CauseIsSet
;
};
}
// namespace model
}
// namespace amf
}
// namespace oai
#endif
/* StatusInfo_H_ */
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