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
f7279026
Commit
f7279026
authored
Feb 13, 2021
by
aligungr
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
gNB CLI improvements
parent
8e2eae84
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
107 additions
and
2 deletions
+107
-2
src/gnb/app/cmd_handler.cpp
src/gnb/app/cmd_handler.cpp
+11
-2
src/utils/printer.cpp
src/utils/printer.cpp
+61
-0
src/utils/printer.hpp
src/utils/printer.hpp
+35
-0
No files found.
src/gnb/app/cmd_handler.cpp
View file @
f7279026
...
...
@@ -15,6 +15,7 @@
#include <gnb/rrc/task.hpp>
#include <gnb/sctp/task.hpp>
#include <utils/common.hpp>
#include <utils/printer.hpp>
#define PAUSE_CONFIRM_TIMEOUT 3000
#define PAUSE_POLLING 10
...
...
@@ -101,7 +102,7 @@ void GnbCmdHandler::HandleCmdImpl(TaskBase &base, NwGnbCliCommand &msg)
case
app
:
:
GnbCliCommand
::
AMF_LIST
:
{
std
::
stringstream
ss
{};
for
(
auto
&
amf
:
base
.
ngapTask
->
m_amfCtx
)
ss
<<
"
* amf-id: "
<<
amf
.
first
<<
"
\n
"
;
ss
<<
"
- ID["
<<
amf
.
first
<<
"] Address["
<<
amf
.
second
->
address
<<
":"
<<
amf
.
second
->
port
<<
"]
\n
"
;
utils
::
Trim
(
ss
);
msg
.
sendResult
(
ss
.
str
());
break
;
...
...
@@ -112,7 +113,15 @@ void GnbCmdHandler::HandleCmdImpl(TaskBase &base, NwGnbCliCommand &msg)
else
{
auto
amf
=
base
.
ngapTask
->
m_amfCtx
[
msg
.
cmd
->
amfId
];
msg
.
sendResult
(
"state: "
+
std
::
to_string
((
int
)
amf
->
state
));
Printer
printer
{};
printer
.
appendKeyValue
(
"address"
,
amf
->
address
);
printer
.
appendKeyValue
(
"port"
,
amf
->
port
);
printer
.
appendKeyValue
(
"name"
,
amf
->
amfName
);
printer
.
appendKeyValue
(
"relative-capacity"
,
amf
->
relativeCapacity
);
printer
.
appendKeyValue
(
"state"
,
EnumToString
(
amf
->
state
));
printer
.
trim
();
msg
.
sendResult
(
printer
.
makeString
());
}
break
;
}
...
...
src/utils/printer.cpp
0 → 100644
View file @
f7279026
//
// This file is a part of UERANSIM open source project.
// Copyright (c) 2021 ALİ GÜNGÖR.
//
// The software and all associated files are licensed under GPL-3.0
// and subject to the terms and conditions defined in LICENSE file.
//
#include "printer.hpp"
#include <utils/common.hpp>
void
Printer
::
appendKeyValue
(
const
std
::
string
&
key
,
const
std
::
string
&
value
)
{
appendIndentation
();
m_ss
<<
key
<<
": "
<<
value
<<
"
\n
"
;
}
std
::
string
Printer
::
makeString
()
const
{
return
m_ss
.
str
();
}
void
Printer
::
appendIndentation
()
{
m_ss
<<
std
::
string
(
m_indent
,
' '
);
}
void
Printer
::
trim
()
{
utils
::
Trim
(
m_ss
);
}
void
Printer
::
appendKeyValue
(
const
std
::
string
&
key
,
int16_t
value
)
{
appendKeyValue
(
key
,
std
::
to_string
(
value
));
}
void
Printer
::
appendKeyValue
(
const
std
::
string
&
key
,
uint16_t
value
)
{
appendKeyValue
(
key
,
std
::
to_string
(
value
));
}
void
Printer
::
appendKeyValue
(
const
std
::
string
&
key
,
int32_t
value
)
{
appendKeyValue
(
key
,
std
::
to_string
(
value
));
}
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
0 → 100644
View file @
f7279026
//
// This file is a part of UERANSIM open source project.
// Copyright (c) 2021 ALİ GÜNGÖR.
//
// The software and all associated files are licensed under GPL-3.0
// and subject to the terms and conditions defined in LICENSE file.
//
#pragma once
#include <sstream>
#include <string>
class
Printer
{
std
::
stringstream
m_ss
{};
int
m_indent
{};
private:
void
appendIndentation
();
public:
void
appendKeyValue
(
const
std
::
string
&
key
,
const
std
::
string
&
value
);
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
;
void
trim
();
};
\ No newline at end of file
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