Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
U
UERANSIM
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
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
Libraries
UERANSIM
Commits
be27bb59
Commit
be27bb59
authored
Feb 20, 2021
by
aligungr
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
UE/gNB executable refactor
parent
23d60da7
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
47 additions
and
38 deletions
+47
-38
src/gnb/app/cmd_handler.cpp
src/gnb/app/cmd_handler.cpp
+32
-32
src/gnb/app/cmd_handler.hpp
src/gnb/app/cmd_handler.hpp
+13
-5
src/gnb/app/task.cpp
src/gnb/app/task.cpp
+2
-1
No files found.
src/gnb/app/cmd_handler.cpp
View file @
be27bb59
...
...
@@ -23,42 +23,42 @@
namespace
nr
::
gnb
{
void
GnbCmdHandler
::
PauseTasks
(
TaskBase
&
base
)
void
GnbCmdHandler
::
pauseTasks
(
)
{
base
.
gtpTask
->
requestPause
();
base
.
mrTask
->
requestPause
();
base
.
ngapTask
->
requestPause
();
base
.
rrcTask
->
requestPause
();
base
.
sctpTask
->
requestPause
();
m_base
->
gtpTask
->
requestPause
();
m_base
->
mrTask
->
requestPause
();
m_base
->
ngapTask
->
requestPause
();
m_base
->
rrcTask
->
requestPause
();
m_base
->
sctpTask
->
requestPause
();
}
void
GnbCmdHandler
::
UnpauseTasks
(
TaskBase
&
base
)
void
GnbCmdHandler
::
unpauseTasks
(
)
{
base
.
gtpTask
->
requestUnpause
();
base
.
mrTask
->
requestUnpause
();
base
.
ngapTask
->
requestUnpause
();
base
.
rrcTask
->
requestUnpause
();
base
.
sctpTask
->
requestUnpause
();
m_base
->
gtpTask
->
requestUnpause
();
m_base
->
mrTask
->
requestUnpause
();
m_base
->
ngapTask
->
requestUnpause
();
m_base
->
rrcTask
->
requestUnpause
();
m_base
->
sctpTask
->
requestUnpause
();
}
bool
GnbCmdHandler
::
IsAllPaused
(
TaskBase
&
base
)
bool
GnbCmdHandler
::
isAllPaused
(
)
{
if
(
!
base
.
gtpTask
->
isPauseConfirmed
())
if
(
!
m_base
->
gtpTask
->
isPauseConfirmed
())
return
false
;
if
(
!
base
.
mrTask
->
isPauseConfirmed
())
if
(
!
m_base
->
mrTask
->
isPauseConfirmed
())
return
false
;
if
(
!
base
.
ngapTask
->
isPauseConfirmed
())
if
(
!
m_base
->
ngapTask
->
isPauseConfirmed
())
return
false
;
if
(
!
base
.
rrcTask
->
isPauseConfirmed
())
if
(
!
m_base
->
rrcTask
->
isPauseConfirmed
())
return
false
;
if
(
!
base
.
sctpTask
->
isPauseConfirmed
())
if
(
!
m_base
->
sctpTask
->
isPauseConfirmed
())
return
false
;
return
true
;
}
void
GnbCmdHandler
::
HandleCmd
(
TaskBase
&
base
,
NwGnbCliCommand
&
msg
)
void
GnbCmdHandler
::
handleCmd
(
NwGnbCliCommand
&
msg
)
{
PauseTasks
(
base
);
pauseTasks
(
);
uint64_t
currentTime
=
utils
::
CurrentTimeMillis
();
uint64_t
endTime
=
currentTime
+
PAUSE_CONFIRM_TIMEOUT
;
...
...
@@ -67,7 +67,7 @@ void GnbCmdHandler::HandleCmd(TaskBase &base, NwGnbCliCommand &msg)
while
(
currentTime
<
endTime
)
{
currentTime
=
utils
::
CurrentTimeMillis
();
if
(
IsAllPaused
(
base
))
if
(
isAllPaused
(
))
{
isPaused
=
true
;
break
;
...
...
@@ -81,47 +81,47 @@ void GnbCmdHandler::HandleCmd(TaskBase &base, NwGnbCliCommand &msg)
}
else
{
HandleCmdImpl
(
base
,
msg
);
handleCmdImpl
(
msg
);
}
UnpauseTasks
(
base
);
unpauseTasks
(
);
}
void
GnbCmdHandler
::
HandleCmdImpl
(
TaskBase
&
base
,
NwGnbCliCommand
&
msg
)
void
GnbCmdHandler
::
handleCmdImpl
(
NwGnbCliCommand
&
msg
)
{
switch
(
msg
.
cmd
->
present
)
{
case
app
:
:
GnbCliCommand
::
STATUS
:
{
msg
.
sendResult
(
ToJson
(
base
.
appTask
->
m_statusInfo
).
dumpYaml
());
msg
.
sendResult
(
ToJson
(
m_base
->
appTask
->
m_statusInfo
).
dumpYaml
());
break
;
}
case
app
:
:
GnbCliCommand
::
INFO
:
{
msg
.
sendResult
(
ToJson
(
*
base
.
config
).
dumpYaml
());
msg
.
sendResult
(
ToJson
(
*
m_base
->
config
).
dumpYaml
());
break
;
}
case
app
:
:
GnbCliCommand
::
AMF_LIST
:
{
Json
json
=
Json
::
Arr
({});
for
(
auto
&
amf
:
base
.
ngapTask
->
m_amfCtx
)
for
(
auto
&
amf
:
m_base
->
ngapTask
->
m_amfCtx
)
json
.
push
(
Json
::
Obj
({{
"id"
,
amf
.
first
}}));
msg
.
sendResult
(
json
.
dumpYaml
());
break
;
}
case
app
:
:
GnbCliCommand
::
AMF_INFO
:
{
if
(
base
.
ngapTask
->
m_amfCtx
.
count
(
msg
.
cmd
->
amfId
)
==
0
)
if
(
m_base
->
ngapTask
->
m_amfCtx
.
count
(
msg
.
cmd
->
amfId
)
==
0
)
msg
.
sendError
(
"AMF not found with given ID"
);
else
{
auto
amf
=
base
.
ngapTask
->
m_amfCtx
[
msg
.
cmd
->
amfId
];
auto
amf
=
m_base
->
ngapTask
->
m_amfCtx
[
msg
.
cmd
->
amfId
];
msg
.
sendResult
(
ToJson
(
*
amf
).
dumpYaml
());
}
break
;
}
case
app
:
:
GnbCliCommand
::
UE_LIST
:
{
Json
json
=
Json
::
Arr
({});
for
(
auto
&
ue
:
base
.
ngapTask
->
m_ueCtx
)
for
(
auto
&
ue
:
m_base
->
ngapTask
->
m_ueCtx
)
{
json
.
push
(
Json
::
Obj
({
{
"ue-name"
,
base
.
mrTask
->
m_ueMap
[
ue
.
first
].
name
},
{
"ue-name"
,
m_base
->
mrTask
->
m_ueMap
[
ue
.
first
].
name
},
{
"ran-ngap-id"
,
ue
.
second
->
ranUeNgapId
},
{
"amf-ngap-id"
,
ue
.
second
->
amfUeNgapId
},
}));
...
...
@@ -130,7 +130,7 @@ void GnbCmdHandler::HandleCmdImpl(TaskBase &base, NwGnbCliCommand &msg)
break
;
}
case
app
:
:
GnbCliCommand
::
UE_COUNT
:
{
msg
.
sendResult
(
std
::
to_string
(
base
.
ngapTask
->
m_ueCtx
.
size
()));
msg
.
sendResult
(
std
::
to_string
(
m_base
->
ngapTask
->
m_ueCtx
.
size
()));
break
;
}
}
...
...
src/gnb/app/cmd_handler.hpp
View file @
be27bb59
...
...
@@ -17,15 +17,23 @@ namespace nr::gnb
class
GnbCmdHandler
{
private:
static
void
PauseTasks
(
TaskBase
&
base
);
static
void
UnpauseTasks
(
TaskBase
&
base
);
static
bool
IsAllPaused
(
TaskBase
&
base
);
TaskBase
*
m_base
;
public:
static
void
HandleCmd
(
TaskBase
&
base
,
NwGnbCliCommand
&
msg
);
explicit
GnbCmdHandler
(
TaskBase
*
base
)
:
m_base
(
base
)
{
}
private:
static
void
HandleCmdImpl
(
TaskBase
&
base
,
NwGnbCliCommand
&
msg
);
void
pauseTasks
();
void
unpauseTasks
();
bool
isAllPaused
();
public:
void
handleCmd
(
NwGnbCliCommand
&
msg
);
private:
void
handleCmdImpl
(
NwGnbCliCommand
&
msg
);
};
}
// namespace nr::gnb
src/gnb/app/task.cpp
View file @
be27bb59
...
...
@@ -42,7 +42,8 @@ void GnbAppTask::onLoop()
}
case
NtsMessageType
:
:
GNB_CLI_COMMAND
:
{
auto
*
w
=
dynamic_cast
<
NwGnbCliCommand
*>
(
msg
);
GnbCmdHandler
::
HandleCmd
(
*
m_base
,
*
w
);
GnbCmdHandler
handler
{
m_base
};
handler
.
handleCmd
(
*
w
);
break
;
}
default:
...
...
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