Commit 330fc086 authored by Tien Thinh NGUYEN's avatar Tien Thinh NGUYEN

Add PDUSessionResourceListCxtRelCpl in UEContextReleaseComplete Msg

parent c00a73a9
......@@ -1359,7 +1359,7 @@ void amf_n2::handle_itti_message(itti_ue_context_release_complete& itti_msg) {
uint32_t ran_ue_ngap_id = itti_msg.ueCtxRelCmpl->getRanUeNgapId();
// 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->is_amf_ue_id_2_nas_context(amf_ue_ngap_id))
nc = amf_n1_inst->amf_ue_id_2_nas_context(amf_ue_ngap_id);
else {
......
......@@ -146,6 +146,10 @@ typedef struct {
OCTET_STRING_t pduSessionResourceReleaseResponseTransfer;
} PDUSessionResourceReleasedItem_t;
typedef struct {
uint8_t pduSessionId;
} PDUSessionResourceCxtRelCplItem_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
*/
#include "PDUSessionResourceItemCxtRelCpl.hpp"
namespace ngap {
//------------------------------------------------------------------------------
PDUSessionResourceItemCxtRelCpl::PDUSessionResourceItemCxtRelCpl() {}
//------------------------------------------------------------------------------
PDUSessionResourceItemCxtRelCpl::~PDUSessionResourceItemCxtRelCpl() {}
//------------------------------------------------------------------------------
void PDUSessionResourceItemCxtRelCpl::setPDUSessionResourceItemCxtRelCpl(
const PDUSessionID& m_pDUSessionID) {
pDUSessionID = m_pDUSessionID;
}
//------------------------------------------------------------------------------
void PDUSessionResourceItemCxtRelCpl::getPDUSessionResourceItemCxtRelCpl(
PDUSessionID& m_pDUSessionID) {
m_pDUSessionID = pDUSessionID;
}
//------------------------------------------------------------------------------
bool PDUSessionResourceItemCxtRelCpl::encode2PDUSessionResourceItemCxtRelCpl(
Ngap_PDUSessionResourceItemCxtRelCpl_t* pduSessionResourceItemCxtRelCpl) {
if (!pDUSessionID.encode2PDUSessionID(
pduSessionResourceItemCxtRelCpl->pDUSessionID))
return false;
return true;
}
//------------------------------------------------------------------------------
bool PDUSessionResourceItemCxtRelCpl::decodefromPDUSessionResourceItemCxtRelCpl(
Ngap_PDUSessionResourceItemCxtRelCpl_t* pduSessionResourceItemCxtRelCpl) {
pDUSessionID.setPDUSessionID(pduSessionResourceItemCxtRelCpl->pDUSessionID);
return true;
}
} // namespace ngap
/*
* 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 _PDU_SESSION_RESOURCE_ITEM_REL_CPL_H_
#define _PDU_SESSION_RESOURCE_ITEM_REL_CPL_H_
#include "PDUSessionID.hpp"
extern "C" {
#include "Ngap_PDUSessionResourceItemCxtRelCpl.h"
}
namespace ngap {
class PDUSessionResourceItemCxtRelCpl {
public:
PDUSessionResourceItemCxtRelCpl();
virtual ~PDUSessionResourceItemCxtRelCpl();
void setPDUSessionResourceItemCxtRelCpl(const PDUSessionID& m_pDUSessionID);
void getPDUSessionResourceItemCxtRelCpl(PDUSessionID& m_pDUSessionID);
bool encode2PDUSessionResourceItemCxtRelCpl(
Ngap_PDUSessionResourceItemCxtRelCpl_t* pduSessionResourceItemCxtRelCpl);
bool decodefromPDUSessionResourceItemCxtRelCpl(
Ngap_PDUSessionResourceItemCxtRelCpl_t* pduSessionResourceItemCxtRelCpl);
private:
PDUSessionID pDUSessionID;
// OCTET_STRING_t pDUSessionResourceReleaseResponseTransfer;
};
} // namespace ngap
#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
*/
#include "PDUSessionResourceListCxtRelCpl.hpp"
namespace ngap {
//------------------------------------------------------------------------------
PDUSessionResourceListCxtRelCpl::PDUSessionResourceListCxtRelCpl() {}
//------------------------------------------------------------------------------
PDUSessionResourceListCxtRelCpl::~PDUSessionResourceListCxtRelCpl() {}
//------------------------------------------------------------------------------
void PDUSessionResourceListCxtRelCpl::setPDUSessionResourceListCxtRelCpl(
const std::vector<PDUSessionResourceItemCxtRelCpl>& list) {
cxtRelCplList = list;
}
//------------------------------------------------------------------------------
void PDUSessionResourceListCxtRelCpl::getPDUSessionResourceListCxtRelCpl(
std::vector<PDUSessionResourceItemCxtRelCpl>& list) {
list = cxtRelCplList;
}
//------------------------------------------------------------------------------
bool PDUSessionResourceListCxtRelCpl::encode2PDUSessionResourceListCxtRelCpl(
Ngap_PDUSessionResourceListCxtRelCpl_t* pduSessionResourceListCxtRelCpl) {
for (auto& cxtRelCpl : cxtRelCplList) {
Ngap_PDUSessionResourceItemCxtRelCpl_t* item =
(Ngap_PDUSessionResourceItemCxtRelCpl_t*) calloc(
1, sizeof(Ngap_PDUSessionResourceItemCxtRelCpl_t));
if (!item) return false;
if (!cxtRelCpl.encode2PDUSessionResourceItemCxtRelCpl(item)) return false;
if (ASN_SEQUENCE_ADD(&pduSessionResourceListCxtRelCpl->list, item) != 0)
return false;
}
return true;
}
//------------------------------------------------------------------------------
bool PDUSessionResourceListCxtRelCpl::decodefromPDUSessionResourceListCxtRelCpl(
const Ngap_PDUSessionResourceListCxtRelCpl_t&
pduSessionResourceListCxtRelCpl) {
for (int i = 0; i < pduSessionResourceListCxtRelCpl.list.count; i++) {
PDUSessionResourceItemCxtRelCpl item = {};
if (!item.decodefromPDUSessionResourceItemCxtRelCpl(
pduSessionResourceListCxtRelCpl.list.array[i]))
return false;
cxtRelCplList.push_back(item);
}
return true;
}
} // namespace ngap
/*
* 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 _PDU_SESSION_RESOURCE_LIST_CXT_REL_CPL_H_
#define _PDU_SESSION_RESOURCE_LIST_CXT_REL_CPL_H_
#include "PDUSessionResourceItemCxtRelCpl.hpp"
#include <vector>
extern "C" {
#include "Ngap_PDUSessionResourceItemCxtRelCpl.h"
#include "Ngap_PDUSessionResourceListCxtRelCpl.h"
}
namespace ngap {
class PDUSessionResourceListCxtRelCpl {
public:
PDUSessionResourceListCxtRelCpl();
virtual ~PDUSessionResourceListCxtRelCpl();
void setPDUSessionResourceListCxtRelCpl(
const std::vector<PDUSessionResourceItemCxtRelCpl>& list);
void getPDUSessionResourceListCxtRelCpl(
std::vector<PDUSessionResourceItemCxtRelCpl>& list);
bool encode2PDUSessionResourceListCxtRelCpl(
Ngap_PDUSessionResourceListCxtRelCpl_t* pduSessionResourceListCxtRelCpl);
bool decodefromPDUSessionResourceListCxtRelCpl(
const Ngap_PDUSessionResourceListCxtRelCpl_t&
pduSessionResourceListCxtRelCpl);
private:
std::vector<PDUSessionResourceItemCxtRelCpl> cxtRelCplList;
};
} // namespace ngap
#endif
......@@ -149,6 +149,66 @@ void UEContextReleaseCompleteMsg::getUserLocationInfoNR(
}
}
//------------------------------------------------------------------------------
void UEContextReleaseCompleteMsg::setPduSessionResourceCxtRelCplList(
const std::vector<PDUSessionResourceCxtRelCplItem_t>& list) {
std::vector<PDUSessionResourceItemCxtRelCpl> cxtRelCplList;
for (int i = 0; i < list.size(); i++) {
PDUSessionResourceItemCxtRelCpl item = {};
PDUSessionID pDUSessionID = {};
pDUSessionID.setPDUSessionID(list[i].pduSessionId);
item.setPDUSessionResourceItemCxtRelCpl(pDUSessionID);
cxtRelCplList.push_back(item);
}
pduSessionResourceListCxtRelCpl->setPDUSessionResourceListCxtRelCpl(
cxtRelCplList);
Ngap_UEContextReleaseComplete_IEs* ie =
(Ngap_UEContextReleaseComplete_IEs*) calloc(
1, sizeof(Ngap_UEContextReleaseComplete_IEs));
ie->id = Ngap_ProtocolIE_ID_id_PDUSessionResourceListCxtRelCpl;
ie->criticality = Ngap_Criticality_reject;
ie->value.present =
Ngap_UEContextReleaseComplete_IEs__value_PR_PDUSessionResourceListCxtRelCpl;
int ret =
pduSessionResourceListCxtRelCpl->encode2PDUSessionResourceListCxtRelCpl(
&ie->value.choice.PDUSessionResourceListCxtRelCpl);
if (!ret) {
Logger::ngap().error(
"Encode NGAP PDUSessionResourceReleasedListRelRes IE error");
free_wrapper((void**) &ie);
return;
}
ret = ASN_SEQUENCE_ADD(&ies->protocolIEs.list, ie);
if (ret != 0)
Logger::ngap().error(
"Encode NGAP PDUSessionResourceReleasedListRelRes IE error");
}
//------------------------------------------------------------------------------
bool UEContextReleaseCompleteMsg::getPduSessionResourceCxtRelCplList(
std::vector<PDUSessionResourceCxtRelCplItem_t>& list) {
std::vector<PDUSessionResourceItemCxtRelCpl> cxtRelCplList;
pduSessionResourceListCxtRelCpl->getPDUSessionResourceListCxtRelCpl(
cxtRelCplList);
for (auto& item : cxtRelCplList) {
PDUSessionResourceCxtRelCplItem_t rel = {};
PDUSessionID pDUSessionID = {};
item.getPDUSessionResourceItemCxtRelCpl(pDUSessionID);
pDUSessionID.getPDUSessionID(rel.pduSessionId);
list.push_back(rel);
}
return true;
}
//------------------------------------------------------------------------------
bool UEContextReleaseCompleteMsg::decodeFromPdu(Ngap_NGAP_PDU_t* ngapMsgPdu) {
ngapPdu = ngapMsgPdu;
......@@ -208,7 +268,28 @@ bool UEContextReleaseCompleteMsg::decodeFromPdu(Ngap_NGAP_PDU_t* ngapMsgPdu) {
} break;
// TODO: User Location Information
// TODO: Information on Recommended Cells and RAN Nodes for Paging
// TODO: PDU Session Resource List
case Ngap_ProtocolIE_ID_id_PDUSessionResourceListCxtRelCpl: {
if (ies->protocolIEs.list.array[i]->criticality ==
Ngap_Criticality_reject &&
ies->protocolIEs.list.array[i]->value.present ==
Ngap_UEContextReleaseComplete_IEs__value_PR_PDUSessionResourceListCxtRelCpl) {
pduSessionResourceListCxtRelCpl =
new PDUSessionResourceListCxtRelCpl();
if (!pduSessionResourceListCxtRelCpl
->decodefromPDUSessionResourceListCxtRelCpl(
ies->protocolIEs.list.array[i]
->value.choice.PDUSessionResourceListCxtRelCpl)) {
Logger::ngap().error(
"Decode NGAP PDUSessionResourceListCxtRelCpl IE error");
return false;
}
} else {
Logger::ngap().error(
"Decode NGAP PDUSessionResourceListCxtRelCpl IE error");
return false;
}
} break;
// TODO: Criticality Diagnostics
default: {
......
......@@ -24,6 +24,7 @@
#include "NgapUEMessage.hpp"
#include "UserLocationInformation.hpp"
#include "PDUSessionResourceListCxtRelCpl.hpp"
extern "C" {
#include "Ngap_UEContextReleaseComplete.h"
......@@ -44,13 +45,19 @@ class UEContextReleaseCompleteMsg : public NgapUEMessage {
void setUserLocationInfoNR(const NrCgi_t& cig, const Tai_t& tai);
void getUserLocationInfoNR(NrCgi_t& cig, Tai_t& tai);
void setPduSessionResourceCxtRelCplList(
const std::vector<PDUSessionResourceCxtRelCplItem_t>& list);
bool getPduSessionResourceCxtRelCplList(
std::vector<PDUSessionResourceCxtRelCplItem_t>& list);
private:
Ngap_UEContextReleaseComplete_t* ies;
// AMF_UE_NGAP_ID //Mandatory
// RAN_UE_NGAP_ID //Mandatory
UserLocationInformation* userLocationInformation; // Optional
// TODO: Information on Recommended Cells and RAN Nodes for Paging (Optional)
// TODO: PDU Session Resource List (Optional)
PDUSessionResourceListCxtRelCpl* pduSessionResourceListCxtRelCpl; // Optional
// TODO: Criticality Diagnostics (Optional)
};
......
......@@ -205,7 +205,8 @@ int ngap_amf_handle_ue_radio_cap_indication(
UeRadioCapabilityInfoIndicationMsg* ueRadioCap =
new UeRadioCapabilityInfoIndicationMsg();
if (!ueRadioCap->decodeFromPdu(message_p)) {
Logger::ngap().error("Decoding UEContextReleaseRequest message error");
Logger::ngap().error(
"Decoding UE Radio Capability Indication message error");
return RETURNerror;
}
itti_ue_radio_capability_indication* itti_msg =
......
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