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
267c5c46
Commit
267c5c46
authored
Feb 13, 2021
by
aligungr
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
UE CLI improvements
parent
8ad0767a
Changes
7
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
302 additions
and
101 deletions
+302
-101
src/app/cli_cmd.cpp
src/app/cli_cmd.cpp
+54
-0
src/app/cli_cmd.hpp
src/app/cli_cmd.hpp
+14
-0
src/gnb.cpp
src/gnb.cpp
+2
-2
src/ue.cpp
src/ue.cpp
+197
-99
src/ue/nts.hpp
src/ue/nts.hpp
+24
-0
src/ue/ue.cpp
src/ue/ue.cpp
+6
-0
src/ue/ue.hpp
src/ue/ue.hpp
+5
-0
No files found.
src/app/cli_cmd.cpp
View file @
267c5c46
...
...
@@ -82,6 +82,18 @@ static std::map<std::string, bool> g_gnbCmdToHelpIfEmpty = {
{
"info"
,
false
},
};
static
std
::
map
<
std
::
string
,
std
::
string
>
g_ueCmdToDescription
=
{
{
"info"
,
"Show some information about the UE"
},
};
static
std
::
map
<
std
::
string
,
std
::
string
>
g_ueCmdToUsage
=
{
{
"info"
,
"[option...]"
},
};
static
std
::
map
<
std
::
string
,
bool
>
g_ueCmdToHelpIfEmpty
=
{
{
"info"
,
false
},
};
std
::
unique_ptr
<
GnbCliCommand
>
ParseGnbCliCommand
(
std
::
vector
<
std
::
string
>
&&
tokens
,
std
::
string
&
error
,
std
::
string
&
output
)
{
...
...
@@ -149,4 +161,46 @@ std::unique_ptr<GnbCliCommand> ParseGnbCliCommand(std::vector<std::string> &&tok
return
nullptr
;
}
std
::
unique_ptr
<
UeCliCommand
>
ParseUeCliCommand
(
std
::
vector
<
std
::
string
>
&&
tokens
,
std
::
string
&
error
,
std
::
string
&
output
)
{
if
(
tokens
.
empty
())
{
error
=
"Empty command"
;
return
nullptr
;
}
std
::
string
&
subCmd
=
tokens
[
0
];
if
(
subCmd
==
"commands"
)
{
output
=
DumpCommands
(
g_ueCmdToDescription
);
return
nullptr
;
}
if
(
g_ueCmdToDescription
.
count
(
subCmd
)
==
0
||
g_ueCmdToUsage
.
count
(
subCmd
)
==
0
||
g_ueCmdToHelpIfEmpty
.
count
(
subCmd
)
==
0
)
{
error
=
"Command not recognized: "
+
subCmd
;
return
nullptr
;
}
opt
::
OptionsDescription
desc
=
Desc
(
subCmd
,
g_ueCmdToDescription
[
subCmd
],
g_ueCmdToUsage
[
subCmd
],
g_ueCmdToHelpIfEmpty
[
subCmd
]);
OptionsHandler
handler
{};
opt
::
OptionsResult
options
{
tokens
,
desc
,
&
handler
};
error
=
handler
.
m_err
.
str
();
output
=
handler
.
m_output
.
str
();
utils
::
Trim
(
error
);
utils
::
Trim
(
output
);
if
(
!
error
.
empty
()
||
!
output
.
empty
())
return
nullptr
;
return
nullptr
;
}
}
// namespace app
src/app/cli_cmd.hpp
View file @
267c5c46
...
...
@@ -33,7 +33,21 @@ struct GnbCliCommand
}
};
struct
UeCliCommand
{
enum
PR
{
}
present
;
explicit
UeCliCommand
(
PR
present
)
:
present
(
present
)
{
}
};
std
::
unique_ptr
<
GnbCliCommand
>
ParseGnbCliCommand
(
std
::
vector
<
std
::
string
>
&&
tokens
,
std
::
string
&
error
,
std
::
string
&
output
);
std
::
unique_ptr
<
UeCliCommand
>
ParseUeCliCommand
(
std
::
vector
<
std
::
string
>
&&
tokens
,
std
::
string
&
error
,
std
::
string
&
output
);
}
// namespace app
\ No newline at end of file
src/gnb.cpp
View file @
267c5c46
...
...
@@ -24,7 +24,7 @@
static
app
::
CliServer
*
g_cliServer
=
nullptr
;
static
nr
::
gnb
::
GnbConfig
*
g_refConfig
=
nullptr
;
static
std
::
unordered_map
<
std
::
string
,
nr
::
gnb
::
GNodeB
*>
g_gnbMap
{};
static
app
::
CliResponseTask
*
g_cliRespTask
;
static
app
::
CliResponseTask
*
g_cliRespTask
=
nullptr
;
static
struct
Options
{
...
...
@@ -78,7 +78,7 @@ static nr::gnb::GnbConfig *ReadConfigYaml()
static
void
ReadOptions
(
int
argc
,
char
**
argv
)
{
opt
::
OptionsDescription
desc
{
cons
::
Project
,
cons
::
Tag
,
"5G-SA gNB implementation"
,
cons
::
Owner
,
"nr-
cli
"
,
{
"-c <config-file> [option...]"
},
cons
::
Owner
,
"nr-
gnb
"
,
{
"-c <config-file> [option...]"
},
true
};
opt
::
OptionItem
itemConfigFile
=
{
'c'
,
"config"
,
"Use specified configuration file for gNB"
,
"config-file"
};
...
...
src/ue.cpp
View file @
267c5c46
This diff is collapsed.
Click to expand it.
src/ue/nts.hpp
View file @
267c5c46
...
...
@@ -9,6 +9,8 @@
#pragma once
#include "types.hpp"
#include "ue.hpp"
#include <app/cli_base.hpp>
#include <nas/timer.hpp>
#include <rrc/rrc.hpp>
#include <urs/rls/rls.hpp>
...
...
@@ -253,4 +255,26 @@ struct NwUeStatusUpdate : NtsMessage
}
};
struct
NwUeCliCommand
:
NtsMessage
{
std
::
unique_ptr
<
app
::
UeCliCommand
>
cmd
;
InetAddress
address
;
NtsTask
*
callbackTask
;
NwUeCliCommand
(
std
::
unique_ptr
<
app
::
UeCliCommand
>
cmd
,
InetAddress
address
,
NtsTask
*
callbackTask
)
:
NtsMessage
(
NtsMessageType
::
UE_CLI_COMMAND
),
cmd
(
std
::
move
(
cmd
)),
address
(
address
),
callbackTask
(
callbackTask
)
{
}
void
sendResult
(
const
std
::
string
&
output
)
const
{
callbackTask
->
push
(
new
app
::
NwCliSendResponse
(
address
,
output
,
false
));
}
void
sendError
(
const
std
::
string
&
output
)
const
{
callbackTask
->
push
(
new
app
::
NwCliSendResponse
(
address
,
output
,
true
));
}
};
}
// namespace nr::ue
\ No newline at end of file
src/ue/ue.cpp
View file @
267c5c46
...
...
@@ -56,4 +56,10 @@ void UserEquipment::start()
taskBase
->
appTask
->
start
();
}
void
UserEquipment
::
pushCommand
(
std
::
unique_ptr
<
app
::
UeCliCommand
>
cmd
,
const
InetAddress
&
address
,
NtsTask
*
callbackTask
)
{
taskBase
->
appTask
->
push
(
new
NwUeCliCommand
(
std
::
move
(
cmd
),
address
,
callbackTask
));
}
}
// namespace nr::ue
src/ue/ue.hpp
View file @
267c5c46
...
...
@@ -9,6 +9,10 @@
#pragma once
#include "types.hpp"
#include <app/cli_cmd.hpp>
#include <memory>
#include <utils/network.hpp>
#include <utils/nts.hpp>
namespace
nr
::
ue
{
...
...
@@ -24,6 +28,7 @@ class UserEquipment
public:
void
start
();
void
pushCommand
(
std
::
unique_ptr
<
app
::
UeCliCommand
>
cmd
,
const
InetAddress
&
address
,
NtsTask
*
callbackTask
);
};
}
// namespace nr::ue
\ 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