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
25617b9f
Commit
25617b9f
authored
Jan 31, 2023
by
Tien Thinh NGUYEN
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Code refactor for gNB context
parent
7b46f95a
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
28 additions
and
14 deletions
+28
-14
src/amf-app/amf_n2.cpp
src/amf-app/amf_n2.cpp
+6
-2
src/contexts/gNB_context.hpp
src/contexts/gNB_context.hpp
+5
-2
src/ngap/ngap_app/ngap_app.cpp
src/ngap/ngap_app/ngap_app.cpp
+12
-4
src/ngap/ngap_app/ngap_app.hpp
src/ngap/ngap_app/ngap_app.hpp
+5
-6
No files found.
src/amf-app/amf_n2.cpp
View file @
25617b9f
...
...
@@ -1673,7 +1673,11 @@ bool amf_n2::handle_itti_message(itti_handover_required& itti_msg) {
int
encoded_size
=
handover_request
->
Encode
(
buffer
,
BUFFER_SIZE_4096
);
bstring
b
=
blk2bstr
(
buffer
,
encoded_size
);
std
::
shared_ptr
<
gnb_context
>
gc_target
=
{};
gc_target
=
gnb_id_2_gnb_context
(
gnb_id_value
);
if
(
!
gnb_id_2_gnb_context
(
gnb_id_value
,
gc_target
))
{
Logger
::
amf_n2
().
warn
(
"Could not find Target's gNB context!"
);
return
false
;
}
unc
->
target_gnb_assoc_id
=
gc_target
->
sctp_assoc_id
;
sctp_s_38412
.
sctp_send_msg
(
gc_target
->
sctp_assoc_id
,
0
,
&
b
);
bdestroy_wrapper
(
&
b
);
...
...
src/contexts/gNB_context.hpp
View file @
25617b9f
...
...
@@ -43,11 +43,14 @@ typedef enum {
NGAP_RESETING
,
NGAP_READY
,
NGAP_SHUTDOWN
}
amf_ng_gnb_state_t
;
}
ng_gnb_state_t
;
static
const
std
::
vector
<
std
::
string
>
ng_gnb_state_str
=
{
"NGAP_INIT"
,
"NGAP_RESETTING"
,
"NGAP_READY"
,
"NGAP_SHUTDOWN"
};
class
gnb_context
{
public:
amf_
ng_gnb_state_t
ng_state
;
ng_gnb_state_t
ng_state
;
std
::
string
gnb_name
;
long
globalRanNodeId
;
...
...
src/ngap/ngap_app/ngap_app.cpp
View file @
25617b9f
...
...
@@ -164,14 +164,22 @@ void ngap_app::set_assoc_id_2_gnb_context(
//------------------------------------------------------------------------------
bool
ngap_app
::
is_gnb_id_2_gnb_context
(
const
long
&
gnb_id
)
const
{
std
::
shared_lock
lock
(
m_gnbid2gnbContext
);
return
bool
{
gnbid2gnbContext
.
count
(
gnb_id
)
>
0
};
if
(
gnbid2gnbContext
.
count
(
gnb_id
)
>
0
)
{
if
(
gnbid2gnbContext
.
at
(
gnb_id
)
!=
nullptr
)
return
true
;
}
return
false
;
}
//------------------------------------------------------------------------------
std
::
shared_ptr
<
gnb_context
>
ngap_app
::
gnb_id_2_gnb_context
(
const
long
&
gnb_id
)
const
{
bool
ngap_app
::
gnb_id_2_gnb_context
(
const
long
&
gnb_id
,
std
::
shared_ptr
<
gnb_context
>&
gc
)
const
{
std
::
shared_lock
lock
(
m_gnbid2gnbContext
);
return
gnbid2gnbContext
.
at
(
gnb_id
);
if
(
gnbid2gnbContext
.
count
(
gnb_id
)
>
0
)
{
if
(
gnbid2gnbContext
.
at
(
gnb_id
)
==
nullptr
)
return
false
;
gc
=
gnbid2gnbContext
.
at
(
gnb_id
);
return
true
;
}
return
false
;
}
//------------------------------------------------------------------------------
...
...
src/ngap/ngap_app/ngap_app.hpp
View file @
25617b9f
...
...
@@ -33,9 +33,6 @@ using namespace sctp;
namespace
ngap
{
static
const
std
::
vector
<
std
::
string
>
ng_gnb_state_str
=
{
"NGAP_INIT"
,
"NGAP_RESETTING"
,
"NGAP_READY"
,
"NGAP_SHUTDOWN"
};
class
ngap_app
:
public
sctp_application
{
public:
ngap_app
(
const
std
::
string
&
address
,
const
uint16_t
port_num
);
...
...
@@ -121,11 +118,13 @@ class ngap_app : public sctp_application {
const
long
&
gnb_id
,
const
std
::
shared_ptr
<
gnb_context
>&
gc
);
/*
* Get the gNB Context associated with a gNB id
* Get the gNB Context associated with a gNB id
if exits and not null
* @param [const long& ] gnb_id: gNB ID
* @return the pointer to the gNB context
* @param [const std::shared_ptr<gnb_context>&] gc: pointer to the gNB context
* @return true if the context exists and not null, otherwise return false
*/
std
::
shared_ptr
<
gnb_context
>
gnb_id_2_gnb_context
(
const
long
&
gnb_id
)
const
;
bool
gnb_id_2_gnb_context
(
const
long
&
gnb_id
,
std
::
shared_ptr
<
gnb_context
>&
gc
)
const
;
/*
* Remove the gNB Context associated with a gNB id
...
...
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