diff options
author | Martin Klozik <martinx.klozik@intel.com> | 2018-01-04 07:13:16 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@opnfv.org> | 2018-01-04 07:13:16 +0000 |
commit | b47717bb0cf09f739feb4ee9b47173c28581bf20 (patch) | |
tree | 9aa0a14a1894b2eac155c3d29f3b1a071fc29efe /core | |
parent | 06777111066517cc005d6543ce1a22371745a4b3 (diff) | |
parent | 4e48e84741d3dd00417c239f6e98f4a0fbfa586a (diff) |
Merge "trafficgen: Postponed call of connect()"
Diffstat (limited to 'core')
-rw-r--r-- | core/traffic_controller.py | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/core/traffic_controller.py b/core/traffic_controller.py index d6e7629c..de82dddf 100644 --- a/core/traffic_controller.py +++ b/core/traffic_controller.py @@ -43,6 +43,7 @@ class TrafficController(object): self._duration = None self._lossrate = None self._packet_sizes = None + self._connected = False self._mode = str(settings.getValue('mode')).lower() self._results = [] @@ -51,6 +52,10 @@ class TrafficController(object): """Set configuration values just before test execution so they can be changed during runtime by test steps. """ + if not self._connected: + self._traffic_gen_class.connect() + self._connected = True + self._duration = int(settings.getValue('TRAFFICGEN_DURATION')) self._lossrate = float(settings.getValue('TRAFFICGEN_LOSSRATE')) self._packet_sizes = settings.getValue('TRAFFICGEN_PKT_SIZES') @@ -62,7 +67,7 @@ class TrafficController(object): def __enter__(self): """Call initialisation function. """ - self._traffic_gen_class.connect() + pass def __exit__(self, type_, value, traceback): """Stop traffic, clean up. |