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