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
c2374dd8
Commit
c2374dd8
authored
Feb 13, 2021
by
aligungr
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
gNB CLI improvements
parent
6a292462
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
23 additions
and
40 deletions
+23
-40
src/gnb/app/cmd_handler.cpp
src/gnb/app/cmd_handler.cpp
+7
-5
src/utils/printer.cpp
src/utils/printer.cpp
+14
-28
src/utils/printer.hpp
src/utils/printer.hpp
+2
-7
No files found.
src/gnb/app/cmd_handler.cpp
View file @
c2374dd8
...
@@ -115,11 +115,13 @@ void GnbCmdHandler::HandleCmdImpl(TaskBase &base, NwGnbCliCommand &msg)
...
@@ -115,11 +115,13 @@ void GnbCmdHandler::HandleCmdImpl(TaskBase &base, NwGnbCliCommand &msg)
auto
amf
=
base
.
ngapTask
->
m_amfCtx
[
msg
.
cmd
->
amfId
];
auto
amf
=
base
.
ngapTask
->
m_amfCtx
[
msg
.
cmd
->
amfId
];
Printer
printer
{};
Printer
printer
{};
printer
.
appendKeyValue
(
"address"
,
amf
->
address
);
printer
.
appendKeyValue
({
printer
.
appendKeyValue
(
"port"
,
amf
->
port
);
{
"address"
,
amf
->
address
},
printer
.
appendKeyValue
(
"name"
,
amf
->
amfName
);
{
"port"
,
std
::
to_string
(
amf
->
port
)},
printer
.
appendKeyValue
(
"relative-capacity"
,
amf
->
relativeCapacity
);
{
"name"
,
amf
->
amfName
},
printer
.
appendKeyValue
(
"state"
,
EnumToString
(
amf
->
state
));
{
"capacity"
,
std
::
to_string
(
amf
->
relativeCapacity
)},
{
"state"
,
EnumToString
(
amf
->
state
)},
});
printer
.
trim
();
printer
.
trim
();
msg
.
sendResult
(
printer
.
makeString
());
msg
.
sendResult
(
printer
.
makeString
());
}
}
...
...
src/utils/printer.cpp
View file @
c2374dd8
...
@@ -30,32 +30,18 @@ void Printer::trim()
...
@@ -30,32 +30,18 @@ void Printer::trim()
utils
::
Trim
(
m_ss
);
utils
::
Trim
(
m_ss
);
}
}
void
Printer
::
appendKeyValue
(
const
std
::
string
&
key
,
int16_t
value
)
void
Printer
::
appendKeyValue
(
const
std
::
initializer_list
<
std
::
pair
<
std
::
string
,
std
::
string
>>
&
pairs
)
{
{
appendKeyValue
(
key
,
std
::
to_string
(
value
));
size_t
maxKey
=
0
;
}
for
(
auto
&
pair
:
pairs
)
maxKey
=
std
::
max
(
maxKey
,
pair
.
first
.
size
());
void
Printer
::
appendKeyValue
(
const
std
::
string
&
key
,
uint16_t
value
)
for
(
auto
&
pair
:
pairs
)
{
{
appendKeyValue
(
key
,
std
::
to_string
(
value
));
appendIndentation
();
}
m_ss
<<
pair
.
first
;
m_ss
<<
std
::
string
(
maxKey
-
pair
.
first
.
size
(),
' '
);
void
Printer
::
appendKeyValue
(
const
std
::
string
&
key
,
int32_t
value
)
m_ss
<<
" : "
;
{
m_ss
<<
pair
.
second
;
appendKeyValue
(
key
,
std
::
to_string
(
value
));
m_ss
<<
"
\n
"
;
}
}
void
Printer
::
appendKeyValue
(
const
std
::
string
&
key
,
uint32_t
value
)
{
appendKeyValue
(
key
,
std
::
to_string
(
value
));
}
void
Printer
::
appendKeyValue
(
const
std
::
string
&
key
,
int64_t
value
)
{
appendKeyValue
(
key
,
std
::
to_string
(
value
));
}
void
Printer
::
appendKeyValue
(
const
std
::
string
&
key
,
uint64_t
value
)
{
appendKeyValue
(
key
,
std
::
to_string
(
value
));
}
}
src/utils/printer.hpp
View file @
c2374dd8
...
@@ -10,6 +10,7 @@
...
@@ -10,6 +10,7 @@
#include <sstream>
#include <sstream>
#include <string>
#include <string>
#include <utility>
class
Printer
class
Printer
{
{
...
@@ -21,13 +22,7 @@ class Printer
...
@@ -21,13 +22,7 @@ class Printer
public:
public:
void
appendKeyValue
(
const
std
::
string
&
key
,
const
std
::
string
&
value
);
void
appendKeyValue
(
const
std
::
string
&
key
,
const
std
::
string
&
value
);
void
appendKeyValue
(
const
std
::
initializer_list
<
std
::
pair
<
std
::
string
,
std
::
string
>>
&
pairs
);
void
appendKeyValue
(
const
std
::
string
&
key
,
int16_t
value
);
void
appendKeyValue
(
const
std
::
string
&
key
,
uint16_t
value
);
void
appendKeyValue
(
const
std
::
string
&
key
,
int32_t
value
);
void
appendKeyValue
(
const
std
::
string
&
key
,
uint32_t
value
);
void
appendKeyValue
(
const
std
::
string
&
key
,
int64_t
value
);
void
appendKeyValue
(
const
std
::
string
&
key
,
uint64_t
value
);
std
::
string
makeString
()
const
;
std
::
string
makeString
()
const
;
...
...
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