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
20e0d301
Commit
20e0d301
authored
Apr 11, 2022
by
Tien-Thinh Nguyen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix issue for directly using member variable
parent
f15eb00c
Changes
7
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
116 additions
and
79 deletions
+116
-79
src/amf-app/amf_n1.cpp
src/amf-app/amf_n1.cpp
+1
-1
src/amf-app/amf_n2.cpp
src/amf-app/amf_n2.cpp
+91
-71
src/amf-app/amf_n2.hpp
src/amf-app/amf_n2.hpp
+11
-4
src/ngap/ngapIEs/UEAssociationLogicalNGConnectionList.cpp
src/ngap/ngapIEs/UEAssociationLogicalNGConnectionList.cpp
+4
-0
src/ngap/ngapIEs/UEAssociationLogicalNGConnectionList.hpp
src/ngap/ngapIEs/UEAssociationLogicalNGConnectionList.hpp
+1
-1
src/ngap/ngapMsgs/NGResetAck.cpp
src/ngap/ngapMsgs/NGResetAck.cpp
+7
-1
src/ngap/ngapMsgs/NGResetAck.hpp
src/ngap/ngapMsgs/NGResetAck.hpp
+1
-1
No files found.
src/amf-app/amf_n1.cpp
View file @
20e0d301
...
...
@@ -1391,7 +1391,7 @@ void amf_n1::set_amf_ue_ngap_id_2_nas_context(
void
amf_n1
::
remove_amf_ue_ngap_id_2_nas_context
(
const
long
&
amf_ue_ngap_id
)
{
std
::
unique_lock
lock
(
m_amfueid2nas_context
);
if
(
amfueid2nas_context
.
count
(
amf_ue_ngap_id
)
>
0
)
{
amfueid2nas_context
[
amf_ue_ngap_id
]
=
nullptr
;
amfueid2nas_context
.
erase
(
amf_ue_ngap_id
)
;
}
}
...
...
src/amf-app/amf_n2.cpp
View file @
20e0d301
...
...
@@ -489,23 +489,15 @@ void amf_n2::handle_itti_message(itti_ng_reset& itti_msg) {
if
(
reset_type
.
getResetType
()
==
Ngap_ResetType_PR_nG_Interface
)
{
// Reset all
// release all the resources related to this interface
for
(
auto
ue_context
:
ranid2uecontext
)
{
if
(
ue_context
.
second
->
gnb_assoc_id
==
itti_msg
.
assoc_id
)
{
uint32_t
ran_ue_ngap_id
=
ue_context
.
second
->
ran_ue_ngap_id
;
long
amf_ue_ngap_id
=
ue_context
.
second
->
amf_ue_ngap_id
;
// get NAS context
std
::
shared_ptr
<
nas_context
>
nc
;
if
(
amf_n1_inst
->
is_amf_ue_id_2_nas_context
(
amf_ue_ngap_id
))
nc
=
amf_n1_inst
->
amf_ue_id_2_nas_context
(
amf_ue_ngap_id
);
else
{
Logger
::
amf_n2
().
warn
(
"No existed nas_context with amf_ue_ngap_id("
AMF_UE_NGAP_ID_FMT
")"
,
amf_ue_ngap_id
);
}
stacs
.
update_5gmm_state
(
nc
.
get
()
->
imsi
,
"5GMM-DEREGISTERED"
);
}
std
::
vector
<
std
::
shared_ptr
<
ue_ngap_context
>>
ue_contexts
;
get_ue_ngap_contexts
(
itti_msg
.
assoc_id
,
ue_contexts
);
for
(
auto
ue_context
:
ue_contexts
)
{
remove_ue_context_with_amf_ue_ngap_id
(
ue_context
->
amf_ue_ngap_id
);
remove_ue_context_with_ran_ue_ngap_id
(
ue_context
->
ran_ue_ngap_id
);
}
stacs
.
display
();
}
else
if
(
reset_type
.
getResetType
()
==
Ngap_ResetType_PR_partOfNG_Interface
)
{
...
...
@@ -514,18 +506,11 @@ void amf_n2::handle_itti_message(itti_ng_reset& itti_msg) {
ueAssociationLogicalNGConnectionList
);
for
(
auto
ue
:
ueAssociationLogicalNGConnectionList
)
{
unsigned
long
amf_ue_ngap_id
=
{
0
};
ue
.
getAmfUeNgapId
(
amf_ue_ngap_id
);
uint32_t
ran_ue_ngap_id
=
{
0
};
ue
.
getRanUeNgapId
(
ran_ue_ngap_id
);
// get NAS context
std
::
shared_ptr
<
nas_context
>
nc
;
if
(
amf_n1_inst
->
is_amf_ue_id_2_nas_context
(
amf_ue_ngap_id
))
{
nc
=
amf_n1_inst
->
amf_ue_id_2_nas_context
(
amf_ue_ngap_id
);
}
else
{
Logger
::
amf_n2
().
warn
(
"No existed nas_context with amf_ue_ngap_id("
AMF_UE_NGAP_ID_FMT
")"
,
amf_ue_ngap_id
);
if
(
ue
.
getAmfUeNgapId
(
amf_ue_ngap_id
))
{
remove_ue_context_with_amf_ue_ngap_id
(
amf_ue_ngap_id
);
}
else
if
(
ue
.
getRanUeNgapId
(
ran_ue_ngap_id
))
{
remove_ue_context_with_ran_ue_ngap_id
(
ran_ue_ngap_id
);
}
}
}
...
...
@@ -568,27 +553,12 @@ void amf_n2::handle_itti_message(itti_ng_shutdown& itti_msg) {
gc
.
get
()
->
ng_state
=
NGAP_SHUTDOWN
;
// Release all the resources related to this interface
uint32_t
ran_ue_ngap_id
=
0
;
for
(
auto
ue_context
:
ranid2uecontext
)
{
if
(
ue_context
.
second
->
gnb_assoc_id
==
itti_msg
.
assoc_id
)
{
ran_ue_ngap_id
=
ue_context
.
second
->
ran_ue_ngap_id
;
long
amf_ue_ngap_id
=
ue_context
.
second
->
amf_ue_ngap_id
;
// get NAS context
std
::
shared_ptr
<
nas_context
>
nc
=
{};
if
(
amf_n1_inst
->
is_amf_ue_id_2_nas_context
(
amf_ue_ngap_id
))
{
nc
=
amf_n1_inst
->
amf_ue_id_2_nas_context
(
amf_ue_ngap_id
);
stacs
.
update_5gmm_state
(
nc
.
get
()
->
imsi
,
"5GMM-DEREGISTERED"
);
}
else
{
Logger
::
amf_n2
().
warn
(
"No existed nas_context with amf_ue_ngap_id("
AMF_UE_NGAP_ID_FMT
")"
,
amf_ue_ngap_id
);
}
}
}
// remove UE context
if
(
ranid2uecontext
.
count
(
ran_ue_ngap_id
)
>
0
)
{
ranid2uecontext
.
erase
(
ran_ue_ngap_id
);
std
::
vector
<
std
::
shared_ptr
<
ue_ngap_context
>>
ue_contexts
;
get_ue_ngap_contexts
(
itti_msg
.
assoc_id
,
ue_contexts
);
for
(
auto
ue_context
:
ue_contexts
)
{
remove_ue_context_with_amf_ue_ngap_id
(
ue_context
->
amf_ue_ngap_id
);
remove_ue_context_with_ran_ue_ngap_id
(
ue_context
->
ran_ue_ngap_id
);
}
// Delete gNB context
...
...
@@ -2180,8 +2150,6 @@ bool amf_n2::is_ran_ue_id_2_ue_ngap_context(
}
}
return
false
;
// return bool{ranid2uecontext.count(ran_ue_ngap_id) > 0};
}
//------------------------------------------------------------------------------
...
...
@@ -2198,35 +2166,56 @@ void amf_n2::set_ran_ue_ngap_id_2_ue_ngap_context(
ranid2uecontext
[
ran_ue_ngap_id
]
=
unc
;
}
/*
//------------------------------------------------------------------------------
bool amf_n2::get_ue_ngap_context_from_ran_ue_id(const uint32_t ran_ue_ngap_id,
std::shared_ptr<ue_ngap_context>& ue_context){ std::shared_lock
lock(m_ranid2uecontext); if (ranid2uecontext.count(ran_ue_ngap_id) > 0) { if
(ranid2uecontext.at(ran_ue_ngap_id).get() != nullptr) { ue_context =
ranid2uecontext.at(ran_ue_ngap_id); return true;
}
void
amf_n2
::
remove_ran_ue_ngap_id_2_ngap_context
(
const
uint32_t
&
ran_ue_ngap_id
)
{
std
::
unique_lock
lock
(
m_ranid2uecontext
);
if
(
ranid2uecontext
.
count
(
ran_ue_ngap_id
)
>
0
)
{
ranid2uecontext
.
erase
(
ran_ue_ngap_id
);
}
return false;
}
*/
//------------------------------------------------------------------------------
void
amf_n2
::
get_ue_ngap_contexts
(
std
::
vector
<
uint32_t
>
ran_ue_ngap_ids
,
std
::
vector
<
std
::
shared_ptr
<
ue_ngap_context
>>&
ue_contexts
)
{
std
::
shared_lock
lock
(
m_ranid2uecontext
);
for
(
auto
ran_ue_ngap_id
:
ran_ue_ngap_ids
)
{
ue_contexts
.
push_back
(
ran_ue_id_2_ue_ngap_context
(
ran_ue_ngap_id
));
void
amf_n2
::
remove_ue_context_with_ran_ue_ngap_id
(
const
uint32_t
&
ran_ue_ngap_id
)
{
// Remove NAS context if still available
std
::
shared_ptr
<
ue_ngap_context
>
unc
=
{};
if
(
!
is_ran_ue_id_2_ue_ngap_context
(
ran_ue_ngap_id
))
{
Logger
::
amf_n2
().
error
(
"No UE NGAP context with ran_ue_ngap_id ("
GNB_UE_NGAP_ID_FMT
")"
,
ran_ue_ngap_id
);
return
;
}
unc
=
ran_ue_id_2_ue_ngap_context
(
ran_ue_ngap_id
);
// Remove all NAS context if still exist
std
::
shared_ptr
<
nas_context
>
nc
=
nullptr
;
if
(
amf_n1_inst
->
is_amf_ue_id_2_nas_context
(
unc
.
get
()
->
amf_ue_ngap_id
))
{
nc
=
amf_n1_inst
->
amf_ue_id_2_nas_context
(
unc
.
get
()
->
amf_ue_ngap_id
);
// Remove all NAS context
string
supi
=
"imsi-"
+
nc
.
get
()
->
imsi
;
amf_n1_inst
->
remove_imsi_2_nas_context
(
supi
);
// TODO: remove_guti_2_nas_context(guti);
amf_n1_inst
->
remove_amf_ue_ngap_id_2_nas_context
(
unc
.
get
()
->
amf_ue_ngap_id
);
}
else
{
Logger
::
amf_n2
().
warn
(
"No existed nas_context with amf_ue_ngap_id("
AMF_UE_NGAP_ID_FMT
")"
,
unc
.
get
()
->
amf_ue_ngap_id
);
}
// Remove NGAP context
remove_amf_ue_ngap_id_2_ue_ngap_context
(
unc
.
get
()
->
amf_ue_ngap_id
);
remove_ran_ue_ngap_id_2_ngap_context
(
ran_ue_ngap_id
);
}
//------------------------------------------------------------------------------
void
amf_n2
::
get_all_ue_ngap_contexts
(
void
amf_n2
::
get_ue_ngap_contexts
(
const
sctp_assoc_id_t
&
gnb_assoc_id
,
std
::
vector
<
std
::
shared_ptr
<
ue_ngap_context
>>&
ue_contexts
)
{
std
::
shared_lock
lock
(
m_ranid2uecontext
);
for
(
auto
ue
:
ranid2uecontext
)
{
if
(
ue
.
second
->
gnb_assoc_id
==
gnb_assoc_id
)
ue_contexts
.
push_back
(
ue
.
second
);
}
}
...
...
@@ -2242,7 +2231,6 @@ std::shared_ptr<ue_ngap_context> amf_n2::amf_ue_id_2_ue_ngap_context(
bool
amf_n2
::
is_amf_ue_id_2_ue_ngap_context
(
const
unsigned
long
&
amf_ue_ngap_id
)
const
{
std
::
shared_lock
lock
(
m_amfueid2uecontext
);
// return bool{amfueid2uecontext.count(amf_ue_ngap_id) > 0};
if
(
amfueid2uecontext
.
count
(
amf_ue_ngap_id
)
>
0
)
{
if
(
amfueid2uecontext
.
at
(
amf_ue_ngap_id
).
get
()
!=
nullptr
)
{
return
true
;
...
...
@@ -2258,6 +2246,38 @@ void amf_n2::set_amf_ue_ngap_id_2_ue_ngap_context(
amfueid2uecontext
[
amf_ue_ngap_id
]
=
unc
;
}
//------------------------------------------------------------------------------
void
amf_n2
::
remove_amf_ue_ngap_id_2_ue_ngap_context
(
const
unsigned
long
&
amf_ue_ngap_id
)
{
std
::
unique_lock
lock
(
m_amfueid2uecontext
);
if
(
amfueid2uecontext
.
count
(
amf_ue_ngap_id
)
>
0
)
{
amfueid2uecontext
.
erase
(
amf_ue_ngap_id
);
}
}
//------------------------------------------------------------------------------
void
amf_n2
::
remove_ue_context_with_amf_ue_ngap_id
(
const
unsigned
long
&
amf_ue_ngap_id
)
{
// Remove all NAS context if still exist
std
::
shared_ptr
<
nas_context
>
nc
=
nullptr
;
if
(
amf_n1_inst
->
is_amf_ue_id_2_nas_context
(
amf_ue_ngap_id
))
{
nc
=
amf_n1_inst
->
amf_ue_id_2_nas_context
(
amf_ue_ngap_id
);
// Remove all NAS context
string
supi
=
"imsi-"
+
nc
.
get
()
->
imsi
;
amf_n1_inst
->
remove_imsi_2_nas_context
(
supi
);
// TODO: remove_guti_2_nas_context(guti);
amf_n1_inst
->
remove_amf_ue_ngap_id_2_nas_context
(
amf_ue_ngap_id
);
// Remove NGAP context related to RAN UE NGAP ID
remove_ran_ue_ngap_id_2_ngap_context
(
nc
.
get
()
->
ran_ue_ngap_id
);
}
else
{
Logger
::
amf_n2
().
warn
(
"No existed nas_context with amf_ue_ngap_id("
AMF_UE_NGAP_ID_FMT
")"
,
amf_ue_ngap_id
);
}
// Remove NGAP context
remove_amf_ue_ngap_id_2_ue_ngap_context
(
amf_ue_ngap_id
);
}
//------------------------------------------------------------------------------
bool
amf_n2
::
verifyPlmn
(
vector
<
SupportedItem_t
>
list
)
{
for
(
int
i
=
0
;
i
<
amf_cfg
.
plmn_list
.
size
();
i
++
)
{
...
...
src/amf-app/amf_n2.hpp
View file @
20e0d301
...
...
@@ -209,6 +209,12 @@ class amf_n2 : public ngap::ngap_app {
// TODO
void
set_ran_ue_ngap_id_2_ue_ngap_context
(
const
uint32_t
&
ran_ue_ngap_id
,
std
::
shared_ptr
<
ue_ngap_context
>
unc
);
void
remove_ran_ue_ngap_id_2_ngap_context
(
const
uint32_t
&
ran_ue_ngap_id
);
// TODO:
void
remove_ue_context_with_ran_ue_ngap_id
(
const
uint32_t
&
ran_ue_ngap_id
);
// TODO
std
::
shared_ptr
<
ue_ngap_context
>
amf_ue_id_2_ue_ngap_context
(
const
unsigned
long
&
amf_ue_ngap_id
)
const
;
...
...
@@ -219,11 +225,12 @@ class amf_n2 : public ngap::ngap_app {
void
set_amf_ue_ngap_id_2_ue_ngap_context
(
const
unsigned
long
&
amf_ue_ngap_id
,
std
::
shared_ptr
<
ue_ngap_context
>
unc
);
void
remove_amf_ue_ngap_id_2_ue_ngap_context
(
const
unsigned
long
&
amf_ue_ngap_id
);
void
remove_ue_context_with_amf_ue_ngap_id
(
const
unsigned
long
&
amf_ue_ngap_id
);
void
get_ue_ngap_contexts
(
std
::
vector
<
uint32_t
>
ran_ue_ngap_ids
,
std
::
vector
<
std
::
shared_ptr
<
ue_ngap_context
>>&
ue_contexts
);
void
get_all_ue_ngap_contexts
(
const
sctp_assoc_id_t
&
gnb_assoc_id
,
std
::
vector
<
std
::
shared_ptr
<
ue_ngap_context
>>&
ue_contexts
);
private:
...
...
src/ngap/ngapIEs/UEAssociationLogicalNGConnectionList.cpp
View file @
20e0d301
...
...
@@ -42,6 +42,10 @@ UEAssociationLogicalNGConnectionList::UEAssociationLogicalNGConnectionList() {
number_of_items
=
0
;
}
UEAssociationLogicalNGConnectionList
::~
UEAssociationLogicalNGConnectionList
()
{
if
(
ueAssociationLogicalNGConnectionItem
)
delete
[]
ueAssociationLogicalNGConnectionItem
;
}
//------------------------------------------------------------------------------
void
UEAssociationLogicalNGConnectionList
::
setUEAssociationLogicalNGConnectionItem
(
...
...
src/ngap/ngapIEs/UEAssociationLogicalNGConnectionList.hpp
View file @
20e0d301
...
...
@@ -44,7 +44,7 @@ namespace ngap {
class
UEAssociationLogicalNGConnectionList
{
public:
UEAssociationLogicalNGConnectionList
();
virtual
~
UEAssociationLogicalNGConnectionList
()
{}
;
virtual
~
UEAssociationLogicalNGConnectionList
();
void
setUEAssociationLogicalNGConnectionItem
(
UEAssociationLogicalNGConnectionItem
*
...
...
src/ngap/ngapMsgs/NGResetAck.cpp
View file @
20e0d301
...
...
@@ -54,7 +54,13 @@ NGResetAckMsg::NGResetAckMsg() {
CriticalityDiagnostics
=
nullptr
;
}
//------------------------------------------------------------------------------
NGResetAckMsg
::~
NGResetAckMsg
()
{}
NGResetAckMsg
::~
NGResetAckMsg
()
{
if
(
ngResetAckPdu
)
free_wrapper
((
void
**
)
&
ngResetAckPdu
);
if
(
ngResetAckIEs
)
free_wrapper
((
void
**
)
&
ngResetAckIEs
);
if
(
ueAssociationLogicalNGConnectionList
)
free_wrapper
((
void
**
)
&
ueAssociationLogicalNGConnectionList
);
if
(
CriticalityDiagnostics
)
free_wrapper
((
void
**
)
&
CriticalityDiagnostics
);
}
//------------------------------------------------------------------------------
void
NGResetAckMsg
::
setMessageType
()
{
...
...
src/ngap/ngapMsgs/NGResetAck.hpp
View file @
20e0d301
...
...
@@ -65,7 +65,7 @@ class NGResetAckMsg {
Ngap_NGAP_PDU_t
*
ngResetAckPdu
;
Ngap_NGResetAcknowledge_t
*
ngResetAckIEs
;
UEAssociationLogicalNGConnectionList
*
ueAssociationLogicalNGConnectionList
;
std
::
unique_ptr
<
Ngap_CriticalityDiagnostics_t
>
CriticalityDiagnostics
;
Ngap_CriticalityDiagnostics_t
*
CriticalityDiagnostics
;
};
}
// namespace ngap
...
...
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