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-Simple
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
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
CommunityXG
OpenXG-AMF-Simple
Commits
e3f9f661
Commit
e3f9f661
authored
Sep 04, 2020
by
Tien-Thinh Nguyen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update logs/correct typo
parent
9497248e
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
23 additions
and
18 deletions
+23
-18
src/amf-app/amf_n1.cpp
src/amf-app/amf_n1.cpp
+7
-4
src/amf-app/amf_n11.cpp
src/amf-app/amf_n11.cpp
+1
-1
src/amf-app/amf_n2.cpp
src/amf-app/amf_n2.cpp
+3
-3
src/itti/itti_msg.hpp
src/itti/itti_msg.hpp
+1
-1
src/itti/msgs/itti_msg_n11.hpp
src/itti/msgs/itti_msg_n11.hpp
+1
-1
src/ngap/ngap_app/ngap_message_callback.hpp
src/ngap/ngap_app/ngap_message_callback.hpp
+4
-3
src/sbi/amf_server/api/N1N2MessageCollectionDocumentApi.cpp
src/sbi/amf_server/api/N1N2MessageCollectionDocumentApi.cpp
+6
-5
No files found.
src/amf-app/amf_n1.cpp
View file @
e3f9f661
...
...
@@ -211,6 +211,7 @@ void amf_n1::handle_itti_message(itti_uplink_nas_data_ind &nas_data_ind) {
uint32_t
mac32
=
0
;
if
(
!
nas_message_integrity_protected
(
nc
.
get
()
->
security_ctx
,
NAS_MESSAGE_UPLINK
,
(
uint8_t
*
)
bdata
(
recved_nas_msg
)
+
6
,
blength
(
recved_nas_msg
)
-
6
,
mac32
))
{
//IA0_5G
//TODO:
}
else
{
bool
isMatched
=
false
;
uint8_t
*
buf
=
(
uint8_t
*
)
bdata
(
recved_nas_msg
);
...
...
@@ -219,6 +220,7 @@ void amf_n1::handle_itti_message(itti_uplink_nas_data_ind &nas_data_ind) {
Logger
::
amf_n1
().
debug
(
"Received mac32 (0x%x) from the message"
,
mac32_recv
);
if
(
mac32
==
mac32_recv
)
{
isMatched
=
true
;
Logger
::
amf_n1
().
error
(
"Integrity matched"
);
//nc.get()->security_ctx->ul_count.seq_num ++;
}
if
(
!
isMatched
)
{
...
...
@@ -1113,7 +1115,7 @@ void amf_n1::authentication_response_handle(uint32_t ran_ue_ngap_id, long amf_ue
response_registration_reject_msg
(
_5GMM_CAUSE_ILLEGAL_UE
,
ran_ue_ngap_id
,
amf_ue_ngap_id
);
//cause?
return
;
}
else
{
Logger
::
amf_n1
().
debug
(
"Authenticat
ed successfully
by network!"
);
Logger
::
amf_n1
().
debug
(
"Authenticat
ion successful
by network!"
);
if
(
!
nc
.
get
()
->
is_current_security_available
)
{
if
(
!
start_security_mode_control_procedure
(
nc
))
{
Logger
::
amf_n1
().
error
(
"Start SMC procedure failure"
);
...
...
@@ -1262,7 +1264,7 @@ void amf_n1::security_mode_complete_handle(uint32_t ran_ue_ngap_id, long amf_ue_
std
::
string
mnc
;
uint32_t
tmsi
=
0
;
if
(
!
amf_app_inst
->
generate_5g_guti
(
ran_ue_ngap_id
,
amf_ue_ngap_id
,
mcc
,
mnc
,
tmsi
))
{
Logger
::
amf_n1
().
error
(
"Generate 5G G
TU
I error! exit"
);
Logger
::
amf_n1
().
error
(
"Generate 5G G
UT
I error! exit"
);
//TODO:
return
;
}
...
...
@@ -1291,6 +1293,7 @@ void amf_n1::security_mode_complete_handle(uint32_t ran_ue_ngap_id, long amf_ue_
std
::
string
guti
=
mcc
+
mnc
+
amf_cfg
.
guami
.
regionID
+
amf_cfg
.
guami
.
AmfSetID
+
amf_cfg
.
guami
.
AmfPointer
+
std
::
to_string
(
tmsi
);
Logger
::
amf_n1
().
debug
(
"Allocated GUTI %s"
,
guti
.
c_str
());
//TODO: remove hardcoded values
regAccept
->
set_5GS_Network_Feature_Support
(
0x00
,
0x00
);
regAccept
->
setT3512_Value
(
0x5
,
0x1e
);
uint8_t
buffer
[
1024
]
=
{
0
};
...
...
@@ -1340,7 +1343,7 @@ void amf_n1::security_mode_complete_handle(uint32_t ran_ue_ngap_id, long amf_ue_
itti_msg
->
amf_ue_ngap_id
=
amf_ue_ngap_id
;
itti_msg
->
kgnb
=
kgnb_bs
;
itti_msg
->
nas
=
protectedNas
;
itti_msg
->
is_sr
=
false
;
itti_msg
->
is_sr
=
false
;
//TODO: for Setup Request procedure
std
::
shared_ptr
<
itti_initial_context_setup_request
>
i
=
std
::
shared_ptr
<
itti_initial_context_setup_request
>
(
itti_msg
);
int
ret
=
itti_inst
->
send_msg
(
i
);
if
(
0
!=
ret
)
{
...
...
@@ -1428,7 +1431,7 @@ bool amf_n1::nas_message_integrity_protected(nas_secu_ctx *nsc, uint8_t directio
}
Logger
::
amf_n1
().
debug
(
"Parameters for NIA, count: 0x%x"
,
count
);
stream_cipher
.
bearer
=
0x01
;
//33.501 section 8.1.1
Logger
::
amf_n1
().
debug
(
"Parameters for NIA, bearer: 0x%x"
,
0x01
);
Logger
::
amf_n1
().
debug
(
"Parameters for NIA, bearer: 0x%x"
,
stream_cipher
.
bearer
);
stream_cipher
.
direction
=
direction
;
// "1" for downlink
Logger
::
amf_n1
().
debug
(
"Parameters for NIA, direction: 0x%x"
,
direction
);
stream_cipher
.
message
=
(
uint8_t
*
)
input_nas
;
...
...
src/amf-app/amf_n11.cpp
View file @
e3f9f661
...
...
@@ -105,7 +105,7 @@ void amf_n11_task(void*) {
amf_n11_inst
->
handle_itti_message
(
ref
(
*
m
));
}
break
;
case
NSMF_PDU_SESS
_UPDATE_SM
CTX
:
{
case
NSMF_PDU_SESS
ION_UPDATE_SM_
CTX
:
{
Logger
::
amf_n1
().
info
(
"Receive Nsmf_PDUSessionUpdateSMContext, handling ..."
);
itti_nsmf_pdusession_update_sm_context
*
m
=
dynamic_cast
<
itti_nsmf_pdusession_update_sm_context
*>
(
msg
);
amf_n11_inst
->
handle_itti_message
(
ref
(
*
m
));
...
...
src/amf-app/amf_n2.cpp
View file @
e3f9f661
...
...
@@ -491,7 +491,7 @@ void amf_n2::handle_itti_message(itti_initial_context_setup_request &itti_msg) {
memcpy
(
uecap
,
(
uint8_t
*
)
bdata
(
ueCapability
),
blength
(
ueCapability
));
uecap
[
blength
(
ueCapability
)]
=
'\0'
;
msg
->
setUERadioCapability
(
uecap
,
(
size_t
)
blength
(
ueCapability
));
Logger
::
amf_n2
().
debug
(
"Encoding parameters for
service r
equest"
);
Logger
::
amf_n2
().
debug
(
"Encoding parameters for
Service R
equest"
);
std
::
vector
<
PDUSessionResourceSetupRequestItem_t
>
list
;
PDUSessionResourceSetupRequestItem_t
item
;
item
.
pduSessionId
=
itti_msg
.
pdu_session_id
;
...
...
@@ -543,8 +543,8 @@ void amf_n2::handle_itti_message(itti_pdu_session_resource_setup_request &itti_m
nas_pdu
[
blength
(
itti_msg
.
nas
)]
=
'\0'
;
item
.
pduSessionNAS_PDU
=
nas_pdu
;
item
.
sizeofpduSessionNAS_PDU
=
blength
(
itti_msg
.
nas
);
item
.
s_nssai
.
sst
=
"01"
;
item
.
s_nssai
.
sd
=
""
;
item
.
s_nssai
.
sst
=
"01"
;
//TODO: get from N1N2msgTranferMsg
item
.
s_nssai
.
sd
=
""
;
//TODO: get from N1N2msgTranferMsg
item
.
pduSessionResourceSetupRequestTransfer
.
buf
=
(
uint8_t
*
)
bdata
(
itti_msg
.
n2sm
);
item
.
pduSessionResourceSetupRequestTransfer
.
size
=
blength
(
itti_msg
.
n2sm
);
list
.
push_back
(
item
);
...
...
src/itti/itti_msg.hpp
View file @
e3f9f661
...
...
@@ -73,7 +73,7 @@ typedef enum {
NAS_SIG_ESTAB_REQ
,
//task amf_app
N1N2_MESSAGE_TRANSFER_REQ
,
SMF_SERVICES_CONSUMER
,
NSMF_PDU_SESS
_UPDATE_SM
CTX
,
NSMF_PDU_SESS
ION_UPDATE_SM_
CTX
,
PDU_SESS_RES_SET_RESP
,
TIME_OUT
,
HEALTH_PING
,
...
...
src/itti/msgs/itti_msg_n11.hpp
View file @
e3f9f661
...
...
@@ -46,7 +46,7 @@ public:
class
itti_nsmf_pdusession_update_sm_context
:
public
itti_msg_n11
{
public:
itti_nsmf_pdusession_update_sm_context
(
const
task_id_t
origin
,
const
task_id_t
destination
)
:
itti_msg_n11
(
NSMF_PDU_SESS
_UPDATE_SM
CTX
,
origin
,
destination
){}
itti_nsmf_pdusession_update_sm_context
(
const
task_id_t
origin
,
const
task_id_t
destination
)
:
itti_msg_n11
(
NSMF_PDU_SESS
ION_UPDATE_SM_
CTX
,
origin
,
destination
){}
itti_nsmf_pdusession_update_sm_context
(
const
itti_nsmf_pdusession_update_sm_context
&
i
)
:
itti_msg_n11
(
i
){}
public:
uint8_t
pdu_session_id
;
...
...
src/ngap/ngap_app/ngap_message_callback.hpp
View file @
e3f9f661
...
...
@@ -111,7 +111,6 @@ int ngap_amf_handle_uplink_nas_transport(const sctp_assoc_id_t assoc_id, const s
//------------------------------------------------------------------------------
int
ngap_amf_handle_initial_context_setup_response
(
const
sctp_assoc_id_t
assoc_id
,
const
sctp_stream_id_t
stream
,
struct
Ngap_NGAP_PDU
*
message_p
)
{
Logger
::
ngap
().
debug
(
"Handling Initial Context Setup Response..."
);
Logger
::
ngap
().
debug
(
"Sending ITTI Initial Context Setup Response to TASK_AMF_N11"
);
InitialContextSetupResponseMsg
*
initCtxResp
=
new
InitialContextSetupResponseMsg
();
if
(
!
initCtxResp
->
decodefrompdu
(
message_p
))
{
Logger
::
ngap
().
error
(
"Decoding InitialContextSetupResponse message error"
);
...
...
@@ -119,13 +118,14 @@ int ngap_amf_handle_initial_context_setup_response(const sctp_assoc_id_t assoc_i
}
std
::
vector
<
PDUSessionResourceSetupResponseItem_t
>
list
;
if
(
!
initCtxResp
->
getPduSessionResourceSetupResponseList
(
list
))
{
Logger
::
ngap
().
error
(
"Decod
ing PduSessionResourceSetupResponseMsg get
PduSessionResourceSetupResponseList IE error or this IE is not available"
);
Logger
::
ngap
().
error
(
"Decod
e
PduSessionResourceSetupResponseList IE error or this IE is not available"
);
return
0
;
}
uint8_t
transferIe
[
500
];
memcpy
(
transferIe
,
list
[
0
].
pduSessionResourceSetupResponseTransfer
.
buf
,
list
[
0
].
pduSessionResourceSetupResponseTransfer
.
size
);
bstring
n2sm
=
blk2bstr
(
transferIe
,
list
[
0
].
pduSessionResourceSetupResponseTransfer
.
size
);
Logger
::
ngap
().
debug
(
"Sending ITTI Initial Context Setup Response to TASK_AMF_N11"
);
itti_nsmf_pdusession_update_sm_context
*
itti_msg
=
new
itti_nsmf_pdusession_update_sm_context
(
TASK_NGAP
,
TASK_AMF_N11
);
itti_msg
->
pdu_session_id
=
list
[
0
].
pduSessionId
;
itti_msg
->
n2sm
=
n2sm
;
...
...
@@ -189,7 +189,7 @@ int ngap_amf_handle_ue_context_release_complete(const sctp_assoc_id_t assoc_id,
//------------------------------------------------------------------------------
int
ngap_amf_handle_pdu_session_resource_setup_response
(
const
sctp_assoc_id_t
assoc_id
,
const
sctp_stream_id_t
stream
,
struct
Ngap_NGAP_PDU
*
message_p
)
{
Logger
::
ngap
().
debug
(
"
Sending itti pdu_session_resource_setup_response to TASK_AMF_N11
"
);
Logger
::
ngap
().
debug
(
"
Handle PDU Session Resource Setup Response
"
);
PduSessionResourceSetupResponseMsg
*
pduresp
=
new
PduSessionResourceSetupResponseMsg
();
if
(
!
pduresp
->
decodefrompdu
(
message_p
))
{
Logger
::
ngap
().
error
(
"Decoding PduSessionResourceSetupResponseMsg message error"
);
...
...
@@ -204,6 +204,7 @@ int ngap_amf_handle_pdu_session_resource_setup_response(const sctp_assoc_id_t as
memcpy
(
transferIe
,
list
[
0
].
pduSessionResourceSetupResponseTransfer
.
buf
,
list
[
0
].
pduSessionResourceSetupResponseTransfer
.
size
);
bstring
n2sm
=
blk2bstr
(
transferIe
,
list
[
0
].
pduSessionResourceSetupResponseTransfer
.
size
);
Logger
::
ngap
().
debug
(
"Sending itti pdu_session_resource_setup_response to TASK_AMF_N11"
);
itti_nsmf_pdusession_update_sm_context
*
itti_msg
=
new
itti_nsmf_pdusession_update_sm_context
(
TASK_NGAP
,
TASK_AMF_N11
);
itti_msg
->
pdu_session_id
=
list
[
0
].
pduSessionId
;
itti_msg
->
n2sm
=
n2sm
;
...
...
src/sbi/amf_server/api/N1N2MessageCollectionDocumentApi.cpp
View file @
e3f9f661
...
...
@@ -42,7 +42,7 @@ void N1N2MessageCollectionDocumentApi::setupRoutes() {
void
N1N2MessageCollectionDocumentApi
::
n1_n2_message_transfer_handler
(
const
Pistache
::
Rest
::
Request
&
request
,
Pistache
::
Http
::
ResponseWriter
response
)
{
// Getting the path params
auto
ueContextId
=
request
.
param
(
":ueContextId"
).
as
<
std
::
string
>
();
Logger
::
amf_server
().
debug
(
"Received a N1N2MessageTrasfer request with ue_ctx_id %s
"
,
ueContextId
.
c_str
());
Logger
::
amf_server
().
debug
(
"Received a N1N2MessageTrasfer request with ue_ctx_id %s
"
,
ueContextId
.
c_str
());
// Getting the body param
//simple parser
...
...
@@ -57,16 +57,17 @@ void N1N2MessageCollectionDocumentApi::n1_n2_message_transfer_handler(const Pist
//at least 2 parts for Json data and N1 (+ N2)
if
(
size
<
2
)
{
response
.
send
(
Pistache
::
Http
::
Code
::
Bad_Request
);
Logger
::
amf_server
().
debug
(
"Bad request: should have at least 2 MIME parts"
);
return
;
}
Logger
::
amf_server
().
debug
(
"Request body, part 1:
\n
%s"
,
parts
[
0
].
body
.
c_str
());
Logger
::
amf_server
().
debug
(
"Request body, part 2:
\n
%s"
,
parts
[
1
].
body
.
c_str
());
Logger
::
amf_server
().
debug
(
"Request body, part 2:
\n
%s"
,
parts
[
1
].
body
.
c_str
());
bool
is_ngap
=
false
;
if
(
size
>
2
)
{
is_ngap
=
true
;
Logger
::
amf_server
().
debug
(
"Request body, part 3:
\n
%s"
,
parts
[
2
].
body
.
c_str
());
Logger
::
amf_server
().
debug
(
"Request body, part 3:
\n
%s"
,
parts
[
2
].
body
.
c_str
());
}
N1N2MessageTransferReqData
n1N2MessageTransferReqData
=
{};
...
...
@@ -79,12 +80,12 @@ void N1N2MessageCollectionDocumentApi::n1_n2_message_transfer_handler(const Pist
this
->
n1_n2_message_transfer
(
ueContextId
,
n1N2MessageTransferReqData
,
parts
[
1
].
body
,
parts
[
2
].
body
,
response
);
}
catch
(
nlohmann
::
detail
::
exception
&
e
)
{
//send a 400 error
Logger
::
amf_server
().
error
(
"
response 400 error"
);
Logger
::
amf_server
().
error
(
"
Error %s, send a msg with error code 400 to SMF"
,
e
.
what
());
response
.
send
(
Pistache
::
Http
::
Code
::
Bad_Request
,
e
.
what
());
return
;
}
catch
(
std
::
exception
&
e
)
{
//send a 500 error
Logger
::
amf_server
().
error
(
"
response 500 error"
);
Logger
::
amf_server
().
error
(
"
Error %s, send a msg with error code 500 to SMF"
,
e
.
what
());
response
.
send
(
Pistache
::
Http
::
Code
::
Internal_Server_Error
,
e
.
what
());
return
;
}
...
...
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