Commit 6674bd27 authored by Shivam Gandhi's avatar Shivam Gandhi

Merge branch 'develop' into 'amf-event-exposure'

# Conflicts:
#   src/amf-app/amf_app.hpp
parents 8bf0ea17 58efab83
# RELEASE NOTES: #
## v1.1.0 -- July 2021 ##
* Session Release
* NRF registration
- with FQDN DNS resolution
* Multiple PDU support
* Bug fixes
* Full support for Ubuntu18 and RHEL8
## v1.0.0 -- September 2020 ##
* Initial release
......
......@@ -147,7 +147,7 @@ pipeline {
sh 'sed -e "s#AMF_IMAGE_TAG#' + amfTag + '#" ci-scripts/dsTesterDockerCompose/docker-compose.tplt > ci-scripts/dsTesterDockerCompose/docker-compose.yml'
dir('ci-scripts/dsTesterDockerCompose') {
sh 'docker-compose up -d > ../../archives/compose_amf_up.log 2>&1'
sh 'sleep 60'
sh 'sleep 100'
// Do a check on number of healthy containers
// 2 == mysql + amf
ret = sh returnStdout: true, script: 'docker-compose ps -a | grep -v unhealthy | grep -c healthy || true'
......
......@@ -67,7 +67,9 @@ pipeline {
"Build RHEL8 AMF Image",
"Static Code Analysis",
"Code Formatting Checker",
"Test with DsTester"
"Bracket Test with DsTester",
"Test with DsTester on Docker environment",
"Test with DsTester on OC environment"
])
}
......@@ -367,32 +369,66 @@ pipeline {
}
}
}
stage ('Testing in CN-5G-FED environment') {
steps {
script {
gitlabCommitStatus(name: "Test with DsTester") {
localStatus = build job: params.CN5G_FED_PipelineName,
parameters: [
string(name: 'AMF_TAG', value: String.valueOf(amf_tag)),
string(name: 'AMF_BRANCH', value: String.valueOf(amf_branch))
], propagate: false
localResult = localStatus.getResult()
stage('Testing whole 5g Core Network Functions') {
parallel {
stage ('Testing in CN-5G-FED Docker environment') {
steps {
script {
gitlabCommitStatus(name: "Test with DsTester on Docker environment") {
localStatus = build job: params.CN5G_FED_PipelineName,
parameters: [
string(name: 'AMF_TAG', value: String.valueOf(amf_tag)),
string(name: 'AMF_BRANCH', value: String.valueOf(amf_branch))
], propagate: false
localResult = localStatus.getResult()
if (localStatus.resultIsBetterOrEqualTo('SUCCESS')) {
echo "Federation Test Job is OK"
} else {
echo "Federation Test Job is KO"
sh "ci-scripts/fail.sh"
if (localStatus.resultIsBetterOrEqualTo('SUCCESS')) {
echo "Docker Federation Test Job is OK"
} else {
echo "Docker Federation Test Job is KO"
sh "ci-scripts/fail.sh"
}
}
}
}
post {
always {
script {
copyArtifacts(projectName: params.CN5G_FED_PipelineName,
filter: '*_results_oai_cn5g.html',
selector: lastCompleted())
}
}
}
}
}
post {
always {
script {
copyArtifacts(projectName: params.CN5G_FED_PipelineName,
filter: '*_results_oai_cn5g.html',
selector: lastCompleted())
stage ('Testing in CN-5G-FED OC environment') {
steps {
script {
gitlabCommitStatus(name: "Test with DsTester on OC environment") {
localStatus = build job: params.CN5G_FED_OC_PipelineName,
parameters: [
string(name: 'AMF_TAG', value: String.valueOf(amf_tag)),
string(name: 'AMF_BRANCH', value: String.valueOf(amf_branch))
], propagate: false
localResult = localStatus.getResult()
if (localStatus.resultIsBetterOrEqualTo('SUCCESS')) {
echo "OC Federation Test Job is OK"
} else {
echo "OC Federation Test Job is KO"
sh "ci-scripts/fail.sh"
}
}
}
}
post {
always {
script {
copyArtifacts(projectName: params.CN5G_FED_OC_PipelineName,
filter: '*_results_oai_cn5g_oc.html',
selector: lastCompleted())
}
}
}
}
}
......@@ -472,6 +508,10 @@ pipeline {
sh "sed -i -e 's#TEMPLATE_MERGE_REQUEST_LINK#${gitlabMergeRequestLink}#g' *_results_oai_amf_bt.html"
sh "sed -i -e 's#TEMPLATE_MERGE_REQUEST_TEMPLATE#${env.gitlabMergeRequestTitle}#' *_results_oai_amf_bt.html"
}
if (fileExists('test_results_oai_cn5g_oc.html')) {
sh "sed -i -e 's#TEMPLATE_MERGE_REQUEST_LINK#${gitlabMergeRequestLink}#g' *_results_oai_cn5g_oc.html"
sh "sed -i -e 's#TEMPLATE_MERGE_REQUEST_TEMPLATE#${env.gitlabMergeRequestTitle}#' *_results_oai_cn5g_oc.html"
}
} else {
sh "python3 ci-scripts/generateHtmlReport.py --job_name=${JOB_NAME} --job_id=${BUILD_ID} --job_url=${BUILD_URL} --git_url=${GIT_URL} --git_src_branch=${GIT_BRANCH} --git_src_commit=${GIT_COMMIT}"
}
......@@ -488,6 +528,10 @@ pipeline {
sh "sed -i -e 's#TEMPLATE_TIME#${JOB_TIMESTAMP}#' *_results_oai_amf_bt.html"
archiveArtifacts artifacts: '*_results_oai_amf_bt.html'
}
if (fileExists('test_results_oai_cn5g_oc.html')) {
sh "sed -i -e 's#TEMPLATE_TIME#${JOB_TIMESTAMP}#' *_results_oai_cn5g_oc.html"
archiveArtifacts artifacts: '*_results_oai_cn5g_oc.html'
}
// Sending email to commiter
if (params.sendToCommitterEmail != null) {
......
......@@ -76,6 +76,7 @@ COPY --from=oai-amf-builder /usr/lib/x86_64-linux-gnu/libpsl.so.5 .
WORKDIR /usr/local/lib
COPY --from=oai-amf-builder /usr/lib/libboost_system.so.1.67.0 .
COPY --from=oai-amf-builder /usr/lib/libboost_thread.so.1.67.0 .
COPY --from=oai-amf-builder /usr/lib/libboost_chrono.so.1.67.0 .
COPY --from=oai-amf-builder /usr/local/lib/libpistache.so .
RUN ldconfig
......
......@@ -97,6 +97,7 @@ COPY --from=oai-amf-builder /usr/lib/x86_64-linux-gnu/libpsl.so.5 .
WORKDIR /usr/local/lib
COPY --from=oai-amf-builder /usr/lib/libboost_system.so.1.67.0 .
COPY --from=oai-amf-builder /usr/lib/libboost_thread.so.1.67.0 .
COPY --from=oai-amf-builder /usr/lib/libboost_chrono.so.1.67.0 .
COPY --from=oai-amf-builder /usr/local/lib/libpistache.so .
RUN ldconfig
......
......@@ -45,7 +45,7 @@ Based on document **3GPP TS 23.501 V16.0.0 §6.2.1**.
| 4 | Registration management | :heavy_check_mark: | |
| 5 | Connection management | :heavy_check_mark: | |
| 6 | Reachability management | :x: | |
| 7 | Mobility Management | :x: | |
| 7 | Mobility Management | :heavy_check_mark: | (Experimental) Support N2 Handover |
| 8 | Lawful intercept (for AMF events and interface to LI System) | :x: | |
| 9 | Provide transport for SM messages between UE and SMF | :heavy_check_mark: | |
| 10 | Transparent proxy for routing SM messages | :x: | |
......
......@@ -102,8 +102,8 @@ AMF =
# STRING, {"yes", "no"},
NF_REGISTRATION = "@NF_REGISTRATION@"; # Set to yes if AMF resgisters to an NRF
SMF_SELECTION = "@SMF_SELECTION@"; # Set to yes to enable SMF discovery and selection
EXTERNAL_AUSF = "no"; # Set to yes if AMF works with an external AUSF
EXTERNAL_UDM = "no"; # Set to yes if AMF works with an external UDM
EXTERNAL_AUSF = "@EXTERNAL_AUSF@"; # Set to yes if AMF works with an external AUSF
EXTERNAL_UDM = "@EXTERNAL_UDM@"; # Set to yes if AMF works with an external UDM
USE_FQDN_DNS = "@USE_FQDN_DNS@"; # Set to yes if AMF relies on a DNS to resolve NRF/SMF/UDM/AUSF's FQDN
}
......
......@@ -4,6 +4,10 @@ set -euo pipefail
CONFIG_DIR="/openair-amf/etc"
# Default values
EXTERNAL_AUSF=${EXTERNAL_AUSF:-no}
EXTERNAL_UDM=${EXTERNAL_UDM:-no}
for c in ${CONFIG_DIR}/*.conf; do
# grep variable names (format: ${VAR}) from template to be rendered
VARS=$(grep -oP '@[a-zA-Z0-9_]+@' ${c} | sort | uniq | xargs)
......
......@@ -64,7 +64,15 @@ void amf_app_task(void*);
uint32_t golbal_tmsi = 1;
//------------------------------------------------------------------------------
amf_app::amf_app(const amf_config& amf_cfg) {
amf_app::amf_app(const amf_config& amf_cfg)
: m_amf_ue_ngap_id2ue_ctx(),
m_ue_ctx_key(),
m_supi2ue_ctx(),
m_curl_handle_responses_n2_sm() {
amf_ue_ngap_id2ue_ctx = {};
ue_ctx_key = {};
supi2ue_ctx = {};
curl_handle_responses_n2_sm = {};
Logger::amf_app().startup("Creating AMF application functionality layer");
if (itti_inst->create_task(TASK_AMF_APP, amf_app_task, nullptr)) {
Logger::amf_app().error("Cannot create task TASK_AMF_APP");
......@@ -207,6 +215,7 @@ void amf_app::set_supi_2_ue_context(
supi2ue_ctx[supi] = uc;
}
//------------------------------------------------------------------------------
bool amf_app::find_pdu_session_context(
const string& supi, const std::uint8_t pdu_session_id,
std::shared_ptr<pdu_session_context>& psc) {
......@@ -217,6 +226,7 @@ bool amf_app::find_pdu_session_context(
return true;
}
//------------------------------------------------------------------------------
bool amf_app::get_pdu_sessions_context(
const string& supi,
std::vector<std::shared_ptr<pdu_session_context>>& sessions_ctx) {
......@@ -305,6 +315,7 @@ void amf_app::handle_itti_message(
} else {
unc = amf_n2_inst->ran_ue_id_2_ue_ngap_context(itti_msg.ran_ue_ngap_id);
unc.get()->amf_ue_ngap_id = amf_ue_ngap_id;
amf_n2_inst->set_amf_ue_ngap_id_2_ue_ngap_context(amf_ue_ngap_id, unc);
}
if (uc.get() == nullptr) {
......@@ -645,3 +656,24 @@ void amf_app::trigger_nf_deregistration() {
itti_msg->get_msg_name());
}
}
//---------------------------------------------------------------------------------------------
void amf_app::add_promise(
uint32_t id, boost::shared_ptr<boost::promise<std::string>>& p) {
std::unique_lock lock(m_curl_handle_responses_n2_sm);
curl_handle_responses_n2_sm.emplace(id, p);
}
//------------------------------------------------------------------------------
void amf_app::trigger_process_response(uint32_t pid, std::string n2_sm) {
Logger::amf_app().debug(
"Trigger process response: Set promise with ID %u "
"to ready",
pid);
std::unique_lock lock(m_curl_handle_responses_n2_sm);
if (curl_handle_responses_n2_sm.count(pid) > 0) {
curl_handle_responses_n2_sm[pid]->set_value(n2_sm);
// Remove this promise from list
curl_handle_responses_n2_sm.erase(pid);
}
}
......@@ -49,6 +49,10 @@
#include <boost/thread.hpp>
#include <boost/thread/future.hpp>
#include "uint_generator.hpp"
#include <boost/thread.hpp>
#include <boost/thread/future.hpp>
using namespace config;
static uint32_t amf_app_ue_ngap_id_generator = 1;
......@@ -80,8 +84,6 @@ class amf_app {
void handle_itti_message(itti_nas_signalling_establishment_request& itti_msg);
void handle_itti_message(itti_n1n2_message_transfer_request& itti_msg);
mutable std::shared_mutex m_amf_event_subscriptions;
bool is_amf_ue_id_2_ue_context(const long& amf_ue_ngap_id) const;
std::shared_ptr<ue_context> amf_ue_id_2_ue_context(
const long& amf_ue_ngap_id) const;
......
......@@ -84,7 +84,6 @@ extern statistics stacs;
extern void convert_string_2_hex(std::string& input, std::string& output);
extern unsigned char* format_string_as_hex(std::string str);
extern int ncc;
Sha256 ctx;
random_state_t random_state;
static uint8_t no_random_delta = 0;
......@@ -210,7 +209,6 @@ void amf_n1::handle_itti_message(itti_downlink_nas_transfer& itti_msg) {
uint32_t ulcount =
secu->ul_count.seq_num | (secu->ul_count.overflow << 8);
Authentication_5gaka::derive_kgnb(0, 0x01, kamf, kgnb);
ncc = 1;
print_buffer("amf_n1", "kamf", kamf, 32);
// Authentication_5gaka::derive_kgnb(ulcount, 0x01, kamf, kgnb);
bstring kgnb_bs = blk2bstr(kgnb, 32);
......@@ -457,58 +455,6 @@ void amf_n1::nas_signalling_establishment_request_handle(
}
}
//------------------------------------------------------------------------------
void amf_n1::uplink_nas_msg_handle(
uint32_t ran_ue_ngap_id, long amf_ue_ngap_id, bstring plain_msg) {
uint8_t* buf = (uint8_t*) bdata(plain_msg);
uint8_t message_type = *(buf + 2);
switch (message_type) {
case AUTHENTICATION_RESPONSE: {
Logger::amf_n1().debug(
"Received authentication response message, handling...");
authentication_response_handle(ran_ue_ngap_id, amf_ue_ngap_id, plain_msg);
} break;
case AUTHENTICATION_FAILURE: {
Logger::amf_n1().debug(
"Received authentication failure message, handling...");
authentication_failure_handle(ran_ue_ngap_id, amf_ue_ngap_id, plain_msg);
} break;
case SECURITY_MODE_COMPLETE: {
Logger::amf_n1().debug(
"Received security mode complete message, handling...");
security_mode_complete_handle(ran_ue_ngap_id, amf_ue_ngap_id, plain_msg);
} break;
case SECURITY_MODE_REJECT: {
Logger::amf_n1().debug(
"Received security mode reject message, handling...");
security_mode_reject_handle(ran_ue_ngap_id, amf_ue_ngap_id, plain_msg);
} break;
case UL_NAS_TRANSPORT: {
Logger::amf_n1().debug("Received UL NAS transport message, handling...");
ul_nas_transport_handle(ran_ue_ngap_id, amf_ue_ngap_id, plain_msg);
} break;
case UE_INIT_DEREGISTER: {
Logger::amf_n1().debug(
"Received de-registration request message, handling...");
ue_initiate_de_registration_handle(
ran_ue_ngap_id, amf_ue_ngap_id, plain_msg);
} break;
case IDENTITY_RESPONSE: {
Logger::amf_n1().debug("received identity response message , handle ...");
identity_response_handle(ran_ue_ngap_id, amf_ue_ngap_id, plain_msg);
} break;
case REGISTRATION_COMPLETE: {
Logger::amf_n1().debug(
"Received registration complete message, handling...");
registration_complete_handle(ran_ue_ngap_id, amf_ue_ngap_id, plain_msg);
// TODO
} break;
default: {
// TODO:
}
}
}
//------------------------------------------------------------------------------
void amf_n1::uplink_nas_msg_handle(
uint32_t ran_ue_ngap_id, long amf_ue_ngap_id, bstring plain_msg,
......@@ -1082,15 +1028,16 @@ void amf_n1::registration_request_handle(
if (!regReq->getUeSecurityCapability(
encrypt_alg, integrity_alg, security_cap_eea, security_cap_eia)) {
Logger::amf_n1().warn("No Optional IE UESecurityCapability available");
} else {
nc.get()->ueSecurityCaplen = regReq->ie_ue_security_capability->getLength();
}
nc.get()->ueSecurityCapEnc = encrypt_alg;
nc.get()->ueSecurityCapInt = integrity_alg;
nc.get()->ueSecurityCapEEA = security_cap_eea;
nc.get()->ueSecurityCapEIA = security_cap_eia;
nc.get()->ueSecurityCaplen = regReq->ie_ue_security_capability->getLength();
// Get Requested NSSAI (Optional IE), if provided
std::vector<SNSSAI_t> requestedNssai = {};
if (!regReq->getRequestedNssai(requestedNssai)) {
......@@ -1422,9 +1369,9 @@ bool amf_n1::_5g_aka_confirmation_from_ausf(
Logger::amf_n1().debug("_5g_aka_confirmation_from_ausf");
std::string remoteUri = nc.get()->Href;
std::string msgBody;
std::string Response;
std::string resStar_string;
std::string msgBody = {};
std::string response = {};
std::string resStar_string = {};
std::map<std::string, std::string>::iterator iter;
iter = rand_record.find(nc.get()->imsi);
......@@ -1450,12 +1397,12 @@ bool amf_n1::_5g_aka_confirmation_from_ausf(
msgBody = confirmationdata_j.dump();
// TODO: Should be updated
amf_n11_inst->curl_http_client(remoteUri, "PUT", msgBody, Response);
amf_n11_inst->curl_http_client(remoteUri, "PUT", msgBody, response);
free_wrapper((void**) &resStar_s);
try {
ConfirmationDataResponse confirmationdataresponse;
nlohmann::json::parse(Response.c_str()).get_to(confirmationdataresponse);
nlohmann::json::parse(response.c_str()).get_to(confirmationdataresponse);
unsigned char* kseaf_hex =
format_string_as_hex(confirmationdataresponse.getKseaf());
memcpy(nc.get()->_5g_av[0].kseaf, kseaf_hex, 32);
......@@ -2004,7 +1951,6 @@ bool amf_n1::start_security_mode_control_procedure(
nc.get()->is_current_security_available = true;
}
// SecurityModeCommand* smc = new SecurityModeCommand();
std::unique_ptr<SecurityModeCommand> smc =
std::make_unique<SecurityModeCommand>();
smc->setHeader(PLAIN_5GS_MSG);
......@@ -2201,7 +2147,6 @@ void amf_n1::security_mode_complete_handle(
uint8_t kgnb[32];
uint32_t ulcount = secu->ul_count.seq_num | (secu->ul_count.overflow << 8);
Authentication_5gaka::derive_kgnb(0, 0x01, kamf, kgnb);
ncc = 1;
print_buffer("amf_n1", "kamf", kamf, 32);
// Authentication_5gaka::derive_kgnb(ulcount, 0x01, kamf, kgnb);
bstring kgnb_bs = blk2bstr(kgnb, 32);
......@@ -2587,10 +2532,8 @@ void amf_n1::ul_nas_transport_handle(
Logger::amf_n1().error("Cannot decode Payload Container");
return;
}
// send_itti_to_smf_services_consumer(ran_ue_ngap_id, amf_ue_ngap_id,
// request_type, pdu_session_id, dnn, sm_msg);
itti_smf_services_consumer* itti_msg =
new itti_smf_services_consumer(TASK_AMF_N1, TASK_AMF_N11);
itti_nsmf_pdusession_create_sm_context* itti_msg =
new itti_nsmf_pdusession_create_sm_context(TASK_AMF_N1, TASK_AMF_N11);
itti_msg->ran_ue_ngap_id = ran_ue_ngap_id;
itti_msg->amf_ue_ngap_id = amf_ue_ngap_id;
itti_msg->req_type = request_type;
......@@ -2599,8 +2542,8 @@ void amf_n1::ul_nas_transport_handle(
itti_msg->sm_msg = sm_msg;
itti_msg->snssai.sST = snssai.sst;
itti_msg->snssai.sD = std::to_string(snssai.sd);
std::shared_ptr<itti_smf_services_consumer> i =
std::shared_ptr<itti_smf_services_consumer>(itti_msg);
std::shared_ptr<itti_nsmf_pdusession_create_sm_context> i =
std::shared_ptr<itti_nsmf_pdusession_create_sm_context>(itti_msg);
int ret = itti_inst->send_msg(i);
if (0 != ret) {
Logger::amf_n1().error(
......@@ -2638,10 +2581,8 @@ void amf_n1::ul_nas_transport_handle(
Logger::amf_n1().error("Cannot decode Payload Container");
return;
}
// send_itti_to_smf_services_consumer(ran_ue_ngap_id, amf_ue_ngap_id,
// request_type, pdu_session_id, dnn, sm_msg);
itti_smf_services_consumer* itti_msg =
new itti_smf_services_consumer(TASK_AMF_N1, TASK_AMF_N11);
itti_nsmf_pdusession_create_sm_context* itti_msg =
new itti_nsmf_pdusession_create_sm_context(TASK_AMF_N1, TASK_AMF_N11);
itti_msg->ran_ue_ngap_id = ran_ue_ngap_id;
itti_msg->amf_ue_ngap_id = amf_ue_ngap_id;
itti_msg->req_type = request_type;
......@@ -2652,8 +2593,8 @@ void amf_n1::ul_nas_transport_handle(
itti_msg->snssai.sD = std::to_string(snssai.sd);
itti_msg->plmn.mnc = plmn.mnc;
itti_msg->plmn.mcc = plmn.mcc;
std::shared_ptr<itti_smf_services_consumer> i =
std::shared_ptr<itti_smf_services_consumer>(itti_msg);
std::shared_ptr<itti_nsmf_pdusession_create_sm_context> i =
std::shared_ptr<itti_nsmf_pdusession_create_sm_context>(itti_msg);
int ret = itti_inst->send_msg(i);
if (0 != ret) {
Logger::amf_n1().error(
......@@ -2665,28 +2606,6 @@ void amf_n1::ul_nas_transport_handle(
}
}
//------------------------------------------------------------------------------
void amf_n1::send_itti_to_smf_services_consumer(
uint32_t ran_ue_ngap_id, long amf_ue_ngap_id, uint8_t request_type,
uint8_t pdu_session_id, bstring dnn, bstring sm_msg) {
itti_smf_services_consumer* itti_msg =
new itti_smf_services_consumer(TASK_AMF_N1, TASK_AMF_N11);
itti_msg->ran_ue_ngap_id = ran_ue_ngap_id;
itti_msg->amf_ue_ngap_id = amf_ue_ngap_id;
itti_msg->req_type = request_type;
itti_msg->pdu_sess_id = pdu_session_id;
itti_msg->dnn = dnn;
itti_msg->sm_msg = sm_msg;
std::shared_ptr<itti_smf_services_consumer> i =
std::shared_ptr<itti_smf_services_consumer>(itti_msg);
int ret = itti_inst->send_msg(i);
if (0 != ret) {
Logger::amf_n1().error(
"Could not send ITTI message %s to task TASK_AMF_N11",
i->get_msg_name());
}
}
//------------------------------------------------------------------------------
void amf_n1::dump_nas_message(uint8_t* buf, int len) {
for (int i = 0; i < len; i++)
......
......@@ -69,8 +69,6 @@ class amf_n1 {
SecurityHeaderType type, std::shared_ptr<nas_context> nc,
uint32_t ran_ue_ngap_id, long amf_ue_ngap_id, bstring plain_msg,
std::string snn, uint8_t ulCount);
void uplink_nas_msg_handle(
uint32_t ran_ue_ngap_id, long amf_ue_ngap_id, bstring plain_msg);
void uplink_nas_msg_handle(
uint32_t ran_ue_ngap_id, long amf_ue_ngap_id, bstring plain_msg,
plmn_t plmn);
......@@ -152,9 +150,6 @@ class amf_n1 {
void annex_a_4_33501(
uint8_t ck[16], uint8_t ik[16], uint8_t* input, uint8_t rand[16],
std::string serving_network, uint8_t* output);
void send_itti_to_smf_services_consumer(
uint32_t ran_ue_ngap_id, long amf_ue_ngap_id, uint8_t request_type,
uint8_t pdu_session_id, bstring dnn, bstring sm_msg);
void set_5gmm_state(std::shared_ptr<nas_context> nc, _5gmm_state_t state);
void get_5gmm_state(std::shared_ptr<nas_context> nc, _5gmm_state_t& state);
......
This diff is collapsed.
......@@ -45,7 +45,7 @@ class amf_n11 {
amf_n11();
~amf_n11();
void handle_itti_message(itti_smf_services_consumer&);
void handle_itti_message(itti_nsmf_pdusession_create_sm_context&);
void handle_pdu_session_initial_request(
std::string supi, std::shared_ptr<pdu_session_context> psc,
std::string smf_addr, std::string smf_api_version, bstring sm_msg,
......@@ -66,11 +66,12 @@ class amf_n11 {
void curl_http_client(
std::string remoteUri, std::string jsonData, std::string n1SmMsg,
std::string n2SmMsg, std::string supi, uint8_t pdu_session_id);
std::string n2SmMsg, std::string supi, uint8_t pdu_session_id,
uint32_t promise_id = 0);
void curl_http_client(
std::string remoteUri, std::string Method, std::string msgBody,
std::string& Response);
std::string& response);
bool discover_smf(
std::string& smf_addr, std::string& smf_api_version,
......
This diff is collapsed.
......@@ -58,26 +58,40 @@ class amf_n2 : public ngap::ngap_app {
void handle_itti_message(itti_ue_radio_capability_indication& itti_msg);
void handle_itti_message(itti_ue_context_release_command& itti_msg);
void handle_itti_message(itti_pdu_session_resource_release_command& itti_msg);
void handle_itti_message(itti_handover_required& itti_msg);
bool handle_itti_message(itti_handover_required& itti_msg);
void handle_itti_message(itti_handover_request_Ack& itti_msg);
void handle_itti_message(itti_handover_notify& itti_msg);
void handle_itti_message(itti_uplinkranstatsutransfer& itti_msg);
void handle_itti_message(itti_uplink_ran_status_transfer& itti_msg);
void send_handover_preparation_failure(
const unsigned long amf_ue_ngap_id, const uint32_t ran_ue_ngap_id,
const sctp_assoc_id_t& gnb_assoc_id);
bool verifyPlmn(std::vector<SupportedItem_t> list);
std::vector<SupportedItem_t> get_common_plmn(
std::vector<SupportedItem_t> list);
std::shared_ptr<ue_ngap_context> ran_ue_id_2_ue_ngap_context(
const uint32_t& ran_ue_ngap_id) const;
bool is_ran_ue_id_2_ue_ngap_context(const uint32_t& ran_ue_ngap_id) const;
void set_ran_ue_ngap_id_2_ue_ngap_context(
const uint32_t& ran_ue_ngap_id, std::shared_ptr<ue_ngap_context> unc);
std::shared_ptr<ue_ngap_context> amf_ue_id_2_ue_ngap_context(
const unsigned long& amf_ue_ngap_id) const;
bool is_amf_ue_id_2_ue_ngap_context(
const unsigned long& amf_ue_ngap_id) const;
void set_amf_ue_ngap_id_2_ue_ngap_context(
const unsigned long& amf_ue_ngap_id,
std::shared_ptr<ue_ngap_context> unc);
private:
std::map<uint32_t, std::shared_ptr<ue_ngap_context>>
ranid2uecontext; // ran ue ngap id
mutable std::shared_mutex m_ranid2uecontext;
std::map<unsigned long, std::shared_ptr<ue_ngap_context>>
amfueid2uecontext; // amf ue id
mutable std::shared_mutex m_amfueid2uecontext;
};
} // namespace amf_application
......
......@@ -136,8 +136,11 @@ constexpr auto CURL_MIME_BOUNDARY = "----Boundary";
#define AUSF_CURL_TIMEOUT_MS 100L
#define CURL_TIMEOUT_MS 100L
#define BUFFER_SIZE_2048 2048
#define BUFFER_SIZE_1024 1024
#define BUFFER_SIZE_512 512
#define BUFFER_SIZE_256 256
#define FUTURE_STATUS_TIMEOUT_MS 100
#endif
......@@ -55,5 +55,7 @@ class pdu_session_context {
snssai_t snssai;
plmn_t plmn;
std::string smf_context_location;
bool is_ho_accepted;
};
#endif
......@@ -46,19 +46,22 @@ typedef enum {
class ue_ngap_context {
public:
uint32_t ran_ue_ngap_id; // 32bits
long amf_ue_ngap_id : 40; // 40bits
uint32_t ran_ue_ngap_id; // 32bits
long amf_ue_ngap_id : 40; // 40bits
uint32_t target_ran_ue_ngap_id; // 32bits, for HO
sctp_stream_id_t sctp_stream_recv; // used to decide which ue in gNB
sctp_stream_id_t sctp_stream_send; // used to decide which ue in gNB
sctp_assoc_id_t gnb_assoc_id; // to find which gnb this UE belongs to
sctp_assoc_id_t target_gnb_assoc_id;
bool ueContextRequest;
uint32_t s_tmsi_5g;
// state management, ue status over the air
ng_ue_state_t ng_ue_state;
uint8_t ncc; // Next Hop Chaining Counter
};
#endif
......@@ -78,7 +78,7 @@ typedef enum {
DOWNLINK_NAS_TRANSFER,
NAS_SIG_ESTAB_REQ, // task amf_app
N1N2_MESSAGE_TRANSFER_REQ,
SMF_SERVICES_CONSUMER,
NSMF_PDU_SESSION_CREATE_SM_CTX,
NSMF_PDU_SESSION_UPDATE_SM_CTX,
N11_REGISTER_NF_INSTANCE_REQUEST,
N11_REGISTER_NF_INSTANCE_RESPONSE,
......@@ -88,12 +88,12 @@ typedef enum {
SBI_EVENT_EXPOSURE_REQUEST,
SBI_NOTIFICATION_DATA,
UE_CONTEXT_RELEASE_COMMAND,
NSMF_PDU_SESS_RELEASE_SMCTX,
NSMF_PDU_SESSION_RELEASE_SM_CTX,
HANDOVER_REQUIRED,
HANDOVER_REQUEST_ACK,
HANDOVER_NOTIFY,
UPLINKRANSTATUSTRANSFER,
PDU_SESS_RES_SET_RESP,
UPLINK_RAN_STATUS_TRANSFER,
PDU_SESSION_RESOURCE_SETUP_RESPONSE,
TIME_OUT,
HEALTH_PING,
TERMINATE,
......
......@@ -45,12 +45,13 @@ class itti_msg_n11 : public itti_msg {
uint32_t ran_ue_ngap_id;
};
class itti_smf_services_consumer : public itti_msg_n11 {
class itti_nsmf_pdusession_create_sm_context : public itti_msg_n11 {
public:
itti_smf_services_consumer(
itti_nsmf_pdusession_create_sm_context(
const task_id_t origin, const task_id_t destination)
: itti_msg_n11(SMF_SERVICES_CONSUMER, origin, destination) {}
itti_smf_services_consumer(const itti_smf_services_consumer& i)
: itti_msg_n11(NSMF_PDU_SESSION_CREATE_SM_CTX, origin, destination) {}
itti_nsmf_pdusession_create_sm_context(
const itti_nsmf_pdusession_create_sm_context& i)
: itti_msg_n11(i) {}
public:
......@@ -66,7 +67,8 @@ class itti_pdu_session_resource_setup_response : public itti_msg_n11 {
public:
itti_pdu_session_resource_setup_response(
const task_id_t origin, const task_id_t destination)
: itti_msg_n11(PDU_SESS_RES_SET_RESP, origin, destination) {}
: itti_msg_n11(PDU_SESSION_RESOURCE_SETUP_RESPONSE, origin, destination) {
}
itti_pdu_session_resource_setup_response(
const itti_pdu_session_resource_setup_response& i)
: itti_msg_n11(i) {}
......@@ -82,6 +84,7 @@ class itti_nsmf_pdusession_update_sm_context : public itti_msg_n11 {
const task_id_t origin, const task_id_t destination)
: itti_msg_n11(NSMF_PDU_SESSION_UPDATE_SM_CTX, origin, destination) {
is_n2sm_set = false;
promise_id = 0;
}
itti_nsmf_pdusession_update_sm_context(
const itti_nsmf_pdusession_update_sm_context& i)
......@@ -90,6 +93,8 @@ class itti_nsmf_pdusession_update_sm_context : public itti_msg_n11 {
n2sm = i.n2sm;
is_n2sm_set = i.is_n2sm_set;
n2sm_info_type = i.n2sm_info_type;
promise_id = i.promise_id;
;
}
public:
......@@ -100,13 +105,14 @@ class itti_nsmf_pdusession_update_sm_context : public itti_msg_n11 {
std::string n2sm_info_type;
uint32_t ran_ue_ngap_id;
long amf_ue_ngap_id;
uint32_t promise_id;
};
class itti_nsmf_pdusession_release_sm_context : public itti_msg_n11 {
public:
itti_nsmf_pdusession_release_sm_context(
const task_id_t origin, const task_id_t destination)
: itti_msg_n11(NSMF_PDU_SESS_RELEASE_SMCTX, origin, destination) {}
: itti_msg_n11(NSMF_PDU_SESSION_RELEASE_SM_CTX, origin, destination) {}
itti_nsmf_pdusession_release_sm_context(
const itti_nsmf_pdusession_update_sm_context& i)
: itti_msg_n11(i) {}
......
......@@ -218,7 +218,7 @@ class itti_handover_required : public itti_msg_n2 {
itti_handover_required(const task_id_t origin, const task_id_t destination)
: itti_msg_n2(HANDOVER_REQUIRED, origin, destination) {}
itti_handover_required(const itti_handover_required& i) : itti_msg_n2(i) {}
HandoverRequiredMsg* handvoerRequ;
HandoverRequiredMsg* handoverReq;
};
class itti_handover_request_Ack : public itti_msg_n2 {
......@@ -238,12 +238,12 @@ class itti_handover_notify : public itti_msg_n2 {
HandoverNotifyMsg* handovernotify;
};
class itti_uplinkranstatsutransfer : public itti_msg_n2 {
class itti_uplink_ran_status_transfer : public itti_msg_n2 {
public:
itti_uplinkranstatsutransfer(
itti_uplink_ran_status_transfer(
const task_id_t origin, const task_id_t destination)
: itti_msg_n2(UPLINKRANSTATUSTRANSFER, origin, destination) {}
itti_uplinkranstatsutransfer(const itti_uplinkranstatsutransfer& i)
: itti_msg_n2(UPLINK_RAN_STATUS_TRANSFER, origin, destination) {}
itti_uplink_ran_status_transfer(const itti_uplink_ran_status_transfer& i)
: itti_msg_n2(i) {}
UplinkRANStatusTransfer* uplinkrantransfer;
};
......
......@@ -35,32 +35,32 @@ using namespace nas;
//------------------------------------------------------------------------------
RegistrationRequest::RegistrationRequest() {
plain_header = NULL;
ie_5gsregistrationtype = NULL;
ie_ngKSI = NULL;
ie_5gs_mobility_id = NULL;
ie_non_current_native_nas_ksi = NULL;
ie_5g_mm_capability = NULL;
ie_ue_security_capability = NULL;
ie_requested_NSSAI = NULL;
ie_s1_ue_network_capability = NULL;
ie_uplink_data_status = NULL;
ie_last_visited_registered_TAI = NULL;
ie_PDU_session_status = NULL;
ie_MICO_indicationl = NULL;
ie_ue_status = NULL;
ie_additional_guti = NULL;
ie_allowed_PDU_session_status = NULL;
ie_ues_usage_setting = NULL;
ie_5gs_drx_parameters = NULL;
ie_eps_nas_message_container = NULL;
ie_ladn_indication = NULL;
ie_payload_container_type = NULL;
ie_payload_container = NULL;
ie_network_slicing_indication = NULL;
ie_5gs_update_type = NULL;
ie_nas_message_container = NULL;
ie_eps_bearer_context_status = NULL;
plain_header = nullptr;
ie_5gsregistrationtype = nullptr;
ie_ngKSI = nullptr;
ie_5gs_mobility_id = nullptr;
ie_non_current_native_nas_ksi = nullptr;
ie_5g_mm_capability = nullptr;
ie_ue_security_capability = nullptr;
ie_requested_NSSAI = nullptr;
ie_s1_ue_network_capability = nullptr;
ie_uplink_data_status = nullptr;
ie_last_visited_registered_TAI = nullptr;
ie_PDU_session_status = nullptr;
ie_MICO_indicationl = nullptr;
ie_ue_status = nullptr;
ie_additional_guti = nullptr;
ie_allowed_PDU_session_status = nullptr;
ie_ues_usage_setting = nullptr;
ie_5gs_drx_parameters = nullptr;
ie_eps_nas_message_container = nullptr;
ie_ladn_indication = nullptr;
ie_payload_container_type = nullptr;
ie_payload_container = nullptr;
ie_network_slicing_indication = nullptr;
ie_5gs_update_type = nullptr;
ie_nas_message_container = nullptr;
ie_eps_bearer_context_status = nullptr;
}
//------------------------------------------------------------------------------
......@@ -94,11 +94,11 @@ void RegistrationRequest::setngKSI(uint8_t tsc, uint8_t key_set_id) {
//------------------------------------------------------------------------------
uint8_t RegistrationRequest::getngKSI() {
if (ie_ngKSI) {
uint8_t a = 0;
a = (ie_ngKSI->getTypeOfSecurityContext()) | ie_ngKSI->getasKeyIdentifier();
return a;
return (
(ie_ngKSI->getTypeOfSecurityContext()) |
ie_ngKSI->getasKeyIdentifier());
} else {
return -1;
return 0;
}
}
......@@ -122,7 +122,7 @@ uint8_t RegistrationRequest::getMobilityIdentityType() {
if (ie_5gs_mobility_id) {
return ie_5gs_mobility_id->gettypeOfIdentity();
} else {
return -1;
return 0;
}
}
......@@ -169,9 +169,9 @@ void RegistrationRequest::setAdditional_GUTI_SUCI_SUPI_format_IMSI(
bool RegistrationRequest::getAdditionalGuti(nas::_5G_GUTI_t& guti) {
if (ie_additional_guti) {
ie_additional_guti->get5GGUTI(guti);
return 0;
return true;
} else {
return -1;
return false;
}
}
......@@ -203,7 +203,7 @@ uint8_t RegistrationRequest::getNonCurrentNativeNasKSI() {
(ie_non_current_native_nas_ksi->getasKeyIdentifier());
return a;
} else {
return -1;
return 0;
}
}
......@@ -217,7 +217,7 @@ uint8_t RegistrationRequest::get5GMMCapability() {
if (ie_5g_mm_capability)
return ie_5g_mm_capability->getValue();
else
return -1;
return 0;
}
//------------------------------------------------------------------------------
......@@ -239,7 +239,7 @@ bool RegistrationRequest::getUeSecurityCapability(uint8_t& ea, uint8_t& ia) {
ea = ie_ue_security_capability->getEASel();
ia = ie_ue_security_capability->getIASel();
} else {
return -1;
return false;
}
return true;
}
......@@ -255,7 +255,7 @@ bool RegistrationRequest::getUeSecurityCapability(
eia = ie_ue_security_capability->getEIASel();
}
} else {
return -1;
return false;
}
return true;
}
......@@ -272,7 +272,7 @@ bool RegistrationRequest::getRequestedNssai(
if (ie_requested_NSSAI) {
ie_requested_NSSAI->getValue(nssai);
} else {
return -1;
return false;
}
return true;
}
......@@ -297,7 +297,7 @@ bool RegistrationRequest::getS1UeNetworkCapability(uint8_t& eea, uint8_t& eia) {
eea = ie_s1_ue_network_capability->getEEASel();
eia = ie_s1_ue_network_capability->getEIASel();
} else {
return -1;
return false;
}
return true;
}
......@@ -312,7 +312,7 @@ uint16_t RegistrationRequest::getUplinkDataStatus() {
if (ie_uplink_data_status) {
return ie_uplink_data_status->getValue();
} else {
return -1;
return 0;
}
}
......@@ -326,7 +326,7 @@ uint16_t RegistrationRequest::getPduSessionStatus() {
if (ie_PDU_session_status) {
return ie_PDU_session_status->getValue();
} else {
return -1;
return 0;
}
}
......@@ -340,9 +340,9 @@ bool RegistrationRequest::getMicoIndication(uint8_t& sprti, uint8_t& raai) {
if (ie_PDU_session_status) {
sprti = ie_MICO_indicationl->getSPRTI();
raai = ie_MICO_indicationl->getRAAI();
return 0;
return true;
} else {
return -1;
return false;
}
}
......@@ -356,9 +356,9 @@ bool RegistrationRequest::getUeStatus(uint8_t& n1ModeReg, uint8_t& s1ModeReg) {
if (ie_ue_status) {
n1ModeReg = ie_ue_status->getN1();
s1ModeReg = ie_ue_status->getS1();
return 0;
return true;
} else {
return -1;
return false;
}
}
......@@ -372,7 +372,7 @@ uint16_t RegistrationRequest::getAllowedPduSessionStatus() {
if (ie_allowed_PDU_session_status) {
return ie_allowed_PDU_session_status->getValue();
} else {
return -1;
return 0;
}
}
......@@ -386,7 +386,7 @@ uint8_t RegistrationRequest::getUEsUsageSetting() {
if (ie_ues_usage_setting) {
return ie_ues_usage_setting->getValue();
} else {
return -1;
return 0;
}
}
......@@ -400,7 +400,7 @@ uint8_t RegistrationRequest::get5GSDrxParameters() {
if (ie_5gs_drx_parameters) {
return ie_5gs_drx_parameters->getValue();
} else {
return -1;
return 0;
}
}
......@@ -413,9 +413,9 @@ void RegistrationRequest::setEPS_NAS_Message_Container(bstring value) {
bool RegistrationRequest::getEpsNasMessageContainer(bstring& epsNas) {
if (ie_eps_nas_message_container) {
ie_eps_nas_message_container->getValue(epsNas);
return 0;
return true;
} else {
return -1;
return false;
}
}
......@@ -429,7 +429,7 @@ bool RegistrationRequest::getLadnIndication(std::vector<bstring>& ladnValue) {
if (ie_ladn_indication) {
return ie_ladn_indication->getValue(ladnValue);
} else {
return -1;
return 0;
}
}
......@@ -443,7 +443,7 @@ uint8_t RegistrationRequest::getPayloadContainerType() {
if (ie_payload_container_type) {
return ie_payload_container_type->getValue();
} else {
return -1;
return 0;
}
}
......@@ -458,9 +458,9 @@ bool RegistrationRequest::getPayloadContainer(
std::vector<PayloadContainerEntry>& content) {
if (ie_payload_container) {
ie_payload_container->getValue(content);
return 0;
return true;
} else {
return -1;
return false;
}
}
......@@ -476,9 +476,9 @@ bool RegistrationRequest::getNetworkSlicingIndication(
if (ie_network_slicing_indication) {
dcni = ie_network_slicing_indication->getDCNI();
nssci = ie_network_slicing_indication->getNSSCI();
return 0;
return true;
} else {
return -1;
return false;
}
}
......@@ -498,9 +498,9 @@ bool RegistrationRequest::get5GSUpdateType(
_5gs_pnb_ciot = ie_5gs_update_type->get_5GS_PNB_CIoT();
ng_ran_rcu = ie_5gs_update_type->getNG_RAN();
sms_requested = ie_5gs_update_type->getSMS();
return 0;
return true;
} else {
return -1;
return false;
}
}
......@@ -513,9 +513,9 @@ void RegistrationRequest::setNAS_Message_Container(bstring value) {
bool RegistrationRequest::getNasMessageContainer(bstring& nas) {
if (ie_nas_message_container) {
ie_nas_message_container->getValue(nas);
return 0;
return true;
} else {
return -1;
return false;
}
}
......@@ -529,7 +529,7 @@ uint16_t RegistrationRequest::getEpsBearerContextStatus() {
if (ie_eps_bearer_context_status) {
return ie_eps_bearer_context_status->getValue();
} else {
return -1;
return 0;
}
}
......
......@@ -27,6 +27,7 @@
*/
#include "DownLinkNasTransport.hpp"
#include "logger.hpp"
extern "C" {
#include "asn_codecs.h"
......@@ -83,9 +84,8 @@ void DownLinkNasTransportMsg::setMessageType() {
&(downLinkNasTransportPdu->choice.initiatingMessage->value.choice
.DownlinkNASTransport);
} else {
cout << "[warning] This information doesn't refer to DownlinkNASTransport "
"Message!!!"
<< endl;
Logger::ngap().warn(
"This information doesn't refer to DownlinkNASTransport Message");
}
}
......@@ -103,13 +103,13 @@ void DownLinkNasTransportMsg::setAmfUeNgapId(unsigned long id) {
int ret = amfUeNgapId->encode2AMF_UE_NGAP_ID(ie->value.choice.AMF_UE_NGAP_ID);
if (!ret) {
cout << "encode AMF_UE_NGAP_ID IE error" << endl;
Logger::ngap().error("Encode AMF_UE_NGAP_ID IE error");
free_wrapper((void**) &ie);
return;
}
ret = ASN_SEQUENCE_ADD(&downLinkNasTransportIEs->protocolIEs.list, ie);
if (ret != 0) cout << "encode AMF_UE_NGAP_ID IE error" << endl;
if (ret != 0) Logger::ngap().error("Encode AMF_UE_NGAP_ID IE error");
// free_wrapper((void**) &ie);
}
......@@ -127,13 +127,13 @@ void DownLinkNasTransportMsg::setRanUeNgapId(uint32_t ran_ue_ngap_id) {
int ret = ranUeNgapId->encode2RAN_UE_NGAP_ID(ie->value.choice.RAN_UE_NGAP_ID);
if (!ret) {
cout << "encode RAN_UE_NGAP_ID IE error" << endl;
Logger::ngap().error("Encode RAN_UE_NGAP_ID IE error");
free_wrapper((void**) &ie);
return;
}
ret = ASN_SEQUENCE_ADD(&downLinkNasTransportIEs->protocolIEs.list, ie);
if (ret != 0) cout << "encode RAN_UE_NGAP_ID IE error" << endl;
if (ret != 0) Logger::ngap().error("Encode RAN_UE_NGAP_ID IE error");
// free_wrapper((void**) &ie);
}
......@@ -151,13 +151,13 @@ void DownLinkNasTransportMsg::setOldAmfName(const std::string name) {
int ret = oldAmfName->encode2AmfName(&ie->value.choice.AMFName);
if (!ret) {
cout << "encode oldAmfName IE error" << endl;
Logger::ngap().error("Encode oldAmfName IE error");
free_wrapper((void**) &ie);
return;
}
ret = ASN_SEQUENCE_ADD(&downLinkNasTransportIEs->protocolIEs.list, ie);
if (ret != 0) cout << "encode oldAmfName IE error" << endl;
if (ret != 0) Logger::ngap().error("Encode oldAmfName IE error");
// free_wrapper((void**) &ie);
}
......@@ -176,7 +176,7 @@ void DownLinkNasTransportMsg::setRanPagingPriority(uint8_t pagingPriority) {
int ret = ranPagingPriority->encode2RANPagingPriority(
ie->value.choice.RANPagingPriority);
if (!ret) {
cout << "encode RANPagingPriority IE error" << endl;
Logger::ngap().error("Encode RANPagingPriority IE error");
free_wrapper((void**) &ie);
return;
}
......@@ -201,13 +201,13 @@ void DownLinkNasTransportMsg::setNasPdu(uint8_t* nas, size_t sizeofnas) {
int ret = nasPdu->encode2octetstring(ie->value.choice.NAS_PDU);
if (!ret) {
cout << "encode NAS_PDU IE error" << endl;
Logger::ngap().error("Encode NAS_PDU IE error");
free_wrapper((void**) &ie);
return;
}
ret = ASN_SEQUENCE_ADD(&downLinkNasTransportIEs->protocolIEs.list, ie);
if (ret != 0) cout << "encode NAS_PDU IE error" << endl;
if (ret != 0) Logger::ngap().error("Encode NAS_PDU IE error");
// free_wrapper((void**) &ie);
}
......@@ -226,13 +226,13 @@ void DownLinkNasTransportMsg::setIndex2Rat_Frequency_SelectionPriority(
int ret = indexToRFSP->encode2IndexToRFSP(ie->value.choice.IndexToRFSP);
if (!ret) {
cout << "encode IndexToRFSP IE error" << endl;
Logger::ngap().error("Encode IndexToRFSP IE error");
free_wrapper((void**) &ie);
return;
}
ret = ASN_SEQUENCE_ADD(&downLinkNasTransportIEs->protocolIEs.list, ie);
if (ret != 0) cout << "encode IndexToRFSP IE error" << endl;
if (ret != 0) Logger::ngap().error("Encode IndexToRFSP IE error");
// free_wrapper((void**) &ie);
}
......
......@@ -30,14 +30,17 @@ extern "C" {
using namespace std;
namespace ngap {
DownlinkRANStatusTransfer::DownlinkRANStatusTransfer() {
amfUeNgapId = NULL;
ranUeNgapId = NULL;
ranStatusTransfer_TransparentContainer = NULL;
DownlinkranstatustransferIEs = NULL;
DownlinkranstatustransferPDU = NULL;
amfUeNgapId = nullptr;
ranUeNgapId = nullptr;
ranStatusTransfer_TransparentContainer = nullptr;
DownlinkranstatustransferIEs = nullptr;
DownlinkranstatustransferPDU = nullptr;
}
DownlinkRANStatusTransfer::~DownlinkRANStatusTransfer() {}
void DownlinkRANStatusTransfer::setAmfUeNgapId(unsigned long id) {
if (!amfUeNgapId) amfUeNgapId = new AMF_UE_NGAP_ID();
amfUeNgapId->setAMF_UE_NGAP_ID(id);
......@@ -61,6 +64,7 @@ void DownlinkRANStatusTransfer::setAmfUeNgapId(unsigned long id) {
if (ret != 0) cout << "encode AMF_UE_NGAP_ID IE error" << endl;
// free_wrapper((void**) &ie);
}
void DownlinkRANStatusTransfer::setRanUeNgapId(uint32_t id) {
if (!ranUeNgapId) ranUeNgapId = new RAN_UE_NGAP_ID();
ranUeNgapId->setRanUeNgapId(id);
......@@ -152,6 +156,7 @@ void DownlinkRANStatusTransfer::setRANStatusTransfer_TransparentContainer(
free_wrapper((void**) &ie);
*/
}
void DownlinkRANStatusTransfer::setmessagetype() {
if (!DownlinkranstatustransferPDU) {
DownlinkranstatustransferPDU =
......@@ -180,6 +185,7 @@ void DownlinkRANStatusTransfer::setmessagetype() {
<< endl;
}
}
int DownlinkRANStatusTransfer::encodetobuffer(uint8_t* buf, int buf_size) {
asn_fprint(stderr, &asn_DEF_Ngap_NGAP_PDU, DownlinkranstatustransferPDU);
asn_enc_rval_t er = aper_encode_to_buffer(
......
......@@ -20,6 +20,8 @@
*/
#include "HandoverCommandMsg.hpp"
#include "logger.hpp"
extern "C" {
#include "Ngap_NGAP-PDU.h"
#include "Ngap_PDUSessionResourceHandoverItem.h"
......@@ -39,28 +41,35 @@ using namespace std;
namespace ngap {
HandoverCommandMsg::HandoverCommandMsg() {
amfUeNgapId = NULL;
ranUeNgapId = NULL;
ngap_handovertype = NULL;
NASSecurityParametersFromNGRAN = NULL;
PDUSessionResourceHandoverList = NULL;
PDUSessionResourceToReleaseListHOCmd = NULL;
TargetToSource_TransparentContainer = NULL;
CriticalityDiagnostics = NULL;
handoverCommandPdu = NULL;
handoverCommandIEs = NULL;
amfUeNgapId = nullptr;
ranUeNgapId = nullptr;
ngap_handovertype = nullptr;
NASSecurityParametersFromNGRAN = nullptr;
PDUSessionResourceHandoverList = nullptr;
PDUSessionResourceToReleaseListHOCmd = nullptr;
TargetToSource_TransparentContainer = nullptr;
CriticalityDiagnostics = nullptr;
handoverCommandPdu = nullptr;
handoverCommandIEs = nullptr;
}
HandoverCommandMsg::~HandoverCommandMsg() {}
unsigned long HandoverCommandMsg::getAmfUeNgapId() {
return amfUeNgapId->getAMF_UE_NGAP_ID();
if (amfUeNgapId)
return amfUeNgapId->getAMF_UE_NGAP_ID();
else
return 0;
}
uint32_t HandoverCommandMsg::getRanUeNgapId() {
return ranUeNgapId->getRanUeNgapId();
if (ranUeNgapId)
return ranUeNgapId->getRanUeNgapId();
else
return 0;
}
bool HandoverCommandMsg::decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu) {
if (!ngap_msg_pdu) return false;
handoverCommandPdu = ngap_msg_pdu;
if (handoverCommandPdu->present == Ngap_NGAP_PDU_PR_successfulOutcome) {
......@@ -74,11 +83,11 @@ bool HandoverCommandMsg::decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu) {
handoverCommandIEs = &handoverCommandPdu->choice.successfulOutcome->value
.choice.HandoverCommand;
} else {
cout << "Check HandoverCommand message error!!!" << endl;
Logger::ngap().error("Check HandoverCommand message error");
return false;
}
} else {
cout << "HandoverRequired MessageType error!!!" << endl;
Logger::ngap().error("HandoverRequired MessageType error");
return false;
}
for (int i = 0; i < handoverCommandIEs->protocolIEs.list.count; i++) {
......@@ -92,11 +101,11 @@ bool HandoverCommandMsg::decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu) {
if (!amfUeNgapId->decodefromAMF_UE_NGAP_ID(
handoverCommandIEs->protocolIEs.list.array[i]
->value.choice.AMF_UE_NGAP_ID)) {
cout << "decoded ngap AMF_UE_NGAP_ID IE error" << endl;
Logger::ngap().error("Decoded ngap AMF_UE_NGAP_ID IE error");
return false;
}
} else {
cout << "decoded ngap AMF_UE_NGAP_ID IE error" << endl;
Logger::ngap().error("Decoded ngap AMF_UE_NGAP_ID IE error");
return false;
}
} break;
......@@ -109,11 +118,11 @@ bool HandoverCommandMsg::decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu) {
if (!ranUeNgapId->decodefromRAN_UE_NGAP_ID(
handoverCommandIEs->protocolIEs.list.array[i]
->value.choice.RAN_UE_NGAP_ID)) {
cout << "decoded ngap RAN_UE_NGAP_ID IE error" << endl;
Logger::ngap().error("Decoded ngap RAN_UE_NGAP_ID IE error");
return false;
}
} else {
cout << "decoded ngap RAN_UE_NGAP_ID IE error" << endl;
Logger::ngap().error("Decoded ngap RAN_UE_NGAP_ID IE error");
return false;
}
} break;
......@@ -126,7 +135,7 @@ bool HandoverCommandMsg::decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu) {
*ngap_handovertype = handoverCommandIEs->protocolIEs.list.array[i]
->value.choice.HandoverType;
} else {
cout << "decoded ngap Handover Type IE error" << endl;
Logger::ngap().error("Decoded ngap Handover Type IE error");
return false;
}
} break;
......@@ -136,8 +145,8 @@ bool HandoverCommandMsg::decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu) {
handoverCommandIEs->protocolIEs.list.array[i]->value.present ==
Ngap_HandoverCommandIEs__value_PR_PDUSessionResourceHandoverList) {
} else {
cout << "decoded ngap PDUSessionResourceHandoverList IE error"
<< endl;
Logger::ngap().error(
"Decoded ngap PDUSessionResourceHandoverList IE error");
return false;
}
} break;
......@@ -147,8 +156,8 @@ bool HandoverCommandMsg::decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu) {
handoverCommandIEs->protocolIEs.list.array[i]->value.present ==
Ngap_HandoverCommandIEs__value_PR_PDUSessionResourceToReleaseListHOCmd) {
} else {
cout << "decoded ngap PDUSessionResourceToReleaseListHOCmd IE error"
<< endl;
Logger::ngap().error(
"Decoded ngap PDUSessionResourceToReleaseListHOCmd IE error");
return false;
}
} break;
......@@ -158,8 +167,8 @@ bool HandoverCommandMsg::decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu) {
handoverCommandIEs->protocolIEs.list.array[i]->value.present ==
Ngap_HandoverCommandIEs__value_PR_TargetToSource_TransparentContainer) {
} else {
cout << "decoded ngap TargetToSource_TransparentContainer IE error"
<< endl;
Logger::ngap().error(
"Decoded ngap TargetToSource_TransparentContainer IE error");
return false;
}
} break;
......@@ -169,12 +178,12 @@ bool HandoverCommandMsg::decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu) {
handoverCommandIEs->protocolIEs.list.array[i]->value.present ==
Ngap_HandoverCommandIEs__value_PR_CriticalityDiagnostics) {
} else {
cout << "decoded ngap CriticalityDiagnostics IE error" << endl;
Logger::ngap().error("Decoded ngap CriticalityDiagnostics IE error");
return false;
}
} break;
default: {
cout << "decoded ngap message pdu error" << endl;
Logger::ngap().error("Decoded NGAP message PDU error");
return false;
}
}
......@@ -212,9 +221,8 @@ void HandoverCommandMsg::setMessageType() {
handoverCommandIEs = &(handoverCommandPdu->choice.successfulOutcome->value
.choice.HandoverCommand);
} else {
cout << "[warning] This information doesn't refer to HandoverCommand "
"Message!!!"
<< endl;
Logger::ngap().warn(
"This information doesn't refer to HandoverCommand message");
}
}
......@@ -230,13 +238,13 @@ void HandoverCommandMsg::setAmfUeNgapId(unsigned long id) {
int ret = amfUeNgapId->encode2AMF_UE_NGAP_ID(ie->value.choice.AMF_UE_NGAP_ID);
if (!ret) {
cout << "encode AMF_UE_NGAP_ID IE error" << endl;
Logger::ngap().error("Encode AMF_UE_NGAP_ID IE error");
free_wrapper((void**) &ie);
return;
}
ret = ASN_SEQUENCE_ADD(&handoverCommandIEs->protocolIEs.list, ie);
if (ret != 0) cout << "encode AMF_UE_NGAP_ID IE error" << endl;
if (ret != 0) Logger::ngap().error("Encode AMF_UE_NGAP_ID IE error");
// free_wrapper((void**) &ie);
}
......@@ -252,13 +260,14 @@ void HandoverCommandMsg::setRanUeNgapId(uint32_t ran_ue_ngap_id) {
int ret = ranUeNgapId->encode2RAN_UE_NGAP_ID(ie->value.choice.RAN_UE_NGAP_ID);
if (!ret) {
cout << "encode RAN_UE_NGAP_ID IE error" << endl;
Logger::ngap().error("Encode RAN_UE_NGAP_ID IE error");
free_wrapper((void**) &ie);
return;
}
ret = ASN_SEQUENCE_ADD(&handoverCommandIEs->protocolIEs.list, ie);
if (ret != 0) cout << "encode RAN_UE_NGAP_ID IE error" << endl;
if (ret != 0) Logger::ngap().error("Encode RAN_UE_NGAP_ID IE error");
// free_wrapper((void**) &ie);
}
......@@ -271,7 +280,8 @@ void HandoverCommandMsg::setHandoverType(long type) {
ie->value.present = Ngap_HandoverCommandIEs__value_PR_HandoverType;
ie->value.choice.HandoverType = type;
int ret = ASN_SEQUENCE_ADD(&handoverCommandIEs->protocolIEs.list, ie);
if (ret != 0) cout << "encode HandoverType IE error" << endl;
if (ret != 0) Logger::ngap().error("Encode HandoverType IE error");
// free_wrapper((void**) &ie);
}
......@@ -290,8 +300,10 @@ void HandoverCommandMsg::setPduSessionResourceHandoverList(
item->pDUSessionID = list[i].pduSessionId;
item->handoverCommandTransfer = list[i].HandoverCommandTransfer;
int ret = ASN_SEQUENCE_ADD(&PDUSessionResourceHandoverList->list, item);
if (ret != 0)
cout << "encode PDUSessionResourceHandoverListItem IE error" << endl;
Logger::ngap().error(
"Encode PDUSessionResourceHandoverListItem IE error");
}
ie->id = Ngap_ProtocolIE_ID_id_PDUSessionResourceHandoverList;
......@@ -302,7 +314,8 @@ void HandoverCommandMsg::setPduSessionResourceHandoverList(
*PDUSessionResourceHandoverList;
int ret = ASN_SEQUENCE_ADD(&handoverCommandIEs->protocolIEs.list, ie);
if (ret != 0)
cout << "encode PDUSessionResourceHandoverList IE error" << endl;
Logger::ngap().error("Encode PDUSessionResourceHandoverList IE error");
// free_wrapper((void**) &item);
// free_wrapper((void**) &ie);
}
......@@ -321,7 +334,7 @@ void HandoverCommandMsg::setTargetToSource_TransparentContainer(
Ngap_HandoverCommandIEs__value_PR_TargetToSource_TransparentContainer;
ie->value.choice.TargetToSource_TransparentContainer = targetTosource;
int ret = ASN_SEQUENCE_ADD(&handoverCommandIEs->protocolIEs.list, ie);
if (ret != 0) cout << "encode HandoverType IE error" << endl;
if (ret != 0) Logger::ngap().error("Encode HandoverType IE error");
// free_wrapper((void**) &ie);
}
......
......@@ -60,8 +60,8 @@ class HandoverCommandMsg {
int encode2buffer(uint8_t* buf, int buf_size);
bool decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu);
unsigned long getAmfUeNgapId(); // return -1;(不存在)
uint32_t getRanUeNgapId(); // return -1;(不存在)
unsigned long getAmfUeNgapId(); // return -1;
uint32_t getRanUeNgapId(); // return -1;
/*void getHandoverType(Ngap_HandoverType_t &handovertype);
void getCause(Cause cause);
void getTargetID(Ngap_TargetID_t targetID);
......
......@@ -26,6 +26,7 @@
\email: contact@openairinterface.org
*/
#include "HandoverNotifyMsg.hpp"
#include "logger.hpp"
extern "C" {
#include "asn_codecs.h"
......@@ -51,8 +52,12 @@ HandoverNotifyMsg::HandoverNotifyMsg() {
HandoverNotifyMsg::~HandoverNotifyMsg(){};
unsigned long HandoverNotifyMsg::getAmfUeNgapId() {
return amfUeNgapId->getAMF_UE_NGAP_ID();
if (amfUeNgapId)
return amfUeNgapId->getAMF_UE_NGAP_ID();
else
return 0;
}
int HandoverNotifyMsg::encode2buffer(uint8_t* buf, int buf_size) {
asn_fprint(stderr, &asn_DEF_Ngap_NGAP_PDU, handoverNotifyPdu);
asn_enc_rval_t er = aper_encode_to_buffer(
......@@ -60,7 +65,9 @@ int HandoverNotifyMsg::encode2buffer(uint8_t* buf, int buf_size) {
cout << "er.encoded(" << er.encoded << ")" << endl;
return er.encoded;
}
bool HandoverNotifyMsg::decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu) {
if (!ngap_msg_pdu) return false;
handoverNotifyPdu = ngap_msg_pdu;
if (handoverNotifyPdu->present == Ngap_NGAP_PDU_PR_initiatingMessage) {
......@@ -74,11 +81,11 @@ bool HandoverNotifyMsg::decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu) {
handoverNotifyIEs = &handoverNotifyPdu->choice.initiatingMessage->value
.choice.HandoverNotify;
} else {
cout << "Check HandoverNotify message error!!!" << endl;
Logger::ngap().error("Check HandoverNotify message error!");
return false;
}
} else {
cout << "HandoverNotify MessageType error!!!" << endl;
Logger::ngap().error("HandoverNotify MessageType error!");
return false;
}
for (int i = 0; i < handoverNotifyIEs->protocolIEs.list.count; i++) {
......@@ -92,11 +99,11 @@ bool HandoverNotifyMsg::decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu) {
if (!amfUeNgapId->decodefromAMF_UE_NGAP_ID(
handoverNotifyIEs->protocolIEs.list.array[i]
->value.choice.AMF_UE_NGAP_ID)) {
cout << "decoded ngap AMF_UE_NGAP_ID IE error" << endl;
Logger::ngap().error("Decoded ngap AMF_UE_NGAP_ID IE error");
return false;
}
} else {
cout << "decoded ngap AMF_UE_NGAP_ID IE error" << endl;
Logger::ngap().error("Decoded ngap AMF_UE_NGAP_ID IE error");
return false;
}
} break;
......@@ -109,11 +116,11 @@ bool HandoverNotifyMsg::decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu) {
if (!ranUeNgapId->decodefromRAN_UE_NGAP_ID(
handoverNotifyIEs->protocolIEs.list.array[i]
->value.choice.RAN_UE_NGAP_ID)) {
cout << "decoded ngap RAN_UE_NGAP_ID IE error" << endl;
Logger::ngap().error("Decoded ngap RAN_UE_NGAP_ID IE error");
return false;
}
} else {
cout << "decoded ngap RAN_UE_NGAP_ID IE error" << endl;
Logger::ngap().error("Decoded ngap RAN_UE_NGAP_ID IE error");
return false;
}
} break;
......@@ -126,16 +133,17 @@ bool HandoverNotifyMsg::decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu) {
if (!userLocationInformation->decodefromUserLocationInformation(
&handoverNotifyIEs->protocolIEs.list.array[i]
->value.choice.UserLocationInformation)) {
cout << "decoded ngap UserLocationInformation IE error" << endl;
Logger::ngap().error(
"Decoded ngap UserLocationInformation IE error");
return false;
}
} else {
cout << "decoded ngap UserLocationInformation IE error" << endl;
Logger::ngap().error("Decoded ngap UserLocationInformation IE error");
return false;
}
} break;
default: {
cout << "decoded ngap message pdu error" << endl;
Logger::ngap().error("Decoded NGAP message PDU error");
return false;
}
}
......@@ -175,20 +183,28 @@ void HandoverNotifyMsg::setUserLocationInfoNR(
int ret = userLocationInformation->encodefromUserLocationInformation(
&ie->value.choice.UserLocationInformation);
if (!ret) {
cout << "encode UserLocationInformation IE error" << endl;
Logger::ngap().error("Encode UserLocationInformation IE error");
free_wrapper((void**) &ie);
return;
}
ret = ASN_SEQUENCE_ADD(&handoverNotifyIEs->protocolIEs.list, ie);
if (ret != 0) cout << "encode UserLocationInformation IE error" << endl;
if (ret != 0) Logger::ngap().error("Encode UserLocationInformation IE error");
// free_wrapper((void**) &ie);
}
uint32_t HandoverNotifyMsg::getRanUeNgapId() {
return ranUeNgapId->getRanUeNgapId();
if (ranUeNgapId)
return ranUeNgapId->getRanUeNgapId();
else
return 0;
}
bool HandoverNotifyMsg::getUserLocationInfoNR(
struct NrCgi_s& cig, struct Tai_s& tai) {
if (!userLocationInformation) return false;
UserLocationInformationNR* informationNR;
userLocationInformation->getInformation(informationNR);
if (userLocationInformation->getChoiceOfUserLocationInformation() !=
......
......@@ -48,8 +48,8 @@ class HandoverNotifyMsg {
int encode2buffer(uint8_t* buf, int buf_size);
bool decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu);
void setUserLocationInfoNR(struct NrCgi_s cig, struct Tai_s tai);
unsigned long getAmfUeNgapId(); // return -1;
uint32_t getRanUeNgapId(); // return -1;
unsigned long getAmfUeNgapId();
uint32_t getRanUeNgapId();
bool getUserLocationInfoNR(struct NrCgi_s& cig, struct Tai_s& tai);
private:
......
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 _HANDOVER_PREPARATION_FAILURE_H_
#define _HANDOVER_PREPARATION_FAILURE_H_
#include "AMF-UE-NGAP-ID.hpp"
#include "Cause.hpp"
#include "MessageType.hpp"
#include "NgapIEsStruct.hpp"
#include "RAN-UE-NGAP-ID.hpp"
extern "C" {
#include "Ngap_NGAP-PDU.h"
#include "Ngap_ProtocolIE-Field.h"
}
namespace ngap {
class HandoverPreparationFailure {
public:
HandoverPreparationFailure();
virtual ~HandoverPreparationFailure();
void setMessageType(); // Initialize the PDU and populate the MessageType;
void setAmfUeNgapId(unsigned long id); // 40 bits
unsigned long getAmfUeNgapId() const;
void setRanUeNgapId(uint32_t id); // 32 bits
uint32_t getRanUeNgapId() const;
int encode2buffer(uint8_t* buf, int buf_size);
bool decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu);
void getCause(Cause& cause) const;
void setCause(Ngap_Cause_PR m_causePresent, long value = 0);
Ngap_Cause_PR getChoiceOfCause() const;
private:
Ngap_NGAP_PDU_t* hoPreparationFailurePdu;
Ngap_HandoverPreparationFailure_t* hoPreparationFailureIEs;
AMF_UE_NGAP_ID* amfUeNgapId;
RAN_UE_NGAP_ID* ranUeNgapId;
Cause* cause;
Ngap_CriticalityDiagnostics_t* CriticalityDiagnostics;
};
} // namespace ngap
#endif
......@@ -20,6 +20,7 @@
*/
#include "HandoverRequest.hpp"
#include "logger.hpp"
extern "C" {
#include "Ngap_NGAP-PDU.h"
......@@ -39,24 +40,27 @@ using namespace std;
namespace ngap {
HandoverRequest::HandoverRequest() {
amfUeNgapId = NULL;
handovertype = NULL;
cause = NULL;
ueAggregateMaximumBitRate = NULL;
ueSecurityCapabilities = NULL;
SecurityContext = NULL;
PDUSessionResourceSetupList = NULL;
allowedNSSAI = NULL;
SourceToTarget_TransparentContainer = NULL;
mobilityrestrictionlist = NULL;
guami = NULL;
handoverRequestPdu = NULL;
handoverRequestIEs = NULL;
amfUeNgapId = nullptr;
handovertype = nullptr;
cause = nullptr;
ueAggregateMaximumBitRate = nullptr;
ueSecurityCapabilities = nullptr;
SecurityContext = nullptr;
PDUSessionResourceSetupList = nullptr;
allowedNSSAI = nullptr;
SourceToTarget_TransparentContainer = nullptr;
mobilityrestrictionlist = nullptr;
guami = nullptr;
handoverRequestPdu = nullptr;
handoverRequestIEs = nullptr;
}
HandoverRequest::~HandoverRequest() {}
unsigned long HandoverRequest::getAmfUeNgapId() {
return amfUeNgapId->getAMF_UE_NGAP_ID();
if (amfUeNgapId)
return amfUeNgapId->getAMF_UE_NGAP_ID();
else
return 0;
}
/*bool HandoverRequest::decodefrompdu(Ngap_NGAP_PDU_t *ngap_msg_pdu)
......@@ -244,11 +248,11 @@ void HandoverRequest::setMessageType() {
handoverRequestIEs = &(handoverRequestPdu->choice.initiatingMessage->value
.choice.HandoverRequest);
} else {
cout << "[warning] This information doesn't refer to HandoverRequest "
"Message!!!"
<< endl;
Logger::ngap().warn(
"This information doesn't refer to HandoverRequest message!");
}
}
void HandoverRequest::setAmfUeNgapId(unsigned long id) {
if (!amfUeNgapId) amfUeNgapId = new AMF_UE_NGAP_ID();
amfUeNgapId->setAMF_UE_NGAP_ID(id);
......@@ -261,13 +265,14 @@ void HandoverRequest::setAmfUeNgapId(unsigned long id) {
int ret = amfUeNgapId->encode2AMF_UE_NGAP_ID(ie->value.choice.AMF_UE_NGAP_ID);
if (!ret) {
cout << "encode AMF_UE_NGAP_ID IE error" << endl;
Logger::ngap().error("Encode AMF_UE_NGAP_ID IE error");
free_wrapper((void**) &ie);
return;
}
ret = ASN_SEQUENCE_ADD(&handoverRequestIEs->protocolIEs.list, ie);
if (ret != 0) cout << "encode AMF_UE_NGAP_ID IE error" << endl;
if (ret != 0) Logger::ngap().error("Encode AMF_UE_NGAP_ID IE error");
// free_wrapper((void**) &ie);
}
......@@ -281,7 +286,7 @@ void HandoverRequest::setHandoverType(long type) // 0--intra5gs
ie->value.present = Ngap_HandoverRequestIEs__value_PR_HandoverType;
ie->value.choice.HandoverType = type;
int ret = ASN_SEQUENCE_ADD(&handoverRequestIEs->protocolIEs.list, ie);
if (ret != 0) cout << "encode HandoverType IE error" << endl;
if (ret != 0) Logger::ngap().error("Encode HandoverType IE error");
// free_wrapper((void**) &ie);
}
......@@ -298,7 +303,7 @@ void HandoverRequest::setCause(Ngap_Cause_PR m_causePresent, long value) //
cause->setValue(value);
cause->encode2Cause(&(ie->value.choice.Cause));
int ret = ASN_SEQUENCE_ADD(&handoverRequestIEs->protocolIEs.list, ie);
if (ret != 0) cout << "encode Cause IE error" << endl;
if (ret != 0) Logger::ngap().error("Encode Cause IE error");
// free_wrapper((void**) &ie);
}
......@@ -320,7 +325,8 @@ void HandoverRequest::setUEAggregateMaximumBitRate(
ie->value.choice.UEAggregateMaximumBitRate);
int ret = ASN_SEQUENCE_ADD(&handoverRequestIEs->protocolIEs.list, ie);
if (ret != 0) cout << "encode UEAggregateMaximumBitRate IE error" << endl;
if (ret != 0)
Logger::ngap().error("Encode UEAggregateMaximumBitRate IE error");
// free_wrapper((void**) &ie);
}
void HandoverRequest::setUESecurityCapabilities(
......@@ -342,14 +348,14 @@ void HandoverRequest::setUESecurityCapabilities(
(ie->value.choice.UESecurityCapabilities));
int ret = ASN_SEQUENCE_ADD(&handoverRequestIEs->protocolIEs.list, ie);
if (ret != 0) cout << "encode UESecurityCapabilities IE error" << endl;
if (ret != 0) Logger::ngap().error("Encode UESecurityCapabilities IE error");
// free_wrapper((void**) &ie);
}
void HandoverRequest::setGUAMI(
PlmnId* m_plmnId, AMFRegionID* m_aMFRegionID, AMFSetID* m_aMFSetID,
AMFPointer* m_aMFPointer) {
if (!guami) guami = new GUAMI;
if (!guami) guami = new GUAMI();
Ngap_HandoverRequestIEs_t* ie =
(Ngap_HandoverRequestIEs_t*) calloc(1, sizeof(Ngap_HandoverRequestIEs_t));
......@@ -360,7 +366,8 @@ void HandoverRequest::setGUAMI(
guami->encode2GUAMI(&(ie->value.choice.GUAMI));
int ret = ASN_SEQUENCE_ADD(&handoverRequestIEs->protocolIEs.list, ie);
if (ret != 0) cout << "encode GUAMI IE error" << endl;
if (ret != 0) Logger::ngap().error("Encode GUAMI IE error");
// free_wrapper((void**) &ie);
}
void HandoverRequest::setAllowedNSSAI(std::vector<S_NSSAI> list) {
......@@ -374,7 +381,8 @@ void HandoverRequest::setAllowedNSSAI(std::vector<S_NSSAI> list) {
list[i].encode2S_NSSAI(&item->s_NSSAI);
int ret = ASN_SEQUENCE_ADD(&allowedNSSAI->list, item);
if (ret != 0)
cout << "encode PDUSessionResourceHandoverListItem IE error" << endl;
Logger::ngap().error(
"Encode PDUSessionResourceHandoverListItem IE error");
}
asn_fprint(stderr, &asn_DEF_Ngap_AllowedNSSAI, allowedNSSAI);
Ngap_HandoverRequestIEs_t* ie =
......@@ -384,7 +392,7 @@ void HandoverRequest::setAllowedNSSAI(std::vector<S_NSSAI> list) {
ie->value.present = Ngap_HandoverRequestIEs__value_PR_AllowedNSSAI;
ie->value.choice.AllowedNSSAI = *allowedNSSAI;
int ret = ASN_SEQUENCE_ADD(&handoverRequestIEs->protocolIEs.list, ie);
if (ret != 0) cout << "encode AllowedNSSAI IE error" << endl;
if (ret != 0) Logger::ngap().error("Encode AllowedNSSAI IE error");
// free_wrapper((void**) &ie);
}
void HandoverRequest::setSecurityContext(long count, uint8_t* buffer) {
......@@ -402,7 +410,7 @@ void HandoverRequest::setSecurityContext(long count, uint8_t* buffer) {
ie->value.present = Ngap_HandoverRequestIEs__value_PR_SecurityContext;
ie->value.choice.SecurityContext = *SecurityContext;
int ret = ASN_SEQUENCE_ADD(&handoverRequestIEs->protocolIEs.list, ie);
if (ret != 0) cout << "encode SecurityContext IE error" << endl;
if (ret != 0) Logger::ngap().error("Encode SecurityContext IE error");
// free_wrapper((void**) &ie);
}
......@@ -438,14 +446,14 @@ void HandoverRequest::setPduSessionResourceSetupList(
PDUSessionResourceSetupList->encode2PDUSessionResourceSetupListHOReq(
&ie->value.choice.PDUSessionResourceSetupListHOReq);
if (!ret) {
cout << "encode PDUSessionResourceSetupListSUReq IE error" << endl;
Logger::ngap().error("Encode PDUSessionResourceSetupListSUReq IE error");
free_wrapper((void**) &ie);
return;
}
ret = ASN_SEQUENCE_ADD(&handoverRequestIEs->protocolIEs.list, ie);
if (ret != 0)
cout << "encode PDUSessionResourceSetupListSUReq IE error" << endl;
Logger::ngap().error("Encode PDUSessionResourceSetupListSUReq IE error");
// free_wrapper((void**) &ie);
}
......@@ -464,7 +472,7 @@ void HandoverRequest::setSourceToTarget_TransparentContainer(
ie->value.choice.SourceToTarget_TransparentContainer = sourceTotarget;
int ret = ASN_SEQUENCE_ADD(&handoverRequestIEs->protocolIEs.list, ie);
if (ret != 0)
cout << "encode SourceToTarget_TransparentContainer IE error" << endl;
Logger::ngap().error("Encode SourceToTarget_TransparentContainer IE error");
// free_wrapper((void**) &ie);
}
void HandoverRequest::setMobilityRestrictionList(PlmnId* m_plmnId) {
......@@ -480,7 +488,7 @@ void HandoverRequest::setMobilityRestrictionList(PlmnId* m_plmnId) {
mobilityrestrictionlist->encodeMobilityRestrictionList(
&(ie->value.choice.MobilityRestrictionList));
int ret = ASN_SEQUENCE_ADD(&handoverRequestIEs->protocolIEs.list, ie);
if (ret != 0) cout << "encode MobilityRestrictionList IE error" << endl;
if (ret != 0) Logger::ngap().error("Encode MobilityRestrictionList IE error");
// free_wrapper((void**) &ie);
}
......
......@@ -81,7 +81,7 @@ class HandoverRequest {
private:
Ngap_NGAP_PDU_t* handoverRequestPdu;
Ngap_HandoverRequest_t* handoverRequestIEs;
/***************** for decoding ****************/
AMF_UE_NGAP_ID* amfUeNgapId;
Ngap_HandoverType_t* handovertype;
Cause* cause;
......
......@@ -20,7 +20,7 @@
*/
#include "HandoverRequestAck.hpp"
#include "logger.hpp"
#include "GTP-TEID.hpp"
#include "String2Value.hpp"
#include "TransportLayerAddress.hpp"
......@@ -55,7 +55,10 @@ HandoverRequestAck::HandoverRequestAck() {
HandoverRequestAck::~HandoverRequestAck() {}
unsigned long HandoverRequestAck::getAmfUeNgapId() {
return amfUeNgapId->getAMF_UE_NGAP_ID();
if (amfUeNgapId)
return amfUeNgapId->getAMF_UE_NGAP_ID();
else
return 0;
}
void HandoverRequestAck::setMessageType() {
if (!handoverRequestAckPdu)
......@@ -79,16 +82,21 @@ void HandoverRequestAck::setMessageType() {
handoverRequestAckIEs = &(handoverRequestAckPdu->choice.successfulOutcome
->value.choice.HandoverRequestAcknowledge);
} else {
cout << "[warning] This information doesn't refer to HandoverRequest "
"Message!!!"
<< endl;
Logger::ngap().warn(
"This information doesn't refer to HandoverRequest message");
}
}
uint32_t HandoverRequestAck::getRanUeNgapId() {
return ranUeNgapId->getRanUeNgapId();
if (ranUeNgapId)
return ranUeNgapId->getRanUeNgapId();
else
return 0;
}
OCTET_STRING_t HandoverRequestAck::getTargetToSource_TransparentContainer() {
return *TargetToSource_TransparentContainer;
if (TargetToSource_TransparentContainer)
return *TargetToSource_TransparentContainer;
return OCTET_STRING_t();
}
bool HandoverRequestAck::getPDUSessionResourceAdmittedList(
......@@ -114,6 +122,7 @@ bool HandoverRequestAck::getPDUSessionResourceAdmittedList(
}
bool HandoverRequestAck::decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu) {
if (!ngap_msg_pdu) return false;
handoverRequestAckPdu = ngap_msg_pdu;
if (handoverRequestAckPdu->present == Ngap_NGAP_PDU_PR_successfulOutcome) {
......@@ -127,11 +136,11 @@ bool HandoverRequestAck::decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu) {
handoverRequestAckIEs = &handoverRequestAckPdu->choice.successfulOutcome
->value.choice.HandoverRequestAcknowledge;
} else {
cout << "Check handoverRequestAck message error!!!" << endl;
Logger::ngap().error("Check handoverRequestAck message error");
return false;
}
} else {
cout << "handoverRequestAck MessageType error!!!" << endl;
Logger::ngap().error("handoverRequestAck MessageType error");
return false;
}
for (int i = 0; i < handoverRequestAckIEs->protocolIEs.list.count; i++) {
......@@ -145,11 +154,11 @@ bool HandoverRequestAck::decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu) {
if (!amfUeNgapId->decodefromAMF_UE_NGAP_ID(
handoverRequestAckIEs->protocolIEs.list.array[i]
->value.choice.AMF_UE_NGAP_ID)) {
cout << "decoded ngap AMF_UE_NGAP_ID IE error" << endl;
Logger::ngap().error("Decoded NGAP AMF_UE_NGAP_ID IE error");
return false;
}
} else {
cout << "decoded ngap AMF_UE_NGAP_ID IE error" << endl;
Logger::ngap().error("Decoded NGAP AMF_UE_NGAP_ID IE error");
return false;
}
} break;
......@@ -162,11 +171,11 @@ bool HandoverRequestAck::decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu) {
if (!ranUeNgapId->decodefromRAN_UE_NGAP_ID(
handoverRequestAckIEs->protocolIEs.list.array[i]
->value.choice.RAN_UE_NGAP_ID)) {
cout << "decoded ngap RAN_UE_NGAP_ID IE error" << endl;
Logger::ngap().error("Decoded NGAP RAN_UE_NGAP_ID IE error");
return false;
}
} else {
cout << "decoded ngap RAN_UE_NGAP_ID IE error" << endl;
Logger::ngap().error("Decoded NGAP RAN_UE_NGAP_ID IE error");
return false;
}
} break;
......@@ -180,13 +189,13 @@ bool HandoverRequestAck::decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu) {
->decodefromPDUSessionResourceAdmittedList(
&handoverRequestAckIEs->protocolIEs.list.array[i]
->value.choice.PDUSessionResourceAdmittedList)) {
cout << "decoded ngap PDUSessionResourceAdmittedList IE error"
<< endl;
Logger::ngap().error(
"Decoded NGAP PDUSessionResourceAdmittedList IE error");
return false;
}
} else {
cout << "decoded ngap PDUSessionResourceAdmittedList Type IE error"
<< endl;
Logger::ngap().error(
"Decoded NGAP PDUSessionResourceAdmittedList IE error");
return false;
}
} break;
......@@ -201,13 +210,14 @@ bool HandoverRequestAck::decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu) {
handoverRequestAckIEs->protocolIEs.list.array[i]
->value.choice.TargetToSource_TransparentContainer;
} else {
cout << "decoded ngap TargetToSource_TransparentContainer IE error"
<< endl;
Logger::ngap().error(
"Decoded NGAP TargetToSource_TransparentContainer IE error");
return false;
}
} break;
default: {
cout << "decoded ngap message pdu error" << endl;
Logger::ngap().error("Decoded NGAP Message PDU error");
return false;
}
}
......
......@@ -65,7 +65,6 @@ class HandoverRequestAck {
private:
Ngap_NGAP_PDU_t* handoverRequestAckPdu;
Ngap_HandoverRequestAcknowledge_t* handoverRequestAckIEs;
/***************** for decoding ****************/
AMF_UE_NGAP_ID* amfUeNgapId;
RAN_UE_NGAP_ID* ranUeNgapId;
Ngap_HandoverType_t* handovertype;
......
......@@ -20,6 +20,7 @@
*/
#include "HandoverRequiredMsg.hpp"
#include "logger.hpp"
extern "C" {
#include "Ngap_NGAP-PDU.h"
#include "asn_codecs.h"
......@@ -52,31 +53,55 @@ HandoverRequiredMsg::HandoverRequiredMsg() {
HandoverRequiredMsg::~HandoverRequiredMsg() {}
unsigned long HandoverRequiredMsg::getAmfUeNgapId() {
return amfUeNgapId->getAMF_UE_NGAP_ID();
if (amfUeNgapId)
return amfUeNgapId->getAMF_UE_NGAP_ID();
else
return 0;
}
uint32_t HandoverRequiredMsg::getRanUeNgapId() {
return ranUeNgapId->getRanUeNgapId();
if (ranUeNgapId)
return ranUeNgapId->getRanUeNgapId();
else
return 0;
}
Ngap_HandoverType_t HandoverRequiredMsg::getHandoverType() {
return *handovertype;
if (handovertype)
return *handovertype;
else
return Ngap_HandoverType_t();
}
Ngap_Cause_PR HandoverRequiredMsg::getChoiceOfCause() {
return cause->getChoiceOfCause();
if (cause)
return cause->getChoiceOfCause();
else
return Ngap_Cause_PR();
}
long HandoverRequiredMsg::getCauseValue() {
return cause->getValue();
if (cause)
return cause->getValue();
else
return 0;
}
void HandoverRequiredMsg::getGlobalRanNodeId(GlobalgNBId*& ptr) {
ptr->decodefromGlobalgNBId(
targetid->choice.targetRANNodeID->globalRANNodeID.choice.globalGNB_ID);
if (ptr)
ptr->decodefromGlobalgNBId(
targetid->choice.targetRANNodeID->globalRANNodeID.choice.globalGNB_ID);
}
void HandoverRequiredMsg::getTAI(TAI*& ptr) {
ptr->decodefromTAI(&(targetid->choice.targetRANNodeID->selectedTAI));
if (ptr) ptr->decodefromTAI(&(targetid->choice.targetRANNodeID->selectedTAI));
}
OCTET_STRING_t HandoverRequiredMsg::getSourceToTarget_TransparentContainer() {
return *SourceToTarget_TransparentContainer;
if (SourceToTarget_TransparentContainer)
return *SourceToTarget_TransparentContainer;
else
return OCTET_STRING_t();
}
bool HandoverRequiredMsg::getPDUSessionResourceList(
......@@ -103,7 +128,10 @@ bool HandoverRequiredMsg::getPDUSessionResourceList(
}
long HandoverRequiredMsg::getDirectForwardingPathAvailability() {
return *directforwardingPathAvailability;
if (directforwardingPathAvailability)
return *directforwardingPathAvailability;
else
return 0;
}
bool HandoverRequiredMsg::decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu) {
......@@ -120,11 +148,11 @@ bool HandoverRequiredMsg::decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu) {
handoverRequiredIEs = &handoverRequiredPdu->choice.initiatingMessage
->value.choice.HandoverRequired;
} else {
cout << "Check HandoverRequired message error!!!" << endl;
Logger::ngap().error("Check HandoverRequired message error!");
return false;
}
} else {
cout << "HandoverRequired MessageType error!!!" << endl;
Logger::ngap().error("HandoverRequired MessageType error!");
return false;
}
for (int i = 0; i < handoverRequiredIEs->protocolIEs.list.count; i++) {
......@@ -138,11 +166,11 @@ bool HandoverRequiredMsg::decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu) {
if (!amfUeNgapId->decodefromAMF_UE_NGAP_ID(
handoverRequiredIEs->protocolIEs.list.array[i]
->value.choice.AMF_UE_NGAP_ID)) {
cout << "decoded ngap AMF_UE_NGAP_ID IE error" << endl;
Logger::ngap().error("Decoded ngap AMF_UE_NGAP_ID IE error");
return false;
}
} else {
cout << "decoded ngap AMF_UE_NGAP_ID IE error" << endl;
Logger::ngap().error("Decoded ngap AMF_UE_NGAP_ID IE error");
return false;
}
} break;
......@@ -155,11 +183,11 @@ bool HandoverRequiredMsg::decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu) {
if (!ranUeNgapId->decodefromRAN_UE_NGAP_ID(
handoverRequiredIEs->protocolIEs.list.array[i]
->value.choice.RAN_UE_NGAP_ID)) {
cout << "decoded ngap RAN_UE_NGAP_ID IE error" << endl;
Logger::ngap().error("Decoded ngap RAN_UE_NGAP_ID IE error");
return false;
}
} else {
cout << "decoded ngap RAN_UE_NGAP_ID IE error" << endl;
Logger::ngap().error("Decoded ngap RAN_UE_NGAP_ID IE error");
return false;
}
} break;
......@@ -172,7 +200,7 @@ bool HandoverRequiredMsg::decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu) {
*handovertype = handoverRequiredIEs->protocolIEs.list.array[i]
->value.choice.HandoverType;
} else {
cout << "decoded ngap Handover Type IE error" << endl;
Logger::ngap().error("Decoded ngap Handover Type error");
return false;
}
} break;
......@@ -185,11 +213,11 @@ bool HandoverRequiredMsg::decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu) {
if (!cause->decodefromCause(
&handoverRequiredIEs->protocolIEs.list.array[i]
->value.choice.Cause)) {
cout << "decoded ngap Cause IE error" << endl;
Logger::ngap().error("Decoded ngap Cause IE error");
return false;
}
} else {
cout << "decoded ngap Cause IE error" << endl;
Logger::ngap().error("Decoded ngap Cause IE error");
return false;
}
} break;
......@@ -202,7 +230,7 @@ bool HandoverRequiredMsg::decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu) {
*targetid = handoverRequiredIEs->protocolIEs.list.array[i]
->value.choice.TargetID;
} else {
cout << "decoded ngap TargetID IE error" << endl;
Logger::ngap().error("Decoded ngap TargetID IE error");
return false;
}
} break;
......@@ -217,8 +245,8 @@ bool HandoverRequiredMsg::decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu) {
handoverRequiredIEs->protocolIEs.list.array[i]
->value.choice.DirectForwardingPathAvailability;
} else {
cout << "decoded ngap DirectForwardingPathAvailability IE error"
<< endl;
Logger::ngap().error(
"Decoded ngap DirectForwardingPathAvailability IE error");
return false;
}
} break;
......@@ -231,12 +259,13 @@ bool HandoverRequiredMsg::decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu) {
if (!PDUSessionResourceList->decodefromPDUSessionResourceListHORqd(
&handoverRequiredIEs->protocolIEs.list.array[i]
->value.choice.PDUSessionResourceListHORqd)) {
cout << "decoded ngap PDUSessionResourceSetupListCxtRes IE error"
<< endl;
Logger::ngap().error(
"Decoded ngap PDUSessionResourceSetupListCxtRes IE error");
return false;
}
} else {
cout << "decoded ngap PDUSessionResourceListHORqd IE error" << endl;
Logger::ngap().error(
"Decoded ngap PDUSessionResourceSetupListCxtRes IE error");
return false;
}
} break;
......@@ -251,13 +280,13 @@ bool HandoverRequiredMsg::decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu) {
handoverRequiredIEs->protocolIEs.list.array[i]
->value.choice.SourceToTarget_TransparentContainer;
} else {
cout << "decoded ngap SourceToTarget_TransparentContainer IE error"
<< endl;
Logger::ngap().error(
"Decoded ngap SourceToTarget_TransparentContainer IE error");
return false;
}
} break;
default: {
cout << "decoded ngap message pdu error" << endl;
Logger::ngap().error("Decoded ngap message PDU error");
return false;
}
}
......@@ -270,7 +299,8 @@ int HandoverRequiredMsg::encode2buffer(uint8_t* buf, int buf_size) {
asn_fprint(stderr, &asn_DEF_Ngap_NGAP_PDU, handoverRequiredPdu);
asn_enc_rval_t er = aper_encode_to_buffer(
&asn_DEF_Ngap_NGAP_PDU, NULL, handoverRequiredPdu, buf, buf_size);
cout << "er.encoded(" << er.encoded << ")" << endl;
// cout << "er.encoded(" << er.encoded << ")" << endl;
Logger::ngap().error("er.encoded( %d )", er.encoded);
return er.encoded;
}
......
......@@ -48,9 +48,8 @@ class HandoverRequiredMsg {
int encode2buffer(uint8_t* buf, int buf_size);
bool decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu);
unsigned long getAmfUeNgapId(); // return -1;(不存在)
uint32_t getRanUeNgapId(); // return -1;(不存在)
unsigned long getAmfUeNgapId();
uint32_t getRanUeNgapId();
Ngap_HandoverType_t getHandoverType();
Ngap_Cause_PR getChoiceOfCause();
long getCauseValue();
......@@ -63,7 +62,6 @@ class HandoverRequiredMsg {
private:
Ngap_NGAP_PDU_t* handoverRequiredPdu;
Ngap_HandoverRequired_t* handoverRequiredIEs;
/***************** for decoding ****************/
AMF_UE_NGAP_ID* amfUeNgapId;
RAN_UE_NGAP_ID* ranUeNgapId;
Ngap_HandoverType_t* handovertype;
......
......@@ -32,27 +32,38 @@
using namespace std;
namespace ngap {
UplinkRANStatusTransfer::UplinkRANStatusTransfer() {
amfUeNgapId = NULL;
ranUeNgapId = NULL;
ranStatusTransfer_TransparentContainer = NULL;
amfUeNgapId = nullptr;
ranUeNgapId = nullptr;
ranStatusTransfer_TransparentContainer = nullptr;
UplinkRANStatusTransferPDU = nullptr;
UplinkRANStatusTransferIEs = nullptr;
}
UplinkRANStatusTransfer::~UplinkRANStatusTransfer() {}
unsigned long UplinkRANStatusTransfer::getAmfUeNgapId() {
return amfUeNgapId->getAMF_UE_NGAP_ID();
if (amfUeNgapId)
return amfUeNgapId->getAMF_UE_NGAP_ID();
else
return 0;
}
uint32_t UplinkRANStatusTransfer::getRanUeNgapId() {
return ranUeNgapId->getRanUeNgapId();
if (ranUeNgapId)
return ranUeNgapId->getRanUeNgapId();
else
return 0;
}
void UplinkRANStatusTransfer::getRANStatusTransfer_TransparentContainer(
RANStatusTransferTransparentContainer*&
ranstatustransfer_transparentcontainer) {
ranstatustransfer_transparentcontainer =
ranStatusTransfer_TransparentContainer;
}
bool UplinkRANStatusTransfer::defromPDU(Ngap_NGAP_PDU_t* ngap_msg_pdu) {
UplinkRANStatusTransferPDU = ngap_msg_pdu;
if (UplinkRANStatusTransferPDU->present ==
......
......@@ -52,7 +52,6 @@ using namespace amf_application;
extern itti_mw* itti_inst;
extern amf_n1* amf_n1_inst;
extern amf_n11* amf_n11_inst;
extern amf_app* amf_app_inst;
typedef int (*ngap_message_decoded_callback)(
......@@ -158,7 +157,7 @@ int ngap_amf_handle_initial_context_setup_response(
}
std::vector<PDUSessionResourceSetupResponseItem_t> list;
if (!initCtxResp->getPduSessionResourceSetupResponseList(list)) {
Logger::ngap().error(
Logger::ngap().debug(
"Decode PduSessionResourceSetupResponseList IE error or this IE is not "
"available");
return 0;
......@@ -543,7 +542,7 @@ int downlink_ue_associated_nappa_transport(
int handover_cancel(
const sctp_assoc_id_t assoc_id, const sctp_stream_id_t stream,
struct Ngap_NGAP_PDU* message_p) {
Logger::ngap().debug("Sending itti handover cancel to TASK_AMF_N2");
Logger::ngap().debug("Sending ITTI Handover Cancel to TASK_AMF_N2");
return 0;
}
......@@ -551,18 +550,18 @@ int handover_cancel(
int handover_preparation(
const sctp_assoc_id_t assoc_id, const sctp_stream_id_t stream,
struct Ngap_NGAP_PDU* message_p) {
Logger::ngap().debug("Sending itti handover preparation to TASK_AMF_N2");
Logger::ngap().debug("Sending ITTI Handover Preparation to TASK_AMF_N2");
asn_fprint(stderr, &asn_DEF_Ngap_NGAP_PDU, message_p);
HandoverRequiredMsg* handoverrequired = new HandoverRequiredMsg();
if (!handoverrequired->decodefrompdu(message_p)) {
Logger::ngap().error("decoding HandoverRequired message error");
HandoverRequiredMsg* handover_required = new HandoverRequiredMsg();
if (!handover_required->decodefrompdu(message_p)) {
Logger::ngap().error("Decoding HandoverRequired message error");
return -1;
}
itti_handover_required* itti_handover_requ =
new itti_handover_required(TASK_NGAP, TASK_AMF_N2);
itti_handover_requ->assoc_id = assoc_id;
itti_handover_requ->stream = stream;
itti_handover_requ->handvoerRequ = handoverrequired;
itti_handover_requ->assoc_id = assoc_id;
itti_handover_requ->stream = stream;
itti_handover_requ->handoverReq = handover_required;
std::shared_ptr<itti_handover_required> i =
std::shared_ptr<itti_handover_required>(itti_handover_requ);
int ret = itti_inst->send_msg(i);
......@@ -578,11 +577,11 @@ int handover_preparation(
int handover_notification(
const sctp_assoc_id_t assoc_id, const sctp_stream_id_t stream,
struct Ngap_NGAP_PDU* message_p) {
Logger::ngap().debug("Sending itti handover Notification to TASK_AMF_N2");
Logger::ngap().debug("Sending ITTI Handover Notification to TASK_AMF_N2");
asn_fprint(stderr, &asn_DEF_Ngap_NGAP_PDU, message_p);
HandoverNotifyMsg* handoverNotify = new HandoverNotifyMsg();
if (!handoverNotify->decodefrompdu(message_p)) {
Logger::ngap().error("decoding handoverNotify message error");
Logger::ngap().error("Decoding HandoverNotify message error");
return -1;
}
itti_handover_notify* itti_handover_NOTIFY =
......@@ -606,12 +605,11 @@ int handover_resource_allocation(
const sctp_assoc_id_t assoc_id, const sctp_stream_id_t stream,
struct Ngap_NGAP_PDU* message_p) {
Logger::ngap().debug(
"Sending itti handover resource allocation to TASK_AMF_N2");
/*receive handover request acknowedge*/
"Sending ITTI Handover Resource Allocation to TASK_AMF_N2");
asn_fprint(stderr, &asn_DEF_Ngap_NGAP_PDU, message_p);
HandoverRequestAck* handoverRequestAck = new HandoverRequestAck();
if (!handoverRequestAck->decodefrompdu(message_p)) {
Logger::ngap().error("decoding handoverRequestAck message error");
Logger::ngap().error("Decoding Handover Request Acknowledge message error");
return -1;
}
itti_handover_request_Ack* itti_handover_requ_Ack =
......@@ -873,22 +871,22 @@ int uplink_ran_status_transfer(
const sctp_assoc_id_t assoc_id, const sctp_stream_id_t stream,
struct Ngap_NGAP_PDU* message_p) {
Logger::ngap().debug(
"Sending itti uplink ran status transfer to TASK_AMF_N2");
/*receive uplinkranstatustransfer*/
"Sending ITTI Uplink RAN Status Transfer to TASK_AMF_N2");
asn_fprint(stderr, &asn_DEF_Ngap_NGAP_PDU, message_p);
UplinkRANStatusTransfer* Uplinkranstatustransfer =
new UplinkRANStatusTransfer();
if (!Uplinkranstatustransfer->defromPDU(message_p)) {
Logger::ngap().error("Decoding Uplinkranstatustransfer message error");
Logger::ngap().error("Decoding Uplink RAN Status Transfer message error");
return -1;
}
itti_uplinkranstatsutransfer* itti_uplinkran_sta_tran =
new itti_uplinkranstatsutransfer(TASK_NGAP, TASK_AMF_N2);
itti_uplink_ran_status_transfer* itti_uplinkran_sta_tran =
new itti_uplink_ran_status_transfer(TASK_NGAP, TASK_AMF_N2);
itti_uplinkran_sta_tran->assoc_id = assoc_id;
itti_uplinkran_sta_tran->stream = stream;
itti_uplinkran_sta_tran->uplinkrantransfer = Uplinkranstatustransfer;
std::shared_ptr<itti_uplinkranstatsutransfer> i =
std::shared_ptr<itti_uplinkranstatsutransfer>(itti_uplinkran_sta_tran);
std::shared_ptr<itti_uplink_ran_status_transfer> i =
std::shared_ptr<itti_uplink_ran_status_transfer>(itti_uplinkran_sta_tran);
int ret = itti_inst->send_msg(i);
if (0 != ret) {
Logger::ngap().error(
......@@ -960,8 +958,7 @@ ngap_message_decoded_callback messages_callback[][3] = {
{overload_stop, overload_stop, overload_stop}, /*OverloadStop*/
{paging, paging, paging}, /*Paging*/
{ngap_amf_handle_path_switch_request, ngap_amf_handle_path_switch_request,
ngap_amf_handle_path_switch_request}, //{ngap_amf_handle_path_switch_request,0,0},
///*PathSwitchRequest*
ngap_amf_handle_path_switch_request}, /*PathSwitchRequest*/
{pdu_session_resource_modify, pdu_session_resource_modify,
pdu_session_resource_modify}, /*PDUSessionResourceModify*/
{pdu_session_resource_modify_indication,
......
......@@ -354,4 +354,4 @@ IF(STATIC_LINKING)
ENDIF(STATIC_LINKING)
target_link_libraries(amf ${ASAN}
-Wl,--start-group 3GPP_COMMON_TYPES AMF CONTEXTS AMF_SCTP AMF_SECU_5GAKA AMF_SECU_NAS AMF_UTILS AMF_SBI_CLIENT AMF_SBI_SERVER config++ sctp pthread ${NETTLE_LIBRARIES} ${MySQL_LIBRARY} ${CRYPTO_LIBRARIES} ${OPENSSL_LIBRARIES} boost_system ssl crypt cpprest gmp pistache curl)
-Wl,--start-group 3GPP_COMMON_TYPES AMF CONTEXTS AMF_SCTP AMF_SECU_5GAKA AMF_SECU_NAS AMF_UTILS AMF_SBI_CLIENT AMF_SBI_SERVER config++ sctp pthread ${NETTLE_LIBRARIES} ${MySQL_LIBRARY} ${CRYPTO_LIBRARIES} ${OPENSSL_LIBRARIES} boost_system boost_thread boost_chrono ssl crypt cpprest gmp pistache curl)
......@@ -22,7 +22,6 @@ using namespace amf_application;
extern void msg_str_2_msg_hex(std::string msg, bstring& b);
extern void convert_string_2_hex(std::string& input, std::string& output);
extern itti_mw* itti_inst;
extern amf_n11* amf_n11_inst;
extern amf_app* amf_app_inst;
extern void print_buffer(
const std::string app, const std::string commit, uint8_t* buf, int len);
......
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