Skip monitoring ports when providing empty list of port
Change-Id: Id40690eb7eaf755f49b8996206513eb0bdf96c18
diff --git a/TestON/drivers/common/api/controller/trexclientdriver.py b/TestON/drivers/common/api/controller/trexclientdriver.py
index 50c8c39..1150d4c 100644
--- a/TestON/drivers/common/api/controller/trexclientdriver.py
+++ b/TestON/drivers/common/api/controller/trexclientdriver.py
@@ -364,15 +364,18 @@
:param ports: List of ports ids to monitor
:param time_interval: Interval between read
- :return: Statistics read while traffic is active
+ :return: Statistics read while traffic is active, or empty result if no
+ ports provided.
"""
-
results = {
port_id: {"rx_bps": [], "tx_bps": [], "rx_pps": [], "tx_pps": []}
for port_id in ports
}
results["duration"] = []
+ if not ports:
+ return results
+
prev = {
port_id: {
"opackets": 0,