Commit 074889ff authored by Stefan Spettel's avatar Stefan Spettel

fix(smf): send PDU session reject when failed before smf procedure

Signed-off-by: default avatarStefan Spettel <stefan.spettel@phine.tech>
parent 9e3948b4
...@@ -1464,9 +1464,6 @@ void smf_context::handle_pdu_session_create_sm_context_request( ...@@ -1464,9 +1464,6 @@ void smf_context::handle_pdu_session_create_sm_context_request(
xgpp_conv::create_sm_context_response_from_ctx_request( xgpp_conv::create_sm_context_response_from_ctx_request(
smreq, sm_context_resp_pending); smreq, sm_context_resp_pending);
// Update AMF ID
set_amf_addr(smreq->req.get_serving_nf_id()); // amf id
// Step 3.2. Create PDU session if not exist // Step 3.2. Create PDU session if not exist
std::shared_ptr<smf_pdu_session> sp = {}; std::shared_ptr<smf_pdu_session> sp = {};
bool find_pdu = find_pdu_session(pdu_session_id, sp); bool find_pdu = find_pdu_session(pdu_session_id, sp);
...@@ -1689,18 +1686,6 @@ void smf_context::handle_pdu_session_create_sm_context_request( ...@@ -1689,18 +1686,6 @@ void smf_context::handle_pdu_session_create_sm_context_request(
} }
} }
// TODO: Step 8. SMF-initiated SM Policy Modification (with PCF)
// Step 9. Create session establishment procedure and run the procedure
// if request is accepted
if (request_accepted) {
if (set_paa) {
sm_context_resp_pending->res.set_paa(paa);
sp->set(paa);
} else {
// TODO:
}
// Store AMF callback URI and subscribe to the status notification: AMF will // Store AMF callback URI and subscribe to the status notification: AMF will
// be notified when SM context changes // be notified when SM context changes
std::string amf_status_uri = smreq->req.get_sm_context_status_uri(); std::string amf_status_uri = smreq->req.get_sm_context_status_uri();
...@@ -1708,10 +1693,9 @@ void smf_context::handle_pdu_session_create_sm_context_request( ...@@ -1708,10 +1693,9 @@ void smf_context::handle_pdu_session_create_sm_context_request(
// Get and Store AMF Addr if available // Get and Store AMF Addr if available
std::vector<std::string> split_result; std::vector<std::string> split_result;
std::string amf_addr_str = {}; std::string amf_addr_str = conv::toString(smf_cfg.amf_addr.ipv4_addr)
amf_addr_str = std::string(inet_ntoa( .append(":")
*((struct in_addr*) &smf_cfg.amf_addr.ipv4_addr))) + .append(std::to_string(smf_cfg.amf_addr.port));
":" + std::to_string(smf_cfg.amf_addr.port);
boost::split(split_result, amf_status_uri, boost::is_any_of("/")); boost::split(split_result, amf_status_uri, boost::is_any_of("/"));
if (split_result.size() >= 3) { if (split_result.size() >= 3) {
...@@ -1726,7 +1710,7 @@ void smf_context::handle_pdu_session_create_sm_context_request( ...@@ -1726,7 +1710,7 @@ void smf_context::handle_pdu_session_create_sm_context_request(
addr = full_addr; addr = full_addr;
} }
struct in_addr amf_ipv4_addr; struct in_addr amf_ipv4_addr;
if (inet_aton(util::trim(addr).c_str(), &amf_ipv4_addr) == 0) { if (inet_pton(AF_INET, util::trim(addr).c_str(), &amf_ipv4_addr) == 0) {
Logger::smf_api_server().warn("Bad IPv4 for AMF"); Logger::smf_api_server().warn("Bad IPv4 for AMF");
} else { } else {
amf_addr_str = full_addr; amf_addr_str = full_addr;
...@@ -1736,6 +1720,18 @@ void smf_context::handle_pdu_session_create_sm_context_request( ...@@ -1736,6 +1720,18 @@ void smf_context::handle_pdu_session_create_sm_context_request(
set_amf_addr(amf_addr_str); set_amf_addr(amf_addr_str);
// TODO: Step 8. SMF-initiated SM Policy Modification (with PCF)
// Step 9. Create session establishment procedure and run the procedure
// if request is accepted
if (request_accepted) {
if (set_paa) {
sm_context_resp_pending->res.set_paa(paa);
sp->set(paa);
} else {
// TODO:
}
// Trigger SMF APP to send response to SMF-HTTP-API-SERVER (Step // Trigger SMF APP to send response to SMF-HTTP-API-SERVER (Step
// 5, 4.3.2.2.1 TS 23.502) // 5, 4.3.2.2.1 TS 23.502)
Logger::smf_app().debug( Logger::smf_app().debug(
...@@ -1746,7 +1742,7 @@ void smf_context::handle_pdu_session_create_sm_context_request( ...@@ -1746,7 +1742,7 @@ void smf_context::handle_pdu_session_create_sm_context_request(
// according to the structure: // according to the structure:
// {apiRoot}/nsmf-pdusession/{apiVersion}/sm-contexts/{smContextRef} // {apiRoot}/nsmf-pdusession/{apiVersion}/sm-contexts/{smContextRef}
std::string smf_context_uri = std::string smf_context_uri =
smreq->req.get_api_root() + "/" + smContextRef.c_str(); smreq->req.get_api_root() + "/" + smContextRef;
sm_context_response.set_smf_context_uri(smf_context_uri); sm_context_response.set_smf_context_uri(smf_context_uri);
sm_context_response.set_cause(static_cast<uint8_t>( sm_context_response.set_cause(static_cast<uint8_t>(
cause_value_5gsm_e::CAUSE_255_REQUEST_ACCEPTED)); // TODO cause_value_5gsm_e::CAUSE_255_REQUEST_ACCEPTED)); // TODO
...@@ -1816,6 +1812,16 @@ void smf_context::handle_pdu_session_create_sm_context_request( ...@@ -1816,6 +1812,16 @@ void smf_context::handle_pdu_session_create_sm_context_request(
// clear the created context?? // clear the created context??
// TODO: // TODO:
// Send HTTP reply to PDU Session Establishment Request
// TODO Stefan: I believe this is not standard-compliant, we should just
// send an error code here (see 29.502 Table 6.1.3.2.3.1-3)
pdu_session_create_sm_context_response sm_context_response = {};
sm_context_response.set_http_code(
http_status_code_e::HTTP_STATUS_CODE_201_CREATED);
smf_app_inst->trigger_session_create_sm_context_response(
sm_context_response, smreq->pid);
// Create PDU Session Establishment Reject and embedded in // Create PDU Session Establishment Reject and embedded in
// Namf_Communication_N1N2MessageTransfer Request // Namf_Communication_N1N2MessageTransfer Request
Logger::smf_app().debug("Create PDU Session Establishment Reject"); Logger::smf_app().debug("Create PDU Session Establishment Reject");
......
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