From 235a14fce2503d2592f9fe58bd8611e97f99f7df Mon Sep 17 00:00:00 2001 From: imarom Date: Wed, 24 Feb 2016 08:58:54 -0500 Subject: RX - for not supported interfaces gives an error in JSON --- src/rpc-server/commands/trex_rpc_cmd_stream.cpp | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'src/rpc-server/commands/trex_rpc_cmd_stream.cpp') diff --git a/src/rpc-server/commands/trex_rpc_cmd_stream.cpp b/src/rpc-server/commands/trex_rpc_cmd_stream.cpp index 984c3f8e..86759f99 100644 --- a/src/rpc-server/commands/trex_rpc_cmd_stream.cpp +++ b/src/rpc-server/commands/trex_rpc_cmd_stream.cpp @@ -105,18 +105,23 @@ TrexRpcCmdAddStream::_run(const Json::Value ¶ms, Json::Value &result) { stream->m_rx_check.m_enabled = parse_bool(rx, "enabled", result); + TrexStatelessPort *port = get_stateless_obj()->get_port_by_id(stream->m_port_id); + /* if it is enabled - we need more fields */ if (stream->m_rx_check.m_enabled) { - stream->m_rx_check.m_user_id = parse_int(rx, "stream_id", result); - stream->m_rx_check.m_seq_enabled = parse_bool(rx, "seq_enabled", result); - stream->m_rx_check.m_latency = parse_bool(rx, "latency_enabled", result); + + if (port->get_rx_caps() == 0) { + generate_parse_err(result, "RX stats is not supported on this interface"); + } + + stream->m_rx_check.m_user_id = parse_int(rx, "stream_id", result); + stream->m_rx_check.m_seq_enabled = parse_bool(rx, "seq_enabled", result); + stream->m_rx_check.m_latency = parse_bool(rx, "latency_enabled", result); } /* make sure this is a valid stream to add */ validate_stream(stream, result); - TrexStatelessPort *port = get_stateless_obj()->get_port_by_id(stream->m_port_id); - try { port->add_stream(stream.get()); stream.release(); -- cgit 1.2.3-korg