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
5a1c9b65
Commit
5a1c9b65
authored
Dec 07, 2022
by
Tien Thinh NGUYEN
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update ULNasTransport
parent
dfd73d84
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
121 additions
and
65 deletions
+121
-65
src/amf-app/amf_n1.cpp
src/amf-app/amf_n1.cpp
+106
-63
src/amf-app/amf_sbi.cpp
src/amf-app/amf_sbi.cpp
+9
-1
src/itti/msgs/itti_msg_sbi.hpp
src/itti/msgs/itti_msg_sbi.hpp
+6
-0
src/ngap/ngap_app/ngap_message_callback.hpp
src/ngap/ngap_app/ngap_message_callback.hpp
+0
-1
No files found.
src/amf-app/amf_n1.cpp
View file @
5a1c9b65
...
...
@@ -3234,80 +3234,123 @@ void amf_n1::ul_nas_transport_handle(
uint8_t
pdu_session_id
=
ul_nas
->
getPduSessionId
();
uint8_t
request_type
=
ul_nas
->
getRequestType
();
// SNSSAI
SNSSAI_t
snssai
=
{};
if
(
!
ul_nas
->
getSnssai
(
snssai
))
{
// If no SNSSAI in this message, use the
// one in Registration Request
Logger
::
amf_n1
().
debug
(
"No Requested NSSAI available in ULNASTransport, use NSSAI from "
"Requested/Configured NSSAI!"
);
bstring
sm_msg
=
nullptr
;
std
::
shared_ptr
<
nas_context
>
nc
=
{};
if
(
!
amf_n1_inst
->
is_amf_ue_id_2_nas_context
(
amf_ue_ngap_id
,
nc
))
{
Logger
::
amf_n1
().
warn
(
"No existed nas_context with amf_ue_ngap_id(0x%x)"
,
amf_ue_ngap_id
);
return
;
if
(((
request_type
&
0x07
)
==
PDU_SESSION_INITIAL_REQUEST
)
or
((
request_type
&
0x07
)
==
EXISTING_PDU_SESSION
))
{
// SNSSAI
SNSSAI_t
snssai
=
{};
if
(
!
ul_nas
->
getSnssai
(
snssai
))
{
// If no SNSSAI in this message, use the
// one in Registration Request
Logger
::
amf_n1
().
debug
(
"No Requested NSSAI available in ULNASTransport, use NSSAI from "
"Requested/Configured NSSAI!"
);
std
::
shared_ptr
<
nas_context
>
nc
=
{};
if
(
!
amf_n1_inst
->
is_amf_ue_id_2_nas_context
(
amf_ue_ngap_id
,
nc
))
{
Logger
::
amf_n1
().
warn
(
"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 since we don't know which slice associated with this PDU session
if
(
nc
->
requestedNssai
.
size
()
>
0
)
{
snssai
=
nc
->
requestedNssai
[
0
];
Logger
::
amf_n1
().
debug
(
"Use first Requested S-NSSAI %s"
,
snssai
.
ToString
().
c_str
());
}
else
{
// Otherwise, use first default subscribed S-NSSAI if available
for
(
const
auto
&
sn
:
nc
->
subscribed_snssai
)
{
if
(
sn
.
first
)
{
snssai
=
sn
.
second
;
Logger
::
amf_n1
().
debug
(
"Use Default Configured S-NSSAI %s"
,
snssai
.
ToString
().
c_str
());
break
;
}
}
}
}
// TODO: Only use the first one for now if there's multiple requested NSSAI
// since we don't know which slice associated with this PDU session
if
(
nc
->
requestedNssai
.
size
()
>
0
)
{
snssai
=
nc
->
requestedNssai
[
0
];
Logger
::
amf_n1
().
debug
(
"S_NSSAI for this PDU Session %s"
,
snssai
.
ToString
().
c_str
());
bstring
dnn
=
bfromcstr
(
"default"
);
if
(
!
ul_nas
->
getDnn
(
dnn
))
{
Logger
::
amf_n1
().
debug
(
"Use first Requested S-NSSAI %s"
,
snssai
.
ToString
().
c_str
());
}
else
{
// Otherwise, use first default subscribed S-NSSAI if available
for
(
const
auto
&
sn
:
nc
->
subscribed_snssai
)
{
if
(
sn
.
first
)
{
snssai
=
sn
.
second
;
Logger
::
amf_n1
().
debug
(
"Use Default Configured S-NSSAI %s"
,
snssai
.
ToString
().
c_str
());
break
;
"No DNN available in ULNASTransport, use default DNN!"
);
// TODO: use default DNN for the corresponding NSSAI
}
comUt
::
print_buffer
(
"amf_n1"
,
"Decoded DNN Bit String"
,
(
uint8_t
*
)
bdata
(
dnn
),
blength
(
dnn
));
switch
(
payload_type
)
{
case
N1_SM_INFORMATION
:
{
if
(
!
ul_nas
->
getPayloadContainer
(
sm_msg
))
{
Logger
::
amf_n1
().
error
(
"Cannot decode Payload Container"
);
return
;
}
std
::
shared_ptr
<
itti_nsmf_pdusession_create_sm_context
>
itti_msg
=
std
::
make_shared
<
itti_nsmf_pdusession_create_sm_context
>
(
TASK_AMF_N1
,
TASK_AMF_SBI
);
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
=
bstrcpy
(
dnn
);
itti_msg
->
sm_msg
=
bstrcpy
(
sm_msg
);
itti_msg
->
snssai
.
sST
=
snssai
.
sst
;
itti_msg
->
snssai
.
sD
=
std
::
to_string
(
snssai
.
sd
);
itti_msg
->
plmn
.
mnc
=
plmn
.
mnc
;
itti_msg
->
plmn
.
mcc
=
plmn
.
mcc
;
int
ret
=
itti_inst
->
send_msg
(
itti_msg
);
if
(
0
!=
ret
)
{
Logger
::
amf_n1
().
error
(
"Could not send ITTI message %s to task TASK_AMF_SBI"
,
itti_msg
->
get_msg_name
());
}
}
break
;
default:
{
Logger
::
amf_n1
().
debug
(
"Transport message un supported"
);
}
}
}
Logger
::
amf_n1
().
debug
(
"S_NSSAI for this PDU Session %s"
,
snssai
.
ToString
().
c_str
());
bstring
dnn
=
bfromcstr
(
"default"
);
bstring
sm_msg
=
nullptr
;
if
(
ul_nas
->
getDnn
(
dnn
))
{
}
else
{
dnn
=
bfromcstr
(
"default"
);
}
comUt
::
print_buffer
(
"amf_n1"
,
"Decoded DNN Bit String"
,
(
uint8_t
*
)
bdata
(
dnn
),
blength
(
dnn
));
switch
(
payload_type
)
{
case
N1_SM_INFORMATION
:
{
if
(
!
ul_nas
->
getPayloadContainer
(
sm_msg
))
{
Logger
::
amf_n1
().
error
(
"Cannot decode Payload Container"
);
return
;
}
switch
(
payload_type
)
{
case
N1_SM_INFORMATION
:
{
if
(
!
ul_nas
->
getPayloadContainer
(
sm_msg
))
{
Logger
::
amf_n1
().
error
(
"Cannot decode Payload Container"
);
return
;
}
std
::
shared_ptr
<
itti_nsmf_pdusession_create_sm_context
>
itti_msg
=
std
::
make_shared
<
itti_nsmf_pdusession_create_sm_context
>
(
TASK_AMF_N1
,
TASK_AMF_SBI
);
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
=
bstrcpy
(
dnn
);
itti_msg
->
sm_msg
=
bstrcpy
(
sm_msg
);
itti_msg
->
snssai
.
sST
=
snssai
.
sst
;
itti_msg
->
snssai
.
sD
=
std
::
to_string
(
snssai
.
sd
);
itti_msg
->
plmn
.
mnc
=
plmn
.
mnc
;
itti_msg
->
plmn
.
mcc
=
plmn
.
mcc
;
int
ret
=
itti_inst
->
send_msg
(
itti_msg
);
if
(
0
!=
ret
)
{
Logger
::
amf_n1
().
error
(
"Could not send ITTI message %s to task TASK_AMF_SBI"
,
itti_msg
->
get_msg_name
());
}
std
::
shared_ptr
<
itti_nsmf_pdusession_update_sm_context
>
itti_msg
=
std
::
make_shared
<
itti_nsmf_pdusession_update_sm_context
>
(
TASK_AMF_N1
,
TASK_AMF_SBI
);
}
break
;
itti_msg
->
ran_ue_ngap_id
=
ran_ue_ngap_id
;
itti_msg
->
amf_ue_ngap_id
=
amf_ue_ngap_id
;
itti_msg
->
pdu_session_id
=
pdu_session_id
;
itti_msg
->
n1sm
=
bstrcpy
(
sm_msg
);
itti_msg
->
is_n1sm_set
=
true
;
int
ret
=
itti_inst
->
send_msg
(
itti_msg
);
if
(
0
!=
ret
)
{
Logger
::
amf_n1
().
error
(
"Could not send ITTI message %s to task TASK_AMF_SBI"
,
itti_msg
->
get_msg_name
());
}
}
break
;
default:
{
Logger
::
amf_n1
().
debug
(
"Transport message is not supported"
);
}
}
}
}
...
...
src/amf-app/amf_sbi.cpp
View file @
5a1c9b65
...
...
@@ -241,8 +241,16 @@ void amf_sbi::handle_itti_message(
Logger
::
amf_sbi
().
debug
(
"SMF URI: %s"
,
remote_uri
.
c_str
());
std
::
string
n1sm_msg
=
{};
std
::
string
n2sm_msg
=
{};
nlohmann
::
json
pdu_session_update_request
=
{};
if
(
itti_msg
.
is_n1sm_set
)
{
pdu_session_update_request
[
"n1SmMsg"
][
"contentId"
]
=
"n1SmMsg"
;
octet_stream_2_hex_stream
(
(
uint8_t
*
)
bdata
(
itti_msg
.
n1sm
),
blength
(
itti_msg
.
n1sm
),
n1sm_msg
);
}
if
(
itti_msg
.
is_n2sm_set
)
{
pdu_session_update_request
[
"n2SmInfoType"
]
=
itti_msg
.
n2sm_info_type
;
pdu_session_update_request
[
"n2SmInfo"
][
"contentId"
]
=
"n2msg"
;
...
...
@@ -270,7 +278,7 @@ void amf_sbi::handle_itti_message(
if
(
amf_cfg
.
support_features
.
use_http2
)
http_version
=
2
;
curl_http_client
(
remote_uri
,
json_part
,
""
,
n2sm_msg
,
supi
,
itti_msg
.
pdu_session_id
,
remote_uri
,
json_part
,
n1sm_msg
,
n2sm_msg
,
supi
,
itti_msg
.
pdu_session_id
,
http_version
,
itti_msg
.
promise_id
);
}
...
...
src/itti/msgs/itti_msg_sbi.hpp
View file @
5a1c9b65
...
...
@@ -124,6 +124,8 @@ class itti_nsmf_pdusession_update_sm_context : public itti_msg_n11 {
:
itti_msg_n11
(
NSMF_PDU_SESSION_UPDATE_SM_CTX
,
origin
,
destination
)
{
supi
=
{};
pdu_session_id
=
0
;
n1sm
=
nullptr
;
is_n1sm_set
=
false
;
n2sm
=
nullptr
;
is_n2sm_set
=
false
;
n2sm_info_type
=
{};
...
...
@@ -138,6 +140,8 @@ class itti_nsmf_pdusession_update_sm_context : public itti_msg_n11 {
:
itti_msg_n11
(
i
)
{
supi
=
i
.
supi
;
pdu_session_id
=
i
.
pdu_session_id
;
n1sm
=
i
.
n1sm
;
is_n1sm_set
=
i
.
is_n1sm_set
;
n2sm
=
i
.
n2sm
;
is_n2sm_set
=
i
.
is_n2sm_set
;
n2sm_info_type
=
i
.
n2sm_info_type
;
...
...
@@ -150,6 +154,8 @@ class itti_nsmf_pdusession_update_sm_context : public itti_msg_n11 {
public:
std
::
string
supi
;
uint8_t
pdu_session_id
;
bstring
n1sm
;
bool
is_n1sm_set
;
bstring
n2sm
;
bool
is_n2sm_set
;
std
::
string
n2sm_info_type
;
...
...
src/ngap/ngap_app/ngap_message_callback.hpp
View file @
5a1c9b65
...
...
@@ -432,7 +432,6 @@ int ngap_amf_handle_pdu_session_resource_setup_response(
itti_msg
->
n2sm
=
blk2bstr
(
list
[
0
].
pduSessionResourceSetupResponseTransfer
.
buf
,
list
[
0
].
pduSessionResourceSetupResponseTransfer
.
size
);
;
itti_msg
->
is_n2sm_set
=
true
;
itti_msg
->
n2sm_info_type
=
"PDU_RES_SETUP_RSP"
;
itti_msg
->
amf_ue_ngap_id
=
...
...
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