diff options
author | DanielMartinBuckley <daniel.m.buckley@intel.com> | 2019-01-23 11:11:00 +0000 |
---|---|---|
committer | Daniel Martin Buckley <daniel.m.buckley@intel.com> | 2019-02-04 13:05:29 +0000 |
commit | deea27f8e9c99b0a547b4c8c2f39dd99d5c4f1a8 (patch) | |
tree | 42fd48fc85be39cd60aa564ac8468bc0223249c4 | |
parent | 7798690cb936d49e6e05b599afe79f047c172e43 (diff) |
Trex client not starting in 4 port baremetal
JIRA: YARDSTICK-1589
After calling STLclient.connect() there is no check if
connection was sucessfull or not.
Added a check for success on connect, retry if failure
and disconnect and connect on timeout.
If still connect failed then do not resume .. end with
LOG.critial and exit.
Change-Id: Ifd306b7920d9acbc16681cf79bf952d5af31eb64
Signed-off-by: Daniel Martin Buckley <daniel.m.buckley@intel.com>
-rw-r--r-- | yardstick/network_services/vnf_generic/vnf/sample_vnf.py | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/yardstick/network_services/vnf_generic/vnf/sample_vnf.py b/yardstick/network_services/vnf_generic/vnf/sample_vnf.py index 6ae393bc4..aec085057 100644 --- a/yardstick/network_services/vnf_generic/vnf/sample_vnf.py +++ b/yardstick/network_services/vnf_generic/vnf/sample_vnf.py @@ -405,6 +405,10 @@ class ClientResourceHelper(ResourceHelper): try: self._build_ports() self.client = self._connect() + if self.client is None: + LOG.critical("Failure to Connect ... unable to continue") + return + self.client.reset(ports=self.all_ports) self.client.remove_all_streams(self.all_ports) # remove all streams traffic_profile.register_generator(self) @@ -454,16 +458,28 @@ class ClientResourceHelper(ResourceHelper): server=self.vnfd_helper.mgmt_interface["ip"], verbose_level=LoggerApi.VERBOSE_QUIET) - # try to connect with 5s intervals, 30s max + # try to connect with 5s intervals for idx in range(6): try: client.connect() - break + for idx2 in range(6): + if client.is_connected(): + return client + LOG.info("Waiting to confirm connection %s .. Attempt %s", + idx, idx2) + time.sleep(1) + client.disconnect(stop_traffic=True, release_ports=True) except STLError: LOG.info("Unable to connect to Trex Server.. Attempt %s", idx) time.sleep(5) - return client + if client.is_connected(): + return client + else: + LOG.critical("Connection failure ..TRex username: %s server: %s", + self.vnfd_helper.mgmt_interface["user"], + self.vnfd_helper.mgmt_interface["ip"]) + return None class Rfc2544ResourceHelper(object): |