From 17a932044bd9924fc4ea041b217c1814148a5533 Mon Sep 17 00:00:00 2001 From: Martin Klozik Date: Fri, 12 Jan 2018 10:25:15 +0000 Subject: trex: Improve error handling Print an error message in case, that vsperf is not able to connect to the T-Rex server. User is instructed to check if T-Rex server is up and running. Change-Id: I70c6d27fa8331921d43e25c5eaa3638ded6c015b Signed-off-by: Martin Klozik Reviewed-by: Jose Lausuch Reviewed-by: Al Morton Reviewed-by: Christian Trautman Reviewed-by: Sridhar Rao Reviewed-by: Trevor Cooper --- tools/pkt_gen/trex/trex.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'tools') diff --git a/tools/pkt_gen/trex/trex.py b/tools/pkt_gen/trex/trex.py index 5ce87b1d..cfe54b78 100644 --- a/tools/pkt_gen/trex/trex.py +++ b/tools/pkt_gen/trex/trex.py @@ -126,9 +126,14 @@ class Trex(ITrafficGenerator): 'T-Rex: Cannot locate Trex program at %s within %s' \ % (self._trex_host_ip_addr, self._trex_base_dir)) - self._stlclient = STLClient(username=self._trex_user, server=self._trex_host_ip_addr, - verbose_level=0) - self._stlclient.connect() + try: + self._stlclient = STLClient(username=self._trex_user, server=self._trex_host_ip_addr, + verbose_level=0) + self._stlclient.connect() + except STLError: + raise RuntimeError('T-Rex: Cannot connect to T-Rex server. Please check if it is ' + 'running and that firewall allows connection to TCP port 4501.') + self._logger.info("T-Rex: Trex host successfully found...") def disconnect(self): -- cgit 1.2.3-korg