Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
O
OpenXG-RAN
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
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
canghaiwuhen
OpenXG-RAN
Commits
46f1dc96
Commit
46f1dc96
authored
Sep 10, 2020
by
zhenghuangkun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Modify NGAP Message
parent
bdd31eb8
Changes
10
Show whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
262 additions
and
198 deletions
+262
-198
cmake_targets/tools/make_asn1c_includes.sh
cmake_targets/tools/make_asn1c_includes.sh
+4
-0
common/utils/msc/msc.h
common/utils/msc/msc.h
+2
-0
openair2/COMMON/ngap_messages_types.h
openair2/COMMON/ngap_messages_types.h
+58
-70
openair2/GNB_APP/gnb_config.c
openair2/GNB_APP/gnb_config.c
+8
-4
openair3/NGAP/ngap_gNB.c
openair3/NGAP/ngap_gNB.c
+1
-1
openair3/NGAP/ngap_gNB_defs.h
openair3/NGAP/ngap_gNB_defs.h
+10
-15
openair3/NGAP/ngap_gNB_nas_procedures.c
openair3/NGAP/ngap_gNB_nas_procedures.c
+61
-68
openair3/NGAP/ngap_gNB_nnsf.c
openair3/NGAP/ngap_gNB_nnsf.c
+42
-34
openair3/NGAP/ngap_gNB_nnsf.h
openair3/NGAP/ngap_gNB_nnsf.h
+6
-6
openair3/UTILS/conversions.h
openair3/UTILS/conversions.h
+70
-0
No files found.
cmake_targets/tools/make_asn1c_includes.sh
View file @
46f1dc96
...
...
@@ -19,6 +19,10 @@ if [ "$done_flag" -ot $ASN1_SOURCE_DIR ] ; then
sed
-i
's/18446744073709551615))/18446744073709551615U))/g'
"
$GENERATED_FULL_DIR
"
/
${
ASN1C_PREFIX
}
E-RABUsageReportItem.c
sed
-i
's/18446744073709551615 }/18446744073709551615U }/g'
"
$GENERATED_FULL_DIR
"
/
${
ASN1C_PREFIX
}
E-RABUsageReportItem.c
fi
if
[
"
$ASN1C_PREFIX
"
=
"NGAP_"
]
;
then
sed
-i
's/18446744073709551615))/18446744073709551615U))/g'
"
$GENERATED_FULL_DIR
"
/
${
ASN1C_PREFIX
}
VolumeTimedReport-Item.c
sed
-i
's/18446744073709551615 }/18446744073709551615U }/g'
"
$GENERATED_FULL_DIR
"
/
${
ASN1C_PREFIX
}
VolumeTimedReport-Item.c
fi
fi
touch
$done_flag
common/utils/msc/msc.h
View file @
46f1dc96
...
...
@@ -51,9 +51,11 @@ typedef enum {
MSC_RRC_ENB
,
MSC_IP_ENB
,
MSC_S1AP_ENB
,
MSC_NGAP_GNB
,
MSC_GTPU_ENB
,
MSC_GTPU_SGW
,
MSC_S1AP_MME
,
MSC_NGAP_AMF
,
MSC_MMEAPP_MME
,
MSC_NAS_MME
,
MSC_NAS_EMM_MME
,
...
...
openair2/COMMON/ngap_messages_types.h
View file @
46f1dc96
...
...
@@ -147,12 +147,12 @@ typedef struct ngap_allocation_retention_priority_s {
ngap_pre_emp_vulnerability_t
pre_emp_vulnerability
;
}
ngap_allocation_retention_priority_t
;
typedef
struct
n
r
_security_capabilities_s
{
typedef
struct
n
gap
_security_capabilities_s
{
uint16_t
nRencryption_algorithms
;
uint16_t
nRintegrity_algorithms
;
uint16_t
eUTRAencryption_algorithms
;
uint16_t
eUTRAintegrity_algorithms
;
}
n
r
_security_capabilities_t
;
}
n
gap
_security_capabilities_t
;
/* Provides the establishment cause for the RRC connection request as provided
* by the upper layers. W.r.t. the cause value names: highPriorityAccess
...
...
@@ -165,9 +165,12 @@ typedef enum ngap_rrc_establishment_cause_e {
NGAP_RRC_CAUSE_MT_ACCESS
=
0x2
,
NGAP_RRC_CAUSE_MO_SIGNALLING
=
0x3
,
NGAP_RRC_CAUSE_MO_DATA
=
0x4
,
#if defined(UPDATE_RELEASE_10)
NGAP_RRC_CAUSE_DELAY_TOLERANT_ACCESS
=
0x5
,
#endif
NGAP_RRC_CAUSE_MO_VOICECALL
=
0x5
,
NGAP_RRC_CAUSE_MO_VIDEOCALL
=
0x6
,
NGAP_RRC_CAUSE_MO_SMS
=
0x7
,
NGAP_RRC_CAUSE_MPS_PRIORITY_ACCESS
=
0x8
,
NGAP_RRC_CAUSE_MCS_PRIORITY_ACCESS
=
0x9
,
NGAP_RRC_CAUSE_NOTAVAILABLE
=
0x10
,
NGAP_RRC_CAUSE_LAST
}
ngap_rrc_establishment_cause_t
;
...
...
@@ -186,42 +189,27 @@ typedef struct ngap_allowed_NSSAI_s{
uint8_t
sD
[
3
];
}
ngap_allowed_NSSAI_t
;
typedef
struct
ngap_imsi_s
{
uint8_t
buffer
[
NGAP_IMSI_LENGTH
];
uint8_t
length
;
}
ngap_imsi_t
;
typedef
struct
ngap_s_tmsi_s
{
uint8_t
amf_code
;
typedef
struct
fiveg_s_tmsi_s
{
uint16_t
amf_set_id
;
uint8_t
amf_pointer
;
uint32_t
m_tmsi
;
}
ngap_s_tmsi_t
;
typedef
enum
ngap_ue_paging_identity_presenceMask_e
{
NGAP_UE_PAGING_IDENTITY_NONE
=
0
,
NGAP_UE_PAGING_IDENTITY_imsi
=
(
1
<<
1
),
NGAP_UE_PAGING_IDENTITY_s_tmsi
=
(
1
<<
2
),
}
ngap_ue_paging_identity_presenceMask_t
;
}
fiveg_s_tmsi_t
;
typedef
struct
ngap_ue_paging_identity_s
{
ngap_ue_paging_identity_presenceMask_t
presenceMask
;
union
{
ngap_imsi_t
imsi
;
ngap_s_tmsi_t
s_tmsi
;
}
choice
;
fiveg_s_tmsi_t
s_tmsi
;
}
ngap_ue_paging_identity_t
;
typedef
enum
ngap_ue_identities_presenceMask_e
{
NGAP_UE_IDENTITIES_NONE
=
0
,
NGAP_UE_IDENTITIES_
s_tmsi
=
1
<<
1
,
NGAP_UE_IDENTITIES_
FiveG_s_tmsi
=
1
<<
1
,
NGAP_UE_IDENTITIES_guami
=
1
<<
2
,
}
ngap_ue_identities_presenceMask_t
;
typedef
struct
ngap_
nr
ue_identity_s
{
typedef
struct
ngap_ue_identity_s
{
ngap_ue_identities_presenceMask_t
presenceMask
;
ngap_s_tmsi_t
s_tmsi
;
fiveg_s_tmsi_t
s_tmsi
;
ngap_guami_t
guami
;
}
n
r
ue_identity_t
;
}
n
gap_
ue_identity_t
;
typedef
struct
ngap_nas_pdu_s
{
/* Octet string data */
...
...
@@ -259,7 +247,7 @@ typedef struct ngap_transport_layer_addr_s {
typedef
struct
pdusession_level_qos_parameter_s
{
uint8_t
qci
;
allocation_retention_priority_t
allocation_retention_priority
;
ngap_
allocation_retention_priority_t
allocation_retention_priority
;
}
pdusession_level_qos_parameter_t
;
typedef
struct
pdusession_s
{
...
...
@@ -282,7 +270,7 @@ typedef struct pdusession_setup_s {
uint8_t
pdusession_id
;
/* The transport layer address for the IP packets */
transport_layer_addr_t
gNB_addr
;
ngap_
transport_layer_addr_t
gNB_addr
;
/* S-GW Tunnel endpoint identifier */
uint32_t
gtp_teid
;
...
...
@@ -296,7 +284,7 @@ typedef struct pdusession_tobe_added_s {
uint8_t
drb_ID
;
/* The transport layer address for the IP packets */
transport_layer_addr_t
upf_addr
;
ngap_
transport_layer_addr_t
upf_addr
;
/* S-GW Tunnel endpoint identifier */
uint32_t
gtp_teid
;
...
...
@@ -310,7 +298,7 @@ typedef struct pdusession_admitted_tobe_added_s {
uint8_t
drb_ID
;
/* The transport layer address for the IP packets */
transport_layer_addr_t
gnb_addr
;
ngap_
transport_layer_addr_t
gnb_addr
;
/* S-GW Tunnel endpoint identifier */
uint32_t
gtp_teid
;
...
...
@@ -323,7 +311,7 @@ typedef struct pdusession_tobeswitched_s {
uint8_t
pdusession_id
;
/* The transport layer address for the IP packets */
transport_layer_addr_t
upf_addr
;
ngap_
transport_layer_addr_t
upf_addr
;
/* S-GW Tunnel endpoint identifier */
uint32_t
gtp_teid
;
...
...
@@ -444,12 +432,12 @@ typedef struct ngap_nas_first_req_s {
ngap_rrc_establishment_cause_t
establishment_cause
;
/* NAS PDU */
nas_pdu_t
nas_pdu
;
n
gap_n
as_pdu_t
nas_pdu
;
/* If this flag is set NGAP layer is expecting the GUAMI. If = 0,
* the temporary s-tmsi is used.
*/
n
r
ue_identity_t
ue_identity
;
n
gap_
ue_identity_t
ue_identity
;
}
ngap_nas_first_req_t
;
typedef
struct
ngap_uplink_nas_s
{
...
...
@@ -457,12 +445,12 @@ typedef struct ngap_uplink_nas_s {
uint32_t
gNB_ue_ngap_id
;
/* NAS pdu */
nas_pdu_t
nas_pdu
;
n
gap_n
as_pdu_t
nas_pdu
;
}
ngap_uplink_nas_t
;
typedef
struct
ngap_ue_cap_info_ind_s
{
uint32_t
gNB_ue_ngap_id
;
ue_radio_cap_t
ue_radio_cap
;
ngap_
ue_radio_cap_t
ue_radio_cap
;
}
ngap_ue_cap_info_ind_t
;
typedef
struct
ngap_initial_context_setup_resp_s
{
...
...
@@ -487,7 +475,7 @@ typedef struct ngap_initial_context_setup_fail_s {
typedef
struct
ngap_nas_non_delivery_ind_s
{
uint32_t
gNB_ue_ngap_id
;
nas_pdu_t
nas_pdu
;
n
gap_n
as_pdu_t
nas_pdu
;
/* TODO: add cause */
}
ngap_nas_non_delivery_ind_t
;
...
...
@@ -506,7 +494,7 @@ typedef struct ngap_ue_ctxt_modification_req_s {
ngap_ambr_t
ue_ambr
;
/* NR Security capabilities */
n
r
_security_capabilities_t
security_capabilities
;
n
gap
_security_capabilities_t
security_capabilities
;
}
ngap_ue_ctxt_modification_req_t
;
typedef
struct
ngap_ue_ctxt_modification_resp_s
{
...
...
@@ -529,7 +517,7 @@ typedef struct ngap_downlink_nas_s {
uint32_t
gNB_ue_ngap_id
;
/* NAS pdu */
nas_pdu_t
nas_pdu
;
n
gap_n
as_pdu_t
nas_pdu
;
}
ngap_downlink_nas_t
;
...
...
@@ -540,10 +528,10 @@ typedef struct ngap_initial_context_setup_req_s {
/* gNB ue ngap id as initialized by NGAP layer */
uint32_t
gNB_ue_ngap_id
;
u
nsigned
long
long
amf_ue_ngap_id
:
40
;
u
int64_t
amf_ue_ngap_id
:
40
;
/* UE aggregate maximum bitrate */
ambr_t
ue_ambr
;
ngap_
ambr_t
ue_ambr
;
/* guami */
ngap_guami_t
guami
;
...
...
@@ -553,7 +541,7 @@ typedef struct ngap_initial_context_setup_req_s {
ngap_allowed_NSSAI_t
allowed_nssai
[
8
];
/* Security algorithms */
n
r
_security_capabilities_t
security_capabilities
;
n
gap
_security_capabilities_t
security_capabilities
;
/* Security key */
uint8_t
security_key
[
SECURITY_KEY_LENGTH
];
...
...
@@ -602,7 +590,7 @@ typedef struct ngap_pdusession_setup_req_s {
uint16_t
ue_initial_id
;
/* AMF UE id */
u
nsigned
long
long
amf_ue_ngap_id
:
40
;
u
int64_t
amf_ue_ngap_id
:
40
;
/* gNB ue ngap id as initialized by NGAP layer */
uint32_t
gNB_ue_ngap_id
;
...
...
@@ -640,14 +628,14 @@ typedef struct ngap_path_switch_req_s {
pdusession_setup_t
pdusessions_tobeswitched
[
NGAP_MAX_PDUSESSION
];
/* AMF UE id */
u
nsigned
long
long
amf_ue_ngap_id
:
40
;
u
int64_t
amf_ue_ngap_id
:
40
;
ngap_guami_t
ue_guami
;
uint16_t
ue_initial_id
;
/* Security algorithms */
n
r
_security_capabilities_t
security_capabilities
;
n
gap
_security_capabilities_t
security_capabilities
;
}
ngap_path_switch_req_t
;
...
...
@@ -659,10 +647,10 @@ typedef struct ngap_path_switch_req_ack_s {
uint32_t
gNB_ue_ngap_id
;
/* AMF UE id */
u
nsigned
long
long
amf_ue_ngap_id
:
40
;
u
int64_t
amf_ue_ngap_id
:
40
;
/* UE aggregate maximum bitrate */
ambr_t
ue_ambr
;
ngap_
ambr_t
ue_ambr
;
/* Number of pdusession setup-ed in the list */
uint8_t
nb_pdusessions_tobeswitched
;
...
...
@@ -687,7 +675,7 @@ typedef struct ngap_pdusession_modification_ind_s {
uint32_t
gNB_ue_ngap_id
;
/* AMF UE id */
u
nsigned
long
long
amf_ue_ngap_id
:
40
;
u
int64_t
amf_ue_ngap_id
:
40
;
/* Number of pdusession setup-ed in the list */
uint8_t
nb_of_pdusessions_tobemodified
;
...
...
@@ -724,7 +712,7 @@ typedef struct ngap_pdusession_modify_req_s {
uint16_t
ue_initial_id
;
/* AMF UE id */
u
nsigned
long
long
amf_ue_ngap_id
:
40
;
u
int64_t
amf_ue_ngap_id
:
40
;
/* gNB ue ngap id as initialized by NGAP layer */
uint32_t
gNB_ue_ngap_id
;
...
...
@@ -757,25 +745,25 @@ typedef struct pdusession_release_s {
typedef
struct
ngap_pdusession_release_command_s
{
/* AMF UE id */
u
nsigned
long
long
amf_ue_ngap_id
:
40
;
u
int64_t
amf_ue_ngap_id
:
40
;
/* gNB ue ngap id as initialized by NGAP layer */
uint32_t
gNB_ue_ngap_id
;
/* The NAS PDU should be forwarded by the RRC layer to the NAS layer */
n
as_pdu_t
nas_pdu
;
n
gap_nas_pdu_t
nas_pdu
;
/* Number of pdusession to be released in the list */
uint8_t
nb_pdusessions_torelease
;
/*
E RAB
release command */
/*
PDUSession
release command */
pdusession_release_t
pdusession_release_params
[
NGAP_MAX_PDUSESSION
];
}
ngap_pdusession_release_command_t
;
typedef
struct
ngap_pdusession_release_resp_s
{
/* AMF UE id */
u
nsigned
long
long
amf_ue_ngap_id
:
40
;
u
int64_t
amf_ue_ngap_id
:
40
;
/* gNB ue ngap id as initialized by NGAP layer */
uint32_t
gNB_ue_ngap_id
;
...
...
openair2/GNB_APP/gnb_config.c
View file @
46f1dc96
...
...
@@ -343,6 +343,7 @@ void RCconfig_nr_flexran()
if
(
!
GNBParamList
.
paramarray
[
i
][
GNB_GNB_ID_IDX
].
uptr
)
{
// Calculate a default gNB ID
if
(
EPC_MODE_ENABLED
)
//gnb_id = i + (ngap_generate_gNB_id () & 0xFFFF8);
gnb_id
=
i
+
(
s1ap_generate_eNB_id
()
&
0xFFFF8
);
else
gnb_id
=
i
;
...
...
@@ -570,6 +571,7 @@ void RCconfig_NRRRC(MessageDef *msg_p, uint32_t i, gNB_RRC_INST *rrc) {
// Calculate a default gNB ID
if
(
EPC_MODE_ENABLED
)
{
uint32_t
hash
;
//hash = ngap_generate_gNB_id ();
hash
=
s1ap_generate_eNB_id
();
gnb_id
=
i
+
(
hash
&
0xFFFF8
);
}
else
{
...
...
@@ -787,6 +789,7 @@ int RCconfig_NR_NG(MessageDef *msg_p, uint32_t i) {
if
(
EPC_MODE_ENABLED
)
{
uint32_t
hash
;
//hash = ngap_generate_gNB_id ();
hash
=
s1ap_generate_eNB_id
();
gnb_id
=
k
+
(
hash
&
0xFFFF8
);
}
else
{
...
...
@@ -1036,6 +1039,7 @@ int RCconfig_NR_X2(MessageDef *msg_p, uint32_t i) {
// Calculate a default eNB ID
if
(
EPC_MODE_ENABLED
)
{
uint32_t
hash
;
//hash = ngap_generate_gNB_id ();
hash
=
s1ap_generate_eNB_id
();
gnb_id
=
k
+
(
hash
&
0xFFFF8
);
}
else
{
...
...
openair3/NGAP/ngap_gNB.c
View file @
46f1dc96
...
...
@@ -194,7 +194,7 @@ void ngap_gNB_handle_register_gNB(instance_t instance, ngap_register_gnb_req_t *
new_instance
->
cell_type
=
ngap_register_gNB
->
cell_type
;
new_instance
->
tac
=
ngap_register_gNB
->
tac
;
memcpy
(
&
new_instance
->
gNB_
s1
_ip
,
memcpy
(
&
new_instance
->
gNB_
ng
_ip
,
&
ngap_register_gNB
->
gnb_ip_address
,
sizeof
(
ngap_register_gNB
->
gnb_ip_address
));
...
...
openair3/NGAP/ngap_gNB_defs.h
View file @
46f1dc96
...
...
@@ -54,7 +54,7 @@ typedef enum {
* originated data transfer E(i.e. reject traffic corresponding to RRC cause
* “mo-data E(TS 36.331 [16])), or
* - “reject all RRC connection establishments for signalling E(i.e. reject
* traffic corresponding to RRC cause “modata Eand “mo-signalling E * (TS 3
6
.331 [16])),or
* traffic corresponding to RRC cause “modata Eand “mo-signalling E * (TS 3
8
.331 [16])),or
* - “only permit RRC connection establishments for emergency sessions and
* mobile terminated services E(i.e. only permit traffic corresponding to RRC
* cause “emergency Eand “mt-Access E(TS 36.331 [16])).
...
...
@@ -125,12 +125,13 @@ struct served_guami_s {
STAILQ_ENTRY
(
served_guami_s
)
next
;
};
/*
slice support
element */
struct
slice_support_s
{
/*
NSSAI
element */
typedef
struct
ngap_gNB_NSSAI_s
{
uint8_t
sST
;
uint8_t
sD_flag
;
uint8_t
sD
[
3
];
};
}
ngap_gNB_NSSAI_t
,
slice_support_s
;
/* plmn support element */
struct
plmn_support_s
{
...
...
@@ -205,12 +206,6 @@ typedef struct ngap_gNB_amf_data_s {
struct
ngap_gNB_instance_s
*
ngap_gNB_instance
;
}
ngap_gNB_amf_data_t
;
typedef
struct
ngap_gNB_NSSAI_s
{
uint8_t
sST
;
uint8_t
sD_flag
;
uint8_t
sD
[
3
];
}
ngap_gNB_NSSAI_t
;
typedef
struct
ngap_gNB_instance_s
{
/* Next ngap gNB association.
* Only used for virtual mode.
...
...
@@ -239,17 +234,17 @@ typedef struct ngap_gNB_instance_s {
/* Unique gNB_id to identify the gNB within EPC.
* In our case the gNB is a macro gNB so the id will be 20 bits long.
* For Home gNB id, this field should be
28
bits long.
* For Home gNB id, this field should be
36
bits long.
*/
uint
32
_t
gNB_id
;
uint
64
_t
gNB_id
;
/* The type of the cell */
enum
cell_type_e
cell_type
;
/* Tracking area code */
uint
16
_t
tac
;
uint
32
_t
tac
;
/* gNB NGAP IP address */
net_ip_address_t
gNB_
s1
_ip
;
net_ip_address_t
gNB_
ng
_ip
;
/* Mobile Country Code
* Mobile Network Code
...
...
@@ -263,7 +258,7 @@ typedef struct ngap_gNB_instance_s {
ngap_gNB_NSSAI_t
s_nssai
[
PLMN_LIST_MAX_SIZE
][
1024
];
/* Default Paging DRX of the gNB as defined in TS 36.304 */
paging_drx_t
default_drx
;
ngap_
paging_drx_t
default_drx
;
}
ngap_gNB_instance_t
;
typedef
struct
{
...
...
openair3/NGAP/ngap_gNB_nas_procedures.c
View file @
46f1dc96
...
...
@@ -59,6 +59,7 @@ int ngap_gNB_handle_nas_first_req(
NGAP_NGAP_PDU_t
pdu
;
NGAP_InitialUEMessage_t
*
out
;
NGAP_InitialUEMessage_IEs_t
*
ie
;
NGAP_UserLocationInformationNR_t
*
userinfo_nr_p
=
NULL
;
uint8_t
*
buffer
=
NULL
;
uint32_t
length
=
0
;
DevAssert
(
ngap_nas_first_req_p
!=
NULL
);
...
...
@@ -67,45 +68,46 @@ int ngap_gNB_handle_nas_first_req(
DevAssert
(
instance_p
!=
NULL
);
memset
(
&
pdu
,
0
,
sizeof
(
pdu
));
pdu
.
present
=
NGAP_NGAP_PDU_PR_initiatingMessage
;
pdu
.
choice
.
initiatingMessage
.
procedureCode
=
NGAP_ProcedureCode_id_
i
nitialUEMessage
;
pdu
.
choice
.
initiatingMessage
.
procedureCode
=
NGAP_ProcedureCode_id_
I
nitialUEMessage
;
pdu
.
choice
.
initiatingMessage
.
criticality
=
NGAP_Criticality_ignore
;
pdu
.
choice
.
initiatingMessage
.
value
.
present
=
NGAP_InitiatingMessage__value_PR_InitialUEMessage
;
out
=
&
pdu
.
choice
.
initiatingMessage
.
value
.
choice
.
InitialUEMessage
;
/* Select the AMF corresponding to the provided GUAMI. */
if
(
ngap_nas_first_req_p
->
ue_identity
.
presenceMask
&
UE_IDENTITIES_guami
)
{
if
(
ngap_nas_first_req_p
->
ue_identity
.
presenceMask
&
NGAP_
UE_IDENTITIES_guami
)
{
amf_desc_p
=
ngap_gNB_nnsf_select_amf_by_guami
(
instance_p
,
ngap_nas_first_req_p
->
establishment_cause
,
ngap_nas_first_req_p
->
ue_identity
.
guami
);
if
(
amf_desc_p
)
{
NGAP_INFO
(
"[gNB %d] Chose AMF '%s' (assoc_id %d) through GUAMI MCC %d MNC %d AMF
GI %d AMFC
%d
\n
"
,
NGAP_INFO
(
"[gNB %d] Chose AMF '%s' (assoc_id %d) through GUAMI MCC %d MNC %d AMF
RI %d AMFSI %d AMFPT
%d
\n
"
,
instance
,
amf_desc_p
->
amf_name
,
amf_desc_p
->
assoc_id
,
ngap_nas_first_req_p
->
ue_identity
.
guami
.
mcc
,
ngap_nas_first_req_p
->
ue_identity
.
guami
.
mnc
,
ngap_nas_first_req_p
->
ue_identity
.
guami
.
amf_group_id
,
ngap_nas_first_req_p
->
ue_identity
.
guami
.
amf_code
);
ngap_nas_first_req_p
->
ue_identity
.
guami
.
amf_region_id
,
ngap_nas_first_req_p
->
ue_identity
.
guami
.
amf_set_id
,
ngap_nas_first_req_p
->
ue_identity
.
guami
.
amf_pointer
);
}
}
if
(
amf_desc_p
==
NULL
)
{
/* Select the AMF corresponding to the provided s-TMSI. */
if
(
ngap_nas_first_req_p
->
ue_identity
.
presenceMask
&
UE_IDENTITIES
_s_tmsi
)
{
amf_desc_p
=
ngap_gNB_nnsf_select_amf_by_amf_
code
(
if
(
ngap_nas_first_req_p
->
ue_identity
.
presenceMask
&
NGAP_UE_IDENTITIES_FiveG
_s_tmsi
)
{
amf_desc_p
=
ngap_gNB_nnsf_select_amf_by_amf_
setid
(
instance_p
,
ngap_nas_first_req_p
->
establishment_cause
,
ngap_nas_first_req_p
->
selected_plmn_identity
,
ngap_nas_first_req_p
->
ue_identity
.
s_tmsi
.
amf_
code
);
ngap_nas_first_req_p
->
ue_identity
.
s_tmsi
.
amf_
set_id
);
if
(
amf_desc_p
)
{
NGAP_INFO
(
"[gNB %d] Chose AMF '%s' (assoc_id %d) through S-TMSI AMF
C
%d and selected PLMN Identity index %d MCC %d MNC %d
\n
"
,
NGAP_INFO
(
"[gNB %d] Chose AMF '%s' (assoc_id %d) through S-TMSI AMF
SI
%d and selected PLMN Identity index %d MCC %d MNC %d
\n
"
,
instance
,
amf_desc_p
->
amf_name
,
amf_desc_p
->
assoc_id
,
ngap_nas_first_req_p
->
ue_identity
.
s_tmsi
.
amf_
code
,
ngap_nas_first_req_p
->
ue_identity
.
s_tmsi
.
amf_
set_id
,
ngap_nas_first_req_p
->
selected_plmn_identity
,
instance_p
->
mcc
[
ngap_nas_first_req_p
->
selected_plmn_identity
],
instance_p
->
mnc
[
ngap_nas_first_req_p
->
selected_plmn_identity
]);
...
...
@@ -173,11 +175,11 @@ int ngap_gNB_handle_nas_first_req(
do
{
struct
ngap_gNB_ue_context_s
*
collision_p
;
/* Peek a random value for the gNB_ue_ngap_id */
ue_desc_p
->
gNB_ue_ngap_id
=
(
random
()
+
random
())
&
0x
00
ffffff
;
ue_desc_p
->
gNB_ue_ngap_id
=
(
random
()
+
random
())
&
0x
ff
ffffff
;
if
((
collision_p
=
RB_INSERT
(
ngap_ue_map
,
&
instance_p
->
ngap_ue_head
,
ue_desc_p
))
==
NULL
)
{
NGAP_DEBUG
(
"Found usable gNB_ue_ngap_id: 0x%0
6
x %u(10)
\n
"
,
NGAP_DEBUG
(
"Found usable gNB_ue_ngap_id: 0x%0
8
x %u(10)
\n
"
,
ue_desc_p
->
gNB_ue_ngap_id
,
ue_desc_p
->
gNB_ue_ngap_id
);
/* Break the loop as the id is not already used by another UE */
...
...
@@ -187,10 +189,10 @@ int ngap_gNB_handle_nas_first_req(
/* mandatory */
ie
=
(
NGAP_InitialUEMessage_IEs_t
*
)
calloc
(
1
,
sizeof
(
NGAP_InitialUEMessage_IEs_t
));
ie
->
id
=
NGAP_ProtocolIE_ID_id_
gNB
_UE_NGAP_ID
;
ie
->
id
=
NGAP_ProtocolIE_ID_id_
RAN
_UE_NGAP_ID
;
ie
->
criticality
=
NGAP_Criticality_reject
;
ie
->
value
.
present
=
NGAP_InitialUEMessage_IEs__value_PR_
GNB
_UE_NGAP_ID
;
ie
->
value
.
choice
.
GNB
_UE_NGAP_ID
=
ue_desc_p
->
gNB_ue_ngap_id
;
ie
->
value
.
present
=
NGAP_InitialUEMessage_IEs__value_PR_
RAN
_UE_NGAP_ID
;
ie
->
value
.
choice
.
RAN
_UE_NGAP_ID
=
ue_desc_p
->
gNB_ue_ngap_id
;
ASN_SEQUENCE_ADD
(
&
out
->
protocolIEs
.
list
,
ie
);
/* mandatory */
ie
=
(
NGAP_InitialUEMessage_IEs_t
*
)
calloc
(
1
,
sizeof
(
NGAP_InitialUEMessage_IEs_t
));
...
...
@@ -207,81 +209,72 @@ int ngap_gNB_handle_nas_first_req(
#endif
ie
->
value
.
choice
.
NAS_PDU
.
size
=
ngap_nas_first_req_p
->
nas_pdu
.
length
;
ASN_SEQUENCE_ADD
(
&
out
->
protocolIEs
.
list
,
ie
);
/* mandatory */
ie
=
(
NGAP_InitialUEMessage_IEs_t
*
)
calloc
(
1
,
sizeof
(
NGAP_InitialUEMessage_IEs_t
));
ie
->
id
=
NGAP_ProtocolIE_ID_id_
TAI
;
ie
->
id
=
NGAP_ProtocolIE_ID_id_
UserLocationInformation
;
ie
->
criticality
=
NGAP_Criticality_reject
;
ie
->
value
.
present
=
NGAP_InitialUEMessage_IEs__value_PR_TAI
;
/* Assuming TAI is the TAI from the cell */
INT16_TO_OCTET_STRING
(
instance_p
->
tac
,
&
ie
->
value
.
choice
.
TAI
.
tAC
);
MCC_MNC_TO_PLMNID
(
instance_p
->
mcc
[
ue_desc_p
->
selected_plmn_identity
],
instance_p
->
mnc
[
ue_desc_p
->
selected_plmn_identity
],
instance_p
->
mnc_digit_length
[
ue_desc_p
->
selected_plmn_identity
],
&
ie
->
value
.
choice
.
TAI
.
pLMNidentity
);
ASN_SEQUENCE_ADD
(
&
out
->
protocolIEs
.
list
,
ie
);
/* mandatory */
ie
=
(
NGAP_InitialUEMessage_IEs_t
*
)
calloc
(
1
,
sizeof
(
NGAP_InitialUEMessage_IEs_t
));
ie
->
id
=
NGAP_ProtocolIE_ID_id_EUTRAN_CGI
;
ie
->
criticality
=
NGAP_Criticality_ignore
;
ie
->
value
.
present
=
NGAP_InitialUEMessage_IEs__value_PR_EUTRAN_CGI
;
/* Set the EUTRAN CGI
* The cell identity is defined on 28 bits but as we use macro enb id,
* we have to pad.
*/
//#warning "TODO get cell id from RRC"
ie
->
value
.
present
=
NGAP_InitialUEMessage_IEs__value_PR_UserLocationInformation
;
ie
->
value
.
choice
.
UserLocationInformation
.
present
=
NGAP_UserLocationInformation_PR_userLocationInformationNR
;
userinfo_nr_p
=
&
ie
->
value
.
choice
.
UserLocationInformation
.
choice
.
userLocationInformationNR
;
/* Set nRCellIdentity. default userLocationInformationNR */
MACRO_GNB_ID_TO_CELL_IDENTITY
(
instance_p
->
gNB_id
,
0
,
// Cell ID
&
ie
->
value
.
choice
.
EUTRAN_CGI
.
cell_ID
);
&
userinfo_nr_p
->
nR_CGI
.
nRCellIdentity
);
MCC_MNC_TO_TBCD
(
instance_p
->
mcc
[
ue_desc_p
->
selected_plmn_identity
],
instance_p
->
mnc
[
ue_desc_p
->
selected_plmn_identity
],
instance_p
->
mnc_digit_length
[
ue_desc_p
->
selected_plmn_identity
],
&
ie
->
value
.
choice
.
EUTRAN_CGI
.
pLMNidentity
);
&
userinfo_nr_p
->
nR_CGI
.
pLMNIdentity
);
/* Set TAI */
INT24_TO_OCTET_STRING
(
instance_p
->
tac
,
&
userinfo_nr_p
->
tAI
.
tAC
);
MCC_MNC_TO_PLMNID
(
instance_p
->
mcc
[
ue_desc_p
->
selected_plmn_identity
],
instance_p
->
mnc
[
ue_desc_p
->
selected_plmn_identity
],
instance_p
->
mnc_digit_length
[
ue_desc_p
->
selected_plmn_identity
],
&
userinfo_nr_p
->
tAI
.
pLMNIdentity
);
ASN_SEQUENCE_ADD
(
&
out
->
protocolIEs
.
list
,
ie
);
/* Set the establishment cause according to those provided by RRC */
DevCheck
(
ngap_nas_first_req_p
->
establishment_cause
<
RRC_CAUSE_LAST
,
ngap_nas_first_req_p
->
establishment_cause
,
RRC_CAUSE_LAST
,
0
);
DevCheck
(
ngap_nas_first_req_p
->
establishment_cause
<
NGAP_RRC_CAUSE_LAST
,
ngap_nas_first_req_p
->
establishment_cause
,
NGAP_RRC_CAUSE_LAST
,
0
);
/* mandatory */
ie
=
(
NGAP_InitialUEMessage_IEs_t
*
)
calloc
(
1
,
sizeof
(
NGAP_InitialUEMessage_IEs_t
));
ie
->
id
=
NGAP_ProtocolIE_ID_id_RRC
_Establishment_
Cause
;
ie
->
id
=
NGAP_ProtocolIE_ID_id_RRC
Establishment
Cause
;
ie
->
criticality
=
NGAP_Criticality_ignore
;
ie
->
value
.
present
=
NGAP_InitialUEMessage_IEs__value_PR_RRC
_Establishment_
Cause
;
ie
->
value
.
choice
.
RRC
_Establishment_
Cause
=
ngap_nas_first_req_p
->
establishment_cause
;
ie
->
value
.
present
=
NGAP_InitialUEMessage_IEs__value_PR_RRC
Establishment
Cause
;
ie
->
value
.
choice
.
RRC
Establishment
Cause
=
ngap_nas_first_req_p
->
establishment_cause
;
ASN_SEQUENCE_ADD
(
&
out
->
protocolIEs
.
list
,
ie
);
/* optional */
if
(
ngap_nas_first_req_p
->
ue_identity
.
presenceMask
&
UE_IDENTITIES
_s_tmsi
)
{
NGAP_DEBUG
(
"S_TMSI_PRESENT
\n
"
);
if
(
ngap_nas_first_req_p
->
ue_identity
.
presenceMask
&
NGAP_UE_IDENTITIES_FiveG
_s_tmsi
)
{
NGAP_DEBUG
(
"
FIVEG_
S_TMSI_PRESENT
\n
"
);
ie
=
(
NGAP_InitialUEMessage_IEs_t
*
)
calloc
(
1
,
sizeof
(
NGAP_InitialUEMessage_IEs_t
));
ie
->
id
=
NGAP_ProtocolIE_ID_id_S_TMSI
;
ie
->
id
=
NGAP_ProtocolIE_ID_id_
FiveG_
S_TMSI
;
ie
->
criticality
=
NGAP_Criticality_reject
;
ie
->
value
.
present
=
NGAP_InitialUEMessage_IEs__value_PR_S_TMSI
;
AMF_CODE_TO_OCTET_STRING
(
ngap_nas_first_req_p
->
ue_identity
.
s_tmsi
.
amf_code
,
&
ie
->
value
.
choice
.
S_TMSI
.
mMEC
);
ie
->
value
.
present
=
NGAP_InitialUEMessage_IEs__value_PR_FiveG_S_TMSI
;
AMF_SETID_TO_BIT_STRING
(
ngap_nas_first_req_p
->
ue_identity
.
s_tmsi
.
amf_set_id
,
&
ie
->
value
.
choice
.
FiveG_S_TMSI
.
aMFSetID
);
AMF_SETID_TO_BIT_STRING
(
ngap_nas_first_req_p
->
ue_identity
.
s_tmsi
.
amf_pointer
,
&
ie
->
value
.
choice
.
FiveG_S_TMSI
.
aMFPointer
);
M_TMSI_TO_OCTET_STRING
(
ngap_nas_first_req_p
->
ue_identity
.
s_tmsi
.
m_tmsi
,
&
ie
->
value
.
choice
.
S_TMSI
.
m
_TMSI
);
&
ie
->
value
.
choice
.
FiveG_S_TMSI
.
fiveG
_TMSI
);
ASN_SEQUENCE_ADD
(
&
out
->
protocolIEs
.
list
,
ie
);
}
/* optional */
if
(
ngap_nas_first_req_p
->
ue_identity
.
presenceMask
&
UE_IDENTITIES_guami
)
{
NGAP_DEBUG
(
"GUAMI_ID_PRESENT
\n
"
);
ie
=
(
NGAP_InitialUEMessage_IEs_t
*
)
calloc
(
1
,
sizeof
(
NGAP_InitialUEMessage_IEs_t
));
ie
->
id
=
NGAP_ProtocolIE_ID_id_GUAMI_ID
;
ie
->
criticality
=
NGAP_Criticality_reject
;
ie
->
value
.
present
=
NGAP_InitialUEMessage_IEs__value_PR_GUAMI
;
MCC_MNC_TO_PLMNID
(
ngap_nas_first_req_p
->
ue_identity
.
guami
.
mcc
,
ngap_nas_first_req_p
->
ue_identity
.
guami
.
mnc
,
ngap_nas_first_req_p
->
ue_identity
.
guami
.
mnc_len
,
&
ie
->
value
.
choice
.
GUAMI
.
pLMN_Identity
);
AMF_GID_TO_OCTET_STRING
(
ngap_nas_first_req_p
->
ue_identity
.
guami
.
amf_group_id
,
&
ie
->
value
.
choice
.
GUAMI
.
mME_Group_ID
);
AMF_CODE_TO_OCTET_STRING
(
ngap_nas_first_req_p
->
ue_identity
.
guami
.
amf_code
,
&
ie
->
value
.
choice
.
GUAMI
.
mME_Code
);
ie
->
id
=
NGAP_ProtocolIE_ID_id_UEContextRequest
;
ie
->
criticality
=
NGAP_Criticality_ignore
;
ie
->
value
.
present
=
NGAP_InitialUEMessage_IEs__value_PR_UEContextRequest
;
ie
->
value
.
choice
.
UEContextRequest
=
NGAP_UEContextRequest_requested
;
ASN_SEQUENCE_ADD
(
&
out
->
protocolIEs
.
list
,
ie
);
}
if
(
ngap_gNB_encode_pdu
(
&
pdu
,
&
buffer
,
&
length
)
<
0
)
{
...
...
@@ -292,7 +285,7 @@ int ngap_gNB_handle_nas_first_req(
/* Update the current NGAP UE state */
ue_desc_p
->
ue_state
=
NGAP_UE_WAITING_CSR
;
/* Assign a stream for this UE :
* From 3GPP 3
6
.412 7)Transport layers:
* From 3GPP 3
8
.412 7)Transport layers:
* Within the SCTP association established between one AMF and gNB pair:
* - a single pair of stream identifiers shall be reserved for the sole use
* of NGAP elementary procedures that utilize non UE-associated signalling.
...
...
openair3/NGAP/ngap_gNB_nnsf.c
View file @
46f1dc96
...
...
@@ -38,7 +38,7 @@
struct
ngap_gNB_amf_data_s
*
ngap_gNB_nnsf_select_amf
(
ngap_gNB_instance_t
*
instance_p
,
rrc_establishment_cause_t
cause
)
ngap_
rrc_establishment_cause_t
cause
)
{
struct
ngap_gNB_amf_data_s
*
amf_data_p
=
NULL
;
struct
ngap_gNB_amf_data_s
*
amf_highest_capacity_p
=
NULL
;
...
...
@@ -54,19 +54,19 @@ ngap_gNB_nnsf_select_amf(ngap_gNB_instance_t *instance_p,
* cause and take decision to the select this AMF depending on
* the overload state.
*/
if
((
cause
==
RRC_CAUSE_MO_DATA
)
if
((
cause
==
NGAP_
RRC_CAUSE_MO_DATA
)
&&
(
amf_data_p
->
overload_state
==
NGAP_OVERLOAD_REJECT_MO_DATA
))
{
continue
;
}
if
((
amf_data_p
->
overload_state
==
NGAP_OVERLOAD_REJECT_ALL_SIGNALLING
)
&&
((
cause
==
RRC_CAUSE_MO_SIGNALLING
)
||
(
cause
==
RRC_CAUSE_MO_DATA
)))
{
&&
((
cause
==
NGAP_RRC_CAUSE_MO_SIGNALLING
)
||
(
cause
==
NGAP_
RRC_CAUSE_MO_DATA
)))
{
continue
;
}
if
((
amf_data_p
->
overload_state
==
NGAP_OVERLOAD_ONLY_EMERGENCY_AND_MT
)
&&
((
cause
==
RRC_CAUSE_MO_SIGNALLING
)
||
(
cause
==
RRC_CAUSE_MO_DATA
)
||
(
cause
==
RRC_CAUSE_HIGH_PRIO_ACCESS
)))
{
&&
((
cause
==
NGAP_RRC_CAUSE_MO_SIGNALLING
)
||
(
cause
==
NGAP_
RRC_CAUSE_MO_DATA
)
||
(
cause
==
NGAP_
RRC_CAUSE_HIGH_PRIO_ACCESS
)))
{
continue
;
}
...
...
@@ -91,7 +91,7 @@ ngap_gNB_nnsf_select_amf(ngap_gNB_instance_t *instance_p,
struct
ngap_gNB_amf_data_s
*
ngap_gNB_nnsf_select_amf_by_plmn_id
(
ngap_gNB_instance_t
*
instance_p
,
rrc_establishment_cause_t
cause
,
ngap_
rrc_establishment_cause_t
cause
,
int
selected_plmn_identity
)
{
struct
ngap_gNB_amf_data_s
*
amf_data_p
=
NULL
;
...
...
@@ -110,19 +110,19 @@ ngap_gNB_nnsf_select_amf_by_plmn_id(ngap_gNB_instance_t *instance_p,
* cause and take decision to the select this AMF depending on
* the overload state.
*/
if
((
cause
==
RRC_CAUSE_MO_DATA
)
if
((
cause
==
NGAP_
RRC_CAUSE_MO_DATA
)
&&
(
amf_data_p
->
overload_state
==
NGAP_OVERLOAD_REJECT_MO_DATA
))
{
continue
;
}
if
((
amf_data_p
->
overload_state
==
NGAP_OVERLOAD_REJECT_ALL_SIGNALLING
)
&&
((
cause
==
RRC_CAUSE_MO_SIGNALLING
)
||
(
cause
==
RRC_CAUSE_MO_DATA
)))
{
&&
((
cause
==
NGAP_RRC_CAUSE_MO_SIGNALLING
)
||
(
cause
==
NGAP_
RRC_CAUSE_MO_DATA
)))
{
continue
;
}
if
((
amf_data_p
->
overload_state
==
NGAP_OVERLOAD_ONLY_EMERGENCY_AND_MT
)
&&
((
cause
==
RRC_CAUSE_MO_SIGNALLING
)
||
(
cause
==
RRC_CAUSE_MO_DATA
)
||
(
cause
==
RRC_CAUSE_HIGH_PRIO_ACCESS
)))
{
&&
((
cause
==
NGAP_RRC_CAUSE_MO_SIGNALLING
)
||
(
cause
==
NGAP_
RRC_CAUSE_MO_DATA
)
||
(
cause
==
NGAP_
RRC_CAUSE_HIGH_PRIO_ACCESS
)))
{
continue
;
}
...
...
@@ -160,10 +160,10 @@ ngap_gNB_nnsf_select_amf_by_plmn_id(ngap_gNB_instance_t *instance_p,
}
struct
ngap_gNB_amf_data_s
*
ngap_gNB_nnsf_select_amf_by_amf_
code
(
ngap_gNB_instance_t
*
instance_p
,
rrc_establishment_cause_t
cause
,
ngap_gNB_nnsf_select_amf_by_amf_
setid
(
ngap_gNB_instance_t
*
instance_p
,
ngap_
rrc_establishment_cause_t
cause
,
int
selected_plmn_identity
,
uint8_t
amf_
code
)
uint8_t
amf_
setid
)
{
struct
ngap_gNB_amf_data_s
*
amf_data_p
=
NULL
;
...
...
@@ -179,19 +179,19 @@ ngap_gNB_nnsf_select_amf_by_amf_code(ngap_gNB_instance_t *instance_p,
* cause and take decision to the select this AMF depending on
* the overload state.
*/
if
((
cause
==
RRC_CAUSE_MO_DATA
)
if
((
cause
==
NGAP_
RRC_CAUSE_MO_DATA
)
&&
(
amf_data_p
->
overload_state
==
NGAP_OVERLOAD_REJECT_MO_DATA
))
{
continue
;
}
if
((
amf_data_p
->
overload_state
==
NGAP_OVERLOAD_REJECT_ALL_SIGNALLING
)
&&
((
cause
==
RRC_CAUSE_MO_SIGNALLING
)
||
(
cause
==
RRC_CAUSE_MO_DATA
)))
{
&&
((
cause
==
NGAP_RRC_CAUSE_MO_SIGNALLING
)
||
(
cause
==
NGAP_
RRC_CAUSE_MO_DATA
)))
{
continue
;
}
if
((
amf_data_p
->
overload_state
==
NGAP_OVERLOAD_ONLY_EMERGENCY_AND_MT
)
&&
((
cause
==
RRC_CAUSE_MO_SIGNALLING
)
||
(
cause
==
RRC_CAUSE_MO_DATA
)
||
(
cause
==
RRC_CAUSE_HIGH_PRIO_ACCESS
)))
{
&&
((
cause
==
NGAP_RRC_CAUSE_MO_SIGNALLING
)
||
(
cause
==
NGAP_
RRC_CAUSE_MO_DATA
)
||
(
cause
==
NGAP_
RRC_CAUSE_HIGH_PRIO_ACCESS
)))
{
continue
;
}
...
...
@@ -206,7 +206,7 @@ ngap_gNB_nnsf_select_amf_by_amf_code(ngap_gNB_instance_t *instance_p,
/* Looking for AMF code matching the one provided by NAS */
STAILQ_FOREACH
(
guami_p
,
&
amf_data_p
->
served_guami
,
next
)
{
struct
amf_
code_s
*
amf_code
_p
=
NULL
;
struct
amf_
set_id_s
*
amf_setid
_p
=
NULL
;
struct
plmn_identity_s
*
served_plmn_p
=
NULL
;
STAILQ_FOREACH
(
served_plmn_p
,
&
guami_p
->
served_plmns
,
next
)
{
...
...
@@ -215,8 +215,8 @@ ngap_gNB_nnsf_select_amf_by_amf_code(ngap_gNB_instance_t *instance_p,
break
;
}
}
STAILQ_FOREACH
(
amf_
code_p
,
&
guami_p
->
amf_code
s
,
next
)
{
if
(
amf_
code_p
->
amf_code
==
amf_code
)
{
STAILQ_FOREACH
(
amf_
setid_p
,
&
guami_p
->
amf_set_id
s
,
next
)
{
if
(
amf_
setid_p
->
amf_set_id
==
amf_setid
)
{
break
;
}
}
...
...
@@ -225,7 +225,7 @@ ngap_gNB_nnsf_select_amf_by_amf_code(ngap_gNB_instance_t *instance_p,
* the AMF is knwown and the association is ready.
* Return the reference to the AMF to use it for this UE.
*/
if
(
amf_
code
_p
&&
served_plmn_p
)
{
if
(
amf_
setid
_p
&&
served_plmn_p
)
{
return
amf_data_p
;
}
}
...
...
@@ -239,7 +239,7 @@ ngap_gNB_nnsf_select_amf_by_amf_code(ngap_gNB_instance_t *instance_p,
struct
ngap_gNB_amf_data_s
*
ngap_gNB_nnsf_select_amf_by_guami
(
ngap_gNB_instance_t
*
instance_p
,
rrc_establishment_cause_t
cause
,
ngap_
rrc_establishment_cause_t
cause
,
ngap_guami_t
guami
)
{
struct
ngap_gNB_amf_data_s
*
amf_data_p
=
NULL
;
...
...
@@ -256,19 +256,19 @@ ngap_gNB_nnsf_select_amf_by_guami(ngap_gNB_instance_t *instance_p,
* cause and take decision to the select this AMF depending on
* the overload state.
*/
if
((
cause
==
RRC_CAUSE_MO_DATA
)
if
((
cause
==
NGAP_
RRC_CAUSE_MO_DATA
)
&&
(
amf_data_p
->
overload_state
==
NGAP_OVERLOAD_REJECT_MO_DATA
))
{
continue
;
}
if
((
amf_data_p
->
overload_state
==
NGAP_OVERLOAD_REJECT_ALL_SIGNALLING
)
&&
((
cause
==
RRC_CAUSE_MO_SIGNALLING
)
||
(
cause
==
RRC_CAUSE_MO_DATA
)))
{
&&
((
cause
==
NGAP_RRC_CAUSE_MO_SIGNALLING
)
||
(
cause
==
NGAP_
RRC_CAUSE_MO_DATA
)))
{
continue
;
}
if
((
amf_data_p
->
overload_state
==
NGAP_OVERLOAD_ONLY_EMERGENCY_AND_MT
)
&&
((
cause
==
RRC_CAUSE_MO_SIGNALLING
)
||
(
cause
==
RRC_CAUSE_MO_DATA
)
||
(
cause
==
RRC_CAUSE_HIGH_PRIO_ACCESS
)))
{
&&
((
cause
==
NGAP_RRC_CAUSE_MO_SIGNALLING
)
||
(
cause
==
NGAP_
RRC_CAUSE_MO_DATA
)
||
(
cause
==
NGAP_
RRC_CAUSE_HIGH_PRIO_ACCESS
)))
{
continue
;
}
...
...
@@ -283,8 +283,9 @@ ngap_gNB_nnsf_select_amf_by_guami(ngap_gNB_instance_t *instance_p,
/* Looking for AMF guami matching the one provided by NAS */
STAILQ_FOREACH
(
guami_p
,
&
amf_data_p
->
served_guami
,
next
)
{
struct
served_group_id_s
*
group_id_p
=
NULL
;
struct
amf_code_s
*
amf_code_p
=
NULL
;
struct
served_region_id_s
*
region_id_p
=
NULL
;
struct
amf_set_id_s
*
amf_set_id_p
=
NULL
;
struct
amf_pointer_s
*
pointer_p
=
NULL
;
struct
plmn_identity_s
*
served_plmn_p
=
NULL
;
STAILQ_FOREACH
(
served_plmn_p
,
&
guami_p
->
served_plmns
,
next
)
{
...
...
@@ -293,13 +294,19 @@ ngap_gNB_nnsf_select_amf_by_guami(ngap_gNB_instance_t *instance_p,
break
;
}
}
STAILQ_FOREACH
(
amf_code_p
,
&
guami_p
->
amf_codes
,
next
)
{
if
(
amf_code_p
->
amf_code
==
guami
.
amf_code
)
{
STAILQ_FOREACH
(
region_id_p
,
&
guami_p
->
served_region_ids
,
next
)
{
if
(
region_id_p
->
amf_region_id
==
guami
.
amf_region_id
)
{
break
;
}
}
STAILQ_FOREACH
(
group_id_p
,
&
guami_p
->
served_group_ids
,
next
)
{
if
(
group_id_p
->
amf_group_id
==
guami
.
amf_group_id
)
{
STAILQ_FOREACH
(
amf_set_id_p
,
&
guami_p
->
amf_set_ids
,
next
)
{
if
(
amf_set_id_p
->
amf_set_id
==
guami
.
amf_set_id
)
{
break
;
}
}
STAILQ_FOREACH
(
pointer_p
,
&
guami_p
->
amf_pointers
,
next
)
{
if
(
pointer_p
->
amf_pointer
==
guami
.
amf_pointer
)
{
break
;
}
}
...
...
@@ -308,8 +315,9 @@ ngap_gNB_nnsf_select_amf_by_guami(ngap_gNB_instance_t *instance_p,
* the AMF is knwown and the association is ready.
* Return the reference to the AMF to use it for this UE.
*/
if
((
group_id_p
!=
NULL
)
&&
(
amf_code_p
!=
NULL
)
&&
if
((
region_id_p
!=
NULL
)
&&
(
amf_set_id_p
!=
NULL
)
&&
(
pointer_p
!=
NULL
)
&&
(
served_plmn_p
!=
NULL
))
{
return
amf_data_p
;
}
...
...
openair3/NGAP/ngap_gNB_nnsf.h
View file @
46f1dc96
...
...
@@ -24,22 +24,22 @@
struct
ngap_gNB_amf_data_s
*
ngap_gNB_nnsf_select_amf
(
ngap_gNB_instance_t
*
instance_p
,
rrc_establishment_cause_t
cause
);
ngap_
rrc_establishment_cause_t
cause
);
struct
ngap_gNB_amf_data_s
*
ngap_gNB_nnsf_select_amf_by_plmn_id
(
ngap_gNB_instance_t
*
instance_p
,
rrc_establishment_cause_t
cause
,
ngap_
rrc_establishment_cause_t
cause
,
int
selected_plmn_identity
);
struct
ngap_gNB_amf_data_s
*
ngap_gNB_nnsf_select_amf_by_amf_
code
(
ngap_gNB_instance_t
*
instance_p
,
rrc_establishment_cause_t
cause
,
ngap_gNB_nnsf_select_amf_by_amf_
setid
(
ngap_gNB_instance_t
*
instance_p
,
ngap_
rrc_establishment_cause_t
cause
,
int
selected_plmn_identity
,
uint8_t
amf_
code
);
uint8_t
amf_
setid
);
struct
ngap_gNB_amf_data_s
*
ngap_gNB_nnsf_select_amf_by_guami
(
ngap_gNB_instance_t
*
instance_p
,
rrc_establishment_cause_t
cause
,
ngap_
rrc_establishment_cause_t
cause
,
ngap_guami_t
guami
);
struct
ngap_gNB_amf_data_s
*
...
...
openair3/UTILS/conversions.h
View file @
46f1dc96
...
...
@@ -81,6 +81,23 @@ do { \
((buf)[1]); \
} while(0)
/* Convert an integer on 24 bits to the given bUFFER */
#define INT24_TO_BUFFER(x, buf) \
do { \
(buf)[0] = (x) >> 16; \
(buf)[1] = (x) >> 8; \
(buf)[2] = (x); \
} while(0)
/* Convert an array of char containing vALUE to x */
#define BUFFER_TO_INT24(buf, x) \
do { \
x = ((buf)[0] << 16) | \
((buf)[1] << 8 ) | \
((buf)[2]); \
} while(0)
/* Convert an integer on 32 bits to the given bUFFER */
#define INT32_TO_BUFFER(x, buf) \
do { \
...
...
@@ -126,6 +143,21 @@ do { \
(aSN)->bits_unused = 0; \
} while(0)
#define INT24_TO_OCTET_STRING(x, aSN) \
do { \
(aSN)->buf = calloc(3, sizeof(uint8_t)); \
INT24_TO_BUFFER(x, ((aSN)->buf)); \
(aSN)->size = 3; \
} while(0)
#define INT24_TO_BIT_STRING(x, aSN) \
do { \
INT24_TO_OCTET_STRING(x, aSN); \
(aSN)->bits_unused = 0; \
} while(0)
#define INT8_TO_OCTET_STRING(x, aSN) \
do { \
(aSN)->buf = calloc(1, sizeof(uint8_t)); \
...
...
@@ -137,6 +169,25 @@ do { \
#define M_TMSI_TO_OCTET_STRING INT32_TO_OCTET_STRING
#define MME_GID_TO_OCTET_STRING INT16_TO_OCTET_STRING
#define AMF_REGION_TO_BIT_STRING(x, aSN) \
do { \
INT8_TO_OCTET_STRING(x, aSN); \
(aSN)->bits_unused = 0; \
} while(0)
#define AMF_SETID_TO_BIT_STRING(x, aSN) \
do { \
INT16_TO_OCTET_STRING(x, aSN); \
(aSN)->bits_unused = 6; \
} while(0)
#define AMF_POINTER_TO_BIT_STRING(x, aSN) \
do { \
INT8_TO_OCTET_STRING(x, aSN); \
(aSN)->bits_unused = 2; \
} while(0)
#define ENCRALG_TO_BIT_STRING(encralg, bitstring) \
do { \
(bitstring)->size=2; \
...
...
@@ -197,6 +248,12 @@ do { \
BUFFER_TO_INT16((aSN)->buf, x); \
} while(0)
#define OCTET_STRING_TO_INT24(aSN, x) \
do { \
DevCheck((aSN)->size == 2 || (aSN)->size == 3, (aSN)->size, 0, 0); \
BUFFER_TO_INT24((aSN)->buf, x); \
} while(0)
#define OCTET_STRING_TO_INT32(aSN, x) \
do { \
DevCheck((aSN)->size == 4, (aSN)->size, 0, 0); \
...
...
@@ -462,6 +519,19 @@ do { \
(bITsTRING)->bits_unused = 4; \
} while(0)
#define MACRO_GNB_ID_TO_CELL_IDENTITY(mACRO, cELL_iD, bITsTRING) \
do { \
(bITsTRING)->buf = calloc(5, sizeof(uint8_t)); \
(bITsTRING)->buf[0] = ((mACRO) >> 20); \
(bITsTRING)->buf[1] = (mACRO) >> 12; \
(bITsTRING)->buf[2] = (mACRO) >> 4; \
(bITsTRING)->buf[3] = (((mACRO) & 0x0f) << 4) | ((cELL_iD) >> 4); \
(bITsTRING)->buf[4] = ((cELL_iD) & 0x0f) << 4; \
(bITsTRING)->size = 5; \
(bITsTRING)->bits_unused = 4; \
} while(0)
/* Used to format an uint32_t containing an ipv4 address */
#define IPV4_ADDR "%u.%u.%u.%u"
#define IPV4_ADDR_FORMAT(aDDRESS) \
...
...
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