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
7e0d0a7e
Commit
7e0d0a7e
authored
Jul 02, 2021
by
Tien-Thinh Nguyen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Code cleanup for HO procedure
parent
82d32d76
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
78 additions
and
76 deletions
+78
-76
src/amf-app/amf_n2.cpp
src/amf-app/amf_n2.cpp
+67
-65
src/itti/msgs/itti_msg_n2.hpp
src/itti/msgs/itti_msg_n2.hpp
+1
-1
src/ngap/ngap_app/ngap_message_callback.hpp
src/ngap/ngap_app/ngap_message_callback.hpp
+10
-10
No files found.
src/amf-app/amf_n2.cpp
View file @
7e0d0a7e
...
@@ -69,7 +69,7 @@ extern statistics stacs;
...
@@ -69,7 +69,7 @@ extern statistics stacs;
extern
void
print_buffer
(
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
ran_id_
G
lobal
=
0
;
uint32_t
ran_id_
g
lobal
=
0
;
uint32_t
AMF_TARGET_ran_id_global
=
0
;
uint32_t
AMF_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
;
...
@@ -1046,65 +1046,62 @@ void amf_n2::handle_itti_message(
...
@@ -1046,65 +1046,62 @@ void amf_n2::handle_itti_message(
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
void
amf_n2
::
handle_itti_message
(
itti_handover_required
&
itti_msg
)
{
void
amf_n2
::
handle_itti_message
(
itti_handover_required
&
itti_msg
)
{
// TODO:
to be tesbed/clean up
// TODO:
Experimental procedure, to be testbed
ncc
++
;
ncc
++
;
// TODO: to be verified
unsigned
long
amf_ue_ngap_id
=
itti_msg
.
hand
voerRequ
->
getAmfUeNgapId
();
unsigned
long
amf_ue_ngap_id
=
itti_msg
.
hand
overReq
->
getAmfUeNgapId
();
uint32_t
ran_ue_ngap_id
=
itti_msg
.
hand
voerRequ
->
getRanUeNgapId
();
uint32_t
ran_ue_ngap_id
=
itti_msg
.
hand
overReq
->
getRanUeNgapId
();
ran_id_
G
lobal
=
ran_ue_ngap_id
;
ran_id_
g
lobal
=
ran_ue_ngap_id
;
source_assoc_id
=
itti_msg
.
assoc_id
;
source_assoc_id
=
itti_msg
.
assoc_id
;
std
::
shared_ptr
<
gnb_context
>
gc
;
std
::
shared_ptr
<
gnb_context
>
gc
=
{};
if
(
!
is_assoc_id_2_gnb_context
(
itti_msg
.
assoc_id
))
{
if
(
!
is_assoc_id_2_gnb_context
(
itti_msg
.
assoc_id
))
{
Logger
::
amf_n2
().
error
(
Logger
::
amf_n2
().
error
(
"gNB with assoc_id (%d) is illegal"
,
itti_msg
.
assoc_id
);
"gNB with assoc_id (%d) is illegal"
,
itti_msg
.
assoc_id
);
return
;
return
;
}
}
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_ran_ue_id_2_ue_ngap_context
(
ran_ue_ngap_id
))
{
std
::
shared_ptr
<
ue_ngap_context
>
unc
=
{};
Logger
::
amf_n2
().
error
(
"UE with ran_ue_ngap_id (0x%x) is not attached to gNB with "
"assoc_id (%d)"
,
ran_ue_ngap_id
,
itti_msg
.
assoc_id
);
return
;
}
if
(
!
is_ran_ue_id_2_ue_ngap_context
(
ran_ue_ngap_id
))
{
if
(
!
is_ran_ue_id_2_ue_ngap_context
(
ran_ue_ngap_id
))
{
Logger
::
amf_n2
().
error
(
Logger
::
amf_n2
().
error
(
"No UE NGAP context with ran_ue_ngap_id
(%d
)"
,
ran_ue_ngap_id
);
"No UE NGAP context with ran_ue_ngap_id
(0x%x
)"
,
ran_ue_ngap_id
);
return
;
return
;
}
}
unc
=
ran_ue_id_2_ue_ngap_context
(
ran_ue_ngap_id
);
unc
=
ran_ue_id_2_ue_ngap_context
(
ran_ue_ngap_id
);
if
(
unc
.
get
()
->
amf_ue_ngap_id
!=
amf_ue_ngap_id
)
{
if
(
unc
.
get
()
->
amf_ue_ngap_id
!=
amf_ue_ngap_id
)
{
Logger
::
amf_n2
().
error
(
Logger
::
amf_n2
().
error
(
"The requested UE (amf_ue_ngap_id:0x%x) is not valid, existed UE "
"The requested UE (amf_ue_ngap_id:0x%x) is not valid, existed UE "
"w
hich's amf_ue_ngap_id
(0x%x)"
,
"w
ith amf_ue_ngap_id
(0x%x)"
,
amf_ue_ngap_id
,
unc
.
get
()
->
amf_ue_ngap_id
);
amf_ue_ngap_id
,
unc
.
get
()
->
amf_ue_ngap_id
);
}
}
if
(
itti_msg
.
handvoerRequ
->
getHandoverType
()
!=
Ngap_HandoverType_intra5gs
)
{
Logger
::
amf_n2
().
error
(
if
(
itti_msg
.
handoverReq
->
getHandoverType
()
!=
Ngap_HandoverType_intra5gs
)
{
"Received Handover Required message,but handover type is not "
Logger
::
amf_n2
().
error
(
"Handover Type is not supported"
);
"Ngap_HandoverType_intra5gs"
);
return
;
return
;
}
}
if
(
itti_msg
.
handvoerRequ
->
getChoiceOfCause
()
!=
Ngap_Cause_PR_radioNetwork
)
{
Logger
::
amf_n2
().
error
(
if
(
itti_msg
.
handoverReq
->
getChoiceOfCause
()
!=
Ngap_Cause_PR_radioNetwork
)
{
"Received Handover Required message,but Cause Of Choice is wrong
"
);
Logger
::
amf_n2
().
error
(
"CHOICE Cause Group is not supported
"
);
return
;
return
;
}
}
if
(
itti_msg
.
handvoerRequ
->
getCauseValue
()
!=
if
(
itti_msg
.
handoverReq
->
getCauseValue
()
!=
Ngap_CauseRadioNetwork_handover_desirable_for_radio_reason
)
{
Ngap_CauseRadioNetwork_handover_desirable_for_radio_reason
)
{
Logger
::
amf_n2
().
error
(
Logger
::
amf_n2
().
error
(
"Radio Network Layer Cause is not supported"
);
"Received Handover Required message, but value of Cause is wrong"
);
return
;
return
;
}
}
if
(
itti_msg
.
handvoerRequ
->
getDirectForwardingPathAvailability
()
!=
if
(
itti_msg
.
handoverReq
->
getDirectForwardingPathAvailability
()
!=
Ngap_DirectForwardingPathAvailability_direct_path_available
)
{
Ngap_DirectForwardingPathAvailability_direct_path_available
)
{
Logger
::
amf_n2
().
error
(
Logger
::
amf_n2
().
error
(
"
Received Handover Required message, but
"
"
DirectForwardingPathAvailability must be
"
"
DirectForwardingPathAvailability is wrong
"
);
"
Ngap_DirectForwardingPathAvailability_direct_path_available!
"
);
return
;
return
;
}
}
GlobalgNBId
*
TargetGlobalgNBId
=
new
GlobalgNBId
();
GlobalgNBId
*
TargetGlobalgNBId
=
new
GlobalgNBId
();
itti_msg
.
hand
voerRequ
->
getGlobalRanNodeId
(
TargetGlobalgNBId
);
itti_msg
.
hand
overReq
->
getGlobalRanNodeId
(
TargetGlobalgNBId
);
PlmnId
*
plmn
=
new
PlmnId
();
PlmnId
*
plmn
=
new
PlmnId
();
GNB_ID
*
gnbid
=
new
GNB_ID
();
GNB_ID
*
gnbid
=
new
GNB_ID
();
TargetGlobalgNBId
->
getGlobalgNBId
(
plmn
,
gnbid
);
TargetGlobalgNBId
->
getGlobalgNBId
(
plmn
,
gnbid
);
...
@@ -1115,8 +1112,9 @@ void amf_n2::handle_itti_message(itti_handover_required& itti_msg) {
...
@@ -1115,8 +1112,9 @@ void amf_n2::handle_itti_message(itti_handover_required& itti_msg) {
"Handover required: Target ID GlobalRanNodeID PLmn (mcc: %s, mnc: %s, "
"Handover required: Target ID GlobalRanNodeID PLmn (mcc: %s, mnc: %s, "
"gnbid: %ld)
\n
"
,
"gnbid: %ld)
\n
"
,
mcc
.
c_str
(),
mnc
.
c_str
(),
gnbid
->
getValue
());
mcc
.
c_str
(),
mnc
.
c_str
(),
gnbid
->
getValue
());
TAI
*
tai
=
new
TAI
();
TAI
*
tai
=
new
TAI
();
itti_msg
.
hand
voerRequ
->
getTAI
(
tai
);
itti_msg
.
hand
overReq
->
getTAI
(
tai
);
PlmnId
*
plmnOfTAI
=
new
PlmnId
();
PlmnId
*
plmnOfTAI
=
new
PlmnId
();
TAC
*
tac
=
new
TAC
();
TAC
*
tac
=
new
TAC
();
tai
->
getTAI
(
plmnOfTAI
,
tac
);
tai
->
getTAI
(
plmnOfTAI
,
tac
);
...
@@ -1126,17 +1124,19 @@ void amf_n2::handle_itti_message(itti_handover_required& itti_msg) {
...
@@ -1126,17 +1124,19 @@ void amf_n2::handle_itti_message(itti_handover_required& itti_msg) {
printf
(
printf
(
"Handover required:Target ID selectedTAI PLmn=mcc%s mnc%s tac=%x
\n
"
,
"Handover required:Target ID selectedTAI PLmn=mcc%s mnc%s tac=%x
\n
"
,
mccOfselectTAI
.
c_str
(),
mncOfselectTAI
.
c_str
(),
tac
->
getTac
());
mccOfselectTAI
.
c_str
(),
mncOfselectTAI
.
c_str
(),
tac
->
getTac
());
std
::
vector
<
PDUSessionResourceItem_t
>
List_HORqd
;
std
::
vector
<
PDUSessionResourceItem_t
>
List_HORqd
;
if
(
!
itti_msg
.
hand
voerRequ
->
getPDUSessionResourceList
(
List_HORqd
))
{
if
(
!
itti_msg
.
hand
overReq
->
getPDUSessionResourceList
(
List_HORqd
))
{
Logger
::
ngap
().
error
(
Logger
::
ngap
().
error
(
"Decoding HandoverRequiredMsg getPDUSessionResourceList IE error"
);
"Decoding HandoverRequiredMsg getPDUSessionResourceList IE error"
);
return
;
return
;
}
}
OCTET_STRING_t
sourceTotarget
;
OCTET_STRING_t
sourceTotarget
;
sourceTotarget
=
sourceTotarget
=
itti_msg
.
hand
voerRequ
->
getSourceToTarget_TransparentContainer
();
itti_msg
.
hand
overReq
->
getSourceToTarget_TransparentContainer
();
//
send handover request to target gnb
//
Create HandoverRequest message to be sent to target gNB
std
::
unique_ptr
<
HandoverRequest
>
handoverrequest
=
std
::
unique_ptr
<
HandoverRequest
>
handoverrequest
=
std
::
make_unique
<
HandoverRequest
>
();
std
::
make_unique
<
HandoverRequest
>
();
handoverrequest
->
setMessageType
();
handoverrequest
->
setMessageType
();
...
@@ -1145,14 +1145,16 @@ void amf_n2::handle_itti_message(itti_handover_required& itti_msg) {
...
@@ -1145,14 +1145,16 @@ void amf_n2::handle_itti_message(itti_handover_required& itti_msg) {
handoverrequest
->
setCause
(
handoverrequest
->
setCause
(
Ngap_Cause_PR_radioNetwork
,
Ngap_Cause_PR_radioNetwork
,
Ngap_CauseRadioNetwork_handover_desirable_for_radio_reason
);
Ngap_CauseRadioNetwork_handover_desirable_for_radio_reason
);
handoverrequest
->
setUEAggregateMaximumBitRate
(
300000000
,
100000000
);
handoverrequest
->
setUEAggregateMaximumBitRate
(
handoverrequest
->
setUESecurityCapabilities
(
0xe000
,
0xe000
,
0xe000
,
0xe000
);
300000000
,
100000000
);
// TODO: remove hardcoded values
handoverrequest
->
setUESecurityCapabilities
(
0xe000
,
0xe000
,
0xe000
,
0xe000
);
// TODO: remove hardcoded values
S_NSSAI
s_nssai
;
S_NSSAI
s_nssai
=
{}
;
s_nssai
.
setSst
(
"01"
);
s_nssai
.
setSst
(
"01"
);
// TODO: remove hardcoded values
std
::
vector
<
S_NSSAI
>
Allowed_Nssai
;
std
::
vector
<
S_NSSAI
>
Allowed_Nssai
;
Allowed_Nssai
.
push_back
(
s_nssai
);
Allowed_Nssai
.
push_back
(
s_nssai
);
// handoverrequest->setAllowedNSSAI(Allowed_Nssai);
Guami_t
guami
;
Guami_t
guami
;
guami
.
mcc
=
amf_cfg
.
guami
.
mcc
;
guami
.
mcc
=
amf_cfg
.
guami
.
mcc
;
guami
.
mnc
=
amf_cfg
.
guami
.
mnc
;
guami
.
mnc
=
amf_cfg
.
guami
.
mnc
;
...
@@ -1167,9 +1169,6 @@ void amf_n2::handle_itti_message(itti_handover_required& itti_msg) {
...
@@ -1167,9 +1169,6 @@ void amf_n2::handle_itti_message(itti_handover_required& itti_msg) {
m_aMFRegionID
->
setAMFRegionID
(
guami
.
regionID
);
m_aMFRegionID
->
setAMFRegionID
(
guami
.
regionID
);
m_aMFSetID
->
setAMFSetID
(
guami
.
AmfSetID
);
m_aMFSetID
->
setAMFSetID
(
guami
.
AmfSetID
);
m_aMFPointer
->
setAMFPointer
(
guami
.
AmfPointer
);
m_aMFPointer
->
setAMFPointer
(
guami
.
AmfPointer
);
// handoverrequest->setMobilityRestrictionList(m_plmnId);
// handoverrequest->setGUAMI(m_plmnId, m_aMFRegionID, m_aMFSetID,
// m_aMFPointer);
std
::
shared_ptr
<
nas_context
>
nc
=
std
::
shared_ptr
<
nas_context
>
nc
=
amf_n1_inst
->
amf_ue_id_2_nas_context
(
amf_ue_ngap_id
);
amf_n1_inst
->
amf_ue_id_2_nas_context
(
amf_ue_ngap_id
);
...
@@ -1185,7 +1184,6 @@ void amf_n2::handle_itti_message(itti_handover_required& itti_msg) {
...
@@ -1185,7 +1184,6 @@ void amf_n2::handle_itti_message(itti_handover_required& itti_msg) {
handoverrequest
->
setSecurityContext
(
handoverrequest
->
setSecurityContext
(
ncc
/*NCC count*/
,
(
uint8_t
*
)
bdata
(
knh_bs
));
ncc
/*NCC count*/
,
(
uint8_t
*
)
bdata
(
knh_bs
));
// handoverrequest->setSourceToTarget_TransparentContainer(sourceTotarget);
string
supi
=
"imsi-"
+
nc
.
get
()
->
imsi
;
string
supi
=
"imsi-"
+
nc
.
get
()
->
imsi
;
// Get all the active PDU sessions
// Get all the active PDU sessions
...
@@ -1195,7 +1193,7 @@ void amf_n2::handle_itti_message(itti_handover_required& itti_msg) {
...
@@ -1195,7 +1193,7 @@ void amf_n2::handle_itti_message(itti_handover_required& itti_msg) {
}
}
std
::
vector
<
PDUSessionResourceSetupRequestItem_t
>
list
;
std
::
vector
<
PDUSessionResourceSetupRequestItem_t
>
list
;
PDUSessionResourceSetupRequestItem_t
item
;
PDUSessionResourceSetupRequestItem_t
item
=
{}
;
if
(
pdu_sessions
.
size
()
>
0
)
{
if
(
pdu_sessions
.
size
()
>
0
)
{
for
(
auto
pdu_session
:
pdu_sessions
)
{
for
(
auto
pdu_session
:
pdu_sessions
)
{
...
@@ -1226,7 +1224,7 @@ void amf_n2::handle_itti_message(itti_handover_required& itti_msg) {
...
@@ -1226,7 +1224,7 @@ void amf_n2::handle_itti_message(itti_handover_required& itti_msg) {
uint8_t
buffer
[
20240
];
uint8_t
buffer
[
20240
];
int
encoded_size
=
handoverrequest
->
encode2buffer
(
buffer
,
20240
);
int
encoded_size
=
handoverrequest
->
encode2buffer
(
buffer
,
20240
);
bstring
b
=
blk2bstr
(
buffer
,
encoded_size
);
bstring
b
=
blk2bstr
(
buffer
,
encoded_size
);
std
::
shared_ptr
<
gnb_context
>
gc_target
;
std
::
shared_ptr
<
gnb_context
>
gc_target
=
{}
;
gc_target
=
gnb_id_2_gnb_context
(
gnbid
->
getValue
());
gc_target
=
gnb_id_2_gnb_context
(
gnbid
->
getValue
());
downlink_sctp_assoc_id
=
gc_target
.
get
()
->
sctp_assoc_id
;
downlink_sctp_assoc_id
=
gc_target
.
get
()
->
sctp_assoc_id
;
sctp_s_38412
.
sctp_send_msg
(
gc_target
.
get
()
->
sctp_assoc_id
,
0
,
&
b
);
sctp_s_38412
.
sctp_send_msg
(
gc_target
.
get
()
->
sctp_assoc_id
,
0
,
&
b
);
...
@@ -1234,26 +1232,29 @@ void amf_n2::handle_itti_message(itti_handover_required& itti_msg) {
...
@@ -1234,26 +1232,29 @@ void amf_n2::handle_itti_message(itti_handover_required& itti_msg) {
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
void
amf_n2
::
handle_itti_message
(
itti_handover_request_Ack
&
itti_msg
)
{
void
amf_n2
::
handle_itti_message
(
itti_handover_request_Ack
&
itti_msg
)
{
// TODO:
remove cout/cleanup
// TODO:
Experimental procedure, to be testbed
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
();
AMF_TARGET_ran_id_global
=
ran_ue_ngap_id
;
AMF_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
);
std
::
shared_ptr
<
gnb_context
>
gc
;
std
::
shared_ptr
<
gnb_context
>
gc
=
{};
if
(
!
is_assoc_id_2_gnb_context
(
itti_msg
.
assoc_id
))
{
if
(
!
is_assoc_id_2_gnb_context
(
itti_msg
.
assoc_id
))
{
Logger
::
amf_n2
().
error
(
Logger
::
amf_n2
().
error
(
"gNB with assoc_id(%d) is illegal"
,
itti_msg
.
assoc_id
);
"gNB with assoc_id(%d) is illegal"
,
itti_msg
.
assoc_id
);
return
;
return
;
}
}
gc
=
assoc_id_2_gnb_context
(
itti_msg
.
assoc_id
);
gc
=
assoc_id_2_gnb_context
(
itti_msg
.
assoc_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
(
"Decoding HandoverRequestACK getPDUSessionResourceList IE error"
);
"Decoding HandoverRequestACK getPDUSessionResourceList IE error"
);
return
;
return
;
}
}
OCTET_STRING_t
targetTosource
;
OCTET_STRING_t
targetTosource
;
targetTosource
=
targetTosource
=
itti_msg
.
handoverrequestAck
->
getTargetToSource_TransparentContainer
();
itti_msg
.
handoverrequestAck
->
getTargetToSource_TransparentContainer
();
...
@@ -1261,21 +1262,22 @@ void amf_n2::handle_itti_message(itti_handover_request_Ack& itti_msg) {
...
@@ -1261,21 +1262,22 @@ void amf_n2::handle_itti_message(itti_handover_request_Ack& itti_msg) {
PDUSessionResourceHandoverRequestAckTransfer
*
PDUHandoverRequestAckTransfer
=
PDUSessionResourceHandoverRequestAckTransfer
*
PDUHandoverRequestAckTransfer
=
new
PDUSessionResourceHandoverRequestAckTransfer
();
new
PDUSessionResourceHandoverRequestAckTransfer
();
uint8_t
buf
[
1024
];
uint8_t
buf
[
1024
];
cout
<<
list
[
0
].
handoverRequestAcknowledgeTransfer
.
buf
<<
endl
;
//
cout << list[0].handoverRequestAcknowledgeTransfer.buf << endl;
cout
<<
list
[
0
].
handoverRequestAcknowledgeTransfer
.
size
<<
endl
;
//
cout << list[0].handoverRequestAcknowledgeTransfer.size << endl;
memcpy
(
memcpy
(
buf
,
list
[
0
].
handoverRequestAcknowledgeTransfer
.
buf
,
buf
,
list
[
0
].
handoverRequestAcknowledgeTransfer
.
buf
,
list
[
0
].
handoverRequestAcknowledgeTransfer
.
size
);
list
[
0
].
handoverRequestAcknowledgeTransfer
.
size
);
if
(
!
PDUHandoverRequestAckTransfer
->
decodefromHandoverRequestAckTransfer
(
if
(
!
PDUHandoverRequestAckTransfer
->
decodefromHandoverRequestAckTransfer
(
buf
,
list
[
0
].
handoverRequestAcknowledgeTransfer
.
size
))
{
buf
,
list
[
0
].
handoverRequestAcknowledgeTransfer
.
size
))
{
cout
<<
"Decode handoverrequestacktransfer error"
<<
endl
;
Logger
::
ngap
().
error
(
"Decode handoverrequestacktransfer error"
)
;
return
;
return
;
}
}
GtpTunnel_t
*
gtptunnel
=
new
GtpTunnel_t
();
GtpTunnel_t
*
gtptunnel
=
new
GtpTunnel_t
();
if
(
!
PDUHandoverRequestAckTransfer
->
getUpTransportLayerInformation2
(
if
(
!
PDUHandoverRequestAckTransfer
->
getUpTransportLayerInformation2
(
gtptunnel
))
{
gtptunnel
))
{
cout
<<
"Decode GtpTunnel error"
<<
endl
;
Logger
::
ngap
().
error
(
"Decode GtpTunnel error"
)
;
return
;
return
;
}
}
string
n3_ip_address
;
string
n3_ip_address
;
...
@@ -1288,21 +1290,21 @@ void amf_n2::handle_itti_message(itti_handover_request_Ack& itti_msg) {
...
@@ -1288,21 +1290,21 @@ void amf_n2::handle_itti_message(itti_handover_request_Ack& itti_msg) {
long
qosflowidentifiervalue
;
long
qosflowidentifiervalue
;
qosflowidentifiervalue
=
qosflowidentifiervalue
=
(
long
)
QosFlowWithDataForwardinglist
[
0
].
qosFlowIdentifier
;
(
long
)
QosFlowWithDataForwardinglist
[
0
].
qosFlowIdentifier
;
cout
<<
"QFI get is "
<<
qosflowidentifiervalue
<<
endl
;
Logger
::
ngap
().
debug
(
"QFI %lu"
,
qosflowidentifiervalue
)
;
// send HandoverCommandMsg to Source gnb
// send HandoverCommandMsg to Source gnb
std
::
unique_ptr
<
HandoverCommandMsg
>
handovercommand
=
std
::
unique_ptr
<
HandoverCommandMsg
>
handovercommand
=
std
::
make_unique
<
HandoverCommandMsg
>
();
std
::
make_unique
<
HandoverCommandMsg
>
();
handovercommand
->
setMessageType
();
handovercommand
->
setMessageType
();
handovercommand
->
setAmfUeNgapId
(
amf_ue_ngap_id
);
handovercommand
->
setAmfUeNgapId
(
amf_ue_ngap_id
);
handovercommand
->
setRanUeNgapId
(
ran_id_
G
lobal
);
handovercommand
->
setRanUeNgapId
(
ran_id_
g
lobal
);
handovercommand
->
setHandoverType
(
Ngap_HandoverType_intra5gs
);
handovercommand
->
setHandoverType
(
Ngap_HandoverType_intra5gs
);
std
::
shared_ptr
<
nas_context
>
nc
=
std
::
shared_ptr
<
nas_context
>
nc
=
amf_n1_inst
->
amf_ue_id_2_nas_context
(
amf_ue_ngap_id
);
amf_n1_inst
->
amf_ue_id_2_nas_context
(
amf_ue_ngap_id
);
// setPduSessionResourceHandoverList_PDYSessionID_handovercommandtransfer
// setPduSessionResourceHandoverList_PDYSessionID_handovercommandtransfer
std
::
vector
<
PDUSessionResourceHandoverItem_t
>
handover_list
;
std
::
vector
<
PDUSessionResourceHandoverItem_t
>
handover_list
;
PDUSessionResourceHandoverItem_t
item
;
PDUSessionResourceHandoverItem_t
item
=
{}
;
// set pdu id
// set pdu id
item
.
pduSessionId
=
list
[
0
].
pduSessionId
;
item
.
pduSessionId
=
list
[
0
].
pduSessionId
;
// set qosFLowtobeforwardedlist
// set qosFLowtobeforwardedlist
...
@@ -1318,7 +1320,7 @@ void amf_n2::handle_itti_message(itti_handover_request_Ack& itti_msg) {
...
@@ -1318,7 +1320,7 @@ void amf_n2::handle_itti_message(itti_handover_request_Ack& itti_msg) {
PDUSessionResourceHandoverCommandTransfer
*
handovercommandtransfer
=
PDUSessionResourceHandoverCommandTransfer
*
handovercommandtransfer
=
new
PDUSessionResourceHandoverCommandTransfer
();
new
PDUSessionResourceHandoverCommandTransfer
();
handovercommandtransfer
->
setQosFlowToBeForwardedList
(
forward_list
);
handovercommandtransfer
->
setQosFlowToBeForwardedList
(
forward_list
);
GtpTunnel_t
uptlinfo
;
GtpTunnel_t
uptlinfo
=
{}
;
uptlinfo
.
gtp_teid
=
teid
;
uptlinfo
.
gtp_teid
=
teid
;
uptlinfo
.
ip_address
=
n3_ip_address
;
uptlinfo
.
ip_address
=
n3_ip_address
;
handovercommandtransfer
->
setUPTransportLayerInformation
(
uptlinfo
);
handovercommandtransfer
->
setUPTransportLayerInformation
(
uptlinfo
);
...
@@ -1339,21 +1341,21 @@ void amf_n2::handle_itti_message(itti_handover_request_Ack& itti_msg) {
...
@@ -1339,21 +1341,21 @@ void amf_n2::handle_itti_message(itti_handover_request_Ack& itti_msg) {
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
;
std
::
shared_ptr
<
ue_ngap_context
>
unc
;
if
(
!
is_ran_ue_id_2_ue_ngap_context
(
ran_id_
G
lobal
))
{
if
(
!
is_ran_ue_id_2_ue_ngap_context
(
ran_id_
g
lobal
))
{
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)"
,
ran_id_
G
lobal
);
ran_id_
g
lobal
);
unc
=
std
::
shared_ptr
<
ue_ngap_context
>
(
new
ue_ngap_context
());
unc
=
std
::
shared_ptr
<
ue_ngap_context
>
(
new
ue_ngap_context
());
set_ran_ue_ngap_id_2_ue_ngap_context
(
ran_id_
G
lobal
,
unc
);
set_ran_ue_ngap_id_2_ue_ngap_context
(
ran_id_
g
lobal
,
unc
);
unc
.
get
()
->
gnb_assoc_id
=
source_assoc_id
;
unc
.
get
()
->
gnb_assoc_id
=
source_assoc_id
;
}
else
{
}
else
{
unc
=
ran_ue_id_2_ue_ngap_context
(
ran_id_
G
lobal
);
unc
=
ran_ue_id_2_ue_ngap_context
(
ran_id_
g
lobal
);
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 =
// ran_ue_id_2_ue_ngap_context(ran_id_
G
lobal);
// ran_ue_id_2_ue_ngap_context(ran_id_
g
lobal);
// sctp_s_38412.sctp_send_msg(ngc.get()->gnb_assoc_id, 0, &b);
// sctp_s_38412.sctp_send_msg(ngc.get()->gnb_assoc_id, 0, &b);
sctp_s_38412
.
sctp_send_msg
(
unc
.
get
()
->
gnb_assoc_id
,
0
,
&
b
);
sctp_s_38412
.
sctp_send_msg
(
unc
.
get
()
->
gnb_assoc_id
,
0
,
&
b
);
}
}
...
@@ -1380,7 +1382,7 @@ void amf_n2::handle_itti_message(itti_handover_notify& itti_msg) {
...
@@ -1380,7 +1382,7 @@ void amf_n2::handle_itti_message(itti_handover_notify& itti_msg) {
std
::
unique_ptr
<
UEContextReleaseCommandMsg
>
ueContextReleaseCommand
=
std
::
unique_ptr
<
UEContextReleaseCommandMsg
>
ueContextReleaseCommand
=
std
::
make_unique
<
UEContextReleaseCommandMsg
>
();
std
::
make_unique
<
UEContextReleaseCommandMsg
>
();
ueContextReleaseCommand
->
setMessageType
();
ueContextReleaseCommand
->
setMessageType
();
ueContextReleaseCommand
->
setUeNgapIdPair
(
amf_ue_ngap_id
,
ran_id_
G
lobal
);
ueContextReleaseCommand
->
setUeNgapIdPair
(
amf_ue_ngap_id
,
ran_id_
g
lobal
);
ueContextReleaseCommand
->
setCauseRadioNetwork
(
ueContextReleaseCommand
->
setCauseRadioNetwork
(
Ngap_CauseRadioNetwork_successful_handover
);
Ngap_CauseRadioNetwork_successful_handover
);
uint8_t
buffer
[
10240
];
uint8_t
buffer
[
10240
];
...
...
src/itti/msgs/itti_msg_n2.hpp
View file @
7e0d0a7e
...
@@ -218,7 +218,7 @@ class itti_handover_required : public itti_msg_n2 {
...
@@ -218,7 +218,7 @@ class itti_handover_required : public itti_msg_n2 {
itti_handover_required
(
const
task_id_t
origin
,
const
task_id_t
destination
)
itti_handover_required
(
const
task_id_t
origin
,
const
task_id_t
destination
)
:
itti_msg_n2
(
HANDOVER_REQUIRED
,
origin
,
destination
)
{}
:
itti_msg_n2
(
HANDOVER_REQUIRED
,
origin
,
destination
)
{}
itti_handover_required
(
const
itti_handover_required
&
i
)
:
itti_msg_n2
(
i
)
{}
itti_handover_required
(
const
itti_handover_required
&
i
)
:
itti_msg_n2
(
i
)
{}
HandoverRequiredMsg
*
hand
voerRequ
;
HandoverRequiredMsg
*
hand
overReq
;
};
};
class
itti_handover_request_Ack
:
public
itti_msg_n2
{
class
itti_handover_request_Ack
:
public
itti_msg_n2
{
...
...
src/ngap/ngap_app/ngap_message_callback.hpp
View file @
7e0d0a7e
...
@@ -543,7 +543,7 @@ int downlink_ue_associated_nappa_transport(
...
@@ -543,7 +543,7 @@ int downlink_ue_associated_nappa_transport(
int
handover_cancel
(
int
handover_cancel
(
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
(
"Sending
itti handover c
ancel to TASK_AMF_N2"
);
Logger
::
ngap
().
debug
(
"Sending
ITTI Handover C
ancel to TASK_AMF_N2"
);
return
0
;
return
0
;
}
}
...
@@ -551,18 +551,18 @@ int handover_cancel(
...
@@ -551,18 +551,18 @@ int handover_cancel(
int
handover_preparation
(
int
handover_preparation
(
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
(
"Sending
itti handover p
reparation to TASK_AMF_N2"
);
Logger
::
ngap
().
debug
(
"Sending
ITTI Handover P
reparation to TASK_AMF_N2"
);
asn_fprint
(
stderr
,
&
asn_DEF_Ngap_NGAP_PDU
,
message_p
);
asn_fprint
(
stderr
,
&
asn_DEF_Ngap_NGAP_PDU
,
message_p
);
HandoverRequiredMsg
*
handoverrequired
=
new
HandoverRequiredMsg
();
HandoverRequiredMsg
*
handover
_
required
=
new
HandoverRequiredMsg
();
if
(
!
handoverrequired
->
decodefrompdu
(
message_p
))
{
if
(
!
handover
_
required
->
decodefrompdu
(
message_p
))
{
Logger
::
ngap
().
error
(
"
d
ecoding HandoverRequired message error"
);
Logger
::
ngap
().
error
(
"
D
ecoding HandoverRequired message error"
);
return
-
1
;
return
-
1
;
}
}
itti_handover_required
*
itti_handover_requ
=
itti_handover_required
*
itti_handover_requ
=
new
itti_handover_required
(
TASK_NGAP
,
TASK_AMF_N2
);
new
itti_handover_required
(
TASK_NGAP
,
TASK_AMF_N2
);
itti_handover_requ
->
assoc_id
=
assoc_id
;
itti_handover_requ
->
assoc_id
=
assoc_id
;
itti_handover_requ
->
stream
=
stream
;
itti_handover_requ
->
stream
=
stream
;
itti_handover_requ
->
hand
voerRequ
=
handover
required
;
itti_handover_requ
->
hand
overReq
=
handover_
required
;
std
::
shared_ptr
<
itti_handover_required
>
i
=
std
::
shared_ptr
<
itti_handover_required
>
i
=
std
::
shared_ptr
<
itti_handover_required
>
(
itti_handover_requ
);
std
::
shared_ptr
<
itti_handover_required
>
(
itti_handover_requ
);
int
ret
=
itti_inst
->
send_msg
(
i
);
int
ret
=
itti_inst
->
send_msg
(
i
);
...
@@ -578,11 +578,11 @@ int handover_preparation(
...
@@ -578,11 +578,11 @@ int handover_preparation(
int
handover_notification
(
int
handover_notification
(
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
(
"Sending
itti h
andover Notification to TASK_AMF_N2"
);
Logger
::
ngap
().
debug
(
"Sending
ITTI H
andover Notification to TASK_AMF_N2"
);
asn_fprint
(
stderr
,
&
asn_DEF_Ngap_NGAP_PDU
,
message_p
);
asn_fprint
(
stderr
,
&
asn_DEF_Ngap_NGAP_PDU
,
message_p
);
HandoverNotifyMsg
*
handoverNotify
=
new
HandoverNotifyMsg
();
HandoverNotifyMsg
*
handoverNotify
=
new
HandoverNotifyMsg
();
if
(
!
handoverNotify
->
decodefrompdu
(
message_p
))
{
if
(
!
handoverNotify
->
decodefrompdu
(
message_p
))
{
Logger
::
ngap
().
error
(
"
decoding h
andoverNotify message error"
);
Logger
::
ngap
().
error
(
"
Decoding H
andoverNotify message error"
);
return
-
1
;
return
-
1
;
}
}
itti_handover_notify
*
itti_handover_NOTIFY
=
itti_handover_notify
*
itti_handover_NOTIFY
=
...
...
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