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
54f7e1ff
Commit
54f7e1ff
authored
Feb 20, 2021
by
aligungr
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
UE/gNB executable refactor
parent
8c7e960e
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
39 additions
and
31 deletions
+39
-31
src/gnb.cpp
src/gnb.cpp
+8
-5
src/gnb/app/cmd_handler.cpp
src/gnb/app/cmd_handler.cpp
+18
-8
src/gnb/app/cmd_handler.hpp
src/gnb/app/cmd_handler.hpp
+4
-0
src/gnb/gnb.cpp
src/gnb/gnb.cpp
+4
-3
src/gnb/gnb.hpp
src/gnb/gnb.hpp
+2
-2
src/gnb/nts.hpp
src/gnb/nts.hpp
+2
-13
src/gnb/types.hpp
src/gnb/types.hpp
+1
-0
No files found.
src/gnb.cpp
View file @
54f7e1ff
...
...
@@ -153,7 +153,7 @@ static void ReceiveCommand(app::CliMessage &msg)
}
auto
*
gnb
=
g_gnbMap
[
msg
.
nodeName
];
gnb
->
pushCommand
(
std
::
move
(
cmd
),
msg
.
clientAddr
,
g_cliRespTask
);
gnb
->
pushCommand
(
std
::
move
(
cmd
),
msg
.
clientAddr
);
}
static
void
Loop
()
...
...
@@ -196,15 +196,18 @@ int main(int argc, char **argv)
std
::
cout
<<
cons
::
Name
<<
std
::
endl
;
auto
*
gnb
=
new
nr
::
gnb
::
GNodeB
(
g_refConfig
,
nullptr
);
if
(
!
g_options
.
disableCmd
)
{
g_cliServer
=
new
app
::
CliServer
{};
g_cliRespTask
=
new
app
::
CliResponseTask
(
g_cliServer
);
}
auto
*
gnb
=
new
nr
::
gnb
::
GNodeB
(
g_refConfig
,
nullptr
,
g_cliRespTask
);
g_gnbMap
[
g_refConfig
->
name
]
=
gnb
;
if
(
!
g_options
.
disableCmd
)
{
g_cliServer
=
new
app
::
CliServer
{};
app
::
CreateProcTable
(
g_gnbMap
,
g_cliServer
->
assignedAddress
().
getPort
());
g_cliRespTask
=
new
app
::
CliResponseTask
(
g_cliServer
);
g_cliRespTask
->
start
();
}
...
...
src/gnb/app/cmd_handler.cpp
View file @
54f7e1ff
...
...
@@ -23,6 +23,16 @@
namespace
nr
::
gnb
{
void
GnbCmdHandler
::
sendResult
(
const
InetAddress
&
address
,
const
std
::
string
&
output
)
{
m_base
->
cliCallbackTask
->
push
(
new
app
::
NwCliSendResponse
(
address
,
output
,
false
));
}
void
GnbCmdHandler
::
sendError
(
const
InetAddress
&
address
,
const
std
::
string
&
output
)
{
m_base
->
cliCallbackTask
->
push
(
new
app
::
NwCliSendResponse
(
address
,
output
,
true
));
}
void
GnbCmdHandler
::
pauseTasks
()
{
m_base
->
gtpTask
->
requestPause
();
...
...
@@ -77,7 +87,7 @@ void GnbCmdHandler::handleCmd(NwGnbCliCommand &msg)
if
(
!
isPaused
)
{
msg
.
sendError
(
"gNB is unable process command due to pausing timeout"
);
sendError
(
msg
.
address
,
"gNB is unable process command due to pausing timeout"
);
}
else
{
...
...
@@ -92,27 +102,27 @@ void GnbCmdHandler::handleCmdImpl(NwGnbCliCommand &msg)
switch
(
msg
.
cmd
->
present
)
{
case
app
:
:
GnbCliCommand
::
STATUS
:
{
msg
.
sendResult
(
ToJson
(
m_base
->
appTask
->
m_statusInfo
).
dumpYaml
());
sendResult
(
msg
.
address
,
ToJson
(
m_base
->
appTask
->
m_statusInfo
).
dumpYaml
());
break
;
}
case
app
:
:
GnbCliCommand
::
INFO
:
{
msg
.
sendResult
(
ToJson
(
*
m_base
->
config
).
dumpYaml
());
sendResult
(
msg
.
address
,
ToJson
(
*
m_base
->
config
).
dumpYaml
());
break
;
}
case
app
:
:
GnbCliCommand
::
AMF_LIST
:
{
Json
json
=
Json
::
Arr
({});
for
(
auto
&
amf
:
m_base
->
ngapTask
->
m_amfCtx
)
json
.
push
(
Json
::
Obj
({{
"id"
,
amf
.
first
}}));
msg
.
sendResult
(
json
.
dumpYaml
());
sendResult
(
msg
.
address
,
json
.
dumpYaml
());
break
;
}
case
app
:
:
GnbCliCommand
::
AMF_INFO
:
{
if
(
m_base
->
ngapTask
->
m_amfCtx
.
count
(
msg
.
cmd
->
amfId
)
==
0
)
msg
.
sendError
(
"AMF not found with given ID"
);
sendError
(
msg
.
address
,
"AMF not found with given ID"
);
else
{
auto
amf
=
m_base
->
ngapTask
->
m_amfCtx
[
msg
.
cmd
->
amfId
];
msg
.
sendResult
(
ToJson
(
*
amf
).
dumpYaml
());
sendResult
(
msg
.
address
,
ToJson
(
*
amf
).
dumpYaml
());
}
break
;
}
...
...
@@ -126,11 +136,11 @@ void GnbCmdHandler::handleCmdImpl(NwGnbCliCommand &msg)
{
"amf-ngap-id"
,
ue
.
second
->
amfUeNgapId
},
}));
}
msg
.
sendResult
(
json
.
dumpYaml
());
sendResult
(
msg
.
address
,
json
.
dumpYaml
());
break
;
}
case
app
:
:
GnbCliCommand
::
UE_COUNT
:
{
msg
.
sendResult
(
std
::
to_string
(
m_base
->
ngapTask
->
m_ueCtx
.
size
()));
sendResult
(
msg
.
address
,
std
::
to_string
(
m_base
->
ngapTask
->
m_ueCtx
.
size
()));
break
;
}
}
...
...
src/gnb/app/cmd_handler.hpp
View file @
54f7e1ff
...
...
@@ -33,6 +33,10 @@ class GnbCmdHandler
private:
void
handleCmdImpl
(
NwGnbCliCommand
&
msg
);
private:
void
sendResult
(
const
InetAddress
&
address
,
const
std
::
string
&
output
);
void
sendError
(
const
InetAddress
&
address
,
const
std
::
string
&
output
);
};
}
// namespace nr::gnb
src/gnb/gnb.cpp
View file @
54f7e1ff
...
...
@@ -20,12 +20,13 @@
namespace
nr
::
gnb
{
GNodeB
::
GNodeB
(
GnbConfig
*
config
,
app
::
INodeListener
*
nodeListener
)
GNodeB
::
GNodeB
(
GnbConfig
*
config
,
app
::
INodeListener
*
nodeListener
,
NtsTask
*
cliCallbackTask
)
{
auto
*
base
=
new
TaskBase
();
base
->
config
=
config
;
base
->
logBase
=
new
LogBase
(
"logs/"
+
config
->
name
+
".log"
);
base
->
nodeListener
=
nodeListener
;
base
->
cliCallbackTask
=
cliCallbackTask
;
base
->
appTask
=
new
GnbAppTask
(
base
);
base
->
sctpTask
=
new
SctpTask
(
base
);
...
...
@@ -68,9 +69,9 @@ void GNodeB::start()
taskBase
->
gtpTask
->
start
();
}
void
GNodeB
::
pushCommand
(
std
::
unique_ptr
<
app
::
GnbCliCommand
>
cmd
,
const
InetAddress
&
address
,
NtsTask
*
callbackTask
)
void
GNodeB
::
pushCommand
(
std
::
unique_ptr
<
app
::
GnbCliCommand
>
cmd
,
const
InetAddress
&
address
)
{
taskBase
->
appTask
->
push
(
new
NwGnbCliCommand
(
std
::
move
(
cmd
),
address
,
callbackTask
));
taskBase
->
appTask
->
push
(
new
NwGnbCliCommand
(
std
::
move
(
cmd
),
address
));
}
}
// namespace nr::gnb
src/gnb/gnb.hpp
View file @
54f7e1ff
...
...
@@ -27,12 +27,12 @@ class GNodeB
TaskBase
*
taskBase
;
public:
GNodeB
(
GnbConfig
*
config
,
app
::
INodeListener
*
nodeListener
);
GNodeB
(
GnbConfig
*
config
,
app
::
INodeListener
*
nodeListener
,
NtsTask
*
cliCallbackTask
);
virtual
~
GNodeB
();
public:
void
start
();
void
pushCommand
(
std
::
unique_ptr
<
app
::
GnbCliCommand
>
cmd
,
const
InetAddress
&
address
,
NtsTask
*
callbackTask
);
void
pushCommand
(
std
::
unique_ptr
<
app
::
GnbCliCommand
>
cmd
,
const
InetAddress
&
address
);
};
}
// namespace nr::gnb
\ No newline at end of file
src/gnb/nts.hpp
View file @
54f7e1ff
...
...
@@ -246,22 +246,11 @@ struct NwGnbCliCommand : NtsMessage
{
std
::
unique_ptr
<
app
::
GnbCliCommand
>
cmd
;
InetAddress
address
;
NtsTask
*
callbackTask
;
NwGnbCliCommand
(
std
::
unique_ptr
<
app
::
GnbCliCommand
>
cmd
,
InetAddress
address
,
NtsTask
*
callbackTask
)
:
NtsMessage
(
NtsMessageType
::
GNB_CLI_COMMAND
),
cmd
(
std
::
move
(
cmd
)),
address
(
address
)
,
callbackTask
(
callbackTask
)
NwGnbCliCommand
(
std
::
unique_ptr
<
app
::
GnbCliCommand
>
cmd
,
InetAddress
address
)
:
NtsMessage
(
NtsMessageType
::
GNB_CLI_COMMAND
),
cmd
(
std
::
move
(
cmd
)),
address
(
address
)
{
}
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::gnb
src/gnb/types.hpp
View file @
54f7e1ff
...
...
@@ -316,6 +316,7 @@ struct TaskBase
GnbConfig
*
config
{};
LogBase
*
logBase
{};
app
::
INodeListener
*
nodeListener
{};
NtsTask
*
cliCallbackTask
{};
GnbAppTask
*
appTask
{};
GtpTask
*
gtpTask
{};
...
...
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