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
b9c4b40e
Commit
b9c4b40e
authored
Feb 13, 2021
by
aligungr
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
gNB CLI improvements
parent
ad4bbf64
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
49 additions
and
9 deletions
+49
-9
src/gnb/app/task.cpp
src/gnb/app/task.cpp
+8
-6
src/gnb/ngap/task.cpp
src/gnb/ngap/task.cpp
+29
-1
src/utils/common.cpp
src/utils/common.cpp
+8
-0
src/utils/common.hpp
src/utils/common.hpp
+4
-2
No files found.
src/gnb/app/task.cpp
View file @
b9c4b40e
...
...
@@ -37,28 +37,30 @@ void GnbAppTask::onLoop()
m_statusInfo
.
isNgapUp
=
w
->
isNgapUp
;
break
;
}
delete
w
;
break
;
}
case
NtsMessageType
:
:
GNB_CLI_COMMAND
:
{
auto
*
w
=
dynamic_cast
<
NwGnbCliCommand
*>
(
msg
);
if
(
w
->
cmd
==
nullptr
)
break
;
switch
(
w
->
cmd
->
present
)
{
case
app
:
:
GnbCliCommand
::
STATUS
:
{
w
->
sendResult
(
m_statusInfo
.
toString
());
delete
w
;
break
;
}
case
app
:
:
GnbCliCommand
::
INFO
:
{
w
->
sendResult
(
m_base
->
config
->
toString
());
delete
w
;
break
;
}
case
app
:
:
GnbCliCommand
::
AMF_LIST
:
{
w
->
sendError
(
"amf-list command not implemented yet"
);
case
app
:
:
GnbCliCommand
::
AMF_LIST
:
case
app
:
:
GnbCliCommand
::
AMF_STATUS
:
{
m_base
->
ngapTask
->
push
(
w
);
break
;
}
case
app
:
:
GnbCliCommand
::
AMF_STATUS
:
{
w
->
sendError
(
"amf-status command not implemented yet"
)
;
default
:
{
delete
w
;
break
;
}
}
...
...
src/gnb/ngap/task.cpp
View file @
b9c4b40e
...
...
@@ -8,7 +8,7 @@
#include "task.hpp"
#include <gnb/app/task.hpp>
#include <sstream>
#include <utils/common.hpp>
namespace
nr
::
gnb
...
...
@@ -82,6 +82,34 @@ void NgapTask::onLoop()
}
break
;
}
case
NtsMessageType
:
:
GNB_CLI_COMMAND
:
{
auto
*
w
=
dynamic_cast
<
NwGnbCliCommand
*>
(
msg
);
switch
(
w
->
cmd
->
present
)
{
case
app
:
:
GnbCliCommand
::
AMF_LIST
:
{
std
::
stringstream
ss
{};
for
(
auto
&
amf
:
m_amfCtx
)
ss
<<
"* amf-id: "
<<
amf
.
first
<<
"
\n
"
;
utils
::
Trim
(
ss
);
w
->
sendResult
(
ss
.
str
());
break
;
}
case
app
:
:
GnbCliCommand
::
AMF_STATUS
:
{
if
(
m_amfCtx
.
count
(
w
->
cmd
->
amfId
)
==
0
)
w
->
sendError
(
"AMF not found with given ID"
);
else
{
auto
amf
=
m_amfCtx
[
w
->
cmd
->
amfId
];
w
->
sendResult
(
"state: "
+
std
::
to_string
((
int
)
amf
->
state
));
}
break
;
}
default:
{
break
;
}
}
break
;
}
default:
{
m_logger
->
unhandledNts
(
msg
);
break
;
...
...
src/utils/common.cpp
View file @
b9c4b40e
...
...
@@ -309,3 +309,11 @@ void utils::Trim(std::string &s)
s
.
erase
(
s
.
begin
(),
std
::
find_if
(
s
.
begin
(),
s
.
end
(),
[](
unsigned
char
ch
)
{
return
!
std
::
isspace
(
ch
);
}));
s
.
erase
(
std
::
find_if
(
s
.
rbegin
(),
s
.
rend
(),
[](
unsigned
char
ch
)
{
return
!
std
::
isspace
(
ch
);
}).
base
(),
s
.
end
());
}
void
utils
::
Trim
(
std
::
stringstream
&
s
)
{
std
::
string
str
{};
str
=
s
.
str
();
Trim
(
str
);
s
.
str
(
str
);
}
src/utils/common.hpp
View file @
b9c4b40e
...
...
@@ -13,6 +13,7 @@
#include "octet_string.hpp"
#include "time_stamp.hpp"
#include <iomanip>
#include <sstream>
#include <string>
#include <vector>
...
...
@@ -32,9 +33,10 @@ int ParseInt(const char *str);
uint64_t
Random64
();
void
Sleep
(
int
ms
);
bool
IsRoot
();
bool
IsNumeric
(
const
std
::
string
&
str
);
bool
IsNumeric
(
const
std
::
string
&
str
);
void
AssertNodeName
(
const
std
::
string
&
str
);
void
Trim
(
std
::
string
&
str
);
void
Trim
(
std
::
string
&
str
);
void
Trim
(
std
::
stringstream
&
str
);
template
<
typename
T
>
inline
void
ClearAndDelete
(
std
::
vector
<
T
*>
&
vector
)
...
...
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