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
ZhouShuya
OpenXG-RAN
Commits
5dc6712c
Commit
5dc6712c
authored
Sep 11, 2020
by
zhenghuangkun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add InitialUEMessage And InitialContextSetupRequest Message
parent
c8b67cb1
Changes
8
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
105 additions
and
54 deletions
+105
-54
openair2/COMMON/ngap_messages_types.h
openair2/COMMON/ngap_messages_types.h
+18
-5
openair2/GNB_APP/gnb_config.c
openair2/GNB_APP/gnb_config.c
+7
-11
openair3/NGAP/ngap_gNB_defs.h
openair3/NGAP/ngap_gNB_defs.h
+11
-2
openair3/NGAP/ngap_gNB_handlers.c
openair3/NGAP/ngap_gNB_handlers.c
+44
-11
openair3/NGAP/ngap_gNB_nas_procedures.c
openair3/NGAP/ngap_gNB_nas_procedures.c
+5
-6
openair3/NGAP/ngap_gNB_nnsf.c
openair3/NGAP/ngap_gNB_nnsf.c
+11
-11
openair3/NGAP/ngap_gNB_ue_context.h
openair3/NGAP/ngap_gNB_ue_context.h
+3
-3
openair3/UTILS/conversions.h
openair3/UTILS/conversions.h
+6
-5
No files found.
openair2/COMMON/ngap_messages_types.h
View file @
5dc6712c
...
...
@@ -195,6 +195,12 @@ typedef struct fiveg_s_tmsi_s {
uint32_t
m_tmsi
;
}
fiveg_s_tmsi_t
;
typedef
struct
ngap_tai_plmn_identity_s
{
uint16_t
mcc
;
uint16_t
mnc
;
uint8_t
mnc_digit_length
;
}
ngap_plmn_identity_t
;
typedef
struct
ngap_ue_paging_identity_s
{
fiveg_s_tmsi_t
s_tmsi
;
}
ngap_ue_paging_identity_t
;
...
...
@@ -218,6 +224,10 @@ typedef struct ngap_nas_pdu_s {
uint32_t
length
;
}
ngap_nas_pdu_t
,
ngap_ue_radio_cap_t
;
typedef
struct
ngap_mobility_restriction_s
{
ngap_plmn_identity_t
serving_plmn
;
}
ngap_mobility_restriction_t
;
typedef
enum
pdu_session_type_e
{
PDUSessionType_ipv4
=
0
,
PDUSessionType_ipv6
=
1
,
...
...
@@ -550,13 +560,16 @@ typedef struct ngap_initial_context_setup_req_s {
uint8_t
nb_of_pdusessions
;
/* list of pdusession to be setup by RRC layers */
pdusession_t
pdusession_param
[
NGAP_MAX_PDUSESSION
];
/* Mobility Restriction List */
uint8_t
mobility_restriction_flag
;
ngap_mobility_restriction_t
mobility_restriction
;
/* Nas Pdu */
uint8_t
nas_pdu_flag
;
ngap_nas_pdu_t
nas_pdu
;
}
ngap_initial_context_setup_req_t
;
typedef
struct
ngap_tai_plmn_identity_s
{
uint16_t
mcc
;
uint16_t
mnc
;
uint8_t
mnc_digit_length
;
}
ngap_plmn_identity_t
;
typedef
struct
ngap_paging_ind_s
{
/* UE identity index value.
...
...
openair2/GNB_APP/gnb_config.c
View file @
5dc6712c
...
...
@@ -343,8 +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
+
(
ngap_generate_gNB_id
()
&
0xFFFF8
);
gnb_id
=
i
+
(
ngap_generate_gNB_id
()
&
0xFFFFFF8
);
else
gnb_id
=
i
;
}
else
{
...
...
@@ -571,9 +570,8 @@ 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
=
ngap_generate_gNB_id
();
gnb_id
=
i
+
(
hash
&
0xFFFF8
);
gnb_id
=
i
+
(
hash
&
0xFFFF
FF
8
);
}
else
{
gnb_id
=
i
;
}
...
...
@@ -789,9 +787,8 @@ int RCconfig_NR_NG(MessageDef *msg_p, uint32_t i) {
if
(
EPC_MODE_ENABLED
)
{
uint32_t
hash
;
//hash = ngap_generate_gNB_id ();
hash
=
ngap_generate_gNB_id
();
gnb_id
=
k
+
(
hash
&
0xFFFF8
);
gnb_id
=
k
+
(
hash
&
0xFFFF
FF
8
);
}
else
{
gnb_id
=
k
;
}
...
...
@@ -1039,9 +1036,8 @@ 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
=
ngap_generate_gNB_id
();
gnb_id
=
k
+
(
hash
&
0xFFFF8
);
gnb_id
=
k
+
(
hash
&
0xFFFF
FF
8
);
}
else
{
gnb_id
=
k
;
}
...
...
openair3/NGAP/ngap_gNB_defs.h
View file @
5dc6712c
...
...
@@ -126,11 +126,14 @@ struct served_guami_s {
};
/* NSSAI element */
typedef
struct
ngap_gNB_NSSAI
_s
{
struct
slice_support
_s
{
uint8_t
sST
;
uint8_t
sD_flag
;
uint8_t
sD
[
3
];
}
ngap_gNB_NSSAI_t
,
slice_support_s
;
/* Next slice element */
STAILQ_ENTRY
(
slice_support_s
)
next
;
};
/* plmn support element */
...
...
@@ -206,6 +209,12 @@ 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.
...
...
openair3/NGAP/ngap_gNB_handlers.c
View file @
5dc6712c
...
...
@@ -49,6 +49,10 @@
#include "assertions.h"
#include "conversions.h"
#include "msc.h"
#include "NGAP_PDUSessionResourceSetupRequestTransfer.h"
#include "NGAP_PDUSessionResourceSetupItemCxtReq.h"
#include "NGAP_QosFlowSetupRequestItem.h"
#include "NGAP_AllowedNSSAI-Item.h"
static
int
ngap_gNB_handle_ng_setup_response
(
uint32_t
assoc_id
,
...
...
@@ -297,7 +301,6 @@ static
int
ngap_gNB_handle_ng_setup_response
(
uint32_t
assoc_id
,
uint32_t
stream
,
NGAP_NGAP_PDU_t
*
pdu
)
{
#if 0
NGAP_NGSetupResponse_t
*
container
;
NGAP_NGSetupResponseIEs_t
*
ie
;
ngap_gNB_amf_data_t
*
amf_desc_p
;
...
...
@@ -447,7 +450,7 @@ int ngap_gNB_handle_ng_setup_response(uint32_t assoc_id,
amf_desc_p
->
state
=
NGAP_GNB_STATE_CONNECTED
;
amf_desc_p
->
ngap_gNB_instance
->
ngap_amf_associated_nb
++
;
ngap_handle_ng_setup_message
(
amf_desc_p
,
0
);
#endif
return
0
;
}
...
...
@@ -794,7 +797,7 @@ static
int
ngap_gNB_handle_initial_context_request
(
uint32_t
assoc_id
,
uint32_t
stream
,
NGAP_NGAP_PDU_t
*
pdu
)
{
#if 0
int
i
;
ngap_gNB_amf_data_t
*
amf_desc_p
=
NULL
;
ngap_gNB_ue_context_t
*
ue_desc_p
=
NULL
;
...
...
@@ -802,7 +805,7 @@ int ngap_gNB_handle_initial_context_request(uint32_t assoc_id,
NGAP_InitialContextSetupRequest_t
*
container
;
NGAP_InitialContextSetupRequestIEs_t
*
ie
;
NGAP_RAN_UE_NGAP_ID_t
ran_ue_ngap_id
;
NGAP_AMF_UE_NGAP_ID_t
amf_ue_ngap_id;
uint64_t
amf_ue_ngap_id
;
DevAssert
(
pdu
!=
NULL
);
container
=
&
pdu
->
choice
.
initiatingMessage
.
value
.
choice
.
InitialContextSetupRequest
;
...
...
@@ -817,7 +820,7 @@ int ngap_gNB_handle_initial_context_request(uint32_t assoc_id,
NGAP_ProtocolIE_ID_id_AMF_UE_NGAP_ID
,
true
);
if
(
ie
!=
NULL
)
{
/* checked by macro but cppcheck doesn't see it */
a
mf_ue_ngap_id = ie->value.choice.AMF_UE_NGAP_ID
;
a
sn_INTEGER2ulong
(
&
(
ie
->
value
.
choice
.
AMF_UE_NGAP_ID
),
&
amf_ue_ngap_id
)
;
}
else
{
return
-
1
;
}
...
...
@@ -849,6 +852,7 @@ int ngap_gNB_handle_initial_context_request(uint32_t assoc_id,
ue_desc_p
->
rx_stream
=
stream
;
ue_desc_p
->
amf_ue_ngap_id
=
amf_ue_ngap_id
;
message_p
=
itti_alloc_new_message
(
TASK_NGAP
,
NGAP_INITIAL_CONTEXT_SETUP_REQ
);
NGAP_INITIAL_CONTEXT_SETUP_REQ
(
message_p
).
ue_initial_id
=
ue_desc_p
->
ue_initial_id
;
ue_desc_p
->
ue_initial_id
=
0
;
...
...
@@ -873,10 +877,6 @@ int ngap_gNB_handle_initial_context_request(uint32_t assoc_id,
NGAP_ProtocolIE_ID_id_GUAMI
,
true
);
if
(
ie
!=
NULL
)
{
/* checked by macro but cppcheck doesn't see it */
ie->value.choice.GUAMI.pLMNIdentity
ie->value.choice.GUAMI.aMFRegionID
ie->value.choice.GUAMI.aMFSetID
ie->value.choice.GUAMI.aMFPointer
TBCD_TO_MCC_MNC
(
&
ie
->
value
.
choice
.
GUAMI
.
pLMNIdentity
,
NGAP_INITIAL_CONTEXT_SETUP_REQ
(
message_p
).
guami
.
mcc
,
NGAP_INITIAL_CONTEXT_SETUP_REQ
(
message_p
).
guami
.
mnc
,
NGAP_INITIAL_CONTEXT_SETUP_REQ
(
message_p
).
guami
.
mnc_len
);
...
...
@@ -1065,17 +1065,50 @@ int ngap_gNB_handle_initial_context_request(uint32_t assoc_id,
return
-
1
;
}
/* id-MobilityRestrictionList */
NGAP_FIND_PROTOCOLIE_BY_ID
(
NGAP_InitialContextSetupRequestIEs_t
,
ie
,
container
,
NGAP_ProtocolIE_ID_id_SecurityKey
,
true
);
if
(
ie
!=
NULL
)
{
/* checked by macro but cppcheck doesn't see it */
memcpy
(
&
NGAP_INITIAL_CONTEXT_SETUP_REQ
(
message_p
).
security_key
,
ie
->
value
.
choice
.
SecurityKey
.
buf
,
ie
->
value
.
choice
.
SecurityKey
.
size
);
itti_send_msg_to_task(TASK_RRC_GNB, ue_desc_p->gNB_instance->instance, message_p);
}
else
{
/* ie != NULL */
return
-
1
;
}
#endif
/* id-NAS-PDU */
NGAP_FIND_PROTOCOLIE_BY_ID
(
NGAP_InitialContextSetupRequestIEs_t
,
ie
,
container
,
NGAP_ProtocolIE_ID_id_MobilityRestrictionList
,
false
);
if
(
ie
!=
NULL
)
{
/* checked by macro but cppcheck doesn't see it */
NGAP_MobilityRestrictionList_t
*
mobility_rest_list_p
=
NULL
;
mobility_rest_list_p
=
&
ie
->
value
.
choice
.
MobilityRestrictionList
;
NGAP_INITIAL_CONTEXT_SETUP_REQ
(
message_p
).
mobility_restriction_flag
=
1
;
TBCD_TO_MCC_MNC
(
&
mobility_rest_list_p
->
servingPLMN
,
NGAP_INITIAL_CONTEXT_SETUP_REQ
(
message_p
).
mobility_restriction
.
serving_plmn
.
mcc
,
NGAP_INITIAL_CONTEXT_SETUP_REQ
(
message_p
).
mobility_restriction
.
serving_plmn
.
mnc
,
NGAP_INITIAL_CONTEXT_SETUP_REQ
(
message_p
).
mobility_restriction
.
serving_plmn
.
mnc_digit_length
);
}
NGAP_FIND_PROTOCOLIE_BY_ID
(
NGAP_InitialContextSetupRequestIEs_t
,
ie
,
container
,
NGAP_ProtocolIE_ID_id_NAS_PDU
,
false
);
if
(
ie
!=
NULL
)
{
/* checked by macro but cppcheck doesn't see it */
if
(
ie
->
value
.
choice
.
NAS_PDU
.
size
>
0
)
{
NGAP_INITIAL_CONTEXT_SETUP_REQ
(
message_p
).
nas_pdu_flag
=
1
;
NGAP_INITIAL_CONTEXT_SETUP_REQ
(
message_p
).
nas_pdu
.
length
=
ie
->
value
.
choice
.
NAS_PDU
.
size
;
NGAP_INITIAL_CONTEXT_SETUP_REQ
(
message_p
).
nas_pdu
.
buffer
=
malloc
(
sizeof
(
uint8_t
)
*
ie
->
value
.
choice
.
NAS_PDU
.
size
);
memcpy
(
NGAP_INITIAL_CONTEXT_SETUP_REQ
(
message_p
).
nas_pdu
.
buffer
,
ie
->
value
.
choice
.
NAS_PDU
.
buf
,
ie
->
value
.
choice
.
NAS_PDU
.
size
);
}
}
itti_send_msg_to_task
(
TASK_RRC_GNB
,
ue_desc_p
->
gNB_instance
->
instance
,
message_p
);
return
0
;
}
...
...
openair3/NGAP/ngap_gNB_nas_procedures.c
View file @
5dc6712c
...
...
@@ -53,7 +53,6 @@ int ngap_gNB_handle_nas_first_req(
instance_t
instance
,
ngap_nas_first_req_t
*
ngap_nas_first_req_p
)
//------------------------------------------------------------------------------
{
#if 0
ngap_gNB_instance_t
*
instance_p
=
NULL
;
struct
ngap_gNB_amf_data_s
*
amf_desc_p
=
NULL
;
struct
ngap_gNB_ue_context_s
*
ue_desc_p
=
NULL
;
...
...
@@ -315,7 +314,7 @@ int ngap_gNB_handle_nas_first_req(
/* Send encoded message over sctp */
ngap_gNB_itti_send_sctp_data_req
(
instance_p
->
instance
,
amf_desc_p
->
assoc_id
,
buffer
,
length
,
ue_desc_p
->
tx_stream
);
#endif
return
0
;
}
...
...
@@ -656,7 +655,7 @@ int ngap_gNB_initial_ctxt_resp(
if ((ue_context_p = ngap_gNB_get_ue_context(ngap_gNB_instance_p,
initial_ctxt_resp_p->gNB_ue_ngap_id)) == NULL) {
/* The context for this gNB ue ngap id doesn't exist in the map of gNB UEs */
NGAP_WARN("Failed to find ue context associated with gNB ue ngap id: 0x%0
6
x\n",
NGAP_WARN("Failed to find ue context associated with gNB ue ngap id: 0x%0
8
x\n",
initial_ctxt_resp_p->gNB_ue_ngap_id);
return -1;
}
...
...
@@ -688,10 +687,10 @@ int ngap_gNB_initial_ctxt_resp(
ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie);
/* mandatory */
ie = (NGAP_InitialContextSetupResponseIEs_t *)calloc(1, sizeof(NGAP_InitialContextSetupResponseIEs_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_ignore;
ie->value.present = NGAP_InitialContextSetupResponseIEs__value_PR_
GNB
_UE_NGAP_ID;
ie->value.choice.
GNB
_UE_NGAP_ID = initial_ctxt_resp_p->gNB_ue_ngap_id;
ie->value.present = NGAP_InitialContextSetupResponseIEs__value_PR_
RAN
_UE_NGAP_ID;
ie->value.choice.
RAN
_UE_NGAP_ID = initial_ctxt_resp_p->gNB_ue_ngap_id;
ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie);
/* mandatory */
ie = (NGAP_InitialContextSetupResponseIEs_t *)calloc(1, sizeof(NGAP_InitialContextSetupResponseIEs_t));
...
...
openair3/NGAP/ngap_gNB_nnsf.c
View file @
5dc6712c
...
...
@@ -339,7 +339,7 @@ ngap_gNB_nnsf_select_amf_by_guami_no_cause(ngap_gNB_instance_t *instance_p
struct
ngap_gNB_amf_data_s
*
amf_highest_capacity_p
=
NULL
;
uint8_t
current_capacity
=
0
;
#if 0
RB_FOREACH
(
amf_data_p
,
ngap_amf_map
,
&
instance_p
->
ngap_amf_head
)
{
struct
served_guami_s
*
guami_p
=
NULL
;
...
...
@@ -366,8 +366,8 @@ ngap_gNB_nnsf_select_amf_by_guami_no_cause(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
plmn_identity_s
*
served_plmn_p
=
NULL
;
STAILQ_FOREACH
(
served_plmn_p
,
&
guami_p
->
served_plmns
,
next
)
{
...
...
@@ -376,13 +376,13 @@ ngap_gNB_nnsf_select_amf_by_guami_no_cause(ngap_gNB_instance_t *instance_p
break
;
}
}
STAILQ_FOREACH(amf_
code_p, &guami_p->amf_code
s, next) {
if (amf_
code_p->amf_code == guami.amf_code
) {
STAILQ_FOREACH
(
amf_
set_id_p
,
&
guami_p
->
amf_set_id
s
,
next
)
{
if
(
amf_
set_id_p
->
amf_set_id
==
guami
.
amf_set_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
(
region_id_p
,
&
guami_p
->
served_region
_ids
,
next
)
{
if
(
region_id_p
->
amf_region_id
==
guami
.
amf_region
_id
)
{
break
;
}
}
...
...
@@ -391,8 +391,8 @@ ngap_gNB_nnsf_select_amf_by_guami_no_cause(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
)
&&
(
served_plmn_p
!=
NULL
))
{
return
amf_data_p
;
}
...
...
@@ -404,6 +404,6 @@ ngap_gNB_nnsf_select_amf_by_guami_no_cause(ngap_gNB_instance_t *instance_p
* In case the list of known AMF is empty, simply return NULL, that way the RRC
* layer should know about it and reject RRC connectivity.
*/
#endif
return
amf_highest_capacity_p
;
}
openair3/NGAP/ngap_gNB_ue_context.h
View file @
5dc6712c
...
...
@@ -47,15 +47,15 @@ typedef struct ngap_gNB_ue_context_s {
RB_ENTRY
(
ngap_gNB_ue_context_s
)
entries
;
/* Uniquely identifies the UE between AMF and gNB within the gNB.
* This id is encoded on
24
bits.
* This id is encoded on
32
bits.
*/
u
nsigned
gNB_ue_ngap_id
:
24
;
u
int32_t
gNB_ue_ngap_id
;
/* UE id for initial connection to NGAP */
uint16_t
ue_initial_id
;
/* Uniquely identifies the UE within AMF. Encoded on 32 bits. */
uint
32_t
amf_ue_ngap_id
;
uint
64_t
amf_ue_ngap_id
:
40
;
/* Stream used for this particular UE */
int32_t
tx_stream
;
...
...
openair3/UTILS/conversions.h
View file @
5dc6712c
...
...
@@ -506,11 +506,12 @@ do { \
#define MACRO_GNB_ID_TO_BIT_STRING(mACRO, bITsTRING) \
do { \
(bITsTRING)->buf = calloc(3, sizeof(uint8_t)); \
(bITsTRING)->buf[0] = ((mACRO) >> 12); \
(bITsTRING)->buf[1] = (mACRO) >> 4; \
(bITsTRING)->buf[2] = ((mACRO) & 0x0f) << 4; \
(bITsTRING)->size = 3; \
(bITsTRING)->buf = calloc(4, sizeof(uint8_t)); \
(bITsTRING)->buf[0] = ((mACRO) >> 20); \
(bITsTRING)->buf[1] = (mACRO) >> 12; \
(bITsTRING)->buf[3] = (mACRO) >> 4; \
(
bITsTRING
)
->
buf
[
4
]
=
((
mACRO
)
&
0x0f
)
<<
4
;
\
(
bITsTRING
)
->
size
=
4
;
\
(
bITsTRING
)
->
bits_unused
=
4
;
\
}
while
(
0
)
...
...
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