Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
O
OpenXG-AMF
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
1
Issues
1
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
OpenXG
OpenXG-AMF
Commits
0ba67b9f
Commit
0ba67b9f
authored
Mar 03, 2021
by
Tien-Thinh Nguyen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
First version to support NG Reset procedure
parent
a9bccc48
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
292 additions
and
7 deletions
+292
-7
src/itti/itti_msg.hpp
src/itti/itti_msg.hpp
+1
-0
src/itti/msgs/itti_msg_n2.hpp
src/itti/msgs/itti_msg_n2.hpp
+11
-0
src/ngap/ngapMsgs/NGReset.cpp
src/ngap/ngapMsgs/NGReset.cpp
+165
-0
src/ngap/ngapMsgs/NGReset.hpp
src/ngap/ngapMsgs/NGReset.hpp
+73
-0
src/ngap/ngap_app/ngap_app.cpp
src/ngap/ngap_app/ngap_app.cpp
+2
-6
src/ngap/ngap_app/ngap_app.hpp
src/ngap/ngap_app/ngap_app.hpp
+18
-0
src/ngap/ngap_app/ngap_message_callback.hpp
src/ngap/ngap_app/ngap_message_callback.hpp
+22
-1
No files found.
src/itti/itti_msg.hpp
View file @
0ba67b9f
...
...
@@ -61,6 +61,7 @@ typedef enum {
ASYNC_SHELL_CMD
=
ITTI_MSG_TYPE_FIRST
,
NEW_SCTP_ASSOCIATION
,
NG_SETUP_REQ
,
NG_RESET
,
INITIAL_UE_MSG
,
ITTI_UL_NAS_TRANSPORT
,
ITTI_DL_NAS_TRANSPORT
,
...
...
src/itti/msgs/itti_msg_n2.hpp
View file @
0ba67b9f
...
...
@@ -24,6 +24,7 @@
#include "itti_msg.hpp"
#include "NGSetupRequest.hpp"
#include "NGReset.hpp"
#include "InitialUEMessage.hpp"
#include "UplinkNASTransport.hpp"
#include "UEContextReleaseRequest.hpp"
...
...
@@ -66,6 +67,16 @@ class itti_ng_setup_request : public itti_msg_n2 {
NGSetupRequestMsg
*
ngSetupReq
;
};
class
itti_ng_reset
:
public
itti_msg_n2
{
public:
itti_ng_reset
(
const
task_id_t
origin
,
const
task_id_t
destination
)
:
itti_msg_n2
(
NG_RESET
,
origin
,
destination
)
{}
itti_ng_reset
(
const
itti_ng_reset
&
i
)
:
itti_msg_n2
(
i
)
{}
public:
NGResetMsg
*
ngReset
;
};
class
itti_initial_ue_message
:
public
itti_msg_n2
{
public:
itti_initial_ue_message
(
const
task_id_t
origin
,
const
task_id_t
destination
)
...
...
src/ngap/ngapMsgs/NGReset.cpp
0 → 100644
View file @
0ba67b9f
/*
* 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
\date 2021
\email: contact@openairinterface.org
*/
#include "NGReset.hpp"
extern
"C"
{
#include "constr_TYPE.h"
#include "Ngap_NGAP-PDU.h"
#include "asn_codecs.h"
#include "per_encoder.h"
#include "per_decoder.h"
#include "constraints.h"
#include "dynamic_memory_check.h"
}
#include <iostream>
#include <vector>
using
namespace
std
;
namespace
ngap
{
//------------------------------------------------------------------------------
NGResetMsg
::
NGResetMsg
()
{
ngResetPdu
=
NULL
;
ngResetIEs
=
NULL
;
cause
=
{};
resetType
=
{};
}
//------------------------------------------------------------------------------
NGResetMsg
::~
NGResetMsg
()
{}
//------------------------------------------------------------------------------
void
NGResetMsg
::
setMessageType
()
{
if
(
!
ngResetPdu
)
ngResetPdu
=
(
Ngap_NGAP_PDU_t
*
)
calloc
(
1
,
sizeof
(
Ngap_NGAP_PDU_t
));
MessageType
NgResetMessageTypeIE
;
NgResetMessageTypeIE
.
setProcedureCode
(
Ngap_ProcedureCode_id_NGReset
);
NgResetMessageTypeIE
.
setTypeOfMessage
(
Ngap_NGAP_PDU_PR_initiatingMessage
);
NgResetMessageTypeIE
.
setValuePresent
(
Ngap_InitiatingMessage__value_PR_NGReset
);
if
(
NgResetMessageTypeIE
.
getProcedureCode
()
==
Ngap_ProcedureCode_id_NGReset
&&
NgResetMessageTypeIE
.
getTypeOfMessage
()
==
Ngap_NGAP_PDU_PR_initiatingMessage
)
{
NgResetMessageTypeIE
.
encode2pdu
(
ngResetPdu
);
ngResetIEs
=
&
(
ngResetPdu
->
choice
.
initiatingMessage
->
value
.
choice
.
NGReset
);
}
else
{
cout
<<
"[warning] This information doesn't refer to NGReset "
"Message!!!"
<<
endl
;
}
}
//------------------------------------------------------------------------------
void
NGResetMsg
::
setCause
(
Ngap_Cause_t
cause
)
{
this
->
cause
=
cause
;
}
//------------------------------------------------------------------------------
void
NGResetMsg
::
setResetType
(
Ngap_ResetType_t
resetType
)
{
this
->
resetType
=
resetType
;
}
void
NGResetMsg
::
getCause
(
Ngap_Cause_t
&
cause
)
{
cause
=
this
->
cause
;
}
void
NGResetMsg
::
getResetType
(
Ngap_ResetType_t
&
resetType
)
{
resetType
=
this
->
resetType
;
}
//------------------------------------------------------------------------------
int
NGResetMsg
::
encode2buffer
(
uint8_t
*
buf
,
int
buf_size
)
{
asn_fprint
(
stderr
,
&
asn_DEF_Ngap_NGAP_PDU
,
ngResetPdu
);
asn_enc_rval_t
er
=
aper_encode_to_buffer
(
&
asn_DEF_Ngap_NGAP_PDU
,
NULL
,
ngResetPdu
,
buf
,
buf_size
);
printf
(
"er.encoded(%ld)
\n
"
,
er
.
encoded
);
return
er
.
encoded
;
}
//------------------------------------------------------------------------------
bool
NGResetMsg
::
decodefrompdu
(
Ngap_NGAP_PDU_t
*
ngap_msg_pdu
)
{
ngResetPdu
=
ngap_msg_pdu
;
if
(
ngResetPdu
->
present
==
Ngap_NGAP_PDU_PR_initiatingMessage
)
{
if
(
ngResetPdu
->
choice
.
initiatingMessage
&&
ngResetPdu
->
choice
.
initiatingMessage
->
procedureCode
==
Ngap_ProcedureCode_id_NGReset
&&
ngResetPdu
->
choice
.
initiatingMessage
->
criticality
==
Ngap_Criticality_reject
&&
ngResetPdu
->
choice
.
initiatingMessage
->
value
.
present
==
Ngap_InitiatingMessage__value_PR_NGReset
)
{
ngResetIEs
=
&
ngResetPdu
->
choice
.
initiatingMessage
->
value
.
choice
.
NGReset
;
for
(
int
i
=
0
;
i
<
ngResetIEs
->
protocolIEs
.
list
.
count
;
i
++
)
{
switch
(
ngResetIEs
->
protocolIEs
.
list
.
array
[
i
]
->
id
)
{
case
Ngap_ProtocolIE_ID_id_Cause
:
{
if
(
ngResetIEs
->
protocolIEs
.
list
.
array
[
i
]
->
criticality
==
Ngap_Criticality_reject
&&
ngResetIEs
->
protocolIEs
.
list
.
array
[
i
]
->
value
.
present
==
Ngap_NGResetIEs__value_PR_Cause
)
{
cause
=
ngResetIEs
->
protocolIEs
.
list
.
array
[
i
]
->
value
.
choice
.
Cause
;
}
else
{
cout
<<
"Decoded NGAP Cause IE error"
<<
endl
;
return
false
;
}
}
break
;
case
Ngap_ProtocolIE_ID_id_ResetType
:
{
if
(
ngResetIEs
->
protocolIEs
.
list
.
array
[
i
]
->
criticality
==
Ngap_Criticality_ignore
&&
ngResetIEs
->
protocolIEs
.
list
.
array
[
i
]
->
value
.
present
==
Ngap_NGResetIEs__value_PR_ResetType
)
{
resetType
=
ngResetIEs
->
protocolIEs
.
list
.
array
[
i
]
->
value
.
choice
.
ResetType
;
}
else
{
cout
<<
"Decoded NGAP ResetType IE error"
<<
endl
;
return
false
;
}
}
break
;
default:
{
cout
<<
"Decoded NGAP message PDU error"
<<
endl
;
return
false
;
}
}
}
}
else
{
cout
<<
"Check NGReset message error!!!"
;
return
false
;
}
}
else
{
cout
<<
"Check NGReset message error!!!"
;
return
false
;
}
return
true
;
}
}
// namespace ngap
src/ngap/ngapMsgs/NGReset.hpp
0 → 100644
View file @
0ba67b9f
/*
* 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
\date 2021
\email: contact@openairinterface.org
*/
#ifndef _NG_RESET_H_
#define _NG_RESET_H_
#include "NgapIEsStruct.hpp"
#include "MessageType.hpp"
#include "GlobalRanNodeId.hpp"
#include "RanNodeName.hpp"
#include "DefaultPagingDRX.hpp"
#include "SupportedTAList.hpp"
extern
"C"
{
#include "Ngap_NGAP-PDU.h"
#include "Ngap_ProtocolIE-Field.h"
#include "Ngap_NGSetupRequest.h"
}
namespace
ngap
{
class
NGResetMsg
{
public:
NGResetMsg
();
virtual
~
NGResetMsg
();
void
setMessageType
();
// Initialize the PDU and populate the MessageType;
void
setCause
(
Ngap_Cause_t
);
void
setResetType
(
Ngap_ResetType_t
);
int
encode2buffer
(
uint8_t
*
buf
,
int
buf_size
);
bool
decodefrompdu
(
Ngap_NGAP_PDU_t
*
ngap_msg_pdu
);
void
getCause
(
Ngap_Cause_t
&
);
void
getResetType
(
Ngap_ResetType_t
&
);
private:
Ngap_NGAP_PDU_t
*
ngResetPdu
;
Ngap_NGReset_t
*
ngResetIEs
;
Ngap_Cause_t
cause
;
Ngap_ResetType_t
resetType
;
// Cause *cause;
// ResetType resetType;
};
}
// namespace ngap
#endif
src/ngap/ngap_app/ngap_app.cpp
View file @
0ba67b9f
...
...
@@ -53,13 +53,11 @@ ngap_app::ngap_app(const std::string& address, const uint16_t port_num)
ngap_app
::~
ngap_app
()
{}
//------------------------------------------------------------------------------
// received sctp payload and decode it to NGAP message and send itti message to
// TASK_AMF_N2
void
ngap_app
::
handle_receive
(
bstring
payload
,
sctp_assoc_id_t
assoc_id
,
sctp_stream_id_t
stream
,
sctp_stream_id_t
instreams
,
sctp_stream_id_t
outstreams
)
{
Logger
::
ngap
().
debug
(
"Handling SCTP payload from
sctp_s
erver on assoc_id (%d), stream_id "
"Handling SCTP payload from
SCTP S
erver on assoc_id (%d), stream_id "
"(%d), instreams (%d), outstreams (%d)"
,
assoc_id
,
stream
,
instreams
,
outstreams
);
Ngap_NGAP_PDU_t
*
ngap_msg_pdu
=
...
...
@@ -71,14 +69,13 @@ void ngap_app::handle_receive(
"Decoded NGAP message, procedure code %d, present %d"
,
ngap_msg_pdu
->
choice
.
initiatingMessage
->
procedureCode
,
ngap_msg_pdu
->
present
);
// Handle the message
(
*
messages_callback
[
ngap_msg_pdu
->
choice
.
initiatingMessage
->
procedureCode
]
[
ngap_msg_pdu
->
present
-
1
])(
assoc_id
,
stream
,
ngap_msg_pdu
);
}
//------------------------------------------------------------------------------
// handle new sctp association
// TNL association(clause 8.7.1.1, 3gpp ts38.413)
void
ngap_app
::
handle_sctp_new_association
(
sctp_assoc_id_t
assoc_id
,
sctp_stream_id_t
instreams
,
sctp_stream_id_t
outstreams
)
{
...
...
@@ -119,7 +116,6 @@ uint32_t ngap_app::getPpid() {
return
ppid_
;
}
// gnb context management
//------------------------------------------------------------------------------
bool
ngap_app
::
is_assoc_id_2_gnb_context
(
const
sctp_assoc_id_t
&
assoc_id
)
const
{
...
...
src/ngap/ngap_app/ngap_app.hpp
View file @
0ba67b9f
...
...
@@ -48,13 +48,31 @@ class ngap_app : public sctp_application {
~
ngap_app
();
uint32_t
getPpid
();
/*
* Handle SCTP payload (decode it and send ITTI msg to N2)
* @param [bstring] payload: payload
* @param [sctp_assoc_id_t] assoc_id: gNB association ID
* @param [sctp_stream_id_t] stream: stream
* @param [sctp_stream_id_t] instreams: instreams
* @param [sctp_stream_id_t] outstreams: outstreams
* @return void:
*/
void
handle_receive
(
bstring
payload
,
sctp_assoc_id_t
assoc_id
,
sctp_stream_id_t
stream
,
sctp_stream_id_t
instreams
,
sctp_stream_id_t
outstreams
);
/*
* Handle new SCTP TNL Association (clause 8.7.1.1, 3gpp ts38.413)
* @param [sctp_assoc_id_t] assoc_id: gNB association ID
* @param [sctp_stream_id_t] instreams: instreams
* @param [sctp_stream_id_t] outstreams: outstreams
* @return void:
*/
void
handle_sctp_new_association
(
sctp_assoc_id_t
assoc_id
,
sctp_stream_id_t
instreams
,
sctp_stream_id_t
outstreams
);
// gnb context management
bool
is_assoc_id_2_gnb_context
(
const
sctp_assoc_id_t
&
assoc_id
)
const
;
void
set_assoc_id_2_gnb_context
(
const
sctp_assoc_id_t
&
assoc_id
,
std
::
shared_ptr
<
gnb_context
>
gc
);
...
...
src/ngap/ngap_app/ngap_message_callback.hpp
View file @
0ba67b9f
...
...
@@ -39,6 +39,7 @@
#include "itti_msg_n11.hpp"
#include "itti.hpp"
#include "NGSetupRequest.hpp"
#include "NGReset.hpp"
#include "PduSessionResourceSetupResponse.hpp"
#include "PduSessionResourceReleaseResponse.hpp"
#include "InitialContextSetupResponse.hpp"
...
...
@@ -646,7 +647,27 @@ int nas_non_delivery_indication(
int
ng_reset
(
const
sctp_assoc_id_t
assoc_id
,
const
sctp_stream_id_t
stream
,
struct
Ngap_NGAP_PDU
*
message_p
)
{
Logger
::
ngap
().
debug
(
"Sending itti ng reset to TASK_AMF_N2"
);
Logger
::
ngap
().
debug
(
"Sending ITTI NG Reset to TASK_AMF_N2"
);
asn_fprint
(
stderr
,
&
asn_DEF_Ngap_NGAP_PDU
,
message_p
);
NGResetMsg
*
ngReset
=
new
NGResetMsg
();
if
(
!
ngReset
->
decodefrompdu
(
message_p
))
{
Logger
::
ngap
().
error
(
"Decoding NGReset message error"
);
return
-
1
;
}
itti_ng_reset
*
itti_msg
=
new
itti_ng_reset
(
TASK_NGAP
,
TASK_AMF_N2
);
itti_msg
->
assoc_id
=
assoc_id
;
itti_msg
->
stream
=
stream
;
itti_msg
->
ngReset
=
ngReset
;
std
::
shared_ptr
<
itti_ng_reset
>
i
=
std
::
shared_ptr
<
itti_ng_reset
>
(
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_N2"
,
i
->
get_msg_name
());
}
return
0
;
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment