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
a0a3314a
Commit
a0a3314a
authored
Aug 06, 2021
by
Tien-Thinh Nguyen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
First version for Paging procedures
parent
b5fc3a28
Changes
11
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
125 additions
and
60 deletions
+125
-60
src/amf-app/amf_app.cpp
src/amf-app/amf_app.cpp
+46
-32
src/amf-app/amf_n1.cpp
src/amf-app/amf_n1.cpp
+4
-4
src/amf-app/amf_n11.cpp
src/amf-app/amf_n11.cpp
+3
-0
src/amf-app/amf_n2.cpp
src/amf-app/amf_n2.cpp
+6
-9
src/common/3gpp_29.518.h
src/common/3gpp_29.518.h
+25
-9
src/common/amf.hpp
src/common/amf.hpp
+2
-0
src/contexts/CMakeLists.txt
src/contexts/CMakeLists.txt
+0
-1
src/contexts/gNB_context.hpp
src/contexts/gNB_context.hpp
+7
-2
src/contexts/nas_context.hpp
src/contexts/nas_context.hpp
+6
-1
src/itti/msgs/itti_msg_amf_app.hpp
src/itti/msgs/itti_msg_amf_app.hpp
+7
-1
src/sbi/amf_server/impl/N1N2MessageCollectionDocumentApiImpl.cpp
.../amf_server/impl/N1N2MessageCollectionDocumentApiImpl.cpp
+19
-1
No files found.
src/amf-app/amf_app.cpp
View file @
a0a3314a
...
...
@@ -238,39 +238,53 @@ bool amf_app::get_pdu_sessions_context(
//------------------------------------------------------------------------------
void
amf_app
::
handle_itti_message
(
itti_n1n2_message_transfer_request
&
itti_msg
)
{
// Encode DL NAS TRANSPORT message(NAS message)
DLNASTransport
*
dl
=
new
DLNASTransport
();
dl
->
setHeader
(
PLAIN_5GS_MSG
);
dl
->
setPayload_Container_Type
(
N1_SM_INFORMATION
);
dl
->
setPayload_Container
(
(
uint8_t
*
)
bdata
(
itti_msg
.
n1sm
),
blength
(
itti_msg
.
n1sm
));
dl
->
setPDUSessionId
(
itti_msg
.
pdu_session_id
);
uint8_t
nas
[
1024
];
int
encoded_size
=
dl
->
encode2buffer
(
nas
,
1024
);
print_buffer
(
"amf_app"
,
"n1n2 transfer"
,
nas
,
encoded_size
);
bstring
dl_nas
=
blk2bstr
(
nas
,
encoded_size
);
itti_downlink_nas_transfer
*
dl_msg
=
new
itti_downlink_nas_transfer
(
TASK_AMF_APP
,
TASK_AMF_N1
);
dl_msg
->
dl_nas
=
dl_nas
;
if
(
!
itti_msg
.
is_n2sm_set
)
{
dl_msg
->
is_n2sm_set
=
false
;
if
(
itti_msg
.
is_ppi_set
)
{
// Paging procedure
std
::
shared_ptr
<
itti_paging
>
i
=
std
::
make_shared
<
itti_paging
>
(
TASK_AMF_APP
,
TASK_AMF_N2
);
i
.
get
()
->
amf_ue_ngap_id
=
amf_n1_inst
->
supi2amfId
.
at
(
itti_msg
.
supi
);
i
.
get
()
->
ran_ue_ngap_id
=
amf_n1_inst
->
supi2ranId
.
at
(
itti_msg
.
supi
);
int
ret
=
itti_inst
->
send_msg
(
i
);
if
(
0
!=
ret
)
{
Logger
::
amf_app
().
error
(
"Could not send ITTI message %s to task TASK_AMF_N2"
,
i
->
get_msg_name
());
}
}
else
{
dl_msg
->
n2sm
=
itti_msg
.
n2sm
;
dl_msg
->
pdu_session_id
=
itti_msg
.
pdu_session_id
;
dl_msg
->
is_n2sm_set
=
true
;
dl_msg
->
n2sm_info_type
=
itti_msg
.
n2sm_info_type
;
}
dl_msg
->
amf_ue_ngap_id
=
amf_n1_inst
->
supi2amfId
.
at
(
itti_msg
.
supi
);
dl_msg
->
ran_ue_ngap_id
=
amf_n1_inst
->
supi2ranId
.
at
(
itti_msg
.
supi
);
std
::
shared_ptr
<
itti_downlink_nas_transfer
>
i
=
std
::
shared_ptr
<
itti_downlink_nas_transfer
>
(
dl_msg
);
int
ret
=
itti_inst
->
send_msg
(
i
);
if
(
0
!=
ret
)
{
Logger
::
amf_app
().
error
(
"Could not send ITTI message %s to task TASK_AMF_N1"
,
i
->
get_msg_name
());
// Encode DL NAS TRANSPORT message(NAS message)
DLNASTransport
*
dl
=
new
DLNASTransport
();
dl
->
setHeader
(
PLAIN_5GS_MSG
);
dl
->
setPayload_Container_Type
(
N1_SM_INFORMATION
);
dl
->
setPayload_Container
(
(
uint8_t
*
)
bdata
(
itti_msg
.
n1sm
),
blength
(
itti_msg
.
n1sm
));
dl
->
setPDUSessionId
(
itti_msg
.
pdu_session_id
);
uint8_t
nas
[
BUFFER_SIZE_1024
];
int
encoded_size
=
dl
->
encode2buffer
(
nas
,
BUFFER_SIZE_1024
);
print_buffer
(
"amf_app"
,
"n1n2 transfer"
,
nas
,
encoded_size
);
bstring
dl_nas
=
blk2bstr
(
nas
,
encoded_size
);
itti_downlink_nas_transfer
*
dl_msg
=
new
itti_downlink_nas_transfer
(
TASK_AMF_APP
,
TASK_AMF_N1
);
dl_msg
->
dl_nas
=
dl_nas
;
if
(
!
itti_msg
.
is_n2sm_set
)
{
dl_msg
->
is_n2sm_set
=
false
;
}
else
{
dl_msg
->
n2sm
=
itti_msg
.
n2sm
;
dl_msg
->
pdu_session_id
=
itti_msg
.
pdu_session_id
;
dl_msg
->
is_n2sm_set
=
true
;
dl_msg
->
n2sm_info_type
=
itti_msg
.
n2sm_info_type
;
}
dl_msg
->
amf_ue_ngap_id
=
amf_n1_inst
->
supi2amfId
.
at
(
itti_msg
.
supi
);
dl_msg
->
ran_ue_ngap_id
=
amf_n1_inst
->
supi2ranId
.
at
(
itti_msg
.
supi
);
std
::
shared_ptr
<
itti_downlink_nas_transfer
>
i
=
std
::
shared_ptr
<
itti_downlink_nas_transfer
>
(
dl_msg
);
int
ret
=
itti_inst
->
send_msg
(
i
);
if
(
0
!=
ret
)
{
Logger
::
amf_app
().
error
(
"Could not send ITTI message %s to task TASK_AMF_N1"
,
i
->
get_msg_name
());
}
}
}
...
...
src/amf-app/amf_n1.cpp
View file @
a0a3314a
...
...
@@ -412,7 +412,7 @@ void amf_n1::nas_signalling_establishment_request_handle(
set_amf_ue_ngap_id_2_nas_context
(
amf_ue_ngap_id
,
nc
);
nc
.
get
()
->
ctx_avaliability_ind
=
false
;
// change UE connection status CM-IDLE -> CM-CONNECTED
nc
.
get
()
->
nas_status
=
"CM-CONNECTED"
;
nc
.
get
()
->
nas_status
=
CM_CONNECTED
;
nc
.
get
()
->
amf_ue_ngap_id
=
amf_ue_ngap_id
;
nc
.
get
()
->
ran_ue_ngap_id
=
ran_ue_ngap_id
;
nc
.
get
()
->
serving_network
=
snn
;
...
...
@@ -582,7 +582,7 @@ void amf_n1::identity_response_handle(
nc
.
get
()
->
ctx_avaliability_ind
=
false
;
}
nc
.
get
()
->
ctx_avaliability_ind
=
true
;
nc
.
get
()
->
nas_status
=
"CM-CONNECTED"
;
nc
.
get
()
->
nas_status
=
CM_CONNECTED
;
nc
.
get
()
->
amf_ue_ngap_id
=
amf_ue_ngap_id
;
nc
.
get
()
->
ran_ue_ngap_id
=
ran_ue_ngap_id
;
nc
.
get
()
->
is_imsi_present
=
true
;
...
...
@@ -847,7 +847,7 @@ void amf_n1::registration_request_handle(
set_amf_ue_ngap_id_2_nas_context
(
amf_ue_ngap_id
,
nc
);
nc
.
get
()
->
ctx_avaliability_ind
=
false
;
// change UE connection status CM-IDLE -> CM-CONNECTED
nc
.
get
()
->
nas_status
=
"CM-CONNECTED"
;
nc
.
get
()
->
nas_status
=
CM_CONNECTED
;
nc
.
get
()
->
amf_ue_ngap_id
=
amf_ue_ngap_id
;
nc
.
get
()
->
ran_ue_ngap_id
=
ran_ue_ngap_id
;
nc
.
get
()
->
serving_network
=
snn
;
...
...
@@ -925,7 +925,7 @@ void amf_n1::registration_request_handle(
set_amf_ue_ngap_id_2_nas_context
(
amf_ue_ngap_id
,
nc
);
nc
.
get
()
->
ctx_avaliability_ind
=
false
;
// change UE connection status CM-IDLE -> CM-CONNECTED
nc
.
get
()
->
nas_status
=
"CM-CONNECTED"
;
nc
.
get
()
->
nas_status
=
CM_CONNECTED
;
nc
.
get
()
->
amf_ue_ngap_id
=
amf_ue_ngap_id
;
nc
.
get
()
->
ran_ue_ngap_id
=
ran_ue_ngap_id
;
nc
.
get
()
->
serving_network
=
snn
;
...
...
src/amf-app/amf_n11.cpp
View file @
a0a3314a
...
...
@@ -494,6 +494,7 @@ void amf_n11::handle_post_sm_context_response_error(
itti_msg
->
is_n2sm_set
=
false
;
itti_msg
->
supi
=
supi
;
itti_msg
->
pdu_session_id
=
pdu_session_id
;
itti_msg
->
is_ppi_set
=
false
;
std
::
shared_ptr
<
itti_n1n2_message_transfer_request
>
i
=
std
::
shared_ptr
<
itti_n1n2_message_transfer_request
>
(
itti_msg
);
int
ret
=
itti_inst
->
send_msg
(
i
);
...
...
@@ -718,6 +719,8 @@ void amf_n11::curl_http_client(
itti_msg
->
is_n1sm_set
=
false
;
itti_msg
->
is_n2sm_set
=
false
;
itti_msg
->
is_ppi_set
=
false
;
if
(
n1sm
.
size
()
>
0
)
{
msg_str_2_msg_hex
(
n1sm
,
n1sm_hex
);
print_buffer
(
...
...
src/amf-app/amf_n2.cpp
View file @
a0a3314a
...
...
@@ -243,10 +243,7 @@ void amf_n2::handle_itti_message(itti_paging& itti_msg) {
itti_msg
.
amf_ue_ngap_id
,
unc
.
get
()
->
amf_ue_ngap_id
);
}
if
(
unc
.
get
()
->
ng_ue_state
==
NGAP_UE_CONNECTED
)
{
Logger
::
amf_n2
().
warn
(
"Received NGAP PAGING while UE in CONNECTED MODE"
);
// return;
}
// TODO: check UE reachability status
PagingMsg
paging_msg
=
{};
paging_msg
.
setMessageType
();
...
...
@@ -746,15 +743,15 @@ void amf_n2::handle_itti_message(itti_dl_nas_transport& dl_nas_transport) {
//------------------------------------------------------------------------------
void
amf_n2
::
handle_itti_message
(
itti_initial_context_setup_request
&
itti_msg
)
{
std
::
shared_ptr
<
ue_ngap_context
>
unc
;
std
::
shared_ptr
<
ue_ngap_context
>
unc
=
{}
;
unc
=
ran_ue_id_2_ue_ngap_context
(
itti_msg
.
ran_ue_ngap_id
);
if
(
unc
.
get
()
==
nullptr
)
{
Logger
::
amf_n2
().
error
(
"Illegal UE with ran_ue_ngap_id (0x%x)"
,
itti_msg
.
ran_ue_ngap_id
);
return
;
}
unc
.
get
()
->
ncc
=
1
;
std
::
shared_ptr
<
gnb_context
>
gc
;
unc
.
get
()
->
ncc
=
1
;
std
::
shared_ptr
<
gnb_context
>
gc
=
{}
;
gc
=
assoc_id_2_gnb_context
(
unc
.
get
()
->
gnb_assoc_id
);
if
(
gc
.
get
()
==
nullptr
)
{
Logger
::
amf_n2
().
error
(
...
...
@@ -866,8 +863,8 @@ void amf_n2::handle_itti_message(itti_initial_context_setup_request& itti_msg) {
}
}
uint8_t
buffer
[
20000
];
// TODO: remove hardcoded value
int
encoded_size
=
msg
->
encode2buffer
(
buffer
,
10000
);
uint8_t
buffer
[
BUFFER_SIZE_2048
];
int
encoded_size
=
msg
->
encode2buffer
(
buffer
,
BUFFER_SIZE_2048
);
bstring
b
=
blk2bstr
(
buffer
,
encoded_size
);
sctp_s_38412
.
sctp_send_msg
(
gc
.
get
()
->
sctp_assoc_id
,
unc
.
get
()
->
sctp_stream_send
,
&
b
);
...
...
src/co
ntexts/gNB_context.cpp
→
src/co
mmon/3gpp_29.518.h
View file @
a0a3314a
...
...
@@ -4,8 +4,8 @@
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this
*
file except in compliance with the License. You may obtain a copy of the
*
License at
*file except in compliance with the License. You may obtain a copy of the
*License at
*
* http://www.openairinterface.org/?page_id=698
*
...
...
@@ -19,11 +19,27 @@
* contact@openairinterface.org
*/
/*! \file gNB_context.cpp
\brief
\author Keliang DU, BUPT
\date 2020
\email: contact@openairinterface.org
*/
#ifndef FILE_3GPP_29_518_SEEN
#define FILE_3GPP_29_518_SEEN
#include <vector>
enum
n1_n2_message_transfer_cause_e
{
ATTEMPTING_TO_REACH_UE
=
1
,
N1_N2_TRANSFER_INITIATED
=
2
,
WAITING_FOR_ASYNCHRONOUS_TRANSFER
=
3
,
UE_NOT_RESPONDING
=
4
,
N1_MSG_NOT_TRANSFERRED
=
5
,
UE_NOT_REACHABLE_FOR_SESSION
=
6
};
static
const
std
::
vector
<
std
::
string
>
n1_n2_message_transfer_cause_e2str
=
{
"UNKNOWN ERROR"
,
"ATTEMPTING_TO_REACH_UE"
,
"N1_N2_TRANSFER_INITIATED"
,
"WAITING_FOR_ASYNCHRONOUS_TRANSFER"
,
"UE_NOT_RESPONDING"
,
"N1_MSG_NOT_TRANSFERRED"
,
"UE_NOT_REACHABLE_FOR_SESSION"
};
#
include "gNB_context.hpp"
#
endif
src/common/amf.hpp
View file @
a0a3314a
...
...
@@ -29,6 +29,8 @@
#define __AMF_HPP
#include "3gpp_23.003.h"
#include "3gpp_29.518.h"
/*
typedef struct {
std::string mcc;
...
...
src/contexts/CMakeLists.txt
View file @
a0a3314a
...
...
@@ -37,7 +37,6 @@ include_directories(${SRC_TOP_DIR}/utils)
include_directories
(
${
SRC_TOP_DIR
}
/utils/bstr
)
add_library
(
CONTEXTS STATIC
${
CMAKE_CURRENT_SOURCE_DIR
}
/gNB_context.cpp
${
CMAKE_CURRENT_SOURCE_DIR
}
/nas_context.cpp
${
CMAKE_CURRENT_SOURCE_DIR
}
/pdu_session_context.cpp
${
CMAKE_CURRENT_SOURCE_DIR
}
/ue_context.cpp
...
...
src/contexts/gNB_context.hpp
View file @
a0a3314a
...
...
@@ -45,10 +45,15 @@ extern "C" {
using
namespace
sctp
;
using
namespace
ngap
;
enum
amf_ng_gnb_state_s
{
NGAP_INIT
,
NGAP_RESETING
,
NGAP_READY
,
NGAP_SHUTDOWN
};
typedef
enum
{
NGAP_INIT
,
NGAP_RESETING
,
NGAP_READY
,
NGAP_SHUTDOWN
}
amf_ng_gnb_state_t
;
class
gnb_context
{
public:
enum
amf_ng_gnb_state_s
ng_state
;
amf_ng_gnb_state_t
ng_state
;
std
::
string
gnb_name
;
long
globalRanNodeId
;
...
...
src/contexts/nas_context.hpp
View file @
a0a3314a
...
...
@@ -56,6 +56,11 @@ static const std::vector<std::string> _5gmm_state_e2str = {
"_5GMM_COMMON_PROCEDURE_INITIATED"
,
"_5GMM_STATE_MAX"
};
typedef
enum
{
CM_IDLE
=
0
,
CM_CONNECTED
}
cm_state_t
;
static
const
std
::
vector
<
std
::
string
>
cm_state_e2str
=
{
"CM_IDLE"
,
"CM_CONNECTED"
};
class
nas_context
{
public:
nas_context
();
...
...
@@ -64,7 +69,7 @@ class nas_context {
bool
is_stacs_available
;
long
amf_ue_ngap_id
;
uint32_t
ran_ue_ngap_id
;
std
::
string
nas_status
;
cm_state_t
nas_status
;
_5gmm_state_t
_5gmm_state
;
// parameters from Registration request
...
...
src/itti/msgs/itti_msg_amf_app.hpp
View file @
a0a3314a
...
...
@@ -86,9 +86,11 @@ class itti_n1n2_message_transfer_request : public itti_msg_amf_app {
:
itti_msg_amf_app
(
N1N2_MESSAGE_TRANSFER_REQ
,
origin
,
destination
),
supi
(),
pdu_session_id
(
0
),
n2sm_info_type
()
{
n2sm_info_type
(),
ppi
(
0
)
{
is_n2sm_set
=
false
;
is_n1sm_set
=
false
;
is_ppi_set
=
false
;
}
itti_n1n2_message_transfer_request
(
const
itti_n1n2_message_transfer_request
&
i
)
...
...
@@ -100,6 +102,8 @@ class itti_n1n2_message_transfer_request : public itti_msg_amf_app {
is_n1sm_set
=
i
.
is_n1sm_set
;
pdu_session_id
=
i
.
pdu_session_id
;
n2sm_info_type
=
i
.
n2sm_info_type
;
ppi
=
i
.
ppi
;
is_ppi_set
=
i
.
is_ppi_set
;
}
std
::
string
supi
;
...
...
@@ -109,6 +113,8 @@ class itti_n1n2_message_transfer_request : public itti_msg_amf_app {
bool
is_n1sm_set
;
uint8_t
pdu_session_id
;
std
::
string
n2sm_info_type
;
bool
is_ppi_set
;
uint8_t
ppi
;
// other parameters
};
...
...
src/sbi/amf_server/impl/N1N2MessageCollectionDocumentApiImpl.cpp
View file @
a0a3314a
...
...
@@ -72,7 +72,11 @@ void N1N2MessageCollectionDocumentApiImpl::n1_n2_message_transfer(
Pistache
::
Http
::
ResponseWriter
&
response
)
{
Logger
::
amf_server
().
debug
(
"Receive N1N2MessageTransfer Request, handling..."
);
response
.
send
(
Pistache
::
Http
::
Code
::
Ok
,
"OK"
);
nlohmann
::
json
response_json
=
{};
response_json
[
"cause"
]
=
n1_n2_message_transfer_cause_e2str
[
N1_N2_TRANSFER_INITIATED
];
Pistache
::
Http
::
Code
code
=
Pistache
::
Http
::
Code
::
Ok
;
std
::
string
supi
=
ueContextId
;
Logger
::
amf_server
().
debug
(
...
...
@@ -108,6 +112,20 @@ void N1N2MessageCollectionDocumentApiImpl::n1_n2_message_transfer(
itti_msg
->
is_n2sm_set
=
true
;
itti_msg
->
pdu_session_id
=
(
uint8_t
)
n1N2MessageTransferReqData
.
getPduSessionId
();
// For Paging
if
(
n1N2MessageTransferReqData
.
ppiIsSet
())
{
itti_msg
->
is_ppi_set
=
true
;
itti_msg
->
ppi
=
n1N2MessageTransferReqData
.
getPpi
();
response_json
[
"cause"
]
=
n1_n2_message_transfer_cause_e2str
[
ATTEMPTING_TO_REACH_UE
];
code
=
Pistache
::
Http
::
Code
::
Accepted
;
}
// Send response to the NF Service Consumer (e.g., SMF)
response
.
send
(
code
,
response_json
.
dump
().
c_str
());
// Process N1N2 Message Transfer Request
std
::
shared_ptr
<
itti_n1n2_message_transfer_request
>
i
=
std
::
shared_ptr
<
itti_n1n2_message_transfer_request
>
(
itti_msg
);
int
ret
=
itti_inst
->
send_msg
(
i
);
...
...
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