Commit bdddb08c authored by aligungr's avatar aligungr

PS establishment over CLI

parent 720e879b
...@@ -21,12 +21,14 @@ ...@@ -21,12 +21,14 @@
return nullptr; \ return nullptr; \
} }
static opt::OptionsDescription Desc(const std::string &subCommand, const std::string &desc, const std::string &usage, static opt::OptionsDescription DefaultDesc(const std::string &subCommand, const std::string &desc,
bool helpIfEmpty) const std::string &usage, bool helpIfEmpty)
{ {
return {{}, {}, desc, {}, subCommand, {usage}, helpIfEmpty, true}; return {{}, {}, desc, {}, subCommand, {usage}, helpIfEmpty, true};
} }
using DescType = decltype(&DefaultDesc);
class OptionsHandler : public opt::IOptionsHandler class OptionsHandler : public opt::IOptionsHandler
{ {
public: public:
...@@ -63,6 +65,11 @@ static std::string DumpCommands(const OrderedMap<std::string, std::string> &desc ...@@ -63,6 +65,11 @@ static std::string DumpCommands(const OrderedMap<std::string, std::string> &desc
namespace app namespace app
{ {
static OrderedMap<std::string, DescType> g_gnbCmdToDescFunc = {
{"status", DefaultDesc}, {"info", DefaultDesc}, {"amf-list", DefaultDesc},
{"amf-info", DefaultDesc}, {"ue-list", DefaultDesc}, {"ue-count", DefaultDesc},
};
static OrderedMap<std::string, std::string> g_gnbCmdToDescription = { static OrderedMap<std::string, std::string> g_gnbCmdToDescription = {
{"status", "Show some status information about the gNB"}, {"status", "Show some status information about the gNB"},
{"info", "Show some information about the gNB"}, {"info", "Show some information about the gNB"},
...@@ -80,6 +87,12 @@ static OrderedMap<std::string, bool> g_gnbCmdToHelpIfEmpty = {{"status", false}, ...@@ -80,6 +87,12 @@ static OrderedMap<std::string, bool> g_gnbCmdToHelpIfEmpty = {{"status", false},
{"amf-list", false}, {"amf-info", true}, {"amf-list", false}, {"amf-info", true},
{"ue-list", false}, {"ue-count", false}}; {"ue-list", false}, {"ue-count", false}};
static OrderedMap<std::string, DescType> g_ueCmdToDescFunc = {
{"info", DefaultDesc}, {"status", DefaultDesc}, {"timers", DefaultDesc},
{"deregister", DefaultDesc}, {"ps-establish", DefaultDesc}, {"ps-release", DefaultDesc},
{"ps-release-all", DefaultDesc},
};
static OrderedMap<std::string, std::string> g_ueCmdToDescription = { static OrderedMap<std::string, std::string> g_ueCmdToDescription = {
{"info", "Show some information about the UE"}, {"info", "Show some information about the UE"},
{"status", "Show some status information about the UE"}, {"status", "Show some status information about the UE"},
...@@ -126,8 +139,8 @@ std::unique_ptr<GnbCliCommand> ParseGnbCliCommand(std::vector<std::string> &&tok ...@@ -126,8 +139,8 @@ std::unique_ptr<GnbCliCommand> ParseGnbCliCommand(std::vector<std::string> &&tok
return nullptr; return nullptr;
} }
opt::OptionsDescription desc = opt::OptionsDescription desc = g_gnbCmdToDescFunc[subCmd](subCmd, g_gnbCmdToDescription[subCmd],
Desc(subCmd, g_gnbCmdToDescription[subCmd], g_gnbCmdToUsage[subCmd], g_gnbCmdToHelpIfEmpty[subCmd]); g_gnbCmdToUsage[subCmd], g_gnbCmdToHelpIfEmpty[subCmd]);
OptionsHandler handler{}; OptionsHandler handler{};
...@@ -201,8 +214,8 @@ std::unique_ptr<UeCliCommand> ParseUeCliCommand(std::vector<std::string> &&token ...@@ -201,8 +214,8 @@ std::unique_ptr<UeCliCommand> ParseUeCliCommand(std::vector<std::string> &&token
return nullptr; return nullptr;
} }
opt::OptionsDescription desc = opt::OptionsDescription desc = g_ueCmdToDescFunc[subCmd](subCmd, g_ueCmdToDescription[subCmd],
Desc(subCmd, g_ueCmdToDescription[subCmd], g_ueCmdToUsage[subCmd], g_ueCmdToHelpIfEmpty[subCmd]); g_ueCmdToUsage[subCmd], g_ueCmdToHelpIfEmpty[subCmd]);
OptionsHandler handler{}; OptionsHandler handler{};
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment