Commit c768dba0 authored by Tien-Thinh Nguyen's avatar Tien-Thinh Nguyen

Process PDUSessionResourceReleaseResponse

parent 5ec0e13d
......@@ -197,7 +197,8 @@ void amf_n11::handle_itti_message(
Logger::amf_n11().debug("SMF URI: %s", remote_uri.c_str());
nlohmann::json pdu_session_update_request = { };
pdu_session_update_request["n2SmInfoType"] = "PDU_RES_SETUP_RSP";
//if (itti_msg.is_n2sm_set){
pdu_session_update_request["n2SmInfoType"] = itti_msg.n2sm_info_type;
pdu_session_update_request["n2SmInfo"]["contentId"] = "n2msg";
std::string json_part = pdu_session_update_request.dump();
std::string n2SmMsg;
......@@ -586,7 +587,8 @@ void amf_n11::curl_http_client(std::string remoteUri, std::string jsonData,
itti_msg->n1sm = n1sm_hex;
itti_msg->is_n1sm_set = true;
} else if (n2sm.size() > 0) {
}
if (n2sm.size() > 0) {
msg_str_2_msg_hex(n2sm, n2sm_hex);
print_buffer("amf_n11", "Get response n1sm:",
(uint8_t*) bdata(n2sm_hex), blength(n2sm_hex));
......
......@@ -21,7 +21,7 @@
/*! \file amf_n2.hpp
\brief
\author Keliang DU, BUPT
\author Keliang DU (BUPT), Tien-Thinh NGUYEN (EURECOM)
\date 2020
\email: contact@openairinterface.org
*/
......
......@@ -69,15 +69,24 @@ class itti_nsmf_pdusession_update_sm_context : public itti_msg_n11 {
const task_id_t destination)
:
itti_msg_n11(NSMF_PDU_SESSION_UPDATE_SM_CTX, origin, destination) {
is_n2sm_set = false;
}
itti_nsmf_pdusession_update_sm_context(
const itti_nsmf_pdusession_update_sm_context &i)
:
itti_msg_n11(i) {
pdu_session_id = i.pdu_session_id;
n2sm = i.n2sm;
is_n2sm_set = i.is_n2sm_set;
n2sm_info_type = i.n2sm_info_type;
}
public:
uint8_t pdu_session_id;
bstring n2sm;
bool is_n2sm_set;
std::string n2sm_info_type;
};
#endif
......@@ -108,6 +108,13 @@ typedef struct {
OCTET_STRING_t pduSessionResourceReleaseCommandTransfer;
} PDUSessionResourceToReleaseItem_t;
//PDU Session Resource Release Item (3GPP TS 38.413 V16.0.0 (2019-12))
typedef struct {
uint8_t pduSessionId;
OCTET_STRING_t pduSessionResourceReleaseResponseTransfer;
} PDUSessionResourceReleasedItem_t;
typedef struct {
std::string ip_address;
uint32_t gtp_teid;
......
/*
* 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
*/
/*! \file
\brief
\author Keliang DU (BUPT), Tien-Thinh NGUYEN (EURECOM)
\date 2020
\email: contact@openairinterface.org
*/
#include "PDUSessionResourceReleasedItemRelRes.hpp"
namespace ngap {
//------------------------------------------------------------------------------
PDUSessionResourceReleasedItemRelRes::PDUSessionResourceReleasedItemRelRes() {
pDUSessionID = NULL;
}
//------------------------------------------------------------------------------
PDUSessionResourceReleasedItemRelRes::~PDUSessionResourceReleasedItemRelRes() {
}
//------------------------------------------------------------------------------
void PDUSessionResourceReleasedItemRelRes::setPDUSessionResourceReleasedItemRelRes(
PDUSessionID *m_pDUSessionID,
OCTET_STRING_t m_pDUSessionResourceReleaseResponseTransfer) {
pDUSessionID = m_pDUSessionID;
pDUSessionResourceReleaseResponseTransfer =
m_pDUSessionResourceReleaseResponseTransfer;
}
//------------------------------------------------------------------------------
void PDUSessionResourceReleasedItemRelRes::getPDUSessionResourceReleasedItemRelRes(
PDUSessionID *&m_pDUSessionID,
OCTET_STRING_t &m_pDUSessionResourceReleaseResponseTransfer) {
m_pDUSessionID = pDUSessionID;
m_pDUSessionResourceReleaseResponseTransfer = pDUSessionResourceReleaseResponseTransfer;
}
//------------------------------------------------------------------------------
bool PDUSessionResourceReleasedItemRelRes::encode2PDUSessionResourceReleasedItemRelRes(
Ngap_PDUSessionResourceReleasedItemRelRes_t *pduSessionResourceReleasedItemRelRes) {
if (!pDUSessionID->encode2PDUSessionID(
pduSessionResourceReleasedItemRelRes->pDUSessionID))
return false;
pduSessionResourceReleasedItemRelRes
->pDUSessionResourceReleaseResponseTransfer =
pDUSessionResourceReleaseResponseTransfer;
return true;
}
//------------------------------------------------------------------------------
bool PDUSessionResourceReleasedItemRelRes::decodefromPDUSessionResourceReleasedItemRelRes(
Ngap_PDUSessionResourceReleasedItemRelRes_t *pduSessionResourceReleasedItemRelRes) {
pDUSessionID = new PDUSessionID();
pDUSessionResourceReleaseResponseTransfer =
pduSessionResourceReleasedItemRelRes
->pDUSessionResourceReleaseResponseTransfer;
return true;
}
}
/*
* 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
*/
/*! \file
\brief
\author Keliang DU (BUPT), Tien-Thinh NGUYEN (EURECOM)
\date 2020
\email: contact@openairinterface.org
*/
#ifndef _PDU_SESSION_RESOURCE_RELEASED_ITEM_REL_RES_H_
#define _PDU_SESSION_RESOURCE_RELEASED_ITEM_REL_RES_H_
#include "PDUSessionID.hpp"
extern "C" {
#include "Ngap_PDUSessionResourceReleasedItemRelRes.h"
}
namespace ngap {
class PDUSessionResourceReleasedItemRelRes {
public:
PDUSessionResourceReleasedItemRelRes();
virtual ~PDUSessionResourceReleasedItemRelRes();
void setPDUSessionResourceReleasedItemRelRes(
PDUSessionID *m_pDUSessionID,
OCTET_STRING_t m_pDUSessionResourceReleaseResponseTransfer);
void getPDUSessionResourceReleasedItemRelRes(
PDUSessionID *&m_pDUSessionID,
OCTET_STRING_t &m_pDUSessionResourceReleaseResponseTransfer);
bool encode2PDUSessionResourceReleasedItemRelRes(
Ngap_PDUSessionResourceReleasedItemRelRes_t *pduSessionResourceReleasedItemRelRes);
bool decodefromPDUSessionResourceReleasedItemRelRes(
Ngap_PDUSessionResourceReleasedItemRelRes_t *pduSessionResourceReleasedItemRelRes);
private:
PDUSessionID *pDUSessionID;
OCTET_STRING_t pDUSessionResourceReleaseResponseTransfer;
// ProtocolExtensionContainer (OPTIONAL)
};
}
#endif
/*
* 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
*/
/*! \file
\brief
\author Keliang DU (BUPT), Tien-Thinh NGUYEN (EURECOM)
\date 2020
\email: contact@openairinterface.org
*/
#include "PDUSessionResourceReleasedListRelRes.hpp"
namespace ngap {
//------------------------------------------------------------------------------
PDUSessionResourceReleasedListRelRes::PDUSessionResourceReleasedListRelRes() {
pduSessionResourceReleasedItemRelRes = NULL;
maxnoofPDUSessions = 0;
}
//------------------------------------------------------------------------------
PDUSessionResourceReleasedListRelRes::~PDUSessionResourceReleasedListRelRes() {
}
//------------------------------------------------------------------------------
void PDUSessionResourceReleasedListRelRes::setPDUSessionResourceReleasedListRelRes(
PDUSessionResourceReleasedItemRelRes *m_pduSessionResourceReleasedItemRelRes,
int num) {
pduSessionResourceReleasedItemRelRes =
m_pduSessionResourceReleasedItemRelRes;
maxnoofPDUSessions = num;
}
//------------------------------------------------------------------------------
void PDUSessionResourceReleasedListRelRes::getPDUSessionResourceReleasedListRelRes(
PDUSessionResourceReleasedItemRelRes *&m_pduSessionResourceReleasedItemRelRes,
int &num) {
m_pduSessionResourceReleasedItemRelRes =
pduSessionResourceReleasedItemRelRes;
num = maxnoofPDUSessions;
}
//------------------------------------------------------------------------------
bool PDUSessionResourceReleasedListRelRes::encode2PDUSessionResourceReleasedListRelRes(
Ngap_PDUSessionResourceReleasedListRelRes_t *pduSessionResourceReleasedListRelRes) {
for (int i = 0; i < maxnoofPDUSessions; i++) {
Ngap_PDUSessionResourceReleasedItemRelRes_t *rel =
(Ngap_PDUSessionResourceReleasedItemRelRes_t*) calloc(
1, sizeof(Ngap_PDUSessionResourceReleasedItemRelRes_t));
if (!rel)
return false;
if (!pduSessionResourceReleasedItemRelRes[i]
.encode2PDUSessionResourceReleasedItemRelRes(rel))
return false;
if (ASN_SEQUENCE_ADD(&pduSessionResourceReleasedListRelRes->list, rel)
!= 0)
return false;
}
return true;
}
//------------------------------------------------------------------------------
bool PDUSessionResourceReleasedListRelRes::decodefromPDUSessionResourceReleasedListRelRes(
Ngap_PDUSessionResourceReleasedListRelRes_t *pduSessionResourceReleasedListRelRes) {
maxnoofPDUSessions = pduSessionResourceReleasedListRelRes->list.count;
pduSessionResourceReleasedItemRelRes =
new PDUSessionResourceReleasedItemRelRes[maxnoofPDUSessions]();
for (int i = 0; i < maxnoofPDUSessions; i++) {
if (!pduSessionResourceReleasedItemRelRes[i]
.decodefromPDUSessionResourceReleasedItemRelRes(
pduSessionResourceReleasedListRelRes->list.array[i]))
return false;
}
return true;
}
}
/*
* 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
*/
/*! \file
\brief
\author Keliang DU (BUPT), Tien-Thinh NGUYEN (EURECOM)
\date 2020
\email: contact@openairinterface.org
*/
#ifndef _PDU_SESSION_RESOURCE_RELEASED_LIST_REL_RES_H_
#define _PDU_SESSION_RESOURCE_RELEASED_LIST_REL_RES_H_
#include "PDUSessionResourceReleasedItemRelRes.hpp"
extern "C" {
#include "Ngap_PDUSessionResourceReleasedItemRelRes.h"
#include "Ngap_PDUSessionResourceReleasedListRelRes.h"
}
namespace ngap {
class PDUSessionResourceReleasedListRelRes {
public:
PDUSessionResourceReleasedListRelRes();
virtual ~PDUSessionResourceReleasedListRelRes();
void setPDUSessionResourceReleasedListRelRes(
PDUSessionResourceReleasedItemRelRes *m_pduSessionResourceReleasedItemRelRes,
int num);
void getPDUSessionResourceReleasedListRelRes(
PDUSessionResourceReleasedItemRelRes *&m_pduSessionResourceReleasedItemRelRes,
int &num);
bool encode2PDUSessionResourceReleasedListRelRes(
Ngap_PDUSessionResourceReleasedListRelRes_t *pduSessionResourceReleasedListRelRes);
bool decodefromPDUSessionResourceReleasedListRelRes(
Ngap_PDUSessionResourceReleasedListRelRes_t *pduSessionResourceReleasedListRelRes);
private:
PDUSessionResourceReleasedItemRelRes *pduSessionResourceReleasedItemRelRes;
int maxnoofPDUSessions;
};
}
#endif
......@@ -53,8 +53,7 @@ void PDUSessionResourceToReleaseItemRelCmd::getPDUSessionResourceToReleaseItemRe
PDUSessionID *&m_pDUSessionID,
OCTET_STRING_t &m_pDUSessionResourceReleaseCommandTransfer) {
m_pDUSessionID = pDUSessionID;
pDUSessionResourceReleaseCommandTransfer =
m_pDUSessionResourceReleaseCommandTransfer;
m_pDUSessionResourceReleaseCommandTransfer = pDUSessionResourceReleaseCommandTransfer;
}
//------------------------------------------------------------------------------
......
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
*/
/*! \file
\brief
\author Keliang DU (BUPT), Tien-Thinh NGUYEN (EURECOM)
\date 2020
\email: contact@openairinterface.org
*/
#ifndef _PDU_SESSION_RESOURCE_RELEASE_RESPONSE_H_
#define _PDU_SESSION_RESOURCE_RELEASE_RESPONSE_H_
#include "NgapIEsStruct.hpp"
#include "MessageType.hpp"
#include "AMF-UE-NGAP-ID.hpp"
#include "RAN-UE-NGAP-ID.hpp"
#include "UserLocationInformation.hpp"
#include "CriticalityDiagnostics.hpp"
#include "PDUSessionResourceReleasedListRelRes.hpp"
extern "C" {
#include "Ngap_NGAP-PDU.h"
#include "Ngap_ProtocolIE-Field.h"
}
namespace ngap {
class PduSessionResourceReleaseResponseMsg {
public:
PduSessionResourceReleaseResponseMsg();
virtual ~PduSessionResourceReleaseResponseMsg();
void setMessageType();
void setAmfUeNgapId(unsigned long id); //40 bits
void setRanUeNgapId(uint32_t id); // 32 bits
void setPduSessionResourceReleasedList(
std::vector<PDUSessionResourceReleasedItem_t> list);
void setUserLocationInfoNR(struct NrCgi_s cig, struct Tai_s tai);
unsigned long getAmfUeNgapId();
uint32_t getRanUeNgapId();
bool getPduSessionResourceReleasedList(
std::vector<PDUSessionResourceReleasedItem_t> &list);
bool getUserLocationInfoNR(struct NrCgi_s &cig, struct Tai_s &tai);
int encode2buffer(uint8_t *buf, int buf_size);
void encode2buffer_new(char *buf, int &encoded_size);
bool decodefrompdu(Ngap_NGAP_PDU_t *ngap_msg_pdu);
private:
Ngap_NGAP_PDU_t *pduSessionResourceReleaseResponsePdu;
Ngap_PDUSessionResourceReleaseResponse_t *pduSessionResourceReleaseResponseIEs; //store list of IEs
//section 9.2.1.4 PDU Session Resource Release Response (3GPP TS 38.413 V16.0.0 (2019-12))
AMF_UE_NGAP_ID *amfUeNgapId;
RAN_UE_NGAP_ID *ranUeNgapId;
PDUSessionResourceReleasedListRelRes *pduSessionResourceReleasedList;
UserLocationInformation *userLocationInformation;
//CriticalityDiagnostics *criticalityDiagnostics;
};
}
#endif
......@@ -36,6 +36,7 @@
#include "itti.hpp"
#include "NGSetupRequest.hpp"
#include "PduSessionResourceSetupResponse.hpp"
#include "PduSessionResourceReleaseResponse.hpp"
#include "InitialContextSetupResponse.hpp"
using namespace sctp;
......@@ -141,6 +142,7 @@ int ngap_amf_handle_initial_context_setup_response(
"Decode PduSessionResourceSetupResponseList IE error or this IE is not available");
return 0;
}
uint8_t transferIe[500];
memcpy(transferIe, list[0].pduSessionResourceSetupResponseTransfer.buf,
list[0].pduSessionResourceSetupResponseTransfer.size);
......@@ -153,6 +155,8 @@ int ngap_amf_handle_initial_context_setup_response(
new itti_nsmf_pdusession_update_sm_context(TASK_NGAP, TASK_AMF_N11);
itti_msg->pdu_session_id = list[0].pduSessionId;
itti_msg->n2sm = n2sm;
itti_msg->is_n2sm_set = true;
itti_msg->n2sm_info_type = "PDU_RES_SETUP_RSP";
std::shared_ptr<itti_nsmf_pdusession_update_sm_context> i = std::shared_ptr
< itti_nsmf_pdusession_update_sm_context > (itti_msg);
int ret = itti_inst->send_msg(i);
......@@ -232,6 +236,55 @@ int ngap_amf_handle_ue_context_release_complete(
return 0;
}
int ngap_amf_handle_pdu_session_resource_release_response(
const sctp_assoc_id_t assoc_id, const sctp_stream_id_t stream,
struct Ngap_NGAP_PDU *message_p){
Logger::ngap().debug("Handle PDU Session Resource Setup Release Response");
PduSessionResourceReleaseResponseMsg *pduresp =
new PduSessionResourceReleaseResponseMsg();
if (!pduresp->decodefrompdu(message_p)) {
Logger::ngap().error(
"Decoding PduSessionResourceReleaseResponseMsg message error");
return -1;
}
//TODO: process User Location Information if this IE is available
//Transfer pduSessionResourceReleaseResponseTransfer to SMF
std::vector<PDUSessionResourceReleasedItem_t> list;
if (!pduresp->getPduSessionResourceReleasedList(list)) {
Logger::ngap().error(
"Decoding PduSessionResourceReleaseResponseMsg getPduSessionResourceReleasedList IE error");
return -1;
}
//TODO: add the full list
uint8_t transferIe[500];
memcpy(transferIe, list[0].pduSessionResourceReleaseResponseTransfer.buf,
list[0].pduSessionResourceReleaseResponseTransfer.size);
bstring n2sm = blk2bstr(transferIe,
list[0].pduSessionResourceReleaseResponseTransfer.size);
Logger::ngap().debug(
"Sending itti PDUSessionResourceReleaseResponse to TASK_AMF_N11");
itti_nsmf_pdusession_update_sm_context *itti_msg =
new itti_nsmf_pdusession_update_sm_context(TASK_NGAP, TASK_AMF_N11);
itti_msg->pdu_session_id = list[0].pduSessionId;
itti_msg->n2sm = n2sm;
itti_msg->is_n2sm_set = true;
itti_msg->n2sm_info_type = "PDU_RES_REL_RSP";
std::shared_ptr<itti_nsmf_pdusession_update_sm_context> i = std::shared_ptr
< itti_nsmf_pdusession_update_sm_context > (itti_msg);
int ret = itti_inst->send_msg(i);
if (0 != ret) {
Logger::ngap().error("Could not send ITTI message %s to task TASK_AMF_N11",
i->get_msg_name());
}
return 0;
}
//------------------------------------------------------------------------------
int ngap_amf_handle_pdu_session_resource_setup_response(
const sctp_assoc_id_t assoc_id, const sctp_stream_id_t stream,
......@@ -262,6 +315,9 @@ int ngap_amf_handle_pdu_session_resource_setup_response(
new itti_nsmf_pdusession_update_sm_context(TASK_NGAP, TASK_AMF_N11);
itti_msg->pdu_session_id = list[0].pduSessionId;
itti_msg->n2sm = n2sm;
itti_msg->is_n2sm_set = true;
itti_msg->n2sm_info_type = "PDU_RES_SETUP_RSP";
std::shared_ptr<itti_nsmf_pdusession_update_sm_context> i = std::shared_ptr
< itti_nsmf_pdusession_update_sm_context > (itti_msg);
int ret = itti_inst->send_msg(i);
......@@ -301,7 +357,7 @@ ngap_message_decoded_callback messages_callback[][3] = { { 0, 0, 0 }, /*0 AMFCon
{ 0, 0, 0 }, //{ngap_amf_handle_path_switch_request,0,0}, /*PathSwitchRequest*
{ 0, 0, 0 }, /*PDUSessionResourceModify*/
{ 0, 0, 0 }, /*PDUSessionResourceModifyIndication*/
{ 0, 0, 0 }, /*PDUSessionResourceRelease*/
{ 0, ngap_amf_handle_pdu_session_resource_release_response, 0 }, /*PDUSessionResourceRelease*/
{ 0, ngap_amf_handle_pdu_session_resource_setup_response, 0 }, /*PDUSessionResourceSetup*/
{ 0, 0, 0 }, /*PDUSessionResourceNotify*/
{ 0, 0, 0 }, /*PrivateMessage*/
......
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