summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorimarom <imarom@cisco.com>2015-11-25 07:39:39 -0500
committerimarom <imarom@cisco.com>2015-11-25 07:39:39 -0500
commitb6ec2066653319b60385de1d4117165eb88890a1 (patch)
tree582bda39a6d04641b3fd9481ca23d6ede53e5a17 /src
parent92dea3787ab7b2c9877af9cd539d42a6957f7da6 (diff)
fixed a bug with default start command in the console
also added clear events and more types of events
Diffstat (limited to 'src')
-rw-r--r--src/publisher/trex_publisher.h6
-rw-r--r--src/stateless/cp/trex_stateless_port.cpp9
2 files changed, 12 insertions, 3 deletions
diff --git a/src/publisher/trex_publisher.h b/src/publisher/trex_publisher.h
index 89336735..8d1be064 100644
--- a/src/publisher/trex_publisher.h
+++ b/src/publisher/trex_publisher.h
@@ -39,8 +39,10 @@ public:
void publish_json(const std::string &s);
enum event_type_e {
- EVENT_PORT_STOPPED = 0,
- EVENT_SERVER_STOPPED = 1
+ EVENT_PORT_STARTED = 0,
+ EVENT_PORT_STOPPED = 1,
+ EVENT_SERVER_STOPPED = 2,
+ EVENT_PORT_FINISHED_TX = 3,
};
void publish_event(event_type_e type, const Json::Value &data = Json::nullValue);
diff --git a/src/stateless/cp/trex_stateless_port.cpp b/src/stateless/cp/trex_stateless_port.cpp
index 5f1a3bca..2fd948fd 100644
--- a/src/stateless/cp/trex_stateless_port.cpp
+++ b/src/stateless/cp/trex_stateless_port.cpp
@@ -139,6 +139,9 @@ TrexStatelessPort::start_traffic(double mul, double duration) {
send_message_to_dp(start_msg);
+ Json::Value data;
+ data["port_id"] = m_port_id;
+ get_stateless_obj()->get_publisher()->publish_event(TrexPublisher::EVENT_PORT_STARTED, data);
}
void
@@ -194,6 +197,10 @@ TrexStatelessPort::stop_traffic(void) {
change_state(PORT_STATE_STREAMS);
+ Json::Value data;
+ data["port_id"] = m_port_id;
+ get_stateless_obj()->get_publisher()->publish_event(TrexPublisher::EVENT_PORT_STOPPED, data);
+
}
void
@@ -366,7 +373,7 @@ TrexStatelessPort::on_dp_event_occured(TrexDpPortEvent::event_e event_type) {
/* send a ZMQ event */
data["port_id"] = m_port_id;
- get_stateless_obj()->get_publisher()->publish_event(TrexPublisher::EVENT_PORT_STOPPED, data);
+ get_stateless_obj()->get_publisher()->publish_event(TrexPublisher::EVENT_PORT_FINISHED_TX, data);
break;
default: