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
8b47068f
Commit
8b47068f
authored
Nov 24, 2020
by
Tien-Thinh Nguyen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update event handling model
parent
b3bef24d
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
161 additions
and
186 deletions
+161
-186
src/smf_app/smf_context.cpp
src/smf_app/smf_context.cpp
+53
-9
src/smf_app/smf_context.hpp
src/smf_app/smf_context.hpp
+25
-3
src/smf_app/smf_event.cpp
src/smf_app/smf_event.cpp
+7
-111
src/smf_app/smf_event.hpp
src/smf_app/smf_event.hpp
+16
-63
src/smf_app/smf_event_sig.hpp
src/smf_app/smf_event_sig.hpp
+60
-0
No files found.
src/smf_app/smf_context.cpp
View file @
8b47068f
...
...
@@ -2089,11 +2089,14 @@ void smf_context::handle_pdu_session_update_sm_context_request(
"Received a PDU Session Update SM Context Request, couldn't retrieve the corresponding SMF context, ignore message!"
);
//TODO: return;
}
smf_event
::
get_instance
().
trigger_sm_context_status_notification
(
scid
,
static_cast
<
uint32_t
>
(
sm_context_status_e
::
SM_CONTEXT_STATUS_RELEASED
),
smreq
->
http_version
);
//smf_event::get_instance().trigger_sm_context_status_notification(scid, static_cast<uint32_t>(sm_context_status_e::SM_CONTEXT_STATUS_RELEASED), smreq->http_version);
event_sub
.
sm_context_status
(
scid
,
static_cast
<
uint32_t
>
(
sm_context_status_e
::
SM_CONTEXT_STATUS_RELEASED
),
smreq
->
http_version
);
//Get SUPI
supi64_t
supi64
=
smf_supi_to_u64
(
sm_context_req_msg
.
get_supi
());
//Trigger PDU Session Release event notification
smf_event
::
get_instance
().
trigger_ee_pdu_session_release
(
supi64
,
sm_context_req_msg
.
get_pdu_session_id
(),
smreq
->
http_version
);
//smf_event::get_instance().trigger_ee_pdu_session_release(supi64, sm_context_req_msg.get_pdu_session_id(), smreq->http_version);
event_sub
.
ee_pdu_session_release
(
supi64
,
sm_context_req_msg
.
get_pdu_session_id
(),
smreq
->
http_version
);
//TODO: if dynamic PCC applied, SMF invokes an SM Policy Association Termination
//TODO: SMF unsubscribes from Session Management Subscription data changes notification from UDM by invoking Numd_SDM_Unsubscribe
...
...
@@ -2871,10 +2874,11 @@ bool smf_context::find_pdu_session(const pfcp::pdr_id_t &pdr_id,
return
false
;
}
//---------------------------------------------------------------------------------------------
void
smf_context
::
send_sm_context_status_notification
(
scid_t
scid
,
uint32_t
status
,
uint8_t
http_version
)
{
Logger
::
smf_app
().
debug
(
"Send request to N11 to triger SM Context Status Notification, SMF Context ID "
SCID_FMT
" "
,
scid
);
//------------------------------------------------------------------------------
void
smf_context
::
handle_sm_context_status_change
(
scid_t
scid
,
uint8_t
status
,
uint8_t
http_version
)
{
Logger
::
smf_app
().
debug
(
"Send request to N11 to triger SM Context Status Notification to AMF, SMF Context ID "
SCID_FMT
" "
,
scid
);
std
::
shared_ptr
<
smf_context_ref
>
scf
=
{
};
if
(
smf_app_inst
->
is_scid_2_smf_context
(
scid
))
{
...
...
@@ -2898,8 +2902,49 @@ void smf_context::send_sm_context_status_notification(scid_t scid,
int
ret
=
itti_inst
->
send_msg
(
itti_msg
);
if
(
RETURNok
!=
ret
)
{
Logger
::
smf_app
().
error
(
"Could not send ITTI message %s to task TASK_SMF_N11"
,
itti_msg
->
get_msg_name
());
Logger
::
smf_app
().
error
(
"Could not send ITTI message %s to task TASK_SMF_N11"
,
itti_msg
->
get_msg_name
());
}
}
//------------------------------------------------------------------------------
void
smf_context
::
handle_ee_pdu_session_release
(
supi64_t
supi
,
pdu_session_id_t
pdu_session_id
,
uint8_t
http_version
)
{
Logger
::
smf_app
().
debug
(
"Send request to N11 to triger PDU Session Release Notification (Event Exposure), SUPI "
SUPI_64_FMT
" , PDU Session ID %d, HTTP version %d"
,
supi
,
pdu_session_id
,
http_version
);
std
::
vector
<
std
::
shared_ptr
<
smf_subscription
>>
subscriptions
=
{};
smf_app_inst
->
get_ee_subscriptions
(
smf_event_t
::
SMF_EVENT_PDU_SES_REL
,
subscriptions
);
if
(
subscriptions
.
size
()
>
0
)
{
//Send request to N11 to trigger the notification to the subscribed event
Logger
::
smf_app
().
debug
(
"Send ITTI msg to SMF N11 to trigger the event notification"
);
std
::
shared_ptr
<
itti_n11_notify_subscribed_event
>
itti_msg
=
std
::
make_shared
<
itti_n11_notify_subscribed_event
>
(
TASK_SMF_APP
,
TASK_SMF_N11
);
for
(
auto
i
:
subscriptions
)
{
event_notification
ev_notif
=
{
};
ev_notif
.
set_supi
(
supi
);
ev_notif
.
set_pdu_session_id
(
pdu_session_id
);
ev_notif
.
set_smf_event
(
smf_event_t
::
SMF_EVENT_PDU_SES_REL
);
ev_notif
.
set_supi
(
supi
);
ev_notif
.
set_notif_uri
(
i
.
get
()
->
notif_uri
);
ev_notif
.
set_notif_id
(
i
.
get
()
->
notif_id
);
itti_msg
->
event_notifs
.
push_back
(
ev_notif
);
}
itti_msg
->
http_version
=
http_version
;
int
ret
=
itti_inst
->
send_msg
(
itti_msg
);
if
(
RETURNok
!=
ret
)
{
Logger
::
smf_app
().
error
(
"Could not send ITTI message %s to task TASK_SMF_N11"
,
itti_msg
->
get_msg_name
());
}
}
else
{
Logger
::
smf_app
().
debug
(
"No subscription available for this event"
);
}
}
...
...
@@ -2954,4 +2999,3 @@ std::string dnn_context::toString() const {
}
return
s
;
}
src/smf_app/smf_context.hpp
View file @
8b47068f
...
...
@@ -52,6 +52,7 @@
#include "uint_generator.hpp"
#include "SmContextCreateData.h"
#include "SmContextCreateError.h"
#include "smf_event.hpp"
extern
"C"
{
#include "QOSRules.h"
...
...
@@ -562,8 +563,14 @@ class smf_context : public std::enable_shared_from_this<smf_context> {
m_context
(),
pending_procedures
(),
dnn_subscriptions
(),
scid
(
0
)
{
scid
(
0
)
,
event_sub
(
smf_event
::
get_instance
())
{
supi_prefix
=
{
};
// subscribe to sm context status change
event_sub
.
subscribe_sm_context_status
(
boost
::
bind
(
&
smf_context
::
handle_sm_context_status_change
,
this
,
_1
,
_1
,
_1
));
// subscribe to pdu session release (event exposure)
event_sub
.
subscribe_ee_pdu_session_release
(
boost
::
bind
(
&
smf_context
::
handle_ee_pdu_session_release
,
this
,
_1
,
_1
,
_1
));
}
smf_context
(
smf_context
&
b
)
=
delete
;
...
...
@@ -824,13 +831,25 @@ class smf_context : public std::enable_shared_from_this<smf_context> {
std
::
shared_ptr
<
smf_pdu_session
>
&
sp
);
/*
*
Send ITTI msg to N11 to trigger the SM Context Status Notification to AMF
*
Handle SM Context Status Change (Send notification AMF)
* @param [scid_t] scid: SMF Context ID
* @param [uint32_t] status: Updated status
* @param [uint8_t] http_version: HTTP version
* @return void
*/
void
send_sm_context_status_notification
(
scid_t
scid
,
uint32_t
status
,
uint8_t
http_version
);
void
handle_sm_context_status_change
(
scid_t
scid
,
uint8_t
status
,
uint8_t
http_version
);
/*
* Handle SM Context Status Change (Send notification AMF)
* @param [scid_t] scid: SMF Context ID
* @param [uint32_t] status: Updated status
* @param [uint8_t] http_version: HTTP version
* @return void
*/
void
handle_ee_pdu_session_release
(
supi64_t
supi
,
pdu_session_id_t
pdu_session_id
,
uint8_t
http_version
);
private:
std
::
vector
<
std
::
shared_ptr
<
dnn_context
>>
dnns
;
...
...
@@ -842,6 +861,9 @@ class smf_context : public std::enable_shared_from_this<smf_context> {
scid_t
scid
;
//SM Context ID
// Big recursive lock
mutable
std
::
recursive_mutex
m_context
;
//for Event Handling
smf_event
&
event_sub
;
};
}
...
...
src/smf_app/smf_event.cpp
View file @
8b47068f
...
...
@@ -33,121 +33,17 @@
#include "itti.hpp"
using
namespace
smf
;
extern
smf
::
smf_app
*
smf_app_inst
;
extern
smf
::
smf_app
*
smf_app_inst
;
extern
itti_mw
*
itti_inst
;
smf_event
::
smf_event
()
{
//bind signal to slot type
bind
();
}
//------------------------------------------------------------------------------
void
smf_event
::
bind
()
{
//by default, subscribe to the events
subscribe_sm_context_status_notification
(
boost
::
bind
(
&
smf_event
::
send_sm_context_status_notification
,
this
,
_1
,
_1
,
_1
));
subscribe_ee_pdu_session_release
(
boost
::
bind
(
&
smf_event
::
send_ee_pdu_session_release
,
this
,
_1
,
_1
,
_1
));
bs2
::
connection
smf_event
::
subscribe_sm_context_status
(
const
sm_context_status_sig_t
::
slot_type
&
sig
)
{
return
sm_context_status
.
connect
(
sig
);
}
//------------------------------------------------------------------------------
boost
::
signals2
::
connection
smf_event
::
subscribe_sm_context_status_notification
(
const
sm_context_status_sig_t
::
slot_type
&
context_status_st
)
{
return
sm_context_status_sig
.
connect
(
context_status_st
);
}
//------------------------------------------------------------------------------
void
smf_event
::
trigger_sm_context_status_notification
(
scid_t
scid
,
uint8_t
status
,
uint8_t
http_version
)
{
sm_context_status_sig
(
scid
,
status
,
http_version
);
}
//------------------------------------------------------------------------------
void
smf_event
::
send_sm_context_status_notification
(
scid_t
scid
,
uint8_t
status
,
uint8_t
http_version
)
{
Logger
::
smf_app
().
debug
(
"Send request to N11 to triger SM Context Status Notification to AMF, SMF Context ID "
SCID_FMT
" "
,
scid
);
std
::
shared_ptr
<
smf_context_ref
>
scf
=
{
};
if
(
smf_app_inst
->
is_scid_2_smf_context
(
scid
))
{
scf
=
smf_app_inst
->
scid_2_smf_context
(
scid
);
}
else
{
Logger
::
smf_app
().
warn
(
"SM Context associated with this id "
SCID_FMT
" does not exit!"
,
scid
);
//TODO:
return
;
}
//Send request to N11 to trigger the notification
Logger
::
smf_app
().
debug
(
"Send ITTI msg to SMF N11 to trigger the status notification"
);
std
::
shared_ptr
<
itti_n11_notify_sm_context_status
>
itti_msg
=
std
::
make_shared
<
itti_n11_notify_sm_context_status
>
(
TASK_SMF_APP
,
TASK_SMF_N11
);
itti_msg
->
scid
=
scid
;
itti_msg
->
sm_context_status
=
sm_context_status_e2str
[
status
];
itti_msg
->
amf_status_uri
=
scf
.
get
()
->
amf_status_uri
;
itti_msg
->
http_version
=
http_version
;
int
ret
=
itti_inst
->
send_msg
(
itti_msg
);
if
(
RETURNok
!=
ret
)
{
Logger
::
smf_app
().
error
(
"Could not send ITTI message %s to task TASK_SMF_N11"
,
itti_msg
->
get_msg_name
());
}
}
//------------------------------------------------------------------------------
boost
::
signals2
::
connection
smf_event
::
subscribe_ee_pdu_session_release
(
const
ee_pdu_session_release_sig_t
::
slot_type
&
pdu_session_release_st
)
{
return
pdu_session_release_sig
.
connect
(
pdu_session_release_st
);
}
//------------------------------------------------------------------------------
void
smf_event
::
trigger_ee_pdu_session_release
(
supi64_t
supi
,
pdu_session_id_t
pdu_session_id
,
uint8_t
http_version
)
{
Logger
::
smf_app
().
debug
(
"Trigger PDU Session Release event (Event Exposure) notification"
);
pdu_session_release_sig
(
supi
,
pdu_session_id
,
http_version
);
}
//------------------------------------------------------------------------------
void
smf_event
::
send_ee_pdu_session_release
(
supi64_t
supi
,
pdu_session_id_t
pdu_session_id
,
uint8_t
http_version
)
{
Logger
::
smf_app
().
debug
(
"Send request to N11 to triger PDU Session Release Notification (Event Exposure), SUPI "
SUPI_64_FMT
" , PDU Session ID %d, HTTP version %d"
,
supi
,
pdu_session_id
,
http_version
);
std
::
vector
<
std
::
shared_ptr
<
smf_subscription
>>
subscriptions
=
{};
smf_app_inst
->
get_ee_subscriptions
(
smf_event_t
::
SMF_EVENT_PDU_SES_REL
,
subscriptions
);
if
(
subscriptions
.
size
()
>
0
)
{
//Send request to N11 to trigger the notification to the subscribed event
Logger
::
smf_app
().
debug
(
"Send ITTI msg to SMF N11 to trigger the event notification"
);
std
::
shared_ptr
<
itti_n11_notify_subscribed_event
>
itti_msg
=
std
::
make_shared
<
itti_n11_notify_subscribed_event
>
(
TASK_SMF_APP
,
TASK_SMF_N11
);
for
(
auto
i
:
subscriptions
)
{
event_notification
ev_notif
=
{
};
ev_notif
.
set_supi
(
supi
);
ev_notif
.
set_pdu_session_id
(
pdu_session_id
);
ev_notif
.
set_smf_event
(
smf_event_t
::
SMF_EVENT_PDU_SES_REL
);
ev_notif
.
set_supi
(
supi
);
ev_notif
.
set_notif_uri
(
i
.
get
()
->
notif_uri
);
ev_notif
.
set_notif_id
(
i
.
get
()
->
notif_id
);
itti_msg
->
event_notifs
.
push_back
(
ev_notif
);
}
itti_msg
->
http_version
=
http_version
;
int
ret
=
itti_inst
->
send_msg
(
itti_msg
);
if
(
RETURNok
!=
ret
)
{
Logger
::
smf_app
().
error
(
"Could not send ITTI message %s to task TASK_SMF_N11"
,
itti_msg
->
get_msg_name
());
}
}
else
{
Logger
::
smf_app
().
debug
(
"No subscription available for this event"
);
}
bs2
::
connection
smf_event
::
subscribe_ee_pdu_session_release
(
const
ee_pdu_session_release_sig_t
::
slot_type
&
sig
)
{
return
ee_pdu_session_release
.
connect
(
sig
);
}
src/smf_app/smf_event.hpp
View file @
8b47068f
...
...
@@ -31,26 +31,18 @@
#define FILE_SMF_EVENT_HPP_SEEN
#include <boost/signals2.hpp>
namespace
bs2
=
boost
::
signals2
;
#include "smf.h"
#include "
3gpp_24.007.h
"
#include "
smf_event_sig.hpp
"
namespace
smf
{
typedef
boost
::
signals2
::
signal
<
void
(
scid_t
,
uint8_t
,
uint8_t
)
>
sm_context_status_sig_t
;
//SCID, PDU Session Status, HTTP version
//For Event Exposure
typedef
boost
::
signals2
::
signal
<
void
(
supi64_t
,
pdu_session_id_t
,
uint8_t
)
>
ee_pdu_session_release_sig_t
;
//SUPI, PDU SessionID, HTTP version
//typedef boost::signals2::signal<void(uint32_t, uint32_t)> ee_ue_ip_address_change_sig_t; //UI IP Address, UE ID
//TODO:
//Access Type Change
//UP Path Change
//PLMN Change
//Downlink data delivery status
class
smf_event
{
public:
smf_event
();
smf_event
()
{
}
;
smf_event
(
smf_event
const
&
)
=
delete
;
void
operator
=
(
smf_event
const
&
)
=
delete
;
...
...
@@ -59,68 +51,29 @@ class smf_event {
return
instance
;
}
/*
* Bind the signals to corresponding slot for each event
* @return void
*/
void
bind
();
// class register/handle event
friend
class
smf_app
;
friend
class
smf_context
;
/*
* Subscribe to SM Context Status Notification signal
* @param [const sm_context_status_sig_t::slot_type&]
context_status_st
: slot_type parameter
* @param [const sm_context_status_sig_t::slot_type&]
sig
: slot_type parameter
* @return boost::signals2::connection: the connection between the signal and the slot
*/
boost
::
signals2
::
connection
subscribe_sm_context_status_notification
(
const
sm_context_status_sig_t
::
slot_type
&
context_status_st
);
bs2
::
connection
subscribe_sm_context_status
(
const
sm_context_status_sig_t
::
slot_type
&
sig
);
/*
* Subscribe to Event Exposure Event: PDU Session Release
* @param [const ee_pdu_session_release_sig_t::slot_type&]
pdu_session_release_st
: slot_type parameter
* @param [const ee_pdu_session_release_sig_t::slot_type&]
sig
: slot_type parameter
* @return boost::signals2::connection: the connection between the signal and the slot
*/
boost
::
signals2
::
connection
subscribe_ee_pdu_session_release
(
const
ee_pdu_session_release_sig_t
::
slot_type
&
pdu_session_release_st
);
/*
* Trigger the signal to send SM Context Status Notification to AMF
* @param [scid_t] scid: SMF Context ID
* @param [uint8_t] status: Updated status
* @param [uint8_t] http_version: HTTP version
* @return void
*/
void
trigger_sm_context_status_notification
(
scid_t
scid
,
uint8_t
status
,
uint8_t
http_version
);
/*
* Send SM Context Status Notification to AMF
* @param [scid_t] scid: SMF Context ID
* @param [uint8_t] status: Updated status
* @param [uint8_t] http_version: HTTP version
* @return void
*/
void
send_sm_context_status_notification
(
scid_t
scid
,
uint8_t
status
,
uint8_t
http_version
)
;
/*
* Trigger the signal to send PDU Session Release notification to subscribed NFs
* @param [supi64_t] supi: UE SUPI
* @param [pdu_session_id_t] pdu_session_id: PDU Session ID
* @param [uint8_t] http_version: HTTP version
* @return void
*/
void
trigger_ee_pdu_session_release
(
supi64_t
supi
,
pdu_session_id_t
pdu_session_id
,
uint8_t
http_version
);
/*
* Send PDU Session Release notification to subscribed NFs
* @param [supi64_t] supi: UE SUPI
* @param [pdu_session_id_t] pdu_session_id: PDU Session ID
* @param [uint8_t] http_version: HTTP version
* @return void
*/
void
send_ee_pdu_session_release
(
supi64_t
supi
,
pdu_session_id_t
pdu_session_id
,
uint8_t
http_version
)
;
bs2
::
connection
subscribe_ee_pdu_session_release
(
const
ee_pdu_session_release_sig_t
::
slot_type
&
sig
);
private:
sm_context_status_sig_t
sm_context_status_sig
;
//Signal for SM Context status update
ee_pdu_session_release_sig_t
pdu_session_release_sig
;
//Signal for PDU session release event
bool
pdu_session_release_sig_is_connected
;
sm_context_status_sig_t
sm_context_status
;
//Signal for SM Context status update
ee_pdu_session_release_sig_t
ee_pdu_session_release
;
//Signal for SM Context status update
};
}
#endif
/* FILE_SMF_EVENT_HPP_SEEN */
src/smf_app/smf_event_sig.hpp
0 → 100644
View file @
8b47068f
/*
* 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
*/
/*! \file smf_event_sig.hpp
\brief
\author Tien-Thinh NGUYEN
\company Eurecom
\date 2019
\email: tien-thinh.nguyen@eurecom.fr
*/
#ifndef FILE_SMF_EVENT_SIG_HPP_SEEN
#define FILE_SMF_EVENT_SIG_HPP_SEEN
#include <boost/signals2.hpp>
namespace
bs2
=
boost
::
signals2
;
#include "3gpp_24.007.h"
namespace
smf
{
// Signal for PDU session status
// SCID, PDU Session Status, HTTP version
typedef
bs2
::
signal_type
<
void
(
scid_t
,
uint8_t
,
uint8_t
),
bs2
::
keywords
::
mutex_type
<
bs2
::
dummy_mutex
>>::
type
sm_context_status_sig_t
;
// Signal for Event exposure
// PDU session Release, SUPI, PDU SessionID, HTTP version
typedef
bs2
::
signal_type
<
void
(
supi64_t
,
pdu_session_id_t
,
uint8_t
),
bs2
::
keywords
::
mutex_type
<
bs2
::
dummy_mutex
>>::
type
ee_pdu_session_release_sig_t
;
// ee_ue_ip_address_change_sig_t; //UI IP Address, UE ID
// TODO:
// Access Type Change
// UP Path Change
// PLMN Change
// Downlink data delivery status
}
// namespace smf
#endif
/* FILE_SMF_EVENT_SIG_HPP_SEEN */
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