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
1fa602b3
Commit
1fa602b3
authored
Jul 13, 2021
by
Tien-Thinh Nguyen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove global variable for Target RAN UE ID
parent
cf41b622
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
67 additions
and
15 deletions
+67
-15
src/amf-app/amf_app.cpp
src/amf-app/amf_app.cpp
+1
-0
src/amf-app/amf_n2.cpp
src/amf-app/amf_n2.cpp
+48
-8
src/amf-app/amf_n2.hpp
src/amf-app/amf_n2.hpp
+13
-2
src/contexts/ue_ngap_context.hpp
src/contexts/ue_ngap_context.hpp
+3
-2
src/ngap/ngap_app/ngap_message_callback.hpp
src/ngap/ngap_app/ngap_message_callback.hpp
+2
-3
No files found.
src/amf-app/amf_app.cpp
View file @
1fa602b3
...
@@ -298,6 +298,7 @@ void amf_app::handle_itti_message(
...
@@ -298,6 +298,7 @@ void amf_app::handle_itti_message(
}
else
{
}
else
{
unc
=
amf_n2_inst
->
ran_ue_id_2_ue_ngap_context
(
itti_msg
.
ran_ue_ngap_id
);
unc
=
amf_n2_inst
->
ran_ue_id_2_ue_ngap_context
(
itti_msg
.
ran_ue_ngap_id
);
unc
.
get
()
->
amf_ue_ngap_id
=
amf_ue_ngap_id
;
unc
.
get
()
->
amf_ue_ngap_id
=
amf_ue_ngap_id
;
amf_n2_inst
->
set_amf_ue_ngap_id_2_ue_ngap_context
(
amf_ue_ngap_id
,
unc
);
}
}
if
(
uc
.
get
()
==
nullptr
)
{
if
(
uc
.
get
()
==
nullptr
)
{
...
...
src/amf-app/amf_n2.cpp
View file @
1fa602b3
...
@@ -70,7 +70,6 @@ extern void print_buffer(
...
@@ -70,7 +70,6 @@ extern void print_buffer(
const
std
::
string
app
,
const
std
::
string
commit
,
uint8_t
*
buf
,
int
len
);
const
std
::
string
app
,
const
std
::
string
commit
,
uint8_t
*
buf
,
int
len
);
uint32_t
source_ran_id_global
=
0
;
uint32_t
source_ran_id_global
=
0
;
uint32_t
target_ran_id_global
=
0
;
sctp_assoc_id_t
downlink_sctp_assoc_id
=
0
;
sctp_assoc_id_t
downlink_sctp_assoc_id
=
0
;
sctp_assoc_id_t
source_assoc_id
=
0
;
sctp_assoc_id_t
source_assoc_id
=
0
;
int
ncc
=
0
;
int
ncc
=
0
;
...
@@ -666,7 +665,8 @@ void amf_n2::handle_itti_message(itti_dl_nas_transport& dl_nas_transport) {
...
@@ -666,7 +665,8 @@ void amf_n2::handle_itti_message(itti_dl_nas_transport& dl_nas_transport) {
"Illegal gNB with assoc id (0x%x)"
,
unc
.
get
()
->
gnb_assoc_id
);
"Illegal gNB with assoc id (0x%x)"
,
unc
.
get
()
->
gnb_assoc_id
);
return
;
return
;
}
}
unc
.
get
()
->
amf_ue_ngap_id
=
dl_nas_transport
.
amf_ue_ngap_id
;
unc
.
get
()
->
amf_ue_ngap_id
=
dl_nas_transport
.
amf_ue_ngap_id
;
set_amf_ue_ngap_id_2_ue_ngap_context
(
unc
.
get
()
->
amf_ue_ngap_id
,
unc
);
unc
.
get
()
->
ng_ue_state
=
NGAP_UE_CONNECTED
;
unc
.
get
()
->
ng_ue_state
=
NGAP_UE_CONNECTED
;
DownLinkNasTransportMsg
*
ngap_msg
=
new
DownLinkNasTransportMsg
();
DownLinkNasTransportMsg
*
ngap_msg
=
new
DownLinkNasTransportMsg
();
ngap_msg
->
setMessageType
();
ngap_msg
->
setMessageType
();
...
@@ -1236,7 +1236,6 @@ void amf_n2::handle_itti_message(itti_handover_request_Ack& itti_msg) {
...
@@ -1236,7 +1236,6 @@ void amf_n2::handle_itti_message(itti_handover_request_Ack& itti_msg) {
// TODO: Experimental procedure, to be tested
// TODO: Experimental procedure, to be tested
unsigned
long
amf_ue_ngap_id
=
itti_msg
.
handoverrequestAck
->
getAmfUeNgapId
();
unsigned
long
amf_ue_ngap_id
=
itti_msg
.
handoverrequestAck
->
getAmfUeNgapId
();
uint32_t
ran_ue_ngap_id
=
itti_msg
.
handoverrequestAck
->
getRanUeNgapId
();
uint32_t
ran_ue_ngap_id
=
itti_msg
.
handoverrequestAck
->
getRanUeNgapId
();
target_ran_id_global
=
ran_ue_ngap_id
;
Logger
::
amf_n2
().
error
(
Logger
::
amf_n2
().
error
(
"Handover Request Ack ran_ue_ngap_id (0x%d) amf_ue_ngap_id (%d)"
,
"Handover Request Ack ran_ue_ngap_id (0x%d) amf_ue_ngap_id (%d)"
,
ran_ue_ngap_id
,
amf_ue_ngap_id
);
ran_ue_ngap_id
,
amf_ue_ngap_id
);
...
@@ -1249,6 +1248,15 @@ void amf_n2::handle_itti_message(itti_handover_request_Ack& itti_msg) {
...
@@ -1249,6 +1248,15 @@ void amf_n2::handle_itti_message(itti_handover_request_Ack& itti_msg) {
}
}
gc
=
assoc_id_2_gnb_context
(
itti_msg
.
assoc_id
);
gc
=
assoc_id_2_gnb_context
(
itti_msg
.
assoc_id
);
std
::
shared_ptr
<
ue_ngap_context
>
unc
=
{};
if
(
!
is_amf_ue_id_2_ue_ngap_context
(
amf_ue_ngap_id
))
{
Logger
::
amf_n2
().
error
(
"No UE NGAP context with amf_ue_ngap_id (0x%x)"
,
amf_ue_ngap_id
);
return
;
}
unc
=
amf_ue_id_2_ue_ngap_context
(
amf_ue_ngap_id
);
unc
.
get
()
->
ran_ue_ngap_id_temp
=
ran_ue_ngap_id
;
// store target RAN ID
std
::
vector
<
PDUSessionResourceAdmittedItem_t
>
list
;
std
::
vector
<
PDUSessionResourceAdmittedItem_t
>
list
;
if
(
!
itti_msg
.
handoverrequestAck
->
getPDUSessionResourceAdmittedList
(
list
))
{
if
(
!
itti_msg
.
handoverrequestAck
->
getPDUSessionResourceAdmittedList
(
list
))
{
Logger
::
ngap
().
error
(
Logger
::
ngap
().
error
(
...
@@ -1340,7 +1348,9 @@ void amf_n2::handle_itti_message(itti_handover_request_Ack& itti_msg) {
...
@@ -1340,7 +1348,9 @@ void amf_n2::handle_itti_message(itti_handover_request_Ack& itti_msg) {
uint8_t
buffer
[
10240
];
uint8_t
buffer
[
10240
];
int
encoded_size
=
handovercommand
->
encode2buffer
(
buffer
,
10240
);
int
encoded_size
=
handovercommand
->
encode2buffer
(
buffer
,
10240
);
bstring
b
=
blk2bstr
(
buffer
,
encoded_size
);
bstring
b
=
blk2bstr
(
buffer
,
encoded_size
);
std
::
shared_ptr
<
ue_ngap_context
>
unc
;
// Create/Update UE NGAP Context if necessary
// TO be verified
if
(
!
is_ran_ue_id_2_ue_ngap_context
(
source_ran_id_global
))
{
if
(
!
is_ran_ue_id_2_ue_ngap_context
(
source_ran_id_global
))
{
Logger
::
amf_n2
().
debug
(
Logger
::
amf_n2
().
debug
(
"Create a new ue ngap context with ran_ue_ngap_id(0x%x)"
,
"Create a new ue ngap context with ran_ue_ngap_id(0x%x)"
,
...
@@ -1352,6 +1362,7 @@ void amf_n2::handle_itti_message(itti_handover_request_Ack& itti_msg) {
...
@@ -1352,6 +1362,7 @@ void amf_n2::handle_itti_message(itti_handover_request_Ack& itti_msg) {
unc
=
ran_ue_id_2_ue_ngap_context
(
source_ran_id_global
);
unc
=
ran_ue_id_2_ue_ngap_context
(
source_ran_id_global
);
unc
.
get
()
->
gnb_assoc_id
=
source_assoc_id
;
unc
.
get
()
->
gnb_assoc_id
=
source_assoc_id
;
}
}
// std::shared_ptr<ue_ngap_context> ngc =
// std::shared_ptr<ue_ngap_context> ngc =
// ran_ue_id_2_ue_ngap_context(nc.get()->ran_ue_ngap_id);
// ran_ue_id_2_ue_ngap_context(nc.get()->ran_ue_ngap_id);
// std::shared_ptr<ue_ngap_context> ngc =
// std::shared_ptr<ue_ngap_context> ngc =
...
@@ -1429,6 +1440,15 @@ void amf_n2::handle_itti_message(itti_uplinkranstatsutransfer& itti_msg) {
...
@@ -1429,6 +1440,15 @@ void amf_n2::handle_itti_message(itti_uplinkranstatsutransfer& itti_msg) {
"gNB with assoc_id (%d) is illegal"
,
itti_msg
.
assoc_id
);
"gNB with assoc_id (%d) is illegal"
,
itti_msg
.
assoc_id
);
return
;
return
;
}
}
std
::
shared_ptr
<
ue_ngap_context
>
unc
=
{};
if
(
!
is_amf_ue_id_2_ue_ngap_context
(
amf_ue_ngap_id
))
{
Logger
::
amf_n2
().
error
(
"No UE NGAP context with amf_ue_ngap_id (0x%x)"
,
amf_ue_ngap_id
);
return
;
}
unc
=
amf_ue_id_2_ue_ngap_context
(
amf_ue_ngap_id
);
RANStatusTransferTransparentContainer
*
ran_status_transfer
=
RANStatusTransferTransparentContainer
*
ran_status_transfer
=
(
RANStatusTransferTransparentContainer
*
)
calloc
(
(
RANStatusTransferTransparentContainer
*
)
calloc
(
1
,
sizeof
(
RANStatusTransferTransparentContainer
));
1
,
sizeof
(
RANStatusTransferTransparentContainer
));
...
@@ -1468,14 +1488,14 @@ void amf_n2::handle_itti_message(itti_uplinkranstatsutransfer& itti_msg) {
...
@@ -1468,14 +1488,14 @@ void amf_n2::handle_itti_message(itti_uplinkranstatsutransfer& itti_msg) {
std
::
make_unique
<
DownlinkRANStatusTransfer
>
();
std
::
make_unique
<
DownlinkRANStatusTransfer
>
();
downLinkranstatustransfer
->
setmessagetype
();
downLinkranstatustransfer
->
setmessagetype
();
downLinkranstatustransfer
->
setAmfUeNgapId
(
amf_ue_ngap_id
);
downLinkranstatustransfer
->
setAmfUeNgapId
(
amf_ue_ngap_id
);
downLinkranstatustransfer
->
setRanUeNgapId
(
target_ran_id_global
);
downLinkranstatustransfer
->
setRanUeNgapId
(
unc
.
get
()
->
ran_ue_ngap_id_temp
);
downLinkranstatustransfer
->
setRANStatusTransfer_TransparentContainer
(
downLinkranstatustransfer
->
setRANStatusTransfer_TransparentContainer
(
amf_drb_id
,
amf_ul_pdcp
,
amf_hfn_ul_pdcp
,
amf_dl_pdcp
,
amf_hfn_dl_pdcp
);
amf_drb_id
,
amf_ul_pdcp
,
amf_hfn_ul_pdcp
,
amf_dl_pdcp
,
amf_hfn_dl_pdcp
);
uint8_t
buffer
[
1024
];
uint8_t
buffer
[
1024
];
int
encode_size
=
downLinkranstatustransfer
->
encodetobuffer
(
buffer
,
1024
);
int
encode_size
=
downLinkranstatustransfer
->
encodetobuffer
(
buffer
,
1024
);
bstring
b
=
blk2bstr
(
buffer
,
encode_size
);
bstring
b
=
blk2bstr
(
buffer
,
encode_size
);
// std::shared_ptr<ue_ngap_context> ngc =
// std::shared_ptr<ue_ngap_context> ngc =
// ran_ue_id_2_ue_ngap_context(
target_ran_id_global
);
// ran_ue_id_2_ue_ngap_context(
unc.get()->ran_ue_ngap_id_temp
);
sctp_s_38412
.
sctp_send_msg
(
downlink_sctp_assoc_id
,
0
,
&
b
);
sctp_s_38412
.
sctp_send_msg
(
downlink_sctp_assoc_id
,
0
,
&
b
);
}
}
...
@@ -1497,12 +1517,32 @@ std::shared_ptr<ue_ngap_context> amf_n2::ran_ue_id_2_ue_ngap_context(
...
@@ -1497,12 +1517,32 @@ std::shared_ptr<ue_ngap_context> amf_n2::ran_ue_id_2_ue_ngap_context(
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
void
amf_n2
::
set_ran_ue_ngap_id_2_ue_ngap_context
(
void
amf_n2
::
set_ran_ue_ngap_id_2_ue_ngap_context
(
const
uint32_t
&
ran_ue_ngap_id
,
std
::
shared_ptr
<
ue_ngap_context
>
unc
)
{
const
uint32_t
&
ran_ue_ngap_id
,
std
::
shared_ptr
<
ue_ngap_context
>
unc
)
{
std
::
shared
_lock
lock
(
m_ranid2uecontext
);
std
::
unique
_lock
lock
(
m_ranid2uecontext
);
ranid2uecontext
[
ran_ue_ngap_id
]
=
unc
;
ranid2uecontext
[
ran_ue_ngap_id
]
=
unc
;
}
}
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
// internal analysis functions
std
::
shared_ptr
<
ue_ngap_context
>
amf_n2
::
amf_ue_id_2_ue_ngap_context
(
const
unsigned
long
&
amf_ue_ngap_id
)
const
{
std
::
shared_lock
lock
(
m_amfueid2uecontext
);
return
amfueid2uecontext
.
at
(
amf_ue_ngap_id
);
}
//------------------------------------------------------------------------------
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
};
}
//------------------------------------------------------------------------------
void
amf_n2
::
set_amf_ue_ngap_id_2_ue_ngap_context
(
const
unsigned
long
&
amf_ue_ngap_id
,
std
::
shared_ptr
<
ue_ngap_context
>
unc
)
{
std
::
unique_lock
lock
(
m_amfueid2uecontext
);
amfueid2uecontext
[
amf_ue_ngap_id
]
=
unc
;
}
//------------------------------------------------------------------------------
bool
amf_n2
::
verifyPlmn
(
vector
<
SupportedItem_t
>
list
)
{
bool
amf_n2
::
verifyPlmn
(
vector
<
SupportedItem_t
>
list
)
{
for
(
int
i
=
0
;
i
<
amf_cfg
.
plmn_list
.
size
();
i
++
)
{
for
(
int
i
=
0
;
i
<
amf_cfg
.
plmn_list
.
size
();
i
++
)
{
for
(
int
j
=
0
;
j
<
list
.
size
();
j
++
)
{
for
(
int
j
=
0
;
j
<
list
.
size
();
j
++
)
{
...
...
src/amf-app/amf_n2.hpp
View file @
1fa602b3
...
@@ -66,18 +66,29 @@ class amf_n2 : public ngap::ngap_app {
...
@@ -66,18 +66,29 @@ class amf_n2 : public ngap::ngap_app {
bool
verifyPlmn
(
std
::
vector
<
SupportedItem_t
>
list
);
bool
verifyPlmn
(
std
::
vector
<
SupportedItem_t
>
list
);
std
::
vector
<
SupportedItem_t
>
get_common_plmn
(
std
::
vector
<
SupportedItem_t
>
get_common_plmn
(
std
::
vector
<
SupportedItem_t
>
list
);
std
::
vector
<
SupportedItem_t
>
list
);
std
::
shared_ptr
<
ue_ngap_context
>
ran_ue_id_2_ue_ngap_context
(
std
::
shared_ptr
<
ue_ngap_context
>
ran_ue_id_2_ue_ngap_context
(
const
uint32_t
&
ran_ue_ngap_id
)
const
;
const
uint32_t
&
ran_ue_ngap_id
)
const
;
bool
is_ran_ue_id_2_ue_ngap_context
(
const
uint32_t
&
ran_ue_ngap_id
)
const
;
bool
is_ran_ue_id_2_ue_ngap_context
(
const
uint32_t
&
ran_ue_ngap_id
)
const
;
void
set_ran_ue_ngap_id_2_ue_ngap_context
(
void
set_ran_ue_ngap_id_2_ue_ngap_context
(
const
uint32_t
&
ran_ue_ngap_id
,
std
::
shared_ptr
<
ue_ngap_context
>
unc
);
const
uint32_t
&
ran_ue_ngap_id
,
std
::
shared_ptr
<
ue_ngap_context
>
unc
);
std
::
shared_ptr
<
ue_ngap_context
>
amf_ue_id_2_ue_ngap_context
(
const
unsigned
long
&
amf_ue_ngap_id
)
const
;
bool
is_amf_ue_id_2_ue_ngap_context
(
const
unsigned
long
&
amf_ue_ngap_id
)
const
;
void
set_amf_ue_ngap_id_2_ue_ngap_context
(
const
unsigned
long
&
amf_ue_ngap_id
,
std
::
shared_ptr
<
ue_ngap_context
>
unc
);
private:
private:
std
::
map
<
uint32_t
,
std
::
shared_ptr
<
ue_ngap_context
>>
std
::
map
<
uint32_t
,
std
::
shared_ptr
<
ue_ngap_context
>>
ranid2uecontext
;
// ran ue ngap id
ranid2uecontext
;
// ran ue ngap id
mutable
std
::
shared_mutex
m_ranid2uecontext
;
mutable
std
::
shared_mutex
m_ranid2uecontext
;
std
::
map
<
unsigned
long
,
std
::
shared_ptr
<
ue_ngap_context
>>
amfueid2uecontext
;
// amf ue id
mutable
std
::
shared_mutex
m_amfueid2uecontext
;
};
};
}
// namespace amf_application
}
// namespace amf_application
...
...
src/contexts/ue_ngap_context.hpp
View file @
1fa602b3
...
@@ -46,8 +46,9 @@ typedef enum {
...
@@ -46,8 +46,9 @@ typedef enum {
class
ue_ngap_context
{
class
ue_ngap_context
{
public:
public:
uint32_t
ran_ue_ngap_id
;
// 32bits
uint32_t
ran_ue_ngap_id
;
// 32bits
long
amf_ue_ngap_id
:
40
;
// 40bits
long
amf_ue_ngap_id
:
40
;
// 40bits
uint32_t
ran_ue_ngap_id_temp
;
// 32bits, for HO
sctp_stream_id_t
sctp_stream_recv
;
// used to decide which ue in gNB
sctp_stream_id_t
sctp_stream_recv
;
// used to decide which ue in gNB
sctp_stream_id_t
sctp_stream_send
;
// used to decide which ue in gNB
sctp_stream_id_t
sctp_stream_send
;
// used to decide which ue in gNB
...
...
src/ngap/ngap_app/ngap_message_callback.hpp
View file @
1fa602b3
...
@@ -606,12 +606,11 @@ int handover_resource_allocation(
...
@@ -606,12 +606,11 @@ int handover_resource_allocation(
const
sctp_assoc_id_t
assoc_id
,
const
sctp_stream_id_t
stream
,
const
sctp_assoc_id_t
assoc_id
,
const
sctp_stream_id_t
stream
,
struct
Ngap_NGAP_PDU
*
message_p
)
{
struct
Ngap_NGAP_PDU
*
message_p
)
{
Logger
::
ngap
().
debug
(
Logger
::
ngap
().
debug
(
"Sending itti handover resource allocation to TASK_AMF_N2"
);
"Sending ITTI Handover Resource Allocation to TASK_AMF_N2"
);
/*receive handover request acknowedge*/
asn_fprint
(
stderr
,
&
asn_DEF_Ngap_NGAP_PDU
,
message_p
);
asn_fprint
(
stderr
,
&
asn_DEF_Ngap_NGAP_PDU
,
message_p
);
HandoverRequestAck
*
handoverRequestAck
=
new
HandoverRequestAck
();
HandoverRequestAck
*
handoverRequestAck
=
new
HandoverRequestAck
();
if
(
!
handoverRequestAck
->
decodefrompdu
(
message_p
))
{
if
(
!
handoverRequestAck
->
decodefrompdu
(
message_p
))
{
Logger
::
ngap
().
error
(
"
decoding handoverRequestAck
message error"
);
Logger
::
ngap
().
error
(
"
Decoding Handover Request Acknowledge
message error"
);
return
-
1
;
return
-
1
;
}
}
itti_handover_request_Ack
*
itti_handover_requ_Ack
=
itti_handover_request_Ack
*
itti_handover_requ_Ack
=
...
...
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