Commit cb751761 authored by Tien Thinh NGUYEN's avatar Tien Thinh NGUYEN

Remove hardcoded values

parent d8f76d76
......@@ -3800,7 +3800,7 @@ void amf_n1::ul_nas_transport_handle(
amf_n2_inst->get_common_NSSAI(
nc->ran_ue_ngap_id, uc->gnb_id, common_nssais);
// Allowed NSSAI
// Use common NSSAI between gNB and AMF
for (auto s : common_nssais) {
snssai.sst = s.sst;
snssai.sd = s.sd;
......@@ -3810,19 +3810,18 @@ void amf_n1::ul_nas_transport_handle(
snssai.length = SST_LENGTH + SD_LENGTH;
}
Logger::amf_n1().debug(
"Allowed S-NSSAI (SST 0x%x, SD 0x%x)", s.sst, s.sd);
"Use common S-NSSAI (SST 0x%x, SD 0x%x)", s.sst, s.sd);
found = true;
break;
}
}
if (!found) {
snssai.sst = 1; // TODO: Get default value
snssai.sst = DEFAULT_SST;
snssai.sd = SD_NO_VALUE;
snssai.length = SST_LENGTH;
Logger::amf_n1().debug(
"Default allowed S-NSSAI (SST 0x%x, SD 0x%x)", snssai.sst,
snssai.sd);
"Default S-NSSAI (SST 0x%x, SD 0x%x)", snssai.sst, snssai.sd);
}
}
}
......@@ -3830,11 +3829,12 @@ void amf_n1::ul_nas_transport_handle(
Logger::amf_n1().debug(
"S_NSSAI for this PDU Session %s", snssai.ToString().c_str());
bstring dnn = bfromcstr("default");
bstring dnn = bfromcstr(DEFAULT_DNN);
if (!ul_nas->GetDnn(dnn)) {
Logger::amf_n1().debug(
"No DNN available in ULNASTransport, use default DNN!");
"No DNN available in ULNASTransport, use default DNN: %s",
DEFAULT_DNN);
// TODO: use default DNN for the corresponding NSSAI
}
......@@ -4606,9 +4606,9 @@ void amf_n1::initialize_registration_accept(
registration_accept->SetT3512Value(0x5, T3512_TIMER_VALUE_MIN);
// Timer T3502
registration_accept->SetT3502Value(12); // TODO: remove hardcoded value
registration_accept->SetT3502Value(T3502_TIMER_DEFAULT_VALUE_MIN);
// LADN info
// LADN info (TODO)
LadnInformation ladn_information = {};
registration_accept->SetLadnInformation(ladn_information);
......@@ -4636,7 +4636,7 @@ void amf_n1::initialize_registration_accept(
// Network Feature Support
// TODO: remove hardcoded values
registration_accept->Set5gsNetworkFeatureSupport(
0x00, 0x00); // 0x00, 0x00 to disable IMS
0x01, 0x00); // 0x00, 0x00 to disable IMS
// Allowed/Rejected/Configured NSSAI
// Get the list of common SST, SD between UE and AMF
......@@ -4714,7 +4714,8 @@ void amf_n1::initialize_registration_accept(
registration_accept->SetAllowedNssai(allowed_nssais);
registration_accept->SetRejectedNssai(rejected_nssais);
// registration_accept->SetConfiguredNssai(allowed_nssais); // TODO
registration_accept->SetConfiguredNssai(
allowed_nssais); // TODO: use Allowed NSSAIs for now
return;
}
......
......@@ -871,6 +871,7 @@ void amf_n2::handle_itti_message(itti_initial_context_setup_request& itti_msg) {
}
msg->setAllowedNssai(list);
// TODO: get from ue_security_capability@NAS Context
msg->setUESecurityCapability(
0xe000, 0xe000, 0x0000,
0x0000); // TODO: remove hardcoded value
......@@ -1340,20 +1341,21 @@ void amf_n2::handle_itti_message(itti_ue_context_release_complete& itti_msg) {
}
std::shared_ptr<gnb_context> gc = {};
if (!assoc_id_2_gnb_context(itti_msg.assoc_id, gc)) {
Logger::amf_n2().error(
"gNB with assoc_id (%d) is illegal", itti_msg.assoc_id);
return;
}
if (!assoc_id_2_gnb_context(itti_msg.assoc_id, gc)) {
Logger::amf_n2().error(
"gNB with assoc_id (%d) is illegal", itti_msg.assoc_id);
return;
}
//verify release cause -> if HandoverSuccessful no further operations required
if(unc->release_cause == Ngap_CauseRadioNetwork_successful_handover && gc->gnb_id == unc->release_gnb){
// verify release cause -> if HandoverSuccessful no further operations
// required
if (unc->release_cause == Ngap_CauseRadioNetwork_successful_handover &&
gc->gnb_id == unc->release_gnb) {
remove_ran_ue_ngap_id_2_ngap_context(ran_ue_ngap_id, gc->gnb_id);
unc->release_cause = 0;
return;
}
// Change UE status from CM-CONNECTED to CM-IDLE
std::shared_ptr<nas_context> nc = {};
if (!amf_n1_inst->amf_ue_id_2_nas_context(amf_ue_ngap_id, nc)) {
......@@ -2085,7 +2087,7 @@ void amf_n2::handle_itti_message(itti_handover_notify& itti_msg) {
return;
}
//update the NGAP Context
// update the NGAP Context
unc->release_cause = Ngap_CauseRadioNetwork_successful_handover;
unc->release_gnb = uc->gnb_id;
unc->ran_ue_ngap_id = ran_ue_ngap_id; // store new RAN ID
......@@ -2093,12 +2095,12 @@ void amf_n2::handle_itti_message(itti_handover_notify& itti_msg) {
unc->ng_ue_state = NGAP_UE_CONNECTED;
unc->gnb_assoc_id = itti_msg.assoc_id; // update serving gNB
//update NAS Context
// update NAS Context
nc->ran_ue_ngap_id = ran_ue_ngap_id;
//update User Context
// update User Context
uc->ran_ue_ngap_id = ran_ue_ngap_id;
uc->gnb_id = gc->gnb_id;
uc->gnb_id = gc->gnb_id;
set_ran_ue_ngap_id_2_ue_ngap_context(ran_ue_ngap_id, gc->gnb_id, unc);
}
......
......@@ -987,7 +987,7 @@ bool amf_sbi::send_ue_authentication_request(
url, "POST", body, response_data, response_code, http_version);
Logger::amf_sbi().debug(
"UE Authentication, response from AUSF, HTTP Code: %d", response_code);
"UE Authentication, response from AUSF, HTTP Code: %lu", response_code);
if ((static_cast<http_response_codes_e>(response_code) ==
http_response_codes_e::HTTP_RESPONSE_CODE_200_OK) or
......@@ -1113,7 +1113,7 @@ void amf_sbi::curl_http_client(
bstring n1sm_hex = nullptr;
bstring n2sm_hex = nullptr;
Logger::amf_sbi().info("Get response with HTTP code (%d)", httpCode);
Logger::amf_sbi().info("Get response with HTTP code (%ld)", httpCode);
Logger::amf_sbi().info("Response body %s", response.c_str());
if (static_cast<http_response_codes_e>(httpCode) ==
......@@ -1404,7 +1404,7 @@ void amf_sbi::curl_http_client(
n2sm_msg = {};
json_data = {};
Logger::amf_sbi().info("Get response with HTTP code (%d)", httpCode);
Logger::amf_sbi().info("Get response with HTTP code (%ld)", httpCode);
Logger::amf_sbi().info("Response body %s", response.c_str());
response_code = httpCode;
......@@ -1542,7 +1542,7 @@ void amf_sbi::curl_http_client(
std::string response = *httpData.get();
std::string resMsg = {};
bool is_response_ok = true;
Logger::amf_sbi().info("Get response with HTTP code (%d)", httpCode);
Logger::amf_sbi().info("Get response with HTTP code (%ld)", httpCode);
response_code = httpCode;
......
......@@ -22,6 +22,8 @@
#ifndef FILE_3GPP_24_501_SEEN
#define FILE_3GPP_24_501_SEEN
#define T3502_TIMER_DEFAULT_VALUE_MIN 12 // 12 minutes
// Table 10.3.1 @3GPP TS 24.501 V16.1.0 (2019-06)
#define T3512_TIMER_VALUE_SEC 3240 // 54 minutes
#define T3512_TIMER_VALUE_MIN 54 // 54 minutes
......
......@@ -80,4 +80,7 @@ constexpr uint32_t DEFAULT_HTTP2_PORT = 8080;
constexpr auto DEFAULT_SBI_API_VERSION = "v1";
constexpr auto DEFAULT_SUPI_TYPE =
"imsi"; // Set to "imsi" when supporting both IMSI and NAI as SUPI
constexpr auto DEFAULT_SST = 1;
constexpr auto DEFAULT_DNN = "default";
#endif
......@@ -303,23 +303,20 @@ bool conv::octet_string_2_bit_string(
//------------------------------------------------------------------------------
bool conv::bstring_2_bit_string(const bstring& b_str, BIT_STRING_t& bit_str) {
int size = blength(b_str);
if (!b_str or size <= 0) return false;
if (!bdata(b_str)) return false;
int size = blength(b_str);
if (!b_str or size <= 0) return false;
if (!bdata(b_str)) return false;
bit_str.buf = (uint8_t*) calloc(size + 1, sizeof(uint8_t));
if (!bit_str.buf) return false;
bit_str.buf = (uint8_t*) calloc(size + 1, sizeof(uint8_t));
if (!bit_str.buf) return false;
if (check_bstring (b_str)) memcpy((void*) bit_str.buf, (char*)b_str->data,
blength(b_str));
((uint8_t*) bit_str.buf)[size] = '\0';
bit_str.size = size;
if (check_bstring(b_str))
memcpy((void*) bit_str.buf, (char*) b_str->data, blength(b_str));
((uint8_t*) bit_str.buf)[size] = '\0';
bit_str.size = size;
bit_str.bits_unused = 0;
bit_str.bits_unused = 0;
return true;
}
//------------------------------------------------------------------------------
......
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