Commit d7fc76b7 authored by Jaroslava Fiedlerova's avatar Jaroslava Fiedlerova

Merge remote-tracking branch 'origin/nrppa_ngap_integration' into integration_2026_w10 (!3884)

Integrate NRPPA and NGAP messages required for positioning

This MR integrates NRPPA and NGAP messages required for positioning.
The following NGAP messages are integrated (3GPP 38.413 Version 16.0.0):

NGAP UPLINK UE ASSOCIATED NRPPA TRANSPORT
NGAP UPLINK NON UE ASSOCIATED NRPPA TRANSPORT
NGAP DOWNLINK UE ASSOCIATED NRPPA TRANSPORT
NGAP DOWNLINK NON UE ASSOCIATED NRPPA TRANSPORT

The following NRPPA messages are integrated (3GPP 38.455 Version 16.7.1):

TRP Information Request
TRP Information Response
Positioning Information Request
Positioning Information Response
Positioning activation request
Positioning Activation Response
Measurement Request
Measurement Response

This MR tests these messages via a standalone tester nr-cu-nrppa-test that
connects to the AMF to perform NGAP enc/dec and NRPPA enc/dec

Core Network:
To pull the docker images:

docker pull oaisoftwarealliance/ims:latest
docker pull oaisoftwarealliance/oai-amf:develop
docker pull oaisoftwarealliance/oai-nrf:develop
docker pull oaisoftwarealliance/oai-smf:develop
docker pull oaisoftwarealliance/oai-udr:develop
docker pull oaisoftwarealliance/oai-upf:develop
docker pull oaisoftwarealliance/oai-udm:develop
docker pull oaisoftwarealliance/oai-ausf:develop
docker pull oaisoftwarealliance/oai-lmf:develop

openairinterface5g$ cd doc/tutorial_resources/oai-cn5g
To deploy:
openairinterface5g/doc/tutorial_resources/oai-cn5g$ docker compose -f docker-compose-positioning.yaml up -d

To undeploy:
openairinterface5g/doc/tutorial_resources/oai-cn5g$ docker compose -f docker-compose-positioning.yaml down -t 0

RAN:
To compile:
openairinterface5g$ mkdir build
openairinterface5g$ cd build
openairinterface5g/build$ cmake .. -GNinja
openairinterface5g/build$ ninja nr-cu-nrppa-test

To run:
openairinterface5g/build$ LD_LIBRARY_PATH=. ./tests/nr-cu-nrppa/nr-cu-nrppa-test -O ../tests/nr-cu-nrppa/nr-nrppa-test.conf

To initiate positioning procedure:
openairinterface5g$ cd doc/tutorial_resources/positioning/
openairinterface5g/doc/tutorial_resources/positioning$ curl --http2-prior-knowledge -H "Content-Type: application/json" -d "@InputData.json" -X POST http://192.168.70.141:8080/nlmf-loc/v1/determine-location
parents 970577c7 7de93489
...@@ -441,6 +441,7 @@ add_library(ngap ...@@ -441,6 +441,7 @@ add_library(ngap
${NGAP_DIR}/ngap_gNB_overload.c ${NGAP_DIR}/ngap_gNB_overload.c
${NGAP_DIR}/ngap_gNB_trace.c ${NGAP_DIR}/ngap_gNB_trace.c
${NGAP_DIR}/ngap_gNB_ue_context.c ${NGAP_DIR}/ngap_gNB_ue_context.c
${NGAP_DIR}/ngap_gNB_NRPPa_transport_procedures.c
) )
target_link_libraries(ngap PUBLIC asn1_ngap) target_link_libraries(ngap PUBLIC asn1_ngap)
target_link_libraries(ngap PRIVATE asn1_lte_rrc_hdrs asn1_nr_rrc_hdrs) target_link_libraries(ngap PRIVATE asn1_lte_rrc_hdrs asn1_nr_rrc_hdrs)
...@@ -1308,6 +1309,8 @@ set (GNB_APP_SRC ...@@ -1308,6 +1309,8 @@ set (GNB_APP_SRC
${OPENAIR2_DIR}/GNB_APP/gnb_app.c ${OPENAIR2_DIR}/GNB_APP/gnb_app.c
${OPENAIR2_DIR}/E1AP/e1ap_setup.c ${OPENAIR2_DIR}/E1AP/e1ap_setup.c
${OPENAIR2_DIR}/GNB_APP/gnb_config.c ${OPENAIR2_DIR}/GNB_APP/gnb_config.c
${OPENAIR2_DIR}/GNB_APP/gnb_config_common.c
${OPENAIR2_DIR}/GNB_APP/gnb_config_ng.c
) )
set (MCE_APP_SRC set (MCE_APP_SRC
......
...@@ -165,6 +165,7 @@ static const char *const flag_name[] = {FOREACH_FLAG(FLAG_TEXT) ""}; ...@@ -165,6 +165,7 @@ static const char *const flag_name[] = {FOREACH_FLAG(FLAG_TEXT) ""};
COMP_DEF(M2AP, ) \ COMP_DEF(M2AP, ) \
COMP_DEF(M3AP, ) \ COMP_DEF(M3AP, ) \
COMP_DEF(NGAP, ) \ COMP_DEF(NGAP, ) \
COMP_DEF(NRPPA, ) \
COMP_DEF(GNB_APP, log) \ COMP_DEF(GNB_APP, log) \
COMP_DEF(NR_RRC, log) \ COMP_DEF(NR_RRC, log) \
COMP_DEF(NR_MAC, log) \ COMP_DEF(NR_MAC, log) \
......
...@@ -586,6 +586,27 @@ ID = LEGACY_NGAP_TRACE ...@@ -586,6 +586,27 @@ ID = LEGACY_NGAP_TRACE
GROUP = ALL:LEGACY_NGAP:LEGACY_GROUP_TRACE:LEGACY GROUP = ALL:LEGACY_NGAP:LEGACY_GROUP_TRACE:LEGACY
FORMAT = string,log FORMAT = string,log
ID = LEGACY_NRPPA_INFO
DESC = NRPPA legacy logs - info level
GROUP = ALL:LEGACY_NRPPA:LEGACY_GROUP_INFO:LEGACY
FORMAT = string,log
ID = LEGACY_NRPPA_ERROR
DESC = NRPPA legacy logs - error level
GROUP = ALL:LEGACY_NRPPA:LEGACY_GROUP_ERROR:LEGACY
FORMAT = string,log
ID = LEGACY_NRPPA_WARNING
DESC = NRPPA legacy logs - warning level
GROUP = ALL:LEGACY_NRPPA:LEGACY_GROUP_WARNING:LEGACY
FORMAT = string,log
ID = LEGACY_NRPPA_DEBUG
DESC = NRPPA legacy logs - debug level
GROUP = ALL:LEGACY_NRPPA:LEGACY_GROUP_DEBUG:LEGACY
FORMAT = string,log
ID = LEGACY_NRPPA_TRACE
DESC = NRPPA legacy logs - trace level
GROUP = ALL:LEGACY_NRPPA:LEGACY_GROUP_TRACE:LEGACY
FORMAT = string,log
ID = LEGACY_X2AP_INFO ID = LEGACY_X2AP_INFO
DESC = X2AP legacy logs - info level DESC = X2AP legacy logs - info level
GROUP = ALL:LEGACY_X2AP:LEGACY_GROUP_INFO:LEGACY GROUP = ALL:LEGACY_X2AP:LEGACY_GROUP_INFO:LEGACY
......
...@@ -14,4 +14,4 @@ ...@@ -14,4 +14,4 @@
#include "openair2/COMMON/f1ap_messages_def.h" #include "openair2/COMMON/f1ap_messages_def.h"
#include "openair2/COMMON/e1ap_messages_def.h" #include "openair2/COMMON/e1ap_messages_def.h"
#include "openair2/COMMON/ngap_messages_def.h" #include "openair2/COMMON/ngap_messages_def.h"
#include "openair2/COMMON/nrppa_messages_def.h"
...@@ -230,6 +230,7 @@ typedef struct IttiMsgText_s { ...@@ -230,6 +230,7 @@ typedef struct IttiMsgText_s {
#include <openair2/COMMON/udp_messages_types.h> #include <openair2/COMMON/udp_messages_types.h>
#include <openair2/COMMON/gtpv1_u_messages_types.h> #include <openair2/COMMON/gtpv1_u_messages_types.h>
#include <openair2/COMMON/ngap_messages_types.h> #include <openair2/COMMON/ngap_messages_types.h>
#include <openair2/COMMON/nrppa_messages_types.h>
#include <openair3/SCTP/sctp_eNB_task.h> #include <openair3/SCTP/sctp_eNB_task.h>
#include <openair3/NAS/UE/nas_proc_defs.h> #include <openair3/NAS/UE/nas_proc_defs.h>
#include <openair3/NAS/UE/ESM/esmData.h> #include <openair3/NAS/UE/ESM/esmData.h>
...@@ -294,6 +295,7 @@ typedef struct { ...@@ -294,6 +295,7 @@ typedef struct {
TASK_DEF(TASK_RAL_ENB, 200) \ TASK_DEF(TASK_RAL_ENB, 200) \
TASK_DEF(TASK_S1AP, 200) \ TASK_DEF(TASK_S1AP, 200) \
TASK_DEF(TASK_NGAP, 200) \ TASK_DEF(TASK_NGAP, 200) \
TASK_DEF(TASK_NRPPA, 200) \
TASK_DEF(TASK_X2AP, 200) \ TASK_DEF(TASK_X2AP, 200) \
TASK_DEF(TASK_M2AP_ENB, 200) \ TASK_DEF(TASK_M2AP_ENB, 200) \
TASK_DEF(TASK_M2AP_MCE, 200) \ TASK_DEF(TASK_M2AP_MCE, 200) \
......
...@@ -121,8 +121,9 @@ The other SDRs (AW2S, LimeSDR, ...) have no READMEs. ...@@ -121,8 +121,9 @@ The other SDRs (AW2S, LimeSDR, ...) have no READMEs.
## Testing ## Testing
- [UnitTests.md](./UnitTests.md) explains the unit testing setup - [UnitTests.md](./UnitTests.md) explains the unit testing setup
- Component tests are under `tests/`. Currently, there is a simple CU-UP - Component tests are under `tests/`. Currently, the following component tests are supported
tester, see the corresponding [README.md](../tests/nr-cuup/README.md). - A simple CU-UP tester, see the corresponding [README.md](../tests/nr-cuup/README.md).
- A CU-NRPPA tester, see the corresponding [README.md](../tests/nr-cu-nrppa/README.md).
- [TESTBenches.md](./TESTBenches.md) lists the CI setup and links to pipelines - [TESTBenches.md](./TESTBenches.md) lists the CI setup and links to pipelines
- The CI setup uses a [custom framework](../ci-scripts/README.md) to run - The CI setup uses a [custom framework](../ci-scripts/README.md) to run
end-to-end tests. end-to-end tests.
......
...@@ -100,6 +100,12 @@ nfs: ...@@ -100,6 +100,12 @@ nfs:
port: 8080 port: 8080
api_version: v1 api_version: v1
interface_name: eth0 interface_name: eth0
lmf:
host: oai-lmf
sbi:
port: 8080
api_version: v1
interface_name: eth0
#### Common for UDR and AMF #### Common for UDR and AMF
database: database:
...@@ -220,6 +226,20 @@ upf: ...@@ -220,6 +226,20 @@ upf:
- dnn: "ims" - dnn: "ims"
- dnn: "default" - dnn: "default"
lmf:
http_threads_count: 8
gnb_id_bits_count: 28
num_gnb: 1
trp_info_wait_ms: 500
positioning_wait_ms: 500
measurement_wait_ms: 500
support_features:
request_trp_info: no
determine_num_gnb: yes
use_http2: yes
use_fqdn_dns: no
register_nrf: yes
## DNN configuration ## DNN configuration
dnns: dnns:
- dnn: "oai" - dnn: "oai"
......
services:
mysql:
container_name: "mysql"
image: mysql:8.0
volumes:
- ./database/oai_db.sql:/docker-entrypoint-initdb.d/oai_db.sql
- ./healthscripts/mysql-healthcheck.sh:/tmp/mysql-healthcheck.sh
environment:
- TZ=Europe/Paris
- MYSQL_DATABASE=oai_db
- MYSQL_USER=test
- MYSQL_PASSWORD=test
- MYSQL_ROOT_PASSWORD=linux
healthcheck:
test: /bin/bash -c "/tmp/mysql-healthcheck.sh"
interval: 5s
timeout: 2s
retries: 10
networks:
public_net:
ipv4_address: 192.168.70.131
ims:
container_name: "ims"
image: oaisoftwarealliance/ims:latest
volumes:
- ./conf/sip.conf:/etc/asterisk/sip.conf
- ./conf/users.conf:/etc/asterisk/users.conf
healthcheck:
test: /bin/bash -c "pgrep asterisk"
interval: 5s
timeout: 2s
retries: 10
networks:
public_net:
ipv4_address: 192.168.70.139
oai-udr:
container_name: "oai-udr"
image: oaisoftwarealliance/oai-udr:develop
expose:
- 80/tcp
- 8080/tcp
volumes:
- ./conf/config.yaml:/openair-udr/etc/config.yaml
environment:
- TZ=Europe/Paris
depends_on:
- mysql
- oai-nrf
networks:
public_net:
ipv4_address: 192.168.70.136
oai-udm:
container_name: "oai-udm"
image: oaisoftwarealliance/oai-udm:develop
expose:
- 80/tcp
- 8080/tcp
volumes:
- ./conf/config.yaml:/openair-udm/etc/config.yaml
environment:
- TZ=Europe/Paris
depends_on:
- oai-udr
networks:
public_net:
ipv4_address: 192.168.70.137
oai-ausf:
container_name: "oai-ausf"
image: oaisoftwarealliance/oai-ausf:develop
expose:
- 80/tcp
- 8080/tcp
volumes:
- ./conf/config.yaml:/openair-ausf/etc/config.yaml
environment:
- TZ=Europe/Paris
depends_on:
- oai-udm
networks:
public_net:
ipv4_address: 192.168.70.138
oai-nrf:
container_name: "oai-nrf"
image: oaisoftwarealliance/oai-nrf:develop
expose:
- 80/tcp
- 8080/tcp
volumes:
- ./conf/config.yaml:/openair-nrf/etc/config.yaml
environment:
- TZ=Europe/Paris
networks:
public_net:
ipv4_address: 192.168.70.130
oai-amf:
container_name: "oai-amf"
image: oaisoftwarealliance/oai-amf:develop
expose:
- 80/tcp
- 8080/tcp
- 38412/sctp
volumes:
- ./conf/config.yaml:/openair-amf/etc/config.yaml
environment:
- TZ=Europe/Paris
depends_on:
- mysql
- oai-nrf
- oai-ausf
networks:
public_net:
ipv4_address: 192.168.70.132
oai-lmf:
container_name: "oai-lmf"
image: oaisoftwarealliance/oai-lmf:develop
#image: oai-lmf:psoElementwiseTdoAmeanVarTDoAfilter
expose:
- 80/tcp
- 8080/tcp
volumes:
- ./conf/config.yaml:/openair-lmf/etc/config.yaml
environment:
- TZ=Europe/Paris
depends_on:
- mysql
- oai-nrf
- oai-amf
networks:
public_net:
ipv4_address: 192.168.70.141
oai-smf:
container_name: "oai-smf"
image: oaisoftwarealliance/oai-smf:develop
expose:
- 80/tcp
- 8080/tcp
- 8805/udp
volumes:
- ./conf/config.yaml:/openair-smf/etc/config.yaml
environment:
- TZ=Europe/Paris
depends_on:
- oai-nrf
- oai-amf
networks:
public_net:
ipv4_address: 192.168.70.133
oai-upf:
container_name: "oai-upf"
image: oaisoftwarealliance/oai-upf:develop
expose:
- 2152/udp
- 8805/udp
volumes:
- ./conf/config.yaml:/openair-upf/etc/config.yaml
environment:
- TZ=Europe/Paris
depends_on:
- oai-nrf
- oai-smf
cap_add:
- NET_ADMIN
- SYS_ADMIN
cap_drop:
- ALL
privileged: true
networks:
public_net:
ipv4_address: 192.168.70.134
oai-ext-dn:
privileged: true
init: true
container_name: oai-ext-dn
image: oaisoftwarealliance/trf-gen-cn5g:jammy
entrypoint: /bin/bash -c \
"ip route add 10.0.0.0/16 via 192.168.70.134 dev eth0; ip route; sleep infinity"
command: ["/bin/bash", "-c", "trap : SIGTERM SIGINT; sleep infinity & wait"]
healthcheck:
test: /bin/bash -c "ip r | grep 10.0.0"
interval: 5s
timeout: 2s
retries: 10
networks:
public_net:
ipv4_address: 192.168.70.135
networks:
public_net:
driver: bridge
name: oai-cn5g-public-net
ipam:
config:
- subnet: 192.168.70.128/26
driver_opts:
com.docker.network.bridge.name: "oai-cn5g"
{
"externalClientType": "VALUE_ADDED_SERVICES",
"amfId": "128:1:1",
"locationQoS": {
"hAccuracy": 1.5,
"vAccuracy": 1.5,
"verticalRequested": true,
"responseTime": "LOW_DELAY",
"lcsQosClass": "BEST_EFFORT"
},
"supportedGADShapes": [
"POINT",
"POINT_UNCERTAINTY_CIRCLE"
],
"supi": "imsi-001010000000001",
"ncgi": {
"plmnId": {
"mcc": "001",
"mnc": "01"
},
"nrCellId": "14680064",
"nid": "0"
},
"priority": "HIGHEST_PRIORITY",
"velocityRequested": "VELOCITY_IS_NOT_REQUESTED",
"lcsServiceType": 127,
"ldrType": "UE_AVAILABLE",
"hgmlcCallBackURI": "198.168.70.129",
"ldrReference": "11",
"lirReference": "1",
"periodicEventInfo": {
"reportingAmount": 10,
"reportingInterval": 60
},
"reportingAccessTypes": [
"NR",
"NON_3GPP_CONNECTED_TO_5GC"
],
"ueConnectivityStates": {
"accessType": "3GPP_ACCESS",
"connectivitystate": "IDLE"
}
}
...@@ -305,6 +305,29 @@ typedef struct { ...@@ -305,6 +305,29 @@ typedef struct {
int32_t reserved; int32_t reserved;
} prs_meas_t; } prs_meas_t;
// Configuration parameters required for 5G Positioning
// TRP Cartesian Coordinate information
typedef struct trp_s {
// TRP id
uint32_t id;
// TRP x-axis value
uint32_t x_axis;
// TRP y-axis value
uint32_t y_axis;
// TRP z-axis value
uint32_t z_axis;
// 0 = mm, 1 = cm, 2 = dm
uint8_t unit;
} trp_t;
#define MAX_NUM_TRPs 8
typedef struct {
trp_t trps[MAX_NUM_TRPs];
uint8_t num_trp;
// Serving gNB indicator
bool is_serving_gNB;
} positioning_config_t;
// rel16 prs k_prime table as per ts138.211 sec.7.4.1.7.2 // rel16 prs k_prime table as per ts138.211 sec.7.4.1.7.2
#define K_PRIME_TABLE_ROW_SIZE 4 #define K_PRIME_TABLE_ROW_SIZE 4
#define K_PRIME_TABLE_COL_SIZE 12 #define K_PRIME_TABLE_COL_SIZE 12
......
...@@ -88,3 +88,18 @@ MESSAGE_DEF(NGAP_HANDOVER_CANCEL_ACK, MESSAGE_PRIORITY_MED, ngap_handover_cancel ...@@ -88,3 +88,18 @@ MESSAGE_DEF(NGAP_HANDOVER_CANCEL_ACK, MESSAGE_PRIORITY_MED, ngap_handover_cancel
/* NGAP <-> RRC messages (can be initiated either by MME or gNB) */ /* NGAP <-> RRC messages (can be initiated either by MME or gNB) */
MESSAGE_DEF(NGAP_UE_CONTEXT_RELEASE_REQ , MESSAGE_PRIORITY_MED, ngap_ue_release_req_t , ngap_ue_release_req) MESSAGE_DEF(NGAP_UE_CONTEXT_RELEASE_REQ , MESSAGE_PRIORITY_MED, ngap_ue_release_req_t , ngap_ue_release_req)
/* NGAP -> NRPPA messages*/
MESSAGE_DEF(NGAP_DOWNLINKUEASSOCIATEDNRPPA,
MESSAGE_PRIORITY_MED,
ngap_downlink_ue_associated_nrppa_t,
ngap_downlink_ue_associated_nrppa)
MESSAGE_DEF(NGAP_DOWNLINKNONUEASSOCIATEDNRPPA,
MESSAGE_PRIORITY_MED,
ngap_downlink_non_ue_associated_nrppa_t,
ngap_downlink_non_ue_associated_nrppa)
MESSAGE_DEF(NGAP_UPLINKUEASSOCIATEDNRPPA, MESSAGE_PRIORITY_MED, ngap_uplink_ue_associated_nrppa_t, ngap_uplink_ue_associated_nrppa)
MESSAGE_DEF(NGAP_UPLINKNONUEASSOCIATEDNRPPA,
MESSAGE_PRIORITY_MED,
ngap_uplink_non_ue_associated_nrppa_t,
ngap_uplink_non_ue_associated_nrppa)
...@@ -79,6 +79,11 @@ ...@@ -79,6 +79,11 @@
#define NGAP_UL_RAN_STATUS_TRANSFER(mSGpTR) (mSGpTR)->ittiMsg.ngap_ul_ran_status_transfer #define NGAP_UL_RAN_STATUS_TRANSFER(mSGpTR) (mSGpTR)->ittiMsg.ngap_ul_ran_status_transfer
#define NGAP_DL_RAN_STATUS_TRANSFER(mSGpTR) (mSGpTR)->ittiMsg.ngap_dl_ran_status_transfer #define NGAP_DL_RAN_STATUS_TRANSFER(mSGpTR) (mSGpTR)->ittiMsg.ngap_dl_ran_status_transfer
#define NGAP_DOWNLINKUEASSOCIATEDNRPPA(mSGpTR) (mSGpTR)->ittiMsg.ngap_downlink_ue_associated_nrppa
#define NGAP_DOWNLINKNONUEASSOCIATEDNRPPA(mSGpTR) (mSGpTR)->ittiMsg.ngap_downlink_non_ue_associated_nrppa
#define NGAP_UPLINKUEASSOCIATEDNRPPA(mSGpTR) (mSGpTR)->ittiMsg.ngap_uplink_ue_associated_nrppa
#define NGAP_UPLINKNONUEASSOCIATEDNRPPA(mSGpTR) (mSGpTR)->ittiMsg.ngap_uplink_non_ue_associated_nrppa
//-------------------------------------------------------------------------------------------// //-------------------------------------------------------------------------------------------//
/* Length of the transport layer address string /* Length of the transport layer address string
...@@ -1007,4 +1012,44 @@ typedef struct { ...@@ -1007,4 +1012,44 @@ typedef struct {
ngap_ran_status_container_t ran_status; ngap_ran_status_container_t ran_status;
} ngap_ran_status_transfer_t; } ngap_ran_status_transfer_t;
// Uplink UE Associated NRPPA Transport message (9.2.9.2 3GPP 38.413 v16.0.0)
typedef struct {
// AMF UE NGAP ID (Mandatory)
uint64_t amf_ue_ngap_id;
// RAN UE NGAP ID (Mandatory)
uint32_t gNB_ue_ngap_id;
// Routing ID (Mandatory)
byte_array_t routing_id;
// NRPPa pdu (Mandatory)
byte_array_t nrppa_pdu;
} ngap_uplink_ue_associated_nrppa_t;
// Uplink NON UE Associated NRPPA Transport message (9.2.9.4 3GPP 38.413 v16.0.0)
typedef struct {
// Routing ID (Mandatory)
byte_array_t routing_id;
// NRPPa pdu (Mandatory)
byte_array_t nrppa_pdu;
} ngap_uplink_non_ue_associated_nrppa_t;
// Downlink UE Associated NRPPA Transport message (9.2.9.1 3GPP 38.413 v16.0.0)
typedef struct {
// AMF UE NGAP ID (Mandatory)
uint64_t amf_ue_ngap_id;
// RAN UE NGAP ID (Mandatory)
uint32_t gNB_ue_ngap_id;
// Routing ID (Mandatory)
byte_array_t routing_id;
// NRPPa pdu (Mandatory)
byte_array_t nrppa_pdu;
} ngap_downlink_ue_associated_nrppa_t;
// Downlink NON UE Associated NRPPA Transport message (9.2.9.3 3GPP 38.413 v16.0.0)
typedef struct {
// Routing ID (Mandatory)
byte_array_t routing_id;
// NRPPa pdu (Mandatory)
byte_array_t nrppa_pdu;
} ngap_downlink_non_ue_associated_nrppa_t;
#endif /* NGAP_MESSAGES_TYPES_H_ */ #endif /* NGAP_MESSAGES_TYPES_H_ */
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* 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
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
#include "openair2/COMMON/nrppa_messages_types.h"
// LMF -> CU
MESSAGE_DEF(NRPPA_TRP_INFORMATION_REQ, MESSAGE_PRIORITY_MED, nrppa_trp_information_req_t, nrppa_trp_information_req)
MESSAGE_DEF(NRPPA_TRP_INFORMATION_RESP, MESSAGE_PRIORITY_MED, nrppa_trp_information_resp_t, nrppa_trp_information_resp)
MESSAGE_DEF(NRPPA_POSITIONING_INFORMATION_REQ,
MESSAGE_PRIORITY_MED,
nrppa_positioning_information_req_t,
nrppa_positioning_information_req)
MESSAGE_DEF(NRPPA_POSITIONING_INFORMATION_RESP,
MESSAGE_PRIORITY_MED,
nrppa_positioning_information_resp_t,
nrppa_positioning_information_resp)
MESSAGE_DEF(NRPPA_POSITIONING_ACTIVATION_REQ,
MESSAGE_PRIORITY_MED,
nrppa_positioning_activation_req_t,
nrppa_positioning_activation_req)
MESSAGE_DEF(NRPPA_POSITIONING_ACTIVATION_RESP,
MESSAGE_PRIORITY_MED,
nrppa_positioning_activation_resp_t,
nrppa_positioning_activation_resp)
MESSAGE_DEF(NRPPA_MEASUREMENT_REQ, MESSAGE_PRIORITY_MED, nrppa_measurement_req_t, nrppa_measurement_req)
MESSAGE_DEF(NRPPA_MEASUREMENT_RESP, MESSAGE_PRIORITY_MED, nrppa_measurement_resp_t, nrppa_measurement_resp)
This diff is collapsed.
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* 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
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
#ifndef __POSITIONING_NR_PARAMDEF__H__
#define __POSITIONING_NR_PARAMDEF__H__
/* Positioning configuration section names */
#define CONFIG_STRING_POSITIONING_CONFIG "positioning_config"
/* Global parameters */
/* TRP configuration parameters names */
#define CONFIG_STRING_POSITIONING_NUM_TRPS "NumTRPs"
#define CONFIG_STRING_POSITIONING_TRP_IDS_LIST "TRPIDs"
#define CONFIG_STRING_POSITIONING_TRP_X_AXIS_LIST "TRPxAxis"
#define CONFIG_STRING_POSITIONING_TRP_Y_AXIS_LIST "TRPyAxis"
#define CONFIG_STRING_POSITIONING_TRP_Z_AXIS_LIST "TRPzAxis"
#define CONFIG_STRING_POSITIONING_TRP_UNIT_LIST "Units"
/* Help string for Positioning parameters */
#define HELP_STRING_POSITIONING_NUM_TRPS "Number of TRPs connected with gNB(max 4)\n"
#define HELP_STRING_POSITIONING_TRP_IDS_LIST "User defined IDs for each TRP \n"
#define HELP_STRING_POSITIONING_TRP_X_AXIS_LIST "x-axis value of each TRP \n"
#define HELP_STRING_POSITIONING_TRP_Y_AXIS_LIST "y-axis value of each TRP \n"
#define HELP_STRING_POSITIONING_TRP_Z_AXIS_LIST "z-axis value of each TRP \n"
#define HELP_STRING_POSITIONING_TRP_UNIT_LIST "XYZ unit value of each TRP \n"
/*----------------------------------------------------------------------------------------------------------------------------------------------------------------*/
/* TRP configuration parameters */
/* optname helpstr paramflags XXXptr defXXXval type
* numelt */
/*----------------------------------------------------------------------------------------------------------------------------------------------------------------*/
// clang-format off
#define POSITIONING_PARAMS_DESC { \
{CONFIG_STRING_POSITIONING_NUM_TRPS, HELP_STRING_POSITIONING_NUM_TRPS, 0, .uptr=NULL, .defuintval=0, TYPE_UINT, 0}, \
{CONFIG_STRING_POSITIONING_TRP_IDS_LIST, HELP_STRING_POSITIONING_TRP_IDS_LIST, 0, .uptr=NULL, .defintarrayval=0, TYPE_UINTARRAY, 0}, \
{CONFIG_STRING_POSITIONING_TRP_X_AXIS_LIST, HELP_STRING_POSITIONING_TRP_X_AXIS_LIST, 0, .uptr=NULL, .defintarrayval=0, TYPE_UINTARRAY, 0}, \
{CONFIG_STRING_POSITIONING_TRP_Y_AXIS_LIST, HELP_STRING_POSITIONING_TRP_Y_AXIS_LIST, 0, .uptr=NULL, .defintarrayval=0, TYPE_UINTARRAY, 0}, \
{CONFIG_STRING_POSITIONING_TRP_Z_AXIS_LIST, HELP_STRING_POSITIONING_TRP_Z_AXIS_LIST, 0, .uptr=NULL, .defintarrayval=0, TYPE_UINTARRAY, 0}, \
{CONFIG_STRING_POSITIONING_TRP_UNIT_LIST, HELP_STRING_POSITIONING_TRP_UNIT_LIST, 0, .uptr=NULL, .defintarrayval=0, TYPE_UINTARRAY, 0}, \
}
// clang-format on
#endif
...@@ -53,6 +53,7 @@ ...@@ -53,6 +53,7 @@
#include "openair2/E1AP/e1ap.h" #include "openair2/E1AP/e1ap.h"
#include "gnb_config.h" #include "gnb_config.h"
#include "openair2/LAYER2/NR_MAC_gNB/mac_proto.h" #include "openair2/LAYER2/NR_MAC_gNB/mac_proto.h"
#include "openair2/GNB_APP/gnb_config_ng.h"
extern RAN_CONTEXT_t RC; extern RAN_CONTEXT_t RC;
/*------------------------------------------------------------------------------*/ /*------------------------------------------------------------------------------*/
......
...@@ -79,7 +79,8 @@ ...@@ -79,7 +79,8 @@
#include "uper_encoder.h" #include "uper_encoder.h"
#include "utils.h" #include "utils.h"
#include "x2ap_messages_types.h" #include "x2ap_messages_types.h"
#include "gnb_config_common.h"
#include "positioning_nr_paramdef.h"
static int DEFBANDS[] = {7}; static int DEFBANDS[] = {7};
static int DEFENBS[] = {0}; static int DEFENBS[] = {0};
...@@ -96,45 +97,6 @@ static int DEFRUTPCORES[] = {-1,-1,-1,-1}; ...@@ -96,45 +97,6 @@ static int DEFRUTPCORES[] = {-1,-1,-1,-1};
(element)->choice.setup = CALLOC(1, sizeof(*((element)->choice.setup))); \ (element)->choice.setup = CALLOC(1, sizeof(*((element)->choice.setup))); \
} while (0) } while (0)
static uint16_t set_snssai_config(nssai_t *nssai, const int max_num_ssi, uint8_t k, uint8_t l)
{
char snssaistr[MAX_OPTNAME_SIZE * 2 + 8];
snprintf(snssaistr, sizeof(snssaistr), "%s.[%i].%s.[%i]", GNB_CONFIG_STRING_GNB_LIST, k, GNB_CONFIG_STRING_PLMN_LIST, l);
GET_PARAMS_LIST(SNSSAIParamList,
SNSSAIParams,
GNBSNSSAIPARAMS_DESC,
GNB_CONFIG_STRING_SNSSAI_LIST,
snssaistr,
SNSSAIPARAMS_CHECK);
uint16_t num_ssi = SNSSAIParamList.numelt;
AssertFatal(num_ssi < max_num_ssi, "S-NSSAI size %d exceeds the max array size %d", num_ssi, max_num_ssi);
for (int s = 0; s < num_ssi; ++s) {
nssai[s].sst = *SNSSAIParamList.paramarray[s][GNB_SLICE_SERVICE_TYPE_IDX].uptr;
// SD is optional
// 0xffffff is "no SD", see 23.003 Sec 28.4.2
nssai[s].sd = *SNSSAIParamList.paramarray[s][GNB_SLICE_DIFFERENTIATOR_IDX].uptr;
AssertFatal(nssai[s].sd <= 0xffffff, "SD cannot be bigger than 0xffffff, but is %d\n", nssai[s].sd);
}
return num_ssi;
}
static uint8_t set_plmn_config(plmn_id_t *p, uint8_t idx)
{
char gnbpath[MAX_OPTNAME_SIZE * 2 + 8];
snprintf(gnbpath, sizeof(gnbpath), "%s.[%i]", GNB_CONFIG_STRING_GNB_LIST, idx);
GET_PARAMS_LIST(PLMNParamList, PLMNParams, GNBPLMNPARAMS_DESC, GNB_CONFIG_STRING_PLMN_LIST, gnbpath, PLMNPARAMS_CHECK);
uint8_t num_plmn = PLMNParamList.numelt;
AssertFatal(num_plmn >= 1 && num_plmn <= 6, "The number of PLMN IDs must be in [1,6], but is %d\n", num_plmn);
for (int l = 0; l < num_plmn; ++l) {
plmn_id_t *plmn = &p[l];
plmn->mcc = *PLMNParamList.paramarray[l][GNB_MOBILE_COUNTRY_CODE_IDX].uptr;
plmn->mnc = *PLMNParamList.paramarray[l][GNB_MOBILE_NETWORK_CODE_IDX].uptr;
plmn->mnc_digit_length = *PLMNParamList.paramarray[l][GNB_MNC_DIGIT_LENGTH].u8ptr;
AssertFatal((plmn->mnc_digit_length == 2) || (plmn->mnc_digit_length == 3), "BAD MNC DIGIT LENGTH %d", plmn->mnc_digit_length);
}
return num_plmn;
}
/** /**
* Allocate memory and initialize ServingCellConfigCommon struct members * Allocate memory and initialize ServingCellConfigCommon struct members
*/ */
...@@ -2131,130 +2093,6 @@ gNB_RRC_INST *RCconfig_NRRRC() ...@@ -2131,130 +2093,6 @@ gNB_RRC_INST *RCconfig_NRRRC()
return rrc; return rrc;
} }
int RCconfig_NR_NG(MessageDef *msg_p, uint32_t i)
{
int j,k = 0;
int gnb_id;
char* gnb_ipv4_address_for_NGU = NULL;
uint32_t gnb_port_for_NGU = 0;
char* gnb_ipv4_address_for_S1U = NULL;
uint32_t gnb_port_for_S1U = 0;
GET_PARAMS(GNBSParams, GNBSPARAMS_DESC, NULL);
AssertFatal (i<GNBSParams[GNB_ACTIVE_GNBS_IDX].numelt,
"Failed to parse config file %s, %uth attribute %s \n",
RC.config_file_name, i, GNB_CONFIG_STRING_ACTIVE_GNBS);
if (GNBSParams[GNB_ACTIVE_GNBS_IDX].numelt>0) {
// Output a list of all gNBs.
GET_PARAMS_LIST(GNBParamList, GNBParams, GNBPARAMS_DESC, GNB_CONFIG_STRING_GNB_LIST, NULL);
if (GNBParamList.numelt > 0) {
for (k = 0; k < GNBParamList.numelt; k++) {
if (GNBParamList.paramarray[k][GNB_GNB_ID_IDX].uptr == NULL) {
// Calculate a default gNB ID
if (IS_SA_MODE(get_softmodem_params())) {
uint32_t hash;
hash = ngap_generate_gNB_id ();
gnb_id = k + (hash & 0xFFFFFF8);
} else {
gnb_id = k;
}
} else {
gnb_id = *(GNBParamList.paramarray[k][GNB_GNB_ID_IDX].uptr);
}
// search if in active list
for (j=0; j < GNBSParams[GNB_ACTIVE_GNBS_IDX].numelt; j++) {
if (strcmp(GNBSParams[GNB_ACTIVE_GNBS_IDX].strlistptr[j], *(GNBParamList.paramarray[k][GNB_GNB_NAME_IDX].strptr)) == 0) {
char aprefix[MAX_OPTNAME_SIZE*2 + 8];
NGAP_REGISTER_GNB_REQ (msg_p).gNB_id = gnb_id;
if (strcmp(*(GNBParamList.paramarray[k][GNB_CELL_TYPE_IDX].strptr), "CELL_MACRO_GNB") == 0) {
NGAP_REGISTER_GNB_REQ (msg_p).cell_type = CELL_MACRO_GNB;
} else if (strcmp(*(GNBParamList.paramarray[k][GNB_CELL_TYPE_IDX].strptr), "CELL_HOME_GNB") == 0) {
NGAP_REGISTER_GNB_REQ (msg_p).cell_type = CELL_HOME_ENB;
} else {
AssertFatal (0,
"Failed to parse gNB configuration file %s, gnb %u unknown value \"%s\" for cell_type choice: CELL_MACRO_GNB or CELL_HOME_GNB !\n",
RC.config_file_name, i, *(GNBParamList.paramarray[k][GNB_CELL_TYPE_IDX].strptr));
}
NGAP_REGISTER_GNB_REQ (msg_p).gNB_name = strdup(*(GNBParamList.paramarray[k][GNB_GNB_NAME_IDX].strptr));
NGAP_REGISTER_GNB_REQ (msg_p).tac = *GNBParamList.paramarray[k][GNB_TRACKING_AREA_CODE_IDX].uptr;
AssertFatal(!GNBParamList.paramarray[k][GNB_MOBILE_COUNTRY_CODE_IDX_OLD].strptr
&& !GNBParamList.paramarray[k][GNB_MOBILE_NETWORK_CODE_IDX_OLD].strptr,
"It seems that you use an old configuration file. Please change the existing\n"
" tracking_area_code = \"1\";\n"
" mobile_country_code = \"208\";\n"
" mobile_network_code = \"93\";\n"
"to\n"
" tracking_area_code = 1; // no string!!\n"
" plmn_list = ( { mcc = 208; mnc = 93; mnc_length = 2; } )\n");
// PLMN
plmn_id_t p[PLMN_LIST_MAX_SIZE] = {0};
NGAP_REGISTER_GNB_REQ(msg_p).num_plmn = set_plmn_config(p, 0);
for (int l = 0; l < NGAP_REGISTER_GNB_REQ(msg_p).num_plmn; ++l) {
NGAP_REGISTER_GNB_REQ(msg_p).plmn[l].plmn = p[l];
// SNSSAI
NGAP_REGISTER_GNB_REQ(msg_p).plmn[l].num_nssai = set_snssai_config(NGAP_REGISTER_GNB_REQ(msg_p).plmn[l].s_nssai, 8, k, l);
}
NGAP_REGISTER_GNB_REQ(msg_p).default_drx = 0;
// NG
snprintf(aprefix, sizeof(aprefix), "%s.[%i]", GNB_CONFIG_STRING_GNB_LIST, k);
GET_PARAMS_LIST(NGParamList, NGParams, GNBNGPARAMS_DESC, GNB_CONFIG_STRING_AMF_IP_ADDRESS, aprefix);
NGAP_REGISTER_GNB_REQ (msg_p).nb_amf = 0;
for (int l = 0; l < NGParamList.numelt; l++) {
NGAP_REGISTER_GNB_REQ (msg_p).nb_amf += 1;
strcpy(NGAP_REGISTER_GNB_REQ (msg_p).amf_ip_address[l].ipv4_address,*(NGParamList.paramarray[l][GNB_AMF_IPV4_ADDRESS_IDX].strptr));
NGAP_REGISTER_GNB_REQ (msg_p).amf_ip_address[j].ipv4 = 1;
NGAP_REGISTER_GNB_REQ (msg_p).amf_ip_address[j].ipv6 = 0;
/* if no broadcasst_plmn array is defined, fill default values */
if (NGAP_REGISTER_GNB_REQ(msg_p).broadcast_plmn_num[l] == 0) {
NGAP_REGISTER_GNB_REQ(msg_p).broadcast_plmn_num[l] = NGAP_REGISTER_GNB_REQ(msg_p).num_plmn;
for (int el = 0; el < NGAP_REGISTER_GNB_REQ(msg_p).num_plmn; ++el)
NGAP_REGISTER_GNB_REQ(msg_p).broadcast_plmn_index[l][el] = el;
}
}
// SCTP SETTING
NGAP_REGISTER_GNB_REQ (msg_p).sctp_out_streams = SCTP_OUT_STREAMS;
NGAP_REGISTER_GNB_REQ (msg_p).sctp_in_streams = SCTP_IN_STREAMS;
if (IS_SA_MODE(get_softmodem_params())) {
snprintf(aprefix, sizeof(aprefix), "%s.[%d].%s", GNB_CONFIG_STRING_GNB_LIST, k, GNB_CONFIG_STRING_SCTP_CONFIG);
GET_PARAMS(SCTPParams, GNBSCTPPARAMS_DESC, aprefix);
NGAP_REGISTER_GNB_REQ (msg_p).sctp_in_streams = (uint16_t)*(SCTPParams[GNB_SCTP_INSTREAMS_IDX].uptr);
NGAP_REGISTER_GNB_REQ (msg_p).sctp_out_streams = (uint16_t)*(SCTPParams[GNB_SCTP_OUTSTREAMS_IDX].uptr);
}
// NETWORK_INTERFACES
snprintf(aprefix, sizeof(aprefix), "%s.[%d].%s", GNB_CONFIG_STRING_GNB_LIST, k, GNB_CONFIG_STRING_NETWORK_INTERFACES_CONFIG);
GET_PARAMS(NETParams, GNBNETPARAMS_DESC, aprefix);
if (NETParams[GNB_IPV4_ADDRESS_FOR_NG_AMF_IDX].strptr != NULL) {
char *cidr = *(NETParams[GNB_IPV4_ADDRESS_FOR_NG_AMF_IDX].strptr);
char *save = NULL;
char *address = strtok_r(cidr, "/", &save);
strcpy(NGAP_REGISTER_GNB_REQ (msg_p).gnb_ip_address.ipv4_address, address);
LOG_I(GNB_APP, "Parsed IPv4 address for NG AMF: %s\n", address);
}
NGAP_REGISTER_GNB_REQ (msg_p).gnb_ip_address.ipv6 = 0;
NGAP_REGISTER_GNB_REQ (msg_p).gnb_ip_address.ipv4 = 1;
break;
}
}
}
}
}
return 0;
}
static pthread_mutex_t rc_mutex = PTHREAD_MUTEX_INITIALIZER; static pthread_mutex_t rc_mutex = PTHREAD_MUTEX_INITIALIZER;
static bool rc_done = false; static bool rc_done = false;
......
...@@ -44,7 +44,6 @@ void RCconfig_nr_macrlc(configmodule_interface_t *cfg); ...@@ -44,7 +44,6 @@ void RCconfig_nr_macrlc(configmodule_interface_t *cfg);
void NRRCConfig(void); void NRRCConfig(void);
gNB_RRC_INST *RCconfig_NRRRC(); gNB_RRC_INST *RCconfig_NRRRC();
int RCconfig_NR_NG(MessageDef *msg_p, uint32_t i);
int RCconfig_NR_X2(MessageDef *msg_p, uint32_t i); int RCconfig_NR_X2(MessageDef *msg_p, uint32_t i);
void wait_f1_setup_response(void); void wait_f1_setup_response(void);
f1ap_tdd_info_t read_tdd_config(const NR_ServingCellConfigCommon_t *scc); f1ap_tdd_info_t read_tdd_config(const NR_ServingCellConfigCommon_t *scc);
......
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* 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
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
#include "openair2/GNB_APP/gnb_config_common.h"
#include "common/config/config_paramdesc.h"
#include "common/config/config_userapi.h"
#include "RRC_nr_paramsvalues.h"
#include "gnb_paramdef.h"
#include "sctp_default_values.h"
uint16_t set_snssai_config(nssai_t *nssai, const int max_num_ssi, uint8_t k, uint8_t l)
{
char snssaistr[MAX_OPTNAME_SIZE * 2 + 8];
snprintf(snssaistr, sizeof(snssaistr), "%s.[%i].%s.[%i]", GNB_CONFIG_STRING_GNB_LIST, k, GNB_CONFIG_STRING_PLMN_LIST, l);
GET_PARAMS_LIST(SNSSAIParamList,
SNSSAIParams,
GNBSNSSAIPARAMS_DESC,
GNB_CONFIG_STRING_SNSSAI_LIST,
snssaistr,
SNSSAIPARAMS_CHECK);
uint16_t num_ssi = SNSSAIParamList.numelt;
AssertFatal(num_ssi < max_num_ssi, "S-NSSAI size %d exceeds the max array size %d", num_ssi, max_num_ssi);
for (int s = 0; s < num_ssi; ++s) {
nssai[s].sst = *SNSSAIParamList.paramarray[s][GNB_SLICE_SERVICE_TYPE_IDX].uptr;
// SD is optional
// 0xffffff is "no SD", see 23.003 Sec 28.4.2
nssai[s].sd = *SNSSAIParamList.paramarray[s][GNB_SLICE_DIFFERENTIATOR_IDX].uptr;
AssertFatal(nssai[s].sd <= 0xffffff, "SD cannot be bigger than 0xffffff, but is %d\n", nssai[s].sd);
}
return num_ssi;
}
uint8_t set_plmn_config(plmn_id_t *p, uint8_t idx)
{
char gnbpath[MAX_OPTNAME_SIZE * 2 + 8];
snprintf(gnbpath, sizeof(gnbpath), "%s.[%i]", GNB_CONFIG_STRING_GNB_LIST, idx);
GET_PARAMS_LIST(PLMNParamList, PLMNParams, GNBPLMNPARAMS_DESC, GNB_CONFIG_STRING_PLMN_LIST, gnbpath, PLMNPARAMS_CHECK);
uint8_t num_plmn = PLMNParamList.numelt;
AssertFatal(num_plmn >= 1 && num_plmn <= 6, "The number of PLMN IDs must be in [1,6], but is %d\n", num_plmn);
for (int l = 0; l < num_plmn; ++l) {
plmn_id_t *plmn = &p[l];
plmn->mcc = *PLMNParamList.paramarray[l][GNB_MOBILE_COUNTRY_CODE_IDX].uptr;
plmn->mnc = *PLMNParamList.paramarray[l][GNB_MOBILE_NETWORK_CODE_IDX].uptr;
plmn->mnc_digit_length = *PLMNParamList.paramarray[l][GNB_MNC_DIGIT_LENGTH].u8ptr;
AssertFatal((plmn->mnc_digit_length == 2) || (plmn->mnc_digit_length == 3), "BAD MNC DIGIT LENGTH %d", plmn->mnc_digit_length);
}
return num_plmn;
}
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* 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
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
#include <assert.h>
#include "common/5g_platform_types.h"
uint16_t set_snssai_config(nssai_t *nssai, const int max_num_ssi, uint8_t k, uint8_t l);
uint8_t set_plmn_config(plmn_id_t *p, uint8_t idx);
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* 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
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
#include "gnb_config_ng.h"
#include <stdint.h>
#include "assertions.h"
#include "common/ran_context.h"
#include "openair2/GNB_APP/gnb_config_common.h"
#include "common/config/config_paramdesc.h"
#include "sctp_default_values.h"
#include "gnb_paramdef.h"
int RCconfig_NR_NG(MessageDef *msg_p, uint32_t i)
{
int j, k = 0;
int gnb_id;
char *gnb_ipv4_address_for_NGU = NULL;
uint32_t gnb_port_for_NGU = 0;
char *gnb_ipv4_address_for_S1U = NULL;
uint32_t gnb_port_for_S1U = 0;
GET_PARAMS(GNBSParams, GNBSPARAMS_DESC, NULL);
AssertFatal(i < GNBSParams[GNB_ACTIVE_GNBS_IDX].numelt,
"Failed to parse config file %s, %uth attribute %s \n",
RC.config_file_name,
i,
GNB_CONFIG_STRING_ACTIVE_GNBS);
if (GNBSParams[GNB_ACTIVE_GNBS_IDX].numelt > 0) {
// Output a list of all gNBs.
GET_PARAMS_LIST(GNBParamList, GNBParams, GNBPARAMS_DESC, GNB_CONFIG_STRING_GNB_LIST, NULL);
if (GNBParamList.numelt > 0) {
for (k = 0; k < GNBParamList.numelt; k++) {
if (GNBParamList.paramarray[k][GNB_GNB_ID_IDX].uptr == NULL) {
// Calculate a default gNB ID
if (IS_SA_MODE(get_softmodem_params())) {
uint32_t hash;
hash = ngap_generate_gNB_id();
gnb_id = k + (hash & 0xFFFFFF8);
} else {
gnb_id = k;
}
} else {
gnb_id = *(GNBParamList.paramarray[k][GNB_GNB_ID_IDX].uptr);
}
// search if in active list
for (j = 0; j < GNBSParams[GNB_ACTIVE_GNBS_IDX].numelt; j++) {
if (strcmp(GNBSParams[GNB_ACTIVE_GNBS_IDX].strlistptr[j], *(GNBParamList.paramarray[k][GNB_GNB_NAME_IDX].strptr)) == 0) {
char aprefix[MAX_OPTNAME_SIZE * 2 + 8];
NGAP_REGISTER_GNB_REQ(msg_p).gNB_id = gnb_id;
if (strcmp(*(GNBParamList.paramarray[k][GNB_CELL_TYPE_IDX].strptr), "CELL_MACRO_GNB") == 0) {
NGAP_REGISTER_GNB_REQ(msg_p).cell_type = CELL_MACRO_GNB;
} else if (strcmp(*(GNBParamList.paramarray[k][GNB_CELL_TYPE_IDX].strptr), "CELL_HOME_GNB") == 0) {
NGAP_REGISTER_GNB_REQ(msg_p).cell_type = CELL_HOME_ENB;
} else {
AssertFatal(0,
"Failed to parse gNB configuration file %s, gnb %u unknown value \"%s\" for cell_type choice: "
"CELL_MACRO_GNB or CELL_HOME_GNB !\n",
RC.config_file_name,
i,
*(GNBParamList.paramarray[k][GNB_CELL_TYPE_IDX].strptr));
}
NGAP_REGISTER_GNB_REQ(msg_p).gNB_name = strdup(*(GNBParamList.paramarray[k][GNB_GNB_NAME_IDX].strptr));
NGAP_REGISTER_GNB_REQ(msg_p).tac = *GNBParamList.paramarray[k][GNB_TRACKING_AREA_CODE_IDX].uptr;
AssertFatal(!GNBParamList.paramarray[k][GNB_MOBILE_COUNTRY_CODE_IDX_OLD].strptr
&& !GNBParamList.paramarray[k][GNB_MOBILE_NETWORK_CODE_IDX_OLD].strptr,
"It seems that you use an old configuration file. Please change the existing\n"
" tracking_area_code = \"1\";\n"
" mobile_country_code = \"208\";\n"
" mobile_network_code = \"93\";\n"
"to\n"
" tracking_area_code = 1; // no string!!\n"
" plmn_list = ( { mcc = 208; mnc = 93; mnc_length = 2; } )\n");
// PLMN
plmn_id_t p[PLMN_LIST_MAX_SIZE] = {0};
NGAP_REGISTER_GNB_REQ(msg_p).num_plmn = set_plmn_config(p, 0);
for (int l = 0; l < NGAP_REGISTER_GNB_REQ(msg_p).num_plmn; ++l) {
NGAP_REGISTER_GNB_REQ(msg_p).plmn[l].plmn = p[l];
// SNSSAI
NGAP_REGISTER_GNB_REQ(msg_p).plmn[l].num_nssai =
set_snssai_config(NGAP_REGISTER_GNB_REQ(msg_p).plmn[l].s_nssai, 8, k, l);
}
NGAP_REGISTER_GNB_REQ(msg_p).default_drx = 0;
// NG
snprintf(aprefix, sizeof(aprefix), "%s.[%i]", GNB_CONFIG_STRING_GNB_LIST, k);
GET_PARAMS_LIST(NGParamList, NGParams, GNBNGPARAMS_DESC, GNB_CONFIG_STRING_AMF_IP_ADDRESS, aprefix);
NGAP_REGISTER_GNB_REQ(msg_p).nb_amf = 0;
for (int l = 0; l < NGParamList.numelt; l++) {
NGAP_REGISTER_GNB_REQ(msg_p).nb_amf += 1;
strcpy(NGAP_REGISTER_GNB_REQ(msg_p).amf_ip_address[l].ipv4_address,
*(NGParamList.paramarray[l][GNB_AMF_IPV4_ADDRESS_IDX].strptr));
NGAP_REGISTER_GNB_REQ(msg_p).amf_ip_address[l].ipv4 = 1;
NGAP_REGISTER_GNB_REQ(msg_p).amf_ip_address[l].ipv6 = 0;
/* if no broadcasst_plmn array is defined, fill default values */
if (NGAP_REGISTER_GNB_REQ(msg_p).broadcast_plmn_num[l] == 0) {
NGAP_REGISTER_GNB_REQ(msg_p).broadcast_plmn_num[l] = NGAP_REGISTER_GNB_REQ(msg_p).num_plmn;
for (int el = 0; el < NGAP_REGISTER_GNB_REQ(msg_p).num_plmn; ++el)
NGAP_REGISTER_GNB_REQ(msg_p).broadcast_plmn_index[l][el] = el;
}
}
// SCTP SETTING
NGAP_REGISTER_GNB_REQ(msg_p).sctp_out_streams = SCTP_OUT_STREAMS;
NGAP_REGISTER_GNB_REQ(msg_p).sctp_in_streams = SCTP_IN_STREAMS;
if (IS_SA_MODE(get_softmodem_params())) {
snprintf(aprefix, sizeof(aprefix), "%s.[%d].%s", GNB_CONFIG_STRING_GNB_LIST, k, GNB_CONFIG_STRING_SCTP_CONFIG);
GET_PARAMS(SCTPParams, GNBSCTPPARAMS_DESC, aprefix);
NGAP_REGISTER_GNB_REQ(msg_p).sctp_in_streams = (uint16_t) * (SCTPParams[GNB_SCTP_INSTREAMS_IDX].uptr);
NGAP_REGISTER_GNB_REQ(msg_p).sctp_out_streams = (uint16_t) * (SCTPParams[GNB_SCTP_OUTSTREAMS_IDX].uptr);
}
// NETWORK_INTERFACES
snprintf(aprefix,
sizeof(aprefix),
"%s.[%d].%s",
GNB_CONFIG_STRING_GNB_LIST,
k,
GNB_CONFIG_STRING_NETWORK_INTERFACES_CONFIG);
GET_PARAMS(NETParams, GNBNETPARAMS_DESC, aprefix);
if (NETParams[GNB_IPV4_ADDRESS_FOR_NG_AMF_IDX].strptr != NULL) {
char *cidr = *(NETParams[GNB_IPV4_ADDRESS_FOR_NG_AMF_IDX].strptr);
char *save = NULL;
char *address = strtok_r(cidr, "/", &save);
strcpy(NGAP_REGISTER_GNB_REQ(msg_p).gnb_ip_address.ipv4_address, address);
LOG_I(GNB_APP, "Parsed IPv4 address for NG AMF: %s\n", address);
}
NGAP_REGISTER_GNB_REQ(msg_p).gnb_ip_address.ipv6 = 0;
NGAP_REGISTER_GNB_REQ(msg_p).gnb_ip_address.ipv4 = 1;
break;
}
}
}
}
}
return 0;
}
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* 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
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
#ifndef NGAP_GNB_CONFIG_H_
#define NGAP_GNB_CONFIG_H_
#include <stdint.h>
#include "intertask_interface.h"
int RCconfig_NR_NG(MessageDef *msg_p, uint32_t i);
#endif /* NGAP_GNB_CONFIG_H_ */
...@@ -58,6 +58,7 @@ ...@@ -58,6 +58,7 @@
#include "ngap_gNB_mobility_management.h" #include "ngap_gNB_mobility_management.h"
#include "ngap_gNB_ue_context.h" #include "ngap_gNB_ue_context.h"
#include "ngap_gNB_pdu_session_management.h" #include "ngap_gNB_pdu_session_management.h"
#include "ngap_gNB_NRPPa_transport_procedures.h"
#include "oai_asn1.h" #include "oai_asn1.h"
#include "openair3/SECU/kdf.h" #include "openair3/SECU/kdf.h"
#include "queue.h" #include "queue.h"
...@@ -626,6 +627,14 @@ void *ngap_gNB_process_itti_msg(void *notUsed) { ...@@ -626,6 +627,14 @@ void *ngap_gNB_process_itti_msg(void *notUsed) {
ngap_gNB_handle_ul_ran_status_transfer(instance, &NGAP_UL_RAN_STATUS_TRANSFER(received_msg)); ngap_gNB_handle_ul_ran_status_transfer(instance, &NGAP_UL_RAN_STATUS_TRANSFER(received_msg));
break; break;
case NGAP_UPLINKUEASSOCIATEDNRPPA:
ngap_gNB_uplink_ue_associated_nrppa_transport(instance, &NGAP_UPLINKUEASSOCIATEDNRPPA(received_msg));
break;
case NGAP_UPLINKNONUEASSOCIATEDNRPPA:
ngap_gNB_uplink_non_ue_associated_nrppa_transport(instance, &NGAP_UPLINKNONUEASSOCIATEDNRPPA(received_msg));
break;
default: default:
NGAP_ERROR("Received unhandled message: %d:%s\n", ITTI_MSG_ID(received_msg), ITTI_MSG_NAME(received_msg)); NGAP_ERROR("Received unhandled message: %d:%s\n", ITTI_MSG_ID(received_msg), ITTI_MSG_NAME(received_msg));
break; break;
......
This diff is collapsed.
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* 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
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
#ifndef NGAP_GNB_NRPPA_PROCEDURES_H_
#define NGAP_GNB_NRPPA_PROCEDURES_H_
// UPLINK UE ASSOCIATED NRPPA TRANSPORT (9.2.9.2 of TS 38.413 Version 16.0.0)
int ngap_gNB_uplink_ue_associated_nrppa_transport(instance_t instance, const ngap_uplink_ue_associated_nrppa_t *msg);
// UPLINK NON UE ASSOCIATED NRPPA TRANSPORT (9.2.9.4 of TS 38.413 Version 16.0.0)
int ngap_gNB_uplink_non_ue_associated_nrppa_transport(instance_t instance, const ngap_uplink_non_ue_associated_nrppa_t *msg);
// DOWNLINK UE ASSOCIATED NRPPA TRANSPORT (9.2.9.1 of TS 38.413 Version 16.0.0)
int ngap_gNB_handle_downlink_ue_associated_nrppa_transport(sctp_assoc_t assoc_id, uint32_t stream, NGAP_NGAP_PDU_t *pdu);
// DOWNLINK UE ASSOCIATED NRPPA TRANSPORT (9.2.9.3 of TS 38.413 Version 16.0.0)
int ngap_gNB_handle_downlink_non_ue_associated_nrppa_transport(sctp_assoc_t assoc_id, uint32_t stream, NGAP_NGAP_PDU_t *pdu);
#endif /* NGAP_GNB_NRPPA_PROCEDURES_H_ */
...@@ -112,6 +112,18 @@ static int ngap_gNB_decode_initiating_message(NGAP_NGAP_PDU_t *pdu) { ...@@ -112,6 +112,18 @@ static int ngap_gNB_decode_initiating_message(NGAP_NGAP_PDU_t *pdu) {
NGAP_INFO("DL RAN Status Transfer initiating message\n"); NGAP_INFO("DL RAN Status Transfer initiating message\n");
break; break;
case NGAP_ProcedureCode_id_DownlinkUEAssociatedNRPPaTransport:
res = asn_encode_to_new_buffer(NULL, ATS_CANONICAL_XER, &asn_DEF_NGAP_NGAP_PDU, pdu);
free(res.buffer);
NGAP_INFO("DL UE Associated NRPPA Transport initiating message\n");
break;
case NGAP_ProcedureCode_id_DownlinkNonUEAssociatedNRPPaTransport:
res = asn_encode_to_new_buffer(NULL, ATS_CANONICAL_XER, &asn_DEF_NGAP_NGAP_PDU, pdu);
free(res.buffer);
NGAP_INFO("DL NON UE Associated NRPPA Transport initiating message\n");
break;
default: default:
NGAP_ERROR("Unknown procedure ID (%d) for initiating message\n", NGAP_ERROR("Unknown procedure ID (%d) for initiating message\n",
(int)pdu->choice.initiatingMessage->procedureCode); (int)pdu->choice.initiatingMessage->procedureCode);
......
...@@ -56,7 +56,9 @@ static inline int ngap_gNB_encode_initiating(NGAP_NGAP_PDU_t *pdu, uint8_t **buf ...@@ -56,7 +56,9 @@ static inline int ngap_gNB_encode_initiating(NGAP_NGAP_PDU_t *pdu, uint8_t **buf
NGAP_ProcedureCode_id_UplinkRANStatusTransfer, NGAP_ProcedureCode_id_UplinkRANStatusTransfer,
NGAP_ProcedureCode_id_HandoverPreparation, NGAP_ProcedureCode_id_HandoverPreparation,
NGAP_ProcedureCode_id_HandoverCancel, NGAP_ProcedureCode_id_HandoverCancel,
NGAP_ProcedureCode_id_HandoverNotification}; NGAP_ProcedureCode_id_HandoverNotification,
NGAP_ProcedureCode_id_UplinkUEAssociatedNRPPaTransport,
NGAP_ProcedureCode_id_UplinkNonUEAssociatedNRPPaTransport};
int i; int i;
for (i = 0; i < sizeofArray(tmp); i++) for (i = 0; i < sizeofArray(tmp); i++)
if (pdu->choice.initiatingMessage->procedureCode == tmp[i]) if (pdu->choice.initiatingMessage->procedureCode == tmp[i])
......
...@@ -50,6 +50,7 @@ ...@@ -50,6 +50,7 @@
#include "ngap_gNB_pdu_session_management.h" #include "ngap_gNB_pdu_session_management.h"
#include "ngap_gNB_nas_procedures.h" #include "ngap_gNB_nas_procedures.h"
#include "ngap_gNB_paging.h" #include "ngap_gNB_paging.h"
#include "ngap_gNB_NRPPa_transport_procedures.h"
#include "ngap_gNB_trace.h" #include "ngap_gNB_trace.h"
#include "ngap_gNB_ue_context.h" #include "ngap_gNB_ue_context.h"
#include "ngap_messages_types.h" #include "ngap_messages_types.h"
...@@ -1499,10 +1500,10 @@ const ngap_message_decoded_callback ngap_messages_callback[][3] = { ...@@ -1499,10 +1500,10 @@ const ngap_message_decoded_callback ngap_messages_callback[][3] = {
{0, 0, 0}, /* CellTrafficTrace */ {0, 0, 0}, /* CellTrafficTrace */
{ngap_gNB_handle_deactivate_trace, 0, 0}, /* DeactivateTrace */ {ngap_gNB_handle_deactivate_trace, 0, 0}, /* DeactivateTrace */
{ngap_gNB_handle_nas_downlink, 0, 0}, /* DownlinkNASTransport */ {ngap_gNB_handle_nas_downlink, 0, 0}, /* DownlinkNASTransport */
{0, 0, 0}, /* DownlinkNonUEAssociatedNRPPaTransport */ {ngap_gNB_handle_downlink_non_ue_associated_nrppa_transport, 0, 0}, /* DownlinkNonUEAssociatedNRPPaTransport */
{0, 0, 0}, /* DownlinkRANConfigurationTransfer */ {0, 0, 0}, /* DownlinkRANConfigurationTransfer */
{ngap_gNB_handle_dl_ran_status_transfer, 0, 0}, /* DownlinkRANStatusTransfer */ {ngap_gNB_handle_dl_ran_status_transfer, 0, 0}, /* DownlinkRANStatusTransfer */
{0, 0, 0}, /* DownlinkUEAssociatedNRPPaTransport */ {ngap_gNB_handle_downlink_ue_associated_nrppa_transport, 0, 0}, /* DownlinkUEAssociatedNRPPaTransport */
{ngap_gNB_handle_error_indication, 0, 0}, /* ErrorIndication */ {ngap_gNB_handle_error_indication, 0, 0}, /* ErrorIndication */
{0, ngap_gNB_handle_handover_cancel_ack, 0}, /* HandoverCancel */ {0, ngap_gNB_handle_handover_cancel_ack, 0}, /* HandoverCancel */
{0, 0, 0}, /* HandoverNotification */ {0, 0, 0}, /* HandoverNotification */
......
add_subdirectory(MESSAGES) add_subdirectory(MESSAGES)
add_executable(test_nrppa ${OPENAIR3_DIR}/NRPPA/test_nrppa.c ) add_library(nrppa
target_link_libraries(test_nrppa asn1_nrppa) nrppa_gNB.c
nrppa_gNB_config.c
nrppa_gNB_handlers.c
nrppa_gNB_decoder.c
nrppa_gNB_ue_context.c
nrppa_gNB_location_information_transfer.c
nrppa_gNB_encoder.c
nrppa_gNB_measurement_information_transfer.c
)
target_link_libraries(nrppa PUBLIC asn1_nrppa)
target_link_libraries(nrppa PRIVATE asn1_lte_rrc_hdrs asn1_nr_rrc_hdrs)
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* 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
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
#ifndef NRPPA_COMMON_H_
#define NRPPA_COMMON_H_
#include "oai_asn1.h"
#include "common/utils/LOG/log.h"
#include "ds/byte_array.h"
#include "nrppa_includes.h"
#define NRPPA_FIND_PROTOCOLIE_BY_ID(IE_TYPE, ie, container, IE_ID, mandatory) \
do { \
IE_TYPE **ptr; \
ie = NULL; \
for (ptr = container->protocolIEs.list.array; ptr < &container->protocolIEs.list.array[container->protocolIEs.list.count]; \
ptr++) { \
if ((*ptr)->id == IE_ID) { \
ie = *ptr; \
break; \
} \
} \
if (ie == NULL) { \
if (mandatory) { \
AssertFatal(false, "NRPPA_FIND_PROTOCOLIE_BY_ID ie is NULL (searching for ie: %ld)\n", IE_ID); \
} else { \
LOG_I(NRPPA, "NRPPA_FIND_PROTOCOLIE_BY_ID ie is NULL (searching for ie: %ld)\n", IE_ID); \
} \
} \
} while (0); \
if (mandatory && !ie) \
return -1
// gnb and ue related info in NRPPA message
typedef struct nrppa_gnb_ue_info_s {
instance_t instance;
int32_t gNB_ue_ngap_id;
int64_t amf_ue_ngap_id;
byte_array_t routing_id;
} nrppa_gnb_ue_info_t;
typedef int (*nrppa_message_decoded_callback)(nrppa_gnb_ue_info_t *nrppa_msg_info, const NRPPA_NRPPA_PDU_t *pdu);
#endif /* NRPPA_COMMON_H_ */
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* 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
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
#include "tree.h"
#include "queue.h"
#include "intertask_interface.h"
#include "assertions.h"
#include "conversions.h"
#include "nrppa_gNB.h"
#include "nrppa_common.h"
#include "nrppa_gNB_handlers.h"
#include "nrppa_gNB_location_information_transfer.h"
#include "nrppa_gNB_measurement_information_transfer.h"
void nrppa_gNB_init(void)
{
LOG_I(NRPPA, "Starting NRPPA layer\n");
itti_mark_task_ready(TASK_NRPPA);
}
void *nrppa_gNB_process_itti_msg(void *notUsed)
{
MessageDef *received_msg = NULL;
int result;
itti_receive_msg(TASK_NRPPA, &received_msg);
if (received_msg) {
instance_t instance = ITTI_MSG_DESTINATION_INSTANCE(received_msg);
LOG_I(NRPPA, "Received message %s\n", ITTI_MSG_NAME(received_msg));
switch (ITTI_MSG_ID(received_msg)) {
case TERMINATE_MESSAGE:
LOG_W(NRPPA, " *** Exiting NRPPA thread\n");
itti_exit_task();
break;
case NGAP_DOWNLINKUEASSOCIATEDNRPPA:
nrppa_handle_downlink_ue_associated_nrppa_transport(instance, &NGAP_DOWNLINKUEASSOCIATEDNRPPA(received_msg));
break;
case NGAP_DOWNLINKNONUEASSOCIATEDNRPPA:
nrppa_handle_downlink_non_ue_associated_nrppa_transport(instance, &NGAP_DOWNLINKNONUEASSOCIATEDNRPPA(received_msg));
break;
case NRPPA_TRP_INFORMATION_RESP:
nrppa_gNB_trp_information_response(instance, received_msg);
break;
case NRPPA_POSITIONING_INFORMATION_RESP:
nrppa_gNB_positioning_information_response(instance, received_msg);
break;
case NRPPA_POSITIONING_ACTIVATION_RESP:
nrppa_gNB_positioning_activation_response(instance, received_msg);
break;
case NRPPA_MEASUREMENT_RESP:
nrppa_gNB_measurement_response(instance, received_msg);
break;
default:
LOG_E(NRPPA, "Received unhandled message: %d:%s\n", ITTI_MSG_ID(received_msg), ITTI_MSG_NAME(received_msg));
break;
}
result = itti_free(ITTI_MSG_ORIGIN_ID(received_msg), received_msg);
AssertFatal(result == EXIT_SUCCESS, "Failed to free memory (%d)!\n", result);
}
return NULL;
}
void *nrppa_gNB_task(void *arg)
{
nrppa_gNB_init();
while (1) {
(void)nrppa_gNB_process_itti_msg(NULL);
}
return NULL;
}
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* 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
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
#include <stdio.h>
#include <stdint.h>
#ifndef NRPPA_GNB_H_
#define NRPPA_GNB_H_
void nrppa_gNB_init(void);
void *nrppa_gNB_process_itti_msg(void *notUsed);
void *nrppa_gNB_task(void *arg);
#endif /* NRPPA_GNB_H_ */
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* 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
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
#include "nrppa_gNB_config.h"
#include "assertions.h"
#include "openair1/PHY/defs_nr_common.h"
#include "openair1/PHY/defs_gNB.h"
#include "common/ran_context.h"
#include "positioning_nr_paramdef.h"
positioning_config_t RCconfig_nr_positioning(void)
{
positioning_config_t positioning_config = {0};
paramdef_t positioning_params_desc[] = POSITIONING_PARAMS_DESC;
int num_params = sizeofArray(positioning_params_desc);
GET_PARAMS_LIST(POSITIONING_ParamList, POSITIONING_Params, POSITIONING_PARAMS_DESC, CONFIG_STRING_POSITIONING_CONFIG, NULL);
if (POSITIONING_ParamList.numelt > 0) {
paramdef_t *params = POSITIONING_ParamList.paramarray[0];
uint8_t num_trp = *gpd(params, num_params, CONFIG_STRING_POSITIONING_NUM_TRPS)->uptr;
if (num_trp == 0) {
LOG_E(NR_PHY, "No TRP configuration found..!!!\n");
return positioning_config;
} else if (num_trp > MAX_NUM_TRPs) {
AssertFatal(false, "Exceeded MAX number of TRPs\n");
}
uint8_t num_ids = gpd(params, num_params, CONFIG_STRING_POSITIONING_TRP_IDS_LIST)->numelt;
uint8_t num_x = gpd(params, num_params, CONFIG_STRING_POSITIONING_TRP_X_AXIS_LIST)->numelt;
uint8_t num_y = gpd(params, num_params, CONFIG_STRING_POSITIONING_TRP_Y_AXIS_LIST)->numelt;
uint8_t num_z = gpd(params, num_params, CONFIG_STRING_POSITIONING_TRP_Z_AXIS_LIST)->numelt;
uint8_t num_unit = gpd(params, num_params, CONFIG_STRING_POSITIONING_TRP_UNIT_LIST)->numelt;
if (num_trp != num_ids || num_trp != num_x || num_trp != num_y || num_trp != num_z || num_trp != num_unit) {
AssertFatal(false, "Mismatch in the number of TRPs with the number of ids, x-axis, y-axis, z-axis, units\n");
}
positioning_config.num_trp = num_trp;
for (int l = 0; l < num_trp; l++) {
positioning_config.trps[l].id = gpd(params, num_params, CONFIG_STRING_POSITIONING_TRP_IDS_LIST)->uptr[l];
positioning_config.trps[l].x_axis = gpd(params, num_params, CONFIG_STRING_POSITIONING_TRP_X_AXIS_LIST)->uptr[l];
positioning_config.trps[l].y_axis = gpd(params, num_params, CONFIG_STRING_POSITIONING_TRP_Y_AXIS_LIST)->uptr[l];
positioning_config.trps[l].z_axis = gpd(params, num_params, CONFIG_STRING_POSITIONING_TRP_Z_AXIS_LIST)->uptr[l];
positioning_config.trps[l].unit = gpd(params, num_params, CONFIG_STRING_POSITIONING_TRP_UNIT_LIST)->uptr[l];
}
} else {
LOG_I(NR_PHY, "No " CONFIG_STRING_POSITIONING_CONFIG " configuration found..!!\n");
}
return positioning_config;
}
void dump_positioning_config(const positioning_config_t *positioning_config)
{
uint8_t num_trp = positioning_config->num_trp;
LOG_I(NR_PHY, "-----------------------------------------\n");
LOG_I(NR_PHY, "Positioning Config\n");
LOG_I(NR_PHY, "-----------------------------------------\n");
LOG_I(NR_PHY, "Number of TRPs \t\t%d\n", num_trp);
for (int i = 0; i < num_trp; i++) {
LOG_I(NR_PHY, "X-axis of TRP ID %d \t\t%d\n", positioning_config->trps[i].id, positioning_config->trps[i].x_axis);
LOG_I(NR_PHY, "Y-axis of TRP ID %d \t\t%d\n", positioning_config->trps[i].id, positioning_config->trps[i].y_axis);
LOG_I(NR_PHY, "Z-axis of TRP ID %d \t\t%d\n", positioning_config->trps[i].id, positioning_config->trps[i].z_axis);
}
LOG_I(NR_PHY, "-----------------------------------------\n");
}
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* 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
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
#ifndef GNB_CONFIG_POSITIONING_H_
#define GNB_CONFIG_POSITIONING_H_
#include "openair1/PHY/defs_nr_common.h"
positioning_config_t RCconfig_nr_positioning(void);
void dump_positioning_config(const positioning_config_t *positioning_config);
#endif /* GNB_CONFIG_POSITIONING_H_ */
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* 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
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
#include "assertions.h"
#include "intertask_interface.h"
#include "nrppa_common.h"
#include "nrppa_gNB_decoder.h"
static int nrppa_gNB_decode_initiating_message(NRPPA_NRPPA_PDU_t *pdu)
{
asn_encode_to_new_buffer_result_t res = {NULL, {0, NULL, NULL}};
DevAssert(pdu != NULL);
switch (pdu->choice.initiatingMessage->procedureCode) {
case NRPPA_ProcedureCode_id_tRPInformationExchange: // TRPInformationRequest
res = asn_encode_to_new_buffer(NULL, ATS_CANONICAL_XER, &asn_DEF_NRPPA_NRPPA_PDU, pdu);
LOG_I(NRPPA, "TRP Information Request initiating message\n");
free(res.buffer);
break;
case NRPPA_ProcedureCode_id_positioningInformationExchange: // PositioningInformationRequest
res = asn_encode_to_new_buffer(NULL, ATS_CANONICAL_XER, &asn_DEF_NRPPA_NRPPA_PDU, pdu);
LOG_I(NRPPA, "Positioning Information Request initiating message\n");
free(res.buffer);
break;
case NRPPA_ProcedureCode_id_positioningActivation:
res = asn_encode_to_new_buffer(NULL, ATS_CANONICAL_XER, &asn_DEF_NRPPA_NRPPA_PDU, pdu);
LOG_I(NRPPA, "Positioning Activation initiating message\n");
free(res.buffer);
break;
case NRPPA_ProcedureCode_id_Measurement:
res = asn_encode_to_new_buffer(NULL, ATS_CANONICAL_XER, &asn_DEF_NRPPA_NRPPA_PDU, pdu);
LOG_I(NRPPA, "Positioning Measurement initiating message\n");
free(res.buffer);
break;
default:
AssertFatal(false, "Unknown procedure ID (%d) for initiating message\n", (int)pdu->choice.initiatingMessage->procedureCode);
return -1;
}
return 0;
}
static int nrppa_gNB_decode_successful_outcome(NRPPA_NRPPA_PDU_t *pdu)
{
asn_encode_to_new_buffer_result_t res = {NULL, {0, NULL, NULL}};
DevAssert(pdu != NULL);
switch (pdu->choice.successfulOutcome->procedureCode) {
case NRPPA_ProcedureCode_id_tRPInformationExchange:
res = asn_encode_to_new_buffer(NULL, ATS_CANONICAL_XER, &asn_DEF_NRPPA_NRPPA_PDU, pdu);
LOG_I(NRPPA, "TRP Information Response successfull outcome message\n");
free(res.buffer);
break;
default:
AssertFatal(false,
"Unknown procedure ID (%d) for successfull outcome message\n",
(int)pdu->choice.initiatingMessage->procedureCode);
return -1;
}
return 0;
}
static int nrppa_gNB_decode_unsuccessful_outcome(NRPPA_NRPPA_PDU_t *pdu)
{
asn_encode_to_new_buffer_result_t res = {NULL, {0, NULL, NULL}};
DevAssert(pdu != NULL);
switch (pdu->choice.unsuccessfulOutcome->procedureCode) {
case NRPPA_ProcedureCode_id_tRPInformationExchange:
res = asn_encode_to_new_buffer(NULL, ATS_CANONICAL_XER, &asn_DEF_NRPPA_NRPPA_PDU, pdu);
LOG_I(NRPPA, "TRP Information Failure unsuccessfull outcome message\n");
free(res.buffer);
break;
default:
AssertFatal(false,
"Unknown procedure ID (%d) for unsuccessfull outcome message\n",
(int)pdu->choice.initiatingMessage->procedureCode);
return -1;
}
return 0;
}
int nrppa_gNB_decode_pdu(NRPPA_NRPPA_PDU_t *pdu, const uint8_t *const buffer, const uint32_t length)
{
asn_dec_rval_t dec_ret;
DevAssert(pdu != NULL);
DevAssert(buffer != NULL);
asn_codec_ctx_t st = {.max_stack_size = 100 * 1000}; // if we enable asn1c debug the stack size become large
dec_ret = aper_decode(&st, &asn_DEF_NRPPA_NRPPA_PDU, (void **)&pdu, buffer, length, 0, 0);
if (dec_ret.code != RC_OK) {
LOG_E(NRPPA, "Failed to decode pdu\n");
return -1;
}
switch (pdu->present) {
case NRPPA_NRPPA_PDU_PR_initiatingMessage:
return nrppa_gNB_decode_initiating_message(pdu);
case NRPPA_NRPPA_PDU_PR_successfulOutcome:
return nrppa_gNB_decode_successful_outcome(pdu);
case NRPPA_NRPPA_PDU_PR_unsuccessfulOutcome:
return nrppa_gNB_decode_unsuccessful_outcome(pdu);
default:
LOG_I(NRPPA, "Unknown presence (%d) or not implemented\n", (int)pdu->present);
break;
}
return -1;
}
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* 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
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
#include "nrppa_common.h"
#ifndef NRPPA_GNB_DECODER_H_
#define NRPPA_GNB_DECODER_H_
int nrppa_gNB_decode_pdu(NRPPA_NRPPA_PDU_t *pdu, const uint8_t *const buffer, const uint32_t length)
__attribute__((warn_unused_result));
#endif /* NRPPA_GNB_DECODER_H_ */
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* 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
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
#include <stdio.h>
#include <string.h>
#include <stdint.h>
#include "nrppa_common.h"
#include "nrppa_gNB_encoder.h"
static inline int nrppa_gNB_encode_initiating(NRPPA_NRPPA_PDU_t *pdu, uint8_t **buffer, uint32_t *len)
{
DevAssert(pdu != NULL);
const NRPPA_ProcedureCode_t tmp[] = {NRPPA_ProcedureCode_id_positioningInformationExchange,
NRPPA_ProcedureCode_id_positioningActivation,
NRPPA_ProcedureCode_id_positioningInformationUpdate,
NRPPA_ProcedureCode_id_positioningDeactivation,
NRPPA_ProcedureCode_id_tRPInformationExchange,
NRPPA_ProcedureCode_id_Measurement,
NRPPA_ProcedureCode_id_MeasurementReport,
NRPPA_ProcedureCode_id_MeasurementFailureIndication,
NRPPA_ProcedureCode_id_MeasurementAbort,
NRPPA_ProcedureCode_id_MeasurementUpdate};
int i;
for (i = 0; i < sizeofArray(tmp); i++)
if (pdu->choice.initiatingMessage->procedureCode == tmp[i])
break;
if (i == sizeofArray(tmp)) {
LOG_E(NRPPA, "Unknown procedure ID (%d) for initiating message\n", (int)pdu->choice.initiatingMessage->procedureCode);
return -1;
}
asn_encode_to_new_buffer_result_t res = asn_encode_to_new_buffer(NULL, ATS_ALIGNED_CANONICAL_PER, &asn_DEF_NRPPA_NRPPA_PDU, pdu);
AssertFatal(res.result.encoded > 0, "failed to encode NRPPA msg\n");
*buffer = res.buffer;
*len = res.result.encoded;
return 0;
}
static inline int nrppa_gNB_encode_successfull_outcome(NRPPA_NRPPA_PDU_t *pdu, uint8_t **buffer, uint32_t *len)
{
DevAssert(pdu != NULL);
const NRPPA_ProcedureCode_t tmp[] = {NRPPA_ProcedureCode_id_positioningInformationExchange,
NRPPA_ProcedureCode_id_positioningActivation,
NRPPA_ProcedureCode_id_tRPInformationExchange,
NRPPA_ProcedureCode_id_Measurement};
int i;
for (i = 0; i < sizeofArray(tmp); i++)
if (pdu->choice.successfulOutcome->procedureCode == tmp[i])
break;
if (i == sizeofArray(tmp)) {
LOG_E(NRPPA, "Unknown procedure ID (%ld) for successfull outcome message\n", pdu->choice.successfulOutcome->procedureCode);
return -1;
}
// xer_fprint(stdout, &asn_DEF_NRPPA_NRPPA_PDU, pdu);
asn_encode_to_new_buffer_result_t res = asn_encode_to_new_buffer(NULL, ATS_ALIGNED_CANONICAL_PER, &asn_DEF_NRPPA_NRPPA_PDU, pdu);
AssertFatal(res.result.encoded > 0, "failed to encode NRPPA msg\n");
*buffer = res.buffer;
*len = res.result.encoded;
return 0;
}
static inline int nrppa_gNB_encode_unsuccessfull_outcome(NRPPA_NRPPA_PDU_t *pdu, uint8_t **buffer, uint32_t *len)
{
DevAssert(pdu != NULL);
const NRPPA_ProcedureCode_t tmp[] = {NRPPA_ProcedureCode_id_positioningInformationExchange,
NRPPA_ProcedureCode_id_positioningActivation,
NRPPA_ProcedureCode_id_tRPInformationExchange,
NRPPA_ProcedureCode_id_Measurement};
int i;
for (i = 0; i < sizeofArray(tmp); i++)
if (pdu->choice.unsuccessfulOutcome->procedureCode == tmp[i])
break;
if (i == sizeofArray(tmp)) {
LOG_W(NRPPA, "Unknown procedure ID (%ld) for unsuccessfull outcome message\n", pdu->choice.unsuccessfulOutcome->procedureCode);
return -1;
}
asn_encode_to_new_buffer_result_t res = asn_encode_to_new_buffer(NULL, ATS_ALIGNED_CANONICAL_PER, &asn_DEF_NRPPA_NRPPA_PDU, pdu);
AssertFatal(res.result.encoded > 0, "failed to encode NRPPA msg\n");
*buffer = res.buffer;
*len = res.result.encoded;
return 0;
}
int nrppa_gNB_encode_pdu(NRPPA_NRPPA_PDU_t *pdu, uint8_t **buffer, uint32_t *len)
{
int ret = -1;
DevAssert(pdu != NULL);
DevAssert(buffer != NULL);
DevAssert(len != NULL);
// xer_fprint(stdout, &asn_DEF_NRPPA_NRPPA_PDU, (void *)pdu);
switch (pdu->present) {
case NRPPA_NRPPA_PDU_PR_initiatingMessage:
ret = nrppa_gNB_encode_initiating(pdu, buffer, len);
break;
case NRPPA_NRPPA_PDU_PR_successfulOutcome:
ret = nrppa_gNB_encode_successfull_outcome(pdu, buffer, len);
break;
case NRPPA_NRPPA_PDU_PR_unsuccessfulOutcome:
ret = nrppa_gNB_encode_unsuccessfull_outcome(pdu, buffer, len);
break;
default:
LOG_E(NRPPA, "Unknown message outcome (%d) or not implemented", (int)pdu->present);
return -1;
}
ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF_NRPPA_NRPPA_PDU, pdu);
return ret;
}
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* 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
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
#ifndef NRPPA_GNB_ENCODER_H_
#define NRPPA_GNB_ENCODER_H_
int nrppa_gNB_encode_pdu(NRPPA_NRPPA_PDU_t *pdu, uint8_t **buffer, uint32_t *len) __attribute__((warn_unused_result));
#endif /* NRPPA_GNB_ENCODER_H_ */
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* 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
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
#include "intertask_interface.h"
#include "nrppa_gNB_handlers.h"
#include "nrppa_gNB_decoder.h"
#include "nrppa_common.h"
#include "nrppa_gNB_location_information_transfer.h"
#include "nrppa_gNB_measurement_information_transfer.h"
char *nrppa_direction2String(int nrppa_dir)
{
static char *nrppa_direction_String[] = {
"", /* Nothing */
"Originating message", /* originating message */
"Successfull outcome", /* successfull outcome */
"UnSuccessfull outcome", /* successfull outcome */
};
return (nrppa_direction_String[nrppa_dir]);
}
/* Handlers matrix. Only gNB related procedure present here */
nrppa_message_decoded_callback nrppa_messages_callback[][3] = {
{0, 0, 0}, // NRPPA_ProcedureCode_id_errorIndication ((NRPPA_ProcedureCode_t)0)
{0, 0, 0}, // NRPPA_ProcedureCode_id_privateMessage ((NRPPA_ProcedureCode_t)1)
{0, 0, 0}, // NRPPA_ProcedureCode_id_e_CIDMeasurementInitiation ((NRPPA_ProcedureCode_t)2)
{0, 0, 0}, // NRPPA_ProcedureCode_id_e_CIDMeasurementFailureIndication ((NRPPA_ProcedureCode_t)3)
{0, 0, 0}, // NRPPA_ProcedureCode_id_e_CIDMeasurementReport ((NRPPA_ProcedureCode_t)4)
{0, 0, 0}, // NRPPA_ProcedureCode_id_e_CIDMeasurementTermination ((NRPPA_ProcedureCode_t)5)
{0, 0, 0}, // NRPPA_ProcedureCode_id_oTDOAInformationExchange ((NRPPA_ProcedureCode_t)6)
{0, 0, 0}, // NRPPA_ProcedureCode_id_assistanceInformationControl ((NRPPA_ProcedureCode_t)7)
{0, 0, 0}, // NRPPA_ProcedureCode_id_assistanceInformationFeedback ((NRPPA_ProcedureCode_t)8)
{nrppa_gNB_handle_positioning_information_request,
0,
0}, // NRPPA_ProcedureCode_id_positioningInformationExchange ((NRPPA_ProcedureCode_t)9)
{0, 0, 0}, // NRPPA_ProcedureCode_id_positioningInformationUpdate ((NRPPA_ProcedureCode_t)10)
{nrppa_gNB_handle_measurement_request, 0, 0}, // NRPPA_ProcedureCode_id_Measurement ((NRPPA_ProcedureCode_t)11)
{0, 0, 0}, // NRPPA_ProcedureCode_id_MeasurementReport ((NRPPA_ProcedureCode_t)12)
{0, 0, 0}, // NRPPA_ProcedureCode_id_MeasurementUpdate ((NRPPA_ProcedureCode_t)13)
{0, 0, 0}, // NRPPA_ProcedureCode_id_MeasurementAbort ((NRPPA_ProcedureCode_t)14)
{0, 0, 0}, // NRPPA_ProcedureCode_id_MeasurementFailureIndication ((NRPPA_ProcedureCode_t)15)
{nrppa_gNB_handle_trp_information_request, 0, 0}, // NRPPA_ProcedureCode_id_tRPInformationExchange ((NRPPA_ProcedureCode_t)16)
{nrppa_gNB_handle_positioning_activation_request,
0,
0}, // NRPPA_ProcedureCode_id_positioningActivation ((NRPPA_ProcedureCode_t)17)
{0, 0, 0}, // NRPPA_ProcedureCode_id_positioningDeactivation ((NRPPA_ProcedureCode_t)18)
};
// Processing DOWNLINK UE ASSOCIATED NRPPA TRANSPORT (9.2.9.1 of TS 38.413 Version 16.0.0)
int nrppa_handle_downlink_ue_associated_nrppa_transport(instance_t instance, const ngap_downlink_ue_associated_nrppa_t *msg)
{
LOG_I(NRPPA, "Handling DOWNLINKUEASSOCIATEDNRPPA TRANSPORT\n");
uint8_t *const data = msg->nrppa_pdu.buf;
const uint32_t data_length = msg->nrppa_pdu.len;
NRPPA_NRPPA_PDU_t pdu;
int ret;
DevAssert(data != NULL);
memset(&pdu, 0, sizeof(pdu));
if (nrppa_gNB_decode_pdu(&pdu, data, data_length) < 0) {
LOG_E(NRPPA, "Failed to decode PDU\n");
ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF_NRPPA_NRPPA_PDU, &pdu);
return -1;
}
/* Checking procedure Code and direction of message*/
if (pdu.choice.initiatingMessage->procedureCode >= sizeof(nrppa_messages_callback) / (3 * sizeof(nrppa_message_decoded_callback))
|| (pdu.present > NRPPA_NRPPA_PDU_PR_unsuccessfulOutcome)) {
LOG_E(NRPPA,
"Either procedureCode %ld or direction %d exceed expected\n",
pdu.choice.initiatingMessage->procedureCode,
pdu.present);
ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF_NRPPA_NRPPA_PDU, &pdu);
return -1;
}
/* No handler present.
* This can mean not implemented or no procedure for gNB (wrong direction).*/
if (nrppa_messages_callback[pdu.choice.initiatingMessage->procedureCode][pdu.present - 1] == NULL) {
LOG_E(NRPPA,
"No handler for procedureCode %ld in %s\n",
pdu.choice.initiatingMessage->procedureCode,
nrppa_direction2String(pdu.present - 1));
ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF_NRPPA_NRPPA_PDU, &pdu);
return -1;
}
/* Calling the right handler*/
nrppa_gnb_ue_info_t nrppa_msg_info;
nrppa_msg_info.instance = instance;
nrppa_msg_info.gNB_ue_ngap_id = msg->gNB_ue_ngap_id;
nrppa_msg_info.amf_ue_ngap_id = msg->amf_ue_ngap_id;
nrppa_msg_info.routing_id.buf = msg->routing_id.buf;
nrppa_msg_info.routing_id.len = msg->routing_id.len;
ret = (*nrppa_messages_callback[pdu.choice.initiatingMessage->procedureCode][pdu.present - 1])(&nrppa_msg_info, &pdu);
if (msg->routing_id.buf) {
free(msg->routing_id.buf);
}
if (msg->nrppa_pdu.buf) {
free(msg->nrppa_pdu.buf);
}
ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF_NRPPA_NRPPA_PDU, &pdu);
return ret;
}
// Processing DOWNLINK NON UE ASSOCIATED NRPPA TRANSPORT (9.2.9.3 of TS 38.413 Version 16.0.0)
int nrppa_handle_downlink_non_ue_associated_nrppa_transport(instance_t instance, const ngap_downlink_non_ue_associated_nrppa_t *msg)
{
LOG_I(NRPPA, "Handling DOWNLINKNONUEASSOCIATEDNRPPA TRANSPORT\n");
uint8_t *const data = msg->nrppa_pdu.buf;
const uint32_t data_length = msg->nrppa_pdu.len;
NRPPA_NRPPA_PDU_t pdu;
int ret;
DevAssert(data != NULL);
memset(&pdu, 0, sizeof(pdu));
if (nrppa_gNB_decode_pdu(&pdu, data, data_length) < 0) {
LOG_E(NRPPA, "Failed to decode Downlink Non UE Associated NRPPa PDU\n");
ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF_NRPPA_NRPPA_PDU, &pdu);
return -1;
}
/* Checking procedure Code and direction of message*/
if (pdu.choice.initiatingMessage->procedureCode >= sizeof(nrppa_messages_callback) / (3 * sizeof(nrppa_message_decoded_callback))
|| (pdu.present > NRPPA_NRPPA_PDU_PR_unsuccessfulOutcome)) {
LOG_E(NRPPA,
"Either procedureCode %ld or direction %d exceed expected\n",
pdu.choice.initiatingMessage->procedureCode,
pdu.present);
ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF_NRPPA_NRPPA_PDU, &pdu);
return -1;
}
/* No handler present.
* This can mean not implemented or no procedure for gNB (wrong direction).*/
if (nrppa_messages_callback[pdu.choice.initiatingMessage->procedureCode][pdu.present - 1] == NULL) {
LOG_E(NRPPA,
"No handler for procedureCode %ld in %s\n",
pdu.choice.initiatingMessage->procedureCode,
nrppa_direction2String(pdu.present - 1));
ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF_NRPPA_NRPPA_PDU, &pdu);
return -1;
}
/* Calling the right handler*/
nrppa_gnb_ue_info_t nrppa_msg_info;
nrppa_msg_info.instance = instance;
nrppa_msg_info.gNB_ue_ngap_id = 0; // non-ue associated
nrppa_msg_info.amf_ue_ngap_id = 0; // non-ue associated
nrppa_msg_info.routing_id.buf = msg->routing_id.buf;
nrppa_msg_info.routing_id.len = msg->routing_id.len;
ret = (*nrppa_messages_callback[pdu.choice.initiatingMessage->procedureCode][pdu.present - 1])(&nrppa_msg_info, &pdu);
if (msg->routing_id.buf) {
free(msg->routing_id.buf);
}
if (msg->nrppa_pdu.buf) {
free(msg->nrppa_pdu.buf);
}
ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF_NRPPA_NRPPA_PDU, &pdu);
return ret;
}
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* 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
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
#ifndef NRPPA_GNB_HANDLERS_H_
#define NRPPA_GNB_HANDLERS_H_
int nrppa_handle_downlink_ue_associated_nrppa_transport(instance_t instance, const ngap_downlink_ue_associated_nrppa_t *msg);
int nrppa_handle_downlink_non_ue_associated_nrppa_transport(instance_t instance,
const ngap_downlink_non_ue_associated_nrppa_t *msg);
#endif /* NRPPA_GNB_HANDLERS_H_ */
This diff is collapsed.
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* 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
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
#ifndef NRPPA_GNB_POSITIONING_PROCEDURES_H_
#define NRPPA_GNB_POSITIONING_PROCEDURES_H_
int nrppa_gNB_handle_trp_information_request(nrppa_gnb_ue_info_t *nrppa_msg_info, const NRPPA_NRPPA_PDU_t *pdu);
void free_trp_information_request(nrppa_trp_information_req_t *msg);
int nrppa_gNB_trp_information_response(instance_t instance, MessageDef *msg_p);
void free_trp_information_request(nrppa_trp_information_req_t *msg);
NRPPA_TRPInformationItem_t encode_trp_info_type_response_item_nrppa(nrppa_trp_information_type_response_item_t *in);
void free_trp_information_response(nrppa_trp_information_resp_t *msg);
int nrppa_gNB_handle_positioning_information_request(nrppa_gnb_ue_info_t *nrppa_msg_info, const NRPPA_NRPPA_PDU_t *pdu);
int nrppa_gNB_positioning_information_response(instance_t instance, MessageDef *msg_p);
NRPPA_SRSCarrier_List_t encode_srs_carrier_list_nrppa(const nrppa_srs_carrier_list_t *in_list);
void free_srs_carrier_list(nrppa_srs_carrier_list_t *srs_carrier_list);
void free_positioning_information_response(nrppa_positioning_information_resp_t *msg);
int nrppa_gNB_handle_positioning_activation_request(nrppa_gnb_ue_info_t *nrppa_msg_info, const NRPPA_NRPPA_PDU_t *pdu);
void decode_nrppa_srstype(NRPPA_SRSType_t *srs_type, nrppa_srs_type_t *out);
void free_positioning_activation_request(nrppa_positioning_activation_req_t *msg);
int nrppa_gNB_positioning_activation_response(instance_t instance, MessageDef *msg_p);
#endif /* NRPPA_GNB_POSITIONING_PROCEDURES_H_ */
This diff is collapsed.
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* 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
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
#ifndef NRPPA_GNB_MEASUREMENT_INFORMATION_TRANSFER_H_
#define NRPPA_GNB_MEASUREMENT_INFORMATION_TRANSFER_H_
int nrppa_gNB_handle_measurement_request(nrppa_gnb_ue_info_t *nrppa_msg_info, const NRPPA_NRPPA_PDU_t *pdu);
void decode_srs_carrier_list(nrppa_srs_carrier_list_t *out_list, const NRPPA_SRSCarrier_List_t *in_list);
void free_measurement_request(nrppa_measurement_req_t *msg);
int nrppa_gNB_measurement_response(instance_t instance, MessageDef *msg_p);
NRPPA_TRP_MeasurementResponseList_t encode_trp_measurement_reponse_list(nrppa_measurement_response_list_t *in_list);
void free_measurement_resp(nrppa_measurement_resp_t *msg);
#endif /* NRPPA_GNB_MEASUREMENT_INFORMATION_TRANSFER_H_ */
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* 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
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
#include "nrppa_gNB_ue_context.h"
#include "tree.h"
#include "T.h"
#include "common/utils/T/T.h"
#include "common/utils/utils.h"
#include "common/utils/LOG/log.h"
static RB_HEAD(nrppa_ue_map, nrppa_gNB_ue_context_s) nrppa_ue_head = RB_INITIALIZER(&nrppa_ue_head);
/* Generate the tree management functions prototypes */
RB_PROTOTYPE(nrppa_ue_map, nrppa_gNB_ue_context_s, entries, nrppa_gNB_compare_transaction_id);
static int nrppa_gNB_compare_transaction_id(struct nrppa_gNB_ue_context_s *p1, struct nrppa_gNB_ue_context_s *p2)
{
if (p1->transaction_id > p2->transaction_id) {
return 1;
}
if (p1->transaction_id < p2->transaction_id) {
return -1;
}
return 0;
}
/* Generate the tree management functions */
RB_GENERATE(nrppa_ue_map, nrppa_gNB_ue_context_s, entries, nrppa_gNB_compare_transaction_id);
void nrppa_store_ue_context(const nrppa_gnb_ue_info_t *info, const uint16_t transaction_id)
{
LOG_I(NRPPA, "Create NRPPa UE context (gNB UE ID %u) for transaction ID : %u\n", info->gNB_ue_ngap_id, transaction_id);
nrppa_gNB_ue_context_t *ue_info_p = calloc_or_fail(1, sizeof(*ue_info_p));
ue_info_p->transaction_id = transaction_id;
ue_info_p->gNB_ue_ngap_id = info->gNB_ue_ngap_id;
ue_info_p->amf_ue_ngap_id = info->amf_ue_ngap_id;
if (info->routing_id.len > 0 && info->routing_id.buf != NULL) {
ue_info_p->routing_id.len = info->routing_id.len;
ue_info_p->routing_id.buf = calloc_or_fail(1, info->routing_id.len);
memcpy(ue_info_p->routing_id.buf, info->routing_id.buf, info->routing_id.len);
} else {
ue_info_p->routing_id.len = 0;
ue_info_p->routing_id.buf = NULL;
}
if (RB_INSERT(nrppa_ue_map, &nrppa_ue_head, ue_info_p))
LOG_E(NRPPA, "Bug in UE uniq number allocation %u, we try to add a existing UE\n", ue_info_p->gNB_ue_ngap_id);
return;
}
struct nrppa_gNB_ue_context_s *nrppa_get_ue_context(uint16_t transaction_id)
{
nrppa_gNB_ue_context_t temp = {.transaction_id = transaction_id};
return RB_FIND(nrppa_ue_map, &nrppa_ue_head, &temp);
}
struct nrppa_gNB_ue_context_s *nrppa_detach_ue_context(uint16_t transaction_id)
{
struct nrppa_gNB_ue_context_s *tmp = nrppa_get_ue_context(transaction_id);
if (tmp == NULL) {
LOG_E(NRPPA, "Trying to free a NULL UE context, %u\n", transaction_id);
return NULL;
}
RB_REMOVE(nrppa_ue_map, &nrppa_ue_head, tmp);
return tmp;
}
void nrppa_free_ue_context(nrppa_gNB_ue_context_t *ue_info)
{
if (!ue_info)
return;
if (ue_info->routing_id.buf) {
free(ue_info->routing_id.buf);
}
free(ue_info);
}
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* 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
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
#include <stdint.h>
#include "tree.h"
#include "ds/byte_array.h"
#include "nrppa_common.h"
#ifndef NRPPA_GNB_UE_CONTEXT_H_
#define NRPPA_GNB_UE_CONTEXT_H_
typedef struct nrppa_gNB_ue_context_s {
/* Tree related data */
RB_ENTRY(nrppa_gNB_ue_context_s) entries;
uint16_t transaction_id;
uint32_t gNB_ue_ngap_id;
uint64_t amf_ue_ngap_id;
byte_array_t routing_id;
} nrppa_gNB_ue_context_t;
void nrppa_store_ue_context(const nrppa_gnb_ue_info_t *info, const uint16_t transaction_id);
nrppa_gNB_ue_context_t *nrppa_get_ue_context(uint16_t transaction_id);
nrppa_gNB_ue_context_t *nrppa_detach_ue_context(uint16_t transaction_id);
void nrppa_free_ue_context(nrppa_gNB_ue_context_t *ue_info);
#endif /* NRPPA_GNB_UE_CONTEXT_H_ */
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* 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
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
#ifndef NRPPA_INCLUDE_H_
#define NRPPA_INCLUDE_H_
#include "NRPPA_NRPPA-PDU.h"
#include "NRPPA_InitiatingMessage.h"
#include "NRPPA_SuccessfulOutcome.h"
#include "NRPPA_UnsuccessfulOutcome.h"
#include "NRPPA_ProtocolIE-ID.h"
#include "NRPPA_ProtocolIE-Field.h"
#include "NRPPA_ProtocolIE-Container.h"
#include "NRPPA_ProtocolExtensionField.h"
#include "NRPPA_ProtocolIE-ContainerList.h"
#include "NRPPA_ProtocolExtensionContainer.h"
#include "NRPPA_ProtocolIE-Single-Container.h"
#include "NRPPA_asn_constant.h"
#include "NRPPA_TRPInformationRequest.h"
#include "NRPPA_TRPInformationItem.h"
#include "NRPPA_TRPPositionDirect.h"
#include "NRPPA_NG-RANAccessPointPosition.h"
#include "NRPPA_NGRANHighAccuracyAccessPointPosition.h"
#include "NRPPA_TRPPositionReferenced.h"
#include "NRPPA_RelativeGeodeticLocation.h"
#include "NRPPA_RelativeCartesianLocation.h"
#include "NRPPA_SRSCarrier-List-Item.h"
#include "NRPPA_SCS-SpecificCarrier.h"
#include "NRPPA_SRSConfig.h"
#include "NRPPA_SRSResource-List.h"
#include "NRPPA_SRSResource.h"
#include "NRPPA_ResourceType.h"
#include "NRPPA_ResourceTypePeriodic.h"
#include "NRPPA_ResourceTypeSemi-persistent.h"
#include "NRPPA_ResourceTypeAperiodic.h"
#include "NRPPA_PosSRSResource-List.h"
#include "NRPPA_ResourceTypePos.h"
#include "NRPPA_ResourceTypePeriodicPos.h"
#include "NRPPA_ResourceTypeSemi-persistentPos.h"
#include "NRPPA_ResourceTypeAperiodicPos.h"
#include "NRPPA_SRSResourceSet-List.h"
#include "NRPPA_SRSResourceSet.h"
#include "NRPPA_PosSRSResource-List.h"
#include "NRPPA_PosSRSResourceSet-Item.h"
#include "NRPPA_PosSRSResource-List.h"
#include "NRPPA_PosSRSResource-Item.h"
#include "NRPPA_ResourceSetTypePeriodic.h"
#include "NRPPA_ResourceSetTypeSemi-persistent.h"
#include "NRPPA_ResourceSetTypeAperiodic.h"
#include "NRPPA_PosSRSResourceSet-List.h"
#include "NRPPA_PosResourceSetTypePeriodic.h"
#include "NRPPA_PosResourceSetTypeSemi-persistent.h"
#include "NRPPA_PosResourceSetTypeAperiodic.h"
#include "NRPPA_SemipersistentSRS.h"
#include "NRPPA_AperiodicSRS.h"
#include "NRPPA_TRP-MeasurementRequestItem.h"
#include "NRPPA_TRPMeasurementQuantities-Item.h"
#include "NRPPA_TRPMeasurementQuantitiesList-Item.h"
#include "NRPPA_TRP-MeasurementResponseList.h"
#include "NRPPA_TRP-MeasurementResponseItem.h"
#include "NRPPA_TrpMeasurementResultItem.h"
#include "NRPPA_UL-RTOAMeasurement.h"
#include "NRPPA_GNB-RxTxTimeDiff.h"
#endif /* NRPPA_INCLUDE_H_ */
add_subdirectory(nr-cuup) add_subdirectory(nr-cuup)
add_subdirectory(nr-cu-nrppa)
add_executable(nr-cu-nrppa-test nr-cu-nrppa.c
${OPENAIR2_DIR}/GNB_APP/gnb_config_common.c
${OPENAIR2_DIR}/GNB_APP/gnb_config_ng.c)
target_link_libraries(nr-cu-nrppa-test PRIVATE nr_nas nr_common lib_uicc usim_lib)
target_link_libraries(nr-cu-nrppa-test PRIVATE
CONFIG_LIB ITTI SCTP_CLIENT
f1ap ngap SECURITY
UTIL softmodem_common nrppa)
target_link_libraries(nr-cu-nrppa-test PRIVATE asn1_lte_rrc_hdrs asn1_nr_rrc_hdrs)
add_dependencies(nr-cu-nrppa-test params_libconfig)
This is a simple standalone tester for NRPPA and NGAP positioning messages. It connects to the AMF to perform NGAP and NRPPA encoding/decoding and validates the exchange of positioning data.
[[_TOC_]]
# Overview
From a schematic point of view, the tester and Core Network interaction looks like this:
```
+-------+ +-------+
| LMF |<--- HTTP POST---| User |
+-------+ +-------+
|
| Nlmf
|
+-------+
| AMF |
+-------+
|
NGAP/NRPPA |
|
+-------+
|tester | (nr-cu-nrppa-test)
+-------+
```
The tester is designed to validate the integration of NRPPA and NGAP messages required for 5G positioning (*3GPP 38.413 V16.0.0* and *3GPP 38.455 V16.7.1*). It acts as a simulated RAN node (like a CU) connecting to the 5G Core Network's AMF.
The following messages are integrated and tested:
* **NGAP:** Uplink/Downlink UE Associated NRPPA Transport, Uplink/Downlink Non-UE Associated NRPPA Transport.
* **NRPPA:** TRP Information Request/Response, Positioning Information Request/Response, Positioning Activation Request/Response, Measurement Request/Response.
A test scenario is fixed to these steps:
1. The 5G Core Network, specifically including the Location Management Function (LMF), is deployed via Docker.
2. The tester connects to the AMF and establishes the NGAP connection.
3. The user initiates a positioning procedure via a API call to the LMF.
4. The AMF and the tester exchange the required NGAP and NRPPA messages to determine location.
# Usage
To run this test, you need to set up the Core Network and build the tester.
**1. Core Network Deployment**
Pull the required Docker images for the OAI 5G Core:
docker pull oaisoftwarealliance/ims:latest
docker pull oaisoftwarealliance/oai-amf:develop
docker pull oaisoftwarealliance/oai-nrf:develop
docker pull oaisoftwarealliance/oai-smf:develop
docker pull oaisoftwarealliance/oai-udr:develop
docker pull oaisoftwarealliance/oai-upf:develop
docker pull oaisoftwarealliance/oai-udm:develop
docker pull oaisoftwarealliance/oai-ausf:develop
docker pull oaisoftwarealliance/oai-lmf:develop
Deploy the network using the positioning compose file:
cd doc/tutorial_resources/oai-cn5g
docker compose -f docker-compose-positioning.yaml up -d
*(To undeploy later, run `docker compose -f docker-compose-positioning.yaml down -t 0`)*
**2. Building the Tester**
You can build the NRPPA tester like so:
cd ~/openairinterface5g
mkdir build && cd build && cmake .. -GNinja && ninja nr-cu-nrppa-test
**3. Running the Tester**
Start the tester with the dedicated configuration file:
LD_LIBRARY_PATH=. ./tests/nr-cu-nrppa/nr-cu-nrppa-test -O ../tests/nr-cu-nrppa/nr-nrppa-test.conf
**4. Initiating the Procedure**
Trigger the location determination by sending an HTTP POST request to the LMF:
cd ~/openairinterface5g/doc/tutorial_resources/positioning/
curl --http2-prior-knowledge -H "Content-Type: application/json" -d "@InputData.json" -X POST http://192.168.70.141:8080/nlmf-loc/v1/determine-location
# Limitations
- The tester is a standalone validation tool (`nr-cu-nrppa-test`) and does not represent a fully integrated, end-to-end gNB positioning setup.
This diff is collapsed.
Active_gNBs = ( "gNB-OAI");
# Asn1_verbosity, choice in: none, info, annoying
Asn1_verbosity = "none";
gNBs =
(
{
////////// Identification parameters:
gNB_ID = 0xe00;
gNB_name = "gNB-OAI";
// Tracking area code, 0x0000 and 0xfffe are reserved values
tracking_area_code = 1;
plmn_list = ({ mcc = 001; mnc = 01; mnc_length = 2; snssaiList = ({ sst = 1; }) });
nr_cellid = 12345678L;
# ------- SCTP definitions
SCTP :
{
# Number of streams to use in input/output
SCTP_INSTREAMS = 2;
SCTP_OUTSTREAMS = 2;
};
////////// AMF parameters:
amf_ip_address = ({ ipv4 = "192.168.70.132"; });
NETWORK_INTERFACES :
{
GNB_IPV4_ADDRESS_FOR_NG_AMF = "192.168.70.129/24";
GNB_IPV4_ADDRESS_FOR_NGU = "192.168.70.129/24";
GNB_PORT_FOR_S1U = 2152; # Spec 2152
};
}
);
positioning_config = (
{
NumTRPs = 4; # number of TRPs
TRPIDs = [1,2,3,4]; # userdefined distinct IDs
TRPxAxis = [71,21,10,45]; # X-axis value of each TRP
TRPyAxis = [11,22,62,14]; # Y-axis value of each TRP
TRPzAxis = [41,22,33,42]; # Z-axis value of each TRP
Units = [0, 0, 0, 0]; # 0 = mm, 1 = cm, 2 = dm
}
);
L1s = (
{
num_cc = 1;
tr_n_preference = "local_mac";
prach_dtx_threshold = 120;
pucch0_dtx_threshold = 150;
ofdm_offset_divisor = 8; #set this to UINT_MAX for offset 0
}
);
log_config :
{
global_log_level ="info";
hw_log_level ="info";
phy_log_level ="info";
mac_log_level ="info";
rlc_log_level ="info";
pdcp_log_level ="info";
rrc_log_level ="info";
ngap_log_level ="debug";
f1ap_log_level ="debug";
};
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment