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
8bbc18db
Commit
8bbc18db
authored
Nov 24, 2021
by
Tien-Thinh Nguyen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove hardcoded values
parent
4ea2e7b1
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
88 additions
and
126 deletions
+88
-126
src/amf-app/amf_n1.cpp
src/amf-app/amf_n1.cpp
+41
-78
src/amf-app/amf_n1.hpp
src/amf-app/amf_n1.hpp
+1
-3
src/amf-app/amf_n11.cpp
src/amf-app/amf_n11.cpp
+12
-9
src/amf-app/amf_n2.cpp
src/amf-app/amf_n2.cpp
+10
-12
src/contexts/nas_context.cpp
src/contexts/nas_context.cpp
+18
-18
src/nas/ies/S_NSSAI.cpp
src/nas/ies/S_NSSAI.cpp
+6
-6
No files found.
src/amf-app/amf_n1.cpp
View file @
8bbc18db
...
@@ -903,7 +903,7 @@ void amf_n1::service_request_handle(
...
@@ -903,7 +903,7 @@ void amf_n1::service_request_handle(
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
void
amf_n1
::
registration_request_handle
(
void
amf_n1
::
registration_request_handle
(
bool
isNasSig
,
std
::
shared_ptr
<
nas_context
>
nc
,
uint32_t
ran_ue_ngap_id
,
bool
isNasSig
,
std
::
shared_ptr
<
nas_context
>
&
nc
,
uint32_t
ran_ue_ngap_id
,
long
amf_ue_ngap_id
,
std
::
string
snn
,
bstring
reg
)
{
long
amf_ue_ngap_id
,
std
::
string
snn
,
bstring
reg
)
{
// Decode registration request message
// Decode registration request message
std
::
unique_ptr
<
RegistrationRequest
>
regReq
=
std
::
unique_ptr
<
RegistrationRequest
>
regReq
=
...
@@ -1060,7 +1060,7 @@ void amf_n1::registration_request_handle(
...
@@ -1060,7 +1060,7 @@ void amf_n1::registration_request_handle(
if
(
uc
.
get
())
uc
.
reset
();
if
(
uc
.
get
())
uc
.
reset
();
if
(
!
amf_n2_inst
->
is_ran_ue_id_2_ue_ngap_context
(
ran_ue_ngap_id
))
{
if
(
!
amf_n2_inst
->
is_ran_ue_id_2_ue_ngap_context
(
ran_ue_ngap_id
))
{
Logger
::
amf_n
2
().
error
(
Logger
::
amf_n
1
().
error
(
"No UE NGAP context with ran_ue_ngap_id (%d)"
,
ran_ue_ngap_id
);
"No UE NGAP context with ran_ue_ngap_id (%d)"
,
ran_ue_ngap_id
);
return
;
return
;
}
}
...
@@ -1141,11 +1141,14 @@ void amf_n1::registration_request_handle(
...
@@ -1141,11 +1141,14 @@ void amf_n1::registration_request_handle(
nc
.
get
()
->
ueSecurityCapEIA
=
security_cap_eia
;
nc
.
get
()
->
ueSecurityCapEIA
=
security_cap_eia
;
// Get Requested NSSAI (Optional IE), if provided
// Get Requested NSSAI (Optional IE), if provided
std
::
vector
<
SNSSAI_t
>
requestedNssai
=
{};
if
(
!
regReq
->
getRequestedNssai
(
nc
.
get
()
->
requestedNssai
))
{
if
(
!
regReq
->
getRequestedNssai
(
requestedNssai
))
{
Logger
::
amf_n1
().
warn
(
"No Optional IE RequestedNssai available"
);
Logger
::
amf_n1
().
warn
(
"No Optional IE RequestedNssai available"
);
}
else
{
}
nc
.
get
()
->
requestedNssai
=
requestedNssai
;
for
(
auto
r
:
nc
.
get
()
->
requestedNssai
)
{
Logger
::
nas_mm
().
debug
(
"Requested NSSAI SST (0x%x) SD (0x%x) hplmnSST (0x%x) hplmnSD (%d)"
,
r
.
sst
,
r
.
sd
,
r
.
mHplmnSst
,
r
.
mHplmnSd
);
}
}
nc
.
get
()
->
ctx_avaliability_ind
=
true
;
nc
.
get
()
->
ctx_avaliability_ind
=
true
;
...
@@ -1165,20 +1168,21 @@ void amf_n1::registration_request_handle(
...
@@ -1165,20 +1168,21 @@ void amf_n1::registration_request_handle(
registration_request_msg_container
->
decodefrombuffer
(
registration_request_msg_container
->
decodefrombuffer
(
nullptr
,
(
uint8_t
*
)
bdata
(
nas_msg
),
blength
(
nas_msg
));
nullptr
,
(
uint8_t
*
)
bdata
(
nas_msg
),
blength
(
nas_msg
));
if
(
!
regReq
->
getRequestedNssai
(
requestedNssai
))
{
if
(
!
registration_request_msg_container
->
getRequestedNssai
(
Logger
::
amf_n1
().
warn
(
"No Optional IE RequestedNssai available"
);
nc
.
get
()
->
requestedNssai
))
{
Logger
::
amf_n1
().
warn
(
"No Optional IE RequestedNssai available in NAS Container"
);
}
else
{
}
else
{
nc
.
get
()
->
requestedNssai
=
requestedNssai
;
for
(
auto
s
:
nc
.
get
()
->
requestedNssai
)
{
Logger
::
amf_n1
().
debug
(
"Requested NSSAI inside the NAS container: SST (0x%x) SD (0x%x) "
"hplmnSST (0x%x) hplmnSD "
"(%d)"
,
s
.
sst
,
s
.
sd
,
s
.
mHplmnSst
,
s
.
mHplmnSd
);
}
}
}
}
}
for
(
auto
s
:
nc
.
get
()
->
requestedNssai
)
{
Logger
::
amf_n1
().
debug
(
"Requested NSSAI SST (0x%x) SD (0x%x) hplmnSST (0x%x) hplmnSD "
"(%d)"
,
s
.
sst
,
s
.
sd
,
s
.
mHplmnSst
,
s
.
mHplmnSd
);
}
// Store NAS information into nas_context
// Store NAS information into nas_context
// Run the corresponding registration procedure
// Run the corresponding registration procedure
switch
(
reg_type
)
{
switch
(
reg_type
)
{
...
@@ -2203,15 +2207,15 @@ void amf_n1::security_mode_complete_handle(
...
@@ -2203,15 +2207,15 @@ void amf_n1::security_mode_complete_handle(
bdestroy
(
nas_msg_container
);
// free buffer
bdestroy
(
nas_msg_container
);
// free buffer
// Get Requested NSSAI (Optional IE), if provided
// Get Requested NSSAI (Optional IE), if provided
std
::
vector
<
SNSSAI_t
>
requested_nssai
=
{};
if
(
registration_request
->
getRequestedNssai
(
nc
.
get
()
->
requestedNssai
))
{
if
(
registration_request
->
getRequestedNssai
(
requested_nssai
))
{
nc
.
get
()
->
requestedNssai
=
requested_nssai
;
for
(
auto
s
:
nc
.
get
()
->
requestedNssai
)
{
for
(
auto
s
:
nc
.
get
()
->
requestedNssai
)
{
Logger
::
amf_n1
().
debug
(
Logger
::
amf_n1
().
debug
(
"Requested NSSAI SST (0x%x) SD (0x%x) hplmnSST (0x%x) hplmnSD "
"Requested NSSAI SST (0x%x) SD (0x%x) hplmnSST (0x%x) hplmnSD "
"(%d)"
,
"(%d)"
,
s
.
sst
,
s
.
sd
,
s
.
mHplmnSst
,
s
.
mHplmnSd
);
s
.
sst
,
s
.
sd
,
s
.
mHplmnSst
,
s
.
mHplmnSd
);
}
}
}
else
{
Logger
::
amf_n1
().
debug
(
"No Optional IE RequestedNssai available"
);
}
}
}
}
}
}
...
@@ -2671,7 +2675,7 @@ void amf_n1::ue_initiate_de_registration_handle(
...
@@ -2671,7 +2675,7 @@ void amf_n1::ue_initiate_de_registration_handle(
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
void
amf_n1
::
ul_nas_transport_handle
(
void
amf_n1
::
ul_nas_transport_handle
(
uint32_t
ran_ue_ngap_id
,
long
amf_ue_ngap_id
,
bstring
nas
)
{
uint32_t
ran_ue_ngap_id
,
long
amf_ue_ngap_id
,
bstring
nas
,
plmn_t
plmn
)
{
// Decode UL_NAS_TRANSPORT message
// Decode UL_NAS_TRANSPORT message
Logger
::
amf_n1
().
debug
(
"Handling UL NAS Transport"
);
Logger
::
amf_n1
().
debug
(
"Handling UL NAS Transport"
);
ULNASTransport
*
ulNas
=
new
ULNASTransport
();
ULNASTransport
*
ulNas
=
new
ULNASTransport
();
...
@@ -2679,75 +2683,34 @@ void amf_n1::ul_nas_transport_handle(
...
@@ -2679,75 +2683,34 @@ void amf_n1::ul_nas_transport_handle(
uint8_t
payload_type
=
ulNas
->
getPayloadContainerType
();
uint8_t
payload_type
=
ulNas
->
getPayloadContainerType
();
uint8_t
pdu_session_id
=
ulNas
->
getPduSessionId
();
uint8_t
pdu_session_id
=
ulNas
->
getPduSessionId
();
uint8_t
request_type
=
ulNas
->
getRequestType
();
uint8_t
request_type
=
ulNas
->
getRequestType
();
// SNSSAI
// SNSSAI
SNSSAI_t
snssai
=
{};
SNSSAI_t
snssai
=
{};
if
(
!
ulNas
->
getSnssai
(
snssai
))
{
// If no SNSSAI in this message, use the one
if
(
!
ulNas
->
getSnssai
(
snssai
))
{
// If no SNSSAI in this message, use the one
// in Registration Request
// in Registration Request
// Only use the first one if there's multiple requested NSSAI
Logger
::
amf_n1
().
debug
(
"No Requested NSSAI available in ULNASTransport, use NSSAI from "
"Requested NSSAI!"
);
std
::
shared_ptr
<
nas_context
>
nc
=
{};
std
::
shared_ptr
<
nas_context
>
nc
=
{};
if
(
amf_n1_inst
->
is_amf_ue_id_2_nas_context
(
amf_ue_ngap_id
))
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
);
nc
=
amf_n1_inst
->
amf_ue_id_2_nas_context
(
amf_ue_ngap_id
);
else
{
else
{
Logger
::
amf_n
2
().
warn
(
Logger
::
amf_n
1
().
warn
(
"No existed nas_context with amf_ue_ngap_id(0x%x)"
,
amf_ue_ngap_id
);
"No existed nas_context with amf_ue_ngap_id(0x%x)"
,
amf_ue_ngap_id
);
return
;
}
}
// TODO: Only use the first one for now if there's multiple requested NSSAI
if
(
nc
.
get
()
->
requestedNssai
.
size
()
>
0
)
if
(
nc
.
get
()
->
requestedNssai
.
size
()
>
0
)
snssai
=
nc
.
get
()
->
requestedNssai
[
0
];
snssai
=
nc
.
get
()
->
requestedNssai
[
0
];
}
}
Logger
::
nas_mm
().
debug
(
Logger
::
amf_n1
().
debug
(
"S_NSSAI SST (0x%x) SD (0x%x) hplmnSST (0x%x) hplmnSD (0x%x)"
,
snssai
.
sst
,
"S_NSSAI for this PDU Session SST (0x%x) SD (0x%x) hplmnSST (0x%x) "
snssai
.
sd
,
snssai
.
mHplmnSst
,
snssai
.
mHplmnSd
);
"hplmnSD (0x%x)"
,
snssai
.
sst
,
snssai
.
sd
,
snssai
.
mHplmnSst
,
snssai
.
mHplmnSd
);
bstring
dnn
=
bfromcstr
(
"default"
);
bstring
sm_msg
;
if
(
ulNas
->
getDnn
(
dnn
))
{
}
else
{
dnn
=
bfromcstr
(
"default"
);
}
comUt
::
print_buffer
(
"amf_n1"
,
"Decoded DNN bitstring"
,
(
uint8_t
*
)
bdata
(
dnn
),
blength
(
dnn
));
switch
(
payload_type
)
{
case
N1_SM_INFORMATION
:
{
if
(
!
ulNas
->
getPayloadContainer
(
sm_msg
))
{
Logger
::
amf_n1
().
error
(
"Cannot decode Payload Container"
);
return
;
}
itti_nsmf_pdusession_create_sm_context
*
itti_msg
=
new
itti_nsmf_pdusession_create_sm_context
(
TASK_AMF_N1
,
TASK_AMF_N11
);
itti_msg
->
ran_ue_ngap_id
=
ran_ue_ngap_id
;
itti_msg
->
amf_ue_ngap_id
=
amf_ue_ngap_id
;
itti_msg
->
req_type
=
request_type
;
itti_msg
->
pdu_sess_id
=
pdu_session_id
;
itti_msg
->
dnn
=
dnn
;
itti_msg
->
sm_msg
=
sm_msg
;
itti_msg
->
snssai
.
sST
=
snssai
.
sst
;
itti_msg
->
snssai
.
sD
=
std
::
to_string
(
snssai
.
sd
);
std
::
shared_ptr
<
itti_nsmf_pdusession_create_sm_context
>
i
=
std
::
shared_ptr
<
itti_nsmf_pdusession_create_sm_context
>
(
itti_msg
);
int
ret
=
itti_inst
->
send_msg
(
i
);
if
(
0
!=
ret
)
{
Logger
::
amf_n1
().
error
(
"Could not send ITTI message %s to task TASK_AMF_N11"
,
i
->
get_msg_name
());
}
}
break
;
}
}
//------------------------------------------------------------------------------
void
amf_n1
::
ul_nas_transport_handle
(
uint32_t
ran_ue_ngap_id
,
long
amf_ue_ngap_id
,
bstring
nas
,
plmn_t
plmn
)
{
// Decode UL_NAS_TRANSPORT message
Logger
::
amf_n1
().
debug
(
"Handling UL NAS Transport"
);
ULNASTransport
*
ulNas
=
new
ULNASTransport
();
ulNas
->
decodefrombuffer
(
NULL
,
(
uint8_t
*
)
bdata
(
nas
),
blength
(
nas
));
uint8_t
payload_type
=
ulNas
->
getPayloadContainerType
();
uint8_t
pdu_session_id
=
ulNas
->
getPduSessionId
();
uint8_t
request_type
=
ulNas
->
getRequestType
();
SNSSAI_t
snssai
=
{};
ulNas
->
getSnssai
(
snssai
);
bstring
dnn
=
bfromcstr
(
"default"
);
bstring
dnn
=
bfromcstr
(
"default"
);
bstring
sm_msg
;
bstring
sm_msg
;
if
(
ulNas
->
getDnn
(
dnn
))
{
if
(
ulNas
->
getDnn
(
dnn
))
{
...
@@ -2755,7 +2718,7 @@ void amf_n1::ul_nas_transport_handle(
...
@@ -2755,7 +2718,7 @@ void amf_n1::ul_nas_transport_handle(
dnn
=
bfromcstr
(
"default"
);
dnn
=
bfromcstr
(
"default"
);
}
}
comUt
::
print_buffer
(
comUt
::
print_buffer
(
"amf_n1"
,
"Decoded DNN
bits
tring"
,
(
uint8_t
*
)
bdata
(
dnn
),
blength
(
dnn
));
"amf_n1"
,
"Decoded DNN
Bit S
tring"
,
(
uint8_t
*
)
bdata
(
dnn
),
blength
(
dnn
));
switch
(
payload_type
)
{
switch
(
payload_type
)
{
case
N1_SM_INFORMATION
:
{
case
N1_SM_INFORMATION
:
{
if
(
!
ulNas
->
getPayloadContainer
(
sm_msg
))
{
if
(
!
ulNas
->
getPayloadContainer
(
sm_msg
))
{
...
@@ -3246,7 +3209,7 @@ void amf_n1::initialize_registration_accept(
...
@@ -3246,7 +3209,7 @@ void amf_n1::initialize_registration_accept(
return
;
return
;
}
}
nssai
.
push_back
(
snssai
);
nssai
.
push_back
(
snssai
);
// Check with the requested NSSAI from UE
//
TODO:
Check with the requested NSSAI from UE
/* for (auto rn : nc.get()->requestedNssai) {
/* for (auto rn : nc.get()->requestedNssai) {
if ((rn.sst == snssai.sst) and (rn.sd == snssai.sd)) {
if ((rn.sst == snssai.sst) and (rn.sd == snssai.sd)) {
nssai.push_back(snssai);
nssai.push_back(snssai);
...
@@ -3316,7 +3279,7 @@ void amf_n1::mobile_reachable_timer_timeout(
...
@@ -3316,7 +3279,7 @@ void amf_n1::mobile_reachable_timer_timeout(
if
(
amf_n1_inst
->
is_amf_ue_id_2_nas_context
(
amf_ue_ngap_id
))
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
);
nc
=
amf_n1_inst
->
amf_ue_id_2_nas_context
(
amf_ue_ngap_id
);
else
{
else
{
Logger
::
amf_n
2
().
warn
(
Logger
::
amf_n
1
().
warn
(
"No existed nas_context with amf_ue_ngap_id(0x%x)"
,
amf_ue_ngap_id
);
"No existed nas_context with amf_ue_ngap_id(0x%x)"
,
amf_ue_ngap_id
);
}
}
set_mobile_reachable_timer_timeout
(
nc
,
true
);
set_mobile_reachable_timer_timeout
(
nc
,
true
);
...
@@ -3338,7 +3301,7 @@ void amf_n1::implicit_deregistration_timer_timeout(
...
@@ -3338,7 +3301,7 @@ void amf_n1::implicit_deregistration_timer_timeout(
if
(
amf_n1_inst
->
is_amf_ue_id_2_nas_context
(
amf_ue_ngap_id
))
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
);
nc
=
amf_n1_inst
->
amf_ue_id_2_nas_context
(
amf_ue_ngap_id
);
else
{
else
{
Logger
::
amf_n
2
().
warn
(
Logger
::
amf_n
1
().
warn
(
"No existed nas_context with amf_ue_ngap_id(0x%x)"
,
amf_ue_ngap_id
);
"No existed nas_context with amf_ue_ngap_id(0x%x)"
,
amf_ue_ngap_id
);
}
}
// Implicitly de-register UE
// Implicitly de-register UE
...
...
src/amf-app/amf_n1.hpp
View file @
8bbc18db
...
@@ -213,7 +213,7 @@ class amf_n1 {
...
@@ -213,7 +213,7 @@ class amf_n1 {
void
ue_initiate_de_registration_handle
(
void
ue_initiate_de_registration_handle
(
uint32_t
ran_ue_ngap_id
,
long
amf_ue_ngap_id
,
bstring
nas
);
uint32_t
ran_ue_ngap_id
,
long
amf_ue_ngap_id
,
bstring
nas
);
void
registration_request_handle
(
void
registration_request_handle
(
bool
isNasSig
,
std
::
shared_ptr
<
nas_context
>
nc
,
uint32_t
ran_ue_ngap_id
,
bool
isNasSig
,
std
::
shared_ptr
<
nas_context
>
&
nc
,
uint32_t
ran_ue_ngap_id
,
long
amf_ue_ngap_id
,
std
::
string
snn
,
bstring
reg
);
long
amf_ue_ngap_id
,
std
::
string
snn
,
bstring
reg
);
void
authentication_response_handle
(
void
authentication_response_handle
(
uint32_t
ran_ue_ngap_id
,
long
amf_ue_ngap_id
,
bstring
plain_msg
);
uint32_t
ran_ue_ngap_id
,
long
amf_ue_ngap_id
,
bstring
plain_msg
);
...
@@ -223,8 +223,6 @@ class amf_n1 {
...
@@ -223,8 +223,6 @@ class amf_n1 {
uint32_t
ran_ue_ngap_id
,
long
amf_ue_ngap_id
,
bstring
nas_msg
);
uint32_t
ran_ue_ngap_id
,
long
amf_ue_ngap_id
,
bstring
nas_msg
);
void
security_mode_reject_handle
(
void
security_mode_reject_handle
(
uint32_t
ran_ue_ngap_id
,
long
amf_ue_ngap_id
,
bstring
nas_msg
);
uint32_t
ran_ue_ngap_id
,
long
amf_ue_ngap_id
,
bstring
nas_msg
);
void
ul_nas_transport_handle
(
uint32_t
ran_ue_ngap_id
,
long
amf_ue_ngap_id
,
bstring
nas
);
void
ul_nas_transport_handle
(
void
ul_nas_transport_handle
(
uint32_t
ran_ue_ngap_id
,
long
amf_ue_ngap_id
,
bstring
nas
,
plmn_t
plmn
);
uint32_t
ran_ue_ngap_id
,
long
amf_ue_ngap_id
,
bstring
nas
,
plmn_t
plmn
);
void
registration_complete_handle
(
void
registration_complete_handle
(
...
...
src/amf-app/amf_n11.cpp
View file @
8bbc18db
...
@@ -287,13 +287,13 @@ void amf_n11::handle_itti_message(itti_nsmf_pdusession_create_sm_context& smf) {
...
@@ -287,13 +287,13 @@ void amf_n11::handle_itti_message(itti_nsmf_pdusession_create_sm_context& smf) {
}
}
uc
=
amf_app_inst
->
ran_amf_id_2_ue_context
(
ue_context_key
);
uc
=
amf_app_inst
->
ran_amf_id_2_ue_context
(
ue_context_key
);
if
(
!
uc
.
get
())
{
if
(
!
uc
.
get
())
{
Logger
::
amf_n11
().
error
(
Logger
::
amf_n11
().
error
(
"No UE context for %s exit"
,
ue_context_key
.
c_str
());
"No UE context for %s exit"
,
ue_context_key
.
c_str
());
return
;
return
;
}
}
// Create PDU Session Context if not available
std
::
shared_ptr
<
pdu_session_context
>
psc
=
{};
std
::
shared_ptr
<
pdu_session_context
>
psc
=
{};
if
(
!
uc
.
get
()
->
find_pdu_session_context
(
smf
.
pdu_sess_id
,
psc
))
{
if
(
!
uc
.
get
()
->
find_pdu_session_context
(
smf
.
pdu_sess_id
,
psc
))
{
psc
=
std
::
shared_ptr
<
pdu_session_context
>
(
new
pdu_session_context
());
psc
=
std
::
shared_ptr
<
pdu_session_context
>
(
new
pdu_session_context
());
...
@@ -306,6 +306,7 @@ void amf_n11::handle_itti_message(itti_nsmf_pdusession_create_sm_context& smf) {
...
@@ -306,6 +306,7 @@ void amf_n11::handle_itti_message(itti_nsmf_pdusession_create_sm_context& smf) {
return
;
return
;
}
}
// Store corresponding info in PDU Session Context
psc
.
get
()
->
amf_ue_ngap_id
=
nc
.
get
()
->
amf_ue_ngap_id
;
psc
.
get
()
->
amf_ue_ngap_id
=
nc
.
get
()
->
amf_ue_ngap_id
;
psc
.
get
()
->
ran_ue_ngap_id
=
nc
.
get
()
->
ran_ue_ngap_id
;
psc
.
get
()
->
ran_ue_ngap_id
=
nc
.
get
()
->
ran_ue_ngap_id
;
psc
.
get
()
->
req_type
=
smf
.
req_type
;
psc
.
get
()
->
req_type
=
smf
.
req_type
;
...
@@ -442,14 +443,13 @@ void amf_n11::handle_pdu_session_initial_request(
...
@@ -442,14 +443,13 @@ void amf_n11::handle_pdu_session_initial_request(
std
::
string
remote_uri
=
std
::
string
remote_uri
=
smf_addr
+
"/nsmf-pdusession/"
+
smf_api_version
+
"/sm-contexts"
;
smf_addr
+
"/nsmf-pdusession/"
+
smf_api_version
+
"/sm-contexts"
;
nlohmann
::
json
pdu_session_establishment_request
;
nlohmann
::
json
pdu_session_establishment_request
;
pdu_session_establishment_request
[
"supi"
]
=
supi
.
c_str
();
pdu_session_establishment_request
[
"supi"
]
=
supi
.
c_str
();
pdu_session_establishment_request
[
"pei"
]
=
"imei-200000000000001"
;
pdu_session_establishment_request
[
"pei"
]
=
"imei-200000000000001"
;
pdu_session_establishment_request
[
"gpsi"
]
=
"msisdn-200000000001"
;
pdu_session_establishment_request
[
"gpsi"
]
=
"msisdn-200000000001"
;
pdu_session_establishment_request
[
"dnn"
]
=
dnn
.
c_str
();
pdu_session_establishment_request
[
"dnn"
]
=
dnn
.
c_str
();
pdu_session_establishment_request
[
"sNssai"
][
"sst"
]
=
pdu_session_establishment_request
[
"sNssai"
][
"sst"
]
=
psc
.
get
()
->
snssai
.
sST
;
1
;
// psc.get()->snssai.sST;
pdu_session_establishment_request
[
"sNssai"
][
"sd"
]
=
pdu_session_establishment_request
[
"sNssai"
][
"sd"
]
=
"1"
;
//
psc.get()->snssai.sD.c_str();
psc
.
get
()
->
snssai
.
sD
.
c_str
();
pdu_session_establishment_request
[
"pduSessionId"
]
=
psc
.
get
()
->
pdu_session_id
;
pdu_session_establishment_request
[
"pduSessionId"
]
=
psc
.
get
()
->
pdu_session_id
;
pdu_session_establishment_request
[
"requestType"
]
=
pdu_session_establishment_request
[
"requestType"
]
=
"INITIAL_REQUEST"
;
// TODO: from SM_MSG
"INITIAL_REQUEST"
;
// TODO: from SM_MSG
...
@@ -471,7 +471,10 @@ void amf_n11::handle_pdu_session_initial_request(
...
@@ -471,7 +471,10 @@ void amf_n11::handle_pdu_session_initial_request(
[
"contentId"
]
=
"n1SmMsg"
;
[
"contentId"
]
=
"n1SmMsg"
;
std
::
string
json_part
=
pdu_session_establishment_request
.
dump
();
std
::
string
json_part
=
pdu_session_establishment_request
.
dump
();
std
::
string
n1SmMsg
=
{};
Logger
::
amf_n11
().
debug
(
"Message body %s"
,
json_part
.
c_str
());
std
::
string
n1SmMsg
=
{};
octet_stream_2_hex_stream
((
uint8_t
*
)
bdata
(
sm_msg
),
blength
(
sm_msg
),
n1SmMsg
);
octet_stream_2_hex_stream
((
uint8_t
*
)
bdata
(
sm_msg
),
blength
(
sm_msg
),
n1SmMsg
);
uint8_t
http_version
=
1
;
uint8_t
http_version
=
1
;
...
...
src/amf-app/amf_n2.cpp
View file @
8bbc18db
...
@@ -922,6 +922,8 @@ void amf_n2::handle_itti_message(itti_initial_context_setup_request& itti_msg) {
...
@@ -922,6 +922,8 @@ void amf_n2::handle_itti_message(itti_initial_context_setup_request& itti_msg) {
}
}
string
supi
=
"imsi-"
+
nc
.
get
()
->
imsi
;
string
supi
=
"imsi-"
+
nc
.
get
()
->
imsi
;
Logger
::
amf_n2
().
debug
(
"SUPI (%s)"
,
supi
.
c_str
());
Logger
::
amf_n2
().
debug
(
"SUPI (%s)"
,
supi
.
c_str
());
// Get S_NSSAI from PDU Session Context
std
::
shared_ptr
<
pdu_session_context
>
psc
=
{};
std
::
shared_ptr
<
pdu_session_context
>
psc
=
{};
if
(
!
amf_app_inst
->
find_pdu_session_context
(
if
(
!
amf_app_inst
->
find_pdu_session_context
(
...
@@ -929,14 +931,12 @@ void amf_n2::handle_itti_message(itti_initial_context_setup_request& itti_msg) {
...
@@ -929,14 +931,12 @@ void amf_n2::handle_itti_message(itti_initial_context_setup_request& itti_msg) {
Logger
::
amf_n2
().
warn
(
Logger
::
amf_n2
().
warn
(
"Cannot get pdu_session_context with SUPI (%s)"
,
supi
.
c_str
());
"Cannot get pdu_session_context with SUPI (%s)"
,
supi
.
c_str
());
item
.
s_nssai
.
sst
=
"01"
;
item
.
s_nssai
.
sst
=
"01"
;
item
.
s_nssai
.
sd
=
"
N
one"
;
item
.
s_nssai
.
sd
=
"
n
one"
;
}
else
{
}
else
{
item
.
s_nssai
.
sst
=
std
::
to_string
(
psc
.
get
()
->
snssai
.
sST
);
item
.
s_nssai
.
sst
=
std
::
to_string
(
psc
.
get
()
->
snssai
.
sST
);
item
.
s_nssai
.
sd
=
psc
.
get
()
->
snssai
.
sD
;
item
.
s_nssai
.
sd
=
psc
.
get
()
->
snssai
.
sD
;
}
}
item
.
s_nssai
.
sst
=
"1"
;
item
.
s_nssai
.
sd
=
"000001"
;
Logger
::
amf_n2
().
debug
(
Logger
::
amf_n2
().
debug
(
"S_NSSAI (SST, SD) %s, %s"
,
item
.
s_nssai
.
sst
.
c_str
(),
"S_NSSAI (SST, SD) %s, %s"
,
item
.
s_nssai
.
sst
.
c_str
(),
item
.
s_nssai
.
sd
.
c_str
());
item
.
s_nssai
.
sd
.
c_str
());
...
@@ -1030,8 +1030,9 @@ void amf_n2::handle_itti_message(
...
@@ -1030,8 +1030,9 @@ void amf_n2::handle_itti_message(
}
}
string
supi
=
"imsi-"
+
nc
.
get
()
->
imsi
;
string
supi
=
"imsi-"
+
nc
.
get
()
->
imsi
;
Logger
::
amf_n2
().
debug
(
"SUPI (%s)"
,
supi
.
c_str
());
Logger
::
amf_n2
().
debug
(
"SUPI (%s)"
,
supi
.
c_str
());
std
::
shared_ptr
<
pdu_session_context
>
psc
=
{};
// Get SNSSAI info from PDU Session Context
std
::
shared_ptr
<
pdu_session_context
>
psc
=
{};
if
(
!
amf_app_inst
->
find_pdu_session_context
(
if
(
!
amf_app_inst
->
find_pdu_session_context
(
supi
,
itti_msg
.
pdu_session_id
,
psc
))
{
supi
,
itti_msg
.
pdu_session_id
,
psc
))
{
Logger
::
amf_n2
().
warn
(
Logger
::
amf_n2
().
warn
(
...
@@ -1039,16 +1040,13 @@ void amf_n2::handle_itti_message(
...
@@ -1039,16 +1040,13 @@ void amf_n2::handle_itti_message(
item
.
s_nssai
.
sst
=
"01"
;
// TODO: get from N1N2msgTranferMsg
item
.
s_nssai
.
sst
=
"01"
;
// TODO: get from N1N2msgTranferMsg
item
.
s_nssai
.
sd
=
"none"
;
// TODO: get from N1N2msgTranferMsg
item
.
s_nssai
.
sd
=
"none"
;
// TODO: get from N1N2msgTranferMsg
}
else
{
}
else
{
// USE HARDCODED for NOW
item
.
s_nssai
.
sst
=
std
::
to_string
(
psc
.
get
()
->
snssai
.
sST
);
item
.
s_nssai
.
sst
=
"01"
;
// std::to_string(psc.get()->snssai.sST);
item
.
s_nssai
.
sd
=
psc
.
get
()
->
snssai
.
sD
;
item
.
s_nssai
.
sd
=
"000001"
;
// psc.get()->snssai.sD;
}
}
item
.
s_nssai
.
sst
=
"01"
;
// std::to_string(psc.get()->snssai.sST);
Logger
::
amf_n2
().
debug
(
item
.
s_nssai
.
sd
=
"000001"
;
// psc.get()->snssai.sD;
"S_NSSAI (SST, SD) %s, %s"
,
item
.
s_nssai
.
sst
.
c_str
(),
item
.
s_nssai
.
sd
.
c_str
());
// item.s_nssai.sst = std::to_string(psc.get()->snssai.sST);
// item.s_nssai.sd = psc.get()->snssai.sD;
item
.
pduSessionResourceSetupRequestTransfer
.
buf
=
item
.
pduSessionResourceSetupRequestTransfer
.
buf
=
(
uint8_t
*
)
bdata
(
itti_msg
.
n2sm
);
(
uint8_t
*
)
bdata
(
itti_msg
.
n2sm
);
...
...
src/contexts/nas_context.cpp
View file @
8bbc18db
...
@@ -30,24 +30,24 @@
...
@@ -30,24 +30,24 @@
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
nas_context
::
nas_context
()
:
_vector
(),
_5g_he_av
(),
_5g_av
(),
kamf
()
{
nas_context
::
nas_context
()
:
_vector
(),
_5g_he_av
(),
_5g_av
(),
kamf
()
{
security_ctx
=
nullptr
;
security_ctx
=
nullptr
;
is_imsi_present
=
false
;
is_imsi_present
=
false
;
is_stacs_available
=
false
;
is_stacs_available
=
false
;
is_auth_vectors_present
=
false
;
is_auth_vectors_present
=
false
;
auts
=
nullptr
;
auts
=
nullptr
;
ctx_avaliability_ind
=
false
;
ctx_avaliability_ind
=
false
;
amf_ue_ngap_id
=
0
;
amf_ue_ngap_id
=
0
;
ran_ue_ngap_id
=
0
;
ran_ue_ngap_id
=
0
;
_5gmm_state
=
{};
_5gmm_state
=
{};
registration_type
=
0
;
registration_type
=
0
;
follow_on_req_pending_ind
=
false
;
follow_on_req_pending_ind
=
false
;
ngKsi
=
0
;
ngKsi
=
0
;
mmCapability
=
0
;
mmCapability
=
0
;
ueSecurityCapEnc
=
0
;
ueSecurityCapEnc
=
0
;
ueSecurityCapInt
=
0
;
ueSecurityCapInt
=
0
;
ueSecurityCapEEA
=
0
;
ueSecurityCapEEA
=
0
;
ueSecurityCapEIA
=
0
;
ueSecurityCapEIA
=
0
;
requestedNssai
=
{};
//
requestedNssai = {};
is_specific_procedure_for_registration_running
=
false
;
is_specific_procedure_for_registration_running
=
false
;
is_specific_procedure_for_deregistration_running
=
false
;
is_specific_procedure_for_deregistration_running
=
false
;
is_specific_procedure_for_eCell_inactivity_running
=
false
;
is_specific_procedure_for_eCell_inactivity_running
=
false
;
...
...
src/nas/ies/S_NSSAI.cpp
View file @
8bbc18db
...
@@ -131,9 +131,9 @@ int S_NSSAI::decodefrombuffer(uint8_t* buf, int len, bool is_option) {
...
@@ -131,9 +131,9 @@ int S_NSSAI::decodefrombuffer(uint8_t* buf, int len, bool is_option) {
case
1
:
{
case
1
:
{
a
.
sst
=
*
(
buf
+
decoded_size
);
a
.
sst
=
*
(
buf
+
decoded_size
);
decoded_size
++
;
decoded_size
++
;
a
.
sd
=
-
1
;
a
.
sd
=
0
;
a
.
mHplmnSst
=
-
1
;
a
.
mHplmnSst
=
0
;
a
.
mHplmnSd
=
-
1
;
a
.
mHplmnSd
=
0
;
}
break
;
}
break
;
case
4
:
{
case
4
:
{
a
.
sst
=
*
(
buf
+
decoded_size
);
a
.
sst
=
*
(
buf
+
decoded_size
);
...
@@ -147,8 +147,8 @@ int S_NSSAI::decodefrombuffer(uint8_t* buf, int len, bool is_option) {
...
@@ -147,8 +147,8 @@ int S_NSSAI::decodefrombuffer(uint8_t* buf, int len, bool is_option) {
a
.
sd
|=
*
(
buf
+
decoded_size
);
a
.
sd
|=
*
(
buf
+
decoded_size
);
a
.
sd
&=
0x00ffffff
;
a
.
sd
&=
0x00ffffff
;
decoded_size
++
;
decoded_size
++
;
a
.
mHplmnSst
=
-
1
;
a
.
mHplmnSst
=
0
;
a
.
mHplmnSd
=
-
1
;
a
.
mHplmnSd
=
0
;
}
break
;
}
break
;
case
5
:
{
case
5
:
{
a
.
sst
=
*
(
buf
+
decoded_size
);
a
.
sst
=
*
(
buf
+
decoded_size
);
...
@@ -164,7 +164,7 @@ int S_NSSAI::decodefrombuffer(uint8_t* buf, int len, bool is_option) {
...
@@ -164,7 +164,7 @@ int S_NSSAI::decodefrombuffer(uint8_t* buf, int len, bool is_option) {
decoded_size
++
;
decoded_size
++
;
a
.
mHplmnSst
=
*
(
buf
+
decoded_size
);
a
.
mHplmnSst
=
*
(
buf
+
decoded_size
);
decoded_size
++
;
decoded_size
++
;
a
.
mHplmnSd
=
-
1
;
a
.
mHplmnSd
=
0
;
}
break
;
}
break
;
case
8
:
{
case
8
:
{
a
.
sst
=
*
(
buf
+
decoded_size
);
a
.
sst
=
*
(
buf
+
decoded_size
);
...
...
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