summaryrefslogtreecommitdiffstats
path: root/src/rpc-server/trex_rpc_server.cpp
diff options
context:
space:
mode:
authorimarom <imarom@cisco.com>2016-01-03 07:09:23 -0500
committerimarom <imarom@cisco.com>2016-01-04 10:02:59 -0500
commit82e65a02d2f9bdab552521a4859795937821f1be (patch)
tree631d29f5252fa24591155ede5c306c55f56265c2 /src/rpc-server/trex_rpc_server.cpp
parentfecdb3ea73b380e01a8877c8e88ce61e853000bc (diff)
simulation end to end
Diffstat (limited to 'src/rpc-server/trex_rpc_server.cpp')
-rw-r--r--src/rpc-server/trex_rpc_server.cpp23
1 files changed, 22 insertions, 1 deletions
diff --git a/src/rpc-server/trex_rpc_server.cpp b/src/rpc-server/trex_rpc_server.cpp
index a14e6f97..1dfc4494 100644
--- a/src/rpc-server/trex_rpc_server.cpp
+++ b/src/rpc-server/trex_rpc_server.cpp
@@ -63,6 +63,9 @@ void TrexRpcServerInterface::start() {
verbose_msg("Starting RPC Server");
+ /* prepare for run */
+ _prepare();
+
m_thread = new std::thread(&TrexRpcServerInterface::_rpc_thread_cb, this);
if (!m_thread) {
throw TrexRpcException("unable to create RPC thread");
@@ -117,9 +120,18 @@ TrexRpcServer::TrexRpcServer(const TrexRpcServerConfig *req_resp_cfg,
const TrexRpcServerConfig *async_cfg,
std::mutex *lock) {
+ m_req_resp = NULL;
+
/* add the request response server */
if (req_resp_cfg) {
- m_servers.push_back(new TrexRpcServerReqRes(*req_resp_cfg, lock));
+
+ if (req_resp_cfg->get_protocol() == TrexRpcServerConfig::RPC_PROT_MOCK) {
+ m_req_resp = new TrexRpcServerReqResMock(*req_resp_cfg);
+ } else {
+ m_req_resp = new TrexRpcServerReqRes(*req_resp_cfg, lock);
+ }
+
+ m_servers.push_back(m_req_resp);
}
/* add async publisher */
@@ -166,3 +178,12 @@ void TrexRpcServer::set_verbose(bool verbose) {
}
}
+
+std::string
+TrexRpcServer::test_inject_request(const std::string &req_str) {
+ if (m_req_resp) {
+ return m_req_resp->test_inject_request(req_str);
+ } else {
+ return "";
+ }
+}