Add support for gRPC authenticated communications

Also, make a few namespace corrections and some minor refactoring.

Change-Id: Iedcaf6b43cb7576bc11dfefe980abd190c838831
This commit is contained in:
Chris Freehill
2020-03-02 15:06:01 -06:00
parent 020f6939f7
commit 47fdfa4c7e
28 changed files with 824 additions and 43 deletions
+1 -1
View File
@@ -124,7 +124,7 @@ endif()
set(RDCTST_ROOT ${CMAKE_CURRENT_SOURCE_DIR})
set(RDCTST "rdctst")
set(RDCTST_LIBS "rdc_client")
set(RDCTST_LIBS "rdc_client_smi")
# Set Name for Google Test Framework and build it as a
# static library to be linked with user test programs
+2
View File
@@ -48,6 +48,7 @@ static void SetFlags(TestBase *test) {
test->set_init_options(sRDCGlvalues->init_options);
test->set_monitor_server_ip(sRDCGlvalues->monitor_server_ip);
test->set_monitor_server_port(sRDCGlvalues->monitor_server_port);
test->set_secure(sRDCGlvalues->secure);
}
static void RunCustomTestProlog(TestBase *test) {
@@ -201,6 +202,7 @@ int main(int argc, char** argv) {
settings.rdcd_path = "";
settings.monitor_server_ip = "";
settings.monitor_server_port = "";
settings.secure = true;
if (ProcessCmdline(&settings, argc, argv)) {
return 1;
+1 -1
View File
@@ -114,7 +114,7 @@ TestBase::AllocateRDCChannel(void) {
err = rdc_channel_create(&c,
monitor_server_ip() == "" ? nullptr : monitor_server_ip().c_str(),
monitor_server_port() == "" ? nullptr : monitor_server_port().c_str(),
false);
secure());
if (err != RDC_STATUS_SUCCESS) {
std::cout << "rdc_channel_create() failed" << std::endl;
+7 -1
View File
@@ -101,7 +101,12 @@ class TestBase {
std::string monitor_server_port(void) const {
return monitor_server_port_;
}
void set_secure(bool sec) {
secure_ = sec;
}
bool secure(void) const {
return secure_;
}
protected:
void PrintDeviceHeader(uint32_t dv_ind);
@@ -117,6 +122,7 @@ class TestBase {
std::string monitor_server_ip_;
std::string monitor_server_port_;
rdc_channel_t rdc_channel_;
bool secure_; // Use authenticated comms. (SSL/TSL)
};
#define IF_VERB(VB) if (verbosity() && verbosity() >= (TestBase::VERBOSE_##VB))
+9 -2
View File
@@ -106,11 +106,12 @@ static const struct option long_options[] = {
{"remote_server_port", required_argument, nullptr, 'p'},
{"start_rdcd", optional_argument, nullptr, 'd'},
{"dont_fail", no_argument, nullptr, 'f'},
{"unauth_comm", no_argument, nullptr, 'u'},
{"rdctst_help", no_argument, nullptr, 'r'},
{nullptr, 0, nullptr, 0}
};
static const char* short_options = "i:v:m:s:p:d:fr";
static const char* short_options = "i:v:m:s:p:d:fur";
static void PrintHelp(void) {
std::cout <<
@@ -130,7 +131,9 @@ static void PrintHelp(void) {
"--remote_server_ip <ip address>; connect to already running "
"rdcd on specified IP\n"
"--remote_server_port <remote port>; connect to already running "
"rdcd on specified IP at this port\n";
"rdcd on specified IP at this port\n"
"--unauth_comm; don't use TSL/SSL authentication; "
"default is with authentication\n";
}
uint32_t ProcessCmdline(RDCTstGlobals* test, int arg_cnt, char** arg_list) {
@@ -183,6 +186,10 @@ uint32_t ProcessCmdline(RDCTstGlobals* test, int arg_cnt, char** arg_list) {
test->dont_fail = true;
break;
case 'u':
test->secure = false;
break;
default:
std::cout << "Unknown command line option: \"" << a <<
"\". Ignoring..." << std::endl;
+1
View File
@@ -38,6 +38,7 @@ struct RDCTstGlobals {
uint32_t num_iterations;
uint64_t init_options;
bool dont_fail;
bool secure;
};
uint32_t ProcessCmdline(RDCTstGlobals* test, int arg_cnt, char** arg_list);