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
2e90cc26
Commit
2e90cc26
authored
Mar 04, 2021
by
Tien-Thinh Nguyen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Process NGReset and update Statistic
parent
705d7a6d
Changes
11
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
129 additions
and
23 deletions
+129
-23
src/amf-app/amf_n2.cpp
src/amf-app/amf_n2.cpp
+37
-9
src/amf-app/amf_statistics.cpp
src/amf-app/amf_statistics.cpp
+15
-4
src/amf-app/amf_statistics.hpp
src/amf-app/amf_statistics.hpp
+2
-1
src/ngap/ngapIEs/ResetType.cpp
src/ngap/ngapIEs/ResetType.cpp
+31
-5
src/ngap/ngapIEs/ResetType.hpp
src/ngap/ngapIEs/ResetType.hpp
+2
-0
src/ngap/ngapIEs/UEAssociationLogicalNGConnectionItem.cpp
src/ngap/ngapIEs/UEAssociationLogicalNGConnectionItem.cpp
+16
-1
src/ngap/ngapIEs/UEAssociationLogicalNGConnectionItem.hpp
src/ngap/ngapIEs/UEAssociationLogicalNGConnectionItem.hpp
+1
-0
src/ngap/ngapMsgs/NGReset.cpp
src/ngap/ngapMsgs/NGReset.cpp
+15
-2
src/ngap/ngapMsgs/NGReset.hpp
src/ngap/ngapMsgs/NGReset.hpp
+1
-0
src/ngap/ngap_app/ngap_app.cpp
src/ngap/ngap_app/ngap_app.cpp
+7
-1
src/ngap/ngap_app/ngap_app.hpp
src/ngap/ngap_app/ngap_app.hpp
+2
-0
No files found.
src/amf-app/amf_n2.cpp
View file @
2e90cc26
...
...
@@ -345,7 +345,7 @@ void amf_n2::handle_itti_message(itti_ng_setup_request& itti_msg) {
"gNB with gNB_id 0x%x, assoc_id %d has been attached to AMF"
,
gc
.
get
()
->
globalRanNodeId
,
itti_msg
.
assoc_id
);
stacs
.
gNB_connected
+=
1
;
stacs
.
gnbs
.
push_back
(
gnbItem
);
stacs
.
gnbs
.
insert
(
std
::
pair
<
uint32_t
,
gnb_infos
>
(
gnbItem
.
gnb_id
,
gnbItem
)
);
return
;
}
...
...
@@ -361,15 +361,43 @@ void amf_n2::handle_itti_message(itti_ng_reset& itti_msg) {
return
;
}
gc
=
assoc_id_2_gnb_context
(
itti_msg
.
assoc_id
);
if
(
gc
.
get
()
->
ng_state
==
NGAP_RESETING
||
gc
.
get
()
->
ng_state
==
NGAP_SHUTDOWN
)
{
Logger
::
amf_n2
().
warn
(
"Received new association request on an association that is being %s, "
"ignoring"
,
ng_gnb_state_str
[
gc
.
get
()
->
ng_state
]);
}
else
{
gc
.
get
()
->
ng_state
=
NGAP_RESETING
;
// TODO: (8.7.4.2.2, NG Reset initiated by the NG-RAN node @3GPP TS 38.413
// V16.0.0) the AMF shall release all allocated resources on NG related to the
// UE association(s) indicated explicitly or implicitly in the NG RESET message
// and remove the NGAP ID for the indicated UE associations.
ResetType
reset_type
=
{};
itti_msg
.
ngReset
->
getResetType
(
reset_type
);
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(0x%x)"
,
amf_ue_ngap_id
);
}
stacs
.
update_5gmm_state
(
nc
.
get
()
->
imsi
,
"5GMM-DEREGISTERED"
);
}
}
// delete gNB context
Logger
::
amf_n2
().
debug
(
"Remove gNB Context %d"
,
itti_msg
.
assoc_id
);
remove_gnb_context
(
itti_msg
.
assoc_id
);
stacs
.
gnbs
.
erase
(
gc
.
get
()
->
globalRanNodeId
);
Logger
::
amf_n2
().
debug
(
"Update gNB context with assoc id (%d)"
,
itti_msg
.
assoc_id
);
"Remove gNB with globalRanNodeId %ld"
,
gc
.
get
()
->
globalRanNodeId
);
stacs
.
gNB_connected
-=
1
;
}
else
if
(
reset_type
.
getResetType
()
==
Ngap_ResetType_PR_partOfNG_Interface
)
{
}
return
;
...
...
src/amf-app/amf_statistics.cpp
View file @
2e90cc26
...
...
@@ -56,13 +56,23 @@ void statistics::display() {
}
// TODO: Show the list of common PLMNs
for
(
int
i
=
0
;
i
<
gnbs
.
size
();
i
++
)
{
int
i
=
1
;
for
(
auto
const
&
gnb
:
gnbs
)
{
Logger
::
amf_app
().
info
(
"| %d | Connected | 0x%x | %s "
" | %s, %d | "
,
i
+
1
,
gnbs
[
i
].
gnb_id
,
gnbs
[
i
].
gnb_name
.
c_str
(),
(
gnbs
[
i
].
mcc
+
gnbs
[
i
].
mnc
).
c_str
(),
gnbs
[
i
].
tac
);
i
,
gnb
.
second
.
gnb_id
,
gnb
.
second
.
gnb_name
.
c_str
(),
(
gnb
.
second
.
mcc
+
gnb
.
second
.
mnc
).
c_str
(),
gnb
.
second
.
tac
);
i
++
;
}
/* for (int i = 0; i < gnbs.size(); i++) {
Logger::amf_app().info(
"| %d | Connected | 0x%x | %s "
" | %s, %d | ",
i + 1, gnbs[i].gnb_id, gnbs[i].gnb_name.c_str(),
(gnbs[i].mcc + gnbs[i].mnc).c_str(), gnbs[i].tac);
}
*/
Logger
::
amf_app
().
info
(
"|-----------------------------------------------------------------------"
"-----------------------------------------|"
);
...
...
@@ -78,7 +88,7 @@ void statistics::display() {
"| Index | 5GMM state | IMSI | GUTI | RAN "
"UE NGAP ID | AMF UE ID | PLMN |Cell ID|"
);
i
nt
i
=
0
;
i
=
0
;
for
(
auto
const
&
ue
:
ue_infos
)
{
Logger
::
amf_app
().
info
(
"|%7d|%22s|%18s|%15s|%16d|%11d|%9s|%7d|"
,
i
+
1
,
...
...
@@ -135,5 +145,6 @@ void statistics::update_5gmm_state(
}
}
void
statistics
::
remove_gnb
(
const
uint32_t
gnb_id
)
{}
//------------------------------------------------------------------------------
statistics
::~
statistics
()
{}
src/amf-app/amf_statistics.hpp
View file @
2e90cc26
...
...
@@ -65,13 +65,14 @@ class statistics {
~
statistics
();
void
update_ue_info
(
const
ue_info_t
&
ue_info
);
void
update_5gmm_state
(
const
std
::
string
&
imsi
,
const
std
::
string
&
state
);
void
remove_gnb
(
const
uint32_t
gnb_id
);
public:
uint32_t
gNB_connected
;
uint32_t
UE_connected
;
uint32_t
UE_registred
;
// uint32_t system_pdu_sessions;
std
::
vector
<
gnb_infos
>
gnbs
;
std
::
map
<
uint32_t
,
gnb_infos
>
gnbs
;
std
::
map
<
std
::
string
,
ue_info_t
>
ue_infos
;
};
...
...
src/ngap/ngapIEs/ResetType.cpp
View file @
2e90cc26
...
...
@@ -45,13 +45,29 @@ ResetType::ResetType() {
ResetType
::~
ResetType
()
{}
//------------------------------------------------------------------------------
void
ResetType
::
setResetType
(
long
)
{}
void
ResetType
::
setResetType
(
long
nG_Interface
)
{
this
->
present
=
Ngap_ResetType_PR_nG_Interface
;
this
->
nG_Interface
=
nG_Interface
;
}
void
ResetType
::
setResetType
(
std
::
vector
<
UEAssociationLogicalNGConnectionItem
>
list
)
{
this
->
present
=
Ngap_ResetType_PR_partOfNG_Interface
;
UEAssociationLogicalNGConnectionItem
*
item
=
new
UEAssociationLogicalNGConnectionItem
[
list
.
size
()]();
for
(
int
i
=
0
;
i
<
list
.
size
();
i
++
)
{
item
[
i
].
encode
(
list
[
i
]);
}
}
//------------------------------------------------------------------------------
bool
ResetType
::
encode
(
Ngap_ResetType_t
*
type
)
{}
bool
ResetType
::
encode
(
Ngap_ResetType_t
*
type
)
{
// TODO:
return
true
;
}
//------------------------------------------------------------------------------
bool
ResetType
::
decode
(
Ngap_ResetType_t
*
type
)
{
present
=
type
->
present
;
if
(
type
->
present
==
Ngap_ResetType_PR_nG_Interface
)
{
nG_Interface
=
(
long
)
type
->
choice
.
nG_Interface
;
return
true
;
...
...
@@ -72,14 +88,24 @@ bool ResetType::decode(Ngap_ResetType_t* type) {
}
//------------------------------------------------------------------------------
void
ResetType
::
getResetType
(
long
&
resetType
)
{}
void
ResetType
::
getResetType
(
long
&
resetType
)
{
// TODO
}
uint8_t
ResetType
::
getResetType
()
{
return
present
;
}
//------------------------------------------------------------------------------
void
ResetType
::
getResetType
(
struct
Ngap_UE_associatedLogicalNG_connectionList
*&
list
)
{}
struct
Ngap_UE_associatedLogicalNG_connectionList
*&
list
)
{
// TODO:
}
//------------------------------------------------------------------------------
void
ResetType
::
setUE_associatedLogicalNG_connectionList
(
const
std
::
vector
<
UEAssociationLogicalNGConnectionItem
>
list
)
{}
const
std
::
vector
<
UEAssociationLogicalNGConnectionItem
>
list
)
{
// TODO:
}
}
// namespace ngap
src/ngap/ngapIEs/ResetType.hpp
View file @
2e90cc26
...
...
@@ -43,10 +43,12 @@ class ResetType {
virtual
~
ResetType
();
void
setResetType
(
long
);
void
setResetType
(
std
::
vector
<
UEAssociationLogicalNGConnectionItem
>
list
);
bool
encode
(
Ngap_ResetType_t
*
type
);
bool
decode
(
Ngap_ResetType_t
*
type
);
void
getResetType
(
long
&
);
uint8_t
getResetType
();
void
getResetType
(
struct
Ngap_UE_associatedLogicalNG_connectionList
*&
);
void
setUE_associatedLogicalNG_connectionList
(
...
...
src/ngap/ngapIEs/UEAssociationLogicalNGConnectionItem.cpp
View file @
2e90cc26
...
...
@@ -84,7 +84,22 @@ void UEAssociationLogicalNGConnectionItem::setRanUeNgapId(
//------------------------------------------------------------------------------
bool
UEAssociationLogicalNGConnectionItem
::
encode
(
Ngap_UE_associatedLogicalNG_connectionItem_t
&
item
)
{}
Ngap_UE_associatedLogicalNG_connectionItem_t
&
item
)
{
item
.
aMF_UE_NGAP_ID
=
new
Ngap_AMF_UE_NGAP_ID_t
();
amfUeNgapId
->
encode2AMF_UE_NGAP_ID
(
*
item
.
aMF_UE_NGAP_ID
);
item
.
rAN_UE_NGAP_ID
=
new
Ngap_RAN_UE_NGAP_ID_t
();
ranUeNgapId
->
encode2RAN_UE_NGAP_ID
(
*
item
.
rAN_UE_NGAP_ID
);
}
//------------------------------------------------------------------------------
bool
UEAssociationLogicalNGConnectionItem
::
encode
(
UEAssociationLogicalNGConnectionItem
&
item
)
{
item
.
amfUeNgapId
=
new
AMF_UE_NGAP_ID
();
item
.
amfUeNgapId
=
amfUeNgapId
;
item
.
ranUeNgapId
=
new
RAN_UE_NGAP_ID
();
item
.
ranUeNgapId
=
ranUeNgapId
;
}
//------------------------------------------------------------------------------
bool
UEAssociationLogicalNGConnectionItem
::
decode
(
Ngap_UE_associatedLogicalNG_connectionItem_t
*
item
)
{
...
...
src/ngap/ngapIEs/UEAssociationLogicalNGConnectionItem.hpp
View file @
2e90cc26
...
...
@@ -48,6 +48,7 @@ class UEAssociationLogicalNGConnectionItem {
void
setRanUeNgapId
(
uint32_t
id
);
bool
encode
(
Ngap_UE_associatedLogicalNG_connectionItem_t
&
item
);
bool
encode
(
UEAssociationLogicalNGConnectionItem
&
item
);
bool
decode
(
Ngap_UE_associatedLogicalNG_connectionItem_t
*
item
);
private:
...
...
src/ngap/ngapMsgs/NGReset.cpp
View file @
2e90cc26
...
...
@@ -98,6 +98,19 @@ void NGResetMsg::getResetType(Ngap_ResetType_t& resetType) {
// resetType = this->resetType;
}
bool
NGResetMsg
::
getResetType
(
ResetType
&
resetType
)
{
if
(
!
this
->
resetType
)
return
false
;
if
(
this
->
resetType
->
getResetType
()
==
Ngap_ResetType_PR_nG_Interface
)
{
long
ng_interface
=
0
;
this
->
resetType
->
getResetType
(
ng_interface
);
resetType
.
setResetType
(
ng_interface
);
}
else
if
(
this
->
resetType
->
getResetType
()
==
Ngap_ResetType_PR_partOfNG_Interface
)
{
// TODO
}
}
//------------------------------------------------------------------------------
int
NGResetMsg
::
encode2buffer
(
uint8_t
*
buf
,
int
buf_size
)
{
asn_fprint
(
stderr
,
&
asn_DEF_Ngap_NGAP_PDU
,
ngResetPdu
);
...
...
@@ -124,7 +137,7 @@ bool NGResetMsg::decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu) {
switch
(
ngResetIEs
->
protocolIEs
.
list
.
array
[
i
]
->
id
)
{
case
Ngap_ProtocolIE_ID_id_Cause
:
{
if
(
ngResetIEs
->
protocolIEs
.
list
.
array
[
i
]
->
criticality
==
Ngap_Criticality_
reject
&&
Ngap_Criticality_
ignore
&&
ngResetIEs
->
protocolIEs
.
list
.
array
[
i
]
->
value
.
present
==
Ngap_NGResetIEs__value_PR_Cause
)
{
cause
=
new
Cause
();
...
...
@@ -141,7 +154,7 @@ bool NGResetMsg::decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu) {
}
break
;
case
Ngap_ProtocolIE_ID_id_ResetType
:
{
if
(
ngResetIEs
->
protocolIEs
.
list
.
array
[
i
]
->
criticality
==
Ngap_Criticality_
ignore
&&
Ngap_Criticality_
reject
&&
ngResetIEs
->
protocolIEs
.
list
.
array
[
i
]
->
value
.
present
==
Ngap_NGResetIEs__value_PR_ResetType
)
{
resetType
=
new
ResetType
();
...
...
src/ngap/ngapMsgs/NGReset.hpp
View file @
2e90cc26
...
...
@@ -56,6 +56,7 @@ class NGResetMsg {
bool
decodefrompdu
(
Ngap_NGAP_PDU_t
*
ngap_msg_pdu
);
void
getCause
(
Ngap_Cause_t
&
);
void
getResetType
(
Ngap_ResetType_t
&
);
bool
getResetType
(
ResetType
&
);
private:
Ngap_NGAP_PDU_t
*
ngResetPdu
;
...
...
src/ngap/ngap_app/ngap_app.cpp
View file @
2e90cc26
...
...
@@ -153,6 +153,12 @@ std::shared_ptr<gnb_context> ngap_app::gnb_id_2_gnb_context(
//------------------------------------------------------------------------------
void
ngap_app
::
set_gnb_id_2_gnb_context
(
const
long
&
gnb_id
,
std
::
shared_ptr
<
gnb_context
>
gc
)
{
std
::
shared
_lock
lock
(
m_gnbid2gnbContext
);
std
::
unique
_lock
lock
(
m_gnbid2gnbContext
);
gnbid2gnbContext
[
gnb_id
]
=
gc
;
}
//------------------------------------------------------------------------------
void
ngap_app
::
remove_gnb_context
(
const
long
&
gnb_id
)
{
std
::
unique_lock
lock
(
m_gnbid2gnbContext
);
gnbid2gnbContext
.
erase
(
gnb_id
);
}
src/ngap/ngap_app/ngap_app.hpp
View file @
2e90cc26
...
...
@@ -83,6 +83,8 @@ class ngap_app : public sctp_application {
const
long
&
gnb_id
,
std
::
shared_ptr
<
gnb_context
>
gc
);
std
::
shared_ptr
<
gnb_context
>
gnb_id_2_gnb_context
(
const
long
&
gnb_id
)
const
;
void
remove_gnb_context
(
const
long
&
gnb_id
);
protected:
sctp_server
sctp_s_38412
;
uint32_t
ppid_
;
...
...
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