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
fe3273e8
Commit
fe3273e8
authored
Jul 26, 2021
by
Prateek Mishra
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Re-added "m_amf_event_subscriptions" in amf_app.hpp
parent
0b6d4f20
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
275 additions
and
273 deletions
+275
-273
src/amf-app/amf_app.hpp
src/amf-app/amf_app.hpp
+275
-273
No files found.
src/amf-app/amf_app.hpp
View file @
fe3273e8
/*
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this
* 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
* file except in compliance with the License. You may obtain a copy of the
* License at
* License at
*
*
* http://www.openairinterface.org/?page_id=698
* http://www.openairinterface.org/?page_id=698
*
*
* Unless required by applicable law or agreed to in writing, software
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* See the License for the specific language governing permissions and
* limitations under the License.
* limitations under the License.
*-------------------------------------------------------------------------------
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
* contact@openairinterface.org
*/
*/
/*! \file amf_app.hpp
/*! \file amf_app.hpp
\brief
\brief
\author Keliang DU, BUPT
\author Keliang DU, BUPT
\date 2020
\date 2020
\email: contact@openairinterface.org
\email: contact@openairinterface.org
*/
*/
#ifndef _AMF_APP_H_
#ifndef _AMF_APP_H_
#define _AMF_APP_H_
#define _AMF_APP_H_
#include <map>
#include <map>
#include <shared_mutex>
#include <shared_mutex>
#include <string>
#include <string>
#include "amf_config.hpp"
#include "amf_config.hpp"
#include "amf_module_from_config.hpp"
#include "amf_module_from_config.hpp"
#include "amf_profile.hpp"
#include "amf_profile.hpp"
#include "itti.hpp"
#include "itti.hpp"
#include "itti_msg_amf_app.hpp"
#include "itti_msg_amf_app.hpp"
#include "itti_msg_sbi.hpp"
#include "itti_msg_sbi.hpp"
#include "ue_context.hpp"
#include "ue_context.hpp"
#include "amf_subscription.hpp"
#include "amf_subscription.hpp"
#include "ProblemDetails.h"
#include "ProblemDetails.h"
#include "uint_generator.hpp"
#include "uint_generator.hpp"
#include "amf_msg.hpp"
#include "amf_msg.hpp"
#include "uint_generator.hpp"
#include "uint_generator.hpp"
#include <boost/thread.hpp>
#include <boost/thread.hpp>
#include <boost/thread/future.hpp>
#include <boost/thread/future.hpp>
#include "uint_generator.hpp"
#include "uint_generator.hpp"
#include <boost/thread.hpp>
#include <boost/thread.hpp>
#include <boost/thread/future.hpp>
#include <boost/thread/future.hpp>
using
namespace
config
;
using
namespace
config
;
static
uint32_t
amf_app_ue_ngap_id_generator
=
1
;
static
uint32_t
amf_app_ue_ngap_id_generator
=
1
;
namespace
amf_application
{
namespace
amf_application
{
using
namespace
amf
;
using
namespace
amf
;
#define TASK_AMF_APP_PERIODIC_STATISTICS (0)
#define TASK_AMF_APP_PERIODIC_STATISTICS (0)
class
amf_app
{
class
amf_app
{
private:
private:
amf_profile
nf_instance_profile
;
// AMF profile
amf_profile
nf_instance_profile
;
// AMF profile
std
::
string
amf_instance_id
;
// AMF instance id
std
::
string
amf_instance_id
;
// AMF instance id
timer_id_t
timer_nrf_heartbeat
;
timer_id_t
timer_nrf_heartbeat
;
util
::
uint_generator
<
uint32_t
>
evsub_id_generator
;
util
::
uint_generator
<
uint32_t
>
evsub_id_generator
;
std
::
map
<
std
::
map
<
std
::
pair
<
evsub_id_t
,
amf_event_t
>
,
std
::
shared_ptr
<
amf_subscription
>>
std
::
pair
<
evsub_id_t
,
amf_event_t
>
,
std
::
shared_ptr
<
amf_subscription
>>
amf_event_subscriptions
;
amf_event_subscriptions
;
public:
mutable
std
::
shared_mutex
m_amf_event_subscriptions
;
explicit
amf_app
(
const
amf_config
&
amf_cfg
);
amf_app
(
amf_app
const
&
)
=
delete
;
public:
void
operator
=
(
amf_app
const
&
)
=
delete
;
explicit
amf_app
(
const
amf_config
&
amf_cfg
);
void
allRegistredModulesInit
(
const
amf_modules
&
modules
);
amf_app
(
amf_app
const
&
)
=
delete
;
long
generate_amf_ue_ngap_id
();
void
operator
=
(
amf_app
const
&
)
=
delete
;
// itti handlers
void
allRegistredModulesInit
(
const
amf_modules
&
modules
);
void
handle_itti_message
(
itti_nas_signalling_establishment_request
&
itti_msg
);
long
generate_amf_ue_ngap_id
();
void
handle_itti_message
(
itti_n1n2_message_transfer_request
&
itti_msg
);
// itti handlers
void
handle_itti_message
(
itti_nas_signalling_establishment_request
&
itti_msg
);
bool
is_amf_ue_id_2_ue_context
(
const
long
&
amf_ue_ngap_id
)
const
;
void
handle_itti_message
(
itti_n1n2_message_transfer_request
&
itti_msg
);
std
::
shared_ptr
<
ue_context
>
amf_ue_id_2_ue_context
(
const
long
&
amf_ue_ngap_id
)
const
;
bool
is_amf_ue_id_2_ue_context
(
const
long
&
amf_ue_ngap_id
)
const
;
void
set_amf_ue_ngap_id_2_ue_context
(
std
::
shared_ptr
<
ue_context
>
amf_ue_id_2_ue_context
(
const
long
&
amf_ue_ngap_id
,
std
::
shared_ptr
<
ue_context
>
uc
);
const
long
&
amf_ue_ngap_id
)
const
;
void
set_amf_ue_ngap_id_2_ue_context
(
bool
is_ran_amf_id_2_ue_context
(
const
std
::
string
&
ue_context_key
)
const
;
const
long
&
amf_ue_ngap_id
,
std
::
shared_ptr
<
ue_context
>
uc
);
std
::
shared_ptr
<
ue_context
>
ran_amf_id_2_ue_context
(
const
std
::
string
&
ue_context_key
)
const
;
bool
is_ran_amf_id_2_ue_context
(
const
std
::
string
&
ue_context_key
)
const
;
void
set_ran_amf_id_2_ue_context
(
std
::
shared_ptr
<
ue_context
>
ran_amf_id_2_ue_context
(
const
std
::
string
&
ue_context_key
,
std
::
shared_ptr
<
ue_context
>
uc
);
const
std
::
string
&
ue_context_key
)
const
;
void
set_ran_amf_id_2_ue_context
(
bool
is_supi_2_ue_context
(
const
string
&
supi
)
const
;
const
std
::
string
&
ue_context_key
,
std
::
shared_ptr
<
ue_context
>
uc
);
std
::
shared_ptr
<
ue_context
>
supi_2_ue_context
(
const
string
&
supi
)
const
;
void
set_supi_2_ue_context
(
bool
is_supi_2_ue_context
(
const
string
&
supi
)
const
;
const
string
&
ue_context_key
,
std
::
shared_ptr
<
ue_context
>&
uc
);
std
::
shared_ptr
<
ue_context
>
supi_2_ue_context
(
const
string
&
supi
)
const
;
void
set_supi_2_ue_context
(
bool
find_pdu_session_context
(
const
string
&
ue_context_key
,
std
::
shared_ptr
<
ue_context
>&
uc
);
const
string
&
supi
,
const
std
::
uint8_t
pdu_session_id
,
std
::
shared_ptr
<
pdu_session_context
>&
psc
);
bool
find_pdu_session_context
(
const
string
&
supi
,
const
std
::
uint8_t
pdu_session_id
,
bool
get_pdu_sessions_context
(
std
::
shared_ptr
<
pdu_session_context
>&
psc
);
const
string
&
supi
,
std
::
vector
<
std
::
shared_ptr
<
pdu_session_context
>>&
sessions_ctx
);
bool
get_pdu_sessions_context
(
// SMF Client response handlers
const
string
&
supi
,
void
handle_post_sm_context_response_error_400
();
std
::
vector
<
std
::
shared_ptr
<
pdu_session_context
>>&
sessions_ctx
);
// others
// SMF Client response handlers
bool
generate_5g_guti
(
void
handle_post_sm_context_response_error_400
();
uint32_t
ranid
,
long
amfid
,
std
::
string
&
mcc
,
std
::
string
&
mnc
,
// others
uint32_t
&
tmsi
);
bool
generate_5g_guti
(
uint32_t
ranid
,
long
amfid
,
std
::
string
&
mcc
,
std
::
string
&
mnc
,
/*
uint32_t
&
tmsi
);
* Generate an Event Exposure Subscription ID
* @param [void]
/*
* @return the generated reference
* Generate an Event Exposure Subscription ID
*/
* @param [void]
evsub_id_t
generate_ev_subscription_id
();
* @return the generated reference
*/
/*
evsub_id_t
generate_ev_subscription_id
();
* Trigger NF instance registration to NRF
* @param [void]
/*
* @return void
* Trigger NF instance registration to NRF
*/
* @param [void]
void
register_to_nrf
();
* @return void
*/
/*
void
register_to_nrf
();
* Handle Event Exposure Msg from NF
* @param [std::shared_ptr<itti_sbi_event_exposure_request>&] Request message
/*
* @return [evsub_id_t] ID of the created subscription
* Handle Event Exposure Msg from NF
*/
* @param [std::shared_ptr<itti_sbi_event_exposure_request>&] Request message
evsub_id_t
handle_event_exposure_subscription
(
* @return [evsub_id_t] ID of the created subscription
std
::
shared_ptr
<
itti_sbi_event_exposure_request
>
msg
);
*/
evsub_id_t
handle_event_exposure_subscription
(
/*
std
::
shared_ptr
<
itti_sbi_event_exposure_request
>
msg
);
* Handle NF status notification (e.g., when an UPF becomes available)
* @param [std::shared_ptr<itti_sbi_notification_data>& ] msg: message
/*
* @param [oai::amf::model::ProblemDetails& ] problem_details
* Handle NF status notification (e.g., when an UPF becomes available)
* @param [uint8_t&] http_code
* @param [std::shared_ptr<itti_sbi_notification_data>& ] msg: message
* @return true if handle sucessfully, otherwise return false
* @param [oai::amf::model::ProblemDetails& ] problem_details
*/
* @param [uint8_t&] http_code
bool
handle_nf_status_notification
(
* @return true if handle sucessfully, otherwise return false
std
::
shared_ptr
<
itti_sbi_notification_data
>&
msg
,
*/
oai
::
amf
::
model
::
ProblemDetails
&
problem_details
,
bool
handle_nf_status_notification
(
uint8_t
&
http_code
);
std
::
shared_ptr
<
itti_sbi_notification_data
>&
msg
,
oai
::
amf
::
model
::
ProblemDetails
&
problem_details
,
/*
uint8_t
&
http_code
);
* Generate a random UUID for SMF instance
* @param [void]
/*
* @return void
* Generate a random UUID for SMF instance
*/
* @param [void]
void
generate_uuid
();
* @return void
*/
/*
void
generate_uuid
();
* Add an Event Subscription to the list
* @param [const evsub_id_t&] sub_id: Subscription ID
/*
* @param [amf_event_t] ev: Event type
* Add an Event Subscription to the list
* @param [std::shared_ptr<amf_subscription>] ss: a shared pointer stored
* @param [const evsub_id_t&] sub_id: Subscription ID
* information of the subscription
* @param [amf_event_t] ev: Event type
* @return void
* @param [std::shared_ptr<amf_subscription>] ss: a shared pointer stored
*/
* information of the subscription
void
add_event_subscription
(
* @return void
evsub_id_t
sub_id
,
amf_event_t
ev
,
std
::
shared_ptr
<
amf_subscription
>
ss
);
*/
void
add_event_subscription
(
/*
evsub_id_t
sub_id
,
amf_event_t
ev
,
std
::
shared_ptr
<
amf_subscription
>
ss
);
* Get a list of subscription associated with a particular event
* @param [amf_event_t] ev: Event type
/*
* @param [std::vector<std::shared_ptr<amf_subscription>>&] subscriptions:
* Get a list of subscription associated with a particular event
* store the list of the subscription associated with this event type
* @param [amf_event_t] ev: Event type
* @return void
* @param [std::vector<std::shared_ptr<amf_subscription>>&] subscriptions:
*/
* store the list of the subscription associated with this event type
void
get_ee_subscriptions
(
* @return void
amf_event_t
ev
,
*/
std
::
vector
<
std
::
shared_ptr
<
amf_subscription
>>&
subscriptions
);
void
get_ee_subscriptions
(
amf_event_t
ev
,
/*
std
::
vector
<
std
::
shared_ptr
<
amf_subscription
>>&
subscriptions
);
* Get a list of subscription associated with a particular event
* @param [evsub_id_t] sub_id: Subscription ID
/*
* @param [std::vector<std::shared_ptr<amf_subscription>>&] subscriptions:
* Get a list of subscription associated with a particular event
* store the list of the subscription associated with this event type
* @param [evsub_id_t] sub_id: Subscription ID
* @return void
* @param [std::vector<std::shared_ptr<amf_subscription>>&] subscriptions:
*/
* store the list of the subscription associated with this event type
void
get_ee_subscriptions
(
* @return void
evsub_id_t
sub_id
,
*/
std
::
vector
<
std
::
shared_ptr
<
amf_subscription
>>&
subscriptions
);
void
get_ee_subscriptions
(
evsub_id_t
sub_id
,
/*
std
::
vector
<
std
::
shared_ptr
<
amf_subscription
>>&
subscriptions
);
* Get a list of subscription associated with a particular event
* @param [amf_event_t] ev: Event type
/*
* @param [supi64_t] supi: SUPI
* Get a list of subscription associated with a particular event
* @param [std::vector<std::shared_ptr<amf_subscription>>&] subscriptions:
* @param [amf_event_t] ev: Event type
* store the list of the subscription associated with this event type
* @param [supi64_t] supi: SUPI
* @return void
* @param [std::vector<std::shared_ptr<amf_subscription>>&] subscriptions:
*/
* store the list of the subscription associated with this event type
void
get_ee_subscriptions
(
* @return void
amf_event_t
ev
,
supi64_t
supi
,
*/
std
::
vector
<
std
::
shared_ptr
<
amf_subscription
>>&
subscriptions
);
void
get_ee_subscriptions
(
amf_event_t
ev
,
supi64_t
supi
,
/*
std
::
vector
<
std
::
shared_ptr
<
amf_subscription
>>&
subscriptions
);
* Generate a SMF profile for this instance
* @param [void]
/*
* @return void
* Generate a SMF profile for this instance
*/
* @param [void]
void
generate_amf_profile
();
* @return void
*/
/*
void
generate_amf_profile
();
* Send request to N11 task to trigger NF instance registration to NRF
* @param [void]
/*
* @return void
* Send request to N11 task to trigger NF instance registration to NRF
*/
* @param [void]
void
trigger_nf_registration_request
();
* @return void
*/
/*
void
trigger_nf_registration_request
();
* Send request to N11 task to trigger NF instance deregistration to NRF
* @param [void]
/*
* @return void
* Send request to N11 task to trigger NF instance deregistration to NRF
*/
* @param [void]
void
trigger_nf_deregistration
();
* @return void
*/
/*
void
trigger_nf_deregistration
();
* Store the promise
* @param [uint32_t] pid: promise id
/*
* @param [boost::shared_ptr<boost::promise<uint32_t>>&] p: promise
* Store the promise
* @return void
* @param [uint32_t] pid: promise id
*/
* @param [boost::shared_ptr<boost::promise<uint32_t>>&] p: promise
void
add_promise
(
* @return void
uint32_t
pid
,
boost
::
shared_ptr
<
boost
::
promise
<
uint32_t
>>&
p
);
*/
void
add_promise
(
/*
uint32_t
pid
,
boost
::
shared_ptr
<
boost
::
promise
<
uint32_t
>>&
p
);
* Remove the promise
* @param [uint32_t] pid: promise id
/*
* @return void
* Remove the promise
*/
* @param [uint32_t] pid: promise id
void
remove_promise
(
uint32_t
id
);
* @return void
*/
/*
void
remove_promise
(
uint32_t
id
);
* Generate an unique value for promise id
* @param void
/*
* @return generated promise id
* Generate an unique value for promise id
*/
* @param void
static
uint64_t
generate_promise_id
()
{
* @return generated promise id
return
util
::
uint_uid_generator
<
uint64_t
>::
get_instance
().
get_uid
();
*/
}
static
uint64_t
generate_promise_id
()
{
return
util
::
uint_uid_generator
<
uint64_t
>::
get_instance
().
get_uid
();
void
trigger_process_response
(
uint32_t
pid
,
uint32_t
http_code
);
}
void
add_promise
(
void
trigger_process_response
(
uint32_t
pid
,
uint32_t
http_code
);
uint32_t
pid
,
boost
::
shared_ptr
<
boost
::
promise
<
std
::
string
>>&
p
);
void
trigger_process_response
(
uint32_t
pid
,
std
::
string
n2_sm
);
void
add_promise
(
uint32_t
pid
,
boost
::
shared_ptr
<
boost
::
promise
<
std
::
string
>>&
p
);
private:
void
trigger_process_response
(
uint32_t
pid
,
std
::
string
n2_sm
);
// context management
std
::
map
<
long
,
std
::
shared_ptr
<
ue_context
>>
amf_ue_ngap_id2ue_ctx
;
private:
mutable
std
::
shared_mutex
m_amf_ue_ngap_id2ue_ctx
;
// context management
std
::
map
<
std
::
string
,
std
::
shared_ptr
<
ue_context
>>
ue_ctx_key
;
std
::
map
<
long
,
std
::
shared_ptr
<
ue_context
>>
amf_ue_ngap_id2ue_ctx
;
mutable
std
::
shared_mutex
m_ue_ctx_key
;
mutable
std
::
shared_mutex
m_amf_ue_ngap_id2ue_ctx
;
std
::
map
<
std
::
string
,
std
::
shared_ptr
<
ue_context
>>
ue_ctx_key
;
std
::
map
<
std
::
string
,
std
::
shared_ptr
<
ue_context
>>
supi2ue_ctx
;
mutable
std
::
shared_mutex
m_ue_ctx_key
;
mutable
std
::
shared_mutex
m_supi2ue_ctx
;
std
::
map
<
std
::
string
,
std
::
shared_ptr
<
ue_context
>>
supi2ue_ctx
;
mutable
std
::
shared_mutex
m_curl_handle_responses_n2_sm
;
mutable
std
::
shared_mutex
m_supi2ue_ctx
;
std
::
map
<
uint32_t
,
boost
::
shared_ptr
<
boost
::
promise
<
std
::
string
>>>
curl_handle_responses_n2_sm
;
mutable
std
::
shared_mutex
m_curl_handle_responses_n2_sm
;
};
std
::
map
<
uint32_t
,
boost
::
shared_ptr
<
boost
::
promise
<
std
::
string
>>>
curl_handle_responses_n2_sm
;
}
// namespace amf_application
};
#endif
}
// namespace amf_application
#endif
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